/*! For license information please see main.e503f1f8c06cade5e2d0.js.LICENSE.txt */ !function(){var t={945:function(t,e){var r="undefined"!=typeof self?self:this,i=function(){function t(){this.fetch=!1,this.DOMException=r.DOMException}return t.prototype=r,new t}();!function(t){!function(e){var r="URLSearchParams"in t,i="Symbol"in t&&"iterator"in Symbol,s="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),n="FormData"in t,o="ArrayBuffer"in t;if(o)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],l=ArrayBuffer.isView||function(t){return t&&a.indexOf(Object.prototype.toString.call(t))>-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function u(t){return"string"!=typeof t&&(t=String(t)),t}function d(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return i&&(e[Symbol.iterator]=function(){return e}),e}function h(t){this.map={},t instanceof h?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function f(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function p(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function g(t){var e=new FileReader,r=p(e);return e.readAsArrayBuffer(t),r}function m(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:s&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:n&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():o&&s&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=m(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):o&&(ArrayBuffer.prototype.isPrototypeOf(t)||l(t))?this._bodyArrayBuffer=m(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},s&&(this.blob=function(){var t=f(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(g)}),this.text=function(){var t,e,r,i=f(this);if(i)return i;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=p(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),i=0;i-1?i:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&s)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(s)}function E(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),i=r.shift().replace(/\+/g," "),s=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(i),decodeURIComponent(s))}})),e}function T(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new h(e.headers),this.url=e.url||"",this._initBody(t)}_.prototype.clone=function(){return new _(this,{body:this._bodyInit})},y.call(_.prototype),y.call(T.prototype),T.prototype.clone=function(){return new T(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},T.error=function(){var t=new T(null,{status:0,statusText:""});return t.type="error",t};var w=[301,302,303,307,308];T.redirect=function(t,e){if(-1===w.indexOf(e))throw new RangeError("Invalid status code");return new T(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function S(t,r){return new Promise((function(i,n){var o=new _(t,r);if(o.signal&&o.signal.aborted)return n(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function l(){a.abort()}a.onload=function(){var t,e,r={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new h,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),i=r.shift().trim();if(i){var s=r.join(":").trim();e.append(i,s)}})),e)};r.url="responseURL"in a?a.responseURL:r.headers.get("X-Request-URL");var s="response"in a?a.response:a.responseText;i(new T(s,r))},a.onerror=function(){n(new TypeError("Network request failed"))},a.ontimeout=function(){n(new TypeError("Network request failed"))},a.onabort=function(){n(new e.DOMException("Aborted","AbortError"))},a.open(o.method,o.url,!0),"include"===o.credentials?a.withCredentials=!0:"omit"===o.credentials&&(a.withCredentials=!1),"responseType"in a&&s&&(a.responseType="blob"),o.headers.forEach((function(t,e){a.setRequestHeader(e,t)})),o.signal&&(o.signal.addEventListener("abort",l),a.onreadystatechange=function(){4===a.readyState&&o.signal.removeEventListener("abort",l)}),a.send(void 0===o._bodyInit?null:o._bodyInit)}))}S.polyfill=!0,t.fetch||(t.fetch=S,t.Headers=h,t.Request=_,t.Response=T),e.Headers=h,e.Request=_,e.Response=T,e.fetch=S,Object.defineProperty(e,"__esModule",{value:!0})}({})}(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var s=i;(e=s.fetch).default=s.fetch,e.fetch=s.fetch,e.Headers=s.Headers,e.Request=s.Request,e.Response=s.Response,t.exports=e},17:function(t){"use strict";t.exports=function t(e,r){if(e===r)return!0;if(e&&r&&"object"==typeof e&&"object"==typeof r){if(e.constructor!==r.constructor)return!1;var i,s,n;if(Array.isArray(e)){if((i=e.length)!=r.length)return!1;for(s=i;0!=s--;)if(!t(e[s],r[s]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if((i=(n=Object.keys(e)).length)!==Object.keys(r).length)return!1;for(s=i;0!=s--;)if(!Object.prototype.hasOwnProperty.call(r,n[s]))return!1;for(s=i;0!=s--;){var o=n[s];if(!t(e[o],r[o]))return!1}return!0}return e!=e&&r!=r}},904:function(t){!function(){function e(t,e){document.addEventListener?t.addEventListener("scroll",e,!1):t.attachEvent("scroll",e)}function r(t){this.g=document.createElement("div"),this.g.setAttribute("aria-hidden","true"),this.g.appendChild(document.createTextNode(t)),this.h=document.createElement("span"),this.i=document.createElement("span"),this.m=document.createElement("span"),this.j=document.createElement("span"),this.l=-1,this.h.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.i.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.j.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.m.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;",this.h.appendChild(this.m),this.i.appendChild(this.j),this.g.appendChild(this.h),this.g.appendChild(this.i)}function i(t,e){t.g.style.cssText="max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;white-space:nowrap;font-synthesis:none;font:"+e+";"}function s(t){var e=t.g.offsetWidth,r=e+100;return t.j.style.width=r+"px",t.i.scrollLeft=r,t.h.scrollLeft=t.h.scrollWidth+100,t.l!==e&&(t.l=e,!0)}function n(t,r){function i(){var t=n;s(t)&&null!==t.g.parentNode&&r(t.l)}var n=t;e(t.h,i),e(t.i,i),s(t)}function o(t,e,r){e=e||{},r=r||window,this.family=t,this.style=e.style||"normal",this.weight=e.weight||"normal",this.stretch=e.stretch||"normal",this.context=r}var a=null,l=null,c=null,u=null;function d(t){return null===u&&(u=!!t.document.fonts),u}function h(t,e){var r=t.style,i=t.weight;if(null===c){var s=document.createElement("div");try{s.style.font="condensed 100px sans-serif"}catch(t){}c=""!==s.style.font}return[r,i,c?t.stretch:"","100px",e].join(" ")}o.prototype.load=function(t,e){var s=this,o=t||"BESbswy",c=0,u=e||3e3,f=(new Date).getTime();return new Promise((function(t,e){if(d(s.context)&&!function(t){return null===l&&(d(t)&&/Apple/.test(window.navigator.vendor)?(t=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))(?:\.([0-9]+))/.exec(window.navigator.userAgent),l=!!t&&603>parseInt(t[1],10)):l=!1),l}(s.context)){var p=new Promise((function(t,e){!function r(){(new Date).getTime()-f>=u?e(Error(u+"ms timeout exceeded")):s.context.document.fonts.load(h(s,'"'+s.family+'"'),o).then((function(e){1<=e.length?t():setTimeout(r,25)}),e)}()})),g=new Promise((function(t,e){c=setTimeout((function(){e(Error(u+"ms timeout exceeded"))}),u)}));Promise.race([g,p]).then((function(){clearTimeout(c),t(s)}),e)}else!function(t){document.body?t():document.addEventListener?document.addEventListener("DOMContentLoaded",(function e(){document.removeEventListener("DOMContentLoaded",e),t()})):document.attachEvent("onreadystatechange",(function e(){"interactive"!=document.readyState&&"complete"!=document.readyState||(document.detachEvent("onreadystatechange",e),t())}))}((function(){function l(){var e;(e=-1!=m&&-1!=y||-1!=m&&-1!=v||-1!=y&&-1!=v)&&((e=m!=y&&m!=v&&y!=v)||(null===a&&(e=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),a=!!e&&(536>parseInt(e[1],10)||536===parseInt(e[1],10)&&11>=parseInt(e[2],10))),e=a&&(m==_&&y==_&&v==_||m==E&&y==E&&v==E||m==T&&y==T&&v==T)),e=!e),e&&(null!==w.parentNode&&w.parentNode.removeChild(w),clearTimeout(c),t(s))}var d=new r(o),p=new r(o),g=new r(o),m=-1,y=-1,v=-1,_=-1,E=-1,T=-1,w=document.createElement("div");w.dir="ltr",i(d,h(s,"sans-serif")),i(p,h(s,"serif")),i(g,h(s,"monospace")),w.appendChild(d.g),w.appendChild(p.g),w.appendChild(g.g),s.context.document.body.appendChild(w),_=d.g.offsetWidth,E=p.g.offsetWidth,T=g.g.offsetWidth,function t(){if((new Date).getTime()-f>=u)null!==w.parentNode&&w.parentNode.removeChild(w),e(Error(u+"ms timeout exceeded"));else{var r=s.context.document.hidden;!0!==r&&void 0!==r||(m=d.g.offsetWidth,y=p.g.offsetWidth,v=g.g.offsetWidth,l()),c=setTimeout(t,50)}}(),n(d,(function(t){m=t,l()})),i(d,h(s,'"'+s.family+'",sans-serif')),n(p,(function(t){y=t,l()})),i(p,h(s,'"'+s.family+'",serif')),n(g,(function(t){v=t,l()})),i(g,h(s,'"'+s.family+'",monospace'))}))}))},t.exports=o}()},181:function(t,e,r){var i=/^\s+|\s+$/g,s=/^[-+]0x[0-9a-f]+$/i,n=/^0b[01]+$/i,o=/^0o[0-7]+$/i,a=parseInt,l="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,c="object"==typeof self&&self&&self.Object===Object&&self,u=l||c||Function("return this")(),d=Object.prototype.toString,h=Math.max,f=Math.min,p=function(){return u.Date.now()};function g(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function m(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==d.call(t)}(t))return NaN;if(g(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=g(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(i,"");var r=n.test(t);return r||o.test(t)?a(t.slice(2),r?2:8):s.test(t)?NaN:+t}t.exports=function(t,e,r){var i,s,n,o,a,l,c=0,u=!1,d=!1,y=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function v(e){var r=i,n=s;return i=s=void 0,c=e,o=t.apply(n,r)}function _(t){var r=t-l;return void 0===l||r>=e||r<0||d&&t-c>=n}function E(){var t=p();if(_(t))return T(t);a=setTimeout(E,function(t){var r=e-(t-l);return d?f(r,n-(t-c)):r}(t))}function T(t){return a=void 0,y&&i?v(t):(i=s=void 0,o)}function w(){var t=p(),r=_(t);if(i=arguments,s=this,l=t,r){if(void 0===a)return function(t){return c=t,a=setTimeout(E,e),u?v(t):o}(l);if(d)return a=setTimeout(E,e),v(l)}return void 0===a&&(a=setTimeout(E,e)),o}return e=m(e)||0,g(r)&&(u=!!r.leading,n=(d="maxWait"in r)?h(m(r.maxWait)||0,e):n,y="trailing"in r?!!r.trailing:y),w.cancel=function(){void 0!==a&&clearTimeout(a),c=0,i=l=s=a=void 0},w.flush=function(){return void 0===a?o:T(p())},w}}},e={};function r(i){var s=e[i];if(void 0!==s)return s.exports;var n=e[i]={exports:{}};return t[i].call(n.exports,n,n.exports,r),n.exports}r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,{a:e}),e},r.d=function(t,e){for(var i in e)r.o(e,i)&&!r.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};var i={};!function(){"use strict";function t(){}r.d(i,{C:function(){return tT},W:function(){return eT}}),t.prototype={on:function(t,e,r){var i=this.e||(this.e={});return(i[t]||(i[t]=[])).push({fn:e,ctx:r}),this},once:function(t,e,r){var i=this;function s(){i.off(t,s),e.apply(r,arguments)}return s._=e,this.on(t,s,r)},emit:function(t){for(var e=[].slice.call(arguments,1),r=((this.e||(this.e={}))[t]||[]).slice(),i=0,s=r.length;i=200&&e.status<300)return e.text();window.location.href=t.location.href}))}catch(t){return Promise.reject(t)}},e.prototype.beforeFetch=function(){try{var t=this;function i(){t.afterFetch()}t.pushState(),t.running=!0,t.emit("NAVIGATE_OUT",{from:{page:t.From.properties.page,view:t.From.properties.view},trigger:t.trigger,location:t.location});var e={trigger:t.trigger,contextual:t.Contextual},r=t.cache.has(t.location.href)?Promise.resolve(t.From.hide(e)).then((function(){t.properties=t.cache.get(t.location.href)})):Promise.resolve(Promise.all([t.fetch(),t.From.hide(e)])).then((function(e){t.properties=t.Helpers.getProperties(e[0]),t.cache.set(t.location.href,t.properties)}));return Promise.resolve(r&&r.then?r.then(i):i())}catch(t){return Promise.reject(t)}},e.prototype.afterFetch=function(){try{var t=this;return Promise.resolve(t.properties.renderer).then((function(e){return t.To=new e(t.properties),t.To.add(),t.emit("NAVIGATE_IN",{to:{page:t.To.properties.page,view:t.To.wrap.lastElementChild},trigger:t.trigger,location:t.location}),Promise.resolve(t.To.show({trigger:t.trigger,contextual:t.Contextual})).then((function(){t.popping=!1,t.running=!1,t.detach(t.links),t.links=document.querySelectorAll("a:not([target]):not([data-router-disabled])"),t.attach(t.links),t.emit("NAVIGATE_END",{to:{page:t.To.properties.page,view:t.To.wrap.lastElementChild},from:{page:t.From.properties.page,view:t.From.properties.view},trigger:t.trigger,location:t.location}),t.From=t.To,t.trigger=null}))}))}catch(t){return Promise.reject(t)}},e}(e),l=function(t,e){this.wrap=t,this.name=e};l.prototype.show=function(t){var e=this,r=t.trigger,i=t.contextual,s=this.wrap.lastElementChild,n=this.wrap.firstElementChild;return new Promise((function(t){i?(s.setAttribute("data-transition-in",i.name),s.removeAttribute("data-transition-out",i.name),i.in&&i.in({to:s,from:n,trigger:r,done:t})):(s.setAttribute("data-transition-in",e.name),s.removeAttribute("data-transition-out",e.name),e.in&&e.in({to:s,from:n,trigger:r,done:t}))}))},l.prototype.hide=function(t){var e=this,r=t.trigger,i=t.contextual,s=this.wrap.firstElementChild;return new Promise((function(t){i?(s.setAttribute("data-transition-out",i.name),s.removeAttribute("data-transition-in",i.name),i.out&&i.out({from:s,trigger:r,done:t})):(s.setAttribute("data-transition-out",e.name),s.removeAttribute("data-transition-in",e.name),e.out&&e.out({from:s,trigger:r,done:t}))}))},console.log("Highway v2.2.0");var c={Core:a,Helpers:o,Renderer:s,Transition:l},u=r(945),d=r.n(u);function h(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function f(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var p,g,m,y,v,_,E,T,w,S,b,D={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},L={duration:.5,overwrite:!1,delay:0},A=1e8,k=1e-8,C=2*Math.PI,x=C/4,R=0,P=Math.sqrt,I=Math.cos,F=Math.sin,M=function(t){return"string"==typeof t},O=function(t){return"function"==typeof t},N=function(t){return"number"==typeof t},B=function(t){return void 0===t},U=function(t){return"object"==typeof t},$=function(t){return!1!==t},q=function(){return"undefined"!=typeof window},G=function(t){return O(t)||M(t)},H="function"==typeof ArrayBuffer&&ArrayBuffer.isView||function(){},V=Array.isArray,K=/(?:-?\.?\d|\.)+/gi,W=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,z=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,j=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,Y=/[+-]=-?[.\d]+/,X=/[^,'"\[\]\s]+/gi,Q=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,Z={},J={},tt=function(t){return(J=kt(t,Z))&&Lr},et=function(t,e){return console.warn("Invalid property",t,"set to",e,"Missing plugin? gsap.registerPlugin()")},rt=function(t,e){return!e&&console.warn(t)},it=function(t,e){return t&&(Z[t]=e)&&J&&(J[t]=e)||Z},st=function(){return 0},nt={suppressEvents:!0,isStart:!0},ot={suppressEvents:!0},at={},lt=[],ct={},ut={},dt={},ht=30,ft=[],pt="",gt=function(t){var e,r,i=t[0];if(U(i)||O(i)||(t=[t]),!(e=(i._gsap||{}).harness)){for(r=ft.length;r--&&!ft[r].targetTest(i););e=ft[r]}for(r=t.length;r--;)t[r]&&(t[r]._gsap||(t[r]._gsap=new qe(t[r],e)))||t.splice(r,1);return t},mt=function(t){return t._gsap||gt(oe(t))[0]._gsap},yt=function(t,e,r){return(r=t[e])&&O(r)?t[e]():B(r)&&t.getAttribute&&t.getAttribute(e)||r},vt=function(t,e){return(t=t.split(",")).forEach(e)||t},_t=function(t){return Math.round(1e5*t)/1e5||0},Et=function(t){return Math.round(1e7*t)/1e7||0},Tt=function(t,e){var r=e.charAt(0),i=parseFloat(e.substr(2));return t=parseFloat(t),"+"===r?t+i:"-"===r?t-i:"*"===r?t*i:t/i},wt=function(t,e){for(var r=e.length,i=0;t.indexOf(e[i])<0&&++in;)o=o._prev;return o?(e._next=o._next,o._next=e):(e._next=t[r],t[r]=e),e._next?e._next._prev=e:t[i]=e,e._prev=o,e.parent=e._dp=t,e},It=function(t,e,r,i){void 0===r&&(r="_first"),void 0===i&&(i="_last");var s=e._prev,n=e._next;s?s._next=n:t[r]===e&&(t[r]=n),n?n._prev=s:t[i]===e&&(t[i]=s),e._next=e._prev=e.parent=null},Ft=function(t,e){t.parent&&(!e||t.parent.autoRemoveChildren)&&t.parent.remove(t),t._act=0},Mt=function(t,e){if(t&&(!e||e._end>t._dur||e._start<0))for(var r=t;r;)r._dirty=1,r=r.parent;return t},Ot=function(t,e,r,i){return t._startAt&&(g?t._startAt.revert(ot):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(e,!0,i))},Nt=function t(e){return!e||e._ts&&t(e.parent)},Bt=function(t){return t._repeat?Ut(t._tTime,t=t.duration()+t._rDelay)*t:0},Ut=function(t,e){var r=Math.floor(t/=e);return t&&r===t?r-1:r},$t=function(t,e){return(t-e._start)*e._ts+(e._ts>=0?0:e._dirty?e.totalDuration():e._tDur)},qt=function(t){return t._end=Et(t._start+(t._tDur/Math.abs(t._ts||t._rts||k)||0))},Gt=function(t,e){var r=t._dp;return r&&r.smoothChildTiming&&t._ts&&(t._start=Et(r._time-(t._ts>0?e/t._ts:((t._dirty?t.totalDuration():t._tDur)-e)/-t._ts)),qt(t),r._dirty||Mt(r,t)),t},Ht=function(t,e){var r;if((e._time||e._initted&&!e._dur)&&(r=$t(t.rawTime(),e),(!e._dur||ee(0,e.totalDuration(),r)-e._tTime>k)&&e.render(r,!0)),Mt(t,e)._dp&&t._initted&&t._time>=t._dur&&t._ts){if(t._dur=0&&r.totalTime(r._tTime),r=r._dp;t._zTime=-1e-8}},Vt=function(t,e,r,i){return e.parent&&Ft(e),e._start=Et((N(r)?r:r||t!==y?Zt(t,r,e):t._time)+e._delay),e._end=Et(e._start+(e.totalDuration()/Math.abs(e.timeScale())||0)),Pt(t,e,"_first","_last",t._sort?"_start":0),jt(e)||(t._recent=e),i||Ht(t,e),t._ts<0&&Gt(t,t._tTime),t},Kt=function(t,e){return(Z.ScrollTrigger||et("scrollTrigger",e))&&Z.ScrollTrigger.create(e,t)},Wt=function(t,e,r,i){return Ye(t,e),t._initted?!r&&t._pt&&(t._dur&&!1!==t.vars.lazy||!t._dur&&t.vars.lazy)&&w!==ke.frame?(lt.push(t),t._lazy=[e,i],1):void 0:1},zt=function t(e){var r=e.parent;return r&&r._ts&&r._initted&&!r._lock&&(r.rawTime()<0||t(r))},jt=function(t){var e=t.data;return"isFromStart"===e||"isStart"===e},Yt=function(t,e,r,i){var s=t._repeat,n=Et(e)||0,o=t._tTime/t._tDur;return o&&!i&&(t._time*=n/t._dur),t._dur=n,t._tDur=s?s<0?1e10:Et(n*(s+1)+t._rDelay*s):n,o>0&&!i?Gt(t,t._tTime=t._tDur*o):t.parent&&qt(t),r||Mt(t.parent,t),t},Xt=function(t){return t instanceof He?Mt(t):Yt(t,t._dur)},Qt={_start:0,endTime:st,totalDuration:st},Zt=function t(e,r,i){var s,n,o,a=e.labels,l=e._recent||Qt,c=e.duration()>=A?l.endTime(!1):e._dur;return M(r)&&(isNaN(r)||r in a)?(n=r.charAt(0),o="%"===r.substr(-1),s=r.indexOf("="),"<"===n||">"===n?(s>=0&&(r=r.replace(/=/,"")),("<"===n?l._start:l.endTime(l._repeat>=0))+(parseFloat(r.substr(1))||0)*(o?(s<0?l:i).totalDuration()/100:1)):s<0?(r in a||(a[r]=c),a[r]):(n=parseFloat(r.charAt(s-1)+r.substr(s+1)),o&&i&&(n=n/100*(V(i)?i[0]:i).totalDuration()),s>1?t(e,r.substr(0,s-1),i)+n:c+n)):null==r?c:+r},Jt=function(t,e,r){var i,s,n=N(e[1]),o=(n?2:1)+(t<2?0:1),a=e[o];if(n&&(a.duration=e[1]),a.parent=r,t){for(i=a,s=r;s&&!("immediateRender"in i);)i=s.vars.defaults||{},s=$(s.vars.inherit)&&s.parent;a.immediateRender=$(i.immediateRender),t<2?a.runBackwards=1:a.startAt=e[o-1]}return new tr(e[0],a,e[o+1])},te=function(t,e){return t||0===t?e(t):e},ee=function(t,e,r){return re?e:r},re=function(t,e){return M(t)&&(e=Q.exec(t))?e[1]:""},ie=[].slice,se=function(t,e){return t&&U(t)&&"length"in t&&(!e&&!t.length||t.length-1 in t&&U(t[0]))&&!t.nodeType&&t!==v},ne=function(t,e,r){return void 0===r&&(r=[]),t.forEach((function(t){var i;return M(t)&&!e||se(t,1)?(i=r).push.apply(i,oe(t)):r.push(t)}))||r},oe=function(t,e,r){return m&&!e&&m.selector?m.selector(t):!M(t)||r||!_&&Ce()?V(t)?ne(t,r):se(t)?ie.call(t,0):t?[t]:[]:ie.call((e||E).querySelectorAll(t),0)},ae=function(t){return t=oe(t)[0]||rt("Invalid scope")||{},function(e){var r=t.current||t.nativeElement||t;return oe(e,r.querySelectorAll?r:r===t?rt("Invalid scope")||E.createElement("div"):t)}},le=function(t){return t.sort((function(){return.5-Math.random()}))},ce=function(t){if(O(t))return t;var e=U(t)?t:{each:t},r=Oe(e.ease),i=e.from||0,s=parseFloat(e.base)||0,n={},o=i>0&&i<1,a=isNaN(i)||o,l=e.axis,c=i,u=i;return M(i)?c=u={center:.5,edges:.5,end:1}[i]||0:!o&&a&&(c=i[0],u=i[1]),function(t,o,d){var h,f,p,g,m,y,v,_,E,T=(d||e).length,w=n[T];if(!w){if(!(E="auto"===e.grid?0:(e.grid||[1,A])[1])){for(v=-A;v<(v=d[E++].getBoundingClientRect().left)&&Ev&&(v=m),m<_&&(_=m);"random"===i&&le(w),w.max=v-_,w.min=_,w.v=T=(parseFloat(e.amount)||parseFloat(e.each)*(E>T?T-1:l?"y"===l?T/E:E:Math.max(E,T/E))||0)*("edges"===i?-1:1),w.b=T<0?s-T:s,w.u=re(e.amount||e.each)||0,r=r&&T<0?Fe(r):r}return T=(w[t]-w.min)/w.max||0,Et(w.b+(r?r(T):T)*w.v)+w.u}},ue=function(t){var e=Math.pow(10,((t+"").split(".")[1]||"").length);return function(r){var i=Et(Math.round(parseFloat(r)/t)*t*e);return(i-i%1)/e+(N(r)?0:re(r))}},de=function(t,e){var r,i,s=V(t);return!s&&U(t)&&(r=s=t.radius||A,t.values?(t=oe(t.values),(i=!N(t[0]))&&(r*=r)):t=ue(t.increment)),te(e,s?O(t)?function(e){return i=t(e),Math.abs(i-e)<=r?i:e}:function(e){for(var s,n,o=parseFloat(i?e.x:e),a=parseFloat(i?e.y:0),l=A,c=0,u=t.length;u--;)(s=i?(s=t[u].x-o)*s+(n=t[u].y-a)*n:Math.abs(t[u]-o))(s=Math.abs(s))&&(n=i,a=s);return n},ye=function(t,e,r){var i,s,n,o=t.vars,a=o[e],l=m,c=t._ctx;if(a)return i=o[e+"Params"],s=o.callbackScope||t,r&<.length&&St(),c&&(m=c),n=i?a.apply(s,i):a.call(s),m=l,n},ve=function(t){return Ft(t),t.scrollTrigger&&t.scrollTrigger.kill(!1),t.progress()<1&&ye(t,"onInterrupt"),t},_e=255,Ee={aqua:[0,_e,_e],lime:[0,_e,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,_e],navy:[0,0,128],white:[_e,_e,_e],olive:[128,128,0],yellow:[_e,_e,0],orange:[_e,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[_e,0,0],pink:[_e,192,203],cyan:[0,_e,_e],transparent:[_e,_e,_e,0]},Te=function(t,e,r){return(6*(t+=t<0?1:t>1?-1:0)<1?e+(r-e)*t*6:t<.5?r:3*t<2?e+(r-e)*(2/3-t)*6:e)*_e+.5|0},we=function(t,e,r){var i,s,n,o,a,l,c,u,d,h,f=t?N(t)?[t>>16,t>>8&_e,t&_e]:0:Ee.black;if(!f){if(","===t.substr(-1)&&(t=t.substr(0,t.length-1)),Ee[t])f=Ee[t];else if("#"===t.charAt(0)){if(t.length<6&&(i=t.charAt(1),s=t.charAt(2),n=t.charAt(3),t="#"+i+i+s+s+n+n+(5===t.length?t.charAt(4)+t.charAt(4):"")),9===t.length)return[(f=parseInt(t.substr(1,6),16))>>16,f>>8&_e,f&_e,parseInt(t.substr(7),16)/255];f=[(t=parseInt(t.substr(1),16))>>16,t>>8&_e,t&_e]}else if("hsl"===t.substr(0,3))if(f=h=t.match(K),e){if(~t.indexOf("="))return f=t.match(W),r&&f.length<4&&(f[3]=1),f}else o=+f[0]%360/360,a=+f[1]/100,i=2*(l=+f[2]/100)-(s=l<=.5?l*(a+1):l+a-l*a),f.length>3&&(f[3]*=1),f[0]=Te(o+1/3,i,s),f[1]=Te(o,i,s),f[2]=Te(o-1/3,i,s);else f=t.match(K)||Ee.transparent;f=f.map(Number)}return e&&!h&&(i=f[0]/_e,s=f[1]/_e,n=f[2]/_e,l=((c=Math.max(i,s,n))+(u=Math.min(i,s,n)))/2,c===u?o=a=0:(d=c-u,a=l>.5?d/(2-c-u):d/(c+u),o=c===i?(s-n)/d+(sa&&(c+=_-l),((g=(y=(u+=_)-c)-h)>0||E)&&(v=++i.frame,s=y-1e3*i.time,i.time=y/=1e3,h+=g+(g>=d?4:d-g),m=1),E||(t=e(r)),m)for(n=0;n=e&&n--},_listeners:f},i}(),Ce=function(){return!b&&ke.wake()},xe={},Re=/^[\d.\-M][\d.\-,\s]/,Pe=/["']/g,Ie=function(t){for(var e,r,i,s={},n=t.substr(1,t.length-3).split(":"),o=n[0],a=1,l=n.length;a1&&o.config?o.config.apply(null,~t.indexOf("{")?[Ie(n[1])]:(e=t,r=e.indexOf("(")+1,i=e.indexOf(")"),s=e.indexOf("(",r),e.substring(r,~s&&s=1?r:1,n=(i||(e?.3:.45))/(r<1?r:1),o=n/C*(Math.asin(1/s)||0),a=function(t){return 1===t?1:s*Math.pow(2,-10*t)*F((t-o)*n)+1},l="out"===e?a:"in"===e?function(t){return 1-a(1-t)}:Be(a);return n=C/n,l.config=function(r,i){return t(e,r,i)},l},$e=function t(e,r){void 0===r&&(r=1.70158);var i=function(t){return t?--t*t*((r+1)*t+r)+1:0},s="out"===e?i:"in"===e?function(t){return 1-i(1-t)}:Be(i);return s.config=function(r){return t(e,r)},s};vt("Linear,Quad,Cubic,Quart,Quint,Strong",(function(t,e){var r=e<5?e+1:e;Ne(t+",Power"+(r-1),e?function(t){return Math.pow(t,r)}:function(t){return t},(function(t){return 1-Math.pow(1-t,r)}),(function(t){return t<.5?Math.pow(2*t,r)/2:1-Math.pow(2*(1-t),r)/2}))})),xe.Linear.easeNone=xe.none=xe.Linear.easeIn,Ne("Elastic",Ue("in"),Ue("out"),Ue()),function(t,e){var r=1/e,i=2*r,s=2.5*r,n=function(n){return n0?t+(t+this._rDelay)*this._repeat:t):this.totalDuration()&&this._dur},e.totalDuration=function(t){return arguments.length?(this._dirty=0,Yt(this,this._repeat<0?t:(t-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},e.totalTime=function(t,e){if(Ce(),!arguments.length)return this._tTime;var r=this._dp;if(r&&r.smoothChildTiming&&this._ts){for(Gt(this,t),!r._dp||r.parent||Ht(r,this);r&&r.parent;)r.parent._time!==r._start+(r._ts>=0?r._tTime/r._ts:(r.totalDuration()-r._tTime)/-r._ts)&&r.totalTime(r._tTime,!0),r=r.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&t0||!this._tDur&&!t)&&Vt(this._dp,this,this._start-this._delay)}return(this._tTime!==t||!this._dur&&!e||this._initted&&Math.abs(this._zTime)===k||!t&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=t),bt(this,t,e)),this},e.time=function(t,e){return arguments.length?this.totalTime(Math.min(this.totalDuration(),t+Bt(this))%(this._dur+this._rDelay)||(t?this._dur:0),e):this._time},e.totalProgress=function(t,e){return arguments.length?this.totalTime(this.totalDuration()*t,e):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.ratio},e.progress=function(t,e){return arguments.length?this.totalTime(this.duration()*(!this._yoyo||1&this.iteration()?t:1-t)+Bt(this),e):this.duration()?Math.min(1,this._time/this._dur):this.ratio},e.iteration=function(t,e){var r=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(t-1)*r,e):this._repeat?Ut(this._tTime,r)+1:1},e.timeScale=function(t){if(!arguments.length)return-1e-8===this._rts?0:this._rts;if(this._rts===t)return this;var e=this.parent&&this._ts?$t(this.parent._time,this):this._tTime;return this._rts=+t||0,this._ts=this._ps||-1e-8===t?0:this._rts,this.totalTime(ee(-this._delay,this._tDur,e),!0),qt(this),function(t){for(var e=t.parent;e&&e.parent;)e._dirty=1,e.totalDuration(),e=e.parent;return t}(this)},e.paused=function(t){return arguments.length?(this._ps!==t&&(this._ps=t,t?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(Ce(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,1===this.progress()&&Math.abs(this._zTime)!==k&&(this._tTime-=k)))),this):this._ps},e.startTime=function(t){if(arguments.length){this._start=t;var e=this.parent||this._dp;return e&&(e._sort||!this.parent)&&Vt(e,this,t-this._delay),this}return this._start},e.endTime=function(t){return this._start+($(t)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},e.rawTime=function(t){var e=this.parent||this._dp;return e?t&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?$t(e.rawTime(t),this):this._tTime:this._tTime},e.revert=function(t){void 0===t&&(t=ot);var e=g;return g=t,this.timeline&&this.timeline.revert(t),this.totalTime(-.01,t.suppressEvents),"nested"!==this.data&&Ft(this),g=e,this},e.globalTime=function(t){for(var e=this,r=arguments.length?t:e.rawTime();e;)r=e._start+r/(e._ts||1),e=e._dp;return!this.parent&&this.vars.immediateRender?-1:r},e.repeat=function(t){return arguments.length?(this._repeat=t===1/0?-2:t,Xt(this)):-2===this._repeat?1/0:this._repeat},e.repeatDelay=function(t){if(arguments.length){var e=this._time;return this._rDelay=t,Xt(this),e?this.time(e):this}return this._rDelay},e.yoyo=function(t){return arguments.length?(this._yoyo=t,this):this._yoyo},e.seek=function(t,e){return this.totalTime(Zt(this,t),$(e))},e.restart=function(t,e){return this.play().totalTime(t?-this._delay:0,$(e))},e.play=function(t,e){return null!=t&&this.seek(t,e),this.reversed(!1).paused(!1)},e.reverse=function(t,e){return null!=t&&this.seek(t||this.totalDuration(),e),this.reversed(!0).paused(!1)},e.pause=function(t,e){return null!=t&&this.seek(t,e),this.paused(!0)},e.resume=function(){return this.paused(!1)},e.reversed=function(t){return arguments.length?(!!t!==this.reversed()&&this.timeScale(-this._rts||(t?-1e-8:0)),this):this._rts<0},e.invalidate=function(){return this._initted=this._act=0,this._zTime=-1e-8,this},e.isActive=function(){var t,e=this.parent||this._dp,r=this._start;return!(e&&!(this._ts&&this._initted&&e.isActive()&&(t=e.rawTime(!0))>=r&&t1?(e?(i[t]=e,r&&(i[t+"Params"]=r),"onUpdate"===t&&(this._onUpdate=e)):delete i[t],this):i[t]},e.then=function(t){var e=this;return new Promise((function(r){var i=O(t)?t:Lt,s=function(){var t=e.then;e.then=null,O(i)&&(i=i(e))&&(i.then||i===e)&&(e.then=t),r(i),e.then=t};e._initted&&1===e.totalProgress()&&e._ts>=0||!e._tTime&&e._ts<0?s():e._prom=s}))},e.kill=function(){ve(this)},t}();At(Ge.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-1e-8,_prom:0,_ps:!1,_rts:1});var He=function(t){function e(e,r){var i;return void 0===e&&(e={}),(i=t.call(this,e)||this).labels={},i.smoothChildTiming=!!e.smoothChildTiming,i.autoRemoveChildren=!!e.autoRemoveChildren,i._sort=$(e.sortChildren),y&&Vt(e.parent||y,h(i),r),e.reversed&&i.reverse(),e.paused&&i.paused(!0),e.scrollTrigger&&Kt(h(i),e.scrollTrigger),i}f(e,t);var r=e.prototype;return r.to=function(t,e,r){return Jt(0,arguments,this),this},r.from=function(t,e,r){return Jt(1,arguments,this),this},r.fromTo=function(t,e,r,i){return Jt(2,arguments,this),this},r.set=function(t,e,r){return e.duration=0,e.parent=this,Rt(e).repeatDelay||(e.repeat=0),e.immediateRender=!!e.immediateRender,new tr(t,e,Zt(this,r),1),this},r.call=function(t,e,r){return Vt(this,tr.delayedCall(0,t,e),r)},r.staggerTo=function(t,e,r,i,s,n,o){return r.duration=e,r.stagger=r.stagger||i,r.onComplete=n,r.onCompleteParams=o,r.parent=this,new tr(t,r,Zt(this,s)),this},r.staggerFrom=function(t,e,r,i,s,n,o){return r.runBackwards=1,Rt(r).immediateRender=$(r.immediateRender),this.staggerTo(t,e,r,i,s,n,o)},r.staggerFromTo=function(t,e,r,i,s,n,o,a){return i.startAt=r,Rt(i).immediateRender=$(i.immediateRender),this.staggerTo(t,e,i,s,n,o,a)},r.render=function(t,e,r){var i,s,n,o,a,l,c,u,d,h,f,p,m=this._time,v=this._dirty?this.totalDuration():this._tDur,_=this._dur,E=t<=0?0:Et(t),T=this._zTime<0!=t<0&&(this._initted||!_);if(this!==y&&E>v&&t>=0&&(E=v),E!==this._tTime||r||T){if(m!==this._time&&_&&(E+=this._time-m,t+=this._time-m),i=E,d=this._start,l=!(u=this._ts),T&&(_||(m=this._zTime),(t||!e)&&(this._zTime=t)),this._repeat){if(f=this._yoyo,a=_+this._rDelay,this._repeat<-1&&t<0)return this.totalTime(100*a+t,e,r);if(i=Et(E%a),E===v?(o=this._repeat,i=_):((o=~~(E/a))&&o===E/a&&(i=_,o--),i>_&&(i=_)),h=Ut(this._tTime,a),!m&&this._tTime&&h!==o&&(h=o),f&&1&o&&(i=_-i,p=1),o!==h&&!this._lock){var w=f&&1&h,S=w===(f&&1&o);if(oe)for(i=t._first;i&&i._start<=r;){if("isPause"===i.data&&i._start>e)return i;i=i._next}else for(i=t._last;i&&i._start>=r;){if("isPause"===i.data&&i._start=m&&t>=0)for(s=this._first;s;){if(n=s._next,(s._act||i>=s._start)&&s._ts&&c!==s){if(s.parent!==this)return this.render(t,e,r);if(s.render(s._ts>0?(i-s._start)*s._ts:(s._dirty?s.totalDuration():s._tDur)+(i-s._start)*s._ts,e,r),i!==this._time||!this._ts&&!l){c=0,n&&(E+=this._zTime=-1e-8);break}}s=n}else{r=r||g,s=this._last;for(var b=t<0?t:i;s;){if(n=s._prev,(s._act||b<=s._end)&&s._ts&&c!==s){if(s.parent!==this)return this.render(t,e,r);if(s.render(s._ts>0?(b-s._start)*s._ts:(s._dirty?s.totalDuration():s._tDur)+(b-s._start)*s._ts,e,r),i!==this._time||!this._ts&&!l){c=0,n&&(E+=this._zTime=b?-1e-8:k);break}}s=n}}if(c&&!e&&(this.pause(),c.render(i>=m?0:-1e-8)._zTime=i>=m?1:-1,this._ts))return this._start=d,qt(this),this.render(t,e,r);this._onUpdate&&!e&&ye(this,"onUpdate",!0),(E===v&&this._tTime>=this.totalDuration()||!E&&m)&&(d!==this._start&&Math.abs(u)===Math.abs(this._ts)||this._lock||((t||!_)&&(E===v&&this._ts>0||!E&&this._ts<0)&&Ft(this,1),e||t<0&&!m||!E&&!m&&v||(ye(this,E===v&&t>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(E0)&&this._prom())))}return this},r.add=function(t,e){var r=this;if(N(e)||(e=Zt(this,e,t)),!(t instanceof Ge)){if(V(t))return t.forEach((function(t){return r.add(t,e)})),this;if(M(t))return this.addLabel(t,e);if(!O(t))return this;t=tr.delayedCall(0,t)}return this!==t?Vt(this,t,e):this},r.getChildren=function(t,e,r,i){void 0===t&&(t=!0),void 0===e&&(e=!0),void 0===r&&(r=!0),void 0===i&&(i=-A);for(var s=[],n=this._first;n;)n._start>=i&&(n instanceof tr?e&&s.push(n):(r&&s.push(n),t&&s.push.apply(s,n.getChildren(!0,e,r)))),n=n._next;return s},r.getById=function(t){for(var e=this.getChildren(1,1,1),r=e.length;r--;)if(e[r].vars.id===t)return e[r]},r.remove=function(t){return M(t)?this.removeLabel(t):O(t)?this.killTweensOf(t):(It(this,t),t===this._recent&&(this._recent=this._last),Mt(this))},r.totalTime=function(e,r){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=Et(ke.time-(this._ts>0?e/this._ts:(this.totalDuration()-e)/-this._ts))),t.prototype.totalTime.call(this,e,r),this._forcing=0,this):this._tTime},r.addLabel=function(t,e){return this.labels[t]=Zt(this,e),this},r.removeLabel=function(t){return delete this.labels[t],this},r.addPause=function(t,e,r){var i=tr.delayedCall(0,e||st,r);return i.data="isPause",this._hasPause=1,Vt(this,i,Zt(this,t))},r.removePause=function(t){var e=this._first;for(t=Zt(this,t);e;)e._start===t&&"isPause"===e.data&&Ft(e),e=e._next},r.killTweensOf=function(t,e,r){for(var i=this.getTweensOf(t,r),s=i.length;s--;)Ve!==i[s]&&i[s].kill(t,e);return this},r.getTweensOf=function(t,e){for(var r,i=[],s=oe(t),n=this._first,o=N(e);n;)n instanceof tr?wt(n._targets,s)&&(o?(!Ve||n._initted&&n._ts)&&n.globalTime(0)<=e&&n.globalTime(n.totalDuration())>e:!e||n.isActive())&&i.push(n):(r=n.getTweensOf(s,e)).length&&i.push.apply(i,r),n=n._next;return i},r.tweenTo=function(t,e){e=e||{};var r,i=this,s=Zt(i,t),n=e,o=n.startAt,a=n.onStart,l=n.onStartParams,c=n.immediateRender,u=tr.to(i,At({ease:e.ease||"none",lazy:!1,immediateRender:!1,time:s,overwrite:"auto",duration:e.duration||Math.abs((s-(o&&"time"in o?o.time:i._time))/i.timeScale())||k,onStart:function(){if(i.pause(),!r){var t=e.duration||Math.abs((s-(o&&"time"in o?o.time:i._time))/i.timeScale());u._dur!==t&&Yt(u,t,0,1).render(u._time,!0,!0),r=1}a&&a.apply(u,l||[])}},e));return c?u.render(0):u},r.tweenFromTo=function(t,e,r){return this.tweenTo(e,At({startAt:{time:Zt(this,t)}},r))},r.recent=function(){return this._recent},r.nextLabel=function(t){return void 0===t&&(t=this._time),me(this,Zt(this,t))},r.previousLabel=function(t){return void 0===t&&(t=this._time),me(this,Zt(this,t),1)},r.currentLabel=function(t){return arguments.length?this.seek(t,!0):this.previousLabel(this._time+k)},r.shiftChildren=function(t,e,r){void 0===r&&(r=0);for(var i,s=this._first,n=this.labels;s;)s._start>=r&&(s._start+=t,s._end+=t),s=s._next;if(e)for(i in n)n[i]>=r&&(n[i]+=t);return Mt(this)},r.invalidate=function(){var e=this._first;for(this._lock=0;e;)e.invalidate(),e=e._next;return t.prototype.invalidate.call(this)},r.clear=function(t){void 0===t&&(t=!0);for(var e,r=this._first;r;)e=r._next,this.remove(r),r=e;return this._dp&&(this._time=this._tTime=this._pTime=0),t&&(this.labels={}),Mt(this)},r.totalDuration=function(t){var e,r,i,s=0,n=this,o=n._last,a=A;if(arguments.length)return n.timeScale((n._repeat<0?n.duration():n.totalDuration())/(n.reversed()?-t:t));if(n._dirty){for(i=n.parent;o;)e=o._prev,o._dirty&&o.totalDuration(),(r=o._start)>a&&n._sort&&o._ts&&!n._lock?(n._lock=1,Vt(n,o,r-o._delay,1)._lock=0):a=r,r<0&&o._ts&&(s-=r,(!i&&!n._dp||i&&i.smoothChildTiming)&&(n._start+=r/n._ts,n._time-=r,n._tTime-=r),n.shiftChildren(-r,!1,-Infinity),a=0),o._end>s&&o._ts&&(s=o._end),o=e;Yt(n,n===y&&n._time>s?n._time:s,1,1),n._dirty=0}return n._tDur},e.updateRoot=function(t){if(y._ts&&(bt(y,$t(t,y)),w=ke.frame),ke.frame>=ht){ht+=D.autoSleep||120;var e=y._first;if((!e||!e._ts)&&D.autoSleep&&ke._listeners.length<2){for(;e&&!e._ts;)e=e._next;e||ke.sleep()}}},e}(Ge);At(He.prototype,{_lock:0,_hasPause:0,_forcing:0});var Ve,Ke,We=function(t,e,r,i,s,n,o){var a,l,c,u,d,h,f,p,g=new pr(this._pt,t,e,0,1,lr,null,s),m=0,y=0;for(g.b=r,g.e=i,r+="",(f=~(i+="").indexOf("random("))&&(i=pe(i)),n&&(n(p=[r,i],t,e),r=p[0],i=p[1]),l=r.match(j)||[];a=j.exec(i);)u=a[0],d=i.substring(m,a.index),c?c=(c+1)%5:"rgba("===d.substr(-5)&&(c=1),u!==l[y++]&&(h=parseFloat(l[y-1])||0,g._pt={_next:g._pt,p:d||1===y?d:",",s:h,c:"="===u.charAt(1)?Tt(h,u)-h:parseFloat(u)-h,m:c&&c<4?Math.round:0},m=j.lastIndex);return g.c=m")})),o.duration();else{for(u in l={},S)"ease"===u||"easeEach"===u||Xe(u,S[u],l,S.easeEach);for(u in l)for(x=l[u].sort((function(t,e){return t.t-e.t})),I=0,a=0;af-k&&!m?f:tp&&(i=p)),(l=this._yoyo&&1&n)&&(d=this._yEase,i=p-i),a=Ut(this._tTime,o),i===h&&!r&&this._initted)return this._tTime=y,this;n!==a&&(u&&this._yEase&&Me(u,l),!this.vars.repeatRefresh||l||this._lock||(this._lock=r=1,this.render(Et(o*n),!0).invalidate()._lock=0))}if(!this._initted){if(Wt(this,m?t:i,r,e))return this._tTime=0,this;if(h!==this._time)return this;if(p!==this._dur)return this.render(t,e,r)}if(this._tTime=y,this._time=i,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=c=(d||this._ease)(i/p),this._from&&(this.ratio=c=1-c),i&&!h&&!e&&(ye(this,"onStart"),this._tTime!==y))return this;for(s=this._pt;s;)s.r(c,s.d),s=s._next;u&&u.render(t<0?t:!i&&l?-1e-8:u._dur*u._ease(i/this._dur),e,r)||this._startAt&&(this._zTime=t),this._onUpdate&&!e&&(m&&Ot(this,t,0,r),ye(this,"onUpdate")),this._repeat&&n!==a&&this.vars.onRepeat&&!e&&this.parent&&ye(this,"onRepeat"),y!==this._tDur&&y||this._tTime!==y||(m&&!this._onUpdate&&Ot(this,t,0,!0),(t||!p)&&(y===this._tDur&&this._ts>0||!y&&this._ts<0)&&Ft(this,1),e||m&&!h||!y&&!h||(ye(this,y===f?"onComplete":"onReverseComplete",!0),this._prom&&!(y0)&&this._prom()))}}else!function(t,e,r,i){var s,n,o,a=t.ratio,l=e<0||!e&&(!t._start&&zt(t)&&(t._initted||!jt(t))||(t._ts<0||t._dp._ts<0)&&!jt(t))?0:1,c=t._rDelay,u=0;if(c&&t._repeat&&(u=ee(0,t._tDur,e),n=Ut(u,c),t._yoyo&&1&n&&(l=1-l),n!==Ut(t._tTime,c)&&(a=1-l,t.vars.repeatRefresh&&t._initted&&t.invalidate())),l!==a||g||i||t._zTime===k||!e&&t._zTime){if(!t._initted&&Wt(t,e,i,r))return;for(o=t._zTime,t._zTime=e||(r?k:0),r||(r=e&&!o),t.ratio=l,t._from&&(l=1-l),t._time=0,t._tTime=u,s=t._pt;s;)s.r(l,s.d),s=s._next;e<0&&Ot(t,e,0,!0),t._onUpdate&&!r&&ye(t,"onUpdate"),u&&t._repeat&&!r&&t.parent&&ye(t,"onRepeat"),(e>=t._tDur||e<0)&&t.ratio===l&&(l&&Ft(t,1),r||(ye(t,l?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=e)}(this,t,e,r);return this},r.targets=function(){return this._targets},r.invalidate=function(){return this._pt=this._op=this._startAt=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(),t.prototype.invalidate.call(this)},r.resetTo=function(t,e,r,i){b||ke.wake(),this._ts||this.play();var s=Math.min(this._dur,(this._dp._time-this._start)*this._ts);return this._initted||Ye(this,s),function(t,e,r,i,s,n,o){var a,l,c,u,d=(t._pt&&t._ptCache||(t._ptCache={}))[e];if(!d)for(d=t._ptCache[e]=[],c=t._ptLookup,u=t._targets.length;u--;){if((a=c[u][e])&&a.d&&a.d._pt)for(a=a.d._pt;a&&a.p!==e&&a.fp!==e;)a=a._next;if(!a)return Ke=1,t.vars[e]="+=0",Ye(t,o),Ke=0,1;d.push(a)}for(u=d.length;u--;)(a=(l=d[u])._pt||l).s=!i&&0!==i||s?a.s+(i||0)+n*a.c:i,a.c=r-a.s,l.e&&(l.e=_t(r)+re(l.e)),l.b&&(l.b=a.s+re(l.b))}(this,t,e,r,i,this._ease(s/this._dur),s)?this.resetTo(t,e,r,i):(Gt(this,0),this.parent||Pt(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},r.kill=function(t,e){if(void 0===e&&(e="all"),!(t||e&&"all"!==e))return this._lazy=this._pt=0,this.parent?ve(this):this;if(this.timeline){var r=this.timeline.totalDuration();return this.timeline.killTweensOf(t,e,Ve&&!0!==Ve.vars.overwrite)._first||ve(this),this.parent&&r!==this.timeline.totalDuration()&&Yt(this,this._dur*this.timeline._tDur/r,0,1),this}var i,s,n,o,a,l,c,u=this._targets,d=t?oe(t):u,h=this._ptLookup,f=this._pt;if((!e||"all"===e)&&function(t,e){for(var r=t.length,i=r===e.length;i&&r--&&t[r]===e[r];);return r<0}(u,d))return"all"===e&&(this._pt=0),ve(this);for(i=this._op=this._op||[],"all"!==e&&(M(e)&&(a={},vt(e,(function(t){return a[t]=1})),e=a),e=function(t,e){var r,i,s,n,o=t[0]?mt(t[0]).harness:0,a=o&&o.aliases;if(!a)return e;for(i in r=kt({},e),a)if(i in r)for(s=(n=a[i].split(",")).length;s--;)r[n[s]]=r[i];return r}(u,e)),c=u.length;c--;)if(~d.indexOf(u[c]))for(a in s=h[c],"all"===e?(i[c]=e,o=s,n={}):(n=i[c]=i[c]||{},o=e),o)(l=s&&s[a])&&("kill"in l.d&&!0!==l.d.kill(a)||It(this,l,"_pt"),delete s[a]),"all"!==n&&(n[a]=1);return this._initted&&!this._pt&&f&&ve(this),this},e.to=function(t,r){return new e(t,r,arguments[2])},e.from=function(t,e){return Jt(1,arguments)},e.delayedCall=function(t,r,i,s){return new e(r,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:t,onComplete:r,onReverseComplete:r,onCompleteParams:i,onReverseCompleteParams:i,callbackScope:s})},e.fromTo=function(t,e,r){return Jt(2,arguments)},e.set=function(t,r){return r.duration=0,r.repeatDelay||(r.repeat=0),new e(t,r)},e.killTweensOf=function(t,e,r){return y.killTweensOf(t,e,r)},e}(Ge);At(tr.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),vt("staggerTo,staggerFrom,staggerFromTo",(function(t){tr[t]=function(){var e=new He,r=ie.call(arguments,0);return r.splice("staggerFromTo"===t?5:4,0,0),e[t].apply(e,r)}}));var er=function(t,e,r){return t[e]=r},rr=function(t,e,r){return t[e](r)},ir=function(t,e,r,i){return t[e](i.fp,r)},sr=function(t,e,r){return t.setAttribute(e,r)},nr=function(t,e){return O(t[e])?rr:B(t[e])&&t.setAttribute?sr:er},or=function(t,e){return e.set(e.t,e.p,Math.round(1e6*(e.s+e.c*t))/1e6,e)},ar=function(t,e){return e.set(e.t,e.p,!!(e.s+e.c*t),e)},lr=function(t,e){var r=e._pt,i="";if(!t&&e.b)i=e.b;else if(1===t&&e.e)i=e.e;else{for(;r;)i=r.p+(r.m?r.m(r.s+r.c*t):Math.round(1e4*(r.s+r.c*t))/1e4)+i,r=r._next;i+=e.c}e.set(e.t,e.p,i,e)},cr=function(t,e){for(var r=e._pt;r;)r.r(t,r.d),r=r._next},ur=function(t,e,r,i){for(var s,n=this._pt;n;)s=n._next,n.p===i&&n.modifier(t,e,r),n=s},dr=function(t){for(var e,r,i=this._pt;i;)r=i._next,i.p===t&&!i.op||i.op===t?It(this,i,"_pt"):i.dep||(e=1),i=r;return!e},hr=function(t,e,r,i){i.mSet(t,e,i.m.call(i.tween,r,i.mt),i)},fr=function(t){for(var e,r,i,s,n=t._pt;n;){for(e=n._next,r=i;r&&r.pr>n.pr;)r=r._next;(n._prev=r?r._prev:s)?n._prev._next=n:i=n,(n._next=r)?r._prev=n:s=n,n=e}t._pt=i},pr=function(){function t(t,e,r,i,s,n,o,a,l){this.t=e,this.s=i,this.c=s,this.p=r,this.r=n||or,this.d=o||this,this.set=a||er,this.pr=l||0,this._next=t,t&&(t._prev=this)}return t.prototype.modifier=function(t,e,r){this.mSet=this.mSet||this.set,this.set=hr,this.m=t,this.mt=r,this.tween=e},t}();vt(pt+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",(function(t){return at[t]=1})),Z.TweenMax=Z.TweenLite=tr,Z.TimelineLite=Z.TimelineMax=He,y=new He({sortChildren:!1,defaults:L,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),D.stringFilter=Ae;var gr=[],mr={},yr=[],vr=0,_r=function(t){return(mr[t]||yr).map((function(t){return t()}))},Er=function(){var t=Date.now(),e=[];t-vr>2&&(_r("matchMediaInit"),gr.forEach((function(t){var r,i,s,n,o=t.queries,a=t.conditions;for(i in o)(r=v.matchMedia(o[i]).matches)&&(s=1),r!==a[i]&&(a[i]=r,n=1);n&&(t.revert(),s&&e.push(t))})),_r("matchMediaRevert"),e.forEach((function(t){return t.onMatch(t)})),vr=t,_r("matchMedia"))},Tr=function(){function t(t,e){this.selector=e&&ae(e),this.data=[],this._r=[],this.isReverted=!1,t&&this.add(t)}var e=t.prototype;return e.add=function(t,e,r){O(t)&&(r=e,e=t,t=O);var i=this,s=function(){var t,s=m,n=i.selector;return s&&s.data.push(i),r&&(i.selector=ae(r)),m=i,t=e.apply(i,arguments),O(t)&&i._r.push(t),m=s,i.selector=n,i.isReverted=!1,t};return i.last=s,t===O?s(i):t?i[t]=s:s},e.ignore=function(t){var e=m;m=null,t(this),m=e},e.getTweens=function(){var e=[];return this.data.forEach((function(r){return r instanceof t?e.push.apply(e,r.getTweens()):r instanceof tr&&r._targets[0]!==r.vars.onComplete&&e.push(r)})),e},e.clear=function(){this._r.length=this.data.length=0},e.kill=function(t,e){var r=this;if(t?(this.getTweens().map((function(t){return{g:t.globalTime(0),t:t}})).sort((function(t,e){return e.g-t.g||-1})).forEach((function(e){return e.t.revert(t)})),this.data.forEach((function(e){return!(e instanceof Ge)&&e.revert&&e.revert(t)})),this._r.forEach((function(e){return e(t,r)})),this.isReverted=!0):this.data.forEach((function(t){return t.kill&&t.kill()})),this.clear(),e){var i=gr.indexOf(this);~i&&gr.splice(i,1)}},e.revert=function(t){this.kill(t||{})},t}(),wr=function(){function t(t){this.contexts=[],this.scope=t}var e=t.prototype;return e.add=function(t,e,r){U(t)||(t={matches:t});var i,s,n,o=new Tr(0,r||this.scope),a=o.conditions={};for(s in this.contexts.push(o),e=o.add("onMatch",e),o.queries=t,t)"all"===s?n=1:(i=v.matchMedia(t[s]))&&(gr.indexOf(o)<0&&gr.push(o),(a[s]=i.matches)&&(n=1),i.addListener?i.addListener(Er):i.addEventListener("change",Er));return n&&e(o),this},e.revert=function(t){this.kill(t||{})},e.kill=function(t){this.contexts.forEach((function(e){return e.kill(t,!0)}))},t}(),Sr={registerPlugin:function(){for(var t=arguments.length,e=new Array(t),r=0;r1){var i=t.map((function(t){return Lr.quickSetter(t,e,r)})),s=i.length;return function(t){for(var e=s;e--;)i[e](t)}}t=t[0]||{};var n=ut[e],o=mt(t),a=o.harness&&(o.harness.aliases||{})[e]||e,l=n?function(e){var i=new n;S._pt=0,i.init(t,r?e+r:e,S,0,[t]),i.render(1,i),S._pt&&cr(1,S)}:o.set(t,a);return n?l:function(e){return l(t,a,r?e+r:e,o,1)}},quickTo:function(t,e,r){var i,s=Lr.to(t,kt(((i={})[e]="+=0.1",i.paused=!0,i),r||{})),n=function(t,r,i){return s.resetTo(e,t,r,i)};return n.tween=s,n},isTweening:function(t){return y.getTweensOf(t,!0).length>0},defaults:function(t){return t&&t.ease&&(t.ease=Oe(t.ease,L.ease)),Ct(L,t||{})},config:function(t){return Ct(D,t||{})},registerEffect:function(t){var e=t.name,r=t.effect,i=t.plugins,s=t.defaults,n=t.extendTimeline;(i||"").split(",").forEach((function(t){return t&&!ut[t]&&!Z[t]&&rt(e+" effect requires "+t+" plugin.")})),dt[e]=function(t,e,i){return r(oe(t),At(e||{},s),i)},n&&(He.prototype[e]=function(t,r,i){return this.add(dt[e](t,U(r)?r:(i=r)&&{},this),i)})},registerEase:function(t,e){xe[t]=Oe(e)},parseEase:function(t,e){return arguments.length?Oe(t,e):xe},getById:function(t){return y.getById(t)},exportRoot:function(t,e){void 0===t&&(t={});var r,i,s=new He(t);for(s.smoothChildTiming=$(t.smoothChildTiming),y.remove(s),s._dp=0,s._time=s._tTime=y._time,r=y._first;r;)i=r._next,!e&&!r._dur&&r instanceof tr&&r.vars.onComplete===r._targets[0]||Vt(s,r,r._start-r._delay),r=i;return Vt(y,s,0),s},context:function(t,e){return t?new Tr(t,e):m},matchMedia:function(t){return new wr(t)},matchMediaRefresh:function(){return gr.forEach((function(t){var e,r,i=t.conditions;for(r in i)i[r]&&(i[r]=!1,e=1);e&&t.revert()}))||Er()},addEventListener:function(t,e){var r=mr[t]||(mr[t]=[]);~r.indexOf(e)||r.push(e)},removeEventListener:function(t,e){var r=mr[t],i=r&&r.indexOf(e);i>=0&&r.splice(i,1)},utils:{wrap:function t(e,r,i){var s=r-e;return V(e)?fe(e,t(0,e.length),r):te(i,(function(t){return(s+(t-e)%s)%s+e}))},wrapYoyo:function t(e,r,i){var s=r-e,n=2*s;return V(e)?fe(e,t(0,e.length-1),r):te(i,(function(t){return e+((t=(n+(t-e)%n)%n||0)>s?n-t:t)}))},distribute:ce,random:he,snap:de,normalize:function(t,e,r){return ge(t,e,0,1,r)},getUnit:re,clamp:function(t,e,r){return te(r,(function(r){return ee(t,e,r)}))},splitColor:we,toArray:oe,selector:ae,mapRange:ge,pipe:function(){for(var t=arguments.length,e=new Array(t),r=0;r=0)return;t=ei}i&&this.props.push(t,i[t])},si=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},ni=function(){var t,e,r=this.props,i=this.target,s=i.style,n=i._gsap;for(t=0;t=0?ci[s]:"")+t},di=function(){"undefined"!=typeof window&&window.document&&(Ar=window,kr=Ar.document,Cr=kr.documentElement,Rr=ai("div")||{style:{}},ai("div"),ei=ui(ei),ri=ei+"Origin",Rr.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",Fr=!!ui("perspective"),Ir=Lr.core.reverting,xr=1)},hi=function t(e){var r,i=ai("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),s=this.parentNode,n=this.nextSibling,o=this.style.cssText;if(Cr.appendChild(i),i.appendChild(this),this.style.display="block",e)try{r=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=t}catch(t){}else this._gsapBBox&&(r=this._gsapBBox());return s&&(n?s.insertBefore(this,n):s.appendChild(this)),Cr.removeChild(i),this.style.cssText=o,r},fi=function(t,e){for(var r=e.length;r--;)if(t.hasAttribute(e[r]))return t.getAttribute(e[r])},pi=function(t){var e;try{e=t.getBBox()}catch(r){e=hi.call(t,!0)}return e&&(e.width||e.height)||t.getBBox===hi||(e=hi.call(t,!0)),!e||e.width||e.x||e.y?e:{x:+fi(t,["x","cx","x1"])||0,y:+fi(t,["y","cy","y1"])||0,width:0,height:0}},gi=function(t){return!(!t.getCTM||t.parentNode&&!t.ownerSVGElement||!pi(t))},mi=function(t,e){if(e){var r=t.style;e in Mr&&e!==ri&&(e=ei),r.removeProperty?("ms"!==e.substr(0,2)&&"webkit"!==e.substr(0,6)||(e="-"+e),r.removeProperty(e.replace(Ur,"-$1").toLowerCase())):r.removeAttribute(e)}},yi=function(t,e,r,i,s,n){var o=new pr(t._pt,e,r,0,1,n?jr:zr);return t._pt=o,o.b=i,o.e=s,t._props.push(r),o},vi={deg:1,rad:1,turn:1},_i={grid:1,flex:1},Ei=function t(e,r,i,s){var n,o,a,l,c=parseFloat(i)||0,u=(i+"").trim().substr((c+"").length)||"px",d=Rr.style,h=$r.test(r),f="svg"===e.tagName.toLowerCase(),p=(f?"client":"offset")+(h?"Width":"Height"),g=100,m="px"===s,y="%"===s;return s===u||!c||vi[s]||vi[u]?c:("px"!==u&&!m&&(c=t(e,r,i,"px")),l=e.getCTM&&gi(e),!y&&"%"!==u||!Mr[r]&&!~r.indexOf("adius")?(d[h?"width":"height"]=g+(m?u:s),o=~r.indexOf("adius")||"em"===s&&e.appendChild&&!f?e:e.parentNode,l&&(o=(e.ownerSVGElement||{}).parentNode),o&&o!==kr&&o.appendChild||(o=kr.body),(a=o._gsap)&&y&&a.width&&h&&a.time===ke.time&&!a.uncache?_t(c/a.width*g):((y||"%"===u)&&!_i[li(o,"display")]&&(d.position=li(e,"position")),o===e&&(d.position="static"),o.appendChild(Rr),n=Rr[p],o.removeChild(Rr),d.position="absolute",h&&y&&((a=mt(o)).time=ke.time,a.width=o[p]),_t(m?n*c/g:n&&c?g/n*c:0))):(n=l?e.getBBox()[h?"width":"height"]:e[p],_t(y?c/n*g:c/100*n)))},Ti=function(t,e,r,i){var s;return xr||di(),e in Gr&&"transform"!==e&&~(e=Gr[e]).indexOf(",")&&(e=e.split(",")[0]),Mr[e]&&"transform"!==e?(s=Pi(t,i),s="transformOrigin"!==e?s[e]:s.svg?s.origin:Ii(li(t,ri))+" "+s.zOrigin+"px"):(!(s=t.style[e])||"auto"===s||i||~(s+"").indexOf("calc("))&&(s=Di[e]&&Di[e](t,e,r)||li(t,e)||yt(t,e)||("opacity"===e?1:0)),r&&!~(s+"").trim().indexOf(" ")?Ei(t,e,s,r)+r:s},wi=function(t,e,r,i){if(!r||"none"===r){var s=ui(e,t,1),n=s&&li(t,s,1);n&&n!==r?(e=s,r=n):"borderColor"===e&&(r=li(t,"borderTopColor"))}var o,a,l,c,u,d,h,f,p,g,m,y=new pr(this._pt,t.style,e,0,1,lr),v=0,_=0;if(y.b=r,y.e=i,r+="","auto"===(i+="")&&(t.style[e]=i,i=li(t,e)||i,t.style[e]=r),Ae(o=[r,i]),i=o[1],l=(r=o[0]).match(z)||[],(i.match(z)||[]).length){for(;a=z.exec(i);)h=a[0],p=i.substring(v,a.index),u?u=(u+1)%5:"rgba("!==p.substr(-5)&&"hsla("!==p.substr(-5)||(u=1),h!==(d=l[_++]||"")&&(c=parseFloat(d)||0,m=d.substr((c+"").length),"="===h.charAt(1)&&(h=Tt(c,h)+m),f=parseFloat(h),g=h.substr((f+"").length),v=z.lastIndex-g.length,g||(g=g||D.units[e]||m,v===i.length&&(i+=g,y.e+=g)),m!==g&&(c=Ei(t,e,d,g)||0),y._pt={_next:y._pt,p:p||1===_?p:",",s:c,c:f-c,m:u&&u<4||"zIndex"===e?Math.round:0});y.c=v-1;)r=a[s],Mr[r]&&(i=1,r="transformOrigin"===r?ri:ei),mi(n,r);i&&(mi(n,ei),l&&(l.svg&&n.removeAttribute("transform"),Pi(n,1),l.uncache=1,si(o)))}},Di={clearProps:function(t,e,r,i,s){if("isFromStart"!==s.data){var n=t._pt=new pr(t._pt,e,r,0,0,bi);return n.u=i,n.pr=-10,n.tween=s,t._props.push(r),1}}},Li=[1,0,0,1,0,0],Ai={},ki=function(t){return"matrix(1, 0, 0, 1, 0, 0)"===t||"none"===t||!t},Ci=function(t){var e=li(t,ei);return ki(e)?Li:e.substr(7).match(W).map(_t)},xi=function(t,e){var r,i,s,n,o=t._gsap||mt(t),a=t.style,l=Ci(t);return o.svg&&t.getAttribute("transform")?"1,0,0,1,0,0"===(l=[(s=t.transform.baseVal.consolidate().matrix).a,s.b,s.c,s.d,s.e,s.f]).join(",")?Li:l:(l!==Li||t.offsetParent||t===Cr||o.svg||(s=a.display,a.display="block",(r=t.parentNode)&&t.offsetParent||(n=1,i=t.nextElementSibling,Cr.appendChild(t)),l=Ci(t),s?a.display=s:mi(t,"display"),n&&(i?r.insertBefore(t,i):r?r.appendChild(t):Cr.removeChild(t))),e&&l.length>6?[l[0],l[1],l[4],l[5],l[12],l[13]]:l)},Ri=function(t,e,r,i,s,n){var o,a,l,c=t._gsap,u=s||xi(t,!0),d=c.xOrigin||0,h=c.yOrigin||0,f=c.xOffset||0,p=c.yOffset||0,g=u[0],m=u[1],y=u[2],v=u[3],_=u[4],E=u[5],T=e.split(" "),w=parseFloat(T[0])||0,S=parseFloat(T[1])||0;r?u!==Li&&(a=g*v-m*y)&&(l=w*(-m/a)+S*(g/a)-(g*E-m*_)/a,w=w*(v/a)+S*(-y/a)+(y*E-v*_)/a,S=l):(w=(o=pi(t)).x+(~T[0].indexOf("%")?w/100*o.width:w),S=o.y+(~(T[1]||T[0]).indexOf("%")?S/100*o.height:S)),i||!1!==i&&c.smooth?(_=w-d,E=S-h,c.xOffset=f+(_*g+E*y)-_,c.yOffset=p+(_*m+E*v)-E):c.xOffset=c.yOffset=0,c.xOrigin=w,c.yOrigin=S,c.smooth=!!i,c.origin=e,c.originIsAbsolute=!!r,t.style[ri]="0px 0px",n&&(yi(n,c,"xOrigin",d,w),yi(n,c,"yOrigin",h,S),yi(n,c,"xOffset",f,c.xOffset),yi(n,c,"yOffset",p,c.yOffset)),t.setAttribute("data-svg-origin",w+" "+S)},Pi=function(t,e){var r=t._gsap||new qe(t);if("x"in r&&!e&&!r.uncache)return r;var i,s,n,o,a,l,c,u,d,h,f,p,g,m,y,v,_,E,T,w,S,b,L,A,k,C,x,R,P,I,F,M,O=t.style,N=r.scaleX<0,B="px",U="deg",$=getComputedStyle(t),q=li(t,ri)||"0";return i=s=n=l=c=u=d=h=f=0,o=a=1,r.svg=!(!t.getCTM||!gi(t)),$.translate&&("none"===$.translate&&"none"===$.scale&&"none"===$.rotate||(O[ei]=("none"!==$.translate?"translate3d("+($.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+("none"!==$.rotate?"rotate("+$.rotate+") ":"")+("none"!==$.scale?"scale("+$.scale.split(" ").join(",")+") ":"")+$[ei]),O.scale=O.rotate=O.translate="none"),m=xi(t,r.svg),r.svg&&(A=(!r.uncache||"0px 0px"===q)&&!e&&t.getAttribute("data-svg-origin"),Ri(t,A||q,!!A||r.originIsAbsolute,!1!==r.smooth,m)),p=r.xOrigin||0,g=r.yOrigin||0,m!==Li&&(E=m[0],T=m[1],w=m[2],S=m[3],i=b=m[4],s=L=m[5],6===m.length?(o=Math.sqrt(E*E+T*T),a=Math.sqrt(S*S+w*w),l=E||T?Br(T,E)*Or:0,(d=w||S?Br(w,S)*Or+l:0)&&(a*=Math.abs(Math.cos(d*Nr))),r.svg&&(i-=p-(p*E+g*w),s-=g-(p*T+g*S))):(M=m[6],I=m[7],x=m[8],R=m[9],P=m[10],F=m[11],i=m[12],s=m[13],n=m[14],c=(y=Br(M,P))*Or,y&&(A=b*(v=Math.cos(-y))+x*(_=Math.sin(-y)),k=L*v+R*_,C=M*v+P*_,x=b*-_+x*v,R=L*-_+R*v,P=M*-_+P*v,F=I*-_+F*v,b=A,L=k,M=C),u=(y=Br(-w,P))*Or,y&&(v=Math.cos(-y),F=S*(_=Math.sin(-y))+F*v,E=A=E*v-x*_,T=k=T*v-R*_,w=C=w*v-P*_),l=(y=Br(T,E))*Or,y&&(A=E*(v=Math.cos(y))+T*(_=Math.sin(y)),k=b*v+L*_,T=T*v-E*_,L=L*v-b*_,E=A,b=k),c&&Math.abs(c)+Math.abs(l)>359.9&&(c=l=0,u=180-u),o=_t(Math.sqrt(E*E+T*T+w*w)),a=_t(Math.sqrt(L*L+M*M)),y=Br(b,L),d=Math.abs(y)>2e-4?y*Or:0,f=F?1/(F<0?-F:F):0),r.svg&&(A=t.getAttribute("transform"),r.forceCSS=t.setAttribute("transform","")||!ki(li(t,ei)),A&&t.setAttribute("transform",A))),Math.abs(d)>90&&Math.abs(d)<270&&(N?(o*=-1,d+=l<=0?180:-180,l+=l<=0?180:-180):(a*=-1,d+=d<=0?180:-180)),e=e||r.uncache,r.x=i-((r.xPercent=i&&(!e&&r.xPercent||(Math.round(t.offsetWidth/2)===Math.round(-i)?-50:0)))?t.offsetWidth*r.xPercent/100:0)+B,r.y=s-((r.yPercent=s&&(!e&&r.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-s)?-50:0)))?t.offsetHeight*r.yPercent/100:0)+B,r.z=n+B,r.scaleX=_t(o),r.scaleY=_t(a),r.rotation=_t(l)+U,r.rotationX=_t(c)+U,r.rotationY=_t(u)+U,r.skewX=d+U,r.skewY=h+U,r.transformPerspective=f+B,(r.zOrigin=parseFloat(q.split(" ")[2])||0)&&(O[ri]=Ii(q)),r.xOffset=r.yOffset=0,r.force3D=D.force3D,r.renderTransform=r.svg?$i:Fr?Ui:Mi,r.uncache=0,r},Ii=function(t){return(t=t.split(" "))[0]+" "+t[1]},Fi=function(t,e,r){var i=re(e);return _t(parseFloat(e)+parseFloat(Ei(t,"x",r+"px",i)))+i},Mi=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,Ui(t,e)},Oi="0deg",Ni="0px",Bi=") ",Ui=function(t,e){var r=e||this,i=r.xPercent,s=r.yPercent,n=r.x,o=r.y,a=r.z,l=r.rotation,c=r.rotationY,u=r.rotationX,d=r.skewX,h=r.skewY,f=r.scaleX,p=r.scaleY,g=r.transformPerspective,m=r.force3D,y=r.target,v=r.zOrigin,_="",E="auto"===m&&t&&1!==t||!0===m;if(v&&(u!==Oi||c!==Oi)){var T,w=parseFloat(c)*Nr,S=Math.sin(w),b=Math.cos(w);w=parseFloat(u)*Nr,T=Math.cos(w),n=Fi(y,n,S*T*-v),o=Fi(y,o,-Math.sin(w)*-v),a=Fi(y,a,b*T*-v+v)}g!==Ni&&(_+="perspective("+g+Bi),(i||s)&&(_+="translate("+i+"%, "+s+"%) "),(E||n!==Ni||o!==Ni||a!==Ni)&&(_+=a!==Ni||E?"translate3d("+n+", "+o+", "+a+") ":"translate("+n+", "+o+Bi),l!==Oi&&(_+="rotate("+l+Bi),c!==Oi&&(_+="rotateY("+c+Bi),u!==Oi&&(_+="rotateX("+u+Bi),d===Oi&&h===Oi||(_+="skew("+d+", "+h+Bi),1===f&&1===p||(_+="scale("+f+", "+p+Bi),y.style[ei]=_||"translate(0, 0)"},$i=function(t,e){var r,i,s,n,o,a=e||this,l=a.xPercent,c=a.yPercent,u=a.x,d=a.y,h=a.rotation,f=a.skewX,p=a.skewY,g=a.scaleX,m=a.scaleY,y=a.target,v=a.xOrigin,_=a.yOrigin,E=a.xOffset,T=a.yOffset,w=a.forceCSS,S=parseFloat(u),b=parseFloat(d);h=parseFloat(h),f=parseFloat(f),(p=parseFloat(p))&&(f+=p=parseFloat(p),h+=p),h||f?(h*=Nr,f*=Nr,r=Math.cos(h)*g,i=Math.sin(h)*g,s=Math.sin(h-f)*-m,n=Math.cos(h-f)*m,f&&(p*=Nr,o=Math.tan(f-p),s*=o=Math.sqrt(1+o*o),n*=o,p&&(o=Math.tan(p),r*=o=Math.sqrt(1+o*o),i*=o)),r=_t(r),i=_t(i),s=_t(s),n=_t(n)):(r=g,n=m,i=s=0),(S&&!~(u+"").indexOf("px")||b&&!~(d+"").indexOf("px"))&&(S=Ei(y,"x",u,"px"),b=Ei(y,"y",d,"px")),(v||_||E||T)&&(S=_t(S+v-(v*r+_*s)+E),b=_t(b+_-(v*i+_*n)+T)),(l||c)&&(o=y.getBBox(),S=_t(S+l/100*o.width),b=_t(b+c/100*o.height)),o="matrix("+r+","+i+","+s+","+n+","+S+","+b+")",y.setAttribute("transform",o),w&&(y.style[ei]=o)},qi=function(t,e,r,i,s){var n,o,a=360,l=M(s),c=parseFloat(s)*(l&&~s.indexOf("rad")?Or:1)-i,u=i+c+"deg";return l&&("short"===(n=s.split("_")[1])&&(c%=a)!==c%180&&(c+=c<0?a:-360),"cw"===n&&c<0?c=(c+36e9)%a-~~(c/a)*a:"ccw"===n&&c>0&&(c=(c-36e9)%a-~~(c/a)*a)),t._pt=o=new pr(t._pt,e,r,i,c,Vr),o.e=u,o.u="deg",t._props.push(r),o},Gi=function(t,e){for(var r in e)t[r]=e[r];return t},Hi=function(t,e,r){var i,s,n,o,a,l,c,u=Gi({},r._gsap),d=r.style;for(s in u.svg?(n=r.getAttribute("transform"),r.setAttribute("transform",""),d[ei]=e,i=Pi(r,1),mi(r,ei),r.setAttribute("transform",n)):(n=getComputedStyle(r)[ei],d[ei]=e,i=Pi(r,1),d[ei]=n),Mr)(n=u[s])!==(o=i[s])&&"perspective,force3D,transformOrigin,svgOrigin".indexOf(s)<0&&(a=re(n)!==(c=re(o))?Ei(r,s,n,c):parseFloat(n),l=parseFloat(o),t._pt=new pr(t._pt,i,s,a,l-a,Hr),t._pt.u=c||0,t._props.push(s));Gi(i,u)};vt("padding,margin,Width,Radius",(function(t,e){var r="Top",i="Right",s="Bottom",n="Left",o=(e<3?[r,i,s,n]:[r+n,r+i,s+i,s+n]).map((function(r){return e<2?t+r:"border"+r+t}));Di[e>1?"border"+t:t]=function(t,e,r,i,s){var n,a;if(arguments.length<4)return n=o.map((function(e){return Ti(t,e,r)})),5===(a=n.join(" ")).split(n[0]).length?n[0]:a;n=(i+"").split(" "),a={},o.forEach((function(t,e){return a[t]=n[e]=n[e]||n[(e-1)/2|0]})),t.init(e,a,s)}}));var Vi,Ki,Wi,zi={name:"css",register:di,targetTest:function(t){return t.style&&t.nodeType},init:function(t,e,r,i,s){var n,o,a,l,c,u,d,h,f,p,g,m,y,v,_,E,T,w,S,b,L=this._props,A=t.style,k=r.vars.startAt;for(d in xr||di(),this.styles=this.styles||oi(t),E=this.styles.props,this.tween=r,e)if("autoRound"!==d&&(o=e[d],!ut[d]||!je(d,e,r,i,t,s)))if(c=typeof o,u=Di[d],"function"===c&&(c=typeof(o=o.call(r,i,t,s))),"string"===c&&~o.indexOf("random(")&&(o=pe(o)),u)u(this,t,d,o,r)&&(_=1);else if("--"===d.substr(0,2))n=(getComputedStyle(t).getPropertyValue(d)+"").trim(),o+="",De.lastIndex=0,De.test(n)||(h=re(n),f=re(o)),f?h!==f&&(n=Ei(t,d,n,f)+f):h&&(o+=h),this.add(A,"setProperty",n,o,i,s,0,0,d),L.push(d),E.push(d,A[d]);else if("undefined"!==c){if(k&&d in k?(n="function"==typeof k[d]?k[d].call(r,i,t,s):k[d],M(n)&&~n.indexOf("random(")&&(n=pe(n)),re(n+"")||(n+=D.units[d]||re(Ti(t,d))||""),"="===(n+"").charAt(1)&&(n=Ti(t,d))):n=Ti(t,d),l=parseFloat(n),(p="string"===c&&"="===o.charAt(1)&&o.substr(0,2))&&(o=o.substr(2)),a=parseFloat(o),d in Gr&&("autoAlpha"===d&&(1===l&&"hidden"===Ti(t,"visibility")&&a&&(l=0),E.push("visibility",A.visibility),yi(this,A,"visibility",l?"inherit":"hidden",a?"inherit":"hidden",!a)),"scale"!==d&&"transform"!==d&&~(d=Gr[d]).indexOf(",")&&(d=d.split(",")[0])),g=d in Mr)if(this.styles.save(d),m||((y=t._gsap).renderTransform&&!e.parseTransform||Pi(t,e.parseTransform),v=!1!==e.smoothOrigin&&y.smooth,(m=this._pt=new pr(this._pt,A,ei,0,1,y.renderTransform,y,0,-1)).dep=1),"scale"===d)this._pt=new pr(this._pt,y,"scaleY",y.scaleY,(p?Tt(y.scaleY,p+a):a)-y.scaleY||0,Hr),this._pt.u=0,L.push("scaleY",d),d+="X";else{if("transformOrigin"===d){E.push(ri,A[ri]),w=void 0,S=void 0,b=void 0,w=(T=o).split(" "),S=w[0],b=w[1]||"50%","top"!==S&&"bottom"!==S&&"left"!==b&&"right"!==b||(T=S,S=b,b=T),w[0]=Si[S]||S,w[1]=Si[b]||b,o=w.join(" "),y.svg?Ri(t,o,0,v,0,this):((f=parseFloat(o.split(" ")[2])||0)!==y.zOrigin&&yi(this,y,"zOrigin",y.zOrigin,f),yi(this,A,d,Ii(n),Ii(o)));continue}if("svgOrigin"===d){Ri(t,o,1,v,0,this);continue}if(d in Ai){qi(this,y,d,l,p?Tt(l,p+o):o);continue}if("smoothOrigin"===d){yi(this,y,"smooth",y.smooth,o);continue}if("force3D"===d){y[d]=o;continue}if("transform"===d){Hi(this,o,t);continue}}else d in A||(d=ui(d)||d);if(g||(a||0===a)&&(l||0===l)&&!qr.test(o)&&d in A)a||(a=0),(h=(n+"").substr((l+"").length))!==(f=re(o)||(d in D.units?D.units[d]:h))&&(l=Ei(t,d,n,f)),this._pt=new pr(this._pt,g?y:A,d,l,(p?Tt(l,p+a):a)-l,g||"px"!==f&&"zIndex"!==d||!1===e.autoRound?Hr:Wr),this._pt.u=f||0,h!==f&&"%"!==f&&(this._pt.b=n,this._pt.r=Kr);else if(d in A)wi.call(this,t,d,n,p?p+o:o);else{if(!(d in t)){et(d,o);continue}this.add(t,d,n||t[d],p?p+o:o,i,s)}g||E.push(d,A[d]),L.push(d)}_&&fr(this)},render:function(t,e){if(e.tween._time||!Ir())for(var r=e._pt;r;)r.r(t,r.d),r=r._next;else e.styles.revert()},get:Ti,aliases:Gr,getSetter:function(t,e,r){var i=Gr[e];return i&&i.indexOf(",")<0&&(e=i),e in Mr&&e!==ri&&(t._gsap.x||Ti(t,"x"))?r&&Pr===r?"scale"===e?Zr:Qr:(Pr=r||{})&&("scale"===e?Jr:ti):t.style&&!B(t.style[e])?Yr:~e.indexOf("-")?Xr:nr(t,e)},core:{_removeProperty:mi,_getMatrix:xi}};Lr.utils.checkPrefix=ui,Lr.core.getStyleSaver=oi,Wi=vt((Vi="x,y,z,scale,scaleX,scaleY,xPercent,yPercent")+","+(Ki="rotation,rotationX,rotationY,skewX,skewY")+",transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective",(function(t){Mr[t]=1})),vt(Ki,(function(t){D.units[t]="deg",Ai[t]=1})),Gr[Wi[13]]=Vi+","+Ki,vt("0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY",(function(t){var e=t.split(":");Gr[e[1]]=Wi[e[0]]})),vt("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",(function(t){D.units[t]="px"})),Lr.registerPlugin(zi);var ji,Yi,Xi,Qi,Zi,Ji,ts,es,rs=Lr.registerPlugin(zi)||Lr,is=(rs.core.Tween,function(){return"undefined"!=typeof window}),ss=function(){return ji||is()&&(ji=window.gsap)&&ji.registerPlugin&&ji},ns=/[-+=\.]*\d+[\.e\-\+]*\d*[e\-\+]*\d*/gi,os={rect:["width","height"],circle:["r","r"],ellipse:["rx","ry"],line:["x2","y2"]},as=function(t){return Math.round(1e4*t)/1e4},ls=function(t){return parseFloat(t)||0},cs=function(t,e){var r=ls(t);return~t.indexOf("%")?r/100*e:r},us=function(t,e){return ls(t.getAttribute(e))},ds=Math.sqrt,hs=function(t,e,r,i,s,n){return ds(Math.pow((ls(r)-ls(t))*s,2)+Math.pow((ls(i)-ls(e))*n,2))},fs=function(t){return console.warn(t)},ps=function(t){return"non-scaling-stroke"===t.getAttribute("vector-effect")},gs=function(t){if(!(t=Yi(t)[0]))return 0;var e,r,i,s,n,o,a,l=t.tagName.toLowerCase(),c=t.style,u=1,d=1;ps(t)&&(d=t.getScreenCTM(),u=ds(d.a*d.a+d.b*d.b),d=ds(d.d*d.d+d.c*d.c));try{r=t.getBBox()}catch(t){fs("Some browsers won't measure invisible elements (like display:none or masks inside defs).")}var h=r||{x:0,y:0,width:0,height:0},f=h.x,p=h.y,g=h.width,m=h.height;if(r&&(g||m)||!os[l]||(g=us(t,os[l][0]),m=us(t,os[l][1]),"rect"!==l&&"line"!==l&&(g*=2,m*=2),"line"===l&&(f=us(t,"x1"),p=us(t,"y1"),g=Math.abs(g-f),m=Math.abs(m-p))),"path"===l)s=c.strokeDasharray,c.strokeDasharray="none",e=t.getTotalLength()||0,as(u)!==as(d)&&!Ji&&(Ji=1)&&fs("Warning: length cannot be measured when vector-effect is non-scaling-stroke and the element isn't proportionally scaled."),e*=(u+d)/2,c.strokeDasharray=s;else if("rect"===l)e=2*g*u+2*m*d;else if("line"===l)e=hs(f,p,f+g,p+m,u,d);else if("polyline"===l||"polygon"===l)for(i=t.getAttribute("points").match(ns)||[],"polygon"===l&&i.push(i[0],i[1]),e=0,n=2;ne&&(i=e),[-s||0,i-s||0]},ys=function(){is()&&(document,Xi=window,Zi=ji=ss(),Yi=ji.utils.toArray,ts=ji.core.getStyleSaver,es=ji.core.reverting||function(){},Qi=-1!==((Xi.navigator||{}).userAgent||"").indexOf("Edge"))},vs={version:"3.11.0",name:"drawSVG",register:function(t){ji=t,ys()},init:function(t,e,r,i,s){if(!t.getBBox)return!1;Zi||ys();var n,o,a,l=gs(t);return this.styles=ts&&ts(t,"strokeDashoffset,strokeDasharray,strokeMiterlimit"),this.tween=r,this._style=t.style,this._target=t,e+""=="true"?e="0 100%":e?-1===(e+"").indexOf(" ")&&(e="0 "+e):e="0 0",o=function(t,e,r){var i,s,n=t.indexOf(" ");return n<0?(i=void 0!==r?r+"":t,s=t):(i=t.substr(0,n),s=t.substr(n+1)),(i=cs(i,e))>(s=cs(s,e))?[s,i]:[i,s]}(e,l,(n=ms(t,l))[0]),this._length=as(l),this._dash=as(n[1]-n[0]),this._offset=as(-n[0]),this._dashPT=this.add(this,"_dash",this._dash,as(o[1]-o[0]),0,0,0,0,0,1),this._offsetPT=this.add(this,"_offset",this._offset,as(-o[0]),0,0,0,0,0,1),Qi&&(a=Xi.getComputedStyle(t)).strokeLinecap!==a.strokeLinejoin&&(o=ls(a.strokeMiterlimit),this.add(t.style,"strokeMiterlimit",o,o+.01)),this._live=ps(t)||~(e+"").indexOf("live"),this._nowrap=~(e+"").indexOf("nowrap"),this._props.push("drawSVG"),1},render:function(t,e){if(e.tween._time||!es()){var r,i,s,n,o=e._pt,a=e._style;if(o){for(e._live&&(r=gs(e._target))!==e._length&&(i=r/e._length,e._length=r,e._offsetPT&&(e._offsetPT.s*=i,e._offsetPT.c*=i),e._dashPT?(e._dashPT.s*=i,e._dashPT.c*=i):e._dash*=i);o;)o.r(t,o.d),o=o._next;s=e._dash||t&&1!==t&&1e-4||0,r=e._length-s+.1,n=e._offset,s&&n&&s+Math.abs(n%e._length)>e._length-.2&&(n+=n<0?.1:-.1)&&(r+=.1),a.strokeDashoffset=s?n:n+.001,a.strokeDasharray=r<.2?"none":s?s+"px,"+(e._nowrap?999999:r)+"px":"0px, 999999px"}}else e.styles.revert()},getLength:gs,getPosition:ms};ss()&&ji.registerPlugin(vs);var _s=/[achlmqstvz]|(-?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/gi,Es=/(?:(-)?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/gi,Ts=/[\+\-]?\d*\.?\d+e[\+\-]?\d+/gi,ws=/(^[#\.][a-z]|[a-y][a-z])/i,Ss=Math.PI/180,bs=180/Math.PI,Ds=Math.sin,Ls=Math.cos,As=Math.abs,ks=Math.sqrt,Cs=Math.atan2,xs=1e8,Rs=function(t){return"string"==typeof t},Ps=function(t){return"number"==typeof t},Is={},Fs={},Ms=1e5,Os=function(t){return Math.round((t+xs)%1*Ms)/Ms||(t<0?0:1)},Ns=function(t){return Math.round(t*Ms)/Ms||0},Bs=function(t){return Math.round(1e10*t)/1e10||0},Us=function(t,e,r,i){var s=t[e],n=1===i?6:Qs(s,r,i);if(n&&n+r+2e){for(;--s&&t[s]>e;);s<0&&(s=0)}else for(;t[++s] element or an SVG path data string")}function Vs(t){var e,r=0;for(t.reverse();r-1;)r=s[n].nodeName.toLowerCase(),e.indexOf(","+r+",")<0&&i.setAttributeNS(null,r,s[n].nodeValue);return i}(t,"x,y,width,height,cx,cy,rx,ry,r,x1,x2,y1,y2,points"),S=function(t,e){for(var r=e?e.split(","):[],i={},s=r.length;--s>-1;)i[r[s]]=+t.getAttribute(r[s])||0;return i}(t,Ks[b]),"rect"===b?(n=S.rx,o=S.ry||n,i=S.x,s=S.y,d=S.width-2*n,h=S.height-2*o,r=n||o?"M"+(y=(g=(p=i+n)+d)+n)+","+(_=s+o)+" V"+(E=_+h)+" C"+[y,T=E+o*D,m=g+n*D,w=E+o,g,w,g-(g-p)/3,w,p+(g-p)/3,w,p,w,f=i+n*(1-D),w,i,T,i,E,i,E-(E-_)/3,i,_+(E-_)/3,i,_,i,v=s+o*(1-D),f,s,p,s,p+(g-p)/3,s,g-(g-p)/3,s,g,s,m,s,y,v,y,_].join(",")+"z":"M"+(i+d)+","+s+" v"+h+" h"+-d+" v"+-h+" h"+d+"z"):"circle"===b||"ellipse"===b?("circle"===b?c=(n=o=S.r)*D:(n=S.rx,c=(o=S.ry)*D),r="M"+((i=S.cx)+n)+","+(s=S.cy)+" C"+[i+n,s+c,i+(l=n*D),s+o,i,s+o,i-l,s+o,i-n,s+c,i-n,s,i-n,s-c,i-l,s-o,i,s-o,i+l,s-o,i+n,s-c,i+n,s].join(",")+"z"):"line"===b?r="M"+S.x1+","+S.y1+" L"+S.x2+","+S.y2:"polyline"!==b&&"polygon"!==b||(r="M"+(i=(u=(t.getAttribute("points")+"").match(Es)||[]).shift())+","+(s=u.shift())+" L"+u.join(","),"polygon"===b&&(r+=","+i+","+s+"z")),a.setAttribute("d",on(a._gsRawPath=rn(r))),e&&t.parentNode&&(t.parentNode.insertBefore(a,t),t.parentNode.removeChild(t)),a):t}function zs(t,e,r){var i,s=t[e],n=t[e+2],o=t[e+4];return s+=(n-s)*r,s+=((n+=(o-n)*r)-s)*r,i=n+(o+(t[e+6]-o)*r-n)*r-s,s=t[e+1],s+=((n=t[e+3])-s)*r,s+=((n+=((o=t[e+5])-n)*r)-s)*r,Ns(Cs(n+(o+(t[e+7]-o)*r-n)*r-s,i)*bs)}function js(t,e,r){r=void 0===r?1:Bs(r)||0,e=Bs(e)||0;var i=Math.max(0,~~(As(r-e)-1e-8)),s=function(t){for(var e=[],r=0;rr&&(e=1-e,r=1-r,function(t,e){var r=t.length;for(e||t.reverse();r--;)t[r].reversed||Vs(t[r])}(s),s.totalLength=0),e<0||r<0){var n=Math.abs(~~Math.min(e,r))+1;e+=n,r+=n}s.totalLength||Xs(s);var o,a,l,c,u,d,h,f,p=r>1,g=Zs(s,e,Is,!0),m=Zs(s,r,Fs),y=m.segment,v=g.segment,_=m.segIndex,E=g.segIndex,T=m.i,w=g.i,S=E===_,b=T===w&&S;if(p||i){for(o=__)&&s.splice(c,1);else y.angle=zs(y,T+l,0),g=y[T+=l],m=y[T+1],y.length=y.totalLength=0,y.totalPoints=s.totalPoints=8,y.push(g,m,g,m,g,m,g,m);return s.totalLength=0,s}function Ys(t,e,r){e=e||0,t.samples||(t.samples=[],t.lookup=[]);var i,s,n,o,a,l,c,u,d,h,f,p,g,m,y,v,_,E=~~t.resolution||12,T=1/E,w=r?e+6*r+1:t.length,S=t[e],b=t[e+1],D=e?e/6*E:0,L=t.samples,A=t.lookup,k=(e?t.minLength:xs)||xs,C=L[D+r*E-1],x=e?L[D-1]:0;for(L.length=A.length=0,s=e+2;s8&&(t.splice(s,6),s-=6,w-=6);else for(i=1;i<=E;i++)l=c-(c=((m=T*i)*m*n+3*(g=1-m)*(m*o+g*a))*m),f=p-(p=(m*m*u+3*g*(m*d+g*h))*m),(v=ks(f*f+l*l))=1)return 0;var i=t[e],s=t[e+1],n=t[e+2],o=t[e+3],a=t[e+4],l=t[e+5],c=i+(n-i)*r,u=n+(a-n)*r,d=s+(o-s)*r,h=o+(l-o)*r,f=c+(u-c)*r,p=d+(h-d)*r,g=a+(t[e+6]-a)*r,m=l+(t[e+7]-l)*r;return u+=(g-u)*r,h+=(m-h)*r,t.splice(e+2,4,Ns(c),Ns(d),Ns(f),Ns(p),Ns(f+(u-f)*r),Ns(p+(h-p)*r),Ns(u),Ns(h),Ns(g),Ns(m)),t.samples&&t.samples.splice(e/6*t.resolution|0,0,0,0,0,0,0,0),6}function Zs(t,e,r,i){r=r||{},t.totalLength||Xs(t),(e<0||e>1)&&(e=Os(e));var s,n,o,a,l,c,u,d=0,h=t[0];if(e)if(1===e)u=1,c=(h=t[d=t.length-1]).length-8;else{if(t.length>1){for(o=t.totalLength*e,l=c=0;(l+=t[c++].totalLength)1)&&(e=Os(e)),t.length>1){for(o=t.totalLength*e,l=c=0;(l+=t[c++].totalLength)=1?1-1e-9:u||1e-9):f.angle||0),p}function tn(t,e,r,i,s,n,o){for(var a,l,c,u,d,h=t.length;--h>-1;)for(l=(a=t[h]).length,c=0;c1&&(r=ks(E)*r,i=ks(E)*i);var T=r*r,w=i*i,S=(T*w-T*_-w*v)/(T*_+w*v);S<0&&(S=0);var b=(n===o?-1:1)*ks(S),D=b*(r*y/i),L=b*(-i*m/r),A=(t+a)/2+(u*D-d*L),k=(e+l)/2+(d*D+u*L),C=(m-D)/r,x=(y-L)/i,R=(-m-D)/r,P=(-y-L)/i,I=C*C+x*x,F=(x<0?-1:1)*Math.acos(C/ks(I)),M=(C*P-x*R<0?-1:1)*Math.acos((C*R+x*P)/ks(I*(R*R+P*P)));isNaN(M)&&(M=h),!o&&M>0?M-=f:o&&M<0&&(M+=f),F%=f,M%=f;var O,N=Math.ceil(As(M)/(f/4)),B=[],U=M/N,$=4/3*Ds(U/2)/(1+Ls(U/2)),q=u*r,G=d*r,H=d*-i,V=u*i;for(O=0;O-1e-4?0:e})).match(_s)||[],y=[],v=0,_=0,E=2/3,T=m.length,w=0,S="ERROR: malformed path: "+t,b=function(t,e,r,i){u=(r-t)/3,d=(i-e)/3,a.push(t+u,e+d,r-u,i-d,r,i)};if(!t||!isNaN(m[0])||isNaN(m[1]))return console.log(S),y;for(e=0;e.5||As(_-s)>.5)&&(b(v,_,i,s),"L"===n&&(e+=2)),v=i,_=s;else if("A"===n){if(p=m[e+4],g=m[e+5],u=m[e+6],d=m[e+7],r=7,p.length>1&&(p.length<3?(d=u,u=g,r--):(d=g,u=p.substr(2),r-=2),g=p.charAt(1),p=p.charAt(0)),h=en(v,_,+m[e+1],+m[e+2],+m[e+3],+p,+g,(o?v:0)+1*u,(o?_:0)+1*d),e+=r,h)for(r=0;rn?n=e:ea?a=r:r-1;)for(r=(o=t[v]).length,n=6;n-1;)(i=((l=S*a)*l*p+3*(c=1-l)*(l*f+c*h))*l+u)>_?_=i:iT?T=s:s-1;)for(l=(i=t[c]).length,a=0;a.999999;)r=t[p-2],i=t[p-1],s=t[p],n=t[p+1],o=t[p+2],a=t[p+3],l=t[p+4],c=t[p+5],u=r+(s-r)*(g=1/((Math.floor(m)||1)+1)),u+=((h=s+(o-s)*g)-u)*g,h+=(o+(l-o)*g-h)*g,d=i+(n-i)*g,d+=((f=n+(a-n)*g)-d)*g,f+=(a+(c-a)*g-f)*g,t.splice(p,4,r+(s-r)*g,i+(n-i)*g,u,d,u+(h-u)*g,d+(f-d)*g,h,f,o+(l-o)*g,a+(c-a)*g),p+=6,y+=6,m--;return t},Bn=function(t,e,r,i,s){var n,o,a,l,c,u,d,h=e.length-t.length,f=h>0?e:t,p=h>0?t:e,g=0,m="complexity"===i?xn:Rn,y="position"===i?0:"number"==typeof i?i:.8,v=p.length,_="object"==typeof r&&r.push?r.slice(0):[r],E="reverse"===_[0]||_[0]<0,T="log"===r;if(p[0]){if(f.length>1&&(t.sort(m),e.sort(m),f.size||Cn(f),p.size||Cn(p),u=f.centerX-p.centerX,d=f.centerY-p.centerY,m===Rn))for(v=0;vp[0].length&&Nn(p[0],(f[0].length-p[0].length)/6|0),v=p.length;g0&&Nn(o,h/6|0),E&&!1!==s&&!o.reversed&&Vs(o),(r=_[v]||0===_[v]?_[v]:"auto")&&(o.closed||Math.abs(o[0]-o[o.length-2])<.5&&Math.abs(o[1]-o[o.length-1])<.5?"auto"===r||"log"===r?(_[v]=r=Fn(o,n,!v||!1===s),r<0&&(E=!0,Vs(o),r=-r),Pn(o,6*r)):"reverse"!==r&&(v&&r<0&&Vs(o),Pn(o,6*(r<0?-r:r))):!E&&("auto"===r&&Math.abs(n[0]-o[0])+Math.abs(n[1]-o[1])+Math.abs(n[n.length-2]-o[o.length-2])+Math.abs(n[n.length-1]-o[o.length-1])>Math.abs(n[0]-o[o.length-2])+Math.abs(n[1]-o[o.length-1])+Math.abs(n[n.length-2]-o[0])+Math.abs(n[n.length-1]-o[1])||r%2)?(Vs(o),_[v]=-1,E=!0):"auto"===r?_[v]=0:"reverse"===r&&(_[v]=-1),o.closed!==n.closed&&(o.closed=n.closed=!1));return T&&Ln("shapeIndex:["+_.join(",")+"]"),t.shapeIndex=_,_}},Un=function(t,e,r,i,s){var n=rn(t[0]),o=rn(t[1]);Bn(n,o,e||0===e?e:"auto",r,s)&&(t[0]=on(n),t[1]=on(o),"log"!==i&&!0!==i||Ln('precompile:["'+t[0]+'","'+t[1]+'"]'))},$n=function(t,e){var r,i,s,n,o,a,l,c=0,u=parseFloat(t[0]),d=parseFloat(t[1]),h=u+","+d+" ",f=.999999;for(r=.5*e/(.5*(s=t.length)-1),i=0;if)for(o=1/(Math.floor(c)+1),n=1;c>f;)h+=(u+(a-u)*o*n).toFixed(2)+","+(d+(l-d)*o*n).toFixed(2)+" ",c--,n++;h+=a+","+l+" ",u=a,d=l}return h},qn=function(t){var e=t[0].match(Sn)||[],r=t[1].match(Sn)||[],i=r.length-e.length;i>0?t[0]=$n(e,i):t[1]=$n(r,-i)},Gn=function(t){return isNaN(t)?qn:function(e){qn(e),e[1]=function(t,e){if(!e)return t;var r,i,s,n=t.match(Sn)||[],o=n.length,a="";for("reverse"===e?(i=o-1,r=-2):(i=(2*(parseInt(e,10)||0)+1+100*o)%o,r=2),s=0;s-1;){for(h=(i=t[p]).isSmooth=i.isSmooth||[0,0,0,0],f=i.smoothData=i.smoothData||[0,0,0,0],h.length=4,c=i.length-2,l=6;lTn?s:n,sl:d,cl:yn(c*c+u*u)-d,i:r}},zn=function(t){an=hn(),dn=dn||an&&an.plugins.morphSVG,an&&dn?(ln=an.utils.toArray,document,dn.prototype._tweenRotation=Wn,un=1):t&&Ln("Please gsap.registerPlugin(MorphSVGPlugin)")},jn={version:"3.11.0",name:"morphSVG",rawVars:1,register:function(t,e){an=t,dn=e,zn()},init:function(t,e,r,i,s){if(un||zn(1),!e)return Ln("invalid shape"),!1;var n,o,a,l,c,u,d,h,f,p,g,m,y,v,_,E,T,w,S,b,D,L;if(fn(e)&&(e=e.call(r,i,t,s)),"string"==typeof e||e.getBBox||e[0])e={shape:e};else if("object"==typeof e){for(o in n={},e)n[o]=fn(e[o])&&"render"!==o?e[o].call(r,i,t,s):e[o];e=n}var A=t.nodeType?window.getComputedStyle(t):{},k=A.fill+"",C=!("none"===k||"0"===(k.match(Sn)||[])[3]||"evenodd"===A.fillRule),x=(e.origin||"50 50").split(",");if(c="POLYLINE"===(n=(t.nodeName+"").toUpperCase())||"POLYGON"===n,"PATH"!==n&&!c&&!e.prop)return Ln("Cannot morph a <"+n+"> element. "+Kn),!1;if(o="PATH"===n?"d":"points",!e.prop&&!fn(t.setAttribute))return!1;if(l=function(t,e,r){var i,s;return(!("string"==typeof t)||bn.test(t)||(t.match(Sn)||[]).length<3)&&((i=ln(t)[0])?(s=(i.nodeName+"").toUpperCase(),e&&"PATH"!==s&&(i=Ws(i,!1),s="PATH"),t=i.getAttribute("PATH"===s?"d":"points")||"",i===r&&(t=i.getAttributeNS(null,"data-original")||t)):(Ln("WARNING: invalid morph to: "+t),t=!1)),t}(e.shape||e.d||e.points||"","d"===o,t),c&&Dn.test(l))return Ln("A <"+n+"> cannot accept path data. "+Kn),!1;if(u=e.shapeIndex||0===e.shapeIndex?e.shapeIndex:"auto",d=e.map||jn.defaultMap,this._prop=e.prop,this._render=e.render||jn.defaultRender,this._apply="updateTarget"in e?e.updateTarget:jn.defaultUpdateTarget,this._rnd=Math.pow(10,isNaN(e.precision)?2:+e.precision),this._tween=r,l){if(this._target=t,T="object"==typeof e.precompile,p=this._prop?t[this._prop]:t.getAttribute(o),this._prop||t.getAttributeNS(null,"data-original")||t.setAttributeNS(null,"data-original",p),"d"===o||this._prop){if(p=rn(T?e.precompile[0]:p),g=rn(T?e.precompile[1]:l),!T&&!Bn(p,g,u,d,C))return!1;for("log"!==e.precompile&&!0!==e.precompile||Ln('precompile:["'+on(p)+'","'+on(g)+'"]'),(D="linear"!==(e.type||jn.defaultType))&&(p=Hn(p,e.smoothTolerance),g=Hn(g,e.smoothTolerance),p.size||Cn(p),g.size||Cn(g),b=Vn(x[0]),this._origin=p.origin={x:p.left+b.x*p.width,y:p.top+b.y*p.height},x[1]&&(b=Vn(x[1])),this._eOrigin={x:g.left+b.x*g.width,y:g.top+b.y*g.height}),this._rawPath=t._gsRawPath=p,y=p.length;--y>-1;)for(_=p[y],E=g[y],h=_.isSmooth||[],f=E.isSmooth||[],v=_.length,cn=0,m=0;m1?function(t){for(var e=new vo,r=0;r4&&(n=s.offsetLeft,o=s.offsetTop,s=0);if("absolute"!==(a=Xn.getComputedStyle(t)).position&&"fixed"!==a.position)for(i=t.offsetParent;d&&d!==i;)n+=d.scrollLeft||0,o+=d.scrollTop||0,d=d.parentNode;(s=r.style).top=t.offsetTop-o+"px",s.left=t.offsetLeft-n+"px",s[so]=a[so],s[no]=a[no],s.position="fixed"===a.position?"fixed":"absolute",t.parentNode.appendChild(r)}return r},yo=function(t,e,r,i,s,n,o){return t.a=e,t.b=r,t.c=i,t.d=s,t.e=n,t.f=o,t},vo=function(){function t(t,e,r,i,s,n){void 0===t&&(t=1),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=1),void 0===s&&(s=0),void 0===n&&(n=0),yo(this,t,e,r,i,s,n)}var e=t.prototype;return e.inverse=function(){var t=this.a,e=this.b,r=this.c,i=this.d,s=this.e,n=this.f,o=t*i-e*r||1e-10;return yo(this,i/o,-e/o,-r/o,t/o,(r*n-i*s)/o,-(t*n-e*s)/o)},e.multiply=function(t){var e=this.a,r=this.b,i=this.c,s=this.d,n=this.e,o=this.f,a=t.a,l=t.c,c=t.b,u=t.d,d=t.e,h=t.f;return yo(this,a*e+c*i,a*r+c*s,l*e+u*i,l*r+u*s,n+d*e+h*i,o+d*r+h*s)},e.clone=function(){return new t(this.a,this.b,this.c,this.d,this.e,this.f)},e.equals=function(t){var e=this.a,r=this.b,i=this.c,s=this.d,n=this.e,o=this.f;return e===t.a&&r===t.b&&i===t.c&&s===t.d&&n===t.e&&o===t.f},e.apply=function(t,e){void 0===e&&(e={});var r=t.x,i=t.y,s=this.a,n=this.b,o=this.c,a=this.d,l=this.e,c=this.f;return e.x=r*s+i*o+l||0,e.y=r*n+i*a+c||0,e},t}();function _o(t,e,r,i){if(!t||!t.parentNode||(Yn||oo(t)).documentElement===t)return new vo;var s=function(t){for(var e,r;t&&t!==Zn;)(r=t._gsap)&&r.uncache&&r.get(t,"x"),r&&!r.scaleX&&!r.scaleY&&r.renderTransform&&(r.scaleX=r.scaleY=1e-4,r.renderTransform(1,r),e?e.push(r):e=[r]),t=t.parentNode;return e}(t),n=ho(t)?ao:lo,o=mo(t,r),a=n[0].getBoundingClientRect(),l=n[1].getBoundingClientRect(),c=n[2].getBoundingClientRect(),u=o.parentNode,d=!i&&fo(t),h=new vo((l.left-a.left)/100,(l.top-a.top)/100,(c.left-a.left)/100,(c.top-a.top)/100,a.left+(d?0:uo()),a.top+(d?0:co()));if(u.removeChild(o),s)for(a=s.length;a--;)(l=s[a]).scaleX=l.scaleY=0,l.renderTransform(1,l);return e?h.inverse():h}var Eo,To,wo,So,bo,Do,Lo="x,translateX,left,marginLeft,xPercent".split(","),Ao="y,translateY,top,marginTop,yPercent".split(","),ko=Math.PI/180,Co=function(t,e,r,i){for(var s=e.length,n=2===i?0:i,o=0;o1?t=1:t<0&&(t=0);i--;)Js(r[i],t,!i&&e.rotate,r[i]);for(;s;)s.set(s.t,s.p,s.path[s.pp]+s.u,s.d,t),s=s._next;e.rotate&&e.rSet(e.target,e.rProp,r[0].angle*(e.radians?ko:1)+e.rOffset+e.ru,e,t)}else e.styles.revert()},getLength:function(t){return Xs(Hs(t)).totalLength},sliceRawPath:js,getRawPath:Hs,pointsToSegment:nn,stringToRawPath:rn,rawPathToString:on,transformRawPath:tn,getGlobalMatrix:_o,getPositionOnPath:Js,cacheRawPathMeasurements:Xs,convertToPath:function(t,e){return So(t).map((function(t){return Ws(t,!1!==e)}))},convertCoordinates:function(t,e,r){var i=_o(e,!0,!0).multiply(_o(t));return r?i.apply(r):i},getAlignMatrix:Oo,getRelativePosition:function(t,e,r,i){var s=Oo(t,e,r,i);return{x:s.e,y:s.f}},arrayToRawPath:function(t,e){var r=Co(Co([],t,(e=e||{}).x||"x",0),t,e.y||"y",1);return e.relative&&Ro(r),["cubic"===e.type?r:nn(r,e.curviness)]}};function $o(t,e){for(var r=0;ra?(s=i,i=t,o=n,n=l):r?i+=t:i=s+(t-s)/(l-o)*(n-o)};return{update:c,reset:function(){s=i=r?0:i,o=n=0},getVelocity:function(t){var e=o,a=s,u=sa();return(t||0===t)&&t!==i&&c(t),n===o||u-o>l?0:(i+(r?a:-a))/((r?u:n)-e)*1e3}}},_a=function(t,e){return e&&!t._gsapAllow&&t.preventDefault(),t.changedTouches?t.changedTouches[0]:t},Ea=function(t){var e=Math.max.apply(Math,t),r=Math.min.apply(Math,t);return Math.abs(e)>=Math.abs(r)?e:r},Ta=function(){var t,e,r,i;(Yo=qo.core.globals().ScrollTrigger)&&Yo.core&&(t=Yo.core,e=t.bridge||{},r=t._scrollers,i=t._proxies,r.push.apply(r,ra),i.push.apply(i,ia),ra=r,ia=i,na=function(t,r){return e[t](r)})},wa=function(t){return(qo=t||Jo())&&"undefined"!=typeof document&&document.body&&(Ho=window,Vo=document,Ko=Vo.documentElement,Wo=Vo.body,Xo=[Ho,Vo,Ko,Wo],qo.utils.clamp,jo="onpointerenter"in Wo?"pointer":"mouse",zo=Sa.isTouch=Ho.matchMedia&&Ho.matchMedia("(hover: none), (pointer: coarse)").matches?1:"ontouchstart"in Ho||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0?2:0,Zo=Sa.eventTypes=("ontouchstart"in Ko?"touchstart,touchmove,touchcancel,touchend":"onpointerdown"in Ko?"pointerdown,pointermove,pointercancel,pointerup":"mousedown,mousemove,mouseup,mouseup").split(","),setTimeout((function(){return ta=0}),500),Ta(),Go=1),Go};pa.op=ga,ra.cache=0;var Sa=function(){function t(t){this.init(t)}var e,r,i;return t.prototype.init=function(t){Go||wa(qo)||console.warn("Please gsap.registerPlugin(Observer)"),Yo||Ta();var e=t.tolerance,r=t.dragMinimum,i=t.type,s=t.target,n=t.lineHeight,o=t.debounce,a=t.preventDefault,l=t.onStop,c=t.onStopDelay,u=t.ignore,d=t.wheelSpeed,h=t.event,f=t.onDragStart,p=t.onDragEnd,g=t.onDrag,m=t.onPress,y=t.onRelease,v=t.onRight,_=t.onLeft,E=t.onUp,T=t.onDown,w=t.onChangeX,S=t.onChangeY,b=t.onChange,D=t.onToggleX,L=t.onToggleY,A=t.onHover,k=t.onHoverEnd,C=t.onMove,x=t.ignoreCheck,R=t.isNormalizer,P=t.onGestureStart,I=t.onGestureEnd,F=t.onWheel,M=t.onEnable,O=t.onDisable,N=t.onClick,B=t.scrollSpeed,U=t.capture,$=t.allowClicks,q=t.lockAxis,G=t.onLockAxis;this.target=s=ma(s)||Ko,this.vars=t,u&&(u=qo.utils.toArray(u)),e=e||1e-9,r=r||0,d=d||1,B=B||1,i=i||"wheel,touch,pointer",o=!1!==o,n||(n=parseFloat(Ho.getComputedStyle(Wo).lineHeight)||22);var H,V,K,W,z,j,Y,X=this,Q=0,Z=0,J=ya(s,pa),tt=ya(s,ga),et=J(),rt=tt(),it=~i.indexOf("touch")&&!~i.indexOf("pointer")&&"pointerdown"===Zo[0],st=aa(s),nt=s.ownerDocument||Vo,ot=[0,0,0],at=[0,0,0],lt=0,ct=function(){return lt=sa()},ut=function(t,e){return(X.event=t)&&u&&~u.indexOf(t.target)||e&&it&&"touch"!==t.pointerType||x&&x(t,e)},dt=function(){var t=X.deltaX=Ea(ot),r=X.deltaY=Ea(at),i=Math.abs(t)>=e,s=Math.abs(r)>=e;b&&(i||s)&&b(X,t,r,ot,at),i&&(v&&X.deltaX>0&&v(X),_&&X.deltaX<0&&_(X),w&&w(X),D&&X.deltaX<0!=Q<0&&D(X),Q=X.deltaX,ot[0]=ot[1]=ot[2]=0),s&&(T&&X.deltaY>0&&T(X),E&&X.deltaY<0&&E(X),S&&S(X),L&&X.deltaY<0!=Z<0&&L(X),Z=X.deltaY,at[0]=at[1]=at[2]=0),(W||K)&&(C&&C(X),K&&(g(X),K=!1),W=!1),j&&!(j=!1)&&G&&G(X),z&&(F(X),z=!1),H=0},ht=function(t,e,r){ot[r]+=t,at[r]+=e,X._vx.update(t),X._vy.update(e),o?H||(H=requestAnimationFrame(dt)):dt()},ft=function(t,e){"y"!==Y&&(ot[2]+=t,X._vx.update(t,!0)),"x"!==Y&&(at[2]+=e,X._vy.update(e,!0)),q&&!Y&&(X.axis=Y=Math.abs(t)>Math.abs(e)?"x":"y",j=!0),o?H||(H=requestAnimationFrame(dt)):dt()},pt=function(t){if(!ut(t,1)){var e=(t=_a(t,a)).clientX,i=t.clientY,s=e-X.x,n=i-X.y,o=X.isDragging;X.x=e,X.y=i,(o||Math.abs(X.startX-e)>=r||Math.abs(X.startY-i)>=r)&&(g&&(K=!0),o||(X.isDragging=!0),ft(s,n),o||f&&f(X))}},gt=X.onPress=function(t){ut(t,1)||(X.axis=Y=null,V.pause(),X.isPressed=!0,t=_a(t),Q=Z=0,X.startX=X.x=t.clientX,X.startY=X.y=t.clientY,X._vx.reset(),X._vy.reset(),la(R?s:nt,Zo[1],pt,a,!0),X.deltaX=X.deltaY=0,m&&m(X))},mt=function(t){if(!ut(t,1)){ca(R?s:nt,Zo[1],pt,!0);var e=X.isDragging&&(Math.abs(X.x-X.startX)>3||Math.abs(X.y-X.startY)>3),r=_a(t);e||(X._vx.reset(),X._vy.reset(),a&&$&&qo.delayedCall(.08,(function(){if(sa()-lt>300&&!t.defaultPrevented)if(t.target.click)t.target.click();else if(nt.createEvent){var e=nt.createEvent("MouseEvents");e.initMouseEvent("click",!0,!0,Ho,1,r.screenX,r.screenY,r.clientX,r.clientY,!1,!1,!1,!1,0,null),t.target.dispatchEvent(e)}}))),X.isDragging=X.isGesturing=X.isPressed=!1,l&&!R&&V.restart(!0),p&&e&&p(X),y&&y(X,e)}},yt=function(t){return t.touches&&t.touches.length>1&&(X.isGesturing=!0)&&P(t,X.isDragging)},vt=function(){return(X.isGesturing=!1)||I(X)},_t=function(t){if(!ut(t)){var e=J(),r=tt();ht((e-et)*B,(r-rt)*B,1),et=e,rt=r,l&&V.restart(!0)}},Et=function(t){if(!ut(t)){t=_a(t,a),F&&(z=!0);var e=(1===t.deltaMode?n:2===t.deltaMode?Ho.innerHeight:1)*d;ht(t.deltaX*e,t.deltaY*e,0),l&&!R&&V.restart(!0)}},Tt=function(t){if(!ut(t)){var e=t.clientX,r=t.clientY,i=e-X.x,s=r-X.y;X.x=e,X.y=r,W=!0,(i||s)&&ft(i,s)}},wt=function(t){X.event=t,A(X)},St=function(t){X.event=t,k(X)},bt=function(t){return ut(t)||_a(t,a)&&N(X)};V=X._dc=qo.delayedCall(c||.25,(function(){X._vx.reset(),X._vy.reset(),V.pause(),l&&l(X)})).pause(),X.deltaX=X.deltaY=0,X._vx=va(0,50,!0),X._vy=va(0,50,!0),X.scrollX=J,X.scrollY=tt,X.isDragging=X.isGesturing=X.isPressed=!1,X.enable=function(t){return X.isEnabled||(la(st?nt:s,"scroll",ha),i.indexOf("scroll")>=0&&la(st?nt:s,"scroll",_t,a,U),i.indexOf("wheel")>=0&&la(s,"wheel",Et,a,U),(i.indexOf("touch")>=0&&zo||i.indexOf("pointer")>=0)&&(la(s,Zo[0],gt,a,U),la(nt,Zo[2],mt),la(nt,Zo[3],mt),$&&la(s,"click",ct,!1,!0),N&&la(s,"click",bt),P&&la(nt,"gesturestart",yt),I&&la(nt,"gestureend",vt),A&&la(s,jo+"enter",wt),k&&la(s,jo+"leave",St),C&&la(s,jo+"move",Tt)),X.isEnabled=!0,t&&t.type&>(t),M&&M(X)),X},X.disable=function(){X.isEnabled&&(ea.filter((function(t){return t!==X&&aa(t.target)})).length||ca(st?nt:s,"scroll",ha),X.isPressed&&(X._vx.reset(),X._vy.reset(),ca(R?s:nt,Zo[1],pt,!0)),ca(st?nt:s,"scroll",_t,U),ca(s,"wheel",Et,U),ca(s,Zo[0],gt,U),ca(nt,Zo[2],mt),ca(nt,Zo[3],mt),ca(s,"click",ct,!0),ca(s,"click",bt),ca(nt,"gesturestart",yt),ca(nt,"gestureend",vt),ca(s,jo+"enter",wt),ca(s,jo+"leave",St),ca(s,jo+"move",Tt),X.isEnabled=X.isPressed=X.isDragging=!1,O&&O(X))},X.kill=function(){X.disable();var t=ea.indexOf(X);t>=0&&ea.splice(t,1),Qo===X&&(Qo=0)},ea.push(X),R&&aa(s)&&(Qo=X),X.enable(h)},e=t,(r=[{key:"velocityX",get:function(){return this._vx.getVelocity()}},{key:"velocityY",get:function(){return this._vy.getVelocity()}}])&&$o(e.prototype,r),i&&$o(e,i),t}();Sa.version="3.11.0",Sa.create=function(t){return new Sa(t)},Sa.register=wa,Sa.getAll=function(){return ea.slice()},Sa.getById=function(t){return ea.filter((function(e){return e.vars.id===t}))[0]},Jo()&&qo.registerPlugin(Sa);var ba,Da,La,Aa,ka,Ca,xa,Ra,Pa,Ia,Fa,Ma,Oa,Na,Ba,Ua,$a,qa,Ga,Ha,Va,Ka,Wa,za,ja,Ya,Xa,Qa,Za,Ja,tl,el,rl=1,il=Date.now,sl=il(),nl=0,ol=0,al=function(){return Na=1},ll=function(){return Na=0},cl=function(t){return t},ul=function(t){return Math.round(1e5*t)/1e5||0},dl=function(){return"undefined"!=typeof window},hl=function(){return ba||dl()&&(ba=window.gsap)&&ba.registerPlugin&&ba},fl=function(t){return!!~xa.indexOf(t)},pl=function(t){return oa(t,"getBoundingClientRect")||(fl(t)?function(){return Dc.width=La.innerWidth,Dc.height=La.innerHeight,Dc}:function(){return $l(t)})},gl=function(t,e){var r=e.s,i=e.d2,s=e.d,n=e.a;return(r="scroll"+i)&&(n=oa(t,r))?n()-pl(t)()[s]:fl(t)?(ka[r]||Ca[r])-(La["inner"+i]||ka["client"+i]||Ca["client"+i]):t[r]-t["offset"+i]},ml=function(t,e){for(var r=0;r0){for(t-=s,n=0;n=t)return r[n];return r[n-1]}for(n=r.length,t+=s;n--;)if(r[n]<=t)return r[n];return r[0]}:function(r,i,s){void 0===s&&(s=.001);var n=e(r);return!i||Math.abs(n-r)r&&(i*=e/100),t=t.substr(0,r-1)),t=i+(t in Xl?Xl[t]*e:~t.indexOf("%")?parseFloat(t)*e/100:parseFloat(t)||0)}return t},Zl=function(t,e,r,i,s,n,o,a){var l=s.startColor,c=s.endColor,u=s.fontSize,d=s.indent,h=s.fontWeight,f=Aa.createElement("div"),p=fl(r)||"fixed"===oa(r,"pinType"),g=-1!==t.indexOf("scroller"),m=p?Ca:r,y=-1!==t.indexOf("start"),v=y?l:c,_="border-color:"+v+";font-size:"+u+";color:"+v+";font-weight:"+h+";pointer-events:none;white-space:nowrap;font-family:sans-serif,Arial;z-index:1000;padding:4px 8px;border-width:0;border-style:solid;";return _+="position:"+((g||a)&&p?"fixed;":"absolute;"),(g||a||!p)&&(_+=(i===ga?Dl:Ll)+":"+(n+parseFloat(d))+"px;"),o&&(_+="box-sizing:border-box;text-align:left;width:"+o.offsetWidth+"px;"),f._isStart=y,f.setAttribute("class","gsap-marker-"+t+(e?" marker-"+e:"")),f.style.cssText=_,f.innerText=e||0===e?t+"-"+e:t,m.children[0]?m.insertBefore(f,m.children[0]):m.appendChild(f),f._offset=f["offset"+i.op.d2],Jl(f,0,i,y),f},Jl=function(t,e,r,i){var s={display:"block"},n=r[i?"os2":"p2"],o=r[i?"p2":"os2"];t._isFlipped=i,s[r.a+"Percent"]=i?-100:0,s[r.a]=i?"1px":0,s["border"+n+Ml]=1,s["border"+o+Ml]=0,s[r.p]=e+"px",ba.set(t,s)},tc=[],ec={},rc=function(){return il()-nl>34&&vc()},ic=function(){(!Wa||!Wa.isPressed||Wa.startX>Ca.clientWidth)&&(ra.cache++,Ja||(Ja=requestAnimationFrame(vc)),nl||cc("scrollStart"),nl=il())},sc=function(){Ya=La.innerWidth,ja=La.innerHeight},nc=function(){ra.cache++,!Oa&&!Ka&&!Aa.fullscreenElement&&!Aa.webkitFullscreenElement&&(!za||Ya!==La.innerWidth||Math.abs(La.innerHeight-ja)>.25*La.innerHeight)&&Ra.restart(!0)},oc={},ac=[],lc=function t(){return Wl(xc,"scrollEnd",t)||gc(!0)},cc=function(t){return oc[t]&&oc[t].map((function(t){return t()}))||ac},uc=[],dc=function(t){for(var e=0;e=50,i=t&&tc[0].scroll();if(yc=mc>i?-1:1,mc=i,r&&(nl&&!Na&&e-nl>200&&(nl=0,cc("scrollEnd")),Fa=sl,sl=e),yc<0){for(Ua=t;Ua-- >0;)tc[Ua]&&tc[Ua].update(0,r);yc=1}else for(Ua=0;Ua20),r-=r-_}if(n){var w=t+r,S=n._isStart;f="scroll"+i.d2,Jl(n,w,i,S&&w>20||!S&&(u?Math.max(Ca[f],ka[f]):n.parentNode[f])<=w+1),u&&(l=$l(o),u&&(n.style[i.op.p]=l[i.op.p]-i.op.m-n._offset+Nl))}return h&&g&&(f=$l(g),h.seek(d),p=$l(g),h._caScrollDist=f[i.p]-p[i.p],t=t/h._caScrollDist*d),h&&h.seek(m),h?t:Math.round(t)},Ac=/(webkit|moz|length|cssText|inset)/i,kc=function(t,e,r,i){if(t.parentNode!==e){var s,n,o=t.style;if(e===Ca){for(s in t._stOrig=o.cssText,n=Bl(t))+s||Ac.test(s)||!n[s]||"string"!=typeof o[s]||"0"===s||(o[s]=n[s]);o.top=r,o.left=i}else o.cssText=t._stOrig;ba.core.getCache(t).uncache=1,e.appendChild(t)}},Cc=function(t,e){var r,i,s=ya(t,e),n="_scroll"+e.p2,o=function e(o,a,l,c,u){var d=e.tween,h=a.onComplete,f={};return l=l||s(),u=c&&u||0,c=c||o-l,d&&d.kill(),r=Math.round(l),a[n]=o,a.modifiers=f,f[n]=function(t){return(t=Math.round(s()))!==r&&t!==i&&Math.abs(t-r)>3&&Math.abs(t-i)>3?(d.kill(),e.tween=0):t=l+c*d.ratio+u*d.ratio*d.ratio,i=r,r=Math.round(t)},a.onComplete=function(){e.tween=0,h&&h.call(d)},d=e.tween=ba.to(t,a)};return t[n]=s,s.wheelHandler=function(){return o.tween&&o.tween.kill()&&(o.tween=0)},Kl(t,"wheel",s.wheelHandler),o},xc=function(){function t(e,r){Da||t.register(ba)||console.warn("Please gsap.registerPlugin(ScrollTrigger)"),this.init(e,r)}return t.prototype.init=function(e,r){if(this.progress=this.start=0,this.vars&&this.kill(!0,!0),ol){var i,s,n,o,a,l,c,u,d,h,f,p,g,m,y,v,_,E,T,w,S,b,D,L,A,k,C,x,R,P,I,F,M,O,N,B,U,$,q,G,H,V=e=Ul(yl(e)||_l(e)||e.nodeType?{trigger:e}:e,Yl),K=V.onUpdate,W=V.toggleClass,z=V.id,j=V.onToggle,Y=V.onRefresh,X=V.scrub,Q=V.trigger,Z=V.pin,J=V.pinSpacing,tt=V.invalidateOnRefresh,et=V.anticipatePin,rt=V.onScrubComplete,it=V.onSnapComplete,st=V.once,nt=V.snap,ot=V.pinReparent,at=V.pinSpacer,lt=V.containerAnimation,ct=V.fastScrollEnd,ut=V.preventOverlaps,dt=e.horizontal||e.containerAnimation&&!1!==e.horizontal?pa:ga,ht=!X&&0!==X,ft=ma(e.scroller||La),pt=ba.core.getCache(ft),gt=fl(ft),mt="fixed"===("pinType"in e?e.pinType:oa(ft,"pinType")||gt&&"fixed"),yt=[e.onEnter,e.onLeave,e.onEnterBack,e.onLeaveBack],vt=ht&&e.toggleActions.split(" "),_t="markers"in e?e.markers:Yl.markers,Et=gt?0:parseFloat(Bl(ft)["border"+dt.p2+Ml])||0,Tt=this,wt=e.onRefreshInit&&function(){return e.onRefreshInit(Tt)},St=function(t,e,r){var i=r.d,s=r.d2,n=r.a;return(n=oa(t,"getBoundingClientRect"))?function(){return n()[i]}:function(){return(e?La["inner"+s]:t["client"+s])||0}}(ft,gt,dt),bt=function(t,e){return!e||~ia.indexOf(t)?pl(t):function(){return Dc}}(ft,gt),Dt=0,Lt=0,At=ya(ft,dt);if(Qa(Tt),Tt._dir=dt,et*=45,Tt.scroller=ft,Tt.scroll=lt?lt.time.bind(lt):At,o=At(),Tt.vars=e,r=r||e.animation,"refreshPriority"in e&&(Ha=1,-9999===e.refreshPriority&&(el=Tt)),pt.tweenScroll=pt.tweenScroll||{top:Cc(ft,ga),left:Cc(ft,pa)},Tt.tweenTo=i=pt.tweenScroll[dt.p],Tt.scrubDuration=function(t){(I=_l(t)&&t)?P?P.duration(t):P=ba.to(r,{ease:"expo",totalProgress:"+=0.001",duration:I,paused:!0,onComplete:function(){return rt&&rt(Tt)}}):(P&&P.progress(1).kill(),P=0)},r&&(r.vars.lazy=!1,r._initted||!1!==r.vars.immediateRender&&!1!==e.immediateRender&&r.render(0,!0,!0),Tt.animation=r.pause(),r.scrollTrigger=Tt,Tt.scrubDuration(X),x=0,z||(z=r.vars.id)),tc.push(Tt),nt&&(El(nt)&&!nt.push||(nt={snapTo:nt}),"scrollBehavior"in Ca.style&&ba.set(gt?[Ca,ka]:ft,{scrollBehavior:"auto"}),n=vl(nt.snapTo)?nt.snapTo:"labels"===nt.snapTo?function(t){return function(e){return ba.utils.snap(Gl(t),e)}}(r):"labelsDirectional"===nt.snapTo?(q=r,function(t,e){return Hl(Gl(q))(t,e.direction)}):!1!==nt.directional?function(t,e){return Hl(nt.snapTo)(t,il()-Lt<500?0:e.direction)}:ba.utils.snap(nt.snapTo),F=nt.duration||{min:.1,max:2},F=El(F)?Ia(F.min,F.max):Ia(F,F),M=ba.delayedCall(nt.delay||I/2||.1,(function(){var t=At(),e=il()-Lt<500,s=i.tween;if(!(e||Math.abs(Tt.getVelocity())<10)||s||Na||Dt===t)Tt.isActive&&Dt!==t&&M.restart(!0);else{var o=(t-l)/g,a=r&&!ht?r.totalProgress():o,u=e?0:(a-R)/(il()-Fa)*1e3||0,d=ba.utils.clamp(-o,1-o,Sl(u/2)*u/.185),h=o+(!1===nt.inertia?0:d),f=Ia(0,1,n(h,Tt)),p=Math.round(l+f*g),m=nt,y=m.onStart,v=m.onInterrupt,_=m.onComplete;if(t<=c&&t>=l&&p!==t){if(s&&!s._initted&&s.data<=Sl(p-t))return;!1===nt.inertia&&(d=f-o),i(p,{duration:F(Sl(.185*Math.max(Sl(h-a),Sl(f-a))/u/.05||0)),ease:nt.ease||"power3",data:Sl(p-t),onInterrupt:function(){return M.restart(!0)&&v&&v(Tt)},onComplete:function(){Tt.update(),Dt=At(),x=R=r&&!ht?r.totalProgress():Tt.progress,it&&it(Tt),_&&_(Tt)}},t,d*g,p-t-d*g),y&&y(Tt,i.tween)}}})).pause()),z&&(ec[z]=Tt),($=(Q=Tt.trigger=ma(Q||Z))&&Q._gsap&&Q._gsap.stRevert)&&($=$(Tt)),Z=!0===Z?Q:ma(Z),yl(W)&&(W={targets:Q,className:W}),Z&&(!1===J||J===Fl||(J=!(!J&&"flex"===Bl(Z.parentNode).display)&&Il),Tt.pin=Z,!1!==e.force3D&&ba.set(Z,{force3D:!0}),(s=ba.core.getCache(Z)).spacer?m=s.pinState:(at&&((at=ma(at))&&!at.nodeType&&(at=at.current||at.nativeElement),s.spacerIsNative=!!at,at&&(s.spacerState=bc(at))),s.spacer=_=at||Aa.createElement("div"),_.classList.add("pin-spacer"),z&&_.classList.add("pin-spacer-"+z),s.pinState=m=bc(Z)),Tt.spacer=_=s.spacer,C=Bl(Z),D=C[J+dt.os2],T=ba.getProperty(Z),w=ba.quickSetter(Z,dt.a,Nl),Tc(Z,_,C),v=bc(Z)),_t){p=El(_t)?Ul(_t,jl):jl,h=Zl("scroller-start",z,ft,dt,p,0),f=Zl("scroller-end",z,ft,dt,p,0,h),E=h["offset"+dt.op.d2];var kt=ma(oa(ft,"content")||ft);u=this.markerStart=Zl("start",z,kt,dt,p,E,0,lt),d=this.markerEnd=Zl("end",z,kt,dt,p,E,0,lt),lt&&(U=ba.quickSetter([u,d],dt.a,Nl)),mt||ia.length&&!0===oa(ft,"fixedMarkers")||(H=Bl(G=gt?Ca:ft).position,G.style.position="absolute"===H||"fixed"===H?H:"relative",ba.set([h,f],{force3D:!0}),A=ba.quickSetter(h,dt.a,Nl),k=ba.quickSetter(f,dt.a,Nl))}if(lt){var Ct=lt.vars.onUpdate,xt=lt.vars.onUpdateParams;lt.eventCallback("onUpdate",(function(){Tt.update(0,0,1),Ct&&Ct.apply(xt||[])}))}Tt.previous=function(){return tc[tc.indexOf(Tt)-1]},Tt.next=function(){return tc[tc.indexOf(Tt)+1]},Tt.revert=function(t,e){if(!e)return Tt.kill(!0);var i=!1!==t||!Tt.enabled,s=Oa;i!==Tt.isReverted&&(i&&(Tt.scroll.rec||!Oa||!tl||(Tt.scroll.rec=At()),N=Math.max(At(),Tt.scroll.rec||0),O=Tt.progress,B=r&&r.progress()),u&&[u,d,h,f].forEach((function(t){return t.style.display=i?"none":"block"})),i&&(Oa=1),Tt.update(i),Oa=s,Z&&(i?function(t,e,r){Sc(r);var i=t._gsap;if(i.spacerIsNative)Sc(i.spacerState);else if(t._gsap.swappedIn){var s=e.parentNode;s&&(s.insertBefore(t,e),s.removeChild(e))}t._gsap.swappedIn=!1}(Z,_,m):(!ot||!Tt.isActive)&&Tc(Z,_,Bl(Z),L)),Tt.isReverted=i)},Tt.refresh=function(s,n){if(!Oa&&Tt.enabled||n)if(Z&&s&&nl)Kl(t,"scrollEnd",lc);else{!tl&&wt&&wt(Tt),Oa=1,Lt=il(),i.tween&&(i.tween.kill(),i.tween=0),P&&P.pause(),tt&&r&&r.revert().invalidate(),Tt.isReverted||Tt.revert(!0,!0);for(var p,E,w,D,A,k,C,x,R,I,F=St(),U=bt(),$=lt?lt.duration():gl(ft,dt),q=0,G=0,H=e.end,V=e.endTrigger||Q,K=e.start||(0!==e.start&&Q?Z?"0 0":"0 100%":0),W=Tt.pinnedContainer=e.pinnedContainer&&ma(e.pinnedContainer),z=Q&&Math.max(0,tc.indexOf(Tt))||0,j=z;j--;)(k=tc[j]).end||k.refresh(0,1)||(Oa=1),!(C=k.pin)||C!==Q&&C!==Z||k.isReverted||(I||(I=[]),I.unshift(k),k.revert(!0,!0)),k!==tc[j]&&(z--,j--);for(vl(K)&&(K=K(Tt)),l=Lc(K,Q,F,dt,At(),u,h,Tt,U,Et,mt,$,lt)||(Z?-.001:0),vl(H)&&(H=H(Tt)),yl(H)&&!H.indexOf("+=")&&(~H.indexOf(" ")?H=(yl(K)?K.split(" ")[0]:"")+H:(q=Ql(H.substr(2),F),H=yl(K)?K:l+q,V=Q)),c=Math.max(l,Lc(H||(V?"100% 0":$),V,F,dt,At()+q,d,f,Tt,U,Et,mt,$,lt))||-.001,g=c-l||(l-=.01)&&.001,q=0,j=z;j--;)(C=(k=tc[j]).pin)&&k.start-k._pinPush0&&(p=k.end-k.start,C!==Q&&C!==W||_l(K)||(q+=p*(1-k.progress)),C===Z&&(G+=p));if(l+=q,c+=q,Tt._pinPush=G,u&&q&&((p={})[dt.a]="+="+q,W&&(p[dt.p]="-="+At()),ba.set([u,d],p)),Z)p=Bl(Z),D=dt===ga,w=At(),S=parseFloat(T(dt.a))+G,!$&&c>1&&((gt?Ca:ft).style["overflow-"+dt.a]="scroll"),Tc(Z,_,p),v=bc(Z),E=$l(Z,!0),x=mt&&ya(ft,D?pa:ga)(),J&&((L=[J+dt.os2,g+G+Nl]).t=_,(j=J===Il?ql(Z,dt)+g+G:0)&&L.push(dt.d,j+Nl),Sc(L),mt&&At(N)),mt&&((A={top:E.top+(D?w-l:x)+Nl,left:E.left+(D?x:w-l)+Nl,boxSizing:"border-box",position:"fixed"})[Al]=A["max"+Ml]=Math.ceil(E.width)+Nl,A[kl]=A["max"+Ol]=Math.ceil(E.height)+Nl,A[Fl]=A[Fl+Rl]=A[Fl+Cl]=A[Fl+Pl]=A[Fl+xl]="0",A[Il]=p[Il],A[Il+Rl]=p[Il+Rl],A[Il+Cl]=p[Il+Cl],A[Il+Pl]=p[Il+Pl],A[Il+xl]=p[Il+xl],y=function(t,e,r){for(var i,s=[],n=t.length,o=r?8:0;o0?tc.slice(0,e).reverse():tc.slice(e+1);return(yl(t)?r.filter((function(e){return e.vars.preventOverlaps===t})):r).filter((function(t){return Tt.direction>0?t.end<=l:t.start>=c}))},Tt.update=function(t,e,s){if(!lt||s||t){var n,u,d,f,p,m,E,T=Tt.scroll(),L=t?0:(T-l)/g,C=L<0?0:L>1?1:L||0,I=Tt.progress;if(e&&(a=o,o=lt?At():T,nt&&(R=x,x=r&&!ht?r.totalProgress():C)),et&&!C&&Z&&!Oa&&!rl&&nl&&lI?1:-1,Tt.progress=C,f&&!Oa&&(u=C&&!I?0:1===C?1:1===I?2:3,ht&&(d=!p&&"none"!==vt[u+1]&&vt[u+1]||vt[u],E=r&&("complete"===d||"reset"===d||d in r))),ut&&(p||E)&&(E||X||!r)&&(vl(ut)?ut(Tt):Tt.getTrailing(ut).forEach((function(t){return t.endAnimation()}))),ht||(!P||Oa||rl?r&&r.totalProgress(C,!!Oa):((lt||el&&el!==Tt)&&P.render(P._dp._time-P._start),P.resetTo?P.resetTo("totalProgress",C,r._tTime/r._tDur):(P.vars.totalProgress=C,P.invalidate().restart()))),Z)if(t&&J&&(_.style[J+dt.os2]=D),mt){if(f){if(m=!t&&C>I&&c+1>T&&T+1>=gl(ft,dt),ot)if(t||!n&&!m)kc(Z,_);else{var F=$l(Z,!0),O=T-l;kc(Z,Ca,F.top+(dt===ga?O:0)+Nl,F.left+(dt===ga?0:O)+Nl)}Sc(n||m?y:v),b!==g&&C<1&&n||w(S+(1!==C||m?0:b))}}else w(ul(S+b*C));nt&&!i.tween&&!Oa&&!rl&&M.restart(!0),W&&(p||st&&C&&(C<1||!Za))&&Pa(W.targets).forEach((function(t){return t.classList[n||st?"add":"remove"](W.className)})),K&&!ht&&!t&&K(Tt),f&&!Oa?(ht&&(E&&("complete"===d?r.pause().totalProgress(1):"reset"===d?r.restart(!0).pause():"restart"===d?r.restart(!0):r[d]()),K&&K(Tt)),!p&&Za||(j&&p&&wl(Tt,j),yt[u]&&wl(Tt,yt[u]),st&&(1===C?Tt.kill(!1,1):yt[u]=0),p||yt[u=1===C?1:3]&&wl(Tt,yt[u])),ct&&!n&&Math.abs(Tt.getVelocity())>(_l(ct)?ct:2500)&&(Tl(Tt.callbackAnimation),P?P.progress(1):Tl(r,!C,1))):ht&&K&&!Oa&&K(Tt)}if(k){var N=lt?T/lt.duration()*(lt._caScrollDist||0):T;A(N+(h._isFlipped?1:0)),k(N)}U&&U(-T/lt.duration()*(lt._caScrollDist||0))}},Tt.enable=function(e,r){Tt.enabled||(Tt.enabled=!0,Kl(ft,"resize",nc),Kl(gt?Aa:ft,"scroll",ic),wt&&Kl(t,"refreshInit",wt),!1!==e&&(Tt.progress=O=0,o=a=Dt=At()),!1!==r&&Tt.refresh())},Tt.getTween=function(t){return t&&i?i.tween:P},Tt.setPositions=function(t,e){Z&&(S+=t-l,b+=e-t-g),Tt.start=l=t,Tt.end=c=e,g=e-t,Tt.update()},Tt.disable=function(e,r){if(Tt.enabled&&(!1!==e&&Tt.revert(!0,!0),Tt.enabled=Tt.isActive=!1,r||P&&P.pause(),N=0,s&&(s.uncache=1),wt&&Wl(t,"refreshInit",wt),M&&(M.pause(),i.tween&&i.tween.kill()&&(i.tween=0)),!gt)){for(var n=tc.length;n--;)if(tc[n].scroller===ft&&tc[n]!==Tt)return;Wl(ft,"resize",nc),Wl(ft,"scroll",ic)}},Tt.kill=function(t,i){Tt.disable(t,i),P&&!i&&P.kill(),z&&delete ec[z];var n=tc.indexOf(Tt);n>=0&&tc.splice(n,1),n===Ua&&yc>0&&Ua--,n=0,tc.forEach((function(t){return t.scroller===Tt.scroller&&(n=1)})),n||(Tt.scroll.rec=0),r&&(r.scrollTrigger=null,t&&r.render(-1),i||r.kill()),u&&[u,d,h,f].forEach((function(t){return t.parentNode&&t.parentNode.removeChild(t)})),el===Tt&&(el=0),Z&&(s&&(s.uncache=1),n=0,tc.forEach((function(t){return t.pin===Z&&n++})),n||(s.spacer=0)),e.onKill&&e.onKill(Tt)},Tt.enable(!1,!1),$&&$(Tt),r&&r.add&&!g?ba.delayedCall(.01,(function(){return l||c||Tt.refresh()}))&&(g=.01)&&(l=c=0):Tt.refresh()}else this.update=this.refresh=this.kill=cl},t.register=function(e){return Da||(ba=e||hl(),dl()&&window.document&&t.enable(),Da=ol),Da},t.defaults=function(t){if(t)for(var e in t)Yl[e]=t[e];return Yl},t.disable=function(t,e){ol=0,tc.forEach((function(r){return r[e?"kill":"disable"](t)})),Wl(La,"wheel",ic),Wl(Aa,"scroll",ic),clearInterval(Ma),Wl(Aa,"touchcancel",cl),Wl(Ca,"touchstart",cl),Vl(Wl,Aa,"pointerdown,touchstart,mousedown",al),Vl(Wl,Aa,"pointerup,touchend,mouseup",ll),Ra.kill(),ml(Wl);for(var r=0;r0&&i.left+s0&&i.top+s=0&&uc.splice(e,5),uc.push(t,t.style.cssText,t.getBBox&&t.getAttribute("transform"),ba.core.getCache(t),Qa())}})):uc},xc.revert=function(t,e){return hc(!t,e)},xc.create=function(t,e){return new xc(t,e)},xc.refresh=function(t){return t?nc():(Da||xc.register())&&gc(!0)},xc.update=vc,xc.clearScrollMemory=fc,xc.maxScroll=function(t,e){return gl(t,e?pa:ga)},xc.getScrollFunc=function(t,e){return ya(ma(t),e?pa:ga)},xc.getById=function(t){return ec[t]},xc.getAll=function(){return tc.filter((function(t){return"ScrollSmoother"!==t.vars.id}))},xc.isScrolling=function(){return!!nl},xc.snapDirectional=Hl,xc.addEventListener=function(t,e){var r=oc[t]||(oc[t]=[]);~r.indexOf(e)||r.push(e)},xc.removeEventListener=function(t,e){var r=oc[t],i=r&&r.indexOf(e);i>=0&&r.splice(i,1)},xc.batch=function(t,e){var r,i=[],s={},n=e.interval||.016,o=e.batchMax||1e9,a=function(t,e){var r=[],i=[],s=ba.delayedCall(n,(function(){e(r,i),r=[],i=[]})).pause();return function(t){r.length||s.restart(!0),r.push(t.trigger),i.push(t),o<=r.length&&s.progress(1)}};for(r in e)s[r]="on"===r.substr(0,2)&&vl(e[r])&&"onRefreshInit"!==r?a(0,e[r]):e[r];return vl(o)&&(o=o(),Kl(xc,"refresh",(function(){return o=e.batchMax()}))),Pa(t).forEach((function(t){var e={};for(r in s)e[r]=s[r];e.trigger=t,i.push(xc.create(e))})),i};var Rc,Pc=function(t,e,r,i){return e>i?t(i):e<0&&t(0),r>i?(i-e)/(r-e):r<0?e/(e-r):1},Ic=function t(e,r){!0===r?e.style.removeProperty("touch-action"):e.style.touchAction=!0===r?"auto":r?"pan-"+r+(Sa.isTouch?" pinch-zoom":""):"none",e===ka&&t(Ca,r)},Fc={auto:1,scroll:1},Mc=function(t){var e,r=t.event,i=t.target,s=t.axis,n=(r.changedTouches?r.changedTouches[0]:r).target,o=n._gsap||ba.core.getCache(n),a=il();if(!o._isScrollT||a-o._isScrollT>2e3){for(;n&&n.scrollHeight<=n.clientHeight;)n=n.parentNode;o._isScroll=n&&!fl(n)&&n!==i&&(Fc[(e=Bl(n)).overflowY]||Fc[e.overflowX]),o._isScrollT=a}(o._isScroll||"x"===s)&&(r.stopPropagation(),r._gsapAllow=!0)},Oc=function(t,e,r,i){return Sa.create({target:t,capture:!0,debounce:!1,lockAxis:!0,type:e,onWheel:i=i&&Mc,onPress:i,onDrag:i,onScroll:i,onEnable:function(){return r&&Kl(Aa,Sa.eventTypes[0],Bc,!1,!0)},onDisable:function(){return Wl(Aa,Sa.eventTypes[0],Bc,!0)}})},Nc=/(input|label|select|textarea)/i,Bc=function(t){var e=Nc.test(t.target.tagName);(e||Rc)&&(t._gsapAllow=!0,Rc=e)},Uc=function(t){El(t)||(t={}),t.preventDefault=t.isNormalizer=t.allowClicks=!0,t.type||(t.type="wheel,touch"),t.debounce=!!t.debounce,t.id=t.id||"normalizer";var e,r,i,s,n,o,a,l,c=t,u=c.normalizeScrollX,d=c.momentum,h=c.allowNestedScroll,f=ma(t.target)||ka,p=ba.core.globals().ScrollSmoother,g=p&&p.get(),m=Xa&&(t.content&&ma(t.content)||g&&!1!==t.content&&!g.smooth()&&g.content()),y=ya(f,ga),v=ya(f,pa),_=1,E=(Sa.isTouch&&La.visualViewport?La.visualViewport.scale*La.visualViewport.width:La.outerWidth)/La.innerWidth,T=0,w=vl(d)?function(){return d(e)}:function(){return d||2.8},S=Oc(f,t.type,!0,h),b=function(){return s=!1},D=cl,L=cl,A=function(){r=gl(f,ga),L=Ia(Xa?1:0,r),u&&(D=Ia(0,gl(f,pa))),i=pc},k=function(){m._gsap.y=ul(parseFloat(m._gsap.y)+y.offset)+"px",m.style.transform="matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, "+parseFloat(m._gsap.y)+", 0, 1)",y.offset=y.cacheID=0},C=function(){A(),n.isActive()&&n.vars.scrollY>r&&(y()>r?n.progress(1)&&y(r):n.resetTo("scrollY",r))};return m&&ba.set(m,{y:"+=0"}),t.ignoreCheck=function(t){return Xa&&"touchmove"===t.type&&function(){if(s){requestAnimationFrame(b);var t=ul(e.deltaY/2),r=L(y.v-t);if(m&&r!==y.v+y.offset){y.offset=r-y.v;var i=ul((parseFloat(m&&m._gsap.y)||0)-y.offset);m.style.transform="matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, "+i+", 0, 1)",m._gsap.y=i+"px",y.cacheID=ra.cache,vc()}return!0}y.offset&&k(),s=!0}()||_>1.05&&"touchstart"!==t.type||e.isGesturing||t.touches&&t.touches.length>1},t.onPress=function(){var t=_;_=ul((La.visualViewport&&La.visualViewport.scale||1)/E),n.pause(),t!==_&&Ic(f,_>1.01||!u&&"x"),o=v(),a=y(),A(),i=pc},t.onRelease=t.onGestureStart=function(t,e){if(y.offset&&k(),e){ra.cache++;var i,s,o=w();u&&(s=(i=v())+.05*o*-t.velocityX/.227,o*=Pc(v,i,s,gl(f,pa)),n.vars.scrollX=D(s)),s=(i=y())+.05*o*-t.velocityY/.227,o*=Pc(y,i,s,gl(f,ga)),n.vars.scrollY=L(s),n.invalidate().duration(o).play(.01),(Xa&&n.vars.scrollY>=r||i>=r-1)&&ba.to({},{onUpdate:C,duration:o})}else l.restart(!0)},t.onWheel=function(){n._ts&&n.pause(),il()-T>1e3&&(i=0,T=il())},t.onChange=function(t,e,r,s,n){if(pc!==i&&A(),e&&u&&v(D(s[2]===e?o+(t.startX-t.x):v()+e-s[1])),r){y.offset&&k();var l=n[2]===r,c=l?a+t.startY-t.y:y()+r-n[1],d=L(c);l&&c!==d&&(a+=d-c),y(d)}(r||e)&&vc()},t.onEnable=function(){Ic(f,!u&&"x"),Kl(La,"resize",C),S.enable()},t.onDisable=function(){Ic(f,!0),Wl(La,"resize",C),S.kill()},t.lockAxis=!1!==t.lockAxis,(e=new Sa(t)).iOS=Xa,Xa&&!y()&&y(1),Xa&&ba.ticker.add(cl),l=e._dc,n=ba.to(e,{ease:"power4",paused:!0,scrollX:u?"+=0.1":"+=0",scrollY:"+=0.1",onComplete:l.vars.onComplete}),e};xc.sort=function(t){return tc.sort(t||function(t,e){return-1e6*(t.vars.refreshPriority||0)+t.start-(e.start+-1e6*(e.vars.refreshPriority||0))})},xc.observe=function(t){return new Sa(t)},xc.normalizeScroll=function(t){if(void 0===t)return Wa;if(!0===t&&Wa)return Wa.enable();if(!1===t)return Wa&&Wa.kill();var e=t instanceof Sa?t:Uc(t);return Wa&&Wa.target===e.target&&Wa.kill(),fl(e.target)&&(Wa=e),e},xc.core={_getVelocityProp:va,_inputObserver:Oc,_scrollers:ra,_proxies:ia,bridge:{ss:function(){nl||cc("scrollStart"),nl=il()},ref:function(){return Oa}}},hl()&&ba.registerPlugin(xc);var $c=/([\uD800-\uDBFF][\uDC00-\uDFFF](?:[\u200D\uFE0F][\uD800-\uDBFF][\uDC00-\uDFFF]){2,}|\uD83D\uDC69(?:\u200D(?:(?:\uD83D\uDC69\u200D)?\uD83D\uDC67|(?:\uD83D\uDC69\u200D)?\uD83D\uDC66)|\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D(?:\uD83D\uDC69\u200D)?\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D(?:\uD83D\uDC69\u200D)?\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]\uFE0F|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC6F\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3C-\uDD3E\uDDD6-\uDDDF])\u200D[\u2640\u2642]\uFE0F|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F\u200D[\u2640\u2642]|(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642])\uFE0F|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]|\uD83D\uDC69\u200D[\u2695\u2696\u2708]|\uD83D\uDC68(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708]))\uFE0F|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83D\uDC69\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|\uD83D\uDC68(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC66\u200D\uD83D\uDC66|(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92])|(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]))|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDD1-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\u200D(?:(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC67|(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC66)|\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC69\uDC6E\uDC70-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD18-\uDD1C\uDD1E\uDD1F\uDD26\uDD30-\uDD39\uDD3D\uDD3E\uDDD1-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])?|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDEEB\uDEEC\uDEF4-\uDEF8]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD4C\uDD50-\uDD6B\uDD80-\uDD97\uDDC0\uDDD0-\uDDE6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u2660\u2663\u2665\u2666\u2668\u267B\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEF8]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD4C\uDD50-\uDD6B\uDD80-\uDD97\uDDC0\uDDD0-\uDDE6])\uFE0F)/;function qc(t){var e=t.nodeType,r="";if(1===e||9===e||11===e){if("string"==typeof t.textContent)return t.textContent;for(t=t.firstChild;t;t=t.nextSibling)r+=qc(t)}else if(3===e||4===e)return t.nodeValue;return r}var Gc,Hc,Vc,Kc=/(?:\r|\n|\t\t)/g,Wc=/(?:\s\s+)/g,zc=function(t){return Hc.getComputedStyle(t)},jc=Array.isArray,Yc=[].slice,Xc=function(t,e){var r;return jc(t)?t:"string"==(r=typeof t)&&!e&&t?Yc.call(Gc.querySelectorAll(t),0):t&&"object"===r&&"length"in t?Yc.call(t,0):t?[t]:[]},Qc=function(t){return"absolute"===t.position||!0===t.absolute},Zc=function(t,e){for(var r,i=e.length;--i>-1;)if(r=e[i],t.substr(0,r.length)===r)return r.length},Jc=function(t,e){void 0===t&&(t="");var r=~t.indexOf("++"),i=1;return r&&(t=t.split("++").join("")),function(){return"<"+e+" style='position:relative;display:inline-block;'"+(t?" class='"+t+(r?i++:"")+"'>":">")}},tu=function t(e,r,i){var s=e.nodeType;if(1===s||9===s||11===s)for(e=e.firstChild;e;e=e.nextSibling)t(e,r,i);else 3!==s&&4!==s||(e.nodeValue=e.nodeValue.split(r).join(i))},eu=function(t,e){for(var r=e.length;--r>-1;)t.push(e[r])},ru=function(t,e,r){for(var i;t&&t!==e;){if(i=t._next||t.nextSibling)return i.textContent.charAt(0)===r;t=t.parentNode||t._parent}},iu=function t(e){var r,i,s=Xc(e.childNodes),n=s.length;for(r=0;rL&&("BR"!==u.nodeName||0===a)&&(f=[],F.push(f),T=v),N&&(u._x=u.offsetLeft,u._y=v,u._w=u.offsetWidth,u._h=u.offsetHeight),F&&((u._isSplit&&h||!O&&h||M&&h||!M&&u.parentNode.parentNode===t&&!u.parentNode._isSplit)&&(f.push(u),u._x-=E,ru(u,t,R)&&(u._wordEnd=!0)),"BR"===u.nodeName&&(u.nextSibling&&"BR"===u.nextSibling.nodeName||0===a)&&F.push([])));for(a=0;a-1;)$[a].parentNode.removeChild($[a]);if(F){for(N&&(m=Gc.createElement(P),t.appendChild(m),y=m.offsetWidth+"px",v=m.offsetParent===t?0:t.offsetLeft,t.removeChild(m)),g=t.style.cssText,t.style.cssText="display:none;";t.firstChild;)t.removeChild(t.firstChild);for(p=" "===R&&(!N||!M&&!O),a=0;at.clientHeight&&(t.style.height=o-b+"px",t.clientHeightt.clientWidth&&(t.style.width=n-D+"px",t.clientWidth",v=1,_=e.specialChars?"function"==typeof e.specialChars?e.specialChars:Zc:null,E=Gc.createElement("div"),T=t.parentNode;for(T.insertBefore(E,t),E.textContent=t.nodeValue,T.removeChild(t),u=-1!==(s=qc(t=E)).indexOf("<"),!1!==e.reduceWhiteSpace&&(s=s.replace(Wc," ").replace(Kc,"")),u&&(s=s.split("<").join("{{LT}}")),l=s.length,n=(" "===s.charAt(0)?m:"")+r(),o=0;o":c,o+=d-1;else if(c===g&&s.charAt(o-1)!==g&&o){for(n+=v?y:"",v=0;s.charAt(o+1)===g;)n+=m,o++;o===l-1?n+=m:")"!==s.charAt(o+1)&&(n+=m+r(),v=1)}else"{"===c&&"{{LT}}"===s.substr(o,6)?(n+=f?i()+"{{LT}}":"{{LT}}",o+=5):c.charCodeAt(0)>=55296&&c.charCodeAt(0)<=56319||s.charCodeAt(o+1)>=65024&&s.charCodeAt(o+1)<=65039?(a=((s.substr(o,12).split($c)||[])[1]||"").length||2,n+=f&&" "!==c?i()+s.substr(o,a)+"":s.substr(o,a),o+=a-1):n+=f&&" "!==c?i()+c+"":c;t.outerHTML=n+(v?y:""),u&&tu(T,"{{LT}}","<")},au=function t(e,r,i,s){var n,o,a=Xc(e.childNodes),l=a.length,c=Qc(r);if(3!==e.nodeType||l>1){for(r.absolute=!1,n=0;n-1;)i=this.elements[s],this._originals[s]=i.innerHTML,e=i.clientHeight,r=i.clientWidth,au(i,t,o,a),nu(i,t,this.chars,this.words,this.lines,r,e);return this.chars.reverse(),this.words.reverse(),this.lines.reverse(),this.isSplit=!0,this},e.revert=function(){var t=this._originals;if(!t)throw"revert() call wasn't scoped properly.";return this.elements.forEach((function(e,r){return e.innerHTML=t[r]})),this.chars=[],this.words=[],this.lines=[],this.isSplit=!1,this},t.create=function(e,r){return new t(e,r)},t}();function cu(t){for(var e=1;e0){function t(t){const e=t.getBoundingClientRect();return e.top>=0&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth)}const e=rs.matchMedia();let r=!0;e.add("(min-width: 992px)",(()=>{r=!1}));const i=document.querySelector(".mcarousel"),s=document.querySelectorAll(".mcarousel--item"),n=document.querySelector(".mcarousel-index");let o=i.clientWidth,a=s[0].clientWidth,l=s.length*a,c=0,u=0,d=0,h=0;d={value:0};const f=(t,e,r)=>t*(1-r)+e*r,p=t=>{rs.set(s,{x:e=>e*a+t,modifiers:{x:(t,e)=>`${rs.utils.wrap(-a,l-a,parseInt(t))}px`}})};let g=0,m=0,y=!1;this.moved=!1;const v=t=>{g=t.clientX||t.touches[0].clientX,y=!0,i.classList.add("is-dragging"),rs.to(s,{scale:.9})},_=t=>{y?(this.moved=!0,m=t.clientX||t.touches[0].clientX,d.value+=2.5*(m-g),g=m):this.moved=!1},E=()=>{y=!1,i.classList.remove("is-dragging"),rs.to(s,{scale:1}),setTimeout((()=>{s.forEach((e=>{t(e)&&(n.innerHTML=e.dataset.item)}))}),100)};i.addEventListener("touchstart",v,{passive:!0}),i.addEventListener("touchmove",_,{passive:!0}),i.addEventListener("touchend",E),i.addEventListener("mousedown",v),i.addEventListener("mousemove",_),i.addEventListener("mouseleave",E),i.addEventListener("mouseup",E),i.addEventListener("selectstart",(()=>!1));let T=!1;document.querySelector(".mcarousel-next").addEventListener("click",(()=>{if(0==T){T=!0;let t=parseInt(n.innerHTML);s[t-1].getBoundingClientRect();t==s.length?t=1:t++;const e=s[0].clientWidth;rs.timeline({onComplete:()=>{T=!1}}).to(s,{scale:.9,duration:.4}).to(d,{value:"-="+e,duration:.8,ease:"power2.inOut"}).to(s,{scale:1,duration:.4}),n.innerHTML=t}})),document.querySelector(".mcarousel-prev").addEventListener("click",(()=>{if(0==T){T=!0;let t=parseInt(n.innerHTML);s[t-1].getBoundingClientRect();1==t?t=s.length:t--;const e=s[0].clientWidth;rs.timeline({onComplete:()=>{T=!1}}).to(s,{scale:.9,duration:.4}).to(d,{value:"+="+e,duration:.8,ease:"power2.inOut"}).to(s,{scale:1,duration:.4}),n.innerHTML=t}})),window.addEventListener("resize",(()=>{o=i.clientWidth,a=s[0].clientWidth,l=s.length*a}));const w=()=>{requestAnimationFrame(w),h=parseInt(f(h,d.value,.1)),p(h),c=h-u,u=h};w()}else this.moved=!1}}var hu=r(904),fu=r.n(hu);let pu=!1,gu=!1;var mu=()=>(pu||(gu=(()=>{const t=document.createElement("canvas");if(!t.toDataURL)return!1;t.width=1,t.height=1;try{return"image/webp"===t.toDataURL("image/webp").substring(5,15)}catch(t){return!1}})(),pu=!0),gu);let yu=!0;const vu=rs.matchMedia();let _u=!0;vu.add("(min-width: 992px)",(()=>{_u=!1}));class Eu extends c.Renderer{onEnter(){}onLeave(){}onEnterCompleted(){if(1==yu){const t=document.querySelector(".aas-detail__hero"),e=t.querySelector(".block-2__imagefull"),r=t.querySelector("span");rs.set(e,{scale:1.25,x:0,y:0,transformOrigin:"center"}),rs.set(r,{"--wPercent":"100%"});rs.timeline({onComplete:()=>{eT.start()}}).add("start").to(".header__logo",{opacity:1,duration:2,ease:"power2.inOut"},"start").to(".header__left-menu",{opacity:1,duration:2,ease:"power2.inOut"},"start").to(".header__right-menu",{opacity:1,duration:2,ease:"power2.inOut"},"start").to(e,{scale:1,duration:2,ease:"power2.inOut"},"start").to(r,{y:0,duration:2,ease:"power2.inOut"},"start"),rs.set(".header__logo",{left:0}),rs.to(".header__menu-toggle",{opacity:1,duration:2,ease:"power2.inOut"}),rs.set(".header__logo svg",{scale:1,y:0,x:()=>{if(_u)return 0}})}else{document.dispatchEvent(new Event("DOMContentLoadedCustom")),eT.start();const t=document.querySelector(".aas-detail__hero").querySelector("span");rs.set(t,{"--wPercent":"100%",y:0})}rs.set(".breadcrumb",{opacity:0}),rs.set(".aas-detail__hero-anchors a",{opacity:0}),rs.to(".site__wrap",{opacity:1,onComplete:()=>{rs.to(".breadcrumb",{opacity:1}),rs.to(".aas-detail__hero-anchors a",{opacity:1,stagger:{each:.1,from:"end"}})}});const t=new du;setTimeout((()=>{xc.create({trigger:".aas-detail__hero",start:"top top",pinSpacing:!1,pin:".aas-detail__hero",markers:!1,end:"+=100%",onUpdate:t=>{}}),rs.to(".hero__shadow--2",{background:"#000",scrollTrigger:{start:"top top",end:"+=100%",scrub:!0,onUpdate:()=>{}}}),rs.to(".block-2__title",{opacity:0,scrollTrigger:{start:"top top",end:"+=100%",scrub:!0,onUpdate:()=>{}}}),rs.to(".block-2__image-wrap",{scale:1.25,scrollTrigger:{start:"top top",end:"+=100%",scrub:!0}})}),250);document.querySelectorAll(".mcarousel--item div").forEach((e=>{const r=e.querySelector("a");e.addEventListener("click",(()=>{0==t.moved&&(async()=>{try{const t=await d()(r.href);if(t.status>=400)throw new Error("Bad response from server");const e=await t.text(),i=new DOMParser,s=i.parseFromString(e,"text/html").querySelector(".finiture");document.querySelector(".aas-detail__over-content").innerHTML="",document.querySelector(".aas-detail__over-content").append(s),document.body.classList.add("popup-opened"),document.querySelector(".header__menu-toggle").classList.add("hide"),document.querySelector(".header").classList.add("hide"),rs.to(".aas-detail__overBG",{opacity:.5,duration:1.5,onStart:()=>{rs.set(".aas-detail__overBG",{display:"block"})}}),rs.to(".aas-detail__over",{xPercent:0,x:0,duration:2,ease:"power2.inOut"}),s.querySelectorAll(".finiture__filter").forEach((t=>{t.addEventListener("click",(()=>{const e="."+t.dataset.filter;rs.to(".finiture__box",{opacity:0,duration:.75,stagger:{amount:.35,from:"random"},ease:"power2.inOut",onComplete:()=>{rs.set(".finiture__box",{display:"none"}),rs.set(e,{display:"block"}),rs.to(e,{opacity:1,duration:.5,stagger:{amount:.35,from:"random"},ease:"power2.inOut"})}})}))}));const n=rs.timeline({paused:!0});n.add("start").to(".gform-bg",{opacity:.5,duration:1.5,onStart:()=>{rs.set(".gform-bg",{display:"block"})},onReverseComplete:()=>{rs.set(".gform-bg",{display:"none"})}},"start").to(".gform-ct",{x:0,xPercent:0,duration:1.5,ease:"power2.inOut",onStart:()=>{rs.set(".gform-ct",{display:"block"})},onReverseComplete:()=>{rs.set(".gform-ct",{display:"none"})}},"start"),document.querySelectorAll(".finiture__filters-contact").forEach((t=>{t.addEventListener("click",(()=>{n.play()}))})),document.querySelector(".gform__close").addEventListener("click",(()=>{n.reverse()})),document.querySelector(".gform-bg")&&document.querySelector(".gform-bg").addEventListener("click",(()=>{n.reverse()}))}catch(t){console.error(t)}})()}))})),document.querySelector(".tutte-le-finiture").addEventListener("click",(()=>{eT.stop();const t=document.querySelector(".tutte-le-finiture").dataset.fetch;(async()=>{try{const e=await d()(t);if(e.status>=400)throw new Error("Bad response from server");const r=await e.text(),i=new DOMParser,s=i.parseFromString(r,"text/html").querySelector(".finiture");document.querySelector(".aas-detail__over-content").innerHTML="",document.querySelector(".aas-detail__over-content").append(s),document.body.classList.add("popup-opened"),document.querySelector(".header__menu-toggle").classList.add("hide"),document.querySelector(".header").classList.add("hide"),rs.to(".aas-detail__overBG",{opacity:.5,duration:1.5,onStart:()=>{rs.set(".aas-detail__overBG",{display:"block"})}}),rs.to(".aas-detail__over",{xPercent:0,x:0,duration:2,ease:"power2.inOut"}),s.querySelectorAll(".finiture__filter").forEach((t=>{t.addEventListener("click",(()=>{s.querySelectorAll(".finiture__filter").forEach((t=>{t.classList.remove("active")})),t.classList.add("active");const e="."+t.dataset.filter;rs.to(".mat-group",{opacity:0,duration:.75,ease:"power2.inOut",onComplete:()=>{rs.set(".mat-group",{display:"none"})}}),document.querySelectorAll(".mat-group").forEach((t=>{0==!t.querySelectorAll(e).length&&rs.to(t,{opacity:1,duration:.75,delay:.76,ease:"power2.inOut",onStart:()=>{rs.set(".finiture__box",{display:"none"}),rs.set(e,{display:"block"}),rs.set(t,{display:"flex"})}})}))}))}));const n=rs.timeline({paused:!0});n.add("start").to(".gform-bg",{opacity:.5,duration:1.5,onStart:()=>{rs.set(".gform-bg",{display:"block"})},onReverseComplete:()=>{rs.set(".gform-bg",{display:"none"})}},"start").to(".gform-ct",{x:0,xPercent:0,duration:1.5,ease:"power2.inOut",onStart:()=>{rs.set(".gform-ct",{display:"block"})},onReverseComplete:()=>{rs.set(".gform-ct",{display:"none"})}},"start"),document.querySelectorAll(".finiture__filters-contact").forEach((t=>{t.addEventListener("click",(()=>{n.play()}))})),document.querySelector(".gform__close").addEventListener("click",(()=>{n.reverse()})),document.querySelector(".gform-bg")&&document.querySelector(".gform-bg").addEventListener("click",(()=>{n.reverse()}))}catch(t){console.error(t)}})()})),document.querySelector(".aas-detail__over-close").addEventListener("click",(()=>{document.body.classList.remove("popup-opened"),eT.start(),rs.to(".aas-detail__over",{xPercent:100,duration:2,ease:"power2.inOut"}),rs.to(".aas-detail__overBG",{opacity:0,delay:.5,duration:1.5,onComplete:()=>{rs.set(".aas-detail__overBG",{display:"none"})}})}))}onLeaveCompleted(){}}rs.registerPlugin(lu,xc);const Tu=rs.matchMedia();let wu=!0;Tu.add("(min-width: 992px)",(()=>{wu=!1}));class Su extends c.Renderer{onEnter(){}onLeave(){}initTitles(){rs.set(".aas-hero__title",{opacity:1});const t=new lu(".aas-hero__title",{type:"lines",linesClass:"lineChild"}),e=new lu(".aas-hero__title",{type:"lines",linesClass:"lineParent"});rs.set(e.lines,{overflow:"hidden"}),rs.set(t.lines,{yPercent:100});rs.timeline({onComplete:()=>{eT.start()}}).add("start").to(".header__logo",{opacity:1,duration:2,ease:"power2.inOut"},"start").to(".header__left-menu",{opacity:1,duration:2,ease:"power2.inOut"},"start").to(".header__right-menu",{opacity:1,duration:2,ease:"power2.inOut"},"start").add("st2").to(t.lines,{yPercent:0,stagger:{each:.1}},"st2-=1").to(".aas-hero__c",{opacity:1,duration:2},"st2-=1")}onEnterCompleted(){rs.set(".aas-hero__title",{opacity:0}),1==yu?(rs.set(".header__logo",{left:0}),rs.to(".header__menu-toggle",{opacity:1,duration:2,ease:"power2.inOut"}),rs.to(".header__logo svg",{scale:1,y:0,x:()=>{if(wu)return 0},duration:2,ease:"power2.inOut"}),window.addEventListener("endloading",(()=>{this.initTitles()}))):(document.dispatchEvent(new Event("DOMContentLoadedCustom")),this.initTitles()),rs.to(".site__wrap",{opacity:1,duration:1}),rs.to(".aas-hero__bg",{yPercent:15,scrollTrigger:{trigger:".aas-hero",start:"top top",scrub:!0}}),document.querySelectorAll(".block-2__ico").forEach((t=>{const e=t.querySelector("span"),r=t.querySelector("img");rs.to(e,{yPercent:-50,y:0,opacity:1,scrollTrigger:{trigger:t,start:"top bottom",scrub:!0}}),rs.to(r,{scale:1.15,scrollTrigger:{trigger:t,start:"top bottom",scrub:!0}})})),document.querySelectorAll(".block-2").forEach((t=>{const e={trigger:t,start:"top center"},r=t.querySelector(".block-2__imagefull"),i=t.querySelector(".block-2__title span");rs.to(r,{opacity:1,scale:1,y:0,x:0,duration:1.5,scrollTrigger:e}),rs.to(i,{y:0,delay:.75,scrollTrigger:e,onComplete:()=>{t.querySelector(".block-2__image-ct").classList.add("ready")}})})),rs.utils.toArray(".block-2__imagefull").forEach((t=>{const e=t.dataset.fullsize,r=()=>{t.src=e};xc.create({trigger:t,start:"-100% bottom",onEnter:r,onEnterBack:r})})),rs.utils.toArray(".dolly-aa").forEach((t=>{rs.to(t,{scale:1.2,scrollTrigger:{trigger:t,markers:!1,start:"top bottom",scrub:!0}})}))}onLeaveCompleted(){}}var bu,Du,Lu,Au,ku,Cu,xu,Ru=1,Pu=function(t,e){return t.actions.forEach((function(t){return t.vars[e]&&t.vars[e](t)}))},Iu={},Fu=180/Math.PI,Mu=Math.PI/180,Ou={},Nu={},Bu={},Uu=function(t){return"string"==typeof t?t.split(" ").join("").split(","):t},$u=Uu("onStart,onUpdate,onComplete,onReverseComplete,onInterrupt"),qu=Uu("transform,transformOrigin,width,height,position,top,left,opacity,zIndex,maxWidth,maxHeight,minWidth,minHeight"),Gu=function(t){return bu(t)[0]||console.warn("Element not found:",t)},Hu=function(t){return Math.round(1e4*t)/1e4||0},Vu=function(t,e,r){return t.forEach((function(t){return t.classList[r](e)}))},Ku={zIndex:1,kill:1,simple:1,spin:1,clearProps:1,targets:1,toggleClass:1,onComplete:1,onUpdate:1,onInterrupt:1,onStart:1,delay:1,repeat:1,repeatDelay:1,yoyo:1,scale:1,fade:1,absolute:1,props:1,onEnter:1,onLeave:1,custom:1,paused:1,nested:1,prune:1,absoluteOnLeave:1},Wu={zIndex:1,simple:1,clearProps:1,scale:1,absolute:1,fitChild:1,getVars:1,props:1},zu=function(t){return t.replace(/([A-Z])/g,"-$1").toLowerCase()},ju=function(t,e){var r,i={};for(r in t)e[r]||(i[r]=t[r]);return i},Yu={},Xu=function(t){var e=Yu[t]=Uu(t);return Bu[t]=e.concat(qu),e},Qu=function t(e,r,i){void 0===i&&(i=0);for(var s=e.parentNode,n=1e3*Math.pow(10,i)*(r?-1:1),o=r?900*-n:0;e;)o+=n,e=e.previousSibling;return s?o+t(s,r,i+1):o},Zu=function(t,e,r){return t.forEach((function(t){return t.d=Qu(r?t.element:t.t,e)})),t.sort((function(t,e){return t.d-e.d})),t},Ju=function(t,e){for(var r,i,s=t.element.style,n=t.css=t.css||[],o=e.length;o--;)i=s[r=e[o]]||s.getPropertyValue(r),n.push(i?r:Nu[r]||(Nu[r]=zu(r)),i);return s},td=function(t){var e=t.css,r=t.element.style,i=0;for(t.cache.uncache=1;i0&&M&&(l.style.opacity=Y?m.opacity-y.opacity:"0"),dd(m,y,F,U)):y.isVisible!==m.isVisible&&(y.isVisible?m.isVisible||(y.css=m.css,V.push(y),K.splice(a--,1),S&&P&&dd(m,y,F,U)):(m.isVisible&&H.push(m),K.splice(a--,1))),F||(l.style.maxWidth=Math.max(m.width,y.width)+"px",l.style.maxHeight=Math.max(m.height,y.height)+"px",l.style.minWidth=Math.min(m.width,y.width)+"px",l.style.minHeight=Math.min(m.height,y.height)+"px"),P&&R&&l.classList.add(R)):K.splice(a--,1),h.push(m);var e;if(R&&(e=h.map((function(t){return t.element})),P&&e.forEach((function(t){return t.classList.remove(R)}))),md(!1),F?($.scaleX=function(t){return K[t].a.scaleX},$.scaleY=function(t){return K[t].a.scaleY}):($.width=function(t){return K[t].a.width+"px"},$.height=function(t){return K[t].a.height+"px"},$.autoRound=r.autoRound||!1),$.x=function(t){return K[t].a.x+"px"},$.y=function(t){return K[t].a.y+"px"},$.rotation=function(t){return K[t].a.rotation+(N?360*j(t,d[t],d):0)},$.skewX=function(t){return K[t].a.skewX},d=K.map((function(t){return t.t})),(I||0===I)&&($.modifiers={zIndex:function(){return I}},$.zIndex=I,$.immediateRender=!1!==r.immediateRender),M&&($.opacity=function(t){return K[t].sd<0?0:K[t].sd>0?K[t].a.opacity:"+=0"}),W.length){O=Du.utils.distribute(O);var i=d.slice(W.length);$.stagger=function(t,e){return O(~W.indexOf(e)?d.indexOf(K[t].swap.t):t,e,i)}}if($u.forEach((function(t){return r[t]&&q.eventCallback(t,r[t],r[t+"Params"])})),D&&d.length)for(n in G=ju($,Ku),"scale"in D&&(D.scaleX=D.scaleY=D.scale,delete D.scale),D)(s=ju(D[n],Wu))[n]=$[n],!("duration"in s)&&"duration"in $&&(s.duration=$.duration),s.stagger=$.stagger,X.call(q,d,s,0),delete G[n];(d.length||V.length||H.length)&&(R&&q.add((function(){return Vu(e,R,q._zTime<0?"remove":"add")}),0)&&!A&&Vu(e,R,"add"),d.length&&X.call(q,d,G,0)),ud(T,H,q),ud(w,V,q);var f=Lu&&Lu.timeline;f&&(f.add(q,0),Lu._final.push((function(){return ed(K,!E)}))),o=q.duration(),q.call((function(){var t=q.time()>=o;t&&!f&&ed(K,!E),R&&Vu(e,R,t?"remove":"add")}))},b&&(S=K.filter((function(t){return!t.sd&&!t.a.isVisible&&t.b.isVisible})).map((function(t){return t.a.element}))),Lu)?(S&&(v=Lu._abs).push.apply(v,sd(K,S)),Lu._run.push(g)):(S&&nd(sd(K,S)),g());return Lu?Lu.timeline:q},vd=function t(e){e.vars.onInterrupt&&e.vars.onInterrupt.apply(e,e.vars.onInterruptParams||[]),e.getChildren(!0,!1,!0).forEach(t)},_d=function(t,e){if(t&&t.progress()<1&&!t.paused())return e&&(vd(t),e<2&&t.progress(1),t.kill()),!0},Ed=function(t){for(var e,r=t.idLookup={},i=t.alt={},s=t.elementStates,n=s.length;n--;)r[(e=s[n]).id]?i[e.id]=e:r[e.id]=e},Td=function(){function t(t,e,r){if(this.props=e&&e.props,this.simple=!(!e||!e.simple),r)this.targets=cd(t),this.elementStates=t,Ed(this);else{this.targets=bu(t);var i=e&&(!1===e.kill||e.batch&&!e.kill);Lu&&!i&&Lu._kill.push(this),this.update(i||!!Lu)}}var e=t.prototype;return e.update=function(t){var e=this;return this.elementStates=this.targets.map((function(t){return new wd(t,e.props,e.simple)})),Ed(this),this.interrupt(t),this.recordInlineStyles(),this},e.clear=function(){return this.targets.length=this.elementStates.length=0,Ed(this),this},e.fit=function(t,e,r){for(var i,s,n=Zu(this.elementStates.slice(0),!1,!0),o=(t||this).idLookup,a=0;a=0&&this.actions.splice(e,1),this},e.getState=function(t){var e=this,r=Lu,i=Au;return Lu=this,this.state.clear(),this._kill.length=0,this.actions.forEach((function(r){r.vars.getState&&(r.states.length=0,Au=r,r.state=r.vars.getState(r)),t&&r.states.forEach((function(t){return e.state.add(t)}))})),Au=i,Lu=r,this.killConflicts(),this},e.animate=function(){var t,e,r=this,i=Lu,s=this.timeline,n=this.actions.length;for(Lu=this,s.clear(),this._abs.length=this._final.length=this._run.length=0,this.actions.forEach((function(t){t.vars.animate&&t.vars.animate(t);var e,r,i=t.vars.onEnter,s=t.vars.onLeave,n=t.targets;n&&n.length&&(i||s)&&(e=new Td,t.states.forEach((function(t){return e.add(t)})),(r=e.compare(Dd.getState(n))).enter.length&&i&&i(r.enter),r.leave.length&&s&&s(r.leave))})),nd(this._abs),this._run.forEach((function(t){return t()})),e=s.duration(),t=this._final.slice(0),s.add((function(){e<=s.time()&&(t.forEach((function(t){return t()})),Pu(r,"onComplete"))})),Lu=i;n--;)this.actions[n].vars.once&&this.actions[n].kill();return Pu(this,"onStart"),s.restart(),this},e.loadState=function(t){t||(t=function(){return 0});var e=[];return this.actions.forEach((function(r){if(r.vars.loadState){var i,s=function s(n){n&&(r.targets=n),~(i=e.indexOf(s))&&(e.splice(i,1),e.length||t())};e.push(s),r.vars.loadState(s)}})),e.length||t(),this},e.setState=function(){return this.actions.forEach((function(t){return t.targets=t.vars.setState&&t.vars.setState(t)})),this},e.killConflicts=function(t){return this.state.interrupt(t),this._kill.forEach((function(e){return e.interrupt(t)})),this},e.run=function(t,e){var r=this;return this!==Lu&&(t||this.getState(e),this.loadState((function(){r._killed||(r.setState(),r.animate())}))),this},e.clear=function(t){this.state.clear(),t||(this.actions.length=0)},e.getStateById=function(t){for(var e,r=this.actions.length;r--;)if(e=this.actions[r].getStateById(t))return e;return this.state.idLookup[t]&&this.state},e.kill=function(){this._killed=1,this.clear(),delete Iu[this.id]},t}(),Dd=function(){function t(){}return t.getState=function(e,r){var i=hd(e,r);return Au&&Au.states.push(i),r&&r.batch&&t.batch(r.batch).state.add(i),i},t.from=function(t,e){return"clearProps"in(e=e||{})||(e.clearProps=!0),yd(t,hd(e.targets||t.targets,{props:e.props||t.props,simple:e.simple,kill:!!e.kill}),e,-1)},t.to=function(t,e){return yd(t,hd(e.targets||t.targets,{props:e.props||t.props,simple:e.simple,kill:!!e.kill}),e,1)},t.fromTo=function(t,e,r){return yd(t,e,r)},t.fit=function(t,e,r){var i=r?ju(r,Wu):{},s=r||i,n=s.absolute,o=s.scale,a=s.getVars,l=s.props,c=s.runBackwards,u=s.onComplete,d=s.simple,h=r&&r.fitChild&&Gu(r.fitChild),f=ad(e,l,d,t),p=ad(t,0,d,f),g=l?Bu[l]:qu;return l&&ld(i,f.props),c&&(Ju(p,g),"immediateRender"in i||(i.immediateRender=!0),i.onComplete=function(){td(p),u&&u.apply(this,arguments)}),n&&id(p,f),i=dd(p,f,o||h,l,h,i.duration||a?i:0),a?i:i.duration?Du.to(p.element,i):null},t.makeAbsolute=function(t,e){return(t instanceof Td?t:new Td(t,e)).makeAbsolute()},t.batch=function(t){return t||(t="default"),Iu[t]||(Iu[t]=new bd(t))},t.killFlipsOf=function(t,e){(t instanceof Td?t.targets:bu(t)).forEach((function(t){return t&&_d(t._flip,!1!==e?1:2)}))},t.isFlipping=function(e){var r=t.getByTarget(e);return!!r&&r.isActive()},t.getByTarget=function(t){return(Gu(t)||Ou)._flip},t.getElementState=function(t,e){return new wd(Gu(t),e)},t.convertCoordinates=function(t,e,r){var i=_o(e,!0,!0).multiply(_o(t));return r?i.apply(r):i},t.register=function(t){if(ku="undefined"!=typeof document&&document.body){Du=t,oo(ku),bu=Du.utils.toArray;var e=Du.utils.snap(.1);Cu=function(t,r){return e(parseFloat(t)+r)}}},t}();Dd.version="3.11.0","undefined"!=typeof window&&window.gsap&&window.gsap.registerPlugin(Dd),rs.registerPlugin(Dd);class Ld extends c.Transition{in(t){let{from:e,to:r,trigger:i,done:s}=t;if("popstate"!=i&&i.classList.contains("block-2__image-ct")){const t=i.clientHeight+1;rs.set(i,{height:t}),document.body.classList.add("bg-white"),rs.to(".block-2__over-ct",{opacity:0,duration:.4}),setTimeout((()=>{const t=i.querySelector(".block-2__image-wrap"),n=i.querySelector(".block-2__title"),o=i.querySelector(".block-2__title span"),a=Dd.getState(t),l=Dd.getState(n);n.classList.add("centered"),document.querySelector(".transition").append(t),document.querySelector(".transition").append(n),document.querySelector(".dolly-aa-no").classList.remove("dolly-aa"),rs.to(".dolly-aa-no",{scale:1,delay:.75,overwrite:!0}),Dd.fit(".transition",a),rs.to(".transition",{x:0,y:0,width:"100%",height:"100%",ease:"power2.inOut",duration:2}),Dd.from(l,{duration:1.5,ease:"power1.inOut",onComplete:()=>{e.remove(),window.scrollTo(0,0),eT.scrollTo(0,{immediate:!0}),r.querySelector(".aas-detail__heroWrap").innerHTML="",document.querySelectorAll(".transition > *").forEach((t=>{const e=t.cloneNode(!0);if(e.classList.contains("block-2__image-wrap")){const t=document.createElement("div");t.classList.add("hero__shadow"),rs.set(t,{opacity:0}),e.append(t),rs.to(t,{opacity:1,duration:2})}r.querySelector(".aas-detail__heroWrap").append(e)})),setTimeout((()=>{rs.to(".transition",{opacity:0,delay:.5,onComplete:()=>{document.querySelector(".transition").innerHTML="",document.body.classList.remove("wait"),rs.set(".transition",{clearProps:"all"})}}),s(),document.body.classList.remove("bg-white")}),250)}}),rs.to(o,{"--wPercent":"100%",duration:1,delay:.5})}),400)}else{if(document.querySelectorAll(".aas-detail__hero").length>0){const t=document.querySelector(".aas-detail__hero").querySelector(".block-2__imagefull");rs.set(t,{scale:1.25,x:0,y:0,transformOrigin:"center"}),rs.to(t,{scale:1,duration:2,ease:"power2.inOut"})}window.scrollTo(0,0),eT.scrollTo(0,{immediate:!0}),setTimeout((()=>{document.body.classList.remove("wait"),s()}),100)}}out(t){let{from:e,trigger:r,done:i}=t;document.body.classList.add("wait"),"popstate"!=r&&r.classList.contains("block-2__image-ct")?i():rs.to(".site__wrap",{opacity:0,duration:1,onComplete:()=>{window.scrollTo(0,0),eT.scrollTo(0,{immediate:!0}),document.body.classList.remove("wait"),e.remove(),i()}})}}function Ad(){const t=rs.utils.checkPrefix("filter"),e=/blur\((.+)?px\)/,r=r=>(rs.getProperty(r,t)||"").match(e)||[];rs.registerPlugin({name:"blur",get(t){return+r(t)[1]||0},init(e,i){let s=rs.getProperty(e,t);const n="blur("+i+"px)",o=r(e)[0];let a;"none"===s&&(s=""),o?(a=s.indexOf(o),i=s.substr(0,a)+n+s.substr(a+o.length)):(i=s+n,s+=s?" blur(0px)":"blur(0px)"),this.target=e,this.interp=rs.utils.interpolate(s,i)},render(e,r){r.target.style[t]=r.interp(e)}})}function kd(t){const e=new MouseEvent("click",{bubbles:!1,cancelable:!0,view:window});t.dispatchEvent(e)}function Cd(t){console.log("simulateSubmit",window.pauseFormSubmit);const e=new MouseEvent("click",{bubbles:!1,cancelable:!0,view:window});if(console.log("1 window.pauseFormSubmit",window.pauseFormSubmit),!0===window.pauseFormSubmit)return;window.pauseFormSubmit=!0,console.log("2 window.pauseFormSubmit",window.pauseFormSubmit),document.addEventListener("wpcf7mailsent",(function(t){window.pauseFormSubmit=!1,console.log("3 window.pauseFormSubmit",window.pauseFormSubmit)}));t.dispatchEvent(e)}Ad(),rs.registerPlugin(lu);const xd=rs.matchMedia();let Rd=!0;xd.add("(min-width: 992px)",(()=>{Rd=!1}));class Pd extends c.Renderer{onEnter(){}onLeave(){}onEnterCompleted(){if(1==yu){rs.set(".advice-hero",{background:"#FFF"}),rs.set(".advice-hero__image",{opacity:0,yPercent:10});const t=rs.timeline({onComplete:()=>{eT.start()}});rs.to(".advice-hero__sub span",{y:0,delay:.5,duration:.75}),rs.to(".advice-hero__qub span",{y:0,delay:.5,duration:.75}),rs.to(".advice-hero__title span",{y:0,delay:.5,duration:1}),rs.to(".advice-hero__image",{yPercent:0,opacity:1,delay:.5,duration:1}),t.add("start").to(".header__logo",{opacity:1,duration:2,ease:"power2.inOut"},"start").to(".header__left-menu",{opacity:1,duration:2,ease:"power2.inOut"},"start").to(".header__right-menu",{opacity:1,duration:2,ease:"power2.inOut"},"start"),rs.set(".header__logo",{left:0}),rs.to(".header__menu-toggle",{opacity:1,duration:2,ease:"power2.inOut"}),rs.set(".header__logo svg",{scale:1,y:0,x:()=>{if(Rd)return 0}})}else document.dispatchEvent(new Event("DOMContentLoadedCustom"));rs.to(".site__wrap",{opacity:1})}onLeaveCompleted(){}}rs.registerPlugin(Dd);class Id extends c.Transition{in(t){let{from:e,to:r,trigger:i,done:s}=t;if("popstate"!=i&&i.classList.contains("adtrans")){let t=i.querySelector("img");const n=Dd.getState(t);eT.stop(),r.querySelector(".advice-hero__image").innerHTML="",document.querySelector(".transition").append(r.querySelector(".advice-hero")),document.querySelector(".transition").querySelector(".advice-hero__image").append(t),rs.set("body",{background:"#FFF"}),rs.to(e,{opacity:0}),Dd.fit(".advice-hero__image",n);let o=Dd.getState(".advice-hero__image");rs.set(".advice-hero__image",{clearProps:!0}),rs.to(".advice-hero__sub span",{y:0,delay:.5,duration:.75}),rs.to(".advice-hero__qub span",{y:0,delay:.5,duration:.75}),rs.to(".advice-hero__title span",{y:0,delay:.5,duration:1}),Dd.from(o,{duration:1.5,ease:"power1.inOut",onComplete:()=>{e.remove(),window.scrollTo(0,0),eT.scrollTo(0,{immediate:!0});var t=document.querySelector(".advice-hero").cloneNode(!0);r.querySelector(".advice-hero__ct").append(t),document.body.classList.remove("wait"),setTimeout((()=>{rs.to(".transition",{opacity:0,delay:.5,onComplete:()=>{document.querySelector(".transition").innerHTML="",eT.start(),rs.set(".transition",{clearProps:"all"}),rs.set("body",{clearProps:"all"}),rs.set(".advice-hero",{background:"#FFF"})}}),s()}),100)}})}else rs.set(".advice-hero",{background:"#FFF"}),rs.set(".advice-hero__image",{opacity:0,yPercent:10}),rs.to(".advice-hero__sub span",{y:0,delay:.5,duration:.75}),rs.to(".advice-hero__qub span",{y:0,delay:.5,duration:.75}),rs.to(".advice-hero__title span",{y:0,delay:.5,duration:1}),rs.to(".advice-hero__image",{yPercent:0,opacity:1,delay:.5,duration:1}),window.scrollTo(0,0),eT.scrollTo(0,{immediate:!0}),setTimeout((()=>{document.body.classList.remove("wait"),s()}),100)}out(t){let{from:e,trigger:r,done:i}=t;document.body.classList.add("wait"),"popstate"!=r&&r.classList.contains("adtrans")?i():rs.to(".site__wrap",{opacity:0,duration:1,onComplete:()=>{window.scrollTo(0,0),eT.scrollTo(0,{immediate:!0}),document.body.classList.remove("wait"),e.remove(),i()}})}}var Fd=r(17),Md=r.n(Fd);const Od=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Nd{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[e,r]=new Uint8Array(t,0,2);if(219!==e)throw new Error("Data does not appear to be in a KDBush format.");const i=r>>4;if(1!==i)throw new Error(`Got v${i} data when expected v1.`);const s=Od[15&r];if(!s)throw new Error("Unrecognized array type.");const[n]=new Uint16Array(t,2,1),[o]=new Uint32Array(t,4,1);return new Nd(o,n,s,t)}constructor(t,e=64,r=Float64Array,i){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+e,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const s=Od.indexOf(this.ArrayType),n=2*t*this.ArrayType.BYTES_PER_ELEMENT,o=t*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-o%8)%8;if(s<0)throw new Error(`Unexpected typed array class: ${r}.`);i&&i instanceof ArrayBuffer?(this.data=i,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+o+a,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+n+o+a),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+o+a,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+s]),new Uint16Array(this.data,2,1)[0]=e,new Uint32Array(this.data,4,1)[0]=t)}add(t,e){const r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=t,this.coords[this._pos++]=e,r}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Bd(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,e,r,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:s,coords:n,nodeSize:o}=this,a=[0,s.length-1,0],l=[];for(;a.length;){const c=a.pop()||0,u=a.pop()||0,d=a.pop()||0;if(u-d<=o){for(let o=d;o<=u;o++){const a=n[2*o],c=n[2*o+1];a>=t&&a<=r&&c>=e&&c<=i&&l.push(s[o])}continue}const h=d+u>>1,f=n[2*h],p=n[2*h+1];f>=t&&f<=r&&p>=e&&p<=i&&l.push(s[h]),(0===c?t<=f:e<=p)&&(a.push(d),a.push(h-1),a.push(1-c)),(0===c?r>=f:i>=p)&&(a.push(h+1),a.push(u),a.push(1-c))}return l}within(t,e,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:s,nodeSize:n}=this,o=[0,i.length-1,0],a=[],l=r*r;for(;o.length;){const c=o.pop()||0,u=o.pop()||0,d=o.pop()||0;if(u-d<=n){for(let r=d;r<=u;r++)Gd(s[2*r],s[2*r+1],t,e)<=l&&a.push(i[r]);continue}const h=d+u>>1,f=s[2*h],p=s[2*h+1];Gd(f,p,t,e)<=l&&a.push(i[h]),(0===c?t-r<=f:e-r<=p)&&(o.push(d),o.push(h-1),o.push(1-c)),(0===c?t+r>=f:e+r>=p)&&(o.push(h+1),o.push(u),o.push(1-c))}return a}}function Bd(t,e,r,i,s,n){if(s-i<=r)return;const o=i+s>>1;Ud(t,e,o,i,s,n),Bd(t,e,r,i,o-1,1-n),Bd(t,e,r,o+1,s,1-n)}function Ud(t,e,r,i,s,n){for(;s>i;){if(s-i>600){const o=s-i+1,a=r-i+1,l=Math.log(o),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(o-c)/o)*(a-o/2<0?-1:1);Ud(t,e,r,Math.max(i,Math.floor(r-a*c/o+u)),Math.min(s,Math.floor(r+(o-a)*c/o+u)),n)}const o=e[2*r+n];let a=i,l=s;for($d(t,e,i,r),e[2*s+n]>o&&$d(t,e,i,s);ao;)l--}e[2*i+n]===o?$d(t,e,i,l):(l++,$d(t,e,l,s)),l<=r&&(i=l+1),r<=l&&(s=l-1)}}function $d(t,e,r,i){qd(t,r,i),qd(e,2*r,2*i),qd(e,2*r+1,2*i+1)}function qd(t,e,r){const i=t[e];t[e]=t[r],t[r]=i}function Gd(t,e,r,i){const s=t-r,n=e-i;return s*s+n*n}const Hd={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},Vd=Math.fround||(Kd=new Float32Array(1),t=>(Kd[0]=+t,Kd[0]));var Kd;class Wd{constructor(t){this.options=Object.assign(Object.create(Hd),t),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(t){const{log:e,minZoom:r,maxZoom:i}=this.options;e&&console.time("total time");const s=`prepare ${t.length} points`;e&&console.time(s),this.points=t;const n=[];for(let e=0;e=r;t--){const r=+Date.now();o=this.trees[t]=this._createTree(this._cluster(o,t)),e&&console.log("z%d: %d clusters in %dms",t,o.numItems,+Date.now()-r)}return e&&console.timeEnd("total time"),this}getClusters(t,e){let r=((t[0]+180)%360+360)%360-180;const i=Math.max(-90,Math.min(90,t[1]));let s=180===t[2]?180:((t[2]+180)%360+360)%360-180;const n=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,s=180;else if(r>s){const t=this.getClusters([r,i,180,n],e),o=this.getClusters([-180,i,s,n],e);return t.concat(o)}const o=this.trees[this._limitZoom(e)],a=o.range(Yd(r),Xd(n),Yd(s),Xd(i)),l=o.data,c=[];for(const t of a){const e=this.stride*t;c.push(l[e+5]>1?zd(l,e,this.clusterProps):this.points[l[e+3]])}return c}getChildren(t){const e=this._getOriginId(t),r=this._getOriginZoom(t),i="No cluster with the specified id.",s=this.trees[r];if(!s)throw new Error(i);const n=s.data;if(e*this.stride>=n.length)throw new Error(i);const o=this.options.radius/(this.options.extent*Math.pow(2,r-1)),a=n[e*this.stride],l=n[e*this.stride+1],c=s.within(a,l,o),u=[];for(const e of c){const r=e*this.stride;n[r+4]===t&&u.push(n[r+5]>1?zd(n,r,this.clusterProps):this.points[n[r+3]])}if(0===u.length)throw new Error(i);return u}getLeaves(t,e,r){e=e||10,r=r||0;const i=[];return this._appendLeaves(i,t,e,r,0),i}getTile(t,e,r){const i=this.trees[this._limitZoom(t)],s=Math.pow(2,t),{extent:n,radius:o}=this.options,a=o/n,l=(r-a)/s,c=(r+1+a)/s,u={features:[]};return this._addTileFeatures(i.range((e-a)/s,l,(e+1+a)/s,c),i.data,e,r,s,u),0===e&&this._addTileFeatures(i.range(1-a/s,l,1,c),i.data,s,r,s,u),e===s-1&&this._addTileFeatures(i.range(0,l,a/s,c),i.data,-1,r,s,u),u.features.length?u:null}getClusterExpansionZoom(t){let e=this._getOriginZoom(t)-1;for(;e<=this.options.maxZoom;){const r=this.getChildren(t);if(e++,1!==r.length)break;t=r[0].properties.cluster_id}return e}_appendLeaves(t,e,r,i,s){const n=this.getChildren(e);for(const e of n){const n=e.properties;if(n&&n.cluster?s+n.point_count<=i?s+=n.point_count:s=this._appendLeaves(t,n.cluster_id,r,i,s):s1;let l,c,u;if(a)l=jd(e,t,this.clusterProps),c=e[t],u=e[t+1];else{const r=this.points[e[t+3]];l=r.properties;const[i,s]=r.geometry.coordinates;c=Yd(i),u=Xd(s)}const d={type:1,geometry:[[Math.round(this.options.extent*(c*s-r)),Math.round(this.options.extent*(u*s-i))]],tags:l};let h;h=a||this.options.generateId?e[t+3]:this.points[e[t+3]].id,void 0!==h&&(d.id=h),n.features.push(d)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}_cluster(t,e){const{radius:r,extent:i,reduce:s,minPoints:n}=this.options,o=r/(i*Math.pow(2,e)),a=t.data,l=[],c=this.stride;for(let r=0;re&&(f+=a[r+5])}if(f>h&&f>=n){let t,n=i*h,o=u*h,p=-1;const g=(r/c<<5)+(e+1)+this.points.length;for(const i of d){const l=i*c;if(a[l+2]<=e)continue;a[l+2]=e;const u=a[l+5];n+=a[l]*u,o+=a[l+1]*u,a[l+4]=g,s&&(t||(t=this._map(a,r,!0),p=this.clusterProps.length,this.clusterProps.push(t)),s(t,this._map(a,l)))}a[r+4]=g,l.push(n/f,o/f,1/0,g,-1,f),s&&l.push(p)}else{for(let t=0;t1)for(const t of d){const r=t*c;if(!(a[r+2]<=e)){a[r+2]=e;for(let t=0;t>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,e,r){if(t[e+5]>1){const i=this.clusterProps[t[e+6]];return r?Object.assign({},i):i}const i=this.points[t[e+3]].properties,s=this.options.map(i);return r&&s===i?Object.assign({},s):s}}function zd(t,e,r){return{type:"Feature",id:t[e+3],properties:jd(t,e,r),geometry:{type:"Point",coordinates:[(i=t[e],360*(i-.5)),Qd(t[e+1])]}};var i}function jd(t,e,r){const i=t[e+5],s=i>=1e4?`${Math.round(i/1e3)}k`:i>=1e3?Math.round(i/100)/10+"k":i,n=t[e+6],o=-1===n?{}:Object.assign({},r[n]);return Object.assign(o,{cluster:!0,cluster_id:t[e+3],point_count:i,point_count_abbreviated:s})}function Yd(t){return t/360+.5}function Xd(t){const e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function Qd(t){const e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function Zd(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);sJd.getVisible(t))).length}push(t){this.markers.push(t)}delete(){this.marker&&(Jd.setMap(this.marker,null),this.marker=void 0),this.markers.length=0}}class eh{constructor({maxZoom:t=16}){this.maxZoom=t}noop({markers:t}){return rh(t)}}const rh=t=>t.map((t=>new th({position:Jd.getPosition(t),markers:[t]})));class ih extends eh{constructor(t){var{maxZoom:e,radius:r=60}=t,i=Zd(t,["maxZoom","radius"]);super({maxZoom:e}),this.state={zoom:-1},this.superCluster=new Wd(Object.assign({maxZoom:this.maxZoom,radius:r},i))}calculate(t){let e=!1;const r={zoom:t.map.getZoom()};if(!Md()(t.markers,this.markers)){e=!0,this.markers=[...t.markers];const r=this.markers.map((t=>{const e=Jd.getPosition(t);return{type:"Feature",geometry:{type:"Point",coordinates:[e.lng(),e.lat()]},properties:{marker:t}}}));this.superCluster.load(r)}return e||(this.state.zoom<=this.maxZoom||r.zoom<=this.maxZoom)&&(e=!Md()(this.state,r)),this.state=r,e&&(this.clusters=this.cluster(t)),{clusters:this.clusters,changed:e}}cluster({map:t}){return this.superCluster.getClusters([-180,-90,180,90],Math.round(t.getZoom())).map((t=>this.transformCluster(t)))}transformCluster({geometry:{coordinates:[t,e]},properties:r}){if(r.cluster)return new th({markers:this.superCluster.getLeaves(r.cluster_id,1/0).map((t=>t.properties.marker)),position:{lat:e,lng:t}});const i=r.marker;return new th({markers:[i],position:Jd.getPosition(i)})}}class sh{constructor(t,e){this.markers={sum:t.length};const r=e.map((t=>t.count)),i=r.reduce(((t,e)=>t+e),0);this.clusters={count:e.length,markers:{mean:i/e.length,sum:i,min:Math.min(...r),max:Math.max(...r)}}}}class nh{render({count:t,position:e},r,i){const s=`\n\n\n\n${t}\n`,n=`Cluster of ${t} markers`,o=Number(google.maps.Marker.MAX_ZINDEX)+t;if(Jd.isAdvancedMarkerAvailable(i)){const t=(new DOMParser).parseFromString(s,"image/svg+xml").documentElement;t.setAttribute("transform","translate(0 25)");const r={map:i,position:e,zIndex:o,title:n,content:t};return new google.maps.marker.AdvancedMarkerElement(r)}const a={position:e,zIndex:o,title:n,icon:{url:`data:image/svg+xml;base64,${btoa(s)}`,anchor:new google.maps.Point(25,25)}};return new google.maps.Marker(a)}}class oh{constructor(){!function(t,e){for(let r in e.prototype)t.prototype[r]=e.prototype[r]}(oh,google.maps.OverlayView)}}var ah;!function(t){t.CLUSTERING_BEGIN="clusteringbegin",t.CLUSTERING_END="clusteringend",t.CLUSTER_CLICK="click"}(ah||(ah={}));const lh=(t,e,r)=>{r.fitBounds(e.bounds)};class ch extends oh{constructor({map:t,markers:e=[],algorithmOptions:r={},algorithm:i=new ih(r),renderer:s=new nh,onClusterClick:n=lh}){super(),this.markers=[...e],this.clusters=[],this.algorithm=i,this.renderer=s,this.onClusterClick=n,t&&this.setMap(t)}addMarker(t,e){this.markers.includes(t)||(this.markers.push(t),e||this.render())}addMarkers(t,e){t.forEach((t=>{this.addMarker(t,!0)})),e||this.render()}removeMarker(t,e){const r=this.markers.indexOf(t);return-1!==r&&(Jd.setMap(t,null),this.markers.splice(r,1),e||this.render(),!0)}removeMarkers(t,e){let r=!1;return t.forEach((t=>{r=this.removeMarker(t,!0)||r})),r&&!e&&this.render(),r}clearMarkers(t){this.markers.length=0,t||this.render()}render(){const t=this.getMap();if(t instanceof google.maps.Map&&t.getProjection()){google.maps.event.trigger(this,ah.CLUSTERING_BEGIN,this);const{clusters:e,changed:r}=this.algorithm.calculate({markers:this.markers,map:t,mapCanvasProjection:this.getProjection()});if(r||null==r){const t=new Set;for(const r of e)1==r.markers.length&&t.add(r.markers[0]);const r=[];for(const e of this.clusters)null!=e.marker&&(1==e.markers.length?t.has(e.marker)||Jd.setMap(e.marker,null):r.push(e.marker));this.clusters=e,this.renderClusters(),requestAnimationFrame((()=>r.forEach((t=>Jd.setMap(t,null)))))}google.maps.event.trigger(this,ah.CLUSTERING_END,this)}}onAdd(){this.idleListener=this.getMap().addListener("idle",this.render.bind(this)),this.render()}onRemove(){google.maps.event.removeListener(this.idleListener),this.reset()}reset(){this.markers.forEach((t=>Jd.setMap(t,null))),this.clusters.forEach((t=>t.delete())),this.clusters=[]}renderClusters(){const t=new sh(this.markers,this.clusters),e=this.getMap();this.clusters.forEach((r=>{1===r.markers.length?r.marker=r.markers[0]:(r.marker=this.renderer.render(r,t,e),r.markers.forEach((t=>Jd.setMap(t,null))),this.onClusterClick&&r.marker.addListener("click",(t=>{google.maps.event.trigger(this,ah.CLUSTER_CLICK,r),this.onClusterClick(t,r,e)}))),Jd.setMap(r.marker,e)}))}}class uh{constructor(){this._map=null,this._defaultCenter={lat:40.9224064,lng:13.0109053},this._markers=[],this._rangeNotifier=null,this._locations=this.parseLocations(),this._markerClusterer=null,this._searchInput=document.getElementById("searchMap"),this._resultsWR=document.querySelector("[data-locator-results]"),this._resultsEmpty=document.querySelector("[data-locator-noresults]"),this._resultsList=document.querySelector("[data-locator-list]"),this._searchBtn=document.querySelector(".block-map__controls-scta"),this._searchBox=null,this._resultsArray=[],this._popup=document.querySelector("[data-map-popup]"),this._style=[{elementType:"geometry",stylers:[{color:"#d0d1d7"}]},{elementType:"labels.icon",stylers:[{visibility:"off"}]},{elementType:"labels.text.fill",stylers:[{color:"#616161"}]},{elementType:"labels.text.stroke",stylers:[{color:"#f5f5f5"},{visibility:"off"}]},{featureType:"administrative",elementType:"geometry",stylers:[{visibility:"off"}]},{featureType:"administrative.land_parcel",stylers:[{visibility:"off"}]},{featureType:"administrative.land_parcel",elementType:"labels.text.fill",stylers:[{color:"#bdbdbd"}]},{featureType:"administrative.neighborhood",stylers:[{visibility:"off"}]},{featureType:"poi",stylers:[{visibility:"off"}]},{featureType:"poi",elementType:"geometry",stylers:[{color:"#eeeeee"}]},{featureType:"poi",elementType:"labels.text",stylers:[{visibility:"off"}]},{featureType:"poi",elementType:"labels.text.fill",stylers:[{color:"#757575"}]},{featureType:"poi.park",elementType:"geometry",stylers:[{color:"#e5e5e5"}]},{featureType:"poi.park",elementType:"labels.text.fill",stylers:[{color:"#9e9e9e"}]},{featureType:"road",elementType:"geometry",stylers:[{color:"#ffffff"}]},{featureType:"road",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"road",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"road.arterial",stylers:[{visibility:"off"}]},{featureType:"road.arterial",elementType:"labels.text.fill",stylers:[{color:"#757575"}]},{featureType:"road.highway",elementType:"geometry",stylers:[{color:"#dadada"}]},{featureType:"road.highway",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"road.highway",elementType:"labels.text.fill",stylers:[{color:"#616161"}]},{featureType:"road.local",stylers:[{visibility:"off"}]},{featureType:"road.local",elementType:"labels.text.fill",stylers:[{color:"#9e9e9e"}]},{featureType:"transit",stylers:[{visibility:"off"}]},{featureType:"transit.line",elementType:"geometry",stylers:[{color:"#e5e5e5"}]},{featureType:"transit.station",elementType:"geometry",stylers:[{color:"#eeeeee"}]},{featureType:"water",elementType:"geometry",stylers:[{color:"#eaeaf0"}]},{featureType:"water",elementType:"labels.text",stylers:[{visibility:"off"}]},{featureType:"water",elementType:"labels.text.fill",stylers:[{color:"#9e9e9e"}]}],this._template=document.querySelector("[data-locator-template]"),this.initialize()}initialize(){this._map=new google.maps.Map(document.getElementById("gmap"),{zoom:window.matchMedia("(min-width: 768px)").matches?3:2,center:this._defaultCenter,styles:this._style}),this.createMarkers(),this.createClusters(),this.handleRangeChange(),this.handleSearchField(),this._searchBtn.addEventListener("click",(t=>{t.preventDefault(),this._searchInput.dispatchEvent(new KeyboardEvent("keydown",{keyCode:13,code:"Enter",key:"Enter"}))})),this._popup?.querySelector("[data-close]").addEventListener("click",(t=>{this.closePopup()})),this._map.addListener("click",(()=>{this.closePopup()}))}parseLocations(){const t=document.querySelector("[data-doimo-locations]")?.innerText?.trim();try{return JSON.parse(t)??[]}catch(t){console.error(t)}}createMarkers(){this._markers=this._locations.reduce(((t,e,r)=>{const i=new google.maps.Marker({id:r,position:{lat:parseFloat(e.lat),lng:parseFloat(e.lng)},icon:{size:new google.maps.Size(24,30),scaledSize:new google.maps.Size(24,30),anchor:new google.maps.Point(12,30),url:window.template_url+"/assets/images/marker.svg"}});return i.addListener("click",(t=>{this.openPopup(e)})),t.concat(i)}),[])}createClusters(){const t=window.btoa('\n \n \n \n ');this._markerClusterer=new ch({map:this._map,markers:this._markers,renderer:{render:e=>{let{count:r,position:i}=e;return new google.maps.Marker({label:{text:String(r),color:"#FFFFFF",fontSize:"12px",fontWeight:"400"},icon:{url:`data:image/svg+xml;base64,${t}`,scaledSize:new google.maps.Size(64,64)},position:i,zIndex:Number(google.maps.Marker.MAX_ZINDEX)+r})}}})}handleRangeChange(){const t=document.querySelector("#range");this._rangeNotifier||(this._rangeNotifier=new google.maps.Circle({strokeOpacity:0,fillOpacity:0,map:this._map,center:this._defaultCenter,radius:1e4})),t&&t.addEventListener("change",(()=>{const e=this._map.getCenter();if(e.lat()!==this._defaultCenter.lat&&e.lng()!==this._defaultCenter.lng&&""!=t.value){const r=1e3*parseInt(t.value);this._rangeNotifier.setRadius(r),this._rangeNotifier.setCenter(e),this._map.fitBounds(this._rangeNotifier.getBounds()),this._resultsList.innerHTML="",this._markers.forEach((t=>{this._rangeNotifier.getBounds().contains(t.getPosition())?(this._markerClusterer.addMarker(t),this.composeResultTemplate(this._locations[t.id],t.getPosition())):this._markerClusterer.removeMarker(t)})),this.displaySortedResults(),this._markerClusterer?.markers.length?this._resultsEmpty.classList.add("d-none"):this._resultsEmpty.classList.remove("d-none"),this._resultsWR.style.display="block"}}))}composeResultTemplate(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const r=this._template.cloneNode(!0);r.classList.remove("results-template");const i=r.querySelector("[data-el-title]"),s=r.querySelector("[data-el-address]"),n=r.querySelector("[data-el-phone]"),o=r.querySelector("[data-el-mail]"),a=r.querySelector("[data-el-website]");if(t.title?i.innerHTML=t.title:i.innerHTML="",t.address?s.innerHTML=t.address:s.innerHTML="",t.phone?n.innerHTML=`T ${t.phone}`:n.innerHTML="",t.email?o.innerHTML=`E ${t.email}`:o.innerHTML="",t.website){const e=t.website.startsWith("www")?`https://${t.website}`:t.website;a.innerHTML=`W ${t.website.replace(/https?:\/\/(www.)?(.*?)\/?$/gi,"$2")}`}else a.innerHTML="";this._resultsArray.push({res:r,pos:e})}displaySortedResults(){this._resultsArray.sort(((t,e)=>{const{spherical:r}=google.maps.geometry;return r.computeDistanceBetween(this._map.getCenter(),t.pos)<=r.computeDistanceBetween(this._map.getCenter(),e.pos)?-1:1})),this._resultsArray.forEach((t=>{this._resultsList.appendChild(t.res)})),this._resultsArray=[]}selectFirstPredictionOnEnter(t){const e=t.addEventListener;t.addEventListener=function(r,i){if("keydown"==r){const e=i;i=function(r){const i=document.querySelector(".pac-item-selected");if(13===r.keycode||"Enter"===r.key&&!i){const r=new KeyboardEvent("keydown",{keyCode:40,code:"ArrowDown",key:"ArrowDown"});e.apply(t,[r])}e.apply(t,[r])}}e.apply(t,[r,i])}}handleSearchField(){const t=document.querySelector("#range");this.selectFirstPredictionOnEnter(this._searchInput),this._searchBox=new google.maps.places.Autocomplete(this._searchInput,{types:["(regions)"],fields:["geometry"]}),this._searchBox.addListener("place_changed",(()=>{const e=this._searchBox.getPlace();if(void 0===e.geometry)return;const r=new google.maps.LatLng(e.geometry.location.lat(),e.geometry.location.lng());this._map.setCenter(r),this._map.getZoom()<10&&this._map.setZoom(10),""==t.value?(this._resultsList.innerHTML="",this._markers.forEach((t=>{this._map.getBounds().contains(t.getPosition())&&this.composeResultTemplate(this._locations[t.id],t.getPosition())})),this.displaySortedResults(),this._resultsList.children.length?this._resultsEmpty.classList.add("d-none"):this._resultsEmpty.classList.remove("d-none"),this._resultsWR.style.display="block"):t.dispatchEvent(new Event("change"))}))}openPopup(t){if(!this._popup)return;this.__timeout&&clearTimeout(this.__timeout);const e=this._popup.querySelector("[data-title]"),r=this._popup.querySelector("[data-address]"),i=this._popup.querySelector("[data-phone]"),s=this._popup.querySelector("[data-mail]"),n=this._popup.querySelector("[data-website]"),o=this._popup.querySelector("[data-directions]");if(t.title?e.innerHTML=t.title:e.innerHTML="",t.address?r.innerHTML=t.address:r.innerHTML="",o.setAttribute("href",`https://www.google.com/maps/dir/${t.lat},${t.lng}/`),t.phone?i.innerHTML=`T ${t.phone}`:i.innerHTML="",t.email?s.innerHTML=`E ${t.email}`:s.innerHTML="",t.website){const e=t.website.startsWith("www")?`https://${t.website}`:t.website;n.innerHTML=`${t.website.replace(/https?:\/\/(www.)?(.*?)\/?$/gi,"$2")}`}else n.innerHTML="";this._popup.classList.remove("-is-hidden")}closePopup(){this._popup&&(this._popup.classList.add("-is-hidden"),this.__timeout=setTimeout((t=>{const e=this._popup.querySelector("[data-title]"),r=this._popup.querySelector("[data-address]"),i=this._popup.querySelector("[data-phone]"),s=this._popup.querySelector("[data-mail]"),n=this._popup.querySelector("[data-website]"),o=this._popup.querySelector("[data-directions]");e.innerText="",r.innerText="",i.innerHTML="",s.innerHTML="",n.innerHTML="",o.removeAttribute("href")}),1500))}}Ad(),rs.registerPlugin(lu,xc);const dh=rs.matchMedia();let hh=!0;dh.add("(min-width: 992px)",(()=>{hh=!1}));class fh extends c.Renderer{onEnter(){document.querySelectorAll("#gmap").length>0&&(window.mappa=new uh)}onLeave(){}onEnterCompleted(){if(1==yu){rs.timeline({onComplete:()=>{eT.start()}}).add("start").to(".header__logo",{opacity:1,duration:2,ease:"power2.inOut"},"start").to(".header__left-menu",{opacity:1,duration:2,ease:"power2.inOut"},"start").to(".header__right-menu",{opacity:1,duration:2,ease:"power2.inOut"},"start"),rs.set(".header__logo",{left:0}),rs.to(".header__menu-toggle",{opacity:1,duration:2,ease:"power2.inOut"}),rs.set(".header__logo svg",{scale:1,y:0,x:()=>{if(hh)return 0}})}else document.dispatchEvent(new Event("DOMContentLoadedCustom"));if(document.querySelectorAll(".freedom-hero__s").length>0){const t=new lu(".freedom-hero__t",{type:"lines",linesClass:"lineChild"}),e=new lu(".freedom-hero__t",{type:"lines",linesClass:"lineParent"}),r=new lu(".freedom-hero__s",{type:"lines",linesClass:"lineChild"}),i=new lu(".freedom-hero__s",{type:"lines",linesClass:"lineParent"});rs.set(e.lines,{overflow:"hidden"}),rs.set(t.lines,{yPercent:100}),rs.set(i.lines,{overflow:"hidden"}),rs.set(r.lines,{yPercent:100});rs.timeline().add("start").to(t.lines,{yPercent:0,delay:.5,duration:1.5,ease:"power2.inOut",stagger:{each:.1}},"start").to(r.lines,{yPercent:0,delay:.5,duration:1.5,ease:"power2.inOut",stagger:{each:.1}},"start"),rs.set(".freedom-hero__cta",{opacity:0,yPercent:15}),rs.to(".freedom-hero__cta",{opacity:1,yPercent:0,delay:1}),rs.set(".freedom-hero__txt",{opacity:0,yPercent:25}),rs.to(".freedom-hero__txt",{opacity:1,yPercent:0,delay:1})}rs.to(".site__wrap",{opacity:1,delay:.5}),rs.set(".block-map__wrap",{opacity:0,yPercent:10}),rs.to(".block-map__wrap",{opacity:1,yPercent:0,duration:2,delay:.5,ease:"power2.inOut"});const t=document.querySelector(".contactform_cta");if(document.querySelectorAll(".contactform_cta").length>0){t.addEventListener("click",(()=>{if(t.classList.contains("pchecked")){Cd(document.querySelector(".submit-ct input")),rs.to(".privacy-error--cf",{opacity:0})}else rs.to(".privacy-error--cf",{opacity:1})}));document.getElementById("p-checkbox-fc").addEventListener("change",(e=>{!0===e.target.checked&&t.classList.add("pchecked"),!1===e.target.checked&&t.classList.remove("pchecked")}))}let e=!1;document.querySelector("#gmap")&&(document.querySelector("#gmap").addEventListener("mouseenter",(()=>{e=!0})),document.querySelector("#gmap").addEventListener("mouseleave",(()=>{e=!1}))),document.addEventListener("keydown",(function(t){"Meta"==t.key&&1==e&&eT.stop()})),document.addEventListener("keyup",(function(t){"Meta"==t.key&&eT.start()}))}onLeaveCompleted(){}}class ph{init(){const t=document.querySelector(".genericform_cta");if(document.querySelectorAll(".genericform_cta").length>0){t.addEventListener("click",(()=>{if(t.classList.contains("pchecked")){kd(document.querySelector(".submit-ct-generic input")),rs.to(".privacy-error--cf",{opacity:0})}else rs.to(".privacy-error--cf",{opacity:1})}));document.getElementById("p-checkbox-fc-generic").addEventListener("change",(e=>{!0===e.target.checked&&t.classList.add("pchecked"),!1===e.target.checked&&t.classList.remove("pchecked")}))}let e=!1;document.querySelector("#gmap")&&(document.querySelector("#gmap").addEventListener("mouseenter",(()=>{e=!0})),document.querySelector("#gmap").addEventListener("mouseleave",(()=>{e=!1}))),document.addEventListener("keydown",(function(t){"Meta"==t.key&&1==e&&eT.stop()})),document.addEventListener("keyup",(function(t){"Meta"==t.key&&eT.start()}))}}(new ph).init();class gh{constructor(t){let e,r,i,s,n,o,a;this.allListeners=[];const l=document.getElementsByClassName(t),c=l.length;for(e=0;e0){const t=l[e].querySelector(".select-selected");l[e].removeChild(t)}if(l[e].querySelectorAll(".select-items").length>0){const t=l[e].querySelector(".select-items");l[e].removeChild(t)}for(i=s.length,n=document.createElement("DIV"),n.setAttribute("class","select-selected"),n.innerHTML=s.options[s.selectedIndex].innerHTML,l[e].appendChild(n),o=document.createElement("DIV"),o.setAttribute("class","select-items select-hide"),o.setAttribute("data-lenis-prevent","true"),r=1;r"+s.options[r].innerHTML+"",1==s.options[r].disabled&&a.classList.add("disabled"),a.addEventListener("click",u),this.allListeners.push({el:a,type:"click",handler:u}),o.appendChild(a)}l[e].appendChild(o),n.addEventListener("click",d),this.allListeners.push({el:n,type:"click",handler:d})}function u(t){let e,r,i,s;const n=this.parentNode.parentNode.getElementsByTagName("select")[0],o=n.length,a=this.parentNode.previousSibling;for(r=0;r{t.value==n.value?t.setAttribute("selected",""):t.value&&""!=t.value&&t.removeAttribute("selected")})),n.dispatchEvent(new Event("change"))}function d(t){t.stopPropagation(),h(this),this.nextSibling.classList.toggle("select-hide"),this.classList.toggle("select-arrow-active")}function h(t){const r=[],i=document.getElementsByClassName("select-items"),s=document.getElementsByClassName("select-selected"),n=i.length,o=s.length;for(e=0;e{t.el.removeEventListener(t.type,t.handler)})),this.allListeners=null}}class mh{constructor(){function t(t){const e=t.getBoundingClientRect();return e.left>=0&&e.right<=(window.innerWidth||document.documentElement.clientWidth)}const e=document.querySelector(".dcarousel"),r=document.querySelectorAll(".dcarousel--item"),i=e.querySelectorAll(".dcarousel--item div"),s=document.querySelector(".dcarousel-index"),n=document.querySelector(".dcarousel-total");let o=e.clientWidth,a=r[0].clientWidth,l=r.length*a;const c=rs.matchMedia();let u=!0;s.innerHTML=3,c.add("(min-width: 992px)",(()=>{u=!1,s.innerHTML=2}));let d=0,h=0,f=0,p=0;f=u?{value:1.5*-window.innerWidth}:{value:-window.innerWidth/3.1};let g=0,m=0,y=!1,v=!1;const _=t=>{g=t.clientX||t.touches[0].clientX,y=!0,e.classList.add("is-dragging"),rs.to(r,{scale:.9})},E=t=>{y?(v=!0,m=t.clientX||t.touches[0].clientX,f.value+=2.5*(m-g),g=m):v=!1},T=()=>{y=!1,e.classList.remove("is-dragging"),rs.to(r,{scale:1}),setTimeout((()=>{r.forEach((t=>{t.classList.remove("inview")})),r.forEach((e=>{t(e)&&(s.innerHTML=e.dataset.item,e.classList.add("inview"))}))}),100)};e.addEventListener("touchstart",_,{passive:!0}),e.addEventListener("touchmove",E,{passive:!0}),e.addEventListener("touchend",T,{passive:!0}),e.addEventListener("mousedown",_),e.addEventListener("mousemove",E),e.addEventListener("mouseleave",T),e.addEventListener("mouseup",T),i.forEach((t=>{const r=t.querySelector("a");t.addEventListener("click",(()=>{e.classList.contains("is-dragging")||0==v&&kd(r)}))})),e.addEventListener("selectstart",(()=>!1));let w=!1;document.querySelector(".dcarousel-next").addEventListener("click",(()=>{if(0==w){w=!0;let e,i=parseInt(s.innerHTML);document.querySelectorAll(".dcarousel--item.inview").length>0?e=document.querySelector(".dcarousel--item.inview").getBoundingClientRect():r.forEach((r=>{t(r)&&(s.innerHTML=r.dataset.item,r.classList.add("inview"),e=r.getBoundingClientRect())})),i==parseInt(n.innerHTML)?i=1:i++;let o=r[0].clientWidth;void 0===e&&(e=r[0].getBoundingClientRect(),s.innerHTML=r[0].dataset.item,r[0].classList.add("inview")),e.left+e.width/2<=10+window.innerWidth/2&&e.left+e.width/2>=window.innerWidth/2-10||(o+=-(window.innerWidth/2-(e.left+e.width/2)));rs.timeline({onComplete:()=>{r.forEach((t=>{t.classList.remove("inview")})),r.forEach((e=>{t(e)&&(s.innerHTML=e.dataset.item,e.classList.add("inview"))})),setTimeout((()=>{w=!1}),100)}}).to(r,{scale:.9,duration:.4}).to(f,{value:"-="+o,duration:.8,ease:"power2.inOut"}).to(r,{scale:1,duration:.4}),s.innerHTML=i}})),document.querySelector(".dcarousel-prev").addEventListener("click",(()=>{if(0==w){w=!0;let e,i=parseInt(s.innerHTML);document.querySelectorAll(".dcarousel--item.inview").length>0?e=document.querySelector(".dcarousel--item.inview").getBoundingClientRect():r.forEach((r=>{t(r)&&(s.innerHTML=r.dataset.item,r.classList.add("inview"),e=r.getBoundingClientRect())})),1==i?i=parseInt(n.innerHTML):i--;let o=r[0].clientWidth;void 0===e&&(e=r[0].getBoundingClientRect(),s.innerHTML=r[0].dataset.item,r[0].classList.add("inview")),e.left+e.width/2<=10+window.innerWidth/2&&e.left+e.width/2>=window.innerWidth/2-10||(o-=-(window.innerWidth/2-(e.left+e.width/2)));rs.timeline({onComplete:()=>{r.forEach((t=>{t.classList.remove("inview")})),setTimeout((()=>{r.forEach((e=>{t(e)&&(s.innerHTML=e.dataset.item,e.classList.add("inview"))})),w=!1}),100)}}).to(r,{scale:.9,duration:.4}).to(f,{value:"+="+o,duration:.8,ease:"power2.inOut"}).to(r,{scale:1,duration:.4}),s.innerHTML=i}})),window.addEventListener("resize",(()=>{o=e.clientWidth,a=r[0].clientWidth,l=r.length*a}));const S=()=>{var t;this.raf=requestAnimationFrame(S),p=parseInt(((t,e,r)=>t*(1-r)+e*r)(p,f.value,.1)),t=p,rs.set(r,{x:e=>e*a+t,modifiers:{x:(t,e)=>`${rs.utils.wrap(-a,l-a,parseInt(t))}px`}}),d=p-h,h=p};S()}destroy(){cancelAnimationFrame(this.raf)}}Ad(),rs.registerPlugin(lu,xc);const yh=rs.matchMedia();let vh=!0;yh.add("(min-width: 992px)",(()=>{vh=!1}));class _h extends c.Renderer{onEnter(){}onLeave(){}onEnterCompleted(){if(1==yu){rs.timeline({onComplete:()=>{eT.start()}}).add("start").to(".header__logo",{opacity:1,duration:2,ease:"power2.inOut"},"start").to(".header__left-menu",{opacity:1,duration:2,ease:"power2.inOut"},"start").to(".header__right-menu",{opacity:1,duration:2,ease:"power2.inOut"},"start"),rs.set(".header__logo",{left:0}),rs.to(".header__menu-toggle",{opacity:1,duration:2,ease:"power2.inOut"}),rs.set(".header__logo svg",{scale:1,y:0,x:()=>{if(vh)return 0}})}else document.dispatchEvent(new Event("DOMContentLoadedCustom"));if(document.querySelectorAll(".freedom-hero__s").length>0){const t=new lu(".freedom-hero__t",{type:"lines",linesClass:"lineChild"}),e=new lu(".freedom-hero__t",{type:"lines",linesClass:"lineParent"}),r=new lu(".freedom-hero__s",{type:"lines",linesClass:"lineChild"}),i=new lu(".freedom-hero__s",{type:"lines",linesClass:"lineParent"});rs.set(e.lines,{overflow:"hidden"}),rs.set(t.lines,{yPercent:100}),rs.set(i.lines,{overflow:"hidden"}),rs.set(r.lines,{yPercent:100});rs.timeline().add("start").to(t.lines,{yPercent:0,delay:.5,duration:1.5,ease:"power2.inOut",stagger:{each:.1}},"start").to(r.lines,{yPercent:0,delay:.5,duration:1.5,ease:"power2.inOut",stagger:{each:.1}},"start"),document.querySelectorAll(".freedom-hero__c").length>0&&(rs.set(".freedom-hero__c",{opacity:0,blur:4,yPercent:5}),rs.to(".freedom-hero__c",{opacity:1,yPercent:0,blur:0,delay:1}))}document.querySelectorAll(".news-grid__box").length>0&&(rs.set(".news-grid__filters",{opacity:0,yPercent:25}),rs.to(".news-grid__filters",{opacity:1,yPercent:0,duration:2,delay:.5,ease:"power2.inOut"}),document.querySelectorAll(".news-grid__box").forEach((t=>{rs.set(t,{opacity:0,yPercent:15}),rs.set(t.querySelector("img"),{scale:1.125}),rs.to(t,{opacity:1,yPercent:0,duration:2,ease:"power2.inOut",scrollTrigger:{trigger:t,start:"top bottom"}}),rs.to(t.querySelector("img"),{scale:1,duration:2,ease:"power2.inOut",onComplete:()=>{rs.set(t.querySelector("img"),{clearProps:"all"})},scrollTrigger:{trigger:t,start:"top bottom"}})}))),document.querySelectorAll(".video-grid__box").length>0&&(rs.set(".video-grid__filters",{opacity:0,yPercent:25}),rs.to(".video-grid__filters",{opacity:1,yPercent:0,duration:2,delay:.5,ease:"power2.inOut"}),document.querySelectorAll(".video-grid__box").forEach((t=>{rs.set(t,{opacity:0,yPercent:15}),rs.set(t.querySelector("img"),{scale:1.125}),rs.to(t,{opacity:1,yPercent:0,duration:2,ease:"power2.inOut",scrollTrigger:{trigger:t,start:"top bottom"}}),rs.to(t.querySelector("img"),{scale:1,duration:2,ease:"power2.inOut",onComplete:()=>{rs.set(t.querySelector("img"),{clearProps:"all"})},scrollTrigger:{trigger:t,start:"top bottom"}})}))),document.querySelectorAll(".top-news-image").length>0&&(rs.set(".top-news-image",{opacity:0,yPercent:25}),rs.to(".top-news-image",{opacity:1,yPercent:0,duration:2,delay:.5,ease:"power2.inOut"})),document.querySelectorAll(".project-hero").length>0&&setTimeout((()=>{xc.create({trigger:".project-hero",start:"top top",pinSpacing:!1,pin:!0,markers:!1,end:"+=100%",onUpdate:t=>{}}),rs.to(".projects-block__img--c",{scale:1.25,scrollTrigger:{start:"top top",end:"+=100%",scrub:!0}})}),250),rs.to(".site__wrap",{opacity:1}),xc.refresh()}onLeaveCompleted(){}}Ad(),rs.registerPlugin(lu,xc);const Eh=rs.matchMedia();let Th=!0;Eh.add("(min-width: 992px)",(()=>{Th=!1}));class wh extends c.Renderer{onEnter(){const t=document.querySelector("#div-form"),e=t.querySelector("form"),r=document.querySelector("#download-list");rs.set(r,{overflow:"hidden",maxHeight:0}),rs.set(t,{overflow:"hidden",maxHeight:999}),e&&e.addEventListener("submit",(function(t){}),!1),document.cookie.split(";").some((t=>t.trim().startsWith("display_downloadList=")))&&(t&&rs.to(t,{maxHeight:0,duration:2,delay:.2,ease:"power2.inOut"}),r&&rs.to(r,{maxHeight:999,duration:2,delay:.5,ease:"power2.inOut"})),!e&&r&&rs.to(r,{maxHeight:999,duration:2,delay:.5,ease:"power2.inOut"}),document.addEventListener("wpcf7mailsent",(function(e){document.cookie="display_downloadList=true; expires=Fri, 31 Dec 9999 23:59:59 GMT";e.detail.inputs.some((t=>"action"===t.name&&"display_downloadList"===t.value))&&(t&&rs.to(t,{maxHeight:0,duration:2,delay:.2,ease:"power2.inOut"}),r&&rs.to(r,{maxHeight:999,duration:2,delay:.5,ease:"power2.inOut"}))}),!1)}onLeave(){}onEnterCompleted(){if(1==yu){rs.timeline({onComplete:()=>{eT.start()}}).add("start").to(".header__logo",{opacity:1,duration:2,ease:"power2.inOut"},"start").to(".header__left-menu",{opacity:1,duration:2,ease:"power2.inOut"},"start").to(".header__right-menu",{opacity:1,duration:2,ease:"power2.inOut"},"start"),rs.set(".header__logo",{left:0}),rs.to(".header__menu-toggle",{opacity:1,duration:2,ease:"power2.inOut"}),rs.set(".header__logo svg",{scale:1,y:0,x:()=>{if(Th)return 0}})}else document.dispatchEvent(new Event("DOMContentLoadedCustom"));if(document.querySelectorAll(".freedom-hero__s").length>0){const t=new lu(".freedom-hero__t",{type:"lines",linesClass:"lineChild"}),e=new lu(".freedom-hero__t",{type:"lines",linesClass:"lineParent"}),r=new lu(".freedom-hero__s",{type:"lines",linesClass:"lineChild"}),i=new lu(".freedom-hero__s",{type:"lines",linesClass:"lineParent"});rs.set(e.lines,{overflow:"hidden"}),rs.set(t.lines,{yPercent:100}),rs.set(i.lines,{overflow:"hidden"}),rs.set(r.lines,{yPercent:100});rs.timeline().add("start").to(t.lines,{yPercent:0,delay:.5,duration:1.5,ease:"power2.inOut",stagger:{each:.1}},"start").to(r.lines,{yPercent:0,delay:.5,duration:1.5,ease:"power2.inOut",stagger:{each:.1}},"start"),rs.set(".freedom-hero__cta",{opacity:0,yPercent:15}),rs.to(".freedom-hero__cta",{opacity:1,yPercent:0,delay:1}),rs.set(".freedom-hero__txt",{opacity:0,yPercent:25}),rs.to(".freedom-hero__txt",{opacity:1,yPercent:0,delay:1})}rs.to(".site__wrap",{opacity:1,delay:.5}),rs.set(".block-map__wrap",{opacity:0,yPercent:10}),rs.to(".block-map__wrap",{opacity:1,yPercent:0,duration:2,delay:.5,ease:"power2.inOut"});const t=document.querySelector(".contactform_cta");if(document.querySelectorAll(".contactform_cta").length>0){t.addEventListener("click",(()=>{if(t.classList.contains("pchecked")){Cd(document.querySelector(".submit-ct input")),rs.to(".privacy-error--dl",{opacity:0})}else rs.to(".privacy-error--dl",{opacity:1})}));document.getElementById("p-checkbox-dl").addEventListener("change",(e=>{!0===e.target.checked&&t.classList.add("pchecked"),!1===e.target.checked&&t.classList.remove("pchecked")}))}let e=!1;document.querySelector("#gmap")&&(document.querySelector("#gmap").addEventListener("mouseenter",(()=>{e=!0})),document.querySelector("#gmap").addEventListener("mouseleave",(()=>{e=!1}))),document.addEventListener("keydown",(function(t){"Meta"==t.key&&1==e&&eT.stop()})),document.addEventListener("keyup",(function(t){"Meta"==t.key&&eT.start()}))}onLeaveCompleted(){}}var Sh=r(181),bh=r.n(Sh);class Dh{constructor(t){this._form=t,this._wr=t.querySelector(".custom-autocomplete"),this._wr&&window.google&&(this.initialized=!0,this._textInput=this._wr.querySelector('input[type="text"]'),this._hiddenInput=this._wr.querySelector('input[type="hidden"]'),this._countrySelect=this._form.querySelector("#nazione"),this._textInput.setAttribute("disabled",!0),window.gpac||(window.gpac=new google.maps.places.AutocompleteService),this.service=window.gpac,this._country=null,this._dbGetPredictions=bh()(this.getPredictions,350),this.addEventListeners())}addEventListeners(){this.listeners={selectChange:this.countryChangeListener.bind(this),textInput:this._dbGetPredictions.bind(this),textBlur:this.blurFocusHandler.bind(this),formSubmit:this.formSubmitPreventListener.bind(this)},this._countrySelect?.addEventListener("change",this.listeners.selectChange),this._textInput?.addEventListener("input",this.listeners.textInput),document.addEventListener("click",this.listeners.textBlur),document.addEventListener("keydown",this.listeners.textBlur),this._form?.addEventListener("submit",this.listeners.formSubmit)}removeEventListeners(){this._countrySelect?.removeEventListener("change",this.listeners.selectChange),this._textInput?.removeEventListener("input",this.listeners.textInput),document.removeEventListener("click",this.listeners.textBlur),document.removeEventListener("keydown",this.listeners.textBlur),this._form?.removeEventListener("submit",this.listeners.formSubmit),this.listeners={}}destroy(){this.initialized&&(this.removeEventListeners(),this._textInput=null,this._countrySelect=null,this._hiddenInput=null,this._dbGetPredictions=null),this._wr=null,this._form=null}formSubmitPreventListener(t){""==this._hiddenInput.value&&(t.preventDefault(),console.warn("[geocity:warning] No City inserted"))}countryChangeListener(t){const e=t.target.querySelectorAll("option[selected]"),r=Array.from(e).find((t=>""!=t.value)),i=r&&r.dataset&&r.dataset.isoValue;this._country=i,this.emptyResultsWrapper(),this._textInput.value="",this._hiddenInput.value="",this._textInput.removeAttribute("disabled")}getPredictions(t){const{value:e}=t.target;this.service.getPlacePredictions({input:e,types:["(cities)"],componentRestrictions:{country:this._country}},this.setResults.bind(this))}setResults(t){this.emptyResultsWrapper();const e=document.createElement("div");if(t&&t.length)t.forEach((t=>{const r=document.createElement("div");r.innerHTML=t.structured_formatting.main_text,r.classList.add("ca-opt"),r.addEventListener("click",(()=>{this._hiddenInput.value=t.structured_formatting.main_text,this._textInput.value=t.structured_formatting.main_text,this.emptyResultsWrapper()}),{once:!0}),e.appendChild(r)}));else{const t=document.createElement("div");t.innerHTML="No results",t.classList.add("ca-opt-no"),e.appendChild(t)}e.setAttribute("data-lenis-prevent",!0),e.classList.add("autocomplete-items"),this._currentResultsWr=e,this._wr.appendChild(e)}emptyResultsWrapper(){this._currentResultsWr&&(this._wr.removeChild(this._currentResultsWr),this._currentResultsWr=null)}blurFocusHandler(t){const{target:e,key:r,code:i}=t;this._wr.contains(e)&&"Tab"!=r&&"Tab"!=i||(this.selectFirstResult(),this.emptyResultsWrapper())}selectFirstResult(){if(this._currentResultsWr){const t=this._currentResultsWr.querySelector(".ca-opt");t?(this._hiddenInput.value=t.innerHTML,this._textInput.value=t.innerHTML):(this._hiddenInput.value=null,this._textInput.value=null)}}}rs.registerPlugin(lu,xc);const Lh=rs.matchMedia();let Ah=!0;Lh.add("(min-width: 992px)",(()=>{Ah=!1}));class kh extends c.Renderer{onEnter(){}onLeave(){}initTitles(){rs.set(".hero-1__title",{opacity:1}),rs.set(".hero-1__sub",{opacity:1}),rs.set(".hero-1__qub",{opacity:1});const t=new lu(".hero-1__title",{type:"lines",linesClass:"lineChild"}),e=new lu(".hero-1__title",{type:"lines",linesClass:"lineParent"}),r=new lu(".hero-1__sub",{type:"lines",linesClass:"lineChild"}),i=new lu(".hero-1__sub",{type:"lines",linesClass:"lineParent"}),s=new lu(".hero-1__qub",{type:"lines",linesClass:"lineChild"}),n=new lu(".hero-1__qub",{type:"lines",linesClass:"lineParent"}),o=document.querySelectorAll(".hero-1__qub__split1.v1"),a=document.querySelectorAll(".hero-1__qub__split2.v1");rs.set(e.lines,{overflow:"hidden"}),rs.set(t.lines,{yPercent:100}),rs.set(i.lines,{overflow:"hidden"}),rs.set(r.lines,{yPercent:100}),rs.set(n.lines,{overflow:"hidden"}),rs.set(s.lines,{yPercent:100});const l=rs.timeline();l.add("start").to(t.lines,{yPercent:0,stagger:{each:.1}},"start").to(r.lines,{yPercent:0,stagger:{each:.1}},"start+=0.3"),l.to(s.lines,{yPercent:0},"start+=0"),l.to(o,{x:0,opacity:1,ease:"power3.out",duration:1.5},"start+=1").to(a,{x:0,opacity:1,ease:"power3.out",duration:1.5},"start+=1")}onEnterCompleted(){if(rs.set(".hero-1__title",{opacity:0}),rs.set(".hero-1__sub",{opacity:0}),rs.set(".hero-1__qub",{opacity:0}),rs.set(".hero-1__qub__split1.v1",{x:-60,opacity:0}),rs.set(".hero-1__qub__split2.v1",{x:60,opacity:0}),1==yu){rs.timeline({onComplete:()=>{eT.start()}}).add("start").to(".header__logo",{opacity:1,duration:2,ease:"power2.inOut"},"start").to(".header__left-menu",{opacity:1,duration:2,ease:"power2.inOut"},"start").to(".header__right-menu",{opacity:1,duration:2,ease:"power2.inOut"},"start"),rs.set(".header__logo",{left:0}),rs.to(".header__menu-toggle",{opacity:1,duration:2,ease:"power2.inOut"}),rs.set(".header__logo svg",{scale:1,y:0,x:()=>{if(Ah)return 0}}),window.addEventListener("endloading",(()=>{this.initTitles()}))}else document.dispatchEvent(new Event("DOMContentLoadedCustom")),this.initTitles();rs.to(".site__wrap",{opacity:1}),document.querySelectorAll(".block-7__banner").length>0&&document.querySelector(".block-7__banner").addEventListener("click",(()=>{rs.to(".block-7__banner",{opacity:0,onComplete:()=>{rs.set(".block-7__banner",{pointerEvents:"none"})}}),rs.to(".iframe-vt",{opacity:1})})),setTimeout((()=>{xc.create({trigger:".hero-1",start:"top top",pinSpacing:!1,pin:".hero-1",markers:!1,end:"+=100%"})}),250),xc.refresh()}onLeaveCompleted(){}}function Ch(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var xh,Rh,Ph,Ih,Fh,Mh={exports:{}};xh=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,Rh=/^(?=([^\/?#]*))\1([^]*)$/,Ph=/(?:\/|^)\.(?=\/)/g,Ih=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,Mh.exports=Fh={buildAbsoluteURL:function(t,e,r){if(r=r||{},t=t.trim(),!(e=e.trim())){if(!r.alwaysNormalize)return t;var i=Fh.parseURL(t);if(!i)throw new Error("Error trying to parse base URL.");return i.path=Fh.normalizePath(i.path),Fh.buildURLFromParts(i)}var s=Fh.parseURL(e);if(!s)throw new Error("Error trying to parse relative URL.");if(s.scheme)return r.alwaysNormalize?(s.path=Fh.normalizePath(s.path),Fh.buildURLFromParts(s)):e;var n=Fh.parseURL(t);if(!n)throw new Error("Error trying to parse base URL.");if(!n.netLoc&&n.path&&"/"!==n.path[0]){var o=Rh.exec(n.path);n.netLoc=o[1],n.path=o[2]}n.netLoc&&!n.path&&(n.path="/");var a={scheme:n.scheme,netLoc:s.netLoc,path:null,params:s.params,query:s.query,fragment:s.fragment};if(!s.netLoc&&(a.netLoc=n.netLoc,"/"!==s.path[0]))if(s.path){var l=n.path,c=l.substring(0,l.lastIndexOf("/")+1)+s.path;a.path=Fh.normalizePath(c)}else a.path=n.path,s.params||(a.params=n.params,s.query||(a.query=n.query));return null===a.path&&(a.path=r.alwaysNormalize?Fh.normalizePath(s.path):s.path),Fh.buildURLFromParts(a)},parseURL:function(t){var e=xh.exec(t);return e?{scheme:e[1]||"",netLoc:e[2]||"",path:e[3]||"",params:e[4]||"",query:e[5]||"",fragment:e[6]||""}:null},normalizePath:function(t){for(t=t.split("").reverse().join("").replace(Ph,"");t.length!==(t=t.replace(Ih,"")).length;);return t.split("").reverse().join("")},buildURLFromParts:function(t){return t.scheme+t.netLoc+t.path+t.params+t.query+t.fragment}};var Oh=Mh.exports;function Nh(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function Bh(t){for(var e=1;e`):jh}(e)}))}const Zh=Xh,Jh=/^(\d+)x(\d+)$/,tf=/(.+?)=(".*?"|.*?)(?:,|$)/g;class ef{constructor(t){"string"==typeof t&&(t=ef.parseAttrList(t)),qh(this,t)}get clientAttrs(){return Object.keys(this).filter((t=>"X-"===t.substring(0,2)))}decimalInteger(t){const e=parseInt(this[t],10);return e>Number.MAX_SAFE_INTEGER?1/0:e}hexadecimalInteger(t){if(this[t]){let e=(this[t]||"0x").slice(2);e=(1&e.length?"0":"")+e;const r=new Uint8Array(e.length/2);for(let t=0;tNumber.MAX_SAFE_INTEGER?1/0:e}decimalFloatingPoint(t){return parseFloat(this[t])}optionalFloat(t,e){const r=this[t];return r?parseFloat(r):e}enumeratedString(t){return this[t]}bool(t){return"YES"===this[t]}decimalResolution(t){const e=Jh.exec(this[t]);if(null!==e)return{width:parseInt(e[1],10),height:parseInt(e[2],10)}}static parseAttrList(t){let e;const r={};for(tf.lastIndex=0;null!==(e=tf.exec(t));){let t=e[2];0===t.indexOf('"')&&t.lastIndexOf('"')===t.length-1&&(t=t.slice(1,-1));r[e[1].trim()]=t}return r}}function rf(t){return"SCTE35-OUT"===t||"SCTE35-IN"===t}class sf{constructor(t,e){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,e){const r=e.attr;for(const e in r)if(Object.prototype.hasOwnProperty.call(t,e)&&t[e]!==r[e]){Zh.warn(`DATERANGE tag attribute: "${e}" does not match for tags with ID: "${t.ID}"`),this._badValueForSameId=e;break}t=qh(new ef({}),r,t)}if(this.attr=t,this._startDate=new Date(t["START-DATE"]),"END-DATE"in this.attr){const t=new Date(this.attr["END-DATE"]);Gh(t.getTime())&&(this._endDate=t)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get startDate(){return this._startDate}get endDate(){if(this._endDate)return this._endDate;const t=this.duration;return null!==t?new Date(this._startDate.getTime()+1e3*t):null}get duration(){if("DURATION"in this.attr){const t=this.attr.decimalFloatingPoint("DURATION");if(Gh(t))return t}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isValid(){return!!this.id&&!this._badValueForSameId&&Gh(this.startDate.getTime())&&(null===this.duration||this.duration>=0)&&(!this.endOnNext||!!this.class)}}class nf{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}}var of="audio",af="video",lf="audiovideo";class cf{constructor(t){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[of]:null,[af]:null,[lf]:null},this.baseurl=t}setByteRange(t,e){const r=t.split("@",2);let i;i=1===r.length?(null==e?void 0:e.byteRangeEndOffset)||0:parseInt(r[1]),this._byteRange=[i,parseInt(r[0])+i]}get byteRange(){return this._byteRange?this._byteRange:[]}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Oh.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(t){this._url=t}}class uf extends cf{constructor(t,e){super(e),this._decryptdata=null,this.rawProgramDateTime=null,this.programDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.stats=new nf,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=t}get decryptdata(){const{levelkeys:t}=this;if(!t&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const t=this.levelkeys.identity;if(t)this._decryptdata=t.getDecryptData(this.sn);else{const t=Object.keys(this.levelkeys);if(1===t.length)return this._decryptdata=this.levelkeys[t[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(null===this.programDateTime)return null;if(!Gh(this.programDateTime))return null;const t=Gh(this.duration)?this.duration:0;return this.programDateTime+1e3*t}get encrypted(){var t;if(null!=(t=this._decryptdata)&&t.encrypted)return!0;if(this.levelkeys){const t=Object.keys(this.levelkeys),e=t.length;if(e>1||1===e&&this.levelkeys[t[0]].encrypted)return!0}return!1}setKeyFormat(t){if(this.levelkeys){const e=this.levelkeys[t];e&&!this._decryptdata&&(this._decryptdata=e.getDecryptData(this.sn))}}abortRequests(){var t,e;null==(t=this.loader)||t.abort(),null==(e=this.keyLoader)||e.abort()}setElementaryStreamInfo(t,e,r,i,s,n=!1){const{elementaryStreams:o}=this,a=o[t];a?(a.startPTS=Math.min(a.startPTS,e),a.endPTS=Math.max(a.endPTS,r),a.startDTS=Math.min(a.startDTS,i),a.endDTS=Math.max(a.endDTS,s)):o[t]={startPTS:e,endPTS:r,startDTS:i,endDTS:s,partial:n}}clearElementaryStreamInfo(){const{elementaryStreams:t}=this;t[of]=null,t[af]=null,t[lf]=null}}class df extends cf{constructor(t,e,r,i,s){super(r),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.stats=new nf,this.duration=t.decimalFloatingPoint("DURATION"),this.gap=t.bool("GAP"),this.independent=t.bool("INDEPENDENT"),this.relurl=t.enumeratedString("URI"),this.fragment=e,this.index=i;const n=t.enumeratedString("BYTERANGE");n&&this.setByteRange(n,s),s&&(this.fragOffset=s.fragOffset+s.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:t}=this;return!!(t.audio||t.video||t.audiovideo)}}class hf{constructor(t){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=t}reloaded(t){if(!t)return this.advanced=!0,void(this.updated=!0);const e=this.lastPartSn-t.lastPartSn,r=this.lastPartIndex-t.lastPartIndex;this.updated=this.endSN!==t.endSN||!!r||!!e||!this.live,this.advanced=this.endSN>t.endSN||e>0||0===e&&r>0,this.updated||this.advanced?this.misses=Math.floor(.6*t.misses):this.misses=t.misses+1,this.availabilityDelay=t.availabilityDelay}get hasProgramDateTime(){return!!this.fragments.length&&Gh(this.fragments[this.fragments.length-1].programDateTime)}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||10}get drift(){const t=this.driftEndTime-this.driftStartTime;if(t>0){return 1e3*(this.driftEnd-this.driftStart)/t}return 1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var t;return null!=(t=this.partList)&&t.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){var t;return null!=(t=this.fragments)&&t.length?this.fragments[this.fragments.length-1].end:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var t;return null!=(t=this.partList)&&t.length?this.partList[this.partList.length-1].index:-1}get lastPartSn(){var t;return null!=(t=this.partList)&&t.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}function ff(t){return Uint8Array.from(atob(t),(t=>t.charCodeAt(0)))}function pf(t){const e=t.split(":");let r=null;if("data"===e[0]&&2===e.length){const t=e[1].split(";"),i=t[t.length-1].split(",");if(2===i.length){const e="base64"===i[0],s=i[1];e?(t.splice(-1,1),r=ff(s)):r=function(t){const e=gf(t).subarray(0,16),r=new Uint8Array(16);return r.set(e,16-e.length),r}(s)}}return r}function gf(t){return Uint8Array.from(unescape(encodeURIComponent(t)),(t=>t.charCodeAt(0)))}const mf="undefined"!=typeof self?self:void 0;var yf={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},vf="org.w3.clearkey",_f="com.apple.streamingkeydelivery",Ef="com.microsoft.playready",Tf="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";function wf(t){switch(t){case _f:return yf.FAIRPLAY;case Ef:return yf.PLAYREADY;case Tf:return yf.WIDEVINE;case vf:return yf.CLEARKEY}}var Sf="1077efecc0b24d02ace33c1e52e2fb4b",bf="e2719d58a985b3c9781ab030af78d30e",Df="9a04f07998404286ab92e65be0885f95",Lf="edef8ba979d64acea3c827dcd51d21ed";function Af(t){return t===Lf?yf.WIDEVINE:t===Df?yf.PLAYREADY:t===Sf||t===bf?yf.CLEARKEY:void 0}function kf(t){switch(t){case yf.FAIRPLAY:return _f;case yf.PLAYREADY:return Ef;case yf.WIDEVINE:return Tf;case yf.CLEARKEY:return vf}}function Cf(t){const{drmSystems:e,widevineLicenseUrl:r}=t,i=e?[yf.FAIRPLAY,yf.WIDEVINE,yf.PLAYREADY,yf.CLEARKEY].filter((t=>!!e[t])):[];return!i[yf.WIDEVINE]&&r&&i.push(yf.WIDEVINE),i}const xf=null!=mf&&null!=(Rf=mf.navigator)&&Rf.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;var Rf;function Pf(t,e,r){return Uint8Array.prototype.slice?t.slice(e,r):new Uint8Array(Array.prototype.slice.call(t,e,r))}const If=(t,e)=>e+10<=t.length&&73===t[e]&&68===t[e+1]&&51===t[e+2]&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128,Ff=(t,e)=>e+10<=t.length&&51===t[e]&&68===t[e+1]&&73===t[e+2]&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128,Mf=(t,e)=>{const r=e;let i=0;for(;If(t,e);){i+=10;i+=Of(t,e+6),Ff(t,e+10)&&(i+=10),e+=i}if(i>0)return t.subarray(r,r+i)},Of=(t,e)=>{let r=0;return r=(127&t[e])<<21,r|=(127&t[e+1])<<14,r|=(127&t[e+2])<<7,r|=127&t[e+3],r},Nf=(t,e)=>If(t,e)&&Of(t,e+6)+10<=t.length-e,Bf=t=>{const e=qf(t);for(let t=0;tt&&"PRIV"===t.key&&"com.apple.streaming.transportStreamTimestamp"===t.info,$f=t=>{const e=String.fromCharCode(t[0],t[1],t[2],t[3]),r=Of(t,4);return{type:e,size:r,data:t.subarray(10,10+r)}},qf=t=>{let e=0;const r=[];for(;If(t,e);){const i=Of(t,e+6);e+=10;const s=e+i;for(;e+8"PRIV"===t.type?Hf(t):"W"===t.type[0]?Kf(t):Vf(t),Hf=t=>{if(t.size<2)return;const e=zf(t.data,!0),r=new Uint8Array(t.data.subarray(e.length+1));return{key:t.type,info:e,data:r.buffer}},Vf=t=>{if(t.size<2)return;if("TXXX"===t.type){let e=1;const r=zf(t.data.subarray(e),!0);e+=r.length+1;const i=zf(t.data.subarray(e));return{key:t.type,info:r,data:i}}const e=zf(t.data.subarray(1));return{key:t.type,data:e}},Kf=t=>{if("WXXX"===t.type){if(t.size<2)return;let e=1;const r=zf(t.data.subarray(e),!0);e+=r.length+1;const i=zf(t.data.subarray(e));return{key:t.type,info:r,data:i}}const e=zf(t.data);return{key:t.type,data:e}},Wf=t=>{if(8===t.data.byteLength){const e=new Uint8Array(t.data),r=1&e[3];let i=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return i/=45,r&&(i+=47721858.84),Math.round(i)}},zf=(t,e=!1)=>{const r=Yf();if(r){const i=r.decode(t);if(e){const t=i.indexOf("\0");return-1!==t?i.substring(0,t):i}return i.replace(/\0/g,"")}const i=t.length;let s,n,o,a="",l=0;for(;l>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:a+=String.fromCharCode(s);break;case 12:case 13:n=t[l++],a+=String.fromCharCode((31&s)<<6|63&n);break;case 14:n=t[l++],o=t[l++],a+=String.fromCharCode((15&s)<<12|(63&n)<<6|63&o)}}return a};let jf;function Yf(){if(!navigator.userAgent.includes("PlayStation 4"))return jf||void 0===self.TextDecoder||(jf=new self.TextDecoder("utf-8")),jf}const Xf=function(t){let e="";for(let r=0;r>24,t[e+1]=r>>16&255,t[e+2]=r>>8&255,t[e+3]=255&r}function op(t,e){const r=[];if(!e.length)return r;const i=t.byteLength;for(let s=0;s1?s+n:i;if(tp(t.subarray(s+4,s+8))===e[0])if(1===e.length)r.push(t.subarray(s+8,o));else{const i=op(t.subarray(s+8,o),e.slice(1));i.length&&Zf.apply(r,i)}s=o}return r}function ap(t){const e=[],r=t[0];let i=8;const s=rp(t,i);i+=4;let n=0,o=0;0===r?(n=rp(t,i),o=rp(t,i+4),i+=8):(n=ip(t,i),o=ip(t,i+8),i+=16),i+=2;let a=t.length+o;const l=ep(t,i);i+=2;for(let r=0;r>>31)return Zh.warn("SIDX has hierarchical references (not supported)"),null;const l=rp(t,r);r+=4,e.push({referenceSize:o,subsegmentDuration:l,info:{duration:l/s,start:a,end:a+o-1}}),a+=o,r+=4,i=r}return{earliestPresentationTime:n,timescale:s,version:r,referencesCount:l,references:e}}function lp(t){const e=[],r=op(t,["moov","trak"]);for(let t=0;t{const r=rp(t,4),i=e[r];i&&(i.default={duration:rp(t,12),flags:rp(t,20)})})),e}function cp(t){const e=t.subarray(8),r=e.subarray(86),i=tp(e.subarray(4,8));let s=i;const n="enca"===i||"encv"===i;if(n){const t=op(e,[i])[0];op(t.subarray("enca"===i?28:78),["sinf"]).forEach((t=>{const e=op(t,["schm"])[0];if(e){const r=tp(e.subarray(4,8));if("cbcs"===r||"cenc"===r){const e=op(t,["frma"])[0];e&&(s=tp(e))}}}))}switch(s){case"avc1":case"avc2":case"avc3":case"avc4":{const t=op(r,["avcC"])[0];s+="."+dp(t[1])+dp(t[2])+dp(t[3]);break}case"mp4a":{const t=op(e,[i])[0],r=op(t.subarray(28),["esds"])[0];if(r&&r.length>12){let t=4;if(3!==r[t++])break;t=up(r,t),t+=2;const e=r[t++];if(128&e&&(t+=2),64&e&&(t+=r[t++]),4!==r[t++])break;t=up(r,t);const i=r[t++];if(64!==i)break;if(s+="."+dp(i),t+=12,5!==r[t++])break;t=up(r,t);const n=r[t++];let o=(248&n)>>3;31===o&&(o+=1+((7&n)<<3)+((224&r[t])>>5)),s+="."+o}break}case"hvc1":case"hev1":{const t=op(r,["hvcC"])[0],e=t[1],i=["","A","B","C"][e>>6],n=31&e,o=rp(t,2),a=(32&e)>>5?"H":"L",l=t[12],c=t.subarray(6,12);s+="."+i+n,s+="."+o.toString(16).toUpperCase(),s+="."+a+l;let u="";for(let t=c.length;t--;){const e=c[t];if(e||u){u="."+e.toString(16).toUpperCase()+u}}s+=u;break}case"dvh1":case"dvhe":{const t=op(r,["dvcC"])[0],e=t[2]>>1&127,i=t[2]<<5&32|t[3]>>3&31;s+="."+hp(e)+"."+hp(i);break}case"vp09":{const t=op(r,["vpcC"])[0],e=t[4],i=t[5],n=t[6]>>4&15;s+="."+hp(e)+"."+hp(i)+"."+hp(n);break}case"av01":{const t=op(r,["av1C"])[0],e=t[1]>>>5,i=31&t[1],n=t[2]>>>7?"H":"M",o=(64&t[2])>>6,a=(32&t[2])>>5,l=2===e&&o?a?12:10:o?10:8,c=(16&t[2])>>4,u=(8&t[2])>>3,d=(4&t[2])>>2,h=3&t[2],f=1,p=1,g=1,m=0;s+="."+e+"."+hp(i)+n+"."+hp(l)+"."+c+"."+u+d+h+"."+hp(f)+"."+hp(p)+"."+hp(g)+"."+m;break}}return{codec:s,encrypted:n}}function up(t,e){const r=e+5;for(;128&t[e++]&&e{const l=a.byteOffset-8;op(a,["traf"]).map((a=>{const c=op(a,["tfdt"]).map((t=>{const e=t[0];let r=rp(t,4);return 1===e&&(r*=Math.pow(2,32),r+=rp(t,8)),r/s}))[0];return void 0!==c&&(t=c),op(a,["tfhd"]).map((c=>{const u=rp(c,4),d=16777215&rp(c,0);let h=0;const f=!!(16&d);let p=0;const g=!!(32&d);let m=8;u===n&&(!!(1&d)&&(m+=8),!!(2&d)&&(m+=4),!!(8&d)&&(h=rp(c,m),m+=4),f&&(p=rp(c,m),m+=4),g&&(m+=4),"video"===e.type&&(o=function(t){if(!t)return!1;const e=t.indexOf("."),r=e<0?t:t.substring(0,e);return"hvc1"===r||"hev1"===r||"dvh1"===r||"dvhe"===r}(e.codec)),op(a,["trun"]).map((n=>{const a=n[0],c=16777215&rp(n,0),u=!!(1&c);let d=0;const f=!!(4&c),g=!!(256&c);let m=0;const y=!!(512&c);let v=0;const _=!!(1024&c),E=!!(2048&c);let T=0;const w=rp(n,4);let S=8;u&&(d=rp(n,S),S+=4),f&&(S+=4);let b=d+l;for(let l=0;l>1&63;return 39===t||40===t}return 6===(31&e)}function vp(t,e,r,i){const s=_p(t);let n=0;n+=e;let o=0,a=0,l=0;for(;n=s.length)break;l=s[n++],o+=l}while(255===l);a=0;do{if(n>=s.length)break;l=s[n++],a+=l}while(255===l);const t=s.length-n;let e=n;if(at){Zh.error(`Malformed SEI payload. ${a} is too small, only ${t} bytes left to parse.`);break}if(4===o){if(181===s[e++]){const t=ep(s,e);if(e+=2,49===t){const t=rp(s,e);if(e+=4,1195456820===t){const t=s[e++];if(3===t){const n=s[e++],a=64&n,l=a?2+3*(31&n):0,c=new Uint8Array(l);if(a){c[0]=n;for(let t=1;t16){const t=[];for(let r=0;r<16;r++){const i=s[e++].toString(16);t.push(1==i.length?"0"+i:i),3!==r&&5!==r&&7!==r&&9!==r||t.push("-")}const n=a-16,l=new Uint8Array(n);for(let t=0;t0?(n=new Uint8Array(4),e.length>0&&new DataView(n.buffer).setUint32(0,e.length,!1)):n=new Uint8Array;const o=new Uint8Array(4);return r&&r.byteLength>0&&new DataView(o.buffer).setUint32(0,r.byteLength,!1),function(t,...e){const r=e.length;let i=8,s=r;for(;s--;)i+=e[s].byteLength;const n=new Uint8Array(i);for(n[0]=i>>24&255,n[1]=i>>16&255,n[2]=i>>8&255,n[3]=255&i,n.set(t,4),s=0,i=8;s>>24;if(0!==s&&1!==s)return{offset:r,size:e};const n=t.buffer,o=Xf(new Uint8Array(n,r+12,16)),a=t.getUint32(28);let l=null,c=null;if(0===s){if(e-32>8*(15-r)&255;return e}(t);return new Sp(this.method,this.uri,"identity",this.keyFormatVersions,e)}const e=pf(this.uri);if(e)switch(this.keyFormat){case Tf:this.pssh=e,e.length>=22&&(this.keyId=e.subarray(e.length-22,e.length-6));break;case Ef:{const t=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Ep(t,null,e);const r=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),i=String.fromCharCode.apply(null,Array.from(r)),s=i.substring(i.indexOf("<"),i.length),n=(new DOMParser).parseFromString(s,"text/xml").getElementsByTagName("KID")[0];if(n){const t=n.childNodes[0]?n.childNodes[0].nodeValue:n.getAttribute("VALUE");if(t){const e=ff(t).subarray(0,16);!function(t){const e=function(t,e,r){const i=t[e];t[e]=t[r],t[r]=i};e(t,0,3),e(t,1,2),e(t,4,5),e(t,6,7)}(e),this.keyId=e}}break}default:{let t=e.subarray(0,16);if(16!==t.length){const e=new Uint8Array(16);e.set(t,16-t.length),t=e}this.keyId=t;break}}if(!this.keyId||16!==this.keyId.byteLength){let t=wp[this.uri];if(!t){const e=Object.keys(wp).length%Number.MAX_SAFE_INTEGER;t=new Uint8Array(16);new DataView(t.buffer,12,4).setUint32(0,e),wp[this.uri]=t}this.keyId=t}return this}}const bp=/\{\$([a-zA-Z0-9-_]+)\}/g;function Dp(t){return bp.test(t)}function Lp(t,e,r){if(null!==t.variableList||t.hasVariableRefs)for(let i=r.length;i--;){const s=r[i],n=e[s];n&&(e[s]=Ap(t,n))}}function Ap(t,e){if(null!==t.variableList||t.hasVariableRefs){const r=t.variableList;return e.replace(bp,(e=>{const i=e.substring(2,e.length-1),s=null==r?void 0:r[i];return void 0===s?(t.playlistParsingError||(t.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${i}"`)),e):s}))}return e}function kp(t,e,r){let i,s,n=t.variableList;if(n||(t.variableList=n={}),"QUERYPARAM"in e){i=e.QUERYPARAM;try{const t=new self.URL(r).searchParams;if(!t.has(i))throw new Error(`"${i}" does not match any query parameter in URI: "${r}"`);s=t.get(i)}catch(e){t.playlistParsingError||(t.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${e.message}`))}}else i=e.NAME,s=e.VALUE;i in n?t.playlistParsingError||(t.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${i}"`)):n[i]=s||""}function Cp(t,e,r){const i=e.IMPORT;if(r&&i in r){let e=t.variableList;e||(t.variableList=e={}),e[i]=r[i]}else t.playlistParsingError||(t.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${i}"`))}function xp(t=!0){if("undefined"==typeof self)return;return(t||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}const Rp={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function Pp(t,e,r=!0){return!t.split(",").some((t=>!Ip(t,e,r)))}function Ip(t,e,r=!0){var i;const s=xp(r);return null!=(i=null==s?void 0:s.isTypeSupported(Fp(t,e)))&&i}function Fp(t,e){return`${e}/mp4;codecs="${t}"`}function Mp(t){if(t){const e=t.substring(0,4);return Rp.video[e]}return 2}function Op(t){return t.split(",").reduce(((t,e)=>{const r=Rp.video[e];return r?(2*r+t)/(t?3:2):(Rp.audio[e]+t)/(t?2:1)}),0)}const Np={};const Bp=/flac|opus/i;function Up(t,e=!0){return t.replace(Bp,(t=>function(t,e=!0){if(Np[t])return Np[t];const r={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[t];for(let i=0;i0&&i.length({id:t.attrs.AUDIO,audioCodec:t.audioCodec}))),SUBTITLES:n.map((t=>({id:t.attrs.SUBTITLES,textCodec:t.textCodec}))),"CLOSED-CAPTIONS":[]};let a=0;for(Gp.lastIndex=0;null!==(i=Gp.exec(t));){const t=new ef(i[1]),n=t.TYPE;if(n){const i=o[n],l=s[n]||[];s[n]=l,Lp(r,t,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);const c=t.LANGUAGE,u=t["ASSOC-LANGUAGE"],d=t.CHANNELS,h=t.CHARACTERISTICS,f=t["INSTREAM-ID"],p={attrs:t,bitrate:0,id:a++,groupId:t["GROUP-ID"]||"",name:t.NAME||c||"",type:n,default:t.bool("DEFAULT"),autoselect:t.bool("AUTOSELECT"),forced:t.bool("FORCED"),lang:c,url:t.URI?Wp.resolve(t.URI,e):""};if(u&&(p.assocLang=u),d&&(p.channels=d),h&&(p.characteristics=h),f&&(p.instreamId=f),null!=i&&i.length){const t=Wp.findGroup(i,p.groupId)||i[0];Xp(p,t,"audioCodec"),Xp(p,t,"textCodec")}l.push(p)}}return s}static parseLevelPlaylist(t,e,r,i,s,n){const o=new hf(e),a=o.fragments;let l,c,u,d=null,h=0,f=0,p=0,g=0,m=null,y=new uf(i,e),v=-1,_=!1,E=null;for(Vp.lastIndex=0,o.m3u8=t,o.hasVariableRefs=Dp(t);null!==(l=Vp.exec(t));){_&&(_=!1,y=new uf(i,e),y.start=p,y.sn=h,y.cc=g,y.level=r,d&&(y.initSegment=d,y.rawProgramDateTime=d.rawProgramDateTime,d.rawProgramDateTime=null,E&&(y.setByteRange(E),E=null)));const t=l[1];if(t){y.duration=parseFloat(t);const e=(" "+l[2]).slice(1);y.title=e||null,y.tagList.push(e?["INF",t,e]:["INF",t])}else if(l[3]){if(Gh(y.duration)){y.start=p,u&&Jp(y,u,o),y.sn=h,y.level=r,y.cc=g,a.push(y);const t=(" "+l[3]).slice(1);y.relurl=Ap(o,t),Qp(y,m),m=y,p+=y.duration,h++,f=0,_=!0}}else if(l[4]){const t=(" "+l[4]).slice(1);m?y.setByteRange(t,m):y.setByteRange(t)}else if(l[5])y.rawProgramDateTime=(" "+l[5]).slice(1),y.tagList.push(["PROGRAM-DATE-TIME",y.rawProgramDateTime]),-1===v&&(v=a.length);else{if(l=l[0].match(Kp),!l){Zh.warn("No matches on slow regex match for level playlist!");continue}for(c=1;c0&&t.bool("CAN-SKIP-DATERANGES"),o.partHoldBack=t.optionalFloat("PART-HOLD-BACK",0),o.holdBack=t.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{const t=new ef(s);o.partTarget=t.decimalFloatingPoint("PART-TARGET");break}case"PART":{let t=o.partList;t||(t=o.partList=[]);const r=f>0?t[t.length-1]:void 0,i=f++,n=new ef(s);Lp(o,n,["BYTERANGE","URI"]);const a=new df(n,y,e,i,r);t.push(a),y.duration+=a.duration;break}case"PRELOAD-HINT":{const t=new ef(s);Lp(o,t,["URI"]),o.preloadHint=t;break}case"RENDITION-REPORT":{const t=new ef(s);Lp(o,t,["URI"]),o.renditionReports=o.renditionReports||[],o.renditionReports.push(t);break}default:Zh.warn(`line parsed but not handled: ${l}`)}}}m&&!m.relurl?(a.pop(),p-=m.duration,o.partList&&(o.fragmentHint=m)):o.partList&&(Qp(y,m),y.cc=g,o.fragmentHint=y,u&&Jp(y,u,o));const T=a.length,w=a[0],S=a[T-1];if(p+=o.skippedSegments*o.targetduration,p>0&&T&&S){o.averagetargetduration=p/T;const t=S.sn;o.endSN="initSegment"!==t?t:0,o.live||(S.endList=!0),w&&(o.startCC=w.cc)}else o.endSN=0,o.startCC=0;return o.fragmentHint&&(p+=o.fragmentHint.duration),o.totalduration=p,o.endCC=g,v>0&&function(t,e){let r=t[e];for(let i=e;i--;){const e=t[i];if(!e)return;e.programDateTime=r.programDateTime-1e3*e.duration,r=e}}(a,v),o}}function zp(t,e,r){var i,s;const n=new ef(t);Lp(r,n,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);const o=null!=(i=n.METHOD)?i:"",a=n.URI,l=n.hexadecimalInteger("IV"),c=n.KEYFORMATVERSIONS,u=null!=(s=n.KEYFORMAT)?s:"identity";a&&n.IV&&!l&&Zh.error(`Invalid IV: ${n.IV}`);const d=a?Wp.resolve(a,e):"",h=(c||"1").split("/").map(Number).filter(Number.isFinite);return new Sp(o,d,u,h,l)}function jp(t){const e=new ef(t).decimalFloatingPoint("TIME-OFFSET");return Gh(e)?e:null}function Yp(t,e){let r=(t||"").split(/[ ,]+/).filter((t=>t));["video","audio","text"].forEach((t=>{const i=r.filter((e=>function(t,e){const r=Rp[e];return!!r&&!!r[t.slice(0,4)]}(e,t)));i.length&&(e[`${t}Codec`]=i.join(","),r=r.filter((t=>-1===i.indexOf(t))))})),e.unknownCodecs=r}function Xp(t,e,r){const i=e[r];i&&(t[r]=i)}function Qp(t,e){t.rawProgramDateTime?t.programDateTime=Date.parse(t.rawProgramDateTime):null!=e&&e.programDateTime&&(t.programDateTime=e.endProgramDateTime),Gh(t.programDateTime)||(t.programDateTime=null,t.rawProgramDateTime=null)}function Zp(t,e,r,i){t.relurl=e.URI,e.BYTERANGE&&t.setByteRange(e.BYTERANGE),t.level=r,t.sn="initSegment",i&&(t.levelkeys=i),t.initSegment=null}function Jp(t,e,r){t.levelkeys=e;const{encryptedFragments:i}=r;i.length&&i[i.length-1].levelkeys===e||!Object.keys(e).some((t=>e[t].isCommonEncryption))||i.push(t)}var tg="manifest",eg="level",rg="audioTrack",ig="subtitleTrack",sg="main",ng="audio",og="subtitle";function ag(t){const{type:e}=t;switch(e){case rg:return ng;case ig:return og;default:return sg}}function lg(t,e){let r=t.url;return void 0!==r&&0!==r.indexOf("data:")||(r=e.url),r}class cg{constructor(t){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=t,this.registerListeners()}startLoad(t){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:t}=this;t.on(Kh.MANIFEST_LOADING,this.onManifestLoading,this),t.on(Kh.LEVEL_LOADING,this.onLevelLoading,this),t.on(Kh.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.on(Kh.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}unregisterListeners(){const{hls:t}=this;t.off(Kh.MANIFEST_LOADING,this.onManifestLoading,this),t.off(Kh.LEVEL_LOADING,this.onLevelLoading,this),t.off(Kh.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.off(Kh.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}createInternalLoader(t){const e=this.hls.config,r=e.pLoader,i=e.loader,s=new(r||i)(e);return this.loaders[t.type]=s,s}getInternalLoader(t){return this.loaders[t.type]}resetInternalLoader(t){this.loaders[t]&&delete this.loaders[t]}destroyInternalLoaders(){for(const t in this.loaders){const e=this.loaders[t];e&&e.destroy(),this.resetInternalLoader(t)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(t,e){const{url:r}=e;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:tg,url:r,deliveryDirectives:null})}onLevelLoading(t,e){const{id:r,level:i,pathwayId:s,url:n,deliveryDirectives:o}=e;this.load({id:r,level:i,pathwayId:s,responseType:"text",type:eg,url:n,deliveryDirectives:o})}onAudioTrackLoading(t,e){const{id:r,groupId:i,url:s,deliveryDirectives:n}=e;this.load({id:r,groupId:i,level:null,responseType:"text",type:rg,url:s,deliveryDirectives:n})}onSubtitleTrackLoading(t,e){const{id:r,groupId:i,url:s,deliveryDirectives:n}=e;this.load({id:r,groupId:i,level:null,responseType:"text",type:ig,url:s,deliveryDirectives:n})}load(t){var e;const r=this.hls.config;let i,s=this.getInternalLoader(t);if(s){const e=s.context;if(e&&e.url===t.url&&e.level===t.level)return void Zh.trace("[playlist-loader]: playlist request ongoing");Zh.log(`[playlist-loader]: aborting previous loader for type: ${t.type}`),s.abort()}if(i=t.type===tg?r.manifestLoadPolicy.default:qh({},r.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),s=this.createInternalLoader(t),Gh(null==(e=t.deliveryDirectives)?void 0:e.part)){let e;if(t.type===eg&&null!==t.level?e=this.hls.levels[t.level].details:t.type===rg&&null!==t.id?e=this.hls.audioTracks[t.id].details:t.type===ig&&null!==t.id&&(e=this.hls.subtitleTracks[t.id].details),e){const t=e.partTarget,r=e.targetduration;if(t&&r){const e=1e3*Math.max(3*t,.8*r);i=qh({},i,{maxTimeToFirstByteMs:Math.min(e,i.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(e,i.maxTimeToFirstByteMs)})}}}const n=i.errorRetry||i.timeoutRetry||{},o={loadPolicy:i,timeout:i.maxLoadTimeMs,maxRetry:n.maxNumRetry||0,retryDelay:n.retryDelayMs||0,maxRetryDelay:n.maxRetryDelayMs||0},a={onSuccess:(t,e,r,i)=>{const s=this.getInternalLoader(r);this.resetInternalLoader(r.type);const n=t.data;0===n.indexOf("#EXTM3U")?(e.parsing.start=performance.now(),Wp.isMediaPlaylist(n)?this.handleTrackOrLevelPlaylist(t,e,r,i||null,s):this.handleMasterPlaylist(t,e,r,i)):this.handleManifestParsingError(t,r,new Error("no EXTM3U delimiter"),i||null,e)},onError:(t,e,r,i)=>{this.handleNetworkError(e,r,!1,t,i)},onTimeout:(t,e,r)=>{this.handleNetworkError(e,r,!0,void 0,t)}};s.load(t,o,a)}handleMasterPlaylist(t,e,r,i){const s=this.hls,n=t.data,o=lg(t,r),a=Wp.parseMasterPlaylist(n,o);if(a.playlistParsingError)return void this.handleManifestParsingError(t,r,a.playlistParsingError,i,e);const{contentSteering:l,levels:c,sessionData:u,sessionKeys:d,startTimeOffset:h,variableList:f}=a;this.variableList=f;const{AUDIO:p=[],SUBTITLES:g,"CLOSED-CAPTIONS":m}=Wp.parseMasterPlaylistMedia(n,o,a);if(p.length){p.some((t=>!t.url))||!c[0].audioCodec||c[0].attrs.AUDIO||(Zh.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),p.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new ef({}),bitrate:0,url:""}))}s.trigger(Kh.MANIFEST_LOADED,{levels:c,audioTracks:p,subtitles:g,captions:m,contentSteering:l,url:o,stats:e,networkDetails:i,sessionData:u,sessionKeys:d,startTimeOffset:h,variableList:f})}handleTrackOrLevelPlaylist(t,e,r,i,s){const n=this.hls,{id:o,level:a,type:l}=r,c=lg(t,r),u=Gh(a)?a:Gh(o)?o:0,d=ag(r),h=Wp.parseLevelPlaylist(t.data,c,u,d,0,this.variableList);if(l===tg){const t={attrs:new ef({}),bitrate:0,details:h,name:"",url:c};n.trigger(Kh.MANIFEST_LOADED,{levels:[t],audioTracks:[],url:c,stats:e,networkDetails:i,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}e.parsing.end=performance.now(),r.levelDetails=h,this.handlePlaylistLoaded(h,t,e,r,i,s)}handleManifestParsingError(t,e,r,i,s){this.hls.trigger(Kh.ERROR,{type:Wh.NETWORK_ERROR,details:zh.MANIFEST_PARSING_ERROR,fatal:e.type===tg,url:t.url,err:r,error:r,reason:r.message,response:t,context:e,networkDetails:i,stats:s})}handleNetworkError(t,e,r=!1,i,s){let n=`A network ${r?"timeout":"error"+(i?" (status "+i.code+")":"")} occurred while loading ${t.type}`;t.type===eg?n+=`: ${t.level} id: ${t.id}`:t.type!==rg&&t.type!==ig||(n+=` id: ${t.id} group-id: "${t.groupId}"`);const o=new Error(n);Zh.warn(`[playlist-loader]: ${n}`);let a=zh.UNKNOWN,l=!1;const c=this.getInternalLoader(t);switch(t.type){case tg:a=r?zh.MANIFEST_LOAD_TIMEOUT:zh.MANIFEST_LOAD_ERROR,l=!0;break;case eg:a=r?zh.LEVEL_LOAD_TIMEOUT:zh.LEVEL_LOAD_ERROR,l=!1;break;case rg:a=r?zh.AUDIO_TRACK_LOAD_TIMEOUT:zh.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case ig:a=r?zh.SUBTITLE_TRACK_LOAD_TIMEOUT:zh.SUBTITLE_LOAD_ERROR,l=!1}c&&this.resetInternalLoader(t.type);const u={type:Wh.NETWORK_ERROR,details:a,fatal:l,url:t.url,loader:c,context:t,error:o,networkDetails:e,stats:s};if(i){const r=(null==e?void 0:e.url)||t.url;u.response=Bh({url:r,data:void 0},i)}this.hls.trigger(Kh.ERROR,u)}handlePlaylistLoaded(t,e,r,i,s,n){const o=this.hls,{type:a,level:l,id:c,groupId:u,deliveryDirectives:d}=i,h=lg(e,i),f=ag(i),p="number"==typeof i.level&&f===sg?l:void 0;if(!t.fragments.length){const t=new Error("No Segments found in Playlist");return void o.trigger(Kh.ERROR,{type:Wh.NETWORK_ERROR,details:zh.LEVEL_EMPTY_ERROR,fatal:!1,url:h,error:t,reason:t.message,response:e,context:i,level:p,parent:f,networkDetails:s,stats:r})}t.targetduration||(t.playlistParsingError=new Error("Missing Target Duration"));const g=t.playlistParsingError;if(g)o.trigger(Kh.ERROR,{type:Wh.NETWORK_ERROR,details:zh.LEVEL_PARSING_ERROR,fatal:!1,url:h,error:g,reason:g.message,response:e,context:i,level:p,parent:f,networkDetails:s,stats:r});else switch(t.live&&n&&(n.getCacheAge&&(t.ageHeader=n.getCacheAge()||0),n.getCacheAge&&!isNaN(t.ageHeader)||(t.ageHeader=0)),a){case tg:case eg:o.trigger(Kh.LEVEL_LOADED,{details:t,level:p||0,id:c||0,stats:r,networkDetails:s,deliveryDirectives:d});break;case rg:o.trigger(Kh.AUDIO_TRACK_LOADED,{details:t,id:c||0,groupId:u||"",stats:r,networkDetails:s,deliveryDirectives:d});break;case ig:o.trigger(Kh.SUBTITLE_TRACK_LOADED,{details:t,id:c||0,groupId:u||"",stats:r,networkDetails:s,deliveryDirectives:d})}}}function ug(t,e){let r;try{r=new Event("addtrack")}catch(t){r=document.createEvent("Event"),r.initEvent("addtrack",!1,!1)}r.track=t,e.dispatchEvent(r)}function dg(t,e){const r=t.mode;if("disabled"===r&&(t.mode="hidden"),t.cues&&!t.cues.getCueById(e.id))try{if(t.addCue(e),!t.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(r){Zh.debug(`[texttrack-utils]: ${r}`);try{const r=new self.TextTrackCue(e.startTime,e.endTime,e.text);r.id=e.id,t.addCue(r)}catch(t){Zh.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${t}`)}}"disabled"===r&&(t.mode=r)}function hg(t){const e=t.mode;if("disabled"===e&&(t.mode="hidden"),t.cues)for(let e=t.cues.length;e--;)t.removeCue(t.cues[e]);"disabled"===e&&(t.mode=e)}function fg(t,e,r,i){const s=t.mode;if("disabled"===s&&(t.mode="hidden"),t.cues&&t.cues.length>0){const s=function(t,e,r){const i=[],s=function(t,e){if(et[r].endTime)return-1;let i=0,s=r;for(;i<=s;){const n=Math.floor((s+i)/2);if(et[n].startTime&&i-1)for(let n=s,o=t.length;n=e&&s.endTime<=r)i.push(s);else if(s.startTime>r)return i}return i}(t.cues,e,r);for(let e=0;e{const t=vg();try{t&&new t(0,Number.POSITIVE_INFINITY,"")}catch(t){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function Tg(t,e){return t.getTime()/1e3-e}class wg{constructor(t){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=t,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null}_registerListeners(){const{hls:t}=this;t.on(Kh.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(Kh.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(Kh.MANIFEST_LOADING,this.onManifestLoading,this),t.on(Kh.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),t.on(Kh.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(Kh.LEVEL_UPDATED,this.onLevelUpdated,this)}_unregisterListeners(){const{hls:t}=this;t.off(Kh.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(Kh.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(Kh.MANIFEST_LOADING,this.onManifestLoading,this),t.off(Kh.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),t.off(Kh.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(Kh.LEVEL_UPDATED,this.onLevelUpdated,this)}onMediaAttached(t,e){this.media=e.media}onMediaDetaching(){this.id3Track&&(hg(this.id3Track),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(t){const e=this.getID3Track(t.textTracks);return e.mode="hidden",e}getID3Track(t){if(this.media){for(let e=0;eEg&&(i=Eg);i-r<=0&&(i=r+.25);for(let t=0;tt.type===gg&&a:"video"===i?t=>t.type===yg&&o:t=>t.type===gg&&a||t.type===yg&&o,fg(s,e,r,t)}}onLevelUpdated(t,{details:e}){if(!this.media||!e.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{dateRangeCuesAppended:r,id3Track:i}=this,{dateRanges:s}=e,n=Object.keys(s);if(i){const t=Object.keys(r).filter((t=>!n.includes(t)));for(let e=t.length;e--;){const s=t[e];Object.keys(r[s].cues).forEach((t=>{i.removeCue(r[s].cues[t])})),delete r[s]}}const o=e.fragments[e.fragments.length-1];if(0===n.length||!Gh(null==o?void 0:o.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const a=o.programDateTime/1e3-o.start,l=vg();for(let t=0;t{if(e!==i.id){const r=s[e];if(r.class===i.class&&r.startDate>i.startDate&&(!t||i.startDatethis.timeupdate(),this.hls=t,this.config=t.config,this.registerListeners()}get latency(){return this._latency||0}get maxLatency(){const{config:t,levelDetails:e}=this;return void 0!==t.liveMaxLatencyDuration?t.liveMaxLatencyDuration:e?t.liveMaxLatencyDurationCount*e.targetduration:0}get targetLatency(){const{levelDetails:t}=this;if(null===t)return null;const{holdBack:e,partHoldBack:r,targetduration:i}=t,{liveSyncDuration:s,liveSyncDurationCount:n,lowLatencyMode:o}=this.config,a=this.hls.userConfig;let l=o&&r||e;(a.liveSyncDuration||a.liveSyncDurationCount||0===l)&&(l=void 0!==s?s:n*i);const c=i;return l+Math.min(1*this.stallCount,c)}get liveSyncPosition(){const t=this.estimateLiveEdge(),e=this.targetLatency,r=this.levelDetails;if(null===t||null===e||null===r)return null;const i=r.edge,s=t-e-this.edgeStalled,n=i-r.totalduration,o=i-(this.config.lowLatencyMode&&r.partTarget||r.targetduration);return Math.min(Math.max(n,s),o)}get drift(){const{levelDetails:t}=this;return null===t?1:t.drift}get edgeStalled(){const{levelDetails:t}=this;if(null===t)return 0;const e=3*(this.config.lowLatencyMode&&t.partTarget||t.targetduration);return Math.max(t.age-e,0)}get forwardBufferLength(){const{media:t,levelDetails:e}=this;if(!t||!e)return 0;const r=t.buffered.length;return(r?t.buffered.end(r-1):e.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null}registerListeners(){this.hls.on(Kh.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Kh.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(Kh.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(Kh.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(Kh.ERROR,this.onError,this)}unregisterListeners(){this.hls.off(Kh.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Kh.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(Kh.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(Kh.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(Kh.ERROR,this.onError,this)}onMediaAttached(t,e){this.media=e.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)}onManifestLoading(){this.levelDetails=null,this._latency=null,this.stallCount=0}onLevelUpdated(t,{details:e}){this.levelDetails=e,e.advanced&&this.timeupdate(),!e.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)}onError(t,e){var r;e.details===zh.BUFFER_STALLED_ERROR&&(this.stallCount++,null!=(r=this.levelDetails)&&r.live&&Zh.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))}timeupdate(){const{media:t,levelDetails:e}=this;if(!t||!e)return;this.currentTime=t.currentTime;const r=this.computeLatency();if(null===r)return;this._latency=r;const{lowLatencyMode:i,maxLiveSyncPlaybackRate:s}=this.config;if(!i||1===s||!e.live)return;const n=this.targetLatency;if(null===n)return;const o=r-n;if(o.05&&this.forwardBufferLength>1){const e=Math.min(2,Math.max(1,s)),r=Math.round(2/(1+Math.exp(-.75*o-this.edgeStalled))*20)/20;t.playbackRate=Math.min(e,Math.max(1,r))}else 1!==t.playbackRate&&0!==t.playbackRate&&(t.playbackRate=1)}estimateLiveEdge(){const{levelDetails:t}=this;return null===t?null:t.edge+t.age}computeLatency(){const t=this.estimateLiveEdge();return null===t?null:t-this.currentTime}}const bg=["NONE","TYPE-0","TYPE-1",null];const Dg=["SDR","PQ","HLG"];var Lg="",Ag="YES",kg="v2";function Cg(t){const{canSkipUntil:e,canSkipDateRanges:r,age:i}=t;return e&&i!!t)).map((t=>t.substring(0,4))).join(","),this.addGroupId("audio",t.attrs.AUDIO),this.addGroupId("text",t.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(t){return Pg(this._audioGroups,t)}hasSubtitleGroup(t){return Pg(this._subtitleGroups,t)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(t,e){if(e)if("audio"===t){let t=this._audioGroups;t||(t=this._audioGroups=[]),-1===t.indexOf(e)&&t.push(e)}else if("text"===t){let t=this._subtitleGroups;t||(t=this._subtitleGroups=[]),-1===t.indexOf(e)&&t.push(e)}}get urlId(){return 0}set urlId(t){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var t;return null==(t=this.audioGroups)?void 0:t[0]}get textGroupId(){var t;return null==(t=this.subtitleGroups)?void 0:t[0]}addFallback(){}}function Pg(t,e){return!(!e||!t)&&-1!==t.indexOf(e)}function Ig(t,e){const r=e.startPTS;if(Gh(r)){let i,s=0;e.sn>t.sn?(s=r-t.start,i=t):(s=t.start-r,i=e),i.duration!==s&&(i.duration=s)}else if(e.sn>t.sn){t.cc===e.cc&&t.minEndPTS?e.start=t.start+(t.minEndPTS-t.start):e.start=t.start+t.duration}else e.start=Math.max(t.start-e.duration,0)}function Fg(t,e,r,i,s,n){i-r<=0&&(Zh.warn("Fragment should have a positive duration",e),i=r+e.duration,n=s+e.duration);let o=r,a=i;const l=e.startPTS,c=e.endPTS;if(Gh(l)){const t=Math.abs(l-r);Gh(e.deltaPTS)?e.deltaPTS=Math.max(t,e.deltaPTS):e.deltaPTS=t,o=Math.max(r,l),r=Math.min(r,l),s=Math.min(s,e.startDTS),a=Math.min(i,c),i=Math.max(i,c),n=Math.max(n,e.endDTS)}const u=r-e.start;0!==e.start&&(e.start=r),e.duration=i-e.start,e.startPTS=r,e.maxStartPTS=o,e.startDTS=s,e.endPTS=i,e.minEndPTS=a,e.endDTS=n;const d=e.sn;if(!t||dt.endSN)return 0;let h;const f=d-t.startSN,p=t.fragments;for(p[f]=e,h=f;h>0;h--)Ig(p[h],p[h-1]);for(h=f;h=0;t--){const e=i[t].initSegment;if(e){r=e;break}}t.fragmentHint&&delete t.fragmentHint.endPTS;let s,n=0;if(function(t,e,r){const i=e.skippedSegments,s=Math.max(t.startSN,e.startSN)-e.startSN,n=(t.fragmentHint?1:0)+(i?e.endSN:Math.min(t.endSN,e.endSN))-e.startSN,o=e.startSN-t.startSN,a=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,l=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments;for(let t=s;t<=n;t++){const s=l[o+t];let n=a[t];i&&!n&&t{t.relurl&&(n=t.cc-i.cc),Gh(t.startPTS)&&Gh(t.endPTS)&&(i.start=i.startPTS=t.startPTS,i.startDTS=t.startDTS,i.maxStartPTS=t.maxStartPTS,i.endPTS=t.endPTS,i.endDTS=t.endDTS,i.minEndPTS=t.minEndPTS,i.duration=t.endPTS-t.startPTS,i.duration&&(s=i),e.PTSKnown=e.alignedSliding=!0),i.elementaryStreams=t.elementaryStreams,i.loader=t.loader,i.stats=t.stats,t.initSegment&&(i.initSegment=t.initSegment,r=t.initSegment)})),r){(e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments).forEach((t=>{var e;!t||t.initSegment&&t.initSegment.relurl!==(null==(e=r)?void 0:e.relurl)||(t.initSegment=r)}))}if(e.skippedSegments)if(e.deltaUpdateFailed=e.fragments.some((t=>!t)),e.deltaUpdateFailed){Zh.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let t=e.skippedSegments;t--;)e.fragments.shift();e.startSN=e.fragments[0].sn,e.startCC=e.fragments[0].cc}else e.canSkipDateRanges&&(e.dateRanges=function(t,e,r){const i=qh({},t);r&&r.forEach((t=>{delete i[t]}));return Object.keys(e).forEach((t=>{const r=new sf(e[t].attr,i[t]);r.isValid?i[t]=r:Zh.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(e[t].attr)}"`)})),i}(t.dateRanges,e.dateRanges,e.recentlyRemovedDateranges));const o=e.fragments;if(n){Zh.warn("discontinuity sliding from playlist, take drift into account");for(let t=0;t{e.elementaryStreams=t.elementaryStreams,e.stats=t.stats})),s?Fg(e,s,s.startPTS,s.endPTS,s.startDTS,s.endDTS):Og(t,e),o.length&&(e.totalduration=e.edge-o[0].start),e.driftStartTime=t.driftStartTime,e.driftStart=t.driftStart;const a=e.advancedDateTime;if(e.advanced&&a){const t=e.edge;e.driftStart||(e.driftStartTime=a,e.driftStart=t),e.driftEndTime=a,e.driftEnd=t}else e.driftEndTime=t.driftEndTime,e.driftEnd=t.driftEnd,e.advancedDateTime=t.advancedDateTime}function Og(t,e){const r=e.startSN+e.skippedSegments-t.startSN,i=t.fragments;r<0||r>=i.length||Ng(e,i[r].start)}function Ng(t,e){if(e){const r=t.fragments;for(let i=t.skippedSegments;i{const{details:r}=t;null!=r&&r.fragments&&r.fragments.forEach((t=>{t.level=e}))}))}function qg(t){switch(t.details){case zh.FRAG_LOAD_TIMEOUT:case zh.KEY_LOAD_TIMEOUT:case zh.LEVEL_LOAD_TIMEOUT:case zh.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Gg(t,e){const r=qg(e);return t.default[(r?"timeout":"error")+"Retry"]}function Hg(t,e){const r="linear"===t.backoff?1:Math.pow(2,e);return Math.min(r*t.retryDelayMs,t.maxRetryDelayMs)}function Vg(t){return Bh(Bh({},t),{errorRetry:null,timeoutRetry:null})}function Kg(t,e,r,i){if(!t)return!1;const s=null==i?void 0:i.code,n=e499)}(s)||!!r);return t.shouldRetry?t.shouldRetry(t,e,r,i,n):n}const Wg=function(t,e){let r=0,i=t.length-1,s=null,n=null;for(;r<=i;){s=(r+i)/2|0,n=t[s];const o=e(n);if(o>0)r=s+1;else{if(!(o<0))return n;i=s-1}}return null};function zg(t,e,r=0,i=0,s=.005){let n=null;if(t){n=e[t.sn-e[0].sn+1]||null;const i=t.endDTS-r;i>0&&i<15e-7&&(r+=15e-7)}else 0===r&&0===e[0].start&&(n=e[0]);if(n&&((!t||t.level===n.level)&&0===jg(r,i,n)||function(t,e,r){if(e&&0===e.start&&e.level0){const i=e.tagList.reduce(((t,e)=>("INF"===e[0]&&(t+=parseFloat(e[1])),t)),r);return t.start<=i}return!1}(n,t,Math.min(s,i))))return n;const o=Wg(e,jg.bind(null,r,i));return!o||o===t&&n?n:o}function jg(t=0,e=0,r){if(r.start<=t&&r.start+r.duration>t)return 0;const i=Math.min(e,r.duration+(r.deltaPTS?r.deltaPTS:0));return r.start+r.duration-i<=t?1:r.start-i>t&&r.start?-1:0}function Yg(t,e,r){const i=1e3*Math.min(e,r.duration+(r.deltaPTS?r.deltaPTS:0));return(r.endProgramDateTime||0)-i>t}var Xg=0,Qg=2,Zg=3,Jg=5,tm=0,em=1,rm=2;class im{constructor(t,e){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.log=void 0,this.warn=void 0,this.log=Zh.log.bind(Zh,`${e}:`),this.warn=Zh.warn.bind(Zh,`${e}:`),this.hls=t}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){-1!==this.timer&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(t,e,r){const i=null==e?void 0:e.renditionReports;if(i){let s=-1;for(let r=0;r=0&&t>e.partTarget&&(o+=1)}const a=r&&Cg(r);return new xg(n,o>=0?o:void 0,a)}}}loadPlaylist(t){-1===this.requestScheduled&&(this.requestScheduled=self.performance.now())}shouldLoadPlaylist(t){return this.canLoad&&!!t&&!!t.url&&(!t.details||t.details.live)}shouldReloadPlaylist(t){return-1===this.timer&&-1===this.requestScheduled&&this.shouldLoadPlaylist(t)}playlistLoaded(t,e,r){const{details:i,stats:s}=e,n=self.performance.now(),o=s.loading.first?Math.max(0,n-s.loading.first):0;if(i.advancedDateTime=Date.now()-o,i.live||null!=r&&r.live){if(i.reloaded(r),r&&this.log(`live playlist ${t} ${i.advanced?"REFRESHED "+i.lastPartSn+"-"+i.lastPartIndex:i.updated?"UPDATED":"MISSED"}`),r&&i.fragments.length>0&&Mg(r,i),!this.canLoad||!i.live)return;let o,a,l;if(i.canBlockReload&&i.endSN&&i.advanced){const t=this.hls.config.lowLatencyMode,s=i.lastPartSn,n=i.endSN,c=i.lastPartIndex,u=s===n;-1!==c?(a=u?n+1:s,l=u?t?0:c:c+1):a=n+1;const d=i.age,h=d+i.ageHeader;let f=Math.min(h-i.partTarget,1.5*i.targetduration);if(f>0){if(r&&f>r.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${r.tuneInGoal} to: ${f} with playlist age: ${i.age}`),f=0;else{const t=Math.floor(f/i.targetduration);if(a+=t,void 0!==l){l+=Math.round(f%i.targetduration/i.partTarget)}this.log(`CDN Tune-in age: ${i.ageHeader}s last advanced ${d.toFixed(2)}s goal: ${f} skip sn ${t} to part ${l}`)}i.tuneInGoal=f}if(o=this.getDeliveryDirectives(i,e.deliveryDirectives,a,l),t||!u)return void this.loadPlaylist(o)}else(i.canBlockReload||i.canSkipUntil)&&(o=this.getDeliveryDirectives(i,e.deliveryDirectives,a,l));const c=this.hls.mainForwardBufferInfo,u=c?c.end-c.len:0,d=function(t,e=1/0){let r=1e3*t.targetduration;if(t.updated){const i=t.fragments,s=4;if(i.length&&r*s>e){const t=1e3*i[i.length-1].duration;tthis.requestScheduled+d&&(this.requestScheduled=s.loading.start),void 0!==a&&i.canBlockReload?this.requestScheduled=s.loading.first+d-(1e3*i.partTarget||1e3):-1===this.requestScheduled||this.requestScheduled+dthis.loadPlaylist(o)),h)}else this.clearTimer()}getDeliveryDirectives(t,e,r,i){let s=Cg(t);return null!=e&&e.skip&&t.deltaUpdateFailed&&(r=e.msn,i=e.part,s=Lg),new xg(r,i,s)}checkRetry(t){const e=t.details,r=qg(t),i=t.errorAction,{action:s,retryCount:n=0,retryConfig:o}=i||{},a=!!i&&!!o&&(s===Jg||!i.resolved&&s===Qg);if(a){var l;if(this.requestScheduled=-1,n>=o.maxNumRetry)return!1;if(r&&null!=(l=t.context)&&l.deliveryDirectives)this.warn(`Retrying playlist loading ${n+1}/${o.maxNumRetry} after "${e}" without delivery-directives`),this.loadPlaylist();else{const t=Hg(o,n);this.timer=self.setTimeout((()=>this.loadPlaylist()),t),this.warn(`Retrying playlist loading ${n+1}/${o.maxNumRetry} after "${e}" in ${t}ms`)}t.levelRetry=!0,i.resolved=!0}return a}}class sm{constructor(t,e=0,r=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=t,this.alpha_=t?Math.exp(Math.log(.5)/t):0,this.estimate_=e,this.totalWeight_=r}sample(t,e){const r=Math.pow(this.alpha_,t);this.estimate_=e*(1-r)+r*this.estimate_,this.totalWeight_+=t}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const t=1-Math.pow(this.alpha_,this.totalWeight_);if(t)return this.estimate_/t}return this.estimate_}}class nm{constructor(t,e,r,i=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=r,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new sm(t),this.fast_=new sm(e),this.defaultTTFB_=i,this.ttfb_=new sm(t)}update(t,e){const{slow_:r,fast_:i,ttfb_:s}=this;r.halfLife!==t&&(this.slow_=new sm(t,r.getEstimate(),r.getTotalWeight())),i.halfLife!==e&&(this.fast_=new sm(e,i.getEstimate(),i.getTotalWeight())),s.halfLife!==t&&(this.ttfb_=new sm(t,s.getEstimate(),s.getTotalWeight()))}sample(t,e){const r=(t=Math.max(t,this.minDelayMs_))/1e3,i=8*e/r;this.fast_.sample(r,i),this.slow_.sample(r,i)}sampleTTFB(t){const e=t/1e3,r=Math.sqrt(2)*Math.exp(-Math.pow(e,2)/2);this.ttfb_.sample(r,Math.max(t,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}destroy(){}}const om={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},am={};function lm(t,e,r,i,s,n){const o=t.audioCodec?t.audioGroups:null,a=null==n?void 0:n.audioCodec,l=null==n?void 0:n.channels,c=l?parseInt(l):a?1/0:2;let u=null;if(null!=o&&o.length)try{u=1===o.length&&o[0]?e.groups[o[0]].channels:o.reduce(((t,r)=>{if(r){const i=e.groups[r];if(!i)throw new Error(`Audio track group ${r} not found`);Object.keys(i.channels).forEach((e=>{t[e]=(t[e]||0)+i.channels[e]}))}return t}),{2:0})}catch(t){return!0}return void 0!==t.videoCodec&&(t.width>1920&&t.height>1088||t.height>1920&&t.width>1088||t.frameRate>Math.max(i,30)||"SDR"!==t.videoRange&&t.videoRange!==r||t.bitrate>Math.max(s,8e6))||!!u&&Gh(c)&&Object.keys(u).some((t=>parseInt(t)>c))}function cm(t,e,r){const i=t.videoCodec,s=t.audioCodec;if(!i||!s||!r)return Promise.resolve(om);const n={width:t.width,height:t.height,bitrate:Math.ceil(Math.max(.9*t.bitrate,t.averageBitrate)),framerate:t.frameRate||30},o=t.videoRange;"SDR"!==o&&(n.transferFunction=o.toLowerCase());const a=i.split(",").map((t=>({type:"media-source",video:Bh(Bh({},n),{},{contentType:Fp(t,"video")})})));return s&&t.audioGroups&&t.audioGroups.forEach((t=>{var r;t&&(null==(r=e.groups[t])||r.tracks.forEach((e=>{if(e.groupId===t){const t=e.channels||"",r=parseFloat(t);Gh(r)&&r>2&&a.push.apply(a,s.split(",").map((t=>({type:"media-source",audio:{contentType:Fp(t,"audio"),channels:""+r}}))))}})))})),Promise.all(a.map((t=>{const e=function(t){const{audio:e,video:r}=t,i=r||e;if(i){const t=i.contentType.split('"')[1];if(r)return`r${r.height}x${r.width}f${Math.ceil(r.framerate)}${r.transferFunction||"sd"}_${t}_${Math.ceil(r.bitrate/1e5)}`;if(e)return`c${e.channels}${e.spatialRendering?"s":"n"}_${t}`}return""}(t);return am[e]||(am[e]=r.decodingInfo(t))}))).then((t=>({supported:!t.some((t=>!t.supported)),configurations:a,decodingInfoResults:t}))).catch((t=>({supported:!1,configurations:a,decodingInfoResults:[],error:t})))}function um(t,e){let r=!1,i=[];return t&&(r="SDR"!==t,i=[t]),e&&(i=e.allowedVideoRanges||Dg.slice(0),r=void 0!==e.preferHDR?e.preferHDR:function(){if("function"==typeof matchMedia){const t=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(t.media!==e.media)return!0===t.matches}return!1}(),i=r?i.filter((t=>"SDR"!==t)):["SDR"]),{preferHDR:r,allowedVideoRanges:i}}function dm(t,e){Zh.log(`[abr] start candidates with "${t}" ignored because ${e}`)}function hm(t,e,r){if("attrs"in t){const r=e.indexOf(t);if(-1!==r)return r}for(let i=0;i-1===i.indexOf(t)))}(a,e.characteristics))&&(void 0===r||r(t,e))}function pm(t,e){const{audioCodec:r,channels:i}=t;return!(void 0!==r&&(e.audioCodec||"").substring(0,4)!==r.substring(0,4)||void 0!==i&&i!==(e.channels||"2"))}function gm(t,e,r){for(let i=e;i>-1;i--)if(r(t[i]))return i;for(let i=e+1;i1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}var ym="NOT_LOADED",vm="APPENDING",_m="PARTIAL",Em="OK";class Tm{constructor(t){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=t,this._registerListeners()}_registerListeners(){const{hls:t}=this;t.on(Kh.BUFFER_APPENDED,this.onBufferAppended,this),t.on(Kh.FRAG_BUFFERED,this.onFragBuffered,this),t.on(Kh.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:t}=this;t.off(Kh.BUFFER_APPENDED,this.onBufferAppended,this),t.off(Kh.FRAG_BUFFERED,this.onFragBuffered,this),t.off(Kh.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(t,e){const r=this.activePartLists[e];if(r)for(let e=r.length;e--;){const i=r[e];if(!i)break;const s=i.end;if(i.start<=t&&null!==s&&t<=s)return i}return this.getBufferedFrag(t,e)}getBufferedFrag(t,e){const{fragments:r}=this,i=Object.keys(r);for(let s=i.length;s--;){const n=r[i[s]];if((null==n?void 0:n.body.type)===e&&n.buffered){const e=n.body;if(e.start<=t&&t<=e.end)return e}}return null}detectEvictedFragments(t,e,r,i){this.timeRanges&&(this.timeRanges[t]=e);const s=(null==i?void 0:i.fragment.sn)||-1;Object.keys(this.fragments).forEach((i=>{const n=this.fragments[i];if(!n)return;if(s>=n.body.sn)return;if(!n.buffered&&!n.loaded)return void(n.body.type===r&&this.removeFragment(n.body));const o=n.range[t];o&&o.time.some((t=>{const r=!this.isTimeBuffered(t.startPTS,t.endPTS,e);return r&&this.removeFragment(n.body),r}))}))}detectPartialFragments(t){const e=this.timeRanges,{frag:r,part:i}=t;if(!e||"initSegment"===r.sn)return;const s=Sm(r),n=this.fragments[s];if(!n||n.buffered&&r.gap)return;const o=!r.relurl;if(Object.keys(e).forEach((t=>{const s=r.elementaryStreams[t];if(!s)return;const a=e[t],l=o||!0===s.partial;n.range[t]=this.getBufferedTimes(r,i,l,a)})),n.loaded=null,Object.keys(n.range).length){n.buffered=!0;(n.body.endList=r.endList||n.body.endList)&&(this.endListFragments[n.body.type]=n),wm(n)||this.removeParts(r.sn-1,r.type)}else this.removeFragment(n.body)}removeParts(t,e){const r=this.activePartLists[e];r&&(this.activePartLists[e]=r.filter((e=>e.fragment.sn>=t)))}fragBuffered(t,e){const r=Sm(t);let i=this.fragments[r];!i&&e&&(i=this.fragments[r]={body:t,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},t.gap&&(this.hasGaps=!0)),i&&(i.loaded=null,i.buffered=!0)}getBufferedTimes(t,e,r,i){const s={time:[],partial:r},n=t.start,o=t.end,a=t.minEndPTS||o,l=t.maxStartPTS||n;for(let t=0;t=e&&a<=r){s.time.push({startPTS:Math.max(n,i.start(t)),endPTS:Math.min(o,i.end(t))});break}if(ne){const e=Math.max(n,i.start(t)),r=Math.min(o,i.end(t));r>e&&(s.partial=!0,s.time.push({startPTS:e,endPTS:r}))}else if(o<=e)break}return s}getPartialFragment(t){let e,r,i,s=null,n=0;const{bufferPadding:o,fragments:a}=this;return Object.keys(a).forEach((l=>{const c=a[l];c&&wm(c)&&(r=c.body.start-o,i=c.body.end+o,t>=r&&t<=i&&(e=Math.min(t-r,i-t),n<=e&&(s=c.body,n=e)))})),s}isEndListAppended(t){const e=this.endListFragments[t];return void 0!==e&&(e.buffered||wm(e))}getState(t){const e=Sm(t),r=this.fragments[e];return r?r.buffered?wm(r)?_m:Em:vm:ym}isTimeBuffered(t,e,r){let i,s;for(let n=0;n=i&&e<=s)return!0;if(e<=i)return!1}return!1}onFragLoaded(t,e){const{frag:r,part:i}=e;if("initSegment"===r.sn||r.bitrateTest)return;const s=i?null:e,n=Sm(r);this.fragments[n]={body:r,appendedPTS:null,loaded:s,buffered:!1,range:Object.create(null)}}onBufferAppended(t,e){const{frag:r,part:i,timeRanges:s}=e;if("initSegment"===r.sn)return;const n=r.type;if(i){let t=this.activePartLists[n];t||(this.activePartLists[n]=t=[]),t.push(i)}this.timeRanges=s,Object.keys(s).forEach((t=>{const e=s[t];this.detectEvictedFragments(t,e,n,i)}))}onFragBuffered(t,e){this.detectPartialFragments(e)}hasFragment(t){const e=Sm(t);return!!this.fragments[e]}hasParts(t){var e;return!(null==(e=this.activePartLists[t])||!e.length)}removeFragmentsInRange(t,e,r,i,s){i&&!this.hasGaps||Object.keys(this.fragments).forEach((n=>{const o=this.fragments[n];if(!o)return;const a=o.body;a.type!==r||i&&!a.gap||a.startt&&(o.buffered||s)&&this.removeFragment(a)}))}removeFragment(t){const e=Sm(t);t.stats.loaded=0,t.clearElementaryStreamInfo();const r=this.activePartLists[t.type];if(r){const e=t.sn;this.activePartLists[t.type]=r.filter((t=>t.fragment.sn!==e))}delete this.fragments[e],t.endList&&delete this.endListFragments[t.type]}removeAllFragments(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1}}function wm(t){var e,r,i;return t.buffered&&(t.body.gap||(null==(e=t.range.video)?void 0:e.partial)||(null==(r=t.range.audio)?void 0:r.partial)||(null==(i=t.range.audiovideo)?void 0:i.partial))}function Sm(t){return`${t.type}_${t.level}_${t.sn}`}const bm={length:0,start:()=>0,end:()=>0};class Dm{static isBuffered(t,e){try{if(t){const r=Dm.getBuffered(t);for(let t=0;t=r.start(t)&&e<=r.end(t))return!0}}catch(t){}return!1}static bufferInfo(t,e,r){try{if(t){const i=Dm.getBuffered(t),s=[];let n;for(n=0;nn&&(i[s-1].end=t[e].end):i.push(t[e])}else i.push(t[e])}else i=t;let s,n=0,o=e,a=e;for(let t=0;t=l&&er.startCC||t&&t.cc{if(this.loader&&this.loader.destroy(),t.gap){if(t.tagList.some((t=>"GAP"===t[0])))return void a(Mm(t));t.gap=!1}const l=this.loader=t.loader=s?new s(i):new n(i),c=Fm(t),u=Vg(i.fragLoadPolicy.default),d={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:"initSegment"===t.sn?1/0:Pm};t.stats=l.stats,l.load(c,d,{onSuccess:(e,r,i,s)=>{this.resetLoader(t,l);let n=e.data;i.resetIV&&t.decryptdata&&(t.decryptdata.iv=new Uint8Array(n.slice(0,16)),n=n.slice(16)),o({frag:t,part:null,payload:n,networkDetails:s})},onError:(e,i,s,n)=>{this.resetLoader(t,l),a(new Om({type:Wh.NETWORK_ERROR,details:zh.FRAG_LOAD_ERROR,fatal:!1,frag:t,response:Bh({url:r,data:void 0},e),error:new Error(`HTTP Error ${e.code} ${e.text}`),networkDetails:s,stats:n}))},onAbort:(e,r,i)=>{this.resetLoader(t,l),a(new Om({type:Wh.NETWORK_ERROR,details:zh.INTERNAL_ABORTED,fatal:!1,frag:t,error:new Error("Aborted"),networkDetails:i,stats:e}))},onTimeout:(e,r,i)=>{this.resetLoader(t,l),a(new Om({type:Wh.NETWORK_ERROR,details:zh.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,error:new Error(`Timeout after ${d.timeout}ms`),networkDetails:i,stats:e}))},onProgress:(r,i,s,n)=>{e&&e({frag:t,part:null,payload:s,networkDetails:n})}})}))}loadPart(t,e,r){this.abort();const i=this.config,s=i.fLoader,n=i.loader;return new Promise(((o,a)=>{if(this.loader&&this.loader.destroy(),t.gap||e.gap)return void a(Mm(t,e));const l=this.loader=t.loader=s?new s(i):new n(i),c=Fm(t,e),u=Vg(i.fragLoadPolicy.default),d={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Pm};e.stats=l.stats,l.load(c,d,{onSuccess:(i,s,n,a)=>{this.resetLoader(t,l),this.updateStatsFromPart(t,e);const c={frag:t,part:e,payload:i.data,networkDetails:a};r(c),o(c)},onError:(r,i,s,n)=>{this.resetLoader(t,l),a(new Om({type:Wh.NETWORK_ERROR,details:zh.FRAG_LOAD_ERROR,fatal:!1,frag:t,part:e,response:Bh({url:c.url,data:void 0},r),error:new Error(`HTTP Error ${r.code} ${r.text}`),networkDetails:s,stats:n}))},onAbort:(r,i,s)=>{t.stats.aborted=e.stats.aborted,this.resetLoader(t,l),a(new Om({type:Wh.NETWORK_ERROR,details:zh.INTERNAL_ABORTED,fatal:!1,frag:t,part:e,error:new Error("Aborted"),networkDetails:s,stats:r}))},onTimeout:(r,i,s)=>{this.resetLoader(t,l),a(new Om({type:Wh.NETWORK_ERROR,details:zh.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,part:e,error:new Error(`Timeout after ${d.timeout}ms`),networkDetails:s,stats:r}))}})}))}updateStatsFromPart(t,e){const r=t.stats,i=e.stats,s=i.total;if(r.loaded+=i.loaded,s){const i=Math.round(t.duration/e.duration),n=Math.min(Math.round(r.loaded/s),i),o=(i-n)*Math.round(r.loaded/n);r.total=r.loaded+o}else r.total=Math.max(r.loaded,r.total);const n=r.loading,o=i.loading;n.start?n.first+=o.first-o.start:(n.start=o.start,n.first=o.first),n.end=o.end}resetLoader(t,e){t.loader=null,this.loader===e&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),e.destroy()}}function Fm(t,e=null){const r=e||t,i={frag:t,part:e,responseType:"arraybuffer",url:r.url,headers:{},rangeStart:0,rangeEnd:0},s=r.byteRangeStartOffset,n=r.byteRangeEndOffset;if(Gh(s)&&Gh(n)){var o;let e=s,r=n;if("initSegment"===t.sn&&"AES-128"===(null==(o=t.decryptdata)?void 0:o.method)){const t=n-s;t%16&&(r=n+(16-t%16)),0!==s&&(i.resetIV=!0,e=s-16)}i.rangeStart=e,i.rangeEnd=r}return i}function Mm(t,e){const r=new Error(`GAP ${t.gap?"tag":"attribute"} found`),i={type:Wh.MEDIA_ERROR,details:zh.FRAG_GAP,fatal:!1,frag:t,error:r,networkDetails:null};return e&&(i.part=e),(e||t).stats.aborted=!0,new Om(i)}class Om extends Error{constructor(t){super(t.error.message),this.data=void 0,this.data=t}}class Nm{constructor(t,e){this.subtle=void 0,this.aesIV=void 0,this.subtle=t,this.aesIV=e}decrypt(t,e){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},e,t)}}class Bm{constructor(t,e){this.subtle=void 0,this.key=void 0,this.subtle=t,this.key=e}expandKey(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])}}class Um{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(t){const e=new DataView(t),r=new Uint32Array(4);for(let t=0;t<4;t++)r[t]=e.getUint32(4*t);return r}initTable(){const t=this.sBox,e=this.invSBox,r=this.subMix,i=r[0],s=r[1],n=r[2],o=r[3],a=this.invSubMix,l=a[0],c=a[1],u=a[2],d=a[3],h=new Uint32Array(256);let f=0,p=0,g=0;for(g=0;g<256;g++)h[g]=g<128?g<<1:g<<1^283;for(g=0;g<256;g++){let r=p^p<<1^p<<2^p<<3^p<<4;r=r>>>8^255&r^99,t[f]=r,e[r]=f;const a=h[f],g=h[a],m=h[g];let y=257*h[r]^16843008*r;i[f]=y<<24|y>>>8,s[f]=y<<16|y>>>16,n[f]=y<<8|y>>>24,o[f]=y,y=16843009*m^65537*g^257*a^16843008*f,l[r]=y<<24|y>>>8,c[r]=y<<16|y>>>16,u[r]=y<<8|y>>>24,d[r]=y,f?(f=a^h[h[h[m^a]]],p^=h[h[p]]):f=p=1}}expandKey(t){const e=this.uint8ArrayToUint32Array_(t);let r=!0,i=0;for(;i{if(!this.subtle)return Promise.reject(new Error("web crypto not initialized"));this.logOnce("WebCrypto AES decrypt");return new Nm(this.subtle,new Uint8Array(r)).decrypt(t.buffer,e)})).catch((i=>(Zh.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${i.name}: ${i.message}`),this.onWebCryptoError(t,e,r))))}onWebCryptoError(t,e,r){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(t,e,r);const i=this.flush();if(i)return i.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")}getValidChunk(t){let e=t;const r=t.length-t.length%16;return r!==t.length&&(e=Pf(t,0,r),this.remainderData=Pf(t,r)),e}logOnce(t){this.logEnabled&&(Zh.log(`[decrypter]: ${t}`),this.logEnabled=!1)}}const qm=function(t){let e="";const r=t.length;for(let i=0;io.end){const t=n>s;(n{if(this.fragContextChanged(t))return this.warn(`Fragment ${t.sn}${e.part?" p: "+e.part.index:""} of level ${t.level} was dropped during download.`),void this.fragmentTracker.removeFragment(t);t.stats.chunkCount++,this._handleFragmentLoadProgress(e)})).then((e=>{if(!e)return;const r=this.state;this.fragContextChanged(t)?(r===Km||!this.fragCurrent&&r===jm)&&(this.fragmentTracker.removeFragment(t),this.state=Hm):("payload"in e&&(this.log(`Loaded fragment ${t.sn} of level ${t.level}`),this.hls.trigger(Kh.FRAG_LOADED,e)),this._handleFragmentLoadComplete(e))})).catch((e=>{this.state!==Gm&&this.state!==Qm&&(this.warn(`Frag error: ${(null==e?void 0:e.message)||e}`),this.resetFragmentLoading(t))}))}clearTrackerIfNeeded(t){var e;const{fragmentTracker:r}=this;if(r.getState(t)===vm){const e=t.type,i=this.getFwdBufferInfo(this.mediaBuffer,e),s=Math.max(t.duration,i?i.len:this.config.maxBufferLength),n=this.backtrackFragment;(1===(n?t.sn-n.sn:0)||this.reduceMaxBufferLength(s,t.duration))&&r.removeFragment(t)}else 0===(null==(e=this.mediaBuffer)?void 0:e.buffered.length)?r.removeAllFragments():r.hasParts(t.type)&&(r.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type}),r.getState(t)===_m&&r.removeFragment(t))}checkLiveUpdate(t){if(t.updated&&!t.live){const e=t.fragments[t.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type})}t.fragments[0]||(t.deltaUpdateFailed=!0)}flushMainBuffer(t,e,r=null){if(!(t-e))return;const i={startOffset:t,endOffset:e,type:r};this.hls.trigger(Kh.BUFFER_FLUSHING,i)}_loadInitSegment(t,e){this._doFragLoad(t,e).then((e=>{if(!e||this.fragContextChanged(t)||!this.levels)throw new Error("init load aborted");return e})).then((e=>{const{hls:r}=this,{payload:i}=e,s=t.decryptdata;if(i&&i.byteLength>0&&null!=s&&s.key&&s.iv&&"AES-128"===s.method){const n=self.performance.now();return this.decrypter.decrypt(new Uint8Array(i),s.key.buffer,s.iv.buffer).catch((e=>{throw r.trigger(Kh.ERROR,{type:Wh.MEDIA_ERROR,details:zh.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:t}),e})).then((i=>{const s=self.performance.now();return r.trigger(Kh.FRAG_DECRYPTED,{frag:t,payload:i,stats:{tstart:n,tdecrypt:s}}),e.payload=i,this.completeInitSegmentLoad(e)}))}return this.completeInitSegmentLoad(e)})).catch((e=>{this.state!==Gm&&this.state!==Qm&&(this.warn(e),this.resetFragmentLoading(t))}))}completeInitSegmentLoad(t){const{levels:e}=this;if(!e)throw new Error("init load aborted, missing levels");const r=t.frag.stats;this.state=Hm,t.frag.data=new Uint8Array(t.payload),r.parsing.start=r.buffering.start=self.performance.now(),r.parsing.end=r.buffering.end=self.performance.now(),this.tick()}fragContextChanged(t){const{fragCurrent:e}=this;return!t||!e||t.sn!==e.sn||t.level!==e.level}fragBufferedComplete(t,e){var r,i,s,n;const o=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${t.type} sn: ${t.sn}${e?" part: "+e.index:""} of ${this.playlistType===sg?"level":"track"} ${t.level} (frag:[${(null!=(r=t.startPTS)?r:NaN).toFixed(3)}-${(null!=(i=t.endPTS)?i:NaN).toFixed(3)}] > buffer:${o?qm(Dm.getBuffered(o)):"(detached)"})`),"initSegment"!==t.sn){var a;if(t.type!==og){const e=t.elementaryStreams;if(!Object.keys(e).some((t=>!!e[t])))return void(this.state=Hm)}const e=null==(a=this.levels)?void 0:a[t.level];null!=e&&e.fragmentError&&(this.log(`Resetting level fragment error count of ${e.fragmentError} on frag buffered`),e.fragmentError=0)}this.state=Hm,o&&(!this.loadedmetadata&&t.type==sg&&o.buffered.length&&(null==(s=this.fragCurrent)?void 0:s.sn)===(null==(n=this.fragPrevious)?void 0:n.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())}seekToStartPos(){}_handleFragmentLoadComplete(t){const{transmuxer:e}=this;if(!e)return;const{frag:r,part:i,partsLoaded:s}=t,n=!s||0===s.length||s.some((t=>!t)),o=new Lm(r.level,r.sn,r.stats.chunkCount+1,0,i?i.index:-1,!n);e.flush(o)}_handleFragmentLoadProgress(t){}_doFragLoad(t,e,r=null,i){var s;const n=null==e?void 0:e.details;if(!this.levels||!n)throw new Error(`frag load aborted, missing level${n?"":" detail"}s`);let o=null;if(!t.encrypted||null!=(s=t.decryptdata)&&s.key?!t.encrypted&&n.encryptedFragments.length&&this.keyLoader.loadClear(t,n.encryptedFragments):(this.log(`Loading key for ${t.sn} of [${n.startSN}-${n.endSN}], ${"[stream-controller]"===this.logPrefix?"level":"track"} ${t.level}`),this.state=Vm,this.fragCurrent=t,o=this.keyLoader.load(t).then((t=>{if(!this.fragContextChanged(t.frag))return this.hls.trigger(Kh.KEY_LOADED,t),this.state===Vm&&(this.state=Hm),t})),this.hls.trigger(Kh.KEY_LOADING,{frag:t}),null===this.fragCurrent&&(o=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))),r=Math.max(t.start,r||0),this.config.lowLatencyMode&&"initSegment"!==t.sn){const s=n.partList;if(s&&i){r>t.end&&n.fragmentHint&&(t=n.fragmentHint);const a=this.getNextPart(s,t,r);if(a>-1){const l=s[a];let c;return this.log(`Loading part sn: ${t.sn} p: ${l.index} cc: ${t.cc} of playlist [${n.startSN}-${n.endSN}] parts [0-${a}-${s.length-1}] ${"[stream-controller]"===this.logPrefix?"level":"track"}: ${t.level}, target: ${parseFloat(r.toFixed(3))}`),this.nextLoadPosition=l.start+l.duration,this.state=Km,c=o?o.then((r=>!r||this.fragContextChanged(r.frag)?null:this.doFragPartsLoad(t,l,e,i))).catch((t=>this.handleFragLoadError(t))):this.doFragPartsLoad(t,l,e,i).catch((t=>this.handleFragLoadError(t))),this.hls.trigger(Kh.FRAG_LOADING,{frag:t,part:l,targetBufferTime:r}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):c}if(!t.url||this.loadedEndOfParts(s,r))return Promise.resolve(null)}}this.log(`Loading fragment ${t.sn} cc: ${t.cc} ${n?"of ["+n.startSN+"-"+n.endSN+"] ":""}${"[stream-controller]"===this.logPrefix?"level":"track"}: ${t.level}, target: ${parseFloat(r.toFixed(3))}`),Gh(t.sn)&&!this.bitrateTest&&(this.nextLoadPosition=t.start+t.duration),this.state=Km;const a=this.config.progressive;let l;return l=a&&o?o.then((e=>!e||this.fragContextChanged(null==e?void 0:e.frag)?null:this.fragmentLoader.load(t,i))).catch((t=>this.handleFragLoadError(t))):Promise.all([this.fragmentLoader.load(t,a?i:void 0),o]).then((([t])=>(!a&&t&&i&&i(t),t))).catch((t=>this.handleFragLoadError(t))),this.hls.trigger(Kh.FRAG_LOADING,{frag:t,targetBufferTime:r}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):l}doFragPartsLoad(t,e,r,i){return new Promise(((s,n)=>{var o;const a=[],l=null==(o=r.details)?void 0:o.partList,c=e=>{this.fragmentLoader.loadPart(t,e,i).then((i=>{a[e.index]=i;const n=i.part;this.hls.trigger(Kh.FRAG_LOADED,i);const o=Bg(r,t.sn,e.index+1)||Ug(l,t.sn,e.index+1);if(!o)return s({frag:t,part:n,partsLoaded:a});c(o)})).catch(n)};c(e)}))}handleFragLoadError(t){if("data"in t){const e=t.data;t.data&&e.details===zh.INTERNAL_ABORTED?this.handleFragLoadAborted(e.frag,e.part):this.hls.trigger(Kh.ERROR,e)}else this.hls.trigger(Kh.ERROR,{type:Wh.OTHER_ERROR,details:zh.INTERNAL_EXCEPTION,err:t,error:t,fatal:!0});return null}_handleTransmuxerFlush(t){const e=this.getCurrentContext(t);if(!e||this.state!==jm)return void(this.fragCurrent||this.state===Gm||this.state===Qm||(this.state=Hm));const{frag:r,part:i,level:s}=e,n=self.performance.now();r.stats.parsing.end=n,i&&(i.stats.parsing.end=n),this.updateLevelTiming(r,i,s,t.partial)}getCurrentContext(t){const{levels:e,fragCurrent:r}=this,{level:i,sn:s,part:n}=t;if(null==e||!e[i])return this.warn(`Levels object was unset while buffering fragment ${s} of level ${i}. The current chunk will not be buffered.`),null;const o=e[i],a=n>-1?Bg(o,s,n):null,l=a?a.fragment:function(t,e,r){if(null==t||!t.details)return null;const i=t.details;let s=i.fragments[e-i.startSN];return s||(s=i.fragmentHint,s&&s.sn===e?s:en&&this.flushMainBuffer(o,t.start)}getFwdBufferInfo(t,e){const r=this.getLoadPosition();return Gh(r)?this.getFwdBufferInfoAtPos(t,r,e):null}getFwdBufferInfoAtPos(t,e,r){const{config:{maxBufferHole:i}}=this,s=Dm.bufferInfo(t,e,i);if(0===s.len&&void 0!==s.nextStart){const n=this.fragmentTracker.getBufferedFrag(e,r);if(n&&s.nextStart=i&&(r.maxMaxBufferLength=s,this.warn(`Reduce max buffer length to ${s}s`),!0)}getAppendedFrag(t,e=sg){const r=this.fragmentTracker.getAppendedFrag(t,sg);return r&&"fragment"in r?r.fragment:r}getNextFragment(t,e){const r=e.fragments,i=r.length;if(!i)return null;const{config:s}=this,n=r[0].start;let o;if(e.live){const a=s.initialLiveManifestSize;if(ie}getNextFragmentLoopLoading(t,e,r,i,s){const n=t.gap,o=this.getNextFragment(this.nextLoadPosition,e);if(null===o)return o;if(t=o,n&&t&&!t.gap&&r.nextStart){const e=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,r.nextStart,i);if(null!==e&&r.len+e.len>=s)return this.log(`buffer full after gaps in "${i}" playlist starting at sn: ${t.sn}`),null}return t}mapToInitFragWhenRequired(t){return null==t||!t.initSegment||null!=t&&t.initSegment.data||this.bitrateTest?t:t.initSegment}getNextPart(t,e,r){let i=-1,s=!1,n=!0;for(let o=0,a=t.length;o-1&&rr.start&&r.loaded}getInitialLiveFragment(t,e){const r=this.fragPrevious;let i=null;if(r){if(t.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${r.programDateTime}`),i=function(t,e,r){if(null===e||!Array.isArray(t)||!t.length||!Gh(e))return null;if(e<(t[0].programDateTime||0))return null;if(e>=(t[t.length-1].endProgramDateTime||0))return null;r=r||0;for(let i=0;i=t.startSN&&s<=t.endSN){const n=e[s-t.startSN];r.cc===n.cc&&(i=n,this.log(`Live playlist, switching playlist, load frag with next SN: ${i.sn}`))}i||(i=function(t,e){return Wg(t,(t=>t.cce?-1:0))}(e,r.cc),i&&this.log(`Live playlist, switching playlist, load frag with same CC: ${i.sn}`))}}else{const e=this.hls.liveSyncPosition;null!==e&&(i=this.getFragmentAtPosition(e,this.bitrateTest?t.fragmentEnd:t.edge,t))}return i}getFragmentAtPosition(t,e,r){const{config:i}=this;let{fragPrevious:s}=this,{fragments:n,endSN:o}=r;const{fragmentHint:a}=r,{maxFragLookUpTolerance:l}=i,c=r.partList,u=!!(i.lowLatencyMode&&null!=c&&c.length&&a);let d;if(u&&a&&!this.bitrateTest&&(n=n.concat(a),o=a.sn),te-l?0:l)}else d=n[n.length-1];if(d){const t=d.sn-r.startSN,e=this.fragmentTracker.getState(d);if((e===Em||e===_m&&d.gap)&&(s=d),s&&d.sn===s.sn&&(!u||c[0].fragment.sn>d.sn)){if(s&&d.level===s.level){const e=n[t+1];d=d.sn=n-e.maxFragLookUpTolerance&&s<=o;if(null!==i&&r.duration>i&&(s${t.startSN} prev-sn: ${s?s.sn:"na"} fragments: ${i}`),n}return s}waitForCdnTuneIn(t){return t.live&&t.canBlockReload&&t.partTarget&&t.tuneInGoal>Math.max(t.partHoldBack,3*t.partTarget)}setStartPosition(t,e){let r=this.startPosition;if(r ${null==(i=this.fragCurrent)?void 0:i.url}`);const s=e.details===zh.FRAG_GAP;s&&this.fragmentTracker.fragBuffered(r,!0);const n=e.errorAction,{action:o,retryCount:a=0,retryConfig:l}=n||{};if(n&&o===Jg&&l){this.resetStartWhenNotLoaded(this.levelLastLoaded);const i=Hg(l,a);this.warn(`Fragment ${r.sn} of ${t} ${r.level} errored with ${e.details}, retrying loading ${a+1}/${l.maxNumRetry} in ${i}ms`),n.resolved=!0,this.retryDate=self.performance.now()+i,this.state=Wm}else if(l&&n){if(this.resetFragmentErrors(t),!(a.5;s&&this.reduceMaxBufferLength(i.len,(null==e?void 0:e.duration)||10);const n=!s;return n&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${r} buffer`),e&&(this.fragmentTracker.removeFragment(e),this.nextLoadPosition=e.start),this.resetLoadingState(),n}return!1}resetFragmentErrors(t){t===ng&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==Gm&&(this.state=Hm)}afterBufferFlushed(t,e,r){if(!t)return;const i=Dm.getBuffered(t);this.fragmentTracker.detectEvictedFragments(e,i,r),this.state===Xm&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=Hm}resetStartWhenNotLoaded(t){if(!this.loadedmetadata){this.startFragRequested=!1;const e=t?t.details:null;null!=e&&e.live?(this.startPosition=-1,this.setStartPosition(e,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(t){this.warn(`The loading context changed while buffering fragment ${t.sn} of level ${t.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()}removeUnbufferedFrags(t=0){this.fragmentTracker.removeFragmentsInRange(t,1/0,this.playlistType,!1,!0)}updateLevelTiming(t,e,r,i){var s;const n=r.details;if(!n)return void this.warn("level.details undefined");if(!Object.keys(t.elementaryStreams).reduce(((e,s)=>{const o=t.elementaryStreams[s];if(o){const a=o.endPTS-o.startPTS;if(a<=0)return this.warn(`Could not parse fragment ${t.sn} ${s} duration reliably (${a})`),e||!1;const l=i?0:Fg(n,t,o.startPTS,o.endPTS,o.startDTS,o.endDTS);return this.hls.trigger(Kh.LEVEL_PTS_UPDATED,{details:n,level:r,drift:l,type:s,frag:t,start:o.startPTS,end:o.endPTS}),!0}return e}),!1)&&null===(null==(s=this.transmuxer)?void 0:s.error)){const e=new Error(`Found no media in fragment ${t.sn} of level ${t.level} resetting transmuxer to fallback to playlist timing`);if(0===r.fragmentError&&(r.fragmentError++,t.gap=!0,this.fragmentTracker.removeFragment(t),this.fragmentTracker.fragBuffered(t,!0)),this.warn(e.message),this.hls.trigger(Kh.ERROR,{type:Wh.MEDIA_ERROR,details:zh.FRAG_PARSING_ERROR,fatal:!1,error:e,frag:t,reason:`Found no media in msn ${t.sn} of level "${r.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=Ym,this.hls.trigger(Kh.FRAG_PARSED,{frag:t,part:e})}resetTransmuxer(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)}recoverWorkerError(t){"demuxerWorker"===t.event&&(this.fragmentTracker.removeAllFragments(),this.resetTransmuxer(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())}set state(t){const e=this._state;e!==t&&(this._state=t,this.log(`${e}->${t}`))}get state(){return this._state}}class ey{constructor(){this.chunks=[],this.dataLength=0}push(t){this.chunks.push(t),this.dataLength+=t.length}flush(){const{chunks:t,dataLength:e}=this;let r;return t.length?(r=1===t.length?t[0]:function(t,e){const r=new Uint8Array(e);let i=0;for(let e=0;e0&&o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:gg,duration:Number.POSITIVE_INFINITY});s{if(Gh(t))return 90*t;return 9e4*e+(r?9e4*r.baseTime/r.timescale:0)};function ny(t,e){return 255===t[e]&&240==(246&t[e+1])}function oy(t,e){return 1&t[e+1]?7:9}function ay(t,e){return(3&t[e+3])<<11|t[e+4]<<3|(224&t[e+5])>>>5}function ly(t,e){return e+1=t.length)return!1;const i=ay(t,e);if(i<=r)return!1;const s=e+i;return s===t.length||ly(t,s)}return!1}function uy(t,e,r,i,s){if(!t.samplerate){const n=function(t,e,r,i){let s,n,o,a;const l=navigator.userAgent.toLowerCase(),c=i,u=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];s=1+((192&e[r+2])>>>6);const d=(60&e[r+2])>>>2;if(!(d>u.length-1))return o=(1&e[r+2])<<2,o|=(192&e[r+3])>>>6,Zh.log(`manifest codec:${i}, ADTS type:${s}, samplingIndex:${d}`),/firefox/i.test(l)?d>=6?(s=5,a=new Array(4),n=d-3):(s=2,a=new Array(2),n=d):-1!==l.indexOf("android")?(s=2,a=new Array(2),n=d):(s=5,a=new Array(4),i&&(-1!==i.indexOf("mp4a.40.29")||-1!==i.indexOf("mp4a.40.5"))||!i&&d>=6?n=d-3:((i&&-1!==i.indexOf("mp4a.40.2")&&(d>=6&&1===o||/vivaldi/i.test(l))||!i&&1===o)&&(s=2,a=new Array(2)),n=d)),a[0]=s<<3,a[0]|=(14&d)>>1,a[1]|=(1&d)<<7,a[1]|=o<<3,5===s&&(a[1]|=(14&n)>>1,a[2]=(1&n)<<7,a[2]|=8,a[3]=0),{config:a,samplerate:u[d],channelCount:o,codec:"mp4a.40."+s,manifestCodec:c};{const e=new Error(`invalid ADTS sampling index:${d}`);t.emit(Kh.ERROR,Kh.ERROR,{type:Wh.MEDIA_ERROR,details:zh.FRAG_PARSING_ERROR,fatal:!0,error:e,reason:e.message})}}(e,r,i,s);if(!n)return;t.config=n.config,t.samplerate=n.samplerate,t.channelCount=n.channelCount,t.codec=n.codec,t.manifestCodec=n.manifestCodec,Zh.log(`parsed codec:${t.codec}, rate:${n.samplerate}, channels:${n.channelCount}`)}}function dy(t){return 9216e4/t}function hy(t,e,r,i,s){const n=i+s*dy(t.samplerate),o=function(t,e){const r=oy(t,e);if(e+r<=t.length){const i=ay(t,e)-r;if(i>0)return{headerLength:r,frameLength:i}}}(e,r);let a;if(o){const{frameLength:i,headerLength:s}=o,l=s+i,c=Math.max(0,r+l-e.length);c?(a=new Uint8Array(l-s),a.set(e.subarray(r+s,e.length),0)):a=e.subarray(r+s,r+l);const u={unit:a,pts:n};return c||t.samples.push(u),{sample:u,length:l,missing:c}}const l=e.length-r;a=new Uint8Array(l),a.set(e.subarray(r,e.length),0);return{sample:{unit:a,pts:n},length:l,missing:-1}}let fy=null;const py=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],gy=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],my=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],yy=[0,1,1,4];function vy(t,e,r,i,s){if(r+24>e.length)return;const n=_y(e,r);if(n&&r+n.frameLength<=e.length){const o=i+s*(9e4*n.samplesPerFrame/n.sampleRate),a={unit:e.subarray(r,r+n.frameLength),pts:o,dts:o};return t.config=[],t.channelCount=n.channelCount,t.samplerate=n.sampleRate,t.samples.push(a),{sample:a,length:n.frameLength,missing:0}}}function _y(t,e){const r=t[e+1]>>3&3,i=t[e+1]>>1&3,s=t[e+2]>>4&15,n=t[e+2]>>2&3;if(1!==r&&0!==s&&15!==s&&3!==n){const o=t[e+2]>>1&1,a=t[e+3]>>6,l=1e3*py[14*(3===r?3-i:3===i?3:4)+s-1],c=gy[3*(3===r?0:2===r?1:2)+n],u=3===a?1:2,d=my[r][i],h=yy[i],f=8*d*h,p=Math.floor(d*l/c+o)*h;if(null===fy){const t=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);fy=t?parseInt(t[1]):0}return!!fy&&fy<=87&&2===i&&l>=224e3&&0===a&&(t[e+3]=128|t[e+3]),{sampleRate:c,channelCount:u,frameLength:p,samplesPerFrame:f}}}function Ey(t,e){return!(255!==t[e]||224&~t[e+1]||!(6&t[e+1]))}function Ty(t,e){return e+1{let r=0,i=5;e+=i;const s=new Uint32Array(1),n=new Uint32Array(1),o=new Uint8Array(1);for(;i>0;){o[0]=t[e];const a=Math.min(i,8),l=8-a;n[0]=4278190080>>>24+l<>l,r=r?r<e.length)return-1;if(11!==e[r]||119!==e[r+1])return-1;const n=e[r+4]>>6;if(n>=3)return-1;const o=[48e3,44100,32e3][n],a=63&e[r+4],l=2*[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][3*a+n];if(r+l>e.length)return-1;const c=e[r+6]>>5;let u=0;2===c?u+=2:(1&c&&1!==c&&(u+=2),4&c&&(u+=2));const d=(e[r+6]<<8|e[r+7])>>12-u&1,h=[2,1,2,3,3,4,4,5][c]+d,f=e[r+5]>>3,p=7&e[r+5],g=new Uint8Array([n<<6|f<<1|p>>2,(3&p)<<6|c<<3|d<<2|a>>4,a<<4&224]),m=i+s*(1536/o*9e4),y=e.subarray(r,r+l);return t.config=g,t.channelCount=h,t.samplerate=o,t.samples.push({unit:y,pts:m}),l}class Ay{constructor(){this.VideoSample=null}createVideoSample(t,e,r,i){return{key:t,frame:!1,pts:e,dts:r,units:[],debug:i,length:0}}getLastNalUnit(t){var e;let r,i=this.VideoSample;if(i&&0!==i.units.length||(i=t[t.length-1]),null!=(e=i)&&e.units){const t=i.units;r=t[t.length-1]}return r}pushAccessUnit(t,e){if(t.units.length&&t.frame){if(void 0===t.pts){const r=e.samples,i=r.length;if(!i)return void e.dropped++;{const e=r[i-1];t.pts=e.pts,t.dts=e.dts}}e.samples.push(t)}t.debug.length&&Zh.log(t.pts+"/"+t.dts+":"+t.debug)}}class ky{constructor(t){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=t,this.bytesAvailable=t.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const t=this.data,e=this.bytesAvailable,r=t.byteLength-e,i=new Uint8Array(4),s=Math.min(4,e);if(0===s)throw new Error("no bytes available");i.set(t.subarray(r,r+s)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=8*s,this.bytesAvailable-=s}skipBits(t){let e;t=Math.min(t,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>t?(this.word<<=t,this.bitsAvailable-=t):(e=(t-=this.bitsAvailable)>>3,t-=e<<3,this.bytesAvailable-=e,this.loadWord(),this.word<<=t,this.bitsAvailable-=t)}readBits(t){let e=Math.min(this.bitsAvailable,t);const r=this.word>>>32-e;if(t>32&&Zh.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=e,this.bitsAvailable>0)this.word<<=e;else{if(!(this.bytesAvailable>0))throw new Error("no bits available");this.loadWord()}return e=t-e,e>0&&this.bitsAvailable?r<>>t)return this.word<<=t,this.bitsAvailable-=t,t;return this.loadWord(),t+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const t=this.skipLZ();return this.readBits(t+1)-1}readEG(){const t=this.readUEG();return 1&t?1+t>>>1:-1*(t>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}skipScalingList(t){let e,r=8,i=8;for(let s=0;s{var n;switch(i.type){case 1:{let e=!1;o=!0;const s=i.data;if(l&&s.length>4){const t=new ky(s).readSliceType();2!==t&&4!==t&&7!==t&&9!==t||(e=!0)}var c;if(e)null!=(c=a)&&c.frame&&!a.key&&(this.pushAccessUnit(a,t),a=this.VideoSample=null);a||(a=this.VideoSample=this.createVideoSample(!0,r.pts,r.dts,"")),a.frame=!0,a.key=e;break}case 5:o=!0,null!=(n=a)&&n.frame&&!a.key&&(this.pushAccessUnit(a,t),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,r.pts,r.dts,"")),a.key=!0,a.frame=!0;break;case 6:o=!0,vp(i.data,1,r.pts,e.samples);break;case 7:{var u,d;o=!0,l=!0;const e=i.data,r=new ky(e).readSPS();if(!t.sps||t.width!==r.width||t.height!==r.height||(null==(u=t.pixelRatio)?void 0:u[0])!==r.pixelRatio[0]||(null==(d=t.pixelRatio)?void 0:d[1])!==r.pixelRatio[1]){t.width=r.width,t.height=r.height,t.pixelRatio=r.pixelRatio,t.sps=[e],t.duration=s;const i=e.subarray(1,4);let n="avc1.";for(let t=0;t<3;t++){let e=i[t].toString(16);e.length<2&&(e="0"+e),n+=e}t.codec=n}break}case 8:o=!0,t.pps=[i.data];break;case 9:o=!0,t.audFound=!0,a&&this.pushAccessUnit(a,t),a=this.VideoSample=this.createVideoSample(!1,r.pts,r.dts,"");break;case 12:o=!0;break;default:o=!1,a&&(a.debug+="unknown NAL "+i.type+" ")}if(a&&o){a.units.push(i)}})),i&&a&&(this.pushAccessUnit(a,t),this.VideoSample=null)}parseAVCNALu(t,e){const r=e.byteLength;let i=t.naluState||0;const s=i,n=[];let o,a,l,c=0,u=-1,d=0;for(-1===i&&(u=0,d=31&e[0],i=0,c=1);c=0){const t={data:e.subarray(u,a),type:d};n.push(t)}else{const r=this.getLastNalUnit(t.samples);r&&(s&&c<=4-s&&r.state&&(r.data=r.data.subarray(0,r.data.byteLength-s)),a>0&&(r.data=gp(r.data,e.subarray(0,a)),r.state=0))}c=0&&i>=0){const t={data:e.subarray(u,r),type:d,state:i};n.push(t)}if(0===n.length){const r=this.getLastNalUnit(t.samples);r&&(r.data=gp(r.data,e))}return t.naluState=i,n}}class xy{constructor(t,e,r){this.keyData=void 0,this.decrypter=void 0,this.keyData=r,this.decrypter=new $m(e,{removePKCS7Padding:!1})}decryptBuffer(t){return this.decrypter.decrypt(t,this.keyData.key.buffer,this.keyData.iv.buffer)}decryptAacSample(t,e,r){const i=t[e].unit;if(i.length<=16)return;const s=i.subarray(16,i.length-i.length%16),n=s.buffer.slice(s.byteOffset,s.byteOffset+s.length);this.decryptBuffer(n).then((s=>{const n=new Uint8Array(s);i.set(n,16),this.decrypter.isSync()||this.decryptAacSamples(t,e+1,r)}))}decryptAacSamples(t,e,r){for(;;e++){if(e>=t.length)return void r();if(!(t[e].unit.length<32)&&(this.decryptAacSample(t,e,r),!this.decrypter.isSync()))return}}getAvcEncryptedData(t){const e=16*Math.floor((t.length-48)/160)+16,r=new Int8Array(e);let i=0;for(let e=32;e{s.data=this.getAvcDecryptedUnit(n,o),this.decrypter.isSync()||this.decryptAvcSamples(t,e,r+1,i)}))}decryptAvcSamples(t,e,r,i){if(t instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;e++,r=0){if(e>=t.length)return void i();const s=t[e].units;for(;!(r>=s.length);r++){const n=s[r];if(!(n.data.length<=48||1!==n.type&&5!==n.type||(this.decryptAvcSample(t,e,r,i,n),this.decrypter.isSync())))return}}}}const Ry=188;class Py{constructor(t,e,r){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=t,this.config=e,this.typeSupported=r,this.videoParser=new Cy}static probe(t){const e=Py.syncOffset(t);return e>0&&Zh.warn(`MPEG2-TS detected but first sync word found @ offset ${e}`),-1!==e}static syncOffset(t){const e=t.length;let r=Math.min(940,e-Ry)+1,i=0;for(;i1&&(0===n&&o>2||a+Ry>r))return n}i++}return-1}static createTrack(t,e){return{container:"video"===t||"audio"===t?"video/mp2t":void 0,type:t,id:Jf[t],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===t?e:void 0}}resetInitSegment(t,e,r,i){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=Py.createTrack("video"),this._audioTrack=Py.createTrack("audio",i),this._id3Track=Py.createTrack("id3"),this._txtTrack=Py.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=e,this.videoCodec=r,this._duration=i}resetTimeStamp(){}resetContiguity(){const{_audioTrack:t,_videoTrack:e,_id3Track:r}=this;t&&(t.pesData=null),e&&(e.pesData=null),r&&(r.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(t,e,r=!1,i=!1){let s;r||(this.sampleAes=null);const n=this._videoTrack,o=this._audioTrack,a=this._id3Track,l=this._txtTrack;let c=n.pid,u=n.pesData,d=o.pid,h=a.pid,f=o.pesData,p=a.pesData,g=null,m=this.pmtParsed,y=this._pmtId,v=t.length;if(this.remainderData&&(v=(t=gp(this.remainderData,t)).length,this.remainderData=null),v>4>1){if(E=e+5+t[e+4],E===e+Ry)continue}else E=e+4;switch(v){case c:i&&(u&&(s=By(u))&&this.videoParser.parseAVCPES(n,l,s,!1,this._duration),u={data:[],size:0}),u&&(u.data.push(t.subarray(E,e+Ry)),u.size+=e+Ry-E);break;case d:if(i){if(f&&(s=By(f)))switch(o.segmentCodec){case"aac":this.parseAACPES(o,s);break;case"mp3":this.parseMPEGPES(o,s);break;case"ac3":this.parseAC3PES(o,s)}f={data:[],size:0}}f&&(f.data.push(t.subarray(E,e+Ry)),f.size+=e+Ry-E);break;case h:i&&(p&&(s=By(p))&&this.parseID3PES(a,s),p={data:[],size:0}),p&&(p.data.push(t.subarray(E,e+Ry)),p.size+=e+Ry-E);break;case 0:i&&(E+=t[E]+1),y=this._pmtId=Fy(t,E);break;case y:{i&&(E+=t[E]+1);const s=My(t,E,this.typeSupported,r,this.observer);c=s.videoPid,c>0&&(n.pid=c,n.segmentCodec=s.segmentVideoCodec),d=s.audioPid,d>0&&(o.pid=d,o.segmentCodec=s.segmentAudioCodec),h=s.id3Pid,h>0&&(a.pid=h),null===g||m||(Zh.warn(`MPEG-TS PMT found at ${e} after unknown PID '${g}'. Backtracking to sync byte @${_} to parse all TS packets.`),g=null,e=_-188),m=this.pmtParsed=!0;break}case 17:case 8191:break;default:g=v}}else E++;E>0&&Oy(this.observer,new Error(`Found ${E} TS packet/s that do not start with 0x47`)),n.pesData=u,o.pesData=f,a.pesData=p;const T={audioTrack:o,videoTrack:n,id3Track:a,textTrack:l};return i&&this.extractRemainingSamples(T),T}flush(){const{remainderData:t}=this;let e;return this.remainderData=null,e=t?this.demux(t,-1,!1,!0):{videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(e),this.sampleAes?this.decrypt(e,this.sampleAes):e}extractRemainingSamples(t){const{audioTrack:e,videoTrack:r,id3Track:i,textTrack:s}=t,n=r.pesData,o=e.pesData,a=i.pesData;let l;if(n&&(l=By(n))?(this.videoParser.parseAVCPES(r,s,l,!0,this._duration),r.pesData=null):r.pesData=n,o&&(l=By(o))){switch(e.segmentCodec){case"aac":this.parseAACPES(e,l);break;case"mp3":this.parseMPEGPES(e,l);break;case"ac3":this.parseAC3PES(e,l)}e.pesData=null}else null!=o&&o.size&&Zh.log("last AAC PES packet truncated,might overlap between fragments"),e.pesData=o;a&&(l=By(a))?(this.parseID3PES(i,l),i.pesData=null):i.pesData=a}demuxSampleAes(t,e,r){const i=this.demux(t,r,!0,!this.config.progressive),s=this.sampleAes=new xy(this.observer,this.config,e);return this.decrypt(i,s)}decrypt(t,e){return new Promise((r=>{const{audioTrack:i,videoTrack:s}=t;i.samples&&"aac"===i.segmentCodec?e.decryptAacSamples(i.samples,0,(()=>{s.samples?e.decryptAvcSamples(s.samples,0,0,(()=>{r(t)})):r(t)})):s.samples&&e.decryptAvcSamples(s.samples,0,0,(()=>{r(t)}))}))}destroy(){this._duration=0}parseAACPES(t,e){let r=0;const i=this.aacOverFlow;let s,n,o,a=e.data;if(i){this.aacOverFlow=null;const e=i.missing,s=i.sample.unit.byteLength;if(-1===e)a=gp(i.sample.unit,a);else{const n=s-e;i.sample.unit.set(a.subarray(0,e),n),t.samples.push(i.sample),r=i.missing}}for(s=r,n=a.length;s0;)a+=n}}parseID3PES(t,e){if(void 0===e.pts)return void Zh.warn("[tsdemuxer]: ID3 PES unknown PTS");const r=qh({},e,{type:this._videoTrack?yg:gg,duration:Number.POSITIVE_INFINITY});t.samples.push(r)}}function Iy(t,e){return((31&t[e+1])<<8)+t[e+2]}function Fy(t,e){return(31&t[e+10])<<8|t[e+11]}function My(t,e,r,i,s){const n={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},o=e+3+((15&t[e+1])<<8|t[e+2])-4;for(e+=12+((15&t[e+10])<<8|t[e+11]);e0){let i=e+5,s=a;for(;s>2;){if(106===t[i])!0!==r.ac3?Zh.log("AC-3 audio found, not supported in this browser for now"):(n.audioPid=o,n.segmentAudioCodec="ac3");const e=t[i+1]+2;i+=e,s-=e}}break;case 194:case 135:return Oy(s,new Error("Unsupported EC-3 in M2TS found")),n;case 36:return Oy(s,new Error("Unsupported HEVC in M2TS found")),n}e+=a+5}return n}function Oy(t,e,r){Zh.warn(`parsing error: ${e.message}`),t.emit(Kh.ERROR,Kh.ERROR,{type:Wh.MEDIA_ERROR,details:zh.FRAG_PARSING_ERROR,fatal:!1,levelRetry:r,error:e,reason:e.message})}function Ny(t){Zh.log(`${t} with AES-128-CBC encryption found in unencrypted stream`)}function By(t){let e,r,i,s,n,o=0;const a=t.data;if(!t||0===t.size)return null;for(;a[0].length<19&&a.length>1;)a[0]=gp(a[0],a[1]),a.splice(1,1);e=a[0];if(1===(e[0]<<16)+(e[1]<<8)+e[2]){if(r=(e[4]<<8)+e[5],r&&r>t.size-6)return null;const l=e[7];192&l&&(s=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,64&l?(n=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2,s-n>54e5&&(Zh.warn(`${Math.round((s-n)/9e4)}s delta between PTS and DTS, align them`),s=n)):n=s),i=e[8];let c=i+9;if(t.size<=c)return null;t.size-=c;const u=new Uint8Array(t.size);for(let t=0,r=a.length;tr){c-=r;continue}e=e.subarray(c),r-=c,c=0}u.set(e,o),o+=r}return r&&(r-=i+3),{data:u,pts:s,dts:n,len:r}}return null}class Uy{static getSilentFrame(t,e){if("mp4a.40.2"===t){if(1===e)return new Uint8Array([0,200,0,128,35,128]);if(2===e)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===e)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===e)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===e)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}}}const $y=Math.pow(2,32)-1;class qy{static init(){let t;for(t in qy.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},qy.types)qy.types.hasOwnProperty(t)&&(qy.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);const e=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),r=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);qy.HDLR_TYPES={video:e,audio:r};const i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),s=new Uint8Array([0,0,0,0,0,0,0,0]);qy.STTS=qy.STSC=qy.STCO=s,qy.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),qy.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),qy.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),qy.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const n=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),a=new Uint8Array([0,0,0,1]);qy.FTYP=qy.box(qy.types.ftyp,n,a,n,o),qy.DINF=qy.box(qy.types.dinf,qy.box(qy.types.dref,i))}static box(t,...e){let r=8,i=e.length;const s=i;for(;i--;)r+=e[i].byteLength;const n=new Uint8Array(r);for(n[0]=r>>24&255,n[1]=r>>16&255,n[2]=r>>8&255,n[3]=255&r,n.set(t,4),i=0,r=8;i>24&255,t>>16&255,t>>8&255,255&t,r>>24,r>>16&255,r>>8&255,255&r,i>>24,i>>16&255,i>>8&255,255&i,85,196,0,0]))}static mdia(t){return qy.box(qy.types.mdia,qy.mdhd(t.timescale,t.duration),qy.hdlr(t.type),qy.minf(t))}static mfhd(t){return qy.box(qy.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}static minf(t){return"audio"===t.type?qy.box(qy.types.minf,qy.box(qy.types.smhd,qy.SMHD),qy.DINF,qy.stbl(t)):qy.box(qy.types.minf,qy.box(qy.types.vmhd,qy.VMHD),qy.DINF,qy.stbl(t))}static moof(t,e,r){return qy.box(qy.types.moof,qy.mfhd(t),qy.traf(r,e))}static moov(t){let e=t.length;const r=[];for(;e--;)r[e]=qy.trak(t[e]);return qy.box.apply(null,[qy.types.moov,qy.mvhd(t[0].timescale,t[0].duration)].concat(r).concat(qy.mvex(t)))}static mvex(t){let e=t.length;const r=[];for(;e--;)r[e]=qy.trex(t[e]);return qy.box.apply(null,[qy.types.mvex,...r])}static mvhd(t,e){e*=t;const r=Math.floor(e/($y+1)),i=Math.floor(e%($y+1)),s=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24,r>>16&255,r>>8&255,255&r,i>>24,i>>16&255,i>>8&255,255&i,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return qy.box(qy.types.mvhd,s)}static sdtp(t){const e=t.samples||[],r=new Uint8Array(4+e.length);let i,s;for(i=0;i>>8&255),s.push(255&i),s=s.concat(Array.prototype.slice.call(r));for(e=0;e>>8&255),n.push(255&i),n=n.concat(Array.prototype.slice.call(r));const o=qy.box(qy.types.avcC,new Uint8Array([1,s[3],s[4],s[5],255,224|t.sps.length].concat(s).concat([t.pps.length]).concat(n))),a=t.width,l=t.height,c=t.pixelRatio[0],u=t.pixelRatio[1];return qy.box(qy.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,a>>8&255,255&a,l>>8&255,255&l,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,qy.box(qy.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),qy.box(qy.types.pasp,new Uint8Array([c>>24,c>>16&255,c>>8&255,255&c,u>>24,u>>16&255,u>>8&255,255&u])))}static esds(t){const e=t.config.length;return new Uint8Array([0,0,0,0,3,23+e,0,1,0,4,15+e,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([e]).concat(t.config).concat([6,1,2]))}static audioStsd(t){const e=t.samplerate;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,e>>8&255,255&e,0,0])}static mp4a(t){return qy.box(qy.types.mp4a,qy.audioStsd(t),qy.box(qy.types.esds,qy.esds(t)))}static mp3(t){return qy.box(qy.types[".mp3"],qy.audioStsd(t))}static ac3(t){return qy.box(qy.types["ac-3"],qy.audioStsd(t),qy.box(qy.types.dac3,t.config))}static stsd(t){return"audio"===t.type?"mp3"===t.segmentCodec&&"mp3"===t.codec?qy.box(qy.types.stsd,qy.STSD,qy.mp3(t)):"ac3"===t.segmentCodec?qy.box(qy.types.stsd,qy.STSD,qy.ac3(t)):qy.box(qy.types.stsd,qy.STSD,qy.mp4a(t)):qy.box(qy.types.stsd,qy.STSD,qy.avc1(t))}static tkhd(t){const e=t.id,r=t.duration*t.timescale,i=t.width,s=t.height,n=Math.floor(r/($y+1)),o=Math.floor(r%($y+1));return qy.box(qy.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,o>>24,o>>16&255,o>>8&255,255&o,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>8&255,255&i,0,0,s>>8&255,255&s,0,0]))}static traf(t,e){const r=qy.sdtp(t),i=t.id,s=Math.floor(e/($y+1)),n=Math.floor(e%($y+1));return qy.box(qy.types.traf,qy.box(qy.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])),qy.box(qy.types.tfdt,new Uint8Array([1,0,0,0,s>>24,s>>16&255,s>>8&255,255&s,n>>24,n>>16&255,n>>8&255,255&n])),qy.trun(t,r.length+16+20+8+16+8+8),r)}static trak(t){return t.duration=t.duration||4294967295,qy.box(qy.types.trak,qy.tkhd(t),qy.mdia(t))}static trex(t){const e=t.id;return qy.box(qy.types.trex,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(t,e){const r=t.samples||[],i=r.length,s=12+16*i,n=new Uint8Array(s);let o,a,l,c,u,d;for(e+=8+s,n.set(["video"===t.type?1:0,0,15,1,i>>>24&255,i>>>16&255,i>>>8&255,255&i,e>>>24&255,e>>>16&255,e>>>8&255,255&e],0),o=0;o>>24&255,l>>>16&255,l>>>8&255,255&l,c>>>24&255,c>>>16&255,c>>>8&255,255&c,u.isLeading<<2|u.dependsOn,u.isDependedOn<<6|u.hasRedundancy<<4|u.paddingValue<<1|u.isNonSync,61440&u.degradPrio,15&u.degradPrio,d>>>24&255,d>>>16&255,d>>>8&255,255&d],12+16*o);return qy.box(qy.types.trun,n)}static initSegment(t){qy.types||qy.init();const e=qy.moov(t);return gp(qy.FTYP,e)}}qy.types=void 0,qy.HDLR_TYPES=void 0,qy.STTS=void 0,qy.STSC=void 0,qy.STCO=void 0,qy.STSZ=void 0,qy.VMHD=void 0,qy.SMHD=void 0,qy.STSD=void 0,qy.FTYP=void 0,qy.DINF=void 0;function Gy(t,e,r=1,i=!1){const s=t*e*r;return i?Math.round(s):s}function Hy(t,e=!1){return Gy(t,1e3,1/9e4,e)}let Vy,Ky=null,Wy=null;class zy{constructor(t,e,r,i=""){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=t,this.config=e,this.typeSupported=r,this.ISGenerated=!1,null===Ky){const t=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Ky=t?parseInt(t[1]):0}if(null===Wy){const t=navigator.userAgent.match(/Safari\/(\d+)/i);Wy=t?parseInt(t[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(t){Zh.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=t}resetNextTimestamp(){Zh.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){Zh.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(t){let e=!1;const r=t.reduce(((t,r)=>{const i=r.pts-t;return i<-4294967296?(e=!0,jy(t,r.pts)):i>0?t:r.pts}),t[0].pts);return e&&Zh.debug("PTS rollover detected"),r}remux(t,e,r,i,s,n,o,a){let l,c,u,d,h,f,p=s,g=s;const m=t.pid>-1,y=e.pid>-1,v=e.samples.length,_=t.samples.length>0,E=o&&v>0||v>1;if((!m||_)&&(!y||E)||this.ISGenerated||o){if(this.ISGenerated){var T,w,S,b;const t=this.videoTrackConfig;!t||e.width===t.width&&e.height===t.height&&(null==(T=e.pixelRatio)?void 0:T[0])===(null==(w=t.pixelRatio)?void 0:w[0])&&(null==(S=e.pixelRatio)?void 0:S[1])===(null==(b=t.pixelRatio)?void 0:b[1])||this.resetInitSegment()}else u=this.generateIS(t,e,s,n);const r=this.isVideoContiguous;let i,o=-1;if(E&&(o=function(t){for(let e=0;e0){Zh.warn(`[mp4-remuxer]: Dropped ${o} out of ${v} video samples due to a missing keyframe`);const t=this.getVideoStartPts(e.samples);e.samples=e.samples.slice(o),e.dropped+=o,g+=(e.samples[0].pts-t)/e.inputTimeScale,i=g}else-1===o&&(Zh.warn(`[mp4-remuxer]: No keyframe found out of ${v} video samples`),f=!1);if(this.ISGenerated){if(_&&E){const r=this.getVideoStartPts(e.samples),i=(jy(t.samples[0].pts,r)-r)/e.inputTimeScale;p+=Math.max(0,i),g+=Math.max(0,-i)}if(_){if(t.samplerate||(Zh.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),u=this.generateIS(t,e,s,n)),c=this.remuxAudio(t,p,this.isAudioContiguous,n,y||E||a===ng?g:void 0),E){const i=c?c.endPTS-c.startPTS:0;e.inputTimeScale||(Zh.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),u=this.generateIS(t,e,s,n)),l=this.remuxVideo(e,g,r,i)}}else E&&(l=this.remuxVideo(e,g,r,0));l&&(l.firstKeyFrame=o,l.independent=-1!==o,l.firstKeyFramePTS=i)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(r.samples.length&&(h=Yy(r,s,this._initPTS,this._initDTS)),i.samples.length&&(d=Xy(i,s,this._initPTS))),{audio:c,video:l,initSegment:u,independent:f,text:d,id3:h}}generateIS(t,e,r,i){const s=t.samples,n=e.samples,o=this.typeSupported,a={},l=this._initPTS;let c,u,d,h=!l||i,f="audio/mp4";if(h&&(c=u=1/0),t.config&&s.length){switch(t.timescale=t.samplerate,t.segmentCodec){case"mp3":o.mpeg?(f="audio/mpeg",t.codec=""):o.mp3&&(t.codec="mp3");break;case"ac3":t.codec="ac-3"}a.audio={id:"audio",container:f,codec:t.codec,initSegment:"mp3"===t.segmentCodec&&o.mpeg?new Uint8Array(0):qy.initSegment([t]),metadata:{channelCount:t.channelCount}},h&&(d=t.inputTimeScale,l&&d===l.timescale?h=!1:c=u=s[0].pts-Math.round(d*r))}if(e.sps&&e.pps&&n.length){if(e.timescale=e.inputTimeScale,a.video={id:"main",container:"video/mp4",codec:e.codec,initSegment:qy.initSegment([e]),metadata:{width:e.width,height:e.height}},h)if(d=e.inputTimeScale,l&&d===l.timescale)h=!1;else{const t=this.getVideoStartPts(n),e=Math.round(d*r);u=Math.min(u,jy(n[0].dts,t)-e),c=Math.min(c,t-e)}this.videoTrackConfig={width:e.width,height:e.height,pixelRatio:e.pixelRatio}}if(Object.keys(a).length)return this.ISGenerated=!0,h?(this._initPTS={baseTime:c,timescale:d},this._initDTS={baseTime:u,timescale:d}):c=d=void 0,{tracks:a,initPTS:c,timescale:d}}remuxVideo(t,e,r,i){const s=t.inputTimeScale,n=t.samples,o=[],a=n.length,l=this._initPTS;let c,u,d=this.nextAvcDts,h=8,f=this.videoSampleDuration,p=Number.POSITIVE_INFINITY,g=Number.NEGATIVE_INFINITY,m=!1;if(!r||null===d){const t=e*s,i=n[0].pts-jy(n[0].dts,n[0].pts);Ky&&null!==d&&Math.abs(t-i-d)<15e3?r=!0:d=t-i}const y=l.baseTime*s/l.timescale;for(let t=0;t0?t-1:t].dts&&(m=!0)}m&&n.sort((function(t,e){const r=t.dts-e.dts,i=t.pts-e.pts;return r||i})),c=n[0].dts,u=n[n.length-1].dts;const v=u-c,_=v?Math.round(v/(a-1)):f||t.inputTimeScale/30;if(r){const t=c-d,r=t>_,i=t<-1;if((r||i)&&(r?Zh.warn(`AVC: ${Hy(t,!0)} ms (${t}dts) hole between fragments detected at ${e.toFixed(3)}`):Zh.warn(`AVC: ${Hy(-t,!0)} ms (${t}dts) overlapping between fragments detected at ${e.toFixed(3)}`),!i||d>=n[0].pts||Ky)){c=d;const e=n[0].pts-t;if(r)n[0].dts=c,n[0].pts=e;else for(let r=0;re);r++)n[r].dts-=t,n[r].pts-=t;Zh.log(`Video: Initial PTS/DTS adjusted: ${Hy(e,!0)}/${Hy(c,!0)}, delta: ${Hy(t,!0)} ms`)}}c=Math.max(0,c);let E=0,T=0,w=c;for(let t=0;t0?e.dts-n[t-1].dts:_;if(l=t>0?e.pts-n[t-1].pts:_,r.stretchShortVideoTrack&&null!==this.nextAudioPts){const t=Math.floor(r.maxBufferHole*s),n=(i?p+i*s:this.nextAudioPts)-e.pts;n>t?(f=n-o,f<0?f=o:L=!0,Zh.log(`[mp4-remuxer]: It is approximately ${n/90} ms to the next segment; using duration ${f/90} ms for the last video frame.`)):f=o}else f=o}const u=Math.round(e.pts-e.dts);A=Math.min(A,f),C=Math.max(C,f),k=Math.min(k,l),x=Math.max(x,l),o.push(new Qy(e.key,f,c,u))}if(o.length)if(Ky){if(Ky<70){const t=o[0].flags;t.dependsOn=2,t.isNonSync=0}}else if(Wy&&x-k0&&(i&&Math.abs(m-g)<9e3||Math.abs(jy(f[0].pts-y,m)-g)<20*l),f.forEach((function(t){t.pts=jy(t.pts-y,m)})),!r||g<0){if(f=f.filter((t=>t.pts>=0)),!f.length)return;g=0===s?0:i&&!h?Math.max(0,m):f[0].pts}if("aac"===t.segmentCodec){const e=this.config.maxAudioFramesDrift;for(let r=0,i=g;r=e*l&&c<1e4&&h){let e=Math.round(a/l);i=o-e*l,i<0&&(e--,i+=l),0===r&&(this.nextAudioPts=g=i),Zh.warn(`[mp4-remuxer]: Injecting ${e} audio frame @ ${(i/n).toFixed(3)}s due to ${Math.round(1e3*a/n)} ms gap.`);for(let n=0;n0))return;T+=p;try{v=new Uint8Array(T)}catch(t){return void this.observer.emit(Kh.ERROR,Kh.ERROR,{type:Wh.MUX_ERROR,details:zh.REMUX_ALLOC_ERROR,fatal:!1,error:t,bytes:T,reason:`fail allocating audio mdat ${T}`})}if(!u){new DataView(v.buffer).setUint32(0,T),v.set(qy.types.mdat,4)}}v.set(s,p);const l=s.byteLength;p+=l,d.push(new Qy(!0,a,l,0)),E=n}const S=d.length;if(!S)return;const b=d[d.length-1];this.nextAudioPts=g=E+o*b.duration;const D=u?new Uint8Array(0):qy.moof(t.sequenceNumber++,_/o,qh({},t,{samples:d}));t.samples=[];const L=_/n,A=g/n,k={data1:D,data2:v,startPTS:L,endPTS:A,startDTS:L,endDTS:A,type:"audio",hasAudio:!0,hasVideo:!1,nb:S};return this.isAudioContiguous=!0,k}remuxEmptyAudio(t,e,r,i){const s=t.inputTimeScale,n=s/(t.samplerate?t.samplerate:s),o=this.nextAudioPts,a=this._initDTS,l=9e4*a.baseTime/a.timescale,c=(null!==o?o:i.startDTS*s)+l,u=i.endDTS*s+l,d=1024*n,h=Math.ceil((u-c)/d),f=Uy.getSilentFrame(t.manifestCodec||t.codec,t.channelCount);if(Zh.warn("[mp4-remuxer]: remux empty Audio"),!f)return void Zh.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");const p=[];for(let t=0;t4294967296;)t+=r;return t}function Yy(t,e,r,i){const s=t.samples.length;if(!s)return;const n=t.inputTimeScale;for(let o=0;ot.pts-e.pts));const n=t.samples;return t.samples=[],{samples:n}}class Qy{constructor(t,e,r,i){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=e,this.size=r,this.cts=i,this.flags={isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:t?2:1,isNonSync:t?0:1}}}function Zy(t,e){const r=null==t?void 0:t.codec;if(r&&r.length>4)return r;if(e===of){if("ec-3"===r||"ac-3"===r||"alac"===r)return r;if("fLaC"===r||"Opus"===r){return Up(r,!1)}const t="mp4a.40.5";return Zh.info(`Parsed audio codec "${r}" or audio object type not handled. Using "${t}"`),t}return Zh.warn(`Unhandled video codec "${r}"`),"hvc1"===r||"hev1"===r?"hvc1.1.6.L120.90":"av01"===r?"av01.0.04M.08":"avc1.42e01e"}try{Vy=self.performance.now.bind(self.performance)}catch(t){Zh.debug("Unable to use Performance API on this environment"),Vy=null==mf?void 0:mf.Date.now}const Jy=[{demux:class{constructor(t,e){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=e}resetTimeStamp(){}resetInitSegment(t,e,r,i){const s=this.videoTrack=ry("video",1),n=this.audioTrack=ry("audio",1),o=this.txtTrack=ry("text",1);if(this.id3Track=ry("id3",1),this.timeOffset=0,null==t||!t.byteLength)return;const a=lp(t);if(a.video){const{id:t,timescale:e,codec:r}=a.video;s.id=t,s.timescale=o.timescale=e,s.codec=r}if(a.audio){const{id:t,timescale:e,codec:r}=a.audio;n.id=t,n.timescale=e,n.codec=r}o.id=Jf.text,s.sampleDuration=0,s.duration=n.duration=i}resetContiguity(){this.remainderData=null}static probe(t){return function(t){const e=t.byteLength;for(let r=0;r8&&109===t[r+4]&&111===t[r+5]&&111===t[r+6]&&102===t[r+7])return!0;r=i>1?r+i:e}return!1}(t)}demux(t,e){this.timeOffset=e;let r=t;const i=this.videoTrack,s=this.txtTrack;if(this.config.progressive){this.remainderData&&(r=gp(this.remainderData,t));const e=function(t){const e={valid:null,remainder:null},r=op(t,["moof"]);if(r.length<2)return e.remainder=t,e;const i=r[r.length-1];return e.valid=Pf(t,0,i.byteOffset-8),e.remainder=Pf(t,i.byteOffset-8),e}(r);this.remainderData=e.remainder,i.samples=e.valid||new Uint8Array}else i.samples=r;const n=this.extractID3Track(i,e);return s.samples=mp(e,i),{videoTrack:i,audioTrack:this.audioTrack,id3Track:n,textTrack:this.txtTrack}}flush(){const t=this.timeOffset,e=this.videoTrack,r=this.txtTrack;e.samples=this.remainderData||new Uint8Array,this.remainderData=null;const i=this.extractID3Track(e,this.timeOffset);return r.samples=mp(t,e),{videoTrack:e,audioTrack:ry(),id3Track:i,textTrack:ry()}}extractID3Track(t,e){const r=this.id3Track;if(t.samples.length){const i=op(t.samples,["emsg"]);i&&i.forEach((t=>{const i=function(t){const e=t[0];let r="",i="",s=0,n=0,o=0,a=0,l=0,c=0;if(0===e){for(;"\0"!==tp(t.subarray(c,c+1));)r+=tp(t.subarray(c,c+1)),c+=1;for(r+=tp(t.subarray(c,c+1)),c+=1;"\0"!==tp(t.subarray(c,c+1));)i+=tp(t.subarray(c,c+1)),c+=1;i+=tp(t.subarray(c,c+1)),c+=1,s=rp(t,12),n=rp(t,16),a=rp(t,20),l=rp(t,24),c=28}else if(1===e){c+=4,s=rp(t,c),c+=4;const e=rp(t,c);c+=4;const n=rp(t,c);for(c+=4,o=2**32*e+n,Hh(o)||(o=Number.MAX_SAFE_INTEGER,Zh.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),a=rp(t,c),c+=4,l=rp(t,c),c+=4;"\0"!==tp(t.subarray(c,c+1));)r+=tp(t.subarray(c,c+1)),c+=1;for(r+=tp(t.subarray(c,c+1)),c+=1;"\0"!==tp(t.subarray(c,c+1));)i+=tp(t.subarray(c,c+1)),c+=1;i+=tp(t.subarray(c,c+1)),c+=1}return{schemeIdUri:r,value:i,timeScale:s,presentationTime:o,presentationTimeDelta:n,eventDuration:a,id:l,payload:t.subarray(c,t.byteLength)}}(t);if(Sy.test(i.schemeIdUri)){const t=Gh(i.presentationTime)?i.presentationTime/i.timeScale:e+i.presentationTimeDelta/i.timeScale;let s=4294967295===i.eventDuration?Number.POSITIVE_INFINITY:i.eventDuration/i.timeScale;s<=.001&&(s=Number.POSITIVE_INFINITY);const n=i.payload;r.samples.push({data:n,len:n.byteLength,dts:t,pts:t,type:yg,duration:s})}}))}return r}demuxSampleAes(t,e,r){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){}},remux:class{constructor(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null}destroy(){}resetTimeStamp(t){this.initPTS=t,this.lastEndTime=null}resetNextTimestamp(){this.lastEndTime=null}resetInitSegment(t,e,r,i){this.audioCodec=e,this.videoCodec=r,this.generateInitSegment(function(t,e){if(!t||!e)return t;const r=e.keyId;r&&e.isCommonEncryption&&op(t,["moov","trak"]).forEach((t=>{const e=op(t,["mdia","minf","stbl","stsd"])[0].subarray(8);let i=op(e,["enca"]);const s=i.length>0;s||(i=op(e,["encv"])),i.forEach((t=>{op(s?t.subarray(28):t.subarray(78),["sinf"]).forEach((t=>{const e=fp(t);if(e){const t=e.subarray(8,24);t.some((t=>0!==t))||(Zh.log(`[eme] Patching keyId in 'enc${s?"a":"v"}>sinf>>tenc' box: ${Xf(t)} -> ${Xf(r)}`),e.set(r,8))}}))}))}));return t}(t,i)),this.emitInitSegment=!0}generateInitSegment(t){let{audioCodec:e,videoCodec:r}=this;if(null==t||!t.byteLength)return this.initTracks=void 0,void(this.initData=void 0);const i=this.initData=lp(t);i.audio&&(e=Zy(i.audio,of)),i.video&&(r=Zy(i.video,af));const s={};i.audio&&i.video?s.audiovideo={container:"video/mp4",codec:e+","+r,initSegment:t,id:"main"}:i.audio?s.audio={container:"audio/mp4",codec:e,initSegment:t,id:"audio"}:i.video?s.video={container:"video/mp4",codec:r,initSegment:t,id:"main"}:Zh.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=s}remux(t,e,r,i,s,n){var o,a;let{initPTS:l,lastEndTime:c}=this;const u={audio:void 0,video:void 0,text:i,id3:r,initSegment:void 0};Gh(c)||(c=this.lastEndTime=s||0);const d=e.samples;if(null==d||!d.length)return u;const h={initPTS:void 0,timescale:1};let f=this.initData;if(null!=(o=f)&&o.length||(this.generateInitSegment(d),f=this.initData),null==(a=f)||!a.length)return Zh.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),u;this.emitInitSegment&&(h.tracks=this.initTracks,this.emitInitSegment=!1);const p=function(t,e){let r=0,i=0,s=0;const n=op(t,["moof","traf"]);for(let t=0;tt+e.info.duration||0),0);r=Math.max(r,t+n.earliestPresentationTime/n.timescale),i=r-e}}if(i&&Gh(i))return i}return i||s}(d,f),g=function(t,e){return op(e,["moof","traf"]).reduce(((e,r)=>{const i=op(r,["tfdt"])[0],s=i[0],n=op(r,["tfhd"]).reduce(((e,r)=>{const n=rp(r,4),o=t[n];if(o){let t=rp(i,4);if(1===s){if(t===Qf)return Zh.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),e;t*=Qf+1,t+=rp(i,8)}const r=t/(o.timescale||9e4);if(Gh(r)&&(null===e||rs}(l,m,s,p)||h.timescale!==l.timescale&&n)&&(h.initPTS=m-s,l&&1===l.timescale&&Zh.warn("Adjusting initPTS by "+(h.initPTS-l.baseTime)),this.initPTS=l={baseTime:h.initPTS,timescale:1});const y=t?m-l.baseTime/l.timescale:c,v=y+p;!function(t,e,r){op(e,["moof","traf"]).forEach((e=>{op(e,["tfhd"]).forEach((i=>{const s=rp(i,4),n=t[s];if(!n)return;const o=n.timescale||9e4;op(e,["tfdt"]).forEach((t=>{const e=t[0],i=r*o;if(i){let r=rp(t,4);if(0===e)r-=i,r=Math.max(r,0),np(t,4,r);else{r*=Math.pow(2,32),r+=rp(t,8),r-=i,r=Math.max(r,0);const e=Math.floor(r/(Qf+1)),s=Math.floor(r%(Qf+1));np(t,4,e),np(t,8,s)}}}))}))}))}(f,d,l.baseTime/l.timescale),p>0?this.lastEndTime=v:(Zh.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const _=!!f.audio,E=!!f.video;let T="";_&&(T+="audio"),E&&(T+="video");const w={data1:d,startPTS:y,startDTS:y,endPTS:v,endDTS:v,type:T,hasAudio:_,hasVideo:E,nb:1,dropped:0};return u.audio="audio"===w.type?w:void 0,u.video="audio"!==w.type?w:void 0,u.initSegment=h,u.id3=Yy(r,s,l,l),i.samples.length&&(u.text=Xy(i,s,l)),u}}},{demux:Py,remux:zy},{demux:class extends iy{constructor(t,e){super(),this.observer=void 0,this.config=void 0,this.observer=t,this.config=e}resetInitSegment(t,e,r,i){super.resetInitSegment(t,e,r,i),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:e,duration:i,inputTimeScale:9e4,dropped:0}}static probe(t){if(!t)return!1;const e=Mf(t,0);let r=(null==e?void 0:e.length)||0;if(wy(t,r))return!1;for(let e=t.length;r0&&null!=(null==e?void 0:e.key)&&null!==e.iv&&null!=e.method&&(r=e);return r}(n,e);if(_&&"AES-128"===_.method){const t=this.getDecrypter();if(!t.isSync())return this.decryptionPromise=t.webCryptoDecrypt(n,_.key.buffer,_.iv.buffer).then((t=>{const e=this.push(t,null,r);return this.decryptionPromise=null,e})),this.decryptionPromise;{let e=t.softwareDecrypt(n,_.key.buffer,_.iv.buffer);if(r.part>-1&&(e=t.flush()),!e)return s.executeEnd=Vy(),ev(r);n=new Uint8Array(e)}}const E=this.needsProbing(c,u);if(E){const t=this.configureTransmuxer(n);if(t)return Zh.warn(`[transmuxer] ${t.message}`),this.observer.emit(Kh.ERROR,Kh.ERROR,{type:Wh.MEDIA_ERROR,details:zh.FRAG_PARSING_ERROR,fatal:!1,error:t,reason:t.message}),s.executeEnd=Vy(),ev(r)}(c||u||f||E)&&this.resetInitSegment(v,p,g,y,e),(c||f||E)&&this.resetInitialTimestamp(m),l||this.resetContiguity();const T=this.transmux(n,_,h,d,r),w=this.currentTransmuxState;return w.contiguous=!0,w.discontinuity=!1,w.trackSwitch=!1,s.executeEnd=Vy(),T}flush(t){const e=t.transmuxing;e.executeStart=Vy();const{decrypter:r,currentTransmuxState:i,decryptionPromise:s}=this;if(s)return s.then((()=>this.flush(t)));const n=[],{timeOffset:o}=i;if(r){const e=r.flush();e&&n.push(this.push(e,null,t))}const{demuxer:a,remuxer:l}=this;if(!a||!l)return e.executeEnd=Vy(),[ev(t)];const c=a.flush(o);return rv(c)?c.then((e=>(this.flushRemux(n,e,t),n))):(this.flushRemux(n,c,t),n)}flushRemux(t,e,r){const{audioTrack:i,videoTrack:s,id3Track:n,textTrack:o}=e,{accurateTimeOffset:a,timeOffset:l}=this.currentTransmuxState;Zh.log(`[transmuxer.ts]: Flushed fragment ${r.sn}${r.part>-1?" p: "+r.part:""} of level ${r.level}`);const c=this.remuxer.remux(i,s,n,o,l,a,!0,this.id);t.push({remuxResult:c,chunkMeta:r}),r.transmuxing.executeEnd=Vy()}resetInitialTimestamp(t){const{demuxer:e,remuxer:r}=this;e&&r&&(e.resetTimeStamp(t),r.resetTimeStamp(t))}resetContiguity(){const{demuxer:t,remuxer:e}=this;t&&e&&(t.resetContiguity(),e.resetNextTimestamp())}resetInitSegment(t,e,r,i,s){const{demuxer:n,remuxer:o}=this;n&&o&&(n.resetInitSegment(t,e,r,i),o.resetInitSegment(t,e,r,s))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(t,e,r,i,s){let n;return n=e&&"SAMPLE-AES"===e.method?this.transmuxSampleAes(t,e,r,i,s):this.transmuxUnencrypted(t,r,i,s),n}transmuxUnencrypted(t,e,r,i){const{audioTrack:s,videoTrack:n,id3Track:o,textTrack:a}=this.demuxer.demux(t,e,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(s,n,o,a,e,r,!1,this.id),chunkMeta:i}}transmuxSampleAes(t,e,r,i,s){return this.demuxer.demuxSampleAes(t,e,r).then((t=>({remuxResult:this.remuxer.remux(t.audioTrack,t.videoTrack,t.id3Track,t.textTrack,r,i,!1,this.id),chunkMeta:s})))}configureTransmuxer(t){const{config:e,observer:r,typeSupported:i,vendor:s}=this;let n;for(let e=0,r=Jy.length;e({remuxResult:{},chunkMeta:t});function rv(t){return"then"in t&&t.then instanceof Function}class iv{constructor(t,e,r,i,s){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=t,this.videoCodec=e,this.initSegmentData=r,this.duration=i,this.defaultInitPts=s||null}}class sv{constructor(t,e,r,i,s,n){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=t,this.contiguous=e,this.accurateTimeOffset=r,this.trackSwitch=i,this.timeOffset=s,this.initSegmentChange=n}}var nv={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,r="~";function i(){}function s(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function n(t,e,i,n,o){if("function"!=typeof i)throw new TypeError("The listener must be a function");var a=new s(i,n||t,o),l=r?r+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 o(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__||(r=!1)),a.prototype.eventNames=function(){var t,i,s=[];if(0===this._eventsCount)return s;for(i in t=this._events)e.call(t,i)&&s.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(t)):s},a.prototype.listeners=function(t){var e=r?r+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var s=0,n=i.length,o=new Array(n);s{(e=e||{}).frag=this.frag,e.id=this.id,t===Kh.ERROR&&(this.error=e.error),this.hls.trigger(t,e)};this.observer=new ov,this.observer.on(Kh.FRAG_DECRYPTED,n),this.observer.on(Kh.ERROR,n);const o=xp(s.preferManagedMediaSource)||{isTypeSupported:()=>!1},a={mpeg:o.isTypeSupported("audio/mpeg"),mp3:o.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:o.isTypeSupported('audio/mp4; codecs="ac-3"')};if(this.useWorker&&"undefined"!=typeof Worker){if(s.workerPath||"function"==typeof __HLS_WORKER_BUNDLE__){try{s.workerPath?(Zh.log(`loading Web Worker ${s.workerPath} for "${e}"`),this.workerContext=function(t){const e=new self.URL(t,self.location.href).href;return{worker:new self.Worker(e),scriptURL:e}}(s.workerPath)):(Zh.log(`injecting Web Worker for "${e}"`),this.workerContext=function(){const t=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),e=self.URL.createObjectURL(t);return{worker:new self.Worker(e),objectURL:e}}()),this.onwmsg=t=>this.onWorkerMessage(t);const{worker:t}=this.workerContext;t.addEventListener("message",this.onwmsg),t.onerror=t=>{const r=new Error(`${t.message} (${t.filename}:${t.lineno})`);s.enableWorker=!1,Zh.warn(`Error in "${e}" Web Worker, fallback to inline`),this.hls.trigger(Kh.ERROR,{type:Wh.OTHER_ERROR,details:zh.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:r})},t.postMessage({cmd:"init",typeSupported:a,vendor:"",id:e,config:JSON.stringify(s)})}catch(t){Zh.warn(`Error setting up "${e}" Web Worker, fallback to inline`,t),this.resetWorker(),this.error=null,this.transmuxer=new tv(this.observer,a,s,"",e)}return}}this.transmuxer=new tv(this.observer,a,s,"",e)}resetWorker(){if(this.workerContext){const{worker:t,objectURL:e}=this.workerContext;e&&self.URL.revokeObjectURL(e),t.removeEventListener("message",this.onwmsg),t.onerror=null,t.terminate(),this.workerContext=null}}destroy(){if(this.workerContext)this.resetWorker(),this.onwmsg=void 0;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const t=this.observer;t&&t.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null}push(t,e,r,i,s,n,o,a,l,c){var u,d;l.transmuxing.start=self.performance.now();const{transmuxer:h}=this,f=n?n.start:s.start,p=s.decryptdata,g=this.frag,m=!(g&&s.cc===g.cc),y=!(g&&l.level===g.level),v=g?l.sn-g.sn:-1,_=this.part?l.part-this.part.index:-1,E=0===v&&l.id>1&&l.id===(null==g?void 0:g.stats.chunkCount),T=!y&&(1===v||0===v&&(1===_||E&&_<=0)),w=self.performance.now();(y||v||0===s.stats.parsing.start)&&(s.stats.parsing.start=w),!n||!_&&T||(n.stats.parsing.start=w);const S=!(g&&(null==(u=s.initSegment)?void 0:u.url)===(null==(d=g.initSegment)?void 0:d.url)),b=new sv(m,T,a,y,f,S);if(!T||m||S){Zh.log(`[transmuxer-interface, ${s.type}]: Starting new transmux session for sn: ${l.sn} p: ${l.part} level: ${l.level} id: ${l.id}\n discontinuity: ${m}\n trackSwitch: ${y}\n contiguous: ${T}\n accurateTimeOffset: ${a}\n timeOffset: ${f}\n initSegmentChange: ${S}`);const t=new iv(r,i,e,o,c);this.configureTransmuxer(t)}if(this.frag=s,this.part=n,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:t,decryptdata:p,chunkMeta:l,state:b},t instanceof ArrayBuffer?[t]:[]);else if(h){const e=h.push(t,p,l,b);rv(e)?(h.async=!0,e.then((t=>{this.handleTransmuxComplete(t)})).catch((t=>{this.transmuxerError(t,l,"transmuxer-interface push error")}))):(h.async=!1,this.handleTransmuxComplete(e))}}flush(t){t.transmuxing.start=self.performance.now();const{transmuxer:e}=this;if(this.workerContext)this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:t});else if(e){let r=e.flush(t);rv(r)||e.async?(rv(r)||(r=Promise.resolve(r)),r.then((e=>{this.handleFlushResult(e,t)})).catch((e=>{this.transmuxerError(e,t,"transmuxer-interface flush error")}))):this.handleFlushResult(r,t)}}transmuxerError(t,e,r){this.hls&&(this.error=t,this.hls.trigger(Kh.ERROR,{type:Wh.MEDIA_ERROR,details:zh.FRAG_PARSING_ERROR,chunkMeta:e,frag:this.frag||void 0,fatal:!1,error:t,err:t,reason:r}))}handleFlushResult(t,e){t.forEach((t=>{this.handleTransmuxComplete(t)})),this.onFlush(e)}onWorkerMessage(t){const e=t.data;if(null==e||!e.event)return void Zh.warn("worker message received with no "+(e?"event name":"data"));const r=this.hls;if(this.hls)switch(e.event){case"init":{var i;const t=null==(i=this.workerContext)?void 0:i.objectURL;t&&self.URL.revokeObjectURL(t);break}case"transmuxComplete":this.handleTransmuxComplete(e.data);break;case"flush":this.onFlush(e.data);break;case"workerLog":Zh[e.data.logType]&&Zh[e.data.logType](e.data.message);break;default:e.data=e.data||{},e.data.frag=this.frag,e.data.id=this.id,r.trigger(e.event,e.data)}}configureTransmuxer(t){const{transmuxer:e}=this;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:t}):e&&e.configure(t)}handleTransmuxComplete(t){t.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(t)}}function lv(t,e){if(t.length!==e.length)return!1;for(let r=0;rt[r]!==e[r]))}function uv(t,e){return e.label.toLowerCase()===t.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(t.lang||"").toLowerCase())}class dv{constructor(t){this.buffered=void 0;const e=(e,r,i)=>{if((r>>>=0)>i-1)throw new DOMException(`Failed to execute '${e}' on 'TimeRanges': The index provided (${r}) is greater than the maximum bound (${i})`);return t[r][e]};this.buffered={get length(){return t.length},end(r){return e("end",r,t.length)},start(r){return e("start",r,t.length)}}}}class hv{constructor(t){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=t}append(t,e,r){const i=this.queues[e];i.push(t),1!==i.length||r||this.executeNext(e)}insertAbort(t,e){this.queues[e].unshift(t),this.executeNext(e)}appendBlocker(t){let e;const r=new Promise((t=>{e=t})),i={execute:e,onStart:()=>{},onComplete:()=>{},onError:()=>{}};return this.append(i,t),r}executeNext(t){const e=this.queues[t];if(e.length){const r=e[0];try{r.execute()}catch(e){Zh.warn(`[buffer-operation-queue]: Exception executing "${t}" SourceBuffer operation: ${e}`),r.onError(e);const i=this.buffers[t];null!=i&&i.updating||this.shiftAndExecuteNext(t)}}}shiftAndExecuteNext(t){this.queues[t].shift(),this.executeNext(t)}current(t){return this.queues[t][0]}}const fv=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/;function pv(t){const e=t.querySelectorAll("source");[].slice.call(e).forEach((e=>{t.removeChild(e)}))}const gv={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},mv=t=>String.fromCharCode(gv[t]||t),yv=15,vv=100,_v={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Ev={17:2,18:4,21:6,22:8,23:10,19:13,20:15},Tv={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},wv={25:2,26:4,29:6,30:8,31:10,27:13,28:15},Sv=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class bv{constructor(){this.time=null,this.verboseLevel=0}log(t,e){if(this.verboseLevel>=t){const r="function"==typeof e?e():e;Zh.log(`${this.time} [${t}] ${r}`)}}}const Dv=function(t){const e=[];for(let r=0;rvv&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=vv)}moveCursor(t){const e=this.pos+t;if(t>1)for(let t=this.pos+1;t=144&&this.backSpace();const e=mv(t);this.pos>=vv?this.logger.log(0,(()=>"Cannot insert "+t.toString(16)+" ("+e+") at position "+this.pos+". Skipping it!")):(this.chars[this.pos].setChar(e,this.currPenState),this.moveCursor(1))}clearFromPos(t){let e;for(e=t;e"pacData = "+JSON.stringify(t)));let e=t.row-1;if(this.nrRollUpRows&&e"bkgData = "+JSON.stringify(t))),this.backSpace(),this.setPen(t),this.insertChar(32)}setRollUpRows(t){this.nrRollUpRows=t}rollUp(){if(null===this.nrRollUpRows)return void this.logger.log(3,"roll_up but nrRollUpRows not set yet");this.logger.log(1,(()=>this.getDisplayText()));const t=this.currRow+1-this.nrRollUpRows,e=this.rows.splice(t,1)[0];e.clear(),this.rows.splice(this.currRow,0,e),this.logger.log(2,"Rolling up")}getDisplayText(t){t=t||!1;const e=[];let r="",i=-1;for(let r=0;r0&&(r=t?"["+e.join(" | ")+"]":e.join("\n")),r}getTextAndFormat(){return this.rows}}class xv{constructor(t,e,r){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=t,this.outputFilter=e,this.mode=null,this.verbose=0,this.displayedMemory=new Cv(r),this.nonDisplayedMemory=new Cv(r),this.lastOutputScreen=new Cv(r),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=r}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(t){this.outputFilter=t}setPAC(t){this.writeScreen.setPAC(t)}setBkgData(t){this.writeScreen.setBkgData(t)}setMode(t){t!==this.mode&&(this.mode=t,this.logger.log(2,(()=>"MODE="+t)),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=t)}insertChars(t){for(let e=0;ee+": "+this.writeScreen.getDisplayText(!0))),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(this.logger.log(1,(()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0))),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(t){this.logger.log(2,"RU("+t+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(t)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),"MODE_POP-ON"===this.mode){const t=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=t,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,(()=>"DISP: "+this.displayedMemory.getDisplayText()))}this.outputDataUpdate(!0)}ccTO(t){this.logger.log(2,"TO("+t+") - Tab Offset"),this.writeScreen.moveCursor(t)}ccMIDROW(t){const e={flash:!1};if(e.underline=t%2==1,e.italics=t>=46,e.italics)e.foreground="white";else{const r=Math.floor(t/2)-16,i=["white","green","blue","cyan","red","yellow","magenta"];e.foreground=i[r]}this.logger.log(2,"MIDROW: "+JSON.stringify(e)),this.writeScreen.setPen(e)}outputDataUpdate(t=!1){const e=this.logger.time;null!==e&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,e,this.lastOutputScreen),t&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:e):this.cueStartTime=e,this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(t){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,t,this.displayedMemory),this.cueStartTime=t))}}class Rv{constructor(t,e,r){this.channels=void 0,this.currentChannel=0,this.cmdHistory={a:null,b:null},this.logger=void 0;const i=this.logger=new bv;this.channels=[null,new xv(t,e,i),new xv(t+1,r,i)]}getHandler(t){return this.channels[t].getHandler()}setHandler(t,e){this.channels[t].setHandler(e)}addData(t,e){this.logger.time=t;for(let t=0;t"["+Dv([e[t],e[t+1]])+"] -> ("+Dv([r,i])+")"));const o=this.cmdHistory;if(r>=16&&r<=31){if(Iv(r,i,o)){Pv(null,null,o),this.logger.log(3,(()=>"Repeated command ("+Dv([r,i])+") is dropped"));continue}Pv(r,i,this.cmdHistory),s=this.parseCmd(r,i),s||(s=this.parseMidrow(r,i)),s||(s=this.parsePAC(r,i)),s||(s=this.parseBackgroundAttributes(r,i))}else Pv(null,null,o);if(!s&&(n=this.parseChars(r,i),n)){const t=this.currentChannel;if(t&&t>0){this.channels[t].insertChars(n)}else this.logger.log(2,"No channel found yet. TEXT-MODE?")}s||n||this.logger.log(2,(()=>"Couldn't parse cleaned data "+Dv([r,i])+" orig: "+Dv([e[t],e[t+1]])))}}parseCmd(t,e){if(!((20===t||28===t||21===t||29===t)&&e>=32&&e<=47)&&!((23===t||31===t)&&e>=33&&e<=35))return!1;const r=20===t||21===t||23===t?1:2,i=this.channels[r];return 20===t||21===t||28===t||29===t?32===e?i.ccRCL():33===e?i.ccBS():34===e?i.ccAOF():35===e?i.ccAON():36===e?i.ccDER():37===e?i.ccRU(2):38===e?i.ccRU(3):39===e?i.ccRU(4):40===e?i.ccFON():41===e?i.ccRDC():42===e?i.ccTR():43===e?i.ccRTD():44===e?i.ccEDM():45===e?i.ccCR():46===e?i.ccENM():47===e&&i.ccEOC():i.ccTO(e-32),this.currentChannel=r,!0}parseMidrow(t,e){let r=0;if((17===t||25===t)&&e>=32&&e<=47){if(r=17===t?1:2,r!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const i=this.channels[r];return!!i&&(i.ccMIDROW(e),this.logger.log(3,(()=>"MIDROW ("+Dv([t,e])+")")),!0)}return!1}parsePAC(t,e){let r;if(!((t>=17&&t<=23||t>=25&&t<=31)&&e>=64&&e<=127)&&!((16===t||24===t)&&e>=64&&e<=95))return!1;const i=t<=23?1:2;r=e>=64&&e<=95?1===i?_v[t]:Tv[t]:1===i?Ev[t]:wv[t];const s=this.channels[i];return!!s&&(s.setPAC(this.interpretPAC(r,e)),this.currentChannel=i,!0)}interpretPAC(t,e){let r;const i={color:null,italics:!1,indent:null,underline:!1,row:t};return r=e>95?e-96:e-64,i.underline=!(1&~r),r<=13?i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(r/2)]:r<=15?(i.italics=!0,i.color="white"):i.indent=4*Math.floor((r-16)/2),i}parseChars(t,e){let r,i=null,s=null;if(t>=25?(r=2,s=t-8):(r=1,s=t),s>=17&&s<=19){let t;t=17===s?e+80:18===s?e+112:e+144,this.logger.log(2,(()=>"Special char '"+mv(t)+"' in channel "+r)),i=[t]}else t>=32&&t<=127&&(i=0===e?[t]:[t,e]);return i&&this.logger.log(3,(()=>"Char codes = "+Dv(i).join(","))),i}parseBackgroundAttributes(t,e){if(!((16===t||24===t)&&e>=32&&e<=47)&&!((23===t||31===t)&&e>=45&&e<=47))return!1;let r;const i={};16===t||24===t?(r=Math.floor((e-32)/2),i.background=Sv[r],e%2==1&&(i.background=i.background+"_semi")):45===e?i.background="transparent":(i.foreground="black",47===e&&(i.underline=!0));const s=t<=23?1:2;return this.channels[s].setBkgData(i),!0}reset(){for(let t=0;tt)&&(this.startTime=t),this.endTime=e,this.screen=r,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}var Mv=function(){if(null!=mf&&mf.VTTCue)return self.VTTCue;const t=["","lr","rl"],e=["start","middle","end","left","right"];function r(t,e){if("string"!=typeof e)return!1;if(!Array.isArray(t))return!1;const r=e.toLowerCase();return!!~t.indexOf(r)&&r}function i(t){return r(e,t)}function s(t,...e){let r=1;for(;r100)throw new Error("Position must be between 0 and 100.");_=t,this.hasBeenReset=!0}})),Object.defineProperty(a,"positionAlign",s({},l,{get:function(){return E},set:function(t){const e=i(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");E=e,this.hasBeenReset=!0}})),Object.defineProperty(a,"size",s({},l,{get:function(){return T},set:function(t){if(t<0||t>100)throw new Error("Size must be between 0 and 100.");T=t,this.hasBeenReset=!0}})),Object.defineProperty(a,"align",s({},l,{get:function(){return w},set:function(t){const e=i(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");w=e,this.hasBeenReset=!0}})),a.displayState=void 0}return n.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},n}();class Ov{decode(t,e){if(!t)return"";if("string"!=typeof t)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(t))}}function Nv(t){function e(t,e,r,i){return 3600*(0|t)+60*(0|e)+(0|r)+parseFloat(i||0)}const r=t.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return r?parseFloat(r[2])>59?e(r[2],r[3],0,r[4]):e(r[1],r[2],r[3],r[4]):null}class Bv{constructor(){this.values=Object.create(null)}set(t,e){this.get(t)||""===e||(this.values[t]=e)}get(t,e,r){return r?this.has(t)?this.values[t]:e[r]:this.has(t)?this.values[t]:e}has(t){return t in this.values}alt(t,e,r){for(let i=0;i=0&&r<=100)return this.set(t,r),!0}return!1}}function Uv(t,e,r,i){const s=i?t.split(i):[t];for(const t in s){if("string"!=typeof s[t])continue;const i=s[t].split(r);if(2!==i.length)continue;e(i[0],i[1])}}const $v=new Mv(0,0,""),qv="middle"===$v.align?"middle":"center";function Gv(t,e,r){const i=t;function s(){const e=Nv(t);if(null===e)throw new Error("Malformed timestamp: "+i);return t=t.replace(/^[^\sa-zA-Z-]+/,""),e}function n(){t=t.replace(/^\s+/,"")}if(n(),e.startTime=s(),n(),"--\x3e"!==t.slice(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+i);t=t.slice(3),n(),e.endTime=s(),n(),function(t,e){const i=new Bv;Uv(t,(function(t,e){let s;switch(t){case"region":for(let s=r.length-1;s>=0;s--)if(r[s].id===e){i.set(t,r[s].region);break}break;case"vertical":i.alt(t,e,["rl","lr"]);break;case"line":s=e.split(","),i.integer(t,s[0]),i.percent(t,s[0])&&i.set("snapToLines",!1),i.alt(t,s[0],["auto"]),2===s.length&&i.alt("lineAlign",s[1],["start",qv,"end"]);break;case"position":s=e.split(","),i.percent(t,s[0]),2===s.length&&i.alt("positionAlign",s[1],["start",qv,"end","line-left","line-right","auto"]);break;case"size":i.percent(t,e);break;case"align":i.alt(t,e,["start",qv,"end","left","right"])}}),/:/,/\s/),e.region=i.get("region",null),e.vertical=i.get("vertical","");let s=i.get("line","auto");"auto"===s&&-1===$v.line&&(s=-1),e.line=s,e.lineAlign=i.get("lineAlign","start"),e.snapToLines=i.get("snapToLines",!0),e.size=i.get("size",100),e.align=i.get("align",qv);let n=i.get("position","auto");"auto"===n&&50===$v.position&&(n="start"===e.align||"left"===e.align?0:"end"===e.align||"right"===e.align?100:50),e.position=n}(t,e)}function Hv(t){return t.replace(//gi,"\n")}class Vv{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new Ov,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(t){const e=this;function r(){let t=e.buffer,r=0;for(t=Hv(t);r>>0).toString()};function jv(t,e,r){return zv(t.toString())+zv(e.toString())+zv(r)}function Yv(t,e,r,i,s,n,o){const a=new Vv,l=zf(new Uint8Array(t)).trim().replace(Kv,"\n").split("\n"),c=[],u=e?function(t,e=1){return Gy(t,9e4,1/e)}(e.baseTime,e.timescale):0;let d,h="00:00.000",f=0,p=0,g=!0;a.oncue=function(t){const n=r[i];let o=r.ccOffset;const a=(f-u)/9e4;if(null!=n&&n.new&&(void 0!==p?o=r.ccOffset=n.start:function(t,e,r){let i=t[e],s=t[i.prevCC];if(!s||!s.new&&i.new)return t.ccOffset=t.presentationOffset=i.start,void(i.new=!1);for(;null!=(n=s)&&n.new;){var n;t.ccOffset+=i.start-s.start,i.new=!1,i=s,s=t[i.prevCC]}t.presentationOffset=r}(r,i,a)),a){if(!e)return void(d=new Error("Missing initPTS for VTT MPEGTS"));o=a-r.presentationOffset}const l=t.endTime-t.startTime,h=jy(9e4*(t.startTime+o-p),9e4*s)/9e4;t.startTime=Math.max(h,0),t.endTime=Math.max(h+l,0);const g=t.text.trim();t.text=decodeURIComponent(encodeURIComponent(g)),t.id||(t.id=jv(t.startTime,t.endTime,g)),t.endTime>0&&c.push(t)},a.onparsingerror=function(t){d=t},a.onflush=function(){d?o(d):n(c)},l.forEach((t=>{if(g){if(Wv(t,"X-TIMESTAMP-MAP=")){g=!1,t.slice(16).split(",").forEach((t=>{Wv(t,"LOCAL:")?h=t.slice(6):Wv(t,"MPEGTS:")&&(f=parseInt(t.slice(7)))}));try{p=function(t){let e=parseInt(t.slice(-3));const r=parseInt(t.slice(-6,-4)),i=parseInt(t.slice(-9,-7)),s=t.length>9?parseInt(t.substring(0,t.indexOf(":"))):0;if(!(Gh(e)&&Gh(r)&&Gh(i)&&Gh(s)))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${t}`);return e+=1e3*r,e+=6e4*i,e+=36e5*s,e}(h)/1e3}catch(t){d=t}return}""===t&&(g=!1)}a.parse(t+"\n")})),a.flush()}const Xv="stpp.ttml.im1t",Qv=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Zv=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Jv={left:"start",center:"center",right:"end",start:"start",end:"end"};function t_(t,e,r,i){const s=op(new Uint8Array(t),["mdat"]);if(0===s.length)return void i(new Error("Could not parse IMSC1 mdat"));const n=s.map((t=>zf(t))),o=function(t,e,r=1,i=!1){return Gy(t,e,1/r,i)}(e.baseTime,1,e.timescale);try{n.forEach((t=>r(function(t,e){const r=(new DOMParser).parseFromString(t,"text/xml"),i=r.getElementsByTagName("tt")[0];if(!i)throw new Error("Invalid ttml");const s={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},n=Object.keys(s).reduce(((t,e)=>(t[e]=i.getAttribute(`ttp:${e}`)||s[e],t)),{}),o="preserve"!==i.getAttribute("xml:space"),a=r_(e_(i,"styling","style")),l=r_(e_(i,"layout","region")),c=e_(i,"body","[begin]");return[].map.call(c,(t=>{const r=i_(t,o);if(!r||!t.hasAttribute("begin"))return null;const i=o_(t.getAttribute("begin"),n),s=o_(t.getAttribute("dur"),n);let c=o_(t.getAttribute("end"),n);if(null===i)throw n_(t);if(null===c){if(null===s)throw n_(t);c=i+s}const u=new Mv(i-e,c-e,r);u.id=jv(u.startTime,u.endTime,u.text);const d=function(t,e,r){const i="http://www.w3.org/ns/ttml#styling";let s=null;const n=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],o=null!=t&&t.hasAttribute("style")?t.getAttribute("style"):null;o&&r.hasOwnProperty(o)&&(s=r[o]);return n.reduce(((r,n)=>{const o=s_(e,i,n)||s_(t,i,n)||s_(s,i,n);return o&&(r[n]=o),r}),{})}(l[t.getAttribute("region")],a[t.getAttribute("style")],a),{textAlign:h}=d;if(h){const t=Jv[h];t&&(u.lineAlign=t),u.align=h}return qh(u,d),u})).filter((t=>null!==t))}(t,o))))}catch(t){i(t)}}function e_(t,e,r){const i=t.getElementsByTagName(e)[0];return i?[].slice.call(i.querySelectorAll(r)):[]}function r_(t){return t.reduce(((t,e)=>{const r=e.getAttribute("xml:id");return r&&(t[r]=e),t}),{})}function i_(t,e){return[].slice.call(t.childNodes).reduce(((t,r,i)=>{var s;return"br"===r.nodeName&&i?t+"\n":null!=(s=r.childNodes)&&s.length?i_(r,e):e?t+r.textContent.trim().replace(/\s+/g," "):t+r.textContent}),"")}function s_(t,e,r){return t&&t.hasAttributeNS(e,r)?t.getAttributeNS(e,r):null}function n_(t){return new Error(`Could not parse ttml timestamp ${t}`)}function o_(t,e){if(!t)return null;let r=Nv(t);return null===r&&(Qv.test(t)?r=function(t,e){const r=Qv.exec(t),i=(0|r[4])+(0|r[5])/e.subFrameRate;return 3600*(0|r[1])+60*(0|r[2])+(0|r[3])+i/e.frameRate}(t,e):Zv.test(t)&&(r=function(t,e){const r=Zv.exec(t),i=Number(r[1]);switch(r[2]){case"h":return 3600*i;case"m":return 60*i;case"ms":return 1e3*i;case"f":return i/e.frameRate;case"t":return i/e.tickRate}return i}(t,e))),r}function a_(t){return t.characteristics&&/transcribes-spoken-dialog/gi.test(t.characteristics)&&/describes-music-and-sound/gi.test(t.characteristics)?"captions":"subtitles"}function l_(t,e){return!!t&&t.kind===a_(e)&&uv(e,t)}class c_{constructor(t){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=t,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(t){this.streamController=t}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:t}=this;t.on(Kh.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),t.on(Kh.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(Kh.MANIFEST_PARSED,this.onManifestParsed,this),t.on(Kh.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(Kh.BUFFER_CODECS,this.onBufferCodecs,this),t.on(Kh.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:t}=this;t.off(Kh.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),t.off(Kh.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(Kh.MANIFEST_PARSED,this.onManifestParsed,this),t.off(Kh.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(Kh.BUFFER_CODECS,this.onBufferCodecs,this),t.off(Kh.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(t,e){const r=this.hls.levels[e.droppedLevel];this.isLevelAllowed(r)&&this.restrictedLevels.push({bitrate:r.bitrate,height:r.height,width:r.width})}onMediaAttaching(t,e){this.media=e.media instanceof HTMLVideoElement?e.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(t,e){const r=this.hls;this.restrictedLevels=[],this.firstLevel=e.firstLevel,r.config.capLevelToPlayerSize&&e.video&&this.startCapping()}onLevelsUpdated(t,e){this.timer&&Gh(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(t,e){this.hls.config.capLevelToPlayerSize&&e.video&&this.startCapping()}onMediaDetaching(){this.stopCapping()}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0)return void(this.clientRect=null);const t=this.hls.levels;if(t.length){const e=this.hls,r=this.getMaxLevel(t.length-1);r!==this.autoLevelCapping&&Zh.log(`Setting autoLevelCapping to ${r}: ${t[r].height}p@${t[r].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),e.autoLevelCapping=r,e.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=e.autoLevelCapping}}}getMaxLevel(t){const e=this.hls.levels;if(!e.length)return-1;const r=e.filter(((e,r)=>this.isLevelAllowed(e)&&r<=t));return this.clientRect=null,c_.getMaxLevelByMediaSize(r,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const t=this.media,e={width:0,height:0};if(t){const r=t.getBoundingClientRect();e.width=r.width,e.height=r.height,e.width||e.height||(e.width=r.right-r.left||t.width||0,e.height=r.bottom-r.top||t.height||0)}return this.clientRect=e,e}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let t=1;if(!this.hls.config.ignoreDevicePixelRatio)try{t=self.devicePixelRatio}catch(t){}return t}isLevelAllowed(t){return!this.restrictedLevels.some((e=>t.bitrate===e.bitrate&&t.width===e.width&&t.height===e.height))}static getMaxLevelByMediaSize(t,e,r){if(null==t||!t.length)return-1;let i=t.length-1;const s=Math.max(e,r);for(let e=0;e=s||r.height>=s)&&(n=r,!(o=t[e+1])||n.width!==o.width||n.height!==o.height)){i=e;break}}var n,o;return i}}const u_="[eme]";class d_{constructor(t){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=d_.CDMCleanupPromise?[d_.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=Zh.debug.bind(Zh,u_),this.log=Zh.log.bind(Zh,u_),this.warn=Zh.warn.bind(Zh,u_),this.error=Zh.error.bind(Zh,u_),this.hls=t,this.config=t.config,this.registerListeners()}destroy(){this.unregisterListeners(),this.onMediaDetached();const t=this.config;t.requestMediaKeySystemAccessFunc=null,t.licenseXhrSetup=t.licenseResponseCallback=void 0,t.drmSystems=t.drmSystemOptions={},this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null,this.config=null}registerListeners(){this.hls.on(Kh.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Kh.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(Kh.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(Kh.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(Kh.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Kh.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(Kh.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(Kh.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(t){const{drmSystems:e,widevineLicenseUrl:r}=this.config,i=e[t];if(i)return i.licenseUrl;if(t===yf.WIDEVINE&&r)return r;throw new Error(`no license server URL configured for key-system "${t}"`)}getServerCertificateUrl(t){const{drmSystems:e}=this.config,r=e[t];if(r)return r.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${t}"]`)}attemptKeySystemAccess(t){const e=this.hls.levels,r=(t,e,r)=>!!t&&r.indexOf(t)===e,i=e.map((t=>t.audioCodec)).filter(r),s=e.map((t=>t.videoCodec)).filter(r);return i.length+s.length===0&&s.push("avc1.42e01e"),new Promise(((e,r)=>{const n=t=>{const o=t.shift();this.getMediaKeysPromise(o,i,s).then((t=>e({keySystem:o,mediaKeys:t}))).catch((e=>{t.length?n(t):r(e instanceof h_?e:new h_({type:Wh.KEY_SYSTEM_ERROR,details:zh.KEY_SYSTEM_NO_ACCESS,error:e,fatal:!0},e.message))}))};n(t)}))}requestMediaKeySystemAccess(t,e){const{requestMediaKeySystemAccessFunc:r}=this.config;if("function"!=typeof r){let t=`Configured requestMediaKeySystemAccess is not a function ${r}`;return null===xf&&"http:"===self.location.protocol&&(t=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(t))}return r(t,e)}getMediaKeysPromise(t,e,r){const i=function(t,e,r,i){let s;switch(t){case yf.FAIRPLAY:s=["cenc","sinf"];break;case yf.WIDEVINE:case yf.PLAYREADY:s=["cenc"];break;case yf.CLEARKEY:s=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${t}`)}return function(t,e,r,i){return[{initDataTypes:t,persistentState:i.persistentState||"optional",distinctiveIdentifier:i.distinctiveIdentifier||"optional",sessionTypes:i.sessionTypes||[i.sessionType||"temporary"],audioCapabilities:e.map((t=>({contentType:`audio/mp4; codecs="${t}"`,robustness:i.audioRobustness||"",encryptionScheme:i.audioEncryptionScheme||null}))),videoCapabilities:r.map((t=>({contentType:`video/mp4; codecs="${t}"`,robustness:i.videoRobustness||"",encryptionScheme:i.videoEncryptionScheme||null})))}]}(s,e,r,i)}(t,e,r,this.config.drmSystemOptions),s=this.keySystemAccessPromises[t];let n=null==s?void 0:s.keySystemAccess;if(!n){this.log(`Requesting encrypted media "${t}" key-system access with config: ${JSON.stringify(i)}`),n=this.requestMediaKeySystemAccess(t,i);const e=this.keySystemAccessPromises[t]={keySystemAccess:n};return n.catch((e=>{this.log(`Failed to obtain access to key-system "${t}": ${e}`)})),n.then((r=>{this.log(`Access for key-system "${r.keySystem}" obtained`);const i=this.fetchServerCertificate(t);return this.log(`Create media-keys for "${t}"`),e.mediaKeys=r.createMediaKeys().then((e=>(this.log(`Media-keys created for "${t}"`),i.then((r=>r?this.setMediaKeysServerCertificate(e,t,r):e))))),e.mediaKeys.catch((e=>{this.error(`Failed to create media-keys for "${t}"}: ${e}`)})),e.mediaKeys}))}return n.then((()=>s.mediaKeys))}createMediaKeySessionContext({decryptdata:t,keySystem:e,mediaKeys:r}){this.log(`Creating key-system session "${e}" keyId: ${Xf(t.keyId||[])}`);const i=r.createSession(),s={decryptdata:t,keySystem:e,mediaKeys:r,mediaKeysSession:i,keyStatus:"status-pending"};return this.mediaKeySessions.push(s),s}renewKeySession(t){const e=t.decryptdata;if(e.pssh){const r=this.createMediaKeySessionContext(t),i=this.getKeyIdString(e),s="cenc";this.keyIdToKeySessionPromise[i]=this.generateRequestWithPreferredKeySession(r,s,e.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(t)}getKeyIdString(t){if(!t)throw new Error("Could not read keyId of undefined decryptdata");if(null===t.keyId)throw new Error("keyId is null");return Xf(t.keyId)}updateKeySession(t,e){var r;const i=t.mediaKeysSession;return this.log(`Updating key-session "${i.sessionId}" for keyID ${Xf((null==(r=t.decryptdata)?void 0:r.keyId)||[])}\n } (data length: ${e?e.byteLength:e})`),i.update(e)}selectKeySystemFormat(t){const e=Object.keys(t.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${t.sn} ${t.type}: ${t.level}) key formats ${e.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(e)),this.keyFormatPromise}getKeyFormatPromise(t){return new Promise(((e,r)=>{const i=Cf(this.config),s=t.map(wf).filter((t=>!!t&&-1!==i.indexOf(t)));return this.getKeySystemSelectionPromise(s).then((({keySystem:t})=>{const i=kf(t);i?e(i):r(new Error(`Unable to find format for key-system "${t}"`))})).catch(r)}))}loadKey(t){const e=t.keyInfo.decryptdata,r=this.getKeyIdString(e),i=`(keyId: ${r} format: "${e.keyFormat}" method: ${e.method} uri: ${e.uri})`;this.log(`Starting session for key ${i}`);let s=this.keyIdToKeySessionPromise[r];return s||(s=this.keyIdToKeySessionPromise[r]=this.getKeySystemForKeyPromise(e).then((({keySystem:r,mediaKeys:s})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${t.frag.sn} ${t.frag.type}: ${t.frag.level} using key ${i}`),this.attemptSetMediaKeys(r,s).then((()=>{this.throwIfDestroyed();const t=this.createMediaKeySessionContext({keySystem:r,mediaKeys:s,decryptdata:e});return this.generateRequestWithPreferredKeySession(t,"cenc",e.pssh,"playlist-key")}))))),s.catch((t=>this.handleError(t)))),s}throwIfDestroyed(t="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(t){this.hls&&(this.error(t.message),t instanceof h_?this.hls.trigger(Kh.ERROR,t.data):this.hls.trigger(Kh.ERROR,{type:Wh.KEY_SYSTEM_ERROR,details:zh.KEY_SYSTEM_NO_KEYS,error:t,fatal:!0}))}getKeySystemForKeyPromise(t){const e=this.getKeyIdString(t),r=this.keyIdToKeySessionPromise[e];if(!r){const e=wf(t.keyFormat),r=e?[e]:Cf(this.config);return this.attemptKeySystemAccess(r)}return r}getKeySystemSelectionPromise(t){if(t.length||(t=Cf(this.config)),0===t.length)throw new h_({type:Wh.KEY_SYSTEM_ERROR,details:zh.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${JSON.stringify({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(t)}_onMediaEncrypted(t){const{initDataType:e,initData:r}=t,i=`"${t.type}" event: init data type: "${e}"`;if(this.debug(i),null===r)return;let s,n;if("sinf"===e&&this.config.drmSystems[yf.FAIRPLAY]){const t=tp(new Uint8Array(r));try{const e=ff(JSON.parse(t).sinf),r=fp(new Uint8Array(e));if(!r)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");s=r.subarray(8,24),n=yf.FAIRPLAY}catch(t){return void this.warn(`${i} Failed to parse sinf: ${t}`)}}else{const t=function(t){const e=[];if(t instanceof ArrayBuffer){const r=t.byteLength;let i=0;for(;i+32t.systemId===Lf))[0];if(!e)return void(0===t.length||t.some((t=>!t.systemId))?this.warn(`${i} contains incomplete or invalid pssh data`):this.log(`ignoring ${i} for ${t.map((t=>Af(t.systemId))).join(",")} pssh data in favor of playlist keys`));if(n=Af(e.systemId),0===e.version&&e.data){const t=e.data.length-22;s=e.data.subarray(t,t+16)}}if(!n||!s)return;const o=Xf(s),{keyIdToKeySessionPromise:a,mediaKeySessions:l}=this;let c=a[o];for(let t=0;tthis.generateRequestWithPreferredKeySession(i,e,r,"encrypted-event-key-match")));break}}c||(c=a[o]=this.getKeySystemSelectionPromise([n]).then((({keySystem:t,mediaKeys:i})=>{var n;this.throwIfDestroyed();const a=new Sp("ISO-23001-7",o,null!=(n=kf(t))?n:"");return a.pssh=new Uint8Array(r),a.keyId=s,this.attemptSetMediaKeys(t,i).then((()=>{this.throwIfDestroyed();const s=this.createMediaKeySessionContext({decryptdata:a,keySystem:t,mediaKeys:i});return this.generateRequestWithPreferredKeySession(s,e,r,"encrypted-event-no-match")}))}))),c.catch((t=>this.handleError(t)))}_onWaitingForKey(t){this.log(`"${t.type}" event`)}attemptSetMediaKeys(t,e){const r=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${t}"`);const i=Promise.all(r).then((()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(e)}));return this.setMediaKeysQueue.push(i),i.then((()=>{this.log(`Media-keys set for "${t}"`),r.push(i),this.setMediaKeysQueue=this.setMediaKeysQueue.filter((t=>-1===r.indexOf(t)))}))}generateRequestWithPreferredKeySession(t,e,r,i){var s,n;const o=null==(s=this.config.drmSystems)||null==(n=s[t.keySystem])?void 0:n.generateRequest;if(o)try{const i=o.call(this.hls,e,r,t);if(!i)throw new Error("Invalid response from configured generateRequest filter");e=i.initDataType,r=t.decryptdata.pssh=i.initData?new Uint8Array(i.initData):null}catch(t){var a;if(this.warn(t.message),null!=(a=this.hls)&&a.config.debug)throw t}if(null===r)return this.log(`Skipping key-session request for "${i}" (no initData)`),Promise.resolve(t);const l=this.getKeyIdString(t.decryptdata);this.log(`Generating key-session request for "${i}": ${l} (init data type: ${e} length: ${r?r.byteLength:null})`);const c=new ov,u=t._onmessage=e=>{const r=t.mediaKeysSession;if(!r)return void c.emit("error",new Error("invalid state"));const{messageType:i,message:s}=e;this.log(`"${i}" message event for session "${r.sessionId}" message size: ${s.byteLength}`),"license-request"===i||"license-renewal"===i?this.renewLicense(t,s).catch((t=>{this.handleError(t),c.emit("error",t)})):"license-release"===i?t.keySystem===yf.FAIRPLAY&&(this.updateKeySession(t,gf("acknowledged")),this.removeSession(t)):this.warn(`unhandled media key message type "${i}"`)},d=t._onkeystatuseschange=e=>{if(!t.mediaKeysSession)return void c.emit("error",new Error("invalid state"));this.onKeyStatusChange(t);const r=t.keyStatus;c.emit("keyStatus",r),"expired"===r&&(this.warn(`${t.keySystem} expired for key ${l}`),this.renewKeySession(t))};t.mediaKeysSession.addEventListener("message",u),t.mediaKeysSession.addEventListener("keystatuseschange",d);const h=new Promise(((t,e)=>{c.on("error",e),c.on("keyStatus",(r=>{r.startsWith("usable")?t():"output-restricted"===r?e(new h_({type:Wh.KEY_SYSTEM_ERROR,details:zh.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):"internal-error"===r?e(new h_({type:Wh.KEY_SYSTEM_ERROR,details:zh.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${r}"`)):"expired"===r?e(new Error("key expired while generating request")):this.warn(`unhandled key status change "${r}"`)}))}));return t.mediaKeysSession.generateRequest(e,r).then((()=>{var e;this.log(`Request generated for key-session "${null==(e=t.mediaKeysSession)?void 0:e.sessionId}" keyId: ${l}`)})).catch((t=>{throw new h_({type:Wh.KEY_SYSTEM_ERROR,details:zh.KEY_SYSTEM_NO_SESSION,error:t,fatal:!1},`Error generating key-session request: ${t}`)})).then((()=>h)).catch((e=>{throw c.removeAllListeners(),this.removeSession(t),e})).then((()=>(c.removeAllListeners(),t)))}onKeyStatusChange(t){t.mediaKeysSession.keyStatuses.forEach(((e,r)=>{this.log(`key status change "${e}" for keyStatuses keyId: ${Xf("buffer"in r?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):new Uint8Array(r))} session keyId: ${Xf(new Uint8Array(t.decryptdata.keyId||[]))} uri: ${t.decryptdata.uri}`),t.keyStatus=e}))}fetchServerCertificate(t){const e=this.config,r=new(0,e.loader)(e),i=this.getServerCertificateUrl(t);return i?(this.log(`Fetching server certificate for "${t}"`),new Promise(((s,n)=>{const o={responseType:"arraybuffer",url:i},a=e.certLoadPolicy.default,l={loadPolicy:a,timeout:a.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},c={onSuccess:(t,e,r,i)=>{s(t.data)},onError:(e,r,s,a)=>{n(new h_({type:Wh.KEY_SYSTEM_ERROR,details:zh.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:s,response:Bh({url:o.url,data:void 0},e)},`"${t}" certificate request failed (${i}). Status: ${e.code} (${e.text})`))},onTimeout:(e,r,s)=>{n(new h_({type:Wh.KEY_SYSTEM_ERROR,details:zh.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:s,response:{url:o.url,data:void 0}},`"${t}" certificate request timed out (${i})`))},onAbort:(t,e,r)=>{n(new Error("aborted"))}};r.load(o,l,c)}))):Promise.resolve()}setMediaKeysServerCertificate(t,e,r){return new Promise(((i,s)=>{t.setServerCertificate(r).then((s=>{this.log(`setServerCertificate ${s?"success":"not supported by CDM"} (${null==r?void 0:r.byteLength}) on "${e}"`),i(t)})).catch((t=>{s(new h_({type:Wh.KEY_SYSTEM_ERROR,details:zh.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:t,fatal:!0},t.message))}))}))}renewLicense(t,e){return this.requestLicense(t,new Uint8Array(e)).then((e=>this.updateKeySession(t,new Uint8Array(e)).catch((t=>{throw new h_({type:Wh.KEY_SYSTEM_ERROR,details:zh.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:t,fatal:!0},t.message)}))))}unpackPlayReadyKeyMessage(t,e){const r=String.fromCharCode.apply(null,new Uint16Array(e.buffer));if(!r.includes("PlayReadyKeyMessage"))return t.setRequestHeader("Content-Type","text/xml; charset=utf-8"),e;const i=(new DOMParser).parseFromString(r,"application/xml"),s=i.querySelectorAll("HttpHeader");if(s.length>0){let e;for(let r=0,i=s.length;r in key message");return gf(atob(l))}setupLicenseXHR(t,e,r,i){const s=this.config.licenseXhrSetup;return s?Promise.resolve().then((()=>{if(!r.decryptdata)throw new Error("Key removed");return s.call(this.hls,t,e,r,i)})).catch((n=>{if(!r.decryptdata)throw n;return t.open("POST",e,!0),s.call(this.hls,t,e,r,i)})).then((r=>{t.readyState||t.open("POST",e,!0);return{xhr:t,licenseChallenge:r||i}})):(t.open("POST",e,!0),Promise.resolve({xhr:t,licenseChallenge:i}))}requestLicense(t,e){const r=this.config.keyLoadPolicy.default;return new Promise(((i,s)=>{const n=this.getLicenseServerUrl(t.keySystem);this.log(`Sending license request to URL: ${n}`);const o=new XMLHttpRequest;o.responseType="arraybuffer",o.onreadystatechange=()=>{if(!this.hls||!t.mediaKeysSession)return s(new Error("invalid state"));if(4===o.readyState)if(200===o.status){this._requestLicenseFailureCount=0;let e=o.response;this.log(`License received ${e instanceof ArrayBuffer?e.byteLength:e}`);const r=this.config.licenseResponseCallback;if(r)try{e=r.call(this.hls,o,n,t)}catch(t){this.error(t)}i(e)}else{const a=r.errorRetry,l=a?a.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>l||o.status>=400&&o.status<500)s(new h_({type:Wh.KEY_SYSTEM_ERROR,details:zh.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:o,response:{url:n,data:void 0,code:o.status,text:o.statusText}},`License Request XHR failed (${n}). Status: ${o.status} (${o.statusText})`));else{const r=l-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${r} attempts left`),this.requestLicense(t,e).then(i,s)}}},t.licenseXhr&&t.licenseXhr.readyState!==XMLHttpRequest.DONE&&t.licenseXhr.abort(),t.licenseXhr=o,this.setupLicenseXHR(o,n,t,e).then((({xhr:e,licenseChallenge:r})=>{t.keySystem==yf.PLAYREADY&&(r=this.unpackPlayReadyKeyMessage(e,r)),e.send(r)}))}))}onMediaAttached(t,e){if(!this.config.emeEnabled)return;const r=e.media;this.media=r,r.addEventListener("encrypted",this.onMediaEncrypted),r.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){const t=this.media,e=this.mediaKeySessions;t&&(t.removeEventListener("encrypted",this.onMediaEncrypted),t.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},Sp.clearKeyUriToKeyIdMap();const r=e.length;d_.CDMCleanupPromise=Promise.all(e.map((t=>this.removeSession(t))).concat(null==t?void 0:t.setMediaKeys(null).catch((t=>{this.log(`Could not clear media keys: ${t}`)})))).then((()=>{r&&(this.log("finished closing key sessions and clearing media keys"),e.length=0)})).catch((t=>{this.log(`Could not close sessions and clear media keys: ${t}`)}))}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(t,{sessionKeys:e}){if(e&&this.config.emeEnabled&&!this.keyFormatPromise){const t=e.reduce(((t,e)=>(-1===t.indexOf(e.keyFormat)&&t.push(e.keyFormat),t)),[]);this.log(`Selecting key-system from session-keys ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)}}removeSession(t){const{mediaKeysSession:e,licenseXhr:r}=t;if(e){this.log(`Remove licenses and keys and close session ${e.sessionId}`),t._onmessage&&(e.removeEventListener("message",t._onmessage),t._onmessage=void 0),t._onkeystatuseschange&&(e.removeEventListener("keystatuseschange",t._onkeystatuseschange),t._onkeystatuseschange=void 0),r&&r.readyState!==XMLHttpRequest.DONE&&r.abort(),t.mediaKeysSession=t.decryptdata=t.licenseXhr=void 0;const i=this.mediaKeySessions.indexOf(t);return i>-1&&this.mediaKeySessions.splice(i,1),e.remove().catch((t=>{this.log(`Could not remove session: ${t}`)})).then((()=>e.close())).catch((t=>{this.log(`Could not close session: ${t}`)}))}}}d_.CDMCleanupPromise=void 0;class h_ extends Error{constructor(t,e){super(e),this.data=void 0,t.error||(t.error=new Error(e)),this.data=t,t.err=t.error}}var f_,p_,g_;!function(t){t.MANIFEST="m",t.AUDIO="a",t.VIDEO="v",t.MUXED="av",t.INIT="i",t.CAPTION="c",t.TIMED_TEXT="tt",t.KEY="k",t.OTHER="o"}(f_||(f_={})),function(t){t.DASH="d",t.HLS="h",t.SMOOTH="s",t.OTHER="o"}(p_||(p_={})),function(t){t.OBJECT="CMCD-Object",t.REQUEST="CMCD-Request",t.SESSION="CMCD-Session",t.STATUS="CMCD-Status"}(g_||(g_={}));const m_={[g_.OBJECT]:["br","d","ot","tb"],[g_.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[g_.SESSION]:["cid","pr","sf","sid","st","v"],[g_.STATUS]:["bs","rtp"]};class y_{constructor(t,e){this.value=void 0,this.params=void 0,Array.isArray(t)&&(t=t.map((t=>t instanceof y_?t:new y_(t)))),this.value=t,this.params=e}}class v_{constructor(t){this.description=void 0,this.description=t}}function __(t,e,r,i){return new Error(`failed to ${t} "${s=e,Array.isArray(s)?JSON.stringify(s):s instanceof Map?"Map{}":s instanceof Set?"Set{}":"object"==typeof s?JSON.stringify(s):String(s)}" as ${r}`,{cause:i});var s}const E_="Bare Item";const T_=/[\x00-\x1f\x7f]+/;function w_(t,e,r){return __("serialize",t,e,r)}function S_(t){if(!1===ArrayBuffer.isView(t))throw w_(t,"Byte Sequence");return`:${e=t,btoa(String.fromCharCode(...e))}:`;var e}function b_(t){if(function(t){return t<-999999999999999||99999999999999912)throw w_(t,"Decimal");const r=e.toString();return r.includes(".")?r:`${r}.0`}function A_(t){const e=(r=t).description||r.toString().slice(7,-1);var r;if(!1===/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e))throw w_(e,"Token");return e}function k_(t){switch(typeof t){case"number":if(!Gh(t))throw w_(t,E_);return Number.isInteger(t)?b_(t):L_(t);case"string":return function(t){if(T_.test(t))throw w_(t,"String");return`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}(t);case"symbol":return A_(t);case"boolean":return function(t){if("boolean"!=typeof t)throw w_(t,"Boolean");return t?"?1":"?0"}(t);case"object":if(t instanceof Date)return function(t){return`@${b_(t.getTime()/1e3)}`}(t);if(t instanceof Uint8Array)return S_(t);if(t instanceof v_)return A_(t);default:throw w_(t,E_)}}function C_(t){if(!1===/^[a-z*][a-z0-9\-_.*]*$/.test(t))throw w_(t,"Key");return t}function x_(t){return null==t?"":Object.entries(t).map((([t,e])=>!0===e?`;${C_(t)}`:`;${C_(t)}=${k_(e)}`)).join("")}function R_(t){return t instanceof y_?`${k_(t.value)}${x_(t.params)}`:k_(t)}function P_(t,e={whitespace:!0}){if("object"!=typeof t)throw w_(t,"Dict");const r=t instanceof Map?t.entries():Object.entries(t),i=null!=e&&e.whitespace?" ":"";return Array.from(r).map((([t,e])=>{e instanceof y_==!1&&(e=new y_(e));let r=C_(t);var i;return!0===e.value?r+=x_(e.params):(r+="=",Array.isArray(e.value)?r+=`(${(i=e).value.map(R_).join(" ")})${x_(i.params)}`:r+=R_(e)),r})).join(`,${i}`)}const I_=t=>Math.round(t),F_=t=>100*I_(t/100),M_={br:I_,d:I_,bl:F_,dl:F_,mtp:F_,nor:(t,e)=>(null!=e&&e.baseUrl&&(t=function(t,e){const r=new URL(t),i=new URL(e);if(r.origin!==i.origin)return t;const s=r.pathname.split("/").slice(1),n=i.pathname.split("/").slice(1,-1);for(;s[0]===n[0];)s.shift(),n.shift();for(;n.length;)n.shift(),s.unshift("..");return s.join("/")}(t,e.baseUrl)),encodeURIComponent(t)),rtp:F_,tb:I_};function O_(t,e){const r={};if(null==t||"object"!=typeof t)return r;const i=Object.keys(t).sort(),s=qh({},M_,null==e?void 0:e.formatters),n=null==e?void 0:e.filter;return i.forEach((i=>{if(null!=n&&n(i))return;let o=t[i];const a=s[i];a&&(o=a(o,e)),"v"===i&&1===o||"pr"==i&&1===o||(t=>"number"==typeof t?Gh(t):null!=t&&""!==t&&!1!==t)(o)&&((t=>"ot"===t||"sf"===t||"st"===t)(i)&&"string"==typeof o&&(o=new v_(o)),r[i]=o)})),r}function N_(t,e={}){return t?function(t,e){return P_(t,e)}(O_(t,e),qh({whitespace:!1},e)):""}function B_(t,e,r){return qh(t,function(t,e={}){if(!t)return{};const r=Object.entries(t),i=Object.entries(m_).concat(Object.entries((null==e?void 0:e.customHeaderMap)||{})),s=r.reduce(((t,e)=>{var r;const[s,n]=e,o=(null==(r=i.find((t=>t[1].includes(s))))?void 0:r[0])||g_.REQUEST;return null!=t[o]||(t[o]={}),t[o][s]=n,t}),{});return Object.entries(s).reduce(((t,[r,i])=>(t[r]=N_(i,e),t)),{})}(e,r))}const U_=/CMCD=[^&#]+/;function $_(t,e,r){const i=function(t,e={}){if(!t)return"";const r=N_(t,e);return`CMCD=${encodeURIComponent(r)}`}(e,r);if(!i)return t;if(U_.test(t))return t.replace(U_,i);const s=t.includes("?")?"&":"?";return`${t}${s}${i}`}function q_(t,e,r,i){t&&Object.keys(e).forEach((s=>{const n=t.filter((t=>t.groupId===s)).map((t=>{const n=qh({},t);return n.details=void 0,n.attrs=new ef(n.attrs),n.url=n.attrs.URI=G_(t.url,t.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",r),n.groupId=n.attrs["GROUP-ID"]=e[s],n.attrs["PATHWAY-ID"]=i,n}));t.push(...n)}))}function G_(t,e,r,i){const{HOST:s,PARAMS:n,[r]:o}=i;let a;e&&(a=null==o?void 0:o[e],a&&(t=a));const l=new self.URL(t);return s&&!a&&(l.host=s),n&&Object.keys(n).sort().forEach((t=>{t&&l.searchParams.set(t,n[t])})),l.href}const H_=/^age:\s*[\d.]+\s*$/im;class V_{constructor(t){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=t&&t.xhrSetup||null,this.stats=new nf,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const t=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),t&&(t.onreadystatechange=null,t.onprogress=null,4!==t.readyState&&(this.stats.aborted=!0,t.abort()))}abort(){var t;this.abortInternal(),null!=(t=this.callbacks)&&t.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(t,e,r){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=t,this.config=e,this.callbacks=r,this.loadInternal()}loadInternal(){const{config:t,context:e}=this;if(!t||!e)return;const r=this.loader=new self.XMLHttpRequest,i=this.stats;i.loading.first=0,i.loaded=0,i.aborted=!1;const s=this.xhrSetup;s?Promise.resolve().then((()=>{if(this.loader===r&&!this.stats.aborted)return s(r,e.url)})).catch((t=>{if(this.loader===r&&!this.stats.aborted)return r.open("GET",e.url,!0),s(r,e.url)})).then((()=>{this.loader!==r||this.stats.aborted||this.openAndSendXhr(r,e,t)})).catch((t=>{this.callbacks.onError({code:r.status,text:t.message},e,r,i)})):this.openAndSendXhr(r,e,t)}openAndSendXhr(t,e,r){t.readyState||t.open("GET",e.url,!0);const i=e.headers,{maxTimeToFirstByteMs:s,maxLoadTimeMs:n}=r.loadPolicy;if(i)for(const e in i)t.setRequestHeader(e,i[e]);e.rangeEnd&&t.setRequestHeader("Range","bytes="+e.rangeStart+"-"+(e.rangeEnd-1)),t.onreadystatechange=this.readystatechange.bind(this),t.onprogress=this.loadprogress.bind(this),t.responseType=e.responseType,self.clearTimeout(this.requestTimeout),r.timeout=s&&Gh(s)?s:n,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.timeout),t.send()}readystatechange(){const{context:t,loader:e,stats:r}=this;if(!t||!e)return;const i=e.readyState,s=this.config;if(!r.aborted&&i>=2&&(0===r.loading.first&&(r.loading.first=Math.max(self.performance.now(),r.loading.start),s.timeout!==s.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),s.timeout=s.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.loadPolicy.maxLoadTimeMs-(r.loading.first-r.loading.start)))),4===i)){self.clearTimeout(this.requestTimeout),e.onreadystatechange=null,e.onprogress=null;const i=e.status,n="text"!==e.responseType;if(i>=200&&i<300&&(n&&e.response||null!==e.responseText)){r.loading.end=Math.max(self.performance.now(),r.loading.first);const s=n?e.response:e.responseText,o="arraybuffer"===e.responseType?s.byteLength:s.length;if(r.loaded=r.total=o,r.bwEstimate=8e3*r.total/(r.loading.end-r.loading.first),!this.callbacks)return;const a=this.callbacks.onProgress;if(a&&a(r,t,s,e),!this.callbacks)return;const l={url:e.responseURL,data:s,code:i};this.callbacks.onSuccess(l,r,t,e)}else{const n=s.loadPolicy.errorRetry;Kg(n,r.retry,!1,{url:t.url,data:void 0,code:i})?this.retry(n):(Zh.error(`${i} while loading ${t.url}`),this.callbacks.onError({code:i,text:e.statusText},t,e,r))}}}loadtimeout(){if(!this.config)return;const t=this.config.loadPolicy.timeoutRetry;if(Kg(t,this.stats.retry,!0))this.retry(t);else{var e;Zh.warn(`timeout while loading ${null==(e=this.context)?void 0:e.url}`);const t=this.callbacks;t&&(this.abortInternal(),t.onTimeout(this.stats,this.context,this.loader))}}retry(t){const{context:e,stats:r}=this;this.retryDelay=Hg(t,r.retry),r.retry++,Zh.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${null==e?void 0:e.url}, retrying ${r.retry}/${t.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(t){const e=this.stats;e.loaded=t.loaded,t.lengthComputable&&(e.total=t.total)}getCacheAge(){let t=null;if(this.loader&&H_.test(this.loader.getAllResponseHeaders())){const e=this.loader.getResponseHeader("age");t=e?parseFloat(e):null}return t}getResponseHeader(t){return this.loader&&new RegExp(`^${t}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(t):null}}const K_=/(\d+)-(\d+)\/(\d+)/;class W_{constructor(t){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=t.fetchSetup||z_,this.controller=new self.AbortController,this.stats=new nf}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var t;this.abortInternal(),null!=(t=this.callbacks)&&t.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(t,e,r){const i=this.stats;if(i.loading.start)throw new Error("Loader can only be used once.");i.loading.start=self.performance.now();const s=function(t,e){const r={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(qh({},t.headers))};t.rangeEnd&&r.headers.set("Range","bytes="+t.rangeStart+"-"+String(t.rangeEnd-1));return r}(t,this.controller.signal),n=r.onProgress,o="arraybuffer"===t.responseType,a=o?"byteLength":"length",{maxTimeToFirstByteMs:l,maxLoadTimeMs:c}=e.loadPolicy;this.context=t,this.config=e,this.callbacks=r,this.request=this.fetchSetup(t,s),self.clearTimeout(this.requestTimeout),e.timeout=l&&Gh(l)?l:c,this.requestTimeout=self.setTimeout((()=>{this.abortInternal(),r.onTimeout(i,t,this.response)}),e.timeout),self.fetch(this.request).then((s=>{this.response=this.loader=s;const a=Math.max(self.performance.now(),i.loading.start);if(self.clearTimeout(this.requestTimeout),e.timeout=c,this.requestTimeout=self.setTimeout((()=>{this.abortInternal(),r.onTimeout(i,t,this.response)}),c-(a-i.loading.start)),!s.ok){const{status:t,statusText:e}=s;throw new j_(e||"fetch, bad network response",t,s)}return i.loading.first=a,i.total=function(t){const e=t.get("Content-Range");if(e){const t=function(t){const e=K_.exec(t);if(e)return parseInt(e[2])-parseInt(e[1])+1}(e);if(Gh(t))return t}const r=t.get("Content-Length");if(r)return parseInt(r)}(s.headers)||i.total,n&&Gh(e.highWaterMark)?this.loadProgressively(s,i,t,e.highWaterMark,n):o?s.arrayBuffer():"json"===t.responseType?s.json():s.text()})).then((s=>{const o=this.response;if(!o)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),i.loading.end=Math.max(self.performance.now(),i.loading.first);const l=s[a];l&&(i.loaded=i.total=l);const c={url:o.url,data:s,code:o.status};n&&!Gh(e.highWaterMark)&&n(i,t,s,o),r.onSuccess(c,i,t,o)})).catch((e=>{if(self.clearTimeout(this.requestTimeout),i.aborted)return;const s=e&&e.code||0,n=e?e.message:null;r.onError({code:s,text:n},t,e?e.details:null,i)}))}getCacheAge(){let t=null;if(this.response){const e=this.response.headers.get("age");t=e?parseFloat(e):null}return t}getResponseHeader(t){return this.response?this.response.headers.get(t):null}loadProgressively(t,e,r,i=0,s){const n=new ey,o=t.body.getReader(),a=()=>o.read().then((o=>{if(o.done)return n.dataLength&&s(e,r,n.flush(),t),Promise.resolve(new ArrayBuffer(0));const l=o.value,c=l.length;return e.loaded+=c,c=i&&s(e,r,n.flush(),t)):s(e,r,l,t),a()})).catch((()=>Promise.reject()));return a()}}function z_(t,e){return new self.Request(t.url,e)}class j_ extends Error{constructor(t,e,r){super(t),this.code=void 0,this.details=void 0,this.code=e,this.details=r}}const Y_=/\s/,X_={newCue(t,e,r,i){const s=[];let n,o,a,l,c;const u=self.VTTCue||self.TextTrackCue;for(let h=0;h=16?l--:l++;const i=Hv(c.trim()),f=jv(e,r,i);null!=t&&null!=(d=t.cues)&&d.getCueById(f)||(o=new u(e,r,i),o.id=f,o.line=h+1,o.align="left",o.position=10+Math.min(80,10*Math.floor(8*l/32)),s.push(o))}return t&&s.length&&(s.sort(((t,e)=>"auto"===t.line||"auto"===e.line?0:t.line>8&&e.line>8?e.line-t.line:t.line-e.line)),s.forEach((e=>dg(t,e)))),s}},Q_=Bh(Bh({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:6e7,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:V_,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:class{constructor(t){this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this._abandonRulesCheck=()=>{const{fragCurrent:t,partCurrent:e,hls:r}=this,{autoLevelEnabled:i,media:s}=r;if(!t||!s)return;const n=performance.now(),o=e?e.stats:t.stats,a=e?e.duration:t.duration,l=n-o.loading.start,c=r.minAutoLevel;if(o.aborted||o.loaded&&o.loaded===o.total||t.level<=c)return this.clearTimer(),void(this._nextAutoLevel=-1);if(!i||s.paused||!s.playbackRate||!s.readyState)return;const u=r.mainForwardBufferInfo;if(null===u)return;const d=this.bwEstimator.getEstimateTTFB(),h=Math.abs(s.playbackRate);if(l<=Math.max(d,a/(2*h)*1e3))return;const f=u.len/h,p=o.loading.first?o.loading.first-o.loading.start:-1,g=o.loaded&&p>-1,m=this.getBwEstimate(),y=r.levels,v=y[t.level],_=o.total||Math.max(o.loaded,Math.round(a*v.averageBitrate/8));let E=g?l-p:l;E<1&&g&&(E=Math.min(l,8*o.loaded/m));const T=g?1e3*o.loaded/E:0,w=T?(_-o.loaded)/T:8*_/m+d/1e3;if(w<=f)return;const S=T?8*T:m;let b,D=Number.POSITIVE_INFINITY;for(b=t.level-1;b>c;b--){const t=y[b].maxBitrate;if(D=this.getTimeToLoadFrag(d/1e3,S,a*t,!y[b].details),D=w)return;if(D>10*a)return;r.nextLoadLevel=r.nextAutoLevel=b,g?this.bwEstimator.sample(l-Math.min(d,p),o.loaded):this.bwEstimator.sampleTTFB(l);const L=y[b].maxBitrate;this.getBwEstimate()*this.hls.config.abrBandWidthUpFactor>L&&this.resetEstimator(L),this.clearTimer(),Zh.warn(`[abr] Fragment ${t.sn}${e?" part "+e.index:""} of level ${t.level} is loading too slowly;\n Time to underbuffer: ${f.toFixed(3)} s\n Estimated load time for current fragment: ${w.toFixed(3)} s\n Estimated load time for down switch fragment: ${D.toFixed(3)} s\n TTFB estimate: ${0|p} ms\n Current BW estimate: ${Gh(m)?0|m:"Unknown"} bps\n New BW estimate: ${0|this.getBwEstimate()} bps\n Switching to level ${b} @ ${0|L} bps`),r.trigger(Kh.FRAG_LOAD_EMERGENCY_ABORTED,{frag:t,part:e,stats:o})},this.hls=t,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(t){t&&(Zh.log(`setting initial bwe to ${t}`),this.hls.config.abrEwmaDefaultEstimate=t),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const t=this.hls.config;return new nm(t.abrEwmaSlowVoD,t.abrEwmaFastVoD,t.abrEwmaDefaultEstimate)}registerListeners(){const{hls:t}=this;t.on(Kh.MANIFEST_LOADING,this.onManifestLoading,this),t.on(Kh.FRAG_LOADING,this.onFragLoading,this),t.on(Kh.FRAG_LOADED,this.onFragLoaded,this),t.on(Kh.FRAG_BUFFERED,this.onFragBuffered,this),t.on(Kh.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(Kh.LEVEL_LOADED,this.onLevelLoaded,this),t.on(Kh.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(Kh.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),t.on(Kh.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t&&(t.off(Kh.MANIFEST_LOADING,this.onManifestLoading,this),t.off(Kh.FRAG_LOADING,this.onFragLoading,this),t.off(Kh.FRAG_LOADED,this.onFragLoaded,this),t.off(Kh.FRAG_BUFFERED,this.onFragBuffered,this),t.off(Kh.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(Kh.LEVEL_LOADED,this.onLevelLoaded,this),t.off(Kh.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(Kh.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),t.off(Kh.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(t,e){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(t,e){const r=e.frag;if(!this.ignoreFragment(r)){var i;if(!r.bitrateTest)this.fragCurrent=r,this.partCurrent=null!=(i=e.part)?i:null;this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(t,e){this.clearTimer()}onError(t,e){if(!e.fatal)switch(e.details){case zh.BUFFER_ADD_CODEC_ERROR:case zh.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case zh.FRAG_LOAD_TIMEOUT:{const t=e.frag,{fragCurrent:r,partCurrent:i}=this;if(t&&r&&t.sn===r.sn&&t.level===r.level){const e=performance.now(),r=i?i.stats:t.stats,s=e-r.loading.start,n=r.loading.first?r.loading.first-r.loading.start:-1;if(r.loaded&&n>-1){const t=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(s-Math.min(t,n),r.loaded)}else this.bwEstimator.sampleTTFB(s)}break}}}getTimeToLoadFrag(t,e,r,i){return t+r/e+(i?this.lastLevelLoadSec:0)}onLevelLoaded(t,e){const r=this.hls.config,{loading:i}=e.stats,s=i.end-i.start;Gh(s)&&(this.lastLevelLoadSec=s/1e3),e.details.live?this.bwEstimator.update(r.abrEwmaSlowLive,r.abrEwmaFastLive):this.bwEstimator.update(r.abrEwmaSlowVoD,r.abrEwmaFastVoD)}onFragLoaded(t,{frag:e,part:r}){const i=r?r.stats:e.stats;if(e.type===sg&&this.bwEstimator.sampleTTFB(i.loading.first-i.loading.start),!this.ignoreFragment(e)){if(this.clearTimer(),e.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const t=r?r.duration:e.duration,s=this.hls.levels[e.level],n=(s.loaded?s.loaded.bytes:0)+i.loaded,o=(s.loaded?s.loaded.duration:0)+t;s.loaded={bytes:n,duration:o},s.realBitrate=Math.round(8*n/o)}if(e.bitrateTest){const t={stats:i,frag:e,part:r,id:e.type};this.onFragBuffered(Kh.FRAG_BUFFERED,t),e.bitrateTest=!1}else this.lastLoadedFragLevel=e.level}}onFragBuffered(t,e){const{frag:r,part:i}=e,s=null!=i&&i.stats.loaded?i.stats:r.stats;if(s.aborted)return;if(this.ignoreFragment(r))return;const n=s.parsing.end-s.loading.start-Math.min(s.loading.first-s.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(n,s.loaded),s.bwEstimate=this.getBwEstimate(),r.bitrateTest?this.bitrateTestDelay=n/1e3:this.bitrateTestDelay=0}ignoreFragment(t){return t.type!==sg||"initSegment"===t.sn}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:t,minAutoLevel:e}=this.hls,r=this.getBwEstimate(),i=this.hls.config.maxStarvationDelay,s=this.findBestLevel(r,e,t,0,i,1,1);if(s>-1)return s;const n=this.hls.firstLevel,o=Math.min(Math.max(n,e),t);return Zh.warn(`[abr] Could not find best starting auto level. Defaulting to first in playlist ${n} clamped to ${o}`),o}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const t=this.forcedAutoLevel,e=this.bwEstimator.canEstimate(),r=this.lastLoadedFragLevel>-1;if(!(-1===t||e&&r&&this.nextAutoLevelKey!==this.getAutoLevelKey()))return t;const i=e&&r?this.getNextABRAutoLevel():this.firstAutoLevel;if(-1!==t){const e=this.hls.levels;if(e.length>Math.max(t,i)&&e[t].loadError<=e[i].loadError)return t}return this._nextAutoLevel=i,this.nextAutoLevelKey=this.getAutoLevelKey(),i}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:t,partCurrent:e,hls:r}=this,{maxAutoLevel:i,config:s,minAutoLevel:n}=r,o=e?e.duration:t?t.duration:0,a=this.getBwEstimate(),l=this.getStarvationDelay();let c=s.abrBandWidthFactor,u=s.abrBandWidthUpFactor;if(l){const t=this.findBestLevel(a,n,i,l,0,c,u);if(t>=0)return t}let d=o?Math.min(o,s.maxStarvationDelay):s.maxStarvationDelay;if(!l){const t=this.bitrateTestDelay;if(t){d=(o?Math.min(o,s.maxLoadingDelay):s.maxLoadingDelay)-t,Zh.info(`[abr] bitrate test took ${Math.round(1e3*t)}ms, set first fragment max fetchDuration to ${Math.round(1e3*d)} ms`),c=u=1}}const h=this.findBestLevel(a,n,i,l,d,c,u);if(Zh.info(`[abr] ${l?"rebuffering expected":"buffer is empty"}, optimal quality level ${h}`),h>-1)return h;const f=r.levels[n],p=r.levels[r.loadLevel];return(null==f?void 0:f.bitrate)<(null==p?void 0:p.bitrate)?n:r.loadLevel}getStarvationDelay(){const t=this.hls,e=t.media;if(!e)return 1/0;const r=e&&0!==e.playbackRate?Math.abs(e.playbackRate):1,i=t.mainForwardBufferInfo;return(i?i.len:0)/r}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(t,e,r,i,s,n,o){var a;const l=i+s,c=this.lastLoadedFragLevel,u=-1===c?this.hls.firstLevel:c,{fragCurrent:d,partCurrent:h}=this,{levels:f,allAudioTracks:p,loadLevel:g,config:m}=this.hls;if(1===f.length)return 0;const y=f[u],v=!(null==y||null==(a=y.details)||!a.live),_=-1===g||-1===c;let E,T="SDR",w=(null==y?void 0:y.frameRate)||0;const{audioPreference:S,videoPreference:b}=m,D=this.audioTracksByGroup||(this.audioTracksByGroup=function(t){return t.reduce(((t,e)=>{let r=t.groups[e.groupId];r||(r=t.groups[e.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),r.tracks.push(e);const i=e.channels||"2";return r.channels[i]=(r.channels[i]||0)+1,r.hasDefault=r.hasDefault||e.default,r.hasAutoSelect=r.hasAutoSelect||e.autoselect,r.hasDefault&&(t.hasDefaultAudio=!0),r.hasAutoSelect&&(t.hasAutoSelectAudio=!0),t}),{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}(p));if(_){if(-1!==this.firstSelection)return this.firstSelection;const i=this.codecTiers||(this.codecTiers=function(t,e,r,i){return t.slice(r,i+1).reduce(((t,r)=>{if(!r.codecSet)return t;const i=r.audioGroups;let s=t[r.codecSet];s||(t[r.codecSet]=s={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!i,fragmentError:0}),s.minBitrate=Math.min(s.minBitrate,r.bitrate);const n=Math.min(r.height,r.width);return s.minHeight=Math.min(s.minHeight,n),s.minFramerate=Math.min(s.minFramerate,r.frameRate),s.maxScore=Math.max(s.maxScore,r.score),s.fragmentError+=r.fragmentError,s.videoRanges[r.videoRange]=(s.videoRanges[r.videoRange]||0)+1,i&&i.forEach((t=>{if(!t)return;const r=e.groups[t];r&&(s.hasDefaultAudio=s.hasDefaultAudio||e.hasDefaultAudio?r.hasDefault:r.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(r.channels).forEach((t=>{s.channels[t]=(s.channels[t]||0)+r.channels[t]})))})),t}),{})}(f,D,e,r)),s=function(t,e,r,i,s){const n=Object.keys(t),o=null==i?void 0:i.channels,a=null==i?void 0:i.audioCodec,l=o&&2===parseInt(o);let c=!0,u=!1,d=1/0,h=1/0,f=1/0,p=0,g=[];const{preferHDR:m,allowedVideoRanges:y}=um(e,s);for(let e=n.length;e--;){const r=t[n[e]];c=r.channels[2]>0,d=Math.min(d,r.minHeight),h=Math.min(h,r.minFramerate),f=Math.min(f,r.minBitrate);const i=y.filter((t=>r.videoRanges[t]>0));i.length>0&&(u=!0,g=i)}d=Gh(d)?d:0,h=Gh(h)?h:0;const v=Math.max(1080,d),_=Math.max(30,h);return f=Gh(f)?f:r,r=Math.max(f,r),u||(e=void 0,g=[]),{codecSet:n.reduce(((e,i)=>{const s=t[i];if(i===e)return e;if(s.minBitrate>r)return dm(i,`min bitrate of ${s.minBitrate} > current estimate of ${r}`),e;if(!s.hasDefaultAudio)return dm(i,"no renditions with default or auto-select sound found"),e;if(a&&i.indexOf(a.substring(0,4))%5!=0)return dm(i,`audio codec preference "${a}" not found`),e;if(o&&!l){if(!s.channels[o])return dm(i,`no renditions with ${o} channel sound found (channels options: ${Object.keys(s.channels)})`),e}else if((!a||l)&&c&&0===s.channels[2])return dm(i,"no renditions with stereo sound found"),e;return s.minHeight>v?(dm(i,`min resolution of ${s.minHeight} > maximum of ${v}`),e):s.minFramerate>_?(dm(i,`min framerate of ${s.minFramerate} > maximum of ${_}`),e):g.some((t=>s.videoRanges[t]>0))?s.maxScore=Op(e)||s.fragmentError>t[e].fragmentError)?e:(p=s.maxScore,i):(dm(i,`no variants with VIDEO-RANGE of ${JSON.stringify(g)} found`),e)}),void 0),videoRanges:g,preferHDR:m,minFramerate:h,minBitrate:f}}(i,T,t,S,b),{codecSet:n,videoRanges:o,minFramerate:a,minBitrate:l,preferHDR:c}=s;E=n,T=c?o[o.length-1]:o[0],w=a,t=Math.max(t,l),Zh.log(`[abr] picked start tier ${JSON.stringify(s)}`)}else E=null==y?void 0:y.codecSet,T=null==y?void 0:y.videoRange;const L=h?h.duration:d?d.duration:0,A=this.bwEstimator.getEstimateTTFB()/1e3,k=[];for(let a=r;a>=e;a--){var C;const e=f[a],d=a>u;if(!e)continue;if(m.useMediaCapabilities&&!e.supportedResult&&!e.supportedPromise){const r=navigator.mediaCapabilities;"function"==typeof(null==r?void 0:r.decodingInfo)&&lm(e,D,T,w,t,S)?(e.supportedPromise=cm(e,D,r),e.supportedPromise.then((t=>{if(!this.hls)return;e.supportedResult=t;const r=this.hls.levels,i=r.indexOf(e);t.error?Zh.warn(`[abr] MediaCapabilities decodingInfo error: "${t.error}" for level ${i} ${JSON.stringify(t)}`):t.supported||(Zh.warn(`[abr] Unsupported MediaCapabilities decodingInfo result for level ${i} ${JSON.stringify(t)}`),i>-1&&r.length>1&&(Zh.log(`[abr] Removing unsupported level ${i}`),this.hls.removeLevel(i)))}))):e.supportedResult=om}if(E&&e.codecSet!==E||T&&e.videoRange!==T||d&&w>e.frameRate||!d&&w>0&&w=2*L&&0===s?f[a].averageBitrate:f[a].maxBitrate,P=this.getTimeToLoadFrag(A,x,R*b,void 0===p);if(x>=R&&(a===c||0===e.loadError&&0===e.fragmentError)&&(P<=A||!Gh(P)||v&&!this.bitrateTestDelay||P${a} adjustedbw(${Math.round(x)})-bitrate=${Math.round(x-R)} ttfb:${A.toFixed(1)} avgDuration:${b.toFixed(1)} maxFetchDuration:${l.toFixed(1)} fetchDuration:${P.toFixed(1)} firstSelection:${_} codecSet:${E} videoRange:${T} hls.loadLevel:${g}`)),_&&(this.firstSelection=a),a}}return-1}set nextAutoLevel(t){const{maxAutoLevel:e,minAutoLevel:r}=this.hls,i=Math.min(Math.max(t,r),e);this._nextAutoLevel!==i&&(this.nextAutoLevelKey="",this._nextAutoLevel=i)}},bufferController:class{constructor(t){this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.appendSource=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this.log=void 0,this.warn=void 0,this.error=void 0,this._onEndStreaming=t=>{this.hls&&this.hls.pauseBuffering()},this._onStartStreaming=t=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=()=>{const{media:t,mediaSource:e}=this;this.log("Media source opened"),t&&(t.removeEventListener("emptied",this._onMediaEmptied),this.updateMediaElementDuration(),this.hls.trigger(Kh.MEDIA_ATTACHED,{media:t,mediaSource:e})),e&&e.removeEventListener("sourceopen",this._onMediaSourceOpen),this.checkPendingTracks()},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:t,_objectUrl:e}=this;t!==e&&Zh.error(`Media element src was set while attaching MediaSource (${e} > ${t})`)},this.hls=t;const e="[buffer-controller]";var r;this.appendSource=(r=xp(t.config.preferManagedMediaSource),"undefined"!=typeof self&&r===self.ManagedMediaSource),this.log=Zh.log.bind(Zh,e),this.warn=Zh.warn.bind(Zh,e),this.error=Zh.error.bind(Zh,e),this._initSourceBuffer(),this.registerListeners()}hasSourceTypes(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null,this.hls=null}registerListeners(){const{hls:t}=this;t.on(Kh.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(Kh.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(Kh.MANIFEST_LOADING,this.onManifestLoading,this),t.on(Kh.MANIFEST_PARSED,this.onManifestParsed,this),t.on(Kh.BUFFER_RESET,this.onBufferReset,this),t.on(Kh.BUFFER_APPENDING,this.onBufferAppending,this),t.on(Kh.BUFFER_CODECS,this.onBufferCodecs,this),t.on(Kh.BUFFER_EOS,this.onBufferEos,this),t.on(Kh.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(Kh.LEVEL_UPDATED,this.onLevelUpdated,this),t.on(Kh.FRAG_PARSED,this.onFragParsed,this),t.on(Kh.FRAG_CHANGED,this.onFragChanged,this)}unregisterListeners(){const{hls:t}=this;t.off(Kh.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(Kh.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(Kh.MANIFEST_LOADING,this.onManifestLoading,this),t.off(Kh.MANIFEST_PARSED,this.onManifestParsed,this),t.off(Kh.BUFFER_RESET,this.onBufferReset,this),t.off(Kh.BUFFER_APPENDING,this.onBufferAppending,this),t.off(Kh.BUFFER_CODECS,this.onBufferCodecs,this),t.off(Kh.BUFFER_EOS,this.onBufferEos,this),t.off(Kh.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(Kh.LEVEL_UPDATED,this.onLevelUpdated,this),t.off(Kh.FRAG_PARSED,this.onFragParsed,this),t.off(Kh.FRAG_CHANGED,this.onFragChanged,this)}_initSourceBuffer(){this.sourceBuffer={},this.operationQueue=new hv(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.appendErrors={audio:0,video:0,audiovideo:0},this.lastMpegAudioChunk=null}onManifestLoading(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null}onManifestParsed(t,e){let r=2;(e.audio&&!e.video||!e.altAudio)&&(r=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=r,this.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`)}onMediaAttaching(t,e){const r=this.media=e.media,i=xp(this.appendSource);if(r&&i){var s;const t=this.mediaSource=new i;this.log(`created media source: ${null==(s=t.constructor)?void 0:s.name}`),t.addEventListener("sourceopen",this._onMediaSourceOpen),t.addEventListener("sourceended",this._onMediaSourceEnded),t.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(t.addEventListener("startstreaming",this._onStartStreaming),t.addEventListener("endstreaming",this._onEndStreaming));const e=this._objectUrl=self.URL.createObjectURL(t);if(this.appendSource)try{r.removeAttribute("src");const i=self.ManagedMediaSource;r.disableRemotePlayback=r.disableRemotePlayback||i&&t instanceof i,pv(r),function(t,e){const r=self.document.createElement("source");r.type="video/mp4",r.src=e,t.appendChild(r)}(r,e),r.load()}catch(t){r.src=e}else r.src=e;r.addEventListener("emptied",this._onMediaEmptied)}}onMediaDetaching(){const{media:t,mediaSource:e,_objectUrl:r}=this;if(e){if(this.log("media source detaching"),"open"===e.readyState)try{e.endOfStream()}catch(t){this.warn(`onMediaDetaching: ${t.message} while calling endOfStream`)}this.onBufferReset(),e.removeEventListener("sourceopen",this._onMediaSourceOpen),e.removeEventListener("sourceended",this._onMediaSourceEnded),e.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.removeEventListener("startstreaming",this._onStartStreaming),e.removeEventListener("endstreaming",this._onEndStreaming)),t&&(t.removeEventListener("emptied",this._onMediaEmptied),r&&self.URL.revokeObjectURL(r),this.mediaSrc===r?(t.removeAttribute("src"),this.appendSource&&pv(t),t.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(Kh.MEDIA_DETACHED,void 0)}onBufferReset(){this.getSourceBufferTypes().forEach((t=>{this.resetBuffer(t)})),this._initSourceBuffer()}resetBuffer(t){const e=this.sourceBuffer[t];try{var r;if(e)this.removeBufferListeners(t),this.sourceBuffer[t]=void 0,null!=(r=this.mediaSource)&&r.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(e)}catch(e){this.warn(`onBufferReset ${t}`,e)}}onBufferCodecs(t,e){const r=this.getSourceBufferTypes().length,i=Object.keys(e);if(i.forEach((t=>{if(r){const r=this.tracks[t];if(r&&"function"==typeof r.buffer.changeType){var i;const{id:s,codec:n,levelCodec:o,container:a,metadata:l}=e[t],c=$p(r.codec,r.levelCodec),u=null==c?void 0:c.replace(fv,"$1");let d=$p(n,o);const h=null==(i=d)?void 0:i.replace(fv,"$1");if(d&&u!==h){"audio"===t.slice(0,5)&&(d=Up(d,this.appendSource));const e=`${a};codecs=${d}`;this.appendChangeType(t,e),this.log(`switching codec ${c} to ${d}`),this.tracks[t]={buffer:r.buffer,codec:n,container:a,levelCodec:o,metadata:l,id:s}}}}else this.pendingTracks[t]=e[t]})),r)return;const s=Math.max(this.bufferCodecEventsExpected-1,0);this.bufferCodecEventsExpected!==s&&(this.log(`${s} bufferCodec event(s) expected ${i.join(",")}`),this.bufferCodecEventsExpected=s),this.mediaSource&&"open"===this.mediaSource.readyState&&this.checkPendingTracks()}appendChangeType(t,e){const{operationQueue:r}=this,i={execute:()=>{const i=this.sourceBuffer[t];i&&(this.log(`changing ${t} sourceBuffer type to ${e}`),i.changeType(e)),r.shiftAndExecuteNext(t)},onStart:()=>{},onComplete:()=>{},onError:e=>{this.warn(`Failed to change ${t} SourceBuffer type`,e)}};r.append(i,t,!!this.pendingTracks[t])}onBufferAppending(t,e){const{hls:r,operationQueue:i,tracks:s}=this,{data:n,type:o,frag:a,part:l,chunkMeta:c}=e,u=c.buffering[o],d=self.performance.now();u.start=d;const h=a.stats.buffering,f=l?l.stats.buffering:null;0===h.start&&(h.start=d),f&&0===f.start&&(f.start=d);const p=s.audio;let g=!1;"audio"===o&&"audio/mpeg"===(null==p?void 0:p.container)&&(g=!this.lastMpegAudioChunk||1===c.id||this.lastMpegAudioChunk.sn!==c.sn,this.lastMpegAudioChunk=c);const m=a.start,y={execute:()=>{if(u.executeStart=self.performance.now(),g){const t=this.sourceBuffer[o];if(t){const e=m-t.timestampOffset;Math.abs(e)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${m} (delta: ${e}) sn: ${a.sn})`),t.timestampOffset=m)}}this.appendExecutor(n,o)},onStart:()=>{},onComplete:()=>{const t=self.performance.now();u.executeEnd=u.end=t,0===h.first&&(h.first=t),f&&0===f.first&&(f.first=t);const{sourceBuffer:e}=this,r={};for(const t in e)r[t]=Dm.getBuffered(e[t]);this.appendErrors[o]=0,"audio"===o||"video"===o?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(Kh.BUFFER_APPENDED,{type:o,frag:a,part:l,chunkMeta:c,parent:a.type,timeRanges:r})},onError:t=>{const e={type:Wh.MEDIA_ERROR,parent:a.type,details:zh.BUFFER_APPEND_ERROR,sourceBufferName:o,frag:a,part:l,chunkMeta:c,error:t,err:t,fatal:!1};if(t.code===DOMException.QUOTA_EXCEEDED_ERR)e.details=zh.BUFFER_FULL_ERROR;else{const t=++this.appendErrors[o];e.details=zh.BUFFER_APPEND_ERROR,this.warn(`Failed ${t}/${r.config.appendErrorMaxRetry} times to append segment in "${o}" sourceBuffer`),t>=r.config.appendErrorMaxRetry&&(e.fatal=!0)}r.trigger(Kh.ERROR,e)}};i.append(y,o,!!this.pendingTracks[o])}onBufferFlushing(t,e){const{operationQueue:r}=this,i=t=>({execute:this.removeExecutor.bind(this,t,e.startOffset,e.endOffset),onStart:()=>{},onComplete:()=>{this.hls.trigger(Kh.BUFFER_FLUSHED,{type:t})},onError:e=>{this.warn(`Failed to remove from ${t} SourceBuffer`,e)}});e.type?r.append(i(e.type),e.type):this.getSourceBufferTypes().forEach((t=>{r.append(i(t),t)}))}onFragParsed(t,e){const{frag:r,part:i}=e,s=[],n=i?i.elementaryStreams:r.elementaryStreams;n[lf]?s.push("audiovideo"):(n[of]&&s.push("audio"),n[af]&&s.push("video"));0===s.length&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${r.type} level: ${r.level} sn: ${r.sn}`),this.blockBuffers((()=>{const t=self.performance.now();r.stats.buffering.end=t,i&&(i.stats.buffering.end=t);const e=i?i.stats:r.stats;this.hls.trigger(Kh.FRAG_BUFFERED,{frag:r,part:i,stats:e,id:r.type})}),s)}onFragChanged(t,e){this.trimBuffers()}onBufferEos(t,e){this.getSourceBufferTypes().reduce(((t,r)=>{const i=this.sourceBuffer[r];return!i||e.type&&e.type!==r||(i.ending=!0,i.ended||(i.ended=!0,this.log(`${r} sourceBuffer now EOS`))),t&&!(i&&!i.ended)}),!0)&&(this.log("Queueing mediaSource.endOfStream()"),this.blockBuffers((()=>{this.getSourceBufferTypes().forEach((t=>{const e=this.sourceBuffer[t];e&&(e.ending=!1)}));const{mediaSource:t}=this;t&&"open"===t.readyState?(this.log("Calling mediaSource.endOfStream()"),t.endOfStream()):t&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${t.readyState}`)})))}onLevelUpdated(t,{details:e}){e.fragments.length&&(this.details=e,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())}trimBuffers(){const{hls:t,details:e,media:r}=this;if(!r||null===e)return;if(!this.getSourceBufferTypes().length)return;const i=t.config,s=r.currentTime,n=e.levelTargetDuration,o=e.live&&null!==i.liveBackBufferLength?i.liveBackBufferLength:i.backBufferLength;if(Gh(o)&&o>0){const t=Math.max(o,n),e=Math.floor(s/n)*n-t;this.flushBackBuffer(s,n,e)}if(Gh(i.frontBufferFlushThreshold)&&i.frontBufferFlushThreshold>0){const t=Math.max(i.maxBufferLength,i.frontBufferFlushThreshold),e=Math.max(t,n),r=Math.floor(s/n)*n+e;this.flushFrontBuffer(s,n,r)}}flushBackBuffer(t,e,r){const{details:i,sourceBuffer:s}=this;this.getSourceBufferTypes().forEach((n=>{const o=s[n];if(o){const s=Dm.getBuffered(o);if(s.length>0&&r>s.start(0)){if(this.hls.trigger(Kh.BACK_BUFFER_REACHED,{bufferEnd:r}),null!=i&&i.live)this.hls.trigger(Kh.LIVE_BACK_BUFFER_REACHED,{bufferEnd:r});else if(o.ended&&s.end(s.length-1)-t<2*e)return void this.log(`Cannot flush ${n} back buffer while SourceBuffer is in ended state`);this.hls.trigger(Kh.BUFFER_FLUSHING,{startOffset:0,endOffset:r,type:n})}}}))}flushFrontBuffer(t,e,r){const{sourceBuffer:i}=this;this.getSourceBufferTypes().forEach((s=>{const n=i[s];if(n){const i=Dm.getBuffered(n),o=i.length;if(o<2)return;const a=i.start(o-1),l=i.end(o-1);if(r>a||t>=a&&t<=l)return;if(n.ended&&t-l<2*e)return void this.log(`Cannot flush ${s} front buffer while SourceBuffer is in ended state`);this.hls.trigger(Kh.BUFFER_FLUSHING,{startOffset:a,endOffset:1/0,type:s})}}))}updateMediaElementDuration(){if(!this.details||!this.media||!this.mediaSource||"open"!==this.mediaSource.readyState)return;const{details:t,hls:e,media:r,mediaSource:i}=this,s=t.fragments[0].start+t.totalduration,n=r.duration,o=Gh(i.duration)?i.duration:0;t.live&&e.config.liveDurationInfinity?(i.duration=1/0,this.updateSeekableRange(t)):(s>o&&s>n||!Gh(n))&&(this.log(`Updating Media Source duration to ${s.toFixed(3)}`),i.duration=s)}updateSeekableRange(t){const e=this.mediaSource,r=t.fragments;if(r.length&&t.live&&null!=e&&e.setLiveSeekableRange){const i=Math.max(0,r[0].start),s=Math.max(i,i+t.totalduration);this.log(`Media Source duration is set to ${e.duration}. Setting seekable range to ${i}-${s}.`),e.setLiveSeekableRange(i,s)}}checkPendingTracks(){const{bufferCodecEventsExpected:t,operationQueue:e,pendingTracks:r}=this,i=Object.keys(r).length;if(i&&(!t||2===i||"audiovideo"in r)){this.createSourceBuffers(r),this.pendingTracks={};const t=this.getSourceBufferTypes();if(t.length)this.hls.trigger(Kh.BUFFER_CREATED,{tracks:this.tracks}),t.forEach((t=>{e.executeNext(t)}));else{const t=new Error("could not create source buffer for media codec(s)");this.hls.trigger(Kh.ERROR,{type:Wh.MEDIA_ERROR,details:zh.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:t,reason:t.message})}}}createSourceBuffers(t){const{sourceBuffer:e,mediaSource:r}=this;if(!r)throw Error("createSourceBuffers called when mediaSource was null");for(const s in t)if(!e[s]){var i;const n=t[s];if(!n)throw Error(`source buffer exists for track ${s}, however track does not`);let o=-1===(null==(i=n.levelCodec)?void 0:i.indexOf(","))?n.levelCodec:n.codec;o&&"audio"===s.slice(0,5)&&(o=Up(o,this.appendSource));const a=`${n.container};codecs=${o}`;this.log(`creating sourceBuffer(${a})`);try{const t=e[s]=r.addSourceBuffer(a),i=s;this.addBufferListener(i,"updatestart",this._onSBUpdateStart),this.addBufferListener(i,"updateend",this._onSBUpdateEnd),this.addBufferListener(i,"error",this._onSBUpdateError),this.appendSource&&this.addBufferListener(i,"bufferedchange",((t,e)=>{const r=e.removedRanges;null!=r&&r.length&&this.hls.trigger(Kh.BUFFER_FLUSHED,{type:s})})),this.tracks[s]={buffer:t,codec:o,container:n.container,levelCodec:n.levelCodec,metadata:n.metadata,id:n.id}}catch(t){this.error(`error while trying to add sourceBuffer: ${t.message}`),this.hls.trigger(Kh.ERROR,{type:Wh.MEDIA_ERROR,details:zh.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:t,sourceBufferName:s,mimeType:a})}}}get mediaSrc(){var t,e;const r=(null==(t=this.media)||null==(e=t.querySelector)?void 0:e.call(t,"source"))||this.media;return null==r?void 0:r.src}_onSBUpdateStart(t){const{operationQueue:e}=this;e.current(t).onStart()}_onSBUpdateEnd(t){var e;if("closed"===(null==(e=this.mediaSource)?void 0:e.readyState))return void this.resetBuffer(t);const{operationQueue:r}=this;r.current(t).onComplete(),r.shiftAndExecuteNext(t)}_onSBUpdateError(t,e){var r;const i=new Error(`${t} SourceBuffer error. MediaSource readyState: ${null==(r=this.mediaSource)?void 0:r.readyState}`);this.error(`${i}`,e),this.hls.trigger(Kh.ERROR,{type:Wh.MEDIA_ERROR,details:zh.BUFFER_APPENDING_ERROR,sourceBufferName:t,error:i,fatal:!1});const s=this.operationQueue.current(t);s&&s.onError(i)}removeExecutor(t,e,r){const{media:i,mediaSource:s,operationQueue:n,sourceBuffer:o}=this,a=o[t];if(!i||!s||!a)return this.warn(`Attempting to remove from the ${t} SourceBuffer, but it does not exist`),void n.shiftAndExecuteNext(t);const l=Gh(i.duration)?i.duration:1/0,c=Gh(s.duration)?s.duration:1/0,u=Math.max(0,e),d=Math.min(r,l,c);d>u&&(!a.ending||a.ended)?(a.ended=!1,this.log(`Removing [${u},${d}] from the ${t} SourceBuffer`),a.remove(u,d)):n.shiftAndExecuteNext(t)}appendExecutor(t,e){const r=this.sourceBuffer[e];if(r)r.ended=!1,r.appendBuffer(t);else if(!this.pendingTracks[e])throw new Error(`Attempting to append to the ${e} SourceBuffer, but it does not exist`)}blockBuffers(t,e=this.getSourceBufferTypes()){if(!e.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),void Promise.resolve().then(t);const{operationQueue:r}=this,i=e.map((t=>r.appendBlocker(t)));Promise.all(i).then((()=>{t(),e.forEach((t=>{const e=this.sourceBuffer[t];null!=e&&e.updating||r.shiftAndExecuteNext(t)}))}))}getSourceBufferTypes(){return Object.keys(this.sourceBuffer)}addBufferListener(t,e,r){const i=this.sourceBuffer[t];if(!i)return;const s=r.bind(this,t);this.listeners[t].push({event:e,listener:s}),i.addEventListener(e,s)}removeBufferListeners(t){const e=this.sourceBuffer[t];e&&this.listeners[t].forEach((t=>{e.removeEventListener(t.event,t.listener)}))}},capLevelController:c_,errorController:class{constructor(t){this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.log=void 0,this.warn=void 0,this.error=void 0,this.hls=t,this.log=Zh.log.bind(Zh,"[info]:"),this.warn=Zh.warn.bind(Zh,"[warning]:"),this.error=Zh.error.bind(Zh,"[error]:"),this.registerListeners()}registerListeners(){const t=this.hls;t.on(Kh.ERROR,this.onError,this),t.on(Kh.MANIFEST_LOADING,this.onManifestLoading,this),t.on(Kh.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const t=this.hls;t&&(t.off(Kh.ERROR,this.onError,this),t.off(Kh.ERROR,this.onErrorOut,this),t.off(Kh.MANIFEST_LOADING,this.onManifestLoading,this),t.off(Kh.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(t){}stopLoad(){this.playlistError=0}getVariantLevelIndex(t){return(null==t?void 0:t.type)===sg?t.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(t,e){var r,i;if(e.fatal)return;const s=this.hls,n=e.context;switch(e.details){case zh.FRAG_LOAD_ERROR:case zh.FRAG_LOAD_TIMEOUT:case zh.KEY_LOAD_ERROR:case zh.KEY_LOAD_TIMEOUT:return void(e.errorAction=this.getFragRetryOrSwitchAction(e));case zh.FRAG_PARSING_ERROR:if(null!=(r=e.frag)&&r.gap)return void(e.errorAction={action:Xg,flags:tm});case zh.FRAG_GAP:case zh.FRAG_DECRYPT_ERROR:return e.errorAction=this.getFragRetryOrSwitchAction(e),void(e.errorAction.action=Qg);case zh.LEVEL_EMPTY_ERROR:case zh.LEVEL_PARSING_ERROR:{var o,a;const t=e.parent===sg?e.level:s.loadLevel;e.details===zh.LEVEL_EMPTY_ERROR&&null!=(o=e.context)&&null!=(a=o.levelDetails)&&a.live?e.errorAction=this.getPlaylistRetryOrSwitchAction(e,t):(e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t))}return;case zh.LEVEL_LOAD_ERROR:case zh.LEVEL_LOAD_TIMEOUT:return void("number"==typeof(null==n?void 0:n.level)&&(e.errorAction=this.getPlaylistRetryOrSwitchAction(e,n.level)));case zh.AUDIO_TRACK_LOAD_ERROR:case zh.AUDIO_TRACK_LOAD_TIMEOUT:case zh.SUBTITLE_LOAD_ERROR:case zh.SUBTITLE_TRACK_LOAD_TIMEOUT:if(n){const t=s.levels[s.loadLevel];if(t&&(n.type===rg&&t.hasAudioGroup(n.groupId)||n.type===ig&&t.hasSubtitleGroup(n.groupId)))return e.errorAction=this.getPlaylistRetryOrSwitchAction(e,s.loadLevel),e.errorAction.action=Qg,void(e.errorAction.flags=em)}return;case zh.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const t=s.levels[s.loadLevel],r=null==t?void 0:t.attrs["HDCP-LEVEL"];r?e.errorAction={action:Qg,flags:rm,hdcpLevel:r}:this.keySystemError(e)}return;case zh.BUFFER_ADD_CODEC_ERROR:case zh.REMUX_ALLOC_ERROR:case zh.BUFFER_APPEND_ERROR:return void(e.errorAction=this.getLevelSwitchAction(e,null!=(i=e.level)?i:s.loadLevel));case zh.INTERNAL_EXCEPTION:case zh.BUFFER_APPENDING_ERROR:case zh.BUFFER_FULL_ERROR:case zh.LEVEL_SWITCH_ERROR:case zh.BUFFER_STALLED_ERROR:case zh.BUFFER_SEEK_OVER_HOLE:case zh.BUFFER_NUDGE_ON_STALL:return void(e.errorAction={action:Xg,flags:tm})}e.type===Wh.KEY_SYSTEM_ERROR&&this.keySystemError(e)}keySystemError(t){const e=this.getVariantLevelIndex(t.frag);t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,e)}getPlaylistRetryOrSwitchAction(t,e){const r=Gg(this.hls.config.playlistLoadPolicy,t),i=this.playlistError++;if(Kg(r,i,qg(t),t.response))return{action:Jg,flags:tm,retryConfig:r,retryCount:i};const s=this.getLevelSwitchAction(t,e);return r&&(s.retryConfig=r,s.retryCount=i),s}getFragRetryOrSwitchAction(t){const e=this.hls,r=this.getVariantLevelIndex(t.frag),i=e.levels[r],{fragLoadPolicy:s,keyLoadPolicy:n}=e.config,o=Gg(t.details.startsWith("key")?n:s,t),a=e.levels.reduce(((t,e)=>t+e.fragmentError),0);if(i){t.details!==zh.FRAG_GAP&&i.fragmentError++;if(Kg(o,a,qg(t),t.response))return{action:Jg,flags:tm,retryConfig:o,retryCount:a}}const l=this.getLevelSwitchAction(t,r);return o&&(l.retryConfig=o,l.retryCount=a),l}getLevelSwitchAction(t,e){const r=this.hls;null==e&&(e=r.loadLevel);const i=this.hls.levels[e];if(i){var s,n;const e=t.details;i.loadError++,e===zh.BUFFER_APPEND_ERROR&&i.fragmentError++;let l=-1;const{levels:c,loadLevel:u,minAutoLevel:d,maxAutoLevel:h}=r;r.autoLevelEnabled||(r.loadLevel=-1);const f=null==(s=t.frag)?void 0:s.type,p=(f===ng&&e===zh.FRAG_PARSING_ERROR||"audio"===t.sourceBufferName&&(e===zh.BUFFER_ADD_CODEC_ERROR||e===zh.BUFFER_APPEND_ERROR))&&c.some((({audioCodec:t})=>i.audioCodec!==t)),g="video"===t.sourceBufferName&&(e===zh.BUFFER_ADD_CODEC_ERROR||e===zh.BUFFER_APPEND_ERROR)&&c.some((({codecSet:t,audioCodec:e})=>i.codecSet!==t&&i.audioCodec===e)),{type:m,groupId:y}=null!=(n=t.context)?n:{};for(let r=c.length;r--;){const s=(r+u)%c.length;if(s!==u&&s>=d&&s<=h&&0===c[s].loadError){var o,a;const r=c[s];if(e===zh.FRAG_GAP&&f===sg&&t.frag){const e=c[s].details;if(e){const r=zg(t.frag,e.fragments,t.frag.start);if(null!=r&&r.gap)continue}}else{if(m===rg&&r.hasAudioGroup(y)||m===ig&&r.hasSubtitleGroup(y))continue;if(f===ng&&null!=(o=i.audioGroups)&&o.some((t=>r.hasAudioGroup(t)))||f===og&&null!=(a=i.subtitleGroups)&&a.some((t=>r.hasSubtitleGroup(t)))||p&&i.audioCodec===r.audioCodec||!p&&i.audioCodec!==r.audioCodec||g&&i.codecSet===r.codecSet)continue}l=s;break}}if(l>-1&&r.loadLevel!==l)return t.levelRetry=!0,this.playlistError=0,{action:Qg,flags:tm,nextAutoLevel:l}}return{action:Qg,flags:em}}onErrorOut(t,e){var r;switch(null==(r=e.errorAction)?void 0:r.action){case Xg:break;case Qg:this.sendAlternateToPenaltyBox(e),e.errorAction.resolved||e.details===zh.FRAG_GAP?/MediaSource readyState: ended/.test(e.error.message)&&(this.warn(`MediaSource ended after "${e.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError()):e.fatal=!0}e.fatal&&this.hls.stopLoad()}sendAlternateToPenaltyBox(t){const e=this.hls,r=t.errorAction;if(!r)return;const{flags:i,hdcpLevel:s,nextAutoLevel:n}=r;switch(i){case tm:this.switchLevel(t,n);break;case rm:s&&(e.maxHdcpLevel=bg[bg.indexOf(s)-1],r.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${e.maxHdcpLevel}" or lower`)}r.resolved||this.switchLevel(t,n)}switchLevel(t,e){void 0!==e&&t.errorAction&&(this.warn(`switching to level ${e} after ${t.details}`),this.hls.nextAutoLevel=e,t.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel)}},fpsController:class{constructor(t){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=t,this.registerListeners()}setStreamController(t){this.streamController=t}registerListeners(){this.hls.on(Kh.MEDIA_ATTACHING,this.onMediaAttaching,this)}unregisterListeners(){this.hls.off(Kh.MEDIA_ATTACHING,this.onMediaAttaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(t,e){const r=this.hls.config;if(r.capLevelOnFPSDrop){const t=e.media instanceof self.HTMLVideoElement?e.media:null;this.media=t,t&&"function"==typeof t.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),r.fpsDroppedMonitoringPeriod)}}checkFPS(t,e,r){const i=performance.now();if(e){if(this.lastTime){const t=i-this.lastTime,s=r-this.lastDroppedFrames,n=e-this.lastDecodedFrames,o=1e3*s/t,a=this.hls;if(a.trigger(Kh.FPS_DROP,{currentDropped:s,currentDecoded:n,totalDroppedFrames:r}),o>0&&s>a.config.fpsDroppedMonitoringThreshold*n){let t=a.currentLevel;Zh.warn("drop FPS ratio greater than max allowed value for currentLevel: "+t),t>0&&(-1===a.autoLevelCapping||a.autoLevelCapping>=t)&&(t-=1,a.trigger(Kh.FPS_DROP_LEVEL_CAPPING,{level:t,droppedLevel:a.currentLevel}),a.autoLevelCapping=t,this.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=r,this.lastDecodedFrames=e}}checkFPSInterval(){const t=this.media;if(t)if(this.isVideoPlaybackQualityAvailable){const e=t.getVideoPlaybackQuality();this.checkFPS(t,e.totalVideoFrames,e.droppedVideoFrames)}else this.checkFPS(t,t.webkitDecodedFrameCount,t.webkitDroppedFrameCount)}},stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:xf,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},{cueHandler:X_,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:class extends ty{constructor(t,e,r){super(t,e,r,"[subtitle-stream-controller]",og),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}_registerListeners(){const{hls:t}=this;t.on(Kh.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(Kh.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(Kh.MANIFEST_LOADING,this.onManifestLoading,this),t.on(Kh.LEVEL_LOADED,this.onLevelLoaded,this),t.on(Kh.ERROR,this.onError,this),t.on(Kh.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(Kh.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.on(Kh.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(Kh.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.on(Kh.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(Kh.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:t}=this;t.off(Kh.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(Kh.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(Kh.MANIFEST_LOADING,this.onManifestLoading,this),t.off(Kh.LEVEL_LOADED,this.onLevelLoaded,this),t.off(Kh.ERROR,this.onError,this),t.off(Kh.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(Kh.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.off(Kh.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(Kh.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.off(Kh.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(Kh.FRAG_BUFFERED,this.onFragBuffered,this)}startLoad(t){this.stopLoad(),this.state=Hm,this.setInterval(500),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()}onManifestLoading(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()}onMediaDetaching(){this.tracksBuffered=[],super.onMediaDetaching()}onLevelLoaded(t,e){this.mainDetails=e.details}onSubtitleFragProcessed(t,e){const{frag:r,success:i}=e;if(this.fragPrevious=r,this.state=Hm,!i)return;const s=this.tracksBuffered[this.currentTrackId];if(!s)return;let n;const o=r.start;for(let t=0;t=s[t].start&&o<=s[t].end){n=s[t];break}const a=r.start+r.duration;n?n.end=a:(n={start:o,end:a},s.push(n)),this.fragmentTracker.fragBuffered(r),this.fragBufferedComplete(r,null)}onBufferFlushing(t,e){const{startOffset:r,endOffset:i}=e;if(0===r&&i!==Number.POSITIVE_INFINITY){const t=i-1;if(t<=0)return;e.endOffsetSubtitles=Math.max(0,t),this.tracksBuffered.forEach((e=>{for(let r=0;rnew Rg(t))):(this.tracksBuffered=[],this.levels=e.map((t=>{const e=new Rg(t);return this.tracksBuffered[e.id]=[],e})),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,og),this.fragPrevious=null,this.mediaBuffer=null)}onSubtitleTrackSwitch(t,e){var r;if(this.currentTrackId=e.id,null==(r=this.levels)||!r.length||-1===this.currentTrackId)return void this.clearInterval();const i=this.levels[this.currentTrackId];null!=i&&i.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,i&&this.setInterval(500)}onSubtitleTrackLoaded(t,e){var r;const{currentTrackId:i,levels:s}=this,{details:n,id:o}=e;if(!s)return void this.warn(`Subtitle tracks were reset while loading level ${o}`);const a=s[o];if(o>=s.length||!a)return;this.log(`Subtitle track ${o} loaded [${n.startSN},${n.endSN}]${n.lastPartSn?`[part-${n.lastPartSn}-${n.lastPartIndex}]`:""},duration:${n.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let l=0;if(n.live||null!=(r=a.details)&&r.live){const t=this.mainDetails;if(n.deltaUpdateFailed||!t)return;const e=t.fragments[0];var c;if(a.details)l=this.alignPlaylists(n,a.details,null==(c=this.levelLastLoaded)?void 0:c.details),0===l&&e&&(l=e.start,Ng(n,l));else n.hasProgramDateTime&&t.hasProgramDateTime?(Rm(n,t),l=n.fragments[0].start):e&&(l=e.start,Ng(n,l))}if(a.details=n,this.levelLastLoaded=a,o===i&&(this.startFragRequested||!this.mainDetails&&n.live||this.setStartPosition(this.mainDetails||n,l),this.tick(),n.live&&!this.fragCurrent&&this.media&&this.state===Hm)){zg(null,n.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),a.details=void 0)}}_handleFragmentLoadComplete(t){const{frag:e,payload:r}=t,i=e.decryptdata,s=this.hls;if(!this.fragContextChanged(e)&&r&&r.byteLength>0&&null!=i&&i.key&&i.iv&&"AES-128"===i.method){const t=performance.now();this.decrypter.decrypt(new Uint8Array(r),i.key.buffer,i.iv.buffer).catch((t=>{throw s.trigger(Kh.ERROR,{type:Wh.MEDIA_ERROR,details:zh.FRAG_DECRYPT_ERROR,fatal:!1,error:t,reason:t.message,frag:e}),t})).then((r=>{const i=performance.now();s.trigger(Kh.FRAG_DECRYPTED,{frag:e,payload:r,stats:{tstart:t,tdecrypt:i}})})).catch((t=>{this.warn(`${t.name}: ${t.message}`),this.state=Hm}))}}doTick(){if(this.media){if(this.state===Hm){const{currentTrackId:t,levels:e}=this,r=null==e?void 0:e[t];if(!r||!e.length||!r.details)return;const{config:i}=this,s=this.getLoadPosition(),n=Dm.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],s,i.maxBufferHole),{end:o,len:a}=n,l=this.getFwdBufferInfo(this.media,sg),c=r.details;if(a>this.getMaxBufferLength(null==l?void 0:l.len)+c.levelTargetDuration)return;const u=c.fragments,d=u.length,h=c.edge;let f=null;const p=this.fragPrevious;if(oh-t?0:t;f=zg(p,u,Math.max(u[0].start,o),e),!f&&p&&p.startthis.pollTrackChange(0),this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const e=pg(this.media.textTracks);for(let r=0;r-1&&this.toggleTrackModes()}registerListeners(){const{hls:t}=this;t.on(Kh.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(Kh.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(Kh.MANIFEST_LOADING,this.onManifestLoading,this),t.on(Kh.MANIFEST_PARSED,this.onManifestParsed,this),t.on(Kh.LEVEL_LOADING,this.onLevelLoading,this),t.on(Kh.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(Kh.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(Kh.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t.off(Kh.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(Kh.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(Kh.MANIFEST_LOADING,this.onManifestLoading,this),t.off(Kh.MANIFEST_PARSED,this.onManifestParsed,this),t.off(Kh.LEVEL_LOADING,this.onLevelLoading,this),t.off(Kh.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(Kh.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(Kh.ERROR,this.onError,this)}onMediaAttached(t,e){this.media=e.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(t){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,t)}onMediaDetaching(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);pg(this.media.textTracks).forEach((t=>{hg(t)})),this.subtitleTrack=-1,this.media=null}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(t,e){this.tracks=e.subtitleTracks}onSubtitleTrackLoaded(t,e){const{id:r,groupId:i,details:s}=e,n=this.tracksInGroup[r];if(!n||n.groupId!==i)return void this.warn(`Subtitle track with id:${r} and group:${i} not found in active group ${null==n?void 0:n.groupId}`);const o=n.details;n.details=e.details,this.log(`Subtitle track ${r} "${n.name}" lang:${n.lang} group:${i} loaded [${s.startSN}-${s.endSN}]`),r===this.trackId&&this.playlistLoaded(r,e,o)}onLevelLoading(t,e){this.switchLevel(e.level)}onLevelSwitching(t,e){this.switchLevel(e.level)}switchLevel(t){const e=this.hls.levels[t];if(!e)return;const r=e.subtitleGroups||null,i=this.groupIds;let s=this.currentTrack;if(!r||(null==i?void 0:i.length)!==(null==r?void 0:r.length)||null!=r&&r.some((t=>-1===(null==i?void 0:i.indexOf(t))))){this.groupIds=r,this.trackId=-1,this.currentTrack=null;const t=this.tracks.filter((t=>!r||-1!==r.indexOf(t.groupId)));if(t.length)this.selectDefaultTrack&&!t.some((t=>t.default))&&(this.selectDefaultTrack=!1),t.forEach(((t,e)=>{t.id=e}));else if(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=t;const e=this.hls.config.subtitlePreference;if(!s&&e){this.selectDefaultTrack=!1;const r=hm(e,t);if(r>-1)s=t[r];else{const t=hm(e,this.tracks);s=this.tracks[t]}}let i=this.findTrackId(s);-1===i&&s&&(i=this.findTrackId(null));const n={subtitleTracks:t};this.log(`Updating subtitle tracks, ${t.length} track(s) found in "${null==r?void 0:r.join(",")}" group-id`),this.hls.trigger(Kh.SUBTITLE_TRACKS_UPDATED,n),-1!==i&&-1===this.trackId&&this.setSubtitleTrack(i)}else this.shouldReloadPlaylist(s)&&this.setSubtitleTrack(this.trackId)}findTrackId(t){const e=this.tracksInGroup,r=this.selectDefaultTrack;for(let i=0;i-1){const t=this.tracksInGroup[i];return this.setSubtitleTrack(i),t}if(r)return null;{const r=hm(t,e);if(r>-1)return e[r]}}}return null}loadPlaylist(t){super.loadPlaylist();const e=this.currentTrack;if(this.shouldLoadPlaylist(e)&&e){const r=e.id,i=e.groupId;let s=e.url;if(t)try{s=t.addDirectives(s)}catch(t){this.warn(`Could not construct new URL with HLS Delivery Directives: ${t}`)}this.log(`Loading subtitle playlist for id ${r}`),this.hls.trigger(Kh.SUBTITLE_TRACK_LOADING,{url:s,id:r,groupId:i,deliveryDirectives:t||null})}}toggleTrackModes(){const{media:t}=this;if(!t)return;const e=pg(t.textTracks),r=this.currentTrack;let i;if(r&&(i=e.filter((t=>uv(r,t)))[0],i||this.warn(`Unable to find subtitle TextTrack with name "${r.name}" and language "${r.lang}"`)),[].slice.call(e).forEach((t=>{"disabled"!==t.mode&&t!==i&&(t.mode="disabled")})),i){const t=this.subtitleDisplay?"showing":"hidden";i.mode!==t&&(i.mode=t)}}setSubtitleTrack(t){const e=this.tracksInGroup;if(!this.media)return void(this.queuedDefaultTrack=t);if(t<-1||t>=e.length||!Gh(t))return void this.warn(`Invalid subtitle track id: ${t}`);this.clearTimer(),this.selectDefaultTrack=!1;const r=this.currentTrack,i=e[t]||null;if(this.trackId=t,this.currentTrack=i,this.toggleTrackModes(),!i)return void this.hls.trigger(Kh.SUBTITLE_TRACK_SWITCH,{id:t});const s=!!i.details&&!i.details.live;if(t===this.trackId&&i===r&&s)return;this.log(`Switching to subtitle-track ${t}`+(i?` "${i.name}" lang:${i.lang} group:${i.groupId}`:""));const{id:n,groupId:o="",name:a,type:l,url:c}=i;this.hls.trigger(Kh.SUBTITLE_TRACK_SWITCH,{id:n,groupId:o,name:a,type:l,url:c});const u=this.switchParams(i.url,null==r?void 0:r.details,i.details);this.loadPlaylist(u)}},timelineController:class{constructor(t){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this.captionsProperties=void 0,this.hls=t,this.config=t.config,this.Cues=t.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},t.on(Kh.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(Kh.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(Kh.MANIFEST_LOADING,this.onManifestLoading,this),t.on(Kh.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(Kh.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(Kh.FRAG_LOADING,this.onFragLoading,this),t.on(Kh.FRAG_LOADED,this.onFragLoaded,this),t.on(Kh.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.on(Kh.FRAG_DECRYPTED,this.onFragDecrypted,this),t.on(Kh.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(Kh.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.on(Kh.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:t}=this;t.off(Kh.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(Kh.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(Kh.MANIFEST_LOADING,this.onManifestLoading,this),t.off(Kh.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(Kh.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(Kh.FRAG_LOADING,this.onFragLoading,this),t.off(Kh.FRAG_LOADED,this.onFragLoaded,this),t.off(Kh.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.off(Kh.FRAG_DECRYPTED,this.onFragDecrypted,this),t.off(Kh.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(Kh.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.off(Kh.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){if(this.config.enableCEA708Captions&&(!this.cea608Parser1||!this.cea608Parser2)){const t=new Fv(this,"textTrack1"),e=new Fv(this,"textTrack2"),r=new Fv(this,"textTrack3"),i=new Fv(this,"textTrack4");this.cea608Parser1=new Rv(1,t,e),this.cea608Parser2=new Rv(3,r,i)}}addCues(t,e,r,i,s){let n=!1;for(let t=s.length;t--;){const i=s[t],u=(o=i[0],a=i[1],l=e,c=r,Math.min(a,c)-Math.max(o,l));if(u>=0&&(i[0]=Math.min(i[0],e),i[1]=Math.max(i[1],r),n=!0,u/(r-e)>.5))return}var o,a,l,c;if(n||s.push([e,r]),this.config.renderTextTracksNatively){const s=this.captionsTracks[t];this.Cues.newCue(s,e,r,i)}else{const s=this.Cues.newCue(null,e,r,i);this.hls.trigger(Kh.CUES_PARSED,{type:"captions",cues:s,track:t})}}onInitPtsFound(t,{frag:e,id:r,initPTS:i,timescale:s}){const{unparsedVttFrags:n}=this;"main"===r&&(this.initPTS[e.cc]={baseTime:i,timescale:s}),n.length&&(this.unparsedVttFrags=[],n.forEach((t=>{this.onFragLoaded(Kh.FRAG_LOADED,t)})))}getExistingTrack(t,e){const{media:r}=this;if(r)for(let i=0;i{hg(t[e]),delete t[e]})),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:t}=this;if(!t)return;const e=t.textTracks;if(e)for(let t=0;tt.textCodec===Xv));if(this.config.enableWebVTT||i&&this.config.enableIMSC1){if(lv(this.tracks,r))return void(this.tracks=r);if(this.textTracks=[],this.tracks=r,this.config.renderTextTracksNatively){const t=this.media,e=t?pg(t.textTracks):null;if(this.tracks.forEach(((t,r)=>{let i;if(e){let r=null;for(let i=0;inull!==t)).map((t=>t.label));t.length&&Zh.warn(`Media element contains unused subtitle tracks: ${t.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const t=this.tracks.map((t=>({label:t.name,kind:t.type.toLowerCase(),default:t.default,subtitleTrack:t})));this.hls.trigger(Kh.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:t})}}}onManifestLoaded(t,e){this.config.enableCEA708Captions&&e.captions&&e.captions.forEach((t=>{const e=/(?:CC|SERVICE)([1-4])/.exec(t.instreamId);if(!e)return;const r=`textTrack${e[1]}`,i=this.captionsProperties[r];i&&(i.label=t.name,t.lang&&(i.languageCode=t.lang),i.media=t)}))}closedCaptionsForLevel(t){const e=this.hls.levels[t.level];return null==e?void 0:e.attrs["CLOSED-CAPTIONS"]}onFragLoading(t,e){if(this.enabled&&e.frag.type===sg){var r,i;const{cea608Parser1:t,cea608Parser2:s,lastSn:n}=this,{cc:o,sn:a}=e.frag,l=null!=(r=null==(i=e.part)?void 0:i.index)?r:-1;t&&s&&(a!==n+1||a===n&&l!==this.lastPartIndex+1||o!==this.lastCc)&&(t.reset(),s.reset()),this.lastCc=o,this.lastSn=a,this.lastPartIndex=l}}onFragLoaded(t,e){const{frag:r,payload:i}=e;if(r.type===og)if(i.byteLength){const t=r.decryptdata,s="stats"in e;if(null==t||!t.encrypted||s){const t=this.tracks[r.level],s=this.vttCCs;s[r.cc]||(s[r.cc]={start:r.start,prevCC:this.prevCC,new:!0},this.prevCC=r.cc),t&&t.textCodec===Xv?this._parseIMSC1(r,i):this._parseVTTs(e)}}else this.hls.trigger(Kh.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:new Error("Empty subtitle payload")})}_parseIMSC1(t,e){const r=this.hls;t_(e,this.initPTS[t.cc],(e=>{this._appendCues(e,t.level),r.trigger(Kh.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:t})}),(e=>{Zh.log(`Failed to parse IMSC1: ${e}`),r.trigger(Kh.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t,error:e})}))}_parseVTTs(t){var e;const{frag:r,payload:i}=t,{initPTS:s,unparsedVttFrags:n}=this,o=s.length-1;if(!s[r.cc]&&-1===o)return void n.push(t);const a=this.hls;Yv(null!=(e=r.initSegment)&&e.data?gp(r.initSegment.data,new Uint8Array(i)):i,this.initPTS[r.cc],this.vttCCs,r.cc,r.start,(t=>{this._appendCues(t,r.level),a.trigger(Kh.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:r})}),(e=>{const s="Missing initPTS for VTT MPEGTS"===e.message;s?n.push(t):this._fallbackToIMSC1(r,i),Zh.log(`Failed to parse VTT cue: ${e}`),s&&o>r.cc||a.trigger(Kh.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:e})}))}_fallbackToIMSC1(t,e){const r=this.tracks[t.level];r.textCodec||t_(e,this.initPTS[t.cc],(()=>{r.textCodec=Xv,this._parseIMSC1(t,e)}),(()=>{r.textCodec="wvtt"}))}_appendCues(t,e){const r=this.hls;if(this.config.renderTextTracksNatively){const r=this.textTracks[e];if(!r||"disabled"===r.mode)return;t.forEach((t=>dg(r,t)))}else{const i=this.tracks[e];if(!i)return;const s=i.default?"default":"subtitles"+e;r.trigger(Kh.CUES_PARSED,{type:"subtitles",cues:t,track:s})}}onFragDecrypted(t,e){const{frag:r}=e;r.type===og&&this.onFragLoaded(Kh.FRAG_LOADED,e)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(t,e){this.initCea608Parsers();const{cea608Parser1:r,cea608Parser2:i}=this;if(!this.enabled||!r||!i)return;const{frag:s,samples:n}=e;if(s.type!==sg||"NONE"!==this.closedCaptionsForLevel(s))for(let t=0;tfg(t[i],e,r)))}if(this.config.renderTextTracksNatively&&0===e&&void 0!==i){const{textTracks:t}=this;Object.keys(t).forEach((r=>fg(t[r],e,i)))}}}extractCea608Data(t){const e=[[],[]],r=31&t[0];let i=2;for(let s=0;s0&&-1===t?(this.log(`Override startPosition with lastCurrentTime @${e.toFixed(3)}`),t=e,this.state=Hm):(this.loadedmetadata=!1,this.state=zm),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()}doTick(){switch(this.state){case Hm:this.doTickIdle();break;case zm:{var t;const{levels:e,trackId:r}=this,i=null==e||null==(t=e[r])?void 0:t.details;if(i){if(this.waitForCdnTuneIn(i))break;this.state=Zm}break}case Wm:{var e;const t=performance.now(),r=this.retryDate;if(!r||t>=r||null!=(e=this.media)&&e.seeking){const{levels:t,trackId:e}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((null==t?void 0:t[e])||null),this.state=Hm}break}case Zm:{const t=this.waitingData;if(t){const{frag:e,part:r,cache:i,complete:s}=t;if(void 0!==this.initPTS[e.cc]){this.waitingData=null,this.waitingVideoCC=-1,this.state=Km;const t={frag:e,part:r,payload:i.flush(),networkDetails:null};this._handleFragmentLoadProgress(t),s&&super._handleFragmentLoadComplete(t)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log(`Waiting fragment cc (${e.cc}) cancelled because video is at cc ${this.videoTrackCC}`),this.clearWaitingFragment();else{const t=this.getLoadPosition(),r=Dm.bufferInfo(this.mediaBuffer,t,this.config.maxBufferHole);jg(r.end,this.config.maxFragLookUpTolerance,e)<0&&(this.log(`Waiting fragment cc (${e.cc}) @ ${e.start} cancelled because another fragment at ${r.end} is needed`),this.clearWaitingFragment())}}else this.state=Hm}}this.onTickEnd()}clearWaitingFragment(){const t=this.waitingData;t&&(this.fragmentTracker.removeFragment(t.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=Hm)}resetLoadingState(){this.clearWaitingFragment(),super.resetLoadingState()}onTickEnd(){const{media:t}=this;null!=t&&t.readyState&&(this.lastCurrentTime=t.currentTime)}doTickIdle(){const{hls:t,levels:e,media:r,trackId:i}=this,s=t.config;if(!r&&(this.startFragRequested||!s.startFragPrefetch)||null==e||!e[i])return;const n=e[i],o=n.details;if(!o||o.live&&this.levelLastLoaded!==n||this.waitForCdnTuneIn(o))return void(this.state=zm);const a=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&a&&(this.bufferFlushed=!1,this.afterBufferFlushed(a,of,ng));const l=this.getFwdBufferInfo(a,ng);if(null===l)return;const{bufferedTrack:c,switchingTrack:u}=this;if(!u&&this._streamEnded(l,o))return t.trigger(Kh.BUFFER_EOS,{type:"audio"}),void(this.state=Xm);const d=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,sg),h=l.len,f=this.getMaxBufferLength(null==d?void 0:d.len),p=o.fragments,g=p[0].start;let m=this.flushing?this.getLoadPosition():l.end;if(u&&r){const t=this.getLoadPosition();c&&!cv(u.attrs,c.attrs)&&(m=t),o.PTSKnown&&tg||l.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),r.currentTime=g+.05)}if(h>=f&&!u&&md.end+o.targetduration;if(_||(null==d||!d.len)&&l.len){const t=this.getAppendedFrag(y.start,sg);if(null===t)return;if(v||(v=!!t.gap||!!_&&0===d.len),_&&!v||v&&l.nextStart&&l.nextStartnew Rg(t)))}onAudioTrackSwitching(t,e){const r=!!e.url;this.trackId=e.id;const{fragCurrent:i}=this;i&&(i.abortRequests(),this.removeUnbufferedFrags(i.start)),this.resetLoadingState(),r?this.setInterval(100):this.resetTransmuxer(),r?(this.switchingTrack=e,this.state=Hm,this.flushAudioIfNeeded(e)):(this.switchingTrack=null,this.bufferedTrack=e,this.state=Gm),this.tick()}onManifestLoading(){this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=this.flushing=!1,this.levels=this.mainDetails=this.waitingData=this.bufferedTrack=this.cachedTrackLoadedData=this.switchingTrack=null,this.startFragRequested=!1,this.trackId=this.videoTrackCC=this.waitingVideoCC=-1}onLevelLoaded(t,e){this.mainDetails=e.details,null!==this.cachedTrackLoadedData&&(this.hls.trigger(Kh.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)}onAudioTrackLoaded(t,e){var r;if(null==this.mainDetails)return void(this.cachedTrackLoadedData=e);const{levels:i}=this,{details:s,id:n}=e;if(!i)return void this.warn(`Audio tracks were reset while loading level ${n}`);this.log(`Audio track ${n} loaded [${s.startSN},${s.endSN}]${s.lastPartSn?`[part-${s.lastPartSn}-${s.lastPartIndex}]`:""},duration:${s.totalduration}`);const o=i[n];let a=0;if(s.live||null!=(r=o.details)&&r.live){this.checkLiveUpdate(s);const t=this.mainDetails;if(s.deltaUpdateFailed||!t)return;var l;if(!o.details&&s.hasProgramDateTime&&t.hasProgramDateTime)Rm(s,t),a=s.fragments[0].start;else a=this.alignPlaylists(s,o.details,null==(l=this.levelLastLoaded)?void 0:l.details)}o.details=s,this.levelLastLoaded=o,this.startFragRequested||!this.mainDetails&&s.live||this.setStartPosition(this.mainDetails||s,a),this.state!==zm||this.waitForCdnTuneIn(s)||(this.state=Hm),this.tick()}_handleFragmentLoadProgress(t){var e;const{frag:r,part:i,payload:s}=t,{config:n,trackId:o,levels:a}=this;if(!a)return void this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${r.sn} of level ${r.level} will not be buffered`);const l=a[o];if(!l)return void this.warn("Audio track is undefined on fragment load progress");const c=l.details;if(!c)return this.warn("Audio track details undefined on fragment load progress"),void this.removeUnbufferedFrags(r.start);const u=n.defaultAudioCodec||l.audioCodec||"mp4a.40.2";let d=this.transmuxer;d||(d=this.transmuxer=new av(this.hls,ng,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const h=this.initPTS[r.cc],f=null==(e=r.initSegment)?void 0:e.data;if(void 0!==h){const t=!1,e=i?i.index:-1,n=-1!==e,o=new Lm(r.level,r.sn,r.stats.chunkCount,s.byteLength,e,n);d.push(s,f,u,"",r,i,c.totalduration,t,o,h)}else{this.log(`Unknown video PTS for cc ${r.cc}, waiting for video PTS before demuxing audio frag ${r.sn} of [${c.startSN} ,${c.endSN}],track ${o}`);const{cache:t}=this.waitingData=this.waitingData||{frag:r,part:i,cache:new ey,complete:!1};t.push(new Uint8Array(s)),this.waitingVideoCC=this.videoTrackCC,this.state=Zm}}_handleFragmentLoadComplete(t){this.waitingData?this.waitingData.complete=!0:super._handleFragmentLoadComplete(t)}onBufferReset(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1}onBufferCreated(t,e){const r=e.tracks.audio;r&&(this.mediaBuffer=r.buffer||null),e.tracks.video&&(this.videoBuffer=e.tracks.video.buffer||null)}onFragBuffered(t,e){const{frag:r,part:i}=e;if(r.type===ng)if(this.fragContextChanged(r))this.warn(`Fragment ${r.sn}${i?" p: "+i.index:""} of level ${r.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);else{if("initSegment"!==r.sn){this.fragPrevious=r;const t=this.switchingTrack;t&&(this.bufferedTrack=t,this.switchingTrack=null,this.hls.trigger(Kh.AUDIO_TRACK_SWITCHED,Bh({},t)))}this.fragBufferedComplete(r,i)}else if(!this.loadedmetadata&&r.type===sg){const t=this.videoBuffer||this.media;if(t){Dm.getBuffered(t).length&&(this.loadedmetadata=!0)}}}onError(t,e){var r;if(e.fatal)this.state=Qm;else switch(e.details){case zh.FRAG_GAP:case zh.FRAG_PARSING_ERROR:case zh.FRAG_DECRYPT_ERROR:case zh.FRAG_LOAD_ERROR:case zh.FRAG_LOAD_TIMEOUT:case zh.KEY_LOAD_ERROR:case zh.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(ng,e);break;case zh.AUDIO_TRACK_LOAD_ERROR:case zh.AUDIO_TRACK_LOAD_TIMEOUT:case zh.LEVEL_PARSING_ERROR:e.levelRetry||this.state!==zm||(null==(r=e.context)?void 0:r.type)!==rg||(this.state=Hm);break;case zh.BUFFER_APPEND_ERROR:case zh.BUFFER_FULL_ERROR:if(!e.parent||"audio"!==e.parent)return;if(e.details===zh.BUFFER_APPEND_ERROR)return void this.resetLoadingState();this.reduceLengthAndFlushBuffer(e)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case zh.INTERNAL_EXCEPTION:this.recoverWorkerError(e)}}onBufferFlushing(t,{type:e}){e!==af&&(this.flushing=!0)}onBufferFlushed(t,{type:e}){if(e!==af){this.flushing=!1,this.bufferFlushed=!0,this.state===Xm&&(this.state=Hm);const t=this.mediaBuffer||this.media;t&&(this.afterBufferFlushed(t,e,ng),this.tick())}}_handleTransmuxComplete(t){var e;const r="audio",{hls:i}=this,{remuxResult:s,chunkMeta:n}=t,o=this.getCurrentContext(n);if(!o)return void this.resetWhenMissingContext(n);const{frag:a,part:l,level:c}=o,{details:u}=c,{audio:d,text:h,id3:f,initSegment:p}=s;if(!this.fragContextChanged(a)&&u){if(this.state=jm,this.switchingTrack&&d&&this.completeAudioSwitch(this.switchingTrack),null!=p&&p.tracks){const t=a.initSegment||a;this._bufferInitSegment(c,p.tracks,t,n),i.trigger(Kh.FRAG_PARSING_INIT_SEGMENT,{frag:t,id:r,tracks:p.tracks})}if(d){const{startPTS:t,endPTS:e,startDTS:r,endDTS:i}=d;l&&(l.elementaryStreams[of]={startPTS:t,endPTS:e,startDTS:r,endDTS:i}),a.setElementaryStreamInfo(of,t,e,r,i),this.bufferFragmentData(d,a,l,n)}if(null!=f&&null!=(e=f.samples)&&e.length){const t=qh({id:r,frag:a,details:u},f);i.trigger(Kh.FRAG_PARSING_METADATA,t)}if(h){const t=qh({id:r,frag:a,details:u},h);i.trigger(Kh.FRAG_PARSING_USERDATA,t)}}else this.fragmentTracker.removeFragment(a)}_bufferInitSegment(t,e,r,i){if(this.state!==jm)return;e.video&&delete e.video;const s=e.audio;if(!s)return;s.id="audio";const n=t.audioCodec;this.log(`Init audio buffer, container:${s.container}, codecs[level/parsed]=[${n}/${s.codec}]`),n&&1===n.split(",").length&&(s.levelCodec=n),this.hls.trigger(Kh.BUFFER_CODECS,e);const o=s.initSegment;if(null!=o&&o.byteLength){const t={type:"audio",frag:r,part:null,chunkMeta:i,parent:r.type,data:o};this.hls.trigger(Kh.BUFFER_APPENDING,t)}this.tickImmediate()}loadFragment(t,e,r){const i=this.fragmentTracker.getState(t);var s;if(this.fragCurrent=t,this.switchingTrack||i===ym||i===_m)if("initSegment"===t.sn)this._loadInitSegment(t,e);else if(null!=(s=e.details)&&s.live&&!this.initPTS[t.cc]){this.log(`Waiting for video PTS in continuity counter ${t.cc} of live stream before loading audio fragment ${t.sn} of level ${this.trackId}`),this.state=Zm;const r=this.mainDetails;r&&r.fragments[0].start!==e.details.fragments[0].start&&Rm(e.details,r)}else this.startFragRequested=!0,super.loadFragment(t,e,r);else this.clearTrackerIfNeeded(t)}flushAudioIfNeeded(t){const{media:e,bufferedTrack:r}=this,i=null==r?void 0:r.attrs,s=t.attrs;e&&i&&(i.CHANNELS!==s.CHANNELS||r.name!==t.name||r.lang!==t.lang)&&(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null)}completeAudioSwitch(t){const{hls:e}=this;this.flushAudioIfNeeded(t),this.bufferedTrack=t,this.switchingTrack=null,e.trigger(Kh.AUDIO_TRACK_SWITCHED,Bh({},t))}},audioTrackController:class extends im{constructor(t){super(t,"[audio-track-controller]"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:t}=this;t.on(Kh.MANIFEST_LOADING,this.onManifestLoading,this),t.on(Kh.MANIFEST_PARSED,this.onManifestParsed,this),t.on(Kh.LEVEL_LOADING,this.onLevelLoading,this),t.on(Kh.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(Kh.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(Kh.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t.off(Kh.MANIFEST_LOADING,this.onManifestLoading,this),t.off(Kh.MANIFEST_PARSED,this.onManifestParsed,this),t.off(Kh.LEVEL_LOADING,this.onLevelLoading,this),t.off(Kh.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(Kh.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(Kh.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(t,e){this.tracks=e.audioTracks||[]}onAudioTrackLoaded(t,e){const{id:r,groupId:i,details:s}=e,n=this.tracksInGroup[r];if(!n||n.groupId!==i)return void this.warn(`Audio track with id:${r} and group:${i} not found in active group ${null==n?void 0:n.groupId}`);const o=n.details;n.details=e.details,this.log(`Audio track ${r} "${n.name}" lang:${n.lang} group:${i} loaded [${s.startSN}-${s.endSN}]`),r===this.trackId&&this.playlistLoaded(r,e,o)}onLevelLoading(t,e){this.switchLevel(e.level)}onLevelSwitching(t,e){this.switchLevel(e.level)}switchLevel(t){const e=this.hls.levels[t];if(!e)return;const r=e.audioGroups||null,i=this.groupIds;let s=this.currentTrack;if(!r||(null==i?void 0:i.length)!==(null==r?void 0:r.length)||null!=r&&r.some((t=>-1===(null==i?void 0:i.indexOf(t))))){this.groupIds=r,this.trackId=-1,this.currentTrack=null;const t=this.tracks.filter((t=>!r||-1!==r.indexOf(t.groupId)));if(t.length)this.selectDefaultTrack&&!t.some((t=>t.default))&&(this.selectDefaultTrack=!1),t.forEach(((t,e)=>{t.id=e}));else if(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=t;const e=this.hls.config.audioPreference;if(!s&&e){const r=hm(e,t,pm);if(r>-1)s=t[r];else{const t=hm(e,this.tracks);s=this.tracks[t]}}let i=this.findTrackId(s);-1===i&&s&&(i=this.findTrackId(null));const o={audioTracks:t};this.log(`Updating audio tracks, ${t.length} track(s) found in group(s): ${null==r?void 0:r.join(",")}`),this.hls.trigger(Kh.AUDIO_TRACKS_UPDATED,o);const a=this.trackId;if(-1!==i&&-1===a)this.setAudioTrack(i);else if(t.length&&-1===a){var n;const e=new Error(`No audio track selected for current audio group-ID(s): ${null==(n=this.groupIds)?void 0:n.join(",")} track count: ${t.length}`);this.warn(e.message),this.hls.trigger(Kh.ERROR,{type:Wh.MEDIA_ERROR,details:zh.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:e})}}else this.shouldReloadPlaylist(s)&&this.setAudioTrack(this.trackId)}onError(t,e){!e.fatal&&e.context&&(e.context.type!==rg||e.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(e.context.groupId)||(this.requestScheduled=-1,this.checkRetry(e)))}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(t){this.selectDefaultTrack=!1,this.setAudioTrack(t)}setAudioOption(t){const e=this.hls;if(e.config.audioPreference=t,t){const r=this.allAudioTracks;if(this.selectDefaultTrack=!1,r.length){const i=this.currentTrack;if(i&&fm(t,i,pm))return i;const s=hm(t,this.tracksInGroup,pm);if(s>-1){const t=this.tracksInGroup[s];return this.setAudioTrack(s),t}if(i){let i=e.loadLevel;-1===i&&(i=e.firstAutoLevel);const s=function(t,e,r,i,s){const n=e[i],o=e.reduce(((t,e,r)=>{const i=e.uri;return(t[i]||(t[i]=[])).push(r),t}),{}),a=o[n.uri];a.length>1&&(i=Math.max.apply(Math,a));const l=n.videoRange,c=n.frameRate,u=n.codecSet.substring(0,4),d=gm(e,i,(e=>{if(e.videoRange!==l||e.frameRate!==c||e.codecSet.substring(0,4)!==u)return!1;const i=e.audioGroups,n=r.filter((t=>!i||-1!==i.indexOf(t.groupId)));return hm(t,n,s)>-1}));return d>-1?d:gm(e,i,(e=>{const i=e.audioGroups,n=r.filter((t=>!i||-1!==i.indexOf(t.groupId)));return hm(t,n,s)>-1}))}(t,e.levels,r,i,pm);if(-1===s)return null;e.nextLoadLevel=s}if(t.channels||t.audioCodec){const e=hm(t,r);if(e>-1)return r[e]}}}return null}setAudioTrack(t){const e=this.tracksInGroup;if(t<0||t>=e.length)return void this.warn(`Invalid audio track id: ${t}`);this.clearTimer(),this.selectDefaultTrack=!1;const r=this.currentTrack,i=e[t],s=i.details&&!i.details.live;if(t===this.trackId&&i===r&&s)return;if(this.log(`Switching to audio-track ${t} "${i.name}" lang:${i.lang} group:${i.groupId} channels:${i.channels}`),this.trackId=t,this.currentTrack=i,this.hls.trigger(Kh.AUDIO_TRACK_SWITCHING,Bh({},i)),s)return;const n=this.switchParams(i.url,null==r?void 0:r.details,i.details);this.loadPlaylist(n)}findTrackId(t){const e=this.tracksInGroup;for(let r=0;r{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=t=>{try{this.apply(t,{ot:f_.MANIFEST,su:!this.initialized})}catch(t){Zh.warn("Could not generate manifest CMCD data.",t)}},this.applyFragmentData=t=>{try{const e=t.frag,r=this.hls.levels[e.level],i=this.getObjectType(e),s={d:1e3*e.duration,ot:i};i!==f_.VIDEO&&i!==f_.AUDIO&&i!=f_.MUXED||(s.br=r.bitrate/1e3,s.tb=this.getTopBandwidth(i)/1e3,s.bl=this.getBufferLength(i)),this.apply(t,s)}catch(t){Zh.warn("Could not generate segment CMCD data.",t)}},this.hls=t;const e=this.config=t.config,{cmcd:r}=e;null!=r&&(e.pLoader=this.createPlaylistLoader(),e.fLoader=this.createFragmentLoader(),this.sid=r.sessionId||function(){try{return crypto.randomUUID()}catch(t){try{const t=URL.createObjectURL(new Blob),e=t.toString();return URL.revokeObjectURL(t),e.slice(e.lastIndexOf("/")+1)}catch(t){let e=(new Date).getTime();const r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(t=>{const r=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"==t?r:3&r|8).toString(16)}));return r}}}(),this.cid=r.contentId,this.useHeaders=!0===r.useHeaders,this.includeKeys=r.includeKeys,this.registerListeners())}registerListeners(){const t=this.hls;t.on(Kh.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(Kh.MEDIA_DETACHED,this.onMediaDetached,this),t.on(Kh.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const t=this.hls;t.off(Kh.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(Kh.MEDIA_DETACHED,this.onMediaDetached,this),t.off(Kh.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=null}onMediaAttached(t,e){this.media=e.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(t,e){var r,i;this.audioBuffer=null==(r=e.tracks.audio)?void 0:r.buffer,this.videoBuffer=null==(i=e.tracks.video)?void 0:i.buffer}createData(){var t;return{v:1,sf:p_.HLS,sid:this.sid,cid:this.cid,pr:null==(t=this.media)?void 0:t.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(t,e={}){qh(e,this.createData());const r=e.ot===f_.INIT||e.ot===f_.VIDEO||e.ot===f_.MUXED;this.starved&&r&&(e.bs=!0,e.su=!0,this.starved=!1),null==e.su&&(e.su=this.buffering);const{includeKeys:i}=this;i&&(e=Object.keys(e).reduce(((t,r)=>(i.includes(r)&&(t[r]=e[r]),t)),{})),this.useHeaders?(t.headers||(t.headers={}),B_(t.headers,e)):t.url=$_(t.url,e)}getObjectType(t){const{type:e}=t;return"subtitle"===e?f_.TIMED_TEXT:"initSegment"===t.sn?f_.INIT:"audio"===e?f_.AUDIO:"main"===e?this.hls.audioTracks.length?f_.VIDEO:f_.MUXED:void 0}getTopBandwidth(t){let e,r=0;const i=this.hls;if(t===f_.AUDIO)e=i.audioTracks;else{const t=i.maxAutoLevel,r=t>-1?t+1:i.levels.length;e=i.levels.slice(0,r)}for(const t of e)t.bitrate>r&&(r=t.bitrate);return r>0?r:NaN}getBufferLength(t){const e=this.hls.media,r=t===f_.AUDIO?this.audioBuffer:this.videoBuffer;if(!r||!e)return NaN;return 1e3*Dm.bufferInfo(r,e.currentTime,this.config.maxBufferHole).len}createPlaylistLoader(){const{pLoader:t}=this.config,e=this.applyPlaylistData,r=t||this.config.loader;return class{constructor(t){this.loader=void 0,this.loader=new r(t)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(t,r,i){e(t),this.loader.load(t,r,i)}}}createFragmentLoader(){const{fLoader:t}=this.config,e=this.applyFragmentData,r=t||this.config.loader;return class{constructor(t){this.loader=void 0,this.loader=new r(t)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(t,r,i){e(t),this.loader.load(t,r,i)}}}},contentSteeringController:class{constructor(t){this.hls=void 0,this.log=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this.pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=t,this.log=Zh.log.bind(Zh,"[content-steering]:"),this.registerListeners()}registerListeners(){const t=this.hls;t.on(Kh.MANIFEST_LOADING,this.onManifestLoading,this),t.on(Kh.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(Kh.MANIFEST_PARSED,this.onManifestParsed,this),t.on(Kh.ERROR,this.onError,this)}unregisterListeners(){const t=this.hls;t&&(t.off(Kh.MANIFEST_LOADING,this.onManifestLoading,this),t.off(Kh.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(Kh.MANIFEST_PARSED,this.onManifestParsed,this),t.off(Kh.ERROR,this.onError,this))}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const t=1e3*this.timeToLoad-(performance.now()-this.updated);if(t>0)return void this.scheduleRefresh(this.uri,t)}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){-1!==this.reloadTimer&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(t){const e=this.levels;e&&(this.levels=e.filter((e=>e!==t)))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(t,e){const{contentSteering:r}=e;null!==r&&(this.pathwayId=r.pathwayId,this.uri=r.uri,this.started&&this.startLoad())}onManifestParsed(t,e){this.audioTracks=e.audioTracks,this.subtitleTracks=e.subtitleTracks}onError(t,e){const{errorAction:r}=e;if((null==r?void 0:r.action)===Qg&&r.flags===em){const t=this.levels;let i=this.pathwayPriority,s=this.pathwayId;if(e.context){const{groupId:r,pathwayId:i,type:n}=e.context;r&&t?s=this.getPathwayForGroupId(r,n,s):i&&(s=i)}s in this.penalizedPathways||(this.penalizedPathways[s]=performance.now()),!i&&t&&(i=t.reduce(((t,e)=>(-1===t.indexOf(e.pathwayId)&&t.push(e.pathwayId),t)),[])),i&&i.length>1&&(this.updatePathwayPriority(i),r.resolved=this.pathwayId!==s),r.resolved||Zh.warn(`Could not resolve ${e.details} ("${e.error.message}") with content-steering for Pathway: ${s} levels: ${t?t.length:t} priorities: ${JSON.stringify(i)} penalized: ${JSON.stringify(this.penalizedPathways)}`)}}filterParsedLevels(t){this.levels=t;let e=this.getLevelsForPathway(this.pathwayId);if(0===e.length){const r=t[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${r}"`),e=this.getLevelsForPathway(r),this.pathwayId=r}return e.length!==t.length&&this.log(`Found ${e.length}/${t.length} levels in Pathway "${this.pathwayId}"`),e}getLevelsForPathway(t){return null===this.levels?[]:this.levels.filter((e=>t===e.pathwayId))}updatePathwayPriority(t){let e;this.pathwayPriority=t;const r=this.penalizedPathways,i=performance.now();Object.keys(r).forEach((t=>{i-r[t]>3e5&&delete r[t]}));for(let i=0;i0){this.log(`Setting Pathway to "${s}"`),this.pathwayId=s,$g(e),this.hls.trigger(Kh.LEVELS_UPDATED,{levels:e});const t=this.hls.levels[n];o&&t&&this.levels&&(t.attrs["STABLE-VARIANT-ID"]!==o.attrs["STABLE-VARIANT-ID"]&&t.bitrate!==o.bitrate&&this.log(`Unstable Pathways change from bitrate ${o.bitrate} to ${t.bitrate}`),this.hls.nextLoadLevel=n);break}}}getPathwayForGroupId(t,e,r){const i=this.getLevelsForPathway(r).concat(this.levels||[]);for(let r=0;r{const{ID:s,"BASE-ID":n,"URI-REPLACEMENT":o}=t;if(e.some((t=>t.pathwayId===s)))return;const a=this.getLevelsForPathway(n).map((t=>{const e=new ef(t.attrs);e["PATHWAY-ID"]=s;const n=e.AUDIO&&`${e.AUDIO}_clone_${s}`,a=e.SUBTITLES&&`${e.SUBTITLES}_clone_${s}`;n&&(r[e.AUDIO]=n,e.AUDIO=n),a&&(i[e.SUBTITLES]=a,e.SUBTITLES=a);const l=G_(t.uri,e["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",o),c=new Rg({attrs:e,audioCodec:t.audioCodec,bitrate:t.bitrate,height:t.height,name:t.name,url:l,videoCodec:t.videoCodec,width:t.width});if(t.audioGroups)for(let e=1;e{this.log(`Loaded steering manifest: "${i}"`);const n=t.data;if(1!==n.VERSION)return void this.log(`Steering VERSION ${n.VERSION} not supported!`);this.updated=performance.now(),this.timeToLoad=n.TTL;const{"RELOAD-URI":o,"PATHWAY-CLONES":a,"PATHWAY-PRIORITY":l}=n;if(o)try{this.uri=new self.URL(o,i).href}catch(t){return this.enabled=!1,void this.log(`Failed to parse Steering Manifest RELOAD-URI: ${o}`)}this.scheduleRefresh(this.uri||r.url),a&&this.clonePathways(a);const c={steeringManifest:n,url:i.toString()};this.hls.trigger(Kh.STEERING_MANIFEST_LOADED,c),l&&this.updatePathwayPriority(l)},onError:(t,e,r,i)=>{if(this.log(`Error loading steering manifest: ${t.code} ${t.text} (${e.url})`),this.stopLoad(),410===t.code)return this.enabled=!1,void this.log(`Steering manifest ${e.url} no longer available`);let s=1e3*this.timeToLoad;if(429!==t.code)this.scheduleRefresh(this.uri||e.url,s);else{const t=this.loader;if("function"==typeof(null==t?void 0:t.getResponseHeader)){const e=t.getResponseHeader("Retry-After");e&&(s=1e3*parseFloat(e))}this.log(`Steering manifest ${e.url} rate limited`)}},onTimeout:(t,e,r)=>{this.log(`Timeout loading steering manifest (${e.url})`),this.scheduleRefresh(this.uri||e.url)}};this.log(`Requesting steering manifest: ${i}`),this.loader.load(s,a,l)}scheduleRefresh(t,e=1e3*this.timeToLoad){this.clearTimeout(),this.reloadTimer=self.setTimeout((()=>{var e;const r=null==(e=this.hls)?void 0:e.media;!r||r.ended?this.scheduleRefresh(t,1e3*this.timeToLoad):this.loadSteeringManifest(t)}),e)}}});function Z_(t){return t&&"object"==typeof t?Array.isArray(t)?t.map(Z_):Object.keys(t).reduce(((e,r)=>(e[r]=Z_(t[r]),e)),{}):t}function J_(t){const e=t.loader;if(e!==W_&&e!==V_)Zh.log("[config]: Custom loader detected, cannot enable progressive streaming"),t.progressive=!1;else{(function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(t){}return!1})()&&(t.loader=W_,t.progressive=!0,t.enableSoftwareAES=!0,Zh.log("[config]: Progressive streaming enabled, using FetchLoader"))}}let tE;class eE extends im{constructor(t,e){super(t,"[level-controller]"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=e,this._registerListeners()}_registerListeners(){const{hls:t}=this;t.on(Kh.MANIFEST_LOADING,this.onManifestLoading,this),t.on(Kh.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(Kh.LEVEL_LOADED,this.onLevelLoaded,this),t.on(Kh.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(Kh.FRAG_BUFFERED,this.onFragBuffered,this),t.on(Kh.ERROR,this.onError,this)}_unregisterListeners(){const{hls:t}=this;t.off(Kh.MANIFEST_LOADING,this.onManifestLoading,this),t.off(Kh.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(Kh.LEVEL_LOADED,this.onLevelLoaded,this),t.off(Kh.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(Kh.FRAG_BUFFERED,this.onFragBuffered,this),t.off(Kh.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach((t=>{t.loadError=0,t.fragmentError=0})),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(t,e){this.resetLevels()}onManifestLoaded(t,e){const r=this.hls.config.preferManagedMediaSource,i=[],s={},n={};let o=!1,a=!1,l=!1;e.levels.forEach((t=>{var e,c;const u=t.attrs;let{audioCodec:d,videoCodec:h}=t;-1!==(null==(e=d)?void 0:e.indexOf("mp4a.40.34"))&&(tE||(tE=/chrome|firefox/i.test(navigator.userAgent)),tE&&(t.audioCodec=d=void 0)),d&&(t.audioCodec=d=Up(d,r)),0===(null==(c=h)?void 0:c.indexOf("avc1"))&&(h=t.videoCodec=function(t){const e=t.split(",");for(let t=0;t2){let i=r.shift()+".";i+=parseInt(r.shift()).toString(16),i+=("000"+parseInt(r.shift()).toString(16)).slice(-4),e[t]=i}}return e.join(",")}(h));const{width:f,height:p,unknownCodecs:g}=t;if(o||(o=!(!f||!p)),a||(a=!!h),l||(l=!!d),null!=g&&g.length||d&&!Pp(d,"audio",r)||h&&!Pp(h,"video",r))return;const{CODECS:m,"FRAME-RATE":y,"HDCP-LEVEL":v,"PATHWAY-ID":_,RESOLUTION:E,"VIDEO-RANGE":T}=u,w=`${`${_||"."}-`}${t.bitrate}-${E}-${y}-${m}-${T}-${v}`;if(s[w])if(s[w].uri===t.url||t.attrs["PATHWAY-ID"])s[w].addGroupId("audio",u.AUDIO),s[w].addGroupId("text",u.SUBTITLES);else{const e=n[w]+=1;t.attrs["PATHWAY-ID"]=new Array(e+1).join(".");const r=new Rg(t);s[w]=r,i.push(r)}else{const e=new Rg(t);s[w]=e,n[w]=1,i.push(e)}})),this.filterAndSortMediaOptions(i,e,o,a,l)}filterAndSortMediaOptions(t,e,r,i,s){let n=[],o=[],a=t;if((r||i)&&s&&(a=a.filter((({videoCodec:t,videoRange:e,width:r,height:i})=>{return(!!t||!(!r||!i))&&(!!(s=e)&&Dg.indexOf(s)>-1);var s}))),0===a.length)return void Promise.resolve().then((()=>{if(this.hls){e.levels.length&&this.warn(`One or more CODECS in variant not supported: ${JSON.stringify(e.levels[0].attrs)}`);const t=new Error("no level with compatible codecs found in manifest");this.hls.trigger(Kh.ERROR,{type:Wh.MEDIA_ERROR,details:zh.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:e.url,error:t,reason:t.message})}}));if(e.audioTracks){const{preferManagedMediaSource:t}=this.hls.config;n=e.audioTracks.filter((e=>!e.audioCodec||Pp(e.audioCodec,"audio",t))),rE(n)}e.subtitles&&(o=e.subtitles,rE(o));const l=a.slice(0);a.sort(((t,e)=>{if(t.attrs["HDCP-LEVEL"]!==e.attrs["HDCP-LEVEL"])return(t.attrs["HDCP-LEVEL"]||"")>(e.attrs["HDCP-LEVEL"]||"")?1:-1;if(r&&t.height!==e.height)return t.height-e.height;if(t.frameRate!==e.frameRate)return t.frameRate-e.frameRate;if(t.videoRange!==e.videoRange)return Dg.indexOf(t.videoRange)-Dg.indexOf(e.videoRange);if(t.videoCodec!==e.videoCodec){const r=Mp(t.videoCodec),i=Mp(e.videoCodec);if(r!==i)return i-r}if(t.uri===e.uri&&t.codecSet!==e.codecSet){const r=Op(t.codecSet),i=Op(e.codecSet);if(r!==i)return i-r}return t.averageBitrate!==e.averageBitrate?t.averageBitrate-e.averageBitrate:0}));let c=l[0];if(this.steering&&(a=this.steering.filterParsedLevels(a),a.length!==l.length))for(let t=0;tr&&r===Q_.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=t)}break}const d=s&&!i,h={levels:a,audioTracks:n,subtitleTracks:o,sessionData:e.sessionData,sessionKeys:e.sessionKeys,firstLevel:this._firstLevel,stats:e.stats,audio:s,video:i,altAudio:!d&&n.some((t=>!!t.url))};this.hls.trigger(Kh.MANIFEST_PARSED,h),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}get levels(){return 0===this._levels.length?null:this._levels}get level(){return this.currentLevelIndex}set level(t){const e=this._levels;if(0===e.length)return;if(t<0||t>=e.length){const r=new Error("invalid level idx"),i=t<0;if(this.hls.trigger(Kh.ERROR,{type:Wh.OTHER_ERROR,details:zh.LEVEL_SWITCH_ERROR,level:t,fatal:i,error:r,reason:r.message}),i)return;t=Math.min(t,e.length-1)}const r=this.currentLevelIndex,i=this.currentLevel,s=i?i.attrs["PATHWAY-ID"]:void 0,n=e[t],o=n.attrs["PATHWAY-ID"];if(this.currentLevelIndex=t,this.currentLevel=n,r===t&&n.details&&i&&s===o)return;this.log(`Switching to level ${t} (${n.height?n.height+"p ":""}${n.videoRange?n.videoRange+" ":""}${n.codecSet?n.codecSet+" ":""}@${n.bitrate})${o?" with Pathway "+o:""} from level ${r}${s?" with Pathway "+s:""}`);const a={level:t,attrs:n.attrs,details:n.details,bitrate:n.bitrate,averageBitrate:n.averageBitrate,maxBitrate:n.maxBitrate,realBitrate:n.realBitrate,width:n.width,height:n.height,codecSet:n.codecSet,audioCodec:n.audioCodec,videoCodec:n.videoCodec,audioGroups:n.audioGroups,subtitleGroups:n.subtitleGroups,loaded:n.loaded,loadError:n.loadError,fragmentError:n.fragmentError,name:n.name,id:n.id,uri:n.uri,url:n.url,urlId:0,audioGroupIds:n.audioGroupIds,textGroupIds:n.textGroupIds};this.hls.trigger(Kh.LEVEL_SWITCHING,a);const l=n.details;if(!l||l.live){const t=this.switchParams(n.uri,null==i?void 0:i.details,l);this.loadPlaylist(t)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(t){this.manualLevelIndex=t,void 0===this._startLevel&&(this._startLevel=t),-1!==t&&(this.level=t)}get firstLevel(){return this._firstLevel}set firstLevel(t){this._firstLevel=t}get startLevel(){if(void 0===this._startLevel){const t=this.hls.config.startLevel;return void 0!==t?t:this.hls.firstAutoLevel}return this._startLevel}set startLevel(t){this._startLevel=t}onError(t,e){!e.fatal&&e.context&&e.context.type===eg&&e.context.level===this.level&&this.checkRetry(e)}onFragBuffered(t,{frag:e}){if(void 0!==e&&e.type===sg){const t=e.elementaryStreams;if(!Object.keys(t).some((e=>!!t[e])))return;const r=this._levels[e.level];null!=r&&r.loadError&&(this.log(`Resetting level error count of ${r.loadError} on frag buffered`),r.loadError=0)}}onLevelLoaded(t,e){var r;const{level:i,details:s}=e,n=this._levels[i];var o;if(!n)return this.warn(`Invalid level index ${i}`),void(null!=(o=e.deliveryDirectives)&&o.skip&&(s.deltaUpdateFailed=!0));i===this.currentLevelIndex?(0===n.fragmentError&&(n.loadError=0),this.playlistLoaded(i,e,n.details)):null!=(r=e.deliveryDirectives)&&r.skip&&(s.deltaUpdateFailed=!0)}loadPlaylist(t){super.loadPlaylist();const e=this.currentLevelIndex,r=this.currentLevel;if(r&&this.shouldLoadPlaylist(r)){let i=r.uri;if(t)try{i=t.addDirectives(i)}catch(t){this.warn(`Could not construct new URL with HLS Delivery Directives: ${t}`)}const s=r.attrs["PATHWAY-ID"];this.log(`Loading level index ${e}${void 0!==(null==t?void 0:t.msn)?" at sn "+t.msn+" part "+t.part:""} with${s?" Pathway "+s:""} ${i}`),this.clearTimer(),this.hls.trigger(Kh.LEVEL_LOADING,{url:i,level:e,pathwayId:r.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}}get nextLoadLevel(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(t){this.level=t,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=t)}removeLevel(t){var e;const r=this._levels.filter(((e,r)=>r!==t||(this.steering&&this.steering.removeLevel(e),e===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,e.details&&e.details.fragments.forEach((t=>t.level=-1))),!1)));$g(r),this._levels=r,this.currentLevelIndex>-1&&null!=(e=this.currentLevel)&&e.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(Kh.LEVELS_UPDATED,{levels:r})}onLevelsUpdated(t,{levels:e}){this._levels=e}checkMaxAutoUpdated(){const{autoLevelCapping:t,maxAutoLevel:e,maxHdcpLevel:r}=this.hls;this._maxAutoLevel!==e&&(this._maxAutoLevel=e,this.hls.trigger(Kh.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:t,levels:this.levels,maxAutoLevel:e,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:r}))}}function rE(t){const e={};t.forEach((t=>{const r=t.groupId||"";t.id=e[r]=e[r]||0,e[r]++}))}class iE{constructor(t){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=t}abort(t){for(const r in this.keyUriToKeyInfo){const i=this.keyUriToKeyInfo[r].loader;if(i){var e;if(t&&t!==(null==(e=i.context)?void 0:e.frag.type))return;i.abort()}}}detach(){for(const t in this.keyUriToKeyInfo){const e=this.keyUriToKeyInfo[t];(e.mediaKeySessionContext||e.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[t]}}destroy(){this.detach();for(const t in this.keyUriToKeyInfo){const e=this.keyUriToKeyInfo[t].loader;e&&e.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(t,e=zh.KEY_LOAD_ERROR,r,i,s){return new Om({type:Wh.NETWORK_ERROR,details:e,fatal:!1,frag:t,response:s,error:r,networkDetails:i})}loadClear(t,e){if(this.emeController&&this.config.emeEnabled){const{sn:r,cc:i}=t;for(let t=0;t{s.setKeyFormat(t)}));break}}}}load(t){return!t.decryptdata&&t.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(t).then((e=>this.loadInternal(t,e))):this.loadInternal(t)}loadInternal(t,e){var r,i;e&&t.setKeyFormat(e);const s=t.decryptdata;if(!s){const r=new Error(e?`Expected frag.decryptdata to be defined after setting format ${e}`:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(t,zh.KEY_LOAD_ERROR,r))}const n=s.uri;if(!n)return Promise.reject(this.createKeyLoadError(t,zh.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${n}"`)));let o=this.keyUriToKeyInfo[n];if(null!=(r=o)&&r.decryptdata.key)return s.key=o.decryptdata.key,Promise.resolve({frag:t,keyInfo:o});var a;if(null!=(i=o)&&i.keyLoadPromise)switch(null==(a=o.mediaKeySessionContext)?void 0:a.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return o.keyLoadPromise.then((e=>(s.key=e.keyInfo.decryptdata.key,{frag:t,keyInfo:o})))}switch(o=this.keyUriToKeyInfo[n]={decryptdata:s,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},s.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return"identity"===s.keyFormat?this.loadKeyHTTP(o,t):this.loadKeyEME(o,t);case"AES-128":return this.loadKeyHTTP(o,t);default:return Promise.reject(this.createKeyLoadError(t,zh.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${s.method}"`)))}}loadKeyEME(t,e){const r={frag:e,keyInfo:t};if(this.emeController&&this.config.emeEnabled){const e=this.emeController.loadKey(r);if(e)return(t.keyLoadPromise=e.then((e=>(t.mediaKeySessionContext=e,r)))).catch((e=>{throw t.keyLoadPromise=null,e}))}return Promise.resolve(r)}loadKeyHTTP(t,e){const r=this.config,i=new(0,r.loader)(r);return e.keyLoader=t.loader=i,t.keyLoadPromise=new Promise(((s,n)=>{const o={keyInfo:t,frag:e,responseType:"arraybuffer",url:t.decryptdata.uri},a=r.keyLoadPolicy.default,l={loadPolicy:a,timeout:a.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},c={onSuccess:(t,e,r,i)=>{const{frag:o,keyInfo:a,url:l}=r;if(!o.decryptdata||a!==this.keyUriToKeyInfo[l])return n(this.createKeyLoadError(o,zh.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),i));a.decryptdata.key=o.decryptdata.key=new Uint8Array(t.data),o.keyLoader=null,a.loader=null,s({frag:o,keyInfo:a})},onError:(t,r,i,s)=>{this.resetLoader(r),n(this.createKeyLoadError(e,zh.KEY_LOAD_ERROR,new Error(`HTTP Error ${t.code} loading key ${t.text}`),i,Bh({url:o.url,data:void 0},t)))},onTimeout:(t,r,i)=>{this.resetLoader(r),n(this.createKeyLoadError(e,zh.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),i))},onAbort:(t,r,i)=>{this.resetLoader(r),n(this.createKeyLoadError(e,zh.INTERNAL_ABORTED,new Error("key loading aborted"),i))}};i.load(o,l,c)}))}resetLoader(t){const{frag:e,keyInfo:r,url:i}=t,s=r.loader;e.keyLoader===s&&(e.keyLoader=null,r.loader=null),delete this.keyUriToKeyInfo[i],s&&s.destroy()}}function sE(){return self.SourceBuffer||self.WebKitSourceBuffer}function nE(){if(!xp())return!1;const t=sE();return!t||t.prototype&&"function"==typeof t.prototype.appendBuffer&&"function"==typeof t.prototype.remove}class oE{constructor(t,e,r,i){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=t,this.media=e,this.fragmentTracker=r,this.hls=i}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(t,e){const{config:r,media:i,stalled:s}=this;if(null===i)return;const{currentTime:n,seeking:o}=i,a=this.seeking&&!o,l=!this.seeking&&o;if(this.seeking=o,n!==t){if(this.moved=!0,o||(this.nudgeRetry=0),null!==s){if(this.stallReported){const t=self.performance.now()-s;Zh.warn(`playback not stuck anymore @${n}, after ${Math.round(t)}ms`),this.stallReported=!1}this.stalled=null}return}if(l||a)return void(this.stalled=null);if(i.paused&&!o||i.ended||0===i.playbackRate||!Dm.getBuffered(i).length)return void(this.nudgeRetry=0);const c=Dm.bufferInfo(i,n,0),u=c.nextStart||0;if(o){const t=c.len>2,r=!u||e&&e.start<=n||u-n>2&&!this.fragmentTracker.getPartialFragment(n);if(t||r)return;this.moved=!1}if(!this.moved&&null!==this.stalled){var d;if(!(c.len>0)&&!u)return;const t=Math.max(u,c.start||0)-n,e=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,r=(null==e||null==(d=e.details)?void 0:d.live)?2*e.details.targetduration:2,s=this.fragmentTracker.getPartialFragment(n);if(t>0&&(t<=r||s))return void(i.paused||this._trySkipBufferHole(s))}const h=self.performance.now();if(null===s)return void(this.stalled=h);const f=h-s;if(!o&&f>=250&&(this._reportStall(c),!this.media))return;const p=Dm.bufferInfo(i,n,r.maxBufferHole);this._tryFixBufferStall(p,f)}_tryFixBufferStall(t,e){const{config:r,fragmentTracker:i,media:s}=this;if(null===s)return;const n=s.currentTime,o=i.getPartialFragment(n);if(o){if(this._trySkipBufferHole(o)||!this.media)return}(t.len>r.maxBufferHole||t.nextStart&&t.nextStart-n1e3*r.highBufferWatchdogPeriod&&(Zh.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(t){const{hls:e,media:r,stallReported:i}=this;if(!i&&r){this.stallReported=!0;const i=new Error(`Playback stalling at @${r.currentTime} due to low buffer (${JSON.stringify(t)})`);Zh.warn(i.message),e.trigger(Kh.ERROR,{type:Wh.MEDIA_ERROR,details:zh.BUFFER_STALLED_ERROR,fatal:!1,error:i,buffer:t.len})}}_trySkipBufferHole(t){const{config:e,hls:r,media:i}=this;if(null===i)return 0;const s=i.currentTime,n=Dm.bufferInfo(i,s,0),o=s0&&n.len<1&&i.readyState<3,c=o-s;if(c>0&&(a||l)){if(c>e.maxBufferHole){const{fragmentTracker:e}=this;let r=!1;if(0===s){const t=e.getAppendedFrag(0,sg);t&&o1?(t=0,this.bitrateTest=!0):t=r.firstAutoLevel),r.nextLoadLevel=t,this.level=r.loadLevel,this.loadedmetadata=!1}e>0&&-1===t&&(this.log(`Override startPosition with lastCurrentTime @${e.toFixed(3)}`),t=e),this.state=Hm,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()}else this._forceStartLoad=!0,this.state=Gm}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case Jm:{const{levels:t,level:e}=this,r=null==t?void 0:t[e],i=null==r?void 0:r.details;if(i&&(!i.live||this.levelLastLoaded===r)){if(this.waitForCdnTuneIn(i))break;this.state=Hm;break}if(this.hls.nextLoadLevel!==this.level){this.state=Hm;break}break}case Wm:{var t;const e=self.performance.now(),r=this.retryDate;if(!r||e>=r||null!=(t=this.media)&&t.seeking){const{levels:t,level:e}=this,r=null==t?void 0:t[e];this.resetStartWhenNotLoaded(r||null),this.state=Hm}}}this.state===Hm&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){const{hls:t,levelLastLoaded:e,levels:r,media:i}=this;if(null===e||!i&&(this.startFragRequested||!t.config.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;const s=t.nextLoadLevel;if(null==r||!r[s])return;const n=r[s],o=this.getMainFwdBufferInfo();if(null===o)return;const a=this.getLevelDetails();if(a&&this._streamEnded(o,a)){const t={};return this.altAudio&&(t.type="video"),this.hls.trigger(Kh.BUFFER_EOS,t),void(this.state=Xm)}t.loadLevel!==s&&-1===t.manualLevel&&this.log(`Adapting to level ${s} from level ${this.level}`),this.level=t.nextLoadLevel=s;const l=n.details;if(!l||this.state===Jm||l.live&&this.levelLastLoaded!==n)return this.level=s,void(this.state=Jm);const c=o.len,u=this.getMaxBufferLength(n.maxBitrate);if(c>=u)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);const d=this.backtrackFragment?this.backtrackFragment.start:o.end;let h=this.getNextFragment(d,l);if(this.couldBacktrack&&!this.fragPrevious&&h&&"initSegment"!==h.sn&&this.fragmentTracker.getState(h)!==Em){var f;const t=(null!=(f=this.backtrackFragment)?f:h).sn-l.startSN,e=l.fragments[t-1];e&&h.cc===e.cc&&(h=e,this.fragmentTracker.removeFragment(e))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(h&&this.isLoopLoading(h,d)){if(!h.gap){const t=this.audioOnly&&!this.altAudio?of:af,e=(t===af?this.videoBuffer:this.mediaBuffer)||this.media;e&&this.afterBufferFlushed(e,t,sg)}h=this.getNextFragmentLoopLoading(h,l,o,sg,u)}h&&(!h.initSegment||h.initSegment.data||this.bitrateTest||(h=h.initSegment),this.loadFragment(h,n,d))}loadFragment(t,e,r){const i=this.fragmentTracker.getState(t);this.fragCurrent=t,i===ym||i===_m?"initSegment"===t.sn?this._loadInitSegment(t,e):this.bitrateTest?(this.log(`Fragment ${t.sn} of level ${t.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(t,e)):(this.startFragRequested=!0,super.loadFragment(t,e,r)):this.clearTrackerIfNeeded(t)}getBufferedFrag(t){return this.fragmentTracker.getBufferedFrag(t,sg)}followingBufferedFrag(t){return t?this.getBufferedFrag(t.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:t,media:e}=this;if(null!=e&&e.readyState){let r;const i=this.getAppendedFrag(e.currentTime);i&&i.start>1&&this.flushMainBuffer(0,i.start-1);const s=this.getLevelDetails();if(null!=s&&s.live){const t=this.getMainFwdBufferInfo();if(!t||t.len<2*s.targetduration)return}if(!e.paused&&t){const e=t[this.hls.nextLoadLevel],i=this.fragLastKbps;r=i&&this.fragCurrent?this.fragCurrent.duration*e.maxBitrate/(1e3*i)+1:0}else r=0;const n=this.getBufferedFrag(e.currentTime+r);if(n){const t=this.followingBufferedFrag(n);if(t){this.abortCurrentFrag();const e=t.maxStartPTS?t.maxStartPTS:t.start,r=t.duration,i=Math.max(n.end,e+Math.min(Math.max(r-this.config.maxFragLookUpTolerance,r*(this.couldBacktrack?.5:.125)),r*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(i,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const t=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,t&&(t.abortRequests(),this.fragmentTracker.removeFragment(t)),this.state){case Vm:case Km:case Wm:case jm:case Ym:this.state=Hm}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(t,e){super.flushMainBuffer(t,e,this.altAudio?"video":null)}onMediaAttached(t,e){super.onMediaAttached(t,e);const r=e.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),r.addEventListener("playing",this.onvplaying),r.addEventListener("seeked",this.onvseeked),this.gapController=new oE(this.config,r,this.fragmentTracker,this.hls)}onMediaDetaching(){const{media:t}=this;t&&this.onvplaying&&this.onvseeked&&(t.removeEventListener("playing",this.onvplaying),t.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),super.onMediaDetaching()}onMediaPlaying(){this.tick()}onMediaSeeked(){const t=this.media,e=t?t.currentTime:null;Gh(e)&&this.log(`Media seeked to ${e.toFixed(3)}`);const r=this.getMainFwdBufferInfo();null!==r&&0!==r.len?this.tick():this.warn(`Main forward buffer length on "seeked" event ${r?r.len:"empty"})`)}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(Kh.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=this.fragLastKbps=0,this.levels=this.fragPlaying=this.backtrackFragment=this.levelLastLoaded=null,this.altAudio=this.audioOnly=this.startFragRequested=!1}onManifestParsed(t,e){let r=!1,i=!1;e.levels.forEach((t=>{const e=t.audioCodec;e&&(r=r||-1!==e.indexOf("mp4a.40.2"),i=i||-1!==e.indexOf("mp4a.40.5"))})),this.audioCodecSwitch=r&&i&&!function(){var t;const e=sE();return"function"==typeof(null==e||null==(t=e.prototype)?void 0:t.changeType)}(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=e.levels,this.startFragRequested=!1}onLevelLoading(t,e){const{levels:r}=this;if(!r||this.state!==Hm)return;const i=r[e.level];(!i.details||i.details.live&&this.levelLastLoaded!==i||this.waitForCdnTuneIn(i.details))&&(this.state=Jm)}onLevelLoaded(t,e){var r;const{levels:i}=this,s=e.level,n=e.details,o=n.totalduration;if(!i)return void this.warn(`Levels were reset while loading level ${s}`);this.log(`Level ${s} loaded [${n.startSN},${n.endSN}]${n.lastPartSn?`[part-${n.lastPartSn}-${n.lastPartIndex}]`:""}, cc [${n.startCC}, ${n.endCC}] duration:${o}`);const a=i[s],l=this.fragCurrent;!l||this.state!==Km&&this.state!==Wm||l.level!==e.level&&l.loader&&this.abortCurrentFrag();let c=0;if(n.live||null!=(r=a.details)&&r.live){var u;if(this.checkLiveUpdate(n),n.deltaUpdateFailed)return;c=this.alignPlaylists(n,a.details,null==(u=this.levelLastLoaded)?void 0:u.details)}if(a.details=n,this.levelLastLoaded=a,this.hls.trigger(Kh.LEVEL_UPDATED,{details:n,level:s}),this.state===Jm){if(this.waitForCdnTuneIn(n))return;this.state=Hm}this.startFragRequested?n.live&&this.synchronizeToLiveEdge(n):this.setStartPosition(n,c),this.tick()}_handleFragmentLoadProgress(t){var e;const{frag:r,part:i,payload:s}=t,{levels:n}=this;if(!n)return void this.warn(`Levels were reset while fragment load was in progress. Fragment ${r.sn} of level ${r.level} will not be buffered`);const o=n[r.level],a=o.details;if(!a)return this.warn(`Dropping fragment ${r.sn} of level ${r.level} after level details were reset`),void this.fragmentTracker.removeFragment(r);const l=o.videoCodec,c=a.PTSKnown||!a.live,u=null==(e=r.initSegment)?void 0:e.data,d=this._getAudioCodec(o),h=this.transmuxer=this.transmuxer||new av(this.hls,sg,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),f=i?i.index:-1,p=-1!==f,g=new Lm(r.level,r.sn,r.stats.chunkCount,s.byteLength,f,p),m=this.initPTS[r.cc];h.push(s,u,d,l,r,i,a.totalduration,c,g,m)}onAudioTrackSwitching(t,e){const r=this.altAudio;if(!!!e.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const t=this.fragCurrent;t&&(this.log("Switching to main audio track, cancel main fragment load"),t.abortRequests(),this.fragmentTracker.removeFragment(t)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();const t=this.hls;r&&(t.trigger(Kh.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),t.trigger(Kh.AUDIO_TRACK_SWITCHED,e)}}onAudioTrackSwitched(t,e){const r=e.id,i=!!this.hls.audioTracks[r].url;if(i){const t=this.videoBuffer;t&&this.mediaBuffer!==t&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=t)}this.altAudio=i,this.tick()}onBufferCreated(t,e){const r=e.tracks;let i,s,n=!1;for(const t in r){const e=r[t];if("main"===e.id){if(s=t,i=e,"video"===t){const e=r[t];e&&(this.videoBuffer=e.buffer)}}else n=!0}n&&i?(this.log(`Alternate track found, use ${s}.buffered to schedule main fragment loading`),this.mediaBuffer=i.buffer):this.mediaBuffer=this.media}onFragBuffered(t,e){const{frag:r,part:i}=e;if(r&&r.type!==sg)return;if(this.fragContextChanged(r))return this.warn(`Fragment ${r.sn}${i?" p: "+i.index:""} of level ${r.level} finished buffering, but was aborted. state: ${this.state}`),void(this.state===Ym&&(this.state=Hm));const s=i?i.stats:r.stats;this.fragLastKbps=Math.round(8*s.total/(s.buffering.end-s.loading.first)),"initSegment"!==r.sn&&(this.fragPrevious=r),this.fragBufferedComplete(r,i)}onError(t,e){var r;if(e.fatal)this.state=Qm;else switch(e.details){case zh.FRAG_GAP:case zh.FRAG_PARSING_ERROR:case zh.FRAG_DECRYPT_ERROR:case zh.FRAG_LOAD_ERROR:case zh.FRAG_LOAD_TIMEOUT:case zh.KEY_LOAD_ERROR:case zh.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(sg,e);break;case zh.LEVEL_LOAD_ERROR:case zh.LEVEL_LOAD_TIMEOUT:case zh.LEVEL_PARSING_ERROR:e.levelRetry||this.state!==Jm||(null==(r=e.context)?void 0:r.type)!==eg||(this.state=Hm);break;case zh.BUFFER_APPEND_ERROR:case zh.BUFFER_FULL_ERROR:if(!e.parent||"main"!==e.parent)return;if(e.details===zh.BUFFER_APPEND_ERROR)return void this.resetLoadingState();this.reduceLengthAndFlushBuffer(e)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case zh.INTERNAL_EXCEPTION:this.recoverWorkerError(e)}}checkBuffer(){const{media:t,gapController:e}=this;if(t&&e&&t.readyState){if(this.loadedmetadata||!Dm.getBuffered(t).length){const t=this.state!==Hm?this.fragCurrent:null;e.poll(this.lastCurrentTime,t)}this.lastCurrentTime=t.currentTime}}onFragLoadEmergencyAborted(){this.state=Hm,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(t,{type:e}){if(e!==of||this.audioOnly&&!this.altAudio){const t=(e===af?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(t,e,sg),this.tick()}}onLevelsUpdated(t,e){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level),this.levels=e.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:t}=this;if(!t)return;const e=t.currentTime;let r=this.startPosition;if(r>=0&&e0&&(s{const{hls:i}=this;if(!r||this.fragContextChanged(t))return;e.fragmentError=0,this.state=Hm,this.startFragRequested=!1,this.bitrateTest=!1;const s=t.stats;s.parsing.start=s.parsing.end=s.buffering.start=s.buffering.end=self.performance.now(),i.trigger(Kh.FRAG_LOADED,r),t.bitrateTest=!1}))}_handleTransmuxComplete(t){var e;const r="main",{hls:i}=this,{remuxResult:s,chunkMeta:n}=t,o=this.getCurrentContext(n);if(!o)return void this.resetWhenMissingContext(n);const{frag:a,part:l,level:c}=o,{video:u,text:d,id3:h,initSegment:f}=s,{details:p}=c,g=this.altAudio?void 0:s.audio;if(this.fragContextChanged(a))this.fragmentTracker.removeFragment(a);else{if(this.state=jm,f){if(null!=f&&f.tracks){const t=a.initSegment||a;this._bufferInitSegment(c,f.tracks,t,n),i.trigger(Kh.FRAG_PARSING_INIT_SEGMENT,{frag:t,id:r,tracks:f.tracks})}const t=f.initPTS,e=f.timescale;Gh(t)&&(this.initPTS[a.cc]={baseTime:t,timescale:e},i.trigger(Kh.INIT_PTS_FOUND,{frag:a,id:r,initPTS:t,timescale:e}))}if(u&&p&&"initSegment"!==a.sn){const t=p.fragments[a.sn-1-p.startSN],e=a.sn===p.startSN,r=!t||a.cc>t.cc;if(!1!==s.independent){const{startPTS:t,endPTS:i,startDTS:s,endDTS:o}=u;if(l)l.elementaryStreams[u.type]={startPTS:t,endPTS:i,startDTS:s,endDTS:o};else if(u.firstKeyFrame&&u.independent&&1===n.id&&!r&&(this.couldBacktrack=!0),u.dropped&&u.independent){const s=this.getMainFwdBufferInfo(),n=(s?s.end:this.getLoadPosition())+this.config.maxBufferHole,l=u.firstKeyFramePTS?u.firstKeyFramePTS:t;if(!e&&n2&&(a.gap=!0);a.setElementaryStreamInfo(u.type,t,i,s,o),this.backtrackFragment&&(this.backtrackFragment=a),this.bufferFragmentData(u,a,l,n,e||r)}else{if(!e&&!r)return void this.backtrack(a);a.gap=!0}}if(g){const{startPTS:t,endPTS:e,startDTS:r,endDTS:i}=g;l&&(l.elementaryStreams[of]={startPTS:t,endPTS:e,startDTS:r,endDTS:i}),a.setElementaryStreamInfo(of,t,e,r,i),this.bufferFragmentData(g,a,l,n)}if(p&&null!=h&&null!=(e=h.samples)&&e.length){const t={id:r,frag:a,details:p,samples:h.samples};i.trigger(Kh.FRAG_PARSING_METADATA,t)}if(p&&d){const t={id:r,frag:a,details:p,samples:d.samples};i.trigger(Kh.FRAG_PARSING_USERDATA,t)}}}_bufferInitSegment(t,e,r,i){if(this.state!==jm)return;this.audioOnly=!!e.audio&&!e.video,this.altAudio&&!this.audioOnly&&delete e.audio;const{audio:s,video:n,audiovideo:o}=e;if(s){let e=t.audioCodec;const r=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){e&&(e=-1!==e.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5");const t=s.metadata;t&&"channelCount"in t&&1!==(t.channelCount||1)&&-1===r.indexOf("firefox")&&(e="mp4a.40.5")}e&&-1!==e.indexOf("mp4a.40.5")&&-1!==r.indexOf("android")&&"audio/mpeg"!==s.container&&(e="mp4a.40.2",this.log(`Android: force audio codec to ${e}`)),t.audioCodec&&t.audioCodec!==e&&this.log(`Swapping manifest audio codec "${t.audioCodec}" for "${e}"`),s.levelCodec=e,s.id="main",this.log(`Init audio buffer, container:${s.container}, codecs[selected/level/parsed]=[${e||""}/${t.audioCodec||""}/${s.codec}]`)}n&&(n.levelCodec=t.videoCodec,n.id="main",this.log(`Init video buffer, container:${n.container}, codecs[level/parsed]=[${t.videoCodec||""}/${n.codec}]`)),o&&this.log(`Init audiovideo buffer, container:${o.container}, codecs[level/parsed]=[${t.codecs}/${o.codec}]`),this.hls.trigger(Kh.BUFFER_CODECS,e),Object.keys(e).forEach((t=>{const s=e[t].initSegment;null!=s&&s.byteLength&&this.hls.trigger(Kh.BUFFER_APPENDING,{type:t,data:s,frag:r,part:null,chunkMeta:i,parent:r.type})})),this.tickImmediate()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,sg)}backtrack(t){this.couldBacktrack=!0,this.backtrackFragment=t,this.resetTransmuxer(),this.flushBufferGap(t),this.fragmentTracker.removeFragment(t),this.fragPrevious=null,this.nextLoadPosition=t.start,this.state=Hm}checkFragmentChanged(){const t=this.media;let e=null;if(t&&t.readyState>1&&!1===t.seeking){const r=t.currentTime;if(Dm.isBuffered(t,r)?e=this.getAppendedFrag(r):Dm.isBuffered(t,r+.1)&&(e=this.getAppendedFrag(r+.1)),e){this.backtrackFragment=null;const t=this.fragPlaying,r=e.level;t&&e.sn===t.sn&&t.level===r||(this.fragPlaying=e,this.hls.trigger(Kh.FRAG_CHANGED,{frag:e}),t&&t.level===r||this.hls.trigger(Kh.LEVEL_SWITCHED,{level:r}))}}}get nextLevel(){const t=this.nextBufferedFrag;return t?t.level:-1}get currentFrag(){const t=this.media;return t?this.fragPlaying||this.getAppendedFrag(t.currentTime):null}get currentProgramDateTime(){const t=this.media;if(t){const e=t.currentTime,r=this.currentFrag;if(r&&Gh(e)&&Gh(r.programDateTime)){const t=r.programDateTime+1e3*(e-r.start);return new Date(t)}}return null}get currentLevel(){const t=this.currentFrag;return t?t.level:-1}get nextBufferedFrag(){const t=this.currentFrag;return t?this.followingBufferedFrag(t):null}get forceStartLoad(){return this._forceStartLoad}}class lE{static get version(){return"1.5.17"}static isMSESupported(){return nE()}static isSupported(){return function(){if(!nE())return!1;const t=xp();return"function"==typeof(null==t?void 0:t.isTypeSupported)&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some((e=>t.isTypeSupported(Fp(e,"video"))))||["mp4a.40.2","fLaC"].some((e=>t.isTypeSupported(Fp(e,"audio")))))}()}static getMediaSource(){return xp()}static get Events(){return Kh}static get ErrorTypes(){return Wh}static get ErrorDetails(){return zh}static get DefaultConfig(){return lE.defaultConfig?lE.defaultConfig:Q_}static set DefaultConfig(t){lE.defaultConfig=t}constructor(t={}){this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this.started=!1,this._emitter=new ov,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,this.triggeringException=void 0,function(t,e){if("object"==typeof console&&!0===t||"object"==typeof t){Qh(t,"debug","log","info","warn","error");try{Xh.log(`Debug logs enabled for "${e}" in hls.js version 1.5.17`)}catch(t){Xh=Yh}}else Xh=Yh}(t.debug||!1,"Hls instance");const e=this.config=function(t,e){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(void 0!==e.liveMaxLatencyDurationCount&&(void 0===e.liveSyncDurationCount||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==e.liveMaxLatencyDuration&&(void 0===e.liveSyncDuration||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const r=Z_(t),i=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach((t=>{const s=`${"level"===t?"playlist":t}LoadPolicy`,n=void 0===e[s],o=[];i.forEach((i=>{const a=`${t}Loading${i}`,l=e[a];if(void 0!==l&&n){o.push(a);const t=r[s].default;switch(e[s]={default:t},i){case"TimeOut":t.maxLoadTimeMs=l,t.maxTimeToFirstByteMs=l;break;case"MaxRetry":t.errorRetry.maxNumRetry=l,t.timeoutRetry.maxNumRetry=l;break;case"RetryDelay":t.errorRetry.retryDelayMs=l,t.timeoutRetry.retryDelayMs=l;break;case"MaxRetryTimeout":t.errorRetry.maxRetryDelayMs=l,t.timeoutRetry.maxRetryDelayMs=l}}})),o.length&&Zh.warn(`hls.js config: "${o.join('", "')}" setting(s) are deprecated, use "${s}": ${JSON.stringify(e[s])}`)})),Bh(Bh({},r),e)}(lE.DefaultConfig,t);this.userConfig=t,e.progressive&&J_(e);const{abrController:r,bufferController:i,capLevelController:s,errorController:n,fpsController:o}=e,a=new n(this),l=this.abrController=new r(this),c=this.bufferController=new i(this),u=this.capLevelController=new s(this),d=new o(this),h=new cg(this),f=new wg(this),p=e.contentSteeringController,g=p?new p(this):null,m=this.levelController=new eE(this,g),y=new Tm(this),v=new iE(this.config),_=this.streamController=new aE(this,y,v);u.setStreamController(_),d.setStreamController(_);const E=[h,m,_];g&&E.splice(1,0,g),this.networkControllers=E;const T=[l,c,u,d,f,y];this.audioTrackController=this.createController(e.audioTrackController,E);const w=e.audioStreamController;w&&E.push(new w(this,y,v)),this.subtitleTrackController=this.createController(e.subtitleTrackController,E);const S=e.subtitleStreamController;S&&E.push(new S(this,y,v)),this.createController(e.timelineController,T),v.emeController=this.emeController=this.createController(e.emeController,T),this.cmcdController=this.createController(e.cmcdController,T),this.latencyController=this.createController(Sg,T),this.coreComponents=T,E.push(a);const b=a.onErrorOut;"function"==typeof b&&this.on(Kh.ERROR,b,a)}createController(t,e){if(t){const r=new t(this);return e&&e.push(r),r}return null}on(t,e,r=this){this._emitter.on(t,e,r)}once(t,e,r=this){this._emitter.once(t,e,r)}removeAllListeners(t){this._emitter.removeAllListeners(t)}off(t,e,r=this,i){this._emitter.off(t,e,r,i)}listeners(t){return this._emitter.listeners(t)}emit(t,e,r){return this._emitter.emit(t,e,r)}trigger(t,e){if(this.config.debug)return this.emit(t,t,e);try{return this.emit(t,t,e)}catch(e){if(Zh.error("An internal error happened while handling event "+t+'. Error message: "'+e.message+'". Here is a stacktrace:',e),!this.triggeringException){this.triggeringException=!0;const r=t===Kh.ERROR;this.trigger(Kh.ERROR,{type:Wh.OTHER_ERROR,details:zh.INTERNAL_EXCEPTION,fatal:r,event:t,error:e}),this.triggeringException=!1}}return!1}listenerCount(t){return this._emitter.listenerCount(t)}destroy(){Zh.log("destroy"),this.trigger(Kh.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach((t=>t.destroy())),this.networkControllers.length=0,this.coreComponents.forEach((t=>t.destroy())),this.coreComponents.length=0;const t=this.config;t.xhrSetup=t.fetchSetup=void 0,this.userConfig=null}attachMedia(t){Zh.log("attachMedia"),this._media=t,this.trigger(Kh.MEDIA_ATTACHING,{media:t})}detachMedia(){Zh.log("detachMedia"),this.trigger(Kh.MEDIA_DETACHING,void 0),this._media=null}loadSource(t){this.stopLoad();const e=this.media,r=this.url,i=this.url=Oh.buildAbsoluteURL(self.location.href,t,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,Zh.log(`loadSource:${i}`),e&&r&&(r!==i||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(e)),this.trigger(Kh.MANIFEST_LOADING,{url:t})}startLoad(t=-1){Zh.log(`startLoad(${t})`),this.started=!0,this.networkControllers.forEach((e=>{e.startLoad(t)}))}stopLoad(){Zh.log("stopLoad"),this.started=!1,this.networkControllers.forEach((t=>{t.stopLoad()}))}resumeBuffering(){this.started&&this.networkControllers.forEach((t=>{"fragmentLoader"in t&&t.startLoad(-1)}))}pauseBuffering(){this.networkControllers.forEach((t=>{"fragmentLoader"in t&&t.stopLoad()}))}swapAudioCodec(){Zh.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){Zh.log("recoverMediaError");const t=this._media;this.detachMedia(),t&&this.attachMedia(t)}removeLevel(t){this.levelController.removeLevel(t)}get levels(){const t=this.levelController.levels;return t||[]}get currentLevel(){return this.streamController.currentLevel}set currentLevel(t){Zh.log(`set currentLevel:${t}`),this.levelController.manualLevel=t,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(t){Zh.log(`set nextLevel:${t}`),this.levelController.manualLevel=t,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(t){Zh.log(`set loadLevel:${t}`),this.levelController.manualLevel=t}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(t){this.levelController.nextLoadLevel=t}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(t){Zh.log(`set firstLevel:${t}`),this.levelController.firstLevel=t}get startLevel(){const t=this.levelController.startLevel;return-1===t&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:t}set startLevel(t){Zh.log(`set startLevel:${t}`),-1!==t&&(t=Math.max(t,this.minAutoLevel)),this.levelController.startLevel=t}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(t){const e=!!t;e!==this.config.capLevelToPlayerSize&&(e?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=e)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:t}=this.abrController;return t?t.getEstimate():NaN}set bandwidthEstimate(t){this.abrController.resetEstimator(t)}get ttfbEstimate(){const{bwEstimator:t}=this.abrController;return t?t.getEstimateTTFB():NaN}set autoLevelCapping(t){this._autoLevelCapping!==t&&(Zh.log(`set autoLevelCapping:${t}`),this._autoLevelCapping=t,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(t){(function(t){return bg.indexOf(t)>-1})(t)&&this._maxHdcpLevel!==t&&(this._maxHdcpLevel=t,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return-1===this.levelController.manualLevel}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:t,config:{minAutoBitrate:e}}=this;if(!t)return 0;const r=t.length;for(let i=0;i=e)return i;return 0}get maxAutoLevel(){const{levels:t,autoLevelCapping:e,maxHdcpLevel:r}=this;let i;if(i=-1===e&&null!=t&&t.length?t.length-1:e,r)for(let e=i;e--;){const i=t[e].attrs["HDCP-LEVEL"];if(i&&i<=r)return e}return i}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(t){this.abrController.nextAutoLevel=t}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}setAudioOption(t){var e;return null==(e=this.audioTrackController)?void 0:e.setAudioOption(t)}setSubtitleOption(t){var e;return null==(e=this.subtitleTrackController)||e.setSubtitleOption(t),null}get allAudioTracks(){const t=this.audioTrackController;return t?t.allAudioTracks:[]}get audioTracks(){const t=this.audioTrackController;return t?t.audioTracks:[]}get audioTrack(){const t=this.audioTrackController;return t?t.audioTrack:-1}set audioTrack(t){const e=this.audioTrackController;e&&(e.audioTrack=t)}get allSubtitleTracks(){const t=this.subtitleTrackController;return t?t.allSubtitleTracks:[]}get subtitleTracks(){const t=this.subtitleTrackController;return t?t.subtitleTracks:[]}get subtitleTrack(){const t=this.subtitleTrackController;return t?t.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(t){const e=this.subtitleTrackController;e&&(e.subtitleTrack=t)}get subtitleDisplay(){const t=this.subtitleTrackController;return!!t&&t.subtitleDisplay}set subtitleDisplay(t){const e=this.subtitleTrackController;e&&(e.subtitleDisplay=t)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(t){this.config.lowLatencyMode=t}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}}lE.defaultConfig=void 0,rs.registerPlugin(lu),Ad();const cE=rs.matchMedia();let uE=!0;cE.add("(min-width: 992px)",(()=>{uE=!1}));class dE extends c.Renderer{intro(){const t=document.querySelector(".popup.--is-home"),e=rs.timeline({paused:!0,onComplete:()=>{const t=document.querySelector(".popup__content");document.addEventListener("click",(e=>{t.contains(e.target)||(r.play(),uu.set("popup_closed",!0))}));document.querySelector(".popup__close").addEventListener("click",(()=>{r.play(),uu.set("popup_closed",!0)}))}});e.set(t,{display:"flex"}),e.to(t,{opacity:1,duration:.7});const r=rs.timeline({paused:!0,onComplete:()=>{eT.start(),t.remove()}});r.to(t,{opacity:0}),r.set(t,{display:"none"});const i=new lu(".home-hero__title",{type:"chars"});rs.timeline({onComplete:()=>{t?e.play():eT.start()}}).add("start").to(".home-hero__title",{opacity:1,duration:2,ease:"power2.inOut"}).to(".header__logo",{opacity:1,duration:2,ease:"power2.inOut"},"start").to(i.chars,{stagger:{from:"random",amount:.75},blur:0,color:tT,duration:2.5,ease:"power2.inOut"},"start").add("step2").to(".home-hero__title",{y:0,scale:1,duration:3,ease:"power4.inOut"},"step2-=1").to(".home-hero__bg",{opacity:1,scale:1,duration:2,ease:"power2.inOut"},"step2-=1").to(".header__left-menu",{opacity:1,duration:2,ease:"power2.inOut"},"step2-=1").to(".header__right-menu",{opacity:1,duration:2,ease:"power2.inOut"},"step2-=1").to(".header__menu-toggle",{opacity:1,duration:2,ease:"power2.inOut"},"step2-=1").to(".home__scroll-down",{opacity:1,duration:2,ease:"power2.inOut"},"step2-=1").to(".home-hero__text",{opacity:1,y:0,duration:2,ease:"power2.inOut"},"step2-=1").to(".header__logo",{left:0,duration:2,ease:"power2.inOut"},"step2-=1").to(".header__logo svg",{scale:1,y:0,x:()=>{if(uE)return 0},duration:2,ease:"power2.inOut"},"step2-=1")}onEnter(){window.scrollTo(0,0)}onLeave(){}onEnterCompleted(){rs.to(".site__wrap",{opacity:1,duration:1}),1==yu?window.addEventListener("endloading",this.intro):(document.dispatchEvent(new Event("DOMContentLoadedCustom")),this.intro());const t=document.getElementById("home-hero-bg-video");let e="https://player.vimeo.com/external/1099405596.m3u8?s=72b60c13e25186c19f489b066c63afb5d0504fe6&logging=false";"mobile"==window.localStorage.getItem("page_size")&&(e="https://player.vimeo.com/external/1099405582.m3u8?s=71c90115d78cec0623d26530ceeb1bb50f3a1646&logging=false"),setTimeout((()=>{if(lE.isSupported()){const r=new lE({debug:!1});r.loadSource(e),r.attachMedia(t),r.on(lE.Events.MEDIA_ATTACHED,(function(){}))}else t.canPlayType("application/vnd.apple.mpegurl")&&(t.src=e,t.addEventListener("canplay",(function(){})));xc.create({trigger:".home-shadow",start:"top bottom",pin:".home-intro",pinSpacing:!1,markers:!1,end:"bottom bottom"}),rs.to(".home-hero__bg",{scale:1.25,scrollTrigger:{trigger:".home-hero",start:"top top",end:"+=100%",scrub:!0,immediateRender:!1}}),rs.to(".home__scroll-down,.home-hero__title,.home-hero__text",{opacity:0,scrollTrigger:{trigger:".home-intro__sub",start:"top bottom",toggleActions:"play pause resume reverse",immediateRender:!1}}),rs.to(".home-shadow__bg",{yPercent:25,scrollTrigger:{trigger:".home-shadow__bg",start:"top center",end:"bottom bottom",markers:!1,scrub:!0}});const r=document.querySelector(".footer__nl-input");r&&r.setAttribute("size",r.getAttribute("placeholder").length)}),100)}onLeaveCompleted(){}}rs.registerPlugin(lu),Ad();const hE=rs.matchMedia();let fE=!0;hE.add("(min-width: 992px)",(()=>{fE=!1}));class pE extends c.Renderer{intro(){const t=document.querySelector(".popup.--is-madetofeed"),e=rs.timeline({paused:!0,onComplete:()=>{const t=document.querySelector(".popup__content");document.addEventListener("click",(e=>{t.contains(e.target)||(r.play(),uu.set("popup_closed",!0))}));document.querySelector(".popup__close").addEventListener("click",(()=>{r.play(),uu.set("popup_closed",!0)}))}});e.set(t,{display:"flex"}),e.to(t,{opacity:1,duration:.7});const r=rs.timeline({paused:!0,onComplete:()=>{eT.start(),t.remove()}});r.to(t,{opacity:0}),r.set(t,{display:"none"});const i=new lu(".madetofeed-hero__title",{type:"chars"});rs.timeline({onComplete:()=>{t?e.play():eT.start()}}).add("start").to(".madetofeed-hero__title",{opacity:1,duration:2,ease:"power2.inOut"}).to(".header__logo",{opacity:1,duration:2,ease:"power2.inOut"},"start").to(i.chars,{stagger:{from:"random",amount:.75},blur:0,color:tT,duration:2.5,ease:"power2.inOut"},"start").add("step2").to(".madetofeed-hero__title",{y:"0",scale:.8,duration:3,ease:"power4.inOut"},"step2-=1").to(".madetofeed-hero__bg",{opacity:1,scale:1,duration:2,ease:"power2.inOut"},"step2-=1").to(".header__left-menu",{opacity:1,duration:2,ease:"power2.inOut"},"step2-=1").to(".header__right-menu",{opacity:1,duration:2,ease:"power2.inOut"},"step2-=1").to(".header__menu-toggle",{opacity:1,duration:2,ease:"power2.inOut"},"step2-=1").to(".madetofeed__scroll-down",{opacity:1,duration:2,ease:"power2.inOut"},"step2-=1").to(".madetofeed-hero__text",{opacity:1,y:0,duration:2,ease:"power2.inOut"},"step2-=1").to(".madetofeed-form__wrapper",{y:20,opacity:1,duration:2,ease:"power2.inOut"},"step2-=1").to(".header__logo",{left:0,duration:2,ease:"power2.inOut"},"step2-=1").to(".header__logo svg",{scale:1,y:0,x:()=>{if(fE)return 0},duration:2,ease:"power2.inOut"},"step2-=1")}onEnter(){window.scrollTo(0,0)}onLeave(){}onEnterCompleted(){rs.to(".site__wrap",{opacity:1,duration:1}),1==yu?window.addEventListener("endloading",this.intro):(document.dispatchEvent(new Event("DOMContentLoadedCustom")),this.intro()),setTimeout((()=>{xc.create({trigger:".madetofeed-shadow",start:"top bottom",pin:".madetofeed-intro",pinSpacing:!1,markers:!1,end:"bottom bottom"}),rs.to(".madetofeed-hero__bg",{scale:1.25,scrollTrigger:{trigger:".madetofeed-hero",start:"top top",end:"+=100%",scrub:!0,immediateRender:!1}}),rs.to(".madetofeed__scroll-down,.madetofeed-hero__title,.madetofeed-hero__text",{opacity:0,scrollTrigger:{trigger:".madetofeed-intro__sub",start:"top bottom",toggleActions:"play pause resume reverse",immediateRender:!1}}),rs.to(".madetofeed-shadow__bg",{yPercent:25,scrollTrigger:{trigger:".madetofeed-shadow__bg",start:"top center",end:"bottom bottom",markers:!1,scrub:!0}});const t=document.querySelector(".footer__nl-input");t&&t.setAttribute("size",t.getAttribute("placeholder").length);const e=document.querySelector(".contactform_cta");if(document.querySelectorAll(".contactform_cta").length>0){e.addEventListener("click",(()=>{if(e.classList.contains("pchecked")){Cd(document.querySelector(".submit-ct input")),rs.to(".privacy-error--cf",{opacity:0})}else rs.to(".privacy-error--cf",{opacity:1})}));document.getElementById("p-checkbox-fc").addEventListener("change",(t=>{!0===t.target.checked&&e.classList.add("pchecked"),!1===t.target.checked&&e.classList.remove("pchecked")}))}let r=!1;document.querySelector("#gmap")&&(document.querySelector("#gmap").addEventListener("mouseenter",(()=>{r=!0})),document.querySelector("#gmap").addEventListener("mouseleave",(()=>{r=!1}))),document.addEventListener("keydown",(function(t){"Meta"==t.key&&1==r&&eT.stop()})),document.addEventListener("keyup",(function(t){"Meta"==t.key&&eT.start()}))}),100)}onLeaveCompleted(){}}rs.registerPlugin(lu),Ad();const gE=rs.matchMedia();let mE=!0;gE.add("(min-width: 992px)",(()=>{mE=!1}));class yE extends c.Renderer{intro(){const t=document.querySelector(".popup.--is-casadecor"),e=rs.timeline({paused:!0,onComplete:()=>{const t=document.querySelector(".popup__content");document.addEventListener("click",(e=>{t.contains(e.target)||(r.play(),uu.set("popup_closed",!0))}));document.querySelector(".popup__close").addEventListener("click",(()=>{r.play(),uu.set("popup_closed",!0)}))}});e.set(t,{display:"flex"}),e.to(t,{opacity:1,duration:.7});const r=rs.timeline({paused:!0,onComplete:()=>{eT.start(),t.remove()}});r.to(t,{opacity:0}),r.set(t,{display:"none"});const i=new lu(".casadecor-hero__title",{type:"chars"});rs.timeline({onComplete:()=>{t?e.play():eT.start()}}).add("start").to(".casadecor-hero__title",{opacity:1,duration:2,ease:"power2.inOut"}).to(".header__logo",{opacity:1,duration:2,ease:"power2.inOut"},"start").to(i.chars,{stagger:{from:"random",amount:.75},blur:0,color:tT,duration:2.5,ease:"power2.inOut"},"start").add("step2").to(".casadecor-hero__title",{y:"-250px",scale:.8,duration:3,ease:"power4.inOut"},"step2-=1").to(".casadecor-hero__bg",{opacity:1,scale:1,duration:2,ease:"power2.inOut"},"step2-=1").to(".header__left-menu",{opacity:1,duration:2,ease:"power2.inOut"},"step2-=1").to(".header__right-menu",{opacity:1,duration:2,ease:"power2.inOut"},"step2-=1").to(".header__menu-toggle",{opacity:1,duration:2,ease:"power2.inOut"},"step2-=1").to(".casadecor__scroll-down",{opacity:1,duration:2,ease:"power2.inOut"},"step2-=1").to(".casadecor-hero__text",{opacity:1,y:0,duration:2,ease:"power2.inOut"},"step2-=1").to(".header__logo",{left:0,duration:2,ease:"power2.inOut"},"step2-=1").to(".header__logo svg",{scale:1,y:0,x:()=>{if(mE)return 0},duration:2,ease:"power2.inOut"},"step2-=1")}onEnter(){window.scrollTo(0,0)}onLeave(){}onEnterCompleted(){rs.to(".site__wrap",{opacity:1,duration:1}),1==yu?window.addEventListener("endloading",this.intro):(document.dispatchEvent(new Event("DOMContentLoadedCustom")),this.intro());const t=document.getElementById("casadecor-hero-bg-video");let e="https://player.vimeo.com/external/1064304805.m3u8?s=363722bb377d2f51f4315b9f3f860ca441cfeeb0&logging=false";"mobile"==window.localStorage.getItem("page_size")&&(e="https://player.vimeo.com/external/1064304825.m3u8?s=2ef49d5c9c668b63e43bbc0caaa84e4c3a9fb71c&logging=false"),setTimeout((()=>{if(lE.isSupported()){const r=new lE({debug:!1});r.loadSource(e),r.attachMedia(t),r.on(lE.Events.MEDIA_ATTACHED,(function(){t.muted=!0,t.play()}))}else t.canPlayType("application/vnd.apple.mpegurl")&&(t.src=e,t.addEventListener("canplay",(function(){t.play()})));xc.create({trigger:".casadecor-shadow",start:"top bottom",pin:".casadecor-intro",pinSpacing:!1,markers:!1,end:"bottom bottom"}),rs.to(".casadecor-hero__bg",{scale:1.25,scrollTrigger:{trigger:".casadecor-hero",start:"top top",end:"+=100%",scrub:!0,immediateRender:!1}}),rs.to(".casadecor__scroll-down,.casadecor-hero__title,.casadecor-hero__text",{opacity:0,scrollTrigger:{trigger:".casadecor-intro__sub",start:"top bottom",toggleActions:"play pause resume reverse",immediateRender:!1}}),rs.to(".casadecor-shadow__bg",{yPercent:25,scrollTrigger:{trigger:".casadecor-shadow__bg",start:"top center",end:"bottom bottom",markers:!1,scrub:!0}});const r=document.querySelector(".footer__nl-input");r&&r.setAttribute("size",r.getAttribute("placeholder").length);const i=document.querySelector(".contactform_cta");if(document.querySelectorAll(".contactform_cta").length>0){i.addEventListener("click",(()=>{if(i.classList.contains("pchecked")){Cd(document.querySelector(".submit-ct input")),rs.to(".privacy-error--cf",{opacity:0})}else rs.to(".privacy-error--cf",{opacity:1})}));document.getElementById("p-checkbox-fc").addEventListener("change",(t=>{!0===t.target.checked&&i.classList.add("pchecked"),!1===t.target.checked&&i.classList.remove("pchecked")}))}let s=!1;document.querySelector("#gmap")&&(document.querySelector("#gmap").addEventListener("mouseenter",(()=>{s=!0})),document.querySelector("#gmap").addEventListener("mouseleave",(()=>{s=!1}))),document.addEventListener("keydown",(function(t){"Meta"==t.key&&1==s&&eT.stop()})),document.addEventListener("keyup",(function(t){"Meta"==t.key&&eT.start()}))}),100)}onLeaveCompleted(){}}rs.registerPlugin(lu),Ad();const vE=rs.matchMedia();let _E=!0;vE.add("(min-width: 992px)",(()=>{_E=!1}));class EE extends c.Renderer{intro(){const t=document.querySelector(".popup.--is-casadecorpromo"),e=rs.timeline({paused:!0,onComplete:()=>{const t=document.querySelector(".popup__content");document.addEventListener("click",(e=>{t.contains(e.target)||(r.play(),uu.set("popup_closed",!0))}));document.querySelector(".popup__close").addEventListener("click",(()=>{r.play(),uu.set("popup_closed",!0)}))}});e.set(t,{display:"flex"}),e.to(t,{opacity:1,duration:.7});const r=rs.timeline({paused:!0,onComplete:()=>{eT.start(),t.remove()}});r.to(t,{opacity:0}),r.set(t,{display:"none"});const i=new lu(".casadecorpromo-hero__title",{type:"chars"});rs.timeline({onComplete:()=>{t?e.play():eT.start()}}).add("start").to(".casadecorpromo-hero__title",{opacity:1,duration:2,ease:"power2.inOut"}).to(".header__logo",{opacity:1,duration:2,ease:"power2.inOut"},"start").to(i.chars,{stagger:{from:"random",amount:.75},blur:0,color:tT,duration:2.5,ease:"power2.inOut"},"start").add("step2").to(".casadecorpromo-hero__title",{y:"0",scale:.8,duration:3,ease:"power4.inOut"},"step2-=1").to(".casadecorpromo-hero__bg",{opacity:1,scale:1,duration:2,ease:"power2.inOut"},"step2-=1").to(".header__left-menu",{opacity:1,duration:2,ease:"power2.inOut"},"step2-=1").to(".header__right-menu",{opacity:1,duration:2,ease:"power2.inOut"},"step2-=1").to(".header__menu-toggle",{opacity:1,duration:2,ease:"power2.inOut"},"step2-=1").to(".casadecorpromo__scroll-down",{opacity:1,duration:2,ease:"power2.inOut"},"step2-=1").to(".casadecorpromo-hero__text",{opacity:1,y:0,duration:2,ease:"power2.inOut"},"step2-=1").to(".casadecorpromo-form__wrapper",{y:20,opacity:1,duration:2,ease:"power2.inOut"},"step2-=1").to(".header__logo",{left:0,duration:2,ease:"power2.inOut"},"step2-=1").to(".header__logo svg",{scale:1,y:0,x:()=>{if(_E)return 0},duration:2,ease:"power2.inOut"},"step2-=1")}onEnter(){window.scrollTo(0,0)}onLeave(){}onEnterCompleted(){rs.to(".site__wrap",{opacity:1,duration:1}),1==yu?window.addEventListener("endloading",this.intro):(document.dispatchEvent(new Event("DOMContentLoadedCustom")),this.intro());const t=document.getElementById("casadecorpromo-hero-bg-video");let e="https://player.vimeo.com/external/1064304805.m3u8?s=363722bb377d2f51f4315b9f3f860ca441cfeeb0&logging=false";"mobile"==window.localStorage.getItem("page_size")&&(e="https://player.vimeo.com/external/1064304825.m3u8?s=2ef49d5c9c668b63e43bbc0caaa84e4c3a9fb71c&logging=false"),setTimeout((()=>{if(lE.isSupported()){const r=new lE({debug:!1});r.loadSource(e),r.attachMedia(t),r.on(lE.Events.MEDIA_ATTACHED,(function(){t.muted=!0,t.play()}))}else t.canPlayType("application/vnd.apple.mpegurl")&&(t.src=e,t.addEventListener("canplay",(function(){t.play()})));xc.create({trigger:".casadecorpromo-shadow",start:"top bottom",pin:".casadecorpromo-intro",pinSpacing:!1,markers:!1,end:"bottom bottom"}),rs.to(".casadecorpromo-hero__bg",{scale:1.25,scrollTrigger:{trigger:".casadecorpromo-hero",start:"top top",end:"+=100%",scrub:!0,immediateRender:!1}}),rs.to(".casadecorpromo__scroll-down,.casadecorpromo-hero__title,.casadecorpromo-hero__text",{opacity:0,scrollTrigger:{trigger:".casadecorpromo-intro__sub",start:"top bottom",toggleActions:"play pause resume reverse",immediateRender:!1}}),rs.to(".casadecorpromo-shadow__bg",{yPercent:25,scrollTrigger:{trigger:".casadecorpromo-shadow__bg",start:"top center",end:"bottom bottom",markers:!1,scrub:!0}});const r=document.querySelector(".footer__nl-input");r&&r.setAttribute("size",r.getAttribute("placeholder").length);const i=document.querySelector(".contactform_cta");if(document.querySelectorAll(".contactform_cta").length>0){i.addEventListener("click",(()=>{if(i.classList.contains("pchecked")){Cd(document.querySelector(".submit-ct input")),rs.to(".privacy-error--cf",{opacity:0})}else rs.to(".privacy-error--cf",{opacity:1})}));document.getElementById("p-checkbox-fc").addEventListener("change",(t=>{!0===t.target.checked&&i.classList.add("pchecked"),!1===t.target.checked&&i.classList.remove("pchecked")}))}let s=!1;document.querySelector("#gmap")&&(document.querySelector("#gmap").addEventListener("mouseenter",(()=>{s=!0})),document.querySelector("#gmap").addEventListener("mouseleave",(()=>{s=!1}))),document.addEventListener("keydown",(function(t){"Meta"==t.key&&1==s&&eT.stop()})),document.addEventListener("keyup",(function(t){"Meta"==t.key&&eT.start()}))}),100)}onLeaveCompleted(){}}rs.registerPlugin(lu),Ad();const TE=rs.matchMedia();let wE=!0;TE.add("(min-width: 992px)",(()=>{wE=!1}));class SE extends c.Renderer{onEnter(){}onLeave(){}introAni(){const t=new lu(".manifesto-intro-title",{type:"lines",linesClass:"lineChild"}),e=new lu(".manifesto-intro-title",{type:"lines",linesClass:"lineParent"}),r=new lu(".manifesto-intro-sub",{type:"lines",linesClass:"lineChild"}),i=new lu(".manifesto-intro-sub",{type:"lines",linesClass:"lineParent"});rs.set(".manifesto-intro-sub",{opacity:1}),rs.set(".manifesto-intro-title",{opacity:1}),rs.set(e.lines,{overflow:"hidden"}),rs.set(t.lines,{yPercent:100}),rs.set(i.lines,{overflow:"hidden"}),rs.set(r.lines,{yPercent:100});rs.timeline({onComplete:()=>{eT.start()}}).add("start").to(t.lines,{yPercent:0,delay:.5,stagger:{each:.1}},"start").to(r.lines,{yPercent:0,delay:.5,stagger:{each:.1}},"start").to(".header__logo",{opacity:1,duration:2,ease:"power2.inOut"},"start").to(".header__left-menu",{opacity:1,duration:2,ease:"power2.inOut"},"start").to(".header__right-menu",{opacity:1,duration:2,ease:"power2.inOut"},"start").to(".manifesto-intro-img--1 img",{xPercent:0,yPercent:0,opacity:1,blur:0,duration:3,delay:.25,ease:"power2.inOut"},"start").to(".manifesto-intro-img--2 img",{xPercent:0,yPercent:0,opacity:1,blur:0,duration:3,delay:.25,ease:"power2.inOut"},"start").to(".header__menu-toggle",{opacity:1,duration:2,ease:"power2.inOut"},"start")}onEnterCompleted(){rs.set(".manifesto-intro-sub",{opacity:0}),rs.set(".manifesto-intro-title",{opacity:0}),1==yu?window.addEventListener("endloading",(()=>{this.introAni()})):(this.introAni(),document.dispatchEvent(new Event("DOMContentLoadedCustom"))),rs.set(".manifesto-intro-img--2 img",{xPercent:50,yPercent:50,opacity:0,blur:4}),rs.set(".manifesto-intro-img--1 img",{xPercent:-50,yPercent:-50,opacity:0,blur:4}),rs.set(".header__logo",{left:0}),rs.set(".header__logo svg",{scale:1,y:0,x:()=>{if(wE)return 0}}),rs.to(".site__wrap",{opacity:1}),rs.to(".manifesto__bg",{opacity:1}),setTimeout((()=>{rs.to(".manifesto__bg",{yPercent:20,scrollTrigger:{trigger:"body",start:"top top",end:"bottom bottom",markers:!1,scrub:!0}})}),100)}onLeaveCompleted(){}}rs.registerPlugin(lu),Ad();const bE=rs.matchMedia();let DE=!0;bE.add("(min-width: 992px)",(()=>{DE=!1}));class LE extends c.Renderer{onEnter(){}onLeave(){}introAni(){const t=new lu(".manifesto-intro-title",{type:"lines",linesClass:"lineChild"}),e=new lu(".manifesto-intro-title",{type:"lines",linesClass:"lineParent"}),r=new lu(".manifesto-intro-sub",{type:"lines",linesClass:"lineChild"}),i=new lu(".manifesto-intro-sub",{type:"lines",linesClass:"lineParent"});rs.set(".manifesto-intro-sub",{opacity:1}),rs.set(".manifesto-intro-title",{opacity:1}),rs.set(e.lines,{overflow:"hidden"}),rs.set(t.lines,{yPercent:100}),rs.set(i.lines,{overflow:"hidden"}),rs.set(r.lines,{yPercent:100});rs.timeline({onComplete:()=>{eT.start()}}).add("start").to(t.lines,{yPercent:0,delay:.5,stagger:{each:.1}},"start").to(r.lines,{yPercent:0,delay:.5,stagger:{each:.1}},"start").to(".header__logo",{opacity:1,duration:2,ease:"power2.inOut"},"start").to(".header__left-menu",{opacity:1,duration:2,ease:"power2.inOut"},"start").to(".header__right-menu",{opacity:1,duration:2,ease:"power2.inOut"},"start").to(".header__menu-toggle",{opacity:1,duration:2,ease:"power2.inOut"},"start")}onEnterCompleted(){rs.set(".manifesto-intro-sub",{opacity:0}),rs.set(".manifesto-intro-title",{opacity:0}),1==yu?window.addEventListener("endloading",(()=>{this.introAni()})):(this.introAni(),document.dispatchEvent(new Event("DOMContentLoadedCustom"))),rs.set(".manifesto-intro-img--2 img",{xPercent:50,yPercent:50,opacity:0,blur:4}),rs.set(".manifesto-intro-img--1 img",{xPercent:-50,yPercent:-50,opacity:0,blur:4}),rs.set(".header__logo",{left:0}),rs.set(".header__logo svg",{scale:1,y:0,x:()=>{if(DE)return 0}}),rs.to(".site__wrap",{opacity:1}),rs.to(".manifesto__bg",{opacity:1}),setTimeout((()=>{rs.to(".manifesto__bg",{yPercent:20,scrollTrigger:{trigger:"body",start:"top top",end:"bottom bottom",markers:!1,scrub:!0}})}),100),xc.refresh()}onLeaveCompleted(){}}rs.registerPlugin(lu,xc);const AE=rs.matchMedia();let kE=!0;AE.add("(min-width: 992px)",(()=>{kE=!1}));class CE extends c.Renderer{onEnter(){}onLeave(){}initTitles(){rs.set(".hero-1__title",{opacity:1}),rs.set(".hero-1__sub",{opacity:1});const t=new lu(".hero-1__title",{type:"lines",linesClass:"lineChild"}),e=new lu(".hero-1__title",{type:"lines",linesClass:"lineParent"}),r=new lu(".hero-1__sub",{type:"lines",linesClass:"lineChild"}),i=new lu(".hero-1__sub",{type:"lines",linesClass:"lineParent"});rs.set(e.lines,{overflow:"hidden"}),rs.set(t.lines,{yPercent:100}),rs.set(i.lines,{overflow:"hidden"}),rs.set(r.lines,{yPercent:100});rs.timeline().add("start").to(t.lines,{yPercent:0,stagger:{each:.1}},"start").to(r.lines,{yPercent:0,stagger:{each:.1}},"start")}onEnterCompleted(){if(rs.set(".hero-1__title",{opacity:0}),rs.set(".hero-1__sub",{opacity:0}),1==yu){localStorage.removeItem("filterStorage");rs.timeline({onComplete:()=>{eT.start()}}).add("start").to(".header__logo",{opacity:1,duration:2,ease:"power2.inOut"},"start").to(".header__left-menu",{opacity:1,duration:2,ease:"power2.inOut"},"start").to(".header__right-menu",{opacity:1,duration:2,ease:"power2.inOut"},"start"),rs.set(".header__logo",{left:0}),rs.to(".header__menu-toggle",{opacity:1,duration:2,ease:"power2.inOut"}),rs.set(".header__logo svg",{scale:1,y:0,x:()=>{if(kE)return 0}}),window.addEventListener("endloading",(()=>{this.initTitles()}))}else document.dispatchEvent(new Event("DOMContentLoadedCustom")),this.initTitles();rs.to(".site__wrap",{opacity:1}),document.querySelectorAll(".block-7__banner").length>0&&document.querySelector(".block-7__banner").addEventListener("click",(()=>{rs.to(".block-7__banner",{opacity:0,onComplete:()=>{rs.set(".block-7__banner",{pointerEvents:"none"})}}),rs.to(".iframe-vt",{opacity:1})})),setTimeout((()=>{xc.create({trigger:".list-materials__filters",start:"bottom bottom",pinSpacing:!1,pin:".list-materials__filters",markers:!1,endTrigger:".list-materials",end:"bottom bottom"}),xc.create({trigger:".hero-1",start:"top top",pinSpacing:!1,pin:".hero-1",markers:!1,end:"+=100%",onUpdate:t=>{}})}),250),setTimeout((()=>{document.querySelectorAll(".custom-select").forEach((t=>{rs.set(t,{minWidth:t.clientWidth+10})}))}),250);const t=document.querySelector(".list-materials-wrapMobile"),e=rs.timeline({paused:!0,onComplete:()=>{t.classList.add("active"),document.querySelector(".list-materials-wrap").classList.add("done")},onReverseComplete:()=>{t.classList.remove("active")}});e.to(".list-materials-wrap",{height:"auto"}),t.addEventListener("click",(()=>{t.classList.contains("active")?(document.querySelector(".list-materials-wrap").classList.remove("done"),e.reverse()):e.play()}));const r={sistema:"",anta:"",apertura:""},i=function(t){t.forEach((t=>{t.classList.remove("disabled")}))},s=function(t,e,r){t.forEach((t=>{const i=t.className.split(" ")[0].replace("opt-","");i&&!e[r].includes(i)&&t.classList.add("disabled")}))},n=function(){const t=document.querySelector("#sistema").value.substr(1),e=document.querySelector("#anta").value.substr(1),r=document.querySelector("#apertura").value.substr(1),n=document.querySelector("#sistema").parentElement.querySelectorAll(".cs-opt"),o=document.querySelector("#anta").parentElement.querySelectorAll(".cs-opt"),a=document.querySelector("#apertura").parentElement.querySelectorAll(".cs-opt");if(i(n),i(o),i(a),t){const e=window.__filters.system.find((e=>e.title==t));s(o,e,"door"),s(a,e,"handle")}if(e){const t=window.__filters.door.find((t=>t.title==e));s(n,t,"system"),s(a,t,"handle")}if(r){const t=window.__filters.handle.find((t=>t.title==r));s(n,t,"system"),s(o,t,"door")}},o=function(){!function(t,e,r){const i={value:e,expiry:(new Date).getTime()+r};localStorage.setItem(t,JSON.stringify(i))}("filterStorage",{system:document.querySelector("#sistema").value,door:document.querySelector("#anta").value,opening:document.querySelector("#apertura").value,systemLabel:document.querySelector("#sistema").parentNode.querySelector(".select-selected").innerHTML,doorLabel:document.querySelector("#anta").parentNode.querySelector(".select-selected").innerHTML,openingLabel:document.querySelector("#apertura").parentNode.querySelector(".select-selected").innerHTML},18e5)};document.querySelectorAll(".mg-filter").forEach((t=>{t.addEventListener("change",(()=>{n(),o(),""!=t.value?r[t.attributes.name.value]=t.value:r[t.attributes.name.value]="";const e=[];for(const t in r)e.push(r[t]);let i=e.join("");""==i&&(i=".list-materials__box-wrap"),rs.to(".list-materials__box-wrap",{onStart:()=>{rs.to(".list-materials__nores",{opacity:0,duration:.75})},opacity:0,duration:.75,stagger:{amount:.35,from:"random"},ease:"power2.inOut",onComplete:()=>{rs.set(".list-materials__box-wrap",{display:"none"}),rs.set(".list-materials__nores",{display:"none"}),setTimeout((()=>{eT.scrollTo("#list-mat-top",{duration:2,lock:!0,force:!0,offset:-200})}),125),document.querySelectorAll(i).length>0?(rs.set(i,{display:"block"}),rs.to(i,{opacity:1,duration:.5,stagger:{amount:.35,from:"random"},ease:"power2.inOut"})):(rs.set(".list-materials__nores",{display:"block"}),rs.to(".list-materials__nores",{opacity:1,duration:.5,ease:"power2.inOut"})),xc.refresh()}})}))})),function(){const t=function(t){const e=localStorage.getItem(t);if(!e)return null;const r=JSON.parse(e);return(new Date).getTime()>r.expiry?(localStorage.removeItem(t),null):r.value}("filterStorage");t&&(t.system||t.door||t.opening)&&(document.querySelector("#sistema").value=t.system,document.querySelector("#anta").value=t.door,document.querySelector("#apertura").value=t.opening,document.querySelector("#sistema").parentNode.querySelector(".select-selected").innerHTML=t.systemLabel,document.querySelector("#anta").parentNode.querySelector(".select-selected").innerHTML=t.doorLabel,document.querySelector("#apertura").parentNode.querySelector(".select-selected").innerHTML=t.openingLabel,t.system&&document.querySelector("#sistema").parentNode.getElementsByClassName("opt-"+t.system.substr(1))[0].classList.add("same-as-selected"),t.door&&document.querySelector("#anta").parentNode.getElementsByClassName("opt-"+t.door.substr(1))[0].classList.add("same-as-selected"),t.opening&&document.querySelector("#apertura").parentNode.getElementsByClassName("opt-"+t.opening.substr(1))[0].classList.add("same-as-selected"),n(),document.querySelector("#sistema").dispatchEvent(new Event("change")))}()}onLeaveCompleted(){}}Ad(),rs.registerPlugin(lu,xc);const xE=rs.matchMedia();let RE=!0;xE.add("(min-width: 992px)",(()=>{RE=!1}));class PE extends c.Renderer{onEnter(){}onLeave(){}initTitles(){const t=new lu(".moodboard__intro-title",{type:"lines",linesClass:"lineChild"}),e=new lu(".moodboard__intro-title",{type:"lines",linesClass:"lineParent"}),r=new lu(".moodboard__intro-sub",{type:"lines",linesClass:"lineChild"}),i=new lu(".moodboard__intro-sub",{type:"lines",linesClass:"lineParent"});rs.set(".moodboard__intro-title",{opacity:1}),rs.set(".moodboard__intro-sub",{opacity:1}),rs.set(e.lines,{overflow:"hidden"}),rs.set(t.lines,{yPercent:100}),rs.set(i.lines,{overflow:"hidden"}),rs.set(r.lines,{yPercent:100});rs.timeline().add("start").to(t.lines,{yPercent:0,stagger:{each:.1}},"start").to(r.lines,{yPercent:0,stagger:{each:.1}},"start")}onEnterCompleted(){if(1==yu){rs.timeline({onComplete:()=>{}}).add("start").to(".header__logo",{opacity:1,duration:2,ease:"power2.inOut"},"start").to(".header__left-menu",{opacity:1,duration:2,ease:"power2.inOut"},"start").to(".header__right-menu",{opacity:1,duration:2,ease:"power2.inOut"},"start"),rs.set(".header__logo",{left:0}),rs.to(".header__menu-toggle",{opacity:1,duration:2,ease:"power2.inOut"}),rs.set(".header__logo svg",{scale:1,y:0,x:()=>{if(RE)return 0}}),rs.set(".moodboard__intro-title",{opacity:0}),rs.set(".moodboard__intro-sub",{opacity:0}),window.addEventListener("endloading",(()=>{this.initTitles()}))}else document.dispatchEvent(new Event("DOMContentLoadedCustom")),this.initTitles();rs.to(".site__wrap",{opacity:1});let t=!1,e=0;const r=document.querySelectorAll(".moodboard__slide"),i=document.querySelectorAll(".moodboard__title"),s=document.querySelectorAll(".moodboard__cta"),n=document.querySelectorAll(".moodboard__breadcrumb nav a"),o=xc.observe({type:"wheel,touch",wheelSpeed:-1,tolerance:10,preventDefault:!0,onDown:()=>{!t&&a(-1,e-1)},onUp:()=>{!t&&a(1,e+1)}});function a(a,l){if(1==a)if(e{t=!1,e=l;for(let t=0;t{rs.set(i[l],{yPercent:100,y:0}),rs.set(s[l],{yPercent:100,y:0}),t=!0,n.forEach((t=>{t.classList.remove("current")})),n[l].classList.add("current"),document.querySelector(".header__menu-toggle").classList.add("hide"),document.querySelector(".header").classList.add("hide")}});o.addLabel("start").to(".moodboard",{duration:3,ease:"power2.inOut",background:()=>r[l].dataset.bg},"start").to(r[e].querySelectorAll(".moodboard__imgCol"),{yPercent:-100,scale:.5,duration:3,stagger:{from:"edges",each:.2}},"start").to(r[l].querySelectorAll(".moodboard__imgCol"),{y:0,scale:1,yPercent:0,duration:3,stagger:{from:"edges",each:.2}},"start").to(".moodboard__img--s img",{yPercent:20,duration:3,ease:"power2.inOut"},"start").to(r[e],{yPercent:-100,opacity:0,duration:3,ease:"power2.inOut"},"start").to(r[l],{y:0,yPercent:0,opacity:1,duration:3,ease:"power2.inOut"},"start").to(i[e],{yPercent:-100,duration:3,ease:"power2.inOut"},"start").to(i[l],{y:0,yPercent:0,duration:3,ease:"power2.inOut"},"start").to(s[e],{yPercent:-100,duration:3,ease:"power2.inOut"},"start").to(s[l],{y:0,yPercent:0,duration:3,ease:"power2.inOut"},"start")}else eT.start(),o.disable();if(-1==a)if(e>=1){rs.timeline({onComplete:()=>{t=!1,e=l},onStart:()=>{rs.set(i[l],{yPercent:-100,y:0}),rs.set(s[l],{yPercent:-100,y:0}),t=!0,n.forEach((t=>{t.classList.remove("current")})),n[l].classList.add("current"),document.querySelector(".header__menu-toggle").classList.remove("hide"),document.querySelector(".header").classList.remove("hide")}}).addLabel("start").to(".moodboard",{duration:3,ease:"power2.inOut",background:()=>r[l].dataset.bg},"start").to(r[e].querySelectorAll(".moodboard__imgCol"),{yPercent:100,duration:3,scale:.5,stagger:{each:.2,from:"edges"}},"start").to(r[l].querySelectorAll(".moodboard__imgCol"),{yPercent:0,y:0,scale:1,duration:3,stagger:{from:"edges",each:.2}},"start").to(".moodboard__img--s img",{yPercent:0,y:0,duration:3,ease:"power2.inOut"},"start").to(r[e],{yPercent:100,opacity:0,duration:3,ease:"power2.inOut"},"start").to(r[l],{yPercent:0,y:0,opacity:1,duration:3,ease:"power2.inOut"},"start").to(i[e],{yPercent:100,duration:3,ease:"power2.inOut"},"start").to(i[l],{yPercent:0,y:0,duration:3,ease:"power2.inOut"},"start").to(s[e],{yPercent:100,duration:3,ease:"power2.inOut"},"start").to(s[l],{yPercent:0,y:0,duration:3,ease:"power2.inOut"},"start")}else eT.start(),o.disable()}eT.start(),o.disable(),xc.create({trigger:".moodboard",start:"top-=1 top",end:"+=1",markers:!1,onEnter:()=>{eT.stop(),o.enable()},onEnterBack:()=>{eT.stop(),eT.scrollTo(".moodboard",{duration:2,lock:!0,force:!0}),o.enable()}}),document.querySelector(".moodboard__over-ctaOP").addEventListener("click",(()=>{o.disable()})),document.querySelector(".gform__close").addEventListener("click",(()=>{o.enable()})),document.querySelector(".header__menu-toggle").addEventListener("click",(()=>{document.querySelector(".header__menu-toggle").classList.contains("active")?o.enable():setTimeout((()=>{o.disable()}),100)})),n.forEach((r=>{r.addEventListener("click",(()=>{const i=function(t){const e=t.parentNode.childNodes;let r=0;for(let i=0;i{eT.stop(),eT.scrollTo(".moodboard",{duration:3,lock:!0,force:!0})},scrollTrigger:{trigger:".moodboard",start:"center bottom",markers:!1}}),rs.to(".moodboard__title--current",{yPercent:0,y:0,duration:2,ease:"power2.inOut",scrollTrigger:{trigger:".moodboard",start:"center bottom",markers:!1}}),rs.to(".moodboard__cta--current",{yPercent:0,y:0,duration:2,ease:"power2.inOut",scrollTrigger:{trigger:".moodboard",start:"center bottom",markers:!1}}),rs.to(document.querySelectorAll(".moodboard__slide--current .moodboard__imgCol"),{yPercent:0,y:0,duration:3,opacity:1,scale:1,stagger:{each:.2,from:"edges"},scrollTrigger:{trigger:".moodboard",start:"center bottom",markers:!1}});let l=!1;s.forEach((t=>{const e=t.querySelector("a");e.addEventListener("click",(()=>{if(0==l){l=!0;const t=document.querySelector(e.dataset.comp),r=t.querySelector(".moodboard__over-wrap");document.querySelector(".header").classList.add("hide"),o.disable(),rs.to(t,{xPercent:0,x:0,duration:2,ease:"power2.inOut"}),rs.to(r,{opacity:1,delay:1,duration:2,ease:"power2.inOut",onComplete:()=>{t.classList.add("active"),l=!1}})}}))})),document.querySelectorAll(".moodboard__over-close").forEach((t=>{t.addEventListener("click",(()=>{if(0==l){l=!0;const t=document.querySelector(".moodboard__over.active");rs.to(t,{xPercent:100,delay:1,duration:2,ease:"power2.inOut",onComplete:()=>{t.classList.remove("active"),l=!1,o.enable()}}),rs.to(t.querySelector(".moodboard__over-wrap"),{opacity:0,duration:2,ease:"power2.inOut"})}}))}))}onLeaveCompleted(){eT.start()}}Ad(),rs.registerPlugin(lu,xc);const IE=rs.matchMedia();let FE=!0;IE.add("(min-width: 992px)",(()=>{FE=!1}));class ME extends c.Renderer{onEnter(){}onLeave(){}onEnterCompleted(){if(1==yu){rs.timeline({onComplete:()=>{eT.start()}}).add("start").to(".header__logo",{opacity:1,duration:2,ease:"power2.inOut"},"start").to(".header__left-menu",{opacity:1,duration:2,ease:"power2.inOut"},"start").to(".header__right-menu",{opacity:1,duration:2,ease:"power2.inOut"},"start"),rs.set(".header__logo",{left:0}),rs.to(".header__menu-toggle",{opacity:1,duration:2,ease:"power2.inOut"}),rs.set(".header__logo svg",{scale:1,y:0,x:()=>{if(FE)return 0}})}else document.dispatchEvent(new Event("DOMContentLoadedCustom"));if(document.querySelectorAll(".freedom-hero__s").length>0){const t=new lu(".freedom-hero__t",{type:"lines",linesClass:"lineChild"}),e=new lu(".freedom-hero__t",{type:"lines",linesClass:"lineParent"}),r=new lu(".freedom-hero__s",{type:"lines",linesClass:"lineChild"}),i=new lu(".freedom-hero__s",{type:"lines",linesClass:"lineParent"});rs.set(e.lines,{overflow:"hidden"}),rs.set(t.lines,{yPercent:100}),rs.set(i.lines,{overflow:"hidden"}),rs.set(r.lines,{yPercent:100});rs.timeline().add("start").to(t.lines,{yPercent:0,delay:.5,duration:1.5,ease:"power2.inOut",stagger:{each:.1}},"start").to(r.lines,{yPercent:0,delay:.5,duration:1.5,ease:"power2.inOut",stagger:{each:.1}},"start"),document.querySelectorAll(".freedom-hero__c").length>0&&(rs.set(".freedom-hero__c",{opacity:0,blur:4,yPercent:5}),rs.to(".freedom-hero__c",{opacity:1,yPercent:0,blur:0,delay:1}))}document.querySelectorAll(".news-grid__box").length>0&&(rs.set(".news-grid__filters",{opacity:0,yPercent:25}),rs.to(".news-grid__filters",{opacity:1,yPercent:0,duration:2,delay:.5,ease:"power2.inOut"}),document.querySelectorAll(".news-grid__box").forEach(((t,e)=>{e>1&&(rs.set(t,{opacity:0,yPercent:15}),rs.set(t.querySelector("img"),{scale:1.125}),rs.to(t,{opacity:1,yPercent:0,duration:2,ease:"power2.inOut",scrollTrigger:{trigger:t,start:"top bottom"}}),rs.to(t.querySelector("img"),{scale:1,duration:2,ease:"power2.inOut",onComplete:()=>{rs.set(t.querySelector("img"),{clearProps:"all"})},scrollTrigger:{trigger:t,start:"top bottom"}}))}))),document.querySelectorAll(".video-grid__box").length>0&&(rs.set(".video-grid__filters",{opacity:0,yPercent:25}),rs.to(".video-grid__filters",{opacity:1,yPercent:0,duration:2,delay:.5,ease:"power2.inOut"}),document.querySelector(".video-fs__close").addEventListener("click",(()=>{const t=document.querySelector(".video-fs__wrap");rs.to(".video-fs",{opacity:0,onComplete:()=>{t.innerHTML="",document.querySelector(".video-fs").classList.remove("active")}})})),document.querySelectorAll(".video-grid__box").forEach((t=>{t.addEventListener("click",(()=>{const e=t.querySelector(".video-iframe__wrap").cloneNode(!0),r=document.querySelector(".video-fs__wrap");document.querySelector(".video-fs").classList.add("active"),r.innerHTML="",r.append(e),rs.to(".video-fs",{opacity:1})})),rs.set(t,{opacity:0,yPercent:15}),rs.set(t.querySelector("img"),{scale:1.125}),rs.to(t,{opacity:1,yPercent:0,duration:2,ease:"power2.inOut",scrollTrigger:{trigger:t,start:"top bottom"}}),rs.to(t.querySelector("img"),{scale:1,duration:2,ease:"power2.inOut",onComplete:()=>{rs.set(t.querySelector("img"),{clearProps:"all"})},scrollTrigger:{trigger:t,start:"top bottom"}})}))),document.querySelectorAll(".top-news-image").length>0&&(rs.set(".top-news-image",{opacity:0,yPercent:25}),rs.to(".top-news-image",{opacity:1,yPercent:0,duration:2,delay:.5,ease:"power2.inOut"})),document.querySelectorAll(".project-hero").length>0&&setTimeout((()=>{xc.create({trigger:".project-hero",start:"top top",pinSpacing:!1,pin:!0,markers:!1,end:"+=100%"}),rs.to(".projects-block__img--c",{scale:1.25,scrollTrigger:{start:"top top",end:"+=100%",scrub:!0}}),rs.to(".project-hero__title span",{y:0,yPercent:0,duration:1.5,ease:"power2.inOut"})}),250),rs.to(".site__wrap",{opacity:1}),xc.refresh()}onLeaveCompleted(){}}rs.registerPlugin(xc,Dd);class OE extends c.Transition{in(t){let{from:e,to:r,trigger:i,done:s}=t;window.scrollTo(0,0),eT.scrollTo(0,{immediate:!0}),setTimeout((()=>{document.body.classList.remove("wait"),s()}),100)}out(t){let{from:e,trigger:r,done:i}=t;document.body.classList.add("wait"),rs.to(".site__wrap",{opacity:0,duration:1,onComplete:()=>{window.scrollTo(0,0),eT.scrollTo(0,{immediate:!0}),document.body.classList.remove("wait");xc.getAll().forEach((t=>{t.kill()})),e.remove(),i()}})}}rs.registerPlugin(lu,xc);const NE=rs.matchMedia();let BE=!0;NE.add("(min-width: 992px)",(()=>{BE=!1}));class UE extends c.Renderer{onEnter(){}onLeave(){}onEnterCompleted(){if(1==yu){rs.timeline({onComplete:()=>{eT.start()}}).add("start").to(".header__logo",{opacity:1,duration:2,ease:"power2.inOut"},"start").to(".header__left-menu",{opacity:1,duration:2,ease:"power2.inOut"},"start").to(".header__right-menu",{opacity:1,duration:2,ease:"power2.inOut"},"start"),rs.set(".header__logo",{left:0}),rs.to(".header__menu-toggle",{opacity:1,duration:2,ease:"power2.inOut"}),rs.set(".header__logo svg",{scale:1,y:0,x:()=>{if(BE)return 0}})}else document.dispatchEvent(new Event("DOMContentLoadedCustom"));rs.to(".site__wrap",{opacity:1}),rs.set(".projects-block__img--1,.projects-block__img--2",{opacity:0,yPercent:25,scale:.75}),rs.set(".projects__filters",{opacity:0,yPercent:25});const t=new lu(".hero-1__title",{type:"lines",linesClass:"lineChild"}),e=new lu(".hero-1__title",{type:"lines",linesClass:"lineParent"}),r=new lu(".hero-1__sub",{type:"lines",linesClass:"lineChild"}),i=new lu(".hero-1__sub",{type:"lines",linesClass:"lineParent"});rs.set(e.lines,{overflow:"hidden"}),rs.set(t.lines,{yPercent:100}),rs.set(i.lines,{overflow:"hidden"}),rs.set(r.lines,{yPercent:100});rs.timeline().add("start").to(t.lines,{yPercent:0,duration:1.5,ease:"power2.inOut",stagger:{each:.1}},"start").to(r.lines,{yPercent:0,duration:1.5,delay:.25,ease:"power2.inOut",stagger:{each:.2}},"start").to(".projects-block__img--1,.projects-block__img--2",{yPercent:0,scale:1,opacity:1,duration:2,ease:"power2.inOut"},"start").to(".projects__filters",{opacity:1,yPercent:0,duration:2,ease:"power2.inOut"},"start"),setTimeout((()=>{xc.create({trigger:".projects-top",endTrigger:".projects-grid__ct",start:"top top",pin:".projects__filters-ct",pinSpacing:!1,markers:!1,end:"bottom bottom"}),rs.utils.toArray(".projects-block__img--c").forEach((t=>{const e=t.dataset.image,r=()=>{e&&(t.src=e)};xc.create({trigger:t,start:"-100% bottom",onEnter:r,onEnterBack:r})}))}),100)}onLeaveCompleted(){}}rs.registerPlugin(xc),rs.registerPlugin(Dd);class $E extends c.Transition{in(t){let{from:e,to:r,trigger:i,done:s}=t;if("popstate"!=i&&i.classList.contains("retrans")){const t=i,n=Dd.getState(t),o=i.parentNode.clientHeight+1;rs.set(i.parentNode,{height:o}),eT.stop(),r.querySelector(".project-hero__img-ct").innerHTML="",document.querySelector(".transition").append(r.querySelector(".project-hero")),document.querySelector(".transition").querySelector(".project-hero__img-ct").append(t),Dd.fit(".project-hero__img-ct",n),rs.to(e,{opacity:0}),rs.to(".project-hero__img-ct .parallax-mask",{x:0,y:0,yPercent:0,xPercent:0,scale:1,duration:1.5,overwrite:!0,ease:"power1.inOut",onComplete:()=>{const t=document.querySelector(".project-hero__img-ct .parallax-mask");t.classList.remove("parallax-mask"),t.classList.add("wh-100")}}),rs.to(".project-hero__img-ct .dolly",{x:0,y:0,scale:1,duration:1.5,ease:"power1.inOut",onComplete:()=>{const t=document.querySelector(".project-hero__img-ct .dolly");t.classList.remove("dolly"),t.classList.add("wh-100")}}),rs.to(".project-hero__img-ct",{x:0,y:0,width:"100%",height:"100%",duration:1.5,ease:"power1.inOut",onComplete:()=>{xc.getAll().forEach((t=>{t.kill()})),e.remove(),window.scrollTo(0,0),eT.scrollTo(0,{immediate:!0});const t=document.querySelector(".project-hero"),i=t.cloneNode(!0);r.querySelector(".project-top").append(i),document.body.classList.remove("wait"),setTimeout((()=>{rs.to(".transition",{opacity:0,delay:.5,onComplete:()=>{document.querySelector(".transition").innerHTML="",eT.start(),rs.set(".transition",{clearProps:"all"})}}),s(),t.remove()}),250)}})}else"popstate"==i&&(rs.set(".advice-hero",{background:"#FFF"}),rs.set(".advice-hero__image",{opacity:0,yPercent:10}),rs.to(".advice-hero__sub span",{y:0,delay:.5,duration:.75}),rs.to(".advice-hero__qub span",{y:0,delay:.5,duration:.75}),rs.to(".advice-hero__title span",{y:0,delay:.5,duration:1}),rs.to(".advice-hero__image",{yPercent:0,opacity:1,delay:.5,duration:1})),window.scrollTo(0,0),eT.scrollTo(0,{immediate:!0}),setTimeout((()=>{document.body.classList.remove("wait"),s()}),100)}out(t){let{from:e,trigger:r,done:i}=t;document.body.classList.add("wait"),"popstate"!=r&&r.classList.contains("retrans")?i():rs.to(".site__wrap",{opacity:0,duration:1,onComplete:()=>{window.scrollTo(0,0),eT.scrollTo(0,{immediate:!0}),document.body.classList.remove("wait"),e.remove(),i()}})}}class qE{constructor(t){const e=rs.matchMedia();let r=!0;e.add("(min-width: 992px)",(()=>{r=!1}));const i=t,s=t.querySelectorAll(".scarousel--item"),n=t.parentNode.querySelector(".scarousel-index");let o=i.clientWidth,a=0;s.forEach((t=>{a+=t.clientWidth}));let l=0,c=0,u=0,d=0;u={value:0};let h=0,f=0,p=!1,g=!0;const m=t=>{h=t.clientX||t.touches[0].clientX,p=!0,i.classList.add("is-dragging"),rs.to(s,{scale:.9})},y=t=>{p&&(f=t.clientX||t.touches[0].clientX,u.value+=2.5*(f-h),h=f)},v=()=>{g=!0,p=!1,i.classList.remove("is-dragging"),rs.to(s,{scale:1}),setTimeout((()=>{s.forEach((t=>{(function(t){const e=t.getBoundingClientRect();return e.top>=0&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth)})(t)&&(n.innerHTML=t.dataset.item)}))}),100)};i.addEventListener("touchstart",m,{passive:!0}),i.addEventListener("touchmove",y,{passive:!0}),i.addEventListener("touchend",v),i.addEventListener("mousedown",m),i.addEventListener("mousemove",y),i.addEventListener("mouseleave",v),i.addEventListener("mouseenter",(()=>{g=!1})),i.addEventListener("mouseup",v),i.addEventListener("selectstart",(()=>!1)),t.parentNode.querySelector(".scarousel-next").addEventListener("click",(()=>{let t=parseInt(n.innerHTML);const e=s[t-1].getBoundingClientRect();t==s.length?t=1:t++;let r=s[0].clientWidth;e.left+e.width/2<=10+window.innerWidth/2&&e.left+e.width/2>=window.innerWidth/2-10||(r+=-(window.innerWidth/2-(e.left+e.width/2)));rs.timeline({}).to(s,{scale:.9,duration:.4}).to(u,{value:"-="+r,duration:.8,ease:"power2.inOut"}).to(s,{scale:1,duration:.4}),n.innerHTML=t})),t.parentNode.querySelector(".scarousel-prev").addEventListener("click",(()=>{let t=parseInt(n.innerHTML);const e=s[t-1].getBoundingClientRect();1==t?t=s.length:t--;let r=s[0].clientWidth;e.left+e.width/2<=10+window.innerWidth/2&&e.left+e.width/2>=window.innerWidth/2-10||(r-=-(window.innerWidth/2-(e.left+e.width/2)));rs.timeline({}).to(s,{scale:.9,duration:.4}).to(u,{value:"+="+r,duration:.8,ease:"power2.inOut"}).to(s,{scale:1,duration:.4}),n.innerHTML=t})),window.addEventListener("resize",(()=>{o=i.clientWidth;let t=0;s.forEach((e=>{t+=e.clientWidth}))}));const _=()=>{var t;this.raf=requestAnimationFrame(_),d=parseInt(((t,e,r)=>t*(1-r)+e*r)(d,u.value,.1)),t=d,rs.set(s,{x:e=>{let r=0;e>0&&(r=1);let i=0;for(let t=0;t`${rs.utils.wrap(-o,a-o,parseInt(t))}px`}}),l=d-c,c=d};_()}destroy(){cancelAnimationFrame(this.raf)}}function GE(t,e,r){return Math.max(t,Math.min(e,r))}class HE{advance(t){if(!this.isRunning)return;let e=!1;if(this.lerp)this.value=(r=this.value,i=this.to,s=60*this.lerp,n=t,function(t,e,r){return(1-r)*t+r*e}(r,i,1-Math.exp(-s*n))),Math.round(this.value)===this.to&&(this.value=this.to,e=!0);else{this.currentTime+=t;const r=GE(0,this.currentTime/this.duration,1);e=r>=1;const i=e?1:this.easing(r);this.value=this.from+(this.to-this.from)*i}var r,i,s,n;this.onUpdate?.(this.value,e),e&&this.stop()}stop(){this.isRunning=!1}fromTo(t,e,{lerp:r=.1,duration:i=1,easing:s=t=>t,onStart:n,onUpdate:o}){this.from=this.value=t,this.to=e,this.lerp=r,this.duration=i,this.easing=s,this.currentTime=0,this.isRunning=!0,n?.(),this.onUpdate=o}}class VE{constructor({wrapper:t,content:e,autoResize:r=!0,debounce:i=250}={}){this.wrapper=t,this.content=e,r&&(this.debouncedResize=function(t,e){let r;return function(){let i=arguments,s=this;clearTimeout(r),r=setTimeout((function(){t.apply(s,i)}),e)}}(this.resize,i),this.wrapper===window?window.addEventListener("resize",this.debouncedResize,!1):(this.wrapperResizeObserver=new ResizeObserver(this.debouncedResize),this.wrapperResizeObserver.observe(this.wrapper)),this.contentResizeObserver=new ResizeObserver(this.debouncedResize),this.contentResizeObserver.observe(this.content)),this.resize()}destroy(){this.wrapperResizeObserver?.disconnect(),this.contentResizeObserver?.disconnect(),window.removeEventListener("resize",this.debouncedResize,!1)}resize=()=>{this.onWrapperResize(),this.onContentResize()};onWrapperResize=()=>{this.wrapper===window?(this.width=window.innerWidth,this.height=window.innerHeight):(this.width=this.wrapper.clientWidth,this.height=this.wrapper.clientHeight)};onContentResize=()=>{this.wrapper===window?(this.scrollHeight=this.content.scrollHeight,this.scrollWidth=this.content.scrollWidth):(this.scrollHeight=this.wrapper.scrollHeight,this.scrollWidth=this.wrapper.scrollWidth)};get limit(){return{x:this.scrollWidth-this.width,y:this.scrollHeight-this.height}}}class KE{constructor(){this.events={}}emit(t,...e){let r=this.events[t]||[];for(let t=0,i=r.length;t{this.events[t]=this.events[t]?.filter((t=>e!==t))}}off(t,e){this.events[t]=this.events[t]?.filter((t=>e!==t))}destroy(){this.events={}}}const WE=100/6;class zE{constructor(t,{wheelMultiplier:e=1,touchMultiplier:r=1}){this.element=t,this.wheelMultiplier=e,this.touchMultiplier=r,this.touchStart={x:null,y:null},this.emitter=new KE,window.addEventListener("resize",this.onWindowResize,!1),this.onWindowResize(),this.element.addEventListener("wheel",this.onWheel,{passive:!1}),this.element.addEventListener("touchstart",this.onTouchStart,{passive:!1}),this.element.addEventListener("touchmove",this.onTouchMove,{passive:!1}),this.element.addEventListener("touchend",this.onTouchEnd,{passive:!1})}on(t,e){return this.emitter.on(t,e)}destroy(){this.emitter.destroy(),window.removeEventListener("resize",this.onWindowResize,!1),this.element.removeEventListener("wheel",this.onWheel,{passive:!1}),this.element.removeEventListener("touchstart",this.onTouchStart,{passive:!1}),this.element.removeEventListener("touchmove",this.onTouchMove,{passive:!1}),this.element.removeEventListener("touchend",this.onTouchEnd,{passive:!1})}onTouchStart=t=>{const{clientX:e,clientY:r}=t.targetTouches?t.targetTouches[0]:t;this.touchStart.x=e,this.touchStart.y=r,this.lastDelta={x:0,y:0},this.emitter.emit("scroll",{deltaX:0,deltaY:0,event:t})};onTouchMove=t=>{const{clientX:e,clientY:r}=t.targetTouches?t.targetTouches[0]:t,i=-(e-this.touchStart.x)*this.touchMultiplier,s=-(r-this.touchStart.y)*this.touchMultiplier;this.touchStart.x=e,this.touchStart.y=r,this.lastDelta={x:i,y:s},this.emitter.emit("scroll",{deltaX:i,deltaY:s,event:t})};onTouchEnd=t=>{this.emitter.emit("scroll",{deltaX:this.lastDelta.x,deltaY:this.lastDelta.y,event:t})};onWheel=t=>{let{deltaX:e,deltaY:r,deltaMode:i}=t;e*=1===i?WE:2===i?this.windowWidth:1,r*=1===i?WE:2===i?this.windowHeight:1,e*=this.wheelMultiplier,r*=this.wheelMultiplier,this.emitter.emit("scroll",{deltaX:e,deltaY:r,event:t})};onWindowResize=()=>{this.windowWidth=window.innerWidth,this.windowHeight=window.innerHeight}}class jE{constructor({wrapper:t=window,content:e=document.documentElement,wheelEventsTarget:r=t,eventsTarget:i=r,smoothWheel:s=!0,syncTouch:n=!1,syncTouchLerp:o=.075,touchInertiaMultiplier:a=35,duration:l,easing:c=t=>Math.min(1,1.001-Math.pow(2,-10*t)),lerp:u=!l&&.1,infinite:d=!1,orientation:h="vertical",gestureOrientation:f="vertical",touchMultiplier:p=1,wheelMultiplier:g=1,autoResize:m=!0,__experimental__naiveDimensions:y=!1}={}){this.__isSmooth=!1,this.__isScrolling=!1,this.__isStopped=!1,this.__isLocked=!1,this.onVirtualScroll=({deltaX:t,deltaY:e,event:r})=>{if(r.ctrlKey)return;const i=r.type.includes("touch"),s=r.type.includes("wheel");if(this.options.syncTouch&&i&&"touchstart"===r.type&&!this.isStopped&&!this.isLocked)return void this.reset();const n=0===t&&0===e,o="vertical"===this.options.gestureOrientation&&0===e||"horizontal"===this.options.gestureOrientation&&0===t;if(n||o)return;let a=r.composedPath();if(a=a.slice(0,a.indexOf(this.rootElement)),a.find((t=>{var e,r,n,o,a;return(null===(e=t.hasAttribute)||void 0===e?void 0:e.call(t,"data-lenis-prevent"))||i&&(null===(r=t.hasAttribute)||void 0===r?void 0:r.call(t,"data-lenis-prevent-touch"))||s&&(null===(n=t.hasAttribute)||void 0===n?void 0:n.call(t,"data-lenis-prevent-wheel"))||(null===(o=t.classList)||void 0===o?void 0:o.contains("lenis"))&&!(null===(a=t.classList)||void 0===a?void 0:a.contains("lenis-stopped"))})))return;if(this.isStopped||this.isLocked)return void r.preventDefault();if(this.isSmooth=this.options.syncTouch&&i||this.options.smoothWheel&&s,!this.isSmooth)return this.isScrolling=!1,void this.animate.stop();r.preventDefault();let l=e;"both"===this.options.gestureOrientation?l=Math.abs(e)>Math.abs(t)?e:t:"horizontal"===this.options.gestureOrientation&&(l=t);const c=i&&this.options.syncTouch,u=i&&"touchend"===r.type&&Math.abs(l)>5;u&&(l=this.velocity*this.options.touchInertiaMultiplier),this.scrollTo(this.targetScroll+l,Object.assign({programmatic:!1},c?{lerp:u?this.options.syncTouchLerp:1}:{lerp:this.options.lerp,duration:this.options.duration,easing:this.options.easing}))},this.onNativeScroll=()=>{if(!this.__preventNextScrollEvent&&!this.isScrolling){const t=this.animatedScroll;this.animatedScroll=this.targetScroll=this.actualScroll,this.velocity=0,this.direction=Math.sign(this.animatedScroll-t),this.emit()}},window.lenisVersion="1.0.42",t!==document.documentElement&&t!==document.body||(t=window),this.options={wrapper:t,content:e,wheelEventsTarget:r,eventsTarget:i,smoothWheel:s,syncTouch:n,syncTouchLerp:o,touchInertiaMultiplier:a,duration:l,easing:c,lerp:u,infinite:d,gestureOrientation:f,orientation:h,touchMultiplier:p,wheelMultiplier:g,autoResize:m,__experimental__naiveDimensions:y},this.animate=new HE,this.emitter=new KE,this.dimensions=new VE({wrapper:t,content:e,autoResize:m}),this.toggleClassName("lenis",!0),this.velocity=0,this.isLocked=!1,this.isStopped=!1,this.isSmooth=n||s,this.isScrolling=!1,this.targetScroll=this.animatedScroll=this.actualScroll,this.options.wrapper.addEventListener("scroll",this.onNativeScroll,!1),this.virtualScroll=new zE(i,{touchMultiplier:p,wheelMultiplier:g}),this.virtualScroll.on("scroll",this.onVirtualScroll)}destroy(){this.emitter.destroy(),this.options.wrapper.removeEventListener("scroll",this.onNativeScroll,!1),this.virtualScroll.destroy(),this.dimensions.destroy(),this.toggleClassName("lenis",!1),this.toggleClassName("lenis-smooth",!1),this.toggleClassName("lenis-scrolling",!1),this.toggleClassName("lenis-stopped",!1),this.toggleClassName("lenis-locked",!1)}on(t,e){return this.emitter.on(t,e)}off(t,e){return this.emitter.off(t,e)}setScroll(t){this.isHorizontal?this.rootElement.scrollLeft=t:this.rootElement.scrollTop=t}resize(){this.dimensions.resize()}emit(){this.emitter.emit("scroll",this)}reset(){this.isLocked=!1,this.isScrolling=!1,this.animatedScroll=this.targetScroll=this.actualScroll,this.velocity=0,this.animate.stop()}start(){this.isStopped&&(this.isStopped=!1,this.reset())}stop(){this.isStopped||(this.isStopped=!0,this.animate.stop(),this.reset())}raf(t){const e=t-(this.time||t);this.time=t,this.animate.advance(.001*e)}scrollTo(t,{offset:e=0,immediate:r=!1,lock:i=!1,duration:s=this.options.duration,easing:n=this.options.easing,lerp:o=!s&&this.options.lerp,onComplete:a,force:l=!1,programmatic:c=!0}={}){if(!this.isStopped&&!this.isLocked||l){if(["top","left","start"].includes(t))t=0;else if(["bottom","right","end"].includes(t))t=this.limit;else{let r;if("string"==typeof t?r=document.querySelector(t):(null==t?void 0:t.nodeType)&&(r=t),r){if(this.options.wrapper!==window){const t=this.options.wrapper.getBoundingClientRect();e-=this.isHorizontal?t.left:t.top}const i=r.getBoundingClientRect();t=(this.isHorizontal?i.left:i.top)+this.animatedScroll}}if("number"==typeof t){if(t+=e,t=Math.round(t),this.options.infinite?c&&(this.targetScroll=this.animatedScroll=this.scroll):t=GE(0,t,this.limit),r)return this.animatedScroll=this.targetScroll=t,this.setScroll(this.scroll),this.reset(),void(null==a||a(this));if(!c){if(t===this.targetScroll)return;this.targetScroll=t}this.animate.fromTo(this.animatedScroll,t,{duration:s,easing:n,lerp:o,onStart:()=>{i&&(this.isLocked=!0),this.isScrolling=!0},onUpdate:(t,e)=>{this.isScrolling=!0,this.velocity=t-this.animatedScroll,this.direction=Math.sign(this.velocity),this.animatedScroll=t,this.setScroll(this.scroll),c&&(this.targetScroll=t),e||this.emit(),e&&(this.reset(),this.emit(),null==a||a(this),this.__preventNextScrollEvent=!0,requestAnimationFrame((()=>{delete this.__preventNextScrollEvent})))}})}}}get rootElement(){return this.options.wrapper===window?document.documentElement:this.options.wrapper}get limit(){return this.options.__experimental__naiveDimensions?this.isHorizontal?this.rootElement.scrollWidth-this.rootElement.clientWidth:this.rootElement.scrollHeight-this.rootElement.clientHeight:this.dimensions.limit[this.isHorizontal?"x":"y"]}get isHorizontal(){return"horizontal"===this.options.orientation}get actualScroll(){return this.isHorizontal?this.rootElement.scrollLeft:this.rootElement.scrollTop}get scroll(){return this.options.infinite?(this.animatedScroll%(t=this.limit)+t)%t:this.animatedScroll;var t}get progress(){return 0===this.limit?1:this.scroll/this.limit}get isSmooth(){return this.__isSmooth}set isSmooth(t){this.__isSmooth!==t&&(this.__isSmooth=t,this.toggleClassName("lenis-smooth",t))}get isScrolling(){return this.__isScrolling}set isScrolling(t){this.__isScrolling!==t&&(this.__isScrolling=t,this.toggleClassName("lenis-scrolling",t))}get isStopped(){return this.__isStopped}set isStopped(t){this.__isStopped!==t&&(this.__isStopped=t,this.toggleClassName("lenis-stopped",t))}get isLocked(){return this.__isLocked}set isLocked(t){this.__isLocked!==t&&(this.__isLocked=t,this.toggleClassName("lenis-locked",t))}get className(){let t="lenis";return this.isStopped&&(t+=" lenis-stopped"),this.isLocked&&(t+=" lenis-locked"),this.isScrolling&&(t+=" lenis-scrolling"),this.isSmooth&&(t+=" lenis-smooth"),t}toggleClassName(t,e){this.rootElement.classList.toggle(t,e),this.emitter.emit("className change",this)}}Ad(),rs.registerPlugin(lu,xc);const YE=rs.matchMedia();let XE=!0;YE.add("(min-width: 992px)",(()=>{XE=!1}));class QE extends c.Renderer{onEnter(){document.querySelectorAll("#gmap").length>0&&(window.mappa=new uh)}onLeave(){}onEnterCompleted(){if(1==yu){rs.timeline({onComplete:()=>{eT.start()}}).add("start").to(".header__logo",{opacity:1,duration:2,ease:"power2.inOut"},"start").to(".header__left-menu",{opacity:1,duration:2,ease:"power2.inOut"},"start").to(".header__right-menu",{opacity:1,duration:2,ease:"power2.inOut"},"start"),rs.set(".header__logo",{left:0}),rs.to(".header__menu-toggle",{opacity:1,duration:2,ease:"power2.inOut"}),rs.set(".header__logo svg",{scale:1,y:0,x:()=>{if(XE)return 0}})}else document.dispatchEvent(new Event("DOMContentLoadedCustom"));if(document.querySelectorAll(".freedom-hero__s").length>0){const t=new lu(".freedom-hero__t",{type:"lines",linesClass:"lineChild"}),e=new lu(".freedom-hero__t",{type:"lines",linesClass:"lineParent"}),r=new lu(".freedom-hero__s",{type:"lines",linesClass:"lineChild"}),i=new lu(".freedom-hero__s",{type:"lines",linesClass:"lineParent"});rs.set(e.lines,{overflow:"hidden"}),rs.set(t.lines,{yPercent:100}),rs.set(i.lines,{overflow:"hidden"}),rs.set(r.lines,{yPercent:100});rs.timeline().add("start").to(t.lines,{yPercent:0,delay:.5,duration:1.5,ease:"power2.inOut",stagger:{each:.1}},"start").to(r.lines,{yPercent:0,delay:.5,duration:1.5,ease:"power2.inOut",stagger:{each:.1}},"start")}window.selectRange=new gh("select-range"),rs.to(".site__wrap",{opacity:1}),rs.set(".block-map__wrap",{opacity:0,yPercent:10}),rs.to(".block-map__wrap",{opacity:1,yPercent:0,duration:2,delay:.5,ease:"power2.inOut"});const t=document.querySelector(".contactform_cta--r");if(document.querySelectorAll(".contactform_cta--r").length>0){t.addEventListener("click",(()=>{if(t.classList.contains("pchecked")){Cd(document.querySelector(".submit-ctr input")),rs.to(".privacy-error--cfr",{opacity:0})}else rs.to(".privacy-error--cfr",{opacity:1})}));document.getElementById("p-checkbox-fcr").addEventListener("change",(e=>{!0===e.target.checked&&t.classList.add("pchecked"),!1===e.target.checked&&t.classList.remove("pchecked")}))}let e=!1;document.querySelector("#gmap")&&(document.querySelector("#gmap").addEventListener("mouseenter",(()=>{e=!0})),document.querySelector("#gmap").addEventListener("mouseleave",(()=>{e=!1}))),document.addEventListener("keydown",(function(t){"Meta"==t.key&&1==e&&eT.stop()})),document.addEventListener("keyup",(function(t){"Meta"==t.key&&eT.start()}))}onLeaveCompleted(){}}class ZE{constructor(t){let e=rs.matchMedia(),r=!0;e.add("(min-width: 992px)",(()=>{r=!1}));const i=t.querySelector(".tcarousel"),s=i.querySelectorAll(".tcarousel--item"),n=i.querySelectorAll(".tcarousel--item div"),o=t.querySelector(".tcarousel-index"),a=t.querySelector(".tcarousel-total");let l=i.clientWidth,c=s[0].clientWidth,u=s.length*c,d=0,h=0,f=0,p=0;f={value:0};let g=0,m=0,y=!1,v=!1;const _=t=>{g=t.clientX||t.touches[0].clientX,y=!0,i.classList.add("is-dragging"),rs.to(s,{scale:.9,delay:.1})},E=t=>{y?(v=!0,m=t.clientX||t.touches[0].clientX,f.value+=2.5*(m-g),g=m):v=!1},T=()=>{y=!1,i.classList.remove("is-dragging"),rs.to(s,{scale:1}),setTimeout((()=>{s.forEach((t=>{(function(t){var e=t.getBoundingClientRect();return e.top>=0&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth)})(t)&&(o.innerHTML=t.dataset.item)}))}),100)};i.addEventListener("touchstart",_,{passive:!0}),i.addEventListener("touchmove",E),i.addEventListener("touchend",T),i.addEventListener("mousedown",_),i.addEventListener("mousemove",E),i.addEventListener("mouseleave",T),i.addEventListener("mouseup",T),n.forEach((t=>{let e=t.querySelector("a");t.addEventListener("click",(()=>{i.classList.contains("is-dragging")||0==v&&kd(e)}))})),i.addEventListener("selectstart",(()=>!1)),t.querySelector(".tcarousel-next").addEventListener("click",(()=>{let t=parseInt(o.innerHTML);s[t-1].getBoundingClientRect();t==parseInt(a.innerHTML)?t=1:t++;var e=s[0].clientWidth;rs.timeline({}).to(s,{scale:.9,duration:.4}).to(f,{value:"-="+e,duration:.8,ease:"power2.inOut"}).to(s,{scale:1,duration:.4}),o.innerHTML=t})),t.querySelector(".tcarousel-prev").addEventListener("click",(()=>{let t=parseInt(o.innerHTML);s[t-1].getBoundingClientRect();1==t?t=parseInt(a.innerHTML):t--;var e=s[0].clientWidth;rs.timeline({}).to(s,{scale:.9,duration:.4}).to(f,{value:"+="+e,duration:.8,ease:"power2.inOut"}).to(s,{scale:1,duration:.4}),o.innerHTML=t})),window.addEventListener("resize",(()=>{l=i.clientWidth,c=s[0].clientWidth,u=s.length*c}));const w=()=>{var t;requestAnimationFrame(w),p=parseInt(((t,e,r)=>t*(1-r)+e*r)(p,f.value,.1)),t=p,rs.set(s,{x:e=>e*c+t,modifiers:{x:(t,e)=>`${rs.utils.wrap(-c,u-c,parseInt(t))}px`}}),d=p-h,h=p};w()}}const JE=WEBSITE_OPTIONS?.ui?.scroll?.smooth??!1;Ad(),rs.config({nullTargetWarn:!1});const tT="#FFF";rs.registerPlugin(xc,lu,Uo,jn,vs);new class{constructor(){this.assetLoadPromises=[],this.loadFonts();document.querySelectorAll("img").forEach(((t,e)=>{let r;t.dataset?.nopreload||(""!=t.src?r=this.loadImage(t.src):(r=this.loadImage(t.dataset.preload),r.then((()=>{mu()&&void 0!==t.dataset.webp?t.src=t.dataset.webp:t.src=t.dataset.preload}))),this.assetLoadPromises.push(r))}));const t=rs.timeline({onComplete:function(){yu=!1,window.dispatchEvent(new Event("endloading"))},onStart:function(){rs.set(".loading",{opacity:1}),rs.set(".loading",{display:"flex"})},paused:!0});t.add("start").to(".loading",{opacity:0,duration:.4},"start").set(".loading",{display:"none"}),Promise.all(this.assetLoadPromises).then((()=>{t.play()})),this.allProgress(this.assetLoadPromises,(t=>{document.querySelector(".loading-wrapper span").innerHTML=t.toFixed(0)+"%"}))}allProgress(t,e){let r=0;e(0);for(const i of t)i.then((()=>{r++,e(100*r/t.length)}));return Promise.all(t)}loadFonts(){this.assetLoadPromises.push(new Promise((t=>{new(fu())("Monschone").load().then((()=>{t()})).catch((e=>{console.error("Failed to load font Monschone:",e),t()}))}))),this.assetLoadPromises.push(new Promise((t=>{new(fu())("Mont").load().then((()=>{t()})).catch((e=>{console.error("Failed to load font Mont:",e),t()}))})))}loadImage=(t,e)=>new Promise(((r,i)=>{const s=new Image;s.onload=()=>r(s),s.onerror=t=>e?i(t):r(t),s.src=t}))};"scrollRestoration"in history&&(history.scrollRestoration="manual");const eT=new class{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.settings={enableScrollInertia:t.enableScrollInertia??!1};const e=new jE({smoothWheel:this.settings.enableScrollInertia,duration:0,easing:this.settings.enableScrollInertia?t=>1-Math.pow(1-t,5):t=>t});return this.settings.enableScrollInertia||(e.start=()=>{},e.stop=()=>{}),e.stop(),e.on("scroll",(t=>{document.body.classList.contains("popup-opened")||(t.animatedScroll>=96?(document.querySelector(".header").classList.add("sticky"),1==t.direction&&(document.querySelector(".header").classList.add("hide"),document.querySelector(".header__menu-toggle").classList.add("hide")),-1==t.direction&&(document.querySelector(".header").classList.remove("hide"),document.querySelector(".header__menu-toggle").classList.remove("hide"))):document.querySelector(".header").classList.remove("sticky"))})),requestAnimationFrame((function t(r){e.raf(r),requestAnimationFrame(t)})),e}}({enableScrollInertia:JE}),rT="(min-width: 768px)",iT="(max-width: 767.98px)";window.matchMedia(rT).matches?window.localStorage.setItem("page_size","desktop"):window.localStorage.setItem("page_size","mobile"),window.addEventListener("resize",(function(){window.matchMedia(rT).matches&&"mobile"==window.localStorage.getItem("page_size")&&location.reload(),window.matchMedia(iT).matches&&"desktop"==window.localStorage.getItem("page_size")&&location.reload()}));(new class{constructor(){}isMobile=function(){var t=this.getUserAgent(),e=t.substr(0,4);return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e)};isMobileOrTablet=function(){var t=this.getUserAgent(),e=t.substr(0,4);return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e)};getUserAgent=function(){var t=navigator.userAgent||navigator.vendor||window.opera||null;if(!t)throw new Error("Failed to look for user agent information.");return t}}).isMobileOrTablet();const sT=rs.matchMedia();let nT=!0;sT.add("(min-width: 992px)",(()=>{nT=!1}));const oT=new c.Core({renderers:{home:dE,casadecor:yE,casadecorpromo:EE,madetofeed:pE,allaround:Su,allarounddetail:Eu,page:ME,manifesto:SE,manifestore:LE,hero:kh,matgroup:CE,projects:UE,adpage:Pd,moodboard:PE,storelocator:QE,contact:fh,formgeneric:ph,finiture:_h,formdownload:wh},transitions:{allaround:Ld,allarounddetail:Ld,default:OE,adpage:Id,contextual:{adtrans:Id,retrans:$E}}});let aT=[],lT=[],cT=[],uT=!0;oT.on("NAVIGATE_IN",(t=>{let{to:e}=t;if(e.page){const t=[...e.page.querySelectorAll('link[rel="alternate"][hreflang]')];t.length>0&&document.querySelectorAll(".header-lang-menu a").forEach((e=>{const r=e.getAttribute("data-lang"),i=t.find((t=>t.getAttribute("hreflang")===r));i&&e.setAttribute("href",i.getAttribute("href"))}))}}));const dT=new ResizeObserver((()=>{xc.refresh()}));if(document.addEventListener("DOMContentLoaded",(()=>{uT&&(uT=!1,document.dispatchEvent(new Event("DOMContentLoadedCustom")))})),document.addEventListener("DOMContentLoadedCustom",(()=>{aT.forEach(((t,e)=>{t.destroy()})),lT.forEach(((t,e)=>{t.destroy()})),cT.forEach((t=>{t.kill()})),dT.disconnect(),cT=[],aT=[],lT=[],document.querySelectorAll(".custom-select").length>0&&lT.push(new gh("custom-select"));if(Array.from(document.querySelectorAll("form")).forEach((t=>{const e=jQuery(t);e.hasClass("wpcf7-form")&&!wpcf7cf_forms.some((t=>t.$form.get(0)===e.get(0)))&&wpcf7cf_forms.push(new Wpcf7cfForm(e));t.closest(".wpcf7")&&aT.push(new Dh(t)),t.querySelector("textarea")&&dT.observe(t.querySelector("textarea"))})),document.querySelectorAll(".custom-select-item").length>0&&document.querySelectorAll(".custom-select-item").forEach((t=>{t.addEventListener("change",(()=>{document.querySelector(t.dataset.target).value=t.value,document.querySelector(t.dataset.target).dispatchEvent(new Event("change"))}))})),document.querySelectorAll(".pdf").length>0){const t=document.querySelectorAll(".pdf");oT.detach(t)}if(document.querySelector(".header").classList.remove("hide"),document.querySelector(".header").classList.remove("sticky"),document.querySelector(".header__menu-toggle").classList.remove("hide"),setTimeout((()=>{const t=document.querySelector(".header__menu-toggle"),e=rs.timeline({paused:!0,onStart:()=>{eT.stop(),rs.set(".header__menu-bg",{display:"block"},"start")},onComplete:()=>{t.classList.add("active")},onReverseComplete:()=>{eT.start(),t.classList.remove("active"),rs.set(".header__menu-bg",{display:"none"},"start"),rs.set(".header__menu-wrap",{clearProps:"all"})}});e.add("start").to(".header__menu-wrap",{x:0,duration:1.5,ease:"power2.inOut"},"start").to(".header__menu-bg",{opacity:.5,duration:1.5,ease:"power2.inOut"},"start").to(".header__menu-toggle i",{y:"-100%",duration:1.5,ease:"power2.inOut"},"start").to(".header__menu-toggle em",{y:"-100%",duration:1.5,ease:"power2.inOut"},"start").to(".header__menu-main a",{opacity:1,blur:0,y:0,stagger:{each:.1}},"start+=1").to(".header__menu-top",{opacity:1,blur:0},"start+=1.25").to(".header__menu-bottom",{opacity:1,blur:0},"start+=1.25"),t.addEventListener("click",(()=>{if(t.classList.contains("active")){if(e.reverse(),document.querySelectorAll(".header__menu-sub.active").length>0){const t=document.querySelector(".header__menu-sub.active");rs.to(t,{xPercent:100,onComplete:()=>{t.classList.remove("active"),rs.set(t,{clearProps:"all"})}})}}else e.play()}));const r=document.querySelector(".popup:not(.--is-home)");if(r){const o=document.querySelector(".popup__close"),a=rs.timeline({paused:!0,onComplete:()=>{eT.start(),r.remove()}});a.to(r,{opacity:0}),a.set(r,{display:"none"}),o.addEventListener("click",(()=>{a.play(),uu.set("popup_closed",!0)}));const l=rs.timeline({defaults:{delay:1},onComplete:()=>{eT.stop();const t=document.querySelector(".popup__content");document.addEventListener("click",(e=>{t.contains(e.target)||(a.play(),uu.set("popup_closed",!0))}))}});l.set(r,{display:"flex"}),l.to(r,{opacity:1,duration:.7})}if(document.querySelectorAll(".header__menu-main-lnk--1").forEach((t=>{t.addEventListener("click",(()=>{t.classList.contains("has-sub")||e.reverse()}))})),document.querySelectorAll(".header__menu-subNav a").forEach((t=>{t.addEventListener("click",(()=>{kd(document.querySelector(".header__menu-subBack")),e.reverse()}))})),document.querySelector(".header__menu-bg").addEventListener("click",(()=>{if(t.classList.contains("active")&&(e.reverse(),document.querySelectorAll(".header__menu-sub.active").length>0)){const t=document.querySelector(".header__menu-sub.active");rs.to(t,{xPercent:100,onComplete:()=>{t.classList.remove("active"),rs.set(t,{clearProps:"all"})}})}})),document.querySelectorAll(".header__menu-bottom a").forEach((r=>{r.addEventListener("click",(()=>{r.classList.contains("current-lang")||t.classList.contains("active")&&e.reverse()}))})),document.querySelectorAll(".header__menu-top a").forEach((r=>{r.addEventListener("click",(()=>{t.classList.contains("active")&&e.reverse()}))})),document.querySelectorAll("a.d-lg-none.store-btn").forEach((r=>{r.addEventListener("click",(()=>{t.classList.contains("active")&&e.reverse()}))})),rs.utils.toArray(".fios").forEach((t=>{rs.to(t,{blur:0,opacity:1,duration:1,y:0,scrollTrigger:{trigger:t,markers:!1,start:"top bottom"}})})),document.querySelectorAll(".fifr").length>0&&rs.utils.toArray(".fifr").forEach((t=>{rs.set(t,{xPercent:50,opacity:0}),rs.to(t,{opacity:1,duration:1,xPercent:0,scrollTrigger:{trigger:t,start:"center bottom"}})})),document.querySelectorAll(".stagger-in").length>0&&document.querySelectorAll(".stagger-in").forEach((t=>{const e=t.querySelectorAll(".stagger-in__el");rs.to(e,{blur:0,opacity:1,duration:1,y:0,stagger:{each:.2},scrollTrigger:{trigger:t,markers:!1,start:"top 75%"}})})),rs.utils.toArray(".ctaos").forEach((t=>{const e=new lu(t,{type:"words"});rs.set(e.words,{opacity:0}),rs.to(t,{"--s":"1rem",scrollTrigger:{trigger:t,markers:!1,start:"top bottom"}}),rs.to(e.words,{opacity:1,stagger:{each:.1},scrollTrigger:{trigger:t,markers:!1,start:"top bottom"}})})),document.querySelectorAll(".parallax").length>0&&rs.utils.toArray(".parallax").forEach((t=>{rs.to(t,{yPercent:t.dataset.percent,scrollTrigger:{trigger:t,markers:!1,start:"top bottom",scrub:!0}})})),document.querySelectorAll(".dolly").length>0&&rs.utils.toArray(".dolly").forEach((t=>{rs.from(t,{scale:t.dataset.dolly,scrollTrigger:{trigger:t,markers:!1,start:"top bottom",scrub:!0}})})),document.querySelectorAll(".dolly-inv").length>0&&rs.utils.toArray(".dolly-inv").forEach((t=>{rs.to(t,{scale:t.dataset.dolly,scrollTrigger:{trigger:t,markers:!1,start:"top bottom",scrub:!0}})})),document.querySelectorAll(".dcarousel").length>0){rs.to(".dcarousel--item div",{y:0,duration:1.5,ease:"power2.inOut",onComplete:()=>{},scrollTrigger:{trigger:".block-c__dcarousel",start:"top center"}});const c=new mh;oT.on("NAVIGATE_OUT",(t=>{let{from:e,trigger:r,location:i}=t;c.destroy()}))}const i=document.querySelectorAll(".scarousel");if(i.length>0&&i.forEach((t=>{const e=new qE(t);oT.on("NAVIGATE_OUT",(t=>{let{from:r,trigger:i,location:s}=t;e.destroy()}))})),document.querySelectorAll(".has-sub").forEach((t=>{t.addEventListener("click",(()=>{const e=t.dataset.sub;document.querySelector(e).classList.add("active"),rs.to(e,{x:0})}))})),document.querySelectorAll(".header__menu-subBack").forEach((t=>{t.addEventListener("click",(()=>{const t=document.querySelector(".header__menu-sub.active");rs.to(t,{xPercent:100,onComplete:()=>{t.classList.remove("active"),rs.set(t,{clearProps:"all"})}})}))})),document.querySelectorAll(".block-v").length>0){document.querySelectorAll(".block-v").forEach((t=>{const e=t.querySelector("video"),r=t.querySelector(".toggle-muted");e.play(),e&&r?(e.muted=!0,e.volume=0,r.addEventListener("click",(()=>{r.classList.contains("active")?(r.classList.remove("active"),e.muted=!0,e.volume=0):(r.classList.add("active"),e.muted=!1,e.volume=1)}))):console.warn("Video or toggle-muted element not found in block:",t)}));const u=rs.timeline({paused:!0,onComplete:()=>{rs.to(".toggle-muted",{opacity:1})},onReverseComplete:()=>{rs.to(".toggle-muted",{opacity:0})}});u.add("start").to(".block-v__img--1",{x:"100%",y:"100%",ease:"none",opacity:0},"start").to(".block-v__img--2",{x:"-100%",y:"100%",opacity:0,ease:"none"},"start").to(".block-v__img--3",{x:"100%",y:"-100%",opacity:0,ease:"none"},"start").to(".block-v__img--4",{x:"-100%",y:"-100%",opacity:0,ease:"none"},"start").to(".block-v__video",{"--cl1":"0%","--cl2":"0%","--cl3":"0%",height:()=>nT?"40%":"100%",ease:"none"},"start"),rs.to(u,{progress:1,duration:2,ease:"power2.inOut",scrollTrigger:{trigger:".block-v",start:"top 50%",markers:!1,toggleActions:"play pause resume reverse"}})}if(document.querySelectorAll(".block-vb").length>0){document.querySelectorAll(".block-vb").forEach((t=>{const e=t.querySelector("video"),r=t.querySelector(".toggle-muted");e.play(),e&&r?(e.muted=!0,e.volume=0,r.addEventListener("click",(()=>{r.classList.contains("active")?(r.classList.remove("active"),e.muted=!0,e.volume=0):(r.classList.add("active"),e.muted=!1,e.volume=1)}))):console.warn("Video or toggle-muted element not found in block:",t)}));const d=rs.timeline({paused:!0,onComplete:()=>{rs.to(".toggle-muted",{opacity:1})},onReverseComplete:()=>{rs.to(".toggle-muted",{opacity:0})}});d.add("start").to(".block-vb__video",{"--cl1":"0%","--cl2":"0%","--cl3":"0%",height:()=>nT?"40%":"100%",ease:"none"},"start"),rs.to(d,{progress:1,duration:2,ease:"power2.inOut",scrollTrigger:{trigger:".block-vb",start:"top 50%",markers:!1,toggleActions:"play pause resume reverse"}})}if(document.querySelectorAll(".aas-schema").length>0){const h={trigger:".aas-schema",start:"center 75%"};if(nT)rs.to(".aas__box",{opacity:1,stagger:{each:.125},scrollTrigger:h});else{const f=jn.convertToPath("#aas-path");rs.set(".aas__typo",{motionPath:{path:f[0],align:f[0],alignOrigin:[.5,.5],autoRotate:!1,start:.05,end:.05},transformOrigin:"50% 50%"}),rs.set(".aas__opens",{motionPath:{path:f[0],align:f[0],alignOrigin:[.5,.5],autoRotate:!1,start:.475,end:.475},transformOrigin:"50% 50%"}),rs.set(".aas__trim",{motionPath:{path:f[0],align:f[0],alignOrigin:[.5,.5],autoRotate:!1,start:.775,end:.775},transformOrigin:"50% 50%"});const p=rs.timeline({paused:!0});p.add("start").to(".aas__typo",{motionPath:{path:f[0],align:f[0],alignOrigin:[.5,.5],autoRotate:!1,start:.05,end:.125},transformOrigin:"50% 50%",opacity:1,ease:"none"},"start").to(".aas__opens",{motionPath:{path:f[0],align:f[0],alignOrigin:[.5,.5],autoRotate:!1,start:.475,end:.55},transformOrigin:"50% 50%",opacity:1,ease:"none"},"start").to(".aas__trim",{motionPath:{path:f[0],align:f[0],alignOrigin:[.5,.5],autoRotate:!1,start:.775,end:.85},transformOrigin:"50% 50%",opacity:1,ease:"none"},"start"),rs.to(p,{progress:1,duration:2,scrollTrigger:h})}rs.to(".aas__scheme-title span",{y:0,scrollTrigger:h}),rs.to(".aas__circle",{opacity:1,scrollTrigger:h})}if(document.querySelectorAll(".in-image").length>0&&document.querySelectorAll(".in-image").forEach((t=>{rs.to(t,{scale:1,y:0,duration:2,scrollTrigger:{trigger:t}})})),document.querySelectorAll(".accordion-group").length>0){const g=rs.utils.toArray(".accordion-group"),m=rs.utils.toArray(".accordion-menu"),y=g.map(_);function v(t){t.parentNode.classList.contains("active")?t.parentNode.classList.remove("active"):(g.forEach((t=>{t.classList.remove("active")})),t.parentNode.classList.add("active")),y.forEach((e=>e(t)))}function _(t){const e=t.querySelector(".accordion-menu"),r=t.querySelector(".accordion-content");rs.set(r,{height:"auto"});const i=rs.from(r,{height:0,duration:.5,ease:"power1.inOut",onComplete:()=>{xc.refresh()}}).reverse();return function(t){t===e?i.reversed(!i.reversed()):i.reverse()}}m.forEach((t=>{t.addEventListener("click",(()=>v(t)))})),void 0!==document.querySelector(".accordion").dataset.firstopen&&v(m[0])}document.querySelectorAll(".block-6").length>0&&(rs.set(".block-6__path",{drawSVG:"0% 0%"}),rs.to(".block-6__path",{drawSVG:"100% 0%",duration:2,scrollTrigger:{trigger:".block-6",start:"top 25%",immediateRender:!1}})),document.querySelectorAll(".block-gallery__img").length>0&&document.querySelectorAll(".block-gallery__img").forEach((t=>{rs.to(t,{scale:1,y:0,delay:()=>void 0!==t.dataset.delay?t.dataset.delay:0,duration:2,scrollTrigger:{trigger:t}})}));const s=document.querySelectorAll(".tcarousel-ct");s.length>0&&s.forEach((t=>{new ZE(t)}));const n=document.querySelectorAll(".anchor-lnk");n.length>0&&n.forEach((t=>{t.addEventListener("click",(()=>{const e=document.getElementById(t.dataset.target),r="#"+t.dataset.target,i=rs.utils.clamp(1.5,3,e.offsetTop/1e3);eT.scrollTo(r,{duration:i})}))}))}),250),document.querySelectorAll(".site-search").length>0){let t=!1;const e=document.querySelector(".site-search"),r=document.querySelector(".site-search__input-cta"),i=t=>{let{key:e,target:i}=t;"Enter"==e&&kd(r)};document.querySelector(".site-search__input-el").addEventListener("keyup",i),document.querySelectorAll(".search-lnk").forEach((r=>{r.addEventListener("click",(()=>{t||(t=!0,rs.to(e,{yPercent:0,y:0,duration:1.5,ease:"power2.inOut",onComplete:()=>{t=!1,document.querySelector(".site-search__input-el").focus()}}))}))})),document.querySelector(".site-search__close").addEventListener("click",(()=>{t||(t=!0,rs.to(e,{yPercent:-100,duration:1.5,ease:"power2.inOut",onComplete:()=>{t=!1}}))})),r.addEventListener("click",(()=>{const t=r.dataset.link+"?s="+document.querySelector(".site-search__input-el").value;(async()=>{try{const e=await d()(t);if(e.status>=400)throw new Error("Bad response from server");const i=await e.text(),s=new DOMParser,n=s.parseFromString(i,"text/html").querySelector(".search-fetch");document.querySelector(".site-search__results").innerHTML="",document.querySelector(".site-search__results").append(n),rs.to(".site-search__input-cta .svg-e",{opacity:1}),rs.to(".site-search__input-cta .svg-s",{opacity:0}),document.querySelector(".site-search__input-cta span").innerHTML=r.dataset.editlabel,document.querySelector(".site-search__input-resWrap strong").innerHTML=document.querySelector(".site-search__input-el").value,r.classList.add("search-done"),rs.to(".site-search__input-resWrap",{yPercent:0,y:0})}catch(t){console.error(t)}})()}))}const t=document.querySelector(".footer__scrolltop");sT.add({isDesktop:rT,isMobile:iT},(e=>{const{isDesktop:r}=e.conditions;cT.push(xc.create({trigger:t,start:"bottom+=20px bottom",end:r?"max-=80px":"max-=220px",pin:!0}))})),t.addEventListener("click",(()=>{eT.scrollTo("start",{force:!0,lock:!0,duration:3})}));const e=rs.timeline({paused:!0,onStart:()=>{eT.stop()},onReverseComplete:()=>{eT.start()}});e.add("start").to(".gform-bg",{opacity:.5,duration:1.5,onStart:()=>{rs.set(".gform-bg",{display:"block"})},onReverseComplete:()=>{rs.set(".gform-bg",{display:"none"})}},"start").to(".gform-ct",{x:0,xPercent:0,duration:1.5,ease:"power2.inOut",onStart:()=>{rs.set(".gform-ct",{display:"block"})},onReverseComplete:()=>{rs.set(".gform-ct",{display:"none"})}},"start"),document.querySelectorAll(".open-form").length>0&&(document.querySelectorAll(".open-form").forEach((t=>{t.addEventListener("click",(()=>{e.play()}))})),document.querySelector(".gform__close").addEventListener("click",(()=>{e.reverse()})),document.querySelector(".gform-bg")&&document.querySelector(".gform-bg").addEventListener("click",(()=>{e.reverse()}))),document.querySelectorAll("input[type=checkbox]").length>0&&document.querySelectorAll("input[type=checkbox]").forEach((t=>{t.classList.contains("ev-ad")||(t.parentNode.parentNode.addEventListener("click",(()=>{kd(t)})),t.classList.add("ev-ad"))}));const r=document.querySelectorAll(".gform_cta"),i=[document.getElementById("p-checkbox"),document.getElementById("p-checkbox-fc")],s=["ev-ad","ev-ad-2"];r&&r.forEach((t=>{t.classList.contains("ev-ad")||(t.addEventListener("click",(()=>{if(t.classList.contains("pchecked")||t.classList.contains("pchecked-fc")){const t=document.querySelector(".gfrom-submit-ct input");Cd(t);const e=t.closest("form").querySelector("svg");e&&e.classList.add("form-svg-spin"),rs.to(".privacy-error--gf",{opacity:0})}else rs.to(".privacy-error--gf",{opacity:1})})),t.classList.add("ev-ad")),i.forEach((e=>{e&&s.forEach((r=>{e.classList.contains(r)||(e.addEventListener("change",(e=>{!0===e.target.checked&&t.classList.add("pchecked"),!1===e.target.checked&&t.classList.remove("pchecked")})),e.classList.add("ev-ad"))}))}))})),document.querySelector(".wpcf7.no-js")&&document.querySelector(".wpcf7.no-js").querySelector("form")&&wpcf7&&wpcf7.init(document.querySelector(".wpcf7.no-js").querySelector("form")),xc.refresh()})),document.addEventListener("DOMContentLoaded",(function(){document.addEventListener("wpcf7mailsent",(function(t){const e=t.detail.apiResponse;e&&e.forward_url&&(window.location.href=e.forward_url)}))})),document.querySelectorAll(".current-lang").length>0){const t=rs.timeline({paused:!0,onStart:()=>{rs.set(".header-lang-menu",{display:"block"}),document.querySelectorAll(".current-lang").forEach((t=>{t.classList.add("open")}))},onReverseComplete:()=>{document.querySelectorAll(".current-lang").forEach((t=>{t.classList.remove("open")}))}});t.to(".header-lang-menu li",{opacity:1,stagger:{each:.1}}),document.querySelectorAll(".current-lang").forEach((e=>{e.addEventListener("click",(()=>{e.classList.contains("open")?t.reverse():t.play()}))}));const e=document.querySelector(".header-lang-menu-ct");document.addEventListener("click",(r=>{e.contains(r.target)||document.querySelectorAll(".current-lang").forEach((e=>{e.classList.contains("open")&&t.reverse()}))}))}window.addEventListener("load",(function(t){if(document.querySelectorAll("#wpadminbar a").length>0){const t=document.querySelectorAll("a");oT.detach(t)}}));const hT=.01*window.innerHeight;document.documentElement.style.setProperty("--vh",`${hT}px`),document.addEventListener("DOMContentLoaded",(function(){document.addEventListener("wpcf7mailsent",(function(t){const e=t.detail.apiResponse;e&&e.forward_url&&(window.location.href=e.forward_url)}))}))}()}(); //# sourceMappingURL=main.e503f1f8c06cade5e2d0.js.map