@ekolabs/eko-gallery-react 4.0.4 → 4.0.5-bby-debug-logs-1155695.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- "use strict";var e=require("react");function n(t="v1"){return function(e,n="*",i=""){let r=`https://${i}play.eko.com/api/${t}/channels/${e}/configs`;return r+="*"!==n?`/${n}`:"",r}}function i(t){return"object"==typeof t&&!Array.isArray(t)&&null!==t}var r={pack:function(t){const e={};if(!i(t))return e;if(t.itemId&&(e.item_id=t.itemId),t.itemName&&(e.item_name=t.itemName),i(t.itemPrice)){const n=t.itemPrice;e.item_price=function(t){const e={};return i(t)&&(t.amount&&(e.amount=Number(t.amount)),t.currency&&(e.currency=t.currency)),e}(n)}return t.quantity&&(e.quantity=Number(t.quantity)),e}};const o="mobile",s="notmobile";function a(){return((window.navigator.userAgentData?window.navigator.userAgentData.mobile:navigator.maxTouchPoints>0&&/Mobile|Android|webOS|iPhone|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&!/Tablet|iPad/i.test(navigator.userAgent))?o:s)===o}const l={};class c{constructor(t){this.key=`eko.${t}`}setDataStorage(t,e){if("undefined"!=typeof window)try{var n,i;let r=null===(n=window.localStorage)||void 0===n?void 0:n.getItem(this.key);r=JSON.parse(r)||{},r[t]=e,null===(i=window.localStorage)||void 0===i||i.setItem(this.key,JSON.stringify(r))}catch(t){console.error(`[setDataStorage]: ${t}`)}}getDataStorage(t){if("undefined"!=typeof window)try{var e;let n=null===(e=window.localStorage)||void 0===e?void 0:e.getItem(this.key);return n=JSON.parse(n)||{},n[t]}catch(t){console.error(`[getDataStorage]: ${t}`)}}removeDataStorage(t){if("undefined"!=typeof window)try{var e;let i=null===(e=window.localStorage)||void 0===e?void 0:e.getItem(this.key);var n;if(i)if(i=JSON.parse(i),delete i[t],Object.keys(i).length>0)null===(n=window.localStorage)||void 0===n||n.setItem(this.key,JSON.stringify(i));else this.removeAll()}catch(t){console.error(`[removeDataStorage]: ${t}`)}}removeAll(){if("undefined"!=typeof window)try{var t;null===(t=window.localStorage)||void 0===t||t.removeItem(this.key)}catch(t){console.error(`[removeAll]: ${t}`)}}}function u(t){return l[t]||(l[t]=new c(t)),l[t]}const d=u("gallery-react").getDataStorage("gallery-react");function h(t){window.EkoAnalytics("registerContextPacker",{tag:t,match:/.*/,schema:"iglu:com.helloeko/products/jsonschema/1-0-1",getData(t={}){var e,n;if(t.items)return{items:t.items.map((t=>function(t){const e=r.pack(t);return t.id&&(e.id=t.id),t.sku&&(e.sku=t.sku),t.upc&&(e.upc=t.upc),t.name&&(e.name=t.name),e}(t)))};const i=(null===(e=window.eko)||void 0===e||null===(e=e.config)||void 0===e?void 0:e.product)||(null==d||null===(n=d.config)||void 0===n?void 0:n.product);if(i){return{items:[{id:i.id,item_id:i.sku,sku:i.sku,upc:i.upc,typeid:i.type,name:i.name}]}}return null}})}function f(t){return"object"==typeof t&&!Array.isArray(t)&&null!==t}function p(t){const e={};return f(t)&&(t.amount&&(e.amount=Number(t.amount)),t.currency&&(e.currency=t.currency)),e}var m={isObject:f,pricePack:p,itemPack:function(t){const e={};if(!f(t))return e;if(t.itemId&&(e.item_id=t.itemId),t.itemName&&(e.item_name=t.itemName),f(t.itemPrice)){const n=t.itemPrice;e.item_price=p(n)}return t.quantity&&(e.quantity=Number(t.quantity)),t.sellingPlan&&(e.selling_plan=function(t){const e={};return f(t)&&(t.id&&(e.id=t.id),t.name&&(e.name=t.name)),e}(t.sellingPlan)),e}};const v=u("gallery-react").getDataStorage("gallery-react");const g=u("gallery-react").getDataStorage("gallery-react");const y=u("gallery-react").getDataStorage("gallery-react");const b="eko-gallery-react";var k={register:function(){var t;t=b,window.EkoAnalytics("registerContextPacker",{tag:t,schema:"iglu:com.helloeko/page/jsonschema/1-0-0",match:/^pixel\..*/,getData:function(){return{url:document.location.href||"",referrer:document.referrer||"",title:document.title||""}}}),h(b),function(t){window.EkoAnalytics("registerContextPacker",{tag:t,schema:"iglu:com.helloeko/cart/jsonschema/1-0-1",match:/pixel\.cart\.(add|remove)$/,getData(t){const e={};if((t=t||{}).cartId&&(e.cart_id=t.cartId),Array.isArray(t.items)&&(e.items=t.items.map((t=>m.itemPack(t)))),m.isObject(t.totalPrice)){const n=t.totalPrice;e.total_price=m.pricePack(n)}return t.totalQuantity&&(e.total_quantity=Number(t.totalQuantity)),e}})}(b),function(t){window.EkoAnalytics("registerContextPacker",{tag:t,schema:"iglu:com.helloeko/organization/jsonschema/1-0-0",match:/.*/,getData:function(){var t,e;const n=(null===(t=window.eko)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.customer)||(null==v||null===(e=v.config)||void 0===e?void 0:e.customer);if(n)return{id:null==n?void 0:n.organizationId}}})}(b),function(t){window.EkoAnalytics("registerContextPacker",{tag:t,schema:"iglu:com.helloeko/space/jsonschema/1-0-2",match:/.*/,getData:function(){var t,e;const n=(null===(t=window.eko)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.customer)||(null==g||null===(e=g.config)||void 0===e?void 0:e.customer);if(n)return{id:null==n?void 0:n.spaceId}}})}(b),function(t){window.EkoAnalytics("registerContextPacker",{tag:t,schema:"iglu:com.helloeko/asset/jsonschema/1-0-1",match:/.*/,getData:function(t){var e,n;if(null!=t&&t.type&&null!=t&&t.publishitemid&&null!=t&&t.name)return{deliverableid:"",publishitemid:null==t?void 0:t.publishitemid,type:null==t?void 0:t.type,name:null==t?void 0:t.name,artifactid:""};const i=null===(e=window.eko)||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.__autoGenerated)||void 0===e?void 0:e.publishItem,r=null==y||null===(n=y.config)||void 0===n||null===(n=n.__autoGenerated)||void 0===n?void 0:n.publishItem,o=i||r;return o?{deliverableid:"",publishitemid:null==o?void 0:o.id,type:"interactive",name:"",artifactid:""}:void 0}})}(b),function(t){window.EkoAnalytics("registerContextPacker",{tag:t,schema:"iglu:com.helloeko/traffic_allocation/jsonschema/1-0-0",match:"trafficallocation.decision",getData:function(t){if(!t)return;const e={decision:t.decision};return t.config&&(e.config=t.config),isNaN(t.traffic_split)||(e.traffic_split=t.traffic_split),t.provider&&(e.provider=t.provider),e}})}(b),function(t){window.EkoAnalytics("registerContextPacker",{tag:t,schema:"iglu:com.helloeko/checkout/jsonschema/1-0-4",match:/pixel\.(checkout|order)$/,getData(t){const e={};if((t=t||{}).checkoutId&&(e.checkout_id=t.checkoutId),Array.isArray(t.items)&&(e.items=t.items.map((t=>m.itemPack(t)))),m.isObject(t.totalPrice)){const n=t.totalPrice;e.total_price=m.pricePack(n)}return t.totalQuantity&&(e.total_quantity=Number(t.totalQuantity)),e}})}(b),function(t){window.EkoAnalytics("registerContextPacker",{tag:t,schema:"iglu:com.helloeko/order/jsonschema/1-0-2",match:"pixel.order",getData(t){const e={};if((t=t||{}).orderId&&(e.order_id=t.orderId),Array.isArray(t.items)&&(e.items=t.items.map((t=>m.itemPack(t)))),m.isObject(t.totalPrice)){const n=t.totalPrice;e.total_price=m.pricePack(n)}return t.totalQuantity&&(e.total_quantity=Number(t.totalQuantity)),e}})}(b)}};function x(t,e){let n="";try{n=window[t].getItem(e),n||(n=function(t){const e=document.cookie.split(";");for(let n=0;n<e.length;n++){const i=e[n].trim();if(0===i.indexOf(t+"="))return i.substring(t.length+1)}return""}(e))}catch(t){console.warn("[eko-gallery-react] Error while getting the id from storage:",e,t)}return n}function w(t){let e=Array.isArray(t.items)?t.items:[t];return e=e.map((t=>({itemId:t.id,itemName:t.name,itemPrice:t.price,quantity:t.quantity||1,variantId:t.variantId,sellingPlan:t.sellingPlan}))),e}function _(t){return{cartId:t.cartId,items:w(t),totalPrice:t.totalPrice,totalQuantity:t.totalQuantity}}var T={"pixel.cart.add":_,"pixel.cart.remove":_,"pixel.product_viewed":function(t){let e=w(t);return e=e.map((t=>function(t){let e=x("localStorage","eko.metadata");if(e&&e[t.itemId]){let n=e[t.itemId].product;t.id=null==n?void 0:n.id,t.sku=null==n?void 0:n.sku,t.upc=null==n?void 0:n.upc,t.name=null==n?void 0:n.name}return t}(t))),{items:e}},"pixel.checkout":function(t){return{checkoutId:t.checkoutId,items:w(t),totalPrice:t.totalPrice,totalQuantity:t.totalQuantity}},"pixel.order":function(t){return{checkoutId:t.checkoutId,orderId:t.orderId,items:w(t),totalPrice:t.totalPrice,totalQuantity:t.totalQuantity}}};const I="https://storage.eko.com/efu/ekoanalytics/master/latest/EkoAnalyticsPlatform.min.gz.js";let E=!1;var S={init:function(t){k.register(),function(t){if(E)return;let e=t?window.location.host:"development";const n=document.createElement("script");n.setAttribute("pxid",e),n.type="text/javascript",n.async=!0,n.src=I,document.body.appendChild(n),E=!0}(t)},onRouteChanged:function(){window.EkoAnalytics("reset")},track:function(t,e){T[t]&&(e=T[t](e)),window.EkoAnalytics("track",t,e)}};function A(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}function N(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function M(t,e){return t.get(A(t,e))}function F(t,e,n){N(t,e),e.set(t,n)}function C(t,e,n){return t.set(A(t,e),n),n}function O(t,e){N(t,e),e.add(t)}function P(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function R(){return R=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},R.apply(null,arguments)}function D(t,e){return t(e={exports:{}},e.exports),e.exports
1
+ "use strict";var e=require("react");function n(e="v1"){return function(t,n="*",i=""){let r=`https://${i}play.eko.com/api/${e}/channels/${t}/configs`;return r+="*"!==n?`/${n}`:"",r}}function i(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}var r={pack:function(e){const t={};if(!i(e))return t;if(e.itemId&&(t.item_id=e.itemId),e.itemName&&(t.item_name=e.itemName),i(e.itemPrice)){const n=e.itemPrice;t.item_price=function(e){const t={};return i(e)&&(e.amount&&(t.amount=Number(e.amount)),e.currency&&(t.currency=e.currency)),t}(n)}return e.quantity&&(t.quantity=Number(e.quantity)),t}};const o="mobile",s="notmobile";function a(){return((window.navigator.userAgentData?window.navigator.userAgentData.mobile:navigator.maxTouchPoints>0&&/Mobile|Android|webOS|iPhone|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&!/Tablet|iPad/i.test(navigator.userAgent))?o:s)===o}const l={};class c{constructor(e){this.key=`eko.${e}`}setDataStorage(e,t){if("undefined"!=typeof window)try{var n,i;let r=null===(n=window.localStorage)||void 0===n?void 0:n.getItem(this.key);r=JSON.parse(r)||{},r[e]=t,null===(i=window.localStorage)||void 0===i||i.setItem(this.key,JSON.stringify(r))}catch(e){console.error(`[setDataStorage]: ${e}`)}}getDataStorage(e){if("undefined"!=typeof window)try{var t;let n=null===(t=window.localStorage)||void 0===t?void 0:t.getItem(this.key);return n=JSON.parse(n)||{},n[e]}catch(e){console.error(`[getDataStorage]: ${e}`)}}removeDataStorage(e){if("undefined"!=typeof window)try{var t;let i=null===(t=window.localStorage)||void 0===t?void 0:t.getItem(this.key);var n;if(i)if(i=JSON.parse(i),delete i[e],Object.keys(i).length>0)null===(n=window.localStorage)||void 0===n||n.setItem(this.key,JSON.stringify(i));else this.removeAll()}catch(e){console.error(`[removeDataStorage]: ${e}`)}}removeAll(){if("undefined"!=typeof window)try{var e;null===(e=window.localStorage)||void 0===e||e.removeItem(this.key)}catch(e){console.error(`[removeAll]: ${e}`)}}}function u(e){return l[e]||(l[e]=new c(e)),l[e]}const d=u("gallery-react").getDataStorage("gallery-react");function h(e){window.EkoAnalytics("registerContextPacker",{tag:e,match:/.*/,schema:"iglu:com.helloeko/products/jsonschema/1-0-1",getData(e={}){var t,n;if(e.items)return{items:e.items.map((e=>function(e){const t=r.pack(e);return e.id&&(t.id=e.id),e.sku&&(t.sku=e.sku),e.upc&&(t.upc=e.upc),e.name&&(t.name=e.name),t}(e)))};const i=(null===(t=window.eko)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.product)||(null==d||null===(n=d.config)||void 0===n?void 0:n.product);if(i){return{items:[{id:i.id,item_id:i.sku,sku:i.sku,upc:i.upc,typeid:i.type,name:i.name}]}}return null}})}function f(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}function p(e){const t={};return f(e)&&(e.amount&&(t.amount=Number(e.amount)),e.currency&&(t.currency=e.currency)),t}var m={isObject:f,pricePack:p,itemPack:function(e){const t={};if(!f(e))return t;if(e.itemId&&(t.item_id=e.itemId),e.itemName&&(t.item_name=e.itemName),f(e.itemPrice)){const n=e.itemPrice;t.item_price=p(n)}return e.quantity&&(t.quantity=Number(e.quantity)),e.sellingPlan&&(t.selling_plan=function(e){const t={};return f(e)&&(e.id&&(t.id=e.id),e.name&&(t.name=e.name)),t}(e.sellingPlan)),t}};const v=u("gallery-react").getDataStorage("gallery-react");const g=u("gallery-react").getDataStorage("gallery-react");const y=u("gallery-react").getDataStorage("gallery-react");const b="eko-gallery-react";var k={register:function(){!function(e){window.EkoAnalytics("registerContextPacker",{tag:e,schema:"iglu:com.helloeko/page/jsonschema/1-0-0",match:/^pixel\..*/,getData:function(){return{url:document.location.href||"",referrer:document.referrer||"",title:document.title||""}}})}(b),h(b),function(e){window.EkoAnalytics("registerContextPacker",{tag:e,schema:"iglu:com.helloeko/cart/jsonschema/1-0-1",match:/pixel\.cart\.(add|remove)$/,getData(e){const t={};if((e=e||{}).cartId&&(t.cart_id=e.cartId),Array.isArray(e.items)&&(t.items=e.items.map((e=>m.itemPack(e)))),m.isObject(e.totalPrice)){const n=e.totalPrice;t.total_price=m.pricePack(n)}return e.totalQuantity&&(t.total_quantity=Number(e.totalQuantity)),t}})}(b),function(e){window.EkoAnalytics("registerContextPacker",{tag:e,schema:"iglu:com.helloeko/organization/jsonschema/1-0-0",match:/.*/,getData:function(){var e,t;const n=(null===(e=window.eko)||void 0===e||null===(e=e.config)||void 0===e?void 0:e.customer)||(null==v||null===(t=v.config)||void 0===t?void 0:t.customer);if(n)return{id:null==n?void 0:n.organizationId}}})}(b),function(e){window.EkoAnalytics("registerContextPacker",{tag:e,schema:"iglu:com.helloeko/space/jsonschema/1-0-2",match:/.*/,getData:function(){var e,t;const n=(null===(e=window.eko)||void 0===e||null===(e=e.config)||void 0===e?void 0:e.customer)||(null==g||null===(t=g.config)||void 0===t?void 0:t.customer);if(n)return{id:null==n?void 0:n.spaceId}}})}(b),function(e){window.EkoAnalytics("registerContextPacker",{tag:e,schema:"iglu:com.helloeko/asset/jsonschema/1-0-1",match:/.*/,getData:function(e){var t,n;if(null!=e&&e.type&&null!=e&&e.publishitemid&&null!=e&&e.name)return{deliverableid:"",publishitemid:null==e?void 0:e.publishitemid,type:null==e?void 0:e.type,name:null==e?void 0:e.name,artifactid:""};const i=null===(t=window.eko)||void 0===t||null===(t=t.config)||void 0===t||null===(t=t.__autoGenerated)||void 0===t?void 0:t.publishItem,r=null==y||null===(n=y.config)||void 0===n||null===(n=n.__autoGenerated)||void 0===n?void 0:n.publishItem,o=i||r;return o?{deliverableid:"",publishitemid:null==o?void 0:o.id,type:"interactive",name:"",artifactid:""}:void 0}})}(b),function(e){window.EkoAnalytics("registerContextPacker",{tag:e,schema:"iglu:com.helloeko/traffic_allocation/jsonschema/1-0-0",match:"trafficallocation.decision",getData:function(e){if(!e)return;const t={decision:e.decision};return e.config&&(t.config=e.config),isNaN(e.traffic_split)||(t.traffic_split=e.traffic_split),e.provider&&(t.provider=e.provider),t}})}(b),function(e){window.EkoAnalytics("registerContextPacker",{tag:e,schema:"iglu:com.helloeko/checkout/jsonschema/1-0-4",match:/pixel\.(checkout|order)$/,getData(e){const t={};if((e=e||{}).checkoutId&&(t.checkout_id=e.checkoutId),Array.isArray(e.items)&&(t.items=e.items.map((e=>m.itemPack(e)))),m.isObject(e.totalPrice)){const n=e.totalPrice;t.total_price=m.pricePack(n)}return e.totalQuantity&&(t.total_quantity=Number(e.totalQuantity)),t}})}(b),function(e){window.EkoAnalytics("registerContextPacker",{tag:e,schema:"iglu:com.helloeko/order/jsonschema/1-0-2",match:"pixel.order",getData(e){const t={};if((e=e||{}).orderId&&(t.order_id=e.orderId),Array.isArray(e.items)&&(t.items=e.items.map((e=>m.itemPack(e)))),m.isObject(e.totalPrice)){const n=e.totalPrice;t.total_price=m.pricePack(n)}return e.totalQuantity&&(t.total_quantity=Number(e.totalQuantity)),t}})}(b)}};function x(e,t){let n="";try{n=window[e].getItem(t),n||(n=function(e){const t=document.cookie.split(";");for(let n=0;n<t.length;n++){const i=t[n].trim();if(0===i.indexOf(e+"="))return i.substring(e.length+1)}return""}(t))}catch(e){console.warn("[eko-gallery-react] Error while getting the id from storage:",t,e)}return n}function w(e){let t=Array.isArray(e.items)?e.items:[e];return t=t.map((e=>({itemId:e.id,itemName:e.name,itemPrice:e.price,quantity:e.quantity||1,variantId:e.variantId,sellingPlan:e.sellingPlan}))),t}function _(e){return{cartId:e.cartId,items:w(e),totalPrice:e.totalPrice,totalQuantity:e.totalQuantity}}var T={"pixel.cart.add":_,"pixel.cart.remove":_,"pixel.product_viewed":function(e){let t=w(e);return t=t.map((e=>function(e){let t=x("localStorage","eko.metadata");if(t&&t[e.itemId]){let n=t[e.itemId].product;e.id=null==n?void 0:n.id,e.sku=null==n?void 0:n.sku,e.upc=null==n?void 0:n.upc,e.name=null==n?void 0:n.name}return e}(e))),{items:t}},"pixel.checkout":function(e){return{checkoutId:e.checkoutId,items:w(e),totalPrice:e.totalPrice,totalQuantity:e.totalQuantity}},"pixel.order":function(e){return{checkoutId:e.checkoutId,orderId:e.orderId,items:w(e),totalPrice:e.totalPrice,totalQuantity:e.totalQuantity}}};const I="https://storage.eko.com/efu/ekoanalytics/master/latest/EkoAnalyticsPlatform.min.gz.js";let E=!1;var S={init:function(e){k.register(),function(e){if(E)return;let t=e?window.location.host:"development";const n=document.createElement("script");n.setAttribute("pxid",t),n.type="text/javascript",n.async=!0,n.src=I,document.body.appendChild(n),E=!0}(e)},onRouteChanged:function(){window.EkoAnalytics("reset")},track:function(e,t){T[e]&&(t=T[e](t)),window.EkoAnalytics("track",e,t)}};function A(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function N(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function M(e,t){return e.get(A(e,t))}function F(e,t,n){N(e,t),t.set(e,n)}function C(e,t,n){return e.set(A(e,t),n),n}function O(e,t){N(e,t),t.add(e)}function P(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function R(){return R=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},R.apply(null,arguments)}function D(e,t){return e(t={exports:{}},t.exports),t.exports
2
2
  /** @license React v16.13.1
3
3
  * react-is.production.min.js
4
4
  *
@@ -6,9 +6,9 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */}var L="function"==typeof Symbol&&Symbol.for,B=L?Symbol.for("react.element"):60103,z=L?Symbol.for("react.portal"):60106,W=L?Symbol.for("react.fragment"):60107,$=L?Symbol.for("react.strict_mode"):60108,U=L?Symbol.for("react.profiler"):60114,j=L?Symbol.for("react.provider"):60109,q=L?Symbol.for("react.context"):60110,V=L?Symbol.for("react.async_mode"):60111,H=L?Symbol.for("react.concurrent_mode"):60111,G=L?Symbol.for("react.forward_ref"):60112,K=L?Symbol.for("react.suspense"):60113,X=L?Symbol.for("react.suspense_list"):60120,Y=L?Symbol.for("react.memo"):60115,Q=L?Symbol.for("react.lazy"):60116,J=L?Symbol.for("react.block"):60121,Z=L?Symbol.for("react.fundamental"):60117,tt=L?Symbol.for("react.responder"):60118,et=L?Symbol.for("react.scope"):60119;function nt(t){if("object"==typeof t&&null!==t){var e=t.$$typeof;switch(e){case B:switch(t=t.type){case V:case H:case W:case U:case $:case K:return t;default:switch(t=t&&t.$$typeof){case q:case G:case Q:case Y:case j:return t;default:return e}}case z:return e}}}function it(t){return nt(t)===H}var rt={AsyncMode:V,ConcurrentMode:H,ContextConsumer:q,ContextProvider:j,Element:B,ForwardRef:G,Fragment:W,Lazy:Q,Memo:Y,Portal:z,Profiler:U,StrictMode:$,Suspense:K,isAsyncMode:function(t){return it(t)||nt(t)===V},isConcurrentMode:it,isContextConsumer:function(t){return nt(t)===q},isContextProvider:function(t){return nt(t)===j},isElement:function(t){return"object"==typeof t&&null!==t&&t.$$typeof===B},isForwardRef:function(t){return nt(t)===G},isFragment:function(t){return nt(t)===W},isLazy:function(t){return nt(t)===Q},isMemo:function(t){return nt(t)===Y},isPortal:function(t){return nt(t)===z},isProfiler:function(t){return nt(t)===U},isStrictMode:function(t){return nt(t)===$},isSuspense:function(t){return nt(t)===K},isValidElementType:function(t){return"string"==typeof t||"function"==typeof t||t===W||t===H||t===U||t===$||t===K||t===X||"object"==typeof t&&null!==t&&(t.$$typeof===Q||t.$$typeof===Y||t.$$typeof===j||t.$$typeof===q||t.$$typeof===G||t.$$typeof===Z||t.$$typeof===tt||t.$$typeof===et||t.$$typeof===J)},typeOf:nt},ot=D((function(t,e){"production"!==process.env.NODE_ENV&&function(){var t="function"==typeof Symbol&&Symbol.for,n=t?Symbol.for("react.element"):60103,i=t?Symbol.for("react.portal"):60106,r=t?Symbol.for("react.fragment"):60107,o=t?Symbol.for("react.strict_mode"):60108,s=t?Symbol.for("react.profiler"):60114,a=t?Symbol.for("react.provider"):60109,l=t?Symbol.for("react.context"):60110,c=t?Symbol.for("react.async_mode"):60111,u=t?Symbol.for("react.concurrent_mode"):60111,d=t?Symbol.for("react.forward_ref"):60112,h=t?Symbol.for("react.suspense"):60113,f=t?Symbol.for("react.suspense_list"):60120,p=t?Symbol.for("react.memo"):60115,m=t?Symbol.for("react.lazy"):60116,v=t?Symbol.for("react.block"):60121,g=t?Symbol.for("react.fundamental"):60117,y=t?Symbol.for("react.responder"):60118,b=t?Symbol.for("react.scope"):60119;function k(t){if("object"==typeof t&&null!==t){var e=t.$$typeof;switch(e){case n:var f=t.type;switch(f){case c:case u:case r:case s:case o:case h:return f;default:var v=f&&f.$$typeof;switch(v){case l:case d:case m:case p:case a:return v;default:return e}}case i:return e}}}var x=c,w=u,_=l,T=a,I=n,E=d,S=r,A=m,N=p,M=i,F=s,C=o,O=h,P=!1;function R(t){return k(t)===u}e.AsyncMode=x,e.ConcurrentMode=w,e.ContextConsumer=_,e.ContextProvider=T,e.Element=I,e.ForwardRef=E,e.Fragment=S,e.Lazy=A,e.Memo=N,e.Portal=M,e.Profiler=F,e.StrictMode=C,e.Suspense=O,e.isAsyncMode=function(t){return P||(P=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),R(t)||k(t)===c},e.isConcurrentMode=R,e.isContextConsumer=function(t){return k(t)===l},e.isContextProvider=function(t){return k(t)===a},e.isElement=function(t){return"object"==typeof t&&null!==t&&t.$$typeof===n},e.isForwardRef=function(t){return k(t)===d},e.isFragment=function(t){return k(t)===r},e.isLazy=function(t){return k(t)===m},e.isMemo=function(t){return k(t)===p},e.isPortal=function(t){return k(t)===i},e.isProfiler=function(t){return k(t)===s},e.isStrictMode=function(t){return k(t)===o},e.isSuspense=function(t){return k(t)===h},e.isValidElementType=function(t){return"string"==typeof t||"function"==typeof t||t===r||t===u||t===s||t===o||t===h||t===f||"object"==typeof t&&null!==t&&(t.$$typeof===m||t.$$typeof===p||t.$$typeof===a||t.$$typeof===l||t.$$typeof===d||t.$$typeof===g||t.$$typeof===y||t.$$typeof===b||t.$$typeof===v)},e.typeOf=k}()}));ot.AsyncMode,ot.ConcurrentMode,ot.ContextConsumer,ot.ContextProvider,ot.Element,ot.ForwardRef,ot.Fragment,ot.Lazy,ot.Memo,ot.Portal,ot.Profiler,ot.StrictMode,ot.Suspense,ot.isAsyncMode,ot.isConcurrentMode,ot.isContextConsumer,ot.isContextProvider,ot.isElement,ot.isForwardRef,ot.isFragment,ot.isLazy,ot.isMemo,ot.isPortal,ot.isProfiler,ot.isStrictMode,ot.isSuspense,ot.isValidElementType,ot.typeOf;var st=D((function(t){"production"===process.env.NODE_ENV?t.exports=rt:t.exports=ot})),at=Object.getOwnPropertySymbols,lt=Object.prototype.hasOwnProperty,ct=Object.prototype.propertyIsEnumerable;
9
+ */}var L="function"==typeof Symbol&&Symbol.for,B=L?Symbol.for("react.element"):60103,z=L?Symbol.for("react.portal"):60106,W=L?Symbol.for("react.fragment"):60107,$=L?Symbol.for("react.strict_mode"):60108,U=L?Symbol.for("react.profiler"):60114,j=L?Symbol.for("react.provider"):60109,q=L?Symbol.for("react.context"):60110,V=L?Symbol.for("react.async_mode"):60111,G=L?Symbol.for("react.concurrent_mode"):60111,H=L?Symbol.for("react.forward_ref"):60112,K=L?Symbol.for("react.suspense"):60113,X=L?Symbol.for("react.suspense_list"):60120,Y=L?Symbol.for("react.memo"):60115,Q=L?Symbol.for("react.lazy"):60116,J=L?Symbol.for("react.block"):60121,Z=L?Symbol.for("react.fundamental"):60117,ee=L?Symbol.for("react.responder"):60118,te=L?Symbol.for("react.scope"):60119;function ne(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case B:switch(e=e.type){case V:case G:case W:case U:case $:case K:return e;default:switch(e=e&&e.$$typeof){case q:case H:case Q:case Y:case j:return e;default:return t}}case z:return t}}}function ie(e){return ne(e)===G}var re={AsyncMode:V,ConcurrentMode:G,ContextConsumer:q,ContextProvider:j,Element:B,ForwardRef:H,Fragment:W,Lazy:Q,Memo:Y,Portal:z,Profiler:U,StrictMode:$,Suspense:K,isAsyncMode:function(e){return ie(e)||ne(e)===V},isConcurrentMode:ie,isContextConsumer:function(e){return ne(e)===q},isContextProvider:function(e){return ne(e)===j},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===B},isForwardRef:function(e){return ne(e)===H},isFragment:function(e){return ne(e)===W},isLazy:function(e){return ne(e)===Q},isMemo:function(e){return ne(e)===Y},isPortal:function(e){return ne(e)===z},isProfiler:function(e){return ne(e)===U},isStrictMode:function(e){return ne(e)===$},isSuspense:function(e){return ne(e)===K},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===W||e===G||e===U||e===$||e===K||e===X||"object"==typeof e&&null!==e&&(e.$$typeof===Q||e.$$typeof===Y||e.$$typeof===j||e.$$typeof===q||e.$$typeof===H||e.$$typeof===Z||e.$$typeof===ee||e.$$typeof===te||e.$$typeof===J)},typeOf:ne},oe=D((function(e,t){"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,n=e?Symbol.for("react.element"):60103,i=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,s=e?Symbol.for("react.profiler"):60114,a=e?Symbol.for("react.provider"):60109,l=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,f=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,m=e?Symbol.for("react.lazy"):60116,v=e?Symbol.for("react.block"):60121,g=e?Symbol.for("react.fundamental"):60117,y=e?Symbol.for("react.responder"):60118,b=e?Symbol.for("react.scope"):60119;function k(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:var f=e.type;switch(f){case c:case u:case r:case s:case o:case h:return f;default:var v=f&&f.$$typeof;switch(v){case l:case d:case m:case p:case a:return v;default:return t}}case i:return t}}}var x=c,w=u,_=l,T=a,I=n,E=d,S=r,A=m,N=p,M=i,F=s,C=o,O=h,P=!1;function R(e){return k(e)===u}t.AsyncMode=x,t.ConcurrentMode=w,t.ContextConsumer=_,t.ContextProvider=T,t.Element=I,t.ForwardRef=E,t.Fragment=S,t.Lazy=A,t.Memo=N,t.Portal=M,t.Profiler=F,t.StrictMode=C,t.Suspense=O,t.isAsyncMode=function(e){return P||(P=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),R(e)||k(e)===c},t.isConcurrentMode=R,t.isContextConsumer=function(e){return k(e)===l},t.isContextProvider=function(e){return k(e)===a},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},t.isForwardRef=function(e){return k(e)===d},t.isFragment=function(e){return k(e)===r},t.isLazy=function(e){return k(e)===m},t.isMemo=function(e){return k(e)===p},t.isPortal=function(e){return k(e)===i},t.isProfiler=function(e){return k(e)===s},t.isStrictMode=function(e){return k(e)===o},t.isSuspense=function(e){return k(e)===h},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===r||e===u||e===s||e===o||e===h||e===f||"object"==typeof e&&null!==e&&(e.$$typeof===m||e.$$typeof===p||e.$$typeof===a||e.$$typeof===l||e.$$typeof===d||e.$$typeof===g||e.$$typeof===y||e.$$typeof===b||e.$$typeof===v)},t.typeOf=k}()}));oe.AsyncMode,oe.ConcurrentMode,oe.ContextConsumer,oe.ContextProvider,oe.Element,oe.ForwardRef,oe.Fragment,oe.Lazy,oe.Memo,oe.Portal,oe.Profiler,oe.StrictMode,oe.Suspense,oe.isAsyncMode,oe.isConcurrentMode,oe.isContextConsumer,oe.isContextProvider,oe.isElement,oe.isForwardRef,oe.isFragment,oe.isLazy,oe.isMemo,oe.isPortal,oe.isProfiler,oe.isStrictMode,oe.isSuspense,oe.isValidElementType,oe.typeOf;var se=D((function(e){"production"===process.env.NODE_ENV?e.exports=re:e.exports=oe})),ae=Object.getOwnPropertySymbols,le=Object.prototype.hasOwnProperty,ce=Object.prototype.propertyIsEnumerable;
10
10
  /*
11
11
  object-assign
12
12
  (c) Sindre Sorhus
13
13
  @license MIT
14
- */var ut=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;var i=Object.getOwnPropertyNames(e).map((function(t){return e[t]}));if("0123456789"!==i.join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(t){r[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var n,i,r=function(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),o=1;o<arguments.length;o++){for(var s in n=Object(arguments[o]))lt.call(n,s)&&(r[s]=n[s]);if(at){i=at(n);for(var a=0;a<i.length;a++)ct.call(n,i[a])&&(r[i[a]]=n[i[a]])}}return r},dt="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",ht=Function.call.bind(Object.prototype.hasOwnProperty),ft=function(){};if("production"!==process.env.NODE_ENV){var pt=dt,mt={},vt=ht;ft=function(t){var e="Warning: "+t;"undefined"!=typeof console&&console.error(e);try{throw new Error(e)}catch(t){}}}function gt(t,e,n,i,r){if("production"!==process.env.NODE_ENV)for(var o in t)if(vt(t,o)){var s;try{if("function"!=typeof t[o]){var a=Error((i||"React class")+": "+n+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof t[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw a.name="Invariant Violation",a}s=t[o](e,o,i,n,null,pt)}catch(t){s=t}if(!s||s instanceof Error||ft((i||"React class")+": type specification of "+n+" `"+o+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof s+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),s instanceof Error&&!(s.message in mt)){mt[s.message]=!0;var l=r?r():"";ft("Failed "+n+" type: "+s.message+(null!=l?l:""))}}}gt.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(mt={})};var yt=gt,bt=function(){};function kt(){return null}"production"!==process.env.NODE_ENV&&(bt=function(t){var e="Warning: "+t;"undefined"!=typeof console&&console.error(e);try{throw new Error(e)}catch(t){}});var xt=function(t,e){var n="function"==typeof Symbol&&Symbol.iterator,i="@@iterator";var r="<<anonymous>>",o={array:c("array"),bigint:c("bigint"),bool:c("boolean"),func:c("function"),number:c("number"),object:c("object"),string:c("string"),symbol:c("symbol"),any:l(kt),arrayOf:function(t){return l((function(e,n,i,r,o){if("function"!=typeof t)return new a("Property `"+o+"` of component `"+i+"` has invalid PropType notation inside arrayOf.");var s=e[n];if(!Array.isArray(s))return new a("Invalid "+r+" `"+o+"` of type `"+h(s)+"` supplied to `"+i+"`, expected an array.");for(var l=0;l<s.length;l++){var c=t(s,l,i,r,o+"["+l+"]",dt);if(c instanceof Error)return c}return null}))},element:l((function(e,n,i,r,o){var s=e[n];return t(s)?null:new a("Invalid "+r+" `"+o+"` of type `"+h(s)+"` supplied to `"+i+"`, expected a single ReactElement.")})),elementType:l((function(t,e,n,i,r){var o=t[e];return st.isValidElementType(o)?null:new a("Invalid "+i+" `"+r+"` of type `"+h(o)+"` supplied to `"+n+"`, expected a single ReactElement type.")})),instanceOf:function(t){return l((function(e,n,i,o,s){if(!(e[n]instanceof t)){var l=t.name||r;return new a("Invalid "+o+" `"+s+"` of type `"+(((c=e[n]).constructor&&c.constructor.name?c.constructor.name:r)+"` supplied to `")+i+"`, expected instance of `"+l+"`.")}var c;return null}))},node:l((function(t,e,n,i,r){return d(t[e])?null:new a("Invalid "+i+" `"+r+"` supplied to `"+n+"`, expected a ReactNode.")})),objectOf:function(t){return l((function(e,n,i,r,o){if("function"!=typeof t)return new a("Property `"+o+"` of component `"+i+"` has invalid PropType notation inside objectOf.");var s=e[n],l=h(s);if("object"!==l)return new a("Invalid "+r+" `"+o+"` of type `"+l+"` supplied to `"+i+"`, expected an object.");for(var c in s)if(ht(s,c)){var u=t(s,c,i,r,o+"."+c,dt);if(u instanceof Error)return u}return null}))},oneOf:function(t){if(!Array.isArray(t))return"production"!==process.env.NODE_ENV&&bt(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),kt;return l((function(e,n,i,r,o){for(var l=e[n],c=0;c<t.length;c++)if(s(l,t[c]))return null;var u=JSON.stringify(t,(function(t,e){return"symbol"===f(e)?String(e):e}));return new a("Invalid "+r+" `"+o+"` of value `"+String(l)+"` supplied to `"+i+"`, expected one of "+u+".")}))},oneOfType:function(t){if(!Array.isArray(t))return"production"!==process.env.NODE_ENV&&bt("Invalid argument supplied to oneOfType, expected an instance of array."),kt;for(var e=0;e<t.length;e++){var n=t[e];if("function"!=typeof n)return bt("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+p(n)+" at index "+e+"."),kt}return l((function(e,n,i,r,o){for(var s=[],l=0;l<t.length;l++){var c=(0,t[l])(e,n,i,r,o,dt);if(null==c)return null;c.data&&ht(c.data,"expectedType")&&s.push(c.data.expectedType)}return new a("Invalid "+r+" `"+o+"` supplied to `"+i+"`"+(s.length>0?", expected one of type ["+s.join(", ")+"]":"")+".")}))},shape:function(t){return l((function(e,n,i,r,o){var s=e[n],l=h(s);if("object"!==l)return new a("Invalid "+r+" `"+o+"` of type `"+l+"` supplied to `"+i+"`, expected `object`.");for(var c in t){var d=t[c];if("function"!=typeof d)return u(i,r,o,c,f(d));var p=d(s,c,i,r,o+"."+c,dt);if(p)return p}return null}))},exact:function(t){return l((function(e,n,i,r,o){var s=e[n],l=h(s);if("object"!==l)return new a("Invalid "+r+" `"+o+"` of type `"+l+"` supplied to `"+i+"`, expected `object`.");var c=ut({},e[n],t);for(var d in c){var p=t[d];if(ht(t,d)&&"function"!=typeof p)return u(i,r,o,d,f(p));if(!p)return new a("Invalid "+r+" `"+o+"` key `"+d+"` supplied to `"+i+"`.\nBad object: "+JSON.stringify(e[n],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(t),null," "));var m=p(s,d,i,r,o+"."+d,dt);if(m)return m}return null}))}};function s(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}function a(t,e){this.message=t,this.data=e&&"object"==typeof e?e:{},this.stack=""}function l(t){if("production"!==process.env.NODE_ENV)var n={},i=0;function o(o,s,l,c,u,d,h){if(c=c||r,d=d||l,h!==dt){if(e){var f=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw f.name="Invariant Violation",f}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var p=c+":"+l;!n[p]&&i<3&&(bt("You are manually calling a React.PropTypes validation function for the `"+d+"` prop on `"+c+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),n[p]=!0,i++)}}return null==s[l]?o?null===s[l]?new a("The "+u+" `"+d+"` is marked as required in `"+c+"`, but its value is `null`."):new a("The "+u+" `"+d+"` is marked as required in `"+c+"`, but its value is `undefined`."):null:t(s,l,c,u,d)}var s=o.bind(null,!1);return s.isRequired=o.bind(null,!0),s}function c(t){return l((function(e,n,i,r,o,s){var l=e[n];return h(l)!==t?new a("Invalid "+r+" `"+o+"` of type `"+f(l)+"` supplied to `"+i+"`, expected `"+t+"`.",{expectedType:t}):null}))}function u(t,e,n,i,r){return new a((t||"React class")+": "+e+" type `"+n+"."+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+r+"`.")}function d(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(d);if(null===e||t(e))return!0;var r=function(t){var e=t&&(n&&t[n]||t[i]);if("function"==typeof e)return e}(e);if(!r)return!1;var o,s=r.call(e);if(r!==e.entries){for(;!(o=s.next()).done;)if(!d(o.value))return!1}else for(;!(o=s.next()).done;){var a=o.value;if(a&&!d(a[1]))return!1}return!0;default:return!1}}function h(t){var e=typeof t;return Array.isArray(t)?"array":t instanceof RegExp?"object":function(t,e){return"symbol"===t||!!e&&("Symbol"===e["@@toStringTag"]||"function"==typeof Symbol&&e instanceof Symbol)}(e,t)?"symbol":e}function f(t){if(null==t)return""+t;var e=h(t);if("object"===e){if(t instanceof Date)return"date";if(t instanceof RegExp)return"regexp"}return e}function p(t){var e=f(t);switch(e){case"array":case"object":return"an "+e;case"boolean":case"date":case"regexp":return"a "+e;default:return e}}return a.prototype=Error.prototype,o.checkPropTypes=yt,o.resetWarningCache=yt.resetWarningCache,o.PropTypes=o,o};function wt(){}function _t(){}_t.resetWarningCache=wt;var Tt=D((function(t){if("production"!==process.env.NODE_ENV){var e=st;t.exports=xt(e.isElement,!0)}else t.exports=function(){function t(t,e,n,i,r,o){if(o!==dt){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function e(){return t}t.isRequired=t;var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:_t,resetWarningCache:wt};return n.PropTypes=n,n}()}));const It=/https?:\/\/(.*?\.)?eko.com/,Et={"eko.project.interaction":"interaction","eko.project.swipe":"swipe"};let St=null,At=null,Nt=[];function Mt(t){return e=>{var n;if(!It.test(e.origin)||"eko.embedapi"!==(null===(n=e.data)||void 0===n?void 0:n.source))return;const i=e.data,r=Et[i.type];r&&(t?t(r,i.data):Nt.push({type:r,data:i.data}))}}"undefined"!=typeof window&&(At=Mt(null),window.addEventListener("message",At));var Ft={subscribe:function(t){"function"==typeof t?St?console.warn("[eko-gallery-react] Ignoring events subscribe since already subscribed"):(St=t,At=Mt(t),window.addEventListener("message",At),function(t){Nt.forEach((e=>{t(e.type,e.data)})),Nt=[]}(t)):console.warn("[eko-gallery-react] Ignoring events subscribe since a callback function was not provided as argument")},unsubscribe:function(){At?(window.removeEventListener("message",At),At=null,St=null,Nt=[]):console.warn("[eko-gallery-react] Ignoring events unsubscribe since not subscribed")},send:function(t,e){St?St(t,e):Nt.push({type:t,data:e})}};const Ct=({index:t,activeIndex:n,setActiveIndex:i,item:r,src:o,navItemRefs:s,itemIcon:a})=>{var l,c;const u=null==r||null===(l=r.media)||void 0===l?void 0:l.srcset,d=null==r||null===(c=r.media)||void 0===c?void 0:c.sizes,h=!o&&(null==r?void 0:r.label),f=u?o:function(t,e=200){if(!t)return null;try{let n=t;t.includes("assets.eko.com")&&t.includes("/raw/")&&(n=t.replace("/raw/","/image/"));const i=new URL(n);return i.searchParams.set("width",e),i.href}catch(e){return t}}(o,150);let p=["addons-container",h?"full-thumb-label":""].join(" ").trim();return e.createElement("li",{className:"eko-nav-item","aria-current":n===t,onClick:function(){i(t),function(t){S.track("gallery.interaction",{elementid:`thumbnail-${t}`,interactiontype:"click"}),Ft.send("interaction",{elementid:`thumbnail-${t}`,interactiontype:"click"})}(t)},ref:s.current[t]},e.createElement("button",{type:"button","aria-label":`Go to item ${t}`},!h&&e.createElement("img",{src:f,srcSet:u,sizes:d,alt:null==r?void 0:r.name,loading:"eager",fetchPriority:"high"}),e.createElement("div",{className:p},(null==r?void 0:r.stepsIndication)&&e.createElement("div",{className:"step-indicator"},e.createElement("span",null),e.createElement("span",null),e.createElement("span",null)),(null==r?void 0:r.label)&&e.createElement("div",{className:"thumb-label"},null==r?void 0:r.label)),a&&e.createElement("div",{className:"item-icon"},e.createElement("span",{style:{backgroundImage:`url(${a})`}}))))};Ct.propTypes={index:Tt.number,activeIndex:Tt.number,setActiveIndex:Tt.func.isRequired,item:Tt.object.isRequired,src:Tt.string,navItemRefs:Tt.object.isRequired,itemIcon:Tt.string};const Ot=({layout:t,nav:n,isVerticalNav:i,showPrevArrow:r,showNextArrow:o})=>{var s,a,l,c,u;const d=e.useRef(null),h=e.useRef(null),f="arrows"===(null==t||null===(s=t.mobile)||void 0===s||null===(s=s.config)||void 0===s||null===(s=s.navPagination)||void 0===s?void 0:s.type)?"eko-mobile-arrows":"",p="arrows"===(null!==(a=null==t||null===(l=t.desktop)||void 0===l||null===(l=l.config)||void 0===l||null===(l=l.navPagination)||void 0===l?void 0:l.type)&&void 0!==a?a:"arrows")?"eko-desktop-arrows":"",m=f||p,v=i?null==n||null===(c=n.current)||void 0===c?void 0:c.scrollHeight:null==n||null===(u=n.current)||void 0===u?void 0:u.scrollWidth;function g(t){const e=i?n.current.clientHeight:n.current.clientWidth,r=function(t,e){const n=i?e.scrollTop:e.scrollLeft;return Math.max(-n,Math.min(v-t-n,t))}("next"===t?e:-e,n.current);return{top:i?r:0,left:i?0:r,behavior:"smooth"}}function y(t){var e,i,r;const o=g(t),s="next"===t?null==h||null===(e=h.current)||void 0===e?void 0:e.id:null==d||null===(i=d.current)||void 0===i?void 0:i.id;var a,l;window.EkoAnalytics("track","gallery.interaction",{elementid:s,interactiontype:"click"}),null==n||null===(r=n.current)||void 0===r||r.scrollBy(o),a=s,l="click",S.track("gallery.interaction",{elementId:a,interactiontype:l}),Ft.send("interaction",{elementId:a,interactiontype:l})}return e.createElement(e.Fragment,null,m&&e.createElement(e.Fragment,null,e.createElement("button",R({type:"button","aria-label":"Go to previous item","aria-hidden":r?"false":"true",onClick:()=>y("prev"),ref:d,id:"eko-nav-prev-arrow",className:`eko-nav-arrow eko-prev-nav-button ${f} ${p} ${r?"":"eko-hidden-nav-button"}`},r?{}:{tabIndex:"-1"}),e.createElement("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M5.56127 9.52817C5.28966 9.22635 5.28966 8.77361 5.56127 8.502L10.39 3.67331C10.6918 3.37157 11.1445 3.37157 11.4161 3.67331C11.7179 3.94492 11.7179 4.39766 11.4161 4.66927L7.10044 8.98487L11.4161 13.3307C11.7179 13.6023 11.7179 14.055 11.4161 14.3266C11.1445 14.6285 10.6918 14.6285 10.4202 14.3266L5.56127 9.52817Z",fill:"black"}))),e.createElement("button",R({type:"button","aria-label":"Go to next item","aria-hidden":o?"false":"true",onClick:()=>y("next"),ref:h,className:`eko-nav-arrow eko-next-nav-button ${f} ${p} ${o?"":"eko-hidden-nav-button"}`,id:"eko-nav-next-arrow"},o?{}:{tabIndex:"-1"}),e.createElement("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M12.4387 8.47185C12.7103 8.77367 12.7103 9.22641 12.4387 9.49802L7.61003 14.3267C7.30821 14.6284 6.85547 14.6284 6.58386 14.3267C6.28212 14.0551 6.28212 13.6024 6.58386 13.3308L10.8996 9.01515L6.58386 4.66933C6.28212 4.39772 6.28212 3.94499 6.58386 3.67338C6.85547 3.37155 7.30821 3.37155 7.57982 3.67338L12.4387 8.47185Z",fill:"black"})))))};function Pt(t,e,n){let i;return function(){const n=this,r=arguments;clearTimeout(i),i=setTimeout((function(){i=null,t.apply(n,r)}),e)}}Ot.propTypes={layout:Tt.object.isRequired,nav:Tt.object.isRequired,isVerticalNav:Tt.bool.isRequired,showPrevArrow:Tt.bool.isRequired,showNextArrow:Tt.bool.isRequired};const Rt=({items:t,setActiveIndex:n,activeIndex:i,layout:r,carouselMounted:o,forceMobile:s})=>{const l=e.useRef(null),c=e.useRef(null),u=e.useRef([]),d=3,[h,f]=e.useState(null),[p,m]=e.useState(!1),[v,g]=e.useState(0),[y,b]=e.useState(!1),[k,x]=e.useState(!1);function w(){var t;const e=s||window.innerWidth<768?"mobile":"desktop",n=(null==r||null===(t=r[e])||void 0===t||null===(t=t.config)||void 0===t?void 0:t.orientation)||("desktop"===e?"left":"bottom");m("left"===n||"right"===n);const i=c.current.parentNode,a=o?".eko-smart-gallery-container iframe":".eko-carousel",l=i.querySelector(a);setTimeout((()=>{g(l.clientHeight)}),0)}function _(){var t,e;const n=s||a()?"mobile":"desktop",i=null!==(t=null==r||null===(e=r[n])||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.navPagination)||void 0===e?void 0:e.scrollThreshold)&&void 0!==t?t:d;!function(t=d){var e,n;const i=l.current;if(!i)return;const o="none"!==(null==r||null===(e=r.desktop)||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.navPagination)||void 0===e?void 0:e.type),c=(u=null==r||null===(n=r.mobile)||void 0===n||null===(n=n.config)||void 0===n||null===(n=n.navPagination)||void 0===n?void 0:n.type,"mask"===u||"arrows"===u);var u;if((s||a())&&!c)return void i.style.setProperty("-webkit-mask","none");if(!a()&&!o)return void i.style.setProperty("-webkit-mask","none");const h=i.scrollHeight-i.clientHeight,f=i.scrollTop>t?"85%":"100%",m=i.scrollTop<=h-t?"15%":"0%",v=i.scrollWidth-i.clientWidth,g=i.scrollLeft>t?"15%":"0%",y=i.scrollLeft<=v-t?"85%":"100%";p?i.style.setProperty("-webkit-mask",`linear-gradient(0deg,#0000,#000 ${m} ${f},#0000)`):i.style.setProperty("-webkit-mask",`linear-gradient(90deg,#0000,#000 ${g} ${y},#0000)`)}(i),function(t=d){var e,n,i,r,o,s;const a=p?null==l||null===(e=l.current)||void 0===e?void 0:e.scrollTop:null==l||null===(n=l.current)||void 0===n?void 0:n.scrollLeft,c=p?null==l||null===(i=l.current)||void 0===i?void 0:i.clientHeight:null==l||null===(r=l.current)||void 0===r?void 0:r.clientWidth,u=p?null==l||null===(o=l.current)||void 0===o?void 0:o.scrollHeight:null==l||null===(s=l.current)||void 0===s?void 0:s.scrollWidth;u-t<c?(b(!1),x(!1)):a<=t?(b(!1),x(!0)):a+c>u-t?(b(!0),x(!1)):a+t>0&&a<u-t&&(b(!0),x(!0))}(i)}u.current=null==t?void 0:t.map(((t,n)=>{var i,r;return null!==(i=null==u||null===(r=u.current)||void 0===r?void 0:r[n])&&void 0!==i?i:e.createRef()}));const T=Pt((t=>{var e;e=t,S.track("gallery.interaction",{elementid:"nav",interactiontype:e}),Ft.send("interaction",{elementid:"nav",interactiontype:e})}),200);const I=e.useCallback((t=>{n({index:t,step:0,source:"nav"})}),[]);return e.useEffect((()=>{var t;f(null===(t=u.current)||void 0===t?void 0:t[i])}),[i]),e.useEffect((()=>{if(null!=h&&h.current&&null!=l&&l.current){const t=h.current,e=l.current.clientWidth/2,n=t.clientWidth/2,i=l.current.clientHeight/2,r=t.clientHeight/2;l.current.scrollTo({left:t.offsetLeft-e+n,top:t.offsetTop-i+r,behavior:"smooth"})}}),[h]),e.useEffect((()=>{w()}),[]),e.useEffect((()=>(window.addEventListener("resize",w),()=>{window.removeEventListener("resize",w)})),[c,o,s]),e.useEffect((()=>{g(0),w()}),[t,c,o,s]),e.useEffect((()=>{_();const t=new ResizeObserver(_);return t.observe(l.current),()=>{t.disconnect()}}),[t,s,p]),e.createElement("div",{className:"eko-nav-container",ref:c,style:{opacity:v>0?1:0,height:""+(v&&p?v+"px":"auto")}},e.createElement(Ot,{layout:r,nav:l,isVerticalNav:p,showPrevArrow:y,showNextArrow:k}),e.createElement("ul",{className:`eko-nav eko-mobile-nav-selected-${null!==(E=null==r||null===(A=r.mobile)||void 0===A||null===(A=A.config)||void 0===A?void 0:A.navItemsSelectedType)&&void 0!==E?E:"underline"} eko-desktop-nav-selected-${null!==(N=null==r||null===(M=r.desktop)||void 0===M||null===(M=M.config)||void 0===M?void 0:M.navItemsSelectedType)&&void 0!==N?N:"underline"}`,ref:l,onScroll:function(){_()},onWheel:function(){T("wheel")},onTouchMove:function(){T("swipe")}},null==t?void 0:t.map(((t,n)=>{var r;const o=(null==t||null===(r=t.media)||void 0===r?void 0:r.url)||(null==t?void 0:t.media)||"";return e.createElement(Ct,{key:o+n,index:n,activeIndex:i,setActiveIndex:I,item:t,src:o,navItemRefs:u,itemIcon:null==t?void 0:t.icon})}))));var E,A,N,M};Rt.propTypes={items:Tt.array.isRequired,activeIndex:Tt.number,setActiveIndex:Tt.func.isRequired,layout:Tt.object,carouselMounted:Tt.bool,forceMobile:Tt.bool};function Dt(){S.track("gallery.cover.displayed"),Ft.send("gallerycoverdisplayed")}function Lt(t){if(!t)return t;try{const e=new URL(t);return e.host.includes("assets.eko.com")&&e.pathname.startsWith("/image")&&!e.searchParams.has("width")?(e.pathname.endsWith(".png")&&(e.pathname=e.pathname.replace(/\.png$/,".webp")),e.searchParams.set("width",1920),e.toString()):t}catch(e){return t}}const Bt=({item:t,src:n,srcset:i,sizes:r,isCoverElement:o})=>{const s=e.useRef(null);return e.useEffect((()=>{var t;if(o){if(null===(t=s.current)||void 0===t||!t.complete)return s.current.addEventListener("load",Dt,{once:!0}),()=>{var t;null===(t=s.current)||void 0===t||t.removeEventListener("load",Dt,{once:!0})};Dt()}}),[]),e.createElement("img",{ref:s,src:Lt(n),srcSet:i,sizes:r,alt:t.name,fetchPriority:o?"high":"auto",loading:o?"eager":"lazy",style:{width:"100%",height:"100%"}})};Bt.propTypes={item:Tt.object.isRequired,src:Tt.string,srcset:Tt.string,sizes:Tt.string,isCoverElement:Tt.bool};const zt=Pt((t=>{var e;e=t,S.track("gallery.interaction",{elementid:"carousel",interactiontype:e}),Ft.send("interaction",{elementid:"carousel",interactiontype:e})}),200);function Wt(){zt("wheel")}const $t=e.forwardRef((({items:t,setActiveIndex:n,activeIndex:i,showSmartLoaders:r},o)=>{const s=e.useRef(null),a=e.useRef([]);a.current=null==t?void 0:t.map(((t,n)=>{var i,r;return null!==(i=null==a||null===(r=a.current)||void 0===r?void 0:r[n])&&void 0!==i?i:e.createRef()}));const[l,c]=e.useState(),[u,d]=e.useState(),h=e.useRef(i),f=e.useRef(!1);function p(){const e=function(t){const e=t.scrollLeft,n=t.scrollWidth-t.clientWidth;return 0===e?0:e>n?100:e/n*100}(s.current)*(null==t?void 0:t.length)/100,i=Math.min(Math.trunc(e),(null==t?void 0:t.length)-1),r=h.current;"nav"!==r.source&&"external-nav"!==r.source?(f.current&&i!==r.index&&(f.current=!1),f.current||(i>(null==t?void 0:t.length)-1?n({index:(null==t?void 0:t.length)-1,source:"carousel"}):n({index:i,source:"carousel"}))):i===r.index?f.current=!0:f.current&&i!==r.index&&(f.current=!1,n({index:i,source:"carousel"}))}return e.useImperativeHandle(o,(()=>({prev:()=>{n({index:Math.max(0,h.current.index-1),source:"carousel"})},next:()=>{n({index:Math.min((null==t?void 0:t.length)-1,h.current.index+1),source:"carousel"})}}))),e.useEffect((()=>{const t=s.current;if(t)return t.addEventListener("scroll",p),()=>{t.removeEventListener("scroll",p)}}),[t]),e.useEffect((()=>{var t;let e=null===(t=a.current)||void 0===t?void 0:t[i.index];if(e&&("nav"===i.source||"external-nav"===i.source)){const t=e.current,n=s.current.clientWidth/2,i=(null==t?void 0:t.clientWidth)/2,r=(null==t?void 0:t.offsetLeft)-n+i;s.current.scrollTo({left:r,behavior:"smooth"})}}),[i]),e.useEffect((()=>{h.current=i,"nav"!==i.source&&"external-nav"!==i.source||(f.current=!1)}),[i]),e.createElement("ul",{className:"eko-carousel",ref:s,onScroll:p,onWheel:Wt,onTouchMove:function(t){d(t.targetTouches[0].clientX)},onTouchStart:function(t){c(t.targetTouches[0].clientX),d(null)},onTouchEnd:function(){u&&l&&(l-u>75||l-u<-75)&&zt("swipe")}},null==t?void 0:t.map(((t,n)=>{const i=(null==t?void 0:t.cover)||(null==t?void 0:t.media),o=(null==i?void 0:i.url)||i;return e.createElement("li",{className:"eko-carousel-item",key:o+n,ref:a.current[n]},e.createElement(Bt,{item:t,src:o,srcset:null==i?void 0:i.srcset,sizes:null==i?void 0:i.sizes,isCoverElement:0===n}),r&&"image"!==t.type&&e.createElement("div",{className:"eko-smart-loading"},e.createElement("div",null),e.createElement("p",null,"Loading video experience")))})))}));function Ut(t){var e;return function(t){var e;return"eko.block.event"===(null==t||null===(e=t.data)||void 0===e?void 0:e.type)}(t)&&"GalleryBlock"===(null==t||null===(e=t.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.blockType)}$t.propTypes={items:Tt.array.isRequired,setActiveIndex:Tt.func.isRequired,activeIndex:Tt.object,showSmartLoaders:Tt.bool},$t.displayName="CarouselLoop";const jt="eko.project.invoke",qt="eko.block.invoke";function Vt(t,e,n){var i;null!=t&&t.contentWindow&&(null==t||null===(i=t.contentWindow)||void 0===i||i.postMessage({target:"eko.embedapi",type:e,data:n},"*"))}function Ht(t){return`#variantId=${encodeURIComponent(t)}`}const Gt=e.forwardRef((({config:t,instanceId:n,setActiveItem:i,activeItem:r,variantId:o,smartGalleryLoaded:s,onLoad:l,forceMobile:c},u)=>{var d,h,f;const p=null!==(d=null===(h=t.options)||void 0===h?void 0:h.galleryEnv)&&void 0!==d?d:"",m=null===(f=t.__autoGenerated)||void 0===f||null===(f=f.publishItem)||void 0===f?void 0:f.id,v=function(t={}){let e="";return Object.entries(t).forEach((([t,n])=>{e+=`&${t}=${n}`})),e}(null==t?void 0:t.qp),g=function(t,e,n){return`https://${t}play.eko.com/embed?${n?`id=${n}`:`piid=${e}`}&nocover=true&galleryBlockMode=gallery&eko_pixel=true`}(p,m,n),y=e.useRef(null),b=e.useRef(null),k=e.useRef(!1),[x,w]=e.useState(Ht(o||"ekonovar")),[_,T]=e.useState(g+v+x);let I;function E(){S.track("gallery.project.display"),l(),Ft.send("galleryloaded")}return e.useImperativeHandle(u,(()=>({prev:()=>{Vt(null==b?void 0:b.current,qt,{action:"onPrevModule"})},next:()=>{Vt(null==b?void 0:b.current,qt,{action:"onNextModule"})}}))),e.useEffect((()=>{k.current?Vt(null==b?void 0:b.current,jt,{action:"updateVariant",args:{id:o}}):w(Ht(o))}),[o]),e.useEffect((()=>{Vt(null==b?void 0:b.current,qt,{action:"updateActiveModule",args:{activeItemIndex:null==r?void 0:r.index,activeModuleIndex:null==r?void 0:r.step}})}),[r]),e.useEffect((()=>{function t(t){if((function(t){var e;return"eko.project.blockstart"===(null==t||null===(e=t.data)||void 0===e?void 0:e.type)}(t)||function(t){var e,n;return"eko.project.started"===(null==t||null===(e=t.data)||void 0===e?void 0:e.type)&&(null==t||null===(n=t.data)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.started)}(t))&&!k.current)return e=t.data.data.blockType,k.current=!0,void("GalleryBlock"===e?Vt(null==b?void 0:b.current,qt,{action:"updateActiveModule",args:{activeItemIndex:null==r?void 0:r.index,activeModuleIndex:null==r?void 0:r.step}}):E());var e;if(k.current){if(function(t){var e;return Ut(t)&&"activeModuleChanged"===(null==t||null===(e=t.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.name)}(t))return void function(t){const e=t.data.data.data.activeItemIndex,n=t.data.data.data.activeModuleIndex;e===(null==r?void 0:r.index)&&n===(null==r?void 0:r.step)||i({index:e,step:n,source:"carousel"})}(t);(function(t){var e;return Ut(t)&&"activeModuleChangeDone"===(null==t||null===(e=t.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.name)})(t)&&!s&&E()}}return I=c||a()?"mobile":"desktop",function(t,e={}){window.addEventListener("message",t,e)}(t),()=>{!function(t,e={}){window.removeEventListener("message",t,e)}(t)}}),[r]),e.useEffect((()=>{k.current||Vt(null==b?void 0:b.current,jt,{action:"queryProjectStarted"})}),[r,s]),e.useEffect((()=>{k.current=!1}),[t]),e.useEffect((()=>{T(g+v+x)}),[x]),e.createElement("div",{className:"eko-smart-gallery-container "+(s?"":"eko-project-not-ready"),ref:y,"data-type":"smart-gallery","data-qp":v,"data-variant":o,"data-device":I},e.createElement("iframe",{allow:"autoplay; fullscreen",title:"eko gallery",src:_,style:{border:0},ref:b}))}));Gt.propTypes={config:Tt.object.isRequired,instanceId:Tt.string,setActiveItem:Tt.func.isRequired,activeItem:Tt.object.isRequired,variantId:Tt.string,smartGalleryLoaded:Tt.bool,onLoad:Tt.func,forceMobile:Tt.bool},Gt.displayName="SmartGallery";const Kt=()=>e.createElement("style",{suppressHydrationWarning:!0},'.eko-gallery {\n --accentColorEko: #000;\n --primaryColorEko: #000;\n --backgroundColorEko: #25D7A2;\n --navItemsBackgroundColorEko: transparent;\n --navItemsBannerBackgroundColorEko: #EEEEEE;\n --carouselItemsBackgroundColorEko: transparent;\n --carouselInteractiveCoverBackgroundColorEko: transparent;\n --galleryGapEkoMobile: 12px;\n --galleryGapEkoDesktop: 12px;\n --galleryPaddingEkoMobile: 0;\n --galleryPaddingEkoDesktop: 0;\n --galleryMaxWidthEkoMobile: 100%;\n --galleryMaxWidthEkoDesktop: 900px;\n --galleryTransition: .8s cubic-bezier(.35, 0, 0, 1) 1.5s;\n --navBarPaddingEkoMobile: 0 0 0 20px;\n --navBarPaddingEkoDesktop: 0;\n --navItemsWidthEkoMobile: 80px;\n --navItemsWidthEkoDesktop: 80px;\n --navItemsHeightEkoMobile: 80px;\n --navItemsHeightEkoDesktop: 80px;\n --navItemsGapEkoMobile: 14px;\n --navItemsGapEkoDesktop: 14px;\n --navItemsRadiusEkoMobile: 8px;\n --navItemsRadiusEkoDesktop: 8px;\n --navItemsSelectedMarginEkoMobile: 3px;\n --navItemsSelectedMarginEkoDesktop: 3px;\n --navItemsSelectedThicknessEkoMobile: 3px;\n --navItemsSelectedThicknessEkoDesktop: 3px;\n --navItemsSelectedUnderlineRadiusEkoMobile: 100px;\n --navItemsSelectedUnderlineRadiusEkoDesktop: 100px;\n --navItemsObjectFitEkoMobile: cover;\n --navItemsObjectFitEkoDesktop: cover;\n --navMediaBadgeSizeEkoMobile: 22px;\n --navMediaBadgeSizeEkoDesktop: 22px;\n --navMediaBadgeMarginTopEkoMobile: 4px;\n --navMediaBadgeMarginTopEkoDesktop: 4px;\n --navMediaBadgeMarginRightEkoMobile: 4px;\n --navMediaBadgeMarginRightEkoDesktop: 4px;\n --carouselItemsAspectRatioEkoMobile: 1 / 1;\n --carouselItemsAspectRatioEkoDesktop: 1 / 1;\n --carouselItemsRadiusEkoMobile: 0px;\n --carouselItemsRadiusEkoDesktop: 12px;\n --carouselItemsObjectFitEkoMobile: cover;\n --carouselItemsObjectFitEkoDesktop: cover;\n --navBannerFontSizeEkoMobile: 12px;\n --navBannerFontSizeEkoDesktop: 12px;\n --navBannerFontLineHeightEkoMobile: 120%;\n --navBannerFontLineHeightEkoDesktop: 120%;\n --navBannerFontFamilyEkoMobile: inherit;\n --navBannerFontFamilyEkoDesktop: inherit;\n --navBannerFontWeightEkoMobile: 400;\n --navBannerFontWeightEkoDesktop: 400;\n --outerWidth: 0\n}\n\n.eko-gallery * {\n box-sizing: border-box\n}\n\n.eko-gallery ul,\n.eko-gallery li {\n padding: 0;\n text-indent: 0;\n list-style-type: none;\n font-size: 0;\n margin: 0\n}\n\n.eko-gallery button {\n border: none;\n padding: 0\n}\n\n.eko-gallery .eko-hidden {\n display: none !important\n}\n\n.eko-gallery .eko-not-visible {\n visibility: hidden !important\n}\n\n.eko-hidden-variant {\n display: none !important\n}\n\n.eko-sr-only {\n width: 1px;\n height: 1px;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n margin: -1px;\n padding: 0;\n position: absolute;\n overflow: hidden\n}\n\n.eko-sticky-top {\n position: sticky;\n top: 0\n}\n\n.eko-gallery .eko-nav {\n height: 100%;\n display: flex;\n align-items: start;\n align-self: start;\n flex-shrink: 0;\n scrollbar-width: none;\n -ms-overflow-style: none\n}\n\n.eko-gallery .eko-nav li {\n font-size: 0;\n position: relative;\n display: flex;\n flex-shrink: 0;\n justify-content: center;\n -webkit-box-pack: center;\n cursor: pointer\n}\n\n.eko-gallery .eko-nav li button {\n position: relative;\n background-color: transparent;\n border-radius: 0;\n line-height: 0;\n overflow: hidden;\n cursor: pointer\n}\n\n.eko-gallery .eko-nav li button img {\n background-color: var(--navItemsBackgroundColorEko);\n pointer-events: none\n}\n\n.eko-gallery .eko-nav li button .item-icon {\n position: absolute;\n top: 0;\n right: 0;\n width: 32px;\n height: 32px;\n transform: scale(.25);\n transform-origin: top right\n}\n\n.eko-gallery .eko-nav li button .item-icon span {\n display: block;\n width: 400%;\n height: 400%;\n position: absolute;\n top: 0;\n right: 0;\n background-position: top right;\n background-repeat: no-repeat;\n background-size: contain\n}\n\n.eko-gallery .eko-nav li .addons-container {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n display: flex;\n flex-direction: column;\n font-size: 10px;\n line-height: 100%\n}\n\n.eko-gallery .eko-nav li .addons-container .thumb-label {\n width: 100%;\n background: var(--navItemsBannerBackgroundColorEko);\n padding: 4px;\n text-align: center;\n text-wrap: balance;\n color: var(--primaryColorEko)\n}\n\n.eko-gallery .eko-nav li .addons-container .step-indicator {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: center;\n gap: 5px;\n padding: 6px\n}\n\n.eko-gallery .eko-nav li .addons-container .step-indicator span {\n width: 5px;\n height: 5px;\n border-radius: 100px;\n background: #fff;\n box-shadow: 0 0 3px #00000094\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label {\n position: relative\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label .step-indicator {\n position: absolute;\n bottom: 0\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label .thumb-label {\n align-content: center\n}\n\n.eko-gallery .eko-nav::-webkit-scrollbar {\n display: none\n}\n\n.eko-nav-container {\n display: flex\n}\n\n.eko-nav-container:has(.eko-nav.eko-not-visible) .eko-nav-arrow {\n display: none\n}\n\n.eko-nav-container {\n position: relative;\n opacity: 0;\n transition: opacity .15s ease-in\n}\n\n.eko-nav-container .eko-nav-arrow {\n width: 28px;\n height: 28px;\n position: absolute;\n display: none;\n justify-content: center;\n align-items: center;\n border-radius: 28px;\n background-color: #fff;\n box-shadow: 0 0 6px #0000001f;\n z-index: 1;\n bottom: 50%;\n opacity: 1;\n transition: opacity .15s ease-in;\n transform: translateY(50%);\n cursor: pointer\n}\n\n.eko-nav-container .eko-nav-arrow.eko-prev-nav-button svg,\n.eko-nav-container .eko-nav-arrow.eko-next-nav-button svg {\n padding: 1px\n}\n\n.eko-nav-container .eko-nav-arrow.eko-prev-nav-button {\n left: 8px\n}\n\n.eko-nav-container .eko-nav-arrow.eko-next-nav-button {\n right: 8px\n}\n\n.eko-nav-container .eko-nav-arrow.eko-hidden-nav-button {\n opacity: 0;\n pointer-events: none\n}\n\n.eko-gallery .eko-nav {\n gap: var(--navItemsGapEkoMobile);\n padding: var(--navBarPaddingEkoMobile)\n}\n\n.eko-gallery .eko-nav li button img {\n width: var(--navItemsWidthEkoMobile);\n height: var(--navItemsHeightEkoMobile);\n object-fit: var(--navItemsObjectFitEkoMobile)\n}\n\n.eko-gallery .eko-nav li .addons-container .thumb-label {\n font-family: var(--navBannerFontFamilyEkoMobile);\n font-size: var(--navBannerFontSizeEkoMobile);\n line-height: var(--navBannerFontLineHeightEkoMobile);\n font-weight: var(--navBannerFontWeightEkoMobile)\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label .thumb-label {\n width: var(--navItemsWidthEkoMobile);\n height: var(--navItemsHeightEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-underline li {\n padding-bottom: calc(var(--navItemsSelectedThicknessEkoMobile) + var(--navItemsSelectedMarginEkoMobile))\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-underline li button {\n border-radius: var(--navItemsRadiusEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-underline li[aria-current=true]:after {\n content: "";\n width: 100%;\n height: var(--navItemsSelectedThicknessEkoMobile);\n border-radius: var(--navItemsSelectedUnderlineRadiusEkoMobile);\n background-color: var(--accentColorEko);\n display: block;\n position: absolute;\n bottom: 0;\n left: 0\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-outline li {\n padding: var(--navItemsSelectedMarginEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-outline li button {\n border-radius: var(--navItemsRadiusEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-outline li[aria-current=true] {\n border-radius: calc(var(--navItemsRadiusEkoMobile) + var(--navItemsSelectedMarginEkoMobile));\n box-shadow: 0 0 0 var(--navItemsSelectedThicknessEkoMobile) var(--accentColorEko)\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery .eko-nav {\n gap: var(--navItemsGapEkoDesktop);\n padding: var(--navBarPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li button img {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop);\n object-fit: var(--navItemsObjectFitEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .addons-container .thumb-label {\n font-family: var(--navBannerFontFamilyEkoDesktop);\n font-size: var(--navBannerFontSizeEkoDesktop);\n line-height: var(--navBannerFontLineHeightEkoDesktop);\n font-weight: var(--navBannerFontWeightEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .addons-container.full-thumb-label .thumb-label {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li {\n border-radius: 0;\n padding: 0;\n padding-bottom: calc(var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop))\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true] {\n box-shadow: none\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true]:after {\n content: "";\n width: 100%;\n height: var(--navItemsSelectedThicknessEkoDesktop);\n border-radius: var(--navItemsSelectedUnderlineRadiusEkoDesktop);\n background-color: var(--accentColorEko);\n display: block;\n position: absolute;\n bottom: 0;\n left: 0\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li {\n padding: var(--navItemsSelectedMarginEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true] {\n border-radius: calc(var(--navItemsRadiusEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop));\n box-shadow: 0 0 0 var(--navItemsSelectedThicknessEkoDesktop) var(--accentColorEko)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true]:after {\n content: none\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container .eko-nav-arrow {\n width: 30px;\n height: 30px\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container .eko-nav-arrow.eko-desktop-arrows {\n display: flex\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container:has(.eko-desktop-nav-selected-underline) .eko-nav-arrow.eko-desktop-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop)) / 2))\n }\n}\n\n@media screen and (max-width: 767px) {\n .eko-gallery.eko-liquid-gallery .eko-nav-arrow.eko-mobile-arrows {\n display: flex\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container:has(.eko-mobile-nav-selected-underline) .eko-nav-arrow.eko-mobile-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoMobile) + var(--navItemsSelectedMarginEkoMobile)) / 2))\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav {\n gap: var(--navItemsGapEkoDesktop);\n padding: var(--navBarPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li button img {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop);\n object-fit: var(--navItemsObjectFitEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .addons-container .thumb-label {\n font-family: var(--navBannerFontFamilyEkoDesktop);\n font-size: var(--navBannerFontSizeEkoDesktop);\n line-height: var(--navBannerFontLineHeightEkoDesktop);\n font-weight: var(--navBannerFontWeightEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .addons-container.full-thumb-label .thumb-label {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li {\n border-radius: 0;\n padding: 0;\n padding-bottom: calc(var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop))\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true] {\n box-shadow: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true]:after {\n content: "";\n width: 100%;\n height: var(--navItemsSelectedThicknessEkoDesktop);\n border-radius: var(--navItemsSelectedUnderlineRadiusEkoDesktop);\n background-color: var(--accentColorEko);\n display: block;\n position: absolute;\n bottom: 0;\n left: 0\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li {\n padding: var(--navItemsSelectedMarginEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true] {\n border-radius: calc(var(--navItemsRadiusEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop));\n box-shadow: 0 0 0 var(--navItemsSelectedThicknessEkoDesktop) var(--accentColorEko)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true]:after {\n content: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav-container .eko-nav-arrow {\n width: 30px;\n height: 30px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav-container .eko-nav-arrow.eko-desktop-arrows {\n display: flex\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav-container:has(.eko-desktop-nav-selected-underline) .eko-nav-arrow.eko-desktop-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop)) / 2))\n }\n}\n\n@media screen and (max-width: 767px) {\n .eko-gallery.eko-react-gallery.eko-mobile .eko-nav-arrow.eko-mobile-arrows {\n display: flex\n }\n\n .eko-gallery.eko-react-gallery.eko-mobile .eko-nav-container:has(.eko-mobile-nav-selected-underline) .eko-nav-arrow.eko-mobile-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoMobile) + var(--navItemsSelectedMarginEkoMobile)) / 2))\n }\n}\n\n.eko-media-badge {\n display: none;\n width: var(--navMediaBadgeSizeEkoMobile);\n height: var(--navMediaBadgeSizeEkoMobile);\n background: #fff;\n align-items: center;\n justify-content: center;\n border-radius: 100%;\n box-shadow: 0 0 4px #00000014;\n place-content: center;\n position: absolute;\n top: var(--navMediaBadgeMarginTopEkoMobile);\n right: var(--navMediaBadgeMarginRightEkoMobile)\n}\n\n.eko-media-badge svg {\n width: 100%;\n height: 100%\n}\n\n.eko-media-badge svg path {\n fill: #000\n}\n\n.eko-nav li .eko-media-badge-mobile {\n display: flex\n}\n\nsvg.interactiveThumb {\n position: absolute;\n top: 3px;\n right: -2.5px;\n width: 100%;\n height: 100%\n}\n\nsvg.interactiveThumb.hand {\n animation: handAnim 2.5s linear infinite\n}\n\nsvg.interactiveThumb.beam {\n animation: beamAnim 2.5s linear infinite;\n transform-origin: 26% 40%;\n top: 0\n}\n\n@keyframes handAnim {\n 0% {\n transform: translateY(0)\n }\n\n 3% {\n transform: translateY(-4px)\n }\n\n 15% {\n transform: translateY(0)\n }\n\n to {\n transform: translateY(0)\n }\n}\n\n@keyframes beamAnim {\n 0% {\n transform: scale(1);\n opacity: 0\n }\n\n 5% {\n transform: scale(1.1);\n opacity: 1\n }\n\n 30% {\n transform: scale(1.4);\n opacity: 0\n }\n\n to {\n transform: scale(1.4);\n opacity: 0\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery .eko-media-badge {\n width: var(--navMediaBadgeSizeEkoDesktop);\n height: var(--navMediaBadgeSizeEkoDesktop);\n top: var(--navMediaBadgeMarginTopEkoDesktop);\n right: var(--navMediaBadgeMarginRightEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .eko-media-badge-mobile {\n display: none\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .eko-media-badge-desktop {\n display: flex\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-media-badge {\n width: var(--navMediaBadgeSizeEkoDesktop);\n height: var(--navMediaBadgeSizeEkoDesktop);\n top: var(--navMediaBadgeMarginTopEkoDesktop);\n right: var(--navMediaBadgeMarginRightEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .eko-media-badge-mobile {\n display: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .eko-media-badge-desktop {\n display: flex\n }\n}\n\n.eko-loading-animation {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n overflow: hidden;\n pointer-events: none\n}\n\n.eko-loading-animation.eko-show-loading-animation .eko-animated-bar {\n opacity: .6\n}\n\n.eko-loading-animation.eko-show-loading-animation .eko-animated-bar .eko-animated-bar-inner {\n animation: eko-loading-bar-inner-animation 2s infinite\n}\n\n.eko-loading-animation.eko-show-loading-text .eko-loading-text {\n opacity: 1\n}\n\n.eko-loading-animation .eko-animated-bar {\n width: 100%;\n height: 4px;\n background-color: #e8e8e8b2;\n opacity: 0;\n transition: opacity .5s;\n position: relative\n}\n\n.eko-loading-animation .eko-animated-bar .eko-animated-bar-inner {\n width: 150px;\n height: 100%;\n transform: translate(-150px);\n background-color: var(--accentColorEko, #4d484b);\n display: block;\n position: absolute\n}\n\n.eko-loading-animation .eko-loading-text {\n position: absolute;\n top: 10px;\n left: 50%;\n transform: translate(-50%);\n color: #656565;\n font-size: 12px;\n font-family: Bogle-Medium, sans-serif;\n font-weight: 500;\n opacity: 0;\n align-items: center;\n display: flex;\n gap: 2px;\n transition: opacity .5s\n}\n\n.eko-loading-animation .eko-loading-text-icon {\n opacity: 60%\n}\n\n.eko-loading-animation .eko-loading-text-icon svg {\n transform: translate(2px, 2px)\n}\n\n.eko-loading-animation .eko-loading-text-icon path {\n fill: var(--accentColorEko, #4d484b)\n}\n\n.eko-loading-animation.eko-hide-icon .eko-loading-text-icon {\n display: none\n}\n\n@keyframes eko-loading-bar-inner-animation {\n 0% {\n left: -350px\n }\n\n to {\n left: calc(100% + 350px)\n }\n}\n\n.eko-smart-loading {\n position: absolute;\n top: 8px;\n left: 50%;\n transform: translate(-50%);\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px\n}\n\n.eko-smart-loading div {\n position: relative;\n width: 158px;\n height: 3px;\n background-color: #dcdcdc;\n overflow: hidden;\n opacity: 0;\n animation: eko-smart-loading-show-animation .2s linear forwards 1s\n}\n\n.eko-smart-loading div:after {\n content: "";\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n background-color: #878787;\n animation: eko-smart-loading-animation 2.5s ease-in-out infinite\n}\n\n.eko-smart-loading p {\n font-size: 11px;\n line-height: 120%;\n font-weight: 500;\n color: #6b6b6b;\n text-shadow: 0 0 2px white;\n opacity: 0;\n animation: eko-smart-loading-show-animation .2s linear forwards 3s\n}\n\n@keyframes eko-smart-loading-animation {\n 0% {\n transform: translate(-100%)\n }\n\n to {\n transform: translate(100%)\n }\n}\n\n@keyframes eko-smart-loading-show-animation {\n 0% {\n opacity: 0\n }\n\n to {\n opacity: 100%\n }\n}\n\n@media screen and (min-width: 450px) {\n .eko-gallery.eko-liquid-gallery .eko-loading-animation .eko-animated-bar {\n height: 6px\n }\n\n .eko-gallery.eko-liquid-gallery .eko-loading-animation .eko-loading-text {\n font-size: 16px;\n top: 12px\n }\n\n .eko-gallery.eko-liquid-gallery .eko-loading-animation .eko-loading-text-icon {\n transform: rotate(180deg)\n }\n}\n\n@media screen and (min-width: 450px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-loading-animation .eko-animated-bar {\n height: 6px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-loading-animation .eko-loading-text {\n font-size: 16px;\n top: 12px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-loading-animation .eko-loading-text-icon {\n transform: rotate(180deg)\n }\n}\n\n.eko-carousel {\n width: 100%;\n white-space: nowrap;\n overflow-x: auto;\n overflow-y: hidden;\n scroll-snap-type: x mandatory;\n overscroll-behavior-x: contain;\n align-self: start;\n align-items: start;\n display: flex;\n gap: 10px;\n scrollbar-width: none;\n -ms-overflow-style: none\n}\n\n.eko-carousel li {\n width: 100%;\n display: inline-block;\n position: relative;\n align-items: start;\n overflow: hidden;\n scroll-snap-align: center;\n scroll-snap-stop: always;\n flex-shrink: 0\n}\n\n.eko-carousel li img.eko-cover-image {\n position: relative;\n pointer-events: none;\n transition: opacity .5s;\n z-index: 1;\n width: 100%;\n height: 100%;\n background-color: var(--carouselInteractiveCoverBackgroundColorEko)\n}\n\n.eko-carousel li iframe {\n position: absolute;\n border: none;\n top: 0;\n left: 0\n}\n\n.eko-carousel li img,\n.eko-carousel li video {\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\n min-width: 0;\n background-color: var(--carouselItemsBackgroundColorEko)\n}\n\n.eko-carousel li[data-type=videoembed],\n.eko-carousel li[data-type=video] {\n cursor: pointer\n}\n\n.eko-carousel::-webkit-scrollbar {\n display: none\n}\n\n.eko-carousel:has(.zoomed) {\n overflow: hidden\n}\n\n.eko-carousel li {\n border-radius: var(--carouselItemsRadiusEkoMobile)\n}\n\n.eko-carousel li img.eko-desktop-cover-image {\n display: none\n}\n\n.eko-carousel li img.eko-mobile-cover-image {\n display: inline\n}\n\n.eko-carousel li img,\n.eko-carousel li video {\n aspect-ratio: var(--carouselItemsAspectRatioEkoMobile);\n object-fit: var(--carouselItemsObjectFitEkoMobile)\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery .eko-carousel li {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-carousel li img,\n .eko-gallery.eko-liquid-gallery .eko-carousel li video {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop);\n object-fit: var(--carouselItemsObjectFitEkoDesktop)\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-carousel li {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-carousel li img,\n .eko-gallery.eko-react-gallery.eko-desktop .eko-carousel li video {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop);\n object-fit: var(--carouselItemsObjectFitEkoDesktop)\n }\n}\n\n.eko-gallery.eko-mobile-embed-layout .eko-nav-container {\n display: none\n}\n\n.eko-gallery.eko-mobile-embed-layout .eko-carousel {\n overflow-x: hidden\n}\n\n.eko-gallery.eko-mobile-embed-layout .eko-mobile-carousel-scroll {\n overflow-x: auto\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery.eko-desktop-embed-layout .eko-nav-container {\n display: none\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-embed-layout .eko-carousel {\n overflow-x: hidden\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-embed-layout .eko-carousel.eko-desktop-carousel-scroll {\n overflow-x: auto\n }\n\n .eko-gallery.eko-liquid-gallery.eko-mobile-embed-layout.eko-desktop-nav-layout .eko-nav-container {\n display: flex\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-embed-layout .eko-nav-container {\n display: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-embed-layout .eko-carousel {\n overflow-x: hidden\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-embed-layout .eko-carousel.eko-desktop-carousel-scroll {\n overflow-x: auto\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-mobile-embed-layout.eko-desktop-nav-layout .eko-nav-container {\n display: flex\n }\n}\n\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-bottom .eko-nav,\n.eko-gallery.eko-desktop-nav-layout.eko-desktop-nav-bottom .eko-nav,\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-top .eko-nav,\n.eko-gallery.eko-desktop-nav-layout.eko-desktop-nav-top .eko-nav {\n flex-direction: row;\n overflow-x: auto;\n overflow-y: hidden;\n max-width: 100%;\n margin: auto\n}\n\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-bottom {\n flex-direction: column-reverse\n}\n\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-top {\n flex-direction: column\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-bottom {\n flex-direction: column-reverse\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-top {\n flex-direction: column\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-bottom {\n flex-direction: column-reverse\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-top {\n flex-direction: column\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right {\n flex-direction: row-reverse\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left {\n flex-direction: row\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav {\n display: flex;\n flex-direction: column;\n justify-content: start;\n overflow-x: hidden;\n overflow-y: auto;\n gap: var(--navItemsGapEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container {\n display: flex;\n flex-shrink: 0\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button {\n top: 4px;\n left: auto\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n bottom: 4px\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n right: 50%;\n transform: translate(50%)\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg {\n transform: rotate(90deg)\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout .eko-carousel {\n align-self: start\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right {\n flex-direction: row-reverse\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left {\n flex-direction: row\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav {\n display: flex;\n flex-direction: column;\n justify-content: start;\n overflow-x: hidden;\n overflow-y: auto;\n gap: var(--navItemsGapEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container {\n display: flex;\n flex-shrink: 0\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button {\n top: 4px;\n left: auto\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n bottom: 4px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n right: 50%;\n transform: translate(50%)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg {\n transform: rotate(90deg)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout .eko-carousel {\n align-self: start\n }\n}\n\n.eko-gallery .eko-introButton {\n cursor: pointer;\n white-space: nowrap;\n pointer-events: auto;\n position: absolute;\n bottom: 100px;\n left: 50%;\n transform: translate(-50%);\n padding: 15px 20px\n}\n\n.eko-gallery .eko-introButton .eko-handContainer {\n display: none\n}\n\n.eko-gallery {\n position: relative;\n overflow: hidden;\n display: flex;\n flex-direction: row;\n justify-content: start;\n margin-inline-start: calc(-1 * var(--outerWidth));\n margin-inline-end: calc(-1 * var(--outerWidth));\n padding: var(--galleryPaddingEkoMobile);\n margin: auto;\n max-width: var(--galleryMaxWidthEkoMobile);\n transition: height var(--galleryTransition, .8s cubic-bezier(.35, 0, 0, 1) 1.5s), padding 0s;\n gap: var(--galleryGapEkoMobile)\n}\n\n.eko-gallery .eko-smart-gallery-container {\n border-radius: var(--carouselItemsRadiusEkoMobile);\n overflow: hidden;\n flex: 1;\n display: flex;\n height: fit-content\n}\n\n.eko-gallery .eko-smart-gallery-container iframe {\n width: 100%;\n aspect-ratio: var(--carouselItemsAspectRatioEkoMobile)\n}\n\n.eko-gallery .eko-smart-gallery-container.eko-project-not-ready {\n position: absolute;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n opacity: 0;\n pointer-events: none;\n touch-action: none\n}\n\n.eko-gallery .eko-smart-gallery-container.eko-project-not-ready iframe {\n pointer-events: none;\n touch-action: none\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery {\n max-width: var(--galleryMaxWidthEkoDesktop);\n gap: var(--galleryGapEkoDesktop);\n padding: var(--galleryPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-smart-gallery-container {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-smart-gallery-container iframe {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop)\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop {\n max-width: var(--galleryMaxWidthEkoDesktop);\n gap: var(--galleryGapEkoDesktop);\n padding: var(--galleryPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-smart-gallery-container {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-smart-gallery-container iframe {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop)\n }\n}'),Xt=({layout:t,style:n})=>{let i={};return function(t={}){Object.keys(t).forEach((e=>{i[`--${e}Eko`]=t[e]}))}(n),function(t){var e,n;const r=(null==t||null===(e=t.desktop)||void 0===e?void 0:e.config)||{},o=(null==t||null===(n=t.mobile)||void 0===n?void 0:n.config)||{};Object.keys(r).forEach((t=>{"string"==typeof r[t]&&(i[`--${t}EkoDesktop`]=r[t])})),Object.keys(o).forEach((t=>{"string"==typeof o[t]&&(i[`--${t}EkoMobile`]=o[t])}))}(t),e.createElement("style",{key:{layout:t,style:n}},`.eko-gallery {${Object.keys(i).map((t=>`${t}: ${i[t]};`)).join("\n")}}`)};Xt.propTypes={layout:Tt.object,style:Tt.object},u("experiment");const Yt=({activeVariantId:t,activeElementId:n,hasInteractive:i,experiments:r,publishItem:o})=>{const s="gallery",a=e.useRef(t),l=e.useRef(n),c=e.useRef(i),u=e.useRef(r),d=e.useRef(o);e.useEffect((()=>{a.current=t,l.current=n,c.current=i,u.current=r,d.current=o}),[t,n,i,r,o]);const h={publishItemPacker:{tag:s,schema:"iglu:com.helloeko/publishitem/jsonschema/1-0-0",match:/.*/,getData:function(){const t=d.current;if(t){const e={};return null!=t&&t.id&&(e.id=t.id),null!=t&&t.productId&&(e.productid=t.productId),t.salesChannelId&&(e.saleschannelid=t.salesChannelId),null!=t&&t.salesChannelName&&(e.saleschannelname=t.salesChannelName),t.salesChannelType&&(e.saleschanneltype=t.salesChannelType),e.id?e:void 0}}},galleryInteractionPacker:{tag:s,schema:"iglu:com.helloeko/gallery_interaction/jsonschema/1-0-0",match:"gallery.interaction",getData:function({elementid:t,interactiontype:e}){return{elementid:String(t),interactiontype:e}}},galleryPacker:{tag:s,schema:"iglu:com.helloeko/gallery/jsonschema/1-0-2",match:/^gallery.*/,getData:function(){var t;return{activeitemid:l.current.toString(),activevariantid:a.current,hasinteractive:c.current,version:(null===(t=window.eko)||void 0===t||null===(t=t.gallery)||void 0===t?void 0:t.version)||""}}},activeVariantIdPacker:{tag:s,schema:"iglu:com.helloeko/variant/jsonschema/1-0-1",match:/.*/,getData:function(){if(a.current)return{id:a.current}}},experimentPacker:{tag:s,schema:"iglu:com.helloeko/experiment/jsonschema/1-0-3",match:/.*/,getData:function(){var t;let e=function(t){let e=null;if(t){const n=Math.floor(Date.now()/1e3);for(const i of t){if("deliverable"!==i.type)return;const t=Math.floor(new Date(i.startDate).getTime()/1e3),r=Math.floor(new Date(i.endDate).getTime()/1e3);!0===i.active&&n>t&&n<r&&(e=i)}}return e}(u.current);if(!e)return;let n={experimentid:e.id||"",experimentvariant:e.chosen||"pending decision",experimenttype:e.type||""},i=null===(t=e.targetDevice)||void 0===t?void 0:t.toLowerCase();return"mobile"!==i&&"notmobile"!==i||(n.experimenttargeting={device:i}),n}}};return e.useEffect((()=>(Object.values(h).forEach((t=>{window.EkoAnalytics("registerContextPacker",t)})),()=>{window.EkoAnalytics("reset",s)})),[]),null};Yt.propTypes={activeVariantId:Tt.string,activeElementId:Tt.number,hasInteractive:Tt.bool,experiments:Tt.array,publishItem:Tt.object};const Qt=({variantId:t,activeItem:n,hasInteractive:i,activeIndex:r,experiments:o,publishItem:s})=>{const a=e.useRef(!0);return e.useEffect((()=>{a.current||t&&S.track("gallery.variant.change")}),[t]),e.useEffect((()=>{a.current||S.track("gallery.element.change",{activeIndex:r})}),[r]),e.useEffect((()=>{a.current||n&&null!=s&&s.id&&S.track("gallery.asset.view",{publishitemid:s.id,type:n.type,name:n.name})}),[n]),e.useEffect((()=>{a.current=!1}),[]),e.createElement(Yt,{activeVariantId:t||"ekonovar",activeElementId:r,hasInteractive:i,experiments:o,publishItem:s})};Qt.propTypes={variantId:Tt.string,activeItem:Tt.object,hasInteractive:Tt.bool,activeIndex:Tt.number,experiments:Tt.array,publishItem:Tt.object};const Jt="eko-gallery-react";function Zt(t,e){var n,i,r;const o=(null==t||null===(n=t.variantMap)||void 0===n?void 0:n[e])||"ekonovar";return(null==t||null===(i=t.items)||void 0===i?void 0:i.find((t=>(null==t?void 0:t.variantId)===o)))||(null==t||null===(r=t.items)||void 0===r?void 0:r[0])}"undefined"!=typeof window&&(window.EkoAnalytics||(console.log("EkoAnalytics is not defined, initializing a no-op function..."),window.EkoAnalytics=()=>{}));const te=e.forwardRef((({className:t,config:n,instanceId:i,variantId:r,activeItem:o={index:0,step:0},onEvent:s,forceMobile:a},l)=>{var c,u,d,h,f,p;const m=null!==(c=null===(u=n.options)||void 0===u?void 0:u.loadingTimeout)&&void 0!==c?c:12,v=null===(d=null===(h=n.options)||void 0===h?void 0:h.showCoverLoadAnimation)||void 0===d||d,[g,y]=e.useState(Zt(n,r)),[b,k]=e.useState({index:o.index,step:o.step,source:"external-nav"}),[x,w]=e.useState(!1),[_,T]=e.useState(!1),[I,E]=e.useState("eko-desktop"),A=e.useRef(!1),N=e.useRef(!1),M=e.useRef(o),F=e.useRef(null),C=e.useRef(r);function O(){const t=a||window.innerWidth<768?"eko-mobile":"eko-desktop";E(t)}return N.current||(Ft.send("galleryinit"),N.current=!0),e.useEffect((()=>{const t=C.current!==r;C.current=r,y(Zt(n,r)),t&&!A.current&&k({index:0,step:0,source:"external-nav"})}),[n,r]),e.useEffect((()=>{if(s)return Ft.subscribe(s),()=>{Ft.unsubscribe()}}),[s]),e.useEffect((()=>{A.current=_}),[_]),e.useEffect((()=>{w(!1),T(!1);const t=setTimeout((()=>{A.current||(w(!0),S.track("gallery.load.timeout"))}),1e3*m);return()=>{clearTimeout(t)}}),[n]),e.useEffect((()=>{O()}),[a]),e.useEffect((()=>(window.addEventListener("resize",O),O(),()=>{window.removeEventListener("resize",O)})),[a]),e.useEffect((()=>(window.EkoAnalytics("trackElementVisibility",F.current,Jt),()=>{window.EkoAnalytics("stopTrackingElementVisibility",Jt)})),[]),e.useEffect((()=>{!("carousel"===(null==b?void 0:b.source)||"nav"===(null==b?void 0:b.source))||(null==b?void 0:b.index)===o.index&&(null==b?void 0:b.step)===o.step||Ft.send("activeitemchanged",{index:null==b?void 0:b.index,step:null==b?void 0:b.step})}),[b,o]),e.useEffect((()=>{M.current.index===o.index&&M.current.step===o.step||(M.current=o,k({index:o.index,step:o.step,source:"external-nav"}))}),[o]),e.createElement(e.Fragment,null,e.createElement(Kt,null),e.createElement(Xt,{layout:n.layout,style:n.style,forceMobile:a}),e.createElement(Qt,{variantId:r,activeItem:null==g||null===(f=g.items)||void 0===f?void 0:f[b.index],activeIndex:b.index,hasInteractive:_,experiments:n.experiments,publishItem:null==n||null===(p=n.__autoGenerated)||void 0===p?void 0:p.publishItem}),e.createElement("section",{className:`${`eko-gallery eko-react-gallery ${function(t){let e="";return["mobile","desktop"].forEach((n=>{var i,r;const o=null!==(i=null==t||null===(r=t[n])||void 0===r?void 0:r.type)&&void 0!==i?i:"nav";if(e+=`eko-${n}-${o}-layout `,"nav"===o){var s;const i="desktop"===n,r=(null==t||null===(s=t[n])||void 0===s||null===(s=s.config)||void 0===s?void 0:s.orientation)||(i?"left":"bottom");e+=`eko-${n}-nav-${r} `}})),e}(n.layout)} ${null!=t?t:""}`.trim()} ${I}`,"aria-controls":"main-content",ref:F},e.createElement(Rt,{items:(null==g?void 0:g.items)||[],setActiveIndex:k,activeIndex:b.index,layout:n.layout,carouselMounted:_,forceMobile:a}),!_&&e.createElement($t,{ref:l,items:(null==g?void 0:g.items)||[],setActiveIndex:k,activeIndex:{index:b.index,source:null==b?void 0:b.source},showSmartLoaders:!x&&v}),!x&&e.createElement(Gt,{ref:l,config:n,instanceId:i,activeItem:b,setActiveItem:k,variantId:null==g?void 0:g.variantId,smartGalleryLoaded:_,forceMobile:a,onLoad:function(){T(!0)}})))}));te.propTypes={className:Tt.string,config:Tt.object.isRequired,instanceId:Tt.string,variantId:Tt.string,activeItem:Tt.object,onEvent:Tt.func,forceMobile:Tt.bool,onPrev:Tt.func,onNext:Tt.func},te.displayName="EkoGallery";var ee=e.memo(te);const ne=u("gallery-react");const ie=e.forwardRef(((t,n)=>{var i;e.useEffect((()=>(ne.setDataStorage("gallery-react",{config:t.config}),window.eko=window.eko||{},window.eko.config=t.config,window.eko.gallery={version:"4.0.4"},()=>{window.eko.config=void 0})),[t.config]);const{children:r,...o}=t;return void 0!==t.config?e.createElement(ee,R({ref:n},o,{key:null===(i=t.config.__autoGenerated)||void 0===i||null===(i=i.publishItem)||void 0===i?void 0:i.id})):r}));ie.propTypes={className:Tt.string,config:Tt.object,variantId:Tt.string,onEvent:Tt.func,instanceId:Tt.string,children:Tt.node},ie.displayName="EkoGalleryWrapper";var re,oe,se,ae,le,ce,ue,de,he,fe,pe,me,ve,ge,ye,be,ke,xe,we,_e,Te,Ie,Ee,Se,Ae,Ne,Me,Fe,Ce,Oe,Pe,Re,De,Le,Be,ze,We,$e,Ue,je,qe,Ve,He,Ge,Ke,Xe,Ye,Qe,Je,Ze,tn,en,nn=e.memo(ie);const rn=1,on=2,sn=4,an=8,ln=16,cn=1,un=4,dn=8,hn=16,fn="[",pn="[!",mn="]",vn={},gn=Symbol(),yn="http://www.w3.org/1999/xhtml",bn="@attach",kn=!1;var xn=Array.isArray,wn=Array.prototype.indexOf,_n=Array.from,Tn=Object.defineProperty,In=Object.getOwnPropertyDescriptor,En=Object.getOwnPropertyDescriptors,Sn=Object.prototype,An=Array.prototype,Nn=Object.getPrototypeOf,Mn=Object.isExtensible;function Fn(){var t,e;return{promise:new Promise(((n,i)=>{t=n,e=i})),resolve:t,reject:e}}const Cn=2,On=4,Pn=8,Rn=1<<24,Dn=16,Ln=32,Bn=64,zn=128,Wn=512,$n=1024,Un=2048,jn=4096,qn=8192,Vn=16384,Hn=32768,Gn=65536,Kn=1<<17,Xn=1<<18,Yn=1<<19,Qn=1<<20,Jn=1<<25,Zn=32768,ti=1<<21,ei=1<<22,ni=1<<23,ii=Symbol("$state"),ri=Symbol("legacy props"),oi=Symbol(""),si=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},ai=3,li=8;function ci(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function ui(t){console.warn("https://svelte.dev/e/hydration_mismatch")}let di,hi=!1;function fi(t){hi=t}function pi(t){if(null===t)throw ui(),vn;return di=t}function mi(){return pi(fo(di))}function vi(t){if(hi){if(null!==fo(di))throw ui(),vn;di=t}}function gi(t=!0){for(var e=0,n=di;;){if(n.nodeType===li){var i=n.data;if(i===mn){if(0===e)return n;e-=1}else i!==fn&&i!==pn||(e+=1)}var r=fo(n);t&&n.remove(),n=r}}function yi(t){if(!t||t.nodeType!==li)throw ui(),vn;return t.data}function bi(t){return t===this.v}function ki(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 xi=!1,wi=null;function _i(t){wi=t}function Ti(t){return Si().get(t)}function Ii(t,e=!1,n){wi={p:wi,i:!1,c:null,e:null,s:t,x:null,l:null}}function Ei(t){var e=wi,n=e.e;if(null!==n)for(var i of(e.e=null,n))Eo(i);return e.i=!0,wi=e.p,{}}function Si(t){var e,n;return null===wi&&ci(),null!==(n=(e=wi).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}(wi)||void 0)}let Ai=[];function Ni(){var t=Ai;Ai=[],function(t){for(var e=0;e<t.length;e++)t[e]()}(t)}function Mi(t){if(0===Ai.length&&!Vi){var e=Ai;queueMicrotask((()=>{e===Ai&&Ni()}))}Ai.push(t)}function Fi(){for(;Ai.length>0;)Ni()}function Ci(t){var e=Xo;if(null===e)return Ho.f|=ni,t;if(e.f&Hn)Oi(t,e);else{if(!(e.f&zn))throw t;e.b.error(t)}}function Oi(t,e){for(;null!==e;){if(e.f&zn)try{return void e.b.error(t)}catch(e){t=e}e=e.parent}throw t}const Pi=-7169;function Ri(t,e){t.f=t.f&Pi|e}function Di(t){t.f&Wn||null===t.deps?Ri(t,$n):Ri(t,jn)}function Li(t){if(null!==t)for(const e of t)e.f&Cn&&e.f&Zn&&(e.f^=Zn,Li(e.deps))}function Bi(t,e,n){t.f&Un?e.add(t):t.f&jn&&n.add(t),Li(t.deps),Ri(t,$n)}const zi=new Set;let Wi=null,$i=null,Ui=[],ji=null,qi=!1,Vi=!1;var Hi=new WeakMap,Gi=new WeakMap,Ki=new WeakMap,Xi=new WeakMap,Yi=new WeakMap,Qi=new WeakMap,Ji=new WeakMap,Zi=new WeakSet;class tr{constructor(){O(this,Zi),P(this,"committed",!1),P(this,"current",new Map),P(this,"previous",new Map),F(this,Hi,new Set),F(this,Gi,new Set),F(this,Ki,0),F(this,Xi,0),F(this,Yi,null),F(this,Qi,new Set),F(this,Ji,new Set),P(this,"skipped_effects",new Set),P(this,"is_fork",!1)}is_deferred(){return this.is_fork||M(Xi,this)>0}process(t){Ui=[],this.apply();var e,n=[],i=[];for(const e of t)A(Zi,this,er).call(this,e,n,i);(this.is_fork||A(Zi,this,ir).call(this),this.is_deferred())?(A(Zi,this,nr).call(this,i),A(Zi,this,nr).call(this,n)):(Wi=null,lr(i),lr(n),null===(e=M(Yi,this))||void 0===e||e.resolve());$i=null}capture(t,e){var n;(e===gn||this.previous.has(t)||this.previous.set(t,e),t.f&ni)||(this.current.set(t,t.v),null===(n=$i)||void 0===n||n.set(t,t.v))}activate(){Wi=this,this.apply()}deactivate(){Wi===this&&(Wi=null,$i=null)}flush(){if(this.activate(),Ui.length>0){if(or(),null!==Wi&&Wi!==this)return}else 0===M(Ki,this)&&this.process([]);this.deactivate()}discard(){for(const t of M(Gi,this))t(this);M(Gi,this).clear()}increment(t){C(Ki,this,M(Ki,this)+1),t&&C(Xi,this,M(Xi,this)+1)}decrement(t){C(Ki,this,M(Ki,this)-1),t&&C(Xi,this,M(Xi,this)-1),this.revive()}revive(){for(const t of M(Qi,this))M(Ji,this).delete(t),Ri(t,Un),dr(t);for(const t of M(Ji,this))Ri(t,jn),dr(t);this.flush()}oncommit(t){M(Hi,this).add(t)}ondiscard(t){M(Gi,this).add(t)}settled(){var t;return(null!==(t=M(Yi,this))&&void 0!==t?t:C(Yi,this,Fn())).promise}static ensure(){if(null===Wi){const t=Wi=new tr;zi.add(Wi),Vi||tr.enqueue((()=>{Wi===t&&t.flush()}))}return Wi}static enqueue(t){Mi(t)}apply(){}}function er(t,e,n){t.f^=$n;for(var i=t.first,r=null;null!==i;){var o=i.f,s=!!(o&(Ln|Bn));if(!(s&&!!(o&$n)||!!(o&qn)||this.skipped_effects.has(i))&&null!==i.fn){s?i.f^=$n:null!==r&&o&(On|Pn|Rn)?r.b.defer_effect(i):o&On?e.push(i):as(i)&&(o&Dn&&M(Qi,this).add(i),hs(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 nr(t){for(var e=0;e<t.length;e+=1)Bi(t[e],M(Qi,this),M(Ji,this))}function ir(){if(0===M(Xi,this)){for(const t of M(Hi,this))t();M(Hi,this).clear()}0===M(Ki,this)&&A(Zi,this,rr).call(this)}function rr(){if(zi.size>1){this.previous.clear();var t=$i,e=!0;for(const t of zi){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=Ui;Ui=[];const e=new Set,o=new Map;for(const t of i)cr(t,r,e,o);if(Ui.length>0){Wi=t,t.apply();for(const e of Ui)A(Zi,t,er).call(t,e,[],[]);t.deactivate()}Ui=n}}Wi=null,$i=t}this.committed=!0,zi.delete(this)}function or(){var t=Uo;qi=!0;try{var e=0;for(jo(!0);Ui.length>0;){var n=tr.ensure();if(e++>1e3)sr();n.process(Ui),Kr.clear()}}finally{qi=!1,jo(t),ji=null}}function sr(){try{!function(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}()}catch(t){Oi(t,ji)}}let ar=null;function lr(t){var e=t.length;if(0!==e){for(var n=0;n<e;){var i,r=t[n++];if(!(r.f&(Vn|qn))&&as(r))if(ar=new Set,hs(r),null===r.deps&&null===r.first&&null===r.nodes&&(null===r.teardown&&null===r.ac?Do(r):r.fn=null),(null===(i=ar)||void 0===i?void 0:i.size)>0){Kr.clear();for(const t of ar){if(t.f&(Vn|qn))continue;const e=[t];let n=t.parent;for(;null!==n;)ar.has(n)&&(ar.delete(n),e.push(n)),n=n.parent;for(let t=e.length-1;t>=0;t--){const n=e[t];n.f&(Vn|qn)||hs(n)}}ar.clear()}}ar=null}}function cr(t,e,n,i){if(!n.has(t)&&(n.add(t),null!==t.reactions))for(const r of t.reactions){const t=r.f;t&Cn?cr(r,e,n,i):t&(ei|Dn)&&!(t&Un)&&ur(r,e,i)&&(Ri(r,Un),dr(r))}}function ur(t,e,n){const i=n.get(t);if(void 0!==i)return i;if(null!==t.deps)for(const i of t.deps){if(e.includes(i))return!0;if(i.f&Cn&&ur(i,e,n))return n.set(i,!0),!0}return n.set(t,!1),!1}function dr(t){for(var e=ji=t;null!==e.parent;){var n=(e=e.parent).f;if(qi&&e===Xo&&n&Dn&&!(n&Xn))return;if(n&(Bn|Ln)){if(!(n&$n))return;e.f^=$n}}Ui.push(e)}var hr=Gn|Yn|zn;var fr=new WeakMap,pr=new WeakMap,mr=new WeakMap,vr=new WeakMap,gr=new WeakMap,yr=new WeakMap,br=new WeakMap,kr=new WeakMap,xr=new WeakMap,wr=new WeakMap,_r=new WeakMap,Tr=new WeakMap,Ir=new WeakMap,Er=new WeakMap,Sr=new WeakMap,Ar=new WeakMap,Nr=new WeakMap,Mr=new WeakSet;class Fr{constructor(t,e,n){O(this,Mr),P(this,"parent",void 0),P(this,"is_pending",!1),F(this,fr,void 0),F(this,pr,hi?di:null),F(this,mr,void 0),F(this,vr,void 0),F(this,gr,void 0),F(this,yr,null),F(this,br,null),F(this,kr,null),F(this,xr,null),F(this,wr,null),F(this,_r,0),F(this,Tr,0),F(this,Ir,!1),F(this,Er,new Set),F(this,Sr,new Set),F(this,Ar,null),F(this,Nr,function(t){let e,n=0,i=Yr(0);return()=>{_o()&&(ps(i),Ao((()=>(0===n&&(e=gs((()=>t((()=>eo(i)))))),n+=1,()=>{Mi((()=>{var t;n-=1,0===n&&(null===(t=e)||void 0===t||t(),e=void 0,eo(i))}))}))))}}((()=>(C(Ar,this,Yr(M(_r,this))),()=>{C(Ar,this,null)})))),C(fr,this,t),C(mr,this,e),C(vr,this,n),this.parent=Xo.b,this.is_pending=!!M(mr,this).pending,C(gr,this,Mo((()=>{if(Xo.b=this,hi){const t=M(pr,this);mi();t.nodeType===li&&t.data===pn?A(Mr,this,Or).call(this):(A(Mr,this,Cr).call(this),0===M(Tr,this)&&(this.is_pending=!1))}else{var t=A(Mr,this,Pr).call(this);try{C(yr,this,Co((()=>n(t))))}catch(t){this.error(t)}M(Tr,this)>0?A(Mr,this,Dr).call(this):this.is_pending=!1}return()=>{var t;null===(t=M(wr,this))||void 0===t||t.remove()}}),hr)),hi&&C(fr,this,di)}defer_effect(t){Bi(t,M(Er,this),M(Sr,this))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!M(mr,this).pending}update_pending_count(t){A(Mr,this,Lr).call(this,t),C(_r,this,M(_r,this)+t),M(Ar,this)&&to(M(Ar,this),M(_r,this))}get_effect_pending(){return M(Nr,this).call(this),ps(M(Ar,this))}error(t){var e=M(mr,this).onerror;let n=M(mr,this).failed;if(M(Ir,this)||!e&&!n)throw t;M(yr,this)&&(Ro(M(yr,this)),C(yr,this,null)),M(br,this)&&(Ro(M(br,this)),C(br,this,null)),M(kr,this)&&(Ro(M(kr,this)),C(kr,this,null)),hi&&(pi(M(pr,this)),function(t=1){if(hi){for(var e=t,n=di;e--;)n=fo(n);di=n}}(),pi(gi()));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")}(),tr.ensure(),C(_r,this,0),null!==M(kr,this)&&Lo(M(kr,this),(()=>{C(kr,this,null)})),this.is_pending=this.has_pending_snippet(),C(yr,this,A(Mr,this,Rr).call(this,(()=>(C(Ir,this,!1),Co((()=>M(vr,this).call(this,M(fr,this)))))))),M(Tr,this)>0?A(Mr,this,Dr).call(this):this.is_pending=!1)};var s=Ho;try{Ko(null),r=!0,null==e||e(t,o),r=!1}catch(t){Oi(t,M(gr,this)&&M(gr,this).parent)}finally{Ko(s)}n&&Mi((()=>{C(kr,this,A(Mr,this,Rr).call(this,(()=>{tr.ensure(),C(Ir,this,!0);try{return Co((()=>{n(M(fr,this),(()=>t),(()=>o))}))}catch(t){return Oi(t,M(gr,this).parent),null}finally{C(Ir,this,!1)}})))}))}}function Cr(){try{C(yr,this,Co((()=>M(vr,this).call(this,M(fr,this)))))}catch(t){this.error(t)}}function Or(){const t=M(mr,this).pending;t&&(C(br,this,Co((()=>t(M(fr,this))))),tr.enqueue((()=>{var t=A(Mr,this,Pr).call(this);C(yr,this,A(Mr,this,Rr).call(this,(()=>(tr.ensure(),Co((()=>M(vr,this).call(this,t))))))),M(Tr,this)>0?A(Mr,this,Dr).call(this):(Lo(M(br,this),(()=>{C(br,this,null)})),this.is_pending=!1)})))}function Pr(){var t=M(fr,this);return this.is_pending&&(C(wr,this,uo()),M(fr,this).before(M(wr,this)),t=M(wr,this)),t}function Rr(t){var e=Xo,n=Ho,i=wi;Yo(M(gr,this)),Ko(M(gr,this)),_i(M(gr,this).ctx);try{return t()}catch(t){return Ci(t),null}finally{Yo(e),Ko(n),_i(i)}}function Dr(){const t=M(mr,this).pending;null!==M(yr,this)&&(C(xr,this,document.createDocumentFragment()),M(xr,this).append(M(wr,this)),$o(M(yr,this),M(xr,this))),null===M(br,this)&&C(br,this,Co((()=>t(M(fr,this)))))}function Lr(t){var e;if(this.has_pending_snippet()){if(C(Tr,this,M(Tr,this)+t),0===M(Tr,this)){this.is_pending=!1;for(const t of M(Er,this))Ri(t,Un),dr(t);for(const t of M(Sr,this))Ri(t,jn),dr(t);M(Er,this).clear(),M(Sr,this).clear(),M(br,this)&&Lo(M(br,this),(()=>{C(br,this,null)})),M(xr,this)&&(M(fr,this).before(M(xr,this)),C(xr,this,null))}}else this.parent&&A(Mr,e=this.parent,Lr).call(e,t)}function Br(t,e,n,i){const r=Wr;if(0!==n.length||0!==t.length){var o,s,a,l,c=Wi,u=Xo,d=(o=Xo,s=Ho,a=wi,l=Wi,function(t=!0){Yo(o),Ko(s),_i(a),t&&(null==l||l.activate())});t.length>0?Promise.all(t).then((()=>{d();try{return h()}finally{null==c||c.deactivate(),zr()}})):h()}else i(e.map(r));function h(){Promise.all(n.map((t=>$r(t)))).then((t=>{d();try{i([...e.map(r),...t])}catch(t){u.f&Vn||Oi(t,u)}null==c||c.deactivate(),zr()})).catch((t=>{Oi(t,u)}))}}function zr(){Yo(null),Ko(null),_i(null)}function Wr(t){var e=Cn|Un,n=null!==Ho&&Ho.f&Cn?Ho:null;null!==Xo&&(Xo.f|=Yn);return{ctx:wi,deps:null,effects:null,equals:bi,f:e,fn:t,reactions:null,rv:0,v:gn,wv:0,parent:null!=n?n:Xo,ac:null}}function $r(t,e,n){let i=Xo;null===i&&function(){throw new Error("https://svelte.dev/e/async_derived_orphan")}();var r=i.b,o=void 0,s=Yr(gn),a=!Ho,l=new Map;return function(t){wo(ei|Yn,t,!0)}((()=>{var e=Fn();o=e.promise;try{Promise.resolve(t()).then(e.resolve,e.reject).then((()=>{n===Wi&&n.committed&&n.deactivate(),zr()}))}catch(t){e.reject(t),zr()}var n=Wi;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(si),l.delete(n),l.set(n,e)}const u=(t,e=void 0)=>{if(n.activate(),e)e!==si&&(s.f|=ni,to(s,e));else{s.f&ni&&(s.f^=ni),to(s,t);for(const[t,e]of l){if(l.delete(t),t===n)break;e.reject(si)}}a&&(r.update_pending_count(-1),n.decrement(c))};e.promise.then(u,(t=>u(null,t||"unknown")))})),To((()=>{for(const t of l.values())t.reject(si)})),new Promise((t=>{!function e(n){function i(){n===o?t(s):e(o)}n.then(i,i)}(o)}))}function Ur(t){const e=Wr(t);return Jo(e),e}function jr(t){const e=Wr(t);return e.equals=ki,e}function qr(t){var e=t.effects;if(null!==e){t.effects=null;for(var n=0;n<e.length;n+=1)Ro(e[n])}}function Vr(t){var e,n=Xo;Yo(function(t){for(var e=t.parent;null!==e;){if(!(e.f&Cn))return e.f&Vn?null:e;e=e.parent}return null}(t));try{t.f&=~Zn,qr(t),e=cs(t)}finally{Yo(n)}return e}function Hr(t){var e,n,i=Vr(t);if(!t.equals(i)&&(t.wv=ss(),(null===(e=Wi)||void 0===e||!e.is_fork||null===t.deps)&&(t.v=i,null===t.deps)))return void Ri(t,$n);qo||(null!==$i?(_o()||null!==(n=Wi)&&void 0!==n&&n.is_fork)&&$i.set(t,i):Di(t))}let Gr=new Set;const Kr=new Map;let Xr=!1;function Yr(t,e){return{f:0,v:t,reactions:null,equals:bi,rv:0,wv:0}}function Qr(t,e){const n=Yr(t);return Jo(n),n}function Jr(t,e=!1,n=!0){const i=Yr(t);return e||(i.equals=ki),i}function Zr(t,e,n=!1){var i;return null!==Ho&&(!Go||Ho.f&Kn)&&Ho.f&(Cn|Dn|ei|Kn)&&(null===(i=Qo)||void 0===i||!i.includes(t))&&function(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}(),to(t,n?io(e):e)}function to(t,e){if(!t.equals(e)){var n=t.v;qo?Kr.set(t,e):Kr.set(t,n),t.v=e;var i=tr.ensure();if(i.capture(t,n),t.f&Cn){const e=t;t.f&Un&&Vr(e),Di(e)}t.wv=ss(),no(t,Un),null!==Xo&&Xo.f&$n&&!(Xo.f&(Ln|Bn))&&(null===es?function(t){es=t}([t]):es.push(t)),!i.is_fork&&Gr.size>0&&!Xr&&function(){Xr=!1;var t=Uo;jo(!0);const e=Array.from(Gr);try{for(const t of e)t.f&$n&&Ri(t,jn),as(t)&&hs(t)}finally{jo(t)}Gr.clear()}()}return e}function eo(t){Zr(t,t.v+1)}function no(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&Un);if(a&&Ri(o,e),s&Cn){var l,c=o;null===(l=$i)||void 0===l||l.delete(c),s&Zn||(s&Wn&&(o.f|=Zn),no(c,jn))}else a&&(s&Dn&&null!==ar&&ar.add(o),dr(o))}}function io(t){if("object"!=typeof t||null===t||ii in t)return t;const e=Nn(t);if(e!==Sn&&e!==An)return t;var n=new Map,i=xn(t),r=Qr(0),o=rs,s=t=>{if(rs===o)return t();var e=Ho,n=rs;Ko(null),os(o);var i=t();return Ko(e),os(n),i};return i&&n.set("length",Qr(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=Qr(i.value);return n.set(e,t),t})):Zr(r,i.value,!0),!0},deleteProperty(t,e){var i=n.get(e);if(void 0===i){if(e in t){const t=s((()=>Qr(gn)));n.set(e,t),eo(r)}}else Zr(i,gn),eo(r);return!0},get(e,i,r){var o;if(i===ii)return t;var a=n.get(i),l=i in e;if(void 0===a&&(!l||null!==(o=In(e,i))&&void 0!==o&&o.writable)&&(a=s((()=>Qr(io(l?e[i]:gn)))),n.set(i,a)),void 0!==a){var c=ps(a);return c===gn?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=ps(r))}else if(void 0===i){var o=n.get(e),s=null==o?void 0:o.v;if(void 0!==o&&s!==gn)return{enumerable:!0,configurable:!0,value:s,writable:!0}}return i},has(t,e){var i;if(e===ii)return!0;var r=n.get(e),o=void 0!==r&&r.v!==gn||Reflect.has(t,e);if((void 0!==r||null!==Xo&&(!o||null!==(i=In(t,e))&&void 0!==i&&i.writable))&&(void 0===r&&(r=s((()=>Qr(o?io(t[e]):gn))),n.set(e,r)),ps(r)===gn))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?Zr(h,gn):d in t&&(h=s((()=>Qr(gn))),n.set(d+"",h))}void 0===c?(!u||null!==(l=In(t,e))&&void 0!==l&&l.writable)&&(Zr(c=s((()=>Qr(void 0))),io(o)),n.set(e,c)):(u=c.v!==gn,Zr(c,s((()=>io(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&&Zr(p,m+1)}eo(r)}return!0},ownKeys(t){ps(r);var e=Reflect.ownKeys(t).filter((t=>{var e=n.get(t);return void 0===e||e.v!==gn}));for(var[i,o]of n)o.v===gn||i in t||e.push(i);return e},setPrototypeOf(){!function(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}()}})}function ro(t){try{if(null!==t&&"object"==typeof t&&ii in t)return t[ii]}catch{}return t}var oo,so,ao,lo;function co(){if(void 0===oo){oo=window,so=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,n=Text.prototype;ao=In(e,"firstChild").get,lo=In(e,"nextSibling").get,Mn(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),Mn(n)&&(n.__t=void 0)}}function uo(t=""){return document.createTextNode(t)}function ho(t){return ao.call(t)}function fo(t){return lo.call(t)}function po(t,e){if(!hi)return ho(t);var n=ho(di);if(null===n)n=di.appendChild(uo());else if(e&&n.nodeType!==ai){var i,r=uo();return null===(i=n)||void 0===i||i.before(r),pi(r),r}return pi(n),n}function mo(t,e=!1){var n;if(!hi){var i=ho(t);return i instanceof Comment&&""===i.data?fo(i):i}if(e&&(null===(n=di)||void 0===n?void 0:n.nodeType)!==ai){var r,o=uo();return null===(r=di)||void 0===r||r.before(o),pi(o),o}return di}function vo(t,e=1,n=!1){var i;let r=hi?di:t;for(var o;e--;)o=r,r=fo(r);if(!hi)return r;if(n&&(null===(i=r)||void 0===i?void 0:i.nodeType)!==ai){var s,a=uo();if(null===r)null===(s=o)||void 0===s||s.after(a);else r.before(a);return pi(a),a}return pi(r),r}function go(t){t.textContent=""}function yo(t,e){if(e){const e=document.body;t.autofocus=!0,Mi((()=>{document.activeElement===e&&t.focus()}))}}let bo=!1;function ko(t){var e=Ho,n=Xo;Ko(null),Yo(null);try{return t()}finally{Ko(e),Yo(n)}}function xo(t){null===Xo&&(null===Ho&&function(){throw new Error("https://svelte.dev/e/effect_orphan")}(),function(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}()),qo&&function(){throw new Error("https://svelte.dev/e/effect_in_teardown")}()}function wo(t,e,n){var i=Xo;null!==i&&i.f&qn&&(t|=qn);var r={ctx:wi,deps:null,nodes:null,f:t|Un|Wn,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{hs(r),r.f|=Hn}catch(t){throw Ro(r),t}else null!==e&&dr(r);var o=r;if(!n||null!==o.deps||null!==o.teardown||null!==o.nodes||o.first!==o.last||o.f&Yn||(o=o.first,t&Dn&&t&Gn&&null!==o&&(o.f|=Gn)),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!==Ho&&Ho.f&Cn&&!(t&Bn))){var s,a=Ho;(null!==(s=a.effects)&&void 0!==s?s:a.effects=[]).push(o)}return r}function _o(){return null!==Ho&&!Go}function To(t){const e=wo(Pn,null,!1);return Ri(e,$n),e.teardown=t,e}function Io(t){xo();var e=Xo.f;if(!!(Ho||!(e&Ln)||e&Hn))return Eo(t);var n,i=wi;(null!==(n=i.e)&&void 0!==n?n:i.e=[]).push(t)}function Eo(t){return wo(On|Qn,t,!1)}function So(t){return wo(On,t,!1)}function Ao(t,e=0){return wo(Pn|e,t,!0)}function No(t,e=[],n=[],i=[]){Br(i,e,n,(e=>{wo(Pn,(()=>t(...e.map(ps))),!0)}))}function Mo(t,e=0){return wo(Dn|e,t,!0)}function Fo(t,e=0){return wo(Rn|e,t,!0)}function Co(t){return wo(Ln|Yn,t,!0)}function Oo(t){var e=t.teardown;if(null!==e){const t=qo,n=Ho;Vo(!0),Ko(null);try{e.call(null)}finally{Vo(t),Ko(n)}}}function Po(t,e=!1){var n=t.first;for(t.first=t.last=null;null!==n;){const t=n.ac;null!==t&&ko((()=>{t.abort(si)}));var i=n.next;n.f&Bn?n.parent=null:Ro(n,e),n=i}}function Ro(t,e=!0){var n=!1;(e||t.f&Xn)&&null!==t.nodes&&null!==t.nodes.end&&(!function(t,e){for(;null!==t;){var n=t===e?null:fo(t);t.remove(),t=n}}(t.nodes.start,t.nodes.end),n=!0),Po(t,e&&!n),ds(t,0),Ri(t,Vn);var i=t.nodes&&t.nodes.t;if(null!==i)for(const t of i)t.stop();Oo(t);var r=t.parent;null!==r&&null!==r.first&&Do(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=null}function Do(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 Lo(t,e,n=!0){var i=[];Bo(t,i,!0);var r=()=>{n&&Ro(t),e&&e()},o=i.length;if(o>0){var s=()=>--o||r();for(var a of i)a.out(s)}else r()}function Bo(t,e,n){if(!(t.f&qn)){t.f^=qn;var i=t.nodes&&t.nodes.t;if(null!==i)for(const t of i)(t.is_global||n)&&e.push(t);for(var r=t.first;null!==r;){var o=r.next;Bo(r,e,!!(!!(r.f&Gn)||!!(r.f&Ln)&&!!(t.f&Dn))&&n),r=o}}}function zo(t){Wo(t,!0)}function Wo(t,e){if(t.f&qn){t.f^=qn,t.f&$n||(Ri(t,Un),dr(t));for(var n=t.first;null!==n;){var i=n.next;Wo(n,!!(!!(n.f&Gn)||!!(n.f&Ln))&&e),n=i}var r=t.nodes&&t.nodes.t;if(null!==r)for(const t of r)(t.is_global||e)&&t.in()}}function $o(t,e){if(t.nodes)for(var n=t.nodes.start,i=t.nodes.end;null!==n;){var r=n===i?null:fo(n);e.append(n),n=r}}let Uo=!1;function jo(t){Uo=t}let qo=!1;function Vo(t){qo=t}let Ho=null,Go=!1;function Ko(t){Ho=t}let Xo=null;function Yo(t){Xo=t}let Qo=null;function Jo(t){null!==Ho&&(null===Qo?Qo=[t]:Qo.push(t))}let Zo=null,ts=0,es=null;let ns=1,is=0,rs=is;function os(t){rs=t}function ss(){return++ns}function as(t){var e=t.f;if(e&Un)return!0;if(e&Cn&&(t.f&=~Zn),e&jn){for(var n=t.deps,i=n.length,r=0;r<i;r++){var o=n[r];if(as(o)&&Hr(o),o.wv>t.wv)return!0}e&Wn&&null===$i&&Ri(t,$n)}return!1}function ls(t,e,n=!0){var i,r=t.reactions;if(null!==r&&(null===(i=Qo)||void 0===i||!i.includes(t)))for(var o=0;o<r.length;o++){var s=r[o];s.f&Cn?ls(s,e,!1):e===s&&(n?Ri(s,Un):s.f&$n&&Ri(s,jn),dr(s))}}function cs(t){var e=Zo,n=ts,i=es,r=Ho,o=Qo,s=wi,a=Go,l=rs,c=t.f;Zo=null,ts=0,es=null,Ho=c&(Ln|Bn)?null:t,Qo=null,_i(t.ctx),Go=!1,rs=++is,null!==t.ac&&(ko((()=>{t.ac.abort(si)})),t.ac=null);try{t.f|=ti;var u=(0,t.fn)(),d=t.deps;if(null!==Zo){var h;if(ds(t,ts),null!==d&&ts>0)for(d.length=ts+Zo.length,h=0;h<Zo.length;h++)d[ts+h]=Zo[h];else t.deps=d=Zo;if(_o()&&t.f&Wn)for(h=ts;h<d.length;h++){var f,p;(null!==(p=(f=d[h]).reactions)&&void 0!==p?p:f.reactions=[]).push(t)}}else null!==d&&ts<d.length&&(ds(t,ts),d.length=ts);if(!(null===es||Go||null===d||t.f&(Cn|jn|Un)))for(h=0;h<es.length;h++)ls(es[h],t);return null!==r&&r!==t&&(is++,null!==es&&(null===i?i=es:i.push(...es))),t.f&ni&&(t.f^=ni),u}catch(t){return Ci(t)}finally{t.f^=ti,Zo=e,ts=n,es=i,Ho=r,Qo=o,_i(s),Go=a,rs=l}}function us(t,e){let n=e.reactions;if(null!==n){var i=wn.call(n,t);if(-1!==i){var r=n.length-1;0===r?n=e.reactions=null:(n[i]=n[r],n.pop())}}if(null===n&&e.f&Cn&&(null===Zo||!Zo.includes(e))){var o=e;o.f&Wn&&(o.f^=Wn,o.f&=~Zn),Di(o),qr(o),ds(o,0)}}function ds(t,e){var n=t.deps;if(null!==n)for(var i=e;i<n.length;i++)us(t,n[i])}function hs(t){var e=t.f;if(!(e&Vn)){Ri(t,$n);var n=Xo,i=Uo;Xo=t,Uo=!0;try{e&(Dn|Rn)?function(t){for(var e=t.first;null!==e;){var n=e.next;e.f&Ln||Ro(e),e=n}}(t):Po(t),Oo(t);var r=cs(t);t.teardown="function"==typeof r?r:null,t.wv=ns,kn&&xi&&t.f&Un&&t.deps}finally{Uo=i,Xo=n}}}async function fs(){await Promise.resolve(),function(){var t=Vi;Vi=!0;try{for(;;){var e;if(Fi(),0===Ui.length&&(null===(e=Wi)||void 0===e||e.flush(),0===Ui.length))return void(ji=null);or()}}finally{Vi=t}}()}function ps(t){var e,n,i=!!(t.f&Cn);if(null!==Ho&&!Go&&!(null!==Xo&&!!(Xo.f&Vn)||null!==(n=Qo)&&void 0!==n&&n.includes(t))){var r=Ho.deps;if(Ho.f&ti)t.rv<is&&(t.rv=is,null===Zo&&null!==r&&r[ts]===t?ts++:null===Zo?Zo=[t]:Zo.includes(t)||Zo.push(t));else{var o,s;(null!==(s=(o=Ho).deps)&&void 0!==s?s:o.deps=[]).push(t);var a=t.reactions;null===a?t.reactions=[Ho]:a.includes(Ho)||a.push(Ho)}}if(qo&&Kr.has(t))return Kr.get(t);if(i){var l=t;if(qo){var c=l.v;return(l.f&$n||null===l.reactions)&&!vs(l)||(c=Vr(l)),Kr.set(l,c),c}var u=!(l.f&Wn)&&!Go&&null!==Ho&&(Uo||!!(Ho.f&Wn)),d=null===l.deps;as(l)&&(u&&(l.f|=Wn),Hr(l)),u&&!d&&ms(l)}if(null!==(e=$i)&&void 0!==e&&e.has(t))return $i.get(t);if(t.f&ni)throw t.v;return t.v}function ms(t){if(null!==t.deps){t.f|=Wn;for(const n of t.deps){var e;(null!==(e=n.reactions)&&void 0!==e?e:n.reactions=[]).push(t),n.f&Cn&&!(n.f&Wn)&&ms(n)}}}function vs(t){if(t.v===gn)return!0;if(null===t.deps)return!1;for(const e of t.deps){if(Kr.has(e))return!0;if(e.f&Cn&&vs(e))return!0}return!1}function gs(t){var e=Go;try{return Go=!0,t()}finally{Go=e}}const ys=new Set,bs=new Set;function ks(t,e,n,i={}){function r(t){if(i.capture||Ts.call(e,t),!t.cancelBubble)return ko((()=>null==n?void 0:n.call(this,t)))}return t.startsWith("pointer")||t.startsWith("touch")||"wheel"===t?Mi((()=>{e.addEventListener(t,r,i)})):e.addEventListener(t,r,i),r}function xs(t,e,n,i,r){var o={capture:i,passive:r},s=ks(t,e,n,o);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&To((()=>{e.removeEventListener(t,s,o)}))}function ws(t){for(var e=0;e<t.length;e++)ys.add(t[e]);for(var n of bs)n(t)}let _s=null;function Ts(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;_s=t;var a=0,l=_s===t&&t.__root;if(l){var c=o.indexOf(l);if(-1!==c&&(n===document||n===window))return void(t.__root=n);var u=o.indexOf(n);if(-1===u)return;c<=u&&(a=c)}if((s=o[a]||t.target)!==n){Tn(t,"currentTarget",{configurable:!0,get:()=>s||i});var d=Ho,h=Xo;Ko(null),Yo(null);try{for(var f,p=[];null!==s;){var m=s.assignedSlot||s.parentNode||s.host||null;try{var v=s["__"+r];null==v||s.disabled&&t.target!==s||v.call(s,t)}catch(t){f?p.push(t):f=t}if(t.cancelBubble||m===n||null===m)break;s=m}if(f){for(let t of p)queueMicrotask((()=>{throw t}));throw f}}finally{t.__root=n,delete t.currentTarget,Ko(d),Yo(h)}}}function Is(t,e){var n=Xo;null===n.nodes&&(n.nodes={start:t,end:e,a:null,t:null})}function Es(t,e){var n,i=!!(1&e),r=!!(2&e),o=!t.startsWith("<!>");return()=>{if(hi)return Is(di,null),di;var e,s;void 0===n&&(e=o?t:"<!>"+t,(s=document.createElement("template")).innerHTML=e.replaceAll("<!>","\x3c!----\x3e"),n=s.content,i||(n=ho(n)));var a=r||so?document.importNode(n,!0):n.cloneNode(!0);i?Is(ho(a),a.lastChild):Is(a,a);return a}}function Ss(){if(hi)return Is(di,null),di;var t=document.createDocumentFragment(),e=document.createComment(""),n=uo();return t.append(e,n),Is(e,n),t}function As(t,e){if(hi){var n=Xo;return n.f&Hn&&null!==n.nodes.end||(n.nodes.end=di),void mi()}null!==t&&t.before(e)}function Ns(t){return t.endsWith("capture")&&"gotpointercapture"!==t&&"lostpointercapture"!==t}const Ms=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function Fs(t){return Ms.includes(t)}const Cs={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject",novalidate:"noValidate",allowfullscreen:"allowFullscreen",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback"};function Os(t){var e;return t=t.toLowerCase(),null!==(e=Cs[t])&&void 0!==e?e:t}const Ps=["touchstart","touchmove"];function Rs(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 zs(t,e)}function Ls(t,e){var n;co(),e.intro=null!==(n=e.intro)&&void 0!==n&&n;const i=e.target,r=hi,o=di;try{for(var s=ho(i);s&&(s.nodeType!==li||s.data!==fn);)s=fo(s);if(!s)throw vn;fi(!0),pi(s);const n=zs(t,{...e,anchor:s});return fi(!1),n}catch(n){if(n instanceof Error&&n.message.split("\n").some((t=>t.startsWith("https://svelte.dev/e/"))))throw n;return n!==vn&&console.warn("Failed to hydrate: ",n),!1===e.recover&&function(){throw new Error("https://svelte.dev/e/hydration_failed")}(),co(),go(i),fi(!1),Ds(t,e)}finally{fi(r),pi(o)}}const Bs=new Map;function zs(t,{target:e,anchor:n,props:i={},events:r,context:o,intro:s=!0}){co();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,Ts,{passive:r});var o=Bs.get(i);void 0===o?(document.addEventListener(i,Ts,{passive:r}),Bs.set(i,1)):Bs.set(i,o+1)}}var s};l(_n(ys)),bs.add(l);var c=void 0,u=function(t){tr.ensure();const e=wo(Bn|Yn,t,!0);return(t={})=>new Promise((n=>{t.outro?Lo(e,(()=>{Ro(e),n(void 0)})):(Ro(e),n(void 0))}))}((()=>{var s=null!=n?n:e.appendChild(uo());return function(t,e,n){new Fr(t,e,n)}(s,{pending:()=>{}},(e=>{o&&(Ii({}),wi.c=o);if(r&&(i.$$events=r),hi&&Is(e,null),c=t(e,i)||{},hi&&(Xo.nodes.end=di,null===di||di.nodeType!==li||di.data!==mn))throw ui(),vn;o&&Ei()})),()=>{for(var t of a){e.removeEventListener(t,Ts);var i=Bs.get(t);0==--i?(document.removeEventListener(t,Ts),Bs.delete(t)):Bs.set(t,i)}var r;(bs.delete(l),s!==n)&&(null===(r=s.parentNode)||void 0===r||r.removeChild(s))}}));return Ws.set(c,u),c}let Ws=new WeakMap;class $s{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=Wi;if(this.#t.has(t)){var e=this.#t.get(t),n=this.#e.get(e);if(n)zo(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&&(Ro(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();$o(i,e),e.append(uo()),this.#n.set(t,{effect:i,fragment:e})}else Ro(i);this.#i.delete(t),this.#e.delete(t)};this.#r||!n?(this.#i.add(t),Lo(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)||(Ro(n.effect),this.#n.delete(t))};ensure(t,e){var n=Wi;!e||this.#e.has(t)||this.#n.has(t)||this.#e.set(t,Co((()=>e(this.anchor)))),this.#t.set(n,t),hi&&(this.anchor=di),this.#o()}}function Us(t,e,n=!1){hi&&mi();var i=new $s(t);function r(e,n){if(hi){if(e===(yi(t)===pn)){var r=gi();return pi(r),i.anchor=r,fi(!1),i.ensure(e,n),void fi(!0)}}i.ensure(e,n)}Mo((()=>{var t=!1;e(((e,n=!0)=>{t=!0,r(n,e)})),t||r(!1,null)}),n?Gn:0)}function js(t,e){return e}function qs(t,e=!0){for(var n=0;n<t.length;n++)Ro(t[n],e)}var Vs;function Hs(t,e,n,i,r,o=null){var s=t,a=new Map;if(!!(e&sn)){var l=t;s=hi?pi(ho(l)):l.appendChild(uo())}hi&&mi();var c,u=null,d=jr((()=>{var t=n();return xn(t)?t:null==t?[]:_n(t)})),h=!0;function f(){m.fallback=u,function(t,e,n,i,r){var o,s,a,l,c,u=!!(i&an),d=e.length,h=t.items,f=t.effect.first,p=null,m=[],v=[];if(u)for(c=0;c<d;c+=1){var g,y;if(a=r(e[c],c),!((l=h.get(a).e).f&Jn))null===(g=l.nodes)||void 0===g||null===(g=g.a)||void 0===g||g.measure(),(null!==(y=s)&&void 0!==y?y:s=new Set).add(l)}for(c=0;c<d;c+=1){if(a=r(e[c],c),l=h.get(a).e,null!==t.outrogroups)for(const e of t.outrogroups)e.pending.delete(l),e.done.delete(l);if(l.f&Jn){if(l.f^=Jn,l!==f){var b=p?p.next:f;l===t.effect.last&&(t.effect.last=l.prev),l.prev&&(l.prev.next=l.next),l.next&&(l.next.prev=l.prev),Xs(t,p,l),Xs(t,l,b),Ks(l,b,n),m=[],v=[],f=(p=l).next;continue}Ks(l,null,n)}var k,x;if(l.f&qn)if(zo(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<v.length){var w,_=v[0];p=_.prev;var T=m[0],I=m[m.length-1];for(w=0;w<m.length;w+=1)Ks(m[w],_,n);for(w=0;w<v.length;w+=1)o.delete(v[w]);Xs(t,T.prev,I.next),Xs(t,p,T),Xs(t,I,_),f=_,p=I,c-=1,m=[],v=[]}else o.delete(l),Ks(l,f,n),Xs(t,l.prev,l.next),Xs(t,l,null===p?t.effect.first:p.next),Xs(t,p,l),p=l;continue}for(m=[],v=[];null!==f&&f!==l;){var E;(null!==(E=o)&&void 0!==E?E:o=new Set).add(f),v.push(f),f=f.next}if(null===f)continue}l.f&Jn||m.push(l),p=l,f=l.next}if(null!==t.outrogroups){for(const e of t.outrogroups){var S;if(0===e.pending.size)qs(_n(e.done)),null===(S=t.outrogroups)||void 0===S||S.delete(e)}0===t.outrogroups.size&&(t.outrogroups=null)}if(null!==f||void 0!==o){var A=[];if(void 0!==o)for(l of o)l.f&qn||A.push(l);for(;null!==f;)f.f&qn||f===t.fallback||A.push(f),f=f.next;var N=A.length;if(N>0){var M=i&sn&&0===d?n:null;if(u){for(c=0;c<N;c+=1){var F;null===(F=A[c].nodes)||void 0===F||null===(F=F.a)||void 0===F||F.measure()}for(c=0;c<N;c+=1){var C;null===(C=A[c].nodes)||void 0===C||null===(C=C.a)||void 0===C||C.fix()}}!function(t,e,n){for(var i,r=e.length,o=e.length,s=0;s<r;s++){let n=e[s];Lo(n,(()=>{if(i){if(i.pending.delete(n),i.done.add(n),0===i.pending.size){var e=t.outrogroups;qs(_n(i.done)),e.delete(i),0===e.size&&(t.outrogroups=null)}}else o-=1}),!1)}if(0===o){var a=null!==n;if(a){var l=n,c=l.parentNode;go(c),c.append(l),t.items.clear()}qs(e,!a)}else{var u;i={pending:new Set(e),done:new Set},(null!==(u=t.outrogroups)&&void 0!==u?u:t.outrogroups=new Set).add(i)}}(t,A,M)}}u&&Mi((()=>{if(void 0!==s)for(l of s){var t;null===(t=l.nodes)||void 0===t||null===(t=t.a)||void 0===t||t.apply()}}))}(m,c,s,e,i),null!==u&&(0===c.length?u.f&Jn?(u.f^=Jn,Ks(u,null,s)):zo(u):Lo(u,(()=>{u=null})))}var p=Mo((()=>{var t=(c=ps(d)).length;let l=!1;hi&&(yi(s)===pn!==(0===t)&&(pi(s=gi()),fi(!1),l=!0));for(var p=new Set,m=0;m<t;m+=1){hi&&di.nodeType===li&&di.data===mn&&(s=di,l=!0,fi(!1));var v,g=c[m],y=i(g,m),b=h?null:a.get(y);if(b)b.v&&to(b.v,g),b.i&&to(b.i,m);else b=Gs(a,h?s:null!==(v=Vs)&&void 0!==v?v:Vs=uo(),g,y,m,r,e,n),h||(b.e.f|=Jn),a.set(y,b);p.add(y)}0===t&&o&&!u&&(h?u=Co((()=>o(s))):(u=Co((()=>{var t;return o(null!==(t=Vs)&&void 0!==t?t:Vs=uo())}))).f|=Jn),hi&&t>0&&pi(gi()),h||f(),l&&fi(!0),ps(d)})),m={effect:p,items:a,outrogroups:null,fallback:u};h=!1,hi&&(s=di)}function Gs(t,e,n,i,r,o,s,a){var l=s&rn?s&ln?Yr(n):Jr(n,!1,!1):null,c=s&on?Yr(r):null;return{v:l,i:c,e:Co((()=>(o(e,null!=l?l:n,null!=c?c:r,a),()=>{t.delete(i)})))}}function Ks(t,e,n){if(t.nodes)for(var i=t.nodes.start,r=t.nodes.end,o=!e||e.f&Jn?n:e.nodes.start;null!==i;){var s=fo(i);if(o.before(i),i===r)return;i=s}}function Xs(t,e,n){null===e?t.effect.first=n:e.next=n,null===n?t.effect.last=e:n.prev=e}function Ys(t,e){So((()=>{var n,i=t.getRootNode(),r=i.host?i:null!==(n=i.head)&&void 0!==n?n:i.ownerDocument.head;if(!r.querySelector("#"+e.hash)){const t=document.createElement("style");t.id=e.hash,t.textContent=e.code,r.appendChild(t)}}))}function Qs(t,e){var n,i=void 0;Fo((()=>{i!==(i=e())&&(n&&(Ro(n),n=null),i&&(n=Co((()=>{So((()=>i(t)))}))))}))}function Js(t){var e,n,i="";if("string"==typeof t||"number"==typeof t)i+=t;else if("object"==typeof t)if(Array.isArray(t)){var r=t.length;for(e=0;e<r;e++)t[e]&&(n=Js(t[e]))&&(i&&(i+=" "),i+=n)}else for(n in t)t[n]&&(i&&(i+=" "),i+=n);return i}function Zs(t){return"object"==typeof t?function(){for(var t,e,n=0,i="",r=arguments.length;n<r;n++)(t=arguments[n])&&(e=Js(t))&&(i&&(i+=" "),i+=e);return i}(t):null!=t?t:""}const ta=[..." \t\n\r\f \v\ufeff"];function ea(t,e=!1){var n=e?" !important;":";",i="";for(var r in t){var o=t[r];null!=o&&""!==o&&(i+=" "+r+": "+o+n)}return i}function na(t){return"-"!==t[0]||"-"!==t[1]?t.toLowerCase():t}function ia(t,e,n,i,r,o){var s=t.__className;if(hi||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&&!ta.includes(i[s-1])||a!==i.length&&!ta.includes(i[a])?s=a:i=(0===s?"":i.substring(0,s))+i.substring(a+1)}return""===i?null:i}(n,i,o);hi&&a===t.getAttribute("class")||(null==a?t.removeAttribute("class"):e?t.className=a:t.setAttribute("class",a)),t.__className=n}else if(o&&r!==o)for(var l in o){var c=!!o[l];null!=r&&c===!!r[l]||t.classList.toggle(l,c)}return o}function ra(t,e={},n,i){for(var r in n){var o=n[r];e[r]!==o&&(null==n[r]?t.style.removeProperty(r):t.style.setProperty(r,o,i))}}function oa(t,e,n,i){var r=t.__style;if(hi||r!==e){var o=function(t,e){if(e){var n,i,r="";if(Array.isArray(e)?(n=e[0],i=e[1]):n=e,t){t=String(t).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var o=!1,s=0,a=!1,l=[];n&&l.push(...Object.keys(n).map(na)),i&&l.push(...Object.keys(i).map(na));var c=0,u=-1;const e=t.length;for(var d=0;d<e;d++){var h=t[d];if(a?"/"===h&&"*"===t[d-1]&&(a=!1):o?o===h&&(o=!1):"/"===h&&"*"===t[d+1]?a=!0:'"'===h||"'"===h?o=h:"("===h?s++:")"===h&&s--,!a&&!1===o&&0===s)if(":"===h&&-1===u)u=d;else if(";"===h||d===e-1){if(-1!==u){var f=na(t.substring(c,u).trim());l.includes(f)||(";"!==h&&d++,r+=" "+t.substring(c,d).trim()+";")}c=d+1,u=-1}}}return n&&(r+=ea(n)),i&&(r+=ea(i,!0)),""===(r=r.trim())?null:r}return null==t?null:String(t)}(e,i);hi&&o===t.getAttribute("style")||(null==o?t.removeAttribute("style"):t.style.cssText=o),t.__style=e}else i&&(Array.isArray(i)?(ra(t,null==n?void 0:n[0],i[0]),ra(t,null==n?void 0:n[1],i[1],"important")):ra(t,n,i));return i}function sa(t,e,n=!1){if(t.multiple){if(null==e)return;if(!xn(e))return void console.warn("https://svelte.dev/e/select_multiple_invalid_value");for(var i of t.options)i.selected=e.includes(aa(i))}else{for(i of t.options){var r=aa(i);if(o=r,s=e,Object.is(ro(o),ro(s)))return void(i.selected=!0)}var o,s;n&&void 0===e||(t.selectedIndex=-1)}}function aa(t){return"__value"in t?t.__value:t.value}const la=Symbol("class"),ca=Symbol("style"),ua=Symbol("is custom element"),da=Symbol("is html");function ha(t){if(hi){var e=!1,n=()=>{if(!e){if(e=!0,t.hasAttribute("value")){var n=t.value;pa(t,"value",null),t.value=n}if(t.hasAttribute("checked")){var i=t.checked;pa(t,"checked",null),t.checked=i}}};t.__on_r=n,Mi(n),bo||(bo=!0,document.addEventListener("reset",(t=>{Promise.resolve().then((()=>{if(!t.defaultPrevented)for(const n of t.target.elements){var e;null===(e=n.__on_r)||void 0===e||e.call(n)}}))}),{capture:!0}))}}function fa(t,e){e?t.hasAttribute("selected")||t.setAttribute("selected",""):t.removeAttribute("selected")}function pa(t,e,n,i){var r=va(t);hi&&(r[e]=t.getAttribute(e),"src"===e||"srcset"===e||"href"===e&&"LINK"===t.nodeName)||r[e]!==(r[e]=n)&&("loading"===e&&(t[oi]=n),null==n?t.removeAttribute(e):"string"!=typeof n&&ya(t).includes(e)?t[e]=n:t.setAttribute(e,n))}function ma(t,e,n=[],i=[],r=[],o,s=!1,a=!1){Br(r,n,i,(n=>{var i=void 0,r={},l="SELECT"===t.nodeName,c=!1;if(Fo((()=>{var u=e(...n.map(ps)),d=function(t,e,n,i,r=!1){if(hi&&r&&"INPUT"===t.tagName){var o=t;("checkbox"===o.type?"defaultChecked":"defaultValue")in n||ha(o)}var s=va(t),a=s[ua],l=!s[da];let c=hi&&a;c&&fi(!1);var u,d=e||{},h="OPTION"===t.tagName;for(var f in e)f in n||(n[f]=null);n.class?n.class=Zs(n.class):n.class=null,n[ca]&&(null!==(u=n.style)&&void 0!==u||(n.style=null));var p=ya(t);for(const r in n){let o=n[r];if(h&&"value"===r&&null==o)t.value=t.__value="",d[r]=o;else if("class"!==r)if("style"!==r){var m=d[r];if(o!==m||void 0===o&&t.hasAttribute(r)){d[r]=o;var v=r[0]+r[1];if("$$"!==v)if("on"===v){const e={},n="$$"+r;let i=r.slice(2);var g=Fs(i);if(Ns(i)&&(i=i.slice(0,-7),e.capture=!0),!g&&m){if(null!=o)continue;t.removeEventListener(i,d[n],e),d[n]=null}if(null!=o)if(g)t[`__${i}`]=o,ws([i]);else{let o=function(t){d[r].call(this,t)};d[n]=ks(i,t,o,e)}else g&&(t[`__${i}`]=void 0)}else if("style"===r)pa(t,r,o);else if("autofocus"===r)yo(t,Boolean(o));else if(a||"__value"!==r&&("value"!==r||null==o))if("selected"===r&&h)fa(t,o);else{var y=r;l||(y=Os(y));var b="defaultValue"===y||"defaultChecked"===y;if(null!=o||a||b)b||p.includes(y)&&(a||"string"!=typeof o)?(t[y]=o,y in s&&(s[y]=gn)):"function"!=typeof o&&pa(t,y,o);else if(s[r]=null,"value"===y||"checked"===y){let n=t;const i=void 0===e;if("value"===y){let t=n.defaultValue;n.removeAttribute(y),n.defaultValue=t,n.value=n.__value=i?t:null}else{let t=n.defaultChecked;n.removeAttribute(y),n.defaultChecked=t,n.checked=!!i&&t}}else t.removeAttribute(r)}else t.value=t.__value=o}}else oa(t,o,null==e?void 0:e[ca],n[ca]),d[r]=o,d[ca]=n[ca];else ia(t,"http://www.w3.org/1999/xhtml"===t.namespaceURI,o,i,null==e?void 0:e[la],n[la]),d[r]=o,d[la]=n[la]}return c&&fi(!0),d}(t,i,u,o,s,a);c&&l&&"value"in u&&sa(t,u.value);for(let t of Object.getOwnPropertySymbols(r))u[t]||Ro(r[t]);for(let e of Object.getOwnPropertySymbols(u)){var h=u[e];e.description!==bn||i&&h===i[e]||(r[e]&&Ro(r[e]),r[e]=Co((()=>Qs(t,(()=>h))))),d[e]=h}i=d})),l){var u=t;So((()=>{sa(u,i.value,!0),function(t){var e=new MutationObserver((()=>{sa(t,t.__value)}));e.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),To((()=>{e.disconnect()}))}(u)}))}c=!0}))}function va(t){var e;return null!==(e=t.__attributes)&&void 0!==e?e:t.__attributes={[ua]:t.nodeName.includes("-"),[da]:t.namespaceURI===yn}}var ga=new Map;function ya(t){var e,n=t.getAttribute("is")||t.nodeName,i=ga.get(n);if(i)return i;ga.set(n,i=[]);for(var r=t,o=Element.prototype;o!==r;){for(var s in e=En(r))e[s].set&&i.push(s);r=Nn(r)}return i}function ba(t,e){return t===e||(null==t?void 0:t[ii])===e}function ka(t={},e,n,i){return So((()=>{var i,r;return Ao((()=>{i=r,r=[],gs((()=>{t!==n(...r)&&(e(t,...r),i&&ba(n(...i),t)&&e(null,...i))}))})),()=>{Mi((()=>{r&&ba(n(...r),t)&&e(null,...r)}))}})),t}let xa=!1;function wa(t,e,n,i){var r,o,s=!!(n&dn),a=!!(n&hn),l=i,c=!0,u=()=>(c&&(c=!1,l=a?gs(i):i),l);if(s){var d,h,f=ii in t||ri in t;r=null!==(d=null===(h=In(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=xa;try{return xa=!1,[t(),xa]}finally{xa=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&un))return p;if(r){var v=t.$$legacy;return function(t,e){return arguments.length>0?((!e||v||m)&&r(e?p():t),t):p()}}var g=!1,y=(n&cn?Wr:jr)((()=>(g=!1,p())));s&&ps(y);var b=Xo;return function(t,e){if(arguments.length>0){const n=e?ps(y):s?io(t):t;return Zr(y,n),g=!0,void 0!==l&&(l=n),t}return qo&&g||b.f&Vn?y.v:ps(y)}}var _a,Ta,Ia,Ea;"undefined"!=typeof window&&(null!==(Ta=(_a=null!==(Ea=(Ia=window).__svelte)&&void 0!==Ea?Ea:Ia.__svelte={}).v)&&void 0!==Ta?Ta:_a.v=new Set).add("5");function Sa(t,{include:e,exclude:n}={}){const i=t=>{const i=e=>"string"==typeof e?t===e:e.test(t);return e?e.some(i):!n||!n.some(i)};for(const[e,n]of(t=>{const e=new Set;do{for(const n of Reflect.ownKeys(t))e.add([t,n])}while((t=Reflect.getPrototypeOf(t))&&t!==Object.prototype);return e})(t.constructor.prototype)){if("constructor"===n||!i(n))continue;const r=Reflect.getOwnPropertyDescriptor(e,n);r&&"function"==typeof r.value&&(t[n]=t[n].bind(t))}return t}function Aa(t,e){t.getNodesAtTime(0)[0].once("nodestart",e)}class Na{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}`,Sa(this)}#a=Qr(io({}));#l=Qr(null);#c=Qr(!1);#u=Qr(null);id;player;position;config;timeline;moduleEndListener;hasDuration=!1;coverAssets=[];get state(){return ps(this.#a)}set state(t){Zr(this.#a,t,!0)}get cover(){return ps(this.#l)}set cover(t){Zr(this.#l,t)}get showCover(){return ps(this.#c)}set showCover(t){Zr(this.#c,t,!0)}get Component(){return ps(this.#u)}set Component(t){Zr(this.#u,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(){Aa(this.timeline,(()=>{this.setPosition()})),this.player.switchTimeline(this.timeline)}get duration(){return this.hasDuration?this.timeline.placements.reduce(((t,e)=>t+this.player.getNode(e.nodeId).duration),0):0}}function Ma(t,e,n){var i,r,o;const s=(null==e||null===(i=e.entity)||void 0===i?void 0:i.entityId)||(null==e?void 0:e.assetId),a=null!==(r=null==e||null===(o=e.entity)||void 0===o?void 0:o.entityRevision)&&void 0!==r?r:null==e?void 0:e.assetRevision;return n.addNode({id:t,manifestRef:{type:"assets-delivery-service",assetId:s,assetRevision:a,availableEncodeProfiles:e.availableEncodeProfiles}})}var Fa=Es('<h3 class="text-box-title svelte-17x2i38"> </h3>'),Ca=Es('<span class="text-box-title svelte-17x2i38"> </span>'),Oa=Es('<span class="text-box-description minimized-description svelte-17x2i38"> </span>'),Pa=Es('<span class="read-more-cta svelte-17x2i38" aria-hidden="true">Read more</span>'),Ra=Es('<button class="expand-description-button svelte-17x2i38" aria-expanded="false" aria-controls="expanded-text-content" aria-label="Expand feature description"><!> <!></button>'),Da=Es('<button aria-expanded="true" aria-label="Collapse feature description" class="svelte-17x2i38">Read less</button>'),La=Es('<section aria-label="Feature description" aria-live="polite"><div class="text-wrapper svelte-17x2i38"><div class="expanded-text-content svelte-17x2i38"><!> <p class="text-box-description svelte-17x2i38"> </p></div> <!></div> <!></section>');const Ba={hash:"svelte-17x2i38",code:".step-description-container.svelte-17x2i38 {width:100%;position:absolute;bottom:0;display:flex;justify-content:space-between;gap:8px;box-sizing:border-box;font-size:12px;font-weight:400;font-style:normal;line-height:16px;letter-spacing:0px;overflow:hidden;pointer-events:none;background:linear-gradient(\n rgba(255, 255, 255, 0) 0%,\n rgba(255, 255, 255, 0.9) 27.79%,\n rgba(255, 255, 255, 0.95) 100%\n );&.expanded {flex-direction:column;justify-content:flex-start;}&:not(.expanded) {button:where(.svelte-17x2i38) {line-height:16px;}}}.expanded-text-content.svelte-17x2i38:not([hidden]) {display:flex;flex-direction:column;gap:8px;}button.svelte-17x2i38 {background:none;border:none;padding:0;cursor:pointer;line-height:18px;gap:8px;letter-spacing:0%;color:#014FD3;font-size:12px;font-weight:500;flex-shrink:0;text-align:left;font-family:inherit;pointer-events:auto;}h3.svelte-17x2i38, p.svelte-17x2i38, span.svelte-17x2i38 {color:#030303;}.text-wrapper.svelte-17x2i38 {width:100%;}.text-box-title.svelte-17x2i38 {margin:0;font-weight:500;font-size:12px;}.text-box-description.svelte-17x2i38 {margin:0;text-align:left;font-weight:400;}.minimized-description.svelte-17x2i38 {overflow:hidden;line-clamp:1;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;font-weight:400;}.expand-description-button.svelte-17x2i38 {width:100%;display:flex;justify-content:space-between;gap:6px;flex-wrap:nowrap;.read-more-cta:where(.svelte-17x2i38) {color:#014FD3;flex-shrink:0;}}"};function za(t,e){const n=Ur((()=>e.state.textBox));!function(t,e){Ii(e,!0),Ys(t,Ba);let n=wa(e,"textBox",3,null),i=wa(e,"isMobile",3,!1),r=Qr(!1),o=Qr(null),s=Qr(!1),a=Ur((()=>{var t;return(null===(t=n())||void 0===t?void 0:t.title)||""})),l=Ur((()=>{var t;return(null===(t=n())||void 0===t?void 0:t.description)||""})),c=Ur((()=>i()?16:18)),u=Ur((()=>i()?12:16));function d(){ps(o)&&Zr(s,ps(o).scrollWidth>ps(o).clientWidth||ps(o).scrollHeight>ps(o).clientHeight,!0)}Io((()=>{ps(o)&&d()}));var h=Ss();xs("resize",oo,d);var f=mo(h),p=t=>{var e=La(),n=po(e),d=po(n),h=po(d),f=t=>{var e=Fa(),n=po(e,!0);vi(e),No((()=>Rs(n,ps(a)))),As(t,e)};Us(h,(t=>{i()&&t(f)}));var p=vo(h,2),m=po(p,!0);vi(p),vi(d);var v=vo(d,2),g=t=>{var e=Ra();e.__click=()=>Zr(r,!0);var n=po(e),u=t=>{var e=Ca(),n=po(e,!0);vi(e),No((()=>Rs(n,ps(a)))),As(t,e)},d=t=>{var e=Oa(),n=po(e,!0);vi(e),ka(e,(t=>Zr(o,t)),(()=>ps(o))),No((()=>Rs(n,ps(l)))),As(t,e)};Us(n,(t=>{i()&&ps(a)?t(u):t(d,!1)}));var h=vo(n,2),f=t=>{As(t,Pa())};Us(h,(t=>{(i()||!i()&&ps(s))&&t(f)})),vi(e),No((()=>oa(e,`line-height: ${ps(c)}px;`))),As(t,e)};Us(v,(t=>{ps(r)||t(g)})),vi(n);var y=vo(n,2),b=t=>{var e=Da();e.__click=()=>Zr(r,!1),No((()=>oa(e,`margin-bottom: ${!i()&&ps(r)?"8px":"0px"};\n line-height: ${ps(u)}px;`))),As(t,e)};Us(y,(t=>{ps(r)&&t(b)})),vi(e),No((()=>{ia(e,1,"step-description-container "+(ps(r)?"expanded":""),"svelte-17x2i38"),oa(e,`padding: ${i()?"8px 16px":"16px 16px 56px 16px"};`),oa(d,`line-height: ${ps(c)}px;`),pa(d,"hidden",!ps(r)),Rs(m,ps(l))})),As(t,e)};Us(f,(t=>{(ps(a)||ps(l))&&t(p)})),As(t,h),Ei()}(t,{get textBox(){return ps(n)},get isMobile(){return e.isMobile}})}ws(["click"]);var Wa=Es('<div class="toggle-option-container svelte-16pmvvn"><button> </button></div>'),$a=Es('<div class="toggle-container svelte-16pmvvn"><div></div></div>');const Ua={hash:"svelte-16pmvvn",code:".eko-gallery-app {--toggleModule_gap: 8px;--toggleModule_padding: 10px 58px 0 0;--toggleModule_options_padding: 0;--toggleModule_options_height: auto;--toggleModule_options_width: 100%;--toggleModule_options_gap: 8px;--toggleModule_button_backgroundColor: #FFFFFF;--toggleModule_button_padding: 8px 12px;--toggleModule_button_boxShadow: 0px 2px 8px 2px rgba(0, 0, 0, 0.07);--toggleModule_button_text_fontFamily: var(--fontName);--toggleModule_button_text_fontSize: 12px;--toggleModule_button_text_fontWeight: 400;--toggleModule_button_text_fontStyle: normal;--toggleModule_button_text_lineHeight: 16px;--toggleModule_button_text_letterSpacing: -0.2px;--toggleModule_button_text_color: #000;--toggleModule_button_border_radius: 100px;--toggleModule_title_fontFamily: var(--fontName);--toggleModule_title_fontSize: 13px;--toggleModule_title_fontWeight: 400;--toggleModule_title_fontStyle: normal;--toggleModule_title_lineHeight: 120%;--toggleModule_title_letterSpacing: 0;--toggleModule_title_color: #666;--toggleModule_title_textAlignment: center;--toggleModule_note_fontFamily: var(--fontName);--toggleModule_note_fontSize: 12px;--toggleModule_note_fontWeight: 400;--toggleModule_note_fontStyle: normal;--toggleModule_note_lineHeight: 120%;--toggleModule_note_letterSpacing: 0;--toggleModule_note_color: #888;--toggleModule_note_topMargin: 4px;}.toggle-container.svelte-16pmvvn {position:absolute;top:0;padding:var(--toggleModule_padding);width:100%;display:flex;flex-direction:column;align-items:center;gap:var(--toggleModule_gap);pointer-events:auto;box-sizing:border-box;}.toggle-options.svelte-16pmvvn {width:var(--toggleModule_options_width);height:var(--toggleModule_options_height);padding:var(--toggleModule_options_padding);gap:var(--toggleModule_options_gap);display:flex;justify-content:end;margin:0;}.toggle-option-container.svelte-16pmvvn {position:relative;min-width:0;}.toggle-option-button.svelte-16pmvvn {border-radius:var(--toggleModule_button_borderRadius);font-family:var(--toggleModule_button_text_fontFamily);font-size:var(--toggleModule_button_text_fontSize);font-weight:var(--toggleModule_button_text_fontWeight);font-style:var(--toggleModule_button_text_fontStyle);line-height:var(--toggleModule_button_text_lineHeight);letter-spacing:var(--toggleModule_button_text_letterSpacing);color:var(--toggleModule_button_text_color);padding:var(--toggleModule_button_padding);border:#E4E5E8 solid 1px;background:#FBFBFB;display:flex;width:100%;height:100%;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;cursor:pointer;position:relative;transition:all 0.3s ease-in-out;animation-duration:0.5s;animation-timing-function:cubic-bezier(0.36, 0, 0, 1);animation-fill-mode:both;animation-delay:calc(var(--button-index) * 90ms);\n animation-name: svelte-16pmvvn-button-back-appear-anim;transform-origin:bottom center;border-radius:var(--toggleModule_button_border_radius);}.toggle-option-button.selected.svelte-16pmvvn {box-shadow:none;color:#FFFFFF;background:#014FD3;border-color:#014FD3;}.toggle-option-button.svelte-16pmvvn:hover:not(.selected) {background:#F3F4F6;}.toggle-option-button.svelte-16pmvvn:active:not(.selected) {background:#E4E5E8;}.toggle-option-button.svelte-16pmvvn:focus {outline-offset:4px;outline-width:2px;}\n\n@keyframes svelte-16pmvvn-button-back-appear-anim {\n from {\n transform: scale(0);\n }\n to {\n transform: scale(1);\n }\n}\n@keyframes svelte-16pmvvn-optionNoteIn {\n 0% {\n opacity: 0;\n translate: -50% -5px;\n }\n 100% {\n opacity: 1;\n translate: -50% var(--toggleModule_note_topMargin);\n }\n}"};function ja(t,e){Ys(t,Ua);const n=Ur((()=>e.state.options)),i=Ur((()=>e.state.currentOptionIndex)),r=Ur((()=>e.state.onOptionClicked));var o=$a(),s=po(o);Hs(s,21,(()=>ps(n)),js,((t,e,n)=>{var o=Wa();oa(o,`--button-index: ${n};`);var s=po(o);let a;s.__click=()=>ps(r)(n);var l=po(s,!0);vi(s),vi(o),No((()=>{a=ia(s,1,"toggle-option-button svelte-16pmvvn",null,a,{selected:ps(i)===n}),Rs(l,ps(e).label)})),As(t,o)})),vi(s),vi(o),No((()=>{var t;return ia(s,1,`toggle-options selected-${null!==(t=ps(i))&&void 0!==t?t:""}`,"svelte-16pmvvn")})),As(t,o)}ws(["click"]);var qa=new WeakSet;function Va(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],this.showCover=!0,Aa(this.timeline,(()=>{this.showCover=!1})),null===(n=this.player)||void 0===n||n.switchTimeline(this.timeline)))}const Ha=(t,e,n)=>n>e?e:n<t?t:n;function Ga(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}let Ka=()=>{},Xa=()=>{};function Ya(t){let e;return()=>(void 0===e&&(e=t()),e)}"undefined"!=typeof process&&"production"!==(null===(re=process.env)||void 0===re?void 0:re.NODE_ENV)&&(Ka=(t,e,n)=>{t||"undefined"==typeof console||console.warn(Ga(e,n))},Xa=(t,e,n)=>{if(!t)throw new Error(Ga(e,n))});const Qa=t=>t,Ja=t=>1e3*t,Za=t=>t/1e3;const tl=t=>Array.isArray(t)&&"number"==typeof t[0],el=(t,e,n=10)=>{let i="";const r=Math.max(Math.round(e/n),2);for(let e=0;e<r;e++)i+=Math.round(1e4*t(e/(r-1)))/1e4+", ";return`linear(${i.substring(0,i.length-2)})`},nl=2e4;function il(t){let e=0;let n=t.next(e);for(;!n.done&&e<nl;)e+=50,n=t.next(e);return e>=nl?1/0:e}const rl=5;const ol={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},sl=.001;function al({duration:t=ol.duration,bounce:e=ol.bounce,velocity:n=ol.velocity,mass:i=ol.mass}){let r,o;Ka(t<=Ja(ol.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let s=1-e;s=Ha(ol.minDamping,ol.maxDamping,s),t=Ha(ol.minDuration,ol.maxDuration,Za(t)),s<1?(r=e=>{const i=e*s,r=i*t,o=i-n,a=cl(e,s),l=Math.exp(-r);return sl-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=cl(Math.pow(e,2),s);return(-r(e)+sl>0?-1:1)*((o-a)*l)/c}):(r=e=>Math.exp(-e*t)*((e-n)*t+1)-sl,o=e=>Math.exp(-e*t)*(t*t*(n-e)));const a=function(t,e,n){let i=n;for(let n=1;n<ll;n++)i-=t(i)/e(i);return i}(r,o,5/t);if(t=Ja(t),isNaN(a))return{stiffness:ol.stiffness,damping:ol.damping,duration:t};{const e=Math.pow(a,2)*i;return{stiffness:e,damping:2*s*Math.sqrt(i*e),duration:t}}}const ll=12;function cl(t,e){return t*Math.sqrt(1-e*e)}const ul=["duration","bounce"],dl=["stiffness","damping","mass"];function hl(t,e){return e.some((e=>void 0!==t[e]))}function fl(t=ol.visualDuration,e=ol.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:ol.velocity,stiffness:ol.stiffness,damping:ol.damping,mass:ol.mass,isResolvedFromDuration:!1,...t};if(!hl(t,dl)&&hl(t,ul))if(t.visualDuration){const n=t.visualDuration,i=2*Math.PI/(1.2*n),r=i*i,o=2*Ha(.05,1,1-(t.bounce||0))*Math.sqrt(r);e={...e,mass:ol.mass,stiffness:r,damping:o}}else{const n=al(t);e={...e,...n,mass:ol.mass},e.isResolvedFromDuration=!0}return e}({...n,velocity:-Za(n.velocity||0)}),p=h||0,m=c/(2*Math.sqrt(l*u)),v=s-o,g=Za(Math.sqrt(l/u)),y=Math.abs(v)<5;let b;if(i||(i=y?ol.restSpeed.granular:ol.restSpeed.default),r||(r=y?ol.restDelta.granular:ol.restDelta.default),m<1){const t=cl(g,m);b=e=>{const n=Math.exp(-m*g*e);return s-n*((p+m*g*v)/t*Math.sin(t*e)+v*Math.cos(t*e))}}else if(1===m)b=t=>s-Math.exp(-g*t)*(v+(p+g*v)*t);else{const t=g*Math.sqrt(m*m-1);b=e=>{const n=Math.exp(-m*g*e),i=Math.min(t*e,300);return s-n*((p+m*g*v)*Math.sinh(i)+t*v*Math.cosh(i))/t}}const k={calculatedDuration:f&&d||null,next:t=>{const e=b(t);if(f)a.done=t>=d;else{let n=0===t?p:0;m<1&&(n=0===t?Ja(p):function(t,e,n){const i=Math.max(e-rl,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(il(k),nl),e=el((e=>k.next(t*e).value),t,30);return t+"ms "+e},toTransition:()=>{}};return k}fl.applyToOptions=t=>{const e=function(t,e=100,n){const i=n({...t,keyframes:[0,e]}),r=Math.min(il(i),nl);return{type:"keyframes",ease:t=>i.next(r*t).value/e,duration:Za(r)}}(t,100,fl);return t.ease=e.ease,t.duration=Ja(e.duration),t.type="keyframes",t};const pl=t=>null!==t;class ml{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 vl(t){for(let n=1;n<t.length;n++){var e;null!==(e=t[n])&&void 0!==e||(t[n]=t[n-1])}}const gl=t=>t.startsWith("--");const yl=Ya((()=>void 0!==window.ScrollTimeline)),bl={};function kl(t,e){const n=Ya(t);return()=>{var t;return null!==(t=bl[e])&&void 0!==t?t:n()}}const xl=kl((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing"),wl=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,_l={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:wl([0,.65,.55,1]),circOut:wl([.55,0,1,.45]),backIn:wl([.31,.01,.66,-.59]),backOut:wl([.33,1.53,.69,.99])};function Tl(t,e){return t?"function"==typeof t?xl()?el(t,e):"ease-out":tl(t)?wl(t):Array.isArray(t)?t.map((t=>Tl(t,e)||_l.easeOut)):_l[t]:void 0}function Il(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=Tl(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 El extends ml{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,Xa("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)&&xl()?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=Il(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(pl),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){gl(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 Za(Number(n))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Za(t)}get time(){return Za(Number(this.animation.currentTime)||0)}set time(t){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Ja(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&&yl()?(this.animation.timeline=t,Qa):e(this)}}class Sl{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 Al(this.animations,"duration")}get iterationDuration(){return Al(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 Al(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 Nl extends Sl{then(t,e){return this.finished.finally(t).then((()=>{}))}}const Ml=new WeakMap,Fl=(t,e="")=>`${t}:${e}`;function Cl(t){const e=Ml.get(t)||new Map;return Ml.set(t,e),e}function Ol(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 Pl=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 Rl(t,e){for(let n=0;n<t.length;n++)"number"==typeof t[n]&&Pl.has(e)&&(t[n]=t[n]+"px")}function Dl(t,e){const n=window.getComputedStyle(t);return gl(e)?n.getPropertyValue(e):n[e]}function Ll(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;Xa(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={...Ol(a,t)};r.duration&&(r.duration=Ja(r.duration)),r.delay&&(r.delay=Ja(r.delay));const o=Cl(i),l=Fl(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]=Dl(i,r)),vl(e),Rl(e,r),!o&&e.length<2&&e.unshift(Dl(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 El(i);e.set(n,r),r.finished.finally((()=>e.delete(n))),a.push(r)}return a}const Bl=(()=>function(t,e,n){return new Nl(Ll(t,e,n))})();var zl=Es('<button class="svelte-16kucsb"><div class="svelte-16kucsb"> </div></button>'),Wl=Es('<div class="tryIt-container svelte-16kucsb"><!></div>');const $l={hash:"svelte-16kucsb",code:".eko-gallery-app {--tryItModule_justifyContent: center;--tryItModule_alignItems: flex-end;--tryItModule_padding: 16px 20px 48px 20px;--tryItModule_button_padding: 16px 32px;--tryItModule_button_textAlign: center;--tryItModule_button_borderRadius: 100px;--tryItModule_button_border: 0;--tryItModule_button_boxShadow: 0 4px 24px 2px rgba(0, 0, 0, 0.12);--tryItModule_button_background: #FFFFFF;--tryItModule_button_text_fontFamily: var(--fontName);--tryItModule_button_text_fontSize: 18px;--tryItModule_button_text_color: #222;--tryItModule_button_text_weight: 500;--tryItModule_button_text_lineHeight: 120%;--tryItModule_button_text_letterSpacing: -0.1px;}.tryIt-container.svelte-16kucsb {position:relative;padding:var(--tryItModule_padding);width:100%;height:100%;box-sizing:border-box;display:flex;justify-content:var(--tryItModule_justifyContent);align-items:var(--tryItModule_alignItems);}.tryIt-container.svelte-16kucsb button:where(.svelte-16kucsb) {padding:var(--tryItModule_button_padding);text-align:var(--tryItModule_button_textAlign);border-radius:var(--tryItModule_button_borderRadius);border:var(--tryItModule_button_border);background:var(--tryItModule_button_background);box-shadow:var(--tryItModule_button_boxShadow);font-family:var(--tryItModule_button_text_fontFamily);font-size:var(--tryItModule_button_text_fontSize);color:var(--tryItModule_button_text_color);font-weight:var(--tryItModule_button_text_weight);line-height:var(--tryItModule_button_text_lineHeight);letter-spacing:var(--tryItModule_button_text_letterSpacing);cursor:pointer;opacity:0;overflow:hidden;}.tryIt-container.svelte-16kucsb button:where(.svelte-16kucsb) div:where(.svelte-16kucsb) {opacity:0;}"};function Ul(t,e){Ii(e,!0),Ys(t,$l);const n=Ur((()=>e.state.ctaText)),i=Ur((()=>e.state.animationConfig)),r=Ur((()=>e.state.showCta)),o=Ur((()=>e.state.onCtaClick));let s=null,a=null,l=Qr(!1),c=!1;function u(){c&&Bl(s,{transform:"scale(1.05)"},{type:fl,mass:1.5,stiffness:400,damping:30})}function d(){c&&Bl(s,{transform:"scale(1)"},{type:fl,mass:1.5,stiffness:400,damping:30})}function h(){c&&Bl(s,{transform:"scale(0.95)"},{type:fl,mass:1,stiffness:600,damping:30})}Io((()=>{const{mass:t,stiffness:e,damping:n,delay:o}=ps(i);let u;return ps(r)&&(u=setTimeout((async()=>{Zr(l,!0),u=null,Bl(s,{transform:["translateY(40px) scale(0, 0.2)","translateY(0) scale(1, 1)"],opacity:1},{type:fl,mass:t,stiffness:e,damping:n}),await Bl(a,{transform:["translateY(20px) scale(0.8)","translateY(0) scale(1)"],opacity:1},{type:fl,mass:t,stiffness:e,damping:n,delay:.15}),c=!0}),o)),()=>{u&&clearTimeout(u)}}));var f=Wl(),p=po(f),m=t=>{var e=zl();e.__mousedown=h,e.__touchstart=h,e.__click=function(...t){var e;null===(e=ps(o))||void 0===e||e.apply(this,t)};var i=po(e),r=po(i,!0);vi(i),ka(i,(t=>a=t),(()=>a)),vi(e),ka(e,(t=>s=t),(()=>s)),No((()=>{oa(e,"pointer-events: "+(ps(l)?"auto":"none")),Rs(r,ps(n))})),xs("mouseenter",e,u),xs("mouseleave",e,d),As(t,e)};Us(p,(t=>{ps(r)&&t(m)})),vi(f),As(t,f),Ei()}ws(["mousedown","touchstart","click"]);var jl=new WeakSet;function ql(){this.mainTimeline?this.player.switchTimeline(this.mainTimeline):this.emitModuleEnd(),this.state.showCta=!1}const Vl={videoModule:class extends Na{constructor({config:t,...e}){var n;super({...e,config:t}),this.Component=za,this.hasDuration=!t.loop,Sa(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(Ma(`${this.id}_intro`,e.intro,t),"end");const n=Ma(this.id,e.video,t);this.timeline.placeOnTimeline(n,"end",{loop:e.loop}),e.loop||n.on("nodeend",this.emitModuleEnd)}},toggleModule:class extends Na{constructor({config:t,...e}){super({...e,config:t}),O(this,qa),this.Component=ja,this.synced=t.sync,this.switchTo=()=>{},Sa(this),this.coverAssets=t.options.map((t=>{var e;return null!==(e=t.intro)&&void 0!==e?e:t.video})),this.cover=this.coverAssets[0],this.state={options:t.options.map((t=>({label:t.label,note:t.note}))),currentOptionIndex:0,onOptionClicked:A(qa,this,Va).bind(this)}}start(t){super.start(t),this.synced?(this.timeline=t.createTimeline(),this.config.options.forEach(((e,n)=>{this.timeline.placeOnTimeline(Ma(`${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(Ma(`${this.id}_option_${n}_intro`,e.intro,t),"end"),i.placeOnTimeline(Ma(`${this.id}_option_${n}`,e.video,t),"end",{loop:!0}),i})),this.timeline=this.timelines[this.state.currentOptionIndex])}},tryItModule:class extends Na{constructor({config:t,...e}){var n;super({...e,config:t}),O(this,jl),Sa(this);const{introVideo:i}=t;this.coverAssets.push(null!==(n=i.intro)&&void 0!==n?n:i.loop),this.cover=this.coverAssets[0],this.state={ctaText:t.ctaText,animationConfig:t.animationConfig,showCta:!0,onCtaClick:A(jl,this,ql).bind(this)}}start(t){super.start(t),this.Component=Ul,this.timeline=t.createTimeline();const{introVideo:e,mainVideo:n}=this.config;if(e.intro&&this.timeline.placeOnTimeline(Ma(`${this.id}_intro_intro`,e.intro,t)),this.timeline.placeOnTimeline(Ma(`${this.id}_intro_loop`,e.loop,t),"end",{loop:!0}),n){this.mainTimeline=t.createTimeline(),n.intro&&this.mainTimeline.placeOnTimeline(Ma(`${this.id}_main_intro`,n.intro,t));const e=Ma(`${this.id}_main_loop`,n.loop,t);this.mainTimeline.placeOnTimeline(e,"end",{loop:!0})}}play(){this.state.showCta=!0,super.play()}}};class Hl{#d=Qr({});#h=Qr("ekonovar");#f=Qr(0);#p=Qr(0);#m=Qr(io({itemIndex:0,moduleIndex:0}));#v=Ur((()=>{var t;return null===(t=ps(this.#d))||void 0===t?void 0:t[ps(this.#h)]}));#g=Ur((()=>{var t;return null===(t=ps(this.#v))||void 0===t?void 0:t[ps(this.#f)]}));#y=Ur((()=>{var t,e;return ps(this.#b)?null===(e=ps(this.#v))||void 0===e?void 0:e[ps(this.#m).itemIndex].modules[ps(this.#m).moduleIndex]:null===(t=ps(this.#g))||void 0===t?void 0:t.modules[ps(this.#p)]}));#k=Ur((()=>{var t;return(null===(t=ps(this.#v))||void 0===t?void 0:t.flatMap((t=>t.modules)))||[]}));#x=Qr(!1);#w=Qr(!1);#b=Qr(!1);#_=Ur((()=>!(ps(this.#m).itemIndex===this.activeItemIndex&&ps(this.#m).moduleIndex===this.activeModuleIndex)));set variants(t){Zr(this.#d,t)}set activeVariant(t){Zr(this.#h,t,!0)}set activeItemIndex(t){Zr(this.#f,t,!0)}set activeModuleIndex(t){Zr(this.#p,t,!0)}set playingModulePosition(t){Zr(this.#m,t,!0)}set playerLoaded(t){Zr(this.#x,t,!0)}set paused(t){Zr(this.#w,t,!0)}set startedPlaying(t){Zr(this.#b,t,!0)}get variants(){return ps(this.#d)}get activeVariant(){return ps(this.#h)}get activeItemIndex(){return ps(this.#f)}get activeModuleIndex(){return ps(this.#p)}get playingModulePosition(){return ps(this.#m)}get currentItemsList(){return ps(this.#v)}get currentItem(){return ps(this.#g)}get currentModule(){return ps(this.#y)}get playerLoaded(){return ps(this.#x)}get paused(){return ps(this.#w)}get startedPlaying(){return ps(this.#b)}get seeking(){return ps(this.#_)}get currentModulesList(){return ps(this.#k)}}const Gl={assetsDeliveryBase:"https://{{env}}assets.eko.com"},Kl=2,Xl=5,Yl=["activeItemIndex","activeModuleIndex","paused","startedPlaying"],Ql=["version","selectItem","selectItemAndStep","next","prev","subscribe"];var Jl=new WeakMap,Zl=new WeakMap,tc=new WeakMap,ec=new WeakMap,nc=new WeakSet;class ic{constructor(t){var e,n,i;O(this,nc),F(this,Jl,void 0),F(this,Zl,void 0),F(this,tc,void 0),F(this,ec,void 0),P(this,"public",void 0),P(this,"version","0.0.7"),Sa(this),C(tc,this,t),C(Jl,this,new Hl(null==t||null===(e=t.options)||void 0===e?void 0:e.galleryEnv)),C(ec,this,((t="")=>("production"===t&&(t=""),Object.fromEntries(Object.entries(Gl).map((([e,n])=>[e,n.replaceAll("{{env}}",t)])))))(null==t||null===(n=t.options)||void 0===n?void 0:n.galleryEnv)),C(Zl,this,[]);const r=null==t||null===(i=t.instance)||void 0===i||null===(i=i.data)||void 0===i||null===(i=i.blocks)||void 0===i||null===(i=i.blocksArr)||void 0===i||null===(i=i.find((t=>"GalleryBlock"===t.blockType)))||void 0===i?void 0:i.config;var o;r?(A(nc,this,rc).call(this,r.items),A(nc,this,oc).call(this,r.items)):console.warn("[eko-gallery-app] Gallery initiated without an instance, results will be empty"),this.public=(o=this,Ql.reduce(((t,e)=>{if(!(e in o))throw new Error(`[eko-gallery-app] Public API member "${e}" does not exist on GalleryLogic`);const n=o[e];return t[e]="function"==typeof n?n.bind(o):n,t}),{}))}start(t){M(Jl,this).playerLoaded=!0,M(Zl,this).forEach((e=>{e.start(t)})),C(Zl,this,null),A(nc,this,sc).call(this,t),M(Jl,this).currentModule.play()}selectItem(t){const e=M(Jl,this);t!==e.activeItemIndex&&(e.activeItemIndex=t,e.activeModuleIndex=0)}selectItemAndStep(t,e){const n=M(Jl,this);t===n.activeItemIndex&&e===n.activeModuleIndex||(n.activeItemIndex=t,n.activeModuleIndex=e)}next(){A(nc,this,lc).call(this)}prev(){const t=M(Jl,this);if(t.activeModuleIndex=t.activeModuleIndex-1,!t.currentItem.modules[t.activeModuleIndex])if(t.currentItemsList[t.activeItemIndex-1]){t.activeItemIndex=t.activeItemIndex-1;const e=t.currentItemsList[t.activeItemIndex];t.activeModuleIndex=e.modules.length-1}else t.activeModuleIndex=t.activeModuleIndex+1}subscribe(t){const e=M(Jl,this);return function(t){tr.ensure();const e=wo(Bn|Yn,t,!0);return()=>{Ro(e)}}((()=>{Io((()=>{const n=Yl.reduce(((t,n)=>(t[n]=e[n],t)),{});t(n)}))}))}getCoverUrl(t,e){var n,i,r,o;const s=(null==t||null===(n=t.entity)||void 0===n?void 0:n.entityId)||(null==t?void 0:t.assetId),a=null!==(i=null==t||null===(r=t.entity)||void 0===r?void 0:r.entityRevision)&&void 0!==i?i:null==t?void 0:t.assetRevision;if(!s)throw new Error(`[getCoverUrl] No assetId found in assetConfig: ${JSON.stringify(t||{},null,2)}`);if(!a&&0!==a)throw new Error(`[getCoverUrl] No assetRevision found for asset ${s}.`);let l;return null!==(o=M(tc,this))&&void 0!==o&&null!==(o=o.coverAssetsMap)&&void 0!==o&&o[s]?(l=new URL(M(tc,this).coverAssetsMap[s]),/^[a-z0-9]*assets.eko.com$/.test(l.host)&&e&&(l.pathname=l.pathname.replace(".png",".webp"))):(l=new URL(`${M(ec,this).assetsDeliveryBase}/image/${s}/${a}?startOffset=0`),l.pathname+=e?".webp":".png"),e&&l.searchParams.set("width",e),l.href}get currentConfig(){return M(tc,this)}get state(){return M(Jl,this)}get urls(){return M(ec,this)}}function rc(t){const e={};for(let n of t)for(let t of Object.keys(n.variants||{}))e[t]=[];e.ekonovar=[],M(Jl,this).variants=e}function oc(t){const e=(t=[],e)=>{const n=[];for(let[i,r]of t.entries()){if(!Vl[r.itemType])throw new Error(`Unknown module type ${r.itemType}`);const t=new Vl[r.itemType]({position:{...e,moduleIndex:i},config:r,galleryState:M(Jl,this)});t.moduleEndListener=A(nc,this,ac).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(M(Jl,this).variants)){var n;if(null===(n=r.variants)||void 0===n?void 0:n[s])console.log("NO IMPLEMENTED");else{const n={...o};n.modules=e(t,{variantId:s,itemIndex:i}),C(Zl,this,[...M(Zl,this),...n.modules]),a.push(n)}}}}function sc(t){for(const[,e]of Object.entries(M(Jl,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:Kl},...c.map((t=>({nodeId:t.id,weight:Xl})))];for(const e of s.timeline.placements){t.getNode(e.nodeId).setChildren(u)}}}}function ac(){const t=M(Jl,this),e=t.currentItem.modules;e.length>1&&t.activeModuleIndex===e.length-1?t.activeModuleIndex=0:A(nc,this,lc).call(this)}function lc(){const t=M(Jl,this);t.activeModuleIndex=t.activeModuleIndex+1,t.currentItem.modules[t.activeModuleIndex]||(t.currentItemsList[t.activeItemIndex+1]?(t.activeItemIndex=t.activeItemIndex+1,t.activeModuleIndex=0):t.activeModuleIndex=t.activeModuleIndex-1)}var cc=Es('<button><span class="svelte-er27y2"> </span></button>'),uc=Es('<div class="nav-buttons-container svelte-er27y2"><div class="nav-buttons svelte-er27y2"></div></div>');const dc={hash:"svelte-er27y2",code:".eko-gallery-app {--nav_gap: 10px;--nav_padding: 12px 16px;--nav_bgColor: #FFFFFF;--nav_justifyContent: center;--nav_button_width: fit-content;--nav_button_bgColor: #FFFFFF;--nav_button_borderRadius: 100px;--nav_button_paddingTop: 8px;--nav_button_paddingBottom: var(--nav_button_paddingTop);--nav_button_paddingLeft: 12px;--nav_button_paddingRight: var(--nav_button_paddingLeft);--nav_button_boxShadow: 0 0 0 1px #E7E7E7;--nav_button_gap: 2px;--nav_button_selected_boxShadow: 0 0 0 1px #000000;--nav_button_selected_bgColor: var(--nav_button_bgColor);--nav_button_text_color: #000000;--nav_button_text_fontSize: 14px;--nav_button_text_fontWeight: 500;--nav_button_text_fontFamily: var(--fontName);--nav_button_text_lineHeight: 120%;--nav_button_text_letterSpacing: 0px;--nav_button_text_align: center;--nav_button_selected_text_color: var(--nav_button_text_color);--nav_button_selected_text_fontWeight: var(--nav_button_text_fontWeight);--nav_button_image_borderRadius: calc(var(--nav_button_borderRadius) - var(--nav_button_paddingTop));--nav_arrow_color: var(--secondaryColor);--nav_arrow_bgColor: var(--primaryColor);--nav_arrow_padding: 9px;--nav_arrow_size: 28px;--nav_arrow_boxShadow: 0 0 8px 0 rgba(0, 0, 0, 0.3);}.nav-buttons-container.svelte-er27y2 {width:100%;background-color:var(--nav_bgColor);height:var(--buttonsContainerHeight);display:flex;box-sizing:border-box;text-align:center;justify-content:var(--nav_justifyContent);align-items:center;position:relative;flex-shrink:0;}.nav-buttons-container.svelte-er27y2 :where(.svelte-er27y2) {touch-action:auto;}.nav-buttons.svelte-er27y2 {display:flex;margin:0;gap:var(--nav_gap);height:100%;align-items:center;padding:var(--nav_padding);box-sizing:border-box;overflow-x:auto;scrollbar-width:none;max-width:100%;width:fit-content;overflow-y:hidden;overscroll-behavior-y:none;}.nav-button.svelte-er27y2 {display:flex;outline:none;flex-shrink:0;height:100%;width:var(--nav_button_width);border:none;cursor:pointer;align-items:center;gap:var(--nav_button_gap);background-color:var(--nav_button_bgColor);border-radius:var(--nav_button_borderRadius);\n /* eslint-disable-next-line max-len */padding:var(--nav_button_paddingTop) var(--nav_button_paddingRight) var(--nav_button_paddingBottom) var(--nav_button_paddingLeft);box-shadow:var(--nav_button_boxShadow);}.nav-button.svelte-er27y2 span:where(.svelte-er27y2) {flex:1 0 0;transition:color 0.2s ease-in-out;color:var(--nav_button_text_color);font-weight:var(--nav_button_text_fontWeight);font-size:var(--nav_button_text_fontSize);font-family:var(--nav_button_text_fontFamily);line-height:var(--nav_button_text_lineHeight);letter-spacing:var(--nav_button_text_letterSpacing);text-align:var(--nav_button_text_align);}.nav-button.selected.svelte-er27y2 {background-color:var(--nav_button_selected_bgColor);box-shadow:var(--nav_button_selected_boxShadow);}.nav-button.selected.svelte-er27y2 span:where(.svelte-er27y2) {color:var(--nav_button_selected_text_color);font-weight:var(--nav_button_selected_text_fontWeight);}"};ws(["click"]);const hc="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 fc=Es('<button><img class="svelte-1al44kl"/></button>');const pc={hash:"svelte-1al44kl",code:'.nav-button.svelte-1al44kl {height:30px;width:30px;border-radius:100%;background-color:transparent;padding:9px;box-sizing:border-box;display:flex;align-items:center;justify-content:center;pointer-events:auto;border:0;opacity:100%;cursor:pointer;transition-property:background-color, box-shadow, opacity;position:relative;}.nav-button.prev.svelte-1al44kl {transform:rotate(180deg);}.nav-button.hidden.svelte-1al44kl {opacity:0;pointer-events:none;}.nav-button.svelte-1al44kl::before {content:"";position:absolute;top:-8px;right:-8px;bottom:-8px;left:-8px;}.nav-button.svelte-1al44kl img:where(.svelte-1al44kl) {height:100%;}'};function mc(t,e){Ys(t,pc);const n=wa(e,"hidden",3,!1);var i=fc();let r;i.__click=function(...t){var n;null===(n=e.onClick)||void 0===n||n.apply(this,t)};var o=po(i);vi(i),No((()=>{var t;r=ia(i,1,`nav-button ${null!==(t=e.type)&&void 0!==t?t:""}`,"svelte-1al44kl",r,{hidden:n()}),pa(i,"aria-label",e.type),pa(o,"src",hc),pa(o,"alt",e.type)})),As(t,i)}ws(["click"]);var vc=Es('<button><span class="svelte-1mxltt0"> </span></button>'),gc=Es('<div class="steps-indicator-container svelte-1mxltt0"><button aria-label="Scroll to previous steps"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="svelte-1mxltt0"><path d="M12.8333 16.6668C12.68 16.6668 12.5266 16.5935 12.4266 16.4601L9.42663 12.2935C9.36482 12.2081 9.33154 12.1055 9.33154 12.0001C9.33154 11.8948 9.36482 11.7921 9.42663 11.7068L12.4266 7.54012C12.4651 7.48671 12.5138 7.44142 12.5698 7.40682C12.6259 7.37222 12.6882 7.349 12.7532 7.33848C12.8182 7.32795 12.8846 7.33033 12.9487 7.34549C13.0128 7.36064 13.0732 7.38826 13.1266 7.42678C13.18 7.46531 13.2253 7.51397 13.2599 7.56999C13.2945 7.62602 13.3177 7.68831 13.3283 7.75331C13.3388 7.81831 13.3364 7.88475 13.3213 7.94883C13.3061 8.01291 13.2785 8.07338 13.24 8.12678L10.4466 12.0001L13.2333 15.8735C13.2864 15.9479 13.3181 16.0355 13.3251 16.1267C13.332 16.2179 13.314 16.3092 13.2728 16.3909C13.2316 16.4725 13.1689 16.5414 13.0915 16.59C13.014 16.6386 12.9247 16.6652 12.8333 16.6668Z" fill="#030303" class="svelte-1mxltt0"></path></svg></button> <div role="group" aria-roledescription="Sequence navigation buttons"></div> <button aria-label="Scroll to next steps"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="svelte-1mxltt0"><path d="M11.1668 16.6666C11.0668 16.6666 10.9601 16.6333 10.8734 16.5733C10.8199 16.5348 10.7746 16.4862 10.7399 16.4302C10.7053 16.3741 10.682 16.3118 10.6715 16.2468C10.6609 16.1818 10.6634 16.1153 10.6786 16.0512C10.6938 15.9871 10.7215 15.9266 10.7601 15.8733L13.5534 11.9999L10.7601 8.12661C10.6001 7.89994 10.6468 7.59328 10.8734 7.42661C11.1001 7.26661 11.4068 7.31994 11.5734 7.53994L14.5734 11.7066C14.7001 11.8799 14.7001 12.1133 14.5734 12.2933L11.5734 16.4599C11.4734 16.5933 11.3201 16.6666 11.1668 16.6666Z" fill="#030303" class="svelte-1mxltt0"></path></svg></button></div>');const yc={hash:"svelte-1mxltt0",code:'.steps-indicator-container.svelte-1mxltt0 {width:calc(100% - 32px);position:absolute;bottom:12px;left:16px;animation-duration:0.75s;animation-timing-function:cubic-bezier(0.36, 0, 0, 1);animation-fill-mode:both;animation-delay:0.15s;\n animation-name: svelte-1mxltt0-gallery-steps-appear-anim;}.steps-indicator.svelte-1mxltt0 {--stepSize: 6px;--stepPadding: 7px;padding:4px 0px;display:flex;gap:8px;align-items:center;overflow-x:auto;pointer-events:all;scrollbar-width:none;}.steps-indicator.with-duration.svelte-1mxltt0 .step-button:where(.svelte-1mxltt0) span:where(.svelte-1mxltt0) {position:relative;overflow:hidden;}.steps-indicator.with-duration.svelte-1mxltt0 .step-button:where(.svelte-1mxltt0) span:where(.svelte-1mxltt0):after {transition:0.3s ease-in-out;transition-property:opacity, width;}.step-button.svelte-1mxltt0 {padding:8px 12px;border:#E4E5E8 solid 1px;background-color:#FBFBFB;cursor:pointer;pointer-events:all;flex-shrink:0;border-radius:100px;font-size:12px;font-weight:500;line-height:16px;color:#030303;transition:all 0.3s ease-in-out;outline-color:#3191fc;}.step-button.active.svelte-1mxltt0 {background-color:#014FD3;color:#FFFFFF;box-shadow:none;border-color:#014FD3;}.step-button.active.svelte-1mxltt0:after {opacity:100%;\n animation: svelte-1mxltt0-stepDurationAnimation var(--stepDuration) linear forwards;animation-play-state:running;}.step-button.svelte-1mxltt0:hover:not(.active) {background:#F3F4F6;}.step-button.svelte-1mxltt0:active:not(.active) {background:#E4E5E8;}.step-button.svelte-1mxltt0:focus {outline-offset:4px;outline-width:2px;}.step-button.svelte-1mxltt0 span:where(.svelte-1mxltt0) {display:block;box-sizing:border-box;pointer-events:none;white-space:nowrap;}.step-button.svelte-1mxltt0 span:where(.svelte-1mxltt0):after {content:"";background-color:rgba(0, 0, 0, 0.6);position:absolute;border-radius:var(--stepSize);width:0;height:100%;top:0;left:-100%;opacity:0;transform:translateX(0);animation-play-state:paused;}.step-arrow.svelte-1mxltt0 {max-height:34px;position:absolute;padding-top:4px;padding-bottom:4px;z-index:10;bottom:4px;border:none;background-color:#FFF;pointer-events:none;cursor:pointer;opacity:0;}.step-arrow.svelte-1mxltt0:hover {background:#F6F6F7;}.step-arrow.svelte-1mxltt0:active {background:#E4E5E8;}.step-arrow-prev.svelte-1mxltt0 {padding-right:8px;padding-left:0;left:0;transform:translateX(-100%);\n animation: svelte-1mxltt0-arrow-left-disappear 0.3s cubic-bezier(0.36, 0, 0, 1) both;}.step-arrow-prev.visible.svelte-1mxltt0 {pointer-events:auto;\n animation: svelte-1mxltt0-arrow-left-appear 0.3s cubic-bezier(0.36, 0, 0, 1) both;}.step-arrow-next.svelte-1mxltt0 {padding-right:0;padding-left:8px;right:0;transform:translateX(100%);\n animation: svelte-1mxltt0-arrow-right-disappear 0.3s cubic-bezier(0.36, 0, 0, 1) both;}.step-arrow-next.visible.svelte-1mxltt0 {pointer-events:auto;\n animation: svelte-1mxltt0-arrow-right-appear 0.3s cubic-bezier(0.36, 0, 0, 1) both;}\n\n@keyframes svelte-1mxltt0-gallery-steps-appear-anim {\n from {\n opacity: 0;\n transform: translate(0, 10px);\n }\n to {\n opacity: 1;\n transform: translate(0, 0);\n }\n}\n@keyframes svelte-1mxltt0-gallery-steps-disappear-anim {\n from {\n opacity: 1;\n transform: translate(0, 0);\n }\n to {\n opacity: 0;\n transform: translate(0, 10px);\n }\n}\n@keyframes svelte-1mxltt0-arrow-left-appear {\n from {\n opacity: 0;\n transform: translateX(-100%);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n@keyframes svelte-1mxltt0-arrow-left-disappear {\n from {\n opacity: 1;\n transform: translateX(0);\n }\n to {\n opacity: 0;\n transform: translateX(-100%);\n }\n}\n@keyframes svelte-1mxltt0-arrow-right-appear {\n from {\n opacity: 0;\n transform: translateX(100%);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n@keyframes svelte-1mxltt0-arrow-right-disappear {\n from {\n opacity: 1;\n transform: translateX(0);\n }\n to {\n opacity: 0;\n transform: translateX(100%);\n }\n}\n@keyframes svelte-1mxltt0-stepDurationAnimation {\n 0% {\n transform: translateX(0);\n }\n 100% {\n transform: translateX(100%);\n }\n}'};function bc(t,e){Ii(e,!0),Ys(t,yc);const n=16,i=32,r=Ti("state");let o=Qr(null),s=Qr(null),a=Qr(!1),l=Qr(!1);const c=Ur((()=>{let t=[];return t=r().currentItem.modules.map(((t,e)=>({index:e,type:e===r().activeModuleIndex?"active":"",name:t.name}))),t}));function u(){ps(o)&&(Zr(a,ps(o).scrollLeft>3),Zr(l,ps(o).scrollLeft+ps(o).clientWidth<ps(o).scrollWidth-3))}function d(t){ps(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(ps(o).querySelectorAll(".step-button")).find((t=>{const e=t.getBoundingClientRect(),n=ps(o).getBoundingClientRect();return e.left>n.left+i}));if(t){const e=t.previousElementSibling;e&&h(ps(o),e)}}function p(){const t=Array.from(ps(o).querySelectorAll(".step-button")).reverse().find((t=>{const e=t.getBoundingClientRect(),n=ps(o).getBoundingClientRect();return e.right<n.right-i}));if(t){const e=t.nextElementSibling;e&&h(ps(o),e)}}Io((()=>{if(ps(o)){u();const t=new MutationObserver((()=>{const t=ps(o).querySelector(".step-button.active");t&&Zr(s,t,!0)}));return t.observe(ps(o),{attributes:!0,attributeFilter:["class"],subtree:!0}),()=>{t.disconnect()}}})),Io((()=>{ps(s)&&ps(o)&&h(ps(o),ps(s))}));var m=Ss();xs("resize",oo,u),function(t,e,n){hi&&mi();var i=new $s(t);Mo((()=>{var t=e();i.ensure(t,n)}))}(mo(m),(()=>r().activeItemIndex),(t=>{var e=gc(),n=po(e);let i;n.__click=f;var s=vo(n,2);let d;Hs(s,21,(()=>ps(c)),js,((t,e)=>{var n=vc();let i;n.__click=t=>{return n=t.currentTarget,i=ps(e).index,r().activeModuleIndex=i,void h(ps(o),n);var n,i};var s=po(n),a=po(s,!0);vi(s),vi(n),No((()=>{i=ia(n,1,"step-button svelte-1mxltt0",null,i,{active:"active"===ps(e).type}),pa(n,"aria-label",`Go to step $${ps(e).index+1}`),Rs(a,ps(e).name)})),As(t,n)})),vi(s),ka(s,(t=>Zr(o,t)),(()=>ps(o)));var m=vo(s,2);let v;m.__click=p,vi(e),No(((t,e)=>{i=ia(n,1,"step-arrow step-arrow-prev svelte-1mxltt0",null,i,{visible:ps(a)}),d=ia(s,1,"steps-indicator svelte-1mxltt0",null,d,t),oa(s,`--stepDuration: ${null!=e?e:""}s`),v=ia(m,1,"step-arrow step-arrow-next svelte-1mxltt0",null,v,{visible:ps(l)})}),[()=>({"with-duration":r().currentModule.hasDuration,paused:r().paused}),()=>r().currentModule.duration]),xs("scroll",s,u),As(t,e)})),As(t,m),Ei()}ws(["click"]);const kc="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3.01318%203.42005C3.01318%202.06672%204.50652%201.26672%205.66652%201.90672C6.82652%202.54672%2014.0732%206.48672%2014.0732%206.48672C15.2865%207.15339%2015.2865%208.86005%2014.0732%209.52005L5.66652%2014.1001C4.50652%2014.7334%203.01318%2013.9401%203.01318%2012.5801V3.42005ZM3.98652%2012.5801C3.98652%2013.1334%204.63318%2013.5467%205.19985%2013.2401L13.6065%208.66005C14.1399%208.36672%2014.1465%207.63339%2013.6065%207.34005C13.0665%207.04672%205.19985%202.76005%205.19985%202.76005C4.63985%202.44672%203.98652%202.86005%203.98652%203.42005V12.5801Z'%20fill='%23030303'/%3e%3c/svg%3e",xc="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M10.8332%2014C10.5598%2014%2010.3332%2013.7733%2010.3332%2013.5V2.5C10.3332%202.22667%2010.5598%202%2010.8332%202C11.1065%202%2011.3332%202.22667%2011.3332%202.5V13.5C11.3332%2013.7733%2011.1065%2014%2010.8332%2014ZM5.1665%2014C4.89317%2014%204.6665%2013.7733%204.6665%2013.5V2.5C4.6665%202.22667%204.89317%202%205.1665%202C5.43984%202%205.6665%202.22667%205.6665%202.5V13.5C5.6665%2013.7733%205.43984%2014%205.1665%2014Z'%20fill='%23030303'/%3e%3c/svg%3e";var wc=Es('<img alt="Play" class="svelte-a3r6re"/>'),_c=Es('<img alt="Pause" class="svelte-a3r6re"/>'),Tc=Es('<button class="pause-button svelte-a3r6re"><!></button>');const Ic={hash:"svelte-a3r6re",code:".pause-button.svelte-a3r6re {position:absolute;top:10px;right:10px;background:#FFFFFF;border-radius:100%;border:1px #C4C8CF solid;padding:0;width:32px;height:32px;display:flex;justify-content:center;align-items:center;pointer-events:auto;transition:background 0.2s ease-in-out;cursor:pointer;outline-color:#3191fc;}.pause-button.svelte-a3r6re:hover {background:#F6F6F7;}.pause-button.svelte-a3r6re:active {background:#E4E5E8;}.pause-button.svelte-a3r6re:focus {outline-offset:8px;outline-width:2px;}.pause-button.svelte-a3r6re img:where(.svelte-a3r6re) {width:16px;height:16px;pointer-events:none;}"};ws(["click"]);const Ec=300,Sc=60,Ac="none";function Nc(t,e,n){return t.addEventListener(e,n),()=>t.removeEventListener(e,n)}function Mc(t,e,n){const{x:i,y:r}=function(t,e){const n=t.getBoundingClientRect();return{x:Math.round(e.clientX-n.left),y:Math.round(e.clientY-n.top)}}(t,e);return{event:e,pointersCount:n.length,target:e.target,x:i,y:r,attachmentNode:t}}function Fc(t,e,n,i,r){const o=Mc(t,n,i);return t.dispatchEvent(new CustomEvent(`${e}${r}`,{detail:o})),o}function Cc(){let t=[],e=()=>{},n=[];return{setPointerControls:(i,r,o,s,a,l=Ac,c=[])=>{var u;if(r.style.touchAction=(u=l,Array.isArray(u)?u:[u]).join(" "),n=c,n.forEach((e=>{var n;null===(n=e.onInit)||void 0===n||n.call(e,t)})),!t.length){let l=function(e){t.push(e);const l=Fc(r,i,e,t,"down");function c(e){const o=t.length;t=function(t,e){return e.filter((e=>t.pointerId!==e.pointerId))}(e,t);if(o>t.length){t.length||(u(),d(),h(),f());const o=Fc(r,i,e,t,"up");null==a||a(t,e),setTimeout((()=>{n.forEach((e=>{var n;null===(n=e.onUp)||void 0===n||n.call(e,o,t)}))}))}}null==s||s(t,e),setTimeout((()=>{n.forEach((e=>{var n;null===(n=e.onDown)||void 0===n||n.call(e,l,t)}))}));const u=Nc(r,"pointermove",(e=>{t=t.map((t=>e.pointerId===t.pointerId?e:t));const s=Fc(r,i,e,t,"move");null==o||o(t,e),n.forEach((e=>{var n;null===(n=e.onMove)||void 0===n||n.call(e,s,t)}))})),d=Nc(r,"lostpointercapture",(t=>{c(t)})),h=Nc(r,"pointerup",(t=>{c(t)})),f=Nc(r,"pointerleave",(t=>{c(t)}))};e=Nc(r,"pointerdown",l)}return{destroy:()=>{t.length||(e(),n.forEach((t=>{var e;null===(e=t.onDestroy)||void 0===e||e.call(t)})))}}}}}const Oc="@attach";const Pc="swipe";function Rc(t,e,n,i=!1){const{setPointerControls:r}=Cc(),o=i?Pc:Symbol(Oc);return{...n,[`on${Pc}`]:t,[o]:t=>{const{onDown:n,onUp:i,parameters:o}=function(t,e){const n={timeframe:Ec,minSwipeDistance:Sc,touchAction:Ac,composed:!1,...e};let i,r,o,s;function a(t,e){r=e.clientX,o=e.clientY,i=Date.now(),1===t.length&&(s=e.target)}function l(e,a){if("pointerup"===a.type&&0===e.length&&Date.now()-i<n.timeframe){const e=a.clientX-r,i=a.clientY-o,l=Math.abs(e),c=Math.abs(i);let u=null;l>=2*c&&l>n.minSwipeDistance?u=e>0?"right":"left":c>=2*l&&c>n.minSwipeDistance&&(u=i>0?"bottom":"top"),u&&t.dispatchEvent(new CustomEvent(Pc,{detail:{direction:u,target:s,pointerType:a.pointerType}}))}}return{onDown:a,onUp:l,parameters:n}}(t,null==e?void 0:e());return r(Pc,t,null,n,i,o.touchAction,o.plugins).destroy}}}const Dc=t=>{const e="#00ff00",n=1e6,i=4;let r,o,s,a=null,l=!1,c=Date.now();const u={x:void 0,y:void 0};function d(){const e=t.fadeTime,n=Date.now(),i=n-c;i>e/20&&(a&&o&&s&&r&&(s.drawImage(r,0,0),a.clearRect(0,0,r.width,r.height),a.globalAlpha=1-3*i/e,a.drawImage(o,0,0),a.globalAlpha=1,s.clearRect(0,0,r.width,r.height)),c=n),l&&requestAnimationFrame(d)}function h(t){u.x=t.x,u.y=t.y}function f(){a&&o&&r&&(a.canvas.width=window.innerWidth,a.canvas.height=window.innerHeight,o.width=r.width,o.height=r.height)}function p(e){var i;m(),r=window.document.createElement("canvas"),r.id="svelte-gestures-highlight-plugin",a=r.getContext("2d"),r.style.cssText=`\ndisplay: block; \nwidth: 100dvw;\nheight: 100dvh;\ntop: 0;\nleft: 0;\nposition: fixed;\npointer-events: none;\nz-index: ${null!==(i=t.zIndex)&&void 0!==i?i:n};\n`,window.document.body.appendChild(r),window.addEventListener("resize",f),e&&h(e.event),o=document.createElement("canvas"),f(),s=o.getContext("2d"),l=!0,d()}function m(){var t;l=!1,null===(t=window.document.getElementById("svelte-gestures-highlight-plugin"))||void 0===t||t.remove(),window.removeEventListener("resize",f)}return{onMove:n=>{var r,o,s;r=n.event,a&&(a.beginPath(),a.lineWidth=null!==(o=t.lineWidth)&&void 0!==o?o:i,a.lineCap="round",a.strokeStyle=null!==(s=t.color)&&void 0!==s?s:e,void 0!==u.x&&void 0!==u.y?(a.moveTo(u.x,u.y),h(r),a.lineTo(u.x,u.y)):h(r),a.stroke())},onDown:t=>{p(t)},onUp:(t,e)=>{0===e.length&&m()},onDestroy:m,onInit:t=>{t.length&&(u.x=void 0,u.y=void 0,p())}}};var Lc=Es("<div></div>");const Bc={hash:"svelte-1fv6njc",code:".swiper.svelte-1fv6njc {position:absolute;top:0;left:0;pointer-events:auto;width:100%;height:100%;}"};var zc=Es("<img/>"),Wc=Es('<div class="ui-container svelte-1rvgxfc"><!></div>'),$c=Es('<div class="cover-container svelte-1rvgxfc"><!> <!> <!></div>'),Uc=Es('<div class="covers-container svelte-1rvgxfc" style="scroll-behavior: auto;"></div>');const jc={hash:"svelte-1rvgxfc",code:".covers-container.svelte-1rvgxfc {position:absolute;top:0;left:0;bottom:0;right:0;overflow-x:auto;overflow-y:hidden;scroll-snap-type:x mandatory;display:flex;gap:0.5px;}.covers-container.svelte-1rvgxfc::-webkit-scrollbar {display:none;}.cover-container.svelte-1rvgxfc {position:relative;display:flex;width:100%;height:100%;flex-shrink:0;scroll-snap-align:center;user-select:none;justify-content:center;align-items:center;}.cover-image.svelte-1rvgxfc {width:var(--videoWidth);height:var(--videoHeight);aspect-ratio:var(--videoAspect);object-fit:cover;pointer-events:none;background:#ffffff;}.cover-image.hidden.svelte-1rvgxfc {opacity:0;}.cover-image.hidden.force-show.svelte-1rvgxfc {opacity:1;background:transparent;}.ui-container.svelte-1rvgxfc {position:absolute;top:0;left:0;bottom:0;right:0;pointer-events:none;}"};function qc(t,e){Ii(e,!0),Ys(t,jc);const n=[375,768,1024,1400,1920];let i=wa(e,"scrollOffset",15),r=wa(e,"isMobile",3,!1);const o=Ti("state");let s,a=Ur((()=>o().playingModulePosition)),l=null,c=null,u=Ur((()=>o().startedPlaying)),d=Ur((()=>o().currentModulesList)),h=Ur((()=>ps(d).findIndex((t=>f(o().playingModulePosition,t.position)))));function f(t,e){return t.itemIndex===e.itemIndex&&t.moduleIndex===e.moduleIndex}function p(t){const e=t.scrollLeft,n=t.scrollWidth-t.clientWidth;return 0===e?0:e>n?100:e/n*100}function m(t){var e;r()&&t.preventDefault();const{target:n}=t,u=p(n),m=(null===(e=ps(d))||void 0===e?void 0:e.length)||1,v=100/(m-1||1),g=Math.round(u/v);let y=Math.min(g,m-1);const b=ps(d)[y],k={itemIndex:o().activeItemIndex,moduleIndex:o().activeModuleIndex};if(!l){const t=s.children[ps(h)],e=s.getBoundingClientRect(),n=t.getBoundingClientRect();i(n.x-e.x)}c&&clearTimeout(c),c=setTimeout((()=>{const t=p(n);Math.abs(t-g*v)<.25&&async function(){o().seeking&&(o().playerLoaded?o().currentItemsList[o().activeItemIndex].modules[o().activeModuleIndex].play():o().playingModulePosition=ps(a),i(0))}()}),l?0:150),null!==l||f(b.position,k)?null!==l&&f(b.position,l)&&(l=null):(o().activeItemIndex=b.position.itemIndex,o().activeModuleIndex=b.position.moduleIndex),Zr(a,b.position)}function v(){}Io((()=>{const{activeItemIndex:t,activeModuleIndex:e}=o();t===ps(a).itemIndex&&e===ps(a).moduleIndex||gs((()=>{var n,i;const r=ps(d).findIndex((n=>{const{itemIndex:i,moduleIndex:r}=n.position;return t===i&&e===r}));l=(null===(n=ps(d)[r])||void 0===n?void 0:n.position)||null;const o=null===(i=s)||void 0===i||null===(i=i.children)||void 0===i?void 0:i[r];if(!s||!o)return;const a=s.getBoundingClientRect(),c=o.getBoundingClientRect();let u=s.scrollLeft+(c.left-a.left);const h=Math.max(0,s.scrollWidth-s.clientWidth);u=Math.max(0,Math.min(h,u)),s.scrollTo({left:u,behavior:"auto"})}))})),Io((()=>{ps(u)&&gs((()=>{}))}));var g=Ss(),y=mo(g),b=t=>{var i=Uc();Hs(i,23,(()=>ps(d)),(t=>t.id),((t,i,o)=>{var s=$c(),a=po(s),l=t=>{var r=zc();let s;No((t=>{s=ia(r,1,"cover-image svelte-1rvgxfc",null,s,{hidden:ps(u)&&ps(o)===ps(h),"force-show":ps(i).showCover}),pa(r,"src",t),pa(r,"alt",ps(i).name),pa(r,"fetchpriority",0===ps(o)?"high":"auto")}),[()=>e.gallery.getCoverUrl(ps(i).cover,n[n.length-1])]),xs("load",r,(function(...t){var e;null===(e=0===ps(o)?v:()=>{})||void 0===e||e.apply(this,t)})),function(t){if(!hi)return;t.removeAttribute("onload"),t.removeAttribute("onerror");const e=t.__e;void 0!==e&&(t.__e=void 0,queueMicrotask((()=>{t.isConnected&&t.dispatchEvent(e)})))}(r),As(t,r)};Us(a,(t=>{t(l)}));var c=vo(a,2),d=t=>{!function(t,e){Ii(e,!0),Ys(t,Bc);const n={color:"#e3e3e3",fadeTime:300,lineWidth:8};function i(t){const{direction:n}=t.detail;var i;if("left"===n)null===(i=e.gallery)||void 0===i||i.next(),e.onEvent("swipe",[-1,0]);else if("right"===n){var r;null===(r=e.gallery)||void 0===r||r.prev(),e.onEvent("swipe",[1,0])}}var r=Lc();ma(r,(t=>({...t,class:"swiper"})),[()=>Rc(i,(()=>({touchAction:"pan-y",plugins:e.debug?[Dc(n)]:[]})))],void 0,void 0,"svelte-1fv6njc"),As(t,r),Ei()}(t,{get gallery(){return e.gallery},get debug(){return e.debug},get onEvent(){return e.onEvent}})};Us(c,(t=>{r()&&t(d)}));var f=vo(c,2),p=t=>{var e=Wc();!function(t,e,n){hi&&mi();var i=new $s(t);Mo((()=>{var t,r=null!==(t=e())&&void 0!==t?t:null;i.ensure(r,r&&(t=>n(t,r)))}),Gn)}(po(e),(()=>ps(i).Component),((t,e)=>{e(t,{get state(){return ps(i).state},get isMobile(){return r()}})})),vi(e),As(t,e)};Us(f,(t=>{var e;null!==(e=ps(i))&&void 0!==e&&e.Component&&t(p)})),vi(s),As(t,s)})),vi(i),ka(i,(t=>s=t),(()=>s)),xs("scroll",i,m),As(t,i)};Us(y,(t=>{ps(d)&&t(b)})),As(t,g),Ei()}const Vc="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{};let Hc;function Gc(){const t=Vc&&Vc.navigator&&(Vc.navigator.userAgent||Vc.navigator.platform||Vc.navigator.vendor)||"";if(Hc&&Hc.ua===t)return Hc;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 Hc={ua:t,isMobile:r},Hc}"undefined"!=typeof window&&window.addEventListener("pageshow",(function(t){t.persisted&&setTimeout((function(){window.location.reload()}),10)}),!1);var Kc=Es('<div class="paging-buttons svelte-1n46o8q"><!> <!></div>'),Xc=Es('<div style="position: absolute; top: 0; left: 0; width: 100%;"></div>'),Yc=Es("<!> <!>",1),Qc=Es('<div class="player-container svelte-1n46o8q"><div class="player-div swipable svelte-1n46o8q"></div> <!> <!> <!> <!></div> <!>',1),Jc=Es('<div class="eko-gallery-app svelte-1n46o8q"><!></div>');const Zc={hash:"svelte-1n46o8q",code:'.eko-gallery-app.svelte-1n46o8q {position:relative;width:100%;height:100%;display:flex;flex-direction:column;box-sizing:border-box;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;}.eko-gallery-app.svelte-1n46o8q:hover .paging-buttons:where(.svelte-1n46o8q) .nav-button {background-color:#FFFFFF;box-shadow:0 0 8px 0 rgba(0, 0, 0, 0.12);}.eko-gallery-app.svelte-1n46o8q * {box-sizing:border-box;touch-action:pan-y;font-family:"Human BBY Digital", sans-serif;}.player-container.svelte-1n46o8q {position:relative;flex:1;width:100%;pointer-events:none;overflow:hidden;display:flex;align-items:center;justify-content:center;}.player-div.svelte-1n46o8q {position:absolute;width:var(--videoWidth);height:var(--videoHeight);aspect-ratio:var(--videoAspect);}.swipable.svelte-1n46o8q {will-change:transform;transform:translate3d(var(--uiTranformX, 0), 0, 0);}.paging-buttons.svelte-1n46o8q {position:absolute;top:0;left:0;bottom:0;right:0;display:flex;justify-content:space-between;align-items:center;pointer-events:none;padding:0 12px;}.paging-buttons.svelte-1n46o8q .nav-button {transition:0.2s ease-in-out;box-shadow:none;}.paging-buttons.svelte-1n46o8q .nav-button img {opacity:0.6;}'};function tu(t,e){Ii(e,!0),Ys(t,Zc);const n=wa(e,"config",19,(()=>({}))),i=wa(e,"forceMobile",3,!1),r=wa(e,"videoAspectRatio",3,"unset"),o=wa(e,"onGalleryReady",3,(()=>{})),s=wa(e,"onEvent",3,(()=>{}));let a,l=!1,c=Qr(new ic(n())),u=Qr(null),d=Ur((()=>i()||Gc().isMobile)),h=Qr(0),f=Qr(void 0),p=Qr(!0),m=Qr(io({width:"100%",height:"100%"}));var v,g,y;function b(){const t={AssetsDeliveryService:{assetsDeliveryServiceUrl:ps(c).urls.assetsDeliveryBase}};Zr(u,new e.EkoPlayer(a,Object.assign(t,e.playerOptions))),ps(u).on("playing",(()=>{ps(c).state.paused=!1})),ps(u).on("pause",(()=>{ps(c).state.paused=!0})),ps(u).once("playing",(()=>{ps(c).state.startedPlaying=!0,s()("galleryloaded")}))}function k(t){var e;null===(e=ps(c))||void 0===e||e.selectItem(t)}function x(){var t;null===(t=ps(c))||void 0===t||t.next()}function w(){var t;null===(t=ps(c))||void 0===t||t.prev()}function _(){ps(u).paused?ps(u).play():ps(u).pause()}function T(){return`--uiTranformX: ${ps(h)}px;--videoAspect: ${r()};--videoWidth: ${ps(m).width};--videoHeight: ${ps(m).height};`}v="state",g=()=>ps(c).state,Si().set(v,g),y=()=>(o()(ps(c).public),n()&&e.EkoPlayer&&(b(),ps(c).start(ps(u))),()=>{var t;null===(t=ps(u))||void 0===t||t.dispose()}),null===wi&&ci(),Io((()=>{const t=gs(y);if("function"==typeof t)return t})),Io((()=>{n()&&e.EkoPlayer&&(l?gs((()=>{var t;Zr(c,new ic(n())),null===(t=ps(u))||void 0===t||t.dispose(),Zr(p,!1),fs().then((()=>(Zr(p,!0),fs()))).then((()=>{o()(ps(c).public),b(),ps(c).start(ps(u))}))})):l=!0)})),Io((()=>{ps(f)&&ps(u)&&ps(u).loadDebugOverlay({containerElement:ps(f)})})),Io((()=>{if("unset"!==r()&&r().includes("/")){const[t,e]=r().split("/").map((t=>Number(t)));isNaN(t)||isNaN(e)||Zr(m,t>e?{width:"100%",height:"auto"}:{width:"auto",height:"100%"},!0)}else Zr(m,{width:"100%",height:"100%"},!0)}));var I=Jc(),E=po(I),S=t=>{var n=Qc(),i=mo(n),r=po(i);ka(r,(t=>a=t),(()=>a));var o=vo(r,2);qc(o,{get isMobile(){return ps(d)},get gallery(){return ps(c)},get debug(){return e.debug},get onEvent(){return s()},get scrollOffset(){return ps(h)},set scrollOffset(t){Zr(h,t,!0)}});var l=vo(o,2),u=t=>{var e=Kc(),n=po(e);mc(n,{type:"prev",onClick:w}),mc(vo(n,2),{type:"next",onClick:x}),vi(e),As(t,e)};Us(l,(t=>{ps(d)||e.hideNav||t(u)}));var p=vo(l,2),m=t=>{bc(t,{})};Us(p,(t=>{var e;!ps(d)&&(null===(e=ps(c).state.currentItem)||void 0===e?void 0:e.modules.length)>1&&t(m)}));var v=vo(p,2),g=t=>{var n=Yc(),i=mo(n);!function(t,e){Ii(e,!0),Ys(t,Ic);const n=Ti("state");var i=Tc();i.__click=function(...t){var n;null===(n=e.onPauseClick)||void 0===n||n.apply(this,t)};var r=po(i),o=t=>{var e=wc();No((()=>pa(e,"src",kc))),As(t,e)},s=t=>{var e=_c();No((()=>pa(e,"src",xc))),As(t,e)};Us(r,(t=>{n().paused?t(o):t(s,!1)})),vi(i),No((t=>pa(i,"aria-label",t)),[()=>n().paused?"Play":"Pause"]),As(t,i),Ei()}(i,{onPauseClick:_});var r=vo(i,2),o=t=>{var e=Xc();ka(e,(t=>Zr(f,t)),(()=>ps(f))),As(t,e)};Us(r,(t=>{e.debug&&t(o)})),As(t,n)};Us(v,(t=>{ps(c).state.startedPlaying&&t(g)})),vi(i);var y=vo(i,2),b=t=>{!function(t,e){Ii(e,!0),Ys(t,dc);let n=wa(e,"onNavItemClick",3,(()=>{}));const i=Ti("state");var r=uc(),o=po(r);Hs(o,23,(()=>i().currentItemsList),(t=>t.id),((t,e,r)=>{var o=cc();let s;o.__click=()=>n()(ps(r));var a=po(o),l=po(a,!0);vi(a),vi(o),No((t=>{s=ia(o,1,"nav-button svelte-er27y2",null,s,t),Rs(l,ps(e).name)}),[()=>({selected:ps(r)===i().activeItemIndex})]),As(t,o)})),vi(o),vi(r),As(t,r),Ei()}(t,{onNavItemClick:k})};Us(y,(t=>{e.hideNav||t(b)})),No((t=>oa(i,t)),[T]),As(t,n)};Us(E,(t=>{n()&&ps(p)&&t(S)})),vi(I),As(t,I),Ei()}function eu(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var nu,iu,ru,ou,su={exports:{}},au=eu((nu||(nu=1,ru=su.exports,ou=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},(iu=su).exports?iu.exports=ou():ru.log=ou()),su.exports));const lu=()=>{},cu=["trace","log","debug","info","warn","error","getLevel","setLevel"],uu=["trace","debug","info","warn","error","silent"],du={TRACE:"color: white; background-color: magenta;",DEBUG:"color: black; background-color: turquoise;",INFO:"color: white; background-color: green;",WARN:"color: black; background-color: yellow;",ERROR:"color: white; background-color: red;"},hu="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global;let fu={level:"trace",appName:""},pu=[];const mu="object"==typeof hu&&hu.performance&&"function"==typeof hu.performance.now?hu.performance.now.bind(hu.performance):Date.now.bind(Date),vu=t=>t&&"string"==typeof t?t.toLowerCase().trim():"",gu=(()=>{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[vu(e)]=vu(i)||"trace"})),n}catch(t){return{}}})(),yu=(t,e="")=>{const n=vu(t),i=au.getLogger(n);if(i.__ekologger)return i.__ekologger;e||gu[n]||gu["*"]||(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)=>(mu()/1e3).toFixed(e))()}] %c[${s}] ${fu.appName?`[${fu.appName}] `:""}[${t}]`,du[s],...e)}},e=gu[n]||gu["*"]||e||fu.level,i.setLevel(e,!1);const o=(...t)=>i.log(...t);return cu.forEach((t=>{o[t]=(...e)=>(pu.forEach((n=>{n[t](...e)})),i[t](...e))})),i.__ekologger=o,o};yu.setDefaults=({appName:t="",level:e})=>{t&&"string"==typeof t&&(fu.appName=t),(e=vu(e))&&uu.includes(e)&&(fu.level=e,Object.values(au.getLoggers()).filter((t=>t.__noExplicitLevel)).forEach((t=>t.setLevel(fu.level,!1))))},yu.installDriver=t=>{const e={...cu.reduce(((e,n)=>(e[n]="function"==typeof(null==t?void 0:t[n])?t[n]:lu,e)),{})};pu.push(e)};let bu=class{#T=new Map;on(t,e){if("function"!=typeof e)return this;const n=this.#T.get(t)||new Set;return n.add(e),this.#T.set(t,n),this}once(t,e){if("function"!=typeof e)return this;const n=(...i)=>(this.off(t,n),e(...i));return this.on(t,n)}off(t,e){if(!t)return this.#T.clear(),this;const n=this.#T.get(t);return n?e?(n.delete(e),0===n.size&&this.#T.delete(t),this):(this.#T.delete(t),this):this}trigger(t,...e){const n=this.#T.get(t);return n?(n.forEach((t=>t(...e))),this):this}};function ku(t){return"[object Object]"===Object.prototype.toString.call(t)}function xu(t,...e){const n=ku(t)?{...t}:{};return e.forEach((t=>{ku(t)&&Object.keys(t).forEach((e=>{const i=t[e],r=n[e];ku(i)&&ku(r)?n[e]=xu(r,i):Array.isArray(i)?n[e]=i.slice():n[e]=i}))})),n}function wu(t){if("string"==typeof t)return`'${t}'`;if(Array.isArray(t))return`[${t.map((t=>wu(t))).join(", ")}]`;if(ku(t))try{return JSON.stringify(t)}catch(t){return"[object Object]"}return null===t?"null":void 0===t?"undefined":String(t)}function _u(t){return Array.from(t).map((t=>wu(t))).join(", ")}var Tu=new WeakSet;let Iu=class extends bu{constructor(...t){super(),O(this,Tu);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=yu(n,this.loglevel);const i=ku(this.defaults)?this.defaults:{},r=ku(e)&&ku(e[n])?e[n]:{};this.settings=xu({},i,r),A(Tu,this,Eu).call(this),A(Tu,this,Su).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 Eu(){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}(${_u(t)})`),a(...t)):a,t.add(o)}n=Object.getPrototypeOf(n)}}function Su(){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 Au="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}let Mu=class extends Iu{#I;#E;#S;get defaults(){return{style:{width:"100%",height:"100%"},contextAttributes:{alpha:!1,depth:!1,stencil:!1,antialias:!1,preserveDrawingBuffer:!1,powerPreference:"low-power"}}}constructor(...t){var e,n;super(...t);const[i]=t,r=function(t,e=(null==Au?void 0:Au.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.#I=r;const o=null==Au?void 0:Au.document;if(!o||"function"!=typeof o.createElement)throw new Error("Canvas requires document.createElement.");var s,a;this.#E=o.createElement("canvas"),s=this.#E,a=null===(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.#I.appendChild(this.#E);const l=null===(n=this.settings)||void 0===n?void 0:n.contextAttributes,c=l&&"object"==typeof l&&!Array.isArray(l)?l:void 0;if(this.#S=this.#E.getContext("webgl2",c),!this.#S)throw new Error("Canvas WebGL2 context is not available.")}get name(){return"Canvas"}get element(){return this.#E}get gl(){return this.#S}onDispose(){this.#E&&this.#E.parentNode&&this.#E.parentNode.removeChild(this.#E),this.#S=null,this.#E=null,this.#I=null}};var Fu=new WeakMap,Cu=new WeakMap,Ou=new WeakMap,Pu=new WeakMap,Ru=new WeakMap,Du=new WeakMap,Lu=new WeakSet;let Bu=class extends Iu{get name(){return"ContainerSize"}get containerWidth(){return M(Cu,this)}get containerHeight(){return M(Ou,this)}get width(){return M(Cu,this)}get height(){return M(Ou,this)}constructor(...t){super(...t),O(this,Lu),F(this,Fu,void 0),F(this,Cu,0),F(this,Ou,0),F(this,Pu,null),F(this,Ru,null),F(this,Du,null);const[e]=t;var n;C(Fu,this,(n=e)&&n.element&&Nu(n.element)?n.element:Nu(n)?n:null),M(Fu,this)&&(A(Lu,this,Wu).call(this,!0),A(Lu,this,zu).call(this))}onDispose(){M(Pu,this)&&"function"==typeof M(Pu,this).disconnect&&M(Pu,this).disconnect(),C(Pu,this,null),M(Du,this)&&"function"==typeof(null==Au?void 0:Au.removeEventListener)&&Au.removeEventListener("resize",M(Du,this)),C(Du,this,null),M(Ru,this)&&((null==Au?void 0:Au.clearInterval)||clearInterval)(M(Ru,this)),C(Ru,this,null),C(Fu,this,null)}};function zu(){if(!M(Fu,this))return;const t=null==Au?void 0:Au.ResizeObserver;if("function"==typeof t)return C(Pu,this,new t((()=>A(Lu,this,Wu).call(this)))),void M(Pu,this).observe(M(Fu,this));C(Du,this,(()=>A(Lu,this,Wu).call(this))),"function"==typeof(null==Au?void 0:Au.addEventListener)&&Au.addEventListener("resize",M(Du,this));const e=(null==Au?void 0:Au.setInterval)||setInterval;C(Ru,this,e((()=>A(Lu,this,Wu).call(this)),250))}function Wu(t=!1){if(!M(Fu,this))return;const{width:e,height:n}=function(t){const e=Number(null==t?void 0:t.clientWidth),n=Number(null==t?void 0:t.clientHeight);return{width:Number.isFinite(e)&&e>0?Math.round(e):0,height:Number.isFinite(n)&&n>0?Math.round(n):0}}(M(Fu,this));(t||e!==M(Cu,this)||n!==M(Ou,this))&&(C(Cu,this,e),C(Ou,this,n),this.trigger("containerresize",{width:e,height:n}))}var $u={VIDEO_SOURCE_PREFIX:"__SRC_VID:",TEXTURE_SOURCE_PREFIX:"__SRC_TEXTURE:",PREVIOUS_OUTPUT_PREFIX:"__PREVIOUS:",SAVED_FRAME_PREFIX:"__SAVED_FRAME:",SYSTEM_NODES:{FILTERS:{RENDER_TO_CANVAS:"__default"},TAGS:{ATOM:"atom",FILTER:"filter",COMPOSITE_FILTER:"composite",TRANSITION_FILTER:"transition"}},MESSAGES:{UPDATE_OPTIONS:"update_options"}};let Uu=class{constructor(t,e){this.canvasSource=t,this.startRendering=e,this.gl=null,this.glOptions=null}init(t,e,n){this.glOptions=n||{};const i=this.initCanvas(this.canvasSource,t,e);return this.initWebgl(i,this.glOptions)}initCanvas(){throw new Error("implement on concrete class")}getContextConfig(t={}){if(!t||"object"!=typeof t)return{contextType:"webgl",contextAttributes:void 0};const{contextType:e,contextAttributes:n,__shaderGraph:i,...r}=t;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 ju,qu={exports:{}},Vu=(ju||(ju=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}(qu)),qu.exports),Hu=eu(Vu);let Gu=class extends Uu{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 Hu;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)}},Ku=class extends Uu{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)}},Xu=class extends Uu{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 Yu=function(t){let e;return e="string"==typeof t?new Ku(t):t&&t.src&&t.dest?new Xu(t):new Gu(t),e};function Qu(t){return Array.isArray(t)||(t=[t]),t}let Ju=class{constructor(t){this.store=t?{...t.get()}:{}}reset(){this.store={}}get(t){if(!t)return this.store;const e=(t=Qu(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=Qu(t),e=Qu(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]}))}},Zu=class{constructor(t,e,n,i){this.gl=i.gl,this.unit=t,this.bindPoint=e,this.height=1080,this.width=1920,this.textureObject=n.object,this.textureObjectInfo=n,this.isStatic=!1,n.needRefresh&&this.setParameters()}getUnit(){return this.unit}getObject(){return this.textureObject}bind(){this.gl.bindTexture(this.bindPoint,this.textureObject)}fill(){throw new Error("impl in concrete class")}setParameters(){this.bind(),this.gl.texParameteri(this.bindPoint,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.bindPoint,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.bindPoint,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.bindPoint,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR)}active(){this.gl.activeTexture(this.gl.TEXTURE0+this.getUnit())}beforeUse(){this.active(),this.bind()}dispose(){this.gl.deleteTexture(this.textureObject)}setHeight(t){this.height=t}setWidth(t){this.width=t}getHeight(){if(!this.height)throw new Error(`texture ${this.unit} no height init `);return this.height}getWidth(){if(!this.width)throw new Error(`texture ${this.unit} no width init `);return this.width}};const td=yu("frame","warn");let ed=!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");ed=e||n}function nd(t,e){const n=t.gl;var i;n.texImage2D(t.bindPoint,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,e),t.__hasAllocated=!0,i=t,Number.isFinite(i.width)&&Number.isFinite(i.height)&&(i.actualWidth=i.width,i.actualHeight=i.height,i.textureObjectInfo&&(i.textureObjectInfo.allocatedWidth=i.width,i.textureObjectInfo.allocatedHeight=i.height))}let id=class extends Zu{fill(t){if(ed&&(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?nd(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,nd(t,e)):t.__useSubImage=!0))}(this,t,e);const i=(performance.now()-n)/1e3;i>=.1&&td.warn(`[fill] texImage2D() took ${i.toFixed(3)} seconds to execute.`),"function"==typeof t.close&&!0!==t.__keepOpen&&(t.close(),t.__closed=!0)}},rd=class extends Zu{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 od=function(t,e,n,i,r){let o;switch(t){case"frame":o=new id(e,n,i,r);break;case"pixel":o=new rd(e,n,i,r);break;default:throw new Error(`cant recognize type ${t}`)}return o};let sd=class{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=od(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 ad=$u.VIDEO_SOURCE_PREFIX,ld=$u.TEXTURE_SOURCE_PREFIX,cd=$u.PREVIOUS_OUTPUT_PREFIX,ud=$u.SAVED_FRAME_PREFIX;function dd(t,e,n){t.set(`${ad}${n}`,e)}function hd(t,e,n){t.set(`${cd}${n}`,e)}function fd(t,e,n){t.set(`${ud}${n}`,e)}let pd=class{constructor(t){return this.gl=t.gl,this.glSource=t.glSource,this.textureManager=t.textureManager,this.capturedFramesManager=t.capturedFramesManager,{setVideoSources:this.setVideoSources.bind(this),setTextureSource:this.setTextureSource.bind(this),getInput:this.getInput.bind(this),getPrevOutput:this.getPrevOutput.bind(this),setOutputs:this.setOutputs.bind(this),disposeTextures:this.disposeTextures.bind(this),disposeAllStore:this.disposeAllStore.bind(this)}}setVideoSources(t){for(const[e,n]of Object.entries(this.capturedFramesManager.getCurrentFrames()))dd(t,n,e),hd(t,n,e);for(const[e,n]of Object.entries(this.capturedFramesManager.getSavedFrames()))fd(t,n,e)}setTextureSource(t,e,n){t.set(`${ld}${n}`,e)}getInput(t,e){return t.get(e)}getPrevOutput(t,e){return e=Number.isInteger(e)?e:0,t.get(`${cd}${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)=>{hd(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))}))}},md=class{constructor(t){this.context=t}bind(){throw new Error("impl in concrete")}},vd=100,gd=100;function yd(t,e){vd=t,gd=e}let bd=class extends md{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),yd(i,r)),t}},kd=class extends md{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 xd{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===$u.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS?new bd({gl:this.gl}):new kd({gl:this.gl,textureManager:this.textureManager,frameBufferObject:this.getFrameBufferObject(),useCanvasSizedFilterTargets:this.useCanvasSizedFilterTargets}),e}}function wd(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 _d=function(t,e){return wd(t,t.VERTEX_SHADER,e)},Td=function(t,e){return wd(t,t.FRAGMENT_SHADER,e)};const Id={position_3d:0,texture_coordinate_2d:1};var Ed=function(t,e,n){const i=t.createProgram();if(t.attachShader(i,e),t.attachShader(i,n),Object.entries(Id).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)},Sd=[-1,-1,1,1,-1,1,-1,1,1,1,1,1],Ad=[0,1,2,2,1,3],Nd=[0,0,1,0,0,1,1,1];const Md=96,Fd=[new Float32Array(new ArrayBuffer(Md)),new Float32Array(new ArrayBuffer(Md)),new Float32Array(new ArrayBuffer(Md)),new Float32Array(new ArrayBuffer(Md)),new Float32Array(new ArrayBuffer(Md)),new Float32Array(new ArrayBuffer(Md))],Cd=[new Int16Array(6),new Int16Array(6),new Int16Array(6)];class Od{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=Fd[this.floatBufferCounter],this.floatBufferCounter=this.floatBufferCounter++%Fd.length;break;case this.gl.ELEMENT_ARRAY_BUFFER:t=Cd[this.unit16BufferCounter],this.unit16BufferCounter=this.unit16BufferCounter++%Cd.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 Pd={position_3d:class extends Od{getPointerData(){return{size:3,type:this.gl.FLOAT,normalize:!1,stride:0,offset:0}}},position_indexes:class extends Od{setPointer(){}getPointerData(){}enable(){}},texture_coordinate_2d:class extends Od{getPointerData(){return{size:2,type:this.gl.FLOAT,normalize:!0,stride:0,offset:0}}}};var Rd=function(t,e,n){const i=Pd[t];if(!i)throw new Error(`${t} is not a attribute name,choose from list: ${Object.keys(Pd)}`);return new i(t,e,n)};class Dd{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 Ld extends Dd{set(t){this.gl.uniform1fv(this.location,t)}}let Bd=class extends Dd{set(t){t&&(t.beforeUse(),this.gl.uniform1i(this.location,t.getUnit()))}};const zd="first_texture_dimensions",Wd="viewport_dimensions",$d="time",Ud={RUNTIME_OPTIONS:"runtimeOptions[0]",STATIC_OPTIONS:"staticOptions[0]",FIRST_TEXTURE:"first_texture",SECOND_TEXTURE:"second_texture",FIRST_MATRIX:"first_mat4"},jd={[Ud.FIRST_TEXTURE]:Bd,[Ud.SECOND_TEXTURE]:Bd,[Ud.FIRST_MATRIX]:class extends Dd{set(t){this.gl.uniformMatrix4fv(this.location,!1,t)}},[Ud.STATIC_OPTIONS]:Ld,[Ud.RUNTIME_OPTIONS]:Ld};var qd=function(t,e){const n=jd[t];if(!n)throw new Error(`${t} is not a attribute name,choose from list: ${Object.keys(jd)}`);return new n(t,e)},Vd=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 Hd="position_3d",Gd="position_indexes",Kd="texture_coordinate_2d";class Xd{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=_d(this.gl,e.vertex),this.fragmentShader=Td(this.gl,e.fragment),this.program=Ed(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:Hd,bindPoint:e.gl.ARRAY_BUFFER},{id:Gd,bindPoint:e.gl.ELEMENT_ARRAY_BUFFER},{id:Kd,bindPoint:e.gl.ARRAY_BUFFER}].concat(t)).forEach((t=>{const i=t.id;n[i]=Rd(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]=qd(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:Ud.RUNTIME_OPTIONS},{id:Ud.STATIC_OPTIONS}];return(t.getUniformList||Xd.getUniformList)().forEach((t=>{Object.values(Ud).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||Xd.getUniformList)().forEach((t=>{switch(t){case Ud.FIRST_TEXTURE:this.uniforms[Ud.FIRST_TEXTURE].set(r[0]);break;case Ud.SECOND_TEXTURE:this.uniforms[Ud.SECOND_TEXTURE].set(r[1]);break;case zd:o=[...o,r[0].getWidth(),r[0].getHeight()];break;case Wd:o=[...o,i.width,i.height];break;case $d:{const t=Vd(e.startTime,e.duration);o=[...o,t];break}}})),o.length>0&&this.uniforms[Ud.RUNTIME_OPTIONS].set(o)}static getUniformList(){return[Ud.FIRST_TEXTURE]}getOptionsDisplay(){return[]}handleStaticUniforms(){}handleAttributes(){this.attributes[Hd].fillBuffer(Sd),this.attributes[Hd].setPointer(),this.attributes[Gd].fillBuffer(Ad),this.attributes[Kd].fillBuffer(Nd),this.attributes[Kd].setPointer()}disposeAttributes(){Object.values(this.attributes).forEach((t=>{t.dispose()}))}render(t,e){const n=this.frameBuffer.bind(t);let i={width:vd,height:gd};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 Yd extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(Yd)};super(Yd.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 Qd,Jd="undefined"!=typeof Float32Array?Float32Array:Array;function Zd(){var t=new Jd(3);return Jd!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function th(t,e,n){var i=new Jd(3);return i[0]=t,i[1]=e,i[2]=n,i}function eh(){var t=new Jd(4);return Jd!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}Zd(),function(){var t;t=new Jd(4),Jd!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0)}(),Zd(),th(1,0,0),th(0,1,0),eh(),eh(),Qd=new Jd(9),Jd!=Float32Array&&(Qd[1]=0,Qd[2]=0,Qd[3]=0,Qd[5]=0,Qd[6]=0,Qd[7]=0),Qd[0]=1,Qd[4]=1,Qd[8]=1;class nh extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(nh)};super(nh.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:nh.getInitialOptions().translate.x},{properties:["translate","y"],type:"slider",minValue:-2,maxValue:2,step:.001,initialValue:nh.getInitialOptions().translate.y},{properties:["scale","x"],type:"slider",minValue:-10,maxValue:10,step:.001,initialValue:nh.getInitialOptions().scale.x},{properties:["scale","y"],type:"slider",minValue:-10,maxValue:10,step:.001,initialValue:nh.getInitialOptions().scale.y},{properties:["rotate"],type:"slider",minValue:-360,maxValue:360,step:1,initialValue:nh.getInitialOptions().rotate}]}static getUniformList(){return[Ud.FIRST_TEXTURE,Ud.FIRST_MATRIX]}handleStaticUniforms(t){if(!t||!t.translate||!t.scale)throw new Error(`bad options object for Transform filter, check ${t}`);const e=Number.parseFloat(t.translate.x).toFixed(7),n=-1*Number.parseFloat(t.translate.y).toFixed(7),i=Number.parseFloat(t.scale.x).toFixed(7),r=Number.parseFloat(t.scale.y).toFixed(7),o=t.rotate||0;var s;this.transformMatrix=function(t,e,n,i){var r=e[0],o=e[1],s=e[2],a=e[3],l=r+r,c=o+o,u=s+s,d=r*l,h=r*c,f=r*u,p=o*c,m=o*u,v=s*u,g=a*l,y=a*c,b=a*u,k=i[0],x=i[1],w=i[2];return t[0]=(1-(p+v))*k,t[1]=(h+b)*k,t[2]=(f-y)*k,t[3]=0,t[4]=(h-b)*x,t[5]=(1-(d+v))*x,t[6]=(m+g)*x,t[7]=0,t[8]=(f+y)*w,t[9]=(m-g)*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 Jd(16),Jd!=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}(eh(),0,0,o),th(e,n,0),th(i,r,1)),this.uniforms[Ud.FIRST_MATRIX].set(this.transformMatrix)}}class ih extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(ih)};super(ih.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[Ud.FIRST_TEXTURE,zd]}}class rh extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(rh)};super(rh.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float runtimeOptions[2];\n\nvarying vec2 blur_texture_coordinate_2d[11];\n\n\nvoid main() {\n vec2 normalize_poistion = vec2(position_3d.xy);\n gl_Position = vec4(normalize_poistion, 1, 1);\n\n float texture_width = runtimeOptions[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[Ud.FIRST_TEXTURE,zd]}}class oh extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(oh)};super(oh.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[Ud.FIRST_TEXTURE,zd,Wd]}handleStaticUniforms(t){var e;const n=(null!==(e=Number.parseFloat(t.offsetDist))&&void 0!==e?e:4).toFixed(3);this.uniforms[Ud.STATIC_OPTIONS].set([n])}}class sh extends Xd{constructor(t){const e={uniforms:Xd.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[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[Ud.FIRST_TEXTURE,zd,Wd]}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[Ud.STATIC_OPTIONS].set([i,r])}}class ah extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(ah)};super(ah.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[Ud.STATIC_OPTIONS].set([e])}}class lh extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(lh)};super(lh.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\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[Ud.FIRST_TEXTURE,zd,Ud.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[Ud.STATIC_OPTIONS].set([e,n,i,r,o,s,a])}}class ch extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(ch)};super(ch.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[Ud.FIRST_TEXTURE,Ud.SECOND_TEXTURE]}}class uh extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(uh)};super(uh.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[Ud.FIRST_TEXTURE,Ud.SECOND_TEXTURE]}getOptionsDisplay(){return[]}handleStaticUniforms(t){const e=Number.parseFloat(t.lutSize).toFixed(1);this.uniforms[Ud.STATIC_OPTIONS].set([e])}}var dh="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",hh='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:fh,cos:ph,sin:mh,acos:vh,atan2:gh,sqrt:yh,pow:bh}=Math;function kh(t){return t<0?-bh(-t,1/3):bh(t,1/3)}const xh=Math.PI,wh=2*xh,_h=xh/2,Th=Number.MAX_SAFE_INTEGER||9007199254740991,Ih=Number.MIN_SAFE_INTEGER||-9007199254740991,Eh={x:0,y:0,z:0},Sh={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),yh(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],Eh],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||Sh.approximately(t,e)||Sh.approximately(t,n)},approximately:function(t,e,n){return fh(t-e)<=(n||1e-6)},length:function(t){const e=Sh.Tvalues.length;let n=0;for(let i,r=0;r<e;r++)i=.5*Sh.Tvalues[r]+.5,n+=Sh.Cvalues[r]*Sh.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(Sh.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 gh(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 yh(n*n+i*i)},closest:function(t,e){let n,i,r=bh(2,63);return t.forEach((function(t,o){i=Sh.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=bh(t,e)+bh(1-t,e);return fh((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=bh(1-t,e);return n/(bh(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 Sh.lli8(r,o,s,a,l,c,u,d)},lli:function(t,e){return Sh.lli4(t,t.c,e,e.c)},makeline:function(t,e){return new Lh(t.x,t.y,(t.x+e.x)/2,(t.y+e.y)/2,e.x,e.y)},findbbox:function(t){let e=Th,n=Th,i=Ih,r=Ih;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(!Sh.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=Sh.makeline(e.points[i-1],t.points[0]),s=Sh.makeline(t.points[r-1],e.points[0]),a={startcap:o,forward:t,back:e,endcap:s,bbox:Sh.findbbox([o,t,e,s]),intersections:function(t){return Sh.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=Th,s=Ih;-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=-gh(e.p2.y-i,e.p2.x-n);return t.map((function(t){return{x:(t.x-n)*ph(r)-(t.y-i)*mh(r),y:(t.x-n)*mh(r)+(t.y-i)*ph(r)}}))},roots:function(t,e){e=e||{p1:{x:0,y:0},p2:{x:1,y:0}};const n=t.length-1,i=Sh.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=-yh(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(Sh.approximately(l,0)){if(Sh.approximately(c,0))return Sh.approximately(u,0)?[]:[-d/u].filter(r);const t=yh(u*u-4*c*d),e=2*c;return[(t-u)/e,(-u-t)/e].filter(r)}c/=l,u/=l,d/=l;const h=(3*u-c*c)/3,f=h/3,p=(2*c*c*c-9*c*u+27*d)/27,m=p/2,v=m*m+f*f*f;let g,y,b,k,x;if(v<0){const t=-h/3,e=yh(t*t*t),n=-p/(2*e),i=vh(n<-1?-1:n>1?1:n),o=2*kh(e);return b=o*ph(i/3)-c/3,k=o*ph((i+wh)/3)-c/3,x=o*ph((i+2*wh)/3)-c/3,[b,k,x].filter(r)}if(0===v)return g=m<0?kh(-m):-kh(m),b=2*g-c/3,k=-g-c/3,[b,k].filter(r);{const t=yh(v);return g=kh(-m+t),y=kh(m+t),[g-y-c/3].filter(r)}},droots:function(t){if(3===t.length){const e=t[0],n=t[1],i=t[2],r=e-2*n+i;if(0!==r){const t=-yh(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=Sh.compute(t,e),h=Sh.compute(t,n),f=d.x*d.x+d.y*d.y;if(i?(o=yh(bh(d.y*h.z-h.y*d.z,2)+bh(d.z*h.x-h.z*d.x,2)+bh(d.x*h.y-h.x*d.y,2)),s=bh(f+d.z*d.z,1.5)):(o=d.x*h.y-d.y*h.x,s=bh(f,1.5)),0===o||0===s)return{k:0,r:0};if(c=o/s,u=s/o,!r){const r=Sh.curvature(t-.001,e,n,i,!0).k,o=Sh.curvature(t+.001,e,n,i,!0).k;l=(o-c+(c-r))/2,a=(fh(o-c)+fh(c-r))/2}return{k:c,r:u,dk:l,adk:a}},inflections:function(t){if(t.length<4)return[];const e=Sh.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(Sh.approximately(o,0)){if(!Sh.approximately(s,0)){let t=-a/s;if(0<=t&&t<=1)return[t]}return[]}const l=2*o;if(Sh.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,fh(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 Sh.bboxoverlap(t.left.bbox(),t.right.bbox())}));let u=[];return 0===c.length||(c.forEach((function(t){u=u.concat(Sh.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*ph(_h)-r*mh(_h),l=i*mh(_h)+r*ph(_h),c=o*ph(_h)-s*mh(_h),u=o*mh(_h)+s*ph(_h),d=(t.x+e.x)/2,h=(t.y+e.y)/2,f=(e.x+n.x)/2,p=(e.y+n.y)/2,m=d+a,v=h+l,g=f+c,y=p+u,b=Sh.lli8(d,h,m,v,f,p,g,y),k=Sh.dist(b,t);let x,w=gh(t.y-b.y,t.x-b.x),_=gh(e.y-b.y,e.x-b.x),T=gh(n.y-b.y,n.x-b.x);return w<T?((w>_||_>T)&&(w+=wh),w>T&&(x=T,T=w,w=x)):T<_&&_<w?(x=T,T=w,w=x):T+=wh,b.s=w,b.e=T,b.r=k,b},numberSort:function(t,e){return t-e}};class Ah{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 Sh.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++)Sh.expandbox(e,t[n].bbox());return e}offset(t){const e=[];return this.curves.forEach((function(n){e.push(...n.offset(t))})),new Ah(e)}}const{abs:Nh,min:Mh,max:Fh,cos:Ch,sin:Oh,acos:Ph,sqrt:Rh}=Math,Dh=Math.PI;let Lh=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=Sh.align(s,{p1:s[0],p2:s[l]}),d=Sh.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=Sh.dist(n,s.C));const a=o*(1-r)/r,l=Sh.dist(t,i),c=(i.x-t.x)/l,u=(i.y-t.y)/l,d=o*c,h=o*u,f=a*c,p=a*u,m=n.x-d,v=n.y-h,g=n.x+f,y=n.y+p,b=s.A,k=b.x+(m-b.x)/(1-r),x=b.y+(v-b.y)/(1-r),w=b.x+(g-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 Sh}getUtils(){return e.getUtils()}static get PolyBezier(){return Ah}valueOf(){return this.toString()}toString(){return Sh.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=Sh.derive(this.points,this._3d),this.computedirection()}computedirection(){const t=this.points,e=Sh.angle(t[0],t[this.order],t[1]);this.clockwise=e>0}length(){return Sh.length(this.derivative.bind(this))}static getABC(t=2,e,n,i,r=.5){const o=Sh.projectionratio(r,t),s=1-o,a={x:o*e.x+s*i.x,y:o*e.y+s*i.y},l=Sh.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],Sh.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=Sh.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=Sh.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?Sh.computeWithRatios(t,this.points,this.ratios,this._3d):Sh.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 Sh.compute(t,this.dpoints[0],this._3d)}dderivative(t){return Sh.compute(t,this.dpoints[1],this._3d)}align(){let t=this.points;return new e(Sh.align(t,{p1:t[0],p2:t[t.length-1]}))}curvature(t){return Sh.curvature(t,this.dpoints[0],this.dpoints[1],this._3d)}inflections(){return Sh.inflections(this.points)}normal(t){return this._3d?this.__normal3(t):this.__normal2(t)}__normal2(t){const e=this.derivative(t),n=Rh(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=Rh(e.x*e.x+e.y*e.y+e.z*e.z),r=Rh(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=Rh(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=Sh.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=Sh.map(0,0,1,this._t1,this._t2),r.left._t2=Sh.map(t,0,1,this._t1,this._t2),r.right._t1=Sh.map(t,0,1,this._t1,this._t2),r.right._t2=Sh.map(1,0,1,this._t1,this._t2),n?(n=Sh.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]=Sh.droots(r),3===this.order&&(r=this.dpoints[1].map(i),t[n]=t[n].concat(Sh.droots(r))),t[n]=t[n].filter((function(t){return t>=0&&t<=1})),e=e.concat(t[n].sort(Sh.numberSort))}.bind(this)),t.values=e.sort(Sh.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]=Sh.getminmax(this,n,t[n])}.bind(this)),e}overlaps(t){const e=this.bbox(),n=t.bbox();return Sh.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=Sh.angle(this.points[0],this.points[3],this.points[1]),e=Sh.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(Ph(n))<Dh/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=Sh.map(n,0,1,t._t1,t._t2),e._t2=Sh.map(i,0,1,t._t1,t._t2),s.push(e),n=i;break}n<1&&(e=t.split(n,1),e._t1=Sh.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=Sh.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]=Sh.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=Rh(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]=Sh.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=Sh.makeline(h[2],d[0]),p=Sh.makeline(d[2],h[0]),m=[f,new e(d),p,new e(h)];return new Ah(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 Sh.map(o,0,1,t+s*l,t+a*l)}}o.forEach((function(e){const o=e.length();h?(a.push(e.scale(f(t,i,d,u,o))),c.push(e.scale(f(-n,-r,d,u,o)))):(a.push(e.scale(t)),c.push(e.scale(-n))),u+=o})),c=c.map((function(t){return l=t.points,l[3]?t.points=[l[3],l[2],l[1],l[0]]:t.points=[l[2],l[1],l[0]],t})).reverse();const p=a[0].points[0],m=a[s-1].points[a[s-1].points.length-1],v=c[s-1].points[c[s-1].points.length-1],g=c[0].points[0],y=Sh.makeline(v,p),b=Sh.makeline(m,g),k=[y].concat(a).concat([b]).concat(c);return new Ah(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=Sh.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=Mh(t.p1.x,t.p2.x),n=Mh(t.p1.y,t.p2.y),i=Fh(t.p1.x,t.p2.x),r=Fh(t.p1.y,t.p2.y);return Sh.roots(this.points,t).filter((t=>{var o=this.get(t);return Sh.between(o.x,e,i)&&Sh.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=Sh.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=Sh.dist(t,e),l=Sh.dist(t,o),c=Sh.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=Sh.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*Ch(a.e),y:a.y+a.r*Oh(a.e)};a.e+=Sh.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 Bh={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 Lh({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 Lh(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 Lh(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 zh{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{Wh(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 Wh(t,e,n){let i=t[e];t[e]=t[n],t[n]=i}function $h(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 Uh={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 zh(n,i);let o=[];for(let n=0;n<e;n++)o.push($h(n/(e-1),r,t));return o}};function jh(t,e=256,n={}){return"bezier"===n.type?Bh.pointsToCurve(t,e,n):Uh.pointsToCurve(t,e)}const qh=[];for(let t=0;t<256;t++)qh[t]=t;class Vh extends Xd{constructor(t){const e={vertex:dh,fragment:hh},n={uniforms:Xd.getUniformInfo(Vh)};super(Vh.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,jh(n,256).map((t=>255*t))):qh],this.uniforms[Ud.STATIC_OPTIONS].set(e)}}function Hh(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 Gh extends Xd{constructor(t){const e={vertex:dh,fragment:hh},n={uniforms:Xd.getUniformInfo(Gh)};super(Gh.getFilterType(),e,n,t)}static getFilterType(){return"levels"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=[...Hh(t.black,t.white,t.gamma)];this.uniforms[Ud.STATIC_OPTIONS].set(e)}}const Kh=360,Xh=[];for(let t=0;t<Kh;t++)Xh[t]=t;class Yh extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(Yh)};super(Yh.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 jh(t,Kh,{type:"bezier"}).map((t=>{return e=t,((Math.round(e.x*Kh)+180)%Kh+(1-e.y-.5)*Kh+Kh)%Kh;var e}))}(t.points)||Xh;this.uniforms[Ud.STATIC_OPTIONS].set(e)}}class Qh extends Xd{constructor(t){const e={uniforms:Xd.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}\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[Ud.STATIC_OPTIONS].set([e,n])}}class Jh extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(Jh)};super(Jh.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\n",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\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[Ud.STATIC_OPTIONS].set([e,n,i,r])}}class Zh extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(Zh)};super(Zh.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\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[Ud.STATIC_OPTIONS].set([e])}}class tf extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(tf)};super(tf.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nuniform float staticOptions[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[Ud.FIRST_TEXTURE,zd,Wd]}handleStaticUniforms(t){let e={...tf.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[Ud.STATIC_OPTIONS].set([n,i,r,o,s,a,l,c,h,f,d,u])}}class ef extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(ef)};super(ef.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nuniform float staticOptions[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[Ud.STATIC_OPTIONS].set([n,i,r,o])}}class nf extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(nf)};super(nf.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 rf extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(rf)};super(rf.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[Ud.STATIC_OPTIONS].set([e,n])}}class of extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(of)};super(of.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n} ",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\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[Ud.STATIC_OPTIONS].set([e])}}var sf,af,lf,cf,uf,df,hf,ff;function pf(){if(cf)return lf;cf=1;const t=af?sf:(af=1,sf={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"]}};lf=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]},lf}function mf(){if(df)return uf;df=1;const t=pf();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 uf=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 vf=function(){if(ff)return hf;ff=1;const t=pf(),e=mf(),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)}))})),hf=n}(),gf=eu(vf);class yf extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(yf)};super(yf.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform float staticOptions[3];\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 blend = texture2D(first_texture, current_texture_coordinate_2d);\n \n vec3 blendRGB = blend.rgb;\n vec3 baseRGB = vec3(staticOptions[0], staticOptions[1], staticOptions[2]);\n \n vec3 limit = step(0.5, blendRGB);\n vec3 mixedRGB = mix(2.0 * baseRGB * blendRGB, 1.0 - 2.0 * (1.0 - baseRGB) * (1.0 - blendRGB), limit);\n \n gl_FragColor = vec4((mixedRGB * blend.a) + ((1.0 - blend.a) * baseRGB), 1);\n}"},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=gf.hex.rgb(t.color).map((t=>t/255));this.uniforms[Ud.STATIC_OPTIONS].set([e[0],e[1],e[2]])}}class bf extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(bf)};super(bf.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[Ud.STATIC_OPTIONS].set([e.from,e.to,...e.ease])}static getUniformList(){return[Ud.FIRST_TEXTURE,$d]}}class kf extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(kf)};super(kf.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[Ud.STATIC_OPTIONS].set([e.from,e.to,...e.ease])}static getUniformList(){return[Ud.FIRST_TEXTURE,$d]}}class xf extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(xf)};super(xf.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[Ud.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[Ud.FIRST_TEXTURE,$d]}}class wf extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(wf)};super(wf.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[Ud.STATIC_OPTIONS].set([e.from,e.to,...e.ease,n.x,n.y])}static getUniformList(){return[Ud.FIRST_TEXTURE,$d,zd]}}class _f extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(_f)};super(_f.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=gf.hex.rgb(n).map((t=>t/255));this.uniforms[Ud.STATIC_OPTIONS].set([e.from,e.to,...e.ease,i[0],i[1],i[2]])}static getUniformList(){return[Ud.FIRST_TEXTURE,$d]}}var Tf=Object.freeze({__proto__:null,Crop:tf,Curves:Vh,Default:Yd,DipToBlackTransition:kf,DirectionalBlur:sh,Exposure:of,ExposureTransition:bf,FadeToColorTransition:_f,FastBlur:oh,HardLight:yf,HorizontalBlur:ih,Hue:Yh,Lab:rf,Levels:Gh,Lut:uh,MotionBlurTransition:wf,Opacity:ah,Saturation:Zh,ShapeComposite:ch,ShapeCompositeMask:lh,Solid:ef,SolidImage:nf,Transform:nh,TransformTransition:xf,VerticalBlur:rh,Vibrance:Jh,WhiteBalance:Qh});const If=Object.values(Tf).reduce(((t,e)=>(t[e.getFilterType()]=e,t)),{});class Ef{constructor(t){this.context=t}static getFilterClass(t){return If[t]}getFilterIds(){return Object.keys(this.filterTypeToInstanceMap)}create(t,e){this.context={...this.context,options:e.options};const n=new If[t](this.context);if(!n)throw new Error(`${t} is not a atom filter, atomFilter list: `,this.getFilterIds());return n}}const Sf=$u.PREVIOUS_OUTPUT_PREFIX,Af=Object.values(Tf).reduce(((t,e)=>(t[e.getFilterType()]={type:e.getFilterType(),options:e.getInitialOptions(),inputs:[...Array(e.getInputsCount())].map(((t,e)=>`${Sf}${e}`)),outputs:[]},t)),{});var Nf,Mf,Ff=function(){if(Mf)return Nf;Mf=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)}),{})},Nf=s}(),Cf=eu(Ff),Of=function(t,e){return Cf(t,e,{arrayMerge:(t,e)=>e})};const Pf=$u.MESSAGES.UPDATE_OPTIONS;let Rf=class{constructor(t,e){this.eventEmitter=new Hu,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(Pf,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 Df extends Rf{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=Of(this.options,t),this.filter.updateStaticUniforms(this.options)}dispose(){this.filter.dispose()}}const Lf=$u.MESSAGES.UPDATE_OPTIONS;let Bf=class extends Df{constructor(t,e,n){super(...arguments),this.baseNode=n.baseNode,this.registerListeners()}baseNodeUpdateOptions(t){this.options=Of(this.options,t),this.filter.updateStaticUniforms(this.options)}registerListeners(){this.baseNode.getEventEmitter().on(Lf,this.baseNodeUpdateOptions,this)}dispose(){this.filter.dispose(),this.baseNode.getEventEmitter().off(Lf,this.baseNodeUpdateOptions,this)}};function zf(t){return null!==t&&"object"==typeof t}function Wf(t){if(!zf(t)||(e=t,Array.isArray(e)))return t;var e;const n=Object.keys(t).sort(),i={};return n.forEach((e=>{i[e]=Wf(t[e])})),i}function $f(t,e){return null!=t&&t.id&&null!=e&&e.id?t.type===e.type&&t.id===e.id:t.type===e.type}function Uf(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)),zf(i=n)&&zf(r)?JSON.stringify(Wf(i))===JSON.stringify(Wf(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]&&$f(a,c[l])?l:c.findIndex((t=>$f(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 jf(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=ep.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 qf=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 jf(Uf(r,o),r,n,i)};class Vf extends Rf{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=>ep.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 Ju(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=qf(t,this.options,this.nodes,this.context),this.options=t}dispose(){this.nodes.forEach((t=>{t.dispose()}))}}const Hf=$u.MESSAGES.UPDATE_OPTIONS;class Gf extends Vf{constructor(t,e,n){super(...arguments),this.baseNode=n.baseNode,this.registerListeners()}registerListeners(){this.baseNode.getEventEmitter().on(Hf,this.updateOptions,this)}dispose(){this.nodes.forEach((t=>{t.dispose()})),this.baseNode.getEventEmitter().off(Hf,this.updateOptions,this)}}const Kf=$u.SYSTEM_NODES.TAGS.ATOM,Xf=$u.SYSTEM_NODES.TAGS.FILTER,Yf=$u.SYSTEM_NODES.TAGS.COMPOSITE_FILTER,Qf=$u.SYSTEM_NODES.TAGS.TRANSITION_FILTER,Jf=$u.PREVIOUS_OUTPUT_PREFIX,Zf=Object.keys(Af);function tp(t,e){const n=(i=t.type,Af[i]);var i;return t=Of(n,t),new Df(t.type,t,e)}var ep={create:function(t,e){let n;switch(function(t){let e;return n=t,e=Zf.includes(n)?Kf:t===Yf?Yf:t===Qf?Qf:Xf,e;var n}((t=JSON.parse(JSON.stringify(t))).type)){case Kf:n=tp(t,e);break;case Xf: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=Of(r,t),e={...e,baseNode:n},o=i===Yf?new Gf(i,t,e):new Bf(i,t,e),o}(t,e);break;case Yf:n=function(t,e){const n=t.type;return t=Of({inputs:[`${Jf}0`]},t),new Vf(n,t,e)}(t,e);break;case Qf: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`,tp(t,e)}(t,e);break;default:throw new Error("cant create node",t.type)}return n}};const np=$u.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS;var ip=function(t){const e={[np]:Af[np]};for(const[n,i]of Object.entries(e)){const e=ep.create(i,t);t.nodeStore.set(n,e)}},rp=function(t,e){for(const[n,i]of Object.entries(t)){const t=ep.create(i,e);e.nodeStore.set(n,t)}};const op=$u.CAPTURED_FRAME_PREFIX;class sp{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=`${op}${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 ap=yu("ShaderGraphApplication","warn"),lp=$u.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS,cp=Object.freeze({useCanvasSizedFilterTargets:!1,rebindAttributesOnProgramSwitch:!0,forwardContextAttributes:!0});function up(t={}){const e=null==t?void 0:t.performanceToggles;return e&&"object"==typeof e?{...cp,...e}:{...cp}}class dp{constructor(t,e={}){return this.glSource=t,this.config=e,this.performanceToggles=up(e),this.isContextLost=!1,this.isRecovering=!1,this.isDisposed=!1,this.pendingNodeOptionUpdates=new Map,this.doInit(t,e)}doInit(t,e){this.source=Yu(t),this.performanceToggles=up(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=cp){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 sd({gl:this.gl,activeTextures:this.activeTextures}),this.capturedFramesManager=new sp({textureManager:this.textureManager}),this.graphIOManager=new pd({glSource:t,gl:this.gl,textureManager:this.textureManager,capturedFramesManager:this.capturedFramesManager}),this.frameBufferFactory=new xd({gl:this.gl,textureManager:this.textureManager,useCanvasSizedFilterTargets:this.performanceToggles.useCanvasSizedFilterTargets}),this.filterFactory=new Ef({gl:this.gl,frameBufferFactory:this.frameBufferFactory,rebindAttributesOnProgramSwitch:this.performanceToggles.rebindAttributesOnProgramSwitch}),this.nodeStore=new Ju,this.ioStore=new Ju,ip({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 ap.debug("[getNodes]"),this.nodeStore.get()}addClientNodes(t,e=!1){if(ap.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));rp(n,{nodeStore:this.nodeStore,filterFactory:this.filterFactory})}addTexture(t,e,n){if(ap.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){ap.debug("[releaseTexture]",t),this.isContextUnavailable()||this.textureManager.releaseTexture(t)}selectNode(t){if(ap.debug("[selectNode]",t),!this.isContextUnavailable())return this.nodeStore.get(t)||ap.warn("Missing render node",t),void(this.selectedRenderNodeId=t);this.selectedRenderNodeId=t}captureTexture(){return ap.debug("[captureTexture]"),this.isContextUnavailable()?null:this.capturedFramesManager.createCaptureId()}disposeTexture(t){return ap.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){ap.error("Failed to apply pending node options",e,t),this.queueNodeOptionUpdate(e,n)}return}this.updateOptions(e,n)}catch(t){ap.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;yd(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&&(yd(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):(ap.warn("Missing selected render node",this.selectedRenderNodeId),this.selectedRenderNodeId=null)}renderToCanvas(t){const e=this.nodeStore.get(lp);e&&"function"==typeof e.render?e.render(t):ap.warn("Missing render-to-canvas node")}updateOptions(t,e){if(ap.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){ap.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(){ap.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),ap.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=>{ap.debug("Re-adding client nodes",t),this.addClientNodes(t,!0)})),Object.entries(e).forEach((([t,e])=>{ap.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&&(ap.debug("Recovering glSource (i.e. seeking/resetting player)"),await this.source.recover()),this.isContextLost=!1,this.isRecovering=!1,o&&this.render()}catch(t){ap.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 hp{constructor(t={}){this.options=t}get type(){return"stage"}getSignature(){return this.type}build({inputs:t=[]}={}){return{graph:[],outputs:t,signature:this.getSignature()}}}function fp(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 pp extends hp{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:fp(a)}),o.push(l)}return{graph:r,outputs:o,signature:this.getSignature()}}}class mp{#A=new Map;constructor(){this.register("retarget",pp)}register(t,e){t&&"function"==typeof e&&this.#A.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.#A.get(e);return n?new n((null==t?void 0:t.options)||{}):null}}class vp{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 gp extends vp{#N=null;#M=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=gp.buildLayoutGraph({inputs:t}),r=e.signature;this.#N!==r&&(i.updateOptions(o,{graph:e.graph}),this.#N=r),this.#M!==o&&(i.selectNode(o),this.#M=o),i.render({noRaf:!0})}catch(t){}}}var yp=new WeakMap,bp=new WeakMap,kp=new WeakSet;class xp extends vp{constructor(...t){super(...t),O(this,kp),F(this,yp,null),F(this,bp,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:xp.type,signature:`${xp.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{A(kp,this,wp).call(this,i,t)}catch(t){}return}try{A(kp,this,_p).call(this,i,o,n)}catch(t){}}}}function wp(t,e){if(!e)return;const n=oe.buildLayoutGraph({inputs:["__SRC_TEXTURE:0"]}),i=n.signature;M(yp,this)!==i&&(t.updateOptions(e,{graph:n.graph}),C(yp,this,i)),M(bp,this)!==e&&(t.selectNode(e),C(bp,this,e)),t.render({noRaf:!0})}function _p(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=oe.buildLayoutGraph({inputs:r}),s=o.signature;M(yp,this)!==s&&(t.updateOptions(e,{graph:o.graph}),C(yp,this,s)),M(bp,this)!==e&&(t.selectNode(e),C(bp,this,e)),t.render({noRaf:!0})}function Tp(t){const e=Number(t);return Number.isFinite(e)?e<=0?0:e>=1?1:e:0}oe=xp;class Ip extends vp{#N=null;#M=null;#F=null;static get type(){return"cross-fade"}static get aliases(){return["CrossFadeRenderNode","cross-fade","crossfade"]}static get requiresFrameCadence(){return!0}static get panAndScanTarget(){return"pre"}static buildLayoutGraph({inputs:t=[],normalizedTime:e}={}){if(t.length<2)return super.buildDefaultLayoutGraph(t);const n=Tp(e),i=[{type:"opacity",inputs:[t[1]],options:{power:n}},{type:"shapeComposite",inputs:["__PREVIOUS:0",t[0]],options:{}}];return{type:Ip.type,signature:`${Ip.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=Tp((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.#N!==e){const n=Ip.buildLayoutGraph({inputs:["__SRC_TEXTURE:0"]});i.updateOptions(t,{graph:n.graph}),this.#N=e}this.#M!==t&&(i.selectNode(t),this.#M=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=Ip.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.#N===r&&this.#F===a||(i.updateOptions(o,{graph:n.graph}),this.#N=r,this.#F=a),this.#M!==o&&(i.selectNode(o),this.#M=o),i.render({noRaf:!0})}catch(t){}}}function Ep(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 Sp(t){return!(!t||!0===t.offsetPending)&&Number.isFinite(t.offset)}function Ap(t){return Sp(t)?t.offset:void 0}function Np(t,e,n,i={}){if(!t)return!1;const r=Ap(t);if(!Number.isFinite(r))return!1;const o=Ep(t,n,i);return Number.isFinite(o)?e>=r&&e<r+o:e>=r}function Mp(t=[]){if(!Array.isArray(t))return t;const e=[],n=[];return t.forEach((t=>{Sp(t)?e.push(t):n.push(t)})),e.sort(((t,e)=>t.offset-e.offset)),t.splice(0,t.length,...e,...n),t}function Fp(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=Ap(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&&Mp(t),{updated:a,resolvedPlacements:l}}function Cp(t){const e=Number(t);return Number.isFinite(e)?e:0}function Op(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 Pp(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 Rp(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 Dp(t){const e=Number(t);return Number.isFinite(e)&&e>0?e:0}function Lp(t){return(null==t?void 0:t.id)||(null==t?void 0:t.nodeId)||null}function Bp(t,e){return Array.isArray(t)&&e?t.findIndex((t=>Lp(t)===e)):-1}function zp(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=Bp(e,n);return t>=0?(t+1)%i:0}if("prev"===t){const t=Bp(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)?Lp(e[i]):null}function Wp(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=Ap(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)=>Ap(t)-Ap(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 $p(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 Up(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 jp(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($p(n,r,t))return r}return null}function qp(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 Vp extends vp{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=Tp(e),i=[{type:"opacity",inputs:[t[1]],options:{power:n}},{type:"shapeComposite",inputs:["__PREVIOUS:0",t[0]],options:{}}];return{type:Vp.type,signature:`${Vp.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:Tp(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&&(qp(a),a.activeRenderPlacementId=l);const c=null==r?void 0:r.initSwitching,u=Wp(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=Up(a.placements,a.selectedPlacementId),i=zp(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=zp(Number.isInteger(t)&&t>=0?t:0,a.nodes,null);let n=null;if(e&&(n=jp(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&&$p(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=jp(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=Dp(a.pendingSwitch.crossfadeSeconds),s=Dp(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=Tp(t/a.switchDuration))}a.switchNormalizedTime=Number.isFinite(p)?p:void 0;const m=Up(a.placements,a.selectedPlacementId),v=$p(s,a.selectedPlacementId,m)||s[0];let g=null;if(Number.isFinite(a.switchNormalizedTime)&&a.previousPlacementId){const t=Up(a.placements,a.previousPlacementId),e=Up(a.placements,a.selectedPlacementId),n=$p(s,a.previousPlacementId,t),i=$p(s,a.selectedPlacementId,e);n&&i&&(g=[n,i])}return g||(g=v?[v]:s),g}static resetRenderState(t){t&&"object"==typeof t&&qp(t)}}const Hp=[gp,xp,Ip,Vp],Gp=new Map;function Kp(t){if("string"!=typeof t)return null;const e=t.trim();return e?e.toLowerCase():null}function Xp(t){const e=Kp(t);return e&&Gp.get(e)||null}function Yp(t){return Xp(t)||gp}Hp.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=Kp(e);n&&Gp.set(n,t)}))}(t)));class Qp{static get defaultType(){return gp.type||"default"}static getRenderNodeClass(t){return Xp(t)}static normalizeType(t){const e=Xp(t);return e?e.type:null}static doesRenderNodeTypeRequireFrameCadence(t){const e=Xp(t);return!!e&&!0===e.requiresFrameCadence}static buildLayoutGraph({type:t,inputs:e=[],normalizedTime:n}={}){const i=Yp(t);return i&&"function"==typeof i.buildLayoutGraph?i.buildLayoutGraph({inputs:e,normalizedTime:n}):gp.buildLayoutGraph({inputs:e,normalizedTime:n})}static getPanAndScanTarget(t){const e=Yp(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=Yp(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=Yp(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=Yp(t);n&&"function"==typeof n.resetRenderState&&n.resetRenderState(e)}static resetAllRenderStates(t){t&&"function"==typeof t.forEach&&t.forEach(((t,e)=>{Qp.resetRenderState(e,t)}))}create(t,e){return t&&"function"==typeof t.render?t:new(Yp(t))(e)}}function Jp(t){return Array.isArray(t)?t.filter((t=>t&&"string"==typeof t.type)):[]}function Zp(t,e){return t&&"function"==typeof t.getSignature?t.getSignature():(null==e?void 0:e.type)||"stage"}class tm{#C;constructor(t){this.#C=t||new mp}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=Qp.normalizeType(null==t?void 0:t.layoutType)||Qp.defaultType,r=null==t?void 0:t.normalizedTime,o=Jp(null==t?void 0:t.preStages),s=Jp(null==t?void 0:t.postStages),a=[],l=[`layout:${i}`,`inputs:${e}`];let c=n;o.forEach(((e,n)=>{const i=this.#C.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(Zp(i,e))}));const u=Qp.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.#C.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(Zp(i,e))})),{graph:a,signature:l.join("|"),isDynamic:d}}}const em=[0,0,1,1],nm="zoomInExposure",im=["transform","exposure","fadeToColor","dipToBlack"],rm={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 om(t,e=0){const n=Number(t);return Number.isFinite(n)?n:e}function sm(t,e=em){return Array.isArray(t)&&t.length>=4?t:e}function am(t){return"string"==typeof t&&t.trim()?t.trim():"#ffffff"}function lm(t,e){const n=null==t?void 0:t[e];return!1===n||null==n?null:ku(n)?n:{}}function cm(t={}){let e=0;return im.forEach((n=>{const i=lm(t,n);if(!i)return;const r=om(null==i?void 0:i.duration);r>e&&(e=r)})),e}function um(t,e,n,i,r){const o=[];return im.forEach((s=>{const a=lm(t,s);if(!a)return;const l=function(t,e,n){const i=om(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=sm(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=sm(null==e?void 0:e.ease),n=(null==e?void 0:e.power)||{from:0,to:1};return o.options.properties.power={from:om(null==n?void 0:n.from,0),to:om(null==n?void 0:n.to,1),ease:t},o.options.properties.color=am((null==e?void 0:e.color)||r),o}if("exposure"===t||"dipToBlack"===t){const t=sm(null==e?void 0:e.ease),n=(null==e?void 0:e.power)||{from:0,to:1};return o.options.properties.power={from:om(null==n?void 0:n.from,0),to:om(null==n?void 0:n.to,1),ease:t},o}return null}(s,a,e,l,r);c&&o.push(c)})),o}function dm(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 hm{#O=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(ku(null==t?void 0:t.transition))return t.transition;if("string"==typeof(null==t?void 0:t.transition))return rm[t.transition]||rm[nm];if(ku(null==t?void 0:t.filters)||ku(null==t?void 0:t.reverseFilters))return{filters:t.filters||{},reverseFilters:t.reverseFilters||{}};if("string"==typeof(null==t?void 0:t.filter)){const e=om(t.duration)>0?1e3*t.duration:500;return{filters:{[t.filter]:{duration:e,power:{from:0,to:1}}},reverseFilters:{}}}return rm[nm]}(t),n=xu({},(null==e?void 0:e.filters)||{},ku(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(ku(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=xu({},(null==e?void 0:e.reverseFilters)||{},ku(null==t?void 0:t.reverseFilters)?t.reverseFilters:{});return{baseFilters:n,reverseFilters:xu({},i,r)}}(t),r=om(null==t?void 0:t.duration),o=r>0?1e3*r:null,s=cm(n),a=cm(i),l=o&&s>0?o/s:1,c=o&&a>0?o/a:1,u=o||s||500,d=o||a||u,h=am(null==t?void 0:t.color),f=e.captureTexture(),p=Date.now(),m=um(n,p,l,o,h);return this.#O={phase:"out",startTime:p,outDurationMs:u,inDurationMs:d,color:h,captureId:f,baseFilters:n,reverseFilters:i,outScale:l,inScale:c,durationOverrideMs:o,outGraph:m,outSignature:dm(m),inGraph:null,inSignature:null},{captureId:f,outDurationMs:u,inDurationMs:d}}beginIncoming(){if(!this.#O)return;const t=Date.now(),e=um(this.#O.reverseFilters,t,this.#O.inScale,this.#O.durationOverrideMs,this.#O.color);this.#O={...this.#O,phase:"in",startTime:t,inGraph:e,inSignature:dm(e)}}reset(t){var e;t&&"function"==typeof t.disposeTexture&&null!==(e=this.#O)&&void 0!==e&&e.captureId&&t.disposeTexture(this.#O.captureId),this.#O=null}getState(){return this.#O}buildOutgoingGraph(){const t=this.#O;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.#O;return t&&"in"===t.phase&&Array.isArray(t.inGraph)&&t.inGraph.length?{signature:`transition:in:${t.inSignature||""}`,forceUpdate:!1,graph:t.inGraph}:null}}let fm;const pm=[/firefox\/(\d+)/,/edg\/(\d+)/,/opr\/(\d+)/,/chrome\/(\d+)/];function mm(){const t=Au&&Au.navigator&&(Au.navigator.userAgent||Au.navigator.platform||Au.navigator.vendor)||"";if(fm&&fm.ua===t)return fm;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<pm.length;e+=1){const n=pm[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 fm={ua:t,lowerUA:e,isAndroid:n,isiOS:i,isMobile:r,isDesktop:o,isFirefox:s,browserMajorVersion:a},fm}function vm(){return mm().ua}function gm(){return mm().isAndroid}function ym(){return mm().isiOS}function bm(){return mm().isMobile}function km(){return mm().isDesktop}function xm(){return mm().isFirefox}function wm(){return mm().browserMajorVersion}var _m={getUserAgent:vm,isAndroid:gm,isiOS:ym,isMobile:bm,isDesktop:km,isFirefox:xm,getBrowserMajorVersion:wm},Tm=Object.freeze({__proto__:null,default:_m,getBrowserMajorVersion:wm,getUserAgent:vm,isAndroid:gm,isDesktop:km,isFirefox:xm,isMobile:bm,isiOS:ym});const Im=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 Em(t,e){const n={};return Number.isFinite(t)&&(n.time=t),"string"==typeof e&&(n.source=e),n}function Sm({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 Am({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",Mm="Playing",Fm="FirstFramePending",Cm="Waiting",Om="Paused",Pm="Seeking",Rm="Resetting";function Dm(t){return Array.isArray(t)?t.filter((t=>t&&"string"==typeof t.type)):[]}function Lm(t,e){return!!Array.isArray(t)&&t.some((t=>(null==t?void 0:t.type)===e))}function Bm(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 zm(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 Wm=2073600;function $m(t,e){const n=Number(t);return Number.isFinite(n)&&n>0?n:e}function Um(t,e){if(null==t)return e;const n=Number(t);return Number.isFinite(n)?n:e}var jm=new WeakMap,qm=new WeakMap,Vm=new WeakMap,Hm=new WeakMap,Gm=new WeakMap,Km=new WeakMap,Xm=new WeakMap,Ym=new WeakMap,Qm=new WeakMap,Jm=new WeakMap,Zm=new WeakMap,tv=new WeakMap,ev=new WeakMap,nv=new WeakMap,iv=new WeakMap,rv=new WeakMap,ov=new WeakMap,sv=new WeakMap,av=new WeakMap,lv=new WeakMap,cv=new WeakMap,uv=new WeakMap,dv=new WeakMap,hv=new WeakMap,fv=new WeakMap,pv=new WeakMap,mv=new WeakMap,vv=new WeakMap,gv=new WeakMap,yv=new WeakMap,bv=new WeakSet;class kv extends Iu{static get pipelineNodeId(){return"ekoplayer-render-pipeline"}get defaults(){return{defaultRenderParams:void 0,resourceLimits:{enabled:!0,maxCanvasPixels:Wm,maxDevicePixelRatio:0,renderScale:1,transitionMinFrameIntervalMs:33}}}constructor(...t){super(...t),O(this,bv),F(this,jm,void 0),F(this,qm,void 0),F(this,Vm,void 0),F(this,Hm,void 0),F(this,Gm,void 0),F(this,Km,void 0),F(this,Xm,void 0),F(this,Ym,void 0),F(this,Qm,void 0),F(this,Jm,void 0),F(this,Zm,null),F(this,tv,null),F(this,ev,void 0),F(this,nv,void 0),F(this,iv,void 0),F(this,rv,[]),F(this,ov,[]),F(this,sv,null),F(this,av,null),F(this,lv,null),F(this,cv,null),F(this,uv,null),F(this,dv,null),F(this,hv,new Map),F(this,fv,null),F(this,pv,null),F(this,mv,!1),F(this,vv,!1),F(this,gv,[]),F(this,yv,null);const[e,n,i]=t;C(jm,this,e),C(qm,this,n),C(Vm,this,i),M(jm,this)&&"function"==typeof M(jm,this).enableFirstFrameRenderedGate&&M(jm,this).enableFirstFrameRenderedGate(),C(Jm,this,new tm),C(ev,this,new hm),C(nv,this,null),C(iv,this,null),C(lv,this,null),C(Hm,this,(t=>A(bv,this,Zv).call(this,t))),M(jm,this)&&"function"==typeof M(jm,this).on&&(M(jm,this).on(Im.VISUAL_FRAMES_AVAILABLE,M(Hm,this)),C(Gm,this,(()=>{var t,e,n,i;A(bv,this,Tv).call(this),A(bv,this,Kv).call(this,0),C(ov,this,[]),C(sv,this,null),C(Zm,this,null),C(tv,this,null),A(bv,this,Bv).call(this),C(fv,this,null);(null===(t=M(ev,this))||void 0===t||null===(e=t.getState)||void 0===e?void 0:e.call(t))||null===(n=M(ev,this))||void 0===n||null===(i=n.reset)||void 0===i||i.call(n,M(nv,this))})),M(jm,this).on(Im.TIMELINE_SEEKING,M(Gm,this)),C(Km,this,(()=>A(bv,this,Iv).call(this))),M(jm,this).on(Im.TIMELINE_RESET,M(Km,this)),C(Qm,this,(()=>A(bv,this,Uv).call(this))),M(jm,this).on(Im.TIMELINE_TIME_UPDATE,M(Qm,this)),C(Xm,this,(()=>{A(bv,this,tg).call(this)&&M(av,this)&&A(bv,this,Zv).call(this,M(av,this))})),M(jm,this).on(Im.TIMELINE_STATE_CHANGE,M(Xm,this))),C(Ym,this,(()=>{C(sv,this,null),M(av,this)&&A(bv,this,tg).call(this)&&A(bv,this,Zv).call(this,M(av,this))})),M(Vm,this)&&"function"==typeof M(Vm,this).on&&M(Vm,this).on(Im.CONTAINER_RESIZE,M(Ym,this))}get name(){return"Renderer"}onDispose(){M(jm,this)&&M(Hm,this)&&"function"==typeof M(jm,this).off&&M(jm,this).off(Im.VISUAL_FRAMES_AVAILABLE,M(Hm,this)),M(jm,this)&&M(Gm,this)&&"function"==typeof M(jm,this).off&&M(jm,this).off(Im.TIMELINE_SEEKING,M(Gm,this)),M(jm,this)&&M(Km,this)&&"function"==typeof M(jm,this).off&&M(jm,this).off(Im.TIMELINE_RESET,M(Km,this)),M(jm,this)&&M(Qm,this)&&"function"==typeof M(jm,this).off&&M(jm,this).off(Im.TIMELINE_TIME_UPDATE,M(Qm,this)),M(jm,this)&&M(Xm,this)&&"function"==typeof M(jm,this).off&&M(jm,this).off(Im.TIMELINE_STATE_CHANGE,M(Xm,this)),M(Vm,this)&&M(Ym,this)&&"function"==typeof M(Vm,this).off&&M(Vm,this).off(Im.CONTAINER_RESIZE,M(Ym,this)),A(bv,this,xv).call(this),C(Hm,this,null),C(Gm,this,null),C(Km,this,null),C(Qm,this,null),C(Xm,this,null),C(Ym,this,null),C(Jm,this,null),C(ev,this,null),C(hv,this,null),C(fv,this,null),C(qm,this,null),C(Vm,this,null),C(jm,this,null)}startTransition(t={}){var e;const n=null===(e=M(qm,this))||void 0===e?void 0:e.element;if(!n)return null;if(A(bv,this,Sv).call(this,n),!M(nv,this))return null;const i=M(ev,this).start({shaderGraph:M(nv,this),duration:null==t?void 0:t.duration,filter:null==t?void 0:t.filter,color:null==t?void 0:t.color,filters:null==t?void 0:t.filters,reverseFilters:null==t?void 0:t.reverseFilters,transition:null==t?void 0:t.transition});return C(lv,this,M(av,this)||null),A(bv,this,Yv).call(this),i}beginTransitionIn(t={}){var e,n;null!==(e=M(ev,this))&&void 0!==e&&null!==(n=e.beginIncoming)&&void 0!==n&&n.call(e,t),C(lv,this,null),A(bv,this,Yv).call(this)}resetTransition(){var t,e;null!==(t=M(ev,this))&&void 0!==t&&null!==(e=t.reset)&&void 0!==e&&e.call(t,M(nv,this)),C(lv,this,null),A(bv,this,Qv).call(this)}}function xv(){if(A(bv,this,Tv).call(this),M(ev,this)&&"function"==typeof M(ev,this).reset&&M(ev,this).reset(M(nv,this)),A(bv,this,Kv).call(this,0),M(nv,this)&&"function"==typeof M(nv,this).dispose)try{M(nv,this).dispose()}catch(t){}C(nv,this,null),C(iv,this,null),C(rv,this,[]),C(ov,this,[]),C(sv,this,null),C(Zm,this,null),C(tv,this,null),C(av,this,null),C(lv,this,null),A(bv,this,Qv).call(this),A(bv,this,Bv).call(this),C(fv,this,null)}function wv(){return{schedule:"function"==typeof Au.requestAnimationFrame?Au.requestAnimationFrame.bind(Au):t=>setTimeout(t,16),cancel:"function"==typeof Au.cancelAnimationFrame?Au.cancelAnimationFrame.bind(Au):clearTimeout}}function _v(t){C(gv,this,M(gv,this).filter((e=>e!==t))),M(gv,this).length||C(yv,this,null)}function Tv(){M(yv,this)&&M(gv,this).forEach((t=>M(yv,this).call(this,t))),C(gv,this,[]),C(yv,this,null),C(vv,this,!1)}function Iv(){A(bv,this,Tv).call(this),C(mv,this,!1)}function Ev(){if(M(mv,this)||M(vv,this))return;const{schedule:t,cancel:e}=A(bv,this,wv).call(this);let n;C(yv,this,e),C(vv,this,!0),n=t((()=>{let e;A(bv,this,_v).call(this,n),e=t((()=>{A(bv,this,_v).call(this,e),C(vv,this,!1),M(mv,this)||(C(mv,this,!0),M(jm,this)&&"function"==typeof M(jm,this).notifyFirstFrameRendered&&M(jm,this).notifyFirstFrameRendered())})),M(gv,this).push(e)})),M(gv,this).push(n)}function Sv(t){if(M(nv,this)||!t)return;const e=this,n={dest:t,src:(t,n)=>{C(iv,e,n)}};C(nv,e,new dp(n,{userWillCallRender:!0,glOptions:{contextType:"webgl2"},performanceToggles:{useCanvasSizedFilterTargets:!0}})),M(nv,e)&&"function"==typeof M(nv,e).addNodes&&M(nv,e).addNodes({[se.pipelineNodeId]:{type:"composite",options:{graph:[]}}})}function Av(){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 Nv(){const t=A(bv,this,Av).call(this).enabled;return!0===t||!1!==t&&ym()}function Mv(){if(!A(bv,this,Nv).call(this))return 0;const t=Um(A(bv,this,Av).call(this).transitionMinFrameIntervalMs,33);return Number.isFinite(t)&&t>0?t:0}function Fv(t,e,n={}){const i=!0===(null==n?void 0:n.useDevicePixelRatio),r=A(bv,this,Nv).call(this),o=i?$m(null==Au?void 0:Au.devicePixelRatio,1):1;let s=o,a=0;if(r){const t=A(bv,this,Av).call(this);a=Um(t.maxCanvasPixels,Wm);const e=Um(t.maxDevicePixelRatio,0);s=$m(t.renderScale,1)*(e>0?Math.min(o,e):o)}let l=Math.max(1,Math.round(t*s)),c=Math.max(1,Math.round(e*s));if(r&&a>0){const t=l*c;if(t>a){const e=Math.sqrt(a/t);l=Math.max(1,Math.floor(l*e)),c=Math.max(1,Math.floor(c*e))}}return{width:l,height:c}}function Cv(t=[],e={}){var n;const i=null===(n=M(qm,this))||void 0===n?void 0:n.element,r=M(iv,this);if(!i||"function"!=typeof r)return!1;let o=0,s=0;const a=!0===(null==e?void 0:e.useViewportSize);if(a){var l,c,u,d,h,f;const t=Number(null!==(l=null===(c=M(Vm,this))||void 0===c?void 0:c.containerWidth)&&void 0!==l?l:null===(u=M(Vm,this))||void 0===u?void 0:u.width),e=Number(null!==(d=null===(h=M(Vm,this))||void 0===h?void 0:h.containerHeight)&&void 0!==d?d:null===(f=M(Vm,this))||void 0===f?void 0:f.height);if(Number.isFinite(t)&&Number.isFinite(e)&&t>0&&e>0)o=Math.round(t),s=Math.round(e);else{const t=Number(i.clientWidth),e=Number(i.clientHeight);Number.isFinite(t)&&Number.isFinite(e)&&t>0&&e>0&&(o=Math.round(t),s=Math.round(e))}}if(!(o>0&&s>0)){if(!Array.isArray(t)||!t.length)return;for(let e=0;e<t.length;e+=1){var p;const n=null===(p=t[e])||void 0===p?void 0:p.frame,i=Number((null==n?void 0:n.displayWidth)||(null==n?void 0:n.codedWidth)||(null==n?void 0:n.videoWidth)||(null==n?void 0:n.naturalWidth)||(null==n?void 0:n.width)),r=Number((null==n?void 0:n.displayHeight)||(null==n?void 0:n.codedHeight)||(null==n?void 0:n.videoHeight)||(null==n?void 0:n.naturalHeight)||(null==n?void 0:n.height));!Number.isFinite(i)||!Number.isFinite(r)||i<=0||r<=0||(i>o&&(o=i),r>s&&(s=r))}}if(!(o>0&&s>0))return!1;const m=A(bv,this,Fv).call(this,o,s,{useDevicePixelRatio:a}),v=m.width,g=m.height,y=M(sv,this);return!(y&&y.width===v&&y.height===g||(C(sv,this,{width:v,height:g}),r(null,null,v,g),0))}function Ov(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 Pv(t,e,n){const i=Number.isFinite(null==t?void 0:t.duration)&&t.duration>0?t.duration:void 0;let r;if(i&&Number.isFinite(null==t?void 0:t.offset)){const n=(e-t.offset)/i;r=n<0?0:n>1?1:n}const o=A(bv,this,Rv).call(this,t),s=A(bv,this,Dv).call(this,o);return Qp.getRenderTiming({type:o,timing:{duration:i,normalizedTime:r},timelineTime:e,active:t,renderNodeParams:n,state:s})}function Rv(t){return Qp.normalizeType(null==t?void 0:t.type)||Qp.defaultType}function Dv(t){if(!t||!M(hv,this))return null;let e=M(hv,this).get(t);return e||(e={},M(hv,this).set(t,e)),e}function Lv(t){if(!t||!M(hv,this))return;const e=M(hv,this).get(t);e&&Qp.resetRenderState(t,e),M(hv,this).delete(t)}function Bv(){M(hv,this)&&(Qp.resetAllRenderStates(M(hv,this)),M(hv,this).clear())}function zv(t,e,n,i){const r=A(bv,this,Rv).call(this,t);M(fv,this)&&M(fv,this)!==r&&A(bv,this,Lv).call(this,M(fv,this)),C(fv,this,r);const o=A(bv,this,Dv).call(this,r);return Qp.prepareRenderFrames({type:r,frames:e,timelineTime:n,timeline:M(jm,this),active:t,renderNodeParams:i,state:o})}function Wv(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 $v(t){return t?String(t.renderPlacementId||t.type||"unknown"):"default"}function Uv(){if(!M(jm,this)||!M(av,this))return;const t=M(jm,this).currentTime,e=M(jm,this).getActiveRenderPlacement(t),n=A(bv,this,$v).call(this,e);n!==M(pv,this)&&(C(pv,this,n),A(bv,this,Zv).call(this,{...M(av,this),time:t}))}function jv(t){return!t||"object"!=typeof t||!Object.prototype.hasOwnProperty.call(t,"panAndScan")||!1!==t.panAndScan}function qv(t,e){const n=A(bv,this,Wv).call(this,t),i=null==n?void 0:n.stages;let r=Dm(null==i?void 0:i.pre),o=Dm(null==i?void 0:i.post);const s=A(bv,this,jv).call(this,n),a=A(bv,this,Rv).call(this,t),l=Lm(r,"retarget")||Lm(o,"retarget");if(s&&!l){const t=Qp.getPanAndScanTarget(a);if("pre"===t){const t=Bm(Array.isArray(e)?e.length:0);t&&(r=[t,...r])}else if("post"===t){const t=Bm(1);t&&(o=[...o,t])}}else s||(r=zm(r),o=zm(o));return{preStages:r,postStages:o,renderNodeParams:n}}function Vv(t,e,n,i,r){const o=r||A(bv,this,Pv).call(this,t,n,i),s=A(bv,this,qv).call(this,t,e);return M(Jm,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 Hv(){var t,e;const n=null===(t=M(ev,this))||void 0===t||null===(e=t.getState)||void 0===e?void 0:e.call(t);return"out"===(null==n?void 0:n.phase)?M(ev,this).buildOutgoingGraph():"in"===(null==n?void 0:n.phase)?M(ev,this).buildIncomingGraph():null}function Gv(t,e,n,i){const r=n||e!==M(Zm,this),o=r||i;return r&&M(nv,this)&&"function"==typeof M(nv,this).updateOptions&&(M(nv,this).updateOptions(se.pipelineNodeId,{graph:t}),C(Zm,this,e)),M(nv,this)&&"function"==typeof M(nv,this).selectNode&&M(tv,this)!==se.pipelineNodeId&&(M(nv,this).selectNode(se.pipelineNodeId),C(tv,this,se.pipelineNodeId)),!(!o||!M(nv,this)||"function"!=typeof M(nv,this).render||(M(nv,this).render({noRaf:!0}),0))}function Kv(t){if(!Array.isArray(M(rv,this))||!M(rv,this).length)return;const e=Number.isFinite(t)?Math.max(0,t):0;if(!(M(rv,this).length<=e)){for(let t=e;t<M(rv,this).length;t+=1){const e=M(rv,this)[t];if(e&&M(nv,this)&&"function"==typeof M(nv,this).releaseTexture)try{M(nv,this).releaseTexture(e)}catch(t){}}M(rv,this).length=e,M(ov,this).length=e}}function Xv(t=[]){if(!M(nv,this)||"function"!=typeof M(nv,this).addTexture)return!1;if("function"==typeof M(nv,this).isContextUnavailable&&M(nv,this).isContextUnavailable())return!1;if(!Array.isArray(t)||!t.length)return A(bv,this,Kv).call(this,0),!1;A(bv,this,Kv).call(this,t.length);let e=!1;for(let i=0;i<t.length;i+=1){var n;M(rv,this)[i]||"function"!=typeof M(nv,this).addTexture||(M(rv,this)[i]=M(nv,this).addTexture(null,"frame",i));const r=A(bv,this,Ov).call(this,t[i]),o=null===(n=t[i])||void 0===n?void 0:n.frame;if(M(rv,this)[i]&&o&&(!r||r!==M(ov,this)[i]))try{M(rv,this)[i].fill(o),M(ov,this)[i]=r,e=!0}catch(t){}}return e}function Yv(){if(M(cv,this))return;const t="function"==typeof Au.requestAnimationFrame?t=>Au.requestAnimationFrame(t):t=>setTimeout(t,16),e="function"==typeof Au.cancelAnimationFrame?t=>Au.cancelAnimationFrame(t):clearTimeout;C(uv,this,e);const n=()=>{var e,i;if(null!==(e=M(ev,this))&&void 0!==e&&null!==(i=e.getState)&&void 0!==i&&i.call(e)){if(M(av,this)){const t=A(bv,this,Mv).call(this),e=Date.now();(!t||!M(dv,this)||e-M(dv,this)>=t)&&(C(dv,this,e),A(bv,this,Zv).call(this,M(av,this)))}C(cv,this,t(n))}else C(cv,this,null)};C(cv,this,t(n))}function Qv(){M(cv,this)&&M(uv,this)&&M(uv,this).call(this,M(cv,this)),C(cv,this,null),C(uv,this,null),C(dv,this,null)}function Jv(t){var e,n;const i=null===(e=M(ev,this))||void 0===e||null===(n=e.getState)||void 0===n?void 0:n.call(e);return"out"===(null==i?void 0:i.phase)&&M(lv,this)?M(lv,this):t}function Zv(t={}){var e,n;const i=null===(e=M(qm,this))||void 0===e?void 0:e.element,r=null===(n=M(qm,this))||void 0===n?void 0:n.gl;if(!i||!r)return;if(t&&C(av,this,t),!A(bv,this,tg).call(this))return;const o=A(bv,this,Jv).call(this,t),s=Number.isFinite(null==o?void 0:o.time)?o.time:void 0;if(!Number.isFinite(s))return;if(A(bv,this,Sv).call(this,i),!M(nv,this))return;const a=M(jm,this)&&"function"==typeof M(jm,this).getActiveRenderPlacement?M(jm,this).getActiveRenderPlacement(s):void 0,l=A(bv,this,$v).call(this,a);l!==M(pv,this)&&C(pv,this,l);const c=Array.isArray(null==o?void 0:o.frames)?o.frames:[],u=A(bv,this,Wv).call(this,a),d=A(bv,this,jv).call(this,u),h=A(bv,this,zv).call(this,a,c,s,u),f=A(bv,this,Pv).call(this,a,s,u),p=A(bv,this,Cv).call(this,h,{useViewportSize:d}),m=A(bv,this,Xv).call(this,h),v=A(bv,this,Vv).call(this,a,h,s,u,f),g=A(bv,this,Hv).call(this);let y=v.graph,b=v.signature,k=!!v.isDynamic;g&&Array.isArray(g.graph)&&g.graph.length&&(y=y.concat(g.graph),b=`${b}|${g.signature||"transition"}`,k=k||!!g.forceUpdate);const x=p||m||k||g&&Array.isArray(g.graph)&&g.graph.length;A(bv,this,Gv).call(this,y,b,k,x)&&h.length&&A(bv,this,Ev).call(this)}function tg(){var t;const e=null===(t=M(jm,this))||void 0===t?void 0:t.state;return e===Nm||e===Fm||e===Mm||e===Om}function eg(t){return"number"==typeof t&&Number.isFinite(t)&&t>0}function ng(t){return t&&"resource"===t.entryType&&t.transferSize>0&&t.duration>0&&t.responseEnd>=t.requestStart}function ig(t){return Array.isArray(t)&&0!==t.length?t.reduce(((t,e)=>t+e),0)/t.length:NaN}se=kv;var rg=new WeakMap,og=new WeakMap,sg=new WeakMap,ag=new WeakMap,lg=new WeakSet;class cg extends Iu{get name(){return"DownloadSpeedGuesstimator"}get defaults(){return{persistentStorage:{key:"ekoDownloadSpeedKbps",ttl:-1},priorities:[["resourceTiming","downlink","persistentValue"],["resourceTiming","downlink"],["resourceTiming","persistentValue","ua"],["resourceTiming","ua","defaultKbps"],["downlink","persistentValue"],["downlink"],["persistentValue"],["connectionType"],["ua"],["defaultKbps"]],defaultKbps:2500,connectionType:{"slow-2g":50,"2g":70,"3g":700,"4g":3500,bluetooth:750,cellular:750,ethernet:3500,wifi:2500,wimax:2500,none:0},ua:{desktop:2500,ios:2500,android:2500}}}constructor(...t){super(...t),O(this,lg),F(this,rg,void 0),F(this,og,void 0),F(this,sg,void 0),F(this,ag,void 0),C(rg,this,!!(Au&&Au.navigator&&Au.navigator.connection)),C(og,this,!(!Au||!Au.performance||"function"!=typeof Au.performance.getEntriesByType)),C(sg,this,A(lg,this,dg).call(this)),C(ag,this,A(lg,this,vg).call(this))}guesstimate(){const t=A(lg,this,yg).call(this);this.log.debug("[guesstimate] Data:",t);const e=A(lg,this,gg).call(this,t),n=eg(e)?e:t.defaultKbps;return A(lg,this,hg).call(this,n),this.log.info(`[guesstimate] Result: ${n} kbps`),n}update(t){eg(t)&&A(lg,this,hg).call(this,t)}onDispose(){C(sg,this,void 0),C(ag,this,void 0)}}function ug(){return Math.round(Date.now()/1e3)}function dg(){try{if(!Au||!Au.localStorage||"function"!=typeof Au.localStorage.getItem)return}catch(t){return}const t=this.settings.persistentStorage.key,e=Au.localStorage.getItem(t);if(e)try{const t=JSON.parse(e),n=this.settings.persistentStorage.ttl,i=A(lg,this,ug).call(this)-t.timestamp;if("number"==typeof n&&n>=0&&i>n)return null;if(!eg(t.value))return;return t.value}catch(t){return}}function hg(t){if(!eg(t))return;try{if(!Au||!Au.localStorage||"function"!=typeof Au.localStorage.setItem)return}catch(t){return}const e=this.settings.persistentStorage.key,n=JSON.stringify({value:t,timestamp:A(lg,this,ug).call(this)});try{Au.localStorage.setItem(e,n),C(sg,this,t)}catch(t){}}function fg(){return Au&&Au.performance&&"function"==typeof Au.performance.getEntriesByType?ig(Au.performance.getEntriesByType("resource").filter(ng).map((t=>8*t.transferSize/t.duration))):NaN}function pg(){if(!Au||!Au.navigator||!Au.navigator.connection)return NaN;const t=Au.navigator.connection.downlink;return eg(t)?1e3*t:NaN}function mg(){if(!M(rg,this))return NaN;const t=Au.navigator.connection,e=t.effectiveType||t.type,n=this.settings.connectionType||{};return e&&Object.prototype.hasOwnProperty.call(n,e)?n[e]:NaN}function vg(){const t=this.settings.ua||{};return gm()?t.android:ym()?t.ios:t.desktop}function gg(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=>eg(t)));if(r.length===i.length)return this.log.debug("[#selectFromPriorities] Selected from priorities:",i,"with values:",r),ig(r)}return NaN}function yg(){const t=this.settings.testOverrides||{},e=eg(t.resourceTiming)?t.resourceTiming:A(lg,this,fg).call(this),n=eg(t.downlink)?t.downlink:A(lg,this,pg).call(this),i=eg(t.persistentValue)?t.persistentValue:M(sg,this),r=eg(t.connectionType)?t.connectionType:A(lg,this,mg).call(this),o=eg(t.ua)?t.ua:M(ag,this);return{defaultKbps:this.settings.defaultKbps,resourceTiming:e,downlink:n,connectionType:r,persistentValue:i,ua:o}}const bg=new bu;function kg(t){return"string"!=typeof t||0===t.length?[]:t.split(".").filter((t=>t.length>0))}function xg(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 wg(t){return null!==t&&"object"==typeof t}function _g(t,e,n){const i=kg(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 Tg(t,e,n){if(!wg(t))return t;const i=kg(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}wg(r[e])||(r[e]=xg(i[t+1])?[]:{}),r=r[e]}return t}const Ig={get:(t,e)=>Au&&Au.eko?_g(Au.eko,t,e):e,set(t,e){if(Au)return Au.eko&&"object"==typeof Au.eko||(Au.eko={}),Tg(Au.eko,t,e),Au.eko}},Eg=Au&&Au.performance,Sg=Eg&&"function"==typeof Eg.now?()=>Eg.now():()=>Date.now();function Ag(){return"undefined"==typeof AbortController?null:new AbortController}function Ng(){const t=new Error("The operation was aborted");return t.name="AbortError",t.code="ABORT_ERR",t}function Mg(t,e){return!(!e||!e.aborted)||!!t&&("AbortError"===t.name||"ABORT_ERR"===t.code||20===t.code)}const Fg=2,Cg=100,Og=2,Pg="runtime.downloadSpeedSamples",Rg=yu("download","warn");function Dg(t){return new Promise((e=>{setTimeout(e,t)}))}function Lg(t){return t>=500}function Bg(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 zg(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=Ig.get(r);t||(t=[],Ig.set(r,t)),t.push(s)}catch(t){}return s}async function Wg(t,e={}){const{method:n="GET",headers:i,body:r,retries:o=Fg,retryDelay:s=Cg,backoffFactor:a=Og,samplesTargetPath:l=Pg,fetch:c,loglevel:u="warn",cache:d,signal:h,onProgress:f,returnType:p="default"}=e;Rg.setLevel(u);const m=function(t){if(t)return t;if(Au&&"function"==typeof Au.fetch)return Au.fetch.bind(Au);throw new Error("fetch is not available in this environment")}(c);let v=0,g=s;for(;;){if(h&&h.aborted)throw Ng();const e=Sg();try{const s=await m(t,{method:n,headers:i,body:r,cache:d,mode:"cors",signal:h});if(h&&h.aborted)throw Ng();if(!s.ok){if(v<o&&Lg(s.status)){v+=1,Rg.warn(`[${t}] Download attempt #${v} failed with status ${s.status}, retrying in ${g}ms...`),await Dg(g),g*=a;continue}Rg.error(`[${t}] Download attempt #${v} failed with status ${s.status}, no more retries.`);const e=new Error(`Download failed with status ${s.status}`);throw e.status=s.status,e}let c=Sg();const u=Bg(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 Ng();const{done:n,value:i}=await t.read();if(n)break;if(i&&i.length){const t=Sg();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=Sg()}else if(y){const t=await s.arrayBuffer();k=new Uint8Array(t),I=k.length,c=Sg()}else"text"===p?(x=await s.text(),c=Sg()):"json"===p&&(w=await s.json(),c=Sg());if(h&&h.aborted)throw Ng();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 A=e,N=c;Number.isFinite(_)&&(A=_,Number.isFinite(T)&&(N=Math.max(T,c))),(!Number.isFinite(A)||!Number.isFinite(N)||N<A)&&(A=e,N=c);const M=Math.max(0,N-A),F=zg(S,M,A,N,l,t);try{bg.trigger("download:sample",F)}catch(t){}const C={response:s,bytes:S,durationMs:M,kbps:F.kbps,startTime:F.startTime,endTime:F.endTime};if("default"===p)return C;if("arrayBuffer"===p||"bytes"===p){const t=k||new Uint8Array(await s.arrayBuffer());return"arrayBuffer"===p?t.buffer:t}return"text"===p?x:"json"===p?w:C}catch(e){if(Mg(e,h))throw"AbortError"===e.name?e:Ng();if(!(v<o)||e.status&&!Lg(e.status))throw Rg.error(`[${t}] Download attempt #${v} failed with error ${e}, no more retries.`),e;v+=1,Rg.warn(`[${t}] Download attempt #${v} failed with error ${e}, retrying in ${g}ms...`),await Dg(g),g*=a}}}const $g={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"]}},Ug=Object.freeze(Object.entries($g).reduce(((t,[e,n])=>(Object.prototype.hasOwnProperty.call(n,"default")&&(t[e]=n.default),t)),{})),jg=yu("config","warn");function qg(t){return Ug[t]}var Vg=new WeakMap,Hg=new WeakMap,Gg=new WeakMap,Kg=new WeakMap,Xg=new WeakMap,Yg=new WeakSet;class Qg extends Iu{get name(){return"DownloadSpeed"}get defaults(){return{alpha:.3,maxSamples:30,minBytesPerSample:1024,minDurationMs:5,maxSampleKbpsCap:void 0,ignoreCacheHits:!0,samplesPath:"runtime.downloadSpeedSamples",initialKbps:qg("initialKbps"),probeUrl:void 0,defaultKbps:2500}}constructor(...t){super(...t),O(this,Yg),F(this,Vg,void 0),F(this,Hg,void 0),F(this,Gg,void 0),F(this,Kg,void 0),F(this,Xg,void 0),C(Gg,this,[]),C(Hg,this,0),C(Vg,this,A(Yg,this,ty).call(this)),C(Xg,this,Ag()),C(Kg,this,(t=>{A(Yg,this,sy).call(this,t,"event")})),A(Yg,this,ey).call(this),bg.on("download:sample",M(Kg,this)),A(Yg,this,ny).call(this),this.log.debug(`[#constructor] Initial estimate: ${M(Vg,this)} kbps`)}getKbps(){return M(Vg,this)}addSample(t){A(Yg,this,sy).call(this,t,"manual")}reset(){C(Gg,this,[]),C(Hg,this,0),C(Vg,this,A(Yg,this,ty).call(this))}onDispose(){M(Xg,this)&&M(Xg,this).abort(),C(Xg,this,null),bg.off("download:sample",M(Kg,this)),C(Gg,this,[]),C(Hg,this,0),C(Vg,this,void 0),C(Kg,this,null)}}function Jg(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 Zg(t){if(!t||"object"!=typeof t)return null;const e=Number(t.bytes),n=Number(t.durationMs);let i=eg(t.kbps)?Number(t.kbps):NaN;return!eg(i)&&n>0&&eg(e)&&(i=8*e/n),eg(i)?e<=this.settings.minBytesPerSample||n<=this.settings.minDurationMs||A(Yg,this,Jg).call(this,t,e)?null:(eg(this.settings.maxSampleKbpsCap)&&i>this.settings.maxSampleKbpsCap&&(i=this.settings.maxSampleKbpsCap),{...t,bytes:e,durationMs:n,kbps:i}):null}function ty(){const t=this.settings.initialKbps;if(eg(t))return t;if("auto"===t)try{const t=(new cg).guesstimate();if(eg(t))return t}catch(t){}return this.settings.defaultKbps}function ey(){const t=Ig.get(this.settings.samplesPath,[]);if(!Array.isArray(t)||0===t.length)return;const e=t.slice(-this.settings.maxSamples);for(let t=0;t<e.length;t+=1)A(Yg,this,sy).call(this,e[t],"replay",{emit:!1})}async function ny(){if(!this.settings.probeUrl||M(Hg,this)>0)return;const t=M(Xg,this)?M(Xg,this).signal:void 0;if(!t||!t.aborted)try{await Wg(this.settings.probeUrl,{cache:"no-store",samplesTargetPath:this.settings.samplesPath,signal:t})}catch(t){}}function iy(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 ry(t,e){if(!A(Yg,this,iy).call(this,t)||!A(Yg,this,iy).call(this,e))return 0;const n=Math.max(t.startTime,e.startTime);return Math.min(t.endTime,e.endTime)-n}function oy(t){if(!A(Yg,this,iy).call(this,t))return t;const e=[];for(let n=0;n<M(Gg,this).length;n+=1){const i=M(Gg,this)[n];A(Yg,this,iy).call(this,i)&&(A(Yg,this,ry).call(this,t,i)>0&&e.push(i))}if(0===e.length)return t;C(Gg,this,M(Gg,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(!eg(i)||s<=0)return t;const a={bytes:i,durationMs:s,kbps:8*i/s,startTime:r,endTime:o,url:t.url||e[e.length-1].url};return A(Yg,this,Zg).call(this,a)}function sy(t,e,{emit:n=!0}={}){const i=A(Yg,this,Zg).call(this,t);if(!i)return;const r=A(Yg,this,oy).call(this,i);if(!r)return;C(Hg,this,M(Hg,this)+1),M(Gg,this).push(r),M(Gg,this).length>this.settings.maxSamples&&M(Gg,this).shift();const o=this.defaults.alpha,s="number"==typeof this.settings.alpha?this.settings.alpha:o,a=eg(M(Vg,this)),l=a?M(Vg,this):r.kbps,c=a||1!==M(Hg,this)?s*r.kbps+(1-s)*l:r.kbps;C(Vg,this,c),this.log.debug(`[#ingestSample] Next estimate: ${c} kbps`),n&&this.trigger("download:speed",{kbps:M(Vg,this),sample:r,source:e,samplesCount:M(Hg,this)})}class ay{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),eg(s)&&(this.bandwidth=s),eg(a)&&(this.timescale=a),eg(l)&&(this.sizeBytes=l),Object.assign(this,c)}}class ly{#P=new Map;#R;#D;#L=0;#B;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 ay?t:new ay(t))),this.representations=this.originalRepresentations.map((t=>t)),this.appliedFilters=[],this.loadAttempts=0,this.loadError=void 0}setRepresentationBuffer(t,e){t&&e&&this.#P.set(t,e)}setDownloadProgress(t,e){const n=Number(t);Number.isFinite(n)&&n>=0&&(this.#L=Math.max(this.#L,n));const i=Number(e);Number.isFinite(i)&&i>0&&(this.#B=i)}setChosenRepresentation(t){this.#R=t;const e=null==t?void 0:t.id;if(!(this.isInit||!e||this.#P.size<=1))for(const t of this.#P.keys())t!==e&&this.#P.delete(t)}setABRDecisionSnapshot(t){if(!t||"object"!=typeof t)return void(this.#D=void 0);const e={...t};Array.isArray(t.availableRepresentations)&&(e.availableRepresentations=t.availableRepresentations.map((t=>({...t})))),this.#D=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.#P.get(t)}get chosenRepresentation(){return this.#R}get abrDecision(){return this.#D}get arrayBuffer(){return this.#R?this.#P.get(this.#R.id):void 0}get retainedByteLength(){let t=0;for(const e of this.#P.values())e&&"number"==typeof e.byteLength&&(t+=e.byteLength);return t}get bufferedRatio(){var t;const e=eg(this.#B)?this.#B:null===(t=this.#R)||void 0===t?void 0:t.sizeBytes;return eg(e)?Math.min(1,Math.max(0,this.#L/e)):this.retainedByteLength>0?1:0}get isLoaded(){return this.retainedByteLength>0}evict(){this.#R=void 0,this.#D=void 0,this.#P.clear(),this.#L=0,this.#B=void 0}}class cy{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 uy(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 dy(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=uy(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 hy=new Set(["video","audio","image","cue","data","bbox"]);class fy{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(!hy.has(n))throw new Error(`Track type must be one of ${Array.from(hy).join("|")}`);this.id=e,this.type=n,this.offset=i,this.duration=eg(r)?r:void 0,this.source=o,"cue"===n?(this._cues=a.map((t=>t instanceof cy?t:new cy(t))),this._segments=[]):(this._segments=s.map((t=>t instanceof ly?t:new ly(t))),this._cues=void 0)}get segments(){return this._segments.slice()}get cues(){if("cue"===this.type)return this._cues.slice()}get endTime(){if(eg(this.duration))return this.offset+this.duration;if(!this._segments.length)return;const t=this._segments.reduce(((t,e)=>{const n=eg(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:eg(null==t?void 0:t.duration)?t.duration:0,offset:eg(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 dy(this._segments,t,e)}setSegments(t=[]){if("cue"===this.type)return;const e=Array.isArray(t)?t:[];this._segments=e.map((t=>t instanceof ly?t:new ly(t)))}}function py(t){return"string"==typeof t?t:t&&"object"==typeof t?t.nodeId||t.nodeIdOrRef||t.id:void 0}function my(t){const e=py(t);let n=1;if(t&&"object"==typeof t&&eg(t.weight)&&(n=t.weight),!e)throw new Error("Child entry requires a nodeId");return{nodeId:e,weight:n}}function vy(t){return(Array.isArray(t)?t:[]).map((t=>my(t)))}function gy(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 yy(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 by(t,e){if(e)try{var n;return new URL(e,t||(null==Au||null===(n=Au.location)||void 0===n?void 0:n.href)||void 0).toString()}catch(t){return e}}const ky=new Map;class xy{static register(t,e){if(!t||"function"!=typeof e)throw new Error("ManifestFactory.register requires type and parser function");ky.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=xy.inferType(t);if(!e||!ky.has(e))throw new Error("Unsupported manifest type");return ky.get(e)(t)}}xy.register("dash",(function(t={}){const{body:e,url:n}=t,i=function(){if(Au&&"function"==typeof Au.DOMParser)return new Au.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=gy(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=gy(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:gy(a&&a.getAttribute("timescale"))||gy(e&&e.getAttribute("timescale"),1)||1,startNumber:gy(a&&a.getAttribute("startNumber"))||gy(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=gy(n.getAttribute("t")),s=gy(n.getAttribute("d")),a=gy(n.getAttribute("r"),0);if(!eg(s))continue;eg(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:by(n,yy(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:by(n,yy(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}})),xy.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:eg(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=>eg(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+(eg(e.duration)?e.duration:0)),0),l=eg(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}})),xy.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=eg(null==t?void 0:t.duration)?t.duration:30,i=eg(null==t?void 0:t.width)?t.width:void 0,r=eg(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};eg(i)&&eg(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 wy=["video/mp4"];function _y(t){return wy.includes(t.mime)}var Ty={name:"containers",fn:function(t=[]){return t.filter(_y)},isRelevantForTrack:function(t){return"video"===(null==t?void 0:t.type)}};const Iy=new(ae=new WeakMap,le=new WeakSet,class extends Iu{get name(){return"MediaCapabilities"}get defaults(){return{enabled:!0,smoothWeight:10,powerWeight:10,ignoreSmooth:!1,ignorePower:!0,codecBonus:{av01:.2,hvc1:.15,hev1:.15,vp09:.1,avc1:0}}}constructor(...t){super(...t),O(this,le),F(this,ae,void 0),C(ae,this,new Map)}onDispose(){M(ae,this)&&M(ae,this).clear()}async sortRepsCodecs(t=[]){if(!Array.isArray(t)||0===t.length)return[];const e=[],n=new Set;let i=0;t.forEach((t=>{const r=null==t?void 0:t.baseCodec;r&&!n.has(r)&&(n.add(r),e.push({codec:r,rep:t,index:i}),i+=1)}));const r=(await Promise.all(e.map((async t=>{const{score:e}=await A(le,this,My).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 Ey(){return!!(Au&&Au.navigator&&Au.navigator.mediaCapabilities&&"function"==typeof Au.navigator.mediaCapabilities.decodingInfo)}function Sy(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 Ay(t){return t?JSON.stringify(t):"invalid"}async function Ny(t){if(!this.settings.enabled||!A(le,this,Ey).call(this)||!t)return this.log.debug("[#queryCapabilities] Not supported, returning false",t),{supported:!1,smooth:!1,powerEfficient:!1};const e=A(le,this,Ay).call(this,t),n=M(ae,this).get(e);if(n)return n;let i;try{i=await Au.navigator.mediaCapabilities.decodingInfo(t)}catch(t){i={supported:!1,smooth:!1,powerEfficient:!1}}return this.log.debug("[#queryCapabilities] Config:",t,"\nDecoding info result:",i),M(ae,this).set(e,i),i}async function My(t){if(A(le,this,Cy).call(this,t))return this.log.debug("[#scoreRepresentation] Blocking HEVC on Firefox versions below support threshold",null==t?void 0:t.codecs),{score:-1e3,capability:{supported:!1,smooth:!1,powerEfficient:!1}};const e=A(le,this,Sy).call(this,t),n=await A(le,this,Ny).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 Fy(){if(!xm())return!1;const t=wm();return!Number.isFinite(t)||t<150}function Cy(t){if(!A(le,this,Fy).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 Oy=[],Py=()=>!0;[Ty,{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 Iy.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:Py;Oy.push({name:t,fn:e,isRelevantForTrack:i})}(t,e,{isRelevantForTrack:n})}));const Ry=yu("Node","warn"),Dy={start:0,end:0},Ly=.001;function By(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)<=Ly&&Math.abs(t.duration-n.duration)<=Ly))?{offset:n.start,duration:n.duration}:void 0}var zy=new WeakMap,Wy=new WeakMap,$y=new WeakMap,Uy=new WeakMap,jy=new WeakMap,qy=new WeakMap,Vy=new WeakMap,Hy=new WeakMap,Gy=new WeakMap,Ky=new WeakMap,Xy=new WeakSet;class Yy extends bu{constructor(t={},e={}){super(),O(this,Xy),F(this,zy,void 0),F(this,Wy,void 0),F(this,$y,void 0),F(this,Uy,void 0),F(this,jy,void 0),F(this,qy,void 0),F(this,Vy,void 0),F(this,Hy,void 0),F(this,Gy,void 0),F(this,Ky,[]);const{id:n,manifestRef:i,duration:r,width:o,height:s,metadata:a={},children:l=[]}=t;if(!n)throw new Error("Node requires id");if(!i)throw new Error("Node requires manifestRef");this.id=n,this.manifestRef=i,this.metadata=a,this.state="pending",this.error=void 0,this.tracks=[],this.mainTrackId=void 0,this.imageFallbackActive=!1,this.disabledTracks=[],this.disabledTrackTypes=Array.isArray(e.disabledTracks)?e.disabledTracks.filter((t=>"string"==typeof t)):[],this.enabledRepFilters=Array.isArray(e.enabledRepFilters)?e.enabledRepFilters:void 0,this.forceVideoCodec="string"==typeof e.forceVideoCodec&&e.forceVideoCodec.trim()?e.forceVideoCodec.trim():void 0,C(Vy,this,!0===e.forceImageFallback),C(zy,this,e.abrSelector),C(Wy,this,e.assetsDeliveryService),C(Uy,this,eg(r)?r:void 0),C(jy,this,eg(o)?o:void 0),C(qy,this,eg(s)?s:void 0),C(Hy,this,e&&"object"==typeof e.mediaHostRewriteMap?e.mediaHostRewriteMap:void 0),C(Gy,this,eg(e.maxManifestLoadAttempts)?e.maxManifestLoadAttempts:1/0),this.manifestLoadAttempts=0,this.manifestLoadError=void 0,C(Ky,this,vy(l))}setChildren(t){const e=vy(t);return A(Xy,this,pb).call(this,e,{emit:!0})}addChild(t){const e=my(t),n=M(Ky,this).slice(),i=n.findIndex((t=>(null==t?void 0:t.nodeId)===e.nodeId));if(i>=0){var r;if((null===(r=n[i])||void 0===r?void 0:r.weight)===e.weight)return this.children;n[i]=e}else n.push(e);return A(Xy,this,pb).call(this,n,{emit:!0})}removeChild(t){const e=py(t);if(!e)return this.children;const n=M(Ky,this).filter((t=>(null==t?void 0:t.nodeId)!==e));return n.length===M(Ky,this).length?this.children:A(Xy,this,pb).call(this,n,{emit:!0})}async load(t={}){const{loadingMode:e="full",signal:n}=t;Ry.info(`[load] [${this.id}] Loading node in '${e}' mode`);try{if(n&&n.aborted)throw Ng();"ready"!==this.state&&await this.resolve({signal:n});const t="partial"===e,i=[];this.tracks.forEach((e=>{const n=e.segments||[];if(t){const t=n.find((t=>t.isInit)),r=n.find((t=>!t.isInit));t&&Array.isArray(t.representations)&&!t.isLoaded&&i.push({track:e,segment:t}),r&&Array.isArray(r.representations)&&!r.isLoaded&&i.push({track:e,segment:r})}else n.forEach((t=>{Array.isArray(t.representations)&&!t.isLoaded&&i.push({track:e,segment:t})}))}));const r=i.filter((({segment:t})=>t.isInit)),o=i.filter((({segment:t})=>!t.isInit)),s=o.length?o[0]:void 0,a=r.map((({track:t,segment:e})=>A(Xy,this,ub).call(this,t,e,n))),l=s?A(Xy,this,db).call(this,s.segment,s.track,n):Promise.resolve();await Promise.all([...a,l]);const c=s?o.slice(1):o;for(const t of c)await A(Xy,this,db).call(this,t.segment,t.track,n);if(n&&n.aborted)throw Ng();return this.trigger("node:loaded",{nodeId:this.id,node:this,loadingMode:e}),this}catch(t){if(Mg(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(Ry.info(`[loadMediaSegmentsAtOffset] [${this.id}] Loading media segments at offset ${n}`),!Number.isFinite(n))return;const{signal:i}=e;if(i&&i.aborted)throw Ng();if("ready"!==this.state&&await this.resolve({signal:i}),"ready"!==this.state)return;const r=[],o=[];if(this.tracks.forEach((t=>{const e=(null==t?void 0:t.segments)||[];if(!Array.isArray(e)||!e.length)return;const s=e.find((t=>(null==t?void 0:t.isInit)&&Array.isArray(null==t?void 0:t.representations)));s&&!s.isLoaded&&r.push(A(Xy,this,ub).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)<=Ly&&!e.isLoaded&&o.push({segment:e,track:t})}))})),r.length||o.length){if(await Promise.all(r),o.length&&await Promise.all(o.map((({segment:t,track:e})=>A(Xy,this,db).call(this,t,e,i)))),i&&i.aborted)throw Ng();this.trigger("node:loaded",{nodeId:this.id,node:this,loadingMode:"segment-offset",offsetSeconds:n})}}async resolve(t={}){const{signal:e,manifestOverride:n}=t;let i=!0;for(;i;){if(i=!1,"ready"===this.state)return this;if("resolving"===this.state)try{return await M($y,this)}catch(t){if(!Mg(t)||e&&e.aborted)throw t;i=!0;continue}if(e&&e.aborted)throw Ng();if(this.hasExceededManifestLoadAttempts()){const t=this.manifestLoadError||new Error("Manifest load retry limit reached");throw this.state="failed",this.error=t,t}const t=A(Xy,this,ib).call(this);return this.state="resolving",this.error=void 0,C($y,this,(async()=>{try{const t=await A(Xy,this,hb).call(this,{signal:e,manifestOverride:n});if(e&&e.aborted)throw Ng();let i=xy.parse(t);return i=A(Xy,this,nb).call(this,i),this.tracks=(i.tracks||[]).map((t=>t instanceof fy?t:new fy(t))),this.mainTrackId=i.mainTrackId||this.mainTrackId,this.metadata=i.metadata||this.metadata,A(Xy,this,vb).call(this),A(Xy,this,mb).call(this),await A(Xy,this,fb).call(this),this.state="ready",this}catch(n){if(Mg(n,e))throw A(Xy,this,rb).call(this,t),n;throw this.state="failed",this.error=n,n}})()),M($y,this)}return M($y,this)}evict(){this.tracks.forEach((t=>{(t.segments||[]).forEach((t=>{t.evict()}))}))}get children(){return M(Ky,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?eg(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+=eg(e.retainedByteLength)?e.retainedByteLength:0}))})),t}get buffered(){if("ready"!==this.state)return Dy;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||!eg(e))return Dy;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 Dy;if(n.length===this.tracks.length&&n.every((({track:t,range:e})=>{const n=t.endTime,i=eg(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 Dy;const r=Math.min(i,e);return r>0?{start:0,end:r}:Dy}get isLoaded(){return"ready"===this.state&&(Array.isArray(this.tracks)?this.tracks:[]).flatMap((t=>Array.isArray(null==t?void 0:t.segments)?t.segments:[])).every((t=>t.isLoaded))}hasExceededManifestLoadAttempts(){if(!Number.isFinite(M(Gy,this))||M(Gy,this)<=0)return!1;if(!this.manifestLoadError)return!1;const t=Number(this.manifestLoadAttempts);return Number.isFinite(t)&&t>=M(Gy,this)}}function Qy(t){return function(t,e){if(!t||"string"!=typeof t)return t;if(!e||"object"!=typeof e)return t;const n=Au&&"function"==typeof Au.URL?Au.URL:"function"==typeof URL?URL:null;if(!n)return t;let i;try{i=new n(t)}catch(e){return t}const r=function(t,e){const n=null==t?void 0:t.hostname,i=null==t?void 0:t.pathname;if("string"!=typeof n||"string"!=typeof i)return t;if(!/^s3(?:[.-][a-z0-9-]+)?\.amazonaws\.com$/i.test(n))return t;const r=i.split("/").filter(Boolean);if(r.length<2)return t;const o=r[0],s=new e(t.toString());return s.hostname=`${o}.${n}`,s.pathname=`/${r.slice(1).join("/")}`,s}(i,n),o=e[r.hostname]?r:i,s=e[o.hostname];if(!s||"string"!=typeof s)return t;let a;try{a=new n(s)}catch(e){return t}return a.protocol&&a.host?(o.protocol=a.protocol,o.host=a.host,o.toString()):t}(t,M(Hy,this))}function Jy(){return M(Vy,this)||void 0===Au.VideoDecoder}function Zy(){return this.manifestRef&&"object"==typeof this.manifestRef&&"assets-delivery-service"===this.manifestRef.type}function tb(t){if(!A(Xy,this,Zy).call(this))return!1;if(!A(Xy,this,Jy).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 eb(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 eg(n)?n:eg(M(Uy,this))?M(Uy,this):void 0}function nb(t){if(this.imageFallbackActive=!1,!A(Xy,this,tb).call(this,t))return t;if(!M(Wy,this)||"function"!=typeof M(Wy,this).resolveImageOne)return t;const e=M(Wy,this).resolveImageOne(this.manifestRef),n=A(Xy,this,Qy).call(this,null==e?void 0:e.url);if(!n)return t;const i={typeHint:"image",url:n,duration:A(Xy,this,eb).call(this,t),width:M(jy,this),height:M(qy,this)},r=xy.parse(i);return t&&"object"==typeof t.metadata&&!Array.isArray(t.metadata)&&(r.metadata=t.metadata),this.imageFallbackActive=!0,r}function ib(){return{state:this.state,error:this.error,tracks:this.tracks,mainTrackId:this.mainTrackId,metadata:this.metadata,imageFallbackActive:this.imageFallbackActive,disabledTracks:this.disabledTracks,manifestRef:this.manifestRef,manifestLoadAttempts:this.manifestLoadAttempts,manifestLoadError:this.manifestLoadError}}function rb(t){t&&(this.state=t.state,this.error=t.error,this.tracks=t.tracks,this.mainTrackId=t.mainTrackId,this.metadata=t.metadata,this.imageFallbackActive=t.imageFallbackActive,this.disabledTracks=t.disabledTracks,this.manifestRef=t.manifestRef,this.manifestLoadAttempts=t.manifestLoadAttempts,this.manifestLoadError=t.manifestLoadError)}function ob(){const t=Number(this.manifestLoadAttempts);this.manifestLoadAttempts=Number.isFinite(t)&&t>0?t+1:1,this.manifestLoadError=void 0}function sb(t){this.manifestLoadError=t||new Error("Manifest load failed")}function ab(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 lb(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 cb(t,e){t&&("function"!=typeof t.setLoadError?t.loadError=e||new Error("Segment load failed"):t.setLoadError(e))}async function ub(t,e,n){const i=A(Xy,this,ab).call(this,e);try{const i=e.representations.map((async i=>{const r=A(Xy,this,Qy).call(this,i.url),o=await Wg(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(Mg(t,n))throw A(Xy,this,lb).call(this,e,i),t;throw A(Xy,this,cb).call(this,e,t),t}}async function db(t,e,n){const i=M(zy,this),r={representations:t.representations,nodeId:this.id,trackId:null==e?void 0:e.id,segmentId:t.id},o=i&&"function"==typeof i.select?i.select(r):void 0,s=t.representations.find((t=>t.id===o))||t.representations[0];if(!s)return;t&&"function"==typeof t.setABRDecisionSnapshot&&t.setABRDecisionSnapshot(r.abrDecision),t.setChosenRepresentation(s);const a=A(Xy,this,ab).call(this,t);try{const i=A(Xy,this,Qy).call(this,s.url),r=await Wg(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(Mg(e,n))throw A(Xy,this,lb).call(this,t,a),e;throw A(Xy,this,cb).call(this,t,e),e}}async function hb(t={}){const{signal:e,manifestOverride:n}=t;if(e&&e.aborted)throw Ng();A(Xy,this,ob).call(this);try{let t=this.manifestRef;if(n&&"object"==typeof n){if(A(Xy,this,Zy).call(this)&&"string"==typeof n.encodeProfile&&n.encodeProfile&&(this.manifestRef={...this.manifestRef,encodeProfile:n.encodeProfile},t=this.manifestRef),n.ivd)return{typeHint:"ivd",body:n.ivd};if(n.body){const t=A(Xy,this,Qy).call(this,n.url);return{typeHint:n.typeHint,url:t,mimeType:n.mimeType,body:n.body,duration:M(Uy,this),width:M(jy,this),height:M(qy,this)}}"string"==typeof n.url&&n.url&&(t=n)}if(t&&"object"==typeof t&&"assets-delivery-service"===t.type){if(!M(Wy,this)||"function"!=typeof M(Wy,this).resolveOne)throw new Error("AssetsDeliveryService is required for assets-delivery-service manifestRef");const n=await M(Wy,this).resolveOne(t,{signal:e});if(!n)throw new Error("AssetsDeliveryService returned empty result");if("string"==typeof n.encodeProfile&&n.encodeProfile&&(this.manifestRef={...t,encodeProfile:n.encodeProfile}),n.ivd)return{typeHint:"ivd",body:n.ivd};const i=n.typeHint,r=A(Xy,this,Qy).call(this,n.url),o=n.mimeType,s=n.body;if(r||s||o)return{typeHint:i,url:r,mimeType:o,body:s,duration:M(Uy,this),width:M(jy,this),height:M(qy,this)};throw new Error("AssetsDeliveryService returned unsupported manifest shape")}if(t&&"object"==typeof t){const e=A(Xy,this,Qy).call(this,t.url),n=t.mimeType;if(t.body)return{url:e,mimeType:n,body:"string"==typeof t.body?t.body:JSON.stringify(t.body)}}if("string"==typeof t||t&&"string"==typeof t.url){const n="string"==typeof t?t:t.url,i=A(Xy,this,Qy).call(this,n),r="object"==typeof t?t.typeHint:void 0,o="object"==typeof t?t.mimeType:void 0;if("image"===xy.inferType({typeHint:r,url:i,mimeType:o})){const e="object"==typeof t&&eg(t.duration)?t.duration:M(Uy,this);return{typeHint:"image",url:i,mimeType:o,duration:e,width:"object"==typeof t&&eg(t.width)?t.width:M(jy,this),height:"object"==typeof t&&eg(t.height)?t.height:M(qy,this)}}const s=await Wg(i,{returnType:"default",signal:e});return{url:i,body:s&&s.response&&"function"==typeof s.response.text?await s.response.text():void 0,mimeType:(s&&s.response&&s.response.headers&&"function"==typeof s.response.headers.get&&s.response.headers.get("content-type")?s.response.headers.get("content-type"):void 0)||o}}throw new Error("Node manifestRef is invalid or missing")}catch(t){if(Mg(t,e))throw t;throw A(Xy,this,sb).call(this,t),t}}async function fb(){const t=Oy.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=By(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 pb(t,{emit:e=!1}={}){return function(t=[],e=[]){if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(let n=0;n<t.length;n+=1){const i=t[n],r=e[n];if((null==i?void 0:i.nodeId)!==(null==r?void 0:r.nodeId)||(null==i?void 0:i.weight)!==(null==r?void 0:r.weight))return!1}return!0}(M(Ky,this),t)||(C(Ky,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 mb(){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 vb(){if(!Array.isArray(this.tracks)||!this.tracks.length)return;const t=this.duration;if(!eg(t))return;const e=[new cy({name:"nodestart",timestamp:0,data:{id:this.id},isSticky:!0}),new cy({name:"nodeend",timestamp:t,data:{id:this.id}})],n=new fy({id:`${this.id}-auto-cue`,type:"cue",cues:e,offset:0,duration:t});this.tracks.push(n)}var gb=new WeakMap,yb=new WeakMap,bb=new WeakMap,kb=new WeakMap,xb=new WeakSet;class wb extends Iu{constructor(...t){super(...t),O(this,xb),F(this,gb,new Map),F(this,yb,new Map),F(this,bb,void 0),F(this,kb,void 0);const[e,n]=t;C(bb,this,e),C(kb,this,n)}get name(){return"NodeRepository"}get defaults(){return{enabledRepFilters:["containers","force-video-codec","media-capabilities"],disabledTracks:qg("disabledTracks"),forceVideoCodec:qg("forceVideoCodec"),forceImageFallback:qg("forceImageFallback"),mediaHostRewriteMap:qg("mediaHostRewriteMap"),maxManifestLoadAttempts:3}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"get","list"])}onDispose(){M(gb,this).forEach(((t,e)=>{const n=M(yb,this).get(e);n&&t&&"function"==typeof t.off&&t.off(Im.NODE_CHILDREN_CHANGED,n)})),M(yb,this).clear(),M(gb,this).clear()}add(t){const e=t instanceof Yy?t:new Yy(t,{enabledRepFilters:this.settings.enabledRepFilters,disabledTracks:this.settings.disabledTracks,forceVideoCodec:this.settings.forceVideoCodec,forceImageFallback:this.settings.forceImageFallback,mediaHostRewriteMap:this.settings.mediaHostRewriteMap,maxManifestLoadAttempts:this.settings.maxManifestLoadAttempts,abrSelector:M(bb,this),assetsDeliveryService:M(kb,this)});if(!e.id)throw new Error("NodeRepository.add requires node with id");if(M(gb,this).has(e.id))throw new Error(`NodeRepository.add: node with id ${e.id} already exists`);return M(gb,this).set(e.id,e),A(xb,this,_b).call(this,e),this.trigger(Im.NODE_ADD,{node:e}),e}get(t){const e=(null==t?void 0:t.id)||t;if(!e)throw new Error("NodeRepository.get requires node or id");return M(gb,this).get(e)}list(){return Array.from(M(gb,this).values())}}function _b(t){if(!t||"function"!=typeof t.on||!t.id)return;const e=t=>{this.trigger(Im.NODE_CHILDREN_CHANGED,t)};t.on(Im.NODE_CHILDREN_CHANGED,e),M(yb,this).set(t.id,e)}var Tb=new WeakMap,Ib=new WeakMap,Eb=new WeakSet;class Sb extends Iu{constructor(...t){super(...t),O(this,Eb),F(this,Tb,void 0),F(this,Ib,new Map);const[e]=t;C(Tb,this,e)}get name(){return"ABRSelector"}get defaults(){return{safetyMargin:.35,minBufferForUpgrade:5,minBufferCritical:1,hysteresisRatio:1.1,abrStrategy:qg("abrStrategy")}}select(t={}){var e;const{representations:n=[],bufferSeconds:i}=t;if(!Array.isArray(n)||0===n.length)return;const r=M(Tb,this)&&"function"==typeof M(Tb,this).getKbps?M(Tb,this).getKbps():void 0,o=A(Eb,this,Ab).call(this,n[0]),s=M(Ib,this).get(o),a=this.settings.abrStrategy||"auto";this.log.debug(`[select] strategy=${a}, bw=${r}, buffer=${i}, prev=${s}`);const l=n.slice().sort(((t,e)=>A(Eb,this,Nb).call(this,t.bandwidth)-A(Eb,this,Nb).call(this,e.bandwidth)));if("bottom"===a){const e=l[0];return A(Eb,this,Cb).call(this,e,t,{decisionReason:"strategy:bottom",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:void 0,bufferSeconds:i}),null==e?void 0:e.id}if("top"===a){const e=l[l.length-1];return A(Eb,this,Cb).call(this,e,t,{decisionReason:"strategy:top",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:void 0,bufferSeconds:i}),null==e?void 0:e.id}if("random"===a){const e=l[Math.floor(Math.random()*l.length)];return A(Eb,this,Cb).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=eg(r)?r*this.settings.safetyMargin:void 0;let d="auto:highest-available";if(s&&void 0!==c&&c<this.settings.minBufferCritical){const e=l[0];return this.log.debug("[select] critical buffer -> lowest",t),A(Eb,this,Cb).call(this,e,t,{decisionReason:"auto:critical-buffer",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:u,bufferSeconds:c}),null==e?void 0:e.id}let h=l[l.length-1];if(void 0!==u){const e=l.filter((t=>A(Eb,this,Nb).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&&eg(e.bandwidth)&&eg(h.bandwidth)&&h.bandwidth/e.bandwidth>this.settings.hysteresisRatio&&(h=n.filter((t=>t.bandwidth&&t.bandwidth<=e.bandwidth*this.settings.hysteresisRatio)).sort(((t,e)=>t.bandwidth-e.bandwidth)).pop()||e,d="auto:hysteresis-hold",this.log.debug("[select] hysteresis prevents upgrade; hold",h.id,t))}return A(Eb,this,Cb).call(this,h,t,{decisionReason:d,trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:u,bufferSeconds:c}),null===(e=h)||void 0===e?void 0:e.id}onDispose(){M(Ib,this).clear(),C(Tb,this,null)}}function Ab(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 Nb(t){return eg(t)?t/1e3:0}function Mb(t){return eg(t)?t/1e3:void 0}function Fb(t,e,n={}){const i=Array.isArray(null==e?void 0:e.representations)?e.representations.map((t=>({id:null==t?void 0:t.id,bandwidthKbps:A(Eb,this,Mb).call(this,null==t?void 0:t.bandwidth)}))):[];return{timeMs:Date.now(),strategy:this.settings.abrStrategy||"auto",decisionReason:n.decisionReason,nodeId:null==e?void 0:e.nodeId,trackId:null==e?void 0:e.trackId,segmentId:null==e?void 0:e.segmentId,trackType:n.trackType,measuredDownloadSpeedKbps:Number.isFinite(n.measuredDownloadSpeedKbps)?n.measuredDownloadSpeedKbps:void 0,safeBandwidthKbps:Number.isFinite(n.safeBandwidthKbps)?n.safeBandwidthKbps:void 0,bufferSeconds:Number.isFinite(n.bufferSeconds)?n.bufferSeconds:void 0,previousRepresentationId:n.previousRepresentationId,selectedRepresentationId:null==t?void 0:t.id,selectedRepresentationBandwidthKbps:A(Eb,this,Mb).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 Cb(t,e,n={}){if(!t)return;const i=A(Eb,this,Fb).call(this,t,e,n);e&&"object"==typeof e&&(e.abrDecision=i),this.log.info("[select] Chosen representation:",t,"context:",e,"decision:",i),this.trigger("abr:selection",{representation:t,context:e,strategy:this.settings.abrStrategy,decision:i});const r=A(Eb,this,Ab).call(this,t);M(Ib,this).set(r,t.id)}var Ob=new WeakMap,Pb=new WeakSet;class Rb extends Iu{constructor(...t){super(...t),O(this,Pb),F(this,Ob,void 0);const[e]=t;if(C(Ob,this,e),!M(Ob,this)||"function"!=typeof M(Ob,this).list)throw new Error("NodePrioritizer requires a NodeRepository instance")}get name(){return"NodePrioritizer"}get defaults(){return{levelMultiplier:1,priorityMultiplier:.3}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"sortNodes"])}onDispose(){C(Ob,this,null)}getPrioritizationSnapshot(t){const e=M(Ob,this).list();if(!e.length)return{orderedIds:[],reachableIds:[]};const{levels:n,weights:i}=A(Pb,this,Db).call(this,e,t);return{orderedIds:A(Pb,this,Lb).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 Db(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=eg(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 Lb(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 Bb(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 zb(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 Wb(t){return"string"==typeof t&&t.startsWith("cmaf:")}function $b(t){return"image"===(null==t?void 0:t.assetType)?"image":"ivd"}function Ub(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 jb=new WeakMap,qb=new WeakMap,Vb=new WeakSet;class Hb extends Iu{constructor(...t){super(...t),O(this,Vb),F(this,jb,void 0),F(this,qb,void 0);const[,e={}]=t;C(jb,this,"function"==typeof e.fetchFn?e.fetchFn:void 0),C(qb,this,Ag())}get name(){return"AssetsDeliveryService"}get defaults(){return{assetsDeliveryServiceUrl:"https://assets.eko.com",profile:qg("encodeProfile"),maxBatchSize:5,imageQueryParams:{startOffset:0,width:1024}}}async resolveOne(t,e={}){var n;const i=await this.resolve([t],e);if(!i.length)return;const r=i[0],o=null==r?void 0:r.manifest,s=null==r||null===(n=r.manifestRef)||void 0===n?void 0:n.encodeProfile;return o&&"object"==typeof o&&"string"==typeof s&&s?{...o,encodeProfile:s}:o}resolveImageOne(t){if(!A(Vb,this,Kb).call(this,t))return;const e=Bb(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=>A(Vb,this,Kb).call(this,t)));if(!n.length)return[];const i=A(Vb,this,Gb).call(this,e);if(i&&i.aborted)return[];const r=[],o=this.settings.profile;n.forEach((t=>{if("image"!==$b(t))return;const e=this.resolveImageOne(t);e&&e.url&&r.push({manifestRef:zb(t,e.encodeProfile),manifest:{typeHint:"image",url:e.url}})}));const s=n.filter((t=>"image"!==$b(t))).map((t=>function(t,e){const n=Bb(t,e);return{ref:t,profile:n,route:Wb(n)?"dash":"ivd"}}(t,o))),a=A(Vb,this,Yb).call(this,s);for(const{refs:t,route:e}of a){if(i&&i.aborted)return r;const{url:n}=A(Vb,this,Qb).call(this,t,e),o=await A(Vb,this,Jb).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:zb(t,e),manifest:Ub(i)})}))}return r}onDispose(){M(qb,this)&&M(qb,this).abort(),C(qb,this,null),C(jb,this,null)}}function Gb(t){return t&&t.signal?t.signal:M(qb,this)?M(qb,this).signal:void 0}function Kb(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 Xb(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 Yb(t){if(!Array.isArray(t)||!t.length)return[];const e=[];t.forEach((t=>{const n=e[e.length-1];n&&n.route===t.route?n.refs.push(t):e.push({route:t.route,refs:[t]})}));const n=[];return e.forEach((t=>{A(Vb,this,Xb).call(this,t.refs,this.settings.maxBatchSize).forEach((e=>{n.push({route:t.route,refs:e})}))})),n}function Qb(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 Jb(t,e){return M(jb,this)?M(jb,this).call(this,t,e):await Wg(t,{returnType:"json",method:(null==e?void 0:e.method)||"GET",signal:null==e?void 0:e.signal})}function Zb({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 tk=(Au.requestAnimationFrame||Au.mozRequestAnimationFrame||Au.webkitRequestAnimationFrame||Au.msRequestAnimationFrame||(t=>Au.setTimeout(t,1e3/60))).bind(Au),ek=(Au.cancelAnimationFrame||Au.mozCancelAnimationFrame||Au.webkitCancelAnimationFrame||Au.msCancelAnimationFrame||(t=>Au.clearTimeout(t))).bind(Au),nk=yu("ticker","warn");let ik,rk=[],ok=null,sk=Sg();function ak(){sk=Sg();const t=[];let e,n;for(n=rk.length-1;n>=0;--n)e=rk[n],sk>=e.lastTick+e.interval&&t.push(e);for(n=t.length-1;n>=0;--n)if(e=t[n],!e.stopped){e.lastTick=sk;try{e.callback()}catch(t){console&&"function"==typeof console.error?console.error(t):nk.error(t)}}ik=tk(ak)}function lk(){Sg()-sk>=200&&(ek(ik),ak())}function ck(t){let e=-1;for(let n=0;n<rk.length;n+=1)if(rk[n].callback===t){e=n;break}return e}function uk(t,e=0){if(!t||"function"!=typeof t||"number"!=typeof e||e<0)return void nk.error("[start] Invalid arguments given to start method.",arguments);const n=ck(t);return-1!==n?(nk.debug("[start] Callback already exists, overriding interval.",arguments),rk[n].interval=e,t):(rk.push({callback:t,interval:e,lastTick:Sg()}),1===rk.length&&(ik=tk(ak),ok||(ok=Au.setInterval(lk,1e3))),t)}function dk(t){const e=ck(t);-1!==e?(rk[e].stopped=!0,rk.splice(e,1),rk.length||(ek(ik),Au.clearInterval(ok),ok=null)):nk.debug("[stop] Callback not found, doing nothing.",arguments)}function hk(t){return-1!==ck(t)}function fk(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 nk.error("[createThrottler] Bad argument given to createThrottler, first argument must be a function.",arguments);nk.debug("[createThrottler] Creating a new throttler instance.",arguments);const s=[];function a(){nk.debug("[onThrottlerTick] Calling callback with "+s.length+" queued items.");const e=s.slice(0);s.length=0,dk(a),t(e)}const l={push:function(t){nk.debug("[push] Queuing argument:",t),0===s.length&&uk(a,e),s.push(t),o+=1,(o<=r||s.length>=i)&&a()},flush:function(){nk.debug("[flush] Flushing queue."),0!==s.length&&a()},dispose:function(){nk.debug("[dispose] Disposing of throttler.");const t=s.slice(0);return s.length=0,dk(a),t}};return Object.defineProperty(l,"interval",{enumerable:!0,get:function(){return e},set:function(t){"number"==typeof t&&(e=t)}}),l}function pk(t,e){if(t&&"function"==typeof t)return t.__tickerThrottler||(t.__tickerThrottler=fk((function(){t()}),e)),"number"==typeof e&&(t.__tickerThrottler.interval=e),t.__tickerThrottler.push(),t.__tickerThrottler;nk.error("[scheduleExecution] Bad argument given to scheduleExecution, first argument must be a function.",arguments)}var mk=new WeakMap,vk=new WeakMap,gk=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,Ak=new WeakMap,Nk=new WeakMap,Mk=new WeakMap,Fk=new WeakSet;class Ck extends Iu{constructor(...t){super(...t),O(this,Fk),F(this,mk,void 0),F(this,vk,void 0),F(this,gk,void 0),F(this,yk,void 0),F(this,bk,[]),F(this,kk,[]),F(this,xk,new Set),F(this,wk,new Set),F(this,_k,!1),F(this,Tk,void 0),F(this,Ik,void 0),F(this,Ek,void 0),F(this,Sk,void 0),F(this,Ak,void 0),F(this,Nk,void 0),F(this,Mk,void 0);const[e,n,i,r]=t;C(mk,this,e),C(vk,this,n),C(gk,this,i),C(yk,this,r),C(Tk,this,Ag());const o=t.length?t[t.length-1]:void 0,s=o&&"object"==typeof o&&Number.isFinite(o.maxConcurrent)?o.maxConcurrent:void 0;Number.isFinite(s)&&(this.settings.maxConcurrent=s),C(Mk,this,(()=>A(Fk,this,jk).call(this))),A(Fk,this,Dk).call(this),A(Fk,this,Rk).call(this)}get name(){return"NodeResolver"}get defaults(){return{maxConcurrent:5}}onDispose(){var t;M(Tk,this)&&M(Tk,this).abort(),C(Tk,this,null),M(yk,this)&&"function"==typeof M(yk,this).off&&M(Ek,this)&&M(yk,this).off(Im.PLACEMENT_ADDED,M(Ek,this)),M(yk,this)&&"function"==typeof M(yk,this).off&&M(Nk,this)&&M(yk,this).off(Im.TIMELINE_RESET,M(Nk,this)),M(mk,this)&&"function"==typeof M(mk,this).off&&M(Sk,this)&&M(mk,this).off(Im.NODE_ADD,M(Sk,this)),M(mk,this)&&"function"==typeof M(mk,this).off&&M(Ak,this)&&M(mk,this).off(Im.NODE_CHILDREN_CHANGED,M(Ak,this)),C(Ek,this,null),C(Sk,this,null),C(Ak,this,null),C(Nk,this,null),C(bk,this,[]),C(kk,this,[]),M(xk,this).clear(),M(wk,this).clear(),C(_k,this,!1),C(Ik,this,void 0),null!==(t=M(Mk,this))&&void 0!==t&&t.__tickerThrottler&&M(Mk,this).__tickerThrottler.dispose(),C(Mk,this,null)}}function Ok(){return M(Tk,this)?M(Tk,this).signal:void 0}function Pk(){return this._disposed||M(Tk,this)&&M(Tk,this).signal.aborted}function Rk(){M(yk,this)&&"function"==typeof M(yk,this).on&&(C(Ek,this,(t=>{A(Fk,this,Bk).call(this,null==t?void 0:t.nodeId)})),M(yk,this).on(Im.PLACEMENT_ADDED,M(Ek,this)),C(Nk,this,(()=>A(Fk,this,Lk).call(this))),M(yk,this).on(Im.TIMELINE_RESET,M(Nk,this))),M(mk,this)&&"function"==typeof M(mk,this).on&&(C(Sk,this,(({node:t})=>{(null==t?void 0:t.id)&&A(Fk,this,Bk).call(this,t.id,{fromRepoAdd:!0})})),M(mk,this).on(Im.NODE_ADD,M(Sk,this)),C(Ak,this,(()=>{pk(M(Mk,this),100)})),M(mk,this).on(Im.NODE_CHILDREN_CHANGED,M(Ak,this)))}function Dk(){const t=M(yk,this)&&Array.isArray(M(yk,this).placements)?M(yk,this).placements:[];t.forEach((t=>A(Fk,this,Bk).call(this,t.nodeId)));const e=t.length?t[t.length-1]:void 0;e&&e.nodeId&&C(Ik,this,e.nodeId)}function Lk(){M(Tk,this)&&M(Tk,this).abort(),C(Tk,this,Ag()),C(bk,this,[]),C(kk,this,[]),M(xk,this).clear(),C(_k,this,!1),C(Ik,this,void 0)}function Bk(t,{fromRepoAdd:e=!1}={}){A(Fk,this,Pk).call(this)||t&&(M(wk,this).has(t)||M(xk,this).has(t)||(M(bk,this).push(t),M(Ik,this)||e||C(Ik,this,t),!M(_k,this)&&e||A(Fk,this,zk).call(this)))}function zk(){if(M(_k,this))return void A(Fk,this,Wk).call(this);if(0===M(bk,this).length)return;C(_k,this,!0);const t=M(bk,this).shift();A(Fk,this,qk).call(this,t).finally((()=>{A(Fk,this,Wk).call(this)}))}async function Wk(){if(!A(Fk,this,Pk).call(this))for(M(bk,this).length||M(kk,this).length||C(kk,this,A(Fk,this,$k).call(this));M(xk,this).size<this.settings.maxConcurrent;){const t=this.settings.maxConcurrent-M(xk,this).size;if(t<=0)break;const e=[];for(;e.length<t&&(M(bk,this).length||M(kk,this).length);){let t=M(bk,this).shift();t||(t=M(kk,this).shift()),t&&e.push(t)}if(!e.length)break;const n=A(Fk,this,Vk).call(this,e);n.length&&M(gk,this)&&"function"==typeof M(gk,this).resolve&&A(Fk,this,Hk).call(this,n).finally((()=>A(Fk,this,Wk).call(this))),e.filter((t=>!n.find((e=>e.nodeId===t)))).forEach((t=>{A(Fk,this,qk).call(this,t).finally((()=>A(Fk,this,Wk).call(this)))}))}}function $k(){const t=new Set([...M(wk,this),...M(xk,this),...M(bk,this)]);return A(Fk,this,Uk).call(this,t)}function Uk(t){const e=M(yk,this)&&Array.isArray(M(yk,this).placements)?M(yk,this).placements:[],n=(e.length?e[e.length-1].nodeId:void 0)||M(Ik,this);return Zb({prioritizer:M(vk,this),repository:M(mk,this),startNodeId:n,pendingIds:t,fallbackToRepository:!1})}function jk(){A(Fk,this,Pk).call(this)||(M(_k,this)||0!==M(bk,this).length)&&(C(kk,this,A(Fk,this,$k).call(this)),M(_k,this)&&A(Fk,this,Wk).call(this))}async function qk(t,e){if(!t||M(wk,this).has(t)||M(xk,this).has(t))return;const n=A(Fk,this,Ok).call(this);if(n&&n.aborted)return;const i=M(mk,this)&&"function"==typeof M(mk,this).get?M(mk,this).get(t):void 0;if(i&&"function"==typeof i.resolve)if("function"==typeof i.hasExceededManifestLoadAttempts&&i.hasExceededManifestLoadAttempts())M(wk,this).add(t);else{M(xk,this).add(t);try{const r={signal:n};e&&(r.manifestOverride=e),await i.resolve(r),M(wk,this).add(t)}catch(e){if(Mg(e,n))return;this.log.warn(`NodeResolver failed to resolve node ${t}: ${(null==e?void 0:e.message)||e}`),"function"==typeof i.hasExceededManifestLoadAttempts&&i.hasExceededManifestLoadAttempts()&&M(wk,this).add(t)}finally{M(xk,this).delete(t)}}}function Vk(t){const e=[];return t.forEach((t=>{const n=M(mk,this)&&"function"==typeof M(mk,this).get?M(mk,this).get(t):void 0;n&&n.manifestRef&&"assets-delivery-service"===n.manifestRef.type&&e.push({nodeId:t,ref:n.manifestRef})})),e}async function Hk(t){const e=A(Fk,this,Ok).call(this);if(!e||!e.aborted){t.forEach((({nodeId:t})=>M(xk,this).add(t)));try{const n=t.map((t=>t.ref)),i=await M(gk,this).resolve(n,{signal:e});t.forEach((({nodeId:t,ref:e})=>{var n;const r=M(mk,this)&&"function"==typeof M(mk,this).get?M(mk,this).get(t):void 0;if(M(xk,this).delete(t),!r||"function"!=typeof r.resolve)return;const o=Array.isArray(i)?i.find((t=>{const n=null==t?void 0:t.manifestRef;return n&&n.assetId===e.assetId&&n.assetRevision===e.assetRevision})):void 0,s="string"==typeof(null==o||null===(n=o.manifestRef)||void 0===n?void 0:n.encodeProfile)&&o.manifestRef.encodeProfile?o.manifestRef.encodeProfile:void 0,a=o?A(Fk,this,Gk).call(this,o.manifest,s):void 0;A(Fk,this,qk).call(this,t,a)}))}catch(n){Mg(n,e)||this.log.warn(`NodeResolver ADS batch failed: ${(null==n?void 0:n.message)||n}`),t.forEach((({nodeId:t})=>M(xk,this).delete(t)))}}}function Gk(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 Kk=.001,Xk="priority";function Yk(t){const e=Number(t);return Number.isFinite(e)?e:0}var Qk=new WeakMap,Jk=new WeakMap,Zk=new WeakMap,tx=new WeakMap,ex=new WeakMap,nx=new WeakMap,ix=new WeakMap,rx=new WeakMap,ox=new WeakMap,sx=new WeakMap,ax=new WeakMap,lx=new WeakMap,cx=new WeakMap,ux=new WeakMap,dx=new WeakMap,hx=new WeakMap,fx=new WeakMap,px=new WeakMap,mx=new WeakMap,vx=new WeakMap,gx=new WeakSet;class yx extends Iu{constructor(...t){super(...t),O(this,gx),F(this,Qk,void 0),F(this,Jk,void 0),F(this,Zk,void 0),F(this,tx,new Map),F(this,ex,new Map),F(this,nx,[]),F(this,ix,new Set),F(this,rx,new Map),F(this,ox,!1),F(this,sx,void 0),F(this,ax,void 0),F(this,lx,void 0),F(this,cx,void 0),F(this,ux,void 0),F(this,dx,void 0),F(this,hx,void 0),F(this,fx,void 0),F(this,px,!1),F(this,mx,[]),F(this,vx,void 0);const[e,n,i]=t;C(Qk,this,e),C(Jk,this,n),C(Zk,this,i),C(ax,this,Ag()),C(vx,this,(()=>A(gx,this,tw).call(this))),A(gx,this,Ox).call(this)}get name(){return"SegmentLoadCoordinator"}get defaults(){return{maxConcurrentLoads:3,maxSegmentLoadAttempts:3}}onDispose(){var t;M(ax,this)&&M(ax,this).abort(),C(ax,this,null),M(rx,this).size&&M(rx,this).forEach((t=>{(null==t?void 0:t.controller)&&t.controller.abort()})),M(rx,this).clear(),M(Zk,this)&&"function"==typeof M(Zk,this).off&&(M(lx,this)&&M(Zk,this).off(Im.PLACEMENT_ADDED,M(lx,this)),M(ux,this)&&M(Zk,this).off(Im.TIMELINE_SEEKING,M(ux,this)),M(dx,this)&&M(Zk,this).off(Im.TIMELINE_SEEKED,M(dx,this)),M(hx,this)&&M(Zk,this).off(Im.TIMELINE_RESET,M(hx,this))),M(Qk,this)&&"function"==typeof M(Qk,this).off&&M(cx,this)&&M(Qk,this).off(Im.NODE_CHILDREN_CHANGED,M(cx,this)),M(fx,this)&&"function"==typeof Au.removeEventListener&&Au.removeEventListener("online",M(fx,this)),C(lx,this,null),C(cx,this,null),C(ux,this,null),C(dx,this,null),C(hx,this,null),C(fx,this,null),M(tx,this).clear(),M(ex,this).clear(),C(nx,this,[]),M(ix,this).clear(),M(rx,this).clear(),C(ox,this,!1),C(sx,this,void 0),C(px,this,!1),C(mx,this,[]),null!==(t=M(vx,this))&&void 0!==t&&t.__tickerThrottler&&M(vx,this).__tickerThrottler.dispose(),C(vx,this,null)}}function bx(){return M(ax,this)?M(ax,this).signal:void 0}function kx(){return this._disposed||M(ax,this)&&M(ax,this).signal.aborted}function xx(){const t=Number(this.settings.maxSegmentLoadAttempts);return Number.isFinite(t)&&t>0?t:1/0}function wx(t){const e=A(gx,this,xx).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 _x(t){return!!t&&(!!A(gx,this,wx).call(this,t)||A(gx,this,Tx).call(this,t))}function Tx(t){if(!t)return!1;if("boolean"==typeof t.isLoaded)return t.isLoaded;const e=Number(t.retainedByteLength);return Number.isFinite(e)&&e>0}function Ix(t){if(!t||A(gx,this,Tx).call(this,t))return;const e=Number(t.loadAttempts);(Number.isFinite(e)&&e>0||t.loadError)&&("function"==typeof t.evict&&t.evict(),t.loadAttempts=0,t.loadError=void 0)}function Ex(t){t&&(t.manifestLoadError&&(t.manifestLoadAttempts=0,t.manifestLoadError=void 0,"failed"===t.state&&(t.state="pending",t.error=void 0)),(Array.isArray(t.tracks)?t.tracks:[]).forEach((t=>{(Array.isArray(null==t?void 0:t.segments)?t.segments:[]).forEach((t=>{A(gx,this,Ix).call(this,t)}))})))}function Sx(){(M(Qk,this)&&"function"==typeof M(Qk,this).list?M(Qk,this).list():[]).forEach((t=>{A(gx,this,Ex).call(this,t)}))}function Ax(t,{allowSeekKeep:e=!1,segmentOffset:n}={}){const i=Ag(),r=i?i.signal:A(gx,this,bx).call(this);return t&&M(rx,this).set(t,{controller:i,allowSeekKeep:!!e,segmentOffset:n}),{signal:r,controller:i}}function Nx(t,e,n={}){const i=M(rx,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 Mx(t,e){const n=M(rx,this).get(t);n&&(e&&n.controller!==e||M(rx,this).delete(t))}function Fx(t,e){const n=new Set;return(Array.isArray(t)?t:[]).forEach((t=>{const i=null==t?void 0:t.nodeId;if(!i)return;const r=M(Qk,this)&&"function"==typeof M(Qk,this).get?M(Qk,this).get(i):void 0;if(!r)return;const o=A(gx,this,qx).call(this,r,t,e);Number.isFinite(o)&&n.add(`${i}:${o}`)})),n}function Cx(t){M(rx,this).size&&M(rx,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 Ox(){M(Zk,this)&&"function"==typeof M(Zk,this).on&&(C(lx,this,(t=>{A(gx,this,zx).call(this,t)})),M(Zk,this).on(Im.PLACEMENT_ADDED,M(lx,this)),C(ux,this,(t=>A(gx,this,Px).call(this,t))),M(Zk,this).on(Im.TIMELINE_SEEKING,M(ux,this)),C(dx,this,(t=>A(gx,this,Rx).call(this,t))),M(Zk,this).on(Im.TIMELINE_SEEKED,M(dx,this)),C(hx,this,(()=>A(gx,this,Bx).call(this))),M(Zk,this).on(Im.TIMELINE_RESET,M(hx,this))),M(Qk,this)&&"function"==typeof M(Qk,this).on&&(C(cx,this,(()=>{pk(M(vx,this),100)})),M(Qk,this).on(Im.NODE_CHILDREN_CHANGED,M(cx,this))),"function"==typeof Au.addEventListener&&(C(fx,this,(()=>A(gx,this,Lx).call(this))),Au.addEventListener("online",M(fx,this)))}function Px(t={}){if(A(gx,this,kx).call(this))return;const e=Number(null==t?void 0:t.targetTime);if(!Number.isFinite(e))return;const n=Array.isArray(null==t?void 0:t.placements)?t.placements:[],i=A(gx,this,Fx).call(this,n,e);A(gx,this,Cx).call(this,i),C(px,this,!0),C(mx,this,n.map((t=>{const n=null==t?void 0:t.nodeId;if(n)return{nodeId:n,placement:t,targetTime:e}})).filter(Boolean)),setTimeout((()=>A(gx,this,$x).call(this)),0)}function Rx(t={}){var e;if(A(gx,this,kx).call(this))return;C(px,this,!1),C(mx,this,[]);const n=Number.isFinite(null==t?void 0:t.targetTime)?Number(t.targetTime):Number(null===(e=M(Zk,this))||void 0===e?void 0:e.currentTime);A(gx,this,Dx).call(this,n),setTimeout((()=>A(gx,this,$x).call(this)),0)}function Dx(t){var e;(Array.isArray(null===(e=M(Zk,this))||void 0===e?void 0:e.placements)?M(Zk,this).placements:[]).forEach((e=>{if(!e)return;const n=Ap(e);if(Number.isFinite(n)){if(Number.isFinite(t)){if(n>=t)return void A(gx,this,zx).call(this,e);const i=Ep(e,M(Qk,this));return Number.isFinite(i)?void(n+i>t&&A(gx,this,zx).call(this,e)):void(n<=t&&A(gx,this,zx).call(this,e))}A(gx,this,zx).call(this,e)}}))}function Lx(){var t;A(gx,this,kx).call(this)||(A(gx,this,Sx).call(this),C(px,this,!1),C(mx,this,[]),A(gx,this,Dx).call(this,Number(null===(t=M(Zk,this))||void 0===t?void 0:t.currentTime)),C(nx,this,A(gx,this,Jx).call(this)),setTimeout((()=>A(gx,this,$x).call(this)),0))}function Bx(){M(ax,this)&&M(ax,this).abort(),C(ax,this,Ag()),M(rx,this).size&&M(rx,this).forEach((t=>{(null==t?void 0:t.controller)&&t.controller.abort()})),M(rx,this).clear(),M(tx,this).clear(),M(ex,this).clear(),C(nx,this,[]),M(ix,this).clear(),C(ox,this,!1),C(sx,this,void 0),C(px,this,!1),C(mx,this,[])}function zx(t){if(A(gx,this,kx).call(this))return;const e=null==t?void 0:t.nodeId;if(!e)return;const n=M(tx,this).get(e);if(n){const i=Ap(n),r=Ap(t);Number.isFinite(i)?Number.isFinite(r)&&r<i&&M(tx,this).set(e,t):Number.isFinite(r)&&M(tx,this).set(e,t)}else M(tx,this).set(e,t);const i=M(sx,this);C(sx,this,e),i&&i!==e&&C(nx,this,[]),M(ox,this)?setTimeout((()=>A(gx,this,$x).call(this)),0):A(gx,this,Wx).call(this)}function Wx(){M(ox,this)||M(tx,this).size&&(C(ox,this,!0),A(gx,this,$x).call(this))}async function $x(){if(A(gx,this,kx).call(this))return;if(M(ix,this).size>=this.settings.maxConcurrentLoads)return;if(M(px,this))return void(M(mx,this).length&&A(gx,this,Ux).call(this));const t=A(gx,this,Gx).call(this);if(t.hasPending)A(gx,this,Kx).call(this,t);else for(M(nx,this).length||C(nx,this,A(gx,this,Jx).call(this));M(ix,this).size<this.settings.maxConcurrentLoads&&M(nx,this).length;){const t=M(nx,this).shift();A(gx,this,ew).call(this,t,"partial").finally((()=>{setTimeout((()=>A(gx,this,$x).call(this)),0)}))}}function Ux(){if(A(gx,this,kx).call(this))return;const t=Math.max(0,this.settings.maxConcurrentLoads-M(ix,this).size);if(!t||!M(mx,this).length)return;const e=[],n=[];for(let i=0;i<M(mx,this).length;i+=1){const r=M(mx,this)[i];(null==r?void 0:r.nodeId)&&(e.length<t&&!M(ix,this).has(r.nodeId)?e.push(r):n.push(r))}C(mx,this,n),e.forEach((t=>{A(gx,this,jx).call(this,t).finally((()=>{setTimeout((()=>A(gx,this,$x).call(this)),0)}))}))}async function jx(t={}){const e=null==t?void 0:t.nodeId,n=null==t?void 0:t.placement,i=Number(null==t?void 0:t.targetTime);if(!e||!n||!Number.isFinite(i))return;if(M(ix,this).has(e))return;const{signal:r,controller:o}=A(gx,this,Ax).call(this,e);if(r&&r.aborted)A(gx,this,Mx).call(this,e,o);else{M(ix,this).add(e);try{const t=M(Qk,this)&&"function"==typeof M(Qk,this).get?M(Qk,this).get(e):void 0;if(!t)return;if("ready"!==t.state&&"function"==typeof t.resolve)try{await t.resolve({signal:r})}catch(t){return}if("ready"!==t.state)return;const s=A(gx,this,qx).call(this,t,n,i);if(!Number.isFinite(s)){const n=Array.isArray(null==t?void 0:t.tracks)?t.tracks.map((t=>null==t?void 0:t.type)).filter(Boolean):[];return void this.log.debug(`[#loadSeekWork] No seek segment offset for node [${e}] targetTime=${i} mainTrackId=${(null==t?void 0:t.mainTrackId)||"n/a"} trackTypes=[${n.join(",")}]`)}"function"==typeof t.loadMediaSegmentsAtOffset?(this.log.debug(`[#loadSeekWork] Loading seek segment for node [${e}] at offset=${s}`),A(gx,this,Nx).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){Mg(t,r)||this.log.warn(`[#loadSeekWork] SegmentLoadCoordinator failed to seek-load node ${e}: ${(null==t?void 0:t.message)||t}`)}finally{M(ix,this).delete(e),A(gx,this,Mx).call(this,e,o)}}}function qx(t,e,n){var i;const r=Ap(e);if(!Number.isFinite(r))return;const o=Yk(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=Yk(null===(i=l)||void 0===i?void 0:i.offset),d=dy(c,Math.max(0,s-u),{preferRepresentationTime:!0}),h=Number(null==d?void 0:d.offset);return Number.isFinite(h)?h:void 0}function Vx(t,e,n=(t=>null===(t=M(Zk,this))||void 0===t?void 0:t.currentTime)()){var i;const r=(Array.isArray(null===(i=M(Zk,this))||void 0===i?void 0:i.placements)?M(Zk,this).placements:[]).filter((e=>(null==e?void 0:e.nodeId)===t&&Number.isFinite(Ap(e)))).sort(((t,e)=>Ap(t)-Ap(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=Ap(e);if(!Number.isFinite(n))continue;const i=Ep(e,M(Qk,this)),l=Number.isFinite(i)&&i>=0;(!a&&n>=o-Kk&&(a=e),l)?o+Kk>=n&&o<n+i-Kk&&(s=e):o+Kk>=n&&(s=e)}return s||a||r[r.length-1]}function Hx(t,e){var n;const i=Number(Ap(e));if(!Number.isFinite(i))return;const r=Ep(e,M(Qk,this)),o=Number.isFinite(r)&&r>=0?i+r:void 0,s=(Array.isArray(null===(n=M(Zk,this))||void 0===n?void 0:n.placements)?M(Zk,this).placements:[]).filter((e=>(null==e?void 0:e.nodeId)===t&&Number.isFinite(Ap(e)))).sort(((t,e)=>Ap(t)-Ap(e)));for(let t=0;t<s.length;t+=1){const e=s[t],n=Number(Ap(e));if(Number.isFinite(n)&&!(n<=i+Kk)){if(Number.isFinite(o)&&n>o+Kk)return;return e}}}function Gx(){const t=[];let e=!1,n=1/0;if(M(tx,this).forEach(((i,r)=>{if(!r||!i)return;const o=M(ex,this).get(r);if(o)return e=!0,void(n=Math.min(n,Yk(o.timelineStart)));const s=A(gx,this,Xx).call(this,r,i);s&&(e=!0,n=Math.min(n,Yk(s.timelineStart)),t.push(s))})),!e||!Number.isFinite(n))return{hasPending:!1,waveTime:void 0,startable:[]};const i=t.filter((t=>Yk(t.timelineStart)===n&&!M(ix,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 Kx({waveTime:t,startable:e}){const n=Math.max(0,this.settings.maxConcurrentLoads-M(ix,this).size);n&&e.length&&e.slice(0,n).forEach((e=>{A(gx,this,Qx).call(this,e,t).finally((()=>{setTimeout((()=>A(gx,this,$x).call(this)),0)}))}))}function Xx(t,e){var n,i;const r=M(Qk,this)&&"function"==typeof M(Qk,this).get?M(Qk,this).get(t):void 0;if(!r)return;if("function"==typeof r.hasExceededManifestLoadAttempts&&r.hasExceededManifestLoadAttempts())return void M(tx,this).delete(t);const o=A(gx,this,Vx).call(this,t,e,null===(n=M(Zk,this))||void 0===n?void 0:n.currentTime),s=Number(Ap(o)),a=Yk(null===(i=M(Zk,this))||void 0===i?void 0:i.currentTime),l="function"==typeof r.loadMediaSegmentsAtOffset,c="function"==typeof r.load;if(!l&&!c)return void M(tx,this).delete(t);if(r.isLoaded)return void M(tx,this).delete(t);if("ready"!==r.state){if(!Number.isFinite(s))return;return{nodeId:t,segmentOffset:0,timelineStart:s}}if(!A(gx,this,nw).call(this,r))return void M(tx,this).delete(t);const u=Array.isArray(r.tracks)?r.tracks:[],d=u.some((t=>{const e=(Array.isArray(null==t?void 0:t.segments)?t.segments:[]).find((t=>(null==t?void 0:t.isInit)&&Array.isArray(null==t?void 0:t.representations)));return!!e&&!A(gx,this,_x).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/Kk)*Kk;h.add(t)}}))}));const f=Array.from(h).sort(((t,e)=>t-e)),p=e=>{const n=Number(Ap(e));if(!Number.isFinite(n))return{status:"none"};const i=Yk(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+Kk;t+=1)s=t;const l=f.slice(s);if(!l.some((t=>A(gx,this,Yx).call(this,r,t))))return{status:f.slice(0,s).some((t=>A(gx,this,Yx).call(this,r,t)))?"beforeOnly":"none"};const c=l.find((t=>A(gx,this,Yx).call(this,r,t))),u=Math.max(0,Yk(c)-i);return{status:"work",work:{nodeId:t,segmentOffset:c,timelineStart:n+u}}},m=p(o);if("work"===m.status)return m.work;if("beforeOnly"!==m.status){if(d&&Number.isFinite(s))return{nodeId:t,segmentOffset:0,timelineStart:s};M(tx,this).delete(t)}else{const e=A(gx,this,Hx).call(this,t,o);if(e){const t=p(e);if("work"===t.status)return t.work}}}function Yx(t,e){const n=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[],i=Yk(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)<=Kk&&!A(gx,this,_x).call(this,t)}))))}async function Qx(t,e){const n=null==t?void 0:t.nodeId,i=null==t?void 0:t.segmentOffset;if(this.log.debug(`[#loadP0Work] Loading ${Xk} node [${n}] at segmentOffset=${i} wave=${e}`),!n)return;const r=M(Qk,this)&&"function"==typeof M(Qk,this).get?M(Qk,this).get(n):void 0;if(!r)return void M(tx,this).delete(n);const o="function"==typeof r.loadMediaSegmentsAtOffset&&Number.isFinite(i),{signal:s,controller:a}=A(gx,this,Ax).call(this,n,{allowSeekKeep:o,segmentOffset:i});if(s&&s.aborted)A(gx,this,Mx).call(this,n,a);else{M(ix,this).add(n),M(ex,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(Mg(t,s))return;const e=`[#loadP0Work] SegmentLoadCoordinator failed to load ${Xk} work for node ${n}: ${(null==t?void 0:t.message)||t}`;this.log.warn(e)}finally{this.log.debug(`[#loadP0Work] Finished ${Xk} work for node [${n}]`),M(ex,this).delete(n),M(ix,this).delete(n),A(gx,this,Mx).call(this,n,a)}}}function Jx(){const t=new Set([...M(tx,this).keys(),...M(ix,this)]),e=A(gx,this,Zx).call(this),n=Array.isArray(null==e?void 0:e.orderedIds)?e.orderedIds:null,i=Array.isArray(null==e?void 0:e.reachableIds)&&e.reachableIds.length?new Set(e.reachableIds):null,r=t=>!("function"==typeof t.hasExceededManifestLoadAttempts&&t.hasExceededManifestLoadAttempts()||t.isLoaded||"ready"===t.state&&A(gx,this,iw).call(this,t));if(i){const e=Zb({prioritizer:M(Jk,this),repository:M(Qk,this),startNodeId:M(sx,this),prioritizedIds:n,pendingIds:t,allowedIds:i,filter:r});if(e.length)return e}return Zb({prioritizer:M(Jk,this),repository:M(Qk,this),startNodeId:M(sx,this),prioritizedIds:n,pendingIds:t,filter:r})}function Zx(){return M(Jk,this)&&M(sx,this)?"function"==typeof M(Jk,this).getPrioritizationSnapshot?M(Jk,this).getPrioritizationSnapshot(M(sx,this)):{orderedIds:"function"==typeof M(Jk,this).sortNodes?M(Jk,this).sortNodes(M(sx,this)):[],reachableIds:"function"==typeof M(Jk,this).getReachableNodeIds?M(Jk,this).getReachableNodeIds(M(sx,this)):[]}:null}function tw(){A(gx,this,kx).call(this)||(M(ox,this)||M(tx,this).size)&&(C(nx,this,A(gx,this,Jx).call(this)),M(ox,this)&&!M(px,this)&&A(gx,this,$x).call(this))}async function ew(t,e){if(this.log.debug(`[#loadNode] Loading node [${t}] in '${e}' mode`),!t)return;const n=M(Qk,this)&&"function"==typeof M(Qk,this).get?M(Qk,this).get(t):void 0;if(!n||"function"!=typeof n.load)return;if("function"==typeof n.hasExceededManifestLoadAttempts&&n.hasExceededManifestLoadAttempts())return;if(n.isLoaded)return void this.log.debug(`[#loadNode] Skipping load for ${t}: already loaded`);const{signal:i,controller:r}=A(gx,this,Ax).call(this,t,{allowSeekKeep:!1});if(i&&i.aborted)A(gx,this,Mx).call(this,t,r);else try{if("ready"!==n.state&&await n.resolve({signal:i}),"ready"!==n.state)return void this.log.debug(`[#loadNode] Skipping load for ${t}: not ready`);if("partial"===e&&A(gx,this,iw).call(this,n))return void this.log.debug(`[#loadNode] Skipping load for ${t}: partial already loaded`);if(!A(gx,this,nw).call(this,n))return void this.log.debug(`[#loadNode] Skipping load for ${t}: no loadable tracks`);M(ix,this).add(t),await n.load({loadingMode:e,signal:i})}catch(e){if(Mg(e,i))return;this.log.warn(`[#loadNode] SegmentLoadCoordinator failed to load node ${t}: ${(null==e?void 0:e.message)||e}`)}finally{this.log.debug(`[#loadNode] Finished loading node [${t}]`),M(ix,this).delete(t),A(gx,this,Mx).call(this,t,r)}}function nw(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 iw(t){const e=(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).filter((t=>Array.isArray(null==t?void 0:t.segments)&&t.segments.length));return!e.length||e.every((t=>{const e=Array.isArray(null==t?void 0:t.segments)?t.segments:[];if(!e.length)return!0;const n=e.find((t=>null==t?void 0:t.isInit)),i=e.find((t=>t&&!t.isInit));return!(n&&!A(gx,this,_x).call(this,n)||i&&!A(gx,this,_x).call(this,i))}))}class rw extends Iu{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 ow(t){if(!t)throw new Error("Assertion failed.")}const sw=t=>t&&t[t.length-1],aw=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)},lw=t=>t.constructor===Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t),cw=t=>t.constructor===DataView?t:ArrayBuffer.isView(t)?new DataView(t.buffer,t.byteOffset,t.byteLength):new DataView(t),uw=new TextDecoder,dw=t=>Object.fromEntries(Object.entries(t).map((([t,e])=>[e,t]))),hw={bt709:1,bt470bg:5,smpte170m:6,bt2020:9,smpte432:12},fw=dw(hw),pw={bt709:1,smpte170m:6,linear:8,"iec61966-2-1":13,pq:16,hlg:18},mw=dw(pw),vw={rgb:0,bt709:1,bt470bg:5,smpte170m:6,"bt2020-ncl":9},gw=dw(vw),yw=t=>[...t].map((t=>t.toString(16).padStart(2,"0"))).join(""),bw=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,kw=(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},xw=(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},ww=()=>{let t,e;return{promise:new Promise(((n,i)=>{t=n,e=i})),resolve:t,reject:e}},_w=(t,e,n)=>t.getUint8(e)<<16|t.getUint8(e+1)<<8|t.getUint8(e+2),Tw=(t,e,n)=>Math.max(e,Math.min(n,t)),Iw=/^[a-z]{3}$/,Ew=1e6*(1+Number.EPSILON);let Sw=null;let Aw=null;const Nw=()=>{if(null!==Aw)return Aw;if("undefined"==typeof navigator)return null;const t=/\bChrome\/(\d+)/.exec(navigator.userAgent);return t?Aw=Number(t[1]):null},Mw=t=>"number"==typeof t&&!Number.isNaN(t);class Fw{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 Cw={default:!0,forced:!1,original:!1,commentary:!1,hearingImpaired:!1,visuallyImpaired:!1};class Ow{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 Ow(this.bytes);return t.pos=this.pos,t}}const Pw=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],Rw=[-1,1,2,3,4,5,6,8],Dw=t=>{if(!t||t.byteLength<2)throw new TypeError("AAC description must be at least 2 bytes long.");const e=new Ow(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<Pw.length&&(r=Pw[i]);const o=e.readBits(4);let s=null;return o>=1&&o<=7&&(s=Rw[o]),{objectType:n,frequencyIndex:i,sampleRate:r,channelConfiguration:o,numberOfChannels:s}},Lw=["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"],Bw=[{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}],zw=t=>{const{codec:e,codecDescription:n,colorSpace:i,avcCodecInfo:r,hevcCodecInfo:o,vp9CodecInfo:s,av1CodecInfo:a}=t;if("avc"===e){if(ow(null!==t.avcType),r){const e=new Uint8Array([r.avcProfileIndication,r.profileCompatibility,r.avcLevelIndication]);return`avc${t.avcType}.${yw(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}.${yw(n.subarray(1,4))}`}if("hevc"===e){let t,e,i,r,s,a;if(o)t=o.generalProfileSpace,e=o.generalProfileIdc,i=bw(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=cw(n),l=o.getUint8(1);t=l>>6&3,e=31&l,i=bw(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=sw(Bw).level;for(const t of Bw)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=sw(Bw).level;for(const t of Bw)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?hw[i.primaries]:1,u=null!=i&&i.transfer?pw[i.transfer]:1,d=null!=i&&i.matrix?vw[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}'.`)},Ww=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:Dw(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&&Lw.includes(e))return e;throw new TypeError(`Unhandled codec '${e}'.`)},$w=/^pcm-([usf])(\d+)+(be)?$/,Uw=[48e3,44100,32e3],jw=[24e3,22050,16e3];var qw,Vw;!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"}(qw||(qw={})),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"}(Vw||(Vw={}));const Hw=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})},Gw=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=_w(i,n):(ow(4===e),t=i.getUint32(n,!1)),n+=e,yield{offset:n,length:t},n+=t}},Kw=t=>31&t,Xw=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)},Yw=t=>t>>1&63,Qw=function*(t){const e=new Ow(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);ow(e.pos%8==0),yield{type:i,data:t.subarray(e.pos/8,e.pos/8+s)},e.skipBits(8*s)}};var Jw;!function(t){t[t.STREAMINFO=0]="STREAMINFO",t[t.VORBIS_COMMENT=4]="VORBIS_COMMENT",t[t.PICTURE=6]="PICTURE"}(Jw||(Jw={}));const Zw=[2,1,2,3,3,4,4,5];class t_{constructor(t){this.input=t}}const e_=[],n_=[],i_=new Uint8Array(0);class r_{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===i_&&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===i_}get microsecondTimestamp(){return Math.trunc(Ew*this.timestamp)}get microsecondDuration(){return Math.trunc(Ew*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 r_(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 r_(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 o_=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.")},s_=t=>{if(!Mw(t))throw new TypeError("timestamp must be a number.")},a_=(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 l_{constructor(t){if(!(t instanceof c_))throw new TypeError("track must be an InputTrack.");this._track=t}getFirstPacket(t={}){if(o_(t),this._track.input._disposed)throw new R_;return a_(this._track,this._track._backing.getFirstPacket(t),t)}async getFirstKeyPacket(t={}){o_(t);const e=await this.getFirstPacket(t);return e?"key"===e.type?e:this.getNextKeyPacket(e,t):null}getPacket(t,e={}){if(s_(t),o_(e),this._track.input._disposed)throw new R_;return a_(this._track,this._track._backing.getPacket(t,e),e)}getNextPacket(t,e={}){if(!(t instanceof r_))throw new TypeError("packet must be an EncodedPacket.");if(o_(e),this._track.input._disposed)throw new R_;return a_(this._track,this._track._backing.getNextPacket(t,e),e)}async getKeyPacket(t,e={}){if(s_(t),o_(e),this._track.input._disposed)throw new R_;if(!e.verifyKeyPackets)return this._track._backing.getKeyPacket(t,e);const n=await this._track._backing.getKeyPacket(t,e);return n?(ow("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 r_))throw new TypeError("packet must be an EncodedPacket.");if(o_(e),this._track.input._disposed)throw new R_;if(!e.verifyKeyPackets)return this._track._backing.getNextKeyPacket(t,e);const n=await this._track._backing.getNextKeyPacket(t,e);return n?(ow("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 r_))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 r_))throw new TypeError("endPacket must be an EncodedPacket.");if(o_(n),this._track.input._disposed)throw new R_;const i=[];let{promise:r,resolve:o}=ww(),{promise:s,resolve:a}=ww(),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}=ww()),await s):(i.push(u),o(),({promise:r,resolve:o}=ww()),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 R_;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 c_{constructor(t,e){this.input=t,this._backing=e}isVideoTrack(){return this instanceof u_}isAudioTrack(){return this instanceof d_}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 l_(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 u_ extends c_{constructor(t,e){super(t,e),this._backing=e,this.pixelAspectRatio=(t=>{ow(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 ow(null!==e),e_.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 r_))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 ow(e),((t,e,n)=>{switch(t){case"avc":for(const t of((t,e)=>{if(e.description){const n=3&lw(e.description)[4];return Gw(t,n+1)}return Hw(t)})(n,e)){const e=n[t.offset],r=Kw(e);if(r>=qw.NON_IDR_SLICE&&r<=qw.SLICE_DPC)return"delta";if(r===qw.IDR)return"key";if(r===qw.SEI&&(i=void 0,!(null!==Sw?Sw:Sw=!("undefined"==typeof navigator||(null===(i=navigator.vendor)||void 0===i||!i.includes("Google Inc"))&&!/Chrome/.test(navigator.userAgent)))||Nw()>=144)){const e=n.subarray(t.offset,t.offset+t.length),i=Xw(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 Ow(i);t.pos=8*r;const e=aw(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&lw(e.description)[21];return Gw(t,n+1)}return Hw(t)})(n,e)){const e=Yw(n[t.offset]);if(e<Vw.BLA_W_LP)return"delta";if(e<=Vw.RSV_IRAP_VCL23)return"key"}return"delta";case"vp8":return 1&n[0]?"delta":"key";case"vp9":{const t=new Ow(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 Qw(n))if(1===e){const e=new Ow(i);e.skipBits(4),t=!!e.readBits(1)}else if(3===e||6===e||7===e){if(t)return"key";const e=new Ow(i);return e.readBits(1)?null:0===e.readBits(2)?"key":"delta"}return null}default:(t=>{throw new Error(`Unexpected value: ${t}`)})(t),ow(!1)}var i})(this.codec,e,t.data)}}class d_ extends c_{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 ow(null!==e),n_.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 r_))throw new TypeError("packet must be an EncodedPacket.");return null===this.codec?null:"key"}}const h_=t=>{let e=q_(t);const n=X_(t,4);let i=8;1===e&&(e=H_(t),i=16);const r=e-i;return r<0?null:{name:n,totalSize:e,headerSize:i,contentSize:r}},f_=t=>V_(t)/65536,p_=t=>V_(t)/1073741824,m_=t=>{let e=0;for(let n=0;n<4;n++){e<<=7;const n=W_(t);if(e|=127&n,!(128&n))break}return e},v_=t=>{let e=$_(t);return t.skip(2),e=Math.min(e,t.remainingLength),uw.decode(z_(t,e))},g_=t=>{const e=h_(t);if(!e||"data"!==e.name)return null;if(t.remainingLength<8)return null;const n=q_(t);t.skip(4);const i=z_(t,e.contentSize-8);switch(n){case 1:return uw.decode(i);case 2:return new TextDecoder("utf-16be").decode(i);case 13:return new Fw(i,"image/jpeg");case 14:return new Fw(i,"image/png");case 27:return new Fw(i,"image/bmp");default:return i}};class y_ extends t_{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=h_(e);if(!i)break;if("ftyp"===i.name){const t=X_(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),ow(t);const e=q_(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=h_(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,ow(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&&Lw.includes(t.info.codec)&&0===n.sampleCompositionTimeOffsets.length){var r;ow("audio"===(null===(r=t.info)||void 0===r?void 0:r.type));const e=(t=>{if(ow(Lw.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=$w.exec(t);let n;return ow(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=xw(n.sampleTimingEntries,a,(t=>t.startIndex)),u=n.sampleTimingEntries[c],d=xw(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=sw(i);m&&m.delta===p?m.count++:i.push({startIndex:s.startChunkIndex+r,startDecodeTimestamp:f,count:1,delta:p});const v=s.samplesPerChunk*e.sampleSize*t.info.numberOfChannels;o.push(v)}s.startSampleIndex=s.startChunkIndex,s.samplesPerChunk=1}n.sampleTimingEntries=i,n.sampleSizes=o}if(n.sampleCompositionTimeOffsets.length>0){n.presentationTimestamps=[];for(const t of n.sampleTimingEntries)for(let e=0;e<t.count;e++)n.presentationTimestamps.push({presentationTimestamp:t.startDecodeTimestamp+e*t.delta,sampleIndex:t.startIndex+e});for(const t of n.sampleCompositionTimeOffsets)for(let e=0;e<t.count;e++){const i=t.startIndex+e,r=n.presentationTimestamps[i];r&&(r.presentationTimestamp+=t.offset)}n.presentationTimestamps.sort(((t,e)=>t.presentationTimestamp-e.presentationTimestamp)),n.presentationTimestampIndexMap=Array(n.presentationTimestamps.length).fill(-1);for(let t=0;t<n.presentationTimestamps.length;t++)n.presentationTimestampIndexMap[n.presentationTimestamps[t].sampleIndex]=t}return n}async readFragment(t){var e;if((null===(e=this.lastReadFragment)||void 0===e?void 0:e.moofOffset)===t)return this.lastReadFragment;let n=this.reader.requestSliceRange(t,8,16);n instanceof Promise&&(n=await n),ow(n);const i=h_(n);ow("moof"===(null==i?void 0:i.name));let r=this.reader.requestSlice(t,i.totalSize);r instanceof Promise&&(r=await r),ow(r),this.traverseBox(r);const o=this.lastReadFragment;ow(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)E_(t,i.timestamp);else{const e=xw(n,o.moofOffset-1,(t=>t.moofOffset));if(-1!==e){const i=n[e];E_(t,i.endTimestamp)}}t.startTimestampIsFinal=!0}const i=xw(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=h_(t);if(!n)break;yield{boxInfo:n,slice:t},t.filePos=e+n.totalSize}}traverseBox(t){var e,n,i,r,o,s,a,l,c,u,d,h,f,p,m,v,g,y,b,k,x,w,_,T,I,E,S,A,N,M,F,C,O,P,R,D;const L=t.filePos,B=h_(t);if(!B)return!1;const z=t.filePos,W=L+B.totalSize;switch(B.name){case"mdia":case"minf":case"dinf":case"mfra":case"edts":case"wave":this.readContiguousBoxes(t.slice(z,B.contentSize));break;case"mvhd":{const e=W_(t);t.skip(3),1===e?(t.skip(16),this.movieTimescale=q_(t),this.movieDurationInTimescale=H_(t)):(t.skip(8),this.movieTimescale=q_(t),this.movieDurationInTimescale=q_(t))}break;case"trak":{const e={id:-1,demuxer:this,inputTrack:null,disposition:{...Cw},info:null,timescale:-1,durationInMovieTimescale:-1,durationInMediaTimescale:-1,rotation:0,internalCodecId:null,name:null,languageCode:"und",sampleTableByteOffset:-1,sampleTable:null,fragmentLookupTable:[],currentFragmentState:null,fragmentPositionCache:[],editListPreviousSegmentDurations:0,editListOffset:0};if(this.currentTrack=e,this.readContiguousBoxes(t.slice(z,B.contentSize)),-1!==e.id&&-1!==e.timescale&&null!==e.info)if("video"===e.info.type&&-1!==e.info.width){const t=e;e.inputTrack=new u_(this.input,new k_(t)),this.tracks.push(e)}else if("audio"===e.info.type&&-1!==e.info.numberOfChannels){const t=e;e.inputTrack=new d_(this.input,new x_(t)),this.tracks.push(e)}this.currentTrack=null}break;case"tkhd":{const e=this.currentTrack;if(!e)break;const n=W_(t),i=!!(1&U_(t));if(e.disposition.default=i,0===n)t.skip(8),e.id=q_(t),t.skip(4),e.durationInMovieTimescale=q_(t);else{if(1!==n)throw new Error(`Incorrect track header version ${n}.`);t.skip(16),e.id=q_(t),t.skip(4),e.durationInMovieTimescale=H_(t)}t.skip(16);const r=[f_(t),f_(t),p_(t),f_(t),f_(t),p_(t),f_(t),f_(t),p_(t)],o=(t=>{const e=(t%360+360)%360;if(0===e||90===e||180===e||270===e)return e;throw new Error(`Invalid rotation ${t}.`)})((Ct=S_(r),90*Math.round(Ct/90)));ow(0===o||90===o||180===o||270===o),e.rotation=o}break;case"elst":{const e=this.currentTrack;if(!e)break;const n=W_(t);t.skip(3);let i=!1,r=0;const o=q_(t);for(let s=0;s<o;s++){const o=1===n?H_(t):q_(t),s=1===n?G_(t):V_(t),a=f_(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=W_(t);t.skip(3),0===n?(t.skip(8),e.timescale=q_(t),e.durationInMediaTimescale=q_(t)):1===n&&(t.skip(16),e.timescale=q_(t),e.durationInMediaTimescale=H_(t));let i=$_(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,Iw.test(Ft)||(e.languageCode="und")}}break;case"hdlr":{const e=this.currentTrack;if(!e)break;t.skip(8);const n=X_(t,4);"vide"===n?e.info={type:"video",width:-1,height:-1,squarePixelWidth:-1,squarePixelHeight:-1,codec:null,codecDescription:null,colorSpace:null,avcType:null,avcCodecInfo:null,hevcCodecInfo:null,vp9CodecInfo:null,av1CodecInfo:null}:"soun"===n&&(e.info={type:"audio",numberOfChannels:-1,sampleRate:-1,codec:null,codecDescription:null,aacCodecInfo:null})}break;case"stbl":{const e=this.currentTrack;if(!e)break;e.sampleTableByteOffset=L,this.readContiguousBoxes(t.slice(z,B.contentSize))}break;case"stsd":{const e=this.currentTrack;if(!e)break;if(null===e.info||e.sampleTable)break;const n=W_(t);t.skip(3);const i=q_(t);for(let r=0;r<i;r++){const i=t.filePos,r=h_(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=$_(t),e.info.height=$_(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=$_(t);t.skip(6);let a=$_(t),l=$_(t);t.skip(4);let c=q_(t)/65536;if(0===n&&s>0)if(1===s)t.skip(4),l=8*q_(t),t.skip(8);else if(2===s){t.skip(4),c=K_(t),a=q_(t),t.skip(4),l=q_(t);const n=q_(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;ow(e.info),e.info.codecDescription=z_(t,B.contentSize)}break;case"hvcC":{const e=this.currentTrack;if(!e)break;ow(e.info),e.info.codecDescription=z_(t,B.contentSize)}break;case"vpcC":{var $;const e=this.currentTrack;if(!e)break;ow("video"===(null===($=e.info)||void 0===$?void 0:$.type)),t.skip(4);const n=W_(t),i=W_(t),r=W_(t),o=r>>4,s=r>>1&7,a=1&r,l=W_(t),c=W_(t),u=W_(t);e.info.vp9CodecInfo={profile:n,level:i,bitDepth:o,chromaSubsampling:s,videoFullRangeFlag:a,colourPrimaries:l,transferCharacteristics:c,matrixCoefficients:u}}break;case"av1C":{var U;const e=this.currentTrack;if(!e)break;ow("video"===(null===(U=e.info)||void 0===U?void 0:U.type)),t.skip(1);const n=W_(t),i=n>>5,r=31&n,o=W_(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 j;const e=this.currentTrack;if(!e)break;if(ow("video"===(null===(j=e.info)||void 0===j?void 0:j.type)),"nclx"!==X_(t,4))break;const n=$_(t),i=$_(t),r=$_(t),o=Boolean(128&W_(t));e.info.colorSpace={primaries:fw[n],transfer:mw[i],matrix:gw[r],fullRange:o}}break;case"pasp":{var q;const e=this.currentTrack;if(!e)break;ow("video"===(null===(q=e.info)||void 0===q?void 0:q.type));const n=q_(t),i=q_(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;ow("audio"===(null===(V=e.info)||void 0===V?void 0:V.type)),t.skip(4),ow(3===W_(t)),m_(t),t.skip(2);const n=W_(t),i=!!(64&n),r=!!(32&n);if(!!(128&n)&&t.skip(2),i){const e=W_(t);t.skip(e)}r&&t.skip(2),ow(4===W_(t));const o=m_(t),s=t.filePos,a=W_(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){ow(5===W_(t));const n=m_(t);if(e.info.codecDescription=z_(t,n),"aac"===e.info.codec){const t=Dw(e.info.codecDescription);null!==t.numberOfChannels&&(e.info.numberOfChannels=t.numberOfChannels),null!==t.sampleRate&&(e.info.sampleRate=t.sampleRate)}}}break;case"enda":{var H;const e=this.currentTrack;if(!e)break;ow("audio"===(null===(H=e.info)||void 0===H?void 0:H.type)),255&$_(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 G;const e=this.currentTrack;if(!e)break;ow("audio"===(null===(G=e.info)||void 0===G?void 0:G.type)),t.skip(4);const n=W_(t),i=Boolean(1&n),r=W_(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;ow("audio"===(null===(K=e.info)||void 0===K?void 0:K.type)),t.skip(1);const n=W_(t),i=$_(t),r=q_(t),o=j_(t),s=W_(t);let a;a=0!==s?z_(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;ow("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=W_(t),o=U_(t);if((r&n)===Jw.STREAMINFO){t.skip(10);const n=q_(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=z_(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;ow("audio"===(null===(Y=e.info)||void 0===Y?void 0:Y.type));const n=z_(t,3),i=new Ow(n),r=i.readBits(2);i.skipBits(8);const o=i.readBits(3),s=i.readBits(1);r<3&&(e.info.sampleRate=Uw[r]),e.info.numberOfChannels=Zw[o]+s}break;case"dec3":{var Q;const e=this.currentTrack;if(!e)break;ow("audio"===(null===(Q=e.info)||void 0===Q?void 0:Q.type));const n=(t=>{if(t.length<2)return null;const e=new Ow(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}})(z_(t,B.contentSize));if(!n){console.warn("Invalid dec3 box contents, ignoring.");break}const i=(t=>{const e=t.substreams[0];return ow(e),e.fscod<3?Uw[e.fscod]:null!==e.fscod2&&e.fscod2<3?jw[e.fscod2]:null})(n);null!==i&&(e.info.sampleRate=i),e.info.numberOfChannels=(t=>{const e=t.substreams[0];ow(e);let n=Zw[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=q_(t);let i=0,r=0;for(let o=0;o<n;o++){const n=q_(t),o=q_(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=q_(t);let i=0;for(let r=0;r<n;r++){const n=q_(t),r=V_(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=q_(t),i=q_(t);if(0===n)for(let n=0;n<i;n++){const n=q_(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=W_(t),i=q_(t),r=z_(t,Math.ceil(i*n/8)),o=new Ow(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=q_(t);for(let i=0;i<n;i++){const n=q_(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=q_(t);for(let i=0;i<n;i++){const n=q_(t)-1,i=q_(t),r=q_(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=q_(t);for(let i=0;i<n;i++){const n=q_(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=q_(t);for(let i=0;i<n;i++){const n=H_(t);e.sampleTable.chunkOffsets.push(n)}}break;case"mvex":this.isFragmented=!0,this.readContiguousBoxes(t.slice(z,B.contentSize));break;case"mehd":{const e=W_(t);t.skip(3);const n=1===e?H_(t):q_(t);this.movieDurationInTimescale=n}break;case"trex":{t.skip(4);const e=q_(t),n=q_(t),i=q_(t),r=q_(t),o=q_(t);this.fragmentTrackDefaults.push({trackId:e,defaultSampleDescriptionIndex:n,defaultSampleDuration:i,defaultSampleSize:r,defaultSampleFlags:o})}break;case"tfra":{const e=W_(t);t.skip(3);const n=q_(t),i=this.tracks.find((t=>t.id===n));if(!i)break;const r=q_(t),o=(12&r)>>2,s=3&r,a=[W_,$_,U_,q_],l=a[(48&r)>>4],c=a[o],u=a[s],d=q_(t);for(let n=0;n<d;n++){const n=1===e?H_(t):q_(t),r=1===e?H_(t):q_(t);l(t),c(t),u(t),i.fragmentLookupTable.push({timestamp:n,moofOffset:r})}i.fragmentLookupTable.sort(((t,e)=>t.timestamp-e.timestamp));for(let t=0;t<i.fragmentLookupTable.length-1;t++){const e=i.fragmentLookupTable[t],n=i.fragmentLookupTable[t+1];e.timestamp===n.timestamp&&(i.fragmentLookupTable.splice(t+1,1),t--)}}break;case"moof":this.currentFragment={moofOffset:L,moofSize:B.totalSize,implicitBaseDataOffset:L,trackData:new Map},this.readContiguousBoxes(t.slice(z,B.contentSize)),this.lastReadFragment=this.currentFragment,this.currentFragment=null;break;case"traf":if(ow(this.currentFragment),this.readContiguousBoxes(t.slice(z,B.contentSize)),this.currentTrack){const t=this.currentFragment.trackData.get(this.currentTrack.id);if(t){const{currentFragmentState:e}=this.currentTrack;ow(e),null!==e.startTimestamp&&(E_(t,e.startTimestamp),t.startTimestampIsFinal=!0)}this.currentTrack.currentFragmentState=null,this.currentTrack=null}break;case"tfhd":{var J,Z,tt,et;ow(this.currentFragment),t.skip(1);const e=U_(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=q_(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=H_(t):l&&(u.currentFragmentState.baseDataOffset=this.currentFragment.moofOffset),i&&(u.currentFragmentState.sampleDescriptionIndex=q_(t)),r&&(u.currentFragmentState.defaultSampleDuration=q_(t)),o&&(u.currentFragmentState.defaultSampleSize=q_(t)),s&&(u.currentFragmentState.defaultSampleFlags=q_(t)),a&&(u.currentFragmentState.defaultSampleDuration=0)}break;case"tfdt":{const e=this.currentTrack;if(!e)break;ow(e.currentFragmentState);const n=W_(t);t.skip(3);const i=0===n?q_(t):H_(t);e.currentFragmentState.startTimestamp=i}break;case"trun":{const e=this.currentTrack;if(!e)break;if(ow(this.currentFragment),ow(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=W_(t),i=U_(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=q_(t);let d=e.currentFragmentState.baseDataOffset;r&&(d+=V_(t));let h=null;o&&(h=q_(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=q_(t):(ow(null!==e.currentFragmentState.defaultSampleDuration),r=e.currentFragmentState.defaultSampleDuration),a?o=q_(t):(ow(null!==e.currentFragmentState.defaultSampleSize),o=e.currentFragmentState.defaultSampleSize),l?u=q_(t):(ow(null!==e.currentFragmentState.defaultSampleFlags),u=e.currentFragmentState.defaultSampleFlags),0===i&&null!==h&&(u=h);let d=0;c&&(d=0===n?q_(t):V_(t));const v=!(65536&u);m.samples.push({presentationTimestamp:p+d,duration:r,byteOffset:f,byteSize:o,isKeyFrame:v}),f+=o,p+=r}m.presentationTimestamps=m.samples.map(((t,e)=>({presentationTimestamp:t.presentationTimestamp,sampleIndex:e}))).sort(((t,e)=>t.presentationTimestamp-e.presentationTimestamp));for(let t=0;t<m.presentationTimestamps.length;t++){const e=m.presentationTimestamps[t],n=m.samples[e.sampleIndex];if(null===m.firstKeyFrameTimestamp&&n.isKeyFrame&&(m.firstKeyFrameTimestamp=n.presentationTimestamp),t<m.presentationTimestamps.length-1){const i=m.presentationTimestamps[t+1];n.duration=i.presentationTimestamp-e.presentationTimestamp}}const v=m.samples[m.presentationTimestamps[0].sampleIndex],g=m.samples[sw(m.presentationTimestamps).sampleIndex];m.startTimestamp=v.presentationTimestamp,m.endTimestamp=g.presentationTimestamp+g.duration,this.currentFragment.implicitBaseDataOffset=f}break;case"udta":{const g=this.iterateContiguousBoxes(t.slice(z,B.contentSize));for(const{boxInfo:t,slice:y}of g){if("meta"!==t.name&&!this.currentTrack){var nt,it,rt,ot,st,at,lt,ct;const e=y.filePos;null!==(it=(nt=this.metadataTags).raw)&&void 0!==it||(nt.raw={}),"©"===t.name[0]?null!==(st=(rt=this.metadataTags.raw)[ot=t.name])&&void 0!==st||(rt[ot]=v_(y)):null!==(ct=(at=this.metadataTags.raw)[lt=t.name])&&void 0!==ct||(at[lt]=z_(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=uw.decode(z_(y,t.contentSize)):null!==(n=(e=this.metadataTags).title)&&void 0!==n||(e.title=v_(y));break;case"©des":this.currentTrack||null!==(r=(i=this.metadataTags).description)&&void 0!==r||(i.description=v_(y));break;case"©ART":this.currentTrack||null!==(s=(o=this.metadataTags).artist)&&void 0!==s||(o.artist=v_(y));break;case"©alb":this.currentTrack||null!==(l=(a=this.metadataTags).album)&&void 0!==l||(a.album=v_(y));break;case"albr":this.currentTrack||null!==(u=(c=this.metadataTags).albumArtist)&&void 0!==u||(c.albumArtist=v_(y));break;case"©gen":this.currentTrack||null!==(h=(d=this.metadataTags).genre)&&void 0!==h||(d.genre=v_(y));break;case"©day":if(!this.currentTrack){var ut,dt;const t=new Date(v_(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=v_(y));break;case"©lyr":this.currentTrack||null!==(v=(m=this.metadataTags).lyrics)&&void 0!==v||(m.lyrics=v_(y))}}}break;case"meta":{if(this.currentTrack)break;const e=0!==q_(t);this.currentMetadataKeys=new Map,e?this.readContiguousBoxes(t.slice(z,B.contentSize)):this.readContiguousBoxes(t.slice(z+4,B.contentSize-4)),this.currentMetadataKeys=null}break;case"keys":{if(!this.currentMetadataKeys)break;t.skip(4);const e=q_(t);for(let n=0;n<e;n++){const e=q_(t);t.skip(4);const i=uw.decode(z_(t,e-8));this.currentMetadataKeys.set(n+1,i)}}break;case"ilst":{if(!this.currentMetadataKeys)break;const e=this.iterateContiguousBoxes(t.slice(z,B.contentSize));for(const{boxInfo:t,slice:n}of e){var ht,ft,pt,mt,vt;let e=t.name;const i=(e.charCodeAt(0)<<24)+(e.charCodeAt(1)<<16)+(e.charCodeAt(2)<<8)+e.charCodeAt(3);this.currentMetadataKeys.has(i)&&(e=this.currentMetadataKeys.get(i));const r=g_(n);switch(null!==(ft=(ht=this.metadataTags).raw)&&void 0!==ft||(ht.raw={}),null!==(vt=(pt=this.metadataTags.raw)[mt=e])&&void 0!==vt||(pt[mt]=r),e){case"©nam":case"titl":case"com.apple.quicktime.title":case"title":"string"==typeof r&&(null!==(y=(g=this.metadataTags).title)&&void 0!==y||(g.title=r));break;case"©des":case"desc":case"dscp":case"com.apple.quicktime.description":case"description":"string"==typeof r&&(null!==(k=(b=this.metadataTags).description)&&void 0!==k||(b.description=r));break;case"©ART":case"com.apple.quicktime.artist":case"artist":"string"==typeof r&&(null!==(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!==(A=(S=this.metadataTags).comment)&&void 0!==A||(S.comment=r));break;case"©gen":case"gnre":case"com.apple.quicktime.genre":case"genre":"string"==typeof r&&(null!==(M=(N=this.metadataTags).genre)&&void 0!==M||(N.genre=r));break;case"©lyr":case"lyrics":"string"==typeof r&&(null!==(C=(F=this.metadataTags).lyrics)&&void 0!==C||(F.lyrics=r));break;case"©day":case"rldt":case"com.apple.quicktime.creationdate":case"date":if("string"==typeof r){var gt,yt;const t=new Date(r);Number.isNaN(t.getTime())||null!==(yt=(gt=this.metadataTags).date)&&void 0!==yt||(gt.date=t)}break;case"covr":case"com.apple.quicktime.artwork":r instanceof Fw?(null!==(P=(O=this.metadataTags).images)&&void 0!==P||(O.images=[]),this.metadataTags.images.push({data:r.data,kind:"coverFront",mimeType:r.mimeType})):r instanceof Uint8Array&&(null!==(D=(R=this.metadataTags).images)&&void 0!==D||(R.images=[]),this.metadataTags.images.push({data:r,kind:"coverFront",mimeType:"image/*"}));break;case"track":if("string"==typeof r){var bt,kt,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=cw(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,At,Nt,Mt;const t=cw(r),e=t.getUint16(2,!1),n=t.getUint16(4,!1);e>0&&(null!==(At=(St=this.metadataTags).discNumber)&&void 0!==At||(St.discNumber=e)),n>0&&(null!==(Mt=(Nt=this.metadataTags).discsTotal)&&void 0!==Mt||(Nt.discsTotal=n))}}}}}var Ft,Ct;return t.filePos=W,!0}}class b_{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=w_(i,n),o=await this.fetchPacketForSampleIndex(r,e);return A_(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=xw(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=__(i,n),o=await this.fetchPacketForSampleIndex(r,e);return A_(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=I_(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 ow(-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=T_(n,t);if(!i)return null;let r;if(e.metadataOnly)r=i_;else{let t=this.internalTrack.demuxer.reader.requestSlice(i.sampleOffset,i.sampleSize);t instanceof Promise&&(t=await t),ow(t),r=z_(t,i.sampleSize)}const o=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,s=i.duration/this.internalTrack.timescale,a=new r_(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(ow(i),n.metadataOnly)r=i_;else{let t=this.internalTrack.demuxer.reader.requestSlice(i.byteOffset,i.byteSize);t instanceof Promise&&(t=await t),ow(t),r=z_(t,i.byteSize)}const o=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,s=i.duration/this.internalTrack.timescale,a=new r_(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=xw(this.internalTrack.fragmentLookupTable,n,(t=>t.timestamp)),h=-1!==d?this.internalTrack.fragmentLookupTable[d]:null,f=xw(this.internalTrack.fragmentPositionCache,n,(t=>t.startTimestamp)),p=-1!==f?this.internalTrack.fragmentPositionCache[f]:null,m=Math.max(null!==(o=null==h?void 0:h.moofOffset)&&void 0!==o?o:0,null!==(s=null==p?void 0:p.moofOffset)&&void 0!==s?s:0)||null;let v;for(t?null===m||t.moofOffset>=m?(v=t.moofOffset+t.moofSize,l=t):v=m:v=null!=m?m:0;;){if(l){const t=l.trackData.get(this.internalTrack.id);if(t&&t.startTimestamp>i)break}let t=a.reader.requestSliceRange(v,8,16);if(t instanceof Promise&&(t=await t),!t)break;const n=v,o=h_(t);if(!o)break;if("moof"===o.name){l=await a.readFragment(n);const{sampleIndex:t,correctSampleFound:i}=e(l);if(i)return this.fetchPacketInFragment(l,t,r);-1!==t&&(c=l,u=t)}v=n+o.totalSize}if(h&&(!c||c.moofOffset<h.moofOffset)){var g;const t=this.internalTrack.fragmentLookupTable[d-1];ow(!t||t.timestamp<h.timestamp);const n=null!==(g=null==t?void 0:t.timestamp)&&void 0!==g?g:-1/0;return this.performFragmentedLookup(null,e,n,i,r)}return c?this.fetchPacketInFragment(c,u,r):null}}class k_ extends b_{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 Qw(t)){if(1!==e)continue;const t=new Ow(n),i=t.readBits(3);t.readBits(1);const r=t.readBits(1);let o=0,s=0,a=0;if(r)o=t.readBits(5);else{if(t.readBits(1)&&(t.skipBits(32),t.skipBits(32),t.readBits(1)))return null;const e=t.readBits(1);e&&(a=t.readBits(5),t.skipBits(32),t.skipBits(5),t.skipBits(5));const n=t.readBits(5);for(let i=0;i<=n;i++){t.skipBits(12);const n=t.readBits(5);if(0===i&&(o=n),n>7){const e=t.readBits(1);0===i&&(s=e)}if(e&&t.readBits(1)){const e=a+1;t.skipBits(e),t.skipBits(e),t.skipBits(1)}t.readBits(1)&&t.skipBits(4)}}const l=t.readBits(4),c=t.readBits(4),u=l+1;t.skipBits(u);const d=c+1;t.skipBits(d);let h=0;if(h=r?0:t.readBits(1),h&&(t.skipBits(4),t.skipBits(3)),t.skipBits(1),t.skipBits(1),t.skipBits(1),!r){t.skipBits(1),t.skipBits(1),t.skipBits(1),t.skipBits(1);const e=t.readBits(1);e&&(t.skipBits(1),t.skipBits(1));let n=0;n=t.readBits(1)?2:t.readBits(1),n>0&&(t.readBits(1)||t.skipBits(1)),e&&t.skipBits(3)}t.skipBits(1),t.skipBits(1),t.skipBits(1);const f=t.readBits(1);let p=8;2===i&&f?p=t.readBits(1)?12:10:i<=2&&(p=f?10:8);let m=0;1!==i&&(m=t.readBits(1));let v=1,g=1,y=0;return m||(0===i?(v=1,g=1):1===i?(v=0,g=0):12===p&&(v=t.readBits(1),v&&(g=t.readBits(1))),v&&g&&(y=t.readBits(2))),{profile:i,level:o,tier:s,bitDepth:p,monochrome:m,chromaSubsamplingX:v,chromaSubsamplingY:g,chromaSamplePosition:y}}return null})(t.data)}}else{const t=await this.getFirstPacket({});this.internalTrack.info.vp9CodecInfo=t&&(t=>{const e=new Ow(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=sw(Bw).level;for(const t of Bw)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:zw(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 x_ extends b_{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:Ww(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 w_=(t,e)=>{if(t.presentationTimestamps){const n=xw(t.presentationTimestamps,e,(t=>t.presentationTimestamp));return-1===n?-1:t.presentationTimestamps[n].sampleIndex}{const n=xw(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)}},__=(t,e)=>{if(!t.keySampleIndices)return w_(t,e);if(t.presentationTimestamps){const n=xw(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!==kw(t.keySampleIndices,n,(t=>t)))return n}return-1}{var n;const i=w_(t,e),r=xw(t.keySampleIndices,i,(t=>t));return null!==(n=t.keySampleIndices[r])&&void 0!==n?n:-1}},T_=(t,e)=>{const n=xw(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=xw(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=xw(t.sampleToChunk,e,(t=>t.startSampleIndex)),c=t.sampleToChunk[l];ow(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];ow(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!==kw(t.keySampleIndices,e,(t=>t))}},I_=(t,e)=>{var n;if(!t.keySampleIndices)return e+1;const i=xw(t.keySampleIndices,e,(t=>t));return null!==(n=t.keySampleIndices[i+1])&&void 0!==n?n:-1},E_=(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},S_=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},A_=t=>0===t.sampleSizes.length;class N_{}class M_ extends N_{async _getMajorBrand(t){let e=t._reader.requestSlice(0,12);return e instanceof Promise&&(e=await e),e?(e.skip(4),"ftyp"!==X_(e,4)?null:X_(e,4)):null}_createDemuxer(t){return new y_(t)}}const F_=new class extends M_{async _canReadInput(t){const e=await this._getMajorBrand(t);return!!e&&"qt "!==e}get name(){return"MP4"}get mimeType(){return"video/mp4"}};class C_{constructor(){this._disposed=!1,this._sizePromise=null,this.onread=null}async getSizeOrNull(){var t;if(this._disposed)throw new R_;return null!==(t=this._sizePromise)&&void 0!==t?t:this._sizePromise=Promise.resolve(this._retrieveSize())}async getSize(){if(this._disposed)throw new R_;const t=await this.getSizeOrNull();if(null===t)throw new Error("Cannot determine the size of an unsized source.");return t}}class O_ extends C_{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&&(!Mw(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=xw(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:cw(o),offset:t};this._currentIndex>r&&this._throwDueToCacheMiss();const{promise:s,resolve:a,reject:l}=ww();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:cw(e.bytes),offset:e.start}),this._pendingSlices.splice(t,1),t--))}for(this._cache.push({start:i,end:r,bytes:n,view:cw(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!==(ce=Symbol.dispose)&&void 0!==ce||(Symbol.dispose=Symbol("Symbol.dispose"));class P_{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 N_))))throw new TypeError("options.formats must be an array of InputFormat.");if(!(t.source instanceof C_))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 D_(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(),ow(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 R_ extends Error{constructor(t="Input has been disposed."){super(t),this.name="InputDisposedError"}}class D_{constructor(t){this.source=t}requestSlice(t,e){if(this.source._disposed)throw new R_;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 L_(e.bytes,e.view,e.offset,t,n):null)):i?new L_(i.bytes,i.view,i.offset,t,n):null}requestSliceRange(t,e,n){if(this.source._disposed)throw new R_;if(t<0)return null;if(null!==this.fileSize)return this.requestSlice(t,Tw(this.fileSize-t,e,n));{const i=this.requestSlice(t,n),r=i=>{if(i)return i;const r=i=>(ow(null!==i),this.requestSlice(t,Tw(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 L_{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 L_(t,cw(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 L_(this.bytes,this.view,this.offset,t,t+e)}}const B_=(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.`)},z_=(t,e)=>{B_(t,e);const n=t.bytes.subarray(t.bufferPos,t.bufferPos+e);return t.bufferPos+=e,n},W_=t=>(B_(t,1),t.view.getUint8(t.bufferPos++)),$_=t=>{B_(t,2);const e=t.view.getUint16(t.bufferPos,!1);return t.bufferPos+=2,e},U_=t=>{B_(t,3);const e=_w(t.view,t.bufferPos);return t.bufferPos+=3,e},j_=t=>{B_(t,2);const e=t.view.getInt16(t.bufferPos,!1);return t.bufferPos+=2,e},q_=t=>{B_(t,4);const e=t.view.getUint32(t.bufferPos,!1);return t.bufferPos+=4,e},V_=t=>{B_(t,4);const e=t.view.getInt32(t.bufferPos,!1);return t.bufferPos+=4,e},H_=t=>4294967296*q_(t)+q_(t),G_=t=>4294967296*V_(t)+q_(t),K_=t=>{B_(t,8);const e=t.view.getFloat64(t.bufferPos,!1);return t.bufferPos+=8,e},X_=(t,e)=>{B_(t,e);let n="";for(let i=0;i<e;i++)n+=String.fromCharCode(t.bytes[t.bufferPos++]);return n};var Y_=new WeakMap,Q_=new WeakMap,J_=new WeakMap,Z_=new WeakMap,tT=new WeakMap,eT=new WeakMap,nT=new WeakMap,iT=new WeakMap,rT=new WeakMap,oT=new WeakMap,sT=new WeakMap,aT=new WeakMap,lT=new WeakMap,cT=new WeakMap,uT=new WeakMap,dT=new WeakSet;class hT extends Iu{constructor(...t){super(...t),O(this,dT),F(this,Y_,null),F(this,Q_,null),F(this,J_,null),F(this,Z_,null),F(this,tT,!1),F(this,eT,!1),F(this,nT,!1),F(this,iT,!1),F(this,rT,void 0),F(this,oT,null),F(this,sT,null),F(this,aT,!1),F(this,lT,!1),F(this,cT,null),F(this,uT,!1)}get name(){return"FMP4Demuxer"}get defaults(){return{}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"pushChunk","endOfStream"])}pushChunk(t,e={}){if(M(nT,this)||M(iT,this))return;const n=t instanceof Uint8Array?t:new Uint8Array(t),i=!!e.isInit;C(oT,this,A(dT,this,yT).call(this,n,e,i)),i&&(C(rT,this,n),C(sT,this,null),this.trigger("demux:init",{data:n})),A(dT,this,gT).call(this);try{var r;const t=null===(r=M(Y_,this))||void 0===r?void 0:r.write(n);t&&"function"==typeof t.catch&&t.catch((t=>{A(dT,this,bT).call(this,t)}))}catch(t){if(M(nT,this)||A(dT,this,fT).call(this,t))return;return this.log.warn("[FMP4Demuxer] mediabunny demux failed",t),void A(dT,this,bT).call(this,t)}const o=A(dT,this,wT).call(this);o&&"function"==typeof o.catch&&o.catch((t=>{A(dT,this,bT).call(this,t)}))}endOfStream(){if(M(iT,this))return;if(M(aT,this))return;let t;C(aT,this,!0),C(lT,this,!1),C(uT,this,!1);try{var e;t=null===(e=M(Y_,this))||void 0===e?void 0:e.close()}catch(e){t=Promise.resolve()}let n=!1;A(dT,this,mT).call(this),C(cT,this,setTimeout((()=>{C(cT,this,null),n||M(lT,this)||M(iT,this)||A(dT,this,vT).call(this)}),20)),Promise.resolve(t).catch((()=>{})).finally((()=>{n=!0,A(dT,this,mT).call(this),A(dT,this,vT).call(this)}))}onDispose(){super.onDispose(),C(iT,this,!0);try{var t,e;null===(t=M(J_,this))||void 0===t||null===(e=t.close)||void 0===e||e.call(t)}catch(t){}this.endOfStream();try{var n,i;null===(n=M(Q_,this))||void 0===n||null===(i=n.dispose)||void 0===i||i.call(n)}catch(t){}C(J_,this,null),C(Q_,this,null),C(nT,this,!1),C(oT,this,null),C(Z_,this,null),C(tT,this,!1),C(eT,this,!1),C(aT,this,!1),C(lT,this,!1),C(uT,this,!1),A(dT,this,mT).call(this)}}function fT(t){return!!M(iT,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 pT(){try{var t,e;const n=null===(t=M(Y_,this))||void 0===t||null===(e=t.close)||void 0===e?void 0:e.call(t);n&&"function"==typeof n.catch&&n.catch((()=>{}))}catch(t){}C(Y_,this,null)}function mT(){null!==M(cT,this)&&(clearTimeout(M(cT,this)),C(cT,this,null))}function vT(){if(M(lT,this)||M(iT,this)||M(nT,this))return;if(C(lT,this,!0),M(eT,this))return void C(uT,this,!0);C(uT,this,!1);const t=A(dT,this,wT).call(this);t&&"function"==typeof t.catch&&t.catch((t=>{A(dT,this,bT).call(this,t)}))}function gT(){if(M(Q_,this)&&M(Y_,this))return;const t=Au.TransformStream;if(void 0===t)throw new Error("TransformStream is not available in this environment");const{readable:e,writable:n}=new t;C(Y_,this,n.getWriter()),C(Q_,this,new P_({source:new O_(e),formats:[F_]})),C(tT,this,!1)}function yT(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 bT(t){if(M(nT,this)||A(dT,this,fT).call(this,t))return;if(A(dT,this,xT).call(this,t))return void C(tT,this,!1);C(nT,this,!0),A(dT,this,pT).call(this);try{var e,n;null===(e=M(J_,this))||void 0===e||null===(n=e.close)||void 0===n||n.call(e)}catch(t){}C(J_,this,null);try{var i,r;null===(i=M(Q_,this))||void 0===i||null===(r=i.dispose)||void 0===r||r.call(i)}catch(t){}C(Q_,this,null);const o={error:t,recoverable:!1,severity:"fatal",streamClosed:M(aT,this),streamFinalized:M(lT,this)};M(oT,this)&&(o.context={...M(oT,this)}),this.trigger("demux:error",o)}function kT(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 xT(t){return!!A(dT,this,kT).call(this,t)&&(!M(lT,this)||M(uT,this))}async function wT(){if(!(M(iT,this)||M(nT,this)||M(tT,this)||M(eT,this))){C(eT,this,!0);try{A(dT,this,gT).call(this);const t=await M(Q_,this).getPrimaryVideoTrack(),e=t?null:await M(Q_,this).getPrimaryAudioTrack(),n=t||e;if(!n)throw new Error("No supported tracks found in MP4");const i=await n.getDecoderConfig(),r=await n.getCodecParameterString(),o=await M(Q_,this).getMimeType();this.trigger("demux:init",{...M(rT,this)?{data:M(rT,this)}:{},decoderConfig:i,codec:r,mimeType:o}),C(J_,this,new l_(n)),C(tT,this,!0),C(Z_,this,(async()=>{try{for await(const t of M(J_,this).packets()){if(M(iT,this))break;const e="number"==typeof t.timestamp?t.timestamp:0;null===M(sT,this)&&C(sT,this,e);let n=e-M(sT,this);n<0&&(n=0),this.trigger("demux:sample",{data:t.data,pts:n,dts:n,duration:t.duration,isKey:"key"===t.type})}this.trigger("demux:complete")}catch(t){A(dT,this,bT).call(this,t)}})())}catch(t){if(A(dT,this,xT).call(this,t))return;throw t}finally{C(eT,this,!1),!M(uT,this)||M(nT,this)||M(iT,this)||A(dT,this,vT).call(this)}}}const _T=1e6,TT=24e3/1001,IT={primaries:"bt709",transfer:"bt709",matrix:"bt709",fullRange:!0},ET=new Uint8Array;function ST(t){return t?t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):ET:ET}let AT=null;const NT={video:(ue=new WeakMap,de=new WeakMap,he=new WeakMap,fe=new WeakMap,pe=new WeakMap,me=new WeakMap,ve=new WeakMap,ge=new WeakMap,ye=new WeakMap,be=new WeakMap,ke=new WeakMap,xe=new WeakMap,we=new WeakMap,_e=new WeakMap,Te=new WeakMap,Ie=new WeakMap,Ee=new WeakMap,Se=new WeakMap,Ae=new WeakMap,Ne=new WeakMap,Me=new WeakMap,Fe=new WeakMap,Ce=new WeakMap,Oe=new WeakMap,Pe=new WeakMap,Re=new WeakMap,De=new WeakMap,Le=new WeakMap,Be=new WeakMap,ze=new WeakMap,We=new WeakMap,$e=new WeakMap,Ue=new WeakMap,je=new WeakMap,qe=new WeakSet,class extends rw{get name(){return"WebCodecsSegmentDecoder"}get defaults(){return{decodedHorizonSeconds:1,maxDecodedFrames:24,maxDecodeQueueSize:4,av1ColorSpaceOverrideEnabled:!0,convertFramesToBitmapsOnAndroid:!0,androidFixEndOfSegmentDelta:.2}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"decodeChunk"])}constructor(...t){super(...t),O(this,qe),F(this,ue,void 0),F(this,de,[]),F(this,he,void 0),F(this,fe,void 0),F(this,pe,void 0),F(this,me,void 0),F(this,ve,[]),F(this,ge,void 0),F(this,ye,new Map),F(this,be,!0),F(this,ke,!1),F(this,xe,!1),F(this,we,!1),F(this,_e,void 0),F(this,Te,!1),F(this,Ie,!1),F(this,Ee,0),F(this,Se,void 0),F(this,Ae,void 0),F(this,Ne,{}),F(this,Me,void 0),F(this,Fe,0),F(this,Ce,null),F(this,Oe,!1),F(this,Pe,null),F(this,Re,void 0),F(this,De,0),F(this,Le,0),F(this,Be,0),F(this,ze,0),F(this,We,!1),F(this,$e,!1),F(this,Ue,.2),F(this,je,Promise.resolve()),C(he,this,this.settings.decodedHorizonSeconds||1),C(fe,this,A(qe,this,kI).call(this,this.settings.maxDecodedFrames)),C(pe,this,A(qe,this,wI).call(this,this.settings.maxDecodeQueueSize)),C(We,this,gm()),C($e,this,A(qe,this,hI).call(this,this.settings.convertFramesToBitmapsOnAndroid)),C(Ue,this,A(qe,this,fI).call(this,this.settings.androidFixEndOfSegmentDelta)),C(me,this,(()=>0)),C(ge,this,(()=>A(qe,this,nI).call(this)));const e=this.settings.demuxerOptions?{FMP4Demuxer:this.settings.demuxerOptions}:{};C(ue,this,new hT(e)),M(ue,this).on("demux:init",(t=>A(qe,this,HT).call(this,t))),M(ue,this).on("demux:sample",(t=>A(qe,this,GT).call(this,t))),M(ue,this).on("demux:complete",(()=>A(qe,this,KT).call(this))),M(ue,this).on("demux:error",(t=>A(qe,this,RT).call(this,t)))}setCurrentTimeProvider(t){"function"==typeof t&&C(me,this,t)}setTimeOffsetSeconds(t){const e=Number(t);C(Fe,this,Number.isFinite(e)?e:0)}setSeekTargetTimeSeconds(t){const e=Number(t);C(Ce,this,Number.isFinite(e)?e:null),C(Oe,this,!1),C(Pe,this,null)}endOfStream(){M(ue,this)&&"function"==typeof M(ue,this).endOfStream&&M(ue,this).endOfStream()}configure(t){super.configure(t),C(Ne,this,{codec:A(qe,this,SI).call(this,t),width:(null==t?void 0:t.codedWidth)||(null==t?void 0:t.width),height:(null==t?void 0:t.codedHeight)||(null==t?void 0:t.height)}),C(Se,this,M(Ne,this).codec)}setSegment(t){this.lastSegment=t,A(qe,this,UT).call(this)}setNodeId(t){C(Re,this,t)}decode(t){this.setSegment(t);const e=null==t?void 0:t.arrayBuffer;e&&M(ue,this).pushChunk(e,{isInit:!(null==t||!t.isInit)})}async decodeChunk(t,e={}){await M(ue,this).pushChunk(t,{isInit:!!e.isInit,pts:"number"==typeof e.pts?e.pts:void 0,dts:"number"==typeof e.dts?e.dts:void 0,duration:"number"==typeof e.duration?e.duration:void 0,isKey:!!e.isKey,loaded:"number"==typeof e.loaded?e.loaded:void 0,total:"number"==typeof e.total?e.total:void 0})}get decodedFrames(){return M(de,this).slice()}onDispose(){if(super.onDispose(),A(qe,this,oI).call(this),M(ue,this)&&"function"==typeof M(ue,this).dispose&&M(ue,this).dispose(),C(de,this,[]),C(ve,this,[]),M(ye,this).clear(),C(Pe,this,null),M(_e,this)&&"function"==typeof M(_e,this).close)try{M(_e,this).close()}catch(t){}C(_e,this,null),C(Te,this,!1),C(Ae,this,null),C(Se,this,null),C(Re,this,null),C(je,this,Promise.resolve()),A(qe,this,UT).call(this)}}),audio:(Ve=new WeakMap,He=new WeakMap,Ge=new WeakMap,Ke=new WeakMap,Xe=new WeakMap,Ye=new WeakMap,Qe=new WeakMap,Je=new WeakSet,class extends rw{constructor(...t){super(...t),O(this,Je),F(this,Ve,void 0),F(this,He,[]),F(this,Ge,0),F(this,Ke,!1),F(this,Xe,!1),F(this,Ye,void 0),F(this,Qe,0)}get name(){return"WebAudioDecoder"}setSegment(t){C(Ye,this,t)}setTimeOffsetSeconds(t){const e=Number(t);C(Qe,this,Number.isFinite(e)?e:0)}decode(t){if(this.lastSegment=t,!t)return;if(t.isInit)return void C(Ve,this,ST(t.arrayBuffer));const e=t.arrayBuffer;e&&A(Je,this,CT).call(this,ST(e),!0)}decodeChunk(t,e={}){if(!t)return;if(e.isInit)return void C(Ve,this,ST(t));const n=ST(t);if(!n.length)return;M(He,this).push(n),C(Ge,this,M(Ge,this)+n.length);const i=Number(e.loaded),r=Number(e.total);Number.isFinite(i)&&Number.isFinite(r)&&r>0&&i>=r&&A(Je,this,MT).call(this)}endOfStream(){A(Je,this,MT).call(this)}onDispose(){super.onDispose(),C(Ve,this,void 0),C(He,this,[]),C(Ge,this,0),C(Ke,this,!1),C(Xe,this,!1),C(Ye,this,void 0)}}),image:class extends rw{#z;#W=0;#$=[];#U=0;#j;get name(){return"ImageDecoder"}setSegment(t){this.#z=t}setTimeOffsetSeconds(t){const e=Number(t);this.#W=Number.isFinite(e)?e:0}decode(t){super.decode(t),t&&(this.#z=t);const e=null==t?void 0:t.arrayBuffer;e instanceof ArrayBuffer&&(this.#$=[new Uint8Array(e)],this.#U=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.#$.push(n),this.#U+=n.length)}async endOfStream(){var t,e,n;if(this.#j)return;if(!(this.#$.length&&this.#U>0))return;const i=new Uint8Array(this.#U);let r=0;for(let t=0;t<this.#$.length;t+=1){const e=this.#$[t];i.set(e,r),r+=e.length}const o=null===(t=this.#z)||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 Au.Blob)return;const n="string"==typeof e?e:"";return new Au.Blob([t],n?{type:n}:void 0)}(t,e);if(!n)throw new Error("Image decode requires Blob support");let i;if("function"==typeof Au.Image&&Au.URL&&"function"==typeof Au.URL.createObjectURL&&"function"==typeof Au.URL.revokeObjectURL){const t=Au.URL.createObjectURL(n);try{const e=new Au.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{Au.URL.revokeObjectURL(t)}}if("function"==typeof Au.createImageBitmap)try{return Au.createImageBitmap(n)}catch(t){i=t}if(i)throw i;throw new Error("No supported image decode mechanism")}(i,s);this.#j=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&&(eg(o.width)||(o.width=e.width),eg(o.height)||(o.height=e.height)),this.trigger("decoder:frame",{pts:this.#W,duration:eg(null===(a=this.#z)||void 0===a?void 0:a.duration)?this.#z.duration:null===(l=this.track)||void 0===l?void 0:l.duration,frame:t})}catch(t){this.trigger("decoder:error",{error:t})}}onDispose(){if(super.onDispose(),this.#j&&"function"==typeof this.#j.close)try{this.#j.close()}catch(t){}this.#j=null,this.#$=[],this.#U=0,this.#z=null}}};function MT(){if(M(Ke,this)||M(Xe,this))return;if(!M(Ge,this))return;const t=A(Je,this,FT).call(this);t.length&&A(Je,this,CT).call(this,t,!1)}function FT(){const t=M(Ve,this),e=t?t.length:0,n=e+M(Ge,this);if(!n)return ET;const i=new Uint8Array(n);let r=0;e&&(i.set(t,r),r+=e);for(let t=0;t<M(He,this).length;t+=1){const e=M(He,this)[t];e&&e.length&&(i.set(e,r),r+=e.length)}return i}function CT(t,e){if(M(Ke,this)||M(Xe,this))return;const n=e?A(Je,this,OT).call(this,t):t;if(!n||!n.length)return;const i=function(){if(AT)return AT;const t=Au.AudioContext||Au.webkitAudioContext;return t?(AT=new t,AT):null}();if(!i||"function"!=typeof i.decodeAudioData)return void this.trigger("decoder:error",{error:new Error("AudioContext is not available")});const r=n.buffer.slice(0);C(Xe,this,!0),new Promise(((t,e)=>{const n=i.decodeAudioData(r,t,e);n&&"function"==typeof n.then&&n.then(t).catch(e)})).then((t=>{var e;C(Ke,this,!0);const n=Number.isFinite(null==t?void 0:t.duration)?t.duration:Number(null===(e=M(Ye,this))||void 0===e?void 0:e.duration)||void 0;this.trigger("decoder:audio",{audioBuffer:t,pts:M(Qe,this),duration:n})})).catch((t=>{this.trigger("decoder:error",{error:t})})).finally((()=>{C(He,this,[]),C(Ge,this,0),C(Xe,this,!1)}))}function OT(t){const e=M(Ve,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 PT(t,e){var n,i,r,o,s;const a=null!=t&&t.context&&"object"==typeof t.context?t.context:void 0;return{error:e,errorName:null==e?void 0:e.name,errorMessage:"string"==typeof(null==e?void 0:e.message)?e.message:void 0,nodeId:M(Re,this),trackId:null===(n=this.track)||void 0===n?void 0:n.id,trackType:null===(i=this.track)||void 0===i?void 0:i.type,codec:(null===(r=M(Ne,this))||void 0===r?void 0:r.codec)||M(Se,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 RT(t){const e=(null==t?void 0:t.error)||t,n=A(qe,this,PT).call(this,t,e);if(A(qe,this,DT).call(this,t,e))return this.log.warn("[onDemuxError] recoverable demux error",n),void A(qe,this,KT).call(this);const i=A(qe,this,VT).call(this,t),r=A(qe,this,LT).call(this,i);if(i&&0===i.missingFrames)return this.log.warn(`[onDemuxError] ignoring demux error (no missing frames)${r}`,{...n,missingFrameStats:i}),void A(qe,this,KT).call(this);let o=n;i&&(o={...n,missingFrameStats:i}),this.log.warn(`[onDemuxError] demux error${r}`,o),this.trigger("decoder:error",t)}function DT(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 LT(t){return t?` expectedFrames=${A(qe,this,BT).call(this,t.expectedFrames)} demuxedFrames=${A(qe,this,BT).call(this,t.demuxedFrames)} missingFrames=${A(qe,this,BT).call(this,t.missingFrames)}`:""}function BT(t){if(null==t)return"unknown";const e=Number(t);return Number.isFinite(e)?String(e):"unknown"}function zT(t,e={}){return{expectedFrames:null,demuxedFrames:M(De,this),missingFrames:null,reason:t,...e}}function WT(t){const e=Number(t);return Number.isFinite(e)?e:null}function $T(t){var e,n;const i=(null==t?void 0:t.context)||{},r=Number(i.loaded),o=Number(i.total);if(!Number.isFinite(o)||o<=0||!Number.isFinite(r)||r<o)return null;if(null!==(e=this.lastSegment)&&void 0!==e&&e.isInit)return null;const s=Number(null===(n=this.lastSegment)||void 0===n?void 0:n.duration);if(!Number.isFinite(s)||s<=0)return A(qe,this,zT).call(this,"segment_duration_unavailable",{segmentDurationSeconds:A(qe,this,WT).call(this,s),demuxedCoverageSeconds:M(ze,this),frameDurationSeconds:null});const a=A(qe,this,qT).call(this);if(!Number.isFinite(a)||a<=0){const t=Math.max(1,Math.round(s*TT));return{expectedFrames:t,demuxedFrames:M(De,this),missingFrames:Math.max(0,t-M(De,this)),reason:"fallback_fps",fallbackFps:TT,segmentDurationSeconds:s,demuxedCoverageSeconds:M(ze,this),frameDurationSeconds:A(qe,this,WT).call(this,a)}}const l=Math.min(.5*a,.02),c=Math.max(0,s-M(ze,this)),u=c<=l?0:c,d=Math.max(1,Math.floor((s+l)/a)),h=Math.max(0,d-M(De,this)),f=u>0?Math.ceil(u/a):0;return{expectedFrames:d,demuxedFrames:M(De,this),missingFrames:Math.max(h,f),segmentDurationSeconds:s,demuxedCoverageSeconds:M(ze,this),frameDurationSeconds:a}}function UT(){C(De,this,0),C(Le,this,0),C(Be,this,0),C(ze,this,0)}function jT(t){C(De,this,M(De,this)+1);const e=Number(null==t?void 0:t.pts),n=Number(null==t?void 0:t.duration);if(Number.isFinite(n)&&n>0&&(C(Le,this,M(Le,this)+n),C(Be,this,M(Be,this)+1)),!Number.isFinite(e))return;const i=Number.isFinite(n)&&n>0?e+n:e;Number.isFinite(i)&&i>M(ze,this)&&C(ze,this,i)}function qT(){return M(Be,this)>0?M(Le,this)/M(Be,this):M(De,this)>0&&M(ze,this)>0?M(ze,this)/M(De,this):null}function VT(t){return A(qe,this,$T).call(this,t)}function HT(t){(null==t?void 0:t.data)instanceof Uint8Array&&(C(Ae,this,t.data.buffer),A(qe,this,aI).call(this)),null!=t&&t.decoderConfig&&(C(Me,this,t.decoderConfig),C(Se,this,t.decoderConfig.codec||M(Se,this)),A(qe,this,aI).call(this)),this.trigger("decoder:init",t)}function GT(t){A(qe,this,jT).call(this,t),M(ve,this).push(t),A(qe,this,nI).call(this)}function KT(){C(ke,this,!0),A(qe,this,cI).call(this)}function XT(t){const e="number"==typeof(null==t?void 0:t.pts)?t.pts:void 0;if(Number.isFinite(e))return M(Fe,this)+e}function YT(t){return M(ve,this).some((e=>{const n=A(qe,this,XT).call(this,e);return Number.isFinite(n)&&n>=t}))}function QT(t){let e=-1,n=null;for(let i=0;i<M(ve,this).length;i+=1){const r=M(ve,this)[i],o=A(qe,this,XT).call(this,r);Number.isFinite(o)&&(null==r?void 0:r.isKey)&&o<=t&&(e=i,n=o)}return{chosenIndex:e,chosenPtsSeconds:n}}function JT(t){let e=-1,n=null;for(let i=0;i<M(ve,this).length;i+=1){const r=M(ve,this)[i],o=A(qe,this,XT).call(this,r);if(Number.isFinite(o)&&null!=r&&r.isKey&&(e=i,n=o,o>=t))break}return{chosenIndex:e,chosenPtsSeconds:n}}function ZT(t){const e=t+M(he,this),n=M(Ce,this);if(!Number.isFinite(n))return e;const i=Number.isFinite(M(Pe,this))?M(Pe,this):null;if(Number.isFinite(i))return Math.max(e,i);const{chosenPtsSeconds:r}=A(qe,this,JT).call(this,n);return Number.isFinite(r)?Math.max(e,r):e}function tI(t){const e=M(Ce,this);Number.isFinite(e)&&Number.isFinite(t)&&t>=e&&(C(Ce,this,null),C(Pe,this,null))}function eI(){const t=M(Ce,this);if(!Number.isFinite(t)||M(Oe,this))return!0;if(!A(qe,this,YT).call(this,t)&&!M(ke,this))return!1;const e=A(qe,this,QT).call(this,t);let n=e;if(-1===e.chosenIndex&&(n=A(qe,this,JT).call(this,t)),n.chosenIndex>0){const t=`[#maybeAlignToSeekKeyframe] Dropping ${n.chosenIndex} samples before keyframe @ ${n.chosenPtsSeconds}`;this.log.debug(t),M(ve,this).splice(0,n.chosenIndex)}return C(be,this,!0),Number.isFinite(n.chosenPtsSeconds)&&C(Pe,this,n.chosenPtsSeconds),C(Oe,this,!0),!0}function nI(){const t=M(me,this)?M(me,this).call(this):0,e=A(qe,this,ZT).call(this,t);if(A(qe,this,yI).call(this,t),A(qe,this,bI).call(this),!A(qe,this,eI).call(this))return void A(qe,this,rI).call(this);const n=void 0!==Au.VideoDecoder&&void 0!==Au.EncodedVideoChunk;for(n&&!M(Te,this)&&M(Me,this)&&A(qe,this,aI).call(this);M(ve,this).length&&!A(qe,this,xI).call(this)&&!(n&&M(_e,this)&&A(qe,this,_I).call(this));){const t=M(ve,this)[0],i="number"==typeof(null==t?void 0:t.pts)?t.pts:0,r=M(Fe,this)+i;if(r>e)break;if(null!=t&&t.raw)M(ve,this).shift(),A(qe,this,iI).call(this,t);else{if(n){if(!M(Te,this)||!M(_e,this))break;if(M(be,this)&&!t.isKey){M(ve,this).shift();continue}M(ve,this).shift();const e=Math.max(0,Math.round(r*_T));M(ye,this).set(e,!!t.isKey);try{const n=new Au.EncodedVideoChunk({type:t.isKey?"key":"delta",timestamp:e,duration:t.duration?Math.round(t.duration*_T):void 0,data:t.data instanceof Uint8Array?t.data:new Uint8Array(t.data)});M(_e,this).decode(n),t.isKey&&C(be,this,!1);continue}catch(t){M(ye,this).delete(e);const n="string"==typeof(null==t?void 0:t.message)?t.message:"";if("DataError"===(null==t?void 0:t.name)&&n.includes("key frame")){C(be,this,!0);continue}this.log.warn("[#drainDecodeQueue] decode failed, falling back to placeholder",t)}}M(ve,this).shift(),A(qe,this,iI).call(this,t)}}A(qe,this,cI).call(this),A(qe,this,rI).call(this)}function iI(t){const e=M(me,this)?M(me,this).call(this):0,n=A(qe,this,ZT).call(this,e),i=M(Fe,this)+("number"==typeof t.pts?t.pts:0);if(i<e||i>n)return;A(qe,this,yI).call(this,e);const r={pts:i,duration:t.duration,data:t.data,isKey:t.isKey};M(de,this).push(r),A(qe,this,bI).call(this),this.trigger("decoder:frame",r),A(qe,this,tI).call(this,i)}function rI(){if(M(ve,this).length>0&&void 0!==Au.VideoDecoder){if(hk(M(ge,this)))return;uk(M(ge,this),50)}else A(qe,this,oI).call(this)}function oI(){M(ge,this)&&hk(M(ge,this))&&dk(M(ge,this))}function sI(){return null!=Au&&Au.performance&&"function"==typeof Au.performance.now?Au.performance.now():Date.now()}function aI(){if(M(Te,this))return;if(void 0===Au.VideoDecoder)return;if(!M(Me,this))return;if(M(Ie,this)&&A(qe,this,sI).call(this)<M(Ee,this))return;const t=A(qe,this,lI).call(this);try{C(_e,this,new Au.VideoDecoder({output:t=>A(qe,this,dI).call(this,t),error:t=>A(qe,this,uI).call(this,t)})),M(_e,this).configure(t),C(Te,this,!0),C(be,this,!0),C(Ie,this,!1),C(Ee,this,0),A(qe,this,nI).call(this)}catch(t){this.log.warn("[#maybeConfigureDecoder] configure failed, falling back to placeholder decode",t),C(_e,this,null),C(Te,this,!1),C(Me,this,null)}}function lI(){const t={...M(Me,this)};return A(qe,this,II).call(this,t)&&M(Ne,this).codec?t.codec=M(Ne,this).codec:!t.codec&&M(Se,this)&&(t.codec=M(Se,this)),M(Ae,this)&&!t.description&&(t.description=M(Ae,this)),M(Ne,this).width&&!t.codedWidth&&(t.codedWidth=M(Ne,this).width),M(Ne,this).height&&!t.codedHeight&&(t.codedHeight=M(Ne,this).height),A(qe,this,EI).call(this,t),t}function cI(){void 0!==Au.VideoDecoder&&void 0!==Au.EncodedVideoChunk&&(M(Ie,this)||!M(ke,this)||M(we,this)||M(xe,this)||M(Te,this)&&M(_e,this)&&"function"==typeof M(_e,this).flush&&(M(ve,this).length||(C(xe,this,!0),Promise.resolve().then((()=>M(_e,this).flush())).then((()=>{C(we,this,!0),C(be,this,!0)})).catch((t=>{"AbortError"!==(null==t?void 0:t.name)&&this.log.warn("[#maybeFlushDecoder] flush failed",t)})).finally((()=>{C(xe,this,!1)})))))}function uI(t){if(this.log.warn("[#handleDecoderError] decoder error",t),this.trigger("decoder:error",{error:t}),M(_e,this)&&"function"==typeof M(_e,this).close)try{M(_e,this).close()}catch(t){}C(_e,this,null),C(Te,this,!1),C(xe,this,!1),C(we,this,!1),C(be,this,!0),M(ye,this).clear(),C(Ie,this,!0),C(Ee,this,A(qe,this,sI).call(this)+1e3)}function dI(t){C(je,this,M(je,this).then((()=>{var e;if(!this._disposed)return A(qe,this,gI).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 hI(t){return"boolean"!=typeof t||t}function fI(t){const e=Number(t);return!Number.isFinite(e)||e<0?.2:e}function pI(){return!!M($e,this)&&"function"==typeof Au.createImageBitmap&&M(We,this)}function mI(t){var e;const n=Number(null===(e=this.lastSegment)||void 0===e?void 0:e.duration);if(!Number.isFinite(n)||n<=0)return!1;if(!Number.isFinite(t))return!1;const i=Number(M(Fe,this));return!!Number.isFinite(i)&&t>=i+n-M(Ue,this)}async function vI(t,e){try{var n;const i=A(qe,this,mI).call(this,e),r=await Au.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 gI(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/_T:M(me,this)?M(me,this).call(this):0,s="number"==typeof t.duration?t.duration/_T:void 0;let a;void 0!==r&&(a=M(ye,this).get(r),M(ye,this).delete(r));try{var l,c,u,d;let e=M(me,this)?M(me,this).call(this):0,n=A(qe,this,ZT).call(this,e);if(o<e||o>n)return void(null===(l=(c=i).close)||void 0===l||l.call(c));if(A(qe,this,pI).call(this)){var h,f,p,m;if(i=await A(qe,this,vI).call(this,t,o),this._disposed)return void(null===(h=(f=i).close)||void 0===h||h.call(f));if(e=M(me,this)?M(me,this).call(this):0,n=A(qe,this,ZT).call(this,e),o<e||o>n)return void(null===(p=(m=i).close)||void 0===p||p.call(m))}if(A(qe,this,yI).call(this,e),this._disposed)return void(null===(u=(d=i).close)||void 0===u||u.call(d));const r={frame:i,pts:o,duration:s,isKey:void 0!==a&&a};M(de,this).push(r),A(qe,this,bI).call(this),this.trigger("decoder:frame",r),A(qe,this,tI).call(this,o),this.log.debug(`[#handleDecodedFrame] [${M(Ne,this).codec}] Decoded frame:`,r)}catch(t){this.log.warn(`[#handleDecodedFrame] [${M(Ne,this).codec}] Failed to handle decoded frame`,t);try{var v,g;null===(v=(g=i).close)||void 0===v||v.call(g)}catch(t){}}}function yI(t){const e=A(qe,this,ZT).call(this,t),n=[];M(de,this).forEach((i=>{var r;const o=null!==(r=null==i?void 0:i.pts)&&void 0!==r?r:0;o<t||o>e||n.push(i)})),C(de,this,n)}function bI(){const t=M(fe,this);if(!Number.isFinite(t)||t<=0)return;if(M(de,this).length<=t)return;const e=M(de,this).length-t;M(de,this).splice(0,e)}function kI(t){const e=Number(t);return!Number.isFinite(e)||e<=0?0:Math.floor(e)}function xI(){const t=M(fe,this);return!(!Number.isFinite(t)||t<=0)&&M(de,this).length>=t}function wI(t){const e=Number(t);return!Number.isFinite(e)||e<=0?0:Math.floor(e)}function _I(){var t;const e=M(pe,this);if(!Number.isFinite(e)||e<=0)return!1;const n=Number(null===(t=M(_e,this))||void 0===t?void 0:t.decodeQueueSize);return!!Number.isFinite(n)&&n>=e}function TI(t){return"string"==typeof t&&t.toLowerCase().startsWith("av01")}function II(t){var e;return!1!==this.settings.av1ColorSpaceOverrideEnabled&&A(qe,this,TI).call(this,(null===(e=M(Ne,this))||void 0===e?void 0:e.codec)||(null==t?void 0:t.codec))}function EI(t){A(qe,this,II).call(this,t)&&(t.colorSpace={...IT})}function SI(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 AI extends Iu{#q;get name(){return"DecoderFactory"}constructor(...t){super(...t);const e=t.length?t[t.length-1]:void 0;this.#q=e&&"object"==typeof e&&!Array.isArray(e)?e:{}}create(t,e=this.#q){if(!t||!t.type)return new rw(e);const n=NT[t.type];return n?(this.log.debug(`[#create] [${t.type}] Creating decoder:`,n),new n(e)):new rw(e)}}class NI{#V;#H;#G;#K;constructor(t={}){this.#V=t.getActiveRenderPlacement,this.#H=t.getPlacementsActiveAtTime,this.#G=t.ensureDecodedForPlacementAtTime;const e=Number(t.lookaheadSeconds);this.#K=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.#G)return;const n="function"==typeof this.#H?this.#H:()=>[],i=n(e),r=new Set;i.forEach((t=>{null!=t&&t.placementId&&r.add(t.placementId),this.#G(t,e)}));const o=this.#K;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.#G(t,s)}))}dispose(){}}class MI{#X;#Y;#Q;#J;#Z;#tt;constructor(t={}){this.#X=t.getNode,this.#Y=t.getPlacementState,this.#Q=t.getDecodeTracks,this.#J=t.getSegmentIdForTrackAtTime,this.#Z=t.decodeLoadedMediaSegment,this.#tt=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.#X?this.#X(i):void 0;if(!r)return;const o="function"==typeof this.#Y?this.#Y(n):void 0,s=null==o?void 0:o.trackStates;s&&"function"==typeof s.get&&("function"==typeof this.#Q?this.#Q(r).filter((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.#J?this.#J(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.#Z||this.#Z(t,n,a),"video"===(null==n?void 0:n.type)&&"function"==typeof this.#tt&&this.#tt(t,n,a))}))}dispose(){}}const FI=new Set(["video","audio","image"]);function CI(t){const e=Number(t);return Number.isFinite(e)?e:0}var OI=new WeakMap,PI=new WeakMap,RI=new WeakMap,DI=new WeakMap,LI=new WeakMap,BI=new WeakMap,zI=new WeakMap,WI=new WeakMap,$I=new WeakMap,UI=new WeakMap,jI=new WeakMap,qI=new WeakMap,VI=new WeakMap,HI=new WeakMap,GI=new WeakMap,KI=new WeakMap,XI=new WeakMap,YI=new WeakMap,QI=new WeakMap,JI=new WeakSet;class ZI extends Iu{constructor(...t){super(...t),O(this,JI),F(this,OI,void 0),F(this,PI,void 0),F(this,RI,void 0),F(this,DI,void 0),F(this,LI,void 0),F(this,BI,void 0),F(this,zI,void 0),F(this,WI,void 0),F(this,$I,void 0),F(this,UI,void 0),F(this,jI,void 0),F(this,qI,new Map),F(this,VI,new Map),F(this,HI,new Map),F(this,GI,new Map),F(this,KI,new Set),F(this,XI,0),F(this,YI,!1),F(this,QI,null);const[e,n,i]=t;C(OI,this,e),C(PI,this,n),C(RI,this,i||new AI),C(DI,this,new MI({getNode:t=>A(JI,this,TE).call(this,t),getPlacementState:t=>M(qI,this).get(t),getDecodeTracks:t=>A(JI,this,bE).call(this,t),getSegmentIdForTrackAtTime:(t,e,n)=>A(JI,this,aE).call(this,t,e,n),decodeLoadedMediaSegment:(t,e,n)=>{A(JI,this,qE).call(this,t,e,n)},decodeLoadedMediaSegmentsAfter:(t,e,n)=>{A(JI,this,DE).call(this,t,e,n)}})),C(LI,this,new NI({getActiveRenderPlacement:t=>{var e,n;return null===(e=M(PI,this))||void 0===e||null===(n=e.getActiveRenderPlacement)||void 0===n?void 0:n.call(e,t)},getPlacementsActiveAtTime:t=>{var e,n;return(null===(e=M(PI,this))||void 0===e||null===(n=e.getPlacementsActiveAtTime)||void 0===n?void 0:n.call(e,t))||[]},ensureDecodedForPlacementAtTime:(t,e)=>{var n,i;null===(n=M(DI,this))||void 0===n||null===(i=n.ensureDecodedForPlacementAtTime)||void 0===i||i.call(n,t,e)}})),A(JI,this,tE).call(this),A(JI,this,vE).call(this)}get name(){return"DecodeCoordinator"}onDispose(){var t,e;M(PI,this)&&"function"==typeof M(PI,this).off&&M(BI,this)&&M(PI,this).off(Im.PLACEMENT_ADDED,M(BI,this)),M(PI,this)&&"function"==typeof M(PI,this).off&&M(zI,this)&&M(PI,this).off(Im.TIMELINE_SEEKING,M(zI,this)),M(PI,this)&&"function"==typeof M(PI,this).off&&M(WI,this)&&M(PI,this).off(Im.TIMELINE_SEEKED,M(WI,this)),M(PI,this)&&"function"==typeof M(PI,this).off&&M($I,this)&&M(PI,this).off(Im.TIMELINE_TIME_UPDATE,M($I,this)),M(PI,this)&&"function"==typeof M(PI,this).off&&M(UI,this)&&M(PI,this).off(Im.TIMELINE_RESET,M(UI,this)),A(JI,this,eE).call(this),C(BI,this,null),C(zI,this,null),C(WI,this,null),C($I,this,null),C(UI,this,null),null!==(t=M(DI,this))&&void 0!==t&&null!==(e=t.dispose)&&void 0!==e&&e.call(t),C(DI,this,null),M(LI,this)&&"function"==typeof M(LI,this).dispose&&M(LI,this).dispose(),C(LI,this,null),M(VI,this).forEach(((t,e)=>{const n=A(JI,this,TE).call(this,e);n&&"function"==typeof n.off&&n.off("node:loaded",t)})),M(VI,this).clear(),M(HI,this).forEach(((t,e)=>{const n=A(JI,this,TE).call(this,e);n&&"function"==typeof n.off&&n.off("segment:chunk",t)})),M(HI,this).clear(),M(GI,this).clear(),M(KI,this).clear(),A(JI,this,hE).call(this),M(qI,this).forEach((({trackStates:t})=>{t&&t.forEach((t=>{A(JI,this,AE).call(this,t)}))})),M(qI,this).clear()}}function tE(){M(PI,this)&&"function"==typeof M(PI,this).on&&(C(BI,this,(t=>{A(JI,this,gE).call(this,t)})),M(PI,this).on(Im.PLACEMENT_ADDED,M(BI,this)),C(zI,this,(t=>A(JI,this,nE).call(this,t))),M(PI,this).on(Im.TIMELINE_SEEKING,M(zI,this)),C(WI,this,(()=>A(JI,this,iE).call(this))),M(PI,this).on(Im.TIMELINE_SEEKED,M(WI,this)),C($I,this,(t=>A(JI,this,rE).call(this,t))),M(PI,this).on(Im.TIMELINE_TIME_UPDATE,M($I,this)),C(UI,this,(()=>A(JI,this,oE).call(this))),M(PI,this).on(Im.TIMELINE_RESET,M(UI,this))),(null==Au?void 0:Au.document)&&"function"==typeof Au.document.addEventListener&&(C(jI,this,(()=>{A(JI,this,fE).call(this)})),Au.document.addEventListener("visibilitychange",M(jI,this)))}function eE(){M(jI,this)&&null!=Au&&Au.document&&"function"==typeof Au.document.removeEventListener&&Au.document.removeEventListener("visibilitychange",M(jI,this)),C(jI,this,null)}function nE(t={}){const e=Number(null==t?void 0:t.targetTime);Number.isFinite(e)&&(M(qI,this).forEach((t=>{const n=null==t?void 0:t.trackStates;n&&n.forEach((n=>{var i;const r=null==n||null===(i=n.track)||void 0===i?void 0:i.type;"video"!==r&&"image"!==r&&"audio"!==r||(A(JI,this,sE).call(this,n,null==t?void 0:t.placement,e),n.seekSegmentId=null)}))})),(Array.isArray(null==t?void 0:t.placements)?t.placements:[]).forEach((t=>{const n=null==t?void 0:t.placementId,i=null==t?void 0:t.nodeId;if(!n||!i)return;const r=M(qI,this).get(n);if(!r||!r.trackStates)return;const o=A(JI,this,TE).call(this,i);o&&(r.trackStates.forEach((n=>{const i=null==n?void 0:n.track;!i||"video"!==i.type&&"image"!==i.type&&"audio"!==i.type||A(JI,this,sE).call(this,n,r.placement||t,e)})),A(JI,this,RE).call(this,r.placement||t,o))})))}function iE(){M(qI,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 rE(t={}){var e,n;A(JI,this,PE).call(this,null==t?void 0:t.time),null!==(e=M(LI,this))&&void 0!==e&&null!==(n=e.handleTimeUpdate)&&void 0!==n&&n.call(e,t),A(JI,this,fE).call(this),A(JI,this,NE).call(this,null==t?void 0:t.time)}function oE(){M(VI,this).forEach(((t,e)=>{const n=A(JI,this,TE).call(this,e);n&&"function"==typeof n.off&&n.off("node:loaded",t)})),M(VI,this).clear(),M(HI,this).forEach(((t,e)=>{const n=A(JI,this,TE).call(this,e);n&&"function"==typeof n.off&&n.off("segment:chunk",t)})),M(HI,this).clear(),M(GI,this).clear(),M(KI,this).clear(),M(qI,this).forEach((({trackStates:t})=>{t&&t.forEach((t=>{const e=null==t?void 0:t.segmentDecoders;e&&e.forEach((t=>{t&&"function"==typeof t.dispose&&t.dispose()}))}))})),M(qI,this).clear()}function sE(t,e,n){t&&(A(JI,this,AE).call(this,t),t.seekSegmentId=A(JI,this,aE).call(this,t.track,e,n))}function aE(t,e,n){if(!t||!e||!Array.isArray(t.segments))return null;const i=Ap(e);if(!Number.isFinite(i))return null;const r=CI(null==e?void 0:e.nodeOffsetOverride),o=Math.max(0,n-i+r),s=CI(null==t?void 0:t.offset),a=Math.max(0,o-s),l="function"==typeof t.getMediaSegmentAtTime?t.getMediaSegmentAtTime(a,{preferRepresentationTime:!0}):dy(t.segments,a,{preferRepresentationTime:!0});return(null==l?void 0:l.id)||null}function lE(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 cE(){const t=null==Au?void 0:Au.document;return!t||"string"!=typeof t.visibilityState||"visible"===t.visibilityState}function uE(){var t;const e=M(PI,this);if(!e||"number"!=typeof e.currentTime)return!1;if(e.state===Pm)return!1;const n=Date.now();if(n<M(XI,this))return!1;const i=e.currentTime;if(!Number.isFinite(i))return!1;const r="function"==typeof e.getPlacementsActiveAtTime?e.getPlacementsActiveAtTime(i):[],o=Number(null==e||null===(t=e.settings)||void 0===t?void 0:t.snapToFps),s=Number.isFinite(o)&&o>0?1/o:1/60;let a;if(Array.isArray(r)&&r.length)a=i+s;else if(a=A(JI,this,dE).call(this,i),!Number.isFinite(a))return!1;return C(XI,this,n+1500),this.log.warn("[DecodeCoordinator] attempting decoder recovery seek"),e.currentTime=a,!0}function dE(t){var e;const n=M(PI,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=Ap(t);if(!Number.isFinite(e))return;(!Number.isFinite(d)||e<d)&&(d=e);const n=Ep(t,M(OI,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 hE(){C(YI,this,!1),C(QI,this,null)}function fE(){M(YI,this)&&A(JI,this,cE).call(this)&&A(JI,this,uE).call(this)}function pE(t){if(!A(JI,this,lE).call(this,t))return;const e=M(PI,this);e&&"number"==typeof e.currentTime&&(C(YI,this,!0),C(QI,this,t),A(JI,this,cE).call(this)&&A(JI,this,uE).call(this))}function mE(t){var e;return!!t&&(Array.isArray(null===(e=M(PI,this))||void 0===e?void 0:e.placements)?M(PI,this).placements:[]).includes(t)}function vE(t){var e;(Array.isArray(null===(e=M(PI,this))||void 0===e?void 0:e.placements)?[...M(PI,this).placements]:[]).filter((e=>"function"!=typeof t||t(e))).sort(((t,e)=>{const n=Ap(t),i=Ap(e);return(Number.isFinite(n)?n:Number.POSITIVE_INFINITY)-(Number.isFinite(i)?i:Number.POSITIVE_INFINITY)})).forEach((t=>{A(JI,this,gE).call(this,t)}))}async function gE(t){if(!t||!t.placementId||M(qI,this).has(t.placementId))return;if(!A(JI,this,mE).call(this,t))return;const e=t.nodeId;if(!e||!M(OI,this)||"function"!=typeof M(OI,this).get)return;const n=A(JI,this,TE).call(this,e);if(n){if(n.state&&"ready"!==n.state){if("function"==typeof n.resolve)try{await n.resolve()}catch(n){if(!A(JI,this,mE).call(this,t))return;return void this.log.warn(`[#processPlacement] Failed to resolve node ${e}`,n)}if(!A(JI,this,mE).call(this,t))return;if("ready"!==n.state)return}if(A(JI,this,OE).call(this,t))return A(JI,this,CE).call(this,t,n),void M(KI,this).add(t.placementId);A(JI,this,FE).call(this,t,n)}}function yE(t){return A(JI,this,bE).call(this,t).every((t=>A(JI,this,ME).call(this,t)))}function bE(t){return(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).filter((t=>FI.has(null==t?void 0:t.type)))}function kE(t){if(!t||!t.id||"function"!=typeof t.on)return;if(M(VI,this).has(t.id))return;const e=()=>{A(JI,this,LE).call(this,t.id)};t.on("node:loaded",e),M(VI,this).set(t.id,e)}function xE(t){if(!t||!t.id||"function"!=typeof t.on)return;if(M(HI,this).has(t.id))return;const e=t=>A(JI,this,BE).call(this,t);t.on("segment:chunk",e),M(HI,this).set(t.id,e)}function wE(t,e){if(!t||!e)return;const n=M(GI,this).get(t)||new Set;n.add(e),M(GI,this).set(t,n)}function _E(t){return M(GI,this).get(t)||new Set}function TE(t){if(t&&M(OI,this)&&"function"==typeof M(OI,this).get)return M(OI,this).get(t)}function IE(t){if(!t)return;const e=t.fullBufferRetryTimer;null!=e&&("function"==typeof(null==Au?void 0:Au.clearTimeout)?Au.clearTimeout.bind(Au):clearTimeout)(e),t.fullBufferRetryTimer=null,t.fullBufferDecodeScheduled=!1,t.fullBufferRetryAttempts=0}function EE(t){const e=null==t?void 0:t.segmentStates;e&&"function"==typeof e.forEach&&e.forEach((t=>{A(JI,this,IE).call(this,t)}))}function SE(t,e,n,i){var r,o;if(!(t&&e&&n&&i))return!1;const s=M(qI,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 AE(t){if(!t)return;A(JI,this,EE).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 NE(t){const e=CI(t);if(!Number.isFinite(e))return;const n=e-2;Number.isFinite(n)&&M(qI,this).forEach((t=>{const e=null==t?void 0:t.placement;if(!e)return;const i=Ap(e),r=Ep(e,M(OI,this),{allowUnready:!0});if(!Number.isFinite(i)||!Number.isFinite(r))return;const o=i+r;if(!Number.isFinite(o)||o>n)return;const s=null==t?void 0:t.trackStates;s&&"function"==typeof s.forEach&&s.forEach((t=>{var e;const n=null==t||null===(e=t.track)||void 0===e?void 0:e.type;"video"!==n&&"image"!==n&&"audio"!==n||A(JI,this,AE).call(this,t)}))}))}function ME(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 FE(t,e){if(this.log.debug(`[#startDecode] [${t.placementId}] [${e.id}] Starting decode`),A(JI,this,CE).call(this,t,e)){if(A(JI,this,wE).call(this,e.id,t.placementId),!A(JI,this,yE).call(this,e))return A(JI,this,kE).call(this,e),void A(JI,this,xE).call(this,e);A(JI,this,RE).call(this,t,e),A(JI,this,xE).call(this,e)}}function CE(t,e){if(!t||!t.placementId||!e)return;const n=M(qI,this).get(t.placementId);if(n)return n.placement=t,n;const i=A(JI,this,bE).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(Im.DECODE_ERROR,Am({placementId:t.placementId,nodeId:e.id,trackId:null==n?void 0:n.id,trackType:null==n?void 0:n.type,error:i}))}}));const o={trackStates:r,nodeId:e.id,placement:t};return M(qI,this).set(t.placementId,o),o}function OE(t){var e;const n=Ap(t),i=CI(null===(e=M(PI,this))||void 0===e?void 0:e.currentTime);return!Number.isFinite(n)||!!Number.isFinite(i)&&n-i>2}function PE(t){if(!M(KI,this).size)return;const e=CI(t);if(!Number.isFinite(e))return;const n=[];M(KI,this).forEach((t=>{const i=M(qI,this).get(t),r=null==i?void 0:i.placement;if(!r)return void n.push(t);const o=Ap(r);Number.isFinite(o)&&o-e<=2&&n.push(t)})),n.forEach((t=>{M(KI,this).delete(t);const e=M(qI,this).get(t),n=null==e?void 0:e.placement;if(!n)return;const i=A(JI,this,TE).call(this,n.nodeId);i&&A(JI,this,FE).call(this,n,i)}))}function RE(t,e){const n=M(qI,this).get(t.placementId);n&&A(JI,this,bE).call(this,e).forEach((i=>{const r=n.trackStates.get(i.id);if(r&&!r.ready)try{let n;if(r.seekSegmentId&&(n=i.segments.find((t=>t&&!t.isInit&&t.id===r.seekSegmentId&&t.retainedByteLength>0)),!n))return;if(n||(n=i.segments.find((t=>t&&!t.isInit&&t.retainedByteLength>0))),!n)return;A(JI,this,qE).call(this,t,i,n),r.seekSegmentId&&"video"===(null==i?void 0:i.type)&&A(JI,this,DE).call(this,t,i,n),r.ready=!0,this.trigger(Im.DECODE_READY,Sm({placementId:t.placementId,nodeId:e.id,trackId:i.id,trackType:i.type}))}catch(n){this.trigger(Im.DECODE_ERROR,Am({placementId:t.placementId,nodeId:e.id,trackId:null==i?void 0:i.id,trackType:null==i?void 0:i.type,error:n}))}}))}function DE(t,e,n){var i;if(!(t&&e&&n&&Array.isArray(e.segments)))return;const r=null==t?void 0:t.placementId,o=r?M(qI,this).get(r):void 0,s=null==o||null===(i=o.trackStates)||void 0===i?void 0:i.get(e.id),a=null==s?void 0:s.segmentDecoders;if(!a||"function"!=typeof a.has)return;const l=e.segments,c=l.findIndex((t=>(null==t?void 0:t.id)===n.id));if(c<0)return;let u=0;for(let n=c+1;n<l.length;n+=1){const i=l[n];if(!i||i.isInit)continue;if(a.has(i.id))continue;if(!(i.retainedByteLength>0))break;const r=i.arrayBuffer;if(!r||"number"!=typeof r.byteLength||r.byteLength<=0)break;if(A(JI,this,qE).call(this,t,e,i),u+=1,u>=2)break}}function LE(t){const e=A(JI,this,TE).call(this,t);e&&A(JI,this,yE).call(this,e)&&A(JI,this,_E).call(this,t).forEach((t=>{const n=M(qI,this).get(t);A(JI,this,RE).call(this,(null==n?void 0:n.placement)||{placementId:t},e)}))}function BE(t){t&&t.nodeId&&t.trackId&&t.chunk&&A(JI,this,_E).call(this,t.nodeId).forEach((e=>A(JI,this,zE).call(this,e,t)))}function zE(t,e){const n=M(qI,this).get(t);if(!n)return;const i=n.trackStates.get(e.trackId);if(i)try{var r,o;if(e.isInit)return;const s=i.track,a=null==s||null===(r=s.segments)||void 0===r?void 0:r.find((t=>(null==t?void 0:t.id)===e.segmentId));if(!a||a.isInit)return;if("image"===(null==s?void 0:s.type))return void(!i.ready&&a.retainedByteLength>0&&A(JI,this,qE).call(this,n.placement,s,a)&&(i.ready=!0,this.trigger(Im.DECODE_READY,Sm({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType}))));if((null===(o=M(PI,this))||void 0===o?void 0:o.state)===Pm&&i.seekSegmentId&&("video"===(null==s?void 0:s.type)||"audio"===(null==s?void 0:s.type))&&a.id!==i.seekSegmentId)return;const l=a.id,c=i.segmentStates.get(l)||{initSent:!1,pendingChunks:[],ended:!1,firstChunkObserved:!1,missedSegmentPrefix:!1,fullBufferDecodeScheduled:!1,fullBufferRetryTimer:null,fullBufferRetryAttempts:0};i.segmentStates.set(l,c);const u=A(JI,this,UE).call(this,n.placement,s,a);if(!u||"function"!=typeof u.decodeChunk)return;if(i.hasInit&&!c.initSent){const t=A(JI,this,jE).call(this,s,a);if(!t)return void c.pendingChunks.push({chunk:e.chunk,loaded:e.loaded,total:e.total});u.decodeChunk(t,{isInit:!0}),c.initSent=!0,c.pendingChunks.length&&(c.pendingChunks.forEach((t=>{u.decodeChunk(t.chunk,{isInit:!1,loaded:t.loaded,total:t.total})})),c.pendingChunks=[])}const d="number"==typeof e.loaded&&"number"==typeof e.total&&e.total>0&&e.loaded>=e.total;A(JI,this,WE).call(this,c,e)?d&&!c.ended&&A(JI,this,$E).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(Im.DECODE_READY,Sm({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType})))}catch(n){this.trigger(Im.DECODE_ERROR,Am({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType,error:n}))}}function WE(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 $E(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==Au?void 0:Au.setTimeout)?Au.setTimeout.bind(Au):setTimeout;i.fullBufferDecodeScheduled=!0,i.fullBufferRetryAttempts=0;const l=()=>{if(!A(JI,this,SE).call(this,r,o,s,i)||i.ended)return void A(JI,this,IE).call(this,i);if(A(JI,this,qE).call(this,t,e,n))return void A(JI,this,IE).call(this,i);i.fullBufferRetryAttempts+=1;const c=i.fullBufferRetryAttempts<=8?0:50;i.fullBufferRetryTimer=a((()=>{l()}),c)};i.fullBufferRetryTimer=a((()=>{l()}),0)}function UE(t,e,n){var i,r;const o=null==t?void 0:t.placementId;if(!o||!e||!n)return;const s=M(qI,this).get(o),a=null==s||null===(i=s.trackStates)||void 0===i?void 0:i.get(e.id);if(!a)return;const l=a.segmentDecoders.get(n.id);if(l)return l;const c=M(RI,this).create(e);if(c&&"function"==typeof c.configure&&c.configure(e),c&&"function"==typeof c.setNodeId&&c.setNodeId(null==t?void 0:t.nodeId),c&&"function"==typeof c.setSegment&&c.setSegment(n),c&&"function"==typeof c.setCurrentTimeProvider&&c.setCurrentTimeProvider((()=>{var t;return"number"==typeof(null===(t=M(PI,this))||void 0===t?void 0:t.currentTime)?M(PI,this).currentTime:0})),c&&"function"==typeof c.setTimeOffsetSeconds){var u,d;const i=Ap(t),r=CI(null==e?void 0:e.offset),o=CI(null!==(u=null==n||null===(d=n.chosenRepresentation)||void 0===d?void 0:d.segStart)&&void 0!==u?u:null==n?void 0:n.offset);Number.isFinite(i)&&c.setTimeOffsetSeconds(i+r+o)}return c&&"function"==typeof c.setSeekTargetTimeSeconds&&(null===(r=M(PI,this))||void 0===r?void 0:r.state)===Pm&&"video"===(null==e?void 0:e.type)&&c.setSeekTargetTimeSeconds(M(PI,this).currentTime),c&&"function"==typeof c.on&&(c.on(Im.DECODER_FRAME,(i=>{i&&(!M(YI,this)||"video"!==(null==e?void 0:e.type)&&"image"!==(null==e?void 0:e.type)||(C(YI,this,!1),C(QI,this,null)),M(PI,this)&&"function"==typeof M(PI,this).notifyDecodedFrame&&(i.frame||i.data)&&M(PI,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(Im.DECODER_AUDIO,(i=>{i&&i.audioBuffer&&this.trigger(Im.DECODER_AUDIO,Sm({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(Im.DECODER_ERROR,(i=>{const r=(null==i?void 0:i.error)||i;this.trigger(Im.DECODER_ERROR,Am({placementId:o,nodeId:null==t?void 0:t.nodeId,trackId:null==e?void 0:e.id,trackType:null==e?void 0:e.type,segmentId:null==n?void 0:n.id,error:r})),A(JI,this,pE).call(this,r)}))),a.segmentDecoders.set(n.id,c),c}function jE(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 qE(t,e,n){var i;if(!t||!e||!n)return!1;const r=t.placementId,o=M(qI,this).get(r),s=null==o||null===(i=o.trackStates)||void 0===i?void 0:i.get(e.id);if(!s)return!1;const a=A(JI,this,UE).call(this,t,e,n);if(!a||"function"!=typeof a.decodeChunk)return!1;const l=s.segmentStates.get(n.id)||{initSent:!1,pendingChunks:[],ended:!1,firstChunkObserved:!1,missedSegmentPrefix:!1,fullBufferDecodeScheduled:!1,fullBufferRetryTimer:null,fullBufferRetryAttempts:0};if(s.segmentStates.set(n.id,l),l.ended)return A(JI,this,IE).call(this,l),!0;if(s.hasInit&&!l.initSent){const t=A(JI,this,jE).call(this,e,n);if(!t)return!1;a.decodeChunk(t,{isInit:!0}),l.initSent=!0}const c=n.arrayBuffer;return!(!c||"number"!=typeof c.byteLength||c.byteLength<=0||(a.decodeChunk(new Uint8Array(c),{isInit:!1,loaded:c.byteLength,total:c.byteLength}),l.ended||"function"!=typeof a.endOfStream||(l.ended=!0,a.endOfStream()),A(JI,this,IE).call(this,l),0))}const VE=1e-6;var HE=new WeakMap,GE=new WeakMap,KE=new WeakMap,XE=new WeakMap,YE=new WeakMap,QE=new WeakMap,JE=new WeakMap,ZE=new WeakMap,tS=new WeakSet;class eS extends Iu{get name(){return"TransitionManager"}get defaults(){return{durationSeconds:.5}}constructor(t,e,n){super(n),O(this,tS),F(this,HE,void 0),F(this,GE,void 0),F(this,KE,null),F(this,XE,null),F(this,YE,null),F(this,QE,0),F(this,JE,[]),F(this,ZE,null),C(HE,this,t),C(GE,this,e),M(HE,this)&&"function"==typeof M(HE,this).on&&(C(ZE,this,(()=>A(tS,this,uS).call(this))),M(HE,this).on(Im.TIMELINE_RESET,M(ZE,this)))}transitionTo(t,e={}){const n=Number(t);if(!Number.isFinite(n))throw new Error("TransitionManager.transitionTo requires a numeric time");A(tS,this,uS).call(this);const i=A(tS,this,nS).call(this),r=A(tS,this,sS).call(this,n,e);return r?A(tS,this,aS).call(this,n,e,i,r):Promise.resolve()}onDispose(){M(HE,this)&&"function"==typeof M(HE,this).off&&M(ZE,this)&&M(HE,this).off(Im.TIMELINE_RESET,M(ZE,this)),C(ZE,this,null),A(tS,this,uS).call(this),C(GE,this,null),C(HE,this,null)}}function nS(){return C(QE,this,M(QE,this)+1),M(QE,this)}function iS(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 rS(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 oS(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 sS(t,e={}){var n;const i=M(GE,this),r=A(tS,this,iS).call(this,e);if(!i||"function"!=typeof i.startTransition)return M(HE,this).currentTime=t,null;if(!(r>0))return M(HE,this).currentTime=t,null!==(n=i.resetTransition)&&void 0!==n&&n.call(i),null;const o=A(tS,this,rS).call(this,e,r);"function"==typeof(null==e?void 0:e.onTransitionInStart)&&e.onTransitionInStart();const s=i.startTransition(o),{outDurationMs:a,inDurationMs:l}=A(tS,this,oS).call(this,r,s);return{renderer:i,transitionOptions:o,outDurationMs:a,inDurationMs:l,shouldWaitForFrames:!1!==(null==e?void 0:e.waitForVisualFrames)}}function aS(t,e={},n,i){const{renderer:r,transitionOptions:o,outDurationMs:s,inDurationMs:a,shouldWaitForFrames:l}=i,c=A(tS,this,mS).call(this,t,e,n),u=l?A(tS,this,vS).call(this,t,n):Promise.resolve();let d=!1,h=!1,f=!1,p=!l;const m=()=>{var t;A(tS,this,dS).call(this,n)&&!f&&d&&h&&p&&(f=!0,"function"==typeof(null==e?void 0:e.onTransitionInEnd)&&e.onTransitionInEnd(),"function"==typeof(null==e?void 0:e.onTransitionOutStart)&&e.onTransitionOutStart(),null!==(t=r.beginTransitionIn)&&void 0!==t&&t.call(r,o),C(XE,this,setTimeout((()=>{var t;A(tS,this,dS).call(this,n)&&(null!==(t=r.resetTransition)&&void 0!==t&&t.call(r),"function"==typeof(null==e?void 0:e.onTransitionOutEnd)&&e.onTransitionOutEnd(),A(tS,this,lS).call(this))}),a)))};return C(KE,this,setTimeout((()=>{d=!0,m()}),s)),c.then((()=>{h=!0,m()})).catch((()=>{var t;A(tS,this,dS).call(this,n)&&(null!==(t=r.resetTransition)&&void 0!==t&&t.call(r),A(tS,this,lS).call(this))})),u.then((()=>{p=!0,m()})).catch((()=>{p=!0,m()})),M(HE,this).currentTime=t,new Promise((t=>{C(YE,this,t)}))}function lS(){const t=M(YE,this);C(YE,this,null),A(tS,this,cS).call(this),A(tS,this,pS).call(this),t&&t()}function cS(){M(KE,this)&&clearTimeout(M(KE,this)),M(XE,this)&&clearTimeout(M(XE,this)),C(KE,this,null),C(XE,this,null)}function uS(){var t,e;M(GE,this)&&null!==(t=(e=M(GE,this)).resetTransition)&&void 0!==t&&t.call(e),A(tS,this,cS).call(this),A(tS,this,pS).call(this),M(YE,this)&&(M(YE,this).call(this),C(YE,this,null))}function dS(t){return M(QE,this)===t}function hS(t,e){M(HE,this)&&"function"==typeof M(HE,this).on&&(M(HE,this).on(t,e),M(JE,this).push({eventName:t,handler:e}))}function fS(t,e){M(HE,this)&&"function"==typeof M(HE,this).off&&(M(HE,this).off(t,e),C(JE,this,M(JE,this).filter((n=>n.eventName!==t||n.handler!==e))))}function pS(){M(HE,this)&&"function"==typeof M(HE,this).off?(M(JE,this).forEach((t=>{M(HE,this).off(t.eventName,t.handler)})),C(JE,this,[])):C(JE,this,[])}function mS(t,e,n){const i=null==e?void 0:e.transitionOutPromise;if(i&&"function"==typeof i.then)return i;if("function"==typeof i)try{const t=i();if(t&&"function"==typeof t.then)return t}catch(t){return Promise.resolve()}if(!M(HE,this)||"function"!=typeof M(HE,this).on)return Promise.resolve();const r=A(tS,this,gS).call(this);return new Promise((e=>{let i=!1;const o=r?Im.TIMELINE_SEEKED:"nodestart";let s,a;const l=()=>{A(tS,this,fS).call(this,Im.TIMELINE_SEEKING,s),A(tS,this,fS).call(this,o,a),e()};s=(e={})=>{A(tS,this,dS).call(this,n)?A(tS,this,yS).call(this,e,t)&&(i=!0):l()},a=(e={})=>{A(tS,this,dS).call(this,n)?(o!==Im.TIMELINE_SEEKED||A(tS,this,yS).call(this,e,t))&&(o===Im.TIMELINE_SEEKED||i)&&l():l()},A(tS,this,hS).call(this,Im.TIMELINE_SEEKING,s),A(tS,this,hS).call(this,o,a)}))}function vS(t,e){if(!M(HE,this)||"function"!=typeof M(HE,this).on)return Promise.resolve();const n=Number(t);return new Promise((t=>{const i=(r={})=>{if(!A(tS,this,dS).call(this,e))return A(tS,this,fS).call(this,Im.VISUAL_FRAMES_AVAILABLE,i),void t();const o=Number(null==r?void 0:r.time);Number.isFinite(n)&&Number.isFinite(o)&&o+VE<n||(Array.isArray(null==r?void 0:r.frames)?r.frames:[]).length&&(A(tS,this,fS).call(this,Im.VISUAL_FRAMES_AVAILABLE,i),t())};A(tS,this,hS).call(this,Im.VISUAL_FRAMES_AVAILABLE,i)}))}function gS(){var t,e;const n=null===(t=M(HE,this))||void 0===t?void 0:t.state;if(n===Om||n===Nm)return!0;const i=null===(e=M(HE,this))||void 0===e?void 0:e.placements;return!Array.isArray(i)||0===i.length}function yS(t,e){const n=Number(null==t?void 0:t.targetTime);return!Number.isFinite(n)||Math.abs(n-e)<VE}function bS(t,e=0){const n=Number(t);return Number.isFinite(n)?n:e}var kS=new WeakMap,xS=new WeakMap,wS=new WeakMap,_S=new WeakMap,TS=new WeakMap,IS=new WeakMap,ES=new WeakMap,SS=new WeakMap,AS=new WeakMap,NS=new WeakMap,MS=new WeakMap,FS=new WeakMap,CS=new WeakMap,OS=new WeakMap,PS=new WeakSet;class RS extends Iu{get name(){return"AudioPlaybackManager"}get defaults(){return{muted:!1,volume:1,lookaheadSeconds:1}}constructor(t,e,n){super(n),O(this,PS),F(this,kS,void 0),F(this,xS,void 0),F(this,wS,null),F(this,_S,null),F(this,TS,[]),F(this,IS,new Set),F(this,ES,new Map),F(this,SS,!1),F(this,AS,1),F(this,NS,!0),F(this,MS,null),F(this,FS,null),F(this,CS,null),F(this,OS,null),C(kS,this,t),C(xS,this,e),C(SS,this,!!this.settings.muted),C(AS,this,Tp(this.settings.volume));const i=Array.isArray(null==n?void 0:n.disabledTracks)?n.disabledTracks:[];C(NS,this,!i.includes("audio")),A(PS,this,DS).call(this)}get muted(){return M(SS,this)}set muted(t){C(SS,this,!!t),A(PS,this,GS).call(this)}get volume(){return M(AS,this)}set volume(t){C(AS,this,Tp(t)),A(PS,this,GS).call(this)}handleDecodedAudio(t={}){if(!M(NS,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=bS(null==t?void 0:t.pts,null);if(!(e&&n&&i&&Number.isFinite(r)))return;const o=Number.isFinite(null==t?void 0:t.duration)?t.duration:e.duration,s=`${n}:${i}`;M(IS,this).has(s)||(M(TS,this).push({key:s,placementId:n,pts:r,duration:o,audioBuffer:e}),M(TS,this).sort(((t,e)=>t.pts-e.pts)),A(PS,this,$S).call(this))}onDispose(){A(PS,this,LS).call(this),A(PS,this,VS).call(this,!0),M(wS,this)&&"function"==typeof M(wS,this).close&&M(wS,this).close(),C(wS,this,null),C(_S,this,null),C(kS,this,null),C(xS,this,null)}}function DS(){M(kS,this)&&"function"==typeof M(kS,this).on&&(C(MS,this,(t=>A(PS,this,BS).call(this,t))),M(kS,this).on(Im.TIMELINE_TIME_UPDATE,M(MS,this)),C(FS,this,(t=>A(PS,this,zS).call(this,t))),M(kS,this).on(Im.TIMELINE_STATE_CHANGE,M(FS,this)),C(OS,this,(()=>A(PS,this,WS).call(this))),M(kS,this).on(Im.TIMELINE_RESET,M(OS,this))),M(xS,this)&&"function"==typeof M(xS,this).on&&(C(CS,this,(t=>this.handleDecodedAudio(t))),M(xS,this).on(Im.DECODER_AUDIO,M(CS,this)))}function LS(){M(kS,this)&&"function"==typeof M(kS,this).off&&(M(MS,this)&&M(kS,this).off(Im.TIMELINE_TIME_UPDATE,M(MS,this)),M(FS,this)&&M(kS,this).off(Im.TIMELINE_STATE_CHANGE,M(FS,this)),M(OS,this)&&M(kS,this).off(Im.TIMELINE_RESET,M(OS,this))),M(xS,this)&&"function"==typeof M(xS,this).off&&M(CS,this)&&M(xS,this).off(Im.DECODER_AUDIO,M(CS,this)),C(MS,this,null),C(FS,this,null),C(CS,this,null),C(OS,this,null)}function BS(){A(PS,this,$S).call(this)}function zS(t={}){const e=null==t?void 0:t.to;if(e)return e===Mm?(A(PS,this,KS).call(this),void A(PS,this,$S).call(this)):void(e!==Om&&e!==Cm?e!==Pm&&e!==Rm||A(PS,this,WS).call(this):A(PS,this,XS).call(this))}function WS(){A(PS,this,XS).call(this),A(PS,this,VS).call(this,!0),C(TS,this,[])}function $S(){if(!M(NS,this)||!M(kS,this))return;if(M(kS,this).state!==Mm)return;const t=A(PS,this,HS).call(this);if(!t)return;const e=bS(M(kS,this).currentTime,0),n=e+Math.max(0,bS(this.settings.lookaheadSeconds,1)),i=[];for(let r=0;r<M(TS,this).length;r+=1){const o=M(TS,this)[r];o&&(o.pts>n?i.push(o):A(PS,this,US).call(this,o)&&A(PS,this,qS).call(this,o,t,e))}C(TS,this,i)}function US(t){if(!t||!M(kS,this))return!1;const e=A(PS,this,jS).call(this,t.pts);return!(!e||e!==t.placementId)}function jS(t){if(!M(kS,this)||"function"!=typeof M(kS,this).getPlacementsActiveAtTime)return null;const e=M(kS,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 qS(t,e,n){const i=t.key;if(M(IS,this).has(i))return;const r=t.audioBuffer;if(!r)return;const o=Number.isFinite(t.duration)?t.duration:r.duration,s=t.pts;if(!Number.isFinite(s))return;const a=n-s;if(Number.isFinite(o)&&o>0&&a>=o)return;const l=e.createBufferSource();l.buffer=r,l.connect(M(_S,this));let c=e.currentTime,u=0;a>0?u=a:a<0&&(c=e.currentTime+Math.abs(a));try{l.start(c,u)}catch(t){return void this.log.warn("[AudioPlaybackManager] Failed to start audio buffer",t)}M(IS,this).add(i),M(ES,this).set(i,l),l.onended=()=>{M(ES,this).delete(i)}}function VS(t){M(ES,this).forEach(((t,e)=>{if(t&&"function"==typeof t.stop)try{t.stop()}catch(t){}M(ES,this).delete(e)})),t&&M(IS,this).clear()}function HS(){if(M(wS,this))return M(wS,this);const t=Au.AudioContext||Au.webkitAudioContext;if(!t)return this.log.warn("[AudioPlaybackManager] AudioContext is not available."),null;try{return C(wS,this,new t),C(_S,this,M(wS,this).createGain()),M(_S,this).connect(M(wS,this).destination),A(PS,this,GS).call(this),M(wS,this)}catch(t){return this.log.warn("[AudioPlaybackManager] Failed to initialize AudioContext",t),C(wS,this,null),C(_S,this,null),null}}function GS(){if(!M(_S,this))return;const t=M(SS,this)?0:M(AS,this);M(_S,this).gain.value=t}function KS(){M(wS,this)&&"function"==typeof M(wS,this).resume&&"suspended"===M(wS,this).state&&M(wS,this).resume().catch((()=>{}))}function XS(){M(wS,this)&&"function"==typeof M(wS,this).suspend&&"running"===M(wS,this).state&&M(wS,this).suspend().catch((()=>{}))}var YS=new WeakMap,QS=new WeakMap,JS=new WeakMap,ZS=new WeakMap,tA=new WeakMap,eA=new WeakSet;class nA extends Iu{constructor(...t){super(...t),O(this,eA),F(this,YS,void 0),F(this,QS,void 0),F(this,JS,void 0),F(this,ZS,void 0),F(this,tA,void 0),C(YS,this,A(eA,this,rA).call(this,this.settings.currentTime)),C(QS,this,A(eA,this,oA).call(this,this.settings.playbackRate)),C(JS,this,null),C(ZS,this,!1),C(tA,this,A(eA,this,iA).bind(this))}get name(){return"PlaybackClock"}get defaults(){return{currentTime:0,playbackRate:qg("playbackRate")}}get currentTime(){return M(YS,this)}get playbackRate(){return M(QS,this)}set playbackRate(t){C(QS,this,A(eA,this,oA).call(this,t))}play(){M(ZS,this)||(C(ZS,this,!0),C(JS,this,Sg()),uk(M(tA,this),0))}pause(){M(ZS,this)&&(C(ZS,this,!1),dk(M(tA,this)))}seek(t){C(YS,this,A(eA,this,rA).call(this,t)),C(JS,this,Sg())}reset(){this.pause(),C(YS,this,0),C(JS,this,null)}onDispose(){this.pause(),C(tA,this,null)}}function iA(){const t=Sg();if(null===M(JS,this))return C(JS,this,t),void this.trigger(Im.CLOCK_TICK,{currentTime:M(YS,this)});const e=t-M(JS,this);C(JS,this,t);const n=e/1e3;C(YS,this,M(YS,this)+n*M(QS,this)),this.trigger(Im.CLOCK_TICK,{currentTime:M(YS,this)})}function rA(t){return"number"!=typeof t||Number.isNaN(t)||!Number.isFinite(t)||t<0?0:t}function oA(t){return"number"!=typeof t||Number.isNaN(t)||!Number.isFinite(t)||t<=0?M(QS,this)||1:t}var sA=new WeakMap,aA=new WeakSet;class lA extends Iu{constructor(...t){super(...t),O(this,aA),F(this,sA,new Map)}get name(){return"TrackBuffers"}get defaults(){return{}}refreshNode(t){if(!t||!Array.isArray(t.tracks))return;const e=t.id,n=M(sA,this).get(e)||new Map;M(sA,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(Im.TRACK_BUFFER_UPDATE,{nodeId:e,trackType:i,range:r})),!s&&a?this.trigger(Im.TRACK_READY,{nodeId:e,trackType:i,range:r}):s&&!a&&this.trigger(Im.TRACK_UNDERFLOW,{nodeId:e,trackType:i,range:r})}))}getTrackRange(t,e){const n=M(sA,this).get(t),i=null==n?void 0:n.get(e);return null==i?void 0:i.range}computeBuffered(t=[],e=0,n){if(!n||"function"!=typeof n.get)return;const i=Number.isFinite(e)?e:0;let r,o,s=!1;for(let e=0;e<t.length;e+=1){const a=A(aA,this,uA).call(this,n,t[e],i);if(!a||a.end<=i)continue;if(void 0===r){r=a.start,o=a.end,s=a.full;continue}const l=a.start<=o,c=s&&a.full;if(!l&&!c)break;o=Math.max(o,a.end),s=a.full}return void 0===r||void 0===o?{start:0,end:0}:{start:r,end:o}}get buffered(){return M(sA,this)}reset(){M(sA,this).clear()}onDispose(){M(sA,this).clear(),"function"==typeof this.off&&this.off()}}function cA(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 uA(t,e,n=0){var i,r;const o=Ap(e);if(!Number.isFinite(o))return;const s=t.get(e.nodeId);if(!s)return;const a=Array.isArray(s.tracks)?s.tracks:[];if(!a.length){const t=s.buffered;if(!t||!Number.isFinite(t.start)||!Number.isFinite(t.end))return;return A(aA,this,dA).call(this,s,t,o,e)}const l=s.mainTrackId,c=Number.isFinite(e.nodeOffsetOverride)?e.nodeOffsetOverride:0,u=Math.max(0,n-o+c);let d;l&&(d=a.find((t=>(null==t?void 0:t.id)===l))),(null===(i=d)||void 0===i?void 0:i.type)||(d=a.find((t=>null==t?void 0:t.type)));const h=A(aA,this,cA).call(this,d,u)||(null===(r=d)||void 0===r?void 0:r.buffered);return h&&Number.isFinite(h.start)&&Number.isFinite(h.end)?A(aA,this,dA).call(this,s,h,o,e):void 0}function dA(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 hA{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 fA extends Iu{constructor(t,e){super(e),this.timeline=t}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"handleDecodedFrame","handleClockTick","handleMainTrackBufferUpdate"])}enter(){}exit(){}play(){this.timeline.transitionTo(Mm)}pause(){this.timeline.transitionTo(Om)}wait(){this.timeline.transitionTo(Cm)}reset(){this.timeline.transitionTo(Rm)}seek(t){this.timeline.transitionTo(Pm,{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 pA=24e3/1001;function mA(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 vA(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 gA(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 yA(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 bA(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:pA)}(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+vA(t)}function kA(t,e=(null==t?void 0:t.currentTime)){const n=mA(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=gA(o);if(!s)return!0;if(!t.hasDecodedFirstFrame(r,s))return!0}return!1}function xA(t,e=(null==t?void 0:t.currentTime)){return kA(t,e)||function(t,e=(null==t?void 0:t.currentTime)){const n=mA(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=yA(s);if(null!=a&&a.id&&!bA(t,o,a.id,a.type,n))return!0}return!1}(t,e)}function wA(t,e=(null==t?void 0:t.currentTime)){if("function"!=typeof(null==t?void 0:t.computeBuffered))return!1;const n=mA(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=vA(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=Ap(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 _A={[Nm]:class extends fA{get name(){return Nm}get defaults(){return{autoplay:qg("autoplay")}}enter(){this.timeline.recordStableState(Om),this.timeline.stopPlaybackClock()}play(){const t=xA(this.timeline),e=t?Cm:this.timeline.getPlaybackStartState();if(this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t)return this.timeline.recordStableState(Mm),void this.timeline.transitionTo(Cm);this.timeline.transitionTo(e)}pause(){}handleDecodedFrame(t){if(!0!==this.settings.autoplay)return;if(!Array.isArray(this.timeline.placements)||!this.timeline.placements.length)return;if(xA(this.timeline))return;const e=this.timeline.getPlaybackStartState();this.log.info("[handleDecodedFrame] Autoplay enabled, starting playback!"),this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),this.timeline.transitionTo(e)}},[Fm]:class extends fA{get name(){return Fm}enter(t={}){const{from:e,to:n}=t;this.timeline.recordStableState(Mm),this.timeline.stopPlaybackClock(),this.emitPlayerStateEvent("canplay",{from:e,to:n})}play(){}pause(){this.timeline.transitionTo(Om)}},[Mm]:class extends fA{get name(){return Mm}enter(t={}){const{from:e,to:n,fromFirstFramePending:i}=t;this.timeline.recordStableState(Mm),this.timeline.startPlaybackClock(),!0!==i&&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;xA(this.timeline,e)&&(this.timeline.recordStableState(Mm),this.timeline.transitionTo(Cm))}},[Cm]:(Ze=new WeakMap,tn=new WeakMap,en=new WeakSet,class extends fA{constructor(...t){super(...t),O(this,en),F(this,Ze,void 0),F(this,tn,null)}get name(){return Cm}enter(t={}){const{from:e,to:n}=t;this.timeline.stopPlaybackClock(),A(en,this,TA).call(this),A(en,this,EA).call(this),this.emitPlayerStateEvent("waiting",{from:e,to:n}),A(en,this,NA).call(this)}exit(){A(en,this,IA).call(this),A(en,this,SA).call(this)}play(){this.timeline.recordStableState(Mm);const t=A(en,this,AA).call(this),e=t?Cm:this.timeline.getPlaybackStartState();this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t||this.timeline.transitionTo(e)}pause(){this.timeline.transitionTo(Om)}handleMainTrackReady(t){const e=this.timeline.getLastStableState()||Om;e!==Mm?this.timeline.transitionTo(e):A(en,this,NA).call(this)}handleDecodedFrame(t){A(en,this,NA).call(this)}handleMainTrackBufferUpdate(t){A(en,this,NA).call(this)}}),[Om]:class extends fA{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=xA(this.timeline),e=t?Cm:this.timeline.getPlaybackStartState();if(this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t)return this.timeline.recordStableState(Mm),void this.timeline.transitionTo(Cm);this.timeline.transitionTo(e)}pause(){}},[Pm]:class extends fA{get name(){return Pm}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===Mm||n===Fm,r=i&&"function"==typeof this.timeline.getPlaybackStartState?this.timeline.getPlaybackStartState(e):i?Mm:Om;this.timeline.transitionTo(r,{fromSeeking:!0})}play(){var t;if(this.timeline&&"function"==typeof this.timeline.setSeekReturnState)return void this.timeline.setSeekReturnState(Mm);const e="function"==typeof(null===(t=this.timeline)||void 0===t?void 0:t.getPlaybackStartState)?this.timeline.getPlaybackStartState():Mm;this.timeline.transitionTo(e)}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)}},[Rm]:class extends fA{get name(){return Rm}enter(){this.timeline.resetClock(),this.timeline.transitionTo(Nm,{fromReset:!0})}play(){}pause(){}get buffered(){return{start:0,end:0}}}};function TA(){var t;const e=null===(t=this.timeline)||void 0===t?void 0:t.trackBuffers;e&&"function"==typeof e.on&&(C(Ze,this,(t=>this.handleMainTrackBufferUpdate(t))),e.on(Im.TRACK_BUFFER_UPDATE,M(Ze,this)))}function IA(){var t;const e=null===(t=this.timeline)||void 0===t?void 0:t.trackBuffers;M(Ze,this)&&e&&"function"==typeof e.off?(e.off(Im.TRACK_BUFFER_UPDATE,M(Ze,this)),C(Ze,this,null)):C(Ze,this,null)}function EA(){if(null!==M(tn,this))return;const t="function"==typeof(null==Au?void 0:Au.setInterval)?Au.setInterval.bind(Au):setInterval;C(tn,this,t((()=>{var t;(null===(t=this.timeline)||void 0===t?void 0:t.state)===Cm&&A(en,this,NA).call(this)}),200))}function SA(){null!==M(tn,this)&&(("function"==typeof(null==Au?void 0:Au.clearInterval)?Au.clearInterval.bind(Au):clearInterval)(M(tn,this)),C(tn,this,null))}function AA(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!!kA(t,e)||!0===n.skipBufferResume||!wA(t,e)}(this.timeline,t)}function NA(t=(t=>null===(t=this.timeline)||void 0===t?void 0:t.currentTime)()){return(this.timeline.getLastStableState()||Om)===Mm&&!A(en,this,AA).call(this,t)&&(this.timeline.transitionTo(this.timeline.getPlaybackStartState(t)),!0)}function MA(t){return t&&("string"!=typeof t.state||"ready"===t.state)}function FA(t){return(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).some((t=>"video"===(null==t?void 0:t.type)))}function CA(t){return(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).some((t=>"video"===(null==t?void 0:t.type)||"image"===(null==t?void 0:t.type)))}function OA(t){return t===Mm||t===Fm}var PA=new WeakMap,RA=new WeakMap,DA=new WeakMap,LA=new WeakMap,BA=new WeakMap,zA=new WeakMap,WA=new WeakMap,$A=new WeakMap,UA=new WeakMap,jA=new WeakMap,qA=new WeakMap,VA=new WeakMap,HA=new WeakMap,GA=new WeakMap,KA=new WeakSet;class XA{constructor(t={}){O(this,KA),F(this,PA,void 0),F(this,RA,void 0),F(this,DA,void 0),F(this,LA,void 0),F(this,BA,void 0),F(this,zA,void 0),F(this,WA,void 0),F(this,$A,void 0),F(this,UA,void 0),F(this,jA,null),F(this,qA,Om),F(this,VA,[]),F(this,HA,new Set),F(this,GA,new Map),C(PA,this,t.getState),C(RA,this,t.getNode),C(DA,this,t.getPlacementsActiveAtTime),C(LA,this,t.getLastStableState),C(BA,this,t.getPlaybackStartState),C(zA,this,t.clearVisualFrameBuffers),C(WA,this,t.updateTime),C($A,this,t.transitionTo),C(UA,this,t.trigger)}start(t,e){const n=Number(t);if(!Number.isFinite(n))return;let i=e;i===Pm?i=M(qA,this):i===Cm&&"function"==typeof M(LA,this)&&(i=M(LA,this).call(this)),C(qA,this,OA(i)?Mm:Om),C(jA,this,n),M(HA,this).clear(),M(GA,this).clear(),C(VA,this,"function"==typeof M(DA,this)?M(DA,this).call(this,n):[]),"function"==typeof M(zA,this)&&M(zA,this).call(this),"function"==typeof M(WA,this)&&M(WA,this).call(this,n,{source:"seek"}),"function"==typeof M(UA,this)&&M(UA,this).call(this,Im.TIMELINE_SEEKING,{targetTime:n,placements:M(VA,this).slice()}),this.maybeComplete()}setReturnState(t){C(qA,this,OA(t)?Mm:Om)}maybeComplete(t){if(("function"==typeof M(PA,this)?M(PA,this).call(this):void 0)!==Pm)return;const e=M(jA,this);if(!Number.isFinite(e))return;const n=null==t?void 0:t.trackType,i=null==t?void 0:t.placementId;if(i&&"video"===n){const n=Number(null==t?void 0:t.pts);if(Number.isFinite(n)&&n>=e){M(HA,this).add(i);const t=M(GA,this).get(i);(!Number.isFinite(t)||n<t)&&M(GA,this).set(i,n)}}else i&&"image"===n&&function(t,e){const n=Number(null==t?void 0:t.pts),i=Number(null==t?void 0:t.duration);return!Number.isFinite(n)||(Number.isFinite(i)&&i>0?e>=n&&e<n+i:e>=n)}(t,e)&&M(HA,this).add(i);const r=Array.isArray(M(VA,this))?M(VA,this):[];if(r.length){if("function"==typeof M(RA,this)){for(let t=0;t<r.length;t+=1){const e=r[t],n=null==e?void 0:e.placementId;if(!n)return;const i=M(RA,this).call(this,e.nodeId);if(!MA(i))return;if(CA(i)&&!M(HA,this).has(n))return}A(KA,this,YA).call(this,e,r)}}else A(KA,this,YA).call(this,e,[])}dispose(){C(VA,this,[]),M(HA,this).clear(),M(GA,this).clear(),C(jA,this,null)}}function YA(t,e){const n=A(KA,this,QA).call(this,t,e);if("function"==typeof M(WA,this)&&M(WA,this).call(this,n,{source:"seek"}),C(jA,this,null),C(VA,this,[]),M(HA,this).clear(),M(GA,this).clear(),"function"==typeof M(UA,this)&&M(UA,this).call(this,Im.TIMELINE_SEEKED,{targetTime:t,placements:Array.isArray(e)?e.slice():[]}),"function"==typeof M($A,this)){const t=M(qA,this)===Mm&&"function"==typeof M(BA,this)?M(BA,this).call(this,n):M(qA,this);M($A,this).call(this,t,{fromSeeking:!0})}}function QA(t,e){const n=Number(t);if(!Number.isFinite(n))return t;if(!Array.isArray(e)||!e.length||"function"!=typeof M(RA,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(!FA(M(RA,this).call(this,n.nodeId)))continue;const o=M(GA,this).get(r);Number.isFinite(o)&&o>i&&(i=o)}return i}function JA(t){if(t&&"function"==typeof t.close)try{t.close()}catch(t){}}function ZA(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=>JA(null==t?void 0:t.frame)))}function tN(t){return Ap(t)}function eN(t){return Number.isFinite(null==t?void 0:t.loopRootOffset)?t.loopRootOffset:tN(t)}function nN(t,e){return"string"==typeof(null==t?void 0:t.loopRootPlacementId)&&t.loopRootPlacementId?t.loopRootPlacementId:e}function iN(t){if("string"!=typeof t)return Number.NaN;const e=t.match(/(\d+)/);return e?Number(e[1]):Number.NaN}function rN(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 oN=1e-6;function sN(t){return t&&("string"!=typeof t.state||"ready"===t.state)}function aN(t){const e=Number(t);return Number.isFinite(e)?e:0}function lN(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 cN(t){return t&&"cue"===t.type&&Array.isArray(t.cues)?t.cues:[]}var uN=new WeakMap,dN=new WeakMap,hN=new WeakMap,fN=new WeakMap,pN=new WeakMap,mN=new WeakMap,vN=new WeakMap,gN=new WeakMap,yN=new WeakSet;class bN{constructor(t={}){O(this,yN),F(this,uN,void 0),F(this,dN,void 0),F(this,hN,void 0),F(this,fN,void 0),F(this,pN,void 0),F(this,mN,void 0),F(this,vN,-1e-6),F(this,gN,null),C(uN,this,t.getPlacements),C(dN,this,t.getPlacementsActiveAtTime),C(hN,this,t.getPlacementDuration),C(fN,this,t.getNode),C(pN,this,t.triggerTimeline),C(mN,this,t.triggerNode)}handleSeeking(t,e){const n=aN(t);C(gN,this,n)}handleSeeked(t){const e=aN(t),n=M(gN,this);C(gN,this,null),Number.isFinite(n)?(A(yN,this,xN).call(this,n,e),C(vN,this,e)):C(vN,this,e)}handleTimeUpdate(t,e={}){const n=aN(t),i=M(vN,this);!0===(null==e?void 0:e.isSeeking)?C(vN,this,n):Number.isFinite(i)?n<=i?n<i&&C(vN,this,n-oN):(A(yN,this,kN).call(this,i,n),C(vN,this,n)):C(vN,this,n)}dispose(){C(gN,this,null),C(vN,this,-1e-6)}}function kN(t,e){const n="function"==typeof M(uN,this)?M(uN,this).call(this):[];A(yN,this,wN).call(this,n,t,e,{onlySticky:!1})}function xN(t,e){if("function"!=typeof M(dN,this))return;const n=M(dN,this).call(this,e);A(yN,this,wN).call(this,n,t,e,{onlySticky:!0})}function wN(t,e,n,i={}){if("function"!=typeof M(fN,this)||"function"!=typeof M(pN,this))return;if(!Array.isArray(t)||!t.length)return;const r=!0===i.onlySticky,o=[];for(let i=0;i<t.length;i+=1){const s=t[i],a=null==s?void 0:s.placementId,l=null==s?void 0:s.nodeId;if(!a||!l)continue;const c=M(fN,this).call(this,l);if(!sN(c))continue;const u=lN(c);if(!u.length)continue;const d=Ap(s);if(!Number.isFinite(d))continue;const h=Number.isFinite(null==s?void 0:s.nodeOffsetOverride)?s.nodeOffsetOverride:0,f="function"==typeof M(hN,this)?M(hN,this).call(this,s):void 0,p="number"==typeof f&&Number.isFinite(f)?d+f:Number.POSITIVE_INFINITY,m=r?d-oN:e;for(let t=0;t<u.length;t+=1){const e=cN(u[t]);for(let i=0;i<e.length;i+=1){const s=e[i],c=aN(null==s?void 0:s.timestamp),u=d+Math.max(0,c-h);u<=p&&(r&&!0!==(null==s?void 0:s.isSticky)||u>m&&u<=n&&"string"==typeof(null==s?void 0:s.name)&&s.name&&o.push({time:u,placementOffset:d,placementId:a,nodeId:l,cuepoint:s,trackIndex:t,cueIndex:i}))}}}o.length&&(o.sort(((t,e)=>t.time!==e.time?t.time-e.time:t.placementOffset!==e.placementOffset?t.placementOffset-e.placementOffset:t.placementId!==e.placementId?t.placementId<e.placementId?-1:1:t.trackIndex!==e.trackIndex?t.trackIndex-e.trackIndex:t.cueIndex-e.cueIndex)),o.forEach((t=>{const e=t.cuepoint,n={time:t.time,nodeId:t.nodeId,placementId:t.placementId,cuepoint:e};M(pN,this).call(this,"cuepoint",n),M(pN,this).call(this,e.name,n),"function"==typeof M(mN,this)&&(M(mN,this).call(this,t.nodeId,"cuepoint",n),M(mN,this).call(this,t.nodeId,e.name,n))})))}class _N{#et;#nt=0;#it=new Set;constructor(t){this.#et="string"==typeof t?t:""}claim(t){if(t)return this.#it.add(t),t;let e;do{e=`${this.#et}${++this.#nt}`}while(this.#it.has(e));return this.#it.add(e),e}reset(){this.#nt=0,this.#it.clear()}}const TN=24e3/1001;function IN(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}:rN(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 EN=new WeakMap,SN=new WeakMap,AN=new WeakMap,NN=new WeakMap,MN=new WeakMap,FN=new WeakMap,CN=new WeakMap,ON=new WeakMap,PN=new WeakMap,RN=new WeakMap,DN=new WeakMap,LN=new WeakMap,BN=new WeakMap,zN=new WeakMap,WN=new WeakMap,$N=new WeakMap,UN=new WeakMap,jN=new WeakMap,qN=new WeakMap,VN=new WeakMap,HN=new WeakMap,GN=new WeakMap,KN=new WeakMap,XN=new WeakMap,YN=new WeakMap,QN=new WeakMap,JN=new WeakMap,ZN=new WeakMap,tM=new WeakMap,eM=new WeakMap,nM=new WeakMap,iM=new WeakMap,rM=new WeakMap,oM=new WeakSet;class sM extends Iu{constructor(...t){super(...t),O(this,oM),F(this,EN,void 0),F(this,SN,void 0),F(this,AN,void 0),F(this,NN,void 0),F(this,MN,void 0),F(this,FN,!1),F(this,CN,[]),F(this,ON,new _N("placement-")),F(this,PN,[]),F(this,RN,new _N("renderplacement-")),F(this,DN,void 0),F(this,LN,void 0),F(this,BN,void 0),F(this,zN,!1),F(this,WN,new Set),F(this,$N,new Set),F(this,UN,new Map),F(this,jN,[]),F(this,qN,0),F(this,VN,new Set),F(this,HN,new Set),F(this,GN,Number.NEGATIVE_INFINITY),F(this,KN,[]),F(this,XN,Number.NEGATIVE_INFINITY),F(this,YN,0),F(this,QN,void 0),F(this,JN,void 0),F(this,ZN,new Map),F(this,tM,null),F(this,eM,void 0),F(this,nM,void 0),F(this,iM,void 0),F(this,rM,void 0);const[e,n={}]=t;C(EN,this,e),C(QN,this,n),C(MN,this,new nA(n)),C(DN,this,new lA(n)),C(NN,this,Om),A(oM,this,gM).call(this),A(oM,this,yM).call(this),C(eM,this,new XA({getState:()=>this.state,getNode:t=>M(EN,this)&&"function"==typeof M(EN,this).get?M(EN,this).get(t):void 0,getPlacementsActiveAtTime:t=>A(oM,this,QM).call(this,t,{endEpsilonSeconds:A(oM,this,sF).call(this)}),getLastStableState:()=>this.getLastStableState(),getPlaybackStartState:t=>this.getPlaybackStartState(t),clearVisualFrameBuffers:()=>A(oM,this,XM).call(this),updateTime:(t,e)=>this.updateTime(t,e),transitionTo:(t,e)=>this.transitionTo(t,e),trigger:(t,e)=>this.trigger(t,e)})),C(nM,this,new bN({getPlacements:()=>M(CN,this).slice(),getPlacementsActiveAtTime:t=>A(oM,this,QM).call(this,t),getPlacementDuration:t=>A(oM,this,CM).call(this,t),getNode:t=>M(EN,this)&&"function"==typeof M(EN,this).get?M(EN,this).get(t):void 0,triggerTimeline:(t,e)=>this.trigger(t,e),triggerNode:(t,e,n)=>{const i=M(EN,this)&&"function"==typeof M(EN,this).get?M(EN,this).get(t):void 0;i&&"function"==typeof i.trigger&&i.trigger(e,n)}})),C(iM,this,(()=>{var t,e;null===(t=M(nM,this))||void 0===t||null===(e=t.handleSeeked)||void 0===e||e.call(t,this.currentTime)})),this.on(Im.TIMELINE_SEEKED,M(iM,this)),C(rM,this,(t=>A(oM,this,IM).call(this,t))),this.on("nodestart",M(rM,this)),this.transitionTo(Nm)}get name(){return"Timeline"}get defaults(){return{snapToFps:TN,maxBufferedVideoFrames:24}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"computeBuffered","notifyDecodedFrame","getDecodedFrameStats","getActiveRenderPlacement","maybeCompleteSeek","getPlacementsActiveAtTime","hasDecodedFirstFrame","getDecodedVisualBuffer","getPlacementDuration","getNode"])}transitionTo(t,e={}){const n=M(AN,this),i=function(t,e,n={}){const i=_A[t];return i?new i(e,n):null}(t,this,M(QN,this)),r=e&&"object"==typeof e&&!Array.isArray(e)?{...e,from:n,to:t}:{from:n,to:t};i?(M(SN,this)&&"function"==typeof M(SN,this).exit&&M(SN,this).exit(),C(SN,this,i),C(AN,this,t),"function"==typeof i.enter&&i.enter(r),this.trigger(Im.TIMELINE_STATE_CHANGE,{from:n,to:t,options:e})):this.log.warn(`Unknown state "${t}"`)}recordStableState(t){C(NN,this,t)}getLastStableState(){return M(NN,this)}enableFirstFrameRenderedGate(){C(FN,this,!0)}getPlaybackStartState(t=this.currentTime){return this.shouldWaitForFirstRenderedFrame(t)?Fm:Mm}shouldWaitForFirstRenderedFrame(t=this.currentTime){if(!M(FN,this)||M(zN,this))return!1;const e=Number.isFinite(t)?t:this.currentTime,n=A(oM,this,QM).call(this,e);return Array.isArray(n)&&n.length>0}notifyFirstFrameRendered(){M(zN,this)||(C(zN,this,!0),this.state===Fm&&this.transitionTo(Mm,{fromFirstFramePending:!0}))}get state(){return M(AN,this)}get paused(){return M(AN,this)===Nm||M(AN,this)===Om}get currentTime(){return M(MN,this).currentTime}set currentTime(t){M(SN,this).seek(t)}get playbackRate(){return M(MN,this).playbackRate}set playbackRate(t){M(MN,this).playbackRate=t}play(){M(SN,this).play()}pause(){M(SN,this).pause()}reset(){M(SN,this).reset()}seekToPlacement(t){if(!t)throw new Error("Timeline.seekToPlacement requires placement id");A(oM,this,AM).call(this);const e=A(oM,this,nF).call(this,t);if(!e)throw new Error("Timeline.seekToPlacement requires placement id");const n=Ap(e);if(!Number.isFinite(n))throw new Error("Timeline.seekToPlacement requires resolved placement offset");return this.currentTime=n,n}updateTime(t,e={}){var n,i;A(oM,this,AM).call(this),A(oM,this,NM).call(this),M(MN,this).seek(t),A(oM,this,YM).call(this,this.currentTime),A(oM,this,JM).call(this);const r="string"==typeof(null==e?void 0:e.source)?e.source:"set";null!==(n=M(nM,this))&&void 0!==n&&null!==(i=n.handleTimeUpdate)&&void 0!==i&&i.call(n,this.currentTime,{isSeeking:this.state===Pm}),A(oM,this,EM).call(this,this.currentTime),A(oM,this,qM).call(this,this.currentTime),this.trigger(Im.TIMELINE_TIME_UPDATE,Em(this.currentTime,r))}startSeeking(t,e){var n,i;null!==(n=M(nM,this))&&void 0!==n&&null!==(i=n.handleSeeking)&&void 0!==i&&i.call(n,this.currentTime,t),M(eM,this)&&"function"==typeof M(eM,this).start&&M(eM,this).start(t,e)}setSeekReturnState(t){M(eM,this)&&"function"==typeof M(eM,this).setReturnState&&M(eM,this).setReturnState(t)}maybeCompleteSeek(t){M(eM,this)&&"function"==typeof M(eM,this).maybeComplete&&M(eM,this).maybeComplete(t)}startPlaybackClock(){M(MN,this).play()}stopPlaybackClock(){M(MN,this).pause()}resetClock(){var t,e;M(MN,this).reset(),null===(t=M(nM,this))||void 0===t||null===(e=t.dispose)||void 0===e||e.call(t)}applyTimelineDefinition(t={}){const e=Array.isArray(null==t?void 0:t.placements)?t.placements:[],n=Array.isArray(null==t?void 0:t.renderPlacements)?t.renderPlacements:[];A(oM,this,aM).call(this),A(oM,this,lM).call(this,e),A(oM,this,cM).call(this,n),this.currentTime=0}placeOnTimeline(t,e,n={}){const i=t&&"object"==typeof t?t.id:t;if(!i)throw new Error("Timeline.placeOnTimeline requires node id");const r=M(ON,this).claim(n.placementId),o=n.nodeOffsetOverride||n.offset,s=n.nodeDurationOverride||n.duration,a=Pp(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}:Op(e,n);let u,d,h,f=!1;const p=null!==a;if(A(oM,this,AM).call(this),a){const t=M(CN,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=Ap(t);if("start"===a.anchor)Number.isFinite(e)?u=A(oM,this,OM).call(this,e,{nodeOffsetOverride:o}):f=!0;else{const n=A(oM,this,CM).call(this,t);if(Number.isFinite(e)&&n>0){const t=e+n,i=A(oM,this,OM).call(this,t,{nodeOffsetOverride:o});u=Math.max(i,t)}else f=!0}}else if(l){const t=n.offsetAnchorPlacementId?M(CN,this).find((t=>(null==t?void 0:t.placementId)===n.offsetAnchorPlacementId)):M(CN,this).length?M(CN,this)[M(CN,this).length-1]:void 0;if(d=n.offsetAnchorPlacementId||(null==t?void 0:t.placementId),d){const e=Ap(t),n=A(oM,this,CM).call(this,t);Number.isFinite(e)&&n>0?u=A(oM,this,OM).call(this,e+n-c,{nodeOffsetOverride:o}):(f=!0,h="end")}else u=A(oM,this,OM).call(this,-c,{nodeOffsetOverride:o})}else u=Cp(e),u=A(oM,this,OM).call(this,u,{...n,nodeOffsetOverride:o});const m=!0===n.loop?n.loopRootPlacementId||r:void 0,v=!0===n.loop&&Number.isFinite(n.loopRootOffset)?n.loopRootOffset:!0===n.loop?u:void 0,g=l?c:a&&"end"===a.anchor?0:void 0,y=new hA({placementId:r,nodeId:i,offset:u,offsetPending:f,offsetAnchorPlacementId:f?d:void 0,offsetAnchorEdge:f?h:void 0,offsetAnchorIsReference:f?p:void 0,offsetEndSeconds:g,nodeOffsetOverride:o,nodeDurationOverride:s,loop:!0===n.loop,loopRootPlacementId:m,loopRootOffset:v});if(M(CN,this).push(y),Mp(M(CN,this)),A(oM,this,UM).call(this,y),A(oM,this,WM).call(this),f&&d){const t=M(CN,this).find((t=>(null==t?void 0:t.placementId)===d));A(oM,this,RM).call(this,null==t?void 0:t.nodeId)}return this.trigger(Im.PLACEMENT_ADDED,y),r}placeRenderNodeOnTimeline(t,e,n,i={}){const r="string"==typeof t?t:null==t?void 0:t.type;if(!r||"string"!=typeof r)throw new Error("Timeline.placeRenderNodeOnTimeline requires render node type");const o=A(oM,this,PM).call(this,e,i),s=o.offset,a=!0===o.offsetPending,l=o.offsetAnchorPlacementId,c=o.offsetAnchorEdge,u=o.offsetAnchorIsReference,d=M(RN,this).claim(i.renderPlacementId),h=Number(n),f=h===Number.POSITIVE_INFINITY,p=Number.isFinite(h)&&h>0||f?h:void 0;if(!p)throw new Error("Timeline.placeRenderNodeOnTimeline requires a positive duration (seconds) or Infinity as 3rd argument");const m=i.params&&"object"==typeof i.params?i.params:void 0,v={renderPlacementId:d,type:r,offset:s,offsetPending:a,offsetAnchorPlacementId:l,offsetAnchorEdge:c,offsetAnchorIsReference:u,duration:p,params:m};if(!a){const t=s,e=s+p;Rp(M(PN,this),t,e,"Timeline.placeRenderNodeOnTimeline does not allow overlapping render node placements")}if(M(PN,this).push(v),Mp(M(PN,this)),a&&l){const t=M(CN,this).find((t=>(null==t?void 0:t.placementId)===l));A(oM,this,RM).call(this,null==t?void 0:t.nodeId)}return this.trigger(Im.RENDER_PLACEMENT_ADDED,v),d}get placements(){return M(CN,this).slice()}getPlacementsActiveAtTime(t){return A(oM,this,QM).call(this,t)}getNodesAtTime(t){const e=A(oM,this,iF).call(this,t);if(!Number.isFinite(e))return[];const n=A(oM,this,QM).call(this,e),i=[];return n.forEach((t=>{const e=this.getNode(null==t?void 0:t.nodeId);e&&i.push(e)})),i}getPlacementDuration(t){return A(oM,this,CM).call(this,t)}getNode(t){if(M(EN,this)&&"function"==typeof M(EN,this).get)return M(EN,this).get(t)}get renderPlacements(){return M(PN,this).slice()}get placementsAhead(){const t=this.currentTime;return M(CN,this).filter((e=>{const n=Ap(e);if(!Number.isFinite(n))return!1;const i=A(oM,this,CM).call(this,e);return"number"==typeof i?n+i>t:n>=t}))}get buffered(){return M(SN,this)?M(SN,this).buffered:{start:0,end:0}}get trackBuffers(){return M(DN,this)}onDispose(){A(oM,this,mM).call(this),M($N,this)&&M($N,this).clear(),M(nM,this)&&"function"==typeof M(nM,this).dispose&&M(nM,this).dispose(),C(nM,this,null),A(oM,this,pM).call(this),A(oM,this,vM).call(this),M(eM,this)&&"function"==typeof M(eM,this).dispose&&M(eM,this).dispose(),C(eM,this,null),M(MN,this)&&"function"==typeof M(MN,this).dispose&&(M(JN,this)&&"function"==typeof M(MN,this).off&&(M(MN,this).off("tick",M(JN,this)),C(JN,this,null)),M(MN,this).dispose(),C(MN,this,null)),A(oM,this,BM).call(this),C(SN,this,null),C(AN,this,null),C(CN,this,[]),C(PN,this,[]),A(oM,this,zM).call(this),A(oM,this,WM).call(this),M(ZN,this).clear(),C(tM,this,null)}notifyDecodedFrame(t={}){const e=null==t?void 0:t.placementId,n=null==t?void 0:t.trackType;if(!e||!n)return;const i=`${e}:${n}`;M(WN,this).add(i),A(oM,this,KM).call(this,t),A(oM,this,JM).call(this),M(SN,this)&&"function"==typeof M(SN,this).handleDecodedFrame&&M(SN,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=IN(t);Number.isFinite(i)&&i>0&&(e.totalBytes+=i)}))}return e.available=!0,e}(M(ZN,this))}hasDecodedFirstFrame(t,e){return!(!t||!e)&&M(WN,this).has(`${t}:${e}`)}getDecodedVisualBuffer(t,e){if(t&&e)return M(ZN,this).get(`${t}:${e}`)}computeBuffered(t){const e=M(EN,this);if(e&&"function"==typeof e.get)return M(DN,this).computeBuffered(M(CN,this),t,e)}getActiveRenderPlacement(t=this.currentTime){const e=Number.isFinite(t)?t:this.currentTime,n=Array.isArray(M(PN,this))?M(PN,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 aM(){C(zN,this,!1),this.trigger(Im.TIMELINE_RESET,{reason:"switch"}),A(oM,this,XM).call(this),M(DN,this)&&"function"==typeof M(DN,this).reset&&M(DN,this).reset(),M($N,this)&&M($N,this).clear(),C(CN,this,[]),C(PN,this,[]),A(oM,this,zM).call(this),A(oM,this,WM).call(this),M(ON,this).reset(),M(RN,this).reset()}function lM(t=[]){for(let e=0;e<t.length;e+=1){const n=t[e];if(!n||!n.nodeId)continue;const i=A(oM,this,uM).call(this,n),r=A(oM,this,hM).call(this,n);this.placeOnTimeline(n.nodeId,r,i)}}function cM(t=[]){for(let e=0;e<t.length;e+=1){const n=t[e];if(!n||!n.type)continue;const i=A(oM,this,dM).call(this,n),r=A(oM,this,fM).call(this,n);this.placeRenderNodeOnTimeline(n.type,r,n.duration,i)}}function uM(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 dM(t){const e={};return t.renderPlacementId&&(e.renderPlacementId=t.renderPlacementId),t.params&&"object"==typeof t.params&&(e.params=t.params),e}function hM(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 fM(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 pM(){M(SN,this)&&"function"==typeof M(SN,this).exit&&M(SN,this).exit()}function mM(){M(iM,this)&&"function"==typeof this.off&&(this.off(Im.TIMELINE_SEEKED,M(iM,this)),C(iM,this,null)),M(rM,this)&&"function"==typeof this.off&&(this.off("nodestart",M(rM,this)),C(rM,this,null))}function vM(){M(DN,this)&&(M(LN,this)&&(M(DN,this).off("track:underflow",M(LN,this)),C(LN,this,null)),M(BN,this)&&(M(DN,this).off("track:ready",M(BN,this)),C(BN,this,null)),"function"==typeof M(DN,this).dispose&&M(DN,this).dispose(),C(DN,this,null))}function gM(){M(DN,this)&&"function"==typeof M(DN,this).on&&(C(LN,this,(t=>A(oM,this,kM).call(this,t))),C(BN,this,(t=>A(oM,this,xM).call(this,t))),M(DN,this).on(Im.TRACK_UNDERFLOW,M(LN,this)),M(DN,this).on(Im.TRACK_READY,M(BN,this)))}function yM(){M(MN,this)&&"function"==typeof M(MN,this).on&&(C(JN,this,(t=>A(oM,this,bM).call(this,t))),M(MN,this).on(Im.CLOCK_TICK,M(JN,this)))}function bM(t){var e,n;A(oM,this,AM).call(this),A(oM,this,JM).call(this),null!==(e=M(nM,this))&&void 0!==e&&null!==(n=e.handleTimeUpdate)&&void 0!==n&&n.call(e,this.currentTime,{isSeeking:!1}),A(oM,this,EM).call(this,this.currentTime),this.trigger(Im.TIMELINE_TIME_UPDATE,Em(this.currentTime,"clock")),M(SN,this)&&"function"==typeof M(SN,this).handleClockTick&&M(SN,this).handleClockTick(t)}function kM(t){A(oM,this,AM).call(this);const e=A(oM,this,wM).call(this);e&&(null==t?void 0:t.trackType)===e.trackType&&(M(SN,this)&&"function"==typeof M(SN,this).handleMainTrackUnderflow?M(SN,this).handleMainTrackUnderflow(t):this.transitionTo(Cm))}function xM(t){if(A(oM,this,AM).call(this),this.state!==Cm)return;const e=A(oM,this,wM).call(this);if(!e)return;if((null==t?void 0:t.trackType)!==e.trackType)return;if(M(SN,this)&&"function"==typeof M(SN,this).handleMainTrackReady)return void M(SN,this).handleMainTrackReady(t);const n=this.getLastStableState()||Om;this.transitionTo(n)}function wM(t=this.currentTime){const e=A(oM,this,TM).call(this,t);if(!e)return;const n=M(EN,this)&&"function"==typeof M(EN,this).get?M(EN,this).get(e.nodeId):void 0;if(!n)return;const i=A(oM,this,_M).call(this,n);return i?{placement:e,trackType:i}:void 0}function _M(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 TM(t=this.currentTime){const e=M(CN,this)||[];let n;for(let i=0;i<e.length;i+=1){const r=e[i],o=Ap(r);if(!Number.isFinite(o))continue;const s=A(oM,this,CM).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 IM(t={}){if(this.state!==Mm)return;const e=null==t?void 0:t.placementId;if(!e)return;const n=A(oM,this,nF).call(this,e);n&&A(oM,this,SM).call(this,n)}function EM(t=this.currentTime){if(this.state!==Mm)return;const e=A(oM,this,QM).call(this,t);Array.isArray(e)&&e.length&&e.forEach((t=>A(oM,this,SM).call(this,t)))}function SM(t){const e=null==t?void 0:t.placementId;if(!e)return;if(M($N,this).has(e))return;if(!t||!0!==t.loop)return;if(!t.nodeId)return;const n=A(oM,this,CM).call(this,t);if(!Number.isFinite(n)||n<=0)return;const i=Ap(t);if(!Number.isFinite(i))return;const r=i+n;if(!Number.isFinite(r))return;const o=t.loopRootPlacementId||t.placementId,s=Number.isFinite(t.loopRootOffset)?t.loopRootOffset:i;M($N,this).add(e),this.placeOnTimeline(t.nodeId,r,{nodeOffsetOverride:t.nodeOffsetOverride,nodeDurationOverride:t.nodeDurationOverride,loop:!0,loopRootPlacementId:o,loopRootOffset:s})}function AM(){const t=Fp(M(CN,this),{getPlacementDuration:t=>A(oM,this,CM).call(this,t),snapPlacementOffset:(t,e)=>A(oM,this,OM).call(this,t,{nodeOffsetOverride:null==e?void 0:e.nodeOffsetOverride}),onResolvedPlacement:(t,e)=>{!0!==t.loop||Number.isFinite(t.loopRootOffset)||(t.loopRootOffset=t.offset),A(oM,this,DM).call(this,null==e?void 0:e.nodeId)}});return t.updated&&(A(oM,this,WM).call(this),t.resolvedPlacements.forEach((t=>{A(oM,this,UM).call(this,t),this.trigger(Im.PLACEMENT_ADDED,t)}))),t.updated}function NM(){if(!M(PN,this).length||!M(CN,this).length)return!1;const t=new Map;M(CN,this).forEach((e=>{(null==e?void 0:e.placementId)&&t.set(e.placementId,e)}));const e=M(PN,this).filter((t=>!0===(null==t?void 0:t.offsetPending)));if(!e.length)return!1;let n=!1;const i=[];for(let r=0;r<e.length;r+=1){const o=e[r];A(oM,this,MM).call(this,o,t)&&(n=!0,i.push(o))}return n&&(Mp(M(PN,this)),i.forEach((t=>{this.trigger(Im.RENDER_PLACEMENT_ADDED,t)}))),n}function MM(t,e){const n=null==t?void 0:t.offsetAnchorPlacementId,i=null==t?void 0:t.offsetAnchorEdge;if(!n||!i)return!1;const r=e.get(n);if(!r||!0===r.offsetPending)return!1;const o=A(oM,this,FM).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 Rp(M(PN,this).filter((e=>e!==t&&!0!==(null==e?void 0:e.offsetPending))),s,a,"Timeline.placeRenderNodeOnTimeline does not allow overlapping render node placements"),A(oM,this,DM).call(this,null==r?void 0:r.nodeId),!0}function FM(t,e){const n=Ap(t);if(!Number.isFinite(n))return;if("start"===e.offsetAnchorEdge)return A(oM,this,OM).call(this,n);const i=A(oM,this,CM).call(this,t);if(!(i>0))return;const r=n+i;if(!Number.isFinite(r))return;const o=A(oM,this,OM).call(this,r);return!0===e.offsetAnchorIsReference?Math.max(o,r):o}function CM(t){return Ep(t,M(EN,this))}function OM(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 PM(t,e={}){const n=Pp(t);if("string"==typeof t&&t.includes("@")&&!n)throw new Error("Timeline.placeRenderNodeOnTimeline requires valid placement reference");if(!n){const n=Cp(t);return{offset:A(oM,this,OM).call(this,n,e)}}const i=M(CN,this).find((t=>(null==t?void 0:t.placementId)===n.placementId));if(!i)throw new Error("Timeline.placeRenderNodeOnTimeline requires valid placement reference");const r=Ap(i);if("start"===n.anchor)return Number.isFinite(r)?{offset:A(oM,this,OM).call(this,r,e)}:{offset:void 0,offsetPending:!0,offsetAnchorPlacementId:i.placementId,offsetAnchorEdge:"start",offsetAnchorIsReference:!0};const o=A(oM,this,CM).call(this,i);if(!(Number.isFinite(r)&&o>0))return{offset:void 0,offsetPending:!0,offsetAnchorPlacementId:i.placementId,offsetAnchorEdge:"end",offsetAnchorIsReference:!0};const s=r+o,a=A(oM,this,OM).call(this,s,e);return{offset:Math.max(a,s)}}function RM(t){if(!t||!M(EN,this)||"function"!=typeof M(EN,this).get)return;if(M(UN,this).has(t))return;let e;try{e=M(EN,this).get(t)}catch(t){return}if(!e||"function"!=typeof e.on)return;if("ready"===e.state&&e.duration>0)return void this.updateTime(this.currentTime);const n=()=>{this.updateTime(this.currentTime),A(oM,this,DM).call(this,t)};e.on(Im.NODE_LOADED,n),M(UN,this).set(t,n)}function DM(t){if(!t)return;if(A(oM,this,LM).call(this,t))return;const e=M(UN,this).get(t);if(!e)return;let n;try{n=M(EN,this).get(t)}catch(t){n=null}n&&"function"==typeof n.off&&n.off(Im.NODE_LOADED,e),M(UN,this).delete(t)}function LM(t){if(!t)return!1;const e=new Map;M(CN,this).forEach((t=>{(null==t?void 0:t.placementId)&&e.set(t.placementId,t)}));const n=n=>{if(null==n||!n.offsetPending||null==n||!n.offsetAnchorPlacementId)return!1;const i=e.get(n.offsetAnchorPlacementId);return(null==i?void 0:i.nodeId)===t};return!!M(CN,this).some((t=>n(t)))||!!M(PN,this).some((t=>n(t)))}function BM(){M(UN,this).size&&M(EN,this)?(M(UN,this).forEach(((t,e)=>{let n;try{n=M(EN,this).get(e)}catch(t){n=null}n&&"function"==typeof n.off&&n.off(Im.NODE_LOADED,t)})),M(UN,this).clear()):M(UN,this).clear()}function zM(){C(jN,this,[]),C(qN,this,0),M(VN,this).clear(),M(HN,this).clear(),C(GN,this,Number.NEGATIVE_INFINITY)}function WM(){C(KN,this,[]),C(YN,this,0),C(XN,this,Number.NEGATIVE_INFINITY)}function $M(t,e){const n=M(jN,this),i={placementId:t,endTime:e};if(!n.length||e>=n[n.length-1].endTime)return void n.push(i);const r=n.findIndex((t=>e<t.endTime)),o=-1===r?n.length:r;n.splice(o,0,i),o<M(qN,this)&&C(qN,this,M(qN,this)+1)}function UM(t){const e=null==t?void 0:t.placementId;if(!e||M(VN,this).has(e))return;const n=Ap(t),i=A(oM,this,CM).call(this,t);if(!Number.isFinite(n)||!Number.isFinite(i)||i<0)return void M(HN,this).add(e);const r=n+i;Number.isFinite(r)&&(M(VN,this).add(e),M(HN,this).delete(e),A(oM,this,$M).call(this,e,r))}function jM(){M(HN,this).size&&Array.from(M(HN,this)).forEach((t=>{const e=A(oM,this,nF).call(this,t);e?A(oM,this,UM).call(this,e):M(HN,this).delete(t)}))}function qM(t){const e=Number(t);if(!Number.isFinite(e))return;if(e<M(GN,this))return void C(GN,this,e);if(C(GN,this,e),A(oM,this,jM).call(this),!M(jN,this).length)return;const n=new Set;let i=M(qN,this);for(;i<M(jN,this).length;){const t=M(jN,this)[i];if(!t||!Number.isFinite(t.endTime)||t.endTime>e)break;t.placementId&&n.add(t.placementId),i+=1}i!==M(qN,this)&&(C(qN,this,i),n.size&&(A(oM,this,GM).call(this,n),A(oM,this,VM).call(this,n)))}function VM(t){if(t&&t.size)for(const e of M(WN,this)){const n=e.split(":")[0];t.has(n)&&M(WN,this).delete(e)}}function HM(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 GM(t){if(t&&t.size)for(const[e,n]of M(ZN,this).entries())t.has(null==n?void 0:n.placementId)&&(A(oM,this,HM).call(this,n),M(ZN,this).delete(e))}function KM(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=rN(a),c=Number.isFinite(null==l?void 0:l.width)?l.width:void 0,u=Number.isFinite(null==l?void 0:l.height)?l.height:void 0,d=Number.isFinite(null==t?void 0:t.pts)?t.pts:void 0;if(!Number.isFinite(d))return;const h=Number.isFinite(null==t?void 0:t.duration)?t.duration:void 0,f=`${n}:${r}`,p=M(ZN,this).get(f),m=p||{placementId:n,nodeId:i,trackId:r,trackType:s,frames:[],current:void 0},v={placementId:n,nodeId:i,trackId:r,segmentId:o,frame:a,width:c,height:u,presentationTime:d,duration:h},g=m.frames,y=g.length?g[g.length-1]:void 0;if(!y||y.presentationTime<=v.presentationTime)g.push(v);else{let t=g.findIndex((t=>t.presentationTime>v.presentationTime));-1===t&&(t=g.length),g.splice(t,0,v)}const b=Number(null===(e=this.settings)||void 0===e?void 0:e.maxBufferedVideoFrames);if("video"===s&&Number.isFinite(b)&&b>0&&g.length>b){const t=g.length-b;for(let e=0;e<t;e+=1){const t=g.pop(),e=null==t?void 0:t.frame;if(e&&"function"==typeof e.close)try{e.close()}catch(t){}}}p||M(ZN,this).set(f,m)}function XM(){for(const t of M(ZN,this).values())A(oM,this,HM).call(this,t);M(ZN,this).clear(),C(tM,this,null),M(WN,this).clear()}function YM(t){const e=Number.isFinite(t)?t:this.currentTime;if(!Number.isFinite(e))return;e<M(XN,this)&&(C(KN,this,[]),C(YN,this,0));const n=Array.isArray(M(CN,this))?M(CN,this):[],i=[],r=new Set;M(KN,this).forEach((t=>{A(oM,this,aF).call(this,t,e)&&(i.push(t),(null==t?void 0:t.placementId)&&r.add(t.placementId))}));let o=M(YN,this);for(;o<n.length;){const t=n[o],s=Ap(t);if(!Number.isFinite(s))break;if(s>e)break;if(A(oM,this,aF).call(this,t,e)){const e=null==t?void 0:t.placementId;e&&r.has(e)||(i.push(t),e&&r.add(e))}o+=1}C(KN,this,i),C(YN,this,o),C(XN,this,e)}function QM(t,e={}){const n=Number.isFinite(t)?t:this.currentTime,i=Number.isFinite(null==e?void 0:e.endEpsilonSeconds)?e.endEpsilonSeconds:0;return 0===i&&n===this.currentTime&&n===M(XN,this)?M(KN,this).slice():(Array.isArray(M(CN,this))?M(CN,this):[]).filter((t=>A(oM,this,aF).call(this,t,n,i)))}function JM(){const t=this.currentTime,e=A(oM,this,tF).call(this,t);if(!e.length)return void C(tM,this,null);const n=this.getActiveRenderPlacement(t),i=A(oM,this,eF).call(this,e,n);(i!==M(tM,this)||A(oM,this,ZM).call(this,t,n))&&(C(tM,this,i),this.trigger(Im.VISUAL_FRAMES_AVAILABLE,{time:t,frames:e}))}function ZM(t,e){const n=e||this.getActiveRenderPlacement(t);if(!n)return!1;if(!Qp.doesRenderNodeTypeRequireFrameCadence(null==n?void 0:n.type))return!1;const i=n.duration;return"number"==typeof i&&i>0}function tF(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){ZA(c),a.push(t);continue}if("function"==typeof r&&!r(u,n)){const e=tN(u),i="function"==typeof o?o(u):void 0;Number.isFinite(i)&&Number.isFinite(e)&&n>=e+i&&(ZA(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&&JA(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:tN(u),placementSortOffset:eN(u),placementSortId:nN(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=iN(r),a=iN(o);return Number.isFinite(s)&&Number.isFinite(a)&&s!==a?s-a:r&&o&&r!==o?r<o?-1:1:function(t,e){const n=(null==t?void 0:t.frame)||{},i=(null==e?void 0:e.frame)||{};return n.trackId!==i.trackId?n.trackId<i.trackId?-1:1:n.nodeId!==i.nodeId?n.nodeId<i.nodeId?-1:1:n.segmentId!==i.segmentId?n.segmentId<i.segmentId?-1:1:("number"==typeof n.presentationTime?n.presentationTime:0)-("number"==typeof i.presentationTime?i.presentationTime:0)}(t,e)})),s.map((t=>t.frame))}({buffers:M(ZN,this),time:t,getPlacementById:t=>A(oM,this,nF).call(this,t),isPlacementActiveAtTime:(t,e)=>A(oM,this,aF).call(this,t,e),getPlacementDuration:t=>A(oM,this,CM).call(this,t)})}function eF(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 nF(t){if(t)return(M(CN,this)||[]).find((e=>(null==e?void 0:e.placementId)===t))}function iF(t){if("end"===t){const t=A(oM,this,rF).call(this);if(!Number.isFinite(t))return;const e=A(oM,this,oF).call(this);return Math.max(0,t-Math.min(t,e))}const e=Number(t);return Number.isFinite(e)?e:0}function rF(){let t;return(Array.isArray(M(CN,this))?M(CN,this):[]).forEach((e=>{const n=Ap(e);if(!Number.isFinite(n))return;const i=A(oM,this,CM).call(this,e);if(!Number.isFinite(i))return;const r=n+i;Number.isFinite(r)&&(!Number.isFinite(t)||r>t)&&(t=r)})),t}function oF(){const t=A(oM,this,sF).call(this);return t>0?t:.001}function sF(){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 aF(t,e,n=0){if(!Np(t,e,M(EN,this)))return!1;const i=Number(n);if(!Number.isFinite(i)||i<=0)return!0;const r=A(oM,this,CM).call(this,t);if(!Number.isFinite(r))return!0;const o=Ap(t);return!Number.isFinite(o)||e<o+r-i}var lF=new WeakMap,cF=new WeakMap,uF=new WeakMap,dF=new WeakMap,hF=new WeakMap,fF=new WeakMap,pF=new WeakMap,mF=new WeakMap,vF=new WeakMap,gF=new WeakMap,yF=new WeakMap,bF=new WeakMap,kF=new WeakMap,xF=new WeakMap,wF=new WeakMap,_F=new WeakMap,TF=new WeakMap,IF=new WeakSet;class EF extends Iu{get name(){return"QoE"}get defaults(){return{calcScoreInterval:1,streamQualityWeight:.8,fpsWeight:.2,fpsMathFuncType:"quad",bestFpsMobile:27,bestFpsDesktop:57,waitingMultiplier:1,statusFloors:{excellent:.98,good:.85,fair:.7,poor:0,alert:0},alertStatusCeil:.3,fpsGracePeriod:2,windowSeconds:30}}constructor(...t){super(...t),O(this,IF),F(this,lF,void 0),F(this,cF,void 0),F(this,uF,1),F(this,dF,1),F(this,hF,1),F(this,fF,""),F(this,pF,0),F(this,mF,[]),F(this,vF,null),F(this,gF,void 0),F(this,yF,[]),F(this,bF,null),F(this,kF,null),F(this,xF,0),F(this,wF,0),F(this,_F,0),F(this,TF,void 0);const[e]=t;C(lF,this,e),C(xF,this,Sg()),C(TF,this,A(IF,this,SF).call(this)),A(IF,this,AF).call(this),A(IF,this,NF).call(this),A(IF,this,PF).call(this),A(IF,this,CF).call(this)}get publicAPI(){return M(TF,this)}calcScore(){A(IF,this,jF).call(this)}onDispose(){M(lF,this)&&M(cF,this)&&"function"==typeof M(lF,this).off&&M(lF,this).off(Im.TIMELINE_PLAYER_STATE,M(cF,this)),C(cF,this,null),A(IF,this,OF).call(this),A(IF,this,RF).call(this),C(lF,this,null),C(yF,this,[]),C(mF,this,[]),C(TF,this,null)}}function SF(){const t=this;return{get score(){return M(uF,t)},get status(){return M(fF,t)},get streamQualityScore(){return M(dF,t)},get fpsScore(){return M(hF,t)},get browserFps(){return M(pF,t)},get waitingSeconds(){return M(wF,t)/1e3},get playingSeconds(){return M(_F,t)/1e3}}}function AF(){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 NF(){M(lF,this)&&"function"==typeof M(lF,this).on&&(C(cF,this,(t=>A(IF,this,MF).call(this,t))),M(lF,this).on(Im.TIMELINE_PLAYER_STATE,M(cF,this)))}function MF(t={}){const e="string"==typeof(null==t?void 0:t.event)?t.event:"";"playing"!==e?"waiting"!==e?"pause"!==e&&"seeking"!==e&&"seeked"!==e&&"reset"!==e||A(IF,this,FF).call(this,null):A(IF,this,FF).call(this,"waiting"):A(IF,this,FF).call(this,"playing")}function FF(t){if(t===M(bF,this))return;const e=Sg();M(bF,this)&&Number.isFinite(M(kF,this))&&M(yF,this).push({state:M(bF,this),startMs:M(kF,this),endMs:e}),C(bF,this,t),C(kF,this,t?e:null),A(IF,this,BF).call(this,e)}function CF(){const t=Number(this.settings.calcScoreInterval);!Number.isFinite(t)||t<=0||(C(gF,this,(()=>A(IF,this,jF).call(this))),uk(M(gF,this),1e3*t))}function OF(){M(gF,this)&&dk(M(gF,this)),C(gF,this,null)}function PF(){if("function"!=typeof tk)return;const t=()=>{if(this._disposed)return;const e=Sg();C(pF,this,A(IF,this,DF).call(this,M(mF,this),e)),C(vF,this,tk(t))};C(vF,this,tk(t))}function RF(){M(vF,this)&&"function"==typeof ek&&ek(M(vF,this)),C(vF,this,null)}function DF(t,e){const n=A(IF,this,LF).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 LF(){const t=Number(this.settings.windowSeconds);return!Number.isFinite(t)||t<=0?3e4:1e3*t}function BF(t){const e=t-A(IF,this,LF).call(this);for(;M(yF,this).length&&M(yF,this)[0].endMs<=e;)M(yF,this).shift()}function zF(t){const e=t-A(IF,this,LF).call(this);let n=0,i=0;const r=(r,o,s)=>{const a=Math.max(o,e),l=Math.min(s,t);l<=a||("waiting"===r?n+=l-a:"playing"===r&&(i+=l-a))};return M(yF,this).forEach((t=>{r(t.state,t.startMs,t.endMs)})),M(bF,this)&&Number.isFinite(M(kF,this))&&r(M(bF,this),M(kF,this),t),C(wF,this,n),C(_F,this,i),{waitingMs:n,playingMs:i}}function WF(t,e){if(t<=0)return 1;if(t>e)return 0;const n=e||1;return Tp(1-t*this.settings.waitingMultiplier/n)}function $F(){if(Sg()-M(xF,this)<=1e3*this.settings.fpsGracePeriod)return 1;const t=Number(M(pF,this)),e=_m.isDesktop()?this.settings.bestFpsDesktop:this.settings.bestFpsMobile,n=Tp(e>0?t/e:0);return"quad"===this.settings.fpsMathFuncType?n*n:n}function UF(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 jF(){const t=Sg(),{waitingMs:e,playingMs:n}=A(IF,this,zF).call(this,t),i=A(IF,this,WF).call(this,e,n),r=A(IF,this,$F).call(this),o=Tp(i*this.settings.streamQualityWeight+r*this.settings.fpsWeight);o!==M(uF,this)&&(C(uF,this,o),this.trigger(Im.QOE_SCORE,o)),C(dF,this,i),C(hF,this,r);const s=A(IF,this,UF).call(this,o,e);s!==M(fF,this)&&(C(fF,this,s),this.trigger(Im.QOE_STATUS,s))}function qF(t,e=0){const n=Number(t);return Number.isFinite(n)?n:e}function VF(t){const e=Number(t);return!Number.isFinite(e)||e<0?0:e}var HF=new WeakMap,GF=new WeakMap,KF=new WeakMap,XF=new WeakMap,YF=new WeakSet;class QF extends Iu{get name(){return"SegmentEvictionCoordinator"}get defaults(){return{enabled:qg("segmentEvictionEnabled"),bufferBehindSeconds:qg("segmentEvictionBufferBehindSeconds"),bufferAheadSeconds:qg("segmentEvictionBufferAheadSeconds"),maxRetainedBytes:qg("segmentEvictionMaxRetainedBytes")}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"evictAtTime"])}constructor(t,e,n={}){super(n),O(this,YF),F(this,HF,void 0),F(this,GF,void 0),F(this,KF,void 0),F(this,XF,void 0),C(HF,this,t),C(GF,this,e),C(KF,this,(t=>A(YF,this,JF).call(this,t))),C(XF,this,(t=>A(YF,this,ZF).call(this,t))),M(HF,this)&&"function"==typeof M(HF,this).on&&(M(HF,this).on(Im.TIMELINE_TIME_UPDATE,M(KF,this)),M(HF,this).on(Im.TIMELINE_SEEKED,M(XF,this)))}onDispose(){M(HF,this)&&"function"==typeof M(HF,this).off&&(M(HF,this).off(Im.TIMELINE_TIME_UPDATE,M(KF,this)),M(HF,this).off(Im.TIMELINE_SEEKED,M(XF,this))),C(HF,this,null),C(GF,this,null),C(KF,this,null),C(XF,this,null)}evictAtTime(t){if(!0!==this.settings.enabled)return;const e=Number(t);if(!Number.isFinite(e))return;const n=VF(this.settings.bufferBehindSeconds),i=VF(this.settings.bufferAheadSeconds),r=e-n,o=e+i,s=A(YF,this,tC).call(this);if(!s.length)return;const a=Number(this.settings.maxRetainedBytes);if(Number.isFinite(a)&&a>0&&A(YF,this,eC).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=Ap(t);if(!Number.isFinite(n))return;const i=l.get(e)||[];i.push(t),l.set(e,i)})),l.size&&l.forEach(((t,e)=>{const n=A(YF,this,nC).call(this,e);if(!n)return;const i=t.filter((t=>A(YF,this,iC).call(this,t,r,o)));i.length?A(YF,this,rC).call(this,n,i,r,o):"function"==typeof n.evict&&n.evict()}))}}function JF(t){var e,n;if(!0!==this.settings.enabled)return;if((null===(e=M(HF,this))||void 0===e?void 0:e.state)===Pm)return;const i=Number(null==t?void 0:t.time),r=Number.isFinite(i)?i:Number(null===(n=M(HF,this))||void 0===n?void 0:n.currentTime);this.evictAtTime(r)}function ZF(t){var e;if(!0!==this.settings.enabled)return;const n=Number(null==t?void 0:t.targetTime),i=Number.isFinite(n)?n:Number(null===(e=M(HF,this))||void 0===e?void 0:e.currentTime);this.evictAtTime(i)}function tC(){var t;const e=null===(t=M(HF,this))||void 0===t?void 0:t.placements;return Array.isArray(e)?e:[]}function eC(t){if(!Array.isArray(t)||!t.length)return 0;const e=new Set;let n=0;return t.forEach((t=>{const i=null==t?void 0:t.nodeId;if(!i||e.has(i))return;e.add(i);const r=A(YF,this,nC).call(this,i),o=Number(null==r?void 0:r.retainedByteLength);eg(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=>{eg(null==t?void 0:t.retainedByteLength)&&(n+=t.retainedByteLength)}))}))})),n}function nC(t){if(M(GF,this)&&"function"==typeof M(GF,this).get)return M(GF,this).get(t)}function iC(t,e,n){const i=Ap(t);if(!Number.isFinite(i))return!1;const r=Ep(t,M(GF,this));return(Number.isFinite(r)?i+r:Number.POSITIVE_INFINITY)>e&&i<n}function rC(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=qF(null==t?void 0:t.offset,0);r.forEach((t=>{if(!t||!eg(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=Ap(a);if(!Number.isFinite(l))continue;const c=qF(null==a?void 0:a.nodeOffsetOverride,0),u=qF(null==t?void 0:t.offset,NaN);if(!Number.isFinite(u))continue;const d=qF(null==t?void 0:t.duration,0),h=l+o+u-c,f=h+(d>0?d:0),p=Ep(a,M(GF,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 oC=new WeakMap,sC=new WeakMap,aC=new WeakMap,lC=new WeakSet;let cC=class extends Iu{get name(){return"DocumentVisibility"}get defaults(){return{autoPauseOnVisibilityChange:!0,autoResumeOnVisibilityChange:!0}}constructor(t,e={}){super(e),O(this,lC),F(this,oC,void 0),F(this,sC,null),F(this,aC,!1),C(oC,this,t),A(lC,this,uC).call(this)}onDispose(){A(lC,this,dC).call(this),C(oC,this,null),C(aC,this,!1)}};function uC(){const t=null==Au?void 0:Au.document;t&&"function"==typeof t.addEventListener&&(C(sC,this,(()=>A(lC,this,hC).call(this))),t.addEventListener("visibilitychange",M(sC,this)))}function dC(){const t=null==Au?void 0:Au.document;M(sC,this)&&t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",M(sC,this)),C(sC,this,null)}function hC(){const t=null==Au?void 0:Au.document,e=null==t?void 0:t.visibilityState;"string"==typeof e&&("hidden"!==e?"visible"===e&&A(lC,this,pC).call(this):A(lC,this,fC).call(this))}function fC(){var t;(null===(t=this.settings)||void 0===t?void 0:t.autoPauseOnVisibilityChange)&&M(oC,this)&&"function"==typeof M(oC,this).pause&&(M(oC,this).state===Mm?(this.log.info("[#handleHidden] Pausing timeline due to document visibility change"),M(oC,this).pause(),C(aC,this,!0)):C(aC,this,!1))}function pC(){var t;M(aC,this)&&(null===(t=this.settings)||void 0===t?void 0:t.autoResumeOnVisibilityChange)&&M(oC,this)&&"function"==typeof M(oC,this).play&&(M(oC,this).state!==Mm?(this.log.info("[#handleVisible] Resuming timeline due to document visibility change"),M(oC,this).play(),C(aC,this,!1)):C(aC,this,!1))}const mC=[{event:"canplay",once:!0,trackAs:"canplay"},{event:"playing",once:!0,trackAs:"startedplaying"},"play","playing","waiting","pause","seeking","seeked","nodestart","nodeend"];function vC(t,e=0){return Number.isFinite(t)?t:e}function gC(t){const e=null==t?void 0:t.exposedPlayerAPI;return e&&"object"==typeof e?e:t}const yC=[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:vC(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:vC(null==r?void 0:r.volume),playercontainerwidth:vC(null==r?void 0:r.containerWidth),playercontainerheight:vC(null==r?void 0:r.containerHeight)}}}},function(t){return{schema:"iglu:com.helloeko/currentnode/jsonschema/1-0-1",match:/^.*$/,getData:()=>{var e;const n=gC(t),i=function(t){const e=gC(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==Au||null===(t=Au.eko)||void 0===t||null===(t=t.environment)||void 0===t?void 0:t.embeddingApp;return e?{embeddingapp:e}:{}}}}],bC=Object.freeze({once:!1,trackAs:""});var kC=new WeakMap,xC=new WeakMap,wC=new WeakMap,_C=new WeakMap,TC=new WeakSet;class IC extends Iu{get name(){return"Tracker"}get defaults(){return{trackingEnabled:qg("trackingEnabled"),defaultForwarders:mC,defaultContextPackers:yC}}constructor(t,e={}){super(e),O(this,TC),F(this,kC,void 0),F(this,xC,new Map),F(this,wC,[]),F(this,_C,!1),C(kC,this,t),A(TC,this,FC).call(this),A(TC,this,EC).call(this)}track(t,...e){if(!this.settings.trackingEnabled)return;if("string"!=typeof t||!t)return void this.log.warn("[track] Expected event to be a non-empty string.");const n=A(TC,this,OC).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=A(TC,this,OC).call(this);n&&n("registerContextPacker",e)}onDispose(){A(TC,this,MC).call(this),A(TC,this,CC).call(this),C(kC,this,null),C(_C,this,!1)}}function EC(){(Array.isArray(this.settings.defaultForwarders)?this.settings.defaultForwarders:[]).forEach((t=>A(TC,this,SC).call(this,t)))}function SC(t){const e=A(TC,this,AC).call(this,t);if(!e)return void this.log.warn("[#addEventForwarder] Invalid forwarder input.",t);const n=M(kC,this);if(!n||"function"!=typeof n.on)return;const i=A(TC,this,NC).call(this,e);if(M(xC,this).has(i))return;const r=(...t)=>{e.once&&n&&"function"==typeof n.off&&n.off(e.event,r);const i=e.trackAs||e.event;this.track(i,...t)};n.on(e.event,r),M(xC,this).set(i,{event:e.event,listener:r})}function AC(t){return"string"==typeof t&&t?{event:t,...bC}: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 NC({event:t,once:e,trackAs:n}){return`${t}:${e}:${n}`}function MC(){const t=M(kC,this);t&&"function"==typeof t.off&&M(xC,this).forEach((({event:e,listener:n})=>{t.off(e,n)})),M(xC,this).clear()}function FC(){(Array.isArray(this.settings.defaultContextPackers)?this.settings.defaultContextPackers:[]).forEach((t=>{if("function"!=typeof t)return;const e=t(M(kC,this),this);e&&"object"==typeof e&&("function"==typeof e.dispose&&M(wC,this).push(e.dispose),e.disabled||this.registerContextPacker({schema:e.schema,match:e.match,getData:e.getData}))}))}function CC(){M(wC,this).forEach((t=>{try{t()}catch(t){this.log.warn("[#teardownContextPackers] Failed disposing context packer.",t)}})),C(wC,this,[])}function OC(){const t=null==Au?void 0:Au.EkoAnalytics;return"function"==typeof t?t:(A(TC,this,PC).call(this),null)}function PC(){this.settings.trackingEnabled&&!M(_C,this)&&(this.log.warn("EkoAnalytics not found on window."),C(_C,this,!0))}class RC{#E;#rt;#ot;#st;#at;#lt;#ct;#ut;#dt;#ht;#ft;#pt;#mt;#vt;#gt;#yt;#bt;#kt;#xt;constructor(t,e={},n=null){this.#E=new Mu(t,e),this.#rt=new Bu(this.#E,e),this.#ot=new Hb(e),this.#st=new Qg(e),this.#at=new Sb(this.#st,e),this.#lt=new wb(this.#at,this.#ot,e),this.#ct=new Rb(this.#lt,e),this.#ut=new sM(this.#lt,e),this.#dt=new cC(this.#ut,e),this.#kt=new QF(this.#ut,this.#lt,e),this.#ht=new Ck(this.#lt,this.#ct,this.#ot,this.#ut,e),this.#ft=new yx(this.#lt,this.#ct,this.#ut,e),this.#pt=new AI(e),this.#mt=new ZI(this.#lt,this.#ut,this.#pt,e),this.#gt=new EF(this.#ut,e),this.#xt=new IC(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.#yt=r?r({timeline:this.#ut,canvas:this.#E,containerSize:this.#rt,options:e}):new kv(this.#ut,this.#E,this.#rt,e),this.#vt=o?o({timeline:this.#ut,decodeCoordinator:this.#mt,options:e}):new RS(this.#ut,this.#mt,e),this.#bt=new eS(this.#ut,this.#yt,e)}get canvas(){return this.#E}get containerSize(){return this.#rt}get assetsDeliveryService(){return this.#ot}get downloadSpeed(){return this.#st}get abrSelector(){return this.#at}get nodeRepository(){return this.#lt}get nodePrioritizer(){return this.#ct}get timeline(){return this.#ut}get documentVisibility(){return this.#dt}get nodeResolver(){return this.#ht}get segmentLoadCoordinator(){return this.#ft}get decoderFactory(){return this.#pt}get parsingManager(){return this.#mt}get audioAdapter(){return this.#vt}get audioPlaybackManager(){return this.#vt}get qoe(){return this.#gt}get renderAdapter(){return this.#yt}get renderer(){return this.#yt}get transitionManager(){return this.#bt}get tracker(){return this.#xt}dispose(){[this.#xt,this.#ut,this.#dt,this.#ft,this.#ht,this.#ct,this.#lt,this.#ot,this.#at,this.#st,this.#mt,this.#pt,this.#vt,this.#gt,this.#yt,this.#bt,this.#kt,this.#rt,this.#E].forEach((t=>{t&&"function"==typeof t.dispose&&t.dispose()})),this.#ut=null,this.#dt=null,this.#ft=null,this.#ht=null,this.#ct=null,this.#lt=null,this.#ot=null,this.#at=null,this.#st=null,this.#mt=null,this.#pt=null,this.#vt=null,this.#gt=null,this.#yt=null,this.#bt=null,this.#kt=null,this.#E=null,this.#xt=null}}const DC="main.1154004";var LC={isPlainObject:ku,deepMerge:xu,get:_g,set:Tg,ekoGlobalStore:Ig,download:Wg,isPositiveNumber:eg,clamp01:Tp,root:Au,now:Sg,getFrameDimensions:rN,useragent:Tm,requestAnimationFrame:tk,cancelAnimationFrame:ek,start:uk,stop:dk,isTicking:hk,predicator:function(t,e){const n=e||{};if("function"!=typeof t)return void nk.error("[predicator] Bad argument given to predicator, first argument must be a function.",arguments);if(t.apply())return nk.debug("[predicator] Invoking onFulfilled immediately."),void("function"==typeof n.onFulfilled&&n.onFulfilled.call(null,0));const i=n.timeout||1e4,r=n.interval,o=Sg();let s,a,l,c,u;c=function(){t.apply()&&l()},l=function(){dk(c),Au.clearTimeout(s),u=Sg()-o,nk.debug("[predicator] Invoking onFulfilled after "+u+" ms."),"function"==typeof n.onFulfilled&&n.onFulfilled.call(null,u)},a=function(){dk(c),u=Sg()-o,nk.debug("[predicator] Invoking onTimeout after "+u+" ms."),"function"==typeof n.onTimeout&&n.onTimeout.call(null,u)},s=Au.setTimeout(a,i),uk(c,r)},createThrottler:fk,scheduleExecution:pk},BC=new WeakMap,zC=new WeakMap,WC=new WeakMap,$C=new WeakMap,UC=new WeakMap,jC=new WeakMap,qC=new WeakMap,VC=new WeakSet;class HC{constructor(t){O(this,VC),F(this,BC,[]),F(this,zC,[]),F(this,WC,new _N("placement-")),F(this,$C,new _N("renderplacement-")),F(this,UC,void 0),F(this,jC,new Map),F(this,qC,void 0),C(UC,this,t),C(qC,this,{allowUnready:!0,getNode:t=>A(VC,this,GC).call(this,t)})}get placements(){return M(BC,this).slice()}get renderPlacements(){return M(zC,this).slice()}getNodesAtTime(t){A(VC,this,KC).call(this);const e=A(VC,this,YC).call(this,t);if(!Number.isFinite(e))return[];const n=M(BC,this).filter((t=>Np(t,e,null,M(qC,this)))),i=[];return n.forEach((t=>{const e=A(VC,this,GC).call(this,null==t?void 0:t.nodeId);e&&i.push(e)})),i}placeOnTimeline(t,e,n={}){const i=t&&"object"==typeof t?t:null,r=i?i.id:t;if(!r)throw new Error("TimelineDefinition.placeOnTimeline requires node id");i&&M(jC,this).set(r,i);const o=n.nodeOffsetOverride||n.offset,s=n.nodeDurationOverride||n.duration,a=Pp(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}:Op(e,n);let u,d,h,f=!1;const p=null!==a;if(a){const t=M(BC,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=Ap(t);if("start"===a.anchor)Number.isFinite(e)?u=e:f=!0;else{const n=A(VC,this,XC).call(this,t);Number.isFinite(e)&&n>0?u=e+n:f=!0}}else if(l){const t=n.offsetAnchorPlacementId?M(BC,this).find((t=>(null==t?void 0:t.placementId)===n.offsetAnchorPlacementId)):M(BC,this).length?M(BC,this)[M(BC,this).length-1]:void 0;if(d=n.offsetAnchorPlacementId||(null==t?void 0:t.placementId),d){const e=Ap(t),n=A(VC,this,XC).call(this,t);Number.isFinite(e)&&n>0?u=e+n-c:(f=!0,h="end")}else u=-c}else u=Cp(e);const m=M(WC,this).claim(n.placementId),v={placementId:m,nodeId:r,offset:u,offsetPending:f,offsetAnchorPlacementId:f?d:void 0,offsetAnchorEdge:f?h:void 0,offsetAnchorIsReference:f?p:void 0,offsetEndSeconds:l?c:a&&"end"===a.anchor?0:void 0,nodeOffsetOverride:o,nodeDurationOverride:s,loop:!0===n.loop};return M(BC,this).push(v),Mp(M(BC,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=Pp(e);if("string"==typeof e&&e.includes("@")&&!c)throw new Error("TimelineDefinition.placeRenderNodeOnTimeline requires valid placement reference");const u=null!==c;if(c){const t=M(BC,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=Ap(t);if("start"===c.anchor)Number.isFinite(e)?o=e:l=!0;else{const n=A(VC,this,XC).call(this,t);Number.isFinite(e)&&Number.isFinite(n)?o=e+n:l=!0}}else o=Cp(e);const d=M($C,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;Rp(M(zC,this),t,e,"TimelineDefinition.placeRenderNodeOnTimeline does not allow overlapping render nodes")}return M(zC,this).push(m),Mp(M(zC,this)),d}}function GC(t){if(t)return M(UC,this)&&"function"==typeof M(UC,this).get?M(UC,this).get(t):M(jC,this).get(t)}function KC(){return Fp(M(BC,this),{getPlacementDuration:t=>A(VC,this,XC).call(this,t)}).updated}function XC(t){return Ep(t,null,M(qC,this))}function YC(t){if("end"===t){const t=A(VC,this,QC).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 QC(){let t;return M(BC,this).forEach((e=>{const n=Ap(e);if(!Number.isFinite(n))return;const i=A(VC,this,XC).call(this,e);if(!Number.isFinite(i))return;const r=n+i;Number.isFinite(r)&&(!Number.isFinite(t)||r>t)&&(t=r)})),t}const JC=new Set(["canplay","play","playing","waiting","pause","seeking","seeked"]);var ZC=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,vO=new WeakMap,gO=new WeakMap,yO=new WeakMap,bO=new WeakMap,kO=new WeakMap,xO=new WeakMap,wO=new WeakMap,_O=new WeakMap,TO=new WeakSet;class IO extends Iu{get name(){return"EkoPlayer"}get exposedPlayerAPI(){return M(nO,this)}constructor(t,e={}){const{options:n,publicOptions:i}=function(t={}){const e=xu({},Ug,t);Object.entries($g).forEach((([t,{targetPaths:n}])=>{void 0!==e[t]&&n.forEach((n=>{void 0===_g(e,n)&&Tg(e,n,e[t])}))}));const n=function(t){const e={};return Object.keys($g).forEach((n=>{Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})),Object.freeze(e)}(e);return jg.info("Processed options:",e),jg.info("Public options:",n),{options:e,publicOptions:n}}(e);return super(n),O(this,TO),F(this,ZC,void 0),F(this,tO,void 0),F(this,eO,void 0),F(this,nO,void 0),F(this,iO,void 0),F(this,rO,void 0),F(this,oO,void 0),F(this,sO,void 0),F(this,aO,void 0),F(this,lO,void 0),F(this,cO,void 0),F(this,uO,void 0),F(this,dO,void 0),F(this,hO,void 0),F(this,fO,void 0),F(this,pO,void 0),F(this,mO,void 0),F(this,vO,void 0),F(this,gO,void 0),F(this,yO,void 0),F(this,bO,void 0),F(this,kO,void 0),F(this,xO,void 0),F(this,wO,void 0),F(this,_O,0),C(eO,this,i),this.log.info("Initializing EkoPlayer with options:",i),C(uO,this,new RC(t,n,this)),A(TO,this,RO).call(this,M(uO,this)),C(fO,this,(t=>A(TO,this,EO).call(this,t))),M(tO,this)&&"function"==typeof M(tO,this).on&&M(tO,this).on(Im.TIMELINE_CUEPOINT,M(fO,this)),C(pO,this,null),C(vO,this,(t=>A(TO,this,SO).call(this,t))),C(gO,this,(t=>{const e=t&&"object"==typeof t?t:{};A(TO,this,SO).call(this,{...e,event:"seeking"})})),C(yO,this,(t=>{const e=t&&"object"==typeof t?t:{};A(TO,this,SO).call(this,{...e,event:"seeked"})})),M(tO,this)&&"function"==typeof M(tO,this).on&&(M(tO,this).on(Im.TIMELINE_PLAYER_STATE,M(vO,this)),M(tO,this).on(Im.TIMELINE_SEEKING,M(gO,this)),M(tO,this).on(Im.TIMELINE_SEEKED,M(yO,this))),C(xO,this,(t=>{const e=t&&"object"==typeof t?t:{};this.trigger(Im.CONTAINER_RESIZE,e)})),M(dO,this)&&"function"==typeof M(dO,this).on&&M(dO,this).on(Im.CONTAINER_RESIZE,M(xO,this)),A(TO,this,FO).call(this),A(TO,this,MO).call(this),C(nO,this,A(TO,this,PO).call(this)),M(nO,this)}onDispose(){M(tO,this)&&"function"==typeof M(tO,this).off&&M(fO,this)&&M(tO,this).off(Im.TIMELINE_CUEPOINT,M(fO,this)),C(fO,this,null),M(tO,this)&&"function"==typeof M(tO,this).off&&(M(vO,this)&&M(tO,this).off(Im.TIMELINE_PLAYER_STATE,M(vO,this)),M(gO,this)&&M(tO,this).off(Im.TIMELINE_SEEKING,M(gO,this)),M(yO,this)&&M(tO,this).off(Im.TIMELINE_SEEKED,M(yO,this))),C(vO,this,null),C(gO,this,null),C(yO,this,null),C(pO,this,null),M(dO,this)&&"function"==typeof M(dO,this).off&&M(xO,this)&&M(dO,this).off(Im.CONTAINER_RESIZE,M(xO,this)),C(xO,this,null),M(cO,this)&&"function"==typeof M(cO,this).off&&(M(bO,this)&&M(cO,this).off("qoescore",M(bO,this)),M(kO,this)&&M(cO,this).off("qoestatus",M(kO,this))),C(bO,this,null),C(kO,this,null),M(lO,this)&&"function"==typeof M(lO,this).off&&M(wO,this)&&M(lO,this).off(Im.DECODER_ERROR,M(wO,this)),C(wO,this,null),C(_O,this,0),M(hO,this)&&"function"==typeof M(hO,this).dispose&&M(hO,this).dispose(),C(hO,this,null),M(uO,this)&&"function"==typeof M(uO,this).dispose&&M(uO,this).dispose(),C(tO,this,null),C(ZC,this,null),C(rO,this,null),C(oO,this,null),C(sO,this,null),C(aO,this,null),C(lO,this,null),C(cO,this,null),C(dO,this,null),C(iO,this,null),C(nO,this,null),C(uO,this,null)}}function EO(t={}){var e;this.trigger(Im.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 SO(t={}){const e="string"==typeof(null==t?void 0:t.event)?t.event:"";if(!JC.has(e))return;if("playing"!==e||Number.isFinite(M(mO,this))||(C(mO,this,Sg()),this.log.info(`[#handlePlayerStateEvent] Playback started @ ${(M(mO,this)/1e3).toFixed(3)}s (${Date.now()})`)),M(pO,this)===e)return;C(pO,this,e);const n=Number.isFinite(null==t?void 0:t.time)?t.time:M(tO,this)&&Number.isFinite(M(tO,this).currentTime)?M(tO,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 AO(){return new HC(M(ZC,this))}function NO(t){if(!t||"object"!=typeof t)throw new Error("EkoPlayer.switchTimeline requires a timeline definition");if(!M(tO,this)||"function"!=typeof M(tO,this).applyTimelineDefinition)throw new Error("EkoPlayer.switchTimeline requires an active timeline");M(tO,this).applyTimelineDefinition(t),"function"==typeof M(tO,this).play&&M(tO,this).play()}function MO(){M(cO,this)&&"function"==typeof M(cO,this).on&&(C(bO,this,(t=>{this.trigger(Im.QOE_SCORE,t)})),C(kO,this,(t=>{this.trigger(Im.QOE_STATUS,t)})),M(cO,this).on(Im.QOE_SCORE,M(bO,this)),M(cO,this).on(Im.QOE_STATUS,M(kO,this)))}function FO(){M(lO,this)&&"function"==typeof M(lO,this).on&&(C(wO,this,(t=>{const e=t&&"object"==typeof t?t:{error:t};this.trigger(Im.DECODER_ERROR,e),A(TO,this,CO).call(this,e)})),M(lO,this).on(Im.DECODER_ERROR,M(wO,this)))}function CO(t={}){var e;const n=M(tO,this);if(!n||"number"!=typeof n.currentTime)return;const i=Date.now();if(i<M(_O,this))return;const r=Number(n.currentTime);if(!Number.isFinite(r))return;const o=Number(null==n||null===(e=n.settings)||void 0===e?void 0:e.snapToFps),s=Number.isFinite(o)&&o>0?1/o:1/60;C(_O,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 OO(t={}){if(M(hO,this))return M(hO,this);const e=t&&"object"==typeof t&&!Array.isArray(t)?{...t}:{},n=M(iO,this)&&M(iO,this).element?M(iO,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==Au?void 0:Au.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 Promise.resolve().then((function(){return rR})),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=M(eO,this),e.playerVersion=DC,C(hO,this,o({mountElement:i,canvasElement:n,timeline:M(tO,this),getNode:t=>M(ZC,this)&&"function"==typeof M(ZC,this).get?M(ZC,this).get(t):void 0,listNodes:()=>M(ZC,this)&&"function"==typeof M(ZC,this).list?M(ZC,this).list():[],downloadSpeed:M(uO,this)?M(uO,this).downloadSpeed:void 0,downloadEvents:bg,qoe:M(cO,this)?M(cO,this).publicAPI:void 0,qoeEvents:this,options:e,playbackStartedAtMs:M(mO,this)})),M(hO,this)}function PO(){const t=this;return{createTimeline:()=>A(TO,t,AO).call(t),switchTimeline:e=>A(TO,t,NO).call(t,e),play:M(tO,this).play,pause:M(tO,this).pause,reset:M(tO,this).reset,placeOnTimeline:M(tO,this).placeOnTimeline,placeRenderNodeOnTimeline:M(tO,this).placeRenderNodeOnTimeline,addNode:M(ZC,this).add,getNode:M(ZC,this).get,listNodes:M(ZC,this).list,getNodesAtTime:e=>M(tO,t).getNodesAtTime(e),dispose:this.dispose,on:t.on,off:t.off,once:t.once,trigger:t.trigger,transitionTo:(e,n)=>M(oO,t).transitionTo(e,n),track:(e,...n)=>{if(M(aO,t)&&"function"==typeof M(aO,t).track)return M(aO,t).track(e,...n)},seekToPlacement:e=>M(tO,t).seekToPlacement(e),get currentTime(){return M(tO,t).currentTime},set currentTime(e){M(tO,t).currentTime=e},get buffered(){return M(tO,t).buffered},get options(){return M(eO,t)},get containerWidth(){return M(dO,t)?M(dO,t).containerWidth:0},get containerHeight(){return M(dO,t)?M(dO,t).containerHeight:0},get playbackRate(){return M(tO,t).playbackRate},set playbackRate(e){M(tO,t).playbackRate=e},get paused(){return!!M(tO,t)&&!0===M(tO,t).paused},get muted(){return!!M(sO,t)&&M(sO,t).muted},set muted(e){M(sO,t)&&(M(sO,t).muted=e)},get volume(){return M(sO,t)?M(sO,t).volume:1},set volume(e){M(sO,t)&&(M(sO,t).volume=e)},get qoe(){return M(cO,t)?M(cO,t).publicAPI:void 0},get utils(){return LC},get version(){return DC},loadDebugOverlay:(...e)=>A(TO,t,OO).call(t,...e)}}function RO(t){t&&(C(iO,this,t.canvas),C(ZC,this,t.nodeRepository),C(tO,this,t.timeline),C(sO,this,t.audioAdapter||t.audioPlaybackManager),C(aO,this,t.tracker),C(lO,this,t.parsingManager),C(cO,this,t.qoe),C(rO,this,t.renderAdapter||t.renderer),C(oO,this,t.transitionManager),C(dO,this,t.containerSize))}class DO{constructor({target:t,props:e}){if(!t)throw new Error("`options.target` is required");Zr(this.#wt,e,!0),this.#wt.v.EkoPlayer=IO;const n=t.hasChildNodes()?Ls:Ds;this.#_t=n(tu,{target:t,props:this.#wt.v})}#_t;#wt=Qr(io({}));destroy(t){if(this.#_t)return function(t,e){const n=Ws.get(t);return n?(Ws.delete(t),n(e)):Promise.resolve()}(this.#_t,t)}get props(){return ps(this.#wt)}}const LO=u("gallery-react");const BO=e.forwardRef(((t,n)=>{const{config:i,debug:r,ssrHtml:o,activeItem:s={index:0,step:0},forceMobile:a,videoAspectRatio:l,onEvent:c=()=>{}}=t,u=e.useRef(null),d=e.useRef({}),h=function(t){return void 0!==t}(i),f=e.useRef(s),p=e.useRef(o);d.current.initEventSent||(c("galleryinit"),d.current.initEventSent=!0);const m=e.useCallback((t=>{d.current.state=t,t.activeItemIndex===f.current.index&&t.activeModuleIndex===f.current.step||c("activeitemchanged",{index:t.activeItemIndex,step:t.activeModuleIndex})}),[]),v=e.useCallback((t=>{d.current.API=t,0===s.index&&0===s.step||t.selectItemAndStep(s.index,s.step),d.current.unsubscribe&&d.current.unsubscribe(),d.current.unsubscribe=t.subscribe(m)}),[]),g=e.useCallback(((t,e)=>{c(t,e)}),[c]);return e.useEffect((()=>(LO.setDataStorage("gallery-react",{config:i}),window.eko=window.eko||{},window.eko.config=i,window.eko.gallery={version:"4.0.4"},()=>{window.eko.config=void 0})),[i]),e.useImperativeHandle(n,(()=>({prev:()=>{var t;null===(t=d.current.API)||void 0===t||t.prev()},next:()=>{var t;null===(t=d.current.API)||void 0===t||t.next()}}))),e.useEffect((()=>{if(null==u||!u.current)return;const t=u.current;return d.current.app=new DO({target:t,props:{config:i,forceMobile:a,videoAspectRatio:l,hideNav:!0,onGalleryReady:v,onEvent:g}}),()=>{var t;null===(t=d.current.app)||void 0===t||t.destroy()}}),[]),e.useEffect((()=>{d.current.app&&(d.current.app.props.config=i)}),[i]),e.useEffect((()=>{d.current.app&&(d.current.app.props.debug=r,d.current.app.props.forceMobile=a,d.current.app.props.videoAspectRatio=l,d.current.app.props.onEvent=g)}),[r,a,l,g]),e.useEffect((()=>{f.current=s,d.current.state&&(d.current.state.activeItemIndex===s.index&&d.current.state.activeModuleIndex===s.step||d.current.API.selectItemAndStep(s.index,s.step))}),[s]),h?e.createElement("div",R({style:{position:"relative",width:"100%",height:"100%"},ref:u},p.current?{dangerouslySetInnerHTML:{__html:p.current}}:{})):t.children}));BO.propTypes={className:Tt.string,config:Tt.object,variantId:Tt.string,onEvent:Tt.func,ssrHtml:Tt.string,videoAspectRatio:Tt.string,debug:Tt.bool,activeItem:Tt.shape({index:Tt.number,step:Tt.number}),forceMobile:Tt.bool,instanceId:Tt.string,children:Tt.node},BO.displayName="EkoGallerySvelte";const zO=n("v2"),WO=n("v1"),$O="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{},UO=$O&&$O.performance,jO=UO&&"function"==typeof UO.now?()=>UO.now():()=>Date.now(),qO=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"}),VO=["ui-monospace,","SFMono-Regular,","Menlo,","Monaco,","Consolas,",'"Liberation Mono",','"Courier New",',"monospace"].join(" "),HO=`11px ${VO}`,GO=`12px ${VO}`;function KO(t){return"number"==typeof t&&Number.isFinite(t)}function XO(t){return KO(t)&&t>0}function YO(t){return KO(t)?Math.min(1,Math.max(0,t)):0}function QO(t,e=3){return KO(t)?t.toFixed(e):String(t)}function JO(t,e){const n=Number(t),i=Number(e);return!Number.isFinite(n)||!Number.isFinite(i)||n<=0||i<=0?"n/a":`${Math.round(n)}x${Math.round(i)}`}var ZO=new WeakMap,tP=new WeakMap,eP=new WeakMap,nP=new WeakMap,iP=new WeakMap,rP=new WeakMap,oP=new WeakMap,sP=new WeakSet;class aP{constructor({width:t=220,height:e=48,windowMs:n=6e4,maxValue:i=60,autoScale:r=!1,formatValue:o}={}){O(this,sP),F(this,ZO,void 0),F(this,tP,void 0),F(this,eP,[]),F(this,nP,void 0),F(this,iP,void 0),F(this,rP,void 0),F(this,oP,void 0);const s=null==$O?void 0:$O.document;if(!s||"function"!=typeof s.createElement)throw new Error("Debug overlay graph requires document.createElement.");C(ZO,this,s.createElement("canvas")),M(ZO,this).width=t,M(ZO,this).height=e,M(ZO,this).style.width=`${t}px`,M(ZO,this).style.height=`${e}px`,M(ZO,this).style.borderRadius="6px",M(ZO,this).style.background="#111",C(tP,this,M(ZO,this).getContext("2d")),C(nP,this,n),C(iP,this,i),C(rP,this,!!r),C(oP,this,"function"==typeof o?o:null)}get element(){return M(ZO,this)}push(t,e){if(M(ZO,this)&&M(tP,this)&&Number.isFinite(t)&&Number.isFinite(e)){for(M(eP,this).push({t:e,v:t});M(eP,this).length&&e-M(eP,this)[0].t>M(nP,this);)M(eP,this).shift();A(sP,this,lP).call(this)}}dispose(){C(eP,this,[]),C(tP,this,null),C(ZO,this,null)}}function lP(){const t=M(tP,this),e=M(ZO,this);if(!t||!e)return;const n=e.width,i=e.height;if(!n||!i)return;if(t.clearRect(0,0,n,i),t.fillStyle="#111",t.fillRect(0,0,n,i),!M(eP,this).length)return;const r=M(eP,this)[0].t;if(!(M(eP,this)[M(eP,this).length-1].t>r))return;const o=M(rP,this)?M(eP,this).reduce(((t,e)=>e.v>t?e.v:t),0):M(iP,this),s=o>0?o:M(iP,this);t.strokeStyle="#0f0",t.lineWidth=2,t.beginPath();for(let e=0;e<M(eP,this).length;e+=1){const o=M(eP,this)[e],a=(o.t-r)/M(nP,this)*n,l=i-(s>0?Math.min(1,Math.max(0,o.v/s)):0)*i;0===e?t.moveTo(a,l):t.lineTo(a,l)}t.stroke();const a=M(eP,this).length?M(eP,this)[M(eP,this).length-1]:null,l=Number.isFinite(null==a?void 0:a.v)?a.v:null;if(null===l)return;const c=M(oP,this)?M(oP,this).call(this,l):l.toFixed(1);if("string"!=typeof c||!c)return;t.font=HO,t.textAlign="right",t.textBaseline="top";const u=t.measureText(c),d=Math.ceil(u.width)+8,h=n-d-2;t.fillStyle="rgba(0,0,0,0.55)",t.fillRect(h,2,d,14),t.fillStyle="#fff",t.fillText(c,n-2-4,4)}const cP=new Intl.NumberFormat("en-US");function uP(t,e){const n=(null==t?void 0:t.trackId)||"",i=(null==e?void 0:e.trackId)||"";if(n!==i)return n<i?-1:1;const r=(null==t?void 0:t.nodeId)||"",o=(null==e?void 0:e.nodeId)||"";if(r!==o)return r<o?-1:1;const s=(null==t?void 0:t.segmentId)||"",a=(null==e?void 0:e.segmentId)||"";return s!==a?s<a?-1:1:("number"==typeof(null==t?void 0:t.presentationTime)?t.presentationTime:0)-("number"==typeof(null==e?void 0:e.presentationTime)?e.presentationTime:0)}function dP(t,e){for(t.push(e);t.length&&e-t[0]>1e3;)t.shift();if(t.length<2)return 0;const n=t[t.length-1]-t[0];return n<=0?0:1e3*(t.length-1)/n}function hP(t,e){if("function"!=typeof t||!e)return;const n=t(e.nodeId),i=null==n?void 0:n.tracks;if(!Array.isArray(i))return;const r=i.find((t=>(null==t?void 0:t.id)===e.trackId)),o=null==r?void 0:r.segments;return Array.isArray(o)?o.find((t=>(null==t?void 0:t.id)===e.segmentId)):void 0}function fP(t,e){var n;const i=hP(t,e);return(null==i?void 0:i.abrDecision)||(null==i||null===(n=i.chosenRepresentation)||void 0===n?void 0:n.abrDecision)}function pP(t){const e=Number(t);return!Number.isFinite(e)||e<=0?"n/a":`${cP.format(Math.round(e))}kbps`}function mP(t){const e=Number(t);return!Number.isFinite(e)||e<=0?"n/a":`${cP.format(Math.round(e/1e3))}kbps`}function vP(t,e=3){const n=Number(t);return Number.isFinite(n)?n.toLocaleString("en-US",{minimumFractionDigits:e,maximumFractionDigits:e}):String(t)}function gP(t,e){var n;if("function"!=typeof t||!e)return;const i=t(e.nodeId),r=null==i||null===(n=i.manifestRef)||void 0===n?void 0:n.encodeProfile;return"string"==typeof r&&r?r:void 0}function yP(t,e){if("function"!=typeof t||!e)return;const n=t(e.nodeId);return!0===(null==n?void 0:n.imageFallbackActive)?"image":void 0}function bP(t,e){const n=function(t){if(!t)return;const e=[[t.displayWidth,t.displayHeight],[t.codedWidth,t.codedHeight],[t.videoWidth,t.videoHeight],[t.naturalWidth,t.naturalHeight],[t.width,t.height]];for(let t=0;t<e.length;t+=1){const[n,i]=e[t],r=Number(n),o=Number(i);if(Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0)return{width:r,height:o}}}(null==e?void 0:e.frame)||{},i=Number.isFinite(null==e?void 0:e.width)?e.width:n.width,r=Number.isFinite(null==e?void 0:e.height)?e.height:n.height,o=function(t,e,n){return null===(n=hP(t,e))||void 0===n?void 0:n.chosenRepresentation}(t,e);if(!o)return KO(i)&&KO(r)?{width:i,height:r}:null;const s=o.width||o.codedWidth||i,a=o.height||o.codedHeight||r;return{id:o.id,codecs:o.codecs,mime:o.mime,bandwidth:o.bandwidth,width:s,height:a}}function kP(t){const e=Number(t);if(Number.isFinite(e)&&!(e<=0))return e/1e3}function xP(t,e){const n=Number(null==t?void 0:t.bandwidthKbps),i=Number(null==e?void 0:e.bandwidthKbps),r=Number.isFinite(n)&&n>0,o=Number.isFinite(i)&&i>0;if(r&&o&&n!==i)return n-i;if(r!==o)return r?-1:1;const s=(null==t?void 0:t.id)||"",a=(null==e?void 0:e.id)||"";return s===a?0:s<a?-1:1}function wP(t,e,n,i){const r=[];if(Array.isArray(null==i?void 0:i.availableRepresentations)&&i.availableRepresentations.forEach((t=>{const e="string"==typeof(null==t?void 0:t.id)&&t.id?t.id:void 0;if(!e)return;const n=Number(null==t?void 0:t.bandwidthKbps);r.push({id:e,bandwidthKbps:Number.isFinite(n)&&n>0?n:void 0})})),!r.length){const n=hP(t,e);(Array.isArray(null==n?void 0:n.representations)?n.representations:[]).forEach((t=>{const e="string"==typeof(null==t?void 0:t.id)&&t.id?t.id:void 0;e&&r.push({id:e,bandwidthKbps:kP(null==t?void 0:t.bandwidth)})}))}!r.length&&(null==n?void 0:n.id)&&r.push({id:n.id,bandwidthKbps:kP(n.bandwidth)});const o=new Map;return r.forEach((t=>{const e=null==t?void 0:t.id;e&&!o.has(e)&&o.set(e,t)})),Array.from(o.values()).sort(xP)}const _P=1024,TP=1048576,IP=1073741824;function EP(t){return KO(t)?t>=1e3?`${QO(t/1e3,1)} Mbps`:`${QO(t,1)} kbps`:"n/a"}function SP({downloadSpeed:t,downloadEvents:e}={}){const n=$O.document,i="function"==typeof(null==t?void 0:t.getKbps)?t.getKbps():void 0;let r=0;const{metricsRow:o,setInitial:s,setTotal:a}=function(t){const e=t.createElement("div");e.style.display="grid",e.style.gridTemplateColumns="1fr 1fr",e.style.gap="8px",e.style.font=GO;const n=t.createElement("div"),i=t.createElement("div");return e.appendChild(n),e.appendChild(i),{metricsRow:e,setInitial:t=>{n.textContent=`initial=${EP(t)}`},setTotal:t=>{var e;i.textContent="total="+(KO(e=t)?e<_P?`${Math.round(e)} B`:e<TP?`${QO(e/_P,1)} KB`:e<IP?`${QO(e/TP,2)} MB`:`${QO(e/IP,2)} GB`:"n/a")}}}(n),{graphWrap:l,speedGraph:c}=function(t,e){const n=t.createElement("div");n.style.marginTop="10px";const i=t.createElement("div");i.textContent="download speed",i.style.font=HO,i.style.opacity="0.9";const r=KO(e)&&e>0?e:1,o=new aP({autoScale:!0,maxValue:r,formatValue:EP});return n.appendChild(i),n.appendChild(o.element),{graphWrap:n,speedGraph:o}}(n,i);s(i),a(r);const u=t=>{const e=Number(null==t?void 0:t.kbps);Number.isFinite(e)&&c.push(e,null!=$O&&$O.performance&&"function"==typeof $O.performance.now?$O.performance.now():Date.now())},d=t=>{const e=Number(null==t?void 0:t.bytes);Number.isFinite(e)&&(r+=e,a(r))};return t&&"function"==typeof t.on&&t.on("download:speed",u),e&&"function"==typeof e.on&&e.on("download:sample",d),{id:"downloads",title:"Downloads",render:t=>{t.appendChild(o),t.appendChild(l)},dispose:()=>{t&&"function"==typeof t.off&&t.off("download:speed",u),e&&"function"==typeof e.off&&e.off("download:sample",d),c.dispose()}}}function AP(t){return KO(t)?QO(t,3):"n/a"}function NP(){return null!=$O&&$O.performance&&"function"==typeof $O.performance.now?$O.performance.now():Date.now()}const MP=18,FP="rgba(83,170,255,0.9)",CP={pending:"rgba(255,255,255,0.55)",resolving:"rgba(255,200,87,0.9)",ready:"rgba(102,214,141,0.9)",failed:"rgba(255,92,92,0.9)",missing:"rgba(160,160,160,0.9)"};function OP(t,e){if(XO(null==t?void 0:t.nodeDurationOverride))return t.nodeDurationOverride;if("function"!=typeof e)return null;const n=e(null==t?void 0:t.nodeId),i=null==n?void 0:n.duration;return XO(i)?i:null}function PP(t){const e=Number(null==t?void 0:t.duration);return e===Number.POSITIVE_INFINITY?Number.POSITIVE_INFINITY:XO(e)?e:null}function RP(t){return t===Number.POSITIVE_INFINITY}function DP(t){return KO(t)?String(t):""}function LP(t=[],e=[],n){const i=function(t=[],e){return Array.isArray(t)&&t.length?t.map((t=>t?["string"==typeof t.placementId?t.placementId:"","string"==typeof t.nodeId?t.nodeId:"",DP(t.offset),DP(OP(t,e)),!0===t.offsetPending?"1":"0",DP(t.nodeOffsetOverride),DP(t.nodeDurationOverride)].join("|"):"null")).join(";"):""}(t,n);return`${i}::${function(t=[]){return Array.isArray(t)&&t.length?t.map((t=>{if(!t)return"null";const e="string"==typeof t.renderPlacementId?t.renderPlacementId:"",n="string"==typeof t.type?t.type:"",i=DP(t.offset),r=PP(t);return[e,n,i,r===Number.POSITIVE_INFINITY?"inf":DP(r),!0===t.offsetPending?"1":"0"].join("|")})).join(";"):""}(e)}`}function BP(t=[],e){if(!Array.isArray(t)||!t.length)return!1;for(let n=0;n<t.length;n+=1){const i=t[n];if(!i||!0===i.offsetPending)continue;if(XO(i.nodeDurationOverride))continue;if("function"!=typeof e)return!0;const r=e(i.nodeId);if(!XO(null==r?void 0:r.duration))return!0}return!1}function zP(t=[]){return!(!Array.isArray(t)||!t.length)&&t.some((t=>!0===(null==t?void 0:t.offsetPending)))}function WP(t=[],e=[]){return zP(t)||zP(e)}function $P(t,e=[],n){if(!t||!Array.isArray(e)||!e.length)return;const i=t.querySelector('[data-segment-boundary="true"]');e.forEach((e=>{if(!e||!KO(e.startRatio)||!KO(e.endRatio))return;const r=YO(e.startRatio),o=YO(e.endRatio);if(!(o>r))return;const s=$O.document.createElement("div");s.dataset.bufferedSegment="true",s.style.position="absolute",s.style.top="0",s.style.bottom="0",s.style.left=100*r+"%",s.style.width=100*(o-r)+"%",s.style.background=n,s.style.opacity="0.8",s.style.pointerEvents="none",s.style.zIndex="0",i?t.insertBefore(s,i):t.appendChild(s)}))}function UP(t,e){if(!t)return;const n=t.querySelector('[data-active-highlight="true"]');if(!e)return void(n&&n.remove());if(n)return;const i=$O.document.createElement("div");i.dataset.activeHighlight="true",i.style.position="absolute",i.style.top="0",i.style.bottom="0",i.style.left="0",i.style.right="0",i.style.border="1px solid rgba(255,255,255,0.9)",i.style.borderRadius="4px",i.style.pointerEvents="none",i.style.zIndex="1",t.appendChild(i)}function jP({timeline:t,getNode:e}={}){const n=null==$O?void 0:$O.document;if(!n||"function"!=typeof n.createElement)throw new Error("Debug overlay timeline tab requires document.createElement.");const i=n.createElement("div");i.style.display="flex",i.style.flexDirection="column",i.style.gap="8px",i.style.position="relative";const r=n.createElement("div");r.style.position="absolute",r.style.display="none",r.style.pointerEvents="none",r.style.zIndex="2",r.style.padding="4px 6px",r.style.borderRadius="6px",r.style.background="rgba(0,0,0,0.8)",r.style.border="1px solid rgba(255,255,255,0.2)",r.style.color="#fff",r.style.font=HO,r.style.maxWidth="220px",r.style.whiteSpace="nowrap",r.style.overflow="hidden",r.style.textOverflow="ellipsis";const o=n.createElement("div");o.dataset.timelineHoverDetails="true",o.style.position="absolute",o.style.display="none",o.style.pointerEvents="none",o.style.zIndex="3",o.style.padding="6px 8px",o.style.borderRadius="8px",o.style.background="rgba(0,0,0,0.85)",o.style.border="1px solid rgba(255,255,255,0.25)",o.style.color="#fff",o.style.font=HO,o.style.maxWidth="260px",o.style.flexDirection="column",o.style.gap="6px";const s=n.createElement("div");s.style.font=GO,s.style.opacity="0.95";const a=n.createElement("div");a.style.font=HO,a.style.opacity="0.7",a.style.textTransform="uppercase",a.style.marginTop="4px";const l=n.createElement("div");l.style.display="flex",l.style.flexDirection="column",l.style.gap="4px",o.appendChild(s),o.appendChild(a),o.appendChild(l);const c=n.createElement("div");c.style.display="flex",c.style.justifyContent="space-between",c.style.alignItems="center";const u=n.createElement("div");u.style.display="flex",u.style.alignItems="baseline",u.style.gap="10px";const d=n.createElement("div");d.style.font=GO,d.style.opacity="0.9";const h=n.createElement("div");h.style.font=HO,h.style.opacity="0.65",u.appendChild(d),u.appendChild(h);const f=n.createElement("label");f.style.display="inline-flex",f.style.alignItems="center",f.style.gap="6px",f.style.font=HO,f.style.cursor="pointer";const p=n.createElement("input");p.type="checkbox",p.checked=!1;const m=n.createElement("span");m.textContent="Click to seek",f.appendChild(p),f.appendChild(m),c.appendChild(u),c.appendChild(f);const v=n.createElement("div");function g(t,e,{alignTop:i=!1}={}){const r=n.createElement("div");r.style.display="grid",r.style.gridTemplateColumns="64px 1fr",r.style.alignItems=i?"start":"center",r.style.gap="8px";const o=n.createElement("div");o.textContent=t,o.style.font=HO,o.style.opacity="0.8",i&&(o.style.paddingTop="2px");const s=n.createElement("div");s.style.position="relative",s.style.borderRadius="6px",s.style.background="rgba(255,255,255,0.08)",s.style.overflow="hidden",e&&(s.dataset.timelineLane=e);const a=n.createElement("div");return a.style.position="absolute",a.style.top="0",a.style.bottom="0",a.style.width="2px",a.style.background="rgba(255,255,255,0.8)",s.appendChild(a),r.appendChild(o),r.appendChild(s),v.appendChild(r),{track:s,indicator:a}}v.style.display="grid",v.style.gridTemplateRows="auto auto",v.style.gap="8px",i.appendChild(c),i.appendChild(v),i.appendChild(r),i.appendChild(o);const y=g("Nodes","nodes",{alignTop:!0}),b=g("Render","render");let k=[],x=[],w=0,_=!1,T=1;const I=new Map,E=new Map,S=new Map,A=new Map;let N=new Set,M=null,F=!1,C="",O=!1,P=0,R=0,D=null;function L(t){for(;t.childNodes.length>1;)t.removeChild(t.lastChild)}function B(){D&&(clearTimeout(D),D=null)}function z(){return!!O||!!t&&(Array.isArray(t.placements)||Array.isArray(t.renderPlacements))}function W(){if(!t)return!1;const e=Array.isArray(t.placements),n=Array.isArray(t.renderPlacements);if(!e&&!n)return!1;const i=e?t.placements:[],r=n?t.renderPlacements:[];return(i.length!==P||r.length!==R)&&(et(i,r),!0)}function $(){if(!O)return!1;const t=LP(k,x,e);return t!==C&&(C=t,Q(),tt(),!0)}function U(){z()?D=function({shouldSchedule:t,isScheduled:e,intervalMs:n,onTick:i}){return e?null:setTimeout(i,n)}({shouldSchedule:!0,isScheduled:!!D,intervalMs:O?100:250,onTick:()=>{D=null,z()&&(W()||$()||U())}}):B()}function j(t,e){const n=e>0?w/e:0;t.style.left=100*YO(n)+"%",t.style.transform="translateX(-1px)"}function q(){r.style.display="none"}function V(t,e){if(!t)return void q();r.textContent=t,r.style.display="block";const n=i.getBoundingClientRect(),o=r.getBoundingClientRect(),s=((null==e?void 0:e.clientX)||0)-n.left+12,a=((null==e?void 0:e.clientY)||0)-n.top+12,l=n.width-o.width-8,c=n.height-o.height-8,u=Math.max(8,Math.min(s,l)),d=Math.max(8,Math.min(a,c));r.style.left=`${u}px`,r.style.top=`${d}px`}function H(){o.style.display="none"}function G(t,r){const c="function"==typeof e&&t?e(t):null,u=Array.isArray(null==c?void 0:c.children)?c.children:[];if(!u.length)return void H();if(s.textContent=t,a.textContent="children",function(){for(;l.firstChild;)l.removeChild(l.firstChild)}(),u.forEach((t=>{t&&t.nodeId&&l.appendChild(function(t){const i=n.createElement("div");i.style.display="grid",i.style.gridTemplateColumns="10px 1fr auto auto",i.style.alignItems="center",i.style.gap="6px";const r="string"==typeof(null==t?void 0:t.nodeId)?t.nodeId:"",o=XO(null==t?void 0:t.weight)?t.weight:1,s=function(t){if(!t||"function"!=typeof e)return"missing";const n=e(t);if(!n)return"missing";const i="string"==typeof n.state?n.state.trim().toLowerCase():"";return"pending"===i||"resolving"===i||"ready"===i||"failed"===i?i:"pending"}(r);i.dataset.childId=r,i.dataset.childStatus=s;const a=n.createElement("span");a.dataset.statusIndicator=s,a.style.width="8px",a.style.height="8px",a.style.borderRadius="999px",a.style.background=CP[s]||CP.pending,a.style.display="inline-block";const l=n.createElement("span");l.textContent=r||"unknown",l.style.overflow="hidden",l.style.textOverflow="ellipsis",l.style.whiteSpace="nowrap";const c=n.createElement("span");c.textContent=`w=${QO(o,0)}`,c.style.opacity="0.8";const u=n.createElement("span");return u.textContent=s,u.style.opacity="0.75",i.appendChild(a),i.appendChild(l),i.appendChild(c),i.appendChild(u),i}(t))})),!l.childNodes.length)return void H();o.style.display="flex";const d=i.getBoundingClientRect(),h=o.getBoundingClientRect(),f=((null==r?void 0:r.clientX)||0)-d.left+12,p=((null==r?void 0:r.clientY)||0)-d.top+12,m=d.width-h.width-8,v=d.height-h.height-8,g=Math.max(8,Math.min(f,m)),y=Math.max(8,Math.min(p,v));o.style.left=`${g}px`,o.style.top=`${y}px`}function K(){const e=w;if(t&&"function"==typeof t.getPlacementsActiveAtTime){const n=t.getPlacementsActiveAtTime(e),i=new Set(n.map((t=>null==t?void 0:t.placementId)).filter((t=>"string"==typeof t&&t.length)));N.forEach((t=>{i.has(t)||UP(S.get(t),!1)})),i.forEach((t=>{N.has(t)||UP(S.get(t),!0)})),N=i}else y.track.querySelectorAll('[data-timeline-item="nodes"]').forEach((t=>{const n="true"===t.dataset.hasDuration,i=Number(t.dataset.start),r=Number(t.dataset.end);UP(t,n&&KO(e)&&e>=i&&e<r)}));if(t&&"function"==typeof t.getActiveRenderPlacement){const n=t.getActiveRenderPlacement(e),i=null==n?void 0:n.renderPlacementId;M&&M!==i&&UP(A.get(M),!1),i&&M!==i&&UP(A.get(i),!0),M=i||null}else b.track.querySelectorAll('[data-timeline-item="render"]').forEach((t=>{const n="true"===t.dataset.hasDuration,i=Number(t.dataset.start),r=Number(t.dataset.end);UP(t,n&&KO(e)&&e>=i&&e<r)}))}function X(t){const n=OP(t,e);if(!XO(n)||"function"!=typeof e)return{boundaries:[],buffered:[]};const i=e(null==t?void 0:t.nodeId),r=function(t){const e=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[];if(!e.length)return null;if(null!=t&&t.mainTrackId){const n=e.find((e=>(null==e?void 0:e.id)===t.mainTrackId));if(n)return n}return e.find((t=>Array.isArray(null==t?void 0:t.segments)&&t.segments.length))||null}(i);if(!r)return{boundaries:[],buffered:[]};const o=t=>{if(!t)return 0;const e=Number(null==t?void 0:t.bufferedRatio);if(Number.isFinite(e))return YO(e);const n=Number(null==t?void 0:t.retainedByteLength);if(!XO(n))return 0;const i=null==t?void 0:t.chosenRepresentation,r=XO(null==i?void 0:i.sizeBytes)?i.sizeBytes:null;return XO(r)?YO(n/r):1},s=Array.isArray(r.segments)?r.segments:[],a=KO(null==r?void 0:r.offset)?r.offset:0,l=KO(null==t?void 0:t.nodeOffsetOverride)?t.nodeOffsetOverride:0;if(!s.length){const t=null==i?void 0:i.buffered,e=KO(null==t?void 0:t.start)?t.start-l:0,r=KO(null==t?void 0:t.end)?t.end-l:0,o=Math.max(0,e),s=Math.min(n,r);return s>o?{boundaries:[],buffered:[{startRatio:o/n,endRatio:s/n}]}:{boundaries:[],buffered:[]}}if("image"===(null==r?void 0:r.type)){const t=s.find((t=>t&&!t.isInit))||s[0],e=t?o(t):0;return e>0?{boundaries:[],buffered:[{startRatio:0,endRatio:YO(e)}]}:{boundaries:[],buffered:[]}}return function(t,e,n,i,r){const o=[],s=[];let a=0;return t.forEach((t=>{if(null!=t&&t.isInit)return;KO(null==t?void 0:t.offset)&&(a=t.offset);const l=a;if(!KO(l))return;const c=KO(null==t?void 0:t.duration)?t.duration:0,u=n+l-i,d=n+(l+c)-i;u>0&&u<e&&o.push(u/e);const h="function"==typeof r?r(t):0;if(c>0&&d>0&&u<e&&h>0){const t=Math.max(0,u),n=Math.min(e,d);if(n>t){const i=t+(n-t)*YO(h);s.push({startRatio:t/e,endRatio:i/e})}}c>0&&(KO(null==t?void 0:t.offset)?a=t.offset+c:a+=c)})),{boundaries:o,buffered:s}}(s,n,a,l,o)}function Y(){const t=Array.isArray(k)?k:[],e=new Map(t.map((t=>[null==t?void 0:t.placementId,t])));for(const[t,n]of S.entries()){if(!t)continue;const i=e.get(t);i&&(n.querySelectorAll('[data-buffered-segment="true"]').forEach((t=>t.remove())),$P(n,X(i).buffered,FP))}}function Q(){const t=new Set(k.map((t=>null==t?void 0:t.nodeId)).filter((t=>"string"==typeof t&&t.length)));t.forEach((t=>{if(E.has(t))return;const n="function"==typeof e?e(t):null;if(!n||"function"!=typeof n.on)return;const i=t=>function(t={}){if(!t||t.isInit)return;const e=null==t?void 0:t.nodeId,n=null==t?void 0:t.segmentId,i=Number(null==t?void 0:t.loaded),r=Number(null==t?void 0:t.total);if(!e||!n||!KO(i))return;const o=`${e}:${n}`,s=I.get(o)||{},a={loaded:Math.max(KO(s.loaded)?s.loaded:0,i),total:XO(r)?r:s.total};I.set(o,a),function(){if(F)return;F=!0;const t=null==$O?void 0:$O.requestAnimationFrame;"function"!=typeof t?((null==$O?void 0:$O.setTimeout)||setTimeout)((()=>{F=!1,Y()}),0):t((()=>{F=!1,Y()}))}()}(t);n.on("segment:chunk",i),E.set(t,{node:n,handler:i})}));for(const[e,n]of E.entries())t.has(e)||(null!=n&&n.node&&"function"==typeof n.node.off&&n.node.off("segment:chunk",n.handler),E.delete(e))}function J({track:t,color:e,start:i,duration:r,startTime:o,durationSeconds:s,segmentRatios:a,bufferedSegments:l,placementId:c,nodeId:u,label:d,rowIndex:h=0,rowHeight:f=18,rowGap:p=0,laneId:m,isClickable:v,isActive:g,tooltip:y,hoverDetailsNodeId:b,showLabel:k,onClick:x}){const w=n.createElement("div");var _,T;T=e,(_=w).style.position="absolute",_.style.borderRadius="4px",_.style.background=T,_.style.opacity="0.9",_.style.font=HO,_.style.color="#fff",_.style.display="flex",_.style.alignItems="center",_.style.whiteSpace="nowrap",_.style.overflow="hidden",_.style.textOverflow="ellipsis",function(t,{startRatio:e,durationRatio:n,rowIndex:i=0,rowHeight:r=18,rowGap:o=0}={}){const s=i*(r+o)+2,a=Math.max(1,r-4);t.style.top=`${s}px`,t.style.height=`${a}px`;const l=YO(e);if(XO(n)){const e=Math.max(0,Math.min(n,1-l));return t.style.left=100*l+"%",t.style.width=100*e+"%",void(t.style.padding="0 4px")}t.style.left=100*l+"%",t.style.width="2px",t.style.padding="0"}(w,{startRatio:i,durationRatio:r,rowIndex:h,rowHeight:f,rowGap:p}),function(t,{laneId:e,label:n,isClickable:i,shouldShowLabel:r,onClick:o}={}){if(e&&(t.dataset.timelineItem=e),r&&n){const e=$O.document.createElement("span");e.textContent=n,e.style.position="relative",e.style.zIndex="2",e.style.pointerEvents="none",t.appendChild(e)}i&&(t.style.cursor="pointer"),"function"==typeof o&&t.addEventListener("click",o)}(w,{laneId:m,label:d,isClickable:v,shouldShowLabel:"boolean"==typeof k?k:XO(r),onClick:x}),y&&(w.title=y),KO(o)&&(w.dataset.start=String(o)),XO(s)||RP(s)?(w.dataset.end=String(o+s),w.dataset.hasDuration="true"):(w.dataset.end="",w.dataset.hasDuration="false"),c&&(w.dataset.placementId=c),u&&(w.dataset.nodeId=u),w.style.pointerEvents="auto",$P(w,l,FP),function(t,e=[]){t&&Array.isArray(e)&&e.length&&e.forEach((e=>{if(!KO(e)||e<=0||e>=1)return;const n=$O.document.createElement("div");n.dataset.segmentBoundary="true",n.style.position="absolute",n.style.top="2px",n.style.bottom="2px",n.style.width="1px",n.style.left=100*YO(e)+"%",n.style.transform="translateX(-0.5px)",n.style.background="rgba(255,255,255,0.35)",n.style.pointerEvents="none",n.style.zIndex="1",t.appendChild(n)}))}(w,a),UP(w,g),y&&(w.addEventListener("mouseenter",(t=>V(y,t))),w.addEventListener("mousemove",(t=>V(y,t))),w.addEventListener("mouseleave",q)),b&&(w.addEventListener("mouseenter",(t=>G(b,t))),w.addEventListener("mousemove",(t=>G(b,t))),w.addEventListener("mouseleave",H)),t.appendChild(w),"nodes"===m&&c?S.set(c,w):"render"===m&&c&&A.set(c,w)}function Z(){let t=0;const n=Array.isArray(k)?k:[],i=Array.isArray(x)?x.filter((t=>!0!==(null==t?void 0:t.offsetPending))):[];return n.forEach((n=>{if(!0===(null==n?void 0:n.offsetPending))return;const i=KO(null==n?void 0:n.offset)?n.offset:void 0;if(!KO(i))return;const r=OP(n,e);t=XO(r)?Math.max(t,i+r):Math.max(t,i)})),i.forEach((e=>{const n=KO(null==e?void 0:e.offset)?e.offset:0,i=PP(e);t=XO(i)?Math.max(t,n+i):Math.max(t,n)})),XO(t)?t:1}function tt(){const n=Z();T=n,d.textContent=`t=${QO(w)}s`,h.textContent=`range=0-${QO(n)}s`,q(),H(),L(y.track),L(b.track),S.clear(),A.clear(),N=new Set,M=null,F=!1;const i=Array.isArray(k)?k:[],r=Array.isArray(x)?x:[],o=function(n){const i=(Array.isArray(n)?n.slice():[]).map((t=>{if(!0===(null==t?void 0:t.offsetPending))return null;const n=KO(null==t?void 0:t.offset)?t.offset:void 0;if(!KO(n))return null;const i=OP(t,e);return{placement:t,offset:n,duration:i,end:XO(i)?n+i:n,rowIndex:0}})).filter(Boolean).sort(((t,e)=>{var n,i,r,o;const s=t.offset-e.offset;if(0!==s)return s;const a="string"==typeof(null===(n=t.placement)||void 0===n?void 0:n.nodeId)?t.placement.nodeId:"",l="string"==typeof(null===(i=e.placement)||void 0===i?void 0:i.nodeId)?e.placement.nodeId:"";if(a!==l)return a.localeCompare(l);const c="string"==typeof(null===(r=t.placement)||void 0===r?void 0:r.placementId)?t.placement.placementId:"",u="string"==typeof(null===(o=e.placement)||void 0===o?void 0:o.placementId)?e.placement.placementId:"";return c.localeCompare(u)})),r=[],o=function(t,e){const n=Number(null==t||null===(e=t.settings)||void 0===e?void 0:e.snapToFps);return!Number.isFinite(n)||n<=0?0:.5/n}(t);return i.forEach((t=>{const e=t.offset,n=KO(t.end)?t.end:e;let i=-1;for(let t=0;t<r.length;t+=1)if(r[t]<=e+o){i=t;break}-1===i?(i=r.length,r.push(n)):r[i]=Math.max(r[i],n),t.rowIndex=i})),{items:i,rowCount:Math.max(1,r.length)}}(i);var s;!function(t){const e=t.rowCount*MP+4*(t.rowCount-1);y.track.style.height=`${e}px`,b.track.style.height="18px",y.track.style.cursor=_?"pointer":"default",y.track.style.pointerEvents="auto",b.track.style.pointerEvents="auto"}(o),s=n,o.items.forEach((t=>{const e=t.placement,n=t.offset,i=t.duration,r=(null==e?void 0:e.nodeId)||(null==e?void 0:e.placementId)||"node",o=!!KO(w)&&w>=n&&(!XO(i)||w<n+i),a=X(e);J({track:y.track,color:"rgba(255,255,255,0.16)",start:YO(n/s),duration:XO(i)?YO(i/s):null,startTime:n,durationSeconds:i,segmentRatios:a.boundaries,bufferedSegments:a.buffered,placementId:null==e?void 0:e.placementId,nodeId:null==e?void 0:e.nodeId,label:r,rowIndex:t.rowIndex,rowHeight:MP,rowGap:4,laneId:"nodes",isClickable:_,isActive:o,tooltip:(null==e?void 0:e.nodeId)||(null==e?void 0:e.placementId),hoverDetailsNodeId:null==e?void 0:e.nodeId})})),function(t,e){t.forEach((t=>{const n=KO(null==t?void 0:t.offset)?t.offset:void 0;if(!KO(n))return;const i=PP(t),r=RP(i),o=(null==t?void 0:t.type)||(null==t?void 0:t.renderPlacementId)||"render",s=function(t){const e="string"==typeof t?t.trim().toLowerCase():"";return"switch"===e||"switching"===e||"switchingrendernode"===e}(null==t?void 0:t.type),a=s?()=>{"function"==typeof(null==$O?void 0:$O.switchTo)&&$O.switchTo("next")}:void 0;let l=!1;KO(w)&&(r?l=w>=n:XO(i)&&(l=w>=n&&w<n+i));const c=r&&XO(e)?YO((e-n)/e):XO(i)?YO(i/e):null;J({track:b.track,color:"rgba(248,162,62,0.9)",start:YO(n/e),duration:c,startTime:n,durationSeconds:i,label:o,placementId:null==t?void 0:t.renderPlacementId,rowIndex:0,rowHeight:MP,rowGap:0,laneId:"render",isClickable:!!s,isActive:l,tooltip:(null==t?void 0:t.type)||(null==t?void 0:t.renderPlacementId),showLabel:XO(i)||r,onClick:a})}))}(r,n),j(y.indicator,n),j(b.indicator,n),K(),Y(),O=WP(k,x)||BP(k,e),C=O?LP(k,x,e):"",P=Array.isArray(k)?k.length:0,R=Array.isArray(x)?x.length:0,U()}function et(t,n){k=Array.isArray(t)?t.slice():[],x=Array.isArray(n)?n.slice():[],O=WP(k,x)||BP(k,e),Q(),tt()}return p.addEventListener("change",(()=>{_=p.checked,tt()})),y.track.addEventListener("click",(e=>{!function(e,n,i){if(!_||!t)return;if(!XO(n)||!i)return;const r="function"==typeof i.getBoundingClientRect?i.getBoundingClientRect():null,o=XO(null==r?void 0:r.width)?r.width:i.clientWidth;if(!XO(o))return;const s=KO(null==r?void 0:r.left)?r.left:0,a=YO(((KO(null==e?void 0:e.clientX)?e.clientX:0)-s)/o)*n;KO(a)&&(t.currentTime=a)}(e,Z(),y.track)})),{id:"timeline",title:"Timeline",render:t=>{t.appendChild(i),tt()},updatePlacements:et,updateTime:function(t){if(w=KO(t)?t:w,W())return;if(O&&$())return;const e=T;KO(e)&&(d.textContent=`t=${QO(w)}s`,h.textContent=`range=0-${QO(e)}s`,j(y.indicator,e),j(b.indicator,e),K())},refresh:()=>tt(),dispose:()=>{B();for(const t of E.values())(null==t?void 0:t.node)&&"function"==typeof t.node.off&&t.node.off("segment:chunk",t.handler);E.clear(),I.clear()}}}const qP=1024,VP=1048576,HP=1073741824;function GP(t){return KO(t)?t<qP?`${Math.round(t)} B`:t<VP?`${QO(t/qP,1)} KB`:t<HP?`${QO(t/VP,2)} MB`:`${QO(t/HP,2)} GB`:"n/a"}const KP="ekoplayer-debug-overlay";var XP=new WeakMap,YP=new WeakMap,QP=new WeakMap,JP=new WeakMap,ZP=new WeakSet;class tR{constructor({tabBarEl:t,contentEl:e}){O(this,ZP),F(this,XP,[]),F(this,YP,void 0),F(this,QP,void 0),F(this,JP,void 0),C(QP,this,t),C(JP,this,e)}registerTab(t){t&&"string"==typeof t.id&&"string"==typeof t.title&&"function"==typeof t.render&&(M(XP,this).some((e=>e.id===t.id))||(M(XP,this).push(t),A(ZP,this,eR).call(this),M(YP,this)||this.selectTab(t.id)))}selectTab(t){M(XP,this).find((e=>e.id===t))&&(C(YP,this,t),A(ZP,this,eR).call(this),A(ZP,this,nR).call(this))}dispose(){M(QP,this)&&(M(QP,this).innerHTML=""),M(JP,this)&&(M(JP,this).innerHTML=""),C(XP,this,[]),C(QP,this,null),C(JP,this,null)}}function eR(){const t=M(QP,this);t&&(t.innerHTML="",M(XP,this).forEach((e=>{const n=$O.document.createElement("button");n.type="button",n.textContent=e.title,n.style.cursor="pointer",n.style.padding="6px 10px",n.style.borderRadius="6px",n.style.border="1px solid rgba(255,255,255,0.2)",n.style.background=e.id===M(YP,this)?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.2)",n.style.color="#fff",n.style.font=GO,n.addEventListener("click",(()=>this.selectTab(e.id))),t.appendChild(n)})))}function nR(){const t=M(JP,this);if(!t)return;t.innerHTML="";const e=M(XP,this).find((t=>t.id===M(YP,this)));e&&e.render(t)}function iR({mountElement:t,canvasElement:e,timeline:n,getNode:i,listNodes:r,downloadSpeed:o,downloadEvents:s,qoe:a,qoeEvents:l,options:c={},playbackStartedAtMs:u,playerVersion:d}={}){if(!t)throw new Error("Debug overlay requires mountElement.");if(!n||"function"!=typeof n.on)throw new Error("Debug overlay requires a Timeline with .on/.off.");!function(t){if(!t||!t.style)return;const e=null==$O?void 0:$O.window,n=e&&"function"==typeof e.getComputedStyle?e.getComputedStyle(t):null,i=n?n.position:t.style.position;i&&"static"!==i||(t.style.position="relative")}(t);const h=$O.document.getElementById(KP);h&&h.parentNode&&h.parentNode.removeChild(h);const f=function({mountElement:t,playerVersion:e}){const n=null==$O?void 0:$O.document;if(!n||"function"!=typeof n.createElement)throw new Error("Debug overlay requires document.createElement.");const i=n.createElement("div");i.id=KP,i.style.position="absolute",i.style.inset="0",i.style.zIndex="999999",i.style.pointerEvents="none";const r=n.createElement("div");r.style.position="absolute",r.style.top="8px",r.style.left="8px",r.style.width="460px",r.style.maxWidth="calc(100% - 16px)",r.style.background="rgba(0,0,0,0.65)",r.style.border="1px solid rgba(255,255,255,0.18)",r.style.borderRadius="10px",r.style.padding="10px",r.style.color="#fff",r.style.pointerEvents="auto",r.style.backdropFilter="blur(6px)";const o=n.createElement("div");o.style.display="flex",o.style.justifyContent="space-between",o.style.alignItems="center",o.style.gap="10px";const s=n.createElement("div");s.textContent="EkoPlayer Debug",s.style.font="600 13px ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial";const a=n.createElement("button");a.type="button",a.textContent="Hide",a.style.cursor="pointer",a.style.padding="6px 10px",a.style.borderRadius="8px",a.style.border="1px solid rgba(255,255,255,0.2)",a.style.background="rgba(0,0,0,0.2)",a.style.color="#fff",o.appendChild(s),o.appendChild(a);const l=n.createElement("div");l.style.display="flex",l.style.gap="8px",l.style.marginTop="10px";const c=n.createElement("div");c.style.marginTop="10px";const u=n.createElement("div");u.style.marginTop="10px",u.style.font=HO,u.style.display="flex",u.style.justifyContent="space-between",u.style.alignItems="center",u.style.gap="10px";const d=n.createElement("div");d.style.color="rgba(140, 224, 255, 0.9)",d.textContent="Playback started @ --";const h=n.createElement("div");h.style.opacity="0.7",h.style.marginLeft="auto",h.textContent=e?`version ${e}`:"version n/a",u.appendChild(d),u.appendChild(h);const f=n.createElement("button");return f.type="button",f.textContent="Debug",f.style.position="absolute",f.style.top="8px",f.style.left="8px",f.style.cursor="pointer",f.style.padding="6px 10px",f.style.borderRadius="10px",f.style.border="1px solid rgba(255,255,255,0.25)",f.style.background="rgba(0,0,0,0.55)",f.style.color="#fff",f.style.pointerEvents="auto",f.style.display="none",r.appendChild(o),r.appendChild(l),r.appendChild(c),r.appendChild(u),i.appendChild(r),i.appendChild(f),t.appendChild(i),{overlayRoot:i,panel:r,tabBar:l,content:c,hideBtn:a,showBtn:f,footerPlayback:d}}({mountElement:t,playerVersion:d||(null==c?void 0:c.playerVersion)}),p=new tR({tabBarEl:f.tabBar,contentEl:f.content});let m=!0;function v(){m=!1,f.panel.style.display="none",f.showBtn.style.display="inline-block"}function g(){m=!0,f.panel.style.display="block",f.showBtn.style.display="none"}f.hideBtn.addEventListener("click",v),f.showBtn.addEventListener("click",g);const y=jP({timeline:n,getNode:i}),b=function({getNode:t}){const e=$O.document,n=e.createElement("pre");n.style.margin="0",n.style.whiteSpace="pre-wrap",n.style.font=GO,n.style.lineHeight="1.35";const i=e.createElement("div");i.style.display="flex",i.style.flexDirection="column",i.style.gap="8px",i.style.marginTop="6px";const r=e.createElement("div");r.style.display="flex",r.style.gap="10px",r.style.marginTop="10px",r.style.alignItems="center",r.style.flexWrap="wrap";const o=new aP({maxValue:60}),s=new aP({maxValue:60}),a=e.createElement("div"),l=e.createElement("div");l.textContent="browserfps",l.style.font=HO,l.style.opacity="0.9",a.appendChild(l),a.appendChild(o.element);const c=e.createElement("div"),u=e.createElement("div");return u.textContent="fps",u.style.font=l.style.font,u.style.opacity="0.9",c.appendChild(u),c.appendChild(s.element),r.appendChild(a),r.appendChild(c),{id:"frames",title:"Frames",render:t=>{t.appendChild(n),t.appendChild(i),t.appendChild(r)},pushBrowserFps:(t,e)=>o.push(t,e),pushVisualFps:(t,e)=>s.push(t,e),updateInfo:function({time:r,entries:o}){const s=Array.isArray(o)?o.slice().sort(uP):[];if(!s.length)return n.textContent="",void(i.innerHTML="");n.textContent=`t=${vP(r)}s tracks=${s.length}`,i.innerHTML="";for(let n=0;n<s.length;n+=1){const r=s[n],o=bP(t,r),a=(null==o?void 0:o.id)||"n/a",l=(null==o?void 0:o.codecs)||(null==o?void 0:o.mime)||"n/a",c=mP(null==o?void 0:o.bandwidth),u=JO(null==o?void 0:o.width,null==o?void 0:o.height),d=gP(t,r)||"n/a",h=yP(t,r),f=h?` fallback=${h}`:"",p=fP(t,r),m=(null==p?void 0:p.strategy)||"n/a",v=(null==p?void 0:p.decisionReason)||"n/a",g=pP(null==p?void 0:p.measuredDownloadSpeedKbps),y=pP(null==p?void 0:p.safeBandwidthKbps),b=e.createElement("div");b.style.display="flex",b.style.flexDirection="column",b.style.gap="2px";const k=e.createElement("pre");k.style.margin="0",k.style.whiteSpace="pre-wrap",k.style.font=GO,k.style.lineHeight="1.35",k.textContent=[`${(null==r?void 0:r.nodeId)||"?"} ${(null==r?void 0:r.trackId)||"?"} ${(null==r?void 0:r.segmentId)||"?"} pts=${vP(null==r?void 0:r.presentationTime)}s`,`rep=${a} encodeProfile=${d}${f} res=${u} codec=${l} repBW=${c}`,`abr=strategy:${m} reason:${v} measuredBW:${g} safeBW:${y}`].join("\n"),b.appendChild(k);const x=(null==p?void 0:p.selectedRepresentationId)||(null==o?void 0:o.id),w=wP(t,r,o,p);if(w.length){const t=e.createElement("div");t.style.display="flex",t.style.alignItems="center",t.dataset.abrLadderRow="true",t.dataset.trackId=(null==r?void 0:r.trackId)||"",t.dataset.segmentId=(null==r?void 0:r.segmentId)||"";const n=e.createElement("div");n.style.display="inline-flex",n.style.alignItems="center",n.style.gap="2px",n.dataset.abrLadder="true",w.forEach((t=>{const i=e.createElement("span"),r=!!x&&t.id===x;i.dataset.abrLadderBlock="true",i.dataset.repId=t.id||"",i.dataset.selected=r?"true":"false",i.style.display="inline-block",i.style.width="10px",i.style.height="8px",i.style.borderRadius="2px",i.style.border="1px solid rgba(255,255,255,0.35)",i.style.background=r?"rgba(74, 222, 128, 0.95)":"rgba(156, 163, 175, 0.55)",i.title=`${t.id||"?"} ${pP(t.bandwidthKbps)}`,n.appendChild(i)})),t.appendChild(n),b.appendChild(t)}i.appendChild(b)}},dispose:()=>{o.dispose(),s.dispose()}}}({getNode:i}),k=SP({downloadSpeed:o,downloadEvents:s}),x=function({qoe:t,qoeEvents:e}={}){const n=null==$O?void 0:$O.document;if(!n||"function"!=typeof n.createElement)throw new Error("Debug overlay QoE tab requires document.createElement.");const i=n.createElement("pre");i.style.margin="0",i.style.whiteSpace="pre-wrap",i.style.font=GO;const{graphWrap:r,graph:o}=function(t){const e=t.createElement("div");e.style.marginTop="10px";const n=t.createElement("div");n.textContent="qoe score",n.style.font=HO,n.style.opacity="0.9";const i=new aP({maxValue:1,windowMs:3e4,formatValue:t=>AP(t)});return e.appendChild(n),e.appendChild(i.element),{graphWrap:e,graph:i}}(n);let s=null;const a=()=>{i.textContent=function(t){if(!t)return"QoE unavailable";const e="string"==typeof t.status?t.status:"n/a";return[`score=${AP(t.score)}`,`status=${e}`,`streamQualityScore=${AP(t.streamQualityScore)}`,`fpsScore=${AP(t.fpsScore)}`,`browserFps=${AP(t.browserFps)}`,`waitingSeconds=${AP(t.waitingSeconds)}`,`playingSeconds=${AP(t.playingSeconds)}`].join("\n")}(t)},l=()=>{if(!t)return;const e=Number(t.score);Number.isFinite(e)&&o.push(e,NP())},c=t=>{const e=Number(t);Number.isFinite(e)&&o.push(e,NP()),a()},u=()=>{a()};if(a(),l(),e&&"function"==typeof e.on&&(e.on("qoescore",c),e.on("qoestatus",u)),t){const t="function"==typeof(null==$O?void 0:$O.setInterval)?$O.setInterval:setInterval;s=t((()=>{l(),a()}),1e3)}return{id:"qoe",title:"QoE",render:t=>{t.appendChild(i),t.appendChild(r)},dispose:()=>{e&&"function"==typeof e.off&&(e.off("qoescore",c),e.off("qoestatus",u)),s&&(("function"==typeof(null==$O?void 0:$O.clearInterval)?$O.clearInterval:clearInterval)(s),s=null),o.dispose()}}}({qoe:a,qoeEvents:l}),w=function({timeline:t,getNode:e,listNodes:n,options:i}={}){const r=null==$O?void 0:$O.document;if(!r||"function"!=typeof r.createElement)throw new Error("Debug overlay Memory tab requires document.createElement.");const o=r.createElement("pre");o.style.margin="0",o.style.whiteSpace="pre-wrap",o.style.font=GO;const s=r.createElement("div");s.textContent="nodes",s.style.marginTop="10px",s.style.font=HO,s.style.opacity="0.9";const a=r.createElement("pre");a.style.margin="6px 0 0 0",a.style.whiteSpace="pre-wrap",a.style.font=GO;let l=null;const c=()=>{const r=function({timeline:t,getNode:e,listNodes:n}){const i=[];let r=0;if("function"==typeof n){let t;try{t=n()}catch(e){t=null}if(Array.isArray(t))return t.forEach((t=>{const e=null==t?void 0:t.id;if("string"!=typeof e||!e.length)return;const n=Number(null==t?void 0:t.retainedByteLength);Number.isFinite(n)&&(r+=n,i.push({nodeId:e,bytes:n}))})),i.sort(((t,e)=>e.bytes-t.bytes)),{totalBytes:r,nodes:i,available:!0}}if(!t||"function"!=typeof e)return{totalBytes:0,nodes:[],available:!1};const o=Array.isArray(t.placements)?t.placements:[];return new Set(o.map((t=>null==t?void 0:t.nodeId)).filter((t=>"string"==typeof t&&t.length))).forEach((t=>{const n=e(t),o=Number(null==n?void 0:n.retainedByteLength);Number.isFinite(o)&&(r+=o,i.push({nodeId:t,bytes:o}))})),i.sort(((t,e)=>e.bytes-t.bytes)),{totalBytes:r,nodes:i,available:!0}}({timeline:t,getNode:e,listNodes:n}),s=function({timeline:t}){if(!t||"function"!=typeof t.getDecodedFrameStats)return{totalBytes:0,frames:0,available:!1};try{const e=t.getDecodedFrameStats(),n=Number(null==e?void 0:e.totalBytes),i=Number(null==e?void 0:e.frames);return{totalBytes:Number.isFinite(n)?n:0,frames:Number.isFinite(i)?i:0,available:!1!==(null==e?void 0:e.available)}}catch(t){return{totalBytes:0,frames:0,available:!1}}}({timeline:t}),l=function(t,e,n,i){const r=Number(null!==(n=null==t||null===(i=t.publicOptions)||void 0===i?void 0:i.segmentEvictionMaxRetainedBytes)&&void 0!==n?n:null==t?void 0:t.segmentEvictionMaxRetainedBytes),o=KO(r)&&r>=0,s=o?GP(r):"n/a";return{active:o&&KO(e)&&e>r,thresholdLabel:s}}(i,r.available?r.totalBytes:NaN),c=l.active?"on":"off",u=s.available?GP(s.totalBytes):"n/a",d=s.available?s.frames:"n/a";if(!r.available)return o.textContent=[`decoded=${u} decodedFrames=${d}`,`retained=n/a eviction=${c} threshold=${l.thresholdLabel}`].join("\n"),void(a.textContent="");if(o.textContent=[`decoded=${u} decodedFrames=${d}`,[`retained=${GP(r.totalBytes)}`,`nodes=${r.nodes.length}`,`eviction=${c}`,`threshold=${l.thresholdLabel}`].join(" ")].join("\n"),!r.nodes.length)return void(a.textContent="none");const h=r.nodes.slice(0,8).map((t=>`${t.nodeId}: ${GP(t.bytes)}`));a.textContent=h.join("\n")};c();const u="function"==typeof(null==$O?void 0:$O.setInterval)?$O.setInterval:setInterval;return l=u(c,1e3),{id:"memory",title:"Memory",render:t=>{t.appendChild(o),t.appendChild(s),t.appendChild(a)},refresh:c,dispose:()=>{l&&(("function"==typeof(null==$O?void 0:$O.clearInterval)?$O.clearInterval:clearInterval)(l),l=null)}}}({timeline:n,getNode:i,listNodes:r,options:c});p.registerTab(y),p.registerTab(b),p.registerTab(k),p.registerTab(x),p.registerTab(w),p.registerTab(function({options:t}={}){const e=null==$O?void 0:$O.document;if(!e||"function"!=typeof e.createElement)throw new Error("Debug overlay options tab requires document.createElement.");const n=e.createElement("pre");n.style.margin="0",n.style.font=GO,n.style.whiteSpace="pre-wrap",n.style.wordBreak="break-word";const i=null==t?void 0:t.publicOptions,r=i&&"object"==typeof i?Object.keys(i):[];if(r.length){const t=r.map((t=>`${t}=${function(t){if(null===t)return"null";if(void 0===t)return"undefined";const e=typeof t;if("string"===e)return t;if("number"===e||"boolean"===e)return String(t);try{return JSON.stringify(t)}catch(e){return String(t)}}(i[t])}`));n.textContent=t.join("\n")}else n.textContent="publicOptions unavailable";return{id:"options",title:"Options",render:t=>{t.appendChild(n)}}}({options:c}));const _=[],T=[];let I=0,E=0,S=null,A=!1,N=0,M=null;function F(t){const e=Number(t);Number.isFinite(e)&&(e-N<250||(N=e,b.pushBrowserFps(I,e),b.pushVisualFps(E,e)))}$O.window&&"function"==typeof $O.window.requestAnimationFrame&&(S=$O.window.requestAnimationFrame((function t(e){A||(I=dP(_,e),F(e),S=$O.window.requestAnimationFrame(t))})));const C=(t={})=>{if(A||!m)return;const e=Array.isArray(t.frames)?t.frames:[];if(!e.length)return void(M=null);const n=null!=$O&&$O.performance&&"function"==typeof $O.performance.now?$O.performance.now():Date.now(),i=e.map((t=>`${null==t?void 0:t.nodeId}:${null==t?void 0:t.trackId}:${null==t?void 0:t.segmentId}@${null==t?void 0:t.presentationTime}`)).join("|");i!==M&&(E=dP(T,n),M=i),b.updateInfo({time:t.time,entries:e}),F(n)};let O=Number.isFinite(u)?u:void 0;if(Number.isFinite(O)&&f.footerPlayback){const t=O/1e3;f.footerPlayback.textContent=`Playback started @ ${QO(t)}s`}const P=(t={})=>{if(!A&&void 0===O&&"playing"===(null==t?void 0:t.event)&&(O=jO(),f.footerPlayback)){const t=O/1e3;f.footerPlayback.textContent=`Playback started @ ${QO(t)}s`}},R=()=>{const t=Array.isArray(null==n?void 0:n.placements)?n.placements:[],e=Array.isArray(null==n?void 0:n.renderPlacements)?n.renderPlacements:[];y.updatePlacements(t,e)},D=(t={})=>{if(A)return;const e=Number.isFinite(null==t?void 0:t.time)?t.time:null==n?void 0:n.currentTime;y.updateTime(e),w&&"function"==typeof w.refresh&&w.refresh()},L=()=>{A||R()},B=()=>{A||R()},z=null==n?void 0:n.trackBuffers,W=()=>{A||("function"==typeof y.refresh?y.refresh():R(),w&&"function"==typeof w.refresh&&w.refresh())};return n.on(qO.VISUAL_FRAMES_AVAILABLE,C),n.on(qO.TIMELINE_TIME_UPDATE,D),n.on(qO.PLACEMENT_ADDED,L),n.on(qO.RENDER_PLACEMENT_ADDED,B),n.on(qO.TIMELINE_PLAYER_STATE,P),z&&"function"==typeof z.on&&z.on("track:bufferupdate",W),R(),y.updateTime(null==n?void 0:n.currentTime),{show:g,hide:v,dispose:function(){A||(A=!0,S&&$O.window&&"function"==typeof $O.window.cancelAnimationFrame&&$O.window.cancelAnimationFrame(S),S=null,n&&"function"==typeof n.off&&(n.off(qO.VISUAL_FRAMES_AVAILABLE,C),n.off(qO.TIMELINE_TIME_UPDATE,D),n.off(qO.PLACEMENT_ADDED,L),n.off(qO.RENDER_PLACEMENT_ADDED,B),n.off(qO.TIMELINE_PLAYER_STATE,P)),z&&"function"==typeof z.off&&z.off("track:bufferupdate",W),b&&"function"==typeof b.dispose&&b.dispose(),y&&"function"==typeof y.dispose&&y.dispose(),k&&"function"==typeof k.dispose&&k.dispose(),x&&"function"==typeof x.dispose&&x.dispose(),w&&"function"==typeof w.dispose&&w.dispose(),p.dispose(),f.overlayRoot&&f.overlayRoot.parentNode&&f.overlayRoot.parentNode.removeChild(f.overlayRoot))},registerTab:function(t){p.registerTab(t)},selectTab:function(t){p.selectTab(t)}}}var rR=Object.freeze({__proto__:null,createDebugOverlay:iR,default:iR});exports.EkoGallery=BO,exports.EkoGalleryLegacy=nn,exports.ekoWebPixel=S,exports.getEkoAnalyticsSnippet=function(t){return`if (!window.EkoAnalytics) {\n !function () {\n var t, a, e, s, n;\n 'undefined' == typeof window || window.EkoAnalytics || (t = window, a = 'EkoAnalytics', e = document, s = 'script', t[a] || (t[a] = function () {\n t[a].f ? (t[a].q.push(arguments), t[a].ts.push(Date.now())) : t[a].apply(t, arguments);\n }, t[a].f = !0, t[a].q = t[a].q || [], t[a].ts = t[a].ts || [], t[a].t = Number(new Date), t[a].sa = [], t[a].cb = [], t[a].init = function (ids) {\n t[a].id = ids;\n }, t[a].childRequestIdsCallback = function (e) {\n e.data && 'ea-ids-request' === e.data.type && t[a].sa.push(e.source);\n }, t.addEventListener('message', t[a].childRequestIdsCallback)));\n }();\n\n window.EkoAnalytics.cb.push(() => {\n let setCookie = (key, value, additionalProperties = '') => {\n let hostname = window.location.hostname;\n let domain = hostname;\n \n let parts = hostname.split('.');\n if (parts.length > 2) {\n domain = parts.slice(-2).join('.');\n }\n\n // "samesite=lax" is needed for cross-site situations (like NZXT getting checkout url attributes from lambda).\n window.document.cookie = \`\${key}=\${value}; domain=.\${domain}; path=/; secure; samesite=lax; \${additionalProperties}\`;\n };\n\n setCookie('easid', encodeURIComponent(window.EkoAnalytics('getSid')));\n setCookie('eauid', encodeURIComponent(window.EkoAnalytics('getUid')), 'max-age=2147483647');\n });\n\n window.EkoAnalytics('configure', {\n snowplow: {\n options: {\n appId: 'ekoGalleryReact',\n },\n },\n ekoEnv: '${t?"production":"development"}',\n env: 'website',\n });\n window.EkoAnalytics('track', 'PageView');\n }`},exports.getEkoProductConfigUrl=zO,exports.getEkoProductConfigUrlLegacy=WO;
14
+ */var ue=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;var i=Object.getOwnPropertyNames(t).map((function(e){return t[e]}));if("0123456789"!==i.join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,i,r=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),o=1;o<arguments.length;o++){for(var s in n=Object(arguments[o]))le.call(n,s)&&(r[s]=n[s]);if(ae){i=ae(n);for(var a=0;a<i.length;a++)ce.call(n,i[a])&&(r[i[a]]=n[i[a]])}}return r},de="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",he=Function.call.bind(Object.prototype.hasOwnProperty),fe=function(){};if("production"!==process.env.NODE_ENV){var pe=de,me={},ve=he;fe=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function ge(e,t,n,i,r){if("production"!==process.env.NODE_ENV)for(var o in e)if(ve(e,o)){var s;try{if("function"!=typeof e[o]){var a=Error((i||"React class")+": "+n+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw a.name="Invariant Violation",a}s=e[o](t,o,i,n,null,pe)}catch(e){s=e}if(!s||s instanceof Error||fe((i||"React class")+": type specification of "+n+" `"+o+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof s+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),s instanceof Error&&!(s.message in me)){me[s.message]=!0;var l=r?r():"";fe("Failed "+n+" type: "+s.message+(null!=l?l:""))}}}ge.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(me={})};var ye=ge,be=function(){};function ke(){return null}"production"!==process.env.NODE_ENV&&(be=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}});var xe=function(e,t){var n="function"==typeof Symbol&&Symbol.iterator,i="@@iterator";var r="<<anonymous>>",o={array:c("array"),bigint:c("bigint"),bool:c("boolean"),func:c("function"),number:c("number"),object:c("object"),string:c("string"),symbol:c("symbol"),any:l(ke),arrayOf:function(e){return l((function(t,n,i,r,o){if("function"!=typeof e)return new a("Property `"+o+"` of component `"+i+"` has invalid PropType notation inside arrayOf.");var s=t[n];if(!Array.isArray(s))return new a("Invalid "+r+" `"+o+"` of type `"+h(s)+"` supplied to `"+i+"`, expected an array.");for(var l=0;l<s.length;l++){var c=e(s,l,i,r,o+"["+l+"]",de);if(c instanceof Error)return c}return null}))},element:l((function(t,n,i,r,o){var s=t[n];return e(s)?null:new a("Invalid "+r+" `"+o+"` of type `"+h(s)+"` supplied to `"+i+"`, expected a single ReactElement.")})),elementType:l((function(e,t,n,i,r){var o=e[t];return se.isValidElementType(o)?null:new a("Invalid "+i+" `"+r+"` of type `"+h(o)+"` supplied to `"+n+"`, expected a single ReactElement type.")})),instanceOf:function(e){return l((function(t,n,i,o,s){if(!(t[n]instanceof e)){var l=e.name||r;return new a("Invalid "+o+" `"+s+"` of type `"+(((c=t[n]).constructor&&c.constructor.name?c.constructor.name:r)+"` supplied to `")+i+"`, expected instance of `"+l+"`.")}var c;return null}))},node:l((function(e,t,n,i,r){return d(e[t])?null:new a("Invalid "+i+" `"+r+"` supplied to `"+n+"`, expected a ReactNode.")})),objectOf:function(e){return l((function(t,n,i,r,o){if("function"!=typeof e)return new a("Property `"+o+"` of component `"+i+"` has invalid PropType notation inside objectOf.");var s=t[n],l=h(s);if("object"!==l)return new a("Invalid "+r+" `"+o+"` of type `"+l+"` supplied to `"+i+"`, expected an object.");for(var c in s)if(he(s,c)){var u=e(s,c,i,r,o+"."+c,de);if(u instanceof Error)return u}return null}))},oneOf:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&be(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),ke;return l((function(t,n,i,r,o){for(var l=t[n],c=0;c<e.length;c++)if(s(l,e[c]))return null;var u=JSON.stringify(e,(function(e,t){return"symbol"===f(t)?String(t):t}));return new a("Invalid "+r+" `"+o+"` of value `"+String(l)+"` supplied to `"+i+"`, expected one of "+u+".")}))},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&be("Invalid argument supplied to oneOfType, expected an instance of array."),ke;for(var t=0;t<e.length;t++){var n=e[t];if("function"!=typeof n)return be("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+p(n)+" at index "+t+"."),ke}return l((function(t,n,i,r,o){for(var s=[],l=0;l<e.length;l++){var c=(0,e[l])(t,n,i,r,o,de);if(null==c)return null;c.data&&he(c.data,"expectedType")&&s.push(c.data.expectedType)}return new a("Invalid "+r+" `"+o+"` supplied to `"+i+"`"+(s.length>0?", expected one of type ["+s.join(", ")+"]":"")+".")}))},shape:function(e){return l((function(t,n,i,r,o){var s=t[n],l=h(s);if("object"!==l)return new a("Invalid "+r+" `"+o+"` of type `"+l+"` supplied to `"+i+"`, expected `object`.");for(var c in e){var d=e[c];if("function"!=typeof d)return u(i,r,o,c,f(d));var p=d(s,c,i,r,o+"."+c,de);if(p)return p}return null}))},exact:function(e){return l((function(t,n,i,r,o){var s=t[n],l=h(s);if("object"!==l)return new a("Invalid "+r+" `"+o+"` of type `"+l+"` supplied to `"+i+"`, expected `object`.");var c=ue({},t[n],e);for(var d in c){var p=e[d];if(he(e,d)&&"function"!=typeof p)return u(i,r,o,d,f(p));if(!p)return new a("Invalid "+r+" `"+o+"` key `"+d+"` supplied to `"+i+"`.\nBad object: "+JSON.stringify(t[n],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var m=p(s,d,i,r,o+"."+d,de);if(m)return m}return null}))}};function s(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function a(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function l(e){if("production"!==process.env.NODE_ENV)var n={},i=0;function o(o,s,l,c,u,d,h){if(c=c||r,d=d||l,h!==de){if(t){var f=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw f.name="Invariant Violation",f}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var p=c+":"+l;!n[p]&&i<3&&(be("You are manually calling a React.PropTypes validation function for the `"+d+"` prop on `"+c+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),n[p]=!0,i++)}}return null==s[l]?o?null===s[l]?new a("The "+u+" `"+d+"` is marked as required in `"+c+"`, but its value is `null`."):new a("The "+u+" `"+d+"` is marked as required in `"+c+"`, but its value is `undefined`."):null:e(s,l,c,u,d)}var s=o.bind(null,!1);return s.isRequired=o.bind(null,!0),s}function c(e){return l((function(t,n,i,r,o,s){var l=t[n];return h(l)!==e?new a("Invalid "+r+" `"+o+"` of type `"+f(l)+"` supplied to `"+i+"`, expected `"+e+"`.",{expectedType:e}):null}))}function u(e,t,n,i,r){return new a((e||"React class")+": "+t+" type `"+n+"."+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+r+"`.")}function d(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(d);if(null===t||e(t))return!0;var r=function(e){var t=e&&(n&&e[n]||e[i]);if("function"==typeof t)return t}(t);if(!r)return!1;var o,s=r.call(t);if(r!==t.entries){for(;!(o=s.next()).done;)if(!d(o.value))return!1}else for(;!(o=s.next()).done;){var a=o.value;if(a&&!d(a[1]))return!1}return!0;default:return!1}}function h(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function f(e){if(null==e)return""+e;var t=h(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function p(e){var t=f(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return a.prototype=Error.prototype,o.checkPropTypes=ye,o.resetWarningCache=ye.resetWarningCache,o.PropTypes=o,o};function we(){}function _e(){}_e.resetWarningCache=we;var Te=D((function(e){if("production"!==process.env.NODE_ENV){var t=se;e.exports=xe(t.isElement,!0)}else e.exports=function(){function e(e,t,n,i,r,o){if(o!==de){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:_e,resetWarningCache:we};return n.PropTypes=n,n}()}));const Ie=/https?:\/\/(.*?\.)?eko.com/,Ee={"eko.project.interaction":"interaction","eko.project.swipe":"swipe"};let Se=null,Ae=null,Ne=[];function Me(e){return t=>{var n;if(!Ie.test(t.origin)||"eko.embedapi"!==(null===(n=t.data)||void 0===n?void 0:n.source))return;const i=t.data,r=Ee[i.type];r&&(e?e(r,i.data):Ne.push({type:r,data:i.data}))}}"undefined"!=typeof window&&(Ae=Me(null),window.addEventListener("message",Ae));var Fe={subscribe:function(e){"function"==typeof e?Se?console.warn("[eko-gallery-react] Ignoring events subscribe since already subscribed"):(Se=e,Ae=Me(e),window.addEventListener("message",Ae),function(e){Ne.forEach((t=>{e(t.type,t.data)})),Ne=[]}(e)):console.warn("[eko-gallery-react] Ignoring events subscribe since a callback function was not provided as argument")},unsubscribe:function(){Ae?(window.removeEventListener("message",Ae),Ae=null,Se=null,Ne=[]):console.warn("[eko-gallery-react] Ignoring events unsubscribe since not subscribed")},send:function(e,t){Se?Se(e,t):Ne.push({type:e,data:t})}};const Ce=({index:t,activeIndex:n,setActiveIndex:i,item:r,src:o,navItemRefs:s,itemIcon:a})=>{var l,c;const u=null==r||null===(l=r.media)||void 0===l?void 0:l.srcset,d=null==r||null===(c=r.media)||void 0===c?void 0:c.sizes,h=!o&&(null==r?void 0:r.label),f=u?o:function(e,t=200){if(!e)return null;try{let n=e;e.includes("assets.eko.com")&&e.includes("/raw/")&&(n=e.replace("/raw/","/image/"));const i=new URL(n);return i.searchParams.set("width",t),i.href}catch(t){return e}}(o,150);let p=["addons-container",h?"full-thumb-label":""].join(" ").trim();return e.createElement("li",{className:"eko-nav-item","aria-current":n===t,onClick:function(){i(t),function(e){S.track("gallery.interaction",{elementid:`thumbnail-${e}`,interactiontype:"click"}),Fe.send("interaction",{elementid:`thumbnail-${e}`,interactiontype:"click"})}(t)},ref:s.current[t]},e.createElement("button",{type:"button","aria-label":`Go to item ${t}`},!h&&e.createElement("img",{src:f,srcSet:u,sizes:d,alt:null==r?void 0:r.name,loading:"eager",fetchPriority:"high"}),e.createElement("div",{className:p},(null==r?void 0:r.stepsIndication)&&e.createElement("div",{className:"step-indicator"},e.createElement("span",null),e.createElement("span",null),e.createElement("span",null)),(null==r?void 0:r.label)&&e.createElement("div",{className:"thumb-label"},null==r?void 0:r.label)),a&&e.createElement("div",{className:"item-icon"},e.createElement("span",{style:{backgroundImage:`url(${a})`}}))))};Ce.propTypes={index:Te.number,activeIndex:Te.number,setActiveIndex:Te.func.isRequired,item:Te.object.isRequired,src:Te.string,navItemRefs:Te.object.isRequired,itemIcon:Te.string};const Oe=({layout:t,nav:n,isVerticalNav:i,showPrevArrow:r,showNextArrow:o})=>{var s,a,l,c,u;const d=e.useRef(null),h=e.useRef(null),f="arrows"===(null==t||null===(s=t.mobile)||void 0===s||null===(s=s.config)||void 0===s||null===(s=s.navPagination)||void 0===s?void 0:s.type)?"eko-mobile-arrows":"",p="arrows"===(null!==(a=null==t||null===(l=t.desktop)||void 0===l||null===(l=l.config)||void 0===l||null===(l=l.navPagination)||void 0===l?void 0:l.type)&&void 0!==a?a:"arrows")?"eko-desktop-arrows":"",m=f||p,v=i?null==n||null===(c=n.current)||void 0===c?void 0:c.scrollHeight:null==n||null===(u=n.current)||void 0===u?void 0:u.scrollWidth;function g(e){const t=i?n.current.clientHeight:n.current.clientWidth,r=function(e,t){const n=i?t.scrollTop:t.scrollLeft;return Math.max(-n,Math.min(v-e-n,e))}("next"===e?t:-t,n.current);return{top:i?r:0,left:i?0:r,behavior:"smooth"}}function y(e){var t,i,r;const o=g(e),s="next"===e?null==h||null===(t=h.current)||void 0===t?void 0:t.id:null==d||null===(i=d.current)||void 0===i?void 0:i.id;var a,l;window.EkoAnalytics("track","gallery.interaction",{elementid:s,interactiontype:"click"}),null==n||null===(r=n.current)||void 0===r||r.scrollBy(o),a=s,l="click",S.track("gallery.interaction",{elementId:a,interactiontype:l}),Fe.send("interaction",{elementId:a,interactiontype:l})}return e.createElement(e.Fragment,null,m&&e.createElement(e.Fragment,null,e.createElement("button",R({type:"button","aria-label":"Go to previous item","aria-hidden":r?"false":"true",onClick:()=>y("prev"),ref:d,id:"eko-nav-prev-arrow",className:`eko-nav-arrow eko-prev-nav-button ${f} ${p} ${r?"":"eko-hidden-nav-button"}`},r?{}:{tabIndex:"-1"}),e.createElement("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M5.56127 9.52817C5.28966 9.22635 5.28966 8.77361 5.56127 8.502L10.39 3.67331C10.6918 3.37157 11.1445 3.37157 11.4161 3.67331C11.7179 3.94492 11.7179 4.39766 11.4161 4.66927L7.10044 8.98487L11.4161 13.3307C11.7179 13.6023 11.7179 14.055 11.4161 14.3266C11.1445 14.6285 10.6918 14.6285 10.4202 14.3266L5.56127 9.52817Z",fill:"black"}))),e.createElement("button",R({type:"button","aria-label":"Go to next item","aria-hidden":o?"false":"true",onClick:()=>y("next"),ref:h,className:`eko-nav-arrow eko-next-nav-button ${f} ${p} ${o?"":"eko-hidden-nav-button"}`,id:"eko-nav-next-arrow"},o?{}:{tabIndex:"-1"}),e.createElement("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M12.4387 8.47185C12.7103 8.77367 12.7103 9.22641 12.4387 9.49802L7.61003 14.3267C7.30821 14.6284 6.85547 14.6284 6.58386 14.3267C6.28212 14.0551 6.28212 13.6024 6.58386 13.3308L10.8996 9.01515L6.58386 4.66933C6.28212 4.39772 6.28212 3.94499 6.58386 3.67338C6.85547 3.37155 7.30821 3.37155 7.57982 3.67338L12.4387 8.47185Z",fill:"black"})))))};function Pe(e,t,n){let i;return function(){const n=this,r=arguments;clearTimeout(i),i=setTimeout((function(){i=null,e.apply(n,r)}),t)}}Oe.propTypes={layout:Te.object.isRequired,nav:Te.object.isRequired,isVerticalNav:Te.bool.isRequired,showPrevArrow:Te.bool.isRequired,showNextArrow:Te.bool.isRequired};const Re=({items:t,setActiveIndex:n,activeIndex:i,layout:r,carouselMounted:o,forceMobile:s})=>{const l=e.useRef(null),c=e.useRef(null),u=e.useRef([]),d=3,[h,f]=e.useState(null),[p,m]=e.useState(!1),[v,g]=e.useState(0),[y,b]=e.useState(!1),[k,x]=e.useState(!1);function w(){var e;const t=s||window.innerWidth<768?"mobile":"desktop",n=(null==r||null===(e=r[t])||void 0===e||null===(e=e.config)||void 0===e?void 0:e.orientation)||("desktop"===t?"left":"bottom");m("left"===n||"right"===n);const i=c.current.parentNode,a=o?".eko-smart-gallery-container iframe":".eko-carousel",l=i.querySelector(a);setTimeout((()=>{g(l.clientHeight)}),0)}function _(){var e,t;const n=s||a()?"mobile":"desktop",i=null!==(e=null==r||null===(t=r[n])||void 0===t||null===(t=t.config)||void 0===t||null===(t=t.navPagination)||void 0===t?void 0:t.scrollThreshold)&&void 0!==e?e:d;!function(e=d){var t,n;const i=l.current;if(!i)return;const o="none"!==(null==r||null===(t=r.desktop)||void 0===t||null===(t=t.config)||void 0===t||null===(t=t.navPagination)||void 0===t?void 0:t.type),c=(u=null==r||null===(n=r.mobile)||void 0===n||null===(n=n.config)||void 0===n||null===(n=n.navPagination)||void 0===n?void 0:n.type,"mask"===u||"arrows"===u);var u;if((s||a())&&!c)return void i.style.setProperty("-webkit-mask","none");if(!a()&&!o)return void i.style.setProperty("-webkit-mask","none");const h=i.scrollHeight-i.clientHeight,f=i.scrollTop>e?"85%":"100%",m=i.scrollTop<=h-e?"15%":"0%",v=i.scrollWidth-i.clientWidth,g=i.scrollLeft>e?"15%":"0%",y=i.scrollLeft<=v-e?"85%":"100%";p?i.style.setProperty("-webkit-mask",`linear-gradient(0deg,#0000,#000 ${m} ${f},#0000)`):i.style.setProperty("-webkit-mask",`linear-gradient(90deg,#0000,#000 ${g} ${y},#0000)`)}(i),function(e=d){var t,n,i,r,o,s;const a=p?null==l||null===(t=l.current)||void 0===t?void 0:t.scrollTop:null==l||null===(n=l.current)||void 0===n?void 0:n.scrollLeft,c=p?null==l||null===(i=l.current)||void 0===i?void 0:i.clientHeight:null==l||null===(r=l.current)||void 0===r?void 0:r.clientWidth,u=p?null==l||null===(o=l.current)||void 0===o?void 0:o.scrollHeight:null==l||null===(s=l.current)||void 0===s?void 0:s.scrollWidth;u-e<c?(b(!1),x(!1)):a<=e?(b(!1),x(!0)):a+c>u-e?(b(!0),x(!1)):a+e>0&&a<u-e&&(b(!0),x(!0))}(i)}u.current=null==t?void 0:t.map(((t,n)=>{var i,r;return null!==(i=null==u||null===(r=u.current)||void 0===r?void 0:r[n])&&void 0!==i?i:e.createRef()}));const T=Pe((e=>{var t;t=e,S.track("gallery.interaction",{elementid:"nav",interactiontype:t}),Fe.send("interaction",{elementid:"nav",interactiontype:t})}),200);const I=e.useCallback((e=>{n({index:e,step:0,source:"nav"})}),[]);return e.useEffect((()=>{var e;f(null===(e=u.current)||void 0===e?void 0:e[i])}),[i]),e.useEffect((()=>{if(null!=h&&h.current&&null!=l&&l.current){const e=h.current,t=l.current.clientWidth/2,n=e.clientWidth/2,i=l.current.clientHeight/2,r=e.clientHeight/2;l.current.scrollTo({left:e.offsetLeft-t+n,top:e.offsetTop-i+r,behavior:"smooth"})}}),[h]),e.useEffect((()=>{w()}),[]),e.useEffect((()=>(window.addEventListener("resize",w),()=>{window.removeEventListener("resize",w)})),[c,o,s]),e.useEffect((()=>{g(0),w()}),[t,c,o,s]),e.useEffect((()=>{_();const e=new ResizeObserver(_);return e.observe(l.current),()=>{e.disconnect()}}),[t,s,p]),e.createElement("div",{className:"eko-nav-container",ref:c,style:{opacity:v>0?1:0,height:""+(v&&p?v+"px":"auto")}},e.createElement(Oe,{layout:r,nav:l,isVerticalNav:p,showPrevArrow:y,showNextArrow:k}),e.createElement("ul",{className:`eko-nav eko-mobile-nav-selected-${null!==(E=null==r||null===(A=r.mobile)||void 0===A||null===(A=A.config)||void 0===A?void 0:A.navItemsSelectedType)&&void 0!==E?E:"underline"} eko-desktop-nav-selected-${null!==(N=null==r||null===(M=r.desktop)||void 0===M||null===(M=M.config)||void 0===M?void 0:M.navItemsSelectedType)&&void 0!==N?N:"underline"}`,ref:l,onScroll:function(){_()},onWheel:function(){T("wheel")},onTouchMove:function(){T("swipe")}},null==t?void 0:t.map(((t,n)=>{var r;const o=(null==t||null===(r=t.media)||void 0===r?void 0:r.url)||(null==t?void 0:t.media)||"";return e.createElement(Ce,{key:o+n,index:n,activeIndex:i,setActiveIndex:I,item:t,src:o,navItemRefs:u,itemIcon:null==t?void 0:t.icon})}))));var E,A,N,M};Re.propTypes={items:Te.array.isRequired,activeIndex:Te.number,setActiveIndex:Te.func.isRequired,layout:Te.object,carouselMounted:Te.bool,forceMobile:Te.bool};function De(){S.track("gallery.cover.displayed"),Fe.send("gallerycoverdisplayed")}function Le(e){if(!e)return e;try{const t=new URL(e);return t.host.includes("assets.eko.com")&&t.pathname.startsWith("/image")&&!t.searchParams.has("width")?(t.pathname.endsWith(".png")&&(t.pathname=t.pathname.replace(/\.png$/,".webp")),t.searchParams.set("width",1920),t.toString()):e}catch(t){return e}}const Be=({item:t,src:n,srcset:i,sizes:r,isCoverElement:o})=>{const s=e.useRef(null);return e.useEffect((()=>{var e;if(o){if(null===(e=s.current)||void 0===e||!e.complete)return s.current.addEventListener("load",De,{once:!0}),()=>{var e;null===(e=s.current)||void 0===e||e.removeEventListener("load",De,{once:!0})};De()}}),[]),e.createElement("img",{ref:s,src:Le(n),srcSet:i,sizes:r,alt:t.name,fetchPriority:o?"high":"auto",loading:o?"eager":"lazy",style:{width:"100%",height:"100%"}})};Be.propTypes={item:Te.object.isRequired,src:Te.string,srcset:Te.string,sizes:Te.string,isCoverElement:Te.bool};const ze=Pe((e=>{var t;t=e,S.track("gallery.interaction",{elementid:"carousel",interactiontype:t}),Fe.send("interaction",{elementid:"carousel",interactiontype:t})}),200);function We(){ze("wheel")}const $e=e.forwardRef((({items:t,setActiveIndex:n,activeIndex:i,showSmartLoaders:r},o)=>{const s=e.useRef(null),a=e.useRef([]);a.current=null==t?void 0:t.map(((t,n)=>{var i,r;return null!==(i=null==a||null===(r=a.current)||void 0===r?void 0:r[n])&&void 0!==i?i:e.createRef()}));const[l,c]=e.useState(),[u,d]=e.useState(),h=e.useRef(i),f=e.useRef(!1);function p(){const e=function(e){const t=e.scrollLeft,n=e.scrollWidth-e.clientWidth;return 0===t?0:t>n?100:t/n*100}(s.current)*(null==t?void 0:t.length)/100,i=Math.min(Math.trunc(e),(null==t?void 0:t.length)-1),r=h.current;"nav"!==r.source&&"external-nav"!==r.source?(f.current&&i!==r.index&&(f.current=!1),f.current||(i>(null==t?void 0:t.length)-1?n({index:(null==t?void 0:t.length)-1,source:"carousel"}):n({index:i,source:"carousel"}))):i===r.index?f.current=!0:f.current&&i!==r.index&&(f.current=!1,n({index:i,source:"carousel"}))}return e.useImperativeHandle(o,(()=>({prev:()=>{n({index:Math.max(0,h.current.index-1),source:"carousel"})},next:()=>{n({index:Math.min((null==t?void 0:t.length)-1,h.current.index+1),source:"carousel"})}}))),e.useEffect((()=>{const e=s.current;if(e)return e.addEventListener("scroll",p),()=>{e.removeEventListener("scroll",p)}}),[t]),e.useEffect((()=>{var e;let t=null===(e=a.current)||void 0===e?void 0:e[i.index];if(t&&("nav"===i.source||"external-nav"===i.source)){const e=t.current,n=s.current.clientWidth/2,i=(null==e?void 0:e.clientWidth)/2,r=(null==e?void 0:e.offsetLeft)-n+i;s.current.scrollTo({left:r,behavior:"smooth"})}}),[i]),e.useEffect((()=>{h.current=i,"nav"!==i.source&&"external-nav"!==i.source||(f.current=!1)}),[i]),e.createElement("ul",{className:"eko-carousel",ref:s,onScroll:p,onWheel:We,onTouchMove:function(e){d(e.targetTouches[0].clientX)},onTouchStart:function(e){c(e.targetTouches[0].clientX),d(null)},onTouchEnd:function(){u&&l&&(l-u>75||l-u<-75)&&ze("swipe")}},null==t?void 0:t.map(((t,n)=>{const i=(null==t?void 0:t.cover)||(null==t?void 0:t.media),o=(null==i?void 0:i.url)||i;return e.createElement("li",{className:"eko-carousel-item",key:o+n,ref:a.current[n]},e.createElement(Be,{item:t,src:o,srcset:null==i?void 0:i.srcset,sizes:null==i?void 0:i.sizes,isCoverElement:0===n}),r&&"image"!==t.type&&e.createElement("div",{className:"eko-smart-loading"},e.createElement("div",null),e.createElement("p",null,"Loading video experience")))})))}));function Ue(e){var t;return function(e){var t;return"eko.block.event"===(null==e||null===(t=e.data)||void 0===t?void 0:t.type)}(e)&&"GalleryBlock"===(null==e||null===(t=e.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.blockType)}$e.propTypes={items:Te.array.isRequired,setActiveIndex:Te.func.isRequired,activeIndex:Te.object,showSmartLoaders:Te.bool},$e.displayName="CarouselLoop";const je="eko.project.invoke",qe="eko.block.invoke";function Ve(e,t,n){var i;null!=e&&e.contentWindow&&(null==e||null===(i=e.contentWindow)||void 0===i||i.postMessage({target:"eko.embedapi",type:t,data:n},"*"))}function Ge(e){return`#variantId=${encodeURIComponent(e)}`}const He=e.forwardRef((({config:t,instanceId:n,setActiveItem:i,activeItem:r,variantId:o,smartGalleryLoaded:s,onLoad:l,forceMobile:c},u)=>{var d,h,f;const p=null!==(d=null===(h=t.options)||void 0===h?void 0:h.galleryEnv)&&void 0!==d?d:"",m=null===(f=t.__autoGenerated)||void 0===f||null===(f=f.publishItem)||void 0===f?void 0:f.id,v=function(e={}){let t="";return Object.entries(e).forEach((([e,n])=>{t+=`&${e}=${n}`})),t}(null==t?void 0:t.qp),g=function(e,t,n){return`https://${e}play.eko.com/embed?${n?`id=${n}`:`piid=${t}`}&nocover=true&galleryBlockMode=gallery&eko_pixel=true`}(p,m,n),y=e.useRef(null),b=e.useRef(null),k=e.useRef(!1),[x,w]=e.useState(Ge(o||"ekonovar")),[_,T]=e.useState(g+v+x);let I;function E(){S.track("gallery.project.display"),l(),Fe.send("galleryloaded")}return e.useImperativeHandle(u,(()=>({prev:()=>{Ve(null==b?void 0:b.current,qe,{action:"onPrevModule"})},next:()=>{Ve(null==b?void 0:b.current,qe,{action:"onNextModule"})}}))),e.useEffect((()=>{k.current?Ve(null==b?void 0:b.current,je,{action:"updateVariant",args:{id:o}}):w(Ge(o))}),[o]),e.useEffect((()=>{Ve(null==b?void 0:b.current,qe,{action:"updateActiveModule",args:{activeItemIndex:null==r?void 0:r.index,activeModuleIndex:null==r?void 0:r.step}})}),[r]),e.useEffect((()=>{function e(e){if((function(e){var t;return"eko.project.blockstart"===(null==e||null===(t=e.data)||void 0===t?void 0:t.type)}(e)||function(e){var t,n;return"eko.project.started"===(null==e||null===(t=e.data)||void 0===t?void 0:t.type)&&(null==e||null===(n=e.data)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.started)}(e))&&!k.current)return t=e.data.data.blockType,k.current=!0,void("GalleryBlock"===t?Ve(null==b?void 0:b.current,qe,{action:"updateActiveModule",args:{activeItemIndex:null==r?void 0:r.index,activeModuleIndex:null==r?void 0:r.step}}):E());var t;if(k.current){if(function(e){var t;return Ue(e)&&"activeModuleChanged"===(null==e||null===(t=e.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.name)}(e))return void function(e){const t=e.data.data.data.activeItemIndex,n=e.data.data.data.activeModuleIndex;t===(null==r?void 0:r.index)&&n===(null==r?void 0:r.step)||i({index:t,step:n,source:"carousel"})}(e);(function(e){var t;return Ue(e)&&"activeModuleChangeDone"===(null==e||null===(t=e.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.name)})(e)&&!s&&E()}}return I=c||a()?"mobile":"desktop",function(e,t={}){window.addEventListener("message",e,t)}(e),()=>{!function(e,t={}){window.removeEventListener("message",e,t)}(e)}}),[r]),e.useEffect((()=>{k.current||Ve(null==b?void 0:b.current,je,{action:"queryProjectStarted"})}),[r,s]),e.useEffect((()=>{k.current=!1}),[t]),e.useEffect((()=>{T(g+v+x)}),[x]),e.createElement("div",{className:"eko-smart-gallery-container "+(s?"":"eko-project-not-ready"),ref:y,"data-type":"smart-gallery","data-qp":v,"data-variant":o,"data-device":I},e.createElement("iframe",{allow:"autoplay; fullscreen",title:"eko gallery",src:_,style:{border:0},ref:b}))}));He.propTypes={config:Te.object.isRequired,instanceId:Te.string,setActiveItem:Te.func.isRequired,activeItem:Te.object.isRequired,variantId:Te.string,smartGalleryLoaded:Te.bool,onLoad:Te.func,forceMobile:Te.bool},He.displayName="SmartGallery";const Ke=()=>e.createElement("style",{suppressHydrationWarning:!0},'.eko-gallery {\n --accentColorEko: #000;\n --primaryColorEko: #000;\n --backgroundColorEko: #25D7A2;\n --navItemsBackgroundColorEko: transparent;\n --navItemsBannerBackgroundColorEko: #EEEEEE;\n --carouselItemsBackgroundColorEko: transparent;\n --carouselInteractiveCoverBackgroundColorEko: transparent;\n --galleryGapEkoMobile: 12px;\n --galleryGapEkoDesktop: 12px;\n --galleryPaddingEkoMobile: 0;\n --galleryPaddingEkoDesktop: 0;\n --galleryMaxWidthEkoMobile: 100%;\n --galleryMaxWidthEkoDesktop: 900px;\n --galleryTransition: .8s cubic-bezier(.35, 0, 0, 1) 1.5s;\n --navBarPaddingEkoMobile: 0 0 0 20px;\n --navBarPaddingEkoDesktop: 0;\n --navItemsWidthEkoMobile: 80px;\n --navItemsWidthEkoDesktop: 80px;\n --navItemsHeightEkoMobile: 80px;\n --navItemsHeightEkoDesktop: 80px;\n --navItemsGapEkoMobile: 14px;\n --navItemsGapEkoDesktop: 14px;\n --navItemsRadiusEkoMobile: 8px;\n --navItemsRadiusEkoDesktop: 8px;\n --navItemsSelectedMarginEkoMobile: 3px;\n --navItemsSelectedMarginEkoDesktop: 3px;\n --navItemsSelectedThicknessEkoMobile: 3px;\n --navItemsSelectedThicknessEkoDesktop: 3px;\n --navItemsSelectedUnderlineRadiusEkoMobile: 100px;\n --navItemsSelectedUnderlineRadiusEkoDesktop: 100px;\n --navItemsObjectFitEkoMobile: cover;\n --navItemsObjectFitEkoDesktop: cover;\n --navMediaBadgeSizeEkoMobile: 22px;\n --navMediaBadgeSizeEkoDesktop: 22px;\n --navMediaBadgeMarginTopEkoMobile: 4px;\n --navMediaBadgeMarginTopEkoDesktop: 4px;\n --navMediaBadgeMarginRightEkoMobile: 4px;\n --navMediaBadgeMarginRightEkoDesktop: 4px;\n --carouselItemsAspectRatioEkoMobile: 1 / 1;\n --carouselItemsAspectRatioEkoDesktop: 1 / 1;\n --carouselItemsRadiusEkoMobile: 0px;\n --carouselItemsRadiusEkoDesktop: 12px;\n --carouselItemsObjectFitEkoMobile: cover;\n --carouselItemsObjectFitEkoDesktop: cover;\n --navBannerFontSizeEkoMobile: 12px;\n --navBannerFontSizeEkoDesktop: 12px;\n --navBannerFontLineHeightEkoMobile: 120%;\n --navBannerFontLineHeightEkoDesktop: 120%;\n --navBannerFontFamilyEkoMobile: inherit;\n --navBannerFontFamilyEkoDesktop: inherit;\n --navBannerFontWeightEkoMobile: 400;\n --navBannerFontWeightEkoDesktop: 400;\n --outerWidth: 0\n}\n\n.eko-gallery * {\n box-sizing: border-box\n}\n\n.eko-gallery ul,\n.eko-gallery li {\n padding: 0;\n text-indent: 0;\n list-style-type: none;\n font-size: 0;\n margin: 0\n}\n\n.eko-gallery button {\n border: none;\n padding: 0\n}\n\n.eko-gallery .eko-hidden {\n display: none !important\n}\n\n.eko-gallery .eko-not-visible {\n visibility: hidden !important\n}\n\n.eko-hidden-variant {\n display: none !important\n}\n\n.eko-sr-only {\n width: 1px;\n height: 1px;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n margin: -1px;\n padding: 0;\n position: absolute;\n overflow: hidden\n}\n\n.eko-sticky-top {\n position: sticky;\n top: 0\n}\n\n.eko-gallery .eko-nav {\n height: 100%;\n display: flex;\n align-items: start;\n align-self: start;\n flex-shrink: 0;\n scrollbar-width: none;\n -ms-overflow-style: none\n}\n\n.eko-gallery .eko-nav li {\n font-size: 0;\n position: relative;\n display: flex;\n flex-shrink: 0;\n justify-content: center;\n -webkit-box-pack: center;\n cursor: pointer\n}\n\n.eko-gallery .eko-nav li button {\n position: relative;\n background-color: transparent;\n border-radius: 0;\n line-height: 0;\n overflow: hidden;\n cursor: pointer\n}\n\n.eko-gallery .eko-nav li button img {\n background-color: var(--navItemsBackgroundColorEko);\n pointer-events: none\n}\n\n.eko-gallery .eko-nav li button .item-icon {\n position: absolute;\n top: 0;\n right: 0;\n width: 32px;\n height: 32px;\n transform: scale(.25);\n transform-origin: top right\n}\n\n.eko-gallery .eko-nav li button .item-icon span {\n display: block;\n width: 400%;\n height: 400%;\n position: absolute;\n top: 0;\n right: 0;\n background-position: top right;\n background-repeat: no-repeat;\n background-size: contain\n}\n\n.eko-gallery .eko-nav li .addons-container {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n display: flex;\n flex-direction: column;\n font-size: 10px;\n line-height: 100%\n}\n\n.eko-gallery .eko-nav li .addons-container .thumb-label {\n width: 100%;\n background: var(--navItemsBannerBackgroundColorEko);\n padding: 4px;\n text-align: center;\n text-wrap: balance;\n color: var(--primaryColorEko)\n}\n\n.eko-gallery .eko-nav li .addons-container .step-indicator {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: center;\n gap: 5px;\n padding: 6px\n}\n\n.eko-gallery .eko-nav li .addons-container .step-indicator span {\n width: 5px;\n height: 5px;\n border-radius: 100px;\n background: #fff;\n box-shadow: 0 0 3px #00000094\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label {\n position: relative\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label .step-indicator {\n position: absolute;\n bottom: 0\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label .thumb-label {\n align-content: center\n}\n\n.eko-gallery .eko-nav::-webkit-scrollbar {\n display: none\n}\n\n.eko-nav-container {\n display: flex\n}\n\n.eko-nav-container:has(.eko-nav.eko-not-visible) .eko-nav-arrow {\n display: none\n}\n\n.eko-nav-container {\n position: relative;\n opacity: 0;\n transition: opacity .15s ease-in\n}\n\n.eko-nav-container .eko-nav-arrow {\n width: 28px;\n height: 28px;\n position: absolute;\n display: none;\n justify-content: center;\n align-items: center;\n border-radius: 28px;\n background-color: #fff;\n box-shadow: 0 0 6px #0000001f;\n z-index: 1;\n bottom: 50%;\n opacity: 1;\n transition: opacity .15s ease-in;\n transform: translateY(50%);\n cursor: pointer\n}\n\n.eko-nav-container .eko-nav-arrow.eko-prev-nav-button svg,\n.eko-nav-container .eko-nav-arrow.eko-next-nav-button svg {\n padding: 1px\n}\n\n.eko-nav-container .eko-nav-arrow.eko-prev-nav-button {\n left: 8px\n}\n\n.eko-nav-container .eko-nav-arrow.eko-next-nav-button {\n right: 8px\n}\n\n.eko-nav-container .eko-nav-arrow.eko-hidden-nav-button {\n opacity: 0;\n pointer-events: none\n}\n\n.eko-gallery .eko-nav {\n gap: var(--navItemsGapEkoMobile);\n padding: var(--navBarPaddingEkoMobile)\n}\n\n.eko-gallery .eko-nav li button img {\n width: var(--navItemsWidthEkoMobile);\n height: var(--navItemsHeightEkoMobile);\n object-fit: var(--navItemsObjectFitEkoMobile)\n}\n\n.eko-gallery .eko-nav li .addons-container .thumb-label {\n font-family: var(--navBannerFontFamilyEkoMobile);\n font-size: var(--navBannerFontSizeEkoMobile);\n line-height: var(--navBannerFontLineHeightEkoMobile);\n font-weight: var(--navBannerFontWeightEkoMobile)\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label .thumb-label {\n width: var(--navItemsWidthEkoMobile);\n height: var(--navItemsHeightEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-underline li {\n padding-bottom: calc(var(--navItemsSelectedThicknessEkoMobile) + var(--navItemsSelectedMarginEkoMobile))\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-underline li button {\n border-radius: var(--navItemsRadiusEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-underline li[aria-current=true]:after {\n content: "";\n width: 100%;\n height: var(--navItemsSelectedThicknessEkoMobile);\n border-radius: var(--navItemsSelectedUnderlineRadiusEkoMobile);\n background-color: var(--accentColorEko);\n display: block;\n position: absolute;\n bottom: 0;\n left: 0\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-outline li {\n padding: var(--navItemsSelectedMarginEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-outline li button {\n border-radius: var(--navItemsRadiusEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-outline li[aria-current=true] {\n border-radius: calc(var(--navItemsRadiusEkoMobile) + var(--navItemsSelectedMarginEkoMobile));\n box-shadow: 0 0 0 var(--navItemsSelectedThicknessEkoMobile) var(--accentColorEko)\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery .eko-nav {\n gap: var(--navItemsGapEkoDesktop);\n padding: var(--navBarPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li button img {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop);\n object-fit: var(--navItemsObjectFitEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .addons-container .thumb-label {\n font-family: var(--navBannerFontFamilyEkoDesktop);\n font-size: var(--navBannerFontSizeEkoDesktop);\n line-height: var(--navBannerFontLineHeightEkoDesktop);\n font-weight: var(--navBannerFontWeightEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .addons-container.full-thumb-label .thumb-label {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li {\n border-radius: 0;\n padding: 0;\n padding-bottom: calc(var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop))\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true] {\n box-shadow: none\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true]:after {\n content: "";\n width: 100%;\n height: var(--navItemsSelectedThicknessEkoDesktop);\n border-radius: var(--navItemsSelectedUnderlineRadiusEkoDesktop);\n background-color: var(--accentColorEko);\n display: block;\n position: absolute;\n bottom: 0;\n left: 0\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li {\n padding: var(--navItemsSelectedMarginEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true] {\n border-radius: calc(var(--navItemsRadiusEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop));\n box-shadow: 0 0 0 var(--navItemsSelectedThicknessEkoDesktop) var(--accentColorEko)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true]:after {\n content: none\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container .eko-nav-arrow {\n width: 30px;\n height: 30px\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container .eko-nav-arrow.eko-desktop-arrows {\n display: flex\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container:has(.eko-desktop-nav-selected-underline) .eko-nav-arrow.eko-desktop-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop)) / 2))\n }\n}\n\n@media screen and (max-width: 767px) {\n .eko-gallery.eko-liquid-gallery .eko-nav-arrow.eko-mobile-arrows {\n display: flex\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container:has(.eko-mobile-nav-selected-underline) .eko-nav-arrow.eko-mobile-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoMobile) + var(--navItemsSelectedMarginEkoMobile)) / 2))\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav {\n gap: var(--navItemsGapEkoDesktop);\n padding: var(--navBarPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li button img {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop);\n object-fit: var(--navItemsObjectFitEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .addons-container .thumb-label {\n font-family: var(--navBannerFontFamilyEkoDesktop);\n font-size: var(--navBannerFontSizeEkoDesktop);\n line-height: var(--navBannerFontLineHeightEkoDesktop);\n font-weight: var(--navBannerFontWeightEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .addons-container.full-thumb-label .thumb-label {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li {\n border-radius: 0;\n padding: 0;\n padding-bottom: calc(var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop))\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true] {\n box-shadow: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true]:after {\n content: "";\n width: 100%;\n height: var(--navItemsSelectedThicknessEkoDesktop);\n border-radius: var(--navItemsSelectedUnderlineRadiusEkoDesktop);\n background-color: var(--accentColorEko);\n display: block;\n position: absolute;\n bottom: 0;\n left: 0\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li {\n padding: var(--navItemsSelectedMarginEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true] {\n border-radius: calc(var(--navItemsRadiusEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop));\n box-shadow: 0 0 0 var(--navItemsSelectedThicknessEkoDesktop) var(--accentColorEko)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true]:after {\n content: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav-container .eko-nav-arrow {\n width: 30px;\n height: 30px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav-container .eko-nav-arrow.eko-desktop-arrows {\n display: flex\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav-container:has(.eko-desktop-nav-selected-underline) .eko-nav-arrow.eko-desktop-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop)) / 2))\n }\n}\n\n@media screen and (max-width: 767px) {\n .eko-gallery.eko-react-gallery.eko-mobile .eko-nav-arrow.eko-mobile-arrows {\n display: flex\n }\n\n .eko-gallery.eko-react-gallery.eko-mobile .eko-nav-container:has(.eko-mobile-nav-selected-underline) .eko-nav-arrow.eko-mobile-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoMobile) + var(--navItemsSelectedMarginEkoMobile)) / 2))\n }\n}\n\n.eko-media-badge {\n display: none;\n width: var(--navMediaBadgeSizeEkoMobile);\n height: var(--navMediaBadgeSizeEkoMobile);\n background: #fff;\n align-items: center;\n justify-content: center;\n border-radius: 100%;\n box-shadow: 0 0 4px #00000014;\n place-content: center;\n position: absolute;\n top: var(--navMediaBadgeMarginTopEkoMobile);\n right: var(--navMediaBadgeMarginRightEkoMobile)\n}\n\n.eko-media-badge svg {\n width: 100%;\n height: 100%\n}\n\n.eko-media-badge svg path {\n fill: #000\n}\n\n.eko-nav li .eko-media-badge-mobile {\n display: flex\n}\n\nsvg.interactiveThumb {\n position: absolute;\n top: 3px;\n right: -2.5px;\n width: 100%;\n height: 100%\n}\n\nsvg.interactiveThumb.hand {\n animation: handAnim 2.5s linear infinite\n}\n\nsvg.interactiveThumb.beam {\n animation: beamAnim 2.5s linear infinite;\n transform-origin: 26% 40%;\n top: 0\n}\n\n@keyframes handAnim {\n 0% {\n transform: translateY(0)\n }\n\n 3% {\n transform: translateY(-4px)\n }\n\n 15% {\n transform: translateY(0)\n }\n\n to {\n transform: translateY(0)\n }\n}\n\n@keyframes beamAnim {\n 0% {\n transform: scale(1);\n opacity: 0\n }\n\n 5% {\n transform: scale(1.1);\n opacity: 1\n }\n\n 30% {\n transform: scale(1.4);\n opacity: 0\n }\n\n to {\n transform: scale(1.4);\n opacity: 0\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery .eko-media-badge {\n width: var(--navMediaBadgeSizeEkoDesktop);\n height: var(--navMediaBadgeSizeEkoDesktop);\n top: var(--navMediaBadgeMarginTopEkoDesktop);\n right: var(--navMediaBadgeMarginRightEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .eko-media-badge-mobile {\n display: none\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .eko-media-badge-desktop {\n display: flex\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-media-badge {\n width: var(--navMediaBadgeSizeEkoDesktop);\n height: var(--navMediaBadgeSizeEkoDesktop);\n top: var(--navMediaBadgeMarginTopEkoDesktop);\n right: var(--navMediaBadgeMarginRightEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .eko-media-badge-mobile {\n display: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .eko-media-badge-desktop {\n display: flex\n }\n}\n\n.eko-loading-animation {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n overflow: hidden;\n pointer-events: none\n}\n\n.eko-loading-animation.eko-show-loading-animation .eko-animated-bar {\n opacity: .6\n}\n\n.eko-loading-animation.eko-show-loading-animation .eko-animated-bar .eko-animated-bar-inner {\n animation: eko-loading-bar-inner-animation 2s infinite\n}\n\n.eko-loading-animation.eko-show-loading-text .eko-loading-text {\n opacity: 1\n}\n\n.eko-loading-animation .eko-animated-bar {\n width: 100%;\n height: 4px;\n background-color: #e8e8e8b2;\n opacity: 0;\n transition: opacity .5s;\n position: relative\n}\n\n.eko-loading-animation .eko-animated-bar .eko-animated-bar-inner {\n width: 150px;\n height: 100%;\n transform: translate(-150px);\n background-color: var(--accentColorEko, #4d484b);\n display: block;\n position: absolute\n}\n\n.eko-loading-animation .eko-loading-text {\n position: absolute;\n top: 10px;\n left: 50%;\n transform: translate(-50%);\n color: #656565;\n font-size: 12px;\n font-family: Bogle-Medium, sans-serif;\n font-weight: 500;\n opacity: 0;\n align-items: center;\n display: flex;\n gap: 2px;\n transition: opacity .5s\n}\n\n.eko-loading-animation .eko-loading-text-icon {\n opacity: 60%\n}\n\n.eko-loading-animation .eko-loading-text-icon svg {\n transform: translate(2px, 2px)\n}\n\n.eko-loading-animation .eko-loading-text-icon path {\n fill: var(--accentColorEko, #4d484b)\n}\n\n.eko-loading-animation.eko-hide-icon .eko-loading-text-icon {\n display: none\n}\n\n@keyframes eko-loading-bar-inner-animation {\n 0% {\n left: -350px\n }\n\n to {\n left: calc(100% + 350px)\n }\n}\n\n.eko-smart-loading {\n position: absolute;\n top: 8px;\n left: 50%;\n transform: translate(-50%);\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px\n}\n\n.eko-smart-loading div {\n position: relative;\n width: 158px;\n height: 3px;\n background-color: #dcdcdc;\n overflow: hidden;\n opacity: 0;\n animation: eko-smart-loading-show-animation .2s linear forwards 1s\n}\n\n.eko-smart-loading div:after {\n content: "";\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n background-color: #878787;\n animation: eko-smart-loading-animation 2.5s ease-in-out infinite\n}\n\n.eko-smart-loading p {\n font-size: 11px;\n line-height: 120%;\n font-weight: 500;\n color: #6b6b6b;\n text-shadow: 0 0 2px white;\n opacity: 0;\n animation: eko-smart-loading-show-animation .2s linear forwards 3s\n}\n\n@keyframes eko-smart-loading-animation {\n 0% {\n transform: translate(-100%)\n }\n\n to {\n transform: translate(100%)\n }\n}\n\n@keyframes eko-smart-loading-show-animation {\n 0% {\n opacity: 0\n }\n\n to {\n opacity: 100%\n }\n}\n\n@media screen and (min-width: 450px) {\n .eko-gallery.eko-liquid-gallery .eko-loading-animation .eko-animated-bar {\n height: 6px\n }\n\n .eko-gallery.eko-liquid-gallery .eko-loading-animation .eko-loading-text {\n font-size: 16px;\n top: 12px\n }\n\n .eko-gallery.eko-liquid-gallery .eko-loading-animation .eko-loading-text-icon {\n transform: rotate(180deg)\n }\n}\n\n@media screen and (min-width: 450px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-loading-animation .eko-animated-bar {\n height: 6px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-loading-animation .eko-loading-text {\n font-size: 16px;\n top: 12px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-loading-animation .eko-loading-text-icon {\n transform: rotate(180deg)\n }\n}\n\n.eko-carousel {\n width: 100%;\n white-space: nowrap;\n overflow-x: auto;\n overflow-y: hidden;\n scroll-snap-type: x mandatory;\n overscroll-behavior-x: contain;\n align-self: start;\n align-items: start;\n display: flex;\n gap: 10px;\n scrollbar-width: none;\n -ms-overflow-style: none\n}\n\n.eko-carousel li {\n width: 100%;\n display: inline-block;\n position: relative;\n align-items: start;\n overflow: hidden;\n scroll-snap-align: center;\n scroll-snap-stop: always;\n flex-shrink: 0\n}\n\n.eko-carousel li img.eko-cover-image {\n position: relative;\n pointer-events: none;\n transition: opacity .5s;\n z-index: 1;\n width: 100%;\n height: 100%;\n background-color: var(--carouselInteractiveCoverBackgroundColorEko)\n}\n\n.eko-carousel li iframe {\n position: absolute;\n border: none;\n top: 0;\n left: 0\n}\n\n.eko-carousel li img,\n.eko-carousel li video {\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\n min-width: 0;\n background-color: var(--carouselItemsBackgroundColorEko)\n}\n\n.eko-carousel li[data-type=videoembed],\n.eko-carousel li[data-type=video] {\n cursor: pointer\n}\n\n.eko-carousel::-webkit-scrollbar {\n display: none\n}\n\n.eko-carousel:has(.zoomed) {\n overflow: hidden\n}\n\n.eko-carousel li {\n border-radius: var(--carouselItemsRadiusEkoMobile)\n}\n\n.eko-carousel li img.eko-desktop-cover-image {\n display: none\n}\n\n.eko-carousel li img.eko-mobile-cover-image {\n display: inline\n}\n\n.eko-carousel li img,\n.eko-carousel li video {\n aspect-ratio: var(--carouselItemsAspectRatioEkoMobile);\n object-fit: var(--carouselItemsObjectFitEkoMobile)\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery .eko-carousel li {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-carousel li img,\n .eko-gallery.eko-liquid-gallery .eko-carousel li video {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop);\n object-fit: var(--carouselItemsObjectFitEkoDesktop)\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-carousel li {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-carousel li img,\n .eko-gallery.eko-react-gallery.eko-desktop .eko-carousel li video {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop);\n object-fit: var(--carouselItemsObjectFitEkoDesktop)\n }\n}\n\n.eko-gallery.eko-mobile-embed-layout .eko-nav-container {\n display: none\n}\n\n.eko-gallery.eko-mobile-embed-layout .eko-carousel {\n overflow-x: hidden\n}\n\n.eko-gallery.eko-mobile-embed-layout .eko-mobile-carousel-scroll {\n overflow-x: auto\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery.eko-desktop-embed-layout .eko-nav-container {\n display: none\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-embed-layout .eko-carousel {\n overflow-x: hidden\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-embed-layout .eko-carousel.eko-desktop-carousel-scroll {\n overflow-x: auto\n }\n\n .eko-gallery.eko-liquid-gallery.eko-mobile-embed-layout.eko-desktop-nav-layout .eko-nav-container {\n display: flex\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-embed-layout .eko-nav-container {\n display: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-embed-layout .eko-carousel {\n overflow-x: hidden\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-embed-layout .eko-carousel.eko-desktop-carousel-scroll {\n overflow-x: auto\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-mobile-embed-layout.eko-desktop-nav-layout .eko-nav-container {\n display: flex\n }\n}\n\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-bottom .eko-nav,\n.eko-gallery.eko-desktop-nav-layout.eko-desktop-nav-bottom .eko-nav,\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-top .eko-nav,\n.eko-gallery.eko-desktop-nav-layout.eko-desktop-nav-top .eko-nav {\n flex-direction: row;\n overflow-x: auto;\n overflow-y: hidden;\n max-width: 100%;\n margin: auto\n}\n\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-bottom {\n flex-direction: column-reverse\n}\n\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-top {\n flex-direction: column\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-bottom {\n flex-direction: column-reverse\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-top {\n flex-direction: column\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-bottom {\n flex-direction: column-reverse\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-top {\n flex-direction: column\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right {\n flex-direction: row-reverse\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left {\n flex-direction: row\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav {\n display: flex;\n flex-direction: column;\n justify-content: start;\n overflow-x: hidden;\n overflow-y: auto;\n gap: var(--navItemsGapEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container {\n display: flex;\n flex-shrink: 0\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button {\n top: 4px;\n left: auto\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n bottom: 4px\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n right: 50%;\n transform: translate(50%)\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg {\n transform: rotate(90deg)\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout .eko-carousel {\n align-self: start\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right {\n flex-direction: row-reverse\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left {\n flex-direction: row\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav {\n display: flex;\n flex-direction: column;\n justify-content: start;\n overflow-x: hidden;\n overflow-y: auto;\n gap: var(--navItemsGapEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container {\n display: flex;\n flex-shrink: 0\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button {\n top: 4px;\n left: auto\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n bottom: 4px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n right: 50%;\n transform: translate(50%)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg {\n transform: rotate(90deg)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout .eko-carousel {\n align-self: start\n }\n}\n\n.eko-gallery .eko-introButton {\n cursor: pointer;\n white-space: nowrap;\n pointer-events: auto;\n position: absolute;\n bottom: 100px;\n left: 50%;\n transform: translate(-50%);\n padding: 15px 20px\n}\n\n.eko-gallery .eko-introButton .eko-handContainer {\n display: none\n}\n\n.eko-gallery {\n position: relative;\n overflow: hidden;\n display: flex;\n flex-direction: row;\n justify-content: start;\n margin-inline-start: calc(-1 * var(--outerWidth));\n margin-inline-end: calc(-1 * var(--outerWidth));\n padding: var(--galleryPaddingEkoMobile);\n margin: auto;\n max-width: var(--galleryMaxWidthEkoMobile);\n transition: height var(--galleryTransition, .8s cubic-bezier(.35, 0, 0, 1) 1.5s), padding 0s;\n gap: var(--galleryGapEkoMobile)\n}\n\n.eko-gallery .eko-smart-gallery-container {\n border-radius: var(--carouselItemsRadiusEkoMobile);\n overflow: hidden;\n flex: 1;\n display: flex;\n height: fit-content\n}\n\n.eko-gallery .eko-smart-gallery-container iframe {\n width: 100%;\n aspect-ratio: var(--carouselItemsAspectRatioEkoMobile)\n}\n\n.eko-gallery .eko-smart-gallery-container.eko-project-not-ready {\n position: absolute;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n opacity: 0;\n pointer-events: none;\n touch-action: none\n}\n\n.eko-gallery .eko-smart-gallery-container.eko-project-not-ready iframe {\n pointer-events: none;\n touch-action: none\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery {\n max-width: var(--galleryMaxWidthEkoDesktop);\n gap: var(--galleryGapEkoDesktop);\n padding: var(--galleryPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-smart-gallery-container {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-smart-gallery-container iframe {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop)\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop {\n max-width: var(--galleryMaxWidthEkoDesktop);\n gap: var(--galleryGapEkoDesktop);\n padding: var(--galleryPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-smart-gallery-container {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-smart-gallery-container iframe {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop)\n }\n}'),Xe=({layout:t,style:n})=>{let i={};return function(e={}){Object.keys(e).forEach((t=>{i[`--${t}Eko`]=e[t]}))}(n),function(e){var t,n;const r=(null==e||null===(t=e.desktop)||void 0===t?void 0:t.config)||{},o=(null==e||null===(n=e.mobile)||void 0===n?void 0:n.config)||{};Object.keys(r).forEach((e=>{"string"==typeof r[e]&&(i[`--${e}EkoDesktop`]=r[e])})),Object.keys(o).forEach((e=>{"string"==typeof o[e]&&(i[`--${e}EkoMobile`]=o[e])}))}(t),e.createElement("style",{key:{layout:t,style:n}},`.eko-gallery {${Object.keys(i).map((e=>`${e}: ${i[e]};`)).join("\n")}}`)};Xe.propTypes={layout:Te.object,style:Te.object},u("experiment");const Ye=({activeVariantId:t,activeElementId:n,hasInteractive:i,experiments:r,publishItem:o})=>{const s="gallery",a=e.useRef(t),l=e.useRef(n),c=e.useRef(i),u=e.useRef(r),d=e.useRef(o);e.useEffect((()=>{a.current=t,l.current=n,c.current=i,u.current=r,d.current=o}),[t,n,i,r,o]);const h={publishItemPacker:{tag:s,schema:"iglu:com.helloeko/publishitem/jsonschema/1-0-0",match:/.*/,getData:function(){const e=d.current;if(e){const t={};return null!=e&&e.id&&(t.id=e.id),null!=e&&e.productId&&(t.productid=e.productId),e.salesChannelId&&(t.saleschannelid=e.salesChannelId),null!=e&&e.salesChannelName&&(t.saleschannelname=e.salesChannelName),e.salesChannelType&&(t.saleschanneltype=e.salesChannelType),t.id?t:void 0}}},galleryInteractionPacker:{tag:s,schema:"iglu:com.helloeko/gallery_interaction/jsonschema/1-0-0",match:"gallery.interaction",getData:function({elementid:e,interactiontype:t}){return{elementid:String(e),interactiontype:t}}},galleryPacker:{tag:s,schema:"iglu:com.helloeko/gallery/jsonschema/1-0-2",match:/^gallery.*/,getData:function(){var e;return{activeitemid:l.current.toString(),activevariantid:a.current,hasinteractive:c.current,version:(null===(e=window.eko)||void 0===e||null===(e=e.gallery)||void 0===e?void 0:e.version)||""}}},activeVariantIdPacker:{tag:s,schema:"iglu:com.helloeko/variant/jsonschema/1-0-1",match:/.*/,getData:function(){if(a.current)return{id:a.current}}},experimentPacker:{tag:s,schema:"iglu:com.helloeko/experiment/jsonschema/1-0-3",match:/.*/,getData:function(){var e;let t=function(e){let t=null;if(e){const n=Math.floor(Date.now()/1e3);for(const i of e){if("deliverable"!==i.type)return;const e=Math.floor(new Date(i.startDate).getTime()/1e3),r=Math.floor(new Date(i.endDate).getTime()/1e3);!0===i.active&&n>e&&n<r&&(t=i)}}return t}(u.current);if(!t)return;let n={experimentid:t.id||"",experimentvariant:t.chosen||"pending decision",experimenttype:t.type||""},i=null===(e=t.targetDevice)||void 0===e?void 0:e.toLowerCase();return"mobile"!==i&&"notmobile"!==i||(n.experimenttargeting={device:i}),n}}};return e.useEffect((()=>(Object.values(h).forEach((e=>{window.EkoAnalytics("registerContextPacker",e)})),()=>{window.EkoAnalytics("reset",s)})),[]),null};Ye.propTypes={activeVariantId:Te.string,activeElementId:Te.number,hasInteractive:Te.bool,experiments:Te.array,publishItem:Te.object};const Qe=({variantId:t,activeItem:n,hasInteractive:i,activeIndex:r,experiments:o,publishItem:s})=>{const a=e.useRef(!0);return e.useEffect((()=>{a.current||t&&S.track("gallery.variant.change")}),[t]),e.useEffect((()=>{a.current||S.track("gallery.element.change",{activeIndex:r})}),[r]),e.useEffect((()=>{a.current||n&&null!=s&&s.id&&S.track("gallery.asset.view",{publishitemid:s.id,type:n.type,name:n.name})}),[n]),e.useEffect((()=>{a.current=!1}),[]),e.createElement(Ye,{activeVariantId:t||"ekonovar",activeElementId:r,hasInteractive:i,experiments:o,publishItem:s})};Qe.propTypes={variantId:Te.string,activeItem:Te.object,hasInteractive:Te.bool,activeIndex:Te.number,experiments:Te.array,publishItem:Te.object};const Je="eko-gallery-react";function Ze(e,t){var n,i,r;const o=(null==e||null===(n=e.variantMap)||void 0===n?void 0:n[t])||"ekonovar";return(null==e||null===(i=e.items)||void 0===i?void 0:i.find((e=>(null==e?void 0:e.variantId)===o)))||(null==e||null===(r=e.items)||void 0===r?void 0:r[0])}"undefined"!=typeof window&&(window.EkoAnalytics||(console.log("EkoAnalytics is not defined, initializing a no-op function..."),window.EkoAnalytics=()=>{}));const et=e.forwardRef((({className:t,config:n,instanceId:i,variantId:r,activeItem:o={index:0,step:0},onEvent:s,forceMobile:a},l)=>{var c,u,d,h,f,p;const m=null!==(c=null===(u=n.options)||void 0===u?void 0:u.loadingTimeout)&&void 0!==c?c:12,v=null===(d=null===(h=n.options)||void 0===h?void 0:h.showCoverLoadAnimation)||void 0===d||d,[g,y]=e.useState(Ze(n,r)),[b,k]=e.useState({index:o.index,step:o.step,source:"external-nav"}),[x,w]=e.useState(!1),[_,T]=e.useState(!1),[I,E]=e.useState("eko-desktop"),A=e.useRef(!1),N=e.useRef(!1),M=e.useRef(o),F=e.useRef(null),C=e.useRef(r);function O(){const e=a||window.innerWidth<768?"eko-mobile":"eko-desktop";E(e)}return N.current||(Fe.send("galleryinit"),N.current=!0),e.useEffect((()=>{const e=C.current!==r;C.current=r,y(Ze(n,r)),e&&!A.current&&k({index:0,step:0,source:"external-nav"})}),[n,r]),e.useEffect((()=>{if(s)return Fe.subscribe(s),()=>{Fe.unsubscribe()}}),[s]),e.useEffect((()=>{A.current=_}),[_]),e.useEffect((()=>{w(!1),T(!1);const e=setTimeout((()=>{A.current||(w(!0),S.track("gallery.load.timeout"))}),1e3*m);return()=>{clearTimeout(e)}}),[n]),e.useEffect((()=>{O()}),[a]),e.useEffect((()=>(window.addEventListener("resize",O),O(),()=>{window.removeEventListener("resize",O)})),[a]),e.useEffect((()=>(window.EkoAnalytics("trackElementVisibility",F.current,Je),()=>{window.EkoAnalytics("stopTrackingElementVisibility",Je)})),[]),e.useEffect((()=>{!("carousel"===(null==b?void 0:b.source)||"nav"===(null==b?void 0:b.source))||(null==b?void 0:b.index)===o.index&&(null==b?void 0:b.step)===o.step||Fe.send("activeitemchanged",{index:null==b?void 0:b.index,step:null==b?void 0:b.step})}),[b,o]),e.useEffect((()=>{M.current.index===o.index&&M.current.step===o.step||(M.current=o,k({index:o.index,step:o.step,source:"external-nav"}))}),[o]),e.createElement(e.Fragment,null,e.createElement(Ke,null),e.createElement(Xe,{layout:n.layout,style:n.style,forceMobile:a}),e.createElement(Qe,{variantId:r,activeItem:null==g||null===(f=g.items)||void 0===f?void 0:f[b.index],activeIndex:b.index,hasInteractive:_,experiments:n.experiments,publishItem:null==n||null===(p=n.__autoGenerated)||void 0===p?void 0:p.publishItem}),e.createElement("section",{className:`${`eko-gallery eko-react-gallery ${function(e){let t="";return["mobile","desktop"].forEach((n=>{var i,r;const o=null!==(i=null==e||null===(r=e[n])||void 0===r?void 0:r.type)&&void 0!==i?i:"nav";if(t+=`eko-${n}-${o}-layout `,"nav"===o){var s;const i="desktop"===n,r=(null==e||null===(s=e[n])||void 0===s||null===(s=s.config)||void 0===s?void 0:s.orientation)||(i?"left":"bottom");t+=`eko-${n}-nav-${r} `}})),t}(n.layout)} ${null!=t?t:""}`.trim()} ${I}`,"aria-controls":"main-content",ref:F},e.createElement(Re,{items:(null==g?void 0:g.items)||[],setActiveIndex:k,activeIndex:b.index,layout:n.layout,carouselMounted:_,forceMobile:a}),!_&&e.createElement($e,{ref:l,items:(null==g?void 0:g.items)||[],setActiveIndex:k,activeIndex:{index:b.index,source:null==b?void 0:b.source},showSmartLoaders:!x&&v}),!x&&e.createElement(He,{ref:l,config:n,instanceId:i,activeItem:b,setActiveItem:k,variantId:null==g?void 0:g.variantId,smartGalleryLoaded:_,forceMobile:a,onLoad:function(){T(!0)}})))}));et.propTypes={className:Te.string,config:Te.object.isRequired,instanceId:Te.string,variantId:Te.string,activeItem:Te.object,onEvent:Te.func,forceMobile:Te.bool,onPrev:Te.func,onNext:Te.func},et.displayName="EkoGallery";var tt=e.memo(et);const nt=u("gallery-react");const it=e.forwardRef(((t,n)=>{var i;e.useEffect((()=>(nt.setDataStorage("gallery-react",{config:t.config}),window.eko=window.eko||{},window.eko.config=t.config,window.eko.gallery={version:"bby-debug-logs/4.0.4"},()=>{window.eko.config=void 0})),[t.config]);const{children:r,...o}=t;return void 0!==t.config?e.createElement(tt,R({ref:n},o,{key:null===(i=t.config.__autoGenerated)||void 0===i||null===(i=i.publishItem)||void 0===i?void 0:i.id})):r}));it.propTypes={className:Te.string,config:Te.object,variantId:Te.string,onEvent:Te.func,instanceId:Te.string,children:Te.node},it.displayName="EkoGalleryWrapper";var rt,ot,st,at,lt,ct,ut,dt,ht,ft,pt,mt,vt,gt,yt,bt,kt,xt,wt,_t,Tt,It,Et,St,At,Nt,Mt,Ft,Ct,Ot,Pt,Rt,Dt,Lt,Bt,zt,Wt,$t,Ut,jt,qt,Vt,Gt,Ht,Kt,Xt,Yt,Qt,Jt,Zt,en,tn,nn=e.memo(it);const rn=1,on=2,sn=4,an=8,ln=16,cn=1,un=4,dn=8,hn=16,fn="[",pn="[!",mn="]",vn={},gn=Symbol(),yn=Symbol("filename"),bn="http://www.w3.org/1999/xhtml",kn="@attach",xn=!0;var wn=Array.isArray,_n=Array.prototype.indexOf,Tn=Array.from,In=Object.defineProperty,En=Object.getOwnPropertyDescriptor,Sn=Object.getOwnPropertyDescriptors,An=Object.prototype,Nn=Array.prototype,Mn=Object.getPrototypeOf,Fn=Object.isExtensible;function Cn(){var e,t;return{promise:new Promise(((n,i)=>{e=n,t=i})),resolve:e,reject:t}}const On=2,Pn=4,Rn=8,Dn=1<<24,Ln=16,Bn=32,zn=64,Wn=128,$n=512,Un=1024,jn=2048,qn=4096,Vn=8192,Gn=16384,Hn=32768,Kn=65536,Xn=1<<17,Yn=1<<18,Qn=1<<19,Jn=1<<20,Zn=1<<25,ei=32768,ti=1<<21,ni=1<<22,ii=1<<23,ri=Symbol("$state"),oi=Symbol("legacy props"),si=Symbol(""),ai=Symbol("proxy path"),li=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},ci=3,ui=8;function di(e){{const t=new Error(`lifecycle_outside_component\n\`${e}(...)\` can only be used during component initialisation\nhttps://svelte.dev/e/lifecycle_outside_component`);throw t.name="Svelte error",t}}var hi="font-weight: bold",fi="font-weight: normal";function pi(e){console.warn("%c[svelte] hydration_mismatch\n%cHydration failed because the initial UI does not match what was rendered on the server\nhttps://svelte.dev/e/hydration_mismatch",hi,fi)}function mi(e){console.warn(`%c[svelte] state_proxy_equality_mismatch\n%cReactive \`$state(...)\` proxies and the values they proxy have different identities. Because of this, comparisons with \`${e}\` will produce unexpected results\nhttps://svelte.dev/e/state_proxy_equality_mismatch`,hi,fi)}let vi,gi=!1;function yi(e){gi=e}function bi(e){if(null===e)throw pi(),vn;return vi=e}function ki(){return bi($o(vi))}function xi(e){if(gi){if(null!==$o(vi))throw pi(),vn;vi=e}}function wi(e=!0){for(var t=0,n=vi;;){if(n.nodeType===ui){var i=n.data;if(i===mn){if(0===t)return n;t-=1}else i!==fn&&i!==pn||(t+=1)}var r=$o(n);e&&n.remove(),n=r}}function _i(e){if(!e||e.nodeType!==ui)throw pi(),vn;return e.data}function Ti(e){return e===this.v}function Ii(e){return t=e,n=this.v,!(t!=t?n==n:t!==n||null!==t&&"object"==typeof t||"function"==typeof t);var t,n}let Ei=!1;var Si="font-weight: bold",Ai="font-weight: normal";function Ni(e){console.warn(`%c[svelte] state_snapshot_uncloneable\n%c${e?`The following properties cannot be cloned with \`$state.snapshot\` — the return value contains the originals:\n\n${e}`:"Value cannot be cloned with `$state.snapshot` — the original value was returned"}\nhttps://svelte.dev/e/state_snapshot_uncloneable`,Si,Ai)}const Mi=[];function Fi(e,t=!1,n=!1){if(!t){const t=[],i=Ci(e,new Map,"",t,null,n);if(1===t.length&&""===t[0])Ni();else if(t.length>0){const e=t.length>10?t.slice(0,7):t.slice(0,10),n=t.length-e.length;let i=e.map((e=>`- <value>${e}`)).join("\n");n>0&&(i+=`\n- ...and ${n} more`),Ni(i)}return i}return Ci(e,new Map,"",Mi,null,n)}function Ci(e,t,n,i,r=null,o=!1){if("object"==typeof e&&null!==e){var s=t.get(e);if(void 0!==s)return s;if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);if(wn(e)){var a=Array(e.length);t.set(e,a),null!==r&&t.set(r,a);for(var l=0;l<e.length;l+=1){var c=e[l];l in e&&(a[l]=Ci(c,t,`${n}[${l}]`,i,null,o))}return a}if(Mn(e)===An){for(var u in a={},t.set(e,a),null!==r&&t.set(r,a),e)a[u]=Ci(e[u],t,`${n}.${u}`,i,null,o);return a}if(e instanceof Date)return structuredClone(e);if("function"==typeof e.toJSON&&!o)return Ci(e.toJSON(),t,`${n}.toJSON()`,i,e)}if(e instanceof EventTarget)return e;try{return structuredClone(e)}catch(t){return i.push(n),e}}function Oi(e,t){return e.label=t,Pi(e.v,t),e}function Pi(e,t){var n;return null==e||null===(n=e[ai])||void 0===n||n.call(e,t),e}function Ri(e){const t=new Error,n=function(){const e=Error.stackTraceLimit;Error.stackTraceLimit=1/0;const t=(new Error).stack;if(Error.stackTraceLimit=e,!t)return[];const n=t.split("\n"),i=[];for(let e=0;e<n.length;e++){const t=n[e],r=t.replaceAll("\\","/");if("Error"!==t.trim()){if(t.includes("validate_each_keys"))return[];r.includes("svelte/src/internal")||r.includes("node_modules/.vite")||i.push(t)}}return i}();return 0===n.length?null:(n.unshift("\n"),In(t,"stack",{value:n.join("\n")}),In(t,"name",{value:e}),t)}let Di=null;function Li(e){Di=e}let Bi=null;function zi(e){Bi=e}let Wi=null;function $i(e){Wi=e}function Ui(e){return Vi("getContext").get(e)}function ji(e,t=!1,n){Di={p:Di,i:!1,c:null,e:null,s:e,x:null,l:null},Di.function=n,Wi=n}function qi(e){var t,n,i=Di,r=i.e;if(null!==r)for(var o of(i.e=null,r))es(o);return i.i=!0,Di=i.p,Wi=null!==(t=null===(n=Di)||void 0===n?void 0:n.function)&&void 0!==t?t:null,{}}function Vi(e){var t,n;return null===Di&&di(e),null!==(n=(t=Di).c)&&void 0!==n?n:t.c=new Map(function(e){let t=e.p;for(;null!==t;){const e=t.c;if(null!==e)return e;t=t.p}return null}(Di)||void 0)}let Gi=[];function Hi(){var e=Gi;Gi=[],function(e){for(var t=0;t<e.length;t++)e[t]()}(e)}function Ki(e){if(0===Gi.length&&!dr){var t=Gi;queueMicrotask((()=>{t===Gi&&Hi()}))}Gi.push(e)}function Xi(){for(;Gi.length>0;)Hi()}const Yi=new WeakMap;function Qi(e){var t=_s;if(null===t)return ks.f|=ii,e;if(e instanceof Error&&!Yi.has(e)&&Yi.set(e,function(e,t){var n,i;const r=En(e,"message");if(r&&!r.configurable)return;var o=Ro?" ":"\t",s=`\n${o}in ${(null===(n=t.fn)||void 0===n?void 0:n.name)||"<unknown>"}`,a=t.ctx;for(;null!==a;){var l;s+=`\n${o}in ${null===(l=a.function)||void 0===l?void 0:l[yn].split("/").pop()}`,a=a.p}return{message:e.message+`\n${s}\n`,stack:null===(i=e.stack)||void 0===i?void 0:i.split("\n").filter((e=>!e.includes("svelte/src/internal"))).join("\n")}}(e,t)),t.f&Hn)Ji(e,t);else{if(!(t.f&Wn))throw!t.parent&&e instanceof Error&&Zi(e),e;t.b.error(e)}}function Ji(e,t){for(;null!==t;){if(t.f&Wn)try{return void t.b.error(e)}catch(t){e=t}t=t.parent}throw e instanceof Error&&Zi(e),e}function Zi(e){const t=Yi.get(e);t&&(In(e,"message",{value:t.message}),In(e,"stack",{value:t.stack}))}const er=-7169;function tr(e,t){e.f=e.f&er|t}function nr(e){e.f&$n||null===e.deps?tr(e,Un):tr(e,qn)}function ir(e){if(null!==e)for(const t of e)t.f&On&&t.f&ei&&(t.f^=ei,ir(t.deps))}function rr(e,t,n){e.f&jn?t.add(e):e.f&qn&&n.add(e),ir(e.deps),tr(e,Un)}const or=new Set;let sr=null,ar=null,lr=[],cr=null,ur=!1,dr=!1;var hr=new WeakMap,fr=new WeakMap,pr=new WeakMap,mr=new WeakMap,vr=new WeakMap,gr=new WeakMap,yr=new WeakMap,br=new WeakSet;class kr{constructor(){O(this,br),P(this,"committed",!1),P(this,"current",new Map),P(this,"previous",new Map),F(this,hr,new Set),F(this,fr,new Set),F(this,pr,0),F(this,mr,0),F(this,vr,null),F(this,gr,new Set),F(this,yr,new Set),P(this,"skipped_effects",new Set),P(this,"is_fork",!1)}is_deferred(){return this.is_fork||M(mr,this)>0}process(e){lr=[],this.apply();var t,n=[],i=[];for(const t of e)A(br,this,xr).call(this,t,n,i);(this.is_fork||A(br,this,_r).call(this),this.is_deferred())?(A(br,this,wr).call(this,i),A(br,this,wr).call(this,n)):(sr=null,Ar(i),Ar(n),null===(t=M(vr,this))||void 0===t||t.resolve());ar=null}capture(e,t){var n;(t===gn||this.previous.has(e)||this.previous.set(e,t),e.f&ii)||(this.current.set(e,e.v),null===(n=ar)||void 0===n||n.set(e,e.v))}activate(){sr=this,this.apply()}deactivate(){sr===this&&(sr=null,ar=null)}flush(){if(this.activate(),lr.length>0){if(Ir(),null!==sr&&sr!==this)return}else 0===M(pr,this)&&this.process([]);this.deactivate()}discard(){for(const e of M(fr,this))e(this);M(fr,this).clear()}increment(e){C(pr,this,M(pr,this)+1),e&&C(mr,this,M(mr,this)+1)}decrement(e){C(pr,this,M(pr,this)-1),e&&C(mr,this,M(mr,this)-1),this.revive()}revive(){for(const e of M(gr,this))M(yr,this).delete(e),tr(e,jn),Fr(e);for(const e of M(yr,this))tr(e,qn),Fr(e);this.flush()}oncommit(e){M(hr,this).add(e)}ondiscard(e){M(fr,this).add(e)}settled(){var e;return(null!==(e=M(vr,this))&&void 0!==e?e:C(vr,this,Cn())).promise}static ensure(){if(null===sr){const e=sr=new kr;or.add(sr),dr||kr.enqueue((()=>{sr===e&&e.flush()}))}return sr}static enqueue(e){Ki(e)}apply(){}}function xr(e,t,n){e.f^=Un;for(var i=e.first,r=null;null!==i;){var o=i.f,s=!!(o&(Bn|zn));if(!(s&&!!(o&Un)||!!(o&Vn)||this.skipped_effects.has(i))&&null!==i.fn){s?i.f^=Un:null!==r&&o&(Pn|Rn|Dn)?r.b.defer_effect(i):o&Pn?t.push(i):Rs(i)&&(o&Ln&&M(gr,this).add(i),Ws(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 wr(e){for(var t=0;t<e.length;t+=1)rr(e[t],M(gr,this),M(yr,this))}function _r(){if(0===M(mr,this)){for(const e of M(hr,this))e();M(hr,this).clear()}0===M(pr,this)&&A(br,this,Tr).call(this)}function Tr(){if(or.size>1){this.previous.clear();var e=ar,t=!0;for(const e of or){if(e===this){t=!1;continue}const i=[];for(const[n,r]of this.current){if(e.current.has(n)){if(!t||r===e.current.get(n))continue;e.current.set(n,r)}i.push(n)}if(0===i.length)continue;const r=[...e.current.keys()].filter((e=>!this.current.has(e)));if(r.length>0){var n=lr;lr=[];const t=new Set,o=new Map;for(const e of i)Nr(e,r,t,o);if(lr.length>0){sr=e,e.apply();for(const t of lr)A(br,e,xr).call(e,t,[],[]);e.deactivate()}lr=n}}sr=null,ar=e}this.committed=!0,or.delete(this)}function Ir(){var e=vs;ur=!0;var t=new Set;try{var n=0;for(gs(!0);lr.length>0;){var i=kr.ensure();if(n++>1e3){if(xn){var r=new Map;for(const e of i.current.keys())for(const[t,n]of null!==(o=e.updated)&&void 0!==o?o:[]){var o,s=r.get(t);s||(s={error:n.error,count:0},r.set(t,s)),s.count+=n.count}for(const e of r.values())e.error&&console.error(e.error)}Er()}if(i.process(lr),go.clear(),xn)for(const e of i.current.keys())t.add(e)}}finally{ur=!1,gs(e),cr=null;for(const e of t)e.updated=null}}function Er(){try{!function(){{const e=new Error("effect_update_depth_exceeded\nMaximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state\nhttps://svelte.dev/e/effect_update_depth_exceeded");throw e.name="Svelte error",e}}()}catch(e){In(e,"stack",{value:""}),Ji(e,cr)}}let Sr=null;function Ar(e){var t=e.length;if(0!==t){for(var n=0;n<t;){var i,r=e[n++];if(!(r.f&(Gn|Vn))&&Rs(r))if(Sr=new Set,Ws(r),null===r.deps&&null===r.first&&null===r.nodes&&(null===r.teardown&&null===r.ac?us(r):r.fn=null),(null===(i=Sr)||void 0===i?void 0:i.size)>0){go.clear();for(const e of Sr){if(e.f&(Gn|Vn))continue;const t=[e];let n=e.parent;for(;null!==n;)Sr.has(n)&&(Sr.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){const n=t[e];n.f&(Gn|Vn)||Ws(n)}}Sr.clear()}}Sr=null}}function Nr(e,t,n,i){if(!n.has(e)&&(n.add(e),null!==e.reactions))for(const r of e.reactions){const e=r.f;e&On?Nr(r,t,n,i):e&(ni|Ln)&&!(e&jn)&&Mr(r,t,i)&&(tr(r,jn),Fr(r))}}function Mr(e,t,n){const i=n.get(e);if(void 0!==i)return i;if(null!==e.deps)for(const i of e.deps){if(t.includes(i))return!0;if(i.f&On&&Mr(i,t,n))return n.set(i,!0),!0}return n.set(e,!1),!1}function Fr(e){for(var t=cr=e;null!==t.parent;){var n=(t=t.parent).f;if(ur&&t===_s&&n&Ln&&!(n&Yn))return;if(n&(zn|Bn)){if(!(n&Un))return;t.f^=Un}}lr.push(t)}var Cr=Kn|Qn|Wn;var Or=new WeakMap,Pr=new WeakMap,Rr=new WeakMap,Dr=new WeakMap,Lr=new WeakMap,Br=new WeakMap,zr=new WeakMap,Wr=new WeakMap,$r=new WeakMap,Ur=new WeakMap,jr=new WeakMap,qr=new WeakMap,Vr=new WeakMap,Gr=new WeakMap,Hr=new WeakMap,Kr=new WeakMap,Xr=new WeakMap,Yr=new WeakSet;class Qr{constructor(e,t,n){O(this,Yr),P(this,"parent",void 0),P(this,"is_pending",!1),F(this,Or,void 0),F(this,Pr,gi?vi:null),F(this,Rr,void 0),F(this,Dr,void 0),F(this,Lr,void 0),F(this,Br,null),F(this,zr,null),F(this,Wr,null),F(this,$r,null),F(this,Ur,null),F(this,jr,0),F(this,qr,0),F(this,Vr,!1),F(this,Gr,new Set),F(this,Hr,new Set),F(this,Kr,null),F(this,Xr,function(e){let t,n=0,i=ko(0);return Oi(i,"createSubscriber version"),()=>{Qo()&&(Us(i),ns((()=>(0===n&&(t=Vs((()=>e((()=>Eo(i)))))),n+=1,()=>{Ki((()=>{var e;n-=1,0===n&&(null===(e=t)||void 0===e||e(),t=void 0,Eo(i))}))}))))}}((()=>(C(Kr,this,ko(M(jr,this))),Oi(M(Kr,this),"$effect.pending()"),()=>{C(Kr,this,null)})))),C(Or,this,e),C(Rr,this,t),C(Dr,this,n),this.parent=_s.b,this.is_pending=!!M(Rr,this).pending,C(Lr,this,rs((()=>{if(_s.b=this,gi){const e=M(Pr,this);ki();e.nodeType===ui&&e.data===pn?A(Yr,this,Zr).call(this):(A(Yr,this,Jr).call(this),0===M(qr,this)&&(this.is_pending=!1))}else{var e=A(Yr,this,eo).call(this);try{C(Br,this,ss((()=>n(e))))}catch(e){this.error(e)}M(qr,this)>0?A(Yr,this,no).call(this):this.is_pending=!1}return()=>{var e;null===(e=M(Ur,this))||void 0===e||e.remove()}}),Cr)),gi&&C(Or,this,vi)}defer_effect(e){rr(e,M(Gr,this),M(Hr,this))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!M(Rr,this).pending}update_pending_count(e){A(Yr,this,io).call(this,e),C(jr,this,M(jr,this)+e),M(Kr,this)&&To(M(Kr,this),M(jr,this))}get_effect_pending(){return M(Xr,this).call(this),Us(M(Kr,this))}error(e){var t=M(Rr,this).onerror;let n=M(Rr,this).failed;if(M(Vr,this)||!t&&!n)throw e;M(Br,this)&&(cs(M(Br,this)),C(Br,this,null)),M(zr,this)&&(cs(M(zr,this)),C(zr,this,null)),M(Wr,this)&&(cs(M(Wr,this)),C(Wr,this,null)),gi&&(bi(M(Pr,this)),function(e=1){if(gi){for(var t=e,n=vi;t--;)n=$o(n);vi=n}}(),bi(wi()));var i=!1,r=!1;const o=()=>{i?console.warn("%c[svelte] svelte_boundary_reset_noop\n%cA `<svelte:boundary>` `reset` function only resets the boundary the first time it is called\nhttps://svelte.dev/e/svelte_boundary_reset_noop",hi,fi):(i=!0,r&&function(){{const e=new Error("svelte_boundary_reset_onerror\nA `<svelte:boundary>` `reset` function cannot be called while an error is still being handled\nhttps://svelte.dev/e/svelte_boundary_reset_onerror");throw e.name="Svelte error",e}}(),kr.ensure(),C(jr,this,0),null!==M(Wr,this)&&ds(M(Wr,this),(()=>{C(Wr,this,null)})),this.is_pending=this.has_pending_snippet(),C(Br,this,A(Yr,this,to).call(this,(()=>(C(Vr,this,!1),ss((()=>M(Dr,this).call(this,M(Or,this)))))))),M(qr,this)>0?A(Yr,this,no).call(this):this.is_pending=!1)};var s=ks;try{ws(null),r=!0,null==t||t(e,o),r=!1}catch(e){Ji(e,M(Lr,this)&&M(Lr,this).parent)}finally{ws(s)}n&&Ki((()=>{C(Wr,this,A(Yr,this,to).call(this,(()=>{kr.ensure(),C(Vr,this,!0);try{return ss((()=>{n(M(Or,this),(()=>e),(()=>o))}))}catch(e){return Ji(e,M(Lr,this).parent),null}finally{C(Vr,this,!1)}})))}))}}function Jr(){try{C(Br,this,ss((()=>M(Dr,this).call(this,M(Or,this)))))}catch(e){this.error(e)}}function Zr(){const e=M(Rr,this).pending;e&&(C(zr,this,ss((()=>e(M(Or,this))))),kr.enqueue((()=>{var e=A(Yr,this,eo).call(this);C(Br,this,A(Yr,this,to).call(this,(()=>(kr.ensure(),ss((()=>M(Dr,this).call(this,e))))))),M(qr,this)>0?A(Yr,this,no).call(this):(ds(M(zr,this),(()=>{C(zr,this,null)})),this.is_pending=!1)})))}function eo(){var e=M(Or,this);return this.is_pending&&(C(Ur,this,zo()),M(Or,this).before(M(Ur,this)),e=M(Ur,this)),e}function to(e){var t=_s,n=ks,i=Di;Ts(M(Lr,this)),ws(M(Lr,this)),Li(M(Lr,this).ctx);try{return e()}catch(e){return Qi(e),null}finally{Ts(t),ws(n),Li(i)}}function no(){const e=M(Rr,this).pending;null!==M(Br,this)&&(C($r,this,document.createDocumentFragment()),M($r,this).append(M(Ur,this)),ms(M(Br,this),M($r,this))),null===M(zr,this)&&C(zr,this,ss((()=>e(M(Or,this)))))}function io(e){var t;if(this.has_pending_snippet()){if(C(qr,this,M(qr,this)+e),0===M(qr,this)){this.is_pending=!1;for(const e of M(Gr,this))tr(e,jn),Fr(e);for(const e of M(Hr,this))tr(e,qn),Fr(e);M(Gr,this).clear(),M(Hr,this).clear(),M(zr,this)&&ds(M(zr,this),(()=>{C(zr,this,null)})),M($r,this)&&(M(Or,this).before(M($r,this)),C($r,this,null))}}else this.parent&&A(Yr,t=this.parent,io).call(t,e)}function ro(e,t,n,i){const r=ao;if(0!==n.length||0!==e.length){var o,s,a,l,c,u=sr,d=_s,h=(o=_s,s=ks,a=Di,l=sr,c=Bi,function(e=!0){Ts(o),ws(s),Li(a),e&&(null==l||l.activate()),zi(c)});e.length>0?Promise.all(e).then((()=>{h();try{return f()}finally{null==u||u.deactivate(),oo()}})):f()}else i(t.map(r));function f(){Promise.all(n.map((e=>lo(e)))).then((e=>{h();try{i([...t.map(r),...e])}catch(e){d.f&Gn||Ji(e,d)}null==u||u.deactivate(),oo()})).catch((e=>{Ji(e,d)}))}}function oo(){Ts(null),ws(null),Li(null),zi(null)}const so=new Set;function ao(e){var t=On|jn,n=null!==ks&&ks.f&On?ks:null;null!==_s&&(_s.f|=Qn);return{ctx:Di,deps:null,effects:null,equals:Ti,f:t,fn:e,reactions:null,rv:0,v:gn,wv:0,parent:null!=n?n:_s,ac:null}}function lo(e,t,n){let i=_s;null===i&&function(){{const e=new Error("async_derived_orphan\nCannot create a `$derived(...)` with an `await` expression outside of an effect tree\nhttps://svelte.dev/e/async_derived_orphan");throw e.name="Svelte error",e}}();var r=i.b,o=void 0,s=ko(gn);s.label=t;var a=!ks,l=new Map;return function(e){Yo(ni|Qn,e,!0)}((()=>{var t=Cn();o=t.promise;try{Promise.resolve(e()).then(t.resolve,t.reject).then((()=>{n===sr&&n.committed&&n.deactivate(),oo()}))}catch(e){t.reject(e),oo()}var n=sr;if(a){var i,c=r.is_rendered();r.update_pending_count(1),n.increment(c),null===(i=l.get(n))||void 0===i||i.reject(li),l.delete(n),l.set(n,t)}const u=(e,t=void 0)=>{if(n.activate(),t)t!==li&&(s.f|=ii,To(s,t));else{s.f&ii&&(s.f^=ii),To(s,e);for(const[e,t]of l){if(l.delete(e),e===n)break;t.reject(li)}}a&&(r.update_pending_count(-1),n.decrement(c))};t.promise.then(u,(e=>u(null,e||"unknown")))})),Jo((()=>{for(const e of l.values())e.reject(li)})),s.f|=ni,new Promise((e=>{!function t(n){function i(){n===o?e(s):t(o)}n.then(i,i)}(o)}))}function co(e){const t=ao(e);return Es(t),t}function uo(e){const t=ao(e);return t.equals=Ii,t}function ho(e){var t=e.effects;if(null!==t){e.effects=null;for(var n=0;n<t.length;n+=1)cs(t[n])}}let fo=[];function po(e){var t,n=_s;Ts(function(e){for(var t=e.parent;null!==t;){if(!(t.f&On))return t.f&Gn?null:t;t=t.parent}return null}(e));{let i=vo;yo(new Set);try{fo.includes(e)&&function(){{const e=new Error("derived_references_self\nA derived value cannot reference itself recursively\nhttps://svelte.dev/e/derived_references_self");throw e.name="Svelte error",e}}(),fo.push(e),e.f&=~ei,ho(e),t=Ls(e)}finally{Ts(n),yo(i),fo.pop()}}return t}function mo(e){var t,n,i=po(e);if(!e.equals(i)&&(e.wv=Ps(),(null===(t=sr)||void 0===t||!t.is_fork||null===e.deps)&&(e.v=i,null===e.deps)))return void tr(e,Un);ys||(null!==ar?(Qo()||null!==(n=sr)&&void 0!==n&&n.is_fork)&&ar.set(e,i):nr(e))}let vo=new Set;const go=new Map;function yo(e){vo=e}let bo=!1;function ko(e,t){return{f:0,v:e,reactions:null,equals:Ti,rv:0,wv:0}}function xo(e,t){const n=ko(e);return Es(n),n}function wo(e,t=!1,n=!0){const i=ko(e);return t||(i.equals=Ii),i}function _o(e,t,n=!1){var i;null!==ks&&(!xs||ks.f&Xn)&&ks.f&(On|Ln|ni|Xn)&&(null===(i=Is)||void 0===i||!i.includes(e))&&function(){{const e=new Error("state_unsafe_mutation\nUpdating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\nhttps://svelte.dev/e/state_unsafe_mutation");throw e.name="Svelte error",e}}();let r=n?No(t):t;return Pi(r,e.label),To(e,r)}function To(e,t){if(!e.equals(t)){var n=e.v;ys?go.set(e,t):go.set(e,n),e.v=t;var i=kr.ensure();if(i.capture(e,n),null!==_s){var r,o,s;null!==(r=e.updated)&&void 0!==r||(e.updated=new Map);const t=(null!==(o=null===(s=e.updated.get(""))||void 0===s?void 0:s.count)&&void 0!==o?o:0)+1;if(e.updated.set("",{error:null,count:t}),t>5){const t=Ri("updated at");if(null!==t){let n=e.updated.get(t.stack);n||(n={error:t,count:0},e.updated.set(t.stack,n)),n.count++}}}if(null!==_s&&(e.set_during_effect=!0),e.f&On){const t=e;e.f&jn&&po(t),nr(t)}e.wv=Ps(),So(e,jn),null!==_s&&_s.f&Un&&!(_s.f&(Bn|zn))&&(null===Ns?function(e){Ns=e}([e]):Ns.push(e)),!i.is_fork&&vo.size>0&&!bo&&Io()}return t}function Io(){bo=!1;var e=vs;gs(!0);const t=Array.from(vo);try{for(const e of t)e.f&Un&&tr(e,qn),Rs(e)&&Ws(e)}finally{gs(e)}vo.clear()}function Eo(e){_o(e,e.v+1)}function So(e,t){var n=e.reactions;if(null!==n)for(var i=n.length,r=0;r<i;r++){var o=n[r],s=o.f;if(s&Xn)vo.add(o);else{var a=!(s&jn);if(a&&tr(o,t),s&On){var l,c=o;null===(l=ar)||void 0===l||l.delete(c),s&ei||(s&$n&&(o.f|=ei),So(c,qn))}else a&&(s&Ln&&null!==Sr&&Sr.add(o),Fr(o))}}}const Ao=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/;function No(e){if("object"!=typeof e||null===e||ri in e)return e;const t=Mn(e);if(t!==An&&t!==Nn)return e;var n=new Map,i=wn(e),r=xo(0),o=Cs,s=e=>{if(Cs===o)return e();var t=ks,n=Cs;ws(null),Os(o);var i=e();return ws(t),Os(n),i};i&&(n.set("length",xo(e.length)),e=new Proxy(e,{get(e,t,n){var i=Reflect.get(e,t,n);return Co.has(t)?function(...e){bo=!0;var t=i.apply(this,e);return Io(),t}:i}}));var a="";let l=!1;function c(e){if(!l){l=!0,Oi(r,`${a=e} version`);for(const[e,t]of n)Oi(t,Mo(a,e));l=!1}}return new Proxy(e,{defineProperty(e,t,i){"value"in i&&!1!==i.configurable&&!1!==i.enumerable&&!1!==i.writable||function(){{const e=new Error("state_descriptors_fixed\nProperty descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\nhttps://svelte.dev/e/state_descriptors_fixed");throw e.name="Svelte error",e}}();var r=n.get(t);return void 0===r?r=s((()=>{var e=xo(i.value);return n.set(t,e),"string"==typeof t&&Oi(e,Mo(a,t)),e})):_o(r,i.value,!0),!0},deleteProperty(e,t){var i=n.get(t);if(void 0===i){if(t in e){const e=s((()=>xo(gn)));n.set(t,e),Eo(r),Oi(e,Mo(a,t))}}else _o(i,gn),Eo(r);return!0},get(t,i,r){var o;if(i===ri)return e;if(i===ai)return c;var l=n.get(i),u=i in t;if(void 0===l&&(!u||null!==(o=En(t,i))&&void 0!==o&&o.writable)&&(l=s((()=>{var e=xo(No(u?t[i]:gn));return Oi(e,Mo(a,i)),e})),n.set(i,l)),void 0!==l){var d=Us(l);return d===gn?void 0:d}return Reflect.get(t,i,r)},getOwnPropertyDescriptor(e,t){var i=Reflect.getOwnPropertyDescriptor(e,t);if(i&&"value"in i){var r=n.get(t);r&&(i.value=Us(r))}else if(void 0===i){var o=n.get(t),s=null==o?void 0:o.v;if(void 0!==o&&s!==gn)return{enumerable:!0,configurable:!0,value:s,writable:!0}}return i},has(e,t){var i;if(t===ri)return!0;var r=n.get(t),o=void 0!==r&&r.v!==gn||Reflect.has(e,t);if((void 0!==r||null!==_s&&(!o||null!==(i=En(e,t))&&void 0!==i&&i.writable))&&(void 0===r&&(r=s((()=>{var n=xo(o?No(e[t]):gn);return Oi(n,Mo(a,t)),n})),n.set(t,r)),Us(r)===gn))return!1;return o},set(e,t,o,l){var c,u=n.get(t),d=t in e;if(i&&"length"===t)for(var h=o;h<u.v;h+=1){var f=n.get(h+"");void 0!==f?_o(f,gn):h in e&&(f=s((()=>xo(gn))),n.set(h+"",f),Oi(f,Mo(a,h)))}void 0===u?(!d||null!==(c=En(e,t))&&void 0!==c&&c.writable)&&(Oi(u=s((()=>xo(void 0))),Mo(a,t)),_o(u,No(o)),n.set(t,u)):(d=u.v!==gn,_o(u,s((()=>No(o)))));var p=Reflect.getOwnPropertyDescriptor(e,t);if(null!=p&&p.set&&p.set.call(l,o),!d){if(i&&"string"==typeof t){var m=n.get("length"),v=Number(t);Number.isInteger(v)&&v>=m.v&&_o(m,v+1)}Eo(r)}return!0},ownKeys(e){Us(r);var t=Reflect.ownKeys(e).filter((e=>{var t=n.get(e);return void 0===t||t.v!==gn}));for(var[i,o]of n)o.v===gn||i in e||t.push(i);return t},setPrototypeOf(){!function(){{const e=new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw e.name="Svelte error",e}}()}})}function Mo(e,t){var n;return"symbol"==typeof t?`${e}[Symbol(${null!==(n=t.description)&&void 0!==n?n:""})]`:Ao.test(t)?`${e}.${t}`:/^\d+$/.test(t)?`${e}[${t}]`:`${e}['${t}']`}function Fo(e){try{if(null!==e&&"object"==typeof e&&ri in e)return e[ri]}catch{}return e}const Co=new Set(["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"]);function Oo(e,t,n=!0){try{e===t!=(Fo(e)===Fo(t))&&mi(n?"===":"!==")}catch{}return e===t===n}var Po,Ro,Do,Lo;function Bo(){if(void 0===Po){Po=window,Ro=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;Do=En(t,"firstChild").get,Lo=En(t,"nextSibling").get,Fn(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),Fn(n)&&(n.__t=void 0),e.__svelte_meta=null,function(){const e=Array.prototype,t=Array.__svelte_cleanup;t&&t();const{indexOf:n,lastIndexOf:i,includes:r}=e;e.indexOf=function(e,t){const i=n.call(this,e,t);if(-1===i)for(let n=null!=t?t:0;n<this.length;n+=1)if(Fo(this[n])===e){mi("array.indexOf(...)");break}return i},e.lastIndexOf=function(e,t){const n=i.call(this,e,null!=t?t:this.length-1);if(-1===n)for(let n=0;n<=(null!=t?t:this.length-1);n+=1)if(Fo(this[n])===e){mi("array.lastIndexOf(...)");break}return n},e.includes=function(e,t){const n=r.call(this,e,t);if(!n)for(let t=0;t<this.length;t+=1)if(Fo(this[t])===e){mi("array.includes(...)");break}return n},Array.__svelte_cleanup=()=>{e.indexOf=n,e.lastIndexOf=i,e.includes=r}}()}}function zo(e=""){return document.createTextNode(e)}function Wo(e){return Do.call(e)}function $o(e){return Lo.call(e)}function Uo(e,t){if(!gi)return Wo(e);var n=Wo(vi);if(null===n)n=vi.appendChild(zo());else if(t&&n.nodeType!==ci){var i,r=zo();return null===(i=n)||void 0===i||i.before(r),bi(r),r}return bi(n),n}function jo(e,t=!1){var n;if(!gi){var i=Wo(e);return i instanceof Comment&&""===i.data?$o(i):i}if(t&&(null===(n=vi)||void 0===n?void 0:n.nodeType)!==ci){var r,o=zo();return null===(r=vi)||void 0===r||r.before(o),bi(o),o}return vi}function qo(e,t=1,n=!1){var i;let r=gi?vi:e;for(var o;t--;)o=r,r=$o(r);if(!gi)return r;if(n&&(null===(i=r)||void 0===i?void 0:i.nodeType)!==ci){var s,a=zo();if(null===r)null===(s=o)||void 0===s||s.after(a);else r.before(a);return bi(a),a}return bi(r),r}function Vo(e){e.textContent=""}function Go(e,t){if(t){const t=document.body;e.autofocus=!0,Ki((()=>{document.activeElement===t&&e.focus()}))}}let Ho=!1;function Ko(e){var t=ks,n=_s;ws(null),Ts(null);try{return e()}finally{ws(t),Ts(n)}}function Xo(e){null===_s&&(null===ks&&function(e){{const t=new Error(`effect_orphan\n\`${e}\` can only be used inside an effect (e.g. during component initialisation)\nhttps://svelte.dev/e/effect_orphan`);throw t.name="Svelte error",t}}(e),function(){{const e=new Error("effect_in_unowned_derived\nEffect cannot be created inside a `$derived` value that was not itself created inside an effect\nhttps://svelte.dev/e/effect_in_unowned_derived");throw e.name="Svelte error",e}}()),ys&&function(e){{const t=new Error(`effect_in_teardown\n\`${e}\` cannot be used inside an effect cleanup function\nhttps://svelte.dev/e/effect_in_teardown`);throw t.name="Svelte error",t}}(e)}function Yo(e,t,n){for(var i=_s;null!==i&&i.f&Xn;)i=i.parent;null!==i&&i.f&Vn&&(e|=Vn);var r={ctx:Di,deps:null,nodes:null,f:e|jn|$n,first:null,fn:t,last:null,next:null,parent:i,b:i&&i.b,prev:null,teardown:null,wv:0,ac:null};if(r.component_function=Wi,n)try{Ws(r),r.f|=Hn}catch(e){throw cs(r),e}else null!==t&&Fr(r);var o=r;if(!n||null!==o.deps||null!==o.teardown||null!==o.nodes||o.first!==o.last||o.f&Qn||(o=o.first,e&Ln&&e&Kn&&null!==o&&(o.f|=Kn)),null!==o&&(o.parent=i,null!==i&&function(e,t){var n=t.last;null===n?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}(o,i),null!==ks&&ks.f&On&&!(e&zn))){var s,a=ks;(null!==(s=a.effects)&&void 0!==s?s:a.effects=[]).push(o)}return r}function Qo(){return null!==ks&&!xs}function Jo(e){const t=Yo(Rn,null,!1);return tr(t,Un),t.teardown=e,t}function Zo(e){Xo("$effect"),In(e,"name",{value:"$effect"});var t=_s.f;if(!!(ks||!(t&Bn)||t&Hn))return es(e);var n,i=Di;(null!==(n=i.e)&&void 0!==n?n:i.e=[]).push(e)}function es(e){return Yo(Pn|Jn,e,!1)}function ts(e){return Yo(Pn,e,!1)}function ns(e,t=0){return Yo(Rn|t,e,!0)}function is(e,t=[],n=[],i=[]){ro(i,t,n,(t=>{Yo(Rn,(()=>e(...t.map(Us))),!0)}))}function rs(e,t=0){var n=Yo(Ln|t,e,!0);return n.dev_stack=Bi,n}function os(e,t=0){var n=Yo(Dn|t,e,!0);return n.dev_stack=Bi,n}function ss(e){return Yo(Bn|Qn,e,!0)}function as(e){var t=e.teardown;if(null!==t){const e=ys,n=ks;bs(!0),ws(null);try{t.call(null)}finally{bs(e),ws(n)}}}function ls(e,t=!1){var n=e.first;for(e.first=e.last=null;null!==n;){const e=n.ac;null!==e&&Ko((()=>{e.abort(li)}));var i=n.next;n.f&zn?n.parent=null:cs(n,t),n=i}}function cs(e,t=!0){var n=!1;(t||e.f&Yn)&&null!==e.nodes&&null!==e.nodes.end&&(!function(e,t){for(;null!==e;){var n=e===t?null:$o(e);e.remove(),e=n}}(e.nodes.start,e.nodes.end),n=!0),ls(e,t&&!n),zs(e,0),tr(e,Gn);var i=e.nodes&&e.nodes.t;if(null!==i)for(const e of i)e.stop();as(e);var r=e.parent;null!==r&&null!==r.first&&us(e),e.component_function=null,e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=null}function us(e){var t=e.parent,n=e.prev,i=e.next;null!==n&&(n.next=i),null!==i&&(i.prev=n),null!==t&&(t.first===e&&(t.first=i),t.last===e&&(t.last=n))}function ds(e,t,n=!0){var i=[];hs(e,i,!0);var r=()=>{n&&cs(e),t&&t()},o=i.length;if(o>0){var s=()=>--o||r();for(var a of i)a.out(s)}else r()}function hs(e,t,n){if(!(e.f&Vn)){e.f^=Vn;var i=e.nodes&&e.nodes.t;if(null!==i)for(const e of i)(e.is_global||n)&&t.push(e);for(var r=e.first;null!==r;){var o=r.next;hs(r,t,!!(!!(r.f&Kn)||!!(r.f&Bn)&&!!(e.f&Ln))&&n),r=o}}}function fs(e){ps(e,!0)}function ps(e,t){if(e.f&Vn){e.f^=Vn,e.f&Un||(tr(e,jn),Fr(e));for(var n=e.first;null!==n;){var i=n.next;ps(n,!!(!!(n.f&Kn)||!!(n.f&Bn))&&t),n=i}var r=e.nodes&&e.nodes.t;if(null!==r)for(const e of r)(e.is_global||t)&&e.in()}}function ms(e,t){if(e.nodes)for(var n=e.nodes.start,i=e.nodes.end;null!==n;){var r=n===i?null:$o(n);t.append(n),n=r}}let vs=!1;function gs(e){vs=e}let ys=!1;function bs(e){ys=e}let ks=null,xs=!1;function ws(e){ks=e}let _s=null;function Ts(e){_s=e}let Is=null;function Es(e){null!==ks&&(null===Is?Is=[e]:Is.push(e))}let Ss=null,As=0,Ns=null;let Ms=1,Fs=0,Cs=Fs;function Os(e){Cs=e}function Ps(){return++Ms}function Rs(e){var t=e.f;if(t&jn)return!0;if(t&On&&(e.f&=~ei),t&qn){for(var n=e.deps,i=n.length,r=0;r<i;r++){var o=n[r];if(Rs(o)&&mo(o),o.wv>e.wv)return!0}t&$n&&null===ar&&tr(e,Un)}return!1}function Ds(e,t,n=!0){var i,r=e.reactions;if(null!==r&&(null===(i=Is)||void 0===i||!i.includes(e)))for(var o=0;o<r.length;o++){var s=r[o];s.f&On?Ds(s,t,!1):t===s&&(n?tr(s,jn):s.f&Un&&tr(s,qn),Fr(s))}}function Ls(e){var t=Ss,n=As,i=Ns,r=ks,o=Is,s=Di,a=xs,l=Cs,c=e.f;Ss=null,As=0,Ns=null,ks=c&(Bn|zn)?null:e,Is=null,Li(e.ctx),xs=!1,Cs=++Fs,null!==e.ac&&(Ko((()=>{e.ac.abort(li)})),e.ac=null);try{e.f|=ti;var u=(0,e.fn)(),d=e.deps;if(null!==Ss){var h;if(zs(e,As),null!==d&&As>0)for(d.length=As+Ss.length,h=0;h<Ss.length;h++)d[As+h]=Ss[h];else e.deps=d=Ss;if(Qo()&&e.f&$n)for(h=As;h<d.length;h++){var f,p;(null!==(p=(f=d[h]).reactions)&&void 0!==p?p:f.reactions=[]).push(e)}}else null!==d&&As<d.length&&(zs(e,As),d.length=As);if(!(null===Ns||xs||null===d||e.f&(On|qn|jn)))for(h=0;h<Ns.length;h++)Ds(Ns[h],e);return null!==r&&r!==e&&(Fs++,null!==Ns&&(null===i?i=Ns:i.push(...Ns))),e.f&ii&&(e.f^=ii),u}catch(e){return Qi(e)}finally{e.f^=ti,Ss=t,As=n,Ns=i,ks=r,Is=o,Li(s),xs=a,Cs=l}}function Bs(e,t){let n=t.reactions;if(null!==n){var i=_n.call(n,e);if(-1!==i){var r=n.length-1;0===r?n=t.reactions=null:(n[i]=n[r],n.pop())}}if(null===n&&t.f&On&&(null===Ss||!Ss.includes(t))){var o=t;o.f&$n&&(o.f^=$n,o.f&=~ei),nr(o),ho(o),zs(o,0)}}function zs(e,t){var n=e.deps;if(null!==n)for(var i=t;i<n.length;i++)Bs(e,n[i])}function Ws(e){var t=e.f;if(!(t&Gn)){tr(e,Un);var n=_s,i=vs;_s=e,vs=!0;var r,o=Wi;$i(e.component_function);var s=Bi;zi(null!==(r=e.dev_stack)&&void 0!==r?r:Bi);try{t&(Ln|Dn)?function(e){for(var t=e.first;null!==t;){var n=t.next;t.f&Bn||cs(t),t=n}}(e):ls(e),as(e);var a=Ls(e);e.teardown="function"==typeof a?a:null,e.wv=Ms,xn&&Ei&&e.f&jn&&e.deps}finally{vs=i,_s=n,$i(o),zi(s)}}}async function $s(){await Promise.resolve(),function(){var e=dr;dr=!0;try{for(;;){var t;if(Xi(),0===lr.length&&(null===(t=sr)||void 0===t||t.flush(),0===lr.length))return void(cr=null);Ir()}}finally{dr=e}}()}function Us(e){var t,n,i=!!(e.f&On);if(null!==ks&&!xs&&!(null!==_s&&!!(_s.f&Gn)||null!==(n=Is)&&void 0!==n&&n.includes(e))){var r=ks.deps;if(ks.f&ti)e.rv<Fs&&(e.rv=Fs,null===Ss&&null!==r&&r[As]===e?As++:null===Ss?Ss=[e]:Ss.includes(e)||Ss.push(e));else{var o,s;(null!==(s=(o=ks).deps)&&void 0!==s?s:o.deps=[]).push(e);var a=e.reactions;null===a?e.reactions=[ks]:a.includes(ks)||a.push(ks)}}if(so.delete(e),ys&&go.has(e))return go.get(e);if(i){var l=e;if(ys){var c=l.v;return(l.f&Un||null===l.reactions)&&!qs(l)||(c=po(l)),go.set(l,c),c}var u=!(l.f&$n)&&!xs&&null!==ks&&(vs||!!(ks.f&$n)),d=null===l.deps;Rs(l)&&(u&&(l.f|=$n),mo(l)),u&&!d&&js(l)}if(null!==(t=ar)&&void 0!==t&&t.has(e))return ar.get(e);if(e.f&ii)throw e.v;return e.v}function js(e){if(null!==e.deps){e.f|=$n;for(const n of e.deps){var t;(null!==(t=n.reactions)&&void 0!==t?t:n.reactions=[]).push(e),n.f&On&&!(n.f&$n)&&js(n)}}}function qs(e){if(e.v===gn)return!0;if(null===e.deps)return!1;for(const t of e.deps){if(go.has(t))return!0;if(t.f&On&&qs(t))return!0}return!1}function Vs(e){var t=xs;try{return xs=!0,e()}finally{xs=t}}const Gs=new Set,Hs=new Set;function Ks(e,t,n,i={}){function r(e){if(i.capture||Js.call(t,e),!e.cancelBubble)return Ko((()=>null==n?void 0:n.call(this,e)))}return e.startsWith("pointer")||e.startsWith("touch")||"wheel"===e?Ki((()=>{t.addEventListener(e,r,i)})):t.addEventListener(e,r,i),r}function Xs(e,t,n,i,r){var o={capture:i,passive:r},s=Ks(e,t,n,o);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&Jo((()=>{t.removeEventListener(e,s,o)}))}function Ys(e){for(var t=0;t<e.length;t++)Gs.add(e[t]);for(var n of Hs)n(e)}let Qs=null;function Js(e){var t,n=this,i=n.ownerDocument,r=e.type,o=(null===(t=e.composedPath)||void 0===t?void 0:t.call(e))||[],s=o[0]||e.target;Qs=e;var a=0,l=Qs===e&&e.__root;if(l){var c=o.indexOf(l);if(-1!==c&&(n===document||n===window))return void(e.__root=n);var u=o.indexOf(n);if(-1===u)return;c<=u&&(a=c)}if((s=o[a]||e.target)!==n){In(e,"currentTarget",{configurable:!0,get:()=>s||i});var d=ks,h=_s;ws(null),Ts(null);try{for(var f,p=[];null!==s;){var m=s.assignedSlot||s.parentNode||s.host||null;try{var v=s["__"+r];null==v||s.disabled&&e.target!==s||v.call(s,e)}catch(e){f?p.push(e):f=e}if(e.cancelBubble||m===n||null===m)break;s=m}if(f){for(let e of p)queueMicrotask((()=>{throw e}));throw f}}finally{e.__root=n,delete e.currentTarget,ws(d),Ts(h)}}}function Zs(e,t){var n=_s;null===n.nodes&&(n.nodes={start:e,end:t,a:null,t:null})}function ea(e,t){var n,i=!!(1&t),r=!!(2&t),o=!e.startsWith("<!>");return()=>{if(gi)return Zs(vi,null),vi;var t,s;void 0===n&&(t=o?e:"<!>"+e,(s=document.createElement("template")).innerHTML=t.replaceAll("<!>","\x3c!----\x3e"),n=s.content,i||(n=Wo(n)));var a=r||Ro?document.importNode(n,!0):n.cloneNode(!0);i?Zs(Wo(a),a.lastChild):Zs(a,a);return a}}function ta(){if(gi)return Zs(vi,null),vi;var e=document.createDocumentFragment(),t=document.createComment(""),n=zo();return e.append(t,n),Zs(t,n),e}function na(e,t){if(gi){var n=_s;return n.f&Hn&&null!==n.nodes.end||(n.nodes.end=vi),void ki()}null!==e&&e.before(t)}function ia(e){return e.endsWith("capture")&&"gotpointercapture"!==e&&"lostpointercapture"!==e}const ra=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function oa(e){return ra.includes(e)}const sa={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject",novalidate:"noValidate",allowfullscreen:"allowFullscreen",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback"};function aa(e){var t;return e=e.toLowerCase(),null!==(t=sa[e])&&void 0!==t?t:e}const la=["touchstart","touchmove"];function ca(e,t){var n,i=null==t?"":"object"==typeof t?t+"":t;i!==(null!==(n=e.__t)&&void 0!==n?n:e.__t=e.nodeValue)&&(e.__t=i,e.nodeValue=i+"")}function ua(e,t){return fa(e,t)}function da(e,t){var n;Bo(),t.intro=null!==(n=t.intro)&&void 0!==n&&n;const i=t.target,r=gi,o=vi;try{for(var s=Wo(i);s&&(s.nodeType!==ui||s.data!==fn);)s=$o(s);if(!s)throw vn;yi(!0),bi(s);const n=fa(e,{...t,anchor:s});return yi(!1),n}catch(n){if(n instanceof Error&&n.message.split("\n").some((e=>e.startsWith("https://svelte.dev/e/"))))throw n;return n!==vn&&console.warn("Failed to hydrate: ",n),!1===t.recover&&function(){{const e=new Error("hydration_failed\nFailed to hydrate the application\nhttps://svelte.dev/e/hydration_failed");throw e.name="Svelte error",e}}(),Bo(),Vo(i),yi(!1),ua(e,t)}finally{yi(r),bi(o)}}const ha=new Map;function fa(e,{target:t,anchor:n,props:i={},events:r,context:o,intro:s=!0}){Bo();var a=new Set,l=e=>{for(var n=0;n<e.length;n++){var i=e[n];if(!a.has(i)){a.add(i);var r=(s=i,la.includes(s));t.addEventListener(i,Js,{passive:r});var o=ha.get(i);void 0===o?(document.addEventListener(i,Js,{passive:r}),ha.set(i,1)):ha.set(i,o+1)}}var s};l(Tn(Gs)),Hs.add(l);var c=void 0,u=function(e){kr.ensure();const t=Yo(zn|Qn,e,!0);return(e={})=>new Promise((n=>{e.outro?ds(t,(()=>{cs(t),n(void 0)})):(cs(t),n(void 0))}))}((()=>{var s=null!=n?n:t.appendChild(zo());return function(e,t,n){new Qr(e,t,n)}(s,{pending:()=>{}},(t=>{o&&(ji({}),Di.c=o);if(r&&(i.$$events=r),gi&&Zs(t,null),c=e(t,i)||{},gi&&(_s.nodes.end=vi,null===vi||vi.nodeType!==ui||vi.data!==mn))throw pi(),vn;o&&qi()})),()=>{for(var e of a){t.removeEventListener(e,Js);var i=ha.get(e);0==--i?(document.removeEventListener(e,Js),ha.delete(e)):ha.set(e,i)}var r;(Hs.delete(l),s!==n)&&(null===(r=s.parentNode)||void 0===r||r.removeChild(s))}}));return pa.set(c,u),c}let pa=new WeakMap;function ma(e,t){const n=pa.get(e);return n?(pa.delete(e),n(t)):(ri in e?console.warn("%c[svelte] state_proxy_unmount\n%cTried to unmount a state proxy, rather than a component\nhttps://svelte.dev/e/state_proxy_unmount",hi,fi):console.warn("%c[svelte] lifecycle_double_unmount\n%cTried to unmount a component that was not mounted\nhttps://svelte.dev/e/lifecycle_double_unmount",hi,fi),Promise.resolve())}class va{anchor;#e=new Map;#t=new Map;#n=new Map;#i=new Set;#r=!0;constructor(e,t=!0){this.anchor=e,this.#r=t}#o=()=>{var e=sr;if(this.#e.has(e)){var t=this.#e.get(e),n=this.#t.get(t);if(n)fs(n),this.#i.delete(t);else{var i=this.#n.get(t);i&&(this.#t.set(t,i.effect),this.#n.delete(t),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),n=i.effect)}for(const[t,n]of this.#e){if(this.#e.delete(t),t===e)break;const i=this.#n.get(n);i&&(cs(i.effect),this.#n.delete(n))}for(const[e,i]of this.#t){if(e===t||this.#i.has(e))continue;const r=()=>{if(Array.from(this.#e.values()).includes(e)){var t=document.createDocumentFragment();ms(i,t),t.append(zo()),this.#n.set(e,{effect:i,fragment:t})}else cs(i);this.#i.delete(e),this.#t.delete(e)};this.#r||!n?(this.#i.add(e),ds(i,r,!1)):r()}}};#s=e=>{this.#e.delete(e);const t=Array.from(this.#e.values());for(const[e,n]of this.#n)t.includes(e)||(cs(n.effect),this.#n.delete(e))};ensure(e,t){var n=sr;!t||this.#t.has(e)||this.#n.has(e)||this.#t.set(e,ss((()=>t(this.anchor)))),this.#e.set(n,e),gi&&(this.anchor=vi),this.#o()}}{let e=function(e){if(!(e in globalThis)){let t;Object.defineProperty(globalThis,e,{configurable:!0,get:()=>{if(void 0!==t)return t;!function(e){{const t=new Error(`rune_outside_svelte\nThe \`${e}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files\nhttps://svelte.dev/e/rune_outside_svelte`);throw t.name="Svelte error",t}}(e)},set:e=>{t=e}})}};e("$state"),e("$effect"),e("$derived"),e("$inspect"),e("$props"),e("$bindable")}var ga,ya=new Map;function ba(e,t,n=!1){gi&&ki();var i=new va(e);function r(t,n){if(gi){if(t===(_i(e)===pn)){var r=wi();return bi(r),i.anchor=r,yi(!1),i.ensure(t,n),void yi(!0)}}i.ensure(t,n)}rs((()=>{var e=!1;t(((t,n=!0)=>{e=!0,r(n,t)})),e||r(!1,null)}),n?Kn:0)}function ka(e,t){return t}function xa(e,t=!0){for(var n=0;n<e.length;n++)cs(e[n],t)}function wa(e,t,n,i,r,o=null){var s=e,a=new Map;if(!!(t&sn)){var l=e;s=gi?bi(Wo(l)):l.appendChild(zo())}gi&&ki();var c,u=null,d=uo((()=>{var e=n();return wn(e)?e:null==e?[]:Tn(e)})),h=!0;function f(){m.fallback=u,function(e,t,n,i,r){var o,s,a,l,c,u=!!(i&an),d=t.length,h=e.items,f=e.effect.first,p=null,m=[],v=[];if(u)for(c=0;c<d;c+=1){var g,y;if(a=r(t[c],c),!((l=h.get(a).e).f&Zn))null===(g=l.nodes)||void 0===g||null===(g=g.a)||void 0===g||g.measure(),(null!==(y=s)&&void 0!==y?y:s=new Set).add(l)}for(c=0;c<d;c+=1){if(a=r(t[c],c),l=h.get(a).e,null!==e.outrogroups)for(const t of e.outrogroups)t.pending.delete(l),t.done.delete(l);if(l.f&Zn){if(l.f^=Zn,l!==f){var b=p?p.next:f;l===e.effect.last&&(e.effect.last=l.prev),l.prev&&(l.prev.next=l.next),l.next&&(l.next.prev=l.prev),Ia(e,p,l),Ia(e,l,b),Ta(l,b,n),m=[],v=[],f=(p=l).next;continue}Ta(l,null,n)}var k,x;if(l.f&Vn)if(fs(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<v.length){var w,_=v[0];p=_.prev;var T=m[0],I=m[m.length-1];for(w=0;w<m.length;w+=1)Ta(m[w],_,n);for(w=0;w<v.length;w+=1)o.delete(v[w]);Ia(e,T.prev,I.next),Ia(e,p,T),Ia(e,I,_),f=_,p=I,c-=1,m=[],v=[]}else o.delete(l),Ta(l,f,n),Ia(e,l.prev,l.next),Ia(e,l,null===p?e.effect.first:p.next),Ia(e,p,l),p=l;continue}for(m=[],v=[];null!==f&&f!==l;){var E;(null!==(E=o)&&void 0!==E?E:o=new Set).add(f),v.push(f),f=f.next}if(null===f)continue}l.f&Zn||m.push(l),p=l,f=l.next}if(null!==e.outrogroups){for(const t of e.outrogroups){var S;if(0===t.pending.size)xa(Tn(t.done)),null===(S=e.outrogroups)||void 0===S||S.delete(t)}0===e.outrogroups.size&&(e.outrogroups=null)}if(null!==f||void 0!==o){var A=[];if(void 0!==o)for(l of o)l.f&Vn||A.push(l);for(;null!==f;)f.f&Vn||f===e.fallback||A.push(f),f=f.next;var N=A.length;if(N>0){var M=i&sn&&0===d?n:null;if(u){for(c=0;c<N;c+=1){var F;null===(F=A[c].nodes)||void 0===F||null===(F=F.a)||void 0===F||F.measure()}for(c=0;c<N;c+=1){var C;null===(C=A[c].nodes)||void 0===C||null===(C=C.a)||void 0===C||C.fix()}}!function(e,t,n){for(var i,r=t.length,o=t.length,s=0;s<r;s++){let n=t[s];ds(n,(()=>{if(i){if(i.pending.delete(n),i.done.add(n),0===i.pending.size){var t=e.outrogroups;xa(Tn(i.done)),t.delete(i),0===t.size&&(e.outrogroups=null)}}else o-=1}),!1)}if(0===o){var a=null!==n;if(a){var l=n,c=l.parentNode;Vo(c),c.append(l),e.items.clear()}xa(t,!a)}else{var u;i={pending:new Set(t),done:new Set},(null!==(u=e.outrogroups)&&void 0!==u?u:e.outrogroups=new Set).add(i)}}(e,A,M)}}u&&Ki((()=>{if(void 0!==s)for(l of s){var e;null===(e=l.nodes)||void 0===e||null===(e=e.a)||void 0===e||e.apply()}}))}(m,c,s,t,i),null!==u&&(0===c.length?u.f&Zn?(u.f^=Zn,Ta(u,null,s)):fs(u):ds(u,(()=>{u=null})))}var p=rs((()=>{var e=(c=Us(d)).length;let l=!1;gi&&(_i(s)===pn!==(0===e)&&(bi(s=wi()),yi(!1),l=!0));for(var p=new Set,m=0;m<e;m+=1){gi&&vi.nodeType===ui&&vi.data===mn&&(s=vi,l=!0,yi(!1));var v,g=c[m],y=i(g,m),b=h?null:a.get(y);if(b)b.v&&To(b.v,g),b.i&&To(b.i,m);else b=_a(a,h?s:null!==(v=ga)&&void 0!==v?v:ga=zo(),g,y,m,r,t,n),h||(b.e.f|=Zn),a.set(y,b);p.add(y)}0===e&&o&&!u&&(h?u=ss((()=>o(s))):(u=ss((()=>{var e;return o(null!==(e=ga)&&void 0!==e?e:ga=zo())}))).f|=Zn),gi&&e>0&&bi(wi()),h||f(),l&&yi(!0),Us(d)})),m={effect:p,items:a,outrogroups:null,fallback:u};h=!1,gi&&(s=vi)}function _a(e,t,n,i,r,o,s,a){var l=s&rn?s&ln?ko(n):wo(n,!1,!1):null,c=s&on?ko(r):null;return l&&(l.trace=()=>{var e;a()[null!==(e=null==c?void 0:c.v)&&void 0!==e?e:r]}),{v:l,i:c,e:ss((()=>(o(t,null!=l?l:n,null!=c?c:r,a),()=>{e.delete(i)})))}}function Ta(e,t,n){if(e.nodes)for(var i=e.nodes.start,r=e.nodes.end,o=!t||t.f&Zn?n:t.nodes.start;null!==i;){var s=$o(i);if(o.before(i),i===r)return;i=s}}function Ia(e,t,n){null===t?e.effect.first=n:t.next=n,null===n?e.effect.last=t:n.prev=t}function Ea(e,t){ts((()=>{var n,i=e.getRootNode(),r=i.host?i:null!==(n=i.head)&&void 0!==n?n:i.ownerDocument.head;if(!r.querySelector("#"+t.hash)){const e=document.createElement("style");e.id=t.hash,e.textContent=t.code,r.appendChild(e),function(e,t){var n=ya.get(e);n||(n=new Set,ya.set(e,n)),n.add(t)}(t.hash,e)}}))}function Sa(e,t){var n,i=void 0;os((()=>{i!==(i=t())&&(n&&(cs(n),n=null),i&&(n=ss((()=>{ts((()=>i(e)))}))))}))}function Aa(e){var t,n,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=Aa(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function Na(e){return"object"==typeof e?function(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Aa(e))&&(i&&(i+=" "),i+=t);return i}(e):null!=e?e:""}const Ma=[..." \t\n\r\f \v\ufeff"];function Fa(e,t=!1){var n=t?" !important;":";",i="";for(var r in e){var o=e[r];null!=o&&""!==o&&(i+=" "+r+": "+o+n)}return i}function Ca(e){return"-"!==e[0]||"-"!==e[1]?e.toLowerCase():e}function Oa(e,t,n,i,r,o){var s=e.__className;if(gi||s!==n||void 0===s){var a=function(e,t,n){var i=null==e?"":""+e;if(t&&(i=i?i+" "+t:t),n)for(var r in n)if(n[r])i=i?i+" "+r:r;else if(i.length)for(var o=r.length,s=0;(s=i.indexOf(r,s))>=0;){var a=s+o;0!==s&&!Ma.includes(i[s-1])||a!==i.length&&!Ma.includes(i[a])?s=a:i=(0===s?"":i.substring(0,s))+i.substring(a+1)}return""===i?null:i}(n,i,o);gi&&a===e.getAttribute("class")||(null==a?e.removeAttribute("class"):t?e.className=a:e.setAttribute("class",a)),e.__className=n}else if(o&&r!==o)for(var l in o){var c=!!o[l];null!=r&&c===!!r[l]||e.classList.toggle(l,c)}return o}function Pa(e,t={},n,i){for(var r in n){var o=n[r];t[r]!==o&&(null==n[r]?e.style.removeProperty(r):e.style.setProperty(r,o,i))}}function Ra(e,t,n,i){var r=e.__style;if(gi||r!==t){var o=function(e,t){if(t){var n,i,r="";if(Array.isArray(t)?(n=t[0],i=t[1]):n=t,e){e=String(e).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var o=!1,s=0,a=!1,l=[];n&&l.push(...Object.keys(n).map(Ca)),i&&l.push(...Object.keys(i).map(Ca));var c=0,u=-1;const t=e.length;for(var d=0;d<t;d++){var h=e[d];if(a?"/"===h&&"*"===e[d-1]&&(a=!1):o?o===h&&(o=!1):"/"===h&&"*"===e[d+1]?a=!0:'"'===h||"'"===h?o=h:"("===h?s++:")"===h&&s--,!a&&!1===o&&0===s)if(":"===h&&-1===u)u=d;else if(";"===h||d===t-1){if(-1!==u){var f=Ca(e.substring(c,u).trim());l.includes(f)||(";"!==h&&d++,r+=" "+e.substring(c,d).trim()+";")}c=d+1,u=-1}}}return n&&(r+=Fa(n)),i&&(r+=Fa(i,!0)),""===(r=r.trim())?null:r}return null==e?null:String(e)}(t,i);gi&&o===e.getAttribute("style")||(null==o?e.removeAttribute("style"):e.style.cssText=o),e.__style=t}else i&&(Array.isArray(i)?(Pa(e,null==n?void 0:n[0],i[0]),Pa(e,null==n?void 0:n[1],i[1],"important")):Pa(e,n,i));return i}function Da(e,t,n=!1){if(e.multiple){if(null==t)return;if(!wn(t))return void console.warn("%c[svelte] select_multiple_invalid_value\n%cThe `value` property of a `<select multiple>` element should be an array, but it received a non-array value. The selection will be kept as is.\nhttps://svelte.dev/e/select_multiple_invalid_value",hi,fi);for(var i of e.options)i.selected=t.includes(La(i))}else{for(i of e.options){var r=La(i);if(o=r,s=t,Object.is(Fo(o),Fo(s)))return void(i.selected=!0)}var o,s;n&&void 0===t||(e.selectedIndex=-1)}}function La(e){return"__value"in e?e.__value:e.value}const Ba=Symbol("class"),za=Symbol("style"),Wa=Symbol("is custom element"),$a=Symbol("is html");function Ua(e){if(gi){var t=!1,n=()=>{if(!t){if(t=!0,e.hasAttribute("value")){var n=e.value;qa(e,"value",null),e.value=n}if(e.hasAttribute("checked")){var i=e.checked;qa(e,"checked",null),e.checked=i}}};e.__on_r=n,Ki(n),Ho||(Ho=!0,document.addEventListener("reset",(e=>{Promise.resolve().then((()=>{if(!e.defaultPrevented)for(const n of e.target.elements){var t;null===(t=n.__on_r)||void 0===t||t.call(n)}}))}),{capture:!0}))}}function ja(e,t){t?e.hasAttribute("selected")||e.setAttribute("selected",""):e.removeAttribute("selected")}function qa(e,t,n,i){var r=Ga(e);gi&&(r[t]=e.getAttribute(t),"src"===t||"srcset"===t||"href"===t&&"LINK"===e.nodeName)?i||function(e,t,n){var i;if("srcset"===t&&function(e,t){var n=Ya(e.srcset),i=Ya(t);return i.length===n.length&&i.every((([e,t],i)=>t===n[i][1]&&(Xa(n[i][0],e)||Xa(e,n[i][0]))))}(e,n))return;if(Xa(null!==(i=e.getAttribute(t))&&void 0!==i?i:"",n))return;!function(e,t,n){console.warn(`%c[svelte] hydration_attribute_changed\n%cThe \`${e}\` attribute on \`${t}\` changed its value between server and client renders. The client value, \`${n}\`, will be ignored in favour of the server value\nhttps://svelte.dev/e/hydration_attribute_changed`,hi,fi)}(t,e.outerHTML.replace(e.innerHTML,e.innerHTML&&"..."),String(n))}(e,t,null!=n?n:""):r[t]!==(r[t]=n)&&("loading"===t&&(e[si]=n),null==n?e.removeAttribute(t):"string"!=typeof n&&Ka(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function Va(e,t,n=[],i=[],r=[],o,s=!1,a=!1){ro(r,n,i,(n=>{var i=void 0,r={},l="SELECT"===e.nodeName,c=!1;if(os((()=>{var u=t(...n.map(Us)),d=function(e,t,n,i,r=!1,o=!1){if(gi&&r&&"INPUT"===e.tagName){var s=e;("checkbox"===s.type?"defaultChecked":"defaultValue")in n||Ua(s)}var a=Ga(e),l=a[Wa],c=!a[$a];let u=gi&&l;u&&yi(!1);var d,h=t||{},f="OPTION"===e.tagName;for(var p in t)p in n||(n[p]=null);n.class?n.class=Na(n.class):n.class=null,n[za]&&(null!==(d=n.style)&&void 0!==d||(n.style=null));var m=Ka(e);for(const r in n){let s=n[r];if(f&&"value"===r&&null==s)e.value=e.__value="",h[r]=s;else if("class"!==r)if("style"!==r){var v=h[r];if(s!==v||void 0===s&&e.hasAttribute(r)){h[r]=s;var g=r[0]+r[1];if("$$"!==g)if("on"===g){const t={},n="$$"+r;let i=r.slice(2);var y=oa(i);if(ia(i)&&(i=i.slice(0,-7),t.capture=!0),!y&&v){if(null!=s)continue;e.removeEventListener(i,h[n],t),h[n]=null}if(null!=s)if(y)e[`__${i}`]=s,Ys([i]);else{let o=function(e){h[r].call(this,e)};h[n]=Ks(i,e,o,t)}else y&&(e[`__${i}`]=void 0)}else if("style"===r)qa(e,r,s);else if("autofocus"===r)Go(e,Boolean(s));else if(l||"__value"!==r&&("value"!==r||null==s))if("selected"===r&&f)ja(e,s);else{var b=r;c||(b=aa(b));var k="defaultValue"===b||"defaultChecked"===b;if(null!=s||l||k)k||m.includes(b)&&(l||"string"!=typeof s)?(e[b]=s,b in a&&(a[b]=gn)):"function"!=typeof s&&qa(e,b,s,o);else if(a[r]=null,"value"===b||"checked"===b){let n=e;const i=void 0===t;if("value"===b){let e=n.defaultValue;n.removeAttribute(b),n.defaultValue=e,n.value=n.__value=i?e:null}else{let e=n.defaultChecked;n.removeAttribute(b),n.defaultChecked=e,n.checked=!!i&&e}}else e.removeAttribute(r)}else e.value=e.__value=s}}else Ra(e,s,null==t?void 0:t[za],n[za]),h[r]=s,h[za]=n[za];else Oa(e,"http://www.w3.org/1999/xhtml"===e.namespaceURI,s,i,null==t?void 0:t[Ba],n[Ba]),h[r]=s,h[Ba]=n[Ba]}return u&&yi(!0),h}(e,i,u,o,s,a);c&&l&&"value"in u&&Da(e,u.value);for(let e of Object.getOwnPropertySymbols(r))u[e]||cs(r[e]);for(let t of Object.getOwnPropertySymbols(u)){var h=u[t];t.description!==kn||i&&h===i[t]||(r[t]&&cs(r[t]),r[t]=ss((()=>Sa(e,(()=>h))))),d[t]=h}i=d})),l){var u=e;ts((()=>{Da(u,i.value,!0),function(e){var t=new MutationObserver((()=>{Da(e,e.__value)}));t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),Jo((()=>{t.disconnect()}))}(u)}))}c=!0}))}function Ga(e){var t;return null!==(t=e.__attributes)&&void 0!==t?t:e.__attributes={[Wa]:e.nodeName.includes("-"),[$a]:e.namespaceURI===bn}}var Ha=new Map;function Ka(e){var t,n=e.getAttribute("is")||e.nodeName,i=Ha.get(n);if(i)return i;Ha.set(n,i=[]);for(var r=e,o=Element.prototype;o!==r;){for(var s in t=Sn(r))t[s].set&&i.push(s);r=Mn(r)}return i}function Xa(e,t){return e===t||new URL(e,document.baseURI).href===new URL(t,document.baseURI).href}function Ya(e){return e.split(",").map((e=>e.trim().split(" ").filter(Boolean)))}function Qa(e,t){return e===t||(null==e?void 0:e[ri])===t}function Ja(e={},t,n,i){return ts((()=>{var i,r;return ns((()=>{i=r,r=[],Vs((()=>{e!==n(...r)&&(t(e,...r),i&&Qa(n(...i),e)&&t(null,...i))}))})),()=>{Ki((()=>{r&&Qa(n(...r),e)&&t(null,...r)}))}})),e}let Za=!1;function el(e,t,n,i){var r,o,s=!!(n&dn),a=!!(n&hn),l=i,c=!0,u=()=>(c&&(c=!1,l=a?Vs(i):i),l);if(s){var d,h,f=ri in e||oi in e;r=null!==(d=null===(h=En(e,t))||void 0===h?void 0:h.set)&&void 0!==d?d:f&&t in e?n=>e[t]=n:void 0}var p,m=!1;if(s?[o,m]=function(e){var t=Za;try{return Za=!1,[e(),Za]}finally{Za=t}}((()=>e[t])):o=e[t],void 0===o&&void 0!==i&&(o=u(),r&&(!function(e){{const t=new Error(`props_invalid_value\nCannot do \`bind:${e}={undefined}\` when \`${e}\` has a fallback value\nhttps://svelte.dev/e/props_invalid_value`);throw t.name="Svelte error",t}}(t),r(o))),p=()=>{var n=e[t];return void 0===n?u():(c=!0,n)},!(n&un))return p;if(r){var v=e.$$legacy;return function(e,t){return arguments.length>0?((!t||v||m)&&r(t?p():e),e):p()}}var g=!1,y=(n&cn?ao:uo)((()=>(g=!1,p())));y.label=t,s&&Us(y);var b=_s;return function(e,t){if(arguments.length>0){const n=t?Us(y):s?No(e):e;return _o(y,n),g=!0,void 0!==l&&(l=n),e}return ys&&g||b.f&Gn?y.v:Us(y)}}function tl(e,...t){return Vs((()=>{try{let n=!1;const i=[];for(const e of t)e&&"object"==typeof e&&ri in e?(i.push(Fi(e,!0)),n=!0):i.push(e);n&&(!function(e){console.warn(`%c[svelte] console_log_state\n%cYour \`console.${e}\` contained \`$state\` proxies. Consider using \`$inspect(...)\` or \`$state.snapshot(...)\` instead\nhttps://svelte.dev/e/console_log_state`,hi,fi)}(e),console.log("%c[snapshot]","color: grey",...i))}catch{}})),t}var nl,il,rl,ol;"undefined"!=typeof window&&(null!==(il=(nl=null!==(ol=(rl=window).__svelte)&&void 0!==ol?ol:rl.__svelte={}).v)&&void 0!==il?il:nl.v=new Set).add("5");function sl(e,{include:t,exclude:n}={}){const i=e=>{const i=t=>"string"==typeof t?e===t:t.test(e);return t?t.some(i):!n||!n.some(i)};for(const[t,n]of(e=>{const t=new Set;do{for(const n of Reflect.ownKeys(e))t.add([e,n])}while((e=Reflect.getPrototypeOf(e))&&e!==Object.prototype);return t})(e.constructor.prototype)){if("constructor"===n||!i(n))continue;const r=Reflect.getOwnPropertyDescriptor(t,n);r&&"function"==typeof r.value&&(e[n]=e[n].bind(e))}return e}function al(e,t){e.getNodesAtTime(0)[0].once("nodestart",t)}class ll{constructor({position:e,galleryState:t,config:n}){this.config=n,this.position=e,this.galleryState=t,this.name=n.name;const{variantId:i,itemIndex:r,moduleIndex:o}=e;this.id=`${n.itemType}_${i}_${r}_${o}`,sl(this)}#a=Oi(xo(No({})),"BaseModule.#state");#l=Oi(xo(null),"BaseModule.#cover");#c=Oi(xo(!1),"BaseModule.#showCover");#u=Oi(xo(null),"BaseModule.#Component");id;player;position;config;timeline;moduleEndListener;hasDuration=!1;coverAssets=[];get state(){return Us(this.#a)}set state(e){_o(this.#a,e,!0)}get cover(){return Us(this.#l)}set cover(e){_o(this.#l,e)}get showCover(){return Us(this.#c)}set showCover(e){_o(this.#c,e,!0)}get Component(){return Us(this.#u)}set Component(e){_o(this.#u,e)}emitModuleEnd(){var e;null===(e=this.moduleEndListener)||void 0===e||e.call(this)}start(e){this.player=e}setPosition(){this.galleryState.playingModulePosition=this.position}play(){al(this.timeline,(()=>{this.setPosition()})),this.player.switchTimeline(this.timeline)}get duration(){return this.hasDuration?this.timeline.placements.reduce(((e,t)=>e+this.player.getNode(t.nodeId).duration),0):0}}function cl(e,t,n){var i,r,o;const s=(null==t||null===(i=t.entity)||void 0===i?void 0:i.entityId)||(null==t?void 0:t.assetId),a=null!==(r=null==t||null===(o=t.entity)||void 0===o?void 0:o.entityRevision)&&void 0!==r?r:null==t?void 0:t.assetRevision;return n.addNode({id:e,manifestRef:{type:"assets-delivery-service",assetId:s,assetRevision:a,availableEncodeProfiles:t.availableEncodeProfiles}})}var ul=ea('<h3 class="text-box-title svelte-17x2i38"> </h3>'),dl=ea('<span class="text-box-title svelte-17x2i38"> </span>'),hl=ea('<span class="text-box-description minimized-description svelte-17x2i38"> </span>'),fl=ea('<span class="read-more-cta svelte-17x2i38" aria-hidden="true">Read more</span>'),pl=ea('<button class="expand-description-button svelte-17x2i38" aria-expanded="false" aria-controls="expanded-text-content" aria-label="Expand feature description"><!> <!></button>'),ml=ea('<button aria-expanded="true" aria-label="Collapse feature description" class="svelte-17x2i38">Read less</button>'),vl=ea('<section aria-label="Feature description" aria-live="polite"><div class="text-wrapper svelte-17x2i38"><div class="expanded-text-content svelte-17x2i38"><!> <p class="text-box-description svelte-17x2i38"> </p></div> <!></div> <!></section>');const gl={hash:"svelte-17x2i38",code:".step-description-container.svelte-17x2i38 {width:100%;position:absolute;bottom:0;display:flex;justify-content:space-between;gap:8px;box-sizing:border-box;font-size:12px;font-weight:400;font-style:normal;line-height:16px;letter-spacing:0px;overflow:hidden;pointer-events:none;background:linear-gradient(\n rgba(255, 255, 255, 0) 0%,\n rgba(255, 255, 255, 0.9) 27.79%,\n rgba(255, 255, 255, 0.95) 100%\n );&.expanded {flex-direction:column;justify-content:flex-start;}&:not(.expanded) {button:where(.svelte-17x2i38) {line-height:16px;}}}.expanded-text-content.svelte-17x2i38:not([hidden]) {display:flex;flex-direction:column;gap:8px;}button.svelte-17x2i38 {background:none;border:none;padding:0;cursor:pointer;line-height:18px;gap:8px;letter-spacing:0%;color:#014FD3;font-size:12px;font-weight:500;flex-shrink:0;text-align:left;font-family:inherit;pointer-events:auto;}h3.svelte-17x2i38, p.svelte-17x2i38, span.svelte-17x2i38 {color:#030303;}.text-wrapper.svelte-17x2i38 {width:100%;}.text-box-title.svelte-17x2i38 {margin:0;font-weight:500;font-size:12px;}.text-box-description.svelte-17x2i38 {margin:0;text-align:left;font-weight:400;}.minimized-description.svelte-17x2i38 {overflow:hidden;line-clamp:1;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;font-weight:400;}.expand-description-button.svelte-17x2i38 {width:100%;display:flex;justify-content:space-between;gap:6px;flex-wrap:nowrap;.read-more-cta:where(.svelte-17x2i38) {color:#014FD3;flex-shrink:0;}}"};function yl(e,t){const n=co((()=>t.state.textBox));!function(e,t){ji(t,!0),Ea(e,gl);let n=el(t,"textBox",3,null),i=el(t,"isMobile",3,!1),r=xo(!1),o=xo(null),s=xo(!1),a=co((()=>{var e;return(null===(e=n())||void 0===e?void 0:e.title)||""})),l=co((()=>{var e;return(null===(e=n())||void 0===e?void 0:e.description)||""})),c=co((()=>i()?16:18)),u=co((()=>i()?12:16));function d(){Us(o)&&_o(s,Us(o).scrollWidth>Us(o).clientWidth||Us(o).scrollHeight>Us(o).clientHeight,!0)}Zo((()=>{Us(o)&&d()}));var h=ta();Xs("resize",Po,d);var f=jo(h),p=e=>{var t=vl(),n=Uo(t),d=Uo(n),h=Uo(d),f=e=>{var t=ul(),n=Uo(t,!0);xi(t),is((()=>ca(n,Us(a)))),na(e,t)};ba(h,(e=>{i()&&e(f)}));var p=qo(h,2),m=Uo(p,!0);xi(p),xi(d);var v=qo(d,2),g=e=>{var t=pl();t.__click=()=>_o(r,!0);var n=Uo(t),u=e=>{var t=dl(),n=Uo(t,!0);xi(t),is((()=>ca(n,Us(a)))),na(e,t)},d=e=>{var t=hl(),n=Uo(t,!0);xi(t),Ja(t,(e=>_o(o,e)),(()=>Us(o))),is((()=>ca(n,Us(l)))),na(e,t)};ba(n,(e=>{i()&&Us(a)?e(u):e(d,!1)}));var h=qo(n,2),f=e=>{na(e,fl())};ba(h,(e=>{(i()||!i()&&Us(s))&&e(f)})),xi(t),is((()=>Ra(t,`line-height: ${Us(c)}px;`))),na(e,t)};ba(v,(e=>{Us(r)||e(g)})),xi(n);var y=qo(n,2),b=e=>{var t=ml();t.__click=()=>_o(r,!1),is((()=>Ra(t,`margin-bottom: ${!i()&&Us(r)?"8px":"0px"};\n line-height: ${Us(u)}px;`))),na(e,t)};ba(y,(e=>{Us(r)&&e(b)})),xi(t),is((()=>{Oa(t,1,"step-description-container "+(Us(r)?"expanded":""),"svelte-17x2i38"),Ra(t,`padding: ${i()?"8px 16px":"16px 16px 56px 16px"};`),Ra(d,`line-height: ${Us(c)}px;`),qa(d,"hidden",!Us(r)),ca(m,Us(l))})),na(e,t)};ba(f,(e=>{(Us(a)||Us(l))&&e(p)})),na(e,h),qi()}(e,{get textBox(){return Us(n)},get isMobile(){return t.isMobile}})}Ys(["click"]);var bl=ea('<div class="toggle-option-container svelte-16pmvvn"><button> </button></div>'),kl=ea('<div class="toggle-container svelte-16pmvvn"><div></div></div>');const xl={hash:"svelte-16pmvvn",code:".eko-gallery-app {--toggleModule_gap: 8px;--toggleModule_padding: 10px 58px 0 0;--toggleModule_options_padding: 0;--toggleModule_options_height: auto;--toggleModule_options_width: 100%;--toggleModule_options_gap: 8px;--toggleModule_button_backgroundColor: #FFFFFF;--toggleModule_button_padding: 8px 12px;--toggleModule_button_boxShadow: 0px 2px 8px 2px rgba(0, 0, 0, 0.07);--toggleModule_button_text_fontFamily: var(--fontName);--toggleModule_button_text_fontSize: 12px;--toggleModule_button_text_fontWeight: 400;--toggleModule_button_text_fontStyle: normal;--toggleModule_button_text_lineHeight: 16px;--toggleModule_button_text_letterSpacing: -0.2px;--toggleModule_button_text_color: #000;--toggleModule_button_border_radius: 100px;--toggleModule_title_fontFamily: var(--fontName);--toggleModule_title_fontSize: 13px;--toggleModule_title_fontWeight: 400;--toggleModule_title_fontStyle: normal;--toggleModule_title_lineHeight: 120%;--toggleModule_title_letterSpacing: 0;--toggleModule_title_color: #666;--toggleModule_title_textAlignment: center;--toggleModule_note_fontFamily: var(--fontName);--toggleModule_note_fontSize: 12px;--toggleModule_note_fontWeight: 400;--toggleModule_note_fontStyle: normal;--toggleModule_note_lineHeight: 120%;--toggleModule_note_letterSpacing: 0;--toggleModule_note_color: #888;--toggleModule_note_topMargin: 4px;}.toggle-container.svelte-16pmvvn {position:absolute;top:0;padding:var(--toggleModule_padding);width:100%;display:flex;flex-direction:column;align-items:center;gap:var(--toggleModule_gap);pointer-events:auto;box-sizing:border-box;}.toggle-options.svelte-16pmvvn {width:var(--toggleModule_options_width);height:var(--toggleModule_options_height);padding:var(--toggleModule_options_padding);gap:var(--toggleModule_options_gap);display:flex;justify-content:end;margin:0;}.toggle-option-container.svelte-16pmvvn {position:relative;min-width:0;}.toggle-option-button.svelte-16pmvvn {border-radius:var(--toggleModule_button_borderRadius);font-family:var(--toggleModule_button_text_fontFamily);font-size:var(--toggleModule_button_text_fontSize);font-weight:var(--toggleModule_button_text_fontWeight);font-style:var(--toggleModule_button_text_fontStyle);line-height:var(--toggleModule_button_text_lineHeight);letter-spacing:var(--toggleModule_button_text_letterSpacing);color:var(--toggleModule_button_text_color);padding:var(--toggleModule_button_padding);border:#E4E5E8 solid 1px;background:#FBFBFB;display:flex;width:100%;height:100%;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;cursor:pointer;position:relative;transition:all 0.3s ease-in-out;animation-duration:0.5s;animation-timing-function:cubic-bezier(0.36, 0, 0, 1);animation-fill-mode:both;animation-delay:calc(var(--button-index) * 90ms);\n animation-name: svelte-16pmvvn-button-back-appear-anim;transform-origin:bottom center;border-radius:var(--toggleModule_button_border_radius);}.toggle-option-button.selected.svelte-16pmvvn {box-shadow:none;color:#FFFFFF;background:#014FD3;border-color:#014FD3;}.toggle-option-button.svelte-16pmvvn:hover:not(.selected) {background:#F3F4F6;}.toggle-option-button.svelte-16pmvvn:active:not(.selected) {background:#E4E5E8;}.toggle-option-button.svelte-16pmvvn:focus {outline-offset:4px;outline-width:2px;}\n\n@keyframes svelte-16pmvvn-button-back-appear-anim {\n from {\n transform: scale(0);\n }\n to {\n transform: scale(1);\n }\n}\n@keyframes svelte-16pmvvn-optionNoteIn {\n 0% {\n opacity: 0;\n translate: -50% -5px;\n }\n 100% {\n opacity: 1;\n translate: -50% var(--toggleModule_note_topMargin);\n }\n}"};function wl(e,t){Ea(e,xl);const n=co((()=>t.state.options)),i=co((()=>t.state.currentOptionIndex)),r=co((()=>t.state.onOptionClicked));var o=kl(),s=Uo(o);wa(s,21,(()=>Us(n)),ka,((e,t,n)=>{var o=bl();Ra(o,`--button-index: ${n};`);var s=Uo(o);let a;s.__click=()=>Us(r)(n);var l=Uo(s,!0);xi(s),xi(o),is((()=>{a=Oa(s,1,"toggle-option-button svelte-16pmvvn",null,a,{selected:Us(i)===n}),ca(l,Us(t).label)})),na(e,o)})),xi(s),xi(o),is((()=>{var e;return Oa(s,1,`toggle-options selected-${null!==(e=Us(i))&&void 0!==e?e:""}`,"svelte-16pmvvn")})),na(e,o)}Ys(["click"]);var _l=new WeakSet;function Tl(e){var t,n;e!==this.state.currentOptionIndex&&(this.state.currentOptionIndex=e,this.cover=this.coverAssets[e],this.synced?this.switchTo(e):(this.timeline=null===(t=this.timelines)||void 0===t?void 0:t[e],this.showCover=!0,al(this.timeline,(()=>{this.showCover=!1})),null===(n=this.player)||void 0===n||n.switchTimeline(this.timeline)))}const Il=(e,t,n)=>n>t?t:n<e?e:n;function El(e,t){return t?`${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${t}`:e}let Sl=()=>{},Al=()=>{};function Nl(e){let t;return()=>(void 0===t&&(t=e()),t)}"undefined"!=typeof process&&"production"!==(null===(rt=process.env)||void 0===rt?void 0:rt.NODE_ENV)&&(Sl=(e,t,n)=>{e||"undefined"==typeof console||console.warn(El(t,n))},Al=(e,t,n)=>{if(!e)throw new Error(El(t,n))});const Ml=e=>e,Fl=e=>1e3*e,Cl=e=>e/1e3;const Ol=e=>Array.isArray(e)&&"number"==typeof e[0],Pl=(e,t,n=10)=>{let i="";const r=Math.max(Math.round(t/n),2);for(let t=0;t<r;t++)i+=Math.round(1e4*e(t/(r-1)))/1e4+", ";return`linear(${i.substring(0,i.length-2)})`},Rl=2e4;function Dl(e){let t=0;let n=e.next(t);for(;!n.done&&t<Rl;)t+=50,n=e.next(t);return t>=Rl?1/0:t}const Ll=5;const Bl={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},zl=.001;function Wl({duration:e=Bl.duration,bounce:t=Bl.bounce,velocity:n=Bl.velocity,mass:i=Bl.mass}){let r,o;Sl(e<=Fl(Bl.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let s=1-t;s=Il(Bl.minDamping,Bl.maxDamping,s),e=Il(Bl.minDuration,Bl.maxDuration,Cl(e)),s<1?(r=t=>{const i=t*s,r=i*e,o=i-n,a=Ul(t,s),l=Math.exp(-r);return zl-o/a*l},o=t=>{const i=t*s*e,o=i*n+n,a=Math.pow(s,2)*Math.pow(t,2)*e,l=Math.exp(-i),c=Ul(Math.pow(t,2),s);return(-r(t)+zl>0?-1:1)*((o-a)*l)/c}):(r=t=>Math.exp(-t*e)*((t-n)*e+1)-zl,o=t=>Math.exp(-t*e)*(e*e*(n-t)));const a=function(e,t,n){let i=n;for(let n=1;n<$l;n++)i-=e(i)/t(i);return i}(r,o,5/e);if(e=Fl(e),isNaN(a))return{stiffness:Bl.stiffness,damping:Bl.damping,duration:e};{const t=Math.pow(a,2)*i;return{stiffness:t,damping:2*s*Math.sqrt(i*t),duration:e}}}const $l=12;function Ul(e,t){return e*Math.sqrt(1-t*t)}const jl=["duration","bounce"],ql=["stiffness","damping","mass"];function Vl(e,t){return t.some((t=>void 0!==e[t]))}function Gl(e=Bl.visualDuration,t=Bl.bounce){const n="object"!=typeof e?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:i,restDelta:r}=n;const o=n.keyframes[0],s=n.keyframes[n.keyframes.length-1],a={done:!1,value:o},{stiffness:l,damping:c,mass:u,duration:d,velocity:h,isResolvedFromDuration:f}=function(e){let t={velocity:Bl.velocity,stiffness:Bl.stiffness,damping:Bl.damping,mass:Bl.mass,isResolvedFromDuration:!1,...e};if(!Vl(e,ql)&&Vl(e,jl))if(e.visualDuration){const n=e.visualDuration,i=2*Math.PI/(1.2*n),r=i*i,o=2*Il(.05,1,1-(e.bounce||0))*Math.sqrt(r);t={...t,mass:Bl.mass,stiffness:r,damping:o}}else{const n=Wl(e);t={...t,...n,mass:Bl.mass},t.isResolvedFromDuration=!0}return t}({...n,velocity:-Cl(n.velocity||0)}),p=h||0,m=c/(2*Math.sqrt(l*u)),v=s-o,g=Cl(Math.sqrt(l/u)),y=Math.abs(v)<5;let b;if(i||(i=y?Bl.restSpeed.granular:Bl.restSpeed.default),r||(r=y?Bl.restDelta.granular:Bl.restDelta.default),m<1){const e=Ul(g,m);b=t=>{const n=Math.exp(-m*g*t);return s-n*((p+m*g*v)/e*Math.sin(e*t)+v*Math.cos(e*t))}}else if(1===m)b=e=>s-Math.exp(-g*e)*(v+(p+g*v)*e);else{const e=g*Math.sqrt(m*m-1);b=t=>{const n=Math.exp(-m*g*t),i=Math.min(e*t,300);return s-n*((p+m*g*v)*Math.sinh(i)+e*v*Math.cosh(i))/e}}const k={calculatedDuration:f&&d||null,next:e=>{const t=b(e);if(f)a.done=e>=d;else{let n=0===e?p:0;m<1&&(n=0===e?Fl(p):function(e,t,n){const i=Math.max(t-Ll,0);return r=n-e(i),(o=t-i)?r*(1e3/o):0;var r,o}(b,e,t));const o=Math.abs(n)<=i,l=Math.abs(s-t)<=r;a.done=o&&l}return a.value=a.done?s:t,a},toString:()=>{const e=Math.min(Dl(k),Rl),t=Pl((t=>k.next(e*t).value),e,30);return e+"ms "+t},toTransition:()=>{}};return k}Gl.applyToOptions=e=>{const t=function(e,t=100,n){const i=n({...e,keyframes:[0,t]}),r=Math.min(Dl(i),Rl);return{type:"keyframes",ease:e=>i.next(r*e).value/t,duration:Cl(r)}}(e,100,Gl);return e.ease=t.ease,e.duration=Fl(t.duration),e.type="keyframes",e};const Hl=e=>null!==e;class Kl{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise((e=>{this.resolve=e}))}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}}function Xl(e){for(let n=1;n<e.length;n++){var t;null!==(t=e[n])&&void 0!==t||(e[n]=e[n-1])}}const Yl=e=>e.startsWith("--");const Ql=Nl((()=>void 0!==window.ScrollTimeline)),Jl={};function Zl(e,t){const n=Nl(e);return()=>{var e;return null!==(e=Jl[t])&&void 0!==e?e:n()}}const ec=Zl((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(e){return!1}return!0}),"linearEasing"),tc=([e,t,n,i])=>`cubic-bezier(${e}, ${t}, ${n}, ${i})`,nc={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:tc([0,.65,.55,1]),circOut:tc([.55,0,1,.45]),backIn:tc([.31,.01,.66,-.59]),backOut:tc([.33,1.53,.69,.99])};function ic(e,t){return e?"function"==typeof e?ec()?Pl(e,t):"ease-out":Ol(e)?tc(e):Array.isArray(e)?e.map((e=>ic(e,t)||nc.easeOut)):nc[e]:void 0}function rc(e,t,n,{delay:i=0,duration:r=300,repeat:o=0,repeatType:s="loop",ease:a="easeOut",times:l}={},c=void 0){const u={[t]:n};l&&(u.offset=l);const d=ic(a,r);Array.isArray(d)&&(u.easing=d);const h={delay:i,duration:r,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:o+1,direction:"reverse"===s?"alternate":"normal"};c&&(h.pseudoElement=c);return e.animate(u,h)}class oc extends Kl{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:n,keyframes:i,pseudoElement:r,allowFlatten:o=!1,finalKeyframe:s,onComplete:a}=e;this.isPseudoElement=Boolean(r),this.allowFlatten=o,this.options=e,Al("string"!=typeof e.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const l=function({type:e,...t}){return function(e){return"function"==typeof e&&"applyToOptions"in e}(e)&&ec()?e.applyToOptions(t):(null!==(n=t.duration)&&void 0!==n||(t.duration=300),null!==(i=t.ease)&&void 0!==i||(t.ease="easeOut"),t);var n,i}(e);this.animation=rc(t,n,i,l,r),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!r){const e=function(e,{repeat:t,repeatType:n="loop"},i,r=1){const o=e.filter(Hl),s=r<0||t&&"loop"!==n&&t%2==1?0:o.length-1;return s&&void 0!==i?i:o[s]}(i,this.options,s,this.speed);this.updateMotionValue?this.updateMotionValue(e):function(e,t,n){Yl(t)?e.style.setProperty(t,n):e.style[t]=n}(t,n,e),this.animation.cancel()}null==a||a(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,t;null===(e=(t=this.animation).finish)||void 0===e||e.call(t)}cancel(){try{this.animation.cancel()}catch(e){}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;"idle"!==e&&"finished"!==e&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var e,t;this.isPseudoElement||(null===(e=(t=this.animation).commitStyles)||void 0===e||e.call(t))}get duration(){var e,t;const n=(null===(e=this.animation.effect)||void 0===e||null===(t=e.getComputedTiming)||void 0===t?void 0:t.call(e).duration)||0;return Cl(Number(n))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Cl(e)}get time(){return Cl(Number(this.animation.currentTime)||0)}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Fl(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){var e;return null!==(e=this.manualStartTime)&&void 0!==e?e:Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,observe:t}){var n;this.allowFlatten&&(null===(n=this.animation.effect)||void 0===n||n.updateTiming({easing:"linear"}));return this.animation.onfinish=null,e&&Ql()?(this.animation.timeline=e,Ml):t(this)}}class sc{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map((e=>e.finished)))}getAll(e){return this.animations[0][e]}setAll(e,t){for(let n=0;n<this.animations.length;n++)this.animations[n][e]=t}attachTimeline(e){const t=this.animations.map((t=>t.attachTimeline(e)));return()=>{t.forEach(((e,t)=>{e&&e(),this.animations[t].stop()}))}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get state(){return this.getAll("state")}get startTime(){return this.getAll("startTime")}get duration(){return ac(this.animations,"duration")}get iterationDuration(){return ac(this.animations,"iterationDuration")}runAll(e){this.animations.forEach((t=>t[e]()))}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function ac(e,t){let n=0;for(let i=0;i<e.length;i++){const r=e[i][t];null!==r&&r>n&&(n=r)}return n}class lc extends sc{then(e,t){return this.finished.finally(e).then((()=>{}))}}const cc=new WeakMap,uc=(e,t="")=>`${e}:${t}`;function dc(e){const t=cc.get(e)||new Map;return cc.set(e,t),t}function hc(e,t){var n,i;return null!==(n=null!==(i=null==e?void 0:e[t])&&void 0!==i?i:null==e?void 0:e.default)&&void 0!==n?n:e}const fc=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 pc(e,t){for(let n=0;n<e.length;n++)"number"==typeof e[n]&&fc.has(t)&&(e[n]=e[n]+"px")}function mc(e,t){const n=window.getComputedStyle(e);return Yl(t)?n.getPropertyValue(t):n[t]}function vc(e,t,n,i){if(null==e)return[];const r=function(e){if(null==e)return[];if(e instanceof EventTarget)return[e];if("string"==typeof e){const t=document.querySelectorAll(e);return t?Array.from(t):[]}return Array.from(e).filter((e=>null!=e))}(e),o=r.length;Al(Boolean(o),"No valid elements provided.","no-valid-elements");const s=[];for(let e=0;e<o;e++){const i=r[e],a={...n};"function"==typeof a.delay&&(a.delay=a.delay(e,o));for(const e in t){let n=t[e];Array.isArray(n)||(n=[n]);const r={...hc(a,e)};r.duration&&(r.duration=Fl(r.duration)),r.delay&&(r.delay=Fl(r.delay));const o=dc(i),l=uc(e,r.pseudoElement||""),c=o.get(l);c&&c.stop(),s.push({map:o,key:l,unresolvedKeyframes:n,options:{...r,element:i,name:e,allowFlatten:!a.type&&!a.ease}})}}for(let e=0;e<s.length;e++){const{unresolvedKeyframes:t,options:n}=s[e],{element:i,name:r,pseudoElement:o}=n;o||null!==t[0]||(t[0]=mc(i,r)),Xl(t),pc(t,r),!o&&t.length<2&&t.unshift(mc(i,r)),n.keyframes=t}const a=[];for(let e=0;e<s.length;e++){const{map:t,key:n,options:i}=s[e],r=new oc(i);t.set(n,r),r.finished.finally((()=>t.delete(n))),a.push(r)}return a}const gc=(()=>function(e,t,n){return new lc(vc(e,t,n))})();var yc=ea('<button class="svelte-16kucsb"><div class="svelte-16kucsb"> </div></button>'),bc=ea('<div class="tryIt-container svelte-16kucsb"><!></div>');const kc={hash:"svelte-16kucsb",code:".eko-gallery-app {--tryItModule_justifyContent: center;--tryItModule_alignItems: flex-end;--tryItModule_padding: 16px 20px 48px 20px;--tryItModule_button_padding: 16px 32px;--tryItModule_button_textAlign: center;--tryItModule_button_borderRadius: 100px;--tryItModule_button_border: 0;--tryItModule_button_boxShadow: 0 4px 24px 2px rgba(0, 0, 0, 0.12);--tryItModule_button_background: #FFFFFF;--tryItModule_button_text_fontFamily: var(--fontName);--tryItModule_button_text_fontSize: 18px;--tryItModule_button_text_color: #222;--tryItModule_button_text_weight: 500;--tryItModule_button_text_lineHeight: 120%;--tryItModule_button_text_letterSpacing: -0.1px;}.tryIt-container.svelte-16kucsb {position:relative;padding:var(--tryItModule_padding);width:100%;height:100%;box-sizing:border-box;display:flex;justify-content:var(--tryItModule_justifyContent);align-items:var(--tryItModule_alignItems);}.tryIt-container.svelte-16kucsb button:where(.svelte-16kucsb) {padding:var(--tryItModule_button_padding);text-align:var(--tryItModule_button_textAlign);border-radius:var(--tryItModule_button_borderRadius);border:var(--tryItModule_button_border);background:var(--tryItModule_button_background);box-shadow:var(--tryItModule_button_boxShadow);font-family:var(--tryItModule_button_text_fontFamily);font-size:var(--tryItModule_button_text_fontSize);color:var(--tryItModule_button_text_color);font-weight:var(--tryItModule_button_text_weight);line-height:var(--tryItModule_button_text_lineHeight);letter-spacing:var(--tryItModule_button_text_letterSpacing);cursor:pointer;opacity:0;overflow:hidden;}.tryIt-container.svelte-16kucsb button:where(.svelte-16kucsb) div:where(.svelte-16kucsb) {opacity:0;}"};function xc(e,t){ji(t,!0),Ea(e,kc);const n=co((()=>t.state.ctaText)),i=co((()=>t.state.animationConfig)),r=co((()=>t.state.showCta)),o=co((()=>t.state.onCtaClick));let s=null,a=null,l=xo(!1),c=!1;function u(){c&&gc(s,{transform:"scale(1.05)"},{type:Gl,mass:1.5,stiffness:400,damping:30})}function d(){c&&gc(s,{transform:"scale(1)"},{type:Gl,mass:1.5,stiffness:400,damping:30})}function h(){c&&gc(s,{transform:"scale(0.95)"},{type:Gl,mass:1,stiffness:600,damping:30})}Zo((()=>{const{mass:e,stiffness:t,damping:n,delay:o}=Us(i);let u;return Us(r)&&(u=setTimeout((async()=>{_o(l,!0),u=null,gc(s,{transform:["translateY(40px) scale(0, 0.2)","translateY(0) scale(1, 1)"],opacity:1},{type:Gl,mass:e,stiffness:t,damping:n}),await gc(a,{transform:["translateY(20px) scale(0.8)","translateY(0) scale(1)"],opacity:1},{type:Gl,mass:e,stiffness:t,damping:n,delay:.15}),c=!0}),o)),()=>{u&&clearTimeout(u)}}));var f=bc(),p=Uo(f),m=e=>{var t=yc();t.__mousedown=h,t.__touchstart=h,t.__click=function(...e){var t;null===(t=Us(o))||void 0===t||t.apply(this,e)};var i=Uo(t),r=Uo(i,!0);xi(i),Ja(i,(e=>a=e),(()=>a)),xi(t),Ja(t,(e=>s=e),(()=>s)),is((()=>{Ra(t,"pointer-events: "+(Us(l)?"auto":"none")),ca(r,Us(n))})),Xs("mouseenter",t,u),Xs("mouseleave",t,d),na(e,t)};ba(p,(e=>{Us(r)&&e(m)})),xi(f),na(e,f),qi()}Ys(["mousedown","touchstart","click"]);var wc=new WeakSet;function _c(){this.mainTimeline?this.player.switchTimeline(this.mainTimeline):this.emitModuleEnd(),this.state.showCta=!1}const Tc={videoModule:class extends ll{constructor({config:e,...t}){var n;super({...t,config:e}),this.Component=yl,this.hasDuration=!e.loop,sl(this),this.coverAssets.push(null!==(n=e.intro)&&void 0!==n?n:e.video),this.cover=this.coverAssets[0],this.state={textBox:e.textBox}}start(e){super.start(e),this.timeline=e.createTimeline();const t=this.config;t.intro&&this.timeline.placeOnTimeline(cl(`${this.id}_intro`,t.intro,e),"end");const n=cl(this.id,t.video,e);this.timeline.placeOnTimeline(n,"end",{loop:t.loop}),t.loop||n.on("nodeend",this.emitModuleEnd)}},toggleModule:class extends ll{constructor({config:e,...t}){super({...t,config:e}),O(this,_l),this.Component=wl,this.synced=e.sync,this.switchTo=()=>{},sl(this),this.coverAssets=e.options.map((e=>{var t;return null!==(t=e.intro)&&void 0!==t?t:e.video})),this.cover=this.coverAssets[0],this.state={options:e.options.map((e=>({label:e.label,note:e.note}))),currentOptionIndex:0,onOptionClicked:A(_l,this,Tl).bind(this)}}start(e){super.start(e),this.synced?(this.timeline=e.createTimeline(),this.config.options.forEach(((t,n)=>{this.timeline.placeOnTimeline(cl(`${this.id}_option_${n}`,t.video,e),0,{loop:!0})})),this.timeline.placeRenderNodeOnTimeline("switch",0,1/0,{params:{switchCrossfadeSeconds:.25,initSwitching:({switchTo:e})=>{this.switchTo=e,e(this.state.currentOptionIndex,{crossfadeSeconds:0})}}})):(this.timelines=this.config.options.map(((t,n)=>{const i=e.createTimeline();return t.intro&&i.placeOnTimeline(cl(`${this.id}_option_${n}_intro`,t.intro,e),"end"),i.placeOnTimeline(cl(`${this.id}_option_${n}`,t.video,e),"end",{loop:!0}),i})),this.timeline=this.timelines[this.state.currentOptionIndex])}},tryItModule:class extends ll{constructor({config:e,...t}){var n;super({...t,config:e}),O(this,wc),sl(this);const{introVideo:i}=e;this.coverAssets.push(null!==(n=i.intro)&&void 0!==n?n:i.loop),this.cover=this.coverAssets[0],this.state={ctaText:e.ctaText,animationConfig:e.animationConfig,showCta:!0,onCtaClick:A(wc,this,_c).bind(this)}}start(e){super.start(e),this.Component=xc,this.timeline=e.createTimeline();const{introVideo:t,mainVideo:n}=this.config;if(t.intro&&this.timeline.placeOnTimeline(cl(`${this.id}_intro_intro`,t.intro,e)),this.timeline.placeOnTimeline(cl(`${this.id}_intro_loop`,t.loop,e),"end",{loop:!0}),n){this.mainTimeline=e.createTimeline(),n.intro&&this.mainTimeline.placeOnTimeline(cl(`${this.id}_main_intro`,n.intro,e));const t=cl(`${this.id}_main_loop`,n.loop,e);this.mainTimeline.placeOnTimeline(t,"end",{loop:!0})}}play(){this.state.showCta=!0,super.play()}}};class Ic{#d=Oi(xo({}),"GalleryState.#variants");#h=Oi(xo("ekonovar"),"GalleryState.#activeVariant");#f=Oi(xo(0),"GalleryState.#activeItemIndex");#p=Oi(xo(0),"GalleryState.#activeModuleIndex");#m=Oi(xo(No({itemIndex:0,moduleIndex:0})),"GalleryState.#playingModulePosition");#v=Oi(co((()=>{var e;return null===(e=Us(this.#d))||void 0===e?void 0:e[Us(this.#h)]})),"GalleryState.#currentItemsList");#g=Oi(co((()=>{var e;return null===(e=Us(this.#v))||void 0===e?void 0:e[Us(this.#f)]})),"GalleryState.#currentItem");#y=Oi(co((()=>{var e,t;return Us(this.#b)?null===(t=Us(this.#v))||void 0===t?void 0:t[Us(this.#m).itemIndex].modules[Us(this.#m).moduleIndex]:null===(e=Us(this.#g))||void 0===e?void 0:e.modules[Us(this.#p)]})),"GalleryState.#currentModule");#k=Oi(co((()=>{var e;return(null===(e=Us(this.#v))||void 0===e?void 0:e.flatMap((e=>e.modules)))||[]})),"GalleryState.#currentModulesList");#x=Oi(xo(!1),"GalleryState.#playerLoaded");#w=Oi(xo(!1),"GalleryState.#paused");#b=Oi(xo(!1),"GalleryState.#startedPlaying");#_=Oi(co((()=>!(Oo(Us(this.#m).itemIndex,this.activeItemIndex)&&Oo(Us(this.#m).moduleIndex,this.activeModuleIndex)))),"GalleryState.#seeking");set variants(e){_o(this.#d,e)}set activeVariant(e){_o(this.#h,e,!0)}set activeItemIndex(e){_o(this.#f,e,!0)}set activeModuleIndex(e){_o(this.#p,e,!0)}set playingModulePosition(e){_o(this.#m,e,!0)}set playerLoaded(e){_o(this.#x,e,!0)}set paused(e){_o(this.#w,e,!0)}set startedPlaying(e){_o(this.#b,e,!0)}get variants(){return Us(this.#d)}get activeVariant(){return Us(this.#h)}get activeItemIndex(){return Us(this.#f)}get activeModuleIndex(){return Us(this.#p)}get playingModulePosition(){return Us(this.#m)}get currentItemsList(){return Us(this.#v)}get currentItem(){return Us(this.#g)}get currentModule(){return Us(this.#y)}get playerLoaded(){return Us(this.#x)}get paused(){return Us(this.#w)}get startedPlaying(){return Us(this.#b)}get seeking(){return Us(this.#_)}get currentModulesList(){return Us(this.#k)}}const Ec={assetsDeliveryBase:"https://{{env}}assets.eko.com"},Sc=2,Ac=5,Nc=["activeItemIndex","activeModuleIndex","paused","startedPlaying"],Mc=["version","selectItem","selectItemAndStep","next","prev","subscribe"];var Fc=new WeakMap,Cc=new WeakMap,Oc=new WeakMap,Pc=new WeakMap,Rc=new WeakSet;class Dc{constructor(e){var t,n,i;O(this,Rc),F(this,Fc,void 0),F(this,Cc,void 0),F(this,Oc,void 0),F(this,Pc,void 0),P(this,"public",void 0),P(this,"version","0.0.7"),sl(this),C(Oc,this,e),C(Fc,this,new Ic(null==e||null===(t=e.options)||void 0===t?void 0:t.galleryEnv)),C(Pc,this,((e="")=>(Oo(e,"production")&&(e=""),Object.fromEntries(Object.entries(Ec).map((([t,n])=>[t,n.replaceAll("{{env}}",e)])))))(null==e||null===(n=e.options)||void 0===n?void 0:n.galleryEnv)),C(Cc,this,[]);const r=null==e||null===(i=e.instance)||void 0===i||null===(i=i.data)||void 0===i||null===(i=i.blocks)||void 0===i||null===(i=i.blocksArr)||void 0===i||null===(i=i.find((e=>Oo(e.blockType,"GalleryBlock"))))||void 0===i?void 0:i.config;var o;r?(A(Rc,this,Lc).call(this,r.items),A(Rc,this,Bc).call(this,r.items)):console.warn("[eko-gallery-app] Gallery initiated without an instance, results will be empty"),this.public=(o=this,Mc.reduce(((e,t)=>{if(!(t in o))throw new Error(`[eko-gallery-app] Public API member "${t}" does not exist on GalleryLogic`);const n=o[t];return e[t]=Oo(typeof n,"function")?n.bind(o):n,e}),{})),console.log(...tl("log","[EkoGallery] GallaryLogic constructor finished with config",e))}start(e){M(Fc,this).playerLoaded=!0,M(Cc,this).forEach((t=>{t.start(e)})),C(Cc,this,null),A(Rc,this,zc).call(this,e),M(Fc,this).currentModule.play()}selectItem(e){const t=M(Fc,this);Oo(e,t.activeItemIndex)||(t.activeItemIndex=e,t.activeModuleIndex=0)}selectItemAndStep(e,t){const n=M(Fc,this);Oo(e,n.activeItemIndex)&&Oo(t,n.activeModuleIndex)||(n.activeItemIndex=e,n.activeModuleIndex=t)}next(){A(Rc,this,$c).call(this)}prev(){const e=M(Fc,this);if(e.activeModuleIndex=e.activeModuleIndex-1,!e.currentItem.modules[e.activeModuleIndex])if(e.currentItemsList[e.activeItemIndex-1]){e.activeItemIndex=e.activeItemIndex-1;const t=e.currentItemsList[e.activeItemIndex];e.activeModuleIndex=t.modules.length-1}else e.activeModuleIndex=e.activeModuleIndex+1}subscribe(e){const t=M(Fc,this);return function(e){kr.ensure();const t=Yo(zn|Qn,e,!0);return()=>{cs(t)}}((()=>{Zo((()=>{const n=Nc.reduce(((e,n)=>(e[n]=t[n],e)),{});e(n)}))}))}getCoverUrl(e,t){var n,i,r,o;const s=(null==e||null===(n=e.entity)||void 0===n?void 0:n.entityId)||(null==e?void 0:e.assetId),a=null!==(i=null==e||null===(r=e.entity)||void 0===r?void 0:r.entityRevision)&&void 0!==i?i:null==e?void 0:e.assetRevision;if(!s)throw new Error(`[getCoverUrl] No assetId found in assetConfig: ${JSON.stringify(e||{},null,2)}`);if(!a&&Oo(a,0,!1))throw new Error(`[getCoverUrl] No assetRevision found for asset ${s}.`);let l;return null!==(o=M(Oc,this))&&void 0!==o&&null!==(o=o.coverAssetsMap)&&void 0!==o&&o[s]?(l=new URL(M(Oc,this).coverAssetsMap[s]),/^[a-z0-9]*assets.eko.com$/.test(l.host)&&t&&(l.pathname=l.pathname.replace(".png",".webp"))):(l=new URL(`${M(Pc,this).assetsDeliveryBase}/image/${s}/${a}?startOffset=0`),l.pathname+=t?".webp":".png"),t&&l.searchParams.set("width",t),l.href}get currentConfig(){return M(Oc,this)}get state(){return M(Fc,this)}get urls(){return M(Pc,this)}}function Lc(e){const t={};for(let n of e)for(let e of Object.keys(n.variants||{}))t[e]=[];t.ekonovar=[],M(Fc,this).variants=t}function Bc(e){const t=(e=[],t)=>{const n=[];for(let[i,r]of e.entries()){if(!Tc[r.itemType])throw new Error(`Unknown module type ${r.itemType}`);const e=new Tc[r.itemType]({position:{...t,moduleIndex:i},config:r,galleryState:M(Fc,this)});e.moduleEndListener=A(Rc,this,Wc).bind(this),n.push(e)}return n};for(const[i,r]of e.entries())if(Oo(r.itemType,"galleryItemV2")){const{modules:e,...o}=r;for(const[s,a]of Object.entries(M(Fc,this).variants)){var n;if(null===(n=r.variants)||void 0===n?void 0:n[s])console.log("NO IMPLEMENTED");else{const n={...o};n.modules=t(e,{variantId:s,itemIndex:i}),C(Cc,this,[...M(Cc,this),...n.modules]),a.push(n)}}}}function zc(e){for(const[,t]of Object.entries(M(Fc,this).variants))for(const[n,i]of t.entries()){const r=i.modules,o=t.filter((e=>Oo(e,i,!1))).map((e=>e.modules[0]));for(const[i,s]of r.entries()){let a=r[i+1];a||(a=t[(n+1)%t.length].modules[0]);const l=a.timeline.getNodesAtTime(0)[0],c=o.filter((e=>Oo(e,a,!1))).map((e=>e.timeline.getNodesAtTime(0)[0])),u=[{nodeId:l.id,weight:Sc},...c.map((e=>({nodeId:e.id,weight:Ac})))];for(const t of s.timeline.placements){e.getNode(t.nodeId).setChildren(u)}}}}function Wc(){const e=M(Fc,this),t=e.currentItem.modules;t.length>1&&Oo(e.activeModuleIndex,t.length-1)?e.activeModuleIndex=0:A(Rc,this,$c).call(this)}function $c(){const e=M(Fc,this);e.activeModuleIndex=e.activeModuleIndex+1,e.currentItem.modules[e.activeModuleIndex]||(e.currentItemsList[e.activeItemIndex+1]?(e.activeItemIndex=e.activeItemIndex+1,e.activeModuleIndex=0):e.activeModuleIndex=e.activeModuleIndex-1)}var Uc=ea('<button><span class="svelte-er27y2"> </span></button>'),jc=ea('<div class="nav-buttons-container svelte-er27y2"><div class="nav-buttons svelte-er27y2"></div></div>');const qc={hash:"svelte-er27y2",code:".eko-gallery-app {--nav_gap: 10px;--nav_padding: 12px 16px;--nav_bgColor: #FFFFFF;--nav_justifyContent: center;--nav_button_width: fit-content;--nav_button_bgColor: #FFFFFF;--nav_button_borderRadius: 100px;--nav_button_paddingTop: 8px;--nav_button_paddingBottom: var(--nav_button_paddingTop);--nav_button_paddingLeft: 12px;--nav_button_paddingRight: var(--nav_button_paddingLeft);--nav_button_boxShadow: 0 0 0 1px #E7E7E7;--nav_button_gap: 2px;--nav_button_selected_boxShadow: 0 0 0 1px #000000;--nav_button_selected_bgColor: var(--nav_button_bgColor);--nav_button_text_color: #000000;--nav_button_text_fontSize: 14px;--nav_button_text_fontWeight: 500;--nav_button_text_fontFamily: var(--fontName);--nav_button_text_lineHeight: 120%;--nav_button_text_letterSpacing: 0px;--nav_button_text_align: center;--nav_button_selected_text_color: var(--nav_button_text_color);--nav_button_selected_text_fontWeight: var(--nav_button_text_fontWeight);--nav_button_image_borderRadius: calc(var(--nav_button_borderRadius) - var(--nav_button_paddingTop));--nav_arrow_color: var(--secondaryColor);--nav_arrow_bgColor: var(--primaryColor);--nav_arrow_padding: 9px;--nav_arrow_size: 28px;--nav_arrow_boxShadow: 0 0 8px 0 rgba(0, 0, 0, 0.3);}.nav-buttons-container.svelte-er27y2 {width:100%;background-color:var(--nav_bgColor);height:var(--buttonsContainerHeight);display:flex;box-sizing:border-box;text-align:center;justify-content:var(--nav_justifyContent);align-items:center;position:relative;flex-shrink:0;}.nav-buttons-container.svelte-er27y2 :where(.svelte-er27y2) {touch-action:auto;}.nav-buttons.svelte-er27y2 {display:flex;margin:0;gap:var(--nav_gap);height:100%;align-items:center;padding:var(--nav_padding);box-sizing:border-box;overflow-x:auto;scrollbar-width:none;max-width:100%;width:fit-content;overflow-y:hidden;overscroll-behavior-y:none;}.nav-button.svelte-er27y2 {display:flex;outline:none;flex-shrink:0;height:100%;width:var(--nav_button_width);border:none;cursor:pointer;align-items:center;gap:var(--nav_button_gap);background-color:var(--nav_button_bgColor);border-radius:var(--nav_button_borderRadius);\n /* eslint-disable-next-line max-len */padding:var(--nav_button_paddingTop) var(--nav_button_paddingRight) var(--nav_button_paddingBottom) var(--nav_button_paddingLeft);box-shadow:var(--nav_button_boxShadow);}.nav-button.svelte-er27y2 span:where(.svelte-er27y2) {flex:1 0 0;transition:color 0.2s ease-in-out;color:var(--nav_button_text_color);font-weight:var(--nav_button_text_fontWeight);font-size:var(--nav_button_text_fontSize);font-family:var(--nav_button_text_fontFamily);line-height:var(--nav_button_text_lineHeight);letter-spacing:var(--nav_button_text_letterSpacing);text-align:var(--nav_button_text_align);}.nav-button.selected.svelte-er27y2 {background-color:var(--nav_button_selected_bgColor);box-shadow:var(--nav_button_selected_boxShadow);}.nav-button.selected.svelte-er27y2 span:where(.svelte-er27y2) {color:var(--nav_button_selected_text_color);font-weight:var(--nav_button_selected_text_fontWeight);}"};Ys(["click"]);const Vc="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 Gc=ea('<button><img class="svelte-1al44kl"/></button>');const Hc={hash:"svelte-1al44kl",code:'.nav-button.svelte-1al44kl {height:30px;width:30px;border-radius:100%;background-color:transparent;padding:9px;box-sizing:border-box;display:flex;align-items:center;justify-content:center;pointer-events:auto;border:0;opacity:100%;cursor:pointer;transition-property:background-color, box-shadow, opacity;position:relative;}.nav-button.prev.svelte-1al44kl {transform:rotate(180deg);}.nav-button.hidden.svelte-1al44kl {opacity:0;pointer-events:none;}.nav-button.svelte-1al44kl::before {content:"";position:absolute;top:-8px;right:-8px;bottom:-8px;left:-8px;}.nav-button.svelte-1al44kl img:where(.svelte-1al44kl) {height:100%;}'};function Kc(e,t){Ea(e,Hc);const n=el(t,"hidden",3,!1);var i=Gc();let r;i.__click=function(...e){var n;null===(n=t.onClick)||void 0===n||n.apply(this,e)};var o=Uo(i);xi(i),is((()=>{var e;r=Oa(i,1,`nav-button ${null!==(e=t.type)&&void 0!==e?e:""}`,"svelte-1al44kl",r,{hidden:n()}),qa(i,"aria-label",t.type),qa(o,"src",Vc),qa(o,"alt",t.type)})),na(e,i)}Ys(["click"]);var Xc=ea('<button><span class="svelte-1mxltt0"> </span></button>'),Yc=ea('<div class="steps-indicator-container svelte-1mxltt0"><button aria-label="Scroll to previous steps"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="svelte-1mxltt0"><path d="M12.8333 16.6668C12.68 16.6668 12.5266 16.5935 12.4266 16.4601L9.42663 12.2935C9.36482 12.2081 9.33154 12.1055 9.33154 12.0001C9.33154 11.8948 9.36482 11.7921 9.42663 11.7068L12.4266 7.54012C12.4651 7.48671 12.5138 7.44142 12.5698 7.40682C12.6259 7.37222 12.6882 7.349 12.7532 7.33848C12.8182 7.32795 12.8846 7.33033 12.9487 7.34549C13.0128 7.36064 13.0732 7.38826 13.1266 7.42678C13.18 7.46531 13.2253 7.51397 13.2599 7.56999C13.2945 7.62602 13.3177 7.68831 13.3283 7.75331C13.3388 7.81831 13.3364 7.88475 13.3213 7.94883C13.3061 8.01291 13.2785 8.07338 13.24 8.12678L10.4466 12.0001L13.2333 15.8735C13.2864 15.9479 13.3181 16.0355 13.3251 16.1267C13.332 16.2179 13.314 16.3092 13.2728 16.3909C13.2316 16.4725 13.1689 16.5414 13.0915 16.59C13.014 16.6386 12.9247 16.6652 12.8333 16.6668Z" fill="#030303" class="svelte-1mxltt0"></path></svg></button> <div role="group" aria-roledescription="Sequence navigation buttons"></div> <button aria-label="Scroll to next steps"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="svelte-1mxltt0"><path d="M11.1668 16.6666C11.0668 16.6666 10.9601 16.6333 10.8734 16.5733C10.8199 16.5348 10.7746 16.4862 10.7399 16.4302C10.7053 16.3741 10.682 16.3118 10.6715 16.2468C10.6609 16.1818 10.6634 16.1153 10.6786 16.0512C10.6938 15.9871 10.7215 15.9266 10.7601 15.8733L13.5534 11.9999L10.7601 8.12661C10.6001 7.89994 10.6468 7.59328 10.8734 7.42661C11.1001 7.26661 11.4068 7.31994 11.5734 7.53994L14.5734 11.7066C14.7001 11.8799 14.7001 12.1133 14.5734 12.2933L11.5734 16.4599C11.4734 16.5933 11.3201 16.6666 11.1668 16.6666Z" fill="#030303" class="svelte-1mxltt0"></path></svg></button></div>');const Qc={hash:"svelte-1mxltt0",code:'.steps-indicator-container.svelte-1mxltt0 {width:calc(100% - 32px);position:absolute;bottom:12px;left:16px;animation-duration:0.75s;animation-timing-function:cubic-bezier(0.36, 0, 0, 1);animation-fill-mode:both;animation-delay:0.15s;\n animation-name: svelte-1mxltt0-gallery-steps-appear-anim;}.steps-indicator.svelte-1mxltt0 {--stepSize: 6px;--stepPadding: 7px;padding:4px 0px;display:flex;gap:8px;align-items:center;overflow-x:auto;pointer-events:all;scrollbar-width:none;}.steps-indicator.with-duration.svelte-1mxltt0 .step-button:where(.svelte-1mxltt0) span:where(.svelte-1mxltt0) {position:relative;overflow:hidden;}.steps-indicator.with-duration.svelte-1mxltt0 .step-button:where(.svelte-1mxltt0) span:where(.svelte-1mxltt0):after {transition:0.3s ease-in-out;transition-property:opacity, width;}.step-button.svelte-1mxltt0 {padding:8px 12px;border:#E4E5E8 solid 1px;background-color:#FBFBFB;cursor:pointer;pointer-events:all;flex-shrink:0;border-radius:100px;font-size:12px;font-weight:500;line-height:16px;color:#030303;transition:all 0.3s ease-in-out;outline-color:#3191fc;}.step-button.active.svelte-1mxltt0 {background-color:#014FD3;color:#FFFFFF;box-shadow:none;border-color:#014FD3;}.step-button.active.svelte-1mxltt0:after {opacity:100%;\n animation: svelte-1mxltt0-stepDurationAnimation var(--stepDuration) linear forwards;animation-play-state:running;}.step-button.svelte-1mxltt0:hover:not(.active) {background:#F3F4F6;}.step-button.svelte-1mxltt0:active:not(.active) {background:#E4E5E8;}.step-button.svelte-1mxltt0:focus {outline-offset:4px;outline-width:2px;}.step-button.svelte-1mxltt0 span:where(.svelte-1mxltt0) {display:block;box-sizing:border-box;pointer-events:none;white-space:nowrap;}.step-button.svelte-1mxltt0 span:where(.svelte-1mxltt0):after {content:"";background-color:rgba(0, 0, 0, 0.6);position:absolute;border-radius:var(--stepSize);width:0;height:100%;top:0;left:-100%;opacity:0;transform:translateX(0);animation-play-state:paused;}.step-arrow.svelte-1mxltt0 {max-height:34px;position:absolute;padding-top:4px;padding-bottom:4px;z-index:10;bottom:4px;border:none;background-color:#FFF;pointer-events:none;cursor:pointer;opacity:0;}.step-arrow.svelte-1mxltt0:hover {background:#F6F6F7;}.step-arrow.svelte-1mxltt0:active {background:#E4E5E8;}.step-arrow-prev.svelte-1mxltt0 {padding-right:8px;padding-left:0;left:0;transform:translateX(-100%);\n animation: svelte-1mxltt0-arrow-left-disappear 0.3s cubic-bezier(0.36, 0, 0, 1) both;}.step-arrow-prev.visible.svelte-1mxltt0 {pointer-events:auto;\n animation: svelte-1mxltt0-arrow-left-appear 0.3s cubic-bezier(0.36, 0, 0, 1) both;}.step-arrow-next.svelte-1mxltt0 {padding-right:0;padding-left:8px;right:0;transform:translateX(100%);\n animation: svelte-1mxltt0-arrow-right-disappear 0.3s cubic-bezier(0.36, 0, 0, 1) both;}.step-arrow-next.visible.svelte-1mxltt0 {pointer-events:auto;\n animation: svelte-1mxltt0-arrow-right-appear 0.3s cubic-bezier(0.36, 0, 0, 1) both;}\n\n@keyframes svelte-1mxltt0-gallery-steps-appear-anim {\n from {\n opacity: 0;\n transform: translate(0, 10px);\n }\n to {\n opacity: 1;\n transform: translate(0, 0);\n }\n}\n@keyframes svelte-1mxltt0-gallery-steps-disappear-anim {\n from {\n opacity: 1;\n transform: translate(0, 0);\n }\n to {\n opacity: 0;\n transform: translate(0, 10px);\n }\n}\n@keyframes svelte-1mxltt0-arrow-left-appear {\n from {\n opacity: 0;\n transform: translateX(-100%);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n@keyframes svelte-1mxltt0-arrow-left-disappear {\n from {\n opacity: 1;\n transform: translateX(0);\n }\n to {\n opacity: 0;\n transform: translateX(-100%);\n }\n}\n@keyframes svelte-1mxltt0-arrow-right-appear {\n from {\n opacity: 0;\n transform: translateX(100%);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n@keyframes svelte-1mxltt0-arrow-right-disappear {\n from {\n opacity: 1;\n transform: translateX(0);\n }\n to {\n opacity: 0;\n transform: translateX(100%);\n }\n}\n@keyframes svelte-1mxltt0-stepDurationAnimation {\n 0% {\n transform: translateX(0);\n }\n 100% {\n transform: translateX(100%);\n }\n}'};function Jc(e,t){ji(t,!0),Ea(e,Qc);const n=16,i=32,r=Ui("state");let o=xo(null),s=xo(null),a=xo(!1),l=xo(!1);const c=co((()=>{let e=[];return e=r().currentItem.modules.map(((e,t)=>({index:t,type:t===r().activeModuleIndex?"active":"",name:e.name}))),e}));function u(){Us(o)&&(_o(a,Us(o).scrollLeft>3),_o(l,Us(o).scrollLeft+Us(o).clientWidth<Us(o).scrollWidth-3))}function d(e){Us(o).scrollBy({left:e,behavior:"smooth"})}function h(e,t){const r=e.getBoundingClientRect(),o=t.getBoundingClientRect(),s=n+i;o.left<r.left+i?d(o.left-r.left-s):o.right>r.right-i&&d(o.right-r.right+s)}function f(){const e=Array.from(Us(o).querySelectorAll(".step-button")).find((e=>{const t=e.getBoundingClientRect(),n=Us(o).getBoundingClientRect();return t.left>n.left+i}));if(e){const t=e.previousElementSibling;t&&h(Us(o),t)}}function p(){const e=Array.from(Us(o).querySelectorAll(".step-button")).reverse().find((e=>{const t=e.getBoundingClientRect(),n=Us(o).getBoundingClientRect();return t.right<n.right-i}));if(e){const t=e.nextElementSibling;t&&h(Us(o),t)}}Zo((()=>{if(Us(o)){u();const e=new MutationObserver((()=>{const e=Us(o).querySelector(".step-button.active");e&&_o(s,e,!0)}));return e.observe(Us(o),{attributes:!0,attributeFilter:["class"],subtree:!0}),()=>{e.disconnect()}}})),Zo((()=>{Us(s)&&Us(o)&&h(Us(o),Us(s))}));var m=ta();Xs("resize",Po,u),function(e,t,n){gi&&ki();var i=new va(e);rs((()=>{var e=t();i.ensure(e,n)}))}(jo(m),(()=>r().activeItemIndex),(e=>{var t=Yc(),n=Uo(t);let i;n.__click=f;var s=qo(n,2);let d;wa(s,21,(()=>Us(c)),ka,((e,t)=>{var n=Xc();let i;n.__click=e=>{return n=e.currentTarget,i=Us(t).index,r().activeModuleIndex=i,void h(Us(o),n);var n,i};var s=Uo(n),a=Uo(s,!0);xi(s),xi(n),is((()=>{i=Oa(n,1,"step-button svelte-1mxltt0",null,i,{active:"active"===Us(t).type}),qa(n,"aria-label",`Go to step $${Us(t).index+1}`),ca(a,Us(t).name)})),na(e,n)})),xi(s),Ja(s,(e=>_o(o,e)),(()=>Us(o)));var m=qo(s,2);let v;m.__click=p,xi(t),is(((e,t)=>{i=Oa(n,1,"step-arrow step-arrow-prev svelte-1mxltt0",null,i,{visible:Us(a)}),d=Oa(s,1,"steps-indicator svelte-1mxltt0",null,d,e),Ra(s,`--stepDuration: ${null!=t?t:""}s`),v=Oa(m,1,"step-arrow step-arrow-next svelte-1mxltt0",null,v,{visible:Us(l)})}),[()=>({"with-duration":r().currentModule.hasDuration,paused:r().paused}),()=>r().currentModule.duration]),Xs("scroll",s,u),na(e,t)})),na(e,m),qi()}Ys(["click"]);const Zc="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",eu="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 tu=ea('<img alt="Play" class="svelte-a3r6re"/>'),nu=ea('<img alt="Pause" class="svelte-a3r6re"/>'),iu=ea('<button class="pause-button svelte-a3r6re"><!></button>');const ru={hash:"svelte-a3r6re",code:".pause-button.svelte-a3r6re {position:absolute;top:10px;right:10px;background:#FFFFFF;border-radius:100%;border:1px #C4C8CF solid;padding:0;width:32px;height:32px;display:flex;justify-content:center;align-items:center;pointer-events:auto;transition:background 0.2s ease-in-out;cursor:pointer;outline-color:#3191fc;}.pause-button.svelte-a3r6re:hover {background:#F6F6F7;}.pause-button.svelte-a3r6re:active {background:#E4E5E8;}.pause-button.svelte-a3r6re:focus {outline-offset:8px;outline-width:2px;}.pause-button.svelte-a3r6re img:where(.svelte-a3r6re) {width:16px;height:16px;pointer-events:none;}"};Ys(["click"]);const ou=300,su=60,au="none";function lu(e,t,n){return e.addEventListener(t,n),()=>e.removeEventListener(t,n)}function cu(e,t,n){const{x:i,y:r}=function(e,t){const n=e.getBoundingClientRect();return{x:Math.round(t.clientX-n.left),y:Math.round(t.clientY-n.top)}}(e,t);return{event:t,pointersCount:n.length,target:t.target,x:i,y:r,attachmentNode:e}}function uu(e,t,n,i,r){const o=cu(e,n,i);return e.dispatchEvent(new CustomEvent(`${t}${r}`,{detail:o})),o}function du(){let e=[],t=()=>{},n=[];return{setPointerControls:(i,r,o,s,a,l=au,c=[])=>{var u;if(r.style.touchAction=(u=l,Array.isArray(u)?u:[u]).join(" "),n=c,n.forEach((t=>{var n;null===(n=t.onInit)||void 0===n||n.call(t,e)})),!e.length){let l=function(t){e.push(t);const l=uu(r,i,t,e,"down");function c(t){const o=e.length;e=function(e,t){return t.filter((t=>Oo(e.pointerId,t.pointerId,!1)))}(t,e);if(o>e.length){e.length||(u(),d(),h(),f());const o=uu(r,i,t,e,"up");null==a||a(e,t),setTimeout((()=>{n.forEach((t=>{var n;null===(n=t.onUp)||void 0===n||n.call(t,o,e)}))}))}}null==s||s(e,t),setTimeout((()=>{n.forEach((t=>{var n;null===(n=t.onDown)||void 0===n||n.call(t,l,e)}))}));const u=lu(r,"pointermove",(t=>{e=e.map((e=>Oo(t.pointerId,e.pointerId)?t:e));const s=uu(r,i,t,e,"move");null==o||o(e,t),n.forEach((t=>{var n;null===(n=t.onMove)||void 0===n||n.call(t,s,e)}))})),d=lu(r,"lostpointercapture",(e=>{c(e)})),h=lu(r,"pointerup",(e=>{c(e)})),f=lu(r,"pointerleave",(e=>{c(e)}))};t=lu(r,"pointerdown",l)}return{destroy:()=>{e.length||(t(),n.forEach((e=>{var t;null===(t=e.onDestroy)||void 0===t||t.call(e)})))}}}}}const hu="@attach";const fu="swipe";function pu(e,t,n,i=!1){const{setPointerControls:r}=du(),o=i?fu:Symbol(hu);return{...n,[`on${fu}`]:e,[o]:e=>{const{onDown:n,onUp:i,parameters:o}=function(e,t){const n={timeframe:ou,minSwipeDistance:su,touchAction:au,composed:!1,...t};let i,r,o,s;function a(e,t){r=t.clientX,o=t.clientY,i=Date.now(),Oo(e.length,1)&&(s=t.target)}function l(t,a){if(Oo(a.type,"pointerup")&&Oo(t.length,0)&&Date.now()-i<n.timeframe){const t=a.clientX-r,i=a.clientY-o,l=Math.abs(t),c=Math.abs(i);let u=null;l>=2*c&&l>n.minSwipeDistance?u=t>0?"right":"left":c>=2*l&&c>n.minSwipeDistance&&(u=i>0?"bottom":"top"),u&&e.dispatchEvent(new CustomEvent(fu,{detail:{direction:u,target:s,pointerType:a.pointerType}}))}}return{onDown:a,onUp:l,parameters:n}}(e,null==t?void 0:t());return r(fu,e,null,n,i,o.touchAction,o.plugins).destroy}}}const mu=e=>{const t="#00ff00",n=1e6,i=4;let r,o,s,a=null,l=!1,c=Date.now();const u={x:void 0,y:void 0};function d(){const t=e.fadeTime,n=Date.now(),i=n-c;i>t/20&&(a&&o&&s&&r&&(s.drawImage(r,0,0),a.clearRect(0,0,r.width,r.height),a.globalAlpha=1-3*i/t,a.drawImage(o,0,0),a.globalAlpha=1,s.clearRect(0,0,r.width,r.height)),c=n),l&&requestAnimationFrame(d)}function h(e){u.x=e.x,u.y=e.y}function f(){a&&o&&r&&(a.canvas.width=window.innerWidth,a.canvas.height=window.innerHeight,o.width=r.width,o.height=r.height)}function p(t){var i;m(),r=window.document.createElement("canvas"),r.id="svelte-gestures-highlight-plugin",a=r.getContext("2d"),r.style.cssText=`\ndisplay: block; \nwidth: 100dvw;\nheight: 100dvh;\ntop: 0;\nleft: 0;\nposition: fixed;\npointer-events: none;\nz-index: ${null!==(i=e.zIndex)&&void 0!==i?i:n};\n`,window.document.body.appendChild(r),window.addEventListener("resize",f),t&&h(t.event),o=document.createElement("canvas"),f(),s=o.getContext("2d"),l=!0,d()}function m(){var e;l=!1,null===(e=window.document.getElementById("svelte-gestures-highlight-plugin"))||void 0===e||e.remove(),window.removeEventListener("resize",f)}return{onMove:n=>{var r,o,s;r=n.event,a&&(a.beginPath(),a.lineWidth=null!==(o=e.lineWidth)&&void 0!==o?o:i,a.lineCap="round",a.strokeStyle=null!==(s=e.color)&&void 0!==s?s:t,Oo(u.x,void 0,!1)&&Oo(u.y,void 0,!1)?(a.moveTo(u.x,u.y),h(r),a.lineTo(u.x,u.y)):h(r),a.stroke())},onDown:e=>{p(e)},onUp:(e,t)=>{Oo(t.length,0)&&m()},onDestroy:m,onInit:e=>{e.length&&(u.x=void 0,u.y=void 0,p())}}};var vu=ea("<div></div>");const gu={hash:"svelte-1fv6njc",code:".swiper.svelte-1fv6njc {position:absolute;top:0;left:0;pointer-events:auto;width:100%;height:100%;}"};var yu=ea("<img/>"),bu=ea('<div class="ui-container svelte-1rvgxfc"><!></div>'),ku=ea('<div class="cover-container svelte-1rvgxfc"><!> <!> <!></div>'),xu=ea('<div class="covers-container svelte-1rvgxfc" style="scroll-behavior: auto;"></div>');const wu={hash:"svelte-1rvgxfc",code:".covers-container.svelte-1rvgxfc {position:absolute;top:0;left:0;bottom:0;right:0;overflow-x:auto;overflow-y:hidden;scroll-snap-type:x mandatory;display:flex;gap:0.5px;}.covers-container.svelte-1rvgxfc::-webkit-scrollbar {display:none;}.cover-container.svelte-1rvgxfc {position:relative;display:flex;width:100%;height:100%;flex-shrink:0;scroll-snap-align:center;user-select:none;justify-content:center;align-items:center;}.cover-image.svelte-1rvgxfc {width:var(--videoWidth);height:var(--videoHeight);aspect-ratio:var(--videoAspect);object-fit:cover;pointer-events:none;background:#ffffff;}.cover-image.hidden.svelte-1rvgxfc {opacity:0;}.cover-image.hidden.force-show.svelte-1rvgxfc {opacity:1;background:transparent;}.ui-container.svelte-1rvgxfc {position:absolute;top:0;left:0;bottom:0;right:0;pointer-events:none;}"};function _u(e,t){ji(t,!0),Ea(e,wu);const n=[375,768,1024,1400,1920];let i=el(t,"scrollOffset",15),r=el(t,"isMobile",3,!1);const o=Ui("state");let s,a=co((()=>o().playingModulePosition)),l=null,c=null,u=co((()=>o().startedPlaying)),d=co((()=>o().currentModulesList)),h=co((()=>Us(d).findIndex((e=>f(o().playingModulePosition,e.position)))));function f(e,t){return e.itemIndex===t.itemIndex&&e.moduleIndex===t.moduleIndex}function p(e){const t=e.scrollLeft,n=e.scrollWidth-e.clientWidth;return 0===t?0:t>n?100:t/n*100}function m(e){var t;r()&&e.preventDefault();const{target:n}=e,u=p(n),m=(null===(t=Us(d))||void 0===t?void 0:t.length)||1,v=100/(m-1||1),g=Math.round(u/v);let y=Math.min(g,m-1);const b=Us(d)[y],k={itemIndex:o().activeItemIndex,moduleIndex:o().activeModuleIndex};if(!l){const e=s.children[Us(h)],t=s.getBoundingClientRect(),n=e.getBoundingClientRect();i(n.x-t.x)}c&&clearTimeout(c),c=setTimeout((()=>{const e=p(n);Math.abs(e-g*v)<.25&&async function(){o().seeking&&(o().playerLoaded?o().currentItemsList[o().activeItemIndex].modules[o().activeModuleIndex].play():o().playingModulePosition=Us(a),i(0))}()}),l?0:150),null!==l||f(b.position,k)?null!==l&&f(b.position,l)&&(l=null):(o().activeItemIndex=b.position.itemIndex,o().activeModuleIndex=b.position.moduleIndex),_o(a,b.position)}function v(){}Zo((()=>{const{activeItemIndex:e,activeModuleIndex:t}=o();e===Us(a).itemIndex&&t===Us(a).moduleIndex||Vs((()=>{var n,i;const r=Us(d).findIndex((n=>{const{itemIndex:i,moduleIndex:r}=n.position;return e===i&&t===r}));l=(null===(n=Us(d)[r])||void 0===n?void 0:n.position)||null;const o=null===(i=s)||void 0===i||null===(i=i.children)||void 0===i?void 0:i[r];if(!s||!o)return;const a=s.getBoundingClientRect(),c=o.getBoundingClientRect();let u=s.scrollLeft+(c.left-a.left);const h=Math.max(0,s.scrollWidth-s.clientWidth);u=Math.max(0,Math.min(h,u)),s.scrollTo({left:u,behavior:"auto"})}))})),Zo((()=>{Us(u)&&Vs((()=>{}))}));var g=ta(),y=jo(g),b=e=>{var i=xu();wa(i,23,(()=>Us(d)),(e=>e.id),((e,i,o)=>{var s=ku(),a=Uo(s),l=e=>{var r=yu();let s;is((e=>{s=Oa(r,1,"cover-image svelte-1rvgxfc",null,s,{hidden:Us(u)&&Us(o)===Us(h),"force-show":Us(i).showCover}),qa(r,"src",e),qa(r,"alt",Us(i).name),qa(r,"fetchpriority",0===Us(o)?"high":"auto")}),[()=>t.gallery.getCoverUrl(Us(i).cover,n[n.length-1])]),Xs("load",r,(function(...e){var t;null===(t=0===Us(o)?v:()=>{})||void 0===t||t.apply(this,e)})),function(e){if(!gi)return;e.removeAttribute("onload"),e.removeAttribute("onerror");const t=e.__e;void 0!==t&&(e.__e=void 0,queueMicrotask((()=>{e.isConnected&&e.dispatchEvent(t)})))}(r),na(e,r)};ba(a,(e=>{e(l)}));var c=qo(a,2),d=e=>{!function(e,t){ji(t,!0),Ea(e,gu);const n={color:"#e3e3e3",fadeTime:300,lineWidth:8};function i(e){const{direction:n}=e.detail;var i;if("left"===n)null===(i=t.gallery)||void 0===i||i.next(),t.onEvent("swipe",[-1,0]);else if("right"===n){var r;null===(r=t.gallery)||void 0===r||r.prev(),t.onEvent("swipe",[1,0])}}var r=vu();Va(r,(e=>({...e,class:"swiper"})),[()=>pu(i,(()=>({touchAction:"pan-y",plugins:t.debug?[mu(n)]:[]})))],void 0,void 0,"svelte-1fv6njc"),na(e,r),qi()}(e,{get gallery(){return t.gallery},get debug(){return t.debug},get onEvent(){return t.onEvent}})};ba(c,(e=>{r()&&e(d)}));var f=qo(c,2),p=e=>{var t=bu();!function(e,t,n){gi&&ki();var i=new va(e);rs((()=>{var e,r=null!==(e=t())&&void 0!==e?e:null;i.ensure(r,r&&(e=>n(e,r)))}),Kn)}(Uo(t),(()=>Us(i).Component),((e,t)=>{t(e,{get state(){return Us(i).state},get isMobile(){return r()}})})),xi(t),na(e,t)};ba(f,(e=>{var t;null!==(t=Us(i))&&void 0!==t&&t.Component&&e(p)})),xi(s),na(e,s)})),xi(i),Ja(i,(e=>s=e),(()=>s)),Xs("scroll",i,m),na(e,i)};ba(y,(e=>{Us(d)&&e(b)})),na(e,g),qi()}const Tu="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{};let Iu;function Eu(){const e=Tu&&Tu.navigator&&(Tu.navigator.userAgent||Tu.navigator.platform||Tu.navigator.vendor)||"";if(Iu&&Iu.ua===e)return Iu;const t=e.toLowerCase(),n=t.includes("android"),i=t.includes("iphone")||t.includes("ipad")||t.includes("ipod")||t.includes("ios"),r=n||i||t.includes("mobile");return Iu={ua:e,isMobile:r},Iu}"undefined"!=typeof window&&window.addEventListener("pageshow",(function(e){e.persisted&&setTimeout((function(){window.location.reload()}),10)}),!1);var Su=ea('<div class="paging-buttons svelte-1n46o8q"><!> <!></div>'),Au=ea('<div style="position: absolute; top: 0; left: 0; width: 100%;"></div>'),Nu=ea("<!> <!>",1),Mu=ea('<div class="player-container svelte-1n46o8q"><div class="player-div swipable svelte-1n46o8q"></div> <!> <!> <!> <!></div> <!>',1),Fu=ea('<div class="eko-gallery-app svelte-1n46o8q"><!></div>');const Cu={hash:"svelte-1n46o8q",code:'.eko-gallery-app.svelte-1n46o8q {position:relative;width:100%;height:100%;display:flex;flex-direction:column;box-sizing:border-box;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;}.eko-gallery-app.svelte-1n46o8q:hover .paging-buttons:where(.svelte-1n46o8q) .nav-button {background-color:#FFFFFF;box-shadow:0 0 8px 0 rgba(0, 0, 0, 0.12);}.eko-gallery-app.svelte-1n46o8q * {box-sizing:border-box;touch-action:pan-y;font-family:"Human BBY Digital", sans-serif;}.player-container.svelte-1n46o8q {position:relative;flex:1;width:100%;pointer-events:none;overflow:hidden;display:flex;align-items:center;justify-content:center;}.player-div.svelte-1n46o8q {position:absolute;width:var(--videoWidth);height:var(--videoHeight);aspect-ratio:var(--videoAspect);}.swipable.svelte-1n46o8q {will-change:transform;transform:translate3d(var(--uiTranformX, 0), 0, 0);}.paging-buttons.svelte-1n46o8q {position:absolute;top:0;left:0;bottom:0;right:0;display:flex;justify-content:space-between;align-items:center;pointer-events:none;padding:0 12px;}.paging-buttons.svelte-1n46o8q .nav-button {transition:0.2s ease-in-out;box-shadow:none;}.paging-buttons.svelte-1n46o8q .nav-button img {opacity:0.6;}'};function Ou(e,t){ji(t,!0),Ea(e,Cu);const n=el(t,"config",19,(()=>({}))),i=el(t,"forceMobile",3,!1),r=el(t,"videoAspectRatio",3,"unset"),o=el(t,"onGalleryReady",3,(()=>{})),s=el(t,"onEvent",3,(()=>{}));let a,l=!1,c=xo(new Dc(n())),u=xo(null),d=co((()=>i()||Eu().isMobile)),h=xo(0),f=xo(void 0),p=xo(!0),m=xo(No({width:"100%",height:"100%"}));var v,g,y;function b(){const e={AssetsDeliveryService:{assetsDeliveryServiceUrl:Us(c).urls.assetsDeliveryBase}};_o(u,new t.EkoPlayer(a,Object.assign(e,t.playerOptions))),Us(u).on("playing",(()=>{Us(c).state.paused=!1})),Us(u).on("pause",(()=>{Us(c).state.paused=!0})),Us(u).once("playing",(()=>{Us(c).state.startedPlaying=!0,s()("galleryloaded")}))}function k(e){var t;null===(t=Us(c))||void 0===t||t.selectItem(e)}function x(){var e;null===(e=Us(c))||void 0===e||e.next()}function w(){var e;null===(e=Us(c))||void 0===e||e.prev()}function _(){Us(u).paused?Us(u).play():Us(u).pause()}function T(){return`--uiTranformX: ${Us(h)}px;--videoAspect: ${r()};--videoWidth: ${Us(m).width};--videoHeight: ${Us(m).height};`}v="state",g=()=>Us(c).state,Vi("setContext").set(v,g),y=()=>(o()(Us(c).public),n()&&t.EkoPlayer&&(b(),Us(c).start(Us(u)),console.log("[EkoGallery] gallery.start() called with config",n())),()=>{var e;null===(e=Us(u))||void 0===e||e.dispose(),console.log("[EkoGallery] dispose()")}),null===Di&&di("onMount"),Zo((()=>{const e=Vs(y);if("function"==typeof e)return e})),Zo((()=>{n()&&t.EkoPlayer&&(l?Vs((()=>{var e;console.log("[EkoGallery] config changed, re-rendering with config:",n()),_o(c,new Dc(n())),null===(e=Us(u))||void 0===e||e.dispose(),_o(p,!1),$s().then((()=>(_o(p,!0),$s()))).then((()=>{o()(Us(c).public),b(),Us(c).start(Us(u)),console.log("[EkoGallery] called gallery.start() after re-rendering")}))})):l=!0)})),Zo((()=>{Us(f)&&Us(u)&&Us(u).loadDebugOverlay({containerElement:Us(f)})})),Zo((()=>{if("unset"!==r()&&r().includes("/")){const[e,t]=r().split("/").map((e=>Number(e)));isNaN(e)||isNaN(t)||_o(m,e>t?{width:"100%",height:"auto"}:{width:"auto",height:"100%"},!0)}else _o(m,{width:"100%",height:"100%"},!0)}));var I=Fu(),E=Uo(I),S=e=>{var n=Mu(),i=jo(n),r=Uo(i);Ja(r,(e=>a=e),(()=>a));var o=qo(r,2);_u(o,{get isMobile(){return Us(d)},get gallery(){return Us(c)},get debug(){return t.debug},get onEvent(){return s()},get scrollOffset(){return Us(h)},set scrollOffset(e){_o(h,e,!0)}});var l=qo(o,2),u=e=>{var t=Su(),n=Uo(t);Kc(n,{type:"prev",onClick:w}),Kc(qo(n,2),{type:"next",onClick:x}),xi(t),na(e,t)};ba(l,(e=>{Us(d)||t.hideNav||e(u)}));var p=qo(l,2),m=e=>{Jc(e,{})};ba(p,(e=>{var t;!Us(d)&&(null===(t=Us(c).state.currentItem)||void 0===t?void 0:t.modules.length)>1&&e(m)}));var v=qo(p,2),g=e=>{var n=Nu(),i=jo(n);!function(e,t){ji(t,!0),Ea(e,ru);const n=Ui("state");var i=iu();i.__click=function(...e){var n;null===(n=t.onPauseClick)||void 0===n||n.apply(this,e)};var r=Uo(i),o=e=>{var t=tu();is((()=>qa(t,"src",Zc))),na(e,t)},s=e=>{var t=nu();is((()=>qa(t,"src",eu))),na(e,t)};ba(r,(e=>{n().paused?e(o):e(s,!1)})),xi(i),is((e=>qa(i,"aria-label",e)),[()=>n().paused?"Play":"Pause"]),na(e,i),qi()}(i,{onPauseClick:_});var r=qo(i,2),o=e=>{var t=Au();Ja(t,(e=>_o(f,e)),(()=>Us(f))),na(e,t)};ba(r,(e=>{t.debug&&e(o)})),na(e,n)};ba(v,(e=>{Us(c).state.startedPlaying&&e(g)})),xi(i);var y=qo(i,2),b=e=>{!function(e,t){ji(t,!0),Ea(e,qc);let n=el(t,"onNavItemClick",3,(()=>{}));const i=Ui("state");var r=jc(),o=Uo(r);wa(o,23,(()=>i().currentItemsList),(e=>e.id),((e,t,r)=>{var o=Uc();let s;o.__click=()=>n()(Us(r));var a=Uo(o),l=Uo(a,!0);xi(a),xi(o),is((e=>{s=Oa(o,1,"nav-button svelte-er27y2",null,s,e),ca(l,Us(t).name)}),[()=>({selected:Us(r)===i().activeItemIndex})]),na(e,o)})),xi(o),xi(r),na(e,r),qi()}(e,{onNavItemClick:k})};ba(y,(e=>{t.hideNav||e(b)})),is((e=>Ra(i,e)),[T]),na(e,n)};ba(E,(e=>{n()&&Us(p)&&e(S)})),xi(I),na(e,I),qi()}function Pu(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ru,Du,Lu,Bu,zu={exports:{}},Wu=Pu((Ru||(Ru=1,Lu=zu.exports,Bu=function(){var e=function(){},t="undefined",n=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],r={},o=null;function s(e,t){var n=e[t];if("function"==typeof n.bind)return n.bind(e);try{return Function.prototype.bind.call(n,e)}catch(t){return function(){return Function.prototype.apply.apply(n,[e,arguments])}}}function a(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function l(){for(var n=this.getLevel(),r=0;r<i.length;r++){var o=i[r];this[o]=r<n?e:this.methodFactory(o,n,this.name)}if(this.log=this.debug,typeof console===t&&n<this.levels.SILENT)return"No console available for logging"}function c(e){return function(){typeof console!==t&&(l.call(this),this[e].apply(this,arguments))}}function u(i,r,o){return"debug"===(l=i)&&(l="log"),typeof console!==t&&("trace"===l&&n?a:void 0!==console[l]?s(console,l):void 0!==console.log?s(console,"log"):e)||c.apply(this,arguments);var l}function d(e,n){var s,a,c,d=this,h="loglevel";function f(){var e;if(typeof window!==t&&h){try{e=window.localStorage[h]}catch(e){}if(typeof e===t)try{var n=window.document.cookie,i=encodeURIComponent(h),r=n.indexOf(i+"=");-1!==r&&(e=/^([^;]+)/.exec(n.slice(r+i.length+1))[1])}catch(e){}return void 0===d.levels[e]&&(e=void 0),e}}function p(e){var t=e;if("string"==typeof t&&void 0!==d.levels[t.toUpperCase()]&&(t=d.levels[t.toUpperCase()]),"number"==typeof t&&t>=0&&t<=d.levels.SILENT)return t;throw new TypeError("log.setLevel() called with invalid level: "+e)}"string"==typeof e?h+=":"+e:"symbol"==typeof e&&(h=void 0),d.name=e,d.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},d.methodFactory=n||u,d.getLevel=function(){return null!=c?c:null!=a?a:s},d.setLevel=function(e,n){return c=p(e),!1!==n&&function(e){var n=(i[e]||"silent").toUpperCase();if(typeof window!==t&&h){try{return void(window.localStorage[h]=n)}catch(e){}try{window.document.cookie=encodeURIComponent(h)+"="+n+";"}catch(e){}}}(c),l.call(d)},d.setDefaultLevel=function(e){a=p(e),f()||d.setLevel(e,!1)},d.resetLevel=function(){c=null,function(){if(typeof window!==t&&h){try{window.localStorage.removeItem(h)}catch(e){}try{window.document.cookie=encodeURIComponent(h)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(e){}}}(),l.call(d)},d.enableAll=function(e){d.setLevel(d.levels.TRACE,e)},d.disableAll=function(e){d.setLevel(d.levels.SILENT,e)},d.rebuild=function(){if(o!==d&&(s=p(o.getLevel())),l.call(d),o===d)for(var e in r)r[e].rebuild()},s=p(o?o.getLevel():"WARN");var m=f();null!=m&&(c=p(m)),l.call(d)}(o=new d).getLogger=function(e){if("symbol"!=typeof e&&"string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=r[e];return t||(t=r[e]=new d(e,o.methodFactory)),t};var h=typeof window!==t?window.log:void 0;return o.noConflict=function(){return typeof window!==t&&window.log===o&&(window.log=h),o},o.getLoggers=function(){return r},o.default=o,o},(Du=zu).exports?Du.exports=Bu():Lu.log=Bu()),zu.exports));const $u=()=>{},Uu=["trace","log","debug","info","warn","error","getLevel","setLevel"],ju=["trace","debug","info","warn","error","silent"],qu={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;"},Vu="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global;let Gu={level:"trace",appName:""},Hu=[];const Ku="object"==typeof Vu&&Vu.performance&&"function"==typeof Vu.performance.now?Vu.performance.now.bind(Vu.performance):Date.now.bind(Date),Xu=e=>e&&"string"==typeof e?e.toLowerCase().trim():"",Yu=(()=>{try{const e=new URLSearchParams(document.location.search),t=[].concat(e.getAll("log")).concat(e.getAll("ekolog")).concat(e.getAll("ekologger")).join(",").split(",");if(0===t.length)return{};let n={};return t.forEach((e=>{const[t,i]=e.split(":");n[Xu(t)]=Xu(i)||"trace"})),n}catch(e){return{}}})(),Qu=(e,t="")=>{const n=Xu(e),i=Wu.getLogger(n);if(i.__ekologger)return i.__ekologger;t||Yu[n]||Yu["*"]||(i.__noExplicitLevel=!0);const r=i.methodFactory;i.methodFactory=(t,n,i)=>{const o=r(t,n,i),s=t.toUpperCase();return(...t)=>{o(`[${((e,t=3)=>(Ku()/1e3).toFixed(t))()}] %c[${s}] ${Gu.appName?`[${Gu.appName}] `:""}[${e}]`,qu[s],...t)}},t=Yu[n]||Yu["*"]||t||Gu.level,i.setLevel(t,!1);const o=(...e)=>i.log(...e);return Uu.forEach((e=>{o[e]=(...t)=>(Hu.forEach((n=>{n[e](...t)})),i[e](...t))})),i.__ekologger=o,o};Qu.setDefaults=({appName:e="",level:t})=>{e&&"string"==typeof e&&(Gu.appName=e),(t=Xu(t))&&ju.includes(t)&&(Gu.level=t,Object.values(Wu.getLoggers()).filter((e=>e.__noExplicitLevel)).forEach((e=>e.setLevel(Gu.level,!1))))},Qu.installDriver=e=>{const t={...Uu.reduce(((t,n)=>(t[n]="function"==typeof(null==e?void 0:e[n])?e[n]:$u,t)),{})};Hu.push(t)};let Ju=class{#T=new Map;on(e,t){if("function"!=typeof t)return this;const n=this.#T.get(e)||new Set;return n.add(t),this.#T.set(e,n),this}once(e,t){if("function"!=typeof t)return this;const n=(...i)=>(this.off(e,n),t(...i));return this.on(e,n)}off(e,t){if(!e)return this.#T.clear(),this;const n=this.#T.get(e);return n?t?(n.delete(t),0===n.size&&this.#T.delete(e),this):(this.#T.delete(e),this):this}trigger(e,...t){const n=this.#T.get(e);return n?(n.forEach((e=>e(...t))),this):this}};function Zu(e){return"[object Object]"===Object.prototype.toString.call(e)}function ed(e,...t){const n=Zu(e)?{...e}:{};return t.forEach((e=>{Zu(e)&&Object.keys(e).forEach((t=>{const i=e[t],r=n[t];Zu(i)&&Zu(r)?n[t]=ed(r,i):Array.isArray(i)?n[t]=i.slice():n[t]=i}))})),n}function td(e){if("string"==typeof e)return`'${e}'`;if(Array.isArray(e))return`[${e.map((e=>td(e))).join(", ")}]`;if(Zu(e))try{return JSON.stringify(e)}catch(e){return"[object Object]"}return null===e?"null":void 0===e?"undefined":String(e)}function nd(e){return Array.from(e).map((e=>td(e))).join(", ")}var id=new WeakSet;let rd=class extends Ju{constructor(...e){super(),O(this,id);const t=e.length?e[e.length-1]:void 0,n=this.name;if(!n||"string"!=typeof n)throw new Error("Extending classes must implement get name() returning a string.");this.log=Qu(n,this.loglevel);const i=Zu(this.defaults)?this.defaults:{},r=Zu(t)&&Zu(t[n])?t[n]:{};this.settings=ed({},i,r),A(id,this,od).call(this),A(id,this,sd).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 od(){const e=new Set,t=this.methodsExcludedFromAutoLog;let n=Object.getPrototypeOf(this);for(;n&&n!==Object.prototype;){const i=Object.getOwnPropertyNames(n);for(let r=0;r<i.length;r+=1){const o=i[r];if("constructor"===o||o.startsWith("#"))continue;if(e.has(o))continue;const s=Object.getOwnPropertyDescriptor(n,o);if(!s||"function"!=typeof s.value)continue;const a=s.value.bind(this),l=!t.has(o);this[o]=l?(...e)=>(this.log&&"function"==typeof this.log.debug&&this.log.debug(`${this.name}.${o}(${nd(e)})`),a(...e)):a,e.add(o)}n=Object.getPrototypeOf(n)}}function sd(){if("undefined"==typeof window||"function"!=typeof window.addEventListener)return;const e=()=>{try{"function"==typeof this.dispose&&this.dispose()}catch(e){this.log&&"function"==typeof this.log.error&&this.log.error("dispose failed",e)}};window.addEventListener("pagehide",e),window.addEventListener("beforeunload",e),this._lifecycleCleanup=()=>{window.removeEventListener("pagehide",e),window.removeEventListener("beforeunload",e)}}const ad="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{};function ld(e){return Boolean(e)&&"object"==typeof e&&1===e.nodeType&&"function"==typeof e.appendChild}let cd=class extends rd{#I;#E;#S;get defaults(){return{style:{width:"100%",height:"100%"},contextAttributes:{alpha:!1,depth:!1,stencil:!1,antialias:!1,preserveDrawingBuffer:!1,powerPreference:"low-power"}}}constructor(...e){var t,n;super(...e);const[i]=e,r=function(e,t=(null==ad?void 0:ad.document)){if(ld(e))return e;const n="string"==typeof e?e:null;if(!n||!t||"function"!=typeof t.querySelector)return null;const i=t.querySelector(n);return ld(i)?i:null}(i);if(!r)throw new Error("Canvas requires a valid mount target (HTMLElement or selector string).");this.#I=r;const o=null==ad?void 0:ad.document;if(!o||"function"!=typeof o.createElement)throw new Error("Canvas requires document.createElement.");var s,a;this.#E=o.createElement("canvas"),s=this.#E,a=null===(t=this.settings)||void 0===t?void 0:t.style,s&&a&&"object"==typeof a&&!Array.isArray(a)&&Object.keys(a).forEach((e=>{const t=a[e];null!=t&&(s.style[e]=String(t))})),this.#I.appendChild(this.#E);const l=null===(n=this.settings)||void 0===n?void 0:n.contextAttributes,c=l&&"object"==typeof l&&!Array.isArray(l)?l:void 0;if(this.#S=this.#E.getContext("webgl2",c),!this.#S)throw new Error("Canvas WebGL2 context is not available.")}get name(){return"Canvas"}get element(){return this.#E}get gl(){return this.#S}onDispose(){this.#E&&this.#E.parentNode&&this.#E.parentNode.removeChild(this.#E),this.#S=null,this.#E=null,this.#I=null}};var ud=new WeakMap,dd=new WeakMap,hd=new WeakMap,fd=new WeakMap,pd=new WeakMap,md=new WeakMap,vd=new WeakSet;let gd=class extends rd{get name(){return"ContainerSize"}get containerWidth(){return M(dd,this)}get containerHeight(){return M(hd,this)}get width(){return M(dd,this)}get height(){return M(hd,this)}constructor(...e){super(...e),O(this,vd),F(this,ud,void 0),F(this,dd,0),F(this,hd,0),F(this,fd,null),F(this,pd,null),F(this,md,null);const[t]=e;var n;C(ud,this,(n=t)&&n.element&&ld(n.element)?n.element:ld(n)?n:null),M(ud,this)&&(A(vd,this,bd).call(this,!0),A(vd,this,yd).call(this))}onDispose(){M(fd,this)&&"function"==typeof M(fd,this).disconnect&&M(fd,this).disconnect(),C(fd,this,null),M(md,this)&&"function"==typeof(null==ad?void 0:ad.removeEventListener)&&ad.removeEventListener("resize",M(md,this)),C(md,this,null),M(pd,this)&&((null==ad?void 0:ad.clearInterval)||clearInterval)(M(pd,this)),C(pd,this,null),C(ud,this,null)}};function yd(){if(!M(ud,this))return;const e=null==ad?void 0:ad.ResizeObserver;if("function"==typeof e)return C(fd,this,new e((()=>A(vd,this,bd).call(this)))),void M(fd,this).observe(M(ud,this));C(md,this,(()=>A(vd,this,bd).call(this))),"function"==typeof(null==ad?void 0:ad.addEventListener)&&ad.addEventListener("resize",M(md,this));const t=(null==ad?void 0:ad.setInterval)||setInterval;C(pd,this,t((()=>A(vd,this,bd).call(this)),250))}function bd(e=!1){if(!M(ud,this))return;const{width:t,height:n}=function(e){const t=Number(null==e?void 0:e.clientWidth),n=Number(null==e?void 0:e.clientHeight);return{width:Number.isFinite(t)&&t>0?Math.round(t):0,height:Number.isFinite(n)&&n>0?Math.round(n):0}}(M(ud,this));(e||t!==M(dd,this)||n!==M(hd,this))&&(C(dd,this,t),C(hd,this,n),this.trigger("containerresize",{width:t,height:n}))}var kd={VIDEO_SOURCE_PREFIX:"__SRC_VID:",TEXTURE_SOURCE_PREFIX:"__SRC_TEXTURE:",PREVIOUS_OUTPUT_PREFIX:"__PREVIOUS:",SAVED_FRAME_PREFIX:"__SAVED_FRAME:",SYSTEM_NODES:{FILTERS:{RENDER_TO_CANVAS:"__default"},TAGS:{ATOM:"atom",FILTER:"filter",COMPOSITE_FILTER:"composite",TRANSITION_FILTER:"transition"}},MESSAGES:{UPDATE_OPTIONS:"update_options"}};let xd=class{constructor(e,t){this.canvasSource=e,this.startRendering=t,this.gl=null,this.glOptions=null}init(e,t,n){this.glOptions=n||{};const i=this.initCanvas(this.canvasSource,e,t);return this.initWebgl(i,this.glOptions)}initCanvas(){throw new Error("implement on concrete class")}getContextConfig(e={}){if(!e||"object"!=typeof e)return{contextType:"webgl",contextAttributes:void 0};const{contextType:t,contextAttributes:n,__shaderGraph:i,...r}=e;return{contextType:t||"webgl",contextAttributes:Object.prototype.hasOwnProperty.call(e,"contextAttributes")?n:r}}initWebgl(e,t={}){const{contextType:n,contextAttributes:i}=this.getContextConfig(t),r=e.getContext(n,i);if(!r)throw new Error(`Browser doesn't support ${n}`);return r.enable(r.BLEND),r.disable(r.DEPTH_TEST),r.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT),r}isStartRendering(){return this.startRendering}};var wd,_d={exports:{}},Td=(wd||(wd=1,function(e){var t=Object.prototype.hasOwnProperty,n="~";function i(){}function r(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,i,o,s){if("function"!=typeof i)throw new TypeError("The listener must be a function");var a=new r(i,o||e,s),l=n?n+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],a]:e._events[l].push(a):(e._events[l]=a,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function a(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),a.prototype.eventNames=function(){var e,i,r=[];if(0===this._eventsCount)return r;for(i in e=this._events)t.call(e,i)&&r.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},a.prototype.listeners=function(e){var t=n?n+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var r=0,o=i.length,s=new Array(o);r<o;r++)s[r]=i[r].fn;return s},a.prototype.listenerCount=function(e){var t=n?n+e:e,i=this._events[t];return i?i.fn?1:i.length:0},a.prototype.emit=function(e,t,i,r,o,s){var a=n?n+e:e;if(!this._events[a])return!1;var l,c,u=this._events[a],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,i),!0;case 4:return u.fn.call(u.context,t,i,r),!0;case 5:return u.fn.call(u.context,t,i,r,o),!0;case 6:return u.fn.call(u.context,t,i,r,o,s),!0}for(c=1,l=new Array(d-1);c<d;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var h,f=u.length;for(c=0;c<f;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),d){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,i);break;case 4:u[c].fn.call(u[c].context,t,i,r);break;default:if(!l)for(h=1,l=new Array(d-1);h<d;h++)l[h-1]=arguments[h];u[c].fn.apply(u[c].context,l)}}return!0},a.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},a.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},a.prototype.removeListener=function(e,t,i,r){var o=n?n+e:e;if(!this._events[o])return this;if(!t)return s(this,o),this;var a=this._events[o];if(a.fn)a.fn!==t||r&&!a.once||i&&a.context!==i||s(this,o);else{for(var l=0,c=[],u=a.length;l<u;l++)(a[l].fn!==t||r&&!a[l].once||i&&a[l].context!==i)&&c.push(a[l]);c.length?this._events[o]=1===c.length?c[0]:c:s(this,o)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,e.exports=a}(_d)),_d.exports),Id=Pu(Td);let Ed=class extends xd{constructor(e){super(e,!0),this.setSrcVidTracksFn=null,this.shouldUpdateTexture=!0,this.onPlayerSeeking=this.onPlayerSeeking.bind(this),this.onPlayerSeeked=this.onPlayerSeeked.bind(this),this.onPlayerNodeStart=this.onPlayerNodeStart.bind(this),this.oncePlayerPlaying=this.oncePlayerPlaying.bind(this);const t=new Id;this.on=t.on.bind(t),this.off=t.off.bind(t),this.once=t.once.bind(t),this.trigger=t.emit.bind(t)}onPlayerSeeking(){this.shouldUpdateTexture=!1}onPlayerSeeked(){this.shouldUpdateTexture=!0}onPlayerNodeStart(){this.shouldUpdateTexture=!0,"function"==typeof this.player.canvas.drawFrame&&this.player.canvas.drawFrame(),this.trigger("forcerender")}oncePlayerPlaying(){this.onPlayerNodeStart()}addPlayerListeners(){this.player&&(this.player.on("seeking",this.onPlayerSeeking),this.player.on("seeked",this.onPlayerSeeked),this.player.on("nodestart",this.onPlayerNodeStart),this.player.once("playing",this.oncePlayerPlaying))}removePlayerListeners(){this.player&&(this.player.off("seeking",this.onPlayerSeeking),this.player.off("seeked",this.onPlayerSeeked),this.player.off("nodestart",this.onPlayerNodeStart),this.player.off("playing",this.oncePlayerPlaying))}initCanvas(e,t,n){var i;this.player=e,this.setSrcVidTracksFn=t;const{contextType:r,contextAttributes:o}=this.getContextConfig(this.glOptions),s=!1!==(null===(i=this.glOptions)||void 0===i||null===(i=i.__shaderGraph)||void 0===i?void 0:i.forwardContextAttributes);const a={contextType:r};s&&void 0!==o&&(a.contextAttributes=o),e.initPlugin("canvas",a);const l={drawFrame:this.canvasDrawFrameFn.bind(this),resize:n,contextType:r,offscreenVideoCanvasEnabled:!1,viewportModeEnabled:!0,fps:0};return s&&void 0!==o&&(l.contextAttributes=o),e.canvas.init(l),e.paused&&0===e.currentTime&&(this.shouldUpdateTexture=!1),this.addPlayerListeners(),e.canvas.canvas}canvasDrawFrameFn(e,t,n){var i;this.setSrcVidTracksFn&&this.shouldUpdateTexture&&e&&t&&n&&(n.videoWidth||n.displayWidth)&&(n.videoHeight||n.displayHeight)&&(!(i=n)||"boolean"!=typeof i.isDataLoaded||i&&i.isDataLoaded&&(void 0===i.isFrameTextureReady||i.isFrameTextureReady))&&this.setSrcVidTracksFn(n)}async recover(){if(this.player&&this.player.paused)return new Promise((e=>{this.player.once("seeked",(()=>{this.shouldUpdateTexture=!0,e()})),this.player.currentTime=this.player.currentTime}))}dispose(){this.player&&(this.player.canvas&&"function"==typeof this.player.canvas.dispose&&this.player.canvas.dispose(),this.removePlayerListeners(),this.player=null)}},Sd=class extends xd{constructor(e){super(e,!1)}initCanvas(e,t){const n=function(){const e=document.querySelector("video");e&&e.videoHeight&&t(e),requestAnimationFrame(n)};return requestAnimationFrame(n),document.getElementById(e)}},Ad=class extends xd{constructor(e){super(e,!1)}initCanvas({src:e,dest:t},n,i){const r="string"==typeof t?document.querySelector(t):t,o="undefined"!=typeof HTMLVideoElement&&e instanceof HTMLVideoElement,s=()=>{this.isDisposed||(e&&e.videoHeight&&n(e),requestAnimationFrame(s))};return o?requestAnimationFrame(s):"function"==typeof e?e(n,i):n(e),r}dispose(){this.isDisposed=!0}};var Nd=function(e){let t;return t="string"==typeof e?new Sd(e):e&&e.src&&e.dest?new Ad(e):new Ed(e),t};function Md(e){return Array.isArray(e)||(e=[e]),e}let Fd=class{constructor(e){this.store=e?{...e.get()}:{}}reset(){this.store={}}get(e){if(!e)return this.store;const t=(e=Md(e)).reduce(((e,t)=>{const n=this.store[t];return e.push(n),e}),[]);return 1===t.length?t[0]:t}set(e,t){if(e=Md(e),t=Md(t),e.length!==t.length)throw new Error(`cant set values ${t} to keys ${e}, length did not match`);e.forEach(((e,n)=>{this.store[e]=t[n]}))}},Cd=class{constructor(e,t,n,i){this.gl=i.gl,this.unit=e,this.bindPoint=t,this.height=1080,this.width=1920,this.textureObject=n.object,this.textureObjectInfo=n,this.isStatic=!1,n.needRefresh&&this.setParameters()}getUnit(){return this.unit}getObject(){return this.textureObject}bind(){this.gl.bindTexture(this.bindPoint,this.textureObject)}fill(){throw new Error("impl in concrete class")}setParameters(){this.bind(),this.gl.texParameteri(this.bindPoint,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.bindPoint,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.bindPoint,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.bindPoint,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR)}active(){this.gl.activeTexture(this.gl.TEXTURE0+this.getUnit())}beforeUse(){this.active(),this.bind()}dispose(){this.gl.deleteTexture(this.textureObject)}setHeight(e){this.height=e}setWidth(e){this.width=e}getHeight(){if(!this.height)throw new Error(`texture ${this.unit} no height init `);return this.height}getWidth(){if(!this.width)throw new Error(`texture ${this.unit} no width init `);return this.width}};const Od=Qu("frame","warn");let Pd=!1;if("undefined"!=typeof window&&window.InterludePlayer){let e=window.InterludePlayer.environment,t=e.isAffectedBySafari17SeekBug,n=e.ua.includes("WMT1H")&&e.ua.includes("iOS/17");Pd=t||n}function Rd(e,t){const n=e.gl;var i;n.texImage2D(e.bindPoint,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,t),e.__hasAllocated=!0,i=e,Number.isFinite(i.width)&&Number.isFinite(i.height)&&(i.actualWidth=i.width,i.actualHeight=i.height,i.textureObjectInfo&&(i.textureObjectInfo.allocatedWidth=i.width,i.textureObjectInfo.allocatedHeight=i.height))}let Dd=class extends Cd{fill(e){if(Pd&&(e.paused||"undefined"!=typeof document&&"hidden"===document.visibilityState))return;if(e.__closed)return;this.bind();const t=function(e,t){let n=!e.__hasAllocated;return t?(t.width===e.width&&t.height===e.height||(n=!0),e.width=t.width,e.height=t.height,n):n}(this,function(e){if(!e)return;const t=[[e.displayWidth,e.displayHeight],[e.codedWidth,e.codedHeight],[e.videoWidth,e.videoHeight],[e.naturalWidth,e.naturalHeight],[e.width,e.height]];for(let e=0;e<t.length;e+=1){const[n,i]=t[e],r=Number(n),o=Number(i);if(Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0)return{width:r,height:o}}}(e)),n=performance.now();!function(e,t,n){const i=e.gl,r=function(e){if("undefined"!=typeof HTMLVideoElement&&e instanceof HTMLVideoElement)return!0;const t="object"==typeof window?window:"object"==typeof self?self:null,n=t&&t.VideoFrame;return"function"==typeof n&&e instanceof n}(t);r&&(e.__useSubImage=!1),n||!1===e.__useSubImage||r?Rd(e,t):(i.texSubImage2D(e.bindPoint,0,0,0,i.RGBA,i.UNSIGNED_BYTE,t),void 0===e.__useSubImage&&(i.getError()!==i.NO_ERROR?(e.__useSubImage=!1,Rd(e,t)):e.__useSubImage=!0))}(this,e,t);const i=(performance.now()-n)/1e3;i>=.1&&Od.warn(`[fill] texImage2D() took ${i.toFixed(3)} seconds to execute.`),"function"==typeof e.close&&!0!==e.__keepOpen&&(e.close(),e.__closed=!0)}},Ld=class extends Cd{constructor(e,t,n){super(...arguments),n.needRefresh&&(this.fill(null),n.needRefresh=!1)}fill(e){if(this.bind(),e&&e.tagName&&"IMG"===e.tagName){const t=Number(e.naturalWidth||e.width),n=Number(e.naturalHeight||e.height);this.gl.texImage2D(this.bindPoint,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e),Number.isFinite(t)&&Number.isFinite(n)&&(this.actualWidth=t,this.actualHeight=n,this.textureObjectInfo&&(this.textureObjectInfo.allocatedWidth=t,this.textureObjectInfo.allocatedHeight=n))}else{const t=this.gl.canvas.width,n=this.gl.canvas.height;this.gl.texImage2D(this.bindPoint,0,this.gl.RGBA,t,n,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e),Number.isFinite(t)&&Number.isFinite(n)&&(this.actualWidth=t,this.actualHeight=n,this.textureObjectInfo&&(this.textureObjectInfo.allocatedWidth=t,this.textureObjectInfo.allocatedHeight=n))}}};var Bd=function(e,t,n,i,r){let o;switch(e){case"frame":o=new Dd(t,n,i,r);break;case"pixel":o=new Ld(t,n,i,r);break;default:throw new Error(`cant recognize type ${e}`)}return o};let zd=class{constructor(e){return this.gl=e.gl,this.textureObjectPool=[],this.textureUnitsPool=new Set(Array(20).keys()),this.activeTextures=e.activeTextures instanceof Set?e.activeTextures:new Set,{createTexture:this.createTexture.bind(this),releaseTexture:this.releaseTexture.bind(this),refreshTextureObjects:this.refreshTextureObjects.bind(this),refreshActiveTextures:this.refreshActiveTextures.bind(this)}}getTextureObject(){return this.textureObjectPool.pop()||{object:this.gl.createTexture(),needRefresh:!0}}getTextureUnit(){const e=this.textureUnitsPool.values(),t=Math.min.apply(null,[...e]);return this.textureUnitsPool.delete(t),t}createTexture(e){const t=e&&e.type||{},n=this.gl.TEXTURE_2D,i=this.getTextureUnit(),r=this.getTextureObject(),o=Bd(t,i,n,r,{gl:this.gl});return this.activeTextures.add(o),o}releaseTexture(e){this.textureUnitsPool.has(e.getUnit())||(this.textureObjectPool.push({object:e.getObject(),needRefresh:!1}),this.textureUnitsPool.add(e.getUnit())),this.activeTextures.delete(e)}refreshTextureObjects(){this.textureObjectPool.forEach((e=>{e.needRefresh=!0}))}refreshActiveTextures(){const e=new Set;this.activeTextures.forEach((t=>{if(!t||"function"!=typeof t.getUnit)return;e.add(t.getUnit());const n={object:this.gl.createTexture(),needRefresh:!0};t.gl=this.gl,t.textureObjectInfo=n,t.textureObject=n.object,t.__hasAllocated=!1,t.__useSubImage=void 0,t.actualWidth=null,t.actualHeight=null,"function"==typeof t.setParameters&&t.setParameters()})),this.textureObjectPool=[],this.textureUnitsPool=new Set(Array(20).keys()),e.forEach((e=>{this.textureUnitsPool.delete(e)}))}};const Wd=kd.VIDEO_SOURCE_PREFIX,$d=kd.TEXTURE_SOURCE_PREFIX,Ud=kd.PREVIOUS_OUTPUT_PREFIX,jd=kd.SAVED_FRAME_PREFIX;function qd(e,t,n){e.set(`${Wd}${n}`,t)}function Vd(e,t,n){e.set(`${Ud}${n}`,t)}function Gd(e,t,n){e.set(`${jd}${n}`,t)}let Hd=class{constructor(e){return this.gl=e.gl,this.glSource=e.glSource,this.textureManager=e.textureManager,this.capturedFramesManager=e.capturedFramesManager,{setVideoSources:this.setVideoSources.bind(this),setTextureSource:this.setTextureSource.bind(this),getInput:this.getInput.bind(this),getPrevOutput:this.getPrevOutput.bind(this),setOutputs:this.setOutputs.bind(this),disposeTextures:this.disposeTextures.bind(this),disposeAllStore:this.disposeAllStore.bind(this)}}setVideoSources(e){for(const[t,n]of Object.entries(this.capturedFramesManager.getCurrentFrames()))qd(e,n,t),Vd(e,n,t);for(const[t,n]of Object.entries(this.capturedFramesManager.getSavedFrames()))Gd(e,n,t)}setTextureSource(e,t,n){e.set(`${$d}${n}`,t)}getInput(e,t){return e.get(t)}getPrevOutput(e,t){return t=Number.isInteger(t)?t:0,e.get(`${Ud}${t}`)}setOutputs(e,t=[],n=[]){if(Array.isArray(n)||(n=[n]),t.length>n.length)throw new Error(`output ids ${t.length} is bigger then supplied outputs ${n.length}`);n.forEach(((t,n)=>{Vd(e,t,n)})),t.forEach(((t,i)=>{e.set(t,n[i])}))}disposeTextures(e,t){const n=t.getUnit();e.forEach((e=>{const t=e.getUnit();this.capturedFramesManager.isReservedUnit(t)||n===t||this.textureManager.releaseTexture(e)}))}disposeAllStore(e){const t=new Set;Object.values(e.get()).forEach((e=>{const n=e.getUnit();this.capturedFramesManager.isReservedUnit(n)||t.has(n)||e.isStatic||(this.textureManager.releaseTexture(e),t.add(n))}))}},Kd=class{constructor(e){this.context=e}bind(){throw new Error("impl in concrete")}},Xd=100,Yd=100;function Qd(e,t){Xd=e,Yd=t}let Jd=class extends Kd{bind(e){var t,n;this.context.gl.bindFramebuffer(this.context.gl.FRAMEBUFFER,null);const i=null===(t=this.context.gl)||void 0===t||null===(t=t.canvas)||void 0===t?void 0:t.width,r=null===(n=this.context.gl)||void 0===n||null===(n=n.canvas)||void 0===n?void 0:n.height;return Number.isFinite(i)&&Number.isFinite(r)&&i>0&&r>0&&(this.context.gl.viewport(0,0,i,r),Qd(i,r)),e}},Zd=class extends Kd{bind(e){Array.isArray(e)||(e=[e]),this.context.gl.bindFramebuffer(this.context.gl.FRAMEBUFFER,this.context.frameBufferObject);const t=this.context.textureManager.createTexture({type:"pixel"}),n=this.context.gl.COLOR_ATTACHMENT0;if(this.context.gl.framebufferTexture2D(this.context.gl.FRAMEBUFFER,n,this.context.gl.TEXTURE_2D,t.textureObject,0),this.context.gl.clear(this.context.gl.COLOR_BUFFER_BIT),!1!==this.context.useCanvasSizedFilterTargets){var i,r;const e=null===(i=this.context.gl)||void 0===i||null===(i=i.canvas)||void 0===i?void 0:i.width,n=null===(r=this.context.gl)||void 0===r||null===(r=r.canvas)||void 0===r?void 0:r.height;Number.isFinite(e)&&e>0&&t.setWidth(e),Number.isFinite(n)&&n>0&&t.setHeight(n);const o=t.textureObjectInfo,s=null==o?void 0:o.allocatedWidth,a=null==o?void 0:o.allocatedHeight;Number.isFinite(e)&&Number.isFinite(n)&&(s!==e||a!==n)&&"function"==typeof t.fill&&t.fill(null)}else e[0]&&(t.setHeight(e[0].getHeight()),t.setWidth(e[0].getWidth()));return t}};class eh{constructor(e){this.gl=e.gl,this.textureManager=e.textureManager,this.useCanvasSizedFilterTargets=e.useCanvasSizedFilterTargets,this.bufferIndex=0,this.frameBufferObjectsPool=[this.gl.createFramebuffer(),this.gl.createFramebuffer(),this.gl.createFramebuffer()]}getFrameBufferObject(){const e=this.frameBufferObjectsPool[this.bufferIndex];return this.bufferIndex=this.bufferIndex++%this.frameBufferObjectsPool.length,e}create(e){let t;return t=e===kd.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS?new Jd({gl:this.gl}):new Zd({gl:this.gl,textureManager:this.textureManager,frameBufferObject:this.getFrameBufferObject(),useCanvasSizedFilterTargets:this.useCanvasSizedFilterTargets}),t}}function th(e,t,n){const i=t===e.VERTEX_SHADER?"vertex":"fragment";var r;r=e,Boolean(r)&&("undefined"!=typeof WebGL2RenderingContext&&r instanceof WebGL2RenderingContext||"function"==typeof r.createVertexArray)&&(n=function(e="",t){if("string"!=typeof e||!e||function(e=""){return"string"==typeof e&&e.includes("#version 300 es")}(e))return e;let n=e;if("vertex"===t&&(n=n.replace(/\battribute\b/g,"in"),n=n.replace(/\bvarying\b/g,"out")),"fragment"===t&&(n=n.replace(/\bvarying\b/g,"in"),n=n.replace(/\bgl_FragColor\b/g,"fragColor")),n=n.replace(/\btexture2D\b/g,"texture"),n=`#version 300 es\n${n}`,"fragment"===t&&n.includes("fragColor")&&!/\bout\s+vec4\s+fragColor\s*;/.test(n)){const e=n.split("\n");let t=1;for(let n=1;n<e.length;n+=1)if(e[n].trim().startsWith("precision ")){t=n+1;break}e.splice(t,0,"out vec4 fragColor;"),n=e.join("\n")}return n}(n,i));const o=e.createShader(t);if(!o)throw new Error(`Failed to create ${i} shader`);if(e.shaderSource(o,n),e.compileShader(o),e.getShaderParameter(o,e.COMPILE_STATUS))return o;const s=e.getShaderInfoLog(o);throw e.deleteShader(o),new Error(s)}var nh=function(e,t){return th(e,e.VERTEX_SHADER,t)},ih=function(e,t){return th(e,e.FRAGMENT_SHADER,t)};const rh={position_3d:0,texture_coordinate_2d:1};var oh=function(e,t,n){const i=e.createProgram();if(e.attachShader(i,t),e.attachShader(i,n),Object.entries(rh).forEach((([t,n])=>{e.bindAttribLocation(i,n,t)})),e.linkProgram(i),e.getProgramParameter(i,e.LINK_STATUS))return i;const r=e.getProgramInfoLog(i);throw e.deleteProgram(i),new Error(r)},sh=[-1,-1,1,1,-1,1,-1,1,1,1,1,1],ah=[0,1,2,2,1,3],lh=[0,0,1,0,0,1,1,1];const ch=96,uh=[new Float32Array(new ArrayBuffer(ch)),new Float32Array(new ArrayBuffer(ch)),new Float32Array(new ArrayBuffer(ch)),new Float32Array(new ArrayBuffer(ch)),new Float32Array(new ArrayBuffer(ch)),new Float32Array(new ArrayBuffer(ch))],dh=[new Int16Array(6),new Int16Array(6),new Int16Array(6)];class hh{constructor(e,t,n){return this.gl=n.gl,this.program=n.program,this.bindPoint=t,this.location=this.gl.getAttribLocation(this.program,e),this.buffer=this.gl.createBuffer(),this.floatBufferCounter=0,this.unit16BufferCounter=0,{fillBuffer:this.fillBuffer.bind(this),bindBuffer:this.bindBuffer.bind(this),setPointer:this.setPointer.bind(this),dispose:this.dispose.bind(this)}}enable(){this.gl.enableVertexAttribArray(this.location)}bindBuffer(){this.gl.bindBuffer(this.bindPoint,this.buffer)}getBuffer(){let e;switch(this.bindPoint){case this.gl.ARRAY_BUFFER:e=uh[this.floatBufferCounter],this.floatBufferCounter=this.floatBufferCounter++%uh.length;break;case this.gl.ELEMENT_ARRAY_BUFFER:e=dh[this.unit16BufferCounter],this.unit16BufferCounter=this.unit16BufferCounter++%dh.length;break;default:throw new Error("cant get buffer for this bind point: ",this.bindPoint)}return e}fillBuffer(e){this.bindBuffer();const t=this.getBuffer();t.set(e,0),this.gl.bufferData(this.bindPoint,t,this.gl.STATIC_DRAW)}getPointerData(){throw new Error("you should impl this function")}setPointer(){this.bindBuffer(),this.enable();const e=this.getPointerData();this.gl.vertexAttribPointer(this.location,e.size,e.type,e.normalize,e.stride,e.offset)}dispose(){this.gl.deleteBuffer(this.buffer)}}const fh={position_3d:class extends hh{getPointerData(){return{size:3,type:this.gl.FLOAT,normalize:!1,stride:0,offset:0}}},position_indexes:class extends hh{setPointer(){}getPointerData(){}enable(){}},texture_coordinate_2d:class extends hh{getPointerData(){return{size:2,type:this.gl.FLOAT,normalize:!0,stride:0,offset:0}}}};var ph=function(e,t,n){const i=fh[e];if(!i)throw new Error(`${e} is not a attribute name,choose from list: ${Object.keys(fh)}`);return new i(e,t,n)};class mh{constructor(e,t){this.gl=t.gl,this.program=t.program,this.location=this.gl.getUniformLocation(this.program,e)}compute(){return this}set(){return this}}let vh=class extends mh{set(e){this.gl.uniform1fv(this.location,e)}};class gh extends mh{set(e){e&&(e.beforeUse(),this.gl.uniform1i(this.location,e.getUnit()))}}const yh="first_texture_dimensions",bh="viewport_dimensions",kh="time",xh={RUNTIME_OPTIONS:"runtimeOptions[0]",STATIC_OPTIONS:"staticOptions[0]",FIRST_TEXTURE:"first_texture",SECOND_TEXTURE:"second_texture",FIRST_MATRIX:"first_mat4"},wh={[xh.FIRST_TEXTURE]:gh,[xh.SECOND_TEXTURE]:gh,[xh.FIRST_MATRIX]:class extends mh{set(e){this.gl.uniformMatrix4fv(this.location,!1,e)}},[xh.STATIC_OPTIONS]:vh,[xh.RUNTIME_OPTIONS]:vh};var _h=function(e,t){const n=wh[e];if(!n)throw new Error(`${e} is not a attribute name,choose from list: ${Object.keys(wh)}`);return new n(e,t)},Th=function(e,t){let n=(Date.now()-e||0)/(t||1);return n=Number.parseFloat(n).toFixed(7),n=Math.min(1,n),n};const Ih="position_3d",Eh="position_indexes",Sh="texture_coordinate_2d";class Ah{constructor(e,t,n,i){this.type=e,this.gl=i.gl,this.frameBuffer=i.frameBufferFactory.create(e),this.rebindAttributesOnProgramSwitch=!1!==i.rebindAttributesOnProgramSwitch,this.vertexShader=nh(this.gl,t.vertex),this.fragmentShader=ih(this.gl,t.fragment),this.program=oh(this.gl,this.vertexShader,this.fragmentShader);const r={gl:this.gl,program:this.program};this.attributes=function(e,t){const n={};return e=e||[],(e=[{id:Ih,bindPoint:t.gl.ARRAY_BUFFER},{id:Eh,bindPoint:t.gl.ELEMENT_ARRAY_BUFFER},{id:Sh,bindPoint:t.gl.ARRAY_BUFFER}].concat(e)).forEach((e=>{const i=e.id;n[i]=ph(i,e.bindPoint,t)})),n}(n.attributes,r),this.uniforms=function(e,t){const n={};return(e=e||[]).forEach((e=>{const i=e.id;n[i]=_h(i,t)})),n}(n.uniforms,r),this.gl.useProgram(this.program),i.__handleAttributesInitedOnce||(this.handleAttributes(),i.__handleAttributesInitedOnce=!0),this.handleStaticUniforms(i.options)}static getFilterType(){throw new Error("impl in concrete class")}static getInputsCount(){throw new Error(`impl in concrete class ${this.getFilterType()}`)}static getInitialOptions(){throw new Error(`impl in concrete class ${this.getFilterType()}`)}static getUniformInfo(e){let t=[{id:xh.RUNTIME_OPTIONS},{id:xh.STATIC_OPTIONS}];return(e.getUniformList||Ah.getUniformList)().forEach((e=>{Object.values(xh).includes(e)&&t.push({id:e})})),t}handleRuntimeUniforms(e,t){const{inputTextures:n,viewportDimensions:i}=e;let r=Array.isArray(n)?n:[n],o=[];(this.constructor.getUniformList||Ah.getUniformList)().forEach((e=>{switch(e){case xh.FIRST_TEXTURE:this.uniforms[xh.FIRST_TEXTURE].set(r[0]);break;case xh.SECOND_TEXTURE:this.uniforms[xh.SECOND_TEXTURE].set(r[1]);break;case yh:o=[...o,r[0].getWidth(),r[0].getHeight()];break;case bh:o=[...o,i.width,i.height];break;case kh:{const e=Th(t.startTime,t.duration);o=[...o,e];break}}})),o.length>0&&this.uniforms[xh.RUNTIME_OPTIONS].set(o)}static getUniformList(){return[xh.FIRST_TEXTURE]}getOptionsDisplay(){return[]}handleStaticUniforms(){}handleAttributes(){this.attributes[Ih].fillBuffer(sh),this.attributes[Ih].setPointer(),this.attributes[Eh].fillBuffer(ah),this.attributes[Sh].fillBuffer(lh),this.attributes[Sh].setPointer()}disposeAttributes(){Object.values(this.attributes).forEach((e=>{e.dispose()}))}render(e,t){const n=this.frameBuffer.bind(e);let i={width:Xd,height:Yd};return this.gl.useProgram(this.program),this.rebindAttributesOnProgramSwitch&&this.gl.__shaderGraphLastProgram!==this.program&&(this.handleAttributes(),this.gl.__shaderGraphLastProgram=this.program),this.handleRuntimeUniforms({inputTextures:e,viewportDimensions:i},t),this.draw(),n}draw(){const e=this.gl.TRIANGLES,t=this.gl.UNSIGNED_SHORT;this.gl.drawElements(e,6,t,0)}updateStaticUniforms(e){this.gl.useProgram(this.program),this.handleStaticUniforms(e)}dispose(){this.gl.detachShader(this.program,this.vertexShader),this.gl.deleteShader(this.vertexShader),this.gl.detachShader(this.program,this.fragmentShader),this.gl.deleteShader(this.fragmentShader),this.gl.deleteProgram(this.program)}}class Nh extends Ah{constructor(e){const t={uniforms:Ah.getUniformInfo(Nh)};super(Nh.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}"},t,e)}static getFilterType(){return"__default"}static getInputsCount(){return 1}static getInitialOptions(){return{}}}var Mh,Fh="undefined"!=typeof Float32Array?Float32Array:Array;function Ch(){var e=new Fh(3);return Fh!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Oh(e,t,n){var i=new Fh(3);return i[0]=e,i[1]=t,i[2]=n,i}function Ph(){var e=new Fh(4);return Fh!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}Ch(),function(){var e;e=new Fh(4),Fh!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0)}(),Ch(),Oh(1,0,0),Oh(0,1,0),Ph(),Ph(),Mh=new Fh(9),Fh!=Float32Array&&(Mh[1]=0,Mh[2]=0,Mh[3]=0,Mh[5]=0,Mh[6]=0,Mh[7]=0),Mh[0]=1,Mh[4]=1,Mh[8]=1;class Rh extends Ah{constructor(e){const t={uniforms:Ah.getUniformInfo(Rh)};super(Rh.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}"},t,e)}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:Rh.getInitialOptions().translate.x},{properties:["translate","y"],type:"slider",minValue:-2,maxValue:2,step:.001,initialValue:Rh.getInitialOptions().translate.y},{properties:["scale","x"],type:"slider",minValue:-10,maxValue:10,step:.001,initialValue:Rh.getInitialOptions().scale.x},{properties:["scale","y"],type:"slider",minValue:-10,maxValue:10,step:.001,initialValue:Rh.getInitialOptions().scale.y},{properties:["rotate"],type:"slider",minValue:-360,maxValue:360,step:1,initialValue:Rh.getInitialOptions().rotate}]}static getUniformList(){return[xh.FIRST_TEXTURE,xh.FIRST_MATRIX]}handleStaticUniforms(e){if(!e||!e.translate||!e.scale)throw new Error(`bad options object for Transform filter, check ${e}`);const t=Number.parseFloat(e.translate.x).toFixed(7),n=-1*Number.parseFloat(e.translate.y).toFixed(7),i=Number.parseFloat(e.scale.x).toFixed(7),r=Number.parseFloat(e.scale.y).toFixed(7),o=e.rotate||0;var s;this.transformMatrix=function(e,t,n,i){var r=t[0],o=t[1],s=t[2],a=t[3],l=r+r,c=o+o,u=s+s,d=r*l,h=r*c,f=r*u,p=o*c,m=o*u,v=s*u,g=a*l,y=a*c,b=a*u,k=i[0],x=i[1],w=i[2];return e[0]=(1-(p+v))*k,e[1]=(h+b)*k,e[2]=(f-y)*k,e[3]=0,e[4]=(h-b)*x,e[5]=(1-(d+v))*x,e[6]=(m+g)*x,e[7]=0,e[8]=(f+y)*w,e[9]=(m-g)*w,e[10]=(1-(d+p))*w,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}((s=new Fh(16),Fh!=Float32Array&&(s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[11]=0,s[12]=0,s[13]=0,s[14]=0),s[0]=1,s[5]=1,s[10]=1,s[15]=1,s),function(e,t,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"zyx",o=Math.PI/360;t*=o,i*=o,n*=o;var s=Math.sin(t),a=Math.cos(t),l=Math.sin(n),c=Math.cos(n),u=Math.sin(i),d=Math.cos(i);switch(r){case"xyz":e[0]=s*c*d+a*l*u,e[1]=a*l*d-s*c*u,e[2]=a*c*u+s*l*d,e[3]=a*c*d-s*l*u;break;case"xzy":e[0]=s*c*d-a*l*u,e[1]=a*l*d-s*c*u,e[2]=a*c*u+s*l*d,e[3]=a*c*d+s*l*u;break;case"yxz":e[0]=s*c*d+a*l*u,e[1]=a*l*d-s*c*u,e[2]=a*c*u-s*l*d,e[3]=a*c*d+s*l*u;break;case"yzx":e[0]=s*c*d+a*l*u,e[1]=a*l*d+s*c*u,e[2]=a*c*u-s*l*d,e[3]=a*c*d-s*l*u;break;case"zxy":e[0]=s*c*d-a*l*u,e[1]=a*l*d+s*c*u,e[2]=a*c*u+s*l*d,e[3]=a*c*d-s*l*u;break;case"zyx":e[0]=s*c*d-a*l*u,e[1]=a*l*d+s*c*u,e[2]=a*c*u-s*l*d,e[3]=a*c*d+s*l*u;break;default:throw new Error("Unknown angle order "+r)}return e}(Ph(),0,0,o),Oh(t,n,0),Oh(i,r,1)),this.uniforms[xh.FIRST_MATRIX].set(this.transformMatrix)}}class Dh extends Ah{constructor(e){const t={uniforms:Ah.getUniformInfo(Dh)};super(Dh.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float runtimeOptions[2];\n\nvarying vec2 blur_texture_coordinate_2d[11];\n\n\nvoid main() {\n vec2 normalize_poistion = vec2(position_3d.xy);\n gl_Position = vec4(normalize_poistion, 1, 1);\n\n float texture_width = runtimeOptions[0];\n float pixel_width = 1.0 / texture_width;\n\n \n for(int i=-5; i<5; ++i){\n float current_i = float(i);\n blur_texture_coordinate_2d[i+5] = texture_coordinate_2d + vec2(pixel_width * current_i, 0.0); \n }\n}\n",fragment:"\nprecision lowp float;\n\nuniform sampler2D first_texture;\n\nvarying vec2 blur_texture_coordinate_2d[11];\n\nvoid main() {\n vec4 out_colour = vec4(0.0);\n\tout_colour += texture2D(first_texture, blur_texture_coordinate_2d[0]) * 0.0093;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[1]) * 0.028002;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[2]) * 0.065984;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[3]) * 0.121703;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[4]) * 0.175713;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[5]) * 0.198596;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[6]) * 0.175713;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[7]) * 0.121703;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[8]) * 0.065984;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[9]) * 0.028002;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[10]) * 0.0093;\n \n \n gl_FragColor = out_colour;\n}"},t,e)}static getFilterType(){return"horizontalBlur"}static getInputsCount(){return 1}static getInitialOptions(){return{}}static getUniformList(){return[xh.FIRST_TEXTURE,yh]}}class Lh extends Ah{constructor(e){const t={uniforms:Ah.getUniformInfo(Lh)};super(Lh.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float runtimeOptions[2];\n\nvarying vec2 blur_texture_coordinate_2d[11];\n\n\nvoid main() {\n vec2 normalize_poistion = vec2(position_3d.xy);\n gl_Position = vec4(normalize_poistion, 1, 1);\n\n float texture_width = runtimeOptions[1];\n float pixel_height = 1.0 / texture_width;\n\n for(int i=-5; i<5; ++i){\n float current_i = float(i);\n blur_texture_coordinate_2d[i+5] = texture_coordinate_2d + vec2( 0.0, pixel_height * current_i);\n }\n}\n",fragment:"\nprecision lowp float;\n\nuniform sampler2D first_texture;\n\nvarying vec2 blur_texture_coordinate_2d[11];\n\nvoid main() {\n vec4 out_colour = vec4(0.0);\n\tout_colour += texture2D(first_texture, blur_texture_coordinate_2d[0]) * 0.0093;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[1]) * 0.028002;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[2]) * 0.065984;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[3]) * 0.121703;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[4]) * 0.175713;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[5]) * 0.198596;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[6]) * 0.175713;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[7]) * 0.121703;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[8]) * 0.065984;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[9]) * 0.028002;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[10]) * 0.0093;\n \n \n gl_FragColor = out_colour;\n}"},t,e)}static getFilterType(){return"verticalBlur"}static getInputsCount(){return 1}static getInitialOptions(){return{}}static getUniformList(){return[xh.FIRST_TEXTURE,yh]}}class Bh extends Ah{constructor(e){const t={uniforms:Ah.getUniformInfo(Bh)};super(Bh.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nuniform float staticOptions[3];\nuniform float runtimeOptions[4];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nconst float Depth = 3.;\nconst float Samples = 8.;\nfloat OffsetDist = staticOptions[0];\n\nvec2 srcDims = vec2(runtimeOptions[0], runtimeOptions[1]);\nvec2 vpDims = vec2(runtimeOptions[2], runtimeOptions[3]);\nvec2 iResolution = vpDims;\n\n\n#define TAU 6.28318530718\n\nvec4 RadialBlur(vec2 fragCoord, float radius) {\n if (radius <= 0.) {\n return texture2D(first_texture, fragCoord/iResolution.xy);\n }\n\n vec2 offset;\n float angle = 0.;\n vec4 color = vec4(0.);\n\n for(float angle = 0.; angle < TAU; angle += (TAU/Samples)) {\n offset = vec2(cos(angle), sin(angle)) * radius;\n color += texture2D(first_texture, (fragCoord + offset)/iResolution.xy);\n }\n\n return color/Samples;\n\n}\n\nvec4 FastBlur(vec2 fragCoord) {\n\n vec4 color;\n vec2 offset;\n float fib = 2.;\n float fibTotal = 0.;\n\n for(float i = 1.; i <= Depth; ++i) {\n fib += i;\n color += RadialBlur(fragCoord, i * OffsetDist)/ fib;\n fibTotal += 1./fib;\n }\n\n return color/fibTotal;\n\n}\n\n// based on https://www.shadertoy.com/view/3ljBDd\nvoid main() {\n// vec2 fragCoords = (vec2(current_texture_coordinate_2d) + 1.0) / 2.0 * vpDims;\n vec2 fragCoords = vec2(current_texture_coordinate_2d) * vpDims;\n gl_FragColor = FastBlur(fragCoords);\n}"},t,e)}static getFilterType(){return"fastBlur"}static getInputsCount(){return 1}static getInitialOptions(){return{}}static getUniformList(){return[xh.FIRST_TEXTURE,yh,bh]}handleStaticUniforms(e){var t;const n=(null!==(t=Number.parseFloat(e.offsetDist))&&void 0!==t?t:4).toFixed(3);this.uniforms[xh.STATIC_OPTIONS].set([n])}}class zh extends Ah{constructor(e){const t={uniforms:Ah.getUniformInfo(zh)};super(zh.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nuniform float staticOptions[2];\nuniform float runtimeOptions[4];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvec2 vpDims = vec2(runtimeOptions[2], runtimeOptions[3]);\n\n// A simple directional blur that doesn't brighten the image, based on https://www.shadertoy.com/view/WdSXWD\n// and https://www.shadertoy.com/view/NltSD4\n\nvec4 dirBlur() {\n float angle = staticOptions[0];\n float strength = staticOptions[1];\n if (strength == 0.0){\n return texture2D(first_texture, current_texture_coordinate_2d);\n }\n\n vec2 uv = current_texture_coordinate_2d;\n\n float r = radians(angle);\n vec2 direction = vec2(sin(r), cos(r));\n\n vec2 strengthDirection = strength * direction;\n vec3 acc = vec3(0);\n for(float i = -1.0; i <= 1.0; i += (2.0 / 50.0)) {\n acc += texture2D(first_texture, uv - vec2(strengthDirection.x * i, strengthDirection.y * i)).rgb * (2.0 / 50.0) * .5;\n }\n\n return vec4(acc, 1.0);\n\n}\n\nvoid main() {\n gl_FragColor = dirBlur();\n}"},t,e)}static getFilterType(){return"directionalBlur"}static getInputsCount(){return 1}static getInitialOptions(){return{}}static getUniformList(){return[xh.FIRST_TEXTURE,yh,bh]}handleStaticUniforms(e){var t,n;const i=(null!==(t=Number.parseFloat(e.angle))&&void 0!==t?t:90).toFixed(3),r=(null!==(n=Number.parseFloat(e.strength))&&void 0!==n?n:.1).toFixed(3);this.uniforms[xh.STATIC_OPTIONS].set([i,r])}}class Wh extends Ah{constructor(e){const t={uniforms:Ah.getUniformInfo(Wh)};super(Wh.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n \n current_texture_coordinate_2d = texture_coordinate_2d;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform float staticOptions[1];\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 texture = texture2D(first_texture, current_texture_coordinate_2d);\n float opacity = texture.w - (1.0 - staticOptions[0]);\n gl_FragColor = vec4((texture.xyz) , opacity);\n}"},t,e)}static getFilterType(){return"opacity"}static getInputsCount(){return 1}static getInitialOptions(){return{power:1}}getOptionsDisplay(){return[{properties:["power"],type:"slider",minValue:0,maxValue:1,step:.001}]}handleStaticUniforms(e){const t=Number.parseFloat(e.power).toFixed(7);this.uniforms[xh.STATIC_OPTIONS].set([t])}}class $h extends Ah{constructor(e){const t={uniforms:Ah.getUniformInfo($h)};super($h.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform sampler2D second_texture;\n\nuniform float staticOptions[7];\nuniform float runtimeOptions[2];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\n\nfloat roundedBoxSDF(vec2 point, vec2 center, vec2 area, float radius) {\n return length(max(abs(point - center) - area + radius, 0.0)) - radius;\n}\n\nfloat boxSDF(vec2 point, vec2 center, vec2 area){\n vec2 d = abs(point - center) - area;\n return length(max(d,vec2(0)));\n}\n\n\nvoid main() {\n float type = staticOptions[0];\n vec2 aspectRatio = vec2(runtimeOptions[0]/runtimeOptions[1], 1.0);\n\n\n vec2 center = vec2(staticOptions[1], staticOptions[2]) * aspectRatio;\n vec2 area = max(vec2(staticOptions[3], staticOptions[4]) * aspectRatio, 0.0); \n float radius = staticOptions[5];\n\n vec2 SDF_PositionCoordinate2d = vec2(\n current_position_coordinate_2d.x,\n current_position_coordinate_2d.y * -1.0\n ) * aspectRatio;\n\n vec4 color1 = texture2D(first_texture, current_texture_coordinate_2d);\n vec4 color2 = texture2D(second_texture, current_texture_coordinate_2d);\n\n float dist;\n vec4 color;\n if(type == 0.0){\n dist = boxSDF(SDF_PositionCoordinate2d, center, area);\n color = (dist > 0.0) ? color2: color1;\n } else {\n dist = roundedBoxSDF(SDF_PositionCoordinate2d, center, area, radius);\n color = (dist > 0.0) ? color2: color1;\n color = mix( color, color2, 1.0-smoothstep(0.0,0.0025,abs(dist)));\n }\n \n gl_FragColor = color;\n}"},t,e)}static getFilterType(){return"shapeCompositeMask"}static getInputsCount(){return 2}static getInitialOptions(){return{type:"box",center:{x:0,y:0},area:{width:0,height:0},radius:.01,edgeSoftness:0}}getOptionsDisplay(){return[{properties:["center","x"],type:"slider",minValue:-1,maxValue:1,step:.001},{properties:["center","y"],type:"slider",minValue:-1,maxValue:1,step:.001},{properties:["area","width"],type:"slider",minValue:-2,maxValue:2,step:.001},{properties:["area","height"],type:"slider",minValue:-2,maxValue:2,step:.001},{properties:["radius"],type:"slider",minValue:-2,maxValue:2,step:.001},{properties:["edgeSoftness"],type:"slider",minValue:-2,maxValue:2,step:.001}]}static getUniformList(){return[xh.FIRST_TEXTURE,yh,xh.SECOND_TEXTURE]}handleStaticUniforms(e){let t;switch(e.type){case"box":t=0;break;case"rounded":t=1;break;default:throw new Error("cant recognize shape composite mask type")}const n=Number.parseFloat(e.center.x).toFixed(7);let i=Number.parseFloat(e.center.y).toFixed(7);i+=0;const r=Number.parseFloat(e.area.width).toFixed(7),o=Number.parseFloat(e.area.height).toFixed(7),s=Number.parseFloat(e.radius).toFixed(7),a=Number.parseFloat(e.edgeSoftness).toFixed(7);this.uniforms[xh.STATIC_OPTIONS].set([t,n,i,r,o,s,a])}}class Uh extends Ah{constructor(e){const t={uniforms:Ah.getUniformInfo(Uh)};super(Uh.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform sampler2D second_texture;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 fgColor = texture2D(first_texture, current_texture_coordinate_2d);\n vec4 bgColor = texture2D(second_texture, current_texture_coordinate_2d);\n gl_FragColor = vec4(\n mix(bgColor.xyz, fgColor.xyz, fgColor.w),\n 1.0\n );\n // vec4 fgColor = texture2D(textures[1], current_texture_coordinate_2d);\n // if(fgColor.w > 0.0){\n // gl_FragColor = vec4(1.0,0,0,1);\n // }else{\n // gl_FragColor = vec4(1.0,1.0,0,1);\n // }\n \n \n}"},t,e)}static getFilterType(){return"shapeComposite"}static getInputsCount(){return 2}static getInitialOptions(){return{}}static getUniformList(){return[xh.FIRST_TEXTURE,xh.SECOND_TEXTURE]}}class jh extends Ah{constructor(e){const t={uniforms:Ah.getUniformInfo(jh)};super(jh.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\n",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform sampler2D second_texture;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n // Look it up in the LUT\n vec4 textureColor = texture2D(first_texture, current_texture_coordinate_2d);\n\n mediump float blueColor = textureColor.b * 63.0;\n\n mediump vec2 quad1;\n quad1.y = floor(floor(blueColor) / 8.0);\n quad1.x = floor(blueColor) - (quad1.y * 8.0);\n\n mediump vec2 quad2;\n quad2.y = floor(ceil(blueColor) / 8.0);\n quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n\n highp vec2 texPos1;\n texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);\n texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);\n\n\n highp vec2 texPos2;\n texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);\n texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);\n\n lowp vec4 newColor1 = texture2D(second_texture, texPos1);\n lowp vec4 newColor2 = texture2D(second_texture, texPos2);\n\n lowp vec4 color = mix(newColor1, newColor2, fract(blueColor));\n\n gl_FragColor = color;\n\n // debug\n// if (current_texture_coordinate_2d.x < 0.5) {\n// // Left half: show original\n// gl_FragColor = textureColor;\n// } else {\n// gl_FragColor = color;\n// }\n}\n"},t,e)}static getFilterType(){return"lut"}static getInputsCount(){return 2}static getInitialOptions(){return{}}static getUniformList(){return[xh.FIRST_TEXTURE,xh.SECOND_TEXTURE]}getOptionsDisplay(){return[]}handleStaticUniforms(e){const t=Number.parseFloat(e.lutSize).toFixed(1);this.uniforms[xh.STATIC_OPTIONS].set([t])}}var qh="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",Vh='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:Gh,cos:Hh,sin:Kh,acos:Xh,atan2:Yh,sqrt:Qh,pow:Jh}=Math;function Zh(e){return e<0?-Jh(-e,1/3):Jh(e,1/3)}const ef=Math.PI,tf=2*ef,nf=ef/2,rf=Number.MAX_SAFE_INTEGER||9007199254740991,of=Number.MIN_SAFE_INTEGER||-9007199254740991,sf={x:0,y:0,z:0},af={Tvalues:[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],Cvalues:[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872],arcfn:function(e,t){const n=t(e);let i=n.x*n.x+n.y*n.y;return void 0!==n.z&&(i+=n.z*n.z),Qh(i)},compute:function(e,t,n){if(0===e)return t[0].t=0,t[0];const i=t.length-1;if(1===e)return t[i].t=1,t[i];const r=1-e;let o=t;if(0===i)return t[0].t=e,t[0];if(1===i){const t={x:r*o[0].x+e*o[1].x,y:r*o[0].y+e*o[1].y,t:e};return n&&(t.z=r*o[0].z+e*o[1].z),t}if(i<4){let t,s,a,l=r*r,c=e*e,u=0;2===i?(o=[o[0],o[1],o[2],sf],t=l,s=r*e*2,a=c):3===i&&(t=l*r,s=l*e*3,a=r*c*3,u=e*c);const d={x:t*o[0].x+s*o[1].x+a*o[2].x+u*o[3].x,y:t*o[0].y+s*o[1].y+a*o[2].y+u*o[3].y,t:e};return n&&(d.z=t*o[0].z+s*o[1].z+a*o[2].z+u*o[3].z),d}const s=JSON.parse(JSON.stringify(t));for(;s.length>1;){for(let t=0;t<s.length-1;t++)s[t]={x:s[t].x+(s[t+1].x-s[t].x)*e,y:s[t].y+(s[t+1].y-s[t].y)*e},void 0!==s[t].z&&(s[t].z=s[t].z+(s[t+1].z-s[t].z)*e);s.splice(s.length-1,1)}return s[0].t=e,s[0]},computeWithRatios:function(e,t,n,i){const r=1-e,o=n,s=t;let a,l=o[0],c=o[1],u=o[2],d=o[3];return l*=r,c*=e,2===s.length?(a=l+c,{x:(l*s[0].x+c*s[1].x)/a,y:(l*s[0].y+c*s[1].y)/a,z:!!i&&(l*s[0].z+c*s[1].z)/a,t:e}):(l*=r,c*=2*r,u*=e*e,3===s.length?(a=l+c+u,{x:(l*s[0].x+c*s[1].x+u*s[2].x)/a,y:(l*s[0].y+c*s[1].y+u*s[2].y)/a,z:!!i&&(l*s[0].z+c*s[1].z+u*s[2].z)/a,t:e}):(l*=r,c*=1.5*r,u*=3*r,d*=e*e*e,4===s.length?(a=l+c+u+d,{x:(l*s[0].x+c*s[1].x+u*s[2].x+d*s[3].x)/a,y:(l*s[0].y+c*s[1].y+u*s[2].y+d*s[3].y)/a,z:!!i&&(l*s[0].z+c*s[1].z+u*s[2].z+d*s[3].z)/a,t:e}):void 0))},derive:function(e,t){const n=[];for(let i=e,r=i.length,o=r-1;r>1;r--,o--){const e=[];for(let n,r=0;r<o;r++)n={x:o*(i[r+1].x-i[r].x),y:o*(i[r+1].y-i[r].y)},t&&(n.z=o*(i[r+1].z-i[r].z)),e.push(n);n.push(e),i=e}return n},between:function(e,t,n){return t<=e&&e<=n||af.approximately(e,t)||af.approximately(e,n)},approximately:function(e,t,n){return Gh(e-t)<=(n||1e-6)},length:function(e){const t=af.Tvalues.length;let n=0;for(let i,r=0;r<t;r++)i=.5*af.Tvalues[r]+.5,n+=af.Cvalues[r]*af.arcfn(i,e);return.5*n},map:function(e,t,n,i,r){return i+(e-t)/(n-t)*(r-i)},lerp:function(e,t,n){const i={x:t.x+e*(n.x-t.x),y:t.y+e*(n.y-t.y)};return void 0!==t.z&&void 0!==n.z&&(i.z=t.z+e*(n.z-t.z)),i},pointToString:function(e){let t=e.x+"/"+e.y;return void 0!==e.z&&(t+="/"+e.z),t},pointsToString:function(e){return"["+e.map(af.pointToString).join(", ")+"]"},copy:function(e){return JSON.parse(JSON.stringify(e))},angle:function(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=n.x-e.x,s=n.y-e.y;return Yh(i*s-r*o,i*o+r*s)},round:function(e,t){const n=""+e,i=n.indexOf(".");return parseFloat(n.substring(0,i+1+t))},dist:function(e,t){const n=e.x-t.x,i=e.y-t.y;return Qh(n*n+i*i)},closest:function(e,t){let n,i,r=Jh(2,63);return e.forEach((function(e,o){i=af.dist(t,e),i<r&&(r=i,n=o)})),{mdist:r,mpos:n}},abcratio:function(e,t){if(2!==t&&3!==t)return!1;if(void 0===e)e=.5;else if(0===e||1===e)return e;const n=Jh(e,t)+Jh(1-e,t);return Gh((n-1)/n)},projectionratio:function(e,t){if(2!==t&&3!==t)return!1;if(void 0===e)e=.5;else if(0===e||1===e)return e;const n=Jh(1-e,t);return n/(Jh(e,t)+n)},lli8:function(e,t,n,i,r,o,s,a){const l=(e-n)*(o-a)-(t-i)*(r-s);return 0!=l&&{x:((e*i-t*n)*(r-s)-(e-n)*(r*a-o*s))/l,y:((e*i-t*n)*(o-a)-(t-i)*(r*a-o*s))/l}},lli4:function(e,t,n,i){const r=e.x,o=e.y,s=t.x,a=t.y,l=n.x,c=n.y,u=i.x,d=i.y;return af.lli8(r,o,s,a,l,c,u,d)},lli:function(e,t){return af.lli4(e,e.c,t,t.c)},makeline:function(e,t){return new gf(e.x,e.y,(e.x+t.x)/2,(e.y+t.y)/2,t.x,t.y)},findbbox:function(e){let t=rf,n=rf,i=of,r=of;return e.forEach((function(e){const o=e.bbox();t>o.x.min&&(t=o.x.min),n>o.y.min&&(n=o.y.min),i<o.x.max&&(i=o.x.max),r<o.y.max&&(r=o.y.max)})),{x:{min:t,mid:(t+i)/2,max:i,size:i-t},y:{min:n,mid:(n+r)/2,max:r,size:r-n}}},shapeintersections:function(e,t,n,i,r){if(!af.bboxoverlap(t,i))return[];const o=[],s=[e.startcap,e.forward,e.back,e.endcap],a=[n.startcap,n.forward,n.back,n.endcap];return s.forEach((function(t){t.virtual||a.forEach((function(i){if(i.virtual)return;const s=t.intersects(i,r);s.length>0&&(s.c1=t,s.c2=i,s.s1=e,s.s2=n,o.push(s))}))})),o},makeshape:function(e,t,n){const i=t.points.length,r=e.points.length,o=af.makeline(t.points[i-1],e.points[0]),s=af.makeline(e.points[r-1],t.points[0]),a={startcap:o,forward:e,back:t,endcap:s,bbox:af.findbbox([o,e,t,s]),intersections:function(e){return af.shapeintersections(a,a.bbox,e,e.bbox,n)}};return a},getminmax:function(e,t,n){if(!n)return{min:0,max:0};let i,r,o=rf,s=of;-1===n.indexOf(0)&&(n=[0].concat(n)),-1===n.indexOf(1)&&n.push(1);for(let a=0,l=n.length;a<l;a++)i=n[a],r=e.get(i),r[t]<o&&(o=r[t]),r[t]>s&&(s=r[t]);return{min:o,mid:(o+s)/2,max:s,size:s-o}},align:function(e,t){const n=t.p1.x,i=t.p1.y,r=-Yh(t.p2.y-i,t.p2.x-n);return e.map((function(e){return{x:(e.x-n)*Hh(r)-(e.y-i)*Kh(r),y:(e.x-n)*Kh(r)+(e.y-i)*Hh(r)}}))},roots:function(e,t){t=t||{p1:{x:0,y:0},p2:{x:1,y:0}};const n=e.length-1,i=af.align(e,t),r=function(e){return 0<=e&&e<=1};if(2===n){const e=i[0].y,t=i[1].y,n=i[2].y,o=e-2*t+n;if(0!==o){const i=-Qh(t*t-e*n),s=-e+t;return[-(i+s)/o,-(-i+s)/o].filter(r)}return t!==n&&0===o?[(2*t-n)/(2*t-2*n)].filter(r):[]}const o=i[0].y,s=i[1].y,a=i[2].y;let l=3*s-o-3*a+i[3].y,c=3*o-6*s+3*a,u=-3*o+3*s,d=o;if(af.approximately(l,0)){if(af.approximately(c,0))return af.approximately(u,0)?[]:[-d/u].filter(r);const e=Qh(u*u-4*c*d),t=2*c;return[(e-u)/t,(-u-e)/t].filter(r)}c/=l,u/=l,d/=l;const h=(3*u-c*c)/3,f=h/3,p=(2*c*c*c-9*c*u+27*d)/27,m=p/2,v=m*m+f*f*f;let g,y,b,k,x;if(v<0){const e=-h/3,t=Qh(e*e*e),n=-p/(2*t),i=Xh(n<-1?-1:n>1?1:n),o=2*Zh(t);return b=o*Hh(i/3)-c/3,k=o*Hh((i+tf)/3)-c/3,x=o*Hh((i+2*tf)/3)-c/3,[b,k,x].filter(r)}if(0===v)return g=m<0?Zh(-m):-Zh(m),b=2*g-c/3,k=-g-c/3,[b,k].filter(r);{const e=Qh(v);return g=Zh(-m+e),y=Zh(m+e),[g-y-c/3].filter(r)}},droots:function(e){if(3===e.length){const t=e[0],n=e[1],i=e[2],r=t-2*n+i;if(0!==r){const e=-Qh(n*n-t*i),o=-t+n;return[-(e+o)/r,-(-e+o)/r]}return n!==i&&0===r?[(2*n-i)/(2*(n-i))]:[]}if(2===e.length){const t=e[0],n=e[1];return t!==n?[t/(t-n)]:[]}return[]},curvature:function(e,t,n,i,r){let o,s,a,l,c=0,u=0;const d=af.compute(e,t),h=af.compute(e,n),f=d.x*d.x+d.y*d.y;if(i?(o=Qh(Jh(d.y*h.z-h.y*d.z,2)+Jh(d.z*h.x-h.z*d.x,2)+Jh(d.x*h.y-h.x*d.y,2)),s=Jh(f+d.z*d.z,1.5)):(o=d.x*h.y-d.y*h.x,s=Jh(f,1.5)),0===o||0===s)return{k:0,r:0};if(c=o/s,u=s/o,!r){const r=af.curvature(e-.001,t,n,i,!0).k,o=af.curvature(e+.001,t,n,i,!0).k;l=(o-c+(c-r))/2,a=(Gh(o-c)+Gh(c-r))/2}return{k:c,r:u,dk:l,adk:a}},inflections:function(e){if(e.length<4)return[];const t=af.align(e,{p1:e[0],p2:e.slice(-1)[0]}),n=t[2].x*t[1].y,i=t[3].x*t[1].y,r=t[1].x*t[2].y,o=18*(-3*n+2*i+3*r-t[3].x*t[2].y),s=18*(3*n-i-3*r),a=18*(r-n);if(af.approximately(o,0)){if(!af.approximately(s,0)){let e=-a/s;if(0<=e&&e<=1)return[e]}return[]}const l=2*o;if(af.approximately(l,0))return[];const c=s*s-4*o*a;if(c<0)return[];const u=Math.sqrt(c);return[(u-s)/l,-(s+u)/l].filter((function(e){return 0<=e&&e<=1}))},bboxoverlap:function(e,t){const n=["x","y"],i=n.length;for(let r,o,s,a,l=0;l<i;l++)if(r=n[l],o=e[r].mid,s=t[r].mid,a=(e[r].size+t[r].size)/2,Gh(o-s)>=a)return!1;return!0},expandbox:function(e,t){t.x.min<e.x.min&&(e.x.min=t.x.min),t.y.min<e.y.min&&(e.y.min=t.y.min),t.z&&t.z.min<e.z.min&&(e.z.min=t.z.min),t.x.max>e.x.max&&(e.x.max=t.x.max),t.y.max>e.y.max&&(e.y.max=t.y.max),t.z&&t.z.max>e.z.max&&(e.z.max=t.z.max),e.x.mid=(e.x.min+e.x.max)/2,e.y.mid=(e.y.min+e.y.max)/2,e.z&&(e.z.mid=(e.z.min+e.z.max)/2),e.x.size=e.x.max-e.x.min,e.y.size=e.y.max-e.y.min,e.z&&(e.z.size=e.z.max-e.z.min)},pairiteration:function(e,t,n){const i=e.bbox(),r=t.bbox(),o=1e5,s=n||.5;if(i.x.size+i.y.size<s&&r.x.size+r.y.size<s)return[(o*(e._t1+e._t2)/2|0)/o+"/"+(o*(t._t1+t._t2)/2|0)/o];let a=e.split(.5),l=t.split(.5),c=[{left:a.left,right:l.left},{left:a.left,right:l.right},{left:a.right,right:l.right},{left:a.right,right:l.left}];c=c.filter((function(e){return af.bboxoverlap(e.left.bbox(),e.right.bbox())}));let u=[];return 0===c.length||(c.forEach((function(e){u=u.concat(af.pairiteration(e.left,e.right,s))})),u=u.filter((function(e,t){return u.indexOf(e)===t}))),u},getccenter:function(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=n.x-t.x,s=n.y-t.y,a=i*Hh(nf)-r*Kh(nf),l=i*Kh(nf)+r*Hh(nf),c=o*Hh(nf)-s*Kh(nf),u=o*Kh(nf)+s*Hh(nf),d=(e.x+t.x)/2,h=(e.y+t.y)/2,f=(t.x+n.x)/2,p=(t.y+n.y)/2,m=d+a,v=h+l,g=f+c,y=p+u,b=af.lli8(d,h,m,v,f,p,g,y),k=af.dist(b,e);let x,w=Yh(e.y-b.y,e.x-b.x),_=Yh(t.y-b.y,t.x-b.x),T=Yh(n.y-b.y,n.x-b.x);return w<T?((w>_||_>T)&&(w+=tf),w>T&&(x=T,T=w,w=x)):T<_&&_<w?(x=T,T=w,w=x):T+=tf,b.s=w,b.e=T,b.r=k,b},numberSort:function(e,t){return e-t}};class lf{constructor(e){this.curves=[],this._3d=!1,e&&(this.curves=e,this._3d=this.curves[0]._3d)}valueOf(){return this.toString()}toString(){return"["+this.curves.map((function(e){return af.pointsToString(e.points)})).join(", ")+"]"}addCurve(e){this.curves.push(e),this._3d=this._3d||e._3d}length(){return this.curves.map((function(e){return e.length()})).reduce((function(e,t){return e+t}))}curve(e){return this.curves[e]}bbox(){const e=this.curves;for(var t=e[0].bbox(),n=1;n<e.length;n++)af.expandbox(t,e[n].bbox());return t}offset(e){const t=[];return this.curves.forEach((function(n){t.push(...n.offset(e))})),new lf(t)}}const{abs:cf,min:uf,max:df,cos:hf,sin:ff,acos:pf,sqrt:mf}=Math,vf=Math.PI;let gf=class e{constructor(e){let t=e&&e.forEach?e:Array.from(arguments).slice(),n=!1;if("object"==typeof t[0]){n=t.length;const e=[];t.forEach((function(t){["x","y","z"].forEach((function(n){void 0!==t[n]&&e.push(t[n])}))})),t=e}let i=!1;const r=t.length;if(n){if(n>4){if(1!==arguments.length)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");i=!0}}else if(6!==r&&8!==r&&9!==r&&12!==r&&1!==arguments.length)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");const o=this._3d=!i&&(9===r||12===r)||e&&e[0]&&void 0!==e[0].z,s=this.points=[];for(let e=0,n=o?3:2;e<r;e+=n){var a={x:t[e],y:t[e+1]};o&&(a.z=t[e+2]),s.push(a)}const l=this.order=s.length-1,c=this.dims=["x","y"];o&&c.push("z"),this.dimlen=c.length;const u=af.align(s,{p1:s[0],p2:s[l]}),d=af.dist(s[0],s[l]);this._linear=u.reduce(((e,t)=>e+cf(t.y)),0)<d/50,this._lut=[],this._t1=0,this._t2=1,this.update()}static quadraticFromPoints(t,n,i,r){if(void 0===r&&(r=.5),0===r)return new e(n,n,i);if(1===r)return new e(t,n,n);const o=e.getABC(2,t,n,i,r);return new e(t,o.A,i)}static cubicFromPoints(t,n,i,r,o){void 0===r&&(r=.5);const s=e.getABC(3,t,n,i,r);void 0===o&&(o=af.dist(n,s.C));const a=o*(1-r)/r,l=af.dist(t,i),c=(i.x-t.x)/l,u=(i.y-t.y)/l,d=o*c,h=o*u,f=a*c,p=a*u,m=n.x-d,v=n.y-h,g=n.x+f,y=n.y+p,b=s.A,k=b.x+(m-b.x)/(1-r),x=b.y+(v-b.y)/(1-r),w=b.x+(g-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 af}getUtils(){return e.getUtils()}static get PolyBezier(){return lf}valueOf(){return this.toString()}toString(){return af.pointsToString(this.points)}toSVG(){if(this._3d)return!1;const e=this.points,t=["M",e[0].x,e[0].y,2===this.order?"Q":"C"];for(let n=1,i=e.length;n<i;n++)t.push(e[n].x),t.push(e[n].y);return t.join(" ")}setRatios(e){if(e.length!==this.points.length)throw new Error("incorrect number of ratio values");this.ratios=e,this._lut=[]}verify(){const e=this.coordDigest();e!==this._print&&(this._print=e,this.update())}coordDigest(){return this.points.map((function(e,t){return""+t+e.x+e.y+(e.z?e.z:0)})).join("")}update(){this._lut=[],this.dpoints=af.derive(this.points,this._3d),this.computedirection()}computedirection(){const e=this.points,t=af.angle(e[0],e[this.order],e[1]);this.clockwise=t>0}length(){return af.length(this.derivative.bind(this))}static getABC(e=2,t,n,i,r=.5){const o=af.projectionratio(r,e),s=1-o,a={x:o*t.x+s*i.x,y:o*t.y+s*i.y},l=af.abcratio(r,e);return{A:{x:n.x+(n.x-a.x)/l,y:n.y+(n.y-a.y)/l},B:n,C:a,S:t,E:i}}getABC(t,n){n=n||this.get(t);let i=this.points[0],r=this.points[this.order];return e.getABC(this.order,i,n,r,t)}getLUT(e){if(this.verify(),e=e||100,this._lut.length===e+1)return this._lut;this._lut=[],e++,this._lut=[];for(let t,n,i=0;i<e;i++)n=i/(e-1),t=this.compute(n),t.t=n,this._lut.push(t);return this._lut}on(e,n){n=n||5;const i=this.getLUT(),r=[];for(let t,o=0,s=0;o<i.length;o++)t=i[o],af.dist(t,e)<n&&(r.push(t),s+=o/i.length);return!!r.length&&(t/=r.length)}project(e){const t=this.getLUT(),n=t.length-1,i=af.closest(t,e),r=i.mpos,o=(r-1)/n,s=(r+1)/n,a=.1/n;let l,c=i.mdist,u=o,d=u;c+=1;for(let t;u<s+a;u+=a)l=this.compute(u),t=af.dist(e,l),t<c&&(c=t,d=u);return d=d<0?0:d>1?1:d,l=this.compute(d),l.t=d,l.d=c,l}get(e){return this.compute(e)}point(e){return this.points[e]}compute(e){return this.ratios?af.computeWithRatios(e,this.points,this.ratios,this._3d):af.compute(e,this.points,this._3d,this.ratios)}raise(){const t=this.points,n=[t[0]],i=t.length;for(let e,r,o=1;o<i;o++)e=t[o],r=t[o-1],n[o]={x:(i-o)/i*e.x+o/i*r.x,y:(i-o)/i*e.y+o/i*r.y};return n[i]=t[i-1],new e(n)}derivative(e){return af.compute(e,this.dpoints[0],this._3d)}dderivative(e){return af.compute(e,this.dpoints[1],this._3d)}align(){let t=this.points;return new e(af.align(t,{p1:t[0],p2:t[t.length-1]}))}curvature(e){return af.curvature(e,this.dpoints[0],this.dpoints[1],this._3d)}inflections(){return af.inflections(this.points)}normal(e){return this._3d?this.__normal3(e):this.__normal2(e)}__normal2(e){const t=this.derivative(e),n=mf(t.x*t.x+t.y*t.y);return{t:e,x:-t.y/n,y:t.x/n}}__normal3(e){const t=this.derivative(e),n=this.derivative(e+.01),i=mf(t.x*t.x+t.y*t.y+t.z*t.z),r=mf(n.x*n.x+n.y*n.y+n.z*n.z);t.x/=i,t.y/=i,t.z/=i,n.x/=r,n.y/=r,n.z/=r;const o={x:n.y*t.z-n.z*t.y,y:n.z*t.x-n.x*t.z,z:n.x*t.y-n.y*t.x},s=mf(o.x*o.x+o.y*o.y+o.z*o.z);o.x/=s,o.y/=s,o.z/=s;const a=[o.x*o.x,o.x*o.y-o.z,o.x*o.z+o.y,o.x*o.y+o.z,o.y*o.y,o.y*o.z-o.x,o.x*o.z-o.y,o.y*o.z+o.x,o.z*o.z];return{t:e,x:a[0]*t.x+a[1]*t.y+a[2]*t.z,y:a[3]*t.x+a[4]*t.y+a[5]*t.z,z:a[6]*t.x+a[7]*t.y+a[8]*t.z}}hull(e){let t=this.points,n=[],i=[],r=0;for(i[r++]=t[0],i[r++]=t[1],i[r++]=t[2],3===this.order&&(i[r++]=t[3]);t.length>1;){n=[];for(let o,s=0,a=t.length-1;s<a;s++)o=af.lerp(e,t[s],t[s+1]),i[r++]=o,n.push(o);t=n}return i}split(t,n){if(0===t&&n)return this.split(n).left;if(1===n)return this.split(t).right;const i=this.hull(t),r={left:2===this.order?new e([i[0],i[3],i[5]]):new e([i[0],i[4],i[7],i[9]]),right:2===this.order?new e([i[5],i[4],i[2]]):new e([i[9],i[8],i[6],i[3]]),span:i};return r.left._t1=af.map(0,0,1,this._t1,this._t2),r.left._t2=af.map(t,0,1,this._t1,this._t2),r.right._t1=af.map(t,0,1,this._t1,this._t2),r.right._t2=af.map(1,0,1,this._t1,this._t2),n?(n=af.map(n,t,1,0,1),r.right.split(n).left):r}extrema(){const e={};let t=[];return this.dims.forEach(function(n){let i=function(e){return e[n]},r=this.dpoints[0].map(i);e[n]=af.droots(r),3===this.order&&(r=this.dpoints[1].map(i),e[n]=e[n].concat(af.droots(r))),e[n]=e[n].filter((function(e){return e>=0&&e<=1})),t=t.concat(e[n].sort(af.numberSort))}.bind(this)),e.values=t.sort(af.numberSort).filter((function(e,n){return t.indexOf(e)===n})),e}bbox(){const e=this.extrema(),t={};return this.dims.forEach(function(n){t[n]=af.getminmax(this,n,e[n])}.bind(this)),t}overlaps(e){const t=this.bbox(),n=e.bbox();return af.bboxoverlap(t,n)}offset(t,n){if(void 0!==n){const e=this.get(t),i=this.normal(t),r={c:e,n:i,x:e.x+i.x*n,y:e.y+i.y*n};return this._3d&&(r.z=e.z+i.z*n),r}if(this._linear){const n=this.normal(0),i=this.points.map((function(e){const i={x:e.x+t*n.x,y:e.y+t*n.y};return e.z&&n.z&&(i.z=e.z+t*n.z),i}));return[new e(i)]}return this.reduce().map((function(e){return e._linear?e.offset(t)[0]:e.scale(t)}))}simple(){if(3===this.order){const e=af.angle(this.points[0],this.points[3],this.points[1]),t=af.angle(this.points[0],this.points[3],this.points[2]);if(e>0&&t<0||e<0&&t>0)return!1}const e=this.normal(0),t=this.normal(1);let n=e.x*t.x+e.y*t.y;return this._3d&&(n+=e.z*t.z),cf(pf(n))<vf/3}reduce(){let e,t,n=0,i=0,r=.01,o=[],s=[],a=this.extrema().values;for(-1===a.indexOf(0)&&(a=[0].concat(a)),-1===a.indexOf(1)&&a.push(1),n=a[0],e=1;e<a.length;e++)i=a[e],t=this.split(n,i),t._t1=n,t._t2=i,o.push(t),n=i;return o.forEach((function(e){for(n=0,i=0;i<=1;)for(i=n+r;i<=1.01;i+=r)if(t=e.split(n,i),!t.simple()){if(i-=r,cf(n-i)<r)return[];t=e.split(n,i),t._t1=af.map(n,0,1,e._t1,e._t2),t._t2=af.map(i,0,1,e._t1,e._t2),s.push(t),n=i;break}n<1&&(t=e.split(n,1),t._t1=af.map(n,0,1,e._t1,e._t2),t._t2=e._t2,s.push(t))})),s}translate(t,n,i){i="number"==typeof i?i:n;const r=this.order;let o=this.points.map(((e,t)=>(1-t/r)*n+t/r*i));return new e(this.points.map(((e,n)=>({x:e.x+t.x*o[n],y:e.y+t.y*o[n]}))))}scale(t){const n=this.order;let i=!1;if("function"==typeof t&&(i=t),i&&2===n)return this.raise().scale(i);const r=this.clockwise,o=this.points;if(this._linear)return this.translate(this.normal(0),i?i(0):t,i?i(1):t);const s=i?i(0):t,a=i?i(1):t,l=[this.offset(0,10),this.offset(1,10)],c=[],u=af.lli4(l[0],l[0].c,l[1],l[1].c);if(!u)throw new Error("cannot scale this curve. Try reducing it first.");return[0,1].forEach((function(e){const t=c[e*n]=af.copy(o[e*n]);t.x+=(e?a:s)*l[e].n.x,t.y+=(e?a:s)*l[e].n.y})),i?([0,1].forEach((function(e){if(2!==n||!e){var s=o[e+1],a={x:s.x-u.x,y:s.y-u.y},l=i?i((e+1)/n):t;i&&!r&&(l=-l);var d=mf(a.x*a.x+a.y*a.y);a.x/=d,a.y/=d,c[e+1]={x:s.x+l*a.x,y:s.y+l*a.y}}})),new e(c)):([0,1].forEach((e=>{if(2===n&&e)return;const t=c[e*n],i=this.derivative(e),r={x:t.x+i.x,y:t.y+i.y};c[e+1]=af.lli4(t,r,u,o[e+1])})),new e(c))}outline(t,n,i,r){if(n=void 0===n?t:n,this._linear){const o=this.normal(0),s=this.points[0],a=this.points[this.points.length-1];let l,c,u;void 0===i&&(i=t,r=n),l={x:s.x+o.x*t,y:s.y+o.y*t},u={x:a.x+o.x*i,y:a.y+o.y*i},c={x:(l.x+u.x)/2,y:(l.y+u.y)/2};const d=[l,c,u];l={x:s.x-o.x*n,y:s.y-o.y*n},u={x:a.x-o.x*r,y:a.y-o.y*r},c={x:(l.x+u.x)/2,y:(l.y+u.y)/2};const h=[u,c,l],f=af.makeline(h[2],d[0]),p=af.makeline(d[2],h[0]),m=[f,new e(d),p,new e(h)];return new lf(m)}const o=this.reduce(),s=o.length,a=[];let l,c=[],u=0,d=this.length();const h=void 0!==i&&void 0!==r;function f(e,t,n,i,r){return function(o){const s=i/n,a=(i+r)/n,l=t-e;return af.map(o,0,1,e+s*l,e+a*l)}}o.forEach((function(e){const o=e.length();h?(a.push(e.scale(f(t,i,d,u,o))),c.push(e.scale(f(-n,-r,d,u,o)))):(a.push(e.scale(t)),c.push(e.scale(-n))),u+=o})),c=c.map((function(e){return l=e.points,l[3]?e.points=[l[3],l[2],l[1],l[0]]:e.points=[l[2],l[1],l[0]],e})).reverse();const p=a[0].points[0],m=a[s-1].points[a[s-1].points.length-1],v=c[s-1].points[c[s-1].points.length-1],g=c[0].points[0],y=af.makeline(v,p),b=af.makeline(m,g),k=[y].concat(a).concat([b]).concat(c);return new lf(k)}outlineshapes(e,t,n){t=t||e;const i=this.outline(e,t).curves,r=[];for(let e=1,t=i.length;e<t/2;e++){const o=af.makeshape(i[e],i[t-e],n);o.startcap.virtual=e>1,o.endcap.virtual=e<t/2-1,r.push(o)}return r}intersects(t,n){return t?t.p1&&t.p2?this.lineIntersects(t):(t instanceof e&&(t=t.reduce()),this.curveintersects(this.reduce(),t,n)):this.selfintersects(n)}lineIntersects(e){const t=uf(e.p1.x,e.p2.x),n=uf(e.p1.y,e.p2.y),i=df(e.p1.x,e.p2.x),r=df(e.p1.y,e.p2.y);return af.roots(this.points,e).filter((e=>{var o=this.get(e);return af.between(o.x,t,i)&&af.between(o.y,n,r)}))}selfintersects(e){const t=this.reduce(),n=t.length-2,i=[];for(let r,o,s,a=0;a<n;a++)o=t.slice(a,a+1),s=t.slice(a+2),r=this.curveintersects(o,s,e),i.push(...r);return i}curveintersects(e,t,n){const i=[];e.forEach((function(e){t.forEach((function(t){e.overlaps(t)&&i.push({left:e,right:t})}))}));let r=[];return i.forEach((function(e){const t=af.pairiteration(e.left,e.right,n);t.length>0&&(r=r.concat(t))})),r}arcs(e){return e=e||.5,this._iterate(e,[])}_error(e,t,n,i){const r=(i-n)/4,o=this.get(n+r),s=this.get(i-r),a=af.dist(e,t),l=af.dist(e,o),c=af.dist(e,s);return cf(l-a)+cf(c-a)}_iterate(e,t){let n,i=0,r=1;do{n=0,r=1;let o,s,a,l,c,u=this.get(i),d=!1,h=!1,f=r,p=1;do{if(h=d,l=a,f=(i+r)/2,o=this.get(f),s=this.get(r),a=af.getccenter(u,o,s),a.interval={start:i,end:r},d=this._error(a,u,i,r)<=e,c=h&&!d,c||(p=r),d){if(r>=1){if(a.interval.end=p=1,l=a,r>1){let e={x:a.x+a.r*hf(a.e),y:a.y+a.r*ff(a.e)};a.e+=af.angle({x:a.x,y:a.y},e,this.get(1))}break}r+=(r-i)/2}else r=f}while(!c&&n++<100);if(n>=100)break;l=l||a,t.push(l),i=p}while(r<1);return t}};var yf={pointsToCurve:function(e,t){let n=1/t;if(0===e.length){let e=[];for(let i=0;i<t;i++){let t=i*n;e.push({x:t,y:.5})}return e}if(1===e.length){let i=e[0].y,r=[{x:0,y:i}];for(let e=0;e<t;e++){let t=e*n+n;r.push({x:t,y:i})}return r}let i=[],r=e[0],o=e[e.length-1],s=new gf({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 gf(o,{x:o.x+(r.x+1-o.x)/2,y:o.y},{x:r.x+1-(r.x+1-o.x)/2,y:r.y},{x:r.x+1,y:r.y});for(let t=0;t<e.length-1;t++){let n=e[t],r=e[t+1],o={x:n.x+(r.x-n.x)/2,y:n.y},s={x:r.x-(r.x-n.x)/2,y:r.y},a=new gf(n,o,s,r);i.push(a)}i.unshift(s),i.push(a);let l=[s.get(s.intersects({p1:{x:0,y:0},p2:{x:0,y:1}})[0])];for(let e=0;e<t;e++){let t,r=e*n+n;i.every((e=>{let n=e.intersects({p1:{x:r,y:0},p2:{x:r,y:1}});return!(n.length>0&&(t=e.get(n[0]),l.push(t),1))}))}return l}};class bf{constructor(e,t){this.xs=e,this.ys=t,this.ks=this.getNaturalKs(new Float64Array(this.xs.length))}getNaturalKs(e){const t=this.xs.length-1,n=function(e,t){const n=[];for(let i=0;i<e;i++)n.push(new Float64Array(t));return n}(t+1,t+2);for(let e=1;e<t;e++)n[e][e-1]=1/(this.xs[e]-this.xs[e-1]),n[e][e]=2*(1/(this.xs[e]-this.xs[e-1])+1/(this.xs[e+1]-this.xs[e])),n[e][e+1]=1/(this.xs[e+1]-this.xs[e]),n[e][t+1]=3*((this.ys[e]-this.ys[e-1])/((this.xs[e]-this.xs[e-1])*(this.xs[e]-this.xs[e-1]))+(this.ys[e+1]-this.ys[e])/((this.xs[e+1]-this.xs[e])*(this.xs[e+1]-this.xs[e])));return n[0][0]=2/(this.xs[1]-this.xs[0]),n[0][1]=1/(this.xs[1]-this.xs[0]),n[0][t+1]=3*(this.ys[1]-this.ys[0])/((this.xs[1]-this.xs[0])*(this.xs[1]-this.xs[0])),n[t][t-1]=1/(this.xs[t]-this.xs[t-1]),n[t][t]=2/(this.xs[t]-this.xs[t-1]),n[t][t+1]=3*(this.ys[t]-this.ys[t-1])/((this.xs[t]-this.xs[t-1])*(this.xs[t]-this.xs[t-1])),function(e,t){const n=e.length;let i=0,r=0;for(;i<n&&r<=n;){let t=0,o=-1/0;for(let s=i;s<n;s++){const n=Math.abs(e[s][r]);n>o&&(t=s,o=n)}if(0===e[t][r])r++;else{kf(e,i,t);for(let t=i+1;t<n;t++){const o=e[t][r]/e[i][r];e[t][r]=0;for(let s=r+1;s<=n;s++)e[t][s]-=e[i][s]*o}i++,r++}}for(let i=n-1;i>=0;i--){var o=0;e[i][i]&&(o=e[i][n]/e[i][i]),t[i]=o;for(let t=i-1;t>=0;t--)e[t][n]-=e[t][i]*o,e[t][i]=0}return t}(n,e)}getIndexBefore(e){let t=0,n=this.xs.length,i=0;for(;t<n;)i=Math.floor((t+n)/2),this.xs[i]<e&&i!==t?t=i:n=this.xs[i]>=e&&i!==n?i:t;return t===this.xs.length-1?this.xs.length-1:t+1}at(e){let t=this.getIndexBefore(e);const n=(e-this.xs[t-1])/(this.xs[t]-this.xs[t-1]),i=this.ks[t-1]*(this.xs[t]-this.xs[t-1])-(this.ys[t]-this.ys[t-1]),r=-this.ks[t]*(this.xs[t]-this.xs[t-1])+(this.ys[t]-this.ys[t-1]);return(1-n)*this.ys[t-1]+n*this.ys[t]+n*(1-n)*(i*(1-n)+r*n)}}function kf(e,t,n){let i=e[t];e[t]=e[n],e[n]=i}function xf(e,t,n){const i=n[0],r=n[n.length-1];if(e<i.x)return i.y;if(e>r.x)return r.y;const o=t.at(e);return Math.max(0,Math.min(o,1))}var wf={pointsToCurve:function(e,t){if(!Array.isArray(e)||!e.every((e=>"object"==typeof e&&"number"==typeof e.x&&"number"==typeof e.y&&e.x>=0&&e.x<=1&&e.y>=0&&e.y<=1)))throw new Error("[pointsToCurve] Invalid points. Expected array of objects with x and y in [0, 1] range.");if(!("number"==typeof t&&t>=1))throw new Error(`[pointsToCurve] Invalid resolution: ${t}. Expected integer >= 1.`);const n=e.map((e=>e.x)),i=e.map((e=>e.y)),r=new bf(n,i);let o=[];for(let n=0;n<t;n++)o.push(xf(n/(t-1),r,e));return o}};function _f(e,t=256,n={}){return"bezier"===n.type?yf.pointsToCurve(e,t,n):wf.pointsToCurve(e,t)}const Tf=[];for(let e=0;e<256;e++)Tf[e]=e;class If extends Ah{constructor(e){const t={vertex:qh,fragment:Vh},n={uniforms:Ah.getUniformInfo(If)};super(If.getFilterType(),t,n,e)}static getFilterType(){return"curves"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(e){let t=[];var n;t=[...e.master||e.points||e.masterPoints?e.master||(n=e.points||e.masterPoints,_f(n,256).map((e=>255*e))):Tf],this.uniforms[xh.STATIC_OPTIONS].set(t)}}function Ef(e,t,n){if("number"!=typeof e||e<0||e>255)throw new Error(`[levels] Invalid black point: ${e}. Expected integer between 0 and 255`);if("number"!=typeof t||t<0||t>255)throw new Error(`[levels] Invalid white point: ${t}. Expected integer between 0 and 255`);if("number"!=typeof n||n<.01||n>9.99)throw new Error(`[levels] Invalid gamma: ${n}. Expected float between 0.01 and 9.99`);if(e>t)throw new Error(`[levels] Invalid black and white points: ${e}, ${t}. Expected black <= white`);let i=[];for(let r=0;r<256;r++){let o;o=r<=e?0:r>=t?255:255*Math.pow((r-e)/(t-e),1/n),i[r]=o}return i}class Sf extends Ah{constructor(e){const t={vertex:qh,fragment:Vh},n={uniforms:Ah.getUniformInfo(Sf)};super(Sf.getFilterType(),t,n,e)}static getFilterType(){return"levels"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(e){let t=[...Ef(e.black,e.white,e.gamma)];this.uniforms[xh.STATIC_OPTIONS].set(t)}}const Af=360,Nf=[];for(let e=0;e<Af;e++)Nf[e]=e;class Mf extends Ah{constructor(e){const t={uniforms:Ah.getUniformInfo(Mf)};super(Mf.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\n",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\n\n// a 360 length array with values for the hue curve\n// this represents a lookup table from a hue value to another hue value\nuniform float staticOptions[360];\n\n// implementation of round (doesn't exist in webgl)\nint round(float val){\n return int(floor(val + 0.5));\n}\n\n// glsl mod doesn't work with negative numbers so\n// this is a safer version that lets us play with negatives > -1.0\nfloat safeMod(float val){\n return mod(val + 1.0, 1.0);\n}\n\n// no dynamic array indexes in webgl\n// see https://stackoverflow.com/questions/30585265/what-can-i-use-as-an-array-index-in-glsl-in-webgl\nfloat getCurveValue(float pixelValue){\n float v;\n for (int k = 0; k < 360; k++) {\n if (k == round(pixelValue * 359.0)){\n v = float(staticOptions[k]) / 359.0;\n }\n }\n return v;\n}\n\n// function source https://www.shadertoy.com/view/4dKcWK\nconst float EPSILON = 1e-10;\n\nvec3 HUEtoRGB(in float hue) {\n // Hue [0..1] to RGB [0..1]\n // See http://www.chilliant.com/rgb2hsv.html\n vec3 rgb = abs(hue * 6. - vec3(3, 2, 4)) * vec3(1, -1, -1) + vec3(-1, 2, 2);\n return clamp(rgb, 0., 1.);\n}\n\nvec3 RGBtoHCV(in vec3 rgb) {\n // RGB [0..1] to Hue-Chroma-Value [0..1]\n // Based on work by Sam Hocevar and Emil Persson\n vec4 p = (rgb.g < rgb.b) ? vec4(rgb.bg, -1., 2. / 3.) : vec4(rgb.gb, 0., -1. / 3.);\n vec4 q = (rgb.r < p.x) ? vec4(p.xyw, rgb.r) : vec4(rgb.r, p.yzx);\n float c = q.x - min(q.w, q.y);\n float h = abs((q.w - q.y) / (6. * c + EPSILON) + q.z);\n return vec3(h, c, q.x);\n}\n\nvec3 HSVtoRGB(in vec3 hsv) {\n // Hue-Saturation-Value [0..1] to RGB [0..1]\n vec3 rgb = HUEtoRGB(hsv.x);\n return ((rgb - 1.) * hsv.y + 1.) * hsv.z;\n}\n\nvec3 HSLtoRGB(in vec3 hsl) {\n // Hue-Saturation-Lightness [0..1] to RGB [0..1]\n vec3 rgb = HUEtoRGB(hsl.x);\n float c = (1. - abs(2. * hsl.z - 1.)) * hsl.y;\n return (rgb - 0.5) * c + hsl.z;\n}\n\nvec3 RGBtoHSV(in vec3 rgb) {\n // RGB [0..1] to Hue-Saturation-Value [0..1]\n vec3 hcv = RGBtoHCV(rgb);\n float s = hcv.y / (hcv.z + EPSILON);\n return vec3(hcv.x, s, hcv.z);\n}\n\nvec3 RGBtoHSL(in vec3 rgb) {\n // RGB [0..1] to Hue-Saturation-Lightness [0..1]\n vec3 hcv = RGBtoHCV(rgb);\n float z = hcv.z - hcv.y * 0.5;\n float s = hcv.y / (1. - abs(z * 2. - 1.) + EPSILON);\n return vec3(hcv.x, s, z);\n}\n\nvoid main() {\n vec4 textureColor = texture2D(first_texture, current_texture_coordinate_2d);\n vec3 inHSL = RGBtoHSL(textureColor.rgb);\n // in the UI hue 0 is cyan and 180 is red\n float shiftedHue = getCurveValue(mod(inHSL.x + 0.5, 1.0));\n vec3 inRGB = HSLtoRGB(vec3(shiftedHue, inHSL.y, inHSL.z));\n\n vec4 finalColor = vec4(inRGB, textureColor.a);\n\n // During the rgb-to-hsl-to-rgb conversion total whites gets clipped on OSX for some reason\n // make sure to retain absolute white (since it has no chroma component)\n if (textureColor.r == 1.0 && textureColor.g == 1.0 && textureColor.b == 1.0){\n finalColor.rgb = vec3(1.0, 1.0, 1.0);\n }\n\n gl_FragColor = finalColor;\n}\n"},t,e)}static getFilterType(){return"hue"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(e){let t=e.points&&function(e){return _f(e,Af,{type:"bezier"}).map((e=>{return t=e,((Math.round(t.x*Af)+180)%Af+(1-t.y-.5)*Af+Af)%Af;var t}))}(e.points)||Nf;this.uniforms[xh.STATIC_OPTIONS].set(t)}}class Ff extends Ah{constructor(e){const t={uniforms:Ah.getUniformInfo(Ff)};super(Ff.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\n",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\nuniform float staticOptions[2];\n\n//CIE L*a*b* (CIELAB, L* for lightness, a* from green to red, b* from blue to yellow)\n//Source: https://gist.github.com/mattatz/44f081cac87e2f7c8980 (HLSL)\nvec3 rgb2xyz(vec3 c){\n vec3 tmp=vec3(\n (c.r>.04045)?pow((c.r+.055)/1.055,2.4):c.r/12.92,\n (c.g>.04045)?pow((c.g+.055)/1.055,2.4):c.g/12.92,\n (c.b>.04045)?pow((c.b+.055)/1.055,2.4):c.b/12.92\n );\n mat3 mat=mat3(\n .4124,.3576,.1805,\n .2126,.7152,.0722,\n .0193,.1192,.9505\n );\n return 100.*(tmp*mat);\n}\nvec3 xyz2lab(vec3 c){\n vec3 n=c/vec3(95.047,100.,108.883),\n v=vec3(\n (n.x>.008856)?pow(n.x,1./3.):(7.787*n.x)+(16./116.),\n (n.y>.008856)?pow(n.y,1./3.):(7.787*n.y)+(16./116.),\n (n.z>.008856)?pow(n.z,1./3.):(7.787*n.z)+(16./116.)\n );\n return vec3((116.*v.y)-16.,500.*(v.x-v.y),200.*(v.y-v.z));\n}\nvec3 rgb2lab(vec3 c){\n vec3 lab=xyz2lab(rgb2xyz(c));\n return vec3(lab.x/100.,.5+.5*(lab.y/127.),.5+.5*(lab.z/127.));\n}\nvec3 lab2xyz(vec3 c){\n float fy=(c.x+16.)/116.,\n fx=c.y/500.+fy,\n fz=fy-c.z/200.;\n return vec3(\n 95.047*((fx>.206897)?fx*fx*fx:(fx-16./116.)/7.787),\n 100. *((fy>.206897)?fy*fy*fy:(fy-16./116.)/7.787),\n 108.883*((fz>.206897)?fz*fz*fz:(fz-16./116.)/7.787)\n );\n}\nvec3 xyz2rgb(vec3 c){\n mat3 mat=mat3(\n 3.2406,-1.5372,-.4986,\n -.9689, 1.8758, .0415,\n .0557, -.2040,1.0570\n );\n vec3 v=(c/100.0)*mat,\n r=vec3(\n (v.r>.0031308)?((1.055*pow(v.r,(1./2.4)))-.055):12.92*v.r,\n (v.g>.0031308)?((1.055*pow(v.g,(1./2.4)))-.055):12.92*v.g,\n (v.b>.0031308)?((1.055*pow(v.b,(1./2.4)))-.055):12.92*v.b\n );\n return r;\n}\nvec3 lab2rgb(vec3 c){return xyz2rgb(lab2xyz(vec3(100.*c.x,2.*127.*(c.y-.5),2.*127.*(c.z-.5))));}\n\n\nfloat handleMix(float x){\n return pow(x * 2.0 - 1.0, 2.0);\n}\n\nvoid main() {\n vec3 inColor = texture2D(first_texture, current_texture_coordinate_2d).rgb;\n// inColor = vec3(148.0 / 255.0, 99.0 / 255.0, 95.0 / 255.0); // debug\n\n vec3 inLab = rgb2lab(inColor);\n vec3 inRGB ;\n\n// vec2 tempTint = vec2(staticOptions[1], -staticOptions[0]);\n\n// inLab.yz += (tempTint.xy); // * 0.3; // damping of effect\n\n // lab range is 0 to 1, input is -128 to 127\n // lab chromacity zero is 0.5, 0.5 so convert between the ranges\n // y is a, z is b\n inLab.y -= (-staticOptions[1] + 128.0) / 255.0 - 0.5;\n inLab.z -= (staticOptions[0] + 128.0) / 255.0 - 0.5;\n\n inRGB = lab2rgb(inLab);\n\n\n // vec3 mixed = mix(inRGB, inColor, handleMix(inLab.x)); // mid tones\n // vec3 mixed = mix(inRGB, inColor, inLab.x); // only high tones\n vec3 mixed = mix(inRGB, inColor, 0.0); // no mix\n\n gl_FragColor = vec4(mixed,1.0);\n}\n"},t,e)}static getFilterType(){return"whiteBalance"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(e){let t=e.temperature?e.temperature:0,n=e.tint?e.tint:0;this.uniforms[xh.STATIC_OPTIONS].set([t,n])}}class Cf extends Ah{constructor(e){const t={uniforms:Ah.getUniformInfo(Cf)};super(Cf.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\n",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\nuniform float staticOptions[4];\n\n// algorithm from here\n// https://github.com/CeeJayDK/SweetFX/blob/master/Shaders/Vibrance.fx\n\nvoid main() {\n float percentAmount = staticOptions[0];\n float redBalance = staticOptions[1];\n float greenBalance = staticOptions[2];\n float blueBalance = staticOptions[3];\n\n vec3 color = texture2D(first_texture, current_texture_coordinate_2d).rgb;\n vec3 coefLuma = vec3(0.212656, 0.715158, 0.072186);\n\n float luma = dot(coefLuma, color);\n\n float max_color = max(color.r, max(color.g, color.b)); // Find the strongest color\n float min_color = min(color.r, min(color.g, color.b)); // Find the weakest color\n\n float color_saturation = max_color - min_color; // The difference between the two is the saturation\n\n // Extrapolate between luma and original by 1 + (1-saturation) - current\n vec3 coeffVibrance = vec3(redBalance, greenBalance, blueBalance) * percentAmount;\n\n color.r = mix(luma, color.r, 1.0 + (coeffVibrance.r * (1.0 - (sign(coeffVibrance.r) * color_saturation))));\n color.g = mix(luma, color.g, 1.0 + (coeffVibrance.g * (1.0 - (sign(coeffVibrance.g) * color_saturation))));\n color.b = mix(luma, color.b, 1.0 + (coeffVibrance.b * (1.0 - (sign(coeffVibrance.b) * color_saturation))));\n\n\n gl_FragColor = vec4(color, 1.0);\n\n}\n"},t,e)}static getFilterType(){return"vibrance"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(e){let t=e.amount?e.amount/100*2:0,n=null===e.redBalance?1:e.redBalance,i=null===e.greenBalance?1:e.greenBalance,r=null===e.blueBalance?1:e.blueBalance;this.uniforms[xh.STATIC_OPTIONS].set([t,n,i,r])}}class Of extends Ah{constructor(e){const t={uniforms:Ah.getUniformInfo(Of)};super(Of.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\n",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\nuniform float staticOptions[1];\n\n// algorithm from here\n// https://github.com/minus34/cesium1/blob/master/Cesium/Shaders/Builtin/Functions/saturation.glsl\n\n/**\n * Adjusts the saturation of a color.\n *\n * @name czm_saturation\n * @glslFunction\n *\n * @param {vec3} rgb The color.\n * @param {float} adjustment The amount to adjust the saturation of the color.\n *\n * @returns {float} The color with the saturation adjusted.\n *\n * @example\n * vec3 greyScale = czm_saturation(color, 0.0);\n * vec3 doubleSaturation = czm_saturation(color, 2.0);\n */\nvec3 czm_saturation(vec3 rgb, float adjustment)\n{\n // Algorithm from Chapter 16 of OpenGL Shading Language\n const vec3 W = vec3(0.2125, 0.7154, 0.0721);\n vec3 intensity = vec3(dot(rgb, W));\n return mix(intensity, rgb, adjustment);\n}\n\n\nvoid main() {\n float amount = staticOptions[0];\n vec3 color = texture2D(first_texture, current_texture_coordinate_2d).rgb;\n gl_FragColor = vec4(czm_saturation(color, amount), 1.0);\n}\n"},t,e)}static getFilterType(){return"saturation"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(e){let t=null===e.amount?1:e.amount;this.uniforms[xh.STATIC_OPTIONS].set([t])}}class Pf extends Ah{constructor(e){const t={uniforms:Ah.getUniformInfo(Pf)};super(Pf.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nuniform float staticOptions[12];\nuniform float runtimeOptions[4];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\n\nfloat roundedBoxSDF(vec2 CenterPosition, vec2 Size, float Radius) {\n return length(max(abs(CenterPosition)-Size+Radius,0.0))-Radius;\n}\n\nvoid main() {\n vec2 srcAR = vec2(runtimeOptions[0]/runtimeOptions[1], 1.0);\n // custom aspect ratio (other than the default 1920/1080)\n // useful for example when doing crop on crop\n if (staticOptions[10] > 0.0) { //\n srcAR.x = staticOptions[10];\n }\n vec2 srcCenter = vec2(staticOptions[0], staticOptions[1]);\n vec2 srcDims = vec2(staticOptions[2], staticOptions[3]);\n vec2 srcTL = vec2(srcCenter.x - srcDims[0] / 2.0, srcCenter.y - srcDims[1] / 2.0); // top left point\n\n vec2 srcDims_AR = srcDims * srcAR;\n vec2 srcTL_AR = srcTL * srcAR;\n\n vec2 vpDims = vec2(runtimeOptions[2], runtimeOptions[3]);\n vec2 vpAR = vec2(vpDims[0]/vpDims[1], 1.0);\n\n vec2 tgtCenter = vec2(staticOptions[4], staticOptions[5]);\n vec2 tgtDims = vec2(staticOptions[6], staticOptions[7]);\n vec2 tgtTL = vec2(tgtCenter.x - tgtDims[0] / 2.0, tgtCenter.y - tgtDims[1] / 2.0);\n\n vec2 tgtDims_AR = tgtDims * vpAR;\n vec2 tgtTL_AR = tgtTL * vpAR;\n\n vec2 pos_AR = current_texture_coordinate_2d * vpAR;\n\n float ratioW = tgtDims_AR[0] / srcDims_AR[0];\n float ratioH = tgtDims_AR[1] / srcDims_AR[1];\n\n float ratio;\n\n // the type of crop fit. 0 - contain, 1 - fill, 3 - stretch\n float fitType = staticOptions[8];\n\n if (fitType == 0.0){\n ratio = ratioW > ratioH ? ratioW : ratioH;\n vec2 tgtDims_OLD_AR = tgtDims_AR;\n tgtDims_AR = srcDims_AR * ratio;\n tgtTL_AR = tgtTL_AR - (tgtDims_AR - tgtDims_OLD_AR) / 2.0;\n } else if (fitType == 1.0){\n ratio = ratioW < ratioH ? ratioW : ratioH;\n vec2 tgtDims_OLD_AR = tgtDims_AR;\n tgtDims_AR = srcDims_AR * ratio;\n tgtTL_AR = tgtTL_AR + (tgtDims_OLD_AR - tgtDims_AR) / 2.0;\n }\n\n vec2 final_pos_AR = (pos_AR - tgtTL_AR) / tgtDims_AR * srcDims_AR + srcTL_AR;\n\n // transform coords back from AR into 0 to 1 range\n vec2 pos = final_pos_AR / srcAR;\n\n // How soft the edges should be . Higher values could be used to simulate a drop shadow.\n float edgeSoftness = staticOptions[11];\n\n // The radius of the corners in pixels\n float radius = staticOptions[9];\n\n float tightDistance = roundedBoxSDF((current_texture_coordinate_2d - tgtCenter) , tgtDims_AR / vpAR / 2.0, 0.0);\n// float distance = roundedBoxSDF((current_texture_coordinate_2d - tgtCenter) * vpAR, tgtDims * vpAR / 2.0, 0.01);\n float distance = roundedBoxSDF((current_texture_coordinate_2d - tgtCenter) * vpDims, (tgtDims * vpDims) / 2.0, radius);\n\n // Smooth the result (free antialiasing).\n float smoothedAlpha = 1.0 - smoothstep(0.0, edgeSoftness * 2.0, distance);\n\n // Return the resultant shape.\n vec4 textureColor = texture2D(first_texture, pos);\n vec4 quadColor = vec4(textureColor.xyz, smoothedAlpha);\n\n // Apply a drop shadow effect.\n// float shadowSoftness = 0.0;\n// vec2 shadowOffset = vec2(0.0, 0.0);\n// float shadowDistance = roundedBoxSDF(pos + shadowOffset, tgtDims_AR / 2.0, radius);\n// float shadowAlpha = 1.0 - smoothstep(-shadowSoftness, shadowSoftness, shadowDistance);\n// vec4 shadowColor = vec4(0.4, 0.4, 0.4, 1.0);\n // gl_FragColor = mix(quadColor, shadowColor, shadowAlpha - smoothedAlpha);\n\n\n // pillarboxing\n if (tightDistance > 0.0 && distance <= 0.0){\n gl_FragColor = vec4(0, 0, 0, 1.0);\n } else {\n gl_FragColor = quadColor;\n }\n\n // debug\n // gl_FragColor = texture2D(first_texture, pos);\n\n}"},t,e)}static getFilterType(){return"crop"}static getInputsCount(){return 1}static getInitialOptions(){return{source:{center:{x:.5,y:.5},width:1,height:1},target:{center:{x:.5,y:.5},width:1,height:1},fitType:"fill",cornerRadius:10,edgeSoftness:0}}getOptionsDisplay(){return[]}static getUniformList(){return[xh.FIRST_TEXTURE,yh,bh]}handleStaticUniforms(e){let t={...Pf.getInitialOptions(),...e};const n=Number.parseFloat(t.source.center.x).toFixed(5),i=Number.parseFloat(t.source.center.y).toFixed(5),r=Number.parseFloat(t.source.width).toFixed(5),o=Number.parseFloat(t.source.height).toFixed(5),s=Number.parseFloat(t.target.center.x).toFixed(5),a=Number.parseFloat(t.target.center.y).toFixed(5),l=Number.parseFloat(t.target.width).toFixed(5),c=Number.parseFloat(t.target.height).toFixed(5),u=Number.parseFloat(t.edgeSoftness).toFixed(5),d=t.source.aspectRatio?Number.parseFloat(t.source.aspectRatio).toFixed(5):0;let h;h="fill"===t.fitType?0:"contain"===t.fitType?1:2;const f=Number.parseFloat(t.cornerRadius).toFixed(5);this.uniforms[xh.STATIC_OPTIONS].set([n,i,r,o,s,a,l,c,h,f,d,u])}}class Rf extends Ah{constructor(e){const t={uniforms:Ah.getUniformInfo(Rf)};super(Rf.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nuniform float staticOptions[4];\nuniform float runtimeOptions[2];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\n\nvoid main() {\n // this is the the texture from the prev shader\n vec4 texture = texture2D(first_texture, current_texture_coordinate_2d);\n vec4 color = vec4(staticOptions[0], staticOptions[1], staticOptions[2], 1.0);\n vec4 blended = mix(texture, color, staticOptions[3]);\n gl_FragColor = blended;\n}"},t,e)}static getFilterType(){return"solid"}static getInputsCount(){return 1}static getInitialOptions(){return{color:{r:.33,g:.66,b:.99,a:1}}}getOptionsDisplay(){return[{properties:["color","r"],type:"slider",minValue:0,maxValue:1,step:.001},{properties:["color","g"],type:"slider",minValue:0,maxValue:1,step:.001},{properties:["color","b"],type:"slider",minValue:0,maxValue:1,step:.001}]}handleStaticUniforms(e){var t;const n=Number.parseFloat(e.color.r).toFixed(5),i=Number.parseFloat(e.color.g).toFixed(5),r=Number.parseFloat(e.color.b).toFixed(5),o=(null!==(t=Number.parseFloat(e.color.a))&&void 0!==t?t:1).toFixed(5);this.uniforms[xh.STATIC_OPTIONS].set([n,i,r,o])}}class Df extends Ah{constructor(e){const t={uniforms:Ah.getUniformInfo(Df)};super(Df.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nuniform float runtimeOptions[1];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\n\nvoid main() {\n vec4 textureColor = texture2D(first_texture, current_texture_coordinate_2d);\n gl_FragColor = vec4(textureColor.rgb, 1.0);\n}\n"},t,e)}static getFilterType(){return"solidImage"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}}class Lf extends Ah{constructor(e){const t={uniforms:Ah.getUniformInfo(Lf)};super(Lf.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_position = vec4(position_3d.xyz, 1);\n gl_Position = normalize_position;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\n",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\n\n//CIE L*a*b* (CIELAB, L* for lightness, a* from green to red, b* from blue to yellow)\n//Source: https://gist.github.com/mattatz/44f081cac87e2f7c8980 (HLSL)\nvec3 rgb2xyz(vec3 c){\n vec3 tmp=vec3(\n (c.r>.04045)?pow((c.r+.055)/1.055,2.4):c.r/12.92,\n (c.g>.04045)?pow((c.g+.055)/1.055,2.4):c.g/12.92,\n (c.b>.04045)?pow((c.b+.055)/1.055,2.4):c.b/12.92\n );\n mat3 mat=mat3(\n .4124,.3576,.1805,\n .2126,.7152,.0722,\n .0193,.1192,.9505\n );\n return 100.*(tmp*mat);\n}\nvec3 xyz2lab(vec3 c){\n vec3 n=c/vec3(95.047,100.,108.883),\n v=vec3(\n (n.x>.008856)?pow(n.x,1./3.):(7.787*n.x)+(16./116.),\n (n.y>.008856)?pow(n.y,1./3.):(7.787*n.y)+(16./116.),\n (n.z>.008856)?pow(n.z,1./3.):(7.787*n.z)+(16./116.)\n );\n return vec3((116.*v.y)-16.,500.*(v.x-v.y),200.*(v.y-v.z));\n}\nvec3 rgb2lab(vec3 c){\n vec3 lab=xyz2lab(rgb2xyz(c));\n return vec3(lab.x/100.,.5+.5*(lab.y/127.),.5+.5*(lab.z/127.));\n}\n\nvoid main() {\n vec3 inColor = texture2D(first_texture, current_texture_coordinate_2d).rgb;\n vec3 inLab = rgb2lab(inColor);\n gl_FragColor = vec4(inLab, 1.0);\n}\n"},t,e)}static getFilterType(){return"lab"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(e){let t=e.temperature?e.temperature:0,n=e.tint?e.tint:0;this.uniforms[xh.STATIC_OPTIONS].set([t,n])}}class Bf extends Ah{constructor(e){const t={uniforms:Ah.getUniformInfo(Bf)};super(Bf.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n} ",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\nuniform float staticOptions[1];\n\nvoid main() {\n float exposureStops = staticOptions[0];\n vec3 color = texture2D(first_texture, current_texture_coordinate_2d).rgb;\n \n // Convert exposure stops to multiplier: pow(2.0, stops)\n float multiplier = pow(2.0, exposureStops);\n \n // Apply exposure adjustment\n vec3 exposedColor = color * multiplier;\n \n gl_FragColor = vec4(exposedColor, 1.0);\n} "},t,e)}static getFilterType(){return"exposure"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(e){let t=null===e.exposure?0:e.exposure;this.uniforms[xh.STATIC_OPTIONS].set([t])}}var zf,Wf,$f,Uf,jf,qf,Vf,Gf;function Hf(){if(Uf)return $f;Uf=1;const e=Wf?zf:(Wf=1,zf={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}),t={};for(const n of Object.keys(e))t[e[n]]=n;const n={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};$f=n;for(const e of Object.keys(n)){if(!("channels"in n[e]))throw new Error("missing channels property: "+e);if(!("labels"in n[e]))throw new Error("missing channel labels property: "+e);if(n[e].labels.length!==n[e].channels)throw new Error("channel and label counts mismatch: "+e);const{channels:t,labels:i}=n[e];delete n[e].channels,delete n[e].labels,Object.defineProperty(n[e],"channels",{value:t}),Object.defineProperty(n[e],"labels",{value:i})}function i(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}return n.rgb.hsl=function(e){const t=e[0]/255,n=e[1]/255,i=e[2]/255,r=Math.min(t,n,i),o=Math.max(t,n,i),s=o-r;let a,l;o===r?a=0:t===o?a=(n-i)/s:n===o?a=2+(i-t)/s:i===o&&(a=4+(t-n)/s),a=Math.min(60*a,360),a<0&&(a+=360);const c=(r+o)/2;return l=o===r?0:c<=.5?s/(o+r):s/(2-o-r),[a,100*l,100*c]},n.rgb.hsv=function(e){let t,n,i,r,o;const s=e[0]/255,a=e[1]/255,l=e[2]/255,c=Math.max(s,a,l),u=c-Math.min(s,a,l),d=function(e){return(c-e)/6/u+.5};return 0===u?(r=0,o=0):(o=u/c,t=d(s),n=d(a),i=d(l),s===c?r=i-n:a===c?r=1/3+t-i:l===c&&(r=2/3+n-t),r<0?r+=1:r>1&&(r-=1)),[360*r,100*o,100*c]},n.rgb.hwb=function(e){const t=e[0],i=e[1];let r=e[2];const o=n.rgb.hsl(e)[0],s=1/255*Math.min(t,Math.min(i,r));return r=1-1/255*Math.max(t,Math.max(i,r)),[o,100*s,100*r]},n.rgb.cmyk=function(e){const t=e[0]/255,n=e[1]/255,i=e[2]/255,r=Math.min(1-t,1-n,1-i);return[100*((1-t-r)/(1-r)||0),100*((1-n-r)/(1-r)||0),100*((1-i-r)/(1-r)||0),100*r]},n.rgb.keyword=function(n){const r=t[n];if(r)return r;let o,s=1/0;for(const t of Object.keys(e)){const r=i(n,e[t]);r<s&&(s=r,o=t)}return o},n.keyword.rgb=function(t){return e[t]},n.rgb.xyz=function(e){let t=e[0]/255,n=e[1]/255,i=e[2]/255;return t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92,i=i>.04045?((i+.055)/1.055)**2.4:i/12.92,[100*(.4124*t+.3576*n+.1805*i),100*(.2126*t+.7152*n+.0722*i),100*(.0193*t+.1192*n+.9505*i)]},n.rgb.lab=function(e){const t=n.rgb.xyz(e);let i=t[0],r=t[1],o=t[2];return i/=95.047,r/=100,o/=108.883,i=i>.008856?i**(1/3):7.787*i+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,o=o>.008856?o**(1/3):7.787*o+16/116,[116*r-16,500*(i-r),200*(r-o)]},n.hsl.rgb=function(e){const t=e[0]/360,n=e[1]/100,i=e[2]/100;let r,o,s;if(0===n)return s=255*i,[s,s,s];r=i<.5?i*(1+n):i+n-i*n;const a=2*i-r,l=[0,0,0];for(let e=0;e<3;e++)o=t+1/3*-(e-1),o<0&&o++,o>1&&o--,s=6*o<1?a+6*(r-a)*o:2*o<1?r:3*o<2?a+(r-a)*(2/3-o)*6:a,l[e]=255*s;return l},n.hsl.hsv=function(e){const t=e[0];let n=e[1]/100,i=e[2]/100,r=n;const o=Math.max(i,.01);return i*=2,n*=i<=1?i:2-i,r*=o<=1?o:2-o,[t,100*(0===i?2*r/(o+r):2*n/(i+n)),(i+n)/2*100]},n.hsv.rgb=function(e){const t=e[0]/60,n=e[1]/100;let i=e[2]/100;const r=Math.floor(t)%6,o=t-Math.floor(t),s=255*i*(1-n),a=255*i*(1-n*o),l=255*i*(1-n*(1-o));switch(i*=255,r){case 0:return[i,l,s];case 1:return[a,i,s];case 2:return[s,i,l];case 3:return[s,a,i];case 4:return[l,s,i];case 5:return[i,s,a]}},n.hsv.hsl=function(e){const t=e[0],n=e[1]/100,i=e[2]/100,r=Math.max(i,.01);let o,s;s=(2-n)*i;const a=(2-n)*r;return o=n*r,o/=a<=1?a:2-a,o=o||0,s/=2,[t,100*o,100*s]},n.hwb.rgb=function(e){const t=e[0]/360;let n=e[1]/100,i=e[2]/100;const r=n+i;let o;r>1&&(n/=r,i/=r);const s=Math.floor(6*t),a=1-i;o=6*t-s,1&s&&(o=1-o);const l=n+o*(a-n);let c,u,d;switch(s){default:case 6:case 0:c=a,u=l,d=n;break;case 1:c=l,u=a,d=n;break;case 2:c=n,u=a,d=l;break;case 3:c=n,u=l,d=a;break;case 4:c=l,u=n,d=a;break;case 5:c=a,u=n,d=l}return[255*c,255*u,255*d]},n.cmyk.rgb=function(e){const t=e[0]/100,n=e[1]/100,i=e[2]/100,r=e[3]/100;return[255*(1-Math.min(1,t*(1-r)+r)),255*(1-Math.min(1,n*(1-r)+r)),255*(1-Math.min(1,i*(1-r)+r))]},n.xyz.rgb=function(e){const t=e[0]/100,n=e[1]/100,i=e[2]/100;let r,o,s;return r=3.2406*t+-1.5372*n+-.4986*i,o=-.9689*t+1.8758*n+.0415*i,s=.0557*t+-.204*n+1.057*i,r=r>.0031308?1.055*r**(1/2.4)-.055:12.92*r,o=o>.0031308?1.055*o**(1/2.4)-.055:12.92*o,s=s>.0031308?1.055*s**(1/2.4)-.055:12.92*s,r=Math.min(Math.max(0,r),1),o=Math.min(Math.max(0,o),1),s=Math.min(Math.max(0,s),1),[255*r,255*o,255*s]},n.xyz.lab=function(e){let t=e[0],n=e[1],i=e[2];return t/=95.047,n/=100,i/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,[116*n-16,500*(t-n),200*(n-i)]},n.lab.xyz=function(e){let t,n,i;n=(e[0]+16)/116,t=e[1]/500+n,i=n-e[2]/200;const r=n**3,o=t**3,s=i**3;return n=r>.008856?r:(n-16/116)/7.787,t=o>.008856?o:(t-16/116)/7.787,i=s>.008856?s:(i-16/116)/7.787,t*=95.047,n*=100,i*=108.883,[t,n,i]},n.lab.lch=function(e){const t=e[0],n=e[1],i=e[2];let r;return r=360*Math.atan2(i,n)/2/Math.PI,r<0&&(r+=360),[t,Math.sqrt(n*n+i*i),r]},n.lch.lab=function(e){const t=e[0],n=e[1],i=e[2]/360*2*Math.PI;return[t,n*Math.cos(i),n*Math.sin(i)]},n.rgb.ansi16=function(e,t=null){const[i,r,o]=e;let s=null===t?n.rgb.hsv(e)[2]:t;if(s=Math.round(s/50),0===s)return 30;let a=30+(Math.round(o/255)<<2|Math.round(r/255)<<1|Math.round(i/255));return 2===s&&(a+=60),a},n.hsv.ansi16=function(e){return n.rgb.ansi16(n.hsv.rgb(e),e[2])},n.rgb.ansi256=function(e){const t=e[0],n=e[1],i=e[2];return t===n&&n===i?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(i/255*5)},n.ansi16.rgb=function(e){let t=e%10;if(0===t||7===t)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];const n=.5*(1+~~(e>50));return[(1&t)*n*255,(t>>1&1)*n*255,(t>>2&1)*n*255]},n.ansi256.rgb=function(e){if(e>=232){const t=10*(e-232)+8;return[t,t,t]}let t;return e-=16,[Math.floor(e/36)/5*255,Math.floor((t=e%36)/6)/5*255,t%6/5*255]},n.rgb.hex=function(e){const t=(((255&Math.round(e[0]))<<16)+((255&Math.round(e[1]))<<8)+(255&Math.round(e[2]))).toString(16).toUpperCase();return"000000".substring(t.length)+t},n.hex.rgb=function(e){const t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];let n=t[0];3===t[0].length&&(n=n.split("").map((e=>e+e)).join(""));const i=parseInt(n,16);return[i>>16&255,i>>8&255,255&i]},n.rgb.hcg=function(e){const t=e[0]/255,n=e[1]/255,i=e[2]/255,r=Math.max(Math.max(t,n),i),o=Math.min(Math.min(t,n),i),s=r-o;let a,l;return a=s<1?o/(1-s):0,l=s<=0?0:r===t?(n-i)/s%6:r===n?2+(i-t)/s:4+(t-n)/s,l/=6,l%=1,[360*l,100*s,100*a]},n.hsl.hcg=function(e){const t=e[1]/100,n=e[2]/100,i=n<.5?2*t*n:2*t*(1-n);let r=0;return i<1&&(r=(n-.5*i)/(1-i)),[e[0],100*i,100*r]},n.hsv.hcg=function(e){const t=e[1]/100,n=e[2]/100,i=t*n;let r=0;return i<1&&(r=(n-i)/(1-i)),[e[0],100*i,100*r]},n.hcg.rgb=function(e){const t=e[0]/360,n=e[1]/100,i=e[2]/100;if(0===n)return[255*i,255*i,255*i];const r=[0,0,0],o=t%1*6,s=o%1,a=1-s;let l=0;switch(Math.floor(o)){case 0:r[0]=1,r[1]=s,r[2]=0;break;case 1:r[0]=a,r[1]=1,r[2]=0;break;case 2:r[0]=0,r[1]=1,r[2]=s;break;case 3:r[0]=0,r[1]=a,r[2]=1;break;case 4:r[0]=s,r[1]=0,r[2]=1;break;default:r[0]=1,r[1]=0,r[2]=a}return l=(1-n)*i,[255*(n*r[0]+l),255*(n*r[1]+l),255*(n*r[2]+l)]},n.hcg.hsv=function(e){const t=e[1]/100,n=t+e[2]/100*(1-t);let i=0;return n>0&&(i=t/n),[e[0],100*i,100*n]},n.hcg.hsl=function(e){const t=e[1]/100,n=e[2]/100*(1-t)+.5*t;let i=0;return n>0&&n<.5?i=t/(2*n):n>=.5&&n<1&&(i=t/(2*(1-n))),[e[0],100*i,100*n]},n.hcg.hwb=function(e){const t=e[1]/100,n=t+e[2]/100*(1-t);return[e[0],100*(n-t),100*(1-n)]},n.hwb.hcg=function(e){const t=e[1]/100,n=1-e[2]/100,i=n-t;let r=0;return i<1&&(r=(n-i)/(1-i)),[e[0],100*i,100*r]},n.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},n.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},n.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},n.gray.hsl=function(e){return[0,0,e[0]]},n.gray.hsv=n.gray.hsl,n.gray.hwb=function(e){return[0,100,e[0]]},n.gray.cmyk=function(e){return[0,0,0,e[0]]},n.gray.lab=function(e){return[e[0],0,0]},n.gray.hex=function(e){const t=255&Math.round(e[0]/100*255),n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(n.length)+n},n.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]},$f}function Kf(){if(qf)return jf;qf=1;const e=Hf();function t(e,t){return function(n){return t(e(n))}}function n(n,i){const r=[i[n].parent,n];let o=e[i[n].parent][n],s=i[n].parent;for(;i[s].parent;)r.unshift(i[s].parent),o=t(e[i[s].parent][s],o),s=i[s].parent;return o.conversion=r,o}return jf=function(t){const i=function(t){const n=function(){const t={},n=Object.keys(e);for(let e=n.length,i=0;i<e;i++)t[n[i]]={distance:-1,parent:null};return t}(),i=[t];for(n[t].distance=0;i.length;){const t=i.pop(),r=Object.keys(e[t]);for(let e=r.length,o=0;o<e;o++){const e=r[o],s=n[e];-1===s.distance&&(s.distance=n[t].distance+1,s.parent=t,i.unshift(e))}}return n}(t),r={},o=Object.keys(i);for(let e=o.length,t=0;t<e;t++){const e=o[t];null!==i[e].parent&&(r[e]=n(e,i))}return r}}var Xf=function(){if(Gf)return Vf;Gf=1;const e=Hf(),t=Kf(),n={};return Object.keys(e).forEach((i=>{n[i]={},Object.defineProperty(n[i],"channels",{value:e[i].channels}),Object.defineProperty(n[i],"labels",{value:e[i].labels});const r=t(i);Object.keys(r).forEach((e=>{const t=r[e];n[i][e]=function(e){const t=function(...t){const n=t[0];if(null==n)return n;n.length>1&&(t=n);const i=e(t);if("object"==typeof i)for(let e=i.length,t=0;t<e;t++)i[t]=Math.round(i[t]);return i};return"conversion"in e&&(t.conversion=e.conversion),t}(t),n[i][e].raw=function(e){const t=function(...t){const n=t[0];return null==n?n:(n.length>1&&(t=n),e(t))};return"conversion"in e&&(t.conversion=e.conversion),t}(t)}))})),Vf=n}(),Yf=Pu(Xf);class Qf extends Ah{constructor(e){const t={uniforms:Ah.getUniformInfo(Qf)};super(Qf.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform float staticOptions[3];\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 blend = texture2D(first_texture, current_texture_coordinate_2d);\n \n vec3 blendRGB = blend.rgb;\n vec3 baseRGB = vec3(staticOptions[0], staticOptions[1], staticOptions[2]);\n \n vec3 limit = step(0.5, blendRGB);\n vec3 mixedRGB = mix(2.0 * baseRGB * blendRGB, 1.0 - 2.0 * (1.0 - baseRGB) * (1.0 - blendRGB), limit);\n \n gl_FragColor = vec4((mixedRGB * blend.a) + ((1.0 - blend.a) * baseRGB), 1);\n}"},t,e)}static getFilterType(){return"hardLight"}static getInputsCount(){return 1}static getInitialOptions(){return{color:"4b0082"}}getOptionsDisplay(){return[{properties:["color"],type:"colorPicker"}]}handleStaticUniforms(e){const t=Yf.hex.rgb(e.color).map((e=>e/255));this.uniforms[xh.STATIC_OPTIONS].set([t[0],t[1],t[2]])}}class Jf extends Ah{constructor(e){const t={uniforms:Ah.getUniformInfo(Jf)};super(Jf.getFilterType(),{vertex:"precision lowp float;\n\nattribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float runtimeOptions[1];\nuniform float staticOptions[6];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float exposure_value;\n\n\nfloat getCurrentBeizerProgress(vec2 p1, vec2 p2, float t){\n vec2 p0 = vec2(0,0);\n vec2 p3 = vec2(1,1);\n \n vec2 E = mix(p0, p1, t);\n vec2 F = mix(p1, p2, t);\n vec2 G = mix(p2, p3, t);\n\n vec2 H = mix(E, F, t);\n vec2 I = mix(F, G, t);\n\n vec2 P = mix(H, I, t);\n\n return P.y;\n}\n\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n \n // transfrom logic // \n // normalized time range from 0 to 1\n float current_time = runtimeOptions[0];\n float current_power_progress = getCurrentBeizerProgress(\n vec2(staticOptions[2], staticOptions[3]),\n vec2(staticOptions[4], staticOptions[5]),\n current_time\n );\n \n current_texture_coordinate_2d = texture_coordinate_2d;\n exposure_value = mix(staticOptions[0], staticOptions[1], current_power_progress);\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float exposure_value;\n\nvoid main() {\n vec4 texture = texture2D(first_texture, current_texture_coordinate_2d);\n gl_FragColor = vec4((texture.xyz) * (1.0 + exposure_value) , texture.w);\n}\n\n"},t,e)}static getFilterType(){return"exposureTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{properties:{power:{form:0,to:0,ease:[0,0,1,1]}}}}handleStaticUniforms(e){const t=e.properties.power;this.uniforms[xh.STATIC_OPTIONS].set([t.from,t.to,...t.ease])}static getUniformList(){return[xh.FIRST_TEXTURE,kh]}}class Zf extends Ah{constructor(e){const t={uniforms:Ah.getUniformInfo(Zf)};super(Zf.getFilterType(),{vertex:"precision lowp float;\n\nattribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float runtimeOptions[1];\nuniform float staticOptions[6];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float dipToBlack_value;\n\n\nfloat getCurrentBeizerProgress(vec2 p1, vec2 p2, float t){\n vec2 p0 = vec2(0,0);\n vec2 p3 = vec2(1,1);\n \n vec2 E = mix(p0, p1, t);\n vec2 F = mix(p1, p2, t);\n vec2 G = mix(p2, p3, t);\n\n vec2 H = mix(E, F, t);\n vec2 I = mix(F, G, t);\n\n vec2 P = mix(H, I, t);\n\n return P.y;\n}\n\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n \n // transfrom logic // \n // normalized time range from 0 to 1\n float current_time = runtimeOptions[0];\n float current_power_progress = getCurrentBeizerProgress(\n vec2(staticOptions[2], staticOptions[3]),\n vec2(staticOptions[4], staticOptions[5]),\n current_time\n );\n \n current_texture_coordinate_2d = texture_coordinate_2d;\n dipToBlack_value = mix(staticOptions[0], staticOptions[1], current_power_progress);\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float dipToBlack_value;\n\nvoid main() {\n vec4 texture = texture2D(first_texture, current_texture_coordinate_2d);\n gl_FragColor = vec4(texture.xyz - dipToBlack_value, texture.w);\n}"},t,e)}static getFilterType(){return"dipToBlackTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{}}handleStaticUniforms(e){const t=e.properties.power;this.uniforms[xh.STATIC_OPTIONS].set([t.from,t.to,...t.ease])}static getUniformList(){return[xh.FIRST_TEXTURE,kh]}}class ep extends Ah{constructor(e){const t={uniforms:Ah.getUniformInfo(ep)};super(ep.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float runtimeOptions[1];\nuniform float staticOptions[16];\n\nvarying vec2 current_texture_coordinate_2d;\n\nfloat getCurrentBeizerProgress(vec2 p1, vec2 p2, float t){\n vec2 p0 = vec2(0,0);\n vec2 p3 = vec2(1,1);\n \n vec2 E = mix(p0, p1, t);\n vec2 F = mix(p1, p2, t);\n vec2 G = mix(p2, p3, t);\n\n vec2 H = mix(E, F, t);\n vec2 I = mix(F, G, t);\n\n vec2 P = mix(H, I, t);\n\n return P.y;\n}\n\n\nvoid main() {\n // time range from 0 to 1\n float current_time = runtimeOptions[0];\n\n // scale X\n float current_scale_x_progress = getCurrentBeizerProgress(\n vec2(staticOptions[4],staticOptions[5]),\n vec2(staticOptions[6],staticOptions[7]),\n current_time\n );\n float currnet_scale_x_value = mix(staticOptions[0], staticOptions[1], current_scale_x_progress);\n\n // scale Y\n float current_scale_y_progress = getCurrentBeizerProgress(\n vec2(staticOptions[4],staticOptions[5]),\n vec2(staticOptions[6],staticOptions[7]),\n current_time\n );\n float currnet_scale_y_value = mix(staticOptions[2], staticOptions[3], current_scale_y_progress);\n\n // translate x\n float current_translate_x_progress = getCurrentBeizerProgress(\n vec2(staticOptions[12],staticOptions[13]),\n vec2(staticOptions[14],staticOptions[15]),\n current_time\n );\n \n float currnet_translate_x_value = mix(staticOptions[8], staticOptions[9], current_translate_x_progress); \n\n // translate y\n float current_translate_y_progress = getCurrentBeizerProgress(\n vec2(staticOptions[12],staticOptions[13]),\n vec2(staticOptions[14],staticOptions[15]),\n current_time\n );\n float currnet_translate_y_value = mix(staticOptions[10], staticOptions[11], current_translate_y_progress); \n\n // See Default vertex shader, we normalize y axis to be -y\n // because of webgl texture coordinates\n currnet_translate_y_value = currnet_translate_y_value * -1.0;\n\n // create matries\n mat4 scaleMatrix;\n scaleMatrix[0] = vec4(currnet_scale_x_value, 0, 0, 0); \n scaleMatrix[1] = vec4(0, currnet_scale_y_value, 0, 0); \n scaleMatrix[2] = vec4(0, 0, 1, 0); \n scaleMatrix[3] = vec4(0, 0, 0, 1); \n\n mat4 translateMatrix;\n translateMatrix[0] = vec4(1, 0, 0, 0); \n translateMatrix[1] = vec4(0, 1, 0, 0); \n translateMatrix[2] = vec4(0, 0, 1, 0); \n translateMatrix[3] = vec4(currnet_translate_x_value, currnet_translate_y_value, 0, 1); \n\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = translateMatrix * scaleMatrix * normalize_poistion;\n // gl_Position = translateMatrix * scaleMatrix * normalize_poistion;\n \n \n current_texture_coordinate_2d = texture_coordinate_2d;\n \n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n gl_FragColor = texture2D(first_texture, current_texture_coordinate_2d);\n}"},t,e)}static getFilterType(){return"transformTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{}}handleStaticUniforms(e){const t=e.properties.scale||{},n=e.properties.translate||{};t.ease=t.ease||[0,0,1,1],n.ease=n.ease||[0,0,1,1],this.uniforms[xh.STATIC_OPTIONS].set([t.from&&t.from.x||1,t.to&&t.to.x||1,t.from&&t.from.y||1,t.to&&t.to.y||1,...t.ease,n.from&&n.from.x||0,n.to&&n.to.x||0,n.from&&n.from.y||0,n.to&&n.to.y||0,...n.ease])}static getUniformList(){return[xh.FIRST_TEXTURE,kh]}}class tp extends Ah{constructor(e){const t={uniforms:Ah.getUniformInfo(tp)};super(tp.getFilterType(),{vertex:"precision lowp float;\n\nattribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float staticOptions[8];\nuniform float runtimeOptions[3];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float current_power_value;\n\nfloat getCurrentBeizerProgress(vec2 p1, vec2 p2, float t){\n vec2 p0 = vec2(0,0);\n vec2 p3 = vec2(1,1);\n \n vec2 E = mix(p0, p1, t);\n vec2 F = mix(p1, p2, t);\n vec2 G = mix(p2, p3, t);\n\n vec2 H = mix(E, F, t);\n vec2 I = mix(F, G, t);\n\n vec2 P = mix(H, I, t);\n\n return P.y;\n}\n\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n float current_time = runtimeOptions[0];\n float current_power_progress = getCurrentBeizerProgress(\n vec2(staticOptions[2],staticOptions[3]),\n vec2(staticOptions[4],staticOptions[5]),\n current_time\n );\n \n // varing\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_power_value = mix(staticOptions[0], staticOptions[1], current_power_progress);\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform float staticOptions[8];\nuniform float runtimeOptions[3];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float current_power_value;\n\nconst int samples = 12; //multiple of 2\n\nvoid main() {\n vec2 pixel = vec2(1.0/runtimeOptions[1], 1.0/runtimeOptions[2]);\n vec2 direction = vec2(staticOptions[6], staticOptions[7]);\n \n vec4 color = vec4(0.0); \n\n for (int i=1; i<=samples/2; i++) {\n vec2 motion = float(i) * current_power_value / float(samples / 2) * direction * pixel;\n \n color += texture2D(\n first_texture,\n current_texture_coordinate_2d + motion);\n\n color += texture2D(\n first_texture,\n current_texture_coordinate_2d - motion);\n }\n\t\n color = color/float(samples);\n\n \n gl_FragColor = color;\n // gl_FragColor = vec4(0,1,0,1);\n \n}"},t,e)}static getFilterType(){return"motionBlurTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{}}handleStaticUniforms(e){const t=e.properties.power||{from:0,to:0},n=e.properties.direction||{x:0,y:0};t.ease=t.ease||[0,0,1,1],this.uniforms[xh.STATIC_OPTIONS].set([t.from,t.to,...t.ease,n.x,n.y])}static getUniformList(){return[xh.FIRST_TEXTURE,kh,yh]}}class np extends Ah{constructor(e){const t={uniforms:Ah.getUniformInfo(np)};super(np.getFilterType(),{vertex:"precision lowp float;\n\nattribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float runtimeOptions[1];\nuniform float staticOptions[9];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float current_power_value;\n\nfloat getCurrentBeizerProgress(vec2 p1, vec2 p2, float t){\n vec2 p0 = vec2(0,0);\n vec2 p3 = vec2(1,1);\n \n vec2 E = mix(p0, p1, t);\n vec2 F = mix(p1, p2, t);\n vec2 G = mix(p2, p3, t);\n\n vec2 H = mix(E, F, t);\n vec2 I = mix(F, G, t);\n\n vec2 P = mix(H, I, t);\n\n return P.y;\n}\n\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n float current_time = runtimeOptions[0];\n float current_power_progress = getCurrentBeizerProgress(\n vec2(staticOptions[2],staticOptions[3]),\n vec2(staticOptions[4],staticOptions[5]),\n current_time\n );\n \n // varing\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_power_value = mix(staticOptions[0], staticOptions[1], current_power_progress);\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform float staticOptions[9];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float current_power_value;\n\nvoid main() {\n vec4 texture = texture2D(first_texture, current_texture_coordinate_2d);\n vec4 fadeColor = vec4(staticOptions[6], staticOptions[7], staticOptions[8], 1.0) ;\n gl_FragColor = mix(texture,fadeColor, current_power_value);\n}"},t,e)}static getFilterType(){return"fadeToColorTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{properties:{power:{form:0,to:0,ease:[0,0,1,1]},color:"#FFFFFF"}}}handleStaticUniforms(e){const t=e.properties.power||{from:0,to:0};t.ease=t.ease||[0,0,1,1];const n=e.properties.color,i=Yf.hex.rgb(n).map((e=>e/255));this.uniforms[xh.STATIC_OPTIONS].set([t.from,t.to,...t.ease,i[0],i[1],i[2]])}static getUniformList(){return[xh.FIRST_TEXTURE,kh]}}var ip=Object.freeze({__proto__:null,Crop:Pf,Curves:If,Default:Nh,DipToBlackTransition:Zf,DirectionalBlur:zh,Exposure:Bf,ExposureTransition:Jf,FadeToColorTransition:np,FastBlur:Bh,HardLight:Qf,HorizontalBlur:Dh,Hue:Mf,Lab:Lf,Levels:Sf,Lut:jh,MotionBlurTransition:tp,Opacity:Wh,Saturation:Of,ShapeComposite:Uh,ShapeCompositeMask:$h,Solid:Rf,SolidImage:Df,Transform:Rh,TransformTransition:ep,VerticalBlur:Lh,Vibrance:Cf,WhiteBalance:Ff});const rp=Object.values(ip).reduce(((e,t)=>(e[t.getFilterType()]=t,e)),{});class op{constructor(e){this.context=e}static getFilterClass(e){return rp[e]}getFilterIds(){return Object.keys(this.filterTypeToInstanceMap)}create(e,t){this.context={...this.context,options:t.options};const n=new rp[e](this.context);if(!n)throw new Error(`${e} is not a atom filter, atomFilter list: `,this.getFilterIds());return n}}const sp=kd.PREVIOUS_OUTPUT_PREFIX,ap=Object.values(ip).reduce(((e,t)=>(e[t.getFilterType()]={type:t.getFilterType(),options:t.getInitialOptions(),inputs:[...Array(t.getInputsCount())].map(((e,t)=>`${sp}${t}`)),outputs:[]},e)),{});var lp,cp,up=function(){if(cp)return lp;cp=1;var e=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&(n=e,!("[object RegExp]"===(i=Object.prototype.toString.call(n))||"[object Date]"===i||n.$$typeof===t));var n,i},t="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function n(e,t){return!1!==t.clone&&t.isMergeableObject(e)?s((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function i(e,t,i){return e.concat(t).map((function(e){return n(e,i)}))}function r(e){return Object.keys(e).concat((t=e,Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t).filter((function(e){return Object.propertyIsEnumerable.call(t,e)})):[]));var t}function o(e,t){try{return t in e}catch(e){return!1}}function s(t,a,l){(l=l||{}).arrayMerge=l.arrayMerge||i,l.isMergeableObject=l.isMergeableObject||e,l.cloneUnlessOtherwiseSpecified=n;var c=Array.isArray(a);return c===Array.isArray(t)?c?l.arrayMerge(t,a,l):function(e,t,i){var a={};return i.isMergeableObject(e)&&r(e).forEach((function(t){a[t]=n(e[t],i)})),r(t).forEach((function(r){var l,c;o(l=e,c=r)&&(!Object.hasOwnProperty.call(l,c)||!Object.propertyIsEnumerable.call(l,c))||(o(e,r)&&i.isMergeableObject(t[r])?a[r]=function(e,t){if(!t.customMerge)return s;var n=t.customMerge(e);return"function"==typeof n?n:s}(r,i)(e[r],t[r],i):a[r]=n(t[r],i))})),a}(t,a,l):n(a,l)}return s.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return s(e,n,t)}),{})},lp=s}(),dp=Pu(up),hp=function(e,t){return dp(e,t,{arrayMerge:(e,t)=>t})};const fp=kd.MESSAGES.UPDATE_OPTIONS;let pp=class{constructor(e,t){this.eventEmitter=new Id,this.type=e,this.inputs=t.inputs,this.outputs=t.outputs,this.options=t.options}render(){throw new Error("concrete class should implement")}_updateOptions(){throw new Error("concrete class should implement")}updateOptions(e){this._updateOptions(e),this.eventEmitter.emit(fp,this.options)}updateInputs(e){e&&(this.inputs.length===e.length&&this.inputs.every(((t,n)=>t===e[n]))||(this.inputs=[...e]))}getEventEmitter(){return this.eventEmitter}getType(){return this.type}getInputs(){return this.inputs}getOutputs(){return this.outputs}getOptions(){return this.options}getInfo(){return{inputs:this.inputs,outputs:this.outputs,options:this.options}}getOptionsDisplay(){return this.filter.getOptionsDisplay()}dispose(){throw new Error("concrete class should implement")}};class mp extends pp{constructor(e,t,n){super(...arguments),this.filter=n.filterFactory.create(this.type,{options:this.options})}render(e){const t=e.ioStore,n=e.graphIOManager,i=this.getInputs(),r=this.getOutputs(),o=t.get(i),s=this.filter.render(o,this.options);return n.setOutputs(t,r,s),s}_updateOptions(e){this.options=hp(this.options,e),this.filter.updateStaticUniforms(this.options)}dispose(){this.filter.dispose()}}const vp=kd.MESSAGES.UPDATE_OPTIONS;class gp extends mp{constructor(e,t,n){super(...arguments),this.baseNode=n.baseNode,this.registerListeners()}baseNodeUpdateOptions(e){this.options=hp(this.options,e),this.filter.updateStaticUniforms(this.options)}registerListeners(){this.baseNode.getEventEmitter().on(vp,this.baseNodeUpdateOptions,this)}dispose(){this.filter.dispose(),this.baseNode.getEventEmitter().off(vp,this.baseNodeUpdateOptions,this)}}function yp(e){return null!==e&&"object"==typeof e}function bp(e){if(!yp(e)||(t=e,Array.isArray(t)))return e;var t;const n=Object.keys(e).sort(),i={};return n.forEach((t=>{i[t]=bp(e[t])})),i}function kp(e,t){return null!=e&&e.id&&null!=t&&t.id?e.type===t.type&&e.id===t.id:e.type===t.type}function xp(e,t){const n=[];e.forEach(((e,i)=>{const r=(o=e,t.findIndex((e=>function(e,t){const n=JSON.parse(JSON.stringify(e));return r=JSON.parse(JSON.stringify(t)),yp(i=n)&&yp(r)?JSON.stringify(bp(i))===JSON.stringify(bp(r)):!(!Number.isNaN(i)||!Number.isNaN(r))||i===r;var i,r}(o,e))));var o;if(-1!==r)return void n.push({type:"take",index:r});const s=(a=e,l=i,(c=t)&&c[l]&&kp(a,c[l])?l:c.findIndex((e=>kp(a,e))));var a,l,c;-1===s?n.push({type:"create",newGraphIndex:i}):n.push({type:"update",currentGraphIndex:s,newGraphIndex:i})}));const i=n.reduce(((e,t)=>("take"===t.type?e.push(t.index):"update"===t.type&&e.push(t.currentGraphIndex),e)),[]);return t.reduce(((e,t,n)=>(i.includes(n)||e.push(n),e)),[]).forEach((e=>{n.push({type:"dispose",currentGraphIndex:e})})),n}function wp(e,t,n,i){const r=[];return e.forEach((e=>{switch(e.type){case"take":r.push(n[e.index]);break;case"update":const o=t[e.newGraphIndex].options,s=n[e.currentGraphIndex];s.updateInputs(t[e.newGraphIndex].inputs),s.updateOptions(o),r.push(s);break;case"create":const a=Pp.create(t[e.newGraphIndex],i);r.push(a);break;case"dispose":n[e.currentGraphIndex].dispose();break;default:throw new Error("cant apply action type: ",e.type)}})),r}var _p=function(e,t,n,i){const r=e.graph,o=t.graph;if(!(o&&r&&Array.isArray(o)&&Array.isArray(r)))throw new Error("cant apply new composite options",e);return wp(xp(r,o),r,n,i)};class Tp extends pp{constructor(e,t,n){super(...arguments),this.context=n,this.nodes=this.createNodes(this.options)}createNodes(e){if(!e||!e.graph)throw new Error("cant create composite node, please supply info.options.graph");return e.graph.map((e=>Pp.create(e,this.context)))}render(e){const t=e.ioStore,n=e.graphIOManager;let i=n.getPrevOutput(t);const r=this.outputs;if(this.nodes.length){const e=new Fd(t),r=[];this.nodes.forEach(((t,o)=>{const s={ioStore:e,graphIOManager:n};i=t.render(s),o!==this.nodes.length-1&&r.push(i)})),n.disposeTextures(r,i)}return n.setOutputs(t,r,i),i}getOptionsDisplay(){return[]}_updateOptions(e){this.nodes=_p(e,this.options,this.nodes,this.context),this.options=e}dispose(){this.nodes.forEach((e=>{e.dispose()}))}}const Ip=kd.MESSAGES.UPDATE_OPTIONS;class Ep extends Tp{constructor(e,t,n){super(...arguments),this.baseNode=n.baseNode,this.registerListeners()}registerListeners(){this.baseNode.getEventEmitter().on(Ip,this.updateOptions,this)}dispose(){this.nodes.forEach((e=>{e.dispose()})),this.baseNode.getEventEmitter().off(Ip,this.updateOptions,this)}}const Sp=kd.SYSTEM_NODES.TAGS.ATOM,Ap=kd.SYSTEM_NODES.TAGS.FILTER,Np=kd.SYSTEM_NODES.TAGS.COMPOSITE_FILTER,Mp=kd.SYSTEM_NODES.TAGS.TRANSITION_FILTER,Fp=kd.PREVIOUS_OUTPUT_PREFIX,Cp=Object.keys(ap);function Op(e,t){const n=(i=e.type,ap[i]);var i;return e=hp(n,e),new mp(e.type,e,t)}var Pp={create:function(e,t){let n;switch(function(e){let t;return n=e,t=Cp.includes(n)?Sp:e===Np?Np:e===Mp?Mp:Ap,t;var n}((e=JSON.parse(JSON.stringify(e))).type)){case Sp:n=Op(e,t);break;case Ap:n=function(e,t){const n=function(e,t){const n=t.get(e);if(!n)throw new Error(`no base node, cant resolve type: ${e}`);return n}(e.type,t.nodeStore),i=n.getType(),r=n.getInfo();let o;return e=hp(r,e),t={...t,baseNode:n},o=i===Np?new Ep(i,e,t):new gp(i,e,t),o}(e,t);break;case Np:n=function(e,t){const n=e.type;return e=hp({inputs:[`${Fp}0`]},e),new Tp(n,e,t)}(e,t);break;case Mp:n=function(e,t){const n=e.options.filter;if(!n)throw new Error(`transition filter should supply base filter ${n}`);return e.type=`${n}Transition`,Op(e,t)}(e,t);break;default:throw new Error("cant create node",e.type)}return n}};const Rp=kd.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS;var Dp=function(e){const t={[Rp]:ap[Rp]};for(const[n,i]of Object.entries(t)){const t=Pp.create(i,e);e.nodeStore.set(n,t)}},Lp=function(e,t){for(const[n,i]of Object.entries(e)){const e=Pp.create(i,t);t.nodeStore.set(n,e)}};const Bp=kd.CAPTURED_FRAME_PREFIX;class zp{constructor(e){return this.textureManager=e.textureManager,this.currentFrameTextures={0:this.textureManager.createTexture({type:"frame"})},this.saveInNextFrameTextures=[],this.savedFramesTextures={},this.reservedUnits=new Set([this.currentFrameTextures[0].getUnit()]),{capture:this.capture.bind(this),createCaptureId:this.createCaptureId.bind(this),releaseCaptureId:this.releaseCaptureId.bind(this),getCurrentFrames:this.getCurrentFrames.bind(this),getSavedFrames:this.getSavedFrames.bind(this),isReservedUnit:this.isReservedUnit.bind(this)}}updateCurrentFrame(e,t){t=t||0,this.currentFrameTextures[t].fill(e)}saveFrame(e){0!==this.saveInNextFrameTextures.length&&(this.saveInNextFrameTextures.forEach((t=>{t.fill(e)})),this.saveInNextFrameTextures=[])}capture(e,t){(e.videoHeight>150||e.displayHeight>150)&&(this.updateCurrentFrame(e,t),this.saveFrame(e))}createCaptureId(){const e=this.textureManager.createTexture({type:"frame"});this.saveInNextFrameTextures.push(e);const t=e.getUnit(),n=`${Bp}${t}`;return this.savedFramesTextures[n]=e,this.reservedUnits.add(t),n}releaseCaptureId(e){if("string"!=typeof e)throw new Error("capture id should be string");delete this.saveInNextFrameTextures[e];const t=e.split(":")[1];this.reservedUnits.delete(parseInt(t,10))}getCurrentFrames(){return this.currentFrameTextures}getSavedFrames(){return this.savedFramesTextures}isReservedUnit(e){return this.reservedUnits.has(e)}}const Wp=Qu("ShaderGraphApplication","warn"),$p=kd.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS,Up=Object.freeze({useCanvasSizedFilterTargets:!1,rebindAttributesOnProgramSwitch:!0,forwardContextAttributes:!0});function jp(e={}){const t=null==e?void 0:e.performanceToggles;return t&&"object"==typeof t?{...Up,...t}:{...Up}}class qp{constructor(e,t={}){return this.glSource=e,this.config=t,this.performanceToggles=jp(t),this.isContextLost=!1,this.isRecovering=!1,this.isDisposed=!1,this.pendingNodeOptionUpdates=new Map,this.doInit(e,t)}doInit(e,t){this.source=Nd(e),this.performanceToggles=jp(t),this.isDisposed=!1,this.render=this.render.bind(this),this.resizeCanvasSize=this.resizeCanvasSize.bind(this),this.setSrcVidTracks=this.setSrcVidTracks.bind(this),this.onWebGLContextLost=this.onWebGLContextLost.bind(this),this.onForceRender=this.onForceRender.bind(this),this.resizeCanvasSize._shouldPreventDefault=!0;const n=function(e={},t=Up){const n=null!=e&&e.glOptions&&"object"==typeof e.glOptions?{...e.glOptions}:{},i=n.__shaderGraph&&"object"==typeof n.__shaderGraph?n.__shaderGraph:{};return{...n,__shaderGraph:{...i,forwardContextAttributes:!1!==t.forwardContextAttributes}}}(t,this.performanceToggles);return this.gl=this.source.init(this.setSrcVidTracks,this.resizeCanvasSize,n),this.addCanvasListeners(),this.addSourceListeners(),"undefined"!=typeof window&&(window.ekoShaderGraph=this),this.selectedRenderNode=null,this.activeTextures=this.activeTextures||new Set,this.textureManager=new zd({gl:this.gl,activeTextures:this.activeTextures}),this.capturedFramesManager=new zp({textureManager:this.textureManager}),this.graphIOManager=new Hd({glSource:e,gl:this.gl,textureManager:this.textureManager,capturedFramesManager:this.capturedFramesManager}),this.frameBufferFactory=new eh({gl:this.gl,textureManager:this.textureManager,useCanvasSizedFilterTargets:this.performanceToggles.useCanvasSizedFilterTargets}),this.filterFactory=new op({gl:this.gl,frameBufferFactory:this.frameBufferFactory,rebindAttributesOnProgramSwitch:this.performanceToggles.rebindAttributesOnProgramSwitch}),this.nodeStore=new Fd,this.ioStore=new Fd,Dp({nodeStore:this.nodeStore,filterFactory:this.filterFactory}),this.addClientNodes(t.nodes,this.isRecovering),t.userWillCallRender||(this.rafId=requestAnimationFrame(this.render)),this.dirtyCanvasSize=!0,{getNodes:this.getNodes.bind(this),addNodes:this.addClientNodes.bind(this),selectNode:this.selectNode.bind(this),addTexture:this.addTexture.bind(this),releaseTexture:this.releaseTexture.bind(this),captureTexture:this.captureTexture.bind(this),disposeTexture:this.disposeTexture.bind(this),updateOptions:this.updateOptions.bind(this),render:this.render,dispose:this.dispose.bind(this)}}getNodes(){return Wp.debug("[getNodes]"),this.nodeStore.get()}addClientNodes(e,t=!1){if(Wp.debug("[addClientNodes]",e),e&&!t&&(this.addClientNodeInvocations=this.addClientNodeInvocations||[],this.addClientNodeInvocations.push(e)),!t&&this.isContextUnavailable())return;e=e||{};const n=JSON.parse(JSON.stringify(e));Lp(n,{nodeStore:this.nodeStore,filterFactory:this.filterFactory})}addTexture(e,t,n){if(Wp.debug("[addTexture]",e,t,n),this.isContextUnavailable())return null;let i=this.textureManager.createTexture({type:t});return i.isStatic=!0,e&&i.fill(e),this.graphIOManager.setTextureSource(this.ioStore,i,n),i}releaseTexture(e){Wp.debug("[releaseTexture]",e),this.isContextUnavailable()||this.textureManager.releaseTexture(e)}selectNode(e){if(Wp.debug("[selectNode]",e),!this.isContextUnavailable())return this.nodeStore.get(e)||Wp.warn("Missing render node",e),void(this.selectedRenderNodeId=e);this.selectedRenderNodeId=e}captureTexture(){return Wp.debug("[captureTexture]"),this.isContextUnavailable()?null:this.capturedFramesManager.createCaptureId()}disposeTexture(e){return Wp.debug("[disposeTexture]",e),this.isContextUnavailable()||"string"!=typeof e?null:this.capturedFramesManager.releaseCaptureId(e)}setSrcVidTracks(e){this.isContextUnavailable()||this.capturedFramesManager&&this.capturedFramesManager.capture(e)}resizeCanvasSize(e,t,n,i){this.dirtyCanvasSize={width:n,height:i}}isContextUnavailable(){return!!this.isDisposed||!(!this.isRecovering&&!this.isContextLost)||!(!this.gl||"function"!=typeof this.gl.isContextLost)&&this.gl.isContextLost()}queueNodeOptionUpdate(e,t){e&&t&&"object"==typeof t&&(this.pendingNodeOptionUpdates||(this.pendingNodeOptionUpdates=new Map),this.pendingNodeOptionUpdates.set(e,t))}applyPendingNodeOptionUpdates(e=!1){if(!this.pendingNodeOptionUpdates||!this.pendingNodeOptionUpdates.size)return;const t=Array.from(this.pendingNodeOptionUpdates.entries());this.pendingNodeOptionUpdates.clear(),t.forEach((([t,n])=>{try{if(e){const e=this.nodeStore.get(t);if(!e||"function"!=typeof e.updateOptions)return void this.queueNodeOptionUpdate(t,n);try{e.updateOptions(n)}catch(e){Wp.error("Failed to apply pending node options",t,e),this.queueNodeOptionUpdate(t,n)}return}this.updateOptions(t,n)}catch(e){Wp.error("Failed to apply pending node options",t,e)}}))}render(e={}){var t,n;const{noRaf:i=!1}=e;if(this.isContextUnavailable())return;if(this.dirtyCanvasSize){let{width:e=this.gl.canvas.width,height:t=this.gl.canvas.height}=this.dirtyCanvasSize;Qd(e,t),this.gl.canvas.width=e,this.gl.canvas.height=t,this.textureManager.refreshTextureObjects(),this.gl.viewport(0,0,e,t),this.dirtyCanvasSize=!1}const r=null===(t=this.gl)||void 0===t||null===(t=t.canvas)||void 0===t?void 0:t.width,o=null===(n=this.gl)||void 0===n||null===(n=n.canvas)||void 0===n?void 0:n.height;Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0&&(Qd(r,o),this.gl.viewport(0,0,r,o)),this.graphIOManager.setVideoSources(this.ioStore);let s={ioStore:this.ioStore,graphIOManager:this.graphIOManager};this.renderSelectedNode(s),this.config.onPreRenderToScreen&&this.config.onPreRenderToScreen(),this.renderToCanvas(s),this.config.onPostRenderToScreen&&this.config.onPostRenderToScreen(),this.graphIOManager.disposeAllStore(this.ioStore),s=null,!i&&!this.config.userWillCallRender&&(this.rafId=requestAnimationFrame(this.render))}renderSelectedNode(e){if(!this.selectedRenderNodeId)return;const t=this.nodeStore.get(this.selectedRenderNodeId);t&&"function"==typeof t.render?t.render(e):(Wp.warn("Missing selected render node",this.selectedRenderNodeId),this.selectedRenderNodeId=null)}renderToCanvas(e){const t=this.nodeStore.get($p);t&&"function"==typeof t.render?t.render(e):Wp.warn("Missing render-to-canvas node")}updateOptions(e,t){if(Wp.debug("[updateOptions]",e,t),this.isContextUnavailable())return void this.queueNodeOptionUpdate(e,t);const n=this.nodeStore.get(e);if(n&&"function"==typeof n.updateOptions)try{n.updateOptions(t)}catch(n){Wp.error("Failed to update node options",e,n),this.queueNodeOptionUpdate(e,t)}else this.queueNodeOptionUpdate(e,t)}addSourceListeners(){var e;"function"==typeof(null===(e=this.source)||void 0===e?void 0:e.on)&&this.source.on("forcerender",this.onForceRender)}removeSourceListeners(){var e;"function"==typeof(null===(e=this.source)||void 0===e?void 0:e.off)&&this.source.off("forcerender",this.onForceRender)}addCanvasListeners(){var e;(null==this||null===(e=this.gl)||void 0===e?void 0:e.canvas)&&(this.config.noWebGLContextLostRecovery||this.gl.canvas.addEventListener("webglcontextlost",this.onWebGLContextLost))}removeCanvasListeners(){var e;(null==this||null===(e=this.gl)||void 0===e?void 0:e.canvas)&&this.gl.canvas.removeEventListener("webglcontextlost",this.onWebGLContextLost)}getNodesOptions(){const e=this.getNodes();let t={};return Object.keys(e).filter((e=>"__default"!==e)).forEach((n=>{t[n]=e[n].options})),t}getDocumentVisibilityPromise(){return new Promise((e=>{"visible"===document.visibilityState&&e();const t=()=>{"visible"===document.visibilityState&&(document.removeEventListener("visibilitychange",t),e())};document.addEventListener("visibilitychange",t)}))}onForceRender(){Wp.info("[onForceRender]"),this.render({noRaf:!0})}async onWebGLContextLost(e){if(e&&"function"==typeof e.preventDefault&&e.preventDefault(),this.isDisposed||this.isRecovering)return;this.isContextLost=!0,this.isRecovering=!0;const t=this.getNodesOptions(),n=this.addClientNodeInvocations,i=this.selectedRenderNodeId;cancelAnimationFrame(this.rafId),Wp.warn("WebGL context lost - attempting to recover");const r=async()=>{if(this.isDisposed)this.isRecovering=!1;else try{var e;if(await this.getDocumentVisibilityPromise(),this.isDisposed)return void(this.isRecovering=!1);if(this.gl&&"function"==typeof this.gl.isContextLost&&this.gl.isContextLost())return void setTimeout(r,200);this.dispose(!1),this.doInit(this.glSource,this.config),this.textureManager&&"function"==typeof this.textureManager.refreshActiveTextures&&this.textureManager.refreshActiveTextures(),n&&n.length&&n.forEach((e=>{Wp.debug("Re-adding client nodes",e),this.addClientNodes(e,!0)})),Object.entries(t).forEach((([e,t])=>{Wp.debug("Re-applying node options",e,t);const n=this.nodeStore.get(e);n&&"function"==typeof n.updateOptions&&n.updateOptions(t)})),i&&(this.selectedRenderNodeId=i),this.applyPendingNodeOptionUpdates(!0);const o="function"==typeof(null===(e=this.source)||void 0===e?void 0:e.recover);o&&(Wp.debug("Recovering glSource (i.e. seeking/resetting player)"),await this.source.recover()),this.isContextLost=!1,this.isRecovering=!1,o&&this.render()}catch(e){Wp.error("Failed to recover WebGL context, retrying",e),setTimeout(r,200)}};await r()}dispose(e=!0){if(this.selectedRenderNode=null,e&&(this.isDisposed=!0,this.isRecovering=!1,this.isContextLost=!1),this.source&&(this.removeSourceListeners(),"function"==typeof this.source.dispose&&this.source.dispose()),this.gl){this.removeCanvasListeners();const t=this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS);for(let e=0;e<t;++e)this.gl.activeTexture(this.gl.TEXTURE0+e),this.gl.bindTexture(this.gl.TEXTURE_2D,null),this.gl.bindTexture(this.gl.TEXTURE_CUBE_MAP,null);if(this.gl.bindBuffer(this.gl.ARRAY_BUFFER,null),this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,null),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null),this.gl.bindTexture(this.gl.TEXTURE_2D,null),this.gl.bindRenderbuffer(this.gl.RENDERBUFFER,null),e)try{this.gl.getExtension("WEBGL_lose_context").loseContext()}catch(e){console.error(e)}}this.selectedRenderNodeId=null,e&&delete this.addClientNodeInvocations}}class Vp{constructor(e={}){this.options=e}get type(){return"stage"}getSignature(){return this.type}build({inputs:e=[]}={}){return{graph:[],outputs:e,signature:this.getSignature()}}}function Gp(e={}){const t={source:{center:{x:.5,y:.5},width:1,height:1},target:{center:{x:.5,y:.5},width:1,height:1},fitType:"fill",cornerRadius:0,edgeSoftness:0},n={...t.source,...e.source||{}},i={...t.target,...e.target||{}};return{...t,...e,source:n,target:i}}class Hp extends Vp{get type(){return"retarget"}getSignature(){var e;const t=Array.isArray(null===(e=this.options)||void 0===e?void 0:e.frames)?this.options.frames:[];return`${this.type}:${t.length}`}build({inputs:e=[],stageIndex:t=0}={}){var n;const i=Array.isArray(null===(n=this.options)||void 0===n?void 0:n.frames)?this.options.frames:[];if(!i.length)return{graph:[],outputs:e,signature:this.getSignature()};const r=[],o=[];for(let n=0;n<e.length;n+=1){const s=e[n],a=i[n];if(!a){o.push(s);continue}const l=`retarget-${t}-${n}`;r.push({id:l,type:"crop",inputs:[s],outputs:[l],options:Gp(a)}),o.push(l)}return{graph:r,outputs:o,signature:this.getSignature()}}}class Kp{#A=new Map;constructor(){this.register("retarget",Hp)}register(e,t){e&&"function"==typeof t&&this.#A.set(e,t)}create(e={}){const t="string"==typeof(null==e?void 0:e.type)?e.type:null;if(!t)return null;const n=this.#A.get(t);return n?new n((null==e?void 0:e.options)||{}):null}}class Xp{constructor(e={}){this.params=e}static get panAndScanTarget(){return"pre"}static buildDefaultLayoutGraph(e=[]){const t=e[0]||"__SRC_TEXTURE:0";return{type:"default",signature:`default:${e.length}`,isDynamic:!1,graph:[{type:"opacity",inputs:[t],options:{power:1}}]}}static prepareRenderFrames({frames:e}={}){return Array.isArray(e)?e:[]}static getRenderTiming({timing:e}={}){return e&&"object"==typeof e?e:{}}static resetRenderState(e){}render(e){}}class Yp extends Xp{#N=null;#M=null;static get type(){return"default"}static get aliases(){return["DefaultRenderNode","default"]}static get requiresFrameCadence(){return!1}static buildLayoutGraph({inputs:e=[]}={}){return super.buildDefaultLayoutGraph(e)}static prepareRenderFrames({frames:e}={}){const t=Array.isArray(e)?e:[];if(t.length<=1)return t;const n=t[t.length-1];return n?[n]:t}render(e){var t;const n=(null==e||null===(t=e.visualFramesAvailable)||void 0===t?void 0:t.frames)||[];if(!n.length)return;const i=null==e?void 0:e.shaderGraph,r=null==e?void 0:e.shaderGraphNodeIds;if(!i||"function"!=typeof i.updateOptions||"function"!=typeof i.selectNode)return;const o=null==r?void 0:r.default;if(o)try{const e=n.map(((e,t)=>e?`__SRC_TEXTURE:${t}`:null)).filter(Boolean),t=Yp.buildLayoutGraph({inputs:e}),r=t.signature;this.#N!==r&&(i.updateOptions(o,{graph:t.graph}),this.#N=r),this.#M!==o&&(i.selectNode(o),this.#M=o),i.render({noRaf:!0})}catch(e){}}}var Qp=new WeakMap,Jp=new WeakMap,Zp=new WeakSet;class em extends Xp{constructor(...e){super(...e),O(this,Zp),F(this,Qp,null),F(this,Jp,null)}static get type(){return"side-by-side"}static get aliases(){return["SideBySideRenderNode","side-by-side","sidebyside"]}static get requiresFrameCadence(){return!1}static get panAndScanTarget(){return"skip"}static buildLayoutGraph({inputs:e=[]}={}){const t=e.length;if(t<=1)return super.buildDefaultLayoutGraph(e);const n=1/t,i=[],r=e.map(((e,t)=>{const r=(t+.5)*n,o=`slice-${t}`;return i.push({id:`side-by-side-crop-${t}`,type:"crop",inputs:[e],outputs:[o],options:{source:{center:{x:.5,y:.5},width:1,height:1},target:{center:{x:r,y:.5},width:n,height:1},fitType:"fill",cornerRadius:0,edgeSoftness:0}}),o}));let o=r[0];for(let e=1;e<t;e+=1){const t=(e+.5)*n*2-1;i.push({id:`side-by-side-mask-${e}`,type:"shapeCompositeMask",inputs:[r[e],o],outputs:["accum"],options:{type:"box",center:{x:t,y:0},area:{width:n,height:1},radius:0,edgeSoftness:0}}),o="accum"}return{type:em.type,signature:`${em.type}:${e.length}`,isDynamic:!1,graph:i}}static prepareRenderFrames({frames:e,state:t}={}){const n=Array.isArray(e)?e:[],i=t&&"object"==typeof t?t:{},r=Array.isArray(i.frames)?i.frames:[];if(!n.length&&!r.length)return i.frames=[],i!==t&&t&&"object"==typeof t&&Object.assign(t,i),[];const o=Math.max(n.length,r.length,2),s=Array.from({length:o}),a=n[0]||r[0];for(let e=0;e<o;e+=1)s[e]=n[e]||r[e]||a;return i.frames=s,i!==t&&t&&"object"==typeof t&&Object.assign(t,i),s}static resetRenderState(e){e&&"object"==typeof e&&(e.frames=null)}render(e){var t;const n=(null==e||null===(t=e.visualFramesAvailable)||void 0===t?void 0:t.frames)||[];if(!n.length)return;const i=null==e?void 0:e.shaderGraph,r=null==e?void 0:e.shaderGraphNodeIds;if(!i||"function"!=typeof i.updateOptions||"function"!=typeof i.selectNode)return;const o=null==r?void 0:r.sideBySide;if(o){if(1===n.length){const e=null==r?void 0:r.default;try{A(Zp,this,tm).call(this,i,e)}catch(e){}return}try{A(Zp,this,nm).call(this,i,o,n)}catch(e){}}}}function tm(e,t){if(!t)return;const n=ot.buildLayoutGraph({inputs:["__SRC_TEXTURE:0"]}),i=n.signature;M(Qp,this)!==i&&(e.updateOptions(t,{graph:n.graph}),C(Qp,this,i)),M(Jp,this)!==t&&(e.selectNode(t),C(Jp,this,t)),e.render({noRaf:!0})}function nm(e,t,n){const i=Array.isArray(n)?n.length:0;if(!t||!i||i<2)return;const r=n.map(((e,t)=>e?`__SRC_TEXTURE:${t}`:null)).filter(Boolean),o=ot.buildLayoutGraph({inputs:r}),s=o.signature;M(Qp,this)!==s&&(e.updateOptions(t,{graph:o.graph}),C(Qp,this,s)),M(Jp,this)!==t&&(e.selectNode(t),C(Jp,this,t)),e.render({noRaf:!0})}function im(e){const t=Number(e);return Number.isFinite(t)?t<=0?0:t>=1?1:t:0}ot=em;class rm extends Xp{#N=null;#M=null;#F=null;static get type(){return"cross-fade"}static get aliases(){return["CrossFadeRenderNode","cross-fade","crossfade"]}static get requiresFrameCadence(){return!0}static get panAndScanTarget(){return"pre"}static buildLayoutGraph({inputs:e=[],normalizedTime:t}={}){if(e.length<2)return super.buildDefaultLayoutGraph(e);const n=im(t),i=[{type:"opacity",inputs:[e[1]],options:{power:n}},{type:"shapeComposite",inputs:["__PREVIOUS:0",e[0]],options:{}}];return{type:rm.type,signature:`${rm.type}:${e.length}`,isDynamic:!0,graph:i}}static prepareRenderFrames({frames:e,timelineTime:t,active:n}={}){let i=(Array.isArray(e)?e:[]).slice(0,2);if(i.length<2)return i;const r=Number.isFinite(null==n?void 0:n.duration)&&n.duration>0?n.duration:void 0,o=Number.isFinite(null==n?void 0:n.offset)?n.offset:void 0;if(!Number.isFinite(t)||!Number.isFinite(r)||!Number.isFinite(o))return i;const s=im((t-o)/r);return s<=0?[i[0]]:s>=1?[i[1]]:i}render(e){var t;const n=(null==e||null===(t=e.visualFramesAvailable)||void 0===t?void 0:t.frames)||[];if(!n.length)return;const i=null==e?void 0:e.shaderGraph,r=null==e?void 0:e.shaderGraphNodeIds;if(!i||"function"!=typeof i.updateOptions||"function"!=typeof i.selectNode)return;if(n.length<2){const e=null==r?void 0:r.default;if(!e)return;try{const t="default";if(this.#N!==t){const n=rm.buildLayoutGraph({inputs:["__SRC_TEXTURE:0"]});i.updateOptions(e,{graph:n.graph}),this.#N=t}this.#M!==e&&(i.selectNode(e),this.#M=e),i.render({noRaf:!0})}catch(e){}return}const o=null==r?void 0:r.crossFade;if(o)try{const t=["__SRC_TEXTURE:0","__SRC_TEXTURE:1"],n=rm.buildLayoutGraph({inputs:t,normalizedTime:null==e?void 0:e.renderNodeNormalizedTime}),r=n.signature,s=Number(null==e?void 0:e.renderNodeNormalizedTime),a=Number.isFinite(s)?s:0;this.#N===r&&this.#F===a||(i.updateOptions(o,{graph:n.graph}),this.#N=r,this.#F=a),this.#M!==o&&(i.selectNode(o),this.#M=o),i.render({noRaf:!0})}catch(e){}}}function om(e,t,n={}){if("number"==typeof(null==e?void 0:e.nodeDurationOverride)&&Number.isFinite(e.nodeDurationOverride))return e.nodeDurationOverride;const i="function"==typeof(null==n?void 0:n.getNode)?n.getNode:t&&"function"==typeof t.get?e=>t.get(e):null;if(!i)return;const r=i(null==e?void 0:e.nodeId);if(!r)return;const o=r.duration;if("number"!=typeof o||Number.isNaN(o)||!Number.isFinite(o))return;const s="string"!=typeof r.state||"ready"===r.state;if(!0!==(null==n?void 0:n.allowUnready)&&!s)return;if(!(!0!==(null==n?void 0:n.allowUnready)||s||o>0))return;let a=0;"number"==typeof e.nodeOffsetOverride&&Number.isFinite(e.nodeOffsetOverride)&&(a=e.nodeOffsetOverride);const l=o-a;return l>0?l:0}function sm(e){return!(!e||!0===e.offsetPending)&&Number.isFinite(e.offset)}function am(e){return sm(e)?e.offset:void 0}function lm(e,t,n,i={}){if(!e)return!1;const r=am(e);if(!Number.isFinite(r))return!1;const o=om(e,n,i);return Number.isFinite(o)?t>=r&&t<r+o:t>=r}function cm(e=[]){if(!Array.isArray(e))return e;const t=[],n=[];return e.forEach((e=>{sm(e)?t.push(e):n.push(e)})),t.sort(((e,t)=>e.offset-t.offset)),e.splice(0,e.length,...t,...n),e}function um(e=[],t={}){if(!Array.isArray(e)||!e.length)return{updated:!1,resolvedPlacements:[]};const n="function"==typeof t.getPlacementDuration?t.getPlacementDuration:()=>{},i="function"==typeof t.snapPlacementOffset?t.snapPlacementOffset:e=>e,r="function"==typeof t.onResolvedPlacement?t.onResolvedPlacement:null,o=new Map,s=[];if(e.forEach((e=>{null!=e&&e.placementId&&o.set(e.placementId,e),!0===(null==e?void 0:e.offsetPending)&&s.push(e)})),!s.length)return{updated:!1,resolvedPlacements:[]};let a=!1;const l=[];let c=s,u=!0;for(;c.length&&u;){u=!1;const e=[];for(let t=0;t<c.length;t+=1){const s=c[t],d=null==s?void 0:s.offsetAnchorPlacementId;if(!d){e.push(s);continue}const h=o.get(d);if(!h||!0===h.offsetPending){e.push(s);continue}const f=am(h);if(!Number.isFinite(f)){e.push(s);continue}let p;if("start"===s.offsetAnchorEdge)p=i(f,s);else{const t=n(h);if(!(t>0)){e.push(s);continue}const r=f+t-(Number.isFinite(s.offsetEndSeconds)?s.offsetEndSeconds:0);if(!Number.isFinite(r)){e.push(s);continue}const o=i(r,s);p=!0===s.offsetAnchorIsReference?Math.max(o,r):o}Number.isFinite(p)?(s.offset=p,s.offsetPending=!1,s.offsetAnchorPlacementId=void 0,s.offsetAnchorEdge=void 0,s.offsetAnchorIsReference=void 0,r&&r(s,h,p),l.push(s),a=!0,u=!0):e.push(s)}c=e}return a&&!1!==t.sortPlacements&&cm(e),{updated:a,resolvedPlacements:l}}function dm(e){const t=Number(e);return Number.isFinite(t)?t:0}function hm(e,t={}){const n=function(e){const t=Number(e);return Number.isFinite(t)&&t<0?Math.abs(t):0}(e),i=Number.isFinite(null==t?void 0:t.offsetEndSeconds)?t.offsetEndSeconds:n;var r;return{wantsEndOffset:"end"===(r=e)||null==r||n>0||!0===(null==t?void 0:t.offsetPending),endOffsetSeconds:i,endOffsetFromAtSeconds:n}}function fm(e){if("string"!=typeof e)return null;const t=e.trim();if(!t||"end"===t)return null;const n=Number(t);if(Number.isFinite(n))return null;const i=t.split("@"),r=i[0]?i[0].trim():"";if(!r)return null;if(1===i.length)return{placementId:r,anchor:"start"};if(2!==i.length)return null;const o=i[1]?i[1].trim().toLowerCase():"";return"start"!==o&&"end"!==o?null:{placementId:r,anchor:o}}function pm(e=[],t,n,i){if(Array.isArray(e))for(let r=0;r<e.length;r+=1){const o=e[r],s="number"==typeof(null==o?void 0:o.offset)?o.offset:0;if(t<s+("number"==typeof(null==o?void 0:o.duration)&&Number.isFinite(o.duration)?o.duration:Number.POSITIVE_INFINITY)&&s<n)throw new Error(i)}}function mm(e){const t=Number(e);return Number.isFinite(t)&&t>0?t:0}function vm(e){return(null==e?void 0:e.id)||(null==e?void 0:e.nodeId)||null}function gm(e,t){return Array.isArray(e)&&t?e.findIndex((e=>vm(e)===t)):-1}function ym(e,t,n){const i=function(e,t,n){if(!Array.isArray(t)||0===t.length)return null;const i=t.length;if(null==e||"next"===e){const e=gm(t,n);return e>=0?(e+1)%i:0}if("prev"===e){const e=gm(t,n);return e>=0?(e-1+i)%i:i-1}const r=Number(e);return Number.isInteger(r)&&r>=0&&r<i?r:null}(e,t,n);return Number.isInteger(i)?vm(t[i]):null}function bm(e,t,n,i){const r=function(e,t){if(!Array.isArray(e)||e.length<=1)return e||[];const n=function(e){const t=[],n=new Set;return Array.isArray(e)?(e.forEach((e=>{const i=null==e?void 0:e.placementId;i&&!n.has(i)&&(n.add(i),t.push(i))})),t):t}(t);if(!n.length)return e;const i=new Map;e.forEach((e=>{const t=null==e?void 0:e.placementId;t&&!i.has(t)&&i.set(t,e)}));const r=[],o=new Set;return n.forEach((e=>{const t=i.get(e);t&&!o.has(e)&&(o.add(e),r.push(t))})),e.forEach((e=>{const t=null==e?void 0:e.placementId;t&&!o.has(t)&&(o.add(t),r.push(e))})),r}(function(e,t){const n=function(e){const t=Number(null==e?void 0:e.offset),n=Number(null==e?void 0:e.duration),i=n===Number.POSITIVE_INFINITY,r=Number.isFinite(n)&&n>0||i;return Number.isFinite(t)&&r?{start:t,end:i?Number.POSITIVE_INFINITY:t+n}:null}(t);if(!n||!e||!Array.isArray(e.placements))return[];const i=function(e,t){const n=Number(null==e||null===(t=e.settings)||void 0===t?void 0:t.snapToFps);return!Number.isFinite(n)||n<=0?0:.5/n}(e),r=e.placements.filter((t=>{const r=function(e,t){const n=am(e);if(!Number.isFinite(n))return null;const i="function"==typeof(null==t?void 0:t.getPlacementDuration)?t.getPlacementDuration(e):void 0;return{start:n,end:Number.isFinite(i)&&i>=0?n+i:Number.POSITIVE_INFINITY}}(t,e);return!!r&&r.start<n.end&&r.end>n.start+i}));return r.sort(((e,t)=>am(e)-am(t))),r}(t,n),i),o=function(e,t){const n=[],i=new Set;return Array.isArray(e)?(e.forEach((e=>{const r=null==e?void 0:e.nodeId;if(!r||i.has(r))return;const o="function"==typeof(null==t?void 0:t.getNode)?t.getNode(r):null;if(o){const e="object"==typeof o&&null!==o?o.id||o.nodeId?o:{...o,id:r}:{id:r};n.push(e),i.add(r)}})),n):n}(r,t),s=function(e){const t=new Map;return e.forEach((e=>{const n=null==e?void 0:e.placementId,i=null==e?void 0:e.nodeId;n&&i&&(t.has(i)||t.set(i,[]),t.get(i).push(n))})),t}(r),a=Array.isArray(e.nodes)?e.nodes:[];return a.splice(0,a.length,...o),e.nodes=a,e.placements=r,e.nodePlacementMap=s,{nodes:a,placements:r,nodePlacementMap:s}}function km(e,t,n){if(!Array.isArray(e))return null;if(t){const n=e.find((e=>(null==e?void 0:e.placementId)===t));if(n)return n}return n&&e.find((e=>(null==e?void 0:e.nodeId)===n))||null}function xm(e,t){if(!t||!Array.isArray(e))return null;const n=e.find((e=>(null==e?void 0:e.placementId)===t));return(null==n?void 0:n.nodeId)||null}function wm(e,t,n){if(!e||!t)return null;const i=t.get(e);if(!Array.isArray(i)||!i.length)return null;for(let t=0;t<i.length;t+=1){const r=i[t];if(km(n,r,e))return r}return null}function _m(e){e.initialized=!1,e.activeRenderPlacementId=null,e.nodes=[],e.placements=[],e.nodePlacementMap=null,e.selectedPlacementId=null,e.previousPlacementId=null,e.pendingSwitch=null,e.switchStartTime=null,e.switchDuration=0,e.switchNormalizedTime=void 0,e.switchTo=null,e.countOfConcurrentChannels=null}class Tm extends Xp{static get type(){return"switching"}static get aliases(){return["SwitchingRenderNode","switching","switch"]}static get requiresFrameCadence(){return!0}static get panAndScanTarget(){return"pre"}static buildLayoutGraph({inputs:e=[],normalizedTime:t}={}){if(e.length<2)return super.buildDefaultLayoutGraph(e);const n=im(t),i=[{type:"opacity",inputs:[e[1]],options:{power:n}},{type:"shapeComposite",inputs:["__PREVIOUS:0",e[0]],options:{}}];return{type:Tm.type,signature:`${Tm.type}:${e.length}`,isDynamic:!0,graph:i}}static getRenderTiming({timing:e,state:t}={}){const n=e&&"object"==typeof e?e:{},i=Number(null==t?void 0:t.switchNormalizedTime);return Number.isFinite(i)?{...n,normalizedTime:im(i)}:n}static prepareRenderFrames({frames:e,timelineTime:t,timeline:n,active:i,renderNodeParams:r,state:o}={}){const s=Array.isArray(e)?e:[],a=o&&"object"==typeof o?o:{},l=null==i?void 0:i.renderPlacementId;l&&a.activeRenderPlacementId!==l&&(_m(a),a.activeRenderPlacementId=l);const c=null==r?void 0:r.initSwitching,u=bm(a,n,i,s),d=(f=s,Array.isArray(f)?f.length:0),h=a.countOfConcurrentChannels;var f;if(a.countOfConcurrentChannels=d,"function"==typeof c&&(a.switchTo||(a.switchTo=(e,t)=>{const n=xm(a.placements,a.selectedPlacementId),i=ym(e,a.nodes,n);if(!i)return;const r={nodeId:i};t&&Object.prototype.hasOwnProperty.call(t,"crossfadeSeconds")&&void 0!==t.crossfadeSeconds&&(r.crossfadeSeconds=t.crossfadeSeconds),a.pendingSwitch=r}),!a.initialized||h!==d)){a.initialized=!0,a.countOfConcurrentChannels=d;try{c({nodes:u.nodes,countOfConcurrentChannels:d,switchTo:a.switchTo})}catch(f){}}if(!a.selectedPlacementId){const e=Number(null==r?void 0:r.initialChannelIndex),t=ym(Number.isInteger(e)&&e>=0?e:0,a.nodes,null);let n=null;if(t&&(n=wm(t,a.nodePlacementMap,s),!n&&a.nodePlacementMap)){const e=a.nodePlacementMap.get(t);Array.isArray(e)&&e.length&&(n=e[0])}a.selectedPlacementId=n||function(e,t){if(Array.isArray(t))for(let i=0;i<t.length;i+=1){var n;const r=null===(n=t[i])||void 0===n?void 0:n.placementId;if(r&&km(e,r))return r}const i=Array.isArray(e)?e.find((e=>null==e?void 0:e.placementId)):null;return i?i.placementId:null}(s,a.placements)}if(a.pendingSwitch&&Number.isFinite(t)){const e=wm(a.pendingSwitch.nodeId,a.nodePlacementMap,s);if(e){const n=a.selectedPlacementId;a.previousPlacementId=n&&n!==e?n:null,a.selectedPlacementId=e;const i=Object.prototype.hasOwnProperty.call(a.pendingSwitch,"crossfadeSeconds"),o=mm(a.pendingSwitch.crossfadeSeconds),s=mm(null==r?void 0:r.switchCrossfadeSeconds),l=i?o:s;a.switchDuration=l,l>0?a.switchStartTime=t:(a.switchStartTime=null,a.previousPlacementId=null)}a.pendingSwitch=null}let p;if(Number.isFinite(a.switchStartTime)&&a.switchDuration>0&&Number.isFinite(t)){const e=t-a.switchStartTime;e>=a.switchDuration?(a.switchStartTime=null,a.switchDuration=0,a.previousPlacementId=null):e>=0&&(p=im(e/a.switchDuration))}a.switchNormalizedTime=Number.isFinite(p)?p:void 0;const m=xm(a.placements,a.selectedPlacementId),v=km(s,a.selectedPlacementId,m)||s[0];let g=null;if(Number.isFinite(a.switchNormalizedTime)&&a.previousPlacementId){const e=xm(a.placements,a.previousPlacementId),t=xm(a.placements,a.selectedPlacementId),n=km(s,a.previousPlacementId,e),i=km(s,a.selectedPlacementId,t);n&&i&&(g=[n,i])}return g||(g=v?[v]:s),g}static resetRenderState(e){e&&"object"==typeof e&&_m(e)}}const Im=[Yp,em,rm,Tm],Em=new Map;function Sm(e){if("string"!=typeof e)return null;const t=e.trim();return t?t.toLowerCase():null}function Am(e){const t=Sm(e);return t&&Em.get(t)||null}function Nm(e){return Am(e)||Yp}Im.forEach((e=>function(e){(function(e){const t=Array.isArray(e.aliases)?e.aliases:[],n=e.type;return(n?[n,...t]:t.slice()).filter((e=>"string"==typeof e&&e.trim().length))})(e).forEach((t=>{const n=Sm(t);n&&Em.set(n,e)}))}(e)));class Mm{static get defaultType(){return Yp.type||"default"}static getRenderNodeClass(e){return Am(e)}static normalizeType(e){const t=Am(e);return t?t.type:null}static doesRenderNodeTypeRequireFrameCadence(e){const t=Am(e);return!!t&&!0===t.requiresFrameCadence}static buildLayoutGraph({type:e,inputs:t=[],normalizedTime:n}={}){const i=Nm(e);return i&&"function"==typeof i.buildLayoutGraph?i.buildLayoutGraph({inputs:t,normalizedTime:n}):Yp.buildLayoutGraph({inputs:t,normalizedTime:n})}static getPanAndScanTarget(e){const t=Nm(e);return"post"===(n=null==t?void 0:t.panAndScanTarget)||"skip"===n?n:"pre";var n}static prepareRenderFrames({type:e,frames:t,timelineTime:n,timeline:i,active:r,renderNodeParams:o,state:s}={}){const a=Nm(e);if(a&&"function"==typeof a.prepareRenderFrames){const e=a.prepareRenderFrames({frames:t,timelineTime:n,timeline:i,active:r,renderNodeParams:o,state:s});if(Array.isArray(e))return e}return Array.isArray(t)?t:[]}static getRenderTiming({type:e,timing:t,timelineTime:n,active:i,renderNodeParams:r,state:o}={}){const s=Nm(e),a=t&&"object"==typeof t?t:{};if(s&&"function"==typeof s.getRenderTiming){const e=s.getRenderTiming({timing:a,timelineTime:n,active:i,renderNodeParams:r,state:o});if(e&&"object"==typeof e)return{...a,...e}}return a}static resetRenderState(e,t){const n=Nm(e);n&&"function"==typeof n.resetRenderState&&n.resetRenderState(t)}static resetAllRenderStates(e){e&&"function"==typeof e.forEach&&e.forEach(((e,t)=>{Mm.resetRenderState(t,e)}))}create(e,t){return e&&"function"==typeof e.render?e:new(Nm(e))(t)}}function Fm(e){return Array.isArray(e)?e.filter((e=>e&&"string"==typeof e.type)):[]}function Cm(e,t){return e&&"function"==typeof e.getSignature?e.getSignature():(null==t?void 0:t.type)||"stage"}class Om{#C;constructor(e){this.#C=e||new Kp}build(e={}){const t=(Array.isArray(null==e?void 0:e.frames)?e.frames:[]).length,n=Array.from({length:t},((e,t)=>`__SRC_TEXTURE:${t}`)),i=Mm.normalizeType(null==e?void 0:e.layoutType)||Mm.defaultType,r=null==e?void 0:e.normalizedTime,o=Fm(null==e?void 0:e.preStages),s=Fm(null==e?void 0:e.postStages),a=[],l=[`layout:${i}`,`inputs:${t}`];let c=n;o.forEach(((t,n)=>{const i=this.#C.create(t);if(!i)return;const r=i.build({inputs:c,stageIndex:n,context:e});Array.isArray(null==r?void 0:r.graph)&&r.graph.length&&a.push(...r.graph),Array.isArray(null==r?void 0:r.outputs)&&r.outputs.length&&(c=r.outputs),l.push(Cm(i,t))}));const u=Mm.buildLayoutGraph({type:i,inputs:c,normalizedTime:r}),d=!(null==u||!u.isDynamic);Array.isArray(null==u?void 0:u.graph)&&u.graph.length&&a.push(...u.graph),l.push((null==u?void 0:u.signature)||`${i}:${c.length}`);let h="__PREVIOUS:0";return s.forEach(((t,n)=>{const i=this.#C.create(t);if(!i)return;const r=i.build({inputs:[h],stageIndex:n,context:e});Array.isArray(null==r?void 0:r.graph)&&r.graph.length&&a.push(...r.graph),h=Array.isArray(null==r?void 0:r.outputs)&&r.outputs.length?r.outputs[0]:"__PREVIOUS:0",l.push(Cm(i,t))})),{graph:a,signature:l.join("|"),isDynamic:d}}}const Pm=[0,0,1,1],Rm="zoomInExposure",Dm=["transform","exposure","fadeToColor","dipToBlack"],Lm={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 Bm(e,t=0){const n=Number(e);return Number.isFinite(n)?n:t}function zm(e,t=Pm){return Array.isArray(e)&&e.length>=4?e:t}function Wm(e){return"string"==typeof e&&e.trim()?e.trim():"#ffffff"}function $m(e,t){const n=null==e?void 0:e[t];return!1===n||null==n?null:Zu(n)?n:{}}function Um(e={}){let t=0;return Dm.forEach((n=>{const i=$m(e,n);if(!i)return;const r=Bm(null==i?void 0:i.duration);r>t&&(t=r)})),t}function jm(e,t,n,i,r){const o=[];return Dm.forEach((s=>{const a=$m(e,s);if(!a)return;const l=function(e,t,n){const i=Bm(null==e?void 0:e.duration);return Number.isFinite(n)&&n>0?i>0&&t>0?i*t:n:i}(a,n,i),c=function(e,t,n,i,r){const o={type:"transition",inputs:["__PREVIOUS:0"],options:{filter:e,startTime:n,duration:i,properties:{}}};if("transform"===e){var s,a,l,c;const e=zm(null==t?void 0:t.ease),n=(null==t||null===(s=t.scale)||void 0===s?void 0:s.from)||{x:1,y:1},i=(null==t||null===(a=t.scale)||void 0===a?void 0:a.to)||{x:1,y:1},r=(null==t||null===(l=t.translate)||void 0===l?void 0:l.from)||{x:0,y:0},u=(null==t||null===(c=t.translate)||void 0===c?void 0:c.to)||{x:0,y:0};return o.options.properties.scale={from:n,to:i,ease:e},o.options.properties.translate={from:r,to:u,ease:e},o}if("fadeToColor"===e){const e=zm(null==t?void 0:t.ease),n=(null==t?void 0:t.power)||{from:0,to:1};return o.options.properties.power={from:Bm(null==n?void 0:n.from,0),to:Bm(null==n?void 0:n.to,1),ease:e},o.options.properties.color=Wm((null==t?void 0:t.color)||r),o}if("exposure"===e||"dipToBlack"===e){const e=zm(null==t?void 0:t.ease),n=(null==t?void 0:t.power)||{from:0,to:1};return o.options.properties.power={from:Bm(null==n?void 0:n.from,0),to:Bm(null==n?void 0:n.to,1),ease:e},o}return null}(s,a,t,l,r);c&&o.push(c)})),o}function qm(e=[]){const t=e.map((e=>{const t=JSON.parse(JSON.stringify(e));return null!=t&&t.options&&(t.options.startTime=0),t}));return JSON.stringify(t)}class Vm{#O=null;start(e={}){const t=null==e?void 0:e.shaderGraph;if(!t||"function"!=typeof t.captureTexture)return null;const{baseFilters:n,reverseFilters:i}=function(e={}){const t=function(e={}){if(Zu(null==e?void 0:e.transition))return e.transition;if("string"==typeof(null==e?void 0:e.transition))return Lm[e.transition]||Lm[Rm];if(Zu(null==e?void 0:e.filters)||Zu(null==e?void 0:e.reverseFilters))return{filters:e.filters||{},reverseFilters:e.reverseFilters||{}};if("string"==typeof(null==e?void 0:e.filter)){const t=Bm(e.duration)>0?1e3*e.duration:500;return{filters:{[e.filter]:{duration:t,power:{from:0,to:1}}},reverseFilters:{}}}return Lm[Rm]}(e),n=ed({},(null==t?void 0:t.filters)||{},Zu(null==e?void 0:e.filters)?e.filters:{}),i=function(e={}){const t={};return Object.keys(e).forEach((n=>{const i=e[n];if(!1===i)return void(t[n]=!1);const r=JSON.parse(JSON.stringify(Zu(i)?i:{}));Object.values(r).forEach((e=>function(e){if(e&&"object"==typeof e&&"from"in e&&"to"in e){const t=e.from;e.from=e.to,e.to=t}}(e))),t[n]=r})),t}(n),r=ed({},(null==t?void 0:t.reverseFilters)||{},Zu(null==e?void 0:e.reverseFilters)?e.reverseFilters:{});return{baseFilters:n,reverseFilters:ed({},i,r)}}(e),r=Bm(null==e?void 0:e.duration),o=r>0?1e3*r:null,s=Um(n),a=Um(i),l=o&&s>0?o/s:1,c=o&&a>0?o/a:1,u=o||s||500,d=o||a||u,h=Wm(null==e?void 0:e.color),f=t.captureTexture(),p=Date.now(),m=jm(n,p,l,o,h);return this.#O={phase:"out",startTime:p,outDurationMs:u,inDurationMs:d,color:h,captureId:f,baseFilters:n,reverseFilters:i,outScale:l,inScale:c,durationOverrideMs:o,outGraph:m,outSignature:qm(m),inGraph:null,inSignature:null},{captureId:f,outDurationMs:u,inDurationMs:d}}beginIncoming(){if(!this.#O)return;const e=Date.now(),t=jm(this.#O.reverseFilters,e,this.#O.inScale,this.#O.durationOverrideMs,this.#O.color);this.#O={...this.#O,phase:"in",startTime:e,inGraph:t,inSignature:qm(t)}}reset(e){var t;e&&"function"==typeof e.disposeTexture&&null!==(t=this.#O)&&void 0!==t&&t.captureId&&e.disposeTexture(this.#O.captureId),this.#O=null}getState(){return this.#O}buildOutgoingGraph(){const e=this.#O;return e&&"out"===e.phase&&Array.isArray(e.outGraph)&&e.outGraph.length?{signature:`transition:out:${e.outSignature||""}`,forceUpdate:!1,graph:e.outGraph}:null}buildIncomingGraph(){const e=this.#O;return e&&"in"===e.phase&&Array.isArray(e.inGraph)&&e.inGraph.length?{signature:`transition:in:${e.inSignature||""}`,forceUpdate:!1,graph:e.inGraph}:null}}let Gm;const Hm=[/firefox\/(\d+)/,/edg\/(\d+)/,/opr\/(\d+)/,/chrome\/(\d+)/];function Km(){const e=ad&&ad.navigator&&(ad.navigator.userAgent||ad.navigator.platform||ad.navigator.vendor)||"";if(Gm&&Gm.ua===e)return Gm;const t=e.toLowerCase(),n=t.includes("android"),i=t.includes("iphone")||t.includes("ipad")||t.includes("ipod")||t.includes("ios"),r=n||i||t.includes("mobile"),o=!!e&&!r,s=t.includes("firefox/"),a=function(e=""){for(let t=0;t<Hm.length;t+=1){const n=Hm[t],i=e.match(n);if(!i)continue;const r=Number(i[1]);return Number.isFinite(r)?r:null}if(e.includes("safari/")&&e.includes("version/")){const t=e.match(/version\/(\d+)/);if(!t)return null;const n=Number(t[1]);return Number.isFinite(n)?n:null}return null}(t);return Gm={ua:e,lowerUA:t,isAndroid:n,isiOS:i,isMobile:r,isDesktop:o,isFirefox:s,browserMajorVersion:a},Gm}function Xm(){return Km().ua}function Ym(){return Km().isAndroid}function Qm(){return Km().isiOS}function Jm(){return Km().isMobile}function Zm(){return Km().isDesktop}function ev(){return Km().isFirefox}function tv(){return Km().browserMajorVersion}var nv={getUserAgent:Xm,isAndroid:Ym,isiOS:Qm,isMobile:Jm,isDesktop:Zm,isFirefox:ev,getBrowserMajorVersion:tv},iv=Object.freeze({__proto__:null,default:nv,getBrowserMajorVersion:tv,getUserAgent:Xm,isAndroid:Ym,isDesktop:Zm,isFirefox:ev,isMobile:Jm,isiOS:Qm});const rv=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 ov(e,t){const n={};return Number.isFinite(e)&&(n.time=e),"string"==typeof t&&(n.source=t),n}function sv({placementId:e,nodeId:t,trackId:n,segmentId:i,trackType:r,pts:o,duration:s,frame:a,audioBuffer:l}={}){const c={};return e&&(c.placementId=e),t&&(c.nodeId=t),n&&(c.trackId=n),i&&(c.segmentId=i),r&&(c.trackType=r),Number.isFinite(o)&&(c.pts=o),Number.isFinite(s)&&(c.duration=s),a&&(c.frame=a),l&&(c.audioBuffer=l),c}function av({placementId:e,nodeId:t,trackId:n,segmentId:i,trackType:r,error:o}={}){const s={};return e&&(s.placementId=e),t&&(s.nodeId=t),n&&(s.trackId=n),i&&(s.segmentId=i),r&&(s.trackType=r),o&&(s.error=o),s}const lv="Idle",cv="Playing",uv="FirstFramePending",dv="Waiting",hv="Paused",fv="Seeking",pv="Resetting";function mv(e){return Array.isArray(e)?e.filter((e=>e&&"string"==typeof e.type)):[]}function vv(e,t){return!!Array.isArray(e)&&e.some((e=>(null==e?void 0:e.type)===t))}function gv(e){const t=Number(e);return!Number.isFinite(t)||t<=0?null:{type:"retarget",options:{frames:Array.from({length:t},(()=>({fitType:"fill"})))},meta:{source:"panAndScan"}}}function yv(e){return Array.isArray(e)?e.filter((e=>{return!("panAndScan"===(null==(t=e)||null===(n=t.meta)||void 0===n?void 0:n.source));var t,n})):[]}const bv=2073600;function kv(e,t){const n=Number(e);return Number.isFinite(n)&&n>0?n:t}function xv(e,t){if(null==e)return t;const n=Number(e);return Number.isFinite(n)?n:t}var wv=new WeakMap,_v=new WeakMap,Tv=new WeakMap,Iv=new WeakMap,Ev=new WeakMap,Sv=new WeakMap,Av=new WeakMap,Nv=new WeakMap,Mv=new WeakMap,Fv=new WeakMap,Cv=new WeakMap,Ov=new WeakMap,Pv=new WeakMap,Rv=new WeakMap,Dv=new WeakMap,Lv=new WeakMap,Bv=new WeakMap,zv=new WeakMap,Wv=new WeakMap,$v=new WeakMap,Uv=new WeakMap,jv=new WeakMap,qv=new WeakMap,Vv=new WeakMap,Gv=new WeakMap,Hv=new WeakMap,Kv=new WeakMap,Xv=new WeakMap,Yv=new WeakMap,Qv=new WeakMap,Jv=new WeakSet;class Zv extends rd{static get pipelineNodeId(){return"ekoplayer-render-pipeline"}get defaults(){return{defaultRenderParams:void 0,resourceLimits:{enabled:!0,maxCanvasPixels:bv,maxDevicePixelRatio:0,renderScale:1,transitionMinFrameIntervalMs:33}}}constructor(...e){super(...e),O(this,Jv),F(this,wv,void 0),F(this,_v,void 0),F(this,Tv,void 0),F(this,Iv,void 0),F(this,Ev,void 0),F(this,Sv,void 0),F(this,Av,void 0),F(this,Nv,void 0),F(this,Mv,void 0),F(this,Fv,void 0),F(this,Cv,null),F(this,Ov,null),F(this,Pv,void 0),F(this,Rv,void 0),F(this,Dv,void 0),F(this,Lv,[]),F(this,Bv,[]),F(this,zv,null),F(this,Wv,null),F(this,$v,null),F(this,Uv,null),F(this,jv,null),F(this,qv,null),F(this,Vv,new Map),F(this,Gv,null),F(this,Hv,null),F(this,Kv,!1),F(this,Xv,!1),F(this,Yv,[]),F(this,Qv,null);const[t,n,i]=e;C(wv,this,t),C(_v,this,n),C(Tv,this,i),M(wv,this)&&"function"==typeof M(wv,this).enableFirstFrameRenderedGate&&M(wv,this).enableFirstFrameRenderedGate(),C(Fv,this,new Om),C(Pv,this,new Vm),C(Rv,this,null),C(Dv,this,null),C($v,this,null),C(Iv,this,(e=>A(Jv,this,Cg).call(this,e))),M(wv,this)&&"function"==typeof M(wv,this).on&&(M(wv,this).on(rv.VISUAL_FRAMES_AVAILABLE,M(Iv,this)),C(Ev,this,(()=>{var e,t,n,i;A(Jv,this,ig).call(this),A(Jv,this,Sg).call(this,0),C(Bv,this,[]),C(zv,this,null),C(Cv,this,null),C(Ov,this,null),A(Jv,this,gg).call(this),C(Gv,this,null);(null===(e=M(Pv,this))||void 0===e||null===(t=e.getState)||void 0===t?void 0:t.call(e))||null===(n=M(Pv,this))||void 0===n||null===(i=n.reset)||void 0===i||i.call(n,M(Rv,this))})),M(wv,this).on(rv.TIMELINE_SEEKING,M(Ev,this)),C(Sv,this,(()=>A(Jv,this,rg).call(this))),M(wv,this).on(rv.TIMELINE_RESET,M(Sv,this)),C(Mv,this,(()=>A(Jv,this,xg).call(this))),M(wv,this).on(rv.TIMELINE_TIME_UPDATE,M(Mv,this)),C(Av,this,(()=>{A(Jv,this,Og).call(this)&&M(Wv,this)&&A(Jv,this,Cg).call(this,M(Wv,this))})),M(wv,this).on(rv.TIMELINE_STATE_CHANGE,M(Av,this))),C(Nv,this,(()=>{C(zv,this,null),M(Wv,this)&&A(Jv,this,Og).call(this)&&A(Jv,this,Cg).call(this,M(Wv,this))})),M(Tv,this)&&"function"==typeof M(Tv,this).on&&M(Tv,this).on(rv.CONTAINER_RESIZE,M(Nv,this))}get name(){return"Renderer"}onDispose(){M(wv,this)&&M(Iv,this)&&"function"==typeof M(wv,this).off&&M(wv,this).off(rv.VISUAL_FRAMES_AVAILABLE,M(Iv,this)),M(wv,this)&&M(Ev,this)&&"function"==typeof M(wv,this).off&&M(wv,this).off(rv.TIMELINE_SEEKING,M(Ev,this)),M(wv,this)&&M(Sv,this)&&"function"==typeof M(wv,this).off&&M(wv,this).off(rv.TIMELINE_RESET,M(Sv,this)),M(wv,this)&&M(Mv,this)&&"function"==typeof M(wv,this).off&&M(wv,this).off(rv.TIMELINE_TIME_UPDATE,M(Mv,this)),M(wv,this)&&M(Av,this)&&"function"==typeof M(wv,this).off&&M(wv,this).off(rv.TIMELINE_STATE_CHANGE,M(Av,this)),M(Tv,this)&&M(Nv,this)&&"function"==typeof M(Tv,this).off&&M(Tv,this).off(rv.CONTAINER_RESIZE,M(Nv,this)),A(Jv,this,eg).call(this),C(Iv,this,null),C(Ev,this,null),C(Sv,this,null),C(Mv,this,null),C(Av,this,null),C(Nv,this,null),C(Fv,this,null),C(Pv,this,null),C(Vv,this,null),C(Gv,this,null),C(_v,this,null),C(Tv,this,null),C(wv,this,null)}startTransition(e={}){var t;const n=null===(t=M(_v,this))||void 0===t?void 0:t.element;if(!n)return null;if(A(Jv,this,sg).call(this,n),!M(Rv,this))return null;const i=M(Pv,this).start({shaderGraph:M(Rv,this),duration:null==e?void 0:e.duration,filter:null==e?void 0:e.filter,color:null==e?void 0:e.color,filters:null==e?void 0:e.filters,reverseFilters:null==e?void 0:e.reverseFilters,transition:null==e?void 0:e.transition});return C($v,this,M(Wv,this)||null),A(Jv,this,Ng).call(this),i}beginTransitionIn(e={}){var t,n;null!==(t=M(Pv,this))&&void 0!==t&&null!==(n=t.beginIncoming)&&void 0!==n&&n.call(t,e),C($v,this,null),A(Jv,this,Ng).call(this)}resetTransition(){var e,t;null!==(e=M(Pv,this))&&void 0!==e&&null!==(t=e.reset)&&void 0!==t&&t.call(e,M(Rv,this)),C($v,this,null),A(Jv,this,Mg).call(this)}}function eg(){if(A(Jv,this,ig).call(this),M(Pv,this)&&"function"==typeof M(Pv,this).reset&&M(Pv,this).reset(M(Rv,this)),A(Jv,this,Sg).call(this,0),M(Rv,this)&&"function"==typeof M(Rv,this).dispose)try{M(Rv,this).dispose()}catch(e){}C(Rv,this,null),C(Dv,this,null),C(Lv,this,[]),C(Bv,this,[]),C(zv,this,null),C(Cv,this,null),C(Ov,this,null),C(Wv,this,null),C($v,this,null),A(Jv,this,Mg).call(this),A(Jv,this,gg).call(this),C(Gv,this,null)}function tg(){return{schedule:"function"==typeof ad.requestAnimationFrame?ad.requestAnimationFrame.bind(ad):e=>setTimeout(e,16),cancel:"function"==typeof ad.cancelAnimationFrame?ad.cancelAnimationFrame.bind(ad):clearTimeout}}function ng(e){C(Yv,this,M(Yv,this).filter((t=>t!==e))),M(Yv,this).length||C(Qv,this,null)}function ig(){M(Qv,this)&&M(Yv,this).forEach((e=>M(Qv,this).call(this,e))),C(Yv,this,[]),C(Qv,this,null),C(Xv,this,!1)}function rg(){A(Jv,this,ig).call(this),C(Kv,this,!1)}function og(){if(M(Kv,this)||M(Xv,this))return;const{schedule:e,cancel:t}=A(Jv,this,tg).call(this);let n;C(Qv,this,t),C(Xv,this,!0),n=e((()=>{let t;A(Jv,this,ng).call(this,n),t=e((()=>{A(Jv,this,ng).call(this,t),C(Xv,this,!1),M(Kv,this)||(C(Kv,this,!0),M(wv,this)&&"function"==typeof M(wv,this).notifyFirstFrameRendered&&M(wv,this).notifyFirstFrameRendered())})),M(Yv,this).push(t)})),M(Yv,this).push(n)}function sg(e){if(M(Rv,this)||!e)return;const t=this,n={dest:e,src:(e,n)=>{C(Dv,t,n)}};C(Rv,t,new qp(n,{userWillCallRender:!0,glOptions:{contextType:"webgl2"},performanceToggles:{useCanvasSizedFilterTargets:!0}})),M(Rv,t)&&"function"==typeof M(Rv,t).addNodes&&M(Rv,t).addNodes({[st.pipelineNodeId]:{type:"composite",options:{graph:[]}}})}function ag(){var e;const t=null===(e=this.settings)||void 0===e?void 0:e.resourceLimits;return!t||"object"!=typeof t||Array.isArray(t)?{}:t}function lg(){const e=A(Jv,this,ag).call(this).enabled;return!0===e||!1!==e&&Qm()}function cg(){if(!A(Jv,this,lg).call(this))return 0;const e=xv(A(Jv,this,ag).call(this).transitionMinFrameIntervalMs,33);return Number.isFinite(e)&&e>0?e:0}function ug(e,t,n={}){const i=!0===(null==n?void 0:n.useDevicePixelRatio),r=A(Jv,this,lg).call(this),o=i?kv(null==ad?void 0:ad.devicePixelRatio,1):1;let s=o,a=0;if(r){const e=A(Jv,this,ag).call(this);a=xv(e.maxCanvasPixels,bv);const t=xv(e.maxDevicePixelRatio,0);s=kv(e.renderScale,1)*(t>0?Math.min(o,t):o)}let l=Math.max(1,Math.round(e*s)),c=Math.max(1,Math.round(t*s));if(r&&a>0){const e=l*c;if(e>a){const t=Math.sqrt(a/e);l=Math.max(1,Math.floor(l*t)),c=Math.max(1,Math.floor(c*t))}}return{width:l,height:c}}function dg(e=[],t={}){var n;const i=null===(n=M(_v,this))||void 0===n?void 0:n.element,r=M(Dv,this);if(!i||"function"!=typeof r)return!1;let o=0,s=0;const a=!0===(null==t?void 0:t.useViewportSize);if(a){var l,c,u,d,h,f;const e=Number(null!==(l=null===(c=M(Tv,this))||void 0===c?void 0:c.containerWidth)&&void 0!==l?l:null===(u=M(Tv,this))||void 0===u?void 0:u.width),t=Number(null!==(d=null===(h=M(Tv,this))||void 0===h?void 0:h.containerHeight)&&void 0!==d?d:null===(f=M(Tv,this))||void 0===f?void 0:f.height);if(Number.isFinite(e)&&Number.isFinite(t)&&e>0&&t>0)o=Math.round(e),s=Math.round(t);else{const e=Number(i.clientWidth),t=Number(i.clientHeight);Number.isFinite(e)&&Number.isFinite(t)&&e>0&&t>0&&(o=Math.round(e),s=Math.round(t))}}if(!(o>0&&s>0)){if(!Array.isArray(e)||!e.length)return;for(let t=0;t<e.length;t+=1){var p;const n=null===(p=e[t])||void 0===p?void 0:p.frame,i=Number((null==n?void 0:n.displayWidth)||(null==n?void 0:n.codedWidth)||(null==n?void 0:n.videoWidth)||(null==n?void 0:n.naturalWidth)||(null==n?void 0:n.width)),r=Number((null==n?void 0:n.displayHeight)||(null==n?void 0:n.codedHeight)||(null==n?void 0:n.videoHeight)||(null==n?void 0:n.naturalHeight)||(null==n?void 0:n.height));!Number.isFinite(i)||!Number.isFinite(r)||i<=0||r<=0||(i>o&&(o=i),r>s&&(s=r))}}if(!(o>0&&s>0))return!1;const m=A(Jv,this,ug).call(this,o,s,{useDevicePixelRatio:a}),v=m.width,g=m.height,y=M(zv,this);return!(y&&y.width===v&&y.height===g||(C(zv,this,{width:v,height:g}),r(null,null,v,g),0))}function hg(e){const t=null==e?void 0:e.nodeId,n=null==e?void 0:e.trackId,i=null==e?void 0:e.segmentId,r=null==e?void 0:e.presentationTime;return t&&n&&i&&Number.isFinite(r)?`${t}:${n}:${i}@${r}`:null}function fg(e,t,n){const i=Number.isFinite(null==e?void 0:e.duration)&&e.duration>0?e.duration:void 0;let r;if(i&&Number.isFinite(null==e?void 0:e.offset)){const n=(t-e.offset)/i;r=n<0?0:n>1?1:n}const o=A(Jv,this,pg).call(this,e),s=A(Jv,this,mg).call(this,o);return Mm.getRenderTiming({type:o,timing:{duration:i,normalizedTime:r},timelineTime:t,active:e,renderNodeParams:n,state:s})}function pg(e){return Mm.normalizeType(null==e?void 0:e.type)||Mm.defaultType}function mg(e){if(!e||!M(Vv,this))return null;let t=M(Vv,this).get(e);return t||(t={},M(Vv,this).set(e,t)),t}function vg(e){if(!e||!M(Vv,this))return;const t=M(Vv,this).get(e);t&&Mm.resetRenderState(e,t),M(Vv,this).delete(e)}function gg(){M(Vv,this)&&(Mm.resetAllRenderStates(M(Vv,this)),M(Vv,this).clear())}function yg(e,t,n,i){const r=A(Jv,this,pg).call(this,e);M(Gv,this)&&M(Gv,this)!==r&&A(Jv,this,vg).call(this,M(Gv,this)),C(Gv,this,r);const o=A(Jv,this,mg).call(this,r);return Mm.prepareRenderFrames({type:r,frames:t,timelineTime:n,timeline:M(wv,this),active:e,renderNodeParams:i,state:o})}function bg(e){var t;return null!=e&&e.params&&"object"==typeof e.params?e.params:!e&&null!==(t=this.settings)&&void 0!==t&&t.defaultRenderParams&&"object"==typeof this.settings.defaultRenderParams?this.settings.defaultRenderParams:{}}function kg(e){return e?String(e.renderPlacementId||e.type||"unknown"):"default"}function xg(){if(!M(wv,this)||!M(Wv,this))return;const e=M(wv,this).currentTime,t=M(wv,this).getActiveRenderPlacement(e),n=A(Jv,this,kg).call(this,t);n!==M(Hv,this)&&(C(Hv,this,n),A(Jv,this,Cg).call(this,{...M(Wv,this),time:e}))}function wg(e){return!e||"object"!=typeof e||!Object.prototype.hasOwnProperty.call(e,"panAndScan")||!1!==e.panAndScan}function _g(e,t){const n=A(Jv,this,bg).call(this,e),i=null==n?void 0:n.stages;let r=mv(null==i?void 0:i.pre),o=mv(null==i?void 0:i.post);const s=A(Jv,this,wg).call(this,n),a=A(Jv,this,pg).call(this,e),l=vv(r,"retarget")||vv(o,"retarget");if(s&&!l){const e=Mm.getPanAndScanTarget(a);if("pre"===e){const e=gv(Array.isArray(t)?t.length:0);e&&(r=[e,...r])}else if("post"===e){const e=gv(1);e&&(o=[...o,e])}}else s||(r=yv(r),o=yv(o));return{preStages:r,postStages:o,renderNodeParams:n}}function Tg(e,t,n,i,r){const o=r||A(Jv,this,fg).call(this,e,n,i),s=A(Jv,this,_g).call(this,e,t);return M(Fv,this).build({layoutType:null==e?void 0:e.type,frames:t,preStages:s.preStages,postStages:s.postStages,normalizedTime:o.normalizedTime,renderNodeDuration:o.duration,renderNodeParams:s.renderNodeParams,timelineTime:n})}function Ig(){var e,t;const n=null===(e=M(Pv,this))||void 0===e||null===(t=e.getState)||void 0===t?void 0:t.call(e);return"out"===(null==n?void 0:n.phase)?M(Pv,this).buildOutgoingGraph():"in"===(null==n?void 0:n.phase)?M(Pv,this).buildIncomingGraph():null}function Eg(e,t,n,i){const r=n||t!==M(Cv,this),o=r||i;return r&&M(Rv,this)&&"function"==typeof M(Rv,this).updateOptions&&(M(Rv,this).updateOptions(st.pipelineNodeId,{graph:e}),C(Cv,this,t)),M(Rv,this)&&"function"==typeof M(Rv,this).selectNode&&M(Ov,this)!==st.pipelineNodeId&&(M(Rv,this).selectNode(st.pipelineNodeId),C(Ov,this,st.pipelineNodeId)),!(!o||!M(Rv,this)||"function"!=typeof M(Rv,this).render||(M(Rv,this).render({noRaf:!0}),0))}function Sg(e){if(!Array.isArray(M(Lv,this))||!M(Lv,this).length)return;const t=Number.isFinite(e)?Math.max(0,e):0;if(!(M(Lv,this).length<=t)){for(let e=t;e<M(Lv,this).length;e+=1){const t=M(Lv,this)[e];if(t&&M(Rv,this)&&"function"==typeof M(Rv,this).releaseTexture)try{M(Rv,this).releaseTexture(t)}catch(e){}}M(Lv,this).length=t,M(Bv,this).length=t}}function Ag(e=[]){if(!M(Rv,this)||"function"!=typeof M(Rv,this).addTexture)return!1;if("function"==typeof M(Rv,this).isContextUnavailable&&M(Rv,this).isContextUnavailable())return!1;if(!Array.isArray(e)||!e.length)return A(Jv,this,Sg).call(this,0),!1;A(Jv,this,Sg).call(this,e.length);let t=!1;for(let i=0;i<e.length;i+=1){var n;M(Lv,this)[i]||"function"!=typeof M(Rv,this).addTexture||(M(Lv,this)[i]=M(Rv,this).addTexture(null,"frame",i));const r=A(Jv,this,hg).call(this,e[i]),o=null===(n=e[i])||void 0===n?void 0:n.frame;if(M(Lv,this)[i]&&o&&(!r||r!==M(Bv,this)[i]))try{M(Lv,this)[i].fill(o),M(Bv,this)[i]=r,t=!0}catch(e){}}return t}function Ng(){if(M(Uv,this))return;const e="function"==typeof ad.requestAnimationFrame?e=>ad.requestAnimationFrame(e):e=>setTimeout(e,16),t="function"==typeof ad.cancelAnimationFrame?e=>ad.cancelAnimationFrame(e):clearTimeout;C(jv,this,t);const n=()=>{var t,i;if(null!==(t=M(Pv,this))&&void 0!==t&&null!==(i=t.getState)&&void 0!==i&&i.call(t)){if(M(Wv,this)){const e=A(Jv,this,cg).call(this),t=Date.now();(!e||!M(qv,this)||t-M(qv,this)>=e)&&(C(qv,this,t),A(Jv,this,Cg).call(this,M(Wv,this)))}C(Uv,this,e(n))}else C(Uv,this,null)};C(Uv,this,e(n))}function Mg(){M(Uv,this)&&M(jv,this)&&M(jv,this).call(this,M(Uv,this)),C(Uv,this,null),C(jv,this,null),C(qv,this,null)}function Fg(e){var t,n;const i=null===(t=M(Pv,this))||void 0===t||null===(n=t.getState)||void 0===n?void 0:n.call(t);return"out"===(null==i?void 0:i.phase)&&M($v,this)?M($v,this):e}function Cg(e={}){var t,n;const i=null===(t=M(_v,this))||void 0===t?void 0:t.element,r=null===(n=M(_v,this))||void 0===n?void 0:n.gl;if(!i||!r)return;if(e&&C(Wv,this,e),!A(Jv,this,Og).call(this))return;const o=A(Jv,this,Fg).call(this,e),s=Number.isFinite(null==o?void 0:o.time)?o.time:void 0;if(!Number.isFinite(s))return;if(A(Jv,this,sg).call(this,i),!M(Rv,this))return;const a=M(wv,this)&&"function"==typeof M(wv,this).getActiveRenderPlacement?M(wv,this).getActiveRenderPlacement(s):void 0,l=A(Jv,this,kg).call(this,a);l!==M(Hv,this)&&C(Hv,this,l);const c=Array.isArray(null==o?void 0:o.frames)?o.frames:[],u=A(Jv,this,bg).call(this,a),d=A(Jv,this,wg).call(this,u),h=A(Jv,this,yg).call(this,a,c,s,u),f=A(Jv,this,fg).call(this,a,s,u),p=A(Jv,this,dg).call(this,h,{useViewportSize:d}),m=A(Jv,this,Ag).call(this,h),v=A(Jv,this,Tg).call(this,a,h,s,u,f),g=A(Jv,this,Ig).call(this);let y=v.graph,b=v.signature,k=!!v.isDynamic;g&&Array.isArray(g.graph)&&g.graph.length&&(y=y.concat(g.graph),b=`${b}|${g.signature||"transition"}`,k=k||!!g.forceUpdate);const x=p||m||k||g&&Array.isArray(g.graph)&&g.graph.length;A(Jv,this,Eg).call(this,y,b,k,x)&&h.length&&A(Jv,this,og).call(this)}function Og(){var e;const t=null===(e=M(wv,this))||void 0===e?void 0:e.state;return t===lv||t===uv||t===cv||t===hv}function Pg(e){return"number"==typeof e&&Number.isFinite(e)&&e>0}function Rg(e){return e&&"resource"===e.entryType&&e.transferSize>0&&e.duration>0&&e.responseEnd>=e.requestStart}function Dg(e){return Array.isArray(e)&&0!==e.length?e.reduce(((e,t)=>e+t),0)/e.length:NaN}st=Zv;var Lg=new WeakMap,Bg=new WeakMap,zg=new WeakMap,Wg=new WeakMap,$g=new WeakSet;class Ug extends rd{get name(){return"DownloadSpeedGuesstimator"}get defaults(){return{persistentStorage:{key:"ekoDownloadSpeedKbps",ttl:-1},priorities:[["resourceTiming","downlink","persistentValue"],["resourceTiming","downlink"],["resourceTiming","persistentValue","ua"],["resourceTiming","ua","defaultKbps"],["downlink","persistentValue"],["downlink"],["persistentValue"],["connectionType"],["ua"],["defaultKbps"]],defaultKbps:2500,connectionType:{"slow-2g":50,"2g":70,"3g":700,"4g":3500,bluetooth:750,cellular:750,ethernet:3500,wifi:2500,wimax:2500,none:0},ua:{desktop:2500,ios:2500,android:2500}}}constructor(...e){super(...e),O(this,$g),F(this,Lg,void 0),F(this,Bg,void 0),F(this,zg,void 0),F(this,Wg,void 0),C(Lg,this,!!(ad&&ad.navigator&&ad.navigator.connection)),C(Bg,this,!(!ad||!ad.performance||"function"!=typeof ad.performance.getEntriesByType)),C(zg,this,A($g,this,qg).call(this)),C(Wg,this,A($g,this,Xg).call(this))}guesstimate(){const e=A($g,this,Qg).call(this);this.log.debug("[guesstimate] Data:",e);const t=A($g,this,Yg).call(this,e),n=Pg(t)?t:e.defaultKbps;return A($g,this,Vg).call(this,n),this.log.info(`[guesstimate] Result: ${n} kbps`),n}update(e){Pg(e)&&A($g,this,Vg).call(this,e)}onDispose(){C(zg,this,void 0),C(Wg,this,void 0)}}function jg(){return Math.round(Date.now()/1e3)}function qg(){try{if(!ad||!ad.localStorage||"function"!=typeof ad.localStorage.getItem)return}catch(e){return}const e=this.settings.persistentStorage.key,t=ad.localStorage.getItem(e);if(t)try{const e=JSON.parse(t),n=this.settings.persistentStorage.ttl,i=A($g,this,jg).call(this)-e.timestamp;if("number"==typeof n&&n>=0&&i>n)return null;if(!Pg(e.value))return;return e.value}catch(e){return}}function Vg(e){if(!Pg(e))return;try{if(!ad||!ad.localStorage||"function"!=typeof ad.localStorage.setItem)return}catch(e){return}const t=this.settings.persistentStorage.key,n=JSON.stringify({value:e,timestamp:A($g,this,jg).call(this)});try{ad.localStorage.setItem(t,n),C(zg,this,e)}catch(e){}}function Gg(){return ad&&ad.performance&&"function"==typeof ad.performance.getEntriesByType?Dg(ad.performance.getEntriesByType("resource").filter(Rg).map((e=>8*e.transferSize/e.duration))):NaN}function Hg(){if(!ad||!ad.navigator||!ad.navigator.connection)return NaN;const e=ad.navigator.connection.downlink;return Pg(e)?1e3*e:NaN}function Kg(){if(!M(Lg,this))return NaN;const e=ad.navigator.connection,t=e.effectiveType||e.type,n=this.settings.connectionType||{};return t&&Object.prototype.hasOwnProperty.call(n,t)?n[t]:NaN}function Xg(){const e=this.settings.ua||{};return Ym()?e.android:Qm()?e.ios:e.desktop}function Yg(e){const t=Array.isArray(this.settings.priorities)?this.settings.priorities:[];for(let n=0;n<t.length;n+=1){const i=t[n];if(!Array.isArray(i)||0===i.length)continue;const r=i.map((t=>e[t])).filter((e=>Pg(e)));if(r.length===i.length)return this.log.debug("[#selectFromPriorities] Selected from priorities:",i,"with values:",r),Dg(r)}return NaN}function Qg(){const e=this.settings.testOverrides||{},t=Pg(e.resourceTiming)?e.resourceTiming:A($g,this,Gg).call(this),n=Pg(e.downlink)?e.downlink:A($g,this,Hg).call(this),i=Pg(e.persistentValue)?e.persistentValue:M(zg,this),r=Pg(e.connectionType)?e.connectionType:A($g,this,Kg).call(this),o=Pg(e.ua)?e.ua:M(Wg,this);return{defaultKbps:this.settings.defaultKbps,resourceTiming:t,downlink:n,connectionType:r,persistentValue:i,ua:o}}const Jg=new Ju;function Zg(e){return"string"!=typeof e||0===e.length?[]:e.split(".").filter((e=>e.length>0))}function ey(e){if("string"!=typeof e)return!1;if(0===e.length)return!1;const t=Number(e);return Number.isInteger(t)&&String(t)===e}function ty(e){return null!==e&&"object"==typeof e}function ny(e,t,n){const i=Zg(t);if(0===i.length)return void 0===e?n:e;let r=e;for(let e=0;e<i.length;e+=1){if(null==r)return n;if(r=r[i[e]],void 0===r)return n}return void 0===r?n:r}function iy(e,t,n){if(!ty(e))return e;const i=Zg(t);if(0===i.length)return e;let r=e;for(let e=0;e<i.length;e+=1){const t=i[e];if(e===i.length-1){r[t]=n;break}ty(r[t])||(r[t]=ey(i[e+1])?[]:{}),r=r[t]}return e}const ry={get:(e,t)=>ad&&ad.eko?ny(ad.eko,e,t):t,set(e,t){if(ad)return ad.eko&&"object"==typeof ad.eko||(ad.eko={}),iy(ad.eko,e,t),ad.eko}},oy=ad&&ad.performance,sy=oy&&"function"==typeof oy.now?()=>oy.now():()=>Date.now();function ay(){return"undefined"==typeof AbortController?null:new AbortController}function ly(){const e=new Error("The operation was aborted");return e.name="AbortError",e.code="ABORT_ERR",e}function cy(e,t){return!(!t||!t.aborted)||!!e&&("AbortError"===e.name||"ABORT_ERR"===e.code||20===e.code)}const uy=2,dy=100,hy=2,fy="runtime.downloadSpeedSamples",py=Qu("download","warn");function my(e){return new Promise((t=>{setTimeout(t,e)}))}function vy(e){return e>=500}function gy(e){if(!e||!e.headers||"function"!=typeof e.headers.get)return 0;const t=e.headers.get("content-length");if(!t)return 0;const n=Number(t);return Number.isNaN(n)||n<0?0:n}function yy(e,t,n,i,r,o){const s={bytes:e,durationMs:t,kbps:t>0?8*e/t:0,startTime:n,endTime:i,url:o};try{let e=ry.get(r);e||(e=[],ry.set(r,e)),e.push(s)}catch(e){}return s}async function by(e,t={}){const{method:n="GET",headers:i,body:r,retries:o=uy,retryDelay:s=dy,backoffFactor:a=hy,samplesTargetPath:l=fy,fetch:c,loglevel:u="warn",cache:d,signal:h,onProgress:f,returnType:p="default"}=t;py.setLevel(u);const m=function(e){if(e)return e;if(ad&&"function"==typeof ad.fetch)return ad.fetch.bind(ad);throw new Error("fetch is not available in this environment")}(c);let v=0,g=s;for(;;){if(h&&h.aborted)throw ly();const t=sy();try{const s=await m(e,{method:n,headers:i,body:r,cache:d,mode:"cors",signal:h});if(h&&h.aborted)throw ly();if(!s.ok){if(v<o&&vy(s.status)){v+=1,py.warn(`[${e}] Download attempt #${v} failed with status ${s.status}, retrying in ${g}ms...`),await my(g),g*=a;continue}py.error(`[${e}] Download attempt #${v} failed with status ${s.status}, no more retries.`);const t=new Error(`Download failed with status ${s.status}`);throw t.status=s.status,t}let c=sy();const u=gy(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 e=s.body.getReader(),t=[];for(;;){if(h&&h.aborted)throw ly();const{done:n,value:i}=await e.read();if(n)break;if(i&&i.length){const e=sy();Number.isFinite(_)||(_=e),T=e,t.push(i),I+=i.length,f({loaded:I,total:u||void 0,chunk:i})}}k=new Uint8Array(I);let n=0;t.forEach((e=>{k.set(e,n),n+=e.length})),c=sy()}else if(y){const e=await s.arrayBuffer();k=new Uint8Array(e),I=k.length,c=sy()}else"text"===p?(x=await s.text(),c=sy()):"json"===p&&(w=await s.json(),c=sy());if(h&&h.aborted)throw ly();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 A=t,N=c;Number.isFinite(_)&&(A=_,Number.isFinite(T)&&(N=Math.max(T,c))),(!Number.isFinite(A)||!Number.isFinite(N)||N<A)&&(A=t,N=c);const M=Math.max(0,N-A),F=yy(S,M,A,N,l,e);try{Jg.trigger("download:sample",F)}catch(e){}const C={response:s,bytes:S,durationMs:M,kbps:F.kbps,startTime:F.startTime,endTime:F.endTime};if("default"===p)return C;if("arrayBuffer"===p||"bytes"===p){const e=k||new Uint8Array(await s.arrayBuffer());return"arrayBuffer"===p?e.buffer:e}return"text"===p?x:"json"===p?w:C}catch(t){if(cy(t,h))throw"AbortError"===t.name?t:ly();if(!(v<o)||t.status&&!vy(t.status))throw py.error(`[${e}] Download attempt #${v} failed with error ${t}, no more retries.`),t;v+=1,py.warn(`[${e}] Download attempt #${v} failed with error ${t}, retrying in ${g}ms...`),await my(g),g*=a}}}const ky={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"]}},xy=Object.freeze(Object.entries(ky).reduce(((e,[t,n])=>(Object.prototype.hasOwnProperty.call(n,"default")&&(e[t]=n.default),e)),{})),wy=Qu("config","warn");function _y(e){return xy[e]}var Ty=new WeakMap,Iy=new WeakMap,Ey=new WeakMap,Sy=new WeakMap,Ay=new WeakMap,Ny=new WeakSet;class My extends rd{get name(){return"DownloadSpeed"}get defaults(){return{alpha:.3,maxSamples:30,minBytesPerSample:1024,minDurationMs:5,maxSampleKbpsCap:void 0,ignoreCacheHits:!0,samplesPath:"runtime.downloadSpeedSamples",initialKbps:_y("initialKbps"),probeUrl:void 0,defaultKbps:2500}}constructor(...e){super(...e),O(this,Ny),F(this,Ty,void 0),F(this,Iy,void 0),F(this,Ey,void 0),F(this,Sy,void 0),F(this,Ay,void 0),C(Ey,this,[]),C(Iy,this,0),C(Ty,this,A(Ny,this,Oy).call(this)),C(Ay,this,ay()),C(Sy,this,(e=>{A(Ny,this,zy).call(this,e,"event")})),A(Ny,this,Py).call(this),Jg.on("download:sample",M(Sy,this)),A(Ny,this,Ry).call(this),this.log.debug(`[#constructor] Initial estimate: ${M(Ty,this)} kbps`)}getKbps(){return M(Ty,this)}addSample(e){A(Ny,this,zy).call(this,e,"manual")}reset(){C(Ey,this,[]),C(Iy,this,0),C(Ty,this,A(Ny,this,Oy).call(this))}onDispose(){M(Ay,this)&&M(Ay,this).abort(),C(Ay,this,null),Jg.off("download:sample",M(Sy,this)),C(Ey,this,[]),C(Iy,this,0),C(Ty,this,void 0),C(Sy,this,null)}}function Fy(e,t){return!!(this.settings.ignoreCacheHits&&(0===t||e&&"boolean"==typeof e.cached&&e.cached||e&&"number"==typeof e.transferSize&&"number"==typeof e.encodedBodySize&&e.transferSize<=e.encodedBodySize))}function Cy(e){if(!e||"object"!=typeof e)return null;const t=Number(e.bytes),n=Number(e.durationMs);let i=Pg(e.kbps)?Number(e.kbps):NaN;return!Pg(i)&&n>0&&Pg(t)&&(i=8*t/n),Pg(i)?t<=this.settings.minBytesPerSample||n<=this.settings.minDurationMs||A(Ny,this,Fy).call(this,e,t)?null:(Pg(this.settings.maxSampleKbpsCap)&&i>this.settings.maxSampleKbpsCap&&(i=this.settings.maxSampleKbpsCap),{...e,bytes:t,durationMs:n,kbps:i}):null}function Oy(){const e=this.settings.initialKbps;if(Pg(e))return e;if("auto"===e)try{const e=(new Ug).guesstimate();if(Pg(e))return e}catch(e){}return this.settings.defaultKbps}function Py(){const e=ry.get(this.settings.samplesPath,[]);if(!Array.isArray(e)||0===e.length)return;const t=e.slice(-this.settings.maxSamples);for(let e=0;e<t.length;e+=1)A(Ny,this,zy).call(this,t[e],"replay",{emit:!1})}async function Ry(){if(!this.settings.probeUrl||M(Iy,this)>0)return;const e=M(Ay,this)?M(Ay,this).signal:void 0;if(!e||!e.aborted)try{await by(this.settings.probeUrl,{cache:"no-store",samplesTargetPath:this.settings.samplesPath,signal:e})}catch(e){}}function Dy(e){return"number"==typeof e.startTime&&"number"==typeof e.endTime&&Number.isFinite(e.startTime)&&Number.isFinite(e.endTime)&&e.startTime>=0&&e.endTime>e.startTime}function Ly(e,t){if(!A(Ny,this,Dy).call(this,e)||!A(Ny,this,Dy).call(this,t))return 0;const n=Math.max(e.startTime,t.startTime);return Math.min(e.endTime,t.endTime)-n}function By(e){if(!A(Ny,this,Dy).call(this,e))return e;const t=[];for(let n=0;n<M(Ey,this).length;n+=1){const i=M(Ey,this)[n];A(Ny,this,Dy).call(this,i)&&(A(Ny,this,Ly).call(this,e,i)>0&&t.push(i))}if(0===t.length)return e;C(Ey,this,M(Ey,this).filter((e=>!t.includes(e))));const n=[e,...t],i=n.reduce(((e,t)=>e+(t.bytes||0)),0),r=Math.min(...n.map((e=>e.startTime))),o=Math.max(...n.map((e=>e.endTime))),s=o-r;if(!Pg(i)||s<=0)return e;const a={bytes:i,durationMs:s,kbps:8*i/s,startTime:r,endTime:o,url:e.url||t[t.length-1].url};return A(Ny,this,Cy).call(this,a)}function zy(e,t,{emit:n=!0}={}){const i=A(Ny,this,Cy).call(this,e);if(!i)return;const r=A(Ny,this,By).call(this,i);if(!r)return;C(Iy,this,M(Iy,this)+1),M(Ey,this).push(r),M(Ey,this).length>this.settings.maxSamples&&M(Ey,this).shift();const o=this.defaults.alpha,s="number"==typeof this.settings.alpha?this.settings.alpha:o,a=Pg(M(Ty,this)),l=a?M(Ty,this):r.kbps,c=a||1!==M(Iy,this)?s*r.kbps+(1-s)*l:r.kbps;C(Ty,this,c),this.log.debug(`[#ingestSample] Next estimate: ${c} kbps`),n&&this.trigger("download:speed",{kbps:M(Ty,this),sample:r,source:t,samplesCount:M(Iy,this)})}class Wy{constructor(e={}){const{id:t,url:n,uri:i,mime:r,codecs:o,bandwidth:s,timescale:a,sizeBytes:l,...c}=e;if(!t)throw new Error("Representation requires id");const u=n||i;if(!u)throw new Error("Representation requires url or uri");this.id=t,this.url=u,this.mime=r,this.codecs=o,this.baseCodec=function(e=""){if(!e||"string"!=typeof e)return;const t=e.split(",")[0].trim();if(!t)return;const n=t.match(/^[a-z0-9]+/i);return n?n[0].toLowerCase():void 0}(o),Pg(s)&&(this.bandwidth=s),Pg(a)&&(this.timescale=a),Pg(l)&&(this.sizeBytes=l),Object.assign(this,c)}}class $y{#P=new Map;#R;#D;#L=0;#B;constructor(e={}){const{id:t,offset:n=0,duration:i=0,isInit:r=!1,representations:o=[]}=e;if(!t)throw new Error("Segment requires id");o.forEach((e=>{if(!e||!e.url&&!e.uri)throw new Error("Segment representation must include uri or url")})),this.id=t,this.offset=n,this.duration=i,this.isInit=!!r,this.originalRepresentations=o.map((e=>e instanceof Wy?e:new Wy(e))),this.representations=this.originalRepresentations.map((e=>e)),this.appliedFilters=[],this.loadAttempts=0,this.loadError=void 0}setRepresentationBuffer(e,t){e&&t&&this.#P.set(e,t)}setDownloadProgress(e,t){const n=Number(e);Number.isFinite(n)&&n>=0&&(this.#L=Math.max(this.#L,n));const i=Number(t);Number.isFinite(i)&&i>0&&(this.#B=i)}setChosenRepresentation(e){this.#R=e;const t=null==e?void 0:e.id;if(!(this.isInit||!t||this.#P.size<=1))for(const e of this.#P.keys())e!==t&&this.#P.delete(e)}setABRDecisionSnapshot(e){if(!e||"object"!=typeof e)return void(this.#D=void 0);const t={...e};Array.isArray(e.availableRepresentations)&&(t.availableRepresentations=e.availableRepresentations.map((e=>({...e})))),this.#D=t}markLoadAttempt(){const e=Number(this.loadAttempts);this.loadAttempts=Number.isFinite(e)&&e>0?e+1:1,this.loadError=void 0}setLoadError(e){this.loadError=e||new Error("Segment load failed")}getRepresentationBuffer(e){return this.#P.get(e)}get chosenRepresentation(){return this.#R}get abrDecision(){return this.#D}get arrayBuffer(){return this.#R?this.#P.get(this.#R.id):void 0}get retainedByteLength(){let e=0;for(const t of this.#P.values())t&&"number"==typeof t.byteLength&&(e+=t.byteLength);return e}get bufferedRatio(){var e;const t=Pg(this.#B)?this.#B:null===(e=this.#R)||void 0===e?void 0:e.sizeBytes;return Pg(t)?Math.min(1,Math.max(0,this.#L/t)):this.retainedByteLength>0?1:0}get isLoaded(){return this.retainedByteLength>0}evict(){this.#R=void 0,this.#D=void 0,this.#P.clear(),this.#L=0,this.#B=void 0}}class Uy{constructor(e={}){const{timestamp:t,name:n,data:i,isSticky:r=!1}=e;this.timestamp="number"==typeof t?t:0,this.name="string"==typeof n?n:"",this.data=i,this.isSticky="boolean"==typeof r&&r}}function jy(e,t){const n=Number(null==e?void 0:e.offset),i=Number(null==e?void 0:e.duration);if(!t)return{offset:n,duration:i};const r=(null==e?void 0:e.chosenRepresentation)||(Array.isArray(null==e?void 0:e.representations)?e.representations[0]:void 0),o=Number(null==r?void 0:r.segStart),s=Number(null==r?void 0:r.segDuration);return Number.isFinite(o)&&Number.isFinite(s)&&s>0?{offset:o,duration:s}:{offset:n,duration:i}}function qy(e,t,n={}){if(!Array.isArray(e)||!e.length)return;const i=Number(t);if(!Number.isFinite(i))return;const r=!!n.preferRepresentationTime;let o,s,a=-1/0;for(let t=0;t<e.length;t+=1){const n=e[t];if(!n||n.isInit)continue;o||(o=n);const l=jy(n,r);if(!Number.isFinite(l.offset))continue;const c=Number(l.duration);if(Number.isFinite(c)&&c>0&&i>=l.offset&&i<l.offset+c)return n;l.offset<=i&&l.offset>a&&(a=l.offset,s=n)}return s||o}const Vy=new Set(["video","audio","image","cue","data","bbox"]);class Gy{constructor(e={}){const{id:t,type:n,offset:i=0,duration:r,source:o,segments:s=[],cues:a=[]}=e;if(!t)throw new Error("Track requires id");if(!Vy.has(n))throw new Error(`Track type must be one of ${Array.from(Vy).join("|")}`);this.id=t,this.type=n,this.offset=i,this.duration=Pg(r)?r:void 0,this.source=o,"cue"===n?(this._cues=a.map((e=>e instanceof Uy?e:new Uy(e))),this._segments=[]):(this._segments=s.map((e=>e instanceof $y?e:new $y(e))),this._cues=void 0)}get segments(){return this._segments.slice()}get cues(){if("cue"===this.type)return this._cues.slice()}get endTime(){if(Pg(this.duration))return this.offset+this.duration;if(!this._segments.length)return;const e=this._segments.reduce(((e,t)=>{const n=Pg(t.duration)?t.duration:0;return Math.max(e,t.offset+n)}),this.offset);return e}get buffered(){const e=this._segments.map((e=>({duration:Pg(null==e?void 0:e.duration)?e.duration:0,offset:Pg(null==e?void 0:e.offset)?e.offset:0,ratio:e&&!e.isInit&&"number"==typeof e.bufferedRatio?e.bufferedRatio:0}))).filter((e=>e.duration>0&&e.ratio>0));if(!e.length)return;const t=e.reduce(((e,t)=>Math.min(e,t.offset)),1/0),n=e.reduce(((e,t)=>{const n=t.offset+t.duration*Math.min(1,t.ratio);return Math.max(e,n)}),0);return!Number.isFinite(t)||!Number.isFinite(n)||n<=t?void 0:{start:t,end:n}}getMediaSegmentAtTime(e,t={}){return qy(this._segments,e,t)}setSegments(e=[]){if("cue"===this.type)return;const t=Array.isArray(e)?e:[];this._segments=t.map((e=>e instanceof $y?e:new $y(e)))}}function Hy(e){return"string"==typeof e?e:e&&"object"==typeof e?e.nodeId||e.nodeIdOrRef||e.id:void 0}function Ky(e){const t=Hy(e);let n=1;if(e&&"object"==typeof e&&Pg(e.weight)&&(n=e.weight),!t)throw new Error("Child entry requires a nodeId");return{nodeId:t,weight:n}}function Xy(e){return(Array.isArray(e)?e:[]).map((e=>Ky(e)))}function Yy(e,t=void 0){if("string"==typeof e){const t=e.match(/\d+\.?\d*/);if(t){const e=Number(t[0]);if(Number.isFinite(e))return e}}else if("number"==typeof e&&Number.isFinite(e))return e;return t}function Qy(e,t){if(e){if(e.includes("$Number%")){const n=e.match(/\$Number%0(\d+)d\$/);if(n){const i=Number(n[1]),r=String(t).padStart(i,"0");return e.replace(/\$Number%0\d+d\$/,r)}}return e.replace(/\$Number\$/g,String(t))}}function Jy(e,t){if(t)try{var n;return new URL(t,e||(null==ad||null===(n=ad.location)||void 0===n?void 0:n.href)||void 0).toString()}catch(e){return t}}const Zy=new Map;class eb{static register(e,t){if(!e||"function"!=typeof t)throw new Error("ManifestFactory.register requires type and parser function");Zy.set(e,t)}static inferType(e={}){const{typeHint:t,url:n,mimeType:i,body:r}=e;return t||function(e=""){const t=function(e=""){return e&&"string"==typeof e?e.split("#")[0].split("?")[0].toLowerCase():""}(e);return t.endsWith(".mpd")?"dash":t.endsWith(".ivd")?"ivd":t.endsWith(".jpg")||t.endsWith(".jpeg")||t.endsWith(".png")||t.endsWith(".webp")||t.endsWith(".gif")||t.endsWith(".avif")?"image":void 0}(n||"")||function(e=""){const t=e.toLowerCase();return t.includes("dash")||t.includes("mpd")||t.includes("xml")?"dash":t.includes("ivd")||t.includes("json")?"ivd":t.includes("image/")?"image":void 0}(i||"")||function(e=""){const t="string"==typeof e?e.trim():"";if(t.startsWith("<")&&t.includes("<MPD"))return"dash";if(t.startsWith("{"))try{const e=JSON.parse(t);if(e&&"object"==typeof e)return"ivd"}catch(e){return}}(r||"")}static parse(e={}){const t=eb.inferType(e);if(!t||!Zy.has(t))throw new Error("Unsupported manifest type");return Zy.get(t)(e)}}eb.register("dash",(function(e={}){const{body:t,url:n}=e,i=function(){if(ad&&"function"==typeof ad.DOMParser)return new ad.DOMParser;throw new Error("DOMParser is not available in this environment")}().parseFromString(t||"","application/xml"),r=i.getElementsByTagName("MPD")[0];if(!r)throw new Error("Invalid MPD");const o=i.getElementsByTagName("Period")[0],s=o?Array.from(o.getElementsByTagName("AdaptationSet")):[],a=[];let l=Yy(r.getAttribute("mediaPresentationDuration"));l=Number.isFinite(l)?l:void 0,s.forEach(((e,t)=>{const i=e.getAttribute("mimeType")||"",r=function(e=""){const t=e.toLowerCase();return t.includes("video")?"video":t.includes("audio")?"audio":t.includes("image")?"image":"data"}(i),o=e.getAttribute("id")||`${r}-${t+1}`,s=e.getElementsByTagName("SegmentTemplate")[0],c=Array.from(e.getElementsByTagName("Representation")).map((e=>function(e,t,n){const i=e.getAttribute("id")||e.getAttribute("representationId")||"",r=Yy(e.getAttribute("bandwidth")),o=e.getAttribute("codecs"),s=e.getAttribute("mimeType")||t&&t.getAttribute("mimeType")||n,a=e.getElementsByTagName("SegmentTemplate")[0]||t;return{repId:i,bandwidth:r,codecs:o,mime:s,media:a?a.getAttribute("media"):void 0,initialization:a?a.getAttribute("initialization"):void 0,timescale:Yy(a&&a.getAttribute("timescale"))||Yy(t&&t.getAttribute("timescale"),1)||1,startNumber:Yy(a&&a.getAttribute("startNumber"))||Yy(t&&t.getAttribute("startNumber"),1)||1,timeline:function(e){const t=[],n=e.getElementsByTagName("SegmentTimeline")[0];if(!n)return t;const i=Array.from(n.getElementsByTagName("S"));let r=0;for(let e=0;e<i.length;e+=1){const n=i[e],o=Yy(n.getAttribute("t")),s=Yy(n.getAttribute("d")),a=Yy(n.getAttribute("r"),0);if(!Pg(s))continue;Pg(o)&&(r=o);const l=a>=0?a:0;for(let e=0;e<=l;e+=1)t.push({start:r,duration:s}),r+=s}return t}(a)}}(e,s,i))),u=c.map((e=>({id:e.repId,url:Jy(n,Qy(e.initialization,e.startNumber)),bandwidth:e.bandwidth,mime:e.mime,codecs:e.codecs,timescale:e.timescale}))).filter((e=>e.url)),d=c.reduce(((e,t)=>{const n=Array.isArray(null==e?void 0:e.timeline)?e.timeline.length:0;return(Array.isArray(null==t?void 0:t.timeline)?t.timeline.length:0)>n?t:e}),c[0]),h=Array.isArray(null==d?void 0:d.timeline)?d.timeline:[],f=h.length,p=[],m=(null==d?void 0:d.timescale)||1;u.length>0&&p.push({id:`init-${o}`,offset:0,duration:0,isInit:!0,representations:u});for(let e=0;e<f;e+=1){const t=h[e];if(!t)continue;const i=c.map((t=>{const i=t.startNumber+e,r=t.timescale||m,o=Array.isArray(t.timeline)?t.timeline[e]:void 0;if(!o)return null;const s=o.start,a=o.duration;return{id:t.repId,url:Jy(n,Qy(t.media,i)),bandwidth:t.bandwidth,mime:t.mime,codecs:t.codecs,timescale:t.timescale,segIndex:e,segStart:s/r,segDuration:a/r}})).filter(Boolean);i.length&&p.push({id:`${o}-seg-${e+1}`,offset:t.start/m,duration:t.duration/m,isInit:!1,representations:i})}a.push({id:o,type:r,offset:0,duration:l,segments:p})}));const c=a[0]?a[0].id:void 0;return{id:n||r.getAttribute("id")||"mpd",mainTrackId:c,tracks:a,duration:l}})),eb.register("ivd",(function(e={}){var t;const{body:n,url:i}=e;let r;try{r="string"==typeof n?JSON.parse(n):n}catch(e){throw new Error("Invalid IVD manifest")}if(!r||"object"!=typeof r)throw new Error("Invalid IVD manifest");const o=Array.isArray(r.representations)?r.representations:[],s=new Map;o.forEach(((e,t)=>{const n=function(e){const t=(e.mimeType||"").toLowerCase();return t.includes("video")?"video":t.includes("audio")?"audio":"data"}(e),i=Number.isInteger(e.altIndex)?e.altIndex:0,r=`${n}-${i}`,o=(l=t,{id:`${(a=e).format||"unknownformat"}-${a.altIndex||0}-${a.label||l+1}`,url:a.url,mime:a.mimeType,codecs:a.codecs,bandwidth:a.bandwidth||a.audioBandwidth||a.videoBandwidth,sizeBytes:a.contentLength,duration:Pg(a.duration)?a.duration:void 0,segIndex:Number.isInteger(a.segIndex)&&a.segIndex>=0?a.segIndex:0});var a,l;s.has(r)||s.set(r,{type:n,altIndex:i,reps:[]}),s.get(r).reps.push(o)}));const a=Array.from(s.values()).map(((e,t)=>{const n=new Map;e.reps.forEach((e=>{const t=Number.isInteger(e.segIndex)?e.segIndex:0;n.has(t)||n.set(t,[]),n.get(t).push(e)}));const i=Array.from(n.keys()).sort(((e,t)=>e-t));let o=0;const s=i.map((i=>{var r;const s=n.get(i)||[],a=(null===(r=s.find((e=>Pg(e.duration))))||void 0===r?void 0:r.duration)||0,l={id:`${e.type}-${e.altIndex}-${t+1}-seg-${i+1}`,offset:o,duration:a,isInit:!1,representations:s.map((e=>{const{duration:t,segIndex:n,...i}=e;return i}))};return o+=a,l})),a=s.reduce(((e,t)=>e+(Pg(t.duration)?t.duration:0)),0),l=Pg(r.duration)?r.duration:a||void 0;return{id:`${e.type}-${e.altIndex}-${t+1}`,type:e.type,offset:0,duration:l,segments:s}})),l=r.mainTrackId||(null===(t=a.find((e=>"video"===e.type)))||void 0===t?void 0:t.id)||a[0]&&a[0].id,c=a.find((e=>e.id===l)),u=(null==c?void 0:c.duration)||void 0;return{id:r.id||i||"ivd",metadata:r.metadata||{},mainTrackId:l,tracks:a,duration:u}})),eb.register("image",(function(e={}){const t=null==e?void 0:e.url;if(!t||"string"!=typeof t)throw new Error("ImageParser requires url");const n=Pg(null==e?void 0:e.duration)?e.duration:30,i=Pg(null==e?void 0:e.width)?e.width:void 0,r=Pg(null==e?void 0:e.height)?e.height:void 0,o={id:"image-1",url:t,mime:"string"==typeof(null==e?void 0:e.mimeType)?e.mimeType:void 0};Pg(i)&&Pg(r)&&(o.width=i,o.height=r);const s="image-1";return{id:t,metadata:{},mainTrackId:s,tracks:[{id:s,type:"image",offset:0,duration:n,segments:[{id:"image-1-seg-1",offset:0,duration:n,isInit:!1,representations:[o]}]}],duration:n}}));const tb=["video/mp4"];function nb(e){return tb.includes(e.mime)}var ib={name:"containers",fn:function(e=[]){return e.filter(nb)},isRelevantForTrack:function(e){return"video"===(null==e?void 0:e.type)}};const rb=new(at=new WeakMap,lt=new WeakSet,class extends rd{get name(){return"MediaCapabilities"}get defaults(){return{enabled:!0,smoothWeight:10,powerWeight:10,ignoreSmooth:!1,ignorePower:!0,codecBonus:{av01:.2,hvc1:.15,hev1:.15,vp09:.1,avc1:0}}}constructor(...e){super(...e),O(this,lt),F(this,at,void 0),C(at,this,new Map)}onDispose(){M(at,this)&&M(at,this).clear()}async sortRepsCodecs(e=[]){if(!Array.isArray(e)||0===e.length)return[];const t=[],n=new Set;let i=0;e.forEach((e=>{const r=null==e?void 0:e.baseCodec;r&&!n.has(r)&&(n.add(r),t.push({codec:r,rep:e,index:i}),i+=1)}));const r=(await Promise.all(t.map((async e=>{const{score:t}=await A(lt,this,cb).call(this,e.rep);return{...e,score:t}})))).sort(((e,t)=>{const n=t.score-e.score;return 0!==n?n:e.index-t.index}));return this.log.info("[sortRepsCodecs] Sorted entries:",r),r.map((e=>e.codec))}});function ob(){return!!(ad&&ad.navigator&&ad.navigator.mediaCapabilities&&"function"==typeof ad.navigator.mediaCapabilities.decodingInfo)}function sb(e){if(!e||"object"!=typeof e)return void this.log.debug("[#buildConfig] Invalid representation:",e);const t=e.mime||e.mimeType||"",n=function(e="",t=""){const n=e||"",i=t||"";return i?`${n}; codecs="${i}"`:n}(t,e.codecs||"");return function(e=""){return e.toLowerCase().includes("video")}(t)?(this.log.debug("[#buildConfig] Building video config for:",e),{type:"file",video:{contentType:n,width:e.width||1920,height:e.height||1080,bitrate:e.videoBandwidth||e.bandwidth||0,framerate:e.framerate||e.frameRate||24}}):function(e=""){return e.toLowerCase().includes("audio")}(t)?(this.log.debug("[#buildConfig] Building audio config for:",e),{type:"file",audio:{contentType:n,channels:e.channels||2,bitrate:e.audioBandwidth||e.bandwidth||0,samplerate:e.audioSamplingRate||48e3}}):void this.log.debug("[#buildConfig] Unknown mime type:",t)}function ab(e){return e?JSON.stringify(e):"invalid"}async function lb(e){if(!this.settings.enabled||!A(lt,this,ob).call(this)||!e)return this.log.debug("[#queryCapabilities] Not supported, returning false",e),{supported:!1,smooth:!1,powerEfficient:!1};const t=A(lt,this,ab).call(this,e),n=M(at,this).get(t);if(n)return n;let i;try{i=await ad.navigator.mediaCapabilities.decodingInfo(e)}catch(e){i={supported:!1,smooth:!1,powerEfficient:!1}}return this.log.debug("[#queryCapabilities] Config:",e,"\nDecoding info result:",i),M(at,this).set(t,i),i}async function cb(e){if(A(lt,this,db).call(this,e))return this.log.debug("[#scoreRepresentation] Blocking HEVC on Firefox versions below support threshold",null==e?void 0:e.codecs),{score:-1e3,capability:{supported:!1,smooth:!1,powerEfficient:!1}};const t=A(lt,this,sb).call(this,e),n=await A(lt,this,lb).call(this,t),i=function(e="",t={}){const n=(e||"").toLowerCase();return Object.keys(t).reduce(((e,i)=>n.includes(i.toLowerCase())?t[i]:e),0)}(e.codecs||"",this.settings.codecBonus);let r=0;return n.supported&&(r+=1),!this.settings.ignoreSmooth&&n.smooth&&(r+=this.settings.smoothWeight),!this.settings.ignorePower&&n.powerEfficient&&(r+=this.settings.powerWeight),r+=i,{score:r,capability:n}}function ub(){if(!ev())return!1;const e=tv();return!Number.isFinite(e)||e<150}function db(e){if(!A(lt,this,ub).call(this))return!1;const t=function(e=""){const t=String(e||"").toLowerCase(),[n]=t.split(".");return n||""}((null==e?void 0:e.baseCodec)||(null==e?void 0:e.codecs)||"");return"hvc1"===t||"hev1"===t}const hb=[],fb=()=>!0;[ib,{name:"force-video-codec",fn:function(e=[],{node:t}={}){const n=function(e){if("string"!=typeof e)return;const t=e.split(",")[0].trim();if(!t)return;const n=t.match(/^[a-z0-9]+/i);return n?n[0].toLowerCase():void 0}(null==t?void 0:t.forceVideoCodec);if(!n)return e;const i=e.filter((e=>(null==e?void 0:e.baseCodec)===n));return i.length?i:e},isRelevantForTrack:function(e){return"video"===(null==e?void 0:e.type)}},{name:"media-capabilities",fn:async function(e=[],{track:t}){if(null==t||!t.preferredCodec){const n=await rb.sortRepsCodecs(e);if(!Array.isArray(n)||0===n.length)return e;t.preferredCodec=n[0]}return e.filter((e=>(null==e?void 0:e.baseCodec)===t.preferredCodec))},isRelevantForTrack:function(e){return"video"===(null==e?void 0:e.type)}}].forEach((({name:e,fn:t,isRelevantForTrack:n})=>{!function(e,t,{isRelevantForTrack:n}={}){if(!e||"function"!=typeof t)throw new Error("registerRepresentationFilter requires a name and function");const i="function"==typeof n?n:fb;hb.push({name:e,fn:t,isRelevantForTrack:i})}(e,t,{isRelevantForTrack:n})}));const pb=Qu("Node","warn"),mb={start:0,end:0},vb=.001;function gb(e){if(!Array.isArray(e)||!e.length)return;const t=e.map((e=>{const t=Number(null==e?void 0:e.segStart),n=Number(null==e?void 0:e.segDuration);return!Number.isFinite(t)||!Number.isFinite(n)||n<=0?null:{start:t,duration:n}}));if(t.some((e=>!e)))return;const n=t[0];return t.every((e=>Math.abs(e.start-n.start)<=vb&&Math.abs(e.duration-n.duration)<=vb))?{offset:n.start,duration:n.duration}:void 0}var yb=new WeakMap,bb=new WeakMap,kb=new WeakMap,xb=new WeakMap,wb=new WeakMap,_b=new WeakMap,Tb=new WeakMap,Ib=new WeakMap,Eb=new WeakMap,Sb=new WeakMap,Ab=new WeakSet;class Nb extends Ju{constructor(e={},t={}){super(),O(this,Ab),F(this,yb,void 0),F(this,bb,void 0),F(this,kb,void 0),F(this,xb,void 0),F(this,wb,void 0),F(this,_b,void 0),F(this,Tb,void 0),F(this,Ib,void 0),F(this,Eb,void 0),F(this,Sb,[]);const{id:n,manifestRef:i,duration:r,width:o,height:s,metadata:a={},children:l=[]}=e;if(!n)throw new Error("Node requires id");if(!i)throw new Error("Node requires manifestRef");this.id=n,this.manifestRef=i,this.metadata=a,this.state="pending",this.error=void 0,this.tracks=[],this.mainTrackId=void 0,this.imageFallbackActive=!1,this.disabledTracks=[],this.disabledTrackTypes=Array.isArray(t.disabledTracks)?t.disabledTracks.filter((e=>"string"==typeof e)):[],this.enabledRepFilters=Array.isArray(t.enabledRepFilters)?t.enabledRepFilters:void 0,this.forceVideoCodec="string"==typeof t.forceVideoCodec&&t.forceVideoCodec.trim()?t.forceVideoCodec.trim():void 0,C(Tb,this,!0===t.forceImageFallback),C(yb,this,t.abrSelector),C(bb,this,t.assetsDeliveryService),C(xb,this,Pg(r)?r:void 0),C(wb,this,Pg(o)?o:void 0),C(_b,this,Pg(s)?s:void 0),C(Ib,this,t&&"object"==typeof t.mediaHostRewriteMap?t.mediaHostRewriteMap:void 0),C(Eb,this,Pg(t.maxManifestLoadAttempts)?t.maxManifestLoadAttempts:1/0),this.manifestLoadAttempts=0,this.manifestLoadError=void 0,C(Sb,this,Xy(l))}setChildren(e){const t=Xy(e);return A(Ab,this,Hb).call(this,t,{emit:!0})}addChild(e){const t=Ky(e),n=M(Sb,this).slice(),i=n.findIndex((e=>(null==e?void 0:e.nodeId)===t.nodeId));if(i>=0){var r;if((null===(r=n[i])||void 0===r?void 0:r.weight)===t.weight)return this.children;n[i]=t}else n.push(t);return A(Ab,this,Hb).call(this,n,{emit:!0})}removeChild(e){const t=Hy(e);if(!t)return this.children;const n=M(Sb,this).filter((e=>(null==e?void 0:e.nodeId)!==t));return n.length===M(Sb,this).length?this.children:A(Ab,this,Hb).call(this,n,{emit:!0})}async load(e={}){const{loadingMode:t="full",signal:n}=e;pb.info(`[load] [${this.id}] Loading node in '${t}' mode`);try{if(n&&n.aborted)throw ly();"ready"!==this.state&&await this.resolve({signal:n});const e="partial"===t,i=[];this.tracks.forEach((t=>{const n=t.segments||[];if(e){const e=n.find((e=>e.isInit)),r=n.find((e=>!e.isInit));e&&Array.isArray(e.representations)&&!e.isLoaded&&i.push({track:t,segment:e}),r&&Array.isArray(r.representations)&&!r.isLoaded&&i.push({track:t,segment:r})}else n.forEach((e=>{Array.isArray(e.representations)&&!e.isLoaded&&i.push({track:t,segment:e})}))}));const r=i.filter((({segment:e})=>e.isInit)),o=i.filter((({segment:e})=>!e.isInit)),s=o.length?o[0]:void 0,a=r.map((({track:e,segment:t})=>A(Ab,this,jb).call(this,e,t,n))),l=s?A(Ab,this,qb).call(this,s.segment,s.track,n):Promise.resolve();await Promise.all([...a,l]);const c=s?o.slice(1):o;for(const e of c)await A(Ab,this,qb).call(this,e.segment,e.track,n);if(n&&n.aborted)throw ly();return this.trigger("node:loaded",{nodeId:this.id,node:this,loadingMode:t}),this}catch(e){if(cy(e,n))throw e;throw this.trigger("node:loaderror",{nodeId:this.id,node:this,error:e,loadingMode:t}),e}}async loadMediaSegmentsAtOffset(e,t={}){const n=Number(e);if(pb.info(`[loadMediaSegmentsAtOffset] [${this.id}] Loading media segments at offset ${n}`),!Number.isFinite(n))return;const{signal:i}=t;if(i&&i.aborted)throw ly();if("ready"!==this.state&&await this.resolve({signal:i}),"ready"!==this.state)return;const r=[],o=[];if(this.tracks.forEach((e=>{const t=(null==e?void 0:e.segments)||[];if(!Array.isArray(t)||!t.length)return;const s=t.find((e=>(null==e?void 0:e.isInit)&&Array.isArray(null==e?void 0:e.representations)));s&&!s.isLoaded&&r.push(A(Ab,this,jb).call(this,e,s,i)),t.forEach((t=>{if(!t||t.isInit||!Array.isArray(t.representations))return;const i=Number(t.offset);Number.isFinite(i)&&Math.abs(i-n)<=vb&&!t.isLoaded&&o.push({segment:t,track:e})}))})),r.length||o.length){if(await Promise.all(r),o.length&&await Promise.all(o.map((({segment:e,track:t})=>A(Ab,this,qb).call(this,e,t,i)))),i&&i.aborted)throw ly();this.trigger("node:loaded",{nodeId:this.id,node:this,loadingMode:"segment-offset",offsetSeconds:n})}}async resolve(e={}){const{signal:t,manifestOverride:n}=e;let i=!0;for(;i;){if(i=!1,"ready"===this.state)return this;if("resolving"===this.state)try{return await M(kb,this)}catch(e){if(!cy(e)||t&&t.aborted)throw e;i=!0;continue}if(t&&t.aborted)throw ly();if(this.hasExceededManifestLoadAttempts()){const e=this.manifestLoadError||new Error("Manifest load retry limit reached");throw this.state="failed",this.error=e,e}const e=A(Ab,this,Db).call(this);return this.state="resolving",this.error=void 0,C(kb,this,(async()=>{try{const e=await A(Ab,this,Vb).call(this,{signal:t,manifestOverride:n});if(t&&t.aborted)throw ly();let i=eb.parse(e);return i=A(Ab,this,Rb).call(this,i),this.tracks=(i.tracks||[]).map((e=>e instanceof Gy?e:new Gy(e))),this.mainTrackId=i.mainTrackId||this.mainTrackId,this.metadata=i.metadata||this.metadata,A(Ab,this,Xb).call(this),A(Ab,this,Kb).call(this),await A(Ab,this,Gb).call(this),this.state="ready",this}catch(n){if(cy(n,t))throw A(Ab,this,Lb).call(this,e),n;throw this.state="failed",this.error=n,n}})()),M(kb,this)}return M(kb,this)}evict(){this.tracks.forEach((e=>{(e.segments||[]).forEach((e=>{e.evict()}))}))}get children(){return M(Sb,this).slice()}set children(e){this.setChildren(e)}get duration(){if(!this.mainTrackId)return 0;const e=this.tracks.find((e=>e.id===this.mainTrackId));return e?Pg(e.duration)?e.duration:e.endTime:0}get retainedByteLength(){let e=0;return this.tracks.forEach((t=>{(Array.isArray(t.segments)?t.segments:[]).forEach((t=>{e+=Pg(t.retainedByteLength)?t.retainedByteLength:0}))})),e}get buffered(){if("ready"!==this.state)return mb;const e=Array.isArray(this.tracks)?this.tracks.find((e=>(null==e?void 0:e.id)===this.mainTrackId)):void 0,t=this.duration;if(!e||!Pg(t))return mb;const n=Array.isArray(this.tracks)?this.tracks.map((e=>{if(!e||void 0===e.buffered)return;const t=e.buffered;return t&&Number.isFinite(t.start)&&Number.isFinite(t.end)?{track:e,range:t}:void 0})).filter(Boolean):[];if(!n.length)return mb;if(n.length===this.tracks.length&&n.every((({track:e,range:t})=>{const n=e.endTime,i=Pg(e.offset)?e.offset:0;return Number.isFinite(n)&&t.start<=i&&t.end>=n})))return{start:0,end:t};const i=n.reduce(((e,{range:t})=>Math.min(e,t.end)),1/0);if(!Number.isFinite(i))return mb;const r=Math.min(i,t);return r>0?{start:0,end:r}:mb}get isLoaded(){return"ready"===this.state&&(Array.isArray(this.tracks)?this.tracks:[]).flatMap((e=>Array.isArray(null==e?void 0:e.segments)?e.segments:[])).every((e=>e.isLoaded))}hasExceededManifestLoadAttempts(){if(!Number.isFinite(M(Eb,this))||M(Eb,this)<=0)return!1;if(!this.manifestLoadError)return!1;const e=Number(this.manifestLoadAttempts);return Number.isFinite(e)&&e>=M(Eb,this)}}function Mb(e){return function(e,t){if(!e||"string"!=typeof e)return e;if(!t||"object"!=typeof t)return e;const n=ad&&"function"==typeof ad.URL?ad.URL:"function"==typeof URL?URL:null;if(!n)return e;let i;try{i=new n(e)}catch(t){return e}const r=function(e,t){const n=null==e?void 0:e.hostname,i=null==e?void 0:e.pathname;if("string"!=typeof n||"string"!=typeof i)return e;if(!/^s3(?:[.-][a-z0-9-]+)?\.amazonaws\.com$/i.test(n))return e;const r=i.split("/").filter(Boolean);if(r.length<2)return e;const o=r[0],s=new t(e.toString());return s.hostname=`${o}.${n}`,s.pathname=`/${r.slice(1).join("/")}`,s}(i,n),o=t[r.hostname]?r:i,s=t[o.hostname];if(!s||"string"!=typeof s)return e;let a;try{a=new n(s)}catch(t){return e}return a.protocol&&a.host?(o.protocol=a.protocol,o.host=a.host,o.toString()):e}(e,M(Ib,this))}function Fb(){return M(Tb,this)||void 0===ad.VideoDecoder}function Cb(){return this.manifestRef&&"object"==typeof this.manifestRef&&"assets-delivery-service"===this.manifestRef.type}function Ob(e){if(!A(Ab,this,Cb).call(this))return!1;if(!A(Ab,this,Fb).call(this))return!1;const t=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[],n=t.find((t=>(null==t?void 0:t.id)===(null==e?void 0:e.mainTrackId)))||t[0];return"image"!==(null==n?void 0:n.type)}function Pb(e){const t=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[],n=function(e){const t=Number(null==e?void 0:e.duration);if(Number.isFinite(t)&&t>0)return t;const n=Array.isArray(null==e?void 0:e.segments)?e.segments:[];let i=0;return n.forEach((e=>{if(null!=e&&e.isInit)return;const t=Number(null==e?void 0:e.offset),n=Number(null==e?void 0:e.duration);!Number.isFinite(t)||!Number.isFinite(n)||n<=0||(i=Math.max(i,t+n))})),i>0?i:void 0}(t.find((t=>(null==t?void 0:t.id)===(null==e?void 0:e.mainTrackId)))||t[0]);return Pg(n)?n:Pg(M(xb,this))?M(xb,this):void 0}function Rb(e){if(this.imageFallbackActive=!1,!A(Ab,this,Ob).call(this,e))return e;if(!M(bb,this)||"function"!=typeof M(bb,this).resolveImageOne)return e;const t=M(bb,this).resolveImageOne(this.manifestRef),n=A(Ab,this,Mb).call(this,null==t?void 0:t.url);if(!n)return e;const i={typeHint:"image",url:n,duration:A(Ab,this,Pb).call(this,e),width:M(wb,this),height:M(_b,this)},r=eb.parse(i);return e&&"object"==typeof e.metadata&&!Array.isArray(e.metadata)&&(r.metadata=e.metadata),this.imageFallbackActive=!0,r}function Db(){return{state:this.state,error:this.error,tracks:this.tracks,mainTrackId:this.mainTrackId,metadata:this.metadata,imageFallbackActive:this.imageFallbackActive,disabledTracks:this.disabledTracks,manifestRef:this.manifestRef,manifestLoadAttempts:this.manifestLoadAttempts,manifestLoadError:this.manifestLoadError}}function Lb(e){e&&(this.state=e.state,this.error=e.error,this.tracks=e.tracks,this.mainTrackId=e.mainTrackId,this.metadata=e.metadata,this.imageFallbackActive=e.imageFallbackActive,this.disabledTracks=e.disabledTracks,this.manifestRef=e.manifestRef,this.manifestLoadAttempts=e.manifestLoadAttempts,this.manifestLoadError=e.manifestLoadError)}function Bb(){const e=Number(this.manifestLoadAttempts);this.manifestLoadAttempts=Number.isFinite(e)&&e>0?e+1:1,this.manifestLoadError=void 0}function zb(e){this.manifestLoadError=e||new Error("Manifest load failed")}function Wb(e){if(!e)return null;const t={loadAttempts:Number(e.loadAttempts),loadError:e.loadError};if("function"==typeof e.markLoadAttempt)return e.markLoadAttempt(),t;const n=Number(e.loadAttempts);return e.loadAttempts=Number.isFinite(n)&&n>0?n+1:1,e.loadError=void 0,t}function $b(e,t){if(!e||!t)return;const n=Number(t.loadAttempts);e.loadAttempts=Number.isFinite(n)&&n>=0?n:0,e.loadError=t.loadError}function Ub(e,t){e&&("function"!=typeof e.setLoadError?e.loadError=t||new Error("Segment load failed"):e.setLoadError(t))}async function jb(e,t,n){const i=A(Ab,this,Wb).call(this,t);try{const i=t.representations.map((async i=>{const r=A(Ab,this,Mb).call(this,i.url),o=await by(r,{returnType:"arrayBuffer",signal:n,onProgress:({loaded:n,total:i,chunk:r})=>{t&&"function"==typeof t.setDownloadProgress&&t.setDownloadProgress(n,i),this.trigger("segment:chunk",{nodeId:this.id,trackId:null==e?void 0:e.id,trackType:null==e?void 0:e.type,segmentId:t.id,isInit:!0,loaded:n,total:i,chunk:r})}}),s=o instanceof ArrayBuffer?o:null==o?void 0:o.arrayBuffer;s&&t.setRepresentationBuffer(i.id,s)}));await Promise.all(i)}catch(e){if(cy(e,n))throw A(Ab,this,$b).call(this,t,i),e;throw A(Ab,this,Ub).call(this,t,e),e}}async function qb(e,t,n){const i=M(yb,this),r={representations:e.representations,nodeId:this.id,trackId:null==t?void 0:t.id,segmentId:e.id},o=i&&"function"==typeof i.select?i.select(r):void 0,s=e.representations.find((e=>e.id===o))||e.representations[0];if(!s)return;e&&"function"==typeof e.setABRDecisionSnapshot&&e.setABRDecisionSnapshot(r.abrDecision),e.setChosenRepresentation(s);const a=A(Ab,this,Wb).call(this,e);try{const i=A(Ab,this,Mb).call(this,s.url),r=await by(i,{returnType:"arrayBuffer",signal:n,onProgress:({loaded:n,total:i,chunk:r})=>{e&&"function"==typeof e.setDownloadProgress&&e.setDownloadProgress(n,i),this.trigger("segment:chunk",{nodeId:this.id,trackId:null==t?void 0:t.id,trackType:null==t?void 0:t.type,segmentId:e.id,isInit:!1,loaded:n,total:i,chunk:r})}}),o=r instanceof ArrayBuffer?r:null==r?void 0:r.arrayBuffer;o&&(e.setRepresentationBuffer(s.id,o),e.setChosenRepresentation(s))}catch(t){if(cy(t,n))throw A(Ab,this,$b).call(this,e,a),t;throw A(Ab,this,Ub).call(this,e,t),t}}async function Vb(e={}){const{signal:t,manifestOverride:n}=e;if(t&&t.aborted)throw ly();A(Ab,this,Bb).call(this);try{let e=this.manifestRef;if(n&&"object"==typeof n){if(A(Ab,this,Cb).call(this)&&"string"==typeof n.encodeProfile&&n.encodeProfile&&(this.manifestRef={...this.manifestRef,encodeProfile:n.encodeProfile},e=this.manifestRef),n.ivd)return{typeHint:"ivd",body:n.ivd};if(n.body){const e=A(Ab,this,Mb).call(this,n.url);return{typeHint:n.typeHint,url:e,mimeType:n.mimeType,body:n.body,duration:M(xb,this),width:M(wb,this),height:M(_b,this)}}"string"==typeof n.url&&n.url&&(e=n)}if(e&&"object"==typeof e&&"assets-delivery-service"===e.type){if(!M(bb,this)||"function"!=typeof M(bb,this).resolveOne)throw new Error("AssetsDeliveryService is required for assets-delivery-service manifestRef");const n=await M(bb,this).resolveOne(e,{signal:t});if(!n)throw new Error("AssetsDeliveryService returned empty result");if("string"==typeof n.encodeProfile&&n.encodeProfile&&(this.manifestRef={...e,encodeProfile:n.encodeProfile}),n.ivd)return{typeHint:"ivd",body:n.ivd};const i=n.typeHint,r=A(Ab,this,Mb).call(this,n.url),o=n.mimeType,s=n.body;if(r||s||o)return{typeHint:i,url:r,mimeType:o,body:s,duration:M(xb,this),width:M(wb,this),height:M(_b,this)};throw new Error("AssetsDeliveryService returned unsupported manifest shape")}if(e&&"object"==typeof e){const t=A(Ab,this,Mb).call(this,e.url),n=e.mimeType;if(e.body)return{url:t,mimeType:n,body:"string"==typeof e.body?e.body:JSON.stringify(e.body)}}if("string"==typeof e||e&&"string"==typeof e.url){const n="string"==typeof e?e:e.url,i=A(Ab,this,Mb).call(this,n),r="object"==typeof e?e.typeHint:void 0,o="object"==typeof e?e.mimeType:void 0;if("image"===eb.inferType({typeHint:r,url:i,mimeType:o})){const t="object"==typeof e&&Pg(e.duration)?e.duration:M(xb,this);return{typeHint:"image",url:i,mimeType:o,duration:t,width:"object"==typeof e&&Pg(e.width)?e.width:M(wb,this),height:"object"==typeof e&&Pg(e.height)?e.height:M(_b,this)}}const s=await by(i,{returnType:"default",signal:t});return{url:i,body:s&&s.response&&"function"==typeof s.response.text?await s.response.text():void 0,mimeType:(s&&s.response&&s.response.headers&&"function"==typeof s.response.headers.get&&s.response.headers.get("content-type")?s.response.headers.get("content-type"):void 0)||o}}throw new Error("Node manifestRef is invalid or missing")}catch(e){if(cy(e,t))throw e;throw A(Ab,this,zb).call(this,e),e}}async function Gb(){const e=hb.slice().filter((e=>!this.enabledRepFilters||this.enabledRepFilters.includes(e.name)));if(e.length)for(let t=0;t<this.tracks.length;t+=1){const n=this.tracks[t],i=Array.isArray(n.segments)?n.segments:[],r=[];for(let t=0;t<i.length;t+=1){const o=i[t];if(!Array.isArray(o.representations)){r.push(o);continue}o.appliedFilters=o.appliedFilters||[];let s=o.representations;for(let t=0;t<e.length;t+=1){const{name:i,fn:r,isRelevantForTrack:a}=e[t];if(!a(n))continue;const l=await r(s,{segment:o,track:n,node:this});Array.isArray(l)&&(s=l),o.appliedFilters.push(i)}if(o.representations=s,o.representations.length){if(!o.isInit){const e=gb(o.representations);e&&(o.offset=e.offset,o.duration=e.duration)}r.push(o)}}r.length!==i.length&&n&&"function"==typeof n.setSegments&&n.setSegments(r)}}function Hb(e,{emit:t=!1}={}){return function(e=[],t=[]){if(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1){const i=e[n],r=t[n];if((null==i?void 0:i.nodeId)!==(null==r?void 0:r.nodeId)||(null==i?void 0:i.weight)!==(null==r?void 0:r.weight))return!1}return!0}(M(Sb,this),e)||(C(Sb,this,e),t&&(n=this)&&"function"==typeof n.trigger&&n.trigger("node:childrenchanged",{nodeId:n.id,node:n,children:Array.isArray(n.children)?n.children:[]})),this.children;var n}function Kb(){var e;const t=Array.isArray(this.disabledTrackTypes)?this.disabledTrackTypes:[];if(!t.length||!Array.isArray(this.tracks)||!this.tracks.length)return void(this.disabledTracks=[]);const n=new Set(t),i=[],r=[];this.tracks.forEach((e=>{e&&n.has(e.type)?r.push(e):e&&i.push(e)})),this.tracks=i,this.disabledTracks=r,this.mainTrackId&&!i.some((e=>e.id===this.mainTrackId))&&(this.mainTrackId=null===(e=i[0])||void 0===e?void 0:e.id)}function Xb(){if(!Array.isArray(this.tracks)||!this.tracks.length)return;const e=this.duration;if(!Pg(e))return;const t=[new Uy({name:"nodestart",timestamp:0,data:{id:this.id},isSticky:!0}),new Uy({name:"nodeend",timestamp:e,data:{id:this.id}})],n=new Gy({id:`${this.id}-auto-cue`,type:"cue",cues:t,offset:0,duration:e});this.tracks.push(n)}var Yb=new WeakMap,Qb=new WeakMap,Jb=new WeakMap,Zb=new WeakMap,ek=new WeakSet;class tk extends rd{constructor(...e){super(...e),O(this,ek),F(this,Yb,new Map),F(this,Qb,new Map),F(this,Jb,void 0),F(this,Zb,void 0);const[t,n]=e;C(Jb,this,t),C(Zb,this,n)}get name(){return"NodeRepository"}get defaults(){return{enabledRepFilters:["containers","force-video-codec","media-capabilities"],disabledTracks:_y("disabledTracks"),forceVideoCodec:_y("forceVideoCodec"),forceImageFallback:_y("forceImageFallback"),mediaHostRewriteMap:_y("mediaHostRewriteMap"),maxManifestLoadAttempts:3}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"get","list"])}onDispose(){M(Yb,this).forEach(((e,t)=>{const n=M(Qb,this).get(t);n&&e&&"function"==typeof e.off&&e.off(rv.NODE_CHILDREN_CHANGED,n)})),M(Qb,this).clear(),M(Yb,this).clear()}add(e){const t=e instanceof Nb?e:new Nb(e,{enabledRepFilters:this.settings.enabledRepFilters,disabledTracks:this.settings.disabledTracks,forceVideoCodec:this.settings.forceVideoCodec,forceImageFallback:this.settings.forceImageFallback,mediaHostRewriteMap:this.settings.mediaHostRewriteMap,maxManifestLoadAttempts:this.settings.maxManifestLoadAttempts,abrSelector:M(Jb,this),assetsDeliveryService:M(Zb,this)});if(!t.id)throw new Error("NodeRepository.add requires node with id");if(M(Yb,this).has(t.id))throw new Error(`NodeRepository.add: node with id ${t.id} already exists`);return M(Yb,this).set(t.id,t),A(ek,this,nk).call(this,t),this.trigger(rv.NODE_ADD,{node:t}),t}get(e){const t=(null==e?void 0:e.id)||e;if(!t)throw new Error("NodeRepository.get requires node or id");return M(Yb,this).get(t)}list(){return Array.from(M(Yb,this).values())}}function nk(e){if(!e||"function"!=typeof e.on||!e.id)return;const t=e=>{this.trigger(rv.NODE_CHILDREN_CHANGED,e)};e.on(rv.NODE_CHILDREN_CHANGED,t),M(Qb,this).set(e.id,t)}var ik=new WeakMap,rk=new WeakMap,ok=new WeakSet;class sk extends rd{constructor(...e){super(...e),O(this,ok),F(this,ik,void 0),F(this,rk,new Map);const[t]=e;C(ik,this,t)}get name(){return"ABRSelector"}get defaults(){return{safetyMargin:.35,minBufferForUpgrade:5,minBufferCritical:1,hysteresisRatio:1.1,abrStrategy:_y("abrStrategy")}}select(e={}){var t;const{representations:n=[],bufferSeconds:i}=e;if(!Array.isArray(n)||0===n.length)return;const r=M(ik,this)&&"function"==typeof M(ik,this).getKbps?M(ik,this).getKbps():void 0,o=A(ok,this,ak).call(this,n[0]),s=M(rk,this).get(o),a=this.settings.abrStrategy||"auto";this.log.debug(`[select] strategy=${a}, bw=${r}, buffer=${i}, prev=${s}`);const l=n.slice().sort(((e,t)=>A(ok,this,lk).call(this,e.bandwidth)-A(ok,this,lk).call(this,t.bandwidth)));if("bottom"===a){const t=l[0];return A(ok,this,dk).call(this,t,e,{decisionReason:"strategy:bottom",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:void 0,bufferSeconds:i}),null==t?void 0:t.id}if("top"===a){const t=l[l.length-1];return A(ok,this,dk).call(this,t,e,{decisionReason:"strategy:top",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:void 0,bufferSeconds:i}),null==t?void 0:t.id}if("random"===a){const t=l[Math.floor(Math.random()*l.length)];return A(ok,this,dk).call(this,t,e,{decisionReason:"strategy:random",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:void 0,bufferSeconds:i}),null==t?void 0:t.id}const c=Number.isFinite(i)?i:void 0,u=Pg(r)?r*this.settings.safetyMargin:void 0;let d="auto:highest-available";if(s&&void 0!==c&&c<this.settings.minBufferCritical){const t=l[0];return this.log.debug("[select] critical buffer -> lowest",e),A(ok,this,dk).call(this,t,e,{decisionReason:"auto:critical-buffer",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:u,bufferSeconds:c}),null==t?void 0:t.id}let h=l[l.length-1];if(void 0!==u){const t=l.filter((e=>A(ok,this,lk).call(this,e.bandwidth)<=u));t.length>0?(h=t[t.length-1],d="auto:highest-under-safe-bandwidth",this.log.debug("[select] under safe bandwidth ->",h.id,e)):(this.log.debug("[select] no rep under safe bandwidth, fallback lowest",e),h=l[0],d="auto:no-rep-under-safe-bandwidth")}if(s&&void 0!==c&&c<this.settings.minBufferForUpgrade){const t=n.find((e=>e.id===s));t&&Pg(t.bandwidth)&&Pg(h.bandwidth)&&h.bandwidth/t.bandwidth>this.settings.hysteresisRatio&&(h=n.filter((e=>e.bandwidth&&e.bandwidth<=t.bandwidth*this.settings.hysteresisRatio)).sort(((e,t)=>e.bandwidth-t.bandwidth)).pop()||t,d="auto:hysteresis-hold",this.log.debug("[select] hysteresis prevents upgrade; hold",h.id,e))}return A(ok,this,dk).call(this,h,e,{decisionReason:d,trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:u,bufferSeconds:c}),null===(t=h)||void 0===t?void 0:t.id}onDispose(){M(rk,this).clear(),C(ik,this,null)}}function ak(e){var t,n;return(null===(t=e.mime)||void 0===t||null===(n=t.split)||void 0===n||null===(n=n.call(t,"/"))||void 0===n?void 0:n[0])||"unknown"}function lk(e){return Pg(e)?e/1e3:0}function ck(e){return Pg(e)?e/1e3:void 0}function uk(e,t,n={}){const i=Array.isArray(null==t?void 0:t.representations)?t.representations.map((e=>({id:null==e?void 0:e.id,bandwidthKbps:A(ok,this,ck).call(this,null==e?void 0:e.bandwidth)}))):[];return{timeMs:Date.now(),strategy:this.settings.abrStrategy||"auto",decisionReason:n.decisionReason,nodeId:null==t?void 0:t.nodeId,trackId:null==t?void 0:t.trackId,segmentId:null==t?void 0:t.segmentId,trackType:n.trackType,measuredDownloadSpeedKbps:Number.isFinite(n.measuredDownloadSpeedKbps)?n.measuredDownloadSpeedKbps:void 0,safeBandwidthKbps:Number.isFinite(n.safeBandwidthKbps)?n.safeBandwidthKbps:void 0,bufferSeconds:Number.isFinite(n.bufferSeconds)?n.bufferSeconds:void 0,previousRepresentationId:n.previousRepresentationId,selectedRepresentationId:null==e?void 0:e.id,selectedRepresentationBandwidthKbps:A(ok,this,ck).call(this,null==e?void 0:e.bandwidth),safetyMargin:Number(this.settings.safetyMargin),minBufferForUpgrade:Number(this.settings.minBufferForUpgrade),minBufferCritical:Number(this.settings.minBufferCritical),hysteresisRatio:Number(this.settings.hysteresisRatio),availableRepresentations:i}}function dk(e,t,n={}){if(!e)return;const i=A(ok,this,uk).call(this,e,t,n);t&&"object"==typeof t&&(t.abrDecision=i),this.log.info("[select] Chosen representation:",e,"context:",t,"decision:",i),this.trigger("abr:selection",{representation:e,context:t,strategy:this.settings.abrStrategy,decision:i});const r=A(ok,this,ak).call(this,e);M(rk,this).set(r,e.id)}var hk=new WeakMap,fk=new WeakSet;class pk extends rd{constructor(...e){super(...e),O(this,fk),F(this,hk,void 0);const[t]=e;if(C(hk,this,t),!M(hk,this)||"function"!=typeof M(hk,this).list)throw new Error("NodePrioritizer requires a NodeRepository instance")}get name(){return"NodePrioritizer"}get defaults(){return{levelMultiplier:1,priorityMultiplier:.3}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"sortNodes"])}onDispose(){C(hk,this,null)}getPrioritizationSnapshot(e){const t=M(hk,this).list();if(!t.length)return{orderedIds:[],reachableIds:[]};const{levels:n,weights:i}=A(fk,this,mk).call(this,t,e);return{orderedIds:A(fk,this,vk).call(this,t,n,i),reachableIds:Array.from(n.keys())}}sortNodes(e){const{orderedIds:t}=this.getPrioritizationSnapshot(e);return t.length?(this.log.info(`[sortNodes(${e})] Sorted nodes: [${t.join(", ")}]`),t):[]}getReachableNodeIds(e){const{reachableIds:t}=this.getPrioritizationSnapshot(e);return t}}function mk(e,t){const n=new Map;e.forEach((e=>{e&&e.id&&n.set(e.id,e)}));const i=new Map,r=new Map;if(!t||!n.has(t))return{levels:i,weights:r};const o=[{id:t,level:0,priority:1}];for(i.set(t,0),r.set(t,1);o.length;){const{id:e,level:t,priority:s}=o.shift(),a=n.get(e),l=Array.isArray(null==a?void 0:a.children)?a.children:[];for(let e=0;e<l.length;e+=1){const a=l[e],c=(null==a?void 0:a.nodeId)||(null==a?void 0:a.id);if(!c||!n.has(c)||i.has(c))continue;const u=Pg(null==a?void 0:a.weight)?a.weight:1,d=Math.max(u,s);i.set(c,t+1),r.set(c,d),o.push({id:c,level:t+1,priority:d})}}return{levels:i,weights:r}}function vk(e,t,n){const i=t.size>0,{levelMultiplier:r,priorityMultiplier:o}=this.settings,s=e.map((e=>{var s;const a=t.has(e.id)?t.get(e.id):i?Number.MAX_SAFE_INTEGER:0,l=Number.isFinite(a)?a:Number.MAX_SAFE_INTEGER,c=null!==(s=n.get(e.id))&&void 0!==s?s:1,u=(Number.isFinite(l)?r*l:Number.MAX_SAFE_INTEGER)+o*c;return{id:e.id,score:u,level:l,priorityWeight:c}}));return s.sort(((e,t)=>e.score!==t.score?e.score-t.score:e.level!==t.level?e.level-t.level:e.priorityWeight!==t.priorityWeight?e.priorityWeight-t.priorityWeight:e.id.localeCompare(t.id))),s.map((e=>e.id))}function gk(e,t){return function(e,t){const n=Array.isArray(e)?e:[];return n.length?t&&n.includes(t)?t:n[0]:t||void 0}(null==e?void 0:e.availableEncodeProfiles,t)}function yk(e,t){const n=e&&"object"==typeof e?{...e}:e;return n&&"object"==typeof n?("string"==typeof t&&t?n.encodeProfile=t:delete n.encodeProfile,n):n}function bk(e){return"string"==typeof e&&e.startsWith("cmaf:")}function kk(e){return"image"===(null==e?void 0:e.assetType)?"image":"ivd"}function xk(e){if(!e||"object"!=typeof e)return e;if(Object.prototype.hasOwnProperty.call(e,"mpd")){const t="string"==typeof e.mpdUrl&&e.mpdUrl||"string"==typeof e.url&&e.url||void 0;return{typeHint:"dash",body:e.mpd,url:t}}return e.ivd||e.url||e.body||e.mimeType||e.typeHint?e:(t=e)&&"object"==typeof t&&Array.isArray(t.representations)?{ivd:e}:e;var t}var wk=new WeakMap,_k=new WeakMap,Tk=new WeakSet;class Ik extends rd{constructor(...e){super(...e),O(this,Tk),F(this,wk,void 0),F(this,_k,void 0);const[,t={}]=e;C(wk,this,"function"==typeof t.fetchFn?t.fetchFn:void 0),C(_k,this,ay())}get name(){return"AssetsDeliveryService"}get defaults(){return{assetsDeliveryServiceUrl:"https://assets.eko.com",profile:_y("encodeProfile"),maxBatchSize:5,imageQueryParams:{startOffset:0,width:1024}}}async resolveOne(e,t={}){var n;const i=await this.resolve([e],t);if(!i.length)return;const r=i[0],o=null==r?void 0:r.manifest,s=null==r||null===(n=r.manifestRef)||void 0===n?void 0:n.encodeProfile;return o&&"object"==typeof o&&"string"==typeof s&&s?{...o,encodeProfile:s}:o}resolveImageOne(e){if(!A(Tk,this,Sk).call(this,e))return;const t=gk(e,this.settings.profile),n=function(e,t,n){const i=(e||"").replace(/\/$/,""),r=null==t?void 0:t.assetId,o=null==t?void 0:t.assetRevision;if(!i||"string"!=typeof r||"number"!=typeof o)return;const s=`${i}/image/${encodeURIComponent(r)}/${o}`,a=function(e){if(!e||"object"!=typeof e||Array.isArray(e))return"";const t=new URLSearchParams;return Object.keys(e).forEach((n=>{if("string"!=typeof n||!n)return;const i=e[n];null!=i&&("number"!=typeof i||Number.isFinite(i))&&("string"!=typeof i&&"number"!=typeof i&&"boolean"!=typeof i||t.set(n,String(i)))})),t.toString()}(n);return a?`${s}?${a}`:s}(this.settings.assetsDeliveryServiceUrl||"",e,this.settings.imageQueryParams);if(!n)return;const i={typeHint:"image",url:n};return"string"==typeof t&&t&&(i.encodeProfile=t),i}async resolve(e=[],t={}){const n=(Array.isArray(e)?e:[e]).filter((e=>A(Tk,this,Sk).call(this,e)));if(!n.length)return[];const i=A(Tk,this,Ek).call(this,t);if(i&&i.aborted)return[];const r=[],o=this.settings.profile;n.forEach((e=>{if("image"!==kk(e))return;const t=this.resolveImageOne(e);t&&t.url&&r.push({manifestRef:yk(e,t.encodeProfile),manifest:{typeHint:"image",url:t.url}})}));const s=n.filter((e=>"image"!==kk(e))).map((e=>function(e,t){const n=gk(e,t);return{ref:e,profile:n,route:bk(n)?"dash":"ivd"}}(e,o))),a=A(Tk,this,Nk).call(this,s);for(const{refs:e,route:t}of a){if(i&&i.aborted)return r;const{url:n}=A(Tk,this,Mk).call(this,e,t),o=await A(Tk,this,Fk).call(this,n,{method:"GET",signal:i});o&&"object"==typeof o&&e.forEach((({ref:e,profile:t})=>{const n=`${e.assetId}:${e.assetRevision}`,i=o[n]||o[e.assetId]||o[e.assetId||n];i&&r.push({manifestRef:yk(e,t),manifest:xk(i)})}))}return r}onDispose(){M(_k,this)&&M(_k,this).abort(),C(_k,this,null),C(wk,this,null)}}function Ek(e){return e&&e.signal?e.signal:M(_k,this)?M(_k,this).signal:void 0}function Sk(e){const t="number"==typeof(null==e?void 0:e.assetRevision)&&Number.isFinite(e.assetRevision)&&e.assetRevision>=0;return e&&"assets-delivery-service"===e.type&&"string"==typeof e.assetId&&t}function Ak(e,t){const n=Number.isFinite(t)&&t>0?t:e.length,i=[];for(let t=0;t<e.length;t+=n)i.push(e.slice(t,t+n));return i}function Nk(e){if(!Array.isArray(e)||!e.length)return[];const t=[];e.forEach((e=>{const n=t[t.length-1];n&&n.route===e.route?n.refs.push(e):t.push({route:e.route,refs:[e]})}));const n=[];return t.forEach((e=>{A(Tk,this,Ak).call(this,e.refs,this.settings.maxBatchSize).forEach((t=>{n.push({route:e.route,refs:t})}))})),n}function Mk(e,t="ivd"){const n=e.map((({ref:e,profile:t})=>function(e,t){const n=`${e.assetId}:${e.assetRevision}`;return t?`${n}:${t}`:n}(e,t))),i=new URLSearchParams({assets:n.join(","),type:"data"});return{url:`${(this.settings.assetsDeliveryServiceUrl||"").replace(/\/$/,"")}/${"dash"===t?"dash":"ivd"}?${i.toString()}`}}async function Fk(e,t){return M(wk,this)?M(wk,this).call(this,e,t):await by(e,{returnType:"json",method:(null==t?void 0:t.method)||"GET",signal:null==t?void 0:t.signal})}function Ck({prioritizer:e,repository:t,startNodeId:n,prioritizedIds:i,pendingIds:r,allowedIds:o,filter:s,fallbackToRepository:a=!0}={}){const l=Array.isArray(i)?i:e&&"function"==typeof e.sortNodes?e.sortNodes(n):[],c=a?(f=t)&&"function"==typeof f.list?f.list().map((e=>null==e?void 0:e.id)).filter(Boolean):[]:[],u=l.length?l:c,d=r?new Set(r):null,h=o?new Set(o):null;var f;return u.filter((e=>{if(!e)return!1;if(d&&d.has(e))return!1;if(h&&!h.has(e))return!1;const n=function(e,t){if(e&&"function"==typeof e.get)return e.get(t)}(t,e);return!(!n||"function"==typeof s&&!s(n,e))}))}const Ok=(ad.requestAnimationFrame||ad.mozRequestAnimationFrame||ad.webkitRequestAnimationFrame||ad.msRequestAnimationFrame||(e=>ad.setTimeout(e,1e3/60))).bind(ad),Pk=(ad.cancelAnimationFrame||ad.mozCancelAnimationFrame||ad.webkitCancelAnimationFrame||ad.msCancelAnimationFrame||(e=>ad.clearTimeout(e))).bind(ad),Rk=Qu("ticker","warn");let Dk,Lk=[],Bk=null,zk=sy();function Wk(){zk=sy();const e=[];let t,n;for(n=Lk.length-1;n>=0;--n)t=Lk[n],zk>=t.lastTick+t.interval&&e.push(t);for(n=e.length-1;n>=0;--n)if(t=e[n],!t.stopped){t.lastTick=zk;try{t.callback()}catch(e){console&&"function"==typeof console.error?console.error(e):Rk.error(e)}}Dk=Ok(Wk)}function $k(){sy()-zk>=200&&(Pk(Dk),Wk())}function Uk(e){let t=-1;for(let n=0;n<Lk.length;n+=1)if(Lk[n].callback===e){t=n;break}return t}function jk(e,t=0){if(!e||"function"!=typeof e||"number"!=typeof t||t<0)return void Rk.error("[start] Invalid arguments given to start method.",arguments);const n=Uk(e);return-1!==n?(Rk.debug("[start] Callback already exists, overriding interval.",arguments),Lk[n].interval=t,e):(Lk.push({callback:e,interval:t,lastTick:sy()}),1===Lk.length&&(Dk=Ok(Wk),Bk||(Bk=ad.setInterval($k,1e3))),e)}function qk(e){const t=Uk(e);-1!==t?(Lk[t].stopped=!0,Lk.splice(t,1),Lk.length||(Pk(Dk),ad.clearInterval(Bk),Bk=null)):Rk.debug("[stop] Callback not found, doing nothing.",arguments)}function Vk(e){return-1!==Uk(e)}function Gk(e,t,n){const i="number"==typeof n?n:(null==n?void 0:n.maxQueueSize)||Number.POSITIVE_INFINITY,r=null!=n&&n.immediatelyFlushFirst?"boolean"==typeof n.immediatelyFlushFirst?n.immediatelyFlushFirst?1:0:Number(n.immediatelyFlushFirst):0;let o=0;if("function"!=typeof e)return void Rk.error("[createThrottler] Bad argument given to createThrottler, first argument must be a function.",arguments);Rk.debug("[createThrottler] Creating a new throttler instance.",arguments);const s=[];function a(){Rk.debug("[onThrottlerTick] Calling callback with "+s.length+" queued items.");const t=s.slice(0);s.length=0,qk(a),e(t)}const l={push:function(e){Rk.debug("[push] Queuing argument:",e),0===s.length&&jk(a,t),s.push(e),o+=1,(o<=r||s.length>=i)&&a()},flush:function(){Rk.debug("[flush] Flushing queue."),0!==s.length&&a()},dispose:function(){Rk.debug("[dispose] Disposing of throttler.");const e=s.slice(0);return s.length=0,qk(a),e}};return Object.defineProperty(l,"interval",{enumerable:!0,get:function(){return t},set:function(e){"number"==typeof e&&(t=e)}}),l}function Hk(e,t){if(e&&"function"==typeof e)return e.__tickerThrottler||(e.__tickerThrottler=Gk((function(){e()}),t)),"number"==typeof t&&(e.__tickerThrottler.interval=t),e.__tickerThrottler.push(),e.__tickerThrottler;Rk.error("[scheduleExecution] Bad argument given to scheduleExecution, first argument must be a function.",arguments)}var Kk=new WeakMap,Xk=new WeakMap,Yk=new WeakMap,Qk=new WeakMap,Jk=new WeakMap,Zk=new WeakMap,ex=new WeakMap,tx=new WeakMap,nx=new WeakMap,ix=new WeakMap,rx=new WeakMap,ox=new WeakMap,sx=new WeakMap,ax=new WeakMap,lx=new WeakMap,cx=new WeakMap,ux=new WeakSet;class dx extends rd{constructor(...e){super(...e),O(this,ux),F(this,Kk,void 0),F(this,Xk,void 0),F(this,Yk,void 0),F(this,Qk,void 0),F(this,Jk,[]),F(this,Zk,[]),F(this,ex,new Set),F(this,tx,new Set),F(this,nx,!1),F(this,ix,void 0),F(this,rx,void 0),F(this,ox,void 0),F(this,sx,void 0),F(this,ax,void 0),F(this,lx,void 0),F(this,cx,void 0);const[t,n,i,r]=e;C(Kk,this,t),C(Xk,this,n),C(Yk,this,i),C(Qk,this,r),C(ix,this,ay());const o=e.length?e[e.length-1]:void 0,s=o&&"object"==typeof o&&Number.isFinite(o.maxConcurrent)?o.maxConcurrent:void 0;Number.isFinite(s)&&(this.settings.maxConcurrent=s),C(cx,this,(()=>A(ux,this,wx).call(this))),A(ux,this,mx).call(this),A(ux,this,px).call(this)}get name(){return"NodeResolver"}get defaults(){return{maxConcurrent:5}}onDispose(){var e;M(ix,this)&&M(ix,this).abort(),C(ix,this,null),M(Qk,this)&&"function"==typeof M(Qk,this).off&&M(ox,this)&&M(Qk,this).off(rv.PLACEMENT_ADDED,M(ox,this)),M(Qk,this)&&"function"==typeof M(Qk,this).off&&M(lx,this)&&M(Qk,this).off(rv.TIMELINE_RESET,M(lx,this)),M(Kk,this)&&"function"==typeof M(Kk,this).off&&M(sx,this)&&M(Kk,this).off(rv.NODE_ADD,M(sx,this)),M(Kk,this)&&"function"==typeof M(Kk,this).off&&M(ax,this)&&M(Kk,this).off(rv.NODE_CHILDREN_CHANGED,M(ax,this)),C(ox,this,null),C(sx,this,null),C(ax,this,null),C(lx,this,null),C(Jk,this,[]),C(Zk,this,[]),M(ex,this).clear(),M(tx,this).clear(),C(nx,this,!1),C(rx,this,void 0),null!==(e=M(cx,this))&&void 0!==e&&e.__tickerThrottler&&M(cx,this).__tickerThrottler.dispose(),C(cx,this,null)}}function hx(){return M(ix,this)?M(ix,this).signal:void 0}function fx(){return this._disposed||M(ix,this)&&M(ix,this).signal.aborted}function px(){M(Qk,this)&&"function"==typeof M(Qk,this).on&&(C(ox,this,(e=>{A(ux,this,gx).call(this,null==e?void 0:e.nodeId)})),M(Qk,this).on(rv.PLACEMENT_ADDED,M(ox,this)),C(lx,this,(()=>A(ux,this,vx).call(this))),M(Qk,this).on(rv.TIMELINE_RESET,M(lx,this))),M(Kk,this)&&"function"==typeof M(Kk,this).on&&(C(sx,this,(({node:e})=>{(null==e?void 0:e.id)&&A(ux,this,gx).call(this,e.id,{fromRepoAdd:!0})})),M(Kk,this).on(rv.NODE_ADD,M(sx,this)),C(ax,this,(()=>{Hk(M(cx,this),100)})),M(Kk,this).on(rv.NODE_CHILDREN_CHANGED,M(ax,this)))}function mx(){const e=M(Qk,this)&&Array.isArray(M(Qk,this).placements)?M(Qk,this).placements:[];e.forEach((e=>A(ux,this,gx).call(this,e.nodeId)));const t=e.length?e[e.length-1]:void 0;t&&t.nodeId&&C(rx,this,t.nodeId)}function vx(){M(ix,this)&&M(ix,this).abort(),C(ix,this,ay()),C(Jk,this,[]),C(Zk,this,[]),M(ex,this).clear(),C(nx,this,!1),C(rx,this,void 0)}function gx(e,{fromRepoAdd:t=!1}={}){A(ux,this,fx).call(this)||e&&(M(tx,this).has(e)||M(ex,this).has(e)||(M(Jk,this).push(e),M(rx,this)||t||C(rx,this,e),!M(nx,this)&&t||A(ux,this,yx).call(this)))}function yx(){if(M(nx,this))return void A(ux,this,bx).call(this);if(0===M(Jk,this).length)return;C(nx,this,!0);const e=M(Jk,this).shift();A(ux,this,_x).call(this,e).finally((()=>{A(ux,this,bx).call(this)}))}async function bx(){if(!A(ux,this,fx).call(this))for(M(Jk,this).length||M(Zk,this).length||C(Zk,this,A(ux,this,kx).call(this));M(ex,this).size<this.settings.maxConcurrent;){const e=this.settings.maxConcurrent-M(ex,this).size;if(e<=0)break;const t=[];for(;t.length<e&&(M(Jk,this).length||M(Zk,this).length);){let e=M(Jk,this).shift();e||(e=M(Zk,this).shift()),e&&t.push(e)}if(!t.length)break;const n=A(ux,this,Tx).call(this,t);n.length&&M(Yk,this)&&"function"==typeof M(Yk,this).resolve&&A(ux,this,Ix).call(this,n).finally((()=>A(ux,this,bx).call(this))),t.filter((e=>!n.find((t=>t.nodeId===e)))).forEach((e=>{A(ux,this,_x).call(this,e).finally((()=>A(ux,this,bx).call(this)))}))}}function kx(){const e=new Set([...M(tx,this),...M(ex,this),...M(Jk,this)]);return A(ux,this,xx).call(this,e)}function xx(e){const t=M(Qk,this)&&Array.isArray(M(Qk,this).placements)?M(Qk,this).placements:[],n=(t.length?t[t.length-1].nodeId:void 0)||M(rx,this);return Ck({prioritizer:M(Xk,this),repository:M(Kk,this),startNodeId:n,pendingIds:e,fallbackToRepository:!1})}function wx(){A(ux,this,fx).call(this)||(M(nx,this)||0!==M(Jk,this).length)&&(C(Zk,this,A(ux,this,kx).call(this)),M(nx,this)&&A(ux,this,bx).call(this))}async function _x(e,t){if(!e||M(tx,this).has(e)||M(ex,this).has(e))return;const n=A(ux,this,hx).call(this);if(n&&n.aborted)return;const i=M(Kk,this)&&"function"==typeof M(Kk,this).get?M(Kk,this).get(e):void 0;if(i&&"function"==typeof i.resolve)if("function"==typeof i.hasExceededManifestLoadAttempts&&i.hasExceededManifestLoadAttempts())M(tx,this).add(e);else{M(ex,this).add(e);try{const r={signal:n};t&&(r.manifestOverride=t),await i.resolve(r),M(tx,this).add(e)}catch(t){if(cy(t,n))return;this.log.warn(`NodeResolver failed to resolve node ${e}: ${(null==t?void 0:t.message)||t}`),"function"==typeof i.hasExceededManifestLoadAttempts&&i.hasExceededManifestLoadAttempts()&&M(tx,this).add(e)}finally{M(ex,this).delete(e)}}}function Tx(e){const t=[];return e.forEach((e=>{const n=M(Kk,this)&&"function"==typeof M(Kk,this).get?M(Kk,this).get(e):void 0;n&&n.manifestRef&&"assets-delivery-service"===n.manifestRef.type&&t.push({nodeId:e,ref:n.manifestRef})})),t}async function Ix(e){const t=A(ux,this,hx).call(this);if(!t||!t.aborted){e.forEach((({nodeId:e})=>M(ex,this).add(e)));try{const n=e.map((e=>e.ref)),i=await M(Yk,this).resolve(n,{signal:t});e.forEach((({nodeId:e,ref:t})=>{var n;const r=M(Kk,this)&&"function"==typeof M(Kk,this).get?M(Kk,this).get(e):void 0;if(M(ex,this).delete(e),!r||"function"!=typeof r.resolve)return;const o=Array.isArray(i)?i.find((e=>{const n=null==e?void 0:e.manifestRef;return n&&n.assetId===t.assetId&&n.assetRevision===t.assetRevision})):void 0,s="string"==typeof(null==o||null===(n=o.manifestRef)||void 0===n?void 0:n.encodeProfile)&&o.manifestRef.encodeProfile?o.manifestRef.encodeProfile:void 0,a=o?A(ux,this,Ex).call(this,o.manifest,s):void 0;A(ux,this,_x).call(this,e,a)}))}catch(n){cy(n,t)||this.log.warn(`NodeResolver ADS batch failed: ${(null==n?void 0:n.message)||n}`),e.forEach((({nodeId:e})=>M(ex,this).delete(e)))}}}function Ex(e,t){if(!e)return;const n="string"==typeof t&&t?t:void 0,i=e=>n&&e&&"object"==typeof e?{...e,encodeProfile:n}:e;return e.ivd?i({typeHint:"ivd",body:e.ivd}):e.url||e.body||e.mimeType?i({typeHint:e.typeHint,url:e.url,mimeType:e.mimeType,body:e.body}):i(e)}const Sx=.001,Ax="priority";function Nx(e){const t=Number(e);return Number.isFinite(t)?t:0}var Mx=new WeakMap,Fx=new WeakMap,Cx=new WeakMap,Ox=new WeakMap,Px=new WeakMap,Rx=new WeakMap,Dx=new WeakMap,Lx=new WeakMap,Bx=new WeakMap,zx=new WeakMap,Wx=new WeakMap,$x=new WeakMap,Ux=new WeakMap,jx=new WeakMap,qx=new WeakMap,Vx=new WeakMap,Gx=new WeakMap,Hx=new WeakMap,Kx=new WeakMap,Xx=new WeakSet;class Yx extends rd{constructor(...e){super(...e),O(this,Xx),F(this,Mx,void 0),F(this,Fx,void 0),F(this,Cx,void 0),F(this,Ox,new Map),F(this,Px,new Map),F(this,Rx,[]),F(this,Dx,new Set),F(this,Lx,new Map),F(this,Bx,!1),F(this,zx,void 0),F(this,Wx,void 0),F(this,$x,void 0),F(this,Ux,void 0),F(this,jx,void 0),F(this,qx,void 0),F(this,Vx,void 0),F(this,Gx,!1),F(this,Hx,[]),F(this,Kx,void 0);const[t,n,i]=e;C(Mx,this,t),C(Fx,this,n),C(Cx,this,i),C(Wx,this,ay()),C(Kx,this,(()=>A(Xx,this,Ew).call(this))),A(Xx,this,aw).call(this)}get name(){return"SegmentLoadCoordinator"}get defaults(){return{maxConcurrentLoads:3,maxSegmentLoadAttempts:3}}onDispose(){var e;M(Wx,this)&&M(Wx,this).abort(),C(Wx,this,null),M(Lx,this).size&&M(Lx,this).forEach((e=>{(null==e?void 0:e.controller)&&e.controller.abort()})),M(Lx,this).clear(),M(Cx,this)&&"function"==typeof M(Cx,this).off&&(M($x,this)&&M(Cx,this).off(rv.PLACEMENT_ADDED,M($x,this)),M(jx,this)&&M(Cx,this).off(rv.TIMELINE_SEEKING,M(jx,this)),M(qx,this)&&M(Cx,this).off(rv.TIMELINE_SEEKED,M(qx,this)),M(Vx,this)&&M(Cx,this).off(rv.TIMELINE_RESET,M(Vx,this))),M(Mx,this)&&"function"==typeof M(Mx,this).off&&M(Ux,this)&&M(Mx,this).off(rv.NODE_CHILDREN_CHANGED,M(Ux,this)),C($x,this,null),C(Ux,this,null),C(jx,this,null),C(qx,this,null),C(Vx,this,null),M(Ox,this).clear(),M(Px,this).clear(),C(Rx,this,[]),M(Dx,this).clear(),M(Lx,this).clear(),C(Bx,this,!1),C(zx,this,void 0),C(Gx,this,!1),C(Hx,this,[]),null!==(e=M(Kx,this))&&void 0!==e&&e.__tickerThrottler&&M(Kx,this).__tickerThrottler.dispose(),C(Kx,this,null)}}function Qx(){return M(Wx,this)?M(Wx,this).signal:void 0}function Jx(){return this._disposed||M(Wx,this)&&M(Wx,this).signal.aborted}function Zx(){const e=Number(this.settings.maxSegmentLoadAttempts);return Number.isFinite(e)&&e>0?e:1/0}function ew(e){const t=A(Xx,this,Zx).call(this);if(!Number.isFinite(t)||t===1/0)return!1;if(null==e||!e.loadError)return!1;const n=Number(e.loadAttempts);return Number.isFinite(n)&&n>=t}function tw(e){if(!e)return!1;if(A(Xx,this,ew).call(this,e))return!0;if("boolean"==typeof e.isLoaded)return e.isLoaded;const t=Number(e.retainedByteLength);return Number.isFinite(t)&&t>0}function nw(e,{allowSeekKeep:t=!1,segmentOffset:n}={}){const i=ay(),r=i?i.signal:A(Xx,this,Qx).call(this);return e&&M(Lx,this).set(e,{controller:i,allowSeekKeep:!!t,segmentOffset:n}),{signal:r,controller:i}}function iw(e,t,n={}){const i=M(Lx,this).get(e);i&&i.controller===t&&(Object.prototype.hasOwnProperty.call(n,"allowSeekKeep")&&(i.allowSeekKeep=!!n.allowSeekKeep),Object.prototype.hasOwnProperty.call(n,"segmentOffset")&&(i.segmentOffset=n.segmentOffset))}function rw(e,t){const n=M(Lx,this).get(e);n&&(t&&n.controller!==t||M(Lx,this).delete(e))}function ow(e,t){const n=new Set;return(Array.isArray(e)?e:[]).forEach((e=>{const i=null==e?void 0:e.nodeId;if(!i)return;const r=M(Mx,this)&&"function"==typeof M(Mx,this).get?M(Mx,this).get(i):void 0;if(!r)return;const o=A(Xx,this,vw).call(this,r,e,t);Number.isFinite(o)&&n.add(`${i}:${o}`)})),n}function sw(e){M(Lx,this).size&&M(Lx,this).forEach(((t,n)=>{const i=null==t?void 0:t.segmentOffset,r=Number.isFinite(i)?`${n}:${i}`:"";!(null!=t&&t.allowSeekKeep&&r&&e&&e.has(r))&&(null==t?void 0:t.controller)&&t.controller.abort()}))}function aw(){M(Cx,this)&&"function"==typeof M(Cx,this).on&&(C($x,this,(e=>{A(Xx,this,dw).call(this,e)})),M(Cx,this).on(rv.PLACEMENT_ADDED,M($x,this)),C(jx,this,(e=>A(Xx,this,lw).call(this,e))),M(Cx,this).on(rv.TIMELINE_SEEKING,M(jx,this)),C(qx,this,(e=>A(Xx,this,cw).call(this,e))),M(Cx,this).on(rv.TIMELINE_SEEKED,M(qx,this)),C(Vx,this,(()=>A(Xx,this,uw).call(this))),M(Cx,this).on(rv.TIMELINE_RESET,M(Vx,this))),M(Mx,this)&&"function"==typeof M(Mx,this).on&&(C(Ux,this,(()=>{Hk(M(Kx,this),100)})),M(Mx,this).on(rv.NODE_CHILDREN_CHANGED,M(Ux,this)))}function lw(e={}){if(A(Xx,this,Jx).call(this))return;const t=Number(null==e?void 0:e.targetTime);if(!Number.isFinite(t))return;const n=Array.isArray(null==e?void 0:e.placements)?e.placements:[],i=A(Xx,this,ow).call(this,n,t);A(Xx,this,sw).call(this,i),C(Gx,this,!0),C(Hx,this,n.map((e=>{const n=null==e?void 0:e.nodeId;if(n)return{nodeId:n,placement:e,targetTime:t}})).filter(Boolean)),setTimeout((()=>A(Xx,this,fw).call(this)),0)}function cw(e={}){var t,n;if(A(Xx,this,Jx).call(this))return;C(Gx,this,!1),C(Hx,this,[]);const i=Number.isFinite(null==e?void 0:e.targetTime)?Number(e.targetTime):Number(null===(t=M(Cx,this))||void 0===t?void 0:t.currentTime);(Array.isArray(null===(n=M(Cx,this))||void 0===n?void 0:n.placements)?M(Cx,this).placements:[]).forEach((e=>{if(!e)return;const t=am(e);if(Number.isFinite(t)){if(Number.isFinite(i)){if(t>=i)return void A(Xx,this,dw).call(this,e);const n=om(e,M(Mx,this));return Number.isFinite(n)?void(t+n>i&&A(Xx,this,dw).call(this,e)):void(t<=i&&A(Xx,this,dw).call(this,e))}A(Xx,this,dw).call(this,e)}})),setTimeout((()=>A(Xx,this,fw).call(this)),0)}function uw(){M(Wx,this)&&M(Wx,this).abort(),C(Wx,this,ay()),M(Lx,this).size&&M(Lx,this).forEach((e=>{(null==e?void 0:e.controller)&&e.controller.abort()})),M(Lx,this).clear(),M(Ox,this).clear(),M(Px,this).clear(),C(Rx,this,[]),M(Dx,this).clear(),C(Bx,this,!1),C(zx,this,void 0),C(Gx,this,!1),C(Hx,this,[])}function dw(e){if(A(Xx,this,Jx).call(this))return;const t=null==e?void 0:e.nodeId;if(!t)return;const n=M(Ox,this).get(t);if(n){const i=am(n),r=am(e);Number.isFinite(i)?Number.isFinite(r)&&r<i&&M(Ox,this).set(t,e):Number.isFinite(r)&&M(Ox,this).set(t,e)}else M(Ox,this).set(t,e);const i=M(zx,this);C(zx,this,t),i&&i!==t&&C(Rx,this,[]),M(Bx,this)?setTimeout((()=>A(Xx,this,fw).call(this)),0):A(Xx,this,hw).call(this)}function hw(){M(Bx,this)||M(Ox,this).size&&(C(Bx,this,!0),A(Xx,this,fw).call(this))}async function fw(){if(A(Xx,this,Jx).call(this))return;if(M(Dx,this).size>=this.settings.maxConcurrentLoads)return;if(M(Gx,this))return void(M(Hx,this).length&&A(Xx,this,pw).call(this));const e=A(Xx,this,bw).call(this);if(e.hasPending)A(Xx,this,kw).call(this,e);else for(M(Rx,this).length||C(Rx,this,A(Xx,this,Tw).call(this));M(Dx,this).size<this.settings.maxConcurrentLoads&&M(Rx,this).length;){const e=M(Rx,this).shift();A(Xx,this,Sw).call(this,e,"partial").finally((()=>{setTimeout((()=>A(Xx,this,fw).call(this)),0)}))}}function pw(){if(A(Xx,this,Jx).call(this))return;const e=Math.max(0,this.settings.maxConcurrentLoads-M(Dx,this).size);if(!e||!M(Hx,this).length)return;const t=[],n=[];for(let i=0;i<M(Hx,this).length;i+=1){const r=M(Hx,this)[i];(null==r?void 0:r.nodeId)&&(t.length<e&&!M(Dx,this).has(r.nodeId)?t.push(r):n.push(r))}C(Hx,this,n),t.forEach((e=>{A(Xx,this,mw).call(this,e).finally((()=>{setTimeout((()=>A(Xx,this,fw).call(this)),0)}))}))}async function mw(e={}){const t=null==e?void 0:e.nodeId,n=null==e?void 0:e.placement,i=Number(null==e?void 0:e.targetTime);if(!t||!n||!Number.isFinite(i))return;if(M(Dx,this).has(t))return;const{signal:r,controller:o}=A(Xx,this,nw).call(this,t);if(r&&r.aborted)A(Xx,this,rw).call(this,t,o);else{M(Dx,this).add(t);try{const e=M(Mx,this)&&"function"==typeof M(Mx,this).get?M(Mx,this).get(t):void 0;if(!e)return;if("ready"!==e.state&&"function"==typeof e.resolve)try{await e.resolve({signal:r})}catch(e){return}if("ready"!==e.state)return;const s=A(Xx,this,vw).call(this,e,n,i);if(!Number.isFinite(s)){const n=Array.isArray(null==e?void 0:e.tracks)?e.tracks.map((e=>null==e?void 0:e.type)).filter(Boolean):[];return void this.log.debug(`[#loadSeekWork] No seek segment offset for node [${t}] targetTime=${i} mainTrackId=${(null==e?void 0:e.mainTrackId)||"n/a"} trackTypes=[${n.join(",")}]`)}"function"==typeof e.loadMediaSegmentsAtOffset?(this.log.debug(`[#loadSeekWork] Loading seek segment for node [${t}] at offset=${s}`),A(Xx,this,iw).call(this,t,o,{allowSeekKeep:!0,segmentOffset:s}),await e.loadMediaSegmentsAtOffset(s,{signal:r})):"function"==typeof e.load&&await e.load({loadingMode:"partial",signal:r})}catch(e){cy(e,r)||this.log.warn(`[#loadSeekWork] SegmentLoadCoordinator failed to seek-load node ${t}: ${(null==e?void 0:e.message)||e}`)}finally{M(Dx,this).delete(t),A(Xx,this,rw).call(this,t,o)}}}function vw(e,t,n){var i;const r=am(t);if(!Number.isFinite(r))return;const o=Nx(null==t?void 0:t.nodeOffsetOverride),s=Math.max(0,n-r+o),a=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[];let l;if(null!=e&&e.mainTrackId){const t=a.find((t=>(null==t?void 0:t.id)===e.mainTrackId));"video"!==(null==t?void 0:t.type)&&"image"!==(null==t?void 0:t.type)||(l=t)}if(l||(l=a.find((e=>"video"===(null==e?void 0:e.type)))||a.find((e=>"image"===(null==e?void 0:e.type)))),!l||!Array.isArray(l.segments))return;const c=l.segments.filter((e=>e&&!e.isInit&&Array.isArray(e.representations)));if(!c.length)return;const u=Nx(null===(i=l)||void 0===i?void 0:i.offset),d=qy(c,Math.max(0,s-u),{preferRepresentationTime:!0}),h=Number(null==d?void 0:d.offset);return Number.isFinite(h)?h:void 0}function gw(e,t,n=(e=>null===(e=M(Cx,this))||void 0===e?void 0:e.currentTime)()){var i;const r=(Array.isArray(null===(i=M(Cx,this))||void 0===i?void 0:i.placements)?M(Cx,this).placements:[]).filter((t=>(null==t?void 0:t.nodeId)===e&&Number.isFinite(am(t)))).sort(((e,t)=>am(e)-am(t)));if(!r.length)return t;const o=Number(n);if(!Number.isFinite(o))return t||r[0];let s,a;for(let e=0;e<r.length;e+=1){const t=r[e],n=am(t);if(!Number.isFinite(n))continue;const i=om(t,M(Mx,this)),l=Number.isFinite(i)&&i>=0;(!a&&n>=o-Sx&&(a=t),l)?o+Sx>=n&&o<n+i-Sx&&(s=t):o+Sx>=n&&(s=t)}return s||a||r[r.length-1]}function yw(e,t){var n;const i=Number(am(t));if(!Number.isFinite(i))return;const r=om(t,M(Mx,this)),o=Number.isFinite(r)&&r>=0?i+r:void 0,s=(Array.isArray(null===(n=M(Cx,this))||void 0===n?void 0:n.placements)?M(Cx,this).placements:[]).filter((t=>(null==t?void 0:t.nodeId)===e&&Number.isFinite(am(t)))).sort(((e,t)=>am(e)-am(t)));for(let e=0;e<s.length;e+=1){const t=s[e],n=Number(am(t));if(Number.isFinite(n)&&!(n<=i+Sx)){if(Number.isFinite(o)&&n>o+Sx)return;return t}}}function bw(){const e=[];let t=!1,n=1/0;if(M(Ox,this).forEach(((i,r)=>{if(!r||!i)return;const o=M(Px,this).get(r);if(o)return t=!0,void(n=Math.min(n,Nx(o.timelineStart)));const s=A(Xx,this,xw).call(this,r,i);s&&(t=!0,n=Math.min(n,Nx(s.timelineStart)),e.push(s))})),!t||!Number.isFinite(n))return{hasPending:!1,waveTime:void 0,startable:[]};const i=e.filter((e=>Nx(e.timelineStart)===n&&!M(Dx,this).has(e.nodeId))).sort(((e,t)=>{const n=Number.isFinite(null==e?void 0:e.timelineStart)?e.timelineStart:Number.POSITIVE_INFINITY,i=Number.isFinite(null==t?void 0:t.timelineStart)?t.timelineStart:Number.POSITIVE_INFINITY;return n!==i?n-i:String(e.nodeId).localeCompare(String(t.nodeId))}));return{hasPending:!0,waveTime:n,startable:i}}function kw({waveTime:e,startable:t}){const n=Math.max(0,this.settings.maxConcurrentLoads-M(Dx,this).size);n&&t.length&&t.slice(0,n).forEach((t=>{A(Xx,this,_w).call(this,t,e).finally((()=>{setTimeout((()=>A(Xx,this,fw).call(this)),0)}))}))}function xw(e,t){var n,i;const r=M(Mx,this)&&"function"==typeof M(Mx,this).get?M(Mx,this).get(e):void 0;if(!r)return;if("function"==typeof r.hasExceededManifestLoadAttempts&&r.hasExceededManifestLoadAttempts())return void M(Ox,this).delete(e);const o=A(Xx,this,gw).call(this,e,t,null===(n=M(Cx,this))||void 0===n?void 0:n.currentTime),s=Number(am(o)),a=Nx(null===(i=M(Cx,this))||void 0===i?void 0:i.currentTime),l="function"==typeof r.loadMediaSegmentsAtOffset,c="function"==typeof r.load;if(!l&&!c)return void M(Ox,this).delete(e);if(r.isLoaded)return void M(Ox,this).delete(e);if("ready"!==r.state){if(!Number.isFinite(s))return;return{nodeId:e,segmentOffset:0,timelineStart:s}}if(!A(Xx,this,Aw).call(this,r))return void M(Ox,this).delete(e);const u=Array.isArray(r.tracks)?r.tracks:[],d=u.some((e=>{const t=(Array.isArray(null==e?void 0:e.segments)?e.segments:[]).find((e=>(null==e?void 0:e.isInit)&&Array.isArray(null==e?void 0:e.representations)));return!!t&&!A(Xx,this,tw).call(this,t)})),h=new Set;u.forEach((e=>{(Array.isArray(null==e?void 0:e.segments)?e.segments:[]).forEach((e=>{if(!e||e.isInit||!Array.isArray(e.representations))return;const t=Number(e.offset);if(Number.isFinite(t)){const e=Math.round(t/Sx)*Sx;h.add(e)}}))}));const f=Array.from(h).sort(((e,t)=>e-t)),p=t=>{const n=Number(am(t));if(!Number.isFinite(n))return{status:"none"};const i=Nx(null==t?void 0:t.nodeOffsetOverride),o=Math.max(0,a-n+i);let s=0;for(let e=0;e<f.length&&f[e]<=o+Sx;e+=1)s=e;const l=f.slice(s);if(!l.some((e=>A(Xx,this,ww).call(this,r,e))))return{status:f.slice(0,s).some((e=>A(Xx,this,ww).call(this,r,e)))?"beforeOnly":"none"};const c=l.find((e=>A(Xx,this,ww).call(this,r,e))),u=Math.max(0,Nx(c)-i);return{status:"work",work:{nodeId:e,segmentOffset:c,timelineStart:n+u}}},m=p(o);if("work"===m.status)return m.work;if("beforeOnly"!==m.status){if(d&&Number.isFinite(s))return{nodeId:e,segmentOffset:0,timelineStart:s};M(Ox,this).delete(e)}else{const t=A(Xx,this,yw).call(this,e,o);if(t){const e=p(t);if("work"===e.status)return e.work}}}function ww(e,t){const n=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[],i=Nx(t);return n.some((e=>(Array.isArray(null==e?void 0:e.segments)?e.segments:[]).some((e=>{if(!e||e.isInit||!Array.isArray(e.representations))return!1;const t=Number(e.offset);return Number.isFinite(t)&&Math.abs(t-i)<=Sx&&!A(Xx,this,tw).call(this,e)}))))}async function _w(e,t){const n=null==e?void 0:e.nodeId,i=null==e?void 0:e.segmentOffset;if(this.log.debug(`[#loadP0Work] Loading ${Ax} node [${n}] at segmentOffset=${i} wave=${t}`),!n)return;const r=M(Mx,this)&&"function"==typeof M(Mx,this).get?M(Mx,this).get(n):void 0;if(!r)return void M(Ox,this).delete(n);const o="function"==typeof r.loadMediaSegmentsAtOffset&&Number.isFinite(i),{signal:s,controller:a}=A(Xx,this,nw).call(this,n,{allowSeekKeep:o,segmentOffset:i});if(s&&s.aborted)A(Xx,this,rw).call(this,n,a);else{M(Dx,this).add(n),M(Px,this).set(n,{timelineStart:t,segmentOffset:i});try{"function"==typeof r.loadMediaSegmentsAtOffset?await r.loadMediaSegmentsAtOffset(i,{signal:s}):"function"==typeof r.load&&await r.load({loadingMode:"full",signal:s})}catch(e){if(cy(e,s))return;const t=`[#loadP0Work] SegmentLoadCoordinator failed to load ${Ax} work for node ${n}: ${(null==e?void 0:e.message)||e}`;this.log.warn(t)}finally{this.log.debug(`[#loadP0Work] Finished ${Ax} work for node [${n}]`),M(Px,this).delete(n),M(Dx,this).delete(n),A(Xx,this,rw).call(this,n,a)}}}function Tw(){const e=new Set([...M(Ox,this).keys(),...M(Dx,this)]),t=A(Xx,this,Iw).call(this),n=Array.isArray(null==t?void 0:t.orderedIds)?t.orderedIds:null,i=Array.isArray(null==t?void 0:t.reachableIds)&&t.reachableIds.length?new Set(t.reachableIds):null,r=e=>!("function"==typeof e.hasExceededManifestLoadAttempts&&e.hasExceededManifestLoadAttempts()||e.isLoaded||"ready"===e.state&&A(Xx,this,Nw).call(this,e));if(i){const t=Ck({prioritizer:M(Fx,this),repository:M(Mx,this),startNodeId:M(zx,this),prioritizedIds:n,pendingIds:e,allowedIds:i,filter:r});if(t.length)return t}return Ck({prioritizer:M(Fx,this),repository:M(Mx,this),startNodeId:M(zx,this),prioritizedIds:n,pendingIds:e,filter:r})}function Iw(){return M(Fx,this)&&M(zx,this)?"function"==typeof M(Fx,this).getPrioritizationSnapshot?M(Fx,this).getPrioritizationSnapshot(M(zx,this)):{orderedIds:"function"==typeof M(Fx,this).sortNodes?M(Fx,this).sortNodes(M(zx,this)):[],reachableIds:"function"==typeof M(Fx,this).getReachableNodeIds?M(Fx,this).getReachableNodeIds(M(zx,this)):[]}:null}function Ew(){A(Xx,this,Jx).call(this)||(M(Bx,this)||M(Ox,this).size)&&(C(Rx,this,A(Xx,this,Tw).call(this)),M(Bx,this)&&!M(Gx,this)&&A(Xx,this,fw).call(this))}async function Sw(e,t){if(this.log.debug(`[#loadNode] Loading node [${e}] in '${t}' mode`),!e)return;const n=M(Mx,this)&&"function"==typeof M(Mx,this).get?M(Mx,this).get(e):void 0;if(!n||"function"!=typeof n.load)return;if("function"==typeof n.hasExceededManifestLoadAttempts&&n.hasExceededManifestLoadAttempts())return;if(n.isLoaded)return void this.log.debug(`[#loadNode] Skipping load for ${e}: already loaded`);const{signal:i,controller:r}=A(Xx,this,nw).call(this,e,{allowSeekKeep:!1});if(i&&i.aborted)A(Xx,this,rw).call(this,e,r);else try{if("ready"!==n.state&&await n.resolve({signal:i}),"ready"!==n.state)return void this.log.debug(`[#loadNode] Skipping load for ${e}: not ready`);if("partial"===t&&A(Xx,this,Nw).call(this,n))return void this.log.debug(`[#loadNode] Skipping load for ${e}: partial already loaded`);if(!A(Xx,this,Aw).call(this,n))return void this.log.debug(`[#loadNode] Skipping load for ${e}: no loadable tracks`);M(Dx,this).add(e),await n.load({loadingMode:t,signal:i})}catch(t){if(cy(t,i))return;this.log.warn(`[#loadNode] SegmentLoadCoordinator failed to load node ${e}: ${(null==t?void 0:t.message)||t}`)}finally{this.log.debug(`[#loadNode] Finished loading node [${e}]`),M(Dx,this).delete(e),A(Xx,this,rw).call(this,e,r)}}function Aw(e){return(Array.isArray(e.tracks)?e.tracks:[]).some((e=>{var t;return null==e||null===(t=e.segments)||void 0===t?void 0:t.length}))}function Nw(e){const t=(Array.isArray(null==e?void 0:e.tracks)?e.tracks:[]).filter((e=>Array.isArray(null==e?void 0:e.segments)&&e.segments.length));return!t.length||t.every((e=>{const t=Array.isArray(null==e?void 0:e.segments)?e.segments:[];if(!t.length)return!0;const n=t.find((e=>null==e?void 0:e.isInit)),i=t.find((e=>e&&!e.isInit));return!(n&&!A(Xx,this,tw).call(this,n)||i&&!A(Xx,this,tw).call(this,i))}))}class Mw extends rd{constructor(...e){super(...e),this.track=void 0,this.lastSegment=void 0}get name(){return"BaseDecoder"}configure(e){this.track=e}decode(e){this.lastSegment=e}decodeChunk(e,t){}onDispose(){this.track=void 0,this.lastSegment=void 0}}function Fw(e){if(!e)throw new Error("Assertion failed.")}const Cw=e=>e&&e[e.length-1],Ow=e=>{let t=0;for(;0===e.readBits(1)&&t<32;)t++;if(t>=32)throw new Error("Invalid exponential-Golomb code.");return(1<<t)-1+e.readBits(t)},Pw=e=>e.constructor===Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e),Rw=e=>e.constructor===DataView?e:ArrayBuffer.isView(e)?new DataView(e.buffer,e.byteOffset,e.byteLength):new DataView(e),Dw=new TextDecoder,Lw=e=>Object.fromEntries(Object.entries(e).map((([e,t])=>[t,e]))),Bw={bt709:1,bt470bg:5,smpte170m:6,bt2020:9,smpte432:12},zw=Lw(Bw),Ww={bt709:1,smpte170m:6,linear:8,"iec61966-2-1":13,pq:16,hlg:18},$w=Lw(Ww),Uw={rgb:0,bt709:1,bt470bg:5,smpte170m:6,"bt2020-ncl":9},jw=Lw(Uw),qw=e=>[...e].map((e=>e.toString(16).padStart(2,"0"))).join(""),Vw=e=>(e=(e=(e=(e=(e=e>>1&1431655765|(1431655765&e)<<1)>>2&858993459|(858993459&e)<<2)>>4&252645135|(252645135&e)<<4)>>8&16711935|(16711935&e)<<8)>>16&65535|(65535&e)<<16)>>>0,Gw=(e,t,n)=>{let i=0,r=e.length-1,o=-1;for(;i<=r;){const s=i+r>>1,a=n(e[s]);a===t?(o=s,r=s-1):a<t?i=s+1:r=s-1}return o},Hw=(e,t,n)=>{let i=0,r=e.length-1,o=-1;for(;i<=r;){const s=i+(r-i+1)/2|0;n(e[s])<=t?(o=s,i=s+1):r=s-1}return o},Kw=()=>{let e,t;return{promise:new Promise(((n,i)=>{e=n,t=i})),resolve:e,reject:t}},Xw=(e,t,n)=>e.getUint8(t)<<16|e.getUint8(t+1)<<8|e.getUint8(t+2),Yw=(e,t,n)=>Math.max(t,Math.min(n,e)),Qw=/^[a-z]{3}$/,Jw=1e6*(1+Number.EPSILON);let Zw=null;let e_=null;const t_=()=>{if(null!==e_)return e_;if("undefined"==typeof navigator)return null;const e=/\bChrome\/(\d+)/.exec(navigator.userAgent);return e?e_=Number(e[1]):null},n_=e=>"number"==typeof e&&!Number.isNaN(e);class i_{constructor(e,t){if(this.data=e,this.mimeType=t,!(e instanceof Uint8Array))throw new TypeError("data must be a Uint8Array.");if("string"!=typeof t)throw new TypeError("mimeType must be a string.")}}const r_={default:!0,forced:!1,original:!1,commentary:!1,hearingImpaired:!1,visuallyImpaired:!1};class o_{constructor(e){this.bytes=e,this.pos=0}seekToByte(e){this.pos=8*e}readBit(){var e;const t=Math.floor(this.pos/8),n=null!==(e=this.bytes[t])&&void 0!==e?e:0,i=7-(7&this.pos),r=(n&1<<i)>>i;return this.pos++,r}readBits(e){if(1===e)return this.readBit();let t=0;for(let n=0;n<e;n++)t<<=1,t|=this.readBit();return t}writeBits(e,t){const n=this.pos+e;for(let e=this.pos;e<n;e++){const i=Math.floor(e/8);let r=this.bytes[i];const o=7-(7&e);r&=~(1<<o),r|=(t&1<<n-e-1)>>n-e-1<<o,this.bytes[i]=r}this.pos=n}readAlignedByte(){var e;if(this.pos%8!=0)throw new Error("Bitstream is not byte-aligned.");const t=this.pos/8,n=null!==(e=this.bytes[t])&&void 0!==e?e:0;return this.pos+=8,n}skipBits(e){this.pos+=e}getBitsLeft(){return 8*this.bytes.length-this.pos}clone(){const e=new o_(this.bytes);return e.pos=this.pos,e}}const s_=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],a_=[-1,1,2,3,4,5,6,8],l_=e=>{if(!e||e.byteLength<2)throw new TypeError("AAC description must be at least 2 bytes long.");const t=new o_(e);let n=t.readBits(5);31===n&&(n=32+t.readBits(6));const i=t.readBits(4);let r=null;15===i?r=t.readBits(24):i<s_.length&&(r=s_[i]);const o=t.readBits(4);let s=null;return o>=1&&o<=7&&(s=a_[o]),{objectType:n,frequencyIndex:i,sampleRate:r,channelConfiguration:o,numberOfChannels:s}},c_=["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"],u_=[{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}],d_=e=>{const{codec:t,codecDescription:n,colorSpace:i,avcCodecInfo:r,hevcCodecInfo:o,vp9CodecInfo:s,av1CodecInfo:a}=e;if("avc"===t){if(Fw(null!==e.avcType),r){const t=new Uint8Array([r.avcProfileIndication,r.profileCompatibility,r.avcLevelIndication]);return`avc${e.avcType}.${qw(t)}`}if(!n||n.byteLength<4)throw new TypeError("AVC decoder description is not provided or is not at least 4 bytes long.");return`avc${e.avcType}.${qw(n.subarray(1,4))}`}if("hevc"===t){let e,t,i,r,s,a;if(o)e=o.generalProfileSpace,t=o.generalProfileIdc,i=Vw(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=Rw(n),l=o.getUint8(1);e=l>>6&3,t=31&l,i=Vw(o.getUint32(2)),r=l>>5&1,s=o.getUint8(12),a=[];for(let e=0;e<6;e++)a.push(o.getUint8(6+e))}let l="hev1.";for(l+=["","A","B","C"][e]+t,l+=".",l+=i.toString(16).toUpperCase(),l+=".",l+=0===r?"L":"H",l+=s;a.length>0&&0===a[a.length-1];)a.pop();return a.length>0&&(l+=".",l+=a.map((e=>e.toString(16).toUpperCase())).join(".")),l}if("vp8"===t)return"vp8";if("vp9"===t){if(!s){const t=e.width*e.height;let n=Cw(u_).level;for(const e of u_)if(t<=e.maxPictureSize){n=e.level;break}return`vp09.00.${n.toString().padStart(2,"0")}.08`}let t=`vp09.${s.profile.toString().padStart(2,"0")}.${s.level.toString().padStart(2,"0")}.${s.bitDepth.toString().padStart(2,"0")}.${s.chromaSubsampling.toString().padStart(2,"0")}`;return t+=`.${s.colourPrimaries.toString().padStart(2,"0")}.${s.transferCharacteristics.toString().padStart(2,"0")}.${s.matrixCoefficients.toString().padStart(2,"0")}.${s.videoFullRangeFlag.toString().padStart(2,"0")}`,t.endsWith(".01.01.01.01.00")&&(t=t.slice(0,-15)),t}if("av1"===t){if(!a){const t=e.width*e.height;let n=Cw(u_).level;for(const e of u_)if(t<=e.maxPictureSize){n=e.level;break}return`av01.0.${n.toString().padStart(2,"0")}M.08`}const t=a.profile,n=a.level.toString().padStart(2,"0"),r=a.tier?"H":"M",o=a.bitDepth.toString().padStart(2,"0"),s=a.monochrome?"1":"0",l=100*a.chromaSubsamplingX+10*a.chromaSubsamplingY+1*(a.chromaSubsamplingX&&a.chromaSubsamplingY?a.chromaSamplePosition:0),c=null!=i&&i.primaries?Bw[i.primaries]:1,u=null!=i&&i.transfer?Ww[i.transfer]:1,d=null!=i&&i.matrix?Uw[i.matrix]:1,h=null!=i&&i.fullRange?1:0;let f=`av01.${t}.${n}${r}.${o}`;return f+=`.${s}.${l.toString().padStart(3,"0")}`,f+=`.${c.toString().padStart(2,"0")}`,f+=`.${u.toString().padStart(2,"0")}`,f+=`.${d.toString().padStart(2,"0")}`,f+=`.${h}`,f.endsWith(".0.110.01.01.01.0")&&(f=f.slice(0,-17)),f}throw new TypeError(`Unhandled codec '${t}'.`)},h_=e=>{const{codec:t,codecDescription:n,aacCodecInfo:i}=e;if("aac"===t){if(!i)throw new TypeError("AAC codec info must be provided.");if(i.isMpeg2)return"mp4a.67";{let e;return e=null!==i.objectType?i.objectType:l_(n).objectType,`mp4a.40.${e}`}}if("mp3"===t)return"mp3";if("opus"===t)return"opus";if("vorbis"===t)return"vorbis";if("flac"===t)return"flac";if("ac3"===t)return"ac-3";if("eac3"===t)return"ec-3";if(t&&c_.includes(t))return t;throw new TypeError(`Unhandled codec '${t}'.`)},f_=/^pcm-([usf])(\d+)+(be)?$/,p_=[48e3,44100,32e3],m_=[24e3,22050,16e3];var v_,g_;!function(e){e[e.NON_IDR_SLICE=1]="NON_IDR_SLICE",e[e.SLICE_DPA=2]="SLICE_DPA",e[e.SLICE_DPB=3]="SLICE_DPB",e[e.SLICE_DPC=4]="SLICE_DPC",e[e.IDR=5]="IDR",e[e.SEI=6]="SEI",e[e.SPS=7]="SPS",e[e.PPS=8]="PPS",e[e.AUD=9]="AUD",e[e.SPS_EXT=13]="SPS_EXT"}(v_||(v_={})),function(e){e[e.RASL_N=8]="RASL_N",e[e.RASL_R=9]="RASL_R",e[e.BLA_W_LP=16]="BLA_W_LP",e[e.RSV_IRAP_VCL23=23]="RSV_IRAP_VCL23",e[e.VPS_NUT=32]="VPS_NUT",e[e.SPS_NUT=33]="SPS_NUT",e[e.PPS_NUT=34]="PPS_NUT",e[e.AUD_NUT=35]="AUD_NUT",e[e.PREFIX_SEI_NUT=39]="PREFIX_SEI_NUT",e[e.SUFFIX_SEI_NUT=40]="SUFFIX_SEI_NUT"}(g_||(g_={}));const y_=function*(e){let t=0,n=-1;for(;t<e.length-2;){const i=e.indexOf(0,t);if(-1===i||i>=e.length-2)break;t=i;let r=0;t+3<e.length&&0===e[t+1]&&0===e[t+2]&&1===e[t+3]?r=4:0===e[t+1]&&1===e[t+2]&&(r=3),0!==r?(-1!==n&&t>n&&(yield{offset:n,length:t-n}),n=t+r,t=n):t++}-1!==n&&n<e.length&&(yield{offset:n,length:e.length-n})},b_=function*(e,t){let n=0;const i=new DataView(e.buffer,e.byteOffset,e.byteLength);for(;n+t<=e.length;){let e;1===t?e=i.getUint8(n):2===t?e=i.getUint16(n,!1):3===t?e=Xw(i,n):(Fw(4===t),e=i.getUint32(n,!1)),n+=t,yield{offset:n,length:e},n+=e}},k_=e=>31&e,x_=e=>{const t=[],n=e.length;for(let i=0;i<n;i++)i+2<n&&0===e[i]&&0===e[i+1]&&3===e[i+2]?(t.push(0,0),i+=2):t.push(e[i]);return new Uint8Array(t)},w_=e=>e>>1&63,__=function*(e){const t=new o_(e),n=()=>{let e=0;for(let n=0;n<8;n++){const i=t.readAlignedByte();if(e|=(127&i)<<7*n,!(128&i))break;if(7===n&&128&i)return null}return e>=2**32-1?null:e};for(;t.getBitsLeft()>=8;){t.skipBits(1);const i=t.readBits(4),r=t.readBits(1),o=t.readBits(1);let s;if(t.skipBits(1),r&&t.skipBits(8),o){const e=n();if(null===e)return;s=e}else s=Math.floor(t.getBitsLeft()/8);Fw(t.pos%8==0),yield{type:i,data:e.subarray(t.pos/8,t.pos/8+s)},t.skipBits(8*s)}};var T_;!function(e){e[e.STREAMINFO=0]="STREAMINFO",e[e.VORBIS_COMMENT=4]="VORBIS_COMMENT",e[e.PICTURE=6]="PICTURE"}(T_||(T_={}));const I_=[2,1,2,3,3,4,4,5];class E_{constructor(e){this.input=e}}const S_=[],A_=[],N_=new Uint8Array(0);class M_{constructor(e,t,n,i,r=-1,o,s){if(this.data=e,this.type=t,this.timestamp=n,this.duration=i,this.sequenceNumber=r,e===N_&&void 0===o)throw new Error("Internal error: byteLength must be explicitly provided when constructing metadata-only packets.");if(void 0===o&&(o=e.byteLength),!(e instanceof Uint8Array))throw new TypeError("data must be a Uint8Array.");if("key"!==t&&"delta"!==t)throw new TypeError('type must be either "key" or "delta".');if(!Number.isFinite(n))throw new TypeError("timestamp must be a number.");if(!Number.isFinite(i)||i<0)throw new TypeError("duration must be a non-negative number.");if(!Number.isFinite(r))throw new TypeError("sequenceNumber must be a number.");if(!Number.isInteger(o)||o<0)throw new TypeError("byteLength must be a non-negative integer.");if(void 0!==s&&("object"!=typeof s||!s))throw new TypeError("sideData, when provided, must be an object.");if(void 0!==(null==s?void 0:s.alpha)&&!(s.alpha instanceof Uint8Array))throw new TypeError("sideData.alpha, when provided, must be a Uint8Array.");if(void 0!==(null==s?void 0:s.alphaByteLength)&&(!Number.isInteger(s.alphaByteLength)||s.alphaByteLength<0))throw new TypeError("sideData.alphaByteLength, when provided, must be a non-negative integer.");this.byteLength=o,this.sideData=null!=s?s:{},this.sideData.alpha&&void 0===this.sideData.alphaByteLength&&(this.sideData.alphaByteLength=this.sideData.alpha.byteLength)}get isMetadataOnly(){return this.data===N_}get microsecondTimestamp(){return Math.trunc(Jw*this.timestamp)}get microsecondDuration(){return Math.trunc(Jw*this.duration)}toEncodedVideoChunk(){if(this.isMetadataOnly)throw new TypeError("Metadata-only packets cannot be converted to a video chunk.");if("undefined"==typeof EncodedVideoChunk)throw new Error("Your browser does not support EncodedVideoChunk.");return new EncodedVideoChunk({data:this.data,type:this.type,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}alphaToEncodedVideoChunk(e=this.type){if(!this.sideData.alpha)throw new TypeError("This packet does not contain alpha side data.");if(this.isMetadataOnly)throw new TypeError("Metadata-only packets cannot be converted to a video chunk.");if("undefined"==typeof EncodedVideoChunk)throw new Error("Your browser does not support EncodedVideoChunk.");return new EncodedVideoChunk({data:this.sideData.alpha,type:e,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}toEncodedAudioChunk(){if(this.isMetadataOnly)throw new TypeError("Metadata-only packets cannot be converted to an audio chunk.");if("undefined"==typeof EncodedAudioChunk)throw new Error("Your browser does not support EncodedAudioChunk.");return new EncodedAudioChunk({data:this.data,type:this.type,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}static fromEncodedChunk(e,t){var n;if(!(e instanceof EncodedVideoChunk||e instanceof EncodedAudioChunk))throw new TypeError("chunk must be an EncodedVideoChunk or EncodedAudioChunk.");const i=new Uint8Array(e.byteLength);return e.copyTo(i),new M_(i,e.type,e.timestamp/1e6,(null!==(n=e.duration)&&void 0!==n?n:0)/1e6,void 0,void 0,t)}clone(e){var t,n,i,r,o,s;if(void 0!==e&&("object"!=typeof e||null===e))throw new TypeError("options, when provided, must be an object.");if(void 0!==(null==e?void 0:e.data)&&!(e.data instanceof Uint8Array))throw new TypeError("options.data, when provided, must be a Uint8Array.");if(void 0!==(null==e?void 0:e.type)&&"key"!==e.type&&"delta"!==e.type)throw new TypeError('options.type, when provided, must be either "key" or "delta".');if(void 0!==(null==e?void 0:e.timestamp)&&!Number.isFinite(e.timestamp))throw new TypeError("options.timestamp, when provided, must be a number.");if(void 0!==(null==e?void 0:e.duration)&&!Number.isFinite(e.duration))throw new TypeError("options.duration, when provided, must be a number.");if(void 0!==(null==e?void 0:e.sequenceNumber)&&!Number.isFinite(e.sequenceNumber))throw new TypeError("options.sequenceNumber, when provided, must be a number.");if(void 0!==(null==e?void 0:e.sideData)&&("object"!=typeof e.sideData||null===e.sideData))throw new TypeError("options.sideData, when provided, must be an object.");return new M_(null!==(t=null==e?void 0:e.data)&&void 0!==t?t:this.data,null!==(n=null==e?void 0:e.type)&&void 0!==n?n:this.type,null!==(i=null==e?void 0:e.timestamp)&&void 0!==i?i:this.timestamp,null!==(r=null==e?void 0:e.duration)&&void 0!==r?r:this.duration,null!==(o=null==e?void 0:e.sequenceNumber)&&void 0!==o?o:this.sequenceNumber,this.byteLength,null!==(s=null==e?void 0:e.sideData)&&void 0!==s?s:this.sideData)}}const F_=e=>{if(!e||"object"!=typeof e)throw new TypeError("options must be an object.");if(void 0!==e.metadataOnly&&"boolean"!=typeof e.metadataOnly)throw new TypeError("options.metadataOnly, when defined, must be a boolean.");if(void 0!==e.verifyKeyPackets&&"boolean"!=typeof e.verifyKeyPackets)throw new TypeError("options.verifyKeyPackets, when defined, must be a boolean.");if(e.verifyKeyPackets&&e.metadataOnly)throw new TypeError("options.verifyKeyPackets and options.metadataOnly cannot be enabled together.")},C_=e=>{if(!n_(e))throw new TypeError("timestamp must be a number.")},O_=(e,t,n)=>n.verifyKeyPackets?t.then((async t=>{if(!t||"delta"===t.type)return t;const n=await e.determinePacketType(t);return n&&(t.type=n),t})):t;class P_{constructor(e){if(!(e instanceof R_))throw new TypeError("track must be an InputTrack.");this._track=e}getFirstPacket(e={}){if(F_(e),this._track.input._disposed)throw new aT;return O_(this._track,this._track._backing.getFirstPacket(e),e)}async getFirstKeyPacket(e={}){F_(e);const t=await this.getFirstPacket(e);return t?"key"===t.type?t:this.getNextKeyPacket(t,e):null}getPacket(e,t={}){if(C_(e),F_(t),this._track.input._disposed)throw new aT;return O_(this._track,this._track._backing.getPacket(e,t),t)}getNextPacket(e,t={}){if(!(e instanceof M_))throw new TypeError("packet must be an EncodedPacket.");if(F_(t),this._track.input._disposed)throw new aT;return O_(this._track,this._track._backing.getNextPacket(e,t),t)}async getKeyPacket(e,t={}){if(C_(e),F_(t),this._track.input._disposed)throw new aT;if(!t.verifyKeyPackets)return this._track._backing.getKeyPacket(e,t);const n=await this._track._backing.getKeyPacket(e,t);return n?(Fw("key"===n.type),"delta"===await this._track.determinePacketType(n)?this.getKeyPacket(n.timestamp-1/this._track.timeResolution,t):n):n}async getNextKeyPacket(e,t={}){if(!(e instanceof M_))throw new TypeError("packet must be an EncodedPacket.");if(F_(t),this._track.input._disposed)throw new aT;if(!t.verifyKeyPackets)return this._track._backing.getNextKeyPacket(e,t);const n=await this._track._backing.getNextKeyPacket(e,t);return n?(Fw("key"===n.type),"delta"===await this._track.determinePacketType(n)?this.getNextKeyPacket(n,t):n):n}packets(e,t,n={}){if(void 0!==e&&!(e instanceof M_))throw new TypeError("startPacket must be an EncodedPacket.");if(void 0!==e&&e.isMetadataOnly&&(null==n||!n.metadataOnly))throw new TypeError("startPacket can only be metadata-only if options.metadataOnly is enabled.");if(void 0!==t&&!(t instanceof M_))throw new TypeError("endPacket must be an EncodedPacket.");if(F_(n),this._track.input._disposed)throw new aT;const i=[];let{promise:r,resolve:o}=Kw(),{promise:s,resolve:a}=Kw(),l=!1,c=!1,u=null;const d=[];(async()=>{let u=null!=e?e:await this.getFirstPacket(n);for(;u&&!c&&!this._track.input._disposed&&!(t&&u.sequenceNumber>=(null==t?void 0:t.sequenceNumber));)i.length>Math.max(2,d.length)?(({promise:s,resolve:a}=Kw()),await s):(i.push(u),o(),({promise:r,resolve:o}=Kw()),u=await this.getNextPacket(u,n));l=!0,o()})().catch((e=>{u||(u=e,o())}));const h=this._track;return{async next(){for(;;){if(h.input._disposed)throw new aT;if(c)return{value:void 0,done:!0};if(u)throw u;if(i.length>0){const e=i.shift(),t=performance.now();for(d.push(t);d.length>0&&t-d[0]>=1e3;)d.shift();return a(),{value:e,done:!1}}if(l)return{value:void 0,done:!0};await r}},return:async()=>(c=!0,a(),o(),{value:void 0,done:!0}),async throw(e){throw e},[Symbol.asyncIterator](){return this}}}}class R_{constructor(e,t){this.input=e,this._backing=t}isVideoTrack(){return this instanceof D_}isAudioTrack(){return this instanceof L_}get id(){return this._backing.getId()}get number(){return this._backing.getNumber()}get internalCodecId(){return this._backing.getInternalCodecId()}get languageCode(){return this._backing.getLanguageCode()}get name(){return this._backing.getName()}get timeResolution(){return this._backing.getTimeResolution()}get disposition(){return this._backing.getDisposition()}getFirstTimestamp(){return this._backing.getFirstTimestamp()}computeDuration(){return this._backing.computeDuration()}async computePacketStats(e=1/0){const t=new P_(this);let n=1/0,i=-1/0,r=0,o=0;for await(const s of t.packets(void 0,void 0,{metadataOnly:!0})){if(r>=e&&s.timestamp>=i)break;n=Math.min(n,s.timestamp),i=Math.max(i,s.timestamp+s.duration),r++,o+=s.byteLength}return{packetCount:r,averagePacketRate:r?Number((r/(i-n)).toPrecision(16)):0,averageBitrate:r?Number((8*o/(i-n)).toPrecision(16)):0}}}class D_ extends R_{constructor(e,t){super(e,t),this._backing=t,this.pixelAspectRatio=(e=>{Fw(0!==e.den);let t=Math.abs(e.num),n=Math.abs(e.den);for(;0!==n;){const e=t%n;t=n,n=e}const i=t||1;return{num:e.num/i,den:e.den/i}})({num:this._backing.getSquarePixelWidth()*this._backing.getCodedHeight(),den:this._backing.getSquarePixelHeight()*this._backing.getCodedWidth()})}get type(){return"video"}get codec(){return this._backing.getCodec()}get codedWidth(){return this._backing.getCodedWidth()}get codedHeight(){return this._backing.getCodedHeight()}get rotation(){return this._backing.getRotation()}get squarePixelWidth(){return this._backing.getSquarePixelWidth()}get squarePixelHeight(){return this._backing.getSquarePixelHeight()}get displayWidth(){return this._backing.getRotation()%180==0?this.squarePixelWidth:this.squarePixelHeight}get displayHeight(){return this._backing.getRotation()%180==0?this.squarePixelHeight:this.squarePixelWidth}getColorSpace(){return this._backing.getColorSpace()}async hasHighDynamicRange(){const e=await this._backing.getColorSpace();return"bt2020"===e.primaries||"smpte432"===e.primaries||"pg"===e.transfer||"hlg"===e.transfer||"bt2020-ncl"===e.matrix}canBeTransparent(){return this._backing.canBeTransparent()}getDecoderConfig(){return this._backing.getDecoderConfig()}async getCodecParameterString(){var e;const t=await this._backing.getDecoderConfig();return null!==(e=null==t?void 0:t.codec)&&void 0!==e?e:null}async canDecode(){try{const e=await this._backing.getDecoderConfig();if(!e)return!1;const t=this._backing.getCodec();return Fw(null!==t),S_.some((n=>n.supports(t,e)))?!0:"undefined"!=typeof VideoDecoder&&!0===(await VideoDecoder.isConfigSupported(e)).supported}catch(e){return console.error("Error during decodability check:",e),!1}}async determinePacketType(e){if(!(e instanceof M_))throw new TypeError("packet must be an EncodedPacket.");if(e.isMetadataOnly)throw new TypeError("packet must not be metadata-only to determine its type.");if(null===this.codec)return null;const t=await this.getDecoderConfig();return Fw(t),((e,t,n)=>{switch(e){case"avc":for(const e of((e,t)=>{if(t.description){const n=3&Pw(t.description)[4];return b_(e,n+1)}return y_(e)})(n,t)){const t=n[e.offset],r=k_(t);if(r>=v_.NON_IDR_SLICE&&r<=v_.SLICE_DPC)return"delta";if(r===v_.IDR)return"key";if(r===v_.SEI&&(i=void 0,!(null!==Zw?Zw:Zw=!("undefined"==typeof navigator||(null===(i=navigator.vendor)||void 0===i||!i.includes("Google Inc"))&&!/Chrome/.test(navigator.userAgent)))||t_()>=144)){const t=n.subarray(e.offset,e.offset+e.length),i=x_(t);let r=1;do{let e=0;for(;;){const t=i[r++];if(void 0===t)break;if(e+=t,t<255)break}let t=0;for(;;){const e=i[r++];if(void 0===e)break;if(t+=e,e<255)break}if(6===e){const e=new o_(i);e.pos=8*r;const t=Ow(e),n=e.readBits(1);if(0===t&&1===n)return"key"}r+=t}while(r<i.length-1)}}return"delta";case"hevc":for(const e of((e,t)=>{if(t.description){const n=3&Pw(t.description)[21];return b_(e,n+1)}return y_(e)})(n,t)){const t=w_(n[e.offset]);if(t<g_.BLA_W_LP)return"delta";if(t<=g_.RSV_IRAP_VCL23)return"key"}return"delta";case"vp8":return 1&n[0]?"delta":"key";case"vp9":{const e=new o_(n);if(2!==e.readBits(2))return null;const t=e.readBits(1);return 3===(e.readBits(1)<<1)+t&&e.skipBits(1),e.readBits(1)?null:0===e.readBits(1)?"key":"delta"}case"av1":{let e=!1;for(const{type:t,data:i}of __(n))if(1===t){const t=new o_(i);t.skipBits(4),e=!!t.readBits(1)}else if(3===t||6===t||7===t){if(e)return"key";const t=new o_(i);return t.readBits(1)?null:0===t.readBits(2)?"key":"delta"}return null}default:(e=>{throw new Error(`Unexpected value: ${e}`)})(e),Fw(!1)}var i})(this.codec,t,e.data)}}class L_ extends R_{constructor(e,t){super(e,t),this._backing=t}get type(){return"audio"}get codec(){return this._backing.getCodec()}get numberOfChannels(){return this._backing.getNumberOfChannels()}get sampleRate(){return this._backing.getSampleRate()}getDecoderConfig(){return this._backing.getDecoderConfig()}async getCodecParameterString(){var e;const t=await this._backing.getDecoderConfig();return null!==(e=null==t?void 0:t.codec)&&void 0!==e?e:null}async canDecode(){try{const e=await this._backing.getDecoderConfig();if(!e)return!1;const t=this._backing.getCodec();return Fw(null!==t),A_.some((n=>n.supports(t,e)))?!0:!!e.codec.startsWith("pcm-")||"undefined"!=typeof AudioDecoder&&!0===(await AudioDecoder.isConfigSupported(e)).supported}catch(e){return console.error("Error during decodability check:",e),!1}}async determinePacketType(e){if(!(e instanceof M_))throw new TypeError("packet must be an EncodedPacket.");return null===this.codec?null:"key"}}const B_=e=>{let t=vT(e);const n=xT(e,4);let i=8;1===t&&(t=yT(e),i=16);const r=t-i;return r<0?null:{name:n,totalSize:t,headerSize:i,contentSize:r}},z_=e=>gT(e)/65536,W_=e=>gT(e)/1073741824,$_=e=>{let t=0;for(let n=0;n<4;n++){t<<=7;const n=hT(e);if(t|=127&n,!(128&n))break}return t},U_=e=>{let t=fT(e);return e.skip(2),t=Math.min(t,e.remainingLength),Dw.decode(dT(e,t))},j_=e=>{const t=B_(e);if(!t||"data"!==t.name)return null;if(e.remainingLength<8)return null;const n=vT(e);e.skip(4);const i=dT(e,t.contentSize-8);switch(n){case 1:return Dw.decode(i);case 2:return new TextDecoder("utf-16be").decode(i);case 13:return new i_(i,"image/jpeg");case 14:return new i_(i,"image/png");case 27:return new i_(i,"image/bmp");default:return i}};class q_ extends E_{constructor(e){super(e),this.moovSlice=null,this.currentTrack=null,this.tracks=[],this.metadataPromise=null,this.movieTimescale=-1,this.movieDurationInTimescale=-1,this.isQuickTime=!1,this.metadataTags={},this.currentMetadataKeys=null,this.isFragmented=!1,this.fragmentTrackDefaults=[],this.currentFragment=null,this.lastReadFragment=null,this.reader=e._reader}async computeDuration(){const e=await this.getTracks(),t=await Promise.all(e.map((e=>e.computeDuration())));return Math.max(0,...t)}async getTracks(){return await this.readMetadata(),this.tracks.map((e=>e.inputTrack))}async getMimeType(){await this.readMetadata();const e=await Promise.all(this.tracks.map((e=>e.inputTrack.getCodecParameterString())));return(e=>{let t=(e.hasVideo?"video/":e.hasAudio?"audio/":"application/")+(e.isQuickTime?"quicktime":"mp4");return e.codecStrings.length>0&&(t+=`; codecs="${[...new Set(e.codecStrings)].join(", ")}"`),t})({isQuickTime:this.isQuickTime,hasVideo:this.tracks.some((e=>{var t;return"video"===(null===(t=e.info)||void 0===t?void 0:t.type)})),hasAudio:this.tracks.some((e=>{var t;return"audio"===(null===(t=e.info)||void 0===t?void 0:t.type)})),codecStrings:e.filter(Boolean)})}async getMetadataTags(){return await this.readMetadata(),this.metadataTags}readMetadata(){var e;return null!==(e=this.metadataPromise)&&void 0!==e?e:this.metadataPromise=(async()=>{let e=0;for(;;){let t=this.reader.requestSliceRange(e,8,16);if(t instanceof Promise&&(t=await t),!t)break;const n=e,i=B_(t);if(!i)break;if("ftyp"===i.name){const e=xT(t,4);this.isQuickTime="qt "===e}else if("moov"===i.name){let e=this.reader.requestSlice(t.filePos,i.contentSize);if(e instanceof Promise&&(e=await e),!e)break;this.moovSlice=e,this.readContiguousBoxes(this.moovSlice),this.tracks.sort(((e,t)=>Number(t.disposition.default)-Number(e.disposition.default)));for(const e of this.tracks){const t=e.editListPreviousSegmentDurations/this.movieTimescale;e.editListOffset-=Math.round(t*e.timescale)}break}e=n+i.totalSize}if(this.isFragmented&&null!==this.reader.fileSize){let e=this.reader.requestSlice(this.reader.fileSize-4,4);e instanceof Promise&&(e=await e),Fw(e);const t=vT(e),n=this.reader.fileSize-t;if(n>=0&&n<=this.reader.fileSize-16){let e=this.reader.requestSliceRange(n,8,16);if(e instanceof Promise&&(e=await e),e){const t=B_(e);if(t&&"mfra"===t.name){let n=this.reader.requestSlice(e.filePos,t.contentSize);n instanceof Promise&&(n=await n),n&&this.readContiguousBoxes(n)}}}}})()}getSampleTableForTrack(e){var t;if(e.sampleTable)return e.sampleTable;const n={sampleTimingEntries:[],sampleCompositionTimeOffsets:[],sampleSizes:[],keySampleIndices:null,chunkOffsets:[],sampleToChunk:[],presentationTimestamps:null,presentationTimestampIndexMap:null};e.sampleTable=n,Fw(this.moovSlice);const i=this.moovSlice.slice(e.sampleTableByteOffset);if(this.currentTrack=e,this.traverseBox(i),this.currentTrack=null,"audio"===(null===(t=e.info)||void 0===t?void 0:t.type)&&e.info.codec&&c_.includes(e.info.codec)&&0===n.sampleCompositionTimeOffsets.length){var r;Fw("audio"===(null===(r=e.info)||void 0===r?void 0:r.type));const t=(e=>{if(Fw(c_.includes(e)),"ulaw"===e)return{dataType:"ulaw",sampleSize:1,littleEndian:!0,silentValue:255};if("alaw"===e)return{dataType:"alaw",sampleSize:1,littleEndian:!0,silentValue:213};const t=f_.exec(e);let n;return Fw(t),n="u"===t[1]?"unsigned":"s"===t[1]?"signed":"float",{dataType:n,sampleSize:Number(t[2])/8,littleEndian:"be"!==t[3],silentValue:"pcm-u8"===e?128:0}})(e.info.codec),i=[],o=[];for(let r=0;r<n.sampleToChunk.length;r++){const s=n.sampleToChunk[r],a=n.sampleToChunk[r+1],l=(a?a.startChunkIndex:n.chunkOffsets.length)-s.startChunkIndex;for(let r=0;r<l;r++){const a=s.startSampleIndex+r*s.samplesPerChunk,l=a+s.samplesPerChunk,c=Hw(n.sampleTimingEntries,a,(e=>e.startIndex)),u=n.sampleTimingEntries[c],d=Hw(n.sampleTimingEntries,l,(e=>e.startIndex)),h=n.sampleTimingEntries[d],f=u.startDecodeTimestamp+(a-u.startIndex)*u.delta,p=h.startDecodeTimestamp+(l-h.startIndex)*h.delta-f,m=Cw(i);m&&m.delta===p?m.count++:i.push({startIndex:s.startChunkIndex+r,startDecodeTimestamp:f,count:1,delta:p});const v=s.samplesPerChunk*t.sampleSize*e.info.numberOfChannels;o.push(v)}s.startSampleIndex=s.startChunkIndex,s.samplesPerChunk=1}n.sampleTimingEntries=i,n.sampleSizes=o}if(n.sampleCompositionTimeOffsets.length>0){n.presentationTimestamps=[];for(const e of n.sampleTimingEntries)for(let t=0;t<e.count;t++)n.presentationTimestamps.push({presentationTimestamp:e.startDecodeTimestamp+t*e.delta,sampleIndex:e.startIndex+t});for(const e of n.sampleCompositionTimeOffsets)for(let t=0;t<e.count;t++){const i=e.startIndex+t,r=n.presentationTimestamps[i];r&&(r.presentationTimestamp+=e.offset)}n.presentationTimestamps.sort(((e,t)=>e.presentationTimestamp-t.presentationTimestamp)),n.presentationTimestampIndexMap=Array(n.presentationTimestamps.length).fill(-1);for(let e=0;e<n.presentationTimestamps.length;e++)n.presentationTimestampIndexMap[n.presentationTimestamps[e].sampleIndex]=e}return n}async readFragment(e){var t;if((null===(t=this.lastReadFragment)||void 0===t?void 0:t.moofOffset)===e)return this.lastReadFragment;let n=this.reader.requestSliceRange(e,8,16);n instanceof Promise&&(n=await n),Fw(n);const i=B_(n);Fw("moof"===(null==i?void 0:i.name));let r=this.reader.requestSlice(e,i.totalSize);r instanceof Promise&&(r=await r),Fw(r),this.traverseBox(r);const o=this.lastReadFragment;Fw(o&&o.moofOffset===e);for(const[,e]of o.trackData){const t=e.track,{fragmentPositionCache:n}=t;if(!e.startTimestampIsFinal){const i=t.fragmentLookupTable.find((e=>e.moofOffset===o.moofOffset));if(i)J_(e,i.timestamp);else{const t=Hw(n,o.moofOffset-1,(e=>e.moofOffset));if(-1!==t){const i=n[t];J_(e,i.endTimestamp)}}e.startTimestampIsFinal=!0}const i=Hw(n,e.startTimestamp,(e=>e.startTimestamp));-1!==i&&n[i].moofOffset===o.moofOffset||n.splice(i+1,0,{moofOffset:o.moofOffset,startTimestamp:e.startTimestamp,endTimestamp:e.endTimestamp})}return o}readContiguousBoxes(e){const t=e.filePos;for(;e.filePos-t<=e.length-8&&this.traverseBox(e););}*iterateContiguousBoxes(e){const t=e.filePos;for(;e.filePos-t<=e.length-8;){const t=e.filePos,n=B_(e);if(!n)break;yield{boxInfo:n,slice:e},e.filePos=t+n.totalSize}}traverseBox(e){var t,n,i,r,o,s,a,l,c,u,d,h,f,p,m,v,g,y,b,k,x,w,_,T,I,E,S,A,N,M,F,C,O,P,R,D;const L=e.filePos,B=B_(e);if(!B)return!1;const z=e.filePos,W=L+B.totalSize;switch(B.name){case"mdia":case"minf":case"dinf":case"mfra":case"edts":case"wave":this.readContiguousBoxes(e.slice(z,B.contentSize));break;case"mvhd":{const t=hT(e);e.skip(3),1===t?(e.skip(16),this.movieTimescale=vT(e),this.movieDurationInTimescale=yT(e)):(e.skip(8),this.movieTimescale=vT(e),this.movieDurationInTimescale=vT(e))}break;case"trak":{const t={id:-1,demuxer:this,inputTrack:null,disposition:{...r_},info:null,timescale:-1,durationInMovieTimescale:-1,durationInMediaTimescale:-1,rotation:0,internalCodecId:null,name:null,languageCode:"und",sampleTableByteOffset:-1,sampleTable:null,fragmentLookupTable:[],currentFragmentState:null,fragmentPositionCache:[],editListPreviousSegmentDurations:0,editListOffset:0};if(this.currentTrack=t,this.readContiguousBoxes(e.slice(z,B.contentSize)),-1!==t.id&&-1!==t.timescale&&null!==t.info)if("video"===t.info.type&&-1!==t.info.width){const e=t;t.inputTrack=new D_(this.input,new G_(e)),this.tracks.push(t)}else if("audio"===t.info.type&&-1!==t.info.numberOfChannels){const e=t;t.inputTrack=new L_(this.input,new H_(e)),this.tracks.push(t)}this.currentTrack=null}break;case"tkhd":{const t=this.currentTrack;if(!t)break;const n=hT(e),i=!!(1&pT(e));if(t.disposition.default=i,0===n)e.skip(8),t.id=vT(e),e.skip(4),t.durationInMovieTimescale=vT(e);else{if(1!==n)throw new Error(`Incorrect track header version ${n}.`);e.skip(16),t.id=vT(e),e.skip(4),t.durationInMovieTimescale=yT(e)}e.skip(16);const r=[z_(e),z_(e),W_(e),z_(e),z_(e),W_(e),z_(e),z_(e),W_(e)],o=(e=>{const t=(e%360+360)%360;if(0===t||90===t||180===t||270===t)return t;throw new Error(`Invalid rotation ${e}.`)})((Ce=Z_(r),90*Math.round(Ce/90)));Fw(0===o||90===o||180===o||270===o),t.rotation=o}break;case"elst":{const t=this.currentTrack;if(!t)break;const n=hT(e);e.skip(3);let i=!1,r=0;const o=vT(e);for(let s=0;s<o;s++){const o=1===n?yT(e):vT(e),s=1===n?bT(e):gT(e),a=z_(e);if(0!==o){if(i){console.warn("Unsupported edit list: multiple edits are not currently supported. Only using first edit.");break}if(-1!==s){if(1!==a){console.warn("Unsupported edit list entry: media rate must be 1.");break}t.editListPreviousSegmentDurations=r,t.editListOffset=s,i=!0}else r+=o}}}break;case"mdhd":{const t=this.currentTrack;if(!t)break;const n=hT(e);e.skip(3),0===n?(e.skip(8),t.timescale=vT(e),t.durationInMediaTimescale=vT(e)):1===n&&(e.skip(16),t.timescale=vT(e),t.durationInMediaTimescale=yT(e));let i=fT(e);if(i>0){t.languageCode="";for(let e=0;e<3;e++)t.languageCode=String.fromCharCode(96+(31&i))+t.languageCode,i>>=5;Fe=t.languageCode,Qw.test(Fe)||(t.languageCode="und")}}break;case"hdlr":{const t=this.currentTrack;if(!t)break;e.skip(8);const n=xT(e,4);"vide"===n?t.info={type:"video",width:-1,height:-1,squarePixelWidth:-1,squarePixelHeight:-1,codec:null,codecDescription:null,colorSpace:null,avcType:null,avcCodecInfo:null,hevcCodecInfo:null,vp9CodecInfo:null,av1CodecInfo:null}:"soun"===n&&(t.info={type:"audio",numberOfChannels:-1,sampleRate:-1,codec:null,codecDescription:null,aacCodecInfo:null})}break;case"stbl":{const t=this.currentTrack;if(!t)break;t.sampleTableByteOffset=L,this.readContiguousBoxes(e.slice(z,B.contentSize))}break;case"stsd":{const t=this.currentTrack;if(!t)break;if(null===t.info||t.sampleTable)break;const n=hT(e);e.skip(3);const i=vT(e);for(let r=0;r<i;r++){const i=e.filePos,r=B_(e);if(!r)break;t.internalCodecId=r.name;const o=r.name.toLowerCase();if("video"===t.info.type)"avc1"===o||"avc3"===o?(t.info.codec="avc",t.info.avcType="avc1"===o?1:3):"hvc1"===o||"hev1"===o?t.info.codec="hevc":"vp08"===o?t.info.codec="vp8":"vp09"===o?t.info.codec="vp9":"av01"===o?t.info.codec="av1":console.warn(`Unsupported video codec (sample entry type '${r.name}').`),e.skip(24),t.info.width=fT(e),t.info.height=fT(e),t.info.squarePixelWidth=t.info.width,t.info.squarePixelHeight=t.info.height,e.skip(50),this.readContiguousBoxes(e.slice(e.filePos,i+r.totalSize-e.filePos));else{"mp4a"===o||("opus"===o?t.info.codec="opus":"flac"===o?t.info.codec="flac":"twos"===o||"sowt"===o||"raw "===o||"in24"===o||"in32"===o||"fl32"===o||"fl64"===o||"lpcm"===o||"ipcm"===o||"fpcm"===o||("ulaw"===o?t.info.codec="ulaw":"alaw"===o?t.info.codec="alaw":"ac-3"===o?t.info.codec="ac3":"ec-3"===o?t.info.codec="eac3":console.warn(`Unsupported audio codec (sample entry type '${r.name}').`))),e.skip(8);const s=fT(e);e.skip(6);let a=fT(e),l=fT(e);e.skip(4);let c=vT(e)/65536;if(0===n&&s>0)if(1===s)e.skip(4),l=8*vT(e),e.skip(8);else if(2===s){e.skip(4),c=kT(e),a=vT(e),e.skip(4),l=vT(e);const n=vT(e);if(e.skip(8),"lpcm"===o){const e=l+7>>3,i=Boolean(1&n),r=Boolean(2&n),o=4&n?-1:0;l>0&&l<=64&&(i?32===l&&(t.info.codec=r?"pcm-f32be":"pcm-f32"):o&1<<e-1?1===e?t.info.codec="pcm-s8":2===e?t.info.codec=r?"pcm-s16be":"pcm-s16":3===e?t.info.codec=r?"pcm-s24be":"pcm-s24":4===e&&(t.info.codec=r?"pcm-s32be":"pcm-s32"):1===e&&(t.info.codec="pcm-u8")),null===t.info.codec&&console.warn("Unsupported PCM format.")}}"opus"===t.info.codec&&(c=48e3),t.info.numberOfChannels=a,t.info.sampleRate=c,"twos"===o?8===l?t.info.codec="pcm-s8":16===l?t.info.codec="pcm-s16be":(console.warn(`Unsupported sample size ${l} for codec 'twos'.`),t.info.codec=null):"sowt"===o?8===l?t.info.codec="pcm-s8":16===l?t.info.codec="pcm-s16":(console.warn(`Unsupported sample size ${l} for codec 'sowt'.`),t.info.codec=null):"raw "===o?t.info.codec="pcm-u8":"in24"===o?t.info.codec="pcm-s24be":"in32"===o?t.info.codec="pcm-s32be":"fl32"===o?t.info.codec="pcm-f32be":"fl64"===o?t.info.codec="pcm-f64be":"ipcm"===o?t.info.codec="pcm-s16be":"fpcm"===o&&(t.info.codec="pcm-f32be"),this.readContiguousBoxes(e.slice(e.filePos,i+r.totalSize-e.filePos))}}}break;case"avcC":{const t=this.currentTrack;if(!t)break;Fw(t.info),t.info.codecDescription=dT(e,B.contentSize)}break;case"hvcC":{const t=this.currentTrack;if(!t)break;Fw(t.info),t.info.codecDescription=dT(e,B.contentSize)}break;case"vpcC":{var $;const t=this.currentTrack;if(!t)break;Fw("video"===(null===($=t.info)||void 0===$?void 0:$.type)),e.skip(4);const n=hT(e),i=hT(e),r=hT(e),o=r>>4,s=r>>1&7,a=1&r,l=hT(e),c=hT(e),u=hT(e);t.info.vp9CodecInfo={profile:n,level:i,bitDepth:o,chromaSubsampling:s,videoFullRangeFlag:a,colourPrimaries:l,transferCharacteristics:c,matrixCoefficients:u}}break;case"av1C":{var U;const t=this.currentTrack;if(!t)break;Fw("video"===(null===(U=t.info)||void 0===U?void 0:U.type)),e.skip(1);const n=hT(e),i=n>>5,r=31&n,o=hT(e),s=o>>7,a=o>>6&1,l=o>>4&1,c=o>>3&1,u=o>>2&1,d=3&o,h=2===i&&a?o>>5&1?12:10:a?10:8;t.info.av1CodecInfo={profile:i,level:r,tier:s,bitDepth:h,monochrome:l,chromaSubsamplingX:c,chromaSubsamplingY:u,chromaSamplePosition:d}}break;case"colr":{var j;const t=this.currentTrack;if(!t)break;if(Fw("video"===(null===(j=t.info)||void 0===j?void 0:j.type)),"nclx"!==xT(e,4))break;const n=fT(e),i=fT(e),r=fT(e),o=Boolean(128&hT(e));t.info.colorSpace={primaries:zw[n],transfer:$w[i],matrix:jw[r],fullRange:o}}break;case"pasp":{var q;const t=this.currentTrack;if(!t)break;Fw("video"===(null===(q=t.info)||void 0===q?void 0:q.type));const n=vT(e),i=vT(e);n>i?t.info.squarePixelWidth=Math.round(t.info.width*n/i):t.info.squarePixelHeight=Math.round(t.info.height*i/n)}break;case"esds":{var V;const t=this.currentTrack;if(!t)break;Fw("audio"===(null===(V=t.info)||void 0===V?void 0:V.type)),e.skip(4),Fw(3===hT(e)),$_(e),e.skip(2);const n=hT(e),i=!!(64&n),r=!!(32&n);if(!!(128&n)&&e.skip(2),i){const t=hT(e);e.skip(t)}r&&e.skip(2),Fw(4===hT(e));const o=$_(e),s=e.filePos,a=hT(e);if(64===a||103===a?(t.info.codec="aac",t.info.aacCodecInfo={isMpeg2:103===a,objectType:null}):105===a||107===a?t.info.codec="mp3":221===a?t.info.codec="vorbis":console.warn(`Unsupported audio codec (objectTypeIndication ${a}) - discarding track.`),e.skip(12),o>e.filePos-s){Fw(5===hT(e));const n=$_(e);if(t.info.codecDescription=dT(e,n),"aac"===t.info.codec){const e=l_(t.info.codecDescription);null!==e.numberOfChannels&&(t.info.numberOfChannels=e.numberOfChannels),null!==e.sampleRate&&(t.info.sampleRate=e.sampleRate)}}}break;case"enda":{var G;const t=this.currentTrack;if(!t)break;Fw("audio"===(null===(G=t.info)||void 0===G?void 0:G.type)),255&fT(e)&&("pcm-s16be"===t.info.codec?t.info.codec="pcm-s16":"pcm-s24be"===t.info.codec?t.info.codec="pcm-s24":"pcm-s32be"===t.info.codec?t.info.codec="pcm-s32":"pcm-f32be"===t.info.codec?t.info.codec="pcm-f32":"pcm-f64be"===t.info.codec&&(t.info.codec="pcm-f64"))}break;case"pcmC":{var H;const t=this.currentTrack;if(!t)break;Fw("audio"===(null===(H=t.info)||void 0===H?void 0:H.type)),e.skip(4);const n=hT(e),i=Boolean(1&n),r=hT(e);"pcm-s16be"===t.info.codec?i?16===r?t.info.codec="pcm-s16":24===r?t.info.codec="pcm-s24":32===r?t.info.codec="pcm-s32":(console.warn(`Invalid ipcm sample size ${r}.`),t.info.codec=null):16===r?t.info.codec="pcm-s16be":24===r?t.info.codec="pcm-s24be":32===r?t.info.codec="pcm-s32be":(console.warn(`Invalid ipcm sample size ${r}.`),t.info.codec=null):"pcm-f32be"===t.info.codec&&(i?32===r?t.info.codec="pcm-f32":64===r?t.info.codec="pcm-f64":(console.warn(`Invalid fpcm sample size ${r}.`),t.info.codec=null):32===r?t.info.codec="pcm-f32be":64===r?t.info.codec="pcm-f64be":(console.warn(`Invalid fpcm sample size ${r}.`),t.info.codec=null));break}case"dOps":{var K;const t=this.currentTrack;if(!t)break;Fw("audio"===(null===(K=t.info)||void 0===K?void 0:K.type)),e.skip(1);const n=hT(e),i=fT(e),r=vT(e),o=mT(e),s=hT(e);let a;a=0!==s?dT(e,2+n):new Uint8Array(0);const l=new Uint8Array(19+a.byteLength),c=new DataView(l.buffer);c.setUint32(0,1332770163,!1),c.setUint32(4,1214603620,!1),c.setUint8(8,1),c.setUint8(9,n),c.setUint16(10,i,!0),c.setUint32(12,r,!0),c.setInt16(16,o,!0),c.setUint8(18,s),l.set(a,19),t.info.codecDescription=l,t.info.numberOfChannels=n}break;case"dfLa":{var X;const t=this.currentTrack;if(!t)break;Fw("audio"===(null===(X=t.info)||void 0===X?void 0:X.type)),e.skip(4);const n=127,i=128,r=e.filePos;for(;e.filePos<W;){const r=hT(e),o=pT(e);if((r&n)===T_.STREAMINFO){e.skip(10);const n=vT(e),i=n>>>12,r=1+(n>>9&7);t.info.sampleRate=i,t.info.numberOfChannels=r,e.skip(20)}else e.skip(o);if(r&i)break}const o=e.filePos;e.filePos=r;const s=dT(e,o-r),a=new Uint8Array(4+s.byteLength);new DataView(a.buffer).setUint32(0,1716281667,!1),a.set(s,4),t.info.codecDescription=a}break;case"dac3":{var Y;const t=this.currentTrack;if(!t)break;Fw("audio"===(null===(Y=t.info)||void 0===Y?void 0:Y.type));const n=dT(e,3),i=new o_(n),r=i.readBits(2);i.skipBits(8);const o=i.readBits(3),s=i.readBits(1);r<3&&(t.info.sampleRate=p_[r]),t.info.numberOfChannels=I_[o]+s}break;case"dec3":{var Q;const t=this.currentTrack;if(!t)break;Fw("audio"===(null===(Q=t.info)||void 0===Q?void 0:Q.type));const n=(e=>{if(e.length<2)return null;const t=new o_(e),n=t.readBits(13),i=t.readBits(3),r=[];for(let n=0;n<=i&&!(Math.ceil(t.pos/8)+3>e.length);n++){const e=t.readBits(2),n=t.readBits(5);t.skipBits(1),t.skipBits(1);const i=t.readBits(3),o=t.readBits(3),s=t.readBits(1);t.skipBits(3);const a=t.readBits(4);let l=0;a>0?l=t.readBits(9):t.skipBits(1),r.push({fscod:e,fscod2:null,bsid:n,bsmod:i,acmod:o,lfeon:s,numDepSub:a,chanLoc:l})}return 0===r.length?null:{dataRate:n,substreams:r}})(dT(e,B.contentSize));if(!n){console.warn("Invalid dec3 box contents, ignoring.");break}const i=(e=>{const t=e.substreams[0];return Fw(t),t.fscod<3?p_[t.fscod]:null!==t.fscod2&&t.fscod2<3?m_[t.fscod2]:null})(n);null!==i&&(t.info.sampleRate=i),t.info.numberOfChannels=(e=>{const t=e.substreams[0];Fw(t);let n=I_[t.acmod]+t.lfeon;if(t.numDepSub>0){const e=[2,2,1,1,2,2,2,1,1];for(let i=0;i<9;i++)t.chanLoc&1<<8-i&&(n+=e[i])}return n})(n)}break;case"stts":{const t=this.currentTrack;if(!t)break;if(!t.sampleTable)break;e.skip(4);const n=vT(e);let i=0,r=0;for(let o=0;o<n;o++){const n=vT(e),o=vT(e);t.sampleTable.sampleTimingEntries.push({startIndex:i,startDecodeTimestamp:r,count:n,delta:o}),i+=n,r+=n*o}}break;case"ctts":{const t=this.currentTrack;if(!t)break;if(!t.sampleTable)break;e.skip(4);const n=vT(e);let i=0;for(let r=0;r<n;r++){const n=vT(e),r=gT(e);t.sampleTable.sampleCompositionTimeOffsets.push({startIndex:i,count:n,offset:r}),i+=n}}break;case"stsz":{const t=this.currentTrack;if(!t)break;if(!t.sampleTable)break;e.skip(4);const n=vT(e),i=vT(e);if(0===n)for(let n=0;n<i;n++){const n=vT(e);t.sampleTable.sampleSizes.push(n)}else t.sampleTable.sampleSizes.push(n)}break;case"stz2":{const t=this.currentTrack;if(!t)break;if(!t.sampleTable)break;e.skip(4),e.skip(3);const n=hT(e),i=vT(e),r=dT(e,Math.ceil(i*n/8)),o=new o_(r);for(let e=0;e<i;e++){const e=o.readBits(n);t.sampleTable.sampleSizes.push(e)}}break;case"stss":{const t=this.currentTrack;if(!t)break;if(!t.sampleTable)break;e.skip(4),t.sampleTable.keySampleIndices=[];const n=vT(e);for(let i=0;i<n;i++){const n=vT(e)-1;t.sampleTable.keySampleIndices.push(n)}0!==t.sampleTable.keySampleIndices[0]&&t.sampleTable.keySampleIndices.unshift(0)}break;case"stsc":{const t=this.currentTrack;if(!t)break;if(!t.sampleTable)break;e.skip(4);const n=vT(e);for(let i=0;i<n;i++){const n=vT(e)-1,i=vT(e),r=vT(e);t.sampleTable.sampleToChunk.push({startSampleIndex:-1,startChunkIndex:n,samplesPerChunk:i,sampleDescriptionIndex:r})}let i=0;for(let e=0;e<t.sampleTable.sampleToChunk.length;e++)t.sampleTable.sampleToChunk[e].startSampleIndex=i,e<t.sampleTable.sampleToChunk.length-1&&(i+=(t.sampleTable.sampleToChunk[e+1].startChunkIndex-t.sampleTable.sampleToChunk[e].startChunkIndex)*t.sampleTable.sampleToChunk[e].samplesPerChunk)}break;case"stco":{const t=this.currentTrack;if(!t)break;if(!t.sampleTable)break;e.skip(4);const n=vT(e);for(let i=0;i<n;i++){const n=vT(e);t.sampleTable.chunkOffsets.push(n)}}break;case"co64":{const t=this.currentTrack;if(!t)break;if(!t.sampleTable)break;e.skip(4);const n=vT(e);for(let i=0;i<n;i++){const n=yT(e);t.sampleTable.chunkOffsets.push(n)}}break;case"mvex":this.isFragmented=!0,this.readContiguousBoxes(e.slice(z,B.contentSize));break;case"mehd":{const t=hT(e);e.skip(3);const n=1===t?yT(e):vT(e);this.movieDurationInTimescale=n}break;case"trex":{e.skip(4);const t=vT(e),n=vT(e),i=vT(e),r=vT(e),o=vT(e);this.fragmentTrackDefaults.push({trackId:t,defaultSampleDescriptionIndex:n,defaultSampleDuration:i,defaultSampleSize:r,defaultSampleFlags:o})}break;case"tfra":{const t=hT(e);e.skip(3);const n=vT(e),i=this.tracks.find((e=>e.id===n));if(!i)break;const r=vT(e),o=(12&r)>>2,s=3&r,a=[hT,fT,pT,vT],l=a[(48&r)>>4],c=a[o],u=a[s],d=vT(e);for(let n=0;n<d;n++){const n=1===t?yT(e):vT(e),r=1===t?yT(e):vT(e);l(e),c(e),u(e),i.fragmentLookupTable.push({timestamp:n,moofOffset:r})}i.fragmentLookupTable.sort(((e,t)=>e.timestamp-t.timestamp));for(let e=0;e<i.fragmentLookupTable.length-1;e++){const t=i.fragmentLookupTable[e],n=i.fragmentLookupTable[e+1];t.timestamp===n.timestamp&&(i.fragmentLookupTable.splice(e+1,1),e--)}}break;case"moof":this.currentFragment={moofOffset:L,moofSize:B.totalSize,implicitBaseDataOffset:L,trackData:new Map},this.readContiguousBoxes(e.slice(z,B.contentSize)),this.lastReadFragment=this.currentFragment,this.currentFragment=null;break;case"traf":if(Fw(this.currentFragment),this.readContiguousBoxes(e.slice(z,B.contentSize)),this.currentTrack){const e=this.currentFragment.trackData.get(this.currentTrack.id);if(e){const{currentFragmentState:t}=this.currentTrack;Fw(t),null!==t.startTimestamp&&(J_(e,t.startTimestamp),e.startTimestampIsFinal=!0)}this.currentTrack.currentFragmentState=null,this.currentTrack=null}break;case"tfhd":{var J,Z,ee,te;Fw(this.currentFragment),e.skip(1);const t=pT(e),n=Boolean(1&t),i=Boolean(2&t),r=Boolean(8&t),o=Boolean(16&t),s=Boolean(32&t),a=Boolean(65536&t),l=Boolean(131072&t),c=vT(e),u=this.tracks.find((e=>e.id===c));if(!u)break;const d=this.fragmentTrackDefaults.find((e=>e.trackId===c));this.currentTrack=u,u.currentFragmentState={baseDataOffset:this.currentFragment.implicitBaseDataOffset,sampleDescriptionIndex:null!==(J=null==d?void 0:d.defaultSampleDescriptionIndex)&&void 0!==J?J:null,defaultSampleDuration:null!==(Z=null==d?void 0:d.defaultSampleDuration)&&void 0!==Z?Z:null,defaultSampleSize:null!==(ee=null==d?void 0:d.defaultSampleSize)&&void 0!==ee?ee:null,defaultSampleFlags:null!==(te=null==d?void 0:d.defaultSampleFlags)&&void 0!==te?te:null,startTimestamp:null},n?u.currentFragmentState.baseDataOffset=yT(e):l&&(u.currentFragmentState.baseDataOffset=this.currentFragment.moofOffset),i&&(u.currentFragmentState.sampleDescriptionIndex=vT(e)),r&&(u.currentFragmentState.defaultSampleDuration=vT(e)),o&&(u.currentFragmentState.defaultSampleSize=vT(e)),s&&(u.currentFragmentState.defaultSampleFlags=vT(e)),a&&(u.currentFragmentState.defaultSampleDuration=0)}break;case"tfdt":{const t=this.currentTrack;if(!t)break;Fw(t.currentFragmentState);const n=hT(e);e.skip(3);const i=0===n?vT(e):yT(e);t.currentFragmentState.startTimestamp=i}break;case"trun":{const t=this.currentTrack;if(!t)break;if(Fw(this.currentFragment),Fw(t.currentFragmentState),this.currentFragment.trackData.has(t.id)){console.warn("Can't have two trun boxes for the same track in one fragment. Ignoring...");break}const n=hT(e),i=pT(e),r=Boolean(1&i),o=Boolean(4&i),s=Boolean(256&i),a=Boolean(512&i),l=Boolean(1024&i),c=Boolean(2048&i),u=vT(e);let d=t.currentFragmentState.baseDataOffset;r&&(d+=gT(e));let h=null;o&&(h=vT(e));let f=d;if(0===u){this.currentFragment.implicitBaseDataOffset=f;break}let p=0;const m={track:t,startTimestamp:0,endTimestamp:0,firstKeyFrameTimestamp:null,samples:[],presentationTimestamps:[],startTimestampIsFinal:!1};this.currentFragment.trackData.set(t.id,m);for(let i=0;i<u;i++){let r,o,u;s?r=vT(e):(Fw(null!==t.currentFragmentState.defaultSampleDuration),r=t.currentFragmentState.defaultSampleDuration),a?o=vT(e):(Fw(null!==t.currentFragmentState.defaultSampleSize),o=t.currentFragmentState.defaultSampleSize),l?u=vT(e):(Fw(null!==t.currentFragmentState.defaultSampleFlags),u=t.currentFragmentState.defaultSampleFlags),0===i&&null!==h&&(u=h);let d=0;c&&(d=0===n?vT(e):gT(e));const v=!(65536&u);m.samples.push({presentationTimestamp:p+d,duration:r,byteOffset:f,byteSize:o,isKeyFrame:v}),f+=o,p+=r}m.presentationTimestamps=m.samples.map(((e,t)=>({presentationTimestamp:e.presentationTimestamp,sampleIndex:t}))).sort(((e,t)=>e.presentationTimestamp-t.presentationTimestamp));for(let e=0;e<m.presentationTimestamps.length;e++){const t=m.presentationTimestamps[e],n=m.samples[t.sampleIndex];if(null===m.firstKeyFrameTimestamp&&n.isKeyFrame&&(m.firstKeyFrameTimestamp=n.presentationTimestamp),e<m.presentationTimestamps.length-1){const i=m.presentationTimestamps[e+1];n.duration=i.presentationTimestamp-t.presentationTimestamp}}const v=m.samples[m.presentationTimestamps[0].sampleIndex],g=m.samples[Cw(m.presentationTimestamps).sampleIndex];m.startTimestamp=v.presentationTimestamp,m.endTimestamp=g.presentationTimestamp+g.duration,this.currentFragment.implicitBaseDataOffset=f}break;case"udta":{const g=this.iterateContiguousBoxes(e.slice(z,B.contentSize));for(const{boxInfo:e,slice:y}of g){if("meta"!==e.name&&!this.currentTrack){var ne,ie,re,oe,se,ae,le,ce;const t=y.filePos;null!==(ie=(ne=this.metadataTags).raw)&&void 0!==ie||(ne.raw={}),"©"===e.name[0]?null!==(se=(re=this.metadataTags.raw)[oe=e.name])&&void 0!==se||(re[oe]=U_(y)):null!==(ce=(ae=this.metadataTags.raw)[le=e.name])&&void 0!==ce||(ae[le]=dT(y,e.contentSize)),y.filePos=t}switch(e.name){case"meta":y.skip(-e.headerSize),this.traverseBox(y);break;case"©nam":case"name":this.currentTrack?this.currentTrack.name=Dw.decode(dT(y,e.contentSize)):null!==(n=(t=this.metadataTags).title)&&void 0!==n||(t.title=U_(y));break;case"©des":this.currentTrack||null!==(r=(i=this.metadataTags).description)&&void 0!==r||(i.description=U_(y));break;case"©ART":this.currentTrack||null!==(s=(o=this.metadataTags).artist)&&void 0!==s||(o.artist=U_(y));break;case"©alb":this.currentTrack||null!==(l=(a=this.metadataTags).album)&&void 0!==l||(a.album=U_(y));break;case"albr":this.currentTrack||null!==(u=(c=this.metadataTags).albumArtist)&&void 0!==u||(c.albumArtist=U_(y));break;case"©gen":this.currentTrack||null!==(h=(d=this.metadataTags).genre)&&void 0!==h||(d.genre=U_(y));break;case"©day":if(!this.currentTrack){var ue,de;const e=new Date(U_(y));Number.isNaN(e.getTime())||null!==(de=(ue=this.metadataTags).date)&&void 0!==de||(ue.date=e)}break;case"©cmt":this.currentTrack||null!==(p=(f=this.metadataTags).comment)&&void 0!==p||(f.comment=U_(y));break;case"©lyr":this.currentTrack||null!==(v=(m=this.metadataTags).lyrics)&&void 0!==v||(m.lyrics=U_(y))}}}break;case"meta":{if(this.currentTrack)break;const t=0!==vT(e);this.currentMetadataKeys=new Map,t?this.readContiguousBoxes(e.slice(z,B.contentSize)):this.readContiguousBoxes(e.slice(z+4,B.contentSize-4)),this.currentMetadataKeys=null}break;case"keys":{if(!this.currentMetadataKeys)break;e.skip(4);const t=vT(e);for(let n=0;n<t;n++){const t=vT(e);e.skip(4);const i=Dw.decode(dT(e,t-8));this.currentMetadataKeys.set(n+1,i)}}break;case"ilst":{if(!this.currentMetadataKeys)break;const t=this.iterateContiguousBoxes(e.slice(z,B.contentSize));for(const{boxInfo:e,slice:n}of t){var he,fe,pe,me,ve;let t=e.name;const i=(t.charCodeAt(0)<<24)+(t.charCodeAt(1)<<16)+(t.charCodeAt(2)<<8)+t.charCodeAt(3);this.currentMetadataKeys.has(i)&&(t=this.currentMetadataKeys.get(i));const r=j_(n);switch(null!==(fe=(he=this.metadataTags).raw)&&void 0!==fe||(he.raw={}),null!==(ve=(pe=this.metadataTags.raw)[me=t])&&void 0!==ve||(pe[me]=r),t){case"©nam":case"titl":case"com.apple.quicktime.title":case"title":"string"==typeof r&&(null!==(y=(g=this.metadataTags).title)&&void 0!==y||(g.title=r));break;case"©des":case"desc":case"dscp":case"com.apple.quicktime.description":case"description":"string"==typeof r&&(null!==(k=(b=this.metadataTags).description)&&void 0!==k||(b.description=r));break;case"©ART":case"com.apple.quicktime.artist":case"artist":"string"==typeof r&&(null!==(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!==(A=(S=this.metadataTags).comment)&&void 0!==A||(S.comment=r));break;case"©gen":case"gnre":case"com.apple.quicktime.genre":case"genre":"string"==typeof r&&(null!==(M=(N=this.metadataTags).genre)&&void 0!==M||(N.genre=r));break;case"©lyr":case"lyrics":"string"==typeof r&&(null!==(C=(F=this.metadataTags).lyrics)&&void 0!==C||(F.lyrics=r));break;case"©day":case"rldt":case"com.apple.quicktime.creationdate":case"date":if("string"==typeof r){var ge,ye;const e=new Date(r);Number.isNaN(e.getTime())||null!==(ye=(ge=this.metadataTags).date)&&void 0!==ye||(ge.date=e)}break;case"covr":case"com.apple.quicktime.artwork":r instanceof i_?(null!==(P=(O=this.metadataTags).images)&&void 0!==P||(O.images=[]),this.metadataTags.images.push({data:r.data,kind:"coverFront",mimeType:r.mimeType})):r instanceof Uint8Array&&(null!==(D=(R=this.metadataTags).images)&&void 0!==D||(R.images=[]),this.metadataTags.images.push({data:r,kind:"coverFront",mimeType:"image/*"}));break;case"track":if("string"==typeof r){var be,ke,xe,we;const e=r.split("/"),t=Number.parseInt(e[0],10),n=e[1]&&Number.parseInt(e[1],10);Number.isInteger(t)&&t>0&&(null!==(ke=(be=this.metadataTags).trackNumber)&&void 0!==ke||(be.trackNumber=t)),n&&Number.isInteger(n)&&n>0&&(null!==(we=(xe=this.metadataTags).tracksTotal)&&void 0!==we||(xe.tracksTotal=n))}break;case"trkn":if(r instanceof Uint8Array&&r.length>=6){var _e,Te,Ie,Ee;const e=Rw(r),t=e.getUint16(2,!1),n=e.getUint16(4,!1);t>0&&(null!==(Te=(_e=this.metadataTags).trackNumber)&&void 0!==Te||(_e.trackNumber=t)),n>0&&(null!==(Ee=(Ie=this.metadataTags).tracksTotal)&&void 0!==Ee||(Ie.tracksTotal=n))}break;case"disc":case"disk":if(r instanceof Uint8Array&&r.length>=6){var Se,Ae,Ne,Me;const e=Rw(r),t=e.getUint16(2,!1),n=e.getUint16(4,!1);t>0&&(null!==(Ae=(Se=this.metadataTags).discNumber)&&void 0!==Ae||(Se.discNumber=t)),n>0&&(null!==(Me=(Ne=this.metadataTags).discsTotal)&&void 0!==Me||(Ne.discsTotal=n))}}}}}var Fe,Ce;return e.filePos=W,!0}}class V_{constructor(e){this.internalTrack=e,this.packetToSampleIndex=new WeakMap,this.packetToFragmentLocation=new WeakMap}getId(){return this.internalTrack.id}getNumber(){const e=this.internalTrack.demuxer,t=this.internalTrack.inputTrack.type;let n=0;for(const i of e.tracks)if(i.inputTrack.type===t&&n++,i===this.internalTrack)break;return n}getCodec(){throw new Error("Not implemented on base class.")}getInternalCodecId(){return this.internalTrack.internalCodecId}getName(){return this.internalTrack.name}getLanguageCode(){return this.internalTrack.languageCode}getTimeResolution(){return this.internalTrack.timescale}getDisposition(){return this.internalTrack.disposition}async computeDuration(){var e,t;const n=await this.getPacket(1/0,{metadataOnly:!0});return(null!==(e=null==n?void 0:n.timestamp)&&void 0!==e?e:0)+(null!==(t=null==n?void 0:n.duration)&&void 0!==t?t:0)}async getFirstTimestamp(){var e;const t=await this.getFirstPacket({metadataOnly:!0});return null!==(e=null==t?void 0:t.timestamp)&&void 0!==e?e:0}async getFirstPacket(e){const t=await this.fetchPacketForSampleIndex(0,e);return t||!this.internalTrack.demuxer.isFragmented?t:this.performFragmentedLookup(null,(e=>e.trackData.get(this.internalTrack.id)?{sampleIndex:0,correctSampleFound:!0}:{sampleIndex:-1,correctSampleFound:!1}),-1/0,1/0,e)}mapTimestampIntoTimescale(e){return(e=>{const t=Math.round(e);return Math.abs(e/t-1)<10*Number.EPSILON?t:e})(e*this.internalTrack.timescale)+this.internalTrack.editListOffset}async getPacket(e,t){const n=this.mapTimestampIntoTimescale(e),i=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),r=K_(i,n),o=await this.fetchPacketForSampleIndex(r,t);return eT(i)&&this.internalTrack.demuxer.isFragmented?this.performFragmentedLookup(null,(e=>{const t=e.trackData.get(this.internalTrack.id);if(!t)return{sampleIndex:-1,correctSampleFound:!1};const i=Hw(t.presentationTimestamps,n,(e=>e.presentationTimestamp));return{sampleIndex:-1!==i?t.presentationTimestamps[i].sampleIndex:-1,correctSampleFound:-1!==i&&n<t.endTimestamp}}),n,n,t):o}async getNextPacket(e,t){const n=this.packetToSampleIndex.get(e);if(void 0!==n)return this.fetchPacketForSampleIndex(n+1,t);const i=this.packetToFragmentLocation.get(e);if(void 0===i)throw new Error("Packet was not created from this track.");return this.performFragmentedLookup(i.fragment,(e=>{if(e===i.fragment){const t=e.trackData.get(this.internalTrack.id);if(i.sampleIndex+1<t.samples.length)return{sampleIndex:i.sampleIndex+1,correctSampleFound:!0}}else if(e.trackData.get(this.internalTrack.id))return{sampleIndex:0,correctSampleFound:!0};return{sampleIndex:-1,correctSampleFound:!1}}),-1/0,1/0,t)}async getKeyPacket(e,t){const n=this.mapTimestampIntoTimescale(e),i=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),r=X_(i,n),o=await this.fetchPacketForSampleIndex(r,t);return eT(i)&&this.internalTrack.demuxer.isFragmented?this.performFragmentedLookup(null,(e=>{const t=e.trackData.get(this.internalTrack.id);if(!t)return{sampleIndex:-1,correctSampleFound:!1};const i=((e,t)=>{for(let n=e.length-1;n>=0;n--)if(t(e[n]))return n;return-1})(t.presentationTimestamps,(e=>t.samples[e.sampleIndex].isKeyFrame&&e.presentationTimestamp<=n));return{sampleIndex:-1!==i?t.presentationTimestamps[i].sampleIndex:-1,correctSampleFound:-1!==i&&n<t.endTimestamp}}),n,n,t):o}async getNextKeyPacket(e,t){const n=this.packetToSampleIndex.get(e);if(void 0!==n){const e=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),i=Q_(e,n);return this.fetchPacketForSampleIndex(i,t)}const i=this.packetToFragmentLocation.get(e);if(void 0===i)throw new Error("Packet was not created from this track.");return this.performFragmentedLookup(i.fragment,(e=>{if(e===i.fragment){const t=e.trackData.get(this.internalTrack.id).samples.findIndex(((e,t)=>e.isKeyFrame&&t>i.sampleIndex));if(-1!==t)return{sampleIndex:t,correctSampleFound:!0}}else{const t=e.trackData.get(this.internalTrack.id);if(t&&null!==t.firstKeyFrameTimestamp){const e=t.samples.findIndex((e=>e.isKeyFrame));return Fw(-1!==e),{sampleIndex:e,correctSampleFound:!0}}}return{sampleIndex:-1,correctSampleFound:!1}}),-1/0,1/0,t)}async fetchPacketForSampleIndex(e,t){if(-1===e)return null;const n=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),i=Y_(n,e);if(!i)return null;let r;if(t.metadataOnly)r=N_;else{let e=this.internalTrack.demuxer.reader.requestSlice(i.sampleOffset,i.sampleSize);e instanceof Promise&&(e=await e),Fw(e),r=dT(e,i.sampleSize)}const o=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,s=i.duration/this.internalTrack.timescale,a=new M_(r,i.isKeyFrame?"key":"delta",o,s,e,i.sampleSize);return this.packetToSampleIndex.set(a,e),a}async fetchPacketInFragment(e,t,n){if(-1===t)return null;const i=e.trackData.get(this.internalTrack.id).samples[t];let r;if(Fw(i),n.metadataOnly)r=N_;else{let e=this.internalTrack.demuxer.reader.requestSlice(i.byteOffset,i.byteSize);e instanceof Promise&&(e=await e),Fw(e),r=dT(e,i.byteSize)}const o=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,s=i.duration/this.internalTrack.timescale,a=new M_(r,i.isKeyFrame?"key":"delta",o,s,e.moofOffset+t,i.byteSize);return this.packetToFragmentLocation.set(a,{fragment:e,sampleIndex:t}),a}async performFragmentedLookup(e,t,n,i,r){var o,s;const a=this.internalTrack.demuxer;let l=null,c=null,u=-1;if(e){const{sampleIndex:n,correctSampleFound:i}=t(e);if(i)return this.fetchPacketInFragment(e,n,r);-1!==n&&(c=e,u=n)}const d=Hw(this.internalTrack.fragmentLookupTable,n,(e=>e.timestamp)),h=-1!==d?this.internalTrack.fragmentLookupTable[d]:null,f=Hw(this.internalTrack.fragmentPositionCache,n,(e=>e.startTimestamp)),p=-1!==f?this.internalTrack.fragmentPositionCache[f]:null,m=Math.max(null!==(o=null==h?void 0:h.moofOffset)&&void 0!==o?o:0,null!==(s=null==p?void 0:p.moofOffset)&&void 0!==s?s:0)||null;let v;for(e?null===m||e.moofOffset>=m?(v=e.moofOffset+e.moofSize,l=e):v=m:v=null!=m?m:0;;){if(l){const e=l.trackData.get(this.internalTrack.id);if(e&&e.startTimestamp>i)break}let e=a.reader.requestSliceRange(v,8,16);if(e instanceof Promise&&(e=await e),!e)break;const n=v,o=B_(e);if(!o)break;if("moof"===o.name){l=await a.readFragment(n);const{sampleIndex:e,correctSampleFound:i}=t(l);if(i)return this.fetchPacketInFragment(l,e,r);-1!==e&&(c=l,u=e)}v=n+o.totalSize}if(h&&(!c||c.moofOffset<h.moofOffset)){var g;const e=this.internalTrack.fragmentLookupTable[d-1];Fw(!e||e.timestamp<h.timestamp);const n=null!==(g=null==e?void 0:e.timestamp)&&void 0!==g?g:-1/0;return this.performFragmentedLookup(null,t,n,i,r)}return c?this.fetchPacketInFragment(c,u,r):null}}class G_ extends V_{constructor(e){super(e),this.decoderConfigPromise=null,this.internalTrack=e}getCodec(){return this.internalTrack.info.codec}getCodedWidth(){return this.internalTrack.info.width}getCodedHeight(){return this.internalTrack.info.height}getSquarePixelWidth(){return this.internalTrack.info.squarePixelWidth}getSquarePixelHeight(){return this.internalTrack.info.squarePixelHeight}getRotation(){return this.internalTrack.rotation}async getColorSpace(){var e,t,n,i;return{primaries:null===(e=this.internalTrack.info.colorSpace)||void 0===e?void 0:e.primaries,transfer:null===(t=this.internalTrack.info.colorSpace)||void 0===t?void 0:t.transfer,matrix:null===(n=this.internalTrack.info.colorSpace)||void 0===n?void 0:n.matrix,fullRange:null===(i=this.internalTrack.info.colorSpace)||void 0===i?void 0:i.fullRange}}async canBeTransparent(){return!1}async getDecoderConfig(){var e;return this.internalTrack.info.codec?null!==(e=this.decoderConfigPromise)&&void 0!==e?e:this.decoderConfigPromise=(async(e,t)=>{if("vp9"!==this.internalTrack.info.codec||this.internalTrack.info.vp9CodecInfo){if("av1"===this.internalTrack.info.codec&&!this.internalTrack.info.av1CodecInfo){const e=await this.getFirstPacket({});this.internalTrack.info.av1CodecInfo=e&&(e=>{for(const{type:t,data:n}of __(e)){if(1!==t)continue;const e=new o_(n),i=e.readBits(3);e.readBits(1);const r=e.readBits(1);let o=0,s=0,a=0;if(r)o=e.readBits(5);else{if(e.readBits(1)&&(e.skipBits(32),e.skipBits(32),e.readBits(1)))return null;const t=e.readBits(1);t&&(a=e.readBits(5),e.skipBits(32),e.skipBits(5),e.skipBits(5));const n=e.readBits(5);for(let i=0;i<=n;i++){e.skipBits(12);const n=e.readBits(5);if(0===i&&(o=n),n>7){const t=e.readBits(1);0===i&&(s=t)}if(t&&e.readBits(1)){const t=a+1;e.skipBits(t),e.skipBits(t),e.skipBits(1)}e.readBits(1)&&e.skipBits(4)}}const l=e.readBits(4),c=e.readBits(4),u=l+1;e.skipBits(u);const d=c+1;e.skipBits(d);let h=0;if(h=r?0:e.readBits(1),h&&(e.skipBits(4),e.skipBits(3)),e.skipBits(1),e.skipBits(1),e.skipBits(1),!r){e.skipBits(1),e.skipBits(1),e.skipBits(1),e.skipBits(1);const t=e.readBits(1);t&&(e.skipBits(1),e.skipBits(1));let n=0;n=e.readBits(1)?2:e.readBits(1),n>0&&(e.readBits(1)||e.skipBits(1)),t&&e.skipBits(3)}e.skipBits(1),e.skipBits(1),e.skipBits(1);const f=e.readBits(1);let p=8;2===i&&f?p=e.readBits(1)?12:10:i<=2&&(p=f?10:8);let m=0;1!==i&&(m=e.readBits(1));let v=1,g=1,y=0;return m||(0===i?(v=1,g=1):1===i?(v=0,g=0):12===p&&(v=e.readBits(1),v&&(g=e.readBits(1))),v&&g&&(y=e.readBits(2))),{profile:i,level:o,tier:s,bitDepth:p,monochrome:m,chromaSubsamplingX:v,chromaSubsamplingY:g,chromaSamplePosition:y}}return null})(e.data)}}else{const e=await this.getFirstPacket({});this.internalTrack.info.vp9CodecInfo=e&&(e=>{const t=new o_(e);if(2!==t.readBits(2))return null;const n=t.readBits(1),i=(t.readBits(1)<<1)+n;if(3===i&&t.skipBits(1),1===t.readBits(1))return null;if(0!==t.readBits(1))return null;if(t.skipBits(2),4817730!==t.readBits(24))return null;let r=8;i>=2&&(r=t.readBits(1)?12:10);const o=t.readBits(3);let s=0,a=0;if(7!==o)if(a=t.readBits(1),1===i||3===i){const e=t.readBits(1),n=t.readBits(1);s=e||n?e&&!n?2:1:3,t.skipBits(1)}else s=1;else s=3,a=1;const l=(t.readBits(16)+1)*(t.readBits(16)+1);let c=Cw(u_).level;for(const e of u_)if(l<=e.maxPictureSize){c=e.level;break}return{profile:i,level:c,bitDepth:r,chromaSubsampling:s,videoFullRangeFlag:a,colourPrimaries:2===o?1:1===o?6:2,transferCharacteristics:2===o?1:1===o?6:2,matrixCoefficients:7===o?0:2===o?1:1===o?6:2}})(e.data)}return{codec:d_(this.internalTrack.info),codedWidth:this.internalTrack.info.width,codedHeight:this.internalTrack.info.height,displayAspectWidth:this.internalTrack.info.squarePixelWidth,displayAspectHeight:this.internalTrack.info.squarePixelHeight,description:null!==(e=this.internalTrack.info.codecDescription)&&void 0!==e?e:void 0,colorSpace:null!==(t=this.internalTrack.info.colorSpace)&&void 0!==t?t:void 0}})():null}}class H_ extends V_{constructor(e){super(e),this.decoderConfig=null,this.internalTrack=e}getCodec(){return this.internalTrack.info.codec}getNumberOfChannels(){return this.internalTrack.info.numberOfChannels}getSampleRate(){return this.internalTrack.info.sampleRate}async getDecoderConfig(){var e,t;return this.internalTrack.info.codec?null!==(e=this.decoderConfig)&&void 0!==e?e:this.decoderConfig={codec:h_(this.internalTrack.info),numberOfChannels:this.internalTrack.info.numberOfChannels,sampleRate:this.internalTrack.info.sampleRate,description:null!==(t=this.internalTrack.info.codecDescription)&&void 0!==t?t:void 0}:null}}const K_=(e,t)=>{if(e.presentationTimestamps){const n=Hw(e.presentationTimestamps,t,(e=>e.presentationTimestamp));return-1===n?-1:e.presentationTimestamps[n].sampleIndex}{const n=Hw(e.sampleTimingEntries,t,(e=>e.startDecodeTimestamp));if(-1===n)return-1;const i=e.sampleTimingEntries[n];return i.startIndex+Math.min(Math.floor((t-i.startDecodeTimestamp)/i.delta),i.count-1)}},X_=(e,t)=>{if(!e.keySampleIndices)return K_(e,t);if(e.presentationTimestamps){const n=Hw(e.presentationTimestamps,t,(e=>e.presentationTimestamp));if(-1===n)return-1;for(let t=n;t>=0;t--){const n=e.presentationTimestamps[t].sampleIndex;if(-1!==Gw(e.keySampleIndices,n,(e=>e)))return n}return-1}{var n;const i=K_(e,t),r=Hw(e.keySampleIndices,i,(e=>e));return null!==(n=e.keySampleIndices[r])&&void 0!==n?n:-1}},Y_=(e,t)=>{const n=Hw(e.sampleTimingEntries,t,(e=>e.startIndex)),i=e.sampleTimingEntries[n];if(!i||i.startIndex+i.count<=t)return null;let r=i.startDecodeTimestamp+(t-i.startIndex)*i.delta;const o=Hw(e.sampleCompositionTimeOffsets,t,(e=>e.startIndex)),s=e.sampleCompositionTimeOffsets[o];s&&t-s.startIndex<s.count&&(r+=s.offset);const a=e.sampleSizes[Math.min(t,e.sampleSizes.length-1)],l=Hw(e.sampleToChunk,t,(e=>e.startSampleIndex)),c=e.sampleToChunk[l];Fw(c);const u=c.startChunkIndex+Math.floor((t-c.startSampleIndex)/c.samplesPerChunk),d=e.chunkOffsets[u],h=c.startSampleIndex+(u-c.startChunkIndex)*c.samplesPerChunk;let f=0,p=d;if(1===e.sampleSizes.length)p+=a*(t-h),f+=a*c.samplesPerChunk;else for(let n=h;n<h+c.samplesPerChunk;n++){const i=e.sampleSizes[n];n<t&&(p+=i),f+=i}let m=i.delta;if(e.presentationTimestamps){const n=e.presentationTimestampIndexMap[t];Fw(void 0!==n),n<e.presentationTimestamps.length-1&&(m=e.presentationTimestamps[n+1].presentationTimestamp-r)}return{presentationTimestamp:r,duration:m,sampleOffset:p,sampleSize:a,chunkOffset:d,chunkSize:f,isKeyFrame:!e.keySampleIndices||-1!==Gw(e.keySampleIndices,t,(e=>e))}},Q_=(e,t)=>{var n;if(!e.keySampleIndices)return t+1;const i=Hw(e.keySampleIndices,t,(e=>e));return null!==(n=e.keySampleIndices[i+1])&&void 0!==n?n:-1},J_=(e,t)=>{e.startTimestamp+=t,e.endTimestamp+=t;for(const n of e.samples)n.presentationTimestamp+=t;for(const n of e.presentationTimestamps)n.presentationTimestamp+=t},Z_=e=>{const[t,,,n]=e,i=Math.hypot(t,n),r=t/i,o=n/i,s=-Math.atan2(o,r)*(180/Math.PI);return Number.isFinite(s)?s:0},eT=e=>0===e.sampleSizes.length;class tT{}class nT extends tT{async _getMajorBrand(e){let t=e._reader.requestSlice(0,12);return t instanceof Promise&&(t=await t),t?(t.skip(4),"ftyp"!==xT(t,4)?null:xT(t,4)):null}_createDemuxer(e){return new q_(e)}}const iT=new class extends nT{async _canReadInput(e){const t=await this._getMajorBrand(e);return!!t&&"qt "!==t}get name(){return"MP4"}get mimeType(){return"video/mp4"}};class rT{constructor(){this._disposed=!1,this._sizePromise=null,this.onread=null}async getSizeOrNull(){var e;if(this._disposed)throw new aT;return null!==(e=this._sizePromise)&&void 0!==e?e:this._sizePromise=Promise.resolve(this._retrieveSize())}async getSize(){if(this._disposed)throw new aT;const e=await this.getSizeOrNull();if(null===e)throw new Error("Cannot determine the size of an unsized source.");return e}}class oT extends rT{constructor(e,t={}){var n;if(!(e instanceof ReadableStream))throw new TypeError("stream must be a ReadableStream.");if(!t||"object"!=typeof t)throw new TypeError("options must be an object.");if(void 0!==t.maxCacheSize&&(!n_(t.maxCacheSize)||t.maxCacheSize<0))throw new TypeError("options.maxCacheSize, when provided, must be a non-negative number.");super(),this._reader=null,this._cache=[],this._pendingSlices=[],this._currentIndex=0,this._targetIndex=0,this._maxRequestedIndex=0,this._endIndex=null,this._pulling=!1,this._stream=e,this._maxCacheSize=null!==(n=t.maxCacheSize)&&void 0!==n?n:16777216}_retrieveSize(){return this._endIndex}_read(e,t){if(null!==this._endIndex&&t>this._endIndex)return null;this._maxRequestedIndex=Math.max(this._maxRequestedIndex,t);const n=Hw(this._cache,e,(e=>e.start)),i=-1!==n?this._cache[n]:null;if(i&&i.start<=e&&t<=i.end)return{bytes:i.bytes,view:i.view,offset:i.start};let r=e;const o=new Uint8Array(t-e);if(-1!==n)for(let i=n;i<this._cache.length;i++){const n=this._cache[i];if(n.start>=t)break;const s=Math.max(e,n.start);s>r&&this._throwDueToCacheMiss();const a=Math.min(t,n.end);s<a&&(o.set(n.bytes.subarray(s-n.start,a-n.start),s-e),r=a)}if(r===t)return{bytes:o,view:Rw(o),offset:e};this._currentIndex>r&&this._throwDueToCacheMiss();const{promise:s,resolve:a,reject:l}=Kw();return this._pendingSlices.push({start:e,end:t,bytes:o,resolve:a,reject:l}),this._targetIndex=Math.max(this._targetIndex,t),this._pulling||(this._pulling=!0,this._pull().catch((e=>{if(this._pulling=!1,!(this._pendingSlices.length>0))throw e;this._pendingSlices.forEach((t=>t.reject(e))),this._pendingSlices.length=0}))),s}_throwDueToCacheMiss(){throw new Error("Read is before the cached region. With ReadableStreamSource, you must access the data more sequentially or increase the size of its cache.")}async _pull(){for(null!==(e=this._reader)&&void 0!==e||(this._reader=this._stream.getReader());this._currentIndex<this._targetIndex&&!this._disposed;){var e;const{done:t,value:n}=await this._reader.read();if(t){for(const e of this._pendingSlices)e.resolve(null);this._pendingSlices.length=0,this._endIndex=this._currentIndex;break}const i=this._currentIndex,r=this._currentIndex+n.byteLength;for(let e=0;e<this._pendingSlices.length;e++){const t=this._pendingSlices[e],o=Math.max(i,t.start),s=Math.min(r,t.end);o<s&&(t.bytes.set(n.subarray(o-i,s-i),o-t.start),s===t.end&&(t.resolve({bytes:t.bytes,view:Rw(t.bytes),offset:t.start}),this._pendingSlices.splice(e,1),e--))}for(this._cache.push({start:i,end:r,bytes:n,view:Rw(n),age:0});this._cache.length>0;){const e=this._cache[0];if(this._maxRequestedIndex-e.end<=this._maxCacheSize)break;this._cache.shift()}this._currentIndex+=n.byteLength}this._pulling=!1}_dispose(){this._pendingSlices.length=0,this._cache.length=0}}null!==(ct=Symbol.dispose)&&void 0!==ct||(Symbol.dispose=Symbol("Symbol.dispose"));class sT{get disposed(){return this._disposed}constructor(e){if(this._demuxerPromise=null,this._format=null,this._disposed=!1,!e||"object"!=typeof e)throw new TypeError("options must be an object.");if(!Array.isArray(e.formats)||e.formats.some((e=>!(e instanceof tT))))throw new TypeError("options.formats must be an array of InputFormat.");if(!(e.source instanceof rT))throw new TypeError("options.source must be a Source.");if(e.source._disposed)throw new Error("options.source must not be disposed.");this._formats=e.formats,this._source=e.source,this._reader=new lT(e.source)}_getDemuxer(){var e;return null!==(e=this._demuxerPromise)&&void 0!==e?e:this._demuxerPromise=(async()=>{this._reader.fileSize=await this._source.getSizeOrNull();for(const e of this._formats)if(await e._canReadInput(this))return this._format=e,e._createDemuxer(this);throw new Error("Input has an unsupported or unrecognizable format.")})()}get source(){return this._source}async getFormat(){return await this._getDemuxer(),Fw(this._format),this._format}async computeDuration(){return(await this._getDemuxer()).computeDuration()}async getFirstTimestamp(){const e=await this.getTracks();if(0===e.length)return 0;const t=await Promise.all(e.map((e=>e.getFirstTimestamp())));return Math.min(...t)}async getTracks(){return(await this._getDemuxer()).getTracks()}async getVideoTracks(){return(await this.getTracks()).filter((e=>e.isVideoTrack()))}async getAudioTracks(){return(await this.getTracks()).filter((e=>e.isAudioTrack()))}async getPrimaryVideoTrack(){var e;return null!==(e=(await this.getTracks()).find((e=>e.isVideoTrack())))&&void 0!==e?e:null}async getPrimaryAudioTrack(){var e;return null!==(e=(await this.getTracks()).find((e=>e.isAudioTrack())))&&void 0!==e?e:null}async getMimeType(){return(await this._getDemuxer()).getMimeType()}async getMetadataTags(){return(await this._getDemuxer()).getMetadataTags()}dispose(){this._disposed||(this._disposed=!0,this._source._disposed=!0,this._source._dispose())}[Symbol.dispose](){this.dispose()}}class aT extends Error{constructor(e="Input has been disposed."){super(e),this.name="InputDisposedError"}}class lT{constructor(e){this.source=e}requestSlice(e,t){if(this.source._disposed)throw new aT;if(e<0)return null;if(null!==this.fileSize&&e+t>this.fileSize)return null;const n=e+t,i=this.source._read(e,n);return i instanceof Promise?i.then((t=>t?new cT(t.bytes,t.view,t.offset,e,n):null)):i?new cT(i.bytes,i.view,i.offset,e,n):null}requestSliceRange(e,t,n){if(this.source._disposed)throw new aT;if(e<0)return null;if(null!==this.fileSize)return this.requestSlice(e,Yw(this.fileSize-e,t,n));{const i=this.requestSlice(e,n),r=i=>{if(i)return i;const r=i=>(Fw(null!==i),this.requestSlice(e,Yw(i-e,t,n))),o=this.source._retrieveSize();return o instanceof Promise?o.then(r):r(o)};return i instanceof Promise?i.then(r):r(i)}}}class cT{constructor(e,t,n,i,r){this.bytes=e,this.view=t,this.offset=n,this.start=i,this.end=r,this.bufferPos=i-n}static tempFromBytes(e){return new cT(e,Rw(e),0,0,e.length)}get length(){return this.end-this.start}get filePos(){return this.offset+this.bufferPos}set filePos(e){this.bufferPos=e-this.offset}get remainingLength(){return Math.max(this.end-this.filePos,0)}skip(e){this.bufferPos+=e}slice(e,t=this.end-e){if(e<this.start||e+t>this.end)throw new RangeError("Slicing outside of original slice.");return new cT(this.bytes,this.view,this.offset,e,e+t)}}const uT=(e,t)=>{if(e.filePos<e.start||e.filePos+t>e.end)throw new RangeError(`Tried reading [${e.filePos}, ${e.filePos+t}), but slice is [${e.start}, ${e.end}). This is likely an internal error, please report it alongside the file that caused it.`)},dT=(e,t)=>{uT(e,t);const n=e.bytes.subarray(e.bufferPos,e.bufferPos+t);return e.bufferPos+=t,n},hT=e=>(uT(e,1),e.view.getUint8(e.bufferPos++)),fT=e=>{uT(e,2);const t=e.view.getUint16(e.bufferPos,!1);return e.bufferPos+=2,t},pT=e=>{uT(e,3);const t=Xw(e.view,e.bufferPos);return e.bufferPos+=3,t},mT=e=>{uT(e,2);const t=e.view.getInt16(e.bufferPos,!1);return e.bufferPos+=2,t},vT=e=>{uT(e,4);const t=e.view.getUint32(e.bufferPos,!1);return e.bufferPos+=4,t},gT=e=>{uT(e,4);const t=e.view.getInt32(e.bufferPos,!1);return e.bufferPos+=4,t},yT=e=>4294967296*vT(e)+vT(e),bT=e=>4294967296*gT(e)+vT(e),kT=e=>{uT(e,8);const t=e.view.getFloat64(e.bufferPos,!1);return e.bufferPos+=8,t},xT=(e,t)=>{uT(e,t);let n="";for(let i=0;i<t;i++)n+=String.fromCharCode(e.bytes[e.bufferPos++]);return n};var wT=new WeakMap,_T=new WeakMap,TT=new WeakMap,IT=new WeakMap,ET=new WeakMap,ST=new WeakMap,AT=new WeakMap,NT=new WeakMap,MT=new WeakMap,FT=new WeakMap,CT=new WeakMap,OT=new WeakMap,PT=new WeakMap,RT=new WeakMap,DT=new WeakMap,LT=new WeakSet;class BT extends rd{constructor(...e){super(...e),O(this,LT),F(this,wT,null),F(this,_T,null),F(this,TT,null),F(this,IT,null),F(this,ET,!1),F(this,ST,!1),F(this,AT,!1),F(this,NT,!1),F(this,MT,void 0),F(this,FT,null),F(this,CT,null),F(this,OT,!1),F(this,PT,!1),F(this,RT,null),F(this,DT,!1)}get name(){return"FMP4Demuxer"}get defaults(){return{}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"pushChunk","endOfStream"])}pushChunk(e,t={}){if(M(AT,this)||M(NT,this))return;const n=e instanceof Uint8Array?e:new Uint8Array(e),i=!!t.isInit;C(FT,this,A(LT,this,qT).call(this,n,t,i)),i&&(C(MT,this,n),C(CT,this,null),this.trigger("demux:init",{data:n})),A(LT,this,jT).call(this);try{var r;const e=null===(r=M(wT,this))||void 0===r?void 0:r.write(n);e&&"function"==typeof e.catch&&e.catch((e=>{A(LT,this,VT).call(this,e)}))}catch(e){if(M(AT,this)||A(LT,this,zT).call(this,e))return;return this.log.warn("[FMP4Demuxer] mediabunny demux failed",e),void A(LT,this,VT).call(this,e)}const o=A(LT,this,KT).call(this);o&&"function"==typeof o.catch&&o.catch((e=>{A(LT,this,VT).call(this,e)}))}endOfStream(){if(M(NT,this))return;if(M(OT,this))return;let e;C(OT,this,!0),C(PT,this,!1),C(DT,this,!1);try{var t;e=null===(t=M(wT,this))||void 0===t?void 0:t.close()}catch(t){e=Promise.resolve()}let n=!1;A(LT,this,$T).call(this),C(RT,this,setTimeout((()=>{C(RT,this,null),n||M(PT,this)||M(NT,this)||A(LT,this,UT).call(this)}),20)),Promise.resolve(e).catch((()=>{})).finally((()=>{n=!0,A(LT,this,$T).call(this),A(LT,this,UT).call(this)}))}onDispose(){super.onDispose(),C(NT,this,!0);try{var e,t;null===(e=M(TT,this))||void 0===e||null===(t=e.close)||void 0===t||t.call(e)}catch(e){}this.endOfStream();try{var n,i;null===(n=M(_T,this))||void 0===n||null===(i=n.dispose)||void 0===i||i.call(n)}catch(e){}C(TT,this,null),C(_T,this,null),C(AT,this,!1),C(FT,this,null),C(IT,this,null),C(ET,this,!1),C(ST,this,!1),C(OT,this,!1),C(PT,this,!1),C(DT,this,!1),A(LT,this,$T).call(this)}}function zT(e){return!!M(NT,this)&&(!e||("InputDisposedError"===(null==e?void 0:e.name)||("string"==typeof(null==e?void 0:e.message)?e.message:"").includes("Input has been disposed")))}function WT(){try{var e,t;const n=null===(e=M(wT,this))||void 0===e||null===(t=e.close)||void 0===t?void 0:t.call(e);n&&"function"==typeof n.catch&&n.catch((()=>{}))}catch(e){}C(wT,this,null)}function $T(){null!==M(RT,this)&&(clearTimeout(M(RT,this)),C(RT,this,null))}function UT(){if(M(PT,this)||M(NT,this)||M(AT,this))return;if(C(PT,this,!0),M(ST,this))return void C(DT,this,!0);C(DT,this,!1);const e=A(LT,this,KT).call(this);e&&"function"==typeof e.catch&&e.catch((e=>{A(LT,this,VT).call(this,e)}))}function jT(){if(M(_T,this)&&M(wT,this))return;const e=ad.TransformStream;if(void 0===e)throw new Error("TransformStream is not available in this environment");const{readable:t,writable:n}=new e;C(wT,this,n.getWriter()),C(_T,this,new sT({source:new oT(t),formats:[iT]})),C(ET,this,!1)}function qT(e,t,n){const i={isInit:n,byteLength:(null==e?void 0:e.byteLength)||0};return"number"==typeof t.loaded&&(i.loaded=t.loaded),"number"==typeof t.total&&(i.total=t.total),"number"==typeof t.pts&&(i.pts=t.pts),"number"==typeof t.dts&&(i.dts=t.dts),"number"==typeof t.duration&&(i.duration=t.duration),"boolean"==typeof t.isKey&&(i.isKey=t.isKey),i}function VT(e){if(M(AT,this)||A(LT,this,zT).call(this,e))return;if(A(LT,this,HT).call(this,e))return void C(ET,this,!1);C(AT,this,!0),A(LT,this,WT).call(this);try{var t,n;null===(t=M(TT,this))||void 0===t||null===(n=t.close)||void 0===n||n.call(t)}catch(e){}C(TT,this,null);try{var i,r;null===(i=M(_T,this))||void 0===i||null===(r=i.dispose)||void 0===r||r.call(i)}catch(e){}C(_T,this,null);const o={error:e,recoverable:!1,severity:"fatal",streamClosed:M(OT,this),streamFinalized:M(PT,this)};M(FT,this)&&(o.context={...M(FT,this)}),this.trigger("demux:error",o)}function GT(e){if(!e)return!1;const t="string"==typeof(null==e?void 0:e.message)?e.message:"";return!!t&&(t.includes("unsupported or unrecognizable format")||t.includes("No supported tracks found"))}function HT(e){return!!A(LT,this,GT).call(this,e)&&(!M(PT,this)||M(DT,this))}async function KT(){if(!(M(NT,this)||M(AT,this)||M(ET,this)||M(ST,this))){C(ST,this,!0);try{A(LT,this,jT).call(this);const e=await M(_T,this).getPrimaryVideoTrack(),t=e?null:await M(_T,this).getPrimaryAudioTrack(),n=e||t;if(!n)throw new Error("No supported tracks found in MP4");const i=await n.getDecoderConfig(),r=await n.getCodecParameterString(),o=await M(_T,this).getMimeType();this.trigger("demux:init",{...M(MT,this)?{data:M(MT,this)}:{},decoderConfig:i,codec:r,mimeType:o}),C(TT,this,new P_(n)),C(ET,this,!0),C(IT,this,(async()=>{try{for await(const e of M(TT,this).packets()){if(M(NT,this))break;const t="number"==typeof e.timestamp?e.timestamp:0;null===M(CT,this)&&C(CT,this,t);let n=t-M(CT,this);n<0&&(n=0),this.trigger("demux:sample",{data:e.data,pts:n,dts:n,duration:e.duration,isKey:"key"===e.type})}this.trigger("demux:complete")}catch(e){A(LT,this,VT).call(this,e)}})())}catch(e){if(A(LT,this,HT).call(this,e))return;throw e}finally{C(ST,this,!1),!M(DT,this)||M(AT,this)||M(NT,this)||A(LT,this,UT).call(this)}}}const XT=1e6,YT=24e3/1001,QT=new Uint8Array;function JT(e){return e?e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):QT:QT}let ZT=null;const eI={video:(ut=new WeakMap,dt=new WeakMap,ht=new WeakMap,ft=new WeakMap,pt=new WeakMap,mt=new WeakMap,vt=new WeakMap,gt=new WeakMap,yt=new WeakMap,bt=new WeakMap,kt=new WeakMap,xt=new WeakMap,wt=new WeakMap,_t=new WeakMap,Tt=new WeakMap,It=new WeakMap,Et=new WeakMap,St=new WeakMap,At=new WeakMap,Nt=new WeakMap,Mt=new WeakMap,Ft=new WeakMap,Ct=new WeakMap,Ot=new WeakMap,Pt=new WeakMap,Rt=new WeakMap,Dt=new WeakMap,Lt=new WeakMap,Bt=new WeakMap,zt=new WeakMap,Wt=new WeakMap,$t=new WeakMap,Ut=new WeakMap,jt=new WeakMap,qt=new WeakSet,class extends Mw{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(...e){super(...e),O(this,qt),F(this,ut,void 0),F(this,dt,[]),F(this,ht,void 0),F(this,ft,void 0),F(this,pt,void 0),F(this,mt,void 0),F(this,vt,[]),F(this,gt,void 0),F(this,yt,new Map),F(this,bt,!0),F(this,kt,!1),F(this,xt,!1),F(this,wt,!1),F(this,_t,void 0),F(this,Tt,!1),F(this,It,!1),F(this,Et,0),F(this,St,void 0),F(this,At,void 0),F(this,Nt,{}),F(this,Mt,void 0),F(this,Ft,0),F(this,Ct,null),F(this,Ot,!1),F(this,Pt,null),F(this,Rt,void 0),F(this,Dt,0),F(this,Lt,0),F(this,Bt,0),F(this,zt,0),F(this,Wt,!1),F(this,$t,!1),F(this,Ut,.2),F(this,jt,Promise.resolve()),C(ht,this,this.settings.decodedHorizonSeconds||1),C(ft,this,A(qt,this,qI).call(this,this.settings.maxDecodedFrames)),C(pt,this,A(qt,this,GI).call(this,this.settings.maxDecodeQueueSize)),C(Wt,this,Ym()),C($t,this,A(qt,this,DI).call(this,this.settings.convertFramesToBitmapsOnAndroid)),C(Ut,this,A(qt,this,LI).call(this,this.settings.androidFixEndOfSegmentDelta)),C(mt,this,(()=>0)),C(gt,this,(()=>A(qt,this,SI).call(this)));const t=this.settings.demuxerOptions?{FMP4Demuxer:this.settings.demuxerOptions}:{};C(ut,this,new BT(t)),M(ut,this).on("demux:init",(e=>A(qt,this,gI).call(this,e))),M(ut,this).on("demux:sample",(e=>A(qt,this,yI).call(this,e))),M(ut,this).on("demux:complete",(()=>A(qt,this,bI).call(this))),M(ut,this).on("demux:error",(e=>A(qt,this,sI).call(this,e)))}setCurrentTimeProvider(e){"function"==typeof e&&C(mt,this,e)}setTimeOffsetSeconds(e){const t=Number(e);C(Ft,this,Number.isFinite(t)?t:0)}setSeekTargetTimeSeconds(e){const t=Number(e);C(Ct,this,Number.isFinite(t)?t:null),C(Ot,this,!1),C(Pt,this,null)}endOfStream(){M(ut,this)&&"function"==typeof M(ut,this).endOfStream&&M(ut,this).endOfStream()}configure(e){super.configure(e),C(Nt,this,{codec:A(qt,this,KI).call(this,e),width:(null==e?void 0:e.codedWidth)||(null==e?void 0:e.width),height:(null==e?void 0:e.codedHeight)||(null==e?void 0:e.height)}),C(St,this,M(Nt,this).codec)}setSegment(e){this.lastSegment=e,A(qt,this,fI).call(this)}setNodeId(e){C(Rt,this,e)}decode(e){this.setSegment(e);const t=null==e?void 0:e.arrayBuffer;t&&M(ut,this).pushChunk(t,{isInit:!(null==e||!e.isInit)})}async decodeChunk(e,t={}){await M(ut,this).pushChunk(e,{isInit:!!t.isInit,pts:"number"==typeof t.pts?t.pts:void 0,dts:"number"==typeof t.dts?t.dts:void 0,duration:"number"==typeof t.duration?t.duration:void 0,isKey:!!t.isKey,loaded:"number"==typeof t.loaded?t.loaded:void 0,total:"number"==typeof t.total?t.total:void 0})}get decodedFrames(){return M(dt,this).slice()}onDispose(){if(super.onDispose(),A(qt,this,MI).call(this),M(ut,this)&&"function"==typeof M(ut,this).dispose&&M(ut,this).dispose(),C(dt,this,[]),C(vt,this,[]),M(yt,this).clear(),C(Pt,this,null),M(_t,this)&&"function"==typeof M(_t,this).close)try{M(_t,this).close()}catch(e){}C(_t,this,null),C(Tt,this,!1),C(At,this,null),C(St,this,null),C(Rt,this,null),C(jt,this,Promise.resolve()),A(qt,this,fI).call(this)}}),audio:(Vt=new WeakMap,Gt=new WeakMap,Ht=new WeakMap,Kt=new WeakMap,Xt=new WeakMap,Yt=new WeakMap,Qt=new WeakMap,Jt=new WeakSet,class extends Mw{constructor(...e){super(...e),O(this,Jt),F(this,Vt,void 0),F(this,Gt,[]),F(this,Ht,0),F(this,Kt,!1),F(this,Xt,!1),F(this,Yt,void 0),F(this,Qt,0)}get name(){return"WebAudioDecoder"}setSegment(e){C(Yt,this,e)}setTimeOffsetSeconds(e){const t=Number(e);C(Qt,this,Number.isFinite(t)?t:0)}decode(e){if(this.lastSegment=e,!e)return;if(e.isInit)return void C(Vt,this,JT(e.arrayBuffer));const t=e.arrayBuffer;t&&A(Jt,this,iI).call(this,JT(t),!0)}decodeChunk(e,t={}){if(!e)return;if(t.isInit)return void C(Vt,this,JT(e));const n=JT(e);if(!n.length)return;M(Gt,this).push(n),C(Ht,this,M(Ht,this)+n.length);const i=Number(t.loaded),r=Number(t.total);Number.isFinite(i)&&Number.isFinite(r)&&r>0&&i>=r&&A(Jt,this,tI).call(this)}endOfStream(){A(Jt,this,tI).call(this)}onDispose(){super.onDispose(),C(Vt,this,void 0),C(Gt,this,[]),C(Ht,this,0),C(Kt,this,!1),C(Xt,this,!1),C(Yt,this,void 0)}}),image:class extends Mw{#z;#W=0;#$=[];#U=0;#j;get name(){return"ImageDecoder"}setSegment(e){this.#z=e}setTimeOffsetSeconds(e){const t=Number(e);this.#W=Number.isFinite(t)?t:0}decode(e){super.decode(e),e&&(this.#z=e);const t=null==e?void 0:e.arrayBuffer;t instanceof ArrayBuffer&&(this.#$=[new Uint8Array(t)],this.#U=t.byteLength,this.endOfStream())}decodeChunk(e,t={}){if(null!=t&&t.isInit)return;const n=function(e){if(e)return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):ArrayBuffer.isView(e)&&e.buffer?new Uint8Array(e.buffer):void 0}(e);n&&n.length&&(this.#$.push(n),this.#U+=n.length)}async endOfStream(){var e,t,n;if(this.#j)return;if(!(this.#$.length&&this.#U>0))return;const i=new Uint8Array(this.#U);let r=0;for(let e=0;e<this.#$.length;e+=1){const t=this.#$[e];i.set(t,r),r+=t.length}const o=null===(e=this.#z)||void 0===e?void 0:e.chosenRepresentation,s=(null==o?void 0:o.mime)||(null===(t=this.track)||void 0===t?void 0:t.mimeType)||(null===(n=this.track)||void 0===n?void 0:n.mime)||function(e){if(e instanceof Uint8Array&&!(e.byteLength<4))return e.byteLength>=8&&137===e[0]&&80===e[1]&&78===e[2]&&71===e[3]&&13===e[4]&&10===e[5]&&26===e[6]&&10===e[7]?"image/png":255===e[0]&&216===e[1]&&255===e[2]?"image/jpeg":e.byteLength>=6&&71===e[0]&&73===e[1]&&70===e[2]&&56===e[3]?"image/gif":e.byteLength>=12&&82===e[0]&&73===e[1]&&70===e[2]&&70===e[3]&&87===e[8]&&69===e[9]&&66===e[10]&&80===e[11]?"image/webp":void 0}(i);try{var a,l;const e=await async function(e,t){const n=function(e,t){if(!(e&&e.byteLength>0))return;if("function"!=typeof ad.Blob)return;const n="string"==typeof t?t:"";return new ad.Blob([e],n?{type:n}:void 0)}(e,t);if(!n)throw new Error("Image decode requires Blob support");let i;if("function"==typeof ad.Image&&ad.URL&&"function"==typeof ad.URL.createObjectURL&&"function"==typeof ad.URL.revokeObjectURL){const e=ad.URL.createObjectURL(n);try{const t=new ad.Image;return await new Promise(((n,i)=>{t.onload=()=>n(),t.onerror=e=>i(e||new Error("Image decode failed")),t.src=e})),t}catch(e){i=e}finally{ad.URL.revokeObjectURL(e)}}if("function"==typeof ad.createImageBitmap)try{return ad.createImageBitmap(n)}catch(e){i=e}if(i)throw i;throw new Error("No supported image decode mechanism")}(i,s);this.#j=e;const t=function(e){if(!e)return;const t=[[e.naturalWidth,e.naturalHeight],[e.width,e.height],[e.displayWidth,e.displayHeight],[e.videoWidth,e.videoHeight],[e.codedWidth,e.codedHeight]];for(let e=0;e<t.length;e+=1){const[n,i]=t[e],r=Number(n),o=Number(i);if(Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0)return{width:r,height:o}}}(e);t&&o&&(Pg(o.width)||(o.width=t.width),Pg(o.height)||(o.height=t.height)),this.trigger("decoder:frame",{pts:this.#W,duration:Pg(null===(a=this.#z)||void 0===a?void 0:a.duration)?this.#z.duration:null===(l=this.track)||void 0===l?void 0:l.duration,frame:e})}catch(e){this.trigger("decoder:error",{error:e})}}onDispose(){if(super.onDispose(),this.#j&&"function"==typeof this.#j.close)try{this.#j.close()}catch(e){}this.#j=null,this.#$=[],this.#U=0,this.#z=null}}};function tI(){if(M(Kt,this)||M(Xt,this))return;if(!M(Ht,this))return;const e=A(Jt,this,nI).call(this);e.length&&A(Jt,this,iI).call(this,e,!1)}function nI(){const e=M(Vt,this),t=e?e.length:0,n=t+M(Ht,this);if(!n)return QT;const i=new Uint8Array(n);let r=0;t&&(i.set(e,r),r+=t);for(let e=0;e<M(Gt,this).length;e+=1){const t=M(Gt,this)[e];t&&t.length&&(i.set(t,r),r+=t.length)}return i}function iI(e,t){if(M(Kt,this)||M(Xt,this))return;const n=t?A(Jt,this,rI).call(this,e):e;if(!n||!n.length)return;const i=function(){if(ZT)return ZT;const e=ad.AudioContext||ad.webkitAudioContext;return e?(ZT=new e,ZT):null}();if(!i||"function"!=typeof i.decodeAudioData)return void this.trigger("decoder:error",{error:new Error("AudioContext is not available")});const r=n.buffer.slice(0);C(Xt,this,!0),new Promise(((e,t)=>{const n=i.decodeAudioData(r,e,t);n&&"function"==typeof n.then&&n.then(e).catch(t)})).then((e=>{var t;C(Kt,this,!0);const n=Number.isFinite(null==e?void 0:e.duration)?e.duration:Number(null===(t=M(Yt,this))||void 0===t?void 0:t.duration)||void 0;this.trigger("decoder:audio",{audioBuffer:e,pts:M(Qt,this),duration:n})})).catch((e=>{this.trigger("decoder:error",{error:e})})).finally((()=>{C(Gt,this,[]),C(Ht,this,0),C(Xt,this,!1)}))}function rI(e){const t=M(Vt,this);if(!t||!t.length)return e;const n=t.length+e.length,i=new Uint8Array(n);return i.set(t,0),i.set(e,t.length),i}function oI(e,t){var n,i,r,o,s;const a=null!=e&&e.context&&"object"==typeof e.context?e.context:void 0;return{error:t,errorName:null==t?void 0:t.name,errorMessage:"string"==typeof(null==t?void 0:t.message)?t.message:void 0,nodeId:M(Rt,this),trackId:null===(n=this.track)||void 0===n?void 0:n.id,trackType:null===(i=this.track)||void 0===i?void 0:i.type,codec:(null===(r=M(Nt,this))||void 0===r?void 0:r.codec)||M(St,this),segmentId:null===(o=this.lastSegment)||void 0===o?void 0:o.id,segmentIsInit:!(null===(s=this.lastSegment)||void 0===s||!s.isInit),chunkContext:a}}function sI(e){const t=(null==e?void 0:e.error)||e,n=A(qt,this,oI).call(this,e,t);if(A(qt,this,aI).call(this,e,t))return this.log.warn("[onDemuxError] recoverable demux error",n),void A(qt,this,bI).call(this);const i=A(qt,this,vI).call(this,e),r=A(qt,this,lI).call(this,i);if(i&&0===i.missingFrames)return this.log.warn(`[onDemuxError] ignoring demux error (no missing frames)${r}`,{...n,missingFrameStats:i}),void A(qt,this,bI).call(this);let o=n;i&&(o={...n,missingFrameStats:i}),this.log.warn(`[onDemuxError] demux error${r}`,o),this.trigger("decoder:error",e)}function aI(e,t){if("boolean"==typeof(null==e?void 0:e.recoverable))return e.recoverable;const n="string"==typeof(null==e?void 0:e.severity)?e.severity:"";if(n)return"recoverable"===n||"transient"===n;const i="string"==typeof(null==t?void 0:t.message)?t.message:"";return!!i&&(i.includes("unsupported or unrecognizable format")||i.includes("No supported tracks found"))}function lI(e){return e?` expectedFrames=${A(qt,this,cI).call(this,e.expectedFrames)} demuxedFrames=${A(qt,this,cI).call(this,e.demuxedFrames)} missingFrames=${A(qt,this,cI).call(this,e.missingFrames)}`:""}function cI(e){if(null==e)return"unknown";const t=Number(e);return Number.isFinite(t)?String(t):"unknown"}function uI(e,t={}){return{expectedFrames:null,demuxedFrames:M(Dt,this),missingFrames:null,reason:e,...t}}function dI(e){const t=Number(e);return Number.isFinite(t)?t:null}function hI(e){var t,n;const i=(null==e?void 0:e.context)||{},r=Number(i.loaded),o=Number(i.total);if(!Number.isFinite(o)||o<=0||!Number.isFinite(r)||r<o)return null;if(null!==(t=this.lastSegment)&&void 0!==t&&t.isInit)return null;const s=Number(null===(n=this.lastSegment)||void 0===n?void 0:n.duration);if(!Number.isFinite(s)||s<=0)return A(qt,this,uI).call(this,"segment_duration_unavailable",{segmentDurationSeconds:A(qt,this,dI).call(this,s),demuxedCoverageSeconds:M(zt,this),frameDurationSeconds:null});const a=A(qt,this,mI).call(this);if(!Number.isFinite(a)||a<=0){const e=Math.max(1,Math.round(s*YT));return{expectedFrames:e,demuxedFrames:M(Dt,this),missingFrames:Math.max(0,e-M(Dt,this)),reason:"fallback_fps",fallbackFps:YT,segmentDurationSeconds:s,demuxedCoverageSeconds:M(zt,this),frameDurationSeconds:A(qt,this,dI).call(this,a)}}const l=Math.min(.5*a,.02),c=Math.max(0,s-M(zt,this)),u=c<=l?0:c,d=Math.max(1,Math.floor((s+l)/a)),h=Math.max(0,d-M(Dt,this)),f=u>0?Math.ceil(u/a):0;return{expectedFrames:d,demuxedFrames:M(Dt,this),missingFrames:Math.max(h,f),segmentDurationSeconds:s,demuxedCoverageSeconds:M(zt,this),frameDurationSeconds:a}}function fI(){C(Dt,this,0),C(Lt,this,0),C(Bt,this,0),C(zt,this,0)}function pI(e){C(Dt,this,M(Dt,this)+1);const t=Number(null==e?void 0:e.pts),n=Number(null==e?void 0:e.duration);if(Number.isFinite(n)&&n>0&&(C(Lt,this,M(Lt,this)+n),C(Bt,this,M(Bt,this)+1)),!Number.isFinite(t))return;const i=Number.isFinite(n)&&n>0?t+n:t;Number.isFinite(i)&&i>M(zt,this)&&C(zt,this,i)}function mI(){return M(Bt,this)>0?M(Lt,this)/M(Bt,this):M(Dt,this)>0&&M(zt,this)>0?M(zt,this)/M(Dt,this):null}function vI(e){return A(qt,this,hI).call(this,e)}function gI(e){(null==e?void 0:e.data)instanceof Uint8Array&&(C(At,this,e.data.buffer),A(qt,this,CI).call(this)),null!=e&&e.decoderConfig&&(C(Mt,this,e.decoderConfig),C(St,this,e.decoderConfig.codec||M(St,this)),A(qt,this,CI).call(this)),this.trigger("decoder:init",e)}function yI(e){A(qt,this,pI).call(this,e),M(vt,this).push(e),A(qt,this,SI).call(this)}function bI(){C(kt,this,!0),A(qt,this,OI).call(this)}function kI(e){const t="number"==typeof(null==e?void 0:e.pts)?e.pts:void 0;if(Number.isFinite(t))return M(Ft,this)+t}function xI(e){return M(vt,this).some((t=>{const n=A(qt,this,kI).call(this,t);return Number.isFinite(n)&&n>=e}))}function wI(e){let t=-1,n=null;for(let i=0;i<M(vt,this).length;i+=1){const r=M(vt,this)[i],o=A(qt,this,kI).call(this,r);Number.isFinite(o)&&(null==r?void 0:r.isKey)&&o<=e&&(t=i,n=o)}return{chosenIndex:t,chosenPtsSeconds:n}}function _I(e){let t=-1,n=null;for(let i=0;i<M(vt,this).length;i+=1){const r=M(vt,this)[i],o=A(qt,this,kI).call(this,r);if(Number.isFinite(o)&&null!=r&&r.isKey&&(t=i,n=o,o>=e))break}return{chosenIndex:t,chosenPtsSeconds:n}}function TI(e){const t=e+M(ht,this),n=M(Ct,this);if(!Number.isFinite(n))return t;const i=Number.isFinite(M(Pt,this))?M(Pt,this):null;if(Number.isFinite(i))return Math.max(t,i);const{chosenPtsSeconds:r}=A(qt,this,_I).call(this,n);return Number.isFinite(r)?Math.max(t,r):t}function II(e){const t=M(Ct,this);Number.isFinite(t)&&Number.isFinite(e)&&e>=t&&(C(Ct,this,null),C(Pt,this,null))}function EI(){const e=M(Ct,this);if(!Number.isFinite(e)||M(Ot,this))return!0;if(!A(qt,this,xI).call(this,e)&&!M(kt,this))return!1;const t=A(qt,this,wI).call(this,e);let n=t;if(-1===t.chosenIndex&&(n=A(qt,this,_I).call(this,e)),n.chosenIndex>0){const e=`[#maybeAlignToSeekKeyframe] Dropping ${n.chosenIndex} samples before keyframe @ ${n.chosenPtsSeconds}`;this.log.debug(e),M(vt,this).splice(0,n.chosenIndex)}return C(bt,this,!0),Number.isFinite(n.chosenPtsSeconds)&&C(Pt,this,n.chosenPtsSeconds),C(Ot,this,!0),!0}function SI(){const e=M(mt,this)?M(mt,this).call(this):0,t=A(qt,this,TI).call(this,e);if(A(qt,this,UI).call(this,e),A(qt,this,jI).call(this),!A(qt,this,EI).call(this))return void A(qt,this,NI).call(this);const n=void 0!==ad.VideoDecoder&&void 0!==ad.EncodedVideoChunk;for(n&&!M(Tt,this)&&M(Mt,this)&&A(qt,this,CI).call(this);M(vt,this).length&&!A(qt,this,VI).call(this)&&!(n&&M(_t,this)&&A(qt,this,HI).call(this));){const e=M(vt,this)[0],i="number"==typeof(null==e?void 0:e.pts)?e.pts:0,r=M(Ft,this)+i;if(r>t)break;if(null!=e&&e.raw)M(vt,this).shift(),A(qt,this,AI).call(this,e);else{if(n){if(!M(Tt,this)||!M(_t,this))break;if(M(bt,this)&&!e.isKey){M(vt,this).shift();continue}M(vt,this).shift();const t=Math.max(0,Math.round(r*XT));M(yt,this).set(t,!!e.isKey);try{const n=new ad.EncodedVideoChunk({type:e.isKey?"key":"delta",timestamp:t,duration:e.duration?Math.round(e.duration*XT):void 0,data:e.data instanceof Uint8Array?e.data:new Uint8Array(e.data)});M(_t,this).decode(n),e.isKey&&C(bt,this,!1);continue}catch(e){M(yt,this).delete(t);const n="string"==typeof(null==e?void 0:e.message)?e.message:"";if("DataError"===(null==e?void 0:e.name)&&n.includes("key frame")){C(bt,this,!0);continue}this.log.warn("[#drainDecodeQueue] decode failed, falling back to placeholder",e)}}M(vt,this).shift(),A(qt,this,AI).call(this,e)}}A(qt,this,OI).call(this),A(qt,this,NI).call(this)}function AI(e){const t=M(mt,this)?M(mt,this).call(this):0,n=A(qt,this,TI).call(this,t),i=M(Ft,this)+("number"==typeof e.pts?e.pts:0);if(i<t||i>n)return;A(qt,this,UI).call(this,t);const r={pts:i,duration:e.duration,data:e.data,isKey:e.isKey};M(dt,this).push(r),A(qt,this,jI).call(this),this.trigger("decoder:frame",r),A(qt,this,II).call(this,i)}function NI(){if(M(vt,this).length>0&&void 0!==ad.VideoDecoder){if(Vk(M(gt,this)))return;jk(M(gt,this),50)}else A(qt,this,MI).call(this)}function MI(){M(gt,this)&&Vk(M(gt,this))&&qk(M(gt,this))}function FI(){return null!=ad&&ad.performance&&"function"==typeof ad.performance.now?ad.performance.now():Date.now()}function CI(){if(M(Tt,this))return;if(void 0===ad.VideoDecoder)return;if(!M(Mt,this))return;if(M(It,this)&&A(qt,this,FI).call(this)<M(Et,this))return;const e={...M(Mt,this)};!e.codec&&M(St,this)&&(e.codec=M(St,this)),M(At,this)&&!e.description&&(e.description=M(At,this)),M(Nt,this).width&&!e.codedWidth&&(e.codedWidth=M(Nt,this).width),M(Nt,this).height&&!e.codedHeight&&(e.codedHeight=M(Nt,this).height);try{C(_t,this,new ad.VideoDecoder({output:e=>A(qt,this,RI).call(this,e),error:e=>A(qt,this,PI).call(this,e)})),M(_t,this).configure(e),C(Tt,this,!0),C(bt,this,!0),C(It,this,!1),C(Et,this,0),A(qt,this,SI).call(this)}catch(e){this.log.warn("[#maybeConfigureDecoder] configure failed, falling back to placeholder decode",e),C(_t,this,null),C(Tt,this,!1),C(Mt,this,null)}}function OI(){void 0!==ad.VideoDecoder&&void 0!==ad.EncodedVideoChunk&&(M(It,this)||!M(kt,this)||M(wt,this)||M(xt,this)||M(Tt,this)&&M(_t,this)&&"function"==typeof M(_t,this).flush&&(M(vt,this).length||(C(xt,this,!0),Promise.resolve().then((()=>M(_t,this).flush())).then((()=>{C(wt,this,!0),C(bt,this,!0)})).catch((e=>{"AbortError"!==(null==e?void 0:e.name)&&this.log.warn("[#maybeFlushDecoder] flush failed",e)})).finally((()=>{C(xt,this,!1)})))))}function PI(e){if(this.log.warn("[#handleDecoderError] decoder error",e),this.trigger("decoder:error",{error:e}),M(_t,this)&&"function"==typeof M(_t,this).close)try{M(_t,this).close()}catch(e){}C(_t,this,null),C(Tt,this,!1),C(xt,this,!1),C(wt,this,!1),C(bt,this,!0),M(yt,this).clear(),C(It,this,!0),C(Et,this,A(qt,this,FI).call(this)+1e3)}function RI(e){C(jt,this,M(jt,this).then((()=>{var t;if(!this._disposed)return A(qt,this,$I).call(this,e);null===(t=e.close)||void 0===t||t.call(e)})).catch((t=>{this.log.warn("[#enqueueDecodedFrame] failed processing decoded frame",t);try{var n;null===(n=e.close)||void 0===n||n.call(e)}catch(e){}})))}function DI(e){return"boolean"!=typeof e||e}function LI(e){const t=Number(e);return!Number.isFinite(t)||t<0?.2:t}function BI(){return!!M($t,this)&&"function"==typeof ad.createImageBitmap&&M(Wt,this)}function zI(e){var t;const n=Number(null===(t=this.lastSegment)||void 0===t?void 0:t.duration);if(!Number.isFinite(n)||n<=0)return!1;if(!Number.isFinite(e))return!1;const i=Number(M(Ft,this));return!!Number.isFinite(i)&&e>=i+n-M(Ut,this)}async function WI(e,t){try{var n;const i=A(qt,this,zI).call(this,t),r=await ad.createImageBitmap(e,{premultiplyAlpha:i?"none":"default"});return null!==(n=e.close)&&void 0!==n&&n.call(e),r}catch(t){return this.log.debug("[#maybeConvertFrameToBitmap] createImageBitmap failed",t),e}}async function $I(e){var t,n;let i=e;if(this._disposed)return void(null===(t=(n=i).close)||void 0===t||t.call(n));const r="number"==typeof e.timestamp?e.timestamp:void 0,o="number"==typeof e.timestamp?e.timestamp/XT:M(mt,this)?M(mt,this).call(this):0,s="number"==typeof e.duration?e.duration/XT:void 0;let a;void 0!==r&&(a=M(yt,this).get(r),M(yt,this).delete(r));try{var l,c,u,d;let t=M(mt,this)?M(mt,this).call(this):0,n=A(qt,this,TI).call(this,t);if(o<t||o>n)return void(null===(l=(c=i).close)||void 0===l||l.call(c));if(A(qt,this,BI).call(this)){var h,f,p,m;if(i=await A(qt,this,WI).call(this,e,o),this._disposed)return void(null===(h=(f=i).close)||void 0===h||h.call(f));if(t=M(mt,this)?M(mt,this).call(this):0,n=A(qt,this,TI).call(this,t),o<t||o>n)return void(null===(p=(m=i).close)||void 0===p||p.call(m))}if(A(qt,this,UI).call(this,t),this._disposed)return void(null===(u=(d=i).close)||void 0===u||u.call(d));const r={frame:i,pts:o,duration:s,isKey:void 0!==a&&a};M(dt,this).push(r),A(qt,this,jI).call(this),this.trigger("decoder:frame",r),A(qt,this,II).call(this,o),this.log.debug(`[#handleDecodedFrame] [${M(Nt,this).codec}] Decoded frame:`,r)}catch(e){this.log.warn(`[#handleDecodedFrame] [${M(Nt,this).codec}] Failed to handle decoded frame`,e);try{var v,g;null===(v=(g=i).close)||void 0===v||v.call(g)}catch(e){}}}function UI(e){const t=A(qt,this,TI).call(this,e),n=[];M(dt,this).forEach((i=>{var r;const o=null!==(r=null==i?void 0:i.pts)&&void 0!==r?r:0;o<e||o>t||n.push(i)})),C(dt,this,n)}function jI(){const e=M(ft,this);if(!Number.isFinite(e)||e<=0)return;if(M(dt,this).length<=e)return;const t=M(dt,this).length-e;M(dt,this).splice(0,t)}function qI(e){const t=Number(e);return!Number.isFinite(t)||t<=0?0:Math.floor(t)}function VI(){const e=M(ft,this);return!(!Number.isFinite(e)||e<=0)&&M(dt,this).length>=e}function GI(e){const t=Number(e);return!Number.isFinite(t)||t<=0?0:Math.floor(t)}function HI(){var e;const t=M(pt,this);if(!Number.isFinite(t)||t<=0)return!1;const n=Number(null===(e=M(_t,this))||void 0===e?void 0:e.decodeQueueSize);return!!Number.isFinite(n)&&n>=t}function KI(e){if(e&&Array.isArray(e.segments))for(let t=0;t<e.segments.length;t+=1){const n=e.segments[t];if(!Array.isArray(null==n?void 0:n.representations))continue;const i=n.chosenRepresentation||n.representations[0];if(null!=i&&i.codecs)return i.codecs;if(null!=i&&i.mime)return i.mime}}class XI extends rd{get name(){return"DecoderFactory"}create(e,t){if(!e||!e.type)return new Mw(t);const n=eI[e.type];return n?(this.log.debug(`[#create] [${e.type}] Creating decoder:`,n),new n(t)):new Mw(t)}}class YI{#q;#V;#G;#H;constructor(e={}){this.#q=e.getActiveRenderPlacement,this.#V=e.getPlacementsActiveAtTime,this.#G=e.ensureDecodedForPlacementAtTime;const t=Number(e.lookaheadSeconds);this.#H=Number.isFinite(t)&&t>=0?t:1}handleTimeUpdate(e={}){const t=Number(null==e?void 0:e.time);if(!Number.isFinite(t))return;if("function"!=typeof this.#G)return;const n="function"==typeof this.#V?this.#V:()=>[],i=n(t),r=new Set;i.forEach((e=>{null!=e&&e.placementId&&r.add(e.placementId),this.#G(e,t)}));const o=this.#H;if(!(o>0))return;const s=t+o;n(s).forEach((e=>{const t=null==e?void 0:e.placementId;t&&!r.has(t)&&this.#G(e,s)}))}dispose(){}}class QI{#K;#X;#Y;#Q;#J;#Z;constructor(e={}){this.#K=e.getNode,this.#X=e.getPlacementState,this.#Y=e.getDecodeTracks,this.#Q=e.getSegmentIdForTrackAtTime,this.#J=e.decodeLoadedMediaSegment,this.#Z=e.decodeLoadedMediaSegmentsAfter}ensureDecodedForPlacementAtTime(e,t){if(!e||!Number.isFinite(t))return;const n=null==e?void 0:e.placementId,i=null==e?void 0:e.nodeId;if(!n||!i)return;const r="function"==typeof this.#K?this.#K(i):void 0;if(!r)return;const o="function"==typeof this.#X?this.#X(n):void 0,s=null==o?void 0:o.trackStates;s&&"function"==typeof s.get&&("function"==typeof this.#Y?this.#Y(r).filter((e=>"video"===(null==e?void 0:e.type)||"image"===(null==e?void 0:e.type)||"audio"===(null==e?void 0:e.type))):[]).forEach((n=>{var i;const r=s.get(n.id);if(!r)return;const o="function"==typeof this.#Q?this.#Q(n,e,t):null;if(!o)return;const a=null==n||null===(i=n.segments)||void 0===i?void 0:i.find((e=>(null==e?void 0:e.id)===o));a&&!a.isInit&&a.retainedByteLength>0&&a.arrayBuffer&&(r.segmentDecoders&&"function"==typeof r.segmentDecoders.has&&r.segmentDecoders.has(o)||"function"!=typeof this.#J||this.#J(e,n,a),"video"===(null==n?void 0:n.type)&&"function"==typeof this.#Z&&this.#Z(e,n,a))}))}dispose(){}}const JI=new Set(["video","audio","image"]);function ZI(e){const t=Number(e);return Number.isFinite(t)?t:0}var eE=new WeakMap,tE=new WeakMap,nE=new WeakMap,iE=new WeakMap,rE=new WeakMap,oE=new WeakMap,sE=new WeakMap,aE=new WeakMap,lE=new WeakMap,cE=new WeakMap,uE=new WeakMap,dE=new WeakMap,hE=new WeakMap,fE=new WeakMap,pE=new WeakMap,mE=new WeakMap,vE=new WeakMap,gE=new WeakMap,yE=new WeakMap,bE=new WeakSet;class kE extends rd{constructor(...e){super(...e),O(this,bE),F(this,eE,void 0),F(this,tE,void 0),F(this,nE,void 0),F(this,iE,void 0),F(this,rE,void 0),F(this,oE,void 0),F(this,sE,void 0),F(this,aE,void 0),F(this,lE,void 0),F(this,cE,void 0),F(this,uE,void 0),F(this,dE,new Map),F(this,hE,new Map),F(this,fE,new Map),F(this,pE,new Map),F(this,mE,new Set),F(this,vE,0),F(this,gE,!1),F(this,yE,null);const[t,n,i]=e;C(eE,this,t),C(tE,this,n),C(nE,this,i||new XI),C(iE,this,new QI({getNode:e=>A(bE,this,VE).call(this,e),getPlacementState:e=>M(dE,this).get(e),getDecodeTracks:e=>A(bE,this,WE).call(this,e),getSegmentIdForTrackAtTime:(e,t,n)=>A(bE,this,AE).call(this,e,t,n),decodeLoadedMediaSegment:(e,t,n)=>{A(bE,this,dS).call(this,e,t,n)},decodeLoadedMediaSegmentsAfter:(e,t,n)=>{A(bE,this,iS).call(this,e,t,n)}})),C(rE,this,new YI({getActiveRenderPlacement:e=>{var t,n;return null===(t=M(tE,this))||void 0===t||null===(n=t.getActiveRenderPlacement)||void 0===n?void 0:n.call(t,e)},getPlacementsActiveAtTime:e=>{var t,n;return(null===(t=M(tE,this))||void 0===t||null===(n=t.getPlacementsActiveAtTime)||void 0===n?void 0:n.call(t,e))||[]},ensureDecodedForPlacementAtTime:(e,t)=>{var n,i;null===(n=M(iE,this))||void 0===n||null===(i=n.ensureDecodedForPlacementAtTime)||void 0===i||i.call(n,e,t)}})),A(bE,this,xE).call(this),A(bE,this,LE).call(this)}get name(){return"DecodeCoordinator"}onDispose(){var e,t;M(tE,this)&&"function"==typeof M(tE,this).off&&M(oE,this)&&M(tE,this).off(rv.PLACEMENT_ADDED,M(oE,this)),M(tE,this)&&"function"==typeof M(tE,this).off&&M(sE,this)&&M(tE,this).off(rv.TIMELINE_SEEKING,M(sE,this)),M(tE,this)&&"function"==typeof M(tE,this).off&&M(aE,this)&&M(tE,this).off(rv.TIMELINE_SEEKED,M(aE,this)),M(tE,this)&&"function"==typeof M(tE,this).off&&M(lE,this)&&M(tE,this).off(rv.TIMELINE_TIME_UPDATE,M(lE,this)),M(tE,this)&&"function"==typeof M(tE,this).off&&M(cE,this)&&M(tE,this).off(rv.TIMELINE_RESET,M(cE,this)),A(bE,this,wE).call(this),C(oE,this,null),C(sE,this,null),C(aE,this,null),C(lE,this,null),C(cE,this,null),null!==(e=M(iE,this))&&void 0!==e&&null!==(t=e.dispose)&&void 0!==t&&t.call(e),C(iE,this,null),M(rE,this)&&"function"==typeof M(rE,this).dispose&&M(rE,this).dispose(),C(rE,this,null),M(hE,this).forEach(((e,t)=>{const n=A(bE,this,VE).call(this,t);n&&"function"==typeof n.off&&n.off("node:loaded",e)})),M(hE,this).clear(),M(fE,this).forEach(((e,t)=>{const n=A(bE,this,VE).call(this,t);n&&"function"==typeof n.off&&n.off("segment:chunk",e)})),M(fE,this).clear(),M(pE,this).clear(),M(mE,this).clear(),A(bE,this,OE).call(this),M(dE,this).forEach((({trackStates:e})=>{e&&e.forEach((e=>{A(bE,this,XE).call(this,e)}))})),M(dE,this).clear()}}function xE(){M(tE,this)&&"function"==typeof M(tE,this).on&&(C(oE,this,(e=>{A(bE,this,BE).call(this,e)})),M(tE,this).on(rv.PLACEMENT_ADDED,M(oE,this)),C(sE,this,(e=>A(bE,this,_E).call(this,e))),M(tE,this).on(rv.TIMELINE_SEEKING,M(sE,this)),C(aE,this,(()=>A(bE,this,TE).call(this))),M(tE,this).on(rv.TIMELINE_SEEKED,M(aE,this)),C(lE,this,(e=>A(bE,this,IE).call(this,e))),M(tE,this).on(rv.TIMELINE_TIME_UPDATE,M(lE,this)),C(cE,this,(()=>A(bE,this,EE).call(this))),M(tE,this).on(rv.TIMELINE_RESET,M(cE,this))),(null==ad?void 0:ad.document)&&"function"==typeof ad.document.addEventListener&&(C(uE,this,(()=>{A(bE,this,PE).call(this)})),ad.document.addEventListener("visibilitychange",M(uE,this)))}function wE(){M(uE,this)&&null!=ad&&ad.document&&"function"==typeof ad.document.removeEventListener&&ad.document.removeEventListener("visibilitychange",M(uE,this)),C(uE,this,null)}function _E(e={}){const t=Number(null==e?void 0:e.targetTime);Number.isFinite(t)&&(M(dE,this).forEach((e=>{const n=null==e?void 0:e.trackStates;n&&n.forEach((n=>{var i;const r=null==n||null===(i=n.track)||void 0===i?void 0:i.type;"video"!==r&&"image"!==r&&"audio"!==r||(A(bE,this,SE).call(this,n,null==e?void 0:e.placement,t),n.seekSegmentId=null)}))})),(Array.isArray(null==e?void 0:e.placements)?e.placements:[]).forEach((e=>{const n=null==e?void 0:e.placementId,i=null==e?void 0:e.nodeId;if(!n||!i)return;const r=M(dE,this).get(n);if(!r||!r.trackStates)return;const o=A(bE,this,VE).call(this,i);o&&(r.trackStates.forEach((n=>{const i=null==n?void 0:n.track;!i||"video"!==i.type&&"image"!==i.type&&"audio"!==i.type||A(bE,this,SE).call(this,n,r.placement||e,t)})),A(bE,this,nS).call(this,r.placement||e,o))})))}function TE(){M(dE,this).forEach((e=>{const t=null==e?void 0:e.trackStates;t&&t.forEach((e=>{var t;const n=null==e||null===(t=e.track)||void 0===t?void 0:t.type;"video"!==n&&"image"!==n&&"audio"!==n||(e.seekSegmentId=null)}))}))}function IE(e={}){var t,n;A(bE,this,tS).call(this,null==e?void 0:e.time),null!==(t=M(rE,this))&&void 0!==t&&null!==(n=t.handleTimeUpdate)&&void 0!==n&&n.call(t,e),A(bE,this,PE).call(this),A(bE,this,YE).call(this,null==e?void 0:e.time)}function EE(){M(hE,this).forEach(((e,t)=>{const n=A(bE,this,VE).call(this,t);n&&"function"==typeof n.off&&n.off("node:loaded",e)})),M(hE,this).clear(),M(fE,this).forEach(((e,t)=>{const n=A(bE,this,VE).call(this,t);n&&"function"==typeof n.off&&n.off("segment:chunk",e)})),M(fE,this).clear(),M(pE,this).clear(),M(mE,this).clear(),M(dE,this).forEach((({trackStates:e})=>{e&&e.forEach((e=>{const t=null==e?void 0:e.segmentDecoders;t&&t.forEach((e=>{e&&"function"==typeof e.dispose&&e.dispose()}))}))})),M(dE,this).clear()}function SE(e,t,n){e&&(A(bE,this,XE).call(this,e),e.seekSegmentId=A(bE,this,AE).call(this,e.track,t,n))}function AE(e,t,n){if(!e||!t||!Array.isArray(e.segments))return null;const i=am(t);if(!Number.isFinite(i))return null;const r=ZI(null==t?void 0:t.nodeOffsetOverride),o=Math.max(0,n-i+r),s=ZI(null==e?void 0:e.offset),a=Math.max(0,o-s),l="function"==typeof e.getMediaSegmentAtTime?e.getMediaSegmentAtTime(a,{preferRepresentationTime:!0}):qy(e.segments,a,{preferRepresentationTime:!0});return(null==l?void 0:l.id)||null}function NE(e){if(!e)return!1;const t=null==e?void 0:e.name;if("QuotaExceededError"===t)return!0;if("EncodingError"===t)return!0;const n="string"==typeof(null==e?void 0:e.message)?e.message:"";return!!n.includes("Decoder failure")||!!n.includes("Codec reclaimed due to inactivity")||!("OperationError"!==t||!n.includes("initialize after flush"))}function ME(){const e=null==ad?void 0:ad.document;return!e||"string"!=typeof e.visibilityState||"visible"===e.visibilityState}function FE(){var e;const t=M(tE,this);if(!t||"number"!=typeof t.currentTime)return!1;if(t.state===fv)return!1;const n=Date.now();if(n<M(vE,this))return!1;const i=t.currentTime;if(!Number.isFinite(i))return!1;const r="function"==typeof t.getPlacementsActiveAtTime?t.getPlacementsActiveAtTime(i):[],o=Number(null==t||null===(e=t.settings)||void 0===e?void 0:e.snapToFps),s=Number.isFinite(o)&&o>0?1/o:1/60;let a;if(Array.isArray(r)&&r.length)a=i+s;else if(a=A(bE,this,CE).call(this,i),!Number.isFinite(a))return!1;return C(vE,this,n+1500),this.log.warn("[DecodeCoordinator] attempting decoder recovery seek"),t.currentTime=a,!0}function CE(e){var t;const n=M(tE,this);if(!n)return null;const i=Array.isArray(n.placements)?n.placements:[];if(!i.length)return null;const r=Number(e);if(!Number.isFinite(r))return null;const o=Number(null==n||null===(t=n.settings)||void 0===t?void 0:t.snapToFps),s=Number.isFinite(o)&&o>0?1/o:1/60;let a=Number.NEGATIVE_INFINITY,l=null,c=Number.NEGATIVE_INFINITY,u=null,d=null;return i.forEach((e=>{const t=am(e);if(!Number.isFinite(t))return;(!Number.isFinite(d)||t<d)&&(d=t);const n=om(e,M(eE,this)),i=Number.isFinite(n),o=i?t+n:t;(o>t||!i)&&((o>a||!Number.isFinite(a)&&Number.isFinite(o))&&(a=o,l=t),o<=r&&o>c&&(c=o,u=i?Math.max(t,o-s):t))})),Number.isFinite(l)&&Number.isFinite(a)&&r>=a-s?l:Number.isFinite(u)?u:Number.isFinite(d)?d:null}function OE(){C(gE,this,!1),C(yE,this,null)}function PE(){M(gE,this)&&A(bE,this,ME).call(this)&&A(bE,this,FE).call(this)}function RE(e){if(!A(bE,this,NE).call(this,e))return;const t=M(tE,this);t&&"number"==typeof t.currentTime&&(C(gE,this,!0),C(yE,this,e),A(bE,this,ME).call(this)&&A(bE,this,FE).call(this))}function DE(e){var t;return!!e&&(Array.isArray(null===(t=M(tE,this))||void 0===t?void 0:t.placements)?M(tE,this).placements:[]).includes(e)}function LE(e){var t;(Array.isArray(null===(t=M(tE,this))||void 0===t?void 0:t.placements)?[...M(tE,this).placements]:[]).filter((t=>"function"!=typeof e||e(t))).sort(((e,t)=>{const n=am(e),i=am(t);return(Number.isFinite(n)?n:Number.POSITIVE_INFINITY)-(Number.isFinite(i)?i:Number.POSITIVE_INFINITY)})).forEach((e=>{A(bE,this,BE).call(this,e)}))}async function BE(e){if(!e||!e.placementId||M(dE,this).has(e.placementId))return;if(!A(bE,this,DE).call(this,e))return;const t=e.nodeId;if(!t||!M(eE,this)||"function"!=typeof M(eE,this).get)return;const n=A(bE,this,VE).call(this,t);if(n){if(n.state&&"ready"!==n.state){if("function"==typeof n.resolve)try{await n.resolve()}catch(n){if(!A(bE,this,DE).call(this,e))return;return void this.log.warn(`[#processPlacement] Failed to resolve node ${t}`,n)}if(!A(bE,this,DE).call(this,e))return;if("ready"!==n.state)return}if(A(bE,this,eS).call(this,e))return A(bE,this,ZE).call(this,e,n),void M(mE,this).add(e.placementId);A(bE,this,JE).call(this,e,n)}}function zE(e){return A(bE,this,WE).call(this,e).every((e=>A(bE,this,QE).call(this,e)))}function WE(e){return(Array.isArray(null==e?void 0:e.tracks)?e.tracks:[]).filter((e=>JI.has(null==e?void 0:e.type)))}function $E(e){if(!e||!e.id||"function"!=typeof e.on)return;if(M(hE,this).has(e.id))return;const t=()=>{A(bE,this,rS).call(this,e.id)};e.on("node:loaded",t),M(hE,this).set(e.id,t)}function UE(e){if(!e||!e.id||"function"!=typeof e.on)return;if(M(fE,this).has(e.id))return;const t=e=>A(bE,this,oS).call(this,e);e.on("segment:chunk",t),M(fE,this).set(e.id,t)}function jE(e,t){if(!e||!t)return;const n=M(pE,this).get(e)||new Set;n.add(t),M(pE,this).set(e,n)}function qE(e){return M(pE,this).get(e)||new Set}function VE(e){if(e&&M(eE,this)&&"function"==typeof M(eE,this).get)return M(eE,this).get(e)}function GE(e){if(!e)return;const t=e.fullBufferRetryTimer;null!=t&&("function"==typeof(null==ad?void 0:ad.clearTimeout)?ad.clearTimeout.bind(ad):clearTimeout)(t),e.fullBufferRetryTimer=null,e.fullBufferDecodeScheduled=!1,e.fullBufferRetryAttempts=0}function HE(e){const t=null==e?void 0:e.segmentStates;t&&"function"==typeof t.forEach&&t.forEach((e=>{A(bE,this,GE).call(this,e)}))}function KE(e,t,n,i){var r,o;if(!(e&&t&&n&&i))return!1;const s=M(dE,this).get(e),a=null==s||null===(r=s.trackStates)||void 0===r?void 0:r.get(t);return(null==a||null===(o=a.segmentStates)||void 0===o?void 0:o.get(n))===i}function XE(e){if(!e)return;A(bE,this,HE).call(this,e);const t=e.segmentDecoders;t&&"function"==typeof t.forEach&&(t.forEach((e=>{if(e&&"function"==typeof e.dispose)try{e.dispose()}catch(e){}})),"function"==typeof t.clear&&t.clear()),e.segmentStates&&"function"==typeof e.segmentStates.clear&&e.segmentStates.clear(),e.ready=!1,e.seekSegmentId=null}function YE(e){const t=ZI(e);if(!Number.isFinite(t))return;const n=t-2;Number.isFinite(n)&&M(dE,this).forEach((e=>{const t=null==e?void 0:e.placement;if(!t)return;const i=am(t),r=om(t,M(eE,this),{allowUnready:!0});if(!Number.isFinite(i)||!Number.isFinite(r))return;const o=i+r;if(!Number.isFinite(o)||o>n)return;const s=null==e?void 0:e.trackStates;s&&"function"==typeof s.forEach&&s.forEach((e=>{var t;const n=null==e||null===(t=e.track)||void 0===t?void 0:t.type;"video"!==n&&"image"!==n&&"audio"!==n||A(bE,this,XE).call(this,e)}))}))}function QE(e){if(!e||!Array.isArray(e.segments))return!1;const t=e.segments.find((e=>null==e?void 0:e.isInit));if(t&&!(t.retainedByteLength>0))return!1;const n=e.segments.find((e=>e&&!e.isInit));return!n||n.retainedByteLength>0}function JE(e,t){if(this.log.debug(`[#startDecode] [${e.placementId}] [${t.id}] Starting decode`),A(bE,this,ZE).call(this,e,t)){if(A(bE,this,jE).call(this,t.id,e.placementId),!A(bE,this,zE).call(this,t))return A(bE,this,$E).call(this,t),void A(bE,this,UE).call(this,t);A(bE,this,nS).call(this,e,t),A(bE,this,UE).call(this,t)}}function ZE(e,t){if(!e||!e.placementId||!t)return;const n=M(dE,this).get(e.placementId);if(n)return n.placement=e,n;const i=A(bE,this,WE).call(this,t),r=new Map;i.forEach((n=>{try{const e=n.segments.some((e=>null==e?void 0:e.isInit));r.set(n.id,{hasInit:e,track:n,ready:!1,segmentDecoders:new Map,segmentStates:new Map})}catch(i){this.trigger(rv.DECODE_ERROR,av({placementId:e.placementId,nodeId:t.id,trackId:null==n?void 0:n.id,trackType:null==n?void 0:n.type,error:i}))}}));const o={trackStates:r,nodeId:t.id,placement:e};return M(dE,this).set(e.placementId,o),o}function eS(e){var t;const n=am(e),i=ZI(null===(t=M(tE,this))||void 0===t?void 0:t.currentTime);return!Number.isFinite(n)||!!Number.isFinite(i)&&n-i>2}function tS(e){if(!M(mE,this).size)return;const t=ZI(e);if(!Number.isFinite(t))return;const n=[];M(mE,this).forEach((e=>{const i=M(dE,this).get(e),r=null==i?void 0:i.placement;if(!r)return void n.push(e);const o=am(r);Number.isFinite(o)&&o-t<=2&&n.push(e)})),n.forEach((e=>{M(mE,this).delete(e);const t=M(dE,this).get(e),n=null==t?void 0:t.placement;if(!n)return;const i=A(bE,this,VE).call(this,n.nodeId);i&&A(bE,this,JE).call(this,n,i)}))}function nS(e,t){const n=M(dE,this).get(e.placementId);n&&A(bE,this,WE).call(this,t).forEach((i=>{const r=n.trackStates.get(i.id);if(r&&!r.ready)try{let n;if(r.seekSegmentId&&(n=i.segments.find((e=>e&&!e.isInit&&e.id===r.seekSegmentId&&e.retainedByteLength>0)),!n))return;if(n||(n=i.segments.find((e=>e&&!e.isInit&&e.retainedByteLength>0))),!n)return;A(bE,this,dS).call(this,e,i,n),r.seekSegmentId&&"video"===(null==i?void 0:i.type)&&A(bE,this,iS).call(this,e,i,n),r.ready=!0,this.trigger(rv.DECODE_READY,sv({placementId:e.placementId,nodeId:t.id,trackId:i.id,trackType:i.type}))}catch(n){this.trigger(rv.DECODE_ERROR,av({placementId:e.placementId,nodeId:t.id,trackId:null==i?void 0:i.id,trackType:null==i?void 0:i.type,error:n}))}}))}function iS(e,t,n){var i;if(!(e&&t&&n&&Array.isArray(t.segments)))return;const r=null==e?void 0:e.placementId,o=r?M(dE,this).get(r):void 0,s=null==o||null===(i=o.trackStates)||void 0===i?void 0:i.get(t.id),a=null==s?void 0:s.segmentDecoders;if(!a||"function"!=typeof a.has)return;const l=t.segments,c=l.findIndex((e=>(null==e?void 0:e.id)===n.id));if(c<0)return;let u=0;for(let n=c+1;n<l.length;n+=1){const i=l[n];if(!i||i.isInit)continue;if(a.has(i.id))continue;if(!(i.retainedByteLength>0))break;const r=i.arrayBuffer;if(!r||"number"!=typeof r.byteLength||r.byteLength<=0)break;if(A(bE,this,dS).call(this,e,t,i),u+=1,u>=2)break}}function rS(e){const t=A(bE,this,VE).call(this,e);t&&A(bE,this,zE).call(this,t)&&A(bE,this,qE).call(this,e).forEach((e=>{const n=M(dE,this).get(e);A(bE,this,nS).call(this,(null==n?void 0:n.placement)||{placementId:e},t)}))}function oS(e){e&&e.nodeId&&e.trackId&&e.chunk&&A(bE,this,qE).call(this,e.nodeId).forEach((t=>A(bE,this,sS).call(this,t,e)))}function sS(e,t){const n=M(dE,this).get(e);if(!n)return;const i=n.trackStates.get(t.trackId);if(i)try{var r,o;if(t.isInit)return;const s=i.track,a=null==s||null===(r=s.segments)||void 0===r?void 0:r.find((e=>(null==e?void 0:e.id)===t.segmentId));if(!a||a.isInit)return;if("image"===(null==s?void 0:s.type))return void(!i.ready&&a.retainedByteLength>0&&A(bE,this,dS).call(this,n.placement,s,a)&&(i.ready=!0,this.trigger(rv.DECODE_READY,sv({placementId:e,nodeId:t.nodeId,trackId:t.trackId,trackType:t.trackType}))));if((null===(o=M(tE,this))||void 0===o?void 0:o.state)===fv&&i.seekSegmentId&&("video"===(null==s?void 0:s.type)||"audio"===(null==s?void 0:s.type))&&a.id!==i.seekSegmentId)return;const l=a.id,c=i.segmentStates.get(l)||{initSent:!1,pendingChunks:[],ended:!1,firstChunkObserved:!1,missedSegmentPrefix:!1,fullBufferDecodeScheduled:!1,fullBufferRetryTimer:null,fullBufferRetryAttempts:0};i.segmentStates.set(l,c);const u=A(bE,this,cS).call(this,n.placement,s,a);if(!u||"function"!=typeof u.decodeChunk)return;if(i.hasInit&&!c.initSent){const e=A(bE,this,uS).call(this,s,a);if(!e)return void c.pendingChunks.push({chunk:t.chunk,loaded:t.loaded,total:t.total});u.decodeChunk(e,{isInit:!0}),c.initSent=!0,c.pendingChunks.length&&(c.pendingChunks.forEach((e=>{u.decodeChunk(e.chunk,{isInit:!1,loaded:e.loaded,total:e.total})})),c.pendingChunks=[])}const d="number"==typeof t.loaded&&"number"==typeof t.total&&t.total>0&&t.loaded>=t.total;A(bE,this,aS).call(this,c,t)?d&&!c.ended&&A(bE,this,lS).call(this,n.placement,s,a,c):(u.decodeChunk(t.chunk,{isInit:!1,loaded:t.loaded,total:t.total}),d&&!c.ended&&"function"==typeof u.endOfStream&&(c.ended=!0,u.endOfStream())),i.ready||(i.ready=!0,this.trigger(rv.DECODE_READY,sv({placementId:e,nodeId:t.nodeId,trackId:t.trackId,trackType:t.trackType})))}catch(n){this.trigger(rv.DECODE_ERROR,av({placementId:e,nodeId:t.nodeId,trackId:t.trackId,trackType:t.trackType,error:n}))}}function aS(e,t){var n;if(!e||e.missedSegmentPrefix)return!(null==e||!e.missedSegmentPrefix);if(e.firstChunkObserved)return!1;e.firstChunkObserved=!0;const i=Number(null==t?void 0:t.loaded),r=Number(null==t||null===(n=t.chunk)||void 0===n?void 0:n.byteLength);return!(!Number.isFinite(i)||!Number.isFinite(r)||r<=0)&&(e.missedSegmentPrefix=i>r,e.missedSegmentPrefix)}function lS(e,t,n,i){if(!e||!t||!n||!i||i.fullBufferDecodeScheduled)return;const r=null==e?void 0:e.placementId,o=null==t?void 0:t.id,s=null==n?void 0:n.id;if(!r||!o||!s)return;const a="function"==typeof(null==ad?void 0:ad.setTimeout)?ad.setTimeout.bind(ad):setTimeout;i.fullBufferDecodeScheduled=!0,i.fullBufferRetryAttempts=0;const l=()=>{if(!A(bE,this,KE).call(this,r,o,s,i)||i.ended)return void A(bE,this,GE).call(this,i);if(A(bE,this,dS).call(this,e,t,n))return void A(bE,this,GE).call(this,i);i.fullBufferRetryAttempts+=1;const c=i.fullBufferRetryAttempts<=8?0:50;i.fullBufferRetryTimer=a((()=>{l()}),c)};i.fullBufferRetryTimer=a((()=>{l()}),0)}function cS(e,t,n){var i,r;const o=null==e?void 0:e.placementId;if(!o||!t||!n)return;const s=M(dE,this).get(o),a=null==s||null===(i=s.trackStates)||void 0===i?void 0:i.get(t.id);if(!a)return;const l=a.segmentDecoders.get(n.id);if(l)return l;const c=M(nE,this).create(t);if(c&&"function"==typeof c.configure&&c.configure(t),c&&"function"==typeof c.setNodeId&&c.setNodeId(null==e?void 0:e.nodeId),c&&"function"==typeof c.setSegment&&c.setSegment(n),c&&"function"==typeof c.setCurrentTimeProvider&&c.setCurrentTimeProvider((()=>{var e;return"number"==typeof(null===(e=M(tE,this))||void 0===e?void 0:e.currentTime)?M(tE,this).currentTime:0})),c&&"function"==typeof c.setTimeOffsetSeconds){var u,d;const i=am(e),r=ZI(null==t?void 0:t.offset),o=ZI(null!==(u=null==n||null===(d=n.chosenRepresentation)||void 0===d?void 0:d.segStart)&&void 0!==u?u:null==n?void 0:n.offset);Number.isFinite(i)&&c.setTimeOffsetSeconds(i+r+o)}return c&&"function"==typeof c.setSeekTargetTimeSeconds&&(null===(r=M(tE,this))||void 0===r?void 0:r.state)===fv&&"video"===(null==t?void 0:t.type)&&c.setSeekTargetTimeSeconds(M(tE,this).currentTime),c&&"function"==typeof c.on&&(c.on(rv.DECODER_FRAME,(i=>{i&&(!M(gE,this)||"video"!==(null==t?void 0:t.type)&&"image"!==(null==t?void 0:t.type)||(C(gE,this,!1),C(yE,this,null)),M(tE,this)&&"function"==typeof M(tE,this).notifyDecodedFrame&&(i.frame||i.data)&&M(tE,this).notifyDecodedFrame({placementId:o,nodeId:null==e?void 0:e.nodeId,trackId:null==t?void 0:t.id,trackType:null==t?void 0:t.type,segmentId:null==n?void 0:n.id,pts:i.pts,duration:i.duration,frame:i.frame,data:i.data}))})),c.on(rv.DECODER_AUDIO,(i=>{i&&i.audioBuffer&&this.trigger(rv.DECODER_AUDIO,sv({placementId:o,nodeId:null==e?void 0:e.nodeId,trackId:null==t?void 0:t.id,trackType:null==t?void 0:t.type,segmentId:null==n?void 0:n.id,pts:i.pts,duration:i.duration,audioBuffer:i.audioBuffer}))})),c.on(rv.DECODER_ERROR,(i=>{const r=(null==i?void 0:i.error)||i;this.trigger(rv.DECODER_ERROR,av({placementId:o,nodeId:null==e?void 0:e.nodeId,trackId:null==t?void 0:t.id,trackType:null==t?void 0:t.type,segmentId:null==n?void 0:n.id,error:r})),A(bE,this,RE).call(this,r)}))),a.segmentDecoders.set(n.id,c),c}function uS(e,t){var n,i;if(!e||!t||!Array.isArray(e.segments))return;const r=e.segments.find((e=>null==e?void 0:e.isInit));if(!r||"function"!=typeof r.getRepresentationBuffer)return;const o=(null==t||null===(n=t.chosenRepresentation)||void 0===n?void 0:n.id)||(null==t||null===(i=t.representations)||void 0===i||null===(i=i[0])||void 0===i?void 0:i.id);if(!o)return;const s=r.getRepresentationBuffer(o);return s?s instanceof Uint8Array?s:new Uint8Array(s):void 0}function dS(e,t,n){var i;if(!e||!t||!n)return!1;const r=e.placementId,o=M(dE,this).get(r),s=null==o||null===(i=o.trackStates)||void 0===i?void 0:i.get(t.id);if(!s)return!1;const a=A(bE,this,cS).call(this,e,t,n);if(!a||"function"!=typeof a.decodeChunk)return!1;const l=s.segmentStates.get(n.id)||{initSent:!1,pendingChunks:[],ended:!1,firstChunkObserved:!1,missedSegmentPrefix:!1,fullBufferDecodeScheduled:!1,fullBufferRetryTimer:null,fullBufferRetryAttempts:0};if(s.segmentStates.set(n.id,l),l.ended)return A(bE,this,GE).call(this,l),!0;if(s.hasInit&&!l.initSent){const e=A(bE,this,uS).call(this,t,n);if(!e)return!1;a.decodeChunk(e,{isInit:!0}),l.initSent=!0}const c=n.arrayBuffer;return!(!c||"number"!=typeof c.byteLength||c.byteLength<=0||(a.decodeChunk(new Uint8Array(c),{isInit:!1,loaded:c.byteLength,total:c.byteLength}),l.ended||"function"!=typeof a.endOfStream||(l.ended=!0,a.endOfStream()),A(bE,this,GE).call(this,l),0))}const hS=1e-6;var fS=new WeakMap,pS=new WeakMap,mS=new WeakMap,vS=new WeakMap,gS=new WeakMap,yS=new WeakMap,bS=new WeakMap,kS=new WeakMap,xS=new WeakSet;class wS extends rd{get name(){return"TransitionManager"}get defaults(){return{durationSeconds:.5}}constructor(e,t,n){super(n),O(this,xS),F(this,fS,void 0),F(this,pS,void 0),F(this,mS,null),F(this,vS,null),F(this,gS,null),F(this,yS,0),F(this,bS,[]),F(this,kS,null),C(fS,this,e),C(pS,this,t),M(fS,this)&&"function"==typeof M(fS,this).on&&(C(kS,this,(()=>A(xS,this,FS).call(this))),M(fS,this).on(rv.TIMELINE_RESET,M(kS,this)))}transitionTo(e,t={}){const n=Number(e);if(!Number.isFinite(n))throw new Error("TransitionManager.transitionTo requires a numeric time");A(xS,this,FS).call(this);const i=A(xS,this,_S).call(this),r=A(xS,this,SS).call(this,n,t);return r?A(xS,this,AS).call(this,n,t,i,r):Promise.resolve()}onDispose(){M(fS,this)&&"function"==typeof M(fS,this).off&&M(kS,this)&&M(fS,this).off(rv.TIMELINE_RESET,M(kS,this)),C(kS,this,null),A(xS,this,FS).call(this),C(pS,this,null),C(fS,this,null)}}function _S(){return C(yS,this,M(yS,this)+1),M(yS,this)}function TS(e={}){var t;const n=Number(null==e?void 0:e.duration),i=Number(null===(t=this.settings)||void 0===t?void 0:t.durationSeconds);return Number.isFinite(n)?n:i}function IS(e={},t){return{duration:t,filter:null==e?void 0:e.filter,color:null==e?void 0:e.color,filters:null==e?void 0:e.filters,reverseFilters:null==e?void 0:e.reverseFilters,transition:null==e?void 0:e.transition}}function ES(e,t){const n=1e3*e,i=Number.isFinite(Number(null==t?void 0:t.outDurationMs))&&t.outDurationMs>0?t.outDurationMs:n;return{outDurationMs:i,inDurationMs:Number.isFinite(Number(null==t?void 0:t.inDurationMs))&&t.inDurationMs>0?t.inDurationMs:i}}function SS(e,t={}){var n;const i=M(pS,this),r=A(xS,this,TS).call(this,t);if(!i||"function"!=typeof i.startTransition)return M(fS,this).currentTime=e,null;if(!(r>0))return M(fS,this).currentTime=e,null!==(n=i.resetTransition)&&void 0!==n&&n.call(i),null;const o=A(xS,this,IS).call(this,t,r);"function"==typeof(null==t?void 0:t.onTransitionInStart)&&t.onTransitionInStart();const s=i.startTransition(o),{outDurationMs:a,inDurationMs:l}=A(xS,this,ES).call(this,r,s);return{renderer:i,transitionOptions:o,outDurationMs:a,inDurationMs:l,shouldWaitForFrames:!1!==(null==t?void 0:t.waitForVisualFrames)}}function AS(e,t={},n,i){const{renderer:r,transitionOptions:o,outDurationMs:s,inDurationMs:a,shouldWaitForFrames:l}=i,c=A(xS,this,DS).call(this,e,t,n),u=l?A(xS,this,LS).call(this,e,n):Promise.resolve();let d=!1,h=!1,f=!1,p=!l;const m=()=>{var e;A(xS,this,CS).call(this,n)&&!f&&d&&h&&p&&(f=!0,"function"==typeof(null==t?void 0:t.onTransitionInEnd)&&t.onTransitionInEnd(),"function"==typeof(null==t?void 0:t.onTransitionOutStart)&&t.onTransitionOutStart(),null!==(e=r.beginTransitionIn)&&void 0!==e&&e.call(r,o),C(vS,this,setTimeout((()=>{var e;A(xS,this,CS).call(this,n)&&(null!==(e=r.resetTransition)&&void 0!==e&&e.call(r),"function"==typeof(null==t?void 0:t.onTransitionOutEnd)&&t.onTransitionOutEnd(),A(xS,this,NS).call(this))}),a)))};return C(mS,this,setTimeout((()=>{d=!0,m()}),s)),c.then((()=>{h=!0,m()})).catch((()=>{var e;A(xS,this,CS).call(this,n)&&(null!==(e=r.resetTransition)&&void 0!==e&&e.call(r),A(xS,this,NS).call(this))})),u.then((()=>{p=!0,m()})).catch((()=>{p=!0,m()})),M(fS,this).currentTime=e,new Promise((e=>{C(gS,this,e)}))}function NS(){const e=M(gS,this);C(gS,this,null),A(xS,this,MS).call(this),A(xS,this,RS).call(this),e&&e()}function MS(){M(mS,this)&&clearTimeout(M(mS,this)),M(vS,this)&&clearTimeout(M(vS,this)),C(mS,this,null),C(vS,this,null)}function FS(){var e,t;M(pS,this)&&null!==(e=(t=M(pS,this)).resetTransition)&&void 0!==e&&e.call(t),A(xS,this,MS).call(this),A(xS,this,RS).call(this),M(gS,this)&&(M(gS,this).call(this),C(gS,this,null))}function CS(e){return M(yS,this)===e}function OS(e,t){M(fS,this)&&"function"==typeof M(fS,this).on&&(M(fS,this).on(e,t),M(bS,this).push({eventName:e,handler:t}))}function PS(e,t){M(fS,this)&&"function"==typeof M(fS,this).off&&(M(fS,this).off(e,t),C(bS,this,M(bS,this).filter((n=>n.eventName!==e||n.handler!==t))))}function RS(){M(fS,this)&&"function"==typeof M(fS,this).off?(M(bS,this).forEach((e=>{M(fS,this).off(e.eventName,e.handler)})),C(bS,this,[])):C(bS,this,[])}function DS(e,t,n){const i=null==t?void 0:t.transitionOutPromise;if(i&&"function"==typeof i.then)return i;if("function"==typeof i)try{const e=i();if(e&&"function"==typeof e.then)return e}catch(e){return Promise.resolve()}if(!M(fS,this)||"function"!=typeof M(fS,this).on)return Promise.resolve();const r=A(xS,this,BS).call(this);return new Promise((t=>{let i=!1;const o=r?rv.TIMELINE_SEEKED:"nodestart";let s,a;const l=()=>{A(xS,this,PS).call(this,rv.TIMELINE_SEEKING,s),A(xS,this,PS).call(this,o,a),t()};s=(t={})=>{A(xS,this,CS).call(this,n)?A(xS,this,zS).call(this,t,e)&&(i=!0):l()},a=(t={})=>{A(xS,this,CS).call(this,n)?(o!==rv.TIMELINE_SEEKED||A(xS,this,zS).call(this,t,e))&&(o===rv.TIMELINE_SEEKED||i)&&l():l()},A(xS,this,OS).call(this,rv.TIMELINE_SEEKING,s),A(xS,this,OS).call(this,o,a)}))}function LS(e,t){if(!M(fS,this)||"function"!=typeof M(fS,this).on)return Promise.resolve();const n=Number(e);return new Promise((e=>{const i=(r={})=>{if(!A(xS,this,CS).call(this,t))return A(xS,this,PS).call(this,rv.VISUAL_FRAMES_AVAILABLE,i),void e();const o=Number(null==r?void 0:r.time);Number.isFinite(n)&&Number.isFinite(o)&&o+hS<n||(Array.isArray(null==r?void 0:r.frames)?r.frames:[]).length&&(A(xS,this,PS).call(this,rv.VISUAL_FRAMES_AVAILABLE,i),e())};A(xS,this,OS).call(this,rv.VISUAL_FRAMES_AVAILABLE,i)}))}function BS(){var e,t;const n=null===(e=M(fS,this))||void 0===e?void 0:e.state;if(n===hv||n===lv)return!0;const i=null===(t=M(fS,this))||void 0===t?void 0:t.placements;return!Array.isArray(i)||0===i.length}function zS(e,t){const n=Number(null==e?void 0:e.targetTime);return!Number.isFinite(n)||Math.abs(n-t)<hS}function WS(e,t=0){const n=Number(e);return Number.isFinite(n)?n:t}var $S=new WeakMap,US=new WeakMap,jS=new WeakMap,qS=new WeakMap,VS=new WeakMap,GS=new WeakMap,HS=new WeakMap,KS=new WeakMap,XS=new WeakMap,YS=new WeakMap,QS=new WeakMap,JS=new WeakMap,ZS=new WeakMap,eA=new WeakMap,tA=new WeakSet;class nA extends rd{get name(){return"AudioPlaybackManager"}get defaults(){return{muted:!1,volume:1,lookaheadSeconds:1}}constructor(e,t,n){super(n),O(this,tA),F(this,$S,void 0),F(this,US,void 0),F(this,jS,null),F(this,qS,null),F(this,VS,[]),F(this,GS,new Set),F(this,HS,new Map),F(this,KS,!1),F(this,XS,1),F(this,YS,!0),F(this,QS,null),F(this,JS,null),F(this,ZS,null),F(this,eA,null),C($S,this,e),C(US,this,t),C(KS,this,!!this.settings.muted),C(XS,this,im(this.settings.volume));const i=Array.isArray(null==n?void 0:n.disabledTracks)?n.disabledTracks:[];C(YS,this,!i.includes("audio")),A(tA,this,iA).call(this)}get muted(){return M(KS,this)}set muted(e){C(KS,this,!!e),A(tA,this,pA).call(this)}get volume(){return M(XS,this)}set volume(e){C(XS,this,im(e)),A(tA,this,pA).call(this)}handleDecodedAudio(e={}){if(!M(YS,this))return;const t=null==e?void 0:e.audioBuffer,n=null==e?void 0:e.placementId,i=null==e?void 0:e.segmentId,r=WS(null==e?void 0:e.pts,null);if(!(t&&n&&i&&Number.isFinite(r)))return;const o=Number.isFinite(null==e?void 0:e.duration)?e.duration:t.duration,s=`${n}:${i}`;M(GS,this).has(s)||(M(VS,this).push({key:s,placementId:n,pts:r,duration:o,audioBuffer:t}),M(VS,this).sort(((e,t)=>e.pts-t.pts)),A(tA,this,lA).call(this))}onDispose(){A(tA,this,rA).call(this),A(tA,this,hA).call(this,!0),M(jS,this)&&"function"==typeof M(jS,this).close&&M(jS,this).close(),C(jS,this,null),C(qS,this,null),C($S,this,null),C(US,this,null)}}function iA(){M($S,this)&&"function"==typeof M($S,this).on&&(C(QS,this,(e=>A(tA,this,oA).call(this,e))),M($S,this).on(rv.TIMELINE_TIME_UPDATE,M(QS,this)),C(JS,this,(e=>A(tA,this,sA).call(this,e))),M($S,this).on(rv.TIMELINE_STATE_CHANGE,M(JS,this)),C(eA,this,(()=>A(tA,this,aA).call(this))),M($S,this).on(rv.TIMELINE_RESET,M(eA,this))),M(US,this)&&"function"==typeof M(US,this).on&&(C(ZS,this,(e=>this.handleDecodedAudio(e))),M(US,this).on(rv.DECODER_AUDIO,M(ZS,this)))}function rA(){M($S,this)&&"function"==typeof M($S,this).off&&(M(QS,this)&&M($S,this).off(rv.TIMELINE_TIME_UPDATE,M(QS,this)),M(JS,this)&&M($S,this).off(rv.TIMELINE_STATE_CHANGE,M(JS,this)),M(eA,this)&&M($S,this).off(rv.TIMELINE_RESET,M(eA,this))),M(US,this)&&"function"==typeof M(US,this).off&&M(ZS,this)&&M(US,this).off(rv.DECODER_AUDIO,M(ZS,this)),C(QS,this,null),C(JS,this,null),C(ZS,this,null),C(eA,this,null)}function oA(){A(tA,this,lA).call(this)}function sA(e={}){const t=null==e?void 0:e.to;if(t)return t===cv?(A(tA,this,mA).call(this),void A(tA,this,lA).call(this)):void(t!==hv&&t!==dv?t!==fv&&t!==pv||A(tA,this,aA).call(this):A(tA,this,vA).call(this))}function aA(){A(tA,this,vA).call(this),A(tA,this,hA).call(this,!0),C(VS,this,[])}function lA(){if(!M(YS,this)||!M($S,this))return;if(M($S,this).state!==cv)return;const e=A(tA,this,fA).call(this);if(!e)return;const t=WS(M($S,this).currentTime,0),n=t+Math.max(0,WS(this.settings.lookaheadSeconds,1)),i=[];for(let r=0;r<M(VS,this).length;r+=1){const o=M(VS,this)[r];o&&(o.pts>n?i.push(o):A(tA,this,cA).call(this,o)&&A(tA,this,dA).call(this,o,e,t))}C(VS,this,i)}function cA(e){if(!e||!M($S,this))return!1;const t=A(tA,this,uA).call(this,e.pts);return!(!t||t!==e.placementId)}function uA(e){if(!M($S,this)||"function"!=typeof M($S,this).getPlacementsActiveAtTime)return null;const t=M($S,this).getPlacementsActiveAtTime(e);if(!Array.isArray(t)||!t.length)return null;const n=t.find((e=>null==e?void 0:e.placementId));return n?n.placementId:null}function dA(e,t,n){const i=e.key;if(M(GS,this).has(i))return;const r=e.audioBuffer;if(!r)return;const o=Number.isFinite(e.duration)?e.duration:r.duration,s=e.pts;if(!Number.isFinite(s))return;const a=n-s;if(Number.isFinite(o)&&o>0&&a>=o)return;const l=t.createBufferSource();l.buffer=r,l.connect(M(qS,this));let c=t.currentTime,u=0;a>0?u=a:a<0&&(c=t.currentTime+Math.abs(a));try{l.start(c,u)}catch(e){return void this.log.warn("[AudioPlaybackManager] Failed to start audio buffer",e)}M(GS,this).add(i),M(HS,this).set(i,l),l.onended=()=>{M(HS,this).delete(i)}}function hA(e){M(HS,this).forEach(((e,t)=>{if(e&&"function"==typeof e.stop)try{e.stop()}catch(e){}M(HS,this).delete(t)})),e&&M(GS,this).clear()}function fA(){if(M(jS,this))return M(jS,this);const e=ad.AudioContext||ad.webkitAudioContext;if(!e)return this.log.warn("[AudioPlaybackManager] AudioContext is not available."),null;try{return C(jS,this,new e),C(qS,this,M(jS,this).createGain()),M(qS,this).connect(M(jS,this).destination),A(tA,this,pA).call(this),M(jS,this)}catch(e){return this.log.warn("[AudioPlaybackManager] Failed to initialize AudioContext",e),C(jS,this,null),C(qS,this,null),null}}function pA(){if(!M(qS,this))return;const e=M(KS,this)?0:M(XS,this);M(qS,this).gain.value=e}function mA(){M(jS,this)&&"function"==typeof M(jS,this).resume&&"suspended"===M(jS,this).state&&M(jS,this).resume().catch((()=>{}))}function vA(){M(jS,this)&&"function"==typeof M(jS,this).suspend&&"running"===M(jS,this).state&&M(jS,this).suspend().catch((()=>{}))}var gA=new WeakMap,yA=new WeakMap,bA=new WeakMap,kA=new WeakMap,xA=new WeakMap,wA=new WeakSet;class _A extends rd{constructor(...e){super(...e),O(this,wA),F(this,gA,void 0),F(this,yA,void 0),F(this,bA,void 0),F(this,kA,void 0),F(this,xA,void 0),C(gA,this,A(wA,this,IA).call(this,this.settings.currentTime)),C(yA,this,A(wA,this,EA).call(this,this.settings.playbackRate)),C(bA,this,null),C(kA,this,!1),C(xA,this,A(wA,this,TA).bind(this))}get name(){return"PlaybackClock"}get defaults(){return{currentTime:0,playbackRate:_y("playbackRate")}}get currentTime(){return M(gA,this)}get playbackRate(){return M(yA,this)}set playbackRate(e){C(yA,this,A(wA,this,EA).call(this,e))}play(){M(kA,this)||(C(kA,this,!0),C(bA,this,sy()),jk(M(xA,this),0))}pause(){M(kA,this)&&(C(kA,this,!1),qk(M(xA,this)))}seek(e){C(gA,this,A(wA,this,IA).call(this,e)),C(bA,this,sy())}reset(){this.pause(),C(gA,this,0),C(bA,this,null)}onDispose(){this.pause(),C(xA,this,null)}}function TA(){const e=sy();if(null===M(bA,this))return C(bA,this,e),void this.trigger(rv.CLOCK_TICK,{currentTime:M(gA,this)});const t=e-M(bA,this);C(bA,this,e);const n=t/1e3;C(gA,this,M(gA,this)+n*M(yA,this)),this.trigger(rv.CLOCK_TICK,{currentTime:M(gA,this)})}function IA(e){return"number"!=typeof e||Number.isNaN(e)||!Number.isFinite(e)||e<0?0:e}function EA(e){return"number"!=typeof e||Number.isNaN(e)||!Number.isFinite(e)||e<=0?M(yA,this)||1:e}var SA=new WeakMap,AA=new WeakSet;class NA extends rd{constructor(...e){super(...e),O(this,AA),F(this,SA,new Map)}get name(){return"TrackBuffers"}get defaults(){return{}}refreshNode(e){if(!e||!Array.isArray(e.tracks))return;const t=e.id,n=M(SA,this).get(t)||new Map;M(SA,this).set(t,n),e.tracks.forEach((e=>{const i=null==e?void 0:e.type;if(!i)return;const r=e.buffered,o=n.get(i),s=!!o&&o.ready,a=(l=r)&&Number.isFinite(l.start)&&Number.isFinite(l.end)&&l.end>l.start;var l,c,u;u=r,!(c=null==o?void 0:o.range)&&!u||c&&u&&c.start===u.start&&c.end===u.end?o&&o.ready!==a&&n.set(i,{range:r,ready:a}):(n.set(i,{range:r,ready:a}),this.trigger(rv.TRACK_BUFFER_UPDATE,{nodeId:t,trackType:i,range:r})),!s&&a?this.trigger(rv.TRACK_READY,{nodeId:t,trackType:i,range:r}):s&&!a&&this.trigger(rv.TRACK_UNDERFLOW,{nodeId:t,trackType:i,range:r})}))}getTrackRange(e,t){const n=M(SA,this).get(e),i=null==n?void 0:n.get(t);return null==i?void 0:i.range}computeBuffered(e=[],t=0,n){if(!n||"function"!=typeof n.get)return;const i=Number.isFinite(t)?t:0;let r,o,s=!1;for(let t=0;t<e.length;t+=1){const a=A(AA,this,FA).call(this,n,e[t],i);if(!a||a.end<=i)continue;if(void 0===r){r=a.start,o=a.end,s=a.full;continue}const l=a.start<=o,c=s&&a.full;if(!l&&!c)break;o=Math.max(o,a.end),s=a.full}return void 0===r||void 0===o?{start:0,end:0}:{start:r,end:o}}get buffered(){return M(SA,this)}reset(){M(SA,this).clear()}onDispose(){M(SA,this).clear(),"function"==typeof this.off&&this.off()}}function MA(e,t=0){const n=Array.isArray(null==e?void 0:e.segments)?e.segments:[],i=[];for(let e=0;e<n.length;e+=1){const t=n[e];if(!t||t.isInit)continue;const r=Number(t.duration),o=Number(t.offset),s=Number(t.bufferedRatio);if(!Number.isFinite(r)||r<=0||!Number.isFinite(o)||s<=0)continue;const a=o+r*Math.min(1,s);!Number.isFinite(a)||a<=o||i.push({start:o,end:a})}if(!i.length)return;i.sort(((e,t)=>e.start-t.start));const r=[i[0]];for(let e=1;e<i.length;e+=1){const t=i[e],n=r[r.length-1];t.start<=n.end+.001?n.end=Math.max(n.end,t.end):r.push({...t})}const o=Number.isFinite(t)?t:0;for(let e=0;e<r.length;e+=1){const t=r[e];if(t.end>o+.001)return t}}function FA(e,t,n=0){var i,r;const o=am(t);if(!Number.isFinite(o))return;const s=e.get(t.nodeId);if(!s)return;const a=Array.isArray(s.tracks)?s.tracks:[];if(!a.length){const e=s.buffered;if(!e||!Number.isFinite(e.start)||!Number.isFinite(e.end))return;return A(AA,this,CA).call(this,s,e,o,t)}const l=s.mainTrackId,c=Number.isFinite(t.nodeOffsetOverride)?t.nodeOffsetOverride:0,u=Math.max(0,n-o+c);let d;l&&(d=a.find((e=>(null==e?void 0:e.id)===l))),(null===(i=d)||void 0===i?void 0:i.type)||(d=a.find((e=>null==e?void 0:e.type)));const h=A(AA,this,MA).call(this,d,u)||(null===(r=d)||void 0===r?void 0:r.buffered);return h&&Number.isFinite(h.start)&&Number.isFinite(h.end)?A(AA,this,CA).call(this,s,h,o,t):void 0}function CA(e,t,n,i){const r=Number.isFinite(i.nodeOffsetOverride)?i.nodeOffsetOverride:0;let o=t.start-r+n,s=t.end-r+n;const a=e.duration,l=Number.isFinite(i.nodeDurationOverride)?i.nodeDurationOverride:a;if(Number.isFinite(l)){const e=n+l;s=Math.min(s,e);const t=o<=n&&s>=e;if(o=Math.max(o,n),!(s>o))return;return{start:o,end:s,full:t}}if(o=Math.max(o,n),s>o)return{start:o,end:s,full:!1}}class OA{constructor(e={}){const{placementId:t,nodeId:n,offset:i,offsetPending:r=!1,offsetAnchorPlacementId:o,offsetEndSeconds:s,offsetAnchorEdge:a,offsetAnchorIsReference:l,nodeOffsetOverride:c,nodeDurationOverride:u,loop:d=!1,loopRootPlacementId:h,loopRootOffset:f}=e;if(!t)throw new Error("Placement requires placementId");if(!n)throw new Error("Placement requires nodeId");this.placementId=t,this.nodeId=n;const p=Number.isFinite(i)?i:0;this.offsetPending=!0===r,this.offsetAnchorPlacementId=o,this.offsetAnchorEdge=a,this.offsetAnchorIsReference=l,this.offsetEndSeconds=Number.isFinite(s)?s:void 0,this.offset=this.offsetPending?void 0:p,this.nodeOffsetOverride=c,this.nodeDurationOverride=u,this.loop=!0===d,this.loopRootPlacementId=h,this.loopRootOffset=f}}class PA extends rd{constructor(e,t){super(t),this.timeline=e}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"handleDecodedFrame","handleClockTick","handleMainTrackBufferUpdate"])}enter(){}exit(){}play(){this.timeline.transitionTo(cv)}pause(){this.timeline.transitionTo(hv)}wait(){this.timeline.transitionTo(dv)}reset(){this.timeline.transitionTo(pv)}seek(e){this.timeline.transitionTo(fv,{targetTime:e,returnState:this.timeline.state})}getCurrentTime(){return this.timeline.currentTime}emitPlayerStateEvent(e,t={}){if(!e||!this.timeline||"function"!=typeof this.timeline.trigger)return;const n=Number.isFinite(null==t?void 0:t.time)?t.time:this.getCurrentTime(),i={...t,event:e};Number.isFinite(n)&&(i.time=n),this.timeline.trigger("player:state",i)}get buffered(){return this.timeline.computeBuffered(this.timeline.currentTime)}handleMainTrackUnderflow(e){this.wait()}handleMainTrackReady(e){const t=this.timeline.getLastStableState()||hv;this.timeline.transitionTo(t)}handleMainTrackBufferUpdate(e){}handleDecodedFrame(e){}handleClockTick(e){}onDispose(){this.timeline=null}}const RA=24e3/1001;function DA(e,t=(null==e?void 0:e.currentTime)){return Number.isFinite(t)?t:Number.isFinite(null==e?void 0:e.currentTime)?e.currentTime:0}function LA(e){var t;const n=Number(null==e||null===(t=e.settings)||void 0===t?void 0:t.snapToFps);return Number.isFinite(n)&&n>0?.5/n:.001}function BA(e){var t;const n=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[];let i;if(null!=e&&e.mainTrackId){const t=n.find((t=>(null==t?void 0:t.id)===e.mainTrackId));i=null==t?void 0:t.type}if(i||(i=null===(t=n.find((e=>null==e?void 0:e.type)))||void 0===t?void 0:t.type),"video"===i||"audio"===i||"image"===i)return i}function zA(e){const t=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[];if(t.length){if(null!=e&&e.mainTrackId){const n=t.find((t=>(null==t?void 0:t.id)===e.mainTrackId));if("video"===(null==n?void 0:n.type)||"image"===(null==n?void 0:n.type))return n}return t.find((e=>"video"===(null==e?void 0:e.type)||"image"===(null==e?void 0:e.type)))}}function WA(e,t,n,i,r){var o,s;const a="function"==typeof(null==e?void 0:e.getDecodedVisualBuffer)?e.getDecodedVisualBuffer(t,n):void 0;if(!a)return"function"==typeof(null==e?void 0:e.hasDecodedFirstFrame)&&e.hasDecodedFirstFrame(t,i);const l=Array.isArray(a.frames)?a.frames:[];let c,u=Number.isFinite(null===(o=a.current)||void 0===o?void 0:o.presentationTime)?a.current:void 0;for(let e=0;e<l.length;e+=1){const t=l[e],n=Number(null==t?void 0:t.presentationTime);if(Number.isFinite(n)){if(!(n<=r)){c=n;break}u=t}}const d=Number(null===(s=u)||void 0===s?void 0:s.presentationTime);if(!Number.isFinite(d)||d>r)return!1;const h=function(e,t,n,i){const r=Number(null==n?void 0:n.duration);if(Number.isFinite(r)&&r>0)return t+r;const o=function(e,t){const n=Number(null==e||null===(t=e.settings)||void 0===t?void 0:t.snapToFps);return 2/(Number.isFinite(n)&&n>0?n:RA)}(e),s=Number.isFinite(i)&&i>t?i-t:o;return t+Math.min(s,o)}(e,d,u,c);return!!Number.isFinite(h)&&r<=h+LA(e)}function $A(e,t=(null==e?void 0:e.currentTime)){const n=DA(e,t),i="function"==typeof(null==e?void 0:e.getPlacementsActiveAtTime)?e.getPlacementsActiveAtTime(n):[];if(!i.length)return!1;for(let t=0;t<i.length;t+=1){const n=i[t],r=null==n?void 0:n.placementId;if(!r)return!0;const o="function"==typeof(null==e?void 0:e.getNode)?e.getNode(n.nodeId):void 0;if(!o)return!0;const s=BA(o);if(!s)return!0;if(!e.hasDecodedFirstFrame(r,s))return!0}return!1}function UA(e,t=(null==e?void 0:e.currentTime)){return $A(e,t)||function(e,t=(null==e?void 0:e.currentTime)){const n=DA(e,t),i="function"==typeof(null==e?void 0:e.getPlacementsActiveAtTime)?e.getPlacementsActiveAtTime(n):[];if(!i.length)return!1;for(let t=0;t<i.length;t+=1){const r=i[t],o=null==r?void 0:r.placementId;if(!o)return!0;const s="function"==typeof(null==e?void 0:e.getNode)?e.getNode(r.nodeId):void 0;if(!s)return!0;const a=zA(s);if(null!=a&&a.id&&!WA(e,o,a.id,a.type,n))return!0}return!1}(e,t)}function jA(e,t=(null==e?void 0:e.currentTime)){if("function"!=typeof(null==e?void 0:e.computeBuffered))return!1;const n=DA(e,t),i=e.computeBuffered(n),r=Number(null==i?void 0:i.start),o=Number(null==i?void 0:i.end);if(!Number.isFinite(r)||!Number.isFinite(o)||o<=r)return!1;const s=LA(e);if(!(r<=n+s))return!1;return o-n>=function(e,t){const n=Number(null==e||null===(t=e.settings)||void 0===t?void 0:t.waitingBufferAheadSeconds);return!Number.isFinite(n)||n<0?3:n}(e)-s||function(e,t,n,i){const r=function(e){const t=Array.isArray(null==e?void 0:e.placements)?e.placements:[];let n;for(let i=0;i<t.length;i+=1){const r=t[i],o=am(r);if(!Number.isFinite(o))continue;const s="function"==typeof(null==e?void 0:e.getPlacementDuration)?e.getPlacementDuration(r):void 0;if(!Number.isFinite(s))continue;const a=o+s;Number.isFinite(a)&&(!Number.isFinite(n)||a>n)&&(n=a)}return n}(e);return!!Number.isFinite(r)&&(t>=r-i||n>=r-i)}(e,n,o,s)}const qA={[lv]:class extends PA{get name(){return lv}get defaults(){return{autoplay:_y("autoplay")}}enter(){this.timeline.recordStableState(hv),this.timeline.stopPlaybackClock()}play(){const e=UA(this.timeline),t=e?dv:this.timeline.getPlaybackStartState();if(this.emitPlayerStateEvent("play",{from:this.timeline.state,to:t}),e)return this.timeline.recordStableState(cv),void this.timeline.transitionTo(dv);this.timeline.transitionTo(t)}pause(){}handleDecodedFrame(e){if(!0!==this.settings.autoplay)return;if(!Array.isArray(this.timeline.placements)||!this.timeline.placements.length)return;if(UA(this.timeline))return;const t=this.timeline.getPlaybackStartState();this.log.info("[handleDecodedFrame] Autoplay enabled, starting playback!"),this.emitPlayerStateEvent("play",{from:this.timeline.state,to:t}),this.timeline.transitionTo(t)}},[uv]:class extends PA{get name(){return uv}enter(e={}){const{from:t,to:n}=e;this.timeline.recordStableState(cv),this.timeline.stopPlaybackClock(),this.emitPlayerStateEvent("canplay",{from:t,to:n})}play(){}pause(){this.timeline.transitionTo(hv)}},[cv]:class extends PA{get name(){return cv}enter(e={}){const{from:t,to:n,fromFirstFramePending:i}=e;this.timeline.recordStableState(cv),this.timeline.startPlaybackClock(),!0!==i&&this.emitPlayerStateEvent("canplay",{from:t,to:n}),this.emitPlayerStateEvent("playing",{from:t,to:n})}play(){}pause(){this.timeline.transitionTo(hv)}handleClockTick(e){const t=this.timeline.currentTime;UA(this.timeline,t)&&(this.timeline.recordStableState(cv),this.timeline.transitionTo(dv))}},[dv]:(Zt=new WeakMap,en=new WeakMap,tn=new WeakSet,class extends PA{constructor(...e){super(...e),O(this,tn),F(this,Zt,void 0),F(this,en,null)}get name(){return dv}enter(e={}){const{from:t,to:n}=e;this.timeline.stopPlaybackClock(),A(tn,this,VA).call(this),A(tn,this,HA).call(this),this.emitPlayerStateEvent("waiting",{from:t,to:n}),A(tn,this,YA).call(this)}exit(){A(tn,this,GA).call(this),A(tn,this,KA).call(this)}play(){this.timeline.recordStableState(cv);const e=A(tn,this,XA).call(this),t=e?dv:this.timeline.getPlaybackStartState();this.emitPlayerStateEvent("play",{from:this.timeline.state,to:t}),e||this.timeline.transitionTo(t)}pause(){this.timeline.transitionTo(hv)}handleMainTrackReady(e){const t=this.timeline.getLastStableState()||hv;t!==cv?this.timeline.transitionTo(t):A(tn,this,YA).call(this)}handleDecodedFrame(e){A(tn,this,YA).call(this)}handleMainTrackBufferUpdate(e){A(tn,this,YA).call(this)}}),[hv]:class extends PA{get name(){return hv}enter(e={}){const{from:t,to:n}=e;this.timeline.recordStableState(hv),this.timeline.stopPlaybackClock(),this.emitPlayerStateEvent("pause",{from:t,to:n})}play(){const e=UA(this.timeline),t=e?dv:this.timeline.getPlaybackStartState();if(this.emitPlayerStateEvent("play",{from:this.timeline.state,to:t}),e)return this.timeline.recordStableState(cv),void this.timeline.transitionTo(dv);this.timeline.transitionTo(t)}pause(){}},[fv]:class extends PA{get name(){return fv}enter(e={}){const{targetTime:t,returnState:n}=e;if(this.timeline&&"function"==typeof this.timeline.stopPlaybackClock&&this.timeline.stopPlaybackClock(),this.timeline&&"function"==typeof this.timeline.startSeeking)return void this.timeline.startSeeking(t,n);this.timeline.updateTime(t);const i=n===cv||n===uv,r=i&&"function"==typeof this.timeline.getPlaybackStartState?this.timeline.getPlaybackStartState(t):i?cv:hv;this.timeline.transitionTo(r,{fromSeeking:!0})}play(){var e;if(this.timeline&&"function"==typeof this.timeline.setSeekReturnState)return void this.timeline.setSeekReturnState(cv);const t="function"==typeof(null===(e=this.timeline)||void 0===e?void 0:e.getPlaybackStartState)?this.timeline.getPlaybackStartState():cv;this.timeline.transitionTo(t)}pause(){this.timeline&&"function"==typeof this.timeline.setSeekReturnState?this.timeline.setSeekReturnState(hv):this.timeline.transitionTo(hv)}handleDecodedFrame(e){this.timeline&&"function"==typeof this.timeline.maybeCompleteSeek&&this.timeline.maybeCompleteSeek(e)}},[pv]:class extends PA{get name(){return pv}enter(){this.timeline.resetClock(),this.timeline.transitionTo(lv,{fromReset:!0})}play(){}pause(){}get buffered(){return{start:0,end:0}}}};function VA(){var e;const t=null===(e=this.timeline)||void 0===e?void 0:e.trackBuffers;t&&"function"==typeof t.on&&(C(Zt,this,(e=>this.handleMainTrackBufferUpdate(e))),t.on(rv.TRACK_BUFFER_UPDATE,M(Zt,this)))}function GA(){var e;const t=null===(e=this.timeline)||void 0===e?void 0:e.trackBuffers;M(Zt,this)&&t&&"function"==typeof t.off?(t.off(rv.TRACK_BUFFER_UPDATE,M(Zt,this)),C(Zt,this,null)):C(Zt,this,null)}function HA(){if(null!==M(en,this))return;const e="function"==typeof(null==ad?void 0:ad.setInterval)?ad.setInterval.bind(ad):setInterval;C(en,this,e((()=>{var e;(null===(e=this.timeline)||void 0===e?void 0:e.state)===dv&&A(tn,this,YA).call(this)}),200))}function KA(){null!==M(en,this)&&(("function"==typeof(null==ad?void 0:ad.clearInterval)?ad.clearInterval.bind(ad):clearInterval)(M(en,this)),C(en,this,null))}function XA(e=(e=>null===(e=this.timeline)||void 0===e?void 0:e.currentTime)()){return function(e,t=(null==e?void 0:e.currentTime),n={}){return!!$A(e,t)||!0===n.skipBufferResume||!jA(e,t)}(this.timeline,e)}function YA(e=(e=>null===(e=this.timeline)||void 0===e?void 0:e.currentTime)()){return(this.timeline.getLastStableState()||hv)===cv&&!A(tn,this,XA).call(this,e)&&(this.timeline.transitionTo(this.timeline.getPlaybackStartState(e)),!0)}function QA(e){return e&&("string"!=typeof e.state||"ready"===e.state)}function JA(e){return(Array.isArray(null==e?void 0:e.tracks)?e.tracks:[]).some((e=>"video"===(null==e?void 0:e.type)))}function ZA(e){return(Array.isArray(null==e?void 0:e.tracks)?e.tracks:[]).some((e=>"video"===(null==e?void 0:e.type)||"image"===(null==e?void 0:e.type)))}function eN(e){return e===cv||e===uv}var tN=new WeakMap,nN=new WeakMap,iN=new WeakMap,rN=new WeakMap,oN=new WeakMap,sN=new WeakMap,aN=new WeakMap,lN=new WeakMap,cN=new WeakMap,uN=new WeakMap,dN=new WeakMap,hN=new WeakMap,fN=new WeakMap,pN=new WeakMap,mN=new WeakSet;class vN{constructor(e={}){O(this,mN),F(this,tN,void 0),F(this,nN,void 0),F(this,iN,void 0),F(this,rN,void 0),F(this,oN,void 0),F(this,sN,void 0),F(this,aN,void 0),F(this,lN,void 0),F(this,cN,void 0),F(this,uN,null),F(this,dN,hv),F(this,hN,[]),F(this,fN,new Set),F(this,pN,new Map),C(tN,this,e.getState),C(nN,this,e.getNode),C(iN,this,e.getPlacementsActiveAtTime),C(rN,this,e.getLastStableState),C(oN,this,e.getPlaybackStartState),C(sN,this,e.clearVisualFrameBuffers),C(aN,this,e.updateTime),C(lN,this,e.transitionTo),C(cN,this,e.trigger)}start(e,t){const n=Number(e);if(!Number.isFinite(n))return;let i=t;i===fv?i=M(dN,this):i===dv&&"function"==typeof M(rN,this)&&(i=M(rN,this).call(this)),C(dN,this,eN(i)?cv:hv),C(uN,this,n),M(fN,this).clear(),M(pN,this).clear(),C(hN,this,"function"==typeof M(iN,this)?M(iN,this).call(this,n):[]),"function"==typeof M(sN,this)&&M(sN,this).call(this),"function"==typeof M(aN,this)&&M(aN,this).call(this,n,{source:"seek"}),"function"==typeof M(cN,this)&&M(cN,this).call(this,rv.TIMELINE_SEEKING,{targetTime:n,placements:M(hN,this).slice()}),this.maybeComplete()}setReturnState(e){C(dN,this,eN(e)?cv:hv)}maybeComplete(e){if(("function"==typeof M(tN,this)?M(tN,this).call(this):void 0)!==fv)return;const t=M(uN,this);if(!Number.isFinite(t))return;const n=null==e?void 0:e.trackType,i=null==e?void 0:e.placementId;if(i&&"video"===n){const n=Number(null==e?void 0:e.pts);if(Number.isFinite(n)&&n>=t){M(fN,this).add(i);const e=M(pN,this).get(i);(!Number.isFinite(e)||n<e)&&M(pN,this).set(i,n)}}else i&&"image"===n&&function(e,t){const n=Number(null==e?void 0:e.pts),i=Number(null==e?void 0:e.duration);return!Number.isFinite(n)||(Number.isFinite(i)&&i>0?t>=n&&t<n+i:t>=n)}(e,t)&&M(fN,this).add(i);const r=Array.isArray(M(hN,this))?M(hN,this):[];if(r.length){if("function"==typeof M(nN,this)){for(let e=0;e<r.length;e+=1){const t=r[e],n=null==t?void 0:t.placementId;if(!n)return;const i=M(nN,this).call(this,t.nodeId);if(!QA(i))return;if(ZA(i)&&!M(fN,this).has(n))return}A(mN,this,gN).call(this,t,r)}}else A(mN,this,gN).call(this,t,[])}dispose(){C(hN,this,[]),M(fN,this).clear(),M(pN,this).clear(),C(uN,this,null)}}function gN(e,t){const n=A(mN,this,yN).call(this,e,t);if("function"==typeof M(aN,this)&&M(aN,this).call(this,n,{source:"seek"}),C(uN,this,null),C(hN,this,[]),M(fN,this).clear(),M(pN,this).clear(),"function"==typeof M(cN,this)&&M(cN,this).call(this,rv.TIMELINE_SEEKED,{targetTime:e,placements:Array.isArray(t)?t.slice():[]}),"function"==typeof M(lN,this)){const e=M(dN,this)===cv&&"function"==typeof M(oN,this)?M(oN,this).call(this,n):M(dN,this);M(lN,this).call(this,e,{fromSeeking:!0})}}function yN(e,t){const n=Number(e);if(!Number.isFinite(n))return e;if(!Array.isArray(t)||!t.length||"function"!=typeof M(nN,this))return n;let i=n;for(let e=0;e<t.length;e+=1){const n=t[e],r=null==n?void 0:n.placementId;if(!r)continue;if(!JA(M(nN,this).call(this,n.nodeId)))continue;const o=M(pN,this).get(r);Number.isFinite(o)&&o>i&&(i=o)}return i}function bN(e){if(e&&"function"==typeof e.close)try{e.close()}catch(e){}}function kN(e){if(!e)return;const t=Array.isArray(null==e?void 0:e.frames)?e.frames:[],n=null==e?void 0:e.current;(n?[n,...t]:t).forEach((e=>bN(null==e?void 0:e.frame)))}function xN(e){return am(e)}function wN(e){return Number.isFinite(null==e?void 0:e.loopRootOffset)?e.loopRootOffset:xN(e)}function _N(e,t){return"string"==typeof(null==e?void 0:e.loopRootPlacementId)&&e.loopRootPlacementId?e.loopRootPlacementId:t}function TN(e){if("string"!=typeof e)return Number.NaN;const t=e.match(/(\d+)/);return t?Number(t[1]):Number.NaN}function IN(e){if(!e)return;const t=[[e.displayWidth,e.displayHeight],[e.codedWidth,e.codedHeight],[e.videoWidth,e.videoHeight],[e.naturalWidth,e.naturalHeight],[e.width,e.height]];for(let e=0;e<t.length;e+=1){const[n,i]=t[e],r=Number(n),o=Number(i);if(Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0)return{width:r,height:o}}}const EN=1e-6;function SN(e){return e&&("string"!=typeof e.state||"ready"===e.state)}function AN(e){const t=Number(e);return Number.isFinite(t)?t:0}function NN(e){return(Array.isArray(null==e?void 0:e.tracks)?e.tracks:[]).filter((e=>"cue"===(null==e?void 0:e.type)&&Array.isArray(null==e?void 0:e.cues)))}function MN(e){return e&&"cue"===e.type&&Array.isArray(e.cues)?e.cues:[]}var FN=new WeakMap,CN=new WeakMap,ON=new WeakMap,PN=new WeakMap,RN=new WeakMap,DN=new WeakMap,LN=new WeakMap,BN=new WeakMap,zN=new WeakSet;class WN{constructor(e={}){O(this,zN),F(this,FN,void 0),F(this,CN,void 0),F(this,ON,void 0),F(this,PN,void 0),F(this,RN,void 0),F(this,DN,void 0),F(this,LN,-1e-6),F(this,BN,null),C(FN,this,e.getPlacements),C(CN,this,e.getPlacementsActiveAtTime),C(ON,this,e.getPlacementDuration),C(PN,this,e.getNode),C(RN,this,e.triggerTimeline),C(DN,this,e.triggerNode)}handleSeeking(e,t){const n=AN(e);C(BN,this,n)}handleSeeked(e){const t=AN(e),n=M(BN,this);C(BN,this,null),Number.isFinite(n)?(A(zN,this,UN).call(this,n,t),C(LN,this,t)):C(LN,this,t)}handleTimeUpdate(e,t={}){const n=AN(e),i=M(LN,this);!0===(null==t?void 0:t.isSeeking)?C(LN,this,n):Number.isFinite(i)?n<=i?n<i&&C(LN,this,n-EN):(A(zN,this,$N).call(this,i,n),C(LN,this,n)):C(LN,this,n)}dispose(){C(BN,this,null),C(LN,this,-1e-6)}}function $N(e,t){const n="function"==typeof M(FN,this)?M(FN,this).call(this):[];A(zN,this,jN).call(this,n,e,t,{onlySticky:!1})}function UN(e,t){if("function"!=typeof M(CN,this))return;const n=M(CN,this).call(this,t);A(zN,this,jN).call(this,n,e,t,{onlySticky:!0})}function jN(e,t,n,i={}){if("function"!=typeof M(PN,this)||"function"!=typeof M(RN,this))return;if(!Array.isArray(e)||!e.length)return;const r=!0===i.onlySticky,o=[];for(let i=0;i<e.length;i+=1){const s=e[i],a=null==s?void 0:s.placementId,l=null==s?void 0:s.nodeId;if(!a||!l)continue;const c=M(PN,this).call(this,l);if(!SN(c))continue;const u=NN(c);if(!u.length)continue;const d=am(s);if(!Number.isFinite(d))continue;const h=Number.isFinite(null==s?void 0:s.nodeOffsetOverride)?s.nodeOffsetOverride:0,f="function"==typeof M(ON,this)?M(ON,this).call(this,s):void 0,p="number"==typeof f&&Number.isFinite(f)?d+f:Number.POSITIVE_INFINITY,m=r?d-EN:t;for(let e=0;e<u.length;e+=1){const t=MN(u[e]);for(let i=0;i<t.length;i+=1){const s=t[i],c=AN(null==s?void 0:s.timestamp),u=d+Math.max(0,c-h);u<=p&&(r&&!0!==(null==s?void 0:s.isSticky)||u>m&&u<=n&&"string"==typeof(null==s?void 0:s.name)&&s.name&&o.push({time:u,placementOffset:d,placementId:a,nodeId:l,cuepoint:s,trackIndex:e,cueIndex:i}))}}}o.length&&(o.sort(((e,t)=>e.time!==t.time?e.time-t.time:e.placementOffset!==t.placementOffset?e.placementOffset-t.placementOffset:e.placementId!==t.placementId?e.placementId<t.placementId?-1:1:e.trackIndex!==t.trackIndex?e.trackIndex-t.trackIndex:e.cueIndex-t.cueIndex)),o.forEach((e=>{const t=e.cuepoint,n={time:e.time,nodeId:e.nodeId,placementId:e.placementId,cuepoint:t};M(RN,this).call(this,"cuepoint",n),M(RN,this).call(this,t.name,n),"function"==typeof M(DN,this)&&(M(DN,this).call(this,e.nodeId,"cuepoint",n),M(DN,this).call(this,e.nodeId,t.name,n))})))}class qN{#ee;#te=0;#ne=new Set;constructor(e){this.#ee="string"==typeof e?e:""}claim(e){if(e)return this.#ne.add(e),e;let t;do{t=`${this.#ee}${++this.#te}`}while(this.#ne.has(t));return this.#ne.add(t),t}reset(){this.#te=0,this.#ne.clear()}}const VN=24e3/1001;function GN(e){var t;const n=null==e?void 0:e.frame;if(!n||!0===n.__closed||!0===n.closed)return 0;if("function"==typeof n.allocationSize)try{const e=Number(n.allocationSize());if(Number.isFinite(e)&&e>0)return e}catch(e){}const i=Number(null==n?void 0:n.byteLength);if(Number.isFinite(i)&&i>0)return i;const r=Number(null==n||null===(t=n.data)||void 0===t?void 0:t.byteLength);if(Number.isFinite(r)&&r>0)return r;const o=function(e,t){const n=Number(null==e?void 0:e.width),i=Number(null==e?void 0:e.height);return Number.isFinite(n)&&Number.isFinite(i)&&n>0&&i>0?{width:n,height:i}:IN(t)}(e,n),s=Number(null==o?void 0:o.width),a=Number(null==o?void 0:o.height);return Number.isFinite(s)&&Number.isFinite(a)&&s>0&&a>0?s*a*4:0}var HN=new WeakMap,KN=new WeakMap,XN=new WeakMap,YN=new WeakMap,QN=new WeakMap,JN=new WeakMap,ZN=new WeakMap,eM=new WeakMap,tM=new WeakMap,nM=new WeakMap,iM=new WeakMap,rM=new WeakMap,oM=new WeakMap,sM=new WeakMap,aM=new WeakMap,lM=new WeakMap,cM=new WeakMap,uM=new WeakMap,dM=new WeakMap,hM=new WeakMap,fM=new WeakMap,pM=new WeakMap,mM=new WeakMap,vM=new WeakMap,gM=new WeakMap,yM=new WeakMap,bM=new WeakMap,kM=new WeakMap,xM=new WeakMap,wM=new WeakMap,_M=new WeakMap,TM=new WeakMap,IM=new WeakMap,EM=new WeakSet;class SM extends rd{constructor(...e){super(...e),O(this,EM),F(this,HN,void 0),F(this,KN,void 0),F(this,XN,void 0),F(this,YN,void 0),F(this,QN,void 0),F(this,JN,!1),F(this,ZN,[]),F(this,eM,new qN("placement-")),F(this,tM,[]),F(this,nM,new qN("renderplacement-")),F(this,iM,void 0),F(this,rM,void 0),F(this,oM,void 0),F(this,sM,!1),F(this,aM,new Set),F(this,lM,new Set),F(this,cM,new Map),F(this,uM,[]),F(this,dM,0),F(this,hM,new Set),F(this,fM,new Set),F(this,pM,Number.NEGATIVE_INFINITY),F(this,mM,[]),F(this,vM,Number.NEGATIVE_INFINITY),F(this,gM,0),F(this,yM,void 0),F(this,bM,void 0),F(this,kM,new Map),F(this,xM,null),F(this,wM,void 0),F(this,_M,void 0),F(this,TM,void 0),F(this,IM,void 0);const[t,n={}]=e;C(HN,this,t),C(yM,this,n),C(QN,this,new _A(n)),C(iM,this,new NA(n)),C(YN,this,hv),A(EM,this,BM).call(this),A(EM,this,zM).call(this),C(wM,this,new vN({getState:()=>this.state,getNode:e=>M(HN,this)&&"function"==typeof M(HN,this).get?M(HN,this).get(e):void 0,getPlacementsActiveAtTime:e=>A(EM,this,yF).call(this,e,{endEpsilonSeconds:A(EM,this,SF).call(this)}),getLastStableState:()=>this.getLastStableState(),getPlaybackStartState:e=>this.getPlaybackStartState(e),clearVisualFrameBuffers:()=>A(EM,this,vF).call(this),updateTime:(e,t)=>this.updateTime(e,t),transitionTo:(e,t)=>this.transitionTo(e,t),trigger:(e,t)=>this.trigger(e,t)})),C(_M,this,new WN({getPlacements:()=>M(ZN,this).slice(),getPlacementsActiveAtTime:e=>A(EM,this,yF).call(this,e),getPlacementDuration:e=>A(EM,this,ZM).call(this,e),getNode:e=>M(HN,this)&&"function"==typeof M(HN,this).get?M(HN,this).get(e):void 0,triggerTimeline:(e,t)=>this.trigger(e,t),triggerNode:(e,t,n)=>{const i=M(HN,this)&&"function"==typeof M(HN,this).get?M(HN,this).get(e):void 0;i&&"function"==typeof i.trigger&&i.trigger(t,n)}})),C(TM,this,(()=>{var e,t;null===(e=M(_M,this))||void 0===e||null===(t=e.handleSeeked)||void 0===t||t.call(e,this.currentTime)})),this.on(rv.TIMELINE_SEEKED,M(TM,this)),C(IM,this,(e=>A(EM,this,GM).call(this,e))),this.on("nodestart",M(IM,this)),this.transitionTo(lv)}get name(){return"Timeline"}get defaults(){return{snapToFps:VN,maxBufferedVideoFrames:24}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"computeBuffered","notifyDecodedFrame","getDecodedFrameStats","getActiveRenderPlacement","maybeCompleteSeek","getPlacementsActiveAtTime","hasDecodedFirstFrame","getDecodedVisualBuffer","getPlacementDuration","getNode"])}transitionTo(e,t={}){const n=M(XN,this),i=function(e,t,n={}){const i=qA[e];return i?new i(t,n):null}(e,this,M(yM,this)),r=t&&"object"==typeof t&&!Array.isArray(t)?{...t,from:n,to:e}:{from:n,to:e};i?(M(KN,this)&&"function"==typeof M(KN,this).exit&&M(KN,this).exit(),C(KN,this,i),C(XN,this,e),"function"==typeof i.enter&&i.enter(r),this.trigger(rv.TIMELINE_STATE_CHANGE,{from:n,to:e,options:t})):this.log.warn(`Unknown state "${e}"`)}recordStableState(e){C(YN,this,e)}getLastStableState(){return M(YN,this)}enableFirstFrameRenderedGate(){C(JN,this,!0)}getPlaybackStartState(e=this.currentTime){return this.shouldWaitForFirstRenderedFrame(e)?uv:cv}shouldWaitForFirstRenderedFrame(e=this.currentTime){if(!M(JN,this)||M(sM,this))return!1;const t=Number.isFinite(e)?e:this.currentTime,n=A(EM,this,yF).call(this,t);return Array.isArray(n)&&n.length>0}notifyFirstFrameRendered(){M(sM,this)||(C(sM,this,!0),this.state===uv&&this.transitionTo(cv,{fromFirstFramePending:!0}))}get state(){return M(XN,this)}get paused(){return M(XN,this)===lv||M(XN,this)===hv}get currentTime(){return M(QN,this).currentTime}set currentTime(e){M(KN,this).seek(e)}get playbackRate(){return M(QN,this).playbackRate}set playbackRate(e){M(QN,this).playbackRate=e}play(){M(KN,this).play()}pause(){M(KN,this).pause()}reset(){M(KN,this).reset()}seekToPlacement(e){if(!e)throw new Error("Timeline.seekToPlacement requires placement id");A(EM,this,XM).call(this);const t=A(EM,this,_F).call(this,e);if(!t)throw new Error("Timeline.seekToPlacement requires placement id");const n=am(t);if(!Number.isFinite(n))throw new Error("Timeline.seekToPlacement requires resolved placement offset");return this.currentTime=n,n}updateTime(e,t={}){var n,i;A(EM,this,XM).call(this),A(EM,this,YM).call(this),M(QN,this).seek(e),A(EM,this,gF).call(this,this.currentTime),A(EM,this,bF).call(this);const r="string"==typeof(null==t?void 0:t.source)?t.source:"set";null!==(n=M(_M,this))&&void 0!==n&&null!==(i=n.handleTimeUpdate)&&void 0!==i&&i.call(n,this.currentTime,{isSeeking:this.state===fv}),A(EM,this,HM).call(this,this.currentTime),A(EM,this,dF).call(this,this.currentTime),this.trigger(rv.TIMELINE_TIME_UPDATE,ov(this.currentTime,r))}startSeeking(e,t){var n,i;null!==(n=M(_M,this))&&void 0!==n&&null!==(i=n.handleSeeking)&&void 0!==i&&i.call(n,this.currentTime,e),M(wM,this)&&"function"==typeof M(wM,this).start&&M(wM,this).start(e,t)}setSeekReturnState(e){M(wM,this)&&"function"==typeof M(wM,this).setReturnState&&M(wM,this).setReturnState(e)}maybeCompleteSeek(e){M(wM,this)&&"function"==typeof M(wM,this).maybeComplete&&M(wM,this).maybeComplete(e)}startPlaybackClock(){M(QN,this).play()}stopPlaybackClock(){M(QN,this).pause()}resetClock(){var e,t;M(QN,this).reset(),null===(e=M(_M,this))||void 0===e||null===(t=e.dispose)||void 0===t||t.call(e)}applyTimelineDefinition(e={}){const t=Array.isArray(null==e?void 0:e.placements)?e.placements:[],n=Array.isArray(null==e?void 0:e.renderPlacements)?e.renderPlacements:[];A(EM,this,AM).call(this),A(EM,this,NM).call(this,t),A(EM,this,MM).call(this,n),this.currentTime=0}placeOnTimeline(e,t,n={}){const i=e&&"object"==typeof e?e.id:e;if(!i)throw new Error("Timeline.placeOnTimeline requires node id");const r=M(eM,this).claim(n.placementId),o=n.nodeOffsetOverride||n.offset,s=n.nodeDurationOverride||n.duration,a=fm(t);if("string"==typeof t&&t.includes("@")&&!a)throw new Error("Timeline.placeOnTimeline requires valid placement reference");const{wantsEndOffset:l,endOffsetSeconds:c}=a?{wantsEndOffset:!1}:hm(t,n);let u,d,h,f=!1;const p=null!==a;if(A(EM,this,XM).call(this),a){const e=M(ZN,this).find((e=>(null==e?void 0:e.placementId)===a.placementId));if(!e)throw new Error("Timeline.placeOnTimeline requires valid placement reference");d=e.placementId,h=a.anchor;const t=am(e);if("start"===a.anchor)Number.isFinite(t)?u=A(EM,this,eF).call(this,t,{nodeOffsetOverride:o}):f=!0;else{const n=A(EM,this,ZM).call(this,e);if(Number.isFinite(t)&&n>0){const e=t+n,i=A(EM,this,eF).call(this,e,{nodeOffsetOverride:o});u=Math.max(i,e)}else f=!0}}else if(l){const e=n.offsetAnchorPlacementId?M(ZN,this).find((e=>(null==e?void 0:e.placementId)===n.offsetAnchorPlacementId)):M(ZN,this).length?M(ZN,this)[M(ZN,this).length-1]:void 0;if(d=n.offsetAnchorPlacementId||(null==e?void 0:e.placementId),d){const t=am(e),n=A(EM,this,ZM).call(this,e);Number.isFinite(t)&&n>0?u=A(EM,this,eF).call(this,t+n-c,{nodeOffsetOverride:o}):(f=!0,h="end")}else u=A(EM,this,eF).call(this,-c,{nodeOffsetOverride:o})}else u=dm(t),u=A(EM,this,eF).call(this,u,{...n,nodeOffsetOverride:o});const m=!0===n.loop?n.loopRootPlacementId||r:void 0,v=!0===n.loop&&Number.isFinite(n.loopRootOffset)?n.loopRootOffset:!0===n.loop?u:void 0,g=l?c:a&&"end"===a.anchor?0:void 0,y=new OA({placementId:r,nodeId:i,offset:u,offsetPending:f,offsetAnchorPlacementId:f?d:void 0,offsetAnchorEdge:f?h:void 0,offsetAnchorIsReference:f?p:void 0,offsetEndSeconds:g,nodeOffsetOverride:o,nodeDurationOverride:s,loop:!0===n.loop,loopRootPlacementId:m,loopRootOffset:v});if(M(ZN,this).push(y),cm(M(ZN,this)),A(EM,this,cF).call(this,y),A(EM,this,aF).call(this),f&&d){const e=M(ZN,this).find((e=>(null==e?void 0:e.placementId)===d));A(EM,this,nF).call(this,null==e?void 0:e.nodeId)}return this.trigger(rv.PLACEMENT_ADDED,y),r}placeRenderNodeOnTimeline(e,t,n,i={}){const r="string"==typeof e?e:null==e?void 0:e.type;if(!r||"string"!=typeof r)throw new Error("Timeline.placeRenderNodeOnTimeline requires render node type");const o=A(EM,this,tF).call(this,t,i),s=o.offset,a=!0===o.offsetPending,l=o.offsetAnchorPlacementId,c=o.offsetAnchorEdge,u=o.offsetAnchorIsReference,d=M(nM,this).claim(i.renderPlacementId),h=Number(n),f=h===Number.POSITIVE_INFINITY,p=Number.isFinite(h)&&h>0||f?h:void 0;if(!p)throw new Error("Timeline.placeRenderNodeOnTimeline requires a positive duration (seconds) or Infinity as 3rd argument");const m=i.params&&"object"==typeof i.params?i.params:void 0,v={renderPlacementId:d,type:r,offset:s,offsetPending:a,offsetAnchorPlacementId:l,offsetAnchorEdge:c,offsetAnchorIsReference:u,duration:p,params:m};if(!a){const e=s,t=s+p;pm(M(tM,this),e,t,"Timeline.placeRenderNodeOnTimeline does not allow overlapping render node placements")}if(M(tM,this).push(v),cm(M(tM,this)),a&&l){const e=M(ZN,this).find((e=>(null==e?void 0:e.placementId)===l));A(EM,this,nF).call(this,null==e?void 0:e.nodeId)}return this.trigger(rv.RENDER_PLACEMENT_ADDED,v),d}get placements(){return M(ZN,this).slice()}getPlacementsActiveAtTime(e){return A(EM,this,yF).call(this,e)}getNodesAtTime(e){const t=A(EM,this,TF).call(this,e);if(!Number.isFinite(t))return[];const n=A(EM,this,yF).call(this,t),i=[];return n.forEach((e=>{const t=this.getNode(null==e?void 0:e.nodeId);t&&i.push(t)})),i}getPlacementDuration(e){return A(EM,this,ZM).call(this,e)}getNode(e){if(M(HN,this)&&"function"==typeof M(HN,this).get)return M(HN,this).get(e)}get renderPlacements(){return M(tM,this).slice()}get placementsAhead(){const e=this.currentTime;return M(ZN,this).filter((t=>{const n=am(t);if(!Number.isFinite(n))return!1;const i=A(EM,this,ZM).call(this,t);return"number"==typeof i?n+i>e:n>=e}))}get buffered(){return M(KN,this)?M(KN,this).buffered:{start:0,end:0}}get trackBuffers(){return M(iM,this)}onDispose(){A(EM,this,DM).call(this),M(lM,this)&&M(lM,this).clear(),M(_M,this)&&"function"==typeof M(_M,this).dispose&&M(_M,this).dispose(),C(_M,this,null),A(EM,this,RM).call(this),A(EM,this,LM).call(this),M(wM,this)&&"function"==typeof M(wM,this).dispose&&M(wM,this).dispose(),C(wM,this,null),M(QN,this)&&"function"==typeof M(QN,this).dispose&&(M(bM,this)&&"function"==typeof M(QN,this).off&&(M(QN,this).off("tick",M(bM,this)),C(bM,this,null)),M(QN,this).dispose(),C(QN,this,null)),A(EM,this,oF).call(this),C(KN,this,null),C(XN,this,null),C(ZN,this,[]),C(tM,this,[]),A(EM,this,sF).call(this),A(EM,this,aF).call(this),M(kM,this).clear(),C(xM,this,null)}notifyDecodedFrame(e={}){const t=null==e?void 0:e.placementId,n=null==e?void 0:e.trackType;if(!t||!n)return;const i=`${t}:${n}`;M(aM,this).add(i),A(EM,this,mF).call(this,e),A(EM,this,bF).call(this),M(KN,this)&&"function"==typeof M(KN,this).handleDecodedFrame&&M(KN,this).handleDecodedFrame(e)}getDecodedFrameStats(){return function(e){const t={totalBytes:0,frames:0,available:!1};if(!e||"function"!=typeof e.values)return t;for(const n of e.values()){const e=[];null!=n&&n.current&&e.push(n.current),Array.isArray(null==n?void 0:n.frames)&&e.push(...n.frames),e.forEach((e=>{const n=null==e?void 0:e.frame;if(!n||!0===n.__closed||!0===n.closed)return;t.frames+=1;const i=GN(e);Number.isFinite(i)&&i>0&&(t.totalBytes+=i)}))}return t.available=!0,t}(M(kM,this))}hasDecodedFirstFrame(e,t){return!(!e||!t)&&M(aM,this).has(`${e}:${t}`)}getDecodedVisualBuffer(e,t){if(e&&t)return M(kM,this).get(`${e}:${t}`)}computeBuffered(e){const t=M(HN,this);if(t&&"function"==typeof t.get)return M(iM,this).computeBuffered(M(ZN,this),e,t)}getActiveRenderPlacement(e=this.currentTime){const t=Number.isFinite(e)?e:this.currentTime,n=Array.isArray(M(tM,this))?M(tM,this):[];if(!n.length)return;let i;for(let e=0;e<n.length;e+=1){const r=n[e];if(!0===(null==r?void 0:r.offsetPending))continue;const o="number"==typeof r.offset?r.offset:void 0;if(!Number.isFinite(o))continue;const s=r.duration;("number"==typeof s&&Number.isFinite(s)&&s>0?t>=o&&t<o+s:t>=o)&&(i=r)}return i}}function AM(){C(sM,this,!1),this.trigger(rv.TIMELINE_RESET,{reason:"switch"}),A(EM,this,vF).call(this),M(iM,this)&&"function"==typeof M(iM,this).reset&&M(iM,this).reset(),M(lM,this)&&M(lM,this).clear(),C(ZN,this,[]),C(tM,this,[]),A(EM,this,sF).call(this),A(EM,this,aF).call(this),M(eM,this).reset(),M(nM,this).reset()}function NM(e=[]){for(let t=0;t<e.length;t+=1){const n=e[t];if(!n||!n.nodeId)continue;const i=A(EM,this,FM).call(this,n),r=A(EM,this,OM).call(this,n);this.placeOnTimeline(n.nodeId,r,i)}}function MM(e=[]){for(let t=0;t<e.length;t+=1){const n=e[t];if(!n||!n.type)continue;const i=A(EM,this,CM).call(this,n),r=A(EM,this,PM).call(this,n);this.placeRenderNodeOnTimeline(n.type,r,n.duration,i)}}function FM(e){const t={};return e.placementId&&(t.placementId=e.placementId),Number.isFinite(e.nodeOffsetOverride)&&(t.nodeOffsetOverride=e.nodeOffsetOverride),Number.isFinite(e.nodeDurationOverride)&&(t.nodeDurationOverride=e.nodeDurationOverride),!0===e.offsetPending&&(t.offsetPending=!0,e.offsetAnchorPlacementId&&(t.offsetAnchorPlacementId=e.offsetAnchorPlacementId),e.offsetAnchorEdge&&(t.offsetAnchorEdge=e.offsetAnchorEdge)),Number.isFinite(e.offsetEndSeconds)&&(t.offsetEndSeconds=e.offsetEndSeconds),!0===e.loop&&(t.loop=!0),e.loopRootPlacementId&&(t.loopRootPlacementId=e.loopRootPlacementId),Number.isFinite(e.loopRootOffset)&&(t.loopRootOffset=e.loopRootOffset),t}function CM(e){const t={};return e.renderPlacementId&&(t.renderPlacementId=e.renderPlacementId),e.params&&"object"==typeof e.params&&(t.params=e.params),t}function OM(e){if(!0===e.offsetPending&&e.offsetAnchorPlacementId&&e.offsetAnchorEdge){if(!0===e.offsetAnchorIsReference)return`${e.offsetAnchorPlacementId}@${e.offsetAnchorEdge}`;if("end"===e.offsetAnchorEdge)return Number.isFinite(e.offsetEndSeconds)&&e.offsetEndSeconds>0?-e.offsetEndSeconds:"end"}return"string"==typeof e.offset||Number.isFinite(e.offset)?e.offset:0}function PM(e){return!0===e.offsetPending&&e.offsetAnchorPlacementId&&e.offsetAnchorEdge&&!0===e.offsetAnchorIsReference?`${e.offsetAnchorPlacementId}@${e.offsetAnchorEdge}`:"string"==typeof e.offset||Number.isFinite(e.offset)?e.offset:0}function RM(){M(KN,this)&&"function"==typeof M(KN,this).exit&&M(KN,this).exit()}function DM(){M(TM,this)&&"function"==typeof this.off&&(this.off(rv.TIMELINE_SEEKED,M(TM,this)),C(TM,this,null)),M(IM,this)&&"function"==typeof this.off&&(this.off("nodestart",M(IM,this)),C(IM,this,null))}function LM(){M(iM,this)&&(M(rM,this)&&(M(iM,this).off("track:underflow",M(rM,this)),C(rM,this,null)),M(oM,this)&&(M(iM,this).off("track:ready",M(oM,this)),C(oM,this,null)),"function"==typeof M(iM,this).dispose&&M(iM,this).dispose(),C(iM,this,null))}function BM(){M(iM,this)&&"function"==typeof M(iM,this).on&&(C(rM,this,(e=>A(EM,this,$M).call(this,e))),C(oM,this,(e=>A(EM,this,UM).call(this,e))),M(iM,this).on(rv.TRACK_UNDERFLOW,M(rM,this)),M(iM,this).on(rv.TRACK_READY,M(oM,this)))}function zM(){M(QN,this)&&"function"==typeof M(QN,this).on&&(C(bM,this,(e=>A(EM,this,WM).call(this,e))),M(QN,this).on(rv.CLOCK_TICK,M(bM,this)))}function WM(e){var t,n;A(EM,this,XM).call(this),A(EM,this,bF).call(this),null!==(t=M(_M,this))&&void 0!==t&&null!==(n=t.handleTimeUpdate)&&void 0!==n&&n.call(t,this.currentTime,{isSeeking:!1}),A(EM,this,HM).call(this,this.currentTime),this.trigger(rv.TIMELINE_TIME_UPDATE,ov(this.currentTime,"clock")),M(KN,this)&&"function"==typeof M(KN,this).handleClockTick&&M(KN,this).handleClockTick(e)}function $M(e){A(EM,this,XM).call(this);const t=A(EM,this,jM).call(this);t&&(null==e?void 0:e.trackType)===t.trackType&&(M(KN,this)&&"function"==typeof M(KN,this).handleMainTrackUnderflow?M(KN,this).handleMainTrackUnderflow(e):this.transitionTo(dv))}function UM(e){if(A(EM,this,XM).call(this),this.state!==dv)return;const t=A(EM,this,jM).call(this);if(!t)return;if((null==e?void 0:e.trackType)!==t.trackType)return;if(M(KN,this)&&"function"==typeof M(KN,this).handleMainTrackReady)return void M(KN,this).handleMainTrackReady(e);const n=this.getLastStableState()||hv;this.transitionTo(n)}function jM(e=this.currentTime){const t=A(EM,this,VM).call(this,e);if(!t)return;const n=M(HN,this)&&"function"==typeof M(HN,this).get?M(HN,this).get(t.nodeId):void 0;if(!n)return;const i=A(EM,this,qM).call(this,n);return i?{placement:t,trackType:i}:void 0}function qM(e){var t;const n=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[];let i;if(null!=e&&e.mainTrackId){const t=n.find((t=>(null==t?void 0:t.id)===e.mainTrackId));i=null==t?void 0:t.type}if(i||(i=null===(t=n.find((e=>null==e?void 0:e.type)))||void 0===t?void 0:t.type),"video"===i||"audio"===i||"image"===i)return i}function VM(e=this.currentTime){const t=M(ZN,this)||[];let n;for(let i=0;i<t.length;i+=1){const r=t[i],o=am(r);if(!Number.isFinite(o))continue;const s=A(EM,this,ZM).call(this,r);if(Number.isFinite(s)){if(e>=o&&e<o+s)return r}else if(e<=o)return r;!n&&e<o&&(n=r)}return n}function GM(e={}){if(this.state!==cv)return;const t=null==e?void 0:e.placementId;if(!t)return;const n=A(EM,this,_F).call(this,t);n&&A(EM,this,KM).call(this,n)}function HM(e=this.currentTime){if(this.state!==cv)return;const t=A(EM,this,yF).call(this,e);Array.isArray(t)&&t.length&&t.forEach((e=>A(EM,this,KM).call(this,e)))}function KM(e){const t=null==e?void 0:e.placementId;if(!t)return;if(M(lM,this).has(t))return;if(!e||!0!==e.loop)return;if(!e.nodeId)return;const n=A(EM,this,ZM).call(this,e);if(!Number.isFinite(n)||n<=0)return;const i=am(e);if(!Number.isFinite(i))return;const r=i+n;if(!Number.isFinite(r))return;const o=e.loopRootPlacementId||e.placementId,s=Number.isFinite(e.loopRootOffset)?e.loopRootOffset:i;M(lM,this).add(t),this.placeOnTimeline(e.nodeId,r,{nodeOffsetOverride:e.nodeOffsetOverride,nodeDurationOverride:e.nodeDurationOverride,loop:!0,loopRootPlacementId:o,loopRootOffset:s})}function XM(){const e=um(M(ZN,this),{getPlacementDuration:e=>A(EM,this,ZM).call(this,e),snapPlacementOffset:(e,t)=>A(EM,this,eF).call(this,e,{nodeOffsetOverride:null==t?void 0:t.nodeOffsetOverride}),onResolvedPlacement:(e,t)=>{!0!==e.loop||Number.isFinite(e.loopRootOffset)||(e.loopRootOffset=e.offset),A(EM,this,iF).call(this,null==t?void 0:t.nodeId)}});return e.updated&&(A(EM,this,aF).call(this),e.resolvedPlacements.forEach((e=>{A(EM,this,cF).call(this,e),this.trigger(rv.PLACEMENT_ADDED,e)}))),e.updated}function YM(){if(!M(tM,this).length||!M(ZN,this).length)return!1;const e=new Map;M(ZN,this).forEach((t=>{(null==t?void 0:t.placementId)&&e.set(t.placementId,t)}));const t=M(tM,this).filter((e=>!0===(null==e?void 0:e.offsetPending)));if(!t.length)return!1;let n=!1;const i=[];for(let r=0;r<t.length;r+=1){const o=t[r];A(EM,this,QM).call(this,o,e)&&(n=!0,i.push(o))}return n&&(cm(M(tM,this)),i.forEach((e=>{this.trigger(rv.RENDER_PLACEMENT_ADDED,e)}))),n}function QM(e,t){const n=null==e?void 0:e.offsetAnchorPlacementId,i=null==e?void 0:e.offsetAnchorEdge;if(!n||!i)return!1;const r=t.get(n);if(!r||!0===r.offsetPending)return!1;const o=A(EM,this,JM).call(this,r,e);if(!Number.isFinite(o))return!1;e.offset=o,e.offsetPending=!1,e.offsetAnchorPlacementId=void 0,e.offsetAnchorEdge=void 0,e.offsetAnchorIsReference=void 0;const s=e.offset,a=e.offset+e.duration;return pm(M(tM,this).filter((t=>t!==e&&!0!==(null==t?void 0:t.offsetPending))),s,a,"Timeline.placeRenderNodeOnTimeline does not allow overlapping render node placements"),A(EM,this,iF).call(this,null==r?void 0:r.nodeId),!0}function JM(e,t){const n=am(e);if(!Number.isFinite(n))return;if("start"===t.offsetAnchorEdge)return A(EM,this,eF).call(this,n);const i=A(EM,this,ZM).call(this,e);if(!(i>0))return;const r=n+i;if(!Number.isFinite(r))return;const o=A(EM,this,eF).call(this,r);return!0===t.offsetAnchorIsReference?Math.max(o,r):o}function ZM(e){return om(e,M(HN,this))}function eF(e,t={}){var n;return function(e,t={},n){const i=Number(n);if(!(i>0))return e;const r=Number(e);if(!Number.isFinite(r))return e;const o=Number.isFinite(null==t?void 0:t.nodeOffsetOverride)?t.nodeOffsetOverride:0,s=r-o;return Math.round(s*i)/i+o}(e,t,null===(n=this.settings)||void 0===n?void 0:n.snapToFps)}function tF(e,t={}){const n=fm(e);if("string"==typeof e&&e.includes("@")&&!n)throw new Error("Timeline.placeRenderNodeOnTimeline requires valid placement reference");if(!n){const n=dm(e);return{offset:A(EM,this,eF).call(this,n,t)}}const i=M(ZN,this).find((e=>(null==e?void 0:e.placementId)===n.placementId));if(!i)throw new Error("Timeline.placeRenderNodeOnTimeline requires valid placement reference");const r=am(i);if("start"===n.anchor)return Number.isFinite(r)?{offset:A(EM,this,eF).call(this,r,t)}:{offset:void 0,offsetPending:!0,offsetAnchorPlacementId:i.placementId,offsetAnchorEdge:"start",offsetAnchorIsReference:!0};const o=A(EM,this,ZM).call(this,i);if(!(Number.isFinite(r)&&o>0))return{offset:void 0,offsetPending:!0,offsetAnchorPlacementId:i.placementId,offsetAnchorEdge:"end",offsetAnchorIsReference:!0};const s=r+o,a=A(EM,this,eF).call(this,s,t);return{offset:Math.max(a,s)}}function nF(e){if(!e||!M(HN,this)||"function"!=typeof M(HN,this).get)return;if(M(cM,this).has(e))return;let t;try{t=M(HN,this).get(e)}catch(e){return}if(!t||"function"!=typeof t.on)return;if("ready"===t.state&&t.duration>0)return void this.updateTime(this.currentTime);const n=()=>{this.updateTime(this.currentTime),A(EM,this,iF).call(this,e)};t.on(rv.NODE_LOADED,n),M(cM,this).set(e,n)}function iF(e){if(!e)return;if(A(EM,this,rF).call(this,e))return;const t=M(cM,this).get(e);if(!t)return;let n;try{n=M(HN,this).get(e)}catch(e){n=null}n&&"function"==typeof n.off&&n.off(rv.NODE_LOADED,t),M(cM,this).delete(e)}function rF(e){if(!e)return!1;const t=new Map;M(ZN,this).forEach((e=>{(null==e?void 0:e.placementId)&&t.set(e.placementId,e)}));const n=n=>{if(null==n||!n.offsetPending||null==n||!n.offsetAnchorPlacementId)return!1;const i=t.get(n.offsetAnchorPlacementId);return(null==i?void 0:i.nodeId)===e};return!!M(ZN,this).some((e=>n(e)))||!!M(tM,this).some((e=>n(e)))}function oF(){M(cM,this).size&&M(HN,this)?(M(cM,this).forEach(((e,t)=>{let n;try{n=M(HN,this).get(t)}catch(e){n=null}n&&"function"==typeof n.off&&n.off(rv.NODE_LOADED,e)})),M(cM,this).clear()):M(cM,this).clear()}function sF(){C(uM,this,[]),C(dM,this,0),M(hM,this).clear(),M(fM,this).clear(),C(pM,this,Number.NEGATIVE_INFINITY)}function aF(){C(mM,this,[]),C(gM,this,0),C(vM,this,Number.NEGATIVE_INFINITY)}function lF(e,t){const n=M(uM,this),i={placementId:e,endTime:t};if(!n.length||t>=n[n.length-1].endTime)return void n.push(i);const r=n.findIndex((e=>t<e.endTime)),o=-1===r?n.length:r;n.splice(o,0,i),o<M(dM,this)&&C(dM,this,M(dM,this)+1)}function cF(e){const t=null==e?void 0:e.placementId;if(!t||M(hM,this).has(t))return;const n=am(e),i=A(EM,this,ZM).call(this,e);if(!Number.isFinite(n)||!Number.isFinite(i)||i<0)return void M(fM,this).add(t);const r=n+i;Number.isFinite(r)&&(M(hM,this).add(t),M(fM,this).delete(t),A(EM,this,lF).call(this,t,r))}function uF(){M(fM,this).size&&Array.from(M(fM,this)).forEach((e=>{const t=A(EM,this,_F).call(this,e);t?A(EM,this,cF).call(this,t):M(fM,this).delete(e)}))}function dF(e){const t=Number(e);if(!Number.isFinite(t))return;if(t<M(pM,this))return void C(pM,this,t);if(C(pM,this,t),A(EM,this,uF).call(this),!M(uM,this).length)return;const n=new Set;let i=M(dM,this);for(;i<M(uM,this).length;){const e=M(uM,this)[i];if(!e||!Number.isFinite(e.endTime)||e.endTime>t)break;e.placementId&&n.add(e.placementId),i+=1}i!==M(dM,this)&&(C(dM,this,i),n.size&&(A(EM,this,pF).call(this,n),A(EM,this,hF).call(this,n)))}function hF(e){if(e&&e.size)for(const t of M(aM,this)){const n=t.split(":")[0];e.has(n)&&M(aM,this).delete(t)}}function fF(e){const t=Array.isArray(null==e?void 0:e.frames)?e.frames:[],n=null==e?void 0:e.current;(n?[n,...t]:t).forEach((e=>{const t=null==e?void 0:e.frame;if(t&&"function"==typeof t.close)try{t.close()}catch(e){}}))}function pF(e){if(e&&e.size)for(const[t,n]of M(kM,this).entries())e.has(null==n?void 0:n.placementId)&&(A(EM,this,fF).call(this,n),M(kM,this).delete(t))}function mF(e={}){var t;const n=null==e?void 0:e.placementId,i=null==e?void 0:e.nodeId,r=null==e?void 0:e.trackId,o=null==e?void 0:e.segmentId,s=null==e?void 0:e.trackType;if(!(n&&i&&r&&o))return;if("video"!==s&&"image"!==s)return;const a=(null==e?void 0:e.frame)||(null==e?void 0:e.data);if(!a)return;"video"===s&&"object"==typeof a&&"function"==typeof a.close&&(a.__keepOpen=!0);const l=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==e?void 0:e.pts)?e.pts:void 0;if(!Number.isFinite(d))return;const h=Number.isFinite(null==e?void 0:e.duration)?e.duration:void 0,f=`${n}:${r}`,p=M(kM,this).get(f),m=p||{placementId:n,nodeId:i,trackId:r,trackType:s,frames:[],current:void 0},v={placementId:n,nodeId:i,trackId:r,segmentId:o,frame:a,width:c,height:u,presentationTime:d,duration:h},g=m.frames,y=g.length?g[g.length-1]:void 0;if(!y||y.presentationTime<=v.presentationTime)g.push(v);else{let e=g.findIndex((e=>e.presentationTime>v.presentationTime));-1===e&&(e=g.length),g.splice(e,0,v)}const b=Number(null===(t=this.settings)||void 0===t?void 0:t.maxBufferedVideoFrames);if("video"===s&&Number.isFinite(b)&&b>0&&g.length>b){const e=g.length-b;for(let t=0;t<e;t+=1){const e=g.pop(),t=null==e?void 0:e.frame;if(t&&"function"==typeof t.close)try{t.close()}catch(e){}}}p||M(kM,this).set(f,m)}function vF(){for(const e of M(kM,this).values())A(EM,this,fF).call(this,e);M(kM,this).clear(),C(xM,this,null),M(aM,this).clear()}function gF(e){const t=Number.isFinite(e)?e:this.currentTime;if(!Number.isFinite(t))return;t<M(vM,this)&&(C(mM,this,[]),C(gM,this,0));const n=Array.isArray(M(ZN,this))?M(ZN,this):[],i=[],r=new Set;M(mM,this).forEach((e=>{A(EM,this,AF).call(this,e,t)&&(i.push(e),(null==e?void 0:e.placementId)&&r.add(e.placementId))}));let o=M(gM,this);for(;o<n.length;){const e=n[o],s=am(e);if(!Number.isFinite(s))break;if(s>t)break;if(A(EM,this,AF).call(this,e,t)){const t=null==e?void 0:e.placementId;t&&r.has(t)||(i.push(e),t&&r.add(t))}o+=1}C(mM,this,i),C(gM,this,o),C(vM,this,t)}function yF(e,t={}){const n=Number.isFinite(e)?e:this.currentTime,i=Number.isFinite(null==t?void 0:t.endEpsilonSeconds)?t.endEpsilonSeconds:0;return 0===i&&n===this.currentTime&&n===M(vM,this)?M(mM,this).slice():(Array.isArray(M(ZN,this))?M(ZN,this):[]).filter((e=>A(EM,this,AF).call(this,e,n,i)))}function bF(){const e=this.currentTime,t=A(EM,this,xF).call(this,e);if(!t.length)return void C(xM,this,null);const n=this.getActiveRenderPlacement(e),i=A(EM,this,wF).call(this,t,n);(i!==M(xM,this)||A(EM,this,kF).call(this,e,n))&&(C(xM,this,i),this.trigger(rv.VISUAL_FRAMES_AVAILABLE,{time:e,frames:t}))}function kF(e,t){const n=t||this.getActiveRenderPlacement(e);if(!n)return!1;if(!Mm.doesRenderNodeTypeRequireFrameCadence(null==n?void 0:n.type))return!1;const i=n.duration;return"number"==typeof i&&i>0}function xF(e){return function(e={}){const t=e.buffers,n=e.time,i=e.getPlacementById,r=e.isPlacementActiveAtTime,o=e.getPlacementDuration,s=[];if(!t||"function"!=typeof t.entries)return[];const a=[];for(const[e,c]of t.entries()){const t=null==c?void 0:c.placementId,u="function"==typeof i?i(t):void 0;if(!u){kN(c),a.push(e);continue}if("function"==typeof r&&!r(u,n)){const t=xN(u),i="function"==typeof o?o(u):void 0;Number.isFinite(i)&&Number.isFinite(t)&&n>=t+i&&(kN(c),a.push(e));continue}const d=Array.isArray(null==c?void 0:c.frames)?c.frames:[];for(;d.length&&Number.isFinite(null===(l=d[0])||void 0===l?void 0:l.presentationTime)&&d[0].presentationTime<=n;){var l;const e=c.current,t=d.shift();c.current=t,e&&e!==t&&bN(null==e?void 0:e.frame)}if(!c.current)continue;const h={placementId:t,nodeId:c.current.nodeId,trackId:c.current.trackId,segmentId:c.current.segmentId,frame:c.current.frame,width:c.current.width,height:c.current.height,presentationTime:c.current.presentationTime,duration:c.current.duration};s.push({frame:h,placementId:t,placementOffset:xN(u),placementSortOffset:wN(u),placementSortId:_N(u,t)})}return a.forEach((e=>{t.delete(e)})),s.sort(((e,t)=>{const n=Number.isFinite(null==e?void 0:e.placementSortOffset)?e.placementSortOffset:Number.isFinite(null==e?void 0:e.placementOffset)?e.placementOffset:0,i=Number.isFinite(null==t?void 0:t.placementSortOffset)?t.placementSortOffset:Number.isFinite(null==t?void 0:t.placementOffset)?t.placementOffset:0;if(n!==i)return n-i;const r=(null==e?void 0:e.placementSortId)||(null==e?void 0:e.placementId),o=(null==t?void 0:t.placementSortId)||(null==t?void 0:t.placementId),s=TN(r),a=TN(o);return Number.isFinite(s)&&Number.isFinite(a)&&s!==a?s-a:r&&o&&r!==o?r<o?-1:1:function(e,t){const n=(null==e?void 0:e.frame)||{},i=(null==t?void 0:t.frame)||{};return n.trackId!==i.trackId?n.trackId<i.trackId?-1:1:n.nodeId!==i.nodeId?n.nodeId<i.nodeId?-1:1:n.segmentId!==i.segmentId?n.segmentId<i.segmentId?-1:1:("number"==typeof n.presentationTime?n.presentationTime:0)-("number"==typeof i.presentationTime?i.presentationTime:0)}(e,t)})),s.map((e=>e.frame))}({buffers:M(kM,this),time:e,getPlacementById:e=>A(EM,this,_F).call(this,e),isPlacementActiveAtTime:(e,t)=>A(EM,this,AF).call(this,e,t),getPlacementDuration:e=>A(EM,this,ZM).call(this,e)})}function wF(e,t){return`${t?`render:${t.renderPlacementId||t.type||"unknown"}`:"render:default"}|${e.map((e=>`${e.nodeId}:${e.trackId}:${e.segmentId}@${e.presentationTime}`)).join("|")}`}function _F(e){if(e)return(M(ZN,this)||[]).find((t=>(null==t?void 0:t.placementId)===e))}function TF(e){if("end"===e){const e=A(EM,this,IF).call(this);if(!Number.isFinite(e))return;const t=A(EM,this,EF).call(this);return Math.max(0,e-Math.min(e,t))}const t=Number(e);return Number.isFinite(t)?t:0}function IF(){let e;return(Array.isArray(M(ZN,this))?M(ZN,this):[]).forEach((t=>{const n=am(t);if(!Number.isFinite(n))return;const i=A(EM,this,ZM).call(this,t);if(!Number.isFinite(i))return;const r=n+i;Number.isFinite(r)&&(!Number.isFinite(e)||r>e)&&(e=r)})),e}function EF(){const e=A(EM,this,SF).call(this);return e>0?e:.001}function SF(){var e;const t=Number(null===(e=this.settings)||void 0===e?void 0:e.snapToFps);return!Number.isFinite(t)||t<=0?0:.5/t}function AF(e,t,n=0){if(!lm(e,t,M(HN,this)))return!1;const i=Number(n);if(!Number.isFinite(i)||i<=0)return!0;const r=A(EM,this,ZM).call(this,e);if(!Number.isFinite(r))return!0;const o=am(e);return!Number.isFinite(o)||t<o+r-i}var NF=new WeakMap,MF=new WeakMap,FF=new WeakMap,CF=new WeakMap,OF=new WeakMap,PF=new WeakMap,RF=new WeakMap,DF=new WeakMap,LF=new WeakMap,BF=new WeakMap,zF=new WeakMap,WF=new WeakMap,$F=new WeakMap,UF=new WeakMap,jF=new WeakMap,qF=new WeakMap,VF=new WeakMap,GF=new WeakSet;class HF extends rd{get name(){return"QoE"}get defaults(){return{calcScoreInterval:1,streamQualityWeight:.8,fpsWeight:.2,fpsMathFuncType:"quad",bestFpsMobile:27,bestFpsDesktop:57,waitingMultiplier:1,statusFloors:{excellent:.98,good:.85,fair:.7,poor:0,alert:0},alertStatusCeil:.3,fpsGracePeriod:2,windowSeconds:30}}constructor(...e){super(...e),O(this,GF),F(this,NF,void 0),F(this,MF,void 0),F(this,FF,1),F(this,CF,1),F(this,OF,1),F(this,PF,""),F(this,RF,0),F(this,DF,[]),F(this,LF,null),F(this,BF,void 0),F(this,zF,[]),F(this,WF,null),F(this,$F,null),F(this,UF,0),F(this,jF,0),F(this,qF,0),F(this,VF,void 0);const[t]=e;C(NF,this,t),C(UF,this,sy()),C(VF,this,A(GF,this,KF).call(this)),A(GF,this,XF).call(this),A(GF,this,YF).call(this),A(GF,this,tC).call(this),A(GF,this,ZF).call(this)}get publicAPI(){return M(VF,this)}calcScore(){A(GF,this,uC).call(this)}onDispose(){M(NF,this)&&M(MF,this)&&"function"==typeof M(NF,this).off&&M(NF,this).off(rv.TIMELINE_PLAYER_STATE,M(MF,this)),C(MF,this,null),A(GF,this,eC).call(this),A(GF,this,nC).call(this),C(NF,this,null),C(zF,this,[]),C(DF,this,[]),C(VF,this,null)}}function KF(){const e=this;return{get score(){return M(FF,e)},get status(){return M(PF,e)},get streamQualityScore(){return M(CF,e)},get fpsScore(){return M(OF,e)},get browserFps(){return M(RF,e)},get waitingSeconds(){return M(jF,e)/1e3},get playingSeconds(){return M(qF,e)/1e3}}}function XF(){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 YF(){M(NF,this)&&"function"==typeof M(NF,this).on&&(C(MF,this,(e=>A(GF,this,QF).call(this,e))),M(NF,this).on(rv.TIMELINE_PLAYER_STATE,M(MF,this)))}function QF(e={}){const t="string"==typeof(null==e?void 0:e.event)?e.event:"";"playing"!==t?"waiting"!==t?"pause"!==t&&"seeking"!==t&&"seeked"!==t&&"reset"!==t||A(GF,this,JF).call(this,null):A(GF,this,JF).call(this,"waiting"):A(GF,this,JF).call(this,"playing")}function JF(e){if(e===M(WF,this))return;const t=sy();M(WF,this)&&Number.isFinite(M($F,this))&&M(zF,this).push({state:M(WF,this),startMs:M($F,this),endMs:t}),C(WF,this,e),C($F,this,e?t:null),A(GF,this,oC).call(this,t)}function ZF(){const e=Number(this.settings.calcScoreInterval);!Number.isFinite(e)||e<=0||(C(BF,this,(()=>A(GF,this,uC).call(this))),jk(M(BF,this),1e3*e))}function eC(){M(BF,this)&&qk(M(BF,this)),C(BF,this,null)}function tC(){if("function"!=typeof Ok)return;const e=()=>{if(this._disposed)return;const t=sy();C(RF,this,A(GF,this,iC).call(this,M(DF,this),t)),C(LF,this,Ok(e))};C(LF,this,Ok(e))}function nC(){M(LF,this)&&"function"==typeof Pk&&Pk(M(LF,this)),C(LF,this,null)}function iC(e,t){const n=A(GF,this,rC).call(this);for(e.push(t);e.length&&t-e[0]>n;)e.shift();if(e.length<2)return 0;const i=e[e.length-1]-e[0];return i<=0?0:1e3*(e.length-1)/i}function rC(){const e=Number(this.settings.windowSeconds);return!Number.isFinite(e)||e<=0?3e4:1e3*e}function oC(e){const t=e-A(GF,this,rC).call(this);for(;M(zF,this).length&&M(zF,this)[0].endMs<=t;)M(zF,this).shift()}function sC(e){const t=e-A(GF,this,rC).call(this);let n=0,i=0;const r=(r,o,s)=>{const a=Math.max(o,t),l=Math.min(s,e);l<=a||("waiting"===r?n+=l-a:"playing"===r&&(i+=l-a))};return M(zF,this).forEach((e=>{r(e.state,e.startMs,e.endMs)})),M(WF,this)&&Number.isFinite(M($F,this))&&r(M(WF,this),M($F,this),e),C(jF,this,n),C(qF,this,i),{waitingMs:n,playingMs:i}}function aC(e,t){if(e<=0)return 1;if(e>t)return 0;const n=t||1;return im(1-e*this.settings.waitingMultiplier/n)}function lC(){if(sy()-M(UF,this)<=1e3*this.settings.fpsGracePeriod)return 1;const e=Number(M(RF,this)),t=nv.isDesktop()?this.settings.bestFpsDesktop:this.settings.bestFpsMobile,n=im(t>0?e/t:0);return"quad"===this.settings.fpsMathFuncType?n*n:n}function cC(e,t){const n=this.settings.statusFloors||{};let i="";return e>=n.excellent?i="excellent":e>=n.good?i="good":e>=n.fair?i="fair":(i="poor",e<=this.settings.alertStatusCeil&&t>0&&(i="alert")),i}function uC(){const e=sy(),{waitingMs:t,playingMs:n}=A(GF,this,sC).call(this,e),i=A(GF,this,aC).call(this,t,n),r=A(GF,this,lC).call(this),o=im(i*this.settings.streamQualityWeight+r*this.settings.fpsWeight);o!==M(FF,this)&&(C(FF,this,o),this.trigger(rv.QOE_SCORE,o)),C(CF,this,i),C(OF,this,r);const s=A(GF,this,cC).call(this,o,t);s!==M(PF,this)&&(C(PF,this,s),this.trigger(rv.QOE_STATUS,s))}function dC(e,t=0){const n=Number(e);return Number.isFinite(n)?n:t}function hC(e){const t=Number(e);return!Number.isFinite(t)||t<0?0:t}var fC=new WeakMap,pC=new WeakMap,mC=new WeakMap,vC=new WeakMap,gC=new WeakSet;class yC extends rd{get name(){return"SegmentEvictionCoordinator"}get defaults(){return{enabled:_y("segmentEvictionEnabled"),bufferBehindSeconds:_y("segmentEvictionBufferBehindSeconds"),bufferAheadSeconds:_y("segmentEvictionBufferAheadSeconds"),maxRetainedBytes:_y("segmentEvictionMaxRetainedBytes")}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"evictAtTime"])}constructor(e,t,n={}){super(n),O(this,gC),F(this,fC,void 0),F(this,pC,void 0),F(this,mC,void 0),F(this,vC,void 0),C(fC,this,e),C(pC,this,t),C(mC,this,(e=>A(gC,this,bC).call(this,e))),C(vC,this,(e=>A(gC,this,kC).call(this,e))),M(fC,this)&&"function"==typeof M(fC,this).on&&(M(fC,this).on(rv.TIMELINE_TIME_UPDATE,M(mC,this)),M(fC,this).on(rv.TIMELINE_SEEKED,M(vC,this)))}onDispose(){M(fC,this)&&"function"==typeof M(fC,this).off&&(M(fC,this).off(rv.TIMELINE_TIME_UPDATE,M(mC,this)),M(fC,this).off(rv.TIMELINE_SEEKED,M(vC,this))),C(fC,this,null),C(pC,this,null),C(mC,this,null),C(vC,this,null)}evictAtTime(e){if(!0!==this.settings.enabled)return;const t=Number(e);if(!Number.isFinite(t))return;const n=hC(this.settings.bufferBehindSeconds),i=hC(this.settings.bufferAheadSeconds),r=t-n,o=t+i,s=A(gC,this,xC).call(this);if(!s.length)return;const a=Number(this.settings.maxRetainedBytes);if(Number.isFinite(a)&&a>0&&A(gC,this,wC).call(this,s)<=a)return;const l=new Map;s.forEach((e=>{const t=null==e?void 0:e.nodeId;if(!t)return;const n=am(e);if(!Number.isFinite(n))return;const i=l.get(t)||[];i.push(e),l.set(t,i)})),l.size&&l.forEach(((e,t)=>{const n=A(gC,this,_C).call(this,t);if(!n)return;const i=e.filter((e=>A(gC,this,TC).call(this,e,r,o)));i.length?A(gC,this,IC).call(this,n,i,r,o):"function"==typeof n.evict&&n.evict()}))}}function bC(e){var t,n;if(!0!==this.settings.enabled)return;if((null===(t=M(fC,this))||void 0===t?void 0:t.state)===fv)return;const i=Number(null==e?void 0:e.time),r=Number.isFinite(i)?i:Number(null===(n=M(fC,this))||void 0===n?void 0:n.currentTime);this.evictAtTime(r)}function kC(e){var t;if(!0!==this.settings.enabled)return;const n=Number(null==e?void 0:e.targetTime),i=Number.isFinite(n)?n:Number(null===(t=M(fC,this))||void 0===t?void 0:t.currentTime);this.evictAtTime(i)}function xC(){var e;const t=null===(e=M(fC,this))||void 0===e?void 0:e.placements;return Array.isArray(t)?t:[]}function wC(e){if(!Array.isArray(e)||!e.length)return 0;const t=new Set;let n=0;return e.forEach((e=>{const i=null==e?void 0:e.nodeId;if(!i||t.has(i))return;t.add(i);const r=A(gC,this,_C).call(this,i),o=Number(null==r?void 0:r.retainedByteLength);Pg(o)?n+=o:(Array.isArray(null==r?void 0:r.tracks)?r.tracks:[]).forEach((e=>{(Array.isArray(null==e?void 0:e.segments)?e.segments:[]).forEach((e=>{Pg(null==e?void 0:e.retainedByteLength)&&(n+=e.retainedByteLength)}))}))})),n}function _C(e){if(M(pC,this)&&"function"==typeof M(pC,this).get)return M(pC,this).get(e)}function TC(e,t,n){const i=am(e);if(!Number.isFinite(i))return!1;const r=om(e,M(pC,this));return(Number.isFinite(r)?i+r:Number.POSITIVE_INFINITY)>t&&i<n}function IC(e,t,n,i){const r=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[];r.length&&r.forEach((e=>{const r=Array.isArray(null==e?void 0:e.segments)?e.segments:[],o=dC(null==e?void 0:e.offset,0);r.forEach((e=>{if(!e||!Pg(null==(r=e)?void 0:r.retainedByteLength))return;var r;if(e.isInit)return;let s=!1;for(let r=0;r<t.length;r+=1){const a=t[r],l=am(a);if(!Number.isFinite(l))continue;const c=dC(null==a?void 0:a.nodeOffsetOverride,0),u=dC(null==e?void 0:e.offset,NaN);if(!Number.isFinite(u))continue;const d=dC(null==e?void 0:e.duration,0),h=l+o+u-c,f=h+(d>0?d:0),p=om(a,M(pC,this)),m=Number.isFinite(p)?l+p:Number.POSITIVE_INFINITY;if(!(f<=l||h>=m||f<=n||h>=i)){s=!0;break}}s||e.evict()}))}))}var EC=new WeakMap,SC=new WeakMap,AC=new WeakMap,NC=new WeakSet;let MC=class extends rd{get name(){return"DocumentVisibility"}get defaults(){return{autoPauseOnVisibilityChange:!0,autoResumeOnVisibilityChange:!0}}constructor(e,t={}){super(t),O(this,NC),F(this,EC,void 0),F(this,SC,null),F(this,AC,!1),C(EC,this,e),A(NC,this,FC).call(this)}onDispose(){A(NC,this,CC).call(this),C(EC,this,null),C(AC,this,!1)}};function FC(){const e=null==ad?void 0:ad.document;e&&"function"==typeof e.addEventListener&&(C(SC,this,(()=>A(NC,this,OC).call(this))),e.addEventListener("visibilitychange",M(SC,this)))}function CC(){const e=null==ad?void 0:ad.document;M(SC,this)&&e&&"function"==typeof e.removeEventListener&&e.removeEventListener("visibilitychange",M(SC,this)),C(SC,this,null)}function OC(){const e=null==ad?void 0:ad.document,t=null==e?void 0:e.visibilityState;"string"==typeof t&&("hidden"!==t?"visible"===t&&A(NC,this,RC).call(this):A(NC,this,PC).call(this))}function PC(){var e;(null===(e=this.settings)||void 0===e?void 0:e.autoPauseOnVisibilityChange)&&M(EC,this)&&"function"==typeof M(EC,this).pause&&(M(EC,this).state===cv?(this.log.info("[#handleHidden] Pausing timeline due to document visibility change"),M(EC,this).pause(),C(AC,this,!0)):C(AC,this,!1))}function RC(){var e;M(AC,this)&&(null===(e=this.settings)||void 0===e?void 0:e.autoResumeOnVisibilityChange)&&M(EC,this)&&"function"==typeof M(EC,this).play&&(M(EC,this).state!==cv?(this.log.info("[#handleVisible] Resuming timeline due to document visibility change"),M(EC,this).play(),C(AC,this,!1)):C(AC,this,!1))}const DC=[{event:"canplay",once:!0,trackAs:"canplay"},{event:"playing",once:!0,trackAs:"startedplaying"},"play","playing","waiting","pause","seeking","seeked","nodestart","nodeend"];function LC(e,t=0){return Number.isFinite(e)?e:t}function BC(e){const t=null==e?void 0:e.exposedPlayerAPI;return t&&"object"==typeof t?t:e}const zC=[function(e){return{schema:"iglu:com.helloeko/player/jsonschema/1-0-6",match:/^.*$/,getData:()=>{var t,n,i;const r=function(e){const t=null==e?void 0:e.exposedPlayerAPI;return t&&"object"==typeof t?t:e}(e);return{playerversion:"string"==typeof(null==r?void 0:r.version)?r.version:"0.0.0",isautoplay:!(null==r||null===(t=r.options)||void 0===t||!t.autoplay),playerqoe:LC(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:LC(null==r?void 0:r.volume),playercontainerwidth:LC(null==r?void 0:r.containerWidth),playercontainerheight:LC(null==r?void 0:r.containerHeight)}}}},function(e){return{schema:"iglu:com.helloeko/currentnode/jsonschema/1-0-1",match:/^.*$/,getData:()=>{var t;const n=BC(e),i=function(e){const t=BC(e);if(!t||"function"!=typeof t.getNodesAtTime)return null;const n=Number.isFinite(t.currentTime)?t.currentTime:0,i=t.getNodesAtTime(n);return Array.isArray(i)&&0!==i.length&&i[0]||null}(e);return{currentnodeid:"string"==typeof(null==i?void 0:i.id)?i.id:"",currentnodetime:Number.isFinite(null==n?void 0:n.currentTime)?n.currentTime:0,currentnodeduration:Number.isFinite(null==i?void 0:i.duration)?i.duration:0,currentnodeprofile:"string"==typeof(null==i||null===(t=i.metadata)||void 0===t?void 0:t.profile)?i.metadata.profile:""}}}},function(e){let t=0,n=0;const i=()=>{t||(t=Date.now(),n=0)},r=()=>{t&&!n&&(n=Date.now())};return e&&"function"==typeof e.on&&(e.on("seeking",i),e.on("seeked",r)),{schema:"iglu:com.helloeko/seeked/jsonschema/1-0-0",match:"seeked",getData:()=>{r();const e=t&&n&&n>=t?(n-t)/1e3:0;return t=0,n=0,{seekduration:e}},dispose:()=>{e&&"function"==typeof e.off&&(e.off("seeking",i),e.off("seeked",r))}}},function(){return{schema:"iglu:com.helloeko/environment/jsonschema/1-0-0",match:/^.*$/,getData:()=>{var e;const t=null==ad||null===(e=ad.eko)||void 0===e||null===(e=e.environment)||void 0===e?void 0:e.embeddingApp;return t?{embeddingapp:t}:{}}}}],WC=Object.freeze({once:!1,trackAs:""});var $C=new WeakMap,UC=new WeakMap,jC=new WeakMap,qC=new WeakMap,VC=new WeakSet;class GC extends rd{get name(){return"Tracker"}get defaults(){return{trackingEnabled:_y("trackingEnabled"),defaultForwarders:DC,defaultContextPackers:zC}}constructor(e,t={}){super(t),O(this,VC),F(this,$C,void 0),F(this,UC,new Map),F(this,jC,[]),F(this,qC,!1),C($C,this,e),A(VC,this,JC).call(this),A(VC,this,HC).call(this)}track(e,...t){if(!this.settings.trackingEnabled)return;if("string"!=typeof e||!e)return void this.log.warn("[track] Expected event to be a non-empty string.");const n=A(VC,this,eO).call(this);n&&n("track",e,...t)}registerContextPacker(e){if(!e||"object"!=typeof e)return void this.log.warn("[registerContextPacker] Expected a packer object.");const t={schema:e.schema,match:e.match,getData:e.getData};if("string"!=typeof t.schema||!t.schema)return void this.log.warn('[registerContextPacker] Expected "schema" to be a non-empty string.');if("function"!=typeof t.getData)return void this.log.warn('[registerContextPacker] Expected "getData" to be a function.');if(!this.settings.trackingEnabled)return;const n=A(VC,this,eO).call(this);n&&n("registerContextPacker",t)}onDispose(){A(VC,this,QC).call(this),A(VC,this,ZC).call(this),C($C,this,null),C(qC,this,!1)}}function HC(){(Array.isArray(this.settings.defaultForwarders)?this.settings.defaultForwarders:[]).forEach((e=>A(VC,this,KC).call(this,e)))}function KC(e){const t=A(VC,this,XC).call(this,e);if(!t)return void this.log.warn("[#addEventForwarder] Invalid forwarder input.",e);const n=M($C,this);if(!n||"function"!=typeof n.on)return;const i=A(VC,this,YC).call(this,t);if(M(UC,this).has(i))return;const r=(...e)=>{t.once&&n&&"function"==typeof n.off&&n.off(t.event,r);const i=t.trackAs||t.event;this.track(i,...e)};n.on(t.event,r),M(UC,this).set(i,{event:t.event,listener:r})}function XC(e){return"string"==typeof e&&e?{event:e,...WC}:e&&"object"==typeof e&&"string"==typeof e.event&&e.event?{event:e.event,once:!!e.once,trackAs:"string"==typeof e.trackAs?e.trackAs:""}:null}function YC({event:e,once:t,trackAs:n}){return`${e}:${t}:${n}`}function QC(){const e=M($C,this);e&&"function"==typeof e.off&&M(UC,this).forEach((({event:t,listener:n})=>{e.off(t,n)})),M(UC,this).clear()}function JC(){(Array.isArray(this.settings.defaultContextPackers)?this.settings.defaultContextPackers:[]).forEach((e=>{if("function"!=typeof e)return;const t=e(M($C,this),this);t&&"object"==typeof t&&("function"==typeof t.dispose&&M(jC,this).push(t.dispose),t.disabled||this.registerContextPacker({schema:t.schema,match:t.match,getData:t.getData}))}))}function ZC(){M(jC,this).forEach((e=>{try{e()}catch(e){this.log.warn("[#teardownContextPackers] Failed disposing context packer.",e)}})),C(jC,this,[])}function eO(){const e=null==ad?void 0:ad.EkoAnalytics;return"function"==typeof e?e:(A(VC,this,tO).call(this),null)}function tO(){this.settings.trackingEnabled&&!M(qC,this)&&(this.log.warn("EkoAnalytics not found on window."),C(qC,this,!0))}class nO{#E;#ie;#re;#oe;#se;#ae;#le;#ce;#ue;#de;#he;#fe;#pe;#me;#ve;#ge;#ye;#be;#ke;constructor(e,t={},n=null){this.#E=new cd(e,t),this.#ie=new gd(this.#E,t),this.#re=new Ik(t),this.#oe=new My(t),this.#se=new sk(this.#oe,t),this.#ae=new tk(this.#se,this.#re,t),this.#le=new pk(this.#ae,t),this.#ce=new SM(this.#ae,t),this.#ue=new MC(this.#ce,t),this.#be=new yC(this.#ce,this.#ae,t),this.#de=new dx(this.#ae,this.#le,this.#re,this.#ce,t),this.#he=new Yx(this.#ae,this.#le,this.#ce,t),this.#fe=new XI(t),this.#pe=new kE(this.#ae,this.#ce,this.#fe,t),this.#ve=new HF(this.#ce,t),this.#ke=new GC(n,t);const i=t&&"object"==typeof t?t.adapters:null,r=i&&"object"==typeof i&&"function"==typeof i.renderAdapterFactory?i.renderAdapterFactory:null,o=i&&"object"==typeof i&&"function"==typeof i.audioAdapterFactory?i.audioAdapterFactory:null;this.#ge=r?r({timeline:this.#ce,canvas:this.#E,containerSize:this.#ie,options:t}):new Zv(this.#ce,this.#E,this.#ie,t),this.#me=o?o({timeline:this.#ce,decodeCoordinator:this.#pe,options:t}):new nA(this.#ce,this.#pe,t),this.#ye=new wS(this.#ce,this.#ge,t)}get canvas(){return this.#E}get containerSize(){return this.#ie}get assetsDeliveryService(){return this.#re}get downloadSpeed(){return this.#oe}get abrSelector(){return this.#se}get nodeRepository(){return this.#ae}get nodePrioritizer(){return this.#le}get timeline(){return this.#ce}get documentVisibility(){return this.#ue}get nodeResolver(){return this.#de}get segmentLoadCoordinator(){return this.#he}get decoderFactory(){return this.#fe}get parsingManager(){return this.#pe}get audioAdapter(){return this.#me}get audioPlaybackManager(){return this.#me}get qoe(){return this.#ve}get renderAdapter(){return this.#ge}get renderer(){return this.#ge}get transitionManager(){return this.#ye}get tracker(){return this.#ke}dispose(){[this.#ke,this.#ce,this.#ue,this.#he,this.#de,this.#le,this.#ae,this.#re,this.#se,this.#oe,this.#pe,this.#fe,this.#me,this.#ve,this.#ge,this.#ye,this.#be,this.#ie,this.#E].forEach((e=>{e&&"function"==typeof e.dispose&&e.dispose()})),this.#ce=null,this.#ue=null,this.#he=null,this.#de=null,this.#le=null,this.#ae=null,this.#re=null,this.#se=null,this.#oe=null,this.#pe=null,this.#fe=null,this.#me=null,this.#ve=null,this.#ge=null,this.#ye=null,this.#be=null,this.#E=null,this.#ke=null}}const iO="bby/debug-logs.1155695";var rO={isPlainObject:Zu,deepMerge:ed,get:ny,set:iy,ekoGlobalStore:ry,download:by,isPositiveNumber:Pg,clamp01:im,root:ad,now:sy,getFrameDimensions:IN,useragent:iv,requestAnimationFrame:Ok,cancelAnimationFrame:Pk,start:jk,stop:qk,isTicking:Vk,predicator:function(e,t){const n=t||{};if("function"!=typeof e)return void Rk.error("[predicator] Bad argument given to predicator, first argument must be a function.",arguments);if(e.apply())return Rk.debug("[predicator] Invoking onFulfilled immediately."),void("function"==typeof n.onFulfilled&&n.onFulfilled.call(null,0));const i=n.timeout||1e4,r=n.interval,o=sy();let s,a,l,c,u;c=function(){e.apply()&&l()},l=function(){qk(c),ad.clearTimeout(s),u=sy()-o,Rk.debug("[predicator] Invoking onFulfilled after "+u+" ms."),"function"==typeof n.onFulfilled&&n.onFulfilled.call(null,u)},a=function(){qk(c),u=sy()-o,Rk.debug("[predicator] Invoking onTimeout after "+u+" ms."),"function"==typeof n.onTimeout&&n.onTimeout.call(null,u)},s=ad.setTimeout(a,i),jk(c,r)},createThrottler:Gk,scheduleExecution:Hk},oO=new WeakMap,sO=new WeakMap,aO=new WeakMap,lO=new WeakMap,cO=new WeakMap,uO=new WeakMap,dO=new WeakMap,hO=new WeakSet;class fO{constructor(e){O(this,hO),F(this,oO,[]),F(this,sO,[]),F(this,aO,new qN("placement-")),F(this,lO,new qN("renderplacement-")),F(this,cO,void 0),F(this,uO,new Map),F(this,dO,void 0),C(cO,this,e),C(dO,this,{allowUnready:!0,getNode:e=>A(hO,this,pO).call(this,e)})}get placements(){return M(oO,this).slice()}get renderPlacements(){return M(sO,this).slice()}getNodesAtTime(e){A(hO,this,mO).call(this);const t=A(hO,this,gO).call(this,e);if(!Number.isFinite(t))return[];const n=M(oO,this).filter((e=>lm(e,t,null,M(dO,this)))),i=[];return n.forEach((e=>{const t=A(hO,this,pO).call(this,null==e?void 0:e.nodeId);t&&i.push(t)})),i}placeOnTimeline(e,t,n={}){const i=e&&"object"==typeof e?e:null,r=i?i.id:e;if(!r)throw new Error("TimelineDefinition.placeOnTimeline requires node id");i&&M(uO,this).set(r,i);const o=n.nodeOffsetOverride||n.offset,s=n.nodeDurationOverride||n.duration,a=fm(t);if("string"==typeof t&&t.includes("@")&&!a)throw new Error("TimelineDefinition.placeOnTimeline requires valid placement reference");const{wantsEndOffset:l,endOffsetSeconds:c}=a?{wantsEndOffset:!1}:hm(t,n);let u,d,h,f=!1;const p=null!==a;if(a){const e=M(oO,this).find((e=>(null==e?void 0:e.placementId)===a.placementId));if(!e)throw new Error("TimelineDefinition.placeOnTimeline requires valid placement reference");d=e.placementId,h=a.anchor;const t=am(e);if("start"===a.anchor)Number.isFinite(t)?u=t:f=!0;else{const n=A(hO,this,vO).call(this,e);Number.isFinite(t)&&n>0?u=t+n:f=!0}}else if(l){const e=n.offsetAnchorPlacementId?M(oO,this).find((e=>(null==e?void 0:e.placementId)===n.offsetAnchorPlacementId)):M(oO,this).length?M(oO,this)[M(oO,this).length-1]:void 0;if(d=n.offsetAnchorPlacementId||(null==e?void 0:e.placementId),d){const t=am(e),n=A(hO,this,vO).call(this,e);Number.isFinite(t)&&n>0?u=t+n-c:(f=!0,h="end")}else u=-c}else u=dm(t);const m=M(aO,this).claim(n.placementId),v={placementId:m,nodeId:r,offset:u,offsetPending:f,offsetAnchorPlacementId:f?d:void 0,offsetAnchorEdge:f?h:void 0,offsetAnchorIsReference:f?p:void 0,offsetEndSeconds:l?c:a&&"end"===a.anchor?0:void 0,nodeOffsetOverride:o,nodeDurationOverride:s,loop:!0===n.loop};return M(oO,this).push(v),cm(M(oO,this)),m}placeRenderNodeOnTimeline(e,t,n,i={}){const r="string"==typeof e?e:null==e?void 0:e.type;if(!r||"string"!=typeof r)throw new Error("TimelineDefinition.placeRenderNodeOnTimeline requires render node type");let o,s,a,l=!1;const c=fm(t);if("string"==typeof t&&t.includes("@")&&!c)throw new Error("TimelineDefinition.placeRenderNodeOnTimeline requires valid placement reference");const u=null!==c;if(c){const e=M(oO,this).find((e=>(null==e?void 0:e.placementId)===c.placementId));if(!e)throw new Error("TimelineDefinition.placeRenderNodeOnTimeline requires valid placement reference");s=e.placementId,a=c.anchor;const t=am(e);if("start"===c.anchor)Number.isFinite(t)?o=t:l=!0;else{const n=A(hO,this,vO).call(this,e);Number.isFinite(t)&&Number.isFinite(n)?o=t+n:l=!0}}else o=dm(t);const d=M(lO,this).claim(i.renderPlacementId),h=Number(n),f=h===Number.POSITIVE_INFINITY,p=Number.isFinite(h)&&h>0||f?h:void 0;if(!p)throw new Error("TimelineDefinition.placeRenderNodeOnTimeline requires a positive duration (seconds) or Infinity as 3rd argument");const m={renderPlacementId:d,type:r,offset:o,offsetPending:l,offsetAnchorPlacementId:l?s:void 0,offsetAnchorEdge:l?a:void 0,offsetAnchorIsReference:l?u:void 0,duration:p,params:i.params&&"object"==typeof i.params?i.params:void 0};if(!l){const e=o,t=o+p;pm(M(sO,this),e,t,"TimelineDefinition.placeRenderNodeOnTimeline does not allow overlapping render nodes")}return M(sO,this).push(m),cm(M(sO,this)),d}}function pO(e){if(e)return M(cO,this)&&"function"==typeof M(cO,this).get?M(cO,this).get(e):M(uO,this).get(e)}function mO(){return um(M(oO,this),{getPlacementDuration:e=>A(hO,this,vO).call(this,e)}).updated}function vO(e){return om(e,null,M(dO,this))}function gO(e){if("end"===e){const e=A(hO,this,yO).call(this);if(!Number.isFinite(e))return;return Math.max(0,e-Math.min(e,.001))}const t=Number(e);return Number.isFinite(t)?t:0}function yO(){let e;return M(oO,this).forEach((t=>{const n=am(t);if(!Number.isFinite(n))return;const i=A(hO,this,vO).call(this,t);if(!Number.isFinite(i))return;const r=n+i;Number.isFinite(r)&&(!Number.isFinite(e)||r>e)&&(e=r)})),e}const bO=new Set(["canplay","play","playing","waiting","pause","seeking","seeked"]);var kO=new WeakMap,xO=new WeakMap,wO=new WeakMap,_O=new WeakMap,TO=new WeakMap,IO=new WeakMap,EO=new WeakMap,SO=new WeakMap,AO=new WeakMap,NO=new WeakMap,MO=new WeakMap,FO=new WeakMap,CO=new WeakMap,OO=new WeakMap,PO=new WeakMap,RO=new WeakMap,DO=new WeakMap,LO=new WeakMap,BO=new WeakMap,zO=new WeakMap,WO=new WeakMap,$O=new WeakMap,UO=new WeakMap,jO=new WeakMap,qO=new WeakMap,VO=new WeakSet;class GO extends rd{get name(){return"EkoPlayer"}get exposedPlayerAPI(){return M(_O,this)}constructor(e,t={}){const{options:n,publicOptions:i}=function(e={}){const t=ed({},xy,e);Object.entries(ky).forEach((([e,{targetPaths:n}])=>{void 0!==t[e]&&n.forEach((n=>{void 0===ny(t,n)&&iy(t,n,t[e])}))}));const n=function(e){const t={};return Object.keys(ky).forEach((n=>{Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})),Object.freeze(t)}(t);return wy.info("Processed options:",t),wy.info("Public options:",n),{options:t,publicOptions:n}}(t);return super(n),O(this,VO),F(this,kO,void 0),F(this,xO,void 0),F(this,wO,void 0),F(this,_O,void 0),F(this,TO,void 0),F(this,IO,void 0),F(this,EO,void 0),F(this,SO,void 0),F(this,AO,void 0),F(this,NO,void 0),F(this,MO,void 0),F(this,FO,void 0),F(this,CO,void 0),F(this,OO,void 0),F(this,PO,void 0),F(this,RO,void 0),F(this,DO,void 0),F(this,LO,void 0),F(this,BO,void 0),F(this,zO,void 0),F(this,WO,void 0),F(this,$O,void 0),F(this,UO,void 0),F(this,jO,void 0),F(this,qO,0),C(wO,this,i),this.log.info("Initializing EkoPlayer with options:",i),C(FO,this,new nO(e,n,this)),A(VO,this,nP).call(this,M(FO,this)),C(PO,this,(e=>A(VO,this,HO).call(this,e))),M(xO,this)&&"function"==typeof M(xO,this).on&&M(xO,this).on(rv.TIMELINE_CUEPOINT,M(PO,this)),C(RO,this,null),C(LO,this,(e=>A(VO,this,KO).call(this,e))),C(BO,this,(e=>{const t=e&&"object"==typeof e?e:{};A(VO,this,KO).call(this,{...t,event:"seeking"})})),C(zO,this,(e=>{const t=e&&"object"==typeof e?e:{};A(VO,this,KO).call(this,{...t,event:"seeked"})})),M(xO,this)&&"function"==typeof M(xO,this).on&&(M(xO,this).on(rv.TIMELINE_PLAYER_STATE,M(LO,this)),M(xO,this).on(rv.TIMELINE_SEEKING,M(BO,this)),M(xO,this).on(rv.TIMELINE_SEEKED,M(zO,this))),C(UO,this,(e=>{const t=e&&"object"==typeof e?e:{};this.trigger(rv.CONTAINER_RESIZE,t)})),M(CO,this)&&"function"==typeof M(CO,this).on&&M(CO,this).on(rv.CONTAINER_RESIZE,M(UO,this)),A(VO,this,JO).call(this),A(VO,this,QO).call(this),C(_O,this,A(VO,this,tP).call(this)),M(_O,this)}onDispose(){M(xO,this)&&"function"==typeof M(xO,this).off&&M(PO,this)&&M(xO,this).off(rv.TIMELINE_CUEPOINT,M(PO,this)),C(PO,this,null),M(xO,this)&&"function"==typeof M(xO,this).off&&(M(LO,this)&&M(xO,this).off(rv.TIMELINE_PLAYER_STATE,M(LO,this)),M(BO,this)&&M(xO,this).off(rv.TIMELINE_SEEKING,M(BO,this)),M(zO,this)&&M(xO,this).off(rv.TIMELINE_SEEKED,M(zO,this))),C(LO,this,null),C(BO,this,null),C(zO,this,null),C(RO,this,null),M(CO,this)&&"function"==typeof M(CO,this).off&&M(UO,this)&&M(CO,this).off(rv.CONTAINER_RESIZE,M(UO,this)),C(UO,this,null),M(MO,this)&&"function"==typeof M(MO,this).off&&(M(WO,this)&&M(MO,this).off("qoescore",M(WO,this)),M($O,this)&&M(MO,this).off("qoestatus",M($O,this))),C(WO,this,null),C($O,this,null),M(NO,this)&&"function"==typeof M(NO,this).off&&M(jO,this)&&M(NO,this).off(rv.DECODER_ERROR,M(jO,this)),C(jO,this,null),C(qO,this,0),M(OO,this)&&"function"==typeof M(OO,this).dispose&&M(OO,this).dispose(),C(OO,this,null),M(FO,this)&&"function"==typeof M(FO,this).dispose&&M(FO,this).dispose(),C(xO,this,null),C(kO,this,null),C(IO,this,null),C(EO,this,null),C(SO,this,null),C(AO,this,null),C(NO,this,null),C(MO,this,null),C(CO,this,null),C(TO,this,null),C(_O,this,null),C(FO,this,null)}}function HO(e={}){var t;this.trigger(rv.TIMELINE_CUEPOINT,e);const n="string"==typeof(null==e||null===(t=e.cuepoint)||void 0===t?void 0:t.name)?e.cuepoint.name:"";n&&this.trigger(n,e)}function KO(e={}){const t="string"==typeof(null==e?void 0:e.event)?e.event:"";if(!bO.has(t))return;if("playing"!==t||Number.isFinite(M(DO,this))||(C(DO,this,sy()),this.log.info(`[#handlePlayerStateEvent] Playback started @ ${(M(DO,this)/1e3).toFixed(3)}s (${Date.now()})`)),M(RO,this)===t)return;C(RO,this,t);const n=Number.isFinite(null==e?void 0:e.time)?e.time:M(xO,this)&&Number.isFinite(M(xO,this).currentTime)?M(xO,this).currentTime:0,i={};Number.isFinite(n)&&(i.time=n),"string"==typeof(null==e?void 0:e.from)&&(i.from=e.from),"string"==typeof(null==e?void 0:e.to)&&(i.to=e.to),Number.isFinite(null==e?void 0:e.targetTime)&&(i.targetTime=e.targetTime),Array.isArray(null==e?void 0:e.placements)&&(i.placements=e.placements.slice()),this.trigger(t,i)}function XO(){return new fO(M(kO,this))}function YO(e){if(!e||"object"!=typeof e)throw new Error("EkoPlayer.switchTimeline requires a timeline definition");if(!M(xO,this)||"function"!=typeof M(xO,this).applyTimelineDefinition)throw new Error("EkoPlayer.switchTimeline requires an active timeline");M(xO,this).applyTimelineDefinition(e),"function"==typeof M(xO,this).play&&M(xO,this).play()}function QO(){M(MO,this)&&"function"==typeof M(MO,this).on&&(C(WO,this,(e=>{this.trigger(rv.QOE_SCORE,e)})),C($O,this,(e=>{this.trigger(rv.QOE_STATUS,e)})),M(MO,this).on(rv.QOE_SCORE,M(WO,this)),M(MO,this).on(rv.QOE_STATUS,M($O,this)))}function JO(){M(NO,this)&&"function"==typeof M(NO,this).on&&(C(jO,this,(e=>{const t=e&&"object"==typeof e?e:{error:e};this.trigger(rv.DECODER_ERROR,t),A(VO,this,ZO).call(this,t)})),M(NO,this).on(rv.DECODER_ERROR,M(jO,this)))}function ZO(e={}){var t;const n=M(xO,this);if(!n||"number"!=typeof n.currentTime)return;const i=Date.now();if(i<M(qO,this))return;const r=Number(n.currentTime);if(!Number.isFinite(r))return;const o=Number(null==n||null===(t=n.settings)||void 0===t?void 0:t.snapToFps),s=Number.isFinite(o)&&o>0?1/o:1/60;C(qO,this,i+1500),this.log.warn("[#attemptDecoderRecoverySeek] decoder:error received, attempting seek recovery",null==e?void 0:e.error),n.currentTime=r+s}async function eP(e={}){if(M(OO,this))return M(OO,this);const t=e&&"object"==typeof e&&!Array.isArray(e)?{...e}:{},n=M(TO,this)&&M(TO,this).element?M(TO,this).element:null;if(!n)throw new Error("Debug overlay requires an initialized player canvas and mount element.");const i=function({canvasElement:e,containerElement:t}={}){const n=e&&e.parentNode?e.parentNode:null;if(null==t)return n;const i=function(e,t=(null==ad?void 0:ad.document)){if(ld(e))return e;if("string"!=typeof e)return null;let n=e.trim();if("#"===n.charAt(0)&&(n=n.slice(1)),!n||!t||"function"!=typeof t.getElementById)return null;const i=t.getElementById(n);return ld(i)?i:null}(t,e&&e.ownerDocument?e.ownerDocument:null);if(i)return i;if("string"==typeof t){const e=t.trim(),n="#"===e.charAt(0)?e.slice(1):e;if(!n)throw new Error("Debug overlay containerElement id cannot be empty.");throw new Error(`Debug overlay containerElement id "${n}" was not found.`)}throw new Error("Debug overlay containerElement must be an element id string or DOM element.")}({canvasElement:n,containerElement:t.containerElement});if(!i)throw new Error("Debug overlay requires an initialized player canvas and mount element.");Object.prototype.hasOwnProperty.call(t,"containerElement")&&delete t.containerElement;const r=await Promise.resolve().then((function(){return IR})),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 t.publicOptions=M(wO,this),t.playerVersion=iO,C(OO,this,o({mountElement:i,canvasElement:n,timeline:M(xO,this),getNode:e=>M(kO,this)&&"function"==typeof M(kO,this).get?M(kO,this).get(e):void 0,listNodes:()=>M(kO,this)&&"function"==typeof M(kO,this).list?M(kO,this).list():[],downloadSpeed:M(FO,this)?M(FO,this).downloadSpeed:void 0,downloadEvents:Jg,qoe:M(MO,this)?M(MO,this).publicAPI:void 0,qoeEvents:this,options:t,playbackStartedAtMs:M(DO,this)})),M(OO,this)}function tP(){const e=this;return{createTimeline:()=>A(VO,e,XO).call(e),switchTimeline:t=>A(VO,e,YO).call(e,t),play:M(xO,this).play,pause:M(xO,this).pause,reset:M(xO,this).reset,placeOnTimeline:M(xO,this).placeOnTimeline,placeRenderNodeOnTimeline:M(xO,this).placeRenderNodeOnTimeline,addNode:M(kO,this).add,getNode:M(kO,this).get,listNodes:M(kO,this).list,getNodesAtTime:t=>M(xO,e).getNodesAtTime(t),dispose:this.dispose,on:e.on,off:e.off,once:e.once,trigger:e.trigger,transitionTo:(t,n)=>M(EO,e).transitionTo(t,n),track:(t,...n)=>{if(M(AO,e)&&"function"==typeof M(AO,e).track)return M(AO,e).track(t,...n)},seekToPlacement:t=>M(xO,e).seekToPlacement(t),get currentTime(){return M(xO,e).currentTime},set currentTime(t){M(xO,e).currentTime=t},get buffered(){return M(xO,e).buffered},get options(){return M(wO,e)},get containerWidth(){return M(CO,e)?M(CO,e).containerWidth:0},get containerHeight(){return M(CO,e)?M(CO,e).containerHeight:0},get playbackRate(){return M(xO,e).playbackRate},set playbackRate(t){M(xO,e).playbackRate=t},get paused(){return!!M(xO,e)&&!0===M(xO,e).paused},get muted(){return!!M(SO,e)&&M(SO,e).muted},set muted(t){M(SO,e)&&(M(SO,e).muted=t)},get volume(){return M(SO,e)?M(SO,e).volume:1},set volume(t){M(SO,e)&&(M(SO,e).volume=t)},get qoe(){return M(MO,e)?M(MO,e).publicAPI:void 0},get utils(){return rO},get version(){return iO},loadDebugOverlay:(...t)=>A(VO,e,eP).call(e,...t)}}function nP(e){e&&(C(TO,this,e.canvas),C(kO,this,e.nodeRepository),C(xO,this,e.timeline),C(SO,this,e.audioAdapter||e.audioPlaybackManager),C(AO,this,e.tracker),C(NO,this,e.parsingManager),C(MO,this,e.qoe),C(IO,this,e.renderAdapter||e.renderer),C(EO,this,e.transitionManager),C(CO,this,e.containerSize))}class iP{constructor({target:e,props:t}){if(!e)throw new Error("`options.target` is required");_o(this.#xe,t,!0),this.#xe.v.EkoPlayer=GO;const n=e.hasChildNodes()?da:ua;this.#we=n(Ou,{target:e,props:this.#xe.v})}#we;#xe=Oi(xo(No({})),"EkoGallery.#props");destroy(e){if(this.#we)return ma(this.#we,e)}get props(){return Us(this.#xe)}}const rP=u("gallery-react");const oP=e.forwardRef(((t,n)=>{const{config:i,debug:r,ssrHtml:o,activeItem:s={index:0,step:0},forceMobile:a,videoAspectRatio:l,onEvent:c=()=>{}}=t,u=e.useRef(null),d=e.useRef({}),h=function(e){return void 0!==e}(i),f=e.useRef(s),p=e.useRef(o);d.current.initEventSent||(c("galleryinit"),d.current.initEventSent=!0);const m=e.useCallback((e=>{d.current.state=e,e.activeItemIndex===f.current.index&&e.activeModuleIndex===f.current.step||c("activeitemchanged",{index:e.activeItemIndex,step:e.activeModuleIndex})}),[]),v=e.useCallback((e=>{d.current.API=e,0===s.index&&0===s.step||e.selectItemAndStep(s.index,s.step),d.current.unsubscribe&&d.current.unsubscribe(),d.current.unsubscribe=e.subscribe(m)}),[]),g=e.useCallback(((e,t)=>{c(e,t)}),[c]);return e.useEffect((()=>(rP.setDataStorage("gallery-react",{config:i}),window.eko=window.eko||{},window.eko.config=i,window.eko.gallery={version:"bby-debug-logs/4.0.4"},()=>{window.eko.config=void 0})),[i]),e.useImperativeHandle(n,(()=>({prev:()=>{var e;null===(e=d.current.API)||void 0===e||e.prev()},next:()=>{var e;null===(e=d.current.API)||void 0===e||e.next()}}))),e.useEffect((()=>{if(null==u||!u.current)return;const e=u.current;return d.current.app=new iP({target:e,props:{config:i,forceMobile:a,videoAspectRatio:l,hideNav:!0,onGalleryReady:v,onEvent:g}}),()=>{var e;null===(e=d.current.app)||void 0===e||e.destroy()}}),[]),e.useEffect((()=>{d.current.app&&(d.current.app.props.config=i)}),[i]),e.useEffect((()=>{d.current.app&&(d.current.app.props.debug=r,d.current.app.props.forceMobile=a,d.current.app.props.videoAspectRatio=l,d.current.app.props.onEvent=g)}),[r,a,l,g]),e.useEffect((()=>{f.current=s,d.current.state&&(d.current.state.activeItemIndex===s.index&&d.current.state.activeModuleIndex===s.step||d.current.API.selectItemAndStep(s.index,s.step))}),[s]),h?e.createElement("div",R({style:{position:"relative",width:"100%",height:"100%"},ref:u},p.current?{dangerouslySetInnerHTML:{__html:p.current}}:{})):t.children}));oP.propTypes={className:Te.string,config:Te.object,variantId:Te.string,onEvent:Te.func,ssrHtml:Te.string,videoAspectRatio:Te.string,debug:Te.bool,activeItem:Te.shape({index:Te.number,step:Te.number}),forceMobile:Te.bool,instanceId:Te.string,children:Te.node},oP.displayName="EkoGallerySvelte";const sP=n("v2"),aP=n("v1"),lP="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{},cP=lP&&lP.performance,uP=cP&&"function"==typeof cP.now?()=>cP.now():()=>Date.now(),dP=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"}),hP=["ui-monospace,","SFMono-Regular,","Menlo,","Monaco,","Consolas,",'"Liberation Mono",','"Courier New",',"monospace"].join(" "),fP=`11px ${hP}`,pP=`12px ${hP}`;function mP(e){return"number"==typeof e&&Number.isFinite(e)}function vP(e){return mP(e)&&e>0}function gP(e){return mP(e)?Math.min(1,Math.max(0,e)):0}function yP(e,t=3){return mP(e)?e.toFixed(t):String(e)}function bP(e,t){const n=Number(e),i=Number(t);return!Number.isFinite(n)||!Number.isFinite(i)||n<=0||i<=0?"n/a":`${Math.round(n)}x${Math.round(i)}`}var kP=new WeakMap,xP=new WeakMap,wP=new WeakMap,_P=new WeakMap,TP=new WeakMap,IP=new WeakMap,EP=new WeakMap,SP=new WeakSet;class AP{constructor({width:e=220,height:t=48,windowMs:n=6e4,maxValue:i=60,autoScale:r=!1,formatValue:o}={}){O(this,SP),F(this,kP,void 0),F(this,xP,void 0),F(this,wP,[]),F(this,_P,void 0),F(this,TP,void 0),F(this,IP,void 0),F(this,EP,void 0);const s=null==lP?void 0:lP.document;if(!s||"function"!=typeof s.createElement)throw new Error("Debug overlay graph requires document.createElement.");C(kP,this,s.createElement("canvas")),M(kP,this).width=e,M(kP,this).height=t,M(kP,this).style.width=`${e}px`,M(kP,this).style.height=`${t}px`,M(kP,this).style.borderRadius="6px",M(kP,this).style.background="#111",C(xP,this,M(kP,this).getContext("2d")),C(_P,this,n),C(TP,this,i),C(IP,this,!!r),C(EP,this,"function"==typeof o?o:null)}get element(){return M(kP,this)}push(e,t){if(M(kP,this)&&M(xP,this)&&Number.isFinite(e)&&Number.isFinite(t)){for(M(wP,this).push({t:t,v:e});M(wP,this).length&&t-M(wP,this)[0].t>M(_P,this);)M(wP,this).shift();A(SP,this,NP).call(this)}}dispose(){C(wP,this,[]),C(xP,this,null),C(kP,this,null)}}function NP(){const e=M(xP,this),t=M(kP,this);if(!e||!t)return;const n=t.width,i=t.height;if(!n||!i)return;if(e.clearRect(0,0,n,i),e.fillStyle="#111",e.fillRect(0,0,n,i),!M(wP,this).length)return;const r=M(wP,this)[0].t;if(!(M(wP,this)[M(wP,this).length-1].t>r))return;const o=M(IP,this)?M(wP,this).reduce(((e,t)=>t.v>e?t.v:e),0):M(TP,this),s=o>0?o:M(TP,this);e.strokeStyle="#0f0",e.lineWidth=2,e.beginPath();for(let t=0;t<M(wP,this).length;t+=1){const o=M(wP,this)[t],a=(o.t-r)/M(_P,this)*n,l=i-(s>0?Math.min(1,Math.max(0,o.v/s)):0)*i;0===t?e.moveTo(a,l):e.lineTo(a,l)}e.stroke();const a=M(wP,this).length?M(wP,this)[M(wP,this).length-1]:null,l=Number.isFinite(null==a?void 0:a.v)?a.v:null;if(null===l)return;const c=M(EP,this)?M(EP,this).call(this,l):l.toFixed(1);if("string"!=typeof c||!c)return;e.font=fP,e.textAlign="right",e.textBaseline="top";const u=e.measureText(c),d=Math.ceil(u.width)+8,h=n-d-2;e.fillStyle="rgba(0,0,0,0.55)",e.fillRect(h,2,d,14),e.fillStyle="#fff",e.fillText(c,n-2-4,4)}const MP=new Intl.NumberFormat("en-US");function FP(e,t){const n=(null==e?void 0:e.trackId)||"",i=(null==t?void 0:t.trackId)||"";if(n!==i)return n<i?-1:1;const r=(null==e?void 0:e.nodeId)||"",o=(null==t?void 0:t.nodeId)||"";if(r!==o)return r<o?-1:1;const s=(null==e?void 0:e.segmentId)||"",a=(null==t?void 0:t.segmentId)||"";return s!==a?s<a?-1:1:("number"==typeof(null==e?void 0:e.presentationTime)?e.presentationTime:0)-("number"==typeof(null==t?void 0:t.presentationTime)?t.presentationTime:0)}function CP(e,t){for(e.push(t);e.length&&t-e[0]>1e3;)e.shift();if(e.length<2)return 0;const n=e[e.length-1]-e[0];return n<=0?0:1e3*(e.length-1)/n}function OP(e,t){if("function"!=typeof e||!t)return;const n=e(t.nodeId),i=null==n?void 0:n.tracks;if(!Array.isArray(i))return;const r=i.find((e=>(null==e?void 0:e.id)===t.trackId)),o=null==r?void 0:r.segments;return Array.isArray(o)?o.find((e=>(null==e?void 0:e.id)===t.segmentId)):void 0}function PP(e,t){var n;const i=OP(e,t);return(null==i?void 0:i.abrDecision)||(null==i||null===(n=i.chosenRepresentation)||void 0===n?void 0:n.abrDecision)}function RP(e){const t=Number(e);return!Number.isFinite(t)||t<=0?"n/a":`${MP.format(Math.round(t))}kbps`}function DP(e){const t=Number(e);return!Number.isFinite(t)||t<=0?"n/a":`${MP.format(Math.round(t/1e3))}kbps`}function LP(e,t=3){const n=Number(e);return Number.isFinite(n)?n.toLocaleString("en-US",{minimumFractionDigits:t,maximumFractionDigits:t}):String(e)}function BP(e,t){var n;if("function"!=typeof e||!t)return;const i=e(t.nodeId),r=null==i||null===(n=i.manifestRef)||void 0===n?void 0:n.encodeProfile;return"string"==typeof r&&r?r:void 0}function zP(e,t){if("function"!=typeof e||!t)return;const n=e(t.nodeId);return!0===(null==n?void 0:n.imageFallbackActive)?"image":void 0}function WP(e,t){const n=function(e){if(!e)return;const t=[[e.displayWidth,e.displayHeight],[e.codedWidth,e.codedHeight],[e.videoWidth,e.videoHeight],[e.naturalWidth,e.naturalHeight],[e.width,e.height]];for(let e=0;e<t.length;e+=1){const[n,i]=t[e],r=Number(n),o=Number(i);if(Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0)return{width:r,height:o}}}(null==t?void 0:t.frame)||{},i=Number.isFinite(null==t?void 0:t.width)?t.width:n.width,r=Number.isFinite(null==t?void 0:t.height)?t.height:n.height,o=function(e,t,n){return null===(n=OP(e,t))||void 0===n?void 0:n.chosenRepresentation}(e,t);if(!o)return mP(i)&&mP(r)?{width:i,height:r}:null;const s=o.width||o.codedWidth||i,a=o.height||o.codedHeight||r;return{id:o.id,codecs:o.codecs,mime:o.mime,bandwidth:o.bandwidth,width:s,height:a}}function $P(e){const t=Number(e);if(Number.isFinite(t)&&!(t<=0))return t/1e3}function UP(e,t){const n=Number(null==e?void 0:e.bandwidthKbps),i=Number(null==t?void 0:t.bandwidthKbps),r=Number.isFinite(n)&&n>0,o=Number.isFinite(i)&&i>0;if(r&&o&&n!==i)return n-i;if(r!==o)return r?-1:1;const s=(null==e?void 0:e.id)||"",a=(null==t?void 0:t.id)||"";return s===a?0:s<a?-1:1}function jP(e,t,n,i){const r=[];if(Array.isArray(null==i?void 0:i.availableRepresentations)&&i.availableRepresentations.forEach((e=>{const t="string"==typeof(null==e?void 0:e.id)&&e.id?e.id:void 0;if(!t)return;const n=Number(null==e?void 0:e.bandwidthKbps);r.push({id:t,bandwidthKbps:Number.isFinite(n)&&n>0?n:void 0})})),!r.length){const n=OP(e,t);(Array.isArray(null==n?void 0:n.representations)?n.representations:[]).forEach((e=>{const t="string"==typeof(null==e?void 0:e.id)&&e.id?e.id:void 0;t&&r.push({id:t,bandwidthKbps:$P(null==e?void 0:e.bandwidth)})}))}!r.length&&(null==n?void 0:n.id)&&r.push({id:n.id,bandwidthKbps:$P(n.bandwidth)});const o=new Map;return r.forEach((e=>{const t=null==e?void 0:e.id;t&&!o.has(t)&&o.set(t,e)})),Array.from(o.values()).sort(UP)}const qP=1024,VP=1048576,GP=1073741824;function HP(e){return mP(e)?e>=1e3?`${yP(e/1e3,1)} Mbps`:`${yP(e,1)} kbps`:"n/a"}function KP({downloadSpeed:e,downloadEvents:t}={}){const n=lP.document,i="function"==typeof(null==e?void 0:e.getKbps)?e.getKbps():void 0;let r=0;const{metricsRow:o,setInitial:s,setTotal:a}=function(e){const t=e.createElement("div");t.style.display="grid",t.style.gridTemplateColumns="1fr 1fr",t.style.gap="8px",t.style.font=pP;const n=e.createElement("div"),i=e.createElement("div");return t.appendChild(n),t.appendChild(i),{metricsRow:t,setInitial:e=>{n.textContent=`initial=${HP(e)}`},setTotal:e=>{var t;i.textContent="total="+(mP(t=e)?t<qP?`${Math.round(t)} B`:t<VP?`${yP(t/qP,1)} KB`:t<GP?`${yP(t/VP,2)} MB`:`${yP(t/GP,2)} GB`:"n/a")}}}(n),{graphWrap:l,speedGraph:c}=function(e,t){const n=e.createElement("div");n.style.marginTop="10px";const i=e.createElement("div");i.textContent="download speed",i.style.font=fP,i.style.opacity="0.9";const r=mP(t)&&t>0?t:1,o=new AP({autoScale:!0,maxValue:r,formatValue:HP});return n.appendChild(i),n.appendChild(o.element),{graphWrap:n,speedGraph:o}}(n,i);s(i),a(r);const u=e=>{const t=Number(null==e?void 0:e.kbps);Number.isFinite(t)&&c.push(t,null!=lP&&lP.performance&&"function"==typeof lP.performance.now?lP.performance.now():Date.now())},d=e=>{const t=Number(null==e?void 0:e.bytes);Number.isFinite(t)&&(r+=t,a(r))};return e&&"function"==typeof e.on&&e.on("download:speed",u),t&&"function"==typeof t.on&&t.on("download:sample",d),{id:"downloads",title:"Downloads",render:e=>{e.appendChild(o),e.appendChild(l)},dispose:()=>{e&&"function"==typeof e.off&&e.off("download:speed",u),t&&"function"==typeof t.off&&t.off("download:sample",d),c.dispose()}}}function XP(e){return mP(e)?yP(e,3):"n/a"}function YP(){return null!=lP&&lP.performance&&"function"==typeof lP.performance.now?lP.performance.now():Date.now()}const QP=18,JP="rgba(83,170,255,0.9)",ZP={pending:"rgba(255,255,255,0.55)",resolving:"rgba(255,200,87,0.9)",ready:"rgba(102,214,141,0.9)",failed:"rgba(255,92,92,0.9)",missing:"rgba(160,160,160,0.9)"};function eR(e,t){if(vP(null==e?void 0:e.nodeDurationOverride))return e.nodeDurationOverride;if("function"!=typeof t)return null;const n=t(null==e?void 0:e.nodeId),i=null==n?void 0:n.duration;return vP(i)?i:null}function tR(e){const t=Number(null==e?void 0:e.duration);return t===Number.POSITIVE_INFINITY?Number.POSITIVE_INFINITY:vP(t)?t:null}function nR(e){return e===Number.POSITIVE_INFINITY}function iR(e){return mP(e)?String(e):""}function rR(e=[],t=[],n){const i=function(e=[],t){return Array.isArray(e)&&e.length?e.map((e=>e?["string"==typeof e.placementId?e.placementId:"","string"==typeof e.nodeId?e.nodeId:"",iR(e.offset),iR(eR(e,t)),!0===e.offsetPending?"1":"0",iR(e.nodeOffsetOverride),iR(e.nodeDurationOverride)].join("|"):"null")).join(";"):""}(e,n);return`${i}::${function(e=[]){return Array.isArray(e)&&e.length?e.map((e=>{if(!e)return"null";const t="string"==typeof e.renderPlacementId?e.renderPlacementId:"",n="string"==typeof e.type?e.type:"",i=iR(e.offset),r=tR(e);return[t,n,i,r===Number.POSITIVE_INFINITY?"inf":iR(r),!0===e.offsetPending?"1":"0"].join("|")})).join(";"):""}(t)}`}function oR(e=[],t){if(!Array.isArray(e)||!e.length)return!1;for(let n=0;n<e.length;n+=1){const i=e[n];if(!i||!0===i.offsetPending)continue;if(vP(i.nodeDurationOverride))continue;if("function"!=typeof t)return!0;const r=t(i.nodeId);if(!vP(null==r?void 0:r.duration))return!0}return!1}function sR(e=[]){return!(!Array.isArray(e)||!e.length)&&e.some((e=>!0===(null==e?void 0:e.offsetPending)))}function aR(e=[],t=[]){return sR(e)||sR(t)}function lR(e,t=[],n){if(!e||!Array.isArray(t)||!t.length)return;const i=e.querySelector('[data-segment-boundary="true"]');t.forEach((t=>{if(!t||!mP(t.startRatio)||!mP(t.endRatio))return;const r=gP(t.startRatio),o=gP(t.endRatio);if(!(o>r))return;const s=lP.document.createElement("div");s.dataset.bufferedSegment="true",s.style.position="absolute",s.style.top="0",s.style.bottom="0",s.style.left=100*r+"%",s.style.width=100*(o-r)+"%",s.style.background=n,s.style.opacity="0.8",s.style.pointerEvents="none",s.style.zIndex="0",i?e.insertBefore(s,i):e.appendChild(s)}))}function cR(e,t){if(!e)return;const n=e.querySelector('[data-active-highlight="true"]');if(!t)return void(n&&n.remove());if(n)return;const i=lP.document.createElement("div");i.dataset.activeHighlight="true",i.style.position="absolute",i.style.top="0",i.style.bottom="0",i.style.left="0",i.style.right="0",i.style.border="1px solid rgba(255,255,255,0.9)",i.style.borderRadius="4px",i.style.pointerEvents="none",i.style.zIndex="1",e.appendChild(i)}function uR({timeline:e,getNode:t}={}){const n=null==lP?void 0:lP.document;if(!n||"function"!=typeof n.createElement)throw new Error("Debug overlay timeline tab requires document.createElement.");const i=n.createElement("div");i.style.display="flex",i.style.flexDirection="column",i.style.gap="8px",i.style.position="relative";const r=n.createElement("div");r.style.position="absolute",r.style.display="none",r.style.pointerEvents="none",r.style.zIndex="2",r.style.padding="4px 6px",r.style.borderRadius="6px",r.style.background="rgba(0,0,0,0.8)",r.style.border="1px solid rgba(255,255,255,0.2)",r.style.color="#fff",r.style.font=fP,r.style.maxWidth="220px",r.style.whiteSpace="nowrap",r.style.overflow="hidden",r.style.textOverflow="ellipsis";const o=n.createElement("div");o.dataset.timelineHoverDetails="true",o.style.position="absolute",o.style.display="none",o.style.pointerEvents="none",o.style.zIndex="3",o.style.padding="6px 8px",o.style.borderRadius="8px",o.style.background="rgba(0,0,0,0.85)",o.style.border="1px solid rgba(255,255,255,0.25)",o.style.color="#fff",o.style.font=fP,o.style.maxWidth="260px",o.style.flexDirection="column",o.style.gap="6px";const s=n.createElement("div");s.style.font=pP,s.style.opacity="0.95";const a=n.createElement("div");a.style.font=fP,a.style.opacity="0.7",a.style.textTransform="uppercase",a.style.marginTop="4px";const l=n.createElement("div");l.style.display="flex",l.style.flexDirection="column",l.style.gap="4px",o.appendChild(s),o.appendChild(a),o.appendChild(l);const c=n.createElement("div");c.style.display="flex",c.style.justifyContent="space-between",c.style.alignItems="center";const u=n.createElement("div");u.style.display="flex",u.style.alignItems="baseline",u.style.gap="10px";const d=n.createElement("div");d.style.font=pP,d.style.opacity="0.9";const h=n.createElement("div");h.style.font=fP,h.style.opacity="0.65",u.appendChild(d),u.appendChild(h);const f=n.createElement("label");f.style.display="inline-flex",f.style.alignItems="center",f.style.gap="6px",f.style.font=fP,f.style.cursor="pointer";const p=n.createElement("input");p.type="checkbox",p.checked=!1;const m=n.createElement("span");m.textContent="Click to seek",f.appendChild(p),f.appendChild(m),c.appendChild(u),c.appendChild(f);const v=n.createElement("div");function g(e,t,{alignTop:i=!1}={}){const r=n.createElement("div");r.style.display="grid",r.style.gridTemplateColumns="64px 1fr",r.style.alignItems=i?"start":"center",r.style.gap="8px";const o=n.createElement("div");o.textContent=e,o.style.font=fP,o.style.opacity="0.8",i&&(o.style.paddingTop="2px");const s=n.createElement("div");s.style.position="relative",s.style.borderRadius="6px",s.style.background="rgba(255,255,255,0.08)",s.style.overflow="hidden",t&&(s.dataset.timelineLane=t);const a=n.createElement("div");return a.style.position="absolute",a.style.top="0",a.style.bottom="0",a.style.width="2px",a.style.background="rgba(255,255,255,0.8)",s.appendChild(a),r.appendChild(o),r.appendChild(s),v.appendChild(r),{track:s,indicator:a}}v.style.display="grid",v.style.gridTemplateRows="auto auto",v.style.gap="8px",i.appendChild(c),i.appendChild(v),i.appendChild(r),i.appendChild(o);const y=g("Nodes","nodes",{alignTop:!0}),b=g("Render","render");let k=[],x=[],w=0,_=!1,T=1;const I=new Map,E=new Map,S=new Map,A=new Map;let N=new Set,M=null,F=!1,C="",O=!1,P=0,R=0,D=null;function L(e){for(;e.childNodes.length>1;)e.removeChild(e.lastChild)}function B(){D&&(clearTimeout(D),D=null)}function z(){return!!O||!!e&&(Array.isArray(e.placements)||Array.isArray(e.renderPlacements))}function W(){if(!e)return!1;const t=Array.isArray(e.placements),n=Array.isArray(e.renderPlacements);if(!t&&!n)return!1;const i=t?e.placements:[],r=n?e.renderPlacements:[];return(i.length!==P||r.length!==R)&&(te(i,r),!0)}function $(){if(!O)return!1;const e=rR(k,x,t);return e!==C&&(C=e,Q(),ee(),!0)}function U(){z()?D=function({shouldSchedule:e,isScheduled:t,intervalMs:n,onTick:i}){return t?null:setTimeout(i,n)}({shouldSchedule:!0,isScheduled:!!D,intervalMs:O?100:250,onTick:()=>{D=null,z()&&(W()||$()||U())}}):B()}function j(e,t){const n=t>0?w/t:0;e.style.left=100*gP(n)+"%",e.style.transform="translateX(-1px)"}function q(){r.style.display="none"}function V(e,t){if(!e)return void q();r.textContent=e,r.style.display="block";const n=i.getBoundingClientRect(),o=r.getBoundingClientRect(),s=((null==t?void 0:t.clientX)||0)-n.left+12,a=((null==t?void 0:t.clientY)||0)-n.top+12,l=n.width-o.width-8,c=n.height-o.height-8,u=Math.max(8,Math.min(s,l)),d=Math.max(8,Math.min(a,c));r.style.left=`${u}px`,r.style.top=`${d}px`}function G(){o.style.display="none"}function H(e,r){const c="function"==typeof t&&e?t(e):null,u=Array.isArray(null==c?void 0:c.children)?c.children:[];if(!u.length)return void G();if(s.textContent=e,a.textContent="children",function(){for(;l.firstChild;)l.removeChild(l.firstChild)}(),u.forEach((e=>{e&&e.nodeId&&l.appendChild(function(e){const i=n.createElement("div");i.style.display="grid",i.style.gridTemplateColumns="10px 1fr auto auto",i.style.alignItems="center",i.style.gap="6px";const r="string"==typeof(null==e?void 0:e.nodeId)?e.nodeId:"",o=vP(null==e?void 0:e.weight)?e.weight:1,s=function(e){if(!e||"function"!=typeof t)return"missing";const n=t(e);if(!n)return"missing";const i="string"==typeof n.state?n.state.trim().toLowerCase():"";return"pending"===i||"resolving"===i||"ready"===i||"failed"===i?i:"pending"}(r);i.dataset.childId=r,i.dataset.childStatus=s;const a=n.createElement("span");a.dataset.statusIndicator=s,a.style.width="8px",a.style.height="8px",a.style.borderRadius="999px",a.style.background=ZP[s]||ZP.pending,a.style.display="inline-block";const l=n.createElement("span");l.textContent=r||"unknown",l.style.overflow="hidden",l.style.textOverflow="ellipsis",l.style.whiteSpace="nowrap";const c=n.createElement("span");c.textContent=`w=${yP(o,0)}`,c.style.opacity="0.8";const u=n.createElement("span");return u.textContent=s,u.style.opacity="0.75",i.appendChild(a),i.appendChild(l),i.appendChild(c),i.appendChild(u),i}(e))})),!l.childNodes.length)return void G();o.style.display="flex";const d=i.getBoundingClientRect(),h=o.getBoundingClientRect(),f=((null==r?void 0:r.clientX)||0)-d.left+12,p=((null==r?void 0:r.clientY)||0)-d.top+12,m=d.width-h.width-8,v=d.height-h.height-8,g=Math.max(8,Math.min(f,m)),y=Math.max(8,Math.min(p,v));o.style.left=`${g}px`,o.style.top=`${y}px`}function K(){const t=w;if(e&&"function"==typeof e.getPlacementsActiveAtTime){const n=e.getPlacementsActiveAtTime(t),i=new Set(n.map((e=>null==e?void 0:e.placementId)).filter((e=>"string"==typeof e&&e.length)));N.forEach((e=>{i.has(e)||cR(S.get(e),!1)})),i.forEach((e=>{N.has(e)||cR(S.get(e),!0)})),N=i}else y.track.querySelectorAll('[data-timeline-item="nodes"]').forEach((e=>{const n="true"===e.dataset.hasDuration,i=Number(e.dataset.start),r=Number(e.dataset.end);cR(e,n&&mP(t)&&t>=i&&t<r)}));if(e&&"function"==typeof e.getActiveRenderPlacement){const n=e.getActiveRenderPlacement(t),i=null==n?void 0:n.renderPlacementId;M&&M!==i&&cR(A.get(M),!1),i&&M!==i&&cR(A.get(i),!0),M=i||null}else b.track.querySelectorAll('[data-timeline-item="render"]').forEach((e=>{const n="true"===e.dataset.hasDuration,i=Number(e.dataset.start),r=Number(e.dataset.end);cR(e,n&&mP(t)&&t>=i&&t<r)}))}function X(e){const n=eR(e,t);if(!vP(n)||"function"!=typeof t)return{boundaries:[],buffered:[]};const i=t(null==e?void 0:e.nodeId),r=function(e){const t=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[];if(!t.length)return null;if(null!=e&&e.mainTrackId){const n=t.find((t=>(null==t?void 0:t.id)===e.mainTrackId));if(n)return n}return t.find((e=>Array.isArray(null==e?void 0:e.segments)&&e.segments.length))||null}(i);if(!r)return{boundaries:[],buffered:[]};const o=e=>{if(!e)return 0;const t=Number(null==e?void 0:e.bufferedRatio);if(Number.isFinite(t))return gP(t);const n=Number(null==e?void 0:e.retainedByteLength);if(!vP(n))return 0;const i=null==e?void 0:e.chosenRepresentation,r=vP(null==i?void 0:i.sizeBytes)?i.sizeBytes:null;return vP(r)?gP(n/r):1},s=Array.isArray(r.segments)?r.segments:[],a=mP(null==r?void 0:r.offset)?r.offset:0,l=mP(null==e?void 0:e.nodeOffsetOverride)?e.nodeOffsetOverride:0;if(!s.length){const e=null==i?void 0:i.buffered,t=mP(null==e?void 0:e.start)?e.start-l:0,r=mP(null==e?void 0:e.end)?e.end-l:0,o=Math.max(0,t),s=Math.min(n,r);return s>o?{boundaries:[],buffered:[{startRatio:o/n,endRatio:s/n}]}:{boundaries:[],buffered:[]}}if("image"===(null==r?void 0:r.type)){const e=s.find((e=>e&&!e.isInit))||s[0],t=e?o(e):0;return t>0?{boundaries:[],buffered:[{startRatio:0,endRatio:gP(t)}]}:{boundaries:[],buffered:[]}}return function(e,t,n,i,r){const o=[],s=[];let a=0;return e.forEach((e=>{if(null!=e&&e.isInit)return;mP(null==e?void 0:e.offset)&&(a=e.offset);const l=a;if(!mP(l))return;const c=mP(null==e?void 0:e.duration)?e.duration:0,u=n+l-i,d=n+(l+c)-i;u>0&&u<t&&o.push(u/t);const h="function"==typeof r?r(e):0;if(c>0&&d>0&&u<t&&h>0){const e=Math.max(0,u),n=Math.min(t,d);if(n>e){const i=e+(n-e)*gP(h);s.push({startRatio:e/t,endRatio:i/t})}}c>0&&(mP(null==e?void 0:e.offset)?a=e.offset+c:a+=c)})),{boundaries:o,buffered:s}}(s,n,a,l,o)}function Y(){const e=Array.isArray(k)?k:[],t=new Map(e.map((e=>[null==e?void 0:e.placementId,e])));for(const[e,n]of S.entries()){if(!e)continue;const i=t.get(e);i&&(n.querySelectorAll('[data-buffered-segment="true"]').forEach((e=>e.remove())),lR(n,X(i).buffered,JP))}}function Q(){const e=new Set(k.map((e=>null==e?void 0:e.nodeId)).filter((e=>"string"==typeof e&&e.length)));e.forEach((e=>{if(E.has(e))return;const n="function"==typeof t?t(e):null;if(!n||"function"!=typeof n.on)return;const i=e=>function(e={}){if(!e||e.isInit)return;const t=null==e?void 0:e.nodeId,n=null==e?void 0:e.segmentId,i=Number(null==e?void 0:e.loaded),r=Number(null==e?void 0:e.total);if(!t||!n||!mP(i))return;const o=`${t}:${n}`,s=I.get(o)||{},a={loaded:Math.max(mP(s.loaded)?s.loaded:0,i),total:vP(r)?r:s.total};I.set(o,a),function(){if(F)return;F=!0;const e=null==lP?void 0:lP.requestAnimationFrame;"function"!=typeof e?((null==lP?void 0:lP.setTimeout)||setTimeout)((()=>{F=!1,Y()}),0):e((()=>{F=!1,Y()}))}()}(e);n.on("segment:chunk",i),E.set(e,{node:n,handler:i})}));for(const[t,n]of E.entries())e.has(t)||(null!=n&&n.node&&"function"==typeof n.node.off&&n.node.off("segment:chunk",n.handler),E.delete(t))}function J({track:e,color:t,start:i,duration:r,startTime:o,durationSeconds:s,segmentRatios:a,bufferedSegments:l,placementId:c,nodeId:u,label:d,rowIndex:h=0,rowHeight:f=18,rowGap:p=0,laneId:m,isClickable:v,isActive:g,tooltip:y,hoverDetailsNodeId:b,showLabel:k,onClick:x}){const w=n.createElement("div");var _,T;T=t,(_=w).style.position="absolute",_.style.borderRadius="4px",_.style.background=T,_.style.opacity="0.9",_.style.font=fP,_.style.color="#fff",_.style.display="flex",_.style.alignItems="center",_.style.whiteSpace="nowrap",_.style.overflow="hidden",_.style.textOverflow="ellipsis",function(e,{startRatio:t,durationRatio:n,rowIndex:i=0,rowHeight:r=18,rowGap:o=0}={}){const s=i*(r+o)+2,a=Math.max(1,r-4);e.style.top=`${s}px`,e.style.height=`${a}px`;const l=gP(t);if(vP(n)){const t=Math.max(0,Math.min(n,1-l));return e.style.left=100*l+"%",e.style.width=100*t+"%",void(e.style.padding="0 4px")}e.style.left=100*l+"%",e.style.width="2px",e.style.padding="0"}(w,{startRatio:i,durationRatio:r,rowIndex:h,rowHeight:f,rowGap:p}),function(e,{laneId:t,label:n,isClickable:i,shouldShowLabel:r,onClick:o}={}){if(t&&(e.dataset.timelineItem=t),r&&n){const t=lP.document.createElement("span");t.textContent=n,t.style.position="relative",t.style.zIndex="2",t.style.pointerEvents="none",e.appendChild(t)}i&&(e.style.cursor="pointer"),"function"==typeof o&&e.addEventListener("click",o)}(w,{laneId:m,label:d,isClickable:v,shouldShowLabel:"boolean"==typeof k?k:vP(r),onClick:x}),y&&(w.title=y),mP(o)&&(w.dataset.start=String(o)),vP(s)||nR(s)?(w.dataset.end=String(o+s),w.dataset.hasDuration="true"):(w.dataset.end="",w.dataset.hasDuration="false"),c&&(w.dataset.placementId=c),u&&(w.dataset.nodeId=u),w.style.pointerEvents="auto",lR(w,l,JP),function(e,t=[]){e&&Array.isArray(t)&&t.length&&t.forEach((t=>{if(!mP(t)||t<=0||t>=1)return;const n=lP.document.createElement("div");n.dataset.segmentBoundary="true",n.style.position="absolute",n.style.top="2px",n.style.bottom="2px",n.style.width="1px",n.style.left=100*gP(t)+"%",n.style.transform="translateX(-0.5px)",n.style.background="rgba(255,255,255,0.35)",n.style.pointerEvents="none",n.style.zIndex="1",e.appendChild(n)}))}(w,a),cR(w,g),y&&(w.addEventListener("mouseenter",(e=>V(y,e))),w.addEventListener("mousemove",(e=>V(y,e))),w.addEventListener("mouseleave",q)),b&&(w.addEventListener("mouseenter",(e=>H(b,e))),w.addEventListener("mousemove",(e=>H(b,e))),w.addEventListener("mouseleave",G)),e.appendChild(w),"nodes"===m&&c?S.set(c,w):"render"===m&&c&&A.set(c,w)}function Z(){let e=0;const n=Array.isArray(k)?k:[],i=Array.isArray(x)?x.filter((e=>!0!==(null==e?void 0:e.offsetPending))):[];return n.forEach((n=>{if(!0===(null==n?void 0:n.offsetPending))return;const i=mP(null==n?void 0:n.offset)?n.offset:void 0;if(!mP(i))return;const r=eR(n,t);e=vP(r)?Math.max(e,i+r):Math.max(e,i)})),i.forEach((t=>{const n=mP(null==t?void 0:t.offset)?t.offset:0,i=tR(t);e=vP(i)?Math.max(e,n+i):Math.max(e,n)})),vP(e)?e:1}function ee(){const n=Z();T=n,d.textContent=`t=${yP(w)}s`,h.textContent=`range=0-${yP(n)}s`,q(),G(),L(y.track),L(b.track),S.clear(),A.clear(),N=new Set,M=null,F=!1;const i=Array.isArray(k)?k:[],r=Array.isArray(x)?x:[],o=function(n){const i=(Array.isArray(n)?n.slice():[]).map((e=>{if(!0===(null==e?void 0:e.offsetPending))return null;const n=mP(null==e?void 0:e.offset)?e.offset:void 0;if(!mP(n))return null;const i=eR(e,t);return{placement:e,offset:n,duration:i,end:vP(i)?n+i:n,rowIndex:0}})).filter(Boolean).sort(((e,t)=>{var n,i,r,o;const s=e.offset-t.offset;if(0!==s)return s;const a="string"==typeof(null===(n=e.placement)||void 0===n?void 0:n.nodeId)?e.placement.nodeId:"",l="string"==typeof(null===(i=t.placement)||void 0===i?void 0:i.nodeId)?t.placement.nodeId:"";if(a!==l)return a.localeCompare(l);const c="string"==typeof(null===(r=e.placement)||void 0===r?void 0:r.placementId)?e.placement.placementId:"",u="string"==typeof(null===(o=t.placement)||void 0===o?void 0:o.placementId)?t.placement.placementId:"";return c.localeCompare(u)})),r=[],o=function(e,t){const n=Number(null==e||null===(t=e.settings)||void 0===t?void 0:t.snapToFps);return!Number.isFinite(n)||n<=0?0:.5/n}(e);return i.forEach((e=>{const t=e.offset,n=mP(e.end)?e.end:t;let i=-1;for(let e=0;e<r.length;e+=1)if(r[e]<=t+o){i=e;break}-1===i?(i=r.length,r.push(n)):r[i]=Math.max(r[i],n),e.rowIndex=i})),{items:i,rowCount:Math.max(1,r.length)}}(i);var s;!function(e){const t=e.rowCount*QP+4*(e.rowCount-1);y.track.style.height=`${t}px`,b.track.style.height="18px",y.track.style.cursor=_?"pointer":"default",y.track.style.pointerEvents="auto",b.track.style.pointerEvents="auto"}(o),s=n,o.items.forEach((e=>{const t=e.placement,n=e.offset,i=e.duration,r=(null==t?void 0:t.nodeId)||(null==t?void 0:t.placementId)||"node",o=!!mP(w)&&w>=n&&(!vP(i)||w<n+i),a=X(t);J({track:y.track,color:"rgba(255,255,255,0.16)",start:gP(n/s),duration:vP(i)?gP(i/s):null,startTime:n,durationSeconds:i,segmentRatios:a.boundaries,bufferedSegments:a.buffered,placementId:null==t?void 0:t.placementId,nodeId:null==t?void 0:t.nodeId,label:r,rowIndex:e.rowIndex,rowHeight:QP,rowGap:4,laneId:"nodes",isClickable:_,isActive:o,tooltip:(null==t?void 0:t.nodeId)||(null==t?void 0:t.placementId),hoverDetailsNodeId:null==t?void 0:t.nodeId})})),function(e,t){e.forEach((e=>{const n=mP(null==e?void 0:e.offset)?e.offset:void 0;if(!mP(n))return;const i=tR(e),r=nR(i),o=(null==e?void 0:e.type)||(null==e?void 0:e.renderPlacementId)||"render",s=function(e){const t="string"==typeof e?e.trim().toLowerCase():"";return"switch"===t||"switching"===t||"switchingrendernode"===t}(null==e?void 0:e.type),a=s?()=>{"function"==typeof(null==lP?void 0:lP.switchTo)&&lP.switchTo("next")}:void 0;let l=!1;mP(w)&&(r?l=w>=n:vP(i)&&(l=w>=n&&w<n+i));const c=r&&vP(t)?gP((t-n)/t):vP(i)?gP(i/t):null;J({track:b.track,color:"rgba(248,162,62,0.9)",start:gP(n/t),duration:c,startTime:n,durationSeconds:i,label:o,placementId:null==e?void 0:e.renderPlacementId,rowIndex:0,rowHeight:QP,rowGap:0,laneId:"render",isClickable:!!s,isActive:l,tooltip:(null==e?void 0:e.type)||(null==e?void 0:e.renderPlacementId),showLabel:vP(i)||r,onClick:a})}))}(r,n),j(y.indicator,n),j(b.indicator,n),K(),Y(),O=aR(k,x)||oR(k,t),C=O?rR(k,x,t):"",P=Array.isArray(k)?k.length:0,R=Array.isArray(x)?x.length:0,U()}function te(e,n){k=Array.isArray(e)?e.slice():[],x=Array.isArray(n)?n.slice():[],O=aR(k,x)||oR(k,t),Q(),ee()}return p.addEventListener("change",(()=>{_=p.checked,ee()})),y.track.addEventListener("click",(t=>{!function(t,n,i){if(!_||!e)return;if(!vP(n)||!i)return;const r="function"==typeof i.getBoundingClientRect?i.getBoundingClientRect():null,o=vP(null==r?void 0:r.width)?r.width:i.clientWidth;if(!vP(o))return;const s=mP(null==r?void 0:r.left)?r.left:0,a=gP(((mP(null==t?void 0:t.clientX)?t.clientX:0)-s)/o)*n;mP(a)&&(e.currentTime=a)}(t,Z(),y.track)})),{id:"timeline",title:"Timeline",render:e=>{e.appendChild(i),ee()},updatePlacements:te,updateTime:function(e){if(w=mP(e)?e:w,W())return;if(O&&$())return;const t=T;mP(t)&&(d.textContent=`t=${yP(w)}s`,h.textContent=`range=0-${yP(t)}s`,j(y.indicator,t),j(b.indicator,t),K())},refresh:()=>ee(),dispose:()=>{B();for(const e of E.values())(null==e?void 0:e.node)&&"function"==typeof e.node.off&&e.node.off("segment:chunk",e.handler);E.clear(),I.clear()}}}const dR=1024,hR=1048576,fR=1073741824;function pR(e){return mP(e)?e<dR?`${Math.round(e)} B`:e<hR?`${yP(e/dR,1)} KB`:e<fR?`${yP(e/hR,2)} MB`:`${yP(e/fR,2)} GB`:"n/a"}const mR="ekoplayer-debug-overlay";var vR=new WeakMap,gR=new WeakMap,yR=new WeakMap,bR=new WeakMap,kR=new WeakSet;class xR{constructor({tabBarEl:e,contentEl:t}){O(this,kR),F(this,vR,[]),F(this,gR,void 0),F(this,yR,void 0),F(this,bR,void 0),C(yR,this,e),C(bR,this,t)}registerTab(e){e&&"string"==typeof e.id&&"string"==typeof e.title&&"function"==typeof e.render&&(M(vR,this).some((t=>t.id===e.id))||(M(vR,this).push(e),A(kR,this,wR).call(this),M(gR,this)||this.selectTab(e.id)))}selectTab(e){M(vR,this).find((t=>t.id===e))&&(C(gR,this,e),A(kR,this,wR).call(this),A(kR,this,_R).call(this))}dispose(){M(yR,this)&&(M(yR,this).innerHTML=""),M(bR,this)&&(M(bR,this).innerHTML=""),C(vR,this,[]),C(yR,this,null),C(bR,this,null)}}function wR(){const e=M(yR,this);e&&(e.innerHTML="",M(vR,this).forEach((t=>{const n=lP.document.createElement("button");n.type="button",n.textContent=t.title,n.style.cursor="pointer",n.style.padding="6px 10px",n.style.borderRadius="6px",n.style.border="1px solid rgba(255,255,255,0.2)",n.style.background=t.id===M(gR,this)?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.2)",n.style.color="#fff",n.style.font=pP,n.addEventListener("click",(()=>this.selectTab(t.id))),e.appendChild(n)})))}function _R(){const e=M(bR,this);if(!e)return;e.innerHTML="";const t=M(vR,this).find((e=>e.id===M(gR,this)));t&&t.render(e)}function TR({mountElement:e,canvasElement:t,timeline:n,getNode:i,listNodes:r,downloadSpeed:o,downloadEvents:s,qoe:a,qoeEvents:l,options:c={},playbackStartedAtMs:u,playerVersion:d}={}){if(!e)throw new Error("Debug overlay requires mountElement.");if(!n||"function"!=typeof n.on)throw new Error("Debug overlay requires a Timeline with .on/.off.");!function(e){if(!e||!e.style)return;const t=null==lP?void 0:lP.window,n=t&&"function"==typeof t.getComputedStyle?t.getComputedStyle(e):null,i=n?n.position:e.style.position;i&&"static"!==i||(e.style.position="relative")}(e);const h=lP.document.getElementById(mR);h&&h.parentNode&&h.parentNode.removeChild(h);const f=function({mountElement:e,playerVersion:t}){const n=null==lP?void 0:lP.document;if(!n||"function"!=typeof n.createElement)throw new Error("Debug overlay requires document.createElement.");const i=n.createElement("div");i.id=mR,i.style.position="absolute",i.style.inset="0",i.style.zIndex="999999",i.style.pointerEvents="none";const r=n.createElement("div");r.style.position="absolute",r.style.top="8px",r.style.left="8px",r.style.width="460px",r.style.maxWidth="calc(100% - 16px)",r.style.background="rgba(0,0,0,0.65)",r.style.border="1px solid rgba(255,255,255,0.18)",r.style.borderRadius="10px",r.style.padding="10px",r.style.color="#fff",r.style.pointerEvents="auto",r.style.backdropFilter="blur(6px)";const o=n.createElement("div");o.style.display="flex",o.style.justifyContent="space-between",o.style.alignItems="center",o.style.gap="10px";const s=n.createElement("div");s.textContent="EkoPlayer Debug",s.style.font="600 13px ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial";const a=n.createElement("button");a.type="button",a.textContent="Hide",a.style.cursor="pointer",a.style.padding="6px 10px",a.style.borderRadius="8px",a.style.border="1px solid rgba(255,255,255,0.2)",a.style.background="rgba(0,0,0,0.2)",a.style.color="#fff",o.appendChild(s),o.appendChild(a);const l=n.createElement("div");l.style.display="flex",l.style.gap="8px",l.style.marginTop="10px";const c=n.createElement("div");c.style.marginTop="10px";const u=n.createElement("div");u.style.marginTop="10px",u.style.font=fP,u.style.display="flex",u.style.justifyContent="space-between",u.style.alignItems="center",u.style.gap="10px";const d=n.createElement("div");d.style.color="rgba(140, 224, 255, 0.9)",d.textContent="Playback started @ --";const h=n.createElement("div");h.style.opacity="0.7",h.style.marginLeft="auto",h.textContent=t?`version ${t}`:"version n/a",u.appendChild(d),u.appendChild(h);const f=n.createElement("button");return f.type="button",f.textContent="Debug",f.style.position="absolute",f.style.top="8px",f.style.left="8px",f.style.cursor="pointer",f.style.padding="6px 10px",f.style.borderRadius="10px",f.style.border="1px solid rgba(255,255,255,0.25)",f.style.background="rgba(0,0,0,0.55)",f.style.color="#fff",f.style.pointerEvents="auto",f.style.display="none",r.appendChild(o),r.appendChild(l),r.appendChild(c),r.appendChild(u),i.appendChild(r),i.appendChild(f),e.appendChild(i),{overlayRoot:i,panel:r,tabBar:l,content:c,hideBtn:a,showBtn:f,footerPlayback:d}}({mountElement:e,playerVersion:d||(null==c?void 0:c.playerVersion)}),p=new xR({tabBarEl:f.tabBar,contentEl:f.content});let m=!0;function v(){m=!1,f.panel.style.display="none",f.showBtn.style.display="inline-block"}function g(){m=!0,f.panel.style.display="block",f.showBtn.style.display="none"}f.hideBtn.addEventListener("click",v),f.showBtn.addEventListener("click",g);const y=uR({timeline:n,getNode:i}),b=function({getNode:e}){const t=lP.document,n=t.createElement("pre");n.style.margin="0",n.style.whiteSpace="pre-wrap",n.style.font=pP,n.style.lineHeight="1.35";const i=t.createElement("div");i.style.display="flex",i.style.flexDirection="column",i.style.gap="8px",i.style.marginTop="6px";const r=t.createElement("div");r.style.display="flex",r.style.gap="10px",r.style.marginTop="10px",r.style.alignItems="center",r.style.flexWrap="wrap";const o=new AP({maxValue:60}),s=new AP({maxValue:60}),a=t.createElement("div"),l=t.createElement("div");l.textContent="browserfps",l.style.font=fP,l.style.opacity="0.9",a.appendChild(l),a.appendChild(o.element);const c=t.createElement("div"),u=t.createElement("div");return u.textContent="fps",u.style.font=l.style.font,u.style.opacity="0.9",c.appendChild(u),c.appendChild(s.element),r.appendChild(a),r.appendChild(c),{id:"frames",title:"Frames",render:e=>{e.appendChild(n),e.appendChild(i),e.appendChild(r)},pushBrowserFps:(e,t)=>o.push(e,t),pushVisualFps:(e,t)=>s.push(e,t),updateInfo:function({time:r,entries:o}){const s=Array.isArray(o)?o.slice().sort(FP):[];if(!s.length)return n.textContent="",void(i.innerHTML="");n.textContent=`t=${LP(r)}s tracks=${s.length}`,i.innerHTML="";for(let n=0;n<s.length;n+=1){const r=s[n],o=WP(e,r),a=(null==o?void 0:o.id)||"n/a",l=(null==o?void 0:o.codecs)||(null==o?void 0:o.mime)||"n/a",c=DP(null==o?void 0:o.bandwidth),u=bP(null==o?void 0:o.width,null==o?void 0:o.height),d=BP(e,r)||"n/a",h=zP(e,r),f=h?` fallback=${h}`:"",p=PP(e,r),m=(null==p?void 0:p.strategy)||"n/a",v=(null==p?void 0:p.decisionReason)||"n/a",g=RP(null==p?void 0:p.measuredDownloadSpeedKbps),y=RP(null==p?void 0:p.safeBandwidthKbps),b=t.createElement("div");b.style.display="flex",b.style.flexDirection="column",b.style.gap="2px";const k=t.createElement("pre");k.style.margin="0",k.style.whiteSpace="pre-wrap",k.style.font=pP,k.style.lineHeight="1.35",k.textContent=[`${(null==r?void 0:r.nodeId)||"?"} ${(null==r?void 0:r.trackId)||"?"} ${(null==r?void 0:r.segmentId)||"?"} pts=${LP(null==r?void 0:r.presentationTime)}s`,`rep=${a} encodeProfile=${d}${f} res=${u} codec=${l} repBW=${c}`,`abr=strategy:${m} reason:${v} measuredBW:${g} safeBW:${y}`].join("\n"),b.appendChild(k);const x=(null==p?void 0:p.selectedRepresentationId)||(null==o?void 0:o.id),w=jP(e,r,o,p);if(w.length){const e=t.createElement("div");e.style.display="flex",e.style.alignItems="center",e.dataset.abrLadderRow="true",e.dataset.trackId=(null==r?void 0:r.trackId)||"",e.dataset.segmentId=(null==r?void 0:r.segmentId)||"";const n=t.createElement("div");n.style.display="inline-flex",n.style.alignItems="center",n.style.gap="2px",n.dataset.abrLadder="true",w.forEach((e=>{const i=t.createElement("span"),r=!!x&&e.id===x;i.dataset.abrLadderBlock="true",i.dataset.repId=e.id||"",i.dataset.selected=r?"true":"false",i.style.display="inline-block",i.style.width="10px",i.style.height="8px",i.style.borderRadius="2px",i.style.border="1px solid rgba(255,255,255,0.35)",i.style.background=r?"rgba(74, 222, 128, 0.95)":"rgba(156, 163, 175, 0.55)",i.title=`${e.id||"?"} ${RP(e.bandwidthKbps)}`,n.appendChild(i)})),e.appendChild(n),b.appendChild(e)}i.appendChild(b)}},dispose:()=>{o.dispose(),s.dispose()}}}({getNode:i}),k=KP({downloadSpeed:o,downloadEvents:s}),x=function({qoe:e,qoeEvents:t}={}){const n=null==lP?void 0:lP.document;if(!n||"function"!=typeof n.createElement)throw new Error("Debug overlay QoE tab requires document.createElement.");const i=n.createElement("pre");i.style.margin="0",i.style.whiteSpace="pre-wrap",i.style.font=pP;const{graphWrap:r,graph:o}=function(e){const t=e.createElement("div");t.style.marginTop="10px";const n=e.createElement("div");n.textContent="qoe score",n.style.font=fP,n.style.opacity="0.9";const i=new AP({maxValue:1,windowMs:3e4,formatValue:e=>XP(e)});return t.appendChild(n),t.appendChild(i.element),{graphWrap:t,graph:i}}(n);let s=null;const a=()=>{i.textContent=function(e){if(!e)return"QoE unavailable";const t="string"==typeof e.status?e.status:"n/a";return[`score=${XP(e.score)}`,`status=${t}`,`streamQualityScore=${XP(e.streamQualityScore)}`,`fpsScore=${XP(e.fpsScore)}`,`browserFps=${XP(e.browserFps)}`,`waitingSeconds=${XP(e.waitingSeconds)}`,`playingSeconds=${XP(e.playingSeconds)}`].join("\n")}(e)},l=()=>{if(!e)return;const t=Number(e.score);Number.isFinite(t)&&o.push(t,YP())},c=e=>{const t=Number(e);Number.isFinite(t)&&o.push(t,YP()),a()},u=()=>{a()};if(a(),l(),t&&"function"==typeof t.on&&(t.on("qoescore",c),t.on("qoestatus",u)),e){const e="function"==typeof(null==lP?void 0:lP.setInterval)?lP.setInterval:setInterval;s=e((()=>{l(),a()}),1e3)}return{id:"qoe",title:"QoE",render:e=>{e.appendChild(i),e.appendChild(r)},dispose:()=>{t&&"function"==typeof t.off&&(t.off("qoescore",c),t.off("qoestatus",u)),s&&(("function"==typeof(null==lP?void 0:lP.clearInterval)?lP.clearInterval:clearInterval)(s),s=null),o.dispose()}}}({qoe:a,qoeEvents:l}),w=function({timeline:e,getNode:t,listNodes:n,options:i}={}){const r=null==lP?void 0:lP.document;if(!r||"function"!=typeof r.createElement)throw new Error("Debug overlay Memory tab requires document.createElement.");const o=r.createElement("pre");o.style.margin="0",o.style.whiteSpace="pre-wrap",o.style.font=pP;const s=r.createElement("div");s.textContent="nodes",s.style.marginTop="10px",s.style.font=fP,s.style.opacity="0.9";const a=r.createElement("pre");a.style.margin="6px 0 0 0",a.style.whiteSpace="pre-wrap",a.style.font=pP;let l=null;const c=()=>{const r=function({timeline:e,getNode:t,listNodes:n}){const i=[];let r=0;if("function"==typeof n){let e;try{e=n()}catch(t){e=null}if(Array.isArray(e))return e.forEach((e=>{const t=null==e?void 0:e.id;if("string"!=typeof t||!t.length)return;const n=Number(null==e?void 0:e.retainedByteLength);Number.isFinite(n)&&(r+=n,i.push({nodeId:t,bytes:n}))})),i.sort(((e,t)=>t.bytes-e.bytes)),{totalBytes:r,nodes:i,available:!0}}if(!e||"function"!=typeof t)return{totalBytes:0,nodes:[],available:!1};const o=Array.isArray(e.placements)?e.placements:[];return new Set(o.map((e=>null==e?void 0:e.nodeId)).filter((e=>"string"==typeof e&&e.length))).forEach((e=>{const n=t(e),o=Number(null==n?void 0:n.retainedByteLength);Number.isFinite(o)&&(r+=o,i.push({nodeId:e,bytes:o}))})),i.sort(((e,t)=>t.bytes-e.bytes)),{totalBytes:r,nodes:i,available:!0}}({timeline:e,getNode:t,listNodes:n}),s=function({timeline:e}){if(!e||"function"!=typeof e.getDecodedFrameStats)return{totalBytes:0,frames:0,available:!1};try{const t=e.getDecodedFrameStats(),n=Number(null==t?void 0:t.totalBytes),i=Number(null==t?void 0:t.frames);return{totalBytes:Number.isFinite(n)?n:0,frames:Number.isFinite(i)?i:0,available:!1!==(null==t?void 0:t.available)}}catch(e){return{totalBytes:0,frames:0,available:!1}}}({timeline:e}),l=function(e,t,n,i){const r=Number(null!==(n=null==e||null===(i=e.publicOptions)||void 0===i?void 0:i.segmentEvictionMaxRetainedBytes)&&void 0!==n?n:null==e?void 0:e.segmentEvictionMaxRetainedBytes),o=mP(r)&&r>=0,s=o?pR(r):"n/a";return{active:o&&mP(t)&&t>r,thresholdLabel:s}}(i,r.available?r.totalBytes:NaN),c=l.active?"on":"off",u=s.available?pR(s.totalBytes):"n/a",d=s.available?s.frames:"n/a";if(!r.available)return o.textContent=[`decoded=${u} decodedFrames=${d}`,`retained=n/a eviction=${c} threshold=${l.thresholdLabel}`].join("\n"),void(a.textContent="");if(o.textContent=[`decoded=${u} decodedFrames=${d}`,[`retained=${pR(r.totalBytes)}`,`nodes=${r.nodes.length}`,`eviction=${c}`,`threshold=${l.thresholdLabel}`].join(" ")].join("\n"),!r.nodes.length)return void(a.textContent="none");const h=r.nodes.slice(0,8).map((e=>`${e.nodeId}: ${pR(e.bytes)}`));a.textContent=h.join("\n")};c();const u="function"==typeof(null==lP?void 0:lP.setInterval)?lP.setInterval:setInterval;return l=u(c,1e3),{id:"memory",title:"Memory",render:e=>{e.appendChild(o),e.appendChild(s),e.appendChild(a)},refresh:c,dispose:()=>{l&&(("function"==typeof(null==lP?void 0:lP.clearInterval)?lP.clearInterval:clearInterval)(l),l=null)}}}({timeline:n,getNode:i,listNodes:r,options:c});p.registerTab(y),p.registerTab(b),p.registerTab(k),p.registerTab(x),p.registerTab(w),p.registerTab(function({options:e}={}){const t=null==lP?void 0:lP.document;if(!t||"function"!=typeof t.createElement)throw new Error("Debug overlay options tab requires document.createElement.");const n=t.createElement("pre");n.style.margin="0",n.style.font=pP,n.style.whiteSpace="pre-wrap",n.style.wordBreak="break-word";const i=null==e?void 0:e.publicOptions,r=i&&"object"==typeof i?Object.keys(i):[];if(r.length){const e=r.map((e=>`${e}=${function(e){if(null===e)return"null";if(void 0===e)return"undefined";const t=typeof e;if("string"===t)return e;if("number"===t||"boolean"===t)return String(e);try{return JSON.stringify(e)}catch(t){return String(e)}}(i[e])}`));n.textContent=e.join("\n")}else n.textContent="publicOptions unavailable";return{id:"options",title:"Options",render:e=>{e.appendChild(n)}}}({options:c}));const _=[],T=[];let I=0,E=0,S=null,A=!1,N=0,M=null;function F(e){const t=Number(e);Number.isFinite(t)&&(t-N<250||(N=t,b.pushBrowserFps(I,t),b.pushVisualFps(E,t)))}lP.window&&"function"==typeof lP.window.requestAnimationFrame&&(S=lP.window.requestAnimationFrame((function e(t){A||(I=CP(_,t),F(t),S=lP.window.requestAnimationFrame(e))})));const C=(e={})=>{if(A||!m)return;const t=Array.isArray(e.frames)?e.frames:[];if(!t.length)return void(M=null);const n=null!=lP&&lP.performance&&"function"==typeof lP.performance.now?lP.performance.now():Date.now(),i=t.map((e=>`${null==e?void 0:e.nodeId}:${null==e?void 0:e.trackId}:${null==e?void 0:e.segmentId}@${null==e?void 0:e.presentationTime}`)).join("|");i!==M&&(E=CP(T,n),M=i),b.updateInfo({time:e.time,entries:t}),F(n)};let O=Number.isFinite(u)?u:void 0;if(Number.isFinite(O)&&f.footerPlayback){const e=O/1e3;f.footerPlayback.textContent=`Playback started @ ${yP(e)}s`}const P=(e={})=>{if(!A&&void 0===O&&"playing"===(null==e?void 0:e.event)&&(O=uP(),f.footerPlayback)){const e=O/1e3;f.footerPlayback.textContent=`Playback started @ ${yP(e)}s`}},R=()=>{const e=Array.isArray(null==n?void 0:n.placements)?n.placements:[],t=Array.isArray(null==n?void 0:n.renderPlacements)?n.renderPlacements:[];y.updatePlacements(e,t)},D=(e={})=>{if(A)return;const t=Number.isFinite(null==e?void 0:e.time)?e.time:null==n?void 0:n.currentTime;y.updateTime(t),w&&"function"==typeof w.refresh&&w.refresh()},L=()=>{A||R()},B=()=>{A||R()},z=null==n?void 0:n.trackBuffers,W=()=>{A||("function"==typeof y.refresh?y.refresh():R(),w&&"function"==typeof w.refresh&&w.refresh())};return n.on(dP.VISUAL_FRAMES_AVAILABLE,C),n.on(dP.TIMELINE_TIME_UPDATE,D),n.on(dP.PLACEMENT_ADDED,L),n.on(dP.RENDER_PLACEMENT_ADDED,B),n.on(dP.TIMELINE_PLAYER_STATE,P),z&&"function"==typeof z.on&&z.on("track:bufferupdate",W),R(),y.updateTime(null==n?void 0:n.currentTime),{show:g,hide:v,dispose:function(){A||(A=!0,S&&lP.window&&"function"==typeof lP.window.cancelAnimationFrame&&lP.window.cancelAnimationFrame(S),S=null,n&&"function"==typeof n.off&&(n.off(dP.VISUAL_FRAMES_AVAILABLE,C),n.off(dP.TIMELINE_TIME_UPDATE,D),n.off(dP.PLACEMENT_ADDED,L),n.off(dP.RENDER_PLACEMENT_ADDED,B),n.off(dP.TIMELINE_PLAYER_STATE,P)),z&&"function"==typeof z.off&&z.off("track:bufferupdate",W),b&&"function"==typeof b.dispose&&b.dispose(),y&&"function"==typeof y.dispose&&y.dispose(),k&&"function"==typeof k.dispose&&k.dispose(),x&&"function"==typeof x.dispose&&x.dispose(),w&&"function"==typeof w.dispose&&w.dispose(),p.dispose(),f.overlayRoot&&f.overlayRoot.parentNode&&f.overlayRoot.parentNode.removeChild(f.overlayRoot))},registerTab:function(e){p.registerTab(e)},selectTab:function(e){p.selectTab(e)}}}var IR=Object.freeze({__proto__:null,createDebugOverlay:TR,default:TR});exports.EkoGallery=oP,exports.EkoGalleryLegacy=nn,exports.ekoWebPixel=S,exports.getEkoAnalyticsSnippet=function(e){return`if (!window.EkoAnalytics) {\n !function () {\n var t, a, e, s, n;\n 'undefined' == typeof window || window.EkoAnalytics || (t = window, a = 'EkoAnalytics', e = document, s = 'script', t[a] || (t[a] = function () {\n t[a].f ? (t[a].q.push(arguments), t[a].ts.push(Date.now())) : t[a].apply(t, arguments);\n }, t[a].f = !0, t[a].q = t[a].q || [], t[a].ts = t[a].ts || [], t[a].t = Number(new Date), t[a].sa = [], t[a].cb = [], t[a].init = function (ids) {\n t[a].id = ids;\n }, t[a].childRequestIdsCallback = function (e) {\n e.data && 'ea-ids-request' === e.data.type && t[a].sa.push(e.source);\n }, t.addEventListener('message', t[a].childRequestIdsCallback)));\n }();\n\n window.EkoAnalytics.cb.push(() => {\n let setCookie = (key, value, additionalProperties = '') => {\n let hostname = window.location.hostname;\n let domain = hostname;\n \n let parts = hostname.split('.');\n if (parts.length > 2) {\n domain = parts.slice(-2).join('.');\n }\n\n // "samesite=lax" is needed for cross-site situations (like NZXT getting checkout url attributes from lambda).\n window.document.cookie = \`\${key}=\${value}; domain=.\${domain}; path=/; secure; samesite=lax; \${additionalProperties}\`;\n };\n\n setCookie('easid', encodeURIComponent(window.EkoAnalytics('getSid')));\n setCookie('eauid', encodeURIComponent(window.EkoAnalytics('getUid')), 'max-age=2147483647');\n });\n\n window.EkoAnalytics('configure', {\n snowplow: {\n options: {\n appId: 'ekoGalleryReact',\n },\n },\n ekoEnv: '${e?"production":"development"}',\n env: 'website',\n });\n window.EkoAnalytics('track', 'PageView');\n }`},exports.getEkoProductConfigUrl=sP,exports.getEkoProductConfigUrlLegacy=aP;