@alirezahosseini/sibtorsh-player 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/dist/App.d.ts +0 -3
- package/dist/VideoPlayer.d.ts +0 -5
- package/dist/components/Loading.d.ts +0 -5
- package/dist/components/MainControl.d.ts +0 -3
- package/dist/components/Transition.d.ts +0 -12
- package/dist/components/VideoPlayerControl.d.ts +0 -3
- package/dist/components/svg/BackwardSvg.d.ts +0 -2
- package/dist/components/svg/ForwardSvg.d.ts +0 -2
- package/dist/components/svg/MaximizeSvg.d.ts +0 -2
- package/dist/components/svg/MinimizeSvg.d.ts +0 -2
- package/dist/components/svg/MuteSvg.d.ts +0 -2
- package/dist/components/svg/PauseSvg.d.ts +0 -2
- package/dist/components/svg/PlaySvg.d.ts +0 -2
- package/dist/components/svg/QualitySvg.d.ts +0 -2
- package/dist/components/svg/RateSvg.d.ts +0 -2
- package/dist/components/svg/RetrySvg.d.ts +0 -2
- package/dist/components/svg/UnMuteSvg.d.ts +0 -2
- package/dist/enums/DeviceTypeEnum.d.ts +0 -5
- package/dist/index.d.ts +0 -5
- package/dist/interfaces/RateInterface.d.ts +0 -5
- package/dist/interfaces/SvgInterface.d.ts +0 -6
- package/dist/interfaces/VideoPlayerControlInterface.d.ts +0 -26
- package/dist/interfaces/VideoPlayerInterface.d.ts +0 -9
- package/dist/main.d.ts +0 -1
- package/dist/sibtorsh-player.css +0 -1
- package/dist/sibtorsh-player.es.js +0 -37644
- package/dist/sibtorsh-player.umd.js +0 -317
- package/dist/utils/DateUtils.d.ts +0 -3
- package/dist/utils/HexToRgba.d.ts +0 -2
- package/dist/utils/useDeviceType.d.ts +0 -2
- package/dist/utils/usePWAInstalled.d.ts +0 -2
- package/dist/utils/useUserAgent.d.ts +0 -12
- package/dist/vite.svg +0 -1
|
@@ -1,317 +0,0 @@
|
|
|
1
|
-
(function(r,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("react/jsx-runtime"),require("react"),require("prop-types"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","prop-types","react-dom"],e):(r=typeof globalThis<"u"?globalThis:r||self,e(r["Sibtorsh Player"]={},r.jsxRuntime,r.React,r.PropTypes,r.ReactDOM))})(this,(function(exports,jsxRuntime,React,PropTypes,ReactDOM){"use strict";function _interopNamespaceDefault(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const React__namespace=_interopNamespaceDefault(React);function _extends$1(){return _extends$1=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(r[i]=t[i])}return r},_extends$1.apply(null,arguments)}function _objectWithoutPropertiesLoose(r,e){if(r==null)return{};var t={};for(var i in r)if({}.hasOwnProperty.call(r,i)){if(e.indexOf(i)!==-1)continue;t[i]=r[i]}return t}function _setPrototypeOf(r,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,i){return t.__proto__=i,t},_setPrototypeOf(r,e)}function _inheritsLoose(r,e){r.prototype=Object.create(e.prototype),r.prototype.constructor=r,_setPrototypeOf(r,e)}function hasClass(r,e){return r.classList?!!e&&r.classList.contains(e):(" "+(r.className.baseVal||r.className)+" ").indexOf(" "+e+" ")!==-1}function addClass(r,e){r.classList?r.classList.add(e):hasClass(r,e)||(typeof r.className=="string"?r.className=r.className+" "+e:r.setAttribute("class",(r.className&&r.className.baseVal||"")+" "+e))}function replaceClassName(r,e){return r.replace(new RegExp("(^|\\s)"+e+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function removeClass$1(r,e){r.classList?r.classList.remove(e):typeof r.className=="string"?r.className=replaceClassName(r.className,e):r.setAttribute("class",replaceClassName(r.className&&r.className.baseVal||"",e))}const config={disabled:!1};var timeoutsShape=process.env.NODE_ENV!=="production"?PropTypes.oneOfType([PropTypes.number,PropTypes.shape({enter:PropTypes.number,exit:PropTypes.number,appear:PropTypes.number}).isRequired]):null,classNamesShape=process.env.NODE_ENV!=="production"?PropTypes.oneOfType([PropTypes.string,PropTypes.shape({enter:PropTypes.string,exit:PropTypes.string,active:PropTypes.string}),PropTypes.shape({enter:PropTypes.string,enterDone:PropTypes.string,enterActive:PropTypes.string,exit:PropTypes.string,exitDone:PropTypes.string,exitActive:PropTypes.string})]):null;const TransitionGroupContext=React.createContext(null);var forceReflow=function(e){return e.scrollTop},UNMOUNTED="unmounted",EXITED="exited",ENTERING="entering",ENTERED="entered",EXITING="exiting",Transition$1=(function(r){_inheritsLoose(e,r);function e(i,s){var n;n=r.call(this,i,s)||this;var a=s,o=a&&!a.isMounting?i.enter:i.appear,c;return n.appearStatus=null,i.in?o?(c=EXITED,n.appearStatus=ENTERING):c=ENTERED:i.unmountOnExit||i.mountOnEnter?c=UNMOUNTED:c=EXITED,n.state={status:c},n.nextCallback=null,n}e.getDerivedStateFromProps=function(s,n){var a=s.in;return a&&n.status===UNMOUNTED?{status:EXITED}:null};var t=e.prototype;return t.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},t.componentDidUpdate=function(s){var n=null;if(s!==this.props){var a=this.state.status;this.props.in?a!==ENTERING&&a!==ENTERED&&(n=ENTERING):(a===ENTERING||a===ENTERED)&&(n=EXITING)}this.updateStatus(!1,n)},t.componentWillUnmount=function(){this.cancelNextCallback()},t.getTimeouts=function(){var s=this.props.timeout,n,a,o;return n=a=o=s,s!=null&&typeof s!="number"&&(n=s.exit,a=s.enter,o=s.appear!==void 0?s.appear:a),{exit:n,enter:a,appear:o}},t.updateStatus=function(s,n){if(s===void 0&&(s=!1),n!==null)if(this.cancelNextCallback(),n===ENTERING){if(this.props.unmountOnExit||this.props.mountOnEnter){var a=this.props.nodeRef?this.props.nodeRef.current:ReactDOM.findDOMNode(this);a&&forceReflow(a)}this.performEnter(s)}else this.performExit();else this.props.unmountOnExit&&this.state.status===EXITED&&this.setState({status:UNMOUNTED})},t.performEnter=function(s){var n=this,a=this.props.enter,o=this.context?this.context.isMounting:s,c=this.props.nodeRef?[o]:[ReactDOM.findDOMNode(this),o],u=c[0],f=c[1],d=this.getTimeouts(),g=o?d.appear:d.enter;if(!s&&!a||config.disabled){this.safeSetState({status:ENTERED},function(){n.props.onEntered(u)});return}this.props.onEnter(u,f),this.safeSetState({status:ENTERING},function(){n.props.onEntering(u,f),n.onTransitionEnd(g,function(){n.safeSetState({status:ENTERED},function(){n.props.onEntered(u,f)})})})},t.performExit=function(){var s=this,n=this.props.exit,a=this.getTimeouts(),o=this.props.nodeRef?void 0:ReactDOM.findDOMNode(this);if(!n||config.disabled){this.safeSetState({status:EXITED},function(){s.props.onExited(o)});return}this.props.onExit(o),this.safeSetState({status:EXITING},function(){s.props.onExiting(o),s.onTransitionEnd(a.exit,function(){s.safeSetState({status:EXITED},function(){s.props.onExited(o)})})})},t.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},t.safeSetState=function(s,n){n=this.setNextCallback(n),this.setState(s,n)},t.setNextCallback=function(s){var n=this,a=!0;return this.nextCallback=function(o){a&&(a=!1,n.nextCallback=null,s(o))},this.nextCallback.cancel=function(){a=!1},this.nextCallback},t.onTransitionEnd=function(s,n){this.setNextCallback(n);var a=this.props.nodeRef?this.props.nodeRef.current:ReactDOM.findDOMNode(this),o=s==null&&!this.props.addEndListener;if(!a||o){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var c=this.props.nodeRef?[this.nextCallback]:[a,this.nextCallback],u=c[0],f=c[1];this.props.addEndListener(u,f)}s!=null&&setTimeout(this.nextCallback,s)},t.render=function(){var s=this.state.status;if(s===UNMOUNTED)return null;var n=this.props,a=n.children;n.in,n.mountOnEnter,n.unmountOnExit,n.appear,n.enter,n.exit,n.timeout,n.addEndListener,n.onEnter,n.onEntering,n.onEntered,n.onExit,n.onExiting,n.onExited,n.nodeRef;var o=_objectWithoutPropertiesLoose(n,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return React.createElement(TransitionGroupContext.Provider,{value:null},typeof a=="function"?a(s,o):React.cloneElement(React.Children.only(a),o))},e})(React.Component);Transition$1.contextType=TransitionGroupContext,Transition$1.propTypes=process.env.NODE_ENV!=="production"?{nodeRef:PropTypes.shape({current:typeof Element>"u"?PropTypes.any:function(r,e,t,i,s,n){var a=r[e];return PropTypes.instanceOf(a&&"ownerDocument"in a?a.ownerDocument.defaultView.Element:Element)(r,e,t,i,s,n)}}),children:PropTypes.oneOfType([PropTypes.func.isRequired,PropTypes.element.isRequired]).isRequired,in:PropTypes.bool,mountOnEnter:PropTypes.bool,unmountOnExit:PropTypes.bool,appear:PropTypes.bool,enter:PropTypes.bool,exit:PropTypes.bool,timeout:function(e){var t=timeoutsShape;e.addEndListener||(t=t.isRequired);for(var i=arguments.length,s=new Array(i>1?i-1:0),n=1;n<i;n++)s[n-1]=arguments[n];return t.apply(void 0,[e].concat(s))},addEndListener:PropTypes.func,onEnter:PropTypes.func,onEntering:PropTypes.func,onEntered:PropTypes.func,onExit:PropTypes.func,onExiting:PropTypes.func,onExited:PropTypes.func}:{};function noop$1(){}Transition$1.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:noop$1,onEntering:noop$1,onEntered:noop$1,onExit:noop$1,onExiting:noop$1,onExited:noop$1},Transition$1.UNMOUNTED=UNMOUNTED,Transition$1.EXITED=EXITED,Transition$1.ENTERING=ENTERING,Transition$1.ENTERED=ENTERED,Transition$1.EXITING=EXITING;var _addClass=function(e,t){return e&&t&&t.split(" ").forEach(function(i){return addClass(e,i)})},removeClass=function(e,t){return e&&t&&t.split(" ").forEach(function(i){return removeClass$1(e,i)})},CSSTransition=(function(r){_inheritsLoose(e,r);function e(){for(var i,s=arguments.length,n=new Array(s),a=0;a<s;a++)n[a]=arguments[a];return i=r.call.apply(r,[this].concat(n))||this,i.appliedClasses={appear:{},enter:{},exit:{}},i.onEnter=function(o,c){var u=i.resolveArguments(o,c),f=u[0],d=u[1];i.removeClasses(f,"exit"),i.addClass(f,d?"appear":"enter","base"),i.props.onEnter&&i.props.onEnter(o,c)},i.onEntering=function(o,c){var u=i.resolveArguments(o,c),f=u[0],d=u[1],g=d?"appear":"enter";i.addClass(f,g,"active"),i.props.onEntering&&i.props.onEntering(o,c)},i.onEntered=function(o,c){var u=i.resolveArguments(o,c),f=u[0],d=u[1],g=d?"appear":"enter";i.removeClasses(f,g),i.addClass(f,g,"done"),i.props.onEntered&&i.props.onEntered(o,c)},i.onExit=function(o){var c=i.resolveArguments(o),u=c[0];i.removeClasses(u,"appear"),i.removeClasses(u,"enter"),i.addClass(u,"exit","base"),i.props.onExit&&i.props.onExit(o)},i.onExiting=function(o){var c=i.resolveArguments(o),u=c[0];i.addClass(u,"exit","active"),i.props.onExiting&&i.props.onExiting(o)},i.onExited=function(o){var c=i.resolveArguments(o),u=c[0];i.removeClasses(u,"exit"),i.addClass(u,"exit","done"),i.props.onExited&&i.props.onExited(o)},i.resolveArguments=function(o,c){return i.props.nodeRef?[i.props.nodeRef.current,o]:[o,c]},i.getClassNames=function(o){var c=i.props.classNames,u=typeof c=="string",f=u&&c?c+"-":"",d=u?""+f+o:c[o],g=u?d+"-active":c[o+"Active"],E=u?d+"-done":c[o+"Done"];return{baseClassName:d,activeClassName:g,doneClassName:E}},i}var t=e.prototype;return t.addClass=function(s,n,a){var o=this.getClassNames(n)[a+"ClassName"],c=this.getClassNames("enter"),u=c.doneClassName;n==="appear"&&a==="done"&&u&&(o+=" "+u),a==="active"&&s&&forceReflow(s),o&&(this.appliedClasses[n][a]=o,_addClass(s,o))},t.removeClasses=function(s,n){var a=this.appliedClasses[n],o=a.base,c=a.active,u=a.done;this.appliedClasses[n]={},o&&removeClass(s,o),c&&removeClass(s,c),u&&removeClass(s,u)},t.render=function(){var s=this.props;s.classNames;var n=_objectWithoutPropertiesLoose(s,["classNames"]);return React.createElement(Transition$1,_extends$1({},n,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},e})(React.Component);CSSTransition.defaultProps={classNames:""},CSSTransition.propTypes=process.env.NODE_ENV!=="production"?_extends$1({},Transition$1.propTypes,{classNames:classNamesShape,onEnter:PropTypes.func,onEntering:PropTypes.func,onEntered:PropTypes.func,onExit:PropTypes.func,onExiting:PropTypes.func,onExited:PropTypes.func}):{};var _leaveRenders,_enterRenders;function areChildrenDifferent(r,e){return!(r===e||React.isValidElement(r)&&React.isValidElement(e)&&r.key!=null&&r.key===e.key)}var modes={out:"out-in",in:"in-out"},callHook=function(e,t,i){return function(){var s;e.props[t]&&(s=e.props)[t].apply(s,arguments),i()}},leaveRenders=(_leaveRenders={},_leaveRenders[modes.out]=function(r){var e=r.current,t=r.changeState;return React.cloneElement(e,{in:!1,onExited:callHook(e,"onExited",function(){t(ENTERING,null)})})},_leaveRenders[modes.in]=function(r){var e=r.current,t=r.changeState,i=r.children;return[e,React.cloneElement(i,{in:!0,onEntered:callHook(i,"onEntered",function(){t(ENTERING)})})]},_leaveRenders),enterRenders=(_enterRenders={},_enterRenders[modes.out]=function(r){var e=r.children,t=r.changeState;return React.cloneElement(e,{in:!0,onEntered:callHook(e,"onEntered",function(){t(ENTERED,React.cloneElement(e,{in:!0}))})})},_enterRenders[modes.in]=function(r){var e=r.current,t=r.children,i=r.changeState;return[React.cloneElement(e,{in:!1,onExited:callHook(e,"onExited",function(){i(ENTERED,React.cloneElement(t,{in:!0}))})}),React.cloneElement(t,{in:!0})]},_enterRenders),SwitchTransition=(function(r){_inheritsLoose(e,r);function e(){for(var i,s=arguments.length,n=new Array(s),a=0;a<s;a++)n[a]=arguments[a];return i=r.call.apply(r,[this].concat(n))||this,i.state={status:ENTERED,current:null},i.appeared=!1,i.changeState=function(o,c){c===void 0&&(c=i.state.current),i.setState({status:o,current:c})},i}var t=e.prototype;return t.componentDidMount=function(){this.appeared=!0},e.getDerivedStateFromProps=function(s,n){return s.children==null?{current:null}:n.status===ENTERING&&s.mode===modes.in?{status:ENTERING}:n.current&&areChildrenDifferent(n.current,s.children)?{status:EXITING}:{current:React.cloneElement(s.children,{in:!0})}},t.render=function(){var s=this.props,n=s.children,a=s.mode,o=this.state,c=o.status,u=o.current,f={children:n,current:u,changeState:this.changeState,status:c},d;switch(c){case ENTERING:d=enterRenders[a](f);break;case EXITING:d=leaveRenders[a](f);break;case ENTERED:d=u}return React.createElement(TransitionGroupContext.Provider,{value:{isMounting:!this.appeared}},d)},e})(React.Component);SwitchTransition.propTypes=process.env.NODE_ENV!=="production"?{mode:PropTypes.oneOf([modes.in,modes.out]),children:PropTypes.oneOfType([PropTypes.element.isRequired])}:{},SwitchTransition.defaultProps={mode:modes.out};function Transition({children:r,enterAnimateClass:e,exitAnimateClass:t,timeOut:i=500,speedAnimateClass:s="fast",isVisible:n,className:a}){const o=React.useRef(null);return jsxRuntime.jsx(SwitchTransition,{children:jsxRuntime.jsx(CSSTransition,{nodeRef:o,timeout:i,classNames:{enter:`animate__animated animate__${e} animate__${s}`,exit:`animate__animated animate__${t} animate__${s}`},children:n?jsxRuntime.jsx("section",{className:a,ref:o,children:r}):jsxRuntime.jsx(jsxRuntime.Fragment,{})},`${n}`)})}function PlayCircleSvg({width:r=24}){return jsxRuntime.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.97 2C6.45 2 1.97 6.48 1.97 12C1.97 17.52 6.45 22 11.97 22C17.49 22 21.97 17.52 21.97 12C21.97 6.48 17.5 2 11.97 2ZM14.97 14.23L12.07 15.9C11.71 16.11 11.31 16.21 10.92 16.21C10.52 16.21 10.13 16.11 9.77 15.9C9.05 15.48 8.62 14.74 8.62 13.9V10.55C8.62 9.72 9.05 8.97 9.77 8.55C10.49 8.13 11.35 8.13 12.08 8.55L14.98 10.22C15.7 10.64 16.13 11.38 16.13 12.22C16.13 13.06 15.7 13.81 14.97 14.23Z",fill:"#fff"})})}var extendStatics=function(r,e){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(t[s]=i[s])})(r,e)};function __extends(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=r}extendStatics(r,e),r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var __assign=function(){return(__assign=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++)for(var s in e=arguments[t])Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=e[s]);return r}).apply(this,arguments)};function __awaiter(r,e,t,i){return new(t||(t=Promise))((function(s,n){function a(u){try{c(i.next(u))}catch(f){n(f)}}function o(u){try{c(i.throw(u))}catch(f){n(f)}}function c(u){var f;u.done?s(u.value):(f=u.value,f instanceof t?f:new t((function(d){d(f)}))).then(a,o)}c((i=i.apply(r,[])).next())}))}function __generator(r,e){var t,i,s,n,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return n={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(n[Symbol.iterator]=function(){return this}),n;function o(c){return function(u){return(function(f){if(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=1,i&&(s=2&f[0]?i.return:f[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,f[1])).done)return s;switch(i=0,s&&(f=[2&f[0],s.value]),f[0]){case 0:case 1:s=f;break;case 4:return a.label++,{value:f[1],done:!1};case 5:a.label++,i=f[1],f=[0];continue;case 7:f=a.ops.pop(),a.trys.pop();continue;default:if(s=a.trys,!((s=s.length>0&&s[s.length-1])||f[0]!==6&&f[0]!==2)){a=0;continue}if(f[0]===3&&(!s||f[1]>s[0]&&f[1]<s[3])){a.label=f[1];break}if(f[0]===6&&a.label<s[1]){a.label=s[1],s=f;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(f);break}s[2]&&a.ops.pop(),a.trys.pop();continue}f=e.call(r,a)}catch(d){f=[6,d],i=0}finally{t=s=0}if(5&f[0])throw f[1];return{value:f[0]?f[1]:void 0,done:!0}})([c,u])}}}function createCommonjsModule(r,e){return r(e={exports:{}},e.exports),e.exports}var lottie=createCommonjsModule((function(module,exports$1){typeof navigator<"u"&&(function(r,e){module.exports=e()})(0,(function(){var svgNS="http://www.w3.org/2000/svg",locationHref="",_useWebWorker=!1,initialDefaultFrame=-999999,setWebWorker=function(r){_useWebWorker=!!r},getWebWorker=function(){return _useWebWorker},setLocationHref=function(r){locationHref=r},getLocationHref=function(){return locationHref};function createTag(r){return document.createElement(r)}function extendPrototype(r,e){var t,i,s=r.length;for(t=0;t<s;t+=1)for(var n in i=r[t].prototype)Object.prototype.hasOwnProperty.call(i,n)&&(e.prototype[n]=i[n])}function getDescriptor(r,e){return Object.getOwnPropertyDescriptor(r,e)}function createProxyFunction(r){function e(){}return e.prototype=r,e}var audioControllerFactory=(function(){function r(e){this.audios=[],this.audioFactory=e,this._volume=1,this._isMuted=!1}return r.prototype={addAudio:function(e){this.audios.push(e)},pause:function(){var e,t=this.audios.length;for(e=0;e<t;e+=1)this.audios[e].pause()},resume:function(){var e,t=this.audios.length;for(e=0;e<t;e+=1)this.audios[e].resume()},setRate:function(e){var t,i=this.audios.length;for(t=0;t<i;t+=1)this.audios[t].setRate(e)},createAudio:function(e){return this.audioFactory?this.audioFactory(e):window.Howl?new window.Howl({src:[e]}):{isPlaying:!1,play:function(){this.isPlaying=!0},seek:function(){this.isPlaying=!1},playing:function(){},rate:function(){},setVolume:function(){}}},setAudioFactory:function(e){this.audioFactory=e},setVolume:function(e){this._volume=e,this._updateVolume()},mute:function(){this._isMuted=!0,this._updateVolume()},unmute:function(){this._isMuted=!1,this._updateVolume()},getVolume:function(){return this._volume},_updateVolume:function(){var e,t=this.audios.length;for(e=0;e<t;e+=1)this.audios[e].volume(this._volume*(this._isMuted?0:1))}},function(){return new r}})(),createTypedArray=(function(){function r(e,t){var i,s=0,n=[];switch(e){case"int16":case"uint8c":i=1;break;default:i=1.1}for(s=0;s<t;s+=1)n.push(i);return n}return typeof Uint8ClampedArray=="function"&&typeof Float32Array=="function"?function(e,t){return e==="float32"?new Float32Array(t):e==="int16"?new Int16Array(t):e==="uint8c"?new Uint8ClampedArray(t):r(e,t)}:r})();function createSizedArray(r){return Array.apply(null,{length:r})}function _typeof$6(r){return(_typeof$6=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(r)}var subframeEnabled=!0,expressionsPlugin=null,expressionsInterfaces=null,idPrefix$1="",isSafari=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),bmPow=Math.pow,bmSqrt=Math.sqrt,bmFloor=Math.floor,bmMax=Math.max,bmMin=Math.min,BMMath={};(function(){var r,e=["abs","acos","acosh","asin","asinh","atan","atanh","atan2","ceil","cbrt","expm1","clz32","cos","cosh","exp","floor","fround","hypot","imul","log","log1p","log2","log10","max","min","pow","random","round","sign","sin","sinh","sqrt","tan","tanh","trunc","E","LN10","LN2","LOG10E","LOG2E","PI","SQRT1_2","SQRT2"],t=e.length;for(r=0;r<t;r+=1)BMMath[e[r]]=Math[e[r]]})(),BMMath.random=Math.random,BMMath.abs=function(r){if(_typeof$6(r)==="object"&&r.length){var e,t=createSizedArray(r.length),i=r.length;for(e=0;e<i;e+=1)t[e]=Math.abs(r[e]);return t}return Math.abs(r)};var defaultCurveSegments=150,degToRads=Math.PI/180,roundCorner=.5519;function styleDiv(r){r.style.position="absolute",r.style.top=0,r.style.left=0,r.style.display="block",r.style.transformOrigin="0 0",r.style.webkitTransformOrigin="0 0",r.style.backfaceVisibility="visible",r.style.webkitBackfaceVisibility="visible",r.style.transformStyle="preserve-3d",r.style.webkitTransformStyle="preserve-3d",r.style.mozTransformStyle="preserve-3d"}function BMEnterFrameEvent(r,e,t,i){this.type=r,this.currentTime=e,this.totalTime=t,this.direction=i<0?-1:1}function BMCompleteEvent(r,e){this.type=r,this.direction=e<0?-1:1}function BMCompleteLoopEvent(r,e,t,i){this.type=r,this.currentLoop=t,this.totalLoops=e,this.direction=i<0?-1:1}function BMSegmentStartEvent(r,e,t){this.type=r,this.firstFrame=e,this.totalFrames=t}function BMDestroyEvent(r,e){this.type=r,this.target=e}function BMRenderFrameErrorEvent(r,e){this.type="renderFrameError",this.nativeError=r,this.currentTime=e}function BMConfigErrorEvent(r){this.type="configError",this.nativeError=r}var createElementID=(_count=0,function(){return idPrefix$1+"__lottie_element_"+(_count+=1)}),_count;function HSVtoRGB(r,e,t){var i,s,n,a,o,c,u,f;switch(c=t*(1-e),u=t*(1-(o=6*r-(a=Math.floor(6*r)))*e),f=t*(1-(1-o)*e),a%6){case 0:i=t,s=f,n=c;break;case 1:i=u,s=t,n=c;break;case 2:i=c,s=t,n=f;break;case 3:i=c,s=u,n=t;break;case 4:i=f,s=c,n=t;break;case 5:i=t,s=c,n=u}return[i,s,n]}function RGBtoHSV(r,e,t){var i,s=Math.max(r,e,t),n=Math.min(r,e,t),a=s-n,o=s===0?0:a/s,c=s/255;switch(s){case n:i=0;break;case r:i=e-t+a*(e<t?6:0),i/=6*a;break;case e:i=t-r+2*a,i/=6*a;break;case t:i=r-e+4*a,i/=6*a}return[i,o,c]}function addSaturationToRGB(r,e){var t=RGBtoHSV(255*r[0],255*r[1],255*r[2]);return t[1]+=e,t[1]>1?t[1]=1:t[1]<=0&&(t[1]=0),HSVtoRGB(t[0],t[1],t[2])}function addBrightnessToRGB(r,e){var t=RGBtoHSV(255*r[0],255*r[1],255*r[2]);return t[2]+=e,t[2]>1?t[2]=1:t[2]<0&&(t[2]=0),HSVtoRGB(t[0],t[1],t[2])}function addHueToRGB(r,e){var t=RGBtoHSV(255*r[0],255*r[1],255*r[2]);return t[0]+=e/360,t[0]>1?t[0]-=1:t[0]<0&&(t[0]+=1),HSVtoRGB(t[0],t[1],t[2])}var rgbToHex=(function(){var r,e,t=[];for(r=0;r<256;r+=1)e=r.toString(16),t[r]=e.length===1?"0"+e:e;return function(i,s,n){return i<0&&(i=0),s<0&&(s=0),n<0&&(n=0),"#"+t[i]+t[s]+t[n]}})(),setSubframeEnabled=function(r){subframeEnabled=!!r},getSubframeEnabled=function(){return subframeEnabled},setExpressionsPlugin=function(r){expressionsPlugin=r},getExpressionsPlugin=function(){return expressionsPlugin},setExpressionInterfaces=function(r){expressionsInterfaces=r},getExpressionInterfaces=function(){return expressionsInterfaces},setDefaultCurveSegments=function(r){defaultCurveSegments=r},getDefaultCurveSegments=function(){return defaultCurveSegments},setIdPrefix=function(r){idPrefix$1=r};function createNS(r){return document.createElementNS(svgNS,r)}function _typeof$5(r){return(_typeof$5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(r)}var dataManager=(function(){var r,e,t=1,i=[],s={onmessage:function(){},postMessage:function(c){r({data:c})}},n={postMessage:function(c){s.onmessage({data:c})}};function a(){e||((e=(function(c){if(window.Worker&&window.Blob&&getWebWorker()){var u=new Blob(["var _workerSelf = self; self.onmessage = ",c.toString()],{type:"text/javascript"}),f=URL.createObjectURL(u);return new Worker(f)}return r=c,s})((function(c){if(n.dataManager||(n.dataManager=(function(){function f(O,F){var G,x,$,X,Q,ee,te=O.length;for(x=0;x<te;x+=1)if("ks"in(G=O[x])&&!G.completed){if(G.completed=!0,G.hasMask){var re=G.masksProperties;for(X=re.length,$=0;$<X;$+=1)if(re[$].pt.k.i)E(re[$].pt.k);else for(ee=re[$].pt.k.length,Q=0;Q<ee;Q+=1)re[$].pt.k[Q].s&&E(re[$].pt.k[Q].s[0]),re[$].pt.k[Q].e&&E(re[$].pt.k[Q].e[0])}G.ty===0?(G.layers=d(G.refId,F),f(G.layers,F)):G.ty===4?g(G.shapes):G.ty===5&&k(G)}}function d(O,F){var G=(function(x,$){for(var X=0,Q=$.length;X<Q;){if($[X].id===x)return $[X];X+=1}return null})(O,F);return G?G.layers.__used?JSON.parse(JSON.stringify(G.layers)):(G.layers.__used=!0,G.layers):null}function g(O){var F,G,x;for(F=O.length-1;F>=0;F-=1)if(O[F].ty==="sh")if(O[F].ks.k.i)E(O[F].ks.k);else for(x=O[F].ks.k.length,G=0;G<x;G+=1)O[F].ks.k[G].s&&E(O[F].ks.k[G].s[0]),O[F].ks.k[G].e&&E(O[F].ks.k[G].e[0]);else O[F].ty==="gr"&&g(O[F].it)}function E(O){var F,G=O.i.length;for(F=0;F<G;F+=1)O.i[F][0]+=O.v[F][0],O.i[F][1]+=O.v[F][1],O.o[F][0]+=O.v[F][0],O.o[F][1]+=O.v[F][1]}function m(O,F){var G=F?F.split("."):[100,100,100];return O[0]>G[0]||!(G[0]>O[0])&&(O[1]>G[1]||!(G[1]>O[1])&&(O[2]>G[2]||!(G[2]>O[2])&&null))}var T,S=(function(){var O=[4,4,14];function F(G){var x,$,X,Q=G.length;for(x=0;x<Q;x+=1)G[x].ty===5&&($=G[x],X=void 0,X=$.t.d,$.t.d={k:[{s:X,t:0}]})}return function(G){if(m(O,G.v)&&(F(G.layers),G.assets)){var x,$=G.assets.length;for(x=0;x<$;x+=1)G.assets[x].layers&&F(G.assets[x].layers)}}})(),b=(T=[4,7,99],function(O){if(O.chars&&!m(T,O.v)){var F,G=O.chars.length;for(F=0;F<G;F+=1){var x=O.chars[F];x.data&&x.data.shapes&&(g(x.data.shapes),x.data.ip=0,x.data.op=99999,x.data.st=0,x.data.sr=1,x.data.ks={p:{k:[0,0],a:0},s:{k:[100,100],a:0},a:{k:[0,0],a:0},r:{k:0,a:0},o:{k:100,a:0}},O.chars[F].t||(x.data.shapes.push({ty:"no"}),x.data.shapes[0].it.push({p:{k:[0,0],a:0},s:{k:[100,100],a:0},a:{k:[0,0],a:0},r:{k:0,a:0},o:{k:100,a:0},sk:{k:0,a:0},sa:{k:0,a:0},ty:"tr"})))}}}),C=(function(){var O=[5,7,15];function F(G){var x,$,X,Q=G.length;for(x=0;x<Q;x+=1)G[x].ty===5&&($=G[x],X=void 0,typeof(X=$.t.p).a=="number"&&(X.a={a:0,k:X.a}),typeof X.p=="number"&&(X.p={a:0,k:X.p}),typeof X.r=="number"&&(X.r={a:0,k:X.r}))}return function(G){if(m(O,G.v)&&(F(G.layers),G.assets)){var x,$=G.assets.length;for(x=0;x<$;x+=1)G.assets[x].layers&&F(G.assets[x].layers)}}})(),I=(function(){var O=[4,1,9];function F(x){var $,X,Q,ee=x.length;for($=0;$<ee;$+=1)if(x[$].ty==="gr")F(x[$].it);else if(x[$].ty==="fl"||x[$].ty==="st")if(x[$].c.k&&x[$].c.k[0].i)for(Q=x[$].c.k.length,X=0;X<Q;X+=1)x[$].c.k[X].s&&(x[$].c.k[X].s[0]/=255,x[$].c.k[X].s[1]/=255,x[$].c.k[X].s[2]/=255,x[$].c.k[X].s[3]/=255),x[$].c.k[X].e&&(x[$].c.k[X].e[0]/=255,x[$].c.k[X].e[1]/=255,x[$].c.k[X].e[2]/=255,x[$].c.k[X].e[3]/=255);else x[$].c.k[0]/=255,x[$].c.k[1]/=255,x[$].c.k[2]/=255,x[$].c.k[3]/=255}function G(x){var $,X=x.length;for($=0;$<X;$+=1)x[$].ty===4&&F(x[$].shapes)}return function(x){if(m(O,x.v)&&(G(x.layers),x.assets)){var $,X=x.assets.length;for($=0;$<X;$+=1)x.assets[$].layers&&G(x.assets[$].layers)}}})(),L=(function(){var O=[4,4,18];function F(x){var $,X,Q;for($=x.length-1;$>=0;$-=1)if(x[$].ty==="sh")if(x[$].ks.k.i)x[$].ks.k.c=x[$].closed;else for(Q=x[$].ks.k.length,X=0;X<Q;X+=1)x[$].ks.k[X].s&&(x[$].ks.k[X].s[0].c=x[$].closed),x[$].ks.k[X].e&&(x[$].ks.k[X].e[0].c=x[$].closed);else x[$].ty==="gr"&&F(x[$].it)}function G(x){var $,X,Q,ee,te,re,me=x.length;for(X=0;X<me;X+=1){if(($=x[X]).hasMask){var H=$.masksProperties;for(ee=H.length,Q=0;Q<ee;Q+=1)if(H[Q].pt.k.i)H[Q].pt.k.c=H[Q].cl;else for(re=H[Q].pt.k.length,te=0;te<re;te+=1)H[Q].pt.k[te].s&&(H[Q].pt.k[te].s[0].c=H[Q].cl),H[Q].pt.k[te].e&&(H[Q].pt.k[te].e[0].c=H[Q].cl)}$.ty===4&&F($.shapes)}}return function(x){if(m(O,x.v)&&(G(x.layers),x.assets)){var $,X=x.assets.length;for($=0;$<X;$+=1)x.assets[$].layers&&G(x.assets[$].layers)}}})();function k(O){O.t.a.length===0&&O.t.p}var U={completeData:function(O){O.__complete||(I(O),S(O),b(O),C(O),L(O),f(O.layers,O.assets),(function(F,G){if(F){var x=0,$=F.length;for(x=0;x<$;x+=1)F[x].t===1&&(F[x].data.layers=d(F[x].data.refId,G),f(F[x].data.layers,G))}})(O.chars,O.assets),O.__complete=!0)}};return U.checkColors=I,U.checkChars=b,U.checkPathProperties=C,U.checkShapes=L,U.completeLayers=f,U})()),n.assetLoader||(n.assetLoader=(function(){function f(d){var g=d.getResponseHeader("content-type");return g&&d.responseType==="json"&&g.indexOf("json")!==-1||d.response&&_typeof$5(d.response)==="object"?d.response:d.response&&typeof d.response=="string"?JSON.parse(d.response):d.responseText?JSON.parse(d.responseText):null}return{load:function(d,g,E,m){var T,S=new XMLHttpRequest;try{S.responseType="json"}catch{}S.onreadystatechange=function(){if(S.readyState===4)if(S.status===200)T=f(S),E(T);else try{T=f(S),E(T)}catch(b){m&&m(b)}};try{S.open(["G","E","T"].join(""),d,!0)}catch{S.open(["G","E","T"].join(""),g+"/"+d,!0)}S.send()}}})()),c.data.type==="loadAnimation")n.assetLoader.load(c.data.path,c.data.fullPath,(function(f){n.dataManager.completeData(f),n.postMessage({id:c.data.id,payload:f,status:"success"})}),(function(){n.postMessage({id:c.data.id,status:"error"})}));else if(c.data.type==="complete"){var u=c.data.animation;n.dataManager.completeData(u),n.postMessage({id:c.data.id,payload:u,status:"success"})}else c.data.type==="loadData"&&n.assetLoader.load(c.data.path,c.data.fullPath,(function(f){n.postMessage({id:c.data.id,payload:f,status:"success"})}),(function(){n.postMessage({id:c.data.id,status:"error"})}))}))).onmessage=function(c){var u=c.data,f=u.id,d=i[f];i[f]=null,u.status==="success"?d.onComplete(u.payload):d.onError&&d.onError()})}function o(c,u){var f="processId_"+(t+=1);return i[f]={onComplete:c,onError:u},f}return{loadAnimation:function(c,u,f){a();var d=o(u,f);e.postMessage({type:"loadAnimation",path:c,fullPath:window.location.origin+window.location.pathname,id:d})},loadData:function(c,u,f){a();var d=o(u,f);e.postMessage({type:"loadData",path:c,fullPath:window.location.origin+window.location.pathname,id:d})},completeAnimation:function(c,u,f){a();var d=o(u,f);e.postMessage({type:"complete",animation:c,id:d})}}})(),ImagePreloader=(function(){var r=(function(){var o=createTag("canvas");o.width=1,o.height=1;var c=o.getContext("2d");return c.fillStyle="rgba(0,0,0,0)",c.fillRect(0,0,1,1),o})();function e(){this.loadedAssets+=1,this.loadedAssets===this.totalImages&&this.loadedFootagesCount===this.totalFootages&&this.imagesLoadedCb&&this.imagesLoadedCb(null)}function t(){this.loadedFootagesCount+=1,this.loadedAssets===this.totalImages&&this.loadedFootagesCount===this.totalFootages&&this.imagesLoadedCb&&this.imagesLoadedCb(null)}function i(o,c,u){var f="";if(o.e)f=o.p;else if(c){var d=o.p;d.indexOf("images/")!==-1&&(d=d.split("/")[1]),f=c+d}else f=u,f+=o.u?o.u:"",f+=o.p;return f}function s(o){var c=0,u=setInterval((function(){(o.getBBox().width||c>500)&&(this._imageLoaded(),clearInterval(u)),c+=1}).bind(this),50)}function n(o){var c={assetData:o},u=i(o,this.assetsPath,this.path);return dataManager.loadData(u,(function(f){c.img=f,this._footageLoaded()}).bind(this),(function(){c.img={},this._footageLoaded()}).bind(this)),c}function a(){this._imageLoaded=e.bind(this),this._footageLoaded=t.bind(this),this.testImageLoaded=s.bind(this),this.createFootageData=n.bind(this),this.assetsPath="",this.path="",this.totalImages=0,this.totalFootages=0,this.loadedAssets=0,this.loadedFootagesCount=0,this.imagesLoadedCb=null,this.images=[]}return a.prototype={loadAssets:function(o,c){var u;this.imagesLoadedCb=c;var f=o.length;for(u=0;u<f;u+=1)o[u].layers||(o[u].t&&o[u].t!=="seq"?o[u].t===3&&(this.totalFootages+=1,this.images.push(this.createFootageData(o[u]))):(this.totalImages+=1,this.images.push(this._createImageData(o[u]))))},setAssetsPath:function(o){this.assetsPath=o||""},setPath:function(o){this.path=o||""},loadedImages:function(){return this.totalImages===this.loadedAssets},loadedFootages:function(){return this.totalFootages===this.loadedFootagesCount},destroy:function(){this.imagesLoadedCb=null,this.images.length=0},getAsset:function(o){for(var c=0,u=this.images.length;c<u;){if(this.images[c].assetData===o)return this.images[c].img;c+=1}return null},createImgData:function(o){var c=i(o,this.assetsPath,this.path),u=createTag("img");u.crossOrigin="anonymous",u.addEventListener("load",this._imageLoaded,!1),u.addEventListener("error",(function(){f.img=r,this._imageLoaded()}).bind(this),!1),u.src=c;var f={img:u,assetData:o};return f},createImageData:function(o){var c=i(o,this.assetsPath,this.path),u=createNS("image");isSafari?this.testImageLoaded(u):u.addEventListener("load",this._imageLoaded,!1),u.addEventListener("error",(function(){f.img=r,this._imageLoaded()}).bind(this),!1),u.setAttributeNS("http://www.w3.org/1999/xlink","href",c),this._elementHelper.append?this._elementHelper.append(u):this._elementHelper.appendChild(u);var f={img:u,assetData:o};return f},imageLoaded:e,footageLoaded:t,setCacheType:function(o,c){o==="svg"?(this._elementHelper=c,this._createImageData=this.createImageData.bind(this)):this._createImageData=this.createImgData.bind(this)}},a})();function BaseEvent(){}BaseEvent.prototype={triggerEvent:function(r,e){if(this._cbs[r])for(var t=this._cbs[r],i=0;i<t.length;i+=1)t[i](e)},addEventListener:function(r,e){return this._cbs[r]||(this._cbs[r]=[]),this._cbs[r].push(e),(function(){this.removeEventListener(r,e)}).bind(this)},removeEventListener:function(r,e){if(e){if(this._cbs[r]){for(var t=0,i=this._cbs[r].length;t<i;)this._cbs[r][t]===e&&(this._cbs[r].splice(t,1),t-=1,i-=1),t+=1;this._cbs[r].length||(this._cbs[r]=null)}}else this._cbs[r]=null}};var markerParser=(function(){function r(e){for(var t,i=e.split(`\r
|
|
2
|
-
`),s={},n=0,a=0;a<i.length;a+=1)(t=i[a].split(":")).length===2&&(s[t[0]]=t[1].trim(),n+=1);if(n===0)throw new Error;return s}return function(e){for(var t=[],i=0;i<e.length;i+=1){var s=e[i],n={time:s.tm,duration:s.dr};try{n.payload=JSON.parse(e[i].cm)}catch{try{n.payload=r(e[i].cm)}catch{n.payload={name:e[i].cm}}}t.push(n)}return t}})(),ProjectInterface=(function(){function r(e){this.compositions.push(e)}return function(){function e(t){for(var i=0,s=this.compositions.length;i<s;){if(this.compositions[i].data&&this.compositions[i].data.nm===t)return this.compositions[i].prepareFrame&&this.compositions[i].data.xt&&this.compositions[i].prepareFrame(this.currentFrame),this.compositions[i].compInterface;i+=1}return null}return e.compositions=[],e.currentFrame=0,e.registerComposition=r,e}})(),renderers={},registerRenderer=function(r,e){renderers[r]=e};function getRenderer(r){return renderers[r]}function getRegisteredRenderer(){if(renderers.canvas)return"canvas";for(var r in renderers)if(renderers[r])return r;return""}function _typeof$4(r){return(_typeof$4=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(r)}var AnimationItem=function(){this._cbs=[],this.name="",this.path="",this.isLoaded=!1,this.currentFrame=0,this.currentRawFrame=0,this.firstFrame=0,this.totalFrames=0,this.frameRate=0,this.frameMult=0,this.playSpeed=1,this.playDirection=1,this.playCount=0,this.animationData={},this.assets=[],this.isPaused=!0,this.autoplay=!1,this.loop=!0,this.renderer=null,this.animationID=createElementID(),this.assetsPath="",this.timeCompleted=0,this.segmentPos=0,this.isSubframeEnabled=getSubframeEnabled(),this.segments=[],this._idle=!0,this._completedLoop=!1,this.projectInterface=ProjectInterface(),this.imagePreloader=new ImagePreloader,this.audioController=audioControllerFactory(),this.markers=[],this.configAnimation=this.configAnimation.bind(this),this.onSetupError=this.onSetupError.bind(this),this.onSegmentComplete=this.onSegmentComplete.bind(this),this.drawnFrameEvent=new BMEnterFrameEvent("drawnFrame",0,0,0),this.expressionsPlugin=getExpressionsPlugin()};extendPrototype([BaseEvent],AnimationItem),AnimationItem.prototype.setParams=function(r){(r.wrapper||r.container)&&(this.wrapper=r.wrapper||r.container);var e="svg";r.animType?e=r.animType:r.renderer&&(e=r.renderer);var t=getRenderer(e);this.renderer=new t(this,r.rendererSettings),this.imagePreloader.setCacheType(e,this.renderer.globalData.defs),this.renderer.setProjectInterface(this.projectInterface),this.animType=e,r.loop===""||r.loop===null||r.loop===void 0||r.loop===!0?this.loop=!0:r.loop===!1?this.loop=!1:this.loop=parseInt(r.loop,10),this.autoplay=!("autoplay"in r)||r.autoplay,this.name=r.name?r.name:"",this.autoloadSegments=!Object.prototype.hasOwnProperty.call(r,"autoloadSegments")||r.autoloadSegments,this.assetsPath=r.assetsPath,this.initialSegment=r.initialSegment,r.audioFactory&&this.audioController.setAudioFactory(r.audioFactory),r.animationData?this.setupAnimation(r.animationData):r.path&&(r.path.lastIndexOf("\\")!==-1?this.path=r.path.substr(0,r.path.lastIndexOf("\\")+1):this.path=r.path.substr(0,r.path.lastIndexOf("/")+1),this.fileName=r.path.substr(r.path.lastIndexOf("/")+1),this.fileName=this.fileName.substr(0,this.fileName.lastIndexOf(".json")),dataManager.loadAnimation(r.path,this.configAnimation,this.onSetupError))},AnimationItem.prototype.onSetupError=function(){this.trigger("data_failed")},AnimationItem.prototype.setupAnimation=function(r){dataManager.completeAnimation(r,this.configAnimation)},AnimationItem.prototype.setData=function(r,e){e&&_typeof$4(e)!=="object"&&(e=JSON.parse(e));var t={wrapper:r,animationData:e},i=r.attributes;t.path=i.getNamedItem("data-animation-path")?i.getNamedItem("data-animation-path").value:i.getNamedItem("data-bm-path")?i.getNamedItem("data-bm-path").value:i.getNamedItem("bm-path")?i.getNamedItem("bm-path").value:"",t.animType=i.getNamedItem("data-anim-type")?i.getNamedItem("data-anim-type").value:i.getNamedItem("data-bm-type")?i.getNamedItem("data-bm-type").value:i.getNamedItem("bm-type")?i.getNamedItem("bm-type").value:i.getNamedItem("data-bm-renderer")?i.getNamedItem("data-bm-renderer").value:i.getNamedItem("bm-renderer")?i.getNamedItem("bm-renderer").value:getRegisteredRenderer()||"canvas";var s=i.getNamedItem("data-anim-loop")?i.getNamedItem("data-anim-loop").value:i.getNamedItem("data-bm-loop")?i.getNamedItem("data-bm-loop").value:i.getNamedItem("bm-loop")?i.getNamedItem("bm-loop").value:"";s==="false"?t.loop=!1:s==="true"?t.loop=!0:s!==""&&(t.loop=parseInt(s,10));var n=i.getNamedItem("data-anim-autoplay")?i.getNamedItem("data-anim-autoplay").value:i.getNamedItem("data-bm-autoplay")?i.getNamedItem("data-bm-autoplay").value:!i.getNamedItem("bm-autoplay")||i.getNamedItem("bm-autoplay").value;t.autoplay=n!=="false",t.name=i.getNamedItem("data-name")?i.getNamedItem("data-name").value:i.getNamedItem("data-bm-name")?i.getNamedItem("data-bm-name").value:i.getNamedItem("bm-name")?i.getNamedItem("bm-name").value:"",(i.getNamedItem("data-anim-prerender")?i.getNamedItem("data-anim-prerender").value:i.getNamedItem("data-bm-prerender")?i.getNamedItem("data-bm-prerender").value:i.getNamedItem("bm-prerender")?i.getNamedItem("bm-prerender").value:"")==="false"&&(t.prerender=!1),t.path?this.setParams(t):this.trigger("destroy")},AnimationItem.prototype.includeLayers=function(r){r.op>this.animationData.op&&(this.animationData.op=r.op,this.totalFrames=Math.floor(r.op-this.animationData.ip));var e,t,i=this.animationData.layers,s=i.length,n=r.layers,a=n.length;for(t=0;t<a;t+=1)for(e=0;e<s;){if(i[e].id===n[t].id){i[e]=n[t];break}e+=1}if((r.chars||r.fonts)&&(this.renderer.globalData.fontManager.addChars(r.chars),this.renderer.globalData.fontManager.addFonts(r.fonts,this.renderer.globalData.defs)),r.assets)for(s=r.assets.length,e=0;e<s;e+=1)this.animationData.assets.push(r.assets[e]);this.animationData.__complete=!1,dataManager.completeAnimation(this.animationData,this.onSegmentComplete)},AnimationItem.prototype.onSegmentComplete=function(r){this.animationData=r;var e=getExpressionsPlugin();e&&e.initExpressions(this),this.loadNextSegment()},AnimationItem.prototype.loadNextSegment=function(){var r=this.animationData.segments;if(!r||r.length===0||!this.autoloadSegments)return this.trigger("data_ready"),void(this.timeCompleted=this.totalFrames);var e=r.shift();this.timeCompleted=e.time*this.frameRate;var t=this.path+this.fileName+"_"+this.segmentPos+".json";this.segmentPos+=1,dataManager.loadData(t,this.includeLayers.bind(this),(function(){this.trigger("data_failed")}).bind(this))},AnimationItem.prototype.loadSegments=function(){this.animationData.segments||(this.timeCompleted=this.totalFrames),this.loadNextSegment()},AnimationItem.prototype.imagesLoaded=function(){this.trigger("loaded_images"),this.checkLoaded()},AnimationItem.prototype.preloadImages=function(){this.imagePreloader.setAssetsPath(this.assetsPath),this.imagePreloader.setPath(this.path),this.imagePreloader.loadAssets(this.animationData.assets,this.imagesLoaded.bind(this))},AnimationItem.prototype.configAnimation=function(r){if(this.renderer)try{this.animationData=r,this.initialSegment?(this.totalFrames=Math.floor(this.initialSegment[1]-this.initialSegment[0]),this.firstFrame=Math.round(this.initialSegment[0])):(this.totalFrames=Math.floor(this.animationData.op-this.animationData.ip),this.firstFrame=Math.round(this.animationData.ip)),this.renderer.configAnimation(r),r.assets||(r.assets=[]),this.assets=this.animationData.assets,this.frameRate=this.animationData.fr,this.frameMult=this.animationData.fr/1e3,this.renderer.searchExtraCompositions(r.assets),this.markers=markerParser(r.markers||[]),this.trigger("config_ready"),this.preloadImages(),this.loadSegments(),this.updaFrameModifier(),this.waitForFontsLoaded(),this.isPaused&&this.audioController.pause()}catch(e){this.triggerConfigError(e)}},AnimationItem.prototype.waitForFontsLoaded=function(){this.renderer&&(this.renderer.globalData.fontManager.isLoaded?this.checkLoaded():setTimeout(this.waitForFontsLoaded.bind(this),20))},AnimationItem.prototype.checkLoaded=function(){if(!this.isLoaded&&this.renderer.globalData.fontManager.isLoaded&&(this.imagePreloader.loadedImages()||this.renderer.rendererType!=="canvas")&&this.imagePreloader.loadedFootages()){this.isLoaded=!0;var r=getExpressionsPlugin();r&&r.initExpressions(this),this.renderer.initItems(),setTimeout((function(){this.trigger("DOMLoaded")}).bind(this),0),this.gotoFrame(),this.autoplay&&this.play()}},AnimationItem.prototype.resize=function(r,e){var t=typeof r=="number"?r:void 0,i=typeof e=="number"?e:void 0;this.renderer.updateContainerSize(t,i)},AnimationItem.prototype.setSubframe=function(r){this.isSubframeEnabled=!!r},AnimationItem.prototype.gotoFrame=function(){this.currentFrame=this.isSubframeEnabled?this.currentRawFrame:~~this.currentRawFrame,this.timeCompleted!==this.totalFrames&&this.currentFrame>this.timeCompleted&&(this.currentFrame=this.timeCompleted),this.trigger("enterFrame"),this.renderFrame(),this.trigger("drawnFrame")},AnimationItem.prototype.renderFrame=function(){if(this.isLoaded!==!1&&this.renderer)try{this.expressionsPlugin&&this.expressionsPlugin.resetFrame(),this.renderer.renderFrame(this.currentFrame+this.firstFrame)}catch(r){this.triggerRenderFrameError(r)}},AnimationItem.prototype.play=function(r){r&&this.name!==r||this.isPaused===!0&&(this.isPaused=!1,this.trigger("_play"),this.audioController.resume(),this._idle&&(this._idle=!1,this.trigger("_active")))},AnimationItem.prototype.pause=function(r){r&&this.name!==r||this.isPaused===!1&&(this.isPaused=!0,this.trigger("_pause"),this._idle=!0,this.trigger("_idle"),this.audioController.pause())},AnimationItem.prototype.togglePause=function(r){r&&this.name!==r||(this.isPaused===!0?this.play():this.pause())},AnimationItem.prototype.stop=function(r){r&&this.name!==r||(this.pause(),this.playCount=0,this._completedLoop=!1,this.setCurrentRawFrameValue(0))},AnimationItem.prototype.getMarkerData=function(r){for(var e,t=0;t<this.markers.length;t+=1)if((e=this.markers[t]).payload&&e.payload.name===r)return e;return null},AnimationItem.prototype.goToAndStop=function(r,e,t){if(!t||this.name===t){var i=Number(r);if(isNaN(i)){var s=this.getMarkerData(r);s&&this.goToAndStop(s.time,!0)}else e?this.setCurrentRawFrameValue(r):this.setCurrentRawFrameValue(r*this.frameModifier);this.pause()}},AnimationItem.prototype.goToAndPlay=function(r,e,t){if(!t||this.name===t){var i=Number(r);if(isNaN(i)){var s=this.getMarkerData(r);s&&(s.duration?this.playSegments([s.time,s.time+s.duration],!0):this.goToAndStop(s.time,!0))}else this.goToAndStop(i,e,t);this.play()}},AnimationItem.prototype.advanceTime=function(r){if(this.isPaused!==!0&&this.isLoaded!==!1){var e=this.currentRawFrame+r*this.frameModifier,t=!1;e>=this.totalFrames-1&&this.frameModifier>0?this.loop&&this.playCount!==this.loop?e>=this.totalFrames?(this.playCount+=1,this.checkSegments(e%this.totalFrames)||(this.setCurrentRawFrameValue(e%this.totalFrames),this._completedLoop=!0,this.trigger("loopComplete"))):this.setCurrentRawFrameValue(e):this.checkSegments(e>this.totalFrames?e%this.totalFrames:0)||(t=!0,e=this.totalFrames-1):e<0?this.checkSegments(e%this.totalFrames)||(!this.loop||this.playCount--<=0&&this.loop!==!0?(t=!0,e=0):(this.setCurrentRawFrameValue(this.totalFrames+e%this.totalFrames),this._completedLoop?this.trigger("loopComplete"):this._completedLoop=!0)):this.setCurrentRawFrameValue(e),t&&(this.setCurrentRawFrameValue(e),this.pause(),this.trigger("complete"))}},AnimationItem.prototype.adjustSegment=function(r,e){this.playCount=0,r[1]<r[0]?(this.frameModifier>0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(-1)),this.totalFrames=r[0]-r[1],this.timeCompleted=this.totalFrames,this.firstFrame=r[1],this.setCurrentRawFrameValue(this.totalFrames-.001-e)):r[1]>r[0]&&(this.frameModifier<0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(1)),this.totalFrames=r[1]-r[0],this.timeCompleted=this.totalFrames,this.firstFrame=r[0],this.setCurrentRawFrameValue(.001+e)),this.trigger("segmentStart")},AnimationItem.prototype.setSegment=function(r,e){var t=-1;this.isPaused&&(this.currentRawFrame+this.firstFrame<r?t=r:this.currentRawFrame+this.firstFrame>e&&(t=e-r)),this.firstFrame=r,this.totalFrames=e-r,this.timeCompleted=this.totalFrames,t!==-1&&this.goToAndStop(t,!0)},AnimationItem.prototype.playSegments=function(r,e){if(e&&(this.segments.length=0),_typeof$4(r[0])==="object"){var t,i=r.length;for(t=0;t<i;t+=1)this.segments.push(r[t])}else this.segments.push(r);this.segments.length&&e&&this.adjustSegment(this.segments.shift(),0),this.isPaused&&this.play()},AnimationItem.prototype.resetSegments=function(r){this.segments.length=0,this.segments.push([this.animationData.ip,this.animationData.op]),r&&this.checkSegments(0)},AnimationItem.prototype.checkSegments=function(r){return!!this.segments.length&&(this.adjustSegment(this.segments.shift(),r),!0)},AnimationItem.prototype.destroy=function(r){r&&this.name!==r||!this.renderer||(this.renderer.destroy(),this.imagePreloader.destroy(),this.trigger("destroy"),this._cbs=null,this.onEnterFrame=null,this.onLoopComplete=null,this.onComplete=null,this.onSegmentStart=null,this.onDestroy=null,this.renderer=null,this.expressionsPlugin=null,this.imagePreloader=null,this.projectInterface=null)},AnimationItem.prototype.setCurrentRawFrameValue=function(r){this.currentRawFrame=r,this.gotoFrame()},AnimationItem.prototype.setSpeed=function(r){this.playSpeed=r,this.updaFrameModifier()},AnimationItem.prototype.setDirection=function(r){this.playDirection=r<0?-1:1,this.updaFrameModifier()},AnimationItem.prototype.setLoop=function(r){this.loop=r},AnimationItem.prototype.setVolume=function(r,e){e&&this.name!==e||this.audioController.setVolume(r)},AnimationItem.prototype.getVolume=function(){return this.audioController.getVolume()},AnimationItem.prototype.mute=function(r){r&&this.name!==r||this.audioController.mute()},AnimationItem.prototype.unmute=function(r){r&&this.name!==r||this.audioController.unmute()},AnimationItem.prototype.updaFrameModifier=function(){this.frameModifier=this.frameMult*this.playSpeed*this.playDirection,this.audioController.setRate(this.playSpeed*this.playDirection)},AnimationItem.prototype.getPath=function(){return this.path},AnimationItem.prototype.getAssetsPath=function(r){var e="";if(r.e)e=r.p;else if(this.assetsPath){var t=r.p;t.indexOf("images/")!==-1&&(t=t.split("/")[1]),e=this.assetsPath+t}else e=this.path,e+=r.u?r.u:"",e+=r.p;return e},AnimationItem.prototype.getAssetData=function(r){for(var e=0,t=this.assets.length;e<t;){if(r===this.assets[e].id)return this.assets[e];e+=1}return null},AnimationItem.prototype.hide=function(){this.renderer.hide()},AnimationItem.prototype.show=function(){this.renderer.show()},AnimationItem.prototype.getDuration=function(r){return r?this.totalFrames:this.totalFrames/this.frameRate},AnimationItem.prototype.updateDocumentData=function(r,e,t){try{this.renderer.getElementByPath(r).updateDocumentData(e,t)}catch{}},AnimationItem.prototype.trigger=function(r){if(this._cbs&&this._cbs[r])switch(r){case"enterFrame":this.triggerEvent(r,new BMEnterFrameEvent(r,this.currentFrame,this.totalFrames,this.frameModifier));break;case"drawnFrame":this.drawnFrameEvent.currentTime=this.currentFrame,this.drawnFrameEvent.totalTime=this.totalFrames,this.drawnFrameEvent.direction=this.frameModifier,this.triggerEvent(r,this.drawnFrameEvent);break;case"loopComplete":this.triggerEvent(r,new BMCompleteLoopEvent(r,this.loop,this.playCount,this.frameMult));break;case"complete":this.triggerEvent(r,new BMCompleteEvent(r,this.frameMult));break;case"segmentStart":this.triggerEvent(r,new BMSegmentStartEvent(r,this.firstFrame,this.totalFrames));break;case"destroy":this.triggerEvent(r,new BMDestroyEvent(r,this));break;default:this.triggerEvent(r)}r==="enterFrame"&&this.onEnterFrame&&this.onEnterFrame.call(this,new BMEnterFrameEvent(r,this.currentFrame,this.totalFrames,this.frameMult)),r==="loopComplete"&&this.onLoopComplete&&this.onLoopComplete.call(this,new BMCompleteLoopEvent(r,this.loop,this.playCount,this.frameMult)),r==="complete"&&this.onComplete&&this.onComplete.call(this,new BMCompleteEvent(r,this.frameMult)),r==="segmentStart"&&this.onSegmentStart&&this.onSegmentStart.call(this,new BMSegmentStartEvent(r,this.firstFrame,this.totalFrames)),r==="destroy"&&this.onDestroy&&this.onDestroy.call(this,new BMDestroyEvent(r,this))},AnimationItem.prototype.triggerRenderFrameError=function(r){var e=new BMRenderFrameErrorEvent(r,this.currentFrame);this.triggerEvent("error",e),this.onError&&this.onError.call(this,e)},AnimationItem.prototype.triggerConfigError=function(r){var e=new BMConfigErrorEvent(r,this.currentFrame);this.triggerEvent("error",e),this.onError&&this.onError.call(this,e)};var animationManager=(function(){var r={},e=[],t=0,i=0,s=0,n=!0,a=!1;function o(T){for(var S=0,b=T.target;S<i;)e[S].animation===b&&(e.splice(S,1),S-=1,i-=1,b.isPaused||f()),S+=1}function c(T,S){if(!T)return null;for(var b=0;b<i;){if(e[b].elem===T&&e[b].elem!==null)return e[b].animation;b+=1}var C=new AnimationItem;return d(C,T),C.setData(T,S),C}function u(){s+=1,m()}function f(){s-=1}function d(T,S){T.addEventListener("destroy",o),T.addEventListener("_active",u),T.addEventListener("_idle",f),e.push({elem:S,animation:T}),i+=1}function g(T){var S,b=T-t;for(S=0;S<i;S+=1)e[S].animation.advanceTime(b);t=T,s&&!a?window.requestAnimationFrame(g):n=!0}function E(T){t=T,window.requestAnimationFrame(g)}function m(){!a&&s&&n&&(window.requestAnimationFrame(E),n=!1)}return r.registerAnimation=c,r.loadAnimation=function(T){var S=new AnimationItem;return d(S,null),S.setParams(T),S},r.setSpeed=function(T,S){var b;for(b=0;b<i;b+=1)e[b].animation.setSpeed(T,S)},r.setDirection=function(T,S){var b;for(b=0;b<i;b+=1)e[b].animation.setDirection(T,S)},r.play=function(T){var S;for(S=0;S<i;S+=1)e[S].animation.play(T)},r.pause=function(T){var S;for(S=0;S<i;S+=1)e[S].animation.pause(T)},r.stop=function(T){var S;for(S=0;S<i;S+=1)e[S].animation.stop(T)},r.togglePause=function(T){var S;for(S=0;S<i;S+=1)e[S].animation.togglePause(T)},r.searchAnimations=function(T,S,b){var C,I=[].concat([].slice.call(document.getElementsByClassName("lottie")),[].slice.call(document.getElementsByClassName("bodymovin"))),L=I.length;for(C=0;C<L;C+=1)b&&I[C].setAttribute("data-bm-type",b),c(I[C],T);if(S&&L===0){b||(b="svg");var k=document.getElementsByTagName("body")[0];k.innerText="";var U=createTag("div");U.style.width="100%",U.style.height="100%",U.setAttribute("data-bm-type",b),k.appendChild(U),c(U,T)}},r.resize=function(){var T;for(T=0;T<i;T+=1)e[T].animation.resize()},r.goToAndStop=function(T,S,b){var C;for(C=0;C<i;C+=1)e[C].animation.goToAndStop(T,S,b)},r.destroy=function(T){var S;for(S=i-1;S>=0;S-=1)e[S].animation.destroy(T)},r.freeze=function(){a=!0},r.unfreeze=function(){a=!1,m()},r.setVolume=function(T,S){var b;for(b=0;b<i;b+=1)e[b].animation.setVolume(T,S)},r.mute=function(T){var S;for(S=0;S<i;S+=1)e[S].animation.mute(T)},r.unmute=function(T){var S;for(S=0;S<i;S+=1)e[S].animation.unmute(T)},r.getRegisteredAnimations=function(){var T,S=e.length,b=[];for(T=0;T<S;T+=1)b.push(e[T].animation);return b},r})(),BezierFactory=(function(){var r={getBezierEasing:function(u,f,d,g,E){var m=E||("bez_"+u+"_"+f+"_"+d+"_"+g).replace(/\./g,"p");if(e[m])return e[m];var T=new c([u,f,d,g]);return e[m]=T,T}},e={},t=typeof Float32Array=="function";function i(u,f){return 1-3*f+3*u}function s(u,f){return 3*f-6*u}function n(u){return 3*u}function a(u,f,d){return((i(f,d)*u+s(f,d))*u+n(f))*u}function o(u,f,d){return 3*i(f,d)*u*u+2*s(f,d)*u+n(f)}function c(u){this._p=u,this._mSampleValues=t?new Float32Array(11):new Array(11),this._precomputed=!1,this.get=this.get.bind(this)}return c.prototype={get:function(u){var f=this._p[0],d=this._p[1],g=this._p[2],E=this._p[3];return this._precomputed||this._precompute(),f===d&&g===E?u:u===0?0:u===1?1:a(this._getTForX(u),d,E)},_precompute:function(){var u=this._p[0],f=this._p[1],d=this._p[2],g=this._p[3];this._precomputed=!0,u===f&&d===g||this._calcSampleValues()},_calcSampleValues:function(){for(var u=this._p[0],f=this._p[2],d=0;d<11;++d)this._mSampleValues[d]=a(.1*d,u,f)},_getTForX:function(u){for(var f=this._p[0],d=this._p[2],g=this._mSampleValues,E=0,m=1;m!==10&&g[m]<=u;++m)E+=.1;var T=E+.1*((u-g[--m])/(g[m+1]-g[m])),S=o(T,f,d);return S>=.001?(function(b,C,I,L){for(var k=0;k<4;++k){var U=o(C,I,L);if(U===0)return C;C-=(a(C,I,L)-b)/U}return C})(u,T,f,d):S===0?T:(function(b,C,I,L,k){var U,O,F=0;do(U=a(O=C+(I-C)/2,L,k)-b)>0?I=O:C=O;while(Math.abs(U)>1e-7&&++F<10);return O})(u,E,E+.1,f,d)}},r})(),pooling={double:function(r){return r.concat(createSizedArray(r.length))}},poolFactory=function(r,e,t){var i=0,s=r,n=createSizedArray(s);return{newElement:function(){return i?n[i-=1]:e()},release:function(a){i===s&&(n=pooling.double(n),s*=2),t&&t(a),n[i]=a,i+=1}}},bezierLengthPool=poolFactory(8,(function(){return{addedLength:0,percents:createTypedArray("float32",getDefaultCurveSegments()),lengths:createTypedArray("float32",getDefaultCurveSegments())}})),segmentsLengthPool=poolFactory(8,(function(){return{lengths:[],totalLength:0}}),(function(r){var e,t=r.lengths.length;for(e=0;e<t;e+=1)bezierLengthPool.release(r.lengths[e]);r.lengths.length=0}));function bezFunction(){var r=Math;function e(u,f,d,g,E,m){var T=u*g+f*E+d*m-E*g-m*u-d*f;return T>-.001&&T<.001}var t=function(u,f,d,g){var E,m,T,S,b,C,I=getDefaultCurveSegments(),L=0,k=[],U=[],O=bezierLengthPool.newElement();for(T=d.length,E=0;E<I;E+=1){for(b=E/(I-1),C=0,m=0;m<T;m+=1)S=bmPow(1-b,3)*u[m]+3*bmPow(1-b,2)*b*d[m]+3*(1-b)*bmPow(b,2)*g[m]+bmPow(b,3)*f[m],k[m]=S,U[m]!==null&&(C+=bmPow(k[m]-U[m],2)),U[m]=k[m];C&&(L+=C=bmSqrt(C)),O.percents[E]=b,O.lengths[E]=L}return O.addedLength=L,O};function i(u){this.segmentLength=0,this.points=new Array(u)}function s(u,f){this.partialLength=u,this.point=f}var n,a=(n={},function(u,f,d,g){var E=(u[0]+"_"+u[1]+"_"+f[0]+"_"+f[1]+"_"+d[0]+"_"+d[1]+"_"+g[0]+"_"+g[1]).replace(/\./g,"p");if(!n[E]){var m,T,S,b,C,I,L,k=getDefaultCurveSegments(),U=0,O=null;u.length===2&&(u[0]!==f[0]||u[1]!==f[1])&&e(u[0],u[1],f[0],f[1],u[0]+d[0],u[1]+d[1])&&e(u[0],u[1],f[0],f[1],f[0]+g[0],f[1]+g[1])&&(k=2);var F=new i(k);for(S=d.length,m=0;m<k;m+=1){for(L=createSizedArray(S),C=m/(k-1),I=0,T=0;T<S;T+=1)b=bmPow(1-C,3)*u[T]+3*bmPow(1-C,2)*C*(u[T]+d[T])+3*(1-C)*bmPow(C,2)*(f[T]+g[T])+bmPow(C,3)*f[T],L[T]=b,O!==null&&(I+=bmPow(L[T]-O[T],2));U+=I=bmSqrt(I),F.points[m]=new s(I,L),O=L}F.segmentLength=U,n[E]=F}return n[E]});function o(u,f){var d=f.percents,g=f.lengths,E=d.length,m=bmFloor((E-1)*u),T=u*f.addedLength,S=0;if(m===E-1||m===0||T===g[m])return d[m];for(var b=g[m]>T?-1:1,C=!0;C;)if(g[m]<=T&&g[m+1]>T?(S=(T-g[m])/(g[m+1]-g[m]),C=!1):m+=b,m<0||m>=E-1){if(m===E-1)return d[m];C=!1}return d[m]+(d[m+1]-d[m])*S}var c=createTypedArray("float32",8);return{getSegmentsLength:function(u){var f,d=segmentsLengthPool.newElement(),g=u.c,E=u.v,m=u.o,T=u.i,S=u._length,b=d.lengths,C=0;for(f=0;f<S-1;f+=1)b[f]=t(E[f],E[f+1],m[f],T[f+1]),C+=b[f].addedLength;return g&&S&&(b[f]=t(E[f],E[0],m[f],T[0]),C+=b[f].addedLength),d.totalLength=C,d},getNewSegment:function(u,f,d,g,E,m,T){E<0?E=0:E>1&&(E=1);var S,b=o(E,T),C=o(m=m>1?1:m,T),I=u.length,L=1-b,k=1-C,U=L*L*L,O=b*L*L*3,F=b*b*L*3,G=b*b*b,x=L*L*k,$=b*L*k+L*b*k+L*L*C,X=b*b*k+L*b*C+b*L*C,Q=b*b*C,ee=L*k*k,te=b*k*k+L*C*k+L*k*C,re=b*C*k+L*C*C+b*k*C,me=b*C*C,H=k*k*k,z=C*k*k+k*C*k+k*k*C,ie=C*C*k+k*C*C+C*k*C,ne=C*C*C;for(S=0;S<I;S+=1)c[4*S]=r.round(1e3*(U*u[S]+O*d[S]+F*g[S]+G*f[S]))/1e3,c[4*S+1]=r.round(1e3*(x*u[S]+$*d[S]+X*g[S]+Q*f[S]))/1e3,c[4*S+2]=r.round(1e3*(ee*u[S]+te*d[S]+re*g[S]+me*f[S]))/1e3,c[4*S+3]=r.round(1e3*(H*u[S]+z*d[S]+ie*g[S]+ne*f[S]))/1e3;return c},getPointInSegment:function(u,f,d,g,E,m){var T=o(E,m),S=1-T;return[r.round(1e3*(S*S*S*u[0]+(T*S*S+S*T*S+S*S*T)*d[0]+(T*T*S+S*T*T+T*S*T)*g[0]+T*T*T*f[0]))/1e3,r.round(1e3*(S*S*S*u[1]+(T*S*S+S*T*S+S*S*T)*d[1]+(T*T*S+S*T*T+T*S*T)*g[1]+T*T*T*f[1]))/1e3]},buildBezierData:a,pointOnLine2D:e,pointOnLine3D:function(u,f,d,g,E,m,T,S,b){if(d===0&&m===0&&b===0)return e(u,f,g,E,T,S);var C,I=r.sqrt(r.pow(g-u,2)+r.pow(E-f,2)+r.pow(m-d,2)),L=r.sqrt(r.pow(T-u,2)+r.pow(S-f,2)+r.pow(b-d,2)),k=r.sqrt(r.pow(T-g,2)+r.pow(S-E,2)+r.pow(b-m,2));return(C=I>L?I>k?I-L-k:k-L-I:k>L?k-L-I:L-I-k)>-1e-4&&C<1e-4}}}var bez=bezFunction(),initFrame=initialDefaultFrame,mathAbs=Math.abs;function interpolateValue(r,e){var t,i=this.offsetTime;this.propType==="multidimensional"&&(t=createTypedArray("float32",this.pv.length));for(var s,n,a,o,c,u,f,d,g,E=e.lastIndex,m=E,T=this.keyframes.length-1,S=!0;S;){if(s=this.keyframes[m],n=this.keyframes[m+1],m===T-1&&r>=n.t-i){s.h&&(s=n),E=0;break}if(n.t-i>r){E=m;break}m<T-1?m+=1:(E=0,S=!1)}a=this.keyframesMetadata[m]||{};var b,C=n.t-i,I=s.t-i;if(s.to){a.bezierData||(a.bezierData=bez.buildBezierData(s.s,n.s||s.e,s.to,s.ti));var L=a.bezierData;if(r>=C||r<I){var k=r>=C?L.points.length-1:0;for(c=L.points[k].point.length,o=0;o<c;o+=1)t[o]=L.points[k].point[o]}else{a.__fnct?g=a.__fnct:(g=BezierFactory.getBezierEasing(s.o.x,s.o.y,s.i.x,s.i.y,s.n).get,a.__fnct=g),u=g((r-I)/(C-I));var U,O=L.segmentLength*u,F=e.lastFrame<r&&e._lastKeyframeIndex===m?e._lastAddedLength:0;for(d=e.lastFrame<r&&e._lastKeyframeIndex===m?e._lastPoint:0,S=!0,f=L.points.length;S;){if(F+=L.points[d].partialLength,O===0||u===0||d===L.points.length-1){for(c=L.points[d].point.length,o=0;o<c;o+=1)t[o]=L.points[d].point[o];break}if(O>=F&&O<F+L.points[d+1].partialLength){for(U=(O-F)/L.points[d+1].partialLength,c=L.points[d].point.length,o=0;o<c;o+=1)t[o]=L.points[d].point[o]+(L.points[d+1].point[o]-L.points[d].point[o])*U;break}d<f-1?d+=1:S=!1}e._lastPoint=d,e._lastAddedLength=F-L.points[d].partialLength,e._lastKeyframeIndex=m}}else{var G,x,$,X,Q;if(T=s.s.length,b=n.s||s.e,this.sh&&s.h!==1)r>=C?(t[0]=b[0],t[1]=b[1],t[2]=b[2]):r<=I?(t[0]=s.s[0],t[1]=s.s[1],t[2]=s.s[2]):quaternionToEuler(t,slerp(createQuaternion(s.s),createQuaternion(b),(r-I)/(C-I)));else for(m=0;m<T;m+=1)s.h!==1&&(r>=C?u=1:r<I?u=0:(s.o.x.constructor===Array?(a.__fnct||(a.__fnct=[]),a.__fnct[m]?g=a.__fnct[m]:(G=s.o.x[m]===void 0?s.o.x[0]:s.o.x[m],x=s.o.y[m]===void 0?s.o.y[0]:s.o.y[m],$=s.i.x[m]===void 0?s.i.x[0]:s.i.x[m],X=s.i.y[m]===void 0?s.i.y[0]:s.i.y[m],g=BezierFactory.getBezierEasing(G,x,$,X).get,a.__fnct[m]=g)):a.__fnct?g=a.__fnct:(G=s.o.x,x=s.o.y,$=s.i.x,X=s.i.y,g=BezierFactory.getBezierEasing(G,x,$,X).get,s.keyframeMetadata=g),u=g((r-I)/(C-I)))),b=n.s||s.e,Q=s.h===1?s.s[m]:s.s[m]+(b[m]-s.s[m])*u,this.propType==="multidimensional"?t[m]=Q:t=Q}return e.lastIndex=E,t}function slerp(r,e,t){var i,s,n,a,o,c=[],u=r[0],f=r[1],d=r[2],g=r[3],E=e[0],m=e[1],T=e[2],S=e[3];return(s=u*E+f*m+d*T+g*S)<0&&(s=-s,E=-E,m=-m,T=-T,S=-S),1-s>1e-6?(i=Math.acos(s),n=Math.sin(i),a=Math.sin((1-t)*i)/n,o=Math.sin(t*i)/n):(a=1-t,o=t),c[0]=a*u+o*E,c[1]=a*f+o*m,c[2]=a*d+o*T,c[3]=a*g+o*S,c}function quaternionToEuler(r,e){var t=e[0],i=e[1],s=e[2],n=e[3],a=Math.atan2(2*i*n-2*t*s,1-2*i*i-2*s*s),o=Math.asin(2*t*i+2*s*n),c=Math.atan2(2*t*n-2*i*s,1-2*t*t-2*s*s);r[0]=a/degToRads,r[1]=o/degToRads,r[2]=c/degToRads}function createQuaternion(r){var e=r[0]*degToRads,t=r[1]*degToRads,i=r[2]*degToRads,s=Math.cos(e/2),n=Math.cos(t/2),a=Math.cos(i/2),o=Math.sin(e/2),c=Math.sin(t/2),u=Math.sin(i/2);return[o*c*a+s*n*u,o*n*a+s*c*u,s*c*a-o*n*u,s*n*a-o*c*u]}function getValueAtCurrentTime(){var r=this.comp.renderedFrame-this.offsetTime,e=this.keyframes[0].t-this.offsetTime,t=this.keyframes[this.keyframes.length-1].t-this.offsetTime;if(!(r===this._caching.lastFrame||this._caching.lastFrame!==initFrame&&(this._caching.lastFrame>=t&&r>=t||this._caching.lastFrame<e&&r<e))){this._caching.lastFrame>=r&&(this._caching._lastKeyframeIndex=-1,this._caching.lastIndex=0);var i=this.interpolateValue(r,this._caching);this.pv=i}return this._caching.lastFrame=r,this.pv}function setVValue(r){var e;if(this.propType==="unidimensional")e=r*this.mult,mathAbs(this.v-e)>1e-5&&(this.v=e,this._mdf=!0);else for(var t=0,i=this.v.length;t<i;)e=r[t]*this.mult,mathAbs(this.v[t]-e)>1e-5&&(this.v[t]=e,this._mdf=!0),t+=1}function processEffectsSequence(){if(this.elem.globalData.frameId!==this.frameId&&this.effectsSequence.length)if(this.lock)this.setVValue(this.pv);else{var r;this.lock=!0,this._mdf=this._isFirstFrame;var e=this.effectsSequence.length,t=this.kf?this.pv:this.data.k;for(r=0;r<e;r+=1)t=this.effectsSequence[r](t);this.setVValue(t),this._isFirstFrame=!1,this.lock=!1,this.frameId=this.elem.globalData.frameId}}function addEffect(r){this.effectsSequence.push(r),this.container.addDynamicProperty(this)}function ValueProperty(r,e,t,i){this.propType="unidimensional",this.mult=t||1,this.data=e,this.v=t?e.k*t:e.k,this.pv=e.k,this._mdf=!1,this.elem=r,this.container=i,this.comp=r.comp,this.k=!1,this.kf=!1,this.vel=0,this.effectsSequence=[],this._isFirstFrame=!0,this.getValue=processEffectsSequence,this.setVValue=setVValue,this.addEffect=addEffect}function MultiDimensionalProperty(r,e,t,i){var s;this.propType="multidimensional",this.mult=t||1,this.data=e,this._mdf=!1,this.elem=r,this.container=i,this.comp=r.comp,this.k=!1,this.kf=!1,this.frameId=-1;var n=e.k.length;for(this.v=createTypedArray("float32",n),this.pv=createTypedArray("float32",n),this.vel=createTypedArray("float32",n),s=0;s<n;s+=1)this.v[s]=e.k[s]*this.mult,this.pv[s]=e.k[s];this._isFirstFrame=!0,this.effectsSequence=[],this.getValue=processEffectsSequence,this.setVValue=setVValue,this.addEffect=addEffect}function KeyframedValueProperty(r,e,t,i){this.propType="unidimensional",this.keyframes=e.k,this.keyframesMetadata=[],this.offsetTime=r.data.st,this.frameId=-1,this._caching={lastFrame:initFrame,lastIndex:0,value:0,_lastKeyframeIndex:-1},this.k=!0,this.kf=!0,this.data=e,this.mult=t||1,this.elem=r,this.container=i,this.comp=r.comp,this.v=initFrame,this.pv=initFrame,this._isFirstFrame=!0,this.getValue=processEffectsSequence,this.setVValue=setVValue,this.interpolateValue=interpolateValue,this.effectsSequence=[getValueAtCurrentTime.bind(this)],this.addEffect=addEffect}function KeyframedMultidimensionalProperty(r,e,t,i){var s;this.propType="multidimensional";var n,a,o,c,u=e.k.length;for(s=0;s<u-1;s+=1)e.k[s].to&&e.k[s].s&&e.k[s+1]&&e.k[s+1].s&&(n=e.k[s].s,a=e.k[s+1].s,o=e.k[s].to,c=e.k[s].ti,(n.length===2&&(n[0]!==a[0]||n[1]!==a[1])&&bez.pointOnLine2D(n[0],n[1],a[0],a[1],n[0]+o[0],n[1]+o[1])&&bez.pointOnLine2D(n[0],n[1],a[0],a[1],a[0]+c[0],a[1]+c[1])||n.length===3&&(n[0]!==a[0]||n[1]!==a[1]||n[2]!==a[2])&&bez.pointOnLine3D(n[0],n[1],n[2],a[0],a[1],a[2],n[0]+o[0],n[1]+o[1],n[2]+o[2])&&bez.pointOnLine3D(n[0],n[1],n[2],a[0],a[1],a[2],a[0]+c[0],a[1]+c[1],a[2]+c[2]))&&(e.k[s].to=null,e.k[s].ti=null),n[0]===a[0]&&n[1]===a[1]&&o[0]===0&&o[1]===0&&c[0]===0&&c[1]===0&&(n.length===2||n[2]===a[2]&&o[2]===0&&c[2]===0)&&(e.k[s].to=null,e.k[s].ti=null));this.effectsSequence=[getValueAtCurrentTime.bind(this)],this.data=e,this.keyframes=e.k,this.keyframesMetadata=[],this.offsetTime=r.data.st,this.k=!0,this.kf=!0,this._isFirstFrame=!0,this.mult=t||1,this.elem=r,this.container=i,this.comp=r.comp,this.getValue=processEffectsSequence,this.setVValue=setVValue,this.interpolateValue=interpolateValue,this.frameId=-1;var f=e.k[0].s.length;for(this.v=createTypedArray("float32",f),this.pv=createTypedArray("float32",f),s=0;s<f;s+=1)this.v[s]=initFrame,this.pv[s]=initFrame;this._caching={lastFrame:initFrame,lastIndex:0,value:createTypedArray("float32",f)},this.addEffect=addEffect}var PropertyFactory={getProp:function(r,e,t,i,s){var n;if(e.sid&&(e=r.globalData.slotManager.getProp(e)),e.k.length)if(typeof e.k[0]=="number")n=new MultiDimensionalProperty(r,e,i,s);else switch(t){case 0:n=new KeyframedValueProperty(r,e,i,s);break;case 1:n=new KeyframedMultidimensionalProperty(r,e,i,s)}else n=new ValueProperty(r,e,i,s);return n.effectsSequence.length&&s.addDynamicProperty(n),n}};function DynamicPropertyContainer(){}DynamicPropertyContainer.prototype={addDynamicProperty:function(r){this.dynamicProperties.indexOf(r)===-1&&(this.dynamicProperties.push(r),this.container.addDynamicProperty(this),this._isAnimated=!0)},iterateDynamicProperties:function(){var r;this._mdf=!1;var e=this.dynamicProperties.length;for(r=0;r<e;r+=1)this.dynamicProperties[r].getValue(),this.dynamicProperties[r]._mdf&&(this._mdf=!0)},initDynamicPropertyContainer:function(r){this.container=r,this.dynamicProperties=[],this._mdf=!1,this._isAnimated=!1}};var pointPool=poolFactory(8,(function(){return createTypedArray("float32",2)}));function ShapePath(){this.c=!1,this._length=0,this._maxLength=8,this.v=createSizedArray(this._maxLength),this.o=createSizedArray(this._maxLength),this.i=createSizedArray(this._maxLength)}ShapePath.prototype.setPathData=function(r,e){this.c=r,this.setLength(e);for(var t=0;t<e;)this.v[t]=pointPool.newElement(),this.o[t]=pointPool.newElement(),this.i[t]=pointPool.newElement(),t+=1},ShapePath.prototype.setLength=function(r){for(;this._maxLength<r;)this.doubleArrayLength();this._length=r},ShapePath.prototype.doubleArrayLength=function(){this.v=this.v.concat(createSizedArray(this._maxLength)),this.i=this.i.concat(createSizedArray(this._maxLength)),this.o=this.o.concat(createSizedArray(this._maxLength)),this._maxLength*=2},ShapePath.prototype.setXYAt=function(r,e,t,i,s){var n;switch(this._length=Math.max(this._length,i+1),this._length>=this._maxLength&&this.doubleArrayLength(),t){case"v":n=this.v;break;case"i":n=this.i;break;case"o":n=this.o;break;default:n=[]}(!n[i]||n[i]&&!s)&&(n[i]=pointPool.newElement()),n[i][0]=r,n[i][1]=e},ShapePath.prototype.setTripleAt=function(r,e,t,i,s,n,a,o){this.setXYAt(r,e,"v",a,o),this.setXYAt(t,i,"o",a,o),this.setXYAt(s,n,"i",a,o)},ShapePath.prototype.reverse=function(){var r=new ShapePath;r.setPathData(this.c,this._length);var e=this.v,t=this.o,i=this.i,s=0;this.c&&(r.setTripleAt(e[0][0],e[0][1],i[0][0],i[0][1],t[0][0],t[0][1],0,!1),s=1);var n,a=this._length-1,o=this._length;for(n=s;n<o;n+=1)r.setTripleAt(e[a][0],e[a][1],i[a][0],i[a][1],t[a][0],t[a][1],n,!1),a-=1;return r},ShapePath.prototype.length=function(){return this._length};var shapePool=(factory=poolFactory(4,(function(){return new ShapePath}),(function(r){var e,t=r._length;for(e=0;e<t;e+=1)pointPool.release(r.v[e]),pointPool.release(r.i[e]),pointPool.release(r.o[e]),r.v[e]=null,r.i[e]=null,r.o[e]=null;r._length=0,r.c=!1})),factory.clone=function(r){var e,t=factory.newElement(),i=r._length===void 0?r.v.length:r._length;for(t.setLength(i),t.c=r.c,e=0;e<i;e+=1)t.setTripleAt(r.v[e][0],r.v[e][1],r.o[e][0],r.o[e][1],r.i[e][0],r.i[e][1],e);return t},factory),factory;function ShapeCollection(){this._length=0,this._maxLength=4,this.shapes=createSizedArray(this._maxLength)}ShapeCollection.prototype.addShape=function(r){this._length===this._maxLength&&(this.shapes=this.shapes.concat(createSizedArray(this._maxLength)),this._maxLength*=2),this.shapes[this._length]=r,this._length+=1},ShapeCollection.prototype.releaseShapes=function(){var r;for(r=0;r<this._length;r+=1)shapePool.release(this.shapes[r]);this._length=0};var shapeCollectionPool=(ob={newShapeCollection:function(){return _length?pool[_length-=1]:new ShapeCollection},release:function(r){var e,t=r._length;for(e=0;e<t;e+=1)shapePool.release(r.shapes[e]);r._length=0,_length===_maxLength&&(pool=pooling.double(pool),_maxLength*=2),pool[_length]=r,_length+=1}},_length=0,_maxLength=4,pool=createSizedArray(_maxLength),ob),ob,_length,_maxLength,pool,ShapePropertyFactory=(function(){function r(g,E,m){var T,S,b,C,I,L,k,U,O,F=m.lastIndex,G=this.keyframes;if(g<G[0].t-this.offsetTime)T=G[0].s[0],b=!0,F=0;else if(g>=G[G.length-1].t-this.offsetTime)T=G[G.length-1].s?G[G.length-1].s[0]:G[G.length-2].e[0],b=!0;else{for(var x,$,X,Q=F,ee=G.length-1,te=!0;te&&(x=G[Q],!(($=G[Q+1]).t-this.offsetTime>g));)Q<ee-1?Q+=1:te=!1;if(X=this.keyframesMetadata[Q]||{},F=Q,!(b=x.h===1)){if(g>=$.t-this.offsetTime)U=1;else if(g<x.t-this.offsetTime)U=0;else{var re;X.__fnct?re=X.__fnct:(re=BezierFactory.getBezierEasing(x.o.x,x.o.y,x.i.x,x.i.y).get,X.__fnct=re),U=re((g-(x.t-this.offsetTime))/($.t-this.offsetTime-(x.t-this.offsetTime)))}S=$.s?$.s[0]:x.e[0]}T=x.s[0]}for(L=E._length,k=T.i[0].length,m.lastIndex=F,C=0;C<L;C+=1)for(I=0;I<k;I+=1)O=b?T.i[C][I]:T.i[C][I]+(S.i[C][I]-T.i[C][I])*U,E.i[C][I]=O,O=b?T.o[C][I]:T.o[C][I]+(S.o[C][I]-T.o[C][I])*U,E.o[C][I]=O,O=b?T.v[C][I]:T.v[C][I]+(S.v[C][I]-T.v[C][I])*U,E.v[C][I]=O}function e(){var g=this.comp.renderedFrame-this.offsetTime,E=this.keyframes[0].t-this.offsetTime,m=this.keyframes[this.keyframes.length-1].t-this.offsetTime,T=this._caching.lastFrame;return T!==-999999&&(T<E&&g<E||T>m&&g>m)||(this._caching.lastIndex=T<g?this._caching.lastIndex:0,this.interpolateShape(g,this.pv,this._caching)),this._caching.lastFrame=g,this.pv}function t(){this.paths=this.localShapeCollection}function i(g){(function(E,m){if(E._length!==m._length||E.c!==m.c)return!1;var T,S=E._length;for(T=0;T<S;T+=1)if(E.v[T][0]!==m.v[T][0]||E.v[T][1]!==m.v[T][1]||E.o[T][0]!==m.o[T][0]||E.o[T][1]!==m.o[T][1]||E.i[T][0]!==m.i[T][0]||E.i[T][1]!==m.i[T][1])return!1;return!0})(this.v,g)||(this.v=shapePool.clone(g),this.localShapeCollection.releaseShapes(),this.localShapeCollection.addShape(this.v),this._mdf=!0,this.paths=this.localShapeCollection)}function s(){if(this.elem.globalData.frameId!==this.frameId)if(this.effectsSequence.length)if(this.lock)this.setVValue(this.pv);else{var g,E;this.lock=!0,this._mdf=!1,g=this.kf?this.pv:this.data.ks?this.data.ks.k:this.data.pt.k;var m=this.effectsSequence.length;for(E=0;E<m;E+=1)g=this.effectsSequence[E](g);this.setVValue(g),this.lock=!1,this.frameId=this.elem.globalData.frameId}else this._mdf=!1}function n(g,E,m){this.propType="shape",this.comp=g.comp,this.container=g,this.elem=g,this.data=E,this.k=!1,this.kf=!1,this._mdf=!1;var T=m===3?E.pt.k:E.ks.k;this.v=shapePool.clone(T),this.pv=shapePool.clone(this.v),this.localShapeCollection=shapeCollectionPool.newShapeCollection(),this.paths=this.localShapeCollection,this.paths.addShape(this.v),this.reset=t,this.effectsSequence=[]}function a(g){this.effectsSequence.push(g),this.container.addDynamicProperty(this)}function o(g,E,m){this.propType="shape",this.comp=g.comp,this.elem=g,this.container=g,this.offsetTime=g.data.st,this.keyframes=m===3?E.pt.k:E.ks.k,this.keyframesMetadata=[],this.k=!0,this.kf=!0;var T=this.keyframes[0].s[0].i.length;this.v=shapePool.newElement(),this.v.setPathData(this.keyframes[0].s[0].c,T),this.pv=shapePool.clone(this.v),this.localShapeCollection=shapeCollectionPool.newShapeCollection(),this.paths=this.localShapeCollection,this.paths.addShape(this.v),this.lastFrame=-999999,this.reset=t,this._caching={lastFrame:-999999,lastIndex:0},this.effectsSequence=[e.bind(this)]}n.prototype.interpolateShape=r,n.prototype.getValue=s,n.prototype.setVValue=i,n.prototype.addEffect=a,o.prototype.getValue=s,o.prototype.interpolateShape=r,o.prototype.setVValue=i,o.prototype.addEffect=a;var c=(function(){var g=roundCorner;function E(m,T){this.v=shapePool.newElement(),this.v.setPathData(!0,4),this.localShapeCollection=shapeCollectionPool.newShapeCollection(),this.paths=this.localShapeCollection,this.localShapeCollection.addShape(this.v),this.d=T.d,this.elem=m,this.comp=m.comp,this.frameId=-1,this.initDynamicPropertyContainer(m),this.p=PropertyFactory.getProp(m,T.p,1,0,this),this.s=PropertyFactory.getProp(m,T.s,1,0,this),this.dynamicProperties.length?this.k=!0:(this.k=!1,this.convertEllToPath())}return E.prototype={reset:t,getValue:function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf&&this.convertEllToPath())},convertEllToPath:function(){var m=this.p.v[0],T=this.p.v[1],S=this.s.v[0]/2,b=this.s.v[1]/2,C=this.d!==3,I=this.v;I.v[0][0]=m,I.v[0][1]=T-b,I.v[1][0]=C?m+S:m-S,I.v[1][1]=T,I.v[2][0]=m,I.v[2][1]=T+b,I.v[3][0]=C?m-S:m+S,I.v[3][1]=T,I.i[0][0]=C?m-S*g:m+S*g,I.i[0][1]=T-b,I.i[1][0]=C?m+S:m-S,I.i[1][1]=T-b*g,I.i[2][0]=C?m+S*g:m-S*g,I.i[2][1]=T+b,I.i[3][0]=C?m-S:m+S,I.i[3][1]=T+b*g,I.o[0][0]=C?m+S*g:m-S*g,I.o[0][1]=T-b,I.o[1][0]=C?m+S:m-S,I.o[1][1]=T+b*g,I.o[2][0]=C?m-S*g:m+S*g,I.o[2][1]=T+b,I.o[3][0]=C?m-S:m+S,I.o[3][1]=T-b*g}},extendPrototype([DynamicPropertyContainer],E),E})(),u=(function(){function g(E,m){this.v=shapePool.newElement(),this.v.setPathData(!0,0),this.elem=E,this.comp=E.comp,this.data=m,this.frameId=-1,this.d=m.d,this.initDynamicPropertyContainer(E),m.sy===1?(this.ir=PropertyFactory.getProp(E,m.ir,0,0,this),this.is=PropertyFactory.getProp(E,m.is,0,.01,this),this.convertToPath=this.convertStarToPath):this.convertToPath=this.convertPolygonToPath,this.pt=PropertyFactory.getProp(E,m.pt,0,0,this),this.p=PropertyFactory.getProp(E,m.p,1,0,this),this.r=PropertyFactory.getProp(E,m.r,0,degToRads,this),this.or=PropertyFactory.getProp(E,m.or,0,0,this),this.os=PropertyFactory.getProp(E,m.os,0,.01,this),this.localShapeCollection=shapeCollectionPool.newShapeCollection(),this.localShapeCollection.addShape(this.v),this.paths=this.localShapeCollection,this.dynamicProperties.length?this.k=!0:(this.k=!1,this.convertToPath())}return g.prototype={reset:t,getValue:function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf&&this.convertToPath())},convertStarToPath:function(){var E,m,T,S,b=2*Math.floor(this.pt.v),C=2*Math.PI/b,I=!0,L=this.or.v,k=this.ir.v,U=this.os.v,O=this.is.v,F=2*Math.PI*L/(2*b),G=2*Math.PI*k/(2*b),x=-Math.PI/2;x+=this.r.v;var $=this.data.d===3?-1:1;for(this.v._length=0,E=0;E<b;E+=1){T=I?U:O,S=I?F:G;var X=(m=I?L:k)*Math.cos(x),Q=m*Math.sin(x),ee=X===0&&Q===0?0:Q/Math.sqrt(X*X+Q*Q),te=X===0&&Q===0?0:-X/Math.sqrt(X*X+Q*Q);X+=+this.p.v[0],Q+=+this.p.v[1],this.v.setTripleAt(X,Q,X-ee*S*T*$,Q-te*S*T*$,X+ee*S*T*$,Q+te*S*T*$,E,!0),I=!I,x+=C*$}},convertPolygonToPath:function(){var E,m=Math.floor(this.pt.v),T=2*Math.PI/m,S=this.or.v,b=this.os.v,C=2*Math.PI*S/(4*m),I=.5*-Math.PI,L=this.data.d===3?-1:1;for(I+=this.r.v,this.v._length=0,E=0;E<m;E+=1){var k=S*Math.cos(I),U=S*Math.sin(I),O=k===0&&U===0?0:U/Math.sqrt(k*k+U*U),F=k===0&&U===0?0:-k/Math.sqrt(k*k+U*U);k+=+this.p.v[0],U+=+this.p.v[1],this.v.setTripleAt(k,U,k-O*C*b*L,U-F*C*b*L,k+O*C*b*L,U+F*C*b*L,E,!0),I+=T*L}this.paths.length=0,this.paths[0]=this.v}},extendPrototype([DynamicPropertyContainer],g),g})(),f=(function(){function g(E,m){this.v=shapePool.newElement(),this.v.c=!0,this.localShapeCollection=shapeCollectionPool.newShapeCollection(),this.localShapeCollection.addShape(this.v),this.paths=this.localShapeCollection,this.elem=E,this.comp=E.comp,this.frameId=-1,this.d=m.d,this.initDynamicPropertyContainer(E),this.p=PropertyFactory.getProp(E,m.p,1,0,this),this.s=PropertyFactory.getProp(E,m.s,1,0,this),this.r=PropertyFactory.getProp(E,m.r,0,0,this),this.dynamicProperties.length?this.k=!0:(this.k=!1,this.convertRectToPath())}return g.prototype={convertRectToPath:function(){var E=this.p.v[0],m=this.p.v[1],T=this.s.v[0]/2,S=this.s.v[1]/2,b=bmMin(T,S,this.r.v),C=b*(1-roundCorner);this.v._length=0,this.d===2||this.d===1?(this.v.setTripleAt(E+T,m-S+b,E+T,m-S+b,E+T,m-S+C,0,!0),this.v.setTripleAt(E+T,m+S-b,E+T,m+S-C,E+T,m+S-b,1,!0),b!==0?(this.v.setTripleAt(E+T-b,m+S,E+T-b,m+S,E+T-C,m+S,2,!0),this.v.setTripleAt(E-T+b,m+S,E-T+C,m+S,E-T+b,m+S,3,!0),this.v.setTripleAt(E-T,m+S-b,E-T,m+S-b,E-T,m+S-C,4,!0),this.v.setTripleAt(E-T,m-S+b,E-T,m-S+C,E-T,m-S+b,5,!0),this.v.setTripleAt(E-T+b,m-S,E-T+b,m-S,E-T+C,m-S,6,!0),this.v.setTripleAt(E+T-b,m-S,E+T-C,m-S,E+T-b,m-S,7,!0)):(this.v.setTripleAt(E-T,m+S,E-T+C,m+S,E-T,m+S,2),this.v.setTripleAt(E-T,m-S,E-T,m-S+C,E-T,m-S,3))):(this.v.setTripleAt(E+T,m-S+b,E+T,m-S+C,E+T,m-S+b,0,!0),b!==0?(this.v.setTripleAt(E+T-b,m-S,E+T-b,m-S,E+T-C,m-S,1,!0),this.v.setTripleAt(E-T+b,m-S,E-T+C,m-S,E-T+b,m-S,2,!0),this.v.setTripleAt(E-T,m-S+b,E-T,m-S+b,E-T,m-S+C,3,!0),this.v.setTripleAt(E-T,m+S-b,E-T,m+S-C,E-T,m+S-b,4,!0),this.v.setTripleAt(E-T+b,m+S,E-T+b,m+S,E-T+C,m+S,5,!0),this.v.setTripleAt(E+T-b,m+S,E+T-C,m+S,E+T-b,m+S,6,!0),this.v.setTripleAt(E+T,m+S-b,E+T,m+S-b,E+T,m+S-C,7,!0)):(this.v.setTripleAt(E-T,m-S,E-T+C,m-S,E-T,m-S,1,!0),this.v.setTripleAt(E-T,m+S,E-T,m+S-C,E-T,m+S,2,!0),this.v.setTripleAt(E+T,m+S,E+T-C,m+S,E+T,m+S,3,!0)))},getValue:function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf&&this.convertRectToPath())},reset:t},extendPrototype([DynamicPropertyContainer],g),g})(),d={getShapeProp:function(g,E,m){var T;return m===3||m===4?T=(m===3?E.pt:E.ks).k.length?new o(g,E,m):new n(g,E,m):m===5?T=new f(g,E):m===6?T=new c(g,E):m===7&&(T=new u(g,E)),T.k&&g.addDynamicProperty(T),T},getConstructorFunction:function(){return n},getKeyframedConstructorFunction:function(){return o}};return d})(),Matrix=(function(){var r=Math.cos,e=Math.sin,t=Math.tan,i=Math.round;function s(){return this.props[0]=1,this.props[1]=0,this.props[2]=0,this.props[3]=0,this.props[4]=0,this.props[5]=1,this.props[6]=0,this.props[7]=0,this.props[8]=0,this.props[9]=0,this.props[10]=1,this.props[11]=0,this.props[12]=0,this.props[13]=0,this.props[14]=0,this.props[15]=1,this}function n(H){if(H===0)return this;var z=r(H),ie=e(H);return this._t(z,-ie,0,0,ie,z,0,0,0,0,1,0,0,0,0,1)}function a(H){if(H===0)return this;var z=r(H),ie=e(H);return this._t(1,0,0,0,0,z,-ie,0,0,ie,z,0,0,0,0,1)}function o(H){if(H===0)return this;var z=r(H),ie=e(H);return this._t(z,0,ie,0,0,1,0,0,-ie,0,z,0,0,0,0,1)}function c(H){if(H===0)return this;var z=r(H),ie=e(H);return this._t(z,-ie,0,0,ie,z,0,0,0,0,1,0,0,0,0,1)}function u(H,z){return this._t(1,z,H,1,0,0)}function f(H,z){return this.shear(t(H),t(z))}function d(H,z){var ie=r(z),ne=e(z);return this._t(ie,ne,0,0,-ne,ie,0,0,0,0,1,0,0,0,0,1)._t(1,0,0,0,t(H),1,0,0,0,0,1,0,0,0,0,1)._t(ie,-ne,0,0,ne,ie,0,0,0,0,1,0,0,0,0,1)}function g(H,z,ie){return ie||ie===0||(ie=1),H===1&&z===1&&ie===1?this:this._t(H,0,0,0,0,z,0,0,0,0,ie,0,0,0,0,1)}function E(H,z,ie,ne,he,pe,Pe,ae,Ae,Re,Le,Y,q,le,ce,Ee){return this.props[0]=H,this.props[1]=z,this.props[2]=ie,this.props[3]=ne,this.props[4]=he,this.props[5]=pe,this.props[6]=Pe,this.props[7]=ae,this.props[8]=Ae,this.props[9]=Re,this.props[10]=Le,this.props[11]=Y,this.props[12]=q,this.props[13]=le,this.props[14]=ce,this.props[15]=Ee,this}function m(H,z,ie){return ie=ie||0,H!==0||z!==0||ie!==0?this._t(1,0,0,0,0,1,0,0,0,0,1,0,H,z,ie,1):this}function T(H,z,ie,ne,he,pe,Pe,ae,Ae,Re,Le,Y,q,le,ce,Ee){var ve=this.props;if(H===1&&z===0&&ie===0&&ne===0&&he===0&&pe===1&&Pe===0&&ae===0&&Ae===0&&Re===0&&Le===1&&Y===0)return ve[12]=ve[12]*H+ve[15]*q,ve[13]=ve[13]*pe+ve[15]*le,ve[14]=ve[14]*Le+ve[15]*ce,ve[15]*=Ee,this._identityCalculated=!1,this;var Be=ve[0],Ie=ve[1],Me=ve[2],Ve=ve[3],dt=ve[4],Qe=ve[5],ze=ve[6],Je=ve[7],gt=ve[8],yt=ve[9],_t=ve[10],qe=ve[11],Yt=ve[12],Dt=ve[13],St=ve[14],Se=ve[15];return ve[0]=Be*H+Ie*he+Me*Ae+Ve*q,ve[1]=Be*z+Ie*pe+Me*Re+Ve*le,ve[2]=Be*ie+Ie*Pe+Me*Le+Ve*ce,ve[3]=Be*ne+Ie*ae+Me*Y+Ve*Ee,ve[4]=dt*H+Qe*he+ze*Ae+Je*q,ve[5]=dt*z+Qe*pe+ze*Re+Je*le,ve[6]=dt*ie+Qe*Pe+ze*Le+Je*ce,ve[7]=dt*ne+Qe*ae+ze*Y+Je*Ee,ve[8]=gt*H+yt*he+_t*Ae+qe*q,ve[9]=gt*z+yt*pe+_t*Re+qe*le,ve[10]=gt*ie+yt*Pe+_t*Le+qe*ce,ve[11]=gt*ne+yt*ae+_t*Y+qe*Ee,ve[12]=Yt*H+Dt*he+St*Ae+Se*q,ve[13]=Yt*z+Dt*pe+St*Re+Se*le,ve[14]=Yt*ie+Dt*Pe+St*Le+Se*ce,ve[15]=Yt*ne+Dt*ae+St*Y+Se*Ee,this._identityCalculated=!1,this}function S(H){var z=H.props;return this.transform(z[0],z[1],z[2],z[3],z[4],z[5],z[6],z[7],z[8],z[9],z[10],z[11],z[12],z[13],z[14],z[15])}function b(){return this._identityCalculated||(this._identity=!(this.props[0]!==1||this.props[1]!==0||this.props[2]!==0||this.props[3]!==0||this.props[4]!==0||this.props[5]!==1||this.props[6]!==0||this.props[7]!==0||this.props[8]!==0||this.props[9]!==0||this.props[10]!==1||this.props[11]!==0||this.props[12]!==0||this.props[13]!==0||this.props[14]!==0||this.props[15]!==1),this._identityCalculated=!0),this._identity}function C(H){for(var z=0;z<16;){if(H.props[z]!==this.props[z])return!1;z+=1}return!0}function I(H){var z;for(z=0;z<16;z+=1)H.props[z]=this.props[z];return H}function L(H){var z;for(z=0;z<16;z+=1)this.props[z]=H[z]}function k(H,z,ie){return{x:H*this.props[0]+z*this.props[4]+ie*this.props[8]+this.props[12],y:H*this.props[1]+z*this.props[5]+ie*this.props[9]+this.props[13],z:H*this.props[2]+z*this.props[6]+ie*this.props[10]+this.props[14]}}function U(H,z,ie){return H*this.props[0]+z*this.props[4]+ie*this.props[8]+this.props[12]}function O(H,z,ie){return H*this.props[1]+z*this.props[5]+ie*this.props[9]+this.props[13]}function F(H,z,ie){return H*this.props[2]+z*this.props[6]+ie*this.props[10]+this.props[14]}function G(){var H=this.props[0]*this.props[5]-this.props[1]*this.props[4],z=this.props[5]/H,ie=-this.props[1]/H,ne=-this.props[4]/H,he=this.props[0]/H,pe=(this.props[4]*this.props[13]-this.props[5]*this.props[12])/H,Pe=-(this.props[0]*this.props[13]-this.props[1]*this.props[12])/H,ae=new Matrix;return ae.props[0]=z,ae.props[1]=ie,ae.props[4]=ne,ae.props[5]=he,ae.props[12]=pe,ae.props[13]=Pe,ae}function x(H){return this.getInverseMatrix().applyToPointArray(H[0],H[1],H[2]||0)}function $(H){var z,ie=H.length,ne=[];for(z=0;z<ie;z+=1)ne[z]=x(H[z]);return ne}function X(H,z,ie){var ne=createTypedArray("float32",6);if(this.isIdentity())ne[0]=H[0],ne[1]=H[1],ne[2]=z[0],ne[3]=z[1],ne[4]=ie[0],ne[5]=ie[1];else{var he=this.props[0],pe=this.props[1],Pe=this.props[4],ae=this.props[5],Ae=this.props[12],Re=this.props[13];ne[0]=H[0]*he+H[1]*Pe+Ae,ne[1]=H[0]*pe+H[1]*ae+Re,ne[2]=z[0]*he+z[1]*Pe+Ae,ne[3]=z[0]*pe+z[1]*ae+Re,ne[4]=ie[0]*he+ie[1]*Pe+Ae,ne[5]=ie[0]*pe+ie[1]*ae+Re}return ne}function Q(H,z,ie){return this.isIdentity()?[H,z,ie]:[H*this.props[0]+z*this.props[4]+ie*this.props[8]+this.props[12],H*this.props[1]+z*this.props[5]+ie*this.props[9]+this.props[13],H*this.props[2]+z*this.props[6]+ie*this.props[10]+this.props[14]]}function ee(H,z){if(this.isIdentity())return H+","+z;var ie=this.props;return Math.round(100*(H*ie[0]+z*ie[4]+ie[12]))/100+","+Math.round(100*(H*ie[1]+z*ie[5]+ie[13]))/100}function te(){for(var H=0,z=this.props,ie="matrix3d(";H<16;)ie+=i(1e4*z[H])/1e4,ie+=H===15?")":",",H+=1;return ie}function re(H){return H<1e-6&&H>0||H>-1e-6&&H<0?i(1e4*H)/1e4:H}function me(){var H=this.props;return"matrix("+re(H[0])+","+re(H[1])+","+re(H[4])+","+re(H[5])+","+re(H[12])+","+re(H[13])+")"}return function(){this.reset=s,this.rotate=n,this.rotateX=a,this.rotateY=o,this.rotateZ=c,this.skew=f,this.skewFromAxis=d,this.shear=u,this.scale=g,this.setTransform=E,this.translate=m,this.transform=T,this.multiply=S,this.applyToPoint=k,this.applyToX=U,this.applyToY=O,this.applyToZ=F,this.applyToPointArray=Q,this.applyToTriplePoints=X,this.applyToPointStringified=ee,this.toCSS=te,this.to2dCSS=me,this.clone=I,this.cloneFromProps=L,this.equals=C,this.inversePoints=$,this.inversePoint=x,this.getInverseMatrix=G,this._t=this.transform,this.isIdentity=b,this._identity=!0,this._identityCalculated=!1,this.props=createTypedArray("float32",16),this.reset()}})();function _typeof$3(r){return(_typeof$3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(r)}var lottie={};function setLocation(r){setLocationHref(r)}function searchAnimations(){animationManager.searchAnimations()}function setSubframeRendering(r){setSubframeEnabled(r)}function setPrefix(r){setIdPrefix(r)}function loadAnimation(r){return animationManager.loadAnimation(r)}function setQuality(r){if(typeof r=="string")switch(r){case"high":setDefaultCurveSegments(200);break;default:case"medium":setDefaultCurveSegments(50);break;case"low":setDefaultCurveSegments(10)}else!isNaN(r)&&r>1&&setDefaultCurveSegments(r)}function inBrowser(){return typeof navigator<"u"}function installPlugin(r,e){r==="expressions"&&setExpressionsPlugin(e)}function getFactory(r){switch(r){case"propertyFactory":return PropertyFactory;case"shapePropertyFactory":return ShapePropertyFactory;case"matrix":return Matrix;default:return null}}function checkReady(){document.readyState==="complete"&&(clearInterval(readyStateCheckInterval),searchAnimations())}function getQueryVariable(r){for(var e=queryString.split("&"),t=0;t<e.length;t+=1){var i=e[t].split("=");if(decodeURIComponent(i[0])==r)return decodeURIComponent(i[1])}return null}lottie.play=animationManager.play,lottie.pause=animationManager.pause,lottie.setLocationHref=setLocation,lottie.togglePause=animationManager.togglePause,lottie.setSpeed=animationManager.setSpeed,lottie.setDirection=animationManager.setDirection,lottie.stop=animationManager.stop,lottie.searchAnimations=searchAnimations,lottie.registerAnimation=animationManager.registerAnimation,lottie.loadAnimation=loadAnimation,lottie.setSubframeRendering=setSubframeRendering,lottie.resize=animationManager.resize,lottie.goToAndStop=animationManager.goToAndStop,lottie.destroy=animationManager.destroy,lottie.setQuality=setQuality,lottie.inBrowser=inBrowser,lottie.installPlugin=installPlugin,lottie.freeze=animationManager.freeze,lottie.unfreeze=animationManager.unfreeze,lottie.setVolume=animationManager.setVolume,lottie.mute=animationManager.mute,lottie.unmute=animationManager.unmute,lottie.getRegisteredAnimations=animationManager.getRegisteredAnimations,lottie.useWebWorker=setWebWorker,lottie.setIDPrefix=setPrefix,lottie.__getFactory=getFactory,lottie.version="5.12.2";var queryString="";{var scripts=document.getElementsByTagName("script"),index=scripts.length-1,myScript=scripts[index]||{src:""};queryString=myScript.src?myScript.src.replace(/^[^\?]+\??/,""):"",getQueryVariable("renderer")}var readyStateCheckInterval=setInterval(checkReady,100);try{_typeof$3(exports$1)!=="object"&&(window.bodymovin=lottie)}catch(r){}var ShapeModifiers=(function(){var r={},e={};return r.registerModifier=function(t,i){e[t]||(e[t]=i)},r.getModifier=function(t,i,s){return new e[t](i,s)},r})();function ShapeModifier(){}function TrimModifier(){}function PuckerAndBloatModifier(){}ShapeModifier.prototype.initModifierProperties=function(){},ShapeModifier.prototype.addShapeToModifier=function(){},ShapeModifier.prototype.addShape=function(r){if(!this.closed){r.sh.container.addDynamicProperty(r.sh);var e={shape:r.sh,data:r,localShapeCollection:shapeCollectionPool.newShapeCollection()};this.shapes.push(e),this.addShapeToModifier(e),this._isAnimated&&r.setAsAnimated()}},ShapeModifier.prototype.init=function(r,e){this.shapes=[],this.elem=r,this.initDynamicPropertyContainer(r),this.initModifierProperties(r,e),this.frameId=initialDefaultFrame,this.closed=!1,this.k=!1,this.dynamicProperties.length?this.k=!0:this.getValue(!0)},ShapeModifier.prototype.processKeys=function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties())},extendPrototype([DynamicPropertyContainer],ShapeModifier),extendPrototype([ShapeModifier],TrimModifier),TrimModifier.prototype.initModifierProperties=function(r,e){this.s=PropertyFactory.getProp(r,e.s,0,.01,this),this.e=PropertyFactory.getProp(r,e.e,0,.01,this),this.o=PropertyFactory.getProp(r,e.o,0,0,this),this.sValue=0,this.eValue=0,this.getValue=this.processKeys,this.m=e.m,this._isAnimated=!!this.s.effectsSequence.length||!!this.e.effectsSequence.length||!!this.o.effectsSequence.length},TrimModifier.prototype.addShapeToModifier=function(r){r.pathsData=[]},TrimModifier.prototype.calculateShapeEdges=function(r,e,t,i,s){var n=[];e<=1?n.push({s:r,e}):r>=1?n.push({s:r-1,e:e-1}):(n.push({s:r,e:1}),n.push({s:0,e:e-1}));var a,o,c=[],u=n.length;for(a=0;a<u;a+=1){var f,d;(o=n[a]).e*s<i||o.s*s>i+t||(f=o.s*s<=i?0:(o.s*s-i)/t,d=o.e*s>=i+t?1:(o.e*s-i)/t,c.push([f,d]))}return c.length||c.push([0,0]),c},TrimModifier.prototype.releasePathsData=function(r){var e,t=r.length;for(e=0;e<t;e+=1)segmentsLengthPool.release(r[e]);return r.length=0,r},TrimModifier.prototype.processShapes=function(r){var e,t,i,s;if(this._mdf||r){var n=this.o.v%360/360;if(n<0&&(n+=1),(e=this.s.v>1?1+n:this.s.v<0?0+n:this.s.v+n)>(t=this.e.v>1?1+n:this.e.v<0?0+n:this.e.v+n)){var a=e;e=t,t=a}e=1e-4*Math.round(1e4*e),t=1e-4*Math.round(1e4*t),this.sValue=e,this.eValue=t}else e=this.sValue,t=this.eValue;var o,c,u,f,d,g=this.shapes.length,E=0;if(t===e)for(s=0;s<g;s+=1)this.shapes[s].localShapeCollection.releaseShapes(),this.shapes[s].shape._mdf=!0,this.shapes[s].shape.paths=this.shapes[s].localShapeCollection,this._mdf&&(this.shapes[s].pathsData.length=0);else if(t===1&&e===0||t===0&&e===1){if(this._mdf)for(s=0;s<g;s+=1)this.shapes[s].pathsData.length=0,this.shapes[s].shape._mdf=!0}else{var m,T,S=[];for(s=0;s<g;s+=1)if((m=this.shapes[s]).shape._mdf||this._mdf||r||this.m===2){if(c=(i=m.shape.paths)._length,d=0,!m.shape._mdf&&m.pathsData.length)d=m.totalShapeLength;else{for(u=this.releasePathsData(m.pathsData),o=0;o<c;o+=1)f=bez.getSegmentsLength(i.shapes[o]),u.push(f),d+=f.totalLength;m.totalShapeLength=d,m.pathsData=u}E+=d,m.shape._mdf=!0}else m.shape.paths=m.localShapeCollection;var b,C=e,I=t,L=0;for(s=g-1;s>=0;s-=1)if((m=this.shapes[s]).shape._mdf){for((T=m.localShapeCollection).releaseShapes(),this.m===2&&g>1?(b=this.calculateShapeEdges(e,t,m.totalShapeLength,L,E),L+=m.totalShapeLength):b=[[C,I]],c=b.length,o=0;o<c;o+=1){C=b[o][0],I=b[o][1],S.length=0,I<=1?S.push({s:m.totalShapeLength*C,e:m.totalShapeLength*I}):C>=1?S.push({s:m.totalShapeLength*(C-1),e:m.totalShapeLength*(I-1)}):(S.push({s:m.totalShapeLength*C,e:m.totalShapeLength}),S.push({s:0,e:m.totalShapeLength*(I-1)}));var k=this.addShapes(m,S[0]);if(S[0].s!==S[0].e){if(S.length>1)if(m.shape.paths.shapes[m.shape.paths._length-1].c){var U=k.pop();this.addPaths(k,T),k=this.addShapes(m,S[1],U)}else this.addPaths(k,T),k=this.addShapes(m,S[1]);this.addPaths(k,T)}}m.shape.paths=T}}},TrimModifier.prototype.addPaths=function(r,e){var t,i=r.length;for(t=0;t<i;t+=1)e.addShape(r[t])},TrimModifier.prototype.addSegment=function(r,e,t,i,s,n,a){s.setXYAt(e[0],e[1],"o",n),s.setXYAt(t[0],t[1],"i",n+1),a&&s.setXYAt(r[0],r[1],"v",n),s.setXYAt(i[0],i[1],"v",n+1)},TrimModifier.prototype.addSegmentFromArray=function(r,e,t,i){e.setXYAt(r[1],r[5],"o",t),e.setXYAt(r[2],r[6],"i",t+1),i&&e.setXYAt(r[0],r[4],"v",t),e.setXYAt(r[3],r[7],"v",t+1)},TrimModifier.prototype.addShapes=function(r,e,t){var i,s,n,a,o,c,u,f,d=r.pathsData,g=r.shape.paths.shapes,E=r.shape.paths._length,m=0,T=[],S=!0;for(t?(o=t._length,f=t._length):(t=shapePool.newElement(),o=0,f=0),T.push(t),i=0;i<E;i+=1){for(c=d[i].lengths,t.c=g[i].c,n=g[i].c?c.length:c.length+1,s=1;s<n;s+=1)if(m+(a=c[s-1]).addedLength<e.s)m+=a.addedLength,t.c=!1;else{if(m>e.e){t.c=!1;break}e.s<=m&&e.e>=m+a.addedLength?(this.addSegment(g[i].v[s-1],g[i].o[s-1],g[i].i[s],g[i].v[s],t,o,S),S=!1):(u=bez.getNewSegment(g[i].v[s-1],g[i].v[s],g[i].o[s-1],g[i].i[s],(e.s-m)/a.addedLength,(e.e-m)/a.addedLength,c[s-1]),this.addSegmentFromArray(u,t,o,S),S=!1,t.c=!1),m+=a.addedLength,o+=1}if(g[i].c&&c.length){if(a=c[s-1],m<=e.e){var b=c[s-1].addedLength;e.s<=m&&e.e>=m+b?(this.addSegment(g[i].v[s-1],g[i].o[s-1],g[i].i[0],g[i].v[0],t,o,S),S=!1):(u=bez.getNewSegment(g[i].v[s-1],g[i].v[0],g[i].o[s-1],g[i].i[0],(e.s-m)/b,(e.e-m)/b,c[s-1]),this.addSegmentFromArray(u,t,o,S),S=!1,t.c=!1)}else t.c=!1;m+=a.addedLength,o+=1}if(t._length&&(t.setXYAt(t.v[f][0],t.v[f][1],"i",f),t.setXYAt(t.v[t._length-1][0],t.v[t._length-1][1],"o",t._length-1)),m>e.e)break;i<E-1&&(t=shapePool.newElement(),S=!0,T.push(t),o=0)}return T},extendPrototype([ShapeModifier],PuckerAndBloatModifier),PuckerAndBloatModifier.prototype.initModifierProperties=function(r,e){this.getValue=this.processKeys,this.amount=PropertyFactory.getProp(r,e.a,0,null,this),this._isAnimated=!!this.amount.effectsSequence.length},PuckerAndBloatModifier.prototype.processPath=function(r,e){var t=e/100,i=[0,0],s=r._length,n=0;for(n=0;n<s;n+=1)i[0]+=r.v[n][0],i[1]+=r.v[n][1];i[0]/=s,i[1]/=s;var a,o,c,u,f,d,g=shapePool.newElement();for(g.c=r.c,n=0;n<s;n+=1)a=r.v[n][0]+(i[0]-r.v[n][0])*t,o=r.v[n][1]+(i[1]-r.v[n][1])*t,c=r.o[n][0]+(i[0]-r.o[n][0])*-t,u=r.o[n][1]+(i[1]-r.o[n][1])*-t,f=r.i[n][0]+(i[0]-r.i[n][0])*-t,d=r.i[n][1]+(i[1]-r.i[n][1])*-t,g.setTripleAt(a,o,c,u,f,d,n);return g},PuckerAndBloatModifier.prototype.processShapes=function(r){var e,t,i,s,n,a,o=this.shapes.length,c=this.amount.v;if(c!==0)for(t=0;t<o;t+=1){if(a=(n=this.shapes[t]).localShapeCollection,n.shape._mdf||this._mdf||r)for(a.releaseShapes(),n.shape._mdf=!0,e=n.shape.paths.shapes,s=n.shape.paths._length,i=0;i<s;i+=1)a.addShape(this.processPath(e[i],c));n.shape.paths=n.localShapeCollection}this.dynamicProperties.length||(this._mdf=!1)};var TransformPropertyFactory=(function(){var r=[0,0];function e(t,i,s){if(this.elem=t,this.frameId=-1,this.propType="transform",this.data=i,this.v=new Matrix,this.pre=new Matrix,this.appliedTransformations=0,this.initDynamicPropertyContainer(s||t),i.p&&i.p.s?(this.px=PropertyFactory.getProp(t,i.p.x,0,0,this),this.py=PropertyFactory.getProp(t,i.p.y,0,0,this),i.p.z&&(this.pz=PropertyFactory.getProp(t,i.p.z,0,0,this))):this.p=PropertyFactory.getProp(t,i.p||{k:[0,0,0]},1,0,this),i.rx){if(this.rx=PropertyFactory.getProp(t,i.rx,0,degToRads,this),this.ry=PropertyFactory.getProp(t,i.ry,0,degToRads,this),this.rz=PropertyFactory.getProp(t,i.rz,0,degToRads,this),i.or.k[0].ti){var n,a=i.or.k.length;for(n=0;n<a;n+=1)i.or.k[n].to=null,i.or.k[n].ti=null}this.or=PropertyFactory.getProp(t,i.or,1,degToRads,this),this.or.sh=!0}else this.r=PropertyFactory.getProp(t,i.r||{k:0},0,degToRads,this);i.sk&&(this.sk=PropertyFactory.getProp(t,i.sk,0,degToRads,this),this.sa=PropertyFactory.getProp(t,i.sa,0,degToRads,this)),this.a=PropertyFactory.getProp(t,i.a||{k:[0,0,0]},1,0,this),this.s=PropertyFactory.getProp(t,i.s||{k:[100,100,100]},1,.01,this),i.o?this.o=PropertyFactory.getProp(t,i.o,0,.01,t):this.o={_mdf:!1,v:1},this._isDirty=!0,this.dynamicProperties.length||this.getValue(!0)}return e.prototype={applyToMatrix:function(t){var i=this._mdf;this.iterateDynamicProperties(),this._mdf=this._mdf||i,this.a&&t.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.s&&t.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.sk&&t.skewFromAxis(-this.sk.v,this.sa.v),this.r?t.rotate(-this.r.v):t.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.data.p.s?this.data.p.z?t.translate(this.px.v,this.py.v,-this.pz.v):t.translate(this.px.v,this.py.v,0):t.translate(this.p.v[0],this.p.v[1],-this.p.v[2])},getValue:function(t){if(this.elem.globalData.frameId!==this.frameId){if(this._isDirty&&(this.precalculateMatrix(),this._isDirty=!1),this.iterateDynamicProperties(),this._mdf||t){var i;if(this.v.cloneFromProps(this.pre.props),this.appliedTransformations<1&&this.v.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.appliedTransformations<2&&this.v.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.sk&&this.appliedTransformations<3&&this.v.skewFromAxis(-this.sk.v,this.sa.v),this.r&&this.appliedTransformations<4?this.v.rotate(-this.r.v):!this.r&&this.appliedTransformations<4&&this.v.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.autoOriented){var s,n;if(i=this.elem.globalData.frameRate,this.p&&this.p.keyframes&&this.p.getValueAtTime)this.p._caching.lastFrame+this.p.offsetTime<=this.p.keyframes[0].t?(s=this.p.getValueAtTime((this.p.keyframes[0].t+.01)/i,0),n=this.p.getValueAtTime(this.p.keyframes[0].t/i,0)):this.p._caching.lastFrame+this.p.offsetTime>=this.p.keyframes[this.p.keyframes.length-1].t?(s=this.p.getValueAtTime(this.p.keyframes[this.p.keyframes.length-1].t/i,0),n=this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length-1].t-.05)/i,0)):(s=this.p.pv,n=this.p.getValueAtTime((this.p._caching.lastFrame+this.p.offsetTime-.01)/i,this.p.offsetTime));else if(this.px&&this.px.keyframes&&this.py.keyframes&&this.px.getValueAtTime&&this.py.getValueAtTime){s=[],n=[];var a=this.px,o=this.py;a._caching.lastFrame+a.offsetTime<=a.keyframes[0].t?(s[0]=a.getValueAtTime((a.keyframes[0].t+.01)/i,0),s[1]=o.getValueAtTime((o.keyframes[0].t+.01)/i,0),n[0]=a.getValueAtTime(a.keyframes[0].t/i,0),n[1]=o.getValueAtTime(o.keyframes[0].t/i,0)):a._caching.lastFrame+a.offsetTime>=a.keyframes[a.keyframes.length-1].t?(s[0]=a.getValueAtTime(a.keyframes[a.keyframes.length-1].t/i,0),s[1]=o.getValueAtTime(o.keyframes[o.keyframes.length-1].t/i,0),n[0]=a.getValueAtTime((a.keyframes[a.keyframes.length-1].t-.01)/i,0),n[1]=o.getValueAtTime((o.keyframes[o.keyframes.length-1].t-.01)/i,0)):(s=[a.pv,o.pv],n[0]=a.getValueAtTime((a._caching.lastFrame+a.offsetTime-.01)/i,a.offsetTime),n[1]=o.getValueAtTime((o._caching.lastFrame+o.offsetTime-.01)/i,o.offsetTime))}else s=n=r;this.v.rotate(-Math.atan2(s[1]-n[1],s[0]-n[0]))}this.data.p&&this.data.p.s?this.data.p.z?this.v.translate(this.px.v,this.py.v,-this.pz.v):this.v.translate(this.px.v,this.py.v,0):this.v.translate(this.p.v[0],this.p.v[1],-this.p.v[2])}this.frameId=this.elem.globalData.frameId}},precalculateMatrix:function(){if(this.appliedTransformations=0,this.pre.reset(),!this.a.effectsSequence.length&&(this.pre.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.appliedTransformations=1,!this.s.effectsSequence.length)){if(this.pre.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.appliedTransformations=2,this.sk){if(this.sk.effectsSequence.length||this.sa.effectsSequence.length)return;this.pre.skewFromAxis(-this.sk.v,this.sa.v),this.appliedTransformations=3}this.r?this.r.effectsSequence.length||(this.pre.rotate(-this.r.v),this.appliedTransformations=4):this.rz.effectsSequence.length||this.ry.effectsSequence.length||this.rx.effectsSequence.length||this.or.effectsSequence.length||(this.pre.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.appliedTransformations=4)}},autoOrient:function(){}},extendPrototype([DynamicPropertyContainer],e),e.prototype.addDynamicProperty=function(t){this._addDynamicProperty(t),this.elem.addDynamicProperty(t),this._isDirty=!0},e.prototype._addDynamicProperty=DynamicPropertyContainer.prototype.addDynamicProperty,{getTransformProperty:function(t,i,s){return new e(t,i,s)}}})();function RepeaterModifier(){}function RoundCornersModifier(){}function floatEqual(r,e){return 1e5*Math.abs(r-e)<=Math.min(Math.abs(r),Math.abs(e))}function floatZero(r){return Math.abs(r)<=1e-5}function lerp(r,e,t){return r*(1-t)+e*t}function lerpPoint(r,e,t){return[lerp(r[0],e[0],t),lerp(r[1],e[1],t)]}function quadRoots(r,e,t){if(r===0)return[];var i=e*e-4*r*t;if(i<0)return[];var s=-e/(2*r);if(i===0)return[s];var n=Math.sqrt(i)/(2*r);return[s-n,s+n]}function polynomialCoefficients(r,e,t,i){return[3*e-r-3*t+i,3*r-6*e+3*t,-3*r+3*e,r]}function singlePoint(r){return new PolynomialBezier(r,r,r,r,!1)}function PolynomialBezier(r,e,t,i,s){s&&pointEqual(r,e)&&(e=lerpPoint(r,i,1/3)),s&&pointEqual(t,i)&&(t=lerpPoint(r,i,2/3));var n=polynomialCoefficients(r[0],e[0],t[0],i[0]),a=polynomialCoefficients(r[1],e[1],t[1],i[1]);this.a=[n[0],a[0]],this.b=[n[1],a[1]],this.c=[n[2],a[2]],this.d=[n[3],a[3]],this.points=[r,e,t,i]}function extrema(r,e){var t=r.points[0][e],i=r.points[r.points.length-1][e];if(t>i){var s=i;i=t,t=s}for(var n=quadRoots(3*r.a[e],2*r.b[e],r.c[e]),a=0;a<n.length;a+=1)if(n[a]>0&&n[a]<1){var o=r.point(n[a])[e];o<t?t=o:o>i&&(i=o)}return{min:t,max:i}}function intersectData(r,e,t){var i=r.boundingBox();return{cx:i.cx,cy:i.cy,width:i.width,height:i.height,bez:r,t:(e+t)/2,t1:e,t2:t}}function splitData(r){var e=r.bez.split(.5);return[intersectData(e[0],r.t1,r.t),intersectData(e[1],r.t,r.t2)]}function boxIntersect(r,e){return 2*Math.abs(r.cx-e.cx)<r.width+e.width&&2*Math.abs(r.cy-e.cy)<r.height+e.height}function intersectsImpl(r,e,t,i,s,n){if(boxIntersect(r,e))if(t>=n||r.width<=i&&r.height<=i&&e.width<=i&&e.height<=i)s.push([r.t,e.t]);else{var a=splitData(r),o=splitData(e);intersectsImpl(a[0],o[0],t+1,i,s,n),intersectsImpl(a[0],o[1],t+1,i,s,n),intersectsImpl(a[1],o[0],t+1,i,s,n),intersectsImpl(a[1],o[1],t+1,i,s,n)}}function crossProduct(r,e){return[r[1]*e[2]-r[2]*e[1],r[2]*e[0]-r[0]*e[2],r[0]*e[1]-r[1]*e[0]]}function lineIntersection(r,e,t,i){var s=[r[0],r[1],1],n=[e[0],e[1],1],a=[t[0],t[1],1],o=[i[0],i[1],1],c=crossProduct(crossProduct(s,n),crossProduct(a,o));return floatZero(c[2])?null:[c[0]/c[2],c[1]/c[2]]}function polarOffset(r,e,t){return[r[0]+Math.cos(e)*t,r[1]-Math.sin(e)*t]}function pointDistance(r,e){return Math.hypot(r[0]-e[0],r[1]-e[1])}function pointEqual(r,e){return floatEqual(r[0],e[0])&&floatEqual(r[1],e[1])}function ZigZagModifier(){}function setPoint(r,e,t,i,s,n,a){var o=t-Math.PI/2,c=t+Math.PI/2,u=e[0]+Math.cos(t)*i*s,f=e[1]-Math.sin(t)*i*s;r.setTripleAt(u,f,u+Math.cos(o)*n,f-Math.sin(o)*n,u+Math.cos(c)*a,f-Math.sin(c)*a,r.length())}function getPerpendicularVector(r,e){var t=[e[0]-r[0],e[1]-r[1]],i=.5*-Math.PI;return[Math.cos(i)*t[0]-Math.sin(i)*t[1],Math.sin(i)*t[0]+Math.cos(i)*t[1]]}function getProjectingAngle(r,e){var t=e===0?r.length()-1:e-1,i=(e+1)%r.length(),s=getPerpendicularVector(r.v[t],r.v[i]);return Math.atan2(0,1)-Math.atan2(s[1],s[0])}function zigZagCorner(r,e,t,i,s,n,a){var o=getProjectingAngle(e,t),c=e.v[t%e._length],u=e.v[t===0?e._length-1:t-1],f=e.v[(t+1)%e._length],d=n===2?Math.sqrt(Math.pow(c[0]-u[0],2)+Math.pow(c[1]-u[1],2)):0,g=n===2?Math.sqrt(Math.pow(c[0]-f[0],2)+Math.pow(c[1]-f[1],2)):0;setPoint(r,e.v[t%e._length],o,a,i,g/(2*(s+1)),d/(2*(s+1)))}function zigZagSegment(r,e,t,i,s,n){for(var a=0;a<i;a+=1){var o=(a+1)/(i+1),c=s===2?Math.sqrt(Math.pow(e.points[3][0]-e.points[0][0],2)+Math.pow(e.points[3][1]-e.points[0][1],2)):0,u=e.normalAngle(o);setPoint(r,e.point(o),u,n,t,c/(2*(i+1)),c/(2*(i+1))),n=-n}return n}function linearOffset(r,e,t){var i=Math.atan2(e[0]-r[0],e[1]-r[1]);return[polarOffset(r,i,t),polarOffset(e,i,t)]}function offsetSegment(r,e){var t,i,s,n,a,o,c;t=(c=linearOffset(r.points[0],r.points[1],e))[0],i=c[1],s=(c=linearOffset(r.points[1],r.points[2],e))[0],n=c[1],a=(c=linearOffset(r.points[2],r.points[3],e))[0],o=c[1];var u=lineIntersection(t,i,s,n);u===null&&(u=i);var f=lineIntersection(a,o,s,n);return f===null&&(f=a),new PolynomialBezier(t,u,f,o)}function joinLines(r,e,t,i,s){var n=e.points[3],a=t.points[0];if(i===3||pointEqual(n,a))return n;if(i===2){var o=-e.tangentAngle(1),c=-t.tangentAngle(0)+Math.PI,u=lineIntersection(n,polarOffset(n,o+Math.PI/2,100),a,polarOffset(a,o+Math.PI/2,100)),f=u?pointDistance(u,n):pointDistance(n,a)/2,d=polarOffset(n,o,2*f*roundCorner);return r.setXYAt(d[0],d[1],"o",r.length()-1),d=polarOffset(a,c,2*f*roundCorner),r.setTripleAt(a[0],a[1],a[0],a[1],d[0],d[1],r.length()),a}var g=lineIntersection(pointEqual(n,e.points[2])?e.points[0]:e.points[2],n,a,pointEqual(a,t.points[1])?t.points[3]:t.points[1]);return g&&pointDistance(g,n)<s?(r.setTripleAt(g[0],g[1],g[0],g[1],g[0],g[1],r.length()),g):n}function getIntersection(r,e){var t=r.intersections(e);return t.length&&floatEqual(t[0][0],1)&&t.shift(),t.length?t[0]:null}function pruneSegmentIntersection(r,e){var t=r.slice(),i=e.slice(),s=getIntersection(r[r.length-1],e[0]);return s&&(t[r.length-1]=r[r.length-1].split(s[0])[0],i[0]=e[0].split(s[1])[1]),r.length>1&&e.length>1&&(s=getIntersection(r[0],e[e.length-1]))?[[r[0].split(s[0])[0]],[e[e.length-1].split(s[1])[1]]]:[t,i]}function pruneIntersections(r){for(var e,t=1;t<r.length;t+=1)e=pruneSegmentIntersection(r[t-1],r[t]),r[t-1]=e[0],r[t]=e[1];return r.length>1&&(e=pruneSegmentIntersection(r[r.length-1],r[0]),r[r.length-1]=e[0],r[0]=e[1]),r}function offsetSegmentSplit(r,e){var t,i,s,n,a=r.inflectionPoints();if(a.length===0)return[offsetSegment(r,e)];if(a.length===1||floatEqual(a[1],1))return t=(s=r.split(a[0]))[0],i=s[1],[offsetSegment(t,e),offsetSegment(i,e)];t=(s=r.split(a[0]))[0];var o=(a[1]-a[0])/(1-a[0]);return n=(s=s[1].split(o))[0],i=s[1],[offsetSegment(t,e),offsetSegment(n,e),offsetSegment(i,e)]}function OffsetPathModifier(){}function getFontProperties(r){for(var e=r.fStyle?r.fStyle.split(" "):[],t="normal",i="normal",s=e.length,n=0;n<s;n+=1)switch(e[n].toLowerCase()){case"italic":i="italic";break;case"bold":t="700";break;case"black":t="900";break;case"medium":t="500";break;case"regular":case"normal":t="400";break;case"light":case"thin":t="200"}return{style:i,weight:r.fWeight||t}}extendPrototype([ShapeModifier],RepeaterModifier),RepeaterModifier.prototype.initModifierProperties=function(r,e){this.getValue=this.processKeys,this.c=PropertyFactory.getProp(r,e.c,0,null,this),this.o=PropertyFactory.getProp(r,e.o,0,null,this),this.tr=TransformPropertyFactory.getTransformProperty(r,e.tr,this),this.so=PropertyFactory.getProp(r,e.tr.so,0,.01,this),this.eo=PropertyFactory.getProp(r,e.tr.eo,0,.01,this),this.data=e,this.dynamicProperties.length||this.getValue(!0),this._isAnimated=!!this.dynamicProperties.length,this.pMatrix=new Matrix,this.rMatrix=new Matrix,this.sMatrix=new Matrix,this.tMatrix=new Matrix,this.matrix=new Matrix},RepeaterModifier.prototype.applyTransforms=function(r,e,t,i,s,n){var a=n?-1:1,o=i.s.v[0]+(1-i.s.v[0])*(1-s),c=i.s.v[1]+(1-i.s.v[1])*(1-s);r.translate(i.p.v[0]*a*s,i.p.v[1]*a*s,i.p.v[2]),e.translate(-i.a.v[0],-i.a.v[1],i.a.v[2]),e.rotate(-i.r.v*a*s),e.translate(i.a.v[0],i.a.v[1],i.a.v[2]),t.translate(-i.a.v[0],-i.a.v[1],i.a.v[2]),t.scale(n?1/o:o,n?1/c:c),t.translate(i.a.v[0],i.a.v[1],i.a.v[2])},RepeaterModifier.prototype.init=function(r,e,t,i){for(this.elem=r,this.arr=e,this.pos=t,this.elemsData=i,this._currentCopies=0,this._elements=[],this._groups=[],this.frameId=-1,this.initDynamicPropertyContainer(r),this.initModifierProperties(r,e[t]);t>0;)t-=1,this._elements.unshift(e[t]);this.dynamicProperties.length?this.k=!0:this.getValue(!0)},RepeaterModifier.prototype.resetElements=function(r){var e,t=r.length;for(e=0;e<t;e+=1)r[e]._processed=!1,r[e].ty==="gr"&&this.resetElements(r[e].it)},RepeaterModifier.prototype.cloneElements=function(r){var e=JSON.parse(JSON.stringify(r));return this.resetElements(e),e},RepeaterModifier.prototype.changeGroupRender=function(r,e){var t,i=r.length;for(t=0;t<i;t+=1)r[t]._render=e,r[t].ty==="gr"&&this.changeGroupRender(r[t].it,e)},RepeaterModifier.prototype.processShapes=function(r){var e,t,i,s,n,a=!1;if(this._mdf||r){var o,c=Math.ceil(this.c.v);if(this._groups.length<c){for(;this._groups.length<c;){var u={it:this.cloneElements(this._elements),ty:"gr"};u.it.push({a:{a:0,ix:1,k:[0,0]},nm:"Transform",o:{a:0,ix:7,k:100},p:{a:0,ix:2,k:[0,0]},r:{a:1,ix:6,k:[{s:0,e:0,t:0},{s:0,e:0,t:1}]},s:{a:0,ix:3,k:[100,100]},sa:{a:0,ix:5,k:0},sk:{a:0,ix:4,k:0},ty:"tr"}),this.arr.splice(0,0,u),this._groups.splice(0,0,u),this._currentCopies+=1}this.elem.reloadShapes(),a=!0}for(n=0,i=0;i<=this._groups.length-1;i+=1){if(o=n<c,this._groups[i]._render=o,this.changeGroupRender(this._groups[i].it,o),!o){var f=this.elemsData[i].it,d=f[f.length-1];d.transform.op.v!==0?(d.transform.op._mdf=!0,d.transform.op.v=0):d.transform.op._mdf=!1}n+=1}this._currentCopies=c;var g=this.o.v,E=g%1,m=g>0?Math.floor(g):Math.ceil(g),T=this.pMatrix.props,S=this.rMatrix.props,b=this.sMatrix.props;this.pMatrix.reset(),this.rMatrix.reset(),this.sMatrix.reset(),this.tMatrix.reset(),this.matrix.reset();var C,I,L=0;if(g>0){for(;L<m;)this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!1),L+=1;E&&(this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,E,!1),L+=E)}else if(g<0){for(;L>m;)this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!0),L-=1;E&&(this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,-E,!0),L-=E)}for(i=this.data.m===1?0:this._currentCopies-1,s=this.data.m===1?1:-1,n=this._currentCopies;n;){if(I=(t=(e=this.elemsData[i].it)[e.length-1].transform.mProps.v.props).length,e[e.length-1].transform.mProps._mdf=!0,e[e.length-1].transform.op._mdf=!0,e[e.length-1].transform.op.v=this._currentCopies===1?this.so.v:this.so.v+(this.eo.v-this.so.v)*(i/(this._currentCopies-1)),L!==0){for((i!==0&&s===1||i!==this._currentCopies-1&&s===-1)&&this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!1),this.matrix.transform(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[8],S[9],S[10],S[11],S[12],S[13],S[14],S[15]),this.matrix.transform(b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8],b[9],b[10],b[11],b[12],b[13],b[14],b[15]),this.matrix.transform(T[0],T[1],T[2],T[3],T[4],T[5],T[6],T[7],T[8],T[9],T[10],T[11],T[12],T[13],T[14],T[15]),C=0;C<I;C+=1)t[C]=this.matrix.props[C];this.matrix.reset()}else for(this.matrix.reset(),C=0;C<I;C+=1)t[C]=this.matrix.props[C];L+=1,n-=1,i+=s}}else for(n=this._currentCopies,i=0,s=1;n;)t=(e=this.elemsData[i].it)[e.length-1].transform.mProps.v.props,e[e.length-1].transform.mProps._mdf=!1,e[e.length-1].transform.op._mdf=!1,n-=1,i+=s;return a},RepeaterModifier.prototype.addShape=function(){},extendPrototype([ShapeModifier],RoundCornersModifier),RoundCornersModifier.prototype.initModifierProperties=function(r,e){this.getValue=this.processKeys,this.rd=PropertyFactory.getProp(r,e.r,0,null,this),this._isAnimated=!!this.rd.effectsSequence.length},RoundCornersModifier.prototype.processPath=function(r,e){var t,i=shapePool.newElement();i.c=r.c;var s,n,a,o,c,u,f,d,g,E,m,T,S=r._length,b=0;for(t=0;t<S;t+=1)s=r.v[t],a=r.o[t],n=r.i[t],s[0]===a[0]&&s[1]===a[1]&&s[0]===n[0]&&s[1]===n[1]?t!==0&&t!==S-1||r.c?(o=t===0?r.v[S-1]:r.v[t-1],u=(c=Math.sqrt(Math.pow(s[0]-o[0],2)+Math.pow(s[1]-o[1],2)))?Math.min(c/2,e)/c:0,f=m=s[0]+(o[0]-s[0])*u,d=T=s[1]-(s[1]-o[1])*u,g=f-(f-s[0])*roundCorner,E=d-(d-s[1])*roundCorner,i.setTripleAt(f,d,g,E,m,T,b),b+=1,o=t===S-1?r.v[0]:r.v[t+1],u=(c=Math.sqrt(Math.pow(s[0]-o[0],2)+Math.pow(s[1]-o[1],2)))?Math.min(c/2,e)/c:0,f=g=s[0]+(o[0]-s[0])*u,d=E=s[1]+(o[1]-s[1])*u,m=f-(f-s[0])*roundCorner,T=d-(d-s[1])*roundCorner,i.setTripleAt(f,d,g,E,m,T,b),b+=1):(i.setTripleAt(s[0],s[1],a[0],a[1],n[0],n[1],b),b+=1):(i.setTripleAt(r.v[t][0],r.v[t][1],r.o[t][0],r.o[t][1],r.i[t][0],r.i[t][1],b),b+=1);return i},RoundCornersModifier.prototype.processShapes=function(r){var e,t,i,s,n,a,o=this.shapes.length,c=this.rd.v;if(c!==0)for(t=0;t<o;t+=1){if(a=(n=this.shapes[t]).localShapeCollection,n.shape._mdf||this._mdf||r)for(a.releaseShapes(),n.shape._mdf=!0,e=n.shape.paths.shapes,s=n.shape.paths._length,i=0;i<s;i+=1)a.addShape(this.processPath(e[i],c));n.shape.paths=n.localShapeCollection}this.dynamicProperties.length||(this._mdf=!1)},PolynomialBezier.prototype.point=function(r){return[((this.a[0]*r+this.b[0])*r+this.c[0])*r+this.d[0],((this.a[1]*r+this.b[1])*r+this.c[1])*r+this.d[1]]},PolynomialBezier.prototype.derivative=function(r){return[(3*r*this.a[0]+2*this.b[0])*r+this.c[0],(3*r*this.a[1]+2*this.b[1])*r+this.c[1]]},PolynomialBezier.prototype.tangentAngle=function(r){var e=this.derivative(r);return Math.atan2(e[1],e[0])},PolynomialBezier.prototype.normalAngle=function(r){var e=this.derivative(r);return Math.atan2(e[0],e[1])},PolynomialBezier.prototype.inflectionPoints=function(){var r=this.a[1]*this.b[0]-this.a[0]*this.b[1];if(floatZero(r))return[];var e=-.5*(this.a[1]*this.c[0]-this.a[0]*this.c[1])/r,t=e*e-1/3*(this.b[1]*this.c[0]-this.b[0]*this.c[1])/r;if(t<0)return[];var i=Math.sqrt(t);return floatZero(i)?i>0&&i<1?[e]:[]:[e-i,e+i].filter((function(s){return s>0&&s<1}))},PolynomialBezier.prototype.split=function(r){if(r<=0)return[singlePoint(this.points[0]),this];if(r>=1)return[this,singlePoint(this.points[this.points.length-1])];var e=lerpPoint(this.points[0],this.points[1],r),t=lerpPoint(this.points[1],this.points[2],r),i=lerpPoint(this.points[2],this.points[3],r),s=lerpPoint(e,t,r),n=lerpPoint(t,i,r),a=lerpPoint(s,n,r);return[new PolynomialBezier(this.points[0],e,s,a,!0),new PolynomialBezier(a,n,i,this.points[3],!0)]},PolynomialBezier.prototype.bounds=function(){return{x:extrema(this,0),y:extrema(this,1)}},PolynomialBezier.prototype.boundingBox=function(){var r=this.bounds();return{left:r.x.min,right:r.x.max,top:r.y.min,bottom:r.y.max,width:r.x.max-r.x.min,height:r.y.max-r.y.min,cx:(r.x.max+r.x.min)/2,cy:(r.y.max+r.y.min)/2}},PolynomialBezier.prototype.intersections=function(r,e,t){e===void 0&&(e=2),t===void 0&&(t=7);var i=[];return intersectsImpl(intersectData(this,0,1),intersectData(r,0,1),0,e,i,t),i},PolynomialBezier.shapeSegment=function(r,e){var t=(e+1)%r.length();return new PolynomialBezier(r.v[e],r.o[e],r.i[t],r.v[t],!0)},PolynomialBezier.shapeSegmentInverted=function(r,e){var t=(e+1)%r.length();return new PolynomialBezier(r.v[t],r.i[t],r.o[e],r.v[e],!0)},extendPrototype([ShapeModifier],ZigZagModifier),ZigZagModifier.prototype.initModifierProperties=function(r,e){this.getValue=this.processKeys,this.amplitude=PropertyFactory.getProp(r,e.s,0,null,this),this.frequency=PropertyFactory.getProp(r,e.r,0,null,this),this.pointsType=PropertyFactory.getProp(r,e.pt,0,null,this),this._isAnimated=this.amplitude.effectsSequence.length!==0||this.frequency.effectsSequence.length!==0||this.pointsType.effectsSequence.length!==0},ZigZagModifier.prototype.processPath=function(r,e,t,i){var s=r._length,n=shapePool.newElement();if(n.c=r.c,r.c||(s-=1),s===0)return n;var a=-1,o=PolynomialBezier.shapeSegment(r,0);zigZagCorner(n,r,0,e,t,i,a);for(var c=0;c<s;c+=1)a=zigZagSegment(n,o,e,t,i,-a),o=c!==s-1||r.c?PolynomialBezier.shapeSegment(r,(c+1)%s):null,zigZagCorner(n,r,c+1,e,t,i,a);return n},ZigZagModifier.prototype.processShapes=function(r){var e,t,i,s,n,a,o=this.shapes.length,c=this.amplitude.v,u=Math.max(0,Math.round(this.frequency.v)),f=this.pointsType.v;if(c!==0)for(t=0;t<o;t+=1){if(a=(n=this.shapes[t]).localShapeCollection,n.shape._mdf||this._mdf||r)for(a.releaseShapes(),n.shape._mdf=!0,e=n.shape.paths.shapes,s=n.shape.paths._length,i=0;i<s;i+=1)a.addShape(this.processPath(e[i],c,u,f));n.shape.paths=n.localShapeCollection}this.dynamicProperties.length||(this._mdf=!1)},extendPrototype([ShapeModifier],OffsetPathModifier),OffsetPathModifier.prototype.initModifierProperties=function(r,e){this.getValue=this.processKeys,this.amount=PropertyFactory.getProp(r,e.a,0,null,this),this.miterLimit=PropertyFactory.getProp(r,e.ml,0,null,this),this.lineJoin=e.lj,this._isAnimated=this.amount.effectsSequence.length!==0},OffsetPathModifier.prototype.processPath=function(r,e,t,i){var s=shapePool.newElement();s.c=r.c;var n,a,o,c=r.length();r.c||(c-=1);var u=[];for(n=0;n<c;n+=1)o=PolynomialBezier.shapeSegment(r,n),u.push(offsetSegmentSplit(o,e));if(!r.c)for(n=c-1;n>=0;n-=1)o=PolynomialBezier.shapeSegmentInverted(r,n),u.push(offsetSegmentSplit(o,e));u=pruneIntersections(u);var f=null,d=null;for(n=0;n<u.length;n+=1){var g=u[n];for(d&&(f=joinLines(s,d,g[0],t,i)),d=g[g.length-1],a=0;a<g.length;a+=1)o=g[a],f&&pointEqual(o.points[0],f)?s.setXYAt(o.points[1][0],o.points[1][1],"o",s.length()-1):s.setTripleAt(o.points[0][0],o.points[0][1],o.points[1][0],o.points[1][1],o.points[0][0],o.points[0][1],s.length()),s.setTripleAt(o.points[3][0],o.points[3][1],o.points[3][0],o.points[3][1],o.points[2][0],o.points[2][1],s.length()),f=o.points[3]}return u.length&&joinLines(s,d,u[0][0],t,i),s},OffsetPathModifier.prototype.processShapes=function(r){var e,t,i,s,n,a,o=this.shapes.length,c=this.amount.v,u=this.miterLimit.v,f=this.lineJoin;if(c!==0)for(t=0;t<o;t+=1){if(a=(n=this.shapes[t]).localShapeCollection,n.shape._mdf||this._mdf||r)for(a.releaseShapes(),n.shape._mdf=!0,e=n.shape.paths.shapes,s=n.shape.paths._length,i=0;i<s;i+=1)a.addShape(this.processPath(e[i],c,f,u));n.shape.paths=n.localShapeCollection}this.dynamicProperties.length||(this._mdf=!1)};var FontManager=(function(){var r={w:0,size:0,shapes:[],data:{shapes:[]}},e=[];e=e.concat([2304,2305,2306,2307,2362,2363,2364,2364,2366,2367,2368,2369,2370,2371,2372,2373,2374,2375,2376,2377,2378,2379,2380,2381,2382,2383,2387,2388,2389,2390,2391,2402,2403]);var t=["d83cdffb","d83cdffc","d83cdffd","d83cdffe","d83cdfff"];function i(c,u){var f=createTag("span");f.setAttribute("aria-hidden",!0),f.style.fontFamily=u;var d=createTag("span");d.innerText="giItT1WQy@!-/#",f.style.position="absolute",f.style.left="-10000px",f.style.top="-10000px",f.style.fontSize="300px",f.style.fontVariant="normal",f.style.fontStyle="normal",f.style.fontWeight="normal",f.style.letterSpacing="0",f.appendChild(d),document.body.appendChild(f);var g=d.offsetWidth;return d.style.fontFamily=(function(E){var m,T=E.split(","),S=T.length,b=[];for(m=0;m<S;m+=1)T[m]!=="sans-serif"&&T[m]!=="monospace"&&b.push(T[m]);return b.join(",")})(c)+", "+u,{node:d,w:g,parent:f}}function s(c,u){var f,d=document.body&&u?"svg":"canvas",g=getFontProperties(c);if(d==="svg"){var E=createNS("text");E.style.fontSize="100px",E.setAttribute("font-family",c.fFamily),E.setAttribute("font-style",g.style),E.setAttribute("font-weight",g.weight),E.textContent="1",c.fClass?(E.style.fontFamily="inherit",E.setAttribute("class",c.fClass)):E.style.fontFamily=c.fFamily,u.appendChild(E),f=E}else{var m=new OffscreenCanvas(500,500).getContext("2d");m.font=g.style+" "+g.weight+" 100px "+c.fFamily,f=m}return{measureText:function(T){return d==="svg"?(f.textContent=T,f.getComputedTextLength()):f.measureText(T).width}}}function n(c){var u=0,f=c.charCodeAt(0);if(f>=55296&&f<=56319){var d=c.charCodeAt(1);d>=56320&&d<=57343&&(u=1024*(f-55296)+d-56320+65536)}return u}function a(c){var u=n(c);return u>=127462&&u<=127487}var o=function(){this.fonts=[],this.chars=null,this.typekitLoaded=0,this.isLoaded=!1,this._warned=!1,this.initTime=Date.now(),this.setIsLoadedBinded=this.setIsLoaded.bind(this),this.checkLoadedFontsBinded=this.checkLoadedFonts.bind(this)};return o.isModifier=function(c,u){var f=c.toString(16)+u.toString(16);return t.indexOf(f)!==-1},o.isZeroWidthJoiner=function(c){return c===8205},o.isFlagEmoji=function(c){return a(c.substr(0,2))&&a(c.substr(2,2))},o.isRegionalCode=a,o.isCombinedCharacter=function(c){return e.indexOf(c)!==-1},o.isRegionalFlag=function(c,u){var f=n(c.substr(u,2));if(f!==127988)return!1;var d=0;for(u+=2;d<5;){if((f=n(c.substr(u,2)))<917601||f>917626)return!1;d+=1,u+=2}return n(c.substr(u,2))===917631},o.isVariationSelector=function(c){return c===65039},o.BLACK_FLAG_CODE_POINT=127988,o.prototype={addChars:function(c){if(c){var u;this.chars||(this.chars=[]);var f,d,g=c.length,E=this.chars.length;for(u=0;u<g;u+=1){for(f=0,d=!1;f<E;)this.chars[f].style===c[u].style&&this.chars[f].fFamily===c[u].fFamily&&this.chars[f].ch===c[u].ch&&(d=!0),f+=1;d||(this.chars.push(c[u]),E+=1)}}},addFonts:function(c,u){if(c){if(this.chars)return this.isLoaded=!0,void(this.fonts=c.list);if(!document.body)return this.isLoaded=!0,c.list.forEach((function(L){L.helper=s(L),L.cache={}})),void(this.fonts=c.list);var f,d=c.list,g=d.length,E=g;for(f=0;f<g;f+=1){var m,T,S=!0;if(d[f].loaded=!1,d[f].monoCase=i(d[f].fFamily,"monospace"),d[f].sansCase=i(d[f].fFamily,"sans-serif"),d[f].fPath){if(d[f].fOrigin==="p"||d[f].origin===3){if((m=document.querySelectorAll('style[f-forigin="p"][f-family="'+d[f].fFamily+'"], style[f-origin="3"][f-family="'+d[f].fFamily+'"]')).length>0&&(S=!1),S){var b=createTag("style");b.setAttribute("f-forigin",d[f].fOrigin),b.setAttribute("f-origin",d[f].origin),b.setAttribute("f-family",d[f].fFamily),b.type="text/css",b.innerText="@font-face {font-family: "+d[f].fFamily+"; font-style: normal; src: url('"+d[f].fPath+"');}",u.appendChild(b)}}else if(d[f].fOrigin==="g"||d[f].origin===1){for(m=document.querySelectorAll('link[f-forigin="g"], link[f-origin="1"]'),T=0;T<m.length;T+=1)m[T].href.indexOf(d[f].fPath)!==-1&&(S=!1);if(S){var C=createTag("link");C.setAttribute("f-forigin",d[f].fOrigin),C.setAttribute("f-origin",d[f].origin),C.type="text/css",C.rel="stylesheet",C.href=d[f].fPath,document.body.appendChild(C)}}else if(d[f].fOrigin==="t"||d[f].origin===2){for(m=document.querySelectorAll('script[f-forigin="t"], script[f-origin="2"]'),T=0;T<m.length;T+=1)d[f].fPath===m[T].src&&(S=!1);if(S){var I=createTag("link");I.setAttribute("f-forigin",d[f].fOrigin),I.setAttribute("f-origin",d[f].origin),I.setAttribute("rel","stylesheet"),I.setAttribute("href",d[f].fPath),u.appendChild(I)}}}else d[f].loaded=!0,E-=1;d[f].helper=s(d[f],u),d[f].cache={},this.fonts.push(d[f])}E===0?this.isLoaded=!0:setTimeout(this.checkLoadedFonts.bind(this),100)}else this.isLoaded=!0},getCharData:function(c,u,f){for(var d=0,g=this.chars.length;d<g;){if(this.chars[d].ch===c&&this.chars[d].style===u&&this.chars[d].fFamily===f)return this.chars[d];d+=1}return(typeof c=="string"&&c.charCodeAt(0)!==13||!c)&&console&&console.warn&&!this._warned&&(this._warned=!0),r},getFontByName:function(c){for(var u=0,f=this.fonts.length;u<f;){if(this.fonts[u].fName===c)return this.fonts[u];u+=1}return this.fonts[0]},measureText:function(c,u,f){var d=this.getFontByName(u),g=c;if(!d.cache[g]){var E=d.helper;if(c===" "){var m=E.measureText("|"+c+"|"),T=E.measureText("||");d.cache[g]=(m-T)/100}else d.cache[g]=E.measureText(c)/100}return d.cache[g]*f},checkLoadedFonts:function(){var c,u,f,d=this.fonts.length,g=d;for(c=0;c<d;c+=1)this.fonts[c].loaded?g-=1:this.fonts[c].fOrigin==="n"||this.fonts[c].origin===0?this.fonts[c].loaded=!0:(u=this.fonts[c].monoCase.node,f=this.fonts[c].monoCase.w,u.offsetWidth!==f?(g-=1,this.fonts[c].loaded=!0):(u=this.fonts[c].sansCase.node,f=this.fonts[c].sansCase.w,u.offsetWidth!==f&&(g-=1,this.fonts[c].loaded=!0)),this.fonts[c].loaded&&(this.fonts[c].sansCase.parent.parentNode.removeChild(this.fonts[c].sansCase.parent),this.fonts[c].monoCase.parent.parentNode.removeChild(this.fonts[c].monoCase.parent)));g!==0&&Date.now()-this.initTime<5e3?setTimeout(this.checkLoadedFontsBinded,20):setTimeout(this.setIsLoadedBinded,10)},setIsLoaded:function(){this.isLoaded=!0}},o})();function SlotManager(r){this.animationData=r}function slotFactory(r){return new SlotManager(r)}function RenderableElement(){}SlotManager.prototype.getProp=function(r){return this.animationData.slots&&this.animationData.slots[r.sid]?Object.assign(r,this.animationData.slots[r.sid].p):r},RenderableElement.prototype={initRenderable:function(){this.isInRange=!1,this.hidden=!1,this.isTransparent=!1,this.renderableComponents=[]},addRenderableComponent:function(r){this.renderableComponents.indexOf(r)===-1&&this.renderableComponents.push(r)},removeRenderableComponent:function(r){this.renderableComponents.indexOf(r)!==-1&&this.renderableComponents.splice(this.renderableComponents.indexOf(r),1)},prepareRenderableFrame:function(r){this.checkLayerLimits(r)},checkTransparency:function(){this.finalTransform.mProp.o.v<=0?!this.isTransparent&&this.globalData.renderConfig.hideOnTransparent&&(this.isTransparent=!0,this.hide()):this.isTransparent&&(this.isTransparent=!1,this.show())},checkLayerLimits:function(r){this.data.ip-this.data.st<=r&&this.data.op-this.data.st>r?this.isInRange!==!0&&(this.globalData._mdf=!0,this._mdf=!0,this.isInRange=!0,this.show()):this.isInRange!==!1&&(this.globalData._mdf=!0,this.isInRange=!1,this.hide())},renderRenderable:function(){var r,e=this.renderableComponents.length;for(r=0;r<e;r+=1)this.renderableComponents[r].renderFrame(this._isFirstFrame)},sourceRectAtTime:function(){return{top:0,left:0,width:100,height:100}},getLayerSize:function(){return this.data.ty===5?{w:this.data.textData.width,h:this.data.textData.height}:{w:this.data.width,h:this.data.height}}};var getBlendMode=(blendModeEnums={0:"source-over",1:"multiply",2:"screen",3:"overlay",4:"darken",5:"lighten",6:"color-dodge",7:"color-burn",8:"hard-light",9:"soft-light",10:"difference",11:"exclusion",12:"hue",13:"saturation",14:"color",15:"luminosity"},function(r){return blendModeEnums[r]||""}),blendModeEnums;function SliderEffect(r,e,t){this.p=PropertyFactory.getProp(e,r.v,0,0,t)}function AngleEffect(r,e,t){this.p=PropertyFactory.getProp(e,r.v,0,0,t)}function ColorEffect(r,e,t){this.p=PropertyFactory.getProp(e,r.v,1,0,t)}function PointEffect(r,e,t){this.p=PropertyFactory.getProp(e,r.v,1,0,t)}function LayerIndexEffect(r,e,t){this.p=PropertyFactory.getProp(e,r.v,0,0,t)}function MaskIndexEffect(r,e,t){this.p=PropertyFactory.getProp(e,r.v,0,0,t)}function CheckboxEffect(r,e,t){this.p=PropertyFactory.getProp(e,r.v,0,0,t)}function NoValueEffect(){this.p={}}function EffectsManager(r,e){var t,i=r.ef||[];this.effectElements=[];var s,n=i.length;for(t=0;t<n;t+=1)s=new GroupEffect(i[t],e),this.effectElements.push(s)}function GroupEffect(r,e){this.init(r,e)}function BaseElement(){}function FrameElement(){}function FootageElement(r,e,t){this.initFrame(),this.initRenderable(),this.assetData=e.getAssetData(r.refId),this.footageData=e.imageLoader.getAsset(this.assetData),this.initBaseData(r,e,t)}function AudioElement(r,e,t){this.initFrame(),this.initRenderable(),this.assetData=e.getAssetData(r.refId),this.initBaseData(r,e,t),this._isPlaying=!1,this._canPlay=!1;var i=this.globalData.getAssetsPath(this.assetData);this.audio=this.globalData.audioController.createAudio(i),this._currentTime=0,this.globalData.audioController.addAudio(this),this._volumeMultiplier=1,this._volume=1,this._previousVolume=null,this.tm=r.tm?PropertyFactory.getProp(this,r.tm,0,e.frameRate,this):{_placeholder:!0},this.lv=PropertyFactory.getProp(this,r.au&&r.au.lv?r.au.lv:{k:[100]},1,.01,this)}function BaseRenderer(){}extendPrototype([DynamicPropertyContainer],GroupEffect),GroupEffect.prototype.getValue=GroupEffect.prototype.iterateDynamicProperties,GroupEffect.prototype.init=function(r,e){var t;this.data=r,this.effectElements=[],this.initDynamicPropertyContainer(e);var i,s=this.data.ef.length,n=this.data.ef;for(t=0;t<s;t+=1){switch(i=null,n[t].ty){case 0:i=new SliderEffect(n[t],e,this);break;case 1:i=new AngleEffect(n[t],e,this);break;case 2:i=new ColorEffect(n[t],e,this);break;case 3:i=new PointEffect(n[t],e,this);break;case 4:case 7:i=new CheckboxEffect(n[t],e,this);break;case 10:i=new LayerIndexEffect(n[t],e,this);break;case 11:i=new MaskIndexEffect(n[t],e,this);break;case 5:i=new EffectsManager(n[t],e);break;default:i=new NoValueEffect(n[t])}i&&this.effectElements.push(i)}},BaseElement.prototype={checkMasks:function(){if(!this.data.hasMask)return!1;for(var r=0,e=this.data.masksProperties.length;r<e;){if(this.data.masksProperties[r].mode!=="n"&&this.data.masksProperties[r].cl!==!1)return!0;r+=1}return!1},initExpressions:function(){var r=getExpressionInterfaces();if(r){var e=r("layer"),t=r("effects"),i=r("shape"),s=r("text"),n=r("comp");this.layerInterface=e(this),this.data.hasMask&&this.maskManager&&this.layerInterface.registerMaskInterface(this.maskManager);var a=t.createEffectsInterface(this,this.layerInterface);this.layerInterface.registerEffectsInterface(a),this.data.ty===0||this.data.xt?this.compInterface=n(this):this.data.ty===4?(this.layerInterface.shapeInterface=i(this.shapesData,this.itemsData,this.layerInterface),this.layerInterface.content=this.layerInterface.shapeInterface):this.data.ty===5&&(this.layerInterface.textInterface=s(this),this.layerInterface.text=this.layerInterface.textInterface)}},setBlendMode:function(){var r=getBlendMode(this.data.bm);(this.baseElement||this.layerElement).style["mix-blend-mode"]=r},initBaseData:function(r,e,t){this.globalData=e,this.comp=t,this.data=r,this.layerId=createElementID(),this.data.sr||(this.data.sr=1),this.effectsManager=new EffectsManager(this.data,this,this.dynamicProperties)},getType:function(){return this.type},sourceRectAtTime:function(){}},FrameElement.prototype={initFrame:function(){this._isFirstFrame=!1,this.dynamicProperties=[],this._mdf=!1},prepareProperties:function(r,e){var t,i=this.dynamicProperties.length;for(t=0;t<i;t+=1)(e||this._isParent&&this.dynamicProperties[t].propType==="transform")&&(this.dynamicProperties[t].getValue(),this.dynamicProperties[t]._mdf&&(this.globalData._mdf=!0,this._mdf=!0))},addDynamicProperty:function(r){this.dynamicProperties.indexOf(r)===-1&&this.dynamicProperties.push(r)}},FootageElement.prototype.prepareFrame=function(){},extendPrototype([RenderableElement,BaseElement,FrameElement],FootageElement),FootageElement.prototype.getBaseElement=function(){return null},FootageElement.prototype.renderFrame=function(){},FootageElement.prototype.destroy=function(){},FootageElement.prototype.initExpressions=function(){var r=getExpressionInterfaces();if(r){var e=r("footage");this.layerInterface=e(this)}},FootageElement.prototype.getFootageData=function(){return this.footageData},AudioElement.prototype.prepareFrame=function(r){if(this.prepareRenderableFrame(r,!0),this.prepareProperties(r,!0),this.tm._placeholder)this._currentTime=r/this.data.sr;else{var e=this.tm.v;this._currentTime=e}this._volume=this.lv.v[0];var t=this._volume*this._volumeMultiplier;this._previousVolume!==t&&(this._previousVolume=t,this.audio.volume(t))},extendPrototype([RenderableElement,BaseElement,FrameElement],AudioElement),AudioElement.prototype.renderFrame=function(){this.isInRange&&this._canPlay&&(this._isPlaying?(!this.audio.playing()||Math.abs(this._currentTime/this.globalData.frameRate-this.audio.seek())>.1)&&this.audio.seek(this._currentTime/this.globalData.frameRate):(this.audio.play(),this.audio.seek(this._currentTime/this.globalData.frameRate),this._isPlaying=!0))},AudioElement.prototype.show=function(){},AudioElement.prototype.hide=function(){this.audio.pause(),this._isPlaying=!1},AudioElement.prototype.pause=function(){this.audio.pause(),this._isPlaying=!1,this._canPlay=!1},AudioElement.prototype.resume=function(){this._canPlay=!0},AudioElement.prototype.setRate=function(r){this.audio.rate(r)},AudioElement.prototype.volume=function(r){this._volumeMultiplier=r,this._previousVolume=r*this._volume,this.audio.volume(this._previousVolume)},AudioElement.prototype.getBaseElement=function(){return null},AudioElement.prototype.destroy=function(){},AudioElement.prototype.sourceRectAtTime=function(){},AudioElement.prototype.initExpressions=function(){},BaseRenderer.prototype.checkLayers=function(r){var e,t,i=this.layers.length;for(this.completeLayers=!0,e=i-1;e>=0;e-=1)this.elements[e]||(t=this.layers[e]).ip-t.st<=r-this.layers[e].st&&t.op-t.st>r-this.layers[e].st&&this.buildItem(e),this.completeLayers=!!this.elements[e]&&this.completeLayers;this.checkPendingElements()},BaseRenderer.prototype.createItem=function(r){switch(r.ty){case 2:return this.createImage(r);case 0:return this.createComp(r);case 1:return this.createSolid(r);case 3:return this.createNull(r);case 4:return this.createShape(r);case 5:return this.createText(r);case 6:return this.createAudio(r);case 13:return this.createCamera(r);case 15:return this.createFootage(r);default:return this.createNull(r)}},BaseRenderer.prototype.createCamera=function(){throw new Error("You're using a 3d camera. Try the html renderer.")},BaseRenderer.prototype.createAudio=function(r){return new AudioElement(r,this.globalData,this)},BaseRenderer.prototype.createFootage=function(r){return new FootageElement(r,this.globalData,this)},BaseRenderer.prototype.buildAllItems=function(){var r,e=this.layers.length;for(r=0;r<e;r+=1)this.buildItem(r);this.checkPendingElements()},BaseRenderer.prototype.includeLayers=function(r){var e;this.completeLayers=!1;var t,i=r.length,s=this.layers.length;for(e=0;e<i;e+=1)for(t=0;t<s;){if(this.layers[t].id===r[e].id){this.layers[t]=r[e];break}t+=1}},BaseRenderer.prototype.setProjectInterface=function(r){this.globalData.projectInterface=r},BaseRenderer.prototype.initItems=function(){this.globalData.progressiveLoad||this.buildAllItems()},BaseRenderer.prototype.buildElementParenting=function(r,e,t){for(var i=this.elements,s=this.layers,n=0,a=s.length;n<a;)s[n].ind==e&&(i[n]&&i[n]!==!0?(t.push(i[n]),i[n].setAsParent(),s[n].parent!==void 0?this.buildElementParenting(r,s[n].parent,t):r.setHierarchy(t)):(this.buildItem(n),this.addPendingElement(r))),n+=1},BaseRenderer.prototype.addPendingElement=function(r){this.pendingElements.push(r)},BaseRenderer.prototype.searchExtraCompositions=function(r){var e,t=r.length;for(e=0;e<t;e+=1)if(r[e].xt){var i=this.createComp(r[e]);i.initExpressions(),this.globalData.projectInterface.registerComposition(i)}},BaseRenderer.prototype.getElementById=function(r){var e,t=this.elements.length;for(e=0;e<t;e+=1)if(this.elements[e].data.ind===r)return this.elements[e];return null},BaseRenderer.prototype.getElementByPath=function(r){var e,t=r.shift();if(typeof t=="number")e=this.elements[t];else{var i,s=this.elements.length;for(i=0;i<s;i+=1)if(this.elements[i].data.nm===t){e=this.elements[i];break}}return r.length===0?e:e.getElementByPath(r)},BaseRenderer.prototype.setupGlobalData=function(r,e){this.globalData.fontManager=new FontManager,this.globalData.slotManager=slotFactory(r),this.globalData.fontManager.addChars(r.chars),this.globalData.fontManager.addFonts(r.fonts,e),this.globalData.getAssetData=this.animationItem.getAssetData.bind(this.animationItem),this.globalData.getAssetsPath=this.animationItem.getAssetsPath.bind(this.animationItem),this.globalData.imageLoader=this.animationItem.imagePreloader,this.globalData.audioController=this.animationItem.audioController,this.globalData.frameId=0,this.globalData.frameRate=r.fr,this.globalData.nm=r.nm,this.globalData.compSize={w:r.w,h:r.h}};var effectTypes={TRANSFORM_EFFECT:"transformEFfect"};function TransformElement(){}function MaskElement(r,e,t){this.data=r,this.element=e,this.globalData=t,this.storedData=[],this.masksProperties=this.data.masksProperties||[],this.maskElement=null;var i,s,n=this.globalData.defs,a=this.masksProperties?this.masksProperties.length:0;this.viewData=createSizedArray(a),this.solidPath="";var o,c,u,f,d,g,E=this.masksProperties,m=0,T=[],S=createElementID(),b="clipPath",C="clip-path";for(i=0;i<a;i+=1)if((E[i].mode!=="a"&&E[i].mode!=="n"||E[i].inv||E[i].o.k!==100||E[i].o.x)&&(b="mask",C="mask"),E[i].mode!=="s"&&E[i].mode!=="i"||m!==0?u=null:((u=createNS("rect")).setAttribute("fill","#ffffff"),u.setAttribute("width",this.element.comp.data.w||0),u.setAttribute("height",this.element.comp.data.h||0),T.push(u)),s=createNS("path"),E[i].mode==="n")this.viewData[i]={op:PropertyFactory.getProp(this.element,E[i].o,0,.01,this.element),prop:ShapePropertyFactory.getShapeProp(this.element,E[i],3),elem:s,lastPath:""},n.appendChild(s);else{var I;if(m+=1,s.setAttribute("fill",E[i].mode==="s"?"#000000":"#ffffff"),s.setAttribute("clip-rule","nonzero"),E[i].x.k!==0?(b="mask",C="mask",g=PropertyFactory.getProp(this.element,E[i].x,0,null,this.element),I=createElementID(),(f=createNS("filter")).setAttribute("id",I),(d=createNS("feMorphology")).setAttribute("operator","erode"),d.setAttribute("in","SourceGraphic"),d.setAttribute("radius","0"),f.appendChild(d),n.appendChild(f),s.setAttribute("stroke",E[i].mode==="s"?"#000000":"#ffffff")):(d=null,g=null),this.storedData[i]={elem:s,x:g,expan:d,lastPath:"",lastOperator:"",filterId:I,lastRadius:0},E[i].mode==="i"){c=T.length;var L=createNS("g");for(o=0;o<c;o+=1)L.appendChild(T[o]);var k=createNS("mask");k.setAttribute("mask-type","alpha"),k.setAttribute("id",S+"_"+m),k.appendChild(s),n.appendChild(k),L.setAttribute("mask","url("+getLocationHref()+"#"+S+"_"+m+")"),T.length=0,T.push(L)}else T.push(s);E[i].inv&&!this.solidPath&&(this.solidPath=this.createLayerSolidPath()),this.viewData[i]={elem:s,lastPath:"",op:PropertyFactory.getProp(this.element,E[i].o,0,.01,this.element),prop:ShapePropertyFactory.getShapeProp(this.element,E[i],3),invRect:u},this.viewData[i].prop.k||this.drawPath(E[i],this.viewData[i].prop.v,this.viewData[i])}for(this.maskElement=createNS(b),a=T.length,i=0;i<a;i+=1)this.maskElement.appendChild(T[i]);m>0&&(this.maskElement.setAttribute("id",S),this.element.maskedElement.setAttribute(C,"url("+getLocationHref()+"#"+S+")"),n.appendChild(this.maskElement)),this.viewData.length&&this.element.addRenderableComponent(this)}TransformElement.prototype={initTransform:function(){var r=new Matrix;this.finalTransform={mProp:this.data.ks?TransformPropertyFactory.getTransformProperty(this,this.data.ks,this):{o:0},_matMdf:!1,_localMatMdf:!1,_opMdf:!1,mat:r,localMat:r,localOpacity:1},this.data.ao&&(this.finalTransform.mProp.autoOriented=!0),this.data.ty},renderTransform:function(){if(this.finalTransform._opMdf=this.finalTransform.mProp.o._mdf||this._isFirstFrame,this.finalTransform._matMdf=this.finalTransform.mProp._mdf||this._isFirstFrame,this.hierarchy){var r,e=this.finalTransform.mat,t=0,i=this.hierarchy.length;if(!this.finalTransform._matMdf)for(;t<i;){if(this.hierarchy[t].finalTransform.mProp._mdf){this.finalTransform._matMdf=!0;break}t+=1}if(this.finalTransform._matMdf)for(r=this.finalTransform.mProp.v.props,e.cloneFromProps(r),t=0;t<i;t+=1)e.multiply(this.hierarchy[t].finalTransform.mProp.v)}this.finalTransform._matMdf&&(this.finalTransform._localMatMdf=this.finalTransform._matMdf),this.finalTransform._opMdf&&(this.finalTransform.localOpacity=this.finalTransform.mProp.o.v)},renderLocalTransform:function(){if(this.localTransforms){var r=0,e=this.localTransforms.length;if(this.finalTransform._localMatMdf=this.finalTransform._matMdf,!this.finalTransform._localMatMdf||!this.finalTransform._opMdf)for(;r<e;)this.localTransforms[r]._mdf&&(this.finalTransform._localMatMdf=!0),this.localTransforms[r]._opMdf&&!this.finalTransform._opMdf&&(this.finalTransform.localOpacity=this.finalTransform.mProp.o.v,this.finalTransform._opMdf=!0),r+=1;if(this.finalTransform._localMatMdf){var t=this.finalTransform.localMat;for(this.localTransforms[0].matrix.clone(t),r=1;r<e;r+=1){var i=this.localTransforms[r].matrix;t.multiply(i)}t.multiply(this.finalTransform.mat)}if(this.finalTransform._opMdf){var s=this.finalTransform.localOpacity;for(r=0;r<e;r+=1)s*=.01*this.localTransforms[r].opacity;this.finalTransform.localOpacity=s}}},searchEffectTransforms:function(){if(this.renderableEffectsManager){var r=this.renderableEffectsManager.getEffects(effectTypes.TRANSFORM_EFFECT);if(r.length){this.localTransforms=[],this.finalTransform.localMat=new Matrix;var e=0,t=r.length;for(e=0;e<t;e+=1)this.localTransforms.push(r[e])}}},globalToLocal:function(r){var e=[];e.push(this.finalTransform);for(var t,i=!0,s=this.comp;i;)s.finalTransform?(s.data.hasMask&&e.splice(0,0,s.finalTransform),s=s.comp):i=!1;var n,a=e.length;for(t=0;t<a;t+=1)n=e[t].mat.applyToPointArray(0,0,0),r=[r[0]-n[0],r[1]-n[1],0];return r},mHelper:new Matrix},MaskElement.prototype.getMaskProperty=function(r){return this.viewData[r].prop},MaskElement.prototype.renderFrame=function(r){var e,t=this.element.finalTransform.mat,i=this.masksProperties.length;for(e=0;e<i;e+=1)if((this.viewData[e].prop._mdf||r)&&this.drawPath(this.masksProperties[e],this.viewData[e].prop.v,this.viewData[e]),(this.viewData[e].op._mdf||r)&&this.viewData[e].elem.setAttribute("fill-opacity",this.viewData[e].op.v),this.masksProperties[e].mode!=="n"&&(this.viewData[e].invRect&&(this.element.finalTransform.mProp._mdf||r)&&this.viewData[e].invRect.setAttribute("transform",t.getInverseMatrix().to2dCSS()),this.storedData[e].x&&(this.storedData[e].x._mdf||r))){var s=this.storedData[e].expan;this.storedData[e].x.v<0?(this.storedData[e].lastOperator!=="erode"&&(this.storedData[e].lastOperator="erode",this.storedData[e].elem.setAttribute("filter","url("+getLocationHref()+"#"+this.storedData[e].filterId+")")),s.setAttribute("radius",-this.storedData[e].x.v)):(this.storedData[e].lastOperator!=="dilate"&&(this.storedData[e].lastOperator="dilate",this.storedData[e].elem.setAttribute("filter",null)),this.storedData[e].elem.setAttribute("stroke-width",2*this.storedData[e].x.v))}},MaskElement.prototype.getMaskelement=function(){return this.maskElement},MaskElement.prototype.createLayerSolidPath=function(){var r="M0,0 ";return r+=" h"+this.globalData.compSize.w,r+=" v"+this.globalData.compSize.h,r+=" h-"+this.globalData.compSize.w,r+=" v-"+this.globalData.compSize.h+" "},MaskElement.prototype.drawPath=function(r,e,t){var i,s,n=" M"+e.v[0][0]+","+e.v[0][1];for(s=e._length,i=1;i<s;i+=1)n+=" C"+e.o[i-1][0]+","+e.o[i-1][1]+" "+e.i[i][0]+","+e.i[i][1]+" "+e.v[i][0]+","+e.v[i][1];if(e.c&&s>1&&(n+=" C"+e.o[i-1][0]+","+e.o[i-1][1]+" "+e.i[0][0]+","+e.i[0][1]+" "+e.v[0][0]+","+e.v[0][1]),t.lastPath!==n){var a="";t.elem&&(e.c&&(a=r.inv?this.solidPath+n:n),t.elem.setAttribute("d",a)),t.lastPath=n}},MaskElement.prototype.destroy=function(){this.element=null,this.globalData=null,this.maskElement=null,this.data=null,this.masksProperties=null};var filtersFactory=(function(){var r={};return r.createFilter=function(e,t){var i=createNS("filter");return i.setAttribute("id",e),t!==!0&&(i.setAttribute("filterUnits","objectBoundingBox"),i.setAttribute("x","0%"),i.setAttribute("y","0%"),i.setAttribute("width","100%"),i.setAttribute("height","100%")),i},r.createAlphaToLuminanceFilter=function(){var e=createNS("feColorMatrix");return e.setAttribute("type","matrix"),e.setAttribute("color-interpolation-filters","sRGB"),e.setAttribute("values","0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1"),e},r})(),featureSupport=(function(){var r={maskType:!0,svgLumaHidden:!0,offscreenCanvas:typeof OffscreenCanvas<"u"};return(/MSIE 10/i.test(navigator.userAgent)||/MSIE 9/i.test(navigator.userAgent)||/rv:11.0/i.test(navigator.userAgent)||/Edge\/\d./i.test(navigator.userAgent))&&(r.maskType=!1),/firefox/i.test(navigator.userAgent)&&(r.svgLumaHidden=!1),r})(),registeredEffects$1={},idPrefix="filter_result_";function SVGEffects(r){var e,t,i="SourceGraphic",s=r.data.ef?r.data.ef.length:0,n=createElementID(),a=filtersFactory.createFilter(n,!0),o=0;for(this.filters=[],e=0;e<s;e+=1){t=null;var c=r.data.ef[e].ty;registeredEffects$1[c]&&(t=new registeredEffects$1[c].effect(a,r.effectsManager.effectElements[e],r,idPrefix+o,i),i=idPrefix+o,registeredEffects$1[c].countsAsEffect&&(o+=1)),t&&this.filters.push(t)}o&&(r.globalData.defs.appendChild(a),r.layerElement.setAttribute("filter","url("+getLocationHref()+"#"+n+")")),this.filters.length&&r.addRenderableComponent(this)}function registerEffect$1(r,e,t){registeredEffects$1[r]={effect:e,countsAsEffect:t}}function SVGBaseElement(){}function HierarchyElement(){}function RenderableDOMElement(){}function IImageElement(r,e,t){this.assetData=e.getAssetData(r.refId),this.assetData&&this.assetData.sid&&(this.assetData=e.slotManager.getProp(this.assetData)),this.initElement(r,e,t),this.sourceRect={top:0,left:0,width:this.assetData.w,height:this.assetData.h}}function ProcessedElement(r,e){this.elem=r,this.pos=e}function IShapeElement(){}SVGEffects.prototype.renderFrame=function(r){var e,t=this.filters.length;for(e=0;e<t;e+=1)this.filters[e].renderFrame(r)},SVGEffects.prototype.getEffects=function(r){var e,t=this.filters.length,i=[];for(e=0;e<t;e+=1)this.filters[e].type===r&&i.push(this.filters[e]);return i},SVGBaseElement.prototype={initRendererElement:function(){this.layerElement=createNS("g")},createContainerElements:function(){this.matteElement=createNS("g"),this.transformedElement=this.layerElement,this.maskedElement=this.layerElement,this._sizeChanged=!1;var r=null;if(this.data.td){this.matteMasks={};var e=createNS("g");e.setAttribute("id",this.layerId),e.appendChild(this.layerElement),r=e,this.globalData.defs.appendChild(e)}else this.data.tt?(this.matteElement.appendChild(this.layerElement),r=this.matteElement,this.baseElement=this.matteElement):this.baseElement=this.layerElement;if(this.data.ln&&this.layerElement.setAttribute("id",this.data.ln),this.data.cl&&this.layerElement.setAttribute("class",this.data.cl),this.data.ty===0&&!this.data.hd){var t=createNS("clipPath"),i=createNS("path");i.setAttribute("d","M0,0 L"+this.data.w+",0 L"+this.data.w+","+this.data.h+" L0,"+this.data.h+"z");var s=createElementID();if(t.setAttribute("id",s),t.appendChild(i),this.globalData.defs.appendChild(t),this.checkMasks()){var n=createNS("g");n.setAttribute("clip-path","url("+getLocationHref()+"#"+s+")"),n.appendChild(this.layerElement),this.transformedElement=n,r?r.appendChild(this.transformedElement):this.baseElement=this.transformedElement}else this.layerElement.setAttribute("clip-path","url("+getLocationHref()+"#"+s+")")}this.data.bm!==0&&this.setBlendMode()},renderElement:function(){this.finalTransform._localMatMdf&&this.transformedElement.setAttribute("transform",this.finalTransform.localMat.to2dCSS()),this.finalTransform._opMdf&&this.transformedElement.setAttribute("opacity",this.finalTransform.localOpacity)},destroyBaseElement:function(){this.layerElement=null,this.matteElement=null,this.maskManager.destroy()},getBaseElement:function(){return this.data.hd?null:this.baseElement},createRenderableComponents:function(){this.maskManager=new MaskElement(this.data,this,this.globalData),this.renderableEffectsManager=new SVGEffects(this),this.searchEffectTransforms()},getMatte:function(r){if(this.matteMasks||(this.matteMasks={}),!this.matteMasks[r]){var e,t,i,s,n=this.layerId+"_"+r;if(r===1||r===3){var a=createNS("mask");a.setAttribute("id",n),a.setAttribute("mask-type",r===3?"luminance":"alpha"),(i=createNS("use")).setAttributeNS("http://www.w3.org/1999/xlink","href","#"+this.layerId),a.appendChild(i),this.globalData.defs.appendChild(a),featureSupport.maskType||r!==1||(a.setAttribute("mask-type","luminance"),e=createElementID(),t=filtersFactory.createFilter(e),this.globalData.defs.appendChild(t),t.appendChild(filtersFactory.createAlphaToLuminanceFilter()),(s=createNS("g")).appendChild(i),a.appendChild(s),s.setAttribute("filter","url("+getLocationHref()+"#"+e+")"))}else if(r===2){var o=createNS("mask");o.setAttribute("id",n),o.setAttribute("mask-type","alpha");var c=createNS("g");o.appendChild(c),e=createElementID(),t=filtersFactory.createFilter(e);var u=createNS("feComponentTransfer");u.setAttribute("in","SourceGraphic"),t.appendChild(u);var f=createNS("feFuncA");f.setAttribute("type","table"),f.setAttribute("tableValues","1.0 0.0"),u.appendChild(f),this.globalData.defs.appendChild(t);var d=createNS("rect");d.setAttribute("width",this.comp.data.w),d.setAttribute("height",this.comp.data.h),d.setAttribute("x","0"),d.setAttribute("y","0"),d.setAttribute("fill","#ffffff"),d.setAttribute("opacity","0"),c.setAttribute("filter","url("+getLocationHref()+"#"+e+")"),c.appendChild(d),(i=createNS("use")).setAttributeNS("http://www.w3.org/1999/xlink","href","#"+this.layerId),c.appendChild(i),featureSupport.maskType||(o.setAttribute("mask-type","luminance"),t.appendChild(filtersFactory.createAlphaToLuminanceFilter()),s=createNS("g"),c.appendChild(d),s.appendChild(this.layerElement),c.appendChild(s)),this.globalData.defs.appendChild(o)}this.matteMasks[r]=n}return this.matteMasks[r]},setMatte:function(r){this.matteElement&&this.matteElement.setAttribute("mask","url("+getLocationHref()+"#"+r+")")}},HierarchyElement.prototype={initHierarchy:function(){this.hierarchy=[],this._isParent=!1,this.checkParenting()},setHierarchy:function(r){this.hierarchy=r},setAsParent:function(){this._isParent=!0},checkParenting:function(){this.data.parent!==void 0&&this.comp.buildElementParenting(this,this.data.parent,[])}},extendPrototype([RenderableElement,createProxyFunction({initElement:function(r,e,t){this.initFrame(),this.initBaseData(r,e,t),this.initTransform(r,e,t),this.initHierarchy(),this.initRenderable(),this.initRendererElement(),this.createContainerElements(),this.createRenderableComponents(),this.createContent(),this.hide()},hide:function(){this.hidden||this.isInRange&&!this.isTransparent||((this.baseElement||this.layerElement).style.display="none",this.hidden=!0)},show:function(){this.isInRange&&!this.isTransparent&&(this.data.hd||((this.baseElement||this.layerElement).style.display="block"),this.hidden=!1,this._isFirstFrame=!0)},renderFrame:function(){this.data.hd||this.hidden||(this.renderTransform(),this.renderRenderable(),this.renderLocalTransform(),this.renderElement(),this.renderInnerContent(),this._isFirstFrame&&(this._isFirstFrame=!1))},renderInnerContent:function(){},prepareFrame:function(r){this._mdf=!1,this.prepareRenderableFrame(r),this.prepareProperties(r,this.isInRange),this.checkTransparency()},destroy:function(){this.innerElem=null,this.destroyBaseElement()}})],RenderableDOMElement),extendPrototype([BaseElement,TransformElement,SVGBaseElement,HierarchyElement,FrameElement,RenderableDOMElement],IImageElement),IImageElement.prototype.createContent=function(){var r=this.globalData.getAssetsPath(this.assetData);this.innerElem=createNS("image"),this.innerElem.setAttribute("width",this.assetData.w+"px"),this.innerElem.setAttribute("height",this.assetData.h+"px"),this.innerElem.setAttribute("preserveAspectRatio",this.assetData.pr||this.globalData.renderConfig.imagePreserveAspectRatio),this.innerElem.setAttributeNS("http://www.w3.org/1999/xlink","href",r),this.layerElement.appendChild(this.innerElem)},IImageElement.prototype.sourceRectAtTime=function(){return this.sourceRect},IShapeElement.prototype={addShapeToModifiers:function(r){var e,t=this.shapeModifiers.length;for(e=0;e<t;e+=1)this.shapeModifiers[e].addShape(r)},isShapeInAnimatedModifiers:function(r){for(var e=this.shapeModifiers.length;0<e;)if(this.shapeModifiers[0].isAnimatedWithShape(r))return!0;return!1},renderModifiers:function(){if(this.shapeModifiers.length){var r,e=this.shapes.length;for(r=0;r<e;r+=1)this.shapes[r].sh.reset();for(r=(e=this.shapeModifiers.length)-1;r>=0&&!this.shapeModifiers[r].processShapes(this._isFirstFrame);r-=1);}},searchProcessedElement:function(r){for(var e=this.processedElements,t=0,i=e.length;t<i;){if(e[t].elem===r)return e[t].pos;t+=1}return 0},addProcessedElement:function(r,e){for(var t=this.processedElements,i=t.length;i;)if(t[i-=1].elem===r)return void(t[i].pos=e);t.push(new ProcessedElement(r,e))},prepareFrame:function(r){this.prepareRenderableFrame(r),this.prepareProperties(r,this.isInRange)}};var lineCapEnum={1:"butt",2:"round",3:"square"},lineJoinEnum={1:"miter",2:"round",3:"bevel"};function SVGShapeData(r,e,t){this.caches=[],this.styles=[],this.transformers=r,this.lStr="",this.sh=t,this.lvl=e,this._isAnimated=!!t.k;for(var i=0,s=r.length;i<s;){if(r[i].mProps.dynamicProperties.length){this._isAnimated=!0;break}i+=1}}function SVGStyleData(r,e){this.data=r,this.type=r.ty,this.d="",this.lvl=e,this._mdf=!1,this.closed=r.hd===!0,this.pElem=createNS("path"),this.msElem=null}function DashProperty(r,e,t,i){var s;this.elem=r,this.frameId=-1,this.dataProps=createSizedArray(e.length),this.renderer=t,this.k=!1,this.dashStr="",this.dashArray=createTypedArray("float32",e.length?e.length-1:0),this.dashoffset=createTypedArray("float32",1),this.initDynamicPropertyContainer(i);var n,a=e.length||0;for(s=0;s<a;s+=1)n=PropertyFactory.getProp(r,e[s].v,0,0,this),this.k=n.k||this.k,this.dataProps[s]={n:e[s].n,p:n};this.k||this.getValue(!0),this._isAnimated=this.k}function SVGStrokeStyleData(r,e,t){this.initDynamicPropertyContainer(r),this.getValue=this.iterateDynamicProperties,this.o=PropertyFactory.getProp(r,e.o,0,.01,this),this.w=PropertyFactory.getProp(r,e.w,0,null,this),this.d=new DashProperty(r,e.d||{},"svg",this),this.c=PropertyFactory.getProp(r,e.c,1,255,this),this.style=t,this._isAnimated=!!this._isAnimated}function SVGFillStyleData(r,e,t){this.initDynamicPropertyContainer(r),this.getValue=this.iterateDynamicProperties,this.o=PropertyFactory.getProp(r,e.o,0,.01,this),this.c=PropertyFactory.getProp(r,e.c,1,255,this),this.style=t}function SVGNoStyleData(r,e,t){this.initDynamicPropertyContainer(r),this.getValue=this.iterateDynamicProperties,this.style=t}function GradientProperty(r,e,t){this.data=e,this.c=createTypedArray("uint8c",4*e.p);var i=e.k.k[0].s?e.k.k[0].s.length-4*e.p:e.k.k.length-4*e.p;this.o=createTypedArray("float32",i),this._cmdf=!1,this._omdf=!1,this._collapsable=this.checkCollapsable(),this._hasOpacity=i,this.initDynamicPropertyContainer(t),this.prop=PropertyFactory.getProp(r,e.k,1,null,this),this.k=this.prop.k,this.getValue(!0)}function SVGGradientFillStyleData(r,e,t){this.initDynamicPropertyContainer(r),this.getValue=this.iterateDynamicProperties,this.initGradientData(r,e,t)}function SVGGradientStrokeStyleData(r,e,t){this.initDynamicPropertyContainer(r),this.getValue=this.iterateDynamicProperties,this.w=PropertyFactory.getProp(r,e.w,0,null,this),this.d=new DashProperty(r,e.d||{},"svg",this),this.initGradientData(r,e,t),this._isAnimated=!!this._isAnimated}function ShapeGroupData(){this.it=[],this.prevViewData=[],this.gr=createNS("g")}function SVGTransformData(r,e,t){this.transform={mProps:r,op:e,container:t},this.elements=[],this._isAnimated=this.transform.mProps.dynamicProperties.length||this.transform.op.effectsSequence.length}SVGShapeData.prototype.setAsAnimated=function(){this._isAnimated=!0},SVGStyleData.prototype.reset=function(){this.d="",this._mdf=!1},DashProperty.prototype.getValue=function(r){if((this.elem.globalData.frameId!==this.frameId||r)&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf=this._mdf||r,this._mdf)){var e=0,t=this.dataProps.length;for(this.renderer==="svg"&&(this.dashStr=""),e=0;e<t;e+=1)this.dataProps[e].n!=="o"?this.renderer==="svg"?this.dashStr+=" "+this.dataProps[e].p.v:this.dashArray[e]=this.dataProps[e].p.v:this.dashoffset[0]=this.dataProps[e].p.v}},extendPrototype([DynamicPropertyContainer],DashProperty),extendPrototype([DynamicPropertyContainer],SVGStrokeStyleData),extendPrototype([DynamicPropertyContainer],SVGFillStyleData),extendPrototype([DynamicPropertyContainer],SVGNoStyleData),GradientProperty.prototype.comparePoints=function(r,e){for(var t=0,i=this.o.length/2;t<i;){if(Math.abs(r[4*t]-r[4*e+2*t])>.01)return!1;t+=1}return!0},GradientProperty.prototype.checkCollapsable=function(){if(this.o.length/2!=this.c.length/4)return!1;if(this.data.k.k[0].s)for(var r=0,e=this.data.k.k.length;r<e;){if(!this.comparePoints(this.data.k.k[r].s,this.data.p))return!1;r+=1}else if(!this.comparePoints(this.data.k.k,this.data.p))return!1;return!0},GradientProperty.prototype.getValue=function(r){if(this.prop.getValue(),this._mdf=!1,this._cmdf=!1,this._omdf=!1,this.prop._mdf||r){var e,t,i,s=4*this.data.p;for(e=0;e<s;e+=1)t=e%4==0?100:255,i=Math.round(this.prop.v[e]*t),this.c[e]!==i&&(this.c[e]=i,this._cmdf=!r);if(this.o.length)for(s=this.prop.v.length,e=4*this.data.p;e<s;e+=1)t=e%2==0?100:1,i=e%2==0?Math.round(100*this.prop.v[e]):this.prop.v[e],this.o[e-4*this.data.p]!==i&&(this.o[e-4*this.data.p]=i,this._omdf=!r);this._mdf=!r}},extendPrototype([DynamicPropertyContainer],GradientProperty),SVGGradientFillStyleData.prototype.initGradientData=function(r,e,t){this.o=PropertyFactory.getProp(r,e.o,0,.01,this),this.s=PropertyFactory.getProp(r,e.s,1,null,this),this.e=PropertyFactory.getProp(r,e.e,1,null,this),this.h=PropertyFactory.getProp(r,e.h||{k:0},0,.01,this),this.a=PropertyFactory.getProp(r,e.a||{k:0},0,degToRads,this),this.g=new GradientProperty(r,e.g,this),this.style=t,this.stops=[],this.setGradientData(t.pElem,e),this.setGradientOpacity(e,t),this._isAnimated=!!this._isAnimated},SVGGradientFillStyleData.prototype.setGradientData=function(r,e){var t=createElementID(),i=createNS(e.t===1?"linearGradient":"radialGradient");i.setAttribute("id",t),i.setAttribute("spreadMethod","pad"),i.setAttribute("gradientUnits","userSpaceOnUse");var s,n,a,o=[];for(a=4*e.g.p,n=0;n<a;n+=4)s=createNS("stop"),i.appendChild(s),o.push(s);r.setAttribute(e.ty==="gf"?"fill":"stroke","url("+getLocationHref()+"#"+t+")"),this.gf=i,this.cst=o},SVGGradientFillStyleData.prototype.setGradientOpacity=function(r,e){if(this.g._hasOpacity&&!this.g._collapsable){var t,i,s,n=createNS("mask"),a=createNS("path");n.appendChild(a);var o=createElementID(),c=createElementID();n.setAttribute("id",c);var u=createNS(r.t===1?"linearGradient":"radialGradient");u.setAttribute("id",o),u.setAttribute("spreadMethod","pad"),u.setAttribute("gradientUnits","userSpaceOnUse"),s=r.g.k.k[0].s?r.g.k.k[0].s.length:r.g.k.k.length;var f=this.stops;for(i=4*r.g.p;i<s;i+=2)(t=createNS("stop")).setAttribute("stop-color","rgb(255,255,255)"),u.appendChild(t),f.push(t);a.setAttribute(r.ty==="gf"?"fill":"stroke","url("+getLocationHref()+"#"+o+")"),r.ty==="gs"&&(a.setAttribute("stroke-linecap",lineCapEnum[r.lc||2]),a.setAttribute("stroke-linejoin",lineJoinEnum[r.lj||2]),r.lj===1&&a.setAttribute("stroke-miterlimit",r.ml)),this.of=u,this.ms=n,this.ost=f,this.maskId=c,e.msElem=a}},extendPrototype([DynamicPropertyContainer],SVGGradientFillStyleData),extendPrototype([SVGGradientFillStyleData,DynamicPropertyContainer],SVGGradientStrokeStyleData);var buildShapeString=function(r,e,t,i){if(e===0)return"";var s,n=r.o,a=r.i,o=r.v,c=" M"+i.applyToPointStringified(o[0][0],o[0][1]);for(s=1;s<e;s+=1)c+=" C"+i.applyToPointStringified(n[s-1][0],n[s-1][1])+" "+i.applyToPointStringified(a[s][0],a[s][1])+" "+i.applyToPointStringified(o[s][0],o[s][1]);return t&&e&&(c+=" C"+i.applyToPointStringified(n[s-1][0],n[s-1][1])+" "+i.applyToPointStringified(a[0][0],a[0][1])+" "+i.applyToPointStringified(o[0][0],o[0][1]),c+="z"),c},SVGElementsRenderer=(function(){var r=new Matrix,e=new Matrix;function t(u,f,d){(d||f.transform.op._mdf)&&f.transform.container.setAttribute("opacity",f.transform.op.v),(d||f.transform.mProps._mdf)&&f.transform.container.setAttribute("transform",f.transform.mProps.v.to2dCSS())}function i(){}function s(u,f,d){var g,E,m,T,S,b,C,I,L,k,U=f.styles.length,O=f.lvl;for(b=0;b<U;b+=1){if(T=f.sh._mdf||d,f.styles[b].lvl<O){for(I=e.reset(),L=O-f.styles[b].lvl,k=f.transformers.length-1;!T&&L>0;)T=f.transformers[k].mProps._mdf||T,L-=1,k-=1;if(T)for(L=O-f.styles[b].lvl,k=f.transformers.length-1;L>0;)I.multiply(f.transformers[k].mProps.v),L-=1,k-=1}else I=r;if(E=(C=f.sh.paths)._length,T){for(m="",g=0;g<E;g+=1)(S=C.shapes[g])&&S._length&&(m+=buildShapeString(S,S._length,S.c,I));f.caches[b]=m}else m=f.caches[b];f.styles[b].d+=u.hd===!0?"":m,f.styles[b]._mdf=T||f.styles[b]._mdf}}function n(u,f,d){var g=f.style;(f.c._mdf||d)&&g.pElem.setAttribute("fill","rgb("+bmFloor(f.c.v[0])+","+bmFloor(f.c.v[1])+","+bmFloor(f.c.v[2])+")"),(f.o._mdf||d)&&g.pElem.setAttribute("fill-opacity",f.o.v)}function a(u,f,d){o(u,f,d),c(u,f,d)}function o(u,f,d){var g,E,m,T,S,b=f.gf,C=f.g._hasOpacity,I=f.s.v,L=f.e.v;if(f.o._mdf||d){var k=u.ty==="gf"?"fill-opacity":"stroke-opacity";f.style.pElem.setAttribute(k,f.o.v)}if(f.s._mdf||d){var U=u.t===1?"x1":"cx",O=U==="x1"?"y1":"cy";b.setAttribute(U,I[0]),b.setAttribute(O,I[1]),C&&!f.g._collapsable&&(f.of.setAttribute(U,I[0]),f.of.setAttribute(O,I[1]))}if(f.g._cmdf||d){g=f.cst;var F=f.g.c;for(m=g.length,E=0;E<m;E+=1)(T=g[E]).setAttribute("offset",F[4*E]+"%"),T.setAttribute("stop-color","rgb("+F[4*E+1]+","+F[4*E+2]+","+F[4*E+3]+")")}if(C&&(f.g._omdf||d)){var G=f.g.o;for(m=(g=f.g._collapsable?f.cst:f.ost).length,E=0;E<m;E+=1)T=g[E],f.g._collapsable||T.setAttribute("offset",G[2*E]+"%"),T.setAttribute("stop-opacity",G[2*E+1])}if(u.t===1)(f.e._mdf||d)&&(b.setAttribute("x2",L[0]),b.setAttribute("y2",L[1]),C&&!f.g._collapsable&&(f.of.setAttribute("x2",L[0]),f.of.setAttribute("y2",L[1])));else if((f.s._mdf||f.e._mdf||d)&&(S=Math.sqrt(Math.pow(I[0]-L[0],2)+Math.pow(I[1]-L[1],2)),b.setAttribute("r",S),C&&!f.g._collapsable&&f.of.setAttribute("r",S)),f.e._mdf||f.h._mdf||f.a._mdf||d){S||(S=Math.sqrt(Math.pow(I[0]-L[0],2)+Math.pow(I[1]-L[1],2)));var x=Math.atan2(L[1]-I[1],L[0]-I[0]),$=f.h.v;$>=1?$=.99:$<=-1&&($=-.99);var X=S*$,Q=Math.cos(x+f.a.v)*X+I[0],ee=Math.sin(x+f.a.v)*X+I[1];b.setAttribute("fx",Q),b.setAttribute("fy",ee),C&&!f.g._collapsable&&(f.of.setAttribute("fx",Q),f.of.setAttribute("fy",ee))}}function c(u,f,d){var g=f.style,E=f.d;E&&(E._mdf||d)&&E.dashStr&&(g.pElem.setAttribute("stroke-dasharray",E.dashStr),g.pElem.setAttribute("stroke-dashoffset",E.dashoffset[0])),f.c&&(f.c._mdf||d)&&g.pElem.setAttribute("stroke","rgb("+bmFloor(f.c.v[0])+","+bmFloor(f.c.v[1])+","+bmFloor(f.c.v[2])+")"),(f.o._mdf||d)&&g.pElem.setAttribute("stroke-opacity",f.o.v),(f.w._mdf||d)&&(g.pElem.setAttribute("stroke-width",f.w.v),g.msElem&&g.msElem.setAttribute("stroke-width",f.w.v))}return{createRenderFunction:function(u){switch(u.ty){case"fl":return n;case"gf":return o;case"gs":return a;case"st":return c;case"sh":case"el":case"rc":case"sr":return s;case"tr":return t;case"no":return i;default:return null}}}})();function SVGShapeElement(r,e,t){this.shapes=[],this.shapesData=r.shapes,this.stylesList=[],this.shapeModifiers=[],this.itemsData=[],this.processedElements=[],this.animatedContents=[],this.initElement(r,e,t),this.prevViewData=[]}function LetterProps(r,e,t,i,s,n){this.o=r,this.sw=e,this.sc=t,this.fc=i,this.m=s,this.p=n,this._mdf={o:!0,sw:!!e,sc:!!t,fc:!!i,m:!0,p:!0}}function TextProperty(r,e){this._frameId=initialDefaultFrame,this.pv="",this.v="",this.kf=!1,this._isFirstFrame=!0,this._mdf=!1,e.d&&e.d.sid&&(e.d=r.globalData.slotManager.getProp(e.d)),this.data=e,this.elem=r,this.comp=this.elem.comp,this.keysIndex=0,this.canResize=!1,this.minimumFontSize=1,this.effectsSequence=[],this.currentData={ascent:0,boxWidth:this.defaultBoxWidth,f:"",fStyle:"",fWeight:"",fc:"",j:"",justifyOffset:"",l:[],lh:0,lineWidths:[],ls:"",of:"",s:"",sc:"",sw:0,t:0,tr:0,sz:0,ps:null,fillColorAnim:!1,strokeColorAnim:!1,strokeWidthAnim:!1,yOffset:0,finalSize:0,finalText:[],finalLineHeight:0,__complete:!1},this.copyData(this.currentData,this.data.d.k[0].s),this.searchProperty()||this.completeTextData(this.currentData)}extendPrototype([BaseElement,TransformElement,SVGBaseElement,IShapeElement,HierarchyElement,FrameElement,RenderableDOMElement],SVGShapeElement),SVGShapeElement.prototype.initSecondaryElement=function(){},SVGShapeElement.prototype.identityMatrix=new Matrix,SVGShapeElement.prototype.buildExpressionInterface=function(){},SVGShapeElement.prototype.createContent=function(){this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.layerElement,0,[],!0),this.filterUniqueShapes()},SVGShapeElement.prototype.filterUniqueShapes=function(){var r,e,t,i,s=this.shapes.length,n=this.stylesList.length,a=[],o=!1;for(t=0;t<n;t+=1){for(i=this.stylesList[t],o=!1,a.length=0,r=0;r<s;r+=1)(e=this.shapes[r]).styles.indexOf(i)!==-1&&(a.push(e),o=e._isAnimated||o);a.length>1&&o&&this.setShapesAsAnimated(a)}},SVGShapeElement.prototype.setShapesAsAnimated=function(r){var e,t=r.length;for(e=0;e<t;e+=1)r[e].setAsAnimated()},SVGShapeElement.prototype.createStyleElement=function(r,e){var t,i=new SVGStyleData(r,e),s=i.pElem;return r.ty==="st"?t=new SVGStrokeStyleData(this,r,i):r.ty==="fl"?t=new SVGFillStyleData(this,r,i):r.ty==="gf"||r.ty==="gs"?(t=new(r.ty==="gf"?SVGGradientFillStyleData:SVGGradientStrokeStyleData)(this,r,i),this.globalData.defs.appendChild(t.gf),t.maskId&&(this.globalData.defs.appendChild(t.ms),this.globalData.defs.appendChild(t.of),s.setAttribute("mask","url("+getLocationHref()+"#"+t.maskId+")"))):r.ty==="no"&&(t=new SVGNoStyleData(this,r,i)),r.ty!=="st"&&r.ty!=="gs"||(s.setAttribute("stroke-linecap",lineCapEnum[r.lc||2]),s.setAttribute("stroke-linejoin",lineJoinEnum[r.lj||2]),s.setAttribute("fill-opacity","0"),r.lj===1&&s.setAttribute("stroke-miterlimit",r.ml)),r.r===2&&s.setAttribute("fill-rule","evenodd"),r.ln&&s.setAttribute("id",r.ln),r.cl&&s.setAttribute("class",r.cl),r.bm&&(s.style["mix-blend-mode"]=getBlendMode(r.bm)),this.stylesList.push(i),this.addToAnimatedContents(r,t),t},SVGShapeElement.prototype.createGroupElement=function(r){var e=new ShapeGroupData;return r.ln&&e.gr.setAttribute("id",r.ln),r.cl&&e.gr.setAttribute("class",r.cl),r.bm&&(e.gr.style["mix-blend-mode"]=getBlendMode(r.bm)),e},SVGShapeElement.prototype.createTransformElement=function(r,e){var t=TransformPropertyFactory.getTransformProperty(this,r,this),i=new SVGTransformData(t,t.o,e);return this.addToAnimatedContents(r,i),i},SVGShapeElement.prototype.createShapeElement=function(r,e,t){var i=4;r.ty==="rc"?i=5:r.ty==="el"?i=6:r.ty==="sr"&&(i=7);var s=new SVGShapeData(e,t,ShapePropertyFactory.getShapeProp(this,r,i,this));return this.shapes.push(s),this.addShapeToModifiers(s),this.addToAnimatedContents(r,s),s},SVGShapeElement.prototype.addToAnimatedContents=function(r,e){for(var t=0,i=this.animatedContents.length;t<i;){if(this.animatedContents[t].element===e)return;t+=1}this.animatedContents.push({fn:SVGElementsRenderer.createRenderFunction(r),element:e,data:r})},SVGShapeElement.prototype.setElementStyles=function(r){var e,t=r.styles,i=this.stylesList.length;for(e=0;e<i;e+=1)this.stylesList[e].closed||t.push(this.stylesList[e])},SVGShapeElement.prototype.reloadShapes=function(){var r;this._isFirstFrame=!0;var e=this.itemsData.length;for(r=0;r<e;r+=1)this.prevViewData[r]=this.itemsData[r];for(this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.layerElement,0,[],!0),this.filterUniqueShapes(),e=this.dynamicProperties.length,r=0;r<e;r+=1)this.dynamicProperties[r].getValue();this.renderModifiers()},SVGShapeElement.prototype.searchShapes=function(r,e,t,i,s,n,a){var o,c,u,f,d,g,E=[].concat(n),m=r.length-1,T=[],S=[];for(o=m;o>=0;o-=1){if((g=this.searchProcessedElement(r[o]))?e[o]=t[g-1]:r[o]._render=a,r[o].ty==="fl"||r[o].ty==="st"||r[o].ty==="gf"||r[o].ty==="gs"||r[o].ty==="no")g?e[o].style.closed=!1:e[o]=this.createStyleElement(r[o],s),r[o]._render&&e[o].style.pElem.parentNode!==i&&i.appendChild(e[o].style.pElem),T.push(e[o].style);else if(r[o].ty==="gr"){if(g)for(u=e[o].it.length,c=0;c<u;c+=1)e[o].prevViewData[c]=e[o].it[c];else e[o]=this.createGroupElement(r[o]);this.searchShapes(r[o].it,e[o].it,e[o].prevViewData,e[o].gr,s+1,E,a),r[o]._render&&e[o].gr.parentNode!==i&&i.appendChild(e[o].gr)}else r[o].ty==="tr"?(g||(e[o]=this.createTransformElement(r[o],i)),f=e[o].transform,E.push(f)):r[o].ty==="sh"||r[o].ty==="rc"||r[o].ty==="el"||r[o].ty==="sr"?(g||(e[o]=this.createShapeElement(r[o],E,s)),this.setElementStyles(e[o])):r[o].ty==="tm"||r[o].ty==="rd"||r[o].ty==="ms"||r[o].ty==="pb"||r[o].ty==="zz"||r[o].ty==="op"?(g?(d=e[o]).closed=!1:((d=ShapeModifiers.getModifier(r[o].ty)).init(this,r[o]),e[o]=d,this.shapeModifiers.push(d)),S.push(d)):r[o].ty==="rp"&&(g?(d=e[o]).closed=!0:(d=ShapeModifiers.getModifier(r[o].ty),e[o]=d,d.init(this,r,o,e),this.shapeModifiers.push(d),a=!1),S.push(d));this.addProcessedElement(r[o],o+1)}for(m=T.length,o=0;o<m;o+=1)T[o].closed=!0;for(m=S.length,o=0;o<m;o+=1)S[o].closed=!0},SVGShapeElement.prototype.renderInnerContent=function(){var r;this.renderModifiers();var e=this.stylesList.length;for(r=0;r<e;r+=1)this.stylesList[r].reset();for(this.renderShape(),r=0;r<e;r+=1)(this.stylesList[r]._mdf||this._isFirstFrame)&&(this.stylesList[r].msElem&&(this.stylesList[r].msElem.setAttribute("d",this.stylesList[r].d),this.stylesList[r].d="M0 0"+this.stylesList[r].d),this.stylesList[r].pElem.setAttribute("d",this.stylesList[r].d||"M0 0"))},SVGShapeElement.prototype.renderShape=function(){var r,e,t=this.animatedContents.length;for(r=0;r<t;r+=1)e=this.animatedContents[r],(this._isFirstFrame||e.element._isAnimated)&&e.data!==!0&&e.fn(e.data,e.element,this._isFirstFrame)},SVGShapeElement.prototype.destroy=function(){this.destroyBaseElement(),this.shapesData=null,this.itemsData=null},LetterProps.prototype.update=function(r,e,t,i,s,n){this._mdf.o=!1,this._mdf.sw=!1,this._mdf.sc=!1,this._mdf.fc=!1,this._mdf.m=!1,this._mdf.p=!1;var a=!1;return this.o!==r&&(this.o=r,this._mdf.o=!0,a=!0),this.sw!==e&&(this.sw=e,this._mdf.sw=!0,a=!0),this.sc!==t&&(this.sc=t,this._mdf.sc=!0,a=!0),this.fc!==i&&(this.fc=i,this._mdf.fc=!0,a=!0),this.m!==s&&(this.m=s,this._mdf.m=!0,a=!0),!n.length||this.p[0]===n[0]&&this.p[1]===n[1]&&this.p[4]===n[4]&&this.p[5]===n[5]&&this.p[12]===n[12]&&this.p[13]===n[13]||(this.p=n,this._mdf.p=!0,a=!0),a},TextProperty.prototype.defaultBoxWidth=[0,0],TextProperty.prototype.copyData=function(r,e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r},TextProperty.prototype.setCurrentData=function(r){r.__complete||this.completeTextData(r),this.currentData=r,this.currentData.boxWidth=this.currentData.boxWidth||this.defaultBoxWidth,this._mdf=!0},TextProperty.prototype.searchProperty=function(){return this.searchKeyframes()},TextProperty.prototype.searchKeyframes=function(){return this.kf=this.data.d.k.length>1,this.kf&&this.addEffect(this.getKeyframeValue.bind(this)),this.kf},TextProperty.prototype.addEffect=function(r){this.effectsSequence.push(r),this.elem.addDynamicProperty(this)},TextProperty.prototype.getValue=function(r){if(this.elem.globalData.frameId!==this.frameId&&this.effectsSequence.length||r){this.currentData.t=this.data.d.k[this.keysIndex].s.t;var e=this.currentData,t=this.keysIndex;if(this.lock)this.setCurrentData(this.currentData);else{var i;this.lock=!0,this._mdf=!1;var s=this.effectsSequence.length,n=r||this.data.d.k[this.keysIndex].s;for(i=0;i<s;i+=1)n=t!==this.keysIndex?this.effectsSequence[i](n,n.t):this.effectsSequence[i](this.currentData,n.t);e!==n&&this.setCurrentData(n),this.v=this.currentData,this.pv=this.v,this.lock=!1,this.frameId=this.elem.globalData.frameId}}},TextProperty.prototype.getKeyframeValue=function(){for(var r=this.data.d.k,e=this.elem.comp.renderedFrame,t=0,i=r.length;t<=i-1&&!(t===i-1||r[t+1].t>e);)t+=1;return this.keysIndex!==t&&(this.keysIndex=t),this.data.d.k[this.keysIndex].s},TextProperty.prototype.buildFinalText=function(r){for(var e,t,i=[],s=0,n=r.length,a=!1,o=!1,c="";s<n;)a=o,o=!1,e=r.charCodeAt(s),c=r.charAt(s),FontManager.isCombinedCharacter(e)?a=!0:e>=55296&&e<=56319?FontManager.isRegionalFlag(r,s)?c=r.substr(s,14):(t=r.charCodeAt(s+1))>=56320&&t<=57343&&(FontManager.isModifier(e,t)?(c=r.substr(s,2),a=!0):c=FontManager.isFlagEmoji(r.substr(s,4))?r.substr(s,4):r.substr(s,2)):e>56319?(t=r.charCodeAt(s+1),FontManager.isVariationSelector(e)&&(a=!0)):FontManager.isZeroWidthJoiner(e)&&(a=!0,o=!0),a?(i[i.length-1]+=c,a=!1):i.push(c),s+=c.length;return i},TextProperty.prototype.completeTextData=function(r){r.__complete=!0;var e,t,i,s,n,a,o,c=this.elem.globalData.fontManager,u=this.data,f=[],d=0,g=u.m.g,E=0,m=0,T=0,S=[],b=0,C=0,I=c.getFontByName(r.f),L=0,k=getFontProperties(I);r.fWeight=k.weight,r.fStyle=k.style,r.finalSize=r.s,r.finalText=this.buildFinalText(r.t),t=r.finalText.length,r.finalLineHeight=r.lh;var U,O=r.tr/1e3*r.finalSize;if(r.sz)for(var F,G,x=!0,$=r.sz[0],X=r.sz[1];x;){F=0,b=0,t=(G=this.buildFinalText(r.t)).length,O=r.tr/1e3*r.finalSize;var Q=-1;for(e=0;e<t;e+=1)U=G[e].charCodeAt(0),i=!1,G[e]===" "?Q=e:U!==13&&U!==3||(b=0,i=!0,F+=r.finalLineHeight||1.2*r.finalSize),c.chars?(o=c.getCharData(G[e],I.fStyle,I.fFamily),L=i?0:o.w*r.finalSize/100):L=c.measureText(G[e],r.f,r.finalSize),b+L>$&&G[e]!==" "?(Q===-1?t+=1:e=Q,F+=r.finalLineHeight||1.2*r.finalSize,G.splice(e,Q===e?1:0,"\r"),Q=-1,b=0):(b+=L,b+=O);F+=I.ascent*r.finalSize/100,this.canResize&&r.finalSize>this.minimumFontSize&&X<F?(r.finalSize-=1,r.finalLineHeight=r.finalSize*r.lh/r.s):(r.finalText=G,t=r.finalText.length,x=!1)}b=-O,L=0;var ee,te=0;for(e=0;e<t;e+=1)if(i=!1,(U=(ee=r.finalText[e]).charCodeAt(0))===13||U===3?(te=0,S.push(b),C=b>C?b:C,b=-2*O,s="",i=!0,T+=1):s=ee,c.chars?(o=c.getCharData(ee,I.fStyle,c.getFontByName(r.f).fFamily),L=i?0:o.w*r.finalSize/100):L=c.measureText(s,r.f,r.finalSize),ee===" "?te+=L+O:(b+=L+O+te,te=0),f.push({l:L,an:L,add:E,n:i,anIndexes:[],val:s,line:T,animatorJustifyOffset:0}),g==2){if(E+=L,s===""||s===" "||e===t-1){for(s!==""&&s!==" "||(E-=L);m<=e;)f[m].an=E,f[m].ind=d,f[m].extra=L,m+=1;d+=1,E=0}}else if(g==3){if(E+=L,s===""||e===t-1){for(s===""&&(E-=L);m<=e;)f[m].an=E,f[m].ind=d,f[m].extra=L,m+=1;E=0,d+=1}}else f[d].ind=d,f[d].extra=0,d+=1;if(r.l=f,C=b>C?b:C,S.push(b),r.sz)r.boxWidth=r.sz[0],r.justifyOffset=0;else switch(r.boxWidth=C,r.j){case 1:r.justifyOffset=-r.boxWidth;break;case 2:r.justifyOffset=-r.boxWidth/2;break;default:r.justifyOffset=0}r.lineWidths=S;var re,me,H,z,ie=u.a;a=ie.length;var ne=[];for(n=0;n<a;n+=1){for((re=ie[n]).a.sc&&(r.strokeColorAnim=!0),re.a.sw&&(r.strokeWidthAnim=!0),(re.a.fc||re.a.fh||re.a.fs||re.a.fb)&&(r.fillColorAnim=!0),z=0,H=re.s.b,e=0;e<t;e+=1)(me=f[e]).anIndexes[n]=z,(H==1&&me.val!==""||H==2&&me.val!==""&&me.val!==" "||H==3&&(me.n||me.val==" "||e==t-1)||H==4&&(me.n||e==t-1))&&(re.s.rn===1&&ne.push(z),z+=1);u.a[n].s.totalChars=z;var he,pe=-1;if(re.s.rn===1)for(e=0;e<t;e+=1)pe!=(me=f[e]).anIndexes[n]&&(pe=me.anIndexes[n],he=ne.splice(Math.floor(Math.random()*ne.length),1)[0]),me.anIndexes[n]=he}r.yOffset=r.finalLineHeight||1.2*r.finalSize,r.ls=r.ls||0,r.ascent=I.ascent*r.finalSize/100},TextProperty.prototype.updateDocumentData=function(r,e){e=e===void 0?this.keysIndex:e;var t=this.copyData({},this.data.d.k[e].s);t=this.copyData(t,r),this.data.d.k[e].s=t,this.recalculate(e),this.setCurrentData(t),this.elem.addDynamicProperty(this)},TextProperty.prototype.recalculate=function(r){var e=this.data.d.k[r].s;e.__complete=!1,this.keysIndex=0,this._isFirstFrame=!0,this.getValue(e)},TextProperty.prototype.canResizeFont=function(r){this.canResize=r,this.recalculate(this.keysIndex),this.elem.addDynamicProperty(this)},TextProperty.prototype.setMinimumFontSize=function(r){this.minimumFontSize=Math.floor(r)||1,this.recalculate(this.keysIndex),this.elem.addDynamicProperty(this)};var TextSelectorProp=(function(){var r=Math.max,e=Math.min,t=Math.floor;function i(s,n){this._currentTextLength=-1,this.k=!1,this.data=n,this.elem=s,this.comp=s.comp,this.finalS=0,this.finalE=0,this.initDynamicPropertyContainer(s),this.s=PropertyFactory.getProp(s,n.s||{k:0},0,0,this),this.e="e"in n?PropertyFactory.getProp(s,n.e,0,0,this):{v:100},this.o=PropertyFactory.getProp(s,n.o||{k:0},0,0,this),this.xe=PropertyFactory.getProp(s,n.xe||{k:0},0,0,this),this.ne=PropertyFactory.getProp(s,n.ne||{k:0},0,0,this),this.sm=PropertyFactory.getProp(s,n.sm||{k:100},0,0,this),this.a=PropertyFactory.getProp(s,n.a,0,.01,this),this.dynamicProperties.length||this.getValue()}return i.prototype={getMult:function(s){this._currentTextLength!==this.elem.textProperty.currentData.l.length&&this.getValue();var n=0,a=0,o=1,c=1;this.ne.v>0?n=this.ne.v/100:a=-this.ne.v/100,this.xe.v>0?o=1-this.xe.v/100:c=1+this.xe.v/100;var u=BezierFactory.getBezierEasing(n,a,o,c).get,f=0,d=this.finalS,g=this.finalE,E=this.data.sh;if(E===2)f=u(f=g===d?s>=g?1:0:r(0,e(.5/(g-d)+(s-d)/(g-d),1)));else if(E===3)f=u(f=g===d?s>=g?0:1:1-r(0,e(.5/(g-d)+(s-d)/(g-d),1)));else if(E===4)g===d?f=0:(f=r(0,e(.5/(g-d)+(s-d)/(g-d),1)))<.5?f*=2:f=1-2*(f-.5),f=u(f);else if(E===5){if(g===d)f=0;else{var m=g-d,T=-m/2+(s=e(r(0,s+.5-d),g-d)),S=m/2;f=Math.sqrt(1-T*T/(S*S))}f=u(f)}else E===6?(g===d?f=0:(s=e(r(0,s+.5-d),g-d),f=(1+Math.cos(Math.PI+2*Math.PI*s/(g-d)))/2),f=u(f)):(s>=t(d)&&(f=r(0,e(s-d<0?e(g,1)-(d-s):g-s,1))),f=u(f));if(this.sm.v!==100){var b=.01*this.sm.v;b===0&&(b=1e-8);var C=.5-.5*b;f<C?f=0:(f=(f-C)/b)>1&&(f=1)}return f*this.a.v},getValue:function(s){this.iterateDynamicProperties(),this._mdf=s||this._mdf,this._currentTextLength=this.elem.textProperty.currentData.l.length||0,s&&this.data.r===2&&(this.e.v=this._currentTextLength);var n=this.data.r===2?1:100/this.data.totalChars,a=this.o.v/n,o=this.s.v/n+a,c=this.e.v/n+a;if(o>c){var u=o;o=c,c=u}this.finalS=o,this.finalE=c}},extendPrototype([DynamicPropertyContainer],i),{getTextSelectorProp:function(s,n,a){return new i(s,n)}}})();function TextAnimatorDataProperty(r,e,t){var i={propType:!1},s=PropertyFactory.getProp,n=e.a;this.a={r:n.r?s(r,n.r,0,degToRads,t):i,rx:n.rx?s(r,n.rx,0,degToRads,t):i,ry:n.ry?s(r,n.ry,0,degToRads,t):i,sk:n.sk?s(r,n.sk,0,degToRads,t):i,sa:n.sa?s(r,n.sa,0,degToRads,t):i,s:n.s?s(r,n.s,1,.01,t):i,a:n.a?s(r,n.a,1,0,t):i,o:n.o?s(r,n.o,0,.01,t):i,p:n.p?s(r,n.p,1,0,t):i,sw:n.sw?s(r,n.sw,0,0,t):i,sc:n.sc?s(r,n.sc,1,0,t):i,fc:n.fc?s(r,n.fc,1,0,t):i,fh:n.fh?s(r,n.fh,0,0,t):i,fs:n.fs?s(r,n.fs,0,.01,t):i,fb:n.fb?s(r,n.fb,0,.01,t):i,t:n.t?s(r,n.t,0,0,t):i},this.s=TextSelectorProp.getTextSelectorProp(r,e.s,t),this.s.t=e.s.t}function TextAnimatorProperty(r,e,t){this._isFirstFrame=!0,this._hasMaskedPath=!1,this._frameId=-1,this._textData=r,this._renderType=e,this._elem=t,this._animatorsData=createSizedArray(this._textData.a.length),this._pathData={},this._moreOptions={alignment:{}},this.renderedLetters=[],this.lettersChangedFlag=!1,this.initDynamicPropertyContainer(t)}function ITextElement(){}TextAnimatorProperty.prototype.searchProperties=function(){var r,e,t=this._textData.a.length,i=PropertyFactory.getProp;for(r=0;r<t;r+=1)e=this._textData.a[r],this._animatorsData[r]=new TextAnimatorDataProperty(this._elem,e,this);this._textData.p&&"m"in this._textData.p?(this._pathData={a:i(this._elem,this._textData.p.a,0,0,this),f:i(this._elem,this._textData.p.f,0,0,this),l:i(this._elem,this._textData.p.l,0,0,this),r:i(this._elem,this._textData.p.r,0,0,this),p:i(this._elem,this._textData.p.p,0,0,this),m:this._elem.maskManager.getMaskProperty(this._textData.p.m)},this._hasMaskedPath=!0):this._hasMaskedPath=!1,this._moreOptions.alignment=i(this._elem,this._textData.m.a,1,0,this)},TextAnimatorProperty.prototype.getMeasures=function(r,e){if(this.lettersChangedFlag=e,this._mdf||this._isFirstFrame||e||this._hasMaskedPath&&this._pathData.m._mdf){this._isFirstFrame=!1;var t,i,s,n,a,o,c,u,f,d,g,E,m,T,S,b,C,I,L,k=this._moreOptions.alignment.v,U=this._animatorsData,O=this._textData,F=this.mHelper,G=this._renderType,x=this.renderedLetters.length,$=r.l;if(this._hasMaskedPath){if(L=this._pathData.m,!this._pathData.n||this._pathData._mdf){var X,Q=L.v;for(this._pathData.r.v&&(Q=Q.reverse()),a={tLength:0,segments:[]},n=Q._length-1,b=0,s=0;s<n;s+=1)X=bez.buildBezierData(Q.v[s],Q.v[s+1],[Q.o[s][0]-Q.v[s][0],Q.o[s][1]-Q.v[s][1]],[Q.i[s+1][0]-Q.v[s+1][0],Q.i[s+1][1]-Q.v[s+1][1]]),a.tLength+=X.segmentLength,a.segments.push(X),b+=X.segmentLength;s=n,L.v.c&&(X=bez.buildBezierData(Q.v[s],Q.v[0],[Q.o[s][0]-Q.v[s][0],Q.o[s][1]-Q.v[s][1]],[Q.i[0][0]-Q.v[0][0],Q.i[0][1]-Q.v[0][1]]),a.tLength+=X.segmentLength,a.segments.push(X),b+=X.segmentLength),this._pathData.pi=a}if(a=this._pathData.pi,o=this._pathData.f.v,g=0,d=1,u=0,f=!0,T=a.segments,o<0&&L.v.c)for(a.tLength<Math.abs(o)&&(o=-Math.abs(o)%a.tLength),d=(m=T[g=T.length-1].points).length-1;o<0;)o+=m[d].partialLength,(d-=1)<0&&(d=(m=T[g-=1].points).length-1);E=(m=T[g].points)[d-1],S=(c=m[d]).partialLength}n=$.length,t=0,i=0;var ee,te,re,me,H,z=1.2*r.finalSize*.714,ie=!0;re=U.length;var ne,he,pe,Pe,ae,Ae,Re,Le,Y,q,le,ce,Ee=-1,ve=o,Be=g,Ie=d,Me=-1,Ve="",dt=this.defaultPropsArray;if(r.j===2||r.j===1){var Qe=0,ze=0,Je=r.j===2?-.5:-1,gt=0,yt=!0;for(s=0;s<n;s+=1)if($[s].n){for(Qe&&(Qe+=ze);gt<s;)$[gt].animatorJustifyOffset=Qe,gt+=1;Qe=0,yt=!0}else{for(te=0;te<re;te+=1)(ee=U[te].a).t.propType&&(yt&&r.j===2&&(ze+=ee.t.v*Je),(H=U[te].s.getMult($[s].anIndexes[te],O.a[te].s.totalChars)).length?Qe+=ee.t.v*H[0]*Je:Qe+=ee.t.v*H*Je);yt=!1}for(Qe&&(Qe+=ze);gt<s;)$[gt].animatorJustifyOffset=Qe,gt+=1}for(s=0;s<n;s+=1){if(F.reset(),Pe=1,$[s].n)t=0,i+=r.yOffset,i+=ie?1:0,o=ve,ie=!1,this._hasMaskedPath&&(d=Ie,E=(m=T[g=Be].points)[d-1],S=(c=m[d]).partialLength,u=0),Ve="",le="",Y="",ce="",dt=this.defaultPropsArray;else{if(this._hasMaskedPath){if(Me!==$[s].line){switch(r.j){case 1:o+=b-r.lineWidths[$[s].line];break;case 2:o+=(b-r.lineWidths[$[s].line])/2}Me=$[s].line}Ee!==$[s].ind&&($[Ee]&&(o+=$[Ee].extra),o+=$[s].an/2,Ee=$[s].ind),o+=k[0]*$[s].an*.005;var _t=0;for(te=0;te<re;te+=1)(ee=U[te].a).p.propType&&((H=U[te].s.getMult($[s].anIndexes[te],O.a[te].s.totalChars)).length?_t+=ee.p.v[0]*H[0]:_t+=ee.p.v[0]*H),ee.a.propType&&((H=U[te].s.getMult($[s].anIndexes[te],O.a[te].s.totalChars)).length?_t+=ee.a.v[0]*H[0]:_t+=ee.a.v[0]*H);for(f=!0,this._pathData.a.v&&(o=.5*$[0].an+(b-this._pathData.f.v-.5*$[0].an-.5*$[$.length-1].an)*Ee/(n-1),o+=this._pathData.f.v);f;)u+S>=o+_t||!m?(C=(o+_t-u)/c.partialLength,he=E.point[0]+(c.point[0]-E.point[0])*C,pe=E.point[1]+(c.point[1]-E.point[1])*C,F.translate(-k[0]*$[s].an*.005,-k[1]*z*.01),f=!1):m&&(u+=c.partialLength,(d+=1)>=m.length&&(d=0,T[g+=1]?m=T[g].points:L.v.c?(d=0,m=T[g=0].points):(u-=c.partialLength,m=null)),m&&(E=c,S=(c=m[d]).partialLength));ne=$[s].an/2-$[s].add,F.translate(-ne,0,0)}else ne=$[s].an/2-$[s].add,F.translate(-ne,0,0),F.translate(-k[0]*$[s].an*.005,-k[1]*z*.01,0);for(te=0;te<re;te+=1)(ee=U[te].a).t.propType&&(H=U[te].s.getMult($[s].anIndexes[te],O.a[te].s.totalChars),t===0&&r.j===0||(this._hasMaskedPath?H.length?o+=ee.t.v*H[0]:o+=ee.t.v*H:H.length?t+=ee.t.v*H[0]:t+=ee.t.v*H));for(r.strokeWidthAnim&&(Ae=r.sw||0),r.strokeColorAnim&&(ae=r.sc?[r.sc[0],r.sc[1],r.sc[2]]:[0,0,0]),r.fillColorAnim&&r.fc&&(Re=[r.fc[0],r.fc[1],r.fc[2]]),te=0;te<re;te+=1)(ee=U[te].a).a.propType&&((H=U[te].s.getMult($[s].anIndexes[te],O.a[te].s.totalChars)).length?F.translate(-ee.a.v[0]*H[0],-ee.a.v[1]*H[1],ee.a.v[2]*H[2]):F.translate(-ee.a.v[0]*H,-ee.a.v[1]*H,ee.a.v[2]*H));for(te=0;te<re;te+=1)(ee=U[te].a).s.propType&&((H=U[te].s.getMult($[s].anIndexes[te],O.a[te].s.totalChars)).length?F.scale(1+(ee.s.v[0]-1)*H[0],1+(ee.s.v[1]-1)*H[1],1):F.scale(1+(ee.s.v[0]-1)*H,1+(ee.s.v[1]-1)*H,1));for(te=0;te<re;te+=1){if(ee=U[te].a,H=U[te].s.getMult($[s].anIndexes[te],O.a[te].s.totalChars),ee.sk.propType&&(H.length?F.skewFromAxis(-ee.sk.v*H[0],ee.sa.v*H[1]):F.skewFromAxis(-ee.sk.v*H,ee.sa.v*H)),ee.r.propType&&(H.length?F.rotateZ(-ee.r.v*H[2]):F.rotateZ(-ee.r.v*H)),ee.ry.propType&&(H.length?F.rotateY(ee.ry.v*H[1]):F.rotateY(ee.ry.v*H)),ee.rx.propType&&(H.length?F.rotateX(ee.rx.v*H[0]):F.rotateX(ee.rx.v*H)),ee.o.propType&&(H.length?Pe+=(ee.o.v*H[0]-Pe)*H[0]:Pe+=(ee.o.v*H-Pe)*H),r.strokeWidthAnim&&ee.sw.propType&&(H.length?Ae+=ee.sw.v*H[0]:Ae+=ee.sw.v*H),r.strokeColorAnim&&ee.sc.propType)for(Le=0;Le<3;Le+=1)H.length?ae[Le]+=(ee.sc.v[Le]-ae[Le])*H[0]:ae[Le]+=(ee.sc.v[Le]-ae[Le])*H;if(r.fillColorAnim&&r.fc){if(ee.fc.propType)for(Le=0;Le<3;Le+=1)H.length?Re[Le]+=(ee.fc.v[Le]-Re[Le])*H[0]:Re[Le]+=(ee.fc.v[Le]-Re[Le])*H;ee.fh.propType&&(Re=H.length?addHueToRGB(Re,ee.fh.v*H[0]):addHueToRGB(Re,ee.fh.v*H)),ee.fs.propType&&(Re=H.length?addSaturationToRGB(Re,ee.fs.v*H[0]):addSaturationToRGB(Re,ee.fs.v*H)),ee.fb.propType&&(Re=H.length?addBrightnessToRGB(Re,ee.fb.v*H[0]):addBrightnessToRGB(Re,ee.fb.v*H))}}for(te=0;te<re;te+=1)(ee=U[te].a).p.propType&&(H=U[te].s.getMult($[s].anIndexes[te],O.a[te].s.totalChars),this._hasMaskedPath?H.length?F.translate(0,ee.p.v[1]*H[0],-ee.p.v[2]*H[1]):F.translate(0,ee.p.v[1]*H,-ee.p.v[2]*H):H.length?F.translate(ee.p.v[0]*H[0],ee.p.v[1]*H[1],-ee.p.v[2]*H[2]):F.translate(ee.p.v[0]*H,ee.p.v[1]*H,-ee.p.v[2]*H));if(r.strokeWidthAnim&&(Y=Ae<0?0:Ae),r.strokeColorAnim&&(q="rgb("+Math.round(255*ae[0])+","+Math.round(255*ae[1])+","+Math.round(255*ae[2])+")"),r.fillColorAnim&&r.fc&&(le="rgb("+Math.round(255*Re[0])+","+Math.round(255*Re[1])+","+Math.round(255*Re[2])+")"),this._hasMaskedPath){if(F.translate(0,-r.ls),F.translate(0,k[1]*z*.01+i,0),this._pathData.p.v){I=(c.point[1]-E.point[1])/(c.point[0]-E.point[0]);var qe=180*Math.atan(I)/Math.PI;c.point[0]<E.point[0]&&(qe+=180),F.rotate(-qe*Math.PI/180)}F.translate(he,pe,0),o-=k[0]*$[s].an*.005,$[s+1]&&Ee!==$[s+1].ind&&(o+=$[s].an/2,o+=.001*r.tr*r.finalSize)}else{switch(F.translate(t,i,0),r.ps&&F.translate(r.ps[0],r.ps[1]+r.ascent,0),r.j){case 1:F.translate($[s].animatorJustifyOffset+r.justifyOffset+(r.boxWidth-r.lineWidths[$[s].line]),0,0);break;case 2:F.translate($[s].animatorJustifyOffset+r.justifyOffset+(r.boxWidth-r.lineWidths[$[s].line])/2,0,0)}F.translate(0,-r.ls),F.translate(ne,0,0),F.translate(k[0]*$[s].an*.005,k[1]*z*.01,0),t+=$[s].l+.001*r.tr*r.finalSize}G==="html"?Ve=F.toCSS():G==="svg"?Ve=F.to2dCSS():dt=[F.props[0],F.props[1],F.props[2],F.props[3],F.props[4],F.props[5],F.props[6],F.props[7],F.props[8],F.props[9],F.props[10],F.props[11],F.props[12],F.props[13],F.props[14],F.props[15]],ce=Pe}x<=s?(me=new LetterProps(ce,Y,q,le,Ve,dt),this.renderedLetters.push(me),x+=1,this.lettersChangedFlag=!0):(me=this.renderedLetters[s],this.lettersChangedFlag=me.update(ce,Y,q,le,Ve,dt)||this.lettersChangedFlag)}}},TextAnimatorProperty.prototype.getValue=function(){this._elem.globalData.frameId!==this._frameId&&(this._frameId=this._elem.globalData.frameId,this.iterateDynamicProperties())},TextAnimatorProperty.prototype.mHelper=new Matrix,TextAnimatorProperty.prototype.defaultPropsArray=[],extendPrototype([DynamicPropertyContainer],TextAnimatorProperty),ITextElement.prototype.initElement=function(r,e,t){this.lettersChangedFlag=!0,this.initFrame(),this.initBaseData(r,e,t),this.textProperty=new TextProperty(this,r.t,this.dynamicProperties),this.textAnimator=new TextAnimatorProperty(r.t,this.renderType,this),this.initTransform(r,e,t),this.initHierarchy(),this.initRenderable(),this.initRendererElement(),this.createContainerElements(),this.createRenderableComponents(),this.createContent(),this.hide(),this.textAnimator.searchProperties(this.dynamicProperties)},ITextElement.prototype.prepareFrame=function(r){this._mdf=!1,this.prepareRenderableFrame(r),this.prepareProperties(r,this.isInRange)},ITextElement.prototype.createPathShape=function(r,e){var t,i,s=e.length,n="";for(t=0;t<s;t+=1)e[t].ty==="sh"&&(i=e[t].ks.k,n+=buildShapeString(i,i.i.length,!0,r));return n},ITextElement.prototype.updateDocumentData=function(r,e){this.textProperty.updateDocumentData(r,e)},ITextElement.prototype.canResizeFont=function(r){this.textProperty.canResizeFont(r)},ITextElement.prototype.setMinimumFontSize=function(r){this.textProperty.setMinimumFontSize(r)},ITextElement.prototype.applyTextPropertiesToMatrix=function(r,e,t,i,s){switch(r.ps&&e.translate(r.ps[0],r.ps[1]+r.ascent,0),e.translate(0,-r.ls,0),r.j){case 1:e.translate(r.justifyOffset+(r.boxWidth-r.lineWidths[t]),0,0);break;case 2:e.translate(r.justifyOffset+(r.boxWidth-r.lineWidths[t])/2,0,0)}e.translate(i,s,0)},ITextElement.prototype.buildColor=function(r){return"rgb("+Math.round(255*r[0])+","+Math.round(255*r[1])+","+Math.round(255*r[2])+")"},ITextElement.prototype.emptyProp=new LetterProps,ITextElement.prototype.destroy=function(){},ITextElement.prototype.validateText=function(){(this.textProperty._mdf||this.textProperty._isFirstFrame)&&(this.buildNewText(),this.textProperty._isFirstFrame=!1,this.textProperty._mdf=!1)};var emptyShapeData={shapes:[]};function SVGTextLottieElement(r,e,t){this.textSpans=[],this.renderType="svg",this.initElement(r,e,t)}function ISolidElement(r,e,t){this.initElement(r,e,t)}function NullElement(r,e,t){this.initFrame(),this.initBaseData(r,e,t),this.initFrame(),this.initTransform(r,e,t),this.initHierarchy()}function SVGRendererBase(){}function ICompElement(){}function SVGCompElement(r,e,t){this.layers=r.layers,this.supports3d=!0,this.completeLayers=!1,this.pendingElements=[],this.elements=this.layers?createSizedArray(this.layers.length):[],this.initElement(r,e,t),this.tm=r.tm?PropertyFactory.getProp(this,r.tm,0,e.frameRate,this):{_placeholder:!0}}function SVGRenderer(r,e){this.animationItem=r,this.layers=null,this.renderedFrame=-1,this.svgElement=createNS("svg");var t="";if(e&&e.title){var i=createNS("title"),s=createElementID();i.setAttribute("id",s),i.textContent=e.title,this.svgElement.appendChild(i),t+=s}if(e&&e.description){var n=createNS("desc"),a=createElementID();n.setAttribute("id",a),n.textContent=e.description,this.svgElement.appendChild(n),t+=" "+a}t&&this.svgElement.setAttribute("aria-labelledby",t);var o=createNS("defs");this.svgElement.appendChild(o);var c=createNS("g");this.svgElement.appendChild(c),this.layerElement=c,this.renderConfig={preserveAspectRatio:e&&e.preserveAspectRatio||"xMidYMid meet",imagePreserveAspectRatio:e&&e.imagePreserveAspectRatio||"xMidYMid slice",contentVisibility:e&&e.contentVisibility||"visible",progressiveLoad:e&&e.progressiveLoad||!1,hideOnTransparent:!(e&&e.hideOnTransparent===!1),viewBoxOnly:e&&e.viewBoxOnly||!1,viewBoxSize:e&&e.viewBoxSize||!1,className:e&&e.className||"",id:e&&e.id||"",focusable:e&&e.focusable,filterSize:{width:e&&e.filterSize&&e.filterSize.width||"100%",height:e&&e.filterSize&&e.filterSize.height||"100%",x:e&&e.filterSize&&e.filterSize.x||"0%",y:e&&e.filterSize&&e.filterSize.y||"0%"},width:e&&e.width,height:e&&e.height,runExpressions:!e||e.runExpressions===void 0||e.runExpressions},this.globalData={_mdf:!1,frameNum:-1,defs:o,renderConfig:this.renderConfig},this.elements=[],this.pendingElements=[],this.destroyed=!1,this.rendererType="svg"}function ShapeTransformManager(){this.sequences={},this.sequenceList=[],this.transform_key_count=0}extendPrototype([BaseElement,TransformElement,SVGBaseElement,HierarchyElement,FrameElement,RenderableDOMElement,ITextElement],SVGTextLottieElement),SVGTextLottieElement.prototype.createContent=function(){this.data.singleShape&&!this.globalData.fontManager.chars&&(this.textContainer=createNS("text"))},SVGTextLottieElement.prototype.buildTextContents=function(r){for(var e=0,t=r.length,i=[],s="";e<t;)r[e]==="\r"||r[e]===""?(i.push(s),s=""):s+=r[e],e+=1;return i.push(s),i},SVGTextLottieElement.prototype.buildShapeData=function(r,e){if(r.shapes&&r.shapes.length){var t=r.shapes[0];if(t.it){var i=t.it[t.it.length-1];i.s&&(i.s.k[0]=e,i.s.k[1]=e)}}return r},SVGTextLottieElement.prototype.buildNewText=function(){var r,e;this.addDynamicProperty(this);var t=this.textProperty.currentData;this.renderedLetters=createSizedArray(t?t.l.length:0),t.fc?this.layerElement.setAttribute("fill",this.buildColor(t.fc)):this.layerElement.setAttribute("fill","rgba(0,0,0,0)"),t.sc&&(this.layerElement.setAttribute("stroke",this.buildColor(t.sc)),this.layerElement.setAttribute("stroke-width",t.sw)),this.layerElement.setAttribute("font-size",t.finalSize);var i=this.globalData.fontManager.getFontByName(t.f);if(i.fClass)this.layerElement.setAttribute("class",i.fClass);else{this.layerElement.setAttribute("font-family",i.fFamily);var s=t.fWeight,n=t.fStyle;this.layerElement.setAttribute("font-style",n),this.layerElement.setAttribute("font-weight",s)}this.layerElement.setAttribute("aria-label",t.t);var a,o=t.l||[],c=!!this.globalData.fontManager.chars;e=o.length;var u=this.mHelper,f=this.data.singleShape,d=0,g=0,E=!0,m=.001*t.tr*t.finalSize;if(!f||c||t.sz){var T,S=this.textSpans.length;for(r=0;r<e;r+=1){if(this.textSpans[r]||(this.textSpans[r]={span:null,childSpan:null,glyph:null}),!c||!f||r===0){if(a=S>r?this.textSpans[r].span:createNS(c?"g":"text"),S<=r){if(a.setAttribute("stroke-linecap","butt"),a.setAttribute("stroke-linejoin","round"),a.setAttribute("stroke-miterlimit","4"),this.textSpans[r].span=a,c){var b=createNS("g");a.appendChild(b),this.textSpans[r].childSpan=b}this.textSpans[r].span=a,this.layerElement.appendChild(a)}a.style.display="inherit"}if(u.reset(),f&&(o[r].n&&(d=-m,g+=t.yOffset,g+=E?1:0,E=!1),this.applyTextPropertiesToMatrix(t,u,o[r].line,d,g),d+=o[r].l||0,d+=m),c){var C;if((T=this.globalData.fontManager.getCharData(t.finalText[r],i.fStyle,this.globalData.fontManager.getFontByName(t.f).fFamily)).t===1)C=new SVGCompElement(T.data,this.globalData,this);else{var I=emptyShapeData;T.data&&T.data.shapes&&(I=this.buildShapeData(T.data,t.finalSize)),C=new SVGShapeElement(I,this.globalData,this)}if(this.textSpans[r].glyph){var L=this.textSpans[r].glyph;this.textSpans[r].childSpan.removeChild(L.layerElement),L.destroy()}this.textSpans[r].glyph=C,C._debug=!0,C.prepareFrame(0),C.renderFrame(),this.textSpans[r].childSpan.appendChild(C.layerElement),T.t===1&&this.textSpans[r].childSpan.setAttribute("transform","scale("+t.finalSize/100+","+t.finalSize/100+")")}else f&&a.setAttribute("transform","translate("+u.props[12]+","+u.props[13]+")"),a.textContent=o[r].val,a.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve")}f&&a&&a.setAttribute("d","")}else{var k=this.textContainer,U="start";switch(t.j){case 1:U="end";break;case 2:U="middle";break;default:U="start"}k.setAttribute("text-anchor",U),k.setAttribute("letter-spacing",m);var O=this.buildTextContents(t.finalText);for(e=O.length,g=t.ps?t.ps[1]+t.ascent:0,r=0;r<e;r+=1)(a=this.textSpans[r].span||createNS("tspan")).textContent=O[r],a.setAttribute("x",0),a.setAttribute("y",g),a.style.display="inherit",k.appendChild(a),this.textSpans[r]||(this.textSpans[r]={span:null,glyph:null}),this.textSpans[r].span=a,g+=t.finalLineHeight;this.layerElement.appendChild(k)}for(;r<this.textSpans.length;)this.textSpans[r].span.style.display="none",r+=1;this._sizeChanged=!0},SVGTextLottieElement.prototype.sourceRectAtTime=function(){if(this.prepareFrame(this.comp.renderedFrame-this.data.st),this.renderInnerContent(),this._sizeChanged){this._sizeChanged=!1;var r=this.layerElement.getBBox();this.bbox={top:r.y,left:r.x,width:r.width,height:r.height}}return this.bbox},SVGTextLottieElement.prototype.getValue=function(){var r,e,t=this.textSpans.length;for(this.renderedFrame=this.comp.renderedFrame,r=0;r<t;r+=1)(e=this.textSpans[r].glyph)&&(e.prepareFrame(this.comp.renderedFrame-this.data.st),e._mdf&&(this._mdf=!0))},SVGTextLottieElement.prototype.renderInnerContent=function(){if(this.validateText(),(!this.data.singleShape||this._mdf)&&(this.textAnimator.getMeasures(this.textProperty.currentData,this.lettersChangedFlag),this.lettersChangedFlag||this.textAnimator.lettersChangedFlag)){var r,e;this._sizeChanged=!0;var t,i,s,n=this.textAnimator.renderedLetters,a=this.textProperty.currentData.l;for(e=a.length,r=0;r<e;r+=1)a[r].n||(t=n[r],i=this.textSpans[r].span,(s=this.textSpans[r].glyph)&&s.renderFrame(),t._mdf.m&&i.setAttribute("transform",t.m),t._mdf.o&&i.setAttribute("opacity",t.o),t._mdf.sw&&i.setAttribute("stroke-width",t.sw),t._mdf.sc&&i.setAttribute("stroke",t.sc),t._mdf.fc&&i.setAttribute("fill",t.fc))}},extendPrototype([IImageElement],ISolidElement),ISolidElement.prototype.createContent=function(){var r=createNS("rect");r.setAttribute("width",this.data.sw),r.setAttribute("height",this.data.sh),r.setAttribute("fill",this.data.sc),this.layerElement.appendChild(r)},NullElement.prototype.prepareFrame=function(r){this.prepareProperties(r,!0)},NullElement.prototype.renderFrame=function(){},NullElement.prototype.getBaseElement=function(){return null},NullElement.prototype.destroy=function(){},NullElement.prototype.sourceRectAtTime=function(){},NullElement.prototype.hide=function(){},extendPrototype([BaseElement,TransformElement,HierarchyElement,FrameElement],NullElement),extendPrototype([BaseRenderer],SVGRendererBase),SVGRendererBase.prototype.createNull=function(r){return new NullElement(r,this.globalData,this)},SVGRendererBase.prototype.createShape=function(r){return new SVGShapeElement(r,this.globalData,this)},SVGRendererBase.prototype.createText=function(r){return new SVGTextLottieElement(r,this.globalData,this)},SVGRendererBase.prototype.createImage=function(r){return new IImageElement(r,this.globalData,this)},SVGRendererBase.prototype.createSolid=function(r){return new ISolidElement(r,this.globalData,this)},SVGRendererBase.prototype.configAnimation=function(r){this.svgElement.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.svgElement.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),this.renderConfig.viewBoxSize?this.svgElement.setAttribute("viewBox",this.renderConfig.viewBoxSize):this.svgElement.setAttribute("viewBox","0 0 "+r.w+" "+r.h),this.renderConfig.viewBoxOnly||(this.svgElement.setAttribute("width",r.w),this.svgElement.setAttribute("height",r.h),this.svgElement.style.width="100%",this.svgElement.style.height="100%",this.svgElement.style.transform="translate3d(0,0,0)",this.svgElement.style.contentVisibility=this.renderConfig.contentVisibility),this.renderConfig.width&&this.svgElement.setAttribute("width",this.renderConfig.width),this.renderConfig.height&&this.svgElement.setAttribute("height",this.renderConfig.height),this.renderConfig.className&&this.svgElement.setAttribute("class",this.renderConfig.className),this.renderConfig.id&&this.svgElement.setAttribute("id",this.renderConfig.id),this.renderConfig.focusable!==void 0&&this.svgElement.setAttribute("focusable",this.renderConfig.focusable),this.svgElement.setAttribute("preserveAspectRatio",this.renderConfig.preserveAspectRatio),this.animationItem.wrapper.appendChild(this.svgElement);var e=this.globalData.defs;this.setupGlobalData(r,e),this.globalData.progressiveLoad=this.renderConfig.progressiveLoad,this.data=r;var t=createNS("clipPath"),i=createNS("rect");i.setAttribute("width",r.w),i.setAttribute("height",r.h),i.setAttribute("x",0),i.setAttribute("y",0);var s=createElementID();t.setAttribute("id",s),t.appendChild(i),this.layerElement.setAttribute("clip-path","url("+getLocationHref()+"#"+s+")"),e.appendChild(t),this.layers=r.layers,this.elements=createSizedArray(r.layers.length)},SVGRendererBase.prototype.destroy=function(){var r;this.animationItem.wrapper&&(this.animationItem.wrapper.innerText=""),this.layerElement=null,this.globalData.defs=null;var e=this.layers?this.layers.length:0;for(r=0;r<e;r+=1)this.elements[r]&&this.elements[r].destroy&&this.elements[r].destroy();this.elements.length=0,this.destroyed=!0,this.animationItem=null},SVGRendererBase.prototype.updateContainerSize=function(){},SVGRendererBase.prototype.findIndexByInd=function(r){var e=0,t=this.layers.length;for(e=0;e<t;e+=1)if(this.layers[e].ind===r)return e;return-1},SVGRendererBase.prototype.buildItem=function(r){var e=this.elements;if(!e[r]&&this.layers[r].ty!==99){e[r]=!0;var t=this.createItem(this.layers[r]);if(e[r]=t,getExpressionsPlugin()&&(this.layers[r].ty===0&&this.globalData.projectInterface.registerComposition(t),t.initExpressions()),this.appendElementInPos(t,r),this.layers[r].tt){var i="tp"in this.layers[r]?this.findIndexByInd(this.layers[r].tp):r-1;if(i===-1)return;if(this.elements[i]&&this.elements[i]!==!0){var s=e[i].getMatte(this.layers[r].tt);t.setMatte(s)}else this.buildItem(i),this.addPendingElement(t)}}},SVGRendererBase.prototype.checkPendingElements=function(){for(;this.pendingElements.length;){var r=this.pendingElements.pop();if(r.checkParenting(),r.data.tt)for(var e=0,t=this.elements.length;e<t;){if(this.elements[e]===r){var i="tp"in r.data?this.findIndexByInd(r.data.tp):e-1,s=this.elements[i].getMatte(this.layers[e].tt);r.setMatte(s);break}e+=1}}},SVGRendererBase.prototype.renderFrame=function(r){if(this.renderedFrame!==r&&!this.destroyed){var e;r===null?r=this.renderedFrame:this.renderedFrame=r,this.globalData.frameNum=r,this.globalData.frameId+=1,this.globalData.projectInterface.currentFrame=r,this.globalData._mdf=!1;var t=this.layers.length;for(this.completeLayers||this.checkLayers(r),e=t-1;e>=0;e-=1)(this.completeLayers||this.elements[e])&&this.elements[e].prepareFrame(r-this.layers[e].st);if(this.globalData._mdf)for(e=0;e<t;e+=1)(this.completeLayers||this.elements[e])&&this.elements[e].renderFrame()}},SVGRendererBase.prototype.appendElementInPos=function(r,e){var t=r.getBaseElement();if(t){for(var i,s=0;s<e;)this.elements[s]&&this.elements[s]!==!0&&this.elements[s].getBaseElement()&&(i=this.elements[s].getBaseElement()),s+=1;i?this.layerElement.insertBefore(t,i):this.layerElement.appendChild(t)}},SVGRendererBase.prototype.hide=function(){this.layerElement.style.display="none"},SVGRendererBase.prototype.show=function(){this.layerElement.style.display="block"},extendPrototype([BaseElement,TransformElement,HierarchyElement,FrameElement,RenderableDOMElement],ICompElement),ICompElement.prototype.initElement=function(r,e,t){this.initFrame(),this.initBaseData(r,e,t),this.initTransform(r,e,t),this.initRenderable(),this.initHierarchy(),this.initRendererElement(),this.createContainerElements(),this.createRenderableComponents(),!this.data.xt&&e.progressiveLoad||this.buildAllItems(),this.hide()},ICompElement.prototype.prepareFrame=function(r){if(this._mdf=!1,this.prepareRenderableFrame(r),this.prepareProperties(r,this.isInRange),this.isInRange||this.data.xt){if(this.tm._placeholder)this.renderedFrame=r/this.data.sr;else{var e=this.tm.v;e===this.data.op&&(e=this.data.op-1),this.renderedFrame=e}var t,i=this.elements.length;for(this.completeLayers||this.checkLayers(this.renderedFrame),t=i-1;t>=0;t-=1)(this.completeLayers||this.elements[t])&&(this.elements[t].prepareFrame(this.renderedFrame-this.layers[t].st),this.elements[t]._mdf&&(this._mdf=!0))}},ICompElement.prototype.renderInnerContent=function(){var r,e=this.layers.length;for(r=0;r<e;r+=1)(this.completeLayers||this.elements[r])&&this.elements[r].renderFrame()},ICompElement.prototype.setElements=function(r){this.elements=r},ICompElement.prototype.getElements=function(){return this.elements},ICompElement.prototype.destroyElements=function(){var r,e=this.layers.length;for(r=0;r<e;r+=1)this.elements[r]&&this.elements[r].destroy()},ICompElement.prototype.destroy=function(){this.destroyElements(),this.destroyBaseElement()},extendPrototype([SVGRendererBase,ICompElement,SVGBaseElement],SVGCompElement),SVGCompElement.prototype.createComp=function(r){return new SVGCompElement(r,this.globalData,this)},extendPrototype([SVGRendererBase],SVGRenderer),SVGRenderer.prototype.createComp=function(r){return new SVGCompElement(r,this.globalData,this)},ShapeTransformManager.prototype={addTransformSequence:function(r){var e,t=r.length,i="_";for(e=0;e<t;e+=1)i+=r[e].transform.key+"_";var s=this.sequences[i];return s||(s={transforms:[].concat(r),finalTransform:new Matrix,_mdf:!1},this.sequences[i]=s,this.sequenceList.push(s)),s},processSequence:function(r,e){for(var t=0,i=r.transforms.length,s=e;t<i&&!e;){if(r.transforms[t].transform.mProps._mdf){s=!0;break}t+=1}if(s)for(r.finalTransform.reset(),t=i-1;t>=0;t-=1)r.finalTransform.multiply(r.transforms[t].transform.mProps.v);r._mdf=s},processSequences:function(r){var e,t=this.sequenceList.length;for(e=0;e<t;e+=1)this.processSequence(this.sequenceList[e],r)},getNewKey:function(){return this.transform_key_count+=1,"_"+this.transform_key_count}};var lumaLoader=function(){var r="__lottie_element_luma_buffer",e=null,t=null,i=null;function s(){var n,a,o;e||(n=createNS("svg"),a=createNS("filter"),o=createNS("feColorMatrix"),a.setAttribute("id",r),o.setAttribute("type","matrix"),o.setAttribute("color-interpolation-filters","sRGB"),o.setAttribute("values","0.3, 0.3, 0.3, 0, 0, 0.3, 0.3, 0.3, 0, 0, 0.3, 0.3, 0.3, 0, 0, 0.3, 0.3, 0.3, 0, 0"),a.appendChild(o),n.appendChild(a),n.setAttribute("id",r+"_svg"),featureSupport.svgLumaHidden&&(n.style.display="none"),i=n,document.body.appendChild(i),e=createTag("canvas"),(t=e.getContext("2d")).filter="url(#"+r+")",t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1))}return{load:s,get:function(n){return e||s(),e.width=n.width,e.height=n.height,t.filter="url(#"+r+")",e}}};function createCanvas(r,e){if(featureSupport.offscreenCanvas)return new OffscreenCanvas(r,e);var t=createTag("canvas");return t.width=r,t.height=e,t}var assetLoader={loadLumaCanvas:lumaLoader.load,getLumaCanvas:lumaLoader.get,createCanvas},registeredEffects={};function CVEffects(r){var e,t,i=r.data.ef?r.data.ef.length:0;for(this.filters=[],e=0;e<i;e+=1){t=null;var s=r.data.ef[e].ty;registeredEffects[s]&&(t=new registeredEffects[s].effect(r.effectsManager.effectElements[e],r)),t&&this.filters.push(t)}this.filters.length&&r.addRenderableComponent(this)}function registerEffect(r,e){registeredEffects[r]={effect:e}}function CVMaskElement(r,e){var t;this.data=r,this.element=e,this.masksProperties=this.data.masksProperties||[],this.viewData=createSizedArray(this.masksProperties.length);var i=this.masksProperties.length,s=!1;for(t=0;t<i;t+=1)this.masksProperties[t].mode!=="n"&&(s=!0),this.viewData[t]=ShapePropertyFactory.getShapeProp(this.element,this.masksProperties[t],3);this.hasMasks=s,s&&this.element.addRenderableComponent(this)}function CVBaseElement(){}CVEffects.prototype.renderFrame=function(r){var e,t=this.filters.length;for(e=0;e<t;e+=1)this.filters[e].renderFrame(r)},CVEffects.prototype.getEffects=function(r){var e,t=this.filters.length,i=[];for(e=0;e<t;e+=1)this.filters[e].type===r&&i.push(this.filters[e]);return i},CVMaskElement.prototype.renderFrame=function(){if(this.hasMasks){var r,e,t,i,s=this.element.finalTransform.mat,n=this.element.canvasContext,a=this.masksProperties.length;for(n.beginPath(),r=0;r<a;r+=1)if(this.masksProperties[r].mode!=="n"){var o;this.masksProperties[r].inv&&(n.moveTo(0,0),n.lineTo(this.element.globalData.compSize.w,0),n.lineTo(this.element.globalData.compSize.w,this.element.globalData.compSize.h),n.lineTo(0,this.element.globalData.compSize.h),n.lineTo(0,0)),i=this.viewData[r].v,e=s.applyToPointArray(i.v[0][0],i.v[0][1],0),n.moveTo(e[0],e[1]);var c=i._length;for(o=1;o<c;o+=1)t=s.applyToTriplePoints(i.o[o-1],i.i[o],i.v[o]),n.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]);t=s.applyToTriplePoints(i.o[o-1],i.i[0],i.v[0]),n.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5])}this.element.globalData.renderer.save(!0),n.clip()}},CVMaskElement.prototype.getMaskProperty=MaskElement.prototype.getMaskProperty,CVMaskElement.prototype.destroy=function(){this.element=null};var operationsMap={1:"source-in",2:"source-out",3:"source-in",4:"source-out"};function CVShapeData(r,e,t,i){this.styledShapes=[],this.tr=[0,0,0,0,0,0];var s,n=4;e.ty==="rc"?n=5:e.ty==="el"?n=6:e.ty==="sr"&&(n=7),this.sh=ShapePropertyFactory.getShapeProp(r,e,n,r);var a,o=t.length;for(s=0;s<o;s+=1)t[s].closed||(a={transforms:i.addTransformSequence(t[s].transforms),trNodes:[]},this.styledShapes.push(a),t[s].elements.push(a))}function CVShapeElement(r,e,t){this.shapes=[],this.shapesData=r.shapes,this.stylesList=[],this.itemsData=[],this.prevViewData=[],this.shapeModifiers=[],this.processedElements=[],this.transformsManager=new ShapeTransformManager,this.initElement(r,e,t)}function CVTextElement(r,e,t){this.textSpans=[],this.yOffset=0,this.fillColorAnim=!1,this.strokeColorAnim=!1,this.strokeWidthAnim=!1,this.stroke=!1,this.fill=!1,this.justifyOffset=0,this.currentRender=null,this.renderType="canvas",this.values={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",sWidth:0,fValue:""},this.initElement(r,e,t)}function CVImageElement(r,e,t){this.assetData=e.getAssetData(r.refId),this.img=e.imageLoader.getAsset(this.assetData),this.initElement(r,e,t)}function CVSolidElement(r,e,t){this.initElement(r,e,t)}function CanvasRendererBase(){}function CanvasContext(){this.opacity=-1,this.transform=createTypedArray("float32",16),this.fillStyle="",this.strokeStyle="",this.lineWidth="",this.lineCap="",this.lineJoin="",this.miterLimit="",this.id=Math.random()}function CVContextData(){var r;for(this.stack=[],this.cArrPos=0,this.cTr=new Matrix,r=0;r<15;r+=1){var e=new CanvasContext;this.stack[r]=e}this._length=15,this.nativeContext=null,this.transformMat=new Matrix,this.currentOpacity=1,this.currentFillStyle="",this.appliedFillStyle="",this.currentStrokeStyle="",this.appliedStrokeStyle="",this.currentLineWidth="",this.appliedLineWidth="",this.currentLineCap="",this.appliedLineCap="",this.currentLineJoin="",this.appliedLineJoin="",this.appliedMiterLimit="",this.currentMiterLimit=""}function CVCompElement(r,e,t){this.completeLayers=!1,this.layers=r.layers,this.pendingElements=[],this.elements=createSizedArray(this.layers.length),this.initElement(r,e,t),this.tm=r.tm?PropertyFactory.getProp(this,r.tm,0,e.frameRate,this):{_placeholder:!0}}function CanvasRenderer(r,e){this.animationItem=r,this.renderConfig={clearCanvas:!e||e.clearCanvas===void 0||e.clearCanvas,context:e&&e.context||null,progressiveLoad:e&&e.progressiveLoad||!1,preserveAspectRatio:e&&e.preserveAspectRatio||"xMidYMid meet",imagePreserveAspectRatio:e&&e.imagePreserveAspectRatio||"xMidYMid slice",contentVisibility:e&&e.contentVisibility||"visible",className:e&&e.className||"",id:e&&e.id||"",runExpressions:!e||e.runExpressions===void 0||e.runExpressions},this.renderConfig.dpr=e&&e.dpr||1,this.animationItem.wrapper&&(this.renderConfig.dpr=e&&e.dpr||window.devicePixelRatio||1),this.renderedFrame=-1,this.globalData={frameNum:-1,_mdf:!1,renderConfig:this.renderConfig,currentGlobalAlpha:-1},this.contextData=new CVContextData,this.elements=[],this.pendingElements=[],this.transformMat=new Matrix,this.completeLayers=!1,this.rendererType="canvas",this.renderConfig.clearCanvas&&(this.ctxTransform=this.contextData.transform.bind(this.contextData),this.ctxOpacity=this.contextData.opacity.bind(this.contextData),this.ctxFillStyle=this.contextData.fillStyle.bind(this.contextData),this.ctxStrokeStyle=this.contextData.strokeStyle.bind(this.contextData),this.ctxLineWidth=this.contextData.lineWidth.bind(this.contextData),this.ctxLineCap=this.contextData.lineCap.bind(this.contextData),this.ctxLineJoin=this.contextData.lineJoin.bind(this.contextData),this.ctxMiterLimit=this.contextData.miterLimit.bind(this.contextData),this.ctxFill=this.contextData.fill.bind(this.contextData),this.ctxFillRect=this.contextData.fillRect.bind(this.contextData),this.ctxStroke=this.contextData.stroke.bind(this.contextData),this.save=this.contextData.save.bind(this.contextData))}function HBaseElement(){}function HSolidElement(r,e,t){this.initElement(r,e,t)}function HShapeElement(r,e,t){this.shapes=[],this.shapesData=r.shapes,this.stylesList=[],this.shapeModifiers=[],this.itemsData=[],this.processedElements=[],this.animatedContents=[],this.shapesContainer=createNS("g"),this.initElement(r,e,t),this.prevViewData=[],this.currentBBox={x:999999,y:-999999,h:0,w:0}}function HTextElement(r,e,t){this.textSpans=[],this.textPaths=[],this.currentBBox={x:999999,y:-999999,h:0,w:0},this.renderType="svg",this.isMasked=!1,this.initElement(r,e,t)}function HCameraElement(r,e,t){this.initFrame(),this.initBaseData(r,e,t),this.initHierarchy();var i=PropertyFactory.getProp;if(this.pe=i(this,r.pe,0,0,this),r.ks.p.s?(this.px=i(this,r.ks.p.x,1,0,this),this.py=i(this,r.ks.p.y,1,0,this),this.pz=i(this,r.ks.p.z,1,0,this)):this.p=i(this,r.ks.p,1,0,this),r.ks.a&&(this.a=i(this,r.ks.a,1,0,this)),r.ks.or.k.length&&r.ks.or.k[0].to){var s,n=r.ks.or.k.length;for(s=0;s<n;s+=1)r.ks.or.k[s].to=null,r.ks.or.k[s].ti=null}this.or=i(this,r.ks.or,1,degToRads,this),this.or.sh=!0,this.rx=i(this,r.ks.rx,0,degToRads,this),this.ry=i(this,r.ks.ry,0,degToRads,this),this.rz=i(this,r.ks.rz,0,degToRads,this),this.mat=new Matrix,this._prevMat=new Matrix,this._isFirstFrame=!0,this.finalTransform={mProp:this}}function HImageElement(r,e,t){this.assetData=e.getAssetData(r.refId),this.initElement(r,e,t)}function HybridRendererBase(r,e){this.animationItem=r,this.layers=null,this.renderedFrame=-1,this.renderConfig={className:e&&e.className||"",imagePreserveAspectRatio:e&&e.imagePreserveAspectRatio||"xMidYMid slice",hideOnTransparent:!(e&&e.hideOnTransparent===!1),filterSize:{width:e&&e.filterSize&&e.filterSize.width||"400%",height:e&&e.filterSize&&e.filterSize.height||"400%",x:e&&e.filterSize&&e.filterSize.x||"-100%",y:e&&e.filterSize&&e.filterSize.y||"-100%"}},this.globalData={_mdf:!1,frameNum:-1,renderConfig:this.renderConfig},this.pendingElements=[],this.elements=[],this.threeDElements=[],this.destroyed=!1,this.camera=null,this.supports3d=!0,this.rendererType="html"}function HCompElement(r,e,t){this.layers=r.layers,this.supports3d=!r.hasMask,this.completeLayers=!1,this.pendingElements=[],this.elements=this.layers?createSizedArray(this.layers.length):[],this.initElement(r,e,t),this.tm=r.tm?PropertyFactory.getProp(this,r.tm,0,e.frameRate,this):{_placeholder:!0}}function HybridRenderer(r,e){this.animationItem=r,this.layers=null,this.renderedFrame=-1,this.renderConfig={className:e&&e.className||"",imagePreserveAspectRatio:e&&e.imagePreserveAspectRatio||"xMidYMid slice",hideOnTransparent:!(e&&e.hideOnTransparent===!1),filterSize:{width:e&&e.filterSize&&e.filterSize.width||"400%",height:e&&e.filterSize&&e.filterSize.height||"400%",x:e&&e.filterSize&&e.filterSize.x||"-100%",y:e&&e.filterSize&&e.filterSize.y||"-100%"},runExpressions:!e||e.runExpressions===void 0||e.runExpressions},this.globalData={_mdf:!1,frameNum:-1,renderConfig:this.renderConfig},this.pendingElements=[],this.elements=[],this.threeDElements=[],this.destroyed=!1,this.camera=null,this.supports3d=!0,this.rendererType="html"}CVBaseElement.prototype={createElements:function(){},initRendererElement:function(){},createContainerElements:function(){if(this.data.tt>=1){this.buffers=[];var r=this.globalData.canvasContext,e=assetLoader.createCanvas(r.canvas.width,r.canvas.height);this.buffers.push(e);var t=assetLoader.createCanvas(r.canvas.width,r.canvas.height);this.buffers.push(t),this.data.tt>=3&&!document._isProxy&&assetLoader.loadLumaCanvas()}this.canvasContext=this.globalData.canvasContext,this.transformCanvas=this.globalData.transformCanvas,this.renderableEffectsManager=new CVEffects(this),this.searchEffectTransforms()},createContent:function(){},setBlendMode:function(){var r=this.globalData;if(r.blendMode!==this.data.bm){r.blendMode=this.data.bm;var e=getBlendMode(this.data.bm);r.canvasContext.globalCompositeOperation=e}},createRenderableComponents:function(){this.maskManager=new CVMaskElement(this.data,this),this.transformEffects=this.renderableEffectsManager.getEffects(effectTypes.TRANSFORM_EFFECT)},hideElement:function(){this.hidden||this.isInRange&&!this.isTransparent||(this.hidden=!0)},showElement:function(){this.isInRange&&!this.isTransparent&&(this.hidden=!1,this._isFirstFrame=!0,this.maskManager._isFirstFrame=!0)},clearCanvas:function(r){r.clearRect(this.transformCanvas.tx,this.transformCanvas.ty,this.transformCanvas.w*this.transformCanvas.sx,this.transformCanvas.h*this.transformCanvas.sy)},prepareLayer:function(){if(this.data.tt>=1){var r=this.buffers[0].getContext("2d");this.clearCanvas(r),r.drawImage(this.canvasContext.canvas,0,0),this.currentTransform=this.canvasContext.getTransform(),this.canvasContext.setTransform(1,0,0,1,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.setTransform(this.currentTransform)}},exitLayer:function(){if(this.data.tt>=1){var r=this.buffers[1],e=r.getContext("2d");if(this.clearCanvas(e),e.drawImage(this.canvasContext.canvas,0,0),this.canvasContext.setTransform(1,0,0,1,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.setTransform(this.currentTransform),this.comp.getElementById("tp"in this.data?this.data.tp:this.data.ind-1).renderFrame(!0),this.canvasContext.setTransform(1,0,0,1,0,0),this.data.tt>=3&&!document._isProxy){var t=assetLoader.getLumaCanvas(this.canvasContext.canvas);t.getContext("2d").drawImage(this.canvasContext.canvas,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.drawImage(t,0,0)}this.canvasContext.globalCompositeOperation=operationsMap[this.data.tt],this.canvasContext.drawImage(r,0,0),this.canvasContext.globalCompositeOperation="destination-over",this.canvasContext.drawImage(this.buffers[0],0,0),this.canvasContext.setTransform(this.currentTransform),this.canvasContext.globalCompositeOperation="source-over"}},renderFrame:function(r){if(!this.hidden&&!this.data.hd&&(this.data.td!==1||r)){this.renderTransform(),this.renderRenderable(),this.renderLocalTransform(),this.setBlendMode();var e=this.data.ty===0;this.prepareLayer(),this.globalData.renderer.save(e),this.globalData.renderer.ctxTransform(this.finalTransform.localMat.props),this.globalData.renderer.ctxOpacity(this.finalTransform.localOpacity),this.renderInnerContent(),this.globalData.renderer.restore(e),this.exitLayer(),this.maskManager.hasMasks&&this.globalData.renderer.restore(!0),this._isFirstFrame&&(this._isFirstFrame=!1)}},destroy:function(){this.canvasContext=null,this.data=null,this.globalData=null,this.maskManager.destroy()},mHelper:new Matrix},CVBaseElement.prototype.hide=CVBaseElement.prototype.hideElement,CVBaseElement.prototype.show=CVBaseElement.prototype.showElement,CVShapeData.prototype.setAsAnimated=SVGShapeData.prototype.setAsAnimated,extendPrototype([BaseElement,TransformElement,CVBaseElement,IShapeElement,HierarchyElement,FrameElement,RenderableElement],CVShapeElement),CVShapeElement.prototype.initElement=RenderableDOMElement.prototype.initElement,CVShapeElement.prototype.transformHelper={opacity:1,_opMdf:!1},CVShapeElement.prototype.dashResetter=[],CVShapeElement.prototype.createContent=function(){this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,!0,[])},CVShapeElement.prototype.createStyleElement=function(r,e){var t={data:r,type:r.ty,preTransforms:this.transformsManager.addTransformSequence(e),transforms:[],elements:[],closed:r.hd===!0},i={};if(r.ty==="fl"||r.ty==="st"?(i.c=PropertyFactory.getProp(this,r.c,1,255,this),i.c.k||(t.co="rgb("+bmFloor(i.c.v[0])+","+bmFloor(i.c.v[1])+","+bmFloor(i.c.v[2])+")")):r.ty!=="gf"&&r.ty!=="gs"||(i.s=PropertyFactory.getProp(this,r.s,1,null,this),i.e=PropertyFactory.getProp(this,r.e,1,null,this),i.h=PropertyFactory.getProp(this,r.h||{k:0},0,.01,this),i.a=PropertyFactory.getProp(this,r.a||{k:0},0,degToRads,this),i.g=new GradientProperty(this,r.g,this)),i.o=PropertyFactory.getProp(this,r.o,0,.01,this),r.ty==="st"||r.ty==="gs"){if(t.lc=lineCapEnum[r.lc||2],t.lj=lineJoinEnum[r.lj||2],r.lj==1&&(t.ml=r.ml),i.w=PropertyFactory.getProp(this,r.w,0,null,this),i.w.k||(t.wi=i.w.v),r.d){var s=new DashProperty(this,r.d,"canvas",this);i.d=s,i.d.k||(t.da=i.d.dashArray,t.do=i.d.dashoffset[0])}}else t.r=r.r===2?"evenodd":"nonzero";return this.stylesList.push(t),i.style=t,i},CVShapeElement.prototype.createGroupElement=function(){return{it:[],prevViewData:[]}},CVShapeElement.prototype.createTransformElement=function(r){return{transform:{opacity:1,_opMdf:!1,key:this.transformsManager.getNewKey(),op:PropertyFactory.getProp(this,r.o,0,.01,this),mProps:TransformPropertyFactory.getTransformProperty(this,r,this)}}},CVShapeElement.prototype.createShapeElement=function(r){var e=new CVShapeData(this,r,this.stylesList,this.transformsManager);return this.shapes.push(e),this.addShapeToModifiers(e),e},CVShapeElement.prototype.reloadShapes=function(){var r;this._isFirstFrame=!0;var e=this.itemsData.length;for(r=0;r<e;r+=1)this.prevViewData[r]=this.itemsData[r];for(this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,!0,[]),e=this.dynamicProperties.length,r=0;r<e;r+=1)this.dynamicProperties[r].getValue();this.renderModifiers(),this.transformsManager.processSequences(this._isFirstFrame)},CVShapeElement.prototype.addTransformToStyleList=function(r){var e,t=this.stylesList.length;for(e=0;e<t;e+=1)this.stylesList[e].closed||this.stylesList[e].transforms.push(r)},CVShapeElement.prototype.removeTransformFromStyleList=function(){var r,e=this.stylesList.length;for(r=0;r<e;r+=1)this.stylesList[r].closed||this.stylesList[r].transforms.pop()},CVShapeElement.prototype.closeStyles=function(r){var e,t=r.length;for(e=0;e<t;e+=1)r[e].closed=!0},CVShapeElement.prototype.searchShapes=function(r,e,t,i,s){var n,a,o,c,u,f,d=r.length-1,g=[],E=[],m=[].concat(s);for(n=d;n>=0;n-=1){if((c=this.searchProcessedElement(r[n]))?e[n]=t[c-1]:r[n]._shouldRender=i,r[n].ty==="fl"||r[n].ty==="st"||r[n].ty==="gf"||r[n].ty==="gs")c?e[n].style.closed=!1:e[n]=this.createStyleElement(r[n],m),g.push(e[n].style);else if(r[n].ty==="gr"){if(c)for(o=e[n].it.length,a=0;a<o;a+=1)e[n].prevViewData[a]=e[n].it[a];else e[n]=this.createGroupElement(r[n]);this.searchShapes(r[n].it,e[n].it,e[n].prevViewData,i,m)}else r[n].ty==="tr"?(c||(f=this.createTransformElement(r[n]),e[n]=f),m.push(e[n]),this.addTransformToStyleList(e[n])):r[n].ty==="sh"||r[n].ty==="rc"||r[n].ty==="el"||r[n].ty==="sr"?c||(e[n]=this.createShapeElement(r[n])):r[n].ty==="tm"||r[n].ty==="rd"||r[n].ty==="pb"||r[n].ty==="zz"||r[n].ty==="op"?(c?(u=e[n]).closed=!1:((u=ShapeModifiers.getModifier(r[n].ty)).init(this,r[n]),e[n]=u,this.shapeModifiers.push(u)),E.push(u)):r[n].ty==="rp"&&(c?(u=e[n]).closed=!0:(u=ShapeModifiers.getModifier(r[n].ty),e[n]=u,u.init(this,r,n,e),this.shapeModifiers.push(u),i=!1),E.push(u));this.addProcessedElement(r[n],n+1)}for(this.removeTransformFromStyleList(),this.closeStyles(g),d=E.length,n=0;n<d;n+=1)E[n].closed=!0},CVShapeElement.prototype.renderInnerContent=function(){this.transformHelper.opacity=1,this.transformHelper._opMdf=!1,this.renderModifiers(),this.transformsManager.processSequences(this._isFirstFrame),this.renderShape(this.transformHelper,this.shapesData,this.itemsData,!0)},CVShapeElement.prototype.renderShapeTransform=function(r,e){(r._opMdf||e.op._mdf||this._isFirstFrame)&&(e.opacity=r.opacity,e.opacity*=e.op.v,e._opMdf=!0)},CVShapeElement.prototype.drawLayer=function(){var r,e,t,i,s,n,a,o,c,u=this.stylesList.length,f=this.globalData.renderer,d=this.globalData.canvasContext;for(r=0;r<u;r+=1)if(((o=(c=this.stylesList[r]).type)!=="st"&&o!=="gs"||c.wi!==0)&&c.data._shouldRender&&c.coOp!==0&&this.globalData.currentGlobalAlpha!==0){for(f.save(),n=c.elements,o==="st"||o==="gs"?(f.ctxStrokeStyle(o==="st"?c.co:c.grd),f.ctxLineWidth(c.wi),f.ctxLineCap(c.lc),f.ctxLineJoin(c.lj),f.ctxMiterLimit(c.ml||0)):f.ctxFillStyle(o==="fl"?c.co:c.grd),f.ctxOpacity(c.coOp),o!=="st"&&o!=="gs"&&d.beginPath(),f.ctxTransform(c.preTransforms.finalTransform.props),t=n.length,e=0;e<t;e+=1){for(o!=="st"&&o!=="gs"||(d.beginPath(),c.da&&(d.setLineDash(c.da),d.lineDashOffset=c.do)),s=(a=n[e].trNodes).length,i=0;i<s;i+=1)a[i].t==="m"?d.moveTo(a[i].p[0],a[i].p[1]):a[i].t==="c"?d.bezierCurveTo(a[i].pts[0],a[i].pts[1],a[i].pts[2],a[i].pts[3],a[i].pts[4],a[i].pts[5]):d.closePath();o!=="st"&&o!=="gs"||(f.ctxStroke(),c.da&&d.setLineDash(this.dashResetter))}o!=="st"&&o!=="gs"&&this.globalData.renderer.ctxFill(c.r),f.restore()}},CVShapeElement.prototype.renderShape=function(r,e,t,i){var s,n;for(n=r,s=e.length-1;s>=0;s-=1)e[s].ty==="tr"?(n=t[s].transform,this.renderShapeTransform(r,n)):e[s].ty==="sh"||e[s].ty==="el"||e[s].ty==="rc"||e[s].ty==="sr"?this.renderPath(e[s],t[s]):e[s].ty==="fl"?this.renderFill(e[s],t[s],n):e[s].ty==="st"?this.renderStroke(e[s],t[s],n):e[s].ty==="gf"||e[s].ty==="gs"?this.renderGradientFill(e[s],t[s],n):e[s].ty==="gr"?this.renderShape(n,e[s].it,t[s].it):e[s].ty;i&&this.drawLayer()},CVShapeElement.prototype.renderStyledShape=function(r,e){if(this._isFirstFrame||e._mdf||r.transforms._mdf){var t,i,s,n=r.trNodes,a=e.paths,o=a._length;n.length=0;var c=r.transforms.finalTransform;for(s=0;s<o;s+=1){var u=a.shapes[s];if(u&&u.v){for(i=u._length,t=1;t<i;t+=1)t===1&&n.push({t:"m",p:c.applyToPointArray(u.v[0][0],u.v[0][1],0)}),n.push({t:"c",pts:c.applyToTriplePoints(u.o[t-1],u.i[t],u.v[t])});i===1&&n.push({t:"m",p:c.applyToPointArray(u.v[0][0],u.v[0][1],0)}),u.c&&i&&(n.push({t:"c",pts:c.applyToTriplePoints(u.o[t-1],u.i[0],u.v[0])}),n.push({t:"z"}))}}r.trNodes=n}},CVShapeElement.prototype.renderPath=function(r,e){if(r.hd!==!0&&r._shouldRender){var t,i=e.styledShapes.length;for(t=0;t<i;t+=1)this.renderStyledShape(e.styledShapes[t],e.sh)}},CVShapeElement.prototype.renderFill=function(r,e,t){var i=e.style;(e.c._mdf||this._isFirstFrame)&&(i.co="rgb("+bmFloor(e.c.v[0])+","+bmFloor(e.c.v[1])+","+bmFloor(e.c.v[2])+")"),(e.o._mdf||t._opMdf||this._isFirstFrame)&&(i.coOp=e.o.v*t.opacity)},CVShapeElement.prototype.renderGradientFill=function(r,e,t){var i,s=e.style;if(!s.grd||e.g._mdf||e.s._mdf||e.e._mdf||r.t!==1&&(e.h._mdf||e.a._mdf)){var n,a=this.globalData.canvasContext,o=e.s.v,c=e.e.v;if(r.t===1)i=a.createLinearGradient(o[0],o[1],c[0],c[1]);else{var u=Math.sqrt(Math.pow(o[0]-c[0],2)+Math.pow(o[1]-c[1],2)),f=Math.atan2(c[1]-o[1],c[0]-o[0]),d=e.h.v;d>=1?d=.99:d<=-1&&(d=-.99);var g=u*d,E=Math.cos(f+e.a.v)*g+o[0],m=Math.sin(f+e.a.v)*g+o[1];i=a.createRadialGradient(E,m,0,o[0],o[1],u)}var T=r.g.p,S=e.g.c,b=1;for(n=0;n<T;n+=1)e.g._hasOpacity&&e.g._collapsable&&(b=e.g.o[2*n+1]),i.addColorStop(S[4*n]/100,"rgba("+S[4*n+1]+","+S[4*n+2]+","+S[4*n+3]+","+b+")");s.grd=i}s.coOp=e.o.v*t.opacity},CVShapeElement.prototype.renderStroke=function(r,e,t){var i=e.style,s=e.d;s&&(s._mdf||this._isFirstFrame)&&(i.da=s.dashArray,i.do=s.dashoffset[0]),(e.c._mdf||this._isFirstFrame)&&(i.co="rgb("+bmFloor(e.c.v[0])+","+bmFloor(e.c.v[1])+","+bmFloor(e.c.v[2])+")"),(e.o._mdf||t._opMdf||this._isFirstFrame)&&(i.coOp=e.o.v*t.opacity),(e.w._mdf||this._isFirstFrame)&&(i.wi=e.w.v)},CVShapeElement.prototype.destroy=function(){this.shapesData=null,this.globalData=null,this.canvasContext=null,this.stylesList.length=0,this.itemsData.length=0},extendPrototype([BaseElement,TransformElement,CVBaseElement,HierarchyElement,FrameElement,RenderableElement,ITextElement],CVTextElement),CVTextElement.prototype.tHelper=createTag("canvas").getContext("2d"),CVTextElement.prototype.buildNewText=function(){var r=this.textProperty.currentData;this.renderedLetters=createSizedArray(r.l?r.l.length:0);var e=!1;r.fc?(e=!0,this.values.fill=this.buildColor(r.fc)):this.values.fill="rgba(0,0,0,0)",this.fill=e;var t=!1;r.sc&&(t=!0,this.values.stroke=this.buildColor(r.sc),this.values.sWidth=r.sw);var i,s,n,a,o,c,u,f,d,g,E,m,T=this.globalData.fontManager.getFontByName(r.f),S=r.l,b=this.mHelper;this.stroke=t,this.values.fValue=r.finalSize+"px "+this.globalData.fontManager.getFontByName(r.f).fFamily,s=r.finalText.length;var C=this.data.singleShape,I=.001*r.tr*r.finalSize,L=0,k=0,U=!0,O=0;for(i=0;i<s;i+=1){a=(n=this.globalData.fontManager.getCharData(r.finalText[i],T.fStyle,this.globalData.fontManager.getFontByName(r.f).fFamily))&&n.data||{},b.reset(),C&&S[i].n&&(L=-I,k+=r.yOffset,k+=U?1:0,U=!1),d=(u=a.shapes?a.shapes[0].it:[]).length,b.scale(r.finalSize/100,r.finalSize/100),C&&this.applyTextPropertiesToMatrix(r,b,S[i].line,L,k),E=createSizedArray(d-1);var F=0;for(f=0;f<d;f+=1)if(u[f].ty==="sh"){for(c=u[f].ks.k.i.length,g=u[f].ks.k,m=[],o=1;o<c;o+=1)o===1&&m.push(b.applyToX(g.v[0][0],g.v[0][1],0),b.applyToY(g.v[0][0],g.v[0][1],0)),m.push(b.applyToX(g.o[o-1][0],g.o[o-1][1],0),b.applyToY(g.o[o-1][0],g.o[o-1][1],0),b.applyToX(g.i[o][0],g.i[o][1],0),b.applyToY(g.i[o][0],g.i[o][1],0),b.applyToX(g.v[o][0],g.v[o][1],0),b.applyToY(g.v[o][0],g.v[o][1],0));m.push(b.applyToX(g.o[o-1][0],g.o[o-1][1],0),b.applyToY(g.o[o-1][0],g.o[o-1][1],0),b.applyToX(g.i[0][0],g.i[0][1],0),b.applyToY(g.i[0][0],g.i[0][1],0),b.applyToX(g.v[0][0],g.v[0][1],0),b.applyToY(g.v[0][0],g.v[0][1],0)),E[F]=m,F+=1}C&&(L+=S[i].l,L+=I),this.textSpans[O]?this.textSpans[O].elem=E:this.textSpans[O]={elem:E},O+=1}},CVTextElement.prototype.renderInnerContent=function(){var r,e,t,i,s,n;this.validateText(),this.canvasContext.font=this.values.fValue,this.globalData.renderer.ctxLineCap("butt"),this.globalData.renderer.ctxLineJoin("miter"),this.globalData.renderer.ctxMiterLimit(4),this.data.singleShape||this.textAnimator.getMeasures(this.textProperty.currentData,this.lettersChangedFlag);var a,o=this.textAnimator.renderedLetters,c=this.textProperty.currentData.l;e=c.length;var u,f,d=null,g=null,E=null,m=this.globalData.renderer;for(r=0;r<e;r+=1)if(!c[r].n){if((a=o[r])&&(m.save(),m.ctxTransform(a.p),m.ctxOpacity(a.o)),this.fill){for(a&&a.fc?d!==a.fc&&(m.ctxFillStyle(a.fc),d=a.fc):d!==this.values.fill&&(d=this.values.fill,m.ctxFillStyle(this.values.fill)),i=(u=this.textSpans[r].elem).length,this.globalData.canvasContext.beginPath(),t=0;t<i;t+=1)for(n=(f=u[t]).length,this.globalData.canvasContext.moveTo(f[0],f[1]),s=2;s<n;s+=6)this.globalData.canvasContext.bezierCurveTo(f[s],f[s+1],f[s+2],f[s+3],f[s+4],f[s+5]);this.globalData.canvasContext.closePath(),m.ctxFill()}if(this.stroke){for(a&&a.sw?E!==a.sw&&(E=a.sw,m.ctxLineWidth(a.sw)):E!==this.values.sWidth&&(E=this.values.sWidth,m.ctxLineWidth(this.values.sWidth)),a&&a.sc?g!==a.sc&&(g=a.sc,m.ctxStrokeStyle(a.sc)):g!==this.values.stroke&&(g=this.values.stroke,m.ctxStrokeStyle(this.values.stroke)),i=(u=this.textSpans[r].elem).length,this.globalData.canvasContext.beginPath(),t=0;t<i;t+=1)for(n=(f=u[t]).length,this.globalData.canvasContext.moveTo(f[0],f[1]),s=2;s<n;s+=6)this.globalData.canvasContext.bezierCurveTo(f[s],f[s+1],f[s+2],f[s+3],f[s+4],f[s+5]);this.globalData.canvasContext.closePath(),m.ctxStroke()}a&&this.globalData.renderer.restore()}},extendPrototype([BaseElement,TransformElement,CVBaseElement,HierarchyElement,FrameElement,RenderableElement],CVImageElement),CVImageElement.prototype.initElement=SVGShapeElement.prototype.initElement,CVImageElement.prototype.prepareFrame=IImageElement.prototype.prepareFrame,CVImageElement.prototype.createContent=function(){if(this.img.width&&(this.assetData.w!==this.img.width||this.assetData.h!==this.img.height)){var r=createTag("canvas");r.width=this.assetData.w,r.height=this.assetData.h;var e,t,i=r.getContext("2d"),s=this.img.width,n=this.img.height,a=s/n,o=this.assetData.w/this.assetData.h,c=this.assetData.pr||this.globalData.renderConfig.imagePreserveAspectRatio;a>o&&c==="xMidYMid slice"||a<o&&c!=="xMidYMid slice"?e=(t=n)*o:t=(e=s)/o,i.drawImage(this.img,(s-e)/2,(n-t)/2,e,t,0,0,this.assetData.w,this.assetData.h),this.img=r}},CVImageElement.prototype.renderInnerContent=function(){this.canvasContext.drawImage(this.img,0,0)},CVImageElement.prototype.destroy=function(){this.img=null},extendPrototype([BaseElement,TransformElement,CVBaseElement,HierarchyElement,FrameElement,RenderableElement],CVSolidElement),CVSolidElement.prototype.initElement=SVGShapeElement.prototype.initElement,CVSolidElement.prototype.prepareFrame=IImageElement.prototype.prepareFrame,CVSolidElement.prototype.renderInnerContent=function(){this.globalData.renderer.ctxFillStyle(this.data.sc),this.globalData.renderer.ctxFillRect(0,0,this.data.sw,this.data.sh)},extendPrototype([BaseRenderer],CanvasRendererBase),CanvasRendererBase.prototype.createShape=function(r){return new CVShapeElement(r,this.globalData,this)},CanvasRendererBase.prototype.createText=function(r){return new CVTextElement(r,this.globalData,this)},CanvasRendererBase.prototype.createImage=function(r){return new CVImageElement(r,this.globalData,this)},CanvasRendererBase.prototype.createSolid=function(r){return new CVSolidElement(r,this.globalData,this)},CanvasRendererBase.prototype.createNull=SVGRenderer.prototype.createNull,CanvasRendererBase.prototype.ctxTransform=function(r){r[0]===1&&r[1]===0&&r[4]===0&&r[5]===1&&r[12]===0&&r[13]===0||this.canvasContext.transform(r[0],r[1],r[4],r[5],r[12],r[13])},CanvasRendererBase.prototype.ctxOpacity=function(r){this.canvasContext.globalAlpha*=r<0?0:r},CanvasRendererBase.prototype.ctxFillStyle=function(r){this.canvasContext.fillStyle=r},CanvasRendererBase.prototype.ctxStrokeStyle=function(r){this.canvasContext.strokeStyle=r},CanvasRendererBase.prototype.ctxLineWidth=function(r){this.canvasContext.lineWidth=r},CanvasRendererBase.prototype.ctxLineCap=function(r){this.canvasContext.lineCap=r},CanvasRendererBase.prototype.ctxLineJoin=function(r){this.canvasContext.lineJoin=r},CanvasRendererBase.prototype.ctxMiterLimit=function(r){this.canvasContext.miterLimit=r},CanvasRendererBase.prototype.ctxFill=function(r){this.canvasContext.fill(r)},CanvasRendererBase.prototype.ctxFillRect=function(r,e,t,i){this.canvasContext.fillRect(r,e,t,i)},CanvasRendererBase.prototype.ctxStroke=function(){this.canvasContext.stroke()},CanvasRendererBase.prototype.reset=function(){this.renderConfig.clearCanvas?this.contextData.reset():this.canvasContext.restore()},CanvasRendererBase.prototype.save=function(){this.canvasContext.save()},CanvasRendererBase.prototype.restore=function(r){this.renderConfig.clearCanvas?(r&&(this.globalData.blendMode="source-over"),this.contextData.restore(r)):this.canvasContext.restore()},CanvasRendererBase.prototype.configAnimation=function(r){if(this.animationItem.wrapper){this.animationItem.container=createTag("canvas");var e=this.animationItem.container.style;e.width="100%",e.height="100%";var t="0px 0px 0px";e.transformOrigin=t,e.mozTransformOrigin=t,e.webkitTransformOrigin=t,e["-webkit-transform"]=t,e.contentVisibility=this.renderConfig.contentVisibility,this.animationItem.wrapper.appendChild(this.animationItem.container),this.canvasContext=this.animationItem.container.getContext("2d"),this.renderConfig.className&&this.animationItem.container.setAttribute("class",this.renderConfig.className),this.renderConfig.id&&this.animationItem.container.setAttribute("id",this.renderConfig.id)}else this.canvasContext=this.renderConfig.context;this.contextData.setContext(this.canvasContext),this.data=r,this.layers=r.layers,this.transformCanvas={w:r.w,h:r.h,sx:0,sy:0,tx:0,ty:0},this.setupGlobalData(r,document.body),this.globalData.canvasContext=this.canvasContext,this.globalData.renderer=this,this.globalData.isDashed=!1,this.globalData.progressiveLoad=this.renderConfig.progressiveLoad,this.globalData.transformCanvas=this.transformCanvas,this.elements=createSizedArray(r.layers.length),this.updateContainerSize()},CanvasRendererBase.prototype.updateContainerSize=function(r,e){var t,i,s,n;if(this.reset(),r?(t=r,i=e,this.canvasContext.canvas.width=t,this.canvasContext.canvas.height=i):(this.animationItem.wrapper&&this.animationItem.container?(t=this.animationItem.wrapper.offsetWidth,i=this.animationItem.wrapper.offsetHeight):(t=this.canvasContext.canvas.width,i=this.canvasContext.canvas.height),this.canvasContext.canvas.width=t*this.renderConfig.dpr,this.canvasContext.canvas.height=i*this.renderConfig.dpr),this.renderConfig.preserveAspectRatio.indexOf("meet")!==-1||this.renderConfig.preserveAspectRatio.indexOf("slice")!==-1){var a=this.renderConfig.preserveAspectRatio.split(" "),o=a[1]||"meet",c=a[0]||"xMidYMid",u=c.substr(0,4),f=c.substr(4);s=t/i,(n=this.transformCanvas.w/this.transformCanvas.h)>s&&o==="meet"||n<s&&o==="slice"?(this.transformCanvas.sx=t/(this.transformCanvas.w/this.renderConfig.dpr),this.transformCanvas.sy=t/(this.transformCanvas.w/this.renderConfig.dpr)):(this.transformCanvas.sx=i/(this.transformCanvas.h/this.renderConfig.dpr),this.transformCanvas.sy=i/(this.transformCanvas.h/this.renderConfig.dpr)),this.transformCanvas.tx=u==="xMid"&&(n<s&&o==="meet"||n>s&&o==="slice")?(t-this.transformCanvas.w*(i/this.transformCanvas.h))/2*this.renderConfig.dpr:u==="xMax"&&(n<s&&o==="meet"||n>s&&o==="slice")?(t-this.transformCanvas.w*(i/this.transformCanvas.h))*this.renderConfig.dpr:0,this.transformCanvas.ty=f==="YMid"&&(n>s&&o==="meet"||n<s&&o==="slice")?(i-this.transformCanvas.h*(t/this.transformCanvas.w))/2*this.renderConfig.dpr:f==="YMax"&&(n>s&&o==="meet"||n<s&&o==="slice")?(i-this.transformCanvas.h*(t/this.transformCanvas.w))*this.renderConfig.dpr:0}else this.renderConfig.preserveAspectRatio==="none"?(this.transformCanvas.sx=t/(this.transformCanvas.w/this.renderConfig.dpr),this.transformCanvas.sy=i/(this.transformCanvas.h/this.renderConfig.dpr),this.transformCanvas.tx=0,this.transformCanvas.ty=0):(this.transformCanvas.sx=this.renderConfig.dpr,this.transformCanvas.sy=this.renderConfig.dpr,this.transformCanvas.tx=0,this.transformCanvas.ty=0);this.transformCanvas.props=[this.transformCanvas.sx,0,0,0,0,this.transformCanvas.sy,0,0,0,0,1,0,this.transformCanvas.tx,this.transformCanvas.ty,0,1],this.ctxTransform(this.transformCanvas.props),this.canvasContext.beginPath(),this.canvasContext.rect(0,0,this.transformCanvas.w,this.transformCanvas.h),this.canvasContext.closePath(),this.canvasContext.clip(),this.renderFrame(this.renderedFrame,!0)},CanvasRendererBase.prototype.destroy=function(){var r;for(this.renderConfig.clearCanvas&&this.animationItem.wrapper&&(this.animationItem.wrapper.innerText=""),r=(this.layers?this.layers.length:0)-1;r>=0;r-=1)this.elements[r]&&this.elements[r].destroy&&this.elements[r].destroy();this.elements.length=0,this.globalData.canvasContext=null,this.animationItem.container=null,this.destroyed=!0},CanvasRendererBase.prototype.renderFrame=function(r,e){if((this.renderedFrame!==r||this.renderConfig.clearCanvas!==!0||e)&&!this.destroyed&&r!==-1){var t;this.renderedFrame=r,this.globalData.frameNum=r-this.animationItem._isFirstFrame,this.globalData.frameId+=1,this.globalData._mdf=!this.renderConfig.clearCanvas||e,this.globalData.projectInterface.currentFrame=r;var i=this.layers.length;for(this.completeLayers||this.checkLayers(r),t=i-1;t>=0;t-=1)(this.completeLayers||this.elements[t])&&this.elements[t].prepareFrame(r-this.layers[t].st);if(this.globalData._mdf){for(this.renderConfig.clearCanvas===!0?this.canvasContext.clearRect(0,0,this.transformCanvas.w,this.transformCanvas.h):this.save(),t=i-1;t>=0;t-=1)(this.completeLayers||this.elements[t])&&this.elements[t].renderFrame();this.renderConfig.clearCanvas!==!0&&this.restore()}}},CanvasRendererBase.prototype.buildItem=function(r){var e=this.elements;if(!e[r]&&this.layers[r].ty!==99){var t=this.createItem(this.layers[r],this,this.globalData);e[r]=t,t.initExpressions()}},CanvasRendererBase.prototype.checkPendingElements=function(){for(;this.pendingElements.length;)this.pendingElements.pop().checkParenting()},CanvasRendererBase.prototype.hide=function(){this.animationItem.container.style.display="none"},CanvasRendererBase.prototype.show=function(){this.animationItem.container.style.display="block"},CVContextData.prototype.duplicate=function(){var r=2*this._length,e=0;for(e=this._length;e<r;e+=1)this.stack[e]=new CanvasContext;this._length=r},CVContextData.prototype.reset=function(){this.cArrPos=0,this.cTr.reset(),this.stack[this.cArrPos].opacity=1},CVContextData.prototype.restore=function(r){this.cArrPos-=1;var e,t=this.stack[this.cArrPos],i=t.transform,s=this.cTr.props;for(e=0;e<16;e+=1)s[e]=i[e];if(r){this.nativeContext.restore();var n=this.stack[this.cArrPos+1];this.appliedFillStyle=n.fillStyle,this.appliedStrokeStyle=n.strokeStyle,this.appliedLineWidth=n.lineWidth,this.appliedLineCap=n.lineCap,this.appliedLineJoin=n.lineJoin,this.appliedMiterLimit=n.miterLimit}this.nativeContext.setTransform(i[0],i[1],i[4],i[5],i[12],i[13]),(r||t.opacity!==-1&&this.currentOpacity!==t.opacity)&&(this.nativeContext.globalAlpha=t.opacity,this.currentOpacity=t.opacity),this.currentFillStyle=t.fillStyle,this.currentStrokeStyle=t.strokeStyle,this.currentLineWidth=t.lineWidth,this.currentLineCap=t.lineCap,this.currentLineJoin=t.lineJoin,this.currentMiterLimit=t.miterLimit},CVContextData.prototype.save=function(r){r&&this.nativeContext.save();var e=this.cTr.props;this._length<=this.cArrPos&&this.duplicate();var t,i=this.stack[this.cArrPos];for(t=0;t<16;t+=1)i.transform[t]=e[t];this.cArrPos+=1;var s=this.stack[this.cArrPos];s.opacity=i.opacity,s.fillStyle=i.fillStyle,s.strokeStyle=i.strokeStyle,s.lineWidth=i.lineWidth,s.lineCap=i.lineCap,s.lineJoin=i.lineJoin,s.miterLimit=i.miterLimit},CVContextData.prototype.setOpacity=function(r){this.stack[this.cArrPos].opacity=r},CVContextData.prototype.setContext=function(r){this.nativeContext=r},CVContextData.prototype.fillStyle=function(r){this.stack[this.cArrPos].fillStyle!==r&&(this.currentFillStyle=r,this.stack[this.cArrPos].fillStyle=r)},CVContextData.prototype.strokeStyle=function(r){this.stack[this.cArrPos].strokeStyle!==r&&(this.currentStrokeStyle=r,this.stack[this.cArrPos].strokeStyle=r)},CVContextData.prototype.lineWidth=function(r){this.stack[this.cArrPos].lineWidth!==r&&(this.currentLineWidth=r,this.stack[this.cArrPos].lineWidth=r)},CVContextData.prototype.lineCap=function(r){this.stack[this.cArrPos].lineCap!==r&&(this.currentLineCap=r,this.stack[this.cArrPos].lineCap=r)},CVContextData.prototype.lineJoin=function(r){this.stack[this.cArrPos].lineJoin!==r&&(this.currentLineJoin=r,this.stack[this.cArrPos].lineJoin=r)},CVContextData.prototype.miterLimit=function(r){this.stack[this.cArrPos].miterLimit!==r&&(this.currentMiterLimit=r,this.stack[this.cArrPos].miterLimit=r)},CVContextData.prototype.transform=function(r){this.transformMat.cloneFromProps(r);var e=this.cTr;this.transformMat.multiply(e),e.cloneFromProps(this.transformMat.props);var t=e.props;this.nativeContext.setTransform(t[0],t[1],t[4],t[5],t[12],t[13])},CVContextData.prototype.opacity=function(r){var e=this.stack[this.cArrPos].opacity;e*=r<0?0:r,this.stack[this.cArrPos].opacity!==e&&(this.currentOpacity!==r&&(this.nativeContext.globalAlpha=r,this.currentOpacity=r),this.stack[this.cArrPos].opacity=e)},CVContextData.prototype.fill=function(r){this.appliedFillStyle!==this.currentFillStyle&&(this.appliedFillStyle=this.currentFillStyle,this.nativeContext.fillStyle=this.appliedFillStyle),this.nativeContext.fill(r)},CVContextData.prototype.fillRect=function(r,e,t,i){this.appliedFillStyle!==this.currentFillStyle&&(this.appliedFillStyle=this.currentFillStyle,this.nativeContext.fillStyle=this.appliedFillStyle),this.nativeContext.fillRect(r,e,t,i)},CVContextData.prototype.stroke=function(){this.appliedStrokeStyle!==this.currentStrokeStyle&&(this.appliedStrokeStyle=this.currentStrokeStyle,this.nativeContext.strokeStyle=this.appliedStrokeStyle),this.appliedLineWidth!==this.currentLineWidth&&(this.appliedLineWidth=this.currentLineWidth,this.nativeContext.lineWidth=this.appliedLineWidth),this.appliedLineCap!==this.currentLineCap&&(this.appliedLineCap=this.currentLineCap,this.nativeContext.lineCap=this.appliedLineCap),this.appliedLineJoin!==this.currentLineJoin&&(this.appliedLineJoin=this.currentLineJoin,this.nativeContext.lineJoin=this.appliedLineJoin),this.appliedMiterLimit!==this.currentMiterLimit&&(this.appliedMiterLimit=this.currentMiterLimit,this.nativeContext.miterLimit=this.appliedMiterLimit),this.nativeContext.stroke()},extendPrototype([CanvasRendererBase,ICompElement,CVBaseElement],CVCompElement),CVCompElement.prototype.renderInnerContent=function(){var r,e=this.canvasContext;for(e.beginPath(),e.moveTo(0,0),e.lineTo(this.data.w,0),e.lineTo(this.data.w,this.data.h),e.lineTo(0,this.data.h),e.lineTo(0,0),e.clip(),r=this.layers.length-1;r>=0;r-=1)(this.completeLayers||this.elements[r])&&this.elements[r].renderFrame()},CVCompElement.prototype.destroy=function(){var r;for(r=this.layers.length-1;r>=0;r-=1)this.elements[r]&&this.elements[r].destroy();this.layers=null,this.elements=null},CVCompElement.prototype.createComp=function(r){return new CVCompElement(r,this.globalData,this)},extendPrototype([CanvasRendererBase],CanvasRenderer),CanvasRenderer.prototype.createComp=function(r){return new CVCompElement(r,this.globalData,this)},HBaseElement.prototype={checkBlendMode:function(){},initRendererElement:function(){this.baseElement=createTag(this.data.tg||"div"),this.data.hasMask?(this.svgElement=createNS("svg"),this.layerElement=createNS("g"),this.maskedElement=this.layerElement,this.svgElement.appendChild(this.layerElement),this.baseElement.appendChild(this.svgElement)):this.layerElement=this.baseElement,styleDiv(this.baseElement)},createContainerElements:function(){this.renderableEffectsManager=new CVEffects(this),this.transformedElement=this.baseElement,this.maskedElement=this.layerElement,this.data.ln&&this.layerElement.setAttribute("id",this.data.ln),this.data.cl&&this.layerElement.setAttribute("class",this.data.cl),this.data.bm!==0&&this.setBlendMode()},renderElement:function(){var r=this.transformedElement?this.transformedElement.style:{};if(this.finalTransform._matMdf){var e=this.finalTransform.mat.toCSS();r.transform=e,r.webkitTransform=e}this.finalTransform._opMdf&&(r.opacity=this.finalTransform.mProp.o.v)},renderFrame:function(){this.data.hd||this.hidden||(this.renderTransform(),this.renderRenderable(),this.renderElement(),this.renderInnerContent(),this._isFirstFrame&&(this._isFirstFrame=!1))},destroy:function(){this.layerElement=null,this.transformedElement=null,this.matteElement&&(this.matteElement=null),this.maskManager&&(this.maskManager.destroy(),this.maskManager=null)},createRenderableComponents:function(){this.maskManager=new MaskElement(this.data,this,this.globalData)},addEffects:function(){},setMatte:function(){}},HBaseElement.prototype.getBaseElement=SVGBaseElement.prototype.getBaseElement,HBaseElement.prototype.destroyBaseElement=HBaseElement.prototype.destroy,HBaseElement.prototype.buildElementParenting=BaseRenderer.prototype.buildElementParenting,extendPrototype([BaseElement,TransformElement,HBaseElement,HierarchyElement,FrameElement,RenderableDOMElement],HSolidElement),HSolidElement.prototype.createContent=function(){var r;this.data.hasMask?((r=createNS("rect")).setAttribute("width",this.data.sw),r.setAttribute("height",this.data.sh),r.setAttribute("fill",this.data.sc),this.svgElement.setAttribute("width",this.data.sw),this.svgElement.setAttribute("height",this.data.sh)):((r=createTag("div")).style.width=this.data.sw+"px",r.style.height=this.data.sh+"px",r.style.backgroundColor=this.data.sc),this.layerElement.appendChild(r)},extendPrototype([BaseElement,TransformElement,HSolidElement,SVGShapeElement,HBaseElement,HierarchyElement,FrameElement,RenderableElement],HShapeElement),HShapeElement.prototype._renderShapeFrame=HShapeElement.prototype.renderInnerContent,HShapeElement.prototype.createContent=function(){var r;if(this.baseElement.style.fontSize=0,this.data.hasMask)this.layerElement.appendChild(this.shapesContainer),r=this.svgElement;else{r=createNS("svg");var e=this.comp.data?this.comp.data:this.globalData.compSize;r.setAttribute("width",e.w),r.setAttribute("height",e.h),r.appendChild(this.shapesContainer),this.layerElement.appendChild(r)}this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.shapesContainer,0,[],!0),this.filterUniqueShapes(),this.shapeCont=r},HShapeElement.prototype.getTransformedPoint=function(r,e){var t,i=r.length;for(t=0;t<i;t+=1)e=r[t].mProps.v.applyToPointArray(e[0],e[1],0);return e},HShapeElement.prototype.calculateShapeBoundingBox=function(r,e){var t,i,s,n,a,o=r.sh.v,c=r.transformers,u=o._length;if(!(u<=1)){for(t=0;t<u-1;t+=1)i=this.getTransformedPoint(c,o.v[t]),s=this.getTransformedPoint(c,o.o[t]),n=this.getTransformedPoint(c,o.i[t+1]),a=this.getTransformedPoint(c,o.v[t+1]),this.checkBounds(i,s,n,a,e);o.c&&(i=this.getTransformedPoint(c,o.v[t]),s=this.getTransformedPoint(c,o.o[t]),n=this.getTransformedPoint(c,o.i[0]),a=this.getTransformedPoint(c,o.v[0]),this.checkBounds(i,s,n,a,e))}},HShapeElement.prototype.checkBounds=function(r,e,t,i,s){this.getBoundsOfCurve(r,e,t,i);var n=this.shapeBoundingBox;s.x=bmMin(n.left,s.x),s.xMax=bmMax(n.right,s.xMax),s.y=bmMin(n.top,s.y),s.yMax=bmMax(n.bottom,s.yMax)},HShapeElement.prototype.shapeBoundingBox={left:0,right:0,top:0,bottom:0},HShapeElement.prototype.tempBoundingBox={x:0,xMax:0,y:0,yMax:0,width:0,height:0},HShapeElement.prototype.getBoundsOfCurve=function(r,e,t,i){for(var s,n,a,o,c,u,f,d=[[r[0],i[0]],[r[1],i[1]]],g=0;g<2;++g)n=6*r[g]-12*e[g]+6*t[g],s=-3*r[g]+9*e[g]-9*t[g]+3*i[g],a=3*e[g]-3*r[g],n|=0,a|=0,(s|=0)===0&&n===0||(s===0?(o=-a/n)>0&&o<1&&d[g].push(this.calculateF(o,r,e,t,i,g)):(c=n*n-4*a*s)>=0&&((u=(-n+bmSqrt(c))/(2*s))>0&&u<1&&d[g].push(this.calculateF(u,r,e,t,i,g)),(f=(-n-bmSqrt(c))/(2*s))>0&&f<1&&d[g].push(this.calculateF(f,r,e,t,i,g))));this.shapeBoundingBox.left=bmMin.apply(null,d[0]),this.shapeBoundingBox.top=bmMin.apply(null,d[1]),this.shapeBoundingBox.right=bmMax.apply(null,d[0]),this.shapeBoundingBox.bottom=bmMax.apply(null,d[1])},HShapeElement.prototype.calculateF=function(r,e,t,i,s,n){return bmPow(1-r,3)*e[n]+3*bmPow(1-r,2)*r*t[n]+3*(1-r)*bmPow(r,2)*i[n]+bmPow(r,3)*s[n]},HShapeElement.prototype.calculateBoundingBox=function(r,e){var t,i=r.length;for(t=0;t<i;t+=1)r[t]&&r[t].sh?this.calculateShapeBoundingBox(r[t],e):r[t]&&r[t].it?this.calculateBoundingBox(r[t].it,e):r[t]&&r[t].style&&r[t].w&&this.expandStrokeBoundingBox(r[t].w,e)},HShapeElement.prototype.expandStrokeBoundingBox=function(r,e){var t=0;if(r.keyframes){for(var i=0;i<r.keyframes.length;i+=1){var s=r.keyframes[i].s;s>t&&(t=s)}t*=r.mult}else t=r.v*r.mult;e.x-=t,e.xMax+=t,e.y-=t,e.yMax+=t},HShapeElement.prototype.currentBoxContains=function(r){return this.currentBBox.x<=r.x&&this.currentBBox.y<=r.y&&this.currentBBox.width+this.currentBBox.x>=r.x+r.width&&this.currentBBox.height+this.currentBBox.y>=r.y+r.height},HShapeElement.prototype.renderInnerContent=function(){if(this._renderShapeFrame(),!this.hidden&&(this._isFirstFrame||this._mdf)){var r=this.tempBoundingBox,e=999999;if(r.x=e,r.xMax=-e,r.y=e,r.yMax=-e,this.calculateBoundingBox(this.itemsData,r),r.width=r.xMax<r.x?0:r.xMax-r.x,r.height=r.yMax<r.y?0:r.yMax-r.y,this.currentBoxContains(r))return;var t=!1;if(this.currentBBox.w!==r.width&&(this.currentBBox.w=r.width,this.shapeCont.setAttribute("width",r.width),t=!0),this.currentBBox.h!==r.height&&(this.currentBBox.h=r.height,this.shapeCont.setAttribute("height",r.height),t=!0),t||this.currentBBox.x!==r.x||this.currentBBox.y!==r.y){this.currentBBox.w=r.width,this.currentBBox.h=r.height,this.currentBBox.x=r.x,this.currentBBox.y=r.y,this.shapeCont.setAttribute("viewBox",this.currentBBox.x+" "+this.currentBBox.y+" "+this.currentBBox.w+" "+this.currentBBox.h);var i=this.shapeCont.style,s="translate("+this.currentBBox.x+"px,"+this.currentBBox.y+"px)";i.transform=s,i.webkitTransform=s}}},extendPrototype([BaseElement,TransformElement,HBaseElement,HierarchyElement,FrameElement,RenderableDOMElement,ITextElement],HTextElement),HTextElement.prototype.createContent=function(){if(this.isMasked=this.checkMasks(),this.isMasked){this.renderType="svg",this.compW=this.comp.data.w,this.compH=this.comp.data.h,this.svgElement.setAttribute("width",this.compW),this.svgElement.setAttribute("height",this.compH);var r=createNS("g");this.maskedElement.appendChild(r),this.innerElem=r}else this.renderType="html",this.innerElem=this.layerElement;this.checkParenting()},HTextElement.prototype.buildNewText=function(){var r=this.textProperty.currentData;this.renderedLetters=createSizedArray(r.l?r.l.length:0);var e=this.innerElem.style,t=r.fc?this.buildColor(r.fc):"rgba(0,0,0,0)";e.fill=t,e.color=t,r.sc&&(e.stroke=this.buildColor(r.sc),e.strokeWidth=r.sw+"px");var i,s,n=this.globalData.fontManager.getFontByName(r.f);if(!this.globalData.fontManager.chars)if(e.fontSize=r.finalSize+"px",e.lineHeight=r.finalSize+"px",n.fClass)this.innerElem.className=n.fClass;else{e.fontFamily=n.fFamily;var a=r.fWeight,o=r.fStyle;e.fontStyle=o,e.fontWeight=a}var c,u,f,d=r.l;s=d.length;var g,E=this.mHelper,m="",T=0;for(i=0;i<s;i+=1){if(this.globalData.fontManager.chars?(this.textPaths[T]?c=this.textPaths[T]:((c=createNS("path")).setAttribute("stroke-linecap",lineCapEnum[1]),c.setAttribute("stroke-linejoin",lineJoinEnum[2]),c.setAttribute("stroke-miterlimit","4")),this.isMasked||(this.textSpans[T]?f=(u=this.textSpans[T]).children[0]:((u=createTag("div")).style.lineHeight=0,(f=createNS("svg")).appendChild(c),styleDiv(u)))):this.isMasked?c=this.textPaths[T]?this.textPaths[T]:createNS("text"):this.textSpans[T]?(u=this.textSpans[T],c=this.textPaths[T]):(styleDiv(u=createTag("span")),styleDiv(c=createTag("span")),u.appendChild(c)),this.globalData.fontManager.chars){var S,b=this.globalData.fontManager.getCharData(r.finalText[i],n.fStyle,this.globalData.fontManager.getFontByName(r.f).fFamily);if(S=b?b.data:null,E.reset(),S&&S.shapes&&S.shapes.length&&(g=S.shapes[0].it,E.scale(r.finalSize/100,r.finalSize/100),m=this.createPathShape(E,g),c.setAttribute("d",m)),this.isMasked)this.innerElem.appendChild(c);else{if(this.innerElem.appendChild(u),S&&S.shapes){document.body.appendChild(f);var C=f.getBBox();f.setAttribute("width",C.width+2),f.setAttribute("height",C.height+2),f.setAttribute("viewBox",C.x-1+" "+(C.y-1)+" "+(C.width+2)+" "+(C.height+2));var I=f.style,L="translate("+(C.x-1)+"px,"+(C.y-1)+"px)";I.transform=L,I.webkitTransform=L,d[i].yOffset=C.y-1}else f.setAttribute("width",1),f.setAttribute("height",1);u.appendChild(f)}}else if(c.textContent=d[i].val,c.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),this.isMasked)this.innerElem.appendChild(c);else{this.innerElem.appendChild(u);var k=c.style,U="translate3d(0,"+-r.finalSize/1.2+"px,0)";k.transform=U,k.webkitTransform=U}this.isMasked?this.textSpans[T]=c:this.textSpans[T]=u,this.textSpans[T].style.display="block",this.textPaths[T]=c,T+=1}for(;T<this.textSpans.length;)this.textSpans[T].style.display="none",T+=1},HTextElement.prototype.renderInnerContent=function(){var r;if(this.validateText(),this.data.singleShape){if(!this._isFirstFrame&&!this.lettersChangedFlag)return;if(this.isMasked&&this.finalTransform._matMdf){this.svgElement.setAttribute("viewBox",-this.finalTransform.mProp.p.v[0]+" "+-this.finalTransform.mProp.p.v[1]+" "+this.compW+" "+this.compH),r=this.svgElement.style;var e="translate("+-this.finalTransform.mProp.p.v[0]+"px,"+-this.finalTransform.mProp.p.v[1]+"px)";r.transform=e,r.webkitTransform=e}}if(this.textAnimator.getMeasures(this.textProperty.currentData,this.lettersChangedFlag),this.lettersChangedFlag||this.textAnimator.lettersChangedFlag){var t,i,s,n,a,o=0,c=this.textAnimator.renderedLetters,u=this.textProperty.currentData.l;for(i=u.length,t=0;t<i;t+=1)u[t].n?o+=1:(n=this.textSpans[t],a=this.textPaths[t],s=c[o],o+=1,s._mdf.m&&(this.isMasked?n.setAttribute("transform",s.m):(n.style.webkitTransform=s.m,n.style.transform=s.m)),n.style.opacity=s.o,s.sw&&s._mdf.sw&&a.setAttribute("stroke-width",s.sw),s.sc&&s._mdf.sc&&a.setAttribute("stroke",s.sc),s.fc&&s._mdf.fc&&(a.setAttribute("fill",s.fc),a.style.color=s.fc));if(this.innerElem.getBBox&&!this.hidden&&(this._isFirstFrame||this._mdf)){var f=this.innerElem.getBBox();if(this.currentBBox.w!==f.width&&(this.currentBBox.w=f.width,this.svgElement.setAttribute("width",f.width)),this.currentBBox.h!==f.height&&(this.currentBBox.h=f.height,this.svgElement.setAttribute("height",f.height)),this.currentBBox.w!==f.width+2||this.currentBBox.h!==f.height+2||this.currentBBox.x!==f.x-1||this.currentBBox.y!==f.y-1){this.currentBBox.w=f.width+2,this.currentBBox.h=f.height+2,this.currentBBox.x=f.x-1,this.currentBBox.y=f.y-1,this.svgElement.setAttribute("viewBox",this.currentBBox.x+" "+this.currentBBox.y+" "+this.currentBBox.w+" "+this.currentBBox.h),r=this.svgElement.style;var d="translate("+this.currentBBox.x+"px,"+this.currentBBox.y+"px)";r.transform=d,r.webkitTransform=d}}}},extendPrototype([BaseElement,FrameElement,HierarchyElement],HCameraElement),HCameraElement.prototype.setup=function(){var r,e,t,i,s=this.comp.threeDElements.length;for(r=0;r<s;r+=1)if((e=this.comp.threeDElements[r]).type==="3d"){t=e.perspectiveElem.style,i=e.container.style;var n=this.pe.v+"px",a="matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)";t.perspective=n,t.webkitPerspective=n,i.transformOrigin="0px 0px 0px",i.mozTransformOrigin="0px 0px 0px",i.webkitTransformOrigin="0px 0px 0px",t.transform=a,t.webkitTransform=a}},HCameraElement.prototype.createElements=function(){},HCameraElement.prototype.hide=function(){},HCameraElement.prototype.renderFrame=function(){var r,e,t=this._isFirstFrame;if(this.hierarchy)for(e=this.hierarchy.length,r=0;r<e;r+=1)t=this.hierarchy[r].finalTransform.mProp._mdf||t;if(t||this.pe._mdf||this.p&&this.p._mdf||this.px&&(this.px._mdf||this.py._mdf||this.pz._mdf)||this.rx._mdf||this.ry._mdf||this.rz._mdf||this.or._mdf||this.a&&this.a._mdf){if(this.mat.reset(),this.hierarchy)for(r=e=this.hierarchy.length-1;r>=0;r-=1){var i=this.hierarchy[r].finalTransform.mProp;this.mat.translate(-i.p.v[0],-i.p.v[1],i.p.v[2]),this.mat.rotateX(-i.or.v[0]).rotateY(-i.or.v[1]).rotateZ(i.or.v[2]),this.mat.rotateX(-i.rx.v).rotateY(-i.ry.v).rotateZ(i.rz.v),this.mat.scale(1/i.s.v[0],1/i.s.v[1],1/i.s.v[2]),this.mat.translate(i.a.v[0],i.a.v[1],i.a.v[2])}if(this.p?this.mat.translate(-this.p.v[0],-this.p.v[1],this.p.v[2]):this.mat.translate(-this.px.v,-this.py.v,this.pz.v),this.a){var s;s=this.p?[this.p.v[0]-this.a.v[0],this.p.v[1]-this.a.v[1],this.p.v[2]-this.a.v[2]]:[this.px.v-this.a.v[0],this.py.v-this.a.v[1],this.pz.v-this.a.v[2]];var n=Math.sqrt(Math.pow(s[0],2)+Math.pow(s[1],2)+Math.pow(s[2],2)),a=[s[0]/n,s[1]/n,s[2]/n],o=Math.sqrt(a[2]*a[2]+a[0]*a[0]),c=Math.atan2(a[1],o),u=Math.atan2(a[0],-a[2]);this.mat.rotateY(u).rotateX(-c)}this.mat.rotateX(-this.rx.v).rotateY(-this.ry.v).rotateZ(this.rz.v),this.mat.rotateX(-this.or.v[0]).rotateY(-this.or.v[1]).rotateZ(this.or.v[2]),this.mat.translate(this.globalData.compSize.w/2,this.globalData.compSize.h/2,0),this.mat.translate(0,0,this.pe.v);var f=!this._prevMat.equals(this.mat);if((f||this.pe._mdf)&&this.comp.threeDElements){var d,g,E;for(e=this.comp.threeDElements.length,r=0;r<e;r+=1)if((d=this.comp.threeDElements[r]).type==="3d"){if(f){var m=this.mat.toCSS();(E=d.container.style).transform=m,E.webkitTransform=m}this.pe._mdf&&((g=d.perspectiveElem.style).perspective=this.pe.v+"px",g.webkitPerspective=this.pe.v+"px")}this.mat.clone(this._prevMat)}}this._isFirstFrame=!1},HCameraElement.prototype.prepareFrame=function(r){this.prepareProperties(r,!0)},HCameraElement.prototype.destroy=function(){},HCameraElement.prototype.getBaseElement=function(){return null},extendPrototype([BaseElement,TransformElement,HBaseElement,HSolidElement,HierarchyElement,FrameElement,RenderableElement],HImageElement),HImageElement.prototype.createContent=function(){var r=this.globalData.getAssetsPath(this.assetData),e=new Image;this.data.hasMask?(this.imageElem=createNS("image"),this.imageElem.setAttribute("width",this.assetData.w+"px"),this.imageElem.setAttribute("height",this.assetData.h+"px"),this.imageElem.setAttributeNS("http://www.w3.org/1999/xlink","href",r),this.layerElement.appendChild(this.imageElem),this.baseElement.setAttribute("width",this.assetData.w),this.baseElement.setAttribute("height",this.assetData.h)):this.layerElement.appendChild(e),e.crossOrigin="anonymous",e.src=r,this.data.ln&&this.baseElement.setAttribute("id",this.data.ln)},extendPrototype([BaseRenderer],HybridRendererBase),HybridRendererBase.prototype.buildItem=SVGRenderer.prototype.buildItem,HybridRendererBase.prototype.checkPendingElements=function(){for(;this.pendingElements.length;)this.pendingElements.pop().checkParenting()},HybridRendererBase.prototype.appendElementInPos=function(r,e){var t=r.getBaseElement();if(t){var i=this.layers[e];if(i.ddd&&this.supports3d)this.addTo3dContainer(t,e);else if(this.threeDElements)this.addTo3dContainer(t,e);else{for(var s,n,a=0;a<e;)this.elements[a]&&this.elements[a]!==!0&&this.elements[a].getBaseElement&&(n=this.elements[a],s=(this.layers[a].ddd?this.getThreeDContainerByPos(a):n.getBaseElement())||s),a+=1;s?i.ddd&&this.supports3d||this.layerElement.insertBefore(t,s):i.ddd&&this.supports3d||this.layerElement.appendChild(t)}}},HybridRendererBase.prototype.createShape=function(r){return this.supports3d?new HShapeElement(r,this.globalData,this):new SVGShapeElement(r,this.globalData,this)},HybridRendererBase.prototype.createText=function(r){return this.supports3d?new HTextElement(r,this.globalData,this):new SVGTextLottieElement(r,this.globalData,this)},HybridRendererBase.prototype.createCamera=function(r){return this.camera=new HCameraElement(r,this.globalData,this),this.camera},HybridRendererBase.prototype.createImage=function(r){return this.supports3d?new HImageElement(r,this.globalData,this):new IImageElement(r,this.globalData,this)},HybridRendererBase.prototype.createSolid=function(r){return this.supports3d?new HSolidElement(r,this.globalData,this):new ISolidElement(r,this.globalData,this)},HybridRendererBase.prototype.createNull=SVGRenderer.prototype.createNull,HybridRendererBase.prototype.getThreeDContainerByPos=function(r){for(var e=0,t=this.threeDElements.length;e<t;){if(this.threeDElements[e].startPos<=r&&this.threeDElements[e].endPos>=r)return this.threeDElements[e].perspectiveElem;e+=1}return null},HybridRendererBase.prototype.createThreeDContainer=function(r,e){var t,i,s=createTag("div");styleDiv(s);var n=createTag("div");if(styleDiv(n),e==="3d"){(t=s.style).width=this.globalData.compSize.w+"px",t.height=this.globalData.compSize.h+"px",t.webkitTransformOrigin="50% 50%",t.mozTransformOrigin="50% 50%",t.transformOrigin="50% 50%";var a="matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)";(i=n.style).transform=a,i.webkitTransform=a}s.appendChild(n);var o={container:n,perspectiveElem:s,startPos:r,endPos:r,type:e};return this.threeDElements.push(o),o},HybridRendererBase.prototype.build3dContainers=function(){var r,e,t=this.layers.length,i="";for(r=0;r<t;r+=1)this.layers[r].ddd&&this.layers[r].ty!==3?(i!=="3d"&&(i="3d",e=this.createThreeDContainer(r,"3d")),e.endPos=Math.max(e.endPos,r)):(i!=="2d"&&(i="2d",e=this.createThreeDContainer(r,"2d")),e.endPos=Math.max(e.endPos,r));for(r=(t=this.threeDElements.length)-1;r>=0;r-=1)this.resizerElem.appendChild(this.threeDElements[r].perspectiveElem)},HybridRendererBase.prototype.addTo3dContainer=function(r,e){for(var t=0,i=this.threeDElements.length;t<i;){if(e<=this.threeDElements[t].endPos){for(var s,n=this.threeDElements[t].startPos;n<e;)this.elements[n]&&this.elements[n].getBaseElement&&(s=this.elements[n].getBaseElement()),n+=1;s?this.threeDElements[t].container.insertBefore(r,s):this.threeDElements[t].container.appendChild(r);break}t+=1}},HybridRendererBase.prototype.configAnimation=function(r){var e=createTag("div"),t=this.animationItem.wrapper,i=e.style;i.width=r.w+"px",i.height=r.h+"px",this.resizerElem=e,styleDiv(e),i.transformStyle="flat",i.mozTransformStyle="flat",i.webkitTransformStyle="flat",this.renderConfig.className&&e.setAttribute("class",this.renderConfig.className),t.appendChild(e),i.overflow="hidden";var s=createNS("svg");s.setAttribute("width","1"),s.setAttribute("height","1"),styleDiv(s),this.resizerElem.appendChild(s);var n=createNS("defs");s.appendChild(n),this.data=r,this.setupGlobalData(r,s),this.globalData.defs=n,this.layers=r.layers,this.layerElement=this.resizerElem,this.build3dContainers(),this.updateContainerSize()},HybridRendererBase.prototype.destroy=function(){var r;this.animationItem.wrapper&&(this.animationItem.wrapper.innerText=""),this.animationItem.container=null,this.globalData.defs=null;var e=this.layers?this.layers.length:0;for(r=0;r<e;r+=1)this.elements[r]&&this.elements[r].destroy&&this.elements[r].destroy();this.elements.length=0,this.destroyed=!0,this.animationItem=null},HybridRendererBase.prototype.updateContainerSize=function(){var r,e,t,i,s=this.animationItem.wrapper.offsetWidth,n=this.animationItem.wrapper.offsetHeight,a=s/n;this.globalData.compSize.w/this.globalData.compSize.h>a?(r=s/this.globalData.compSize.w,e=s/this.globalData.compSize.w,t=0,i=(n-this.globalData.compSize.h*(s/this.globalData.compSize.w))/2):(r=n/this.globalData.compSize.h,e=n/this.globalData.compSize.h,t=(s-this.globalData.compSize.w*(n/this.globalData.compSize.h))/2,i=0);var o=this.resizerElem.style;o.webkitTransform="matrix3d("+r+",0,0,0,0,"+e+",0,0,0,0,1,0,"+t+","+i+",0,1)",o.transform=o.webkitTransform},HybridRendererBase.prototype.renderFrame=SVGRenderer.prototype.renderFrame,HybridRendererBase.prototype.hide=function(){this.resizerElem.style.display="none"},HybridRendererBase.prototype.show=function(){this.resizerElem.style.display="block"},HybridRendererBase.prototype.initItems=function(){if(this.buildAllItems(),this.camera)this.camera.setup();else{var r,e=this.globalData.compSize.w,t=this.globalData.compSize.h,i=this.threeDElements.length;for(r=0;r<i;r+=1){var s=this.threeDElements[r].perspectiveElem.style;s.webkitPerspective=Math.sqrt(Math.pow(e,2)+Math.pow(t,2))+"px",s.perspective=s.webkitPerspective}}},HybridRendererBase.prototype.searchExtraCompositions=function(r){var e,t=r.length,i=createTag("div");for(e=0;e<t;e+=1)if(r[e].xt){var s=this.createComp(r[e],i,this.globalData.comp,null);s.initExpressions(),this.globalData.projectInterface.registerComposition(s)}},extendPrototype([HybridRendererBase,ICompElement,HBaseElement],HCompElement),HCompElement.prototype._createBaseContainerElements=HCompElement.prototype.createContainerElements,HCompElement.prototype.createContainerElements=function(){this._createBaseContainerElements(),this.data.hasMask?(this.svgElement.setAttribute("width",this.data.w),this.svgElement.setAttribute("height",this.data.h),this.transformedElement=this.baseElement):this.transformedElement=this.layerElement},HCompElement.prototype.addTo3dContainer=function(r,e){for(var t,i=0;i<e;)this.elements[i]&&this.elements[i].getBaseElement&&(t=this.elements[i].getBaseElement()),i+=1;t?this.layerElement.insertBefore(r,t):this.layerElement.appendChild(r)},HCompElement.prototype.createComp=function(r){return this.supports3d?new HCompElement(r,this.globalData,this):new SVGCompElement(r,this.globalData,this)},extendPrototype([HybridRendererBase],HybridRenderer),HybridRenderer.prototype.createComp=function(r){return this.supports3d?new HCompElement(r,this.globalData,this):new SVGCompElement(r,this.globalData,this)};var CompExpressionInterface=function(r){function e(t){for(var i=0,s=r.layers.length;i<s;){if(r.layers[i].nm===t||r.layers[i].ind===t)return r.elements[i].layerInterface;i+=1}return null}return Object.defineProperty(e,"_name",{value:r.data.nm}),e.layer=e,e.pixelAspect=1,e.height=r.data.h||r.globalData.compSize.h,e.width=r.data.w||r.globalData.compSize.w,e.pixelAspect=1,e.frameDuration=1/r.globalData.frameRate,e.displayStartTime=0,e.numLayers=r.layers.length,e};function _typeof$2(r){return(_typeof$2=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(r)}function seedRandom(r,e){var t=this,i=e.pow(256,6),s=e.pow(2,52),n=2*s;function a(f){var d,g=f.length,E=this,m=0,T=E.i=E.j=0,S=E.S=[];for(g||(f=[g++]);m<256;)S[m]=m++;for(m=0;m<256;m++)S[m]=S[T=255&T+f[m%g]+(d=S[m])],S[T]=d;E.g=function(b){for(var C,I=0,L=E.i,k=E.j,U=E.S;b--;)C=U[L=255&L+1],I=256*I+U[255&(U[L]=U[k=255&k+C])+(U[k]=C)];return E.i=L,E.j=k,I}}function o(f,d){return d.i=f.i,d.j=f.j,d.S=f.S.slice(),d}function c(f,d){for(var g,E=f+"",m=0;m<E.length;)d[255&m]=255&(g^=19*d[255&m])+E.charCodeAt(m++);return u(d)}function u(f){return String.fromCharCode.apply(0,f)}e.seedrandom=function(f,d,g){var E=[],m=c((function b(C,I){var L,k=[],U=_typeof$2(C);if(I&&U=="object")for(L in C)try{k.push(b(C[L],I-1))}catch{}return k.length?k:U=="string"?C:C+"\0"})((d=d===!0?{entropy:!0}:d||{}).entropy?[f,u(r)]:f===null?(function(){try{var b=new Uint8Array(256);return(t.crypto||t.msCrypto).getRandomValues(b),u(b)}catch{var C=t.navigator,I=C&&C.plugins;return[+new Date,t,I,t.screen,u(r)]}})():f,3),E),T=new a(E),S=function(){for(var b=T.g(6),C=i,I=0;b<s;)b=256*(b+I),C*=256,I=T.g(1);for(;b>=n;)b/=2,C/=2,I>>>=1;return(b+I)/C};return S.int32=function(){return 0|T.g(4)},S.quick=function(){return T.g(4)/4294967296},S.double=S,c(u(T.S),r),(d.pass||g||function(b,C,I,L){return L&&(L.S&&o(L,T),b.state=function(){return o(T,{})}),I?(e.random=b,C):b})(S,m,"global"in d?d.global:this==e,d.state)},c(e.random(),r)}function initialize$2(r){seedRandom([],r)}var propTypes={SHAPE:"shape"};function _typeof$1(r){return(_typeof$1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(r)}var ExpressionManager=(function(){var ob={},Math=BMMath,window=null,document=null,XMLHttpRequest=null,fetch=null,frames=null,_lottieGlobal={};function resetFrame(){_lottieGlobal={}}function $bm_isInstanceOfArray(r){return r.constructor===Array||r.constructor===Float32Array}function isNumerable(r,e){return r==="number"||e instanceof Number||r==="boolean"||r==="string"}function $bm_neg(r){var e=_typeof$1(r);if(e==="number"||r instanceof Number||e==="boolean")return-r;if($bm_isInstanceOfArray(r)){var t,i=r.length,s=[];for(t=0;t<i;t+=1)s[t]=-r[t];return s}return r.propType?r.v:-r}initialize$2(BMMath);var easeInBez=BezierFactory.getBezierEasing(.333,0,.833,.833,"easeIn").get,easeOutBez=BezierFactory.getBezierEasing(.167,.167,.667,1,"easeOut").get,easeInOutBez=BezierFactory.getBezierEasing(.33,0,.667,1,"easeInOut").get;function sum(r,e){var t=_typeof$1(r),i=_typeof$1(e);if(isNumerable(t,r)&&isNumerable(i,e)||t==="string"||i==="string")return r+e;if($bm_isInstanceOfArray(r)&&isNumerable(i,e))return(r=r.slice(0))[0]+=e,r;if(isNumerable(t,r)&&$bm_isInstanceOfArray(e))return(e=e.slice(0))[0]=r+e[0],e;if($bm_isInstanceOfArray(r)&&$bm_isInstanceOfArray(e)){for(var s=0,n=r.length,a=e.length,o=[];s<n||s<a;)(typeof r[s]=="number"||r[s]instanceof Number)&&(typeof e[s]=="number"||e[s]instanceof Number)?o[s]=r[s]+e[s]:o[s]=e[s]===void 0?r[s]:r[s]||e[s],s+=1;return o}return 0}var add=sum;function sub(r,e){var t=_typeof$1(r),i=_typeof$1(e);if(isNumerable(t,r)&&isNumerable(i,e))return t==="string"&&(r=parseInt(r,10)),i==="string"&&(e=parseInt(e,10)),r-e;if($bm_isInstanceOfArray(r)&&isNumerable(i,e))return(r=r.slice(0))[0]-=e,r;if(isNumerable(t,r)&&$bm_isInstanceOfArray(e))return(e=e.slice(0))[0]=r-e[0],e;if($bm_isInstanceOfArray(r)&&$bm_isInstanceOfArray(e)){for(var s=0,n=r.length,a=e.length,o=[];s<n||s<a;)(typeof r[s]=="number"||r[s]instanceof Number)&&(typeof e[s]=="number"||e[s]instanceof Number)?o[s]=r[s]-e[s]:o[s]=e[s]===void 0?r[s]:r[s]||e[s],s+=1;return o}return 0}function mul(r,e){var t,i,s,n=_typeof$1(r),a=_typeof$1(e);if(isNumerable(n,r)&&isNumerable(a,e))return r*e;if($bm_isInstanceOfArray(r)&&isNumerable(a,e)){for(s=r.length,t=createTypedArray("float32",s),i=0;i<s;i+=1)t[i]=r[i]*e;return t}if(isNumerable(n,r)&&$bm_isInstanceOfArray(e)){for(s=e.length,t=createTypedArray("float32",s),i=0;i<s;i+=1)t[i]=r*e[i];return t}return 0}function div(r,e){var t,i,s,n=_typeof$1(r),a=_typeof$1(e);if(isNumerable(n,r)&&isNumerable(a,e))return r/e;if($bm_isInstanceOfArray(r)&&isNumerable(a,e)){for(s=r.length,t=createTypedArray("float32",s),i=0;i<s;i+=1)t[i]=r[i]/e;return t}if(isNumerable(n,r)&&$bm_isInstanceOfArray(e)){for(s=e.length,t=createTypedArray("float32",s),i=0;i<s;i+=1)t[i]=r/e[i];return t}return 0}function mod(r,e){return typeof r=="string"&&(r=parseInt(r,10)),typeof e=="string"&&(e=parseInt(e,10)),r%e}var $bm_sum=sum,$bm_sub=sub,$bm_mul=mul,$bm_div=div,$bm_mod=mod;function clamp(r,e,t){if(e>t){var i=t;t=e,e=i}return Math.min(Math.max(r,e),t)}function radiansToDegrees(r){return r/degToRads}var radians_to_degrees=radiansToDegrees;function degreesToRadians(r){return r*degToRads}var degrees_to_radians=radiansToDegrees,helperLengthArray=[0,0,0,0,0,0];function length(r,e){if(typeof r=="number"||r instanceof Number)return e=e||0,Math.abs(r-e);var t;e||(e=helperLengthArray);var i=Math.min(r.length,e.length),s=0;for(t=0;t<i;t+=1)s+=Math.pow(e[t]-r[t],2);return Math.sqrt(s)}function normalize(r){return div(r,length(r))}function rgbToHsl(r){var e,t,i=r[0],s=r[1],n=r[2],a=Math.max(i,s,n),o=Math.min(i,s,n),c=(a+o)/2;if(a===o)e=0,t=0;else{var u=a-o;switch(t=c>.5?u/(2-a-o):u/(a+o),a){case i:e=(s-n)/u+(s<n?6:0);break;case s:e=(n-i)/u+2;break;case n:e=(i-s)/u+4}e/=6}return[e,t,c,r[3]]}function hue2rgb(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+6*(e-r)*t:t<.5?e:t<2/3?r+(e-r)*(2/3-t)*6:r}function hslToRgb(r){var e,t,i,s=r[0],n=r[1],a=r[2];if(n===0)e=a,i=a,t=a;else{var o=a<.5?a*(1+n):a+n-a*n,c=2*a-o;e=hue2rgb(c,o,s+1/3),t=hue2rgb(c,o,s),i=hue2rgb(c,o,s-1/3)}return[e,t,i,r[3]]}function linear(r,e,t,i,s){if(i!==void 0&&s!==void 0||(i=e,s=t,e=0,t=1),t<e){var n=t;t=e,e=n}if(r<=e)return i;if(r>=t)return s;var a,o=t===e?0:(r-e)/(t-e);if(!i.length)return i+(s-i)*o;var c=i.length,u=createTypedArray("float32",c);for(a=0;a<c;a+=1)u[a]=i[a]+(s[a]-i[a])*o;return u}function random(r,e){if(e===void 0&&(r===void 0?(r=0,e=1):(e=r,r=void 0)),e.length){var t,i=e.length;r||(r=createTypedArray("float32",i));var s=createTypedArray("float32",i),n=BMMath.random();for(t=0;t<i;t+=1)s[t]=r[t]+n*(e[t]-r[t]);return s}return r===void 0&&(r=0),r+BMMath.random()*(e-r)}function createPath(r,e,t,i){var s,n=r.length,a=shapePool.newElement();a.setPathData(!!i,n);var o,c,u=[0,0];for(s=0;s<n;s+=1)o=e&&e[s]?e[s]:u,c=t&&t[s]?t[s]:u,a.setTripleAt(r[s][0],r[s][1],c[0]+r[s][0],c[1]+r[s][1],o[0]+r[s][0],o[1]+r[s][1],s,!0);return a}function initiateExpression(elem,data,property){function noOp(r){return r}if(!elem.globalData.renderConfig.runExpressions)return noOp;var val=data.x,needsVelocity=/velocity(?![\w\d])/.test(val),_needsRandom=val.indexOf("random")!==-1,elemType=elem.data.ty,transform,$bm_transform,content,effect,thisProperty=property;thisProperty.valueAtTime=thisProperty.getValueAtTime,Object.defineProperty(thisProperty,"value",{get:function(){return thisProperty.v}}),elem.comp.frameDuration=1/elem.comp.globalData.frameRate,elem.comp.displayStartTime=0;var inPoint=elem.data.ip/elem.comp.globalData.frameRate,outPoint=elem.data.op/elem.comp.globalData.frameRate,width=elem.data.sw?elem.data.sw:0,height=elem.data.sh?elem.data.sh:0,name=elem.data.nm,loopIn,loop_in,loopOut,loop_out,smooth,toWorld,fromWorld,fromComp,toComp,fromCompToSurface,position,rotation,anchorPoint,scale,thisLayer,thisComp,mask,valueAtTime,velocityAtTime,scoped_bm_rt,expression_function=eval("[function _expression_function(){"+val+";scoped_bm_rt=$bm_rt}]")[0],numKeys=property.kf?data.k.length:0,active=!this.data||this.data.hd!==!0,wiggle=(function(r,e){var t,i,s=this.pv.length?this.pv.length:1,n=createTypedArray("float32",s),a=Math.floor(5*time);for(t=0,i=0;t<a;){for(i=0;i<s;i+=1)n[i]+=-e+2*e*BMMath.random();t+=1}var o=5*time,c=o-Math.floor(o),u=createTypedArray("float32",s);if(s>1){for(i=0;i<s;i+=1)u[i]=this.pv[i]+n[i]+(-e+2*e*BMMath.random())*c;return u}return this.pv+n[0]+(-e+2*e*BMMath.random())*c}).bind(this);function loopInDuration(r,e){return loopIn(r,e,!0)}function loopOutDuration(r,e){return loopOut(r,e,!0)}thisProperty.loopIn&&(loopIn=thisProperty.loopIn.bind(thisProperty),loop_in=loopIn),thisProperty.loopOut&&(loopOut=thisProperty.loopOut.bind(thisProperty),loop_out=loopOut),thisProperty.smooth&&(smooth=thisProperty.smooth.bind(thisProperty)),this.getValueAtTime&&(valueAtTime=this.getValueAtTime.bind(this)),this.getVelocityAtTime&&(velocityAtTime=this.getVelocityAtTime.bind(this));var comp=elem.comp.globalData.projectInterface.bind(elem.comp.globalData.projectInterface),time,velocity,value,text,textIndex,textTotal,selectorValue;function lookAt(r,e){var t=[e[0]-r[0],e[1]-r[1],e[2]-r[2]],i=Math.atan2(t[0],Math.sqrt(t[1]*t[1]+t[2]*t[2]))/degToRads;return[-Math.atan2(t[1],t[2])/degToRads,i,0]}function easeOut(r,e,t,i,s){return applyEase(easeOutBez,r,e,t,i,s)}function easeIn(r,e,t,i,s){return applyEase(easeInBez,r,e,t,i,s)}function ease(r,e,t,i,s){return applyEase(easeInOutBez,r,e,t,i,s)}function applyEase(r,e,t,i,s,n){s===void 0?(s=t,n=i):e=(e-t)/(i-t),e>1?e=1:e<0&&(e=0);var a=r(e);if($bm_isInstanceOfArray(s)){var o,c=s.length,u=createTypedArray("float32",c);for(o=0;o<c;o+=1)u[o]=(n[o]-s[o])*a+s[o];return u}return(n-s)*a+s}function nearestKey(r){var e,t,i,s=data.k.length;if(data.k.length&&typeof data.k[0]!="number")if(t=-1,(r*=elem.comp.globalData.frameRate)<data.k[0].t)t=1,i=data.k[0].t;else{for(e=0;e<s-1;e+=1){if(r===data.k[e].t){t=e+1,i=data.k[e].t;break}if(r>data.k[e].t&&r<data.k[e+1].t){r-data.k[e].t>data.k[e+1].t-r?(t=e+2,i=data.k[e+1].t):(t=e+1,i=data.k[e].t);break}}t===-1&&(t=e+1,i=data.k[e].t)}else t=0,i=0;var n={};return n.index=t,n.time=i/elem.comp.globalData.frameRate,n}function key(r){var e,t,i;if(!data.k.length||typeof data.k[0]=="number")throw new Error("The property has no keyframe at index "+r);r-=1,e={time:data.k[r].t/elem.comp.globalData.frameRate,value:[]};var s=Object.prototype.hasOwnProperty.call(data.k[r],"s")?data.k[r].s:data.k[r-1].e;for(i=s.length,t=0;t<i;t+=1)e[t]=s[t],e.value[t]=s[t];return e}function framesToTime(r,e){return e||(e=elem.comp.globalData.frameRate),r/e}function timeToFrames(r,e){return r||r===0||(r=time),e||(e=elem.comp.globalData.frameRate),r*e}function seedRandom(r){BMMath.seedrandom(randSeed+r)}function sourceRectAtTime(){return elem.sourceRectAtTime()}function substring(r,e){return typeof value=="string"?e===void 0?value.substring(r):value.substring(r,e):""}function substr(r,e){return typeof value=="string"?e===void 0?value.substr(r):value.substr(r,e):""}function posterizeTime(r){time=r===0?0:Math.floor(time*r)/r,value=valueAtTime(time)}var index=elem.data.ind;!elem.hierarchy||elem.hierarchy.length;var parent,randSeed=Math.floor(1e6*Math.random()),globalData=elem.globalData;function executeExpression(r){return value=r,this.frameExpressionId===elem.globalData.frameId&&this.propType!=="textSelector"?value:(this.propType==="textSelector"&&(textIndex=this.textIndex,textTotal=this.textTotal,selectorValue=this.selectorValue),thisLayer||(text=elem.layerInterface.text,thisLayer=elem.layerInterface,thisComp=elem.comp.compInterface,toWorld=thisLayer.toWorld.bind(thisLayer),fromWorld=thisLayer.fromWorld.bind(thisLayer),fromComp=thisLayer.fromComp.bind(thisLayer),toComp=thisLayer.toComp.bind(thisLayer),mask=thisLayer.mask?thisLayer.mask.bind(thisLayer):null,fromCompToSurface=fromComp),transform||(transform=elem.layerInterface("ADBE Transform Group"),$bm_transform=transform,transform&&(anchorPoint=transform.anchorPoint)),elemType!==4||content||(content=thisLayer("ADBE Root Vectors Group")),effect||(effect=thisLayer(4)),!(!elem.hierarchy||!elem.hierarchy.length)&&!parent&&(parent=elem.hierarchy[0].layerInterface),time=this.comp.renderedFrame/this.comp.globalData.frameRate,_needsRandom&&seedRandom(randSeed+time),needsVelocity&&(velocity=velocityAtTime(time)),expression_function(),this.frameExpressionId=elem.globalData.frameId,scoped_bm_rt=scoped_bm_rt.propType===propTypes.SHAPE?scoped_bm_rt.v:scoped_bm_rt)}return executeExpression.__preventDeadCodeRemoval=[$bm_transform,anchorPoint,time,velocity,inPoint,outPoint,width,height,name,loop_in,loop_out,smooth,toComp,fromCompToSurface,toWorld,fromWorld,mask,position,rotation,scale,thisComp,numKeys,active,wiggle,loopInDuration,loopOutDuration,comp,lookAt,easeOut,easeIn,ease,nearestKey,key,text,textIndex,textTotal,selectorValue,framesToTime,timeToFrames,sourceRectAtTime,substring,substr,posterizeTime,index,globalData],executeExpression}return ob.initiateExpression=initiateExpression,ob.__preventDeadCodeRemoval=[window,document,XMLHttpRequest,fetch,frames,$bm_neg,add,$bm_sum,$bm_sub,$bm_mul,$bm_div,$bm_mod,clamp,radians_to_degrees,degreesToRadians,degrees_to_radians,normalize,rgbToHsl,hslToRgb,linear,random,createPath,_lottieGlobal],ob.resetFrame=resetFrame,ob})(),Expressions=(function(){var r={};return r.initExpressions=function(e){var t=0,i=[];e.renderer.compInterface=CompExpressionInterface(e.renderer),e.renderer.globalData.projectInterface.registerComposition(e.renderer),e.renderer.globalData.pushExpression=function(){t+=1},e.renderer.globalData.popExpression=function(){(t-=1)===0&&(function(){var s,n=i.length;for(s=0;s<n;s+=1)i[s].release();i.length=0})()},e.renderer.globalData.registerExpressionProperty=function(s){i.indexOf(s)===-1&&i.push(s)}},r.resetFrame=ExpressionManager.resetFrame,r})(),MaskManagerInterface=(function(){function r(e,t){this._mask=e,this._data=t}return Object.defineProperty(r.prototype,"maskPath",{get:function(){return this._mask.prop.k&&this._mask.prop.getValue(),this._mask.prop}}),Object.defineProperty(r.prototype,"maskOpacity",{get:function(){return this._mask.op.k&&this._mask.op.getValue(),100*this._mask.op.v}}),function(e){var t,i=createSizedArray(e.viewData.length),s=e.viewData.length;for(t=0;t<s;t+=1)i[t]=new r(e.viewData[t],e.masksProperties[t]);return function(n){for(t=0;t<s;){if(e.masksProperties[t].nm===n)return i[t];t+=1}return null}}})(),ExpressionPropertyInterface=(function(){var r={pv:0,v:0,mult:1},e={pv:[0,0,0],v:[0,0,0],mult:1};function t(s,n,a){Object.defineProperty(s,"velocity",{get:function(){return n.getVelocityAtTime(n.comp.currentFrame)}}),s.numKeys=n.keyframes?n.keyframes.length:0,s.key=function(o){if(!s.numKeys)return 0;var c="";c="s"in n.keyframes[o-1]?n.keyframes[o-1].s:"e"in n.keyframes[o-2]?n.keyframes[o-2].e:n.keyframes[o-2].s;var u=a==="unidimensional"?new Number(c):Object.assign({},c);return u.time=n.keyframes[o-1].t/n.elem.comp.globalData.frameRate,u.value=a==="unidimensional"?c[0]:c,u},s.valueAtTime=n.getValueAtTime,s.speedAtTime=n.getSpeedAtTime,s.velocityAtTime=n.getVelocityAtTime,s.propertyGroup=n.propertyGroup}function i(){return r}return function(s){return s?s.propType==="unidimensional"?(function(n){n&&"pv"in n||(n=r);var a=1/n.mult,o=n.pv*a,c=new Number(o);return c.value=o,t(c,n,"unidimensional"),function(){return n.k&&n.getValue(),o=n.v*a,c.value!==o&&((c=new Number(o)).value=o,t(c,n,"unidimensional")),c}})(s):(function(n){n&&"pv"in n||(n=e);var a=1/n.mult,o=n.data&&n.data.l||n.pv.length,c=createTypedArray("float32",o),u=createTypedArray("float32",o);return c.value=u,t(c,n,"multidimensional"),function(){n.k&&n.getValue();for(var f=0;f<o;f+=1)u[f]=n.v[f]*a,c[f]=u[f];return c}})(s):i}})(),TransformExpressionInterface=function(r){function e(a){switch(a){case"scale":case"Scale":case"ADBE Scale":case 6:return e.scale;case"rotation":case"Rotation":case"ADBE Rotation":case"ADBE Rotate Z":case 10:return e.rotation;case"ADBE Rotate X":return e.xRotation;case"ADBE Rotate Y":return e.yRotation;case"position":case"Position":case"ADBE Position":case 2:return e.position;case"ADBE Position_0":return e.xPosition;case"ADBE Position_1":return e.yPosition;case"ADBE Position_2":return e.zPosition;case"anchorPoint":case"AnchorPoint":case"Anchor Point":case"ADBE AnchorPoint":case 1:return e.anchorPoint;case"opacity":case"Opacity":case 11:return e.opacity;default:return null}}var t,i,s,n;return Object.defineProperty(e,"rotation",{get:ExpressionPropertyInterface(r.r||r.rz)}),Object.defineProperty(e,"zRotation",{get:ExpressionPropertyInterface(r.rz||r.r)}),Object.defineProperty(e,"xRotation",{get:ExpressionPropertyInterface(r.rx)}),Object.defineProperty(e,"yRotation",{get:ExpressionPropertyInterface(r.ry)}),Object.defineProperty(e,"scale",{get:ExpressionPropertyInterface(r.s)}),r.p?n=ExpressionPropertyInterface(r.p):(t=ExpressionPropertyInterface(r.px),i=ExpressionPropertyInterface(r.py),r.pz&&(s=ExpressionPropertyInterface(r.pz))),Object.defineProperty(e,"position",{get:function(){return r.p?n():[t(),i(),s?s():0]}}),Object.defineProperty(e,"xPosition",{get:ExpressionPropertyInterface(r.px)}),Object.defineProperty(e,"yPosition",{get:ExpressionPropertyInterface(r.py)}),Object.defineProperty(e,"zPosition",{get:ExpressionPropertyInterface(r.pz)}),Object.defineProperty(e,"anchorPoint",{get:ExpressionPropertyInterface(r.a)}),Object.defineProperty(e,"opacity",{get:ExpressionPropertyInterface(r.o)}),Object.defineProperty(e,"skew",{get:ExpressionPropertyInterface(r.sk)}),Object.defineProperty(e,"skewAxis",{get:ExpressionPropertyInterface(r.sa)}),Object.defineProperty(e,"orientation",{get:ExpressionPropertyInterface(r.or)}),e},LayerExpressionInterface=(function(){function r(u){var f=new Matrix;return u!==void 0?this._elem.finalTransform.mProp.getValueAtTime(u).clone(f):this._elem.finalTransform.mProp.applyToMatrix(f),f}function e(u,f){var d=this.getMatrix(f);return d.props[12]=0,d.props[13]=0,d.props[14]=0,this.applyPoint(d,u)}function t(u,f){var d=this.getMatrix(f);return this.applyPoint(d,u)}function i(u,f){var d=this.getMatrix(f);return d.props[12]=0,d.props[13]=0,d.props[14]=0,this.invertPoint(d,u)}function s(u,f){var d=this.getMatrix(f);return this.invertPoint(d,u)}function n(u,f){if(this._elem.hierarchy&&this._elem.hierarchy.length){var d,g=this._elem.hierarchy.length;for(d=0;d<g;d+=1)this._elem.hierarchy[d].finalTransform.mProp.applyToMatrix(u)}return u.applyToPointArray(f[0],f[1],f[2]||0)}function a(u,f){if(this._elem.hierarchy&&this._elem.hierarchy.length){var d,g=this._elem.hierarchy.length;for(d=0;d<g;d+=1)this._elem.hierarchy[d].finalTransform.mProp.applyToMatrix(u)}return u.inversePoint(f)}function o(u){var f=new Matrix;if(f.reset(),this._elem.finalTransform.mProp.applyToMatrix(f),this._elem.hierarchy&&this._elem.hierarchy.length){var d,g=this._elem.hierarchy.length;for(d=0;d<g;d+=1)this._elem.hierarchy[d].finalTransform.mProp.applyToMatrix(f);return f.inversePoint(u)}return f.inversePoint(u)}function c(){return[1,1,1,1]}return function(u){var f;function d(E){switch(E){case"ADBE Root Vectors Group":case"Contents":case 2:return d.shapeInterface;case 1:case 6:case"Transform":case"transform":case"ADBE Transform Group":return f;case 4:case"ADBE Effect Parade":case"effects":case"Effects":return d.effect;case"ADBE Text Properties":return d.textInterface;default:return null}}d.getMatrix=r,d.invertPoint=a,d.applyPoint=n,d.toWorld=t,d.toWorldVec=e,d.fromWorld=s,d.fromWorldVec=i,d.toComp=t,d.fromComp=o,d.sampleImage=c,d.sourceRectAtTime=u.sourceRectAtTime.bind(u),d._elem=u;var g=getDescriptor(f=TransformExpressionInterface(u.finalTransform.mProp),"anchorPoint");return Object.defineProperties(d,{hasParent:{get:function(){return u.hierarchy.length}},parent:{get:function(){return u.hierarchy[0].layerInterface}},rotation:getDescriptor(f,"rotation"),scale:getDescriptor(f,"scale"),position:getDescriptor(f,"position"),opacity:getDescriptor(f,"opacity"),anchorPoint:g,anchor_point:g,transform:{get:function(){return f}},active:{get:function(){return u.isInRange}}}),d.startTime=u.data.st,d.index=u.data.ind,d.source=u.data.refId,d.height=u.data.ty===0?u.data.h:100,d.width=u.data.ty===0?u.data.w:100,d.inPoint=u.data.ip/u.comp.globalData.frameRate,d.outPoint=u.data.op/u.comp.globalData.frameRate,d._name=u.data.nm,d.registerMaskInterface=function(E){d.mask=new MaskManagerInterface(E,u)},d.registerEffectsInterface=function(E){d.effect=E},d}})(),propertyGroupFactory=function(r,e){return function(t){return(t=t===void 0?1:t)<=0?r:e(t-1)}},PropertyInterface=function(r,e){var t={_name:r};return function(i){return(i=i===void 0?1:i)<=0?t:e(i-1)}},EffectsExpressionInterface=(function(){function r(t,i,s,n){function a(d){for(var g=t.ef,E=0,m=g.length;E<m;){if(d===g[E].nm||d===g[E].mn||d===g[E].ix)return g[E].ty===5?u[E]:u[E]();E+=1}throw new Error}var o,c=propertyGroupFactory(a,s),u=[],f=t.ef.length;for(o=0;o<f;o+=1)t.ef[o].ty===5?u.push(r(t.ef[o],i.effectElements[o],i.effectElements[o].propertyGroup,n)):u.push(e(i.effectElements[o],t.ef[o].ty,n,c));return t.mn==="ADBE Color Control"&&Object.defineProperty(a,"color",{get:function(){return u[0]()}}),Object.defineProperties(a,{numProperties:{get:function(){return t.np}},_name:{value:t.nm},propertyGroup:{value:c}}),a.enabled=t.en!==0,a.active=a.enabled,a}function e(t,i,s,n){var a=ExpressionPropertyInterface(t.p);return t.p.setGroupProperty&&t.p.setGroupProperty(PropertyInterface("",n)),function(){return i===10?s.comp.compInterface(t.p.v):a()}}return{createEffectsInterface:function(t,i){if(t.effectsManager){var s,n=[],a=t.data.ef,o=t.effectsManager.effectElements.length;for(s=0;s<o;s+=1)n.push(r(a[s],t.effectsManager.effectElements[s],i,t));var c=t.data.ef||[],u=function(f){for(s=0,o=c.length;s<o;){if(f===c[s].nm||f===c[s].mn||f===c[s].ix)return n[s];s+=1}return null};return Object.defineProperty(u,"numProperties",{get:function(){return c.length}}),u}return null}}})(),ShapePathInterface=function(r,e,t){var i=e.sh;function s(a){return a==="Shape"||a==="shape"||a==="Path"||a==="path"||a==="ADBE Vector Shape"||a===2?s.path:null}var n=propertyGroupFactory(s,t);return i.setGroupProperty(PropertyInterface("Path",n)),Object.defineProperties(s,{path:{get:function(){return i.k&&i.getValue(),i}},shape:{get:function(){return i.k&&i.getValue(),i}},_name:{value:r.nm},ix:{value:r.ix},propertyIndex:{value:r.ix},mn:{value:r.mn},propertyGroup:{value:t}}),s},ShapeExpressionInterface=(function(){function r(E,m,T){var S,b=[],C=E?E.length:0;for(S=0;S<C;S+=1)E[S].ty==="gr"?b.push(e(E[S],m[S],T)):E[S].ty==="fl"?b.push(t(E[S],m[S],T)):E[S].ty==="st"?b.push(n(E[S],m[S],T)):E[S].ty==="tm"?b.push(a(E[S],m[S],T)):E[S].ty==="tr"||(E[S].ty==="el"?b.push(c(E[S],m[S],T)):E[S].ty==="sr"?b.push(u(E[S],m[S],T)):E[S].ty==="sh"?b.push(ShapePathInterface(E[S],m[S],T)):E[S].ty==="rc"?b.push(f(E[S],m[S],T)):E[S].ty==="rd"?b.push(d(E[S],m[S],T)):E[S].ty==="rp"?b.push(g(E[S],m[S],T)):E[S].ty==="gf"?b.push(i(E[S],m[S],T)):b.push(s(E[S],m[S])));return b}function e(E,m,T){var S=function(I){switch(I){case"ADBE Vectors Group":case"Contents":case 2:return S.content;default:return S.transform}};S.propertyGroup=propertyGroupFactory(S,T);var b=(function(I,L,k){var U,O=function(G){for(var x=0,$=U.length;x<$;){if(U[x]._name===G||U[x].mn===G||U[x].propertyIndex===G||U[x].ix===G||U[x].ind===G)return U[x];x+=1}return typeof G=="number"?U[G-1]:null};O.propertyGroup=propertyGroupFactory(O,k),U=r(I.it,L.it,O.propertyGroup),O.numProperties=U.length;var F=o(I.it[I.it.length-1],L.it[L.it.length-1],O.propertyGroup);return O.transform=F,O.propertyIndex=I.cix,O._name=I.nm,O})(E,m,S.propertyGroup),C=o(E.it[E.it.length-1],m.it[m.it.length-1],S.propertyGroup);return S.content=b,S.transform=C,Object.defineProperty(S,"_name",{get:function(){return E.nm}}),S.numProperties=E.np,S.propertyIndex=E.ix,S.nm=E.nm,S.mn=E.mn,S}function t(E,m,T){function S(b){return b==="Color"||b==="color"?S.color:b==="Opacity"||b==="opacity"?S.opacity:null}return Object.defineProperties(S,{color:{get:ExpressionPropertyInterface(m.c)},opacity:{get:ExpressionPropertyInterface(m.o)},_name:{value:E.nm},mn:{value:E.mn}}),m.c.setGroupProperty(PropertyInterface("Color",T)),m.o.setGroupProperty(PropertyInterface("Opacity",T)),S}function i(E,m,T){function S(b){return b==="Start Point"||b==="start point"?S.startPoint:b==="End Point"||b==="end point"?S.endPoint:b==="Opacity"||b==="opacity"?S.opacity:null}return Object.defineProperties(S,{startPoint:{get:ExpressionPropertyInterface(m.s)},endPoint:{get:ExpressionPropertyInterface(m.e)},opacity:{get:ExpressionPropertyInterface(m.o)},type:{get:function(){return"a"}},_name:{value:E.nm},mn:{value:E.mn}}),m.s.setGroupProperty(PropertyInterface("Start Point",T)),m.e.setGroupProperty(PropertyInterface("End Point",T)),m.o.setGroupProperty(PropertyInterface("Opacity",T)),S}function s(){return function(){return null}}function n(E,m,T){var S,b=propertyGroupFactory(U,T),C=propertyGroupFactory(k,b);function I(O){Object.defineProperty(k,E.d[O].nm,{get:ExpressionPropertyInterface(m.d.dataProps[O].p)})}var L=E.d?E.d.length:0,k={};for(S=0;S<L;S+=1)I(S),m.d.dataProps[S].p.setGroupProperty(C);function U(O){return O==="Color"||O==="color"?U.color:O==="Opacity"||O==="opacity"?U.opacity:O==="Stroke Width"||O==="stroke width"?U.strokeWidth:null}return Object.defineProperties(U,{color:{get:ExpressionPropertyInterface(m.c)},opacity:{get:ExpressionPropertyInterface(m.o)},strokeWidth:{get:ExpressionPropertyInterface(m.w)},dash:{get:function(){return k}},_name:{value:E.nm},mn:{value:E.mn}}),m.c.setGroupProperty(PropertyInterface("Color",b)),m.o.setGroupProperty(PropertyInterface("Opacity",b)),m.w.setGroupProperty(PropertyInterface("Stroke Width",b)),U}function a(E,m,T){function S(C){return C===E.e.ix||C==="End"||C==="end"?S.end:C===E.s.ix?S.start:C===E.o.ix?S.offset:null}var b=propertyGroupFactory(S,T);return S.propertyIndex=E.ix,m.s.setGroupProperty(PropertyInterface("Start",b)),m.e.setGroupProperty(PropertyInterface("End",b)),m.o.setGroupProperty(PropertyInterface("Offset",b)),S.propertyIndex=E.ix,S.propertyGroup=T,Object.defineProperties(S,{start:{get:ExpressionPropertyInterface(m.s)},end:{get:ExpressionPropertyInterface(m.e)},offset:{get:ExpressionPropertyInterface(m.o)},_name:{value:E.nm}}),S.mn=E.mn,S}function o(E,m,T){function S(C){return E.a.ix===C||C==="Anchor Point"?S.anchorPoint:E.o.ix===C||C==="Opacity"?S.opacity:E.p.ix===C||C==="Position"?S.position:E.r.ix===C||C==="Rotation"||C==="ADBE Vector Rotation"?S.rotation:E.s.ix===C||C==="Scale"?S.scale:E.sk&&E.sk.ix===C||C==="Skew"?S.skew:E.sa&&E.sa.ix===C||C==="Skew Axis"?S.skewAxis:null}var b=propertyGroupFactory(S,T);return m.transform.mProps.o.setGroupProperty(PropertyInterface("Opacity",b)),m.transform.mProps.p.setGroupProperty(PropertyInterface("Position",b)),m.transform.mProps.a.setGroupProperty(PropertyInterface("Anchor Point",b)),m.transform.mProps.s.setGroupProperty(PropertyInterface("Scale",b)),m.transform.mProps.r.setGroupProperty(PropertyInterface("Rotation",b)),m.transform.mProps.sk&&(m.transform.mProps.sk.setGroupProperty(PropertyInterface("Skew",b)),m.transform.mProps.sa.setGroupProperty(PropertyInterface("Skew Angle",b))),m.transform.op.setGroupProperty(PropertyInterface("Opacity",b)),Object.defineProperties(S,{opacity:{get:ExpressionPropertyInterface(m.transform.mProps.o)},position:{get:ExpressionPropertyInterface(m.transform.mProps.p)},anchorPoint:{get:ExpressionPropertyInterface(m.transform.mProps.a)},scale:{get:ExpressionPropertyInterface(m.transform.mProps.s)},rotation:{get:ExpressionPropertyInterface(m.transform.mProps.r)},skew:{get:ExpressionPropertyInterface(m.transform.mProps.sk)},skewAxis:{get:ExpressionPropertyInterface(m.transform.mProps.sa)},_name:{value:E.nm}}),S.ty="tr",S.mn=E.mn,S.propertyGroup=T,S}function c(E,m,T){function S(I){return E.p.ix===I?S.position:E.s.ix===I?S.size:null}var b=propertyGroupFactory(S,T);S.propertyIndex=E.ix;var C=m.sh.ty==="tm"?m.sh.prop:m.sh;return C.s.setGroupProperty(PropertyInterface("Size",b)),C.p.setGroupProperty(PropertyInterface("Position",b)),Object.defineProperties(S,{size:{get:ExpressionPropertyInterface(C.s)},position:{get:ExpressionPropertyInterface(C.p)},_name:{value:E.nm}}),S.mn=E.mn,S}function u(E,m,T){function S(I){return E.p.ix===I?S.position:E.r.ix===I?S.rotation:E.pt.ix===I?S.points:E.or.ix===I||I==="ADBE Vector Star Outer Radius"?S.outerRadius:E.os.ix===I?S.outerRoundness:!E.ir||E.ir.ix!==I&&I!=="ADBE Vector Star Inner Radius"?E.is&&E.is.ix===I?S.innerRoundness:null:S.innerRadius}var b=propertyGroupFactory(S,T),C=m.sh.ty==="tm"?m.sh.prop:m.sh;return S.propertyIndex=E.ix,C.or.setGroupProperty(PropertyInterface("Outer Radius",b)),C.os.setGroupProperty(PropertyInterface("Outer Roundness",b)),C.pt.setGroupProperty(PropertyInterface("Points",b)),C.p.setGroupProperty(PropertyInterface("Position",b)),C.r.setGroupProperty(PropertyInterface("Rotation",b)),E.ir&&(C.ir.setGroupProperty(PropertyInterface("Inner Radius",b)),C.is.setGroupProperty(PropertyInterface("Inner Roundness",b))),Object.defineProperties(S,{position:{get:ExpressionPropertyInterface(C.p)},rotation:{get:ExpressionPropertyInterface(C.r)},points:{get:ExpressionPropertyInterface(C.pt)},outerRadius:{get:ExpressionPropertyInterface(C.or)},outerRoundness:{get:ExpressionPropertyInterface(C.os)},innerRadius:{get:ExpressionPropertyInterface(C.ir)},innerRoundness:{get:ExpressionPropertyInterface(C.is)},_name:{value:E.nm}}),S.mn=E.mn,S}function f(E,m,T){function S(I){return E.p.ix===I?S.position:E.r.ix===I?S.roundness:E.s.ix===I||I==="Size"||I==="ADBE Vector Rect Size"?S.size:null}var b=propertyGroupFactory(S,T),C=m.sh.ty==="tm"?m.sh.prop:m.sh;return S.propertyIndex=E.ix,C.p.setGroupProperty(PropertyInterface("Position",b)),C.s.setGroupProperty(PropertyInterface("Size",b)),C.r.setGroupProperty(PropertyInterface("Rotation",b)),Object.defineProperties(S,{position:{get:ExpressionPropertyInterface(C.p)},roundness:{get:ExpressionPropertyInterface(C.r)},size:{get:ExpressionPropertyInterface(C.s)},_name:{value:E.nm}}),S.mn=E.mn,S}function d(E,m,T){function S(I){return E.r.ix===I||I==="Round Corners 1"?S.radius:null}var b=propertyGroupFactory(S,T),C=m;return S.propertyIndex=E.ix,C.rd.setGroupProperty(PropertyInterface("Radius",b)),Object.defineProperties(S,{radius:{get:ExpressionPropertyInterface(C.rd)},_name:{value:E.nm}}),S.mn=E.mn,S}function g(E,m,T){function S(I){return E.c.ix===I||I==="Copies"?S.copies:E.o.ix===I||I==="Offset"?S.offset:null}var b=propertyGroupFactory(S,T),C=m;return S.propertyIndex=E.ix,C.c.setGroupProperty(PropertyInterface("Copies",b)),C.o.setGroupProperty(PropertyInterface("Offset",b)),Object.defineProperties(S,{copies:{get:ExpressionPropertyInterface(C.c)},offset:{get:ExpressionPropertyInterface(C.o)},_name:{value:E.nm}}),S.mn=E.mn,S}return function(E,m,T){var S;function b(C){if(typeof C=="number")return(C=C===void 0?1:C)===0?T:S[C-1];for(var I=0,L=S.length;I<L;){if(S[I]._name===C)return S[I];I+=1}return null}return b.propertyGroup=propertyGroupFactory(b,(function(){return T})),S=r(E,m,b.propertyGroup),b.numProperties=S.length,b._name="Contents",b}})(),TextExpressionInterface=function(r){var e;function t(i){return i==="ADBE Text Document"?t.sourceText:null}return Object.defineProperty(t,"sourceText",{get:function(){r.textProperty.getValue();var i=r.textProperty.currentData.t;return e&&i===e.value||((e=new String(i)).value=i||new String(i),Object.defineProperty(e,"style",{get:function(){return{fillColor:r.textProperty.currentData.fc}}})),e}}),t};function _typeof(r){return(_typeof=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(r)}var FootageInterface=(dataInterfaceFactory=function(r){function e(t){return t==="Outline"?e.outlineInterface():null}return e._name="Outline",e.outlineInterface=(function(t){var i="",s=t.getFootageData();function n(a){if(s[a])return i=a,_typeof(s=s[a])==="object"?n:s;var o=a.indexOf(i);if(o!==-1){var c=parseInt(a.substr(o+i.length),10);return _typeof(s=s[c])==="object"?n:s}return""}return function(){return i="",s=t.getFootageData(),n}})(r),e},function(r){function e(t){return t==="Data"?e.dataInterface:null}return e._name="Data",e.dataInterface=dataInterfaceFactory(r),e}),dataInterfaceFactory,interfaces={layer:LayerExpressionInterface,effects:EffectsExpressionInterface,comp:CompExpressionInterface,shape:ShapeExpressionInterface,text:TextExpressionInterface,footage:FootageInterface};function getInterface(r){return interfaces[r]||null}var expressionHelpers={searchExpressions:function(r,e,t){e.x&&(t.k=!0,t.x=!0,t.initiateExpression=ExpressionManager.initiateExpression,t.effectsSequence.push(t.initiateExpression(r,e,t).bind(t)))},getSpeedAtTime:function(r){var e=this.getValueAtTime(r),t=this.getValueAtTime(r+-.01),i=0;if(e.length){var s;for(s=0;s<e.length;s+=1)i+=Math.pow(t[s]-e[s],2);i=100*Math.sqrt(i)}else i=0;return i},getVelocityAtTime:function(r){if(this.vel!==void 0)return this.vel;var e,t,i=this.getValueAtTime(r),s=this.getValueAtTime(r+-.001);if(i.length)for(e=createTypedArray("float32",i.length),t=0;t<i.length;t+=1)e[t]=(s[t]-i[t])/-.001;else e=(s-i)/-.001;return e},getValueAtTime:function(r){return r*=this.elem.globalData.frameRate,(r-=this.offsetTime)!==this._cachingAtTime.lastFrame&&(this._cachingAtTime.lastIndex=this._cachingAtTime.lastFrame<r?this._cachingAtTime.lastIndex:0,this._cachingAtTime.value=this.interpolateValue(r,this._cachingAtTime),this._cachingAtTime.lastFrame=r),this._cachingAtTime.value},getStaticValueAtTime:function(){return this.pv},setGroupProperty:function(r){this.propertyGroup=r}};function addPropertyDecorator(){function r(d,g,E){if(!this.k||!this.keyframes)return this.pv;d=d?d.toLowerCase():"";var m,T,S,b,C,I=this.comp.renderedFrame,L=this.keyframes,k=L[L.length-1].t;if(I<=k)return this.pv;if(E?T=k-(m=g?Math.abs(k-this.elem.comp.globalData.frameRate*g):Math.max(0,k-this.elem.data.ip)):((!g||g>L.length-1)&&(g=L.length-1),m=k-(T=L[L.length-1-g].t)),d==="pingpong"){if(Math.floor((I-T)/m)%2!=0)return this.getValueAtTime((m-(I-T)%m+T)/this.comp.globalData.frameRate,0)}else{if(d==="offset"){var U=this.getValueAtTime(T/this.comp.globalData.frameRate,0),O=this.getValueAtTime(k/this.comp.globalData.frameRate,0),F=this.getValueAtTime(((I-T)%m+T)/this.comp.globalData.frameRate,0),G=Math.floor((I-T)/m);if(this.pv.length){for(b=(C=new Array(U.length)).length,S=0;S<b;S+=1)C[S]=(O[S]-U[S])*G+F[S];return C}return(O-U)*G+F}if(d==="continue"){var x=this.getValueAtTime(k/this.comp.globalData.frameRate,0),$=this.getValueAtTime((k-.001)/this.comp.globalData.frameRate,0);if(this.pv.length){for(b=(C=new Array(x.length)).length,S=0;S<b;S+=1)C[S]=x[S]+(x[S]-$[S])*((I-k)/this.comp.globalData.frameRate)/5e-4;return C}return x+(I-k)/.001*(x-$)}}return this.getValueAtTime(((I-T)%m+T)/this.comp.globalData.frameRate,0)}function e(d,g,E){if(!this.k)return this.pv;d=d?d.toLowerCase():"";var m,T,S,b,C,I=this.comp.renderedFrame,L=this.keyframes,k=L[0].t;if(I>=k)return this.pv;if(E?T=k+(m=g?Math.abs(this.elem.comp.globalData.frameRate*g):Math.max(0,this.elem.data.op-k)):((!g||g>L.length-1)&&(g=L.length-1),m=(T=L[g].t)-k),d==="pingpong"){if(Math.floor((k-I)/m)%2==0)return this.getValueAtTime(((k-I)%m+k)/this.comp.globalData.frameRate,0)}else{if(d==="offset"){var U=this.getValueAtTime(k/this.comp.globalData.frameRate,0),O=this.getValueAtTime(T/this.comp.globalData.frameRate,0),F=this.getValueAtTime((m-(k-I)%m+k)/this.comp.globalData.frameRate,0),G=Math.floor((k-I)/m)+1;if(this.pv.length){for(b=(C=new Array(U.length)).length,S=0;S<b;S+=1)C[S]=F[S]-(O[S]-U[S])*G;return C}return F-(O-U)*G}if(d==="continue"){var x=this.getValueAtTime(k/this.comp.globalData.frameRate,0),$=this.getValueAtTime((k+.001)/this.comp.globalData.frameRate,0);if(this.pv.length){for(b=(C=new Array(x.length)).length,S=0;S<b;S+=1)C[S]=x[S]+(x[S]-$[S])*(k-I)/.001;return C}return x+(x-$)*(k-I)/.001}}return this.getValueAtTime((m-((k-I)%m+k))/this.comp.globalData.frameRate,0)}function t(d,g){if(!this.k)return this.pv;if(d=.5*(d||.4),(g=Math.floor(g||5))<=1)return this.pv;var E,m,T=this.comp.renderedFrame/this.comp.globalData.frameRate,S=T-d,b=g>1?(T+d-S)/(g-1):1,C=0,I=0;for(E=this.pv.length?createTypedArray("float32",this.pv.length):0;C<g;){if(m=this.getValueAtTime(S+C*b),this.pv.length)for(I=0;I<this.pv.length;I+=1)E[I]+=m[I];else E+=m;C+=1}if(this.pv.length)for(I=0;I<this.pv.length;I+=1)E[I]/=g;else E/=g;return E}function i(d){this._transformCachingAtTime||(this._transformCachingAtTime={v:new Matrix});var g=this._transformCachingAtTime.v;if(g.cloneFromProps(this.pre.props),this.appliedTransformations<1){var E=this.a.getValueAtTime(d);g.translate(-E[0]*this.a.mult,-E[1]*this.a.mult,E[2]*this.a.mult)}if(this.appliedTransformations<2){var m=this.s.getValueAtTime(d);g.scale(m[0]*this.s.mult,m[1]*this.s.mult,m[2]*this.s.mult)}if(this.sk&&this.appliedTransformations<3){var T=this.sk.getValueAtTime(d),S=this.sa.getValueAtTime(d);g.skewFromAxis(-T*this.sk.mult,S*this.sa.mult)}if(this.r&&this.appliedTransformations<4){var b=this.r.getValueAtTime(d);g.rotate(-b*this.r.mult)}else if(!this.r&&this.appliedTransformations<4){var C=this.rz.getValueAtTime(d),I=this.ry.getValueAtTime(d),L=this.rx.getValueAtTime(d),k=this.or.getValueAtTime(d);g.rotateZ(-C*this.rz.mult).rotateY(I*this.ry.mult).rotateX(L*this.rx.mult).rotateZ(-k[2]*this.or.mult).rotateY(k[1]*this.or.mult).rotateX(k[0]*this.or.mult)}if(this.data.p&&this.data.p.s){var U=this.px.getValueAtTime(d),O=this.py.getValueAtTime(d);if(this.data.p.z){var F=this.pz.getValueAtTime(d);g.translate(U*this.px.mult,O*this.py.mult,-F*this.pz.mult)}else g.translate(U*this.px.mult,O*this.py.mult,0)}else{var G=this.p.getValueAtTime(d);g.translate(G[0]*this.p.mult,G[1]*this.p.mult,-G[2]*this.p.mult)}return g}function s(){return this.v.clone(new Matrix)}var n=TransformPropertyFactory.getTransformProperty;TransformPropertyFactory.getTransformProperty=function(d,g,E){var m=n(d,g,E);return m.dynamicProperties.length?m.getValueAtTime=i.bind(m):m.getValueAtTime=s.bind(m),m.setGroupProperty=expressionHelpers.setGroupProperty,m};var a=PropertyFactory.getProp;PropertyFactory.getProp=function(d,g,E,m,T){var S=a(d,g,E,m,T);S.kf?S.getValueAtTime=expressionHelpers.getValueAtTime.bind(S):S.getValueAtTime=expressionHelpers.getStaticValueAtTime.bind(S),S.setGroupProperty=expressionHelpers.setGroupProperty,S.loopOut=r,S.loopIn=e,S.smooth=t,S.getVelocityAtTime=expressionHelpers.getVelocityAtTime.bind(S),S.getSpeedAtTime=expressionHelpers.getSpeedAtTime.bind(S),S.numKeys=g.a===1?g.k.length:0,S.propertyIndex=g.ix;var b=0;return E!==0&&(b=createTypedArray("float32",g.a===1?g.k[0].s.length:g.k.length)),S._cachingAtTime={lastFrame:initialDefaultFrame,lastIndex:0,value:b},expressionHelpers.searchExpressions(d,g,S),S.k&&T.addDynamicProperty(S),S};var o=ShapePropertyFactory.getConstructorFunction(),c=ShapePropertyFactory.getKeyframedConstructorFunction();function u(){}u.prototype={vertices:function(d,g){this.k&&this.getValue();var E,m=this.v;g!==void 0&&(m=this.getValueAtTime(g,0));var T=m._length,S=m[d],b=m.v,C=createSizedArray(T);for(E=0;E<T;E+=1)C[E]=d==="i"||d==="o"?[S[E][0]-b[E][0],S[E][1]-b[E][1]]:[S[E][0],S[E][1]];return C},points:function(d){return this.vertices("v",d)},inTangents:function(d){return this.vertices("i",d)},outTangents:function(d){return this.vertices("o",d)},isClosed:function(){return this.v.c},pointOnPath:function(d,g){var E=this.v;g!==void 0&&(E=this.getValueAtTime(g,0)),this._segmentsLength||(this._segmentsLength=bez.getSegmentsLength(E));for(var m,T=this._segmentsLength,S=T.lengths,b=T.totalLength*d,C=0,I=S.length,L=0;C<I;){if(L+S[C].addedLength>b){var k=C,U=E.c&&C===I-1?0:C+1,O=(b-L)/S[C].addedLength;m=bez.getPointInSegment(E.v[k],E.v[U],E.o[k],E.i[U],O,S[C]);break}L+=S[C].addedLength,C+=1}return m||(m=E.c?[E.v[0][0],E.v[0][1]]:[E.v[E._length-1][0],E.v[E._length-1][1]]),m},vectorOnPath:function(d,g,E){d==1?d=this.v.c:d==0&&(d=.999);var m=this.pointOnPath(d,g),T=this.pointOnPath(d+.001,g),S=T[0]-m[0],b=T[1]-m[1],C=Math.sqrt(Math.pow(S,2)+Math.pow(b,2));return C===0?[0,0]:E==="tangent"?[S/C,b/C]:[-b/C,S/C]},tangentOnPath:function(d,g){return this.vectorOnPath(d,g,"tangent")},normalOnPath:function(d,g){return this.vectorOnPath(d,g,"normal")},setGroupProperty:expressionHelpers.setGroupProperty,getValueAtTime:expressionHelpers.getStaticValueAtTime},extendPrototype([u],o),extendPrototype([u],c),c.prototype.getValueAtTime=function(d){return this._cachingAtTime||(this._cachingAtTime={shapeValue:shapePool.clone(this.pv),lastIndex:0,lastTime:initialDefaultFrame}),d*=this.elem.globalData.frameRate,(d-=this.offsetTime)!==this._cachingAtTime.lastTime&&(this._cachingAtTime.lastIndex=this._cachingAtTime.lastTime<d?this._caching.lastIndex:0,this._cachingAtTime.lastTime=d,this.interpolateShape(d,this._cachingAtTime.shapeValue,this._cachingAtTime)),this._cachingAtTime.shapeValue},c.prototype.initiateExpression=ExpressionManager.initiateExpression;var f=ShapePropertyFactory.getShapeProp;ShapePropertyFactory.getShapeProp=function(d,g,E,m,T){var S=f(d,g,E,m,T);return S.propertyIndex=g.ix,S.lock=!1,E===3?expressionHelpers.searchExpressions(d,g.pt,S):E===4&&expressionHelpers.searchExpressions(d,g.ks,S),S.k&&d.addDynamicProperty(S),S}}function initialize$1(){addPropertyDecorator()}function addDecorator(){TextProperty.prototype.getExpressionValue=function(r,e){var t=this.calculateExpression(e);if(r.t!==t){var i={};return this.copyData(i,r),i.t=t.toString(),i.__complete=!1,i}return r},TextProperty.prototype.searchProperty=function(){var r=this.searchKeyframes(),e=this.searchExpressions();return this.kf=r||e,this.kf},TextProperty.prototype.searchExpressions=function(){return this.data.d.x?(this.calculateExpression=ExpressionManager.initiateExpression.bind(this)(this.elem,this.data.d,this),this.addEffect(this.getExpressionValue.bind(this)),!0):null}}function initialize(){addDecorator()}function SVGComposableEffect(){}SVGComposableEffect.prototype={createMergeNode:function(r,e){var t,i,s=createNS("feMerge");for(s.setAttribute("result",r),i=0;i<e.length;i+=1)(t=createNS("feMergeNode")).setAttribute("in",e[i]),s.appendChild(t),s.appendChild(t);return s}};var linearFilterValue="0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0";function SVGTintFilter(r,e,t,i,s){this.filterManager=e;var n=createNS("feColorMatrix");n.setAttribute("type","matrix"),n.setAttribute("color-interpolation-filters","linearRGB"),n.setAttribute("values",linearFilterValue+" 1 0"),this.linearFilter=n,n.setAttribute("result",i+"_tint_1"),r.appendChild(n),(n=createNS("feColorMatrix")).setAttribute("type","matrix"),n.setAttribute("color-interpolation-filters","sRGB"),n.setAttribute("values","1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"),n.setAttribute("result",i+"_tint_2"),r.appendChild(n),this.matrixFilter=n;var a=this.createMergeNode(i,[s,i+"_tint_1",i+"_tint_2"]);r.appendChild(a)}function SVGFillFilter(r,e,t,i){this.filterManager=e;var s=createNS("feColorMatrix");s.setAttribute("type","matrix"),s.setAttribute("color-interpolation-filters","sRGB"),s.setAttribute("values","1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"),s.setAttribute("result",i),r.appendChild(s),this.matrixFilter=s}function SVGStrokeEffect(r,e,t){this.initialized=!1,this.filterManager=e,this.elem=t,this.paths=[]}function SVGTritoneFilter(r,e,t,i){this.filterManager=e;var s=createNS("feColorMatrix");s.setAttribute("type","matrix"),s.setAttribute("color-interpolation-filters","linearRGB"),s.setAttribute("values","0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0"),r.appendChild(s);var n=createNS("feComponentTransfer");n.setAttribute("color-interpolation-filters","sRGB"),n.setAttribute("result",i),this.matrixFilter=n;var a=createNS("feFuncR");a.setAttribute("type","table"),n.appendChild(a),this.feFuncR=a;var o=createNS("feFuncG");o.setAttribute("type","table"),n.appendChild(o),this.feFuncG=o;var c=createNS("feFuncB");c.setAttribute("type","table"),n.appendChild(c),this.feFuncB=c,r.appendChild(n)}function SVGProLevelsFilter(r,e,t,i){this.filterManager=e;var s=this.filterManager.effectElements,n=createNS("feComponentTransfer");(s[10].p.k||s[10].p.v!==0||s[11].p.k||s[11].p.v!==1||s[12].p.k||s[12].p.v!==1||s[13].p.k||s[13].p.v!==0||s[14].p.k||s[14].p.v!==1)&&(this.feFuncR=this.createFeFunc("feFuncR",n)),(s[17].p.k||s[17].p.v!==0||s[18].p.k||s[18].p.v!==1||s[19].p.k||s[19].p.v!==1||s[20].p.k||s[20].p.v!==0||s[21].p.k||s[21].p.v!==1)&&(this.feFuncG=this.createFeFunc("feFuncG",n)),(s[24].p.k||s[24].p.v!==0||s[25].p.k||s[25].p.v!==1||s[26].p.k||s[26].p.v!==1||s[27].p.k||s[27].p.v!==0||s[28].p.k||s[28].p.v!==1)&&(this.feFuncB=this.createFeFunc("feFuncB",n)),(s[31].p.k||s[31].p.v!==0||s[32].p.k||s[32].p.v!==1||s[33].p.k||s[33].p.v!==1||s[34].p.k||s[34].p.v!==0||s[35].p.k||s[35].p.v!==1)&&(this.feFuncA=this.createFeFunc("feFuncA",n)),(this.feFuncR||this.feFuncG||this.feFuncB||this.feFuncA)&&(n.setAttribute("color-interpolation-filters","sRGB"),r.appendChild(n)),(s[3].p.k||s[3].p.v!==0||s[4].p.k||s[4].p.v!==1||s[5].p.k||s[5].p.v!==1||s[6].p.k||s[6].p.v!==0||s[7].p.k||s[7].p.v!==1)&&((n=createNS("feComponentTransfer")).setAttribute("color-interpolation-filters","sRGB"),n.setAttribute("result",i),r.appendChild(n),this.feFuncRComposed=this.createFeFunc("feFuncR",n),this.feFuncGComposed=this.createFeFunc("feFuncG",n),this.feFuncBComposed=this.createFeFunc("feFuncB",n))}function SVGDropShadowEffect(r,e,t,i,s){var n=e.container.globalData.renderConfig.filterSize,a=e.data.fs||n;r.setAttribute("x",a.x||n.x),r.setAttribute("y",a.y||n.y),r.setAttribute("width",a.width||n.width),r.setAttribute("height",a.height||n.height),this.filterManager=e;var o=createNS("feGaussianBlur");o.setAttribute("in","SourceAlpha"),o.setAttribute("result",i+"_drop_shadow_1"),o.setAttribute("stdDeviation","0"),this.feGaussianBlur=o,r.appendChild(o);var c=createNS("feOffset");c.setAttribute("dx","25"),c.setAttribute("dy","0"),c.setAttribute("in",i+"_drop_shadow_1"),c.setAttribute("result",i+"_drop_shadow_2"),this.feOffset=c,r.appendChild(c);var u=createNS("feFlood");u.setAttribute("flood-color","#00ff00"),u.setAttribute("flood-opacity","1"),u.setAttribute("result",i+"_drop_shadow_3"),this.feFlood=u,r.appendChild(u);var f=createNS("feComposite");f.setAttribute("in",i+"_drop_shadow_3"),f.setAttribute("in2",i+"_drop_shadow_2"),f.setAttribute("operator","in"),f.setAttribute("result",i+"_drop_shadow_4"),r.appendChild(f);var d=this.createMergeNode(i,[i+"_drop_shadow_4",s]);r.appendChild(d)}extendPrototype([SVGComposableEffect],SVGTintFilter),SVGTintFilter.prototype.renderFrame=function(r){if(r||this.filterManager._mdf){var e=this.filterManager.effectElements[0].p.v,t=this.filterManager.effectElements[1].p.v,i=this.filterManager.effectElements[2].p.v/100;this.linearFilter.setAttribute("values",linearFilterValue+" "+i+" 0"),this.matrixFilter.setAttribute("values",t[0]-e[0]+" 0 0 0 "+e[0]+" "+(t[1]-e[1])+" 0 0 0 "+e[1]+" "+(t[2]-e[2])+" 0 0 0 "+e[2]+" 0 0 0 1 0")}},SVGFillFilter.prototype.renderFrame=function(r){if(r||this.filterManager._mdf){var e=this.filterManager.effectElements[2].p.v,t=this.filterManager.effectElements[6].p.v;this.matrixFilter.setAttribute("values","0 0 0 0 "+e[0]+" 0 0 0 0 "+e[1]+" 0 0 0 0 "+e[2]+" 0 0 0 "+t+" 0")}},SVGStrokeEffect.prototype.initialize=function(){var r,e,t,i,s=this.elem.layerElement.children||this.elem.layerElement.childNodes;for(this.filterManager.effectElements[1].p.v===1?(i=this.elem.maskManager.masksProperties.length,t=0):i=(t=this.filterManager.effectElements[0].p.v-1)+1,(e=createNS("g")).setAttribute("fill","none"),e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-dashoffset",1);t<i;t+=1)r=createNS("path"),e.appendChild(r),this.paths.push({p:r,m:t});if(this.filterManager.effectElements[10].p.v===3){var n=createNS("mask"),a=createElementID();n.setAttribute("id",a),n.setAttribute("mask-type","alpha"),n.appendChild(e),this.elem.globalData.defs.appendChild(n);var o=createNS("g");for(o.setAttribute("mask","url("+getLocationHref()+"#"+a+")");s[0];)o.appendChild(s[0]);this.elem.layerElement.appendChild(o),this.masker=n,e.setAttribute("stroke","#fff")}else if(this.filterManager.effectElements[10].p.v===1||this.filterManager.effectElements[10].p.v===2){if(this.filterManager.effectElements[10].p.v===2)for(s=this.elem.layerElement.children||this.elem.layerElement.childNodes;s.length;)this.elem.layerElement.removeChild(s[0]);this.elem.layerElement.appendChild(e),this.elem.layerElement.removeAttribute("mask"),e.setAttribute("stroke","#fff")}this.initialized=!0,this.pathMasker=e},SVGStrokeEffect.prototype.renderFrame=function(r){var e;this.initialized||this.initialize();var t,i,s=this.paths.length;for(e=0;e<s;e+=1)if(this.paths[e].m!==-1&&(t=this.elem.maskManager.viewData[this.paths[e].m],i=this.paths[e].p,(r||this.filterManager._mdf||t.prop._mdf)&&i.setAttribute("d",t.lastPath),r||this.filterManager.effectElements[9].p._mdf||this.filterManager.effectElements[4].p._mdf||this.filterManager.effectElements[7].p._mdf||this.filterManager.effectElements[8].p._mdf||t.prop._mdf)){var n;if(this.filterManager.effectElements[7].p.v!==0||this.filterManager.effectElements[8].p.v!==100){var a=.01*Math.min(this.filterManager.effectElements[7].p.v,this.filterManager.effectElements[8].p.v),o=.01*Math.max(this.filterManager.effectElements[7].p.v,this.filterManager.effectElements[8].p.v),c=i.getTotalLength();n="0 0 0 "+c*a+" ";var u,f=c*(o-a),d=1+2*this.filterManager.effectElements[4].p.v*this.filterManager.effectElements[9].p.v*.01,g=Math.floor(f/d);for(u=0;u<g;u+=1)n+="1 "+2*this.filterManager.effectElements[4].p.v*this.filterManager.effectElements[9].p.v*.01+" ";n+="0 "+10*c+" 0 0"}else n="1 "+2*this.filterManager.effectElements[4].p.v*this.filterManager.effectElements[9].p.v*.01;i.setAttribute("stroke-dasharray",n)}if((r||this.filterManager.effectElements[4].p._mdf)&&this.pathMasker.setAttribute("stroke-width",2*this.filterManager.effectElements[4].p.v),(r||this.filterManager.effectElements[6].p._mdf)&&this.pathMasker.setAttribute("opacity",this.filterManager.effectElements[6].p.v),(this.filterManager.effectElements[10].p.v===1||this.filterManager.effectElements[10].p.v===2)&&(r||this.filterManager.effectElements[3].p._mdf)){var E=this.filterManager.effectElements[3].p.v;this.pathMasker.setAttribute("stroke","rgb("+bmFloor(255*E[0])+","+bmFloor(255*E[1])+","+bmFloor(255*E[2])+")")}},SVGTritoneFilter.prototype.renderFrame=function(r){if(r||this.filterManager._mdf){var e=this.filterManager.effectElements[0].p.v,t=this.filterManager.effectElements[1].p.v,i=this.filterManager.effectElements[2].p.v,s=i[0]+" "+t[0]+" "+e[0],n=i[1]+" "+t[1]+" "+e[1],a=i[2]+" "+t[2]+" "+e[2];this.feFuncR.setAttribute("tableValues",s),this.feFuncG.setAttribute("tableValues",n),this.feFuncB.setAttribute("tableValues",a)}},SVGProLevelsFilter.prototype.createFeFunc=function(r,e){var t=createNS(r);return t.setAttribute("type","table"),e.appendChild(t),t},SVGProLevelsFilter.prototype.getTableValue=function(r,e,t,i,s){for(var n,a,o=0,c=Math.min(r,e),u=Math.max(r,e),f=Array.call(null,{length:256}),d=0,g=s-i,E=e-r;o<=256;)a=(n=o/256)<=c?E<0?s:i:n>=u?E<0?i:s:i+g*Math.pow((n-r)/E,1/t),f[d]=a,d+=1,o+=256/255;return f.join(" ")},SVGProLevelsFilter.prototype.renderFrame=function(r){if(r||this.filterManager._mdf){var e,t=this.filterManager.effectElements;this.feFuncRComposed&&(r||t[3].p._mdf||t[4].p._mdf||t[5].p._mdf||t[6].p._mdf||t[7].p._mdf)&&(e=this.getTableValue(t[3].p.v,t[4].p.v,t[5].p.v,t[6].p.v,t[7].p.v),this.feFuncRComposed.setAttribute("tableValues",e),this.feFuncGComposed.setAttribute("tableValues",e),this.feFuncBComposed.setAttribute("tableValues",e)),this.feFuncR&&(r||t[10].p._mdf||t[11].p._mdf||t[12].p._mdf||t[13].p._mdf||t[14].p._mdf)&&(e=this.getTableValue(t[10].p.v,t[11].p.v,t[12].p.v,t[13].p.v,t[14].p.v),this.feFuncR.setAttribute("tableValues",e)),this.feFuncG&&(r||t[17].p._mdf||t[18].p._mdf||t[19].p._mdf||t[20].p._mdf||t[21].p._mdf)&&(e=this.getTableValue(t[17].p.v,t[18].p.v,t[19].p.v,t[20].p.v,t[21].p.v),this.feFuncG.setAttribute("tableValues",e)),this.feFuncB&&(r||t[24].p._mdf||t[25].p._mdf||t[26].p._mdf||t[27].p._mdf||t[28].p._mdf)&&(e=this.getTableValue(t[24].p.v,t[25].p.v,t[26].p.v,t[27].p.v,t[28].p.v),this.feFuncB.setAttribute("tableValues",e)),this.feFuncA&&(r||t[31].p._mdf||t[32].p._mdf||t[33].p._mdf||t[34].p._mdf||t[35].p._mdf)&&(e=this.getTableValue(t[31].p.v,t[32].p.v,t[33].p.v,t[34].p.v,t[35].p.v),this.feFuncA.setAttribute("tableValues",e))}},extendPrototype([SVGComposableEffect],SVGDropShadowEffect),SVGDropShadowEffect.prototype.renderFrame=function(r){if(r||this.filterManager._mdf){if((r||this.filterManager.effectElements[4].p._mdf)&&this.feGaussianBlur.setAttribute("stdDeviation",this.filterManager.effectElements[4].p.v/4),r||this.filterManager.effectElements[0].p._mdf){var e=this.filterManager.effectElements[0].p.v;this.feFlood.setAttribute("flood-color",rgbToHex(Math.round(255*e[0]),Math.round(255*e[1]),Math.round(255*e[2])))}if((r||this.filterManager.effectElements[1].p._mdf)&&this.feFlood.setAttribute("flood-opacity",this.filterManager.effectElements[1].p.v/255),r||this.filterManager.effectElements[2].p._mdf||this.filterManager.effectElements[3].p._mdf){var t=this.filterManager.effectElements[3].p.v,i=(this.filterManager.effectElements[2].p.v-90)*degToRads,s=t*Math.cos(i),n=t*Math.sin(i);this.feOffset.setAttribute("dx",s),this.feOffset.setAttribute("dy",n)}}};var _svgMatteSymbols=[];function SVGMatte3Effect(r,e,t){this.initialized=!1,this.filterManager=e,this.filterElem=r,this.elem=t,t.matteElement=createNS("g"),t.matteElement.appendChild(t.layerElement),t.matteElement.appendChild(t.transformedElement),t.baseElement=t.matteElement}function SVGGaussianBlurEffect(r,e,t,i){r.setAttribute("x","-100%"),r.setAttribute("y","-100%"),r.setAttribute("width","300%"),r.setAttribute("height","300%"),this.filterManager=e;var s=createNS("feGaussianBlur");s.setAttribute("result",i),r.appendChild(s),this.feGaussianBlur=s}function TransformEffect(){}function SVGTransformEffect(r,e){this.init(e)}function CVTransformEffect(r){this.init(r)}return SVGMatte3Effect.prototype.findSymbol=function(r){for(var e=0,t=_svgMatteSymbols.length;e<t;){if(_svgMatteSymbols[e]===r)return _svgMatteSymbols[e];e+=1}return null},SVGMatte3Effect.prototype.replaceInParent=function(r,e){var t=r.layerElement.parentNode;if(t){for(var i,s=t.children,n=0,a=s.length;n<a&&s[n]!==r.layerElement;)n+=1;n<=a-2&&(i=s[n+1]);var o=createNS("use");o.setAttribute("href","#"+e),i?t.insertBefore(o,i):t.appendChild(o)}},SVGMatte3Effect.prototype.setElementAsMask=function(r,e){if(!this.findSymbol(e)){var t=createElementID(),i=createNS("mask");i.setAttribute("id",e.layerId),i.setAttribute("mask-type","alpha"),_svgMatteSymbols.push(e);var s=r.globalData.defs;s.appendChild(i);var n=createNS("symbol");n.setAttribute("id",t),this.replaceInParent(e,t),n.appendChild(e.layerElement),s.appendChild(n);var a=createNS("use");a.setAttribute("href","#"+t),i.appendChild(a),e.data.hd=!1,e.show()}r.setMatte(e.layerId)},SVGMatte3Effect.prototype.initialize=function(){for(var r=this.filterManager.effectElements[0].p.v,e=this.elem.comp.elements,t=0,i=e.length;t<i;)e[t]&&e[t].data.ind===r&&this.setElementAsMask(this.elem,e[t]),t+=1;this.initialized=!0},SVGMatte3Effect.prototype.renderFrame=function(){this.initialized||this.initialize()},SVGGaussianBlurEffect.prototype.renderFrame=function(r){if(r||this.filterManager._mdf){var e=.3*this.filterManager.effectElements[0].p.v,t=this.filterManager.effectElements[1].p.v,i=t==3?0:e,s=t==2?0:e;this.feGaussianBlur.setAttribute("stdDeviation",i+" "+s);var n=this.filterManager.effectElements[2].p.v==1?"wrap":"duplicate";this.feGaussianBlur.setAttribute("edgeMode",n)}},TransformEffect.prototype.init=function(r){this.effectsManager=r,this.type=effectTypes.TRANSFORM_EFFECT,this.matrix=new Matrix,this.opacity=-1,this._mdf=!1,this._opMdf=!1},TransformEffect.prototype.renderFrame=function(r){if(this._opMdf=!1,this._mdf=!1,r||this.effectsManager._mdf){var e=this.effectsManager.effectElements,t=e[0].p.v,i=e[1].p.v,s=e[2].p.v===1,n=e[3].p.v,a=s?n:e[4].p.v,o=e[5].p.v,c=e[6].p.v,u=e[7].p.v;this.matrix.reset(),this.matrix.translate(-t[0],-t[1],t[2]),this.matrix.scale(.01*a,.01*n,1),this.matrix.rotate(-u*degToRads),this.matrix.skewFromAxis(-o*degToRads,(c+90)*degToRads),this.matrix.translate(i[0],i[1],0),this._mdf=!0,this.opacity!==e[8].p.v&&(this.opacity=e[8].p.v,this._opMdf=!0)}},extendPrototype([TransformEffect],SVGTransformEffect),extendPrototype([TransformEffect],CVTransformEffect),registerRenderer("canvas",CanvasRenderer),registerRenderer("html",HybridRenderer),registerRenderer("svg",SVGRenderer),ShapeModifiers.registerModifier("tm",TrimModifier),ShapeModifiers.registerModifier("pb",PuckerAndBloatModifier),ShapeModifiers.registerModifier("rp",RepeaterModifier),ShapeModifiers.registerModifier("rd",RoundCornersModifier),ShapeModifiers.registerModifier("zz",ZigZagModifier),ShapeModifiers.registerModifier("op",OffsetPathModifier),setExpressionsPlugin(Expressions),setExpressionInterfaces(getInterface),initialize$1(),initialize(),registerEffect$1(20,SVGTintFilter,!0),registerEffect$1(21,SVGFillFilter,!0),registerEffect$1(22,SVGStrokeEffect,!1),registerEffect$1(23,SVGTritoneFilter,!0),registerEffect$1(24,SVGProLevelsFilter,!0),registerEffect$1(25,SVGDropShadowEffect,!0),registerEffect$1(28,SVGMatte3Effect,!1),registerEffect$1(29,SVGGaussianBlurEffect,!0),registerEffect$1(35,SVGTransformEffect,!1),registerEffect(35,CVTransformEffect),lottie}))})),REACT_LOTTIE_PLAYER_VERSION="3.6.0",LOTTIE_WEB_VERSION="^5.12.2",PlayerState,PlayerEvent;function parseSrc(r){if(typeof r=="object")return r;try{return JSON.parse(r)}catch{}try{return new URL(r).toString()}catch{}return r}(function(r){r.Loading="loading",r.Playing="playing",r.Paused="paused",r.Stopped="stopped",r.Frozen="frozen",r.Error="error"})(PlayerState||(PlayerState={})),(function(r){r.Load="load",r.InstanceSaved="instanceSaved",r.Error="error",r.Ready="ready",r.Play="play",r.Pause="pause",r.Stop="stop",r.Freeze="freeze",r.Loop="loop",r.Complete="complete",r.Frame="frame"})(PlayerEvent||(PlayerEvent={}));var defaultOptions={clearCanvas:!1,hideOnTransparent:!0,progressiveLoad:!0},Player=(function(r){function e(t){var i=r.call(this,t)||this;return i.container=null,i.unmounted=!1,i.handleBgChange=function(s){i.setState({background:s})},i.triggerDownload=function(s,n){var a=document.createElement("a");a.href=s,a.download=n,document.body.appendChild(a),a.click(),document.body.removeChild(a)},i.snapshot=function(s){var n;s===void 0&&(s=!0);var a=i.props.id?i.props.id:"lottie",o=document.getElementById(a);if(i.props.renderer==="svg"){if(o){var c=o.querySelector("svg");if(c){var u=new XMLSerializer().serializeToString(c);n="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(u)}}s&&i.triggerDownload(n,"snapshot.svg")}else if(i.props.renderer==="canvas"){if(o){var f=o.querySelector("canvas");f&&(n=f.toDataURL("image/png"))}s&&i.triggerDownload(n,"snapshot.png")}return n},typeof window<"u"&&(window.lottie=lottie),i.state={animationData:null,background:"transparent",containerRef:React__namespace.createRef(),debug:!0,instance:null,playerState:PlayerState.Loading,seeker:0},i}return __extends(e,r),e.getDerivedStateFromProps=function(t,i){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(s){return t.background!==i.background?[2,{background:t.background}]:[2,null]}))}))},e.prototype.getVersions=function(){return{lottieWebVersion:LOTTIE_WEB_VERSION,lottiePlayerVersion:REACT_LOTTIE_PLAYER_VERSION}},e.prototype.componentDidMount=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return this.unmounted?[3,2]:[4,this.createLottie()];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))},e.prototype.componentWillUnmount=function(){this.unmounted=!0,this.state.instance&&this.state.instance.destroy()},e.prototype.componentDidUpdate=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(i){switch(i.label){case 0:return this.props.src===t.src?[3,2]:(this.state.instance&&this.state.instance.destroy(),[4,this.createLottie()]);case 1:i.sent(),i.label=2;case 2:return[2]}}))}))},e.prototype.render=function(){var t=this,i=this.props,s=i.children,n=i.loop,a=i.style,o=i.onBackgroundChange,c=i.className,u=this.state,f=u.animationData,d=u.instance,g=u.playerState,E=u.seeker,m=u.debug,T=u.background;return React__namespace.createElement("div",{className:"lf-player-container"},this.state.playerState===PlayerState.Error?React__namespace.createElement("div",{className:"lf-error"},React__namespace.createElement("span",{"aria-label":"error-symbol",role:"img"},"⚠️")):React__namespace.createElement("div",{id:this.props.id?this.props.id:"lottie",ref:function(S){return t.container=S},style:__assign({background:T,margin:"0 auto",outline:"none",overflow:"hidden"},a),className:c}),React__namespace.Children.map(s,(function(S){return React__namespace.isValidElement(S)?React__namespace.cloneElement(S,{animationData:f,background:T,debug:m,instance:d,loop:n,pause:function(){return t.pause()},play:function(){return t.play()},playerState:g,seeker:E,setBackground:function(b){t.setState({background:b}),typeof o=="function"&&o(b)},setSeeker:function(b,C){return t.setSeeker(b,C)},stop:function(){return t.stop()},toggleDebug:function(){return t.toggleDebug()},setLoop:function(b){return t.setLoop(b)},colorChangedEvent:function(b){t.handleBgChange(b)},snapshot:function(){t.snapshot()}}):null})))},e.prototype.toggleDebug=function(){this.setState({debug:!this.state.debug})},e.prototype.createLottie=function(){return __awaiter(this,void 0,void 0,(function(){var t,i,s,n,a,o,c,u,f,d,g,E,m,T,S=this;return __generator(this,(function(b){switch(b.label){case 0:if(t=this.props,i=t.autoplay,s=t.direction,n=t.loop,a=t.lottieRef,o=t.renderer,c=t.speed,u=t.src,f=t.background,d=t.rendererSettings,g=t.hover,E=this.state.instance,!u||!this.container)return[2];b.label=1;case 1:return b.trys.push([1,5,,6]),typeof(m=parseSrc(u))!="string"?[3,4]:[4,fetch(m).catch((function(){throw S.setState({playerState:PlayerState.Error}),S.triggerEvent(PlayerEvent.Error),new Error("@LottieFiles/lottie-react: Animation data could not be fetched.")}))];case 2:return[4,b.sent().json().catch((function(){throw S.setState({playerState:PlayerState.Error}),S.triggerEvent(PlayerEvent.Error),new Error("@LottieFiles/lottie-react: Animation data could not be fetched.")}))];case 3:m=b.sent(),b.label=4;case 4:return E&&E.destroy(),T=lottie.loadAnimation({rendererSettings:d||defaultOptions,animationData:m,autoplay:i||!1,container:this.container,loop:n||!1,renderer:o}),c&&T.setSpeed(c),this.setState({animationData:m}),this.setState({instance:T},(function(){S.triggerEvent(PlayerEvent.InstanceSaved),typeof a=="function"&&a(T),i&&S.play()})),T.addEventListener("enterFrame",(function(){S.triggerEvent(PlayerEvent.Frame),S.setState({seeker:Math.floor(T.currentFrame)})})),T.addEventListener("DOMLoaded",(function(){S.triggerEvent(PlayerEvent.Load)})),T.addEventListener("data_ready",(function(){S.triggerEvent(PlayerEvent.Ready)})),T.addEventListener("data_failed",(function(){S.setState({playerState:PlayerState.Error}),S.triggerEvent(PlayerEvent.Error)})),T.addEventListener("loopComplete",(function(){S.triggerEvent(PlayerEvent.Loop)})),T.addEventListener("complete",(function(){S.triggerEvent(PlayerEvent.Complete),S.setState({playerState:PlayerState.Paused}),S.props.keepLastFrame&&!S.props.loop||S.setSeeker(0)})),this.container&&(this.container.addEventListener("mouseenter",(function(){g&&S.state.playerState!==PlayerState.Playing&&(S.props.keepLastFrame&&S.stop(),S.play())})),this.container.addEventListener("mouseleave",(function(){g&&S.state.playerState===PlayerState.Playing&&S.stop()}))),c&&this.setPlayerSpeed(c),s&&this.setPlayerDirection(s),f&&this.setState({background:f}),[3,6];case 5:return b.sent(),this.setState({playerState:PlayerState.Error}),this.triggerEvent(PlayerEvent.Error),[3,6];case 6:return[2]}}))}))},e.prototype.play=function(){var t=this.state.instance;t&&(this.triggerEvent(PlayerEvent.Play),t.play(),this.setState({playerState:PlayerState.Playing}))},e.prototype.pause=function(){var t=this.state.instance;t&&(this.triggerEvent(PlayerEvent.Pause),t.pause(),this.setState({playerState:PlayerState.Paused}))},e.prototype.stop=function(){var t=this.state.instance;t&&(this.triggerEvent(PlayerEvent.Stop),t.stop(),this.setState({playerState:PlayerState.Stopped}))},e.prototype.setPlayerSpeed=function(t){var i=this.state.instance;i&&i.setSpeed(t)},e.prototype.setPlayerDirection=function(t){var i=this.state.instance;i&&i.setDirection(t)},e.prototype.setSeeker=function(t,i){i===void 0&&(i=!1);var s=this.state,n=s.instance,a=s.playerState;n&&(i&&a===PlayerState.Playing?n.goToAndPlay(t,!0):(n.goToAndStop(t,!0),this.triggerEvent(PlayerEvent.Pause),this.setState({playerState:PlayerState.Paused})))},e.prototype.setLoop=function(t){var i=this.state.instance;i&&(i.loop=t,this.setState({instance:i}))},e.prototype.triggerEvent=function(t){var i=this.props.onEvent;i&&i(t)},e.defaultProps={loop:!1},e})(React__namespace.Component);function styleInject(r,e){e===void 0&&(e={});var t=e.insertAt;if(typeof document<"u"){var i=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",t==="top"&&i.firstChild?i.insertBefore(s,i.firstChild):i.appendChild(s),s.styleSheet?s.styleSheet.cssText=r:s.appendChild(document.createTextNode(r))}}var css_248z=`.lf-progress {
|
|
3
|
-
-webkit-appearance: none;
|
|
4
|
-
-moz-apperance: none;
|
|
5
|
-
width: 100%;
|
|
6
|
-
/* margin: 0 10px; */
|
|
7
|
-
height: 4px;
|
|
8
|
-
border-radius: 3px;
|
|
9
|
-
cursor: pointer;
|
|
10
|
-
}
|
|
11
|
-
.lf-progress:focus {
|
|
12
|
-
outline: none;
|
|
13
|
-
border: none;
|
|
14
|
-
}
|
|
15
|
-
.lf-progress::-moz-range-track {
|
|
16
|
-
cursor: pointer;
|
|
17
|
-
background: none;
|
|
18
|
-
border: none;
|
|
19
|
-
outline: none;
|
|
20
|
-
}
|
|
21
|
-
.lf-progress::-webkit-slider-thumb {
|
|
22
|
-
-webkit-appearance: none !important;
|
|
23
|
-
height: 13px;
|
|
24
|
-
width: 13px;
|
|
25
|
-
border: 0;
|
|
26
|
-
border-radius: 50%;
|
|
27
|
-
background: #0fccce;
|
|
28
|
-
cursor: pointer;
|
|
29
|
-
}
|
|
30
|
-
.lf-progress::-moz-range-thumb {
|
|
31
|
-
-moz-appearance: none !important;
|
|
32
|
-
height: 13px;
|
|
33
|
-
width: 13px;
|
|
34
|
-
border: 0;
|
|
35
|
-
border-radius: 50%;
|
|
36
|
-
background: #0fccce;
|
|
37
|
-
cursor: pointer;
|
|
38
|
-
}
|
|
39
|
-
.lf-progress::-ms-track {
|
|
40
|
-
width: 100%;
|
|
41
|
-
height: 3px;
|
|
42
|
-
cursor: pointer;
|
|
43
|
-
background: transparent;
|
|
44
|
-
border-color: transparent;
|
|
45
|
-
color: transparent;
|
|
46
|
-
}
|
|
47
|
-
.lf-progress::-ms-fill-lower {
|
|
48
|
-
background: #ccc;
|
|
49
|
-
border-radius: 3px;
|
|
50
|
-
}
|
|
51
|
-
.lf-progress::-ms-fill-upper {
|
|
52
|
-
background: #ccc;
|
|
53
|
-
border-radius: 3px;
|
|
54
|
-
}
|
|
55
|
-
.lf-progress::-ms-thumb {
|
|
56
|
-
border: 0;
|
|
57
|
-
height: 15px;
|
|
58
|
-
width: 15px;
|
|
59
|
-
border-radius: 50%;
|
|
60
|
-
background: #0fccce;
|
|
61
|
-
cursor: pointer;
|
|
62
|
-
}
|
|
63
|
-
.lf-progress:focus::-ms-fill-lower {
|
|
64
|
-
background: #ccc;
|
|
65
|
-
}
|
|
66
|
-
.lf-progress:focus::-ms-fill-upper {
|
|
67
|
-
background: #ccc;
|
|
68
|
-
}
|
|
69
|
-
.lf-player-container :focus {
|
|
70
|
-
outline: 0;
|
|
71
|
-
}
|
|
72
|
-
.lf-popover {
|
|
73
|
-
position: relative;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.lf-popover-content {
|
|
77
|
-
display: inline-block;
|
|
78
|
-
position: absolute;
|
|
79
|
-
opacity: 1;
|
|
80
|
-
visibility: visible;
|
|
81
|
-
transform: translate(0, -10px);
|
|
82
|
-
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);
|
|
83
|
-
transition: all 0.3s cubic-bezier(0.75, -0.02, 0.2, 0.97);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.lf-popover-content.hidden {
|
|
87
|
-
opacity: 0;
|
|
88
|
-
visibility: hidden;
|
|
89
|
-
transform: translate(0, 0px);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.lf-player-btn-container {
|
|
93
|
-
display: flex;
|
|
94
|
-
align-items: center;
|
|
95
|
-
}
|
|
96
|
-
.lf-player-btn {
|
|
97
|
-
cursor: pointer;
|
|
98
|
-
fill: #999;
|
|
99
|
-
width: 14px;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.lf-player-btn.active {
|
|
103
|
-
fill: #555;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.lf-popover {
|
|
107
|
-
position: relative;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.lf-popover-content {
|
|
111
|
-
display: inline-block;
|
|
112
|
-
position: absolute;
|
|
113
|
-
background-color: #ffffff;
|
|
114
|
-
opacity: 1;
|
|
115
|
-
|
|
116
|
-
transform: translate(0, -10px);
|
|
117
|
-
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);
|
|
118
|
-
transition: all 0.3s cubic-bezier(0.75, -0.02, 0.2, 0.97);
|
|
119
|
-
padding: 10px;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.lf-popover-content.hidden {
|
|
123
|
-
opacity: 0;
|
|
124
|
-
visibility: hidden;
|
|
125
|
-
transform: translate(0, 0px);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.lf-arrow {
|
|
129
|
-
position: absolute;
|
|
130
|
-
z-index: -1;
|
|
131
|
-
content: '';
|
|
132
|
-
bottom: -9px;
|
|
133
|
-
border-style: solid;
|
|
134
|
-
border-width: 10px 10px 0px 10px;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.lf-left-align,
|
|
138
|
-
.lf-left-align .lfarrow {
|
|
139
|
-
left: 0;
|
|
140
|
-
right: unset;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.lf-right-align,
|
|
144
|
-
.lf-right-align .lf-arrow {
|
|
145
|
-
right: 0;
|
|
146
|
-
left: unset;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
.lf-text-input {
|
|
150
|
-
border: 1px #ccc solid;
|
|
151
|
-
border-radius: 5px;
|
|
152
|
-
padding: 3px;
|
|
153
|
-
width: 60px;
|
|
154
|
-
margin: 0;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
.lf-color-picker {
|
|
158
|
-
display: flex;
|
|
159
|
-
flex-direction: row;
|
|
160
|
-
justify-content: space-between;
|
|
161
|
-
height: 90px;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
.lf-color-selectors {
|
|
165
|
-
display: flex;
|
|
166
|
-
flex-direction: column;
|
|
167
|
-
justify-content: space-between;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
.lf-color-component {
|
|
171
|
-
display: flex;
|
|
172
|
-
flex-direction: row;
|
|
173
|
-
font-size: 12px;
|
|
174
|
-
align-items: center;
|
|
175
|
-
justify-content: center;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
.lf-color-component strong {
|
|
179
|
-
width: 40px;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
.lf-color-component input[type='range'] {
|
|
183
|
-
margin: 0 0 0 10px;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
.lf-color-component input[type='number'] {
|
|
187
|
-
width: 50px;
|
|
188
|
-
margin: 0 0 0 10px;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
.lf-color-preview {
|
|
192
|
-
font-size: 12px;
|
|
193
|
-
display: flex;
|
|
194
|
-
flex-direction: column;
|
|
195
|
-
align-items: center;
|
|
196
|
-
justify-content: space-between;
|
|
197
|
-
padding-left: 5px;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
.lf-preview {
|
|
201
|
-
height: 60px;
|
|
202
|
-
width: 60px;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
.lf-popover-snapshot {
|
|
206
|
-
width: 150px;
|
|
207
|
-
}
|
|
208
|
-
.lf-popover-snapshot h5 {
|
|
209
|
-
margin: 5px 0 10px 0;
|
|
210
|
-
font-size: 0.75rem;
|
|
211
|
-
}
|
|
212
|
-
.lf-popover-snapshot a {
|
|
213
|
-
display: block;
|
|
214
|
-
text-decoration: none;
|
|
215
|
-
}
|
|
216
|
-
.lf-popover-snapshot a:before {
|
|
217
|
-
content: '⥼';
|
|
218
|
-
margin-right: 5px;
|
|
219
|
-
}
|
|
220
|
-
.lf-popover-snapshot .lf-note {
|
|
221
|
-
display: block;
|
|
222
|
-
margin-top: 10px;
|
|
223
|
-
color: #999;
|
|
224
|
-
}
|
|
225
|
-
.lf-player-controls > div {
|
|
226
|
-
margin-right: 5px;
|
|
227
|
-
margin-left: 5px;
|
|
228
|
-
}
|
|
229
|
-
.lf-player-controls > div:first-child {
|
|
230
|
-
margin-left: 0px;
|
|
231
|
-
}
|
|
232
|
-
.lf-player-controls > div:last-child {
|
|
233
|
-
margin-right: 0px;
|
|
234
|
-
}
|
|
235
|
-
`;styleInject(css_248z);var ColorPicker=(function(r){function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.state={red:0,green:0,blue:0,rgba:null,hex:"#000000",colorComponents:[]},t.handleChange=function(i,s){if(i==="r"){var n="#"+(256|s).toString(16).slice(1)+(256|t.state.green).toString(16).slice(1)+(256|t.state.blue).toString(16).slice(1);t.setState({hex:n})}else i==="g"?(n="#"+(256|t.state.red).toString(16).slice(1)+(256|s).toString(16).slice(1)+(256|t.state.blue).toString(16).slice(1),t.setState({hex:n})):i==="b"&&(n="#"+(256|t.state.red).toString(16).slice(1)+(256|t.state.green).toString(16).slice(1)+(256|s).toString(16).slice(1),t.setState({hex:n}))},t.parseColor=function(i){var s;if(typeof i=="string"){if(i[0]==="#"){var n=i.length===4?[i.slice(1,2),i.slice(2,3),i.slice(3,4)].map((function(a){return parseInt(""+a+a,16)})):[i.slice(1,3),i.slice(3,5),i.slice(5,7)].map((function(a){return parseInt(a,16)}));t.setState({colorComponents:n})}else i.startsWith("rgb")&&(n=(s=i.match(/\d+/g))===null||s===void 0?void 0:s.map((function(a){return parseInt(a)})))!==void 0&&t.setState({colorComponents:n});t.state.colorComponents.length&&(t.setState({red:t.state.colorComponents[0]}),t.setState({green:t.state.colorComponents[1]}),t.setState({blue:t.state.colorComponents[2]}))}},t}return __extends(e,r),e.prototype.componentDidUpdate=function(t,i){return this.props.colorChangedEvent&&this.state.hex!==i.hex&&this.props.colorChangedEvent(this.state.hex),!0},e.prototype.render=function(){var t=this;return React__namespace.createElement("div",{className:"lf-color-picker"},React__namespace.createElement("div",{className:"lf-color-selectors"},React__namespace.createElement("div",{className:"lf-color-component"},React__namespace.createElement("strong",null,"Red"),React__namespace.createElement("input",{type:"range",min:"0",max:"255",value:this.state.red,onChange:function(i){t.setState({red:i.target.value}),t.handleChange("r",i.target.value)}}),React__namespace.createElement("input",{className:"lf-text-input",type:"number",min:"0",max:"255",value:this.state.red,onChange:function(i){t.setState({red:i.target.value}),t.handleChange("r",i.target.value)}})),React__namespace.createElement("div",{className:"lf-color-component"},React__namespace.createElement("strong",null,"Green"),React__namespace.createElement("input",{type:"range",min:"0",max:"255",value:this.state.green,onChange:function(i){t.setState({green:i.target.value}),t.handleChange("g",i.target.value)}}),React__namespace.createElement("input",{className:"lf-text-input",type:"number",min:"0",max:"255",value:this.state.green,onChange:function(i){t.setState({green:i.target.value}),t.handleChange("g",i.target.value)}})),React__namespace.createElement("div",{className:"lf-color-component"},React__namespace.createElement("strong",null,"Blue"),React__namespace.createElement("input",{type:"range",min:"0",max:"255",value:this.state.blue,onChange:function(i){t.setState({blue:i.target.value}),t.handleChange("b",i.target.value)}}),React__namespace.createElement("input",{className:"lf-text-input",type:"number",min:"0",max:"255",value:this.state.blue,onChange:function(i){t.setState({blue:i.target.value}),t.handleChange("b",i.target.value)}}))),React__namespace.createElement("div",{className:"lf-color-preview"},React__namespace.createElement("div",{className:"lf-preview",style:{background:"rgb("+this.state.red+", "+this.state.green+", "+this.state.blue+")"}}),React__namespace.createElement("div",null,React__namespace.createElement("input",{className:"lf-text-input",type:"text",value:this.state.hex,onChange:function(i){t.setState({hex:i.target.value}),t.parseColor(i.target.value)}}))))},e})(React__namespace.Component),Popover=function(r){var e=r.children,t=r.icon,i=React.useState(null),s=i[0],n=i[1],a=React.useState(null),o=a[0],c=a[1],u=React.useState(null),f=u[0],d=u[1],g=React.useState(!1),E=g[0],m=g[1];return React.useEffect((function(){if(s&&o){var T=s.getBoundingClientRect(),S=o.getBoundingClientRect(),b=T.left+S.width>window.innerWidth?-1:0;d(b)}}),[f,o,s]),React__namespace.createElement("div",{className:"lf-popover",onMouseOver:function(){m(!0)},onMouseLeave:function(){m(!1)},ref:function(T){n(T)}},React__namespace.createElement("div",{className:" lf-player-btn"},t),React__namespace.createElement("div",{className:"lf-popover-content",ref:function(T){c(T)},style:{bottom:"22px",right:"0px",zIndex:2,visibility:E?"visible":"hidden"}},e))},Seeker=(function(r){function e(t){var i=r.call(this,t)||this;return i.inputRef=React__namespace.createRef(),i.handleChange=function(){return function(s){var n=s.target.value,a=Math.floor(n/100*i.props.max);i.props.onChange(a)}},i.state={value:0},i}return __extends(e,r),e.prototype.render=function(){var t=this.props.value/this.props.max*100,i={backgroundImage:"-webkit-gradient(linear, left top, right top, color-stop("+t+"%, rgba(15, 204, 206, 0.4)), color-stop("+t+"%, #DAE1E7))"},s={position:"absolute",left:0,marginTop:"8px",width:"20px",display:"block",border:"0px",backgroundColor:this.props.darkTheme?"#505050":"rgb(218, 225, 231)",color:this.props.darkTheme?"#B9B9B9":"#555",padding:"2px",textAlign:"center",borderRadius:"3px",fontSize:"8px",fontWeight:"bold"},n={position:"absolute",right:0,marginTop:"8px",width:"20px",display:"block",border:"0px",backgroundColor:this.props.darkTheme?"#505050":"rgb(218, 225, 231)",color:this.props.darkTheme?"#B9B9B9":"#555",padding:"2px",textAlign:"center",borderRadius:"3px",fontSize:"8px",fontWeight:"bold"};return React__namespace.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",width:"100%",marginRight:"5px",marginLeft:"5px",position:"relative"}},React__namespace.createElement("input",{ref:this.inputRef,id:"track",className:"lf-progress",name:"progress","aria-label":"progress",type:"range",min:"0",max:"100",step:"0.1",value:t,onInput:this.handleChange(),onChange:this.handleChange(),style:i}),this.props.showLabels&&React__namespace.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},React__namespace.createElement("div",{style:s},this.props.min),React__namespace.createElement("div",{style:n},this.props.max)))},e})(React__namespace.Component),ControlButtonStyle={display:"inline-flex",cursor:"pointer"};(function(r){function e(t){var i=r.call(this,t)||this;return i.state={activeFrame:0,mouseDown:!1},i}return __extends(e,r),e.prototype.render=function(){var t=this,i=this.props,s=i.instance,n=i.playerState,a=i.seeker,o=i.setLoop,c=i.setSeeker,u=i.play,f=i.pause,d=i.stop,g=i.visible,E=i.buttons;if(!s||!g)return null;var m=!E||E.includes("play"),T=!E||E.includes("stop"),S=!E||E.includes("repeat"),b=!E||E.includes("frame"),C=!E||E.includes("background"),I=!E||E.includes("snapshot"),L={width:14,height:14,viewBox:"0 0 24 24"},k=Math.round(s.currentFrame);return React__namespace.createElement("div",{className:"lf-player-controls",style:{display:"flex",justifyContent:"space-between",height:"60px",alignItems:"center",backgroundColor:this.props.transparentTheme?"transparent":this.props.darkTheme?"#3C3C3C":"#ffffff",paddingLeft:"10px",paddingRight:"10px"}},m&&React__namespace.createElement("div",{role:"button","aria-label":n===PlayerState.Playing?PlayerEvent.Pause:PlayerEvent.Play,tabIndex:0,onClick:function(){n===PlayerState.Playing?typeof f=="function"&&f():typeof u=="function"&&u()},onKeyDown:function(){n===PlayerState.Playing?typeof f=="function"&&f():typeof u=="function"&&u()},className:"lf-player-btn",style:ControlButtonStyle},n===PlayerState.Playing?React__namespace.createElement("svg",__assign({},L),React__namespace.createElement("rect",{height:"22.9",rx:"1.9",width:"7.6",x:"14",y:".5"}),React__namespace.createElement("rect",{height:"22.9",rx:"1.9",width:"7.6",x:"2",y:".5"})):React__namespace.createElement("svg",__assign({},L),React__namespace.createElement("path",{d:"M2 3.4C2 1.9 3.5 1 4.8 1.8l16.5 9.6c1.2.7 1.2 2.5 0 3.2L4.8 24.2C3.5 25 2 24.1 2 22.6V3.4z"}))),T&&React__namespace.createElement("div",{tabIndex:0,role:"button","aria-label":PlayerEvent.Stop,onClick:function(){return d&&d()},onKeyDown:function(){return d&&d()},className:n===PlayerState.Stopped?"lf-player-btn active":"lf-player-btn",style:ControlButtonStyle},React__namespace.createElement("svg",__assign({},L),React__namespace.createElement("path",{d:`M2 3.667A1.67 1.67 0 0 1 3.667 2h16.666A1.67 1.67 0 0 1 22 3.667v16.666A1.67 1.67 0 0 1 20.333
|
|
236
|
-
22H3.667A1.67 1.67 0 0 1 2 20.333z`}))),React__namespace.createElement(Seeker,{min:0,step:1,max:s?s.totalFrames:1,value:a||0,onChange:function(U){c&&t.setState({activeFrame:U},(function(){c(U,!1)}))},onChangeEnd:function(U){c&&t.setState({activeFrame:U},(function(){c(U,!1)}))},showLabels:this.props.showLabels,darkTheme:this.props.darkTheme}),b&&React__namespace.createElement("div",{role:"button",className:"lf-player-btn-container"},React__namespace.createElement("input",{style:{outline:"none",border:this.props.darkTheme?"1px #505050 solid":"1px #ccc solid",borderRadius:"3px",width:"40px",textAlign:"center",backgroundColor:this.props.darkTheme?"#505050":"#ffffff",color:this.props.darkTheme?"#B9B9B9":"#999",fontSize:"0.7rem",padding:"0",fontFamily:"inherit"},type:"text",value:k,readOnly:!0})),S&&React__namespace.createElement("div",{role:"button","aria-label":PlayerEvent.Loop,tabIndex:0,onClick:function(){s&&o&&o(!s.loop)},onKeyDown:function(){s&&o&&o(!s.loop)},className:s.loop?"lf-player-btn active":"lf-player-btn",style:ControlButtonStyle},React__namespace.createElement("svg",__assign({},L),React__namespace.createElement("path",{d:`M12.5 16.8137h-.13v1.8939h4.9696c3.6455 0 6.6113-2.9658 6.6113-6.6116
|
|
237
|
-
0-3.64549-2.9658-6.61131-6.6113-6.61131-.5231 0-.947.42391-.947.94696 0 .52304.4239.94696.947.94696 2.6011 0
|
|
238
|
-
4.7174 2.11634 4.7174 4.71739 0 2.6014-2.1166 4.7177-4.7174 4.7177H12.5zM13.6025
|
|
239
|
-
5.61469v-.13H7.48137C3.83582 5.48469.87 8.45051.87 12.096c0 3.6509 3.17269 6.6117 6.81304 6.6117.52304 0
|
|
240
|
-
.94696-.424.94696-.947 0-.5231-.42392-.947-.94696-.947-2.60804 0-4.91907-2.1231-4.91907-4.7176 0-2.60115
|
|
241
|
-
2.11634-4.71744 4.7174-4.71744h6.12113V5.61469z`,stroke:"#8795A1",strokeWidth:".26"}),React__namespace.createElement("path",{d:`M11.1482
|
|
242
|
-
2.20355h0l-.001-.00116c-.3412-.40061-.9405-.44558-1.33668-.0996h-.00001c-.39526.34519-.43936.94795-.09898
|
|
243
|
-
1.34767l2.51487 3.03683-2.51894 3.06468c-.33872.40088-.29282 1.00363.10347
|
|
244
|
-
1.34723l.08517-.0982-.08517.0982c.17853.1549.39807.2308.61647.2308.2671 0 .5328-.114.72-.3347h0l.0011-.0014
|
|
245
|
-
3.0435-3.68655.0006-.00068c.3035-.35872.3025-.88754-.0019-1.24526l-3.0425-3.65786zM13.9453
|
|
246
|
-
21.7965h0l.001.0011c.3413.4006.9407.4456 1.337.0996h0c.3953-.3452.4395-.9479.099-1.3477l-2.5154-3.0368
|
|
247
|
-
2.5195-3.0647c.3388-.4008.2929-1.0036-.1035-1.3472l-.0852.0982.0852-.0982c-.1786-.1549-.3981-.2308-.6166-.2308-.2671
|
|
248
|
-
0-.5329.114-.7202.3347h0l-.0011.0014-3.0442
|
|
249
|
-
3.6865c-.0001.0003-.0003.0005-.0005.0007-.3036.3587-.3027.8876.0019 1.2453l3.0431 3.6579z`,fill:"#8795A1",stroke:"#8795A1",strokeWidth:".26"}))),C&&React__namespace.createElement(Popover,{icon:React__namespace.createElement("svg",__assign({},L),React__namespace.createElement("path",{d:`M12 3.1L6.1 8.6a7.6 7.6 0 00-2.2 4 7.2 7.2 0 00.4 4.4 7.9 7.9 0 003 3.5 8.7 8.7 0 004.7 1.3c1.6 0
|
|
250
|
-
3.2-.5 4.6-1.3s2.4-2 3-3.5a7.2 7.2 0 00.5-4.5 7.6 7.6 0 00-2.2-4L12 3.2zM12 0l7.5 7a9.8 9.8 0 013 5.1
|
|
251
|
-
9.3 9.3 0 01-.6 5.8c-.9 1.8-2.2 3.3-4 4.4A11.2 11.2 0 0112 24a11.2 11.2 0
|
|
252
|
-
01-6-1.7c-1.7-1-3-2.6-3.9-4.4a9.3 9.3 0 01-.6-5.8c.4-2 1.5-3.7 3-5L12 0zM6 14h12c0 1.5-.7 3-1.8 4s-2.6
|
|
253
|
-
1.6-4.2 1.6S9 19 7.8 18s-1.7-2.5-1.7-4z`}))},React__namespace.createElement("div",{slot:"content",className:"lf-popover popover-background"},React__namespace.createElement(ColorPicker,{colorChangedEvent:this.props.colorChangedEvent}))),I&&React__namespace.createElement(Popover,{icon:React__namespace.createElement("svg",__assign({},L),React__namespace.createElement("path",{clipRule:"evenodd",d:`M0 3.01A2.983 2.983 0 012.983.027H16.99a2.983 2.983 0 012.983 2.983v14.008a2.982 2.982 0 01-2.983
|
|
254
|
-
2.983H2.983A2.983 2.983 0 010 17.018zm2.983-.941a.941.941 0 00-.942.94v14.01c0
|
|
255
|
-
.52.422.94.942.94H16.99a.94.94 0 00.941-.94V3.008a.941.941 0 00-.94-.94H2.981z`,fillRule:"evenodd"}),React__namespace.createElement("path",{d:"M12.229 7.945l-2.07 4.598-2.586-2.605-2.414 2.758v2.146h9.656V11.93z"}),React__namespace.createElement("circle",{cx:"7.444",cy:"6.513",r:"2.032"}),React__namespace.createElement("path",{d:`M9.561 23.916h11.25a2.929 2.929 0 002.926-2.927V9.954a1.06 1.06 0 10-2.122 0v11.035a.805.805 0
|
|
256
|
-
01-.803.804H9.562a1.061 1.061 0 100 2.123z`,stroke:"#8795a1",strokeWidth:".215"}))},React__namespace.createElement("div",{slot:"content",className:"lf-popover lf-popover-snapshot",onWheel:function(U){c&&c(k+(U.deltaY>0?-1:1),!1)}},React__namespace.createElement("h5",null,"Frame ",k),React__namespace.createElement("div",{style:{cursor:"pointer",color:"#0FCCCE"},onClick:this.props.snapshot},"Download SVG"),React__namespace.createElement("div",{style:{cursor:"pointer",color:"#0FCCCE"},onClick:this.props.snapshot},"Download PNG"),React__namespace.createElement("i",{className:"lf-note"},"Scroll with mousewheel to find exact frame"))))},e})(React__namespace.Component);const nm="loading-dots",ddd=0,h=40,w=100,meta={g:"@lottiefiles/toolkit-js 0.33.2"},layers=[{ty:4,nm:"Dot 3",sr:1,st:20,op:60,ip:0,hd:!1,ddd:0,bm:0,hasMask:!1,ao:0,ks:{a:{a:0,k:[-24,1,0],ix:1},s:{a:0,k:[100,100,100],ix:6},sk:{a:0,k:0},p:{a:0,k:[80,20.266,0],ix:2},r:{a:0,k:0,ix:10},sa:{a:0,k:0},o:{a:0,k:100,ix:11}},ef:[],shapes:[{ty:"gr",bm:0,hd:!1,mn:"ADBE Vector Group",nm:"Ellipse 1",ix:1,cix:2,np:3,it:[{ty:"el",bm:0,hd:!1,mn:"ADBE Vector Shape - Ellipse",nm:"Ellipse Path 1",d:1,p:{a:0,k:[0,0],ix:3},s:{a:1,k:[{o:{x:.333,y:0},i:{x:.667,y:1},s:[0,0],t:16},{o:{x:.333,y:0},i:{x:.667,y:1},s:[22,22],t:38},{s:[0,0],t:59.896484375}],ix:2}},{ty:"fl",bm:0,hd:!1,mn:"ADBE Vector Graphic - Fill",nm:"Fill 1",c:{a:0,k:[1,1,1],ix:4},r:1,o:{a:0,k:100,ix:5}},{ty:"tr",a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},sk:{a:0,k:0,ix:4},p:{a:0,k:[-24.078,.734],ix:2},r:{a:0,k:0,ix:6},sa:{a:0,k:0,ix:5},o:{a:0,k:100,ix:7}}]}],ind:1},{ty:4,nm:"Dot 2",sr:1,st:10,op:60,ip:0,hd:!1,ddd:0,bm:0,hasMask:!1,ao:0,ks:{a:{a:0,k:[-24,1,0],ix:1},s:{a:0,k:[100,100,100],ix:6},sk:{a:0,k:0},p:{a:0,k:[50.078,20.266,0],ix:2},r:{a:0,k:0,ix:10},sa:{a:0,k:0},o:{a:0,k:100,ix:11}},ef:[],shapes:[{ty:"gr",bm:0,hd:!1,mn:"ADBE Vector Group",nm:"Ellipse 1",ix:1,cix:2,np:3,it:[{ty:"el",bm:0,hd:!1,mn:"ADBE Vector Shape - Ellipse",nm:"Ellipse Path 1",d:1,p:{a:0,k:[0,0],ix:3},s:{a:1,k:[{o:{x:.333,y:0},i:{x:.667,y:1},s:[0,0],t:8},{o:{x:.333,y:0},i:{x:.667,y:1},s:[24,24],t:30},{s:[0,0],t:52}],ix:2}},{ty:"fl",bm:0,hd:!1,mn:"ADBE Vector Graphic - Fill",nm:"Fill 1",c:{a:0,k:[1,1,1],ix:4},r:1,o:{a:0,k:100,ix:5}},{ty:"tr",a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},sk:{a:0,k:0,ix:4},p:{a:0,k:[-24.078,.734],ix:2},r:{a:0,k:0,ix:6},sa:{a:0,k:0,ix:5},o:{a:0,k:100,ix:7}}]}],ind:2},{ty:4,nm:"Dot 1",sr:1,st:0,op:60,ip:0,hd:!1,ddd:0,bm:0,hasMask:!1,ao:0,ks:{a:{a:0,k:[-24,1,0],ix:1},s:{a:0,k:[100,100,100],ix:6},sk:{a:0,k:0},p:{a:0,k:[19.578,20.266,0],ix:2},r:{a:0,k:0,ix:10},sa:{a:0,k:0},o:{a:0,k:100,ix:11}},ef:[],shapes:[{ty:"gr",bm:0,hd:!1,mn:"ADBE Vector Group",nm:"Ellipse 1",ix:1,cix:2,np:3,it:[{ty:"el",bm:0,hd:!1,mn:"ADBE Vector Shape - Ellipse",nm:"Ellipse Path 1",d:1,p:{a:0,k:[0,0],ix:3},s:{a:1,k:[{o:{x:.333,y:0},i:{x:.667,y:1},s:[0,0],t:0},{o:{x:.333,y:0},i:{x:.667,y:1},s:[22,22],t:22},{s:[0,0],t:44}],ix:2}},{ty:"fl",bm:0,hd:!1,mn:"ADBE Vector Graphic - Fill",nm:"Fill 1",c:{a:0,k:[1,1,1],ix:4},r:1,o:{a:0,k:100,ix:5}},{ty:"tr",a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},sk:{a:0,k:0,ix:4},p:{a:0,k:[-24.078,.734],ix:2},r:{a:0,k:0,ix:6},sa:{a:0,k:0,ix:5},o:{a:0,k:100,ix:7}}]}],ind:3}],v="5.6.8",fr=60,op=60,ip=0,assets=[],animationData={nm,ddd,h,w,meta,layers,v,fr,op,ip,assets};var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs$1(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var lodash$1={exports:{}},lodash=lodash$1.exports,hasRequiredLodash;function requireLodash(){return hasRequiredLodash||(hasRequiredLodash=1,(function(r,e){var t={"process.env.NODE_ENV":'"production"'};(function(){var i,s="4.17.21",n=200,a="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",c="Invalid `variable` option passed into `_.template`",u="__lodash_hash_undefined__",f=500,d="__lodash_placeholder__",g=1,E=2,m=4,T=1,S=2,b=1,C=2,I=4,L=8,k=16,U=32,O=64,F=128,G=256,x=512,$=30,X="...",Q=800,ee=16,te=1,re=2,me=3,H=1/0,z=9007199254740991,ie=17976931348623157e292,ne=NaN,he=4294967295,pe=he-1,Pe=he>>>1,ae=[["ary",F],["bind",b],["bindKey",C],["curry",L],["curryRight",k],["flip",x],["partial",U],["partialRight",O],["rearg",G]],Ae="[object Arguments]",Re="[object Array]",Le="[object AsyncFunction]",Y="[object Boolean]",q="[object Date]",le="[object DOMException]",ce="[object Error]",Ee="[object Function]",ve="[object GeneratorFunction]",Be="[object Map]",Ie="[object Number]",Me="[object Null]",Ve="[object Object]",dt="[object Promise]",Qe="[object Proxy]",ze="[object RegExp]",Je="[object Set]",gt="[object String]",yt="[object Symbol]",_t="[object Undefined]",qe="[object WeakMap]",Yt="[object WeakSet]",Dt="[object ArrayBuffer]",St="[object DataView]",Se="[object Float32Array]",lt="[object Float64Array]",ht="[object Int8Array]",pt="[object Int16Array]",Ui="[object Int32Array]",Pi="[object Uint8Array]",Di="[object Uint8ClampedArray]",tr="[object Uint16Array]",ks="[object Uint32Array]",zr=/\b__p \+= '';/g,Ra=/\b(__p \+=) '' \+/g,Tr=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Vi=/&(?:amp|lt|gt|quot|#39);/g,qr=/[&<>"']/g,Xr=RegExp(Vi.source),Ce=RegExp(qr.source),La=/<%-([\s\S]+?)%>/g,xa=/<%([\s\S]+?)%>/g,ni=/<%=([\s\S]+?)%>/g,Wt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,He=/^\w*$/,Os=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,it=/[\\^$.*+?()[\]{}|]/g,_r=RegExp(it.source),Fs=/^\s+/,Zr=/\s/,xt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,gi=/\{\n\/\* \[wrapped with (.+)\] \*/,ai=/,? & /,At=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Qt=/[()=,{}\[\]\/\s]/,yi=/\\(\\)?/g,$i=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,yn=/\w*$/,Ma=/^[-+]0x[0-9a-f]+$/i,Ar=/^0b[01]+$/i,vn=/^\[object .+?Constructor\]$/,wa=/^0o[0-7]+$/i,ir=/^(?:0|[1-9]\d*)$/,br=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Cr=/($^)/,ka=/['\n\r\u2028\u2029\\]/g,Qr="\\ud800-\\udfff",Oa="\\u0300-\\u036f",vt="\\ufe20-\\ufe2f",Ns="\\u20d0-\\u20ff",En=Oa+vt+Ns,Bs="\\u2700-\\u27bf",Us="a-z\\xdf-\\xf6\\xf8-\\xff",Fa="\\xac\\xb1\\xd7\\xf7",Na="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ba="\\u2000-\\u206f",Ua=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Sn="A-Z\\xc0-\\xd6\\xd8-\\xde",Tn="\\ufe0e\\ufe0f",Vs=Fa+Na+Ba+Ua,Jr="['’]",Va="["+Qr+"]",_n="["+Vs+"]",es="["+En+"]",$s="\\d+",$a="["+Bs+"]",rr="["+Us+"]",Ir="[^"+Qr+Vs+$s+Bs+Us+Sn+"]",ts="\\ud83c[\\udffb-\\udfff]",Pr="(?:"+es+"|"+ts+")",oi="[^"+Qr+"]",Gs="(?:\\ud83c[\\udde6-\\uddff]){2}",Hs="[\\ud800-\\udbff][\\udc00-\\udfff]",sr="["+Sn+"]",An="\\u200d",bn="(?:"+rr+"|"+Ir+")",Ga="(?:"+sr+"|"+Ir+")",Cn="(?:"+Jr+"(?:d|ll|m|re|s|t|ve))?",In="(?:"+Jr+"(?:D|LL|M|RE|S|T|VE))?",is=Pr+"?",Pn="["+Tn+"]?",Dn="(?:"+An+"(?:"+[oi,Gs,Hs].join("|")+")"+Pn+is+")*",Ha="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ya="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Rn=Pn+is+Dn,Wa="(?:"+[$a,Gs,Hs].join("|")+")"+Rn,Ka="(?:"+[oi+es+"?",es,Gs,Hs,Va].join("|")+")",ja=RegExp(Jr,"g"),za=RegExp(es,"g"),Ys=RegExp(ts+"(?="+ts+")|"+Ka+Rn,"g"),qa=RegExp([sr+"?"+rr+"+"+Cn+"(?="+[_n,sr,"$"].join("|")+")",Ga+"+"+In+"(?="+[_n,sr+bn,"$"].join("|")+")",sr+"?"+bn+"+"+Cn,sr+"+"+In,Ya,Ha,$s,Wa].join("|"),"g"),Xa=RegExp("["+An+Qr+En+Tn+"]"),Za=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Qa=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Ja=-1,ft={};ft[Se]=ft[lt]=ft[ht]=ft[pt]=ft[Ui]=ft[Pi]=ft[Di]=ft[tr]=ft[ks]=!0,ft[Ae]=ft[Re]=ft[Dt]=ft[Y]=ft[St]=ft[q]=ft[ce]=ft[Ee]=ft[Be]=ft[Ie]=ft[Ve]=ft[ze]=ft[Je]=ft[gt]=ft[qe]=!1;var ut={};ut[Ae]=ut[Re]=ut[Dt]=ut[St]=ut[Y]=ut[q]=ut[Se]=ut[lt]=ut[ht]=ut[pt]=ut[Ui]=ut[Be]=ut[Ie]=ut[Ve]=ut[ze]=ut[Je]=ut[gt]=ut[yt]=ut[Pi]=ut[Di]=ut[tr]=ut[ks]=!0,ut[ce]=ut[Ee]=ut[qe]=!1;var Ws={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Ks={"&":"&","<":"<",">":">",'"':""","'":"'"},eo={"&":"&","<":"<",">":">",""":'"',"'":"'"},Ln={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},xn=parseFloat,to=parseInt,Mn=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,io=typeof self=="object"&&self&&self.Object===Object&&self,It=Mn||io||Function("return this")(),rs=e&&!e.nodeType&&e,rt=rs&&!0&&r&&!r.nodeType&&r,nr=rt&&rt.exports===rs,Gi=nr&&Mn.process,Kt=(function(){try{var Z=rt&&rt.require&&rt.require("util").types;return Z||Gi&&Gi.binding&&Gi.binding("util")}catch{}})(),js=Kt&&Kt.isArrayBuffer,wn=Kt&&Kt.isDate,kn=Kt&&Kt.isMap,Dr=Kt&&Kt.isRegExp,vi=Kt&&Kt.isSet,ss=Kt&&Kt.isTypedArray;function Nt(Z,ue,se){switch(se.length){case 0:return Z.call(ue);case 1:return Z.call(ue,se[0]);case 2:return Z.call(ue,se[0],se[1]);case 3:return Z.call(ue,se[0],se[1],se[2])}return Z.apply(ue,se)}function Ei(Z,ue,se,be){for(var Fe=-1,tt=Z==null?0:Z.length;++Fe<tt;){var nt=Z[Fe];ue(be,nt,se(nt),Z)}return be}function jt(Z,ue){for(var se=-1,be=Z==null?0:Z.length;++se<be&&ue(Z[se],se,Z)!==!1;);return Z}function zs(Z,ue){for(var se=Z==null?0:Z.length;se--&&ue(Z[se],se,Z)!==!1;);return Z}function On(Z,ue){for(var se=-1,be=Z==null?0:Z.length;++se<be;)if(!ue(Z[se],se,Z))return!1;return!0}function Ri(Z,ue){for(var se=-1,be=Z==null?0:Z.length,Fe=0,tt=[];++se<be;){var nt=Z[se];ue(nt,se,Z)&&(tt[Fe++]=nt)}return tt}function ns(Z,ue){var se=Z==null?0:Z.length;return!!se&&Hi(Z,ue,0)>-1}function ar(Z,ue,se){for(var be=-1,Fe=Z==null?0:Z.length;++be<Fe;)if(se(ue,Z[be]))return!0;return!1}function ct(Z,ue){for(var se=-1,be=Z==null?0:Z.length,Fe=Array(be);++se<be;)Fe[se]=ue(Z[se],se,Z);return Fe}function Li(Z,ue){for(var se=-1,be=ue.length,Fe=Z.length;++se<be;)Z[Fe+se]=ue[se];return Z}function qs(Z,ue,se,be){var Fe=-1,tt=Z==null?0:Z.length;for(be&&tt&&(se=Z[++Fe]);++Fe<tt;)se=ue(se,Z[Fe],Fe,Z);return se}function ro(Z,ue,se,be){var Fe=Z==null?0:Z.length;for(be&&Fe&&(se=Z[--Fe]);Fe--;)se=ue(se,Z[Fe],Fe,Z);return se}function as(Z,ue){for(var se=-1,be=Z==null?0:Z.length;++se<be;)if(ue(Z[se],se,Z))return!0;return!1}var so=Rr("length");function no(Z){return Z.split("")}function ao(Z){return Z.match(At)||[]}function Fn(Z,ue,se){var be;return se(Z,function(Fe,tt,nt){if(ue(Fe,tt,nt))return be=tt,!1}),be}function os(Z,ue,se,be){for(var Fe=Z.length,tt=se+(be?1:-1);be?tt--:++tt<Fe;)if(ue(Z[tt],tt,Z))return tt;return-1}function Hi(Z,ue,se){return ue===ue?go(Z,ue,se):os(Z,Yi,se)}function oo(Z,ue,se,be){for(var Fe=se-1,tt=Z.length;++Fe<tt;)if(be(Z[Fe],ue))return Fe;return-1}function Yi(Z){return Z!==Z}function Nn(Z,ue){var se=Z==null?0:Z.length;return se?Zs(Z,ue)/se:ne}function Rr(Z){return function(ue){return ue==null?i:ue[Z]}}function Xs(Z){return function(ue){return Z==null?i:Z[ue]}}function ls(Z,ue,se,be,Fe){return Fe(Z,function(tt,nt,Xe){se=be?(be=!1,tt):ue(se,tt,nt,Xe)}),se}function lo(Z,ue){var se=Z.length;for(Z.sort(ue);se--;)Z[se]=Z[se].value;return Z}function Zs(Z,ue){for(var se,be=-1,Fe=Z.length;++be<Fe;){var tt=ue(Z[be]);tt!==i&&(se=se===i?tt:se+tt)}return se}function Qs(Z,ue){for(var se=-1,be=Array(Z);++se<Z;)be[se]=ue(se);return be}function ho(Z,ue){return ct(ue,function(se){return[se,Z[se]]})}function Js(Z){return Z&&Z.slice(0,Gn(Z)+1).replace(Fs,"")}function Bt(Z){return function(ue){return Z(ue)}}function hs(Z,ue){return ct(ue,function(se){return Z[se]})}function st(Z,ue){return Z.has(ue)}function Bn(Z,ue){for(var se=-1,be=Z.length;++se<be&&Hi(ue,Z[se],0)>-1;);return se}function Un(Z,ue){for(var se=Z.length;se--&&Hi(ue,Z[se],0)>-1;);return se}function Vn(Z,ue){for(var se=Z.length,be=0;se--;)Z[se]===ue&&++be;return be}var uo=Xs(Ws),co=Xs(Ks);function fo(Z){return"\\"+Ln[Z]}function Lr(Z,ue){return Z==null?i:Z[ue]}function or(Z){return Xa.test(Z)}function po(Z){return Za.test(Z)}function mo(Z){for(var ue,se=[];!(ue=Z.next()).done;)se.push(ue.value);return se}function lr(Z){var ue=-1,se=Array(Z.size);return Z.forEach(function(be,Fe){se[++ue]=[Fe,be]}),se}function xr(Z,ue){return function(se){return Z(ue(se))}}function li(Z,ue){for(var se=-1,be=Z.length,Fe=0,tt=[];++se<be;){var nt=Z[se];(nt===ue||nt===d)&&(Z[se]=d,tt[Fe++]=se)}return tt}function us(Z){var ue=-1,se=Array(Z.size);return Z.forEach(function(be){se[++ue]=be}),se}function $n(Z){var ue=-1,se=Array(Z.size);return Z.forEach(function(be){se[++ue]=[be,be]}),se}function go(Z,ue,se){for(var be=se-1,Fe=Z.length;++be<Fe;)if(Z[be]===ue)return be;return-1}function en(Z,ue,se){for(var be=se+1;be--;)if(Z[be]===ue)return be;return be}function xi(Z){return or(Z)?vo(Z):so(Z)}function Ut(Z){return or(Z)?Eo(Z):no(Z)}function Gn(Z){for(var ue=Z.length;ue--&&Zr.test(Z.charAt(ue)););return ue}var yo=Xs(eo);function vo(Z){for(var ue=Ys.lastIndex=0;Ys.test(Z);)++ue;return ue}function Eo(Z){return Z.match(Ys)||[]}function So(Z){return Z.match(qa)||[]}var To=(function Z(ue){ue=ue==null?It:Mi.defaults(It.Object(),ue,Mi.pick(It,Qa));var se=ue.Array,be=ue.Date,Fe=ue.Error,tt=ue.Function,nt=ue.Math,Xe=ue.Object,cs=ue.RegExp,_o=ue.String,Vt=ue.TypeError,Mr=se.prototype,Ao=tt.prototype,hr=Xe.prototype,wr=ue["__core-js_shared__"],fs=Ao.toString,at=hr.hasOwnProperty,bo=0,Hn=(function(){var l=/[^.]+$/.exec(wr&&wr.keys&&wr.keys.IE_PROTO||"");return l?"Symbol(src)_1."+l:""})(),ds=hr.toString,Co=fs.call(Xe),Io=It._,Po=cs("^"+fs.call(at).replace(it,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ps=nr?ue.Buffer:i,wi=ue.Symbol,ms=ue.Uint8Array,Yn=ps?ps.allocUnsafe:i,gs=xr(Xe.getPrototypeOf,Xe),Wn=Xe.create,kr=hr.propertyIsEnumerable,ys=Mr.splice,Kn=wi?wi.isConcatSpreadable:i,Or=wi?wi.iterator:i,Wi=wi?wi.toStringTag:i,vs=(function(){try{var l=Wr(Xe,"defineProperty");return l({},"",{}),l}catch{}})(),Do=ue.clearTimeout!==It.clearTimeout&&ue.clearTimeout,Ro=be&&be.now!==It.Date.now&&be.now,Lo=ue.setTimeout!==It.setTimeout&&ue.setTimeout,Fr=nt.ceil,Nr=nt.floor,Es=Xe.getOwnPropertySymbols,Ss=ps?ps.isBuffer:i,Ki=ue.isFinite,Ts=Mr.join,jn=xr(Xe.keys,Xe),mt=nt.max,Rt=nt.min,zn=be.now,xo=ue.parseInt,qn=nt.random,Mo=Mr.reverse,tn=Wr(ue,"DataView"),Br=Wr(ue,"Map"),rn=Wr(ue,"Promise"),ur=Wr(ue,"Set"),Ur=Wr(ue,"WeakMap"),Vr=Wr(Xe,"create"),_s=Ur&&new Ur,cr={},wo=Kr(tn),ko=Kr(Br),Oo=Kr(rn),Fo=Kr(ur),No=Kr(Ur),As=wi?wi.prototype:i,$r=As?As.valueOf:i,Xn=As?As.toString:i;function B(l){if(Tt(l)&&!Ne(l)&&!(l instanceof Ye)){if(l instanceof kt)return l;if(at.call(l,"__wrapped__"))return Dh(l)}return new kt(l)}var dr=(function(){function l(){}return function(p){if(!Et(p))return{};if(Wn)return Wn(p);l.prototype=p;var _=new l;return l.prototype=i,_}})();function bs(){}function kt(l,p){this.__wrapped__=l,this.__actions__=[],this.__chain__=!!p,this.__index__=0,this.__values__=i}B.templateSettings={escape:La,evaluate:xa,interpolate:ni,variable:"",imports:{_:B}},B.prototype=bs.prototype,B.prototype.constructor=B,kt.prototype=dr(bs.prototype),kt.prototype.constructor=kt;function Ye(l){this.__wrapped__=l,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=he,this.__views__=[]}function Bo(){var l=new Ye(this.__wrapped__);return l.__actions__=zt(this.__actions__),l.__dir__=this.__dir__,l.__filtered__=this.__filtered__,l.__iteratees__=zt(this.__iteratees__),l.__takeCount__=this.__takeCount__,l.__views__=zt(this.__views__),l}function Uo(){if(this.__filtered__){var l=new Ye(this);l.__dir__=-1,l.__filtered__=!0}else l=this.clone(),l.__dir__*=-1;return l}function sn(){var l=this.__wrapped__.value(),p=this.__dir__,_=Ne(l),P=p<0,M=_?l.length:0,V=Mu(0,M,this.__views__),W=V.start,j=V.end,J=j-W,fe=P?j:W-1,de=this.__iteratees__,ge=de.length,Te=0,De=Rt(J,this.__takeCount__);if(!_||!P&&M==J&&De==J)return Zl(l,this.__actions__);var we=[];e:for(;J--&&Te<De;){fe+=p;for(var $e=-1,ke=l[fe];++$e<ge;){var je=de[$e],Ze=je.iteratee,ri=je.type,Ht=Ze(ke);if(ri==re)ke=Ht;else if(!Ht){if(ri==te)continue e;break e}}we[Te++]=ke}return we}Ye.prototype=dr(bs.prototype),Ye.prototype.constructor=Ye;function hi(l){var p=-1,_=l==null?0:l.length;for(this.clear();++p<_;){var P=l[p];this.set(P[0],P[1])}}function Vo(){this.__data__=Vr?Vr(null):{},this.size=0}function $o(l){var p=this.has(l)&&delete this.__data__[l];return this.size-=p?1:0,p}function Go(l){var p=this.__data__;if(Vr){var _=p[l];return _===u?i:_}return at.call(p,l)?p[l]:i}function Ho(l){var p=this.__data__;return Vr?p[l]!==i:at.call(p,l)}function Yo(l,p){var _=this.__data__;return this.size+=this.has(l)?0:1,_[l]=Vr&&p===i?u:p,this}hi.prototype.clear=Vo,hi.prototype.delete=$o,hi.prototype.get=Go,hi.prototype.has=Ho,hi.prototype.set=Yo;function Si(l){var p=-1,_=l==null?0:l.length;for(this.clear();++p<_;){var P=l[p];this.set(P[0],P[1])}}function Zn(){this.__data__=[],this.size=0}function Wo(l){var p=this.__data__,_=Is(p,l);if(_<0)return!1;var P=p.length-1;return _==P?p.pop():ys.call(p,_,1),--this.size,!0}function Ko(l){var p=this.__data__,_=Is(p,l);return _<0?i:p[_][1]}function Qn(l){return Is(this.__data__,l)>-1}function jo(l,p){var _=this.__data__,P=Is(_,l);return P<0?(++this.size,_.push([l,p])):_[P][1]=p,this}Si.prototype.clear=Zn,Si.prototype.delete=Wo,Si.prototype.get=Ko,Si.prototype.has=Qn,Si.prototype.set=jo;function Ti(l){var p=-1,_=l==null?0:l.length;for(this.clear();++p<_;){var P=l[p];this.set(P[0],P[1])}}function zo(){this.size=0,this.__data__={hash:new hi,map:new(Br||Si),string:new hi}}function ki(l){var p=Ea(this,l).delete(l);return this.size-=p?1:0,p}function Jn(l){return Ea(this,l).get(l)}function qo(l){return Ea(this,l).has(l)}function Xo(l,p){var _=Ea(this,l),P=_.size;return _.set(l,p),this.size+=_.size==P?0:1,this}Ti.prototype.clear=zo,Ti.prototype.delete=ki,Ti.prototype.get=Jn,Ti.prototype.has=qo,Ti.prototype.set=Xo;function ji(l){var p=-1,_=l==null?0:l.length;for(this.__data__=new Ti;++p<_;)this.add(l[p])}function ye(l){return this.__data__.set(l,u),this}function Zo(l){return this.__data__.has(l)}ji.prototype.add=ji.prototype.push=ye,ji.prototype.has=Zo;function Jt(l){var p=this.__data__=new Si(l);this.size=p.size}function ea(){this.__data__=new Si,this.size=0}function et(l){var p=this.__data__,_=p.delete(l);return this.size=p.size,_}function Cs(l){return this.__data__.get(l)}function ta(l){return this.__data__.has(l)}function nn(l,p){var _=this.__data__;if(_ instanceof Si){var P=_.__data__;if(!Br||P.length<n-1)return P.push([l,p]),this.size=++_.size,this;_=this.__data__=new Ti(P)}return _.set(l,p),this.size=_.size,this}Jt.prototype.clear=ea,Jt.prototype.delete=et,Jt.prototype.get=Cs,Jt.prototype.has=ta,Jt.prototype.set=nn;function ia(l,p){var _=Ne(l),P=!_&&jr(l),M=!_&&!P&&Sr(l),V=!_&&!P&&!M&&Ms(l),W=_||P||M||V,j=W?Qs(l.length,_o):[],J=j.length;for(var fe in l)(p||at.call(l,fe))&&!(W&&(fe=="length"||M&&(fe=="offset"||fe=="parent")||V&&(fe=="buffer"||fe=="byteLength"||fe=="byteOffset")||Zi(fe,J)))&&j.push(fe);return j}function ra(l){var p=l.length;return p?l[ul(0,p-1)]:i}function Qo(l,p){return Sa(zt(l),Oi(p,0,l.length))}function Jo(l){return Sa(zt(l))}function an(l,p,_){(_!==i&&!Ci(l[p],_)||_===i&&!(p in l))&&ui(l,p,_)}function $t(l,p,_){var P=l[p];(!(at.call(l,p)&&Ci(P,_))||_===i&&!(p in l))&&ui(l,p,_)}function Is(l,p){for(var _=l.length;_--;)if(Ci(l[_][0],p))return _;return-1}function sa(l,p,_,P){return Fi(l,function(M,V,W){p(P,M,_(M),W)}),P}function na(l,p){return l&&Ni(p,Mt(p),l)}function el(l,p){return l&&Ni(p,Xt(p),l)}function ui(l,p,_){p=="__proto__"&&vs?vs(l,p,{configurable:!0,enumerable:!0,value:_,writable:!0}):l[p]=_}function on(l,p){for(var _=-1,P=p.length,M=se(P),V=l==null;++_<P;)M[_]=V?i:Ol(l,p[_]);return M}function Oi(l,p,_){return l===l&&(_!==i&&(l=l<=_?l:_),p!==i&&(l=l>=p?l:p)),l}function Ot(l,p,_,P,M,V){var W,j=p&g,J=p&E,fe=p&m;if(_&&(W=M?_(l,P,M,V):_(l)),W!==i)return W;if(!Et(l))return l;var de=Ne(l);if(de){if(W=ku(l),!j)return zt(l,W)}else{var ge=Ft(l),Te=ge==Ee||ge==ve;if(Sr(l))return eh(l,j);if(ge==Ve||ge==Ae||Te&&!M){if(W=J||Te?{}:Eh(l),!j)return J?Au(l,el(W,l)):_u(l,na(W,l))}else{if(!ut[ge])return M?l:{};W=Ou(l,ge,j)}}V||(V=new Jt);var De=V.get(l);if(De)return De;V.set(l,W),zh(l)?l.forEach(function(ke){W.add(Ot(ke,p,_,ke,l,V))}):Kh(l)&&l.forEach(function(ke,je){W.set(je,Ot(ke,p,_,je,l,V))});var we=fe?J?Tl:Sl:J?Xt:Mt,$e=de?i:we(l);return jt($e||l,function(ke,je){$e&&(je=ke,ke=l[je]),$t(W,je,Ot(ke,p,_,je,l,V))}),W}function tl(l){var p=Mt(l);return function(_){return ci(_,l,p)}}function ci(l,p,_){var P=_.length;if(l==null)return!P;for(l=Xe(l);P--;){var M=_[P],V=p[M],W=l[M];if(W===i&&!(M in l)||!V(W))return!1}return!0}function ln(l,p,_){if(typeof l!="function")throw new Vt(o);return mn(function(){l.apply(i,_)},p)}function Gr(l,p,_,P){var M=-1,V=ns,W=!0,j=l.length,J=[],fe=p.length;if(!j)return J;_&&(p=ct(p,Bt(_))),P?(V=ar,W=!1):p.length>=n&&(V=st,W=!1,p=new ji(p));e:for(;++M<j;){var de=l[M],ge=_==null?de:_(de);if(de=P||de!==0?de:0,W&&ge===ge){for(var Te=fe;Te--;)if(p[Te]===ge)continue e;J.push(de)}else V(p,ge,P)||J.push(de)}return J}var Fi=nh(fi),aa=nh(_i,!0);function il(l,p){var _=!0;return Fi(l,function(P,M,V){return _=!!p(P,M,V),_}),_}function Ps(l,p,_){for(var P=-1,M=l.length;++P<M;){var V=l[P],W=p(V);if(W!=null&&(j===i?W===W&&!ii(W):_(W,j)))var j=W,J=V}return J}function rl(l,p,_,P){var M=l.length;for(_=Ue(_),_<0&&(_=-_>M?0:M+_),P=P===i||P>M?M:Ue(P),P<0&&(P+=M),P=_>P?0:Xh(P);_<P;)l[_++]=p;return l}function oa(l,p){var _=[];return Fi(l,function(P,M,V){p(P,M,V)&&_.push(P)}),_}function Lt(l,p,_,P,M){var V=-1,W=l.length;for(_||(_=Nu),M||(M=[]);++V<W;){var j=l[V];p>0&&_(j)?p>1?Lt(j,p-1,_,P,M):Li(M,j):P||(M[M.length]=j)}return M}var hn=ah(),la=ah(!0);function fi(l,p){return l&&hn(l,p,Mt)}function _i(l,p){return l&&la(l,p,Mt)}function Ds(l,p){return Ri(p,function(_){return Qi(l[_])})}function zi(l,p){p=vr(p,l);for(var _=0,P=p.length;l!=null&&_<P;)l=l[Bi(p[_++])];return _&&_==P?l:i}function ha(l,p,_){var P=p(l);return Ne(l)?P:Li(P,_(l))}function wt(l){return l==null?l===i?_t:Me:Wi&&Wi in Xe(l)?xu(l):Yu(l)}function un(l,p){return l>p}function sl(l,p){return l!=null&&at.call(l,p)}function nl(l,p){return l!=null&&p in Xe(l)}function al(l,p,_){return l>=Rt(p,_)&&l<mt(p,_)}function ei(l,p,_){for(var P=_?ar:ns,M=l[0].length,V=l.length,W=V,j=se(V),J=1/0,fe=[];W--;){var de=l[W];W&&p&&(de=ct(de,Bt(p))),J=Rt(de.length,J),j[W]=!_&&(p||M>=120&&de.length>=120)?new ji(W&&de):i}de=l[0];var ge=-1,Te=j[0];e:for(;++ge<M&&fe.length<J;){var De=de[ge],we=p?p(De):De;if(De=_||De!==0?De:0,!(Te?st(Te,we):P(fe,we,_))){for(W=V;--W;){var $e=j[W];if(!($e?st($e,we):P(l[W],we,_)))continue e}Te&&Te.push(we),fe.push(De)}}return fe}function pr(l,p,_,P){return fi(l,function(M,V,W){p(P,_(M),V,W)}),P}function Hr(l,p,_){p=vr(p,l),l=Ah(l,p);var P=l==null?l:l[Bi(pi(p))];return P==null?i:Nt(P,l,_)}function ua(l){return Tt(l)&&wt(l)==Ae}function ol(l){return Tt(l)&&wt(l)==Dt}function ll(l){return Tt(l)&&wt(l)==q}function Yr(l,p,_,P,M){return l===p?!0:l==null||p==null||!Tt(l)&&!Tt(p)?l!==l&&p!==p:cn(l,p,_,P,Yr,M)}function cn(l,p,_,P,M,V){var W=Ne(l),j=Ne(p),J=W?Re:Ft(l),fe=j?Re:Ft(p);J=J==Ae?Ve:J,fe=fe==Ae?Ve:fe;var de=J==Ve,ge=fe==Ve,Te=J==fe;if(Te&&Sr(l)){if(!Sr(p))return!1;W=!0,de=!1}if(Te&&!de)return V||(V=new Jt),W||Ms(l)?gh(l,p,_,P,M,V):Ru(l,p,J,_,P,M,V);if(!(_&T)){var De=de&&at.call(l,"__wrapped__"),we=ge&&at.call(p,"__wrapped__");if(De||we){var $e=De?l.value():l,ke=we?p.value():p;return V||(V=new Jt),M($e,ke,_,P,V)}}return Te?(V||(V=new Jt),Lu(l,p,_,P,M,V)):!1}function mr(l){return Tt(l)&&Ft(l)==Be}function gr(l,p,_,P){var M=_.length,V=M,W=!P;if(l==null)return!V;for(l=Xe(l);M--;){var j=_[M];if(W&&j[2]?j[1]!==l[j[0]]:!(j[0]in l))return!1}for(;++M<V;){j=_[M];var J=j[0],fe=l[J],de=j[1];if(W&&j[2]){if(fe===i&&!(J in l))return!1}else{var ge=new Jt;if(P)var Te=P(fe,de,J,l,p,ge);if(!(Te===i?Yr(de,fe,T|S,P,ge):Te))return!1}}return!0}function Ke(l){if(!Et(l)||Uu(l))return!1;var p=Qi(l)?Po:vn;return p.test(Kr(l))}function y(l){return Tt(l)&&wt(l)==ze}function A(l){return Tt(l)&&Ft(l)==Je}function D(l){return Tt(l)&&Ia(l.length)&&!!ft[wt(l)]}function R(l){return typeof l=="function"?l:l==null?Zt:typeof l=="object"?Ne(l)?We(l[0],l[1]):Oe(l):ou(l)}function N(l){if(!pn(l))return jn(l);var p=[];for(var _ in Xe(l))at.call(l,_)&&_!="constructor"&&p.push(_);return p}function K(l){if(!Et(l))return Hu(l);var p=pn(l),_=[];for(var P in l)P=="constructor"&&(p||!at.call(l,P))||_.push(P);return _}function oe(l,p){return l<p}function _e(l,p){var _=-1,P=qt(l)?se(l.length):[];return Fi(l,function(M,V,W){P[++_]=p(M,V,W)}),P}function Oe(l){var p=Al(l);return p.length==1&&p[0][2]?Th(p[0][0],p[0][1]):function(_){return _===l||gr(_,l,p)}}function We(l,p){return Cl(l)&&Sh(p)?Th(Bi(l),p):function(_){var P=Ol(_,l);return P===i&&P===p?Fl(_,l):Yr(p,P,T|S)}}function Pt(l,p,_,P,M){l!==p&&hn(p,function(V,W){if(M||(M=new Jt),Et(V))Ai(l,p,W,_,Pt,P,M);else{var j=P?P(Pl(l,W),V,W+"",l,p,M):i;j===i&&(j=V),an(l,W,j)}},Xt)}function Ai(l,p,_,P,M,V,W){var j=Pl(l,_),J=Pl(p,_),fe=W.get(J);if(fe){an(l,_,fe);return}var de=V?V(j,J,_+"",l,p,W):i,ge=de===i;if(ge){var Te=Ne(J),De=!Te&&Sr(J),we=!Te&&!De&&Ms(J);de=J,Te||De||we?Ne(j)?de=j:bt(j)?de=zt(j):De?(ge=!1,de=eh(J,!0)):we?(ge=!1,de=th(J,!0)):de=[]:gn(J)||jr(J)?(de=j,jr(j)?de=Zh(j):(!Et(j)||Qi(j))&&(de=Eh(J))):ge=!1}ge&&(W.set(J,de),M(de,J,P,V,W),W.delete(J)),an(l,_,de)}function bi(l,p){var _=l.length;if(_)return p+=p<0?_:0,Zi(p,_)?l[p]:i}function Yl(l,p,_){p.length?p=ct(p,function(V){return Ne(V)?function(W){return zi(W,V.length===1?V[0]:V)}:V}):p=[Zt];var P=-1;p=ct(p,Bt(xe()));var M=_e(l,function(V,W,j){var J=ct(p,function(fe){return fe(V)});return{criteria:J,index:++P,value:V}});return lo(M,function(V,W){return Tu(V,W,_)})}function hu(l,p){return Wl(l,p,function(_,P){return Fl(l,P)})}function Wl(l,p,_){for(var P=-1,M=p.length,V={};++P<M;){var W=p[P],j=zi(l,W);_(j,W)&&fn(V,vr(W,l),j)}return V}function uu(l){return function(p){return zi(p,l)}}function hl(l,p,_,P){var M=P?oo:Hi,V=-1,W=p.length,j=l;for(l===p&&(p=zt(p)),_&&(j=ct(l,Bt(_)));++V<W;)for(var J=0,fe=p[V],de=_?_(fe):fe;(J=M(j,de,J,P))>-1;)j!==l&&ys.call(j,J,1),ys.call(l,J,1);return l}function Kl(l,p){for(var _=l?p.length:0,P=_-1;_--;){var M=p[_];if(_==P||M!==V){var V=M;Zi(M)?ys.call(l,M,1):dl(l,M)}}return l}function ul(l,p){return l+Nr(qn()*(p-l+1))}function cu(l,p,_,P){for(var M=-1,V=mt(Fr((p-l)/(_||1)),0),W=se(V);V--;)W[P?V:++M]=l,l+=_;return W}function cl(l,p){var _="";if(!l||p<1||p>z)return _;do p%2&&(_+=l),p=Nr(p/2),p&&(l+=l);while(p);return _}function Ge(l,p){return Dl(_h(l,p,Zt),l+"")}function fu(l){return ra(ws(l))}function du(l,p){var _=ws(l);return Sa(_,Oi(p,0,_.length))}function fn(l,p,_,P){if(!Et(l))return l;p=vr(p,l);for(var M=-1,V=p.length,W=V-1,j=l;j!=null&&++M<V;){var J=Bi(p[M]),fe=_;if(J==="__proto__"||J==="constructor"||J==="prototype")return l;if(M!=W){var de=j[J];fe=P?P(de,J,j):i,fe===i&&(fe=Et(de)?de:Zi(p[M+1])?[]:{})}$t(j,J,fe),j=j[J]}return l}var jl=_s?function(l,p){return _s.set(l,p),l}:Zt,pu=vs?function(l,p){return vs(l,"toString",{configurable:!0,enumerable:!1,value:Bl(p),writable:!0})}:Zt;function mu(l){return Sa(ws(l))}function di(l,p,_){var P=-1,M=l.length;p<0&&(p=-p>M?0:M+p),_=_>M?M:_,_<0&&(_+=M),M=p>_?0:_-p>>>0,p>>>=0;for(var V=se(M);++P<M;)V[P]=l[P+p];return V}function gu(l,p){var _;return Fi(l,function(P,M,V){return _=p(P,M,V),!_}),!!_}function ca(l,p,_){var P=0,M=l==null?P:l.length;if(typeof p=="number"&&p===p&&M<=Pe){for(;P<M;){var V=P+M>>>1,W=l[V];W!==null&&!ii(W)&&(_?W<=p:W<p)?P=V+1:M=V}return M}return fl(l,p,Zt,_)}function fl(l,p,_,P){var M=0,V=l==null?0:l.length;if(V===0)return 0;p=_(p);for(var W=p!==p,j=p===null,J=ii(p),fe=p===i;M<V;){var de=Nr((M+V)/2),ge=_(l[de]),Te=ge!==i,De=ge===null,we=ge===ge,$e=ii(ge);if(W)var ke=P||we;else fe?ke=we&&(P||Te):j?ke=we&&Te&&(P||!De):J?ke=we&&Te&&!De&&(P||!$e):De||$e?ke=!1:ke=P?ge<=p:ge<p;ke?M=de+1:V=de}return Rt(V,pe)}function zl(l,p){for(var _=-1,P=l.length,M=0,V=[];++_<P;){var W=l[_],j=p?p(W):W;if(!_||!Ci(j,J)){var J=j;V[M++]=W===0?0:W}}return V}function ql(l){return typeof l=="number"?l:ii(l)?ne:+l}function ti(l){if(typeof l=="string")return l;if(Ne(l))return ct(l,ti)+"";if(ii(l))return Xn?Xn.call(l):"";var p=l+"";return p=="0"&&1/l==-H?"-0":p}function yr(l,p,_){var P=-1,M=ns,V=l.length,W=!0,j=[],J=j;if(_)W=!1,M=ar;else if(V>=n){var fe=p?null:Pu(l);if(fe)return us(fe);W=!1,M=st,J=new ji}else J=p?[]:j;e:for(;++P<V;){var de=l[P],ge=p?p(de):de;if(de=_||de!==0?de:0,W&&ge===ge){for(var Te=J.length;Te--;)if(J[Te]===ge)continue e;p&&J.push(ge),j.push(de)}else M(J,ge,_)||(J!==j&&J.push(ge),j.push(de))}return j}function dl(l,p){return p=vr(p,l),l=Ah(l,p),l==null||delete l[Bi(pi(p))]}function Xl(l,p,_,P){return fn(l,p,_(zi(l,p)),P)}function fa(l,p,_,P){for(var M=l.length,V=P?M:-1;(P?V--:++V<M)&&p(l[V],V,l););return _?di(l,P?0:V,P?V+1:M):di(l,P?V+1:0,P?M:V)}function Zl(l,p){var _=l;return _ instanceof Ye&&(_=_.value()),qs(p,function(P,M){return M.func.apply(M.thisArg,Li([P],M.args))},_)}function pl(l,p,_){var P=l.length;if(P<2)return P?yr(l[0]):[];for(var M=-1,V=se(P);++M<P;)for(var W=l[M],j=-1;++j<P;)j!=M&&(V[M]=Gr(V[M]||W,l[j],p,_));return yr(Lt(V,1),p,_)}function Ql(l,p,_){for(var P=-1,M=l.length,V=p.length,W={};++P<M;){var j=P<V?p[P]:i;_(W,l[P],j)}return W}function ml(l){return bt(l)?l:[]}function gl(l){return typeof l=="function"?l:Zt}function vr(l,p){return Ne(l)?l:Cl(l,p)?[l]:Ph(ot(l))}var yu=Ge;function Er(l,p,_){var P=l.length;return _=_===i?P:_,!p&&_>=P?l:di(l,p,_)}var Jl=Do||function(l){return It.clearTimeout(l)};function eh(l,p){if(p)return l.slice();var _=l.length,P=Yn?Yn(_):new l.constructor(_);return l.copy(P),P}function yl(l){var p=new l.constructor(l.byteLength);return new ms(p).set(new ms(l)),p}function vu(l,p){var _=p?yl(l.buffer):l.buffer;return new l.constructor(_,l.byteOffset,l.byteLength)}function Eu(l){var p=new l.constructor(l.source,yn.exec(l));return p.lastIndex=l.lastIndex,p}function Su(l){return $r?Xe($r.call(l)):{}}function th(l,p){var _=p?yl(l.buffer):l.buffer;return new l.constructor(_,l.byteOffset,l.length)}function ih(l,p){if(l!==p){var _=l!==i,P=l===null,M=l===l,V=ii(l),W=p!==i,j=p===null,J=p===p,fe=ii(p);if(!j&&!fe&&!V&&l>p||V&&W&&J&&!j&&!fe||P&&W&&J||!_&&J||!M)return 1;if(!P&&!V&&!fe&&l<p||fe&&_&&M&&!P&&!V||j&&_&&M||!W&&M||!J)return-1}return 0}function Tu(l,p,_){for(var P=-1,M=l.criteria,V=p.criteria,W=M.length,j=_.length;++P<W;){var J=ih(M[P],V[P]);if(J){if(P>=j)return J;var fe=_[P];return J*(fe=="desc"?-1:1)}}return l.index-p.index}function rh(l,p,_,P){for(var M=-1,V=l.length,W=_.length,j=-1,J=p.length,fe=mt(V-W,0),de=se(J+fe),ge=!P;++j<J;)de[j]=p[j];for(;++M<W;)(ge||M<V)&&(de[_[M]]=l[M]);for(;fe--;)de[j++]=l[M++];return de}function sh(l,p,_,P){for(var M=-1,V=l.length,W=-1,j=_.length,J=-1,fe=p.length,de=mt(V-j,0),ge=se(de+fe),Te=!P;++M<de;)ge[M]=l[M];for(var De=M;++J<fe;)ge[De+J]=p[J];for(;++W<j;)(Te||M<V)&&(ge[De+_[W]]=l[M++]);return ge}function zt(l,p){var _=-1,P=l.length;for(p||(p=se(P));++_<P;)p[_]=l[_];return p}function Ni(l,p,_,P){var M=!_;_||(_={});for(var V=-1,W=p.length;++V<W;){var j=p[V],J=P?P(_[j],l[j],j,_,l):i;J===i&&(J=l[j]),M?ui(_,j,J):$t(_,j,J)}return _}function _u(l,p){return Ni(l,bl(l),p)}function Au(l,p){return Ni(l,yh(l),p)}function da(l,p){return function(_,P){var M=Ne(_)?Ei:sa,V=p?p():{};return M(_,l,xe(P,2),V)}}function Rs(l){return Ge(function(p,_){var P=-1,M=_.length,V=M>1?_[M-1]:i,W=M>2?_[2]:i;for(V=l.length>3&&typeof V=="function"?(M--,V):i,W&&Gt(_[0],_[1],W)&&(V=M<3?i:V,M=1),p=Xe(p);++P<M;){var j=_[P];j&&l(p,j,P,V)}return p})}function nh(l,p){return function(_,P){if(_==null)return _;if(!qt(_))return l(_,P);for(var M=_.length,V=p?M:-1,W=Xe(_);(p?V--:++V<M)&&P(W[V],V,W)!==!1;);return _}}function ah(l){return function(p,_,P){for(var M=-1,V=Xe(p),W=P(p),j=W.length;j--;){var J=W[l?j:++M];if(_(V[J],J,V)===!1)break}return p}}function bu(l,p,_){var P=p&b,M=dn(l);function V(){var W=this&&this!==It&&this instanceof V?M:l;return W.apply(P?_:this,arguments)}return V}function oh(l){return function(p){p=ot(p);var _=or(p)?Ut(p):i,P=_?_[0]:p.charAt(0),M=_?Er(_,1).join(""):p.slice(1);return P[l]()+M}}function Ls(l){return function(p){return qs(nu(su(p).replace(ja,"")),l,"")}}function dn(l){return function(){var p=arguments;switch(p.length){case 0:return new l;case 1:return new l(p[0]);case 2:return new l(p[0],p[1]);case 3:return new l(p[0],p[1],p[2]);case 4:return new l(p[0],p[1],p[2],p[3]);case 5:return new l(p[0],p[1],p[2],p[3],p[4]);case 6:return new l(p[0],p[1],p[2],p[3],p[4],p[5]);case 7:return new l(p[0],p[1],p[2],p[3],p[4],p[5],p[6])}var _=dr(l.prototype),P=l.apply(_,p);return Et(P)?P:_}}function Cu(l,p,_){var P=dn(l);function M(){for(var V=arguments.length,W=se(V),j=V,J=xs(M);j--;)W[j]=arguments[j];var fe=V<3&&W[0]!==J&&W[V-1]!==J?[]:li(W,J);if(V-=fe.length,V<_)return fh(l,p,pa,M.placeholder,i,W,fe,i,i,_-V);var de=this&&this!==It&&this instanceof M?P:l;return Nt(de,this,W)}return M}function lh(l){return function(p,_,P){var M=Xe(p);if(!qt(p)){var V=xe(_,3);p=Mt(p),_=function(j){return V(M[j],j,M)}}var W=l(p,_,P);return W>-1?M[V?p[W]:W]:i}}function hh(l){return Xi(function(p){var _=p.length,P=_,M=kt.prototype.thru;for(l&&p.reverse();P--;){var V=p[P];if(typeof V!="function")throw new Vt(o);if(M&&!W&&va(V)=="wrapper")var W=new kt([],!0)}for(P=W?P:_;++P<_;){V=p[P];var j=va(V),J=j=="wrapper"?_l(V):i;J&&Il(J[0])&&J[1]==(F|L|U|G)&&!J[4].length&&J[9]==1?W=W[va(J[0])].apply(W,J[3]):W=V.length==1&&Il(V)?W[j]():W.thru(V)}return function(){var fe=arguments,de=fe[0];if(W&&fe.length==1&&Ne(de))return W.plant(de).value();for(var ge=0,Te=_?p[ge].apply(this,fe):de;++ge<_;)Te=p[ge].call(this,Te);return Te}})}function pa(l,p,_,P,M,V,W,j,J,fe){var de=p&F,ge=p&b,Te=p&C,De=p&(L|k),we=p&x,$e=Te?i:dn(l);function ke(){for(var je=arguments.length,Ze=se(je),ri=je;ri--;)Ze[ri]=arguments[ri];if(De)var Ht=xs(ke),si=Vn(Ze,Ht);if(P&&(Ze=rh(Ze,P,M,De)),V&&(Ze=sh(Ze,V,W,De)),je-=si,De&&je<fe){var Ct=li(Ze,Ht);return fh(l,p,pa,ke.placeholder,_,Ze,Ct,j,J,fe-je)}var Ii=ge?_:this,er=Te?Ii[l]:l;return je=Ze.length,j?Ze=Wu(Ze,j):we&&je>1&&Ze.reverse(),de&&J<je&&(Ze.length=J),this&&this!==It&&this instanceof ke&&(er=$e||dn(er)),er.apply(Ii,Ze)}return ke}function uh(l,p){return function(_,P){return pr(_,l,p(P),{})}}function ma(l,p){return function(_,P){var M;if(_===i&&P===i)return p;if(_!==i&&(M=_),P!==i){if(M===i)return P;typeof _=="string"||typeof P=="string"?(_=ti(_),P=ti(P)):(_=ql(_),P=ql(P)),M=l(_,P)}return M}}function vl(l){return Xi(function(p){return p=ct(p,Bt(xe())),Ge(function(_){var P=this;return l(p,function(M){return Nt(M,P,_)})})})}function ga(l,p){p=p===i?" ":ti(p);var _=p.length;if(_<2)return _?cl(p,l):p;var P=cl(p,Fr(l/xi(p)));return or(p)?Er(Ut(P),0,l).join(""):P.slice(0,l)}function Iu(l,p,_,P){var M=p&b,V=dn(l);function W(){for(var j=-1,J=arguments.length,fe=-1,de=P.length,ge=se(de+J),Te=this&&this!==It&&this instanceof W?V:l;++fe<de;)ge[fe]=P[fe];for(;J--;)ge[fe++]=arguments[++j];return Nt(Te,M?_:this,ge)}return W}function ch(l){return function(p,_,P){return P&&typeof P!="number"&&Gt(p,_,P)&&(_=P=i),p=Ji(p),_===i?(_=p,p=0):_=Ji(_),P=P===i?p<_?1:-1:Ji(P),cu(p,_,P,l)}}function ya(l){return function(p,_){return typeof p=="string"&&typeof _=="string"||(p=mi(p),_=mi(_)),l(p,_)}}function fh(l,p,_,P,M,V,W,j,J,fe){var de=p&L,ge=de?W:i,Te=de?i:W,De=de?V:i,we=de?i:V;p|=de?U:O,p&=~(de?O:U),p&I||(p&=-4);var $e=[l,p,M,De,ge,we,Te,j,J,fe],ke=_.apply(i,$e);return Il(l)&&bh(ke,$e),ke.placeholder=P,Ch(ke,l,p)}function El(l){var p=nt[l];return function(_,P){if(_=mi(_),P=P==null?0:Rt(Ue(P),292),P&&Ki(_)){var M=(ot(_)+"e").split("e"),V=p(M[0]+"e"+(+M[1]+P));return M=(ot(V)+"e").split("e"),+(M[0]+"e"+(+M[1]-P))}return p(_)}}var Pu=ur&&1/us(new ur([,-0]))[1]==H?function(l){return new ur(l)}:$l;function dh(l){return function(p){var _=Ft(p);return _==Be?lr(p):_==Je?$n(p):ho(p,l(p))}}function qi(l,p,_,P,M,V,W,j){var J=p&C;if(!J&&typeof l!="function")throw new Vt(o);var fe=P?P.length:0;if(fe||(p&=-97,P=M=i),W=W===i?W:mt(Ue(W),0),j=j===i?j:Ue(j),fe-=M?M.length:0,p&O){var de=P,ge=M;P=M=i}var Te=J?i:_l(l),De=[l,p,_,P,M,de,ge,V,W,j];if(Te&&Gu(De,Te),l=De[0],p=De[1],_=De[2],P=De[3],M=De[4],j=De[9]=De[9]===i?J?0:l.length:mt(De[9]-fe,0),!j&&p&(L|k)&&(p&=-25),!p||p==b)var we=bu(l,p,_);else p==L||p==k?we=Cu(l,p,j):(p==U||p==(b|U))&&!M.length?we=Iu(l,p,_,P):we=pa.apply(i,De);var $e=Te?jl:bh;return Ch($e(we,De),l,p)}function ph(l,p,_,P){return l===i||Ci(l,hr[_])&&!at.call(P,_)?p:l}function mh(l,p,_,P,M,V){return Et(l)&&Et(p)&&(V.set(p,l),Pt(l,p,i,mh,V),V.delete(p)),l}function Du(l){return gn(l)?i:l}function gh(l,p,_,P,M,V){var W=_&T,j=l.length,J=p.length;if(j!=J&&!(W&&J>j))return!1;var fe=V.get(l),de=V.get(p);if(fe&&de)return fe==p&&de==l;var ge=-1,Te=!0,De=_&S?new ji:i;for(V.set(l,p),V.set(p,l);++ge<j;){var we=l[ge],$e=p[ge];if(P)var ke=W?P($e,we,ge,p,l,V):P(we,$e,ge,l,p,V);if(ke!==i){if(ke)continue;Te=!1;break}if(De){if(!as(p,function(je,Ze){if(!st(De,Ze)&&(we===je||M(we,je,_,P,V)))return De.push(Ze)})){Te=!1;break}}else if(!(we===$e||M(we,$e,_,P,V))){Te=!1;break}}return V.delete(l),V.delete(p),Te}function Ru(l,p,_,P,M,V,W){switch(_){case St:if(l.byteLength!=p.byteLength||l.byteOffset!=p.byteOffset)return!1;l=l.buffer,p=p.buffer;case Dt:return!(l.byteLength!=p.byteLength||!V(new ms(l),new ms(p)));case Y:case q:case Ie:return Ci(+l,+p);case ce:return l.name==p.name&&l.message==p.message;case ze:case gt:return l==p+"";case Be:var j=lr;case Je:var J=P&T;if(j||(j=us),l.size!=p.size&&!J)return!1;var fe=W.get(l);if(fe)return fe==p;P|=S,W.set(l,p);var de=gh(j(l),j(p),P,M,V,W);return W.delete(l),de;case yt:if($r)return $r.call(l)==$r.call(p)}return!1}function Lu(l,p,_,P,M,V){var W=_&T,j=Sl(l),J=j.length,fe=Sl(p),de=fe.length;if(J!=de&&!W)return!1;for(var ge=J;ge--;){var Te=j[ge];if(!(W?Te in p:at.call(p,Te)))return!1}var De=V.get(l),we=V.get(p);if(De&&we)return De==p&&we==l;var $e=!0;V.set(l,p),V.set(p,l);for(var ke=W;++ge<J;){Te=j[ge];var je=l[Te],Ze=p[Te];if(P)var ri=W?P(Ze,je,Te,p,l,V):P(je,Ze,Te,l,p,V);if(!(ri===i?je===Ze||M(je,Ze,_,P,V):ri)){$e=!1;break}ke||(ke=Te=="constructor")}if($e&&!ke){var Ht=l.constructor,si=p.constructor;Ht!=si&&"constructor"in l&&"constructor"in p&&!(typeof Ht=="function"&&Ht instanceof Ht&&typeof si=="function"&&si instanceof si)&&($e=!1)}return V.delete(l),V.delete(p),$e}function Xi(l){return Dl(_h(l,i,xh),l+"")}function Sl(l){return ha(l,Mt,bl)}function Tl(l){return ha(l,Xt,yh)}var _l=_s?function(l){return _s.get(l)}:$l;function va(l){for(var p=l.name+"",_=cr[p],P=at.call(cr,p)?_.length:0;P--;){var M=_[P],V=M.func;if(V==null||V==l)return M.name}return p}function xs(l){var p=at.call(B,"placeholder")?B:l;return p.placeholder}function xe(){var l=B.iteratee||Ul;return l=l===Ul?R:l,arguments.length?l(arguments[0],arguments[1]):l}function Ea(l,p){var _=l.__data__;return Bu(p)?_[typeof p=="string"?"string":"hash"]:_.map}function Al(l){for(var p=Mt(l),_=p.length;_--;){var P=p[_],M=l[P];p[_]=[P,M,Sh(M)]}return p}function Wr(l,p){var _=Lr(l,p);return Ke(_)?_:i}function xu(l){var p=at.call(l,Wi),_=l[Wi];try{l[Wi]=i;var P=!0}catch{}var M=ds.call(l);return P&&(p?l[Wi]=_:delete l[Wi]),M}var bl=Es?function(l){return l==null?[]:(l=Xe(l),Ri(Es(l),function(p){return kr.call(l,p)}))}:Gl,yh=Es?function(l){for(var p=[];l;)Li(p,bl(l)),l=gs(l);return p}:Gl,Ft=wt;(tn&&Ft(new tn(new ArrayBuffer(1)))!=St||Br&&Ft(new Br)!=Be||rn&&Ft(rn.resolve())!=dt||ur&&Ft(new ur)!=Je||Ur&&Ft(new Ur)!=qe)&&(Ft=function(l){var p=wt(l),_=p==Ve?l.constructor:i,P=_?Kr(_):"";if(P)switch(P){case wo:return St;case ko:return Be;case Oo:return dt;case Fo:return Je;case No:return qe}return p});function Mu(l,p,_){for(var P=-1,M=_.length;++P<M;){var V=_[P],W=V.size;switch(V.type){case"drop":l+=W;break;case"dropRight":p-=W;break;case"take":p=Rt(p,l+W);break;case"takeRight":l=mt(l,p-W);break}}return{start:l,end:p}}function wu(l){var p=l.match(gi);return p?p[1].split(ai):[]}function vh(l,p,_){p=vr(p,l);for(var P=-1,M=p.length,V=!1;++P<M;){var W=Bi(p[P]);if(!(V=l!=null&&_(l,W)))break;l=l[W]}return V||++P!=M?V:(M=l==null?0:l.length,!!M&&Ia(M)&&Zi(W,M)&&(Ne(l)||jr(l)))}function ku(l){var p=l.length,_=new l.constructor(p);return p&&typeof l[0]=="string"&&at.call(l,"index")&&(_.index=l.index,_.input=l.input),_}function Eh(l){return typeof l.constructor=="function"&&!pn(l)?dr(gs(l)):{}}function Ou(l,p,_){var P=l.constructor;switch(p){case Dt:return yl(l);case Y:case q:return new P(+l);case St:return vu(l,_);case Se:case lt:case ht:case pt:case Ui:case Pi:case Di:case tr:case ks:return th(l,_);case Be:return new P;case Ie:case gt:return new P(l);case ze:return Eu(l);case Je:return new P;case yt:return Su(l)}}function Fu(l,p){var _=p.length;if(!_)return l;var P=_-1;return p[P]=(_>1?"& ":"")+p[P],p=p.join(_>2?", ":" "),l.replace(xt,`{
|
|
257
|
-
/* [wrapped with `+p+`] */
|
|
258
|
-
`)}function Nu(l){return Ne(l)||jr(l)||!!(Kn&&l&&l[Kn])}function Zi(l,p){var _=typeof l;return p=p??z,!!p&&(_=="number"||_!="symbol"&&ir.test(l))&&l>-1&&l%1==0&&l<p}function Gt(l,p,_){if(!Et(_))return!1;var P=typeof p;return(P=="number"?qt(_)&&Zi(p,_.length):P=="string"&&p in _)?Ci(_[p],l):!1}function Cl(l,p){if(Ne(l))return!1;var _=typeof l;return _=="number"||_=="symbol"||_=="boolean"||l==null||ii(l)?!0:He.test(l)||!Wt.test(l)||p!=null&&l in Xe(p)}function Bu(l){var p=typeof l;return p=="string"||p=="number"||p=="symbol"||p=="boolean"?l!=="__proto__":l===null}function Il(l){var p=va(l),_=B[p];if(typeof _!="function"||!(p in Ye.prototype))return!1;if(l===_)return!0;var P=_l(_);return!!P&&l===P[0]}function Uu(l){return!!Hn&&Hn in l}var Vu=wr?Qi:Hl;function pn(l){var p=l&&l.constructor,_=typeof p=="function"&&p.prototype||hr;return l===_}function Sh(l){return l===l&&!Et(l)}function Th(l,p){return function(_){return _==null?!1:_[l]===p&&(p!==i||l in Xe(_))}}function $u(l){var p=ba(l,function(P){return _.size===f&&_.clear(),P}),_=p.cache;return p}function Gu(l,p){var _=l[1],P=p[1],M=_|P,V=M<(b|C|F),W=P==F&&_==L||P==F&&_==G&&l[7].length<=p[8]||P==(F|G)&&p[7].length<=p[8]&&_==L;if(!(V||W))return l;P&b&&(l[2]=p[2],M|=_&b?0:I);var j=p[3];if(j){var J=l[3];l[3]=J?rh(J,j,p[4]):j,l[4]=J?li(l[3],d):p[4]}return j=p[5],j&&(J=l[5],l[5]=J?sh(J,j,p[6]):j,l[6]=J?li(l[5],d):p[6]),j=p[7],j&&(l[7]=j),P&F&&(l[8]=l[8]==null?p[8]:Rt(l[8],p[8])),l[9]==null&&(l[9]=p[9]),l[0]=p[0],l[1]=M,l}function Hu(l){var p=[];if(l!=null)for(var _ in Xe(l))p.push(_);return p}function Yu(l){return ds.call(l)}function _h(l,p,_){return p=mt(p===i?l.length-1:p,0),function(){for(var P=arguments,M=-1,V=mt(P.length-p,0),W=se(V);++M<V;)W[M]=P[p+M];M=-1;for(var j=se(p+1);++M<p;)j[M]=P[M];return j[p]=_(W),Nt(l,this,j)}}function Ah(l,p){return p.length<2?l:zi(l,di(p,0,-1))}function Wu(l,p){for(var _=l.length,P=Rt(p.length,_),M=zt(l);P--;){var V=p[P];l[P]=Zi(V,_)?M[V]:i}return l}function Pl(l,p){if(!(p==="constructor"&&typeof l[p]=="function")&&p!="__proto__")return l[p]}var bh=Ih(jl),mn=Lo||function(l,p){return It.setTimeout(l,p)},Dl=Ih(pu);function Ch(l,p,_){var P=p+"";return Dl(l,Fu(P,Ku(wu(P),_)))}function Ih(l){var p=0,_=0;return function(){var P=zn(),M=ee-(P-_);if(_=P,M>0){if(++p>=Q)return arguments[0]}else p=0;return l.apply(i,arguments)}}function Sa(l,p){var _=-1,P=l.length,M=P-1;for(p=p===i?P:p;++_<p;){var V=ul(_,M),W=l[V];l[V]=l[_],l[_]=W}return l.length=p,l}var Ph=$u(function(l){var p=[];return l.charCodeAt(0)===46&&p.push(""),l.replace(Os,function(_,P,M,V){p.push(M?V.replace(yi,"$1"):P||_)}),p});function Bi(l){if(typeof l=="string"||ii(l))return l;var p=l+"";return p=="0"&&1/l==-H?"-0":p}function Kr(l){if(l!=null){try{return fs.call(l)}catch{}try{return l+""}catch{}}return""}function Ku(l,p){return jt(ae,function(_){var P="_."+_[0];p&_[1]&&!ns(l,P)&&l.push(P)}),l.sort()}function Dh(l){if(l instanceof Ye)return l.clone();var p=new kt(l.__wrapped__,l.__chain__);return p.__actions__=zt(l.__actions__),p.__index__=l.__index__,p.__values__=l.__values__,p}function ju(l,p,_){(_?Gt(l,p,_):p===i)?p=1:p=mt(Ue(p),0);var P=l==null?0:l.length;if(!P||p<1)return[];for(var M=0,V=0,W=se(Fr(P/p));M<P;)W[V++]=di(l,M,M+=p);return W}function zu(l){for(var p=-1,_=l==null?0:l.length,P=0,M=[];++p<_;){var V=l[p];V&&(M[P++]=V)}return M}function qu(){var l=arguments.length;if(!l)return[];for(var p=se(l-1),_=arguments[0],P=l;P--;)p[P-1]=arguments[P];return Li(Ne(_)?zt(_):[_],Lt(p,1))}var Xu=Ge(function(l,p){return bt(l)?Gr(l,Lt(p,1,bt,!0)):[]}),Zu=Ge(function(l,p){var _=pi(p);return bt(_)&&(_=i),bt(l)?Gr(l,Lt(p,1,bt,!0),xe(_,2)):[]}),Qu=Ge(function(l,p){var _=pi(p);return bt(_)&&(_=i),bt(l)?Gr(l,Lt(p,1,bt,!0),i,_):[]});function Ju(l,p,_){var P=l==null?0:l.length;return P?(p=_||p===i?1:Ue(p),di(l,p<0?0:p,P)):[]}function ec(l,p,_){var P=l==null?0:l.length;return P?(p=_||p===i?1:Ue(p),p=P-p,di(l,0,p<0?0:p)):[]}function tc(l,p){return l&&l.length?fa(l,xe(p,3),!0,!0):[]}function ic(l,p){return l&&l.length?fa(l,xe(p,3),!0):[]}function rc(l,p,_,P){var M=l==null?0:l.length;return M?(_&&typeof _!="number"&&Gt(l,p,_)&&(_=0,P=M),rl(l,p,_,P)):[]}function Rh(l,p,_){var P=l==null?0:l.length;if(!P)return-1;var M=_==null?0:Ue(_);return M<0&&(M=mt(P+M,0)),os(l,xe(p,3),M)}function Lh(l,p,_){var P=l==null?0:l.length;if(!P)return-1;var M=P-1;return _!==i&&(M=Ue(_),M=_<0?mt(P+M,0):Rt(M,P-1)),os(l,xe(p,3),M,!0)}function xh(l){var p=l==null?0:l.length;return p?Lt(l,1):[]}function sc(l){var p=l==null?0:l.length;return p?Lt(l,H):[]}function nc(l,p){var _=l==null?0:l.length;return _?(p=p===i?1:Ue(p),Lt(l,p)):[]}function ac(l){for(var p=-1,_=l==null?0:l.length,P={};++p<_;){var M=l[p];P[M[0]]=M[1]}return P}function Mh(l){return l&&l.length?l[0]:i}function oc(l,p,_){var P=l==null?0:l.length;if(!P)return-1;var M=_==null?0:Ue(_);return M<0&&(M=mt(P+M,0)),Hi(l,p,M)}function lc(l){var p=l==null?0:l.length;return p?di(l,0,-1):[]}var hc=Ge(function(l){var p=ct(l,ml);return p.length&&p[0]===l[0]?ei(p):[]}),uc=Ge(function(l){var p=pi(l),_=ct(l,ml);return p===pi(_)?p=i:_.pop(),_.length&&_[0]===l[0]?ei(_,xe(p,2)):[]}),cc=Ge(function(l){var p=pi(l),_=ct(l,ml);return p=typeof p=="function"?p:i,p&&_.pop(),_.length&&_[0]===l[0]?ei(_,i,p):[]});function fc(l,p){return l==null?"":Ts.call(l,p)}function pi(l){var p=l==null?0:l.length;return p?l[p-1]:i}function dc(l,p,_){var P=l==null?0:l.length;if(!P)return-1;var M=P;return _!==i&&(M=Ue(_),M=M<0?mt(P+M,0):Rt(M,P-1)),p===p?en(l,p,M):os(l,Yi,M,!0)}function pc(l,p){return l&&l.length?bi(l,Ue(p)):i}var mc=Ge(wh);function wh(l,p){return l&&l.length&&p&&p.length?hl(l,p):l}function gc(l,p,_){return l&&l.length&&p&&p.length?hl(l,p,xe(_,2)):l}function yc(l,p,_){return l&&l.length&&p&&p.length?hl(l,p,i,_):l}var vc=Xi(function(l,p){var _=l==null?0:l.length,P=on(l,p);return Kl(l,ct(p,function(M){return Zi(M,_)?+M:M}).sort(ih)),P});function Ec(l,p){var _=[];if(!(l&&l.length))return _;var P=-1,M=[],V=l.length;for(p=xe(p,3);++P<V;){var W=l[P];p(W,P,l)&&(_.push(W),M.push(P))}return Kl(l,M),_}function Rl(l){return l==null?l:Mo.call(l)}function Sc(l,p,_){var P=l==null?0:l.length;return P?(_&&typeof _!="number"&&Gt(l,p,_)?(p=0,_=P):(p=p==null?0:Ue(p),_=_===i?P:Ue(_)),di(l,p,_)):[]}function Tc(l,p){return ca(l,p)}function _c(l,p,_){return fl(l,p,xe(_,2))}function Ac(l,p){var _=l==null?0:l.length;if(_){var P=ca(l,p);if(P<_&&Ci(l[P],p))return P}return-1}function bc(l,p){return ca(l,p,!0)}function Cc(l,p,_){return fl(l,p,xe(_,2),!0)}function Ic(l,p){var _=l==null?0:l.length;if(_){var P=ca(l,p,!0)-1;if(Ci(l[P],p))return P}return-1}function Pc(l){return l&&l.length?zl(l):[]}function Dc(l,p){return l&&l.length?zl(l,xe(p,2)):[]}function Rc(l){var p=l==null?0:l.length;return p?di(l,1,p):[]}function Lc(l,p,_){return l&&l.length?(p=_||p===i?1:Ue(p),di(l,0,p<0?0:p)):[]}function xc(l,p,_){var P=l==null?0:l.length;return P?(p=_||p===i?1:Ue(p),p=P-p,di(l,p<0?0:p,P)):[]}function Mc(l,p){return l&&l.length?fa(l,xe(p,3),!1,!0):[]}function wc(l,p){return l&&l.length?fa(l,xe(p,3)):[]}var kc=Ge(function(l){return yr(Lt(l,1,bt,!0))}),Oc=Ge(function(l){var p=pi(l);return bt(p)&&(p=i),yr(Lt(l,1,bt,!0),xe(p,2))}),Fc=Ge(function(l){var p=pi(l);return p=typeof p=="function"?p:i,yr(Lt(l,1,bt,!0),i,p)});function Nc(l){return l&&l.length?yr(l):[]}function Bc(l,p){return l&&l.length?yr(l,xe(p,2)):[]}function Uc(l,p){return p=typeof p=="function"?p:i,l&&l.length?yr(l,i,p):[]}function Ll(l){if(!(l&&l.length))return[];var p=0;return l=Ri(l,function(_){if(bt(_))return p=mt(_.length,p),!0}),Qs(p,function(_){return ct(l,Rr(_))})}function kh(l,p){if(!(l&&l.length))return[];var _=Ll(l);return p==null?_:ct(_,function(P){return Nt(p,i,P)})}var Vc=Ge(function(l,p){return bt(l)?Gr(l,p):[]}),$c=Ge(function(l){return pl(Ri(l,bt))}),Gc=Ge(function(l){var p=pi(l);return bt(p)&&(p=i),pl(Ri(l,bt),xe(p,2))}),Hc=Ge(function(l){var p=pi(l);return p=typeof p=="function"?p:i,pl(Ri(l,bt),i,p)}),Yc=Ge(Ll);function Wc(l,p){return Ql(l||[],p||[],$t)}function Kc(l,p){return Ql(l||[],p||[],fn)}var jc=Ge(function(l){var p=l.length,_=p>1?l[p-1]:i;return _=typeof _=="function"?(l.pop(),_):i,kh(l,_)});function Oh(l){var p=B(l);return p.__chain__=!0,p}function zc(l,p){return p(l),l}function Ta(l,p){return p(l)}var qc=Xi(function(l){var p=l.length,_=p?l[0]:0,P=this.__wrapped__,M=function(V){return on(V,l)};return p>1||this.__actions__.length||!(P instanceof Ye)||!Zi(_)?this.thru(M):(P=P.slice(_,+_+(p?1:0)),P.__actions__.push({func:Ta,args:[M],thisArg:i}),new kt(P,this.__chain__).thru(function(V){return p&&!V.length&&V.push(i),V}))});function Xc(){return Oh(this)}function Zc(){return new kt(this.value(),this.__chain__)}function Qc(){this.__values__===i&&(this.__values__=qh(this.value()));var l=this.__index__>=this.__values__.length,p=l?i:this.__values__[this.__index__++];return{done:l,value:p}}function Jc(){return this}function ef(l){for(var p,_=this;_ instanceof bs;){var P=Dh(_);P.__index__=0,P.__values__=i,p?M.__wrapped__=P:p=P;var M=P;_=_.__wrapped__}return M.__wrapped__=l,p}function tf(){var l=this.__wrapped__;if(l instanceof Ye){var p=l;return this.__actions__.length&&(p=new Ye(this)),p=p.reverse(),p.__actions__.push({func:Ta,args:[Rl],thisArg:i}),new kt(p,this.__chain__)}return this.thru(Rl)}function rf(){return Zl(this.__wrapped__,this.__actions__)}var sf=da(function(l,p,_){at.call(l,_)?++l[_]:ui(l,_,1)});function nf(l,p,_){var P=Ne(l)?On:il;return _&&Gt(l,p,_)&&(p=i),P(l,xe(p,3))}function af(l,p){var _=Ne(l)?Ri:oa;return _(l,xe(p,3))}var of=lh(Rh),lf=lh(Lh);function hf(l,p){return Lt(_a(l,p),1)}function uf(l,p){return Lt(_a(l,p),H)}function cf(l,p,_){return _=_===i?1:Ue(_),Lt(_a(l,p),_)}function Fh(l,p){var _=Ne(l)?jt:Fi;return _(l,xe(p,3))}function Nh(l,p){var _=Ne(l)?zs:aa;return _(l,xe(p,3))}var ff=da(function(l,p,_){at.call(l,_)?l[_].push(p):ui(l,_,[p])});function df(l,p,_,P){l=qt(l)?l:ws(l),_=_&&!P?Ue(_):0;var M=l.length;return _<0&&(_=mt(M+_,0)),Pa(l)?_<=M&&l.indexOf(p,_)>-1:!!M&&Hi(l,p,_)>-1}var pf=Ge(function(l,p,_){var P=-1,M=typeof p=="function",V=qt(l)?se(l.length):[];return Fi(l,function(W){V[++P]=M?Nt(p,W,_):Hr(W,p,_)}),V}),mf=da(function(l,p,_){ui(l,_,p)});function _a(l,p){var _=Ne(l)?ct:_e;return _(l,xe(p,3))}function gf(l,p,_,P){return l==null?[]:(Ne(p)||(p=p==null?[]:[p]),_=P?i:_,Ne(_)||(_=_==null?[]:[_]),Yl(l,p,_))}var yf=da(function(l,p,_){l[_?0:1].push(p)},function(){return[[],[]]});function vf(l,p,_){var P=Ne(l)?qs:ls,M=arguments.length<3;return P(l,xe(p,4),_,M,Fi)}function Ef(l,p,_){var P=Ne(l)?ro:ls,M=arguments.length<3;return P(l,xe(p,4),_,M,aa)}function Sf(l,p){var _=Ne(l)?Ri:oa;return _(l,Ca(xe(p,3)))}function Tf(l){var p=Ne(l)?ra:fu;return p(l)}function _f(l,p,_){(_?Gt(l,p,_):p===i)?p=1:p=Ue(p);var P=Ne(l)?Qo:du;return P(l,p)}function Af(l){var p=Ne(l)?Jo:mu;return p(l)}function bf(l){if(l==null)return 0;if(qt(l))return Pa(l)?xi(l):l.length;var p=Ft(l);return p==Be||p==Je?l.size:N(l).length}function Cf(l,p,_){var P=Ne(l)?as:gu;return _&&Gt(l,p,_)&&(p=i),P(l,xe(p,3))}var If=Ge(function(l,p){if(l==null)return[];var _=p.length;return _>1&&Gt(l,p[0],p[1])?p=[]:_>2&&Gt(p[0],p[1],p[2])&&(p=[p[0]]),Yl(l,Lt(p,1),[])}),Aa=Ro||function(){return It.Date.now()};function Pf(l,p){if(typeof p!="function")throw new Vt(o);return l=Ue(l),function(){if(--l<1)return p.apply(this,arguments)}}function Bh(l,p,_){return p=_?i:p,p=l&&p==null?l.length:p,qi(l,F,i,i,i,i,p)}function Uh(l,p){var _;if(typeof p!="function")throw new Vt(o);return l=Ue(l),function(){return--l>0&&(_=p.apply(this,arguments)),l<=1&&(p=i),_}}var xl=Ge(function(l,p,_){var P=b;if(_.length){var M=li(_,xs(xl));P|=U}return qi(l,P,p,_,M)}),Vh=Ge(function(l,p,_){var P=b|C;if(_.length){var M=li(_,xs(Vh));P|=U}return qi(p,P,l,_,M)});function $h(l,p,_){p=_?i:p;var P=qi(l,L,i,i,i,i,i,p);return P.placeholder=$h.placeholder,P}function Gh(l,p,_){p=_?i:p;var P=qi(l,k,i,i,i,i,i,p);return P.placeholder=Gh.placeholder,P}function Hh(l,p,_){var P,M,V,W,j,J,fe=0,de=!1,ge=!1,Te=!0;if(typeof l!="function")throw new Vt(o);p=mi(p)||0,Et(_)&&(de=!!_.leading,ge="maxWait"in _,V=ge?mt(mi(_.maxWait)||0,p):V,Te="trailing"in _?!!_.trailing:Te);function De(Ct){var Ii=P,er=M;return P=M=i,fe=Ct,W=l.apply(er,Ii),W}function we(Ct){return fe=Ct,j=mn(je,p),de?De(Ct):W}function $e(Ct){var Ii=Ct-J,er=Ct-fe,lu=p-Ii;return ge?Rt(lu,V-er):lu}function ke(Ct){var Ii=Ct-J,er=Ct-fe;return J===i||Ii>=p||Ii<0||ge&&er>=V}function je(){var Ct=Aa();if(ke(Ct))return Ze(Ct);j=mn(je,$e(Ct))}function Ze(Ct){return j=i,Te&&P?De(Ct):(P=M=i,W)}function ri(){j!==i&&Jl(j),fe=0,P=J=M=j=i}function Ht(){return j===i?W:Ze(Aa())}function si(){var Ct=Aa(),Ii=ke(Ct);if(P=arguments,M=this,J=Ct,Ii){if(j===i)return we(J);if(ge)return Jl(j),j=mn(je,p),De(J)}return j===i&&(j=mn(je,p)),W}return si.cancel=ri,si.flush=Ht,si}var Df=Ge(function(l,p){return ln(l,1,p)}),Rf=Ge(function(l,p,_){return ln(l,mi(p)||0,_)});function Lf(l){return qi(l,x)}function ba(l,p){if(typeof l!="function"||p!=null&&typeof p!="function")throw new Vt(o);var _=function(){var P=arguments,M=p?p.apply(this,P):P[0],V=_.cache;if(V.has(M))return V.get(M);var W=l.apply(this,P);return _.cache=V.set(M,W)||V,W};return _.cache=new(ba.Cache||Ti),_}ba.Cache=Ti;function Ca(l){if(typeof l!="function")throw new Vt(o);return function(){var p=arguments;switch(p.length){case 0:return!l.call(this);case 1:return!l.call(this,p[0]);case 2:return!l.call(this,p[0],p[1]);case 3:return!l.call(this,p[0],p[1],p[2])}return!l.apply(this,p)}}function xf(l){return Uh(2,l)}var Mf=yu(function(l,p){p=p.length==1&&Ne(p[0])?ct(p[0],Bt(xe())):ct(Lt(p,1),Bt(xe()));var _=p.length;return Ge(function(P){for(var M=-1,V=Rt(P.length,_);++M<V;)P[M]=p[M].call(this,P[M]);return Nt(l,this,P)})}),Ml=Ge(function(l,p){var _=li(p,xs(Ml));return qi(l,U,i,p,_)}),Yh=Ge(function(l,p){var _=li(p,xs(Yh));return qi(l,O,i,p,_)}),wf=Xi(function(l,p){return qi(l,G,i,i,i,p)});function kf(l,p){if(typeof l!="function")throw new Vt(o);return p=p===i?p:Ue(p),Ge(l,p)}function Of(l,p){if(typeof l!="function")throw new Vt(o);return p=p==null?0:mt(Ue(p),0),Ge(function(_){var P=_[p],M=Er(_,0,p);return P&&Li(M,P),Nt(l,this,M)})}function Ff(l,p,_){var P=!0,M=!0;if(typeof l!="function")throw new Vt(o);return Et(_)&&(P="leading"in _?!!_.leading:P,M="trailing"in _?!!_.trailing:M),Hh(l,p,{leading:P,maxWait:p,trailing:M})}function Nf(l){return Bh(l,1)}function Bf(l,p){return Ml(gl(p),l)}function Uf(){if(!arguments.length)return[];var l=arguments[0];return Ne(l)?l:[l]}function Vf(l){return Ot(l,m)}function $f(l,p){return p=typeof p=="function"?p:i,Ot(l,m,p)}function Gf(l){return Ot(l,g|m)}function Hf(l,p){return p=typeof p=="function"?p:i,Ot(l,g|m,p)}function Yf(l,p){return p==null||ci(l,p,Mt(p))}function Ci(l,p){return l===p||l!==l&&p!==p}var Wf=ya(un),Kf=ya(function(l,p){return l>=p}),jr=ua((function(){return arguments})())?ua:function(l){return Tt(l)&&at.call(l,"callee")&&!kr.call(l,"callee")},Ne=se.isArray,jf=js?Bt(js):ol;function qt(l){return l!=null&&Ia(l.length)&&!Qi(l)}function bt(l){return Tt(l)&&qt(l)}function zf(l){return l===!0||l===!1||Tt(l)&&wt(l)==Y}var Sr=Ss||Hl,qf=wn?Bt(wn):ll;function Xf(l){return Tt(l)&&l.nodeType===1&&!gn(l)}function Zf(l){if(l==null)return!0;if(qt(l)&&(Ne(l)||typeof l=="string"||typeof l.splice=="function"||Sr(l)||Ms(l)||jr(l)))return!l.length;var p=Ft(l);if(p==Be||p==Je)return!l.size;if(pn(l))return!N(l).length;for(var _ in l)if(at.call(l,_))return!1;return!0}function Qf(l,p){return Yr(l,p)}function Jf(l,p,_){_=typeof _=="function"?_:i;var P=_?_(l,p):i;return P===i?Yr(l,p,i,_):!!P}function wl(l){if(!Tt(l))return!1;var p=wt(l);return p==ce||p==le||typeof l.message=="string"&&typeof l.name=="string"&&!gn(l)}function ed(l){return typeof l=="number"&&Ki(l)}function Qi(l){if(!Et(l))return!1;var p=wt(l);return p==Ee||p==ve||p==Le||p==Qe}function Wh(l){return typeof l=="number"&&l==Ue(l)}function Ia(l){return typeof l=="number"&&l>-1&&l%1==0&&l<=z}function Et(l){var p=typeof l;return l!=null&&(p=="object"||p=="function")}function Tt(l){return l!=null&&typeof l=="object"}var Kh=kn?Bt(kn):mr;function td(l,p){return l===p||gr(l,p,Al(p))}function id(l,p,_){return _=typeof _=="function"?_:i,gr(l,p,Al(p),_)}function rd(l){return jh(l)&&l!=+l}function sd(l){if(Vu(l))throw new Fe(a);return Ke(l)}function nd(l){return l===null}function ad(l){return l==null}function jh(l){return typeof l=="number"||Tt(l)&&wt(l)==Ie}function gn(l){if(!Tt(l)||wt(l)!=Ve)return!1;var p=gs(l);if(p===null)return!0;var _=at.call(p,"constructor")&&p.constructor;return typeof _=="function"&&_ instanceof _&&fs.call(_)==Co}var kl=Dr?Bt(Dr):y;function od(l){return Wh(l)&&l>=-z&&l<=z}var zh=vi?Bt(vi):A;function Pa(l){return typeof l=="string"||!Ne(l)&&Tt(l)&&wt(l)==gt}function ii(l){return typeof l=="symbol"||Tt(l)&&wt(l)==yt}var Ms=ss?Bt(ss):D;function ld(l){return l===i}function hd(l){return Tt(l)&&Ft(l)==qe}function ud(l){return Tt(l)&&wt(l)==Yt}var cd=ya(oe),fd=ya(function(l,p){return l<=p});function qh(l){if(!l)return[];if(qt(l))return Pa(l)?Ut(l):zt(l);if(Or&&l[Or])return mo(l[Or]());var p=Ft(l),_=p==Be?lr:p==Je?us:ws;return _(l)}function Ji(l){if(!l)return l===0?l:0;if(l=mi(l),l===H||l===-H){var p=l<0?-1:1;return p*ie}return l===l?l:0}function Ue(l){var p=Ji(l),_=p%1;return p===p?_?p-_:p:0}function Xh(l){return l?Oi(Ue(l),0,he):0}function mi(l){if(typeof l=="number")return l;if(ii(l))return ne;if(Et(l)){var p=typeof l.valueOf=="function"?l.valueOf():l;l=Et(p)?p+"":p}if(typeof l!="string")return l===0?l:+l;l=Js(l);var _=Ar.test(l);return _||wa.test(l)?to(l.slice(2),_?2:8):Ma.test(l)?ne:+l}function Zh(l){return Ni(l,Xt(l))}function dd(l){return l?Oi(Ue(l),-z,z):l===0?l:0}function ot(l){return l==null?"":ti(l)}var pd=Rs(function(l,p){if(pn(p)||qt(p)){Ni(p,Mt(p),l);return}for(var _ in p)at.call(p,_)&&$t(l,_,p[_])}),Qh=Rs(function(l,p){Ni(p,Xt(p),l)}),Da=Rs(function(l,p,_,P){Ni(p,Xt(p),l,P)}),md=Rs(function(l,p,_,P){Ni(p,Mt(p),l,P)}),gd=Xi(on);function yd(l,p){var _=dr(l);return p==null?_:na(_,p)}var vd=Ge(function(l,p){l=Xe(l);var _=-1,P=p.length,M=P>2?p[2]:i;for(M&&Gt(p[0],p[1],M)&&(P=1);++_<P;)for(var V=p[_],W=Xt(V),j=-1,J=W.length;++j<J;){var fe=W[j],de=l[fe];(de===i||Ci(de,hr[fe])&&!at.call(l,fe))&&(l[fe]=V[fe])}return l}),Ed=Ge(function(l){return l.push(i,mh),Nt(Jh,i,l)});function Sd(l,p){return Fn(l,xe(p,3),fi)}function Td(l,p){return Fn(l,xe(p,3),_i)}function _d(l,p){return l==null?l:hn(l,xe(p,3),Xt)}function Ad(l,p){return l==null?l:la(l,xe(p,3),Xt)}function bd(l,p){return l&&fi(l,xe(p,3))}function Cd(l,p){return l&&_i(l,xe(p,3))}function Id(l){return l==null?[]:Ds(l,Mt(l))}function Pd(l){return l==null?[]:Ds(l,Xt(l))}function Ol(l,p,_){var P=l==null?i:zi(l,p);return P===i?_:P}function Dd(l,p){return l!=null&&vh(l,p,sl)}function Fl(l,p){return l!=null&&vh(l,p,nl)}var Rd=uh(function(l,p,_){p!=null&&typeof p.toString!="function"&&(p=ds.call(p)),l[p]=_},Bl(Zt)),Ld=uh(function(l,p,_){p!=null&&typeof p.toString!="function"&&(p=ds.call(p)),at.call(l,p)?l[p].push(_):l[p]=[_]},xe),xd=Ge(Hr);function Mt(l){return qt(l)?ia(l):N(l)}function Xt(l){return qt(l)?ia(l,!0):K(l)}function Md(l,p){var _={};return p=xe(p,3),fi(l,function(P,M,V){ui(_,p(P,M,V),P)}),_}function wd(l,p){var _={};return p=xe(p,3),fi(l,function(P,M,V){ui(_,M,p(P,M,V))}),_}var kd=Rs(function(l,p,_){Pt(l,p,_)}),Jh=Rs(function(l,p,_,P){Pt(l,p,_,P)}),Od=Xi(function(l,p){var _={};if(l==null)return _;var P=!1;p=ct(p,function(V){return V=vr(V,l),P||(P=V.length>1),V}),Ni(l,Tl(l),_),P&&(_=Ot(_,g|E|m,Du));for(var M=p.length;M--;)dl(_,p[M]);return _});function Fd(l,p){return eu(l,Ca(xe(p)))}var Nd=Xi(function(l,p){return l==null?{}:hu(l,p)});function eu(l,p){if(l==null)return{};var _=ct(Tl(l),function(P){return[P]});return p=xe(p),Wl(l,_,function(P,M){return p(P,M[0])})}function Bd(l,p,_){p=vr(p,l);var P=-1,M=p.length;for(M||(M=1,l=i);++P<M;){var V=l==null?i:l[Bi(p[P])];V===i&&(P=M,V=_),l=Qi(V)?V.call(l):V}return l}function Ud(l,p,_){return l==null?l:fn(l,p,_)}function Vd(l,p,_,P){return P=typeof P=="function"?P:i,l==null?l:fn(l,p,_,P)}var tu=dh(Mt),iu=dh(Xt);function $d(l,p,_){var P=Ne(l),M=P||Sr(l)||Ms(l);if(p=xe(p,4),_==null){var V=l&&l.constructor;M?_=P?new V:[]:Et(l)?_=Qi(V)?dr(gs(l)):{}:_={}}return(M?jt:fi)(l,function(W,j,J){return p(_,W,j,J)}),_}function Gd(l,p){return l==null?!0:dl(l,p)}function Hd(l,p,_){return l==null?l:Xl(l,p,gl(_))}function Yd(l,p,_,P){return P=typeof P=="function"?P:i,l==null?l:Xl(l,p,gl(_),P)}function ws(l){return l==null?[]:hs(l,Mt(l))}function Wd(l){return l==null?[]:hs(l,Xt(l))}function Kd(l,p,_){return _===i&&(_=p,p=i),_!==i&&(_=mi(_),_=_===_?_:0),p!==i&&(p=mi(p),p=p===p?p:0),Oi(mi(l),p,_)}function jd(l,p,_){return p=Ji(p),_===i?(_=p,p=0):_=Ji(_),l=mi(l),al(l,p,_)}function zd(l,p,_){if(_&&typeof _!="boolean"&&Gt(l,p,_)&&(p=_=i),_===i&&(typeof p=="boolean"?(_=p,p=i):typeof l=="boolean"&&(_=l,l=i)),l===i&&p===i?(l=0,p=1):(l=Ji(l),p===i?(p=l,l=0):p=Ji(p)),l>p){var P=l;l=p,p=P}if(_||l%1||p%1){var M=qn();return Rt(l+M*(p-l+xn("1e-"+((M+"").length-1))),p)}return ul(l,p)}var qd=Ls(function(l,p,_){return p=p.toLowerCase(),l+(_?ru(p):p)});function ru(l){return Nl(ot(l).toLowerCase())}function su(l){return l=ot(l),l&&l.replace(br,uo).replace(za,"")}function Xd(l,p,_){l=ot(l),p=ti(p);var P=l.length;_=_===i?P:Oi(Ue(_),0,P);var M=_;return _-=p.length,_>=0&&l.slice(_,M)==p}function Zd(l){return l=ot(l),l&&Ce.test(l)?l.replace(qr,co):l}function Qd(l){return l=ot(l),l&&_r.test(l)?l.replace(it,"\\$&"):l}var Jd=Ls(function(l,p,_){return l+(_?"-":"")+p.toLowerCase()}),ep=Ls(function(l,p,_){return l+(_?" ":"")+p.toLowerCase()}),tp=oh("toLowerCase");function rp(l,p,_){l=ot(l),p=Ue(p);var P=p?xi(l):0;if(!p||P>=p)return l;var M=(p-P)/2;return ga(Nr(M),_)+l+ga(Fr(M),_)}function sp(l,p,_){l=ot(l),p=Ue(p);var P=p?xi(l):0;return p&&P<p?l+ga(p-P,_):l}function np(l,p,_){l=ot(l),p=Ue(p);var P=p?xi(l):0;return p&&P<p?ga(p-P,_)+l:l}function ap(l,p,_){return _||p==null?p=0:p&&(p=+p),xo(ot(l).replace(Fs,""),p||0)}function lp(l,p,_){return(_?Gt(l,p,_):p===i)?p=1:p=Ue(p),cl(ot(l),p)}function hp(){var l=arguments,p=ot(l[0]);return l.length<3?p:p.replace(l[1],l[2])}var up=Ls(function(l,p,_){return l+(_?"_":"")+p.toLowerCase()});function cp(l,p,_){return _&&typeof _!="number"&&Gt(l,p,_)&&(p=_=i),_=_===i?he:_>>>0,_?(l=ot(l),l&&(typeof p=="string"||p!=null&&!kl(p))&&(p=ti(p),!p&&or(l))?Er(Ut(l),0,_):l.split(p,_)):[]}var fp=Ls(function(l,p,_){return l+(_?" ":"")+Nl(p)});function dp(l,p,_){return l=ot(l),_=_==null?0:Oi(Ue(_),0,l.length),p=ti(p),l.slice(_,_+p.length)==p}function pp(l,p,_){var P=B.templateSettings;_&&Gt(l,p,_)&&(p=i),l=ot(l),p=Da({},p,P,ph);var M=Da({},p.imports,P.imports,ph),V=Mt(M),W=hs(M,V),j,J,fe=0,de=p.interpolate||Cr,ge="__p += '",Te=cs((p.escape||Cr).source+"|"+de.source+"|"+(de===ni?$i:Cr).source+"|"+(p.evaluate||Cr).source+"|$","g"),De="//# sourceURL="+(at.call(p,"sourceURL")?(p.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Ja+"]")+`
|
|
259
|
-
`;l.replace(Te,function(ke,je,Ze,ri,Ht,si){return Ze||(Ze=ri),ge+=l.slice(fe,si).replace(ka,fo),je&&(j=!0,ge+=`' +
|
|
260
|
-
__e(`+je+`) +
|
|
261
|
-
'`),Ht&&(J=!0,ge+=`';
|
|
262
|
-
`+Ht+`;
|
|
263
|
-
__p += '`),Ze&&(ge+=`' +
|
|
264
|
-
((__t = (`+Ze+`)) == null ? '' : __t) +
|
|
265
|
-
'`),fe=si+ke.length,ke}),ge+=`';
|
|
266
|
-
`;var we=at.call(p,"variable")&&p.variable;if(!we)ge=`with (obj) {
|
|
267
|
-
`+ge+`
|
|
268
|
-
}
|
|
269
|
-
`;else if(Qt.test(we))throw new Fe(c);ge=(J?ge.replace(zr,""):ge).replace(Ra,"$1").replace(Tr,"$1;"),ge="function("+(we||"obj")+`) {
|
|
270
|
-
`+(we?"":`obj || (obj = {});
|
|
271
|
-
`)+"var __t, __p = ''"+(j?", __e = _.escape":"")+(J?`, __j = Array.prototype.join;
|
|
272
|
-
function print() { __p += __j.call(arguments, '') }
|
|
273
|
-
`:`;
|
|
274
|
-
`)+ge+`return __p
|
|
275
|
-
}`;var $e=au(function(){return tt(V,De+"return "+ge).apply(i,W)});if($e.source=ge,wl($e))throw $e;return $e}function mp(l){return ot(l).toLowerCase()}function gp(l){return ot(l).toUpperCase()}function yp(l,p,_){if(l=ot(l),l&&(_||p===i))return Js(l);if(!l||!(p=ti(p)))return l;var P=Ut(l),M=Ut(p),V=Bn(P,M),W=Un(P,M)+1;return Er(P,V,W).join("")}function vp(l,p,_){if(l=ot(l),l&&(_||p===i))return l.slice(0,Gn(l)+1);if(!l||!(p=ti(p)))return l;var P=Ut(l),M=Un(P,Ut(p))+1;return Er(P,0,M).join("")}function Ep(l,p,_){if(l=ot(l),l&&(_||p===i))return l.replace(Fs,"");if(!l||!(p=ti(p)))return l;var P=Ut(l),M=Bn(P,Ut(p));return Er(P,M).join("")}function Sp(l,p){var _=$,P=X;if(Et(p)){var M="separator"in p?p.separator:M;_="length"in p?Ue(p.length):_,P="omission"in p?ti(p.omission):P}l=ot(l);var V=l.length;if(or(l)){var W=Ut(l);V=W.length}if(_>=V)return l;var j=_-xi(P);if(j<1)return P;var J=W?Er(W,0,j).join(""):l.slice(0,j);if(M===i)return J+P;if(W&&(j+=J.length-j),kl(M)){if(l.slice(j).search(M)){var fe,de=J;for(M.global||(M=cs(M.source,ot(yn.exec(M))+"g")),M.lastIndex=0;fe=M.exec(de);)var ge=fe.index;J=J.slice(0,ge===i?j:ge)}}else if(l.indexOf(ti(M),j)!=j){var Te=J.lastIndexOf(M);Te>-1&&(J=J.slice(0,Te))}return J+P}function Tp(l){return l=ot(l),l&&Xr.test(l)?l.replace(Vi,yo):l}var _p=Ls(function(l,p,_){return l+(_?" ":"")+p.toUpperCase()}),Nl=oh("toUpperCase");function nu(l,p,_){return l=ot(l),p=_?i:p,p===i?po(l)?So(l):ao(l):l.match(p)||[]}var au=Ge(function(l,p){try{return Nt(l,i,p)}catch(_){return wl(_)?_:new Fe(_)}}),Ap=Xi(function(l,p){return jt(p,function(_){_=Bi(_),ui(l,_,xl(l[_],l))}),l});function bp(l){var p=l==null?0:l.length,_=xe();return l=p?ct(l,function(P){if(typeof P[1]!="function")throw new Vt(o);return[_(P[0]),P[1]]}):[],Ge(function(P){for(var M=-1;++M<p;){var V=l[M];if(Nt(V[0],this,P))return Nt(V[1],this,P)}})}function Cp(l){return tl(Ot(l,g))}function Bl(l){return function(){return l}}function Ip(l,p){return l==null||l!==l?p:l}var Pp=hh(),Dp=hh(!0);function Zt(l){return l}function Ul(l){return R(typeof l=="function"?l:Ot(l,g))}function Rp(l){return Oe(Ot(l,g))}function Lp(l,p){return We(l,Ot(p,g))}var xp=Ge(function(l,p){return function(_){return Hr(_,l,p)}}),Mp=Ge(function(l,p){return function(_){return Hr(l,_,p)}});function Vl(l,p,_){var P=Mt(p),M=Ds(p,P);_==null&&!(Et(p)&&(M.length||!P.length))&&(_=p,p=l,l=this,M=Ds(p,Mt(p)));var V=!(Et(_)&&"chain"in _)||!!_.chain,W=Qi(l);return jt(M,function(j){var J=p[j];l[j]=J,W&&(l.prototype[j]=function(){var fe=this.__chain__;if(V||fe){var de=l(this.__wrapped__),ge=de.__actions__=zt(this.__actions__);return ge.push({func:J,args:arguments,thisArg:l}),de.__chain__=fe,de}return J.apply(l,Li([this.value()],arguments))})}),l}function wp(){return It._===this&&(It._=Io),this}function $l(){}function kp(l){return l=Ue(l),Ge(function(p){return bi(p,l)})}var Op=vl(ct),Fp=vl(On),Np=vl(as);function ou(l){return Cl(l)?Rr(Bi(l)):uu(l)}function Bp(l){return function(p){return l==null?i:zi(l,p)}}var Up=ch(),Vp=ch(!0);function Gl(){return[]}function Hl(){return!1}function $p(){return{}}function Gp(){return""}function Hp(){return!0}function Yp(l,p){if(l=Ue(l),l<1||l>z)return[];var _=he,P=Rt(l,he);p=xe(p),l-=he;for(var M=Qs(P,p);++_<l;)p(_);return M}function Wp(l){return Ne(l)?ct(l,Bi):ii(l)?[l]:zt(Ph(ot(l)))}function Kp(l){var p=++bo;return ot(l)+p}var jp=ma(function(l,p){return l+p},0),zp=El("ceil"),qp=ma(function(l,p){return l/p},1),Xp=El("floor");function Zp(l){return l&&l.length?Ps(l,Zt,un):i}function Qp(l,p){return l&&l.length?Ps(l,xe(p,2),un):i}function Jp(l){return Nn(l,Zt)}function em(l,p){return Nn(l,xe(p,2))}function tm(l){return l&&l.length?Ps(l,Zt,oe):i}function im(l,p){return l&&l.length?Ps(l,xe(p,2),oe):i}var rm=ma(function(l,p){return l*p},1),sm=El("round"),am=ma(function(l,p){return l-p},0);function om(l){return l&&l.length?Zs(l,Zt):0}function lm(l,p){return l&&l.length?Zs(l,xe(p,2)):0}return B.after=Pf,B.ary=Bh,B.assign=pd,B.assignIn=Qh,B.assignInWith=Da,B.assignWith=md,B.at=gd,B.before=Uh,B.bind=xl,B.bindAll=Ap,B.bindKey=Vh,B.castArray=Uf,B.chain=Oh,B.chunk=ju,B.compact=zu,B.concat=qu,B.cond=bp,B.conforms=Cp,B.constant=Bl,B.countBy=sf,B.create=yd,B.curry=$h,B.curryRight=Gh,B.debounce=Hh,B.defaults=vd,B.defaultsDeep=Ed,B.defer=Df,B.delay=Rf,B.difference=Xu,B.differenceBy=Zu,B.differenceWith=Qu,B.drop=Ju,B.dropRight=ec,B.dropRightWhile=tc,B.dropWhile=ic,B.fill=rc,B.filter=af,B.flatMap=hf,B.flatMapDeep=uf,B.flatMapDepth=cf,B.flatten=xh,B.flattenDeep=sc,B.flattenDepth=nc,B.flip=Lf,B.flow=Pp,B.flowRight=Dp,B.fromPairs=ac,B.functions=Id,B.functionsIn=Pd,B.groupBy=ff,B.initial=lc,B.intersection=hc,B.intersectionBy=uc,B.intersectionWith=cc,B.invert=Rd,B.invertBy=Ld,B.invokeMap=pf,B.iteratee=Ul,B.keyBy=mf,B.keys=Mt,B.keysIn=Xt,B.map=_a,B.mapKeys=Md,B.mapValues=wd,B.matches=Rp,B.matchesProperty=Lp,B.memoize=ba,B.merge=kd,B.mergeWith=Jh,B.method=xp,B.methodOf=Mp,B.mixin=Vl,B.negate=Ca,B.nthArg=kp,B.omit=Od,B.omitBy=Fd,B.once=xf,B.orderBy=gf,B.over=Op,B.overArgs=Mf,B.overEvery=Fp,B.overSome=Np,B.partial=Ml,B.partialRight=Yh,B.partition=yf,B.pick=Nd,B.pickBy=eu,B.property=ou,B.propertyOf=Bp,B.pull=mc,B.pullAll=wh,B.pullAllBy=gc,B.pullAllWith=yc,B.pullAt=vc,B.range=Up,B.rangeRight=Vp,B.rearg=wf,B.reject=Sf,B.remove=Ec,B.rest=kf,B.reverse=Rl,B.sampleSize=_f,B.set=Ud,B.setWith=Vd,B.shuffle=Af,B.slice=Sc,B.sortBy=If,B.sortedUniq=Pc,B.sortedUniqBy=Dc,B.split=cp,B.spread=Of,B.tail=Rc,B.take=Lc,B.takeRight=xc,B.takeRightWhile=Mc,B.takeWhile=wc,B.tap=zc,B.throttle=Ff,B.thru=Ta,B.toArray=qh,B.toPairs=tu,B.toPairsIn=iu,B.toPath=Wp,B.toPlainObject=Zh,B.transform=$d,B.unary=Nf,B.union=kc,B.unionBy=Oc,B.unionWith=Fc,B.uniq=Nc,B.uniqBy=Bc,B.uniqWith=Uc,B.unset=Gd,B.unzip=Ll,B.unzipWith=kh,B.update=Hd,B.updateWith=Yd,B.values=ws,B.valuesIn=Wd,B.without=Vc,B.words=nu,B.wrap=Bf,B.xor=$c,B.xorBy=Gc,B.xorWith=Hc,B.zip=Yc,B.zipObject=Wc,B.zipObjectDeep=Kc,B.zipWith=jc,B.entries=tu,B.entriesIn=iu,B.extend=Qh,B.extendWith=Da,Vl(B,B),B.add=jp,B.attempt=au,B.camelCase=qd,B.capitalize=ru,B.ceil=zp,B.clamp=Kd,B.clone=Vf,B.cloneDeep=Gf,B.cloneDeepWith=Hf,B.cloneWith=$f,B.conformsTo=Yf,B.deburr=su,B.defaultTo=Ip,B.divide=qp,B.endsWith=Xd,B.eq=Ci,B.escape=Zd,B.escapeRegExp=Qd,B.every=nf,B.find=of,B.findIndex=Rh,B.findKey=Sd,B.findLast=lf,B.findLastIndex=Lh,B.findLastKey=Td,B.floor=Xp,B.forEach=Fh,B.forEachRight=Nh,B.forIn=_d,B.forInRight=Ad,B.forOwn=bd,B.forOwnRight=Cd,B.get=Ol,B.gt=Wf,B.gte=Kf,B.has=Dd,B.hasIn=Fl,B.head=Mh,B.identity=Zt,B.includes=df,B.indexOf=oc,B.inRange=jd,B.invoke=xd,B.isArguments=jr,B.isArray=Ne,B.isArrayBuffer=jf,B.isArrayLike=qt,B.isArrayLikeObject=bt,B.isBoolean=zf,B.isBuffer=Sr,B.isDate=qf,B.isElement=Xf,B.isEmpty=Zf,B.isEqual=Qf,B.isEqualWith=Jf,B.isError=wl,B.isFinite=ed,B.isFunction=Qi,B.isInteger=Wh,B.isLength=Ia,B.isMap=Kh,B.isMatch=td,B.isMatchWith=id,B.isNaN=rd,B.isNative=sd,B.isNil=ad,B.isNull=nd,B.isNumber=jh,B.isObject=Et,B.isObjectLike=Tt,B.isPlainObject=gn,B.isRegExp=kl,B.isSafeInteger=od,B.isSet=zh,B.isString=Pa,B.isSymbol=ii,B.isTypedArray=Ms,B.isUndefined=ld,B.isWeakMap=hd,B.isWeakSet=ud,B.join=fc,B.kebabCase=Jd,B.last=pi,B.lastIndexOf=dc,B.lowerCase=ep,B.lowerFirst=tp,B.lt=cd,B.lte=fd,B.max=Zp,B.maxBy=Qp,B.mean=Jp,B.meanBy=em,B.min=tm,B.minBy=im,B.stubArray=Gl,B.stubFalse=Hl,B.stubObject=$p,B.stubString=Gp,B.stubTrue=Hp,B.multiply=rm,B.nth=pc,B.noConflict=wp,B.noop=$l,B.now=Aa,B.pad=rp,B.padEnd=sp,B.padStart=np,B.parseInt=ap,B.random=zd,B.reduce=vf,B.reduceRight=Ef,B.repeat=lp,B.replace=hp,B.result=Bd,B.round=sm,B.runInContext=Z,B.sample=Tf,B.size=bf,B.snakeCase=up,B.some=Cf,B.sortedIndex=Tc,B.sortedIndexBy=_c,B.sortedIndexOf=Ac,B.sortedLastIndex=bc,B.sortedLastIndexBy=Cc,B.sortedLastIndexOf=Ic,B.startCase=fp,B.startsWith=dp,B.subtract=am,B.sum=om,B.sumBy=lm,B.template=pp,B.times=Yp,B.toFinite=Ji,B.toInteger=Ue,B.toLength=Xh,B.toLower=mp,B.toNumber=mi,B.toSafeInteger=dd,B.toString=ot,B.toUpper=gp,B.trim=yp,B.trimEnd=vp,B.trimStart=Ep,B.truncate=Sp,B.unescape=Tp,B.uniqueId=Kp,B.upperCase=_p,B.upperFirst=Nl,B.each=Fh,B.eachRight=Nh,B.first=Mh,Vl(B,(function(){var l={};return fi(B,function(p,_){at.call(B.prototype,_)||(l[_]=p)}),l})(),{chain:!1}),B.VERSION=s,jt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(l){B[l].placeholder=B}),jt(["drop","take"],function(l,p){Ye.prototype[l]=function(_){_=_===i?1:mt(Ue(_),0);var P=this.__filtered__&&!p?new Ye(this):this.clone();return P.__filtered__?P.__takeCount__=Rt(_,P.__takeCount__):P.__views__.push({size:Rt(_,he),type:l+(P.__dir__<0?"Right":"")}),P},Ye.prototype[l+"Right"]=function(_){return this.reverse()[l](_).reverse()}}),jt(["filter","map","takeWhile"],function(l,p){var _=p+1,P=_==te||_==me;Ye.prototype[l]=function(M){var V=this.clone();return V.__iteratees__.push({iteratee:xe(M,3),type:_}),V.__filtered__=V.__filtered__||P,V}}),jt(["head","last"],function(l,p){var _="take"+(p?"Right":"");Ye.prototype[l]=function(){return this[_](1).value()[0]}}),jt(["initial","tail"],function(l,p){var _="drop"+(p?"":"Right");Ye.prototype[l]=function(){return this.__filtered__?new Ye(this):this[_](1)}}),Ye.prototype.compact=function(){return this.filter(Zt)},Ye.prototype.find=function(l){return this.filter(l).head()},Ye.prototype.findLast=function(l){return this.reverse().find(l)},Ye.prototype.invokeMap=Ge(function(l,p){return typeof l=="function"?new Ye(this):this.map(function(_){return Hr(_,l,p)})}),Ye.prototype.reject=function(l){return this.filter(Ca(xe(l)))},Ye.prototype.slice=function(l,p){l=Ue(l);var _=this;return _.__filtered__&&(l>0||p<0)?new Ye(_):(l<0?_=_.takeRight(-l):l&&(_=_.drop(l)),p!==i&&(p=Ue(p),_=p<0?_.dropRight(-p):_.take(p-l)),_)},Ye.prototype.takeRightWhile=function(l){return this.reverse().takeWhile(l).reverse()},Ye.prototype.toArray=function(){return this.take(he)},fi(Ye.prototype,function(l,p){var _=/^(?:filter|find|map|reject)|While$/.test(p),P=/^(?:head|last)$/.test(p),M=B[P?"take"+(p=="last"?"Right":""):p],V=P||/^find/.test(p);M&&(B.prototype[p]=function(){var W=this.__wrapped__,j=P?[1]:arguments,J=W instanceof Ye,fe=j[0],de=J||Ne(W),ge=function(je){var Ze=M.apply(B,Li([je],j));return P&&Te?Ze[0]:Ze};de&&_&&typeof fe=="function"&&fe.length!=1&&(J=de=!1);var Te=this.__chain__,De=!!this.__actions__.length,we=V&&!Te,$e=J&&!De;if(!V&&de){W=$e?W:new Ye(this);var ke=l.apply(W,j);return ke.__actions__.push({func:Ta,args:[ge],thisArg:i}),new kt(ke,Te)}return we&&$e?l.apply(this,j):(ke=this.thru(ge),we?P?ke.value()[0]:ke.value():ke)})}),jt(["pop","push","shift","sort","splice","unshift"],function(l){var p=Mr[l],_=/^(?:push|sort|unshift)$/.test(l)?"tap":"thru",P=/^(?:pop|shift)$/.test(l);B.prototype[l]=function(){var M=arguments;if(P&&!this.__chain__){var V=this.value();return p.apply(Ne(V)?V:[],M)}return this[_](function(W){return p.apply(Ne(W)?W:[],M)})}}),fi(Ye.prototype,function(l,p){var _=B[p];if(_){var P=_.name+"";at.call(cr,P)||(cr[P]=[]),cr[P].push({name:p,func:_})}}),cr[pa(i,C).name]=[{name:"wrapper",func:i}],Ye.prototype.clone=Bo,Ye.prototype.reverse=Uo,Ye.prototype.value=sn,B.prototype.at=qc,B.prototype.chain=Xc,B.prototype.commit=Zc,B.prototype.next=Qc,B.prototype.plant=ef,B.prototype.reverse=tf,B.prototype.toJSON=B.prototype.valueOf=B.prototype.value=rf,B.prototype.first=B.prototype.head,Or&&(B.prototype[Or]=Jc),B}),Mi=To();typeof t=="function"&&typeof t.amd=="object"&&t.amd?(It._=Mi,t(function(){return Mi})):rt?((rt.exports=Mi)._=Mi,rs._=Mi):It._=Mi}).call(lodash)})(lodash$1,lodash$1.exports)),lodash$1.exports}var lodashExports=requireLodash();function updateColor(r,e){const t=i=>{i&&typeof i=="object"&&(i.c&&Array.isArray(i.c.k)&&(i.c.k=hexToRgbArray(e)),Object.values(i).forEach(t))};return t(r),r}function hexToRgbArray(r){const e=parseInt(r.replace("#",""),16);return[(e>>16)/255,(e>>8&255)/255,(e&255)/255]}function Loading({classNames:r,color:e="#ffffff"}){const t=updateColor(lodashExports.cloneDeep(animationData),e);return jsxRuntime.jsx(Player,{className:r,autoplay:!0,loop:!0,src:t})}function MaximizeSvg({width:r=24}){return jsxRuntime.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 9.75C1.59 9.75 1.25 9.41 1.25 9V6.5C1.25 3.61 3.61 1.25 6.5 1.25H9C9.41 1.25 9.75 1.59 9.75 2C9.75 2.41 9.41 2.75 9 2.75H6.5C4.43 2.75 2.75 4.43 2.75 6.5V9C2.75 9.41 2.41 9.75 2 9.75Z",fill:"#fff"}),jsxRuntime.jsx("path",{d:"M22 9.75C21.59 9.75 21.25 9.41 21.25 9V6.5C21.25 4.43 19.57 2.75 17.5 2.75H15C14.59 2.75 14.25 2.41 14.25 2C14.25 1.59 14.59 1.25 15 1.25H17.5C20.39 1.25 22.75 3.61 22.75 6.5V9C22.75 9.41 22.41 9.75 22 9.75Z",fill:"#fff"}),jsxRuntime.jsx("path",{d:"M17.5 22.75H16C15.59 22.75 15.25 22.41 15.25 22C15.25 21.59 15.59 21.25 16 21.25H17.5C19.57 21.25 21.25 19.57 21.25 17.5V16C21.25 15.59 21.59 15.25 22 15.25C22.41 15.25 22.75 15.59 22.75 16V17.5C22.75 20.39 20.39 22.75 17.5 22.75Z",fill:"#fff"}),jsxRuntime.jsx("path",{d:"M9 22.75H6.5C3.61 22.75 1.25 20.39 1.25 17.5V15C1.25 14.59 1.59 14.25 2 14.25C2.41 14.25 2.75 14.59 2.75 15V17.5C2.75 19.57 4.43 21.25 6.5 21.25H9C9.41 21.25 9.75 21.59 9.75 22C9.75 22.41 9.41 22.75 9 22.75Z",fill:"#fff"})]})}function BackwardSvg({width:r=24}){return jsxRuntime.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M14.43 16.92H12.14C11.73 16.92 11.39 16.58 11.39 16.17C11.39 15.76 11.73 15.42 12.14 15.42H14.43C14.86 15.42 15.21 15.07 15.21 14.64C15.21 14.21 14.86 13.86 14.43 13.86H12.14C11.9 13.86 11.67 13.74 11.53 13.55C11.39 13.36 11.35 13.1 11.43 12.87L12.19 10.58C12.29 10.27 12.58 10.07 12.9 10.07H15.96C16.37 10.07 16.71 10.41 16.71 10.82C16.71 11.23 16.37 11.57 15.96 11.57H13.44L13.18 12.36H14.43C15.69 12.36 16.71 13.38 16.71 14.64C16.71 15.9 15.68 16.92 14.43 16.92Z",fill:"#fff"}),jsxRuntime.jsx("path",{d:"M9.53998 16.92C9.12998 16.92 8.78998 16.58 8.78998 16.17V12.78L8.59998 13C8.31998 13.31 7.84998 13.33 7.53998 13.06C7.23998 12.78 7.20998 12.31 7.48998 12L8.98998 10.33C9.19998 10.1 9.52998 10.02 9.81998 10.13C10.11 10.24 10.3 10.52 10.3 10.83V16.18C10.29 16.59 9.95998 16.92 9.53998 16.92Z",fill:"#fff"}),jsxRuntime.jsx("path",{d:"M12 3.48006C11.92 3.48006 11.84 3.49006 11.76 3.49006L12.58 2.47006C12.84 2.15006 12.79 1.67006 12.46 1.42006C12.13 1.17006 11.67 1.21006 11.41 1.54006L9.44001 4.00006C9.43001 4.01006 9.43001 4.02006 9.42001 4.04006C9.39001 4.08006 9.37001 4.13006 9.35001 4.17006C9.33001 4.22006 9.31001 4.26006 9.30001 4.30006C9.29001 4.35006 9.29001 4.39006 9.29001 4.44006C9.29001 4.49006 9.29001 4.54006 9.29001 4.59006C9.29001 4.61006 9.29001 4.62006 9.29001 4.64006C9.30001 4.67006 9.32001 4.69006 9.33001 4.72006C9.35001 4.77006 9.37001 4.81006 9.39001 4.86006C9.42001 4.90006 9.45001 4.94006 9.49001 4.97006C9.51001 5.00006 9.52001 5.03006 9.55001 5.05006C9.57001 5.06006 9.58001 5.07006 9.60001 5.08006C9.62001 5.10006 9.65001 5.11006 9.68001 5.12006C9.73001 5.15006 9.79001 5.17006 9.84001 5.18006C9.88001 5.20006 9.91001 5.20006 9.94001 5.20006C9.97001 5.20006 9.99001 5.21006 10.02 5.21006C10.05 5.21006 10.07 5.20006 10.09 5.19006C10.12 5.19006 10.15 5.20006 10.18 5.19006C10.82 5.04006 11.42 4.97006 11.99 4.97006C16.48 4.97006 20.13 8.62006 20.13 13.1101C20.13 17.6001 16.48 21.2501 11.99 21.2501C7.50001 21.2501 3.85001 17.6001 3.85001 13.1101C3.85001 11.3701 4.42001 9.69006 5.50001 8.25006C5.75001 7.92006 5.68001 7.45006 5.35001 7.20006C5.02001 6.95006 4.55001 7.02006 4.30001 7.35006C3.02001 9.05006 2.35001 11.0401 2.35001 13.1101C2.35001 18.4201 6.67001 22.7501 11.99 22.7501C17.31 22.7501 21.63 18.4301 21.63 13.1101C21.63 7.79006 17.31 3.48006 12 3.48006Z",fill:"#fff"})]})}function ForwardSvg({width:r=24}){return jsxRuntime.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M14.43 16.92H12.14C11.73 16.92 11.39 16.58 11.39 16.17C11.39 15.76 11.73 15.42 12.14 15.42H14.43C14.86 15.42 15.21 15.07 15.21 14.64C15.21 14.21 14.86 13.86 14.43 13.86H12.14C11.9 13.86 11.67 13.74 11.53 13.55C11.39 13.36 11.35 13.1 11.43 12.87L12.19 10.58C12.29 10.27 12.58 10.07 12.9 10.07H15.96C16.37 10.07 16.71 10.41 16.71 10.82C16.71 11.23 16.37 11.57 15.96 11.57H13.44L13.18 12.36H14.43C15.69 12.36 16.71 13.38 16.71 14.64C16.71 15.9 15.68 16.92 14.43 16.92Z",fill:"#fff"}),jsxRuntime.jsx("path",{d:"M9.53998 16.92C9.12998 16.92 8.78998 16.58 8.78998 16.17V12.78L8.59998 13C8.31998 13.31 7.84998 13.33 7.53998 13.06C7.23998 12.78 7.20998 12.31 7.48998 12L8.98998 10.33C9.19998 10.1 9.52998 10.02 9.81998 10.13C10.11 10.24 10.3 10.52 10.3 10.83V16.18C10.29 16.59 9.95998 16.92 9.53998 16.92Z",fill:"#fff"}),jsxRuntime.jsx("path",{d:"M19.69 7.35002C19.44 7.02002 18.97 6.95002 18.64 7.20002C18.31 7.45002 18.24 7.92002 18.49 8.25002C19.57 9.69002 20.14 11.37 20.14 13.11C20.14 17.6 16.49 21.25 12 21.25C7.51001 21.25 3.86001 17.6 3.86001 13.11C3.86001 8.62002 7.51001 4.98002 12 4.98002C12.58 4.98002 13.17 5.05002 13.81 5.20002C13.84 5.21002 13.87 5.20002 13.9 5.20002C13.93 5.20002 13.95 5.22002 13.97 5.22002C14 5.22002 14.02 5.21002 14.05 5.21002C14.08 5.21002 14.11 5.20002 14.15 5.19002C14.21 5.18002 14.26 5.15002 14.31 5.13002C14.34 5.11002 14.37 5.10002 14.4 5.08002C14.41 5.07002 14.43 5.07002 14.44 5.06002C14.47 5.04002 14.48 5.01002 14.5 4.99002C14.54 4.95002 14.57 4.92002 14.6 4.87002C14.63 4.83002 14.64 4.78002 14.66 4.73002C14.67 4.70002 14.69 4.67002 14.7 4.64002C14.7 4.62002 14.7 4.61002 14.7 4.59002C14.71 4.54002 14.71 4.49002 14.7 4.44002C14.7 4.39002 14.7 4.35002 14.69 4.30002C14.68 4.26002 14.66 4.22002 14.64 4.17002C14.62 4.12002 14.6 4.07002 14.57 4.03002C14.57 4.02002 14.57 4.01002 14.56 4.00002L12.58 1.53002C12.32 1.21002 11.85 1.15002 11.53 1.41002C11.21 1.67002 11.16 2.14002 11.41 2.46002L12.23 3.48002C12.15 3.48002 12.07 3.47002 11.99 3.47002C6.68001 3.47002 2.35001 7.79002 2.35001 13.11C2.35001 18.43 6.67001 22.75 11.99 22.75C17.31 22.75 21.63 18.43 21.63 13.11C21.64 11.04 20.96 9.05002 19.69 7.35002Z",fill:"#fff"})]})}function VolumeUnMuteSvg({width:r}){return jsxRuntime.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M18 16.75C17.84 16.75 17.69 16.7 17.55 16.6C17.22 16.35 17.15 15.88 17.4 15.55C18.97 13.46 18.97 10.54 17.4 8.45003C17.15 8.12003 17.22 7.65003 17.55 7.40003C17.88 7.15003 18.35 7.22003 18.6 7.55003C20.56 10.17 20.56 13.83 18.6 16.45C18.45 16.65 18.23 16.75 18 16.75Z",fill:"#fff"}),jsxRuntime.jsx("path",{d:"M19.83 19.25C19.67 19.25 19.52 19.2 19.38 19.1C19.05 18.85 18.98 18.38 19.23 18.05C21.9 14.49 21.9 9.51003 19.23 5.95003C18.98 5.62003 19.05 5.15003 19.38 4.90003C19.71 4.65003 20.18 4.72003 20.43 5.05003C23.5 9.14003 23.5 14.86 20.43 18.95C20.29 19.15 20.06 19.25 19.83 19.25Z",fill:"#fff"}),jsxRuntime.jsx("path",{d:"M14.02 3.78003C12.9 3.16003 11.47 3.32003 10.01 4.23003L7.09 6.06003C6.89 6.18003 6.66 6.25003 6.43 6.25003H5.5H5C2.58 6.25003 1.25 7.58003 1.25 10V14C1.25 16.42 2.58 17.75 5 17.75H5.5H6.43C6.66 17.75 6.89 17.82 7.09 17.94L10.01 19.77C10.89 20.32 11.75 20.59 12.55 20.59C13.07 20.59 13.57 20.47 14.02 20.22C15.13 19.6 15.75 18.31 15.75 16.59V7.41003C15.75 5.69003 15.13 4.40003 14.02 3.78003Z",fill:"#fff"})]})}function VolumeMuteSvg({width:r=24}){return jsxRuntime.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M7 17.75H5C2.58 17.75 1.25 16.42 1.25 14V9.99999C1.25 7.57999 2.58 6.24999 5 6.24999H6.43C6.66 6.24999 6.89 6.17999 7.09 6.05999L10.01 4.22999C11.47 3.31999 12.89 3.14999 14.01 3.76999C15.13 4.38999 15.74 5.67999 15.74 7.40999V8.36999C15.74 8.77999 15.4 9.11999 14.99 9.11999C14.58 9.11999 14.24 8.77999 14.24 8.36999V7.40999C14.24 6.26999 13.89 5.41999 13.28 5.08999C12.67 4.74999 11.77 4.89999 10.8 5.50999L7.88 7.32999C7.45 7.60999 6.94 7.74999 6.43 7.74999H5C3.42 7.74999 2.75 8.41999 2.75 9.99999V14C2.75 15.58 3.42 16.25 5 16.25H7C7.41 16.25 7.75 16.59 7.75 17C7.75 17.41 7.41 17.75 7 17.75Z",fill:"#fff"}),jsxRuntime.jsx("path",{d:"M12.55 20.59C11.76 20.59 10.89 20.31 10.02 19.76C9.67003 19.54 9.56003 19.08 9.78003 18.73C10 18.38 10.46 18.27 10.81 18.49C11.78 19.09 12.68 19.25 13.29 18.91C13.9 18.57 14.25 17.72 14.25 16.59V12.95C14.25 12.54 14.59 12.2 15 12.2C15.41 12.2 15.75 12.54 15.75 12.95V16.59C15.75 18.31 15.13 19.61 14.02 20.23C13.57 20.47 13.07 20.59 12.55 20.59Z",fill:"#fff"}),jsxRuntime.jsx("path",{d:"M18 16.75C17.84 16.75 17.69 16.7 17.55 16.6C17.22 16.35 17.15 15.88 17.4 15.55C18.66 13.87 18.93 11.64 18.12 9.71001C17.96 9.33001 18.14 8.89001 18.52 8.73001C18.9 8.57001 19.34 8.75001 19.5 9.13001C20.52 11.55 20.17 14.36 18.6 16.46C18.45 16.65 18.23 16.75 18 16.75Z",fill:"#fff"}),jsxRuntime.jsx("path",{d:"M19.83 19.25C19.67 19.25 19.52 19.2 19.38 19.1C19.05 18.85 18.98 18.38 19.23 18.05C21.37 15.2 21.84 11.38 20.46 8.09002C20.3 7.71002 20.48 7.27002 20.86 7.11002C21.25 6.95002 21.68 7.13002 21.84 7.51002C23.43 11.29 22.89 15.67 20.43 18.95C20.29 19.15 20.06 19.25 19.83 19.25Z",fill:"#fff"}),jsxRuntime.jsx("path",{d:"M2 22.75C1.81 22.75 1.62 22.68 1.47 22.53C1.18 22.24 1.18 21.76 1.47 21.47L21.47 1.47C21.76 1.18 22.24 1.18 22.53 1.47C22.82 1.76 22.82 2.24 22.53 2.53L2.53 22.53C2.38 22.68 2.19 22.75 2 22.75Z",fill:"#fff"})]})}function PauseSvg({width:r=24}){return jsxRuntime.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.97 2C6.45 2 1.97 6.48 1.97 12C1.97 17.52 6.45 22 11.97 22C17.49 22 21.97 17.52 21.97 12C21.97 6.48 17.5 2 11.97 2ZM10.72 15.03C10.72 15.51 10.52 15.7 10.01 15.7H8.71C8.2 15.7 8 15.51 8 15.03V8.97C8 8.49 8.2 8.3 8.71 8.3H10C10.51 8.3 10.71 8.49 10.71 8.97V15.03H10.72ZM16 15.03C16 15.51 15.8 15.7 15.29 15.7H14C13.49 15.7 13.29 15.51 13.29 15.03V8.97C13.29 8.49 13.49 8.3 14 8.3H15.29C15.8 8.3 16 8.49 16 8.97V15.03Z",fill:"#fff"})})}function commonjsRequire(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var moment$2={exports:{}},moment$1=moment$2.exports,hasRequiredMoment;function requireMoment(){return hasRequiredMoment||(hasRequiredMoment=1,(function(r,e){(function(t,i){r.exports=i()})(moment$1,(function(){var t;function i(){return t.apply(null,arguments)}function s(y){t=y}function n(y){return y instanceof Array||Object.prototype.toString.call(y)==="[object Array]"}function a(y){return y!=null&&Object.prototype.toString.call(y)==="[object Object]"}function o(y,A){return Object.prototype.hasOwnProperty.call(y,A)}function c(y){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(y).length===0;var A;for(A in y)if(o(y,A))return!1;return!0}function u(y){return y===void 0}function f(y){return typeof y=="number"||Object.prototype.toString.call(y)==="[object Number]"}function d(y){return y instanceof Date||Object.prototype.toString.call(y)==="[object Date]"}function g(y,A){var D=[],R,N=y.length;for(R=0;R<N;++R)D.push(A(y[R],R));return D}function E(y,A){for(var D in A)o(A,D)&&(y[D]=A[D]);return o(A,"toString")&&(y.toString=A.toString),o(A,"valueOf")&&(y.valueOf=A.valueOf),y}function m(y,A,D,R){return hs(y,A,D,R,!0).utc()}function T(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function S(y){return y._pf==null&&(y._pf=T()),y._pf}var b;Array.prototype.some?b=Array.prototype.some:b=function(y){var A=Object(this),D=A.length>>>0,R;for(R=0;R<D;R++)if(R in A&&y.call(this,A[R],R,A))return!0;return!1};function C(y){var A=null,D=!1,R=y._d&&!isNaN(y._d.getTime());if(R&&(A=S(y),D=b.call(A.parsedDateParts,function(N){return N!=null}),R=A.overflow<0&&!A.empty&&!A.invalidEra&&!A.invalidMonth&&!A.invalidWeekday&&!A.weekdayMismatch&&!A.nullInput&&!A.invalidFormat&&!A.userInvalidated&&(!A.meridiem||A.meridiem&&D),y._strict&&(R=R&&A.charsLeftOver===0&&A.unusedTokens.length===0&&A.bigHour===void 0)),Object.isFrozen==null||!Object.isFrozen(y))y._isValid=R;else return R;return y._isValid}function I(y){var A=m(NaN);return y!=null?E(S(A),y):S(A).userInvalidated=!0,A}var L=i.momentProperties=[],k=!1;function U(y,A){var D,R,N,K=L.length;if(u(A._isAMomentObject)||(y._isAMomentObject=A._isAMomentObject),u(A._i)||(y._i=A._i),u(A._f)||(y._f=A._f),u(A._l)||(y._l=A._l),u(A._strict)||(y._strict=A._strict),u(A._tzm)||(y._tzm=A._tzm),u(A._isUTC)||(y._isUTC=A._isUTC),u(A._offset)||(y._offset=A._offset),u(A._pf)||(y._pf=S(A)),u(A._locale)||(y._locale=A._locale),K>0)for(D=0;D<K;D++)R=L[D],N=A[R],u(N)||(y[R]=N);return y}function O(y){U(this,y),this._d=new Date(y._d!=null?y._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),k===!1&&(k=!0,i.updateOffset(this),k=!1)}function F(y){return y instanceof O||y!=null&&y._isAMomentObject!=null}function G(y){i.suppressDeprecationWarnings===!1&&typeof console<"u"&&console.warn&&console.warn("Deprecation warning: "+y)}function x(y,A){var D=!0;return E(function(){if(i.deprecationHandler!=null&&i.deprecationHandler(null,y),D){var R=[],N,K,oe,_e=arguments.length;for(K=0;K<_e;K++){if(N="",typeof arguments[K]=="object"){N+=`
|
|
276
|
-
[`+K+"] ";for(oe in arguments[0])o(arguments[0],oe)&&(N+=oe+": "+arguments[0][oe]+", ");N=N.slice(0,-2)}else N=arguments[K];R.push(N)}G(y+`
|
|
277
|
-
Arguments: `+Array.prototype.slice.call(R).join("")+`
|
|
278
|
-
`+new Error().stack),D=!1}return A.apply(this,arguments)},A)}var $={};function X(y,A){i.deprecationHandler!=null&&i.deprecationHandler(y,A),$[y]||(G(A),$[y]=!0)}i.suppressDeprecationWarnings=!1,i.deprecationHandler=null;function Q(y){return typeof Function<"u"&&y instanceof Function||Object.prototype.toString.call(y)==="[object Function]"}function ee(y){var A,D;for(D in y)o(y,D)&&(A=y[D],Q(A)?this[D]=A:this["_"+D]=A);this._config=y,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function te(y,A){var D=E({},y),R;for(R in A)o(A,R)&&(a(y[R])&&a(A[R])?(D[R]={},E(D[R],y[R]),E(D[R],A[R])):A[R]!=null?D[R]=A[R]:delete D[R]);for(R in y)o(y,R)&&!o(A,R)&&a(y[R])&&(D[R]=E({},D[R]));return D}function re(y){y!=null&&this.set(y)}var me;Object.keys?me=Object.keys:me=function(y){var A,D=[];for(A in y)o(y,A)&&D.push(A);return D};var H={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function z(y,A,D){var R=this._calendar[y]||this._calendar.sameElse;return Q(R)?R.call(A,D):R}function ie(y,A,D){var R=""+Math.abs(y),N=A-R.length,K=y>=0;return(K?D?"+":"":"-")+Math.pow(10,Math.max(0,N)).toString().substr(1)+R}var ne=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,he=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,pe={},Pe={};function ae(y,A,D,R){var N=R;typeof R=="string"&&(N=function(){return this[R]()}),y&&(Pe[y]=N),A&&(Pe[A[0]]=function(){return ie(N.apply(this,arguments),A[1],A[2])}),D&&(Pe[D]=function(){return this.localeData().ordinal(N.apply(this,arguments),y)})}function Ae(y){return y.match(/\[[\s\S]/)?y.replace(/^\[|\]$/g,""):y.replace(/\\/g,"")}function Re(y){var A=y.match(ne),D,R;for(D=0,R=A.length;D<R;D++)Pe[A[D]]?A[D]=Pe[A[D]]:A[D]=Ae(A[D]);return function(N){var K="",oe;for(oe=0;oe<R;oe++)K+=Q(A[oe])?A[oe].call(N,y):A[oe];return K}}function Le(y,A){return y.isValid()?(A=Y(A,y.localeData()),pe[A]=pe[A]||Re(A),pe[A](y)):y.localeData().invalidDate()}function Y(y,A){var D=5;function R(N){return A.longDateFormat(N)||N}for(he.lastIndex=0;D>=0&&he.test(y);)y=y.replace(he,R),he.lastIndex=0,D-=1;return y}var q={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function le(y){var A=this._longDateFormat[y],D=this._longDateFormat[y.toUpperCase()];return A||!D?A:(this._longDateFormat[y]=D.match(ne).map(function(R){return R==="MMMM"||R==="MM"||R==="DD"||R==="dddd"?R.slice(1):R}).join(""),this._longDateFormat[y])}var ce="Invalid date";function Ee(){return this._invalidDate}var ve="%d",Be=/\d{1,2}/;function Ie(y){return this._ordinal.replace("%d",y)}var Me={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function Ve(y,A,D,R){var N=this._relativeTime[D];return Q(N)?N(y,A,D,R):N.replace(/%d/i,y)}function dt(y,A){var D=this._relativeTime[y>0?"future":"past"];return Q(D)?D(A):D.replace(/%s/i,A)}var Qe={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function ze(y){return typeof y=="string"?Qe[y]||Qe[y.toLowerCase()]:void 0}function Je(y){var A={},D,R;for(R in y)o(y,R)&&(D=ze(R),D&&(A[D]=y[R]));return A}var gt={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function yt(y){var A=[],D;for(D in y)o(y,D)&&A.push({unit:D,priority:gt[D]});return A.sort(function(R,N){return R.priority-N.priority}),A}var _t=/\d/,qe=/\d\d/,Yt=/\d{3}/,Dt=/\d{4}/,St=/[+-]?\d{6}/,Se=/\d\d?/,lt=/\d\d\d\d?/,ht=/\d\d\d\d\d\d?/,pt=/\d{1,3}/,Ui=/\d{1,4}/,Pi=/[+-]?\d{1,6}/,Di=/\d+/,tr=/[+-]?\d+/,ks=/Z|[+-]\d\d:?\d\d/gi,zr=/Z|[+-]\d\d(?::?\d\d)?/gi,Ra=/[+-]?\d+(\.\d{1,3})?/,Tr=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,Vi=/^[1-9]\d?/,qr=/^([1-9]\d|\d)/,Xr;Xr={};function Ce(y,A,D){Xr[y]=Q(A)?A:function(R,N){return R&&D?D:A}}function La(y,A){return o(Xr,y)?Xr[y](A._strict,A._locale):new RegExp(xa(y))}function xa(y){return ni(y.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(A,D,R,N,K){return D||R||N||K}))}function ni(y){return y.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Wt(y){return y<0?Math.ceil(y)||0:Math.floor(y)}function He(y){var A=+y,D=0;return A!==0&&isFinite(A)&&(D=Wt(A)),D}var Os={};function it(y,A){var D,R=A,N;for(typeof y=="string"&&(y=[y]),f(A)&&(R=function(K,oe){oe[A]=He(K)}),N=y.length,D=0;D<N;D++)Os[y[D]]=R}function _r(y,A){it(y,function(D,R,N,K){N._w=N._w||{},A(D,N._w,N,K)})}function Fs(y,A,D){A!=null&&o(Os,y)&&Os[y](A,D._a,D,y)}function Zr(y){return y%4===0&&y%100!==0||y%400===0}var xt=0,gi=1,ai=2,At=3,Qt=4,yi=5,$i=6,yn=7,Ma=8;ae("Y",0,0,function(){var y=this.year();return y<=9999?ie(y,4):"+"+y}),ae(0,["YY",2],0,function(){return this.year()%100}),ae(0,["YYYY",4],0,"year"),ae(0,["YYYYY",5],0,"year"),ae(0,["YYYYYY",6,!0],0,"year"),Ce("Y",tr),Ce("YY",Se,qe),Ce("YYYY",Ui,Dt),Ce("YYYYY",Pi,St),Ce("YYYYYY",Pi,St),it(["YYYYY","YYYYYY"],xt),it("YYYY",function(y,A){A[xt]=y.length===2?i.parseTwoDigitYear(y):He(y)}),it("YY",function(y,A){A[xt]=i.parseTwoDigitYear(y)}),it("Y",function(y,A){A[xt]=parseInt(y,10)});function Ar(y){return Zr(y)?366:365}i.parseTwoDigitYear=function(y){return He(y)+(He(y)>68?1900:2e3)};var vn=ir("FullYear",!0);function wa(){return Zr(this.year())}function ir(y,A){return function(D){return D!=null?(Cr(this,y,D),i.updateOffset(this,A),this):br(this,y)}}function br(y,A){if(!y.isValid())return NaN;var D=y._d,R=y._isUTC;switch(A){case"Milliseconds":return R?D.getUTCMilliseconds():D.getMilliseconds();case"Seconds":return R?D.getUTCSeconds():D.getSeconds();case"Minutes":return R?D.getUTCMinutes():D.getMinutes();case"Hours":return R?D.getUTCHours():D.getHours();case"Date":return R?D.getUTCDate():D.getDate();case"Day":return R?D.getUTCDay():D.getDay();case"Month":return R?D.getUTCMonth():D.getMonth();case"FullYear":return R?D.getUTCFullYear():D.getFullYear();default:return NaN}}function Cr(y,A,D){var R,N,K,oe,_e;if(!(!y.isValid()||isNaN(D))){switch(R=y._d,N=y._isUTC,A){case"Milliseconds":return void(N?R.setUTCMilliseconds(D):R.setMilliseconds(D));case"Seconds":return void(N?R.setUTCSeconds(D):R.setSeconds(D));case"Minutes":return void(N?R.setUTCMinutes(D):R.setMinutes(D));case"Hours":return void(N?R.setUTCHours(D):R.setHours(D));case"Date":return void(N?R.setUTCDate(D):R.setDate(D));case"FullYear":break;default:return}K=D,oe=y.month(),_e=y.date(),_e=_e===29&&oe===1&&!Zr(K)?28:_e,N?R.setUTCFullYear(K,oe,_e):R.setFullYear(K,oe,_e)}}function ka(y){return y=ze(y),Q(this[y])?this[y]():this}function Qr(y,A){if(typeof y=="object"){y=Je(y);var D=yt(y),R,N=D.length;for(R=0;R<N;R++)this[D[R].unit](y[D[R].unit])}else if(y=ze(y),Q(this[y]))return this[y](A);return this}function Oa(y,A){return(y%A+A)%A}var vt;Array.prototype.indexOf?vt=Array.prototype.indexOf:vt=function(y){var A;for(A=0;A<this.length;++A)if(this[A]===y)return A;return-1};function Ns(y,A){if(isNaN(y)||isNaN(A))return NaN;var D=Oa(A,12);return y+=(A-D)/12,D===1?Zr(y)?29:28:31-D%7%2}ae("M",["MM",2],"Mo",function(){return this.month()+1}),ae("MMM",0,0,function(y){return this.localeData().monthsShort(this,y)}),ae("MMMM",0,0,function(y){return this.localeData().months(this,y)}),Ce("M",Se,Vi),Ce("MM",Se,qe),Ce("MMM",function(y,A){return A.monthsShortRegex(y)}),Ce("MMMM",function(y,A){return A.monthsRegex(y)}),it(["M","MM"],function(y,A){A[gi]=He(y)-1}),it(["MMM","MMMM"],function(y,A,D,R){var N=D._locale.monthsParse(y,R,D._strict);N!=null?A[gi]=N:S(D).invalidMonth=y});var En="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Bs="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Us=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Fa=Tr,Na=Tr;function Ba(y,A){return y?n(this._months)?this._months[y.month()]:this._months[(this._months.isFormat||Us).test(A)?"format":"standalone"][y.month()]:n(this._months)?this._months:this._months.standalone}function Ua(y,A){return y?n(this._monthsShort)?this._monthsShort[y.month()]:this._monthsShort[Us.test(A)?"format":"standalone"][y.month()]:n(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function Sn(y,A,D){var R,N,K,oe=y.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],R=0;R<12;++R)K=m([2e3,R]),this._shortMonthsParse[R]=this.monthsShort(K,"").toLocaleLowerCase(),this._longMonthsParse[R]=this.months(K,"").toLocaleLowerCase();return D?A==="MMM"?(N=vt.call(this._shortMonthsParse,oe),N!==-1?N:null):(N=vt.call(this._longMonthsParse,oe),N!==-1?N:null):A==="MMM"?(N=vt.call(this._shortMonthsParse,oe),N!==-1?N:(N=vt.call(this._longMonthsParse,oe),N!==-1?N:null)):(N=vt.call(this._longMonthsParse,oe),N!==-1?N:(N=vt.call(this._shortMonthsParse,oe),N!==-1?N:null))}function Tn(y,A,D){var R,N,K;if(this._monthsParseExact)return Sn.call(this,y,A,D);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),R=0;R<12;R++){if(N=m([2e3,R]),D&&!this._longMonthsParse[R]&&(this._longMonthsParse[R]=new RegExp("^"+this.months(N,"").replace(".","")+"$","i"),this._shortMonthsParse[R]=new RegExp("^"+this.monthsShort(N,"").replace(".","")+"$","i")),!D&&!this._monthsParse[R]&&(K="^"+this.months(N,"")+"|^"+this.monthsShort(N,""),this._monthsParse[R]=new RegExp(K.replace(".",""),"i")),D&&A==="MMMM"&&this._longMonthsParse[R].test(y))return R;if(D&&A==="MMM"&&this._shortMonthsParse[R].test(y))return R;if(!D&&this._monthsParse[R].test(y))return R}}function Vs(y,A){if(!y.isValid())return y;if(typeof A=="string"){if(/^\d+$/.test(A))A=He(A);else if(A=y.localeData().monthsParse(A),!f(A))return y}var D=A,R=y.date();return R=R<29?R:Math.min(R,Ns(y.year(),D)),y._isUTC?y._d.setUTCMonth(D,R):y._d.setMonth(D,R),y}function Jr(y){return y!=null?(Vs(this,y),i.updateOffset(this,!0),this):br(this,"Month")}function Va(){return Ns(this.year(),this.month())}function _n(y){return this._monthsParseExact?(o(this,"_monthsRegex")||$s.call(this),y?this._monthsShortStrictRegex:this._monthsShortRegex):(o(this,"_monthsShortRegex")||(this._monthsShortRegex=Fa),this._monthsShortStrictRegex&&y?this._monthsShortStrictRegex:this._monthsShortRegex)}function es(y){return this._monthsParseExact?(o(this,"_monthsRegex")||$s.call(this),y?this._monthsStrictRegex:this._monthsRegex):(o(this,"_monthsRegex")||(this._monthsRegex=Na),this._monthsStrictRegex&&y?this._monthsStrictRegex:this._monthsRegex)}function $s(){function y(Oe,We){return We.length-Oe.length}var A=[],D=[],R=[],N,K,oe,_e;for(N=0;N<12;N++)K=m([2e3,N]),oe=ni(this.monthsShort(K,"")),_e=ni(this.months(K,"")),A.push(oe),D.push(_e),R.push(_e),R.push(oe);A.sort(y),D.sort(y),R.sort(y),this._monthsRegex=new RegExp("^("+R.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+D.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+A.join("|")+")","i")}function $a(y,A,D,R,N,K,oe){var _e;return y<100&&y>=0?(_e=new Date(y+400,A,D,R,N,K,oe),isFinite(_e.getFullYear())&&_e.setFullYear(y)):_e=new Date(y,A,D,R,N,K,oe),_e}function rr(y){var A,D;return y<100&&y>=0?(D=Array.prototype.slice.call(arguments),D[0]=y+400,A=new Date(Date.UTC.apply(null,D)),isFinite(A.getUTCFullYear())&&A.setUTCFullYear(y)):A=new Date(Date.UTC.apply(null,arguments)),A}function Ir(y,A,D){var R=7+A-D,N=(7+rr(y,0,R).getUTCDay()-A)%7;return-N+R-1}function ts(y,A,D,R,N){var K=(7+D-R)%7,oe=Ir(y,R,N),_e=1+7*(A-1)+K+oe,Oe,We;return _e<=0?(Oe=y-1,We=Ar(Oe)+_e):_e>Ar(y)?(Oe=y+1,We=_e-Ar(y)):(Oe=y,We=_e),{year:Oe,dayOfYear:We}}function Pr(y,A,D){var R=Ir(y.year(),A,D),N=Math.floor((y.dayOfYear()-R-1)/7)+1,K,oe;return N<1?(oe=y.year()-1,K=N+oi(oe,A,D)):N>oi(y.year(),A,D)?(K=N-oi(y.year(),A,D),oe=y.year()+1):(oe=y.year(),K=N),{week:K,year:oe}}function oi(y,A,D){var R=Ir(y,A,D),N=Ir(y+1,A,D);return(Ar(y)-R+N)/7}ae("w",["ww",2],"wo","week"),ae("W",["WW",2],"Wo","isoWeek"),Ce("w",Se,Vi),Ce("ww",Se,qe),Ce("W",Se,Vi),Ce("WW",Se,qe),_r(["w","ww","W","WW"],function(y,A,D,R){A[R.substr(0,1)]=He(y)});function Gs(y){return Pr(y,this._week.dow,this._week.doy).week}var Hs={dow:0,doy:6};function sr(){return this._week.dow}function An(){return this._week.doy}function bn(y){var A=this.localeData().week(this);return y==null?A:this.add((y-A)*7,"d")}function Ga(y){var A=Pr(this,1,4).week;return y==null?A:this.add((y-A)*7,"d")}ae("d",0,"do","day"),ae("dd",0,0,function(y){return this.localeData().weekdaysMin(this,y)}),ae("ddd",0,0,function(y){return this.localeData().weekdaysShort(this,y)}),ae("dddd",0,0,function(y){return this.localeData().weekdays(this,y)}),ae("e",0,0,"weekday"),ae("E",0,0,"isoWeekday"),Ce("d",Se),Ce("e",Se),Ce("E",Se),Ce("dd",function(y,A){return A.weekdaysMinRegex(y)}),Ce("ddd",function(y,A){return A.weekdaysShortRegex(y)}),Ce("dddd",function(y,A){return A.weekdaysRegex(y)}),_r(["dd","ddd","dddd"],function(y,A,D,R){var N=D._locale.weekdaysParse(y,R,D._strict);N!=null?A.d=N:S(D).invalidWeekday=y}),_r(["d","e","E"],function(y,A,D,R){A[R]=He(y)});function Cn(y,A){return typeof y!="string"?y:isNaN(y)?(y=A.weekdaysParse(y),typeof y=="number"?y:null):parseInt(y,10)}function In(y,A){return typeof y=="string"?A.weekdaysParse(y)%7||7:isNaN(y)?null:y}function is(y,A){return y.slice(A,7).concat(y.slice(0,A))}var Pn="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Dn="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Ha="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Ya=Tr,Rn=Tr,Wa=Tr;function Ka(y,A){var D=n(this._weekdays)?this._weekdays:this._weekdays[y&&y!==!0&&this._weekdays.isFormat.test(A)?"format":"standalone"];return y===!0?is(D,this._week.dow):y?D[y.day()]:D}function ja(y){return y===!0?is(this._weekdaysShort,this._week.dow):y?this._weekdaysShort[y.day()]:this._weekdaysShort}function za(y){return y===!0?is(this._weekdaysMin,this._week.dow):y?this._weekdaysMin[y.day()]:this._weekdaysMin}function Ys(y,A,D){var R,N,K,oe=y.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],R=0;R<7;++R)K=m([2e3,1]).day(R),this._minWeekdaysParse[R]=this.weekdaysMin(K,"").toLocaleLowerCase(),this._shortWeekdaysParse[R]=this.weekdaysShort(K,"").toLocaleLowerCase(),this._weekdaysParse[R]=this.weekdays(K,"").toLocaleLowerCase();return D?A==="dddd"?(N=vt.call(this._weekdaysParse,oe),N!==-1?N:null):A==="ddd"?(N=vt.call(this._shortWeekdaysParse,oe),N!==-1?N:null):(N=vt.call(this._minWeekdaysParse,oe),N!==-1?N:null):A==="dddd"?(N=vt.call(this._weekdaysParse,oe),N!==-1||(N=vt.call(this._shortWeekdaysParse,oe),N!==-1)?N:(N=vt.call(this._minWeekdaysParse,oe),N!==-1?N:null)):A==="ddd"?(N=vt.call(this._shortWeekdaysParse,oe),N!==-1||(N=vt.call(this._weekdaysParse,oe),N!==-1)?N:(N=vt.call(this._minWeekdaysParse,oe),N!==-1?N:null)):(N=vt.call(this._minWeekdaysParse,oe),N!==-1||(N=vt.call(this._weekdaysParse,oe),N!==-1)?N:(N=vt.call(this._shortWeekdaysParse,oe),N!==-1?N:null))}function qa(y,A,D){var R,N,K;if(this._weekdaysParseExact)return Ys.call(this,y,A,D);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),R=0;R<7;R++){if(N=m([2e3,1]).day(R),D&&!this._fullWeekdaysParse[R]&&(this._fullWeekdaysParse[R]=new RegExp("^"+this.weekdays(N,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[R]=new RegExp("^"+this.weekdaysShort(N,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[R]=new RegExp("^"+this.weekdaysMin(N,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[R]||(K="^"+this.weekdays(N,"")+"|^"+this.weekdaysShort(N,"")+"|^"+this.weekdaysMin(N,""),this._weekdaysParse[R]=new RegExp(K.replace(".",""),"i")),D&&A==="dddd"&&this._fullWeekdaysParse[R].test(y))return R;if(D&&A==="ddd"&&this._shortWeekdaysParse[R].test(y))return R;if(D&&A==="dd"&&this._minWeekdaysParse[R].test(y))return R;if(!D&&this._weekdaysParse[R].test(y))return R}}function Xa(y){if(!this.isValid())return y!=null?this:NaN;var A=br(this,"Day");return y!=null?(y=Cn(y,this.localeData()),this.add(y-A,"d")):A}function Za(y){if(!this.isValid())return y!=null?this:NaN;var A=(this.day()+7-this.localeData()._week.dow)%7;return y==null?A:this.add(y-A,"d")}function Qa(y){if(!this.isValid())return y!=null?this:NaN;if(y!=null){var A=In(y,this.localeData());return this.day(this.day()%7?A:A-7)}else return this.day()||7}function Ja(y){return this._weekdaysParseExact?(o(this,"_weekdaysRegex")||Ws.call(this),y?this._weekdaysStrictRegex:this._weekdaysRegex):(o(this,"_weekdaysRegex")||(this._weekdaysRegex=Ya),this._weekdaysStrictRegex&&y?this._weekdaysStrictRegex:this._weekdaysRegex)}function ft(y){return this._weekdaysParseExact?(o(this,"_weekdaysRegex")||Ws.call(this),y?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(o(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Rn),this._weekdaysShortStrictRegex&&y?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function ut(y){return this._weekdaysParseExact?(o(this,"_weekdaysRegex")||Ws.call(this),y?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(o(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Wa),this._weekdaysMinStrictRegex&&y?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Ws(){function y(Pt,Ai){return Ai.length-Pt.length}var A=[],D=[],R=[],N=[],K,oe,_e,Oe,We;for(K=0;K<7;K++)oe=m([2e3,1]).day(K),_e=ni(this.weekdaysMin(oe,"")),Oe=ni(this.weekdaysShort(oe,"")),We=ni(this.weekdays(oe,"")),A.push(_e),D.push(Oe),R.push(We),N.push(_e),N.push(Oe),N.push(We);A.sort(y),D.sort(y),R.sort(y),N.sort(y),this._weekdaysRegex=new RegExp("^("+N.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+R.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+D.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+A.join("|")+")","i")}function Ks(){return this.hours()%12||12}function eo(){return this.hours()||24}ae("H",["HH",2],0,"hour"),ae("h",["hh",2],0,Ks),ae("k",["kk",2],0,eo),ae("hmm",0,0,function(){return""+Ks.apply(this)+ie(this.minutes(),2)}),ae("hmmss",0,0,function(){return""+Ks.apply(this)+ie(this.minutes(),2)+ie(this.seconds(),2)}),ae("Hmm",0,0,function(){return""+this.hours()+ie(this.minutes(),2)}),ae("Hmmss",0,0,function(){return""+this.hours()+ie(this.minutes(),2)+ie(this.seconds(),2)});function Ln(y,A){ae(y,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),A)})}Ln("a",!0),Ln("A",!1);function xn(y,A){return A._meridiemParse}Ce("a",xn),Ce("A",xn),Ce("H",Se,qr),Ce("h",Se,Vi),Ce("k",Se,Vi),Ce("HH",Se,qe),Ce("hh",Se,qe),Ce("kk",Se,qe),Ce("hmm",lt),Ce("hmmss",ht),Ce("Hmm",lt),Ce("Hmmss",ht),it(["H","HH"],At),it(["k","kk"],function(y,A,D){var R=He(y);A[At]=R===24?0:R}),it(["a","A"],function(y,A,D){D._isPm=D._locale.isPM(y),D._meridiem=y}),it(["h","hh"],function(y,A,D){A[At]=He(y),S(D).bigHour=!0}),it("hmm",function(y,A,D){var R=y.length-2;A[At]=He(y.substr(0,R)),A[Qt]=He(y.substr(R)),S(D).bigHour=!0}),it("hmmss",function(y,A,D){var R=y.length-4,N=y.length-2;A[At]=He(y.substr(0,R)),A[Qt]=He(y.substr(R,2)),A[yi]=He(y.substr(N)),S(D).bigHour=!0}),it("Hmm",function(y,A,D){var R=y.length-2;A[At]=He(y.substr(0,R)),A[Qt]=He(y.substr(R))}),it("Hmmss",function(y,A,D){var R=y.length-4,N=y.length-2;A[At]=He(y.substr(0,R)),A[Qt]=He(y.substr(R,2)),A[yi]=He(y.substr(N))});function to(y){return(y+"").toLowerCase().charAt(0)==="p"}var Mn=/[ap]\.?m?\.?/i,io=ir("Hours",!0);function It(y,A,D){return y>11?D?"pm":"PM":D?"am":"AM"}var rs={calendar:H,longDateFormat:q,invalidDate:ce,ordinal:ve,dayOfMonthOrdinalParse:Be,relativeTime:Me,months:En,monthsShort:Bs,week:Hs,weekdays:Pn,weekdaysMin:Ha,weekdaysShort:Dn,meridiemParse:Mn},rt={},nr={},Gi;function Kt(y,A){var D,R=Math.min(y.length,A.length);for(D=0;D<R;D+=1)if(y[D]!==A[D])return D;return R}function js(y){return y&&y.toLowerCase().replace("_","-")}function wn(y){for(var A=0,D,R,N,K;A<y.length;){for(K=js(y[A]).split("-"),D=K.length,R=js(y[A+1]),R=R?R.split("-"):null;D>0;){if(N=Dr(K.slice(0,D).join("-")),N)return N;if(R&&R.length>=D&&Kt(K,R)>=D-1)break;D--}A++}return Gi}function kn(y){return!!(y&&y.match("^[^/\\\\]*$"))}function Dr(y){var A=null,D;if(rt[y]===void 0&&r&&r.exports&&kn(y))try{A=Gi._abbr,D=commonjsRequire,D("./locale/"+y),vi(A)}catch{rt[y]=null}return rt[y]}function vi(y,A){var D;return y&&(u(A)?D=Ei(y):D=ss(y,A),D?Gi=D:typeof console<"u"&&console.warn&&console.warn("Locale "+y+" not found. Did you forget to load it?")),Gi._abbr}function ss(y,A){if(A!==null){var D,R=rs;if(A.abbr=y,rt[y]!=null)X("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),R=rt[y]._config;else if(A.parentLocale!=null)if(rt[A.parentLocale]!=null)R=rt[A.parentLocale]._config;else if(D=Dr(A.parentLocale),D!=null)R=D._config;else return nr[A.parentLocale]||(nr[A.parentLocale]=[]),nr[A.parentLocale].push({name:y,config:A}),null;return rt[y]=new re(te(R,A)),nr[y]&&nr[y].forEach(function(N){ss(N.name,N.config)}),vi(y),rt[y]}else return delete rt[y],null}function Nt(y,A){if(A!=null){var D,R,N=rs;rt[y]!=null&&rt[y].parentLocale!=null?rt[y].set(te(rt[y]._config,A)):(R=Dr(y),R!=null&&(N=R._config),A=te(N,A),R==null&&(A.abbr=y),D=new re(A),D.parentLocale=rt[y],rt[y]=D),vi(y)}else rt[y]!=null&&(rt[y].parentLocale!=null?(rt[y]=rt[y].parentLocale,y===vi()&&vi(y)):rt[y]!=null&&delete rt[y]);return rt[y]}function Ei(y){var A;if(y&&y._locale&&y._locale._abbr&&(y=y._locale._abbr),!y)return Gi;if(!n(y)){if(A=Dr(y),A)return A;y=[y]}return wn(y)}function jt(){return me(rt)}function zs(y){var A,D=y._a;return D&&S(y).overflow===-2&&(A=D[gi]<0||D[gi]>11?gi:D[ai]<1||D[ai]>Ns(D[xt],D[gi])?ai:D[At]<0||D[At]>24||D[At]===24&&(D[Qt]!==0||D[yi]!==0||D[$i]!==0)?At:D[Qt]<0||D[Qt]>59?Qt:D[yi]<0||D[yi]>59?yi:D[$i]<0||D[$i]>999?$i:-1,S(y)._overflowDayOfYear&&(A<xt||A>ai)&&(A=ai),S(y)._overflowWeeks&&A===-1&&(A=yn),S(y)._overflowWeekday&&A===-1&&(A=Ma),S(y).overflow=A),y}var On=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Ri=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,ns=/Z|[+-]\d\d(?::?\d\d)?/,ar=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],ct=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Li=/^\/?Date\((-?\d+)/i,qs=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,ro={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function as(y){var A,D,R=y._i,N=On.exec(R)||Ri.exec(R),K,oe,_e,Oe,We=ar.length,Pt=ct.length;if(N){for(S(y).iso=!0,A=0,D=We;A<D;A++)if(ar[A][1].exec(N[1])){oe=ar[A][0],K=ar[A][2]!==!1;break}if(oe==null){y._isValid=!1;return}if(N[3]){for(A=0,D=Pt;A<D;A++)if(ct[A][1].exec(N[3])){_e=(N[2]||" ")+ct[A][0];break}if(_e==null){y._isValid=!1;return}}if(!K&&_e!=null){y._isValid=!1;return}if(N[4])if(ns.exec(N[4]))Oe="Z";else{y._isValid=!1;return}y._f=oe+(_e||"")+(Oe||""),ls(y)}else y._isValid=!1}function so(y,A,D,R,N,K){var oe=[no(y),Bs.indexOf(A),parseInt(D,10),parseInt(R,10),parseInt(N,10)];return K&&oe.push(parseInt(K,10)),oe}function no(y){var A=parseInt(y,10);return A<=49?2e3+A:A<=999?1900+A:A}function ao(y){return y.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function Fn(y,A,D){if(y){var R=Dn.indexOf(y),N=new Date(A[0],A[1],A[2]).getDay();if(R!==N)return S(D).weekdayMismatch=!0,D._isValid=!1,!1}return!0}function os(y,A,D){if(y)return ro[y];if(A)return 0;var R=parseInt(D,10),N=R%100,K=(R-N)/100;return K*60+N}function Hi(y){var A=qs.exec(ao(y._i)),D;if(A){if(D=so(A[4],A[3],A[2],A[5],A[6],A[7]),!Fn(A[1],D,y))return;y._a=D,y._tzm=os(A[8],A[9],A[10]),y._d=rr.apply(null,y._a),y._d.setUTCMinutes(y._d.getUTCMinutes()-y._tzm),S(y).rfc2822=!0}else y._isValid=!1}function oo(y){var A=Li.exec(y._i);if(A!==null){y._d=new Date(+A[1]);return}if(as(y),y._isValid===!1)delete y._isValid;else return;if(Hi(y),y._isValid===!1)delete y._isValid;else return;y._strict?y._isValid=!1:i.createFromInputFallback(y)}i.createFromInputFallback=x("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(y){y._d=new Date(y._i+(y._useUTC?" UTC":""))});function Yi(y,A,D){return y??A??D}function Nn(y){var A=new Date(i.now());return y._useUTC?[A.getUTCFullYear(),A.getUTCMonth(),A.getUTCDate()]:[A.getFullYear(),A.getMonth(),A.getDate()]}function Rr(y){var A,D,R=[],N,K,oe;if(!y._d){for(N=Nn(y),y._w&&y._a[ai]==null&&y._a[gi]==null&&Xs(y),y._dayOfYear!=null&&(oe=Yi(y._a[xt],N[xt]),(y._dayOfYear>Ar(oe)||y._dayOfYear===0)&&(S(y)._overflowDayOfYear=!0),D=rr(oe,0,y._dayOfYear),y._a[gi]=D.getUTCMonth(),y._a[ai]=D.getUTCDate()),A=0;A<3&&y._a[A]==null;++A)y._a[A]=R[A]=N[A];for(;A<7;A++)y._a[A]=R[A]=y._a[A]==null?A===2?1:0:y._a[A];y._a[At]===24&&y._a[Qt]===0&&y._a[yi]===0&&y._a[$i]===0&&(y._nextDay=!0,y._a[At]=0),y._d=(y._useUTC?rr:$a).apply(null,R),K=y._useUTC?y._d.getUTCDay():y._d.getDay(),y._tzm!=null&&y._d.setUTCMinutes(y._d.getUTCMinutes()-y._tzm),y._nextDay&&(y._a[At]=24),y._w&&typeof y._w.d<"u"&&y._w.d!==K&&(S(y).weekdayMismatch=!0)}}function Xs(y){var A,D,R,N,K,oe,_e,Oe,We;A=y._w,A.GG!=null||A.W!=null||A.E!=null?(K=1,oe=4,D=Yi(A.GG,y._a[xt],Pr(st(),1,4).year),R=Yi(A.W,1),N=Yi(A.E,1),(N<1||N>7)&&(Oe=!0)):(K=y._locale._week.dow,oe=y._locale._week.doy,We=Pr(st(),K,oe),D=Yi(A.gg,y._a[xt],We.year),R=Yi(A.w,We.week),A.d!=null?(N=A.d,(N<0||N>6)&&(Oe=!0)):A.e!=null?(N=A.e+K,(A.e<0||A.e>6)&&(Oe=!0)):N=K),R<1||R>oi(D,K,oe)?S(y)._overflowWeeks=!0:Oe!=null?S(y)._overflowWeekday=!0:(_e=ts(D,R,N,K,oe),y._a[xt]=_e.year,y._dayOfYear=_e.dayOfYear)}i.ISO_8601=function(){},i.RFC_2822=function(){};function ls(y){if(y._f===i.ISO_8601){as(y);return}if(y._f===i.RFC_2822){Hi(y);return}y._a=[],S(y).empty=!0;var A=""+y._i,D,R,N,K,oe,_e=A.length,Oe=0,We,Pt;for(N=Y(y._f,y._locale).match(ne)||[],Pt=N.length,D=0;D<Pt;D++)K=N[D],R=(A.match(La(K,y))||[])[0],R&&(oe=A.substr(0,A.indexOf(R)),oe.length>0&&S(y).unusedInput.push(oe),A=A.slice(A.indexOf(R)+R.length),Oe+=R.length),Pe[K]?(R?S(y).empty=!1:S(y).unusedTokens.push(K),Fs(K,R,y)):y._strict&&!R&&S(y).unusedTokens.push(K);S(y).charsLeftOver=_e-Oe,A.length>0&&S(y).unusedInput.push(A),y._a[At]<=12&&S(y).bigHour===!0&&y._a[At]>0&&(S(y).bigHour=void 0),S(y).parsedDateParts=y._a.slice(0),S(y).meridiem=y._meridiem,y._a[At]=lo(y._locale,y._a[At],y._meridiem),We=S(y).era,We!==null&&(y._a[xt]=y._locale.erasConvertYear(We,y._a[xt])),Rr(y),zs(y)}function lo(y,A,D){var R;return D==null?A:y.meridiemHour!=null?y.meridiemHour(A,D):(y.isPM!=null&&(R=y.isPM(D),R&&A<12&&(A+=12),!R&&A===12&&(A=0)),A)}function Zs(y){var A,D,R,N,K,oe,_e=!1,Oe=y._f.length;if(Oe===0){S(y).invalidFormat=!0,y._d=new Date(NaN);return}for(N=0;N<Oe;N++)K=0,oe=!1,A=U({},y),y._useUTC!=null&&(A._useUTC=y._useUTC),A._f=y._f[N],ls(A),C(A)&&(oe=!0),K+=S(A).charsLeftOver,K+=S(A).unusedTokens.length*10,S(A).score=K,_e?K<R&&(R=K,D=A):(R==null||K<R||oe)&&(R=K,D=A,oe&&(_e=!0));E(y,D||A)}function Qs(y){if(!y._d){var A=Je(y._i),D=A.day===void 0?A.date:A.day;y._a=g([A.year,A.month,D,A.hour,A.minute,A.second,A.millisecond],function(R){return R&&parseInt(R,10)}),Rr(y)}}function ho(y){var A=new O(zs(Js(y)));return A._nextDay&&(A.add(1,"d"),A._nextDay=void 0),A}function Js(y){var A=y._i,D=y._f;return y._locale=y._locale||Ei(y._l),A===null||D===void 0&&A===""?I({nullInput:!0}):(typeof A=="string"&&(y._i=A=y._locale.preparse(A)),F(A)?new O(zs(A)):(d(A)?y._d=A:n(D)?Zs(y):D?ls(y):Bt(y),C(y)||(y._d=null),y))}function Bt(y){var A=y._i;u(A)?y._d=new Date(i.now()):d(A)?y._d=new Date(A.valueOf()):typeof A=="string"?oo(y):n(A)?(y._a=g(A.slice(0),function(D){return parseInt(D,10)}),Rr(y)):a(A)?Qs(y):f(A)?y._d=new Date(A):i.createFromInputFallback(y)}function hs(y,A,D,R,N){var K={};return(A===!0||A===!1)&&(R=A,A=void 0),(D===!0||D===!1)&&(R=D,D=void 0),(a(y)&&c(y)||n(y)&&y.length===0)&&(y=void 0),K._isAMomentObject=!0,K._useUTC=K._isUTC=N,K._l=D,K._i=y,K._f=A,K._strict=R,ho(K)}function st(y,A,D,R){return hs(y,A,D,R,!1)}var Bn=x("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var y=st.apply(null,arguments);return this.isValid()&&y.isValid()?y<this?this:y:I()}),Un=x("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var y=st.apply(null,arguments);return this.isValid()&&y.isValid()?y>this?this:y:I()});function Vn(y,A){var D,R;if(A.length===1&&n(A[0])&&(A=A[0]),!A.length)return st();for(D=A[0],R=1;R<A.length;++R)(!A[R].isValid()||A[R][y](D))&&(D=A[R]);return D}function uo(){var y=[].slice.call(arguments,0);return Vn("isBefore",y)}function co(){var y=[].slice.call(arguments,0);return Vn("isAfter",y)}var fo=function(){return Date.now?Date.now():+new Date},Lr=["year","quarter","month","week","day","hour","minute","second","millisecond"];function or(y){var A,D=!1,R,N=Lr.length;for(A in y)if(o(y,A)&&!(vt.call(Lr,A)!==-1&&(y[A]==null||!isNaN(y[A]))))return!1;for(R=0;R<N;++R)if(y[Lr[R]]){if(D)return!1;parseFloat(y[Lr[R]])!==He(y[Lr[R]])&&(D=!0)}return!0}function po(){return this._isValid}function mo(){return nt(NaN)}function lr(y){var A=Je(y),D=A.year||0,R=A.quarter||0,N=A.month||0,K=A.week||A.isoWeek||0,oe=A.day||0,_e=A.hour||0,Oe=A.minute||0,We=A.second||0,Pt=A.millisecond||0;this._isValid=or(A),this._milliseconds=+Pt+We*1e3+Oe*6e4+_e*1e3*60*60,this._days=+oe+K*7,this._months=+N+R*3+D*12,this._data={},this._locale=Ei(),this._bubble()}function xr(y){return y instanceof lr}function li(y){return y<0?Math.round(-1*y)*-1:Math.round(y)}function us(y,A,D){var R=Math.min(y.length,A.length),N=Math.abs(y.length-A.length),K=0,oe;for(oe=0;oe<R;oe++)He(y[oe])!==He(A[oe])&&K++;return K+N}function $n(y,A){ae(y,0,0,function(){var D=this.utcOffset(),R="+";return D<0&&(D=-D,R="-"),R+ie(~~(D/60),2)+A+ie(~~D%60,2)})}$n("Z",":"),$n("ZZ",""),Ce("Z",zr),Ce("ZZ",zr),it(["Z","ZZ"],function(y,A,D){D._useUTC=!0,D._tzm=en(zr,y)});var go=/([\+\-]|\d\d)/gi;function en(y,A){var D=(A||"").match(y),R,N,K;return D===null?null:(R=D[D.length-1]||[],N=(R+"").match(go)||["-",0,0],K=+(N[1]*60)+He(N[2]),K===0?0:N[0]==="+"?K:-K)}function xi(y,A){var D,R;return A._isUTC?(D=A.clone(),R=(F(y)||d(y)?y.valueOf():st(y).valueOf())-D.valueOf(),D._d.setTime(D._d.valueOf()+R),i.updateOffset(D,!1),D):st(y).local()}function Ut(y){return-Math.round(y._d.getTimezoneOffset())}i.updateOffset=function(){};function Gn(y,A,D){var R=this._offset||0,N;if(!this.isValid())return y!=null?this:NaN;if(y!=null){if(typeof y=="string"){if(y=en(zr,y),y===null)return this}else Math.abs(y)<16&&!D&&(y=y*60);return!this._isUTC&&A&&(N=Ut(this)),this._offset=y,this._isUTC=!0,N!=null&&this.add(N,"m"),R!==y&&(!A||this._changeInProgress?Mr(this,nt(y-R,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,i.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?R:Ut(this)}function yo(y,A){return y!=null?(typeof y!="string"&&(y=-y),this.utcOffset(y,A),this):-this.utcOffset()}function vo(y){return this.utcOffset(0,y)}function Eo(y){return this._isUTC&&(this.utcOffset(0,y),this._isUTC=!1,y&&this.subtract(Ut(this),"m")),this}function So(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var y=en(ks,this._i);y!=null?this.utcOffset(y):this.utcOffset(0,!0)}return this}function To(y){return this.isValid()?(y=y?st(y).utcOffset():0,(this.utcOffset()-y)%60===0):!1}function Mi(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Z(){if(!u(this._isDSTShifted))return this._isDSTShifted;var y={},A;return U(y,this),y=Js(y),y._a?(A=y._isUTC?m(y._a):st(y._a),this._isDSTShifted=this.isValid()&&us(y._a,A.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function ue(){return this.isValid()?!this._isUTC:!1}function se(){return this.isValid()?this._isUTC:!1}function be(){return this.isValid()?this._isUTC&&this._offset===0:!1}var Fe=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,tt=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function nt(y,A){var D=y,R=null,N,K,oe;return xr(y)?D={ms:y._milliseconds,d:y._days,M:y._months}:f(y)||!isNaN(+y)?(D={},A?D[A]=+y:D.milliseconds=+y):(R=Fe.exec(y))?(N=R[1]==="-"?-1:1,D={y:0,d:He(R[ai])*N,h:He(R[At])*N,m:He(R[Qt])*N,s:He(R[yi])*N,ms:He(li(R[$i]*1e3))*N}):(R=tt.exec(y))?(N=R[1]==="-"?-1:1,D={y:Xe(R[2],N),M:Xe(R[3],N),w:Xe(R[4],N),d:Xe(R[5],N),h:Xe(R[6],N),m:Xe(R[7],N),s:Xe(R[8],N)}):D==null?D={}:typeof D=="object"&&("from"in D||"to"in D)&&(oe=_o(st(D.from),st(D.to)),D={},D.ms=oe.milliseconds,D.M=oe.months),K=new lr(D),xr(y)&&o(y,"_locale")&&(K._locale=y._locale),xr(y)&&o(y,"_isValid")&&(K._isValid=y._isValid),K}nt.fn=lr.prototype,nt.invalid=mo;function Xe(y,A){var D=y&&parseFloat(y.replace(",","."));return(isNaN(D)?0:D)*A}function cs(y,A){var D={};return D.months=A.month()-y.month()+(A.year()-y.year())*12,y.clone().add(D.months,"M").isAfter(A)&&--D.months,D.milliseconds=+A-+y.clone().add(D.months,"M"),D}function _o(y,A){var D;return y.isValid()&&A.isValid()?(A=xi(A,y),y.isBefore(A)?D=cs(y,A):(D=cs(A,y),D.milliseconds=-D.milliseconds,D.months=-D.months),D):{milliseconds:0,months:0}}function Vt(y,A){return function(D,R){var N,K;return R!==null&&!isNaN(+R)&&(X(A,"moment()."+A+"(period, number) is deprecated. Please use moment()."+A+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),K=D,D=R,R=K),N=nt(D,R),Mr(this,N,y),this}}function Mr(y,A,D,R){var N=A._milliseconds,K=li(A._days),oe=li(A._months);y.isValid()&&(R=R??!0,oe&&Vs(y,br(y,"Month")+oe*D),K&&Cr(y,"Date",br(y,"Date")+K*D),N&&y._d.setTime(y._d.valueOf()+N*D),R&&i.updateOffset(y,K||oe))}var Ao=Vt(1,"add"),hr=Vt(-1,"subtract");function wr(y){return typeof y=="string"||y instanceof String}function fs(y){return F(y)||d(y)||wr(y)||f(y)||bo(y)||at(y)||y===null||y===void 0}function at(y){var A=a(y)&&!c(y),D=!1,R=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],N,K,oe=R.length;for(N=0;N<oe;N+=1)K=R[N],D=D||o(y,K);return A&&D}function bo(y){var A=n(y),D=!1;return A&&(D=y.filter(function(R){return!f(R)&&wr(y)}).length===0),A&&D}function Hn(y){var A=a(y)&&!c(y),D=!1,R=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],N,K;for(N=0;N<R.length;N+=1)K=R[N],D=D||o(y,K);return A&&D}function ds(y,A){var D=y.diff(A,"days",!0);return D<-6?"sameElse":D<-1?"lastWeek":D<0?"lastDay":D<1?"sameDay":D<2?"nextDay":D<7?"nextWeek":"sameElse"}function Co(y,A){arguments.length===1&&(arguments[0]?fs(arguments[0])?(y=arguments[0],A=void 0):Hn(arguments[0])&&(A=arguments[0],y=void 0):(y=void 0,A=void 0));var D=y||st(),R=xi(D,this).startOf("day"),N=i.calendarFormat(this,R)||"sameElse",K=A&&(Q(A[N])?A[N].call(this,D):A[N]);return this.format(K||this.localeData().calendar(N,this,st(D)))}function Io(){return new O(this)}function Po(y,A){var D=F(y)?y:st(y);return this.isValid()&&D.isValid()?(A=ze(A)||"millisecond",A==="millisecond"?this.valueOf()>D.valueOf():D.valueOf()<this.clone().startOf(A).valueOf()):!1}function ps(y,A){var D=F(y)?y:st(y);return this.isValid()&&D.isValid()?(A=ze(A)||"millisecond",A==="millisecond"?this.valueOf()<D.valueOf():this.clone().endOf(A).valueOf()<D.valueOf()):!1}function wi(y,A,D,R){var N=F(y)?y:st(y),K=F(A)?A:st(A);return this.isValid()&&N.isValid()&&K.isValid()?(R=R||"()",(R[0]==="("?this.isAfter(N,D):!this.isBefore(N,D))&&(R[1]===")"?this.isBefore(K,D):!this.isAfter(K,D))):!1}function ms(y,A){var D=F(y)?y:st(y),R;return this.isValid()&&D.isValid()?(A=ze(A)||"millisecond",A==="millisecond"?this.valueOf()===D.valueOf():(R=D.valueOf(),this.clone().startOf(A).valueOf()<=R&&R<=this.clone().endOf(A).valueOf())):!1}function Yn(y,A){return this.isSame(y,A)||this.isAfter(y,A)}function gs(y,A){return this.isSame(y,A)||this.isBefore(y,A)}function Wn(y,A,D){var R,N,K;if(!this.isValid())return NaN;if(R=xi(y,this),!R.isValid())return NaN;switch(N=(R.utcOffset()-this.utcOffset())*6e4,A=ze(A),A){case"year":K=kr(this,R)/12;break;case"month":K=kr(this,R);break;case"quarter":K=kr(this,R)/3;break;case"second":K=(this-R)/1e3;break;case"minute":K=(this-R)/6e4;break;case"hour":K=(this-R)/36e5;break;case"day":K=(this-R-N)/864e5;break;case"week":K=(this-R-N)/6048e5;break;default:K=this-R}return D?K:Wt(K)}function kr(y,A){if(y.date()<A.date())return-kr(A,y);var D=(A.year()-y.year())*12+(A.month()-y.month()),R=y.clone().add(D,"months"),N,K;return A-R<0?(N=y.clone().add(D-1,"months"),K=(A-R)/(R-N)):(N=y.clone().add(D+1,"months"),K=(A-R)/(N-R)),-(D+K)||0}i.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",i.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function ys(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function Kn(y){if(!this.isValid())return null;var A=y!==!0,D=A?this.clone().utc():this;return D.year()<0||D.year()>9999?Le(D,A?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):Q(Date.prototype.toISOString)?A?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",Le(D,"Z")):Le(D,A?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function Or(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var y="moment",A="",D,R,N,K;return this.isLocal()||(y=this.utcOffset()===0?"moment.utc":"moment.parseZone",A="Z"),D="["+y+'("]',R=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",N="-MM-DD[T]HH:mm:ss.SSS",K=A+'[")]',this.format(D+R+N+K)}function Wi(y){y||(y=this.isUtc()?i.defaultFormatUtc:i.defaultFormat);var A=Le(this,y);return this.localeData().postformat(A)}function vs(y,A){return this.isValid()&&(F(y)&&y.isValid()||st(y).isValid())?nt({to:this,from:y}).locale(this.locale()).humanize(!A):this.localeData().invalidDate()}function Do(y){return this.from(st(),y)}function Ro(y,A){return this.isValid()&&(F(y)&&y.isValid()||st(y).isValid())?nt({from:this,to:y}).locale(this.locale()).humanize(!A):this.localeData().invalidDate()}function Lo(y){return this.to(st(),y)}function Fr(y){var A;return y===void 0?this._locale._abbr:(A=Ei(y),A!=null&&(this._locale=A),this)}var Nr=x("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(y){return y===void 0?this.localeData():this.locale(y)});function Es(){return this._locale}var Ss=1e3,Ki=60*Ss,Ts=60*Ki,jn=(365*400+97)*24*Ts;function mt(y,A){return(y%A+A)%A}function Rt(y,A,D){return y<100&&y>=0?new Date(y+400,A,D)-jn:new Date(y,A,D).valueOf()}function zn(y,A,D){return y<100&&y>=0?Date.UTC(y+400,A,D)-jn:Date.UTC(y,A,D)}function xo(y){var A,D;if(y=ze(y),y===void 0||y==="millisecond"||!this.isValid())return this;switch(D=this._isUTC?zn:Rt,y){case"year":A=D(this.year(),0,1);break;case"quarter":A=D(this.year(),this.month()-this.month()%3,1);break;case"month":A=D(this.year(),this.month(),1);break;case"week":A=D(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":A=D(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":A=D(this.year(),this.month(),this.date());break;case"hour":A=this._d.valueOf(),A-=mt(A+(this._isUTC?0:this.utcOffset()*Ki),Ts);break;case"minute":A=this._d.valueOf(),A-=mt(A,Ki);break;case"second":A=this._d.valueOf(),A-=mt(A,Ss);break}return this._d.setTime(A),i.updateOffset(this,!0),this}function qn(y){var A,D;if(y=ze(y),y===void 0||y==="millisecond"||!this.isValid())return this;switch(D=this._isUTC?zn:Rt,y){case"year":A=D(this.year()+1,0,1)-1;break;case"quarter":A=D(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":A=D(this.year(),this.month()+1,1)-1;break;case"week":A=D(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":A=D(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":A=D(this.year(),this.month(),this.date()+1)-1;break;case"hour":A=this._d.valueOf(),A+=Ts-mt(A+(this._isUTC?0:this.utcOffset()*Ki),Ts)-1;break;case"minute":A=this._d.valueOf(),A+=Ki-mt(A,Ki)-1;break;case"second":A=this._d.valueOf(),A+=Ss-mt(A,Ss)-1;break}return this._d.setTime(A),i.updateOffset(this,!0),this}function Mo(){return this._d.valueOf()-(this._offset||0)*6e4}function tn(){return Math.floor(this.valueOf()/1e3)}function Br(){return new Date(this.valueOf())}function rn(){var y=this;return[y.year(),y.month(),y.date(),y.hour(),y.minute(),y.second(),y.millisecond()]}function ur(){var y=this;return{years:y.year(),months:y.month(),date:y.date(),hours:y.hours(),minutes:y.minutes(),seconds:y.seconds(),milliseconds:y.milliseconds()}}function Ur(){return this.isValid()?this.toISOString():null}function Vr(){return C(this)}function _s(){return E({},S(this))}function cr(){return S(this).overflow}function wo(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}ae("N",0,0,"eraAbbr"),ae("NN",0,0,"eraAbbr"),ae("NNN",0,0,"eraAbbr"),ae("NNNN",0,0,"eraName"),ae("NNNNN",0,0,"eraNarrow"),ae("y",["y",1],"yo","eraYear"),ae("y",["yy",2],0,"eraYear"),ae("y",["yyy",3],0,"eraYear"),ae("y",["yyyy",4],0,"eraYear"),Ce("N",kt),Ce("NN",kt),Ce("NNN",kt),Ce("NNNN",Ye),Ce("NNNNN",Bo),it(["N","NN","NNN","NNNN","NNNNN"],function(y,A,D,R){var N=D._locale.erasParse(y,R,D._strict);N?S(D).era=N:S(D).invalidEra=y}),Ce("y",Di),Ce("yy",Di),Ce("yyy",Di),Ce("yyyy",Di),Ce("yo",Uo),it(["y","yy","yyy","yyyy"],xt),it(["yo"],function(y,A,D,R){var N;D._locale._eraYearOrdinalRegex&&(N=y.match(D._locale._eraYearOrdinalRegex)),D._locale.eraYearOrdinalParse?A[xt]=D._locale.eraYearOrdinalParse(y,N):A[xt]=parseInt(y,10)});function ko(y,A){var D,R,N,K=this._eras||Ei("en")._eras;for(D=0,R=K.length;D<R;++D)switch(typeof K[D].since==="string"&&(N=i(K[D].since).startOf("day"),K[D].since=N.valueOf()),typeof K[D].until){case"undefined":K[D].until=1/0;break;case"string":N=i(K[D].until).startOf("day").valueOf(),K[D].until=N.valueOf();break}return K}function Oo(y,A,D){var R,N,K=this.eras(),oe,_e,Oe;for(y=y.toUpperCase(),R=0,N=K.length;R<N;++R)if(oe=K[R].name.toUpperCase(),_e=K[R].abbr.toUpperCase(),Oe=K[R].narrow.toUpperCase(),D)switch(A){case"N":case"NN":case"NNN":if(_e===y)return K[R];break;case"NNNN":if(oe===y)return K[R];break;case"NNNNN":if(Oe===y)return K[R];break}else if([oe,_e,Oe].indexOf(y)>=0)return K[R]}function Fo(y,A){var D=y.since<=y.until?1:-1;return A===void 0?i(y.since).year():i(y.since).year()+(A-y.offset)*D}function No(){var y,A,D,R=this.localeData().eras();for(y=0,A=R.length;y<A;++y)if(D=this.clone().startOf("day").valueOf(),R[y].since<=D&&D<=R[y].until||R[y].until<=D&&D<=R[y].since)return R[y].name;return""}function As(){var y,A,D,R=this.localeData().eras();for(y=0,A=R.length;y<A;++y)if(D=this.clone().startOf("day").valueOf(),R[y].since<=D&&D<=R[y].until||R[y].until<=D&&D<=R[y].since)return R[y].narrow;return""}function $r(){var y,A,D,R=this.localeData().eras();for(y=0,A=R.length;y<A;++y)if(D=this.clone().startOf("day").valueOf(),R[y].since<=D&&D<=R[y].until||R[y].until<=D&&D<=R[y].since)return R[y].abbr;return""}function Xn(){var y,A,D,R,N=this.localeData().eras();for(y=0,A=N.length;y<A;++y)if(D=N[y].since<=N[y].until?1:-1,R=this.clone().startOf("day").valueOf(),N[y].since<=R&&R<=N[y].until||N[y].until<=R&&R<=N[y].since)return(this.year()-i(N[y].since).year())*D+N[y].offset;return this.year()}function B(y){return o(this,"_erasNameRegex")||sn.call(this),y?this._erasNameRegex:this._erasRegex}function dr(y){return o(this,"_erasAbbrRegex")||sn.call(this),y?this._erasAbbrRegex:this._erasRegex}function bs(y){return o(this,"_erasNarrowRegex")||sn.call(this),y?this._erasNarrowRegex:this._erasRegex}function kt(y,A){return A.erasAbbrRegex(y)}function Ye(y,A){return A.erasNameRegex(y)}function Bo(y,A){return A.erasNarrowRegex(y)}function Uo(y,A){return A._eraYearOrdinalRegex||Di}function sn(){var y=[],A=[],D=[],R=[],N,K,oe,_e,Oe,We=this.eras();for(N=0,K=We.length;N<K;++N)oe=ni(We[N].name),_e=ni(We[N].abbr),Oe=ni(We[N].narrow),A.push(oe),y.push(_e),D.push(Oe),R.push(oe),R.push(_e),R.push(Oe);this._erasRegex=new RegExp("^("+R.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+A.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+y.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+D.join("|")+")","i")}ae(0,["gg",2],0,function(){return this.weekYear()%100}),ae(0,["GG",2],0,function(){return this.isoWeekYear()%100});function hi(y,A){ae(0,[y,y.length],0,A)}hi("gggg","weekYear"),hi("ggggg","weekYear"),hi("GGGG","isoWeekYear"),hi("GGGGG","isoWeekYear"),Ce("G",tr),Ce("g",tr),Ce("GG",Se,qe),Ce("gg",Se,qe),Ce("GGGG",Ui,Dt),Ce("gggg",Ui,Dt),Ce("GGGGG",Pi,St),Ce("ggggg",Pi,St),_r(["gggg","ggggg","GGGG","GGGGG"],function(y,A,D,R){A[R.substr(0,2)]=He(y)}),_r(["gg","GG"],function(y,A,D,R){A[R]=i.parseTwoDigitYear(y)});function Vo(y){return Zn.call(this,y,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)}function $o(y){return Zn.call(this,y,this.isoWeek(),this.isoWeekday(),1,4)}function Go(){return oi(this.year(),1,4)}function Ho(){return oi(this.isoWeekYear(),1,4)}function Yo(){var y=this.localeData()._week;return oi(this.year(),y.dow,y.doy)}function Si(){var y=this.localeData()._week;return oi(this.weekYear(),y.dow,y.doy)}function Zn(y,A,D,R,N){var K;return y==null?Pr(this,R,N).year:(K=oi(y,R,N),A>K&&(A=K),Wo.call(this,y,A,D,R,N))}function Wo(y,A,D,R,N){var K=ts(y,A,D,R,N),oe=rr(K.year,0,K.dayOfYear);return this.year(oe.getUTCFullYear()),this.month(oe.getUTCMonth()),this.date(oe.getUTCDate()),this}ae("Q",0,"Qo","quarter"),Ce("Q",_t),it("Q",function(y,A){A[gi]=(He(y)-1)*3});function Ko(y){return y==null?Math.ceil((this.month()+1)/3):this.month((y-1)*3+this.month()%3)}ae("D",["DD",2],"Do","date"),Ce("D",Se,Vi),Ce("DD",Se,qe),Ce("Do",function(y,A){return y?A._dayOfMonthOrdinalParse||A._ordinalParse:A._dayOfMonthOrdinalParseLenient}),it(["D","DD"],ai),it("Do",function(y,A){A[ai]=He(y.match(Se)[0])});var Qn=ir("Date",!0);ae("DDD",["DDDD",3],"DDDo","dayOfYear"),Ce("DDD",pt),Ce("DDDD",Yt),it(["DDD","DDDD"],function(y,A,D){D._dayOfYear=He(y)});function jo(y){var A=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return y==null?A:this.add(y-A,"d")}ae("m",["mm",2],0,"minute"),Ce("m",Se,qr),Ce("mm",Se,qe),it(["m","mm"],Qt);var Ti=ir("Minutes",!1);ae("s",["ss",2],0,"second"),Ce("s",Se,qr),Ce("ss",Se,qe),it(["s","ss"],yi);var zo=ir("Seconds",!1);ae("S",0,0,function(){return~~(this.millisecond()/100)}),ae(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),ae(0,["SSS",3],0,"millisecond"),ae(0,["SSSS",4],0,function(){return this.millisecond()*10}),ae(0,["SSSSS",5],0,function(){return this.millisecond()*100}),ae(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),ae(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),ae(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),ae(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),Ce("S",pt,_t),Ce("SS",pt,qe),Ce("SSS",pt,Yt);var ki,Jn;for(ki="SSSS";ki.length<=9;ki+="S")Ce(ki,Di);function qo(y,A){A[$i]=He(("0."+y)*1e3)}for(ki="S";ki.length<=9;ki+="S")it(ki,qo);Jn=ir("Milliseconds",!1),ae("z",0,0,"zoneAbbr"),ae("zz",0,0,"zoneName");function Xo(){return this._isUTC?"UTC":""}function ji(){return this._isUTC?"Coordinated Universal Time":""}var ye=O.prototype;ye.add=Ao,ye.calendar=Co,ye.clone=Io,ye.diff=Wn,ye.endOf=qn,ye.format=Wi,ye.from=vs,ye.fromNow=Do,ye.to=Ro,ye.toNow=Lo,ye.get=ka,ye.invalidAt=cr,ye.isAfter=Po,ye.isBefore=ps,ye.isBetween=wi,ye.isSame=ms,ye.isSameOrAfter=Yn,ye.isSameOrBefore=gs,ye.isValid=Vr,ye.lang=Nr,ye.locale=Fr,ye.localeData=Es,ye.max=Un,ye.min=Bn,ye.parsingFlags=_s,ye.set=Qr,ye.startOf=xo,ye.subtract=hr,ye.toArray=rn,ye.toObject=ur,ye.toDate=Br,ye.toISOString=Kn,ye.inspect=Or,typeof Symbol<"u"&&Symbol.for!=null&&(ye[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),ye.toJSON=Ur,ye.toString=ys,ye.unix=tn,ye.valueOf=Mo,ye.creationData=wo,ye.eraName=No,ye.eraNarrow=As,ye.eraAbbr=$r,ye.eraYear=Xn,ye.year=vn,ye.isLeapYear=wa,ye.weekYear=Vo,ye.isoWeekYear=$o,ye.quarter=ye.quarters=Ko,ye.month=Jr,ye.daysInMonth=Va,ye.week=ye.weeks=bn,ye.isoWeek=ye.isoWeeks=Ga,ye.weeksInYear=Yo,ye.weeksInWeekYear=Si,ye.isoWeeksInYear=Go,ye.isoWeeksInISOWeekYear=Ho,ye.date=Qn,ye.day=ye.days=Xa,ye.weekday=Za,ye.isoWeekday=Qa,ye.dayOfYear=jo,ye.hour=ye.hours=io,ye.minute=ye.minutes=Ti,ye.second=ye.seconds=zo,ye.millisecond=ye.milliseconds=Jn,ye.utcOffset=Gn,ye.utc=vo,ye.local=Eo,ye.parseZone=So,ye.hasAlignedHourOffset=To,ye.isDST=Mi,ye.isLocal=ue,ye.isUtcOffset=se,ye.isUtc=be,ye.isUTC=be,ye.zoneAbbr=Xo,ye.zoneName=ji,ye.dates=x("dates accessor is deprecated. Use date instead.",Qn),ye.months=x("months accessor is deprecated. Use month instead",Jr),ye.years=x("years accessor is deprecated. Use year instead",vn),ye.zone=x("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",yo),ye.isDSTShifted=x("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Z);function Zo(y){return st(y*1e3)}function Jt(){return st.apply(null,arguments).parseZone()}function ea(y){return y}var et=re.prototype;et.calendar=z,et.longDateFormat=le,et.invalidDate=Ee,et.ordinal=Ie,et.preparse=ea,et.postformat=ea,et.relativeTime=Ve,et.pastFuture=dt,et.set=ee,et.eras=ko,et.erasParse=Oo,et.erasConvertYear=Fo,et.erasAbbrRegex=dr,et.erasNameRegex=B,et.erasNarrowRegex=bs,et.months=Ba,et.monthsShort=Ua,et.monthsParse=Tn,et.monthsRegex=es,et.monthsShortRegex=_n,et.week=Gs,et.firstDayOfYear=An,et.firstDayOfWeek=sr,et.weekdays=Ka,et.weekdaysMin=za,et.weekdaysShort=ja,et.weekdaysParse=qa,et.weekdaysRegex=Ja,et.weekdaysShortRegex=ft,et.weekdaysMinRegex=ut,et.isPM=to,et.meridiem=It;function Cs(y,A,D,R){var N=Ei(),K=m().set(R,A);return N[D](K,y)}function ta(y,A,D){if(f(y)&&(A=y,y=void 0),y=y||"",A!=null)return Cs(y,A,D,"month");var R,N=[];for(R=0;R<12;R++)N[R]=Cs(y,R,D,"month");return N}function nn(y,A,D,R){typeof y=="boolean"?(f(A)&&(D=A,A=void 0),A=A||""):(A=y,D=A,y=!1,f(A)&&(D=A,A=void 0),A=A||"");var N=Ei(),K=y?N._week.dow:0,oe,_e=[];if(D!=null)return Cs(A,(D+K)%7,R,"day");for(oe=0;oe<7;oe++)_e[oe]=Cs(A,(oe+K)%7,R,"day");return _e}function ia(y,A){return ta(y,A,"months")}function ra(y,A){return ta(y,A,"monthsShort")}function Qo(y,A,D){return nn(y,A,D,"weekdays")}function Jo(y,A,D){return nn(y,A,D,"weekdaysShort")}function an(y,A,D){return nn(y,A,D,"weekdaysMin")}vi("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(y){var A=y%10,D=He(y%100/10)===1?"th":A===1?"st":A===2?"nd":A===3?"rd":"th";return y+D}}),i.lang=x("moment.lang is deprecated. Use moment.locale instead.",vi),i.langData=x("moment.langData is deprecated. Use moment.localeData instead.",Ei);var $t=Math.abs;function Is(){var y=this._data;return this._milliseconds=$t(this._milliseconds),this._days=$t(this._days),this._months=$t(this._months),y.milliseconds=$t(y.milliseconds),y.seconds=$t(y.seconds),y.minutes=$t(y.minutes),y.hours=$t(y.hours),y.months=$t(y.months),y.years=$t(y.years),this}function sa(y,A,D,R){var N=nt(A,D);return y._milliseconds+=R*N._milliseconds,y._days+=R*N._days,y._months+=R*N._months,y._bubble()}function na(y,A){return sa(this,y,A,1)}function el(y,A){return sa(this,y,A,-1)}function ui(y){return y<0?Math.floor(y):Math.ceil(y)}function on(){var y=this._milliseconds,A=this._days,D=this._months,R=this._data,N,K,oe,_e,Oe;return y>=0&&A>=0&&D>=0||y<=0&&A<=0&&D<=0||(y+=ui(Ot(D)+A)*864e5,A=0,D=0),R.milliseconds=y%1e3,N=Wt(y/1e3),R.seconds=N%60,K=Wt(N/60),R.minutes=K%60,oe=Wt(K/60),R.hours=oe%24,A+=Wt(oe/24),Oe=Wt(Oi(A)),D+=Oe,A-=ui(Ot(Oe)),_e=Wt(D/12),D%=12,R.days=A,R.months=D,R.years=_e,this}function Oi(y){return y*4800/146097}function Ot(y){return y*146097/4800}function tl(y){if(!this.isValid())return NaN;var A,D,R=this._milliseconds;if(y=ze(y),y==="month"||y==="quarter"||y==="year")switch(A=this._days+R/864e5,D=this._months+Oi(A),y){case"month":return D;case"quarter":return D/3;case"year":return D/12}else switch(A=this._days+Math.round(Ot(this._months)),y){case"week":return A/7+R/6048e5;case"day":return A+R/864e5;case"hour":return A*24+R/36e5;case"minute":return A*1440+R/6e4;case"second":return A*86400+R/1e3;case"millisecond":return Math.floor(A*864e5)+R;default:throw new Error("Unknown unit "+y)}}function ci(y){return function(){return this.as(y)}}var ln=ci("ms"),Gr=ci("s"),Fi=ci("m"),aa=ci("h"),il=ci("d"),Ps=ci("w"),rl=ci("M"),oa=ci("Q"),Lt=ci("y"),hn=ln;function la(){return nt(this)}function fi(y){return y=ze(y),this.isValid()?this[y+"s"]():NaN}function _i(y){return function(){return this.isValid()?this._data[y]:NaN}}var Ds=_i("milliseconds"),zi=_i("seconds"),ha=_i("minutes"),wt=_i("hours"),un=_i("days"),sl=_i("months"),nl=_i("years");function al(){return Wt(this.days()/7)}var ei=Math.round,pr={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function Hr(y,A,D,R,N){return N.relativeTime(A||1,!!D,y,R)}function ua(y,A,D,R){var N=nt(y).abs(),K=ei(N.as("s")),oe=ei(N.as("m")),_e=ei(N.as("h")),Oe=ei(N.as("d")),We=ei(N.as("M")),Pt=ei(N.as("w")),Ai=ei(N.as("y")),bi=K<=D.ss&&["s",K]||K<D.s&&["ss",K]||oe<=1&&["m"]||oe<D.m&&["mm",oe]||_e<=1&&["h"]||_e<D.h&&["hh",_e]||Oe<=1&&["d"]||Oe<D.d&&["dd",Oe];return D.w!=null&&(bi=bi||Pt<=1&&["w"]||Pt<D.w&&["ww",Pt]),bi=bi||We<=1&&["M"]||We<D.M&&["MM",We]||Ai<=1&&["y"]||["yy",Ai],bi[2]=A,bi[3]=+y>0,bi[4]=R,Hr.apply(null,bi)}function ol(y){return y===void 0?ei:typeof y=="function"?(ei=y,!0):!1}function ll(y,A){return pr[y]===void 0?!1:A===void 0?pr[y]:(pr[y]=A,y==="s"&&(pr.ss=A-1),!0)}function Yr(y,A){if(!this.isValid())return this.localeData().invalidDate();var D=!1,R=pr,N,K;return typeof y=="object"&&(A=y,y=!1),typeof y=="boolean"&&(D=y),typeof A=="object"&&(R=Object.assign({},pr,A),A.s!=null&&A.ss==null&&(R.ss=A.s-1)),N=this.localeData(),K=ua(this,!D,R,N),D&&(K=N.pastFuture(+this,K)),N.postformat(K)}var cn=Math.abs;function mr(y){return(y>0)-(y<0)||+y}function gr(){if(!this.isValid())return this.localeData().invalidDate();var y=cn(this._milliseconds)/1e3,A=cn(this._days),D=cn(this._months),R,N,K,oe,_e=this.asSeconds(),Oe,We,Pt,Ai;return _e?(R=Wt(y/60),N=Wt(R/60),y%=60,R%=60,K=Wt(D/12),D%=12,oe=y?y.toFixed(3).replace(/\.?0+$/,""):"",Oe=_e<0?"-":"",We=mr(this._months)!==mr(_e)?"-":"",Pt=mr(this._days)!==mr(_e)?"-":"",Ai=mr(this._milliseconds)!==mr(_e)?"-":"",Oe+"P"+(K?We+K+"Y":"")+(D?We+D+"M":"")+(A?Pt+A+"D":"")+(N||R||y?"T":"")+(N?Ai+N+"H":"")+(R?Ai+R+"M":"")+(y?Ai+oe+"S":"")):"P0D"}var Ke=lr.prototype;Ke.isValid=po,Ke.abs=Is,Ke.add=na,Ke.subtract=el,Ke.as=tl,Ke.asMilliseconds=ln,Ke.asSeconds=Gr,Ke.asMinutes=Fi,Ke.asHours=aa,Ke.asDays=il,Ke.asWeeks=Ps,Ke.asMonths=rl,Ke.asQuarters=oa,Ke.asYears=Lt,Ke.valueOf=hn,Ke._bubble=on,Ke.clone=la,Ke.get=fi,Ke.milliseconds=Ds,Ke.seconds=zi,Ke.minutes=ha,Ke.hours=wt,Ke.days=un,Ke.weeks=al,Ke.months=sl,Ke.years=nl,Ke.humanize=Yr,Ke.toISOString=gr,Ke.toString=gr,Ke.toJSON=gr,Ke.locale=Fr,Ke.localeData=Es,Ke.toIsoString=x("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",gr),Ke.lang=Nr,ae("X",0,0,"unix"),ae("x",0,0,"valueOf"),Ce("x",tr),Ce("X",Ra),it("X",function(y,A,D){D._d=new Date(parseFloat(y)*1e3)}),it("x",function(y,A,D){D._d=new Date(He(y))});return i.version="2.30.1",s(st),i.fn=ye,i.min=uo,i.max=co,i.now=fo,i.utc=m,i.unix=Zo,i.months=ia,i.isDate=d,i.locale=vi,i.invalid=I,i.duration=nt,i.isMoment=F,i.weekdays=Qo,i.parseZone=Jt,i.localeData=Ei,i.isDuration=xr,i.monthsShort=ra,i.weekdaysMin=an,i.defineLocale=ss,i.updateLocale=Nt,i.locales=jt,i.weekdaysShort=Jo,i.normalizeUnits=ze,i.relativeTimeRounding=ol,i.relativeTimeThreshold=ll,i.calendarFormat=ds,i.prototype=ye,i.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},i}))})(moment$2)),moment$2.exports}var jalaaliJs,hasRequiredJalaaliJs;function requireJalaaliJs(){if(hasRequiredJalaaliJs)return jalaaliJs;hasRequiredJalaaliJs=1,jalaaliJs={toJalaali:e,toGregorian:t,isValidJalaaliDate:i,isLeapJalaaliYear:s,jalaaliMonthLength:n,jalCal:o,j2d:c,d2j:u,g2d:f,d2g:d,jalaaliToDateObject:E,jalaaliWeek:g};var r=[-61,9,38,199,426,686,756,818,1111,1181,1210,1635,2060,2097,2192,2262,2324,2394,2456,3178];function e(S,b,C){return Object.prototype.toString.call(S)==="[object Date]"&&(C=S.getDate(),b=S.getMonth()+1,S=S.getFullYear()),u(f(S,b,C))}function t(S,b,C){return d(c(S,b,C))}function i(S,b,C){return S>=-61&&S<=3177&&b>=1&&b<=12&&C>=1&&C<=n(S,b)}function s(S){return a(S)===0}function n(S,b){return b<=6?31:b<=11||s(S)?30:29}function a(S){var b=r.length,C=r[0],I,L,k,U,O;if(S<C||S>=r[b-1])throw new Error("Invalid Jalaali year "+S);for(O=1;O<b&&(I=r[O],L=I-C,!(S<I));O+=1)C=I;return U=S-C,L-U<6&&(U=U-L+m(L+4,33)*33),k=T(T(U+1,33)-1,4),k===-1&&(k=4),k}function o(S,b){var C=r.length,I=S+621,L=-14,k=r[0],U,O,F,G,x,$,X;if(S<k||S>=r[C-1])throw new Error("Invalid Jalaali year "+S);for(X=1;X<C&&(U=r[X],O=U-k,!(S<U));X+=1)L=L+m(O,33)*8+m(T(O,33),4),k=U;return $=S-k,L=L+m($,33)*8+m(T($,33)+3,4),T(O,33)===4&&O-$===4&&(L+=1),G=m(I,4)-m((m(I,100)+1)*3,4)-150,x=20+L-G,b?{gy:I,march:x}:(O-$<6&&($=$-O+m(O+4,33)*33),F=T(T($+1,33)-1,4),F===-1&&(F=4),{leap:F,gy:I,march:x})}function c(S,b,C){var I=o(S,!0);return f(I.gy,3,I.march)+(b-1)*31-m(b,7)*(b-7)+C-1}function u(S){var b=d(S).gy,C=b-621,I=o(C,!1),L=f(b,3,I.march),k,U,O;if(O=S-L,O>=0){if(O<=185)return U=1+m(O,31),k=T(O,31)+1,{jy:C,jm:U,jd:k};O-=186}else C-=1,O+=179,I.leap===1&&(O+=1);return U=7+m(O,30),k=T(O,30)+1,{jy:C,jm:U,jd:k}}function f(S,b,C){var I=m((S+m(b-8,6)+100100)*1461,4)+m(153*T(b+9,12)+2,5)+C-34840408;return I=I-m(m(S+100100+m(b-8,6),100)*3,4)+752,I}function d(S){var b,C,I,L,k;return b=4*S+139361631,b=b+m(m(4*S+183187720,146097)*3,4)*4-3908,C=m(T(b,1461),4)*5+308,I=m(T(C,153),5)+1,L=T(m(C,153),12)+1,k=m(b,1461)-100100+m(8-L,6),{gy:k,gm:L,gd:I}}function g(S,b,C){var I=E(S,b,C).getDay(),L=I==6?0:-(I+1),k=6+L;return{saturday:u(c(S,b,C+L)),friday:u(c(S,b,C+k))}}function E(S,b,C,I,L,k,U){var O=t(S,b,C);return new Date(O.gy,O.gm-1,O.gd,I||0,L||0,k||0,U||0)}function m(S,b){return~~(S/b)}function T(S,b){return S-~~(S/b)*b}return jalaaliJs}var momentJalaali,hasRequiredMomentJalaali;function requireMomentJalaali(){if(hasRequiredMomentJalaali)return momentJalaali;hasRequiredMomentJalaali=1,momentJalaali=pe;var r=requireMoment(),e=requireJalaaliJs(),t=/(\[[^\[]*\])|(\\)?j(Mo|MM?M?M?|Do|DDDo|DD?D?D?|w[o|w]?|YYYYY|YYYY|YY|gg(ggg?)?|)|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|SS?S?|X|zz?|ZZ?|.)/g,i=/(\[[^\[]*\])|(\\)?(LTS?|LL?L?L?|l{1,4})/g,s=/\d\d?/,n=/\d{1,3}/,a=/\d{3}/,o=/\d{1,4}/,c=/[+\-]?\d{1,6}/,u=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,f=/Z|[\+\-]\d\d:?\d\d/i,d=/T/i,g=/[\+\-]?\d+(\.\d{1,3})?/,E={1:"۱",2:"۲",3:"۳",4:"۴",5:"۵",6:"۶",7:"۷",8:"۸",9:"۹",0:"۰"},m={"۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9","۰":"0"},T={jm:"jmonth",jmonths:"jmonth",jy:"jyear",jyears:"jyear"},S={},b="DDD w M D".split(" "),C="M D w".split(" "),I={jM:function(){return this.jMonth()+1},jMMM:function(Y){return this.localeData().jMonthsShort(this,Y)},jMMMM:function(Y){return this.localeData().jMonths(this,Y)},jD:function(){return this.jDate()},jDDD:function(){return this.jDayOfYear()},jw:function(){return this.jWeek()},jYY:function(){return O(this.jYear()%100,2)},jYYYY:function(){return O(this.jYear(),4)},jYYYYY:function(){return O(this.jYear(),5)},jgg:function(){return O(this.jWeekYear()%100,2)},jgggg:function(){return this.jWeekYear()},jggggg:function(){return O(this.jWeekYear(),5)}};function L(Y,q){return function(le){return O(Y.call(this,le),q)}}function k(Y,q){return function(le){return this.localeData().ordinal(Y.call(this,le),q)}}(function(){for(var Y;b.length;)Y=b.pop(),I["j"+Y+"o"]=k(I["j"+Y],Y);for(;C.length;)Y=C.pop(),I["j"+Y+Y]=L(I["j"+Y],2);I.jDDDD=L(I.jDDD,3)})();function U(Y,q){var le;for(le in q)q.hasOwnProperty(le)&&(Y[le]=q[le]);return Y}function O(Y,q){for(var le=Y+"";le.length<q;)le="0"+le;return le}function F(Y){return Object.prototype.toString.call(Y)==="[object Array]"}function G(Y){if(Y){var q=Y.toLowerCase();Y=T[q]||q}return Y}function x(Y,q,le,ce){var Ee=Y._d;isNaN(q)&&(Y._isValid=!1),Y._isUTC?Y._d=new Date(Date.UTC(q,le,ce,Ee.getUTCHours(),Ee.getUTCMinutes(),Ee.getUTCSeconds(),Ee.getUTCMilliseconds())):Y._d=new Date(q,le,ce,Ee.getHours(),Ee.getMinutes(),Ee.getSeconds(),Ee.getMilliseconds())}function $(Y){function q(){}return q.prototype=Y,new q}function X(Y){return Object.getPrototypeOf?Object.getPrototypeOf(Y):"".__proto__?Y.__proto__:Y.constructor.prototype}U(X(r.localeData()),{_jMonths:["Farvardin","Ordibehesht","Khordaad","Tir","Amordaad","Shahrivar","Mehr","Aabaan","Aazar","Dey","Bahman","Esfand"],jMonths:function(Y){return this._jMonths[Y.jMonth()]},_jMonthsShort:["Far","Ord","Kho","Tir","Amo","Sha","Meh","Aab","Aaz","Dey","Bah","Esf"],jMonthsShort:function(Y){return this._jMonthsShort[Y.jMonth()]},jMonthsParse:function(Y){var q,le,ce;for(this._jMonthsParse||(this._jMonthsParse=[]),q=0;q<12;q+=1)if(this._jMonthsParse[q]||(le=pe([2e3,(2+q)%12,25]),ce="^"+this.jMonths(le,"")+"|^"+this.jMonthsShort(le,""),this._jMonthsParse[q]=new RegExp(ce.replace(".",""),"i")),this._jMonthsParse[q].test(Y))return q}});function Q(Y){var q=Y.match(t),le=q.length,ce;for(ce=0;ce<le;ce+=1)I[q[ce]]&&(q[ce]=I[q[ce]]);return function(Ee){var ve="";for(ce=0;ce<le;ce+=1)ve+=q[ce]instanceof Function?"["+q[ce].call(Ee,Y)+"]":q[ce];return ve}}function ee(Y,q){switch(Y){case"jDDDD":return a;case"jYYYY":return o;case"jYYYYY":return c;case"jDDD":return n;case"jMMM":case"jMMMM":return u;case"jMM":case"jDD":case"jYY":case"jM":case"jD":return s;case"DDDD":return a;case"YYYY":return o;case"YYYYY":return c;case"S":case"SS":case"SSS":case"DDD":return n;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return u;case"a":case"A":return r.localeData(q._l)._meridiemParse;case"X":return g;case"Z":case"ZZ":return f;case"T":return d;case"MM":case"DD":case"YY":case"HH":case"hh":case"mm":case"ss":case"M":case"D":case"d":case"H":case"h":case"m":case"s":return s;default:return new RegExp(Y.replace("\\",""))}}function te(Y,q,le){var ce,Ee=le._a;switch(Y){case"jM":case"jMM":Ee[1]=q==null?0:~~q-1;break;case"jMMM":case"jMMMM":ce=r.localeData(le._l).jMonthsParse(q),ce!=null?Ee[1]=ce:le._isValid=!1;break;case"jD":case"jDD":case"jDDD":case"jDDDD":q!=null&&(Ee[2]=~~q);break;case"jYY":Ee[0]=~~q+(~~q>47?1300:1400);break;case"jYYYY":case"jYYYYY":Ee[0]=~~q}q==null&&(le._isValid=!1)}function re(Y){var q,le,ce=Y._a[0],Ee=Y._a[1],ve=Y._a[2];return ce==null&&Ee==null&&ve==null?[0,0,1]:(ce=ce??0,Ee=Ee??0,ve=ve??1,(ve<1||ve>pe.jDaysInMonth(ce,Ee)||Ee<0||Ee>11)&&(Y._isValid=!1),q=Ae(ce,Ee,ve),le=ae(q.gy,q.gm,q.gd),isNaN(q.gy)&&(Y._isValid=!1),Y._jDiff=0,~~le.jy!==ce&&(Y._jDiff+=1),~~le.jm!==Ee&&(Y._jDiff+=1),~~le.jd!==ve&&(Y._jDiff+=1),[q.gy,q.gm,q.gd])}function me(Y){var q=Y._f.match(t),le=Y._i+"",ce=q.length,Ee,ve,Be;for(Y._a=[],Ee=0;Ee<ce;Ee+=1)ve=q[Ee],Be=(ee(ve,Y).exec(le)||[])[0],Be&&(le=le.slice(le.indexOf(Be)+Be.length)),I[ve]&&te(ve,Be,Y);return le&&(Y._il=le),re(Y)}function H(Y,q){var le=Y._f.length,ce,Ee,ve,Be,Ie,Me;if(le===0)return he(new Date(NaN));for(ce=0;ce<le;ce+=1)Ee=Y._f[ce],Ie=0,ve=he(Y._i,Ee,Y._l,Y._strict,q),ve.isValid()&&(Ie+=ve._jDiff,ve._il&&(Ie+=ve._il.length),(Me==null||Ie<Me)&&(Me=Ie,Be=ve));return Be}function z(Y){var q=Y._i+"",le="",ce="",Ee=Y._f.match(t),ve=Ee.length,Be,Ie,Me;for(Be=0;Be<ve;Be+=1)Ie=Ee[Be],Me=(ee(Ie,Y).exec(q)||[])[0],Me&&(q=q.slice(q.indexOf(Me)+Me.length)),I[Ie]instanceof Function||(ce+=Ie,Me&&(le+=Me));Y._i=le,Y._f=ce}function ie(Y,q,le){var ce=le-q,Ee=le-Y.day(),ve;return Ee>ce&&(Ee-=7),Ee<ce-7&&(Ee+=7),ve=pe(Y).add(Ee,"d"),{week:Math.ceil(ve.jDayOfYear()/7),year:ve.jYear()}}var ne=57724432199999;function he(Y,q,le,ce,Ee){typeof le=="boolean"&&(ce=le,le=void 0),q&&typeof q=="string"&&(q=Pe(q,r));var ve={_i:Y,_f:q,_l:le,_strict:ce},Be,Ie,Me,Ve=Y,dt=q;if(q){if(F(q))return H(ve,Ee);Be=me(ve),z(ve),q="YYYY-MM-DD-"+ve._f,Y=O(Be[0],4)+"-"+O(Be[1]+1,2)+"-"+O(Be[2],2)+"-"+ve._i}return Ee?Ie=r.utc(Y,q,le,ce):Ie=r(Y,q,le,ce),ve._isValid===!1&&(Ie._isValid=!1),Ie._jDiff=ve._jDiff||0,Me=$(pe.fn),U(Me,Ie),ce&&q&&Me.isValid()&&(Me._isValid=Me.format(dt)===Ve),Ie._d.getTime()>ne&&(Me._isValid=!1),Me}function pe(Y,q,le,ce){return he(Y,q,le,ce,!1)}U(pe,r),pe.fn=$(r.fn),pe.utc=function(Y,q,le,ce){return he(Y,q,le,ce,!0)},pe.unix=function(Y){return he(Y*1e3)};function Pe(Y,q){for(var le=5,ce=function(Ee){return q.localeData().longDateFormat(Ee)||Ee};le>0&&i.test(Y);)le-=1,Y=Y.replace(i,ce);return Y}pe.fn.format=function(Y){return Y&&(Y=Pe(Y,this),S[Y]||(S[Y]=Q(Y)),Y=S[Y](this)),r.fn.format.call(this,Y)},pe.fn.jYear=function(Y){var q,le,ce;return typeof Y=="number"?(le=ae(this.year(),this.month(),this.date()),q=Math.min(le.jd,pe.jDaysInMonth(Y,le.jm)),ce=Ae(Y,le.jm,q),x(this,ce.gy,ce.gm,ce.gd),r.updateOffset(this),this):ae(this.year(),this.month(),this.date()).jy},pe.fn.jMonth=function(Y){var q,le,ce;return Y!=null?typeof Y=="string"&&(Y=this.localeData().jMonthsParse(Y),typeof Y!="number")?this:(le=ae(this.year(),this.month(),this.date()),q=Math.min(le.jd,pe.jDaysInMonth(le.jy,Y)),this.jYear(le.jy+Re(Y,12)),Y=Le(Y,12),Y<0&&(Y+=12,this.jYear(this.jYear()-1)),ce=Ae(this.jYear(),Y,q),x(this,ce.gy,ce.gm,ce.gd),r.updateOffset(this),this):ae(this.year(),this.month(),this.date()).jm},pe.fn.jDate=function(Y){var q,le;return typeof Y=="number"?(q=ae(this.year(),this.month(),this.date()),le=Ae(q.jy,q.jm,Y),x(this,le.gy,le.gm,le.gd),r.updateOffset(this),this):ae(this.year(),this.month(),this.date()).jd},pe.fn.jDayOfYear=function(Y){var q=Math.round((pe(this).startOf("day")-pe(this).startOf("jYear"))/864e5)+1;return Y==null?q:this.add(Y-q,"d")},pe.fn.jWeek=function(Y){var q=ie(this,this.localeData()._week.dow,this.localeData()._week.doy).week;return Y==null?q:this.add((Y-q)*7,"d")},pe.fn.jWeekYear=function(Y){var q=ie(this,this.localeData()._week.dow,this.localeData()._week.doy).year;return Y==null?q:this.add(Y-q,"y")},pe.fn.add=function(Y,q){var le;return q!==null&&!isNaN(+q)&&(le=Y,Y=q,q=le),q=G(q),q==="jyear"?this.jYear(this.jYear()+Y):q==="jmonth"?this.jMonth(this.jMonth()+Y):(r.fn.add.call(this,Y,q),isNaN(this.jYear())&&(this._isValid=!1)),this},pe.fn.subtract=function(Y,q){var le;return q!==null&&!isNaN(+q)&&(le=Y,Y=q,q=le),q=G(q),q==="jyear"?this.jYear(this.jYear()-Y):q==="jmonth"?this.jMonth(this.jMonth()-Y):r.fn.subtract.call(this,Y,q),this},pe.fn.startOf=function(Y){return Y=G(Y),Y==="jyear"||Y==="jmonth"?(Y==="jyear"&&this.jMonth(0),this.jDate(1),this.hours(0),this.minutes(0),this.seconds(0),this.milliseconds(0),this):r.fn.startOf.call(this,Y)},pe.fn.endOf=function(Y){return Y=G(Y),Y===void 0||Y==="milisecond"?this:this.startOf(Y).add(1,Y==="isoweek"?"week":Y).subtract(1,"ms")},pe.fn.isSame=function(Y,q){return q=G(q),q==="jyear"||q==="jmonth"?r.fn.isSame.call(this.startOf(q),Y.startOf(q)):r.fn.isSame.call(this,Y,q)},pe.fn.clone=function(){return pe(this)},pe.fn.jYears=pe.fn.jYear,pe.fn.jMonths=pe.fn.jMonth,pe.fn.jDates=pe.fn.jDate,pe.fn.jWeeks=pe.fn.jWeek,pe.jDaysInMonth=function(Y,q){return Y+=Re(q,12),q=Le(q,12),q<0&&(q+=12,Y-=1),q<6?31:q<11||pe.jIsLeapYear(Y)?30:29},pe.jIsLeapYear=e.isLeapJalaaliYear,pe.loadPersian=function(Y){var q=Y!==void 0&&Y.hasOwnProperty("usePersianDigits")?Y.usePersianDigits:!1,le=Y!==void 0&&Y.hasOwnProperty("dialect")?Y.dialect:"persian";r.locale("fa"),r.updateLocale("fa",{months:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),monthsShort:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),weekdays:{persian:"یکشنبه_دوشنبه_سهشنبه_چهارشنبه_پنجشنبه_آدینه_شنبه".split("_"),"persian-modern":"یکشنبه_دوشنبه_سهشنبه_چهارشنبه_پنجشنبه_جمعه_شنبه".split("_")}[le],weekdaysShort:{persian:"یکشنبه_دوشنبه_سهشنبه_چهارشنبه_پنجشنبه_آدینه_شنبه".split("_"),"persian-modern":"یکشنبه_دوشنبه_سهشنبه_چهارشنبه_پنجشنبه_جمعه_شنبه".split("_")}[le],weekdaysMin:{persian:"ی_د_س_چ_پ_آ_ش".split("_"),"persian-modern":"ی_د_س_چ_پ_ج_ش".split("_")}[le],longDateFormat:{LT:"HH:mm",L:"jYYYY/jMM/jDD",LL:"jD jMMMM jYYYY",LLL:"jD jMMMM jYYYY LT",LLLL:"dddd، jD jMMMM jYYYY LT"},calendar:{sameDay:"[امروز ساعت] LT",nextDay:"[فردا ساعت] LT",nextWeek:"dddd [ساعت] LT",lastDay:"[دیروز ساعت] LT",lastWeek:"dddd [ی پیش ساعت] LT",sameElse:"L"},relativeTime:{future:"در %s",past:"%s پیش",s:"چند ثانیه",m:"1 دقیقه",mm:"%d دقیقه",h:"1 ساعت",hh:"%d ساعت",d:"1 روز",dd:"%d روز",M:"1 ماه",MM:"%d ماه",y:"1 سال",yy:"%d سال"},preparse:function(ce){return q?ce.replace(/[۰-۹]/g,function(Ee){return m[Ee]}).replace(/،/g,","):ce},postformat:function(ce){return q?ce.replace(/\d/g,function(Ee){return E[Ee]}).replace(/,/g,"،"):ce},ordinal:"%dم",week:{dow:6,doy:12},meridiem:function(ce){return ce<12?"ق.ظ":"ب.ظ"},jMonths:{persian:"فروردین_اردیبهشت_خرداد_تیر_امرداد_شهریور_مهر_آبان_آذر_دی_بهمن_اسفند".split("_"),"persian-modern":"فروردین_اردیبهشت_خرداد_تیر_مرداد_شهریور_مهر_آبان_آذر_دی_بهمن_اسفند".split("_")}[le],jMonthsShort:{persian:"فرو_ارد_خرد_تیر_امر_شهر_مهر_آبا_آذر_دی_بهم_اسف".split("_"),"persian-modern":"فرو_ارد_خرد_تیر_مرد_شهر_مهر_آبا_آذر_دی_بهم_اسف".split("_")}[le]})},pe.loadPersian_dari=function(Y){var q=Y!==void 0&&Y.hasOwnProperty("usePersianDigits")?Y.usePersianDigits:!1,le=Y!==void 0&&Y.hasOwnProperty("dialect")?Y.dialect:"persian-dari";r.locale("fa-af"),r.updateLocale("fa-af",{months:"جنوری_فبروری_مارچ_اپریل_می_جون_جولای_آگست_سپتمبر_اکتوبر_نومبر_دیسمبر".split("_"),monthsShort:"جنوری_فبروری_مارچ_اپریل_می_جون_جولای_آگست_سپتمبر_اکتوبر_نومبر_دیسمبر".split("_"),weekdays:{persian:"یکشنبه_دوشنبه_سهشنبه_چهارشنبه_پنجشنبه_آدینه_شنبه".split("_"),"persian-modern":"یکشنبه_دوشنبه_سهشنبه_چهارشنبه_پنجشنبه_جمعه_شنبه".split("_")}[le],weekdaysShort:{persian:"یکشنبه_دوشنبه_سهشنبه_چهارشنبه_پنجشنبه_آدینه_شنبه".split("_"),"persian-modern":"یکشنبه_دوشنبه_سهشنبه_چهارشنبه_پنجشنبه_جمعه_شنبه".split("_")}[le],weekdaysMin:{persian:"ی_د_س_چ_پ_آ_ش".split("_"),"persian-modern":"ی_د_س_چ_پ_ج_ش".split("_")}[le],longDateFormat:{LT:"HH:mm",L:"jYYYY/jMM/jDD",LL:"jD jMMMM jYYYY",LLL:"jD jMMMM jYYYY LT",LLLL:"dddd، jD jMMMM jYYYY LT"},calendar:{sameDay:"[امروز ساعت] LT",nextDay:"[فردا ساعت] LT",nextWeek:"dddd [ساعت] LT",lastDay:"[دیروز ساعت] LT",lastWeek:"dddd [ی پیش ساعت] LT",sameElse:"L"},relativeTime:{future:"در %s",past:"%s پیش",s:"چند ثانیه",m:"1 دقیقه",mm:"%d دقیقه",h:"1 ساعت",hh:"%d ساعت",d:"1 روز",dd:"%d روز",M:"1 ماه",MM:"%d ماه",y:"1 سال",yy:"%d سال"},preparse:function(ce){return q?ce.replace(/[۰-۹]/g,function(Ee){return m[Ee]}).replace(/،/g,","):ce},postformat:function(ce){return q?ce.replace(/\d/g,function(Ee){return E[Ee]}).replace(/,/g,"،"):ce},ordinal:"%dم",week:{dow:6,doy:12},meridiem:function(ce){return ce<12?"ق.ظ":"ب.ظ"},jMonths:{"persian-dari":"حمل_ثور_جوزا_سرطان_اسد_سنبله_میزان_عقرب_قوس_جدی_دلو_حوت".split("_"),"persian-modern-dari":"حمل_ثور_جوزا_سرطان_اسد_سنبله_میزان_عقرب_قوس_جدی_دلو_حوت".split("_")}[le],jMonthsShort:{"persian-dari":"حمل_ثور_جوزا_سرط_اسد_سنب_میز_عقر_قوس_جدی_دلو_حوت".split("_"),"persian-modern-dari":"حمل_ثور_جوزا_سرط_اسد_سنب_میز_عقر_قوس_جدی_دلو_حوت".split("_")}[le]})},pe.loadPashto=function(Y){var q=Y!==void 0&&Y.hasOwnProperty("usePersianDigits")?Y.usePersianDigits:!1,le=Y!==void 0&&Y.hasOwnProperty("dialect")?Y.dialect:"pashto";r.locale("ps-af"),r.updateLocale("ps-af",{months:"جنوری_فبروری_مارچ_اپریل_می_جون_جولای_آگست_سپتمبر_اکتوبر_نومبر_دیسمبر".split("_"),monthsShort:"جنوری_فبروری_مارچ_اپریل_می_جون_جولای_آگست_سپتمبر_اکتوبر_نومبر_دیسمبر".split("_"),weekdays:{pashto:"یکشنبه_دوشنبه_سهشنبه_چهارشنبه_پنجشنبه_آدینه_شنبه".split("_"),"pashto-modern":"یکشنبه_دوشنبه_سهشنبه_چهارشنبه_پنجشنبه_جمعه_شنبه".split("_")}[le],weekdaysShort:{pashto:"یکشنبه_دوشنبه_سهشنبه_چهارشنبه_پنجشنبه_آدینه_شنبه".split("_"),"pashto-modern":"یکشنبه_دوشنبه_سهشنبه_چهارشنبه_پنجشنبه_جمعه_شنبه".split("_")}[le],weekdaysMin:{pashto:"ی_د_س_چ_پ_آ_ش".split("_"),"pashto-modern":"ی_د_س_چ_پ_ج_ش".split("_")}[le],longDateFormat:{LT:"HH:mm",L:"jYYYY/jMM/jDD",LL:"jD jMMMM jYYYY",LLL:"jD jMMMM jYYYY LT",LLLL:"dddd، jD jMMMM jYYYY LT"},calendar:{sameDay:"[امروز ساعت] LT",nextDay:"[فردا ساعت] LT",nextWeek:"dddd [ساعت] LT",lastDay:"[دیروز ساعت] LT",lastWeek:"dddd [ی پیش ساعت] LT",sameElse:"L"},relativeTime:{future:"در %s",past:"%s پیش",s:"چند ثانیه",m:"1 دقیقه",mm:"%d دقیقه",h:"1 ساعت",hh:"%d ساعت",d:"1 روز",dd:"%d روز",M:"1 ماه",MM:"%d ماه",y:"1 سال",yy:"%d سال"},preparse:function(ce){return q?ce.replace(/[۰-۹]/g,function(Ee){return m[Ee]}).replace(/،/g,","):ce},postformat:function(ce){return q?ce.replace(/\d/g,function(Ee){return E[Ee]}).replace(/,/g,"،"):ce},ordinal:"%dم",week:{dow:6,doy:12},meridiem:function(ce){return ce<12?"ق.ظ":"ب.ظ"},jMonths:{pashto:"وری_غویی_غبرګولی_چنګاښ_زمری_وږی_تله_لړم_لیندی_مرغومی_سلواغه_کب".split("_"),"pashto-modern":"وری_غویی_غبرګولی_چنګاښ_زمری_وږی_تله_لړم_لیندی_مرغومی_سلواغه_کب".split("_")}[le],jMonthsShort:{pashto:"وری_غوی_غبر_چنګ_زمر_وږی_لړم_لین_مرغ_سلو_کب".split("_"),"pashto-modern":"وری_غوی_غبر_چنګ_زمر_وږی_لړم_لین_مرغ_سلو_کب".split("_")}[le]})},pe.jConvert={toJalaali:ae,toGregorian:Ae};function ae(Y,q,le){try{var ce=e.toJalaali(Y,q+1,le);return ce.jm-=1,ce}catch{return{jy:NaN,jm:NaN,jd:NaN}}}function Ae(Y,q,le){try{var ce=e.toGregorian(Y,q+1,le);return ce.gm-=1,ce}catch{return{gy:NaN,gm:NaN,gd:NaN}}}function Re(Y,q){return~~(Y/q)}function Le(Y,q){return Y-~~(Y/q)*q}return momentJalaali}var momentJalaaliExports=requireMomentJalaali();const moment=getDefaultExportFromCjs$1(momentJalaaliExports);moment.loadPersian({dialect:"persian-modern",usePersianDigits:!0});const formatTime=r=>{const e=Math.floor(r/3600),t=Math.floor(r%3600/60),i=Math.floor(r%60),s=String(t).padStart(2,"0"),n=String(i).padStart(2,"0");return e>0?`${e}:${s}:${n}`:`${s}:${n}`};function RetrySvg({width:r=24}){return jsxRuntime.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M16.19 2H7.81C4.17 2 2 4.17 2 7.81V16.18C2 19.83 4.17 22 7.81 22H16.18C19.82 22 21.99 19.83 21.99 16.19V7.81C22 4.17 19.83 2 16.19 2ZM12 18.01C8.83 18.01 6.25 15.43 6.25 12.26C6.25 11.12 6.58 10.01 7.22 9.07C7.45 8.72 7.92 8.63 8.26 8.86C8.6 9.09 8.7 9.56 8.46 9.9C8 10.6 7.75 11.42 7.75 12.26C7.75 14.6 9.66 16.51 12 16.51C14.34 16.51 16.25 14.6 16.25 12.26C16.25 9.92 14.34 8.01 12 8.01C11.81 8.01 11.63 8.03 11.44 8.05L12 8.46C12.33 8.7 12.41 9.17 12.16 9.51C12.01 9.71 11.78 9.82 11.55 9.82C11.4 9.82 11.24 9.77 11.11 9.68L9.17 8.25C9.17 8.25 9.16 8.24 9.15 8.23C9.14 8.22 9.13 8.22 9.12 8.21C9.09 8.19 9.08 8.15 9.05 8.12C9.02 8.08 8.99 8.05 8.96 8C8.94 7.96 8.93 7.91 8.91 7.87C8.9 7.82 8.88 7.78 8.88 7.73C8.88 7.68 8.88 7.64 8.89 7.59C8.89 7.54 8.89 7.5 8.91 7.45C8.91 7.4 8.94 7.36 8.96 7.31C8.98 7.28 8.98 7.24 9.01 7.2C9.02 7.2 9.03 7.19 9.04 7.18C9.05 7.17 9.05 7.16 9.06 7.15L10.73 5.24C11 4.93 11.48 4.89 11.79 5.17C12.1 5.44 12.13 5.92 11.86 6.23L11.58 6.55C11.72 6.54 11.86 6.52 12.01 6.52C15.18 6.52 17.76 9.1 17.76 12.27C17.76 15.44 15.17 18.01 12 18.01Z",fill:"#fff"})})}var DeviceTypeEnum=(r=>(r.DESKTOP="desktop",r.MOBILE="mobile",r))(DeviceTypeEnum||{});function useDeviceType(){const[r,e]=React.useState(DeviceTypeEnum.MOBILE);React.useEffect(()=>(t(),window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}));const t=()=>{window.innerWidth>1024?e(DeviceTypeEnum.DESKTOP):e(DeviceTypeEnum.MOBILE)};return r}function MainControl({children:r}){return jsxRuntime.jsx("section",{children:jsxRuntime.jsx("div",{className:"w-24 h-24 flex justify-center items-center bg-black/40 backdrop-blur-xs rounded-full",children:r})})}function MinimizeSvg({width:r=24}){return jsxRuntime.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M16.19 2H7.81C4.17 2 2 4.17 2 7.81V16.18C2 19.83 4.17 22 7.81 22H16.18C19.82 22 21.99 19.83 21.99 16.19V7.81C22 4.17 19.83 2 16.19 2ZM10.22 21H7.91C5.2 21 3 18.8 3 16.09V13.78C3 13.37 3.34 13.03 3.75 13.03C4.16 13.03 4.5 13.37 4.5 13.78V16.09C4.5 17.97 6.03 19.5 7.91 19.5H10.22C10.63 19.5 10.97 19.84 10.97 20.25C10.97 20.66 10.64 21 10.22 21ZM10.22 4.5H7.91C6.03 4.5 4.5 6.03 4.5 7.91V10.22C4.5 10.63 4.16 10.97 3.75 10.97C3.34 10.97 3 10.64 3 10.22V7.91C3 5.2 5.2 3 7.91 3H10.22C10.63 3 10.97 3.34 10.97 3.75C10.97 4.16 10.64 4.5 10.22 4.5ZM21 16.09C21 18.8 18.8 21 16.09 21H14.7C14.29 21 13.95 20.66 13.95 20.25C13.95 19.84 14.29 19.5 14.7 19.5H16.09C17.97 19.5 19.5 17.97 19.5 16.09V14.7C19.5 14.29 19.84 13.95 20.25 13.95C20.66 13.95 21 14.29 21 14.7V16.09ZM21 10.22C21 10.63 20.66 10.97 20.25 10.97C19.84 10.97 19.5 10.63 19.5 10.22V7.91C19.5 6.03 17.97 4.5 16.09 4.5H13.78C13.37 4.5 13.03 4.16 13.03 3.75C13.03 3.34 13.36 3 13.78 3H16.09C18.8 3 21 5.2 21 7.91V10.22Z",fill:"#fff"})})}function VideoPlayerControl({canPlay:r,isPlayed:e,isMuted:t,isShowControl:i,isError:s,currentTime:n,duration:a,bufferedRanges:o,rates:c,onMaximize:u,onBackwardCurrentTime:f,onForwardCurrentTime:d,onDoubleClickInRight:g,onDoubleClickInLeft:E,onToggleMute:m,onTogglePlay:T,onChangeRate:S,onSeek:b,onTryAgain:C,isFullScreen:I}){const[L,k]=React.useState(!1),[U,O]=React.useState(!1),F=useDeviceType(),G=()=>{if(!a)return"";const x=n/a*100,$=`linear-gradient(to right, rgba(255,255,255,0.2) 0%, rgba(255,255,255,1) ${x}%, transparent ${x}%)`,X="rgba(0, 0, 0, 0.6)",Q="rgba(255, 255, 255, 0.1)";let ee=[`transparent ${x}%`];o.length>0&&o.forEach(re=>{const me=re.start/a*100,H=re.end/a*100;if(H<=x)return;const z=Math.max(me,x);ee.push(`${X} ${z}%`,`${X} ${H}%`)}),ee.push(`${Q} ${x}%`,`${Q} 100%`);const te=`linear-gradient(to right, ${ee.join(", ")})`;return`${$}, ${te}`};return React.useEffect(()=>{k(!0);const x=setTimeout(()=>{k(!1)},100);return()=>{clearTimeout(x)}},[t]),React.useEffect(()=>{O(!0);const x=setTimeout(()=>{O(!1)},100);return()=>{clearTimeout(x)}},[c]),jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Transition,{enterAnimateClass:"fadeIn",exitAnimateClass:"fadeOut",isVisible:r&&!e,children:jsxRuntime.jsx("div",{className:"absolute top-0 bottom-0 left-0 right-0 flex justify-center items-center cursor-pointer",children:jsxRuntime.jsx(MainControl,{children:jsxRuntime.jsx(PlayCircleSvg,{width:50})})})}),jsxRuntime.jsx(Transition,{enterAnimateClass:"fadeIn",exitAnimateClass:"fadeOut",isVisible:s,children:jsxRuntime.jsx("div",{onClick:()=>C?.(),className:"absolute top-0 bottom-0 left-0 right-0 flex justify-center items-center cursor-pointer bg-dark-surface/30 backdrop-blur-[1px]",children:jsxRuntime.jsx(MainControl,{children:jsxRuntime.jsx(RetrySvg,{width:50})})})}),jsxRuntime.jsx(Transition,{enterAnimateClass:"fadeIn",exitAnimateClass:"fadeOut",isVisible:!r&&!s,children:jsxRuntime.jsx("div",{className:"absolute top-0 bottom-0 left-0 right-0 flex justify-center items-center cursor-pointer bg-dark-surface/30 backdrop-blur-[1px]",children:jsxRuntime.jsx(MainControl,{children:jsxRuntime.jsx(Loading,{classNames:"w-[50px]"})})})}),r&&e?jsxRuntime.jsx("div",{onDoubleClick:()=>{g?.()},className:"absolute top-0 bottom-0 right-0 w-[50%] cursor-pointer"}):null,r&&e?jsxRuntime.jsx("div",{onDoubleClick:()=>{E?.()},className:"absolute top-0 bottom-0 left-0 w-[50%] cursor-pointer"}):null,jsxRuntime.jsx(Transition,{className:"absolute bottom-10 left-12 right-12 flex flex-col gap-5 items-center",enterAnimateClass:"fadeIn",exitAnimateClass:"fadeOut",speedAnimateClass:"faster",isVisible:r&&e&&i,children:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-full px-5 flex items-center",onClick:x=>x.stopPropagation(),children:jsxRuntime.jsx("input",{type:"range",min:0,max:a,value:n,onChange:x=>b?.(parseFloat(x.target.value)),className:"w-full h-3 appearance-none cursor-pointer rounded-full backdrop-blur-md transition duration-500 bg-black/60",style:{direction:"ltr",backgroundImage:G(),backgroundSize:"100% 100%",outline:"none"}})}),jsxRuntime.jsxs("div",{onClick:x=>x.stopPropagation(),className:`w-full flex justify-between items-center bg-black/40 rounded-full backdrop-blur-md transition duration-500 px-5 py-3 ${F===DeviceTypeEnum.MOBILE?"landscape:px-12":""}`,children:[jsxRuntime.jsxs("div",{className:`flex gap-3 items-center ${F===DeviceTypeEnum.MOBILE?"landscape:gap-5":""}`,children:[jsxRuntime.jsx("div",{className:"cursor-pointer",onClick:x=>{x.stopPropagation(),u?.()},children:I?jsxRuntime.jsx(MinimizeSvg,{width:30}):jsxRuntime.jsx(MaximizeSvg,{width:30})}),jsxRuntime.jsx("div",{className:"min-w-5 flex items-center justify-center cursor-pointer",onMouseUp:x=>{x.stopPropagation()},onMouseDown:x=>{x.stopPropagation()},onTouchStart:x=>{x.stopPropagation()},onTouchEnd:x=>{x.stopPropagation()},onClick:x=>{x.stopPropagation(),S?.()},children:jsxRuntime.jsx(Transition,{enterAnimateClass:"heartBeat",exitAnimateClass:"heartBeat",speedAnimateClass:"faster",isVisible:!U,children:jsxRuntime.jsx("span",{className:"text-white font-bold text-lg",children:lodashExports.first(lodashExports.filter(c,x=>x.active))?.label})})}),jsxRuntime.jsx("div",{className:"cursor-pointer",onClick:x=>{x.stopPropagation(),m?.()},children:jsxRuntime.jsx(Transition,{enterAnimateClass:"heartBeat",exitAnimateClass:"heartBeat",speedAnimateClass:"faster",isVisible:!L,children:t?jsxRuntime.jsx(VolumeMuteSvg,{width:30}):jsxRuntime.jsx(VolumeUnMuteSvg,{width:30})})})]}),jsxRuntime.jsxs("div",{className:`flex gap-3 items-center ${F===DeviceTypeEnum.MOBILE?"landscape:gap-5":""}`,children:[jsxRuntime.jsxs("div",{className:"flex gap-1 items-center rounded-full border border-white px-3 py-1",children:[jsxRuntime.jsx("span",{className:"text-white text-sm tabular-nums",children:formatTime(a)}),jsxRuntime.jsx("span",{className:"text-white text-sm",children:"/"}),jsxRuntime.jsx("span",{className:"text-white text-sm tabular-nums",children:formatTime(n)})]}),jsxRuntime.jsx("div",{className:"cursor-pointer",onClick:x=>{x.stopPropagation(),d?.()},children:jsxRuntime.jsx(ForwardSvg,{width:30})}),jsxRuntime.jsx("div",{className:"cursor-pointer",onClick:x=>{x.stopPropagation(),f?.()},children:jsxRuntime.jsx(BackwardSvg,{width:30})}),jsxRuntime.jsx("div",{className:"cursor-pointer",onClick:x=>{x.stopPropagation(),T?.()},children:jsxRuntime.jsx(PauseSvg,{width:30})})]})]})]})})]})}var LIBVERSION="2.0.7",UA_MAX_LENGTH=500,USER_AGENT="user-agent",EMPTY="",UNKNOWN="?",TYPEOF={FUNCTION:"function",OBJECT:"object",STRING:"string",UNDEFINED:"undefined"},BROWSER="browser",CPU="cpu",DEVICE="device",ENGINE="engine",OS="os",RESULT="result",NAME="name",TYPE="type",VENDOR="vendor",VERSION="version",ARCHITECTURE="architecture",MAJOR="major",MODEL="model",CONSOLE="console",MOBILE="mobile",TABLET="tablet",SMARTTV="smarttv",WEARABLE="wearable",XR="xr",EMBEDDED="embedded",INAPP="inapp",BRANDS="brands",FORMFACTORS="formFactors",FULLVERLIST="fullVersionList",PLATFORM="platform",PLATFORMVER="platformVersion",BITNESS="bitness",CH="sec-ch-ua",CH_FULL_VER_LIST=CH+"-full-version-list",CH_ARCH=CH+"-arch",CH_BITNESS=CH+"-"+BITNESS,CH_FORM_FACTORS=CH+"-form-factors",CH_MOBILE=CH+"-"+MOBILE,CH_MODEL=CH+"-"+MODEL,CH_PLATFORM=CH+"-"+PLATFORM,CH_PLATFORM_VER=CH_PLATFORM+"-version",CH_ALL_VALUES=[BRANDS,FULLVERLIST,MOBILE,MODEL,PLATFORM,PLATFORMVER,ARCHITECTURE,FORMFACTORS,BITNESS],AMAZON="Amazon",APPLE="Apple",ASUS="ASUS",BLACKBERRY="BlackBerry",GOOGLE="Google",HUAWEI="Huawei",LENOVO="Lenovo",HONOR="Honor",LG="LG",MICROSOFT="Microsoft",MOTOROLA="Motorola",NVIDIA="Nvidia",ONEPLUS="OnePlus",OPPO="OPPO",SAMSUNG="Samsung",SHARP="Sharp",SONY="Sony",XIAOMI="Xiaomi",ZEBRA="Zebra",CHROME="Chrome",CHROMIUM="Chromium",CHROMECAST="Chromecast",EDGE="Edge",FIREFOX="Firefox",OPERA="Opera",FACEBOOK="Facebook",SOGOU="Sogou",PREFIX_MOBILE="Mobile ",SUFFIX_BROWSER=" Browser",WINDOWS="Windows",isWindow=typeof window!==TYPEOF.UNDEFINED,NAVIGATOR=isWindow&&window.navigator?window.navigator:void 0,NAVIGATOR_UADATA=NAVIGATOR&&NAVIGATOR.userAgentData?NAVIGATOR.userAgentData:void 0,extend=function(r,e){var t={},i=e;if(!isExtensions(e)){i={};for(var s in e)for(var n in e[s])i[n]=e[s][n].concat(i[n]?i[n]:[])}for(var a in r)t[a]=i[a]&&i[a].length%2===0?i[a].concat(r[a]):r[a];return t},enumerize=function(r){for(var e={},t=0;t<r.length;t++)e[r[t].toUpperCase()]=r[t];return e},has=function(r,e){if(typeof r===TYPEOF.OBJECT&&r.length>0){for(var t in r)if(lowerize(e)==lowerize(r[t]))return!0;return!1}return isString(r)?lowerize(e)==lowerize(r):!1},isExtensions=function(r,e){for(var t in r)return/^(browser|cpu|device|engine|os)$/.test(t)||(e?isExtensions(r[t]):!1)},isString=function(r){return typeof r===TYPEOF.STRING},itemListToArray=function(r){if(r){for(var e=[],t=strip(/\\?\"/g,r).split(","),i=0;i<t.length;i++)if(t[i].indexOf(";")>-1){var s=trim(t[i]).split(";v=");e[i]={brand:s[0],version:s[1]}}else e[i]=trim(t[i]);return e}},lowerize=function(r){return isString(r)?r.toLowerCase():r},majorize=function(r){return isString(r)?strip(/[^\d\.]/g,r).split(".")[0]:void 0},setProps=function(r){for(var e in r)if(r.hasOwnProperty(e)){var t=r[e];typeof t==TYPEOF.OBJECT&&t.length==2?this[t[0]]=t[1]:this[t]=void 0}return this},strip=function(r,e){return isString(e)?e.replace(r,EMPTY):e},stripQuotes=function(r){return strip(/\\?\"/g,r)},trim=function(r,e){return r=strip(/^\s\s*/,String(r)),typeof e===TYPEOF.UNDEFINED?r:r.substring(0,e)},rgxMapper=function(r,e){if(!(!r||!e))for(var t=0,i,s,n,a,o,c;t<e.length&&!o;){var u=e[t],f=e[t+1];for(i=s=0;i<u.length&&!o&&u[i];)if(o=u[i++].exec(r),o)for(n=0;n<f.length;n++)c=o[++s],a=f[n],typeof a===TYPEOF.OBJECT&&a.length>0?a.length===2?typeof a[1]==TYPEOF.FUNCTION?this[a[0]]=a[1].call(this,c):this[a[0]]=a[1]:a.length>=3&&(typeof a[1]===TYPEOF.FUNCTION&&!(a[1].exec&&a[1].test)?a.length>3?this[a[0]]=c?a[1].apply(this,a.slice(2)):void 0:this[a[0]]=c?a[1].call(this,c,a[2]):void 0:a.length==3?this[a[0]]=c?c.replace(a[1],a[2]):void 0:a.length==4?this[a[0]]=c?a[3].call(this,c.replace(a[1],a[2])):void 0:a.length>4&&(this[a[0]]=c?a[3].apply(this,[c.replace(a[1],a[2])].concat(a.slice(4))):void 0)):this[a]=c||void 0;t+=2}},strMapper=function(r,e){for(var t in e)if(typeof e[t]===TYPEOF.OBJECT&&e[t].length>0){for(var i=0;i<e[t].length;i++)if(has(e[t][i],r))return t===UNKNOWN?void 0:t}else if(has(e[t],r))return t===UNKNOWN?void 0:t;return e.hasOwnProperty("*")?e["*"]:r},windowsVersionMap={ME:"4.90","NT 3.51":"3.51","NT 4.0":"4.0",2e3:["5.0","5.01"],XP:["5.1","5.2"],Vista:"6.0",7:"6.1",8:"6.2","8.1":"6.3",10:["6.4","10.0"],NT:""},formFactorsMap={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},browserHintsMap={Chrome:"Google Chrome",Edge:"Microsoft Edge","Edge WebView2":"Microsoft Edge WebView2","Chrome WebView":"Android WebView","Chrome Headless":"HeadlessChrome","Huawei Browser":"HuaweiBrowser","MIUI Browser":"Miui Browser","Opera Mobi":"OperaMobile",Yandex:"YaBrowser"},defaultRegexes={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[VERSION,[NAME,PREFIX_MOBILE+"Chrome"]],[/webview.+edge\/([\w\.]+)/i],[VERSION,[NAME,EDGE+" WebView"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[VERSION,[NAME,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[NAME,VERSION],[/opios[\/ ]+([\w\.]+)/i],[VERSION,[NAME,OPERA+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[VERSION,[NAME,OPERA+" GX"]],[/\bopr\/([\w\.]+)/i],[VERSION,[NAME,OPERA]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[VERSION,[NAME,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[VERSION,[NAME,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(atlas|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon|otter|dooble|(?:lg |qute)browser|palemoon)\/([-\w\.]+)/i,/(heytap|ovi|115|surf|qwant)browser\/([\d\.]+)/i,/(qwant)(?:ios|mobile)\/([\d\.]+)/i,/(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i],[NAME,VERSION],[/quark(?:pc)?\/([-\w\.]+)/i],[VERSION,[NAME,"Quark"]],[/\bddg\/([\w\.]+)/i],[VERSION,[NAME,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[VERSION,[NAME,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[VERSION,[NAME,"WeChat"]],[/konqueror\/([\w\.]+)/i],[VERSION,[NAME,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[VERSION,[NAME,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[VERSION,[NAME,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[VERSION,[NAME,"Smart "+LENOVO+SUFFIX_BROWSER]],[/(avast|avg)\/([\w\.]+)/i],[[NAME,/(.+)/,"$1 Secure"+SUFFIX_BROWSER],VERSION],[/\bfocus\/([\w\.]+)/i],[VERSION,[NAME,FIREFOX+" Focus"]],[/\bopt\/([\w\.]+)/i],[VERSION,[NAME,OPERA+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[VERSION,[NAME,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[VERSION,[NAME,"Dolphin"]],[/coast\/([\w\.]+)/i],[VERSION,[NAME,OPERA+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[VERSION,[NAME,"MIUI"+SUFFIX_BROWSER]],[/fxios\/([\w\.-]+)/i],[VERSION,[NAME,PREFIX_MOBILE+FIREFOX]],[/\bqihoobrowser\/?([\w\.]*)/i],[VERSION,[NAME,"360"]],[/\b(qq)\/([\w\.]+)/i],[[NAME,/(.+)/,"$1Browser"],VERSION],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[NAME,/(.+)/,"$1"+SUFFIX_BROWSER],VERSION],[/samsungbrowser\/([\w\.]+)/i],[VERSION,[NAME,SAMSUNG+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[VERSION,[NAME,SOGOU+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[NAME,SOGOU+" Mobile"],VERSION],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[NAME,VERSION],[/(lbbrowser|rekonq|steam(?= (clie|tenf|gameo)))/i],[NAME],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[VERSION,NAME],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[NAME,FACEBOOK],VERSION,[TYPE,INAPP]],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(bing)(?:web|sapphire)\/([\w\.]+)/i,/(instagram|snapchat|klarna)[\/ ]([-\w\.]+)/i],[NAME,VERSION,[TYPE,INAPP]],[/\bgsa\/([\w\.]+) .*safari\//i],[VERSION,[NAME,"GSA"],[TYPE,INAPP]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[VERSION,[NAME,"TikTok"],[TYPE,INAPP]],[/\[(linkedin)app\]/i],[NAME,[TYPE,INAPP]],[/(zalo(?:app)?)[\/\sa-z]*([\w\.-]+)/i],[[NAME,/(.+)/,"Zalo"],VERSION,[TYPE,INAPP]],[/(chromium)[\/ ]([-\w\.]+)/i],[NAME,VERSION],[/headlesschrome(?:\/([\w\.]+)| )/i],[VERSION,[NAME,CHROME+" Headless"]],[/wv\).+chrome\/([\w\.]+).+edgw\//i],[VERSION,[NAME,EDGE+" WebView2"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[NAME,CHROME+" WebView"],VERSION],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[VERSION,[NAME,"Android"+SUFFIX_BROWSER]],[/chrome\/([\w\.]+) mobile/i],[VERSION,[NAME,PREFIX_MOBILE+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[NAME,VERSION],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[VERSION,[NAME,PREFIX_MOBILE+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[NAME,PREFIX_MOBILE+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[VERSION,NAME],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[NAME,[VERSION,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[NAME,VERSION],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[NAME,PREFIX_MOBILE+FIREFOX],VERSION],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[NAME,"Netscape"],VERSION],[/(wolvic|librewolf)\/([\w\.]+)/i],[NAME,VERSION],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[VERSION,[NAME,FIREFOX+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+(?= .+rv\:.+gecko\/\d+)|[0-4][\w\.]+(?!.+compatible))/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[NAME,[VERSION,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[NAME,[VERSION,/[^\d\.]+./,EMPTY]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[ARCHITECTURE,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[ARCHITECTURE,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[ARCHITECTURE,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[ARCHITECTURE,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[ARCHITECTURE,"arm"]],[/ sun4\w[;\)]/i],[[ARCHITECTURE,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i,/((ppc|powerpc)(64)?)( mac|;|\))/i,/(?:osf1|[freopnt]{3,4}bsd) (alpha)/i],[[ARCHITECTURE,/ower/,EMPTY,lowerize]],[/mc680.0/i],[[ARCHITECTURE,"68k"]],[/winnt.+\[axp/i],[[ARCHITECTURE,"alpha"]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[MODEL,[VENDOR,SAMSUNG],[TYPE,TABLET]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr]|browser)[-\w]+)/i,/sec-(sgh\w+)/i],[MODEL,[VENDOR,SAMSUNG],[TYPE,MOBILE]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)[\/\);]/i],[MODEL,[VENDOR,APPLE],[TYPE,MOBILE]],[/\b(?:ios|apple\w+)\/.+[\(\/](ipad)/i,/\b(ipad)[\d,]*[;\] ].+(mac |i(pad)?)os/i],[MODEL,[VENDOR,APPLE],[TYPE,TABLET]],[/(macintosh);/i],[MODEL,[VENDOR,APPLE]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[MODEL,[VENDOR,SHARP],[TYPE,MOBILE]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[MODEL,[VENDOR,HONOR],[TYPE,TABLET]],[/honor([-\w ]+)[;\)]/i],[MODEL,[VENDOR,HONOR],[TYPE,MOBILE]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[MODEL,[VENDOR,HUAWEI],[TYPE,TABLET]],[/(?:huawei) ?([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][\dc][adnt]?)\b(?!.+d\/s)/i],[MODEL,[VENDOR,HUAWEI],[TYPE,MOBILE]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b(?:xiao)?((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[MODEL,/_/g," "],[VENDOR,XIAOMI],[TYPE,TABLET]],[/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/oid[^\)]+; (redmi[\-_ ]?(?:note|k)?[\w_ ]+|m?[12]\d[01]\d\w{3,6}|poco[\w ]+|(shark )?\w{3}-[ah]0|qin ?[1-3](s\+|ultra| pro)?)( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note|max|cc)?[_ ]?(?:\d{0,2}\w?)[_ ]?(?:plus|se|lite|pro)?( 5g|lte)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[MODEL,/_/g," "],[VENDOR,XIAOMI],[TYPE,MOBILE]],[/droid.+; (cph2[3-6]\d[13579]|((gm|hd)19|(ac|be|in|kb)20|(d[en]|eb|le|mt)21|ne22)[0-2]\d|p[g-k]\w[1m]10)\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[MODEL,[VENDOR,ONEPLUS],[TYPE,MOBILE]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[MODEL,[VENDOR,OPPO],[TYPE,MOBILE]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[MODEL,[VENDOR,strMapper,{OnePlus:["203","304","403","404","413","415"],"*":OPPO}],[TYPE,TABLET]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[MODEL,[VENDOR,"BLU"],[TYPE,MOBILE]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[MODEL,[VENDOR,"Vivo"],[TYPE,MOBILE]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[MODEL,[VENDOR,"Realme"],[TYPE,MOBILE]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[MODEL,[VENDOR,LENOVO],[TYPE,TABLET]],[/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i],[MODEL,[VENDOR,LENOVO],[TYPE,MOBILE]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ]([\w\s]+)(\)| bui)/i,/((?:moto(?! 360)[-\w\(\) ]+|xt\d{3,4}[cgkosw\+]?[-\d]*|nexus 6)(?= bui|\)))/i],[MODEL,[VENDOR,MOTOROLA],[TYPE,MOBILE]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[MODEL,[VENDOR,MOTOROLA],[TYPE,TABLET]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[MODEL,[VENDOR,LG],[TYPE,TABLET]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,/\blg-?([\d\w]+) bui/i],[MODEL,[VENDOR,LG],[TYPE,MOBILE]],[/(nokia) (t[12][01])/i],[VENDOR,MODEL,[TYPE,TABLET]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*?))( bui|\)|;|\/)/i],[[MODEL,/_/g," "],[TYPE,MOBILE],[VENDOR,"Nokia"]],[/(pixel (c|tablet))\b/i],[MODEL,[VENDOR,GOOGLE],[TYPE,TABLET]],[/droid.+;(?: google)? (g(01[13]a|020[aem]|025[jn]|1b60|1f8f|2ybb|4s1m|576d|5nz6|8hhn|8vou|a02099|c15s|d1yq|e2ae|ec77|gh2x|kv4x|p4bc|pj41|r83y|tt9q|ur25|wvk6)|pixel[\d ]*a?( pro)?( xl)?( fold)?( \(5g\))?)( bui|\))/i],[MODEL,[VENDOR,GOOGLE],[TYPE,MOBILE]],[/(google) (pixelbook( go)?)/i],[VENDOR,MODEL],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-\w\w\d\d)(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[MODEL,[VENDOR,SONY],[TYPE,MOBILE]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[MODEL,"Xperia Tablet"],[VENDOR,SONY],[TYPE,TABLET]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[MODEL,[VENDOR,AMAZON],[TYPE,TABLET]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[MODEL,/(.+)/g,"Fire Phone $1"],[VENDOR,AMAZON],[TYPE,MOBILE]],[/(playbook);[-\w\),; ]+(rim)/i],[MODEL,VENDOR,[TYPE,TABLET]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/(?:blackberry|\(bb10;) (\w+)/i],[MODEL,[VENDOR,BLACKBERRY],[TYPE,MOBILE]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[MODEL,[VENDOR,ASUS],[TYPE,TABLET]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[MODEL,[VENDOR,ASUS],[TYPE,MOBILE]],[/(nexus 9)/i],[MODEL,[VENDOR,"HTC"],[TYPE,TABLET]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[VENDOR,[MODEL,/_/g," "],[TYPE,MOBILE]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[MODEL,[VENDOR,"TCL"],[TYPE,TABLET]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[MODEL,[VENDOR,"TCL"],[TYPE,MOBILE]],[/(itel) ((\w+))/i],[[VENDOR,lowerize],MODEL,[TYPE,strMapper,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[MODEL,[VENDOR,"Acer"],[TYPE,TABLET]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[MODEL,[VENDOR,"Meizu"],[TYPE,MOBILE]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[MODEL,[VENDOR,"Ulefone"],[TYPE,MOBILE]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[MODEL,[VENDOR,"Energizer"],[TYPE,MOBILE]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[MODEL,[VENDOR,"Cat"],[TYPE,MOBILE]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[MODEL,[VENDOR,"Smartfren"],[TYPE,MOBILE]],[/droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i],[MODEL,[VENDOR,"Nothing"],[TYPE,MOBILE]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[MODEL,[VENDOR,"Archos"],[TYPE,TABLET]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[MODEL,[VENDOR,"Archos"],[TYPE,MOBILE]],[/; (n159v)/i],[MODEL,[VENDOR,"HMD"],[TYPE,MOBILE]],[/(imo) (tab \w+)/i,/(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i],[VENDOR,MODEL,[TYPE,TABLET]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (blu|hmd|imo|infinix|lava|oneplus|tcl|wiko)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(oppo) ?([\w ]+) bui/i,/(hisense) ([ehv][\w ]+)\)/i,/droid[^;]+; (philips)[_ ]([sv-x][\d]{3,4}[xz]?)/i],[VENDOR,MODEL,[TYPE,MOBILE]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[VENDOR,MODEL,[TYPE,TABLET]],[/(surface duo)/i],[MODEL,[VENDOR,MICROSOFT],[TYPE,TABLET]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[MODEL,[VENDOR,"Fairphone"],[TYPE,MOBILE]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[MODEL,[VENDOR,NVIDIA],[TYPE,TABLET]],[/(sprint) (\w+)/i],[VENDOR,MODEL,[TYPE,MOBILE]],[/(kin\.[onetw]{3})/i],[[MODEL,/\./g," "],[VENDOR,MICROSOFT],[TYPE,MOBILE]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[MODEL,[VENDOR,ZEBRA],[TYPE,TABLET]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[MODEL,[VENDOR,ZEBRA],[TYPE,MOBILE]],[/(philips)[\w ]+tv/i,/smart-tv.+(samsung)/i],[VENDOR,[TYPE,SMARTTV]],[/hbbtv.+maple;(\d+)/i],[[MODEL,/^/,"SmartTV"],[VENDOR,SAMSUNG],[TYPE,SMARTTV]],[/(vizio)(?: |.+model\/)(\w+-\w+)/i,/tcast.+(lg)e?. ([-\w]+)/i],[VENDOR,MODEL,[TYPE,SMARTTV]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[VENDOR,LG],[TYPE,SMARTTV]],[/(apple) ?tv/i],[VENDOR,[MODEL,APPLE+" TV"],[TYPE,SMARTTV]],[/crkey.*devicetype\/chromecast/i],[[MODEL,CHROMECAST+" Third Generation"],[VENDOR,GOOGLE],[TYPE,SMARTTV]],[/crkey.*devicetype\/([^/]*)/i],[[MODEL,/^/,"Chromecast "],[VENDOR,GOOGLE],[TYPE,SMARTTV]],[/fuchsia.*crkey/i],[[MODEL,CHROMECAST+" Nest Hub"],[VENDOR,GOOGLE],[TYPE,SMARTTV]],[/crkey/i],[[MODEL,CHROMECAST],[VENDOR,GOOGLE],[TYPE,SMARTTV]],[/(portaltv)/i],[MODEL,[VENDOR,FACEBOOK],[TYPE,SMARTTV]],[/droid.+aft(\w+)( bui|\))/i],[MODEL,[VENDOR,AMAZON],[TYPE,SMARTTV]],[/(shield \w+ tv)/i],[MODEL,[VENDOR,NVIDIA],[TYPE,SMARTTV]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[MODEL,[VENDOR,SHARP],[TYPE,SMARTTV]],[/(bravia[\w ]+)( bui|\))/i],[MODEL,[VENDOR,SONY],[TYPE,SMARTTV]],[/(mi(tv|box)-?\w+) bui/i],[MODEL,[VENDOR,XIAOMI],[TYPE,SMARTTV]],[/Hbbtv.*(technisat) (.*);/i],[VENDOR,MODEL,[TYPE,SMARTTV]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[VENDOR,/.+\/(\w+)/,"$1",strMapper,{LG:"lge"}],[MODEL,trim],[TYPE,SMARTTV]],[/(playstation \w+)/i],[MODEL,[VENDOR,SONY],[TYPE,CONSOLE]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[MODEL,[VENDOR,MICROSOFT],[TYPE,CONSOLE]],[/(ouya)/i,/(nintendo) (\w+)/i,/(retroid) (pocket ([^\)]+))/i,/(valve).+(steam deck)/i,/droid.+; ((shield|rgcube|gr0006))( bui|\))/i],[[VENDOR,strMapper,{Nvidia:"Shield",Anbernic:"RGCUBE",Logitech:"GR0006"}],MODEL,[TYPE,CONSOLE]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[MODEL,[VENDOR,SAMSUNG],[TYPE,WEARABLE]],[/((pebble))app/i,/(asus|google|lg|oppo|xiaomi) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[VENDOR,MODEL,[TYPE,WEARABLE]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[MODEL,[VENDOR,OPPO],[TYPE,WEARABLE]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[MODEL,[VENDOR,APPLE],[TYPE,WEARABLE]],[/(opwwe\d{3})/i],[MODEL,[VENDOR,ONEPLUS],[TYPE,WEARABLE]],[/(moto 360)/i],[MODEL,[VENDOR,MOTOROLA],[TYPE,WEARABLE]],[/(smartwatch 3)/i],[MODEL,[VENDOR,SONY],[TYPE,WEARABLE]],[/(g watch r)/i],[MODEL,[VENDOR,LG],[TYPE,WEARABLE]],[/droid.+; (wt63?0{2,3})\)/i],[MODEL,[VENDOR,ZEBRA],[TYPE,WEARABLE]],[/droid.+; (glass) \d/i],[MODEL,[VENDOR,GOOGLE],[TYPE,XR]],[/(pico) ([\w ]+) os\d/i],[VENDOR,MODEL,[TYPE,XR]],[/(quest( \d| pro)?s?).+vr/i],[MODEL,[VENDOR,FACEBOOK],[TYPE,XR]],[/mobile vr; rv.+firefox/i],[[TYPE,XR]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[VENDOR,[TYPE,EMBEDDED]],[/(aeobc)\b/i],[MODEL,[VENDOR,AMAZON],[TYPE,EMBEDDED]],[/(homepod).+mac os/i],[MODEL,[VENDOR,APPLE],[TYPE,EMBEDDED]],[/windows iot/i],[[TYPE,EMBEDDED]],[/droid.+; ([\w- ]+) (4k|android|smart|google)[- ]?tv/i],[MODEL,[TYPE,SMARTTV]],[/\b((4k|android|smart|opera)[- ]?tv|tv; rv:|large screen[\w ]+safari)\b/i],[[TYPE,SMARTTV]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew|; hmsc).+?(mobile|vr|\d) safari/i],[MODEL,[TYPE,strMapper,{mobile:"Mobile",xr:"VR","*":TABLET}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[TYPE,TABLET]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[TYPE,MOBILE]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[MODEL,[VENDOR,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[VERSION,[NAME,EDGE+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[NAME,VERSION],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[VERSION,[NAME,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[NAME,VERSION],[/ladybird\//i],[[NAME,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[VERSION,NAME]],os:[[/(windows nt) (6\.[23]); arm/i],[[NAME,/N/,"R"],[VERSION,strMapper,windowsVersionMap]],[/(windows (?:phone|mobile|iot))(?: os)?[\/ ]?([\d\.]*( se)?)/i,/(windows)[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i],[NAME,VERSION],[/windows nt ?([\d\.\)]*)(?!.+xbox)/i,/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i],[[VERSION,/(;|\))/g,"",strMapper,windowsVersionMap],[NAME,WINDOWS]],[/(windows ce)\/?([\d\.]*)/i],[NAME,VERSION],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv|ios(?=.+ip(?:ad|hone)|.+apple ?tv)|ip(?:ad|hone)(?: |.+i(?:pad)?)os|apple ?tv.+ios)[\/ ]([\w\.]+)/i,/\btvos ?([\w\.]+)/i,/cfnetwork\/.+darwin/i],[[VERSION,/_/g,"."],[NAME,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i],[[NAME,"macOS"],[VERSION,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[VERSION,[NAME,CHROMECAST+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[VERSION,[NAME,CHROMECAST+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[VERSION,[NAME,CHROMECAST+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[VERSION,[NAME,CHROMECAST+" Linux"]],[/crkey\/([\d\.]+)/i],[VERSION,[NAME,CHROMECAST]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[VERSION,NAME],[/(ubuntu) ([\w\.]+) like android/i],[[NAME,/(.+)/,"$1 Touch"],VERSION],[/(harmonyos)[\/ ]?([\d\.]*)/i,/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i],[NAME,VERSION],[/\(bb(10);/i],[VERSION,[NAME,BLACKBERRY]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[VERSION,[NAME,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[VERSION,[NAME,FIREFOX+" OS"]],[/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i,/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i],[VERSION,[NAME,"webOS"]],[/web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i],[[VERSION,strMapper,{25:"120",24:"108",23:"94",22:"87",6:"79",5:"68",4:"53",3:"38",2:"538",1:"537","*":"TV"}],[NAME,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[VERSION,[NAME,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[NAME,"Chrome OS"],VERSION],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/linux.+(mint)[\/\(\) ]?([\w\.]*)/i,/(mageia|vectorlinux|fuchsia|arcaos|arch(?= ?linux))[;l ]([\d\.]*)/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire|knoppix)(?: gnu[\/ ]linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/\b(aix)[; ]([1-9\.]{0,4})/i,/(hurd|linux|morphos)(?: (?:arm|x86|ppc)\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) ?(r\d)?/i],[NAME,VERSION],[/(sunos) ?([\d\.]*)/i],[[NAME,"Solaris"],VERSION],[/\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[NAME,VERSION]]},defaultProps=(function(){var r={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return setProps.call(r.init,[[BROWSER,[NAME,VERSION,MAJOR,TYPE]],[CPU,[ARCHITECTURE]],[DEVICE,[TYPE,MODEL,VENDOR]],[ENGINE,[NAME,VERSION]],[OS,[NAME,VERSION]]]),setProps.call(r.isIgnore,[[BROWSER,[VERSION,MAJOR]],[ENGINE,[VERSION]],[OS,[VERSION]]]),setProps.call(r.isIgnoreRgx,[[BROWSER,/ ?browser$/i],[OS,/ ?os$/i]]),setProps.call(r.toString,[[BROWSER,[NAME,VERSION]],[CPU,[ARCHITECTURE]],[DEVICE,[VENDOR,MODEL]],[ENGINE,[NAME,VERSION]],[OS,[NAME,VERSION]]]),r})(),createIData=function(r,e){var t=defaultProps.init[e],i=defaultProps.isIgnore[e]||0,s=defaultProps.isIgnoreRgx[e]||0,n=defaultProps.toString[e]||0;function a(){setProps.call(this,t)}return a.prototype.getItem=function(){return r},a.prototype.withClientHints=function(){return NAVIGATOR_UADATA?NAVIGATOR_UADATA.getHighEntropyValues(CH_ALL_VALUES).then(function(o){return r.setCH(new UACHData(o,!1)).parseCH().get()}):r.parseCH().get()},a.prototype.withFeatureCheck=function(){return r.detectFeature().get()},e!=RESULT&&(a.prototype.is=function(o){var c=!1;for(var u in this)if(this.hasOwnProperty(u)&&!has(i,u)&&lowerize(s?strip(s,this[u]):this[u])==lowerize(s?strip(s,o):o)){if(c=!0,o!=TYPEOF.UNDEFINED)break}else if(o==TYPEOF.UNDEFINED&&c){c=!c;break}return c},a.prototype.toString=function(){var o=EMPTY;for(var c in n)typeof this[n[c]]!==TYPEOF.UNDEFINED&&(o+=(o?" ":EMPTY)+this[n[c]]);return o||TYPEOF.UNDEFINED}),a.prototype.then=function(o){var c=this,u=function(){for(var d in c)c.hasOwnProperty(d)&&(this[d]=c[d])};u.prototype={is:a.prototype.is,toString:a.prototype.toString,withClientHints:a.prototype.withClientHints,withFeatureCheck:a.prototype.withFeatureCheck};var f=new u;return o(f),f},new a};function UACHData(r,e){if(r=r||{},setProps.call(this,CH_ALL_VALUES),e)setProps.call(this,[[BRANDS,itemListToArray(r[CH])],[FULLVERLIST,itemListToArray(r[CH_FULL_VER_LIST])],[MOBILE,/\?1/.test(r[CH_MOBILE])],[MODEL,stripQuotes(r[CH_MODEL])],[PLATFORM,stripQuotes(r[CH_PLATFORM])],[PLATFORMVER,stripQuotes(r[CH_PLATFORM_VER])],[ARCHITECTURE,stripQuotes(r[CH_ARCH])],[FORMFACTORS,itemListToArray(r[CH_FORM_FACTORS])],[BITNESS,stripQuotes(r[CH_BITNESS])]]);else for(var t in r)this.hasOwnProperty(t)&&typeof r[t]!==TYPEOF.UNDEFINED&&(this[t]=r[t])}function UAItem(r,e,t,i){return setProps.call(this,[["itemType",r],["ua",e],["uaCH",i],["rgxMap",t],["data",createIData(this,r)]]),this}UAItem.prototype.get=function(r){return r?this.data.hasOwnProperty(r)?this.data[r]:void 0:this.data},UAItem.prototype.set=function(r,e){return this.data[r]=e,this},UAItem.prototype.setCH=function(r){return this.uaCH=r,this},UAItem.prototype.detectFeature=function(){if(NAVIGATOR&&NAVIGATOR.userAgent==this.ua)switch(this.itemType){case BROWSER:NAVIGATOR.brave&&typeof NAVIGATOR.brave.isBrave==TYPEOF.FUNCTION&&this.set(NAME,"Brave");break;case DEVICE:!this.get(TYPE)&&NAVIGATOR_UADATA&&NAVIGATOR_UADATA[MOBILE]&&this.set(TYPE,MOBILE),this.get(MODEL)=="Macintosh"&&NAVIGATOR&&typeof NAVIGATOR.standalone!==TYPEOF.UNDEFINED&&NAVIGATOR.maxTouchPoints&&NAVIGATOR.maxTouchPoints>2&&this.set(MODEL,"iPad").set(TYPE,TABLET);break;case OS:!this.get(NAME)&&NAVIGATOR_UADATA&&NAVIGATOR_UADATA[PLATFORM]&&this.set(NAME,NAVIGATOR_UADATA[PLATFORM]);break;case RESULT:var r=this.data,e=function(t){return r[t].getItem().detectFeature().get()};this.set(BROWSER,e(BROWSER)).set(CPU,e(CPU)).set(DEVICE,e(DEVICE)).set(ENGINE,e(ENGINE)).set(OS,e(OS))}return this},UAItem.prototype.parseUA=function(){switch(this.itemType!=RESULT&&rgxMapper.call(this.data,this.ua,this.rgxMap),this.itemType){case BROWSER:this.set(MAJOR,majorize(this.get(VERSION)));break;case OS:if(this.get(NAME)=="iOS"&&this.get(VERSION)=="18.6"){var r=/\) Version\/([\d\.]+)/.exec(this.ua);r&&parseInt(r[1].substring(0,2),10)>=26&&this.set(VERSION,r[1])}break}return this},UAItem.prototype.parseCH=function(){var r=this.uaCH,e=this.rgxMap;switch(this.itemType){case BROWSER:case ENGINE:var t=r[FULLVERLIST]||r[BRANDS],i;if(t)for(var s=0;s<t.length;s++){var n=t[s].brand||t[s],a=t[s].version;this.itemType==BROWSER&&!/not.a.brand/i.test(n)&&(!i||/Chrom/.test(i)&&n!=CHROMIUM||i==EDGE&&/WebView2/.test(n))&&(n=strMapper(n,browserHintsMap),i=this.get(NAME),i&&!/Chrom/.test(i)&&/Chrom/.test(n)||this.set(NAME,n).set(VERSION,a).set(MAJOR,majorize(a)),i=n),this.itemType==ENGINE&&n==CHROMIUM&&this.set(VERSION,a)}break;case CPU:var o=r[ARCHITECTURE];o&&(o&&r[BITNESS]=="64"&&(o+="64"),rgxMapper.call(this.data,o+";",e));break;case DEVICE:if(r[MOBILE]&&this.set(TYPE,MOBILE),r[MODEL]&&(this.set(MODEL,r[MODEL]),!this.get(TYPE)||!this.get(VENDOR))){var c={};rgxMapper.call(c,"droid 9; "+r[MODEL]+")",e),!this.get(TYPE)&&c.type&&this.set(TYPE,c.type),!this.get(VENDOR)&&c.vendor&&this.set(VENDOR,c.vendor)}if(r[FORMFACTORS]){var u;if(typeof r[FORMFACTORS]!="string")for(var f=0;!u&&f<r[FORMFACTORS].length;)u=strMapper(r[FORMFACTORS][f++],formFactorsMap);else u=strMapper(r[FORMFACTORS],formFactorsMap);this.set(TYPE,u)}break;case OS:var d=r[PLATFORM];if(d){var g=r[PLATFORMVER];d==WINDOWS&&(g=parseInt(majorize(g),10)>=13?"11":"10"),this.set(NAME,d).set(VERSION,g)}this.get(NAME)==WINDOWS&&r[MODEL]=="Xbox"&&this.set(NAME,"Xbox").set(VERSION,void 0);break;case RESULT:var E=this.data,m=function(T){return E[T].getItem().setCH(r).parseCH().get()};this.set(BROWSER,m(BROWSER)).set(CPU,m(CPU)).set(DEVICE,m(DEVICE)).set(ENGINE,m(ENGINE)).set(OS,m(OS))}return this};function UAParser(r,e,t){if(typeof r===TYPEOF.OBJECT?(isExtensions(r,!0)?(typeof e===TYPEOF.OBJECT&&(t=e),e=r):(t=r,e=void 0),r=void 0):typeof r===TYPEOF.STRING&&!isExtensions(e,!0)&&(t=e,e=void 0),t)if(typeof t.append===TYPEOF.FUNCTION){var i={};t.forEach(function(f,d){i[String(d).toLowerCase()]=f}),t=i}else{var s={};for(var n in t)t.hasOwnProperty(n)&&(s[String(n).toLowerCase()]=t[n]);t=s}if(!(this instanceof UAParser))return new UAParser(r,e,t).getResult();var a=typeof r===TYPEOF.STRING?r:t&&t[USER_AGENT]?t[USER_AGENT]:NAVIGATOR&&NAVIGATOR.userAgent?NAVIGATOR.userAgent:EMPTY,o=new UACHData(t,!0),c=e?extend(defaultRegexes,e):defaultRegexes,u=function(f){return f==RESULT?function(){return new UAItem(f,a,c,o).set("ua",a).set(BROWSER,this.getBrowser()).set(CPU,this.getCPU()).set(DEVICE,this.getDevice()).set(ENGINE,this.getEngine()).set(OS,this.getOS()).get()}:function(){return new UAItem(f,a,c[f],o).parseUA().get()}};return setProps.call(this,[["getBrowser",u(BROWSER)],["getCPU",u(CPU)],["getDevice",u(DEVICE)],["getEngine",u(ENGINE)],["getOS",u(OS)],["getResult",u(RESULT)],["getUA",function(){return a}],["setUA",function(f){return isString(f)&&(a=trim(f,UA_MAX_LENGTH)),this}]]).setUA(a),this}UAParser.VERSION=LIBVERSION,UAParser.BROWSER=enumerize([NAME,VERSION,MAJOR,TYPE]),UAParser.CPU=enumerize([ARCHITECTURE]),UAParser.DEVICE=enumerize([MODEL,VENDOR,TYPE,CONSOLE,MOBILE,SMARTTV,TABLET,WEARABLE,EMBEDDED]),UAParser.ENGINE=UAParser.OS=enumerize([NAME,VERSION]);function useUserAgent(){const r=new UAParser().getResult().os.name,e=new UAParser().getResult().browser.name,t=new UAParser().getResult().device.type;return{os:{name:r},browser:{name:e},device:{type:t}}}const isFiniteNumber=Number.isFinite||function(r){return typeof r=="number"&&isFinite(r)},isSafeInteger=Number.isSafeInteger||function(r){return typeof r=="number"&&Math.abs(r)<=MAX_SAFE_INTEGER},MAX_SAFE_INTEGER=Number.MAX_SAFE_INTEGER||9007199254740991;let ErrorTypes=(function(r){return r.NETWORK_ERROR="networkError",r.MEDIA_ERROR="mediaError",r.KEY_SYSTEM_ERROR="keySystemError",r.MUX_ERROR="muxError",r.OTHER_ERROR="otherError",r})({}),ErrorDetails=(function(r){return r.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",r.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",r.KEY_SYSTEM_NO_SESSION="keySystemNoSession",r.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",r.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",r.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",r.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",r.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",r.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",r.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",r.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",r.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",r.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",r.MANIFEST_LOAD_ERROR="manifestLoadError",r.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",r.MANIFEST_PARSING_ERROR="manifestParsingError",r.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",r.LEVEL_EMPTY_ERROR="levelEmptyError",r.LEVEL_LOAD_ERROR="levelLoadError",r.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",r.LEVEL_PARSING_ERROR="levelParsingError",r.LEVEL_SWITCH_ERROR="levelSwitchError",r.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",r.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",r.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",r.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",r.FRAG_LOAD_ERROR="fragLoadError",r.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",r.FRAG_DECRYPT_ERROR="fragDecryptError",r.FRAG_PARSING_ERROR="fragParsingError",r.FRAG_GAP="fragGap",r.REMUX_ALLOC_ERROR="remuxAllocError",r.KEY_LOAD_ERROR="keyLoadError",r.KEY_LOAD_TIMEOUT="keyLoadTimeOut",r.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",r.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",r.BUFFER_APPEND_ERROR="bufferAppendError",r.BUFFER_APPENDING_ERROR="bufferAppendingError",r.BUFFER_STALLED_ERROR="bufferStalledError",r.BUFFER_FULL_ERROR="bufferFullError",r.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",r.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",r.ASSET_LIST_LOAD_ERROR="assetListLoadError",r.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",r.ASSET_LIST_PARSING_ERROR="assetListParsingError",r.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",r.INTERNAL_EXCEPTION="internalException",r.INTERNAL_ABORTED="aborted",r.ATTACH_MEDIA_ERROR="attachMediaError",r.UNKNOWN="unknown",r})({}),Events=(function(r){return r.MEDIA_ATTACHING="hlsMediaAttaching",r.MEDIA_ATTACHED="hlsMediaAttached",r.MEDIA_DETACHING="hlsMediaDetaching",r.MEDIA_DETACHED="hlsMediaDetached",r.MEDIA_ENDED="hlsMediaEnded",r.STALL_RESOLVED="hlsStallResolved",r.BUFFER_RESET="hlsBufferReset",r.BUFFER_CODECS="hlsBufferCodecs",r.BUFFER_CREATED="hlsBufferCreated",r.BUFFER_APPENDING="hlsBufferAppending",r.BUFFER_APPENDED="hlsBufferAppended",r.BUFFER_EOS="hlsBufferEos",r.BUFFERED_TO_END="hlsBufferedToEnd",r.BUFFER_FLUSHING="hlsBufferFlushing",r.BUFFER_FLUSHED="hlsBufferFlushed",r.MANIFEST_LOADING="hlsManifestLoading",r.MANIFEST_LOADED="hlsManifestLoaded",r.MANIFEST_PARSED="hlsManifestParsed",r.LEVEL_SWITCHING="hlsLevelSwitching",r.LEVEL_SWITCHED="hlsLevelSwitched",r.LEVEL_LOADING="hlsLevelLoading",r.LEVEL_LOADED="hlsLevelLoaded",r.LEVEL_UPDATED="hlsLevelUpdated",r.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",r.LEVELS_UPDATED="hlsLevelsUpdated",r.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",r.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",r.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",r.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",r.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",r.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",r.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",r.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",r.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",r.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",r.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",r.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",r.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",r.CUES_PARSED="hlsCuesParsed",r.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",r.INIT_PTS_FOUND="hlsInitPtsFound",r.FRAG_LOADING="hlsFragLoading",r.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",r.FRAG_LOADED="hlsFragLoaded",r.FRAG_DECRYPTED="hlsFragDecrypted",r.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",r.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",r.FRAG_PARSING_METADATA="hlsFragParsingMetadata",r.FRAG_PARSED="hlsFragParsed",r.FRAG_BUFFERED="hlsFragBuffered",r.FRAG_CHANGED="hlsFragChanged",r.FPS_DROP="hlsFpsDrop",r.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",r.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",r.ERROR="hlsError",r.DESTROYING="hlsDestroying",r.KEY_LOADING="hlsKeyLoading",r.KEY_LOADED="hlsKeyLoaded",r.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",r.BACK_BUFFER_REACHED="hlsBackBufferReached",r.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",r.ASSET_LIST_LOADING="hlsAssetListLoading",r.ASSET_LIST_LOADED="hlsAssetListLoaded",r.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",r.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",r.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",r.INTERSTITIAL_STARTED="hlsInterstitialStarted",r.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",r.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",r.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",r.INTERSTITIAL_ENDED="hlsInterstitialEnded",r.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",r.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",r.EVENT_CUE_ENTER="hlsEventCueEnter",r})({});var PlaylistContextType={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},PlaylistLevelType={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};class EWMA{constructor(e,t=0,i=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}sample(e,t){const i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class EwmaBandWidthEstimator{constructor(e,t,i,s=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_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new EWMA(e),this.fast_=new EWMA(t),this.defaultTTFB_=s,this.ttfb_=new EWMA(e)}update(e,t){const{slow_:i,fast_:s,ttfb_:n}=this;i.halfLife!==e&&(this.slow_=new EWMA(e,i.getEstimate(),i.getTotalWeight())),s.halfLife!==t&&(this.fast_=new EWMA(t,s.getEstimate(),s.getTotalWeight())),n.halfLife!==e&&(this.ttfb_=new EWMA(e,n.getEstimate(),n.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const i=8*t,s=e/1e3,n=i/s;this.fast_.sample(s,n),this.slow_.sample(s,n)}sampleTTFB(e){const t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,Math.max(e,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_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}function _defineProperty(r,e,t){return(e=_toPropertyKey(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function _extends(){return _extends=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(r[i]=t[i])}return r},_extends.apply(null,arguments)}function ownKeys(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);e&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(r,s).enumerable})),t.push.apply(t,i)}return t}function _objectSpread2(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ownKeys(Object(t),!0).forEach(function(i){_defineProperty(r,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(i){Object.defineProperty(r,i,Object.getOwnPropertyDescriptor(t,i))})}return r}function _toPrimitive(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var i=t.call(r,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function _toPropertyKey(r){var e=_toPrimitive(r,"string");return typeof e=="symbol"?e:e+""}class Logger{constructor(e,t){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;const i=`[${e}]:`;this.trace=noop,this.debug=t.debug.bind(null,i),this.log=t.log.bind(null,i),this.warn=t.warn.bind(null,i),this.info=t.info.bind(null,i),this.error=t.error.bind(null,i)}}const noop=function r(){},fakeLogger={trace:noop,debug:noop,log:noop,warn:noop,info:noop,error:noop};function createLogger(){return _extends({},fakeLogger)}function consolePrintFn(r,e){const t=self.console[r];return t?t.bind(self.console,`${e?"["+e+"] ":""}[${r}] >`):noop}function getLoggerFn(r,e,t){return e[r]?e[r].bind(e):consolePrintFn(r,t)}const exportedLogger=createLogger();function enableLogs(r,e,t){const i=createLogger();if(typeof console=="object"&&r===!0||typeof r=="object"){const s=["debug","log","info","warn","error"];s.forEach(n=>{i[n]=getLoggerFn(n,r,t)});try{i.log(`Debug logs enabled for "${e}" in hls.js version 1.6.15`)}catch{return createLogger()}s.forEach(n=>{exportedLogger[n]=getLoggerFn(n,r)})}else _extends(exportedLogger,i);return i}const logger=exportedLogger;function getMediaSource(r=!0){return typeof self>"u"?void 0:(r||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function isManagedMediaSource(r){return typeof self<"u"&&r===self.ManagedMediaSource}function isCompatibleTrackChange(r,e){const t=Object.keys(r),i=Object.keys(e),s=t.length,n=i.length;return!s||!n||s===n&&!t.some(a=>i.indexOf(a)===-1)}function utf8ArrayToStr(r,e=!1){if(typeof TextDecoder<"u"){const u=new TextDecoder("utf-8").decode(r);if(e){const f=u.indexOf("\0");return f!==-1?u.substring(0,f):u}return u.replace(/\0/g,"")}const t=r.length;let i,s,n,a="",o=0;for(;o<t;){if(i=r[o++],i===0&&e)return a;if(i===0||i===3)continue;switch(i>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:a+=String.fromCharCode(i);break;case 12:case 13:s=r[o++],a+=String.fromCharCode((i&31)<<6|s&63);break;case 14:s=r[o++],n=r[o++],a+=String.fromCharCode((i&15)<<12|(s&63)<<6|(n&63)<<0);break}}return a}function arrayToHex(r){let e="";for(let t=0;t<r.length;t++){let i=r[t].toString(16);i.length<2&&(i="0"+i),e+=i}return e}function hexToArrayBuffer(r){return Uint8Array.from(r.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function getDefaultExportFromCjs(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var urlToolkit={exports:{}},hasRequiredUrlToolkit;function requireUrlToolkit(){return hasRequiredUrlToolkit||(hasRequiredUrlToolkit=1,(function(r,e){(function(t){var i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,s=/^(?=([^\/?#]*))\1([^]*)$/,n=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(c,u,f){if(f=f||{},c=c.trim(),u=u.trim(),!u){if(!f.alwaysNormalize)return c;var d=o.parseURL(c);if(!d)throw new Error("Error trying to parse base URL.");return d.path=o.normalizePath(d.path),o.buildURLFromParts(d)}var g=o.parseURL(u);if(!g)throw new Error("Error trying to parse relative URL.");if(g.scheme)return f.alwaysNormalize?(g.path=o.normalizePath(g.path),o.buildURLFromParts(g)):u;var E=o.parseURL(c);if(!E)throw new Error("Error trying to parse base URL.");if(!E.netLoc&&E.path&&E.path[0]!=="/"){var m=s.exec(E.path);E.netLoc=m[1],E.path=m[2]}E.netLoc&&!E.path&&(E.path="/");var T={scheme:E.scheme,netLoc:g.netLoc,path:null,params:g.params,query:g.query,fragment:g.fragment};if(!g.netLoc&&(T.netLoc=E.netLoc,g.path[0]!=="/"))if(!g.path)T.path=E.path,g.params||(T.params=E.params,g.query||(T.query=E.query));else{var S=E.path,b=S.substring(0,S.lastIndexOf("/")+1)+g.path;T.path=o.normalizePath(b)}return T.path===null&&(T.path=f.alwaysNormalize?o.normalizePath(g.path):g.path),o.buildURLFromParts(T)},parseURL:function(c){var u=i.exec(c);return u?{scheme:u[1]||"",netLoc:u[2]||"",path:u[3]||"",params:u[4]||"",query:u[5]||"",fragment:u[6]||""}:null},normalizePath:function(c){for(c=c.split("").reverse().join("").replace(n,"");c.length!==(c=c.replace(a,"")).length;);return c.split("").reverse().join("")},buildURLFromParts:function(c){return c.scheme+c.netLoc+c.path+c.params+c.query+c.fragment}};r.exports=o})()})(urlToolkit)),urlToolkit.exports}var urlToolkitExports=requireUrlToolkit();class LoadStats{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 ElementaryStreamTypes={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class BaseSegment{constructor(e){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,typeof e=="string"&&(e={url:e}),this.base=e,makeEnumerable(this,"stats")}setByteRange(e,t){const i=e.split("@",2);let s;i.length===1?s=t?.byteRangeEndOffset||0:s=parseInt(i[1]),this._byteRange=[s,parseInt(i[0])+s]}get baseurl(){return this.base.url}get byteRange(){return this._byteRange===null?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return this._streams===null&&(this._streams={[ElementaryStreamTypes.AUDIO]:null,[ElementaryStreamTypes.VIDEO]:null,[ElementaryStreamTypes.AUDIOVIDEO]:null}),this._streams}set elementaryStreams(e){this._streams=e}get hasStats(){return this._stats!==null}get hasStreams(){return this._streams!==null}get stats(){return this._stats===null&&(this._stats=new LoadStats),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=urlToolkitExports.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[ElementaryStreamTypes.AUDIO]=null,e[ElementaryStreamTypes.VIDEO]=null,e[ElementaryStreamTypes.AUDIOVIDEO]=null}}function isMediaFragment(r){return r.sn!=="initSegment"}class Fragment extends BaseSegment{constructor(e,t){super(t),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=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.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,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=e}get byteLength(){if(this.hasStats){const e=this.stats.total;if(e)return e}if(this.byteRange.length){const e=this.byteRange[0],t=this.byteRange[1];if(isFiniteNumber(e)&&isFiniteNumber(t))return t-e}return null}get bitrate(){return this.byteLength?this.byteLength*8/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){var e;const{levelkeys:t}=this;if(!t||t.NONE)return null;if(t.identity)this._decryptdata||(this._decryptdata=t.identity.getDecryptData(this.sn));else if(!((e=this._decryptdata)!=null&&e.keyId)){const i=Object.keys(t);if(i.length===1){const s=this._decryptdata=t[i[0]]||null;s&&(this._decryptdata=s.getDecryptData(this.sn,t))}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;const e=isFiniteNumber(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){var t;const i=Object.keys(this.levelkeys),s=i.length;if(s>1||s===1&&(t=this.levelkeys[i[0]])!=null&&t.encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!isFiniteNumber(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return isMediaFragment(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){const t=this.levelkeys;if(t){var i;const s=t[e];s&&!((i=this._decryptdata)!=null&&i.keyId)&&(this._decryptdata=s.getDecryptData(this.sn,t))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,i,s,n,a=!1){const{elementaryStreams:o}=this,c=o[e];if(!c){o[e]={startPTS:t,endPTS:i,startDTS:s,endDTS:n,partial:a};return}c.startPTS=Math.min(c.startPTS,t),c.endPTS=Math.max(c.endPTS,i),c.startDTS=Math.min(c.startDTS,s),c.endDTS=Math.max(c.endDTS,n)}}class Part extends BaseSegment{constructor(e,t,i,s,n){super(i),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.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=s;const a=e.enumeratedString("BYTERANGE");a&&this.setByteRange(a,n),n&&(this.fragOffset=n.fragOffset+n.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}function getOwnPropertyDescriptorFromPrototypeChain(r,e){const t=Object.getPrototypeOf(r);if(t){const i=Object.getOwnPropertyDescriptor(t,e);return i||getOwnPropertyDescriptorFromPrototypeChain(t,e)}}function makeEnumerable(r,e){const t=getOwnPropertyDescriptorFromPrototypeChain(r,e);t&&(t.enumerable=!0,Object.defineProperty(r,e,t))}const UINT32_MAX$1=Math.pow(2,32)-1,push=[].push,RemuxerTrackIdConfig={video:1,audio:2,id3:3,text:4};function bin2str(r){return String.fromCharCode.apply(null,r)}function readUint16(r,e){const t=r[e]<<8|r[e+1];return t<0?65536+t:t}function readUint32(r,e){const t=readSint32(r,e);return t<0?4294967296+t:t}function readUint64(r,e){let t=readUint32(r,e);return t*=Math.pow(2,32),t+=readUint32(r,e+4),t}function readSint32(r,e){return r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3]}function hasMoofData(r){const e=r.byteLength;for(let t=0;t<e;){const i=readUint32(r,t);if(i>8&&r[t+4]===109&&r[t+5]===111&&r[t+6]===111&&r[t+7]===102)return!0;t=i>1?t+i:e}return!1}function findBox(r,e){const t=[];if(!e.length)return t;const i=r.byteLength;for(let s=0;s<i;){const n=readUint32(r,s),a=bin2str(r.subarray(s+4,s+8)),o=n>1?s+n:i;if(a===e[0])if(e.length===1)t.push(r.subarray(s+8,o));else{const c=findBox(r.subarray(s+8,o),e.slice(1));c.length&&push.apply(t,c)}s=o}return t}function parseSegmentIndex(r){const e=[],t=r[0];let i=8;const s=readUint32(r,i);i+=4;let n=0,a=0;t===0?(n=readUint32(r,i),a=readUint32(r,i+4),i+=8):(n=readUint64(r,i),a=readUint64(r,i+8),i+=16),i+=2;let o=r.length+a;const c=readUint16(r,i);i+=2;for(let u=0;u<c;u++){let f=i;const d=readUint32(r,f);f+=4;const g=d&2147483647;if((d&2147483648)>>>31===1)return logger.warn("SIDX has hierarchical references (not supported)"),null;const m=readUint32(r,f);f+=4,e.push({referenceSize:g,subsegmentDuration:m,info:{duration:m/s,start:o,end:o+g-1}}),o+=g,f+=4,i=f}return{earliestPresentationTime:n,timescale:s,version:t,referencesCount:c,references:e}}function parseInitSegment(r){const e=[],t=findBox(r,["moov","trak"]);for(let s=0;s<t.length;s++){const n=t[s],a=findBox(n,["tkhd"])[0];if(a){let o=a[0];const c=readUint32(a,o===0?12:20),u=findBox(n,["mdia","mdhd"])[0];if(u){o=u[0];const f=readUint32(u,o===0?12:20),d=findBox(n,["mdia","hdlr"])[0];if(d){const g=bin2str(d.subarray(8,12)),E={soun:ElementaryStreamTypes.AUDIO,vide:ElementaryStreamTypes.VIDEO}[g],m=findBox(n,["mdia","minf","stbl","stsd"])[0],T=parseStsd(m);E?(e[c]={timescale:f,type:E,stsd:T},e[E]=_objectSpread2({timescale:f,id:c},T)):e[c]={timescale:f,type:g,stsd:T}}}}}return findBox(r,["moov","mvex","trex"]).forEach(s=>{const n=readUint32(s,4),a=e[n];a&&(a.default={duration:readUint32(s,12),flags:readUint32(s,20)})}),e}function parseStsd(r){const e=r.subarray(8),t=e.subarray(86),i=bin2str(e.subarray(4,8));let s=i,n;const a=i==="enca"||i==="encv";if(a){const u=findBox(e,[i])[0].subarray(i==="enca"?28:78);findBox(u,["sinf"]).forEach(d=>{const g=findBox(d,["schm"])[0];if(g){const E=bin2str(g.subarray(4,8));if(E==="cbcs"||E==="cenc"){const m=findBox(d,["frma"])[0];m&&(s=bin2str(m))}}})}const o=s;switch(s){case"avc1":case"avc2":case"avc3":case"avc4":{const c=findBox(t,["avcC"])[0];c&&c.length>3&&(s+="."+toHex(c[1])+toHex(c[2])+toHex(c[3]),n=parseSupplementalDoViCodec(o==="avc1"?"dva1":"dvav",t));break}case"mp4a":{const c=findBox(e,[i])[0],u=findBox(c.subarray(28),["esds"])[0];if(u&&u.length>7){let f=4;if(u[f++]!==3)break;f=skipBERInteger(u,f),f+=2;const d=u[f++];if(d&128&&(f+=2),d&64&&(f+=u[f++]),u[f++]!==4)break;f=skipBERInteger(u,f);const g=u[f++];if(g===64)s+="."+toHex(g);else break;if(f+=12,u[f++]!==5)break;f=skipBERInteger(u,f);const E=u[f++];let m=(E&248)>>3;m===31&&(m+=1+((E&7)<<3)+((u[f]&224)>>5)),s+="."+m}break}case"hvc1":case"hev1":{const c=findBox(t,["hvcC"])[0];if(c&&c.length>12){const u=c[1],f=["","A","B","C"][u>>6],d=u&31,g=readUint32(c,2),E=(u&32)>>5?"H":"L",m=c[12],T=c.subarray(6,12);s+="."+f+d,s+="."+reverse32BitInt(g).toString(16).toUpperCase(),s+="."+E+m;let S="";for(let b=T.length;b--;){const C=T[b];(C||S)&&(S="."+C.toString(16).toUpperCase()+S)}s+=S}n=parseSupplementalDoViCodec(o=="hev1"?"dvhe":"dvh1",t);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{s=parseSupplementalDoViCodec(s,t)||s;break}case"vp09":{const c=findBox(t,["vpcC"])[0];if(c&&c.length>6){const u=c[4],f=c[5],d=c[6]>>4&15;s+="."+addLeadingZero(u)+"."+addLeadingZero(f)+"."+addLeadingZero(d)}break}case"av01":{const c=findBox(t,["av1C"])[0];if(c&&c.length>2){const u=c[1]>>>5,f=c[1]&31,d=c[2]>>>7?"H":"M",g=(c[2]&64)>>6,E=(c[2]&32)>>5,m=u===2&&g?E?12:10:g?10:8,T=(c[2]&16)>>4,S=(c[2]&8)>>3,b=(c[2]&4)>>2,C=c[2]&3;s+="."+u+"."+addLeadingZero(f)+d+"."+addLeadingZero(m)+"."+T+"."+S+b+C+"."+addLeadingZero(1)+"."+addLeadingZero(1)+"."+addLeadingZero(1)+"."+0,n=parseSupplementalDoViCodec("dav1",t)}break}}return{codec:s,encrypted:a,supplemental:n}}function parseSupplementalDoViCodec(r,e){const t=findBox(e,["dvvC"]),i=t.length?t[0]:findBox(e,["dvcC"])[0];if(i){const s=i[2]>>1&127,n=i[2]<<5&32|i[3]>>3&31;return r+"."+addLeadingZero(s)+"."+addLeadingZero(n)}}function reverse32BitInt(r){let e=0;for(let t=0;t<32;t++)e|=(r>>t&1)<<31-t;return e>>>0}function skipBERInteger(r,e){const t=e+5;for(;r[e++]&128&&e<t;);return e}function toHex(r){return("0"+r.toString(16).toUpperCase()).slice(-2)}function addLeadingZero(r){return(r<10?"0":"")+r}function patchEncyptionData(r,e){if(!r||!e)return;const t=e.keyId;t&&e.isCommonEncryption&&applyToTencBoxes(r,(i,s)=>{const n=i.subarray(8,24);n.some(a=>a!==0)||(logger.log(`[eme] Patching keyId in 'enc${s?"a":"v"}>sinf>>tenc' box: ${arrayToHex(n)} -> ${arrayToHex(t)}`),i.set(t,8))})}function parseKeyIdsFromTenc(r){const e=[];return applyToTencBoxes(r,t=>e.push(t.subarray(8,24))),e}function applyToTencBoxes(r,e){findBox(r,["moov","trak"]).forEach(i=>{const s=findBox(i,["mdia","minf","stbl","stsd"])[0];if(!s)return;const n=s.subarray(8);let a=findBox(n,["enca"]);const o=a.length>0;o||(a=findBox(n,["encv"])),a.forEach(c=>{const u=o?c.subarray(28):c.subarray(78);findBox(u,["sinf"]).forEach(d=>{const g=parseSinf(d);g&&e(g,o)})})})}function parseSinf(r){const e=findBox(r,["schm"])[0];if(e){const t=bin2str(e.subarray(4,8));if(t==="cbcs"||t==="cenc"){const i=findBox(r,["schi","tenc"])[0];if(i)return i}}}function getSampleData(r,e,t){const i={},s=findBox(r,["moof","traf"]);for(let n=0;n<s.length;n++){const a=s[n],o=findBox(a,["tfhd"])[0],c=readUint32(o,4),u=e[c];if(!u)continue;i[c]||(i[c]={start:NaN,duration:0,sampleCount:0,timescale:u.timescale,type:u.type});const f=i[c],d=findBox(a,["tfdt"])[0];if(d){const I=d[0];let L=readUint32(d,4);I===1&&(L===UINT32_MAX$1?t.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(L*=UINT32_MAX$1+1,L+=readUint32(d,8))),isFiniteNumber(L)&&(!isFiniteNumber(f.start)||L<f.start)&&(f.start=L)}const g=u.default,E=readUint32(o,0)|g?.flags;let m=g?.duration||0;E&8&&(E&2?m=readUint32(o,12):m=readUint32(o,8));const T=findBox(a,["trun"]);let S=f.start||0,b=0,C=m;for(let I=0;I<T.length;I++){const L=T[I],k=readUint32(L,4),U=f.sampleCount;f.sampleCount+=k;const O=L[3]&1,F=L[3]&4,G=L[2]&1,x=L[2]&2,$=L[2]&4,X=L[2]&8;let Q=8,ee=k;for(O&&(Q+=4),F&&k&&(!(L[Q+1]&1)&&f.keyFrameIndex===void 0&&(f.keyFrameIndex=U),Q+=4,G?(C=readUint32(L,Q),Q+=4):C=m,x&&(Q+=4),X&&(Q+=4),S+=C,b+=C,ee--);ee--;)G?(C=readUint32(L,Q),Q+=4):C=m,x&&(Q+=4),$&&(L[Q+1]&1||f.keyFrameIndex===void 0&&(f.keyFrameIndex=f.sampleCount-(ee+1),f.keyFrameStart=S),Q+=4),X&&(Q+=4),S+=C,b+=C;!b&&m&&(b+=m*k)}f.duration+=b}if(!Object.keys(i).some(n=>i[n].duration)){let n=1/0,a=0;const o=findBox(r,["sidx"]);for(let c=0;c<o.length;c++){const u=parseSegmentIndex(o[c]);if(u!=null&&u.references){n=Math.min(n,u.earliestPresentationTime/u.timescale);const f=u.references.reduce((d,g)=>d+g.info.duration||0,0);a=Math.max(a,f+u.earliestPresentationTime/u.timescale)}}a&&isFiniteNumber(a)&&Object.keys(i).forEach(c=>{i[c].duration||(i[c].duration=a*i[c].timescale-i[c].start)})}return i}function segmentValidRange(r){const e={valid:null,remainder:null},t=findBox(r,["moof"]);if(t.length<2)return e.remainder=r,e;const i=t[t.length-1];return e.valid=r.slice(0,i.byteOffset-8),e.remainder=r.slice(i.byteOffset-8),e}function appendUint8Array(r,e){const t=new Uint8Array(r.length+e.length);return t.set(r),t.set(e,r.length),t}function parseSamples(r,e){const t=[],i=e.samples,s=e.timescale,n=e.id;let a=!1;return findBox(i,["moof"]).map(c=>{const u=c.byteOffset-8;findBox(c,["traf"]).map(d=>{const g=findBox(d,["tfdt"]).map(E=>{const m=E[0];let T=readUint32(E,4);return m===1&&(T*=Math.pow(2,32),T+=readUint32(E,8)),T/s})[0];return g!==void 0&&(r=g),findBox(d,["tfhd"]).map(E=>{const m=readUint32(E,4),T=readUint32(E,0)&16777215,S=(T&1)!==0,b=(T&2)!==0,C=(T&8)!==0;let I=0;const L=(T&16)!==0;let k=0;const U=(T&32)!==0;let O=8;m===n&&(S&&(O+=8),b&&(O+=4),C&&(I=readUint32(E,O),O+=4),L&&(k=readUint32(E,O),O+=4),U&&(O+=4),e.type==="video"&&(a=isHEVC(e.codec)),findBox(d,["trun"]).map(F=>{const G=F[0],x=readUint32(F,0)&16777215,$=(x&1)!==0;let X=0;const Q=(x&4)!==0,ee=(x&256)!==0;let te=0;const re=(x&512)!==0;let me=0;const H=(x&1024)!==0,z=(x&2048)!==0;let ie=0;const ne=readUint32(F,4);let he=8;$&&(X=readUint32(F,he),he+=4),Q&&(he+=4);let pe=X+u;for(let Pe=0;Pe<ne;Pe++){if(ee?(te=readUint32(F,he),he+=4):te=I,re?(me=readUint32(F,he),he+=4):me=k,H&&(he+=4),z&&(G===0?ie=readUint32(F,he):ie=readSint32(F,he),he+=4),e.type===ElementaryStreamTypes.VIDEO){let ae=0;for(;ae<me;){const Ae=readUint32(i,pe);if(pe+=4,isSEIMessage(a,i[pe])){const Re=i.subarray(pe,pe+Ae);parseSEIMessageFromNALu(Re,a?2:1,r+ie/s,t)}pe+=Ae,ae+=Ae+4}}r+=te/s}}))})})}),t}function isHEVC(r){if(!r)return!1;const e=r.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function isSEIMessage(r,e){if(r){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function parseSEIMessageFromNALu(r,e,t,i){const s=discardEPB(r);let n=0;n+=e;let a=0,o=0,c=0;for(;n<s.length;){a=0;do{if(n>=s.length)break;c=s[n++],a+=c}while(c===255);o=0;do{if(n>=s.length)break;c=s[n++],o+=c}while(c===255);const u=s.length-n;let f=n;if(o<u)n+=o;else if(o>u){logger.error(`Malformed SEI payload. ${o} is too small, only ${u} bytes left to parse.`);break}if(a===4){if(s[f++]===181){const g=readUint16(s,f);if(f+=2,g===49){const E=readUint32(s,f);if(f+=4,E===1195456820){const m=s[f++];if(m===3){const T=s[f++],S=31&T,b=64&T,C=b?2+S*3:0,I=new Uint8Array(C);if(b){I[0]=T;for(let L=1;L<C;L++)I[L]=s[f++]}i.push({type:m,payloadType:a,pts:t,bytes:I})}}}}}else if(a===5&&o>16){const d=[];for(let m=0;m<16;m++){const T=s[f++].toString(16);d.push(T.length==1?"0"+T:T),(m===3||m===5||m===7||m===9)&&d.push("-")}const g=o-16,E=new Uint8Array(g);for(let m=0;m<g;m++)E[m]=s[f++];i.push({payloadType:a,pts:t,uuid:d.join(""),userData:utf8ArrayToStr(E),userDataBytes:E})}}}function discardEPB(r){const e=r.byteLength,t=[];let i=1;for(;i<e-2;)r[i]===0&&r[i+1]===0&&r[i+2]===3?(t.push(i+2),i+=2):i++;if(t.length===0)return r;const s=e-t.length,n=new Uint8Array(s);let a=0;for(i=0;i<s;a++,i++)a===t[0]&&(a++,t.shift()),n[i]=r[a];return n}function parseEmsg(r){const e=r[0];let t="",i="",s=0,n=0,a=0,o=0,c=0,u=0;if(e===0){for(;bin2str(r.subarray(u,u+1))!=="\0";)t+=bin2str(r.subarray(u,u+1)),u+=1;for(t+=bin2str(r.subarray(u,u+1)),u+=1;bin2str(r.subarray(u,u+1))!=="\0";)i+=bin2str(r.subarray(u,u+1)),u+=1;i+=bin2str(r.subarray(u,u+1)),u+=1,s=readUint32(r,12),n=readUint32(r,16),o=readUint32(r,20),c=readUint32(r,24),u=28}else if(e===1){u+=4,s=readUint32(r,u),u+=4;const d=readUint32(r,u);u+=4;const g=readUint32(r,u);for(u+=4,a=2**32*d+g,isSafeInteger(a)||(a=Number.MAX_SAFE_INTEGER,logger.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=readUint32(r,u),u+=4,c=readUint32(r,u),u+=4;bin2str(r.subarray(u,u+1))!=="\0";)t+=bin2str(r.subarray(u,u+1)),u+=1;for(t+=bin2str(r.subarray(u,u+1)),u+=1;bin2str(r.subarray(u,u+1))!=="\0";)i+=bin2str(r.subarray(u,u+1)),u+=1;i+=bin2str(r.subarray(u,u+1)),u+=1}const f=r.subarray(u,r.byteLength);return{schemeIdUri:t,value:i,timeScale:s,presentationTime:a,presentationTimeDelta:n,eventDuration:o,id:c,payload:f}}function mp4Box(r,...e){const t=e.length;let i=8,s=t;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]=i&255,n.set(r,4),s=0,i=8;s<t;s++)n.set(e[s],i),i+=e[s].byteLength;return n}function mp4pssh(r,e,t){if(r.byteLength!==16)throw new RangeError("Invalid system id");let i,s;i=0,s=new Uint8Array;let n;i>0?(n=new Uint8Array(4),e.length>0&&new DataView(n.buffer).setUint32(0,e.length,!1)):n=new Uint8Array;const a=new Uint8Array(4);return t.byteLength>0&&new DataView(a.buffer).setUint32(0,t.byteLength,!1),mp4Box([112,115,115,104],new Uint8Array([i,0,0,0]),r,n,s,a,t)}function parseMultiPssh(r){const e=[];if(r instanceof ArrayBuffer){const t=r.byteLength;let i=0;for(;i+32<t;){const s=new DataView(r,i),n=parsePssh(s);e.push(n),i+=n.size}}return e}function parsePssh(r){const e=r.getUint32(0),t=r.byteOffset,i=r.byteLength;if(i<e)return{offset:t,size:i};if(r.getUint32(4)!==1886614376)return{offset:t,size:e};const n=r.getUint32(8)>>>24;if(n!==0&&n!==1)return{offset:t,size:e};const a=r.buffer,o=arrayToHex(new Uint8Array(a,t+12,16));let c=null,u=null,f=0;if(n===0)f=28;else{const g=r.getUint32(28);if(!g||i<32+g*16)return{offset:t,size:e};c=[];for(let E=0;E<g;E++)c.push(new Uint8Array(a,t+32+E*16,16));f=32+g*16}if(!f)return{offset:t,size:e};const d=r.getUint32(f);return e-32<d?{offset:t,size:e}:(u=new Uint8Array(a,t+f+4,d),{version:n,systemId:o,kids:c,data:u,offset:t,size:e})}const userAgentHevcSupportIsInaccurate=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),sampleEntryCodesISO={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,dav1:.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 isCodecType(r,e){const t=sampleEntryCodesISO[e];return!!t&&!!t[r.slice(0,4)]}function areCodecsMediaSourceSupported(r,e,t=!0){return!r.split(",").some(i=>!isCodecMediaSourceSupported(i,e,t))}function isCodecMediaSourceSupported(r,e,t=!0){var i;const s=getMediaSource(t);return(i=s?.isTypeSupported(mimeTypeForCodec(r,e)))!=null?i:!1}function mimeTypeForCodec(r,e){return`${e}/mp4;codecs=${r}`}function videoCodecPreferenceValue(r){if(r){const e=r.substring(0,4);return sampleEntryCodesISO.video[e]}return 2}function codecsSetSelectionPreferenceValue(r){const e=userAgentHevcSupportIsInaccurate();return r.split(",").reduce((t,i)=>{const n=e&&isHEVC(i)?9:sampleEntryCodesISO.video[i];return n?(n*2+t)/(t?3:2):(sampleEntryCodesISO.audio[i]+t)/(t?2:1)},0)}const CODEC_COMPATIBLE_NAMES={};function getCodecCompatibleNameLower(r,e=!0){if(CODEC_COMPATIBLE_NAMES[r])return CODEC_COMPATIBLE_NAMES[r];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[r];for(let s=0;s<t.length;s++){var i;if(isCodecMediaSourceSupported(t[s],"audio",e))return CODEC_COMPATIBLE_NAMES[r]=t[s],t[s];if(t[s]==="mp3"&&(i=getMediaSource(e))!=null&&i.isTypeSupported("audio/mpeg"))return""}return r}const AUDIO_CODEC_REGEXP=/flac|opus|mp4a\.40\.34/i;function getCodecCompatibleName(r,e=!0){return r.replace(AUDIO_CODEC_REGEXP,t=>getCodecCompatibleNameLower(t.toLowerCase(),e))}function replaceVideoCodec(r,e){const t=[];if(r){const i=r.split(",");for(let s=0;s<i.length;s++)isCodecType(i[s],"video")||t.push(i[s])}return e&&t.push(e),t.join(",")}function pickMostCompleteCodecName(r,e){if(r&&(r.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(r)!==-1)&&(isCodecSupportedAsType(r,"audio")||isCodecSupportedAsType(r,"video")))return r;if(e){const t=e.split(",");if(t.length>1){if(r){for(let i=t.length;i--;)if(t[i].substring(0,4)===r.substring(0,4))return t[i]}return t[0]}}return e||r}function isCodecSupportedAsType(r,e){return isCodecType(r,e)&&isCodecMediaSourceSupported(r,e)}function convertAVC1ToAVCOTI(r){const e=r.split(",");for(let t=0;t<e.length;t++){const i=e[t].split(".");i.length>2&&i[0]==="avc1"&&(e[t]=`avc1.${parseInt(i[1]).toString(16)}${("000"+parseInt(i[2]).toString(16)).slice(-4)}`)}return e.join(",")}function fillInMissingAV01Params(r){if(r.startsWith("av01.")){const e=r.split("."),t=["0","111","01","01","01","0"];for(let i=e.length;i>4&&i<10;i++)e[i]=t[i-4];return e.join(".")}return r}function getM2TSSupportedAudioTypes(r){const e=getMediaSource(r)||{isTypeSupported:()=>!1};return{mpeg:e.isTypeSupported("audio/mpeg"),mp3:e.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:e.isTypeSupported('audio/mp4; codecs="ac-3"')}}function getCodecsForMimeType(r){return r.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const supportedResult={supported:!0,powerEfficient:!0,smooth:!0},unsupportedResult={supported:!1,smooth:!1,powerEfficient:!1},SUPPORTED_INFO_DEFAULT={supported:!0,configurations:[],decodingInfoResults:[supportedResult]};function getUnsupportedResult(r,e){return{supported:!1,configurations:e,decodingInfoResults:[unsupportedResult],error:r}}function requiresMediaCapabilitiesDecodingInfo(r,e,t,i,s,n){const a=r.videoCodec,o=r.audioCodec?r.audioGroups:null,c=n?.audioCodec,u=n?.channels,f=u?parseInt(u):c?1/0:2;let d=null;if(o!=null&&o.length)try{o.length===1&&o[0]?d=e.groups[o[0]].channels:d=o.reduce((g,E)=>{if(E){const m=e.groups[E];if(!m)throw new Error(`Audio track group ${E} not found`);Object.keys(m.channels).forEach(T=>{g[T]=(g[T]||0)+m.channels[T]})}return g},{2:0})}catch{return!0}return a!==void 0&&(a.split(",").some(g=>isHEVC(g))||r.width>1920&&r.height>1088||r.height>1920&&r.width>1088||r.frameRate>Math.max(i,30)||r.videoRange!=="SDR"&&r.videoRange!==t||r.bitrate>Math.max(s,8e6))||!!d&&isFiniteNumber(f)&&Object.keys(d).some(g=>parseInt(g)>f)}function getMediaDecodingInfoPromise(r,e,t,i={}){const s=r.videoCodec;if(!s&&!r.audioCodec||!t)return Promise.resolve(SUPPORTED_INFO_DEFAULT);const n=[],a=makeVideoConfigurations(r),o=a.length,c=makeAudioConfigurations(r,e,o>0),u=c.length;for(let f=o||1*u||1;f--;){const d={type:"media-source"};if(o&&(d.video=a[f%o]),u){d.audio=c[f%u];const g=d.audio.bitrate;d.video&&g&&(d.video.bitrate-=g)}n.push(d)}if(s){const f=navigator.userAgent;if(s.split(",").some(d=>isHEVC(d))&&userAgentHevcSupportIsInaccurate())return Promise.resolve(getUnsupportedResult(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${f})`),n))}return Promise.all(n.map(f=>{const d=getMediaDecodingInfoKey(f);return i[d]||(i[d]=t.decodingInfo(f))})).then(f=>({supported:!f.some(d=>!d.supported),configurations:n,decodingInfoResults:f})).catch(f=>({supported:!1,configurations:n,decodingInfoResults:[],error:f}))}function makeVideoConfigurations(r){var e;const t=(e=r.videoCodec)==null?void 0:e.split(","),i=getVariantDecodingBitrate(r),s=r.width||640,n=r.height||480,a=r.frameRate||30,o=r.videoRange.toLowerCase();return t?t.map(c=>{const u={contentType:mimeTypeForCodec(fillInMissingAV01Params(c),"video"),width:s,height:n,bitrate:i,framerate:a};return o!=="sdr"&&(u.transferFunction=o),u}):[]}function makeAudioConfigurations(r,e,t){var i;const s=(i=r.audioCodec)==null?void 0:i.split(","),n=getVariantDecodingBitrate(r);return s&&r.audioGroups?r.audioGroups.reduce((a,o)=>{var c;const u=o?(c=e.groups[o])==null?void 0:c.tracks:null;return u?u.reduce((f,d)=>{if(d.groupId===o){const g=parseFloat(d.channels||"");s.forEach(E=>{const m={contentType:mimeTypeForCodec(E,"audio"),bitrate:t?estimatedAudioBitrate(E,n):n};g&&(m.channels=""+g),f.push(m)})}return f},a):a},[]):[]}function estimatedAudioBitrate(r,e){if(e<=1)return 1;let t=128e3;return r==="ec-3"?t=768e3:r==="ac-3"&&(t=64e4),Math.min(e/2,t)}function getVariantDecodingBitrate(r){return Math.ceil(Math.max(r.bitrate*.9,r.averageBitrate)/1e3)*1e3||1}function getMediaDecodingInfoKey(r){let e="";const{audio:t,video:i}=r;if(i){const s=getCodecsForMimeType(i.contentType);e+=`${s}_r${i.height}x${i.width}f${Math.ceil(i.framerate)}${i.transferFunction||"sd"}_${Math.ceil(i.bitrate/1e5)}`}if(t){const s=getCodecsForMimeType(t.contentType);e+=`${i?"_":""}${s}_c${t.channels}`}return e}const HdcpLevels=["NONE","TYPE-0","TYPE-1",null];function isHdcpLevel(r){return HdcpLevels.indexOf(r)>-1}const VideoRangeValues=["SDR","PQ","HLG"];function isVideoRange(r){return!!r&&VideoRangeValues.indexOf(r)>-1}var HlsSkip={No:"",Yes:"YES",v2:"v2"};function getSkipValue(r){const{canSkipUntil:e,canSkipDateRanges:t,age:i}=r,s=i<e/2;return e&&s?t?HlsSkip.v2:HlsSkip.Yes:HlsSkip.No}class HlsUrlParameters{constructor(e,t,i){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=i}addDirectives(e){const t=new self.URL(e);return this.msn!==void 0&&t.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}class Level{constructor(e){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter(i=>!!i).map(i=>i.substring(0,4)).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;const i=(t=e.supplemental)==null?void 0:t.videoCodec;i&&i!==e.videoCodec&&(this.codecSet+=`,${i.substring(0,4)}`)}this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.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(e){return hasGroup(this._audioGroups,e)}hasSubtitleGroup(e){return hasGroup(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let i=this._audioGroups;i||(i=this._audioGroups=[]),i.indexOf(t)===-1&&i.push(t)}else if(e==="text"){let i=this._subtitleGroups;i||(i=this._subtitleGroups=[]),i.indexOf(t)===-1&&i.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}}function hasGroup(r,e){return!e||!r?!1:r.indexOf(e)!==-1}function isHdrSupported(){if(typeof matchMedia=="function"){const r=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(r.media!==e.media)return r.matches===!0}return!1}function getVideoSelectionOptions(r,e){let t=!1,i=[];if(r&&(t=r!=="SDR",i=[r]),e){i=e.allowedVideoRanges||VideoRangeValues.slice(0);const s=i.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:s&&isHdrSupported(),t||(i=["SDR"])}return{preferHDR:t,allowedVideoRanges:i}}const omitCircularRefsReplacer=r=>{const e=new WeakSet;return(t,i)=>{if(r&&(i=r(t,i)),typeof i=="object"&&i!==null){if(e.has(i))return;e.add(i)}return i}},stringify=(r,e)=>JSON.stringify(r,omitCircularRefsReplacer(e));function getStartCodecTier(r,e,t,i,s){const n=Object.keys(r),a=i?.channels,o=i?.audioCodec,c=s?.videoCodec,u=a&&parseInt(a)===2;let f=!1,d=!1,g=1/0,E=1/0,m=1/0,T=1/0,S=0,b=[];const{preferHDR:C,allowedVideoRanges:I}=getVideoSelectionOptions(e,s);for(let F=n.length;F--;){const G=r[n[F]];f||(f=G.channels[2]>0),g=Math.min(g,G.minHeight),E=Math.min(E,G.minFramerate),m=Math.min(m,G.minBitrate),I.filter($=>G.videoRanges[$]>0).length>0&&(d=!0)}g=isFiniteNumber(g)?g:0,E=isFiniteNumber(E)?E:0;const L=Math.max(1080,g),k=Math.max(30,E);m=isFiniteNumber(m)?m:t,t=Math.max(m,t),d||(e=void 0);const U=n.length>1;return{codecSet:n.reduce((F,G)=>{const x=r[G];if(G===F)return F;if(b=d?I.filter($=>x.videoRanges[$]>0):[],U){if(x.minBitrate>t)return logStartCodecCandidateIgnored(G,`min bitrate of ${x.minBitrate} > current estimate of ${t}`),F;if(!x.hasDefaultAudio)return logStartCodecCandidateIgnored(G,"no renditions with default or auto-select sound found"),F;if(o&&G.indexOf(o.substring(0,4))%5!==0)return logStartCodecCandidateIgnored(G,`audio codec preference "${o}" not found`),F;if(a&&!u){if(!x.channels[a])return logStartCodecCandidateIgnored(G,`no renditions with ${a} channel sound found (channels options: ${Object.keys(x.channels)})`),F}else if((!o||u)&&f&&x.channels[2]===0)return logStartCodecCandidateIgnored(G,"no renditions with stereo sound found"),F;if(x.minHeight>L)return logStartCodecCandidateIgnored(G,`min resolution of ${x.minHeight} > maximum of ${L}`),F;if(x.minFramerate>k)return logStartCodecCandidateIgnored(G,`min framerate of ${x.minFramerate} > maximum of ${k}`),F;if(!b.some($=>x.videoRanges[$]>0))return logStartCodecCandidateIgnored(G,`no variants with VIDEO-RANGE of ${stringify(b)} found`),F;if(c&&G.indexOf(c.substring(0,4))%5!==0)return logStartCodecCandidateIgnored(G,`video codec preference "${c}" not found`),F;if(x.maxScore<S)return logStartCodecCandidateIgnored(G,`max score of ${x.maxScore} < selected max of ${S}`),F}return F&&(codecsSetSelectionPreferenceValue(G)>=codecsSetSelectionPreferenceValue(F)||x.fragmentError>r[F].fragmentError)?F:(T=x.minIndex,S=x.maxScore,G)},void 0),videoRanges:b,preferHDR:C,minFramerate:E,minBitrate:m,minIndex:T}}function logStartCodecCandidateIgnored(r,e){logger.log(`[abr] start candidates with "${r}" ignored because ${e}`)}function getAudioTracksByGroup(r){return r.reduce((e,t)=>{let i=e.groups[t.groupId];i||(i=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),i.tracks.push(t);const s=t.channels||"2";return i.channels[s]=(i.channels[s]||0)+1,i.hasDefault=i.hasDefault||t.default,i.hasAutoSelect=i.hasAutoSelect||t.autoselect,i.hasDefault&&(e.hasDefaultAudio=!0),i.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function getCodecTiers(r,e,t,i){return r.slice(t,i+1).reduce((s,n,a)=>{if(!n.codecSet)return s;const o=n.audioGroups;let c=s[n.codecSet];c||(s[n.codecSet]=c={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:a,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!o,fragmentError:0}),c.minBitrate=Math.min(c.minBitrate,n.bitrate);const u=Math.min(n.height,n.width);return c.minHeight=Math.min(c.minHeight,u),c.minFramerate=Math.min(c.minFramerate,n.frameRate),c.minIndex=Math.min(c.minIndex,a),c.maxScore=Math.max(c.maxScore,n.score),c.fragmentError+=n.fragmentError,c.videoRanges[n.videoRange]=(c.videoRanges[n.videoRange]||0)+1,o&&o.forEach(f=>{if(!f)return;const d=e.groups[f];d&&(c.hasDefaultAudio=c.hasDefaultAudio||e.hasDefaultAudio?d.hasDefault:d.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(d.channels).forEach(g=>{c.channels[g]=(c.channels[g]||0)+d.channels[g]}))}),s},{})}function getBasicSelectionOption(r){if(!r)return r;const{lang:e,assocLang:t,characteristics:i,channels:s,audioCodec:n}=r;return{lang:e,assocLang:t,characteristics:i,channels:s,audioCodec:n}}function findMatchingOption(r,e,t){if("attrs"in r){const i=e.indexOf(r);if(i!==-1)return i}for(let i=0;i<e.length;i++){const s=e[i];if(matchesOption(r,s,t))return i}return-1}function matchesOption(r,e,t){const{groupId:i,name:s,lang:n,assocLang:a,default:o}=r,c=r.forced;return(i===void 0||e.groupId===i)&&(s===void 0||e.name===s)&&(n===void 0||languagesMatch(n,e.lang))&&(n===void 0||e.assocLang===a)&&(o===void 0||e.default===o)&&(c===void 0||e.forced===c)&&(!("characteristics"in r)||characteristicsMatch(r.characteristics||"",e.characteristics))&&(t===void 0||t(r,e))}function languagesMatch(r,e="--"){return r.length===e.length?r===e:r.startsWith(e)||e.startsWith(r)}function characteristicsMatch(r,e=""){const t=r.split(","),i=e.split(",");return t.length===i.length&&!t.some(s=>i.indexOf(s)===-1)}function audioMatchPredicate(r,e){const{audioCodec:t,channels:i}=r;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(i===void 0||i===(e.channels||"2"))}function findClosestLevelWithAudioGroup(r,e,t,i,s){const n=e[i],o=e.reduce((g,E,m)=>{const T=E.uri;return(g[T]||(g[T]=[])).push(m),g},{})[n.uri];o.length>1&&(i=Math.max.apply(Math,o));const c=n.videoRange,u=n.frameRate,f=n.codecSet.substring(0,4),d=searchDownAndUpList(e,i,g=>{if(g.videoRange!==c||g.frameRate!==u||g.codecSet.substring(0,4)!==f)return!1;const E=g.audioGroups,m=t.filter(T=>!E||E.indexOf(T.groupId)!==-1);return findMatchingOption(r,m,s)>-1});return d>-1?d:searchDownAndUpList(e,i,g=>{const E=g.audioGroups,m=t.filter(T=>!E||E.indexOf(T.groupId)!==-1);return findMatchingOption(r,m,s)>-1})}function searchDownAndUpList(r,e,t){for(let i=e;i>-1;i--)if(t(r[i]))return i;for(let i=e+1;i<r.length;i++)if(t(r[i]))return i;return-1}function useAlternateAudio(r,e){var t;return!!r&&r!==((t=e.loadLevelObj)==null?void 0:t.uri)}class AbrController extends Logger{constructor(e){super("abr",e.logger),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.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=t=>{var i;const{fragCurrent:s,partCurrent:n,hls:a}=this,{autoLevelEnabled:o,media:c}=a;if(!s||!c)return;const u=performance.now(),f=n?n.stats:s.stats,d=n?n.duration:s.duration,g=u-f.loading.start,E=a.minAutoLevel,m=s.level,T=this._nextAutoLevel;if(f.aborted||f.loaded&&f.loaded===f.total||m<=E){this.clearTimer(),this._nextAutoLevel=-1;return}if(!o)return;const S=T>-1&&T!==m,b=!!t||S;if(!b&&(c.paused||!c.playbackRate||!c.readyState))return;const C=a.mainForwardBufferInfo;if(!b&&C===null)return;const I=this.bwEstimator.getEstimateTTFB(),L=Math.abs(c.playbackRate);if(g<=Math.max(I,1e3*(d/(L*2))))return;const k=C?C.len/L:0,U=f.loading.first?f.loading.first-f.loading.start:-1,O=f.loaded&&U>-1,F=this.getBwEstimate(),G=a.levels,x=G[m],$=Math.max(f.loaded,Math.round(d*(s.bitrate||x.averageBitrate)/8));let X=O?g-U:g;X<1&&O&&(X=Math.min(g,f.loaded*8/F));const Q=O?f.loaded*1e3/X:0,ee=I/1e3,te=Q?($-f.loaded)/Q:$*8/F+ee;if(te<=k)return;const re=Q?Q*8:F,me=((i=t?.details||this.hls.latestLevelDetails)==null?void 0:i.live)===!0,H=this.hls.config.abrBandWidthUpFactor;let z=Number.POSITIVE_INFINITY,ie;for(ie=m-1;ie>E;ie--){const Pe=G[ie].maxBitrate,ae=!G[ie].details||me;if(z=this.getTimeToLoadFrag(ee,re,d*Pe,ae),z<Math.min(k,d+ee))break}if(z>=te||z>d*10)return;O?this.bwEstimator.sample(g-Math.min(I,U),f.loaded):this.bwEstimator.sampleTTFB(g);const ne=G[ie].maxBitrate;this.getBwEstimate()*H>ne&&this.resetEstimator(ne);const he=this.findBestLevel(ne,E,ie,0,k,1,1);he>-1&&(ie=he),this.warn(`Fragment ${s.sn}${n?" part "+n.index:""} of level ${m} is loading too slowly;
|
|
279
|
-
Fragment duration: ${s.duration.toFixed(3)}
|
|
280
|
-
Time to underbuffer: ${k.toFixed(3)} s
|
|
281
|
-
Estimated load time for current fragment: ${te.toFixed(3)} s
|
|
282
|
-
Estimated load time for down switch fragment: ${z.toFixed(3)} s
|
|
283
|
-
TTFB estimate: ${U|0} ms
|
|
284
|
-
Current BW estimate: ${isFiniteNumber(F)?F|0:"Unknown"} bps
|
|
285
|
-
New BW estimate: ${this.getBwEstimate()|0} bps
|
|
286
|
-
Switching to level ${ie} @ ${ne|0} bps`),a.nextLoadLevel=a.nextAutoLevel=ie,this.clearTimer();const pe=()=>{if(this.clearTimer(),this.fragCurrent===s&&this.hls.loadLevel===ie&&ie>0){const Pe=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${ie>0?"and switching down":""}
|
|
287
|
-
Fragment duration: ${s.duration.toFixed(3)} s
|
|
288
|
-
Time to underbuffer: ${Pe.toFixed(3)} s`),s.abortRequests(),this.fragCurrent=this.partCurrent=null,ie>E){let ae=this.findBestLevel(this.hls.levels[E].bitrate,E,ie,0,Pe,1,1);ae===-1&&(ae=E),this.hls.nextLoadLevel=this.hls.nextAutoLevel=ae,this.resetEstimator(this.hls.levels[ae].bitrate)}}};S||te>z*2?pe():this.timer=self.setInterval(pe,z*1e3),a.trigger(Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:s,part:n,stats:f})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(this.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const e=this.hls.config;return new EwmaBandWidthEstimator(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Events.FRAG_LOADING,this.onFragLoading,this),e.on(Events.FRAG_LOADED,this.onFragLoaded,this),e.on(Events.FRAG_BUFFERED,this.onFragBuffered,this),e.on(Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(Events.LEVEL_LOADED,this.onLevelLoaded,this),e.on(Events.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(Events.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(Events.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Events.FRAG_LOADING,this.onFragLoading,this),e.off(Events.FRAG_LOADED,this.onFragLoaded,this),e.off(Events.FRAG_BUFFERED,this.onFragBuffered,this),e.off(Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(Events.LEVEL_LOADED,this.onLevelLoaded,this),e.off(Events.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(Events.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(Events.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.supportedCache={},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(e,t){const i=t.frag;if(!this.ignoreFragment(i)){if(!i.bitrateTest){var s;this.fragCurrent=i,this.partCurrent=(s=t.part)!=null?s:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case ErrorDetails.BUFFER_ADD_CODEC_ERROR:case ErrorDetails.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case ErrorDetails.FRAG_LOAD_TIMEOUT:{const i=t.frag,{fragCurrent:s,partCurrent:n}=this;if(i&&s&&i.sn===s.sn&&i.level===s.level){const a=performance.now(),o=n?n.stats:i.stats,c=a-o.loading.start,u=o.loading.first?o.loading.first-o.loading.start:-1;if(o.loaded&&u>-1){const d=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(c-Math.min(d,u),o.loaded)}else this.bwEstimator.sampleTTFB(c)}break}}}getTimeToLoadFrag(e,t,i,s){const n=e+i/t,a=s?e+this.lastLevelLoadSec:0;return n+a}onLevelLoaded(e,t){const i=this.hls.config,{loading:s}=t.stats,n=s.end-s.first;isFiniteNumber(n)&&(this.lastLevelLoadSec=n/1e3),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)}onFragLoaded(e,{frag:t,part:i}){const s=i?i.stats:t.stats;if(t.type===PlaylistLevelType.MAIN&&this.bwEstimator.sampleTTFB(s.loading.first-s.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const n=i?i.duration:t.duration,a=this.hls.levels[t.level],o=(a.loaded?a.loaded.bytes:0)+s.loaded,c=(a.loaded?a.loaded.duration:0)+n;a.loaded={bytes:o,duration:c},a.realBitrate=Math.round(8*o/c)}if(t.bitrateTest){const n={stats:s,frag:t,part:i,id:t.type};this.onFragBuffered(Events.FRAG_BUFFERED,n),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:i,part:s}=t,n=s!=null&&s.stats.loaded?s.stats:i.stats;if(n.aborted||this.ignoreFragment(i))return;const a=n.parsing.end-n.loading.start-Math.min(n.loading.first-n.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(a,n.loaded),n.bwEstimate=this.getBwEstimate(),i.bitrateTest?this.bitrateTestDelay=a/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==PlaylistLevelType.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,i=this.getBwEstimate(),s=this.hls.config.maxStarvationDelay,n=this.findBestLevel(i,t,e,0,s,1,1);if(n>-1)return n;const a=this.hls.firstLevel,o=Math.min(Math.max(a,t),e);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${a} clamped to ${o}`),o}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,i=this.bwEstimator.canEstimate(),s=this.lastLoadedFragLevel>-1;if(e!==-1&&(!i||!s||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const n=i&&s?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const a=this.hls.levels;if(a.length>Math.max(e,n)&&a[e].loadError<=a[n].loadError)return e}return this._nextAutoLevel=n,this.nextAutoLevelKey=this.getAutoLevelKey(),n}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:i}=this;if(i.levels.length<=1)return i.loadLevel;const{maxAutoLevel:s,config:n,minAutoLevel:a}=i,o=t?t.duration:e?e.duration:0,c=this.getBwEstimate(),u=this.getStarvationDelay();let f=n.abrBandWidthFactor,d=n.abrBandWidthUpFactor;if(u){const S=this.findBestLevel(c,a,s,u,0,f,d);if(S>=0)return this.rebufferNotice=-1,S}let g=o?Math.min(o,n.maxStarvationDelay):n.maxStarvationDelay;if(!u){const S=this.bitrateTestDelay;S&&(g=(o?Math.min(o,n.maxLoadingDelay):n.maxLoadingDelay)-S,this.info(`bitrate test took ${Math.round(1e3*S)}ms, set first fragment max fetchDuration to ${Math.round(1e3*g)} ms`),f=d=1)}const E=this.findBestLevel(c,a,s,u,g,f,d);if(this.rebufferNotice!==E&&(this.rebufferNotice=E,this.info(`${u?"rebuffering expected":"buffer is empty"}, optimal quality level ${E}`)),E>-1)return E;const m=i.levels[a],T=i.loadLevelObj;return T&&m?.bitrate<T.bitrate?a:i.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const i=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,s=e.mainForwardBufferInfo;return(s?s.len:0)/i}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,i,s,n,a,o){var c;const u=s+n,f=this.lastLoadedFragLevel,d=f===-1?this.hls.firstLevel:f,{fragCurrent:g,partCurrent:E}=this,{levels:m,allAudioTracks:T,loadLevel:S,config:b}=this.hls;if(m.length===1)return 0;const C=m[d],I=!!((c=this.hls.latestLevelDetails)!=null&&c.live),L=S===-1||f===-1;let k,U="SDR",O=C?.frameRate||0;const{audioPreference:F,videoPreference:G}=b,x=this.audioTracksByGroup||(this.audioTracksByGroup=getAudioTracksByGroup(T));let $=-1;if(L){if(this.firstSelection!==-1)return this.firstSelection;const re=this.codecTiers||(this.codecTiers=getCodecTiers(m,x,t,i)),me=getStartCodecTier(re,U,e,F,G),{codecSet:H,videoRanges:z,minFramerate:ie,minBitrate:ne,minIndex:he,preferHDR:pe}=me;$=he,k=H,U=pe?z[z.length-1]:z[0],O=ie,e=Math.max(e,ne),this.log(`picked start tier ${stringify(me)}`)}else k=C?.codecSet,U=C?.videoRange;const X=E?E.duration:g?g.duration:0,Q=this.bwEstimator.getEstimateTTFB()/1e3,ee=[];for(let re=i;re>=t;re--){var te;const me=m[re],H=re>d;if(!me)continue;if(b.useMediaCapabilities&&!me.supportedResult&&!me.supportedPromise){const ae=navigator.mediaCapabilities;typeof ae?.decodingInfo=="function"&&requiresMediaCapabilitiesDecodingInfo(me,x,U,O,e,F)?(me.supportedPromise=getMediaDecodingInfoPromise(me,x,ae,this.supportedCache),me.supportedPromise.then(Ae=>{if(!this.hls)return;me.supportedResult=Ae;const Re=this.hls.levels,Le=Re.indexOf(me);Ae.error?this.warn(`MediaCapabilities decodingInfo error: "${Ae.error}" for level ${Le} ${stringify(Ae)}`):Ae.supported?Ae.decodingInfoResults.some(Y=>Y.smooth===!1||Y.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${Le} not smooth or powerEfficient: ${stringify(Ae)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${Le} ${stringify(Ae)}`),Le>-1&&Re.length>1&&(this.log(`Removing unsupported level ${Le}`),this.hls.removeLevel(Le),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))}).catch(Ae=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${Ae}`)})):me.supportedResult=SUPPORTED_INFO_DEFAULT}if((k&&me.codecSet!==k||U&&me.videoRange!==U||H&&O>me.frameRate||!H&&O>0&&O<me.frameRate||(te=me.supportedResult)!=null&&(te=te.decodingInfoResults)!=null&&te.some(ae=>ae.smooth===!1))&&(!L||re!==$)){ee.push(re);continue}const z=me.details,ie=(E?z?.partTarget:z?.averagetargetduration)||X;let ne;H?ne=o*e:ne=a*e;const he=X&&s>=X*2&&n===0?me.averageBitrate:me.maxBitrate,pe=this.getTimeToLoadFrag(Q,ne,he*ie,z===void 0);if(ne>=he&&(re===f||me.loadError===0&&me.fragmentError===0)&&(pe<=Q||!isFiniteNumber(pe)||I&&!this.bitrateTestDelay||pe<u)){const ae=this.forcedAutoLevel;return re!==S&&(ae===-1||ae!==S)&&(ee.length&&this.trace(`Skipped level(s) ${ee.join(",")} of ${i} max with CODECS and VIDEO-RANGE:"${m[ee[0]].codecs}" ${m[ee[0]].videoRange}; not compatible with "${k}" ${U}`),this.info(`switch candidate:${d}->${re} adjustedbw(${Math.round(ne)})-bitrate=${Math.round(ne-he)} ttfb:${Q.toFixed(1)} avgDuration:${ie.toFixed(1)} maxFetchDuration:${u.toFixed(1)} fetchDuration:${pe.toFixed(1)} firstSelection:${L} codecSet:${me.codecSet} videoRange:${me.videoRange} hls.loadLevel:${S}`)),L&&(this.firstSelection=re),re}}return-1}set nextAutoLevel(e){const t=this.deriveNextAutoLevel(e);this._nextAutoLevel!==t&&(this.nextAutoLevelKey="",this._nextAutoLevel=t)}deriveNextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:i}=this.hls;return Math.min(Math.max(e,i),t)}}const BinarySearch={search:function(r,e){let t=0,i=r.length-1,s=null,n=null;for(;t<=i;){s=(t+i)/2|0,n=r[s];const a=e(n);if(a>0)t=s+1;else if(a<0)i=s-1;else return n}return null}};function findFragmentByPDT(r,e,t){if(e===null||!Array.isArray(r)||!r.length||!isFiniteNumber(e))return null;const i=r[0].programDateTime;if(e<(i||0))return null;const s=r[r.length-1].endProgramDateTime;if(e>=(s||0))return null;for(let n=0;n<r.length;++n){const a=r[n];if(pdtWithinToleranceTest(e,t,a))return a}return null}function findFragmentByPTS(r,e,t=0,i=0,s=.005){let n=null;if(r){n=e[1+r.sn-e[0].sn]||null;const o=r.endDTS-t;o>0&&o<15e-7&&(t+=15e-7),n&&r.level!==n.level&&n.end<=r.end&&(n=e[2+r.sn-e[0].sn]||null)}else t===0&&e[0].start===0&&(n=e[0]);if(n&&((!r||r.level===n.level)&&fragmentWithinToleranceTest(t,i,n)===0||fragmentWithinFastStartSwitch(n,r,Math.min(s,i))))return n;const a=BinarySearch.search(e,fragmentWithinToleranceTest.bind(null,t,i));return a&&(a!==r||!n)?a:n}function fragmentWithinFastStartSwitch(r,e,t){if(e&&e.start===0&&e.level<r.level&&(e.endPTS||0)>0){const i=e.tagList.reduce((s,n)=>(n[0]==="INF"&&(s+=parseFloat(n[1])),s),t);return r.start<=i}return!1}function fragmentWithinToleranceTest(r=0,e=0,t){if(t.start<=r&&t.start+t.duration>r)return 0;const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-i<=r?1:t.start-i>r&&t.start?-1:0}function pdtWithinToleranceTest(r,e,t){const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-i>r}function findNearestWithCC(r,e,t){if(r&&r.startCC<=e&&r.endCC>=e){let i=r.fragments;const{fragmentHint:s}=r;s&&(i=i.concat(s));let n;return BinarySearch.search(i,a=>a.cc<e?1:a.cc>e?-1:(n=a,a.end<=t?1:a.start>t?-1:0)),n||null}return null}function isTimeoutError(r){switch(r.details){case ErrorDetails.FRAG_LOAD_TIMEOUT:case ErrorDetails.KEY_LOAD_TIMEOUT:case ErrorDetails.LEVEL_LOAD_TIMEOUT:case ErrorDetails.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function isKeyError(r){return r.details.startsWith("key")}function isUnusableKeyError(r){return isKeyError(r)&&!!r.frag&&!r.frag.decryptdata}function getRetryConfig(r,e){const t=isTimeoutError(e);return r.default[`${t?"timeout":"error"}Retry`]}function getRetryDelay(r,e){const t=r.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*r.retryDelayMs,r.maxRetryDelayMs)}function getLoaderConfigWithoutReties(r){return _objectSpread2(_objectSpread2({},r),{errorRetry:null,timeoutRetry:null})}function shouldRetry(r,e,t,i){if(!r)return!1;const s=i?.code,n=e<r.maxNumRetry&&(retryForHttpStatus(s)||!!t);return r.shouldRetry?r.shouldRetry(r,e,t,i,n):n}function retryForHttpStatus(r){return offlineHttpStatus(r)||!!r&&(r<400||r>499)}function offlineHttpStatus(r){return r===0&&navigator.onLine===!1}var NetworkErrorAction={DoNothing:0,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,RetryRequest:5},ErrorActionFlags={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,MoveAllAlternatesMatchingKey:4};class ErrorController extends Logger{constructor(e){super("error-controller",e.logger),this.hls=void 0,this.playlistError=0,this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(Events.ERROR,this.onError,this),e.on(Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Events.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(Events.ERROR,this.onError,this),e.off(Events.ERROR,this.onErrorOut,this),e.off(Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Events.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return e?.type===PlaylistLevelType.MAIN?e.level:this.getVariantIndex()}getVariantIndex(){var e;const t=this.hls,i=t.currentLevel;return(e=t.loadLevelObj)!=null&&e.details||i===-1?t.loadLevel:i}variantHasKey(e,t){if(e){var i;if((i=e.details)!=null&&i.hasKey(t))return!0;const s=e.audioGroups;if(s)return this.hls.allAudioTracks.filter(a=>s.indexOf(a.groupId)>=0).some(a=>{var o;return(o=a.details)==null?void 0:o.hasKey(t)})}return!1}onManifestLoading(){this.playlistError=0}onLevelUpdated(){this.playlistError=0}onError(e,t){var i;if(t.fatal)return;const s=this.hls,n=t.context;switch(t.details){case ErrorDetails.FRAG_LOAD_ERROR:case ErrorDetails.FRAG_LOAD_TIMEOUT:case ErrorDetails.KEY_LOAD_ERROR:case ErrorDetails.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case ErrorDetails.FRAG_PARSING_ERROR:if((i=t.frag)!=null&&i.gap){t.errorAction=createDoNothingErrorAction();return}case ErrorDetails.FRAG_GAP:case ErrorDetails.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=NetworkErrorAction.SendAlternateToPenaltyBox;return}case ErrorDetails.LEVEL_EMPTY_ERROR:case ErrorDetails.LEVEL_PARSING_ERROR:{var a;const c=t.parent===PlaylistLevelType.MAIN?t.level:s.loadLevel;t.details===ErrorDetails.LEVEL_EMPTY_ERROR&&((a=t.context)!=null&&(a=a.levelDetails)!=null&&a.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,c):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,c))}return;case ErrorDetails.LEVEL_LOAD_ERROR:case ErrorDetails.LEVEL_LOAD_TIMEOUT:typeof n?.level=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.level));return;case ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:case ErrorDetails.SUBTITLE_LOAD_ERROR:case ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:if(n){const c=s.loadLevelObj;if(c&&(n.type===PlaylistContextType.AUDIO_TRACK&&c.hasAudioGroup(n.groupId)||n.type===PlaylistContextType.SUBTITLE_TRACK&&c.hasSubtitleGroup(n.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,s.loadLevel),t.errorAction.action=NetworkErrorAction.SendAlternateToPenaltyBox,t.errorAction.flags=ErrorActionFlags.MoveAllAlternatesMatchingHost;return}}return;case ErrorDetails.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:t.errorAction={action:NetworkErrorAction.SendAlternateToPenaltyBox,flags:ErrorActionFlags.MoveAllAlternatesMatchingHDCP};return;case ErrorDetails.KEY_SYSTEM_SESSION_UPDATE_FAILED:case ErrorDetails.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case ErrorDetails.KEY_SYSTEM_NO_SESSION:t.errorAction={action:NetworkErrorAction.SendAlternateToPenaltyBox,flags:ErrorActionFlags.MoveAllAlternatesMatchingKey};return;case ErrorDetails.BUFFER_ADD_CODEC_ERROR:case ErrorDetails.REMUX_ALLOC_ERROR:case ErrorDetails.BUFFER_APPEND_ERROR:if(!t.errorAction){var o;t.errorAction=this.getLevelSwitchAction(t,(o=t.level)!=null?o:s.loadLevel)}return;case ErrorDetails.INTERNAL_EXCEPTION:case ErrorDetails.BUFFER_APPENDING_ERROR:case ErrorDetails.BUFFER_FULL_ERROR:case ErrorDetails.LEVEL_SWITCH_ERROR:case ErrorDetails.BUFFER_STALLED_ERROR:case ErrorDetails.BUFFER_SEEK_OVER_HOLE:case ErrorDetails.BUFFER_NUDGE_ON_STALL:t.errorAction=createDoNothingErrorAction();return}t.type===ErrorTypes.KEY_SYSTEM_ERROR&&(t.levelRetry=!1,t.errorAction=createDoNothingErrorAction())}getPlaylistRetryOrSwitchAction(e,t){const i=this.hls,s=getRetryConfig(i.config.playlistLoadPolicy,e),n=this.playlistError++;if(shouldRetry(s,n,isTimeoutError(e),e.response))return{action:NetworkErrorAction.RetryRequest,flags:ErrorActionFlags.None,retryConfig:s,retryCount:n};const o=this.getLevelSwitchAction(e,t);return s&&(o.retryConfig=s,o.retryCount=n),o}getFragRetryOrSwitchAction(e){const t=this.hls,i=this.getVariantLevelIndex(e.frag),s=t.levels[i],{fragLoadPolicy:n,keyLoadPolicy:a}=t.config,o=getRetryConfig(isKeyError(e)?a:n,e),c=t.levels.reduce((f,d)=>f+d.fragmentError,0);if(s&&(e.details!==ErrorDetails.FRAG_GAP&&s.fragmentError++,!isUnusableKeyError(e)&&shouldRetry(o,c,isTimeoutError(e),e.response)))return{action:NetworkErrorAction.RetryRequest,flags:ErrorActionFlags.None,retryConfig:o,retryCount:c};const u=this.getLevelSwitchAction(e,i);return o&&(u.retryConfig=o,u.retryCount=c),u}getLevelSwitchAction(e,t){const i=this.hls;t==null&&(t=i.loadLevel);const s=this.hls.levels[t];if(s){var n,a;const u=e.details;s.loadError++,u===ErrorDetails.BUFFER_APPEND_ERROR&&s.fragmentError++;let f=-1;const{levels:d,loadLevel:g,minAutoLevel:E,maxAutoLevel:m}=i;!i.autoLevelEnabled&&!i.config.preserveManualLevelOnError&&(i.loadLevel=-1);const T=(n=e.frag)==null?void 0:n.type,b=(T===PlaylistLevelType.AUDIO&&u===ErrorDetails.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(u===ErrorDetails.BUFFER_ADD_CODEC_ERROR||u===ErrorDetails.BUFFER_APPEND_ERROR))&&d.some(({audioCodec:U})=>s.audioCodec!==U),I=e.sourceBufferName==="video"&&(u===ErrorDetails.BUFFER_ADD_CODEC_ERROR||u===ErrorDetails.BUFFER_APPEND_ERROR)&&d.some(({codecSet:U,audioCodec:O})=>s.codecSet!==U&&s.audioCodec===O),{type:L,groupId:k}=(a=e.context)!=null?a:{};for(let U=d.length;U--;){const O=(U+g)%d.length;if(O!==g&&O>=E&&O<=m&&d[O].loadError===0){var o,c;const F=d[O];if(u===ErrorDetails.FRAG_GAP&&T===PlaylistLevelType.MAIN&&e.frag){const G=d[O].details;if(G){const x=findFragmentByPTS(e.frag,G.fragments,e.frag.start);if(x!=null&&x.gap)continue}}else{if(L===PlaylistContextType.AUDIO_TRACK&&F.hasAudioGroup(k)||L===PlaylistContextType.SUBTITLE_TRACK&&F.hasSubtitleGroup(k))continue;if(T===PlaylistLevelType.AUDIO&&(o=s.audioGroups)!=null&&o.some(G=>F.hasAudioGroup(G))||T===PlaylistLevelType.SUBTITLE&&(c=s.subtitleGroups)!=null&&c.some(G=>F.hasSubtitleGroup(G))||b&&s.audioCodec===F.audioCodec||I&&s.codecSet===F.codecSet||!b&&s.codecSet!==F.codecSet)continue}f=O;break}}if(f>-1&&i.loadLevel!==f)return e.levelRetry=!0,this.playlistError=0,{action:NetworkErrorAction.SendAlternateToPenaltyBox,flags:ErrorActionFlags.None,nextAutoLevel:f}}return{action:NetworkErrorAction.SendAlternateToPenaltyBox,flags:ErrorActionFlags.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var i;switch((i=t.errorAction)==null?void 0:i.action){case NetworkErrorAction.DoNothing:break;case NetworkErrorAction.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==ErrorDetails.FRAG_GAP?t.fatal=!0:/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError());break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,i=e.errorAction;if(!i)return;const{flags:s}=i,n=i.nextAutoLevel;switch(s){case ErrorActionFlags.None:this.switchLevel(e,n);break;case ErrorActionFlags.MoveAllAlternatesMatchingHDCP:{const c=this.getVariantLevelIndex(e.frag),u=t.levels[c],f=u?.attrs["HDCP-LEVEL"];if(i.hdcpLevel=f,f==="NONE")this.warn("HDCP policy resticted output with HDCP-LEVEL=NONE");else if(f){t.maxHdcpLevel=HdcpLevels[HdcpLevels.indexOf(f)-1],i.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}}case ErrorActionFlags.MoveAllAlternatesMatchingKey:{const c=e.decryptdata;if(c){const u=this.hls.levels,f=u.length;for(let g=f;g--;)if(this.variantHasKey(u[g],c)){var a,o;this.log(`Banned key found in level ${g} (${u[g].bitrate}bps) or audio group "${(a=u[g].audioGroups)==null?void 0:a.join(",")}" (${(o=e.frag)==null?void 0:o.type} fragment) ${arrayToHex(c.keyId||[])}`),u[g].fragmentError++,u[g].loadError++,this.log(`Removing level ${g} with key error (${e.error})`),this.hls.removeLevel(g)}const d=e.frag;if(this.hls.levels.length<f)i.resolved=!0;else if(d&&d.type!==PlaylistLevelType.MAIN){const g=d.decryptdata;g&&!c.matches(g)&&(i.resolved=!0)}}break}}i.resolved||this.switchLevel(e,n)}switchLevel(e,t){if(t!==void 0&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel,e.details===ErrorDetails.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!=="audiovideo")){const i=getCodecsForMimeType(e.mimeType),s=this.hls.levels;for(let n=s.length;n--;)s[n][`${e.sourceBufferName}Codec`]===i&&(this.log(`Removing level ${n} for ${e.details} ("${i}" not supported)`),this.hls.removeLevel(n))}}}function createDoNothingErrorAction(r){const e={action:NetworkErrorAction.DoNothing,flags:ErrorActionFlags.None};return r&&(e.resolved=!0),e}var FragmentState={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class FragmentTracker{constructor(e){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=e,this._registerListeners()}_registerListeners(){const{hls:e}=this;e&&(e.on(Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Events.BUFFER_APPENDED,this.onBufferAppended,this),e.on(Events.FRAG_BUFFERED,this.onFragBuffered,this),e.on(Events.FRAG_LOADED,this.onFragLoaded,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Events.BUFFER_APPENDED,this.onBufferAppended,this),e.off(Events.FRAG_BUFFERED,this.onFragBuffered,this),e.off(Events.FRAG_LOADED,this.onFragLoaded,this))}destroy(){this._unregisterListeners(),this.hls=this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const i=this.activePartLists[t];if(i)for(let s=i.length;s--;){const n=i[s];if(!n)break;if(n.start<=e&&e<=n.end&&n.loaded)return n}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){return this.getFragAtPos(e,t,!0)}getFragAtPos(e,t,i){const{fragments:s}=this,n=Object.keys(s);for(let a=n.length;a--;){const o=s[n[a]];if(o?.body.type===t&&(!i||o.buffered)){const c=o.body;if(c.start<=e&&e<=c.end)return c}}return null}detectEvictedFragments(e,t,i,s,n){this.timeRanges&&(this.timeRanges[e]=t);const a=s?.fragment.sn||-1;Object.keys(this.fragments).forEach(o=>{const c=this.fragments[o];if(!c||a>=c.body.sn)return;if(!c.buffered&&(!c.loaded||n)){c.body.type===i&&this.removeFragment(c.body);return}const u=c.range[e];if(u){if(u.time.length===0){this.removeFragment(c.body);return}u.time.some(f=>{const d=!this.isTimeBuffered(f.startPTS,f.endPTS,t);return d&&this.removeFragment(c.body),d})}})}detectPartialFragments(e){const t=this.timeRanges;if(!t||e.frag.sn==="initSegment")return;const i=e.frag,s=getFragmentKey(i),n=this.fragments[s];if(!n||n.buffered&&i.gap)return;const a=!i.relurl;Object.keys(t).forEach(o=>{const c=i.elementaryStreams[o];if(!c)return;const u=t[o],f=a||c.partial===!0;n.range[o]=this.getBufferedTimes(i,e.part,f,u)}),n.loaded=null,Object.keys(n.range).length?(this.bufferedEnd(n,i),isPartial(n)||this.removeParts(i.sn-1,i.type)):this.removeFragment(n.body)}bufferedEnd(e,t){e.buffered=!0,(e.body.endList=t.endList||e.body.endList)&&(this.endListFragments[e.body.type]=e)}removeParts(e,t){const i=this.activePartLists[t];i&&(this.activePartLists[t]=filterParts(i,s=>s.fragment.sn>=e))}fragBuffered(e,t){const i=getFragmentKey(e);let s=this.fragments[i];!s&&t&&(s=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),s&&(s.loaded=null,this.bufferedEnd(s,e))}getBufferedTimes(e,t,i,s){const n={time:[],partial:i},a=e.start,o=e.end,c=e.minEndPTS||o,u=e.maxStartPTS||a;for(let f=0;f<s.length;f++){const d=s.start(f)-this.bufferPadding,g=s.end(f)+this.bufferPadding;if(u>=d&&c<=g){n.time.push({startPTS:Math.max(a,s.start(f)),endPTS:Math.min(o,s.end(f))});break}else if(a<g&&o>d){const E=Math.max(a,s.start(f)),m=Math.min(o,s.end(f));m>E&&(n.partial=!0,n.time.push({startPTS:E,endPTS:m}))}else if(o<=d)break}return n}getPartialFragment(e){let t=null,i,s,n,a=0;const{bufferPadding:o,fragments:c}=this;return Object.keys(c).forEach(u=>{const f=c[u];f&&isPartial(f)&&(s=f.body.start-o,n=f.body.end+o,e>=s&&e<=n&&(i=Math.min(e-s,n-e),a<=i&&(t=f.body,a=i)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||isPartial(t))}getState(e){const t=getFragmentKey(e),i=this.fragments[t];return i?i.buffered?isPartial(i)?FragmentState.PARTIAL:FragmentState.OK:FragmentState.APPENDING:FragmentState.NOT_LOADED}isTimeBuffered(e,t,i){let s,n;for(let a=0;a<i.length;a++){if(s=i.start(a)-this.bufferPadding,n=i.end(a)+this.bufferPadding,e>=s&&t<=n)return!0;if(t<=s)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,t){if(t.frag.sn==="initSegment"||t.frag.bitrateTest)return;const i=t.frag,s=t.part?null:t,n=getFragmentKey(i);this.fragments[n]={body:i,appendedPTS:null,loaded:s,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:i,part:s,timeRanges:n,type:a}=t;if(i.sn==="initSegment")return;const o=i.type;if(s){let u=this.activePartLists[o];u||(this.activePartLists[o]=u=[]),u.push(s)}this.timeRanges=n;const c=n[a];this.detectEvictedFragments(a,c,o,s)}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=getFragmentKey(e);return!!this.fragments[t]}hasFragments(e){const{fragments:t}=this,i=Object.keys(t);if(!e)return i.length>0;for(let s=i.length;s--;){const n=t[i[s]];if(n?.body.type===e)return!0}return!1}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,i,s,n){s&&!this.hasGaps||Object.keys(this.fragments).forEach(a=>{const o=this.fragments[a];if(!o)return;const c=o.body;c.type!==i||s&&!c.gap||c.start<t&&c.end>e&&(o.buffered||n)&&this.removeFragment(c)})}removeFragment(e){const t=getFragmentKey(e);e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const s=e.sn;this.activePartLists[e.type]=filterParts(i,n=>n.fragment.sn!==s)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const t=(e=this.hls)==null||(e=e.latestLevelDetails)==null?void 0:e.partList;t&&t.forEach(i=>i.clearElementaryStreamInfo())}}function isPartial(r){var e,t,i;return r.buffered&&!!(r.body.gap||(e=r.range.video)!=null&&e.partial||(t=r.range.audio)!=null&&t.partial||(i=r.range.audiovideo)!=null&&i.partial)}function getFragmentKey(r){return`${r.type}_${r.level}_${r.sn}`}function filterParts(r,e){return r.filter(t=>{const i=e(t);return i||t.clearElementaryStreamInfo(),i})}var DecrypterAesMode={cbc:0,ctr:1};class AESCrypto{constructor(e,t,i){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=t,this.aesMode=i}decrypt(e,t){switch(this.aesMode){case DecrypterAesMode.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case DecrypterAesMode.ctr:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},t,e);default:throw new Error(`[AESCrypto] invalid aes mode ${this.aesMode}`)}}}function removePadding(r){const e=r.byteLength,t=e&&new DataView(r.buffer).getUint8(e-1);return t?r.slice(0,e-t):r}class AESDecryptor{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_(e){const t=new DataView(e),i=new Uint32Array(4);for(let s=0;s<4;s++)i[s]=t.getUint32(s*4);return i}initTable(){const e=this.sBox,t=this.invSBox,i=this.subMix,s=i[0],n=i[1],a=i[2],o=i[3],c=this.invSubMix,u=c[0],f=c[1],d=c[2],g=c[3],E=new Uint32Array(256);let m=0,T=0,S=0;for(S=0;S<256;S++)S<128?E[S]=S<<1:E[S]=S<<1^283;for(S=0;S<256;S++){let b=T^T<<1^T<<2^T<<3^T<<4;b=b>>>8^b&255^99,e[m]=b,t[b]=m;const C=E[m],I=E[C],L=E[I];let k=E[b]*257^b*16843008;s[m]=k<<24|k>>>8,n[m]=k<<16|k>>>16,a[m]=k<<8|k>>>24,o[m]=k,k=L*16843009^I*65537^C*257^m*16843008,u[b]=k<<24|k>>>8,f[b]=k<<16|k>>>16,d[b]=k<<8|k>>>24,g[b]=k,m?(m=C^E[E[E[L^C]]],T^=E[E[T]]):m=T=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let i=!0,s=0;for(;s<t.length&&i;)i=t[s]===this.key[s],s++;if(i)return;this.key=t;const n=this.keySize=t.length;if(n!==4&&n!==6&&n!==8)throw new Error("Invalid aes key size="+n);const a=this.ksRows=(n+6+1)*4;let o,c;const u=this.keySchedule=new Uint32Array(a),f=this.invKeySchedule=new Uint32Array(a),d=this.sBox,g=this.rcon,E=this.invSubMix,m=E[0],T=E[1],S=E[2],b=E[3];let C,I;for(o=0;o<a;o++){if(o<n){C=u[o]=t[o];continue}I=C,o%n===0?(I=I<<8|I>>>24,I=d[I>>>24]<<24|d[I>>>16&255]<<16|d[I>>>8&255]<<8|d[I&255],I^=g[o/n|0]<<24):n>6&&o%n===4&&(I=d[I>>>24]<<24|d[I>>>16&255]<<16|d[I>>>8&255]<<8|d[I&255]),u[o]=C=(u[o-n]^I)>>>0}for(c=0;c<a;c++)o=a-c,c&3?I=u[o]:I=u[o-4],c<4||o<=4?f[c]=I:f[c]=m[d[I>>>24]]^T[d[I>>>16&255]]^S[d[I>>>8&255]]^b[d[I&255]],f[c]=f[c]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,i){const s=this.keySize+6,n=this.invKeySchedule,a=this.invSBox,o=this.invSubMix,c=o[0],u=o[1],f=o[2],d=o[3],g=this.uint8ArrayToUint32Array_(i);let E=g[0],m=g[1],T=g[2],S=g[3];const b=new Int32Array(e),C=new Int32Array(b.length);let I,L,k,U,O,F,G,x,$,X,Q,ee,te,re;const me=this.networkToHostOrderSwap;for(;t<b.length;){for($=me(b[t]),X=me(b[t+1]),Q=me(b[t+2]),ee=me(b[t+3]),O=$^n[0],F=ee^n[1],G=Q^n[2],x=X^n[3],te=4,re=1;re<s;re++)I=c[O>>>24]^u[F>>16&255]^f[G>>8&255]^d[x&255]^n[te],L=c[F>>>24]^u[G>>16&255]^f[x>>8&255]^d[O&255]^n[te+1],k=c[G>>>24]^u[x>>16&255]^f[O>>8&255]^d[F&255]^n[te+2],U=c[x>>>24]^u[O>>16&255]^f[F>>8&255]^d[G&255]^n[te+3],O=I,F=L,G=k,x=U,te=te+4;I=a[O>>>24]<<24^a[F>>16&255]<<16^a[G>>8&255]<<8^a[x&255]^n[te],L=a[F>>>24]<<24^a[G>>16&255]<<16^a[x>>8&255]<<8^a[O&255]^n[te+1],k=a[G>>>24]<<24^a[x>>16&255]<<16^a[O>>8&255]<<8^a[F&255]^n[te+2],U=a[x>>>24]<<24^a[O>>16&255]<<16^a[F>>8&255]<<8^a[G&255]^n[te+3],C[t]=me(I^E),C[t+1]=me(U^m),C[t+2]=me(k^T),C[t+3]=me(L^S),E=$,m=X,T=Q,S=ee,t=t+4}return C.buffer}}class FastAESKey{constructor(e,t,i){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=e,this.key=t,this.aesMode=i}expandKey(){const e=getSubtleAlgoName(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}function getSubtleAlgoName(r){switch(r){case DecrypterAesMode.cbc:return"AES-CBC";case DecrypterAesMode.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${r}`)}}const CHUNK_SIZE=16;class Decrypter{constructor(e,{removePKCS7Padding:t=!0}={}){if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.enableSoftwareAES=void 0,this.enableSoftwareAES=e.enableSoftwareAES,this.removePKCS7Padding=t,t)try{const i=self.crypto;i&&(this.subtle=i.subtle||i.webkitSubtle)}catch{}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:e,remainderData:t}=this;if(!e||t)return this.reset(),null;const i=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?removePadding(i):i}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,i,s){return this.useSoftware?new Promise((n,a)=>{const o=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(o,t,i,s);const c=this.flush();c?n(c.buffer):a(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,i,s)}softwareDecrypt(e,t,i,s){const{currentIV:n,currentResult:a,remainderData:o}=this;if(s!==DecrypterAesMode.cbc||t.byteLength!==16)return logger.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),o&&(e=appendUint8Array(o,e),this.remainderData=null);const c=this.getValidChunk(e);if(!c.length)return null;n&&(i=n);let u=this.softwareDecrypter;u||(u=this.softwareDecrypter=new AESDecryptor),u.expandKey(t);const f=a;return this.currentResult=u.decrypt(c.buffer,0,i),this.currentIV=c.slice(-16).buffer,f||null}webCryptoDecrypt(e,t,i,s){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,i,s));this.key=t,this.fastAesKey=new FastAESKey(this.subtle,t,s)}return this.fastAesKey.expandKey().then(n=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new AESCrypto(this.subtle,new Uint8Array(i),s).decrypt(e.buffer,n)):Promise.reject(new Error("web crypto not initialized"))).catch(n=>(logger.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${n.name}: ${n.message}`),this.onWebCryptoError(e,t,i,s)))}onWebCryptoError(e,t,i,s){const n=this.enableSoftwareAES;if(n){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i,s);const a=this.flush();if(a)return a.buffer}throw new Error("WebCrypto"+(n?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(e){let t=e;const i=e.length-e.length%CHUNK_SIZE;return i!==e.length&&(t=e.slice(0,i),this.remainderData=e.slice(i)),t}logOnce(e){this.logEnabled&&(logger.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const MIN_CHUNK_SIZE=Math.pow(2,17);class FragmentLoader{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,t){const i=e.url;if(!i)return Promise.reject(new LoadError({type:ErrorTypes.NETWORK_ERROR,details:ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${i?"part list":"url"}`),networkDetails:null}));this.abort();const s=this.config,n=s.fLoader,a=s.loader;return new Promise((o,c)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(m=>m[0]==="GAP")){c(createGapLoadError(e));return}else e.gap=!1;const u=this.loader=n?new n(s):new a(s),f=createLoaderContext(e);e.loader=u;const d=getLoaderConfigWithoutReties(s.fragLoadPolicy.default),g={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:MIN_CHUNK_SIZE};e.stats=u.stats;const E={onSuccess:(m,T,S,b)=>{this.resetLoader(e,u);let C=m.data;S.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(C.slice(0,16)),C=C.slice(16)),o({frag:e,part:null,payload:C,networkDetails:b})},onError:(m,T,S,b)=>{this.resetLoader(e,u),c(new LoadError({type:ErrorTypes.NETWORK_ERROR,details:ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:_objectSpread2({url:i,data:void 0},m),error:new Error(`HTTP Error ${m.code} ${m.text}`),networkDetails:S,stats:b}))},onAbort:(m,T,S)=>{this.resetLoader(e,u),c(new LoadError({type:ErrorTypes.NETWORK_ERROR,details:ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:S,stats:m}))},onTimeout:(m,T,S)=>{this.resetLoader(e,u),c(new LoadError({type:ErrorTypes.NETWORK_ERROR,details:ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${g.timeout}ms`),networkDetails:S,stats:m}))}};t&&(E.onProgress=(m,T,S,b)=>t({frag:e,part:null,payload:S,networkDetails:b})),u.load(f,g,E)})}loadPart(e,t,i){this.abort();const s=this.config,n=s.fLoader,a=s.loader;return new Promise((o,c)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){c(createGapLoadError(e,t));return}const u=this.loader=n?new n(s):new a(s),f=createLoaderContext(e,t);e.loader=u;const d=getLoaderConfigWithoutReties(s.fragLoadPolicy.default),g={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:MIN_CHUNK_SIZE};t.stats=u.stats,u.load(f,g,{onSuccess:(E,m,T,S)=>{this.resetLoader(e,u),this.updateStatsFromPart(e,t);const b={frag:e,part:t,payload:E.data,networkDetails:S};i(b),o(b)},onError:(E,m,T,S)=>{this.resetLoader(e,u),c(new LoadError({type:ErrorTypes.NETWORK_ERROR,details:ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:_objectSpread2({url:f.url,data:void 0},E),error:new Error(`HTTP Error ${E.code} ${E.text}`),networkDetails:T,stats:S}))},onAbort:(E,m,T)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,u),c(new LoadError({type:ErrorTypes.NETWORK_ERROR,details:ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:T,stats:E}))},onTimeout:(E,m,T)=>{this.resetLoader(e,u),c(new LoadError({type:ErrorTypes.NETWORK_ERROR,details:ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${g.timeout}ms`),networkDetails:T,stats:E}))}})})}updateStatsFromPart(e,t){const i=e.stats,s=t.stats,n=s.total;if(i.loaded+=s.loaded,n){const c=Math.round(e.duration/t.duration),u=Math.min(Math.round(i.loaded/n),c),d=(c-u)*Math.round(i.loaded/u);i.total=i.loaded+d}else i.total=Math.max(i.loaded,i.total);const a=i.loading,o=s.loading;a.start?a.first+=o.first-o.start:(a.start=o.start,a.first=o.first),a.end=o.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function createLoaderContext(r,e=null){const t=e||r,i={frag:r,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},s=t.byteRangeStartOffset,n=t.byteRangeEndOffset;if(isFiniteNumber(s)&&isFiniteNumber(n)){var a;let o=s,c=n;if(r.sn==="initSegment"&&isMethodFullSegmentAesCbc((a=r.decryptdata)==null?void 0:a.method)){const u=n-s;u%16&&(c=n+(16-u%16)),s!==0&&(i.resetIV=!0,o=s-16)}i.rangeStart=o,i.rangeEnd=c}return i}function createGapLoadError(r,e){const t=new Error(`GAP ${r.gap?"tag":"attribute"} found`),i={type:ErrorTypes.MEDIA_ERROR,details:ErrorDetails.FRAG_GAP,fatal:!1,frag:r,error:t,networkDetails:null};return e&&(i.part=e),(e||r).stats.aborted=!0,new LoadError(i)}function isMethodFullSegmentAesCbc(r){return r==="AES-128"||r==="AES-256"}class LoadError extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class TaskLoop extends Logger{constructor(e,t){super(e,t),this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(e){return this._tickInterval?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1}clearNextTick(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1}tick(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}class ChunkMetadata{constructor(e,t,i,s=0,n=-1,a=!1){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=getNewPerformanceTiming(),this.buffering={audio:getNewPerformanceTiming(),video:getNewPerformanceTiming(),audiovideo:getNewPerformanceTiming()},this.level=e,this.sn=t,this.id=i,this.size=s,this.part=n,this.partial=a}}function getNewPerformanceTiming(){return{start:0,executeStart:0,executeEnd:0,end:0}}const noopBuffered={length:0,start:()=>0,end:()=>0};class BufferHelper{static isBuffered(e,t){if(e){const i=BufferHelper.getBuffered(e);for(let s=i.length;s--;)if(t>=i.start(s)&&t<=i.end(s))return!0}return!1}static bufferedRanges(e){if(e){const t=BufferHelper.getBuffered(e);return BufferHelper.timeRangesToArray(t)}return[]}static timeRangesToArray(e){const t=[];for(let i=0;i<e.length;i++)t.push({start:e.start(i),end:e.end(i)});return t}static bufferInfo(e,t,i){if(e){const s=BufferHelper.bufferedRanges(e);if(s.length)return BufferHelper.bufferedInfo(s,t,i)}return{len:0,start:t,end:t,bufferedIndex:-1}}static bufferedInfo(e,t,i){t=Math.max(0,t),e.length>1&&e.sort((f,d)=>f.start-d.start||d.end-f.end);let s=-1,n=[];if(i)for(let f=0;f<e.length;f++){t>=e[f].start&&t<=e[f].end&&(s=f);const d=n.length;if(d){const g=n[d-1].end;e[f].start-g<i?e[f].end>g&&(n[d-1].end=e[f].end):n.push(e[f])}else n.push(e[f])}else n=e;let a=0,o,c=t,u=t;for(let f=0;f<n.length;f++){const d=n[f].start,g=n[f].end;if(s===-1&&t>=d&&t<=g&&(s=f),t+i>=d&&t<g)c=d,u=g,a=u-t;else if(t+i<d){o=d;break}}return{len:a,start:c||0,end:u||0,nextStart:o,buffered:e,bufferedIndex:s}}static getBuffered(e){try{return e.buffered||noopBuffered}catch(t){return logger.log("failed to get media.buffered",t),noopBuffered}}}const VARIABLE_REPLACEMENT_REGEX=/\{\$([a-zA-Z0-9-_]+)\}/g;function hasVariableReferences(r){return VARIABLE_REPLACEMENT_REGEX.test(r)}function substituteVariables(r,e){if(r.variableList!==null||r.hasVariableRefs){const t=r.variableList;return e.replace(VARIABLE_REPLACEMENT_REGEX,i=>{const s=i.substring(2,i.length-1),n=t?.[s];return n===void 0?(r.playlistParsingError||(r.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${s}"`)),i):n})}return e}function addVariableDefinition(r,e,t){let i=r.variableList;i||(r.variableList=i={});let s,n;if("QUERYPARAM"in e){s=e.QUERYPARAM;try{const a=new self.URL(t).searchParams;if(a.has(s))n=a.get(s);else throw new Error(`"${s}" does not match any query parameter in URI: "${t}"`)}catch(a){r.playlistParsingError||(r.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${a.message}`))}}else s=e.NAME,n=e.VALUE;s in i?r.playlistParsingError||(r.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${s}"`)):i[s]=n||""}function importVariableDefinition(r,e,t){const i=e.IMPORT;if(t&&i in t){let s=r.variableList;s||(r.variableList=s={}),s[i]=t[i]}else r.playlistParsingError||(r.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${i}"`))}const DECIMAL_RESOLUTION_REGEX=/^(\d+)x(\d+)$/,ATTR_LIST_REGEX=/(.+?)=(".*?"|.*?)(?:,|$)/g;class AttrList{constructor(e,t){typeof e=="string"&&(e=AttrList.parseAttrList(e,t)),_extends(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(t.length&1?"0":"")+t;const i=new Uint8Array(t.length/2);for(let s=0;s<t.length/2;s++)i[s]=parseInt(t.slice(s*2,s*2+2),16);return i}return null}hexadecimalIntegerAsNumber(e){const t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const i=this[e];return i?parseFloat(i):t}enumeratedString(e){return this[e]}enumeratedStringList(e,t){const i=this[e];return(i?i.split(/[ ,]+/):[]).reduce((s,n)=>(s[n.toLowerCase()]=!0,s),t)}bool(e){return this[e]==="YES"}decimalResolution(e){const t=DECIMAL_RESOLUTION_REGEX.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let i;const s={};for(ATTR_LIST_REGEX.lastIndex=0;(i=ATTR_LIST_REGEX.exec(e))!==null;){const a=i[1].trim();let o=i[2];const c=o.indexOf('"')===0&&o.lastIndexOf('"')===o.length-1;let u=!1;if(c)o=o.slice(1,-1);else switch(a){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":u=!0}if(t&&(c||u))o=substituteVariables(t,o);else if(!u&&!c)switch(a){case"CLOSED-CAPTIONS":if(o==="NONE")break;case"ALLOWED-CPC":case"CLASS":case"ASSOC-LANGUAGE":case"AUDIO":case"BYTERANGE":case"CHANNELS":case"CHARACTERISTICS":case"CODECS":case"DATA-ID":case"END-DATE":case"GROUP-ID":case"ID":case"IMPORT":case"INSTREAM-ID":case"KEYFORMAT":case"KEYFORMATVERSIONS":case"LANGUAGE":case"NAME":case"PATHWAY-ID":case"QUERYPARAM":case"RECENTLY-REMOVED-DATERANGES":case"SERVER-URI":case"STABLE-RENDITION-ID":case"STABLE-VARIANT-ID":case"START-DATE":case"SUBTITLES":case"SUPPLEMENTAL-CODECS":case"URI":case"VALUE":case"VIDEO":case"X-ASSET-LIST":case"X-ASSET-URI":logger.warn(`${e}: attribute ${a} is missing quotes`)}s[a]=o}return s}}const CLASS_INTERSTITIAL="com.apple.hls.interstitial";function isDateRangeCueAttribute(r){return r!=="ID"&&r!=="CLASS"&&r!=="CUE"&&r!=="START-DATE"&&r!=="DURATION"&&r!=="END-DATE"&&r!=="END-ON-NEXT"}function isSCTE35Attribute(r){return r==="SCTE35-OUT"||r==="SCTE35-IN"||r==="SCTE35-CMD"}class DateRange{constructor(e,t,i=0){var s;if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=t?.tagAnchor||null,this.tagOrder=(s=t?.tagOrder)!=null?s:i,t){const n=t.attr;for(const a in n)if(Object.prototype.hasOwnProperty.call(e,a)&&e[a]!==n[a]){logger.warn(`DATERANGE tag attribute: "${a}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=a;break}e=_extends(new AttrList({}),n,e)}if(this.attr=e,t?(this._startDate=t._startDate,this._cue=t._cue,this._endDate=t._endDate,this._dateAtEnd=t._dateAtEnd):this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const n=t?.endDate||new Date(this.attr["END-DATE"]);isFiniteNumber(n.getTime())&&(this._endDate=n)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){const e=this._cue;return e===void 0?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):e}get startTime(){const{tagAnchor:e}=this;return e===null||e.programDateTime===null?(logger.warn(`Expected tagAnchor Fragment with PDT set for DateRange "${this.id}": ${e}`),NaN):e.start+(this.startDate.getTime()-e.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){const e=this._endDate||this._dateAtEnd;if(e)return e;const t=this.duration;return t!==null?this._dateAtEnd=new Date(this._startDate.getTime()+t*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(isFiniteNumber(e))return e}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 isInterstitial(){return this.class===CLASS_INTERSTITIAL}get isValid(){return!!this.id&&!this._badValueForSameId&&isFiniteNumber(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}}const DEFAULT_TARGET_DURATION=10;class LevelDetails{constructor(e){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.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!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.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const t=this.lastPartSn-e.lastPartSn,i=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!i||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&i>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1}hasKey(e){return this.encryptedFragments.some(t=>{let i=t.decryptdata;return i||(t.setKeyFormat(e.keyFormat),i=t.decryptdata),!!i&&e.matches(i)})}get hasProgramDateTime(){return this.fragments.length?isFiniteNumber(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||DEFAULT_TARGET_DURATION}get drift(){const e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){return this.fragments.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){return this.fragments.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const e=this.partList;if(e){const t=this.lastPartIndex;if(t!==-1){for(let i=e.length;i--;)if(e[i].index>t)return e[i].index;return t}}return 0}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}}function arrayValuesMatch(r,e){return r.length===e.length?!r.some((t,i)=>t!==e[i]):!1}function optionalArrayValuesMatch(r,e){return!r&&!e?!0:!r||!e?!1:arrayValuesMatch(r,e)}function isFullSegmentEncryption(r){return r==="AES-128"||r==="AES-256"||r==="AES-256-CTR"}function getAesModeFromFullSegmentMethod(r){switch(r){case"AES-128":case"AES-256":return DecrypterAesMode.cbc;case"AES-256-CTR":return DecrypterAesMode.ctr;default:throw new Error(`invalid full segment method ${r}`)}}function base64Decode(r){return Uint8Array.from(atob(r),e=>e.charCodeAt(0))}function strToUtf8array(r){return Uint8Array.from(unescape(encodeURIComponent(r)),e=>e.charCodeAt(0))}function getKeyIdBytes(r){const e=strToUtf8array(r).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function changeEndianness(r){const e=function(i,s,n){const a=i[s];i[s]=i[n],i[n]=a};e(r,0,3),e(r,1,2),e(r,4,5),e(r,6,7)}function convertDataUriToArrayBytes(r){const e=r.split(":");let t=null;if(e[0]==="data"&&e.length===2){const i=e[1].split(";"),s=i[i.length-1].split(",");if(s.length===2){const n=s[0]==="base64",a=s[1];n?(i.splice(-1,1),t=base64Decode(a)):t=getKeyIdBytes(a)}}return t}const optionalSelf=typeof self<"u"?self:void 0;var KeySystems={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},KeySystemFormats={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function keySystemFormatToKeySystemDomain(r){switch(r){case KeySystemFormats.FAIRPLAY:return KeySystems.FAIRPLAY;case KeySystemFormats.PLAYREADY:return KeySystems.PLAYREADY;case KeySystemFormats.WIDEVINE:return KeySystems.WIDEVINE;case KeySystemFormats.CLEARKEY:return KeySystems.CLEARKEY}}function keySystemDomainToKeySystemFormat(r){switch(r){case KeySystems.FAIRPLAY:return KeySystemFormats.FAIRPLAY;case KeySystems.PLAYREADY:return KeySystemFormats.PLAYREADY;case KeySystems.WIDEVINE:return KeySystemFormats.WIDEVINE;case KeySystems.CLEARKEY:return KeySystemFormats.CLEARKEY}}function getKeySystemsForConfig(r){const{drmSystems:e,widevineLicenseUrl:t}=r,i=e?[KeySystems.FAIRPLAY,KeySystems.WIDEVINE,KeySystems.PLAYREADY,KeySystems.CLEARKEY].filter(s=>!!e[s]):[];return!i[KeySystems.WIDEVINE]&&t&&i.push(KeySystems.WIDEVINE),i}const requestMediaKeySystemAccess=(function(r){return optionalSelf!=null&&(r=optionalSelf.navigator)!=null&&r.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null})();function getSupportedMediaKeySystemConfigurations(r,e,t,i){let s;switch(r){case KeySystems.FAIRPLAY:s=["cenc","sinf"];break;case KeySystems.WIDEVINE:case KeySystems.PLAYREADY:s=["cenc"];break;case KeySystems.CLEARKEY:s=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${r}`)}return createMediaKeySystemConfigurations(s,e,t,i)}function createMediaKeySystemConfigurations(r,e,t,i){return[{initDataTypes:r,persistentState:i.persistentState||"optional",distinctiveIdentifier:i.distinctiveIdentifier||"optional",sessionTypes:i.sessionTypes||[i.sessionType||"temporary"],audioCapabilities:e.map(n=>({contentType:`audio/mp4; codecs=${n}`,robustness:i.audioRobustness||"",encryptionScheme:i.audioEncryptionScheme||null})),videoCapabilities:t.map(n=>({contentType:`video/mp4; codecs=${n}`,robustness:i.videoRobustness||"",encryptionScheme:i.videoEncryptionScheme||null}))}]}function isPersistentSessionType(r){var e;return!!r&&(r.sessionType==="persistent-license"||!!((e=r.sessionTypes)!=null&&e.some(t=>t==="persistent-license")))}function parsePlayReadyWRM(r){const e=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2),t=String.fromCharCode.apply(null,Array.from(e)),i=t.substring(t.indexOf("<"),t.length),a=new DOMParser().parseFromString(i,"text/xml").getElementsByTagName("KID")[0];if(a){const o=a.childNodes[0]?a.childNodes[0].nodeValue:a.getAttribute("VALUE");if(o){const c=base64Decode(o).subarray(0,16);return changeEndianness(c),c}}return null}let keyUriToKeyIdMap={};class LevelKey{static clearKeyUriToKeyIdMap(){keyUriToKeyIdMap={}}static setKeyIdForUri(e,t){keyUriToKeyIdMap[e]=t}static addKeyIdForUri(e){const t=Object.keys(keyUriToKeyIdMap).length%Number.MAX_SAFE_INTEGER,i=new Uint8Array(16);return new DataView(i.buffer,12,4).setUint32(0,t),keyUriToKeyIdMap[e]=i,i}constructor(e,t,i,s=[1],n=null,a){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=t,this.keyFormat=i,this.keyFormatVersions=s,this.iv=n,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!isFullSegmentEncryption(e),a!=null&&a.startsWith("0x")&&(this.keyId=new Uint8Array(hexToArrayBuffer(a)))}matches(e){return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&arrayValuesMatch(e.keyFormatVersions,this.keyFormatVersions)&&optionalArrayValuesMatch(e.iv,this.iv)&&optionalArrayValuesMatch(e.keyId,this.keyId)}isSupported(){if(this.method){if(isFullSegmentEncryption(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case KeySystemFormats.FAIRPLAY:case KeySystemFormats.WIDEVINE:case KeySystemFormats.PLAYREADY:case KeySystemFormats.CLEARKEY:return["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e,t){if(!this.encrypted||!this.uri)return null;if(isFullSegmentEncryption(this.method)){let n=this.iv;return n||(typeof e!="number"&&(logger.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0),n=createInitializationVector(e)),new LevelKey(this.method,this.uri,"identity",this.keyFormatVersions,n)}if(this.keyId){const n=keyUriToKeyIdMap[this.uri];if(n&&!arrayValuesMatch(this.keyId,n)&&LevelKey.setKeyIdForUri(this.uri,this.keyId),this.pssh)return this}const i=convertDataUriToArrayBytes(this.uri);if(i)switch(this.keyFormat){case KeySystemFormats.WIDEVINE:if(this.pssh=i,!this.keyId){const n=parseMultiPssh(i.buffer);if(n.length){var s;const a=n[0];this.keyId=(s=a.kids)!=null&&s.length?a.kids[0]:null}}this.keyId||(this.keyId=getKeyIdFromPlayReadyKey(t));break;case KeySystemFormats.PLAYREADY:{const n=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=mp4pssh(n,null,i),this.keyId=parsePlayReadyWRM(i);break}default:{let n=i.subarray(0,16);if(n.length!==16){const a=new Uint8Array(16);a.set(n,16-n.length),n=a}this.keyId=n;break}}if(!this.keyId||this.keyId.byteLength!==16){let n;n=getKeyIdFromWidevineKey(t),n||(n=getKeyIdFromPlayReadyKey(t),n||(n=keyUriToKeyIdMap[this.uri])),n&&(this.keyId=n,LevelKey.setKeyIdForUri(this.uri,n))}return this}}function getKeyIdFromWidevineKey(r){const e=r?.[KeySystemFormats.WIDEVINE];return e?e.keyId:null}function getKeyIdFromPlayReadyKey(r){const e=r?.[KeySystemFormats.PLAYREADY];if(e){const t=convertDataUriToArrayBytes(e.uri);if(t)return parsePlayReadyWRM(t)}return null}function createInitializationVector(r){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=r>>8*(15-t)&255;return e}const MASTER_PLAYLIST_REGEX=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,MASTER_PLAYLIST_MEDIA_REGEX=/#EXT-X-MEDIA:(.*)/g,IS_MEDIA_PLAYLIST=/^#EXT(?:INF|-X-TARGETDURATION):/m,LEVEL_PLAYLIST_REGEX_FAST=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),LEVEL_PLAYLIST_REGEX_SLOW=new RegExp([/#EXT-X-(PROGRAM-DATE-TIME|BYTERANGE|DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class M3U8Parser{static findGroup(e,t){for(let i=0;i<e.length;i++){const s=e[i];if(s.id===t)return s}}static resolve(e,t){return urlToolkitExports.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return IS_MEDIA_PLAYLIST.test(e)}static parseMasterPlaylist(e,t){const i=hasVariableReferences(e),s={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:i},n=[];if(MASTER_PLAYLIST_REGEX.lastIndex=0,!e.startsWith("#EXTM3U"))return s.playlistParsingError=new Error("no EXTM3U delimiter"),s;let a;for(;(a=MASTER_PLAYLIST_REGEX.exec(e))!=null;)if(a[1]){var o;const u=new AttrList(a[1],s),f=substituteVariables(s,a[2]),d={attrs:u,bitrate:u.decimalInteger("BANDWIDTH")||u.decimalInteger("AVERAGE-BANDWIDTH"),name:u.NAME,url:M3U8Parser.resolve(f,t)},g=u.decimalResolution("RESOLUTION");g&&(d.width=g.width,d.height=g.height),setCodecs(u.CODECS,d);const E=u["SUPPLEMENTAL-CODECS"];E&&(d.supplemental={},setCodecs(E,d.supplemental)),(o=d.unknownCodecs)!=null&&o.length||n.push(d),s.levels.push(d)}else if(a[3]){const u=a[3],f=a[4];switch(u){case"SESSION-DATA":{const d=new AttrList(f,s),g=d["DATA-ID"];g&&(s.sessionData===null&&(s.sessionData={}),s.sessionData[g]=d);break}case"SESSION-KEY":{const d=parseKey(f,t,s);d.encrypted&&d.isSupported()?(s.sessionKeys===null&&(s.sessionKeys=[]),s.sessionKeys.push(d)):logger.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${f}"`);break}case"DEFINE":{{const d=new AttrList(f,s);addVariableDefinition(s,d,t)}break}case"CONTENT-STEERING":{const d=new AttrList(f,s);s.contentSteering={uri:M3U8Parser.resolve(d["SERVER-URI"],t),pathwayId:d["PATHWAY-ID"]||"."};break}case"START":{s.startTimeOffset=parseStartTimeOffset(f);break}}}const c=n.length>0&&n.length<s.levels.length;return s.levels=c?n:s.levels,s.levels.length===0&&(s.playlistParsingError=new Error("no levels found in manifest")),s}static parseMasterPlaylistMedia(e,t,i){let s;const n={},a=i.levels,o={AUDIO:a.map(u=>({id:u.attrs.AUDIO,audioCodec:u.audioCodec})),SUBTITLES:a.map(u=>({id:u.attrs.SUBTITLES,textCodec:u.textCodec})),"CLOSED-CAPTIONS":[]};let c=0;for(MASTER_PLAYLIST_MEDIA_REGEX.lastIndex=0;(s=MASTER_PLAYLIST_MEDIA_REGEX.exec(e))!==null;){const u=new AttrList(s[1],i),f=u.TYPE;if(f){const d=o[f],g=n[f]||[];n[f]=g;const E=u.LANGUAGE,m=u["ASSOC-LANGUAGE"],T=u.CHANNELS,S=u.CHARACTERISTICS,b=u["INSTREAM-ID"],C={attrs:u,bitrate:0,id:c++,groupId:u["GROUP-ID"]||"",name:u.NAME||E||"",type:f,default:u.bool("DEFAULT"),autoselect:u.bool("AUTOSELECT"),forced:u.bool("FORCED"),lang:E,url:u.URI?M3U8Parser.resolve(u.URI,t):""};if(m&&(C.assocLang=m),T&&(C.channels=T),S&&(C.characteristics=S),b&&(C.instreamId=b),d!=null&&d.length){const I=M3U8Parser.findGroup(d,C.groupId)||d[0];assignCodec(C,I,"audioCodec"),assignCodec(C,I,"textCodec")}g.push(C)}}return n}static parseLevelPlaylist(e,t,i,s,n,a){var o;const c={url:t},u=new LevelDetails(t),f=u.fragments,d=[];let g=null,E=0,m=0,T=0,S=0,b=0,C=null,I=new Fragment(s,c),L,k,U,O=-1,F=!1,G=null,x;if(LEVEL_PLAYLIST_REGEX_FAST.lastIndex=0,u.m3u8=e,u.hasVariableRefs=hasVariableReferences(e),((o=LEVEL_PLAYLIST_REGEX_FAST.exec(e))==null?void 0:o[0])!=="#EXTM3U")return u.playlistParsingError=new Error("Missing format identifier #EXTM3U"),u;for(;(L=LEVEL_PLAYLIST_REGEX_FAST.exec(e))!==null;){F&&(F=!1,I=new Fragment(s,c),I.playlistOffset=T,I.setStart(T),I.sn=E,I.cc=S,b&&(I.bitrate=b),I.level=i,g&&(I.initSegment=g,g.rawProgramDateTime&&(I.rawProgramDateTime=g.rawProgramDateTime,g.rawProgramDateTime=null),G&&(I.setByteRange(G),G=null)));const ee=L[1];if(ee){I.duration=parseFloat(ee);const te=(" "+L[2]).slice(1);I.title=te||null,I.tagList.push(te?["INF",ee,te]:["INF",ee])}else if(L[3]){if(isFiniteNumber(I.duration)){I.playlistOffset=T,I.setStart(T),U&&setFragLevelKeys(I,U,u),I.sn=E,I.level=i,I.cc=S,f.push(I);const te=(" "+L[3]).slice(1);I.relurl=substituteVariables(u,te),assignProgramDateTime(I,C,d),C=I,T+=I.duration,E++,m=0,F=!0}}else{if(L=L[0].match(LEVEL_PLAYLIST_REGEX_SLOW),!L){logger.warn("No matches on slow regex match for level playlist!");continue}for(k=1;k<L.length&&L[k]===void 0;k++);const te=(" "+L[k]).slice(1),re=(" "+L[k+1]).slice(1),me=L[k+2]?(" "+L[k+2]).slice(1):null;switch(te){case"BYTERANGE":C?I.setByteRange(re,C):I.setByteRange(re);break;case"PROGRAM-DATE-TIME":I.rawProgramDateTime=re,I.tagList.push(["PROGRAM-DATE-TIME",re]),O===-1&&(O=f.length);break;case"PLAYLIST-TYPE":u.type&&assignMultipleMediaPlaylistTagOccuranceError(u,te,L),u.type=re.toUpperCase();break;case"MEDIA-SEQUENCE":u.startSN!==0?assignMultipleMediaPlaylistTagOccuranceError(u,te,L):f.length>0&&assignMustAppearBeforeSegmentsError(u,te,L),E=u.startSN=parseInt(re);break;case"SKIP":{u.skippedSegments&&assignMultipleMediaPlaylistTagOccuranceError(u,te,L);const H=new AttrList(re,u),z=H.decimalInteger("SKIPPED-SEGMENTS");if(isFiniteNumber(z)){u.skippedSegments+=z;for(let ne=z;ne--;)f.push(null);E+=z}const ie=H.enumeratedString("RECENTLY-REMOVED-DATERANGES");ie&&(u.recentlyRemovedDateranges=(u.recentlyRemovedDateranges||[]).concat(ie.split(" ")));break}case"TARGETDURATION":u.targetduration!==0&&assignMultipleMediaPlaylistTagOccuranceError(u,te,L),u.targetduration=Math.max(parseInt(re),1);break;case"VERSION":u.version!==null&&assignMultipleMediaPlaylistTagOccuranceError(u,te,L),u.version=parseInt(re);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":u.live||assignMultipleMediaPlaylistTagOccuranceError(u,te,L),u.live=!1;break;case"#":(re||me)&&I.tagList.push(me?[re,me]:[re]);break;case"DISCONTINUITY":S++,I.tagList.push(["DIS"]);break;case"GAP":I.gap=!0,I.tagList.push([te]);break;case"BITRATE":I.tagList.push([te,re]),b=parseInt(re)*1e3,isFiniteNumber(b)?I.bitrate=b:b=0;break;case"DATERANGE":{const H=new AttrList(re,u),z=new DateRange(H,u.dateRanges[H.ID],u.dateRangeTagCount);u.dateRangeTagCount++,z.isValid||u.skippedSegments?u.dateRanges[z.id]=z:logger.warn(`Ignoring invalid DATERANGE tag: "${re}"`),I.tagList.push(["EXT-X-DATERANGE",re]);break}case"DEFINE":{{const H=new AttrList(re,u);"IMPORT"in H?importVariableDefinition(u,H,a):addVariableDefinition(u,H,t)}break}case"DISCONTINUITY-SEQUENCE":u.startCC!==0?assignMultipleMediaPlaylistTagOccuranceError(u,te,L):f.length>0&&assignMustAppearBeforeSegmentsError(u,te,L),u.startCC=S=parseInt(re);break;case"KEY":{const H=parseKey(re,t,u);if(H.isSupported()){if(H.method==="NONE"){U=void 0;break}U||(U={});const z=U[H.keyFormat];z!=null&&z.matches(H)||(z&&(U=_extends({},U)),U[H.keyFormat]=H)}else logger.warn(`[Keys] Ignoring unsupported EXT-X-KEY tag: "${re}"`);break}case"START":u.startTimeOffset=parseStartTimeOffset(re);break;case"MAP":{const H=new AttrList(re,u);if(I.duration){const z=new Fragment(s,c);setInitSegment(z,H,i,U),g=z,I.initSegment=g,g.rawProgramDateTime&&!I.rawProgramDateTime&&(I.rawProgramDateTime=g.rawProgramDateTime)}else{const z=I.byteRangeEndOffset;if(z){const ie=I.byteRangeStartOffset;G=`${z-ie}@${ie}`}else G=null;setInitSegment(I,H,i,U),g=I,F=!0}g.cc=S;break}case"SERVER-CONTROL":{x&&assignMultipleMediaPlaylistTagOccuranceError(u,te,L),x=new AttrList(re),u.canBlockReload=x.bool("CAN-BLOCK-RELOAD"),u.canSkipUntil=x.optionalFloat("CAN-SKIP-UNTIL",0),u.canSkipDateRanges=u.canSkipUntil>0&&x.bool("CAN-SKIP-DATERANGES"),u.partHoldBack=x.optionalFloat("PART-HOLD-BACK",0),u.holdBack=x.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{u.partTarget&&assignMultipleMediaPlaylistTagOccuranceError(u,te,L);const H=new AttrList(re);u.partTarget=H.decimalFloatingPoint("PART-TARGET");break}case"PART":{let H=u.partList;H||(H=u.partList=[]);const z=m>0?H[H.length-1]:void 0,ie=m++,ne=new AttrList(re,u),he=new Part(ne,I,c,ie,z);H.push(he),I.duration+=he.duration;break}case"PRELOAD-HINT":{const H=new AttrList(re,u);u.preloadHint=H;break}case"RENDITION-REPORT":{const H=new AttrList(re,u);u.renditionReports=u.renditionReports||[],u.renditionReports.push(H);break}default:logger.warn(`line parsed but not handled: ${L}`);break}}}C&&!C.relurl?(f.pop(),T-=C.duration,u.partList&&(u.fragmentHint=C)):u.partList&&(assignProgramDateTime(I,C,d),I.cc=S,u.fragmentHint=I,U&&setFragLevelKeys(I,U,u)),u.targetduration||(u.playlistParsingError=new Error("Missing Target Duration"));const $=f.length,X=f[0],Q=f[$-1];if(T+=u.skippedSegments*u.targetduration,T>0&&$&&Q){u.averagetargetduration=T/$;const ee=Q.sn;u.endSN=ee!=="initSegment"?ee:0,u.live||(Q.endList=!0),O>0&&(backfillProgramDateTimes(f,O),X&&d.unshift(X))}return u.fragmentHint&&(T+=u.fragmentHint.duration),u.totalduration=T,d.length&&u.dateRangeTagCount&&X&&mapDateRanges(d,u),u.endCC=S,u}}function mapDateRanges(r,e){let t=r.length;if(!t)if(e.hasProgramDateTime){const o=e.fragments[e.fragments.length-1];r.push(o),t++}else return;const i=r[t-1],s=e.live?1/0:e.totalduration,n=Object.keys(e.dateRanges);for(let o=n.length;o--;){const c=e.dateRanges[n[o]],u=c.startDate.getTime();c.tagAnchor=i.ref;for(let f=t;f--;){var a;if(((a=r[f])==null?void 0:a.sn)<e.startSN)break;const d=findFragmentWithStartDate(e,u,r,f,s);if(d!==-1){c.tagAnchor=e.fragments[d].ref;break}}}}function findFragmentWithStartDate(r,e,t,i,s){const n=t[i];if(n){const o=n.programDateTime;if(e>=o||i===0){var a;const c=(((a=t[i+1])==null?void 0:a.start)||s)-n.start;if(e<=o+c*1e3){const u=t[i].sn-r.startSN;if(u<0)return-1;const f=r.fragments;if(f.length>t.length){const g=(t[i+1]||f[f.length-1]).sn-r.startSN;for(let E=g;E>u;E--){const m=f[E].programDateTime;if(e>=m&&e<m+f[E].duration*1e3)return E}}return u}}}return-1}function parseKey(r,e,t){var i,s;const n=new AttrList(r,t),a=(i=n.METHOD)!=null?i:"",o=n.URI,c=n.hexadecimalInteger("IV"),u=n.KEYFORMATVERSIONS,f=(s=n.KEYFORMAT)!=null?s:"identity";o&&n.IV&&!c&&logger.error(`Invalid IV: ${n.IV}`);const d=o?M3U8Parser.resolve(o,e):"",g=(u||"1").split("/").map(Number).filter(Number.isFinite);return new LevelKey(a,d,f,g,c,n.KEYID)}function parseStartTimeOffset(r){const t=new AttrList(r).decimalFloatingPoint("TIME-OFFSET");return isFiniteNumber(t)?t:null}function setCodecs(r,e){let t=(r||"").split(/[ ,]+/).filter(i=>i);["video","audio","text"].forEach(i=>{const s=t.filter(n=>isCodecType(n,i));s.length&&(e[`${i}Codec`]=s.map(n=>n.split("/")[0]).join(","),t=t.filter(n=>s.indexOf(n)===-1))}),e.unknownCodecs=t}function assignCodec(r,e,t){const i=e[t];i&&(r[t]=i)}function backfillProgramDateTimes(r,e){let t=r[e];for(let i=e;i--;){const s=r[i];if(!s)return;s.programDateTime=t.programDateTime-s.duration*1e3,t=s}}function assignProgramDateTime(r,e,t){r.rawProgramDateTime?t.push(r):e!=null&&e.programDateTime&&(r.programDateTime=e.endProgramDateTime)}function setInitSegment(r,e,t,i){r.relurl=e.URI,e.BYTERANGE&&r.setByteRange(e.BYTERANGE),r.level=t,r.sn="initSegment",i&&(r.levelkeys=i),r.initSegment=null}function setFragLevelKeys(r,e,t){r.levelkeys=e;const{encryptedFragments:i}=t;(!i.length||i[i.length-1].levelkeys!==e)&&Object.keys(e).some(s=>e[s].isCommonEncryption)&&i.push(r)}function assignMultipleMediaPlaylistTagOccuranceError(r,e,t){r.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${t[0]})`)}function assignMustAppearBeforeSegmentsError(r,e,t){r.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${t[0]})`)}function updateFromToPTS(r,e){const t=e.startPTS;if(isFiniteNumber(t)){let i=0,s;e.sn>r.sn?(i=t-r.start,s=r):(i=r.start-t,s=e),s.duration!==i&&s.setDuration(i)}else e.sn>r.sn?r.cc===e.cc&&r.minEndPTS?e.setStart(r.start+(r.minEndPTS-r.start)):e.setStart(r.start+r.duration):e.setStart(Math.max(r.start-e.duration,0))}function updateFragPTSDTS(r,e,t,i,s,n,a){i-t<=0&&(a.warn("Fragment should have a positive duration",e),i=t+e.duration,n=s+e.duration);let c=t,u=i;const f=e.startPTS,d=e.endPTS;if(isFiniteNumber(f)){const b=Math.abs(f-t);r&&b>r.totalduration?a.warn(`media timestamps and playlist times differ by ${b}s for level ${e.level} ${r.url}`):isFiniteNumber(e.deltaPTS)?e.deltaPTS=Math.max(b,e.deltaPTS):e.deltaPTS=b,c=Math.max(t,f),t=Math.min(t,f),s=e.startDTS!==void 0?Math.min(s,e.startDTS):s,u=Math.min(i,d),i=Math.max(i,d),n=e.endDTS!==void 0?Math.max(n,e.endDTS):n}const g=t-e.start;e.start!==0&&e.setStart(t),e.setDuration(i-e.start),e.startPTS=t,e.maxStartPTS=c,e.startDTS=s,e.endPTS=i,e.minEndPTS=u,e.endDTS=n;const E=e.sn;if(!r||E<r.startSN||E>r.endSN)return 0;let m;const T=E-r.startSN,S=r.fragments;for(S[T]=e,m=T;m>0;m--)updateFromToPTS(S[m],S[m-1]);for(m=T;m<S.length-1;m++)updateFromToPTS(S[m],S[m+1]);return r.fragmentHint&&updateFromToPTS(S[S.length-1],r.fragmentHint),r.PTSKnown=r.alignedSliding=!0,g}function mergeDetails(r,e,t){if(r===e)return;let i=null;const s=r.fragments;for(let f=s.length-1;f>=0;f--){const d=s[f].initSegment;if(d){i=d;break}}r.fragmentHint&&delete r.fragmentHint.endPTS;let n;mapFragmentIntersection(r,e,(f,d,g,E)=>{if((!e.startCC||e.skippedSegments)&&d.cc!==f.cc){const m=f.cc-d.cc;for(let T=g;T<E.length;T++)E[T].cc+=m;e.endCC=E[E.length-1].cc}isFiniteNumber(f.startPTS)&&isFiniteNumber(f.endPTS)&&(d.setStart(d.startPTS=f.startPTS),d.startDTS=f.startDTS,d.maxStartPTS=f.maxStartPTS,d.endPTS=f.endPTS,d.endDTS=f.endDTS,d.minEndPTS=f.minEndPTS,d.setDuration(f.endPTS-f.startPTS),d.duration&&(n=d),e.PTSKnown=e.alignedSliding=!0),f.hasStreams&&(d.elementaryStreams=f.elementaryStreams),d.loader=f.loader,f.hasStats&&(d.stats=f.stats),f.initSegment&&(d.initSegment=f.initSegment,i=f.initSegment)});const a=e.fragments,o=e.fragmentHint?a.concat(e.fragmentHint):a;if(i&&o.forEach(f=>{var d;f&&(!f.initSegment||f.initSegment.relurl===((d=i)==null?void 0:d.relurl))&&(f.initSegment=i)}),e.skippedSegments){if(e.deltaUpdateFailed=a.some(f=>!f),e.deltaUpdateFailed){t.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let f=e.skippedSegments;f--;)a.shift();e.startSN=a[0].sn}else{e.canSkipDateRanges&&(e.dateRanges=mergeDateRanges(r.dateRanges,e,t));const f=r.fragments.filter(d=>d.rawProgramDateTime);if(r.hasProgramDateTime&&!e.hasProgramDateTime)for(let d=1;d<o.length;d++)o[d].programDateTime===null&&assignProgramDateTime(o[d],o[d-1],f);mapDateRanges(f,e)}e.endCC=a[a.length-1].cc}if(!e.startCC){var c;const f=getFragmentWithSN(r,e.startSN-1);e.startCC=(c=f?.cc)!=null?c:a[0].cc}mapPartIntersection(r.partList,e.partList,(f,d)=>{d.elementaryStreams=f.elementaryStreams,d.stats=f.stats}),n?updateFragPTSDTS(e,n,n.startPTS,n.endPTS,n.startDTS,n.endDTS,t):adjustSliding(r,e),a.length&&(e.totalduration=e.edge-a[0].start),e.driftStartTime=r.driftStartTime,e.driftStart=r.driftStart;const u=e.advancedDateTime;if(e.advanced&&u){const f=e.edge;e.driftStart||(e.driftStartTime=u,e.driftStart=f),e.driftEndTime=u,e.driftEnd=f}else e.driftEndTime=r.driftEndTime,e.driftEnd=r.driftEnd,e.advancedDateTime=r.advancedDateTime;e.requestScheduled===-1&&(e.requestScheduled=r.requestScheduled)}function mergeDateRanges(r,e,t){const{dateRanges:i,recentlyRemovedDateranges:s}=e,n=_extends({},r);s&&s.forEach(c=>{delete n[c]});const o=Object.keys(n).length;return o?(Object.keys(i).forEach(c=>{const u=n[c],f=new DateRange(i[c].attr,u);f.isValid?(n[c]=f,u||(f.tagOrder+=o)):t.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${stringify(i[c].attr)}"`)}),n):i}function mapPartIntersection(r,e,t){if(r&&e){let i=0;for(let s=0,n=r.length;s<=n;s++){const a=r[s],o=e[s+i];a&&o&&a.index===o.index&&a.fragment.sn===o.fragment.sn?t(a,o):i--}}}function mapFragmentIntersection(r,e,t){const i=e.skippedSegments,s=Math.max(r.startSN,e.startSN)-e.startSN,n=(r.fragmentHint?1:0)+(i?e.endSN:Math.min(r.endSN,e.endSN))-e.startSN,a=e.startSN-r.startSN,o=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,c=r.fragmentHint?r.fragments.concat(r.fragmentHint):r.fragments;for(let u=s;u<=n;u++){const f=c[a+u];let d=o[u];if(i&&!d&&f&&(d=e.fragments[u]=f),f&&d){t(f,d,u,o);const g=f.relurl,E=d.relurl;if(g&¬EqualAfterStrippingQueries(g,E)){e.playlistParsingError=getSequenceError(`media sequence mismatch ${d.sn}:`,r,e,f,d);return}else if(f.cc!==d.cc){e.playlistParsingError=getSequenceError(`discontinuity sequence mismatch (${f.cc}!=${d.cc})`,r,e,f,d);return}}}}function getSequenceError(r,e,t,i,s){return new Error(`${r} ${s.url}
|
|
289
|
-
Playlist starting @${e.startSN}
|
|
290
|
-
${e.m3u8}
|
|
291
|
-
|
|
292
|
-
Playlist starting @${t.startSN}
|
|
293
|
-
${t.m3u8}`)}function adjustSliding(r,e,t=!0){const i=e.startSN+e.skippedSegments-r.startSN,s=r.fragments,n=i>=0;let a=0;if(n&&i<s.length)a=s[i].start;else if(n&&e.startSN===r.endSN+1)a=r.fragmentEnd;else if(n&&t)a=r.fragmentStart+i*e.levelTargetDuration;else if(!e.skippedSegments&&e.fragmentStart===0)a=r.fragmentStart;else return;addSliding(e,a)}function addSliding(r,e){if(e){const t=r.fragments;for(let i=r.skippedSegments;i<t.length;i++)t[i].addStart(e);r.fragmentHint&&r.fragmentHint.addStart(e)}}function computeReloadInterval(r,e=1/0){let t=1e3*r.targetduration;if(r.updated){const i=r.fragments;if(i.length&&t*4>e){const n=i[i.length-1].duration*1e3;n<t&&(t=n)}}else t/=2;return Math.round(t)}function getFragmentWithSN(r,e,t){if(!r)return null;let i=r.fragments[e-r.startSN];return i||(i=r.fragmentHint,i&&i.sn===e)?i:e<r.startSN&&t&&t.sn===e?t:null}function getPartWith(r,e,t){return r?findPart(r.partList,e,t):null}function findPart(r,e,t){if(r)for(let i=r.length;i--;){const s=r[i];if(s.index===t&&s.fragment.sn===e)return s}return null}function reassignFragmentLevelIndexes(r){r.forEach((e,t)=>{var i;(i=e.details)==null||i.fragments.forEach(s=>{s.level=t,s.initSegment&&(s.initSegment.level=t)})})}function notEqualAfterStrippingQueries(r,e){return r!==e&&e?stripQuery(r)!==stripQuery(e):!1}function stripQuery(r){return r.replace(/\?[^?]*$/,"")}function findFirstFragWithCC(r,e){for(let i=0,s=r.length;i<s;i++){var t;if(((t=r[i])==null?void 0:t.cc)===e)return r[i]}return null}function shouldAlignOnDiscontinuities(r,e){return!!(r&&e.startCC<r.endCC&&e.endCC>r.startCC)}function adjustFragmentStart(r,e){const t=r.start+e;r.startPTS=t,r.setStart(t),r.endPTS=t+r.duration}function adjustSlidingStart(r,e){const t=e.fragments;for(let i=0,s=t.length;i<s;i++)adjustFragmentStart(t[i],r);e.fragmentHint&&adjustFragmentStart(e.fragmentHint,r),e.alignedSliding=!0}function alignStream(r,e){r&&(alignDiscontinuities(e,r),e.alignedSliding||alignMediaPlaylistByPDT(e,r),!e.alignedSliding&&!e.skippedSegments&&adjustSliding(r,e,!1))}function alignDiscontinuities(r,e){if(!shouldAlignOnDiscontinuities(e,r))return;const t=Math.min(e.endCC,r.endCC),i=findFirstFragWithCC(e.fragments,t),s=findFirstFragWithCC(r.fragments,t);if(!i||!s)return;logger.log(`Aligning playlist at start of dicontinuity sequence ${t}`);const n=i.start-s.start;adjustSlidingStart(n,r)}function alignMediaPlaylistByPDT(r,e){if(!r.hasProgramDateTime||!e.hasProgramDateTime)return;const t=r.fragments,i=e.fragments;if(!t.length||!i.length)return;let s,n;const a=Math.min(e.endCC,r.endCC);e.startCC<a&&r.startCC<a&&(s=findFirstFragWithCC(i,a),n=findFirstFragWithCC(t,a)),(!s||!n)&&(s=i[Math.floor(i.length/2)],n=findFirstFragWithCC(t,s.cc)||t[Math.floor(t.length/2)]);const o=s.programDateTime,c=n.programDateTime;if(!o||!c)return;const u=(c-o)/1e3-(n.start-s.start);adjustSlidingStart(u,r)}function addEventListener(r,e,t){removeEventListener(r,e,t),r.addEventListener(e,t)}function removeEventListener(r,e,t){r.removeEventListener(e,t)}const TimeRanges={toString:function(r){let e="";const t=r.length;for(let i=0;i<t;i++)e+=`[${r.start(i).toFixed(3)}-${r.end(i).toFixed(3)}]`;return e}},State={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"};class BaseStreamController extends TaskLoop{constructor(e,t,i,s,n){super(s,e.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=State.STOPPED,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.buffering=!0,this.loadingParts=!1,this.loopSn=void 0,this.onMediaSeeking=()=>{const{config:a,fragCurrent:o,media:c,mediaBuffer:u,state:f}=this,d=c?c.currentTime:0,g=BufferHelper.bufferInfo(u||c,d,a.maxBufferHole),E=!g.len;if(this.log(`Media seeking to ${isFiniteNumber(d)?d.toFixed(3):d}, state: ${f}, ${E?"out of":"in"} buffer`),this.state===State.ENDED)this.resetLoadingState();else if(o){const m=a.maxFragLookUpTolerance,T=o.start-m,S=o.start+o.duration+m;if(E||S<g.start||T>g.end){const b=d>S;(d<T||b)&&(b&&o.loader&&(this.log(`Cancelling fragment load for seek (sn: ${o.sn})`),o.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}if(c){this.fragmentTracker.removeFragmentsInRange(d,1/0,this.playlistType,!0);const m=this.lastCurrentTime;if(d>m&&(this.lastCurrentTime=d),!this.loadingParts){const T=Math.max(g.end,d),S=this.shouldLoadParts(this.getLevelDetails(),T);S&&(this.log(`LL-Part loading ON after seeking to ${d.toFixed(2)} with buffer @${T.toFixed(2)}`),this.loadingParts=S)}}this.hls.hasEnoughToStart||(this.log(`Setting ${E?"startPosition":"nextLoadPosition"} to ${d} for seek without enough to start`),this.nextLoadPosition=d,E&&(this.startPosition=d)),E&&this.state===State.IDLE&&this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=n,this.hls=e,this.fragmentLoader=new FragmentLoader(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new Decrypter(e.config)}registerListeners(){const{hls:e}=this;e.on(Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(Events.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(Events.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===State.STOPPED)return;this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=State.STOPPED}get startPositionValue(){const{nextLoadPosition:e,startPosition:t}=this;return t===-1&&e?e:t}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(e,t){if(t.live||!this.media)return!1;const i=e.end||0,s=this.config.timelineOffset||0;if(i<=s)return!1;const n=e.buffered;this.config.maxBufferHole&&n&&n.length>1&&(e=BufferHelper.bufferedInfo(n,e.start,0));const a=e.nextStart;if(a&&a>s&&a<t.edge||this.media.currentTime<e.start)return!1;const c=t.partList;if(c!=null&&c.length){const f=c[c.length-1];return BufferHelper.isBuffered(this.media,f.start+f.duration/2)}const u=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(u)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null)return this.levelLastLoaded.details}get timelineOffset(){const e=this.config.timelineOffset;if(e){var t;return((t=this.getLevelDetails())==null?void 0:t.appliedTimelineOffset)||e}return 0}onMediaAttached(e,t){const i=this.media=this.mediaBuffer=t.media;addEventListener(i,"seeking",this.onMediaSeeking),addEventListener(i,"ended",this.onMediaEnded);const s=this.config;this.levels&&s.autoStartLoad&&this.state===State.STOPPED&&this.startLoad(s.startPosition)}onMediaDetaching(e,t){const i=!!t.transferMedia,s=this.media;if(s!==null){if(s.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),removeEventListener(s,"seeking",this.onMediaSeeking),removeEventListener(s,"ended",this.onMediaEnded),this.keyLoader&&!i&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,i){this.resetLoadingState(),this.resetTransmuxer();return}this.loadingParts=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}}onManifestLoading(){this.initPTS=[],this.levels=this.levelLastLoaded=this.fragCurrent=null,this.lastCurrentTime=this.startPosition=0,this.startFragRequested=!1}onError(e,t){}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset}onHandlerDestroying(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),super.onHandlerDestroying(),this.hls=this.onMediaSeeking=this.onMediaEnded=null}onHandlerDestroyed(){this.state=State.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,t,i){this.startFragRequested=!0,this._loadFragForPlayback(e,t,i)}_loadFragForPlayback(e,t,i){const s=n=>{const a=n.frag;if(this.fragContextChanged(a)){this.warn(`${a.type} sn: ${a.sn}${n.part?" part: "+n.part.index:""} of ${this.fragInfo(a,!1,n.part)}) was dropped during download.`),this.fragmentTracker.removeFragment(a);return}a.stats.chunkCount++,this._handleFragmentLoadProgress(n)};this._doFragLoad(e,t,i,s).then(n=>{if(!n)return;const a=this.state,o=n.frag;if(this.fragContextChanged(o)){(a===State.FRAG_LOADING||!this.fragCurrent&&a===State.PARSING)&&(this.fragmentTracker.removeFragment(o),this.state=State.IDLE);return}"payload"in n&&(this.log(`Loaded ${o.type} sn: ${o.sn} of ${this.playlistLabel()} ${o.level}`),this.hls.trigger(Events.FRAG_LOADED,n)),this._handleFragmentLoadComplete(n)}).catch(n=>{this.state===State.STOPPED||this.state===State.ERROR||(this.warn(`Frag error: ${n?.message||n}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:i}=this;if(i.getState(e)===FragmentState.APPENDING){const n=e.type,a=this.getFwdBufferInfo(this.mediaBuffer,n),o=Math.max(e.duration,a?a.len:this.config.maxBufferLength),c=this.backtrackFragment;((c?e.sn-c.sn:0)===1||this.reduceMaxBufferLength(o,e.duration))&&i.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?i.removeAllFragments():i.hasParts(e.type)&&(i.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),i.getState(e)===FragmentState.PARTIAL&&i.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}waitForLive(e){const t=e.details;return t?.live&&t.type!=="EVENT"&&(this.levelLastLoaded!==e||t.expired)}flushMainBuffer(e,t,i=null){if(!(e-t))return;const s={startOffset:e,endOffset:t,type:i};this.hls.trigger(Events.BUFFER_FLUSHING,s)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(i=>{const s=i?.frag;if(!s||this.fragContextChanged(s)||!this.levels)throw new Error("init load aborted");return i}).then(i=>{const{hls:s}=this,{frag:n,payload:a}=i,o=n.decryptdata;if(a&&a.byteLength>0&&o!=null&&o.key&&o.iv&&isFullSegmentEncryption(o.method)){const c=self.performance.now();return this.decrypter.decrypt(new Uint8Array(a),o.key.buffer,o.iv.buffer,getAesModeFromFullSegmentMethod(o.method)).catch(u=>{throw s.trigger(Events.ERROR,{type:ErrorTypes.MEDIA_ERROR,details:ErrorDetails.FRAG_DECRYPT_ERROR,fatal:!1,error:u,reason:u.message,frag:n}),u}).then(u=>{const f=self.performance.now();return s.trigger(Events.FRAG_DECRYPTED,{frag:n,payload:u,stats:{tstart:c,tdecrypt:f}}),i.payload=u,this.completeInitSegmentLoad(i)})}return this.completeInitSegmentLoad(i)}).catch(i=>{this.state===State.STOPPED||this.state===State.ERROR||(this.warn(i),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const i=e.frag.stats;this.state!==State.STOPPED&&(this.state=State.IDLE),e.frag.data=new Uint8Array(e.payload),i.parsing.start=i.buffering.start=self.performance.now(),i.parsing.end=i.buffering.end=self.performance.now(),this.tick()}unhandledEncryptionError(e,t){var i,s;const n=e.tracks;if(n&&!t.encrypted&&((i=n.audio)!=null&&i.encrypted||(s=n.video)!=null&&s.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){const a=this.media,o=new Error(`Encrypted track with no key in ${this.fragInfo(t)} (media ${a?"attached mediaKeys: "+a.mediaKeys:"detached"})`);return this.warn(o.message),!a||a.mediaKeys?!1:(this.hls.trigger(Events.ERROR,{type:ErrorTypes.KEY_SYSTEM_ERROR,details:ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!1,error:o,frag:t}),this.resetTransmuxer(),!0)}return!1}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){const i=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)} > buffer:${i?TimeRanges.toString(BufferHelper.getBuffered(i)):"(detached)"})`),isMediaFragment(e)){var s;if(e.type!==PlaylistLevelType.SUBTITLE){const a=e.elementaryStreams;if(!Object.keys(a).some(o=>!!a[o])){this.state=State.IDLE;return}}const n=(s=this.levels)==null?void 0:s[e.level];n!=null&&n.fragmentError&&(this.log(`Resetting level fragment error count of ${n.fragmentError} on frag buffered`),n.fragmentError=0)}this.state=State.IDLE}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:i,part:s,partsLoaded:n}=e,a=!n||n.length===0||n.some(c=>!c),o=new ChunkMetadata(i.level,i.sn,i.stats.chunkCount+1,0,s?s.index:-1,!a);t.flush(o)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,i=null,s){var n;this.fragCurrent=e;const a=t.details;if(!this.levels||!a)throw new Error(`frag load aborted, missing level${a?"":" detail"}s`);let o=null;if(e.encrypted&&!((n=e.decryptdata)!=null&&n.key)){if(this.log(`Loading key for ${e.sn} of [${a.startSN}-${a.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=State.KEY_LOADING,this.fragCurrent=e,o=this.keyLoader.load(e).then(g=>{if(!this.fragContextChanged(g.frag))return this.hls.trigger(Events.KEY_LOADED,g),this.state===State.KEY_LOADING&&(this.state=State.IDLE),g}),this.hls.trigger(Events.KEY_LOADING,{frag:e}),this.fragCurrent===null)return this.log("context changed in KEY_LOADING"),Promise.resolve(null)}else e.encrypted||(o=this.keyLoader.loadClear(e,a.encryptedFragments,this.startFragRequested),o&&this.log("[eme] blocking frag load until media-keys acquired"));const c=this.fragPrevious;if(isMediaFragment(e)&&(!c||e.sn!==c.sn)){const g=this.shouldLoadParts(t.details,e.end);g!==this.loadingParts&&(this.log(`LL-Part loading ${g?"ON":"OFF"} loading sn ${c?.sn}->${e.sn}`),this.loadingParts=g)}if(i=Math.max(e.start,i||0),this.loadingParts&&isMediaFragment(e)){const g=a.partList;if(g&&s){i>a.fragmentEnd&&a.fragmentHint&&(e=a.fragmentHint);const E=this.getNextPart(g,e,i);if(E>-1){const m=g[E];e=this.fragCurrent=m.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${m.index} (${E}/${g.length-1}) of ${this.fragInfo(e,!1,m)}) cc: ${e.cc} [${a.startSN}-${a.endSN}], target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=m.start+m.duration,this.state=State.FRAG_LOADING;let T;return o?T=o.then(S=>!S||this.fragContextChanged(S.frag)?null:this.doFragPartsLoad(e,m,t,s)).catch(S=>this.handleFragLoadError(S)):T=this.doFragPartsLoad(e,m,t,s).catch(S=>this.handleFragLoadError(S)),this.hls.trigger(Events.FRAG_LOADING,{frag:e,part:m,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):T}else if(!e.url||this.loadedEndOfParts(g,i))return Promise.resolve(null)}}if(isMediaFragment(e)&&this.loadingParts){var u;this.log(`LL-Part loading OFF after next part miss @${i.toFixed(2)} Check buffer at sn: ${e.sn} loaded parts: ${(u=a.partList)==null?void 0:u.filter(g=>g.loaded).map(g=>`[${g.start}-${g.end}]`)}`),this.loadingParts=!1}else if(!e.url)return Promise.resolve(null);this.log(`Loading ${e.type} sn: ${e.sn} of ${this.fragInfo(e,!1)}) cc: ${e.cc} ${"["+a.startSN+"-"+a.endSN+"]"}, target: ${parseFloat(i.toFixed(3))}`),isFiniteNumber(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=State.FRAG_LOADING;const f=this.config.progressive&&e.type!==PlaylistLevelType.SUBTITLE;let d;return f&&o?d=o.then(g=>!g||this.fragContextChanged(g.frag)?null:this.fragmentLoader.load(e,s)).catch(g=>this.handleFragLoadError(g)):d=Promise.all([this.fragmentLoader.load(e,f?s:void 0),o]).then(([g])=>(!f&&s&&s(g),g)).catch(g=>this.handleFragLoadError(g)),this.hls.trigger(Events.FRAG_LOADING,{frag:e,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):d}doFragPartsLoad(e,t,i,s){return new Promise((n,a)=>{var o;const c=[],u=(o=i.details)==null?void 0:o.partList,f=d=>{this.fragmentLoader.loadPart(e,d,s).then(g=>{c[d.index]=g;const E=g.part;this.hls.trigger(Events.FRAG_LOADED,g);const m=getPartWith(i.details,e.sn,d.index+1)||findPart(u,e.sn,d.index+1);if(m)f(m);else return n({frag:e,part:E,partsLoaded:c})}).catch(a)};f(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;t.frag&&t.details===ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):t.frag&&t.type===ErrorTypes.KEY_SYSTEM_ERROR?(t.frag.abortRequests(),this.resetStartWhenNotLoaded(),this.resetFragmentLoading(t.frag)):this.hls.trigger(Events.ERROR,t)}else this.hls.trigger(Events.ERROR,{type:ErrorTypes.OTHER_ERROR,details:ErrorDetails.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==State.PARSING){!this.fragCurrent&&this.state!==State.STOPPED&&this.state!==State.ERROR&&(this.state=State.IDLE);return}const{frag:i,part:s,level:n}=t,a=self.performance.now();i.stats.parsing.end=a,s&&(s.stats.parsing.end=a);const o=this.getLevelDetails(),u=o&&i.sn>o.endSN||this.shouldLoadParts(o,i.end);u!==this.loadingParts&&(this.log(`LL-Part loading ${u?"ON":"OFF"} after parsing segment ending @${i.end.toFixed(2)}`),this.loadingParts=u),this.updateLevelTiming(i,s,n,e.partial)}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e.partList){var i;const n=e.partList[0];if(n.fragment.type===PlaylistLevelType.SUBTITLE)return!1;const a=n.end+(((i=e.fragmentHint)==null?void 0:i.duration)||0);if(t>=a){var s;if((this.hls.hasEnoughToStart?((s=this.media)==null?void 0:s.currentTime)||this.lastCurrentTime:this.getLoadPosition())>n.start-n.fragment.duration)return!0}}}return!1}getCurrentContext(e){const{levels:t,fragCurrent:i}=this,{level:s,sn:n,part:a}=e;if(!(t!=null&&t[s]))return this.warn(`Levels object was unset while buffering fragment ${n} of ${this.playlistLabel()} ${s}. The current chunk will not be buffered.`),null;const o=t[s],c=o.details,u=a>-1?getPartWith(c,n,a):null,f=u?u.fragment:getFragmentWithSN(c,n,i);return f?(i&&i!==f&&(f.stats=i.stats),{frag:f,part:u,level:o}):null}bufferFragmentData(e,t,i,s,n){if(this.state!==State.PARSING)return;const{data1:a,data2:o}=e;let c=a;if(o&&(c=appendUint8Array(a,o)),!c.length)return;const u=this.initPTS[t.cc],f=u?-u.baseTime/u.timescale:void 0,d={type:e.type,frag:t,part:i,chunkMeta:s,offset:f,parent:t.type,data:c};if(this.hls.trigger(Events.BUFFER_APPENDING,d),e.dropped&&e.independent&&!i){if(n)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!BufferHelper.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const i=t.currentTime,s=BufferHelper.bufferInfo(t,i,0),n=e.duration,a=Math.min(this.config.maxFragLookUpTolerance*2,n*.25),o=Math.max(Math.min(e.start-a,s.end-a),i+a);e.start-o>a&&this.flushMainBuffer(o,e.start)}getFwdBufferInfo(e,t){var i;const s=this.getLoadPosition();if(!isFiniteNumber(s))return null;const a=this.lastCurrentTime>s||(i=this.media)!=null&&i.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,s,t,a)}getFwdBufferInfoAtPos(e,t,i,s){const n=BufferHelper.bufferInfo(e,t,s);if(n.len===0&&n.nextStart!==void 0){const a=this.fragmentTracker.getBufferedFrag(t,i);if(a&&(n.nextStart<=a.end||a.gap)){const o=Math.max(Math.min(n.nextStart,a.end)-t,s);return BufferHelper.bufferInfo(e,t,o)}}return n}getMaxBufferLength(e){const{config:t}=this;let i;return e?i=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):i=t.maxBufferLength,Math.min(i,t.maxMaxBufferLength)}reduceMaxBufferLength(e,t){const i=this.config,s=Math.max(Math.min(e-t,i.maxBufferLength),t),n=Math.max(e-t*3,i.maxMaxBufferLength/2,s);return n>=s?(i.maxMaxBufferLength=n,this.warn(`Reduce max buffer length to ${n}s`),!0):!1}getAppendedFrag(e,t=PlaylistLevelType.MAIN){const i=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(e,t):null;return i&&"fragment"in i?i.fragment:i}getNextFragment(e,t){const i=t.fragments,s=i.length;if(!s)return null;const{config:n}=this,a=i[0].start,o=n.lowLatencyMode&&!!t.partList;let c=null;if(t.live){const d=n.initialLiveManifestSize;if(s<d)return this.warn(`Not enough fragments to start playback (have: ${s}, need: ${d})`),null;if(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<a){var u;o&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),c=this.getInitialLiveFragment(t);const g=this.hls.startPosition,E=this.hls.liveSyncPosition,m=c?(g!==-1&&g>=a?g:E)||c.start:e;this.log(`Setting startPosition to ${m} to match start frag at live edge. mainStart: ${g} liveSyncPosition: ${E} frag.start: ${(u=c)==null?void 0:u.start}`),this.startPosition=this.nextLoadPosition=m}}else e<=a&&(c=i[0]);if(!c){const d=this.loadingParts?t.partEnd:t.fragmentEnd;c=this.getFragmentAtPosition(e,d,t)}let f=this.filterReplacedPrimary(c,t);if(!f&&c){const d=c.sn-t.startSN;f=this.filterReplacedPrimary(i[d+1]||null,t)}return this.mapToInitFragWhenRequired(f)}isLoopLoading(e,t){const i=this.fragmentTracker.getState(e);return(i===FragmentState.OK||i===FragmentState.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,i,s,n){let a=null;if(e.gap&&(a=this.getNextFragment(this.nextLoadPosition,t),a&&!a.gap&&i.nextStart)){const o=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,s,0);if(o!==null&&i.len+o.len>=n){const c=a.sn;return this.loopSn!==c&&(this.log(`buffer full after gaps in "${s}" playlist starting at sn: ${c}`),this.loopSn=c),null}}return this.loopSn=void 0,a}get primaryPrefetch(){if(interstitialsEnabled(this.config)){var e;if((e=this.hls.interstitialsManager)==null||(e=e.playingItem)==null?void 0:e.event)return!0}return!1}filterReplacedPrimary(e,t){if(!e)return e;if(interstitialsEnabled(this.config)&&e.type!==PlaylistLevelType.SUBTITLE){const i=this.hls.interstitialsManager,s=i?.bufferingItem;if(s){const a=s.event;if(a){if(a.appendInPlace||Math.abs(e.start-s.start)>1||s.start===0)return null}else if(e.end<=s.start&&t?.live===!1||e.start>s.end&&s.nextEvent&&(s.nextEvent.appendInPlace||e.start-s.end>1))return null}const n=i?.playerQueue;if(n)for(let a=n.length;a--;){const o=n[a].interstitial;if(o.appendInPlace&&e.start>=o.startTime&&e.end<=o.resumeTime)return null}}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!e.initSegment.data&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,i){let s=-1,n=!1,a=!0;for(let o=0,c=e.length;o<c;o++){const u=e[o];if(a=a&&!u.independent,s>-1&&i<u.start)break;const f=u.loaded;f?s=-1:(n||(u.independent||a)&&u.fragment===t)&&(u.fragment!==t&&this.warn(`Need buffer at ${i} but next unloaded part starts at ${u.start}`),s=o),n=f}return s}loadedEndOfParts(e,t){let i;for(let s=e.length;s--;){if(i=e[s],!i.loaded)return!1;if(t>i.start)return!0}return!1}getInitialLiveFragment(e){const t=e.fragments,i=this.fragPrevious;let s=null;if(i){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${i.programDateTime}`),s=findFragmentByPDT(t,i.endProgramDateTime,this.config.maxFragLookUpTolerance)),!s){const n=i.sn+1;if(n>=e.startSN&&n<=e.endSN){const a=t[n-e.startSN];i.cc===a.cc&&(s=a,this.log(`Live playlist, switching playlist, load frag with next SN: ${s.sn}`))}s||(s=findNearestWithCC(e,i.cc,i.end),s&&this.log(`Live playlist, switching playlist, load frag with same CC: ${s.sn}`))}}else{const n=this.hls.liveSyncPosition;n!==null&&(s=this.getFragmentAtPosition(n,this.bitrateTest?e.fragmentEnd:e.edge,e))}return s}getFragmentAtPosition(e,t,i){const{config:s}=this;let{fragPrevious:n}=this,{fragments:a,endSN:o}=i;const{fragmentHint:c}=i,{maxFragLookUpTolerance:u}=s,f=i.partList,d=!!(this.loadingParts&&f!=null&&f.length&&c);d&&!this.bitrateTest&&f[f.length-1].fragment.sn===c.sn&&(a=a.concat(c),o=c.sn);let g;if(e<t){var E;const T=e<this.lastCurrentTime||e>t-u||(E=this.media)!=null&&E.paused||!this.startFragRequested?0:u;g=findFragmentByPTS(n,a,e,T)}else g=a[a.length-1];if(g){const m=g.sn-i.startSN,T=this.fragmentTracker.getState(g);if((T===FragmentState.OK||T===FragmentState.PARTIAL&&g.gap)&&(n=g),n&&g.sn===n.sn&&(!d||f[0].fragment.sn>g.sn||!i.live)&&g.level===n.level){const b=a[m+1];g.sn<o&&this.fragmentTracker.getState(b)!==FragmentState.OK?g=b:g=null}}return g}alignPlaylists(e,t,i){const s=e.fragments.length;if(!s)return this.warn("No fragments in live playlist"),0;const n=e.fragmentStart,a=!t,o=e.alignedSliding&&isFiniteNumber(n);if(a||!o&&!n){alignStream(i,e);const c=e.fragmentStart;return this.log(`Live playlist sliding: ${c.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} fragments: ${s}`),c}return n}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let i=this.startPosition;i<t&&(i=-1);const s=this.timelineOffset;if(i===-1){const n=this.startTimeOffset!==null,a=n?this.startTimeOffset:e.startTimeOffset;a!==null&&isFiniteNumber(a)?(i=t+a,a<0&&(i+=e.edge),i=Math.min(Math.max(t,i),t+e.totalduration),this.log(`Setting startPosition to ${i} for start time offset ${a} found in ${n?"multivariant":"media"} playlist`),this.startPosition=i):e.live?(i=this.hls.liveSyncPosition||t,this.log(`Setting startPosition to -1 to start at live edge ${i}`),this.startPosition=-1):(this.log("setting startPosition to 0 by default"),this.startPosition=i=0),this.lastCurrentTime=i+s}this.nextLoadPosition=i+s}getLoadPosition(){var e;const{media:t}=this;let i=0;return(e=this.hls)!=null&&e.hasEnoughToStart&&t?i=t.currentTime:this.nextLoadPosition>=0&&(i=this.nextLoadPosition),i}handleFragLoadAborted(e,t){this.transmuxer&&e.type===this.playlistType&&isMediaFragment(e)&&e.stats.aborted&&(this.log(`Fragment ${e.sn}${t?" part "+t.index:""} of ${this.playlistLabel()} ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==State.FRAG_LOADING_WAITING_RETRY)&&(this.state=State.IDLE)}onFragmentOrKeyLoadError(e,t){var i;if(t.chunkMeta&&!t.frag){const b=this.getCurrentContext(t.chunkMeta);b&&(t.frag=b.frag)}const s=t.frag;if(!s||s.type!==e||!this.levels)return;if(this.fragContextChanged(s)){var n;this.warn(`Frag load error must match current frag to retry ${s.url} > ${(n=this.fragCurrent)==null?void 0:n.url}`);return}const a=t.details===ErrorDetails.FRAG_GAP;a&&this.fragmentTracker.fragBuffered(s,!0);const o=t.errorAction;if(!o){this.state=State.ERROR;return}const{action:c,flags:u,retryCount:f=0,retryConfig:d}=o,g=!!d,E=g&&c===NetworkErrorAction.RetryRequest,m=g&&!o.resolved&&u===ErrorActionFlags.MoveAllAlternatesMatchingHost,T=(i=this.hls.latestLevelDetails)==null?void 0:i.live;if(!E&&m&&isMediaFragment(s)&&!s.endList&&T&&!isUnusableKeyError(t))this.resetFragmentErrors(e),this.treatAsGap(s),o.resolved=!0;else if((E||m)&&f<d.maxNumRetry){var S;const b=offlineHttpStatus((S=t.response)==null?void 0:S.code),C=getRetryDelay(d,f);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+C,this.state=State.FRAG_LOADING_WAITING_RETRY,o.resolved=!0,b){this.log("Waiting for connection (offline)"),this.retryDate=1/0,t.reason="offline";return}this.warn(`Fragment ${s.sn} of ${e} ${s.level} errored with ${t.details}, retrying loading ${f+1}/${d.maxNumRetry} in ${C}ms`)}else if(d)if(this.resetFragmentErrors(e),f<d.maxNumRetry)!a&&c!==NetworkErrorAction.RemoveAlternatePermanently&&(o.resolved=!0);else{this.warn(`${t.details} reached or exceeded max retry (${f})`);return}else c===NetworkErrorAction.SendAlternateToPenaltyBox?this.state=State.WAITING_LEVEL:this.state=State.ERROR;this.tickImmediate()}checkRetryDate(){const e=self.performance.now(),t=this.retryDate,i=t===1/0;(!t||e>=t||i&&!offlineHttpStatus(0))&&(i&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=State.IDLE)}reduceLengthAndFlushBuffer(e){if(this.state===State.PARSING||this.state===State.PARSED){const t=e.frag,i=e.parent,s=this.getFwdBufferInfo(this.mediaBuffer,i),n=s&&s.len>.5;n&&this.reduceMaxBufferLength(s.len,t?.duration||10);const a=!n;return a&&this.warn(`Buffer full error while media.currentTime (${this.getLoadPosition()}) is not buffered, flush ${i} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),a}return!1}resetFragmentErrors(e){e===PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==State.STOPPED&&(this.state=State.IDLE)}afterBufferFlushed(e,t,i){if(!e)return;const s=BufferHelper.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,s,i),this.state===State.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==State.STOPPED&&(this.state=State.IDLE)}resetStartWhenNotLoaded(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const e=this.levelLastLoaded,t=e?e.details:null;t!=null&&t.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(t,t.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.log(`Loading context changed while buffering sn ${e.sn} of ${this.playlistLabel()} ${e.level===-1?"<removed>":e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,i,s){const n=i.details;if(!n){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((c,u)=>{const f=e.elementaryStreams[u];if(f){const d=f.endPTS-f.startPTS;if(d<=0)return this.warn(`Could not parse fragment ${e.sn} ${u} duration reliably (${d})`),c||!1;const g=s?0:updateFragPTSDTS(n,e,f.startPTS,f.endPTS,f.startDTS,f.endDTS,this);return this.hls.trigger(Events.LEVEL_PTS_UPDATED,{details:n,level:i,drift:g,type:u,frag:e,start:f.startPTS,end:f.endPTS}),!0}return c},!1)){var o;const c=((o=this.transmuxer)==null?void 0:o.error)===null;if((i.fragmentError===0||c&&(i.fragmentError<2||e.endList))&&this.treatAsGap(e,i),c){const u=new Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(u.message),this.hls.trigger(Events.ERROR,{type:ErrorTypes.MEDIA_ERROR,details:ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,error:u,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${i.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=State.PARSED,this.log(`Parsed ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)})`),this.hls.trigger(Events.FRAG_PARSED,{frag:e,part:t})}playlistLabel(){return this.playlistType===PlaylistLevelType.MAIN?"level":"track"}fragInfo(e,t=!0,i){var s,n;return`${this.playlistLabel()} ${e.level} (${i?"part":"frag"}:[${((s=t&&!i?e.startPTS:(i||e).start)!=null?s:NaN).toFixed(3)}-${((n=t&&!i?e.endPTS:(i||e).end)!=null?n:NaN).toFixed(3)}]${i&&e.type==="main"?"INDEPENDENT="+(i.independent?"YES":"NO"):""}`}treatAsGap(e,t){t&&t.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)}resetTransmuxer(){var e;(e=this.transmuxer)==null||e.reset()}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}function interstitialsEnabled(r){return!!r.interstitialsController&&r.enableInterstitialPlayback!==!1}class ChunkCache{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let i;if(e.length)e.length===1?i=e[0]:i=concatUint8Arrays(e,t);else return new Uint8Array(0);return this.reset(),i}reset(){this.chunks.length=0,this.dataLength=0}}function concatUint8Arrays(r,e){const t=new Uint8Array(e);let i=0;for(let s=0;s<r.length;s++){const n=r[s];t.set(n,i),i+=n.length}return t}var eventemitter3={exports:{}},hasRequiredEventemitter3;function requireEventemitter3(){return hasRequiredEventemitter3||(hasRequiredEventemitter3=1,(function(r){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function s(c,u,f){this.fn=c,this.context=u,this.once=f||!1}function n(c,u,f,d,g){if(typeof f!="function")throw new TypeError("The listener must be a function");var E=new s(f,d||c,g),m=t?t+u:u;return c._events[m]?c._events[m].fn?c._events[m]=[c._events[m],E]:c._events[m].push(E):(c._events[m]=E,c._eventsCount++),c}function a(c,u){--c._eventsCount===0?c._events=new i:delete c._events[u]}function o(){this._events=new i,this._eventsCount=0}o.prototype.eventNames=function(){var u=[],f,d;if(this._eventsCount===0)return u;for(d in f=this._events)e.call(f,d)&&u.push(t?d.slice(1):d);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(f)):u},o.prototype.listeners=function(u){var f=t?t+u:u,d=this._events[f];if(!d)return[];if(d.fn)return[d.fn];for(var g=0,E=d.length,m=new Array(E);g<E;g++)m[g]=d[g].fn;return m},o.prototype.listenerCount=function(u){var f=t?t+u:u,d=this._events[f];return d?d.fn?1:d.length:0},o.prototype.emit=function(u,f,d,g,E,m){var T=t?t+u:u;if(!this._events[T])return!1;var S=this._events[T],b=arguments.length,C,I;if(S.fn){switch(S.once&&this.removeListener(u,S.fn,void 0,!0),b){case 1:return S.fn.call(S.context),!0;case 2:return S.fn.call(S.context,f),!0;case 3:return S.fn.call(S.context,f,d),!0;case 4:return S.fn.call(S.context,f,d,g),!0;case 5:return S.fn.call(S.context,f,d,g,E),!0;case 6:return S.fn.call(S.context,f,d,g,E,m),!0}for(I=1,C=new Array(b-1);I<b;I++)C[I-1]=arguments[I];S.fn.apply(S.context,C)}else{var L=S.length,k;for(I=0;I<L;I++)switch(S[I].once&&this.removeListener(u,S[I].fn,void 0,!0),b){case 1:S[I].fn.call(S[I].context);break;case 2:S[I].fn.call(S[I].context,f);break;case 3:S[I].fn.call(S[I].context,f,d);break;case 4:S[I].fn.call(S[I].context,f,d,g);break;default:if(!C)for(k=1,C=new Array(b-1);k<b;k++)C[k-1]=arguments[k];S[I].fn.apply(S[I].context,C)}}return!0},o.prototype.on=function(u,f,d){return n(this,u,f,d,!1)},o.prototype.once=function(u,f,d){return n(this,u,f,d,!0)},o.prototype.removeListener=function(u,f,d,g){var E=t?t+u:u;if(!this._events[E])return this;if(!f)return a(this,E),this;var m=this._events[E];if(m.fn)m.fn===f&&(!g||m.once)&&(!d||m.context===d)&&a(this,E);else{for(var T=0,S=[],b=m.length;T<b;T++)(m[T].fn!==f||g&&!m[T].once||d&&m[T].context!==d)&&S.push(m[T]);S.length?this._events[E]=S.length===1?S[0]:S:a(this,E)}return this},o.prototype.removeAllListeners=function(u){var f;return u?(f=t?t+u:u,this._events[f]&&a(this,f)):(this._events=new i,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=t,o.EventEmitter=o,r.exports=o})(eventemitter3)),eventemitter3.exports}var eventemitter3Exports=requireEventemitter3(),EventEmitter=getDefaultExportFromCjs(eventemitter3Exports);const version="1.6.15",workerStore={};function hasUMDWorker(){return typeof __HLS_WORKER_BUNDLE__=="function"}function injectWorker(){const r=workerStore[version];if(r)return r.clientCount++,r;const e=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),t=self.URL.createObjectURL(e),s={worker:new self.Worker(t),objectURL:t,clientCount:1};return workerStore[version]=s,s}function loadWorker(r){const e=workerStore[r];if(e)return e.clientCount++,e;const t=new self.URL(r,self.location.href).href,s={worker:new self.Worker(t),scriptURL:t,clientCount:1};return workerStore[r]=s,s}function removeWorkerFromStore(r){const e=workerStore[r||version];if(e&&e.clientCount--===1){const{worker:i,objectURL:s}=e;delete workerStore[r||version],s&&self.URL.revokeObjectURL(s),i.terminate()}}function isId3Footer(r,e){return e+10<=r.length&&r[e]===51&&r[e+1]===68&&r[e+2]===73&&r[e+3]<255&&r[e+4]<255&&r[e+6]<128&&r[e+7]<128&&r[e+8]<128&&r[e+9]<128}function isId3Header(r,e){return e+10<=r.length&&r[e]===73&&r[e+1]===68&&r[e+2]===51&&r[e+3]<255&&r[e+4]<255&&r[e+6]<128&&r[e+7]<128&&r[e+8]<128&&r[e+9]<128}function readId3Size(r,e){let t=0;return t=(r[e]&127)<<21,t|=(r[e+1]&127)<<14,t|=(r[e+2]&127)<<7,t|=r[e+3]&127,t}function getId3Data(r,e){const t=e;let i=0;for(;isId3Header(r,e);){i+=10;const s=readId3Size(r,e+6);i+=s,isId3Footer(r,e+10)&&(i+=10),e+=i}if(i>0)return r.subarray(t,t+i)}function getAudioConfig(r,e,t,i){const s=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],n=e[t+2],a=n>>2&15;if(a>12){const E=new Error(`invalid ADTS sampling index:${a}`);r.emit(Events.ERROR,Events.ERROR,{type:ErrorTypes.MEDIA_ERROR,details:ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,error:E,reason:E.message});return}const o=(n>>6&3)+1,c=e[t+3]>>6&3|(n&1)<<2,u="mp4a.40."+o,f=s[a];let d=a;(o===5||o===29)&&(d-=3);const g=[o<<3|(d&14)>>1,(d&1)<<7|c<<3];return logger.log(`manifest codec:${i}, parsed codec:${u}, channels:${c}, rate:${f} (ADTS object type:${o} sampling index:${a})`),{config:g,samplerate:f,channelCount:c,codec:u,parsedCodec:u,manifestCodec:i}}function isHeaderPattern$1(r,e){return r[e]===255&&(r[e+1]&246)===240}function getHeaderLength(r,e){return r[e+1]&1?7:9}function getFullFrameLength(r,e){return(r[e+3]&3)<<11|r[e+4]<<3|(r[e+5]&224)>>>5}function canGetFrameLength(r,e){return e+5<r.length}function isHeader$1(r,e){return e+1<r.length&&isHeaderPattern$1(r,e)}function canParse$1(r,e){return canGetFrameLength(r,e)&&isHeaderPattern$1(r,e)&&getFullFrameLength(r,e)<=r.length-e}function probe$1(r,e){if(isHeader$1(r,e)){const t=getHeaderLength(r,e);if(e+t>=r.length)return!1;const i=getFullFrameLength(r,e);if(i<=t)return!1;const s=e+i;return s===r.length||isHeader$1(r,s)}return!1}function initTrackConfig(r,e,t,i,s){if(!r.samplerate){const n=getAudioConfig(e,t,i,s);if(!n)return;_extends(r,n)}}function getFrameDuration(r){return 1024*9e4/r}function parseFrameHeader(r,e){const t=getHeaderLength(r,e);if(e+t<=r.length){const i=getFullFrameLength(r,e)-t;if(i>0)return{headerLength:t,frameLength:i}}}function appendFrame$2(r,e,t,i,s){const n=getFrameDuration(r.samplerate),a=i+s*n,o=parseFrameHeader(e,t);let c;if(o){const{frameLength:d,headerLength:g}=o,E=g+d,m=Math.max(0,t+E-e.length);m?(c=new Uint8Array(E-g),c.set(e.subarray(t+g,e.length),0)):c=e.subarray(t+g,t+E);const T={unit:c,pts:a};return m||r.samples.push(T),{sample:T,length:E,missing:m}}const u=e.length-t;return c=new Uint8Array(u),c.set(e.subarray(t,e.length),0),{sample:{unit:c,pts:a},length:u,missing:-1}}function canParseId3(r,e){return isId3Header(r,e)&&readId3Size(r,e+6)+10<=r.length-e}function toArrayBuffer(r){return r instanceof ArrayBuffer?r:r.byteOffset==0&&r.byteLength==r.buffer.byteLength?r.buffer:new Uint8Array(r).buffer}function toUint8(r,e=0,t=1/0){return view(r,e,t,Uint8Array)}function view(r,e,t,i){const s=unsafeGetArrayBuffer(r);let n=1;"BYTES_PER_ELEMENT"in i&&(n=i.BYTES_PER_ELEMENT);const a=isArrayBufferView(r)?r.byteOffset:0,o=(a+r.byteLength)/n,c=(a+e)/n,u=Math.floor(Math.max(0,Math.min(c,o))),f=Math.floor(Math.min(u+Math.max(t,0),o));return new i(s,u,f-u)}function unsafeGetArrayBuffer(r){return r instanceof ArrayBuffer?r:r.buffer}function isArrayBufferView(r){return r&&r.buffer instanceof ArrayBuffer&&r.byteLength!==void 0&&r.byteOffset!==void 0}function decodeId3ImageFrame(r){const e={key:r.type,description:"",data:"",mimeType:null,pictureType:null},t=3;if(r.size<2)return;if(r.data[0]!==t){console.log("Ignore frame with unrecognized character encoding");return}const i=r.data.subarray(1).indexOf(0);if(i===-1)return;const s=utf8ArrayToStr(toUint8(r.data,1,i)),n=r.data[2+i],a=r.data.subarray(3+i).indexOf(0);if(a===-1)return;const o=utf8ArrayToStr(toUint8(r.data,3+i,a));let c;return s==="-->"?c=utf8ArrayToStr(toUint8(r.data,4+i+a)):c=toArrayBuffer(r.data.subarray(4+i+a)),e.mimeType=s,e.pictureType=n,e.description=o,e.data=c,e}function decodeId3PrivFrame(r){if(r.size<2)return;const e=utf8ArrayToStr(r.data,!0),t=new Uint8Array(r.data.subarray(e.length+1));return{key:r.type,info:e,data:t.buffer}}function decodeId3TextFrame(r){if(r.size<2)return;if(r.type==="TXXX"){let t=1;const i=utf8ArrayToStr(r.data.subarray(t),!0);t+=i.length+1;const s=utf8ArrayToStr(r.data.subarray(t));return{key:r.type,info:i,data:s}}const e=utf8ArrayToStr(r.data.subarray(1));return{key:r.type,info:"",data:e}}function decodeId3UrlFrame(r){if(r.type==="WXXX"){if(r.size<2)return;let t=1;const i=utf8ArrayToStr(r.data.subarray(t),!0);t+=i.length+1;const s=utf8ArrayToStr(r.data.subarray(t));return{key:r.type,info:i,data:s}}const e=utf8ArrayToStr(r.data);return{key:r.type,info:"",data:e}}function decodeId3Frame(r){return r.type==="PRIV"?decodeId3PrivFrame(r):r.type[0]==="W"?decodeId3UrlFrame(r):r.type==="APIC"?decodeId3ImageFrame(r):decodeId3TextFrame(r)}function getId3FrameData(r){const e=String.fromCharCode(r[0],r[1],r[2],r[3]),t=readId3Size(r,4),i=10;return{type:e,size:t,data:r.subarray(i,i+t)}}const HEADER_FOOTER_SIZE=10,FRAME_SIZE=10;function getId3Frames(r){let e=0;const t=[];for(;isId3Header(r,e);){const i=readId3Size(r,e+6);r[e+5]>>6&1&&(e+=HEADER_FOOTER_SIZE),e+=HEADER_FOOTER_SIZE;const s=e+i;for(;e+FRAME_SIZE<s;){const n=getId3FrameData(r.subarray(e)),a=decodeId3Frame(n);a&&t.push(a),e+=n.size+HEADER_FOOTER_SIZE}isId3Footer(r,e)&&(e+=HEADER_FOOTER_SIZE)}return t}function isId3TimestampFrame(r){return r&&r.key==="PRIV"&&r.info==="com.apple.streaming.transportStreamTimestamp"}function readId3Timestamp(r){if(r.data.byteLength===8){const e=new Uint8Array(r.data),t=e[3]&1;let i=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return i/=45,t&&(i+=4772185884e-2),Math.round(i)}}function getId3Timestamp(r){const e=getId3Frames(r);for(let t=0;t<e.length;t++){const i=e[t];if(isId3TimestampFrame(i))return readId3Timestamp(i)}}let MetadataSchema=(function(r){return r.audioId3="org.id3",r.dateRange="com.apple.quicktime.HLS",r.emsg="https://aomedia.org/emsg/ID3",r.misbklv="urn:misb:KLV:bin:1910.1",r})({});function dummyTrack(r="",e=9e4){return{type:r,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class BaseAudioDemuxer{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,t,i,s){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,i){}demux(e,t){this.cachedData&&(e=appendUint8Array(this.cachedData,e),this.cachedData=null);let i=getId3Data(e,0),s=i?i.length:0,n;const a=this._audioTrack,o=this._id3Track,c=i?getId3Timestamp(i):void 0,u=e.length;for((this.basePTS===null||this.frameIndex===0&&isFiniteNumber(c))&&(this.basePTS=initPTSFn(c,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),i&&i.length>0&&o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:MetadataSchema.audioId3,duration:Number.POSITIVE_INFINITY});s<u;){if(this.canParse(e,s)){const f=this.appendFrame(a,e,s);f?(this.frameIndex++,this.lastPTS=f.sample.pts,s+=f.length,n=s):s=u}else canParseId3(e,s)?(i=getId3Data(e,s),o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:MetadataSchema.audioId3,duration:Number.POSITIVE_INFINITY}),s+=i.length,n=s):s++;if(s===u&&n!==u){const f=e.slice(n);this.cachedData?this.cachedData=appendUint8Array(this.cachedData,f):this.cachedData=f}}return{audioTrack:a,videoTrack:dummyTrack(),id3Track:o,textTrack:dummyTrack()}}demuxSampleAes(e,t,i){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){const t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:dummyTrack(),id3Track:this._id3Track,textTrack:dummyTrack()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const initPTSFn=(r,e,t)=>{if(isFiniteNumber(r))return r*90;const i=t?t.baseTime*9e4/t.timescale:0;return e*9e4+i};let chromeVersion$1=null;const BitratesMap=[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],SamplingRateMap=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],SamplesCoefficients=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],BytesInSlot=[0,1,1,4];function appendFrame$1(r,e,t,i,s){if(t+24>e.length)return;const n=parseHeader(e,t);if(n&&t+n.frameLength<=e.length){const a=n.samplesPerFrame*9e4/n.sampleRate,o=i+s*a,c={unit:e.subarray(t,t+n.frameLength),pts:o,dts:o};return r.config=[],r.channelCount=n.channelCount,r.samplerate=n.sampleRate,r.samples.push(c),{sample:c,length:n.frameLength,missing:0}}}function parseHeader(r,e){const t=r[e+1]>>3&3,i=r[e+1]>>1&3,s=r[e+2]>>4&15,n=r[e+2]>>2&3;if(t!==1&&s!==0&&s!==15&&n!==3){const a=r[e+2]>>1&1,o=r[e+3]>>6,c=t===3?3-i:i===3?3:4,u=BitratesMap[c*14+s-1]*1e3,d=SamplingRateMap[(t===3?0:t===2?1:2)*3+n],g=o===3?1:2,E=SamplesCoefficients[t][i],m=BytesInSlot[i],T=E*8*m,S=Math.floor(E*u/d+a)*m;if(chromeVersion$1===null){const I=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);chromeVersion$1=I?parseInt(I[1]):0}return chromeVersion$1&&chromeVersion$1<=87&&i===2&&u>=224e3&&o===0&&(r[e+3]=r[e+3]|128),{sampleRate:d,channelCount:g,frameLength:S,samplesPerFrame:T}}}function isHeaderPattern(r,e){return r[e]===255&&(r[e+1]&224)===224&&(r[e+1]&6)!==0}function isHeader(r,e){return e+1<r.length&&isHeaderPattern(r,e)}function canParse(r,e){return isHeaderPattern(r,e)&&4<=r.length-e}function probe(r,e){if(e+1<r.length&&isHeaderPattern(r,e)){const i=parseHeader(r,e);let s=4;i!=null&&i.frameLength&&(s=i.frameLength);const n=e+s;return n===r.length||isHeader(r,n)}return!1}class AACDemuxer extends BaseAudioDemuxer{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,i,s){super.resetInitSegment(e,t,i,s),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:s,inputTimeScale:9e4,dropped:0}}static probe(e,t){if(!e)return!1;const i=getId3Data(e,0);let s=i?.length||0;if(probe(e,s))return!1;for(let n=e.length;s<n;s++)if(probe$1(e,s))return t.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return canParse$1(e,t)}appendFrame(e,t,i){initTrackConfig(e,this.observer,t,i,e.manifestCodec);const s=appendFrame$2(e,t,i,this.basePTS,this.frameIndex);if(s&&s.missing===0)return s}}const getAudioBSID=(r,e)=>{let t=0,i=5;e+=i;const s=new Uint32Array(1),n=new Uint32Array(1),a=new Uint8Array(1);for(;i>0;){a[0]=r[e];const o=Math.min(i,8),c=8-o;n[0]=4278190080>>>24+c<<c,s[0]=(a[0]&n[0])>>c,t=t?t<<o|s[0]:s[0],e+=1,i-=o}return t};class AC3Demuxer extends BaseAudioDemuxer{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,i,s){super.resetInitSegment(e,t,i,s),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:s,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,i){const s=appendFrame(e,t,i,this.basePTS,this.frameIndex);if(s!==-1)return{sample:e.samples[e.samples.length-1],length:s,missing:0}}static probe(e){if(!e)return!1;const t=getId3Data(e,0);if(!t)return!1;const i=t.length;return e[i]===11&&e[i+1]===119&&getId3Timestamp(t)!==void 0&&getAudioBSID(e,i)<16}}function appendFrame(r,e,t,i,s){if(t+8>e.length||e[t]!==11||e[t+1]!==119)return-1;const n=e[t+4]>>6;if(n>=3)return-1;const o=[48e3,44100,32e3][n],c=e[t+4]&63,f=[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][c*3+n]*2;if(t+f>e.length)return-1;const d=e[t+6]>>5;let g=0;d===2?g+=2:(d&1&&d!==1&&(g+=2),d&4&&(g+=2));const E=(e[t+6]<<8|e[t+7])>>12-g&1,T=[2,1,2,3,3,4,4,5][d]+E,S=e[t+5]>>3,b=e[t+5]&7,C=new Uint8Array([n<<6|S<<1|b>>2,(b&3)<<6|d<<3|E<<2|c>>4,c<<4&224]),I=1536/o*9e4,L=i+s*I,k=e.subarray(t,t+f);return r.config=C,r.channelCount=T,r.samplerate=o,r.samples.push({unit:k,pts:L}),f}class MP3Demuxer extends BaseAudioDemuxer{resetInitSegment(e,t,i,s){super.resetInitSegment(e,t,i,s),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:s,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=getId3Data(e,0);let i=t?.length||0;if(t&&e[i]===11&&e[i+1]===119&&getId3Timestamp(t)!==void 0&&getAudioBSID(e,i)<=16)return!1;for(let s=e.length;i<s;i++)if(probe(e,i))return logger.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return canParse(e,t)}appendFrame(e,t,i){if(this.basePTS!==null)return appendFrame$1(e,t,i,this.basePTS,this.frameIndex)}}const emsgSchemePattern=/\/emsg[-/]ID3/i;class MP4Demuxer{constructor(e,t){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=t}resetTimeStamp(){}resetInitSegment(e,t,i,s){const n=this.videoTrack=dummyTrack("video",1),a=this.audioTrack=dummyTrack("audio",1),o=this.txtTrack=dummyTrack("text",1);if(this.id3Track=dummyTrack("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const c=parseInitSegment(e);if(c.video){const{id:u,timescale:f,codec:d,supplemental:g}=c.video;n.id=u,n.timescale=o.timescale=f,n.codec=d,n.supplemental=g}if(c.audio){const{id:u,timescale:f,codec:d}=c.audio;a.id=u,a.timescale=f,a.codec=d}o.id=RemuxerTrackIdConfig.text,n.sampleDuration=0,n.duration=a.duration=s}resetContiguity(){this.remainderData=null}static probe(e){return hasMoofData(e)}demux(e,t){this.timeOffset=t;let i=e;const s=this.videoTrack,n=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=appendUint8Array(this.remainderData,e));const o=segmentValidRange(i);this.remainderData=o.remainder,s.samples=o.valid||new Uint8Array}else s.samples=i;const a=this.extractID3Track(s,t);return n.samples=parseSamples(t,s),{videoTrack:s,audioTrack:this.audioTrack,id3Track:a,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,i=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const s=this.extractID3Track(t,this.timeOffset);return i.samples=parseSamples(e,t),{videoTrack:t,audioTrack:dummyTrack(),id3Track:s,textTrack:dummyTrack()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const s=findBox(e.samples,["emsg"]);s&&s.forEach(n=>{const a=parseEmsg(n);if(emsgSchemePattern.test(a.schemeIdUri)){const o=getEmsgStartTime(a,t);let c=a.eventDuration===4294967295?Number.POSITIVE_INFINITY:a.eventDuration/a.timeScale;c<=.001&&(c=Number.POSITIVE_INFINITY);const u=a.payload;i.samples.push({data:u,len:u.byteLength,dts:o,pts:o,type:MetadataSchema.emsg,duration:c})}else if(this.config.enableEmsgKLVMetadata&&a.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const o=getEmsgStartTime(a,t);i.samples.push({data:a.payload,len:a.payload.byteLength,dts:o,pts:o,type:MetadataSchema.misbklv,duration:Number.POSITIVE_INFINITY})}})}return i}demuxSampleAes(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0}}function getEmsgStartTime(r,e){return isFiniteNumber(r.presentationTime)?r.presentationTime/r.timeScale:e+r.presentationTimeDelta/r.timeScale}class SampleAesDecrypter{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new Decrypter(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,DecrypterAesMode.cbc)}decryptAacSample(e,t,i){const s=e[t].unit;if(s.length<=16)return;const n=s.subarray(16,s.length-s.length%16),a=n.buffer.slice(n.byteOffset,n.byteOffset+n.length);this.decryptBuffer(a).then(o=>{const c=new Uint8Array(o);s.set(c,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,i)}).catch(i)}decryptAacSamples(e,t,i){for(;;t++){if(t>=e.length){i();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,i),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,i=new Int8Array(t);let s=0;for(let n=32;n<e.length-16;n+=160,s+=16)i.set(e.subarray(n,n+16),s);return i}getAvcDecryptedUnit(e,t){const i=new Uint8Array(t);let s=0;for(let n=32;n<e.length-16;n+=160,s+=16)e.set(i.subarray(s,s+16),n);return e}decryptAvcSample(e,t,i,s,n){const a=discardEPB(n.data),o=this.getAvcEncryptedData(a);this.decryptBuffer(o.buffer).then(c=>{n.data=this.getAvcDecryptedUnit(a,c),this.decrypter.isSync()||this.decryptAvcSamples(e,t,i+1,s)}).catch(s)}decryptAvcSamples(e,t,i,s){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length){s();return}const n=e[t].units;for(;!(i>=n.length);i++){const a=n[i];if(!(a.data.length<=48||a.type!==1&&a.type!==5)&&(this.decryptAvcSample(e,t,i,s,a),!this.decrypter.isSync()))return}}}}class BaseVideoParser{constructor(){this.VideoSample=null}createVideoSample(e,t,i){return{key:e,frame:!1,pts:t,dts:i,units:[],length:0}}getLastNalUnit(e){var t;let i=this.VideoSample,s;if((!i||i.units.length===0)&&(i=e[e.length-1]),(t=i)!=null&&t.units){const n=i.units;s=n[n.length-1]}return s}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const i=t.samples,s=i.length;if(s){const n=i[s-1];e.pts=n.pts,e.dts=n.dts}else{t.dropped++;return}}t.samples.push(e)}}parseNALu(e,t,i){const s=t.byteLength;let n=e.naluState||0;const a=n,o=[];let c=0,u,f,d,g=-1,E=0;for(n===-1&&(g=0,E=this.getNALuType(t,0),n=0,c=1);c<s;){if(u=t[c++],!n){n=u?0:1;continue}if(n===1){n=u?0:2;continue}if(!u)n=3;else if(u===1){if(f=c-n-1,g>=0){const m={data:t.subarray(g,f),type:E};o.push(m)}else{const m=this.getLastNalUnit(e.samples);m&&(a&&c<=4-a&&m.state&&(m.data=m.data.subarray(0,m.data.byteLength-a)),f>0&&(m.data=appendUint8Array(m.data,t.subarray(0,f)),m.state=0))}c<s?(d=this.getNALuType(t,c),g=c,E=d,n=0):n=-1}else n=0}if(g>=0&&n>=0){const m={data:t.subarray(g,s),type:E,state:n};o.push(m)}if(o.length===0){const m=this.getLastNalUnit(e.samples);m&&(m.data=appendUint8Array(m.data,t))}return e.naluState=n,o}}class ExpGolomb{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,i=e.byteLength-t,s=new Uint8Array(4),n=Math.min(4,t);if(n===0)throw new Error("no bytes available");s.set(e.subarray(i,i+n)),this.word=new DataView(s.buffer).getUint32(0),this.bitsAvailable=n*8,this.bytesAvailable-=n}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const i=this.word>>>32-t;if(e>32&&logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return t=e-t,t>0&&this.bitsAvailable?i<<t|this.readBits(t):i}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if((this.word&2147483648>>>e)!==0)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}class AvcVideoParser extends BaseVideoParser{parsePES(e,t,i,s){const n=this.parseNALu(e,i.data,s);let a=this.VideoSample,o,c=!1;i.data=null,a&&n.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),n.forEach(u=>{var f,d;switch(u.type){case 1:{let T=!1;o=!0;const S=u.data;if(c&&S.length>4){const b=this.readSliceType(S);(b===2||b===4||b===7||b===9)&&(T=!0)}if(T){var g;(g=a)!=null&&g.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null)}a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.frame=!0,a.key=T;break}case 5:o=!0,(f=a)!=null&&f.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0,a.frame=!0;break;case 6:{o=!0,parseSEIMessageFromNALu(u.data,1,i.pts,t.samples);break}case 7:{var E,m;o=!0,c=!0;const T=u.data,S=this.readSPS(T);if(!e.sps||e.width!==S.width||e.height!==S.height||((E=e.pixelRatio)==null?void 0:E[0])!==S.pixelRatio[0]||((m=e.pixelRatio)==null?void 0:m[1])!==S.pixelRatio[1]){e.width=S.width,e.height=S.height,e.pixelRatio=S.pixelRatio,e.sps=[T];const b=T.subarray(1,4);let C="avc1.";for(let I=0;I<3;I++){let L=b[I].toString(16);L.length<2&&(L="0"+L),C+=L}e.codec=C}break}case 8:o=!0,e.pps=[u.data];break;case 9:o=!0,e.audFound=!0,(d=a)!=null&&d.frame&&(this.pushAccessUnit(a,e),a=null),a||(a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts));break;case 12:o=!0;break;default:o=!1;break}a&&o&&a.units.push(u)}),s&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}getNALuType(e,t){return e[t]&31}readSliceType(e){const t=new ExpGolomb(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let i=8,s=8,n;for(let a=0;a<e;a++)s!==0&&(n=t.readEG(),s=(i+n+256)%256),i=s===0?i:s}readSPS(e){const t=new ExpGolomb(e);let i=0,s=0,n=0,a=0,o,c,u;const f=t.readUByte.bind(t),d=t.readBits.bind(t),g=t.readUEG.bind(t),E=t.readBoolean.bind(t),m=t.skipBits.bind(t),T=t.skipEG.bind(t),S=t.skipUEG.bind(t),b=this.skipScalingList.bind(this);f();const C=f();if(d(5),m(3),f(),S(),C===100||C===110||C===122||C===244||C===44||C===83||C===86||C===118||C===128){const F=g();if(F===3&&m(1),S(),S(),m(1),E())for(c=F!==3?8:12,u=0;u<c;u++)E()&&(u<6?b(16,t):b(64,t))}S();const I=g();if(I===0)g();else if(I===1)for(m(1),T(),T(),o=g(),u=0;u<o;u++)T();S(),m(1);const L=g(),k=g(),U=d(1);U===0&&m(1),m(1),E()&&(i=g(),s=g(),n=g(),a=g());let O=[1,1];if(E()&&E())switch(f()){case 1:O=[1,1];break;case 2:O=[12,11];break;case 3:O=[10,11];break;case 4:O=[16,11];break;case 5:O=[40,33];break;case 6:O=[24,11];break;case 7:O=[20,11];break;case 8:O=[32,11];break;case 9:O=[80,33];break;case 10:O=[18,11];break;case 11:O=[15,11];break;case 12:O=[64,33];break;case 13:O=[160,99];break;case 14:O=[4,3];break;case 15:O=[3,2];break;case 16:O=[2,1];break;case 255:{O=[f()<<8|f(),f()<<8|f()];break}}return{width:Math.ceil((L+1)*16-i*2-s*2),height:(2-U)*(k+1)*16-(U?2:4)*(n+a),pixelRatio:O}}}class HevcVideoParser extends BaseVideoParser{constructor(...e){super(...e),this.initVPS=null}parsePES(e,t,i,s){const n=this.parseNALu(e,i.data,s);let a=this.VideoSample,o,c=!1;i.data=null,a&&n.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),n.forEach(u=>{var f,d;switch(u.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:a||(a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),a.frame=!0,o=!0;break;case 16:case 17:case 18:case 21:if(o=!0,c){var g;(g=a)!=null&&g.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null)}a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0,a.frame=!0;break;case 19:case 20:o=!0,(f=a)!=null&&f.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0,a.frame=!0;break;case 39:o=!0,parseSEIMessageFromNALu(u.data,2,i.pts,t.samples);break;case 32:o=!0,e.vps||(typeof e.params!="object"&&(e.params={}),e.params=_extends(e.params,this.readVPS(u.data)),this.initVPS=u.data),e.vps=[u.data];break;case 33:if(o=!0,c=!0,e.vps!==void 0&&e.vps[0]!==this.initVPS&&e.sps!==void 0&&!this.matchSPS(e.sps[0],u.data)&&(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){const E=this.readSPS(u.data);e.width=E.width,e.height=E.height,e.pixelRatio=E.pixelRatio,e.codec=E.codecString,e.sps=[],typeof e.params!="object"&&(e.params={});for(const m in E.params)e.params[m]=E.params[m]}this.pushParameterSet(e.sps,u.data,e.vps),a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0;break;case 34:if(o=!0,typeof e.params=="object"){if(!e.pps){e.pps=[];const E=this.readPPS(u.data);for(const m in E)e.params[m]=E[m]}this.pushParameterSet(e.pps,u.data,e.vps)}break;case 35:o=!0,e.audFound=!0,(d=a)!=null&&d.frame&&(this.pushAccessUnit(a,e),a=null),a||(a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts));break;default:o=!1;break}a&&o&&a.units.push(u)}),s&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}pushParameterSet(e,t,i){(i&&i[0]===this.initVPS||!i&&!e.length)&&e.push(t)}getNALuType(e,t){return(e[t]&126)>>>1}ebsp2rbsp(e){const t=new Uint8Array(e.byteLength);let i=0;for(let s=0;s<e.byteLength;s++)s>=2&&e[s]===3&&e[s-1]===0&&e[s-2]===0||(t[i]=e[s],i++);return new Uint8Array(t.buffer,0,i)}pushAccessUnit(e,t){super.pushAccessUnit(e,t),this.initVPS&&(this.initVPS=null)}readVPS(e){const t=new ExpGolomb(e);t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6);const i=t.readBits(3),s=t.readBoolean();return{numTemporalLayers:i+1,temporalIdNested:s}}readSPS(e){const t=new ExpGolomb(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);const i=t.readBits(3);t.readBoolean();const s=t.readBits(2),n=t.readBoolean(),a=t.readBits(5),o=t.readUByte(),c=t.readUByte(),u=t.readUByte(),f=t.readUByte(),d=t.readUByte(),g=t.readUByte(),E=t.readUByte(),m=t.readUByte(),T=t.readUByte(),S=t.readUByte(),b=t.readUByte(),C=[],I=[];for(let Ie=0;Ie<i;Ie++)C.push(t.readBoolean()),I.push(t.readBoolean());if(i>0)for(let Ie=i;Ie<8;Ie++)t.readBits(2);for(let Ie=0;Ie<i;Ie++)C[Ie]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),I[Ie]&&t.readUByte();t.readUEG();const L=t.readUEG();L==3&&t.skipBits(1);const k=t.readUEG(),U=t.readUEG(),O=t.readBoolean();let F=0,G=0,x=0,$=0;O&&(F+=t.readUEG(),G+=t.readUEG(),x+=t.readUEG(),$+=t.readUEG());const X=t.readUEG(),Q=t.readUEG(),ee=t.readUEG(),te=t.readBoolean();for(let Ie=te?0:i;Ie<=i;Ie++)t.skipUEG(),t.skipUEG(),t.skipUEG();if(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.readBoolean()&&t.readBoolean())for(let Me=0;Me<4;Me++)for(let Ve=0;Ve<(Me===3?2:6);Ve++)if(!t.readBoolean())t.readUEG();else{const Qe=Math.min(64,1<<4+(Me<<1));Me>1&&t.readEG();for(let ze=0;ze<Qe;ze++)t.readEG()}t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());const H=t.readUEG();let z=0;for(let Ie=0;Ie<H;Ie++){let Me=!1;if(Ie!==0&&(Me=t.readBoolean()),Me){Ie===H&&t.readUEG(),t.readBoolean(),t.readUEG();let Ve=0;for(let dt=0;dt<=z;dt++){const Qe=t.readBoolean();let ze=!1;Qe||(ze=t.readBoolean()),(Qe||ze)&&Ve++}z=Ve}else{const Ve=t.readUEG(),dt=t.readUEG();z=Ve+dt;for(let Qe=0;Qe<Ve;Qe++)t.readUEG(),t.readBoolean();for(let Qe=0;Qe<dt;Qe++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){const Ie=t.readUEG();for(let Me=0;Me<Ie;Me++){for(let Ve=0;Ve<ee+4;Ve++)t.readBits(1);t.readBits(1)}}let ne=0,he=1,pe=1,Pe=!0,ae=1,Ae=0;t.readBoolean(),t.readBoolean();let Re=!1;if(t.readBoolean()){if(t.readBoolean()){const Je=t.readUByte(),gt=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],yt=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];Je>0&&Je<16?(he=gt[Je-1],pe=yt[Je-1]):Je===255&&(he=t.readBits(16),pe=t.readBits(16))}if(t.readBoolean()&&t.readBoolean(),t.readBoolean()&&(t.readBits(3),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.readUByte(),t.readUByte())),t.readBoolean()&&(t.readUEG(),t.readUEG()),t.readBoolean(),t.readBoolean(),t.readBoolean(),Re=t.readBoolean(),Re&&(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG()),t.readBoolean()&&(ae=t.readBits(32),Ae=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){const yt=t.readBoolean(),_t=t.readBoolean();let qe=!1;(yt||_t)&&(qe=t.readBoolean(),qe&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),qe&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let Yt=0;Yt<=i;Yt++){Pe=t.readBoolean();const Dt=Pe||t.readBoolean();let St=!1;Dt?t.readEG():St=t.readBoolean();const Se=St?1:t.readUEG()+1;if(yt)for(let lt=0;lt<Se;lt++)t.readUEG(),t.readUEG(),qe&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(_t)for(let lt=0;lt<Se;lt++)t.readUEG(),t.readUEG(),qe&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),ne=t.readUEG())}let Y=k,q=U;if(O){let Ie=1,Me=1;L===1?Ie=Me=2:L==2&&(Ie=2),Y=k-Ie*G-Ie*F,q=U-Me*$-Me*x}const le=s?["A","B","C"][s]:"",ce=o<<24|c<<16|u<<8|f;let Ee=0;for(let Ie=0;Ie<32;Ie++)Ee=(Ee|(ce>>Ie&1)<<31-Ie)>>>0;let ve=Ee.toString(16);return a===1&&ve==="2"&&(ve="6"),{codecString:`hvc1.${le}${a}.${ve}.${n?"H":"L"}${b}.B0`,params:{general_tier_flag:n,general_profile_idc:a,general_profile_space:s,general_profile_compatibility_flags:[o,c,u,f],general_constraint_indicator_flags:[d,g,E,m,T,S],general_level_idc:b,bit_depth:X+8,bit_depth_luma_minus8:X,bit_depth_chroma_minus8:Q,min_spatial_segmentation_idc:ne,chroma_format_idc:L,frame_rate:{fixed:Pe,fps:Ae/ae}},width:Y,height:q,pixelRatio:[he,pe]}}readPPS(e){const t=new ExpGolomb(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.skipUEG(),t.skipUEG(),t.skipBits(2),t.skipBits(3),t.skipBits(2),t.skipUEG(),t.skipUEG(),t.skipEG(),t.skipBits(2),t.readBoolean()&&t.skipUEG(),t.skipEG(),t.skipEG(),t.skipBits(4);const s=t.readBoolean(),n=t.readBoolean();let a=1;return n&&s?a=0:n?a=3:s&&(a=2),{parallelismType:a}}matchSPS(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)}}const PACKET_LENGTH=188;class TSDemuxer{constructor(e,t,i,s){this.logger=void 0,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._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=e,this.config=t,this.typeSupported=i,this.logger=s,this.videoParser=null}static probe(e,t){const i=TSDemuxer.syncOffset(e);return i>0&&t.warn(`MPEG2-TS detected but first sync word found @ offset ${i}`),i!==-1}static syncOffset(e){const t=e.length;let i=Math.min(PACKET_LENGTH*5,t-PACKET_LENGTH)+1,s=0;for(;s<i;){let n=!1,a=-1,o=0;for(let c=s;c<t;c+=PACKET_LENGTH)if(e[c]===71&&(t-c===PACKET_LENGTH||e[c+PACKET_LENGTH]===71)){if(o++,a===-1&&(a=c,a!==0&&(i=Math.min(a+PACKET_LENGTH*99,e.length-PACKET_LENGTH)+1)),n||(n=parsePID(e,c)===0),n&&o>1&&(a===0&&o>2||c+PACKET_LENGTH>i))return a}else{if(o)return-1;break}s++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:RemuxerTrackIdConfig[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,i,s){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=TSDemuxer.createTrack("video"),this._videoTrack.duration=s,this._audioTrack=TSDemuxer.createTrack("audio",s),this._id3Track=TSDemuxer.createTrack("id3"),this._txtTrack=TSDemuxer.createTrack("text"),this._audioTrack.segmentCodec="aac",this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=i}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:i}=this;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,i=!1,s=!1){i||(this.sampleAes=null);let n;const a=this._videoTrack,o=this._audioTrack,c=this._id3Track,u=this._txtTrack;let f=a.pid,d=a.pesData,g=o.pid,E=c.pid,m=o.pesData,T=c.pesData,S=null,b=this.pmtParsed,C=this._pmtId,I=e.length;if(this.remainderData&&(e=appendUint8Array(this.remainderData,e),I=e.length,this.remainderData=null),I<PACKET_LENGTH&&!s)return this.remainderData=e,{audioTrack:o,videoTrack:a,id3Track:c,textTrack:u};const L=Math.max(0,TSDemuxer.syncOffset(e));I-=(I-L)%PACKET_LENGTH,I<e.byteLength&&!s&&(this.remainderData=new Uint8Array(e.buffer,I,e.buffer.byteLength-I));let k=0;for(let O=L;O<I;O+=PACKET_LENGTH)if(e[O]===71){const F=!!(e[O+1]&64),G=parsePID(e,O),x=(e[O+3]&48)>>4;let $;if(x>1){if($=O+5+e[O+4],$===O+PACKET_LENGTH)continue}else $=O+4;switch(G){case f:F&&(d&&(n=parsePES(d,this.logger))&&(this.readyVideoParser(a.segmentCodec),this.videoParser!==null&&this.videoParser.parsePES(a,u,n,!1)),d={data:[],size:0}),d&&(d.data.push(e.subarray($,O+PACKET_LENGTH)),d.size+=O+PACKET_LENGTH-$);break;case g:if(F){if(m&&(n=parsePES(m,this.logger)))switch(o.segmentCodec){case"aac":this.parseAACPES(o,n);break;case"mp3":this.parseMPEGPES(o,n);break;case"ac3":this.parseAC3PES(o,n);break}m={data:[],size:0}}m&&(m.data.push(e.subarray($,O+PACKET_LENGTH)),m.size+=O+PACKET_LENGTH-$);break;case E:F&&(T&&(n=parsePES(T,this.logger))&&this.parseID3PES(c,n),T={data:[],size:0}),T&&(T.data.push(e.subarray($,O+PACKET_LENGTH)),T.size+=O+PACKET_LENGTH-$);break;case 0:F&&($+=e[$]+1),C=this._pmtId=parsePAT(e,$);break;case C:{F&&($+=e[$]+1);const X=parsePMT(e,$,this.typeSupported,i,this.observer,this.logger);f=X.videoPid,f>0&&(a.pid=f,a.segmentCodec=X.segmentVideoCodec),g=X.audioPid,g>0&&(o.pid=g,o.segmentCodec=X.segmentAudioCodec),E=X.id3Pid,E>0&&(c.pid=E),S!==null&&!b&&(this.logger.warn(`MPEG-TS PMT found at ${O} after unknown PID '${S}'. Backtracking to sync byte @${L} to parse all TS packets.`),S=null,O=L-188),b=this.pmtParsed=!0;break}case 17:case 8191:break;default:S=G;break}}else k++;k>0&&emitParsingError(this.observer,new Error(`Found ${k} TS packet/s that do not start with 0x47`),void 0,this.logger),a.pesData=d,o.pesData=m,c.pesData=T;const U={audioTrack:o,videoTrack:a,id3Track:c,textTrack:u};return s&&this.extractRemainingSamples(U),U}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:i,id3Track:s,textTrack:n}=e,a=i.pesData,o=t.pesData,c=s.pesData;let u;if(a&&(u=parsePES(a,this.logger))?(this.readyVideoParser(i.segmentCodec),this.videoParser!==null&&(this.videoParser.parsePES(i,n,u,!0),i.pesData=null)):i.pesData=a,o&&(u=parsePES(o,this.logger))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,u);break;case"mp3":this.parseMPEGPES(t,u);break;case"ac3":this.parseAC3PES(t,u);break}t.pesData=null}else o!=null&&o.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=o;c&&(u=parsePES(c,this.logger))?(this.parseID3PES(s,u),s.pesData=null):s.pesData=c}demuxSampleAes(e,t,i){const s=this.demux(e,i,!0,!this.config.progressive),n=this.sampleAes=new SampleAesDecrypter(this.observer,this.config,t);return this.decrypt(s,n)}readyVideoParser(e){this.videoParser===null&&(e==="avc"?this.videoParser=new AvcVideoParser:e==="hevc"&&(this.videoParser=new HevcVideoParser))}decrypt(e,t){return new Promise(i=>{const{audioTrack:s,videoTrack:n}=e;s.samples&&s.segmentCodec==="aac"?t.decryptAacSamples(s.samples,0,()=>{n.samples?t.decryptAvcSamples(n.samples,0,0,()=>{i(e)}):i(e)}):n.samples&&t.decryptAvcSamples(n.samples,0,0,()=>{i(e)})})}destroy(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0}parseAACPES(e,t){let i=0;const s=this.aacOverFlow;let n=t.data;if(s){this.aacOverFlow=null;const d=s.missing,g=s.sample.unit.byteLength;if(d===-1)n=appendUint8Array(s.sample.unit,n);else{const E=g-d;s.sample.unit.set(n.subarray(0,d),E),e.samples.push(s.sample),i=s.missing}}let a,o;for(a=i,o=n.length;a<o-1&&!isHeader$1(n,a);a++);if(a!==i){let d;const g=a<o-1;if(g?d=`AAC PES did not start with ADTS header,offset:${a}`:d="No ADTS header found in AAC PES",emitParsingError(this.observer,new Error(d),g,this.logger),!g)return}initTrackConfig(e,this.observer,n,a,this.audioCodec);let c;if(t.pts!==void 0)c=t.pts;else if(s){const d=getFrameDuration(e.samplerate);c=s.sample.pts+d}else{this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}let u=0,f;for(;a<o;)if(f=appendFrame$2(e,n,a,c,u),a+=f.length,f.missing){this.aacOverFlow=f;break}else for(u++;a<o-1&&!isHeader$1(n,a);a++);}parseMPEGPES(e,t){const i=t.data,s=i.length;let n=0,a=0;const o=t.pts;if(o===void 0){this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<s;)if(isHeader(i,a)){const c=appendFrame$1(e,i,a,o,n);if(c)a+=c.length,n++;else break}else a++}parseAC3PES(e,t){{const i=t.data,s=t.pts;if(s===void 0){this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const n=i.length;let a=0,o=0,c;for(;o<n&&(c=appendFrame(e,i,o,s,a++))>0;)o+=c}}parseID3PES(e,t){if(t.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const i=_extends({},t,{type:this._videoTrack?MetadataSchema.emsg:MetadataSchema.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function parsePID(r,e){return((r[e+1]&31)<<8)+r[e+2]}function parsePAT(r,e){return(r[e+10]&31)<<8|r[e+11]}function parsePMT(r,e,t,i,s,n){const a={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},o=(r[e+1]&15)<<8|r[e+2],c=e+3+o-4,u=(r[e+10]&15)<<8|r[e+11];for(e+=12+u;e<c;){const f=parsePID(r,e),d=(r[e+3]&15)<<8|r[e+4];switch(r[e]){case 207:if(!i){logEncryptedSamplesFoundInUnencryptedStream("ADTS AAC",n);break}case 15:a.audioPid===-1&&(a.audioPid=f);break;case 21:a.id3Pid===-1&&(a.id3Pid=f);break;case 219:if(!i){logEncryptedSamplesFoundInUnencryptedStream("H.264",n);break}case 27:a.videoPid===-1&&(a.videoPid=f);break;case 3:case 4:!t.mpeg&&!t.mp3?n.log("MPEG audio found, not supported in this browser"):a.audioPid===-1&&(a.audioPid=f,a.segmentAudioCodec="mp3");break;case 193:if(!i){logEncryptedSamplesFoundInUnencryptedStream("AC-3",n);break}case 129:t.ac3?a.audioPid===-1&&(a.audioPid=f,a.segmentAudioCodec="ac3"):n.log("AC-3 audio found, not supported in this browser");break;case 6:if(a.audioPid===-1&&d>0){let g=e+5,E=d;for(;E>2;){r[g]===106&&(t.ac3!==!0?n.log("AC-3 audio found, not supported in this browser for now"):(a.audioPid=f,a.segmentAudioCodec="ac3"));const T=r[g+1]+2;g+=T,E-=T}}break;case 194:case 135:return emitParsingError(s,new Error("Unsupported EC-3 in M2TS found"),void 0,n),a;case 36:a.videoPid===-1&&(a.videoPid=f,a.segmentVideoCodec="hevc",n.log("HEVC in M2TS found"));break}e+=d+5}return a}function emitParsingError(r,e,t,i){i.warn(`parsing error: ${e.message}`),r.emit(Events.ERROR,Events.ERROR,{type:ErrorTypes.MEDIA_ERROR,details:ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function logEncryptedSamplesFoundInUnencryptedStream(r,e){e.log(`${r} with AES-128-CBC encryption found in unencrypted stream`)}function parsePES(r,e){let t=0,i,s,n,a,o;const c=r.data;if(!r||r.size===0)return null;for(;c[0].length<19&&c.length>1;)c[0]=appendUint8Array(c[0],c[1]),c.splice(1,1);if(i=c[0],(i[0]<<16)+(i[1]<<8)+i[2]===1){if(s=(i[4]<<8)+i[5],s&&s>r.size-6)return null;const f=i[7];f&192&&(a=(i[9]&14)*536870912+(i[10]&255)*4194304+(i[11]&254)*16384+(i[12]&255)*128+(i[13]&254)/2,f&64?(o=(i[14]&14)*536870912+(i[15]&255)*4194304+(i[16]&254)*16384+(i[17]&255)*128+(i[18]&254)/2,a-o>60*9e4&&(e.warn(`${Math.round((a-o)/9e4)}s delta between PTS and DTS, align them`),a=o)):o=a),n=i[8];let d=n+9;if(r.size<=d)return null;r.size-=d;const g=new Uint8Array(r.size);for(let E=0,m=c.length;E<m;E++){i=c[E];let T=i.byteLength;if(d)if(d>T){d-=T;continue}else i=i.subarray(d),T-=d,d=0;g.set(i,t),t+=T}return s&&(s-=n+3),{data:g,pts:a,dts:o,len:s}}return null}class AAC{static getSilentFrame(e,t){switch(e){case"mp4a.40.2":if(t===1)return new Uint8Array([0,200,0,128,35,128]);if(t===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(t===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(t===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(t===5)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(t===6)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]);break;default:if(t===1)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(t===2)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(t===3)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]);break}}}const UINT32_MAX=Math.pow(2,32)-1;class MP4{static init(){MP4.types={avc1:[],avcC:[],hvc1:[],hvcC:[],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:[]};let e;for(e in MP4.types)MP4.types.hasOwnProperty(e)&&(MP4.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=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]),i=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]);MP4.HDLR_TYPES={video:t,audio:i};const s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),n=new Uint8Array([0,0,0,0,0,0,0,0]);MP4.STTS=MP4.STSC=MP4.STCO=n,MP4.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),MP4.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),MP4.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),MP4.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const a=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),c=new Uint8Array([0,0,0,1]);MP4.FTYP=MP4.box(MP4.types.ftyp,a,c,a,o),MP4.DINF=MP4.box(MP4.types.dinf,MP4.box(MP4.types.dref,s))}static box(e,...t){let i=8,s=t.length;const n=s;for(;s--;)i+=t[s].byteLength;const a=new Uint8Array(i);for(a[0]=i>>24&255,a[1]=i>>16&255,a[2]=i>>8&255,a[3]=i&255,a.set(e,4),s=0,i=8;s<n;s++)a.set(t[s],i),i+=t[s].byteLength;return a}static hdlr(e){return MP4.box(MP4.types.hdlr,MP4.HDLR_TYPES[e])}static mdat(e){return MP4.box(MP4.types.mdat,e)}static mdhd(e,t){t*=e;const i=Math.floor(t/(UINT32_MAX+1)),s=Math.floor(t%(UINT32_MAX+1));return MP4.box(MP4.types.mdhd,new Uint8Array([1,0,0,0,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,e&255,i>>24,i>>16&255,i>>8&255,i&255,s>>24,s>>16&255,s>>8&255,s&255,85,196,0,0]))}static mdia(e){return MP4.box(MP4.types.mdia,MP4.mdhd(e.timescale||0,e.duration||0),MP4.hdlr(e.type),MP4.minf(e))}static mfhd(e){return MP4.box(MP4.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255]))}static minf(e){return e.type==="audio"?MP4.box(MP4.types.minf,MP4.box(MP4.types.smhd,MP4.SMHD),MP4.DINF,MP4.stbl(e)):MP4.box(MP4.types.minf,MP4.box(MP4.types.vmhd,MP4.VMHD),MP4.DINF,MP4.stbl(e))}static moof(e,t,i){return MP4.box(MP4.types.moof,MP4.mfhd(e),MP4.traf(i,t))}static moov(e){let t=e.length;const i=[];for(;t--;)i[t]=MP4.trak(e[t]);return MP4.box.apply(null,[MP4.types.moov,MP4.mvhd(e[0].timescale||0,e[0].duration||0)].concat(i).concat(MP4.mvex(e)))}static mvex(e){let t=e.length;const i=[];for(;t--;)i[t]=MP4.trex(e[t]);return MP4.box.apply(null,[MP4.types.mvex,...i])}static mvhd(e,t){t*=e;const i=Math.floor(t/(UINT32_MAX+1)),s=Math.floor(t%(UINT32_MAX+1)),n=new Uint8Array([1,0,0,0,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,e&255,i>>24,i>>16&255,i>>8&255,i&255,s>>24,s>>16&255,s>>8&255,s&255,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 MP4.box(MP4.types.mvhd,n)}static sdtp(e){const t=e.samples||[],i=new Uint8Array(4+t.length);let s,n;for(s=0;s<t.length;s++)n=t[s].flags,i[s+4]=n.dependsOn<<4|n.isDependedOn<<2|n.hasRedundancy;return MP4.box(MP4.types.sdtp,i)}static stbl(e){return MP4.box(MP4.types.stbl,MP4.stsd(e),MP4.box(MP4.types.stts,MP4.STTS),MP4.box(MP4.types.stsc,MP4.STSC),MP4.box(MP4.types.stsz,MP4.STSZ),MP4.box(MP4.types.stco,MP4.STCO))}static avc1(e){let t=[],i=[],s,n,a;for(s=0;s<e.sps.length;s++)n=e.sps[s],a=n.byteLength,t.push(a>>>8&255),t.push(a&255),t=t.concat(Array.prototype.slice.call(n));for(s=0;s<e.pps.length;s++)n=e.pps[s],a=n.byteLength,i.push(a>>>8&255),i.push(a&255),i=i.concat(Array.prototype.slice.call(n));const o=MP4.box(MP4.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(i))),c=e.width,u=e.height,f=e.pixelRatio[0],d=e.pixelRatio[1];return MP4.box(MP4.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,c>>8&255,c&255,u>>8&255,u&255,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,MP4.box(MP4.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),MP4.box(MP4.types.pasp,new Uint8Array([f>>24,f>>16&255,f>>8&255,f&255,d>>24,d>>16&255,d>>8&255,d&255])))}static esds(e){const t=e.config;return new Uint8Array([0,0,0,0,3,25,0,1,0,4,17,64,21,0,0,0,0,0,0,0,0,0,0,0,5,2,...t,6,1,2])}static audioStsd(e){const t=e.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount||0,0,16,0,0,0,0,t>>8&255,t&255,0,0])}static mp4a(e){return MP4.box(MP4.types.mp4a,MP4.audioStsd(e),MP4.box(MP4.types.esds,MP4.esds(e)))}static mp3(e){return MP4.box(MP4.types[".mp3"],MP4.audioStsd(e))}static ac3(e){return MP4.box(MP4.types["ac-3"],MP4.audioStsd(e),MP4.box(MP4.types.dac3,e.config))}static stsd(e){const{segmentCodec:t}=e;if(e.type==="audio"){if(t==="aac")return MP4.box(MP4.types.stsd,MP4.STSD,MP4.mp4a(e));if(t==="ac3"&&e.config)return MP4.box(MP4.types.stsd,MP4.STSD,MP4.ac3(e));if(t==="mp3"&&e.codec==="mp3")return MP4.box(MP4.types.stsd,MP4.STSD,MP4.mp3(e))}else if(e.pps&&e.sps){if(t==="avc")return MP4.box(MP4.types.stsd,MP4.STSD,MP4.avc1(e));if(t==="hevc"&&e.vps)return MP4.box(MP4.types.stsd,MP4.STSD,MP4.hvc1(e))}else throw new Error("video track missing pps or sps");throw new Error(`unsupported ${e.type} segment codec (${t}/${e.codec})`)}static tkhd(e){const t=e.id,i=(e.duration||0)*(e.timescale||0),s=e.width||0,n=e.height||0,a=Math.floor(i/(UINT32_MAX+1)),o=Math.floor(i%(UINT32_MAX+1));return MP4.box(MP4.types.tkhd,new Uint8Array([1,0,0,7,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,t&255,0,0,0,0,a>>24,a>>16&255,a>>8&255,a&255,o>>24,o>>16&255,o>>8&255,o&255,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,s>>8&255,s&255,0,0,n>>8&255,n&255,0,0]))}static traf(e,t){const i=MP4.sdtp(e),s=e.id,n=Math.floor(t/(UINT32_MAX+1)),a=Math.floor(t%(UINT32_MAX+1));return MP4.box(MP4.types.traf,MP4.box(MP4.types.tfhd,new Uint8Array([0,0,0,0,s>>24,s>>16&255,s>>8&255,s&255])),MP4.box(MP4.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,n&255,a>>24,a>>16&255,a>>8&255,a&255])),MP4.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||4294967295,MP4.box(MP4.types.trak,MP4.tkhd(e),MP4.mdia(e))}static trex(e){const t=e.id;return MP4.box(MP4.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const i=e.samples||[],s=i.length,n=12+16*s,a=new Uint8Array(n);let o,c,u,f,d,g;for(t+=8+n,a.set([e.type==="video"?1:0,0,15,1,s>>>24&255,s>>>16&255,s>>>8&255,s&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),o=0;o<s;o++)c=i[o],u=c.duration,f=c.size,d=c.flags,g=c.cts,a.set([u>>>24&255,u>>>16&255,u>>>8&255,u&255,f>>>24&255,f>>>16&255,f>>>8&255,f&255,d.isLeading<<2|d.dependsOn,d.isDependedOn<<6|d.hasRedundancy<<4|d.paddingValue<<1|d.isNonSync,d.degradPrio&61440,d.degradPrio&15,g>>>24&255,g>>>16&255,g>>>8&255,g&255],12+16*o);return MP4.box(MP4.types.trun,a)}static initSegment(e){MP4.types||MP4.init();const t=MP4.moov(e);return appendUint8Array(MP4.FTYP,t)}static hvc1(e){const t=e.params,i=[e.vps,e.sps,e.pps],s=4,n=new Uint8Array([1,t.general_profile_space<<6|(t.general_tier_flag?32:0)|t.general_profile_idc,t.general_profile_compatibility_flags[0],t.general_profile_compatibility_flags[1],t.general_profile_compatibility_flags[2],t.general_profile_compatibility_flags[3],t.general_constraint_indicator_flags[0],t.general_constraint_indicator_flags[1],t.general_constraint_indicator_flags[2],t.general_constraint_indicator_flags[3],t.general_constraint_indicator_flags[4],t.general_constraint_indicator_flags[5],t.general_level_idc,240|t.min_spatial_segmentation_idc>>8,255&t.min_spatial_segmentation_idc,252|t.parallelismType,252|t.chroma_format_idc,248|t.bit_depth_luma_minus8,248|t.bit_depth_chroma_minus8,0,parseInt(t.frame_rate.fps),s-1|t.temporal_id_nested<<2|t.num_temporal_layers<<3|(t.frame_rate.fixed?64:0),i.length]);let a=n.length;for(let m=0;m<i.length;m+=1){a+=3;for(let T=0;T<i[m].length;T+=1)a+=2+i[m][T].length}const o=new Uint8Array(a);o.set(n,0),a=n.length;const c=i.length-1;for(let m=0;m<i.length;m+=1){o.set(new Uint8Array([32+m|(m===c?128:0),0,i[m].length]),a),a+=3;for(let T=0;T<i[m].length;T+=1)o.set(new Uint8Array([i[m][T].length>>8,i[m][T].length&255]),a),a+=2,o.set(i[m][T],a),a+=i[m][T].length}const u=MP4.box(MP4.types.hvcC,o),f=e.width,d=e.height,g=e.pixelRatio[0],E=e.pixelRatio[1];return MP4.box(MP4.types.hvc1,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,f>>8&255,f&255,d>>8&255,d&255,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]),u,MP4.box(MP4.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),MP4.box(MP4.types.pasp,new Uint8Array([g>>24,g>>16&255,g>>8&255,g&255,E>>24,E>>16&255,E>>8&255,E&255])))}}MP4.types=void 0,MP4.HDLR_TYPES=void 0,MP4.STTS=void 0,MP4.STSC=void 0,MP4.STCO=void 0,MP4.STSZ=void 0,MP4.VMHD=void 0,MP4.SMHD=void 0,MP4.STSD=void 0,MP4.FTYP=void 0,MP4.DINF=void 0;const MPEG_TS_CLOCK_FREQ_HZ=9e4;function toTimescaleFromBase(r,e,t=1,i=!1){const s=r*e*t;return i?Math.round(s):s}function toTimescaleFromScale(r,e,t=1,i=!1){return toTimescaleFromBase(r,e,1/t,i)}function toMsFromMpegTsClock(r,e=!1){return toTimescaleFromBase(r,1e3,1/MPEG_TS_CLOCK_FREQ_HZ,e)}function toMpegTsClockFromTimescale(r,e=1){return toTimescaleFromBase(r,MPEG_TS_CLOCK_FREQ_HZ,1/e)}function timestampToString(r){const{baseTime:e,timescale:t,trackId:i}=r;return`${e/t} (${e}/${t}) trackId: ${i}`}const MAX_SILENT_FRAME_DURATION=10*1e3,AAC_SAMPLES_PER_FRAME=1024,MPEG_AUDIO_SAMPLE_PER_FRAME=1152,AC3_SAMPLES_PER_FRAME=1536;let chromeVersion=null,safariWebkitVersion=null;function createMp4Sample(r,e,t,i){return{duration:e,size:t,cts:i,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:r?2:1,isNonSync:r?0:1}}}class MP4Remuxer extends Logger{constructor(e,t,i,s){if(super("mp4-remuxer",s),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextVideoTs=null,this.nextAudioTs=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.ISGenerated=!1,chromeVersion===null){const a=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);chromeVersion=a?parseInt(a[1]):0}if(safariWebkitVersion===null){const n=navigator.userAgent.match(/Safari\/(\d+)/i);safariWebkitVersion=n?parseInt(n[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){const t=this._initPTS;(!t||!e||e.trackId!==t.trackId||e.baseTime!==t.baseTime||e.timescale!==t.timescale)&&this.log(`Reset initPTS: ${t&×tampToString(t)} > ${e&×tampToString(e)}`),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.log("reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.log("ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const i=e[0].pts,s=e.reduce((n,a)=>{let o=a.pts,c=o-n;return c<-4294967296&&(t=!0,o=normalizePts(o,i),c=o-n),c>0?n:o},i);return t&&this.debug("PTS rollover detected"),s}remux(e,t,i,s,n,a,o,c){let u,f,d,g,E,m,T=n,S=n;const b=e.pid>-1,C=t.pid>-1,I=t.samples.length,L=e.samples.length>0,k=o&&I>0||I>1;if((!b||L)&&(!C||k)||this.ISGenerated||o){if(this.ISGenerated){var O,F,G,x;const ee=this.videoTrackConfig;(ee&&(t.width!==ee.width||t.height!==ee.height||((O=t.pixelRatio)==null?void 0:O[0])!==((F=ee.pixelRatio)==null?void 0:F[0])||((G=t.pixelRatio)==null?void 0:G[1])!==((x=ee.pixelRatio)==null?void 0:x[1]))||!ee&&k||this.nextAudioTs===null&&L)&&this.resetInitSegment()}this.ISGenerated||(d=this.generateIS(e,t,n,a));const $=this.isVideoContiguous;let X=-1,Q;if(k&&(X=findKeyframeIndex(t.samples),!$&&this.config.forceKeyFrameOnDiscontinuity))if(m=!0,X>0){this.warn(`Dropped ${X} out of ${I} video samples due to a missing keyframe`);const ee=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(X),t.dropped+=X,S+=(t.samples[0].pts-ee)/t.inputTimeScale,Q=S}else X===-1&&(this.warn(`No keyframe found out of ${I} video samples`),m=!1);if(this.ISGenerated){if(L&&k){const ee=this.getVideoStartPts(t.samples),re=(normalizePts(e.samples[0].pts,ee)-ee)/t.inputTimeScale;T+=Math.max(0,re),S+=Math.max(0,-re)}if(L){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),d=this.generateIS(e,t,n,a)),f=this.remuxAudio(e,T,this.isAudioContiguous,a,C||k||c===PlaylistLevelType.AUDIO?S:void 0),k){const ee=f?f.endPTS-f.startPTS:0;t.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),d=this.generateIS(e,t,n,a)),u=this.remuxVideo(t,S,$,ee)}}else k&&(u=this.remuxVideo(t,S,$,0));u&&(u.firstKeyFrame=X,u.independent=X!==-1,u.firstKeyFramePTS=Q)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(E=flushTextTrackMetadataCueSamples(i,n,this._initPTS,this._initDTS)),s.samples.length&&(g=flushTextTrackUserdataCueSamples(s,n,this._initPTS))),{audio:f,video:u,initSegment:d,independent:m,text:g,id3:E}}computeInitPts(e,t,i,s){const n=Math.round(i*t);let a=normalizePts(e,n);if(a<n+t)for(this.log(`Adjusting PTS for rollover in timeline near ${(n-a)/t} ${s}`);a<n+t;)a+=8589934592;return a-n}generateIS(e,t,i,s){const n=e.samples,a=t.samples,o=this.typeSupported,c={},u=this._initPTS;let f=!u||s,d="audio/mp4",g,E,m,T=-1;if(f&&(g=E=1/0),e.config&&n.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":o.mpeg?(d="audio/mpeg",e.codec=""):o.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}c.audio={id:"audio",container:d,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&o.mpeg?new Uint8Array(0):MP4.initSegment([e]),metadata:{channelCount:e.channelCount}},f&&(T=e.id,m=e.inputTimeScale,!u||m!==u.timescale?g=E=this.computeInitPts(n[0].pts,m,i,"audio"):f=!1)}if(t.sps&&t.pps&&a.length){if(t.timescale=t.inputTimeScale,c.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:MP4.initSegment([t]),metadata:{width:t.width,height:t.height}},f)if(T=t.id,m=t.inputTimeScale,!u||m!==u.timescale){const S=this.getVideoStartPts(a),b=normalizePts(a[0].dts,S),C=this.computeInitPts(b,m,i,"video"),I=this.computeInitPts(S,m,i,"video");E=Math.min(E,C),g=Math.min(g,I)}else f=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(c).length)return this.ISGenerated=!0,f?(u&&this.warn(`Timestamps at playlist time: ${s?"":"~"}${i} ${g/m} != initPTS: ${u.baseTime/u.timescale} (${u.baseTime}/${u.timescale}) trackId: ${u.trackId}`),this.log(`Found initPTS at playlist time: ${i} offset: ${g/m} (${g}/${m}) trackId: ${T}`),this._initPTS={baseTime:g,timescale:m,trackId:T},this._initDTS={baseTime:E,timescale:m,trackId:T}):g=m=void 0,{tracks:c,initPTS:g,timescale:m,trackId:T}}remuxVideo(e,t,i,s){const n=e.inputTimeScale,a=e.samples,o=[],c=a.length,u=this._initPTS,f=u.baseTime*n/u.timescale;let d=this.nextVideoTs,g=8,E=this.videoSampleDuration,m,T,S=Number.POSITIVE_INFINITY,b=Number.NEGATIVE_INFINITY,C=!1;if(!i||d===null){const ne=f+t*n,he=a[0].pts-normalizePts(a[0].dts,a[0].pts);chromeVersion&&d!==null&&Math.abs(ne-he-(d+f))<15e3?i=!0:d=ne-he-f}const I=d+f;for(let ne=0;ne<c;ne++){const he=a[ne];he.pts=normalizePts(he.pts,I),he.dts=normalizePts(he.dts,I),he.dts<a[ne>0?ne-1:ne].dts&&(C=!0)}C&&a.sort(function(ne,he){const pe=ne.dts-he.dts,Pe=ne.pts-he.pts;return pe||Pe}),m=a[0].dts,T=a[a.length-1].dts;const L=T-m,k=L?Math.round(L/(c-1)):E||e.inputTimeScale/30;if(i){const ne=m-I,he=ne>k,pe=ne<-1;if((he||pe)&&(he?this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${toMsFromMpegTsClock(ne,!0)} ms (${ne}dts) hole between fragments detected at ${t.toFixed(3)}`):this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${toMsFromMpegTsClock(-ne,!0)} ms (${ne}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!pe||I>=a[0].pts||chromeVersion)){m=I;const Pe=a[0].pts-ne;if(he)a[0].dts=m,a[0].pts=Pe;else{let ae=!0;for(let Ae=0;Ae<a.length&&!(a[Ae].dts>Pe&&ae);Ae++){const Re=a[Ae].pts;if(a[Ae].dts-=ne,a[Ae].pts-=ne,Ae<a.length-1){const Le=a[Ae+1].pts,Y=a[Ae].pts,q=Le<=Y,le=Le<=Re;ae=q==le}}}this.log(`Video: Initial PTS/DTS adjusted: ${toMsFromMpegTsClock(Pe,!0)}/${toMsFromMpegTsClock(m,!0)}, delta: ${toMsFromMpegTsClock(ne,!0)} ms`)}}m=Math.max(0,m);let U=0,O=0,F=m;for(let ne=0;ne<c;ne++){const he=a[ne],pe=he.units,Pe=pe.length;let ae=0;for(let Ae=0;Ae<Pe;Ae++)ae+=pe[Ae].data.length;O+=ae,U+=Pe,he.length=ae,he.dts<F?(he.dts=F,F+=k/4|0||1):F=he.dts,S=Math.min(he.pts,S),b=Math.max(he.pts,b)}T=a[c-1].dts;const G=O+4*U+8;let x;try{x=new Uint8Array(G)}catch(ne){this.observer.emit(Events.ERROR,Events.ERROR,{type:ErrorTypes.MUX_ERROR,details:ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,error:ne,bytes:G,reason:`fail allocating video mdat ${G}`});return}const $=new DataView(x.buffer);$.setUint32(0,G),x.set(MP4.types.mdat,4);let X=!1,Q=Number.POSITIVE_INFINITY,ee=Number.POSITIVE_INFINITY,te=Number.NEGATIVE_INFINITY,re=Number.NEGATIVE_INFINITY;for(let ne=0;ne<c;ne++){const he=a[ne],pe=he.units;let Pe=0;for(let Re=0,Le=pe.length;Re<Le;Re++){const Y=pe[Re],q=Y.data,le=Y.data.byteLength;$.setUint32(g,le),g+=4,x.set(q,g),g+=le,Pe+=4+le}let ae;if(ne<c-1)E=a[ne+1].dts-he.dts,ae=a[ne+1].pts-he.pts;else{const Re=this.config,Le=ne>0?he.dts-a[ne-1].dts:k;if(ae=ne>0?he.pts-a[ne-1].pts:k,Re.stretchShortVideoTrack&&this.nextAudioTs!==null){const Y=Math.floor(Re.maxBufferHole*n),q=(s?S+s*n:this.nextAudioTs+f)-he.pts;q>Y?(E=q-Le,E<0?E=Le:X=!0,this.log(`It is approximately ${q/90} ms to the next segment; using duration ${E/90} ms for the last video frame.`)):E=Le}else E=Le}const Ae=Math.round(he.pts-he.dts);Q=Math.min(Q,E),te=Math.max(te,E),ee=Math.min(ee,ae),re=Math.max(re,ae),o.push(createMp4Sample(he.key,E,Pe,Ae))}if(o.length){if(chromeVersion){if(chromeVersion<70){const ne=o[0].flags;ne.dependsOn=2,ne.isNonSync=0}}else if(safariWebkitVersion&&re-ee<te-Q&&k/te<.025&&o[0].cts===0){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let ne=m;for(let he=0,pe=o.length;he<pe;he++){const Pe=ne+o[he].duration,ae=ne+o[he].cts;if(he<pe-1){const Ae=Pe+o[he+1].cts;o[he].duration=Ae-ae}else o[he].duration=he?o[he-1].duration:k;o[he].cts=0,ne=Pe}}}E=X||!E?k:E;const me=T+E;this.nextVideoTs=d=me-f,this.videoSampleDuration=E,this.isVideoContiguous=!0;const ie={data1:MP4.moof(e.sequenceNumber++,m,_extends(e,{samples:o})),data2:x,startPTS:(S-f)/n,endPTS:(b+E-f)/n,startDTS:(m-f)/n,endDTS:d/n,type:"video",hasAudio:!1,hasVideo:!0,nb:o.length,dropped:e.dropped};return e.samples=[],e.dropped=0,ie}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return MPEG_AUDIO_SAMPLE_PER_FRAME;case"ac3":return AC3_SAMPLES_PER_FRAME;default:return AAC_SAMPLES_PER_FRAME}}remuxAudio(e,t,i,s,n){const a=e.inputTimeScale,o=e.samplerate?e.samplerate:a,c=a/o,u=this.getSamplesPerFrame(e),f=u*c,d=this._initPTS,g=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,E=[],m=n!==void 0;let T=e.samples,S=g?0:8,b=this.nextAudioTs||-1;const C=d.baseTime*a/d.timescale,I=C+t*a;if(this.isAudioContiguous=i=i||T.length&&b>0&&(s&&Math.abs(I-(b+C))<9e3||Math.abs(normalizePts(T[0].pts,I)-(b+C))<20*f),T.forEach(function(re){re.pts=normalizePts(re.pts,I)}),!i||b<0){const re=T.length;if(T=T.filter(me=>me.pts>=0),re!==T.length&&this.warn(`Removed ${T.length-re} of ${re} samples (initPTS ${C} / ${a})`),!T.length)return;n===0?b=0:s&&!m?b=Math.max(0,I-C):b=T[0].pts-C}if(e.segmentCodec==="aac"){const re=this.config.maxAudioFramesDrift;for(let me=0,H=b+C;me<T.length;me++){const z=T[me],ie=z.pts,ne=ie-H,he=Math.abs(1e3*ne/a);if(ne<=-re*f&&m)me===0&&(this.warn(`Audio frame @ ${(ie/a).toFixed(3)}s overlaps marker by ${Math.round(1e3*ne/a)} ms.`),this.nextAudioTs=b=ie-C,H=ie);else if(ne>=re*f&&he<MAX_SILENT_FRAME_DURATION&&m){let pe=Math.round(ne/f);for(H=ie-pe*f;H<0&&pe&&f;)pe--,H+=f;me===0&&(this.nextAudioTs=b=H-C),this.warn(`Injecting ${pe} audio frames @ ${((H-C)/a).toFixed(3)}s due to ${Math.round(1e3*ne/a)} ms gap.`);for(let Pe=0;Pe<pe;Pe++){let ae=AAC.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);ae||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),ae=z.unit.subarray()),T.splice(me,0,{unit:ae,pts:H}),H+=f,me++}}z.pts=H,H+=f}}let L=null,k=null,U,O=0,F=T.length;for(;F--;)O+=T[F].unit.byteLength;for(let re=0,me=T.length;re<me;re++){const H=T[re],z=H.unit;let ie=H.pts;if(k!==null){const he=E[re-1];he.duration=Math.round((ie-k)/c)}else if(i&&e.segmentCodec==="aac"&&(ie=b+C),L=ie,O>0){O+=S;try{U=new Uint8Array(O)}catch(he){this.observer.emit(Events.ERROR,Events.ERROR,{type:ErrorTypes.MUX_ERROR,details:ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,error:he,bytes:O,reason:`fail allocating audio mdat ${O}`});return}g||(new DataView(U.buffer).setUint32(0,O),U.set(MP4.types.mdat,4))}else return;U.set(z,S);const ne=z.byteLength;S+=ne,E.push(createMp4Sample(!0,u,ne,0)),k=ie}const G=E.length;if(!G)return;const x=E[E.length-1];b=k-C,this.nextAudioTs=b+c*x.duration;const $=g?new Uint8Array(0):MP4.moof(e.sequenceNumber++,L/c,_extends({},e,{samples:E}));e.samples=[];const X=(L-C)/a,Q=this.nextAudioTs/a,te={data1:$,data2:U,startPTS:X,endPTS:Q,startDTS:X,endDTS:Q,type:"audio",hasAudio:!0,hasVideo:!1,nb:G};return this.isAudioContiguous=!0,te}}function normalizePts(r,e){let t;if(e===null)return r;for(e<r?t=-8589934592:t=8589934592;Math.abs(r-e)>4294967296;)r+=t;return r}function findKeyframeIndex(r){for(let e=0;e<r.length;e++)if(r[e].key)return e;return-1}function flushTextTrackMetadataCueSamples(r,e,t,i){const s=r.samples.length;if(!s)return;const n=r.inputTimeScale;for(let o=0;o<s;o++){const c=r.samples[o];c.pts=normalizePts(c.pts-t.baseTime*n/t.timescale,e*n)/n,c.dts=normalizePts(c.dts-i.baseTime*n/i.timescale,e*n)/n}const a=r.samples;return r.samples=[],{samples:a}}function flushTextTrackUserdataCueSamples(r,e,t){const i=r.samples.length;if(!i)return;const s=r.inputTimeScale;for(let a=0;a<i;a++){const o=r.samples[a];o.pts=normalizePts(o.pts-t.baseTime*s/t.timescale,e*s)/s}r.samples.sort((a,o)=>a.pts-o.pts);const n=r.samples;return r.samples=[],{samples:n}}class PassThroughRemuxer extends Logger{constructor(e,t,i,s){super("passthrough-remuxer",s),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,this.isVideoContiguous=!1}destroy(){}resetTimeStamp(e){this.lastEndTime=null;const t=this.initPTS;t&&e&&t.baseTime===e.baseTime&&t.timescale===e.timescale||(this.initPTS=e)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(e,t,i,s){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(e,s),this.emitInitSegment=!0}generateInitSegment(e,t){let{audioCodec:i,videoCodec:s}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const{audio:n,video:a}=this.initData=parseInitSegment(e);if(t)patchEncyptionData(e,t);else{const c=n||a;c!=null&&c.encrypted&&this.warn(`Init segment with encrypted track with has no key ("${c.codec}")!`)}n&&(i=getParsedTrackCodec(n,ElementaryStreamTypes.AUDIO,this)),a&&(s=getParsedTrackCodec(a,ElementaryStreamTypes.VIDEO,this));const o={};n&&a?o.audiovideo={container:"video/mp4",codec:i+","+s,supplemental:a.supplemental,encrypted:a.encrypted,initSegment:e,id:"main"}:n?o.audio={container:"audio/mp4",codec:i,encrypted:n.encrypted,initSegment:e,id:"audio"}:a?o.video={container:"video/mp4",codec:s,supplemental:a.supplemental,encrypted:a.encrypted,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=o}remux(e,t,i,s,n,a){var o,c;let{initPTS:u,lastEndTime:f}=this;const d={audio:void 0,video:void 0,text:s,id3:i,initSegment:void 0};isFiniteNumber(f)||(f=this.lastEndTime=n||0);const g=t.samples;if(!g.length)return d;const E={initPTS:void 0,timescale:void 0,trackId:void 0};let m=this.initData;if((o=m)!=null&&o.length||(this.generateInitSegment(g),m=this.initData),!((c=m)!=null&&c.length))return this.warn("Failed to generate initSegment."),d;this.emitInitSegment&&(E.tracks=this.initTracks,this.emitInitSegment=!1);const T=getSampleData(g,m,this),S=m.audio?T[m.audio.id]:null,b=m.video?T[m.video.id]:null,C=toStartEndOrDefault(b,1/0),I=toStartEndOrDefault(S,1/0),L=toStartEndOrDefault(b,0,!0),k=toStartEndOrDefault(S,0,!0);let U=n,O=0;const F=S&&(!b||!u&&I<C||u&&u.trackId===m.audio.id),G=F?S:b;if(G){const H=G.timescale,z=G.start-n*H,ie=F?m.audio.id:m.video.id;U=G.start/H,O=F?k-I:L-C,(a||!u)&&(isInvalidInitPts(u,U,n,O)||H!==u.timescale)&&(u&&this.warn(`Timestamps at playlist time: ${a?"":"~"}${n} ${z/H} != initPTS: ${u.baseTime/u.timescale} (${u.baseTime}/${u.timescale}) trackId: ${u.trackId}`),this.log(`Found initPTS at playlist time: ${n} offset: ${U-n} (${z}/${H}) trackId: ${ie}`),u=null,E.initPTS=z,E.timescale=H,E.trackId=ie)}else this.warn(`No audio or video samples found for initPTS at playlist time: ${n}`);u?(E.initPTS=u.baseTime,E.timescale=u.timescale,E.trackId=u.trackId):((!E.timescale||E.trackId===void 0||E.initPTS===void 0)&&(this.warn("Could not set initPTS"),E.initPTS=U,E.timescale=1,E.trackId=-1),this.initPTS=u={baseTime:E.initPTS,timescale:E.timescale,trackId:E.trackId});const x=U-u.baseTime/u.timescale,$=x+O;O>0?this.lastEndTime=$:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const X=!!m.audio,Q=!!m.video;let ee="";X&&(ee+="audio"),Q&&(ee+="video");const te=(m.audio?m.audio.encrypted:!1)||(m.video?m.video.encrypted:!1),re={data1:g,startPTS:x,startDTS:x,endPTS:$,endDTS:$,type:ee,hasAudio:X,hasVideo:Q,nb:1,dropped:0,encrypted:te};d.audio=X&&!Q?re:void 0,d.video=Q?re:void 0;const me=b?.sampleCount;if(me){const H=b.keyFrameIndex,z=H!==-1;re.nb=me,re.dropped=H===0||this.isVideoContiguous?0:z?H:me,re.independent=z,re.firstKeyFrame=H,z&&b.keyFrameStart&&(re.firstKeyFramePTS=(b.keyFrameStart-u.baseTime)/u.timescale),this.isVideoContiguous||(d.independent=z),this.isVideoContiguous||(this.isVideoContiguous=z),re.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${H}/${me} dropped: ${re.dropped} start: ${re.firstKeyFramePTS||"NA"}`)}return d.initSegment=E,d.id3=flushTextTrackMetadataCueSamples(i,n,u,u),s.samples.length&&(d.text=flushTextTrackUserdataCueSamples(s,n,u)),d}}function toStartEndOrDefault(r,e,t=!1){return r?.start!==void 0?(r.start+(t?r.duration:0))/r.timescale:e}function isInvalidInitPts(r,e,t,i){if(r===null)return!0;const s=Math.max(i,1),n=e-r.baseTime/r.timescale;return Math.abs(n-t)>s}function getParsedTrackCodec(r,e,t){const i=r.codec;return i&&i.length>4?i:e===ElementaryStreamTypes.AUDIO?i==="ec-3"||i==="ac-3"||i==="alac"?i:i==="fLaC"||i==="Opus"?getCodecCompatibleName(i,!1):(t.warn(`Unhandled audio codec "${i}" in mp4 MAP`),i||"mp4a"):(t.warn(`Unhandled video codec "${i}" in mp4 MAP`),i||"avc1")}let now;try{now=self.performance.now.bind(self.performance)}catch(r){now=Date.now}const muxConfig=[{demux:MP4Demuxer,remux:PassThroughRemuxer},{demux:TSDemuxer,remux:MP4Remuxer},{demux:AACDemuxer,remux:MP4Remuxer},{demux:MP3Demuxer,remux:MP4Remuxer}];muxConfig.splice(2,0,{demux:AC3Demuxer,remux:MP4Remuxer});class Transmuxer{constructor(e,t,i,s,n,a){this.asyncResult=!1,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=i,this.id=n,this.logger=a}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,i,s){const n=i.transmuxing;n.executeStart=now();let a=new Uint8Array(e);const{currentTransmuxState:o,transmuxConfig:c}=this;s&&(this.currentTransmuxState=s);const{contiguous:u,discontinuity:f,trackSwitch:d,accurateTimeOffset:g,timeOffset:E,initSegmentChange:m}=s||o,{audioCodec:T,videoCodec:S,defaultInitPts:b,duration:C,initSegmentData:I}=c,L=getEncryptionType(a,t);if(L&&isFullSegmentEncryption(L.method)){const F=this.getDecrypter(),G=getAesModeFromFullSegmentMethod(L.method);if(F.isSync()){let x=F.softwareDecrypt(a,L.key.buffer,L.iv.buffer,G);if(i.part>-1){const X=F.flush();x=X&&X.buffer}if(!x)return n.executeEnd=now(),emptyResult(i);a=new Uint8Array(x)}else return this.asyncResult=!0,this.decryptionPromise=F.webCryptoDecrypt(a,L.key.buffer,L.iv.buffer,G).then(x=>{const $=this.push(x,null,i);return this.decryptionPromise=null,$}),this.decryptionPromise}const k=this.needsProbing(f,d);if(k){const F=this.configureTransmuxer(a);if(F)return this.logger.warn(`[transmuxer] ${F.message}`),this.observer.emit(Events.ERROR,Events.ERROR,{type:ErrorTypes.MEDIA_ERROR,details:ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,error:F,reason:F.message}),n.executeEnd=now(),emptyResult(i)}(f||d||m||k)&&this.resetInitSegment(I,T,S,C,t),(f||m||k)&&this.resetInitialTimestamp(b),u||this.resetContiguity();const U=this.transmux(a,L,E,g,i);this.asyncResult=isPromise(U);const O=this.currentTransmuxState;return O.contiguous=!0,O.discontinuity=!1,O.trackSwitch=!1,n.executeEnd=now(),U}flush(e){const t=e.transmuxing;t.executeStart=now();const{decrypter:i,currentTransmuxState:s,decryptionPromise:n}=this;if(n)return this.asyncResult=!0,n.then(()=>this.flush(e));const a=[],{timeOffset:o}=s;if(i){const d=i.flush();d&&a.push(this.push(d.buffer,null,e))}const{demuxer:c,remuxer:u}=this;if(!c||!u){t.executeEnd=now();const d=[emptyResult(e)];return this.asyncResult?Promise.resolve(d):d}const f=c.flush(o);return isPromise(f)?(this.asyncResult=!0,f.then(d=>(this.flushRemux(a,d,e),a))):(this.flushRemux(a,f,e),this.asyncResult?Promise.resolve(a):a)}flushRemux(e,t,i){const{audioTrack:s,videoTrack:n,id3Track:a,textTrack:o}=t,{accurateTimeOffset:c,timeOffset:u}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${i.sn}${i.part>-1?" part: "+i.part:""} of ${this.id===PlaylistLevelType.MAIN?"level":"track"} ${i.level}`);const f=this.remuxer.remux(s,n,a,o,u,c,!0,this.id);e.push({remuxResult:f,chunkMeta:i}),i.transmuxing.executeEnd=now()}resetInitialTimestamp(e){const{demuxer:t,remuxer:i}=this;!t||!i||(t.resetTimeStamp(e),i.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,i,s,n){const{demuxer:a,remuxer:o}=this;!a||!o||(a.resetInitSegment(e,t,i,s),o.resetInitSegment(e,t,i,n))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,i,s,n){let a;return t&&t.method==="SAMPLE-AES"?a=this.transmuxSampleAes(e,t,i,s,n):a=this.transmuxUnencrypted(e,i,s,n),a}transmuxUnencrypted(e,t,i,s){const{audioTrack:n,videoTrack:a,id3Track:o,textTrack:c}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(n,a,o,c,t,i,!1,this.id),chunkMeta:s}}transmuxSampleAes(e,t,i,s,n){return this.demuxer.demuxSampleAes(e,t,i).then(a=>({remuxResult:this.remuxer.remux(a.audioTrack,a.videoTrack,a.id3Track,a.textTrack,i,s,!1,this.id),chunkMeta:n}))}configureTransmuxer(e){const{config:t,observer:i,typeSupported:s}=this;let n;for(let d=0,g=muxConfig.length;d<g;d++){var a;if((a=muxConfig[d].demux)!=null&&a.probe(e,this.logger)){n=muxConfig[d];break}}if(!n)return new Error("Failed to find demuxer by probing fragment data");const o=this.demuxer,c=this.remuxer,u=n.remux,f=n.demux;(!c||!(c instanceof u))&&(this.remuxer=new u(i,t,s,this.logger)),(!o||!(o instanceof f))&&(this.demuxer=new f(i,t,s,this.logger),this.probe=f.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new Decrypter(this.config)),e}}function getEncryptionType(r,e){let t=null;return r.byteLength>0&&e?.key!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const emptyResult=r=>({remuxResult:{},chunkMeta:r});function isPromise(r){return"then"in r&&r.then instanceof Function}class TransmuxConfig{constructor(e,t,i,s,n){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=i,this.duration=s,this.defaultInitPts=n||null}}class TransmuxState{constructor(e,t,i,s,n,a){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=e,this.contiguous=t,this.accurateTimeOffset=i,this.trackSwitch=s,this.timeOffset=n,this.initSegmentChange=a}}let transmuxerInstanceCount=0;class TransmuxerInterface{constructor(e,t,i,s){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=transmuxerInstanceCount++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=c=>{const u=c.data,f=this.hls;if(!(!f||!(u!=null&&u.event)||u.instanceNo!==this.instanceNo))switch(u.event){case"init":{var d;const g=(d=this.workerContext)==null?void 0:d.objectURL;g&&self.URL.revokeObjectURL(g);break}case"transmuxComplete":{this.handleTransmuxComplete(u.data);break}case"flush":{this.onFlush(u.data);break}case"workerLog":{f.logger[u.data.logType]&&f.logger[u.data.logType](u.data.message);break}default:{u.data=u.data||{},u.data.frag=this.frag,u.data.part=this.part,u.data.id=this.id,f.trigger(u.event,u.data);break}}},this.onWorkerError=c=>{if(!this.hls)return;const u=new Error(`${c.message} (${c.filename}:${c.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(Events.ERROR,{type:ErrorTypes.OTHER_ERROR,details:ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:u})};const n=e.config;this.hls=e,this.id=t,this.useWorker=!!n.enableWorker,this.onTransmuxComplete=i,this.onFlush=s;const a=(c,u)=>{u=u||{},u.frag=this.frag||void 0,c===Events.ERROR&&(u=u,u.parent=this.id,u.part=this.part,this.error=u.error),this.hls.trigger(c,u)};this.observer=new EventEmitter,this.observer.on(Events.FRAG_DECRYPTED,a),this.observer.on(Events.ERROR,a);const o=getM2TSSupportedAudioTypes(n.preferManagedMediaSource);if(this.useWorker&&typeof Worker<"u"){const c=this.hls.logger;if(n.workerPath||hasUMDWorker()){try{n.workerPath?(c.log(`loading Web Worker ${n.workerPath} for "${t}"`),this.workerContext=loadWorker(n.workerPath)):(c.log(`injecting Web Worker for "${t}"`),this.workerContext=injectWorker());const{worker:f}=this.workerContext;f.addEventListener("message",this.onWorkerMessage),f.addEventListener("error",this.onWorkerError),f.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:o,id:t,config:stringify(n)})}catch(f){c.warn(`Error setting up "${t}" Web Worker, fallback to inline`,f),this.terminateWorker(),this.error=null,this.transmuxer=new Transmuxer(this.observer,o,n,"",t,e.logger)}return}}this.transmuxer=new Transmuxer(this.observer,o,n,"",t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=transmuxerInstanceCount++;const t=this.hls.config,i=getM2TSSupportedAudioTypes(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:i,id:this.id,config:stringify(t)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),removeWorkerFromStore(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,t,i,s,n,a,o,c,u,f){var d,g;u.transmuxing.start=self.performance.now();const{instanceNo:E,transmuxer:m}=this,T=a?a.start:n.start,S=n.decryptdata,b=this.frag,C=!(b&&n.cc===b.cc),I=!(b&&u.level===b.level),L=b?u.sn-b.sn:-1,k=this.part?u.part-this.part.index:-1,U=L===0&&u.id>1&&u.id===b?.stats.chunkCount,O=!I&&(L===1||L===0&&(k===1||U&&k<=0)),F=self.performance.now();(I||L||n.stats.parsing.start===0)&&(n.stats.parsing.start=F),a&&(k||!O)&&(a.stats.parsing.start=F);const G=!(b&&((d=n.initSegment)==null?void 0:d.url)===((g=b.initSegment)==null?void 0:g.url)),x=new TransmuxState(C,O,c,I,T,G);if(!O||C||G){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${n.type} sn: ${u.sn}${u.part>-1?" part: "+u.part:""} ${this.id===PlaylistLevelType.MAIN?"level":"track"}: ${u.level} id: ${u.id}
|
|
294
|
-
discontinuity: ${C}
|
|
295
|
-
trackSwitch: ${I}
|
|
296
|
-
contiguous: ${O}
|
|
297
|
-
accurateTimeOffset: ${c}
|
|
298
|
-
timeOffset: ${T}
|
|
299
|
-
initSegmentChange: ${G}`);const $=new TransmuxConfig(i,s,t,o,f);this.configureTransmuxer($)}if(this.frag=n,this.part=a,this.workerContext)this.workerContext.worker.postMessage({instanceNo:E,cmd:"demux",data:e,decryptdata:S,chunkMeta:u,state:x},e instanceof ArrayBuffer?[e]:[]);else if(m){const $=m.push(e,S,u,x);isPromise($)?$.then(X=>{this.handleTransmuxComplete(X)}).catch(X=>{this.transmuxerError(X,u,"transmuxer-interface push error")}):this.handleTransmuxComplete($)}}flush(e){e.transmuxing.start=self.performance.now();const{instanceNo:t,transmuxer:i}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:t,cmd:"flush",chunkMeta:e});else if(i){const s=i.flush(e);isPromise(s)?s.then(n=>{this.handleFlushResult(n,e)}).catch(n=>{this.transmuxerError(n,e,"transmuxer-interface flush error")}):this.handleFlushResult(s,e)}}transmuxerError(e,t,i){this.hls&&(this.error=e,this.hls.trigger(Events.ERROR,{type:ErrorTypes.MEDIA_ERROR,details:ErrorDetails.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:i}))}handleFlushResult(e,t){e.forEach(i=>{this.handleTransmuxComplete(i)}),this.onFlush(t)}configureTransmuxer(e){const{instanceNo:t,transmuxer:i}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:t,cmd:"configure",config:e}):i&&i.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}const TICK_INTERVAL$3=100;class AudioStreamController extends BaseStreamController{constructor(e,t,i){super(e,t,i,"audio-stream-controller",PlaylistLevelType.AUDIO),this.mainAnchor=null,this.mainFragLoading=null,this.audioOnly=!1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.resetItem()}resetItem(){this.mainDetails=this.mainAnchor=this.mainFragLoading=this.bufferedTrack=this.switchingTrack=this.waitingData=this.cachedTrackLoadedData=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(Events.LEVEL_LOADED,this.onLevelLoaded,this),e.on(Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(Events.BUFFER_RESET,this.onBufferReset,this),e.on(Events.BUFFER_CREATED,this.onBufferCreated,this),e.on(Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(Events.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(Events.FRAG_LOADING,this.onFragLoading,this),e.on(Events.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:e}=this;e&&(super.unregisterListeners(),e.off(Events.LEVEL_LOADED,this.onLevelLoaded,this),e.off(Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(Events.BUFFER_RESET,this.onBufferReset,this),e.off(Events.BUFFER_CREATED,this.onBufferCreated,this),e.off(Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(Events.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(Events.FRAG_LOADING,this.onFragLoading,this),e.off(Events.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,{frag:t,id:i,initPTS:s,timescale:n,trackId:a}){if(i===PlaylistLevelType.MAIN){const o=t.cc,c=this.fragCurrent;if(this.initPTS[o]={baseTime:s,timescale:n,trackId:a},this.log(`InitPTS for cc: ${o} found from main: ${s/n} (${s}/${n}) trackId: ${a}`),this.mainAnchor=t,this.state===State.WAITING_INIT_PTS){const u=this.waitingData;(!u&&!this.loadingParts||u&&u.frag.cc!==o)&&this.syncWithAnchor(t,u?.frag)}else!this.hls.hasEnoughToStart&&c&&c.cc!==o?(c.abortRequests(),this.syncWithAnchor(t,c)):this.state===State.IDLE&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,t){var i;const s=((i=this.mainFragLoading)==null?void 0:i.frag)||null;if(t&&s?.cc===t.cc)return;const n=(s||e).cc,a=this.getLevelDetails(),o=this.getLoadPosition(),c=findNearestWithCC(a,n,o);c&&(this.log(`Syncing with main frag at ${c.start} cc ${c.cc}`),this.startFragRequested=!1,this.nextLoadPosition=c.start,this.resetLoadingState(),this.state===State.IDLE&&this.doTickIdle())}startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=State.STOPPED;return}const i=this.lastCurrentTime;this.stopLoad(),this.setInterval(TICK_INTERVAL$3),i>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i,this.state=State.IDLE):this.state=State.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case State.IDLE:this.doTickIdle();break;case State.WAITING_TRACK:{const{levels:e,trackId:t}=this,i=e?.[t],s=i?.details;if(s&&!this.waitForLive(i)){if(this.waitForCdnTuneIn(s))break;this.state=State.WAITING_INIT_PTS}break}case State.FRAG_LOADING_WAITING_RETRY:{this.checkRetryDate();break}case State.WAITING_INIT_PTS:{const e=this.waitingData;if(e){const{frag:t,part:i,cache:s,complete:n}=e,a=this.mainAnchor;if(this.initPTS[t.cc]!==void 0){this.waitingData=null,this.state=State.FRAG_LOADING;const o=s.flush().buffer,c={frag:t,part:i,payload:o,networkDetails:null};this._handleFragmentLoadProgress(c),n&&super._handleFragmentLoadComplete(c)}else a&&a.cc!==e.frag.cc&&this.syncWithAnchor(a,e.frag)}else this.state=State.IDLE}}this.onTickEnd()}resetLoadingState(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){var e;const{hls:t,levels:i,media:s,trackId:n}=this,a=t.config;if(!this.buffering||!s&&!this.primaryPrefetch&&(this.startFragRequested||!a.startFragPrefetch)||!(i!=null&&i[n]))return;const o=i[n],c=o.details;if(!c||this.waitForLive(o)||this.waitForCdnTuneIn(c)){this.state=State.WAITING_TRACK,this.startFragRequested=!1;return}const u=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&u&&(this.bufferFlushed=!1,this.afterBufferFlushed(u,ElementaryStreamTypes.AUDIO,PlaylistLevelType.AUDIO));const f=this.getFwdBufferInfo(u,PlaylistLevelType.AUDIO);if(f===null)return;if(!this.switchingTrack&&this._streamEnded(f,c)){t.trigger(Events.BUFFER_EOS,{type:"audio"}),this.state=State.ENDED;return}const d=f.len,g=t.maxBufferLength,E=c.fragments,m=E[0].start,T=this.getLoadPosition(),S=this.flushing?T:f.end;if(this.switchingTrack&&s){const I=T;c.PTSKnown&&I<m&&(f.end>m||f.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),s.currentTime=m+.05)}if(d>=g&&!this.switchingTrack&&S<E[E.length-1].start)return;let b=this.getNextFragment(S,c);if(b&&this.isLoopLoading(b,S)&&(b=this.getNextFragmentLoopLoading(b,c,f,PlaylistLevelType.MAIN,g)),!b){this.bufferFlushed=!0;return}let C=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&C&&isMediaFragment(b)&&!b.endList&&(!c.live||!this.loadingParts&&S<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(C)===FragmentState.OK&&(this.mainFragLoading=C=null),C&&isMediaFragment(C))){if(b.start>C.end){const L=this.fragmentTracker.getFragAtPos(S,PlaylistLevelType.MAIN);L&&L.end>C.end&&(C=L,this.mainFragLoading={frag:L,targetBufferTime:null})}if(b.start>C.end)return}this.loadFragment(b,o,S)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(i=>new Level(i))}onAudioTrackSwitching(e,t){const i=!!t.url;this.trackId=t.id;const{fragCurrent:s}=this;s&&(s.abortRequests(),this.removeUnbufferedFrags(s.start)),this.resetLoadingState(),i?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==State.STOPPED&&(this.setInterval(TICK_INTERVAL$3),this.state=State.IDLE,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(e,t){this.mainDetails=t.details;const i=this.cachedTrackLoadedData;i&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(Events.AUDIO_TRACK_LOADED,i))}onAudioTrackLoaded(e,t){var i;const{levels:s}=this,{details:n,id:a,groupId:o,track:c}=t;if(!s){this.warn(`Audio tracks reset while loading track ${a} "${c.name}" of "${o}"`);return}const u=this.mainDetails;if(!u||n.endCC>u.endCC||u.expired){this.cachedTrackLoadedData=t,this.state!==State.STOPPED&&(this.state=State.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${a} "${c.name}" of "${o}" loaded [${n.startSN},${n.endSN}]${n.lastPartSn?`[part-${n.lastPartSn}-${n.lastPartIndex}]`:""},duration:${n.totalduration}`);const f=s[a];let d=0;if(n.live||(i=f.details)!=null&&i.live){if(this.checkLiveUpdate(n),n.deltaUpdateFailed)return;if(f.details){var g;d=this.alignPlaylists(n,f.details,(g=this.levelLastLoaded)==null?void 0:g.details)}n.alignedSliding||(alignDiscontinuities(n,u),n.alignedSliding||alignMediaPlaylistByPDT(n,u),d=n.fragmentStart)}f.details=n,this.levelLastLoaded=f,this.startFragRequested||this.setStartPosition(u,d),this.hls.trigger(Events.AUDIO_TRACK_UPDATED,{details:n,id:a,groupId:t.groupId}),this.state===State.WAITING_TRACK&&!this.waitForCdnTuneIn(n)&&(this.state=State.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const i=e.frag,{part:s,payload:n}=e,{config:a,trackId:o,levels:c}=this;if(!c){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const u=c[o];if(!u){this.warn("Audio track is undefined on fragment load progress");return}const f=u.details;if(!f){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(i.start);return}const d=a.defaultAudioCodec||u.audioCodec||"mp4a.40.2";let g=this.transmuxer;g||(g=this.transmuxer=new TransmuxerInterface(this.hls,PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const E=this.initPTS[i.cc],m=(t=i.initSegment)==null?void 0:t.data;if(E!==void 0){const S=s?s.index:-1,b=S!==-1,C=new ChunkMetadata(i.level,i.sn,i.stats.chunkCount,n.byteLength,S,b);g.push(n,m,d,"",i,s,f.totalduration,!1,C,E)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${f.startSN} ,${f.endSN}],track ${o}`);const{cache:T}=this.waitingData=this.waitingData||{frag:i,part:s,cache:new ChunkCache,complete:!1};T.push(new Uint8Array(n)),this.state!==State.STOPPED&&(this.state=State.WAITING_INIT_PTS)}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(e,t){this.bufferFlushed=this.flushing=!1;const i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer||null)}onFragLoading(e,t){!this.audioOnly&&t.frag.type===PlaylistLevelType.MAIN&&isMediaFragment(t.frag)&&(this.mainFragLoading=t,this.state===State.IDLE&&this.tick())}onFragBuffered(e,t){const{frag:i,part:s}=t;if(i.type!==PlaylistLevelType.AUDIO){!this.audioOnly&&i.type===PlaylistLevelType.MAIN&&!i.elementaryStreams.video&&!i.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${s?" p: "+s.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(isMediaFragment(i)){this.fragPrevious=i;const n=this.switchingTrack;n&&(this.bufferedTrack=n,this.switchingTrack=null,this.hls.trigger(Events.AUDIO_TRACK_SWITCHED,_objectSpread2({},n)))}this.fragBufferedComplete(i,s),this.media&&this.tick()}onError(e,t){var i;if(t.fatal){this.state=State.ERROR;return}switch(t.details){case ErrorDetails.FRAG_GAP:case ErrorDetails.FRAG_PARSING_ERROR:case ErrorDetails.FRAG_DECRYPT_ERROR:case ErrorDetails.FRAG_LOAD_ERROR:case ErrorDetails.FRAG_LOAD_TIMEOUT:case ErrorDetails.KEY_LOAD_ERROR:case ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(PlaylistLevelType.AUDIO,t);break;case ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:case ErrorDetails.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===State.WAITING_TRACK&&((i=t.context)==null?void 0:i.type)===PlaylistContextType.AUDIO_TRACK&&(this.state=State.IDLE);break;case ErrorDetails.BUFFER_ADD_CODEC_ERROR:case ErrorDetails.BUFFER_APPEND_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)||this.resetLoadingState();break;case ErrorDetails.BUFFER_FULL_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case ErrorDetails.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==ElementaryStreamTypes.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==ElementaryStreamTypes.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===State.ENDED&&(this.state=State.IDLE);const i=this.mediaBuffer||this.media;i&&(this.afterBufferFlushed(i,t,PlaylistLevelType.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const i="audio",{hls:s}=this,{remuxResult:n,chunkMeta:a}=e,o=this.getCurrentContext(a);if(!o){this.resetWhenMissingContext(a);return}const{frag:c,part:u,level:f}=o,{details:d}=f,{audio:g,text:E,id3:m,initSegment:T}=n;if(this.fragContextChanged(c)||!d){this.fragmentTracker.removeFragment(c);return}if(this.state=State.PARSING,this.switchingTrack&&g&&this.completeAudioSwitch(this.switchingTrack),T!=null&&T.tracks){const S=c.initSegment||c;if(this.unhandledEncryptionError(T,c))return;this._bufferInitSegment(f,T.tracks,S,a),s.trigger(Events.FRAG_PARSING_INIT_SEGMENT,{frag:S,id:i,tracks:T.tracks})}if(g){const{startPTS:S,endPTS:b,startDTS:C,endDTS:I}=g;u&&(u.elementaryStreams[ElementaryStreamTypes.AUDIO]={startPTS:S,endPTS:b,startDTS:C,endDTS:I}),c.setElementaryStreamInfo(ElementaryStreamTypes.AUDIO,S,b,C,I),this.bufferFragmentData(g,c,u,a)}if(m!=null&&(t=m.samples)!=null&&t.length){const S=_extends({id:i,frag:c,details:d},m);s.trigger(Events.FRAG_PARSING_METADATA,S)}if(E){const S=_extends({id:i,frag:c,details:d},E);s.trigger(Events.FRAG_PARSING_USERDATA,S)}}_bufferInitSegment(e,t,i,s){if(this.state!==State.PARSING||(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio))return;const n=t.audio;n.id=PlaylistLevelType.AUDIO;const a=e.audioCodec;this.log(`Init audio buffer, container:${n.container}, codecs[level/parsed]=[${a}/${n.codec}]`),a&&a.split(",").length===1&&(n.levelCodec=a),this.hls.trigger(Events.BUFFER_CODECS,t);const o=n.initSegment;if(o!=null&&o.byteLength){const c={type:"audio",frag:i,part:null,chunkMeta:s,parent:i.type,data:o};this.hls.trigger(Events.BUFFER_APPENDING,c)}this.tickImmediate()}loadFragment(e,t,i){const s=this.fragmentTracker.getState(e);if(this.switchingTrack||s===FragmentState.NOT_LOADED||s===FragmentState.PARTIAL){var n;if(!isMediaFragment(e))this._loadInitSegment(e,t);else if((n=t.details)!=null&&n.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=State.WAITING_INIT_PTS;const a=this.mainDetails;a&&a.fragmentStart!==t.details.fragmentStart&&alignMediaPlaylistByPDT(t.details,a)}else super.loadFragment(e,t,i)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){const{name:t,lang:i,assocLang:s,characteristics:n,audioCodec:a,channels:o}=this.bufferedTrack;matchesOption({name:t,lang:i,assocLang:s,characteristics:n,audioCodec:a,channels:o},e,audioMatchPredicate)||(useAlternateAudio(e.url,this.hls)?(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null):this.bufferedTrack=e)}}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(Events.AUDIO_TRACK_SWITCHED,_objectSpread2({},e))}}class BasePlaylistController extends Logger{constructor(e,t){super(t,e.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,i){const s=t?.renditionReports;if(s){let n=-1;for(let a=0;a<s.length;a++){const o=s[a];let c;try{c=new self.URL(o.URI,t.url).href}catch(u){this.warn(`Could not construct new URL for Rendition Report: ${u}`),c=o.URI||""}if(c===e){n=a;break}else c===e.substring(0,c.length)&&(n=a)}if(n!==-1){const a=s[n],o=parseInt(a["LAST-MSN"])||t.lastPartSn;let c=parseInt(a["LAST-PART"])||t.lastPartIndex;if(this.hls.config.lowLatencyMode){const f=Math.min(t.age-t.partTarget,t.targetduration);c>=0&&f>t.partTarget&&(c+=1)}const u=i&&getSkipValue(i);return new HlsUrlParameters(o,c>=0?c:void 0,u)}}}loadPlaylist(e){this.clearTimer()}loadingPlaylist(e,t){this.clearTimer()}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}getUrlWithDirectives(e,t){if(t)try{return t.addDirectives(e)}catch(i){this.warn(`Could not construct new URL with HLS Delivery Directives: ${i}`)}return e}playlistLoaded(e,t,i){const{details:s,stats:n}=t,a=self.performance.now(),o=n.loading.first?Math.max(0,a-n.loading.first):0;s.advancedDateTime=Date.now()-o;const c=this.hls.config.timelineOffset;if(c!==s.appliedTimelineOffset){const f=Math.max(c||0,0);s.appliedTimelineOffset=f,s.fragments.forEach(d=>{d.setStart(d.playlistOffset+f)})}if(s.live||i!=null&&i.live){const f="levelInfo"in t?t.levelInfo:t.track;if(s.reloaded(i),i&&s.fragments.length>0){mergeDetails(i,s,this);const C=s.playlistParsingError;if(C){this.warn(C);const I=this.hls;if(!I.config.ignorePlaylistParsingErrors){var u;const{networkDetails:L}=t;I.trigger(Events.ERROR,{type:ErrorTypes.NETWORK_ERROR,details:ErrorDetails.LEVEL_PARSING_ERROR,fatal:!1,url:s.url,error:C,reason:C.message,level:t.level||void 0,parent:(u=s.fragments[0])==null?void 0:u.type,networkDetails:L,stats:n});return}s.playlistParsingError=null}}s.requestScheduled===-1&&(s.requestScheduled=n.loading.start);const d=this.hls.mainForwardBufferInfo,g=d?d.end-d.len:0,E=(s.edge-g)*1e3,m=computeReloadInterval(s,E);if(s.requestScheduled+m<a?s.requestScheduled=a:s.requestScheduled+=m,this.log(`live playlist ${e} ${s.advanced?"REFRESHED "+s.lastPartSn+"-"+s.lastPartIndex:s.updated?"UPDATED":"MISSED"}`),!this.canLoad||!s.live)return;let T,S,b;if(s.canBlockReload&&s.endSN&&s.advanced){const C=this.hls.config.lowLatencyMode,I=s.lastPartSn,L=s.endSN,k=s.lastPartIndex,U=k!==-1,O=I===L;U?O?(S=L+1,b=C?0:k):(S=I,b=C?k+1:s.maxPartIndex):S=L+1;const F=s.age,G=F+s.ageHeader;let x=Math.min(G-s.partTarget,s.targetduration*1.5);if(x>0){if(G>s.targetduration*3)this.log(`Playlist last advanced ${F.toFixed(2)}s ago. Omitting segment and part directives.`),S=void 0,b=void 0;else if(i!=null&&i.tuneInGoal&&G-s.partTarget>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${x} with playlist age: ${s.age}`),x=0;else{const $=Math.floor(x/s.targetduration);if(S+=$,b!==void 0){const X=Math.round(x%s.targetduration/s.partTarget);b+=X}this.log(`CDN Tune-in age: ${s.ageHeader}s last advanced ${F.toFixed(2)}s goal: ${x} skip sn ${$} to part ${b}`)}s.tuneInGoal=x}if(T=this.getDeliveryDirectives(s,t.deliveryDirectives,S,b),C||!O){s.requestScheduled=a,this.loadingPlaylist(f,T);return}}else(s.canBlockReload||s.canSkipUntil)&&(T=this.getDeliveryDirectives(s,t.deliveryDirectives,S,b));T&&S!==void 0&&s.canBlockReload&&(s.requestScheduled=n.loading.first+Math.max(m-o*2,m/2)),this.scheduleLoading(f,T,s)}else this.clearTimer()}scheduleLoading(e,t,i){const s=i||e.details;if(!s){this.loadingPlaylist(e,t);return}const n=self.performance.now(),a=s.requestScheduled;if(n>=a){this.loadingPlaylist(e,t);return}const o=a-n;this.log(`reload live playlist ${e.name||e.bitrate+"bps"} in ${Math.round(o)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(e,t),o)}getDeliveryDirectives(e,t,i,s){let n=getSkipValue(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,s=t.part,n=HlsSkip.No),new HlsUrlParameters(i,s,n)}checkRetry(e){const t=e.details,i=isTimeoutError(e),s=e.errorAction,{action:n,retryCount:a=0,retryConfig:o}=s||{},c=!!s&&!!o&&(n===NetworkErrorAction.RetryRequest||!s.resolved&&n===NetworkErrorAction.SendAlternateToPenaltyBox);if(c){var u;if(a>=o.maxNumRetry)return!1;if(i&&(u=e.context)!=null&&u.deliveryDirectives)this.warn(`Retrying playlist loading ${a+1}/${o.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const f=getRetryDelay(o,a);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),f),this.warn(`Retrying playlist loading ${a+1}/${o.maxNumRetry} after "${t}" in ${f}ms`)}e.levelRetry=!0,s.resolved=!0}return c}}function subtitleOptionsIdentical(r,e){if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(!mediaAttributesIdentical(r[t].attrs,e[t].attrs))return!1;return!0}function mediaAttributesIdentical(r,e,t){const i=r["STABLE-RENDITION-ID"];return i&&!t?i===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(s=>r[s]!==e[s])}function subtitleTrackMatchesTextTrack(r,e){return e.label.toLowerCase()===r.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(r.lang||"").toLowerCase())}class AudioTrackController extends BasePlaylistController{constructor(e){super(e,"audio-track-controller"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(Events.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(Events.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(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:i,groupId:s,details:n}=t,a=this.tracksInGroup[i];if(!a||a.groupId!==s){this.warn(`Audio track with id:${i} and group:${s} not found in active group ${a?.groupId}`);return}const o=a.details;a.details=t.details,this.log(`Audio track ${i} "${a.name}" lang:${a.lang} group:${s} loaded [${n.startSN}-${n.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.audioGroups||null,s=this.groupIds;let n=this.currentTrack;if(!i||s?.length!==i?.length||i!=null&&i.some(o=>s?.indexOf(o)===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(g=>!i||i.indexOf(g.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(g=>g.default)&&(this.selectDefaultTrack=!1),o.forEach((g,E)=>{g.id=E});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const c=this.hls.config.audioPreference;if(!n&&c){const g=findMatchingOption(c,o,audioMatchPredicate);if(g>-1)n=o[g];else{const E=findMatchingOption(c,this.tracks);n=this.tracks[E]}}let u=this.findTrackId(n);u===-1&&n&&(u=this.findTrackId(null));const f={audioTracks:o};this.log(`Updating audio tracks, ${o.length} track(s) found in group(s): ${i?.join(",")}`),this.hls.trigger(Events.AUDIO_TRACKS_UPDATED,f);const d=this.trackId;if(u!==-1&&d===-1)this.setAudioTrack(u);else if(o.length&&d===-1){var a;const g=new Error(`No audio track selected for current audio group-ID(s): ${(a=this.groupIds)==null?void 0:a.join(",")} track count: ${o.length}`);this.warn(g.message),this.hls.trigger(Events.ERROR,{type:ErrorTypes.MEDIA_ERROR,details:ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:g})}}}onError(e,t){t.fatal||!t.context||t.context.type===PlaylistContextType.AUDIO_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const i=this.allAudioTracks;if(this.selectDefaultTrack=!1,i.length){const s=this.currentTrack;if(s&&matchesOption(e,s,audioMatchPredicate))return s;const n=findMatchingOption(e,this.tracksInGroup,audioMatchPredicate);if(n>-1){const a=this.tracksInGroup[n];return this.setAudioTrack(n),a}else if(s){let a=t.loadLevel;a===-1&&(a=t.firstAutoLevel);const o=findClosestLevelWithAudioGroup(e,t.levels,i,a,audioMatchPredicate);if(o===-1)return null;t.nextLoadLevel=o}if(e.channels||e.audioCodec){const a=findMatchingOption(e,i);if(a>-1)return i[a]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length){this.warn(`Invalid audio track id: ${e}`);return}this.selectDefaultTrack=!1;const i=this.currentTrack,s=t[e],n=s.details&&!s.details.live;if(e===this.trackId&&s===i&&n||(this.log(`Switching to audio-track ${e} "${s.name}" lang:${s.lang} group:${s.groupId} channels:${s.channels}`),this.trackId=e,this.currentTrack=s,this.hls.trigger(Events.AUDIO_TRACK_SWITCHING,_objectSpread2({},s)),n))return;const a=this.switchParams(s.url,i?.details,s.details);this.loadPlaylist(a)}findTrackId(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const s=t[i];if(!(this.selectDefaultTrack&&!s.default)&&(!e||matchesOption(e,s,audioMatchPredicate)))return i}if(e){const{name:i,lang:s,assocLang:n,characteristics:a,audioCodec:o,channels:c}=e;for(let u=0;u<t.length;u++){const f=t[u];if(matchesOption({name:i,lang:s,assocLang:n,characteristics:a,audioCodec:o,channels:c},f,audioMatchPredicate))return u}for(let u=0;u<t.length;u++){const f=t[u];if(mediaAttributesIdentical(e.attrs,f.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return u}for(let u=0;u<t.length;u++){const f=t[u];if(mediaAttributesIdentical(e.attrs,f.attrs,["LANGUAGE"]))return u}}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;this.shouldLoadPlaylist(t)&&useAlternateAudio(t.url,this.hls)&&this.scheduleLoading(t,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=e.id,s=e.groupId,n=this.getUrlWithDirectives(e.url,t),a=e.details,o=a?.age;this.log(`Loading audio-track ${i} "${e.name}" lang:${e.lang} group:${s}${t?.msn!==void 0?" at sn "+t.msn+" part "+t.part:""}${o&&a.live?" age "+o.toFixed(1)+(a.type&&" "+a.type||""):""} ${n}`),this.hls.trigger(Events.AUDIO_TRACK_LOADING,{url:n,id:i,groupId:s,deliveryDirectives:t||null,track:e})}}class BufferOperationQueue{constructor(e){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=e}destroy(){this.tracks=this.queues=null}append(e,t,i){if(this.queues===null||this.tracks===null)return;const s=this.queues[t];s.push(e),s.length===1&&!i&&this.executeNext(t)}appendBlocker(e){return new Promise(t=>{const i={label:"async-blocker",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(i,e)})}prependBlocker(e){return new Promise(t=>{if(this.queues){const i={label:"async-blocker-prepend",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(i)}})}removeBlockers(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{var t;const i=(t=e[0])==null?void 0:t.label;(i==="async-blocker"||i==="async-blocker-prepend")&&(e[0].execute(),e.splice(0,1))})}unblockAudio(e){if(this.queues===null)return;this.queues.audio[0]===e&&this.shiftAndExecuteNext("audio")}executeNext(e){if(this.queues===null||this.tracks===null)return;const t=this.queues[e];if(t.length){const s=t[0];try{s.execute()}catch(n){var i;if(s.onError(n),this.queues===null||this.tracks===null)return;const a=(i=this.tracks[e])==null?void 0:i.buffer;a!=null&&a.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues!==null&&(this.queues[e].shift(),this.executeNext(e))}current(e){var t;return((t=this.queues)==null?void 0:t[e][0])||null}toString(){const{queues:e,tracks:t}=this;return e===null||t===null?"<destroyed>":`
|
|
300
|
-
${this.list("video")}
|
|
301
|
-
${this.list("audio")}
|
|
302
|
-
${this.list("audiovideo")}}`}list(e){var t,i;return(t=this.queues)!=null&&t[e]||(i=this.tracks)!=null&&i[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:""}listSbInfo(e){var t;const i=(t=this.tracks)==null?void 0:t[e],s=i?.buffer;return s?`SourceBuffer${s.updating?" updating":""}${i.ended?" ended":""}${i.ending?" ending":""}`:"none"}listOps(e){var t;return((t=this.queues)==null?void 0:t[e].map(i=>i.label).join(", "))||""}}const VIDEO_CODEC_PROFILE_REPLACE=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,TRACK_REMOVED_ERROR_NAME="HlsJsTrackRemovedError";class HlsJsTrackRemovedError extends Error{constructor(e){super(e),this.name=TRACK_REMOVED_ERROR_NAME}}class BufferController extends Logger{constructor(e,t){super("buffer-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.details=null,this._objectUrl=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.blockedAudioAppend=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this._onEndStreaming=i=>{var s;this.hls&&((s=this.mediaSource)==null?void 0:s.readyState)==="open"&&this.hls.pauseBuffering()},this._onStartStreaming=i=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=i=>{const{media:s,mediaSource:n}=this;i&&this.log("Media source opened"),!(!s||!n)&&(n.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(Events.MEDIA_ATTACHED,{media:s,mediaSource:n}),this.mediaSource!==null&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:i,_objectUrl:s}=this;i!==s&&this.error(`Media element src was set while attaching MediaSource (${s} > ${i})`)},this.hls=e,this.fragmentTracker=t,this.appendSource=isManagedMediaSource(getMediaSource(e.config.preferManagedMediaSource)),this.initTracks(),this.registerListeners()}hasSourceTypes(){return Object.keys(this.tracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.transferData=this.overrides=void 0,this.operationQueue&&(this.operationQueue.destroy(),this.operationQueue=null),this.hls=this.fragmentTracker=null,this._onMediaSourceOpen=this._onMediaSourceClose=null,this._onMediaSourceEnded=null,this._onStartStreaming=this._onEndStreaming=null}registerListeners(){const{hls:e}=this;e.on(Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Events.BUFFER_RESET,this.onBufferReset,this),e.on(Events.BUFFER_APPENDING,this.onBufferAppending,this),e.on(Events.BUFFER_CODECS,this.onBufferCodecs,this),e.on(Events.BUFFER_EOS,this.onBufferEos,this),e.on(Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(Events.FRAG_PARSED,this.onFragParsed,this),e.on(Events.FRAG_CHANGED,this.onFragChanged,this),e.on(Events.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Events.BUFFER_RESET,this.onBufferReset,this),e.off(Events.BUFFER_APPENDING,this.onBufferAppending,this),e.off(Events.BUFFER_CODECS,this.onBufferCodecs,this),e.off(Events.BUFFER_EOS,this.onBufferEos,this),e.off(Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(Events.FRAG_PARSED,this.onFragParsed,this),e.off(Events.FRAG_CHANGED,this.onFragChanged,this),e.off(Events.ERROR,this.onError,this)}transferMedia(){const{media:e,mediaSource:t}=this;if(!e)return null;const i={};if(this.operationQueue){const n=this.isUpdating();n||this.operationQueue.removeBlockers();const a=this.isQueued();(n||a)&&this.warn(`Transfering MediaSource with${a?" operations in queue":""}${n?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}const s=this.transferData;return!this.sourceBufferCount&&s&&s.mediaSource===t?_extends(i,s.tracks):this.sourceBuffers.forEach(n=>{const[a]=n;a&&(i[a]=_extends({},this.tracks[a]),this.removeBuffer(a)),n[0]=n[1]=null}),{media:e,mediaSource:t,tracks:i}}initTracks(){const e={};this.sourceBuffers=[[null,null],[null,null]],this.tracks=e,this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){var i;let s=2;(t.audio&&!t.video||!t.altAudio)&&(s=1),this.bufferCodecEventsTotal=s,this.log(`${s} bufferCodec event(s) expected.`),(i=this.transferData)!=null&&i.mediaSource&&this.sourceBufferCount&&s&&this.bufferCreated()}onMediaAttaching(e,t){const i=this.media=t.media;this.transferData=this.overrides=void 0;const s=getMediaSource(this.appendSource);if(s){const n=!!t.mediaSource;(n||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);const a=this.mediaSource=t.mediaSource||new s;if(this.assignMediaSource(a),n)this._objectUrl=i.src,this.attachTransferred();else{const o=this._objectUrl=self.URL.createObjectURL(a);if(this.appendSource)try{i.removeAttribute("src");const c=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||c&&a instanceof c,removeSourceChildren(i),addSource(i,o),i.load()}catch{i.src=o}else i.src=o}i.addEventListener("emptied",this._onMediaEmptied)}}assignMediaSource(e){var t,i;this.log(`${((t=this.transferData)==null?void 0:t.mediaSource)===e?"transferred":"created"} media source: ${(i=e.constructor)==null?void 0:i.name}`),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming))}attachTransferred(){const e=this.media,t=this.transferData;if(!t||!e)return;const i=this.tracks,s=t.tracks,n=s?Object.keys(s):null,a=n?n.length:0,o=()=>{Promise.resolve().then(()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()})};if(s&&n&&a){if(!this.tracksReady){this.hls.config.startFragPrefetch=!0,this.log("attachTransferred: waiting for SourceBuffer track info");return}if(this.log(`attachTransferred: (bufferCodecEventsTotal ${this.bufferCodecEventsTotal})
|
|
303
|
-
required tracks: ${stringify(i,(c,u)=>c==="initSegment"?void 0:u)};
|
|
304
|
-
transfer tracks: ${stringify(s,(c,u)=>c==="initSegment"?void 0:u)}}`),!isCompatibleTrackChange(s,i)){t.mediaSource=null,t.tracks=void 0;const c=e.currentTime,u=this.details,f=Math.max(c,u?.fragments[0].start||0);if(f-c>1){this.log(`attachTransferred: waiting for playback to reach new tracks start time ${c} -> ${f}`);return}this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(s)}"->"${Object.keys(i)}") start time: ${f} currentTime: ${c}`),this.onMediaDetaching(Events.MEDIA_DETACHING,{}),this.onMediaAttaching(Events.MEDIA_ATTACHING,t),e.currentTime=f;return}this.transferData=void 0,n.forEach(c=>{const u=c,f=s[u];if(f){const d=f.buffer;if(d){const g=this.fragmentTracker,E=f.id;if(g.hasFragments(E)||g.hasParts(E)){const S=BufferHelper.getBuffered(d);g.detectEvictedFragments(u,S,E,null,!0)}const m=sourceBufferNameToIndex(u),T=[u,d];this.sourceBuffers[m]=T,d.updating&&this.operationQueue&&this.operationQueue.prependBlocker(u),this.trackSourceBuffer(u,f)}}}),o(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),o()}get mediaSourceOpenOrEnded(){var e;const t=(e=this.mediaSource)==null?void 0:e.readyState;return t==="open"||t==="ended"}onMediaDetaching(e,t){const i=!!t.transferMedia;this.transferData=this.overrides=void 0;const{media:s,mediaSource:n,_objectUrl:a}=this;if(n){if(this.log(`media source ${i?"transferring":"detaching"}`),i)this.sourceBuffers.forEach(([o])=>{o&&this.removeBuffer(o)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const o=n.readyState==="open";try{const c=n.sourceBuffers;for(let u=c.length;u--;)o&&c[u].abort(),n.removeSourceBuffer(c[u]);o&&n.endOfStream()}catch(c){this.warn(`onMediaDetaching: ${c.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}n.removeEventListener("sourceopen",this._onMediaSourceOpen),n.removeEventListener("sourceended",this._onMediaSourceEnded),n.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(n.removeEventListener("startstreaming",this._onStartStreaming),n.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}s&&(s.removeEventListener("emptied",this._onMediaEmptied),i||(a&&self.URL.revokeObjectURL(a),this.mediaSrc===a?(s.removeAttribute("src"),this.appendSource&&removeSourceChildren(s),s.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(Events.MEDIA_DETACHED,t)}onBufferReset(){this.sourceBuffers.forEach(([e])=>{e&&this.resetBuffer(e)}),this.initTracks()}resetBuffer(e){var t;const i=(t=this.tracks[e])==null?void 0:t.buffer;if(this.removeBuffer(e),i)try{var s;(s=this.mediaSource)!=null&&s.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(i)}catch(n){this.warn(`onBufferReset ${e}`,n)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[sourceBufferNameToIndex(e)]=[null,null];const t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new BufferOperationQueue(this.tracks)}onBufferCodecs(e,t){var i;const s=this.tracks,n=Object.keys(t);this.log(`BUFFER_CODECS: "${n}" (current SB count ${this.sourceBufferCount})`);const a="audiovideo"in t&&(s.audio||s.video)||s.audiovideo&&("audio"in t||"video"in t),o=!a&&this.sourceBufferCount&&this.media&&n.some(c=>!s[c]);if(a||o){this.warn(`Unsupported transition between "${Object.keys(s)}" and "${n}" SourceBuffers`);return}n.forEach(c=>{var u,f;const d=t[c],{id:g,codec:E,levelCodec:m,container:T,metadata:S,supplemental:b}=d;let C=s[c];const I=(u=this.transferData)==null||(u=u.tracks)==null?void 0:u[c],L=I!=null&&I.buffer?I:C,k=L?.pendingCodec||L?.codec,U=L?.levelCodec;C||(C=s[c]={buffer:void 0,listeners:[],codec:E,supplemental:b,container:T,levelCodec:m,metadata:S,id:g});const O=pickMostCompleteCodecName(k,U),F=O?.replace(VIDEO_CODEC_PROFILE_REPLACE,"$1");let G=pickMostCompleteCodecName(E,m);const x=(f=G)==null?void 0:f.replace(VIDEO_CODEC_PROFILE_REPLACE,"$1");G&&O&&F!==x&&(c.slice(0,5)==="audio"&&(G=getCodecCompatibleName(G,this.appendSource)),this.log(`switching codec ${k} to ${G}`),G!==(C.pendingCodec||C.codec)&&(C.pendingCodec=G),C.container=T,this.appendChangeType(c,T,G))}),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&(this.bufferCodecEventsTotal>1&&!this.tracks.video&&!t.video&&((i=t.audio)==null?void 0:i.id)==="main"&&(this.log("Main audio-only"),this.bufferCodecEventsTotal=1),this.mediaSourceOpenOrEnded&&this.checkPendingTracks())}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((e,t)=>{const i=this.tracks[t];return e[t]={id:i.id,container:i.container,codec:i.codec,levelCodec:i.levelCodec},e},{})}appendChangeType(e,t,i){const s=`${t};codecs=${i}`,n={label:`change-type=${s}`,execute:()=>{const a=this.tracks[e];if(a){const o=a.buffer;o!=null&&o.changeType&&(this.log(`changing ${e} sourceBuffer type to ${s}`),o.changeType(s),a.codec=i,a.container=t)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:a=>{this.warn(`Failed to change ${e} SourceBuffer type`,a)}};this.append(n,e,this.isPending(this.tracks[e]))}blockAudio(e){var t;const i=e.start,s=i+e.duration*.05;if(((t=this.fragmentTracker.getAppendedFrag(i,PlaylistLevelType.MAIN))==null?void 0:t.gap)===!0)return;const a={label:"block-audio",execute:()=>{var o;const c=this.tracks.video;(this.lastVideoAppendEnd>s||c!=null&&c.buffer&&BufferHelper.isBuffered(c.buffer,s)||((o=this.fragmentTracker.getAppendedFrag(s,PlaylistLevelType.MAIN))==null?void 0:o.gap)===!0)&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext("audio"))},onStart:()=>{},onComplete:()=>{},onError:o=>{this.warn("Error executing block-audio operation",o)}};this.blockedAudioAppend={op:a,frag:e},this.append(a,"audio",!0)}unblockAudio(){const{blockedAudioAppend:e,operationQueue:t}=this;e&&t&&(this.blockedAudioAppend=null,t.unblockAudio(e.op))}onBufferAppending(e,t){const{tracks:i}=this,{data:s,type:n,parent:a,frag:o,part:c,chunkMeta:u,offset:f}=t,d=u.buffering[n],{sn:g,cc:E}=o,m=self.performance.now();d.start=m;const T=o.stats.buffering,S=c?c.stats.buffering:null;T.start===0&&(T.start=m),S&&S.start===0&&(S.start=m);const b=i.audio;let C=!1;n==="audio"&&b?.container==="audio/mpeg"&&(C=!this.lastMpegAudioChunk||u.id===1||this.lastMpegAudioChunk.sn!==u.sn,this.lastMpegAudioChunk=u);const I=i.video,L=I?.buffer;if(L&&g!=="initSegment"){const O=c||o,F=this.blockedAudioAppend;if(n==="audio"&&a!=="main"&&!this.blockedAudioAppend&&!(I.ending||I.ended)){const x=O.start+O.duration*.05,$=L.buffered,X=this.currentOp("video");!$.length&&!X?this.blockAudio(O):!X&&!BufferHelper.isBuffered(L,x)&&this.lastVideoAppendEnd<x&&this.blockAudio(O)}else if(n==="video"){const G=O.end;if(F){const x=F.frag.start;(G>x||G<this.lastVideoAppendEnd||BufferHelper.isBuffered(L,x))&&this.unblockAudio()}this.lastVideoAppendEnd=G}}const k=(c||o).start,U={label:`append-${n}`,execute:()=>{var O;d.executeStart=self.performance.now();const F=(O=this.tracks[n])==null?void 0:O.buffer;F&&(C?this.updateTimestampOffset(F,k,.1,n,g,E):f!==void 0&&isFiniteNumber(f)&&this.updateTimestampOffset(F,f,1e-6,n,g,E)),this.appendExecutor(s,n)},onStart:()=>{},onComplete:()=>{const O=self.performance.now();d.executeEnd=d.end=O,T.first===0&&(T.first=O),S&&S.first===0&&(S.first=O);const F={};this.sourceBuffers.forEach(([G,x])=>{G&&(F[G]=BufferHelper.getBuffered(x))}),this.appendErrors[n]=0,n==="audio"||n==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(Events.BUFFER_APPENDED,{type:n,frag:o,part:c,chunkMeta:u,parent:o.type,timeRanges:F})},onError:O=>{var F;const G={type:ErrorTypes.MEDIA_ERROR,parent:o.type,details:ErrorDetails.BUFFER_APPEND_ERROR,sourceBufferName:n,frag:o,part:c,chunkMeta:u,error:O,err:O,fatal:!1},x=(F=this.media)==null?void 0:F.error;if(O.code===DOMException.QUOTA_EXCEEDED_ERR||O.name=="QuotaExceededError"||"quota"in O)G.details=ErrorDetails.BUFFER_FULL_ERROR;else if(O.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!x)G.errorAction=createDoNothingErrorAction(!0);else if(O.name===TRACK_REMOVED_ERROR_NAME&&this.sourceBufferCount===0)G.errorAction=createDoNothingErrorAction(!0);else{const $=++this.appendErrors[n];this.warn(`Failed ${$}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${n}" sourceBuffer (${x||"no media error"})`),($>=this.hls.config.appendErrorMaxRetry||x)&&(G.fatal=!0)}this.hls.trigger(Events.ERROR,G)}};this.log(`queuing "${n}" append sn: ${g}${c?" p: "+c.index:""} of ${o.type===PlaylistLevelType.MAIN?"level":"track"} ${o.level} cc: ${E}`),this.append(U,n,this.isPending(this.tracks[n]))}getFlushOp(e,t,i){return this.log(`queuing "${e}" remove ${t}-${i}`),{label:"remove",execute:()=>{this.removeExecutor(e,t,i)},onStart:()=>{},onComplete:()=>{this.hls.trigger(Events.BUFFER_FLUSHED,{type:e})},onError:s=>{this.warn(`Failed to remove ${t}-${i} from "${e}" SourceBuffer`,s)}}}onBufferFlushing(e,t){const{type:i,startOffset:s,endOffset:n}=t;i?this.append(this.getFlushOp(i,s,n),i):this.sourceBuffers.forEach(([a])=>{a&&this.append(this.getFlushOp(a,s,n),a)})}onFragParsed(e,t){const{frag:i,part:s}=t,n=[],a=s?s.elementaryStreams:i.elementaryStreams;a[ElementaryStreamTypes.AUDIOVIDEO]?n.push("audiovideo"):(a[ElementaryStreamTypes.AUDIO]&&n.push("audio"),a[ElementaryStreamTypes.VIDEO]&&n.push("video"));const o=()=>{const c=self.performance.now();i.stats.buffering.end=c,s&&(s.stats.buffering.end=c);const u=s?s.stats:i.stats;this.hls.trigger(Events.FRAG_BUFFERED,{frag:i,part:s,stats:u,id:i.type})};n.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${i.type} level: ${i.level} sn: ${i.sn}`),this.blockBuffers(o,n).catch(c=>{this.warn(`Fragment buffered callback ${c}`),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(e,t){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{if(e){const t=this.tracks[e];if(t)return!t.ended||t.ending}return!1})}onBufferEos(e,t){var i;this.sourceBuffers.forEach(([a])=>{if(a){const o=this.tracks[a];(!t.type||t.type===a)&&(o.ending=!0,o.ended||(o.ended=!0,this.log(`${a} buffer reached EOS`)))}});const s=((i=this.overrides)==null?void 0:i.endOfStream)!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([a])=>{var o;return a&&!((o=this.tracks[a])!=null&&o.ended)})?s?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();const{mediaSource:a}=this;if(!a||a.readyState!=="open"){a&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${a.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),a.endOfStream(),this.hls.trigger(Events.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(Events.BUFFERED_TO_END,void 0)):t.type==="video"&&this.unblockAudio()}tracksEnded(){this.sourceBuffers.forEach(([e])=>{if(e!==null){const t=this.tracks[e];t&&(t.ending=!1)}})}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.updateDuration())}updateDuration(){this.blockUntilOpen(()=>{const e=this.getDurationAndRange();e&&this.updateMediaSource(e)})}onError(e,t){if(t.details===ErrorDetails.BUFFER_APPEND_ERROR&&t.frag){var i;const s=(i=t.errorAction)==null?void 0:i.nextAutoLevel;isFiniteNumber(s)&&s!==t.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){const{hls:e,details:t,media:i}=this;if(!i||t===null||!this.sourceBufferCount)return;const s=e.config,n=i.currentTime,a=t.levelTargetDuration,o=t.live&&s.liveBackBufferLength!==null?s.liveBackBufferLength:s.backBufferLength;if(isFiniteNumber(o)&&o>=0){const u=Math.max(o,a),f=Math.floor(n/a)*a-u;this.flushBackBuffer(n,a,f)}const c=s.frontBufferFlushThreshold;if(isFiniteNumber(c)&&c>0){const u=Math.max(s.maxBufferLength,c),f=Math.max(u,a),d=Math.floor(n/a)*a+f;this.flushFrontBuffer(n,a,d)}}flushBackBuffer(e,t,i){this.sourceBuffers.forEach(([s,n])=>{if(n){const o=BufferHelper.getBuffered(n);if(o.length>0&&i>o.start(0)){var a;this.hls.trigger(Events.BACK_BUFFER_REACHED,{bufferEnd:i});const c=this.tracks[s];if((a=this.details)!=null&&a.live)this.hls.trigger(Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i});else if(c!=null&&c.ended){this.log(`Cannot flush ${s} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(Events.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:s})}}})}flushFrontBuffer(e,t,i){this.sourceBuffers.forEach(([s,n])=>{if(n){const a=BufferHelper.getBuffered(n),o=a.length;if(o<2)return;const c=a.start(o-1),u=a.end(o-1);if(i>c||e>=c&&e<=u)return;this.hls.trigger(Events.BUFFER_FLUSHING,{startOffset:c,endOffset:1/0,type:s})}})}getDurationAndRange(){var e;const{details:t,mediaSource:i}=this;if(!t||!this.media||i?.readyState!=="open")return null;const s=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(t.fragments.length&&i.setLiveSeekableRange){const u=Math.max(0,t.fragmentStart),f=Math.max(u,s);return{duration:1/0,start:u,end:f}}return{duration:1/0}}const n=(e=this.overrides)==null?void 0:e.duration;if(n)return isFiniteNumber(n)?{duration:n}:null;const a=this.media.duration,o=isFiniteNumber(i.duration)?i.duration:0;return s>o&&s>a||!isFiniteNumber(a)?{duration:s}:null}updateMediaSource({duration:e,start:t,end:i}){const s=this.mediaSource;!this.media||!s||s.readyState!=="open"||(s.duration!==e&&(isFiniteNumber(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),s.duration=e),t!==void 0&&i!==void 0&&(this.log(`MediaSource duration is set to ${s.duration}. Setting seekable range to ${t}-${i}.`),s.setLiveSeekableRange(t,i)))}get tracksReady(){const e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:e,pendingTrackCount:t,tracks:i}=this;if(this.log(`checkPendingTracks (pending: ${t} codec events expected: ${e}) ${stringify(i)}`),this.tracksReady){var s;const n=(s=this.transferData)==null?void 0:s.tracks;n&&Object.keys(n).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const e={};this.sourceBuffers.forEach(([t,i])=>{if(t){const s=this.tracks[t];e[t]={buffer:i,container:s.container,codec:s.codec,supplemental:s.supplemental,levelCodec:s.levelCodec,id:s.id,metadata:s.metadata}}}),this.hls.trigger(Events.BUFFER_CREATED,{tracks:e}),this.log(`SourceBuffers created. Running queue: ${this.operationQueue}`),this.sourceBuffers.forEach(([t])=>{this.executeNext(t)})}else{const e=new Error("could not create source buffer for media codec(s)");this.hls.trigger(Events.ERROR,{type:ErrorTypes.MEDIA_ERROR,details:ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}createSourceBuffers(){const{tracks:e,sourceBuffers:t,mediaSource:i}=this;if(!i)throw new Error("createSourceBuffers called when mediaSource was null");for(const n in e){const a=n,o=e[a];if(this.isPending(o)){const c=this.getTrackCodec(o,a),u=`${o.container};codecs=${c}`;o.codec=c,this.log(`creating sourceBuffer(${u})${this.currentOp(a)?" Queued":""} ${stringify(o)}`);try{const f=i.addSourceBuffer(u),d=sourceBufferNameToIndex(a),g=[a,f];t[d]=g,o.buffer=f}catch(f){var s;this.error(`error while trying to add sourceBuffer: ${f.message}`),this.shiftAndExecuteNext(a),(s=this.operationQueue)==null||s.removeBlockers(),delete this.tracks[a],this.hls.trigger(Events.ERROR,{type:ErrorTypes.MEDIA_ERROR,details:ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:f,sourceBufferName:a,mimeType:u,parent:o.id});return}this.trackSourceBuffer(a,o)}}this.bufferCreated()}getTrackCodec(e,t){const i=e.supplemental;let s=e.codec;i&&(t==="video"||t==="audiovideo")&&areCodecsMediaSourceSupported(i,"video")&&(s=replaceVideoCodec(s,i));const n=pickMostCompleteCodecName(s,e.levelCodec);return n?t.slice(0,5)==="audio"?getCodecCompatibleName(n,this.appendSource):n:""}trackSourceBuffer(e,t){const i=t.buffer;if(!i)return;const s=this.getTrackCodec(t,e);this.tracks[e]={buffer:i,codec:s,container:t.container,levelCodec:t.levelCodec,supplemental:t.supplemental,metadata:t.metadata,id:t.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,"updatestart",this.onSBUpdateStart),this.addBufferListener(e,"updateend",this.onSBUpdateEnd),this.addBufferListener(e,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,"bufferedchange",(n,a)=>{const o=a.removedRanges;o!=null&&o.length&&this.hls.trigger(Events.BUFFER_FLUSHED,{type:n})})}get mediaSrc(){var e,t;const i=((e=this.media)==null||(t=e.querySelector)==null?void 0:t.call(e,"source"))||this.media;return i?.src}onSBUpdateStart(e){const t=this.currentOp(e);t&&t.onStart()}onSBUpdateEnd(e){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed"){this.resetBuffer(e);return}const i=this.currentOp(e);i&&(i.onComplete(),this.shiftAndExecuteNext(e))}onSBUpdateError(e,t){var i;const s=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(i=this.mediaSource)==null?void 0:i.readyState}`);this.error(`${s}`,t),this.hls.trigger(Events.ERROR,{type:ErrorTypes.MEDIA_ERROR,details:ErrorDetails.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:s,fatal:!1});const n=this.currentOp(e);n&&n.onError(s)}updateTimestampOffset(e,t,i,s,n,a){const o=t-e.timestampOffset;Math.abs(o)>=i&&(this.log(`Updating ${s} SourceBuffer timestampOffset to ${t} (sn: ${n} cc: ${a})`),e.timestampOffset=t)}removeExecutor(e,t,i){const{media:s,mediaSource:n}=this,a=this.tracks[e],o=a?.buffer;if(!s||!n||!o){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),this.shiftAndExecuteNext(e);return}const c=isFiniteNumber(s.duration)?s.duration:1/0,u=isFiniteNumber(n.duration)?n.duration:1/0,f=Math.max(0,t),d=Math.min(i,c,u);d>f&&(!a.ending||a.ended)?(a.ended=!1,this.log(`Removing [${f},${d}] from the ${e} SourceBuffer`),o.remove(f,d)):this.shiftAndExecuteNext(e)}appendExecutor(e,t){const i=this.tracks[t],s=i?.buffer;if(!s)throw new HlsJsTrackRemovedError(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);i.ending=!1,i.ended=!1,s.appendBuffer(e)}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(t=>{this.warn(`SourceBuffer blocked callback ${t}`),this.stepOperationQueue(this.sourceBufferTypes)});else try{e()}catch(t){this.warn(`Callback run without blocking ${this.operationQueue} ${t}`)}}isUpdating(){return this.sourceBuffers.some(([e,t])=>e&&t.updating)}isQueued(){return this.sourceBuffers.some(([e])=>e&&!!this.currentOp(e))}isPending(e){return!!e&&!e.buffer}blockBuffers(e,t=this.sourceBufferTypes){if(!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);const{operationQueue:i}=this,s=t.map(a=>this.appendBlocker(a));return t.length>1&&this.blockedAudioAppend&&this.unblockAudio(),Promise.all(s).then(a=>{i===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(t=>{var i;const s=(i=this.tracks[t])==null?void 0:i.buffer;!s||s.updating||this.shiftAndExecuteNext(t)})}append(e,t,i){this.operationQueue&&this.operationQueue.append(e,t,i)}appendBlocker(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}currentOp(e){return this.operationQueue?this.operationQueue.current(e):null}executeNext(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)}shiftAndExecuteNext(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)}get pendingTrackCount(){return Object.keys(this.tracks).reduce((e,t)=>e+(this.isPending(this.tracks[t])?1:0),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((e,[t])=>e+(t?1:0),0)}get sourceBufferTypes(){return this.sourceBuffers.map(([e])=>e).filter(e=>!!e)}addBufferListener(e,t,i){const s=this.tracks[e];if(!s)return;const n=s.buffer;if(!n)return;const a=i.bind(this,e);s.listeners.push({event:t,listener:a}),n.addEventListener(t,a)}removeBufferListeners(e){const t=this.tracks[e];if(!t)return;const i=t.buffer;i&&(t.listeners.forEach(s=>{i.removeEventListener(s.event,s.listener)}),t.listeners.length=0)}}function removeSourceChildren(r){const e=r.querySelectorAll("source");[].slice.call(e).forEach(t=>{r.removeChild(t)})}function addSource(r,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,r.appendChild(t)}function sourceBufferNameToIndex(r){return r==="audio"?1:0}class CapLevelController{constructor(e){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=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on(Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Events.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(Events.BUFFER_CODECS,this.onBufferCodecs,this),e.on(Events.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Events.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(Events.BUFFER_CODECS,this.onBufferCodecs,this),e.off(Events.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const i=this.hls.levels[t.droppedLevel];this.isLevelAllowed(i)&&this.restrictedLevels.push({bitrate:i.bitrate,height:i.height,width:i.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){const i=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,i.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&isFiniteNumber(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping(),this.media=null}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}const e=this.hls.levels;if(e.length){const t=this.hls,i=this.getMaxLevel(e.length-1);i!==this.autoLevelCapping&&t.logger.log(`Setting autoLevelCapping to ${i}: ${e[i].height}p@${e[i].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=i,t.autoLevelEnabled&&t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const i=t.filter((s,n)=>this.isLevelAllowed(s)&&n<=e);return this.clientRect=null,CapLevelController.getMaxLevelByMediaSize(i,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 e=this.media,t={width:0,height:0};if(e){const i=e.getBoundingClientRect();t.width=i.width,t.height=i.height,!t.width&&!t.height&&(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch{}return Math.min(e,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(e){return!this.restrictedLevels.some(i=>e.bitrate===i.bitrate&&e.width===i.width&&e.height===i.height)}static getMaxLevelByMediaSize(e,t,i){if(!(e!=null&&e.length))return-1;const s=(o,c)=>c?o.width!==c.width||o.height!==c.height:!0;let n=e.length-1;const a=Math.max(t,i);for(let o=0;o<e.length;o+=1){const c=e[o];if((c.width>=a||c.height>=a)&&s(c,e[o+1])){n=o;break}}return n}}const CmObjectType={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},CmcdObjectType=CmObjectType,CmStreamingFormat={HLS:"h"},CmcdStreamingFormat=CmStreamingFormat;class SfItem{constructor(e,t){Array.isArray(e)&&(e=e.map(i=>i instanceof SfItem?i:new SfItem(i))),this.value=e,this.params=t}}const DICT="Dict";function format(r){return Array.isArray(r)?JSON.stringify(r):r instanceof Map?"Map{}":r instanceof Set?"Set{}":typeof r=="object"?JSON.stringify(r):String(r)}function throwError(r,e,t,i){return new Error(`failed to ${r} "${format(e)}" as ${t}`,{cause:i})}function serializeError(r,e,t){return throwError("serialize",r,e,t)}class SfToken{constructor(e){this.description=e}}const BARE_ITEM="Bare Item",BOOLEAN="Boolean";function serializeBoolean(r){if(typeof r!="boolean")throw serializeError(r,BOOLEAN);return r?"?1":"?0"}function encodeBase64(r){return btoa(String.fromCharCode(...r))}const BYTES="Byte Sequence";function serializeByteSequence(r){if(ArrayBuffer.isView(r)===!1)throw serializeError(r,BYTES);return`:${encodeBase64(r)}:`}const INTEGER="Integer";function isInvalidInt(r){return r<-999999999999999||999999999999999<r}function serializeInteger(r){if(isInvalidInt(r))throw serializeError(r,INTEGER);return r.toString()}function serializeDate(r){return`@${serializeInteger(r.getTime()/1e3)}`}function roundToEven(r,e){if(r<0)return-roundToEven(-r,e);const t=Math.pow(10,e);if(Math.abs(r*t%1-.5)<Number.EPSILON){const s=Math.floor(r*t);return(s%2===0?s:s+1)/t}else return Math.round(r*t)/t}const DECIMAL="Decimal";function serializeDecimal(r){const e=roundToEven(r,3);if(Math.floor(Math.abs(e)).toString().length>12)throw serializeError(r,DECIMAL);const t=e.toString();return t.includes(".")?t:`${t}.0`}const STRING="String",STRING_REGEX=/[\x00-\x1f\x7f]+/;function serializeString(r){if(STRING_REGEX.test(r))throw serializeError(r,STRING);return`"${r.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function symbolToStr(r){return r.description||r.toString().slice(7,-1)}const TOKEN="Token";function serializeToken(r){const e=symbolToStr(r);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw serializeError(e,TOKEN);return e}function serializeBareItem(r){switch(typeof r){case"number":if(!isFiniteNumber(r))throw serializeError(r,BARE_ITEM);return Number.isInteger(r)?serializeInteger(r):serializeDecimal(r);case"string":return serializeString(r);case"symbol":return serializeToken(r);case"boolean":return serializeBoolean(r);case"object":if(r instanceof Date)return serializeDate(r);if(r instanceof Uint8Array)return serializeByteSequence(r);if(r instanceof SfToken)return serializeToken(r);default:throw serializeError(r,BARE_ITEM)}}const KEY="Key";function serializeKey(r){if(/^[a-z*][a-z0-9\-_.*]*$/.test(r)===!1)throw serializeError(r,KEY);return r}function serializeParams(r){return r==null?"":Object.entries(r).map(([e,t])=>t===!0?`;${serializeKey(e)}`:`;${serializeKey(e)}=${serializeBareItem(t)}`).join("")}function serializeItem(r){return r instanceof SfItem?`${serializeBareItem(r.value)}${serializeParams(r.params)}`:serializeBareItem(r)}function serializeInnerList(r){return`(${r.value.map(serializeItem).join(" ")})${serializeParams(r.params)}`}function serializeDict(r,e={whitespace:!0}){if(typeof r!="object"||r==null)throw serializeError(r,DICT);const t=r instanceof Map?r.entries():Object.entries(r),i=e?.whitespace?" ":"";return Array.from(t).map(([s,n])=>{n instanceof SfItem||(n=new SfItem(n));let a=serializeKey(s);return n.value===!0?a+=serializeParams(n.params):(a+="=",Array.isArray(n.value)?a+=serializeInnerList(n):a+=serializeItem(n)),a}).join(`,${i}`)}function encodeSfDict(r,e){return serializeDict(r,e)}const CMCD_OBJECT="CMCD-Object",CMCD_REQUEST="CMCD-Request",CMCD_SESSION="CMCD-Session",CMCD_STATUS="CMCD-Status",CMCD_HEADER_MAP={br:CMCD_OBJECT,ab:CMCD_OBJECT,d:CMCD_OBJECT,ot:CMCD_OBJECT,tb:CMCD_OBJECT,tpb:CMCD_OBJECT,lb:CMCD_OBJECT,tab:CMCD_OBJECT,lab:CMCD_OBJECT,url:CMCD_OBJECT,pb:CMCD_REQUEST,bl:CMCD_REQUEST,tbl:CMCD_REQUEST,dl:CMCD_REQUEST,ltc:CMCD_REQUEST,mtp:CMCD_REQUEST,nor:CMCD_REQUEST,nrr:CMCD_REQUEST,rc:CMCD_REQUEST,sn:CMCD_REQUEST,sta:CMCD_REQUEST,su:CMCD_REQUEST,ttfb:CMCD_REQUEST,ttfbb:CMCD_REQUEST,ttlb:CMCD_REQUEST,cmsdd:CMCD_REQUEST,cmsds:CMCD_REQUEST,smrt:CMCD_REQUEST,df:CMCD_REQUEST,cs:CMCD_REQUEST,ts:CMCD_REQUEST,cid:CMCD_SESSION,pr:CMCD_SESSION,sf:CMCD_SESSION,sid:CMCD_SESSION,st:CMCD_SESSION,v:CMCD_SESSION,msd:CMCD_SESSION,bs:CMCD_STATUS,bsd:CMCD_STATUS,cdn:CMCD_STATUS,rtp:CMCD_STATUS,bg:CMCD_STATUS,pt:CMCD_STATUS,ec:CMCD_STATUS,e:CMCD_STATUS},CmcdHeaderField={REQUEST:CMCD_REQUEST};function createHeaderMap(r){return Object.keys(r).reduce((e,t)=>{var i;return(i=r[t])===null||i===void 0||i.forEach(s=>e[s]=t),e},{})}function groupCmcdHeaders(r,e){const t={};if(!r)return t;const i=Object.keys(r),s=e?createHeaderMap(e):{};return i.reduce((n,a)=>{var o;const c=CMCD_HEADER_MAP[a]||s[a]||CmcdHeaderField.REQUEST,u=(o=n[c])!==null&&o!==void 0?o:n[c]={};return u[a]=r[a],n},t)}function isTokenField(r){return["ot","sf","st","e","sta"].includes(r)}function isValid(r){return typeof r=="number"?isFiniteNumber(r):r!=null&&r!==""&&r!==!1}const CMCD_EVENT_MODE="event";function urlToRelativePath(r,e){const t=new URL(r),i=new URL(e);if(t.origin!==i.origin)return r;const s=t.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.search+t.hash}const toRounded=r=>Math.round(r),toUrlSafe=(r,e)=>Array.isArray(r)?r.map(t=>toUrlSafe(t,e)):r instanceof SfItem&&typeof r.value=="string"?new SfItem(toUrlSafe(r.value,e),r.params):(e.baseUrl&&(r=urlToRelativePath(r,e.baseUrl)),e.version===1?encodeURIComponent(r):r),toHundred=r=>toRounded(r/100)*100,nor=(r,e)=>{let t=r;return e.version>=2&&(r instanceof SfItem&&typeof r.value=="string"?t=new SfItem([r]):typeof r=="string"&&(t=[r])),toUrlSafe(t,e)},CMCD_FORMATTER_MAP={br:toRounded,d:toRounded,bl:toHundred,dl:toHundred,mtp:toHundred,nor,rtp:toHundred,tb:toRounded},CMCD_REQUEST_MODE="request",CMCD_RESPONSE_MODE="response",CMCD_COMMON_KEYS=["ab","bg","bl","br","bs","bsd","cdn","cid","cs","df","ec","lab","lb","ltc","msd","mtp","pb","pr","pt","sf","sid","sn","st","sta","tab","tb","tbl","tpb","ts","v"],CMCD_EVENT_KEYS=["e"],CUSTOM_KEY_REGEX=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function isCmcdCustomKey(r){return CUSTOM_KEY_REGEX.test(r)}function isCmcdEventKey(r){return CMCD_COMMON_KEYS.includes(r)||CMCD_EVENT_KEYS.includes(r)||isCmcdCustomKey(r)}const CMCD_REQUEST_KEYS=["d","dl","nor","ot","rtp","su"];function isCmcdRequestKey(r){return CMCD_COMMON_KEYS.includes(r)||CMCD_REQUEST_KEYS.includes(r)||isCmcdCustomKey(r)}const CMCD_RESPONSE_KEYS=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"];function isCmcdResponseKey(r){return CMCD_COMMON_KEYS.includes(r)||CMCD_REQUEST_KEYS.includes(r)||CMCD_RESPONSE_KEYS.includes(r)||isCmcdCustomKey(r)}const CMCD_V1_KEYS=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"];function isCmcdV1Key(r){return CMCD_V1_KEYS.includes(r)||isCmcdCustomKey(r)}const filterMap={[CMCD_RESPONSE_MODE]:isCmcdResponseKey,[CMCD_EVENT_MODE]:isCmcdEventKey,[CMCD_REQUEST_MODE]:isCmcdRequestKey};function prepareCmcdData(r,e={}){const t={};if(r==null||typeof r!="object")return t;const i=e.version||r.v||1,s=e.reportingMode||CMCD_REQUEST_MODE,n=i===1?isCmcdV1Key:filterMap[s];let a=Object.keys(r).filter(n);const o=e.filter;typeof o=="function"&&(a=a.filter(o));const c=s===CMCD_RESPONSE_MODE||s===CMCD_EVENT_MODE;c&&!a.includes("ts")&&a.push("ts"),i>1&&!a.includes("v")&&a.push("v");const u=_extends({},CMCD_FORMATTER_MAP,e.formatters),f={version:i,reportingMode:s,baseUrl:e.baseUrl};return a.sort().forEach(d=>{let g=r[d];const E=u[d];if(typeof E=="function"&&(g=E(g,f)),d==="v"){if(i===1)return;g=i}d=="pr"&&g===1||(c&&d==="ts"&&!isFiniteNumber(g)&&(g=Date.now()),isValid(g)&&(isTokenField(d)&&typeof g=="string"&&(g=new SfToken(g)),t[d]=g))}),t}function toCmcdHeaders(r,e={}){const t={};if(!r)return t;const i=prepareCmcdData(r,e),s=groupCmcdHeaders(i,e?.customHeaderMap);return Object.entries(s).reduce((n,[a,o])=>{const c=encodeSfDict(o,{whitespace:!1});return c&&(n[a]=c),n},t)}function appendCmcdHeaders(r,e,t){return _extends(r,toCmcdHeaders(e,t))}const CMCD_PARAM="CMCD";function encodeCmcd(r,e={}){return r?encodeSfDict(prepareCmcdData(r,e),{whitespace:!1}):""}function toCmcdUrl(r,e={}){if(!r)return"";const t=encodeCmcd(r,e);return encodeURIComponent(t)}function toCmcdQuery(r,e={}){if(!r)return"";const t=toCmcdUrl(r,e);return`${CMCD_PARAM}=${t}`}const REGEX=/CMCD=[^&#]+/;function appendCmcdQuery(r,e,t){const i=toCmcdQuery(e,t);if(!i)return r;if(REGEX.test(r))return r.replace(REGEX,i);const s=r.includes("?")?"&":"?";return`${r}${s}${i}`}class CMCDController{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=s=>{try{this.apply(s,{ot:CmcdObjectType.MANIFEST,su:!this.initialized})}catch(n){this.hls.logger.warn("Could not generate manifest CMCD data.",n)}},this.applyFragmentData=s=>{try{const{frag:n,part:a}=s,o=this.hls.levels[n.level],c=this.getObjectType(n),u={d:(a||n).duration*1e3,ot:c};(c===CmcdObjectType.VIDEO||c===CmcdObjectType.AUDIO||c==CmcdObjectType.MUXED)&&(u.br=o.bitrate/1e3,u.tb=this.getTopBandwidth(c)/1e3,u.bl=this.getBufferLength(c));const f=a?this.getNextPart(a):this.getNextFrag(n);f!=null&&f.url&&f.url!==n.url&&(u.nor=f.url),this.apply(s,u)}catch(n){this.hls.logger.warn("Could not generate segment CMCD data.",n)}},this.hls=e;const t=this.config=e.config,{cmcd:i}=t;i!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||e.sessionId,this.cid=i.contentId,this.useHeaders=i.useHeaders===!0,this.includeKeys=i.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Events.MEDIA_DETACHED,this.onMediaDetached,this),e.on(Events.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Events.MEDIA_DETACHED,this.onMediaDetached,this),e.off(Events.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=this.media=null}onMediaAttached(e,t){this.media=t.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(e,t){var i,s;this.audioBuffer=(i=t.tracks.audio)==null?void 0:i.buffer,this.videoBuffer=(s=t.tracks.video)==null?void 0:s.buffer}createData(){var e;return{v:1,sf:CmcdStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){_extends(t,this.createData());const i=t.ot===CmcdObjectType.INIT||t.ot===CmcdObjectType.VIDEO||t.ot===CmcdObjectType.MUXED;this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:s}=this;s&&(t=Object.keys(t).reduce((a,o)=>(s.includes(o)&&(a[o]=t[o]),a),{}));const n={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),appendCmcdHeaders(e.headers,t,n)):e.url=appendCmcdQuery(e.url,t,n)}getNextFrag(e){var t;const i=(t=this.hls.levels[e.level])==null?void 0:t.details;if(i){const s=e.sn-i.startSN;return i.fragments[s+1]}}getNextPart(e){var t;const{index:i,fragment:s}=e,n=(t=this.hls.levels[s.level])==null||(t=t.details)==null?void 0:t.partList;if(n){const{sn:a}=s;for(let o=n.length-1;o>=0;o--){const c=n[o];if(c.index===i&&c.fragment.sn===a)return n[o+1]}}}getObjectType(e){const{type:t}=e;if(t==="subtitle")return CmcdObjectType.TIMED_TEXT;if(e.sn==="initSegment")return CmcdObjectType.INIT;if(t==="audio")return CmcdObjectType.AUDIO;if(t==="main")return this.hls.audioTracks.length?CmcdObjectType.VIDEO:CmcdObjectType.MUXED}getTopBandwidth(e){let t=0,i;const s=this.hls;if(e===CmcdObjectType.AUDIO)i=s.audioTracks;else{const n=s.maxAutoLevel,a=n>-1?n+1:s.levels.length;i=s.levels.slice(0,a)}return i.forEach(n=>{n.bitrate>t&&(t=n.bitrate)}),t>0?t:NaN}getBufferLength(e){const t=this.media,i=e===CmcdObjectType.AUDIO?this.audioBuffer:this.videoBuffer;return!i||!t?NaN:BufferHelper.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,i=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new i(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,a,o){t(n),this.loader.load(n,a,o)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,i=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new i(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,a,o){t(n),this.loader.load(n,a,o)}}}}const PATHWAY_PENALTY_DURATION_MS=3e5;class ContentSteeringController extends Logger{constructor(e){super("content-steering",e.logger),this.hls=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=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Events.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Events.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((e,t)=>(e.indexOf(t.pathwayId)===-1&&e.push(t.pathwayId),e),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(e){this.updatePathwayPriority(e)}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(i=>i!==e))}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(e,t){const{contentSteering:i}=t;i!==null&&(this.pathwayId=i.pathwayId,this.uri=i.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:i}=t;if(i?.action===NetworkErrorAction.SendAlternateToPenaltyBox&&i.flags===ErrorActionFlags.MoveAllAlternatesMatchingHost){const s=this.levels;let n=this._pathwayPriority,a=this.pathwayId;if(t.context){const{groupId:o,pathwayId:c,type:u}=t.context;o&&s?a=this.getPathwayForGroupId(o,u,a):c&&(a=c)}a in this.penalizedPathways||(this.penalizedPathways[a]=performance.now()),!n&&s&&(n=this.pathways()),n&&n.length>1&&(this.updatePathwayPriority(n),i.resolved=this.pathwayId!==a),t.details===ErrorDetails.BUFFER_APPEND_ERROR&&!t.fatal?i.resolved=!0:i.resolved||this.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${a} levels: ${s&&s.length} priorities: ${stringify(n)} penalized: ${stringify(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const i=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${i}"`),t=this.getLevelsForPathway(i),this.pathwayId=i}return t.length!==e.length&&this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this._pathwayPriority=e;let t;const i=this.penalizedPathways,s=performance.now();Object.keys(i).forEach(n=>{s-i[n]>PATHWAY_PENALTY_DURATION_MS&&delete i[n]});for(let n=0;n<e.length;n++){const a=e[n];if(a in i)continue;if(a===this.pathwayId)return;const o=this.hls.nextLoadLevel,c=this.hls.levels[o];if(t=this.getLevelsForPathway(a),t.length>0){this.log(`Setting Pathway to "${a}"`),this.pathwayId=a,reassignFragmentLevelIndexes(t),this.hls.trigger(Events.LEVELS_UPDATED,{levels:t});const u=this.hls.levels[o];c&&u&&this.levels&&(u.attrs["STABLE-VARIANT-ID"]!==c.attrs["STABLE-VARIANT-ID"]&&u.bitrate!==c.bitrate&&this.log(`Unstable Pathways change from bitrate ${c.bitrate} to ${u.bitrate}`),this.hls.nextLoadLevel=o);break}}}getPathwayForGroupId(e,t,i){const s=this.getLevelsForPathway(i).concat(this.levels||[]);for(let n=0;n<s.length;n++)if(t===PlaylistContextType.AUDIO_TRACK&&s[n].hasAudioGroup(e)||t===PlaylistContextType.SUBTITLE_TRACK&&s[n].hasSubtitleGroup(e))return s[n].pathwayId;return i}clonePathways(e){const t=this.levels;if(!t)return;const i={},s={};e.forEach(n=>{const{ID:a,"BASE-ID":o,"URI-REPLACEMENT":c}=n;if(t.some(f=>f.pathwayId===a))return;const u=this.getLevelsForPathway(o).map(f=>{const d=new AttrList(f.attrs);d["PATHWAY-ID"]=a;const g=d.AUDIO&&`${d.AUDIO}_clone_${a}`,E=d.SUBTITLES&&`${d.SUBTITLES}_clone_${a}`;g&&(i[d.AUDIO]=g,d.AUDIO=g),E&&(s[d.SUBTITLES]=E,d.SUBTITLES=E);const m=performUriReplacement(f.uri,d["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",c),T=new Level({attrs:d,audioCodec:f.audioCodec,bitrate:f.bitrate,height:f.height,name:f.name,url:m,videoCodec:f.videoCodec,width:f.width});if(f.audioGroups)for(let S=1;S<f.audioGroups.length;S++)T.addGroupId("audio",`${f.audioGroups[S]}_clone_${a}`);if(f.subtitleGroups)for(let S=1;S<f.subtitleGroups.length;S++)T.addGroupId("text",`${f.subtitleGroups[S]}_clone_${a}`);return T});t.push(...u),cloneRenditionGroups(this.audioTracks,i,c,a),cloneRenditionGroups(this.subtitleTracks,s,c,a)})}loadSteeringManifest(e){const t=this.hls.config,i=t.loader;this.loader&&this.loader.destroy(),this.loader=new i(t);let s;try{s=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(s.protocol!=="data:"){const f=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;s.searchParams.set("_HLS_pathway",this.pathwayId),s.searchParams.set("_HLS_throughput",""+f)}const n={responseType:"json",url:s.href},a=t.steeringManifestLoadPolicy.default,o=a.errorRetry||a.timeoutRetry||{},c={loadPolicy:a,timeout:a.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},u={onSuccess:(f,d,g,E)=>{this.log(`Loaded steering manifest: "${s}"`);const m=f.data;if(m?.VERSION!==1){this.log(`Steering VERSION ${m.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=m.TTL;const{"RELOAD-URI":T,"PATHWAY-CLONES":S,"PATHWAY-PRIORITY":b}=m;if(T)try{this.uri=new self.URL(T,s).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${T}`);return}this.scheduleRefresh(this.uri||g.url),S&&this.clonePathways(S);const C={steeringManifest:m,url:s.toString()};this.hls.trigger(Events.STEERING_MANIFEST_LOADED,C),b&&this.updatePathwayPriority(b)},onError:(f,d,g,E)=>{if(this.log(`Error loading steering manifest: ${f.code} ${f.text} (${d.url})`),this.stopLoad(),f.code===410){this.enabled=!1,this.log(`Steering manifest ${d.url} no longer available`);return}let m=this.timeToLoad*1e3;if(f.code===429){const T=this.loader;if(typeof T?.getResponseHeader=="function"){const S=T.getResponseHeader("Retry-After");S&&(m=parseFloat(S)*1e3)}this.log(`Steering manifest ${d.url} rate limited`);return}this.scheduleRefresh(this.uri||d.url,m)},onTimeout:(f,d,g)=>{this.log(`Timeout loading steering manifest (${d.url})`),this.scheduleRefresh(this.uri||d.url)}};this.log(`Requesting steering manifest: ${s}`),this.loader.load(n,c,u)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var i;const s=(i=this.hls)==null?void 0:i.media;if(s&&!s.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function cloneRenditionGroups(r,e,t,i){r&&Object.keys(e).forEach(s=>{const n=r.filter(a=>a.groupId===s).map(a=>{const o=_extends({},a);return o.details=void 0,o.attrs=new AttrList(o.attrs),o.url=o.attrs.URI=performUriReplacement(a.url,a.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),o.groupId=o.attrs["GROUP-ID"]=e[s],o.attrs["PATHWAY-ID"]=i,o});r.push(...n)})}function performUriReplacement(r,e,t,i){const{HOST:s,PARAMS:n,[t]:a}=i;let o;e&&(o=a?.[e],o&&(r=o));const c=new self.URL(r);return s&&!o&&(c.host=s),n&&Object.keys(n).sort().forEach(u=>{u&&c.searchParams.set(u,n[u])}),c.href}class EMEController extends Logger{constructor(e){super("eme",e.logger),this.hls=void 0,this.config=void 0,this.media=null,this.mediaResolved=void 0,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.mediaKeys=null,this.setMediaKeysQueue=EMEController.CDMCleanupPromise?[EMEController.CDMCleanupPromise]:[],this.bannedKeyIds={},this.onMediaEncrypted=t=>{const{initDataType:i,initData:s}=t,n=`"${t.type}" event: init data type: "${i}"`;if(this.debug(n),s!==null){if(!this.keyFormatPromise){let a=Object.keys(this.keySystemAccessPromises);a.length||(a=getKeySystemsForConfig(this.config));const o=a.map(keySystemDomainToKeySystemFormat).filter(c=>!!c);this.keyFormatPromise=this.getKeyFormatPromise(o)}this.keyFormatPromise.then(a=>{const o=keySystemFormatToKeySystemDomain(a);if(i!=="sinf"||o!==KeySystems.FAIRPLAY){this.log(`Ignoring "${t.type}" event with init data type: "${i}" for selected key-system ${o}`);return}let c;try{const E=bin2str(new Uint8Array(s)),m=base64Decode(JSON.parse(E).sinf),T=parseSinf(m);if(!T)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");c=new Uint8Array(T.subarray(8,24))}catch(E){this.warn(`${n} Failed to parse sinf: ${E}`);return}const u=arrayToHex(c),{keyIdToKeySessionPromise:f,mediaKeySessions:d}=this;let g=f[u];for(let E=0;E<d.length;E++){const m=d[E],T=m.decryptdata;if(!T.keyId)continue;const S=arrayToHex(T.keyId);if(arrayValuesMatch(c,T.keyId)||T.uri.replace(/-/g,"").indexOf(u)!==-1){if(g=f[S],!g)continue;if(T.pssh)break;delete f[S],T.pssh=new Uint8Array(s),T.keyId=c,g=f[u]=g.then(()=>this.generateRequestWithPreferredKeySession(m,i,s,"encrypted-event-key-match")),g.catch(b=>this.handleError(b));break}}g||this.handleError(new Error(`Key ID ${u} not encountered in playlist. Key-system sessions ${d.length}.`))}).catch(a=>this.handleError(a))}},this.onWaitingForKey=t=>{this.log(`"${t.type}" event`)},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.onDestroying(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}registerListeners(){this.hls.on(Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(Events.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on(Events.DESTROYING,this.onDestroying,this)}unregisterListeners(){this.hls.off(Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(Events.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off(Events.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:i}=this.config,s=t?.[e];if(s)return s.licenseUrl;if(e===KeySystems.WIDEVINE&&i)return i}getLicenseServerUrlOrThrow(e){const t=this.getLicenseServerUrl(e);if(t===void 0)throw new Error(`no license server URL configured for key-system "${e}"`);return t}getServerCertificateUrl(e){const{drmSystems:t}=this.config,i=t?.[e];if(i)return i.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,i=(a,o,c)=>!!a&&c.indexOf(a)===o,s=t.map(a=>a.audioCodec).filter(i),n=t.map(a=>a.videoCodec).filter(i);return s.length+n.length===0&&n.push("avc1.42e01e"),new Promise((a,o)=>{const c=u=>{const f=u.shift();this.getMediaKeysPromise(f,s,n).then(d=>a({keySystem:f,mediaKeys:d})).catch(d=>{u.length?c(u):d instanceof EMEKeyError?o(d):o(new EMEKeyError({type:ErrorTypes.KEY_SYSTEM_ERROR,details:ErrorDetails.KEY_SYSTEM_NO_ACCESS,error:d,fatal:!0},d.message))})};c(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:i}=this.config;if(typeof i!="function"){let s=`Configured requestMediaKeySystemAccess is not a function ${i}`;return requestMediaKeySystemAccess===null&&self.location.protocol==="http:"&&(s=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(s))}return i(e,t)}getMediaKeysPromise(e,t,i){var s;const n=getSupportedMediaKeySystemConfigurations(e,t,i,this.config.drmSystemOptions||{});let a=this.keySystemAccessPromises[e],o=(s=a)==null?void 0:s.keySystemAccess;if(!o){this.log(`Requesting encrypted media "${e}" key-system access with config: ${stringify(n)}`),o=this.requestMediaKeySystemAccess(e,n);const c=a=this.keySystemAccessPromises[e]={keySystemAccess:o};return o.catch(u=>{this.log(`Failed to obtain access to key-system "${e}": ${u}`)}),o.then(u=>{this.log(`Access for key-system "${u.keySystem}" obtained`);const f=this.fetchServerCertificate(e);this.log(`Create media-keys for "${e}"`);const d=c.mediaKeys=u.createMediaKeys().then(g=>(this.log(`Media-keys created for "${e}"`),c.hasMediaKeys=!0,f.then(E=>E?this.setMediaKeysServerCertificate(g,e,E):g)));return d.catch(g=>{this.error(`Failed to create media-keys for "${e}"}: ${g}`)}),d})}return o.then(()=>a.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:i}){this.log(`Creating key-system session "${t}" keyId: ${arrayToHex(e.keyId||[])} keyUri: ${e.uri}`);const s=i.createSession(),n={decryptdata:e,keySystem:t,mediaKeys:i,mediaKeysSession:s,keyStatus:"status-pending"};return this.mediaKeySessions.push(n),n}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const i=this.createMediaKeySessionContext(e),s=getKeyIdString(t),n="cenc";this.keyIdToKeySessionPromise[s]=this.generateRequestWithPreferredKeySession(i,n,t.pssh.buffer,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}updateKeySession(e,t){const i=e.mediaKeysSession;return this.log(`Updating key-session "${i.sessionId}" for keyId ${arrayToHex(e.decryptdata.keyId||[])}
|
|
305
|
-
} (data length: ${t.byteLength})`),i.update(t)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>keySystemDomainToKeySystemFormat(e)).filter(e=>!!e)}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then(({keySystem:t,mediaKeys:i})=>this.attemptSetMediaKeys(t,i))}selectKeySystem(e){return new Promise((t,i)=>{this.getKeySystemSelectionPromise(e).then(({keySystem:s})=>{const n=keySystemDomainToKeySystemFormat(s);n?t(n):i(new Error(`Unable to find format for key-system "${s}"`))}).catch(i)})}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){const t=getKeySystemsForConfig(this.config),i=e.map(keySystemFormatToKeySystemDomain).filter(s=>!!s&&t.indexOf(s)!==-1);return this.selectKeySystem(i)}getKeyStatus(e){const{mediaKeySessions:t}=this;for(let i=0;i<t.length;i++){const s=getKeyStatus(e,t[i]);if(s)return s}}loadKey(e){const t=e.keyInfo.decryptdata,i=getKeyIdString(t),s=this.bannedKeyIds[i];if(s||this.getKeyStatus(t)==="internal-error"){const o=getKeyStatusError(s||"internal-error",t);return this.handleError(o,e.frag),Promise.reject(o)}const n=`(keyId: ${i} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${n}`);const a=this.keyIdToKeySessionPromise[i];if(!a){const o=this.getKeySystemForKeyPromise(t).then(({keySystem:c,mediaKeys:u})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${n}`),this.attemptSetMediaKeys(c,u).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:c,mediaKeys:u,decryptdata:t}))))).then(c=>{const u="cenc",f=t.pssh?t.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(c,u,f,"playlist-key")});return o.catch(c=>this.handleError(c,e.frag)),this.keyIdToKeySessionPromise[i]=o,o}return a.catch(o=>{if(o instanceof EMEKeyError){const c=_objectSpread2({},o.data);this.getKeyStatus(t)==="internal-error"&&(c.decryptdata=t);const u=new EMEKeyError(c,o.message);this.handleError(u,e.frag)}}),a}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e,t){if(this.hls)if(e instanceof EMEKeyError){t&&(e.data.frag=t);const i=e.data.decryptdata;this.error(`${e.message}${i?` (${arrayToHex(i.keyId||[])})`:""}`),this.hls.trigger(Events.ERROR,e.data)}else this.error(e.message),this.hls.trigger(Events.ERROR,{type:ErrorTypes.KEY_SYSTEM_ERROR,details:ErrorDetails.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0})}getKeySystemForKeyPromise(e){const t=getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){const s=keySystemFormatToKeySystemDomain(e.keyFormat),n=s?[s]:getKeySystemsForConfig(this.config);return this.attemptKeySystemAccess(n)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=getKeySystemsForConfig(this.config)),e.length===0)throw new EMEKeyError({type:ErrorTypes.KEY_SYSTEM_ERROR,details:ErrorDetails.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${stringify({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){if(this.mediaResolved=void 0,this.mediaKeys===t)return Promise.resolve();const i=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const s=Promise.all(i).then(()=>this.media?this.media.setMediaKeys(t):new Promise((n,a)=>{this.mediaResolved=()=>{if(this.mediaResolved=void 0,!this.media)return a(new Error("Attempted to set mediaKeys without media element attached"));this.mediaKeys=t,this.media.setMediaKeys(t).then(n).catch(a)}}));return this.mediaKeys=t,this.setMediaKeysQueue.push(s),s.then(()=>{this.log(`Media-keys set for "${e}"`),i.push(s),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(n=>i.indexOf(n)===-1)})}generateRequestWithPreferredKeySession(e,t,i,s){var n;const a=(n=this.config.drmSystems)==null||(n=n[e.keySystem])==null?void 0:n.generateRequest;if(a)try{const m=a.call(this.hls,t,i,e);if(!m)throw new Error("Invalid response from configured generateRequest filter");t=m.initDataType,i=m.initData?m.initData:null,e.decryptdata.pssh=i?new Uint8Array(i):null}catch(m){if(this.warn(m.message),this.hls&&this.hls.config.debug)throw m}if(i===null)return this.log(`Skipping key-session request for "${s}" (no initData)`),Promise.resolve(e);const o=getKeyIdString(e.decryptdata),c=e.decryptdata.uri;this.log(`Generating key-session request for "${s}" keyId: ${o} URI: ${c} (init data type: ${t} length: ${i.byteLength})`);const u=new EventEmitter,f=e._onmessage=m=>{const T=e.mediaKeysSession;if(!T){u.emit("error",new Error("invalid state"));return}const{messageType:S,message:b}=m;this.log(`"${S}" message event for session "${T.sessionId}" message size: ${b.byteLength}`),S==="license-request"||S==="license-renewal"?this.renewLicense(e,b).catch(C=>{u.eventNames().length?u.emit("error",C):this.handleError(C)}):S==="license-release"?e.keySystem===KeySystems.FAIRPLAY&&this.updateKeySession(e,strToUtf8array("acknowledged")).then(()=>this.removeSession(e)).catch(C=>this.handleError(C)):this.warn(`unhandled media key message type "${S}"`)},d=(m,T)=>{T.keyStatus=m;let S;m.startsWith("usable")?u.emit("resolved"):m==="internal-error"||m==="output-restricted"||m==="output-downscaled"?S=getKeyStatusError(m,T.decryptdata):m==="expired"?S=new Error(`key expired (keyId: ${o})`):m==="released"?S=new Error("key released"):m==="status-pending"||this.warn(`unhandled key status change "${m}" (keyId: ${o})`),S&&(u.eventNames().length?u.emit("error",S):this.handleError(S))},g=e._onkeystatuseschange=m=>{if(!e.mediaKeysSession){u.emit("error",new Error("invalid state"));return}const S=this.getKeyStatuses(e);if(!Object.keys(S).some(L=>S[L]!=="status-pending"))return;if(S[o]==="expired"){this.log(`Expired key ${stringify(S)} in key-session "${e.mediaKeysSession.sessionId}"`),this.renewKeySession(e);return}let C=S[o];if(C)d(C,e);else{var I;e.keyStatusTimeouts||(e.keyStatusTimeouts={}),(I=e.keyStatusTimeouts)[o]||(I[o]=self.setTimeout(()=>{if(!e.mediaKeysSession||!this.mediaKeys)return;const k=this.getKeyStatus(e.decryptdata);if(k&&k!=="status-pending")return this.log(`No status for keyId ${o} in key-session "${e.mediaKeysSession.sessionId}". Using session key-status ${k} from other session.`),d(k,e);this.log(`key status for ${o} in key-session "${e.mediaKeysSession.sessionId}" timed out after 1000ms`),C="internal-error",d(C,e)},1e3)),this.log(`No status for keyId ${o} (${stringify(S)}).`)}};addEventListener(e.mediaKeysSession,"message",f),addEventListener(e.mediaKeysSession,"keystatuseschange",g);const E=new Promise((m,T)=>{u.on("error",T),u.on("resolved",m)});return e.mediaKeysSession.generateRequest(t,i).then(()=>{this.log(`Request generated for key-session "${e.mediaKeysSession.sessionId}" keyId: ${o} URI: ${c}`)}).catch(m=>{throw new EMEKeyError({type:ErrorTypes.KEY_SYSTEM_ERROR,details:ErrorDetails.KEY_SYSTEM_NO_SESSION,error:m,decryptdata:e.decryptdata,fatal:!1},`Error generating key-session request: ${m}`)}).then(()=>E).catch(m=>(u.removeAllListeners(),this.removeSession(e).then(()=>{throw m}))).then(()=>(u.removeAllListeners(),e))}getKeyStatuses(e){const t={};return e.mediaKeysSession.keyStatuses.forEach((i,s)=>{if(typeof s=="string"&&typeof i=="object"){const o=s;s=i,i=o}const n="buffer"in s?new Uint8Array(s.buffer,s.byteOffset,s.byteLength):new Uint8Array(s);if(e.keySystem===KeySystems.PLAYREADY&&n.length===16){const o=arrayToHex(n);t[o]=i,changeEndianness(n)}const a=arrayToHex(n);i==="internal-error"&&(this.bannedKeyIds[a]=i),this.log(`key status change "${i}" for keyStatuses keyId: ${a} key-session "${e.mediaKeysSession.sessionId}"`),t[a]=i}),t}fetchServerCertificate(e){const t=this.config,i=t.loader,s=new i(t),n=this.getServerCertificateUrl(e);return n?(this.log(`Fetching server certificate for "${e}"`),new Promise((a,o)=>{const c={responseType:"arraybuffer",url:n},u=t.certLoadPolicy.default,f={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(g,E,m,T)=>{a(g.data)},onError:(g,E,m,T)=>{o(new EMEKeyError({type:ErrorTypes.KEY_SYSTEM_ERROR,details:ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:m,response:_objectSpread2({url:c.url,data:void 0},g)},`"${e}" certificate request failed (${n}). Status: ${g.code} (${g.text})`))},onTimeout:(g,E,m)=>{o(new EMEKeyError({type:ErrorTypes.KEY_SYSTEM_ERROR,details:ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:m,response:{url:c.url,data:void 0}},`"${e}" certificate request timed out (${n})`))},onAbort:(g,E,m)=>{o(new Error("aborted"))}};s.load(c,f,d)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,i){return new Promise((s,n)=>{e.setServerCertificate(i).then(a=>{this.log(`setServerCertificate ${a?"success":"not supported by CDM"} (${i.byteLength}) on "${t}"`),s(e)}).catch(a=>{n(new EMEKeyError({type:ErrorTypes.KEY_SYSTEM_ERROR,details:ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:a,fatal:!0},a.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(i=>this.updateKeySession(e,new Uint8Array(i)).catch(s=>{throw new EMEKeyError({type:ErrorTypes.KEY_SYSTEM_ERROR,details:ErrorDetails.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:e.decryptdata,error:s,fatal:!1},s.message)}))}unpackPlayReadyKeyMessage(e,t){const i=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!i.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const s=new DOMParser().parseFromString(i,"application/xml"),n=s.querySelectorAll("HttpHeader");if(n.length>0){let f;for(let d=0,g=n.length;d<g;d++){var a,o;f=n[d];const E=(a=f.querySelector("name"))==null?void 0:a.textContent,m=(o=f.querySelector("value"))==null?void 0:o.textContent;E&&m&&e.setRequestHeader(E,m)}}const c=s.querySelector("Challenge"),u=c?.textContent;if(!u)throw new Error("Cannot find <Challenge> in key message");return strToUtf8array(atob(u))}setupLicenseXHR(e,t,i,s){const n=this.config.licenseXhrSetup;return n?Promise.resolve().then(()=>{if(!i.decryptdata)throw new Error("Key removed");return n.call(this.hls,e,t,i,s)}).catch(a=>{if(!i.decryptdata)throw a;return e.open("POST",t,!0),n.call(this.hls,e,t,i,s)}).then(a=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:a||s})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:s}))}requestLicense(e,t){const i=this.config.keyLoadPolicy.default;return new Promise((s,n)=>{const a=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${a}`);const o=new XMLHttpRequest;o.responseType="arraybuffer",o.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return n(new Error("invalid state"));if(o.readyState===4)if(o.status===200){this._requestLicenseFailureCount=0;let c=o.response;this.log(`License received ${c instanceof ArrayBuffer?c.byteLength:c}`);const u=this.config.licenseResponseCallback;if(u)try{c=u.call(this.hls,o,a,e)}catch(f){this.error(f)}s(c)}else{const c=i.errorRetry,u=c?c.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>u||o.status>=400&&o.status<500)n(new EMEKeyError({type:ErrorTypes.KEY_SYSTEM_ERROR,details:ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:e.decryptdata,fatal:!0,networkDetails:o,response:{url:a,data:void 0,code:o.status,text:o.statusText}},`License Request XHR failed (${a}). Status: ${o.status} (${o.statusText})`));else{const f=u-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${f} attempts left`),this.requestLicense(e,t).then(s,n)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=o,this.setupLicenseXHR(o,a,e,t).then(({xhr:c,licenseChallenge:u})=>{e.keySystem==KeySystems.PLAYREADY&&(u=this.unpackPlayReadyKeyMessage(c,u)),c.send(u)}).catch(n)})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const i=t.media;this.media=i,addEventListener(i,"encrypted",this.onMediaEncrypted),addEventListener(i,"waitingforkey",this.onWaitingForKey);const s=this.mediaResolved;s?s():this.mediaKeys=i.mediaKeys}onMediaDetached(){const e=this.media;e&&(removeEventListener(e,"encrypted",this.onMediaEncrypted),removeEventListener(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var e;this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},this.bannedKeyIds={};const t=this.mediaResolved;if(t&&t(),!this.mediaKeys&&!this.mediaKeySessions.length)return;const i=this.media,s=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,LevelKey.clearKeyUriToKeyIdMap();const n=s.length;EMEController.CDMCleanupPromise=Promise.all(s.map(a=>this.removeSession(a)).concat((i==null||(e=i.setMediaKeys(null))==null?void 0:e.catch(a=>{this.log(`Could not clear media keys: ${a}`),this.hls&&this.hls.trigger(Events.ERROR,{type:ErrorTypes.OTHER_ERROR,details:ErrorDetails.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${a}`)})}))||Promise.resolve())).catch(a=>{this.log(`Could not close sessions and clear media keys: ${a}`),this.hls&&this.hls.trigger(Events.ERROR,{type:ErrorTypes.OTHER_ERROR,details:ErrorDetails.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${a}`)})}).then(()=>{n&&this.log("finished closing key sessions and clearing media keys")})}onManifestLoading(){this._clear()}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const i=t.reduce((s,n)=>(s.indexOf(n.keyFormat)===-1&&s.push(n.keyFormat),s),[]);this.log(`Selecting key-system from session-keys ${i.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(i)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:i,decryptdata:s}=e;if(t){this.log(`Remove licenses and keys and close session "${t.sessionId}" keyId: ${arrayToHex(s?.keyId||[])}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const n=this.mediaKeySessions.indexOf(e);n>-1&&this.mediaKeySessions.splice(n,1);const{keyStatusTimeouts:a}=e;a&&Object.keys(a).forEach(u=>self.clearTimeout(a[u]));const{drmSystemOptions:o}=this.config;return(isPersistentSessionType(o)?new Promise((u,f)=>{self.setTimeout(()=>f(new Error("MediaKeySession.remove() timeout")),8e3),t.remove().then(u).catch(f)}):Promise.resolve()).catch(u=>{this.log(`Could not remove session: ${u}`),this.hls&&this.hls.trigger(Events.ERROR,{type:ErrorTypes.OTHER_ERROR,details:ErrorDetails.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${u}`)})}).then(()=>t.close()).catch(u=>{this.log(`Could not close session: ${u}`),this.hls&&this.hls.trigger(Events.ERROR,{type:ErrorTypes.OTHER_ERROR,details:ErrorDetails.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${u}`)})})}return Promise.resolve()}}EMEController.CDMCleanupPromise=void 0;function getKeyIdString(r){if(!r)throw new Error("Could not read keyId of undefined decryptdata");if(r.keyId===null)throw new Error("keyId is null");return arrayToHex(r.keyId)}function getKeyStatus(r,e){if(r.keyId&&e.mediaKeysSession.keyStatuses.has(r.keyId))return e.mediaKeysSession.keyStatuses.get(r.keyId);if(r.matches(e.decryptdata))return e.keyStatus}class EMEKeyError extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}function getKeyStatusError(r,e){const t=r==="output-restricted",i=t?ErrorDetails.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:ErrorDetails.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new EMEKeyError({type:ErrorTypes.KEY_SYSTEM_ERROR,details:i,fatal:!1,decryptdata:e},t?"HDCP level output restricted":`key status changed to "${r}"`)}class FPSController{constructor(e){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=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(Events.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(Events.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(Events.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(Events.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const i=this.hls.config;if(i.capLevelOnFPSDrop){const s=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=s,s&&typeof s.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,t,i){const s=performance.now();if(t){if(this.lastTime){const n=s-this.lastTime,a=i-this.lastDroppedFrames,o=t-this.lastDecodedFrames,c=1e3*a/n,u=this.hls;if(u.trigger(Events.FPS_DROP,{currentDropped:a,currentDecoded:o,totalDroppedFrames:i}),c>0&&a>u.config.fpsDroppedMonitoringThreshold*o){let f=u.currentLevel;u.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+f),f>0&&(u.autoLevelCapping===-1||u.autoLevelCapping>=f)&&(f=f-1,u.trigger(Events.FPS_DROP_LEVEL_CAPPING,{level:f,droppedLevel:u.currentLevel}),u.autoLevelCapping=f,this.streamController.nextLevelSwitch())}}this.lastTime=s,this.lastDroppedFrames=i,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}function sendAddTrackEvent(r,e){let t;try{t=new Event("addtrack")}catch{t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=r,e.dispatchEvent(t)}function addCueToTrack(r,e){const t=r.mode;if(t==="disabled"&&(r.mode="hidden"),r.cues&&!r.cues.getCueById(e.id))try{if(r.addCue(e),!r.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(i){logger.debug(`[texttrack-utils]: ${i}`);try{const s=new self.TextTrackCue(e.startTime,e.endTime,e.text);s.id=e.id,r.addCue(s)}catch(s){logger.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${s}`)}}t==="disabled"&&(r.mode=t)}function clearCurrentCues(r,e){const t=r.mode;if(t==="disabled"&&(r.mode="hidden"),r.cues)for(let i=r.cues.length;i--;)e&&r.cues[i].removeEventListener("enter",e),r.removeCue(r.cues[i]);t==="disabled"&&(r.mode=t)}function removeCuesInRange(r,e,t,i){const s=r.mode;if(s==="disabled"&&(r.mode="hidden"),r.cues&&r.cues.length>0){const n=getCuesInRange(r.cues,e,t);for(let a=0;a<n.length;a++)(!i||i(n[a]))&&r.removeCue(n[a])}s==="disabled"&&(r.mode=s)}function getFirstCueIndexFromTime(r,e){if(e<=r[0].startTime)return 0;const t=r.length-1;if(e>r[t].endTime)return-1;let i=0,s=t,n;for(;i<=s;)if(n=Math.floor((s+i)/2),e<r[n].startTime)s=n-1;else if(e>r[n].startTime&&i<t)i=n+1;else return n;return r[i].startTime-e<e-r[s].startTime?i:s}function getCuesInRange(r,e,t){const i=[],s=getFirstCueIndexFromTime(r,e);if(s>-1)for(let n=s,a=r.length;n<a;n++){const o=r[n];if(o.startTime>=e&&o.endTime<=t)i.push(o);else if(o.startTime>t)return i}return i}function filterSubtitleTracks(r){const e=[];for(let t=0;t<r.length;t++){const i=r[t];(i.kind==="subtitles"||i.kind==="captions")&&i.label&&e.push(r[t])}return e}class SubtitleTrackController extends BasePlaylistController{constructor(e){super(e,"subtitle-track-controller"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const i=filterSubtitleTracks(this.media.textTracks);for(let n=0;n<i.length;n++)if(i[n].mode==="hidden")t=i[n];else if(i[n].mode==="showing"){t=i[n];break}const s=this.findTrackForTextTrack(t);this.subtitleTrack!==s&&this.setSubtitleTrack(s)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(Events.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(Events.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.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(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(e,t){const i=this.media;if(!i)return;const s=!!t.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||i.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,s)return;filterSubtitleTracks(i.textTracks).forEach(a=>{clearCurrentCues(a)})}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:i,groupId:s,details:n}=t,a=this.tracksInGroup[i];if(!a||a.groupId!==s){this.warn(`Subtitle track with id:${i} and group:${s} not found in active group ${a?.groupId}`);return}const o=a.details;a.details=t.details,this.log(`Subtitle track ${i} "${a.name}" lang:${a.lang} group:${s} loaded [${n.startSN}-${n.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.subtitleGroups||null,s=this.groupIds;let n=this.currentTrack;if(!i||s?.length!==i?.length||i!=null&&i.some(a=>s?.indexOf(a)===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const a=this.tracks.filter(f=>!i||i.indexOf(f.groupId)!==-1);if(a.length)this.selectDefaultTrack&&!a.some(f=>f.default)&&(this.selectDefaultTrack=!1),a.forEach((f,d)=>{f.id=d});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=a;const o=this.hls.config.subtitlePreference;if(!n&&o){this.selectDefaultTrack=!1;const f=findMatchingOption(o,a);if(f>-1)n=a[f];else{const d=findMatchingOption(o,this.tracks);n=this.tracks[d]}}let c=this.findTrackId(n);c===-1&&n&&(c=this.findTrackId(null));const u={subtitleTracks:a};this.log(`Updating subtitle tracks, ${a.length} track(s) found in "${i?.join(",")}" group-id`),this.hls.trigger(Events.SUBTITLE_TRACKS_UPDATED,u),c!==-1&&this.trackId===-1&&this.setSubtitleTrack(c)}}findTrackId(e){const t=this.tracksInGroup,i=this.selectDefaultTrack;for(let s=0;s<t.length;s++){const n=t[s];if(!(i&&!n.default||!i&&!e)&&(!e||matchesOption(n,e)))return s}if(e){for(let s=0;s<t.length;s++){const n=t[s];if(mediaAttributesIdentical(e.attrs,n.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return s}for(let s=0;s<t.length;s++){const n=t[s];if(mediaAttributesIdentical(e.attrs,n.attrs,["LANGUAGE"]))return s}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const s=t[i];if(subtitleTrackMatchesTextTrack(s,e))return i}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===PlaylistContextType.SUBTITLE_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}setSubtitleOption(e){if(this.hls.config.subtitlePreference=e,e){if(e.id===-1)return this.setSubtitleTrack(-1),null;const t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){const i=this.currentTrack;if(i&&matchesOption(e,i))return i;const s=findMatchingOption(e,this.tracksInGroup);if(s>-1){const n=this.tracksInGroup[s];return this.setSubtitleTrack(s),n}else{if(i)return null;{const n=findMatchingOption(e,t);if(n>-1)return t[n]}}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=e.id,s=e.groupId,n=this.getUrlWithDirectives(e.url,t),a=e.details,o=a?.age;this.log(`Loading subtitle ${i} "${e.name}" lang:${e.lang} group:${s}${t?.msn!==void 0?" at sn "+t.msn+" part "+t.part:""}${o&&a.live?" age "+o.toFixed(1)+(a.type&&" "+a.type||""):""} ${n}`),this.hls.trigger(Events.SUBTITLE_TRACK_LOADING,{url:n,id:i,groupId:s,deliveryDirectives:t||null,track:e})}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=filterSubtitleTracks(e.textTracks),i=this.currentTrack;let s;if(i&&(s=t.filter(n=>subtitleTrackMatchesTextTrack(i,n))[0],s||this.warn(`Unable to find subtitle TextTrack with name "${i.name}" and language "${i.lang}"`)),[].slice.call(t).forEach(n=>{n.mode!=="disabled"&&n!==s&&(n.mode="disabled")}),s){const n=this.subtitleDisplay?"showing":"hidden";s.mode!==n&&(s.mode=n)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!isFiniteNumber(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.selectDefaultTrack=!1;const i=this.currentTrack,s=t[e]||null;if(this.trackId=e,this.currentTrack=s,this.toggleTrackModes(),!s){this.hls.trigger(Events.SUBTITLE_TRACK_SWITCH,{id:e});return}const n=!!s.details&&!s.details.live;if(e===this.trackId&&s===i&&n)return;this.log(`Switching to subtitle-track ${e}`+(s?` "${s.name}" lang:${s.lang} group:${s.groupId}`:""));const{id:a,groupId:o="",name:c,type:u,url:f}=s;this.hls.trigger(Events.SUBTITLE_TRACK_SWITCH,{id:a,groupId:o,name:c,type:u,url:f});const d=this.switchParams(s.url,i?.details,s.details);this.loadPlaylist(d)}}function uuid(){try{return crypto.randomUUID()}catch{try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch{let t=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,s=>{const n=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(s=="x"?n:n&3|8).toString(16)})}}}function hash(r){let e=5381,t=r.length;for(;t;)e=e*33^r.charCodeAt(--t);return(e>>>0).toString()}const ALIGNED_END_THRESHOLD_SECONDS=.025;let TimelineOccupancy=(function(r){return r[r.Point=0]="Point",r[r.Range=1]="Range",r})({});function generateAssetIdentifier(r,e,t){return`${r.identifier}-${t+1}-${hash(e)}`}class InterstitialEvent{constructor(e,t){this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=t,this.dateRange=e,this.setDateRange(e)}setDateRange(e){this.dateRange=e,this.resumeOffset=e.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=e.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=e.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=e.attr.enumeratedStringList("X-SNAP",this.snapOptions)}reset(){var e;this.appendInPlaceStarted=!1,(e=this.assetListLoader)==null||e.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(e){var t;if(e>0&&e>=this.assetList.length)return!0;const i=this.playoutLimit;return e<=0||isNaN(i)?!1:i===0?!0:(((t=this.assetList[e])==null?void 0:t.startOffset)||0)>i}findAssetIndex(e){return this.assetList.indexOf(e)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){const e=this.dateRange.startTime;if(this.snapOptions.out){const t=this.dateRange.tagAnchor;if(t)return getSnapToFragmentTime(e,t)}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(this.startTime===0||this.snapOptions.out)return!0;const e=this.dateRange.tagAnchor;if(e){const t=this.dateRange.startTime,i=getSnapToFragmentTime(t,e);return t-i<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,t=isFiniteNumber(e)?e:this.duration;return this.cumulativeDuration+t}get resumeTime(){const e=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){const t=this.resumeAnchor;if(t)return getSnapToFragmentTime(e,t)}return e}get appendInPlace(){return this.appendInPlaceStarted?!0:this.appendInPlaceDisabled?!1:!!(!this.cue.once&&!this.cue.pre&&this.startIsAligned&&(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)<ALIGNED_END_THRESHOLD_SECONDS))}set appendInPlace(e){if(this.appendInPlaceStarted){this.resetOnResume=!e;return}this.appendInPlaceDisabled=!e}get timelineStart(){return this._timelineStart!==null?this._timelineStart:this.startTime}set timelineStart(e){this._timelineStart=e}get duration(){const e=this.playoutLimit;let t;return this._duration!==null?t=this._duration:this.dateRange.duration?t=this.dateRange.duration:t=this.dateRange.plannedDuration||0,!isNaN(e)&&e<t&&(t=e),t}set duration(e){this._duration=e}get cue(){return this.dateRange.cue}get timelineOccupancy(){return this.dateRange.attr["X-TIMELINE-OCCUPIES"]==="RANGE"?TimelineOccupancy.Range:TimelineOccupancy.Point}get supplementsPrimary(){return this.dateRange.attr["X-TIMELINE-STYLE"]==="PRIMARY"}get contentMayVary(){return this.dateRange.attr["X-CONTENT-MAY-VARY"]!=="NO"}get assetUrl(){return this.dateRange.attr["X-ASSET-URI"]}get assetListUrl(){return this.dateRange.attr["X-ASSET-LIST"]}get baseUrl(){return this.base.url}get assetListLoaded(){return this.assetList.length>0||this.assetListResponse!==null}toString(){return eventToString(this)}}function getSnapToFragmentTime(r,e){return r-e.start<e.duration/2&&!(Math.abs(r-(e.start+e.duration))<ALIGNED_END_THRESHOLD_SECONDS)?e.start:e.start+e.duration}function getInterstitialUrl(r,e,t){const i=new self.URL(r,t);return i.protocol!=="data:"&&i.searchParams.set("_HLS_primary_id",e),i}function getNextAssetIndex(r,e){for(;(t=r.assetList[++e])!=null&&t.error;)var t;return e}function eventToString(r){return`["${r.identifier}" ${r.cue.pre?"<pre>":r.cue.post?"<post>":""}${r.timelineStart.toFixed(2)}-${r.resumeTime.toFixed(2)}]`}function eventAssetToString(r){const e=r.timelineStart,t=r.duration||0;return`["${r.identifier}" ${e.toFixed(2)}-${(e+t).toFixed(2)}]`}class HlsAssetPlayer{constructor(e,t,i,s){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls&&this.hls.trigger(Events.PLAYOUT_LIMIT_REACHED,{})};const n=this.hls=new e(t);this.interstitial=i,this.assetItem=s;const a=()=>{this.hasDetails=!0};n.once(Events.LEVEL_LOADED,a),n.once(Events.AUDIO_TRACK_LOADED,a),n.once(Events.SUBTITLE_TRACK_LOADED,a),n.on(Events.MEDIA_ATTACHING,(o,{media:c})=>{this.removeMediaListeners(),this.mediaAttached=c,this.interstitial.playoutLimit&&(c.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&n.on(Events.BUFFER_APPENDED,()=>{const f=this.bufferedEnd;this.reachedPlayout(f)&&(this._bufferedEosTime=f,n.trigger(Events.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){return this.interstitial.appendInPlace}loadSource(){const e=this.hls;if(e)if(e.url)e.levels.length&&!e.started&&e.startLoad(-1,!0);else{let t=this.assetItem.uri;try{t=getInterstitialUrl(t,e.config.primarySessionId||"").href}catch{}e.loadSource(t)}}bufferedInPlaceToEnd(e){var t;if(!this.appendInPlace)return!1;if((t=this.hls)!=null&&t.bufferedToEnd)return!0;if(!e)return!1;const i=Math.min(this._bufferedEosTime||1/0,this.duration),s=this.timelineOffset,n=BufferHelper.bufferInfo(e,s,0);return this.getAssetTime(n.end)>=i-.02}reachedPlayout(e){const i=this.interstitial.playoutLimit;return this.startOffset+e>=i}get destroyed(){var e;return!((e=this.hls)!=null&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return((e=this.hls)==null?void 0:e.media)||null}get bufferedEnd(){const e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const t=BufferHelper.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(t.end)}get currentTime(){const e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){const e=this.assetItem.duration;if(!e)return 0;const t=this.interstitial.playoutLimit;if(t){const i=t-this.startOffset;if(i>0&&i<e)return i}return e}get remaining(){const e=this.duration;return e?Math.max(0,e-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var e;return((e=this.hls)==null?void 0:e.config.timelineOffset)||0}set timelineOffset(e){const t=this.timelineOffset;if(e!==t){const i=e-t;if(Math.abs(i)>1/9e4&&this.hls){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e}}}getAssetTime(e){const t=this.timelineOffset,i=this.duration;return Math.min(Math.max(0,e-t),i)}removeMediaListeners(){const e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){if(this.mediaAttached){var e;(e=this.hls)!=null&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}}destroy(){this.removeMediaListeners(),this.hls&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){var t;this.loadSource(),(t=this.hls)==null||t.attachMedia(e)}detachMedia(){var e;this.removeMediaListeners(),this.mediaAttached=null,(e=this.hls)==null||e.detachMedia()}resumeBuffering(){var e;(e=this.hls)==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.hls)==null||e.pauseBuffering()}transferMedia(){var e;return this.bufferSnapShot(),((e=this.hls)==null?void 0:e.transferMedia())||null}resetDetails(){const e=this.hls;if(e&&this.hasDetails){e.stopLoad();const t=i=>delete i.details;e.levels.forEach(t),e.allAudioTracks.forEach(t),e.allSubtitleTracks.forEach(t),this.hasDetails=!1}}on(e,t,i){var s;(s=this.hls)==null||s.on(e,t)}once(e,t,i){var s;(s=this.hls)==null||s.once(e,t)}off(e,t,i){var s;(s=this.hls)==null||s.off(e,t)}toString(){var e;return`HlsAssetPlayer: ${eventAssetToString(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}}const ABUTTING_THRESHOLD_SECONDS=.033;class InterstitialsSchedule extends Logger{constructor(e,t){super("interstitials-sched",t),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=e}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach(e=>e.reset()),this.events=this.items=null}resetErrorsInRange(e,t){return this.events?this.events.reduce((i,s)=>e<=s.startOffset&&t>s.startOffset?(delete s.error,i+1):i,0):0}get duration(){const e=this.items;return e?e[e.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(e){return e&&this.eventMap[e]||null}hasEvent(e){return e in this.eventMap}findItemIndex(e,t){if(e.event)return this.findEventIndex(e.event.identifier);let i=-1;e.nextEvent?i=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(i=this.findEventIndex(e.previousEvent.identifier)+1);const s=this.items;if(s)for(s[i]||(t===void 0&&(t=e.start),i=this.findItemIndexAtTime(t));i>=0&&(n=s[i])!=null&&n.event;){var n;i--}return i}findItemIndexAtTime(e,t){const i=this.items;if(i)for(let s=0;s<i.length;s++){let n=i[s];if(t&&t!=="primary"&&(n=n[t]),e===n.start||e>n.start&&e<n.end)return s}return-1}findJumpRestrictedIndex(e,t){const i=this.items;if(i)for(let s=e;s<=t&&i[s];s++){const n=i[s].event;if(n!=null&&n.restrictions.jump&&!n.appendInPlace)return s}return-1}findEventIndex(e){const t=this.items;if(t)for(let s=t.length;s--;){var i;if(((i=t[s].event)==null?void 0:i.identifier)===e)return s}return-1}findAssetIndex(e,t){const i=e.assetList,s=i.length;if(s>1)for(let n=0;n<s;n++){const a=i[n];if(!a.error){const o=a.timelineStart;if(t===o||t>o&&(t<o+(a.duration||0)||n===s-1))return n}}return 0}get assetIdAtEnd(){var e;const t=(e=this.items)==null||(e=e[this.length-1])==null?void 0:e.event;if(t){const i=t.assetList,s=i[i.length-1];if(s)return s.identifier}return null}parseInterstitialDateRanges(e,t){const i=e.main.details,{dateRanges:s}=i,n=this.events,a=this.parseDateRanges(s,{url:i.url},t),o=Object.keys(s),c=n?n.filter(u=>!o.includes(u.identifier)):[];a.length&&a.sort((u,f)=>{const d=u.cue.pre,g=u.cue.post,E=f.cue.pre,m=f.cue.post;if(d&&!E)return-1;if(E&&!d||g&&!m)return 1;if(m&&!g)return-1;if(!d&&!E&&!g&&!m){const T=u.startTime,S=f.startTime;if(T!==S)return T-S}return u.dateRange.tagOrder-f.dateRange.tagOrder}),this.events=a,c.forEach(u=>{this.removeEvent(u)}),this.updateSchedule(e,c)}updateSchedule(e,t=[],i=!1){const s=this.events||[];if(s.length||t.length||this.length<2){const n=this.items,a=this.parseSchedule(s,e);(i||t.length||n?.length!==a.length||a.some((c,u)=>Math.abs(c.playout.start-n[u].playout.start)>.005||Math.abs(c.playout.end-n[u].playout.end)>.005))&&(this.items=a,this.onScheduleUpdate(t,n))}}parseDateRanges(e,t,i){const s=[],n=Object.keys(e);for(let a=0;a<n.length;a++){const o=n[a],c=e[o];if(c.isInterstitial){let u=this.eventMap[o];u?u.setDateRange(c):(u=new InterstitialEvent(c,t),this.eventMap[o]=u,i===!1&&(u.appendInPlace=i)),s.push(u)}}return s}parseSchedule(e,t){const i=[],s=t.main.details,n=s.live?1/0:s.edge;let a=0;if(e=e.filter(c=>!c.error&&!(c.cue.once&&c.hasPlayed)),e.length){this.resolveOffsets(e,t);let c=0,u=0;if(e.forEach((f,d)=>{const g=f.cue.pre,E=f.cue.post,m=e[d-1]||null,T=f.appendInPlace,S=E?n:f.startOffset,b=f.duration,C=f.timelineOccupancy===TimelineOccupancy.Range?b:0,I=f.resumptionOffset,L=m?.startTime===S,k=S+f.cumulativeDuration;let U=T?k+b:S+I;if(g||!E&&S<=0){const F=u;u+=C,f.timelineStart=k;const G=a;a+=b,i.push({event:f,start:k,end:U,playout:{start:G,end:a},integrated:{start:F,end:u}})}else if(S<=n){if(!L){const x=S-c;if(x>ABUTTING_THRESHOLD_SECONDS){const $=c,X=u;u+=x;const Q=a;a+=x;const ee={previousEvent:e[d-1]||null,nextEvent:f,start:$,end:$+x,playout:{start:Q,end:a},integrated:{start:X,end:u}};i.push(ee)}else x>0&&m&&(m.cumulativeDuration+=x,i[i.length-1].end=S)}E&&(U=k),f.timelineStart=k;const F=u;u+=C;const G=a;a+=b,i.push({event:f,start:k,end:U,playout:{start:G,end:a},integrated:{start:F,end:u}})}else return;const O=f.resumeTime;E||O>n?c=n:c=O}),c<n){var o;const f=c,d=u,g=n-c;u+=g;const E=a;a+=g,i.push({previousEvent:((o=i[i.length-1])==null?void 0:o.event)||null,nextEvent:null,start:c,end:f+g,playout:{start:E,end:a},integrated:{start:d,end:u}})}this.setDurations(n,a,u)}else i.push({previousEvent:null,nextEvent:null,start:0,end:n,playout:{start:0,end:n},integrated:{start:0,end:n}}),this.setDurations(n,n,n);return i}setDurations(e,t,i){this.durations={primary:e,playout:t,integrated:i}}resolveOffsets(e,t){const i=t.main.details,s=i.live?1/0:i.edge;let n=0,a=-1;e.forEach((o,c)=>{const u=o.cue.pre,f=o.cue.post,d=u?0:f?s:o.startTime;this.updateAssetDurations(o),a===d?o.cumulativeDuration=n:(n=0,a=d),!f&&o.snapOptions.in&&(o.resumeAnchor=findFragmentByPTS(null,i.fragments,o.startOffset+o.resumptionOffset,0,0)||void 0),o.appendInPlace&&!o.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(o,t)||(o.appendInPlace=!1)),!o.appendInPlace&&c+1<e.length&&e[c+1].startTime-e[c].resumeTime<ABUTTING_THRESHOLD_SECONDS&&(e[c+1].appendInPlace=!1,e[c+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${o}`));const E=isFiniteNumber(o.resumeOffset)?o.resumeOffset:o.duration;n+=E})}primaryCanResumeInPlaceAt(e,t){const i=e.resumeTime,s=e.startTime+e.resumptionOffset;return Math.abs(i-s)>ALIGNED_END_THRESHOLD_SECONDS?(this.log(`"${e.identifier}" resumption ${i} not aligned with estimated timeline end ${s}`),!1):!Object.keys(t).some(a=>{const o=t[a].details,c=o.edge;if(i>=c)return this.log(`"${e.identifier}" resumption ${i} past ${a} playlist end ${c}`),!1;const u=findFragmentByPTS(null,o.fragments,i);if(!u)return this.log(`"${e.identifier}" resumption ${i} does not align with any fragments in ${a} playlist (${o.fragStart}-${o.fragmentEnd})`),!0;const f=a==="audio"?.175:0;return Math.abs(u.start-i)<ALIGNED_END_THRESHOLD_SECONDS+f||Math.abs(u.end-i)<ALIGNED_END_THRESHOLD_SECONDS+f?!1:(this.log(`"${e.identifier}" resumption ${i} not aligned with ${a} fragment bounds (${u.start}-${u.end} sn: ${u.sn} cc: ${u.cc})`),!0)})}updateAssetDurations(e){if(!e.assetListLoaded)return;const t=e.timelineStart;let i=0,s=!1,n=!1;for(let a=0;a<e.assetList.length;a++){const o=e.assetList[a],c=t+i;o.startOffset=i,o.timelineStart=c,s||(s=o.duration===null),n||(n=!!o.error);const u=o.error?0:o.duration||0;i+=u}s&&!n?e.duration=Math.max(i,e.duration):e.duration=i}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}}function segmentToString(r){return`[${r.event?'"'+r.event.identifier+'"':"primary"}: ${r.start.toFixed(2)}-${r.end.toFixed(2)}]`}class AssetListLoader{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,t){const i=e.assetListUrl;let s;try{s=getInterstitialUrl(i,this.hls.sessionId,e.baseUrl)}catch(g){const E=this.assignAssetListError(e,ErrorDetails.ASSET_LIST_LOAD_ERROR,g,i);this.hls.trigger(Events.ERROR,E);return}t&&s.protocol!=="data:"&&s.searchParams.set("_HLS_start_offset",""+t);const n=this.hls.config,a=n.loader,o=new a(n),c={responseType:"json",url:s.href},u=n.interstitialAssetListLoadPolicy.default,f={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(g,E,m,T)=>{const S=g.data,b=S?.ASSETS;if(!Array.isArray(b)){const C=this.assignAssetListError(e,ErrorDetails.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),m.url,E,T);this.hls.trigger(Events.ERROR,C);return}e.assetListResponse=S,this.hls.trigger(Events.ASSET_LIST_LOADED,{event:e,assetListResponse:S,networkDetails:T})},onError:(g,E,m,T)=>{const S=this.assignAssetListError(e,ErrorDetails.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${g.code} ${g.text} (${E.url})`),E.url,T,m);this.hls.trigger(Events.ERROR,S)},onTimeout:(g,E,m)=>{const T=this.assignAssetListError(e,ErrorDetails.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${E.url})`),E.url,g,m);this.hls.trigger(Events.ERROR,T)}};return o.load(c,f,d),this.hls.trigger(Events.ASSET_LIST_LOADING,{event:e}),o}assignAssetListError(e,t,i,s,n,a){return e.error=i,{type:ErrorTypes.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:s,error:i,networkDetails:a,stats:n}}}function playWithCatch(r){var e;r==null||(e=r.play())==null||e.catch(()=>{})}function timelineMessage(r,e){return`[${r}] Advancing timeline position to ${e}`}class InterstitialsController extends Logger{constructor(e,t){super("interstitials",e.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.shouldPlay=!1,this.onPlay=()=>{this.shouldPlay=!0},this.onPause=()=>{this.shouldPlay=!1},this.onSeeking=()=>{const i=this.currentTime;if(i===void 0||this.playbackDisabled||!this.schedule)return;const s=i-this.timelinePos;if(Math.abs(s)<1/7056e5)return;const a=s<=-.01;this.timelinePos=i,this.bufferedPos=i;const o=this.playingItem;if(!o){this.checkBuffer();return}if(a&&this.schedule.resetErrorsInRange(i,i-s)&&this.updateSchedule(!0),this.checkBuffer(),a&&i<o.start||i>=o.end){var c;const E=this.findItemIndex(o);let m=this.schedule.findItemIndexAtTime(i);if(m===-1&&(m=E+(a?-1:1),this.log(`seeked ${a?"back ":""}to position not covered by schedule ${i} (resolving from ${E} to ${m})`)),!this.isInterstitial(o)&&(c=this.media)!=null&&c.paused&&(this.shouldPlay=!1),!a&&m>E){const T=this.schedule.findJumpRestrictedIndex(E+1,m);if(T>E){this.setSchedulePosition(T);return}}this.setSchedulePosition(m);return}const u=this.playingAsset;if(!u){if(this.playingLastItem&&this.isInterstitial(o)){const E=o.event.assetList[0];E&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(i,E))}return}const f=u.timelineStart,d=u.duration||0;if(a&&i<f||i>=f+d){var g;(g=o.event)!=null&&g.appendInPlace&&(this.clearAssetPlayers(o.event,o),this.flushFrontBuffer(i)),this.setScheduleToAssetAtTime(i,u)}},this.onTimeupdate=()=>{const i=this.currentTime;if(i===void 0||this.playbackDisabled)return;if(i>this.timelinePos)this.timelinePos=i,i>this.bufferedPos&&this.checkBuffer();else return;const s=this.playingItem;if(!s||this.playingLastItem)return;if(i>=s.end){this.timelinePos=s.end;const o=this.findItemIndex(s);this.setSchedulePosition(o+1)}const n=this.playingAsset;if(!n)return;const a=n.timelineStart+(n.duration||0);i>=a&&this.setScheduleToAssetAtTime(i,n)},this.onScheduleUpdate=(i,s)=>{const n=this.schedule;if(!n)return;const a=this.playingItem,o=n.events||[],c=n.items||[],u=n.durations,f=i.map(T=>T.identifier),d=!!(o.length||f.length);(d||s)&&this.log(`INTERSTITIALS_UPDATED (${o.length}): ${o}
|
|
306
|
-
Schedule: ${c.map(T=>segmentToString(T))} pos: ${this.timelinePos}`),f.length&&this.log(`Removed events ${f}`);let g=null,E=null;a&&(g=this.updateItem(a,this.timelinePos),this.itemsMatch(a,g)?this.playingItem=g:this.waitingItem=this.endedItem=null),this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const m=this.bufferingItem;if(m&&(E=this.updateItem(m,this.bufferedPos),this.itemsMatch(m,E)?this.bufferingItem=E:m.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(m.event,null))),i.forEach(T=>{T.assetList.forEach(S=>{this.clearAssetPlayer(S.identifier,null)})}),this.playerQueue.forEach(T=>{if(T.interstitial.appendInPlace){const S=T.assetItem.timelineStart,b=T.timelineOffset-S;if(b)try{T.timelineOffset=S}catch(C){Math.abs(b)>ALIGNED_END_THRESHOLD_SECONDS&&this.warn(`${C} ("${T.assetId}" ${T.timelineOffset}->${S})`)}}}),d||s){if(this.hls.trigger(Events.INTERSTITIALS_UPDATED,{events:o.slice(0),schedule:c.slice(0),durations:u,removedIds:f}),this.isInterstitial(a)&&f.includes(a.event.identifier)){this.warn(`Interstitial "${a.event.identifier}" removed while playing`),this.primaryFallback(a.event);return}a&&this.trimInPlace(g,a),m&&E!==g&&this.trimInPlace(E,m),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new AssetListLoader(e),this.schedule=new InterstitialsSchedule(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){const e=this.hls;e&&(e.on(Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(Events.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(Events.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(Events.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(Events.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(Events.BUFFER_APPENDED,this.onBufferAppended,this),e.on(Events.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(Events.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(Events.MEDIA_ENDED,this.onMediaEnded,this),e.on(Events.ERROR,this.onError,this),e.on(Events.DESTROYING,this.onDestroying,this))}unregisterListeners(){const e=this.hls;e&&(e.off(Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(Events.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(Events.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(Events.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(Events.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(Events.BUFFER_CODECS,this.onBufferCodecs,this),e.off(Events.BUFFER_APPENDED,this.onBufferAppended,this),e.off(Events.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(Events.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(Events.MEDIA_ENDED,this.onMediaEnded,this),e.off(Events.ERROR,this.onError,this),e.off(Events.DESTROYING,this.onDestroying,this))}startLoad(){this.resumeBuffering()}stopLoad(){this.pauseBuffering()}resumeBuffering(){var e;(e=this.getBufferingPlayer())==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.getBufferingPlayer())==null||e.pauseBuffering()}destroy(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.schedule=this.manager=null,this.hls=this.HlsPlayerClass=this.log=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}onDestroying(){const e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e)}removeMediaListeners(e){removeEventListener(e,"play",this.onPlay),removeEventListener(e,"pause",this.onPause),removeEventListener(e,"seeking",this.onSeeking),removeEventListener(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const i=this.media=t.media;addEventListener(i,"seeking",this.onSeeking),addEventListener(i,"timeupdate",this.onTimeupdate),addEventListener(i,"play",this.onPlay),addEventListener(i,"pause",this.onPause)}onMediaAttached(e,t){const i=this.effectivePlayingItem,s=this.detachedData;if(this.detachedData=null,i===null)this.checkStart();else if(!s){this.clearScheduleState();const n=this.findItemIndex(i);this.setSchedulePosition(n)}}clearScheduleState(){this.log("clear schedule state"),this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,t){const i=!!t.transferMedia,s=this.media;if(this.media=null,!i&&(s&&this.removeMediaListeners(s),this.detachedData)){const n=this.getBufferingPlayer();n&&(this.log(`Removing schedule state for detachedData and ${n}`),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,n.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.hls)return null;if(this.manager)return this.manager;const e=this,t=()=>e.bufferingItem||e.waitingItem,i=d=>d&&e.getAssetPlayer(d.identifier),s=(d,g,E,m,T)=>{if(d){let S=d[g].start;const b=d.event;if(b){if(g==="playout"||b.timelineOccupancy!==TimelineOccupancy.Point){const C=i(E);C?.interstitial===b&&(S+=C.assetItem.startOffset+C[T])}}else{const C=m==="bufferedPos"?a():e[m];S+=C-d.start}return S}return 0},n=(d,g)=>{var E;if(d!==0&&g!=="primary"&&(E=e.schedule)!=null&&E.length){var m;const T=e.schedule.findItemIndexAtTime(d),S=(m=e.schedule.items)==null?void 0:m[T];if(S){const b=S[g].start-S.start;return d+b}}return d},a=()=>{const d=e.bufferedPos;return d===Number.MAX_VALUE?o("primary"):Math.max(d,0)},o=d=>{var g,E;return(g=e.primaryDetails)!=null&&g.live?e.primaryDetails.edge:((E=e.schedule)==null?void 0:E.durations[d])||0},c=(d,g)=>{var E,m;const T=e.effectivePlayingItem;if(T!=null&&(E=T.event)!=null&&E.restrictions.skip||!e.schedule)return;e.log(`seek to ${d} "${g}"`);const S=e.effectivePlayingItem,b=e.schedule.findItemIndexAtTime(d,g),C=(m=e.schedule.items)==null?void 0:m[b],I=e.getBufferingPlayer(),L=I?.interstitial,k=L?.appendInPlace,U=S&&e.itemsMatch(S,C);if(S&&(k||U)){const O=i(e.playingAsset),F=O?.media||e.primaryMedia;if(F){const G=g==="primary"?F.currentTime:s(S,g,e.playingAsset,"timelinePos","currentTime"),x=d-G,$=(k?G:F.currentTime)+x;if($>=0&&(!O||k||$<=O.duration)){F.currentTime=$;return}}}if(C){let O=d;if(g!=="primary"){const G=C[g].start,x=d-G;O=C.start+x}const F=!e.isInterstitial(C);if((!e.isInterstitial(S)||S.event.appendInPlace)&&(F||C.event.appendInPlace)){const G=e.media||(k?I?.media:null);G&&(G.currentTime=O)}else if(S){const G=e.findItemIndex(S);if(b>G){const $=e.schedule.findJumpRestrictedIndex(G+1,b);if($>G){e.setSchedulePosition($);return}}let x=0;if(F)e.timelinePos=O,e.checkBuffer();else{const $=C.event.assetList,X=d-(C[g]||C).start;for(let Q=$.length;Q--;){const ee=$[Q];if(ee.duration&&X>=ee.startOffset&&X<ee.startOffset+ee.duration){x=Q;break}}}e.setSchedulePosition(b,x)}}},u=()=>{const d=e.effectivePlayingItem;if(e.isInterstitial(d))return d;const g=t();return e.isInterstitial(g)?g:null},f={get bufferedEnd(){const d=t(),g=e.bufferingItem;if(g&&g===d){var E;return s(g,"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")-g.playout.start||((E=e.bufferingAsset)==null?void 0:E.startOffset)||0}return 0},get currentTime(){const d=u(),g=e.effectivePlayingItem;return g&&g===d?s(g,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-g.playout.start:0},set currentTime(d){const g=u(),E=e.effectivePlayingItem;E&&E===g&&c(d+E.playout.start,"playout")},get duration(){const d=u();return d?d.playout.end-d.playout.start:0},get assetPlayers(){var d;const g=(d=u())==null?void 0:d.event.assetList;return g?g.map(E=>e.getAssetPlayer(E.identifier)):[]},get playingIndex(){var d;const g=(d=u())==null?void 0:d.event;return g&&e.effectivePlayingAsset?g.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return u()}};return this.manager={get events(){var d;return((d=e.schedule)==null||(d=d.events)==null?void 0:d.slice(0))||[]},get schedule(){var d;return((d=e.schedule)==null||(d=d.items)==null?void 0:d.slice(0))||[]},get interstitialPlayer(){return u()?f:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return t()},get bufferingIndex(){const d=t();return e.findItemIndex(d)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){const d=e.effectivePlayingItem;return e.findItemIndex(d)},primary:{get bufferedEnd(){return a()},get currentTime(){const d=e.timelinePos;return d>0?d:0},set currentTime(d){c(d,"primary")},get duration(){return o("primary")},get seekableStart(){var d;return((d=e.primaryDetails)==null?void 0:d.fragmentStart)||0}},integrated:{get bufferedEnd(){return s(t(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return s(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(d){c(d,"integrated")},get duration(){return o("integrated")},get seekableStart(){var d;return n(((d=e.primaryDetails)==null?void 0:d.fragmentStart)||0,"integrated")}},skip:()=>{const d=e.effectivePlayingItem,g=d?.event;if(g&&!g.restrictions.skip){const E=e.findItemIndex(d);if(g.appendInPlace){const m=d.playout.start+d.event.duration;c(m+.001,"playout")}else e.advanceAfterAssetEnded(g,E,1/0)}}}}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var e;const t=this.playingItem,i=(e=this.schedule)==null?void 0:e.items;return!this.playbackStarted||!t||!i?!1:this.findItemIndex(t)===i.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var e,t;if(this.mediaSelection===null)return;const i=this.waitingItem||this.playingItem;if(this.isInterstitial(i)&&!i.event.appendInPlace)return;let s=this.media;!s&&(e=this.bufferingItem)!=null&&(e=e.event)!=null&&e.appendInPlace&&(s=this.primaryMedia);const n=(t=s)==null?void 0:t.currentTime;if(!(n===void 0||!isFiniteNumber(n)))return n}get primaryMedia(){var e;return this.media||((e=this.detachedData)==null?void 0:e.media)||null}isInterstitial(e){return!!(e!=null&&e.event)}retreiveMediaSource(e,t){const i=this.getAssetPlayer(e);i&&this.transferMediaFromPlayer(i,t)}transferMediaFromPlayer(e,t){const i=e.interstitial.appendInPlace,s=e.media;if(i&&s===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&s){this.detachedData={media:s};return}const n=e.transferMedia();this.log(`transfer MediaSource from ${e} ${stringify(n)}`),this.detachedData=n}else t&&s&&(this.shouldPlay||(this.shouldPlay=!s.paused))}transferMediaTo(e,t){var i,s;if(e.media===t)return;let n=null;const a=this.hls,o=e!==a,c=o&&e.interstitial.appendInPlace,u=(i=this.detachedData)==null?void 0:i.mediaSource;let f;if(a.media)c&&(n=a.transferMedia(),this.detachedData=n),f="Primary";else if(u){const m=this.getBufferingPlayer();m?(n=m.transferMedia(),f=`${m}`):f="detached MediaSource"}else f="detached media";if(!n){if(u)n=this.detachedData,this.log(`using detachedData: MediaSource ${stringify(n)}`);else if(!this.detachedData||a.media===t){const m=this.playerQueue;m.length>1&&m.forEach(T=>{if(o&&T.interstitial.appendInPlace!==c){const S=T.interstitial;this.clearInterstitial(T.interstitial,null),S.appendInPlace=!1,S.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${S}`)}}),this.hls.detachMedia(),this.detachedData={media:t}}}const d=n&&"mediaSource"in n&&((s=n.mediaSource)==null?void 0:s.readyState)!=="closed",g=d&&n?n:t;this.log(`${d?"transfering MediaSource":"attaching media"} to ${o?e:"Primary"} from ${f} (media.currentTime: ${t.currentTime})`);const E=this.schedule;if(g===n&&E){const m=o&&e.assetId===E.assetIdAtEnd;g.overrides={duration:E.duration,endOfStream:!o||m,cueRemoval:!o}}e.attachMedia(g)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const e=this.schedule,t=e?.events;if(!t||this.playbackDisabled||!this.media)return;this.bufferedPos===-1&&(this.bufferedPos=0);const i=this.timelinePos,s=this.effectivePlayingItem;if(i===-1){const n=this.hls.startPosition;if(this.log(timelineMessage("checkStart",n)),this.timelinePos=n,t.length&&t[0].cue.pre){const a=e.findEventIndex(t[0].identifier);this.setSchedulePosition(a)}else if(n>=0||!this.primaryLive){const a=this.timelinePos=n>0?n:0,o=e.findItemIndexAtTime(a);this.setSchedulePosition(o)}}else if(s&&!this.playingItem){const n=e.findItemIndex(s);this.setSchedulePosition(n)}}advanceAssetBuffering(e,t){const i=e.event,s=i.findAssetIndex(t),n=getNextAssetIndex(i,s);if(!i.isAssetPastPlayoutLimit(n))this.bufferedToEvent(e,n);else if(this.schedule){var a;const o=(a=this.schedule.items)==null?void 0:a[this.findItemIndex(e)+1];o&&this.bufferedToItem(o)}}advanceAfterAssetEnded(e,t,i){const s=getNextAssetIndex(e,i);if(e.isAssetPastPlayoutLimit(s)){if(this.schedule){const n=this.schedule.items;if(n){const a=t+1,o=n.length;if(a>=o){this.setSchedulePosition(-1);return}const c=e.resumeTime;this.timelinePos<c&&(this.log(timelineMessage("advanceAfterAssetEnded",c)),this.timelinePos=c,e.appendInPlace&&this.advanceInPlace(c),this.checkBuffer(this.bufferedPos<c)),this.setSchedulePosition(a)}}}else{if(e.appendInPlace){const n=e.assetList[s];n&&this.advanceInPlace(n.timelineStart)}this.setSchedulePosition(t,s)}}setScheduleToAssetAtTime(e,t){const i=this.schedule;if(!i)return;const s=t.parentIdentifier,n=i.getEvent(s);if(n){const a=i.findEventIndex(s),o=i.findAssetIndex(n,e);this.advanceAfterAssetEnded(n,a,o-1)}}setSchedulePosition(e,t){var i;const s=(i=this.schedule)==null?void 0:i.items;if(!s||this.playbackDisabled)return;const n=e>=0?s[e]:null;this.log(`setSchedulePosition ${e}, ${t} (${n&&segmentToString(n)}) pos: ${this.timelinePos}`);const a=this.waitingItem||this.playingItem,o=this.playingLastItem;if(this.isInterstitial(a)){const f=a.event,d=this.playingAsset,g=d?.identifier,E=g?this.getAssetPlayer(g):null;if(E&&g&&(!this.eventItemsMatch(a,n)||t!==void 0&&g!==f.assetList[t].identifier)){var c;const m=f.findAssetIndex(d);if(this.log(`INTERSTITIAL_ASSET_ENDED ${m+1}/${f.assetList.length} ${eventAssetToString(d)}`),this.endedAsset=d,this.playingAsset=null,this.hls.trigger(Events.INTERSTITIAL_ASSET_ENDED,{asset:d,assetListIndex:m,event:f,schedule:s.slice(0),scheduleIndex:e,player:E}),a!==this.playingItem){this.itemsMatch(a,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(f,this.findItemIndex(this.playingItem),m);return}this.retreiveMediaSource(g,n),E.media&&!((c=this.detachedData)!=null&&c.mediaSource)&&E.detachMedia()}if(!this.eventItemsMatch(a,n)&&(this.endedItem=a,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${f} ${segmentToString(a)}`),f.hasPlayed=!0,this.hls.trigger(Events.INTERSTITIAL_ENDED,{event:f,schedule:s.slice(0),scheduleIndex:e}),f.cue.once)){var u;this.updateSchedule();const m=(u=this.schedule)==null?void 0:u.items;if(n&&m){const T=this.findItemIndex(n);this.advanceSchedule(T,m,t,a,o)}return}}this.advanceSchedule(e,s,t,a,o)}advanceSchedule(e,t,i,s,n){const a=this.schedule;if(!a)return;const o=t[e]||null,c=this.primaryMedia,u=this.playerQueue;if(u.length&&u.forEach(f=>{const d=f.interstitial,g=a.findEventIndex(d.identifier);(g<e||g>e+1)&&this.clearInterstitial(d,o)}),this.isInterstitial(o)){this.timelinePos=Math.min(Math.max(this.timelinePos,o.start),o.end);const f=o.event;if(i===void 0){i=a.findAssetIndex(f,this.timelinePos);const m=getNextAssetIndex(f,i-1);if(f.isAssetPastPlayoutLimit(m)||f.appendInPlace&&this.timelinePos===o.end){this.advanceAfterAssetEnded(f,e,i);return}i=m}const d=this.waitingItem;this.assetsBuffered(o,c)||this.setBufferingItem(o);let g=this.preloadAssets(f,i);if(this.eventItemsMatch(o,d||s)||(this.waitingItem=o,this.log(`INTERSTITIAL_STARTED ${segmentToString(o)} ${f.appendInPlace?"append in place":""}`),this.hls.trigger(Events.INTERSTITIAL_STARTED,{event:f,schedule:t.slice(0),scheduleIndex:e})),!f.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${f}`);return}if(f.assetListLoader&&(f.assetListLoader.destroy(),f.assetListLoader=void 0),!c){this.log(`Waiting for attachMedia to start Interstitial ${f}`);return}this.waitingItem=this.endedItem=null,this.playingItem=o;const E=f.assetList[i];if(!E){this.advanceAfterAssetEnded(f,e,i||0);return}if(g||(g=this.getAssetPlayer(E.identifier)),g===null||g.destroyed){const m=f.assetList.length;this.warn(`asset ${i+1}/${m} player destroyed ${f}`),g=this.createAssetPlayer(f,E,i),g.loadSource()}if(!this.eventItemsMatch(o,this.bufferingItem)&&f.appendInPlace&&this.isAssetBuffered(E))return;this.startAssetPlayer(g,i,t,e,c),this.shouldPlay&&playWithCatch(g.media)}else o?(this.resumePrimary(o,e,s),this.shouldPlay&&playWithCatch(this.hls.media)):n&&this.isInterstitial(s)&&(this.endedItem=null,this.playingItem=s,s.event.appendInPlace||this.attachPrimary(a.durations.primary,null))}get playbackDisabled(){return this.hls.config.enableInterstitialPlayback===!1}get primaryDetails(){var e;return(e=this.mediaSelection)==null?void 0:e.main.details}get primaryLive(){var e;return!!((e=this.primaryDetails)!=null&&e.live)}resumePrimary(e,t,i){var s,n;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${segmentToString(e)}`),!((s=this.detachedData)!=null&&s.mediaSource)){let o=this.timelinePos;(o<e.start||o>=e.end)&&(o=this.getPrimaryResumption(e,t),this.log(timelineMessage("resumePrimary",o)),this.timelinePos=o),this.attachPrimary(o,e)}if(!i)return;const a=(n=this.schedule)==null?void 0:n.items;a&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${segmentToString(e)}`),this.hls.trigger(Events.INTERSTITIALS_PRIMARY_RESUMED,{schedule:a.slice(0),scheduleIndex:t}),this.checkBuffer())}getPrimaryResumption(e,t){const i=e.start;if(this.primaryLive){const s=this.primaryDetails;if(t===0)return this.hls.startPosition;if(s&&(i<s.fragmentStart||i>s.edge))return this.hls.liveSyncPosition||-1}return i}isAssetBuffered(e){const t=this.getAssetPlayer(e.identifier);return t!=null&&t.hls?t.hls.bufferedToEnd:BufferHelper.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,t,i){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const s=this.primaryMedia;if(!s)return;const n=this.hls;n.media?this.checkBuffer():(this.transferMediaTo(n,s),i&&this.startLoadingPrimaryAt(e,i)),i||(this.log(timelineMessage("attachPrimary",e)),this.timelinePos=e,this.startLoadingPrimaryAt(e,i))}startLoadingPrimaryAt(e,t){var i;const s=this.hls;!s.loadingEnabled||!s.media||Math.abs((((i=s.mainForwardBufferInfo)==null?void 0:i.start)||s.media.currentTime)-e)>.5?s.startLoad(e,t):s.bufferingEnabled||s.resumeBuffering()}onManifestLoading(){var e;this.stopLoad(),(e=this.schedule)==null||e.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(Events.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(Events.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,t){if(t.level===-1||!this.schedule)return;const i=this.hls.levels[t.level];if(!i.details)return;const s=_objectSpread2(_objectSpread2({},this.mediaSelection||this.altSelection),{},{main:i});this.mediaSelection=s,this.schedule.parseInterstitialDateRanges(s,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(e,t){const i=this.hls.audioTracks[t.id],s=this.mediaSelection;if(!s){this.altSelection=_objectSpread2(_objectSpread2({},this.altSelection),{},{audio:i});return}const n=_objectSpread2(_objectSpread2({},s),{},{audio:i});this.mediaSelection=n}onSubtitleTrackUpdated(e,t){const i=this.hls.subtitleTracks[t.id],s=this.mediaSelection;if(!s){this.altSelection=_objectSpread2(_objectSpread2({},this.altSelection),{},{subtitles:i});return}const n=_objectSpread2(_objectSpread2({},s),{},{subtitles:i});this.mediaSelection=n}onAudioTrackSwitching(e,t){const i=getBasicSelectionOption(t);this.playerQueue.forEach(({hls:s})=>s&&(s.setAudioOption(t)||s.setAudioOption(i)))}onSubtitleTrackSwitch(e,t){const i=getBasicSelectionOption(t);this.playerQueue.forEach(({hls:s})=>s&&(s.setSubtitleOption(t)||t.id!==-1&&s.setSubtitleOption(i)))}onBufferCodecs(e,t){const i=t.tracks;i&&(this.requiredTracks=i)}onBufferAppended(e,t){this.checkBuffer()}onBufferFlushed(e,t){const i=this.playingItem;if(i&&!this.itemsMatch(i,this.bufferingItem)&&!this.isInterstitial(i)){const s=this.timelinePos;this.bufferedPos=s,this.checkBuffer()}}onBufferedToEnd(e){if(!this.schedule)return;const t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(let s=0;s<t.length;s++){const n=t[s];if(n.cue.post){var i;const a=this.schedule.findEventIndex(n.identifier),o=(i=this.schedule.items)==null?void 0:i[a];this.isInterstitial(o)&&this.eventItemsMatch(o,this.bufferingItem)&&this.bufferedToItem(o,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(e){const t=this.playingItem;if(!this.playingLastItem&&t){const i=this.findItemIndex(t);this.setSchedulePosition(i+1)}else this.shouldPlay=!1}updateItem(e,t){var i;const s=(i=this.schedule)==null?void 0:i.items;if(e&&s){const n=this.findItemIndex(e,t);return s[n]||null}return null}trimInPlace(e,t){if(this.isInterstitial(e)&&e.event.appendInPlace&&t.end-e.end>.25){e.event.assetList.forEach((n,a)=>{e.event.isAssetPastPlayoutLimit(a)&&this.clearAssetPlayer(n.identifier,null)});const i=e.end+.25,s=BufferHelper.bufferInfo(this.primaryMedia,i,0);(s.end>i||(s.nextStart||0)>i)&&(this.log(`trim buffered interstitial ${segmentToString(e)} (was ${segmentToString(t)})`),this.attachPrimary(i,null,!0),this.flushFrontBuffer(i))}}itemsMatch(e,t){return!!t&&(e===t||e.event&&t.event&&this.eventItemsMatch(e,t)||!e.event&&!t.event&&this.findItemIndex(e)===this.findItemIndex(t))}eventItemsMatch(e,t){var i;return!!t&&(e===t||e.event.identifier===((i=t.event)==null?void 0:i.identifier))}findItemIndex(e,t){return e&&this.schedule?this.schedule.findItemIndex(e,t):-1}updateSchedule(e=!1){var t;const i=this.mediaSelection;i&&((t=this.schedule)==null||t.updateSchedule(i,[],e))}checkBuffer(e){var t;const i=(t=this.schedule)==null?void 0:t.items;if(!i)return;const s=BufferHelper.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=s.len<1),this.updateBufferedPos(s.end,i,e)}updateBufferedPos(e,t,i){const s=this.schedule,n=this.bufferingItem;if(this.bufferedPos>e||!s)return;if(t.length===1&&this.itemsMatch(t[0],n)){this.bufferedPos=e;return}const a=this.playingItem,o=this.findItemIndex(a);let c=s.findItemIndexAtTime(e);if(this.bufferedPos<e){var u;const f=this.findItemIndex(n),d=Math.min(f+1,t.length-1),g=t[d];if((c===-1&&n&&e>=n.end||(u=g.event)!=null&&u.appendInPlace&&e+.01>=g.start)&&(c=d),this.isInterstitial(n)){const E=n.event;if(d-o>1&&E.appendInPlace===!1||E.assetList.length===0&&E.assetListLoader)return}if(this.bufferedPos=e,c>f&&c>o)this.bufferedToItem(g);else{const E=this.primaryDetails;this.primaryLive&&E&&e>E.edge-E.targetduration&&g.start<E.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(g)&&this.preloadAssets(g.event,0)}}else i&&a&&!this.itemsMatch(a,n)&&(c===o?this.bufferedToItem(a):c===o+1&&this.bufferedToItem(t[c]))}assetsBuffered(e,t){return e.event.assetList.length===0?!1:!e.event.assetList.some(s=>{const n=this.getAssetPlayer(s.identifier);return!(n!=null&&n.bufferedInPlaceToEnd(t))})}setBufferingItem(e){const t=this.bufferingItem,i=this.schedule;if(!this.itemsMatch(e,t)&&i){const{items:s,events:n}=i;if(!s||!n)return t;const a=this.isInterstitial(e),o=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));const c=o?o.remaining:t?t.end-this.timelinePos:0;if(this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${segmentToString(e)}`+(t?` (${c.toFixed(2)} remaining)`:"")),!this.playbackDisabled)if(a){const u=i.findAssetIndex(e.event,this.bufferedPos);e.event.assetList.forEach((f,d)=>{const g=this.getAssetPlayer(f.identifier);g&&(d===u&&g.loadSource(),g.resumeBuffering())})}else this.hls.resumeBuffering(),this.playerQueue.forEach(u=>u.pauseBuffering());this.hls.trigger(Events.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:n.slice(0),schedule:s.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}else this.bufferingItem!==e&&(this.bufferingItem=e);return t}bufferedToItem(e,t=0){const i=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(i!==null){this.bufferingAsset=null;const s=this.detachedData;s?s.mediaSource?this.attachPrimary(e.start,e,!0):this.preloadPrimary(e):this.preloadPrimary(e)}}}preloadPrimary(e){const t=this.findItemIndex(e),i=this.getPrimaryResumption(e,t);this.startLoadingPrimaryAt(i)}bufferedToEvent(e,t){const i=e.event,s=i.assetList.length===0&&!i.assetListLoader,n=i.cue.once;if(s||!n){const a=this.preloadAssets(i,t);if(a!=null&&a.interstitial.appendInPlace){const o=this.primaryMedia;o&&this.bufferAssetPlayer(a,o)}}}preloadAssets(e,t){const i=e.assetUrl,s=e.assetList.length,n=s===0&&!e.assetListLoader,a=e.cue.once;if(n){const c=e.timelineStart;if(e.appendInPlace){var o;const g=this.playingItem;!this.isInterstitial(g)&&(g==null||(o=g.nextEvent)==null?void 0:o.identifier)===e.identifier&&this.flushFrontBuffer(c+.25)}let u,f=0;if(!this.playingItem&&this.primaryLive&&(f=this.hls.startPosition,f===-1&&(f=this.hls.liveSyncPosition||0)),f&&!(e.cue.pre||e.cue.post)){const g=f-c;g>0&&(u=Math.round(g*1e3)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${i?1:s} ${e}${u?` live-start: ${f} start-offset: ${u}`:""}`),i)return this.createAsset(e,0,0,c,e.duration,i);const d=this.assetListLoader.loadAssetList(e,u);d&&(e.assetListLoader=d)}else if(!a&&s){for(let u=t;u<s;u++){const f=e.assetList[u],d=this.getAssetPlayerQueueIndex(f.identifier);(d===-1||this.playerQueue[d].destroyed)&&!f.error&&this.createAssetPlayer(e,f,u)}const c=e.assetList[t];if(c){const u=this.getAssetPlayer(c.identifier);return u&&u.loadSource(),u}}return null}flushFrontBuffer(e){const t=this.requiredTracks;if(!t)return;this.log(`Removing front buffer starting at ${e}`),Object.keys(t).forEach(s=>{this.hls.trigger(Events.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:s})})}getAssetPlayerQueueIndex(e){const t=this.playerQueue;for(let i=0;i<t.length;i++)if(e===t[i].assetId)return i;return-1}getAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);return this.playerQueue[t]||null}getBufferingPlayer(){const{playerQueue:e,primaryMedia:t}=this;if(t){for(let i=0;i<e.length;i++)if(e[i].media===t)return e[i]}return null}createAsset(e,t,i,s,n,a){const o={parentIdentifier:e.identifier,identifier:generateAssetIdentifier(e,a,t),duration:n,startOffset:i,timelineStart:s,uri:a};return this.createAssetPlayer(e,o,t)}createAssetPlayer(e,t,i){const s=this.hls,n=s.userConfig;let a=n.videoPreference;const o=s.loadLevelObj||s.levels[s.currentLevel];(a||o)&&(a=_extends({},a),o.videoCodec&&(a.videoCodec=o.videoCodec),o.videoRange&&(a.allowedVideoRanges=[o.videoRange]));const c=s.audioTracks[s.audioTrack],u=s.subtitleTracks[s.subtitleTrack];let f=0;if(this.primaryLive||e.appendInPlace){const L=this.timelinePos-t.timelineStart;if(L>1){const k=t.duration;k&&L<k&&(f=L)}}const d=t.identifier,g=_objectSpread2(_objectSpread2({},n),{},{maxMaxBufferLength:Math.min(180,s.config.maxMaxBufferLength),autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:s.sessionId,assetPlayerId:d,abrEwmaDefaultEstimate:s.bandwidthEstimate,interstitialsController:void 0,startPosition:f,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:a,audioPreference:c||n.audioPreference,subtitlePreference:u||n.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(g.timelineOffset=t.timelineStart));const E=g.cmcd;E!=null&&E.sessionId&&E.contentId&&(g.cmcd=_extends({},E,{contentId:hash(t.uri)})),this.getAssetPlayer(d)&&this.warn(`Duplicate date range identifier ${e} and asset ${d}`);const m=new HlsAssetPlayer(this.HlsPlayerClass,g,e,t);this.playerQueue.push(m),e.assetList[i]=t;let T=!0;const S=L=>{if(L.live){var k;const F=new Error(`Interstitials MUST be VOD assets ${e}`),G={fatal:!0,type:ErrorTypes.OTHER_ERROR,details:ErrorDetails.INTERSTITIAL_ASSET_ITEM_ERROR,error:F},x=((k=this.schedule)==null?void 0:k.findEventIndex(e.identifier))||-1;this.handleAssetItemError(G,e,x,i,F.message);return}const U=L.edge-L.fragmentStart,O=t.duration;(T||O===null||U>O)&&(T=!1,this.log(`Interstitial asset "${d}" duration change ${O} > ${U}`),t.duration=U,this.updateSchedule())};m.on(Events.LEVEL_UPDATED,(L,{details:k})=>S(k)),m.on(Events.LEVEL_PTS_UPDATED,(L,{details:k})=>S(k)),m.on(Events.EVENT_CUE_ENTER,()=>this.onInterstitialCueEnter());const b=(L,k)=>{const U=this.getAssetPlayer(d);if(U&&k.tracks){U.off(Events.BUFFER_CODECS,b),U.tracks=k.tracks;const O=this.primaryMedia;this.bufferingAsset===U.assetItem&&O&&!U.media&&this.bufferAssetPlayer(U,O)}};m.on(Events.BUFFER_CODECS,b);const C=()=>{var L;const k=this.getAssetPlayer(d);if(this.log(`buffered to end of asset ${k}`),!k||!this.schedule)return;const U=this.schedule.findEventIndex(e.identifier),O=(L=this.schedule.items)==null?void 0:L[U];this.isInterstitial(O)&&this.advanceAssetBuffering(O,t)};m.on(Events.BUFFERED_TO_END,C);const I=L=>()=>{if(!this.getAssetPlayer(d)||!this.schedule)return;this.shouldPlay=!0;const U=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,U,L)};return m.once(Events.MEDIA_ENDED,I(i)),m.once(Events.PLAYOUT_LIMIT_REACHED,I(1/0)),m.on(Events.ERROR,(L,k)=>{if(!this.schedule)return;const U=this.getAssetPlayer(d);if(k.details===ErrorDetails.BUFFER_STALLED_ERROR){if(U!=null&&U.appendInPlace){this.handleInPlaceStall(e);return}this.onTimeupdate(),this.checkBuffer(!0);return}this.handleAssetItemError(k,e,this.schedule.findEventIndex(e.identifier),i,`Asset player error ${k.error} ${e}`)}),m.on(Events.DESTROYING,()=>{if(!this.getAssetPlayer(d)||!this.schedule)return;const k=new Error(`Asset player destroyed unexpectedly ${d}`),U={fatal:!0,type:ErrorTypes.OTHER_ERROR,details:ErrorDetails.INTERSTITIAL_ASSET_ITEM_ERROR,error:k};this.handleAssetItemError(U,e,this.schedule.findEventIndex(e.identifier),i,k.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${eventAssetToString(t)}`),this.hls.trigger(Events.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:i,event:e,player:m}),m}clearInterstitial(e,t){this.clearAssetPlayers(e,t),e.reset()}clearAssetPlayers(e,t){e.assetList.forEach(i=>{this.clearAssetPlayer(i.identifier,t)})}resetAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);if(t!==-1){this.log(`reset asset player "${e}" after error`);const i=this.playerQueue[t];this.transferMediaFromPlayer(i,null),i.resetDetails()}}clearAssetPlayer(e,t){const i=this.getAssetPlayerQueueIndex(e);if(i!==-1){const s=this.playerQueue[i];this.log(`clear ${s} toSegment: ${t&&segmentToString(t)}`),this.transferMediaFromPlayer(s,t),this.playerQueue.splice(i,1),s.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,t,i,s,n){const{interstitial:a,assetItem:o,assetId:c}=e,u=a.assetList.length,f=this.playingAsset;this.endedAsset=null,this.playingAsset=o,(!f||f.identifier!==c)&&(f&&(this.clearAssetPlayer(f.identifier,i[s]),delete f.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${u} ${eventAssetToString(o)}`),this.hls.trigger(Events.INTERSTITIAL_ASSET_STARTED,{asset:o,assetListIndex:t,event:a,schedule:i.slice(0),scheduleIndex:s,player:e})),this.bufferAssetPlayer(e,n)}bufferAssetPlayer(e,t){var i,s;if(!this.schedule)return;const{interstitial:n,assetItem:a}=e,o=this.schedule.findEventIndex(n.identifier),c=(i=this.schedule.items)==null?void 0:i[o];if(!c)return;e.loadSource(),this.setBufferingItem(c),this.bufferingAsset=a;const u=this.getBufferingPlayer();if(u===e)return;const f=n.appendInPlace;if(f&&u?.interstitial.appendInPlace===!1)return;const d=u?.tracks||((s=this.detachedData)==null?void 0:s.tracks)||this.requiredTracks;if(f&&a!==this.playingAsset){if(!e.tracks){this.log(`Waiting for track info before buffering ${e}`);return}if(d&&!isCompatibleTrackChange(d,e.tracks)){const g=new Error(`Asset ${eventAssetToString(a)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(d)}')`),E={fatal:!0,type:ErrorTypes.OTHER_ERROR,details:ErrorDetails.INTERSTITIAL_ASSET_ITEM_ERROR,error:g},m=n.findAssetIndex(a);this.handleAssetItemError(E,n,o,m,g.message);return}}this.transferMediaTo(e,t)}handleInPlaceStall(e){const t=this.schedule,i=this.primaryMedia;if(!t||!i)return;const s=i.currentTime,n=t.findAssetIndex(e,s),a=e.assetList[n];if(a){const o=this.getAssetPlayer(a.identifier);if(o){const c=o.currentTime||s-a.timelineStart,u=o.duration-c;if(this.warn(`Stalled at ${c} of ${c+u} in ${o} ${e} (media.currentTime: ${s})`),c&&(u/i.playbackRate<.5||o.bufferedInPlaceToEnd(i))&&o.hls){const f=t.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,f,n)}}}}advanceInPlace(e){const t=this.primaryMedia;t&&t.currentTime<e&&(t.currentTime=e)}handleAssetItemError(e,t,i,s,n){if(e.details===ErrorDetails.BUFFER_STALLED_ERROR)return;const a=t.assetList[s]||null;if(this.warn(`INTERSTITIAL_ASSET_ERROR ${a&&eventAssetToString(a)} ${e.error}`),!this.schedule)return;const o=a?.identifier||"",c=this.getAssetPlayerQueueIndex(o),u=this.playerQueue[c]||null,f=this.schedule.items,d=_extends({},e,{fatal:!1,errorAction:createDoNothingErrorAction(!0),asset:a,assetListIndex:s,event:t,schedule:f,scheduleIndex:i,player:u});if(this.hls.trigger(Events.INTERSTITIAL_ASSET_ERROR,d),!e.fatal)return;const g=this.playingAsset,E=this.bufferingAsset,m=new Error(n);if(a&&(this.clearAssetPlayer(o,null),a.error=m),!t.assetList.some(T=>!T.error))t.error=m;else for(let T=s;T<t.assetList.length;T++)this.resetAssetPlayer(t.assetList[T].identifier);this.updateSchedule(!0),t.error?this.primaryFallback(t):g&&g.identifier===o?this.advanceAfterAssetEnded(t,i,s):E&&E.identifier===o&&this.isInterstitial(this.bufferingItem)&&this.advanceAssetBuffering(this.bufferingItem,E)}primaryFallback(e){const t=e.timelineStart,i=this.effectivePlayingItem;let s=this.timelinePos;if(i){this.log(`Fallback to primary from event "${e.identifier}" start: ${t} pos: ${s} playing: ${segmentToString(i)} error: ${e.error}`),s===-1&&(s=this.hls.startPosition);const a=this.updateItem(i,s);this.itemsMatch(i,a)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t))}else if(s===-1){this.checkStart();return}if(!this.schedule)return;const n=this.schedule.findItemIndexAtTime(s);this.setSchedulePosition(n)}onAssetListLoaded(e,t){var i,s;const n=t.event,a=n.identifier,o=t.assetListResponse.ASSETS;if(!((i=this.schedule)!=null&&i.hasEvent(a)))return;const c=n.timelineStart,u=n.duration;let f=0;o.forEach((T,S)=>{const b=parseFloat(T.DURATION);this.createAsset(n,S,f,c+f,b,T.URI),f+=b}),n.duration=f,this.log(`Loaded asset-list with duration: ${f} (was: ${u}) ${n}`);const d=this.waitingItem,g=d?.event.identifier===a;this.updateSchedule();const E=(s=this.bufferingItem)==null?void 0:s.event;if(g){var m;const T=this.schedule.findEventIndex(a),S=(m=this.schedule.items)==null?void 0:m[T];if(S){if(!this.playingItem&&this.timelinePos>S.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==T){n.error=new Error(`Interstitial ${o.length?"no longer within playback range":"asset-list is empty"} ${this.timelinePos} ${n}`),this.log(n.error.message),this.updateSchedule(!0),this.primaryFallback(n);return}this.setBufferingItem(S)}this.setSchedulePosition(T)}else if(E?.identifier===a){const T=n.assetList[0];if(T){const S=this.getAssetPlayer(T.identifier);if(E.appendInPlace){const b=this.primaryMedia;S&&b&&this.bufferAssetPlayer(S,b)}else S&&S.loadSource()}}}onError(e,t){if(this.schedule)switch(t.details){case ErrorDetails.ASSET_LIST_PARSING_ERROR:case ErrorDetails.ASSET_LIST_LOAD_ERROR:case ErrorDetails.ASSET_LIST_LOAD_TIMEOUT:{const i=t.interstitial;i&&(this.updateSchedule(!0),this.primaryFallback(i));break}case ErrorDetails.BUFFER_STALLED_ERROR:{const i=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(i)&&i.event.appendInPlace){this.handleInPlaceStall(i.event);return}this.log(`Primary player stall @${this.timelinePos} bufferedPos: ${this.bufferedPos}`),this.onTimeupdate(),this.checkBuffer(!0);break}}}}const TICK_INTERVAL$2=500;class SubtitleStreamController extends BaseStreamController{constructor(e,t,i){super(e,t,i,"subtitle-stream-controller",PlaylistLevelType.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(Events.LEVEL_LOADED,this.onLevelLoaded,this),e.on(Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(Events.LEVEL_LOADED,this.onLevelLoaded,this),e.off(Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,t){this.stopLoad(),this.state=State.IDLE,this.setInterval(TICK_INTERVAL$2),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(e,t){this.tracksBuffered=[],super.onMediaDetaching(e,t)}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:i,success:s}=t;if(this.fragContextChanged(i)||(isMediaFragment(i)&&(this.fragPrevious=i),this.state=State.IDLE),!s)return;const n=this.tracksBuffered[this.currentTrackId];if(!n)return;let a;const o=i.start;for(let u=0;u<n.length;u++)if(o>=n[u].start&&o<=n[u].end){a=n[u];break}const c=i.start+i.duration;a?a.end=c:(a={start:o,end:c},n.push(a)),this.fragmentTracker.fragBuffered(i),this.fragBufferedComplete(i,null),this.media&&this.tick()}onBufferFlushing(e,t){const{startOffset:i,endOffset:s}=t;if(i===0&&s!==Number.POSITIVE_INFINITY){const n=s-1;if(n<=0)return;t.endOffsetSubtitles=Math.max(0,n),this.tracksBuffered.forEach(a=>{for(let o=0;o<a.length;){if(a[o].end<=n){a.shift();continue}else if(a[o].start<n)a[o].start=n;else break;o++}}),this.fragmentTracker.removeFragmentsInRange(i,n,PlaylistLevelType.SUBTITLE)}}onError(e,t){const i=t.frag;i?.type===PlaylistLevelType.SUBTITLE&&(t.details===ErrorDetails.FRAG_GAP&&this.fragmentTracker.fragBuffered(i,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==State.STOPPED&&(this.state=State.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&subtitleOptionsIdentical(this.levels,t)){this.levels=t.map(i=>new Level(i));return}this.tracksBuffered=[],this.levels=t.map(i=>{const s=new Level(i);return this.tracksBuffered[s.id]=[],s}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,PlaylistLevelType.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var i;if(this.currentTrackId=t.id,!((i=this.levels)!=null&&i.length)||this.currentTrackId===-1){this.clearInterval();return}const s=this.levels[this.currentTrackId];s!=null&&s.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,s&&this.state!==State.STOPPED&&this.setInterval(TICK_INTERVAL$2)}onSubtitleTrackLoaded(e,t){var i;const{currentTrackId:s,levels:n}=this,{details:a,id:o}=t;if(!n){this.warn(`Subtitle tracks were reset while loading level ${o}`);return}const c=n[o];if(o>=n.length||!c)return;this.log(`Subtitle track ${o} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:""},duration:${a.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let u=0;if(a.live||(i=c.details)!=null&&i.live){if(a.deltaUpdateFailed)return;const d=this.mainDetails;if(!d){this.startFragRequested=!1;return}const g=d.fragments[0];if(!c.details)a.hasProgramDateTime&&d.hasProgramDateTime?(alignMediaPlaylistByPDT(a,d),u=a.fragmentStart):g&&(u=g.start,addSliding(a,u));else{var f;u=this.alignPlaylists(a,c.details,(f=this.levelLastLoaded)==null?void 0:f.details),u===0&&g&&(u=g.start,addSliding(a,u))}d&&!this.startFragRequested&&this.setStartPosition(d,u)}c.details=a,this.levelLastLoaded=c,o===s&&(this.hls.trigger(Events.SUBTITLE_TRACK_UPDATED,{details:a,id:o,groupId:t.groupId}),this.tick(),a.live&&!this.fragCurrent&&this.media&&this.state===State.IDLE&&(findFragmentByPTS(null,a.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),c.details=void 0)))}_handleFragmentLoadComplete(e){const{frag:t,payload:i}=e,s=t.decryptdata,n=this.hls;if(!this.fragContextChanged(t)&&i&&i.byteLength>0&&s!=null&&s.key&&s.iv&&isFullSegmentEncryption(s.method)){const a=performance.now();this.decrypter.decrypt(new Uint8Array(i),s.key.buffer,s.iv.buffer,getAesModeFromFullSegmentMethod(s.method)).catch(o=>{throw n.trigger(Events.ERROR,{type:ErrorTypes.MEDIA_ERROR,details:ErrorDetails.FRAG_DECRYPT_ERROR,fatal:!1,error:o,reason:o.message,frag:t}),o}).then(o=>{const c=performance.now();n.trigger(Events.FRAG_DECRYPTED,{frag:t,payload:o,stats:{tstart:a,tdecrypt:c}})}).catch(o=>{this.warn(`${o.name}: ${o.message}`),this.state=State.IDLE})}}doTick(){if(!this.media){this.state=State.IDLE;return}if(this.state===State.IDLE){const{currentTrackId:e,levels:t}=this,i=t?.[e];if(!i||!t.length||!i.details||this.waitForLive(i))return;const{config:s}=this,n=this.getLoadPosition(),a=BufferHelper.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],n,s.maxBufferHole),{end:o,len:c}=a,u=i.details,f=this.hls.maxBufferLength+u.levelTargetDuration;if(c>f)return;const d=u.fragments,g=d.length,E=u.edge;let m=null;const T=this.fragPrevious;if(o<E){const C=s.maxFragLookUpTolerance,I=o>E-C?0:C;m=findFragmentByPTS(T,d,Math.max(d[0].start,o),I),!m&&T&&T.start<d[0].start&&(m=d[0])}else m=d[g-1];if(m=this.filterReplacedPrimary(m,i.details),!m)return;const S=m.sn-u.startSN,b=d[S-1];if(b&&b.cc===m.cc&&this.fragmentTracker.getState(b)===FragmentState.NOT_LOADED&&(m=b),this.fragmentTracker.getState(m)===FragmentState.NOT_LOADED){const C=this.mapToInitFragWhenRequired(m);C&&this.loadFragment(C,i,o)}}}loadFragment(e,t,i){isMediaFragment(e)?super.loadFragment(e,t,i):this._loadInitSegment(e,t)}get mediaBufferTimeRanges(){return new BufferableInstance(this.tracksBuffered[this.currentTrackId]||[])}}class BufferableInstance{constructor(e){this.buffered=void 0;const t=(i,s,n)=>{if(s=s>>>0,s>n-1)throw new DOMException(`Failed to execute '${i}' on 'TimeRanges': The index provided (${s}) is greater than the maximum bound (${n})`);return e[s][i]};this.buffered={get length(){return e.length},end(i){return t("end",i,e.length)},start(i){return t("start",i,e.length)}}}}const specialCea608CharsCodes={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},getCharForByte=r=>String.fromCharCode(specialCea608CharsCodes[r]||r),NR_ROWS=15,NR_COLS=100,rowsLowCh1={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},rowsHighCh1={17:2,18:4,21:6,22:8,23:10,19:13,20:15},rowsLowCh2={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},rowsHighCh2={25:2,26:4,29:6,30:8,31:10,27:13,28:15},backgroundColors=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class CaptionsLogger{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const i=typeof t=="function"?t():t;logger.log(`${this.time} [${e}] ${i}`)}}}const numArrayToHexArray=function r(e){const t=[];for(let i=0;i<e.length;i++)t.push(e[i].toString(16));return t};class PenState{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(e){const t=["foreground","underline","italics","background","flash"];for(let i=0;i<t.length;i++){const s=t[i];e.hasOwnProperty(s)&&(this[s]=e[s])}}isDefault(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash}equals(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}copy(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class StyledUnicodeChar{constructor(){this.uchar=" ",this.penState=new PenState}reset(){this.uchar=" ",this.penState.reset()}setChar(e,t){this.uchar=e,this.penState.copy(t)}setPenState(e){this.penState.copy(e)}equals(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)}copy(e){this.uchar=e.uchar,this.penState.copy(e.penState)}isEmpty(){return this.uchar===" "&&this.penState.isDefault()}}class Row{constructor(e){this.chars=[],this.pos=0,this.currPenState=new PenState,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<NR_COLS;t++)this.chars.push(new StyledUnicodeChar);this.logger=e}equals(e){for(let t=0;t<NR_COLS;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<NR_COLS;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<NR_COLS;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e}setCursor(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>NR_COLS&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=NR_COLS)}moveCursor(e){const t=this.pos+e;if(e>1)for(let i=this.pos+1;i<t+1;i++)this.chars[i].setPenState(this.currPenState);this.setCursor(t)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(e){e>=144&&this.backSpace();const t=getCharForByte(e);if(this.pos>=NR_COLS){this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1)}clearFromPos(e){let t;for(t=e;t<NR_COLS;t++)this.chars[t].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const e=[];let t=!0;for(let i=0;i<NR_COLS;i++){const s=this.chars[i].uchar;s!==" "&&(t=!1),e.push(s)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class CaptionScreen{constructor(e){this.rows=[],this.currRow=NR_ROWS-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<NR_ROWS;t++)this.rows.push(new Row(e));this.logger=e}reset(){for(let e=0;e<NR_ROWS;e++)this.rows[e].clear();this.currRow=NR_ROWS-1}equals(e){let t=!0;for(let i=0;i<NR_ROWS;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t}copy(e){for(let t=0;t<NR_ROWS;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<NR_ROWS;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(e){this.rows[this.currRow].insertChar(e)}setPen(e){this.rows[this.currRow].setPenStyles(e)}moveCursor(e){this.rows[this.currRow].moveCursor(e)}setCursor(e){this.logger.log(2,"setCursor: "+e),this.rows[this.currRow].setCursor(e)}setPAC(e){this.logger.log(2,()=>"pacData = "+stringify(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let o=0;o<NR_ROWS;o++)this.rows[o].clear();const n=this.currRow+1-this.nrRollUpRows,a=this.lastOutputScreen;if(a){const o=a.rows[n].cueStartTime,c=this.logger.time;if(o!==null&&c!==null&&o<c)for(let u=0;u<this.nrRollUpRows;u++)this.rows[t-this.nrRollUpRows+u+1].copy(a.rows[n+u])}}this.currRow=t;const i=this.rows[this.currRow];if(e.indent!==null){const n=e.indent,a=Math.max(n-1,0);i.setCursor(e.indent),e.color=i.chars[a].penState.foreground}const s={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(s)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let i="",s=-1;for(let n=0;n<NR_ROWS;n++){const a=this.rows[n].getTextString();a&&(s=n+1,e?t.push("Row "+s+": '"+a+"'"):t.push(a.trim()))}return t.length>0&&(e?i="["+t.join(" | ")+"]":i=t.join(`
|
|
307
|
-
`)),i}getTextAndFormat(){return this.rows}}class Cea608Channel{constructor(e,t,i){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=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new CaptionScreen(i),this.nonDisplayedMemory=new CaptionScreen(i),this.lastOutputScreen=new CaptionScreen(i),this.currRollUpRow=this.displayedMemory.rows[NR_ROWS-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[NR_ROWS-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let i=0;i<e.length;i++)this.writeScreen.insertChar(e[i]);const t=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>t+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(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"),this.mode!=="MODE_TEXT"&&(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(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}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"),this.mode==="MODE_POP-ON"){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2===1,t.italics=e>=46,t.italics)t.foreground="white";else{const i=Math.floor(e/2)-16,s=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=s[i]}this.logger.log(2,"MIDROW: "+stringify(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){const t=this.logger.time;t!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=t:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t),this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}class Cea608Parser{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=createCmdHistory(),this.logger=void 0;const s=this.logger=new CaptionsLogger;this.channels=[null,new Cea608Channel(e,t,s),new Cea608Channel(e+1,i,s)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let i=0;i<t.length;i+=2){const s=t[i]&127,n=t[i+1]&127;let a=!1,o=null;if(s===0&&n===0)continue;this.logger.log(3,()=>"["+numArrayToHexArray([t[i],t[i+1]])+"] -> ("+numArrayToHexArray([s,n])+")");const c=this.cmdHistory;if(s>=16&&s<=31){if(hasCmdRepeated(s,n,c)){setLastCmd(null,null,c),this.logger.log(3,()=>"Repeated command ("+numArrayToHexArray([s,n])+") is dropped");continue}setLastCmd(s,n,this.cmdHistory),a=this.parseCmd(s,n),a||(a=this.parseMidrow(s,n)),a||(a=this.parsePAC(s,n)),a||(a=this.parseBackgroundAttributes(s,n))}else setLastCmd(null,null,c);if(!a&&(o=this.parseChars(s,n),o)){const f=this.currentChannel;f&&f>0?this.channels[f].insertChars(o):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!a&&!o&&this.logger.log(2,()=>"Couldn't parse cleaned data "+numArrayToHexArray([s,n])+" orig: "+numArrayToHexArray([t[i],t[i+1]]))}}parseCmd(e,t){const i=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,s=(e===23||e===31)&&t>=33&&t<=35;if(!(i||s))return!1;const n=e===20||e===21||e===23?1:2,a=this.channels[n];return e===20||e===21||e===28||e===29?t===32?a.ccRCL():t===33?a.ccBS():t===34?a.ccAOF():t===35?a.ccAON():t===36?a.ccDER():t===37?a.ccRU(2):t===38?a.ccRU(3):t===39?a.ccRU(4):t===40?a.ccFON():t===41?a.ccRDC():t===42?a.ccTR():t===43?a.ccRTD():t===44?a.ccEDM():t===45?a.ccCR():t===46?a.ccENM():t===47&&a.ccEOC():a.ccTO(t-32),this.currentChannel=n,!0}parseMidrow(e,t){let i=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?i=1:i=2,i!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const s=this.channels[i];return s?(s.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+numArrayToHexArray([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let i;const s=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,n=(e===16||e===24)&&t>=64&&t<=95;if(!(s||n))return!1;const a=e<=23?1:2;t>=64&&t<=95?i=a===1?rowsLowCh1[e]:rowsLowCh2[e]:i=a===1?rowsHighCh1[e]:rowsHighCh2[e];const o=this.channels[a];return o?(o.setPAC(this.interpretPAC(i,t)),this.currentChannel=a,!0):!1}interpretPAC(e,t){let i;const s={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?i=t-96:i=t-64,s.underline=(i&1)===1,i<=13?s.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(s.italics=!0,s.color="white"):s.indent=Math.floor((i-16)/2)*4,s}parseChars(e,t){let i,s=null,n=null;if(e>=25?(i=2,n=e-8):(i=1,n=e),n>=17&&n<=19){let a;n===17?a=t+80:n===18?a=t+112:a=t+144,this.logger.log(2,()=>"Special char '"+getCharForByte(a)+"' in channel "+i),s=[a]}else e>=32&&e<=127&&(s=t===0?[e]:[e,t]);return s&&this.logger.log(3,()=>"Char codes = "+numArrayToHexArray(s).join(",")),s}parseBackgroundAttributes(e,t){const i=(e===16||e===24)&&t>=32&&t<=47,s=(e===23||e===31)&&t>=45&&t<=47;if(!(i||s))return!1;let n;const a={};e===16||e===24?(n=Math.floor((t-32)/2),a.background=backgroundColors[n],t%2===1&&(a.background=a.background+"_semi")):t===45?a.background="transparent":(a.foreground="black",t===47&&(a.underline=!0));const o=e<=23?1:2;return this.channels[o].setBkgData(a),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const t=this.channels[e];t&&t.reset()}setLastCmd(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const i=this.channels[t];i&&i.cueSplitAtTime(e)}}}function setLastCmd(r,e,t){t.a=r,t.b=e}function hasCmdRepeated(r,e,t){return t.a===r&&t.b===e}function createCmdHistory(){return{a:null,b:null}}var VTTCue=(function(){if(optionalSelf!=null&&optionalSelf.VTTCue)return self.VTTCue;const r=["","lr","rl"],e=["start","middle","end","left","right"];function t(o,c){if(typeof c!="string"||!Array.isArray(o))return!1;const u=c.toLowerCase();return~o.indexOf(u)?u:!1}function i(o){return t(r,o)}function s(o){return t(e,o)}function n(o,...c){let u=1;for(;u<arguments.length;u++){const f=arguments[u];for(const d in f)o[d]=f[d]}return o}function a(o,c,u){const f=this,d={enumerable:!0};f.hasBeenReset=!1;let g="",E=!1,m=o,T=c,S=u,b=null,C="",I=!0,L="auto",k="start",U=50,O="middle",F=50,G="middle";Object.defineProperty(f,"id",n({},d,{get:function(){return g},set:function(x){g=""+x}})),Object.defineProperty(f,"pauseOnExit",n({},d,{get:function(){return E},set:function(x){E=!!x}})),Object.defineProperty(f,"startTime",n({},d,{get:function(){return m},set:function(x){if(typeof x!="number")throw new TypeError("Start time must be set to a number.");m=x,this.hasBeenReset=!0}})),Object.defineProperty(f,"endTime",n({},d,{get:function(){return T},set:function(x){if(typeof x!="number")throw new TypeError("End time must be set to a number.");T=x,this.hasBeenReset=!0}})),Object.defineProperty(f,"text",n({},d,{get:function(){return S},set:function(x){S=""+x,this.hasBeenReset=!0}})),Object.defineProperty(f,"region",n({},d,{get:function(){return b},set:function(x){b=x,this.hasBeenReset=!0}})),Object.defineProperty(f,"vertical",n({},d,{get:function(){return C},set:function(x){const $=i(x);if($===!1)throw new SyntaxError("An invalid or illegal string was specified.");C=$,this.hasBeenReset=!0}})),Object.defineProperty(f,"snapToLines",n({},d,{get:function(){return I},set:function(x){I=!!x,this.hasBeenReset=!0}})),Object.defineProperty(f,"line",n({},d,{get:function(){return L},set:function(x){if(typeof x!="number"&&x!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");L=x,this.hasBeenReset=!0}})),Object.defineProperty(f,"lineAlign",n({},d,{get:function(){return k},set:function(x){const $=s(x);if(!$)throw new SyntaxError("An invalid or illegal string was specified.");k=$,this.hasBeenReset=!0}})),Object.defineProperty(f,"position",n({},d,{get:function(){return U},set:function(x){if(x<0||x>100)throw new Error("Position must be between 0 and 100.");U=x,this.hasBeenReset=!0}})),Object.defineProperty(f,"positionAlign",n({},d,{get:function(){return O},set:function(x){const $=s(x);if(!$)throw new SyntaxError("An invalid or illegal string was specified.");O=$,this.hasBeenReset=!0}})),Object.defineProperty(f,"size",n({},d,{get:function(){return F},set:function(x){if(x<0||x>100)throw new Error("Size must be between 0 and 100.");F=x,this.hasBeenReset=!0}})),Object.defineProperty(f,"align",n({},d,{get:function(){return G},set:function(x){const $=s(x);if(!$)throw new SyntaxError("An invalid or illegal string was specified.");G=$,this.hasBeenReset=!0}})),f.displayState=void 0}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a})();class StringDecoder{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function parseTimeStamp(r){function e(i,s,n,a){return(i|0)*3600+(s|0)*60+(n|0)+parseFloat(a||0)}const t=r.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return t?parseFloat(t[2])>59?e(t[2],t[3],0,t[4]):e(t[1],t[2],t[3],t[4]):null}class Settings{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,i){for(let s=0;s<i.length;++s)if(t===i[s]){this.set(e,t);break}}integer(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))}percent(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){const i=parseFloat(t);if(i>=0&&i<=100)return this.set(e,i),!0}return!1}}function parseOptions(r,e,t,i){const s=i?r.split(i):[r];for(const n in s){if(typeof s[n]!="string")continue;const a=s[n].split(t);if(a.length!==2)continue;const o=a[0],c=a[1];e(o,c)}}const defaults=new VTTCue(0,0,""),center=defaults.align==="middle"?"middle":"center";function parseCue(r,e,t){const i=r;function s(){const o=parseTimeStamp(r);if(o===null)throw new Error("Malformed timestamp: "+i);return r=r.replace(/^[^\sa-zA-Z-]+/,""),o}function n(o,c){const u=new Settings;parseOptions(o,function(g,E){let m;switch(g){case"region":for(let T=t.length-1;T>=0;T--)if(t[T].id===E){u.set(g,t[T].region);break}break;case"vertical":u.alt(g,E,["rl","lr"]);break;case"line":m=E.split(","),u.integer(g,m[0]),u.percent(g,m[0])&&u.set("snapToLines",!1),u.alt(g,m[0],["auto"]),m.length===2&&u.alt("lineAlign",m[1],["start",center,"end"]);break;case"position":m=E.split(","),u.percent(g,m[0]),m.length===2&&u.alt("positionAlign",m[1],["start",center,"end","line-left","line-right","auto"]);break;case"size":u.percent(g,E);break;case"align":u.alt(g,E,["start",center,"end","left","right"]);break}},/:/,/\s/),c.region=u.get("region",null),c.vertical=u.get("vertical","");let f=u.get("line","auto");f==="auto"&&defaults.line===-1&&(f=-1),c.line=f,c.lineAlign=u.get("lineAlign","start"),c.snapToLines=u.get("snapToLines",!0),c.size=u.get("size",100),c.align=u.get("align",center);let d=u.get("position","auto");d==="auto"&&defaults.position===50&&(d=c.align==="start"||c.align==="left"?0:c.align==="end"||c.align==="right"?100:50),c.position=d}function a(){r=r.replace(/^\s+/,"")}if(a(),e.startTime=s(),a(),r.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+i);r=r.slice(3),a(),e.endTime=s(),a(),n(r,e)}function fixLineBreaks(r){return r.replace(/<br(?: \/)?>/gi,`
|
|
308
|
-
`)}class VTTParser{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new StringDecoder,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));function i(){let n=t.buffer,a=0;for(n=fixLineBreaks(n);a<n.length&&n[a]!=="\r"&&n[a]!==`
|
|
309
|
-
`;)++a;const o=n.slice(0,a);return n[a]==="\r"&&++a,n[a]===`
|
|
310
|
-
`&&++a,t.buffer=n.slice(a),o}function s(n){parseOptions(n,function(a,o){},/:/)}try{let n="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;n=i();const o=n.match(/^()?WEBVTT([ \t].*)?$/);if(!(o!=null&&o[0]))throw new Error("Malformed WebVTT signature.");t.state="HEADER"}let a=!1;for(;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(a?a=!1:n=i(),t.state){case"HEADER":/:/.test(n)?s(n):n||(t.state="ID");continue;case"NOTE":n||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(n)){t.state="NOTE";break}if(!n)continue;if(t.cue=new VTTCue(0,0,""),t.state="CUE",n.indexOf("-->")===-1){t.cue.id=n;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{parseCue(n,t.cue,t.regionList)}catch{t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const o=n.indexOf("-->")!==-1;if(!n||o&&(a=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(t.cue===null)continue;t.cue.text&&(t.cue.text+=`
|
|
311
|
-
`),t.cue.text+=n}continue;case"BADCUE":n||(t.state="ID")}}}catch{t.state==="CUETEXT"&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state=t.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this}flush(){const e=this;try{if((e.cue||e.state==="HEADER")&&(e.buffer+=`
|
|
312
|
-
|
|
313
|
-
`,e.parse()),e.state==="INITIAL"||e.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this}}const LINEBREAKS=/\r\n|\n\r|\n|\r/g,startsWith=function r(e,t,i=0){return e.slice(i,i+t.length)===t},cueString2millis=function r(e){let t=parseInt(e.slice(-3));const i=parseInt(e.slice(-6,-4)),s=parseInt(e.slice(-9,-7)),n=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!isFiniteNumber(t)||!isFiniteNumber(i)||!isFiniteNumber(s)||!isFiniteNumber(n))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*i,t+=60*1e3*s,t+=3600*1e3*n,t};function generateCueId(r,e,t){return hash(r.toString())+hash(e.toString())+hash(t)}const calculateOffset=function r(e,t,i){let s=e[t],n=e[s.prevCC];if(!n||!n.new&&s.new){e.ccOffset=e.presentationOffset=s.start,s.new=!1;return}for(;(a=n)!=null&&a.new;){var a;e.ccOffset+=s.start-n.start,s.new=!1,s=n,n=e[s.prevCC]}e.presentationOffset=i};function parseWebVTT(r,e,t,i,s,n,a){const o=new VTTParser,c=utf8ArrayToStr(new Uint8Array(r)).trim().replace(LINEBREAKS,`
|
|
314
|
-
`).split(`
|
|
315
|
-
`),u=[],f=e?toMpegTsClockFromTimescale(e.baseTime,e.timescale):0;let d="00:00.000",g=0,E=0,m,T=!0;o.oncue=function(S){const b=t[i];let C=t.ccOffset;const I=(g-f)/9e4;if(b!=null&&b.new&&(E!==void 0?C=t.ccOffset=b.start:calculateOffset(t,i,I)),I){if(!e){m=new Error("Missing initPTS for VTT MPEGTS");return}C=I-t.presentationOffset}const L=S.endTime-S.startTime,k=normalizePts((S.startTime+C-E)*9e4,s*9e4)/9e4;S.startTime=Math.max(k,0),S.endTime=Math.max(k+L,0);const U=S.text.trim();S.text=decodeURIComponent(encodeURIComponent(U)),S.id||(S.id=generateCueId(S.startTime,S.endTime,U)),S.endTime>0&&u.push(S)},o.onparsingerror=function(S){m=S},o.onflush=function(){if(m){a(m);return}n(u)},c.forEach(S=>{if(T)if(startsWith(S,"X-TIMESTAMP-MAP=")){T=!1,S.slice(16).split(",").forEach(b=>{startsWith(b,"LOCAL:")?d=b.slice(6):startsWith(b,"MPEGTS:")&&(g=parseInt(b.slice(7)))});try{E=cueString2millis(d)/1e3}catch(b){m=b}return}else S===""&&(T=!1);o.parse(S+`
|
|
316
|
-
`)}),o.flush()}const IMSC1_CODEC="stpp.ttml.im1t",HMSF_REGEX=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,TIME_UNIT_REGEX=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,textAlignToLineAlign={left:"start",center:"center",right:"end",start:"start",end:"end"};function parseIMSC1(r,e,t,i){const s=findBox(new Uint8Array(r),["mdat"]);if(s.length===0){i(new Error("Could not parse IMSC1 mdat"));return}const n=s.map(o=>utf8ArrayToStr(o)),a=toTimescaleFromScale(e.baseTime,1,e.timescale);try{n.forEach(o=>t(parseTTML(o,a)))}catch(o){i(o)}}function parseTTML(r,e){const s=new DOMParser().parseFromString(r,"text/xml").getElementsByTagName("tt")[0];if(!s)throw new Error("Invalid ttml");const n={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},a=Object.keys(n).reduce((d,g)=>(d[g]=s.getAttribute(`ttp:${g}`)||n[g],d),{}),o=s.getAttribute("xml:space")!=="preserve",c=collectionToDictionary(getElementCollection(s,"styling","style")),u=collectionToDictionary(getElementCollection(s,"layout","region")),f=getElementCollection(s,"body","[begin]");return[].map.call(f,d=>{const g=getTextContent(d,o);if(!g||!d.hasAttribute("begin"))return null;const E=parseTtmlTime(d.getAttribute("begin"),a),m=parseTtmlTime(d.getAttribute("dur"),a);let T=parseTtmlTime(d.getAttribute("end"),a);if(E===null)throw timestampParsingError(d);if(T===null){if(m===null)throw timestampParsingError(d);T=E+m}const S=new VTTCue(E-e,T-e,g);S.id=generateCueId(S.startTime,S.endTime,S.text);const b=u[d.getAttribute("region")],C=c[d.getAttribute("style")],I=getTtmlStyles(b,C,c),{textAlign:L}=I;if(L){const k=textAlignToLineAlign[L];k&&(S.lineAlign=k),S.align=L}return _extends(S,I),S}).filter(d=>d!==null)}function getElementCollection(r,e,t){const i=r.getElementsByTagName(e)[0];return i?[].slice.call(i.querySelectorAll(t)):[]}function collectionToDictionary(r){return r.reduce((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e},{})}function getTextContent(r,e){return[].slice.call(r.childNodes).reduce((t,i,s)=>{var n;return i.nodeName==="br"&&s?t+`
|
|
317
|
-
`:(n=i.childNodes)!=null&&n.length?getTextContent(i,e):e?t+i.textContent.trim().replace(/\s+/g," "):t+i.textContent},"")}function getTtmlStyles(r,e,t){const i="http://www.w3.org/ns/ttml#styling";let s=null;const n=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],a=r!=null&&r.hasAttribute("style")?r.getAttribute("style"):null;return a&&t.hasOwnProperty(a)&&(s=t[a]),n.reduce((o,c)=>{const u=getAttributeNS(e,i,c)||getAttributeNS(r,i,c)||getAttributeNS(s,i,c);return u&&(o[c]=u),o},{})}function getAttributeNS(r,e,t){return r&&r.hasAttributeNS(e,t)?r.getAttributeNS(e,t):null}function timestampParsingError(r){return new Error(`Could not parse ttml timestamp ${r}`)}function parseTtmlTime(r,e){if(!r)return null;let t=parseTimeStamp(r);return t===null&&(HMSF_REGEX.test(r)?t=parseHoursMinutesSecondsFrames(r,e):TIME_UNIT_REGEX.test(r)&&(t=parseTimeUnits(r,e))),t}function parseHoursMinutesSecondsFrames(r,e){const t=HMSF_REGEX.exec(r),i=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+i/e.frameRate}function parseTimeUnits(r,e){const t=TIME_UNIT_REGEX.exec(r),i=Number(t[1]);switch(t[2]){case"h":return i*3600;case"m":return i*60;case"ms":return i*1e3;case"f":return i/e.frameRate;case"t":return i/e.tickRate}return i}class OutputFilter{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,i){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}class TimelineController{constructor(e){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=newVTTCCs(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.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}},e.on(Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(Events.FRAG_LOADING,this.onFragLoading,this),e.on(Events.FRAG_LOADED,this.onFragLoaded,this),e.on(Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(Events.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(Events.FRAG_LOADING,this.onFragLoading,this),e.off(Events.FRAG_LOADED,this.onFragLoaded,this),e.off(Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(Events.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const e=new OutputFilter(this,"textTrack1"),t=new OutputFilter(this,"textTrack2"),i=new OutputFilter(this,"textTrack3"),s=new OutputFilter(this,"textTrack4");this.cea608Parser1=new Cea608Parser(1,e,t),this.cea608Parser2=new Cea608Parser(3,i,s)}addCues(e,t,i,s,n){let a=!1;for(let o=n.length;o--;){const c=n[o],u=intersection(c[0],c[1],t,i);if(u>=0&&(c[0]=Math.min(c[0],t),c[1]=Math.max(c[1],i),a=!0,u/(i-t)>.5))return}if(a||n.push([t,i]),this.config.renderTextTracksNatively){const o=this.captionsTracks[e];this.Cues.newCue(o,t,i,s)}else{const o=this.Cues.newCue(null,t,i,s);this.hls.trigger(Events.CUES_PARSED,{type:"captions",cues:o,track:e})}}onInitPtsFound(e,{frag:t,id:i,initPTS:s,timescale:n,trackId:a}){const{unparsedVttFrags:o}=this;i===PlaylistLevelType.MAIN&&(this.initPTS[t.cc]={baseTime:s,timescale:n,trackId:a}),o.length&&(this.unparsedVttFrags=[],o.forEach(c=>{this.initPTS[c.frag.cc]?this.onFragLoaded(Events.FRAG_LOADED,c):this.hls.trigger(Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:c.frag,error:new Error("Subtitle discontinuity domain does not match main")})}))}getExistingTrack(e,t){const{media:i}=this;if(i)for(let s=0;s<i.textTracks.length;s++){const n=i.textTracks[s];if(canReuseVttTextTrack(n,{name:e,lang:t,characteristics:"transcribes-spoken-dialog,describes-music-and-sound"}))return n}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:i,media:s}=this,{label:n,languageCode:a}=t[e],o=this.getExistingTrack(n,a);if(o)i[e]=o,clearCurrentCues(i[e]),sendAddTrackEvent(i[e],s);else{const c=this.createTextTrack("captions",n,a);c&&(c[e]=!0,i[e]=c)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const i=t.label,s={_id:e,label:i,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=s,this.hls.trigger(Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[s]})}createTextTrack(e,t,i){const s=this.media;if(s)return s.addTextTrack(e,t,i)}onMediaAttaching(e,t){this.media=t.media,t.mediaSource||this._cleanTracks()}onMediaDetaching(e,t){const i=!!t.transferMedia;if(this.media=null,i)return;const{captionsTracks:s}=this;Object.keys(s).forEach(n=>{clearCurrentCues(s[n]),delete s[n]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=newVTTCCs(),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:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let i=0;i<t.length;i++)clearCurrentCues(t[i])}onSubtitleTracksUpdated(e,t){const i=t.subtitleTracks||[],s=i.some(n=>n.textCodec===IMSC1_CODEC);if(this.config.enableWebVTT||s&&this.config.enableIMSC1){if(subtitleOptionsIdentical(this.tracks,i)){this.tracks=i;return}if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const a=this.media,o=a?filterSubtitleTracks(a.textTracks):null;if(this.tracks.forEach((c,u)=>{let f;if(o){let d=null;for(let g=0;g<o.length;g++)if(o[g]&&canReuseVttTextTrack(o[g],c)){d=o[g],o[g]=null;break}d&&(f=d)}if(f)clearCurrentCues(f);else{const d=captionsOrSubtitlesFromCharacteristics(c);f=this.createTextTrack(d,c.name,c.lang),f&&(f.mode="disabled")}f&&this.textTracks.push(f)}),o!=null&&o.length){const c=o.filter(u=>u!==null).map(u=>u.label);c.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${c.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const a=this.tracks.map(o=>({label:o.name,kind:o.type.toLowerCase(),default:o.default,subtitleTrack:o}));this.hls.trigger(Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:a})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(i=>{const s=/(?:CC|SERVICE)([1-4])/.exec(i.instreamId);if(!s)return;const n=`textTrack${s[1]}`,a=this.captionsProperties[n];a&&(a.label=i.name,i.lang&&(a.languageCode=i.lang),a.media=i)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t?.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===PlaylistLevelType.MAIN){var i,s;const{cea608Parser1:n,cea608Parser2:a,lastSn:o}=this,{cc:c,sn:u}=t.frag,f=(i=(s=t.part)==null?void 0:s.index)!=null?i:-1;n&&a&&(u!==o+1||u===o&&f!==this.lastPartIndex+1||c!==this.lastCc)&&(n.reset(),a.reset()),this.lastCc=c,this.lastSn=u,this.lastPartIndex=f}}onFragLoaded(e,t){const{frag:i,payload:s}=t;if(i.type===PlaylistLevelType.SUBTITLE)if(s.byteLength){const n=i.decryptdata,a="stats"in t;if(n==null||!n.encrypted||a){const o=this.tracks[i.level],c=this.vttCCs;c[i.cc]||(c[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),o&&o.textCodec===IMSC1_CODEC?this._parseIMSC1(i,s):this._parseVTTs(t)}}else this.hls.trigger(Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const i=this.hls;parseIMSC1(t,this.initPTS[e.cc],s=>{this._appendCues(s,e.level),i.trigger(Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},s=>{i.logger.log(`Failed to parse IMSC1: ${s}`),i.trigger(Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:s})})}_parseVTTs(e){var t;const{frag:i,payload:s}=e,{initPTS:n,unparsedVttFrags:a}=this,o=n.length-1;if(!n[i.cc]&&o===-1){a.push(e);return}const c=this.hls,u=(t=i.initSegment)!=null&&t.data?appendUint8Array(i.initSegment.data,new Uint8Array(s)).buffer:s;parseWebVTT(u,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,f=>{this._appendCues(f,i.level),c.trigger(Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},f=>{const d=f.message==="Missing initPTS for VTT MPEGTS";d?a.push(e):this._fallbackToIMSC1(i,s),c.logger.log(`Failed to parse VTT cue: ${f}`),!(d&&o>i.cc)&&c.trigger(Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:f})})}_fallbackToIMSC1(e,t){const i=this.tracks[e.level];i.textCodec||parseIMSC1(t,this.initPTS[e.cc],()=>{i.textCodec=IMSC1_CODEC,this._parseIMSC1(e,t)},()=>{i.textCodec="wvtt"})}_appendCues(e,t){const i=this.hls;if(this.config.renderTextTracksNatively){const s=this.textTracks[t];if(!s||s.mode==="disabled")return;e.forEach(n=>addCueToTrack(s,n))}else{const s=this.tracks[t];if(!s)return;const n=s.default?"default":"subtitles"+t;i.trigger(Events.CUES_PARSED,{type:"subtitles",cues:e,track:n})}}onFragDecrypted(e,t){const{frag:i}=t;i.type===PlaylistLevelType.SUBTITLE&&this.onFragLoaded(Events.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:i,samples:s}=t;if(!(i.type===PlaylistLevelType.MAIN&&this.closedCaptionsForLevel(i)==="NONE"))for(let n=0;n<s.length;n++){const a=s[n].bytes;if(a){this.cea608Parser1||this.initCea608Parsers();const o=this.extractCea608Data(a);this.cea608Parser1.addData(s[n].pts,o[0]),this.cea608Parser2.addData(s[n].pts,o[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:i,endOffsetSubtitles:s,type:n}){const{media:a}=this;if(!(!a||a.currentTime<i)){if(!n||n==="video"){const{captionsTracks:o}=this;Object.keys(o).forEach(c=>removeCuesInRange(o[c],t,i))}if(this.config.renderTextTracksNatively&&t===0&&s!==void 0){const{textTracks:o}=this;Object.keys(o).forEach(c=>removeCuesInRange(o[c],t,s))}}}extractCea608Data(e){const t=[[],[]],i=e[0]&31;let s=2;for(let n=0;n<i;n++){const a=e[s++],o=127&e[s++],c=127&e[s++];if(o===0&&c===0)continue;if((4&a)!==0){const f=3&a;(f===0||f===1)&&(t[f].push(o),t[f].push(c))}}return t}}function captionsOrSubtitlesFromCharacteristics(r){return r.characteristics&&/transcribes-spoken-dialog/gi.test(r.characteristics)&&/describes-music-and-sound/gi.test(r.characteristics)?"captions":"subtitles"}function canReuseVttTextTrack(r,e){return!!r&&r.kind===captionsOrSubtitlesFromCharacteristics(e)&&subtitleTrackMatchesTextTrack(e,r)}function intersection(r,e,t,i){return Math.min(e,i)-Math.max(r,t)}function newVTTCCs(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const WHITESPACE_CHAR=/\s/,Cues={newCue(r,e,t,i){const s=[];let n,a,o,c,u;const f=self.VTTCue||self.TextTrackCue;for(let g=0;g<i.rows.length;g++)if(n=i.rows[g],o=!0,c=0,u="",!n.isEmpty()){var d;for(let T=0;T<n.chars.length;T++)WHITESPACE_CHAR.test(n.chars[T].uchar)&&o?c++:(u+=n.chars[T].uchar,o=!1);n.cueStartTime=e,e===t&&(t+=1e-4),c>=16?c--:c++;const E=fixLineBreaks(u.trim()),m=generateCueId(e,t,E);r!=null&&(d=r.cues)!=null&&d.getCueById(m)||(a=new f(e,t,E),a.id=m,a.line=g+1,a.align="left",a.position=10+Math.min(80,Math.floor(c*8/32)*10),s.push(a))}return r&&s.length&&(s.sort((g,E)=>g.line==="auto"||E.line==="auto"?0:g.line>8&&E.line>8?E.line-g.line:g.line-E.line),s.forEach(g=>addCueToTrack(r,g))),s}};function fetchSupported(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const BYTERANGE=/(\d+)-(\d+)\/(\d+)/;class FetchLoader{constructor(e){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=e.fetchSetup||getRequest,this.controller=new self.AbortController,this.stats=new LoadStats}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 e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,i){const s=this.stats;if(s.loading.start)throw new Error("Loader can only be used once.");s.loading.start=self.performance.now();const n=getRequestParameters(e,this.controller.signal),a=e.responseType==="arraybuffer",o=a?"byteLength":"length",{maxTimeToFirstByteMs:c,maxLoadTimeMs:u}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,n),self.clearTimeout(this.requestTimeout),t.timeout=c&&isFiniteNumber(c)?c:u,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(s,e,this.response))},t.timeout),(isPromise(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(d=>{var g;this.response=this.loader=d;const E=Math.max(self.performance.now(),s.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=u,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(s,e,this.response))},u-(E-s.loading.start)),!d.ok){const{status:T,statusText:S}=d;throw new FetchError(S||"fetch, bad network response",T,d)}s.loading.first=E,s.total=getContentLength(d.headers)||s.total;const m=(g=this.callbacks)==null?void 0:g.onProgress;return m&&isFiniteNumber(t.highWaterMark)?this.loadProgressively(d,s,e,t.highWaterMark,m):a?d.arrayBuffer():e.responseType==="json"?d.json():d.text()}).then(d=>{var g,E;const m=this.response;if(!m)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),s.loading.end=Math.max(self.performance.now(),s.loading.first);const T=d[o];T&&(s.loaded=s.total=T);const S={url:m.url,data:d,code:m.status},b=(g=this.callbacks)==null?void 0:g.onProgress;b&&!isFiniteNumber(t.highWaterMark)&&b(s,e,d,m),(E=this.callbacks)==null||E.onSuccess(S,s,e,m)}).catch(d=>{var g;if(self.clearTimeout(this.requestTimeout),s.aborted)return;const E=d&&d.code||0,m=d?d.message:null;(g=this.callbacks)==null||g.onError({code:E,text:m},e,d?d.details:null,s)})}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,i,s=0,n){const a=new ChunkCache,o=e.body.getReader(),c=()=>o.read().then(u=>{if(u.done)return a.dataLength&&n(t,i,a.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const f=u.value,d=f.length;return t.loaded+=d,d<s||a.dataLength?(a.push(f),a.dataLength>=s&&n(t,i,a.flush().buffer,e)):n(t,i,f.buffer,e),c()}).catch(()=>Promise.reject());return c()}}function getRequestParameters(r,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(_extends({},r.headers))};return r.rangeEnd&&t.headers.set("Range","bytes="+r.rangeStart+"-"+String(r.rangeEnd-1)),t}function getByteRangeLength(r){const e=BYTERANGE.exec(r);if(e)return parseInt(e[2])-parseInt(e[1])+1}function getContentLength(r){const e=r.get("Content-Range");if(e){const i=getByteRangeLength(e);if(isFiniteNumber(i))return i}const t=r.get("Content-Length");if(t)return parseInt(t)}function getRequest(r,e){return new self.Request(r.url,e)}class FetchError extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const AGE_HEADER_LINE_REGEX=/^age:\s*[\d.]+\s*$/im;class XhrLoader{constructor(e){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=e&&e.xhrSetup||null,this.stats=new LoadStats,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=i,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const i=this.loader=new self.XMLHttpRequest,s=this.stats;s.loading.first=0,s.loaded=0,s.aborted=!1;const n=this.xhrSetup;n?Promise.resolve().then(()=>{if(!(this.loader!==i||this.stats.aborted))return n(i,t.url)}).catch(a=>{if(!(this.loader!==i||this.stats.aborted))return i.open("GET",t.url,!0),n(i,t.url)}).then(()=>{this.loader!==i||this.stats.aborted||this.openAndSendXhr(i,t,e)}).catch(a=>{var o;(o=this.callbacks)==null||o.onError({code:i.status,text:a.message},t,i,s)}):this.openAndSendXhr(i,t,e)}openAndSendXhr(e,t,i){e.readyState||e.open("GET",t.url,!0);const s=t.headers,{maxTimeToFirstByteMs:n,maxLoadTimeMs:a}=i.loadPolicy;if(s)for(const o in s)e.setRequestHeader(o,s[o]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),i.timeout=n&&isFiniteNumber(n)?n:a,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:i}=this;if(!e||!t)return;const s=t.readyState,n=this.config;if(!i.aborted&&s>=2&&(i.loading.first===0&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),n.timeout!==n.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),n.timeout=n.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),s===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const u=t.status,f=t.responseType==="text"?t.responseText:null;if(u>=200&&u<300){const m=f??t.response;if(m!=null){var a,o;i.loading.end=Math.max(self.performance.now(),i.loading.first);const T=t.responseType==="arraybuffer"?m.byteLength:m.length;i.loaded=i.total=T,i.bwEstimate=i.total*8e3/(i.loading.end-i.loading.first);const S=(a=this.callbacks)==null?void 0:a.onProgress;S&&S(i,e,m,t);const b={url:t.responseURL,data:m,code:u};(o=this.callbacks)==null||o.onSuccess(b,i,e,t);return}}const d=n.loadPolicy.errorRetry,g=i.retry,E={url:e.url,data:void 0,code:u};if(shouldRetry(d,g,!1,E))this.retry(d);else{var c;logger.error(`${u} while loading ${e.url}`),(c=this.callbacks)==null||c.onError({code:u,text:t.statusText},e,t,i)}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(shouldRetry(e,t,!0))this.retry(e);else{var i;logger.warn(`timeout while loading ${(i=this.context)==null?void 0:i.url}`);const s=this.callbacks;s&&(this.abortInternal(),s.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:i}=this;this.retryDelay=getRetryDelay(e,i.retry),i.retry++,logger.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t?.url}, retrying ${i.retry}/${e.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(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&AGE_HEADER_LINE_REGEX.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}const defaultLoadPolicy={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},hlsDefaultConfig=_objectSpread2(_objectSpread2({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,startOnSegmentBoundary:!1,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncMode:"edge",liveSyncDurationCount:3,liveSyncOnStallIncrease:1,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,ignorePlaylistParsingErrors:!1,loader:XhrLoader,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:AbrController,bufferController:BufferController,capLevelController:CapLevelController,errorController:ErrorController,fpsController:FPSController,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:requestMediaKeySystemAccess,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,preserveManualLevelOnError:!1,certLoadPolicy:{default:defaultLoadPolicy},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}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,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},timelineConfig()),{},{subtitleStreamController:SubtitleStreamController,subtitleTrackController:SubtitleTrackController,timelineController:TimelineController,audioStreamController:AudioStreamController,audioTrackController:AudioTrackController,emeController:EMEController,cmcdController:CMCDController,contentSteeringController:ContentSteeringController,interstitialsController:InterstitialsController});function timelineConfig(){return{cueHandler:Cues,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function mergeConfig(r,e,t){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(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const i=deepCpy(r),s=["manifest","level","frag"],n=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return s.forEach(a=>{const o=`${a==="level"?"playlist":a}LoadPolicy`,c=e[o]===void 0,u=[];n.forEach(f=>{const d=`${a}Loading${f}`,g=e[d];if(g!==void 0&&c){u.push(d);const E=i[o].default;switch(e[o]={default:E},f){case"TimeOut":E.maxLoadTimeMs=g,E.maxTimeToFirstByteMs=g;break;case"MaxRetry":E.errorRetry.maxNumRetry=g,E.timeoutRetry.maxNumRetry=g;break;case"RetryDelay":E.errorRetry.retryDelayMs=g,E.timeoutRetry.retryDelayMs=g;break;case"MaxRetryTimeout":E.errorRetry.maxRetryDelayMs=g,E.timeoutRetry.maxRetryDelayMs=g;break}}}),u.length&&t.warn(`hls.js config: "${u.join('", "')}" setting(s) are deprecated, use "${o}": ${stringify(e[o])}`)}),_objectSpread2(_objectSpread2({},i),e)}function deepCpy(r){return r&&typeof r=="object"?Array.isArray(r)?r.map(deepCpy):Object.keys(r).reduce((e,t)=>(e[t]=deepCpy(r[t]),e),{}):r}function enableStreamingMode(r,e){const t=r.loader;t!==FetchLoader&&t!==XhrLoader?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),r.progressive=!1):fetchSupported()&&(r.loader=FetchLoader,r.progressive=!0,r.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}const MAX_START_GAP_JUMP=2,SKIP_BUFFER_HOLE_STEP_SECONDS=.1,SKIP_BUFFER_RANGE_START=.05,TICK_INTERVAL$1=100;class GapController extends TaskLoop{constructor(e,t){super("gap-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var i;(i=this.media)!=null&&i.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{if(this.hls){var i;this.ended=((i=this.media)==null?void 0:i.currentTime)||1,this.hls.trigger(Events.MEDIA_ENDED,{stalled:!1})}},this.hls=e,this.fragmentTracker=t,this.registerListeners()}registerListeners(){const{hls:e}=this;e&&(e.on(Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Events.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Events.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(e,t){this.setInterval(TICK_INTERVAL$1),this.mediaSource=t.mediaSource;const i=this.media=t.media;addEventListener(i,"playing",this.onMediaPlaying),addEventListener(i,"waiting",this.onMediaWaiting),addEventListener(i,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:i}=this;i&&(removeEventListener(i,"playing",this.onMediaPlaying),removeEventListener(i,"waiting",this.onMediaWaiting),removeEventListener(i,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,t){this.buffered=t.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var e;if(!((e=this.media)!=null&&e.readyState)||!this.hasBuffered)return;const t=this.media.currentTime;this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t}poll(e,t){var i,s;const n=(i=this.hls)==null?void 0:i.config;if(!n)return;const a=this.media;if(!a)return;const{seeking:o}=a,c=this.seeking&&!o,u=!this.seeking&&o,f=a.paused&&!o||a.ended||a.playbackRate===0;if(this.seeking=o,e!==t){t&&(this.ended=0),this.moved=!0,o||(this.nudgeRetry=0,n.nudgeOnVideoHole&&!f&&e>t&&this.nudgeOnVideoHole(e,t)),this.waiting===0&&this.stallResolved(e);return}if(u||c){c&&this.stallResolved(e);return}if(f){this.nudgeRetry=0,this.stallResolved(e),!this.ended&&a.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(Events.MEDIA_ENDED,{stalled:!1}));return}if(!BufferHelper.getBuffered(a).length){this.nudgeRetry=0;return}const d=BufferHelper.bufferInfo(a,e,0),g=d.nextStart||0,E=this.fragmentTracker;if(o&&E&&this.hls){const U=getInFlightDependency(this.hls.inFlightFragments,e),O=d.len>MAX_START_GAP_JUMP,F=!g||U||g-e>MAX_START_GAP_JUMP&&!E.getPartialFragment(e);if(O||F)return;this.moved=!1}const m=(s=this.hls)==null?void 0:s.latestLevelDetails;if(!this.moved&&this.stalled!==null&&E){if(!(d.len>0)&&!g)return;const O=Math.max(g,d.start||0)-e,G=!!(m!=null&&m.live)?m.targetduration*2:MAX_START_GAP_JUMP,x=appendedFragAtPosition(e,E);if(O>0&&(O<=G||x)){a.paused||this._trySkipBufferHole(x);return}}const T=n.detectStallWithCurrentTimeMs,S=self.performance.now(),b=this.waiting;let C=this.stalled;if(C===null)if(b>0&&S-b<T)C=this.stalled=b;else{this.stalled=S;return}const I=S-C;if(!o&&(I>=T||b)&&this.hls){var L;if(((L=this.mediaSource)==null?void 0:L.readyState)==="ended"&&!(m!=null&&m.live)&&Math.abs(e-(m?.edge||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(Events.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(d),!this.media||!this.hls)return}const k=BufferHelper.bufferInfo(a,e,n.maxBufferHole);this._tryFixBufferStall(k,I,e)}stallResolved(e){const t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){const i=self.performance.now()-t;this.log(`playback not stuck anymore @${e}, after ${Math.round(i)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(Events.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var i;const s=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(i=this.buffered.audio)!=null&&i.length&&s&&s.length>1&&e>s.end(0)){const n=BufferHelper.bufferedInfo(BufferHelper.timeRangesToArray(this.buffered.audio),e,0);if(n.len>1&&t>=n.start){const a=BufferHelper.timeRangesToArray(s),o=BufferHelper.bufferedInfo(a,t,0).bufferedIndex;if(o>-1&&o<a.length-1){const c=BufferHelper.bufferedInfo(a,e,0).bufferedIndex,u=a[o].end,f=a[o+1].start;if((c===-1||c>o)&&f-u<1&&e-u<2){const d=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${u} -> ${f} buffered index: ${c}`);this.warn(d.message),this.media.currentTime+=1e-6;let g=appendedFragAtPosition(e,this.fragmentTracker);g&&"fragment"in g?g=g.fragment:g||(g=void 0);const E=BufferHelper.bufferInfo(this.media,e,0);this.hls.trigger(Events.ERROR,{type:ErrorTypes.MEDIA_ERROR,details:ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:d,reason:d.message,frag:g,buffer:E.len,bufferInfo:E})}}}}}_tryFixBufferStall(e,t,i){var s,n;const{fragmentTracker:a,media:o}=this,c=(s=this.hls)==null?void 0:s.config;if(!o||!a||!c)return;const u=(n=this.hls)==null?void 0:n.latestLevelDetails,f=appendedFragAtPosition(i,a);if((f||u!=null&&u.live&&i<u.fragmentStart)&&(this._trySkipBufferHole(f)||!this.media))return;const d=e.buffered,g=this.adjacentTraversal(e,i);(d&&d.length>1&&e.len>c.maxBufferHole||e.nextStart&&(e.nextStart-i<c.maxBufferHole||g))&&(t>c.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,t){const i=this.fragmentTracker,s=e.nextStart;if(i&&s){const n=i.getFragAtPos(t,PlaylistLevelType.MAIN),a=i.getFragAtPos(s,PlaylistLevelType.MAIN);if(n&&a)return a.sn-n.sn<2}return!1}_reportStall(e){const{hls:t,media:i,stallReported:s,stalled:n}=this;if(!s&&n!==null&&i&&t){this.stallReported=!0;const a=new Error(`Playback stalling at @${i.currentTime} due to low buffer (${stringify(e)})`);this.warn(a.message),t.trigger(Events.ERROR,{type:ErrorTypes.MEDIA_ERROR,details:ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,error:a,buffer:e.len,bufferInfo:e,stalled:{start:n}})}}_trySkipBufferHole(e){var t;const{fragmentTracker:i,media:s}=this,n=(t=this.hls)==null?void 0:t.config;if(!s||!i||!n)return 0;const a=s.currentTime,o=BufferHelper.bufferInfo(s,a,0),c=a<o.start?o.start:o.nextStart;if(c&&this.hls){const f=o.len<=n.maxBufferHole,d=o.len>0&&o.len<1&&s.readyState<3,g=c-a;if(g>0&&(f||d)){if(g>n.maxBufferHole){let m=!1;if(a===0){const T=i.getAppendedFrag(0,PlaylistLevelType.MAIN);T&&c<T.end&&(m=!0)}if(!m&&e){var u;if(!((u=this.hls.loadLevelObj)!=null&&u.details)||getInFlightDependency(this.hls.inFlightFragments,c))return 0;let S=!1,b=e.end;for(;b<c;){const C=appendedFragAtPosition(b,i);if(C)b+=C.duration;else{S=!0;break}}if(S)return 0}}const E=Math.max(c+SKIP_BUFFER_RANGE_START,a+SKIP_BUFFER_HOLE_STEP_SECONDS);if(this.warn(`skipping hole, adjusting currentTime from ${a} to ${E}`),this.moved=!0,s.currentTime=E,!(e!=null&&e.gap)){const m=new Error(`fragment loaded with buffer holes, seeking from ${a} to ${E}`),T={type:ErrorTypes.MEDIA_ERROR,details:ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:m,reason:m.message,buffer:o.len,bufferInfo:o};e&&("fragment"in e?T.part=e:T.frag=e),this.hls.trigger(Events.ERROR,T)}return E}}return 0}_tryNudgeBuffer(e){const{hls:t,media:i,nudgeRetry:s}=this,n=t?.config;if(!i||!n)return 0;const a=i.currentTime;if(this.nudgeRetry++,s<n.nudgeMaxRetry){const o=a+(s+1)*n.nudgeOffset,c=new Error(`Nudging 'currentTime' from ${a} to ${o}`);this.warn(c.message),i.currentTime=o,t.trigger(Events.ERROR,{type:ErrorTypes.MEDIA_ERROR,details:ErrorDetails.BUFFER_NUDGE_ON_STALL,error:c,fatal:!1,buffer:e.len,bufferInfo:e})}else{const o=new Error(`Playhead still not moving while enough data buffered @${a} after ${n.nudgeMaxRetry} nudges`);this.error(o.message),t.trigger(Events.ERROR,{type:ErrorTypes.MEDIA_ERROR,details:ErrorDetails.BUFFER_STALLED_ERROR,error:o,fatal:!0,buffer:e.len,bufferInfo:e})}}}function getInFlightDependency(r,e){const t=inFlight(r.main);if(t&&t.start<=e)return t;const i=inFlight(r.audio);return i&&i.start<=e?i:null}function inFlight(r){if(!r)return null;switch(r.state){case State.IDLE:case State.STOPPED:case State.ENDED:case State.ERROR:return null}return r.frag}function appendedFragAtPosition(r,e){return e.getAppendedFrag(r,PlaylistLevelType.MAIN)||e.getPartialFragment(r)}const MIN_CUE_DURATION=.25;function getCueClass(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function createCueWithDataFields(r,e,t,i,s){let n=new r(e,t,"");try{n.value=i,s&&(n.type=s)}catch{n=new r(e,t,stringify(s?_objectSpread2({type:s},i):i))}return n}const MAX_CUE_ENDTIME=(()=>{const r=getCueClass();try{r&&new r(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class ID3TrackController{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.assetCue=void 0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(Events.EVENT_CUE_ENTER,{})},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){const{hls:e}=this;e&&(e.on(Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(Events.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(Events.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(e,t){var i;this.media=t.media,((i=t.overrides)==null?void 0:i.cueRemoval)===!1&&(this.removeCues=!1)}onMediaAttached(){var e;const t=(e=this.hls)==null?void 0:e.latestLevelDetails;t&&this.updateDateRangeCues(t)}onMediaDetaching(e,t){this.media=null,!t.transferMedia&&(this.id3Track&&(this.removeCues&&clearCurrentCues(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;t<e.length;t++){const i=e[t];if(i.kind==="metadata"&&i.label==="id3")return sendAddTrackEvent(i,this.media),i}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media||!this.hls)return;const{enableEmsgMetadataCues:i,enableID3MetadataCues:s}=this.hls.config;if(!i&&!s)return;const{samples:n}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const a=getCueClass();if(a)for(let o=0;o<n.length;o++){const c=n[o].type;if(c===MetadataSchema.emsg&&!i||!s)continue;const u=getId3Frames(n[o].data),f=n[o].pts;let d=f+n[o].duration;d>MAX_CUE_ENDTIME&&(d=MAX_CUE_ENDTIME),d-f<=0&&(d=f+MIN_CUE_DURATION);for(let E=0;E<u.length;E++){const m=u[E];if(!isId3TimestampFrame(m)){this.updateId3CueEnds(f,c);const T=createCueWithDataFields(a,f,d,m,c);T&&this.id3Track.addCue(T)}}}}updateId3CueEnds(e,t){var i;const s=(i=this.id3Track)==null?void 0:i.cues;if(s)for(let n=s.length;n--;){const a=s[n];a.type===t&&a.startTime<e&&a.endTime===MAX_CUE_ENDTIME&&(a.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:i,type:s}){const{id3Track:n,hls:a}=this;if(!a)return;const{config:{enableEmsgMetadataCues:o,enableID3MetadataCues:c}}=a;if(n&&(o||c)){let u;s==="audio"?u=f=>f.type===MetadataSchema.audioId3&&c:s==="video"?u=f=>f.type===MetadataSchema.emsg&&o:u=f=>f.type===MetadataSchema.audioId3&&c||f.type===MetadataSchema.emsg&&o,removeCuesInRange(n,t,i,u)}}onLevelUpdated(e,{details:t}){this.updateDateRangeCues(t,!0)}onLevelPtsUpdated(e,t){Math.abs(t.drift)>.01&&this.updateDateRangeCues(t.details)}updateDateRangeCues(e,t){if(!this.hls||!this.media)return;const{assetPlayerId:i,timelineOffset:s,enableDateRangeMetadataCues:n,interstitialsController:a}=this.hls.config;if(!n)return;const o=getCueClass();if(i&&s&&!a){const{fragmentStart:T,fragmentEnd:S}=e;let b=this.assetCue;b?(b.startTime=T,b.endTime=S):o&&(b=this.assetCue=createCueWithDataFields(o,T,S,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),b&&(b.id=i,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.addCue(b),b.addEventListener("enter",this.onEventCueEnter)))}if(!e.hasProgramDateTime)return;const{id3Track:c}=this,{dateRanges:u}=e,f=Object.keys(u);let d=this.dateRangeCuesAppended;if(c&&t){var g;if((g=c.cues)!=null&&g.length){const T=Object.keys(d).filter(S=>!f.includes(S));for(let S=T.length;S--;){var E;const b=T[S],C=(E=d[b])==null?void 0:E.cues;delete d[b],C&&Object.keys(C).forEach(I=>{const L=C[I];if(L){L.removeEventListener("enter",this.onEventCueEnter);try{c.removeCue(L)}catch{}}})}}else d=this.dateRangeCuesAppended={}}const m=e.fragments[e.fragments.length-1];if(!(f.length===0||!isFiniteNumber(m?.programDateTime))){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let T=0;T<f.length;T++){const S=f[T],b=u[S],C=b.startTime,I=d[S],L=I?.cues||{};let k=I?.durationKnown||!1,U=MAX_CUE_ENDTIME;const{duration:O,endDate:F}=b;if(F&&O!==null)U=C+O,k=!0;else if(b.endOnNext&&!k){const x=f.reduce(($,X)=>{if(X!==b.id){const Q=u[X];if(Q.class===b.class&&Q.startDate>b.startDate&&(!$||b.startDate<$.startDate))return Q}return $},null);x&&(U=x.startTime,k=!0)}const G=Object.keys(b.attr);for(let x=0;x<G.length;x++){const $=G[x];if(!isDateRangeCueAttribute($))continue;const X=L[$];if(X)k&&!(I!=null&&I.durationKnown)?X.endTime=U:Math.abs(X.startTime-C)>.01&&(X.startTime=C,X.endTime=U);else if(o){let Q=b.attr[$];isSCTE35Attribute($)&&(Q=hexToArrayBuffer(Q));const te=createCueWithDataFields(o,C,U,{key:$,data:Q},MetadataSchema.dateRange);te&&(te.id=S,this.id3Track.addCue(te),L[$]=te,a&&($==="X-ASSET-LIST"||$==="X-ASSET-URL")&&te.addEventListener("enter",this.onEventCueEnter))}}d[S]={cues:L,dateRange:b,durationKnown:k}}}}}class LatencyController{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=()=>{const{media:t}=this,i=this.levelDetails;if(!t||!i)return;this.currentTime=t.currentTime;const s=this.computeLatency();if(s===null)return;this._latency=s;const{lowLatencyMode:n,maxLiveSyncPlaybackRate:a}=this.config;if(!n||a===1||!i.live)return;const o=this.targetLatency;if(o===null)return;const c=s-o,u=Math.min(this.maxLatency,o+i.targetduration);if(c<u&&c>.05&&this.forwardBufferLength>1){const d=Math.min(2,Math.max(1,a)),g=Math.round(2/(1+Math.exp(-.75*c-this.edgeStalled))*20)/20,E=Math.min(d,Math.max(1,g));this.changeMediaPlaybackRate(t,E)}else t.playbackRate!==1&&t.playbackRate!==0&&this.changeMediaPlaybackRate(t,1)},this.hls=e,this.config=e.config,this.registerListeners()}get levelDetails(){var e;return((e=this.hls)==null?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){const{config:e}=this;if(e.liveMaxLatencyDuration!==void 0)return e.liveMaxLatencyDuration;const t=this.levelDetails;return t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const e=this.levelDetails;if(e===null||this.hls===null)return null;const{holdBack:t,partHoldBack:i,targetduration:s}=e,{liveSyncDuration:n,liveSyncDurationCount:a,lowLatencyMode:o}=this.config,c=this.hls.userConfig;let u=o&&i||t;(this._targetLatencyUpdated||c.liveSyncDuration||c.liveSyncDurationCount||u===0)&&(u=n!==void 0?n:a*s);const f=s;return u+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,f)}set targetLatency(e){this.stallCount=0,this.config.liveSyncDuration=e,this._targetLatencyUpdated=!0}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency;if(e===null||t===null)return null;const i=this.levelDetails;if(i===null)return null;const s=i.edge,n=e-t-this.edgeStalled,a=s-i.totalduration,o=s-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(a,n),o)}get drift(){const e=this.levelDetails;return e===null?1:e.drift}get edgeStalled(){const e=this.levelDetails;if(e===null)return 0;const t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e}=this,t=this.levelDetails;if(!e||!t)return 0;const i=e.buffered.length;return(i?e.buffered.end(i-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:e}=this;e&&(e.on(Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(Events.ERROR,this.onError,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(Events.ERROR,this.onError,this))}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.onTimeupdate)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){t.advanced&&this.onTimeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onError(e,t){var i;t.details===ErrorDetails.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(i=this.levelDetails)!=null&&i.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(e,t){var i,s;e.playbackRate!==t&&((i=this.hls)==null||i.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${(s=this.targetLatency)==null?void 0:s.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${e.playbackRate} to ${t}`),e.playbackRate=t)}estimateLiveEdge(){const e=this.levelDetails;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}class LevelController extends BasePlaylistController{constructor(e,t){super(e,"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=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(Events.LEVEL_LOADED,this.onLevelLoaded,this),e.on(Events.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(Events.FRAG_BUFFERED,this.onFragBuffered,this),e.on(Events.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(Events.LEVEL_LOADED,this.onLevelLoaded,this),e.off(Events.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(Events.FRAG_BUFFERED,this.onFragBuffered,this),e.off(Events.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(e,t){this.resetLevels()}onManifestLoaded(e,t){const i=this.hls.config.preferManagedMediaSource,s=[],n={},a={};let o=!1,c=!1,u=!1;t.levels.forEach(f=>{const d=f.attrs;let{audioCodec:g,videoCodec:E}=f;g&&(f.audioCodec=g=getCodecCompatibleName(g,i)||void 0),E&&(E=f.videoCodec=convertAVC1ToAVCOTI(E));const{width:m,height:T,unknownCodecs:S}=f,b=S?.length||0;if(o||(o=!!(m&&T)),c||(c=!!E),u||(u=!!g),b||g&&!this.isAudioSupported(g)||E&&!this.isVideoSupported(E)){this.log(`Some or all CODECS not supported "${d.CODECS}"`);return}const{CODECS:C,"FRAME-RATE":I,"HDCP-LEVEL":L,"PATHWAY-ID":k,RESOLUTION:U,"VIDEO-RANGE":O}=d,G=`${`${k||"."}-`}${f.bitrate}-${U}-${I}-${C}-${O}-${L}`;if(n[G])if(n[G].uri!==f.url&&!f.attrs["PATHWAY-ID"]){const x=a[G]+=1;f.attrs["PATHWAY-ID"]=new Array(x+1).join(".");const $=this.createLevel(f);n[G]=$,s.push($)}else n[G].addGroupId("audio",d.AUDIO),n[G].addGroupId("text",d.SUBTITLES);else{const x=this.createLevel(f);n[G]=x,a[G]=1,s.push(x)}}),this.filterAndSortMediaOptions(s,t,o,c,u)}createLevel(e){const t=new Level(e),i=e.supplemental;if(i!=null&&i.videoCodec&&!this.isVideoSupported(i.videoCodec)){const s=new Error(`SUPPLEMENTAL-CODECS not supported "${i.videoCodec}"`);this.log(s.message),t.supportedResult=getUnsupportedResult(s,[])}return t}isAudioSupported(e){return areCodecsMediaSourceSupported(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return areCodecsMediaSourceSupported(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,i,s,n){var a;let o=[],c=[],u=e;const f=((a=t.stats)==null?void 0:a.parsing)||{};if((i||s)&&n&&(u=u.filter(({videoCodec:C,videoRange:I,width:L,height:k})=>(!!C||!!(L&&k))&&isVideoRange(I))),u.length===0){Promise.resolve().then(()=>{if(this.hls){let C="no level with compatible codecs found in manifest",I=C;t.levels.length&&(I=`one or more CODECS in variant not supported: ${stringify(t.levels.map(k=>k.attrs.CODECS).filter((k,U,O)=>O.indexOf(k)===U))}`,this.warn(I),C+=` (${I})`);const L=new Error(C);this.hls.trigger(Events.ERROR,{type:ErrorTypes.MEDIA_ERROR,details:ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:L,reason:I})}}),f.end=performance.now();return}t.audioTracks&&(o=t.audioTracks.filter(C=>!C.audioCodec||this.isAudioSupported(C.audioCodec)),assignTrackIdsByGroup(o)),t.subtitles&&(c=t.subtitles,assignTrackIdsByGroup(c));const d=u.slice(0);u.sort((C,I)=>{if(C.attrs["HDCP-LEVEL"]!==I.attrs["HDCP-LEVEL"])return(C.attrs["HDCP-LEVEL"]||"")>(I.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&C.height!==I.height)return C.height-I.height;if(C.frameRate!==I.frameRate)return C.frameRate-I.frameRate;if(C.videoRange!==I.videoRange)return VideoRangeValues.indexOf(C.videoRange)-VideoRangeValues.indexOf(I.videoRange);if(C.videoCodec!==I.videoCodec){const L=videoCodecPreferenceValue(C.videoCodec),k=videoCodecPreferenceValue(I.videoCodec);if(L!==k)return k-L}if(C.uri===I.uri&&C.codecSet!==I.codecSet){const L=codecsSetSelectionPreferenceValue(C.codecSet),k=codecsSetSelectionPreferenceValue(I.codecSet);if(L!==k)return k-L}return C.averageBitrate!==I.averageBitrate?C.averageBitrate-I.averageBitrate:0});let g=d[0];if(this.steering&&(u=this.steering.filterParsedLevels(u),u.length!==d.length)){for(let C=0;C<d.length;C++)if(d[C].pathwayId===u[0].pathwayId){g=d[C];break}}this._levels=u;for(let C=0;C<u.length;C++)if(u[C]===g){var E;this._firstLevel=C;const I=g.bitrate,L=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${u.length} level(s) found, first bitrate: ${I}`),((E=this.hls.userConfig)==null?void 0:E.abrEwmaDefaultEstimate)===void 0){const k=Math.min(I,this.hls.config.abrEwmaDefaultEstimateMax);k>L&&L===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=k)}break}const m=n&&!s,T=this.hls.config,S=!!(T.audioStreamController&&T.audioTrackController),b={levels:u,audioTracks:o,subtitleTracks:c,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:n,video:s,altAudio:S&&!m&&o.some(C=>!!C.url)};f.end=performance.now(),this.hls.trigger(Events.MANIFEST_PARSED,b)}get levels(){return this._levels.length===0?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const f=new Error("invalid level idx"),d=e<0;if(this.hls.trigger(Events.ERROR,{type:ErrorTypes.OTHER_ERROR,details:ErrorDetails.LEVEL_SWITCH_ERROR,level:e,fatal:d,error:f,reason:f.message}),d)return;e=Math.min(e,t.length-1)}const i=this.currentLevelIndex,s=this.currentLevel,n=s?s.attrs["PATHWAY-ID"]:void 0,a=t[e],o=a.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=a,i===e&&s&&n===o)return;this.log(`Switching to level ${e} (${a.height?a.height+"p ":""}${a.videoRange?a.videoRange+" ":""}${a.codecSet?a.codecSet+" ":""}@${a.bitrate})${o?" with Pathway "+o:""} from level ${i}${n?" with Pathway "+n:""}`);const c={level:e,attrs:a.attrs,details:a.details,bitrate:a.bitrate,averageBitrate:a.averageBitrate,maxBitrate:a.maxBitrate,realBitrate:a.realBitrate,width:a.width,height:a.height,codecSet:a.codecSet,audioCodec:a.audioCodec,videoCodec:a.videoCodec,audioGroups:a.audioGroups,subtitleGroups:a.subtitleGroups,loaded:a.loaded,loadError:a.loadError,fragmentError:a.fragmentError,name:a.name,id:a.id,uri:a.uri,url:a.url,urlId:0,audioGroupIds:a.audioGroupIds,textGroupIds:a.textGroupIds};this.hls.trigger(Events.LEVEL_SWITCHING,c);const u=a.details;if(!u||u.live){const f=this.switchParams(a.uri,s?.details,u);this.loadPlaylist(f)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){const t=this.steering.pathways(),i=e.filter(s=>t.indexOf(s)!==-1);if(e.length<1){this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${t}`);return}this.steering.pathwayPriority=i}}onError(e,t){t.fatal||!t.context||t.context.type===PlaylistContextType.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===PlaylistLevelType.MAIN){const i=t.elementaryStreams;if(!Object.keys(i).some(n=>!!i[n]))return;const s=this._levels[t.level];s!=null&&s.loadError&&(this.log(`Resetting level error count of ${s.loadError} on frag buffered`),s.loadError=0)}}onLevelLoaded(e,t){var i;const{level:s,details:n}=t,a=t.levelInfo;if(!a){var o;this.warn(`Invalid level index ${s}`),(o=t.deliveryDirectives)!=null&&o.skip&&(n.deltaUpdateFailed=!0);return}if(a===this.currentLevel||t.withoutMultiVariant){a.fragmentError===0&&(a.loadError=0);let c=a.details;c===t.details&&c.advanced&&(c=void 0),this.playlistLoaded(s,t,c)}else(i=t.deliveryDirectives)!=null&&i.skip&&(n.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=this.getUrlWithDirectives(e.uri,t),s=this.currentLevelIndex,n=e.attrs["PATHWAY-ID"],a=e.details,o=a?.age;this.log(`Loading level index ${s}${t?.msn!==void 0?" at sn "+t.msn+" part "+t.part:""}${n?" Pathway "+n:""}${o&&a.live?" age "+o.toFixed(1)+(a.type&&" "+a.type||""):""} ${i}`),this.hls.trigger(Events.LEVEL_LOADING,{url:i,level:s,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;if(this._levels.length===1)return;const i=this._levels.filter((n,a)=>a!==e?!0:(this.steering&&this.steering.removeLevel(n),n===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,n.details&&n.details.fragments.forEach(o=>o.level=-1)),!1));reassignFragmentLevelIndexes(i),this._levels=i,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const s=i.length-1;this._firstLevel=Math.min(this._firstLevel,s),this._startLevel&&(this._startLevel=Math.min(this._startLevel,s)),this.hls.trigger(Events.LEVELS_UPDATED,{levels:i})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:i}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(Events.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}}function assignTrackIdsByGroup(r){const e={};r.forEach(t=>{const i=t.groupId||"";t.id=e[i]=e[i]||0,e[i]++})}function getSourceBuffer(){return self.SourceBuffer||self.WebKitSourceBuffer}function isMSESupported(){if(!getMediaSource())return!1;const e=getSourceBuffer();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function isSupported(){if(!isMSESupported())return!1;const r=getMediaSource();return typeof r?.isTypeSupported=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>r.isTypeSupported(mimeTypeForCodec(e,"video")))||["mp4a.40.2","fLaC"].some(e=>r.isTypeSupported(mimeTypeForCodec(e,"audio"))))}function changeTypeSupported(){var r;const e=getSourceBuffer();return typeof(e==null||(r=e.prototype)==null?void 0:r.changeType)=="function"}const TICK_INTERVAL=100;class StreamController extends BaseStreamController{constructor(e,t,i){super(e,t,i,"stream-controller",PlaylistLevelType.MAIN),this.audioCodecSwap=!1,this.level=-1,this._forceStartLoad=!1,this._hasEnoughToStart=!1,this.altAudio=0,this.audioOnly=!1,this.fragPlaying=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this.onMediaPlaying=()=>{this.tick()},this.onMediaSeeked=()=>{const s=this.media,n=s?s.currentTime:null;if(n===null||!isFiniteNumber(n)||(this.log(`Media seeked to ${n.toFixed(3)}`),!this.getBufferedFrag(n)))return;const a=this.getFwdBufferInfoAtPos(s,n,PlaylistLevelType.MAIN,0);if(a===null||a.len===0){this.warn(`Main forward buffer length at ${n} on "seeked" event ${a?a.len:"empty"})`);return}this.tick()},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(Events.LEVEL_LOADED,this.onLevelLoaded,this),e.on(Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(Events.BUFFER_CREATED,this.onBufferCreated,this),e.on(Events.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(Events.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(Events.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Events.LEVEL_LOADED,this.onLevelLoaded,this),e.off(Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(Events.BUFFER_CREATED,this.onBufferCreated,this),e.off(Events.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(Events.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(Events.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(e,t){if(this.levels){const{lastCurrentTime:i,hls:s}=this;if(this.stopLoad(),this.setInterval(TICK_INTERVAL),this.level=-1,!this.startFragRequested){let n=s.startLevel;n===-1&&(s.config.testBandwidth&&this.levels.length>1?(n=0,this.bitrateTest=!0):n=s.firstAutoLevel),s.nextLoadLevel=n,this.level=s.loadLevel,this._hasEnoughToStart=!!t}i>0&&e===-1&&!t&&(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i),this.state=State.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=State.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case State.WAITING_LEVEL:{const{levels:e,level:t}=this,i=e?.[t],s=i?.details;if(s&&(!s.live||this.levelLastLoaded===i&&!this.waitForLive(i))){if(this.waitForCdnTuneIn(s))break;this.state=State.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=State.IDLE;break}break}case State.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break}this.state===State.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),(e=this.media)!=null&&e.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:i,media:s}=this;if(t===null||!s&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const n=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(i!=null&&i[n]))return;const a=i[n],o=this.getMainFwdBufferInfo();if(o===null)return;const c=this.getLevelDetails();if(c&&this._streamEnded(o,c)){const T={};this.altAudio===2&&(T.type="video"),this.hls.trigger(Events.BUFFER_EOS,T),this.state=State.ENDED;return}if(!this.buffering)return;e.loadLevel!==n&&e.manualLevel===-1&&this.log(`Adapting to level ${n} from level ${this.level}`),this.level=e.nextLoadLevel=n;const u=a.details;if(!u||this.state===State.WAITING_LEVEL||this.waitForLive(a)){this.level=n,this.state=State.WAITING_LEVEL,this.startFragRequested=!1;return}const f=o.len,d=this.getMaxBufferLength(a.maxBitrate);if(f>=d)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);const g=this.backtrackFragment?this.backtrackFragment.start:o.end;let E=this.getNextFragment(g,u);if(this.couldBacktrack&&!this.fragPrevious&&E&&isMediaFragment(E)&&this.fragmentTracker.getState(E)!==FragmentState.OK){var m;const S=((m=this.backtrackFragment)!=null?m:E).sn-u.startSN,b=u.fragments[S-1];b&&E.cc===b.cc&&(E=b,this.fragmentTracker.removeFragment(b))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(E&&this.isLoopLoading(E,g)){if(!E.gap){const S=this.audioOnly&&!this.altAudio?ElementaryStreamTypes.AUDIO:ElementaryStreamTypes.VIDEO,b=(S===ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;b&&this.afterBufferFlushed(b,S,PlaylistLevelType.MAIN)}E=this.getNextFragmentLoopLoading(E,u,o,PlaylistLevelType.MAIN,d)}E&&(E.initSegment&&!E.initSegment.data&&!this.bitrateTest&&(E=E.initSegment),this.loadFragment(E,a,g))}loadFragment(e,t,i){const s=this.fragmentTracker.getState(e);s===FragmentState.NOT_LOADED||s===FragmentState.PARTIAL?isMediaFragment(e)?this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):super.loadFragment(e,t,i):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,PlaylistLevelType.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(t!=null&&t.readyState){let i;const s=this.getAppendedFrag(t.currentTime);s&&s.start>1&&this.flushMainBuffer(0,s.start-1);const n=this.getLevelDetails();if(n!=null&&n.live){const o=this.getMainFwdBufferInfo();if(!o||o.len<n.targetduration*2)return}if(!t.paused&&e){const o=this.hls.nextLoadLevel,c=e[o],u=this.fragLastKbps;u&&this.fragCurrent?i=this.fragCurrent.duration*c.maxBitrate/(1e3*u)+1:i=0}else i=0;const a=this.getBufferedFrag(t.currentTime+i);if(a){const o=this.followingBufferedFrag(a);if(o){this.abortCurrentFrag();const c=o.maxStartPTS?o.maxStartPTS:o.start,u=o.duration,f=Math.max(a.end,c+Math.min(Math.max(u-this.config.maxFragLookUpTolerance,u*(this.couldBacktrack?.5:.125)),u*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(f,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case State.KEY_LOADING:case State.FRAG_LOADING:case State.FRAG_LOADING_WAITING_RETRY:case State.PARSING:case State.PARSED:this.state=State.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio===2?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const i=t.media;addEventListener(i,"playing",this.onMediaPlaying),addEventListener(i,"seeked",this.onMediaSeeked)}onMediaDetaching(e,t){const{media:i}=this;i&&(removeEventListener(i,"playing",this.onMediaPlaying),removeEventListener(i,"seeked",this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,super.onMediaDetaching(e,t),!t.transferMedia&&(this._hasEnoughToStart=!1)}onManifestLoading(){super.onManifestLoading(),this.log("Trigger BUFFER_RESET"),this.hls.trigger(Events.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1}onManifestParsed(e,t){let i=!1,s=!1;for(let n=0;n<t.levels.length;n++){const a=t.levels[n].audioCodec;a&&(i=i||a.indexOf("mp4a.40.2")!==-1,s=s||a.indexOf("mp4a.40.5")!==-1)}this.audioCodecSwitch=i&&s&&!changeTypeSupported(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:i}=this;if(!i||this.state!==State.IDLE)return;const s=t.levelInfo;(!s.details||s.details.live&&(this.levelLastLoaded!==s||s.details.expired)||this.waitForCdnTuneIn(s.details))&&(this.state=State.WAITING_LEVEL)}onLevelLoaded(e,t){var i;const{levels:s,startFragRequested:n}=this,a=t.level,o=t.details,c=o.totalduration;if(!s){this.warn(`Levels were reset while loading level ${a}`);return}this.log(`Level ${a} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""}, cc [${o.startCC}, ${o.endCC}] duration:${c}`);const u=t.levelInfo,f=this.fragCurrent;f&&(this.state===State.FRAG_LOADING||this.state===State.FRAG_LOADING_WAITING_RETRY)&&f.level!==t.level&&f.loader&&this.abortCurrentFrag();let d=0;if(o.live||(i=u.details)!=null&&i.live){var g;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;d=this.alignPlaylists(o,u.details,(g=this.levelLastLoaded)==null?void 0:g.details)}if(u.details=o,this.levelLastLoaded=u,n||this.setStartPosition(o,d),this.hls.trigger(Events.LEVEL_UPDATED,{details:o,level:a}),this.state===State.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=State.IDLE}n&&o.live&&this.synchronizeToLiveEdge(o),this.tick()}synchronizeToLiveEdge(e){const{config:t,media:i}=this;if(!i)return;const s=this.hls.liveSyncPosition,n=this.getLoadPosition(),a=e.fragmentStart,o=e.edge,c=n>=a-t.maxFragLookUpTolerance&&n<=o;if(s!==null&&i.duration>s&&(n<s||!c)){const f=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;if((!c&&i.readyState<4||n<o-f)&&(this._hasEnoughToStart||(this.nextLoadPosition=s),i.readyState))if(this.warn(`Playback: ${n.toFixed(3)} is located too far from the end of live sliding playlist: ${o}, reset currentTime to : ${s.toFixed(3)}`),this.config.liveSyncMode==="buffered"){var u;const d=BufferHelper.bufferInfo(i,s,0);if(!((u=d.buffered)!=null&&u.length)){i.currentTime=s;return}if(d.start<=n){i.currentTime=s;return}const{nextStart:E}=BufferHelper.bufferedInfo(d.buffered,n,0);E&&(i.currentTime=E)}else i.currentTime=s}}_handleFragmentLoadProgress(e){var t;const i=e.frag,{part:s,payload:n}=e,{levels:a}=this;if(!a){this.warn(`Levels were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const o=a[i.level];if(!o){this.warn(`Level ${i.level} not found on progress`);return}const c=o.details;if(!c){this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),this.fragmentTracker.removeFragment(i);return}const u=o.videoCodec,f=c.PTSKnown||!c.live,d=(t=i.initSegment)==null?void 0:t.data,g=this._getAudioCodec(o),E=this.transmuxer=this.transmuxer||new TransmuxerInterface(this.hls,PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),m=s?s.index:-1,T=m!==-1,S=new ChunkMetadata(i.level,i.sn,i.stats.chunkCount,n.byteLength,m,T),b=this.initPTS[i.cc];E.push(n,d,g,u,i,s,c.totalduration,f,S,b)}onAudioTrackSwitching(e,t){const i=this.hls,s=this.altAudio!==0;if(useAlternateAudio(t.url,i))this.altAudio=1;else{if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const a=this.fragCurrent;a&&(this.log("Switching to main audio track, cancel main fragment load"),a.abortRequests(),this.fragmentTracker.removeFragment(a)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(s){this.altAudio=0,this.fragmentTracker.removeAllFragments(),i.once(Events.BUFFER_FLUSHED,()=>{this.hls&&this.hls.trigger(Events.AUDIO_TRACK_SWITCHED,t)}),i.trigger(Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}i.trigger(Events.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const i=useAlternateAudio(t.url,this.hls);if(i){const s=this.videoBuffer;s&&this.mediaBuffer!==s&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=s)}this.altAudio=i?2:0,this.tick()}onBufferCreated(e,t){const i=t.tracks;let s,n,a=!1;for(const o in i){const c=i[o];if(c.id==="main"){if(n=o,s=c,o==="video"){const u=i[o];u&&(this.videoBuffer=u.buffer)}}else a=!0}a&&s?(this.log(`Alternate track found, use ${n}.buffered to schedule main fragment loading`),this.mediaBuffer=s.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:i,part:s}=t,n=i.type===PlaylistLevelType.MAIN;if(n){if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${s?" p: "+s.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}`),this.state===State.PARSED&&(this.state=State.IDLE);return}const o=s?s.stats:i.stats;this.fragLastKbps=Math.round(8*o.total/(o.buffering.end-o.loading.first)),isMediaFragment(i)&&(this.fragPrevious=i),this.fragBufferedComplete(i,s)}const a=this.media;a&&(!this._hasEnoughToStart&&BufferHelper.getBuffered(a).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),n&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){var i;if(t.fatal){this.state=State.ERROR;return}switch(t.details){case ErrorDetails.FRAG_GAP:case ErrorDetails.FRAG_PARSING_ERROR:case ErrorDetails.FRAG_DECRYPT_ERROR:case ErrorDetails.FRAG_LOAD_ERROR:case ErrorDetails.FRAG_LOAD_TIMEOUT:case ErrorDetails.KEY_LOAD_ERROR:case ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(PlaylistLevelType.MAIN,t);break;case ErrorDetails.LEVEL_LOAD_ERROR:case ErrorDetails.LEVEL_LOAD_TIMEOUT:case ErrorDetails.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===State.WAITING_LEVEL&&((i=t.context)==null?void 0:i.type)===PlaylistContextType.LEVEL&&(this.state=State.IDLE);break;case ErrorDetails.BUFFER_ADD_CODEC_ERROR:case ErrorDetails.BUFFER_APPEND_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case ErrorDetails.BUFFER_FULL_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&(!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,Number.POSITIVE_INFINITY));break;case ErrorDetails.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=State.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==ElementaryStreamTypes.AUDIO||!this.altAudio){const i=(t===ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;i&&(this.afterBufferFlushed(i,t,PlaylistLevelType.MAIN),this.tick())}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let i=this.startPosition;if(i>=0&&t<i){if(e.seeking){this.log(`could not seek to ${i}, already seeking at ${t}`);return}const s=this.timelineOffset;s&&i&&(i+=s);const n=this.getLevelDetails(),a=BufferHelper.getBuffered(e),o=a.length?a.start(0):0,c=o-i,u=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||c>0&&(c<u||this.loadingParts&&c<2*(n?.partTarget||0)))&&(this.log(`adjusting start position by ${c} to match buffer start`),i+=c,this.startPosition=i),t<i&&(this.log(`seek to target start position ${i} from current time ${t} buffer start ${o}`),e.currentTime=i)}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(i=>{const{hls:s}=this,n=i?.frag;if(!n||this.fragContextChanged(n))return;t.fragmentError=0,this.state=State.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const a=n.stats;a.parsing.start=a.parsing.end=a.buffering.start=a.buffering.end=self.performance.now(),s.trigger(Events.FRAG_LOADED,i),n.bitrateTest=!1}).catch(i=>{this.state===State.STOPPED||this.state===State.ERROR||(this.warn(i),this.resetFragmentLoading(e))})}_handleTransmuxComplete(e){const t=this.playlistType,{hls:i}=this,{remuxResult:s,chunkMeta:n}=e,a=this.getCurrentContext(n);if(!a){this.resetWhenMissingContext(n);return}const{frag:o,part:c,level:u}=a,{video:f,text:d,id3:g,initSegment:E}=s,{details:m}=u,T=this.altAudio?void 0:s.audio;if(this.fragContextChanged(o)){this.fragmentTracker.removeFragment(o);return}if(this.state=State.PARSING,E){const S=E.tracks;if(S){const L=o.initSegment||o;if(this.unhandledEncryptionError(E,o))return;this._bufferInitSegment(u,S,L,n),i.trigger(Events.FRAG_PARSING_INIT_SEGMENT,{frag:L,id:t,tracks:S})}const b=E.initPTS,C=E.timescale,I=this.initPTS[o.cc];if(isFiniteNumber(b)&&(!I||I.baseTime!==b||I.timescale!==C)){const L=E.trackId;this.initPTS[o.cc]={baseTime:b,timescale:C,trackId:L},i.trigger(Events.INIT_PTS_FOUND,{frag:o,id:t,initPTS:b,timescale:C,trackId:L})}}if(f&&m){T&&f.type==="audiovideo"&&this.logMuxedErr(o);const S=m.fragments[o.sn-1-m.startSN],b=o.sn===m.startSN,C=!S||o.cc>S.cc;if(s.independent!==!1){const{startPTS:I,endPTS:L,startDTS:k,endDTS:U}=f;if(c)c.elementaryStreams[f.type]={startPTS:I,endPTS:L,startDTS:k,endDTS:U};else if(f.firstKeyFrame&&f.independent&&n.id===1&&!C&&(this.couldBacktrack=!0),f.dropped&&f.independent){const O=this.getMainFwdBufferInfo(),F=(O?O.end:this.getLoadPosition())+this.config.maxBufferHole,G=f.firstKeyFramePTS?f.firstKeyFramePTS:I;if(!b&&F<G-this.config.maxBufferHole&&!C){this.backtrack(o);return}else C&&(o.gap=!0);o.setElementaryStreamInfo(f.type,o.start,L,o.start,U,!0)}else b&&I-(m.appliedTimelineOffset||0)>MAX_START_GAP_JUMP&&(o.gap=!0);o.setElementaryStreamInfo(f.type,I,L,k,U),this.backtrackFragment&&(this.backtrackFragment=o),this.bufferFragmentData(f,o,c,n,b||C)}else if(b||C)o.gap=!0;else{this.backtrack(o);return}}if(T){const{startPTS:S,endPTS:b,startDTS:C,endDTS:I}=T;c&&(c.elementaryStreams[ElementaryStreamTypes.AUDIO]={startPTS:S,endPTS:b,startDTS:C,endDTS:I}),o.setElementaryStreamInfo(ElementaryStreamTypes.AUDIO,S,b,C,I),this.bufferFragmentData(T,o,c,n)}if(m&&g!=null&&g.samples.length){const S={id:t,frag:o,details:m,samples:g.samples};i.trigger(Events.FRAG_PARSING_METADATA,S)}if(m&&d){const S={id:t,frag:o,details:m,samples:d.samples};i.trigger(Events.FRAG_PARSING_USERDATA,S)}}logMuxedErr(e){this.warn(`${isMediaFragment(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,i,s){if(this.state!==State.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(i));const{audio:n,video:a,audiovideo:o}=t;if(n){const u=e.audioCodec;let f=pickMostCompleteCodecName(n.codec,u);f==="mp4a"&&(f="mp4a.40.5");const d=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){f&&(f.indexOf("mp4a.40.5")!==-1?f="mp4a.40.2":f="mp4a.40.5");const g=n.metadata;g&&"channelCount"in g&&(g.channelCount||1)!==1&&d.indexOf("firefox")===-1&&(f="mp4a.40.5")}f&&f.indexOf("mp4a.40.5")!==-1&&d.indexOf("android")!==-1&&n.container!=="audio/mpeg"&&(f="mp4a.40.2",this.log(`Android: force audio codec to ${f}`)),u&&u!==f&&this.log(`Swapping manifest audio codec "${u}" for "${f}"`),n.levelCodec=f,n.id=PlaylistLevelType.MAIN,this.log(`Init audio buffer, container:${n.container}, codecs[selected/level/parsed]=[${f||""}/${u||""}/${n.codec}]`),delete t.audiovideo}if(a){a.levelCodec=e.videoCodec,a.id=PlaylistLevelType.MAIN;const u=a.codec;if(u?.length===4)switch(u){case"hvc1":case"hev1":a.codec="hvc1.1.6.L120.90";break;case"av01":a.codec="av01.0.04M.08";break;case"avc1":a.codec="avc1.42e01e";break}this.log(`Init video buffer, container:${a.container}, codecs[level/parsed]=[${e.videoCodec||""}/${u}]${a.codec!==u?" parsed-corrected="+a.codec:""}${a.supplemental?" supplemental="+a.supplemental:""}`),delete t.audiovideo}o&&(this.log(`Init audiovideo buffer, container:${o.container}, codecs[level/parsed]=[${e.codecs}/${o.codec}]`),delete t.video,delete t.audio);const c=Object.keys(t);if(c.length){if(this.hls.trigger(Events.BUFFER_CODECS,t),!this.hls)return;c.forEach(u=>{const d=t[u].initSegment;d!=null&&d.byteLength&&this.hls.trigger(Events.BUFFER_APPENDING,{type:u,data:d,frag:i,part:null,chunkMeta:s,parent:i.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const e=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,PlaylistLevelType.MAIN)}get maxBufferLength(){const{levels:e,level:t}=this,i=e?.[t];return i?this.getMaxBufferLength(i.maxBitrate):this.config.maxBufferLength}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=State.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const i=e.currentTime;if(BufferHelper.isBuffered(e,i)?t=this.getAppendedFrag(i):BufferHelper.isBuffered(e,i+.1)&&(t=this.getAppendedFrag(i+.1)),t){this.backtrackFragment=null;const s=this.fragPlaying,n=t.level;(!s||t.sn!==s.sn||s.level!==n)&&(this.fragPlaying=t,this.hls.trigger(Events.FRAG_CHANGED,{frag:t}),(!s||s.level!==n)&&this.hls.trigger(Events.LEVEL_SWITCHED,{level:n}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){var e;if(this.fragPlaying)return this.fragPlaying;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;return isFiniteNumber(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(isFiniteNumber(t)){const i=this.getLevelDetails(),s=this.currentFrag||(i?findFragmentByPTS(null,i.fragments,t):null);if(s){const n=s.programDateTime;if(n!==null){const a=n+(t-s.start)*1e3;return new Date(a)}}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class KeyLoader extends Logger{constructor(e,t){super("key-loader",t),this.config=void 0,this.keyIdToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const i in this.keyIdToKeyInfo){const s=this.keyIdToKeyInfo[i].loader;if(s){var t;if(e&&e!==((t=s.context)==null?void 0:t.frag.type))return;s.abort()}}}detach(){for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyIdToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e].loader;t&&t.destroy()}this.keyIdToKeyInfo={}}createKeyLoadError(e,t=ErrorDetails.KEY_LOAD_ERROR,i,s,n){return new LoadError({type:ErrorTypes.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:n,error:i,networkDetails:s})}loadClear(e,t,i){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(t.length)for(let s=0,n=t.length;s<n;s++){const a=t[s];if(e.cc<=a.cc&&(!isMediaFragment(e)||!isMediaFragment(a)||e.sn<a.sn)||!i&&s==n-1)return this.emeController.selectKeySystemFormat(a).then(o=>{if(!this.emeController)return;a.setKeyFormat(o);const c=keySystemFormatToKeySystemDomain(o);if(c)return this.emeController.getKeySystemAccess([c])})}if(this.config.requireKeySystemAccessOnStart){const s=getKeySystemsForConfig(this.config);if(s.length)return this.emeController.getKeySystemAccess(s)}}return null}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var i,s;t&&e.setKeyFormat(t);const n=e.decryptdata;if(!n){const u=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:`Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: ${this.emeController&&this.config.emeEnabled})`);return Promise.reject(this.createKeyLoadError(e,ErrorDetails.KEY_LOAD_ERROR,u))}const a=n.uri;if(!a)return Promise.reject(this.createKeyLoadError(e,ErrorDetails.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${a}"`)));const o=getKeyId(n);let c=this.keyIdToKeyInfo[o];if((i=c)!=null&&i.decryptdata.key)return n.key=c.decryptdata.key,Promise.resolve({frag:e,keyInfo:c});if(this.emeController&&(s=c)!=null&&s.keyLoadPromise)switch(this.emeController.getKeyStatus(c.decryptdata)){case"usable":case"usable-in-future":return c.keyLoadPromise.then(f=>{const{keyInfo:d}=f;return n.key=d.decryptdata.key,{frag:e,keyInfo:d}})}switch(this.log(`${this.keyIdToKeyInfo[o]?"Rel":"L"}oading${n.keyId?" keyId: "+arrayToHex(n.keyId):""} URI: ${n.uri} from ${e.type} ${e.level}`),c=this.keyIdToKeyInfo[o]={decryptdata:n,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},n.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return n.keyFormat==="identity"?this.loadKeyHTTP(c,e):this.loadKeyEME(c,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(c,e);default:return Promise.reject(this.createKeyLoadError(e,ErrorDetails.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${n.method}"`)))}}loadKeyEME(e,t){const i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var s;if(!e.decryptdata.keyId&&(s=t.initSegment)!=null&&s.data){const a=parseKeyIdsFromTenc(t.initSegment.data);if(a.length){let o=a[0];o.some(c=>c!==0)?(this.log(`Using keyId found in init segment ${arrayToHex(o)}`),LevelKey.setKeyIdForUri(e.decryptdata.uri,o)):(o=LevelKey.addKeyIdForUri(e.decryptdata.uri),this.log(`Generating keyId to patch media ${arrayToHex(o)}`)),e.decryptdata.keyId=o}}if(!e.decryptdata.keyId&&!isMediaFragment(t))return Promise.resolve(i);const n=this.emeController.loadKey(i);return(e.keyLoadPromise=n.then(a=>(e.mediaKeySessionContext=a,i))).catch(a=>{throw e.keyLoadPromise=null,"data"in a&&(a.data.frag=t),a})}return Promise.resolve(i)}loadKeyHTTP(e,t){const i=this.config,s=i.loader,n=new s(i);return t.keyLoader=e.loader=n,e.keyLoadPromise=new Promise((a,o)=>{const c={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},u=i.keyLoadPolicy.default,f={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(g,E,m,T)=>{const{frag:S,keyInfo:b}=m,C=getKeyId(b.decryptdata);if(!S.decryptdata||b!==this.keyIdToKeyInfo[C])return o(this.createKeyLoadError(S,ErrorDetails.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),T));b.decryptdata.key=S.decryptdata.key=new Uint8Array(g.data),S.keyLoader=null,b.loader=null,a({frag:S,keyInfo:b})},onError:(g,E,m,T)=>{this.resetLoader(E),o(this.createKeyLoadError(t,ErrorDetails.KEY_LOAD_ERROR,new Error(`HTTP Error ${g.code} loading key ${g.text}`),m,_objectSpread2({url:c.url,data:void 0},g)))},onTimeout:(g,E,m)=>{this.resetLoader(E),o(this.createKeyLoadError(t,ErrorDetails.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),m))},onAbort:(g,E,m)=>{this.resetLoader(E),o(this.createKeyLoadError(t,ErrorDetails.INTERNAL_ABORTED,new Error("key loading aborted"),m))}};n.load(c,f,d)})}resetLoader(e){const{frag:t,keyInfo:i,url:s}=e,n=i.loader;t.keyLoader===n&&(t.keyLoader=null,i.loader=null);const a=getKeyId(i.decryptdata)||s;delete this.keyIdToKeyInfo[a],n&&n.destroy()}}function getKeyId(r){if(r.keyFormat!==KeySystemFormats.FAIRPLAY){const e=r.keyId;if(e)return arrayToHex(e)}return r.uri}function mapContextToLevelType(r){const{type:e}=r;switch(e){case PlaylistContextType.AUDIO_TRACK:return PlaylistLevelType.AUDIO;case PlaylistContextType.SUBTITLE_TRACK:return PlaylistLevelType.SUBTITLE;default:return PlaylistLevelType.MAIN}}function getResponseUrl(r,e){let t=r.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class PlaylistLoader{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(Events.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:e}=this;e.off(Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(Events.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){const t=this.hls.config,i=t.pLoader,s=t.loader,n=i||s,a=new n(t);return this.loaders[e.type]=a,a}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:i}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:PlaylistContextType.MANIFEST,url:i,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){const{id:i,level:s,pathwayId:n,url:a,deliveryDirectives:o,levelInfo:c}=t;this.load({id:i,level:s,pathwayId:n,responseType:"text",type:PlaylistContextType.LEVEL,url:a,deliveryDirectives:o,levelOrTrack:c})}onAudioTrackLoading(e,t){const{id:i,groupId:s,url:n,deliveryDirectives:a,track:o}=t;this.load({id:i,groupId:s,level:null,responseType:"text",type:PlaylistContextType.AUDIO_TRACK,url:n,deliveryDirectives:a,levelOrTrack:o})}onSubtitleTrackLoading(e,t){const{id:i,groupId:s,url:n,deliveryDirectives:a,track:o}=t;this.load({id:i,groupId:s,level:null,responseType:"text",type:PlaylistContextType.SUBTITLE_TRACK,url:n,deliveryDirectives:a,levelOrTrack:o})}onLevelsUpdated(e,t){const i=this.loaders[PlaylistContextType.LEVEL];if(i){const s=i.context;s&&!t.levels.some(n=>n===s.levelOrTrack)&&(i.abort(),delete this.loaders[PlaylistContextType.LEVEL])}}load(e){var t;const i=this.hls.config;let s=this.getInternalLoader(e);if(s){const u=this.hls.logger,f=s.context;if(f&&f.levelOrTrack===e.levelOrTrack&&(f.url===e.url||f.deliveryDirectives&&!e.deliveryDirectives)){f.url===e.url?u.log(`[playlist-loader]: ignore ${e.url} ongoing request`):u.log(`[playlist-loader]: ignore ${e.url} in favor of ${f.url}`);return}u.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),s.abort()}let n;if(e.type===PlaylistContextType.MANIFEST?n=i.manifestLoadPolicy.default:n=_extends({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),s=this.createInternalLoader(e),isFiniteNumber((t=e.deliveryDirectives)==null?void 0:t.part)){let u;if(e.type===PlaylistContextType.LEVEL&&e.level!==null?u=this.hls.levels[e.level].details:e.type===PlaylistContextType.AUDIO_TRACK&&e.id!==null?u=this.hls.audioTracks[e.id].details:e.type===PlaylistContextType.SUBTITLE_TRACK&&e.id!==null&&(u=this.hls.subtitleTracks[e.id].details),u){const f=u.partTarget,d=u.targetduration;if(f&&d){const g=Math.max(f*3,d*.8)*1e3;n=_extends({},n,{maxTimeToFirstByteMs:Math.min(g,n.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(g,n.maxTimeToFirstByteMs)})}}}const a=n.errorRetry||n.timeoutRetry||{},o={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},c={onSuccess:(u,f,d,g)=>{const E=this.getInternalLoader(d);this.resetInternalLoader(d.type);const m=u.data;f.parsing.start=performance.now(),M3U8Parser.isMediaPlaylist(m)||d.type!==PlaylistContextType.MANIFEST?this.handleTrackOrLevelPlaylist(u,f,d,g||null,E):this.handleMasterPlaylist(u,f,d,g)},onError:(u,f,d,g)=>{this.handleNetworkError(f,d,!1,u,g)},onTimeout:(u,f,d)=>{this.handleNetworkError(f,d,!0,void 0,u)}};s.load(e,o,c)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:e,startPosition:t},forceStartLoad:i}=this.hls;(e||i)&&(this.hls.logger.log(`${e?"auto":"force"} startLoad with configured startPosition ${t}`),this.hls.startLoad(t))}handleMasterPlaylist(e,t,i,s){const n=this.hls,a=e.data,o=getResponseUrl(e,i),c=M3U8Parser.parseMasterPlaylist(a,o);if(c.playlistParsingError){t.parsing.end=performance.now(),this.handleManifestParsingError(e,i,c.playlistParsingError,s,t);return}const{contentSteering:u,levels:f,sessionData:d,sessionKeys:g,startTimeOffset:E,variableList:m}=c;this.variableList=m,f.forEach(C=>{const{unknownCodecs:I}=C;if(I){const{preferManagedMediaSource:L}=this.hls.config;let{audioCodec:k,videoCodec:U}=C;for(let O=I.length;O--;){const F=I[O];areCodecsMediaSourceSupported(F,"audio",L)?(C.audioCodec=k=k?`${k},${F}`:F,sampleEntryCodesISO.audio[k.substring(0,4)]=2,I.splice(O,1)):areCodecsMediaSourceSupported(F,"video",L)&&(C.videoCodec=U=U?`${U},${F}`:F,sampleEntryCodesISO.video[U.substring(0,4)]=2,I.splice(O,1))}}});const{AUDIO:T=[],SUBTITLES:S,"CLOSED-CAPTIONS":b}=M3U8Parser.parseMasterPlaylistMedia(a,o,c);T.length&&!T.some(I=>!I.url)&&f[0].audioCodec&&!f[0].attrs.AUDIO&&(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),T.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new AttrList({}),bitrate:0,url:""})),n.trigger(Events.MANIFEST_LOADED,{levels:f,audioTracks:T,subtitles:S,captions:b,contentSteering:u,url:o,stats:t,networkDetails:s,sessionData:d,sessionKeys:g,startTimeOffset:E,variableList:m})}handleTrackOrLevelPlaylist(e,t,i,s,n){const a=this.hls,{id:o,level:c,type:u}=i,f=getResponseUrl(e,i),d=isFiniteNumber(c)?c:isFiniteNumber(o)?o:0,g=mapContextToLevelType(i),E=M3U8Parser.parseLevelPlaylist(e.data,f,d,g,0,this.variableList);if(u===PlaylistContextType.MANIFEST){const m={attrs:new AttrList({}),bitrate:0,details:E,name:"",url:f};E.requestScheduled=t.loading.start+computeReloadInterval(E,0),a.trigger(Events.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:f,stats:t,networkDetails:s,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=E,this.handlePlaylistLoaded(E,e,t,i,s,n)}handleManifestParsingError(e,t,i,s,n){this.hls.trigger(Events.ERROR,{type:ErrorTypes.NETWORK_ERROR,details:ErrorDetails.MANIFEST_PARSING_ERROR,fatal:t.type===PlaylistContextType.MANIFEST,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:s,stats:n})}handleNetworkError(e,t,i=!1,s,n){let a=`A network ${i?"timeout":"error"+(s?" (status "+s.code+")":"")} occurred while loading ${e.type}`;e.type===PlaylistContextType.LEVEL?a+=`: ${e.level} id: ${e.id}`:(e.type===PlaylistContextType.AUDIO_TRACK||e.type===PlaylistContextType.SUBTITLE_TRACK)&&(a+=` id: ${e.id} group-id: "${e.groupId}"`);const o=new Error(a);this.hls.logger.warn(`[playlist-loader]: ${a}`);let c=ErrorDetails.UNKNOWN,u=!1;const f=this.getInternalLoader(e);switch(e.type){case PlaylistContextType.MANIFEST:c=i?ErrorDetails.MANIFEST_LOAD_TIMEOUT:ErrorDetails.MANIFEST_LOAD_ERROR,u=!0;break;case PlaylistContextType.LEVEL:c=i?ErrorDetails.LEVEL_LOAD_TIMEOUT:ErrorDetails.LEVEL_LOAD_ERROR,u=!1;break;case PlaylistContextType.AUDIO_TRACK:c=i?ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:ErrorDetails.AUDIO_TRACK_LOAD_ERROR,u=!1;break;case PlaylistContextType.SUBTITLE_TRACK:c=i?ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:ErrorDetails.SUBTITLE_LOAD_ERROR,u=!1;break}f&&this.resetInternalLoader(e.type);const d={type:ErrorTypes.NETWORK_ERROR,details:c,fatal:u,url:e.url,loader:f,context:e,error:o,networkDetails:t,stats:n};if(s){const g=t?.url||e.url;d.response=_objectSpread2({url:g,data:void 0},s)}this.hls.trigger(Events.ERROR,d)}handlePlaylistLoaded(e,t,i,s,n,a){const o=this.hls,{type:c,level:u,levelOrTrack:f,id:d,groupId:g,deliveryDirectives:E}=s,m=getResponseUrl(t,s),T=mapContextToLevelType(s);let S=typeof s.level=="number"&&T===PlaylistLevelType.MAIN?u:void 0;const b=e.playlistParsingError;if(b){if(this.hls.logger.warn(`${b} ${e.url}`),!o.config.ignorePlaylistParsingErrors){o.trigger(Events.ERROR,{type:ErrorTypes.NETWORK_ERROR,details:ErrorDetails.LEVEL_PARSING_ERROR,fatal:!1,url:m,error:b,reason:b.message,response:t,context:s,level:S,parent:T,networkDetails:n,stats:i});return}e.playlistParsingError=null}if(!e.fragments.length){const C=e.playlistParsingError=new Error("No Segments found in Playlist");o.trigger(Events.ERROR,{type:ErrorTypes.NETWORK_ERROR,details:ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:m,error:C,reason:C.message,response:t,context:s,level:S,parent:T,networkDetails:n,stats:i});return}switch(e.live&&a&&(a.getCacheAge&&(e.ageHeader=a.getCacheAge()||0),(!a.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),c){case PlaylistContextType.MANIFEST:case PlaylistContextType.LEVEL:if(S){if(!f)S=0;else if(f!==o.levels[S]){const C=o.levels.indexOf(f);C>-1&&(S=C)}}o.trigger(Events.LEVEL_LOADED,{details:e,levelInfo:f||o.levels[0],level:S||0,id:d||0,stats:i,networkDetails:n,deliveryDirectives:E,withoutMultiVariant:c===PlaylistContextType.MANIFEST});break;case PlaylistContextType.AUDIO_TRACK:o.trigger(Events.AUDIO_TRACK_LOADED,{details:e,track:f,id:d||0,groupId:g||"",stats:i,networkDetails:n,deliveryDirectives:E});break;case PlaylistContextType.SUBTITLE_TRACK:o.trigger(Events.SUBTITLE_TRACK_LOADED,{details:e,track:f,id:d||0,groupId:g||"",stats:i,networkDetails:n,deliveryDirectives:E});break}}}class Hls{static get version(){return version}static isMSESupported(){return isMSESupported()}static isSupported(){return isSupported()}static getMediaSource(){return getMediaSource()}static get Events(){return Events}static get MetadataSchema(){return MetadataSchema}static get ErrorTypes(){return ErrorTypes}static get ErrorDetails(){return ErrorDetails}static get DefaultConfig(){return Hls.defaultConfig?Hls.defaultConfig:hlsDefaultConfig}static set DefaultConfig(e){Hls.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new EventEmitter,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.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._url=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;const t=this.logger=enableLogs(e.debug||!1,"Hls instance",e.assetPlayerId),i=this.config=mergeConfig(Hls.DefaultConfig,e,t);this.userConfig=e,i.progressive&&enableStreamingMode(i,t);const{abrController:s,bufferController:n,capLevelController:a,errorController:o,fpsController:c}=i,u=new o(this),f=this.abrController=new s(this),d=new FragmentTracker(this),g=i.interstitialsController,E=g?this.interstitialsController=new g(this,Hls):null,m=this.bufferController=new n(this,d),T=this.capLevelController=new a(this),S=new c(this),b=new PlaylistLoader(this),C=i.contentSteeringController,I=C?new C(this):null,L=this.levelController=new LevelController(this,I),k=new ID3TrackController(this),U=new KeyLoader(this.config,this.logger),O=this.streamController=new StreamController(this,d,U),F=this.gapController=new GapController(this,d);T.setStreamController(O),S.setStreamController(O);const G=[b,L,O];E&&G.splice(1,0,E),I&&G.splice(1,0,I),this.networkControllers=G;const x=[f,m,F,T,S,k,d];this.audioTrackController=this.createController(i.audioTrackController,G);const $=i.audioStreamController;$&&G.push(this.audioStreamController=new $(this,d,U)),this.subtitleTrackController=this.createController(i.subtitleTrackController,G);const X=i.subtitleStreamController;X&&G.push(this.subtititleStreamController=new X(this,d,U)),this.createController(i.timelineController,x),U.emeController=this.emeController=this.createController(i.emeController,x),this.cmcdController=this.createController(i.cmcdController,x),this.latencyController=this.createController(LatencyController,x),this.coreComponents=x,G.push(u);const Q=u.onErrorOut;typeof Q=="function"&&this.on(Events.ERROR,Q,u),this.on(Events.MANIFEST_LOADED,b.onManifestLoaded,b)}createController(e,t){if(e){const i=new e(this);return t&&t.push(i),i}return null}on(e,t,i=this){this._emitter.on(e,t,i)}once(e,t,i=this){this._emitter.once(e,t,i)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,i=this,s){this._emitter.off(e,t,i,s)}listeners(e){return this._emitter.listeners(e)}emit(e,t,i){return this._emitter.emit(e,t,i)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(i){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+i.message+'". Here is a stacktrace:',i),!this.triggeringException){this.triggeringException=!0;const s=e===Events.ERROR;this.trigger(Events.ERROR,{type:ErrorTypes.OTHER_ERROR,details:ErrorDetails.INTERNAL_EXCEPTION,fatal:s,event:e,error:i}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log("destroy"),this.trigger(Events.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 e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){if(!e||"media"in e&&!e.media){const n=new Error(`attachMedia failed: invalid argument (${e})`);this.trigger(Events.ERROR,{type:ErrorTypes.OTHER_ERROR,details:ErrorDetails.ATTACH_MEDIA_ERROR,fatal:!0,error:n});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const t="media"in e,i=t?e.media:e,s=t?e:{media:i};this._media=i,this.trigger(Events.MEDIA_ATTACHING,s)}detachMedia(){this.logger.log("detachMedia"),this.trigger(Events.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const e=this.bufferController.transferMedia();return this.trigger(Events.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();const t=this.media,i=this._url,s=this._url=urlToolkitExports.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${s}`),t&&i&&(i!==s||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(Events.MANIFEST_LOADING,{url:e})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(e=-1,t){this.logger.log(`startLoad(${e+(t?", <skip seek to start>":"")})`),this.started=!0,this.resumeBuffering();for(let i=0;i<this.networkControllers.length&&(this.networkControllers[i].startLoad(e,t),!(!this.started||!this.networkControllers));i++);}stopLoad(){this.logger.log("stopLoad"),this.started=!1;for(let e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!(this.started||!this.networkControllers));e++);}get loadingEnabled(){return this.started}get bufferingEnabled(){return this.streamController.bufferingEnabled}resumeBuffering(){this.bufferingEnabled||(this.logger.log("resume buffering"),this.networkControllers.forEach(e=>{e.resumeBuffering&&e.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()}))}get inFlightFragments(){const e={[PlaylistLevelType.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[PlaylistLevelType.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[PlaylistLevelType.SUBTITLE]=this.subtititleStreamController.inFlightFrag),e}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");const e=this._media,t=e?.currentTime;this.detachMedia(),e&&(this.attachMedia(e),t&&this.startLoad(t))}removeLevel(e){this.levelController.removeLevel(e)}get sessionId(){let e=this._sessionId;return e||(e=this._sessionId=uuid()),e}get levels(){const e=this.levelController.levels;return e||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){this.logger.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){this.logger.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){this.logger.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){this.logger.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get abrEwmaDefaultEstimate(){const{bwEstimator:e}=this.abrController;return e?e.defaultEstimate:NaN}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(this.logger.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){isHdcpLevel(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const i=e.length;for(let s=0;s<i;s++)if(e[s].maxBitrate>=t)return s;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:i}=this;let s;if(t===-1&&e!=null&&e.length?s=e.length-1:s=t,i)for(let n=s;n--;){const a=e[n].attrs["HDCP-LEVEL"];if(a&&a<=i)return n}return s}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){var t;return((t=this.audioTrackController)==null?void 0:t.setAudioOption(e))||null}setSubtitleOption(e){var t;return((t=this.subtitleTrackController)==null?void 0:t.setSubtitleOption(e))||null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}set targetLatency(e){this.latencyController.targetLatency=e}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(e){this.levelController.pathwayPriority=e}get bufferedToEnd(){var e;return!!((e=this.bufferController)!=null&&e.bufferedToEnd)}get interstitialsManager(){var e;return((e=this.interstitialsController)==null?void 0:e.interstitialsManager)||null}getMediaDecodingInfo(e,t=this.allAudioTracks){const i=getAudioTracksByGroup(t);return getMediaDecodingInfoPromise(e,i,navigator.mediaCapabilities)}}Hls.defaultConfig=void 0;const checkPwaInstalled=()=>{const r=window.matchMedia("(display-mode: standalone)").matches,e=/iphone|ipad|ipod/i.test(window.navigator.userAgent),t=window.navigator.standalone===!0;return r||e&&t},usePWAInstalled=()=>{const[r,e]=React.useState(checkPwaInstalled());return React.useEffect(()=>{const t=()=>{e(checkPwaInstalled())};return window.addEventListener("DOMContentLoaded",t),window.addEventListener("appinstalled",t),()=>{window.removeEventListener("DOMContentLoaded",t),window.removeEventListener("appinstalled",t)}},[]),r};function VideoPlayer({src:r,reverseSrc:e,poster:t,keySrc:i,onPlay:s,onPause:n}){const[a,o]=React.useState(!1),[c,u]=React.useState(!1),f=React.useRef(null),{os:d,browser:g}=useUserAgent(),E=useDeviceType(),[m,T]=React.useState(!1),[S,b]=React.useState(!1),[C,I]=React.useState(0),[L,k]=React.useState(0),[U,O]=React.useState([]),[F,G]=React.useState(!1),[x,$]=React.useState(!1),X=usePWAInstalled(),[Q,ee]=React.useState(!1),[te,re]=React.useState([{value:.5,label:"0.5x",active:!1},{value:1,label:"1x",active:!0},{value:1.25,label:"1.25x",active:!1},{value:1.5,label:"1.5x",active:!1},{value:1.75,label:"1.75x",active:!1},{value:2,label:"2x",active:!1},{value:2.5,label:"2.5x",active:!1},{value:3,label:"3x",active:!1}]),me=React.useRef(null),H=React.useRef(null),[z,ie]=React.useState(!1),ne=React.useRef(null),he=React.useRef(!1);React.useEffect(()=>(Pe(),document.addEventListener("keypress",pe),()=>{ne.current?.destroy(),ne.current=null,document.removeEventListener("keypress",pe)}),[r,i]);function pe(Se){Se.preventDefault(),Se.code.toUpperCase()==="SPACE"&&Qe()}async function Pe(){if(!f.current||!r)return;const Se=r.endsWith(".m3u8");if(Hls.isSupported()&&Se)try{const lt=new Hls({xhrSetup:function(ht,pt){pt.includes(".key")&&i&&ht.open("GET",i,!0)},maxBufferLength:30,maxMaxBufferLength:60,maxBufferSize:3e7,maxBufferHole:1,startPosition:-1,autoStartLoad:!0});lt.on(Hls.Events.ERROR,function(ht,pt){console.error("Hls error:",pt)}),ne.current=lt,lt.loadSource(r),lt.attachMedia(f.current)}catch{$(!0)}else f.current.canPlayType("application/vnd.apple.mpegurl")&&Se?e&&(f.current.src=e):f.current.src=r;f.current.poster=t??"",f.current.addEventListener("canplay",ae),f.current.addEventListener("loadedmetadata",Le),f.current.addEventListener("play",ce),f.current.addEventListener("pause",Ee),f.current.addEventListener("timeupdate",Y),f.current.addEventListener("progress",Re),f.current.addEventListener("error",Ae),f.current.addEventListener("playing",ve),f.current.addEventListener("waiting",Be),document.addEventListener("visibilitychange",q),le()}React.useEffect(()=>{a&&c&&G(!0)},[a,c]),React.useEffect(()=>{const Se=setTimeout(()=>{G(!1)},1e4);return()=>{clearTimeout(Se)}},[F]);function ae(){o(!0),$(!1)}function Ae(){$(!0),o(!1),u(!1);const Se=f.current?.error;if(Se)switch(Se.code){case MediaError.MEDIA_ERR_ABORTED:console.log("خطا: بارگذاری ویدیو قطع شد.");break;case MediaError.MEDIA_ERR_NETWORK:console.log("خطا: مشکل شبکه هنگام بارگذاری ویدیو.");break;case MediaError.MEDIA_ERR_DECODE:console.log("خطا: مشکل در رمزگشایی فایل ویدیو.");break;case MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED:console.log("خطا: فرمت یا سورس ویدیو پشتیبانی نمیشود.");break;default:console.log("خطای نامشخص در ویدیو.");break}else console.log("خطای ناشناخته در پخش ویدیو")}function Re(){const Se=f.current;if(!Se)return;const lt=[],ht=Se.buffered;for(let pt=0;pt<ht.length;pt++){const Ui=ht.start(pt),Pi=ht.end(pt);lt.push({start:Ui,end:Pi})}O(lt)}function Le(){o(!0),$(!1),k(f.current?.duration??0)}function Y(){I(f.current?.currentTime??0)}function q(){f.current?.pause()}function le(){new IntersectionObserver(lt=>{for(const ht of lt){const pt=ht.target;ht.intersectionRatio<.5?!pt.paused&&!pt.ended&&(pt.pause(),he.current=!0):ht.isIntersecting&&(he.current&&pt.play().catch(()=>{}),he.current=!1)}},{threshold:[0,.5,1]}).observe(f.current)}function ce(){u(!0),s?.()}function Ee(){u(!1),n?.()}function ve(){o(!0),u(!0)}function Be(){o(!1),u(!1),$(!1)}async function Ie(){if(ee(Se=>!Se),d.name?.toUpperCase().includes("IOS")||g.name?.toUpperCase().includes("SAFARI")&&d.name?.toUpperCase().includes("MAC")&&(E===DeviceTypeEnum.MOBILE||X))S?(f.current?.classList.remove("!object-contain"),f.current?.parentElement?.classList.remove("!z-[999]")):(f.current?.classList.add("!object-contain"),f.current?.parentElement?.classList.add("!z-[999]")),b(!S);else{if(document.fullscreenElement)await document.exitFullscreen(),f.current?.classList.remove("!object-contain"),f.current?.parentElement?.classList.remove("!z-[9999999]");else{const Se=f.current?.parentElement;if(Se){const lt=Se.requestFullscreen||Se.webkitRequestFullscreen||Se.mozRequestFullScreen||Se.msRequestFullscreen;if(lt){const ht=lt.call(Se);ht&&ht.catch(pt=>{console.error("Error attempting to enable full-screen mode:",pt)})}else console.warn("Fullscreen API is not supported by this browser.")}f.current?.classList.add("!object-contain"),f.current?.parentElement?.classList.add("!z-[9999999]")}gt()}}React.useEffect(()=>{gt()},[S]);function Me(){f.current&&(f.current.currentTime+=15)}function Ve(){f.current&&(f.current.currentTime-=15)}function dt(){f.current&&(m?f.current.muted=!1:f.current.muted=!0,T(!m))}function Qe(){c?f.current?.pause():f.current?.play()}function ze(){let Se=lodashExports.findIndex(te,ht=>ht.active),lt=te[Se].value;Se+1==te.length?Se=0:Se+=1,re(te.map((ht,pt)=>pt==Se?(lt=ht.value,{value:ht.value,label:ht.label,active:!0}):{value:ht.value,label:ht.label,active:!1})),f.current&&(f.current.playbackRate=lt)}function Je(Se){f.current&&(f.current.currentTime=Se)}function gt(){document.fullscreenElement||S?document.body.classList.add("landscape-allowed"):document.body.classList.remove("landscape-allowed")}const yt=React.useRef(lodashExports.debounce(()=>{G(!0)})).current;function _t(){$(!1),Pe()}function qe(){me.current&&(clearTimeout(me.current),me.current=null),Me()}function Yt(){me.current&&(clearTimeout(me.current),me.current=null),Ve()}function Dt(){ie(!1),H.current=setTimeout(()=>{ie(!0),re(te.map(Se=>Se.value==2?{value:Se.value,label:Se.label,active:!0}:{value:Se.value,label:Se.label,active:!1})),f.current&&(f.current.playbackRate=2)},1e3)}function St(){z&&(re(te.map(Se=>Se.value==1?{value:Se.value,label:Se.label,active:!0}:{value:Se.value,label:Se.label,active:!1})),f.current&&(f.current.playbackRate=1)),H.current&&(clearTimeout(H.current),H.current=null)}return jsxRuntime.jsxs("section",{onMouseMove:yt,onTouchMove:yt,onMouseDown:Dt,onMouseUp:St,onTouchStart:Dt,onTouchEnd:St,onClick:()=>{if(z){ie(!1);return}me.current!==null&&(clearTimeout(me.current),me.current=null),c?me.current=setTimeout(()=>{f.current?.pause()},300):f.current?.play()},style:{direction:"rtl"},className:S?"sp__fullscreen__safari":"w-full h-full relative",children:[jsxRuntime.jsx("video",{width:"100%",height:"100%",className:"w-full h-full object-cover",ref:f,playsInline:!0,"webkit-playsinline":"true",controls:!1}),jsxRuntime.jsx(VideoPlayerControl,{isError:x,isShowControl:F,onSeek:Je,bufferedRanges:U,rates:te,currentTime:C,duration:L,onTogglePlay:Qe,isMuted:m,onToggleMute:dt,onBackwardCurrentTime:Ve,onForwardCurrentTime:Me,onDoubleClickInRight:qe,onDoubleClickInLeft:Yt,onMaximize:Ie,canPlay:a,isPlayed:c,onChangeRate:ze,isFullScreen:Q,onTryAgain:_t})]})}exports.VideoPlayer=VideoPlayer,exports.VideoPlayerControl=VideoPlayerControl,exports.default=VideoPlayer,Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|