You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NewEduCoderBuild/p__Problemset__Preview__ind...

256 lines
599 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[235,9],{"+M/w":function(mt,ct,be){mt.exports={flexRow:"flexRow___1Kwk7",flexColumn:"flexColumn___1x58l",action:"action___osaCD",setScore:"setScore___kmMlR",delete:"delete___XpFlx",content:"content___9Naj3",titleWrap:"titleWrap___32PZL",titleNumber:"titleNumber___3HPb0",score:"score___3zGYh",titleHtml:"titleHtml___2vgPo",answerWrap:"answerWrap___2vM8f",answer:"answer___1Q0Tc",answerText:"answerText___5UVSF"}},"6cGi":function(mt,ct,be){"use strict";be.d(ct,"a",function(){return B});var he=be("ODXe"),j=be("q1tI"),D=be.n(j);function B(R,L){var G=L||{},O=G.defaultValue,_=G.value,A=G.onChange,y=G.postState,S=j.useState(function(){return _!==void 0?_:O!==void 0?typeof O=="function"?O():O:typeof R=="function"?R():R}),C=Object(he.a)(S,2),T=C[0],E=C[1],x=_!==void 0?_:T;y&&(x=y(x));var l=j.useRef(A);l.current=A;var r=j.useCallback(function(n){E(n),x!==n&&l.current&&l.current(n,x)},[x,l]),s=j.useRef(!0);return j.useEffect(function(){if(s.current){s.current=!1;return}_===void 0&&E(_)},[_]),[x,r]}},"8hTe":function(mt,ct,be){mt.exports={button:"button___1wy9m"}},"9Bee":function(mt,ct,be){"use strict";var he=be("DYRE"),j=be("zeV3"),D=be("+L6B"),B=be("2/Rp"),R=be("k1fw"),L=be("9og8"),G=be("tJVT"),O=be("WmNS"),_=be.n(O),A=be("q1tI"),y=be.n(A),S=be("vg9a"),C=be("DlQD"),T=be.n(C),E=be("rUJ1");function x(X,F){var U=X.match(/^(\s+)(?:```)/);if(U===null)return F;var $=U[1];return F.split(`
`).map(function(J){var W=J.match(/^\s+/);if(W===null)return J;var H=Object(G.a)(W,1),Q=H[0];return Q.length>=$.length?J.slice($.length):J}).join(`
`)}var l=[],r=["<ul>"],s=new T.a.Renderer,n=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function p(){l.length=0,r=["<ul>"]}var d={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function c(X,F,U,$){if(F>=X.length||X[F].level<=U)return F;var J=X[F];$.push("<li><a href='#"+J.anchor+"'>"+J.text+"</a>"),F++;var W=[];return F=c(X,F,J.level,W),W.length>0&&($.push("<ul>"),W.forEach(function(H){$.push(H)}),$.push("</ul>")),$.push("</li>"),F=c(X,F,U,$),F}function b(){return c(l,0,0,r),r.push("</ul>"),r.join("")}var f={heading:function(F){var U=n.exec(F);if(U)return{type:"heading",raw:U[0],depth:U[1].length,text:U[2]}},fences:function(F){var U=this.rules.block.fences.exec(F);if(U){var $=U[0],J=x($,U[3]||""),W=U[2]?U[2].trim():U[2];if(["latex","katex","math"].indexOf(W)>=0){var H=a(),Q=J;J=H,i[H]={type:"block",expression:Q}}return{type:"code",raw:$,lang:W,text:J}}}},u=/(?:\${2})([^\n`]+?)(?:\${2})/gi,o=0,a=function(){return"__special_katext_id_".concat(o++,"__")},i={};function v(){return i}function g(){o=0,i={}}function m(X){return X=X.replace(u,function(F,U){var $=a();return i[$]={type:"inline",expression:U},$}),X}var w=s.listitem;s.listitem=function(X){return w(m(X))};var P=s.paragraph;s.paragraph=function(X){return P(m(X))};var N=s.tablecell;s.tablecell=function(X,F){return N(m(X),F)},s.code=function(X,F,U){var $=(F||"").match(/\S*/)[0];return $?["latex","katex","math"].indexOf($)>=0?"<p class='editormd-tex'>".concat(X,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(F,'">').concat(U?X:Object(E.escape)(X,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(U?X:Object(E.escape)(X,!0))+"</code></pre>"},s.heading=function(X,F,U){var $=this.options.headerPrefix+U.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return l.push({anchor:$,level:F,text:X}),"<h"+F+' id="'+$+'">'+X+"</h"+F+">"},T.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),T.a.use({tokenizer:f,renderer:s});var K=T.a,Y=be("SJMd"),ne=be("ulZh"),q=be.n(ne),se=be("m3rI"),fe=be("Oy/b"),le=be("p5ED"),ve=be("ErOA"),Se=be("STEk");/* **********************************
cropro version 1.2.0
@license SEE LICENSE IN LICENSE
copyright Alan Mendelevich
see README and LICENSE for details
********************************** *//*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var ke=function(X,F){return(ke=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(U,$){U.__proto__=$}||function(U,$){for(var J in $)Object.prototype.hasOwnProperty.call($,J)&&(U[J]=$[J])})(X,F)};function Ce(X,F){if(typeof F!="function"&&F!==null)throw new TypeError("Class extends value "+String(F)+" is not a constructor or null");function U(){this.constructor=X}ke(X,F),X.prototype=F===null?Object.create(F):(U.prototype=F.prototype,new U)}function Le(X,F,U,$){return new(U||(U=Promise))(function(J,W){function H(ce){try{Z($.next(ce))}catch(ue){W(ue)}}function Q(ce){try{Z($.throw(ce))}catch(ue){W(ue)}}function Z(ce){var ue;ce.done?J(ce.value):(ue=ce.value,ue instanceof U?ue:new U(function(ye){ye(ue)})).then(H,Q)}Z(($=$.apply(X,F||[])).next())})}function ge(X,F){var U,$,J,W,H={label:0,sent:function(){if(1&J[0])throw J[1];return J[1]},trys:[],ops:[]};return W={next:Q(0),throw:Q(1),return:Q(2)},typeof Symbol=="function"&&(W[Symbol.iterator]=function(){return this}),W;function Q(Z){return function(ce){return function(ue){if(U)throw new TypeError("Generator is already executing.");for(;H;)try{if(U=1,$&&(J=2&ue[0]?$.return:ue[0]?$.throw||((J=$.return)&&J.call($),0):$.next)&&!(J=J.call($,ue[1])).done)return J;switch($=0,J&&(ue=[2&ue[0],J.value]),ue[0]){case 0:case 1:J=ue;break;case 4:return H.label++,{value:ue[1],done:!1};case 5:H.label++,$=ue[1],ue=[0];continue;case 7:ue=H.ops.pop(),H.trys.pop();continue;default:if(!(J=H.trys,(J=J.length>0&&J[J.length-1])||ue[0]!==6&&ue[0]!==2)){H=0;continue}if(ue[0]===3&&(!J||ue[1]>J[0]&&ue[1]<J[3])){H.label=ue[1];break}if(ue[0]===6&&H.label<J[1]){H.label=J[1],J=ue;break}if(J&&H.label<J[2]){H.label=J[2],H.ops.push(ue);break}J[2]&&H.ops.pop(),H.trys.pop();continue}ue=F.call(X,H)}catch(ye){ue=[6,ye],$=0}finally{U=J=0}if(5&ue[0])throw ue[1];return{value:ue[0]?ue[1]:void 0,done:!0}}([Z,ce])}}}var me=function(){function X(){}return X.addKey=function(F){X.key=F},Object.defineProperty(X,"isLicensed",{get:function(){return!!X.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(X.key)},enumerable:!1,configurable:!0}),X}(),de=function(){function X(){}return X.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},X.setAttributes=function(F,U){for(var $=0,J=U;$<J.length;$++){var W=J[$],H=W[0],Q=W[1];F.setAttribute(H,Q)}},X.createRect=function(F,U,$){var J=document.createElementNS("http://www.w3.org/2000/svg","rect");return J.setAttribute("width",F.toString()),J.setAttribute("height",U.toString()),$&&X.setAttributes(J,$),J},X.createLine=function(F,U,$,J,W){var H=document.createElementNS("http://www.w3.org/2000/svg","line");return H.setAttribute("x1",F.toString()),H.setAttribute("y1",U.toString()),H.setAttribute("x2",$.toString()),H.setAttribute("y2",J.toString()),W&&X.setAttributes(H,W),H},X.createPolygon=function(F,U){var $=document.createElementNS("http://www.w3.org/2000/svg","polygon");return $.setAttribute("points",F),U&&X.setAttributes($,U),$},X.createCircle=function(F,U){var $=document.createElementNS("http://www.w3.org/2000/svg","circle");return $.setAttribute("cx",(F/2).toString()),$.setAttribute("cy",(F/2).toString()),$.setAttribute("r",F.toString()),U&&X.setAttributes($,U),$},X.createEllipse=function(F,U,$){var J=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return J.setAttribute("cx",(F/2).toString()),J.setAttribute("cy",(U/2).toString()),J.setAttribute("rx",(F/2).toString()),J.setAttribute("ry",(U/2).toString()),$&&X.setAttributes(J,$),J},X.createGroup=function(F){var U=document.createElementNS("http://www.w3.org/2000/svg","g");return F&&X.setAttributes(U,F),U},X.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},X.createMarker=function(F,U,$,J,W,H,Q){var Z=document.createElementNS("http://www.w3.org/2000/svg","marker");return X.setAttributes(Z,[["id",F],["orient",U],["markerWidth",$.toString()],["markerHeight",J.toString()],["refX",W.toString()],["refY",H.toString()]]),Z.appendChild(Q),Z},X.createText=function(F){var U=document.createElementNS("http://www.w3.org/2000/svg","text");return U.setAttribute("x","0"),U.setAttribute("y","0"),F&&X.setAttributes(U,F),U},X.createTSpan=function(F,U){var $=document.createElementNS("http://www.w3.org/2000/svg","tspan");return $.textContent=F,U&&X.setAttributes($,U),$},X.createImage=function(F){var U=document.createElementNS("http://www.w3.org/2000/svg","image");return F&&X.setAttributes(U,F),U},X.createPoint=function(F,U){var $=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return $.x=F,$.y=U,$},X.createPath=function(F,U){var $=document.createElementNS("http://www.w3.org/2000/svg","path");return $.setAttribute("d",F),U&&X.setAttributes($,U),$},X.createElement=function(F,U){var $=document.createElementNS("http://www.w3.org/2000/svg",F);return U&&X.setAttributes($,U),$},X.getHollowRectanglePath=function(F,U,$,J,W,H,Q,Z){return"M"+F+","+U+"V"+(U+J)+"H"+(F+$)+"V"+U+"H"+W+"V"+H+"H"+(W+Q)+"V"+(H+Z)+"H"+W+"V"+U+"Z"},X}(),nt=function(){function X(F){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+F+"_"}return Object.defineProperty(X.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#333333",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarBackgroundActiveColor:"#282828",toolbarColor:"#eeeeee",cropShadeColor:"#ffffff",cropFrameColor:"#ffffff",gripColor:"#333333",gripFillColor:"#cccccc",toolbarHeight:40}},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),X.prototype.addClass=function(F){return this.styleSheet===void 0&&this.addStyleSheet(),F.name=""+this.classNamePrefix+F.localName,this.classes.push(F),this.styleSheet.sheet.insertRule("."+F.name+" {"+F.style+"}",this.styleSheet.sheet.cssRules.length),F},X.prototype.addRule=function(F){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(F),this.styleSheet.sheet.insertRule(F.selector+" {"+F.style+"}",this.styleSheet.sheet.cssRules.length)},X.prototype.addStyleSheet=function(){var F;this.styleSheet=document.createElement("style"),((F=this.styleSheetRoot)!==null&&F!==void 0?F:document.head).appendChild(this.styleSheet),this.addRule(new Qe("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Qe("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new Qe("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new qe("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new qe("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},X.prototype.removeStyleSheet=function(){var F;this.styleSheet&&(((F=this.styleSheetRoot)!==null&&F!==void 0?F:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},X}(),Qe=function(X,F){this.selector=X,this.style=F},qe=function(X,F){this.localName=X,this.style=F},We=function(){function X(){this.blocks=[],this.display=""}return X.prototype.addButtonBlock=function(F){F.className=this.blockClassName,F.buttonClassName=this.buttonClassName,F.buttonColorsClassName=this.buttonColorsClassName,F.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(F)},X.prototype.addElementBlock=function(F){F.className===void 0&&(F.className=this.blockClassName),this.blocks.push(F)},X.prototype.getUI=function(){var F=document.createElement("div");return F.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,F.style.display=this.display,this.blocks.forEach(function(U){return F.appendChild(U.getUI())}),F},X}(),xe=function(){function X(){}return X.prototype.getUI=function(){var F=document.createElement("div");if(F.className=this.className,this.minWidth!==void 0&&(F.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":F.style.justifyContent="flex-start";break;case"center":F.style.justifyContent="center";break;case"end":F.style.justifyContent="flex-end"}return F.style.whiteSpace="nowrap",F},X}(),Te=function(X){function F(){var U=X!==null&&X.apply(this,arguments)||this;return U.buttons=[],U}return Ce(F,X),F.prototype.addButton=function(U){U.className=this.buttonClassName,U.colorsClassName=this.buttonColorsClassName,U.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(U)},F.prototype.getUI=function(){var U=X.prototype.getUI.call(this);return this.buttons.forEach(function($){return U.appendChild($.getUI())}),U},F}(xe),we=function(){function X(F,U){this._isActive=!1,this._isHidden=!1,this._icon=F,this.title=U,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(X.prototype,"icon",{get:function(){return this._icon},set:function(F){this._icon=F,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isActive",{get:function(){return this._isActive},set:function(F){this._isActive=F,this.adjustClassName()},enumerable:!1,configurable:!0}),X.prototype.getUI=function(){var F=this;return this.buttonContainer=document.createElement("div"),this.buttonContainer.title=this.title,this.buttonContainer.className=this.className+" "+this.colorsClassName,this.adjustClassName(),this.buttonContainer.innerHTML=this._icon,this.onClick&&this.buttonContainer.addEventListener("click",function(){return F.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},X.prototype.adjustClassName=function(){this.activeColorsClassName&&(this._isActive&&this.buttonContainer.className.indexOf(this.activeColorsClassName)<0?this.buttonContainer.className+=" "+this.activeColorsClassName:this._isActive||(this.buttonContainer.className=this.buttonContainer.className.replace(this.activeColorsClassName,"")))},X.prototype.hide=function(){this._isHidden=!0},X}(),Oe=function(X){function F(){var U=X!==null&&X.apply(this,arguments)||this;return U.elements=[],U}return Ce(F,X),F.prototype.addElement=function(U){this.elements.push(U)},F.prototype.getUI=function(){var U=X.prototype.getUI.call(this);return this.elements.forEach(function($){return U.appendChild($)}),U},F}(xe),Ne=function(){function X(F,U){this.horizontal=F,this.vertical=U}return Object.defineProperty(X.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),X.prototype.getVerticalLength=function(F){return F/this.ratio},X.prototype.getHorizontalLength=function(F){return F*this.ratio},X}(),De=function(){function X(){}return X.getIcon=function(F,U){if(F>0&&U>0){var $=new Ne(F,U),J=$.ratio>=1?20:$.getHorizontalLength(20),W=$.ratio<1?20:$.getVerticalLength(20),H=document.createElementNS("http://www.w3.org/2000/svg","svg");H.setAttribute("xmlns","http://www.w3.org/2000/svg"),H.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(H);var Q=de.createDefs();H.appendChild(Q);var Z=de.createElement("clipPath",[["id","text-bg-clip"]]);Q.appendChild(Z);var ce=de.createPath(de.getHollowRectanglePath((24-J)/2,(24-W)/2,J,W,(24-J)/2+2,(24-W)/2+2,J-4,W-4));H.appendChild(ce);var ue=de.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);ue.appendChild(de.createTSpan(F+":"+U)),H.appendChild(ue);var ye=ue.getBBox();de.setAttributes(ue,[["x",((24-ye.width)/2).toString()],["y",((24-ye.height)/2-ye.y).toString()]]);var Fe=de.createPath(de.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(ye.width))/2,(24-Math.ceil(ye.height))/2,Math.ceil(ye.width),Math.ceil(ye.height)));return Z.appendChild(Fe),de.setAttributes(ce,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(H),H.outerHTML}return'<svg viewBox="0 0 24 24"><path d="M19 12h-2v3h-3v2h5v-5M7 9h3V7H5v5h2V9m14-6H3a2 2 0 00-2 2v14a2 2 0 002 2h18a2 2 0 002-2V5a2 2 0 00-2-2m0 16H3V5h18v14z"/></svg>'},X}(),Ee=function(X){function F(U,$,J){var W=X.call(this,U,$)||this;return W.isDropdownOpen=!1,W.onClick=W.dropdownButtonClicked,W.dropdownButtons=J,W}return Ce(F,X),F.prototype.setupDropdown=function(){var U=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function($){$.className=U.className,$.colorsClassName=U.colorsClassName,U.dropdownBlock.appendChild($.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},F.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},F.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},F.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},F.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},F.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},F}(we),Ie=function(){function X(F,U){this.GRIP_SIZE=10,this.color=F,this.fillColor=U,this.visual=de.createGroup(),this.visual.appendChild(de.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(de.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return X.prototype.ownsTarget=function(F){return F===this.visual||F===this.visual.childNodes[0]||F===this.visual.childNodes[1]},X.prototype.setCenter=function(F,U){this.visual.childNodes.forEach(function($){return de.setAttributes($,[["cx",F.toString()],["cy",U.toString()]])})},X}(),_e=function(){function X(F,U,$,J){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=F,this.canvasHeight=U,this.margin=$,this.container=J,this.attachEvents=this.attachEvents.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.resize=this.resize.bind(this),this.adjustCropRect=this.adjustCropRect.bind(this),this.scaleCanvas=this.scaleCanvas.bind(this),this.getRescaledRect=this.getRescaledRect.bind(this)}return Object.defineProperty(X.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(F){this._aspectRatio=F,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(F){this._isGridVisible=F,this.gridContainer&&de.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(F){this._zoomFactor=F,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),X.prototype.open=function(){var F=this;this.cropShadeElement=de.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=de.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var U=0;U<this.numberOfGridLines;U++)this.horizontalGridLines.push(de.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(de.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function($){return F.gridContainer.appendChild($)}),this.verticalGridLines.forEach(function($){return F.gridContainer.appendChild($)}),this.cropRectElement=de.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Ie(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Ie(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Ie(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Ie(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},X.prototype.setCropRectangle=function(F){this.cropRect=F;var U=Object.assign({},this.cropRect);this.zoomFactor!==1&&(U.width=this.cropRect.width*this.zoomFactor,U.height=this.cropRect.height*this.zoomFactor,U.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-U.width/2,U.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-U.height/2),de.setAttributes(this.cropRectElement,[["x",U.x.toString()],["y",U.y.toString()],["width",U.width.toString()],["height",U.height.toString()]]);var $=U.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(W,H){var Q=U.y+$*(H+1);de.setAttributes(W,[["x1",""+U.x],["y1",""+Q],["x2",""+(U.x+U.width)],["y2",""+Q]])});var J=U.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(W,H){var Q=U.x+J*(H+1);de.setAttributes(W,[["x1",""+Q],["y1",""+U.y],["x2",""+Q],["y2",""+(U.y+U.height)]])}),de.setAttributes(this.cropShadeElement,[["d",de.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,U.x,U.y,U.width,U.height)]]),this.topLeftGrip.setCenter(U.x,U.y),this.topRightGrip.setCenter(U.x+U.width,U.y),this.bottomLeftGrip.setCenter(U.x,U.y+U.height),this.bottomRightGrip.setCenter(U.x+U.width,U.y+U.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},X.prototype.attachEvents=function(){this.container.style.touchAction="none",this.container.addEventListener("pointerdown",this.onPointerDown),this.container.addEventListener("pointermove",this.onPointerMove),this.container.addEventListener("pointerup",this.onPointerUp)},X.prototype.clientToLocalCoordinates=function(F,U){var $=this.container.getBoundingClientRect();return{x:F-$.left+this.margin,y:U-$.top+this.margin}},X.prototype.onPointerDown=function(F){this.container.setPointerCapture(F.pointerId),this.previousPoint=this.clientToLocalCoordinates(F.clientX,F.clientY),this.cropRectElement===F.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(F.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(F.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(F.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(F.target)&&(this.activeGrip=this.bottomRightGrip)},X.prototype.onPointerMove=function(F){if(this.isMoving)this.move(this.clientToLocalCoordinates(F.clientX,F.clientY));else if(this.activeGrip){var U=this.clientToLocalCoordinates(F.clientX,F.clientY);this.resize(U)}F.preventDefault()},X.prototype.onPointerUp=function(F){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(F.pointerId)},X.prototype.move=function(F){var U=F.x-this.previousPoint.x,$=F.y-this.previousPoint.y;this.zoomFactor!==1&&(U=-U/this.zoomFactor,$=-$/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+U),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+$),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=F},X.prototype.resize=function(F){var U=Object.assign({},this.cropRect),$=F.x-this.previousPoint.x,J=F.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:U.x+$<this.margin&&($=this.margin-U.x),U.x+=$,U.width=this.cropRect.x+this.cropRect.width-U.x;break;case this.bottomRightGrip:case this.topRightGrip:U.width+$>this.canvasWidth*this.zoomFactor&&($=this.canvasWidth*this.zoomFactor-U.width),U.width+=$}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(U.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength($),U.height=this.aspectRatio.getVerticalLength(U.width)):(U.y+=J,U.height=this.cropRect.y+this.cropRect.height-U.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?U.height=this.aspectRatio.getVerticalLength(U.width):U.height+=J}U.width<10&&(U.x=this.cropRect.x,U.width=10),U.height<10&&(U.y=this.cropRect.y,U.height=10),this.previousPoint=F,U.x>=this.margin&&U.y>=this.margin&&U.x-this.margin+U.width<=this.canvasWidth&&U.y-this.margin+U.height<=this.canvasHeight&&(this.cropRect=U,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},X.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var F=this.cropRect.x+this.cropRect.width/2,U=this.cropRect.y+this.cropRect.height/2,$=this.aspectRatio.getHorizontalLength(this.cropRect.height),J=this.aspectRatio.getVerticalLength(this.cropRect.width);$/this.canvasWidth<J/this.canvasHeight?this.cropRect.width=$:this.cropRect.height=J,this.cropRect.width>this.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=F-this.cropRect.width/2,this.cropRect.y=U-this.cropRect.height/2,this.cropRect.x+this.cropRect.width>this.margin+this.canvasWidth&&(this.cropRect.x=this.margin+this.canvasWidth-this.cropRect.width),this.cropRect.y+this.cropRect.height>this.margin+this.canvasHeight&&(this.cropRect.y=this.margin+this.canvasHeight-this.cropRect.height),this.cropRect.x=Math.max(this.cropRect.x,this.margin),this.cropRect.y=Math.max(this.cropRect.y,this.margin)}},X.prototype.getRescaledRect=function(F,U,$,J,W,H){var Q=$/F,Z=J/U;return{x:(W.x-H)*Q+H,y:(W.y-H)*Z+H,width:W.width*Q,height:W.height*Z}},X.prototype.scaleCanvas=function(F,U){var $=this.getRescaledRect(this.canvasWidth,this.canvasHeight,F,U,this.cropRect,this.margin);this.canvasWidth=F,this.canvasHeight=U,this.onCropChange&&this.onCropChange($),this.setCropRectangle($)},X}(),Me=function(){function X(F){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=F,this.uiContainer=document.createElement("div"),this.getUI=this.getUI.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.setAngleLabel=this.setAngleLabel.bind(this),this.positionScaleShape=this.positionScaleShape.bind(this)}return Object.defineProperty(X.prototype,"angle",{get:function(){return this._angle},set:function(F){this._angle=F,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),X.prototype.getUI=function(){return this.controlContainer=document.createElement("div"),this.controlContainer.title=this.title,this.controlContainer.className=this.className+" "+this.colorsClassName,this.controlContainer.appendChild(this.getVisual()),this.controlContainer.addEventListener("pointerdown",this.onPointerDown),this.controlContainer.addEventListener("pointermove",this.onPointerMove),this.controlContainer.addEventListener("pointerup",this.onPointerUp),this.uiContainer.appendChild(this.controlContainer),this.uiContainer.style.display="inline-block",this.uiContainer.style.touchAction="none",this.setAngleLabel(),this.positionScaleShape(),this.uiContainer},X.prototype.onPointerDown=function(F){this.controlContainer.setPointerCapture(F.pointerId),this.isDragging=!0,this.previousPoint={x:F.clientX,y:F.clientY}},X.prototype.onPointerMove=function(F){this.isDragging&&(this.onAngleChange&&this.onAngleChange((F.clientX-this.previousPoint.x)/5),this.previousPoint.x=F.clientX)},X.prototype.onPointerUp=function(F){this.isDragging&&this.onAngleChange&&this.onAngleChange((F.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(F.pointerId)},X.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var F=this.angleLabelText.getBBox();de.setAttributes(this.angleLabelElement,[["x",((this.width-F.width)/2).toString()],["y",(this.height/2).toString()]])}},X.prototype.positionScaleShape=function(){if(this.scaleShape){var F=this.scaleShape.transform.baseVal.getItem(0);F.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(F,0)}},X.prototype.getVisual=function(){var F=document.createElementNS("http://www.w3.org/2000/svg","svg");F.setAttribute("xmlns","http://www.w3.org/2000/svg"),F.setAttribute("width",this.width+"px"),F.setAttribute("height",this.height+"px"),F.setAttribute("viewBox","0 0 "+this.width+" "+this.height),F.style.flexShrink="0",document.body.appendChild(F);for(var U="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,$=1;$<=this.width/5+10;$++){var J=$%5==0?this.height/3:this.height/6;U+="h4v"+-J+"h1v"+J}U+="v1H0Z",this.scaleShape=de.createPath(U);var W=de.createTransform();this.scaleShape.transform.baseVal.appendItem(W),F.appendChild(this.scaleShape),this.angleLabelElement=de.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=de.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var H=de.createTSpan("");return H.innerHTML="&deg;",this.angleLabelElement.appendChild(H),F.appendChild(this.angleLabelElement),document.body.removeChild(F),F},X}(),Ue=function(){function X(){this.naturalSize=!1,this.imageType="image/png"}return X.prototype.rasterize=function(F,U,$,J,W,H,Q){var Z=this;return new Promise(function(ce){var ue=document.createElement("canvas");ue.width=F.width.baseVal.value-2*J,ue.height=F.height.baseVal.value-2*J;var ye=1,Fe=1;Z.naturalSize===!0?(ye=U.naturalWidth/(F.width.baseVal.value-2*J)/H,Fe=U.naturalHeight/(F.height.baseVal.value-2*J)/Q,ue.width=U.naturalWidth/H,ue.height=U.naturalHeight/Q):Z.width!==void 0&&Z.height!==void 0&&(ye=Z.width/$.width,Fe=Z.height/$.height,ue.width*=ye,ue.height*=Fe);var Ye=ue.getContext("2d");Ye.translate(ue.width/2,ue.height/2),Ye.rotate(W*Math.PI/180),Ye.scale(H,Q),Ye.translate(-ue.width/2,-ue.height/2),Ye.drawImage(U,0,0,ue.width,ue.height);var ze=document.createElement("canvas");ze.width=$.width*ye,ze.height=$.height*Fe,ze.getContext("2d").putImageData(Ye.getImageData(($.x-J)*ye,($.y-J)*Fe,$.width*ye,$.height*Fe),0,0),ce(ze.toDataURL(Z.imageType,Z.imageQuality))})},X}(),je=function(){function X(F){this._zoomToCropEnabled=!0,this.zoomFactor=1,this.flippedHorizontally=!1,this.flippedVertically=!1,this._isGridVisible=!0,this._gridLines=2,this._rotationAngle=0,this.scaleFactor=1,this.renderEventListeners=[],this.closeEventListeners=[],this._isOpen=!1,this.CANVAS_MARGIN=20,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.displayMode="inline",this.popupMargin=30,this.toolbarHeight=40,this.aspectRatios=[{horizontal:0,vertical:0},{horizontal:4,vertical:3},{horizontal:3,vertical:2},{horizontal:16,vertical:9},{horizontal:1,vertical:1},{horizontal:3,vertical:4},{horizontal:2,vertical:3},{horizontal:9,vertical:16}],this._instanceNo=X.instanceCounter++,this.styles=new nt(this.instanceNo),this.target=F,this.targetRoot=document.body,this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.rotateBy=this.rotateBy.bind(this),this.applyRotation=this.applyRotation.bind(this),this.cropRectChanged=this.cropRectChanged.bind(this),this.zoomToCrop=this.zoomToCrop.bind(this),this.unzoomFromCrop=this.unzoomFromCrop.bind(this),this.rotateLeftButtonClicked=this.rotateLeftButtonClicked.bind(this),this.rotateRightButtonClicked=this.rotateRightButtonClicked.bind(this),this.flipHorizontallyButtonClicked=this.flipHorizontallyButtonClicked.bind(this),this.flipVerticallyButtonClicked=this.flipVerticallyButtonClicked.bind(this),this.applyFlip=this.applyFlip.bind(this),this.startRenderAndClose=this.startRenderAndClose.bind(this),this.render=this.render.bind(this),this.onPopupResize=this.onPopupResize.bind(this),this.applyAspectRatio=this.applyAspectRatio.bind(this)}return Object.defineProperty(X.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(F){this._zoomToCropEnabled=F,F?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(F){this._isGridVisible=F,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"gridLines",{get:function(){return this._gridLines},set:function(F){this._gridLines=F,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(F){this._rotationAngle=F,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"aspectRatio",{get:function(){var F;return(F=this._aspectRatio)!==null&&F!==void 0?F:this.aspectRatios[0]},set:function(F){this._aspectRatio=F},enumerable:!1,configurable:!0}),X.prototype.open=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.setupResizeObserver(),this.initCropCanvas(),this.setEditingTarget(),this.setTopLeft(),this.initCropLayer(),this.attachEvents(),this.applyAspectRatio(),this.displayMode==="popup"&&this.onPopupResize(),this._isOpen=!0},X.prototype.show=function(){this.showUI(),this.open()},X.prototype.close=function(F){F===void 0&&(F=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),F||this.closeEventListeners.forEach(function(U){return U()}),this._isOpen=!1)},X.prototype.addRenderEventListener=function(F){this.renderEventListeners.push(F)},X.prototype.removeRenderEventListener=function(F){this.renderEventListeners.indexOf(F)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(F),1)},X.prototype.addCloseEventListener=function(F){this.closeEventListeners.push(F)},X.prototype.removeCloseEventListener=function(F){this.closeEventListeners.indexOf(F)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(F),1)},X.prototype.setupResizeObserver=function(){var F=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){F.resize(F.target.clientWidth,F.target.clientHeight)}),this.targetObserver.observe(this.target)):this.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},X.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var F=1*this.target.clientWidth/this.target.clientHeight,U=this.contentDiv.clientWidth/F>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*F:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,$=U+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/F;this.resize(U,$)}},X.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},X.prototype.setEditingTargetSize=function(){this.editorCanvas.style.width=this.imageWidth+2*this.CANVAS_MARGIN+"px",this.editorCanvas.style.height=this.imageHeight+2*this.CANVAS_MARGIN+"px",de.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},X.prototype.resize=function(F,U){this.imageWidth=Math.round(F),this.imageHeight=Math.round(U),this.setEditingTargetSize(),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.displayMode!=="popup"?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},X.prototype.setEditingTarget=function(){var F=document.createElement("canvas");F.width=this.target.naturalWidth,F.height=this.target.naturalHeight,F.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var U=F.toDataURL();de.setAttributes(this.editingTarget,[["href",U]]),this.setEditingTargetSize()},X.prototype.setTopLeft=function(){var F=this.target.getBoundingClientRect(),U=this.editorCanvas.getBoundingClientRect();this.left=F.left-U.left-this.CANVAS_MARGIN,this.top=F.top-U.top-this.CANVAS_MARGIN},X.prototype.initCropCanvas=function(){this.cropImageHolder=document.createElement("div"),this.cropImageHolder.style.setProperty("touch-action","none"),this.cropImageHolder.style.setProperty("-ms-touch-action","none"),this.cropImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.cropImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImage.style.pointerEvents="auto",this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.cropImageHolder.style.transformOrigin="top left",this.positionCropImage(),this.defs=de.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=de.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=de.createGroup(),this.editingTargetRotationScaleContainer=de.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var F=de.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(F);var U=de.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(U),this.editingTargetContainer=de.createGroup(),this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px)",this.editingTargetContainer.appendChild(this.editingTargetRotationContainer),this.cropImage.appendChild(this.editingTargetContainer),this.cropImageHolder.appendChild(this.cropImage),this.editorCanvas.appendChild(this.cropImageHolder)},X.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},X.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=de.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new _e(this.imageWidth,this.imageHeight,this.CANVAS_MARGIN,this.cropLayerContainer),this.cropLayer.onCropChange=this.cropRectChanged,this.cropLayer.numberOfGridLines=this.gridLines,this.cropLayer.isGridVisible=this.isGridVisible,this.cropLayer.cropShadeColor=this.styles.settings.cropShadeColor,this.cropLayer.cropFrameColor=this.styles.settings.cropFrameColor,this.cropLayer.gripColor=this.styles.settings.gripColor,this.cropLayer.gripFillColor=this.styles.settings.gripFillColor,this.cropLayer.open(),this.cropLayer.setCropRectangle(this.cropRect),this.zoomToCropEnabled&&this.zoomToCrop()},X.prototype.zoomToCrop=function(){if(this.cropRect){var F=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,U=this.cropRect.y-this.CANVAS_MARGIN+this.cropRect.height/2;this.zoomFactor=Math.min(this.imageWidth/this.cropRect.width,this.imageHeight/this.cropRect.height),this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin=F+"px "+U+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-F+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-U+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},X.prototype.unzoomFromCrop=function(){this.zoomFactor=1,this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin="center",this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px) scale(1)",this.cropLayer.zoomFactor=this.zoomFactor)},X.prototype.cropRectChanged=function(F){this.cropRect=F,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},X.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},X.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},X.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},X.prototype.showUI=function(){switch(this.addStyles(),this.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.displayMode){case"inline":this.coverDiv.style.position="absolute";var F=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,U=this.target.offsetTop>F+this.CANVAS_MARGIN?this.target.offsetTop-(F+this.CANVAS_MARGIN):0;this.coverDiv.style.top=U+"px",this.coverDiv.style.left=(this.target.offsetLeft>this.CANVAS_MARGIN?this.target.offsetLeft-this.CANVAS_MARGIN:0)+"px",this.coverDiv.style.width=this.target.offsetWidth+this.CANVAS_MARGIN+"px",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.displayMode==="popup"?this.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.addToolbars(),this.uiDiv.appendChild(this.topToolbar.getUI()),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.alignItems="center",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.contentDiv.style.overflow="hidden",this.contentDiv.style.backgroundColor=this.styles.settings.canvasBackgroundColor,this.displayMode==="popup"&&(this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.popupMargin+"px)"),this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.contentDiv.appendChild(this.editorCanvas),this.uiDiv.appendChild(this.bottomToolbar.getUI()),this.straightener.angle=this.rotationAngle},X.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},X.prototype.addTopToolbar=function(){var F=this;this.topToolbar=new We,this.topToolbar.display=this.styles.settings.hideTopToolbar?"none":"",this.topToolbar.className=this.toolbarStyleClass.name,this.topToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.topToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.topToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.topToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.topToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.topToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var U=new Te;U.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(U);var $=[];this.aspectRatios.forEach(function(Fe){var Ye=new we(De.getIcon(Fe.horizontal,Fe.vertical),Fe.horizontal===0&&Fe.vertical===0?"FREE":Fe.horizontal+":"+Fe.vertical);Ye.onClick=function(){return F.ratioButtonClicked(Fe)},$.push(Ye)}),this.aspectRatioButton=new Ee(De.getIcon(0,0),"Aspect ratio",$),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,U.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var J=new we('<svg viewBox="0 0 24 24"><path d="M10 4v4h4V4h-4m6 0v4h4V4h-4m0 6v4h4v-4h-4m0 6v4h4v-4h-4m-2 4v-4h-4v4h4m-6 0v-4H4v4h4m0-6v-4H4v4h4m0-6V4H4v4h4m2 6h4v-4h-4v4M4 2h16a2 2 0 012 2v16a2 2 0 01-2 2H4c-1.08 0-2-.9-2-2V4a2 2 0 012-2z"/></svg>',"Toggle grid");J.isActive=this.isGridVisible,J.onClick=function(){F.isGridVisible=!F.isGridVisible,J.isActive=F.isGridVisible},U.addButton(J);var W=new we('<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"Zoom to selection");if(W.isActive=this.zoomToCropEnabled,W.onClick=function(){F.zoomToCropEnabled=!F.zoomToCropEnabled,W.isActive=F.zoomToCropEnabled},U.addButton(W),!me.isLicensed){var H=new Oe;this.topToolbar.addElementBlock(H);var Q=document.createElement("div");Q.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var Z=document.createElement("a");Z.style.color="currentColor",Z.href="https://markerjs.com/products/cropro",Z.target="_blank",Z.innerHTML='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M16.326 14.895c0 1.126-.558 1.688-1.673 1.688H9.931c-1.116 0-1.674-.562-1.674-1.688V3.733c0-1.126.558-1.688 1.674-1.688h4.722c1.115 0 1.673.562 1.673 1.688v2.899h-1.957V3.793h-4.124v11.042h4.124v-3.242h1.957v3.302z" fill="currentColor"/><path d="M15.94 7.364a.783.783 0 00-1.065-.304l-11.01 6.126a.783.783 0 00-.303 1.065l4.498 8.085a.783.783 0 001.065.304l11.01-6.126a.783.783 0 00.303-1.065L15.94 7.364zM5.311 14.173l3.737 6.718 9.641-5.364-3.737-6.718-9.641 5.364z" fill="#eef762"/></svg>',Q.appendChild(Z),H.addElement(Q)}var ce=new Te;ce.minWidth=3*this.toolbarHeight+"px",ce.contentAlign="end",this.topToolbar.addButtonBlock(ce);var ue=new we('<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"OK");ue.onClick=this.startRenderAndClose,ce.addButton(ue),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(ue.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var ye=new we('<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"Close");ye.onClick=this.close,ce.addButton(ye),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(ye.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},X.prototype.addBottomToolbar=function(){var F=this;this.bottomToolbar=new We,this.bottomToolbar.display=this.styles.settings.hideBottomToolbar?"none":"",this.bottomToolbar.className=this.toolbarStyleClass.name,this.bottomToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.bottomToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.bottomToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.bottomToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.bottomToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.bottomToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var U=new Te;U.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(U);var $=new we('<svg viewBox="0 0 24 24"><path d="M13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93M7.1 18.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32M6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47m1.02-4.47L5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47z"/></svg>',"Rotate left");$.onClick=this.rotateLeftButtonClicked,U.addButton($);var J=new we('<svg viewBox="0 0 24 24"><path d="M16.89 15.5l1.42 1.39c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.5M13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03m6.93-6.9a7.906 7.906 0 00-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47m-2.36-5.45L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45z"/></svg>',"Rotate right");J.onClick=this.rotateRightButtonClicked,U.addButton(J);var W=new Oe;W.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(W),this.straightener=new Me("Straighten"),this.straightener.className=this.toolbarStraightenerStyleClass.name,this.straightener.colorsClassName=this.styles.settings.toolbarStraightenerColorsClassName?this.styles.settings.toolbarStraightenerColorsClassName:this.toolbarStraightenerStyleColorsClass.name,this.straightener.onAngleChange=function(ce){F.rotateBy(ce),F.straightener.angle=F.rotationAngle},W.addElement(this.straightener.getUI());var H=new Te;H.minWidth=2*this.toolbarHeight+"px",H.contentAlign="end",this.bottomToolbar.addButtonBlock(H);var Q=new we('<svg viewBox="0 0 24 24"><path d="M15 21h2v-2h-2m4-10h2V7h-2M3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2m16-2v2h2c0-1.1-.9-2-2-2m-8 20h2V1h-2m8 16h2v-2h-2M15 5h2V3h-2m4 10h2v-2h-2m0 10c1.1 0 2-.9 2-2h-2z"/></svg>',"Flip horizontal");Q.onClick=this.flipHorizontallyButtonClicked,H.addButton(Q);var Z=new we('<svg viewBox="0 0 24 24"><path d="M3 15v2h2v-2m10 4v2h2v-2m2-16H5c-1.1 0-2 .9-2 2v4h2V5h14v4h2V5c0-1.1-.9-2-2-2m2 16h-2v2c1.1 0 2-.9 2-2M1 11v2h22v-2M7 19v2h2v-2m10-4v2h2v-2m-10 4v2h2v-2M3 19c0 1.1.9 2 2 2v-2z"/></svg>',"Flip vertical");Z.onClick=this.flipVerticallyButtonClicked,H.addButton(Z)},X.prototype.ratioButtonClicked=function(F){this.aspectRatio=F,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},X.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=De.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},X.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Ne(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},X.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},X.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},X.prototype.restoreState=function(F){if(F){var U=this.cropLayer.getRescaledRect(F.width,F.height,this.imageWidth,this.imageHeight,F.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(U),this.cropRectChanged(U),this.flippedHorizontally=F.flippedHorizontally,this.flippedVertically=F.flippedVertically,this.applyFlip(),this.rotationAngle=F.rotationAngle,this.applyRotation()}},X.prototype.clientToLocalCoordinates=function(F,U){var $=this.cropImage.getBoundingClientRect();return{x:F-$.left,y:U-$.top}},X.prototype.onWindowResize=function(){this.positionUI()},X.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var F=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=F+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)"}this.positionCropImage()},X.prototype.rotateLeftButtonClicked=function(){var F=this.rotationAngle-90;this.rotationAngle%90!=0&&(F+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(F)},X.prototype.rotateRightButtonClicked=function(){var F=this.rotationAngle+90;this.rotationAngle%90!=0&&(F-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(F)},X.prototype.rotateTo=function(F){F=(F=F>180?F-360:F)<=-180?F+360:F,this.rotationAngle=F,this.applyRotation()},X.prototype.rotateBy=function(F){this.rotateTo((this.rotationAngle+F)%360)},X.prototype.applyRotation=function(){var F=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var U=this.editingTargetRotationContainer.transform.baseVal.getItem(0);U.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(U,0);var $=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/$.width,this.imageHeight/$.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=F},X.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},X.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},X.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},X.prototype.startRenderAndClose=function(){return Le(this,void 0,void 0,function(){var F,U;return ge(this,function($){switch($.label){case 0:return[4,this.render()];case 1:return F=$.sent(),U=this.getState(),this.renderEventListeners.forEach(function(J){return J(F,U)}),this.close(!0),[2]}})})},X.prototype.render=function(){return Le(this,void 0,void 0,function(){var F;return ge(this,function(U){switch(U.label){case 0:return(F=new Ue).naturalSize=this.renderAtNaturalSize,F.imageType=this.renderImageType,F.imageQuality=this.renderImageQuality,F.width=this.renderWidth,F.height=this.renderHeight,this.unzoomFromCrop(),de.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,F.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 1:return U.sent(),[4,F.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 2:return[2,U.sent()]}})})},X.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new qe("toolbar",`
width: `+(this.displayMode==="inline"?"100%":"calc(100vw - "+2*this.popupMargin+"px)")+`;
flex-shrink: 0;
display: flex;
flex-direction: row;
justify-content: space-between;
height: `+this.toolbarHeight+`px;
box-sizing: content-box;
overflow: hidden;
line-height: 0px;
`)),this.toolbarStyleColorsClass=this.styles.addClass(new qe("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new qe("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var F=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new qe("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*F)+`px;
height: `+(this.toolbarHeight-2*F)+`px;
padding: `+F+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new qe("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new qe("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new Qe("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new Qe("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new qe("toolbar_dropdown",`
position: absolute;
max-width: `+4*this.toolbarHeight+`px;
z-index: 20;
white-space: normal;
box-sizing: content-box;
box-shadow: 3px 3px rgba(33, 33, 33, 0.1);
margin: `+(this.displayMode==="inline"?"0":this.popupMargin)+`px;
line-height: 0px;
`)),this.toolbarDropdownStyleColorsClass=this.styles.addClass(new qe("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new qe("toolbar_straightener_block",`
display: flex;
overflow: hidden;
justify-content: center;
-webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 30%, rgba(0,0,0,1) 70%, rgba(0,0,0,0) 100%);
`)),this.toolbarStraightenerStyleClass=this.styles.addClass(new qe("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*F)+`px;
padding: `+F+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new qe("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},X.instanceCounter=0,X}(),Ge=be("8hTe"),Ke=be.n(Ge),Ae=/<pre[^>]*>/g;function Xe(X){var F=document.createElement("div");return F.innerHTML=X,F.childNodes.length===0?"":F.childNodes[0].nodeValue}var Ve=ct.a=function(X){var F=X.value,U=F===void 0?"":F,$=X.edit,J=$===void 0?!1:$,W=X.className,H=X.showTextOnly,Q=X.showLines,Z=X.replaces,ce=X.zoomImg,ue=X.hasMask,ye=X.style,Fe=ye===void 0?{}:ye,Ye=X.stylesPrev,ze=Ye===void 0?{}:Ye,dt=String(U),et=Object(A.useRef)(),Ze=Object(A.useRef)(),gt=Object(A.useState)(""),lt=Object(G.a)(gt,2),Et=lt[0],ft=lt[1],at=Object(A.useState)("office"),St=Object(G.a)(at,2),Nt=St[0],ht=St[1],Mt=function(){var ot=new je(Ze.current);ot.displayMode="popup",ot.addRenderEventListener(function(){var Dt=Object(L.a)(_.a.mark(function it(Ct){var pt;return _.a.wrap(function(vt){for(;;)switch(vt.prev=vt.next){case 0:return et.current.style.display="none",vt.next=3,Object(ve.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Ct}});case 3:pt=vt.sent,pt!=null&&pt.id&&Z(Ze.current.getAttribute("src").replace(se.a.API_SERVER,""),"/api/attachments/".concat(pt==null?void 0:pt.id,"?type=").concat(pt.content_type));case 5:case"end":return vt.stop()}},it)}));return function(it){return Dt.apply(this,arguments)}}()),ot.show()},Ut=function(){var ot=new Se.a(Ze.current);ot.settings.displayMode="popup",ot.addEventListener("render",function(){var Dt=Object(L.a)(_.a.mark(function it(Ct){var pt;return _.a.wrap(function(vt){for(;;)switch(vt.prev=vt.next){case 0:if(et.current.style.display="none",!Ze.current){vt.next=6;break}return vt.next=4,Object(ve.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Ct.dataUrl}});case 4:pt=vt.sent,pt!=null&&pt.id&&Z(Ze.current.getAttribute("src").replace(se.a.API_SERVER,""),"/api/attachments/".concat(pt==null?void 0:pt.id,"?type=").concat(pt.content_type));case 6:case"end":return vt.stop()}},it)}));return function(it){return Dt.apply(this,arguments)}}()),ot.show(),window.markerArea=ot},_t=Object(A.useMemo)(function(){et.current&&(et.current.style.zIndex=-1);try{var xt=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,ot=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Dt=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;dt=dt.replace(xt,"("+se.a.API_SERVER+"/api/attachments/").replace(ot,'"'+se.a.API_SERVER+"/api/attachments/").replace(Dt,'"'+se.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
`)}catch(zt){}var it=K(dt),Ct=v();if(dt.match(/\[TOC\]/)&&(it=it.replace("<p>[TOC]</p>",b()),p()),it=it.replace(/(__special_katext_id_\d+__)/g,function(zt,vt){var or=Ct[vt],lr=or.type,Ft=or.expression;return Object(fe.renderToString)(Xe(Ft)||"",{displayMode:lr==="block",throwOnError:!1,output:"html"})}),it=it.replace(/▁/g,"\u2581\u2581\u2581"),g(),H){var pt=document.createElement("div");return pt.innerHTML=it,pt.innerText}return setTimeout(function(){return yr()},500),it},[dt]),Lt=Object(A.useRef)();d.WebkitLineClamp=Q,Q&&(Fe=Object(R.a)(Object(R.a)({},Fe),d));function Vt(xt){var ot=xt.target;if(ot.tagName.toUpperCase()==="IMG"){if(ce){var Dt=ot.getAttribute("src");ft(Dt),ht("image")}}else if(ot.tagName.toUpperCase()==="A"){var it=ot.getAttribute("href");if(it.indexOf("office")>-1)xt.preventDefault(),ft(it),ht("office");else if(it.indexOf("application/pdf")>-1)xt.preventDefault(),ft(it),ht("pdf");else if(it.indexOf("text/html")>-1)xt.preventDefault(),ft(it),ht("html");else if(it.startsWith("#")){xt.preventDefault();var Ct=document.getElementById(it.replace("#",""));Ct&&Ct.scrollIntoView(!0)}}}var yr=function(){var ot,Dt=(ot=Lt.current)===null||ot===void 0?void 0:ot.querySelectorAll("video");Dt==null||Dt.forEach(function(it){if(it.oncontextmenu=function(){return!1},it.src.indexOf(".m3u8")>-1&&!it.canPlayType("application/vnd.apple.mpegurl")){if(q.a.isSupported()){var Ct=new q.a;Ct.loadSource(it.src),Ct.attachMedia(it)}}})};Object(A.useEffect)(function(){if(Lt.current&&_t&&(_t.match(Ae)&&window.PR.prettyPrint()),Lt.current)return Lt.current.addEventListener("click",Vt),function(){Lt.current.removeEventListener("click",Vt),g(),p()}},[_t,Lt.current,Vt]);var br=function(ot){if(!J)return;ot.target.nodeName==="IMG"?(et.current.style.zIndex=1,et.current.style.display="flex",et.current.style.width=ot.target.clientWidth+"px",et.current.style.height=ot.target.clientHeight+"px",et.current.style.top=ot.target.offsetTop+"px",et.current.style.left=ot.target.offsetLeft+"px",Ze.current.src=ot.target.getAttribute("src")):et.current.style.display="none"};return y.a.createElement("div",{style:{position:"relative"}},y.a.createElement("div",{ref:Lt,style:Object(R.a)({},Fe),className:"".concat(W||""," markdown-body ").concat(Ke.a.mdBody),onMouseOver:br,dangerouslySetInnerHTML:{__html:_t}}),y.a.createElement("div",{ref:et,className:Ke.a.button},y.a.createElement(j.a,null,y.a.createElement(B.a,{onClick:function(){return Mt()}},"\u88C1\u526A"),y.a.createElement(B.a,{onClick:function(){return Ut()}},"\u7F16\u8F91"))),y.a.createElement("img",{ref:Ze,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),y.a.createElement(le.a,{close:!0,data:Et,type:Et!=null&&Et.length?Nt:"",style:Object(R.a)({},ze),onClose:function(){return ft("")}}))}},"9ZNV":function(mt,ct,be){"use strict";be.d(ct,"a",function(){return A});var he=be("0Owb"),j=be("+L6B"),D=be("2/Rp"),B=be("q1tI"),R=be.n(B),L=be("UUDw"),G=be.n(L),O=be("TSYQ"),_=be.n(O),A=function(S){var C=S.cancelText,T=C===void 0?"\u53D6\u6D88":C,E=S.okText,x=E===void 0?"\u786E\u5B9A":E,l=S.loading,r=l===void 0?!1:l,s=S.hasOkBtn,n=s===void 0?!0:s,p=S.okButtonProps,d=p===void 0?{}:p,c=S.onCancel,b=c===void 0?function(){}:c,f=S.onOk,u=f===void 0?function(){}:f,o=S.className,a=o===void 0?"":o;return R.a.createElement("div",{className:_()(G.a.buttonFixed,a)},R.a.createElement("div",{className:G.a.buttonWrap},R.a.createElement(D.a,{size:"large",className:"".concat(G.a.button," mr20"),onClick:b},T),n&&R.a.createElement(D.a,Object(he.a)({size:"large",type:"primary",className:"".concat(G.a.button," mr20"),loading:r,onClick:u},d),x)))}},DaK5:function(mt,ct,be){"use strict";be.r(ct),be.d(ct,"formatTypeNameToDefaultScore",function(){return f});var he=be("0Owb"),j=be("sPJy"),D=be("bE4q"),B=be("9og8"),R=be("giR+"),L=be("fyUT"),G=be("2qtc"),O=be("kLXV"),_=be("k1fw"),A=be("tJVT"),y=be("PpiC"),S=be("WmNS"),C=be.n(S),T=be("q1tI"),E=be.n(T),x=be("9kvl"),l=be("ngQI"),r=be("NNiE"),s=be("tKIZ"),n=be.n(s),p=be("9ZNV"),d=be("LvDl"),c=be.n(d),b=be("WCUW"),f=function(a){var i={\u5355\u9009\u9898:2,\u591A\u9009\u9898:5,\u586B\u7A7A\u9898:2,\u5224\u65AD\u9898:2,\u7B80\u7B54\u9898:10,\u7F16\u7A0B\u9898:10,\u5B9E\u8BAD\u9898:5,\u7EC4\u5408\u9898:10};return i[a]||0},u=function(a){var i,v,g,m,w=a.problemsetPreview,P=a.user,N=a.globalSetting,K=a.loading,Y=a.dispatch,ne=Object(y.a)(a,["problemsetPreview","user","globalSetting","loading","dispatch"]),q=Object(T.useState)(),se=Object(A.a)(q,2),fe=se[0],le=se[1],ve=Object(T.useState)(),Se=Object(A.a)(ve,2),ke=Se[0],Ce=Se[1],Le=Object(T.useRef)();console.log(w,"problemsetPreview"),Object(T.useEffect)(function(){return Y({type:"globalSetting/footerToggle",payload:!1}),function(){Y({type:"globalSetting/footerToggle",payload:!0})}},[]),Object(T.useEffect)(function(){ge()},[]);var ge=function(){Y({type:"problemsetPreview/getPaperData"})},me=function(xe,Te){var we=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],Oe=arguments.length>3?arguments[3]:void 0,Ne=arguments.length>4?arguments[4]:void 0,De=c.a.cloneDeep(Ne),Ee=c.a.cloneDeep(we).map(function(_e){return Object(_.a)(Object(_.a)({},_e),{},{challenge_score:_e.challenge_score||5})});if(Le.current=Oe||f(Te),Te==="\u5B9E\u8BAD\u9898")return O.a.confirm({centered:!0,width:530,title:"\u8BBE\u7F6E\u5206\u6570",content:E.a.createElement("div",{className:n.a.shixunModal},E.a.createElement("div",null,"\u5173\u5361\uFF1A"),Ee==null?void 0:Ee.map(function(_e,Me){return E.a.createElement("div",{className:n.a.shixunScore},Me+1,"\u3001",_e.challenge_name,E.a.createElement("div",{style:{minWidth:"130px"}},E.a.createElement(L.a,{defaultValue:_e.challenge_score,min:1,onChange:function(je){_e.challenge_score=je}}),E.a.createElement("span",{className:"ml5"},"\u5206/\u9898")))})),okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var _e=Object(B.a)(C.a.mark(function Ue(){return C.a.wrap(function(Ge){for(;;)switch(Ge.prev=Ge.next){case 0:return Ge.next=2,Object(b.O)({id:xe,challenge_scores:Ee.map(function(Ke){return{challenge_id:Ke.challenge_id,score:Ke.challenge_score}})});case 2:Le.current=null,ge();case 4:case"end":return Ge.stop()}},Ue)}));function Me(){return _e.apply(this,arguments)}return Me}()});if(Te==="\u7EC4\u5408\u9898"){var Ie;return O.a.confirm({centered:!0,width:530,title:"\u8BBE\u7F6E\u5206\u6570",content:E.a.createElement("div",{className:n.a.shixunModal,style:{maxHeight:200,overflow:"auto"}},De==null||((Ie=De.sub_questions)===null||Ie===void 0)?void 0:Ie.map(function(_e,Me){return E.a.createElement("div",{className:n.a.shixunScore},"\u7B2C",Me+1,"\u5C0F\u9898",E.a.createElement("div",{style:{minWidth:"130px"}},E.a.createElement(L.a,{defaultValue:_e.score,min:1,onChange:function(je){_e.score=je}}),E.a.createElement("span",{className:"ml5"},"\u5206")))})),okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var _e=Object(B.a)(C.a.mark(function Ue(){var je;return C.a.wrap(function(Ke){for(;;)switch(Ke.prev=Ke.next){case 0:return Ke.next=2,Object(b.P)({id:xe,subs:De==null||((je=De.sub_questions)===null||je===void 0)?void 0:je.map(function(Ae){return{basket_id:Ae.basket_id,score:Ae.score}})});case 2:Le.current=null,ge();case 4:case"end":return Ke.stop()}},Ue)}));function Me(){return _e.apply(this,arguments)}return Me}()})}O.a.confirm({centered:!0,title:"\u8BBE\u7F6E\u5206\u6570",content:E.a.createElement("div",{className:""},E.a.createElement("span",null,"\u672C\u9898\u5206\u503C\uFF1A"),E.a.createElement(L.a,{min:1,defaultValue:Le.current,onChange:function(Me){Le.current=Me}}),E.a.createElement("span",{className:"ml5"},"\u5206/\u9898"),E.a.createElement("br",null),Te==="\u586B\u7A7A\u9898"&&E.a.createElement("div",{style:{color:"rgb(255, 0, 0)"}},"\u6BCF\u7A7A\u5206\u503C\u6309\u6BCF\u9898\u5206\u503C\u53D6\u5E73\u5747\u5206\u8BA1\u7B97")),okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var _e=Object(B.a)(C.a.mark(function Ue(){return C.a.wrap(function(Ge){for(;;)switch(Ge.prev=Ge.next){case 0:return Ge.next=2,Y({type:"problemsetPreview/setScore",payload:{id:xe,score:Le.current}});case 2:Le.current=null,ge();case 4:case"end":return Ge.stop()}},Ue)}));function Me(){return _e.apply(this,arguments)}return Me}()})},de=function(xe){O.a.confirm({centered:!0,title:"\u63D0\u793A",content:E.a.createElement("div",{className:n.a.modal},"\u786E\u8BA4\u5220\u9664\u8BE5\u8BD5\u9898\uFF1F"),okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var Te=Object(B.a)(C.a.mark(function Oe(){return C.a.wrap(function(De){for(;;)switch(De.prev=De.next){case 0:return De.next=2,Y({type:"problemsetPreview/handleDelete",payload:{id:xe}});case 2:ge();case 3:case"end":return De.stop()}},Oe)}));function we(){return Te.apply(this,arguments)}return we}()})},nt=function(xe,Te){Le.current=f(Te),O.a.confirm({centered:!0,title:"\u6279\u91CF\u8BBE\u7F6E\u5206\u6570",content:E.a.createElement("div",{className:""},E.a.createElement("span",null,Te==="\u7EC4\u5408\u9898"?"\u7EC4\u5408\u9898\u4E2D\u7684\u6BCF\u5C0F\u9898":Te,"\uFF1A"),E.a.createElement(L.a,{min:1,defaultValue:Le.current,onChange:function(Oe){Le.current=Oe}}),E.a.createElement("span",{className:"ml5"},"\u5206/\u9898"),E.a.createElement("br",null),Te==="\u586B\u7A7A\u9898"&&E.a.createElement("div",{style:{color:"rgb(255, 0, 0)"}},"\u6BCF\u7A7A\u5206\u503C\u6309\u6BCF\u9898\u5206\u503C\u53D6\u5E73\u5747\u5206\u8BA1\u7B97")),okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var we=Object(B.a)(C.a.mark(function Ne(){return C.a.wrap(function(Ee){for(;;)switch(Ee.prev=Ee.next){case 0:return Ee.next=2,Y({type:"problemsetPreview/batchSetScore",payload:{item_type:xe,score:Le.current}});case 2:Le.current=null,ge();case 4:case"end":return Ee.stop()}},Ne)}));function Oe(){return we.apply(this,arguments)}return Oe}()})},Qe=function(xe){O.a.confirm({centered:!0,title:"\u63D0\u793A",content:E.a.createElement("div",{className:n.a.modalColumn},E.a.createElement("p",null,"\u5220\u9664\u5927\u9898\uFF0C\u5C06\u5220\u9664\u8BE5\u5927\u9898\u4E0B\u6240\u6709\u5C0F\u9898"),E.a.createElement("p",null,"\u786E\u8BA4\u5220\u9664\u8BE5\u5927\u9898\uFF1F")),okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var Te=Object(B.a)(C.a.mark(function Oe(){return C.a.wrap(function(De){for(;;)switch(De.prev=De.next){case 0:return De.next=2,Y({type:"problemsetPreview/batchDelete",payload:{item_type:xe}});case 2:ge();case 3:case"end":return De.stop()}},Oe)}));function we(){return Te.apply(this,arguments)}return we}()})},qe=function(){var We=Object(B.a)(C.a.mark(function xe(Te,we){var Oe,Ne,De;return C.a.wrap(function(Ie){for(;;)switch(Ie.prev=Ie.next){case 0:if(!(!Te.destination||!Te.source)){Ie.next=2;break}return Ie.abrupt("return");case 2:return Oe=we.questions[Te.source.index].id,Ne=Te.destination.index+1,Ie.next=6,Y({type:"problemsetPreview/adjustPosition",payload:{id:Oe,position:Ne}});case 6:if(De=Ie.sent,!(De.status===-1)){Ie.next=9;break}return Ie.abrupt("return");case 9:ge();case 10:case"end":return Ie.stop()}},xe)}));return function(Te,we){return We.apply(this,arguments)}}();return E.a.createElement("section",{className:n.a.bg},E.a.createElement(D.a,{className:"mt30",separator:">"},E.a.createElement(D.a.Item,null,"\u8BD5\u9898\u5E93"),E.a.createElement(D.a.Item,{href:"/problemset"},"\u4EBA\u5DE5\u7EC4\u5377"),E.a.createElement(D.a.Item,null,"\u8BD5\u5377\u9884\u89C8")),E.a.createElement("div",{className:n.a.wrap},E.a.createElement("div",{className:"pt20 pb20"},E.a.createElement("div",{className:"".concat(n.a.flexRow," ").concat(n.a.flexJustifyBetween)},E.a.createElement("div",null,E.a.createElement("span",{className:n.a.questionNumber},"\u9898\u6570\uFF1A",(i=w.paperData)===null||i===void 0?void 0:i.all_questions_count),E.a.createElement("span",{className:n.a.score},"\u603B\u5206\uFF1A",(v=w.paperData)===null||v===void 0?void 0:v.all_score)),E.a.createElement("div",{className:n.a.selectTopicButton,onClick:function(){return x.d.push("/problemset/preview_select")}},"\u7EE7\u7EED\u9009\u9898")),E.a.createElement("div",{className:n.a.line}),E.a.createElement("div",{className:n.a.dragTip},"\u5C0F\u9898\u4E4B\u95F4\u53EF\u4EE5\u62D6\u52A8\u6392\u5E8F"),(g=w.paperData)===null||g===void 0||((m=g.questionList)===null||m===void 0)?void 0:m.map(function(We,xe){var Te=We.type===ke;return console.log(We,"paperItem"),E.a.createElement("div",{className:"".concat(n.a.relative," mt20 mb20"),key:xe},E.a.createElement("div",{className:"".concat(n.a.typeActive," ").concat(Te?n.a.mouseTypeActive:""),onMouseEnter:function(){Ce(We.type),le(null)}},E.a.createElement("span",{className:"".concat(n.a.typeName," ").concat(Te?"ml20":"")},We.number,"\u3001",We.name),E.a.createElement("span",{className:n.a.typeNumber},"\uFF08\u5171",We.questions_count,"\u9898\uFF0C",(We==null?void 0:We.type)==="COMBINATION"?"\u5305\u542B".concat(We==null?void 0:We.sub_questions_count,"\u5C0F\u9898\uFF0C"):"","\u5171",We.questions_score,"\u5206\uFF09")),Te&&E.a.createElement("div",{className:"".concat(n.a.typeAction," ").concat(n.a.flexRow)},We.type!=="PRACTICAL"&&E.a.createElement("div",{className:n.a.setScore,onClick:function(){return nt(We.type,We.name)}},"\u6279\u91CF\u8BBE\u7F6E\u5F97\u5206"),E.a.createElement("div",{className:n.a.delete,onClick:function(){return Qe(We.type)}},"\u5220\u9664")),E.a.createElement(l.a,{onDragEnd:function(Oe){return qe(Oe,We)}},E.a.createElement(l.c,{droppableId:xe.toString()},function(we,Oe){var Ne;return E.a.createElement("div",Object(he.a)({className:"mt20",ref:we.innerRef},we.droppableProps,{onScroll:function(){}}),(Ne=We.questions)===null||Ne===void 0?void 0:Ne.map(function(De,Ee){return E.a.createElement(l.b,{draggableId:De.id.toString(),index:Ee,key:De.id},function(Ie){return E.a.createElement("div",Object(he.a)({ref:Ie.innerRef},Ie.draggableProps,Ie.dragHandleProps),E.a.createElement(r.a,{index:Ee,typeName:We.name,type:We.type,data:De,inMouseId:fe,onSetScore:me,onDelete:de,onMouseEnter:function(Me){le(Me),Ce(null)}}))})}))})))}))),E.a.createElement(p.a,{okText:"\u4FDD\u5B58\u8BD5\u5377",onCancel:function(){return x.d.replace("/problemset")},onOk:function(){return x.d.push("/problemset/preview_new")}}))};ct.default=Object(x.a)(function(o){var a=o.problemsetPreview,i=o.user,v=o.loading,g=o.globalSetting;return{problemsetPreview:a,user:i,globalSetting:g,loading:v.effects}})(u)},DlQD:function(mt,ct,be){(function(he,j){mt.exports=j()})(this,function(){"use strict";function he(U,$){for(var J=0;J<$.length;J++){var W=$[J];W.enumerable=W.enumerable||!1,W.configurable=!0,"value"in W&&(W.writable=!0),Object.defineProperty(U,W.key,W)}}function j(U,$,J){return $&&he(U.prototype,$),J&&he(U,J),U}function D(U,$){if(!U)return;if(typeof U=="string")return B(U,$);var J=Object.prototype.toString.call(U).slice(8,-1);if(J==="Object"&&U.constructor&&(J=U.constructor.name),J==="Map"||J==="Set")return Array.from(U);if(J==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(J))return B(U,$)}function B(U,$){($==null||$>U.length)&&($=U.length);for(var J=0,W=new Array($);J<$;J++)W[J]=U[J];return W}function R(U,$){var J;if(typeof Symbol=="undefined"||U[Symbol.iterator]==null){if(Array.isArray(U)||(J=D(U))||$&&U&&typeof U.length=="number"){J&&(U=J);var W=0;return function(){return W>=U.length?{done:!0}:{done:!1,value:U[W++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return J=U[Symbol.iterator](),J.next.bind(J)}function L(U,$){return $={exports:{}},U($,$.exports),$.exports}var G=L(function(U){function $(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function J(W){U.exports.defaults=W}U.exports={defaults:$(),getDefaults:$,changeDefaults:J}}),O=G.defaults,_=G.getDefaults,A=G.changeDefaults,y=/[&<>"']/,S=/[&<>"']/g,C=/[<>"']|&(?!#?\w+;)/,T=/[<>"']|&(?!#?\w+;)/g,E={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},x=function($){return E[$]};function l(U,$){if($){if(y.test(U))return U.replace(S,x)}else if(C.test(U))return U.replace(T,x);return U}var r=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(U){return U.replace(r,function($,J){return J=J.toLowerCase(),J==="colon"?":":J.charAt(0)==="#"?J.charAt(1)==="x"?String.fromCharCode(parseInt(J.substring(2),16)):String.fromCharCode(+J.substring(1)):""})}var n=/(^|[^\[])\^/g;function p(U,$){U=U.source||U,$=$||"";var J={replace:function(H,Q){return Q=Q.source||Q,Q=Q.replace(n,"$1"),U=U.replace(H,Q),J},getRegex:function(){return new RegExp(U,$)}};return J}var d=/[^\w:]/g,c=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function b(U,$,J){if(U){var W;try{W=decodeURIComponent(s(J)).replace(d,"").toLowerCase()}catch(H){return null}if(W.indexOf("javascript:")===0||W.indexOf("vbscript:")===0||W.indexOf("data:")===0)return null}$&&!c.test(J)&&(J=i($,J));try{J=encodeURI(J).replace(/%25/g,"%")}catch(H){return null}return J}var f={},u=/^[^:]+:\/*[^/]*$/,o=/^([^:]+:)[\s\S]*$/,a=/^([^:]+:\/*[^/]*)[\s\S]*$/;function i(U,$){f[" "+U]||(u.test(U)?f[" "+U]=U+"/":f[" "+U]=w(U,"/",!0)),U=f[" "+U];var J=U.indexOf(":")===-1;return $.substring(0,2)==="//"?J?$:U.replace(o,"$1")+$:$.charAt(0)==="/"?J?$:U.replace(a,"$1")+$:U+$}var v={exec:function(){}};function g(U){for(var $=1,J,W;$<arguments.length;$++){J=arguments[$];for(W in J)Object.prototype.hasOwnProperty.call(J,W)&&(U[W]=J[W])}return U}function m(U,$){var J=U.replace(/\|/g,function(Q,Z,ce){for(var ue=!1,ye=Z;--ye>=0&&ce[ye]==="\\";)ue=!ue;return ue?"|":" |"}),W=J.split(/ \|/),H=0;if(W.length>$)W.splice($);else for(;W.length<$;)W.push("");for(;H<W.length;H++)W[H]=W[H].trim().replace(/\\\|/g,"|");return W}function w(U,$,J){var W=U.length;if(W===0)return"";for(var H=0;H<W;){var Q=U.charAt(W-H-1);if(Q===$&&!J)H++;else if(Q!==$&&J)H++;else break}return U.substr(0,W-H)}function P(U,$){if(U.indexOf($[1])===-1)return-1;for(var J=U.length,W=0,H=0;H<J;H++)if(U[H]==="\\")H++;else if(U[H]===$[0])W++;else if(U[H]===$[1]&&(W--,W<0))return H;return-1}function N(U){U&&U.sanitize&&!U.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var K={escape:l,unescape:s,edit:p,cleanUrl:b,resolveUrl:i,noopTest:v,merge:g,splitCells:m,rtrim:w,findClosingBracket:P,checkSanitizeDeprecation:N},Y=G.defaults,ne=K.rtrim,q=K.splitCells,se=K.escape,fe=K.findClosingBracket;function le(U,$,J){var W=$.href,H=$.title?se($.title):null,Q=U[1].replace(/\\([\[\]])/g,"$1");return U[0].charAt(0)!=="!"?{type:"link",raw:J,href:W,title:H,text:Q}:{type:"image",raw:J,href:W,title:H,text:se(Q)}}function ve(U,$){var J=U.match(/^(\s+)(?:```)/);if(J===null)return $;var W=J[1];return $.split(`
`).map(function(H){var Q=H.match(/^\s+/);if(Q===null)return H;var Z=Q[0];return Z.length>=W.length?H.slice(W.length):H}).join(`
`)}var Se=function(){function U(J){this.options=J||Y}var $=U.prototype;return $.space=function(W){var H=this.rules.block.newline.exec(W);if(H)return H[0].length>1?{type:"space",raw:H[0]}:{raw:`
`}},$.code=function(W,H){var Q=this.rules.block.code.exec(W);if(Q){var Z=H[H.length-1];if(Z&&Z.type==="paragraph")return{raw:Q[0],text:Q[0].trimRight()};var ce=Q[0].replace(/^ {4}/gm,"");return{type:"code",raw:Q[0],codeBlockStyle:"indented",text:this.options.pedantic?ce:ne(ce,`
`)}}},$.fences=function(W){var H=this.rules.block.fences.exec(W);if(H){var Q=H[0],Z=ve(Q,H[3]||"");return{type:"code",raw:Q,lang:H[2]?H[2].trim():H[2],text:Z}}},$.heading=function(W){var H=this.rules.block.heading.exec(W);if(H)return{type:"heading",raw:H[0],depth:H[1].length,text:H[2]}},$.nptable=function(W){var H=this.rules.block.nptable.exec(W);if(H){var Q={type:"table",header:q(H[1].replace(/^ *| *\| *$/g,"")),align:H[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:H[3]?H[3].replace(/\n$/,"").split(`
`):[],raw:H[0]};if(Q.header.length===Q.align.length){var Z=Q.align.length,ce;for(ce=0;ce<Z;ce++)/^ *-+: *$/.test(Q.align[ce])?Q.align[ce]="right":/^ *:-+: *$/.test(Q.align[ce])?Q.align[ce]="center":/^ *:-+ *$/.test(Q.align[ce])?Q.align[ce]="left":Q.align[ce]=null;for(Z=Q.cells.length,ce=0;ce<Z;ce++)Q.cells[ce]=q(Q.cells[ce],Q.header.length);return Q}}},$.hr=function(W){var H=this.rules.block.hr.exec(W);if(H)return{type:"hr",raw:H[0]}},$.blockquote=function(W){var H=this.rules.block.blockquote.exec(W);if(H){var Q=H[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:H[0],text:Q}}},$.list=function(W){var H=this.rules.block.list.exec(W);if(H){for(var Q=H[0],Z=H[2],ce=Z.length>1,ue=Z[Z.length-1]===")",ye={type:"list",raw:Q,ordered:ce,start:ce?+Z.slice(0,-1):"",loose:!1,items:[]},Fe=H[0].match(this.rules.block.item),Ye=!1,ze,dt,et,Ze,gt,lt,Et,ft=Fe.length,at=0;at<ft;at++)ze=Fe[at],Q=ze,dt=ze.length,ze=ze.replace(/^ *([*+-]|\d+[.)]) */,""),~ze.indexOf(`
`)&&(dt-=ze.length,ze=this.options.pedantic?ze.replace(/^ {1,4}/gm,""):ze.replace(new RegExp("^ {1,"+dt+"}","gm"),"")),at!==ft-1&&(et=this.rules.block.bullet.exec(Fe[at+1])[0],(ce?et.length===1||!ue&&et[et.length-1]===")":et.length>1||this.options.smartLists&&et!==Z)&&(Ze=Fe.slice(at+1).join(`
`),ye.raw=ye.raw.substring(0,ye.raw.length-Ze.length),at=ft-1)),gt=Ye||/\n\n(?!\s*$)/.test(ze),at!==ft-1&&(Ye=ze.charAt(ze.length-1)===`
`,gt||(gt=Ye)),gt&&(ye.loose=!0),lt=/^\[[ xX]\] /.test(ze),Et=void 0,lt&&(Et=ze[1]!==" ",ze=ze.replace(/^\[[ xX]\] +/,"")),ye.items.push({type:"list_item",raw:Q,task:lt,checked:Et,loose:gt,text:ze});return ye}},$.html=function(W){var H=this.rules.block.html.exec(W);if(H)return{type:this.options.sanitize?"paragraph":"html",raw:H[0],pre:!this.options.sanitizer&&(H[1]==="pre"||H[1]==="script"||H[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(H[0]):se(H[0]):H[0]}},$.def=function(W){var H=this.rules.block.def.exec(W);if(H){H[3]&&(H[3]=H[3].substring(1,H[3].length-1));var Q=H[1].toLowerCase().replace(/\s+/g," ");return{tag:Q,raw:H[0],href:H[2],title:H[3]}}},$.table=function(W){var H=this.rules.block.table.exec(W);if(H){var Q={type:"table",header:q(H[1].replace(/^ *| *\| *$/g,"")),align:H[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:H[3]?H[3].replace(/\n$/,"").split(`
`):[]};if(Q.header.length===Q.align.length){Q.raw=H[0];var Z=Q.align.length,ce;for(ce=0;ce<Z;ce++)/^ *-+: *$/.test(Q.align[ce])?Q.align[ce]="right":/^ *:-+: *$/.test(Q.align[ce])?Q.align[ce]="center":/^ *:-+ *$/.test(Q.align[ce])?Q.align[ce]="left":Q.align[ce]=null;for(Z=Q.cells.length,ce=0;ce<Z;ce++)Q.cells[ce]=q(Q.cells[ce].replace(/^ *\| *| *\| *$/g,""),Q.header.length);return Q}}},$.lheading=function(W){var H=this.rules.block.lheading.exec(W);if(H)return{type:"heading",raw:H[0],depth:H[2].charAt(0)==="="?1:2,text:H[1]}},$.paragraph=function(W){var H=this.rules.block.paragraph.exec(W);if(H)return{type:"paragraph",raw:H[0],text:H[1].charAt(H[1].length-1)===`
`?H[1].slice(0,-1):H[1]}},$.text=function(W,H){var Q=this.rules.block.text.exec(W);if(Q){var Z=H[H.length-1];return Z&&Z.type==="text"?{raw:Q[0],text:Q[0]}:{type:"text",raw:Q[0],text:Q[0]}}},$.escape=function(W){var H=this.rules.inline.escape.exec(W);if(H)return{type:"escape",raw:H[0],text:se(H[1])}},$.tag=function(W,H,Q){var Z=this.rules.inline.tag.exec(W);if(Z)return!H&&/^<a /i.test(Z[0])?H=!0:H&&/^<\/a>/i.test(Z[0])&&(H=!1),!Q&&/^<(pre|code|kbd|script)(\s|>)/i.test(Z[0])?Q=!0:Q&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(Z[0])&&(Q=!1),{type:this.options.sanitize?"text":"html",raw:Z[0],inLink:H,inRawBlock:Q,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Z[0]):se(Z[0]):Z[0]}},$.link=function(W){var H=this.rules.inline.link.exec(W);if(H){var Q=fe(H[2],"()");if(Q>-1){var Z=H[0].indexOf("!")===0?5:4,ce=Z+H[1].length+Q;H[2]=H[2].substring(0,Q),H[0]=H[0].substring(0,ce).trim(),H[3]=""}var ue=H[2],ye="";if(this.options.pedantic){var Fe=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(ue);Fe?(ue=Fe[1],ye=Fe[3]):ye=""}else ye=H[3]?H[3].slice(1,-1):"";ue=ue.trim().replace(/^<([\s\S]*)>$/,"$1");var Ye=le(H,{href:ue&&ue.replace(this.rules.inline._escapes,"$1"),title:ye&&ye.replace(this.rules.inline._escapes,"$1")},H[0]);return Ye}},$.reflink=function(W,H){var Q;if((Q=this.rules.inline.reflink.exec(W))||(Q=this.rules.inline.nolink.exec(W))){var Z=(Q[2]||Q[1]).replace(/\s+/g," ");if(Z=H[Z.toLowerCase()],!Z||!Z.href){var ce=Q[0].charAt(0);return{type:"text",raw:ce,text:ce}}var ue=le(Q,Z,Q[0]);return ue}},$.strong=function(W,H,Q){Q===void 0&&(Q="");var Z=this.rules.inline.strong.start.exec(W);if(Z&&(!Z[1]||Z[1]&&(Q===""||this.rules.inline.punctuation.exec(Q)))){H=H.slice(-1*W.length);var ce=Z[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ce.lastIndex=0;for(var ue;(Z=ce.exec(H))!=null;)if(ue=this.rules.inline.strong.middle.exec(H.slice(0,Z.index+3)),ue)return{type:"strong",raw:W.slice(0,ue[0].length),text:W.slice(2,ue[0].length-2)}}},$.em=function(W,H,Q){Q===void 0&&(Q="");var Z=this.rules.inline.em.start.exec(W);if(Z&&(!Z[1]||Z[1]&&(Q===""||this.rules.inline.punctuation.exec(Q)))){H=H.slice(-1*W.length);var ce=Z[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ce.lastIndex=0;for(var ue;(Z=ce.exec(H))!=null;)if(ue=this.rules.inline.em.middle.exec(H.slice(0,Z.index+2)),ue)return{type:"em",raw:W.slice(0,ue[0].length),text:W.slice(1,ue[0].length-1)}}},$.codespan=function(W){var H=this.rules.inline.code.exec(W);if(H){var Q=H[2].replace(/\n/g," "),Z=/[^ ]/.test(Q),ce=Q.startsWith(" ")&&Q.endsWith(" ");return Z&&ce&&(Q=Q.substring(1,Q.length-1)),Q=se(Q,!0),{type:"codespan",raw:H[0],text:Q}}},$.br=function(W){var H=this.rules.inline.br.exec(W);if(H)return{type:"br",raw:H[0]}},$.del=function(W){var H=this.rules.inline.del.exec(W);if(H)return{type:"del",raw:H[0],text:H[1]}},$.autolink=function(W,H){var Q=this.rules.inline.autolink.exec(W);if(Q){var Z,ce;return Q[2]==="@"?(Z=se(this.options.mangle?H(Q[1]):Q[1]),ce="mailto:"+Z):(Z=se(Q[1]),ce=Z),{type:"link",raw:Q[0],text:Z,href:ce,tokens:[{type:"text",raw:Z,text:Z}]}}},$.url=function(W,H){var Q;if(Q=this.rules.inline.url.exec(W)){var Z,ce;if(Q[2]==="@")Z=se(this.options.mangle?H(Q[0]):Q[0]),ce="mailto:"+Z;else{var ue;do ue=Q[0],Q[0]=this.rules.inline._backpedal.exec(Q[0])[0];while(ue!==Q[0]);Z=se(Q[0]),Q[1]==="www."?ce="http://"+Z:ce=Z}return{type:"link",raw:Q[0],text:Z,href:ce,tokens:[{type:"text",raw:Z,text:Z}]}}},$.inlineText=function(W,H,Q){var Z=this.rules.inline.text.exec(W);if(Z){var ce;return H?ce=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Z[0]):se(Z[0]):Z[0]:ce=se(this.options.smartypants?Q(Z[0]):Z[0]),{type:"text",raw:Z[0],text:ce}}},U}(),ke=K.noopTest,Ce=K.edit,Le=K.merge,ge={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:ke,table:ke,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ge._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ge._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ge.def=Ce(ge.def).replace("label",ge._label).replace("title",ge._title).getRegex(),ge.bullet=/(?:[*+-]|\d{1,9}[.)])/,ge.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ge.item=Ce(ge.item,"gm").replace(/bull/g,ge.bullet).getRegex(),ge.list=Ce(ge.list).replace(/bull/g,ge.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ge.def.source+")").getRegex(),ge._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ge._comment=/<!--(?!-?>)[\s\S]*?-->/,ge.html=Ce(ge.html,"i").replace("comment",ge._comment).replace("tag",ge._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ge.paragraph=Ce(ge._paragraph).replace("hr",ge.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ge._tag).getRegex(),ge.blockquote=Ce(ge.blockquote).replace("paragraph",ge.paragraph).getRegex(),ge.normal=Le({},ge),ge.gfm=Le({},ge.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n *([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n *\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),ge.gfm.nptable=Ce(ge.gfm.nptable).replace("hr",ge.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ge._tag).getRegex(),ge.gfm.table=Ce(ge.gfm.table).replace("hr",ge.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ge._tag).getRegex(),ge.pedantic=Le({},ge.normal,{html:Ce(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ge._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:ke,paragraph:Ce(ge.normal._paragraph).replace("hr",ge.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",ge.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var me={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:ke,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:ke,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};me._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",me.punctuation=Ce(me.punctuation).replace(/punctuation/g,me._punctuation).getRegex(),me._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",me._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",me.em.start=Ce(me.em.start).replace(/punctuation/g,me._punctuation).getRegex(),me.em.middle=Ce(me.em.middle).replace(/punctuation/g,me._punctuation).replace(/overlapSkip/g,me._overlapSkip).getRegex(),me.em.endAst=Ce(me.em.endAst,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.em.endUnd=Ce(me.em.endUnd,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.strong.start=Ce(me.strong.start).replace(/punctuation/g,me._punctuation).getRegex(),me.strong.middle=Ce(me.strong.middle).replace(/punctuation/g,me._punctuation).replace(/blockSkip/g,me._blockSkip).getRegex(),me.strong.endAst=Ce(me.strong.endAst,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.strong.endUnd=Ce(me.strong.endUnd,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.blockSkip=Ce(me._blockSkip,"g").getRegex(),me.overlapSkip=Ce(me._overlapSkip,"g").getRegex(),me._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,me._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,me._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,me.autolink=Ce(me.autolink).replace("scheme",me._scheme).replace("email",me._email).getRegex(),me._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,me.tag=Ce(me.tag).replace("comment",ge._comment).replace("attribute",me._attribute).getRegex(),me._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,me._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,me._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,me.link=Ce(me.link).replace("label",me._label).replace("href",me._href).replace("title",me._title).getRegex(),me.reflink=Ce(me.reflink).replace("label",me._label).getRegex(),me.reflinkSearch=Ce(me.reflinkSearch,"g").replace("reflink",me.reflink).replace("nolink",me.nolink).getRegex(),me.normal=Le({},me),me.pedantic=Le({},me.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Ce(/^!?\[(label)\]\((.*?)\)/).replace("label",me._label).getRegex(),reflink:Ce(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",me._label).getRegex()}),me.gfm=Le({},me.normal,{escape:Ce(me.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),me.gfm.url=Ce(me.gfm.url,"i").replace("email",me.gfm._extended_email).getRegex(),me.breaks=Le({},me.gfm,{br:Ce(me.br).replace("{2,}","*").getRegex(),text:Ce(me.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var de={block:ge,inline:me},nt=G.defaults,Qe=de.block,qe=de.inline;function We(U){return U.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function xe(U){var $="",J,W,H=U.length;for(J=0;J<H;J++)W=U.charCodeAt(J),Math.random()>.5&&(W="x"+W.toString(16)),$+="&#"+W+";";return $}var Te=function(){function U(J){this.tokens=[],this.tokens.links=Object.create(null),this.options=J||nt,this.options.tokenizer=this.options.tokenizer||new Se,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var W={block:Qe.normal,inline:qe.normal};this.options.pedantic?(W.block=Qe.pedantic,W.inline=qe.pedantic):this.options.gfm&&(W.block=Qe.gfm,this.options.breaks?W.inline=qe.breaks:W.inline=qe.gfm),this.tokenizer.rules=W}U.lex=function(W,H){var Q=new U(H);return Q.lex(W)};var $=U.prototype;return $.lex=function(W){return W=W.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(W,this.tokens,!0),this.inline(this.tokens),this.tokens},$.blockTokens=function(W,H,Q){H===void 0&&(H=[]),Q===void 0&&(Q=!0),W=W.replace(/^ +$/gm,"");for(var Z,ce,ue,ye;W;){if(Z=this.tokenizer.space(W)){W=W.substring(Z.raw.length),Z.type&&H.push(Z);continue}if(Z=this.tokenizer.code(W,H)){W=W.substring(Z.raw.length),Z.type?H.push(Z):(ye=H[H.length-1],ye.raw+=`
`+Z.raw,ye.text+=`
`+Z.text);continue}if(Z=this.tokenizer.fences(W)){W=W.substring(Z.raw.length),H.push(Z);continue}if(Z=this.tokenizer.heading(W)){W=W.substring(Z.raw.length),H.push(Z);continue}if(Z=this.tokenizer.nptable(W)){W=W.substring(Z.raw.length),H.push(Z);continue}if(Z=this.tokenizer.hr(W)){W=W.substring(Z.raw.length),H.push(Z);continue}if(Z=this.tokenizer.blockquote(W)){W=W.substring(Z.raw.length),Z.tokens=this.blockTokens(Z.text,[],Q),H.push(Z);continue}if(Z=this.tokenizer.list(W)){for(W=W.substring(Z.raw.length),ue=Z.items.length,ce=0;ce<ue;ce++)Z.items[ce].tokens=this.blockTokens(Z.items[ce].text,[],!1);H.push(Z);continue}if(Z=this.tokenizer.html(W)){W=W.substring(Z.raw.length),H.push(Z);continue}if(Q&&(Z=this.tokenizer.def(W))){W=W.substring(Z.raw.length),this.tokens.links[Z.tag]||(this.tokens.links[Z.tag]={href:Z.href,title:Z.title});continue}if(Z=this.tokenizer.table(W)){W=W.substring(Z.raw.length),H.push(Z);continue}if(Z=this.tokenizer.lheading(W)){W=W.substring(Z.raw.length),H.push(Z);continue}if(Q&&(Z=this.tokenizer.paragraph(W))){W=W.substring(Z.raw.length),H.push(Z);continue}if(Z=this.tokenizer.text(W,H)){W=W.substring(Z.raw.length),Z.type?H.push(Z):(ye=H[H.length-1],ye.raw+=`
`+Z.raw,ye.text+=`
`+Z.text);continue}if(W){var Fe="Infinite loop on byte: "+W.charCodeAt(0);if(this.options.silent){console.error(Fe);break}else throw new Error(Fe)}}return H},$.inline=function(W){var H,Q,Z,ce,ue,ye,Fe=W.length;for(H=0;H<Fe;H++){ye=W[H];switch(ye.type){case"paragraph":case"text":case"heading":{ye.tokens=[],this.inlineTokens(ye.text,ye.tokens);break}case"table":{for(ye.tokens={header:[],cells:[]},ce=ye.header.length,Q=0;Q<ce;Q++)ye.tokens.header[Q]=[],this.inlineTokens(ye.header[Q],ye.tokens.header[Q]);for(ce=ye.cells.length,Q=0;Q<ce;Q++)for(ue=ye.cells[Q],ye.tokens.cells[Q]=[],Z=0;Z<ue.length;Z++)ye.tokens.cells[Q][Z]=[],this.inlineTokens(ue[Z],ye.tokens.cells[Q][Z]);break}case"blockquote":{this.inline(ye.tokens);break}case"list":{for(ce=ye.items.length,Q=0;Q<ce;Q++)this.inline(ye.items[Q].tokens);break}}}return W},$.inlineTokens=function(W,H,Q,Z,ce){H===void 0&&(H=[]),Q===void 0&&(Q=!1),Z===void 0&&(Z=!1),ce===void 0&&(ce="");var ue,ye=W,Fe;if(this.tokens.links){var Ye=Object.keys(this.tokens.links);if(Ye.length>0)for(;(Fe=this.tokenizer.rules.inline.reflinkSearch.exec(ye))!=null;)Ye.includes(Fe[0].slice(Fe[0].lastIndexOf("[")+1,-1))&&(ye=ye.slice(0,Fe.index)+"["+"a".repeat(Fe[0].length-2)+"]"+ye.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Fe=this.tokenizer.rules.inline.blockSkip.exec(ye))!=null;)ye=ye.slice(0,Fe.index)+"["+"a".repeat(Fe[0].length-2)+"]"+ye.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;W;){if(ue=this.tokenizer.escape(W)){W=W.substring(ue.raw.length),H.push(ue);continue}if(ue=this.tokenizer.tag(W,Q,Z)){W=W.substring(ue.raw.length),Q=ue.inLink,Z=ue.inRawBlock,H.push(ue);continue}if(ue=this.tokenizer.link(W)){W=W.substring(ue.raw.length),ue.type==="link"&&(ue.tokens=this.inlineTokens(ue.text,[],!0,Z)),H.push(ue);continue}if(ue=this.tokenizer.reflink(W,this.tokens.links)){W=W.substring(ue.raw.length),ue.type==="link"&&(ue.tokens=this.inlineTokens(ue.text,[],!0,Z)),H.push(ue);continue}if(ue=this.tokenizer.strong(W,ye,ce)){W=W.substring(ue.raw.length),ue.tokens=this.inlineTokens(ue.text,[],Q,Z),H.push(ue);continue}if(ue=this.tokenizer.em(W,ye,ce)){W=W.substring(ue.raw.length),ue.tokens=this.inlineTokens(ue.text,[],Q,Z),H.push(ue);continue}if(ue=this.tokenizer.codespan(W)){W=W.substring(ue.raw.length),H.push(ue);continue}if(ue=this.tokenizer.br(W)){W=W.substring(ue.raw.length),H.push(ue);continue}if(ue=this.tokenizer.del(W)){W=W.substring(ue.raw.length),ue.tokens=this.inlineTokens(ue.text,[],Q,Z),H.push(ue);continue}if(ue=this.tokenizer.autolink(W,xe)){W=W.substring(ue.raw.length),H.push(ue);continue}if(!Q&&(ue=this.tokenizer.url(W,xe))){W=W.substring(ue.raw.length),H.push(ue);continue}if(ue=this.tokenizer.inlineText(W,Z,We)){W=W.substring(ue.raw.length),ce=ue.raw.slice(-1),H.push(ue);continue}if(W){var ze="Infinite loop on byte: "+W.charCodeAt(0);if(this.options.silent){console.error(ze);break}else throw new Error(ze)}}return H},j(U,null,[{key:"rules",get:function(){return{block:Qe,inline:qe}}}]),U}(),we=G.defaults,Oe=K.cleanUrl,Ne=K.escape,De=function(){function U(J){this.options=J||we}var $=U.prototype;return $.code=function(W,H,Q){var Z=(H||"").match(/\S*/)[0];if(this.options.highlight){var ce=this.options.highlight(W,Z);ce!=null&&ce!==W&&(Q=!0,W=ce)}return Z?'<pre><code class="'+this.options.langPrefix+Ne(Z,!0)+'">'+(Q?W:Ne(W,!0))+`</code></pre>
`:"<pre><code>"+(Q?W:Ne(W,!0))+`</code></pre>
`},$.blockquote=function(W){return`<blockquote>
`+W+`</blockquote>
`},$.html=function(W){return W},$.heading=function(W,H,Q,Z){return this.options.headerIds?"<h"+H+' id="'+this.options.headerPrefix+Z.slug(Q)+'">'+W+"</h"+H+`>
`:"<h"+H+">"+W+"</h"+H+`>
`},$.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},$.list=function(W,H,Q){var Z=H?"ol":"ul",ce=H&&Q!==1?' start="'+Q+'"':"";return"<"+Z+ce+`>
`+W+"</"+Z+`>
`},$.listitem=function(W){return"<li>"+W+`</li>
`},$.checkbox=function(W){return"<input "+(W?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},$.paragraph=function(W){return"<p>"+W+`</p>
`},$.table=function(W,H){return H&&(H="<tbody>"+H+"</tbody>"),`<table>
<thead>
`+W+`</thead>
`+H+`</table>
`},$.tablerow=function(W){return`<tr>
`+W+`</tr>
`},$.tablecell=function(W,H){var Q=H.header?"th":"td",Z=H.align?"<"+Q+' align="'+H.align+'">':"<"+Q+">";return Z+W+"</"+Q+`>
`},$.strong=function(W){return"<strong>"+W+"</strong>"},$.em=function(W){return"<em>"+W+"</em>"},$.codespan=function(W){return"<code>"+W+"</code>"},$.br=function(){return this.options.xhtml?"<br/>":"<br>"},$.del=function(W){return"<del>"+W+"</del>"},$.link=function(W,H,Q){if(W=Oe(this.options.sanitize,this.options.baseUrl,W),W===null)return Q;var Z='<a href="'+Ne(W)+'"';return H&&(Z+=' title="'+H+'"'),Z+=">"+Q+"</a>",Z},$.image=function(W,H,Q){if(W=Oe(this.options.sanitize,this.options.baseUrl,W),W===null)return Q;var Z='<img src="'+W+'" alt="'+Q+'"';return H&&(Z+=' title="'+H+'"'),Z+=this.options.xhtml?"/>":">",Z},$.text=function(W){return W},U}(),Ee=function(){function U(){}var $=U.prototype;return $.strong=function(W){return W},$.em=function(W){return W},$.codespan=function(W){return W},$.del=function(W){return W},$.html=function(W){return W},$.text=function(W){return W},$.link=function(W,H,Q){return""+Q},$.image=function(W,H,Q){return""+Q},$.br=function(){return""},U}(),Ie=function(){function U(){this.seen={}}var $=U.prototype;return $.slug=function(W){var H=W.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(H)){var Q=H;do this.seen[Q]++,H=Q+"-"+this.seen[Q];while(this.seen.hasOwnProperty(H))}return this.seen[H]=0,H},U}(),_e=G.defaults,Me=K.unescape,Ue=function(){function U(J){this.options=J||_e,this.options.renderer=this.options.renderer||new De,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ee,this.slugger=new Ie}U.parse=function(W,H){var Q=new U(H);return Q.parse(W)};var $=U.prototype;return $.parse=function(W,H){H===void 0&&(H=!0);var Q="",Z,ce,ue,ye,Fe,Ye,ze,dt,et,Ze,gt,lt,Et,ft,at,St,Nt,ht,Mt=W.length;for(Z=0;Z<Mt;Z++){Ze=W[Z];switch(Ze.type){case"space":continue;case"hr":{Q+=this.renderer.hr();continue}case"heading":{Q+=this.renderer.heading(this.parseInline(Ze.tokens),Ze.depth,Me(this.parseInline(Ze.tokens,this.textRenderer)),this.slugger);continue}case"code":{Q+=this.renderer.code(Ze.text,Ze.lang,Ze.escaped);continue}case"table":{for(dt="",ze="",ye=Ze.header.length,ce=0;ce<ye;ce++)ze+=this.renderer.tablecell(this.parseInline(Ze.tokens.header[ce]),{header:!0,align:Ze.align[ce]});for(dt+=this.renderer.tablerow(ze),et="",ye=Ze.cells.length,ce=0;ce<ye;ce++){for(Ye=Ze.tokens.cells[ce],ze="",Fe=Ye.length,ue=0;ue<Fe;ue++)ze+=this.renderer.tablecell(this.parseInline(Ye[ue]),{header:!1,align:Ze.align[ue]});et+=this.renderer.tablerow(ze)}Q+=this.renderer.table(dt,et);continue}case"blockquote":{et=this.parse(Ze.tokens),Q+=this.renderer.blockquote(et);continue}case"list":{for(gt=Ze.ordered,lt=Ze.start,Et=Ze.loose,ye=Ze.items.length,et="",ce=0;ce<ye;ce++)at=Ze.items[ce],St=at.checked,Nt=at.task,ft="",at.task&&(ht=this.renderer.checkbox(St),Et?at.tokens.length>0&&at.tokens[0].type==="text"?(at.tokens[0].text=ht+" "+at.tokens[0].text,at.tokens[0].tokens&&at.tokens[0].tokens.length>0&&at.tokens[0].tokens[0].type==="text"&&(at.tokens[0].tokens[0].text=ht+" "+at.tokens[0].tokens[0].text)):at.tokens.unshift({type:"text",text:ht}):ft+=ht),ft+=this.parse(at.tokens,Et),et+=this.renderer.listitem(ft,Nt,St);Q+=this.renderer.list(et,gt,lt);continue}case"html":{Q+=this.renderer.html(Ze.text);continue}case"paragraph":{Q+=this.renderer.paragraph(this.parseInline(Ze.tokens));continue}case"text":{for(et=Ze.tokens?this.parseInline(Ze.tokens):Ze.text;Z+1<Mt&&W[Z+1].type==="text";)Ze=W[++Z],et+=`
`+(Ze.tokens?this.parseInline(Ze.tokens):Ze.text);Q+=H?this.renderer.paragraph(et):et;continue}default:{var Ut='Token with "'+Ze.type+'" type was not found.';if(this.options.silent){console.error(Ut);return}else throw new Error(Ut)}}}return Q},$.parseInline=function(W,H){H=H||this.renderer;var Q="",Z,ce,ue=W.length;for(Z=0;Z<ue;Z++){ce=W[Z];switch(ce.type){case"escape":{Q+=H.text(ce.text);break}case"html":{Q+=H.html(ce.text);break}case"link":{Q+=H.link(ce.href,ce.title,this.parseInline(ce.tokens,H));break}case"image":{Q+=H.image(ce.href,ce.title,ce.text);break}case"strong":{Q+=H.strong(this.parseInline(ce.tokens,H));break}case"em":{Q+=H.em(this.parseInline(ce.tokens,H));break}case"codespan":{Q+=H.codespan(ce.text);break}case"br":{Q+=H.br();break}case"del":{Q+=H.del(this.parseInline(ce.tokens,H));break}case"text":{Q+=H.text(ce.text);break}default:{var ye='Token with "'+ce.type+'" type was not found.';if(this.options.silent){console.error(ye);return}else throw new Error(ye)}}}return Q},U}(),je=K.merge,Ge=K.checkSanitizeDeprecation,Ke=K.escape,Ae=G.getDefaults,Xe=G.changeDefaults,Ve=G.defaults;function X(U,$,J){if(typeof U=="undefined"||U===null)throw new Error("marked(): input parameter is undefined or null");if(typeof U!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(U)+", string expected");if(typeof $=="function"&&(J=$,$=null),$=je({},X.defaults,$||{}),Ge($),J){var W=$.highlight,H;try{H=Te.lex(U,$)}catch(ue){return J(ue)}var Q=function(ye){var Fe;if(!ye)try{Fe=Ue.parse(H,$)}catch(Ye){ye=Ye}return $.highlight=W,ye?J(ye):J(null,Fe)};if(!W||W.length<3)return Q();if(delete $.highlight,!H.length)return Q();var Z=0;X.walkTokens(H,function(ue){ue.type==="code"&&(Z++,setTimeout(function(){W(ue.text,ue.lang,function(ye,Fe){if(ye)return Q(ye);Fe!=null&&Fe!==ue.text&&(ue.text=Fe,ue.escaped=!0),Z--,Z===0&&Q()})},0))}),Z===0&&Q();return}try{var ce=Te.lex(U,$);return $.walkTokens&&X.walkTokens(ce,$.walkTokens),Ue.parse(ce,$)}catch(ue){if(ue.message+=`
Please report this to https://github.com/markedjs/marked.`,$.silent)return"<p>An error occurred:</p><pre>"+Ke(ue.message+"",!0)+"</pre>";throw ue}}X.options=X.setOptions=function(U){return je(X.defaults,U),Xe(X.defaults),X},X.getDefaults=Ae,X.defaults=Ve,X.use=function(U){var $=je({},U);if(U.renderer&&function(){var W=X.defaults.renderer||new De,H=function(ce){var ue=W[ce];W[ce]=function(){for(var ye=arguments.length,Fe=new Array(ye),Ye=0;Ye<ye;Ye++)Fe[Ye]=arguments[Ye];var ze=U.renderer[ce].apply(W,Fe);return ze===!1&&(ze=ue.apply(W,Fe)),ze}};for(var Q in U.renderer)H(Q);$.renderer=W}(),U.tokenizer&&function(){var W=X.defaults.tokenizer||new Se,H=function(ce){var ue=W[ce];W[ce]=function(){for(var ye=arguments.length,Fe=new Array(ye),Ye=0;Ye<ye;Ye++)Fe[Ye]=arguments[Ye];var ze=U.tokenizer[ce].apply(W,Fe);return ze===!1&&(ze=ue.apply(W,Fe)),ze}};for(var Q in U.tokenizer)H(Q);$.tokenizer=W}(),U.walkTokens){var J=X.defaults.walkTokens;$.walkTokens=function(W){U.walkTokens(W),J&&J(W)}}X.setOptions($)},X.walkTokens=function(U,$){for(var J=R(U),W;!(W=J()).done;){var H=W.value;$(H);switch(H.type){case"table":{for(var Q=R(H.tokens.header),Z;!(Z=Q()).done;){var ce=Z.value;X.walkTokens(ce,$)}for(var ue=R(H.tokens.cells),ye;!(ye=ue()).done;)for(var Fe=ye.value,Ye=R(Fe),ze;!(ze=Ye()).done;){var dt=ze.value;X.walkTokens(dt,$)}break}case"list":{X.walkTokens(H.items,$);break}default:H.tokens&&X.walkTokens(H.tokens,$)}}},X.Parser=Ue,X.parser=Ue.parse,X.Renderer=De,X.TextRenderer=Ee,X.Lexer=Te,X.lexer=Te.lex,X.Tokenizer=Se,X.Slugger=Ie,X.parse=X;var F=X;return F})},NNiE:function(mt,ct,be){"use strict";var he=be("7Kak"),j=be("9yH6"),D=be("tJVT"),B=be("q1tI"),R=be.n(B),L=be("9Bee"),G=be("+M/w"),O=be.n(G),_=["A\uFF0E","B\uFF0E","C\uFF0E","D\uFF0E","E\uFF0E","F\uFF0E","G\uFF0E","H\uFF0E","I\uFF0E","J\uFF0E","K\uFF0E","L\uFF0E","M\uFF0E","N\uFF0E","O\uFF0E","P\uFF0E","Q\uFF0E","R\uFF0E","S\uFF0E","T\uFF0E","U\uFF0E","V\uFF0E","W\uFF0E","X\uFF0E","Y\uFF0E","Z\uFF0E"],A=function(S){var C=S.index,T=S.typeName,E=S.type,x=S.data,l=x===void 0?{}:x,r=S.inMouseId,s=S.isshow,n=S.onSetScore,p=n===void 0?function(){}:n,d=S.onDelete,c=d===void 0?function(){}:d,b=S.onMouseEnter,f=b===void 0?function(){}:b,u=S.showAnswer,o=u===void 0?!1:u,a=Object(B.useState)(!1),i=Object(D.a)(a,2),v=i[0],g=i[1],m=function(){var le;return R.a.createElement("div",{className:O.a.answerWrap},l==null||((le=l.choices)===null||le===void 0)?void 0:le.map(function(ve,Se){return R.a.createElement("div",{className:"".concat(O.a.flexRow," mt15"),key:Se},R.a.createElement("div",{style:{lineHeight:"24px",flexShrink:0}},_[Se]),R.a.createElement("div",{className:"".concat(O.a.answer," ml5")},R.a.createElement(L.a,{value:ve==null?void 0:ve.choice_text})))}),o&&R.a.createElement("div",{className:"mt10 ".concat(O.a.answerText)},"\u53C2\u8003\u7B54\u6848\uFF1A",l==null?void 0:l.standard_answer_show))},w=function(){var le;return R.a.createElement("div",{className:O.a.answerWrap},R.a.createElement("div",{className:"".concat(O.a.flexRow," mt15")},l==null||((le=l.choices)===null||le===void 0)?void 0:le.map(function(ve,Se){return R.a.createElement(j.a,{disabled:!0,key:Se},ve==null?void 0:ve.choice_text)})),o&&R.a.createElement("div",{className:"mt10 ".concat(O.a.answerText)},"\u53C2\u8003\u7B54\u6848\uFF1A",l==null?void 0:l.standard_answer_show))},P=function(){var le;return R.a.createElement("div",{className:O.a.answerWrap},R.a.createElement("div",{className:"".concat(O.a.flexRow," mt15")},R.a.createElement(L.a,{value:l==null||((le=l.program_attr)===null||le===void 0)?void 0:le.description})))},N=function(){var le;return R.a.createElement("div",{className:O.a.answerWrap},o&&R.a.createElement("div",{className:"".concat(O.a.flexColumn," mt15")},l==null||((le=l.standard_answer)===null||le===void 0)?void 0:le.map(function(ve,Se){return R.a.createElement(L.a,{key:Se,value:"\u53C2\u8003\u7B54\u6848\uFF08\u586B\u7A7A".concat(ve.position,"\uFF09\uFF1A").concat(ve.answer_text.join("\u3001"))})})))},K=function(){var le;return R.a.createElement("div",{className:O.a.answerWrap},o&&R.a.createElement("div",{className:"mt15"},R.a.createElement("div",null,"\u53C2\u8003\u7B54\u6848\uFF1A"),R.a.createElement(L.a,{value:l==null||((le=l.answer_texts)===null||le===void 0)?void 0:le[0]})))},Y=function(){var le;return R.a.createElement("div",{className:O.a.answerWrap},R.a.createElement("div",{className:"mt10"},"\u5173\u5361"),l==null||((le=l.shixun)===null||le===void 0)?void 0:le.map(function(ve,Se){return R.a.createElement("div",{className:"mt10 font14",key:Se},Se+1,". ",ve==null?void 0:ve.challenge_name)}))},ne=function(){var le;return R.a.createElement("div",{className:O.a.answerWrap,style:{display:v&&"none"}},l==null||((le=l.sub_questions)===null||le===void 0)?void 0:le.map(function(ve,Se){var ke,Ce='<span style="margin-right: 10px">'.concat(C+1,".").concat(Se+1,'</span><span>\uFF08\u5355\u9009\u9898\uFF09</span><span class="c-grey-999">\uFF08').concat(ve.score,"\u5206\uFF09</span>");return R.a.createElement(B.Fragment,{key:ve==null?void 0:ve.id},R.a.createElement("div",{className:O.a.titleWrap,style:{marginTop:16}},R.a.createElement(L.a,{className:O.a.titleHtml,value:Ce+ve.name})),ve==null||((ke=ve.choices)===null||ke===void 0)?void 0:ke.map(function(Le,ge){return R.a.createElement("div",{className:"".concat(O.a.flexRow," mt15"),key:ge},R.a.createElement("div",{style:{lineHeight:"24px",flexShrink:0}},_[ge]),R.a.createElement("div",{className:"".concat(O.a.answer," ml5")},R.a.createElement(L.a,{value:Le==null?void 0:Le.choice_text})))}),o&&R.a.createElement("div",{className:"mt10 ".concat(O.a.answerText)},"\u53C2\u8003\u7B54\u6848\uFF1A",ve==null?void 0:ve.standard_answer_show))}))},q=function(){var le={SINGLE:m,MULTIPLE:m,JUDGMENT:w,PROGRAM:P,COMPLETION:N,SUBJECTIVE:K,PRACTICAL:Y,COMBINATION:ne};return le[E]?le[E]():null},se=function(le,ve){var Se,ke='<span style="margin-right: -10px">'.concat(ve+1,'\u3001</span><span class="c-grey-999">\uFF08').concat((le==null?void 0:le.item_type)==="combination"?"\u5171".concat(le==null||((Se=le.sub_questions)===null||Se===void 0)?void 0:Se.length,"\u5C0F\u9898\uFF0C"):"").concat(le.score,"\u5206\uFF09</span> ");return ke};return R.a.createElement("div",{onMouseEnter:function(){return f(l.id)}},r===l.id&&R.a.createElement("div",{className:O.a.action},R.a.createElement("div",{className:O.a.setScore,onClick:function(){return p(l.id,T,l==null?void 0:l.shixun,l.score,l)}},"\u8BBE\u7F6E\u5F97\u5206"),R.a.createElement("div",{className:O.a.delete,onClick:function(){return c(l.id)}},"\u5220\u9664")),R.a.createElement("div",{className:O.a.content},R.a.createElement("div",{className:O.a.titleWrap,style:{justifyContent:"space-between"}},R.a.createElement(L.a,{className:O.a.titleHtml,value:se(l,C)+((l==null?void 0:l.item_type)==="combination"?"\uFF08\u9898\u5E72\uFF09":"")+(l.name||(l==null?void 0:l.shixun_name))}),(l==null?void 0:l.item_type)==="combination"&&!s&&R.a.createElement("span",{onClick:function(le){g(!v)},style:{textAlign:"end",flexShrink:0}},v?"\u5C55\u5F00":"\u6536\u8D77")),q()))};ct.a=A},SJMd:function(mt,ct){/**
* @license
* Copyright (C) 2006 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/var be,he,j,D=!1,B,R;window.PR_SHOULD_USE_CONTINUATION=!0;var L,G;(function(){var O=window,_=["break,continue,do,else,for,if,return,while"],A=[_,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],y=[A,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],S=[y,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],C=[y,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],T=[y,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],E="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",x=[y,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],l="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",r=[_,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],s=[_,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],n=[_,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],p=[S,T,C,x,l,r,s,n],d=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,c="str",b="kwd",f="com",u="typ",o="lit",a="pun",i="pln",v="tag",g="dec",m="src",w="atn",P="atv",N="nocode",K="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function Y(xe){for(var Te=0,we=!1,Oe=!1,Ne=0,De=xe.length;Ne<De;++Ne){var Ee=xe[Ne];if(Ee.ignoreCase)Oe=!0;else if(/[a-z]/i.test(Ee.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){we=!0,Oe=!1;break}}var Ie={b:8,t:9,n:10,v:11,f:12,r:13};function _e(Ke){var Ae=Ke.charCodeAt(0);if(Ae!==92)return Ae;var Xe=Ke.charAt(1);return Ae=Ie[Xe],Ae||("0"<=Xe&&Xe<="7"?parseInt(Ke.substring(1),8):Xe==="u"||Xe==="x"?parseInt(Ke.substring(2),16):Ke.charCodeAt(1))}function Me(Ke){if(Ke<32)return(Ke<16?"\\x0":"\\x")+Ke.toString(16);var Ae=String.fromCharCode(Ke);return Ae==="\\"||Ae==="-"||Ae==="]"||Ae==="^"?"\\"+Ae:Ae}function Ue(Ke){var Ae=Ke.substring(1,Ke.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),Xe=[],Ve=Ae[0]==="^",X=["["];Ve&&X.push("^");for(var F=Ve?1:0,U=Ae.length;F<U;++F){var $=Ae[F];if(/\\[bdsw]/i.test($))X.push($);else{var J=_e($),W;F+2<U&&Ae[F+1]==="-"?(W=_e(Ae[F+2]),F+=2):W=J,Xe.push([J,W]),W<65||J>122||(W<65||J>90||Xe.push([Math.max(65,J)|32,Math.min(W,90)|32]),W<97||J>122||Xe.push([Math.max(97,J)&~32,Math.min(W,122)&~32]))}}Xe.sort(function(ce,ue){return ce[0]-ue[0]||ue[1]-ce[1]});for(var H=[],Q=[],F=0;F<Xe.length;++F){var Z=Xe[F];Z[0]<=Q[1]+1?Q[1]=Math.max(Q[1],Z[1]):H.push(Q=Z)}for(var F=0;F<H.length;++F){var Z=H[F];X.push(Me(Z[0])),Z[1]>Z[0]&&(Z[1]+1>Z[0]&&X.push("-"),X.push(Me(Z[1])))}return X.push("]"),X.join("")}function je(Ke){for(var Ae=Ke.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),Xe=Ae.length,Ve=[],X=0,F=0;X<Xe;++X){var U=Ae[X];if(U==="(")++F;else if(U.charAt(0)==="\\"){var $=+U.substring(1);$&&($<=F?Ve[$]=-1:Ae[X]=Me($))}}for(var X=1;X<Ve.length;++X)Ve[X]===-1&&(Ve[X]=++Te);for(var X=0,F=0;X<Xe;++X){var U=Ae[X];if(U==="(")++F,Ve[F]||(Ae[X]="(?:");else if(U.charAt(0)==="\\"){var $=+U.substring(1);$&&$<=F&&(Ae[X]="\\"+Ve[$])}}for(var X=0;X<Xe;++X)Ae[X]==="^"&&Ae[X+1]!=="^"&&(Ae[X]="");if(Ke.ignoreCase&&we)for(var X=0;X<Xe;++X){var U=Ae[X],J=U.charAt(0);U.length>=2&&J==="["?Ae[X]=Ue(U):J!=="\\"&&(Ae[X]=U.replace(/[a-zA-Z]/g,function(Q){var Z=Q.charCodeAt(0);return"["+String.fromCharCode(Z&~32,Z|32)+"]"}))}return Ae.join("")}for(var Ge=[],Ne=0,De=xe.length;Ne<De;++Ne){var Ee=xe[Ne];if(Ee.global||Ee.multiline)throw new Error(""+Ee);Ge.push("(?:"+je(Ee)+")")}return new RegExp(Ge.join("|"),Oe?"gi":"g")}function ne(xe,Te){var we=/(?:^|\s)nocode(?:\s|$)/,Oe=[],Ne=0,De=[],Ee=0;function Ie(_e){var Me=_e.nodeType;if(Me==1){if(we.test(_e.className))return;for(var Ue=_e.firstChild;Ue;Ue=Ue.nextSibling)Ie(Ue);var je=_e.nodeName.toLowerCase();(je==="br"||je==="li")&&(Oe[Ee]=`
`,De[Ee<<1]=Ne++,De[Ee++<<1|1]=_e)}else if(Me==3||Me==4){var Ge=_e.nodeValue;Ge.length&&(Te?Ge=Ge.replace(/\r\n?/g,`
`):Ge=Ge.replace(/[ \t\r\n]+/g," "),Oe[Ee]=Ge,De[Ee<<1]=Ne,Ne+=Ge.length,De[Ee++<<1|1]=_e)}}return Ie(xe),{sourceCode:Oe.join("").replace(/\n$/,""),spans:De}}function q(xe,Te,we,Oe,Ne){if(!we)return;var De={sourceNode:xe,pre:1,langExtension:null,numberLines:null,sourceCode:we,spans:null,basePos:Te,decorations:null};Oe(De),Ne.push.apply(Ne,De.decorations)}var se=/\S/;function fe(xe){for(var Te=void 0,we=xe.firstChild;we;we=we.nextSibling){var Oe=we.nodeType;Te=Oe===1?Te?xe:we:Oe===3&&se.test(we.nodeValue)?xe:Te}return Te===xe?void 0:Te}function le(xe,Te){var we={},Oe;(function(){for(var Ee=xe.concat(Te),Ie=[],_e={},Me=0,Ue=Ee.length;Me<Ue;++Me){var je=Ee[Me],Ge=je[3];if(Ge)for(var Ke=Ge.length;--Ke>=0;)we[Ge.charAt(Ke)]=je;var Ae=je[1],Xe=""+Ae;_e.hasOwnProperty(Xe)||(Ie.push(Ae),_e[Xe]=null)}Ie.push(/[\0-\uffff]/),Oe=Y(Ie)})();var Ne=Te.length,De=function(Ee){for(var Ie=Ee.sourceCode,_e=Ee.basePos,Me=Ee.sourceNode,Ue=[_e,i],je=0,Ge=Ie.match(Oe)||[],Ke={},Ae=0,Xe=Ge.length;Ae<Xe;++Ae){var Ve=Ge[Ae],X=Ke[Ve],F=void 0,U;if(typeof X=="string")U=!1;else{var $=we[Ve.charAt(0)];if($)F=Ve.match($[1]),X=$[0];else{for(var J=0;J<Ne;++J)if($=Te[J],F=Ve.match($[1]),F){X=$[0];break}F||(X=i)}U=X.length>=5&&X.substring(0,5)==="lang-",U&&!(F&&typeof F[1]=="string")&&(U=!1,X=m),U||(Ke[Ve]=X)}var W=je;if(je+=Ve.length,!U)Ue.push(_e+W,X);else{var H=F[1],Q=Ve.indexOf(H),Z=Q+H.length;F[2]&&(Z=Ve.length-F[2].length,Q=Z-H.length);var ce=X.substring(5);q(Me,_e+W,Ve.substring(0,Q),De,Ue),q(Me,_e+W+Q,H,me(ce,H),Ue),q(Me,_e+W+Z,Ve.substring(Z),De,Ue)}}Ee.decorations=Ue};return De}function ve(xe){var Te=[],we=[];xe.tripleQuotedStrings?Te.push([c,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):xe.multiLineStrings?Te.push([c,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Te.push([c,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),xe.verbatimStrings&&we.push([c,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Oe=xe.hashComments;Oe&&(xe.cStyleComments?(Oe>1?Te.push([f,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Te.push([f,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),we.push([c,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Te.push([f,/^#[^\r\n]*/,null,"#"])),xe.cStyleComments&&(we.push([f,/^\/\/[^\r\n]*/,null]),we.push([f,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ne=xe.regexLiterals;if(Ne){var De=Ne>1?"":`
\r`,Ee=De?".":"[\\S\\s]",Ie="/(?=[^/*"+De+"])(?:[^/\\x5B\\x5C"+De+"]|\\x5C"+Ee+"|\\x5B(?:[^\\x5C\\x5D"+De+"]|\\x5C"+Ee+")*(?:\\x5D|$))+/";we.push(["lang-regex",RegExp("^"+K+"("+Ie+")")])}var _e=xe.types;_e&&we.push([u,_e]);var Me=(""+xe.keywords).replace(/^ | $/g,"");Me.length&&we.push([b,new RegExp("^(?:"+Me.replace(/[\s,]+/g,"|")+")\\b"),null]),Te.push([i,/^\s+/,null,` \r
\xA0`]);var Ue="^.[^\\s\\w.$@'\"`/\\\\]*";return xe.regexLiterals&&(Ue+="(?!s*/)"),we.push([o,/^@[a-z_$][a-z_$@0-9]*/i,null],[u,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[i,/^[a-z_$][a-z_$@0-9]*/i,null],[o,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[i,/^\\[\s\S]?/,null],[a,new RegExp(Ue),null]),le(Te,we)}var Se=ve({keywords:p,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function ke(xe,Te,we){for(var Oe=/(?:^|\s)nocode(?:\s|$)/,Ne=/\r\n?|\n/,De=xe.ownerDocument,Ee=De.createElement("li");xe.firstChild;)Ee.appendChild(xe.firstChild);var Ie=[Ee];function _e(Ae){var Xe=Ae.nodeType;if(Xe==1&&!Oe.test(Ae.className))if(Ae.nodeName==="br")Me(Ae),Ae.parentNode&&Ae.parentNode.removeChild(Ae);else for(var Ve=Ae.firstChild;Ve;Ve=Ve.nextSibling)_e(Ve);else if((Xe==3||Xe==4)&&we){var X=Ae.nodeValue,F=X.match(Ne);if(F){var U=X.substring(0,F.index);Ae.nodeValue=U;var $=X.substring(F.index+F[0].length);if($){var J=Ae.parentNode;J.insertBefore(De.createTextNode($),Ae.nextSibling)}Me(Ae),U||Ae.parentNode.removeChild(Ae)}}}function Me(Ae){for(;!Ae.nextSibling;)if(Ae=Ae.parentNode,!Ae)return;function Xe(F,U){var $=U?F.cloneNode(!1):F,J=F.parentNode;if(J){var W=Xe(J,1),H=F.nextSibling;W.appendChild($);for(var Q=H;Q;Q=H)H=Q.nextSibling,W.appendChild(Q)}return $}for(var Ve=Xe(Ae.nextSibling,0),X;(X=Ve.parentNode)&&X.nodeType===1;)Ve=X;Ie.push(Ve)}for(var Ue=0;Ue<Ie.length;++Ue)_e(Ie[Ue]);Te===(Te|0)&&Ie[0].setAttribute("value",Te);var je=De.createElement("ol");je.className="linenums";for(var Ge=Math.max(0,Te-1|0)||0,Ue=0,Ke=Ie.length;Ue<Ke;++Ue)Ee=Ie[Ue],Ee.className="L"+(Ue+Ge)%10,Ee.firstChild||Ee.appendChild(De.createTextNode("\xA0")),je.appendChild(Ee);xe.appendChild(je)}function Ce(xe){var Te=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Te=Te&&+Te[1]<=8;var we=/\n/g,Oe=xe.sourceCode,Ne=Oe.length,De=0,Ee=xe.spans,Ie=Ee.length,_e=0,Me=xe.decorations,Ue=Me.length,je=0;Me[Ue]=Ne;var Ge,Ke;for(Ke=Ge=0;Ke<Ue;)Me[Ke]!==Me[Ke+2]?(Me[Ge++]=Me[Ke++],Me[Ge++]=Me[Ke++]):Ke+=2;for(Ue=Ge,Ke=Ge=0;Ke<Ue;){for(var Ae=Me[Ke],Xe=Me[Ke+1],Ve=Ke+2;Ve+2<=Ue&&Me[Ve+1]===Xe;)Ve+=2;Me[Ge++]=Ae,Me[Ge++]=Xe,Ke=Ve}Ue=Me.length=Ge;var X=xe.sourceNode,F="";X&&(F=X.style.display,X.style.display="none");try{for(var U=null;_e<Ie;){var $=Ee[_e],J=Ee[_e+2]||Ne,W=Me[je+2]||Ne,Ve=Math.min(J,W),H=Ee[_e+1],Q;if(H.nodeType!==1&&(Q=Oe.substring(De,Ve))){Te&&(Q=Q.replace(we,"\r")),H.nodeValue=Q;var Z=H.ownerDocument,ce=Z.createElement("span");ce.className=Me[je+1];var ue=H.parentNode;ue.replaceChild(ce,H),ce.appendChild(H),De<J&&(Ee[_e+1]=H=Z.createTextNode(Oe.substring(Ve,J)),ue.insertBefore(H,ce.nextSibling))}De=Ve,De>=J&&(_e+=2),De>=W&&(je+=2)}}finally{X&&(X.style.display=F)}}var Le={};function ge(xe,Te){for(var we=Te.length;--we>=0;){var Oe=Te[we];Le.hasOwnProperty(Oe)?O.console&&console.warn("cannot override language handler %s",Oe):Le[Oe]=xe}}function me(xe,Te){return xe&&Le.hasOwnProperty(xe)||(xe=/^\s*</.test(Te)?"default-markup":"default-code"),Le[xe]}ge(Se,["default-code"]),ge(le([],[[i,/^[^<?]+/],[g,/^<!\w[^>]*(?:>|$)/],[f,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[a,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),ge(le([[i,/^[\s]+/,null,` \r
`],[P,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[v,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[w,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[a,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),ge(le([],[[P,/^[\s\S]+/]]),["uq.val"]),ge(ve({keywords:S,hashComments:!0,cStyleComments:!0,types:d}),["c","cc","cpp","cxx","cyc","m"]),ge(ve({keywords:"null,true,false"}),["json"]),ge(ve({keywords:T,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:d}),["cs"]),ge(ve({keywords:C,cStyleComments:!0}),["java"]),ge(ve({keywords:n,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ge(ve({keywords:r,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ge(ve({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ge(ve({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ge(ve({keywords:x,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ge(ve({keywords:E,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ge(le([],[[c,/^[\s\S]+/]]),["regex"]);function de(xe){var Te=xe.langExtension;try{var we=ne(xe.sourceNode,xe.pre),Oe=we.sourceCode;xe.sourceCode=Oe,xe.spans=we.spans,xe.basePos=0,me(Te,Oe)(xe),Ce(xe)}catch(Ne){O.console&&console.log(Ne&&Ne.stack||Ne)}}function nt(xe,Te,we){var Oe=we||!1,Ne=Te||null,De=document.createElement("div");De.innerHTML="<pre>"+xe+"</pre>",De=De.firstChild,Oe&&ke(De,Oe,!0);var Ee={langExtension:Ne,numberLines:Oe,sourceNode:De,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return de(Ee),De.innerHTML}function Qe(xe,Te){var we=Te||document.body,Oe=we.ownerDocument||document;function Ne($){return we.getElementsByTagName($)}for(var De=[Ne("pre"),Ne("code"),Ne("xmp")],Ee=[],Ie=0;Ie<De.length;++Ie)for(var _e=0,Me=De[Ie].length;_e<Me;++_e)Ee.push(De[Ie][_e]);De=null;var Ue=Date;Ue.now||(Ue={now:function(){return+new Date}});var je=0,Ge=/\blang(?:uage)?-([\w.]+)(?!\S)/,Ke=/\bprettyprint\b/,Ae=/\bprettyprinted\b/,Xe=/pre|xmp/i,Ve=/^code$/i,X=/^(?:pre|code|xmp)$/i,F={};function U(){for(var $=O.PR_SHOULD_USE_CONTINUATION?Ue.now()+250:Infinity;je<Ee.length&&Ue.now()<$;je++){for(var J=Ee[je],W=F,H=J;H=H.previousSibling;){var Q=H.nodeType,Z=(Q===7||Q===8)&&H.nodeValue;if(Z?!/^\??prettify\b/.test(Z):Q!==3||/\S/.test(H.nodeValue))break;if(Z){W={},Z.replace(/\b(\w+)=([\w:.%+-]+)/g,function(ft,at,St){W[at]=St});break}}var ce=J.className;if((W!==F||Ke.test(ce))&&!Ae.test(ce)){for(var ue=!1,ye=J.parentNode;ye;ye=ye.parentNode){var Fe=ye.tagName;if(X.test(Fe)&&ye.className&&Ke.test(ye.className)){ue=!0;break}}if(!ue){J.className+=" prettyprinted";var Ye=W.lang;if(!Ye){Ye=ce.match(Ge);var ze;!Ye&&(ze=fe(J))&&Ve.test(ze.tagName)&&(Ye=ze.className.match(Ge)),Ye&&(Ye=Ye[1])}var dt;if(Xe.test(J.tagName))dt=1;else{var et=J.currentStyle,Ze=Oe.defaultView,gt=et?et.whiteSpace:Ze&&Ze.getComputedStyle?Ze.getComputedStyle(J,null).getPropertyValue("white-space"):0;dt=gt&&gt.substring(0,3)==="pre"}var lt=W.linenums;(lt=lt==="true"||+lt)||(lt=ce.match(/\blinenums\b(?::(\d+))?/),lt=lt?lt[1]&&lt[1].length?+lt[1]:!0:!1),lt&&ke(J,lt,dt);var Et={langExtension:Ye,sourceNode:J,numberLines:lt,pre:dt,sourceCode:null,basePos:null,spans:null,decorations:null};de(Et)}}}je<Ee.length?O.setTimeout(U,250):typeof xe=="function"&&xe()}U()}var qe=O.PR={createSimpleLexer:le,registerLangHandler:ge,sourceDecorator:ve,PR_ATTRIB_NAME:w,PR_ATTRIB_VALUE:P,PR_COMMENT:f,PR_DECLARATION:g,PR_KEYWORD:b,PR_LITERAL:o,PR_NOCODE:N,PR_PLAIN:i,PR_PUNCTUATION:a,PR_SOURCE:m,PR_STRING:c,PR_TAG:v,PR_TYPE:u,prettyPrintOne:D?O.prettyPrintOne=nt:L=nt,prettyPrint:G=D?O.prettyPrint=Qe:G=Qe},We=O.define;typeof We=="function"&&We.amd&&We("google-code-prettify",[],function(){return qe})})()},UUDw:function(mt,ct,be){mt.exports={buttonFixed:"buttonFixed___2zLVJ",button:"button___-JgFH",buttonWrap:"buttonWrap___aZhhk"}},dmUQ:function(mt,ct,be){"use strict";var he=be("Ff2n"),j=be("rePB"),D=be("1OyB"),B=be("vuIU"),R=be("Ji7U"),L=be("md7G"),G=be("foSv"),O=be("q1tI"),_=be.n(O),A=be("TSYQ"),y=be.n(A),S=be("4IlW");function C(a,i){var v=Object.keys(a);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(a);i&&(g=g.filter(function(m){return Object.getOwnPropertyDescriptor(a,m).enumerable})),v.push.apply(v,g)}return v}function T(a){for(var i=1;i<arguments.length;i++){var v=arguments[i]!=null?arguments[i]:{};i%2?C(Object(v),!0).forEach(function(g){Object(j.a)(a,g,v[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(v)):C(Object(v)).forEach(function(g){Object.defineProperty(a,g,Object.getOwnPropertyDescriptor(v,g))})}return a}function E(a){var i=x();return function(){var g=Object(G.a)(a),m;if(i){var w=Object(G.a)(this).constructor;m=Reflect.construct(g,arguments,w)}else m=g.apply(this,arguments);return Object(L.a)(this,m)}}function x(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(a){return!1}}function l(){}function r(a){a.preventDefault()}var s=function(i){return i.replace(/[^\w.-]+/g,"")},n=200,p=600,d=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,c=function(i){return i!=null},b=function(i,v){return v===i||typeof v=="number"&&typeof i=="number"&&isNaN(v)&&isNaN(i)},f=function(a){Object(R.a)(v,a);var i=E(v);function v(g){var m;Object(D.a)(this,v),m=i.call(this,g),m.onKeyDown=function(N){var K=m.props,Y=K.onKeyDown,ne=K.onPressEnter;if(N.keyCode===S.a.UP){var q=m.getRatio(N);m.up(N,q,null),m.stop()}else if(N.keyCode===S.a.DOWN){var se=m.getRatio(N);m.down(N,se,null),m.stop()}else N.keyCode===S.a.ENTER&&ne&&ne(N);if(m.recordCursorPosition(),m.lastKeyCode=N.keyCode,Y){for(var fe=arguments.length,le=new Array(fe>1?fe-1:0),ve=1;ve<fe;ve++)le[ve-1]=arguments[ve];Y.apply(void 0,[N].concat(le))}},m.onKeyUp=function(N){var K=m.props.onKeyUp;if(m.stop(),m.recordCursorPosition(),K){for(var Y=arguments.length,ne=new Array(Y>1?Y-1:0),q=1;q<Y;q++)ne[q-1]=arguments[q];K.apply(void 0,[N].concat(ne))}},m.onChange=function(N){var K=m.props.onChange;m.state.focused&&(m.inputting=!0),m.rawInput=m.props.parser(m.getValueFromEvent(N)),m.setState({inputValue:m.rawInput}),K(m.toNumber(m.rawInput))},m.onMouseUp=function(){var N=m.props.onMouseUp;m.recordCursorPosition(),N&&N.apply(void 0,arguments)},m.onFocus=function(){var N;m.setState({focused:!0}),(N=m.props).onFocus.apply(N,arguments)},m.onBlur=function(){var N=m.props.onBlur;m.inputting=!1,m.setState({focused:!1});var K=m.getCurrentValidValue(m.state.inputValue),Y=m.setValue(K,l);if(N){var ne=m.input.value,q=m.getInputDisplayValue({focus:!1,value:Y});m.input.value=q&&Number(q),N.apply(void 0,arguments),m.input.value=ne}},m.getRatio=function(N){var K=1;return N.metaKey||N.ctrlKey?K=.1:N.shiftKey&&(K=10),K},m.getFullNum=function(N){return isNaN(N)?N:/e/i.test(String(N))?Number(N).toFixed(18).replace(/\.?0+$/,""):N},m.getPrecision=function(N){if(c(m.props.precision))return m.props.precision;var K=String(N);if(K.indexOf("e-")>=0)return parseInt(K.slice(K.indexOf("e-")+2),10);var Y=0;return K.indexOf(".")>=0&&(Y=K.length-K.indexOf(".")-1),Y},m.getInputDisplayValue=function(N){var K=N||m.state,Y=K.focused,ne=K.inputValue,q=K.value,se;Y?se=ne:se=m.toPrecisionAsStep(q),se==null&&(se="");var fe=m.formatWrapper(se);return c(m.props.decimalSeparator)&&(fe=fe.toString().replace(".",m.props.decimalSeparator)),fe},m.recordCursorPosition=function(){try{m.cursorStart=m.input.selectionStart,m.cursorEnd=m.input.selectionEnd,m.currentValue=m.input.value,m.cursorBefore=m.input.value.substring(0,m.cursorStart),m.cursorAfter=m.input.value.substring(m.cursorEnd)}catch(N){}},m.restoreByAfter=function(N){if(N===void 0)return!1;var K=m.input.value,Y=K.lastIndexOf(N);if(Y===-1)return!1;var ne=m.cursorBefore.length;return m.lastKeyCode===S.a.DELETE&&m.cursorBefore.charAt(ne-1)===N[0]?(m.fixCaret(ne,ne),!0):Y+N.length===K.length?(m.fixCaret(Y,Y),!0):!1},m.partRestoreByAfter=function(N){return N===void 0?!1:Array.prototype.some.call(N,function(K,Y){var ne=N.substring(Y);return m.restoreByAfter(ne)})},m.isNotCompleteNumber=function(N){return isNaN(N)||N===""||N===null||N&&N.toString().indexOf(".")===N.toString().length-1},m.stop=function(){m.autoStepTimer&&clearTimeout(m.autoStepTimer)},m.down=function(N,K,Y){m.pressingUpOrDown=!0,m.step("down",N,K,Y)},m.up=function(N,K,Y){m.pressingUpOrDown=!0,m.step("up",N,K,Y)},m.saveInput=function(N){m.input=N};var w=g.value;w===void 0&&(w=g.defaultValue),m.state={focused:g.autoFocus};var P=m.getValidValue(m.toNumber(w));return m.state=T(T({},m.state),{},{inputValue:m.toPrecisionAsStep(P),value:P}),m}return Object(B.a)(v,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(m){var w=this.props,P=w.value,N=w.onChange,K=w.max,Y=w.min,ne=this.state.focused;if(m){if(!b(m.value,P)||!b(m.max,K)||!b(m.min,Y)){var q=ne?P:this.getValidValue(P),se;this.pressingUpOrDown?se=q:this.inputting?se=this.rawInput:se=this.toPrecisionAsStep(q),this.setState({value:q,inputValue:se})}var fe="value"in this.props?P:this.state.value;"max"in this.props&&m.max!==K&&typeof fe=="number"&&fe>K&&N&&N(K),"min"in this.props&&m.min!==Y&&typeof fe=="number"&&fe<Y&&N&&N(Y)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var le=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===S.a.BACKSPACE?le=this.cursorStart-1:this.lastKeyCode===S.a.DELETE&&(le=this.cursorStart):le=this.input.value.length,this.fixCaret(le,le)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case S.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case S.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(ve){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(m){var w=m;return w===""?w="":this.isNotCompleteNumber(parseFloat(w))?w=this.state.value:w=this.getValidValue(w),this.toNumber(w)}},{key:"getValueFromEvent",value:function(m){var w=m.target.value.trim().replace(/。/g,".");return c(this.props.decimalSeparator)&&(w=w.replace(this.props.decimalSeparator,".")),w}},{key:"getValidValue",value:function(m){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,N=parseFloat(m);return isNaN(N)?m:(N<w&&(N=w),N>P&&(N=P),N)}},{key:"setValue",value:function(m,w){var P=this.props.precision,N=this.isNotCompleteNumber(parseFloat(m))?null:parseFloat(m),K=this.state.value,Y=K===void 0?null:K,ne=this.state.inputValue,q=ne===void 0?null:ne,se=typeof N=="number"?N.toFixed(P):"".concat(N),fe=N!==Y||se!=="".concat(q);return"value"in this.props?(q=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:q},w)):this.setState({value:N,inputValue:this.toPrecisionAsStep(m)},w),fe&&this.props.onChange(N),N}},{key:"getMaxPrecision",value:function(m){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,P=this.props,N=P.precision,K=P.step;if(c(N))return N;var Y=this.getPrecision(w),ne=this.getPrecision(K),q=this.getPrecision(m);return m?Math.max(q,Y+ne):Y+ne}},{key:"getPrecisionFactor",value:function(m){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,P=this.getMaxPrecision(m,w);return Math.pow(10,P)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(m){return this.props.formatter?this.props.formatter(m):m}},{key:"toPrecisionAsStep",value:function(m){if(this.isNotCompleteNumber(m)||m==="")return m;var w=Math.abs(this.getMaxPrecision(m));return isNaN(w)?m.toString():Number(m).toFixed(w)}},{key:"toNumber",value:function(m){var w=this.props.precision,P=this.state.focused,N=m&&m.length>16&&P;return this.isNotCompleteNumber(m)||N?m:c(w)?Math.round(m*Math.pow(10,w))/Math.pow(10,w):Number(m)}},{key:"upStep",value:function(m,w){var P=this.props.step,N=this.getPrecisionFactor(m,w),K=Math.abs(this.getMaxPrecision(m,w)),Y=((N*m+N*P*w)/N).toFixed(K);return this.toNumber(Y)}},{key:"downStep",value:function(m,w){var P=this.props.step,N=this.getPrecisionFactor(m,w),K=Math.abs(this.getMaxPrecision(m,w)),Y=((N*m-N*P*w)/N).toFixed(K);return this.toNumber(Y)}},{key:"step",value:function(m,w){var P=this,N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,K=arguments.length>3?arguments[3]:void 0;this.stop(),w&&(w.persist(),w.preventDefault());var Y=this.props;if(Y.disabled)return;var ne=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(ne))return;var q=this["".concat(m,"Step")](ne,N),se=q>Y.max||q<Y.min;if(q>Y.max?q=Y.max:q<Y.min&&(q=Y.min),this.setValue(q,null),this.setState({focused:!0},function(){P.pressingUpOrDown=!1}),se)return;this.autoStepTimer=setTimeout(function(){P[m](w,N,!0)},K?n:p)}},{key:"fixCaret",value:function(m,w){if(m===void 0||w===void 0||!this.input||!this.input.value)return;try{var P=this.input.selectionStart,N=this.input.selectionEnd;(m!==P||w!==N)&&this.input.setSelectionRange(m,w)}catch(K){}}},{key:"render",value:function(){var m,w=this.props,P=w.prefixCls,N=w.disabled,K=w.readOnly,Y=w.useTouch,ne=w.autoComplete,q=w.upHandler,se=w.downHandler,fe=w.className,le=w.max,ve=w.min,Se=w.style,ke=w.title,Ce=w.onMouseEnter,Le=w.onMouseLeave,ge=w.onMouseOver,me=w.onMouseOut,de=w.required,nt=w.onClick,Qe=w.tabIndex,qe=w.type,We=w.placeholder,xe=w.id,Te=w.inputMode,we=w.pattern,Oe=w.step,Ne=w.maxLength,De=w.autoFocus,Ee=w.name,Ie=w.onPaste,_e=w.onInput,Me=Object(he.a)(w,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),Ue=this.state,je=Ue.value,Ge=Ue.focused,Ke=y()(P,(m={},Object(j.a)(m,fe,!!fe),Object(j.a)(m,"".concat(P,"-disabled"),N),Object(j.a)(m,"".concat(P,"-focused"),Ge),m)),Ae={};Object.keys(Me).forEach(function(Z){(Z.substr(0,5)==="data-"||Z.substr(0,5)==="aria-"||Z==="role")&&(Ae[Z]=Me[Z])});var Xe=!K&&!N,Ve=this.getInputDisplayValue(null),X=(je||je===0)&&(isNaN(je)||Number(je)>=le),F=(je||je===0)&&(isNaN(je)||Number(je)<=ve),U=X||N||K,$=F||N||K,J=y()("".concat(P,"-handler"),"".concat(P,"-handler-up"),Object(j.a)({},"".concat(P,"-handler-up-disabled"),U)),W=y()("".concat(P,"-handler"),"".concat(P,"-handler-down"),Object(j.a)({},"".concat(P,"-handler-down-disabled"),$)),H=Y?{onTouchStart:U?l:this.up,onTouchEnd:this.stop}:{onMouseDown:U?l:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},Q=Y?{onTouchStart:$?l:this.down,onTouchEnd:this.stop}:{onMouseDown:$?l:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return _.a.createElement("div",{className:Ke,style:Se,title:ke,onMouseEnter:Ce,onMouseLeave:Le,onMouseOver:ge,onMouseOut:me,onFocus:function(){return null},onBlur:function(){return null}},_.a.createElement("div",{className:"".concat(P,"-handler-wrap")},_.a.createElement("span",Object.assign({unselectable:"on"},H,{role:"button","aria-label":"Increase Value","aria-disabled":U,className:J}),q||_.a.createElement("span",{unselectable:"on",className:"".concat(P,"-handler-up-inner"),onClick:r})),_.a.createElement("span",Object.assign({unselectable:"on"},Q,{role:"button","aria-label":"Decrease Value","aria-disabled":$,className:W}),se||_.a.createElement("span",{unselectable:"on",className:"".concat(P,"-handler-down-inner"),onClick:r}))),_.a.createElement("div",{className:"".concat(P,"-input-wrap")},_.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":ve,"aria-valuemax":le,"aria-valuenow":je,required:de,type:qe,placeholder:We,onPaste:Ie,onClick:nt,onMouseUp:this.onMouseUp,className:"".concat(P,"-input"),tabIndex:Qe,autoComplete:ne,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:Xe?this.onKeyDown:l,onKeyUp:Xe?this.onKeyUp:l,autoFocus:De,maxLength:Ne,readOnly:K,disabled:N,max:le,min:ve,step:Oe,name:Ee,title:ke,id:xe,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Ve),pattern:we,inputMode:Te,onInput:_e},Ae))))}}]),v}(_.a.Component);f.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:d,min:-d,step:1,style:{},onChange:l,onKeyDown:l,onPressEnter:l,onFocus:l,onBlur:l,parser:s,required:!1,autoComplete:"off"};var u=f,o=ct.a=u},ngQI:function(mt,ct,be){"use strict";be.d(ct,"a",function(){return Ao}),be.d(ct,"b",function(){return ml}),be.d(ct,"c",function(){return hi});var he=be("q1tI"),j=be.n(he),D=be("dI71"),B=be("wx14"),R=be("ANjH"),L=be("/MKj");function G(e,t){if(e.length!==t.length)return!1;for(var h=0;h<e.length;h++)if(e[h]!==t[h])return!1;return!0}function O(e,t){var h=Object(he.useState)(function(){return{inputs:t,result:e()}})[0],I=Object(he.useRef)(!0),k=Object(he.useRef)(h),M=I.current||Boolean(t&&k.current.inputs&&G(t,k.current.inputs)),V=M?k.current:{inputs:t,result:e()};return Object(he.useEffect)(function(){I.current=!1,k.current=V},[V]),V.result}function _(e,t){return O(function(){return e},t)}var A=O,y=_,S=be("9R94"),C=function(t){var h=t.top,I=t.right,k=t.bottom,M=t.left,V=I-M,z=k-h,ee={top:h,right:I,bottom:k,left:M,width:V,height:z,x:M,y:h,center:{x:(I+M)/2,y:(k+h)/2}};return ee},T=function(t,h){return{top:t.top-h.top,left:t.left-h.left,bottom:t.bottom+h.bottom,right:t.right+h.right}},E=function(t,h){return{top:t.top+h.top,left:t.left+h.left,bottom:t.bottom-h.bottom,right:t.right-h.right}},x=function(t,h){return{top:t.top+h.y,left:t.left+h.x,bottom:t.bottom+h.y,right:t.right+h.x}},l={top:0,right:0,bottom:0,left:0},r=function(t){var h=t.borderBox,I=t.margin,k=I===void 0?l:I,M=t.border,V=M===void 0?l:M,z=t.padding,ee=z===void 0?l:z,ie=C(T(h,k)),ae=C(E(h,V)),re=C(E(ae,ee));return{marginBox:ie,borderBox:C(h),paddingBox:ae,contentBox:re,margin:k,border:V,padding:ee}},s=function(t){var h=t.slice(0,-2),I=t.slice(-2);if(I!=="px")return 0;var k=Number(h);return isNaN(k)&&Object(S.a)(!1),k},n=function(){return{x:window.pageXOffset,y:window.pageYOffset}},p=function(t,h){var I=t.borderBox,k=t.border,M=t.margin,V=t.padding,z=x(I,h);return r({borderBox:z,border:k,margin:M,padding:V})},d=function(t,h){return h===void 0&&(h=n()),p(t,h)},c=function(t,h){var I={top:s(h.marginTop),right:s(h.marginRight),bottom:s(h.marginBottom),left:s(h.marginLeft)},k={top:s(h.paddingTop),right:s(h.paddingRight),bottom:s(h.paddingBottom),left:s(h.paddingLeft)},M={top:s(h.borderTopWidth),right:s(h.borderRightWidth),bottom:s(h.borderBottomWidth),left:s(h.borderLeftWidth)};return r({borderBox:t,margin:I,padding:k,border:M})},b=function(t){var h=t.getBoundingClientRect(),I=window.getComputedStyle(t);return c(h,I)},f=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function u(e,t){return e===t?!0:!!(f(e)&&f(t))}function o(e,t){if(e.length!==t.length)return!1;for(var h=0;h<e.length;h++)if(!u(e[h],t[h]))return!1;return!0}function a(e,t){t===void 0&&(t=o);var h,I=[],k,M=!1;function V(){for(var z=[],ee=0;ee<arguments.length;ee++)z[ee]=arguments[ee];return M&&h===this&&t(z,I)||(k=e.apply(this,z),M=!0,h=this,I=z),k}return V}var i=a,v=function(t){var h=[],I=null,k=function(){for(var V=arguments.length,z=new Array(V),ee=0;ee<V;ee++)z[ee]=arguments[ee];if(h=z,I)return;I=requestAnimationFrame(function(){I=null,t.apply(void 0,h)})};return k.cancel=function(){if(!I)return;cancelAnimationFrame(I),I=null},k},g=v,m=be("i8i4"),w=be.n(m),P=!0,N=/[ \t]{2,}/g,K=/^[ \t]*/gm,Y=function(t){return t.replace(N," ").replace(K,"").trim()},ne=function(t){return Y(`
%creact-beautiful-dnd
%c`+Y(t)+`
%c\u{1F477}\u200D This is a development only message. It will be removed in production builds.
`)},q=function(t){return[ne(t),"color: #00C584; font-size: 1.2em; font-weight: bold;","line-height: 1.5","color: #723874;"]},se="__react-beautiful-dnd-disable-dev-warnings";function fe(e,t){var h;if(P)return;if(typeof window!="undefined"&&window[se])return;(h=console)[e].apply(h,q(t))}var le=fe.bind(null,"warn"),ve=fe.bind(null,"error");function Se(){}function ke(e,t){return Object(B.a)({},e,{},t)}function Ce(e,t,h){var I=t.map(function(k){var M=ke(h,k.options);return e.addEventListener(k.eventName,k.fn,M),function(){e.removeEventListener(k.eventName,k.fn,M)}});return function(){I.forEach(function(M){M()})}}var Le=!0,ge="Invariant failed";function me(e){this.message=e}me.prototype.toString=function(){return this.message};function de(e,t){if(e)return;throw Le?new me(ge):new me(ge+": "+(t||""))}var nt=function(e){Object(D.a)(t,e);function t(){for(var I,k=arguments.length,M=new Array(k),V=0;V<k;V++)M[V]=arguments[V];return I=e.call.apply(e,[this].concat(M))||this,I.callbacks=null,I.unbind=Se,I.onWindowError=function(z){var ee=I.getCallbacks();ee.isDragging()&&ee.tryAbort();var ie=z.error;ie instanceof me&&z.preventDefault()},I.getCallbacks=function(){if(!I.callbacks)throw new Error("Unable to find AppCallbacks in <ErrorBoundary/>");return I.callbacks},I.setCallbacks=function(z){I.callbacks=z},I}var h=t.prototype;return h.componentDidMount=function(){this.unbind=Ce(window,[{eventName:"error",fn:this.onWindowError}])},h.componentWillUnmount=function(){this.unbind()},h.componentDidCatch=function(k){if(k instanceof me){this.setState({});return}throw k},h.render=function(){return this.props.children(this.setCallbacks)},t}(j.a.Component),Qe=`
Press space bar to start a drag.
When dragging you can use the arrow keys to move the item around and escape to cancel.
Some screen readers may require you to be in focus mode or to use your pass through key
`,qe=function(t){return t+1},We=function(t){return`
You have lifted an item in position `+qe(t.source.index)+`
`},xe=function(t,h){var I=t.droppableId===h.droppableId,k=qe(t.index),M=qe(h.index);return I?`
You have moved the item from position `+k+`
to position `+M+`
`:`
You have moved the item from position `+k+`
in list `+t.droppableId+`
to list `+h.droppableId+`
in position `+M+`
`},Te=function(t,h,I){var k=h.droppableId===I.droppableId;return k?`
The item `+t+`
has been combined with `+I.draggableId:`
The item `+t+`
in list `+h.droppableId+`
has been combined with `+I.draggableId+`
in list `+I.droppableId+`
`},we=function(t){var h=t.destination;if(h)return xe(t.source,h);var I=t.combine;return I?Te(t.draggableId,t.source,I):"You are over an area that cannot be dropped on"},Oe=function(t){return`
The item has returned to its starting position
of `+qe(t.index)+`
`},Ne=function(t){if(t.reason==="CANCEL")return`
Movement cancelled.
`+Oe(t.source)+`
`;var h=t.destination,I=t.combine;return h?`
You have dropped the item.
`+xe(t.source,h)+`
`:I?`
You have dropped the item.
`+Te(t.draggableId,t.source,I)+`
`:`
The item has been dropped while not over a drop area.
`+Oe(t.source)+`
`},De={dragHandleUsageInstructions:Qe,onDragStart:We,onDragUpdate:we,onDragEnd:Ne},Ee={x:0,y:0},Ie=function(t,h){return{x:t.x+h.x,y:t.y+h.y}},_e=function(t,h){return{x:t.x-h.x,y:t.y-h.y}},Me=function(t,h){return t.x===h.x&&t.y===h.y},Ue=function(t){return{x:t.x!==0?-t.x:0,y:t.y!==0?-t.y:0}},je=function(t,h,I){var k;return I===void 0&&(I=0),k={},k[t]=h,k[t==="x"?"y":"x"]=I,k},Ge=function(t,h){return Math.sqrt(Math.pow(h.x-t.x,2)+Math.pow(h.y-t.y,2))},Ke=function(t,h){return Math.min.apply(Math,h.map(function(I){return Ge(t,I)}))},Ae=function(t){return function(h){return{x:t(h.x),y:t(h.y)}}},Xe=function(e,t){var h=C({top:Math.max(t.top,e.top),right:Math.min(t.right,e.right),bottom:Math.min(t.bottom,e.bottom),left:Math.max(t.left,e.left)});return h.width<=0||h.height<=0?null:h},Ve=function(t,h){return{top:t.top+h.y,left:t.left+h.x,bottom:t.bottom+h.y,right:t.right+h.x}},X=function(t){return[{x:t.left,y:t.top},{x:t.right,y:t.top},{x:t.left,y:t.bottom},{x:t.right,y:t.bottom}]},F={top:0,right:0,bottom:0,left:0},U=function(t,h){return h?Ve(t,h.scroll.diff.displacement):t},$=function(t,h,I){if(I&&I.increasedBy){var k;return Object(B.a)({},t,(k={},k[h.end]=t[h.end]+I.increasedBy[h.line],k))}return t},J=function(t,h){return h&&h.shouldClipSubject?Xe(h.pageMarginBox,t):C(t)},W=function(e){var t=e.page,h=e.withPlaceholder,I=e.axis,k=e.frame,M=U(t.marginBox,k),V=$(M,I,h),z=J(V,k);return{page:t,withPlaceholder:h,active:z}},H=function(e,t){e.frame||de(!1);var h=e.frame,I=_e(t,h.scroll.initial),k=Ue(I),M=Object(B.a)({},h,{scroll:{initial:h.scroll.initial,current:t,diff:{value:I,displacement:k},max:h.scroll.max}}),V=W({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:M}),z=Object(B.a)({},e,{frame:M,subject:V});return z};function Q(e){return Number.isInteger?Number.isInteger(e):typeof e=="number"&&isFinite(e)&&Math.floor(e)===e}function Z(e){return Object.values?Object.values(e):Object.keys(e).map(function(t){return e[t]})}function ce(e,t){if(e.findIndex)return e.findIndex(t);for(var h=0;h<e.length;h++)if(t(e[h]))return h;return-1}function ue(e,t){if(e.find)return e.find(t);var h=ce(e,t);return h!==-1?e[h]:void 0}function ye(e){return Array.prototype.slice.call(e)}var Fe=i(function(e){return e.reduce(function(t,h){return t[h.descriptor.id]=h,t},{})}),Ye=i(function(e){return e.reduce(function(t,h){return t[h.descriptor.id]=h,t},{})}),ze=i(function(e){return Z(e)}),dt=i(function(e){return Z(e)}),et=i(function(e,t){var h=dt(t).filter(function(I){return e===I.descriptor.droppableId}).sort(function(I,k){return I.descriptor.index-k.descriptor.index});return h});function Ze(e){return e.at&&e.at.type==="REORDER"?e.at.destination:null}function gt(e){return e.at&&e.at.type==="COMBINE"?e.at.combine:null}var lt=i(function(e,t){return t.filter(function(h){return h.descriptor.id!==e.descriptor.id})}),Et=function(e){var t=e.isMovingForward,h=e.draggable,I=e.destination,k=e.insideDestination,M=e.previousImpact;if(!I.isCombineEnabled)return null;var V=Ze(M);if(!V)return null;function z(Re){var Pe={type:"COMBINE",combine:{draggableId:Re,droppableId:I.descriptor.id}};return Object(B.a)({},M,{at:Pe})}var ee=M.displaced.all,ie=ee.length?ee[0]:null;if(t)return ie?z(ie):null;var ae=lt(h,k);if(!ie){if(!ae.length)return null;var re=ae[ae.length-1];return z(re.descriptor.id)}var te=ce(ae,function(Re){return Re.descriptor.id===ie});te!==-1||de(!1);var oe=te-1;if(oe<0)return null;var pe=ae[oe];return z(pe.descriptor.id)},ft=function(e,t){return e.descriptor.droppableId===t.descriptor.id},at={point:Ee,value:0},St={invisible:{},visible:{},all:[]},Nt={displaced:St,displacedBy:at,at:null},ht=function(e,t){return function(h){return e<=h&&h<=t}},Mt=function(e){var t=ht(e.top,e.bottom),h=ht(e.left,e.right);return function(I){var k=t(I.top)&&t(I.bottom)&&h(I.left)&&h(I.right);if(k)return!0;var M=t(I.top)||t(I.bottom),V=h(I.left)||h(I.right),z=M&&V;if(z)return!0;var ee=I.top<e.top&&I.bottom>e.bottom,ie=I.left<e.left&&I.right>e.right,ae=ee&&ie;if(ae)return!0;var re=ee&&V||ie&&M;return re}},Ut=function(e){var t=ht(e.top,e.bottom),h=ht(e.left,e.right);return function(I){var k=t(I.top)&&t(I.bottom)&&h(I.left)&&h(I.right);return k}},_t={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},Lt={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"},Vt=function(e){return function(t){var h=ht(t.top,t.bottom),I=ht(t.left,t.right);return function(k){return e===_t?h(k.top)&&h(k.bottom):I(k.left)&&I(k.right)}}},yr=function(t,h){var I=h.frame?h.frame.scroll.diff.displacement:Ee;return Ve(t,I)},br=function(t,h,I){return h.subject.active?I(h.subject.active)(t):!1},xt=function(t,h,I){return I(h)(t)},ot=function(t){var h=t.target,I=t.destination,k=t.viewport,M=t.withDroppableDisplacement,V=t.isVisibleThroughFrameFn,z=M?yr(h,I):h;return br(z,I,V)&&xt(z,k,V)},Dt=function(t){return ot(Object(B.a)({},t,{isVisibleThroughFrameFn:Mt}))},it=function(t){return ot(Object(B.a)({},t,{isVisibleThroughFrameFn:Ut}))},Ct=function(t){return ot(Object(B.a)({},t,{isVisibleThroughFrameFn:Vt(t.destination.axis)}))},pt=function(t,h,I){if(typeof I=="boolean")return I;if(!h)return!0;var k=h.invisible,M=h.visible;if(k[t])return!1;var V=M[t];return V?V.shouldAnimate:!0};function zt(e,t){var h=e.page.marginBox,I={top:t.point.y,right:0,bottom:0,left:t.point.x};return C(T(h,I))}function vt(e){var t=e.afterDragging,h=e.destination,I=e.displacedBy,k=e.viewport,M=e.forceShouldAnimate,V=e.last;return t.reduce(function(ee,ie){var ae=zt(ie,I),re=ie.descriptor.id;ee.all.push(re);var te=Dt({target:ae,destination:h,viewport:k,withDroppableDisplacement:!0});if(!te)return ee.invisible[ie.descriptor.id]=!0,ee;var oe=pt(re,V,M),pe={draggableId:re,shouldAnimate:oe};return ee.visible[re]=pe,ee},{all:[],visible:{},invisible:{}})}function or(e,t){if(!e.length)return 0;var h=e[e.length-1].descriptor.index;return t.inHomeList?h:h+1}function lr(e){var t=e.insideDestination,h=e.inHomeList,I=e.displacedBy,k=e.destination,M=or(t,{inHomeList:h});return{displaced:St,displacedBy:I,at:{type:"REORDER",destination:{droppableId:k.descriptor.id,index:M}}}}function Ft(e){var t=e.draggable,h=e.insideDestination,I=e.destination,k=e.viewport,M=e.displacedBy,V=e.last,z=e.index,ee=e.forceShouldAnimate,ie=ft(t,I);if(z==null)return lr({insideDestination:h,inHomeList:ie,displacedBy:M,destination:I});var ae=ue(h,function(Re){return Re.descriptor.index===z});if(!ae)return lr({insideDestination:h,inHomeList:ie,displacedBy:M,destination:I});var re=lt(t,h),te=h.indexOf(ae),oe=re.slice(te),pe=vt({afterDragging:oe,destination:I,displacedBy:M,last:V,viewport:k.frame,forceShouldAnimate:ee});return{displaced:pe,displacedBy:M,at:{type:"REORDER",destination:{droppableId:I.descriptor.id,index:z}}}}function Pt(e,t){return Boolean(t.effected[e])}var vi=function(e){var t=e.isMovingForward,h=e.destination,I=e.draggables,k=e.combine,M=e.afterCritical;if(!h.isCombineEnabled)return null;var V=k.draggableId,z=I[V],ee=z.descriptor.index,ie=Pt(V,M);return ie?t?ee:ee-1:t?ee+1:ee},yi=function(e){var t=e.isMovingForward,h=e.isInHomeList,I=e.insideDestination,k=e.location;if(!I.length)return null;var M=k.index,V=t?M+1:M-1,z=I[0].descriptor.index,ee=I[I.length-1].descriptor.index,ie=h?ee:ee+1;return V<z||V>ie?null:V},bi=function(e){var t=e.isMovingForward,h=e.isInHomeList,I=e.draggable,k=e.draggables,M=e.destination,V=e.insideDestination,z=e.previousImpact,ee=e.viewport,ie=e.afterCritical,ae=z.at;if(ae||de(!1),ae.type==="REORDER"){var re=yi({isMovingForward:t,isInHomeList:h,location:ae.destination,insideDestination:V});return re==null?null:Ft({draggable:I,insideDestination:V,destination:M,viewport:ee,last:z.displaced,displacedBy:z.displacedBy,index:re})}var te=vi({isMovingForward:t,destination:M,displaced:z.displaced,draggables:k,combine:ae.combine,afterCritical:ie});return te==null?null:Ft({draggable:I,insideDestination:V,destination:M,viewport:ee,last:z.displaced,displacedBy:z.displacedBy,index:te})},Ei=function(e){var t=e.displaced,h=e.afterCritical,I=e.combineWith,k=e.displacedBy,M=Boolean(t.visible[I]||t.invisible[I]);return Pt(I,h)?M?Ee:Ue(k.point):M?k.point:Ee},xi=function(e){var t=e.afterCritical,h=e.impact,I=e.draggables,k=gt(h);k||de(!1);var M=k.draggableId,V=I[M].page.borderBox.center,z=Ei({displaced:h.displaced,afterCritical:t,combineWith:M,displacedBy:h.displacedBy});return Ie(V,z)},tn=function(t,h){return h.margin[t.start]+h.borderBox[t.size]/2},Ti=function(t,h){return h.margin[t.end]+h.borderBox[t.size]/2},Er=function(t,h,I){return h[t.crossAxisStart]+I.margin[t.crossAxisStart]+I.borderBox[t.crossAxisSize]/2},rn=function(t){var h=t.axis,I=t.moveRelativeTo,k=t.isMoving;return je(h.line,I.marginBox[h.end]+tn(h,k),Er(h,I.marginBox,k))},nn=function(t){var h=t.axis,I=t.moveRelativeTo,k=t.isMoving;return je(h.line,I.marginBox[h.start]-Ti(h,k),Er(h,I.marginBox,k))},Si=function(t){var h=t.axis,I=t.moveInto,k=t.isMoving;return je(h.line,I.contentBox[h.start]+tn(h,k),Er(h,I.contentBox,k))},Di=function(e){var t=e.impact,h=e.draggable,I=e.draggables,k=e.droppable,M=e.afterCritical,V=et(k.descriptor.id,I),z=h.page,ee=k.axis;if(!V.length)return Si({axis:ee,moveInto:k.page,isMoving:z});var ie=t.displaced,ae=t.displacedBy,re=ie.all[0];if(re){var te=I[re];if(Pt(re,M))return nn({axis:ee,moveRelativeTo:te.page,isMoving:z});var oe=p(te.page,ae.point);return nn({axis:ee,moveRelativeTo:oe,isMoving:z})}var pe=V[V.length-1];if(pe.descriptor.id===h.descriptor.id)return z.borderBox.center;if(Pt(pe.descriptor.id,M)){var Re=p(pe.page,Ue(M.displacedBy.point));return rn({axis:ee,moveRelativeTo:Re,isMoving:z})}return rn({axis:ee,moveRelativeTo:pe.page,isMoving:z})},xr=function(e,t){var h=e.frame;return h?Ie(t,h.scroll.diff.displacement):t},Ci=function(t){var h=t.impact,I=t.draggable,k=t.droppable,M=t.draggables,V=t.afterCritical,z=I.page.borderBox.center,ee=h.at;return k&&ee?ee.type==="REORDER"?Di({impact:h,draggable:I,draggables:M,droppable:k,afterCritical:V}):xi({impact:h,draggables:M,afterCritical:V}):z},ur=function(e){var t=Ci(e),h=e.droppable,I=h?xr(h,t):t;return I},an=function(e,t){var h=_e(t,e.scroll.initial),I=Ue(h),k=C({top:t.y,bottom:t.y+e.frame.height,left:t.x,right:t.x+e.frame.width}),M={frame:k,scroll:{initial:e.scroll.initial,max:e.scroll.max,current:t,diff:{value:h,displacement:I}}};return M};function sn(e,t){return e.map(function(h){return t[h]})}function Ai(e,t){for(var h=0;h<t.length;h++){var I=t[h].visible[e];if(I)return I}return null}var wi=function(e){var t=e.impact,h=e.viewport,I=e.destination,k=e.draggables,M=e.maxScrollChange,V=an(h,Ie(h.scroll.current,M)),z=I.frame?H(I,Ie(I.frame.scroll.current,M)):I,ee=t.displaced,ie=vt({afterDragging:sn(ee.all,k),destination:I,displacedBy:t.displacedBy,viewport:V.frame,last:ee,forceShouldAnimate:!1}),ae=vt({afterDragging:sn(ee.all,k),destination:z,displacedBy:t.displacedBy,viewport:h.frame,last:ee,forceShouldAnimate:!1}),re={},te={},oe=[ee,ie,ae];ee.all.forEach(function(Re){var Pe=Ai(Re,oe);if(Pe){te[Re]=Pe;return}re[Re]=!0});var pe=Object(B.a)({},t,{displaced:{all:ee.all,invisible:re,visible:te}});return pe},Ri=function(e,t){return Ie(e.scroll.diff.displacement,t)},Tr=function(e){var t=e.pageBorderBoxCenter,h=e.draggable,I=e.viewport,k=Ri(I,t),M=_e(k,h.page.borderBox.center);return Ie(h.client.borderBox.center,M)},on=function(e){var t=e.draggable,h=e.destination,I=e.newPageBorderBoxCenter,k=e.viewport,M=e.withDroppableDisplacement,V=e.onlyOnMainAxis,z=V===void 0?!1:V,ee=_e(I,t.page.borderBox.center),ie=Ve(t.page.borderBox,ee),ae={target:ie,destination:h,withDroppableDisplacement:M,viewport:k};return z?Ct(ae):it(ae)},Ii=function(e){var t=e.isMovingForward,h=e.draggable,I=e.destination,k=e.draggables,M=e.previousImpact,V=e.viewport,z=e.previousPageBorderBoxCenter,ee=e.previousClientSelection,ie=e.afterCritical;if(!I.isEnabled)return null;var ae=et(I.descriptor.id,k),re=ft(h,I),te=Et({isMovingForward:t,draggable:h,destination:I,insideDestination:ae,previousImpact:M})||bi({isMovingForward:t,isInHomeList:re,draggable:h,draggables:k,destination:I,insideDestination:ae,previousImpact:M,viewport:V,afterCritical:ie});if(!te)return null;var oe=ur({impact:te,draggable:h,droppable:I,draggables:k,afterCritical:ie}),pe=on({draggable:h,destination:I,newPageBorderBoxCenter:oe,viewport:V.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0});if(pe){var Re=Tr({pageBorderBoxCenter:oe,draggable:h,viewport:V});return{clientSelection:Re,impact:te,scrollJumpRequest:null}}var Pe=_e(oe,z),Be=wi({impact:te,viewport:V,destination:I,draggables:k,maxScrollChange:Pe});return{clientSelection:ee,impact:Be,scrollJumpRequest:Pe}},Tt=function(t){var h=t.subject.active;return h||de(!1),h},Li=function(e){var t=e.isMovingForward,h=e.pageBorderBoxCenter,I=e.source,k=e.droppables,M=e.viewport,V=I.subject.active;if(!V)return null;var z=I.axis,ee=ht(V[z.start],V[z.end]),ie=ze(k).filter(function(re){return re!==I}).filter(function(re){return re.isEnabled}).filter(function(re){return Boolean(re.subject.active)}).filter(function(re){return Mt(M.frame)(Tt(re))}).filter(function(re){var te=Tt(re);return t?V[z.crossAxisEnd]<te[z.crossAxisEnd]:te[z.crossAxisStart]<V[z.crossAxisStart]}).filter(function(re){var te=Tt(re),oe=ht(te[z.start],te[z.end]);return ee(te[z.start])||ee(te[z.end])||oe(V[z.start])||oe(V[z.end])}).sort(function(re,te){var oe=Tt(re)[z.crossAxisStart],pe=Tt(te)[z.crossAxisStart];return t?oe-pe:pe-oe}).filter(function(re,te,oe){return Tt(re)[z.crossAxisStart]===Tt(oe[0])[z.crossAxisStart]});if(!ie.length)return null;if(ie.length===1)return ie[0];var ae=ie.filter(function(re){var te=ht(Tt(re)[z.start],Tt(re)[z.end]);return te(h[z.line])});return ae.length===1?ae[0]:ae.length>1?ae.sort(function(re,te){return Tt(re)[z.start]-Tt(te)[z.start]})[0]:ie.sort(function(re,te){var oe=Ke(h,X(Tt(re))),pe=Ke(h,X(Tt(te)));return oe!==pe?oe-pe:Tt(re)[z.start]-Tt(te)[z.start]})[0]},ln=function(t,h){var I=t.page.borderBox.center;return Pt(t.descriptor.id,h)?_e(I,h.displacedBy.point):I},_i=function(t,h){var I=t.page.borderBox;return Pt(t.descriptor.id,h)?Ve(I,Ue(h.displacedBy.point)):I},Pi=function(e){var t=e.pageBorderBoxCenter,h=e.viewport,I=e.destination,k=e.insideDestination,M=e.afterCritical,V=k.filter(function(z){return it({target:_i(z,M),destination:I,viewport:h.frame,withDroppableDisplacement:!0})}).sort(function(z,ee){var ie=Ge(t,xr(I,ln(z,M))),ae=Ge(t,xr(I,ln(ee,M)));return ie<ae?-1:ae<ie?1:z.descriptor.index-ee.descriptor.index});return V[0]||null},$t=i(function(t,h){var I=h[t.line];return{value:I,point:je(t.line,I)}}),Oi=function(t,h,I){var k=t.axis;if(t.descriptor.mode==="virtual")return je(k.line,h[k.line]);var M=t.subject.page.contentBox[k.size],V=et(t.descriptor.id,I),z=V.reduce(function(ae,re){return ae+re.client.marginBox[k.size]},0),ee=z+h[k.line],ie=ee-M;return ie<=0?null:je(k.line,ie)},un=function(t,h){return Object(B.a)({},t,{scroll:Object(B.a)({},t.scroll,{max:h})})},dn=function(t,h,I){var k=t.frame;ft(h,t)&&de(!1),t.subject.withPlaceholder&&de(!1);var M=$t(t.axis,h.displaceBy).point,V=Oi(t,M,I),z={placeholderSize:M,increasedBy:V,oldFrameMaxScroll:t.frame?t.frame.scroll.max:null};if(!k){var ee=W({page:t.subject.page,withPlaceholder:z,axis:t.axis,frame:t.frame});return Object(B.a)({},t,{subject:ee})}var ie=V?Ie(k.scroll.max,V):k.scroll.max,ae=un(k,ie),re=W({page:t.subject.page,withPlaceholder:z,axis:t.axis,frame:ae});return Object(B.a)({},t,{subject:re,frame:ae})},Mi=function(t){var h=t.subject.withPlaceholder;h||de(!1);var I=t.frame;if(!I){var k=W({page:t.subject.page,axis:t.axis,frame:null,withPlaceholder:null});return Object(B.a)({},t,{subject:k})}var M=h.oldFrameMaxScroll;M||de(!1);var V=un(I,M),z=W({page:t.subject.page,axis:t.axis,frame:V,withPlaceholder:null});return Object(B.a)({},t,{subject:z,frame:V})},ki=function(e){var t=e.previousPageBorderBoxCenter,h=e.moveRelativeTo,I=e.insideDestination,k=e.draggable,M=e.draggables,V=e.destination,z=e.viewport,ee=e.afterCritical;if(!h){if(I.length)return null;var ie={displaced:St,displacedBy:at,at:{type:"REORDER",destination:{droppableId:V.descriptor.id,index:0}}},ae=ur({impact:ie,draggable:k,droppable:V,draggables:M,afterCritical:ee}),re=ft(k,V)?V:dn(V,k,M),te=on({draggable:k,destination:re,newPageBorderBoxCenter:ae,viewport:z.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0});return te?ie:null}var oe=Boolean(t[V.axis.line]<=h.page.borderBox.center[V.axis.line]),pe=function(){var Pe=h.descriptor.index;return h.descriptor.id===k.descriptor.id||oe?Pe:Pe+1}(),Re=$t(V.axis,k.displaceBy);return Ft({draggable:k,insideDestination:I,destination:V,viewport:z,displacedBy:Re,last:St,index:pe})},Bi=function(e){var t=e.isMovingForward,h=e.previousPageBorderBoxCenter,I=e.draggable,k=e.isOver,M=e.draggables,V=e.droppables,z=e.viewport,ee=e.afterCritical,ie=Li({isMovingForward:t,pageBorderBoxCenter:h,source:k,droppables:V,viewport:z});if(!ie)return null;var ae=et(ie.descriptor.id,M),re=Pi({pageBorderBoxCenter:h,viewport:z,destination:ie,insideDestination:ae,afterCritical:ee}),te=ki({previousPageBorderBoxCenter:h,destination:ie,draggable:I,draggables:M,moveRelativeTo:re,insideDestination:ae,viewport:z,afterCritical:ee});if(!te)return null;var oe=ur({impact:te,draggable:I,droppable:ie,draggables:M,afterCritical:ee}),pe=Tr({pageBorderBoxCenter:oe,draggable:I,viewport:z});return{clientSelection:pe,impact:te,scrollJumpRequest:null}},At=function(e){var t=e.at;return t?t.type==="REORDER"?t.destination.droppableId:t.combine.droppableId:null},Ni=function(t,h){var I=At(t);return I?h[I]:null},Ui=function(e){var t=e.state,h=e.type,I=Ni(t.impact,t.dimensions.droppables),k=Boolean(I),M=t.dimensions.droppables[t.critical.droppable.id],V=I||M,z=V.axis.direction,ee=z==="vertical"&&(h==="MOVE_UP"||h==="MOVE_DOWN")||z==="horizontal"&&(h==="MOVE_LEFT"||h==="MOVE_RIGHT");if(ee&&!k)return null;var ie=h==="MOVE_DOWN"||h==="MOVE_RIGHT",ae=t.dimensions.draggables[t.critical.draggable.id],re=t.current.page.borderBoxCenter,te=t.dimensions,oe=te.draggables,pe=te.droppables;return ee?Ii({isMovingForward:ie,previousPageBorderBoxCenter:re,draggable:ae,destination:V,draggables:oe,viewport:t.viewport,previousClientSelection:t.current.client.selection,previousImpact:t.impact,afterCritical:t.afterCritical}):Bi({isMovingForward:ie,previousPageBorderBoxCenter:re,draggable:ae,isOver:V,draggables:oe,droppables:pe,viewport:t.viewport,afterCritical:t.afterCritical})};function kt(e){return e.phase==="DRAGGING"||e.phase==="COLLECTING"}function cn(e){var t=ht(e.top,e.bottom),h=ht(e.left,e.right);return function(k){return t(k.y)&&h(k.x)}}function Fi(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function Wi(e){var t=e.pageBorderBox,h=e.draggable,I=e.candidates,k=h.page.borderBox.center,M=I.map(function(V){var z=V.axis,ee=je(V.axis.line,t.center[z.line],V.page.borderBox.center[z.crossAxisLine]);return{id:V.descriptor.id,distance:Ge(k,ee)}}).sort(function(V,z){return z.distance-V.distance});return M[0]?M[0].id:null}function ji(e){var t=e.pageBorderBox,h=e.draggable,I=e.droppables,k=ze(I).filter(function(M){if(!M.isEnabled)return!1;var V=M.subject.active;if(!V)return!1;if(!Fi(t,V))return!1;if(cn(V)(t.center))return!0;var z=M.axis,ee=V.center[z.crossAxisLine],ie=t[z.crossAxisStart],ae=t[z.crossAxisEnd],re=ht(V[z.crossAxisStart],V[z.crossAxisEnd]),te=re(ie),oe=re(ae);return!te&&!oe?!0:te?ie<ee:ae>ee});return k.length?k.length===1?k[0].descriptor.id:Wi({pageBorderBox:t,draggable:h,candidates:k}):null}var fn=function(t,h){return C(Ve(t,h))},Gi=function(e,t){var h=e.frame;return h?fn(t,h.scroll.diff.value):t};function hn(e){var t=e.displaced,h=e.id;return Boolean(t.visible[h]||t.invisible[h])}function Hi(e){var t=e.draggable,h=e.closest,I=e.inHomeList;return h?I&&h.descriptor.index>t.descriptor.index?h.descriptor.index-1:h.descriptor.index:null}var Ki=function(e){var t=e.pageBorderBoxWithDroppableScroll,h=e.draggable,I=e.destination,k=e.insideDestination,M=e.last,V=e.viewport,z=e.afterCritical,ee=I.axis,ie=$t(I.axis,h.displaceBy),ae=ie.value,re=t[ee.start],te=t[ee.end],oe=lt(h,k),pe=ue(oe,function(Pe){var Be=Pe.descriptor.id,He=Pe.page.borderBox.center[ee.line],$e=Pt(Be,z),Je=hn({displaced:M,id:Be});return $e?Je?te<=He:re<He-ae:Je?te<=He+ae:re<He}),Re=Hi({draggable:h,closest:pe,inHomeList:ft(h,I)});return Ft({draggable:h,insideDestination:k,destination:I,viewport:V,last:M,displacedBy:ie,index:Re})},Vi=4,zi=function(e){var t=e.draggable,h=e.pageBorderBoxWithDroppableScroll,I=e.previousImpact,k=e.destination,M=e.insideDestination,V=e.afterCritical;if(!k.isCombineEnabled)return null;var z=k.axis,ee=$t(k.axis,t.displaceBy),ie=ee.value,ae=h[z.start],re=h[z.end],te=lt(t,M),oe=ue(te,function(Re){var Pe=Re.descriptor.id,Be=Re.page.borderBox,He=Be[z.size],$e=He/Vi,Je=Pt(Pe,V),rt=hn({displaced:I.displaced,id:Pe});return Je?rt?re>Be[z.start]+$e&&re<Be[z.end]-$e:ae>Be[z.start]-ie+$e&&ae<Be[z.end]-ie-$e:rt?re>Be[z.start]+ie+$e&&re<Be[z.end]+ie-$e:ae>Be[z.start]+$e&&ae<Be[z.end]-$e});if(!oe)return null;var pe={displacedBy:ee,displaced:I.displaced,at:{type:"COMBINE",combine:{draggableId:oe.descriptor.id,droppableId:k.descriptor.id}}};return pe},pn=function(e){var t=e.pageOffset,h=e.draggable,I=e.draggables,k=e.droppables,M=e.previousImpact,V=e.viewport,z=e.afterCritical,ee=fn(h.page.borderBox,t),ie=ji({pageBorderBox:ee,draggable:h,droppables:k});if(!ie)return Nt;var ae=k[ie],re=et(ae.descriptor.id,I),te=Gi(ae,ee);return zi({pageBorderBoxWithDroppableScroll:te,draggable:h,previousImpact:M,destination:ae,insideDestination:re,afterCritical:z})||Ki({pageBorderBoxWithDroppableScroll:te,draggable:h,destination:ae,insideDestination:re,last:M.displaced,viewport:V,afterCritical:z})},Sr=function(e,t){var h;return Object(B.a)({},e,(h={},h[t.descriptor.id]=t,h))},$i=function(t){var h=t.previousImpact,I=t.impact,k=t.droppables,M=At(h),V=At(I);if(!M)return k;if(M===V)return k;var z=k[M];if(!z.subject.withPlaceholder)return k;var ee=Mi(z);return Sr(k,ee)},Xi=function(e){var t=e.draggable,h=e.draggables,I=e.droppables,k=e.previousImpact,M=e.impact,V=$i({previousImpact:k,impact:M,droppables:I}),z=At(M);if(!z)return V;var ee=I[z];if(ft(t,ee))return V;if(ee.subject.withPlaceholder)return V;var ie=dn(ee,t,h);return Sr(V,ie)},Xt=function(e){var t=e.state,h=e.clientSelection,I=e.dimensions,k=e.viewport,M=e.impact,V=e.scrollJumpRequest,z=k||t.viewport,ee=I||t.dimensions,ie=h||t.current.client.selection,ae=_e(ie,t.initial.client.selection),re={offset:ae,selection:ie,borderBoxCenter:Ie(t.initial.client.borderBoxCenter,ae)},te={selection:Ie(re.selection,z.scroll.current),borderBoxCenter:Ie(re.borderBoxCenter,z.scroll.current),offset:Ie(re.offset,z.scroll.diff.value)},oe={client:re,page:te};if(t.phase==="COLLECTING")return Object(B.a)({phase:"COLLECTING"},t,{dimensions:ee,viewport:z,current:oe});var pe=ee.draggables[t.critical.draggable.id],Re=M||pn({pageOffset:te.offset,draggable:pe,draggables:ee.draggables,droppables:ee.droppables,previousImpact:t.impact,viewport:z,afterCritical:t.afterCritical}),Pe=Xi({draggable:pe,impact:Re,previousImpact:t.impact,draggables:ee.draggables,droppables:ee.droppables}),Be=Object(B.a)({},t,{current:oe,dimensions:{draggables:ee.draggables,droppables:Pe},impact:Re,viewport:z,scrollJumpRequest:V||null,forceShouldAnimate:V?!1:null});return Be};function Yi(e,t){return e.map(function(h){return t[h]})}var mn=function(e){var t=e.impact,h=e.viewport,I=e.draggables,k=e.destination,M=e.forceShouldAnimate,V=t.displaced,z=Yi(V.all,I),ee=vt({afterDragging:z,destination:k,displacedBy:t.displacedBy,viewport:h.frame,forceShouldAnimate:M,last:V});return Object(B.a)({},t,{displaced:ee})},gn=function(e){var t=e.impact,h=e.draggable,I=e.droppable,k=e.draggables,M=e.viewport,V=e.afterCritical,z=ur({impact:t,draggable:h,draggables:k,droppable:I,afterCritical:V});return Tr({pageBorderBoxCenter:z,draggable:h,viewport:M})},vn=function(e){var t=e.state,h=e.dimensions,I=e.viewport;t.movementMode==="SNAP"||de(!1);var k=t.impact,M=I||t.viewport,V=h||t.dimensions,z=V.draggables,ee=V.droppables,ie=z[t.critical.draggable.id],ae=At(k);ae||de(!1);var re=ee[ae],te=mn({impact:k,viewport:M,destination:re,draggables:z}),oe=gn({impact:te,draggable:ie,droppable:re,draggables:z,viewport:M,afterCritical:t.afterCritical});return Xt({impact:te,clientSelection:oe,state:t,dimensions:V,viewport:M})},Ji=function(e){return{index:e.index,droppableId:e.droppableId}},yn=function(e){var t=e.draggable,h=e.home,I=e.draggables,k=e.viewport,M=$t(h.axis,t.displaceBy),V=et(h.descriptor.id,I),z=V.indexOf(t);z!==-1||de(!1);var ee=V.slice(z+1),ie=ee.reduce(function(oe,pe){return oe[pe.descriptor.id]=!0,oe},{}),ae={inVirtualList:h.descriptor.mode==="virtual",displacedBy:M,effected:ie},re=vt({afterDragging:ee,destination:h,displacedBy:M,last:null,viewport:k.frame,forceShouldAnimate:!1}),te={displaced:re,displacedBy:M,at:{type:"REORDER",destination:Ji(t.descriptor)}};return{impact:te,afterCritical:ae}},Qi=function(e,t){return{draggables:e.draggables,droppables:Sr(e.droppables,t)}},Yt=function(t){},Jt=function(t){},Zi=function(e){var t=e.draggable,h=e.offset,I=e.initialWindowScroll,k=p(t.client,h),M=d(k,I),V=Object(B.a)({},t,{placeholder:Object(B.a)({},t.placeholder,{client:k}),client:k,page:M});return V},qi=function(e){var t=e.frame;return t||de(!1),t},ea=function(e){var t=e.additions,h=e.updatedDroppables,I=e.viewport,k=I.scroll.diff.value;return t.map(function(M){var V=M.descriptor.droppableId,z=h[V],ee=qi(z),ie=ee.scroll.diff.value,ae=Ie(k,ie),re=Zi({draggable:M,offset:ae,initialWindowScroll:I.scroll.initial});return re})},ta=function(e){var t=e.state,h=e.published;Yt();var I=h.modified.map(function($e){var Je=t.dimensions.droppables[$e.droppableId],rt=H(Je,$e.scroll);return rt}),k=Object(B.a)({},t.dimensions.droppables,{},Fe(I)),M=Ye(ea({additions:h.additions,updatedDroppables:k,viewport:t.viewport})),V=Object(B.a)({},t.dimensions.draggables,{},M);h.removals.forEach(function($e){delete V[$e]});var z={droppables:k,draggables:V},ee=At(t.impact),ie=ee?z.droppables[ee]:null,ae=z.draggables[t.critical.draggable.id],re=z.droppables[t.critical.droppable.id],te=yn({draggable:ae,home:re,draggables:V,viewport:t.viewport}),oe=te.impact,pe=te.afterCritical,Re=ie&&ie.isCombineEnabled?t.impact:oe,Pe=pn({pageOffset:t.current.page.offset,draggable:z.draggables[t.critical.draggable.id],draggables:z.draggables,droppables:z.droppables,previousImpact:Re,viewport:t.viewport,afterCritical:pe});Jt();var Be=Object(B.a)({phase:"DRAGGING"},t,{phase:"DRAGGING",impact:Pe,onLiftImpact:oe,dimensions:z,afterCritical:pe,forceShouldAnimate:!1});if(t.phase==="COLLECTING")return Be;var He=Object(B.a)({phase:"DROP_PENDING"},Be,{phase:"DROP_PENDING",reason:t.reason,isWaiting:!1});return He},Dr=function(t){return t.movementMode==="SNAP"},Cr=function(t,h,I){var k=Qi(t.dimensions,h);return!Dr(t)||I?Xt({state:t,dimensions:k}):vn({state:t,dimensions:k})};function Ar(e){return e.isDragging&&e.movementMode==="SNAP"?Object(B.a)({phase:"DRAGGING"},e,{scrollJumpRequest:null}):e}var bn={phase:"IDLE",completed:null,shouldFlush:!1},ra=function(e,t){if(e===void 0&&(e=bn),t.type==="FLUSH")return Object(B.a)({},bn,{shouldFlush:!0});if(t.type==="INITIAL_PUBLISH"){e.phase==="IDLE"||de(!1);var h=t.payload,I=h.critical,k=h.clientSelection,M=h.viewport,V=h.dimensions,z=h.movementMode,ee=V.draggables[I.draggable.id],ie=V.droppables[I.droppable.id],ae={selection:k,borderBoxCenter:ee.client.borderBox.center,offset:Ee},re={client:ae,page:{selection:Ie(ae.selection,M.scroll.initial),borderBoxCenter:Ie(ae.selection,M.scroll.initial),offset:Ie(ae.selection,M.scroll.diff.value)}},te=ze(V.droppables).every(function(Ll){return!Ll.isFixedOnPage}),oe=yn({draggable:ee,home:ie,draggables:V.draggables,viewport:M}),pe=oe.impact,Re=oe.afterCritical,Pe={phase:"DRAGGING",isDragging:!0,critical:I,movementMode:z,dimensions:V,initial:re,current:re,isWindowScrollAllowed:te,impact:pe,afterCritical:Re,onLiftImpact:pe,viewport:M,scrollJumpRequest:null,forceShouldAnimate:null};return Pe}if(t.type==="COLLECTION_STARTING"){if(e.phase==="COLLECTING"||e.phase==="DROP_PENDING")return e;e.phase==="DRAGGING"||de(!1);var Be=Object(B.a)({phase:"COLLECTING"},e,{phase:"COLLECTING"});return Be}if(t.type==="PUBLISH_WHILE_DRAGGING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"||de(!1),ta({state:e,published:t.payload});if(t.type==="MOVE"){if(e.phase==="DROP_PENDING")return e;kt(e)||de(!1);var He=t.payload.client;return Me(He,e.current.client.selection)?e:Xt({state:e,clientSelection:He,impact:Dr(e)?e.impact:null})}if(t.type==="UPDATE_DROPPABLE_SCROLL"){if(e.phase==="DROP_PENDING")return Ar(e);if(e.phase==="COLLECTING")return Ar(e);kt(e)||de(!1);var $e=t.payload,Je=$e.id,rt=$e.newScroll,tt=e.dimensions.droppables[Je];if(!tt)return e;var ut=H(tt,rt);return Cr(e,ut,!1)}if(t.type==="UPDATE_DROPPABLE_IS_ENABLED"){if(e.phase==="DROP_PENDING")return e;kt(e)||de(!1);var bt=t.payload,st=bt.id,yt=bt.isEnabled,Rt=e.dimensions.droppables[st];Rt||de(!1),Rt.isEnabled!==yt||de(!1);var It=Object(B.a)({},Rt,{isEnabled:yt});return Cr(e,It,!0)}if(t.type==="UPDATE_DROPPABLE_IS_COMBINE_ENABLED"){if(e.phase==="DROP_PENDING")return e;kt(e)||de(!1);var Ht=t.payload,ar=Ht.id,Kt=Ht.isCombineEnabled,sr=e.dimensions.droppables[ar];sr||de(!1),sr.isCombineEnabled!==Kt||de(!1);var xl=Object(B.a)({},sr,{isCombineEnabled:Kt});return Cr(e,xl,!0)}if(t.type==="MOVE_BY_WINDOW_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="DROP_ANIMATING")return e;kt(e)||de(!1),e.isWindowScrollAllowed||de(!1);var pi=t.payload.newScroll;if(Me(e.viewport.scroll.current,pi))return Ar(e);var mi=an(e.viewport,pi);return Dr(e)?vn({state:e,viewport:mi}):Xt({state:e,viewport:mi})}if(t.type==="UPDATE_VIEWPORT_MAX_SCROLL"){if(!kt(e))return e;var gi=t.payload.maxScroll;if(Me(gi,e.viewport.scroll.max))return e;var Tl=Object(B.a)({},e.viewport,{scroll:Object(B.a)({},e.viewport.scroll,{max:gi})});return Object(B.a)({phase:"DRAGGING"},e,{viewport:Tl})}if(t.type==="MOVE_UP"||t.type==="MOVE_DOWN"||t.type==="MOVE_LEFT"||t.type==="MOVE_RIGHT"){if(e.phase==="COLLECTING"||e.phase==="DROP_PENDING")return e;e.phase==="DRAGGING"||de(!1);var vr=Ui({state:e,type:t.type});return vr?Xt({state:e,impact:vr.impact,clientSelection:vr.clientSelection,scrollJumpRequest:vr.scrollJumpRequest}):e}if(t.type==="DROP_PENDING"){var Sl=t.payload.reason;e.phase==="COLLECTING"||de(!1);var Dl=Object(B.a)({phase:"DROP_PENDING"},e,{phase:"DROP_PENDING",isWaiting:!0,reason:Sl});return Dl}if(t.type==="DROP_ANIMATE"){var en=t.payload,Cl=en.completed,Al=en.dropDuration,wl=en.newHomeClientOffset;e.phase==="DRAGGING"||e.phase==="DROP_PENDING"||de(!1);var Rl={phase:"DROP_ANIMATING",completed:Cl,dropDuration:Al,newHomeClientOffset:wl,dimensions:e.dimensions};return Rl}if(t.type==="DROP_COMPLETE"){var Il=t.payload.completed;return{phase:"IDLE",completed:Il,shouldFlush:!1}}return e},na=function(t){return{type:"BEFORE_INITIAL_CAPTURE",payload:t}},ia=function(t){return{type:"LIFT",payload:t}},aa=function(t){return{type:"INITIAL_PUBLISH",payload:t}},sa=function(t){return{type:"PUBLISH_WHILE_DRAGGING",payload:t}},oa=function(){return{type:"COLLECTION_STARTING",payload:null}},la=function(t){return{type:"UPDATE_DROPPABLE_SCROLL",payload:t}},ua=function(t){return{type:"UPDATE_DROPPABLE_IS_ENABLED",payload:t}},da=function(t){return{type:"UPDATE_DROPPABLE_IS_COMBINE_ENABLED",payload:t}},En=function(t){return{type:"MOVE",payload:t}},ca=function(t){return{type:"MOVE_BY_WINDOW_SCROLL",payload:t}},fa=function(t){return{type:"UPDATE_VIEWPORT_MAX_SCROLL",payload:t}},ha=function(){return{type:"MOVE_UP",payload:null}},pa=function(){return{type:"MOVE_DOWN",payload:null}},ma=function(){return{type:"MOVE_RIGHT",payload:null}},ga=function(){return{type:"MOVE_LEFT",payload:null}},wr=function(){return{type:"FLUSH",payload:null}},va=function(t){return{type:"DROP_ANIMATE",payload:t}},Rr=function(t){return{type:"DROP_COMPLETE",payload:t}},xn=function(t){return{type:"DROP",payload:t}},ya=function(t){return{type:"DROP_PENDING",payload:t}},Tn=function(){return{type:"DROP_ANIMATION_FINISHED",payload:null}};function _l(e){if(e.length<=1)return;for(var t=e.map(function(z){return z.descriptor.index}),h={},I=1;I<t.length;I++){var k=t[I],M=t[I-1];k!==M+1&&(h[k]=!0)}if(!Object.keys(h).length)return;var V=t.map(function(z){var ee=Boolean(h[z]);return ee?"[\u{1F525}"+z+"]":""+z}).join(", ")}function ba(e,t){if(!1)var h}var Ea=function(e){return function(t){var h=t.getState,I=t.dispatch;return function(k){return function(M){if(M.type!=="LIFT"){k(M);return}var V=M.payload,z=V.id,ee=V.clientSelection,ie=V.movementMode,ae=h();ae.phase==="DROP_ANIMATING"&&I(Rr({completed:ae.completed})),h().phase==="IDLE"||de(!1),I(wr()),I(na({draggableId:z,movementMode:ie}));var re={shouldPublishImmediately:ie==="SNAP"},te={draggableId:z,scrollOptions:re},oe=e.startPublishing(te),pe=oe.critical,Re=oe.dimensions,Pe=oe.viewport;ba(pe,Re),I(aa({critical:pe,dimensions:Re,clientSelection:ee,movementMode:ie,viewport:Pe}))}}}},xa=function(e){return function(){return function(t){return function(h){h.type==="INITIAL_PUBLISH"&&e.dragging(),h.type==="DROP_ANIMATE"&&e.dropping(h.payload.completed.result.reason),(h.type==="FLUSH"||h.type==="DROP_COMPLETE")&&e.resting(),t(h)}}}},Ir={outOfTheWay:"cubic-bezier(0.2, 0, 0, 1)",drop:"cubic-bezier(.2,1,.1,1)"},Qt={opacity:{drop:0,combining:.7},scale:{drop:.75}},Lr={outOfTheWay:.2,minDropTime:.33,maxDropTime:.55},Bt=Lr.outOfTheWay+"s "+Ir.outOfTheWay,Zt={fluid:"opacity "+Bt,snap:"transform "+Bt+", opacity "+Bt,drop:function(t){var h=t+"s "+Ir.drop;return"transform "+h+", opacity "+h},outOfTheWay:"transform "+Bt,placeholder:"height "+Bt+", width "+Bt+", margin "+Bt},Sn=function(t){return Me(t,Ee)?null:"translate("+t.x+"px, "+t.y+"px)"},_r={moveTo:Sn,drop:function(t,h){var I=Sn(t);return I?h?I+" scale("+Qt.scale.drop+")":I:null}},Pr=Lr.minDropTime,Dn=Lr.maxDropTime,Ta=Dn-Pr,Cn=1500,Sa=.6,Da=function(e){var t=e.current,h=e.destination,I=e.reason,k=Ge(t,h);if(k<=0)return Pr;if(k>=Cn)return Dn;var M=k/Cn,V=Pr+Ta*M,z=I==="CANCEL"?V*Sa:V;return Number(z.toFixed(2))},Ca=function(e){var t=e.impact,h=e.draggable,I=e.dimensions,k=e.viewport,M=e.afterCritical,V=I.draggables,z=I.droppables,ee=At(t),ie=ee?z[ee]:null,ae=z[h.descriptor.droppableId],re=gn({impact:t,draggable:h,draggables:V,afterCritical:M,droppable:ie||ae,viewport:k}),te=_e(re,h.client.borderBox.center);return te},Aa=function(e){var t=e.draggables,h=e.reason,I=e.lastImpact,k=e.home,M=e.viewport,V=e.onLiftImpact;if(!I.at||h!=="DROP"){var z=mn({draggables:t,impact:V,destination:k,viewport:M,forceShouldAnimate:!0});return{impact:z,didDropInsideDroppable:!1}}if(I.at.type==="REORDER")return{impact:I,didDropInsideDroppable:!0};var ee=Object(B.a)({},I,{displaced:St});return{impact:ee,didDropInsideDroppable:!0}},wa=function(e){var t=e.getState,h=e.dispatch;return function(I){return function(k){if(k.type!=="DROP"){I(k);return}var M=t(),V=k.payload.reason;if(M.phase==="COLLECTING"){h(ya({reason:V}));return}if(M.phase==="IDLE")return;var z=M.phase==="DROP_PENDING"&&M.isWaiting;z&&de(!1),M.phase==="DRAGGING"||M.phase==="DROP_PENDING"||de(!1);var ee=M.critical,ie=M.dimensions,ae=ie.draggables[M.critical.draggable.id],re=Aa({reason:V,lastImpact:M.impact,afterCritical:M.afterCritical,onLiftImpact:M.onLiftImpact,home:M.dimensions.droppables[M.critical.droppable.id],viewport:M.viewport,draggables:M.dimensions.draggables}),te=re.impact,oe=re.didDropInsideDroppable,pe=oe?Ze(te):null,Re=oe?gt(te):null,Pe={index:ee.draggable.index,droppableId:ee.droppable.id},Be={draggableId:ae.descriptor.id,type:ae.descriptor.type,source:Pe,reason:V,mode:M.movementMode,destination:pe,combine:Re},He=Ca({impact:te,draggable:ae,dimensions:ie,viewport:M.viewport,afterCritical:M.afterCritical}),$e={critical:M.critical,afterCritical:M.afterCritical,result:Be,impact:te},Je=!Me(M.current.client.offset,He)||Boolean(Be.combine);if(!Je){h(Rr({completed:$e}));return}var rt=Da({current:M.current.client.offset,destination:He,reason:V}),tt={newHomeClientOffset:He,dropDuration:rt,completed:$e};h(va(tt))}}},An=function(){return{x:window.pageXOffset,y:window.pageYOffset}};function Ra(e){return{eventName:"scroll",options:{passive:!0,capture:!1},fn:function(h){if(h.target!==window&&h.target!==window.document)return;e()}}}function Ia(e){var t=e.onWindowScroll;function h(){t(An())}var I=g(h),k=Ra(I),M=Se;function V(){return M!==Se}function z(){V()&&de(!1),M=Ce(window,[k])}function ee(){V()||de(!1),I.cancel(),M(),M=Se}return{start:z,stop:ee,isActive:V}}var La=function(t){return t.type==="DROP_COMPLETE"||t.type==="DROP_ANIMATE"||t.type==="FLUSH"},_a=function(e){var t=Ia({onWindowScroll:function(I){e.dispatch(ca({newScroll:I}))}});return function(h){return function(I){!t.isActive()&&I.type==="INITIAL_PUBLISH"&&t.start(),t.isActive()&&La(I)&&t.stop(),h(I)}}},Pa=function(e){var t=!1,h=!1,I=setTimeout(function(){h=!0}),k=function(V){if(t)return;if(h)return;t=!0,e(V),clearTimeout(I)};return k.wasCalled=function(){return t},k},Oa=function(){var e=[],t=function(M){var V=ce(e,function(ie){return ie.timerId===M});V!==-1||de(!1);var z=e.splice(V,1),ee=z[0];ee.callback()},h=function(M){var V=setTimeout(function(){return t(V)}),z={timerId:V,callback:M};e.push(z)},I=function(){if(!e.length)return;var M=[].concat(e);e.length=0,M.forEach(function(V){clearTimeout(V.timerId),V.callback()})};return{add:h,flush:I}},Ma=function(t,h){return t==null&&h==null?!0:t==null||h==null?!1:t.droppableId===h.droppableId&&t.index===h.index},ka=function(t,h){return t==null&&h==null?!0:t==null||h==null?!1:t.draggableId===h.draggableId&&t.droppableId===h.droppableId},Ba=function(t,h){if(t===h)return!0;var I=t.draggable.id===h.draggable.id&&t.draggable.droppableId===h.draggable.droppableId&&t.draggable.type===h.draggable.type&&t.draggable.index===h.draggable.index,k=t.droppable.id===h.droppable.id&&t.droppable.type===h.droppable.type;return I&&k},qt=function(t,h){Yt(),h(),Jt()},dr=function(t,h){return{draggableId:t.draggable.id,type:t.droppable.type,source:{droppableId:t.droppable.id,index:t.draggable.index},mode:h}},Or=function(t,h,I,k){if(!t){I(k(h));return}var M=Pa(I),V={announce:M};t(h,V),M.wasCalled()||I(k(h))},Na=function(e,t){var h=Oa(),I=null,k=function(te,oe){I&&de(!1),qt("onBeforeCapture",function(){var pe=e().onBeforeCapture;if(pe){var Re={draggableId:te,mode:oe};pe(Re)}})},M=function(te,oe){I&&de(!1),qt("onBeforeDragStart",function(){var pe=e().onBeforeDragStart;pe&&pe(dr(te,oe))})},V=function(te,oe){I&&de(!1);var pe=dr(te,oe);I={mode:oe,lastCritical:te,lastLocation:pe.source,lastCombine:null},h.add(function(){qt("onDragStart",function(){return Or(e().onDragStart,pe,t,De.onDragStart)})})},z=function(te,oe){var pe=Ze(oe),Re=gt(oe);I||de(!1);var Pe=!Ba(te,I.lastCritical);Pe&&(I.lastCritical=te);var Be=!Ma(I.lastLocation,pe);Be&&(I.lastLocation=pe);var He=!ka(I.lastCombine,Re);if(He&&(I.lastCombine=Re),!Pe&&!Be&&!He)return;var $e=Object(B.a)({},dr(te,I.mode),{combine:Re,destination:pe});h.add(function(){qt("onDragUpdate",function(){return Or(e().onDragUpdate,$e,t,De.onDragUpdate)})})},ee=function(){I||de(!1),h.flush()},ie=function(te){I||de(!1),I=null,qt("onDragEnd",function(){return Or(e().onDragEnd,te,t,De.onDragEnd)})},ae=function(){if(!I)return;var te=Object(B.a)({},dr(I.lastCritical,I.mode),{combine:null,destination:null,reason:"CANCEL"});ie(te)};return{beforeCapture:k,beforeStart:M,start:V,update:z,flush:ee,drop:ie,abort:ae}},Ua=function(e,t){var h=Na(e,t);return function(I){return function(k){return function(M){if(M.type==="BEFORE_INITIAL_CAPTURE"){h.beforeCapture(M.payload.draggableId,M.payload.movementMode);return}if(M.type==="INITIAL_PUBLISH"){var V=M.payload.critical;h.beforeStart(V,M.payload.movementMode),k(M),h.start(V,M.payload.movementMode);return}if(M.type==="DROP_COMPLETE"){var z=M.payload.completed.result;h.flush(),k(M),h.drop(z);return}if(k(M),M.type==="FLUSH"){h.abort();return}var ee=I.getState();ee.phase==="DRAGGING"&&h.update(ee.critical,ee.impact)}}}},Fa=function(e){return function(t){return function(h){if(h.type!=="DROP_ANIMATION_FINISHED"){t(h);return}var I=e.getState();I.phase==="DROP_ANIMATING"||de(!1),e.dispatch(Rr({completed:I.completed}))}}},Wa=function(e){var t=null,h=null;function I(){h&&(cancelAnimationFrame(h),h=null),t&&(t(),t=null)}return function(k){return function(M){if((M.type==="FLUSH"||M.type==="DROP_COMPLETE"||M.type==="DROP_ANIMATION_FINISHED")&&I(),k(M),M.type!=="DROP_ANIMATE")return;var V={eventName:"scroll",options:{capture:!0,passive:!1,once:!0},fn:function(){var ee=e.getState();ee.phase==="DROP_ANIMATING"&&e.dispatch(Tn())}};h=requestAnimationFrame(function(){h=null,t=Ce(window,[V])})}}},ja=function(e){return function(){return function(t){return function(h){(h.type==="DROP_COMPLETE"||h.type==="FLUSH"||h.type==="DROP_ANIMATE")&&e.stopPublishing(),t(h)}}}},Ga=function(e){var t=!1;return function(){return function(h){return function(I){if(I.type==="INITIAL_PUBLISH"){t=!0,e.tryRecordFocus(I.payload.critical.draggable.id),h(I),e.tryRestoreFocusRecorded();return}if(h(I),!t)return;if(I.type==="FLUSH"){t=!1,e.tryRestoreFocusRecorded();return}if(I.type==="DROP_COMPLETE"){t=!1;var k=I.payload.completed.result;k.combine&&e.tryShiftRecord(k.draggableId,k.combine.draggableId),e.tryRestoreFocusRecorded()}}}}},Ha=function(t){return t.type==="DROP_COMPLETE"||t.type==="DROP_ANIMATE"||t.type==="FLUSH"},Ka=function(e){return function(t){return function(h){return function(I){if(Ha(I)){e.stop(),h(I);return}if(I.type==="INITIAL_PUBLISH"){h(I);var k=t.getState();k.phase==="DRAGGING"||de(!1),e.start(k);return}h(I),e.scroll(t.getState())}}}},Va=function(e){return function(t){return function(h){if(t(h),h.type!=="PUBLISH_WHILE_DRAGGING")return;var I=e.getState();if(I.phase!=="DROP_PENDING")return;if(I.isWaiting)return;e.dispatch(xn({reason:I.reason}))}}},za=R.d,$a=function(e){var t=e.dimensionMarshal,h=e.focusMarshal,I=e.styleMarshal,k=e.getResponders,M=e.announce,V=e.autoScroller;return Object(R.e)(ra,za(Object(R.a)(xa(I),ja(t),Ea(t),wa,Fa,Wa,Va,Ka(V),_a,Ga(h),Ua(k,M))))},Mr=function(){return{additions:{},removals:{},modified:{}}};function Xa(e){var t=e.registry,h=e.callbacks,I=Mr(),k=null,M=function(){if(k)return;h.collectionStarting(),k=requestAnimationFrame(function(){k=null,Yt();var ae=I,re=ae.additions,te=ae.removals,oe=ae.modified,pe=Object.keys(re).map(function(Be){return t.draggable.getById(Be).getDimension(Ee)}).sort(function(Be,He){return Be.descriptor.index-He.descriptor.index}),Re=Object.keys(oe).map(function(Be){var He=t.droppable.getById(Be),$e=He.callbacks.getScrollWhileDragging();return{droppableId:Be,scroll:$e}}),Pe={additions:pe,removals:Object.keys(te),modified:Re};I=Mr(),Jt(),h.publish(Pe)})},V=function(ae){var re=ae.descriptor.id;I.additions[re]=ae,I.modified[ae.descriptor.droppableId]=!0,I.removals[re]&&delete I.removals[re],M()},z=function(ae){var re=ae.descriptor;I.removals[re.id]=!0,I.modified[re.droppableId]=!0,I.additions[re.id]&&delete I.additions[re.id],M()},ee=function(){if(!k)return;cancelAnimationFrame(k),k=null,I=Mr()};return{add:V,remove:z,stop:ee}}var wn=function(e){var t=e.scrollHeight,h=e.scrollWidth,I=e.height,k=e.width,M=_e({x:h,y:t},{x:k,y:I}),V={x:Math.max(0,M.x),y:Math.max(0,M.y)};return V},Rn=function(){var e=document.documentElement;return e||de(!1),e},In=function(){var e=Rn(),t=wn({scrollHeight:e.scrollHeight,scrollWidth:e.scrollWidth,width:e.clientWidth,height:e.clientHeight});return t},Ya=function(){var e=An(),t=In(),h=e.y,I=e.x,k=Rn(),M=k.clientWidth,V=k.clientHeight,z=I+M,ee=h+V,ie=C({top:h,left:I,right:z,bottom:ee}),ae={frame:ie,scroll:{initial:e,current:e,max:t,diff:{value:Ee,displacement:Ee}}};return ae},Ja=function(e){var t=e.critical,h=e.scrollOptions,I=e.registry;Yt();var k=Ya(),M=k.scroll.current,V=t.droppable,z=I.droppable.getAllByType(V.type).map(function(re){return re.callbacks.getDimensionAndWatchScroll(M,h)}),ee=I.draggable.getAllByType(t.draggable.type).map(function(re){return re.getDimension(M)}),ie={draggables:Ye(ee),droppables:Fe(z)};Jt();var ae={dimensions:ie,critical:t,viewport:k};return ae};function Ln(e,t,h){if(h.descriptor.id===t.id)return!1;if(h.descriptor.type!==t.type)return!1;var I=e.droppable.getById(h.descriptor.droppableId);return!(I.descriptor.mode!=="virtual")}var Qa=function(e,t){var h=null,I=Xa({callbacks:{publish:t.publishWhileDragging,collectionStarting:t.collectionStarting},registry:e}),k=function(oe,pe){if(e.droppable.exists(oe)||de(!1),!h)return;t.updateDroppableIsEnabled({id:oe,isEnabled:pe})},M=function(oe,pe){if(!h)return;e.droppable.exists(oe)||de(!1),t.updateDroppableIsCombineEnabled({id:oe,isCombineEnabled:pe})},V=function(oe,pe){if(!h)return;e.droppable.exists(oe)||de(!1),t.updateDroppableScroll({id:oe,newScroll:pe})},z=function(oe,pe){if(!h)return;e.droppable.getById(oe).callbacks.scroll(pe)},ee=function(){if(!h)return;I.stop();var oe=h.critical.droppable;e.droppable.getAllByType(oe.type).forEach(function(pe){return pe.callbacks.dragStopped()}),h.unsubscribe(),h=null},ie=function(oe){h||de(!1);var pe=h.critical.draggable;oe.type==="ADDITION"&&(Ln(e,pe,oe.value)&&I.add(oe.value)),oe.type==="REMOVAL"&&(Ln(e,pe,oe.value)&&I.remove(oe.value))},ae=function(oe){h&&de(!1);var pe=e.draggable.getById(oe.draggableId),Re=e.droppable.getById(pe.descriptor.droppableId),Pe={draggable:pe.descriptor,droppable:Re.descriptor},Be=e.subscribe(ie);return h={critical:Pe,unsubscribe:Be},Ja({critical:Pe,registry:e,scrollOptions:oe.scrollOptions})},re={updateDroppableIsEnabled:k,updateDroppableIsCombineEnabled:M,scrollDroppable:z,updateDroppableScroll:V,startPublishing:ae,stopPublishing:ee};return re},_n=function(e,t){return e.phase==="IDLE"?!0:e.phase!=="DROP_ANIMATING"||e.completed.result.draggableId===t?!1:e.completed.result.reason==="DROP"},Za=function(e){window.scrollBy(e.x,e.y)},qa=i(function(e){return ze(e).filter(function(t){return t.isEnabled?!!t.frame:!1})}),es=function(t,h){var I=ue(qa(h),function(k){return k.frame||de(!1),cn(k.frame.pageMarginBox)(t)});return I},ts=function(e){var t=e.center,h=e.destination,I=e.droppables;if(h){var k=I[h];return k.frame?k:null}var M=es(t,I);return M},Ot={startFromPercentage:.25,maxScrollAtPercentage:.05,maxPixelScroll:28,ease:function(t){return Math.pow(t,2)},durationDampening:{stopDampeningAt:1200,accelerateAt:360}},rs=function(e,t){var h=e[t.size]*Ot.startFromPercentage,I=e[t.size]*Ot.maxScrollAtPercentage,k={startScrollingFrom:h,maxScrollValueAt:I};return k},Pn=function(e){var t=e.startOfRange,h=e.endOfRange,I=e.current,k=h-t;if(k===0)return 0;var M=I-t,V=M/k;return V},kr=1,ns=function(e,t){if(e>t.startScrollingFrom)return 0;if(e<=t.maxScrollValueAt)return Ot.maxPixelScroll;if(e===t.startScrollingFrom)return kr;var h=Pn({startOfRange:t.maxScrollValueAt,endOfRange:t.startScrollingFrom,current:e}),I=1-h,k=Ot.maxPixelScroll*Ot.ease(I);return Math.ceil(k)},On=Ot.durationDampening.accelerateAt,Mn=Ot.durationDampening.stopDampeningAt,is=function(e,t){var h=t,I=Mn,k=Date.now(),M=k-h;if(M>=Mn)return e;if(M<On)return kr;var V=Pn({startOfRange:On,endOfRange:I,current:M}),z=e*Ot.ease(V);return Math.ceil(z)},kn=function(e){var t=e.distanceToEdge,h=e.thresholds,I=e.dragStartTime,k=e.shouldUseTimeDampening,M=ns(t,h);return M===0?0:k?Math.max(is(M,I),kr):M},Bn=function(e){var t=e.container,h=e.distanceToEdges,I=e.dragStartTime,k=e.axis,M=e.shouldUseTimeDampening,V=rs(t,k),z=h[k.end]<h[k.start];return z?kn({distanceToEdge:h[k.end],thresholds:V,dragStartTime:I,shouldUseTimeDampening:M}):-1*kn({distanceToEdge:h[k.start],thresholds:V,dragStartTime:I,shouldUseTimeDampening:M})},as=function(e){var t=e.container,h=e.subject,I=e.proposedScroll,k=h.height>t.height,M=h.width>t.width;return!M&&!k?I:M&&k?null:{x:M?0:I.x,y:k?0:I.y}},ss=Ae(function(e){return e===0?0:e}),Nn=function(e){var t=e.dragStartTime,h=e.container,I=e.subject,k=e.center,M=e.shouldUseTimeDampening,V={top:k.y-h.top,right:h.right-k.x,bottom:h.bottom-k.y,left:k.x-h.left},z=Bn({container:h,distanceToEdges:V,dragStartTime:t,axis:_t,shouldUseTimeDampening:M}),ee=Bn({container:h,distanceToEdges:V,dragStartTime:t,axis:Lt,shouldUseTimeDampening:M}),ie=ss({x:ee,y:z});if(Me(ie,Ee))return null;var ae=as({container:h,subject:I,proposedScroll:ie});return ae?Me(ae,Ee)?null:ae:null},os=Ae(function(e){return e===0?0:e>0?1:-1}),Br=function(){var e=function(h,I){return h<0?h:h>I?h-I:0};return function(t){var h=t.current,I=t.max,k=t.change,M=Ie(h,k),V={x:e(M.x,I.x),y:e(M.y,I.y)};return Me(V,Ee)?null:V}}(),Un=function(t){var h=t.max,I=t.current,k=t.change,M={x:Math.max(I.x,h.x),y:Math.max(I.y,h.y)},V=os(k),z=Br({max:M,current:I,change:V});return z?V.x!==0&&z.x===0?!0:V.y!==0&&z.y===0:!0},Nr=function(t,h){return Un({current:t.scroll.current,max:t.scroll.max,change:h})},ls=function(t,h){if(!Nr(t,h))return null;var I=t.scroll.max,k=t.scroll.current;return Br({current:k,max:I,change:h})},Ur=function(t,h){var I=t.frame;return I?Un({current:I.scroll.current,max:I.scroll.max,change:h}):!1},us=function(t,h){var I=t.frame;return I&&Ur(t,h)?Br({current:I.scroll.current,max:I.scroll.max,change:h}):null},ds=function(e){var t=e.viewport,h=e.subject,I=e.center,k=e.dragStartTime,M=e.shouldUseTimeDampening,V=Nn({dragStartTime:k,container:t.frame,subject:h,center:I,shouldUseTimeDampening:M});return V&&Nr(t,V)?V:null},cs=function(e){var t=e.droppable,h=e.subject,I=e.center,k=e.dragStartTime,M=e.shouldUseTimeDampening,V=t.frame;if(!V)return null;var z=Nn({dragStartTime:k,container:V.pageMarginBox,subject:h,center:I,shouldUseTimeDampening:M});return z&&Ur(t,z)?z:null},Fn=function(e){var t=e.state,h=e.dragStartTime,I=e.shouldUseTimeDampening,k=e.scrollWindow,M=e.scrollDroppable,V=t.current.page.borderBoxCenter,z=t.dimensions.draggables[t.critical.draggable.id],ee=z.page.marginBox;if(t.isWindowScrollAllowed){var ie=t.viewport,ae=ds({dragStartTime:h,viewport:ie,subject:ee,center:V,shouldUseTimeDampening:I});if(ae){k(ae);return}}var re=ts({center:V,destination:At(t.impact),droppables:t.dimensions.droppables});if(!re)return;var te=cs({dragStartTime:h,droppable:re,subject:ee,center:V,shouldUseTimeDampening:I});te&&M(re.descriptor.id,te)},fs=function(e){var t=e.scrollWindow,h=e.scrollDroppable,I=g(t),k=g(h),M=null,V=function(ae){M||de(!1);var re=M,te=re.shouldUseTimeDampening,oe=re.dragStartTime;Fn({state:ae,scrollWindow:I,scrollDroppable:k,dragStartTime:oe,shouldUseTimeDampening:te})},z=function(ae){Yt(),M&&de(!1);var re=Date.now(),te=!1,oe=function(){te=!0};Fn({state:ae,dragStartTime:0,shouldUseTimeDampening:!1,scrollWindow:oe,scrollDroppable:oe}),M={dragStartTime:re,shouldUseTimeDampening:te},Jt(),te&&V(ae)},ee=function(){if(!M)return;I.cancel(),k.cancel(),M=null};return{start:z,stop:ee,scroll:V}},hs=function(e){var t=e.move,h=e.scrollDroppable,I=e.scrollWindow,k=function(ie,ae){var re=Ie(ie.current.client.selection,ae);t({client:re})},M=function(ie,ae){if(!Ur(ie,ae))return ae;var re=us(ie,ae);if(!re)return h(ie.descriptor.id,ae),null;var te=_e(ae,re);h(ie.descriptor.id,te);var oe=_e(ae,te);return oe},V=function(ie,ae,re){if(!ie)return re;if(!Nr(ae,re))return re;var te=ls(ae,re);if(!te)return I(re),null;var oe=_e(re,te);I(oe);var pe=_e(re,oe);return pe},z=function(ie){var ae=ie.scrollJumpRequest;if(!ae)return;var re=At(ie.impact);re||de(!1);var te=M(ie.dimensions.droppables[re],ae);if(!te)return;var oe=ie.viewport,pe=V(ie.isWindowScrollAllowed,oe,te);if(!pe)return;k(ie,pe)};return z},ps=function(e){var t=e.scrollDroppable,h=e.scrollWindow,I=e.move,k=fs({scrollWindow:h,scrollDroppable:t}),M=hs({move:I,scrollWindow:h,scrollDroppable:t}),V=function(ie){if(ie.phase!=="DRAGGING")return;if(ie.movementMode==="FLUID"){k.scroll(ie);return}if(!ie.scrollJumpRequest)return;M(ie)},z={scroll:V,start:k.start,stop:k.stop};return z},Wt="data-rbd",jt=function(){var e=Wt+"-drag-handle";return{base:e,draggableId:e+"-draggable-id",contextId:e+"-context-id"}}(),Fr=function(){var e=Wt+"-draggable";return{base:e,contextId:e+"-context-id",id:e+"-id"}}(),ms=function(){var e=Wt+"-droppable";return{base:e,contextId:e+"-context-id",id:e+"-id"}}(),Wn={contextId:Wt+"-scroll-container-context-id"},gs=function(t){return function(h){return"["+h+'="'+t+'"]'}},er=function(t,h){return t.map(function(I){var k=I.styles[h];return k?I.selector+" { "+k+" }":""}).join(" ")},vs="pointer-events: none;",ys=function(e){var t=gs(e),h=function(){var z=`
cursor: -webkit-grab;
cursor: grab;
`;return{selector:t(jt.contextId),styles:{always:`
-webkit-touch-callout: none;
-webkit-tap-highlight-color: rgba(0,0,0,0);
touch-action: manipulation;
`,resting:z,dragging:vs,dropAnimating:z}}}(),I=function(){var z=`
transition: `+Zt.outOfTheWay+`;
`;return{selector:t(Fr.contextId),styles:{dragging:z,dropAnimating:z,userCancel:z}}}(),k={selector:t(ms.contextId),styles:{always:"overflow-anchor: none;"}},M={selector:"body",styles:{dragging:`
cursor: grabbing;
cursor: -webkit-grabbing;
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
overflow-anchor: none;
`}},V=[I,h,k,M];return{always:er(V,"always"),resting:er(V,"resting"),dragging:er(V,"dragging"),dropAnimating:er(V,"dropAnimating"),userCancel:er(V,"userCancel")}},wt=typeof window!="undefined"&&typeof window.document!="undefined"&&typeof window.document.createElement!="undefined"?he.useLayoutEffect:he.useEffect,Wr=function(){var t=document.querySelector("head");return t||de(!1),t},jn=function(t){var h=document.createElement("style");return t&&h.setAttribute("nonce",t),h.type="text/css",h};function bs(e,t){var h=A(function(){return ys(e)},[e]),I=Object(he.useRef)(null),k=Object(he.useRef)(null),M=y(i(function(re){var te=k.current;te||de(!1),te.textContent=re}),[]),V=y(function(re){var te=I.current;te||de(!1),te.textContent=re},[]);wt(function(){!I.current&&!k.current||de(!1);var re=jn(t),te=jn(t);return I.current=re,k.current=te,re.setAttribute(Wt+"-always",e),te.setAttribute(Wt+"-dynamic",e),Wr().appendChild(re),Wr().appendChild(te),V(h.always),M(h.resting),function(){var oe=function(Re){var Pe=Re.current;Pe||de(!1),Wr().removeChild(Pe),Re.current=null};oe(I),oe(k)}},[t,V,M,h.always,h.resting,e]);var z=y(function(){return M(h.dragging)},[M,h.dragging]),ee=y(function(re){if(re==="DROP"){M(h.dropAnimating);return}M(h.userCancel)},[M,h.dropAnimating,h.userCancel]),ie=y(function(){if(!k.current)return;M(h.resting)},[M,h.resting]),ae=A(function(){return{dragging:z,dropping:ee,resting:ie}},[z,ee,ie]);return ae}var Gn=function(e){return e&&e.ownerDocument?e.ownerDocument.defaultView:window};function tr(e){return e instanceof Gn(e).HTMLElement}function Hn(e,t){var h="["+jt.contextId+'="'+e+'"]',I=ye(document.querySelectorAll(h));if(!I.length)return null;var k=ue(I,function(M){return M.getAttribute(jt.draggableId)===t});return k&&tr(k)?k:null}function Es(e){var t=Object(he.useRef)({}),h=Object(he.useRef)(null),I=Object(he.useRef)(null),k=Object(he.useRef)(!1),M=y(function(te,oe){var pe={id:te,focus:oe};return t.current[te]=pe,function(){var Pe=t.current,Be=Pe[te];Be!==pe&&delete Pe[te]}},[]),V=y(function(te){var oe=Hn(e,te);oe&&oe!==document.activeElement&&oe.focus()},[e]),z=y(function(te,oe){h.current===te&&(h.current=oe)},[]),ee=y(function(){if(I.current)return;if(!k.current)return;I.current=requestAnimationFrame(function(){I.current=null;var te=h.current;te&&V(te)})},[V]),ie=y(function(te){h.current=null;var oe=document.activeElement;if(!oe)return;if(oe.getAttribute(jt.draggableId)!==te)return;h.current=te},[]);wt(function(){return k.current=!0,function(){k.current=!1;var te=I.current;te&&cancelAnimationFrame(te)}},[]);var ae=A(function(){return{register:M,tryRecordFocus:ie,tryRestoreFocusRecorded:ee,tryShiftRecord:z}},[M,ie,ee,z]);return ae}function xs(){var e={draggables:{},droppables:{}},t=[];function h(re){return t.push(re),function(){var oe=t.indexOf(re);if(oe===-1)return;t.splice(oe,1)}}function I(re){t.length&&t.forEach(function(te){return te(re)})}function k(re){return e.draggables[re]||null}function M(re){var te=k(re);return te||de(!1),te}var V={register:function(te){e.draggables[te.descriptor.id]=te,I({type:"ADDITION",value:te})},update:function(te,oe){var pe=e.draggables[oe.descriptor.id];if(!pe)return;if(pe.uniqueId!==te.uniqueId)return;delete e.draggables[oe.descriptor.id],e.draggables[te.descriptor.id]=te},unregister:function(te){var oe=te.descriptor.id,pe=k(oe);if(!pe)return;if(te.uniqueId!==pe.uniqueId)return;delete e.draggables[oe],I({type:"REMOVAL",value:te})},getById:M,findById:k,exists:function(te){return Boolean(k(te))},getAllByType:function(te){return Z(e.draggables).filter(function(oe){return oe.descriptor.type===te})}};function z(re){return e.droppables[re]||null}function ee(re){var te=z(re);return te||de(!1),te}var ie={register:function(te){e.droppables[te.descriptor.id]=te},unregister:function(te){var oe=z(te.descriptor.id);if(!oe)return;if(te.uniqueId!==oe.uniqueId)return;delete e.droppables[te.descriptor.id]},getById:ee,findById:z,exists:function(te){return Boolean(z(te))},getAllByType:function(te){return Z(e.droppables).filter(function(oe){return oe.descriptor.type===te})}};function ae(){e.draggables={},e.droppables={},t.length=0}return{draggable:V,droppable:ie,subscribe:h,clean:ae}}function Ts(){var e=A(xs,[]);return Object(he.useEffect)(function(){return function(){requestAnimationFrame(e.clean)}},[e]),e}var jr=j.a.createContext(null),rr=function(){var e=document.body;return e||de(!1),e},Ss={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},Ds=function(t){return"rbd-announcement-"+t};function Cs(e){var t=A(function(){return Ds(e)},[e]),h=Object(he.useRef)(null);Object(he.useEffect)(function(){var M=document.createElement("div");return h.current=M,M.id=t,M.setAttribute("aria-live","assertive"),M.setAttribute("aria-atomic","true"),Object(B.a)(M.style,Ss),rr().appendChild(M),function(){setTimeout(function(){var ee=rr();ee.contains(M)&&ee.removeChild(M),M===h.current&&(h.current=null)})}},[t]);var I=y(function(k){var M=h.current;if(M){M.textContent=k;return}},[]);return I}var Kn=0,As={separator:"::"};function ws(){Kn=0}function Gr(e,t){return t===void 0&&(t=As),A(function(){return""+e+t.separator+Kn++},[t.separator,e])}function Rs(e){var t=e.contextId,h=e.uniqueId;return"rbd-hidden-text-"+t+"-"+h}function Is(e){var t=e.contextId,h=e.text,I=Gr("hidden-text",{separator:"-"}),k=A(function(){return Rs({contextId:t,uniqueId:I})},[I,t]);return Object(he.useEffect)(function(){var V=document.createElement("div");return V.id=k,V.textContent=h,V.style.display="none",rr().appendChild(V),function(){var ee=rr();ee.contains(V)&&ee.removeChild(V)}},[k,h]),k}var cr=j.a.createContext(null),Ls={react:"^16.8.5","react-dom":"^16.8.5"},_s=/(\d+)\.(\d+)\.(\d+)/,Vn=function(t){var h=_s.exec(t);h!=null||de(!1);var I=Number(h[1]),k=Number(h[2]),M=Number(h[3]);return{major:I,minor:k,patch:M,raw:t}},Ps=function(t,h){return h.major>t.major?!0:h.major<t.major?!1:h.minor>t.minor?!0:h.minor<t.minor?!1:h.patch>=t.patch},Os=function(e,t){var h=Vn(e),I=Vn(t);if(Ps(h,I))return},Pl=`
We expect a html5 doctype: <!doctype html>
This is to ensure consistent browser layout and measurement
More information: https://github.com/atlassian/react-beautiful-dnd/blob/master/docs/guides/doctype.md
`,Ms=function(e){var t=e.doctype;if(!t)return;t.name.toLowerCase()!=="html",t.publicId!==""};function Hr(e){}function nr(e,t){Hr(function(){Object(he.useEffect)(function(){try{e()}catch(h){ve(`
A setup problem was encountered.
> `+h.message+`
`)}},t)})}function ks(){nr(function(){Os(Ls.react,j.a.version),Ms(document)},[])}function Kr(e){var t=Object(he.useRef)(e);return Object(he.useEffect)(function(){t.current=e}),t}function Bs(){var e=null;function t(){return Boolean(e)}function h(V){return V===e}function I(V){e&&de(!1);var z={abandon:V};return e=z,z}function k(){e||de(!1),e=null}function M(){e&&(e.abandon(),k())}return{isClaimed:t,isActive:h,claim:I,release:k,tryAbandon:M}}var Ns=9,Us=13,Vr=27,zn=32,Fs=33,Ws=34,js=35,Gs=36,Hs=37,Ks=38,Vs=39,zs=40,fr,$s=(fr={},fr[Us]=!0,fr[Ns]=!0,fr),$n=function(e){$s[e.keyCode]&&e.preventDefault()},hr=function(){var e="visibilitychange";if(typeof document=="undefined")return e;var t=[e,"ms"+e,"webkit"+e,"moz"+e,"o"+e],h=ue(t,function(I){return"on"+I in document});return h||e}(),Xn=0,Yn=5;function Xs(e,t){return Math.abs(t.x-e.x)>=Yn||Math.abs(t.y-e.y)>=Yn}var Jn={type:"IDLE"};function Ys(e){var t=e.cancel,h=e.completed,I=e.getPhase,k=e.setPhase;return[{eventName:"mousemove",fn:function(V){var z=V.button,ee=V.clientX,ie=V.clientY;if(z!==Xn)return;var ae={x:ee,y:ie},re=I();if(re.type==="DRAGGING"){V.preventDefault(),re.actions.move(ae);return}re.type==="PENDING"||de(!1);var te=re.point;if(!Xs(te,ae))return;V.preventDefault();var oe=re.actions.fluidLift(ae);k({type:"DRAGGING",actions:oe})}},{eventName:"mouseup",fn:function(V){var z=I();if(z.type!=="DRAGGING"){t();return}V.preventDefault(),z.actions.drop({shouldBlockNextClick:!0}),h()}},{eventName:"mousedown",fn:function(V){I().type==="DRAGGING"&&V.preventDefault(),t()}},{eventName:"keydown",fn:function(V){var z=I();if(z.type==="PENDING"){t();return}if(V.keyCode===Vr){V.preventDefault(),t();return}$n(V)}},{eventName:"resize",fn:t},{eventName:"scroll",options:{passive:!0,capture:!1},fn:function(){I().type==="PENDING"&&t()}},{eventName:"webkitmouseforcedown",fn:function(V){var z=I();if(z.type!=="IDLE"||de(!1),z.actions.shouldRespectForcePress()){t();return}V.preventDefault()}},{eventName:hr,fn:t}]}function Js(e){var t=Object(he.useRef)(Jn),h=Object(he.useRef)(Se),I=A(function(){return{eventName:"mousedown",fn:function(re){if(re.defaultPrevented)return;if(re.button!==Xn)return;if(re.ctrlKey||re.metaKey||re.shiftKey||re.altKey)return;var te=e.findClosestDraggableId(re);if(!te)return;var oe=e.tryGetLock(te,V,{sourceEvent:re});if(!oe)return;re.preventDefault();var pe={x:re.clientX,y:re.clientY};h.current(),ie(oe,pe)}}},[e]),k=A(function(){return{eventName:"webkitmouseforcewillbegin",fn:function(re){if(re.defaultPrevented)return;var te=e.findClosestDraggableId(re);if(!te)return;var oe=e.findOptionsForDraggable(te);if(!oe)return;if(oe.shouldRespectForcePress)return;if(!e.canGetLock(te))return;re.preventDefault()}}},[e]),M=y(function(){var re={passive:!1,capture:!0};h.current=Ce(window,[k,I],re)},[k,I]),V=y(function(){var ae=t.current;if(ae.type==="IDLE")return;t.current=Jn,h.current(),M()},[M]),z=y(function(){var ae=t.current;V(),ae.type==="DRAGGING"&&ae.actions.cancel({shouldBlockNextClick:!0}),ae.type==="PENDING"&&ae.actions.abort()},[V]),ee=y(function(){var re={capture:!0,passive:!1},te=Ys({cancel:z,completed:V,getPhase:function(){return t.current},setPhase:function(pe){t.current=pe}});h.current=Ce(window,te,re)},[z,V]),ie=y(function(re,te){t.current.type==="IDLE"||de(!1),t.current={type:"PENDING",point:te,actions:re},ee()},[ee]);wt(function(){return M(),function(){h.current()}},[M])}var Gt;function Qs(){}var Zs=(Gt={},Gt[Ws]=!0,Gt[Fs]=!0,Gt[Gs]=!0,Gt[js]=!0,Gt);function qs(e,t){function h(){t(),e.cancel()}function I(){t(),e.drop()}return[{eventName:"keydown",fn:function(M){if(M.keyCode===Vr){M.preventDefault(),h();return}if(M.keyCode===zn){M.preventDefault(),I();return}if(M.keyCode===zs){M.preventDefault(),e.moveDown();return}if(M.keyCode===Ks){M.preventDefault(),e.moveUp();return}if(M.keyCode===Vs){M.preventDefault(),e.moveRight();return}if(M.keyCode===Hs){M.preventDefault(),e.moveLeft();return}if(Zs[M.keyCode]){M.preventDefault();return}$n(M)}},{eventName:"mousedown",fn:h},{eventName:"mouseup",fn:h},{eventName:"click",fn:h},{eventName:"touchstart",fn:h},{eventName:"resize",fn:h},{eventName:"wheel",fn:h,options:{passive:!0}},{eventName:hr,fn:h}]}function eo(e){var t=Object(he.useRef)(Qs),h=A(function(){return{eventName:"keydown",fn:function(M){if(M.defaultPrevented)return;if(M.keyCode!==zn)return;var V=e.findClosestDraggableId(M);if(!V)return;var z=e.tryGetLock(V,ae,{sourceEvent:M});if(!z)return;M.preventDefault();var ee=!0,ie=z.snapLift();t.current();function ae(){ee||de(!1),ee=!1,t.current(),I()}t.current=Ce(window,qs(ie,ae),{capture:!0,passive:!1})}}},[e]),I=y(function(){var M={passive:!1,capture:!0};t.current=Ce(window,[h],M)},[h]);wt(function(){return I(),function(){t.current()}},[I])}var zr={type:"IDLE"},to=120,ro=.15;function no(e){var t=e.cancel,h=e.getPhase;return[{eventName:"orientationchange",fn:t},{eventName:"resize",fn:t},{eventName:"contextmenu",fn:function(k){k.preventDefault()}},{eventName:"keydown",fn:function(k){if(h().type!=="DRAGGING"){t();return}k.keyCode===Vr&&k.preventDefault(),t()}},{eventName:hr,fn:t}]}function io(e){var t=e.cancel,h=e.completed,I=e.getPhase;return[{eventName:"touchmove",options:{capture:!1},fn:function(M){var V=I();if(V.type!=="DRAGGING"){t();return}V.hasMoved=!0;var z=M.touches[0],ee=z.clientX,ie=z.clientY,ae={x:ee,y:ie};M.preventDefault(),V.actions.move(ae)}},{eventName:"touchend",fn:function(M){var V=I();if(V.type!=="DRAGGING"){t();return}M.preventDefault(),V.actions.drop({shouldBlockNextClick:!0}),h()}},{eventName:"touchcancel",fn:function(M){if(I().type!=="DRAGGING"){t();return}M.preventDefault(),t()}},{eventName:"touchforcechange",fn:function(M){var V=I();V.type!=="IDLE"||de(!1);var z=M.touches[0];if(!z)return;var ee=z.force>=ro;if(!ee)return;var ie=V.actions.shouldRespectForcePress();if(V.type==="PENDING"){ie&&t();return}if(ie){if(V.hasMoved){M.preventDefault();return}t();return}M.preventDefault()}},{eventName:hr,fn:t}]}function ao(e){var t=Object(he.useRef)(zr),h=Object(he.useRef)(Se),I=y(function(){return t.current},[]),k=y(function(oe){t.current=oe},[]),M=A(function(){return{eventName:"touchstart",fn:function(oe){if(oe.defaultPrevented)return;var pe=e.findClosestDraggableId(oe);if(!pe)return;var Re=e.tryGetLock(pe,z,{sourceEvent:oe});if(!Re)return;var Pe=oe.touches[0],Be=Pe.clientX,He=Pe.clientY,$e={x:Be,y:He};h.current(),re(Re,$e)}}},[e]),V=y(function(){var oe={capture:!0,passive:!1};h.current=Ce(window,[M],oe)},[M]),z=y(function(){var te=t.current;if(te.type==="IDLE")return;te.type==="PENDING"&&clearTimeout(te.longPressTimerId),k(zr),h.current(),V()},[V,k]),ee=y(function(){var te=t.current;z(),te.type==="DRAGGING"&&te.actions.cancel({shouldBlockNextClick:!0}),te.type==="PENDING"&&te.actions.abort()},[z]),ie=y(function(){var oe={capture:!0,passive:!1},pe={cancel:ee,completed:z,getPhase:I},Re=Ce(window,io(pe),oe),Pe=Ce(window,no(pe),oe);h.current=function(){Re(),Pe()}},[ee,I,z]),ae=y(function(){var oe=I();oe.type==="PENDING"||de(!1);var pe=oe.actions.fluidLift(oe.point);k({type:"DRAGGING",actions:pe,hasMoved:!1})},[I,k]),re=y(function(oe,pe){I().type==="IDLE"||de(!1);var Re=setTimeout(ae,to);k({type:"PENDING",point:pe,actions:oe,longPressTimerId:Re}),ie()},[ie,I,k,ae]);wt(function(){return V(),function(){h.current();var pe=I();pe.type==="PENDING"&&(clearTimeout(pe.longPressTimerId),k(zr))}},[I,V,k]),wt(function(){var oe=Ce(window,[{eventName:"touchmove",fn:function(){},options:{capture:!1,passive:!1}}]);return oe},[])}function so(e){Hr(function(){var t=Kr(e);nr(function(){t.current.length===e.length||de(!1)})})}var oo={input:!0,button:!0,textarea:!0,select:!0,option:!0,optgroup:!0,video:!0,audio:!0};function Qn(e,t){if(t==null)return!1;var h=Boolean(oo[t.tagName.toLowerCase()]);if(h)return!0;var I=t.getAttribute("contenteditable");return I==="true"||I===""?!0:t===e?!1:Qn(e,t.parentElement)}function lo(e,t){var h=t.target;return tr(h)?Qn(e,h):!1}var uo=function(e){return C(e.getBoundingClientRect()).center};function co(e){return e instanceof Gn(e).Element}var fo=function(){var e="matches";if(typeof document=="undefined")return e;var t=[e,"msMatchesSelector","webkitMatchesSelector"],h=ue(t,function(I){return I in Element.prototype});return h||e}();function Zn(e,t){return e==null?null:e[fo](t)?e:Zn(e.parentElement,t)}function ho(e,t){return e.closest?e.closest(t):Zn(e,t)}function po(e){return"["+jt.contextId+'="'+e+'"]'}function mo(e,t){var h=t.target;if(!co(h))return null;var I=po(e),k=ho(h,I);return k&&tr(k)?k:null}function go(e,t){var h=mo(e,t);return h?h.getAttribute(jt.draggableId):null}function vo(e,t){var h="["+Fr.contextId+'="'+e+'"]',I=ye(document.querySelectorAll(h)),k=ue(I,function(M){return M.getAttribute(Fr.id)===t});return k&&tr(k)?k:null}function yo(e){e.preventDefault()}function pr(e){var t=e.expected,h=e.phase,I=e.isLockActive,k=e.shouldWarn;return I()?!(t!==h):!1}function qn(e){var t=e.lockAPI,h=e.store,I=e.registry,k=e.draggableId;if(t.isClaimed())return!1;var M=I.draggable.findById(k);return M&&M.options.isEnabled?!!_n(h.getState(),k):!1}function bo(e){var t=e.lockAPI,h=e.contextId,I=e.store,k=e.registry,M=e.draggableId,V=e.forceSensorStop,z=e.sourceEvent,ee=qn({lockAPI:t,store:I,registry:k,draggableId:M});if(!ee)return null;var ie=k.draggable.getById(M),ae=vo(h,ie.descriptor.id);if(!ae)return null;if(z&&!ie.options.canDragInteractiveElements&&lo(ae,z))return null;var re=t.claim(V||Se),te="PRE_DRAG";function oe(){return ie.options.shouldRespectForcePress}function pe(){return t.isActive(re)}function Re(tt,ut){pr({expected:tt,phase:te,isLockActive:pe,shouldWarn:!0})&&I.dispatch(ut())}var Pe=Re.bind(null,"DRAGGING");function Be(tt){function ut(){t.release(),te="COMPLETED"}te!=="PRE_DRAG"&&(ut(),te==="PRE_DRAG"||de(!1)),I.dispatch(ia(tt.liftActionArgs)),te="DRAGGING";function bt(st,yt){if(yt===void 0&&(yt={shouldBlockNextClick:!1}),tt.cleanup(),yt.shouldBlockNextClick){var Rt=Ce(window,[{eventName:"click",fn:yo,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(Rt)}ut(),I.dispatch(xn({reason:st}))}return Object(B.a)({isActive:function(){return pr({expected:"DRAGGING",phase:te,isLockActive:pe,shouldWarn:!1})},shouldRespectForcePress:oe,drop:function(yt){return bt("DROP",yt)},cancel:function(yt){return bt("CANCEL",yt)}},tt.actions)}function He(tt){var ut=g(function(st){Pe(function(){return En({client:st})})}),bt=Be({liftActionArgs:{id:M,clientSelection:tt,movementMode:"FLUID"},cleanup:function(){return ut.cancel()},actions:{move:ut}});return Object(B.a)({},bt,{move:ut})}function $e(){var tt={moveUp:function(){return Pe(ha)},moveRight:function(){return Pe(ma)},moveDown:function(){return Pe(pa)},moveLeft:function(){return Pe(ga)}};return Be({liftActionArgs:{id:M,clientSelection:uo(ae),movementMode:"SNAP"},cleanup:Se,actions:tt})}function Je(){var tt=pr({expected:"PRE_DRAG",phase:te,isLockActive:pe,shouldWarn:!0});tt&&t.release()}var rt={isActive:function(){return pr({expected:"PRE_DRAG",phase:te,isLockActive:pe,shouldWarn:!1})},shouldRespectForcePress:oe,fluidLift:He,snapLift:$e,abort:Je};return rt}var Eo=[Js,eo,ao];function xo(e){var t=e.contextId,h=e.store,I=e.registry,k=e.customSensors,M=e.enableDefaultSensors,V=[].concat(M?Eo:[],k||[]),z=Object(he.useState)(function(){return Bs()})[0],ee=y(function(He,$e){He.isDragging&&!$e.isDragging&&z.tryAbandon()},[z]);wt(function(){var He=h.getState(),$e=h.subscribe(function(){var Je=h.getState();ee(He,Je),He=Je});return $e},[z,h,ee]),wt(function(){return z.tryAbandon},[z.tryAbandon]);var ie=y(function(Be){return qn({lockAPI:z,registry:I,store:h,draggableId:Be})},[z,I,h]),ae=y(function(Be,He,$e){return bo({lockAPI:z,registry:I,contextId:t,store:h,draggableId:Be,forceSensorStop:He,sourceEvent:$e&&$e.sourceEvent?$e.sourceEvent:null})},[t,z,I,h]),re=y(function(Be){return go(t,Be)},[t]),te=y(function(Be){var He=I.draggable.findById(Be);return He?He.options:null},[I.draggable]),oe=y(function(){if(!z.isClaimed())return;z.tryAbandon(),h.getState().phase!=="IDLE"&&h.dispatch(wr())},[z,h]),pe=y(z.isClaimed,[z]),Re=A(function(){return{canGetLock:ie,tryGetLock:ae,findClosestDraggableId:re,findOptionsForDraggable:te,tryReleaseLock:oe,isLockClaimed:pe}},[ie,ae,re,te,oe,pe]);so(V);for(var Pe=0;Pe<V.length;Pe++)V[Pe](Re)}var To=function(t){return{onBeforeCapture:t.onBeforeCapture,onBeforeDragStart:t.onBeforeDragStart,onDragStart:t.onDragStart,onDragEnd:t.onDragEnd,onDragUpdate:t.onDragUpdate}};function ir(e){return e.current||de(!1),e.current}function So(e){var t=e.contextId,h=e.setCallbacks,I=e.sensors,k=e.nonce,M=e.dragHandleUsageInstructions,V=Object(he.useRef)(null);ks();var z=Kr(e),ee=y(function(){return To(z.current)},[z]),ie=Cs(t),ae=Is({contextId:t,text:M}),re=bs(t,k),te=y(function(st){ir(V).dispatch(st)},[]),oe=A(function(){return Object(R.b)({publishWhileDragging:sa,updateDroppableScroll:la,updateDroppableIsEnabled:ua,updateDroppableIsCombineEnabled:da,collectionStarting:oa},te)},[te]),pe=Ts(),Re=A(function(){return Qa(pe,oe)},[pe,oe]),Pe=A(function(){return ps(Object(B.a)({scrollWindow:Za,scrollDroppable:Re.scrollDroppable},Object(R.b)({move:En},te)))},[Re.scrollDroppable,te]),Be=Es(t),He=A(function(){return $a({announce:ie,autoScroller:Pe,dimensionMarshal:Re,focusMarshal:Be,getResponders:ee,styleMarshal:re})},[ie,Pe,Re,Be,ee,re]);V.current=He;var $e=y(function(){var st=ir(V),yt=st.getState();yt.phase!=="IDLE"&&st.dispatch(wr())},[]),Je=y(function(){var st=ir(V).getState();return st.isDragging||st.phase==="DROP_ANIMATING"},[]),rt=A(function(){return{isDragging:Je,tryAbort:$e}},[Je,$e]);h(rt);var tt=y(function(st){return _n(ir(V).getState(),st)},[]),ut=y(function(){return kt(ir(V).getState())},[]),bt=A(function(){return{marshal:Re,focus:Be,contextId:t,canLift:tt,isMovementAllowed:ut,dragHandleUsageInstructionsId:ae,registry:pe}},[t,Re,ae,Be,tt,ut,pe]);return xo({contextId:t,store:He,registry:pe,customSensors:I,enableDefaultSensors:e.enableDefaultSensors!==!1}),Object(he.useEffect)(function(){return $e},[$e]),j.a.createElement(cr.Provider,{value:bt},j.a.createElement(L.a,{context:jr,store:He},e.children))}var ei=0;function Do(){ei=0}function Co(){return A(function(){return""+ei++},[])}function Ol(){Do(),ws()}function Ao(e){var t=Co(),h=e.dragHandleUsageInstructions||De.dragHandleUsageInstructions;return j.a.createElement(nt,null,function(I){return j.a.createElement(So,{nonce:e.nonce,contextId:t,setCallbacks:I,dragHandleUsageInstructions:h,enableDefaultSensors:e.enableDefaultSensors,sensors:e.sensors,onBeforeCapture:e.onBeforeCapture,onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragUpdate:e.onDragUpdate,onDragEnd:e.onDragEnd},e.children)})}var $r=function(t){return function(h){return t===h}},wo=$r("scroll"),Ro=$r("auto"),Io=$r("visible"),ti=function(t,h){return h(t.overflowX)||h(t.overflowY)},Lo=function(t,h){return h(t.overflowX)&&h(t.overflowY)},ri=function(t){var h=window.getComputedStyle(t),I={overflowX:h.overflowX,overflowY:h.overflowY};return ti(I,wo)||ti(I,Ro)},_o=function(){return!1;var t,h;if(!ri(t))return!1;var I,k;if(Lo(k,Io))return!1},ni=function e(t){return t==null?null:t===document.body?_o()?t:null:t===document.documentElement?null:ri(t)?t:e(t.parentElement)},Ml=function(e){if(!e)return;var t=ni(e.parentElement);if(!t)return},Xr=function(e){return{x:e.scrollLeft,y:e.scrollTop}},Po=function e(t){if(!t)return!1;var h=window.getComputedStyle(t);return h.position==="fixed"?!0:e(t.parentElement)},Oo=function(e){var t=ni(e),h=Po(e);return{closestScrollable:t,isFixedOnPage:h}},Mo=function(e){var t=e.descriptor,h=e.isEnabled,I=e.isCombineEnabled,k=e.isFixedOnPage,M=e.direction,V=e.client,z=e.page,ee=e.closest,ie=function(){if(!ee)return null;var oe=ee.scrollSize,pe=ee.client,Re=wn({scrollHeight:oe.scrollHeight,scrollWidth:oe.scrollWidth,height:pe.paddingBox.height,width:pe.paddingBox.width});return{pageMarginBox:ee.page.marginBox,frameClient:pe,scrollSize:oe,shouldClipSubject:ee.shouldClipSubject,scroll:{initial:ee.scroll,current:ee.scroll,max:Re,diff:{value:Ee,displacement:Ee}}}}(),ae=M==="vertical"?_t:Lt,re=W({page:z,withPlaceholder:null,axis:ae,frame:ie}),te={descriptor:t,isCombineEnabled:I,isFixedOnPage:k,axis:ae,isEnabled:h,client:V,page:z,frame:ie,subject:re};return te},ko=function(t,h){var I=b(t);if(!h)return I;if(t!==h)return I;var k=I.paddingBox.top-h.scrollTop,M=I.paddingBox.left-h.scrollLeft,V=k+h.scrollHeight,z=M+h.scrollWidth,ee={top:k,right:z,bottom:V,left:M},ie=T(ee,I.border),ae=r({borderBox:ie,margin:I.margin,border:I.border,padding:I.padding});return ae},Bo=function(e){var t=e.ref,h=e.descriptor,I=e.env,k=e.windowScroll,M=e.direction,V=e.isDropDisabled,z=e.isCombineEnabled,ee=e.shouldClipSubject,ie=I.closestScrollable,ae=ko(t,ie),re=d(ae,k),te=function(){if(!ie)return null;var pe=b(ie),Re={scrollHeight:ie.scrollHeight,scrollWidth:ie.scrollWidth};return{client:pe,page:d(pe,k),scroll:Xr(ie),scrollSize:Re,shouldClipSubject:ee}}(),oe=Mo({descriptor:h,isEnabled:!V,isCombineEnabled:z,isFixedOnPage:I.isFixedOnPage,direction:M,client:ae,page:re,closest:te});return oe},No={passive:!1},Uo={passive:!0},ii=function(e){return e.shouldPublishImmediately?No:Uo};function mr(e){var t=Object(he.useContext)(e);return t||de(!1),t}var gr=function(t){return t&&t.env.closestScrollable||null};function Fo(e){var t=Object(he.useRef)(null),h=mr(cr),I=Gr("droppable"),k=h.registry,M=h.marshal,V=Kr(e),z=A(function(){return{id:e.droppableId,type:e.type,mode:e.mode}},[e.droppableId,e.mode,e.type]),ee=Object(he.useRef)(z),ie=A(function(){return i(function(Je,rt){t.current||de(!1);var tt={x:Je,y:rt};M.updateDroppableScroll(z.id,tt)})},[z.id,M]),ae=y(function(){var Je=t.current;return!Je||!Je.env.closestScrollable?Ee:Xr(Je.env.closestScrollable)},[]),re=y(function(){var Je=ae();ie(Je.x,Je.y)},[ae,ie]),te=A(function(){return g(re)},[re]),oe=y(function(){var Je=t.current,rt=gr(Je);Je&&rt||de(!1);var tt=Je.scrollOptions;if(tt.shouldPublishImmediately){re();return}te()},[te,re]),pe=y(function(Je,rt){t.current&&de(!1);var tt=V.current,ut=tt.getDroppableRef();ut||de(!1);var bt=Oo(ut),st={ref:ut,descriptor:z,env:bt,scrollOptions:rt};t.current=st;var yt=Bo({ref:ut,descriptor:z,env:bt,windowScroll:Je,direction:tt.direction,isDropDisabled:tt.isDropDisabled,isCombineEnabled:tt.isCombineEnabled,shouldClipSubject:!tt.ignoreContainerClipping}),Rt=bt.closestScrollable;return Rt&&(Rt.setAttribute(Wn.contextId,h.contextId),Rt.addEventListener("scroll",oe,ii(st.scrollOptions))),yt},[h.contextId,z,oe,V]),Re=y(function(){var Je=t.current,rt=gr(Je);return Je&&rt||de(!1),Xr(rt)},[]),Pe=y(function(){var Je=t.current;Je||de(!1);var rt=gr(Je);if(t.current=null,!rt)return;te.cancel(),rt.removeAttribute(Wn.contextId),rt.removeEventListener("scroll",oe,ii(Je.scrollOptions))},[oe,te]),Be=y(function(Je){var rt=t.current;rt||de(!1);var tt=gr(rt);tt||de(!1),tt.scrollTop+=Je.y,tt.scrollLeft+=Je.x},[]),He=A(function(){return{getDimensionAndWatchScroll:pe,getScrollWhileDragging:Re,dragStopped:Pe,scroll:Be}},[Pe,pe,Re,Be]),$e=A(function(){return{uniqueId:I,descriptor:z,callbacks:He}},[He,z,I]);wt(function(){return ee.current=$e.descriptor,k.droppable.register($e),function(){t.current&&Pe(),k.droppable.unregister($e)}},[He,z,Pe,$e,M,k.droppable]),wt(function(){if(!t.current)return;M.updateDroppableIsEnabled(ee.current.id,!e.isDropDisabled)},[e.isDropDisabled,M]),wt(function(){if(!t.current)return;M.updateDroppableIsCombineEnabled(ee.current.id,e.isCombineEnabled)},[e.isCombineEnabled,M])}function Yr(){}var ai={width:0,height:0,margin:F},Wo=function(t){var h=t.isAnimatingOpenOnMount,I=t.placeholder,k=t.animate;return h||k==="close"?ai:{height:I.client.borderBox.height,width:I.client.borderBox.width,margin:I.client.margin}},jo=function(t){var h=t.isAnimatingOpenOnMount,I=t.placeholder,k=t.animate,M=Wo({isAnimatingOpenOnMount:h,placeholder:I,animate:k});return{display:I.display,boxSizing:"border-box",width:M.width,height:M.height,marginTop:M.margin.top,marginRight:M.margin.right,marginBottom:M.margin.bottom,marginLeft:M.margin.left,flexShrink:"0",flexGrow:"0",pointerEvents:"none",transition:k!=="none"?Zt.placeholder:null}};function Go(e){var t=Object(he.useRef)(null),h=y(function(){if(!t.current)return;clearTimeout(t.current),t.current=null},[]),I=e.animate,k=e.onTransitionEnd,M=e.onClose,V=e.contextId,z=Object(he.useState)(e.animate==="open"),ee=z[0],ie=z[1];Object(he.useEffect)(function(){return ee?I!=="open"?(h(),ie(!1),Yr):t.current?Yr:(t.current=setTimeout(function(){t.current=null,ie(!1)}),h):Yr},[I,ee,h]);var ae=y(function(te){if(te.propertyName!=="height")return;k(),I==="close"&&M()},[I,M,k]),re=jo({isAnimatingOpenOnMount:ee,animate:e.animate,placeholder:e.placeholder});return j.a.createElement(e.placeholder.tagName,{style:re,"data-rbd-placeholder-context-id":V,onTransitionEnd:ae,ref:e.innerRef})}var Ho=j.a.memo(Go),Jr=j.a.createContext(null);function si(e){e&&tr(e)||de(!1)}function Qr(e){return typeof e=="boolean"}function Zr(e,t){t.forEach(function(h){return h(e)})}var Ko=[function(t){var h=t.props;h.droppableId||de(!1),typeof h.droppableId=="string"||de(!1)},function(t){var h=t.props;Qr(h.isDropDisabled)||de(!1),Qr(h.isCombineEnabled)||de(!1),Qr(h.ignoreContainerClipping)||de(!1)},function(t){var h=t.getDroppableRef;si(h())}],Vo=[function(t){var h=t.props,I=t.getPlaceholderRef;if(!h.placeholder)return;var k=I();if(k)return}],zo=[function(t){var h=t.props;h.renderClone||de(!1)},function(t){var h=t.getPlaceholderRef;h()&&de(!1)}];function $o(e){nr(function(){Zr(e,Ko),e.props.mode==="standard"&&Zr(e,Vo),e.props.mode==="virtual"&&Zr(e,zo)})}var Xo=function(e){Object(D.a)(t,e);function t(){for(var I,k=arguments.length,M=new Array(k),V=0;V<k;V++)M[V]=arguments[V];return I=e.call.apply(e,[this].concat(M))||this,I.state={isVisible:Boolean(I.props.on),data:I.props.on,animate:I.props.shouldAnimate&&I.props.on?"open":"none"},I.onClose=function(){if(I.state.animate!=="close")return;I.setState({isVisible:!1})},I}t.getDerivedStateFromProps=function(k,M){return k.shouldAnimate?k.on?{isVisible:!0,data:k.on,animate:"open"}:M.isVisible?{isVisible:!0,data:M.data,animate:"close"}:{isVisible:!1,animate:"close",data:null}:{isVisible:Boolean(k.on),data:k.on,animate:"none"}};var h=t.prototype;return h.render=function(){if(!this.state.isVisible)return null;var k={onClose:this.onClose,data:this.state.data,animate:this.state.animate};return this.props.children(k)},t}(j.a.PureComponent),oi={dragging:5e3,dropAnimating:4500},Yo=function(t,h){return h?Zt.drop(h.duration):t?Zt.snap:Zt.fluid},Jo=function(t,h){return t?h?Qt.opacity.drop:Qt.opacity.combining:null},Qo=function(t){return t.forceShouldAnimate!=null?t.forceShouldAnimate:t.mode==="SNAP"};function Zo(e){var t=e.dimension,h=t.client,I=e.offset,k=e.combineWith,M=e.dropping,V=Boolean(k),z=Qo(e),ee=Boolean(M),ie=ee?_r.drop(I,V):_r.moveTo(I),ae={position:"fixed",top:h.marginBox.top,left:h.marginBox.left,boxSizing:"border-box",width:h.borderBox.width,height:h.borderBox.height,transition:Yo(z,M),transform:ie,opacity:Jo(V,ee),zIndex:ee?oi.dropAnimating:oi.dragging,pointerEvents:"none"};return ae}function qo(e){return{transform:_r.moveTo(e.offset),transition:e.shouldAnimateDisplacement?null:"none"}}function el(e){return e.type==="DRAGGING"?Zo(e):qo(e)}function tl(e,t,h){h===void 0&&(h=Ee);var I=window.getComputedStyle(t),k=t.getBoundingClientRect(),M=c(k,I),V=d(M,h),z={client:M,tagName:t.tagName.toLowerCase(),display:I.display},ee={x:M.marginBox.width,y:M.marginBox.height},ie={descriptor:e,placeholder:z,displaceBy:ee,client:M,page:V};return ie}function rl(e){var t=Gr("draggable"),h=e.descriptor,I=e.registry,k=e.getDraggableRef,M=e.canDragInteractiveElements,V=e.shouldRespectForcePress,z=e.isEnabled,ee=A(function(){return{canDragInteractiveElements:M,shouldRespectForcePress:V,isEnabled:z}},[M,z,V]),ie=y(function(oe){var pe=k();return pe||de(!1),tl(h,pe,oe)},[h,k]),ae=A(function(){return{uniqueId:t,descriptor:h,options:ee,getDimension:ie}},[h,ie,ee,t]),re=Object(he.useRef)(ae),te=Object(he.useRef)(!0);wt(function(){return I.draggable.register(re.current),function(){return I.draggable.unregister(re.current)}},[I.draggable]),wt(function(){if(te.current){te.current=!1;return}var oe=re.current;re.current=ae,I.draggable.update(ae,oe)},[ae,I.draggable])}function nl(e,t,h){nr(function(){function I(M){return"Draggable[id: "+M+"]: "}var k=e.draggableId;if(k||de(!1),typeof k=="string"||de(!1),Q(e.index)||de(!1),e.mapped.type==="DRAGGING")return;si(h()),e.isEnabled&&(Hn(t,k)||de(!1))})}function il(e){Hr(function(){var t=Object(he.useRef)(e);nr(function(){e===t.current||de(!1)},[e])})}function al(e){e.preventDefault()}function sl(e){var t=Object(he.useRef)(null),h=y(function(st){t.current=st},[]),I=y(function(){return t.current},[]),k=mr(cr),M=k.contextId,V=k.dragHandleUsageInstructionsId,z=k.registry,ee=mr(Jr),ie=ee.type,ae=ee.droppableId,re=A(function(){return{id:e.draggableId,index:e.index,type:ie,droppableId:ae}},[e.draggableId,e.index,ie,ae]),te=e.children,oe=e.draggableId,pe=e.isEnabled,Re=e.shouldRespectForcePress,Pe=e.canDragInteractiveElements,Be=e.isClone,He=e.mapped,$e=e.dropAnimationFinished;if(nl(e,M,I),il(Be),!Be){var Je=A(function(){return{descriptor:re,registry:z,getDraggableRef:I,canDragInteractiveElements:Pe,shouldRespectForcePress:Re,isEnabled:pe}},[re,z,I,Pe,Re,pe]);rl(Je)}var rt=A(function(){return pe?{tabIndex:0,role:"button","aria-describedby":V,"data-rbd-drag-handle-draggable-id":oe,"data-rbd-drag-handle-context-id":M,draggable:!1,onDragStart:al}:null},[M,V,oe,pe]),tt=y(function(st){if(He.type!=="DRAGGING")return;if(!He.dropping)return;if(st.propertyName!=="transform")return;$e()},[$e,He]),ut=A(function(){var st=el(He),yt=He.type==="DRAGGING"&&He.dropping?tt:null,Rt={innerRef:h,draggableProps:{"data-rbd-draggable-context-id":M,"data-rbd-draggable-id":oe,style:st,onTransitionEnd:yt},dragHandleProps:rt};return Rt},[M,rt,oe,He,tt,h]),bt=A(function(){return{draggableId:re.id,type:re.type,source:{index:re.index,droppableId:re.droppableId}}},[re.droppableId,re.id,re.index,re.type]);return te(ut,He.snapshot,bt)}var li=function(e,t){return e===t},ui=function(e){var t=e.combine,h=e.destination;return h?h.droppableId:t?t.droppableId:null},ol=function(t){return t.combine?t.combine.draggableId:null},ll=function(t){return t.at&&t.at.type==="COMBINE"?t.at.combine.draggableId:null};function ul(){var e=i(function(k,M){return{x:k,y:M}}),t=i(function(k,M,V,z,ee){return{isDragging:!0,isClone:M,isDropAnimating:Boolean(ee),dropAnimation:ee,mode:k,draggingOver:V,combineWith:z,combineTargetFor:null}}),h=i(function(k,M,V,z,ee,ie,ae){return{mapped:{type:"DRAGGING",dropping:null,draggingOver:ee,combineWith:ie,mode:M,offset:k,dimension:V,forceShouldAnimate:ae,snapshot:t(M,z,ee,ie,null)}}}),I=function(M,V){if(M.isDragging){if(M.critical.draggable.id!==V.draggableId)return null;var z=M.current.client.offset,ee=M.dimensions.draggables[V.draggableId],ie=At(M.impact),ae=ll(M.impact),re=M.forceShouldAnimate;return h(e(z.x,z.y),M.movementMode,ee,V.isClone,ie,ae,re)}if(M.phase==="DROP_ANIMATING"){var te=M.completed;if(te.result.draggableId!==V.draggableId)return null;var oe=V.isClone,pe=M.dimensions.draggables[V.draggableId],Re=te.result,Pe=Re.mode,Be=ui(Re),He=ol(Re),$e=M.dropDuration,Je={duration:$e,curve:Ir.drop,moveTo:M.newHomeClientOffset,opacity:He?Qt.opacity.drop:null,scale:He?Qt.scale.drop:null};return{mapped:{type:"DRAGGING",offset:M.newHomeClientOffset,dimension:pe,dropping:Je,draggingOver:Be,combineWith:He,mode:Pe,forceShouldAnimate:null,snapshot:t(Pe,oe,Be,He,Je)}}}return null};return I}function di(e){return{isDragging:!1,isDropAnimating:!1,isClone:!1,dropAnimation:null,mode:null,draggingOver:null,combineTargetFor:e,combineWith:null}}var dl={mapped:{type:"SECONDARY",offset:Ee,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:di(null)}};function cl(){var e=i(function(V,z){return{x:V,y:z}}),t=i(di),h=i(function(V,z,ee){return z===void 0&&(z=null),{mapped:{type:"SECONDARY",offset:V,combineTargetFor:z,shouldAnimateDisplacement:ee,snapshot:t(z)}}}),I=function(z){return z?h(Ee,z,!0):null},k=function(z,ee,ie,ae){var re=ie.displaced.visible[z],te=Boolean(ae.inVirtualList&&ae.effected[z]),oe=gt(ie),pe=oe&&oe.draggableId===z?ee:null;if(!re){if(!te)return I(pe);if(ie.displaced.invisible[z])return null;var Re=Ue(ae.displacedBy.point),Pe=e(Re.x,Re.y);return h(Pe,pe,!0)}if(te)return I(pe);var Be=ie.displacedBy.point,He=e(Be.x,Be.y);return h(He,pe,re.shouldAnimate)},M=function(z,ee){if(z.isDragging)return z.critical.draggable.id===ee.draggableId?null:k(ee.draggableId,z.critical.draggable.id,z.impact,z.afterCritical);if(z.phase==="DROP_ANIMATING"){var ie=z.completed;return ie.result.draggableId===ee.draggableId?null:k(ee.draggableId,ie.result.draggableId,ie.impact,ie.afterCritical)}return null};return M}var fl=function(){var t=ul(),h=cl(),I=function(M,V){return t(M,V)||h(M,V)||dl};return I},hl={dropAnimationFinished:Tn},pl=Object(L.c)(fl,hl,null,{context:jr,pure:!0,areStatePropsEqual:li})(sl);function ci(e){var t=mr(Jr),h=t.isUsingCloneFor;return h===e.draggableId&&!e.isClone?null:j.a.createElement(pl,e)}function ml(e){var t=typeof e.isDragDisabled=="boolean"?!e.isDragDisabled:!0,h=Boolean(e.disableInteractiveElementBlocking),I=Boolean(e.shouldRespectForcePress);return j.a.createElement(ci,Object(B.a)({},e,{isClone:!1,isEnabled:t,canDragInteractiveElements:h,shouldRespectForcePress:I}))}function gl(e){var t=Object(he.useContext)(cr);t||de(!1);var h=t.contextId,I=t.isMovementAllowed,k=Object(he.useRef)(null),M=Object(he.useRef)(null),V=e.children,z=e.droppableId,ee=e.type,ie=e.mode,ae=e.direction,re=e.ignoreContainerClipping,te=e.isDropDisabled,oe=e.isCombineEnabled,pe=e.snapshot,Re=e.useClone,Pe=e.updateViewportMaxScroll,Be=e.getContainerForClone,He=y(function(){return k.current},[]),$e=y(function(It){k.current=It},[]),Je=y(function(){return M.current},[]),rt=y(function(It){M.current=It},[]);$o({props:e,getDroppableRef:He,getPlaceholderRef:Je});var tt=y(function(){I()&&Pe({maxScroll:In()})},[I,Pe]);Fo({droppableId:z,type:ee,mode:ie,direction:ae,isDropDisabled:te,isCombineEnabled:oe,ignoreContainerClipping:re,getDroppableRef:He});var ut=j.a.createElement(Xo,{on:e.placeholder,shouldAnimate:e.shouldAnimatePlaceholder},function(It){var Ht=It.onClose,ar=It.data,Kt=It.animate;return j.a.createElement(Ho,{placeholder:ar,onClose:Ht,innerRef:rt,animate:Kt,contextId:h,onTransitionEnd:tt})}),bt=A(function(){return{innerRef:$e,placeholder:ut,droppableProps:{"data-rbd-droppable-id":z,"data-rbd-droppable-context-id":h}}},[h,z,ut,$e]),st=Re?Re.dragging.draggableId:null,yt=A(function(){return{droppableId:z,type:ee,isUsingCloneFor:st}},[z,st,ee]);function Rt(){if(!Re)return null;var It=Re.dragging,Ht=Re.render,ar=j.a.createElement(ci,{draggableId:It.draggableId,index:It.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},function(Kt,sr){return Ht(Kt,sr,It)});return w.a.createPortal(ar,Be())}return j.a.createElement(Jr.Provider,{value:yt},V(bt,pe),Rt())}var qr=function(t,h){return t===h.droppable.type},fi=function(t,h){return h.draggables[t.draggable.id]},vl=function(){var t={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},h=Object(B.a)({},t,{shouldAnimatePlaceholder:!1}),I=i(function(V){return{draggableId:V.id,type:V.type,source:{index:V.index,droppableId:V.droppableId}}}),k=i(function(V,z,ee,ie,ae,re){var te=ae.descriptor.id,oe=ae.descriptor.droppableId===V;if(oe){var pe=re?{render:re,dragging:I(ae.descriptor)}:null,Re={isDraggingOver:ee,draggingOverWith:ee?te:null,draggingFromThisWith:te,isUsingPlaceholder:!0};return{placeholder:ae.placeholder,shouldAnimatePlaceholder:!1,snapshot:Re,useClone:pe}}if(!z)return h;if(!ie)return t;var Pe={isDraggingOver:ee,draggingOverWith:te,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:ae.placeholder,shouldAnimatePlaceholder:!0,snapshot:Pe,useClone:null}}),M=function(z,ee){var ie=ee.droppableId,ae=ee.type,re=!ee.isDropDisabled,te=ee.renderClone;if(z.isDragging){var oe=z.critical;if(!qr(ae,oe))return h;var pe=fi(oe,z.dimensions),Re=At(z.impact)===ie;return k(ie,re,Re,Re,pe,te)}if(z.phase==="DROP_ANIMATING"){var Pe=z.completed;if(!qr(ae,Pe.critical))return h;var Be=fi(Pe.critical,z.dimensions);return k(ie,re,ui(Pe.result)===ie,At(Pe.impact)===ie,Be,te)}if(z.phase==="IDLE"&&z.completed&&!z.shouldFlush){var He=z.completed;if(!qr(ae,He.critical))return h;var $e=At(He.impact)===ie,Je=Boolean(He.impact.at&&He.impact.at.type==="COMBINE"),rt=He.critical.droppable.id===ie;return $e?Je?t:h:rt?t:h}return h};return M},yl={updateViewportMaxScroll:fa};function bl(){return document.body||de(!1),document.body}var El={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:bl},hi=Object(L.c)(vl,yl,null,{context:jr,pure:!0,areStatePropsEqual:li})(gl);hi.defaultProps=El},rUJ1:function(mt,ct){const be=/[&<>"']/,he=/[&<>"']/g,j=/[<>"']|&(?!#?\w+;)/,D=/[<>"']|&(?!#?\w+;)/g,B={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},R=f=>B[f];function L(f,u){if(u){if(be.test(f))return f.replace(he,R)}else if(j.test(f))return f.replace(D,R);return f}const G=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function O(f){return f.replace(G,(u,o)=>(o=o.toLowerCase(),o==="colon"?":":o.charAt(0)==="#"?o.charAt(1)==="x"?String.fromCharCode(parseInt(o.substring(2),16)):String.fromCharCode(+o.substring(1)):""))}const _=/(^|[^\[])\^/g;function A(f,u){f=f.source||f,u=u||"";const o={replace:(a,i)=>(i=i.source||i,i=i.replace(_,"$1"),f=f.replace(a,i),o),getRegex:()=>new RegExp(f,u)};return o}const y=/[^\w:]/g,S=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function C(f,u,o){if(f){let a;try{a=decodeURIComponent(O(o)).replace(y,"").toLowerCase()}catch(i){return null}if(a.indexOf("javascript:")===0||a.indexOf("vbscript:")===0||a.indexOf("data:")===0)return null}u&&!S.test(o)&&(o=r(u,o));try{o=encodeURI(o).replace(/%25/g,"%")}catch(a){return null}return o}const T={},E=/^[^:]+:\/*[^/]*$/,x=/^([^:]+:)[\s\S]*$/,l=/^([^:]+:\/*[^/]*)[\s\S]*$/;function r(f,u){T[" "+f]||(E.test(f)?T[" "+f]=f+"/":T[" "+f]=d(f,"/",!0)),f=T[" "+f];const o=f.indexOf(":")===-1;return u.substring(0,2)==="//"?o?u:f.replace(x,"$1")+u:u.charAt(0)==="/"?o?u:f.replace(l,"$1")+u:f+u}const s={exec:function(){}};function n(f){let u=1,o,a;for(;u<arguments.length;u++){o=arguments[u];for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&(f[a]=o[a])}return f}function p(f,u){const o=f.replace(/\|/g,(v,g,m)=>{let w=!1,P=g;for(;--P>=0&&m[P]==="\\";)w=!w;return w?"|":" |"}),a=o.split(/ \|/);let i=0;if(a.length>u)a.splice(u);else for(;a.length<u;)a.push("");for(;i<a.length;i++)a[i]=a[i].trim().replace(/\\\|/g,"|");return a}function d(f,u,o){const a=f.length;if(a===0)return"";let i=0;for(;i<a;){const v=f.charAt(a-i-1);if(v===u&&!o)i++;else if(v!==u&&o)i++;else break}return f.substr(0,a-i)}function c(f,u){if(f.indexOf(u[1])===-1)return-1;const o=f.length;let a=0,i=0;for(;i<o;i++)if(f[i]==="\\")i++;else if(f[i]===u[0])a++;else if(f[i]===u[1]&&(a--,a<0))return i;return-1}function b(f){f&&f.sanitize&&!f.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}mt.exports={escape:L,unescape:O,edit:A,cleanUrl:C,resolveUrl:r,noopTest:s,merge:n,splitCells:p,rtrim:d,findClosingBracket:c,checkSanitizeDeprecation:b}},tKIZ:function(mt,ct,be){mt.exports={bg:"bg___1GOV5",wrap:"wrap___J6vaJ",flexRow:"flexRow___unGFp",flexColumn:"flexColumn___3FCv8",flexJustifyBetween:"flexJustifyBetween___1tvRX",relative:"relative___2tGdE",questionNumber:"questionNumber___2RbSA",score:"score___31L41",selectTopicButton:"selectTopicButton___ic3uu",line:"line___2kJQN",dragTip:"dragTip___3pvU9",typeActive:"typeActive___3yJ9J",mouseTypeActive:"mouseTypeActive___2H9Th",typeName:"typeName___3wa5X",typeNumber:"typeNumber___1LJJb",typeAction:"typeAction___20qxC",setScore:"setScore___1-dVI",delete:"delete___3XQMr",modal:"modal___1GZ8w",modalColumn:"modalColumn___2Pxg5",shixunModal:"shixunModal___3b9yL",shixunScore:"shixunScore___1-hSe"}},ulZh:function(mt,ct,be){typeof window!="undefined"&&function(j,D){mt.exports=D()}(this,function(){return function(he){var j={};function D(B){if(j[B])return j[B].exports;var R=j[B]={i:B,l:!1,exports:{}};return he[B].call(R.exports,R,R.exports,D),R.l=!0,R.exports}return D.m=he,D.c=j,D.d=function(B,R,L){D.o(B,R)||Object.defineProperty(B,R,{enumerable:!0,get:L})},D.r=function(B){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(B,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(B,"__esModule",{value:!0})},D.t=function(B,R){if(R&1&&(B=D(B)),R&8)return B;if(R&4&&typeof B=="object"&&B&&B.__esModule)return B;var L=Object.create(null);if(D.r(L),Object.defineProperty(L,"default",{enumerable:!0,value:B}),R&2&&typeof B!="string")for(var G in B)D.d(L,G,function(O){return B[O]}.bind(null,G));return L},D.n=function(B){var R=B&&B.__esModule?function(){return B.default}:function(){return B};return D.d(R,"a",R),R},D.o=function(B,R){return Object.prototype.hasOwnProperty.call(B,R)},D.p="/dist/",D(D.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(he,j,D){"use strict";var B=Object.prototype.hasOwnProperty,R="~";function L(){}Object.create&&(L.prototype=Object.create(null),new L().__proto__||(R=!1));function G(y,S,C){this.fn=y,this.context=S,this.once=C||!1}function O(y,S,C,T,E){if(typeof C!="function")throw new TypeError("The listener must be a function");var x=new G(C,T||y,E),l=R?R+S:S;return y._events[l]?y._events[l].fn?y._events[l]=[y._events[l],x]:y._events[l].push(x):(y._events[l]=x,y._eventsCount++),y}function _(y,S){--y._eventsCount===0?y._events=new L:delete y._events[S]}function A(){this._events=new L,this._eventsCount=0}A.prototype.eventNames=function(){var S=[],C,T;if(this._eventsCount===0)return S;for(T in C=this._events)B.call(C,T)&&S.push(R?T.slice(1):T);return Object.getOwnPropertySymbols?S.concat(Object.getOwnPropertySymbols(C)):S},A.prototype.listeners=function(S){var C=R?R+S:S,T=this._events[C];if(!T)return[];if(T.fn)return[T.fn];for(var E=0,x=T.length,l=new Array(x);E<x;E++)l[E]=T[E].fn;return l},A.prototype.listenerCount=function(S){var C=R?R+S:S,T=this._events[C];return T?T.fn?1:T.length:0},A.prototype.emit=function(S,C,T,E,x,l){var r=R?R+S:S;if(!this._events[r])return!1;var s=this._events[r],n=arguments.length,p,d;if(s.fn){s.once&&this.removeListener(S,s.fn,void 0,!0);switch(n){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,C),!0;case 3:return s.fn.call(s.context,C,T),!0;case 4:return s.fn.call(s.context,C,T,E),!0;case 5:return s.fn.call(s.context,C,T,E,x),!0;case 6:return s.fn.call(s.context,C,T,E,x,l),!0}for(d=1,p=new Array(n-1);d<n;d++)p[d-1]=arguments[d];s.fn.apply(s.context,p)}else{var c=s.length,b;for(d=0;d<c;d++){s[d].once&&this.removeListener(S,s[d].fn,void 0,!0);switch(n){case 1:s[d].fn.call(s[d].context);break;case 2:s[d].fn.call(s[d].context,C);break;case 3:s[d].fn.call(s[d].context,C,T);break;case 4:s[d].fn.call(s[d].context,C,T,E);break;default:if(!p)for(b=1,p=new Array(n-1);b<n;b++)p[b-1]=arguments[b];s[d].fn.apply(s[d].context,p)}}}return!0},A.prototype.on=function(S,C,T){return O(this,S,C,T,!1)},A.prototype.once=function(S,C,T){return O(this,S,C,T,!0)},A.prototype.removeListener=function(S,C,T,E){var x=R?R+S:S;if(!this._events[x])return this;if(!C)return _(this,x),this;var l=this._events[x];if(l.fn)l.fn===C&&(!E||l.once)&&(!T||l.context===T)&&_(this,x);else{for(var r=0,s=[],n=l.length;r<n;r++)(l[r].fn!==C||E&&!l[r].once||T&&l[r].context!==T)&&s.push(l[r]);s.length?this._events[x]=s.length===1?s[0]:s:_(this,x)}return this},A.prototype.removeAllListeners=function(S){var C;return S?(C=R?R+S:S,this._events[C]&&_(this,C)):(this._events=new L,this._eventsCount=0),this},A.prototype.off=A.prototype.removeListener,A.prototype.addListener=A.prototype.on,A.prefixed=R,A.EventEmitter=A,he.exports=A},"./node_modules/url-toolkit/src/url-toolkit.js":function(he,j,D){(function(B){var R=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,L=/^([^\/?#]*)([^]*)$/,G=/(?:\/|^)\.(?=\/)/g,O=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,_={buildAbsoluteURL:function(A,y,S){if(S=S||{},A=A.trim(),y=y.trim(),!y){if(!S.alwaysNormalize)return A;var C=_.parseURL(A);if(!C)throw new Error("Error trying to parse base URL.");return C.path=_.normalizePath(C.path),_.buildURLFromParts(C)}var T=_.parseURL(y);if(!T)throw new Error("Error trying to parse relative URL.");if(T.scheme)return S.alwaysNormalize?(T.path=_.normalizePath(T.path),_.buildURLFromParts(T)):y;var E=_.parseURL(A);if(!E)throw new Error("Error trying to parse base URL.");if(!E.netLoc&&E.path&&E.path[0]!=="/"){var x=L.exec(E.path);E.netLoc=x[1],E.path=x[2]}E.netLoc&&!E.path&&(E.path="/");var l={scheme:E.scheme,netLoc:T.netLoc,path:null,params:T.params,query:T.query,fragment:T.fragment};if(!T.netLoc&&(l.netLoc=E.netLoc,T.path[0]!=="/"))if(!T.path)l.path=E.path,T.params||(l.params=E.params,T.query||(l.query=E.query));else{var r=E.path,s=r.substring(0,r.lastIndexOf("/")+1)+T.path;l.path=_.normalizePath(s)}return l.path===null&&(l.path=S.alwaysNormalize?_.normalizePath(T.path):T.path),_.buildURLFromParts(l)},parseURL:function(A){var y=R.exec(A);return y?{scheme:y[1]||"",netLoc:y[2]||"",path:y[3]||"",params:y[4]||"",query:y[5]||"",fragment:y[6]||""}:null},normalizePath:function(A){for(A=A.split("").reverse().join("").replace(G,"");A.length!==(A=A.replace(O,"")).length;);return A.split("").reverse().join("")},buildURLFromParts:function(A){return A.scheme+A.netLoc+A.path+A.params+A.query+A.fragment}};he.exports=_})(this)},"./node_modules/webworkify-webpack/index.js":function(he,j,D){function B(S){var C={};function T(x){if(C[x])return C[x].exports;var l=C[x]={i:x,l:!1,exports:{}};return S[x].call(l.exports,l,l.exports,T),l.l=!0,l.exports}T.m=S,T.c=C,T.i=function(x){return x},T.d=function(x,l,r){T.o(x,l)||Object.defineProperty(x,l,{configurable:!1,enumerable:!0,get:r})},T.r=function(x){Object.defineProperty(x,"__esModule",{value:!0})},T.n=function(x){var l=x&&x.__esModule?function(){return x.default}:function(){return x};return T.d(l,"a",l),l},T.o=function(x,l){return Object.prototype.hasOwnProperty.call(x,l)},T.p="/",T.oe=function(x){throw console.error(x),x};var E=T(T.s=ENTRY_MODULE);return E.default||E}var R="[\\.|\\-|\\+|\\w|/|@]+",L="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+R+").*?\\)";function G(S){return(S+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function O(S){return!isNaN(1*S)}function _(S,C,T){var E={};E[T]=[];var x=C.toString(),l=x.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!l)return E;for(var r=l[1],s=new RegExp("(\\\\n|\\W)"+G(r)+L,"g"),n;n=s.exec(x);){if(n[3]==="dll-reference")continue;E[T].push(n[3])}for(s=new RegExp("\\("+G(r)+'\\("(dll-reference\\s('+R+'))"\\)\\)'+L,"g");n=s.exec(x);)S[n[2]]||(E[T].push(n[1]),S[n[2]]=D(n[1]).m),E[n[2]]=E[n[2]]||[],E[n[2]].push(n[4]);for(var p=Object.keys(E),d=0;d<p.length;d++)for(var c=0;c<E[p[d]].length;c++)O(E[p[d]][c])&&(E[p[d]][c]=1*E[p[d]][c]);return E}function A(S){var C=Object.keys(S);return C.reduce(function(T,E){return T||S[E].length>0},!1)}function y(S,C){for(var T={main:[C]},E={main:[]},x={main:{}};A(T);)for(var l=Object.keys(T),r=0;r<l.length;r++){var s=l[r],n=T[s],p=n.pop();if(x[s]=x[s]||{},x[s][p]||!S[s][p])continue;x[s][p]=!0,E[s]=E[s]||[],E[s].push(p);for(var d=_(S,S[s][p],s),c=Object.keys(d),b=0;b<c.length;b++)T[c[b]]=T[c[b]]||[],T[c[b]]=T[c[b]].concat(d[c[b]])}return E}he.exports=function(S,C){C=C||{};var T={main:D.m},E=C.all?{main:Object.keys(T.main)}:y(T,S),x="";Object.keys(E).filter(function(p){return p!=="main"}).forEach(function(p){for(var d=0;E[p][d];)d++;E[p].push(d),T[p][d]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",x=x+"var "+p+" = ("+B.toString().replace("ENTRY_MODULE",JSON.stringify(d))+")({"+E[p].map(function(c){return""+JSON.stringify(c)+": "+T[p][c].toString()}).join(",")+`});
`}),x=x+"new (("+B.toString().replace("ENTRY_MODULE",JSON.stringify(S))+")({"+E.main.map(function(p){return""+JSON.stringify(p)+": "+T.main[p].toString()}).join(",")+"}))(self);";var l=new window.Blob([x],{type:"text/javascript"});if(C.bare)return l;var r=window.URL||window.webkitURL||window.mozURL||window.msURL,s=r.createObjectURL(l),n=new window.Worker(s);return n.objectURL=s,n}},"./src/config.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"hlsDefaultConfig",function(){return b}),D.d(j,"mergeConfig",function(){return u}),D.d(j,"enableStreamingMode",function(){return o});var B=D("./src/controller/abr-controller.ts"),R=D("./src/controller/audio-stream-controller.ts"),L=D("./src/controller/audio-track-controller.ts"),G=D("./src/controller/subtitle-stream-controller.ts"),O=D("./src/controller/subtitle-track-controller.ts"),_=D("./src/controller/buffer-controller.ts"),A=D("./src/controller/timeline-controller.ts"),y=D("./src/controller/cap-level-controller.ts"),S=D("./src/controller/fps-controller.ts"),C=D("./src/controller/eme-controller.ts"),T=D("./src/controller/cmcd-controller.ts"),E=D("./src/utils/xhr-loader.ts"),x=D("./src/utils/fetch-loader.ts"),l=D("./src/utils/cues.ts"),r=D("./src/utils/mediakeys-helper.ts"),s=D("./src/utils/logger.ts");function n(){return n=Object.assign||function(a){for(var i=1;i<arguments.length;i++){var v=arguments[i];for(var g in v)Object.prototype.hasOwnProperty.call(v,g)&&(a[g]=v[g])}return a},n.apply(this,arguments)}function p(a,i){var v=Object.keys(a);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(a);i&&(g=g.filter(function(m){return Object.getOwnPropertyDescriptor(a,m).enumerable})),v.push.apply(v,g)}return v}function d(a){for(var i=1;i<arguments.length;i++){var v=arguments[i]!=null?arguments[i]:{};i%2?p(Object(v),!0).forEach(function(g){c(a,g,v[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(v)):p(Object(v)).forEach(function(g){Object.defineProperty(a,g,Object.getOwnPropertyDescriptor(v,g))})}return a}function c(a,i,v){return i in a?Object.defineProperty(a,i,{value:v,enumerable:!0,configurable:!0,writable:!0}):a[i]=v,a}var b=d(d({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:E.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:B.default,bufferController:_.default,capLevelController:y.default,fpsController:S.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:r.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},f()),{},{subtitleStreamController:G.SubtitleStreamController,subtitleTrackController:O.default,timelineController:A.TimelineController,audioStreamController:R.default,audioTrackController:L.default,emeController:C.default,cmcdController:T.default});function f(){return{cueHandler:l.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function u(a,i){if((i.liveSyncDurationCount||i.liveMaxLatencyDurationCount)&&(i.liveSyncDuration||i.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(i.liveMaxLatencyDurationCount!==void 0&&(i.liveSyncDurationCount===void 0||i.liveMaxLatencyDurationCount<=i.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(i.liveMaxLatencyDuration!==void 0&&(i.liveSyncDuration===void 0||i.liveMaxLatencyDuration<=i.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return n({},a,i)}function o(a){var i=a.loader;if(i!==x.default&&i!==E.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),a.progressive=!1;else{var v=Object(x.fetchSupported)();v&&(a.loader=x.default,a.progressive=!0,a.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(he,j,D){"use strict";D.r(j);var B=D("./src/polyfills/number.ts"),R=D("./src/utils/ewma-bandwidth-estimator.ts"),L=D("./src/events.ts"),G=D("./src/utils/buffer-helper.ts"),O=D("./src/errors.ts"),_=D("./src/types/loader.ts"),A=D("./src/utils/logger.ts");function y(T,E){for(var x=0;x<E.length;x++){var l=E[x];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(T,l.key,l)}}function S(T,E,x){return E&&y(T.prototype,E),x&&y(T,x),T}var C=function(){function T(x){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=x;var l=x.config;this.bwEstimator=new R.default(l.abrEwmaSlowVoD,l.abrEwmaFastVoD,l.abrEwmaDefaultEstimate),this.registerListeners()}var E=T.prototype;return E.registerListeners=function(){var l=this.hls;l.on(L.Events.FRAG_LOADING,this.onFragLoading,this),l.on(L.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(L.Events.FRAG_BUFFERED,this.onFragBuffered,this),l.on(L.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(L.Events.ERROR,this.onError,this)},E.unregisterListeners=function(){var l=this.hls;l.off(L.Events.FRAG_LOADING,this.onFragLoading,this),l.off(L.Events.FRAG_LOADED,this.onFragLoaded,this),l.off(L.Events.FRAG_BUFFERED,this.onFragBuffered,this),l.off(L.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(L.Events.ERROR,this.onError,this)},E.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},E.onFragLoading=function(l,r){var s=r.frag;if(s.type===_.PlaylistLevelType.MAIN&&!this.timer){var n;this.fragCurrent=s,this.partCurrent=(n=r.part)!=null?n:null,this.timer=self.setInterval(this.onCheck,100)}},E.onLevelLoaded=function(l,r){var s=this.hls.config;r.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},E._abandonRulesCheck=function(){var l=this.fragCurrent,r=this.partCurrent,s=this.hls,n=s.autoLevelEnabled,p=s.config,d=s.media;if(!l||!d)return;var c=r?r.stats:l.stats,b=r?r.duration:l.duration;if(c.aborted){A.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!n||d.paused||!d.playbackRate||!d.readyState)return;var f=performance.now()-c.loading.start,u=Math.abs(d.playbackRate);if(f<=500*b/u)return;var o=s.levels,a=s.minAutoLevel,i=o[l.level],v=c.total||Math.max(c.loaded,Math.round(b*i.maxBitrate/8)),g=Math.max(1,c.bwEstimate?c.bwEstimate/8:c.loaded*1e3/f),m=(v-c.loaded)/g,w=d.currentTime,P=(G.BufferHelper.bufferInfo(d,w,p.maxBufferHole).end-w)/u;if(P>=2*b/u||m<=P)return;var N=Number.POSITIVE_INFINITY,K;for(K=l.level-1;K>a;K--){var Y=o[K].maxBitrate;if(N=b*Y/(8*.8*g),N<P)break}if(N>=m)return;var ne=this.bwEstimator.getEstimate();A.logger.warn("Fragment "+l.sn+(r?" part "+r.index:"")+" of level "+l.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+K+`
Current BW estimate: `+(Object(B.isFiniteNumber)(ne)?(ne/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+m.toFixed(3)+` s
Estimated load time for the next fragment: `+N.toFixed(3)+` s
Time to underbuffer: `+P.toFixed(3)+" s"),s.nextLoadLevel=K,this.bwEstimator.sample(f,c.loaded),this.clearTimer(),l.loader&&(this.fragCurrent=this.partCurrent=null,l.loader.abort()),s.trigger(L.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:l,part:r,stats:c})},E.onFragLoaded=function(l,r){var s=r.frag,n=r.part;if(s.type===_.PlaylistLevelType.MAIN&&Object(B.isFiniteNumber)(s.sn)){var p=n?n.stats:s.stats,d=n?n.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var c=this.hls.levels[s.level],b=(c.loaded?c.loaded.bytes:0)+p.loaded,f=(c.loaded?c.loaded.duration:0)+d;c.loaded={bytes:b,duration:f},c.realBitrate=Math.round(8*b/f)}if(s.bitrateTest){var u={stats:p,frag:s,part:n,id:s.type};this.onFragBuffered(L.Events.FRAG_BUFFERED,u),s.bitrateTest=!1}}},E.onFragBuffered=function(l,r){var s=r.frag,n=r.part,p=n?n.stats:s.stats;if(p.aborted)return;if(s.type!==_.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var d=p.parsing.end-p.loading.start;this.bwEstimator.sample(d,p.loaded),p.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=d/1e3:this.bitrateTestDelay=0},E.onError=function(l,r){switch(r.details){case O.ErrorDetails.FRAG_LOAD_ERROR:case O.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},E.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},E.getNextABRAutoLevel=function(){var l=this.fragCurrent,r=this.partCurrent,s=this.hls,n=s.maxAutoLevel,p=s.config,d=s.minAutoLevel,c=s.media,b=r?r.duration:l?l.duration:0,f=c?c.currentTime:0,u=c&&c.playbackRate!==0?Math.abs(c.playbackRate):1,o=this.bwEstimator?this.bwEstimator.getEstimate():p.abrEwmaDefaultEstimate,a=(G.BufferHelper.bufferInfo(c,f,p.maxBufferHole).end-f)/u,i=this.findBestLevel(o,d,n,a,p.abrBandWidthFactor,p.abrBandWidthUpFactor);if(i>=0)return i;A.logger.trace((a?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var v=b?Math.min(b,p.maxStarvationDelay):p.maxStarvationDelay,g=p.abrBandWidthFactor,m=p.abrBandWidthUpFactor;if(!a){var w=this.bitrateTestDelay;if(w){var P=b?Math.min(b,p.maxLoadingDelay):p.maxLoadingDelay;v=P-w,A.logger.trace("bitrate test took "+Math.round(1e3*w)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*v)+" ms"),g=m=1}}return i=this.findBestLevel(o,d,n,a+v,g,m),Math.max(i,0)},E.findBestLevel=function(l,r,s,n,p,d){for(var c,b=this.fragCurrent,f=this.partCurrent,u=this.lastLoadedFragLevel,o=this.hls.levels,a=o[u],i=!!(a!=null&&(c=a.details)!==null&&c!==void 0&&c.live),v=a==null?void 0:a.codecSet,g=f?f.duration:b?b.duration:0,m=s;m>=r;m--){var w=o[m];if(!w||v&&w.codecSet!==v)continue;var P=w.details,N=(f?P==null?void 0:P.partTarget:P==null?void 0:P.averagetargetduration)||g,K=void 0;m<=u?K=p*l:K=d*l;var Y=o[m].maxBitrate,ne=Y*N/K;if(A.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+m+"/"+Math.round(K)+"/"+Y+"/"+N+"/"+n+"/"+ne),K>Y&&(!ne||i&&!this.bitrateTestDelay||ne<n))return m}return-1},S(T,[{key:"nextAutoLevel",get:function(){var l=this._nextAutoLevel,r=this.bwEstimator;if(l!==-1&&(!r||!r.canEstimate()))return l;var s=this.getNextABRAutoLevel();return l!==-1&&(s=Math.min(l,s)),s},set:function(l){this._nextAutoLevel=l}}]),T}();j.default=C},"./src/controller/audio-stream-controller.ts":function(he,j,D){"use strict";D.r(j);var B=D("./src/polyfills/number.ts"),R=D("./src/controller/base-stream-controller.ts"),L=D("./src/events.ts"),G=D("./src/utils/buffer-helper.ts"),O=D("./src/controller/fragment-tracker.ts"),_=D("./src/types/level.ts"),A=D("./src/types/loader.ts"),y=D("./src/loader/fragment.ts"),S=D("./src/demux/chunk-cache.ts"),C=D("./src/demux/transmuxer-interface.ts"),T=D("./src/types/transmuxer.ts"),E=D("./src/controller/fragment-finders.ts"),x=D("./src/utils/discontinuities.ts"),l=D("./src/errors.ts"),r=D("./src/utils/logger.ts");function s(){return s=Object.assign||function(b){for(var f=1;f<arguments.length;f++){var u=arguments[f];for(var o in u)Object.prototype.hasOwnProperty.call(u,o)&&(b[o]=u[o])}return b},s.apply(this,arguments)}function n(b,f){b.prototype=Object.create(f.prototype),b.prototype.constructor=b,p(b,f)}function p(b,f){return p=Object.setPrototypeOf||function(o,a){return o.__proto__=a,o},p(b,f)}var d=100,c=function(b){n(f,b);function f(o,a){var i;return i=b.call(this,o,a,"[audio-stream-controller]")||this,i.videoBuffer=null,i.videoTrackCC=-1,i.waitingVideoCC=-1,i.audioSwitch=!1,i.trackId=-1,i.waitingData=null,i.mainDetails=null,i.bufferFlushed=!1,i._registerListeners(),i}var u=f.prototype;return u.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},u._registerListeners=function(){var a=this.hls;a.on(L.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(L.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(L.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(L.Events.LEVEL_LOADED,this.onLevelLoaded,this),a.on(L.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),a.on(L.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),a.on(L.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),a.on(L.Events.ERROR,this.onError,this),a.on(L.Events.BUFFER_RESET,this.onBufferReset,this),a.on(L.Events.BUFFER_CREATED,this.onBufferCreated,this),a.on(L.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),a.on(L.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),a.on(L.Events.FRAG_BUFFERED,this.onFragBuffered,this)},u._unregisterListeners=function(){var a=this.hls;a.off(L.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(L.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(L.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(L.Events.LEVEL_LOADED,this.onLevelLoaded,this),a.off(L.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),a.off(L.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),a.off(L.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),a.off(L.Events.ERROR,this.onError,this),a.off(L.Events.BUFFER_RESET,this.onBufferReset,this),a.off(L.Events.BUFFER_CREATED,this.onBufferCreated,this),a.off(L.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),a.off(L.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),a.off(L.Events.FRAG_BUFFERED,this.onFragBuffered,this)},u.onInitPtsFound=function(a,i){var v=i.frag,g=i.id,m=i.initPTS;if(g==="main"){var w=v.cc;this.initPTS[v.cc]=m,this.log("InitPTS for cc: "+w+" found from main: "+m),this.videoTrackCC=w,this.state===R.State.WAITING_INIT_PTS&&this.tick()}},u.startLoad=function(a){if(!this.levels){this.startPosition=a,this.state=R.State.STOPPED;return}var i=this.lastCurrentTime;this.stopLoad(),this.setInterval(d),this.fragLoadError=0,i>0&&a===-1?(this.log("Override startPosition with lastCurrentTime @"+i.toFixed(3)),this.state=R.State.IDLE):(this.loadedmetadata=!1,this.state=R.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=a,this.tick()},u.doTick=function(){switch(this.state){case R.State.IDLE:this.doTickIdle();break;case R.State.WAITING_TRACK:{var a,i=this.levels,v=this.trackId,g=i==null||((a=i[v])===null||a===void 0)?void 0:a.details;if(g){if(this.waitForCdnTuneIn(g))break;this.state=R.State.WAITING_INIT_PTS}break}case R.State.FRAG_LOADING_WAITING_RETRY:{var m,w=performance.now(),P=this.retryDate;(!P||w>=P||(m=this.media)!==null&&m!==void 0&&m.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=R.State.IDLE);break}case R.State.WAITING_INIT_PTS:{var N=this.waitingData;if(N){var K=N.frag,Y=N.part,ne=N.cache,q=N.complete;if(this.initPTS[K.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=R.State.FRAG_LOADING;var se=ne.flush(),fe={frag:K,part:Y,payload:se,networkDetails:null};this._handleFragmentLoadProgress(fe),q&&b.prototype._handleFragmentLoadComplete.call(this,fe)}else if(this.videoTrackCC!==this.waitingVideoCC)r.logger.log("Waiting fragment cc ("+K.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var le=this.getLoadPosition(),ve=G.BufferHelper.bufferInfo(this.mediaBuffer,le,this.config.maxBufferHole),Se=Object(E.fragmentWithinToleranceTest)(ve.end,this.config.maxFragLookUpTolerance,K);Se<0&&(r.logger.log("Waiting fragment cc ("+K.cc+") @ "+K.start+" cancelled because another fragment at "+ve.end+" is needed"),this.clearWaitingFragment())}}else this.state=R.State.IDLE}}this.onTickEnd()},u.clearWaitingFragment=function(){var a=this.waitingData;a&&(this.fragmentTracker.removeFragment(a.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=R.State.IDLE)},u.onTickEnd=function(){var a=this.media;if(!a||!a.readyState)return;var i=this.mediaBuffer?this.mediaBuffer:a,v=i.buffered;!this.loadedmetadata&&v.length&&(this.loadedmetadata=!0),this.lastCurrentTime=a.currentTime},u.doTickIdle=function(){var a,i,v=this.hls,g=this.levels,m=this.media,w=this.trackId,P=v.config;if(!g||!g[w])return;if(!m&&(this.startFragRequested||!P.startFragPrefetch))return;var N=g[w],K=N.details;if(!K||K.live&&this.levelLastLoaded!==w||this.waitForCdnTuneIn(K)){this.state=R.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,y.ElementaryStreamTypes.AUDIO,A.PlaylistLevelType.AUDIO));var Y=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,A.PlaylistLevelType.AUDIO);if(Y===null)return;var ne=Y.len,q=this.getMaxBufferLength(),se=this.audioSwitch;if(ne>=q&&!se)return;if(!se&&this._streamEnded(Y,K)){v.trigger(L.Events.BUFFER_EOS,{type:"audio"}),this.state=R.State.ENDED;return}var fe=K.fragments,le=fe[0].start,ve=Y.end;if(se){var Se=this.getLoadPosition();ve=Se,K.PTSKnown&&Se<le&&((Y.end>le||Y.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),m.currentTime=le+.05))}var ke=this.getNextFragment(ve,K);if(!ke){this.bufferFlushed=!0;return}((a=ke.decryptdata)===null||a===void 0?void 0:a.keyFormat)==="identity"&&!((i=ke.decryptdata)!==null&&i!==void 0&&i.key)?this.loadKey(ke,K):this.loadFragment(ke,K,ve)},u.getMaxBufferLength=function(){var a=b.prototype.getMaxBufferLength.call(this),i=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,A.PlaylistLevelType.MAIN);return i===null?a:Math.max(a,i.len)},u.onMediaDetaching=function(){this.videoBuffer=null,b.prototype.onMediaDetaching.call(this)},u.onAudioTracksUpdated=function(a,i){var v=i.audioTracks;this.resetTransmuxer(),this.levels=v.map(function(g){return new _.Level(g)})},u.onAudioTrackSwitching=function(a,i){var v=!!i.url;this.trackId=i.id;var g=this.fragCurrent;g!=null&&g.loader&&g.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),v?this.setInterval(d):this.resetTransmuxer(),v?(this.audioSwitch=!0,this.state=R.State.IDLE):this.state=R.State.STOPPED,this.tick()},u.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},u.onLevelLoaded=function(a,i){this.mainDetails=i.details},u.onAudioTrackLoaded=function(a,i){var v,g=this.levels,m=i.details,w=i.id;if(!g){this.warn("Audio tracks were reset while loading level "+w);return}this.log("Track "+w+" loaded ["+m.startSN+","+m.endSN+"],duration:"+m.totalduration);var P=g[w],N=0;if(m.live||(v=P.details)!==null&&v!==void 0&&v.live){var K=this.mainDetails;if(m.fragments[0]||(m.deltaUpdateFailed=!0),m.deltaUpdateFailed||!K)return;!P.details&&m.hasProgramDateTime&&K.hasProgramDateTime?(Object(x.alignMediaPlaylistByPDT)(m,K),N=m.fragments[0].start):N=this.alignPlaylists(m,P.details)}P.details=m,this.levelLastLoaded=w,!this.startFragRequested&&(this.mainDetails||!m.live)&&this.setStartPosition(P.details,N),this.state===R.State.WAITING_TRACK&&!this.waitForCdnTuneIn(m)&&(this.state=R.State.IDLE),this.tick()},u._handleFragmentLoadProgress=function(a){var i,v=a.frag,g=a.part,m=a.payload,w=this.config,P=this.trackId,N=this.levels;if(!N){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+v.sn+" of level "+v.level+" will not be buffered");return}var K=N[P];console.assert(K,"Audio track is defined on fragment load progress");var Y=K.details;console.assert(Y,"Audio track details are defined on fragment load progress");var ne=w.defaultAudioCodec||K.audioCodec||"mp4a.40.2",q=this.transmuxer;q||(q=this.transmuxer=new C.default(this.hls,A.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var se=this.initPTS[v.cc],fe=(i=v.initSegment)===null||i===void 0?void 0:i.data;if(se!==void 0){var le=!1,ve=g?g.index:-1,Se=ve!==-1,ke=new T.ChunkMetadata(v.level,v.sn,v.stats.chunkCount,m.byteLength,ve,Se);q.push(m,fe,ne,"",v,g,Y.totalduration,le,ke,se)}else{r.logger.log("Unknown video PTS for cc "+v.cc+", waiting for video PTS before demuxing audio frag "+v.sn+" of ["+Y.startSN+" ,"+Y.endSN+"],track "+P);var Ce=this.waitingData=this.waitingData||{frag:v,part:g,cache:new S.default,complete:!1},Le=Ce.cache;Le.push(new Uint8Array(m)),this.waitingVideoCC=this.videoTrackCC,this.state=R.State.WAITING_INIT_PTS}},u._handleFragmentLoadComplete=function(a){if(this.waitingData){this.waitingData.complete=!0;return}b.prototype._handleFragmentLoadComplete.call(this,a)},u.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},u.onBufferCreated=function(a,i){var v=i.tracks.audio;v&&(this.mediaBuffer=v.buffer),i.tracks.video&&(this.videoBuffer=i.tracks.video.buffer)},u.onFragBuffered=function(a,i){var v=i.frag,g=i.part;if(v.type!==A.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(v)){this.warn("Fragment "+v.sn+(g?" p: "+g.index:"")+" of level "+v.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}v.sn!=="initSegment"&&(this.fragPrevious=v,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(L.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(v,g)},u.onError=function(a,i){switch(i.details){case l.ErrorDetails.FRAG_LOAD_ERROR:case l.ErrorDetails.FRAG_LOAD_TIMEOUT:case l.ErrorDetails.KEY_LOAD_ERROR:case l.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(A.PlaylistLevelType.AUDIO,i);break;case l.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case l.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==R.State.ERROR&&this.state!==R.State.STOPPED&&(this.state=i.fatal?R.State.ERROR:R.State.IDLE,this.warn(i.details+" while loading frag, switching to "+this.state+" state"));break;case l.ErrorDetails.BUFFER_FULL_ERROR:if(i.parent==="audio"&&(this.state===R.State.PARSING||this.state===R.State.PARSED)){var v=!0,g=this.getFwdBufferInfo(this.mediaBuffer,A.PlaylistLevelType.AUDIO);g&&g.len>.5&&(v=!this.reduceMaxBufferLength(g.len)),v&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,b.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},u.onBufferFlushed=function(a,i){var v=i.type;v===y.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},u._handleTransmuxComplete=function(a){var i,v="audio",g=this.hls,m=a.remuxResult,w=a.chunkMeta,P=this.getCurrentContext(w);if(!P){this.warn("The loading context changed while buffering fragment "+w.sn+" of level "+w.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(w.level);return}var N=P.frag,K=P.part,Y=m.audio,ne=m.text,q=m.id3,se=m.initSegment;if(this.fragContextChanged(N))return;if(this.state=R.State.PARSING,this.audioSwitch&&Y&&this.completeAudioSwitch(),se!=null&&se.tracks&&(this._bufferInitSegment(se.tracks,N,w),g.trigger(L.Events.FRAG_PARSING_INIT_SEGMENT,{frag:N,id:v,tracks:se.tracks})),Y){var fe=Y.startPTS,le=Y.endPTS,ve=Y.startDTS,Se=Y.endDTS;K&&(K.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:fe,endPTS:le,startDTS:ve,endDTS:Se}),N.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,fe,le,ve,Se),this.bufferFragmentData(Y,N,K,w)}if(q!=null&&(i=q.samples)!==null&&i!==void 0&&i.length){var ke=s({frag:N,id:v},q);g.trigger(L.Events.FRAG_PARSING_METADATA,ke)}if(ne){var Ce=s({frag:N,id:v},ne);g.trigger(L.Events.FRAG_PARSING_USERDATA,Ce)}},u._bufferInitSegment=function(a,i,v){if(this.state!==R.State.PARSING)return;a.video&&delete a.video;var g=a.audio;if(!g)return;g.levelCodec=g.codec,g.id="audio",this.log("Init audio buffer, container:"+g.container+", codecs[parsed]=["+g.codec+"]"),this.hls.trigger(L.Events.BUFFER_CODECS,a);var m=g.initSegment;if(m!=null&&m.byteLength){var w={type:"audio",frag:i,part:null,chunkMeta:v,parent:i.type,data:m};this.hls.trigger(L.Events.BUFFER_APPENDING,w)}this.tick()},u.loadFragment=function(a,i,v){var g=this.fragmentTracker.getState(a);this.fragCurrent=a,(this.audioSwitch||g===O.FragmentState.NOT_LOADED||g===O.FragmentState.PARTIAL)&&(a.sn==="initSegment"?this._loadInitSegment(a):i.live&&!Object(B.isFiniteNumber)(this.initPTS[a.cc])?(this.log("Waiting for video PTS in continuity counter "+a.cc+" of live stream before loading audio fragment "+a.sn+" of level "+this.trackId),this.state=R.State.WAITING_INIT_PTS):(this.startFragRequested=!0,b.prototype.loadFragment.call(this,a,i,v)))},u.completeAudioSwitch=function(){var a=this.hls,i=this.media,v=this.trackId;i&&(this.log("Switching audio track : flushing all audio"),b.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,a.trigger(L.Events.AUDIO_TRACK_SWITCHED,{id:v})},f}(R.default);j.default=c},"./src/controller/audio-track-controller.ts":function(he,j,D){"use strict";D.r(j);var B=D("./src/events.ts"),R=D("./src/errors.ts"),L=D("./src/controller/base-playlist-controller.ts"),G=D("./src/types/loader.ts");function O(C,T){for(var E=0;E<T.length;E++){var x=T[E];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(C,x.key,x)}}function _(C,T,E){return T&&O(C.prototype,T),E&&O(C,E),C}function A(C,T){C.prototype=Object.create(T.prototype),C.prototype.constructor=C,y(C,T)}function y(C,T){return y=Object.setPrototypeOf||function(x,l){return x.__proto__=l,x},y(C,T)}var S=function(C){A(T,C);function T(x){var l;return l=C.call(this,x,"[audio-track-controller]")||this,l.tracks=[],l.groupId=null,l.tracksInGroup=[],l.trackId=-1,l.trackName="",l.selectDefaultTrack=!0,l.registerListeners(),l}var E=T.prototype;return E.registerListeners=function(){var l=this.hls;l.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.on(B.Events.LEVEL_LOADING,this.onLevelLoading,this),l.on(B.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.on(B.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.on(B.Events.ERROR,this.onError,this)},E.unregisterListeners=function(){var l=this.hls;l.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.off(B.Events.LEVEL_LOADING,this.onLevelLoading,this),l.off(B.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.off(B.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.off(B.Events.ERROR,this.onError,this)},E.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,C.prototype.destroy.call(this)},E.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},E.onManifestParsed=function(l,r){this.tracks=r.audioTracks||[]},E.onAudioTrackLoaded=function(l,r){var s=r.id,n=r.details,p=this.tracksInGroup[s];if(!p){this.warn("Invalid audio track id "+s);return}var d=p.details;p.details=r.details,this.log("audioTrack "+s+" loaded ["+n.startSN+"-"+n.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,r,d))},E.onLevelLoading=function(l,r){this.switchLevel(r.level)},E.onLevelSwitching=function(l,r){this.switchLevel(r.level)},E.switchLevel=function(l){var r=this.hls.levels[l];if(!(r!=null&&r.audioGroupIds))return;var s=r.audioGroupIds[r.urlId];if(this.groupId!==s){this.groupId=s;var n=this.tracks.filter(function(d){return!s||d.groupId===s});this.selectDefaultTrack&&!n.some(function(d){return d.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=n;var p={audioTracks:n};this.log("Updating audio tracks, "+n.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(B.Events.AUDIO_TRACKS_UPDATED,p),this.selectInitialTrack()}},E.onError=function(l,r){if(C.prototype.onError.call(this,l,r),r.fatal||!r.context)return;r.context.type===G.PlaylistContextType.AUDIO_TRACK&&r.context.id===this.trackId&&r.context.groupId===this.groupId&&this.retryLoadingOrFail(r)},E.setAudioTrack=function(l){var r=this.tracksInGroup;if(l<0||l>=r.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var s=r[this.trackId];this.log("Now switching to audio-track index "+l);var n=r[l],p=n.id,d=n.groupId,c=d===void 0?"":d,b=n.name,f=n.type,u=n.url;if(this.trackId=l,this.trackName=b,this.selectDefaultTrack=!1,this.hls.trigger(B.Events.AUDIO_TRACK_SWITCHING,{id:p,groupId:c,name:b,type:f,url:u}),n.details&&!n.details.live)return;var o=this.switchParams(n.url,s==null?void 0:s.details);this.loadPlaylist(o)},E.selectInitialTrack=function(){var l=this.tracksInGroup;console.assert(l.length,"Initial audio track should be selected when tracks are known");var r=this.trackName,s=this.findTrackId(r)||this.findTrackId();s!==-1?this.setAudioTrack(s):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(B.Events.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},E.findTrackId=function(l){for(var r=this.tracksInGroup,s=0;s<r.length;s++){var n=r[s];if((!this.selectDefaultTrack||n.default)&&(!l||l===n.name))return n.id}return-1},E.loadPlaylist=function(l){var r=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(r)){var s=r.id,n=r.groupId,p=r.url;if(l)try{p=l.addDirectives(p)}catch(d){this.warn("Could not construct new URL with HLS Delivery Directives: "+d)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger(B.Events.AUDIO_TRACK_LOADING,{url:p,id:s,groupId:n,deliveryDirectives:l||null})}},_(T,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(l){this.selectDefaultTrack=!1,this.setAudioTrack(l)}}]),T}(L.default);j.default=S},"./src/controller/base-playlist-controller.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"default",function(){return _});var B=D("./src/polyfills/number.ts"),R=D("./src/types/level.ts"),L=D("./src/controller/level-helper.ts"),G=D("./src/utils/logger.ts"),O=D("./src/errors.ts"),_=function(){function A(S,C){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=G.logger.log.bind(G.logger,C+":"),this.warn=G.logger.warn.bind(G.logger,C+":"),this.hls=S}var y=A.prototype;return y.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},y.onError=function(C,T){T.fatal&&T.type===O.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},y.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},y.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},y.stopLoad=function(){this.canLoad=!1,this.clearTimer()},y.switchParams=function(C,T){var E=T==null?void 0:T.renditionReports;if(E)for(var x=0;x<E.length;x++){var l=E[x],r=""+l.URI;if(r===C.substr(-r.length)){var s=parseInt(l["LAST-MSN"]),n=parseInt(l["LAST-PART"]);if(T&&this.hls.config.lowLatencyMode){var p=Math.min(T.age-T.partTarget,T.targetduration);n!==void 0&&p>T.partTarget&&(n+=1)}if(Object(B.isFiniteNumber)(s))return new R.HlsUrlParameters(s,Object(B.isFiniteNumber)(n)?n:void 0,R.HlsSkip.No)}}},y.loadPlaylist=function(C){},y.shouldLoadTrack=function(C){return this.canLoad&&C&&!!C.url&&(!C.details||C.details.live)},y.playlistLoaded=function(C,T,E){var x=this,l=T.details,r=T.stats,s=r.loading.end?Math.max(0,self.performance.now()-r.loading.end):0;if(l.advancedDateTime=Date.now()-s,l.live||E!=null&&E.live){if(l.reloaded(E),E&&this.log("live playlist "+C+" "+(l.advanced?"REFRESHED "+l.lastPartSn+"-"+l.lastPartIndex:"MISSED")),E&&l.fragments.length>0&&Object(L.mergeDetails)(E,l),!this.canLoad||!l.live)return;var n,p=void 0,d=void 0;if(l.canBlockReload&&l.endSN&&l.advanced){var c=this.hls.config.lowLatencyMode,b=l.lastPartSn,f=l.endSN,u=l.lastPartIndex,o=u!==-1,a=b===f,i=c?0:u;o?(p=a?f+1:b,d=a?i:u+1):p=f+1;var v=l.age,g=v+l.ageHeader,m=Math.min(g-l.partTarget,l.targetduration*1.5);if(m>0){if(E&&m>E.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+E.tuneInGoal+" to: "+m+" with playlist age: "+l.age),m=0;else{var w=Math.floor(m/l.targetduration);if(p+=w,d!==void 0){var P=Math.round(m%l.targetduration/l.partTarget);d+=P}this.log("CDN Tune-in age: "+l.ageHeader+"s last advanced "+v.toFixed(2)+"s goal: "+m+" skip sn "+w+" to part "+d)}l.tuneInGoal=m}if(n=this.getDeliveryDirectives(l,T.deliveryDirectives,p,d),c||!a){this.loadPlaylist(n);return}}else n=this.getDeliveryDirectives(l,T.deliveryDirectives,p,d);var N=Object(L.computeReloadInterval)(l,r);p!==void 0&&l.canBlockReload&&(N-=l.partTarget||1),this.log("reload live playlist "+C+" in "+Math.round(N)+" ms"),this.timer=self.setTimeout(function(){return x.loadPlaylist(n)},N)}else this.clearTimer()},y.getDeliveryDirectives=function(C,T,E,x){var l=Object(R.getSkipValue)(C,E);return T!=null&&T.skip&&C.deltaUpdateFailed&&(E=T.msn,x=T.part,l=R.HlsSkip.No),new R.HlsUrlParameters(E,x,l)},y.retryLoadingOrFail=function(C){var T=this,E=this.hls.config,x=this.retryCount<E.levelLoadingMaxRetry;if(x){var l;if(this.retryCount++,C.details.indexOf("LoadTimeOut")>-1&&(l=C.context)!==null&&l!==void 0&&l.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+C.details+'"'),this.loadPlaylist();else{var r=Math.min(Math.pow(2,this.retryCount)*E.levelLoadingRetryDelay,E.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return T.loadPlaylist()},r),this.warn("retry playlist loading #"+this.retryCount+" in "+r+' ms after "'+C.details+'"')}}else this.warn('cannot recover from error "'+C.details+'"'),this.clearTimer(),C.fatal=!0;return x},A}()},"./src/controller/base-stream-controller.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"State",function(){return f}),D.d(j,"default",function(){return u});var B=D("./src/polyfills/number.ts"),R=D("./src/task-loop.ts"),L=D("./src/controller/fragment-tracker.ts"),G=D("./src/utils/buffer-helper.ts"),O=D("./src/utils/logger.ts"),_=D("./src/events.ts"),A=D("./src/errors.ts"),y=D("./src/types/transmuxer.ts"),S=D("./src/utils/mp4-tools.ts"),C=D("./src/utils/discontinuities.ts"),T=D("./src/controller/fragment-finders.ts"),E=D("./src/controller/level-helper.ts"),x=D("./src/loader/fragment-loader.ts"),l=D("./src/crypt/decrypter.ts"),r=D("./src/utils/time-ranges.ts"),s=D("./src/types/loader.ts");function n(o,a){for(var i=0;i<a.length;i++){var v=a[i];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(o,v.key,v)}}function p(o,a,i){return a&&n(o.prototype,a),i&&n(o,i),o}function d(o){if(o===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return o}function c(o,a){o.prototype=Object.create(a.prototype),o.prototype.constructor=o,b(o,a)}function b(o,a){return b=Object.setPrototypeOf||function(v,g){return v.__proto__=g,v},b(o,a)}var f={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",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},u=function(o){c(a,o);function a(v,g,m){var w;return w=o.call(this)||this,w.hls=void 0,w.fragPrevious=null,w.fragCurrent=null,w.fragmentTracker=void 0,w.transmuxer=null,w._state=f.STOPPED,w.media=void 0,w.mediaBuffer=void 0,w.config=void 0,w.bitrateTest=!1,w.lastCurrentTime=0,w.nextLoadPosition=0,w.startPosition=0,w.loadedmetadata=!1,w.fragLoadError=0,w.retryDate=0,w.levels=null,w.fragmentLoader=void 0,w.levelLastLoaded=null,w.startFragRequested=!1,w.decrypter=void 0,w.initPTS=[],w.onvseeking=null,w.onvended=null,w.logPrefix="",w.log=void 0,w.warn=void 0,w.logPrefix=m,w.log=O.logger.log.bind(O.logger,m+":"),w.warn=O.logger.warn.bind(O.logger,m+":"),w.hls=v,w.fragmentLoader=new x.default(v.config),w.fragmentTracker=g,w.config=v.config,w.decrypter=new l.default(v,v.config),v.on(_.Events.KEY_LOADED,w.onKeyLoaded,d(w)),w}var i=a.prototype;return i.doTick=function(){this.onTickEnd()},i.onTickEnd=function(){},i.startLoad=function(g){},i.stopLoad=function(){this.fragmentLoader.abort();var g=this.fragCurrent;g&&this.fragmentTracker.removeFragment(g),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=f.STOPPED},i._streamEnded=function(g,m){var w=this.fragCurrent,P=this.fragmentTracker;if(!m.live&&w&&w.sn===m.endSN&&!g.nextStart){var N=P.getState(w);return N===L.FragmentState.PARTIAL||N===L.FragmentState.OK}return!1},i.onMediaAttached=function(g,m){var w=this.media=this.mediaBuffer=m.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),w.addEventListener("seeking",this.onvseeking),w.addEventListener("ended",this.onvended);var P=this.config;this.levels&&P.autoStartLoad&&this.state===f.STOPPED&&this.startLoad(P.startPosition)},i.onMediaDetaching=function(){var g=this.media;g!=null&&g.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),g&&(g.removeEventListener("seeking",this.onvseeking),g.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},i.onMediaSeeking=function(){var g=this.config,m=this.fragCurrent,w=this.media,P=this.mediaBuffer,N=this.state,K=w?w.currentTime:0,Y=G.BufferHelper.bufferInfo(P||w,K,g.maxBufferHole);if(this.log("media seeking to "+(Object(B.isFiniteNumber)(K)?K.toFixed(3):K)+", state: "+N),N===f.ENDED)this.resetLoadingState();else if(m&&!Y.len){var ne=g.maxFragLookUpTolerance,q=m.start-ne,se=m.start+m.duration+ne,fe=K>se;(K<q||fe)&&(fe&&m.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),m.loader.abort()),this.resetLoadingState())}w&&(this.lastCurrentTime=K),!this.loadedmetadata&&!Y.len&&(this.nextLoadPosition=this.startPosition=K),this.tickImmediate()},i.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},i.onKeyLoaded=function(g,m){if(this.state!==f.KEY_LOADING||m.frag!==this.fragCurrent||!this.levels)return;this.state=f.IDLE;var w=this.levels[m.frag.level].details;w&&this.loadFragment(m.frag,w,m.frag.start)},i.onHandlerDestroying=function(){this.stopLoad(),o.prototype.onHandlerDestroying.call(this)},i.onHandlerDestroyed=function(){this.state=f.STOPPED,this.hls.off(_.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,o.prototype.onHandlerDestroyed.call(this)},i.loadKey=function(g,m){this.log("Loading key for "+g.sn+" of ["+m.startSN+"-"+m.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+g.level),this.state=f.KEY_LOADING,this.fragCurrent=g,this.hls.trigger(_.Events.KEY_LOADING,{frag:g})},i.loadFragment=function(g,m,w){this._loadFragForPlayback(g,m,w)},i._loadFragForPlayback=function(g,m,w){var P=this,N=function(Y){if(P.fragContextChanged(g)){P.warn("Fragment "+g.sn+(Y.part?" p: "+Y.part.index:"")+" of level "+g.level+" was dropped during download."),P.fragmentTracker.removeFragment(g);return}g.stats.chunkCount++,P._handleFragmentLoadProgress(Y)};this._doFragLoad(g,m,w,N).then(function(K){if(!K)return;P.fragLoadError=0;var Y=P.state;if(P.fragContextChanged(g)){(Y===f.FRAG_LOADING||Y===f.BACKTRACKING||!P.fragCurrent&&Y===f.PARSING)&&(P.fragmentTracker.removeFragment(g),P.state=f.IDLE);return}if("payload"in K&&(P.log("Loaded fragment "+g.sn+" of level "+g.level),P.hls.trigger(_.Events.FRAG_LOADED,K),P.state===f.BACKTRACKING)){P.fragmentTracker.backtrack(g,K),P.resetFragmentLoading(g);return}P._handleFragmentLoadComplete(K)}).catch(function(K){P.warn(K),P.resetFragmentLoading(g)})},i.flushMainBuffer=function(g,m,w){if(w===void 0&&(w=null),!(g-m))return;var P={startOffset:g,endOffset:m,type:w};this.fragLoadError=0,this.hls.trigger(_.Events.BUFFER_FLUSHING,P)},i._loadInitSegment=function(g){var m=this;this._doFragLoad(g).then(function(w){if(!w||m.fragContextChanged(g)||!m.levels)throw new Error("init load aborted");return w}).then(function(w){var P=m.hls,N=w.payload,K=g.decryptdata;if(N&&N.byteLength>0&&K&&K.key&&K.iv&&K.method==="AES-128"){var Y=self.performance.now();return m.decrypter.webCryptoDecrypt(new Uint8Array(N),K.key.buffer,K.iv.buffer).then(function(ne){var q=self.performance.now();return P.trigger(_.Events.FRAG_DECRYPTED,{frag:g,payload:ne,stats:{tstart:Y,tdecrypt:q}}),w.payload=ne,w})}return w}).then(function(w){var P=m.fragCurrent,N=m.hls,K=m.levels;if(!K)throw new Error("init load aborted, missing levels");var Y=K[g.level].details;console.assert(Y,"Level details are defined when init segment is loaded");var ne=g.stats;m.state=f.IDLE,m.fragLoadError=0,g.data=new Uint8Array(w.payload),ne.parsing.start=ne.buffering.start=self.performance.now(),ne.parsing.end=ne.buffering.end=self.performance.now(),w.frag===P&&N.trigger(_.Events.FRAG_BUFFERED,{stats:ne,frag:P,part:null,id:g.type}),m.tick()}).catch(function(w){m.warn(w),m.resetFragmentLoading(g)})},i.fragContextChanged=function(g){var m=this.fragCurrent;return!g||!m||g.level!==m.level||g.sn!==m.sn||g.urlId!==m.urlId},i.fragBufferedComplete=function(g,m){var w=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+g.type+" sn: "+g.sn+(m?" part: "+m.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+g.level+" "+r.default.toString(G.BufferHelper.getBuffered(w))),this.state=f.IDLE,this.tick()},i._handleFragmentLoadComplete=function(g){var m=this.transmuxer;if(!m)return;var w=g.frag,P=g.part,N=g.partsLoaded,K=!N||N.length===0||N.some(function(ne){return!ne}),Y=new y.ChunkMetadata(w.level,w.sn,w.stats.chunkCount+1,0,P?P.index:-1,!K);m.flush(Y)},i._handleFragmentLoadProgress=function(g){},i._doFragLoad=function(g,m,w,P){var N=this;if(w===void 0&&(w=null),!this.levels)throw new Error("frag load aborted, missing levels");if(w=Math.max(g.start,w||0),this.config.lowLatencyMode&&m){var K=m.partList;if(K&&P){w>g.end&&m.fragmentHint&&(g=m.fragmentHint);var Y=this.getNextPart(K,g,w);if(Y>-1){var ne=K[Y];return this.log("Loading part sn: "+g.sn+" p: "+ne.index+" cc: "+g.cc+" of playlist ["+m.startSN+"-"+m.endSN+"] parts [0-"+Y+"-"+(K.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(w.toFixed(3))),this.nextLoadPosition=ne.start+ne.duration,this.state=f.FRAG_LOADING,this.hls.trigger(_.Events.FRAG_LOADING,{frag:g,part:K[Y],targetBufferTime:w}),this.doFragPartsLoad(g,K,Y,P).catch(function(q){return N.handleFragLoadError(q)})}else if(!g.url||this.loadedEndOfParts(K,w))return Promise.resolve(null)}}return this.log("Loading fragment "+g.sn+" cc: "+g.cc+" "+(m?"of ["+m.startSN+"-"+m.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(w.toFixed(3))),Object(B.isFiniteNumber)(g.sn)&&!this.bitrateTest&&(this.nextLoadPosition=g.start+g.duration),this.state=f.FRAG_LOADING,this.hls.trigger(_.Events.FRAG_LOADING,{frag:g,targetBufferTime:w}),this.fragmentLoader.load(g,P).catch(function(q){return N.handleFragLoadError(q)})},i.doFragPartsLoad=function(g,m,w,P){var N=this;return new Promise(function(K,Y){var ne=[],q=function se(fe){var le=m[fe];N.fragmentLoader.loadPart(g,le,P).then(function(ve){ne[le.index]=ve;var Se=ve.part;N.hls.trigger(_.Events.FRAG_LOADED,ve);var ke=m[fe+1];if(ke&&ke.fragment===g)se(fe+1);else return K({frag:g,part:Se,partsLoaded:ne})}).catch(Y)};q(w)})},i.handleFragLoadError=function(g){var m=g.data;return m&&m.details===A.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(m.frag,m.part):this.hls.trigger(_.Events.ERROR,m),null},i._handleTransmuxerFlush=function(g){var m=this.getCurrentContext(g);if(!m||this.state!==f.PARSING){this.fragCurrent||(this.state=f.IDLE);return}var w=m.frag,P=m.part,N=m.level,K=self.performance.now();w.stats.parsing.end=K,P&&(P.stats.parsing.end=K),this.updateLevelTiming(w,P,N,g.partial)},i.getCurrentContext=function(g){var m=this.levels,w=g.level,P=g.sn,N=g.part;if(!m||!m[w])return this.warn("Levels object was unset while buffering fragment "+P+" of level "+w+". The current chunk will not be buffered."),null;var K=m[w],Y=N>-1?Object(E.getPartWith)(K,P,N):null,ne=Y?Y.fragment:Object(E.getFragmentWithSN)(K,P,this.fragCurrent);return ne?{frag:ne,part:Y,level:K}:null},i.bufferFragmentData=function(g,m,w,P){if(!g||this.state!==f.PARSING)return;var N=g.data1,K=g.data2,Y=N;if(N&&K&&(Y=Object(S.appendUint8Array)(N,K)),!Y||!Y.length)return;var ne={type:g.type,frag:m,part:w,chunkMeta:P,parent:m.type,data:Y};this.hls.trigger(_.Events.BUFFER_APPENDING,ne),g.dropped&&g.independent&&!w&&this.flushBufferGap(m)},i.flushBufferGap=function(g){var m=this.media;if(!m)return;if(!G.BufferHelper.isBuffered(m,m.currentTime)){this.flushMainBuffer(0,g.start);return}var w=m.currentTime,P=G.BufferHelper.bufferInfo(m,w,0),N=g.duration,K=Math.min(this.config.maxFragLookUpTolerance*2,N*.25),Y=Math.max(Math.min(g.start-K,P.end-K),w+K);g.start-Y>K&&this.flushMainBuffer(Y,g.start)},i.getFwdBufferInfo=function(g,m){var w=this.config,P=this.getLoadPosition();if(!Object(B.isFiniteNumber)(P))return null;var N=G.BufferHelper.bufferInfo(g,P,w.maxBufferHole);if(N.len===0&&N.nextStart!==void 0){var K=this.fragmentTracker.getBufferedFrag(P,m);if(K&&N.nextStart<K.end)return G.BufferHelper.bufferInfo(g,P,Math.max(N.nextStart,w.maxBufferHole))}return N},i.getMaxBufferLength=function(g){var m=this.config,w;return g?w=Math.max(8*m.maxBufferSize/g,m.maxBufferLength):w=m.maxBufferLength,Math.min(w,m.maxMaxBufferLength)},i.reduceMaxBufferLength=function(g){var m=this.config,w=g||m.maxBufferLength;return m.maxMaxBufferLength>=w?(m.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+m.maxMaxBufferLength+"s"),!0):!1},i.getNextFragment=function(g,m){var w,P,N=m.fragments,K=N.length;if(!K)return null;var Y=this.config,ne=N[0].start,q;if(m.live){var se=Y.initialLiveManifestSize;if(K<se)return this.warn("Not enough fragments to start playback (have: "+K+", need: "+se+")"),null;!m.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(q=this.getInitialLiveFragment(m,N),this.startPosition=q?this.hls.liveSyncPosition||q.start:g)}else g<=ne&&(q=N[0]);if(!q){var fe=Y.lowLatencyMode?m.partEnd:m.fragmentEnd;q=this.getFragmentAtPosition(g,fe,m)}return(w=q)!==null&&w!==void 0&&w.initSegment&&!((P=q)!==null&&P!==void 0&&P.initSegment.data)&&!this.bitrateTest&&(q=q.initSegment),q},i.getNextPart=function(g,m,w){for(var P=-1,N=!1,K=!0,Y=0,ne=g.length;Y<ne;Y++){var q=g[Y];if(K=K&&!q.independent,P>-1&&w<q.start)break;var se=q.loaded;!se&&(N||q.independent||K)&&q.fragment===m&&(P=Y),N=se}return P},i.loadedEndOfParts=function(g,m){var w=g[g.length-1];return w&&m>w.start&&w.loaded},i.getInitialLiveFragment=function(g,m){var w=this.fragPrevious,P=null;if(w){if(g.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+w.programDateTime),P=Object(T.findFragmentByPDT)(m,w.endProgramDateTime,this.config.maxFragLookUpTolerance)),!P){var N=w.sn+1;if(N>=g.startSN&&N<=g.endSN){var K=m[N-g.startSN];w.cc===K.cc&&(P=K,this.log("Live playlist, switching playlist, load frag with next SN: "+P.sn))}P||(P=Object(T.findFragWithCC)(m,w.cc),P&&this.log("Live playlist, switching playlist, load frag with same CC: "+P.sn))}}else{var Y=this.hls.liveSyncPosition;Y!==null&&(P=this.getFragmentAtPosition(Y,this.bitrateTest?g.fragmentEnd:g.edge,g))}return P},i.getFragmentAtPosition=function(g,m,w){var P=this.config,N=this.fragPrevious,K=w.fragments,Y=w.endSN,ne=w.fragmentHint,q=P.maxFragLookUpTolerance,se=!!(P.lowLatencyMode&&w.partList&&ne);se&&ne&&!this.bitrateTest&&(K=K.concat(ne),Y=ne.sn);var fe;if(g<m){var le=g>m-q?0:q;fe=Object(T.findFragmentByPTS)(N,K,g,le)}else fe=K[K.length-1];if(fe){var ve=fe.sn-w.startSN,Se=N&&fe.level===N.level,ke=K[ve+1],Ce=this.fragmentTracker.getState(fe);if(Ce===L.FragmentState.BACKTRACKED){fe=null;for(var Le=ve;K[Le]&&this.fragmentTracker.getState(K[Le])===L.FragmentState.BACKTRACKED;)N?fe=K[Le--]:fe=K[--Le];fe||(fe=ke)}else N&&fe.sn===N.sn&&!se&&(Se&&(fe.sn<Y&&this.fragmentTracker.getState(ke)!==L.FragmentState.OK?(this.log("SN "+fe.sn+" just loaded, load next one: "+ke.sn),fe=ke):fe=null))}return fe},i.synchronizeToLiveEdge=function(g){var m=this.config,w=this.media;if(!w)return;var P=this.hls.liveSyncPosition,N=w.currentTime,K=g.fragments[0].start,Y=g.edge,ne=N>=K-m.maxFragLookUpTolerance&&N<=Y;if(P!==null&&w.duration>P&&(N<P||!ne)){var q=m.liveMaxLatencyDuration!==void 0?m.liveMaxLatencyDuration:m.liveMaxLatencyDurationCount*g.targetduration;(!ne&&w.readyState<4||N<Y-q)&&(this.loadedmetadata||(this.nextLoadPosition=P),w.readyState&&(this.warn("Playback: "+N.toFixed(3)+" is located too far from the end of live sliding playlist: "+Y+", reset currentTime to : "+P.toFixed(3)),w.currentTime=P))}},i.alignPlaylists=function(g,m){var w=this.levels,P=this.levelLastLoaded,N=this.fragPrevious,K=P!==null?w[P]:null,Y=g.fragments.length;if(!Y)return this.warn("No fragments in live playlist"),0;var ne=g.fragments[0].start,q=!m,se=g.alignedSliding&&Object(B.isFiniteNumber)(ne);if(q||!se&&!ne){Object(C.alignStream)(N,K,g);var fe=g.fragments[0].start;return this.log("Live playlist sliding: "+fe.toFixed(2)+" start-sn: "+(m?m.startSN:"na")+"->"+g.startSN+" prev-sn: "+(N?N.sn:"na")+" fragments: "+Y),fe}return ne},i.waitForCdnTuneIn=function(g){var m=3;return g.live&&g.canBlockReload&&g.tuneInGoal>Math.max(g.partHoldBack,g.partTarget*m)},i.setStartPosition=function(g,m){var w=this.startPosition;if(w<m&&(w=-1),w===-1||this.lastCurrentTime===-1){var P=g.startTimeOffset;Object(B.isFiniteNumber)(P)?(w=m+P,P<0&&(w+=g.totalduration),w=Math.min(Math.max(m,w),m+g.totalduration),this.log("Start time offset "+P+" found in playlist, adjust startPosition to "+w),this.startPosition=w):g.live?w=this.hls.liveSyncPosition||m:this.startPosition=w=0,this.lastCurrentTime=w}this.nextLoadPosition=w},i.getLoadPosition=function(){var g=this.media,m=0;return this.loadedmetadata&&g?m=g.currentTime:this.nextLoadPosition&&(m=this.nextLoadPosition),m},i.handleFragLoadAborted=function(g,m){this.transmuxer&&g.sn!=="initSegment"&&g.stats.aborted&&(this.warn("Fragment "+g.sn+(m?" part"+m.index:"")+" of level "+g.level+" was aborted"),this.resetFragmentLoading(g))},i.resetFragmentLoading=function(g){(!this.fragCurrent||!this.fragContextChanged(g))&&(this.state=f.IDLE)},i.onFragmentOrKeyLoadError=function(g,m){if(m.fatal)return;var w=m.frag;if(!w||w.type!==g)return;var P=this.fragCurrent;console.assert(P&&w.sn===P.sn&&w.level===P.level&&w.urlId===P.urlId,"Frag load error must match current frag to retry");var N=this.config;if(this.fragLoadError+1<=N.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(w.level))return;var K=Math.min(Math.pow(2,this.fragLoadError)*N.fragLoadingRetryDelay,N.fragLoadingMaxRetryTimeout);this.warn("Fragment "+w.sn+" of "+g+" "+w.level+" failed to load, retrying in "+K+"ms"),this.retryDate=self.performance.now()+K,this.fragLoadError++,this.state=f.FRAG_LOADING_WAITING_RETRY}else m.levelRetry?(g===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=f.IDLE):(O.logger.error(m.details+" reaches max retry, redispatch as fatal ..."),m.fatal=!0,this.hls.stopLoad(),this.state=f.ERROR)},i.afterBufferFlushed=function(g,m,w){if(!g)return;var P=G.BufferHelper.getBuffered(g);this.fragmentTracker.detectEvictedFragments(m,P,w),this.state===f.ENDED&&this.resetLoadingState()},i.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=f.IDLE},i.resetLiveStartWhenNotLoaded=function(g){if(!this.loadedmetadata){this.startFragRequested=!1;var m=this.levels?this.levels[g].details:null;if(m!=null&&m.live)return this.startPosition=-1,this.setStartPosition(m,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},i.updateLevelTiming=function(g,m,w,P){var N=this,K=w.details;console.assert(!!K,"level.details must be defined");var Y=Object.keys(g.elementaryStreams).reduce(function(ne,q){var se=g.elementaryStreams[q];if(se){var fe=se.endPTS-se.startPTS;if(fe<=0)return N.warn("Could not parse fragment "+g.sn+" "+q+" duration reliably ("+fe+") resetting transmuxer to fallback to playlist timing"),N.resetTransmuxer(),ne||!1;var le=P?0:Object(E.updateFragPTSDTS)(K,g,se.startPTS,se.endPTS,se.startDTS,se.endDTS);return N.hls.trigger(_.Events.LEVEL_PTS_UPDATED,{details:K,level:w,drift:le,type:q,frag:g,start:se.startPTS,end:se.endPTS}),!0}return ne},!1);Y?(this.state=f.PARSED,this.hls.trigger(_.Events.FRAG_PARSED,{frag:g,part:m})):this.resetLoadingState()},i.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},p(a,[{key:"state",get:function(){return this._state},set:function(g){var m=this._state;m!==g&&(this._state=g,this.log(m+"->"+g))}}]),a}(R.default)},"./src/controller/buffer-controller.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"default",function(){return T});var B=D("./src/polyfills/number.ts"),R=D("./src/events.ts"),L=D("./src/utils/logger.ts"),G=D("./src/errors.ts"),O=D("./src/utils/buffer-helper.ts"),_=D("./src/utils/mediasource-helper.ts"),A=D("./src/loader/fragment.ts"),y=D("./src/controller/buffer-operation-queue.ts"),S=Object(_.getMediaSource)(),C=/([ha]vc.)(?:\.[^.,]+)+/,T=function(){function E(l){var r=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var s=r.hls,n=r.media,p=r.mediaSource;L.logger.log("[buffer-controller]: Media source opened"),n&&(r.updateMediaElementDuration(),s.trigger(R.Events.MEDIA_ATTACHED,{media:n})),p&&p.removeEventListener("sourceopen",r._onMediaSourceOpen),r.checkPendingTracks()},this._onMediaSourceClose=function(){L.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){L.logger.log("[buffer-controller]: Media source ended")},this.hls=l,this._initSourceBuffer(),this.registerListeners()}var x=E.prototype;return x.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},x.destroy=function(){this.unregisterListeners(),this.details=null},x.registerListeners=function(){var r=this.hls;r.on(R.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),r.on(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.on(R.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.on(R.Events.BUFFER_RESET,this.onBufferReset,this),r.on(R.Events.BUFFER_APPENDING,this.onBufferAppending,this),r.on(R.Events.BUFFER_CODECS,this.onBufferCodecs,this),r.on(R.Events.BUFFER_EOS,this.onBufferEos,this),r.on(R.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),r.on(R.Events.LEVEL_UPDATED,this.onLevelUpdated,this),r.on(R.Events.FRAG_PARSED,this.onFragParsed,this),r.on(R.Events.FRAG_CHANGED,this.onFragChanged,this)},x.unregisterListeners=function(){var r=this.hls;r.off(R.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),r.off(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.off(R.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.off(R.Events.BUFFER_RESET,this.onBufferReset,this),r.off(R.Events.BUFFER_APPENDING,this.onBufferAppending,this),r.off(R.Events.BUFFER_CODECS,this.onBufferCodecs,this),r.off(R.Events.BUFFER_EOS,this.onBufferEos,this),r.off(R.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),r.off(R.Events.LEVEL_UPDATED,this.onLevelUpdated,this),r.off(R.Events.FRAG_PARSED,this.onFragParsed,this),r.off(R.Events.FRAG_CHANGED,this.onFragChanged,this)},x._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new y.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},x.onManifestParsed=function(r,s){var n=2;(s.audio&&!s.video||!s.altAudio)&&(n=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=n,this.details=null,L.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},x.onMediaAttaching=function(r,s){var n=this.media=s.media;if(n&&S){var p=this.mediaSource=new S;p.addEventListener("sourceopen",this._onMediaSourceOpen),p.addEventListener("sourceended",this._onMediaSourceEnded),p.addEventListener("sourceclose",this._onMediaSourceClose),n.src=self.URL.createObjectURL(p),this._objectUrl=n.src}},x.onMediaDetaching=function(){var r=this.media,s=this.mediaSource,n=this._objectUrl;if(s){if(L.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(p){L.logger.warn("[buffer-controller]: onMediaDetaching: "+p.message+" while calling endOfStream")}this.onBufferReset(),s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),r&&(n&&self.URL.revokeObjectURL(n),r.src===n?(r.removeAttribute("src"),r.load()):L.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(R.Events.MEDIA_DETACHED,void 0)},x.onBufferReset=function(){var r=this;this.getSourceBufferTypes().forEach(function(s){var n=r.sourceBuffer[s];try{n&&(r.removeBufferListeners(s),r.mediaSource&&r.mediaSource.removeSourceBuffer(n),r.sourceBuffer[s]=void 0)}catch(p){L.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",p)}}),this._initSourceBuffer()},x.onBufferCodecs=function(r,s){var n=this,p=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(d){if(p){var c=n.tracks[d];if(c&&typeof c.buffer.changeType=="function"){var b=s[d],f=b.codec,u=b.levelCodec,o=b.container,a=(c.levelCodec||c.codec).replace(C,"$1"),i=(u||f).replace(C,"$1");if(a!==i){var v=o+";codecs="+(u||f);n.appendChangeType(d,v)}}}else n.pendingTracks[d]=s[d]}),p)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},x.appendChangeType=function(r,s){var n=this,p=this.operationQueue,d={execute:function(){var b=n.sourceBuffer[r];b&&(L.logger.log("[buffer-controller]: changing "+r+" sourceBuffer type to "+s),b.changeType(s)),p.shiftAndExecuteNext(r)},onStart:function(){},onComplete:function(){},onError:function(b){L.logger.warn("[buffer-controller]: Failed to change "+r+" SourceBuffer type",b)}};p.append(d,r)},x.onBufferAppending=function(r,s){var n=this,p=this.hls,d=this.operationQueue,c=this.tracks,b=s.data,f=s.type,u=s.frag,o=s.part,a=s.chunkMeta,i=a.buffering[f],v=self.performance.now();i.start=v;var g=u.stats.buffering,m=o?o.stats.buffering:null;g.start===0&&(g.start=v),m&&m.start===0&&(m.start=v);var w=c.audio,P=f==="audio"&&a.id===1&&(w==null?void 0:w.container)==="audio/mpeg",N={execute:function(){if(i.executeStart=self.performance.now(),P){var Y=n.sourceBuffer[f];if(Y){var ne=u.start-Y.timestampOffset;Math.abs(ne)>=.1&&(L.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+u.start+" (delta: "+ne+") sn: "+u.sn+")"),Y.timestampOffset=u.start)}}n.appendExecutor(b,f)},onStart:function(){},onComplete:function(){var Y=self.performance.now();i.executeEnd=i.end=Y,g.first===0&&(g.first=Y),m&&m.first===0&&(m.first=Y);var ne=n.sourceBuffer,q={};for(var se in ne)q[se]=O.BufferHelper.getBuffered(ne[se]);n.appendError=0,n.hls.trigger(R.Events.BUFFER_APPENDED,{type:f,frag:u,part:o,chunkMeta:a,parent:u.type,timeRanges:q})},onError:function(Y){L.logger.error("[buffer-controller]: Error encountered while trying to append to the "+f+" SourceBuffer",Y);var ne={type:G.ErrorTypes.MEDIA_ERROR,parent:u.type,details:G.ErrorDetails.BUFFER_APPEND_ERROR,err:Y,fatal:!1};Y.code===DOMException.QUOTA_EXCEEDED_ERR?ne.details=G.ErrorDetails.BUFFER_FULL_ERROR:(n.appendError++,ne.details=G.ErrorDetails.BUFFER_APPEND_ERROR,n.appendError>p.config.appendErrorMaxRetry&&(L.logger.error("[buffer-controller]: Failed "+p.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),ne.fatal=!0)),p.trigger(R.Events.ERROR,ne)}};d.append(N,f)},x.onBufferFlushing=function(r,s){var n=this,p=this.operationQueue,d=function(b){return{execute:n.removeExecutor.bind(n,b,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){n.hls.trigger(R.Events.BUFFER_FLUSHED,{type:b})},onError:function(u){L.logger.warn("[buffer-controller]: Failed to remove from "+b+" SourceBuffer",u)}}};s.type?p.append(d(s.type),s.type):this.getSourceBufferTypes().forEach(function(c){p.append(d(c),c)})},x.onFragParsed=function(r,s){var n=this,p=s.frag,d=s.part,c=[],b=d?d.elementaryStreams:p.elementaryStreams;b[A.ElementaryStreamTypes.AUDIOVIDEO]?c.push("audiovideo"):(b[A.ElementaryStreamTypes.AUDIO]&&c.push("audio"),b[A.ElementaryStreamTypes.VIDEO]&&c.push("video"));var f=function(){var o=self.performance.now();p.stats.buffering.end=o,d&&(d.stats.buffering.end=o);var a=d?d.stats:p.stats;n.hls.trigger(R.Events.FRAG_BUFFERED,{frag:p,part:d,stats:a,id:p.type})};c.length===0&&L.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+p.type+" level: "+p.level+" sn: "+p.sn),this.blockBuffers(f,c)},x.onFragChanged=function(r,s){this.flushBackBuffer()},x.onBufferEos=function(r,s){var n=this,p=this.getSourceBufferTypes().reduce(function(d,c){var b=n.sourceBuffer[c];return(!s.type||s.type===c)&&(b&&!b.ended&&(b.ended=!0,L.logger.log("[buffer-controller]: "+c+" sourceBuffer now EOS"))),d&&!!(!b||b.ended)},!0);p&&this.blockBuffers(function(){var d=n.mediaSource;if(!d||d.readyState!=="open")return;d.endOfStream()})},x.onLevelUpdated=function(r,s){var n=s.details;if(!n.fragments.length)return;this.details=n,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},x.flushBackBuffer=function(){var r=this.hls,s=this.details,n=this.media,p=this.sourceBuffer;if(!n||s===null)return;var d=this.getSourceBufferTypes();if(!d.length)return;var c=s.live&&r.config.liveBackBufferLength!==null?r.config.liveBackBufferLength:r.config.backBufferLength;if(!Object(B.isFiniteNumber)(c)||c<0)return;var b=n.currentTime,f=s.levelTargetDuration,u=Math.max(c,f),o=Math.floor(b/f)*f-u;d.forEach(function(a){var i=p[a];if(i){var v=O.BufferHelper.getBuffered(i);v.length>0&&o>v.start(0)&&(r.trigger(R.Events.BACK_BUFFER_REACHED,{bufferEnd:o}),s.live&&r.trigger(R.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:o}),r.trigger(R.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:o,type:a}))}})},x.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var r=this.details,s=this.hls,n=this.media,p=this.mediaSource,d=r.fragments[0].start+r.totalduration,c=n.duration,b=Object(B.isFiniteNumber)(p.duration)?p.duration:0;r.live&&s.config.liveDurationInfinity?(L.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),p.duration=Infinity,this.updateSeekableRange(r)):(d>b&&d>c||!Object(B.isFiniteNumber)(c))&&(L.logger.log("[buffer-controller]: Updating Media Source duration to "+d.toFixed(3)),p.duration=d)},x.updateSeekableRange=function(r){var s=this.mediaSource,n=r.fragments,p=n.length;if(p&&r.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var d=Math.max(0,n[0].start),c=Math.max(d,d+r.totalduration);s.setLiveSeekableRange(d,c)}},x.checkPendingTracks=function(){var r=this.bufferCodecEventsExpected,s=this.operationQueue,n=this.pendingTracks,p=Object.keys(n).length;if(p&&!r||p===2){this.createSourceBuffers(n),this.pendingTracks={};var d=this.getSourceBufferTypes();if(d.length===0){this.hls.trigger(R.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}d.forEach(function(c){s.executeNext(c)})}},x.createSourceBuffers=function(r){var s=this.sourceBuffer,n=this.mediaSource;if(!n)throw Error("createSourceBuffers called when mediaSource was null");var p=0;for(var d in r)if(!s[d]){var c=r[d];if(!c)throw Error("source buffer exists for track "+d+", however track does not");var b=c.levelCodec||c.codec,f=c.container+";codecs="+b;L.logger.log("[buffer-controller]: creating sourceBuffer("+f+")");try{var u=s[d]=n.addSourceBuffer(f),o=d;this.addBufferListener(o,"updatestart",this._onSBUpdateStart),this.addBufferListener(o,"updateend",this._onSBUpdateEnd),this.addBufferListener(o,"error",this._onSBUpdateError),this.tracks[d]={buffer:u,codec:b,container:c.container,levelCodec:c.levelCodec,id:c.id},p++}catch(a){L.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+a.message),this.hls.trigger(R.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:a,mimeType:f})}}p&&this.hls.trigger(R.Events.BUFFER_CREATED,{tracks:this.tracks})},x._onSBUpdateStart=function(r){var s=this.operationQueue,n=s.current(r);n.onStart()},x._onSBUpdateEnd=function(r){var s=this.operationQueue,n=s.current(r);n.onComplete(),s.shiftAndExecuteNext(r)},x._onSBUpdateError=function(r,s){L.logger.error("[buffer-controller]: "+r+" SourceBuffer error",s),this.hls.trigger(R.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var n=this.operationQueue.current(r);n&&n.onError(s)},x.removeExecutor=function(r,s,n){var p=this.media,d=this.mediaSource,c=this.operationQueue,b=this.sourceBuffer,f=b[r];if(!p||!d||!f){L.logger.warn("[buffer-controller]: Attempting to remove from the "+r+" SourceBuffer, but it does not exist"),c.shiftAndExecuteNext(r);return}var u=Object(B.isFiniteNumber)(p.duration)?p.duration:Infinity,o=Object(B.isFiniteNumber)(d.duration)?d.duration:Infinity,a=Math.max(0,s),i=Math.min(n,u,o);i>a?(L.logger.log("[buffer-controller]: Removing ["+a+","+i+"] from the "+r+" SourceBuffer"),console.assert(!f.updating,r+" sourceBuffer must not be updating"),f.remove(a,i)):c.shiftAndExecuteNext(r)},x.appendExecutor=function(r,s){var n=this.operationQueue,p=this.sourceBuffer,d=p[s];if(!d){L.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),n.shiftAndExecuteNext(s);return}d.ended=!1,console.assert(!d.updating,s+" sourceBuffer must not be updating"),d.appendBuffer(r)},x.blockBuffers=function(r,s){var n=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){L.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(r);return}var p=this.operationQueue,d=s.map(function(c){return p.appendBlocker(c)});Promise.all(d).then(function(){r(),s.forEach(function(c){var b=n.sourceBuffer[c];(!b||!b.updating)&&p.shiftAndExecuteNext(c)})})},x.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},x.addBufferListener=function(r,s,n){var p=this.sourceBuffer[r];if(!p)return;var d=n.bind(this,r);this.listeners[r].push({event:s,listener:d}),p.addEventListener(s,d)},x.removeBufferListeners=function(r){var s=this.sourceBuffer[r];if(!s)return;this.listeners[r].forEach(function(n){s.removeEventListener(n.event,n.listener)})},E}()},"./src/controller/buffer-operation-queue.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"default",function(){return R});var B=D("./src/utils/logger.ts"),R=function(){function L(O){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=O}var G=L.prototype;return G.append=function(_,A){var y=this.queues[A];y.push(_),y.length===1&&this.buffers[A]&&this.executeNext(A)},G.insertAbort=function(_,A){var y=this.queues[A];y.unshift(_),this.executeNext(A)},G.appendBlocker=function(_){var A,y=new Promise(function(C){A=C}),S={execute:A,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(S,_),y},G.executeNext=function(_){var A=this.buffers,y=this.queues,S=A[_],C=y[_];if(C.length){var T=C[0];try{T.execute()}catch(E){B.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),T.onError(E),(!S||!S.updating)&&(C.shift(),this.executeNext(_))}}},G.shiftAndExecuteNext=function(_){this.queues[_].shift(),this.executeNext(_)},G.current=function(_){return this.queues[_][0]},L}()},"./src/controller/cap-level-controller.ts":function(he,j,D){"use strict";D.r(j);var B=D("./src/events.ts");function R(O,_){for(var A=0;A<_.length;A++){var y=_[A];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(O,y.key,y)}}function L(O,_,A){return _&&R(O.prototype,_),A&&R(O,A),O}var G=function(){function O(A){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=A,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var _=O.prototype;return _.setStreamController=function(y){this.streamController=y},_.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},_.registerListeners=function(){var y=this.hls;y.on(B.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.on(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.on(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.on(B.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},_.unregisterListener=function(){var y=this.hls;y.off(B.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.off(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.off(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.off(B.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},_.onFpsDropLevelCapping=function(y,S){O.isLevelAllowed(S.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(S.droppedLevel)},_.onMediaAttaching=function(y,S){this.media=S.media instanceof HTMLVideoElement?S.media:null},_.onManifestParsed=function(y,S){var C=this.hls;this.restrictedLevels=[],this.firstLevel=S.firstLevel,C.config.capLevelToPlayerSize&&S.video&&this.startCapping()},_.onBufferCodecs=function(y,S){var C=this.hls;C.config.capLevelToPlayerSize&&S.video&&this.startCapping()},_.onMediaDetaching=function(){this.stopCapping()},_.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var y=this.hls.levels;if(y.length){var S=this.hls;S.autoLevelCapping=this.getMaxLevel(y.length-1),S.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=S.autoLevelCapping}}},_.getMaxLevel=function(y){var S=this,C=this.hls.levels;if(!C.length)return-1;var T=C.filter(function(E,x){return O.isLevelAllowed(x,S.restrictedLevels)&&x<=y});return this.clientRect=null,O.getMaxLevelByMediaSize(T,this.mediaWidth,this.mediaHeight)},_.startCapping=function(){if(this.timer)return;this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize()},_.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},_.getDimensions=function(){if(this.clientRect)return this.clientRect;var y=this.media,S={width:0,height:0};if(y){var C=y.getBoundingClientRect();S.width=C.width,S.height=C.height,!S.width&&!S.height&&(S.width=C.right-C.left||y.width||0,S.height=C.bottom-C.top||y.height||0)}return this.clientRect=S,S},O.isLevelAllowed=function(y,S){return S===void 0&&(S=[]),S.indexOf(y)===-1},O.getMaxLevelByMediaSize=function(y,S,C){if(!y||!y.length)return-1;for(var T=function(s,n){return n?s.width!==n.width||s.height!==n.height:!0},E=y.length-1,x=0;x<y.length;x+=1){var l=y[x];if((l.width>=S||l.height>=C)&&T(l,y[x+1])){E=x;break}}return E},L(O,[{key:"mediaWidth",get:function(){return this.getDimensions().width*O.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*O.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var y=1;try{y=self.devicePixelRatio}catch(S){}return y}}]),O}();j.default=G},"./src/controller/cmcd-controller.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"default",function(){return T});var B=D("./src/events.ts"),R=D("./src/types/cmcd.ts"),L=D("./src/utils/buffer-helper.ts"),G=D("./src/utils/logger.ts");function O(E,x){for(var l=0;l<x.length;l++){var r=x[l];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(E,r.key,r)}}function _(E,x,l){return x&&O(E.prototype,x),l&&O(E,l),E}function A(E,x){var l=typeof Symbol!="undefined"&&E[Symbol.iterator]||E["@@iterator"];if(l)return(l=l.call(E)).next.bind(l);if(Array.isArray(E)||(l=y(E))||x&&E&&typeof E.length=="number"){l&&(E=l);var r=0;return function(){return r>=E.length?{done:!0}:{done:!1,value:E[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function y(E,x){if(!E)return;if(typeof E=="string")return S(E,x);var l=Object.prototype.toString.call(E).slice(8,-1);if(l==="Object"&&E.constructor&&(l=E.constructor.name),l==="Map"||l==="Set")return Array.from(E);if(l==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l))return S(E,x)}function S(E,x){(x==null||x>E.length)&&(x=E.length);for(var l=0,r=new Array(x);l<x;l++)r[l]=E[l];return r}function C(){return C=Object.assign||function(E){for(var x=1;x<arguments.length;x++){var l=arguments[x];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(E[r]=l[r])}return E},C.apply(this,arguments)}var T=function(){function E(l){var r=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){r.initialized&&(r.starved=!0),r.buffering=!0},this.onPlaying=function(){r.initialized||(r.initialized=!0),r.buffering=!1},this.applyPlaylistData=function(p){try{r.apply(p,{ot:R.CMCDObjectType.MANIFEST,su:!r.initialized})}catch(d){G.logger.warn("Could not generate manifest CMCD data.",d)}},this.applyFragmentData=function(p){try{var d=p.frag,c=r.hls.levels[d.level],b=r.getObjectType(d),f={d:d.duration*1e3,ot:b};(b===R.CMCDObjectType.VIDEO||b===R.CMCDObjectType.AUDIO||b==R.CMCDObjectType.MUXED)&&(f.br=c.bitrate/1e3,f.tb=r.getTopBandwidth(b),f.bl=r.getBufferLength(b)),r.apply(p,f)}catch(u){G.logger.warn("Could not generate segment CMCD data.",u)}},this.hls=l;var s=this.config=l.config,n=s.cmcd;n!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=n.sessionId||E.uuid(),this.cid=n.contentId,this.useHeaders=n.useHeaders===!0,this.registerListeners())}var x=E.prototype;return x.registerListeners=function(){var r=this.hls;r.on(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.on(B.Events.MEDIA_DETACHED,this.onMediaDetached,this),r.on(B.Events.BUFFER_CREATED,this.onBufferCreated,this)},x.unregisterListeners=function(){var r=this.hls;r.off(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.off(B.Events.MEDIA_DETACHED,this.onMediaDetached,this),r.off(B.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},x.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},x.onMediaAttached=function(r,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},x.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},x.onBufferCreated=function(r,s){var n,p;this.audioBuffer=(n=s.tracks.audio)===null||n===void 0?void 0:n.buffer,this.videoBuffer=(p=s.tracks.video)===null||p===void 0?void 0:p.buffer},x.createData=function(){var r;return{v:R.CMCDVersion,sf:R.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(r=this.media)===null||r===void 0?void 0:r.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},x.apply=function(r,s){s===void 0&&(s={}),C(s,this.createData());var n=s.ot===R.CMCDObjectType.INIT||s.ot===R.CMCDObjectType.VIDEO||s.ot===R.CMCDObjectType.MUXED;if(this.starved&&n&&(s.bs=!0,s.su=!0,this.starved=!1),s.su==null&&(s.su=this.buffering),this.useHeaders){var p=E.toHeaders(s);if(!Object.keys(p).length)return;r.headers||(r.headers={}),C(r.headers,p)}else{var d=E.toQuery(s);if(!d)return;r.url=E.appendQueryToUri(r.url,d)}},x.getObjectType=function(r){var s=r.type;return s==="subtitle"?R.CMCDObjectType.TIMED_TEXT:r.sn==="initSegment"?R.CMCDObjectType.INIT:s==="audio"?R.CMCDObjectType.AUDIO:s==="main"?this.hls.audioTracks.length?R.CMCDObjectType.VIDEO:R.CMCDObjectType.MUXED:void 0},x.getTopBandwidth=function(r){for(var s=0,n=r===R.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,p=A(n),d;!(d=p()).done;){var c=d.value;c.bitrate>s&&(s=c.bitrate)}return s>0?s:NaN},x.getBufferLength=function(r){var s=this.hls.media,n=r===R.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!n||!s)return NaN;var p=L.BufferHelper.bufferInfo(n,s.currentTime,this.config.maxBufferHole);return p.len*1e3},x.createPlaylistLoader=function(){var r=this.config.pLoader,s=this.applyPlaylistData,n=r||this.config.loader;return function(){function p(c){this.loader=void 0,this.loader=new n(c)}var d=p.prototype;return d.destroy=function(){this.loader.destroy()},d.abort=function(){this.loader.abort()},d.load=function(b,f,u){s(b),this.loader.load(b,f,u)},_(p,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),p}()},x.createFragmentLoader=function(){var r=this.config.fLoader,s=this.applyFragmentData,n=r||this.config.loader;return function(){function p(c){this.loader=void 0,this.loader=new n(c)}var d=p.prototype;return d.destroy=function(){this.loader.destroy()},d.abort=function(){this.loader.abort()},d.load=function(b,f,u){s(b),this.loader.load(b,f,u)},_(p,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),p}()},E.uuid=function(){var r=URL.createObjectURL(new Blob),s=r.toString();return URL.revokeObjectURL(r),s.substr(s.lastIndexOf("/")+1)},E.serialize=function(r){for(var s=[],n=function(P){return!Number.isNaN(P)&&P!=null&&P!==""&&P!==!1},p=function(P){return Math.round(P)},d=function(P){return p(P/100)*100},c=function(P){return encodeURIComponent(P)},b={br:p,d:p,bl:d,dl:d,mtp:d,nor:c,rtp:d,tb:p},f=Object.keys(r||{}).sort(),u=A(f),o;!(o=u()).done;){var a=o.value,i=r[a];if(!n(i))continue;if(a==="v"&&i===1)continue;if(a=="pr"&&i===1)continue;var v=b[a];v&&(i=v(i));var g=typeof i,m=void 0;a==="ot"||a==="sf"||a==="st"?m=a+"="+i:g==="boolean"?m=a:g==="number"?m=a+"="+i:m=a+"="+JSON.stringify(i),s.push(m)}return s.join(",")},E.toHeaders=function(r){for(var s=Object.keys(r),n={},p=["Object","Request","Session","Status"],d=[{},{},{},{}],c={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},b=0,f=s;b<f.length;b++){var u=f[b],o=c[u]!=null?c[u]:1;d[o][u]=r[u]}for(var a=0;a<d.length;a++){var i=E.serialize(d[a]);i&&(n["CMCD-"+p[a]]=i)}return n},E.toQuery=function(r){return"CMCD="+encodeURIComponent(E.serialize(r))},E.appendQueryToUri=function(r,s){if(!s)return r;var n=r.includes("?")?"&":"?";return""+r+n+s},E}()},"./src/controller/eme-controller.ts":function(he,j,D){"use strict";D.r(j);var B=D("./src/events.ts"),R=D("./src/errors.ts"),L=D("./src/utils/logger.ts"),G=D("./src/utils/mediakeys-helper.ts");function O(T,E){for(var x=0;x<E.length;x++){var l=E[x];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(T,l.key,l)}}function _(T,E,x){return E&&O(T.prototype,E),x&&O(T,x),T}var A=3,y=function(E,x,l){var r={audioCapabilities:[],videoCapabilities:[]};return E.forEach(function(s){r.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:l.audioRobustness||""})}),x.forEach(function(s){r.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:l.videoRobustness||""})}),[r]},S=function(E,x,l,r){switch(E){case G.KeySystems.WIDEVINE:return y(x,l,r);default:throw new Error("Unknown key-system: "+E)}},C=function(){function T(x){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=x,this._config=x.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var E=T.prototype;return E.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},E._registerListeners=function(){this.hls.on(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(B.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(B.Events.MANIFEST_PARSED,this.onManifestParsed,this)},E._unregisterListeners=function(){this.hls.off(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(B.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(B.Events.MANIFEST_PARSED,this.onManifestParsed,this)},E.getLicenseServerUrl=function(l){switch(l){case G.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+l+'"')},E._attemptKeySystemAccess=function(l,r,s){var n=this,p=S(l,r,s,this._drmSystemOptions);L.logger.log("Requesting encrypted media key-system access");var d=this.requestMediaKeySystemAccess(l,p);this.mediaKeysPromise=d.then(function(c){return n._onMediaKeySystemAccessObtained(l,c)}),d.catch(function(c){L.logger.error('Failed to obtain key-system "'+l+'" access:',c)})},E._onMediaKeySystemAccessObtained=function(l,r){var s=this;L.logger.log('Access for key-system "'+l+'" obtained');var n={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:r,mediaKeySystemDomain:l};this._mediaKeysList.push(n);var p=Promise.resolve().then(function(){return r.createMediaKeys()}).then(function(d){return n.mediaKeys=d,L.logger.log('Media-keys created for key-system "'+l+'"'),s._onMediaKeysCreated(),d});return p.catch(function(d){L.logger.error("Failed to create media-keys:",d)}),p},E._onMediaKeysCreated=function(){var l=this;this._mediaKeysList.forEach(function(r){r.mediaKeysSession||(r.mediaKeysSession=r.mediaKeys.createSession(),l._onNewMediaKeySession(r.mediaKeysSession))})},E._onNewMediaKeySession=function(l){var r=this;L.logger.log("New key-system session "+l.sessionId),l.addEventListener("message",function(s){r._onKeySessionMessage(l,s.message)},!1)},E._onKeySessionMessage=function(l,r){L.logger.log("Got EME message event, creating license request"),this._requestLicense(r,function(s){L.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),l.update(s)})},E.onMediaEncrypted=function(l){var r=this;if(L.logger.log('Media is encrypted using "'+l.initDataType+'" init data type'),!this.mediaKeysPromise){L.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(B.Events.ERROR,{type:R.ErrorTypes.KEY_SYSTEM_ERROR,details:R.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(p){if(!r._media)return;r._attemptSetMediaKeys(p),r._generateRequestWithPreferredKeySession(l.initDataType,l.initData)};this.mediaKeysPromise.then(s).catch(s)},E._attemptSetMediaKeys=function(l){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var r=this._mediaKeysList[0];if(!r||!r.mediaKeys){L.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(B.Events.ERROR,{type:R.ErrorTypes.KEY_SYSTEM_ERROR,details:R.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}L.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(r.mediaKeys),this._hasSetMediaKeys=!0}},E._generateRequestWithPreferredKeySession=function(l,r){var s=this,n=this._mediaKeysList[0];if(!n){L.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(B.Events.ERROR,{type:R.ErrorTypes.KEY_SYSTEM_ERROR,details:R.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(n.mediaKeysSessionInitialized){L.logger.warn("Key-Session already initialized but requested again");return}var p=n.mediaKeysSession;if(!p){L.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(B.Events.ERROR,{type:R.ErrorTypes.KEY_SYSTEM_ERROR,details:R.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!r){L.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(B.Events.ERROR,{type:R.ErrorTypes.KEY_SYSTEM_ERROR,details:R.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}L.logger.log('Generating key-session request for "'+l+'" init data type'),n.mediaKeysSessionInitialized=!0,p.generateRequest(l,r).then(function(){L.logger.debug("Key-session generation succeeded")}).catch(function(d){L.logger.error("Error generating key-session request:",d),s.hls.trigger(B.Events.ERROR,{type:R.ErrorTypes.KEY_SYSTEM_ERROR,details:R.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},E._createLicenseXhr=function(l,r,s){var n=new XMLHttpRequest;n.responseType="arraybuffer",n.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,n,l,r,s);var p=this._licenseXhrSetup;if(p)try{p.call(this.hls,n,l),p=void 0}catch(d){L.logger.error(d)}try{n.readyState||n.open("POST",l,!0),p&&p.call(this.hls,n,l)}catch(d){throw new Error("issue setting up KeySystem license XHR "+d)}return n},E._onLicenseRequestReadyStageChange=function(l,r,s,n){switch(l.readyState){case 4:if(l.status===200){this._requestLicenseFailureCount=0,L.logger.log("License request succeeded");var p=l.response,d=this._licenseResponseCallback;if(d)try{p=d.call(this.hls,l,r)}catch(b){L.logger.error(b)}n(p)}else{if(L.logger.error("License Request XHR failed ("+r+"). Status: "+l.status+" ("+l.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>A){this.hls.trigger(B.Events.ERROR,{type:R.ErrorTypes.KEY_SYSTEM_ERROR,details:R.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var c=A-this._requestLicenseFailureCount+1;L.logger.warn("Retrying license request, "+c+" attempts left"),this._requestLicense(s,n)}break}},E._generateLicenseRequestChallenge=function(l,r){switch(l.mediaKeySystemDomain){case G.KeySystems.WIDEVINE:return r}throw new Error("unsupported key-system: "+l.mediaKeySystemDomain)},E._requestLicense=function(l,r){L.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){L.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(B.Events.ERROR,{type:R.ErrorTypes.KEY_SYSTEM_ERROR,details:R.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var n=this.getLicenseServerUrl(s.mediaKeySystemDomain),p=this._createLicenseXhr(n,l,r);L.logger.log("Sending license request to URL: "+n);var d=this._generateLicenseRequestChallenge(s,l);p.send(d)}catch(c){L.logger.error("Failure requesting DRM license: "+c),this.hls.trigger(B.Events.ERROR,{type:R.ErrorTypes.KEY_SYSTEM_ERROR,details:R.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},E.onMediaAttached=function(l,r){if(!this._emeEnabled)return;var s=r.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},E.onMediaDetached=function(){var l=this._media,r=this._mediaKeysList;if(!l)return;l.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(r.map(function(s){if(s.mediaKeysSession)return s.mediaKeysSession.close().catch(function(){})})).then(function(){return l.setMediaKeys(null)}).catch(function(){})},E.onManifestParsed=function(l,r){if(!this._emeEnabled)return;var s=r.levels.map(function(p){return p.audioCodec}).filter(function(p){return!!p}),n=r.levels.map(function(p){return p.videoCodec}).filter(function(p){return!!p});this._attemptKeySystemAccess(G.KeySystems.WIDEVINE,s,n)},_(T,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),T}();j.default=C},"./src/controller/fps-controller.ts":function(he,j,D){"use strict";D.r(j);var B=D("./src/events.ts"),R=D("./src/utils/logger.ts"),L=function(){function G(_){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=_,this.registerListeners()}var O=G.prototype;return O.setStreamController=function(A){this.streamController=A},O.registerListeners=function(){this.hls.on(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},O.unregisterListeners=function(){this.hls.off(B.Events.MEDIA_ATTACHING,this.onMediaAttaching)},O.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},O.onMediaAttaching=function(A,y){var S=this.hls.config;if(S.capLevelOnFPSDrop){var C=y.media instanceof self.HTMLVideoElement?y.media:null;this.media=C,C&&typeof C.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),S.fpsDroppedMonitoringPeriod)}},O.checkFPS=function(A,y,S){var C=performance.now();if(y){if(this.lastTime){var T=C-this.lastTime,E=S-this.lastDroppedFrames,x=y-this.lastDecodedFrames,l=1e3*E/T,r=this.hls;if(r.trigger(B.Events.FPS_DROP,{currentDropped:E,currentDecoded:x,totalDroppedFrames:S}),l>0&&E>r.config.fpsDroppedMonitoringThreshold*x){var s=r.currentLevel;R.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+s),s>0&&(r.autoLevelCapping===-1||r.autoLevelCapping>=s)&&(s=s-1,r.trigger(B.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:r.currentLevel}),r.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=C,this.lastDroppedFrames=S,this.lastDecodedFrames=y}},O.checkFPSInterval=function(){var A=this.media;if(A)if(this.isVideoPlaybackQualityAvailable){var y=A.getVideoPlaybackQuality();this.checkFPS(A,y.totalVideoFrames,y.droppedVideoFrames)}else this.checkFPS(A,A.webkitDecodedFrameCount,A.webkitDroppedFrameCount)},G}();j.default=L},"./src/controller/fragment-finders.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"findFragmentByPDT",function(){return L}),D.d(j,"findFragmentByPTS",function(){return G}),D.d(j,"fragmentWithinToleranceTest",function(){return O}),D.d(j,"pdtWithinToleranceTest",function(){return _}),D.d(j,"findFragWithCC",function(){return A});var B=D("./src/polyfills/number.ts"),R=D("./src/utils/binary-search.ts");function L(y,S,C){if(S===null||!Array.isArray(y)||!y.length||!Object(B.isFiniteNumber)(S))return null;var T=y[0].programDateTime;if(S<(T||0))return null;var E=y[y.length-1].endProgramDateTime;if(S>=(E||0))return null;C=C||0;for(var x=0;x<y.length;++x){var l=y[x];if(_(S,C,l))return l}return null}function G(y,S,C,T){C===void 0&&(C=0),T===void 0&&(T=0);var E=null;if(y?E=S[y.sn-S[0].sn+1]||null:C===0&&S[0].start===0&&(E=S[0]),E&&O(C,T,E)===0)return E;var x=R.default.search(S,O.bind(null,C,T));return x||E}function O(y,S,C){y===void 0&&(y=0),S===void 0&&(S=0);var T=Math.min(S,C.duration+(C.deltaPTS?C.deltaPTS:0));return C.start+C.duration-T<=y?1:C.start-T>y&&C.start?-1:0}function _(y,S,C){var T=Math.min(S,C.duration+(C.deltaPTS?C.deltaPTS:0))*1e3,E=C.endProgramDateTime||0;return E-T>y}function A(y,S){return R.default.search(y,function(C){return C.cc<S?1:C.cc>S?-1:0})}},"./src/controller/fragment-tracker.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"FragmentState",function(){return L}),D.d(j,"FragmentTracker",function(){return G});var B=D("./src/events.ts"),R=D("./src/types/loader.ts"),L;(function(A){A.NOT_LOADED="NOT_LOADED",A.BACKTRACKED="BACKTRACKED",A.APPENDING="APPENDING",A.PARTIAL="PARTIAL",A.OK="OK"})(L||(L={}));var G=function(){function A(S){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=S,this._registerListeners()}var y=A.prototype;return y._registerListeners=function(){var C=this.hls;C.on(B.Events.BUFFER_APPENDED,this.onBufferAppended,this),C.on(B.Events.FRAG_BUFFERED,this.onFragBuffered,this),C.on(B.Events.FRAG_LOADED,this.onFragLoaded,this)},y._unregisterListeners=function(){var C=this.hls;C.off(B.Events.BUFFER_APPENDED,this.onBufferAppended,this),C.off(B.Events.FRAG_BUFFERED,this.onFragBuffered,this),C.off(B.Events.FRAG_LOADED,this.onFragLoaded,this)},y.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},y.getAppendedFrag=function(C,T){if(T===R.PlaylistLevelType.MAIN){var E=this.activeFragment,x=this.activeParts;if(!E)return null;if(x)for(var l=x.length;l--;){var r=x[l],s=r?r.end:E.appendedPTS;if(r.start<=C&&s!==void 0&&C<=s)return l>9&&(this.activeParts=x.slice(l-9)),r}else if(E.start<=C&&E.appendedPTS!==void 0&&C<=E.appendedPTS)return E}return this.getBufferedFrag(C,T)},y.getBufferedFrag=function(C,T){for(var E=this.fragments,x=Object.keys(E),l=x.length;l--;){var r=E[x[l]];if((r==null?void 0:r.body.type)===T&&r.buffered){var s=r.body;if(s.start<=C&&C<=s.end)return s}}return null},y.detectEvictedFragments=function(C,T,E){var x=this;Object.keys(this.fragments).forEach(function(l){var r=x.fragments[l];if(!r)return;if(!r.buffered){r.body.type===E&&x.removeFragment(r.body);return}var s=r.range[C];if(!s)return;s.time.some(function(n){var p=!x.isTimeBuffered(n.startPTS,n.endPTS,T);return p&&x.removeFragment(r.body),p})})},y.detectPartialFragments=function(C){var T=this,E=this.timeRanges,x=C.frag,l=C.part;if(!E||x.sn==="initSegment")return;var r=_(x),s=this.fragments[r];if(!s)return;Object.keys(E).forEach(function(n){var p=x.elementaryStreams[n];if(!p)return;var d=E[n],c=l!==null||p.partial===!0;s.range[n]=T.getBufferedTimes(x,l,c,d)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},y.fragBuffered=function(C){var T=_(C),E=this.fragments[T];E&&(E.backtrack=E.loaded=null,E.buffered=!0)},y.getBufferedTimes=function(C,T,E,x){for(var l={time:[],partial:E},r=T?T.start:C.start,s=T?T.end:C.end,n=C.minEndPTS||s,p=C.maxStartPTS||r,d=0;d<x.length;d++){var c=x.start(d)-this.bufferPadding,b=x.end(d)+this.bufferPadding;if(p>=c&&n<=b){l.time.push({startPTS:Math.max(r,x.start(d)),endPTS:Math.min(s,x.end(d))});break}else if(r<b&&s>c)l.partial=!0,l.time.push({startPTS:Math.max(r,x.start(d)),endPTS:Math.min(s,x.end(d))});else if(s<=c)break}return l},y.getPartialFragment=function(C){var T=null,E,x,l,r=0,s=this.bufferPadding,n=this.fragments;return Object.keys(n).forEach(function(p){var d=n[p];if(!d)return;O(d)&&(x=d.body.start-s,l=d.body.end+s,C>=x&&C<=l&&(E=Math.min(C-x,l-C),r<=E&&(T=d.body,r=E)))}),T},y.getState=function(C){var T=_(C),E=this.fragments[T];return E?E.buffered?O(E)?L.PARTIAL:L.OK:E.backtrack?L.BACKTRACKED:L.APPENDING:L.NOT_LOADED},y.backtrack=function(C,T){var E=_(C),x=this.fragments[E];if(!x||x.backtrack)return null;var l=x.backtrack=T||x.loaded;return x.loaded=null,l},y.getBacktrackData=function(C){var T=_(C),E=this.fragments[T];if(E){var x,l=E.backtrack;if(l!=null&&(x=l.payload)!==null&&x!==void 0&&x.byteLength)return l;this.removeFragment(C)}return null},y.isTimeBuffered=function(C,T,E){for(var x,l,r=0;r<E.length;r++){if(x=E.start(r)-this.bufferPadding,l=E.end(r)+this.bufferPadding,C>=x&&T<=l)return!0;if(T<=x)return!1}return!1},y.onFragLoaded=function(C,T){var E=T.frag,x=T.part;if(E.sn==="initSegment"||E.bitrateTest||x)return;var l=_(E);this.fragments[l]={body:E,loaded:T,backtrack:null,buffered:!1,range:Object.create(null)}},y.onBufferAppended=function(C,T){var E=this,x=T.frag,l=T.part,r=T.timeRanges;if(x.type===R.PlaylistLevelType.MAIN)if(this.activeFragment=x,l){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(l)}else this.activeParts=null;this.timeRanges=r,Object.keys(r).forEach(function(n){var p=r[n];if(E.detectEvictedFragments(n,p),!l)for(var d=0;d<p.length;d++)x.appendedPTS=Math.max(p.end(d),x.appendedPTS||0)})},y.onFragBuffered=function(C,T){this.detectPartialFragments(T)},y.hasFragment=function(C){var T=_(C);return!!this.fragments[T]},y.removeFragmentsInRange=function(C,T,E){var x=this;Object.keys(this.fragments).forEach(function(l){var r=x.fragments[l];if(!r)return;if(r.buffered){var s=r.body;s.type===E&&s.start<T&&s.end>C&&x.removeFragment(s)}})},y.removeFragment=function(C){var T=_(C);C.stats.loaded=0,C.clearElementaryStreamInfo(),delete this.fragments[T]},y.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},A}();function O(A){var y,S;return A.buffered&&(((y=A.range.video)===null||y===void 0?void 0:y.partial)||((S=A.range.audio)===null||S===void 0?void 0:S.partial))}function _(A){return A.type+"_"+A.level+"_"+A.urlId+"_"+A.sn}},"./src/controller/gap-controller.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"STALL_MINIMUM_DURATION_MS",function(){return O}),D.d(j,"MAX_START_GAP_JUMP",function(){return _}),D.d(j,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return A}),D.d(j,"SKIP_BUFFER_RANGE_START",function(){return y}),D.d(j,"default",function(){return S});var B=D("./src/utils/buffer-helper.ts"),R=D("./src/errors.ts"),L=D("./src/events.ts"),G=D("./src/utils/logger.ts"),O=250,_=2,A=.1,y=.05,S=function(){function C(E,x,l,r){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=E,this.media=x,this.fragmentTracker=l,this.hls=r}var T=C.prototype;return T.destroy=function(){this.hls=this.fragmentTracker=this.media=null},T.poll=function(x){var l=this.config,r=this.media,s=this.stalled,n=r.currentTime,p=r.seeking,d=this.seeking&&!p,c=!this.seeking&&p;if(this.seeking=p,n!==x){if(this.moved=!0,s!==null){if(this.stallReported){var b=self.performance.now()-s;G.logger.warn("playback not stuck anymore @"+n+", after "+Math.round(b)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((c||d)&&(this.stalled=null),r.paused||r.ended||r.playbackRate===0||!B.BufferHelper.getBuffered(r).length)return;var f=B.BufferHelper.bufferInfo(r,n,0),u=f.len>0,o=f.nextStart||0;if(!u&&!o)return;if(p){var a=f.len>_,i=!o||o-n>_&&!this.fragmentTracker.getPartialFragment(n);if(a||i)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var v,g=Math.max(o,f.start||0)-n,m=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,w=m==null||((v=m.details)===null||v===void 0)?void 0:v.live,P=w?m.details.targetduration*2:_;if(g>0&&g<=P){this._trySkipBufferHole(null);return}}var N=self.performance.now();if(s===null){this.stalled=N;return}var K=N-s;!p&&K>=O&&this._reportStall(f.len);var Y=B.BufferHelper.bufferInfo(r,n,l.maxBufferHole);this._tryFixBufferStall(Y,K)},T._tryFixBufferStall=function(x,l){var r=this.config,s=this.fragmentTracker,n=this.media,p=n.currentTime,d=s.getPartialFragment(p);if(d){var c=this._trySkipBufferHole(d);if(c)return}x.len>r.maxBufferHole&&l>r.highBufferWatchdogPeriod*1e3&&(G.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},T._reportStall=function(x){var l=this.hls,r=this.media,s=this.stallReported;s||(this.stallReported=!0,G.logger.warn("Playback stalling at @"+r.currentTime+" due to low buffer (buffer="+x+")"),l.trigger(L.Events.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:x}))},T._trySkipBufferHole=function(x){for(var l=this.config,r=this.hls,s=this.media,n=s.currentTime,p=0,d=B.BufferHelper.getBuffered(s),c=0;c<d.length;c++){var b=d.start(c);if(n+l.maxBufferHole>=p&&n<b){var f=Math.max(b+y,s.currentTime+A);return G.logger.warn("skipping hole, adjusting currentTime from "+n+" to "+f),this.moved=!0,this.stalled=null,s.currentTime=f,x&&r.trigger(L.Events.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+n+" to "+f,frag:x}),f}p=d.end(c)}return 0},T._tryNudgeBuffer=function(){var x=this.config,l=this.hls,r=this.media,s=r.currentTime,n=(this.nudgeRetry||0)+1;if(this.nudgeRetry=n,n<x.nudgeMaxRetry){var p=s+n*x.nudgeOffset;G.logger.warn("Nudging 'currentTime' from "+s+" to "+p),r.currentTime=p,l.trigger(L.Events.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else G.logger.error("Playhead still not moving while enough data buffered @"+s+" after "+x.nudgeMaxRetry+" nudges"),l.trigger(L.Events.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},C}()},"./src/controller/id3-track-controller.ts":function(he,j,D){"use strict";D.r(j);var B=D("./src/events.ts"),R=D("./src/utils/texttrack-utils.ts"),L=D("./src/demux/id3.ts"),G=.25,O=function(){function _(y){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=y,this._registerListeners()}var A=_.prototype;return A.destroy=function(){this._unregisterListeners()},A._registerListeners=function(){var S=this.hls;S.on(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),S.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),S.on(B.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),S.on(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},A._unregisterListeners=function(){var S=this.hls;S.off(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),S.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),S.off(B.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),S.off(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},A.onMediaAttached=function(S,C){this.media=C.media},A.onMediaDetaching=function(){if(!this.id3Track)return;Object(R.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},A.getID3Track=function(S){if(!this.media)return;for(var C=0;C<S.length;C++){var T=S[C];if(T.kind==="metadata"&&T.label==="id3")return Object(R.sendAddTrackEvent)(T,this.media),T}return this.media.addTextTrack("metadata","id3")},A.onFragParsingMetadata=function(S,C){if(!this.media)return;var T=C.frag,E=C.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var x=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,l=0;l<E.length;l++){var r=L.getID3Frames(E[l].data);if(r){var s=E[l].pts,n=l<E.length-1?E[l+1].pts:T.end,p=n-s;p<=0&&(n=s+G);for(var d=0;d<r.length;d++){var c=r[d];if(!L.isTimeStampFrame(c)){var b=new x(s,n,"");b.value=c,this.id3Track.addCue(b)}}}}},A.onBufferFlushing=function(S,C){var T=C.startOffset,E=C.endOffset,x=C.type;if(!x||x==="audio"){var l=this.id3Track;l&&Object(R.removeCuesInRange)(l,T,E)}},_}();j.default=O},"./src/controller/latency-controller.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"default",function(){return _});var B=D("./src/errors.ts"),R=D("./src/events.ts"),L=D("./src/utils/logger.ts");function G(A,y){for(var S=0;S<y.length;S++){var C=y[S];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(A,C.key,C)}}function O(A,y,S){return y&&G(A.prototype,y),S&&G(A,S),A}var _=function(){function A(S){var C=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return C.timeupdate()},this.hls=S,this.config=S.config,this.registerListeners()}var y=A.prototype;return y.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},y.registerListeners=function(){this.hls.on(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(R.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(R.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){this.hls.off(R.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(R.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(R.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(R.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(R.Events.ERROR,this.onError)},y.onMediaAttached=function(C,T){this.media=T.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},y.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},y.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},y.onLevelUpdated=function(C,T){var E=T.details;this.levelDetails=E,E.advanced&&this.timeupdate(),!E.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},y.onError=function(C,T){if(T.details!==B.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,L.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},y.timeupdate=function(){var C=this.media,T=this.levelDetails;if(!C||!T)return;this.currentTime=C.currentTime;var E=this.computeLatency();if(E===null)return;this._latency=E;var x=this.config,l=x.lowLatencyMode,r=x.maxLiveSyncPlaybackRate;if(!l||r===1)return;var s=this.targetLatency;if(s===null)return;var n=E-s,p=Math.min(this.maxLatency,s+T.targetduration),d=n<p;if(T.live&&d&&n>.05&&this.forwardBufferLength>1){var c=Math.min(2,Math.max(1,r)),b=Math.round(2/(1+Math.exp(-.75*n-this.edgeStalled))*20)/20;C.playbackRate=Math.min(c,Math.max(1,b))}else C.playbackRate!==1&&C.playbackRate!==0&&(C.playbackRate=1)},y.estimateLiveEdge=function(){var C=this.levelDetails;return C===null?null:C.edge+C.age},y.computeLatency=function(){var C=this.estimateLiveEdge();return C===null?null:C-this.currentTime},O(A,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var C=this.config,T=this.levelDetails;return C.liveMaxLatencyDuration!==void 0?C.liveMaxLatencyDuration:T?C.liveMaxLatencyDurationCount*T.targetduration:0}},{key:"targetLatency",get:function(){var C=this.levelDetails;if(C===null)return null;var T=C.holdBack,E=C.partHoldBack,x=C.targetduration,l=this.config,r=l.liveSyncDuration,s=l.liveSyncDurationCount,n=l.lowLatencyMode,p=this.hls.userConfig,d=n&&E||T;(p.liveSyncDuration||p.liveSyncDurationCount||d===0)&&(d=r!==void 0?r:s*x);var c=x,b=1;return d+Math.min(this.stallCount*b,c)}},{key:"liveSyncPosition",get:function(){var C=this.estimateLiveEdge(),T=this.targetLatency,E=this.levelDetails;if(C===null||T===null||E===null)return null;var x=E.edge,l=C-T-this.edgeStalled,r=x-E.totalduration,s=x-(this.config.lowLatencyMode&&E.partTarget||E.targetduration);return Math.min(Math.max(r,l),s)}},{key:"drift",get:function(){var C=this.levelDetails;return C===null?1:C.drift}},{key:"edgeStalled",get:function(){var C=this.levelDetails;if(C===null)return 0;var T=(this.config.lowLatencyMode&&C.partTarget||C.targetduration)*3;return Math.max(C.age-T,0)}},{key:"forwardBufferLength",get:function(){var C=this.media,T=this.levelDetails;if(!C||!T)return 0;var E=C.buffered.length;return E?C.buffered.end(E-1):T.edge-this.currentTime}}]),A}()},"./src/controller/level-controller.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"default",function(){return l});var B=D("./src/types/level.ts"),R=D("./src/events.ts"),L=D("./src/errors.ts"),G=D("./src/utils/codecs.ts"),O=D("./src/controller/level-helper.ts"),_=D("./src/controller/base-playlist-controller.ts"),A=D("./src/types/loader.ts");function y(){return y=Object.assign||function(r){for(var s=1;s<arguments.length;s++){var n=arguments[s];for(var p in n)Object.prototype.hasOwnProperty.call(n,p)&&(r[p]=n[p])}return r},y.apply(this,arguments)}function S(r,s){for(var n=0;n<s.length;n++){var p=s[n];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(r,p.key,p)}}function C(r,s,n){return s&&S(r.prototype,s),n&&S(r,n),r}function T(r,s){r.prototype=Object.create(s.prototype),r.prototype.constructor=r,E(r,s)}function E(r,s){return E=Object.setPrototypeOf||function(p,d){return p.__proto__=d,p},E(r,s)}var x=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),l=function(r){T(s,r);function s(p){var d;return d=r.call(this,p,"[level-controller]")||this,d._levels=[],d._firstLevel=-1,d._startLevel=void 0,d.currentLevelIndex=-1,d.manualLevelIndex=-1,d.onParsedComplete=void 0,d._registerListeners(),d}var n=s.prototype;return n._registerListeners=function(){var d=this.hls;d.on(R.Events.MANIFEST_LOADED,this.onManifestLoaded,this),d.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(R.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),d.on(R.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(R.Events.ERROR,this.onError,this)},n._unregisterListeners=function(){var d=this.hls;d.off(R.Events.MANIFEST_LOADED,this.onManifestLoaded,this),d.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(R.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),d.off(R.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(R.Events.ERROR,this.onError,this)},n.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,r.prototype.destroy.call(this)},n.startLoad=function(){var d=this._levels;d.forEach(function(c){c.loadError=0}),r.prototype.startLoad.call(this)},n.onManifestLoaded=function(d,c){var b=[],f=[],u=[],o,a={},i,v=!1,g=!1,m=!1;if(c.levels.forEach(function(K){var Y=K.attrs;v=v||!!(K.width&&K.height),g=g||!!K.videoCodec,m=m||!!K.audioCodec,x&&K.audioCodec&&K.audioCodec.indexOf("mp4a.40.34")!==-1&&(K.audioCodec=void 0);var ne=K.bitrate+"-"+K.attrs.RESOLUTION+"-"+K.attrs.CODECS;i=a[ne],i?i.url.push(K.url):(i=new B.Level(K),a[ne]=i,b.push(i)),Y&&(Y.AUDIO&&Object(O.addGroupId)(i,"audio",Y.AUDIO),Y.SUBTITLES&&Object(O.addGroupId)(i,"text",Y.SUBTITLES))}),(v||g)&&m&&(b=b.filter(function(K){var Y=K.videoCodec,ne=K.width,q=K.height;return!!Y||!!(ne&&q)})),b=b.filter(function(K){var Y=K.audioCodec,ne=K.videoCodec;return(!Y||Object(G.isCodecSupportedInMp4)(Y,"audio"))&&(!ne||Object(G.isCodecSupportedInMp4)(ne,"video"))}),c.audioTracks&&(f=c.audioTracks.filter(function(K){return!K.audioCodec||Object(G.isCodecSupportedInMp4)(K.audioCodec,"audio")}),Object(O.assignTrackIdsByGroup)(f)),c.subtitles&&(u=c.subtitles,Object(O.assignTrackIdsByGroup)(u)),b.length>0){o=b[0].bitrate,b.sort(function(K,Y){return K.bitrate-Y.bitrate}),this._levels=b;for(var w=0;w<b.length;w++)if(b[w].bitrate===o){this._firstLevel=w,this.log("manifest loaded, "+b.length+" level(s) found, first bitrate: "+o);break}var P=m&&!g,N={levels:b,audioTracks:f,subtitleTracks:u,firstLevel:this._firstLevel,stats:c.stats,audio:m,video:g,altAudio:!P&&f.some(function(K){return!!K.url})};this.hls.trigger(R.Events.MANIFEST_PARSED,N),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(R.Events.ERROR,{type:L.ErrorTypes.MEDIA_ERROR,details:L.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:c.url,reason:"no level with compatible codecs found in manifest"})},n.onError=function(d,c){if(r.prototype.onError.call(this,d,c),c.fatal)return;var b=c.context,f=this._levels[this.currentLevelIndex];if(b&&(b.type===A.PlaylistContextType.AUDIO_TRACK&&f.audioGroupIds&&b.groupId===f.audioGroupIds[f.urlId]||b.type===A.PlaylistContextType.SUBTITLE_TRACK&&f.textGroupIds&&b.groupId===f.textGroupIds[f.urlId])){this.redundantFailover(this.currentLevelIndex);return}var u=!1,o=!0,a;switch(c.details){case L.ErrorDetails.FRAG_LOAD_ERROR:case L.ErrorDetails.FRAG_LOAD_TIMEOUT:case L.ErrorDetails.KEY_LOAD_ERROR:case L.ErrorDetails.KEY_LOAD_TIMEOUT:if(c.frag){var i=this._levels[c.frag.level];i?(i.fragmentError++,i.fragmentError>this.hls.config.fragLoadingMaxRetry&&(a=c.frag.level)):a=c.frag.level}break;case L.ErrorDetails.LEVEL_LOAD_ERROR:case L.ErrorDetails.LEVEL_LOAD_TIMEOUT:b&&(b.deliveryDirectives&&(o=!1),a=b.level),u=!0;break;case L.ErrorDetails.REMUX_ALLOC_ERROR:a=c.level,u=!0;break}a!==void 0&&this.recoverLevel(c,a,u,o)},n.recoverLevel=function(d,c,b,f){var u=d.details,o=this._levels[c];if(o.loadError++,b){var a=this.retryLoadingOrFail(d);if(a)d.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(f){var i=o.url.length;if(i>1&&o.loadError<i)d.levelRetry=!0,this.redundantFailover(c);else if(this.manualLevelIndex===-1){var v=c===0?this._levels.length-1:c-1;this.currentLevelIndex!==v&&this._levels[v].loadError===0&&(this.warn(u+": switch to "+v),d.levelRetry=!0,this.hls.nextAutoLevel=v)}}},n.redundantFailover=function(d){var c=this._levels[d],b=c.url.length;if(b>1){var f=(c.urlId+1)%b;this.warn("Switching to redundant URL-id "+f),this._levels.forEach(function(u){u.urlId=f}),this.level=d}},n.onFragLoaded=function(d,c){var b=c.frag;if(b!==void 0&&b.type===A.PlaylistLevelType.MAIN){var f=this._levels[b.level];f!==void 0&&(f.fragmentError=0,f.loadError=0)}},n.onLevelLoaded=function(d,c){var b,f=c.level,u=c.details,o=this._levels[f];if(!o){var a;this.warn("Invalid level index "+f),(a=c.deliveryDirectives)!==null&&a!==void 0&&a.skip&&(u.deltaUpdateFailed=!0);return}f===this.currentLevelIndex?(o.fragmentError===0&&(o.loadError=0,this.retryCount=0),this.playlistLoaded(f,c,o.details)):(b=c.deliveryDirectives)!==null&&b!==void 0&&b.skip&&(u.deltaUpdateFailed=!0)},n.onAudioTrackSwitched=function(d,c){var b=this.hls.levels[this.currentLevelIndex];if(!b)return;if(b.audioGroupIds){for(var f=-1,u=this.hls.audioTracks[c.id].groupId,o=0;o<b.audioGroupIds.length;o++)if(b.audioGroupIds[o]===u){f=o;break}f!==b.urlId&&(b.urlId=f,this.startLoad())}},n.loadPlaylist=function(d){var c=this.currentLevelIndex,b=this._levels[c];if(this.canLoad&&b&&b.url.length>0){var f=b.urlId,u=b.url[f];if(d)try{u=d.addDirectives(u)}catch(o){this.warn("Could not construct new URL with HLS Delivery Directives: "+o)}this.log("Attempt loading level index "+c+(d?" at sn "+d.msn+" part "+d.part:"")+" with URL-id "+f+" "+u),this.clearTimer(),this.hls.trigger(R.Events.LEVEL_LOADING,{url:u,level:c,id:f,deliveryDirectives:d||null})}},n.removeLevel=function(d,c){var b=function(o,a){return a!==c},f=this._levels.filter(function(u,o){return o!==d?!0:u.url.length>1&&c!==void 0?(u.url=u.url.filter(b),u.audioGroupIds&&(u.audioGroupIds=u.audioGroupIds.filter(b)),u.textGroupIds&&(u.textGroupIds=u.textGroupIds.filter(b)),u.urlId=0,!0):!1}).map(function(u,o){var a=u.details;return a!=null&&a.fragments&&a.fragments.forEach(function(i){i.level=o}),u});this._levels=f,this.hls.trigger(R.Events.LEVELS_UPDATED,{levels:f})},C(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(d){var c,b=this._levels;if(b.length===0)return;if(this.currentLevelIndex===d&&(c=b[d])!==null&&c!==void 0&&c.details)return;if(d<0||d>=b.length){var f=d<0;if(this.hls.trigger(R.Events.ERROR,{type:L.ErrorTypes.OTHER_ERROR,details:L.ErrorDetails.LEVEL_SWITCH_ERROR,level:d,fatal:f,reason:"invalid level idx"}),f)return;d=Math.min(d,b.length-1)}this.clearTimer();var u=this.currentLevelIndex,o=b[u],a=b[d];this.log("switching to level "+d+" from "+u),this.currentLevelIndex=d;var i=y({},a,{level:d,maxBitrate:a.maxBitrate,uri:a.uri,urlId:a.urlId});delete i._urlId,this.hls.trigger(R.Events.LEVEL_SWITCHING,i);var v=a.details;if(!v||v.live){var g=this.switchParams(a.uri,o==null?void 0:o.details);this.loadPlaylist(g)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(d){this.manualLevelIndex=d,this._startLevel===void 0&&(this._startLevel=d),d!==-1&&(this.level=d)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(d){this._firstLevel=d}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var d=this.hls.config.startLevel;return d!==void 0?d:this._firstLevel}else return this._startLevel},set:function(d){this._startLevel=d}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(d){this.level=d,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=d)}}]),s}(_.default)},"./src/controller/level-helper.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"addGroupId",function(){return L}),D.d(j,"assignTrackIdsByGroup",function(){return G}),D.d(j,"updatePTS",function(){return O}),D.d(j,"updateFragPTSDTS",function(){return A}),D.d(j,"mergeDetails",function(){return y}),D.d(j,"mapPartIntersection",function(){return S}),D.d(j,"mapFragmentIntersection",function(){return C}),D.d(j,"adjustSliding",function(){return T}),D.d(j,"addSliding",function(){return E}),D.d(j,"computeReloadInterval",function(){return x}),D.d(j,"getFragmentWithSN",function(){return l}),D.d(j,"getPartWith",function(){return r});var B=D("./src/polyfills/number.ts"),R=D("./src/utils/logger.ts");function L(s,n,p){switch(n){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(p);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(p);break}}function G(s){var n={};s.forEach(function(p){var d=p.groupId||"";p.id=n[d]=n[d]||0,n[d]++})}function O(s,n,p){var d=s[n],c=s[p];_(d,c)}function _(s,n){var p=n.startPTS;if(Object(B.isFiniteNumber)(p)){var d=0,c;n.sn>s.sn?(d=p-s.start,c=s):(d=s.start-p,c=n),c.duration!==d&&(c.duration=d)}else if(n.sn>s.sn){var b=s.cc===n.cc;b&&s.minEndPTS?n.start=s.start+(s.minEndPTS-s.start):n.start=s.start+s.duration}else n.start=Math.max(s.start-n.duration,0)}function A(s,n,p,d,c,b){var f=d-p;f<=0&&(R.logger.warn("Fragment should have a positive duration",n),d=p+n.duration,b=c+n.duration);var u=p,o=d,a=n.startPTS,i=n.endPTS;if(Object(B.isFiniteNumber)(a)){var v=Math.abs(a-p);Object(B.isFiniteNumber)(n.deltaPTS)?n.deltaPTS=Math.max(v,n.deltaPTS):n.deltaPTS=v,u=Math.max(p,a),p=Math.min(p,a),c=Math.min(c,n.startDTS),o=Math.min(d,i),d=Math.max(d,i),b=Math.max(b,n.endDTS)}n.duration=d-p;var g=p-n.start;n.appendedPTS=d,n.start=n.startPTS=p,n.maxStartPTS=u,n.startDTS=c,n.endPTS=d,n.minEndPTS=o,n.endDTS=b;var m=n.sn;if(!s||m<s.startSN||m>s.endSN)return 0;var w,P=m-s.startSN,N=s.fragments;for(N[P]=n,w=P;w>0;w--)_(N[w],N[w-1]);for(w=P;w<N.length-1;w++)_(N[w],N[w+1]);return s.fragmentHint&&_(N[N.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,g}function y(s,n){for(var p=null,d=s.fragments,c=d.length-1;c>=0;c--){var b=d[c].initSegment;if(b){p=b;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var f=0,u;if(C(s,n,function(w,P){w.relurl&&(f=w.cc-P.cc),Object(B.isFiniteNumber)(w.startPTS)&&Object(B.isFiniteNumber)(w.endPTS)&&(P.start=P.startPTS=w.startPTS,P.startDTS=w.startDTS,P.appendedPTS=w.appendedPTS,P.maxStartPTS=w.maxStartPTS,P.endPTS=w.endPTS,P.endDTS=w.endDTS,P.minEndPTS=w.minEndPTS,P.duration=w.endPTS-w.startPTS,P.duration&&(u=P),n.PTSKnown=n.alignedSliding=!0),P.elementaryStreams=w.elementaryStreams,P.loader=w.loader,P.stats=w.stats,P.urlId=w.urlId,w.initSegment&&(P.initSegment=w.initSegment,p=w.initSegment)}),p){var o=n.fragmentHint?n.fragments.concat(n.fragmentHint):n.fragments;o.forEach(function(w){var P;(!w.initSegment||w.initSegment.relurl===((P=p)===null||P===void 0?void 0:P.relurl))&&(w.initSegment=p)})}if(n.skippedSegments&&(n.deltaUpdateFailed=n.fragments.some(function(w){return!w}),n.deltaUpdateFailed)){R.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var a=n.skippedSegments;a--;)n.fragments.shift();n.startSN=n.fragments[0].sn,n.startCC=n.fragments[0].cc}var i=n.fragments;if(f){R.logger.warn("discontinuity sliding from playlist, take drift into account");for(var v=0;v<i.length;v++)i[v].cc+=f}n.skippedSegments&&(n.startCC=n.fragments[0].cc),S(s.partList,n.partList,function(w,P){P.elementaryStreams=w.elementaryStreams,P.stats=w.stats}),u?A(n,u,u.startPTS,u.endPTS,u.startDTS,u.endDTS):T(s,n),i.length&&(n.totalduration=n.edge-i[0].start),n.driftStartTime=s.driftStartTime,n.driftStart=s.driftStart;var g=n.advancedDateTime;if(n.advanced&&g){var m=n.edge;n.driftStart||(n.driftStartTime=g,n.driftStart=m),n.driftEndTime=g,n.driftEnd=m}else n.driftEndTime=s.driftEndTime,n.driftEnd=s.driftEnd,n.advancedDateTime=s.advancedDateTime}function S(s,n,p){if(s&&n)for(var d=0,c=0,b=s.length;c<=b;c++){var f=s[c],u=n[c+d];f&&u&&f.index===u.index&&f.fragment.sn===u.fragment.sn?p(f,u):d--}}function C(s,n,p){for(var d=n.skippedSegments,c=Math.max(s.startSN,n.startSN)-n.startSN,b=(s.fragmentHint?1:0)+(d?n.endSN:Math.min(s.endSN,n.endSN))-n.startSN,f=n.startSN-s.startSN,u=n.fragmentHint?n.fragments.concat(n.fragmentHint):n.fragments,o=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,a=c;a<=b;a++){var i=o[f+a],v=u[a];d&&!v&&a<d&&(v=n.fragments[a]=i),i&&v&&p(i,v)}}function T(s,n){var p=n.startSN+n.skippedSegments-s.startSN,d=s.fragments;if(p<0||p>=d.length)return;E(n,d[p].start)}function E(s,n){if(n){for(var p=s.fragments,d=s.skippedSegments;d<p.length;d++)p[d].start+=n;s.fragmentHint&&(s.fragmentHint.start+=n)}}function x(s,n){var p=1e3*s.levelTargetDuration,d=p/2,c=s.age,b=c>0&&c<p*3,f=n.loading.end-n.loading.start,u,o=s.availabilityDelay;if(s.updated===!1)if(b){var a=333*s.misses;u=Math.max(Math.min(d,f*2),a),s.availabilityDelay=(s.availabilityDelay||0)+u}else u=d;else b?(o=Math.min(o||p/2,c),s.availabilityDelay=o,u=o+p-c):u=p-f;return Math.round(u)}function l(s,n,p){if(!s||!s.details)return null;var d=s.details,c=d.fragments[n-d.startSN];return c||(c=d.fragmentHint,c&&c.sn===n?c:n<d.startSN&&p&&p.sn===n?p:null)}function r(s,n,p){if(!s||!s.details)return null;var d=s.details.partList;if(d)for(var c=d.length;c--;){var b=d[c];if(b.index===p&&b.fragment.sn===n)return b}return null}},"./src/controller/stream-controller.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"default",function(){return d});var B=D("./src/polyfills/number.ts"),R=D("./src/controller/base-stream-controller.ts"),L=D("./src/is-supported.ts"),G=D("./src/events.ts"),O=D("./src/utils/buffer-helper.ts"),_=D("./src/controller/fragment-tracker.ts"),A=D("./src/types/loader.ts"),y=D("./src/loader/fragment.ts"),S=D("./src/demux/transmuxer-interface.ts"),C=D("./src/types/transmuxer.ts"),T=D("./src/controller/gap-controller.ts"),E=D("./src/errors.ts"),x=D("./src/utils/logger.ts");function l(c,b){for(var f=0;f<b.length;f++){var u=b[f];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(c,u.key,u)}}function r(c,b,f){return b&&l(c.prototype,b),f&&l(c,f),c}function s(c,b){c.prototype=Object.create(b.prototype),c.prototype.constructor=c,n(c,b)}function n(c,b){return n=Object.setPrototypeOf||function(u,o){return u.__proto__=o,u},n(c,b)}var p=100,d=function(c){s(b,c);function b(u,o){var a;return a=c.call(this,u,o,"[stream-controller]")||this,a.audioCodecSwap=!1,a.gapController=null,a.level=-1,a._forceStartLoad=!1,a.altAudio=!1,a.audioOnly=!1,a.fragPlaying=null,a.onvplaying=null,a.onvseeked=null,a.fragLastKbps=0,a.stalled=!1,a.couldBacktrack=!1,a.audioCodecSwitch=!1,a.videoBuffer=null,a._registerListeners(),a}var f=b.prototype;return f._registerListeners=function(){var o=this.hls;o.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(G.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),o.on(G.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),o.on(G.Events.ERROR,this.onError,this),o.on(G.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),o.on(G.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),o.on(G.Events.BUFFER_CREATED,this.onBufferCreated,this),o.on(G.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),o.on(G.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),o.on(G.Events.FRAG_BUFFERED,this.onFragBuffered,this)},f._unregisterListeners=function(){var o=this.hls;o.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),o.off(G.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),o.off(G.Events.ERROR,this.onError,this),o.off(G.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),o.off(G.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),o.off(G.Events.BUFFER_CREATED,this.onBufferCreated,this),o.off(G.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),o.off(G.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),o.off(G.Events.FRAG_BUFFERED,this.onFragBuffered,this)},f.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},f.startLoad=function(o){if(this.levels){var a=this.lastCurrentTime,i=this.hls;if(this.stopLoad(),this.setInterval(p),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var v=i.startLevel;v===-1&&(i.config.testBandwidth?(v=0,this.bitrateTest=!0):v=i.nextAutoLevel),this.level=i.nextLoadLevel=v,this.loadedmetadata=!1}a>0&&o===-1&&(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),o=a),this.state=R.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=o,this.tick()}else this._forceStartLoad=!0,this.state=R.State.STOPPED},f.stopLoad=function(){this._forceStartLoad=!1,c.prototype.stopLoad.call(this)},f.doTick=function(){switch(this.state){case R.State.IDLE:this.doTickIdle();break;case R.State.WAITING_LEVEL:{var o,a=this.levels,i=this.level,v=a==null||((o=a[i])===null||o===void 0)?void 0:o.details;if(v&&(!v.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(v))break;this.state=R.State.IDLE;break}break}case R.State.FRAG_LOADING_WAITING_RETRY:{var g,m=self.performance.now(),w=this.retryDate;(!w||m>=w||(g=this.media)!==null&&g!==void 0&&g.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=R.State.IDLE)}break;default:break}this.onTickEnd()},f.onTickEnd=function(){c.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},f.doTickIdle=function(){var o,a,i=this.hls,v=this.levelLastLoaded,g=this.levels,m=this.media,w=i.config,P=i.nextLoadLevel;if(v===null||!m&&(this.startFragRequested||!w.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!g||!g[P])return;var N=g[P];this.level=i.nextLoadLevel=P;var K=N.details;if(!K||this.state===R.State.WAITING_LEVEL||K.live&&this.levelLastLoaded!==P){this.state=R.State.WAITING_LEVEL;return}var Y=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:m,A.PlaylistLevelType.MAIN);if(Y===null)return;var ne=Y.len,q=this.getMaxBufferLength(N.maxBitrate);if(ne>=q)return;if(this._streamEnded(Y,K)){var se={};this.altAudio&&(se.type="video"),this.hls.trigger(G.Events.BUFFER_EOS,se),this.state=R.State.ENDED;return}var fe=Y.end,le=this.getNextFragment(fe,K);if(this.couldBacktrack&&!this.fragPrevious&&le&&le.sn!=="initSegment"){var ve=le.sn-K.startSN;ve>1&&(le=K.fragments[ve-1],this.fragmentTracker.removeFragment(le))}if(le&&this.fragmentTracker.getState(le)===_.FragmentState.OK&&this.nextLoadPosition>fe){var Se=this.audioOnly&&!this.altAudio?y.ElementaryStreamTypes.AUDIO:y.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(m,Se,A.PlaylistLevelType.MAIN),le=this.getNextFragment(this.nextLoadPosition,K)}if(!le)return;le.initSegment&&!le.initSegment.data&&!this.bitrateTest&&(le=le.initSegment),((o=le.decryptdata)===null||o===void 0?void 0:o.keyFormat)==="identity"&&!((a=le.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(le,K):this.loadFragment(le,K,fe)},f.loadFragment=function(o,a,i){var v,g=this.fragmentTracker.getState(o);if(this.fragCurrent=o,g===_.FragmentState.BACKTRACKED){var m=this.fragmentTracker.getBacktrackData(o);if(m){this._handleFragmentLoadProgress(m),this._handleFragmentLoadComplete(m);return}else g=_.FragmentState.NOT_LOADED}g===_.FragmentState.NOT_LOADED||g===_.FragmentState.PARTIAL?o.sn==="initSegment"?this._loadInitSegment(o):this.bitrateTest?(o.bitrateTest=!0,this.log("Fragment "+o.sn+" of level "+o.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(o)):(this.startFragRequested=!0,c.prototype.loadFragment.call(this,o,a,i)):g===_.FragmentState.APPENDING?this.reduceMaxBufferLength(o.duration)&&this.fragmentTracker.removeFragment(o):((v=this.media)===null||v===void 0?void 0:v.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},f.getAppendedFrag=function(o){var a=this.fragmentTracker.getAppendedFrag(o,A.PlaylistLevelType.MAIN);return a&&"fragment"in a?a.fragment:a},f.getBufferedFrag=function(o){return this.fragmentTracker.getBufferedFrag(o,A.PlaylistLevelType.MAIN)},f.followingBufferedFrag=function(o){return o?this.getBufferedFrag(o.end+.5):null},f.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},f.nextLevelSwitch=function(){var o=this.levels,a=this.media;if(a!=null&&a.readyState){var i,v=this.getAppendedFrag(a.currentTime);if(v&&v.start>1&&this.flushMainBuffer(0,v.start-1),!a.paused&&o){var g=this.hls.nextLoadLevel,m=o[g],w=this.fragLastKbps;w&&this.fragCurrent?i=this.fragCurrent.duration*m.maxBitrate/(1e3*w)+1:i=0}else i=0;var P=this.getBufferedFrag(a.currentTime+i);if(P){var N=this.followingBufferedFrag(P);if(N){this.abortCurrentFrag();var K=N.maxStartPTS?N.maxStartPTS:N.start,Y=N.duration,ne=Math.max(P.end,K+Math.min(Math.max(Y-this.config.maxFragLookUpTolerance,Y*.5),Y*.75));this.flushMainBuffer(ne,Number.POSITIVE_INFINITY)}}}},f.abortCurrentFrag=function(){var o=this.fragCurrent;this.fragCurrent=null,o!=null&&o.loader&&o.loader.abort(),this.state===R.State.KEY_LOADING&&(this.state=R.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},f.flushMainBuffer=function(o,a){c.prototype.flushMainBuffer.call(this,o,a,this.altAudio?"video":null)},f.onMediaAttached=function(o,a){c.prototype.onMediaAttached.call(this,o,a);var i=a.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),i.addEventListener("playing",this.onvplaying),i.addEventListener("seeked",this.onvseeked),this.gapController=new T.default(this.config,i,this.fragmentTracker,this.hls)},f.onMediaDetaching=function(){var o=this.media;o&&(o.removeEventListener("playing",this.onvplaying),o.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),c.prototype.onMediaDetaching.call(this)},f.onMediaPlaying=function(){this.tick()},f.onMediaSeeked=function(){var o=this.media,a=o?o.currentTime:null;Object(B.isFiniteNumber)(a)&&this.log("Media seeked to "+a.toFixed(3)),this.tick()},f.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(G.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},f.onManifestParsed=function(o,a){var i=!1,v=!1,g;a.levels.forEach(function(m){g=m.audioCodec,g&&(g.indexOf("mp4a.40.2")!==-1&&(i=!0),g.indexOf("mp4a.40.5")!==-1&&(v=!0))}),this.audioCodecSwitch=i&&v&&!Object(L.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=a.levels,this.startFragRequested=!1},f.onLevelLoading=function(o,a){var i=this.levels;if(!i||this.state!==R.State.IDLE)return;var v=i[a.level];(!v.details||v.details.live&&this.levelLastLoaded!==a.level||this.waitForCdnTuneIn(v.details))&&(this.state=R.State.WAITING_LEVEL)},f.onLevelLoaded=function(o,a){var i,v=this.levels,g=a.level,m=a.details,w=m.totalduration;if(!v){this.warn("Levels were reset while loading level "+g);return}this.log("Level "+g+" loaded ["+m.startSN+","+m.endSN+"], cc ["+m.startCC+", "+m.endCC+"] duration:"+w);var P=this.fragCurrent;P&&(this.state===R.State.FRAG_LOADING||this.state===R.State.FRAG_LOADING_WAITING_RETRY)&&(P.level!==a.level&&P.loader&&(this.state=R.State.IDLE,P.loader.abort()));var N=v[g],K=0;if(m.live||(i=N.details)!==null&&i!==void 0&&i.live){if(m.fragments[0]||(m.deltaUpdateFailed=!0),m.deltaUpdateFailed)return;K=this.alignPlaylists(m,N.details)}if(N.details=m,this.levelLastLoaded=g,this.hls.trigger(G.Events.LEVEL_UPDATED,{details:m,level:g}),this.state===R.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(m))return;this.state=R.State.IDLE}this.startFragRequested?m.live&&this.synchronizeToLiveEdge(m):this.setStartPosition(m,K),this.tick()},f._handleFragmentLoadProgress=function(o){var a,i=o.frag,v=o.part,g=o.payload,m=this.levels;if(!m){this.warn("Levels were reset while fragment load was in progress. Fragment "+i.sn+" of level "+i.level+" will not be buffered");return}var w=m[i.level],P=w.details;if(!P){this.warn("Dropping fragment "+i.sn+" of level "+i.level+" after level details were reset");return}var N=w.videoCodec,K=P.PTSKnown||!P.live,Y=(a=i.initSegment)===null||a===void 0?void 0:a.data,ne=this._getAudioCodec(w),q=this.transmuxer=this.transmuxer||new S.default(this.hls,A.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),se=v?v.index:-1,fe=se!==-1,le=new C.ChunkMetadata(i.level,i.sn,i.stats.chunkCount,g.byteLength,se,fe),ve=this.initPTS[i.cc];q.push(g,Y,ne,N,i,v,P.totalduration,K,le,ve)},f.onAudioTrackSwitching=function(o,a){var i=this.altAudio,v=!!a.url,g=a.id;if(!v){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var m=this.fragCurrent;m!=null&&m.loader&&(this.log("Switching to main audio track, cancel main fragment load"),m.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var w=this.hls;i&&w.trigger(G.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),w.trigger(G.Events.AUDIO_TRACK_SWITCHED,{id:g})}},f.onAudioTrackSwitched=function(o,a){var i=a.id,v=!!this.hls.audioTracks[i].url;if(v){var g=this.videoBuffer;g&&this.mediaBuffer!==g&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=g)}this.altAudio=v,this.tick()},f.onBufferCreated=function(o,a){var i=a.tracks,v,g,m=!1;for(var w in i){var P=i[w];if(P.id==="main"){if(g=w,v=P,w==="video"){var N=i[w];N&&(this.videoBuffer=N.buffer)}}else m=!0}m&&v?(this.log("Alternate track found, use "+g+".buffered to schedule main fragment loading"),this.mediaBuffer=v.buffer):this.mediaBuffer=this.media},f.onFragBuffered=function(o,a){var i=a.frag,v=a.part;if(i&&i.type!==A.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(i)){this.warn("Fragment "+i.sn+(v?" p: "+v.index:"")+" of level "+i.level+" finished buffering, but was aborted. state: "+this.state),this.state===R.State.PARSED&&(this.state=R.State.IDLE);return}var g=v?v.stats:i.stats;this.fragLastKbps=Math.round(8*g.total/(g.buffering.end-g.loading.first)),i.sn!=="initSegment"&&(this.fragPrevious=i),this.fragBufferedComplete(i,v)},f.onError=function(o,a){switch(a.details){case E.ErrorDetails.FRAG_LOAD_ERROR:case E.ErrorDetails.FRAG_LOAD_TIMEOUT:case E.ErrorDetails.KEY_LOAD_ERROR:case E.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(A.PlaylistLevelType.MAIN,a);break;case E.ErrorDetails.LEVEL_LOAD_ERROR:case E.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==R.State.ERROR&&(a.fatal?(this.warn(""+a.details),this.state=R.State.ERROR):!a.levelRetry&&this.state===R.State.WAITING_LEVEL&&(this.state=R.State.IDLE));break;case E.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="main"&&(this.state===R.State.PARSING||this.state===R.State.PARSED)){var i=!0,v=this.getFwdBufferInfo(this.media,A.PlaylistLevelType.MAIN);v&&v.len>.5&&(i=!this.reduceMaxBufferLength(v.len)),i&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},f.checkBuffer=function(){var o=this.media,a=this.gapController;if(!o||!a||!o.readyState)return;var i=O.BufferHelper.getBuffered(o);!this.loadedmetadata&&i.length?(this.loadedmetadata=!0,this.seekToStartPos()):a.poll(this.lastCurrentTime),this.lastCurrentTime=o.currentTime},f.onFragLoadEmergencyAborted=function(){this.state=R.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},f.onBufferFlushed=function(o,a){var i=a.type;if(i!==y.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var v=(i===y.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(v,i,A.PlaylistLevelType.MAIN)}},f.onLevelsUpdated=function(o,a){this.levels=a.levels},f.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},f.seekToStartPos=function(){var o=this.media,a=o.currentTime,i=this.startPosition;if(i>=0&&a<i){if(o.seeking){x.logger.log("could not seek to "+i+", already seeking at "+a);return}var v=O.BufferHelper.getBuffered(o),g=v.length?v.start(0):0,m=g-i;m>0&&(m<this.config.maxBufferHole||m<this.config.maxFragLookUpTolerance)&&(x.logger.log("adjusting start position by "+m+" to match buffer start"),i+=m,this.startPosition=i),this.log("seek to target start position "+i+" from current time "+a),o.currentTime=i}},f._getAudioCodec=function(o){var a=this.config.defaultAudioCodec||o.audioCodec;return this.audioCodecSwap&&a&&(this.log("Swapping audio codec"),a.indexOf("mp4a.40.5")!==-1?a="mp4a.40.2":a="mp4a.40.5"),a},f._loadBitrateTestFrag=function(o){var a=this;this._doFragLoad(o).then(function(i){var v=a.hls;if(!i||v.nextLoadLevel||a.fragContextChanged(o))return;a.fragLoadError=0,a.state=R.State.IDLE,a.startFragRequested=!1,a.bitrateTest=!1;var g=o.stats;g.parsing.start=g.parsing.end=g.buffering.start=g.buffering.end=self.performance.now(),v.trigger(G.Events.FRAG_LOADED,i)})},f._handleTransmuxComplete=function(o){var a,i="main",v=this.hls,g=o.remuxResult,m=o.chunkMeta,w=this.getCurrentContext(m);if(!w){this.warn("The loading context changed while buffering fragment "+m.sn+" of level "+m.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(m.level);return}var P=w.frag,N=w.part,K=w.level,Y=g.video,ne=g.text,q=g.id3,se=g.initSegment,fe=this.altAudio?void 0:g.audio;if(this.fragContextChanged(P))return;if(this.state=R.State.PARSING,se){se.tracks&&(this._bufferInitSegment(K,se.tracks,P,m),v.trigger(G.Events.FRAG_PARSING_INIT_SEGMENT,{frag:P,id:i,tracks:se.tracks}));var le=se.initPTS,ve=se.timescale;Object(B.isFiniteNumber)(le)&&(this.initPTS[P.cc]=le,v.trigger(G.Events.INIT_PTS_FOUND,{frag:P,id:i,initPTS:le,timescale:ve}))}if(Y&&g.independent!==!1){if(K.details){var Se=Y.startPTS,ke=Y.endPTS,Ce=Y.startDTS,Le=Y.endDTS;if(N)N.elementaryStreams[Y.type]={startPTS:Se,endPTS:ke,startDTS:Ce,endDTS:Le};else if(Y.firstKeyFrame&&Y.independent&&(this.couldBacktrack=!0),Y.dropped&&Y.independent){var ge=this.getLoadPosition()+this.config.maxBufferHole;if(ge<Se){this.backtrack(P);return}P.setElementaryStreamInfo(Y.type,P.start,ke,P.start,Le,!0)}P.setElementaryStreamInfo(Y.type,Se,ke,Ce,Le),this.bufferFragmentData(Y,P,N,m)}}else if(g.independent===!1){this.backtrack(P);return}if(fe){var me=fe.startPTS,de=fe.endPTS,nt=fe.startDTS,Qe=fe.endDTS;N&&(N.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:me,endPTS:de,startDTS:nt,endDTS:Qe}),P.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,me,de,nt,Qe),this.bufferFragmentData(fe,P,N,m)}if(q!=null&&(a=q.samples)!==null&&a!==void 0&&a.length){var qe={frag:P,id:i,samples:q.samples};v.trigger(G.Events.FRAG_PARSING_METADATA,qe)}if(ne){var We={frag:P,id:i,samples:ne.samples};v.trigger(G.Events.FRAG_PARSING_USERDATA,We)}},f._bufferInitSegment=function(o,a,i,v){var g=this;if(this.state!==R.State.PARSING)return;this.audioOnly=!!a.audio&&!a.video,this.altAudio&&!this.audioOnly&&delete a.audio;var m=a.audio,w=a.video,P=a.audiovideo;if(m){var N=o.audioCodec,K=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(N&&(N.indexOf("mp4a.40.5")!==-1?N="mp4a.40.2":N="mp4a.40.5"),m.metadata.channelCount!==1&&K.indexOf("firefox")===-1&&(N="mp4a.40.5")),K.indexOf("android")!==-1&&m.container!=="audio/mpeg"&&(N="mp4a.40.2",this.log("Android: force audio codec to "+N)),o.audioCodec&&o.audioCodec!==N&&this.log('Swapping manifest audio codec "'+o.audioCodec+'" for "'+N+'"'),m.levelCodec=N,m.id="main",this.log("Init audio buffer, container:"+m.container+", codecs[selected/level/parsed]=["+(N||"")+"/"+(o.audioCodec||"")+"/"+m.codec+"]")}w&&(w.levelCodec=o.videoCodec,w.id="main",this.log("Init video buffer, container:"+w.container+", codecs[level/parsed]=["+(o.videoCodec||"")+"/"+w.codec+"]")),P&&this.log("Init audiovideo buffer, container:"+P.container+", codecs[level/parsed]=["+(o.attrs.CODECS||"")+"/"+P.codec+"]"),this.hls.trigger(G.Events.BUFFER_CODECS,a),Object.keys(a).forEach(function(Y){var ne=a[Y],q=ne.initSegment;q!=null&&q.byteLength&&g.hls.trigger(G.Events.BUFFER_APPENDING,{type:Y,data:q,frag:i,part:null,chunkMeta:v,parent:i.type})}),this.tick()},f.backtrack=function(o){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(o);var a=this.fragmentTracker.backtrack(o);this.fragPrevious=null,this.nextLoadPosition=o.start,a?this.resetFragmentLoading(o):this.state=R.State.BACKTRACKING},f.checkFragmentChanged=function(){var o=this.media,a=null;if(o&&o.readyState>1&&o.seeking===!1){var i=o.currentTime;if(O.BufferHelper.isBuffered(o,i)?a=this.getAppendedFrag(i):O.BufferHelper.isBuffered(o,i+.1)&&(a=this.getAppendedFrag(i+.1)),a){var v=this.fragPlaying,g=a.level;(!v||a.sn!==v.sn||v.level!==g||a.urlId!==v.urlId)&&(this.hls.trigger(G.Events.FRAG_CHANGED,{frag:a}),(!v||v.level!==g)&&this.hls.trigger(G.Events.LEVEL_SWITCHED,{level:g}),this.fragPlaying=a)}}},r(b,[{key:"nextLevel",get:function(){var o=this.nextBufferedFrag;return o?o.level:-1}},{key:"currentLevel",get:function(){var o=this.media;if(o){var a=this.getAppendedFrag(o.currentTime);if(a)return a.level}return-1}},{key:"nextBufferedFrag",get:function(){var o=this.media;if(o){var a=this.getAppendedFrag(o.currentTime);return this.followingBufferedFrag(a)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),b}(R.default)},"./src/controller/subtitle-stream-controller.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"SubtitleStreamController",function(){return s});var B=D("./src/events.ts"),R=D("./src/utils/logger.ts"),L=D("./src/utils/buffer-helper.ts"),G=D("./src/controller/fragment-finders.ts"),O=D("./src/utils/discontinuities.ts"),_=D("./src/controller/level-helper.ts"),A=D("./src/controller/fragment-tracker.ts"),y=D("./src/controller/base-stream-controller.ts"),S=D("./src/types/loader.ts"),C=D("./src/types/level.ts");function T(n,p){for(var d=0;d<p.length;d++){var c=p[d];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(n,c.key,c)}}function E(n,p,d){return p&&T(n.prototype,p),d&&T(n,d),n}function x(n,p){n.prototype=Object.create(p.prototype),n.prototype.constructor=n,l(n,p)}function l(n,p){return l=Object.setPrototypeOf||function(c,b){return c.__proto__=b,c},l(n,p)}var r=500,s=function(n){x(p,n);function p(c,b){var f;return f=n.call(this,c,b,"[subtitle-stream-controller]")||this,f.levels=[],f.currentTrackId=-1,f.tracksBuffered=[],f.mainDetails=null,f._registerListeners(),f}var d=p.prototype;return d.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},d._registerListeners=function(){var b=this.hls;b.on(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),b.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),b.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),b.on(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),b.on(B.Events.ERROR,this.onError,this),b.on(B.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),b.on(B.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),b.on(B.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),b.on(B.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),b.on(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},d._unregisterListeners=function(){var b=this.hls;b.off(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),b.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),b.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),b.off(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),b.off(B.Events.ERROR,this.onError,this),b.off(B.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),b.off(B.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),b.off(B.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),b.off(B.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),b.off(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},d.startLoad=function(){this.stopLoad(),this.state=y.State.IDLE,this.setInterval(r),this.tick()},d.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},d.onLevelLoaded=function(b,f){this.mainDetails=f.details},d.onSubtitleFragProcessed=function(b,f){var u=f.frag,o=f.success;if(this.fragPrevious=u,this.state=y.State.IDLE,!o)return;var a=this.tracksBuffered[this.currentTrackId];if(!a)return;for(var i,v=u.start,g=0;g<a.length;g++)if(v>=a[g].start&&v<=a[g].end){i=a[g];break}var m=u.start+u.duration;i?i.end=m:(i={start:v,end:m},a.push(i)),this.fragmentTracker.fragBuffered(u)},d.onBufferFlushing=function(b,f){var u=f.startOffset,o=f.endOffset;if(u===0&&o!==Number.POSITIVE_INFINITY){var a=this.currentTrackId,i=this.levels;if(!i.length||!i[a]||!i[a].details)return;var v=i[a].details,g=v.targetduration,m=o-g;if(m<=0)return;f.endOffsetSubtitles=Math.max(0,m),this.tracksBuffered.forEach(function(w){for(var P=0;P<w.length;){if(w[P].end<=m){w.shift();continue}else if(w[P].start<m)w[P].start=m;else break;P++}}),this.fragmentTracker.removeFragmentsInRange(u,m,S.PlaylistLevelType.SUBTITLE)}},d.onError=function(b,f){var u,o=f.frag;if(!o||o.type!==S.PlaylistLevelType.SUBTITLE)return;(u=this.fragCurrent)!==null&&u!==void 0&&u.loader&&this.fragCurrent.loader.abort(),this.state=y.State.IDLE},d.onSubtitleTracksUpdated=function(b,f){var u=this,o=f.subtitleTracks;this.tracksBuffered=[],this.levels=o.map(function(a){return new C.Level(a)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(a){u.tracksBuffered[a.id]=[]}),this.mediaBuffer=null},d.onSubtitleTrackSwitch=function(b,f){if(this.currentTrackId=f.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var u=this.levels[this.currentTrackId];u!=null&&u.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,u&&this.setInterval(r)},d.onSubtitleTrackLoaded=function(b,f){var u,o=f.details,a=f.id,i=this.currentTrackId,v=this.levels;if(!v.length)return;var g=v[i];if(a>=v.length||a!==i||!g)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,o.live||(u=g.details)!==null&&u!==void 0&&u.live){var m=this.mainDetails;if(o.deltaUpdateFailed||!m)return;var w=m.fragments[0];if(!g.details)o.hasProgramDateTime&&m.hasProgramDateTime?Object(O.alignMediaPlaylistByPDT)(o,m):w&&Object(_.addSliding)(o,w.start);else{var P=this.alignPlaylists(o,g.details);P===0&&w&&Object(_.addSliding)(o,w.start)}}if(g.details=o,this.levelLastLoaded=a,this.tick(),o.live&&!this.fragCurrent&&this.media&&this.state===y.State.IDLE){var N=Object(G.findFragmentByPTS)(null,o.fragments,this.media.currentTime,0);N||(this.warn("Subtitle playlist not aligned with playback"),g.details=void 0)}},d._handleFragmentLoadComplete=function(b){var f=b.frag,u=b.payload,o=f.decryptdata,a=this.hls;if(this.fragContextChanged(f))return;if(u&&u.byteLength>0&&o&&o.key&&o.iv&&o.method==="AES-128"){var i=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(u),o.key.buffer,o.iv.buffer).then(function(v){var g=performance.now();a.trigger(B.Events.FRAG_DECRYPTED,{frag:f,payload:v,stats:{tstart:i,tdecrypt:g}})})}},d.doTick=function(){if(!this.media){this.state=y.State.IDLE;return}if(this.state===y.State.IDLE){var b,f=this.currentTrackId,u=this.levels;if(!u.length||!u[f]||!u[f].details)return;var o=u[f].details,a=o.targetduration,i=this.config,v=this.media,g=L.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,v.currentTime-a,i.maxBufferHole),m=g.end,w=g.len,P=this.getMaxBufferLength()+a;if(w>P)return;console.assert(o,"Subtitle track details are defined on idle subtitle stream controller tick");var N=o.fragments,K=N.length,Y=o.edge,ne,q=this.fragPrevious;if(m<Y){var se=i.maxFragLookUpTolerance;q&&o.hasProgramDateTime&&(ne=Object(G.findFragmentByPDT)(N,q.endProgramDateTime,se)),ne||(ne=Object(G.findFragmentByPTS)(q,N,m,se),!ne&&q&&q.start<N[0].start&&(ne=N[0]))}else ne=N[K-1];(b=ne)!==null&&b!==void 0&&b.encrypted?(R.logger.log("Loading key for "+ne.sn),this.state=y.State.KEY_LOADING,this.hls.trigger(B.Events.KEY_LOADING,{frag:ne})):ne&&this.fragmentTracker.getState(ne)===A.FragmentState.NOT_LOADED&&this.loadFragment(ne,o,m)}},d.loadFragment=function(b,f,u){this.fragCurrent=b,n.prototype.loadFragment.call(this,b,f,u)},E(p,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),p}(y.default)},"./src/controller/subtitle-track-controller.ts":function(he,j,D){"use strict";D.r(j);var B=D("./src/events.ts"),R=D("./src/utils/texttrack-utils.ts"),L=D("./src/controller/base-playlist-controller.ts"),G=D("./src/types/loader.ts");function O(T,E){for(var x=0;x<E.length;x++){var l=E[x];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(T,l.key,l)}}function _(T,E,x){return E&&O(T.prototype,E),x&&O(T,x),T}function A(T,E){T.prototype=Object.create(E.prototype),T.prototype.constructor=T,y(T,E)}function y(T,E){return y=Object.setPrototypeOf||function(l,r){return l.__proto__=r,l},y(T,E)}var S=function(T){A(E,T);function E(l){var r;return r=T.call(this,l,"[subtitle-track-controller]")||this,r.media=null,r.tracks=[],r.groupId=null,r.tracksInGroup=[],r.trackId=-1,r.selectDefaultTrack=!0,r.queuedDefaultTrack=-1,r.trackChangeListener=function(){return r.onTextTracksChanged()},r.asyncPollTrackChange=function(){return r.pollTrackChange(0)},r.useTextTrackPolling=!1,r.subtitlePollingInterval=-1,r.subtitleDisplay=!0,r.registerListeners(),r}var x=E.prototype;return x.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,T.prototype.destroy.call(this)},x.registerListeners=function(){var r=this.hls;r.on(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.on(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.on(B.Events.LEVEL_LOADING,this.onLevelLoading,this),r.on(B.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),r.on(B.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),r.on(B.Events.ERROR,this.onError,this)},x.unregisterListeners=function(){var r=this.hls;r.off(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.off(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.off(B.Events.LEVEL_LOADING,this.onLevelLoading,this),r.off(B.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),r.off(B.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),r.off(B.Events.ERROR,this.onError,this)},x.onMediaAttached=function(r,s){if(this.media=s.media,!this.media)return;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)},x.pollTrackChange=function(r){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,r)},x.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var r=C(this.media.textTracks);r.forEach(function(s){Object(R.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},x.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},x.onManifestParsed=function(r,s){this.tracks=s.subtitleTracks},x.onSubtitleTrackLoaded=function(r,s){var n=s.id,p=s.details,d=this.trackId,c=this.tracksInGroup[d];if(!c){this.warn("Invalid subtitle track id "+n);return}var b=c.details;c.details=s.details,this.log("subtitle track "+n+" loaded ["+p.startSN+"-"+p.endSN+"]"),n===this.trackId&&(this.retryCount=0,this.playlistLoaded(n,s,b))},x.onLevelLoading=function(r,s){this.switchLevel(s.level)},x.onLevelSwitching=function(r,s){this.switchLevel(s.level)},x.switchLevel=function(r){var s=this.hls.levels[r];if(!(s!=null&&s.textGroupIds))return;var n=s.textGroupIds[s.urlId];if(this.groupId!==n){var p=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,d=this.tracks.filter(function(f){return!n||f.groupId===n});this.tracksInGroup=d;var c=this.findTrackId(p==null?void 0:p.name)||this.findTrackId();this.groupId=n;var b={subtitleTracks:d};this.log("Updating subtitle tracks, "+d.length+' track(s) found in "'+n+'" group-id'),this.hls.trigger(B.Events.SUBTITLE_TRACKS_UPDATED,b),c!==-1&&this.setSubtitleTrack(c,p)}},x.findTrackId=function(r){for(var s=this.tracksInGroup,n=0;n<s.length;n++){var p=s[n];if((!this.selectDefaultTrack||p.default)&&(!r||r===p.name))return p.id}return-1},x.onError=function(r,s){if(T.prototype.onError.call(this,r,s),s.fatal||!s.context)return;s.context.type===G.PlaylistContextType.SUBTITLE_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},x.loadPlaylist=function(r){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var n=s.id,p=s.groupId,d=s.url;if(r)try{d=r.addDirectives(d)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Loading subtitle playlist for id "+n),this.hls.trigger(B.Events.SUBTITLE_TRACK_LOADING,{url:d,id:n,groupId:p,deliveryDirectives:r||null})}},x.toggleTrackModes=function(r){var s=this,n=this.media,p=this.subtitleDisplay,d=this.trackId;if(!n)return;var c=C(n.textTracks),b=c.filter(function(o){return o.groupId===s.groupId});if(r===-1)[].slice.call(c).forEach(function(o){o.mode="disabled"});else{var f=b[d];f&&(f.mode="disabled")}var u=b[r];u&&(u.mode=p?"showing":"hidden")},x.setSubtitleTrack=function(r,s){var n,p=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=r;return}if(this.trackId!==r&&this.toggleTrackModes(r),this.trackId===r&&(r===-1||(n=p[r])!==null&&n!==void 0&&n.details)||r<-1||r>=p.length)return;this.clearTimer();var d=p[r];if(this.log("Switching to subtitle track "+r),this.trackId=r,d){var c=d.id,b=d.groupId,f=b===void 0?"":b,u=d.name,o=d.type,a=d.url;this.hls.trigger(B.Events.SUBTITLE_TRACK_SWITCH,{id:c,groupId:f,name:u,type:o,url:a});var i=this.switchParams(d.url,s==null?void 0:s.details);this.loadPlaylist(i)}else this.hls.trigger(B.Events.SUBTITLE_TRACK_SWITCH,{id:r})},x.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var r=-1,s=C(this.media.textTracks),n=0;n<s.length;n++)if(s[n].mode==="hidden")r=n;else if(s[n].mode==="showing"){r=n;break}this.subtitleTrack!==r&&(this.subtitleTrack=r)},_(E,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(r){this.selectDefaultTrack=!1;var s=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(r,s)}}]),E}(L.default);function C(T){for(var E=[],x=0;x<T.length;x++){var l=T[x];l.kind==="subtitles"&&l.label&&E.push(T[x])}return E}j.default=S},"./src/controller/timeline-controller.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"TimelineController",function(){return C});var B=D("./src/polyfills/number.ts"),R=D("./src/events.ts"),L=D("./src/utils/cea-608-parser.ts"),G=D("./src/utils/output-filter.ts"),O=D("./src/utils/webvtt-parser.ts"),_=D("./src/utils/texttrack-utils.ts"),A=D("./src/utils/imsc1-ttml-parser.ts"),y=D("./src/types/loader.ts"),S=D("./src/utils/logger.ts"),C=function(){function l(s){if(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.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=x(),this.captionsProperties=void 0,this.hls=s,this.config=s.config,this.Cues=s.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}},this.config.enableCEA708Captions){var n=new G.default(this,"textTrack1"),p=new G.default(this,"textTrack2"),d=new G.default(this,"textTrack3"),c=new G.default(this,"textTrack4");this.cea608Parser1=new L.default(1,n,p),this.cea608Parser2=new L.default(3,d,c)}s.on(R.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(R.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.on(R.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.on(R.Events.FRAG_LOADING,this.onFragLoading,this),s.on(R.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(R.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.on(R.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.on(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(R.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.on(R.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var r=l.prototype;return r.destroy=function(){var n=this.hls;n.off(R.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),n.off(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.off(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.off(R.Events.MANIFEST_LOADED,this.onManifestLoaded,this),n.off(R.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),n.off(R.Events.FRAG_LOADING,this.onFragLoading,this),n.off(R.Events.FRAG_LOADED,this.onFragLoaded,this),n.off(R.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),n.off(R.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),n.off(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),n.off(R.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),n.off(R.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},r.addCues=function(n,p,d,c,b){for(var f=!1,u=b.length;u--;){var o=b[u],a=E(o[0],o[1],p,d);if(a>=0&&(o[0]=Math.min(o[0],p),o[1]=Math.max(o[1],d),f=!0,a/(d-p)>.5))return}if(f||b.push([p,d]),this.config.renderTextTracksNatively){var i=this.captionsTracks[n];this.Cues.newCue(i,p,d,c)}else{var v=this.Cues.newCue(null,p,d,c);this.hls.trigger(R.Events.CUES_PARSED,{type:"captions",cues:v,track:n})}},r.onInitPtsFound=function(n,p){var d=this,c=p.frag,b=p.id,f=p.initPTS,u=p.timescale,o=this.unparsedVttFrags;b==="main"&&(this.initPTS[c.cc]=f,this.timescale[c.cc]=u),o.length&&(this.unparsedVttFrags=[],o.forEach(function(a){d.onFragLoaded(R.Events.FRAG_LOADED,a)}))},r.getExistingTrack=function(n){var p=this.media;if(p)for(var d=0;d<p.textTracks.length;d++){var c=p.textTracks[d];if(c[n])return c}return null},r.createCaptionsTrack=function(n){this.config.renderTextTracksNatively?this.createNativeTrack(n):this.createNonNativeTrack(n)},r.createNativeTrack=function(n){if(this.captionsTracks[n])return;var p=this.captionsProperties,d=this.captionsTracks,c=this.media,b=p[n],f=b.label,u=b.languageCode,o=this.getExistingTrack(n);if(o)d[n]=o,Object(_.clearCurrentCues)(d[n]),Object(_.sendAddTrackEvent)(d[n],c);else{var a=this.createTextTrack("captions",f,u);a&&(a[n]=!0,d[n]=a)}},r.createNonNativeTrack=function(n){if(this.nonNativeCaptionsTracks[n])return;var p=this.captionsProperties[n];if(!p)return;var d=p.label,c={_id:n,label:d,kind:"captions",default:p.media?!!p.media.default:!1,closedCaptions:p.media};this.nonNativeCaptionsTracks[n]=c,this.hls.trigger(R.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[c]})},r.createTextTrack=function(n,p,d){var c=this.media;return c?c.addTextTrack(n,p,d):void 0},r.onMediaAttaching=function(n,p){this.media=p.media,this._cleanTracks()},r.onMediaDetaching=function(){var n=this.captionsTracks;Object.keys(n).forEach(function(p){Object(_.clearCurrentCues)(n[p]),delete n[p]}),this.nonNativeCaptionsTracks={}},r.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=x(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},r._cleanTracks=function(){var n=this.media;if(!n)return;var p=n.textTracks;if(p)for(var d=0;d<p.length;d++)Object(_.clearCurrentCues)(p[d])},r.onSubtitleTracksUpdated=function(n,p){var d=this;this.textTracks=[];var c=p.subtitleTracks||[],b=c.some(function(a){return a.textCodec===A.IMSC1_CODEC});if(this.config.enableWebVTT||b&&this.config.enableIMSC1){var f=this.tracks&&c&&this.tracks.length===c.length;if(this.tracks=c||[],this.config.renderTextTracksNatively){var u=this.media?this.media.textTracks:[];this.tracks.forEach(function(a,i){var v;if(i<u.length){for(var g=null,m=0;m<u.length;m++)if(T(u[m],a)){g=u[m];break}g&&(v=g)}v?Object(_.clearCurrentCues)(v):(v=d.createTextTrack("subtitles",a.name,a.lang),v&&(v.mode="disabled")),v&&(v.groupId=a.groupId,d.textTracks.push(v))})}else if(!f&&this.tracks&&this.tracks.length){var o=this.tracks.map(function(a){return{label:a.name,kind:a.type.toLowerCase(),default:a.default,subtitleTrack:a}});this.hls.trigger(R.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:o})}}},r.onManifestLoaded=function(n,p){var d=this;this.config.enableCEA708Captions&&p.captions&&p.captions.forEach(function(c){var b=/(?:CC|SERVICE)([1-4])/.exec(c.instreamId);if(!b)return;var f="textTrack"+b[1],u=d.captionsProperties[f];if(!u)return;u.label=c.name,c.lang&&(u.languageCode=c.lang),u.media=c})},r.onFragLoading=function(n,p){var d=this.cea608Parser1,c=this.cea608Parser2,b=this.lastSn,f=this.lastPartIndex;if(!this.enabled||!(d&&c))return;if(p.frag.type===y.PlaylistLevelType.MAIN){var u,o,a=p.frag.sn,i=(u=p==null||((o=p.part)===null||o===void 0)?void 0:o.index)!=null?u:-1;a===b+1||a===b&&i===f+1||(d.reset(),c.reset()),this.lastSn=a,this.lastPartIndex=i}},r.onFragLoaded=function(n,p){var d=p.frag,c=p.payload,b=this.initPTS,f=this.unparsedVttFrags;if(d.type===y.PlaylistLevelType.SUBTITLE)if(c.byteLength){if(!Object(B.isFiniteNumber)(b[d.cc])){f.push(p),b.length&&this.hls.trigger(R.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:new Error("Missing initial subtitle PTS")});return}var u=d.decryptdata;if(u==null||u.key==null||u.method!=="AES-128"){var o=this.tracks[d.level],a=this.vttCCs;a[d.cc]||(a[d.cc]={start:d.start,prevCC:this.prevCC,new:!0},this.prevCC=d.cc),o&&o.textCodec===A.IMSC1_CODEC?this._parseIMSC1(d,c):this._parseVTTs(d,c,a)}}else this.hls.trigger(R.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:new Error("Empty subtitle payload")})},r._parseIMSC1=function(n,p){var d=this,c=this.hls;Object(A.parseIMSC1)(p,this.initPTS[n.cc],this.timescale[n.cc],function(b){d._appendCues(b,n.level),c.trigger(R.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:n})},function(b){S.logger.log("Failed to parse IMSC1: "+b),c.trigger(R.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:b})})},r._parseVTTs=function(n,p,d){var c=this,b=this.hls;Object(O.parseWebVTT)(p,this.initPTS[n.cc],this.timescale[n.cc],d,n.cc,n.start,function(f){c._appendCues(f,n.level),b.trigger(R.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:n})},function(f){c._fallbackToIMSC1(n,p),S.logger.log("Failed to parse VTT cue: "+f),b.trigger(R.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:f})})},r._fallbackToIMSC1=function(n,p){var d=this,c=this.tracks[n.level];c.textCodec||Object(A.parseIMSC1)(p,this.initPTS[n.cc],this.timescale[n.cc],function(){c.textCodec=A.IMSC1_CODEC,d._parseIMSC1(n,p)},function(){c.textCodec="wvtt"})},r._appendCues=function(n,p){var d=this.hls;if(this.config.renderTextTracksNatively){var c=this.textTracks[p];if(c.mode==="disabled")return;n.forEach(function(u){return Object(_.addCueToTrack)(c,u)})}else{var b=this.tracks[p],f=b.default?"default":"subtitles"+p;d.trigger(R.Events.CUES_PARSED,{type:"subtitles",cues:n,track:f})}},r.onFragDecrypted=function(n,p){var d=p.frag;if(d.type===y.PlaylistLevelType.SUBTITLE){if(!Object(B.isFiniteNumber)(this.initPTS[d.cc])){this.unparsedVttFrags.push(p);return}this.onFragLoaded(R.Events.FRAG_LOADED,p)}},r.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},r.onFragParsingUserdata=function(n,p){var d=this.cea608Parser1,c=this.cea608Parser2;if(!this.enabled||!(d&&c))return;for(var b=0;b<p.samples.length;b++){var f=p.samples[b].bytes;if(f){var u=this.extractCea608Data(f);d.addData(p.samples[b].pts,u[0]),c.addData(p.samples[b].pts,u[1])}}},r.onBufferFlushing=function(n,p){var d=p.startOffset,c=p.endOffset,b=p.endOffsetSubtitles,f=p.type,u=this.media;if(!u||u.currentTime<c)return;if(!f||f==="video"){var o=this.captionsTracks;Object.keys(o).forEach(function(i){return Object(_.removeCuesInRange)(o[i],d,c)})}if(this.config.renderTextTracksNatively&&(d===0&&b!==void 0)){var a=this.textTracks;Object.keys(a).forEach(function(i){return Object(_.removeCuesInRange)(a[i],d,b)})}},r.extractCea608Data=function(n){for(var p=n[0]&31,d=2,c=[[],[]],b=0;b<p;b++){var f=n[d++],u=127&n[d++],o=127&n[d++],a=(4&f)!==0,i=3&f;if(u===0&&o===0)continue;a&&((i===0||i===1)&&(c[i].push(u),c[i].push(o)))}return c},l}();function T(l,r){return l&&l.label===r.name&&!(l.textTrack1||l.textTrack2)}function E(l,r,s,n){return Math.min(r,n)-Math.max(l,s)}function x(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"default",function(){return B});var B=function(){function R(G,O){this.subtle=void 0,this.aesIV=void 0,this.subtle=G,this.aesIV=O}var L=R.prototype;return L.decrypt=function(O,_){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},_,O)},R}()},"./src/crypt/aes-decryptor.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"removePadding",function(){return R}),D.d(j,"default",function(){return L});var B=D("./src/utils/typed-array.ts");function R(G){var O=G.byteLength,_=O&&new DataView(G.buffer).getUint8(O-1);return _?Object(B.sliceUint8)(G,0,O-_):G}var L=function(){function G(){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()}var O=G.prototype;return O.uint8ArrayToUint32Array_=function(A){for(var y=new DataView(A),S=new Uint32Array(4),C=0;C<4;C++)S[C]=y.getUint32(C*4);return S},O.initTable=function(){var A=this.sBox,y=this.invSBox,S=this.subMix,C=S[0],T=S[1],E=S[2],x=S[3],l=this.invSubMix,r=l[0],s=l[1],n=l[2],p=l[3],d=new Uint32Array(256),c=0,b=0,f=0;for(f=0;f<256;f++)f<128?d[f]=f<<1:d[f]=f<<1^283;for(f=0;f<256;f++){var u=b^b<<1^b<<2^b<<3^b<<4;u=u>>>8^u&255^99,A[c]=u,y[u]=c;var o=d[c],a=d[o],i=d[a],v=d[u]*257^u*16843008;C[c]=v<<24|v>>>8,T[c]=v<<16|v>>>16,E[c]=v<<8|v>>>24,x[c]=v,v=i*16843009^a*65537^o*257^c*16843008,r[u]=v<<24|v>>>8,s[u]=v<<16|v>>>16,n[u]=v<<8|v>>>24,p[u]=v,c?(c=o^d[d[d[i^o]]],b^=d[d[b]]):c=b=1}},O.expandKey=function(A){for(var y=this.uint8ArrayToUint32Array_(A),S=!0,C=0;C<y.length&&S;)S=y[C]===this.key[C],C++;if(S)return;this.key=y;var T=this.keySize=y.length;if(T!==4&&T!==6&&T!==8)throw new Error("Invalid aes key size="+T);var E=this.ksRows=(T+6+1)*4,x,l,r=this.keySchedule=new Uint32Array(E),s=this.invKeySchedule=new Uint32Array(E),n=this.sBox,p=this.rcon,d=this.invSubMix,c=d[0],b=d[1],f=d[2],u=d[3],o,a;for(x=0;x<E;x++){if(x<T){o=r[x]=y[x];continue}a=o,x%T===0?(a=a<<8|a>>>24,a=n[a>>>24]<<24|n[a>>>16&255]<<16|n[a>>>8&255]<<8|n[a&255],a^=p[x/T|0]<<24):T>6&&x%T===4&&(a=n[a>>>24]<<24|n[a>>>16&255]<<16|n[a>>>8&255]<<8|n[a&255]),r[x]=o=(r[x-T]^a)>>>0}for(l=0;l<E;l++)x=E-l,l&3?a=r[x]:a=r[x-4],l<4||x<=4?s[l]=a:s[l]=c[n[a>>>24]]^b[n[a>>>16&255]]^f[n[a>>>8&255]]^u[n[a&255]],s[l]=s[l]>>>0},O.networkToHostOrderSwap=function(A){return A<<24|(A&65280)<<8|(A&16711680)>>8|A>>>24},O.decrypt=function(A,y,S){for(var C=this.keySize+6,T=this.invKeySchedule,E=this.invSBox,x=this.invSubMix,l=x[0],r=x[1],s=x[2],n=x[3],p=this.uint8ArrayToUint32Array_(S),d=p[0],c=p[1],b=p[2],f=p[3],u=new Int32Array(A),o=new Int32Array(u.length),a,i,v,g,m,w,P,N,K,Y,ne,q,se,fe,le=this.networkToHostOrderSwap;y<u.length;){for(K=le(u[y]),Y=le(u[y+1]),ne=le(u[y+2]),q=le(u[y+3]),m=K^T[0],w=q^T[1],P=ne^T[2],N=Y^T[3],se=4,fe=1;fe<C;fe++)a=l[m>>>24]^r[w>>16&255]^s[P>>8&255]^n[N&255]^T[se],i=l[w>>>24]^r[P>>16&255]^s[N>>8&255]^n[m&255]^T[se+1],v=l[P>>>24]^r[N>>16&255]^s[m>>8&255]^n[w&255]^T[se+2],g=l[N>>>24]^r[m>>16&255]^s[w>>8&255]^n[P&255]^T[se+3],m=a,w=i,P=v,N=g,se=se+4;a=E[m>>>24]<<24^E[w>>16&255]<<16^E[P>>8&255]<<8^E[N&255]^T[se],i=E[w>>>24]<<24^E[P>>16&255]<<16^E[N>>8&255]<<8^E[m&255]^T[se+1],v=E[P>>>24]<<24^E[N>>16&255]<<16^E[m>>8&255]<<8^E[w&255]^T[se+2],g=E[N>>>24]<<24^E[m>>16&255]<<16^E[w>>8&255]<<8^E[P&255]^T[se+3],o[y]=le(a^d),o[y+1]=le(g^c),o[y+2]=le(v^b),o[y+3]=le(i^f),d=K,c=Y,b=ne,f=q,y=y+4}return o.buffer},G}()},"./src/crypt/decrypter.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"default",function(){return y});var B=D("./src/crypt/aes-crypto.ts"),R=D("./src/crypt/fast-aes-key.ts"),L=D("./src/crypt/aes-decryptor.ts"),G=D("./src/utils/logger.ts"),O=D("./src/utils/mp4-tools.ts"),_=D("./src/utils/typed-array.ts"),A=16,y=function(){function S(T,E,x){var l=x===void 0?{}:x,r=l.removePKCS7Padding,s=r===void 0?!0:r;if(this.logEnabled=!0,this.observer=void 0,this.config=void 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.observer=T,this.config=E,this.removePKCS7Padding=s,s)try{var n=self.crypto;n&&(this.subtle=n.subtle||n.webkitSubtle)}catch(p){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var C=S.prototype;return C.destroy=function(){this.observer=null},C.isSync=function(){return this.config.enableSoftwareAES},C.flush=function(){var E=this.currentResult;if(!E){this.reset();return}var x=new Uint8Array(E);return this.reset(),this.removePKCS7Padding?Object(L.removePadding)(x):x},C.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},C.decrypt=function(E,x,l,r){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(E),x,l);var s=this.flush();s&&r(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(E),x,l).then(r)},C.softwareDecrypt=function(E,x,l){var r=this.currentIV,s=this.currentResult,n=this.remainderData;this.logOnce("JS AES decrypt"),n&&(E=Object(O.appendUint8Array)(n,E),this.remainderData=null);var p=this.getValidChunk(E);if(!p.length)return null;r&&(l=r);var d=this.softwareDecrypter;d||(d=this.softwareDecrypter=new L.default),d.expandKey(x);var c=s;return this.currentResult=d.decrypt(p.buffer,0,l),this.currentIV=Object(_.sliceUint8)(p,-16).buffer,c||null},C.webCryptoDecrypt=function(E,x,l){var r=this,s=this.subtle;return(this.key!==x||!this.fastAesKey)&&(this.key=x,this.fastAesKey=new R.default(s,x)),this.fastAesKey.expandKey().then(function(n){if(!s)return Promise.reject(new Error("web crypto not initialized"));var p=new B.default(s,l);return p.decrypt(E.buffer,n)}).catch(function(n){return r.onWebCryptoError(n,E,x,l)})},C.onWebCryptoError=function(E,x,l,r){return G.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",E),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(x,l,r)},C.getValidChunk=function(E){var x=E,l=E.length-E.length%A;return l!==E.length&&(x=Object(_.sliceUint8)(E,0,l),this.remainderData=Object(_.sliceUint8)(E,l)),x},C.logOnce=function(E){if(!this.logEnabled)return;G.logger.log("[decrypter.ts]: "+E),this.logEnabled=!1},S}()},"./src/crypt/fast-aes-key.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"default",function(){return B});var B=function(){function R(G,O){this.subtle=void 0,this.key=void 0,this.subtle=G,this.key=O}var L=R.prototype;return L.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},R}()},"./src/demux/aacdemuxer.ts":function(he,j,D){"use strict";D.r(j);var B=D("./src/demux/base-audio-demuxer.ts"),R=D("./src/demux/adts.ts"),L=D("./src/utils/logger.ts"),G=D("./src/demux/id3.ts");function O(y,S){y.prototype=Object.create(S.prototype),y.prototype.constructor=y,_(y,S)}function _(y,S){return _=Object.setPrototypeOf||function(T,E){return T.__proto__=E,T},_(y,S)}var A=function(y){O(S,y);function S(T,E){var x;return x=y.call(this)||this,x.observer=void 0,x.config=void 0,x.observer=T,x.config=E,x}var C=S.prototype;return C.resetInitSegment=function(E,x,l){y.prototype.resetInitSegment.call(this,E,x,l),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:E,duration:l,inputTimeScale:9e4,dropped:0}},S.probe=function(E){if(!E)return!1;for(var x=G.getID3Data(E,0)||[],l=x.length,r=E.length;l<r;l++)if(R.probe(E,l))return L.logger.log("ADTS sync word found !"),!0;return!1},C.canParse=function(E,x){return R.canParse(E,x)},C.appendFrame=function(E,x,l){R.initTrackConfig(E,this.observer,x,l,E.manifestCodec);var r=R.appendFrame(E,x,l,this.initPTS,this.frameIndex);if(r&&r.missing===0)return r},S}(B.default);A.minProbeByteLength=9,j.default=A},"./src/demux/adts.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"getAudioConfig",function(){return G}),D.d(j,"isHeaderPattern",function(){return O}),D.d(j,"getHeaderLength",function(){return _}),D.d(j,"getFullFrameLength",function(){return A}),D.d(j,"canGetFrameLength",function(){return y}),D.d(j,"isHeader",function(){return S}),D.d(j,"canParse",function(){return C}),D.d(j,"probe",function(){return T}),D.d(j,"initTrackConfig",function(){return E}),D.d(j,"getFrameDuration",function(){return x}),D.d(j,"parseFrameHeader",function(){return l}),D.d(j,"appendFrame",function(){return r});var B=D("./src/utils/logger.ts"),R=D("./src/errors.ts"),L=D("./src/events.ts");function G(s,n,p,d){var c,b,f,u,o=navigator.userAgent.toLowerCase(),a=d,i=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];c=((n[p+2]&192)>>>6)+1;var v=(n[p+2]&60)>>>2;if(v>i.length-1){s.trigger(L.Events.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+v});return}return f=(n[p+2]&1)<<2,f|=(n[p+3]&192)>>>6,B.logger.log("manifest codec:"+d+", ADTS type:"+c+", samplingIndex:"+v),/firefox/i.test(o)?v>=6?(c=5,u=new Array(4),b=v-3):(c=2,u=new Array(2),b=v):o.indexOf("android")!==-1?(c=2,u=new Array(2),b=v):(c=5,u=new Array(4),d&&(d.indexOf("mp4a.40.29")!==-1||d.indexOf("mp4a.40.5")!==-1)||!d&&v>=6?b=v-3:((d&&d.indexOf("mp4a.40.2")!==-1&&(v>=6&&f===1||/vivaldi/i.test(o))||!d&&f===1)&&(c=2,u=new Array(2)),b=v)),u[0]=c<<3,u[0]|=(v&14)>>1,u[1]|=(v&1)<<7,u[1]|=f<<3,c===5&&(u[1]|=(b&14)>>1,u[2]=(b&1)<<7,u[2]|=2<<2,u[3]=0),{config:u,samplerate:i[v],channelCount:f,codec:"mp4a.40."+c,manifestCodec:a}}function O(s,n){return s[n]===255&&(s[n+1]&246)===240}function _(s,n){return s[n+1]&1?7:9}function A(s,n){return(s[n+3]&3)<<11|s[n+4]<<3|(s[n+5]&224)>>>5}function y(s,n){return n+5<s.length}function S(s,n){return n+1<s.length&&O(s,n)}function C(s,n){return y(s,n)&&O(s,n)&&A(s,n)<=s.length-n}function T(s,n){if(S(s,n)){var p=_(s,n);if(n+p>=s.length)return!1;var d=A(s,n);if(d<=p)return!1;var c=n+d;return c===s.length||S(s,c)}return!1}function E(s,n,p,d,c){if(!s.samplerate){var b=G(n,p,d,c);if(!b)return;s.config=b.config,s.samplerate=b.samplerate,s.channelCount=b.channelCount,s.codec=b.codec,s.manifestCodec=b.manifestCodec,B.logger.log("parsed codec:"+s.codec+", rate:"+b.samplerate+", channels:"+b.channelCount)}}function x(s){return 1024*9e4/s}function l(s,n,p,d,c){var b=_(s,n),f=A(s,n);if(f-=b,f>0){var u=p+d*c;return{headerLength:b,frameLength:f,stamp:u}}}function r(s,n,p,d,c){var b=x(s.samplerate),f=l(n,p,d,c,b);if(f){var u=f.frameLength,o=f.headerLength,a=f.stamp,i=o+u,v=Math.max(0,p+i-n.length),g;v?(g=new Uint8Array(i-o),g.set(n.subarray(p+o,n.length),0)):g=n.subarray(p+o,p+i);var m={unit:g,pts:a};return v||s.samples.push(m),{sample:m,length:i,missing:v}}}},"./src/demux/base-audio-demuxer.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"initPTSFn",function(){return A});var B=D("./src/polyfills/number.ts"),R=D("./src/demux/id3.ts"),L=D("./src/demux/dummy-demuxed-track.ts"),G=D("./src/utils/mp4-tools.ts"),O=D("./src/utils/typed-array.ts"),_=function(){function y(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var S=y.prototype;return S.resetInitSegment=function(T,E,x){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},S.resetTimeStamp=function(){},S.resetContiguity=function(){},S.canParse=function(T,E){return!1},S.appendFrame=function(T,E,x){},S.demux=function(T,E){this.cachedData&&(T=Object(G.appendUint8Array)(this.cachedData,T),this.cachedData=null);var x=R.getID3Data(T,0),l=x?x.length:0,r,s,n=this._audioTrack,p=this._id3Track,d=x?R.getTimeStamp(x):void 0,c=T.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=A(d,E)),x&&x.length>0&&p.samples.push({pts:this.initPTS,dts:this.initPTS,data:x}),s=this.initPTS;l<c;){if(this.canParse(T,l)){var b=this.appendFrame(n,T,l);b?(this.frameIndex++,s=b.sample.pts,l+=b.length,r=l):l=c}else R.canParse(T,l)?(x=R.getID3Data(T,l),p.samples.push({pts:s,dts:s,data:x}),l+=x.length,r=l):l++;if(l===c&&r!==c){var f=Object(O.sliceUint8)(T,r);this.cachedData?this.cachedData=Object(G.appendUint8Array)(this.cachedData,f):this.cachedData=f}}return{audioTrack:n,avcTrack:Object(L.dummyTrack)(),id3Track:p,textTrack:Object(L.dummyTrack)()}},S.demuxSampleAes=function(T,E,x){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},S.flush=function(T){var E=this.cachedData;return E&&(this.cachedData=null,this.demux(E,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(L.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(L.dummyTrack)()}},S.destroy=function(){},y}(),A=function(S,C){return Object(B.isFiniteNumber)(S)?S*90:C*9e4};j.default=_},"./src/demux/chunk-cache.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"default",function(){return B});var B=function(){function L(){this.chunks=[],this.dataLength=0}var G=L.prototype;return G.push=function(_){this.chunks.push(_),this.dataLength+=_.length},G.flush=function(){var _=this.chunks,A=this.dataLength,y;if(_.length)_.length===1?y=_[0]:y=R(_,A);else return new Uint8Array(0);return this.reset(),y},G.reset=function(){this.chunks.length=0,this.dataLength=0},L}();function R(L,G){for(var O=new Uint8Array(G),_=0,A=0;A<L.length;A++){var y=L[A];O.set(y,_),_+=y.length}return O}},"./src/demux/dummy-demuxed-track.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"dummyTrack",function(){return B});function B(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(he,j,D){"use strict";D.r(j);var B=D("./src/utils/logger.ts"),R=function(){function L(O){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=O,this.bytesAvailable=O.byteLength,this.word=0,this.bitsAvailable=0}var G=L.prototype;return G.loadWord=function(){var _=this.data,A=this.bytesAvailable,y=_.byteLength-A,S=new Uint8Array(4),C=Math.min(4,A);if(C===0)throw new Error("no bytes available");S.set(_.subarray(y,y+C)),this.word=new DataView(S.buffer).getUint32(0),this.bitsAvailable=C*8,this.bytesAvailable-=C},G.skipBits=function(_){var A;this.bitsAvailable>_?(this.word<<=_,this.bitsAvailable-=_):(_-=this.bitsAvailable,A=_>>3,_-=A>>3,this.bytesAvailable-=A,this.loadWord(),this.word<<=_,this.bitsAvailable-=_)},G.readBits=function(_){var A=Math.min(this.bitsAvailable,_),y=this.word>>>32-A;return _>32&&B.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=A,this.bitsAvailable>0?this.word<<=A:this.bytesAvailable>0&&this.loadWord(),A=_-A,A>0&&this.bitsAvailable?y<<A|this.readBits(A):y},G.skipLZ=function(){var _;for(_=0;_<this.bitsAvailable;++_)if((this.word&2147483648>>>_)!==0)return this.word<<=_,this.bitsAvailable-=_,_;return this.loadWord(),_+this.skipLZ()},G.skipUEG=function(){this.skipBits(1+this.skipLZ())},G.skipEG=function(){this.skipBits(1+this.skipLZ())},G.readUEG=function(){var _=this.skipLZ();return this.readBits(_+1)-1},G.readEG=function(){var _=this.readUEG();return 1&_?1+_>>>1:-1*(_>>>1)},G.readBoolean=function(){return this.readBits(1)===1},G.readUByte=function(){return this.readBits(8)},G.readUShort=function(){return this.readBits(16)},G.readUInt=function(){return this.readBits(32)},G.skipScalingList=function(_){for(var A=8,y=8,S,C=0;C<_;C++)y!==0&&(S=this.readEG(),y=(A+S+256)%256),A=y===0?A:y},G.readSPS=function(){var _=0,A=0,y=0,S=0,C,T,E,x=this.readUByte.bind(this),l=this.readBits.bind(this),r=this.readUEG.bind(this),s=this.readBoolean.bind(this),n=this.skipBits.bind(this),p=this.skipEG.bind(this),d=this.skipUEG.bind(this),c=this.skipScalingList.bind(this);x();var b=x();if(l(5),n(3),x(),d(),b===100||b===110||b===122||b===244||b===44||b===83||b===86||b===118||b===128){var f=r();if(f===3&&n(1),d(),d(),n(1),s())for(T=f!==3?8:12,E=0;E<T;E++)s()&&(E<6?c(16):c(64))}d();var u=r();if(u===0)r();else if(u===1)for(n(1),p(),p(),C=r(),E=0;E<C;E++)p();d(),n(1);var o=r(),a=r(),i=l(1);i===0&&n(1),n(1),s()&&(_=r(),A=r(),y=r(),S=r());var v=[1,1];if(s()&&s()){var g=x();switch(g){case 1:v=[1,1];break;case 2:v=[12,11];break;case 3:v=[10,11];break;case 4:v=[16,11];break;case 5:v=[40,33];break;case 6:v=[24,11];break;case 7:v=[20,11];break;case 8:v=[32,11];break;case 9:v=[80,33];break;case 10:v=[18,11];break;case 11:v=[15,11];break;case 12:v=[64,33];break;case 13:v=[160,99];break;case 14:v=[4,3];break;case 15:v=[3,2];break;case 16:v=[2,1];break;case 255:{v=[x()<<8|x(),x()<<8|x()];break}}}return{width:Math.ceil((o+1)*16-_*2-A*2),height:(2-i)*(a+1)*16-(i?2:4)*(y+S),pixelRatio:v}},G.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},L}();j.default=R},"./src/demux/id3.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"isHeader",function(){return B}),D.d(j,"isFooter",function(){return R}),D.d(j,"getID3Data",function(){return L}),D.d(j,"canParse",function(){return O}),D.d(j,"getTimeStamp",function(){return _}),D.d(j,"isTimeStampFrame",function(){return A}),D.d(j,"getID3Frames",function(){return S}),D.d(j,"decodeFrame",function(){return C}),D.d(j,"utf8ArrayToStr",function(){return r}),D.d(j,"testables",function(){return s});var B=function(c,b){return b+10<=c.length&&(c[b]===73&&c[b+1]===68&&c[b+2]===51&&(c[b+3]<255&&c[b+4]<255&&(c[b+6]<128&&c[b+7]<128&&c[b+8]<128&&c[b+9]<128)))},R=function(c,b){return b+10<=c.length&&(c[b]===51&&c[b+1]===68&&c[b+2]===73&&(c[b+3]<255&&c[b+4]<255&&(c[b+6]<128&&c[b+7]<128&&c[b+8]<128&&c[b+9]<128)))},L=function(c,b){for(var f=b,u=0;B(c,b);){u+=10;var o=G(c,b+6);u+=o,R(c,b+10)&&(u+=10),b+=u}return u>0?c.subarray(f,f+u):void 0},G=function(c,b){var f=0;return f=(c[b]&127)<<21,f|=(c[b+1]&127)<<14,f|=(c[b+2]&127)<<7,f|=c[b+3]&127,f},O=function(c,b){return B(c,b)&&G(c,b+6)+10<=c.length-b},_=function(c){for(var b=S(c),f=0;f<b.length;f++){var u=b[f];if(A(u))return l(u)}return},A=function(c){return c&&c.key==="PRIV"&&c.info==="com.apple.streaming.transportStreamTimestamp"},y=function(c){var b=String.fromCharCode(c[0],c[1],c[2],c[3]),f=G(c,4),u=10;return{type:b,size:f,data:c.subarray(u,u+f)}},S=function(c){for(var b=0,f=[];B(c,b);){var u=G(c,b+6);b+=10;for(var o=b+u;b+8<o;){var a=y(c.subarray(b)),i=C(a);i&&f.push(i),b+=a.size+10}R(c,b)&&(b+=10)}return f},C=function(c){return c.type==="PRIV"?T(c):c.type[0]==="W"?x(c):E(c)},T=function(c){if(c.size<2)return;var b=r(c.data,!0),f=new Uint8Array(c.data.subarray(b.length+1));return{key:c.type,info:b,data:f.buffer}},E=function(c){if(c.size<2)return;if(c.type==="TXXX"){var b=1,f=r(c.data.subarray(b),!0);b+=f.length+1;var u=r(c.data.subarray(b));return{key:c.type,info:f,data:u}}var o=r(c.data.subarray(1));return{key:c.type,data:o}},x=function(c){if(c.type==="WXXX"){if(c.size<2)return;var b=1,f=r(c.data.subarray(b),!0);b+=f.length+1;var u=r(c.data.subarray(b));return{key:c.type,info:f,data:u}}var o=r(c.data);return{key:c.type,data:o}},l=function(c){if(c.data.byteLength===8){var b=new Uint8Array(c.data),f=b[3]&1,u=(b[4]<<23)+(b[5]<<15)+(b[6]<<7)+b[7];return u/=45,f&&(u+=4772185884e-2),Math.round(u)}return},r=function(c,b){b===void 0&&(b=!1);var f=p();if(f){var u=f.decode(c);if(b){var o=u.indexOf("\0");return o!==-1?u.substring(0,o):u}return u.replace(/\0/g,"")}for(var a=c.length,i,v,g,m="",w=0;w<a;){if(i=c[w++],i===0&&b)return m;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:m+=String.fromCharCode(i);break;case 12:case 13:v=c[w++],m+=String.fromCharCode((i&31)<<6|v&63);break;case 14:v=c[w++],g=c[w++],m+=String.fromCharCode((i&15)<<12|(v&63)<<6|(g&63)<<0);break;default:}}return m},s={decodeTextFrame:E},n;function p(){return!n&&typeof self.TextDecoder!="undefined"&&(n=new self.TextDecoder("utf-8")),n}},"./src/demux/mp3demuxer.ts":function(he,j,D){"use strict";D.r(j);var B=D("./src/demux/base-audio-demuxer.ts"),R=D("./src/demux/id3.ts"),L=D("./src/utils/logger.ts"),G=D("./src/demux/mpegaudio.ts");function O(y,S){y.prototype=Object.create(S.prototype),y.prototype.constructor=y,_(y,S)}function _(y,S){return _=Object.setPrototypeOf||function(T,E){return T.__proto__=E,T},_(y,S)}var A=function(y){O(S,y);function S(){return y.apply(this,arguments)||this}var C=S.prototype;return C.resetInitSegment=function(E,x,l){y.prototype.resetInitSegment.call(this,E,x,l),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:E,duration:l,inputTimeScale:9e4,dropped:0}},S.probe=function(E){if(!E)return!1;for(var x=R.getID3Data(E,0)||[],l=x.length,r=E.length;l<r;l++)if(G.probe(E,l))return L.logger.log("MPEG Audio sync word found !"),!0;return!1},C.canParse=function(E,x){return G.canParse(E,x)},C.appendFrame=function(E,x,l){return this.initPTS===null?void 0:G.appendFrame(E,x,l,this.initPTS,this.frameIndex)},S}(B.default);A.minProbeByteLength=4,j.default=A},"./src/demux/mp4demuxer.ts":function(he,j,D){"use strict";D.r(j);var B=D("./src/utils/mp4-tools.ts"),R=D("./src/demux/dummy-demuxed-track.ts"),L=function(){function G(_,A){this.remainderData=null,this.config=void 0,this.config=A}var O=G.prototype;return O.resetTimeStamp=function(){},O.resetInitSegment=function(){},O.resetContiguity=function(){},G.probe=function(A){return Object(B.findBox)({data:A,start:0,end:Math.min(A.length,16384)},["moof"]).length>0},O.demux=function(A){var y=A,S=Object(R.dummyTrack)();if(this.config.progressive){this.remainderData&&(y=Object(B.appendUint8Array)(this.remainderData,A));var C=Object(B.segmentValidRange)(y);this.remainderData=C.remainder,S.samples=C.valid||new Uint8Array}else S.samples=y;return{audioTrack:Object(R.dummyTrack)(),avcTrack:S,id3Track:Object(R.dummyTrack)(),textTrack:Object(R.dummyTrack)()}},O.flush=function(){var A=Object(R.dummyTrack)();return A.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(R.dummyTrack)(),avcTrack:A,id3Track:Object(R.dummyTrack)(),textTrack:Object(R.dummyTrack)()}},O.demuxSampleAes=function(A,y,S){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},O.destroy=function(){},G}();L.minProbeByteLength=1024,j.default=L},"./src/demux/mpegaudio.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"appendFrame",function(){return _}),D.d(j,"parseHeader",function(){return A}),D.d(j,"isHeaderPattern",function(){return y}),D.d(j,"isHeader",function(){return S}),D.d(j,"canParse",function(){return C}),D.d(j,"probe",function(){return T});var B=null,R=[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],L=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],G=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],O=[0,1,1,4];function _(E,x,l,r,s){if(l+24>x.length)return;var n=A(x,l);if(n&&l+n.frameLength<=x.length){var p=n.samplesPerFrame*9e4/n.sampleRate,d=r+s*p,c={unit:x.subarray(l,l+n.frameLength),pts:d,dts:d};return E.config=[],E.channelCount=n.channelCount,E.samplerate=n.sampleRate,E.samples.push(c),{sample:c,length:n.frameLength,missing:0}}}function A(E,x){var l=E[x+1]>>3&3,r=E[x+1]>>1&3,s=E[x+2]>>4&15,n=E[x+2]>>2&3;if(l!==1&&s!==0&&s!==15&&n!==3){var p=E[x+2]>>1&1,d=E[x+3]>>6,c=l===3?3-r:r===3?3:4,b=R[c*14+s-1]*1e3,f=l===3?0:l===2?1:2,u=L[f*3+n],o=d===3?1:2,a=G[l][r],i=O[r],v=a*8*i,g=Math.floor(a*b/u+p)*i;if(B===null){var m=navigator.userAgent||"",w=m.match(/Chrome\/(\d+)/i);B=w?parseInt(w[1]):0}var P=!!B&&B<=87;return P&&r===2&&b>=224e3&&d===0&&(E[x+3]=E[x+3]|128),{sampleRate:u,channelCount:o,frameLength:g,samplesPerFrame:v}}}function y(E,x){return E[x]===255&&(E[x+1]&224)===224&&(E[x+1]&6)!==0}function S(E,x){return x+1<E.length&&y(E,x)}function C(E,x){var l=4;return y(E,x)&&l<=E.length-x}function T(E,x){if(x+1<E.length&&y(E,x)){var l=4,r=A(E,x),s=l;r!=null&&r.frameLength&&(s=r.frameLength);var n=x+s;return n===E.length||S(E,n)}return!1}},"./src/demux/sample-aes.ts":function(he,j,D){"use strict";D.r(j);var B=D("./src/crypt/decrypter.ts"),R=D("./src/demux/tsdemuxer.ts"),L=function(){function G(_,A,y){this.keyData=void 0,this.decrypter=void 0,this.keyData=y,this.decrypter=new B.default(_,A,{removePKCS7Padding:!1})}var O=G.prototype;return O.decryptBuffer=function(A,y){this.decrypter.decrypt(A,this.keyData.key.buffer,this.keyData.iv.buffer,y)},O.decryptAacSample=function(A,y,S,C){var T=A[y].unit,E=T.subarray(16,T.length-T.length%16),x=E.buffer.slice(E.byteOffset,E.byteOffset+E.length),l=this;this.decryptBuffer(x,function(r){var s=new Uint8Array(r);T.set(s,16),C||l.decryptAacSamples(A,y+1,S)})},O.decryptAacSamples=function(A,y,S){for(;;y++){if(y>=A.length){S();return}if(A[y].unit.length<32)continue;var C=this.decrypter.isSync();if(this.decryptAacSample(A,y,S,C),!C)return}},O.getAvcEncryptedData=function(A){for(var y=Math.floor((A.length-48)/160)*16+16,S=new Int8Array(y),C=0,T=32;T<=A.length-16;T+=160,C+=16)S.set(A.subarray(T,T+16),C);return S},O.getAvcDecryptedUnit=function(A,y){for(var S=new Uint8Array(y),C=0,T=32;T<=A.length-16;T+=160,C+=16)A.set(S.subarray(C,C+16),T);return A},O.decryptAvcSample=function(A,y,S,C,T,E){var x=Object(R.discardEPB)(T.data),l=this.getAvcEncryptedData(x),r=this;this.decryptBuffer(l.buffer,function(s){T.data=r.getAvcDecryptedUnit(x,s),E||r.decryptAvcSamples(A,y,S+1,C)})},O.decryptAvcSamples=function(A,y,S,C){if(A instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;y++,S=0){if(y>=A.length){C();return}for(var T=A[y].units;!(S>=T.length);S++){var E=T[S];if(E.data.length<=48||E.type!==1&&E.type!==5)continue;var x=this.decrypter.isSync();if(this.decryptAvcSample(A,y,S,C,E,x),!x)return}}},G}();j.default=L},"./src/demux/transmuxer-interface.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"default",function(){return T});var B=D("./node_modules/webworkify-webpack/index.js"),R=D.n(B),L=D("./src/events.ts"),G=D("./src/demux/transmuxer.ts"),O=D("./src/utils/logger.ts"),_=D("./src/errors.ts"),A=D("./src/utils/mediasource-helper.ts"),y=D("./node_modules/eventemitter3/index.js"),S=D.n(y),C=Object(A.getMediaSource)()||{isTypeSupported:function(){return!1}},T=function(){function E(l,r,s,n){var p=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=l,this.id=r,this.onTransmuxComplete=s,this.onFlush=n;var d=l.config,c=function(a,i){i=i||{},i.frag=p.frag,i.id=p.id,l.trigger(a,i)};this.observer=new y.EventEmitter,this.observer.on(L.Events.FRAG_DECRYPTED,c),this.observer.on(L.Events.ERROR,c);var b={mp4:C.isTypeSupported("video/mp4"),mpeg:C.isTypeSupported("audio/mpeg"),mp3:C.isTypeSupported('audio/mp4; codecs="mp3"')},f=navigator.vendor;if(d.enableWorker&&typeof Worker!="undefined"){O.logger.log("demuxing in webworker");var u;try{u=this.worker=B("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),u.addEventListener("message",this.onwmsg),u.onerror=function(o){l.trigger(L.Events.ERROR,{type:_.ErrorTypes.OTHER_ERROR,details:_.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(o.message+" ("+o.filename+":"+o.lineno+")")})},u.postMessage({cmd:"init",typeSupported:b,vendor:f,id:r,config:JSON.stringify(d)})}catch(o){O.logger.warn("Error in worker:",o),O.logger.error("Error while initializing DemuxerWorker, fallback to inline"),u&&self.URL.revokeObjectURL(u.objectURL),this.transmuxer=new G.default(this.observer,b,d,f,r),this.worker=null}}else this.transmuxer=new G.default(this.observer,b,d,f,r)}var x=E.prototype;return x.destroy=function(){var r=this.worker;if(r)r.removeEventListener("message",this.onwmsg),r.terminate(),this.worker=null;else{var s=this.transmuxer;s&&(s.destroy(),this.transmuxer=null)}var n=this.observer;n&&n.removeAllListeners(),this.observer=null},x.push=function(r,s,n,p,d,c,b,f,u,o){var a=this;u.transmuxing.start=self.performance.now();var i=this.transmuxer,v=this.worker,g=c?c.start:d.start,m=d.decryptdata,w=this.frag,P=!(w&&d.cc===w.cc),N=!(w&&u.level===w.level),K=w?u.sn-w.sn:-1,Y=this.part?u.part-this.part.index:1,ne=!N&&(K===1||K===0&&Y===1),q=self.performance.now();(N||K||d.stats.parsing.start===0)&&(d.stats.parsing.start=q),c&&(Y||!ne)&&(c.stats.parsing.start=q);var se=new G.TransmuxState(P,ne,f,N,g);if(!ne||P){O.logger.log("[transmuxer-interface, "+d.type+"]: Starting new transmux session for sn: "+u.sn+" p: "+u.part+" level: "+u.level+" id: "+u.id+`
discontinuity: `+P+`
trackSwitch: `+N+`
contiguous: `+ne+`
accurateTimeOffset: `+f+`
timeOffset: `+g);var fe=new G.TransmuxConfig(n,p,s,b,o);this.configureTransmuxer(fe)}if(this.frag=d,this.part=c,v)v.postMessage({cmd:"demux",data:r,decryptdata:m,chunkMeta:u,state:se},r instanceof ArrayBuffer?[r]:[]);else if(i){var le=i.push(r,m,u,se);Object(G.isPromise)(le)?le.then(function(ve){a.handleTransmuxComplete(ve)}):this.handleTransmuxComplete(le)}},x.flush=function(r){var s=this;r.transmuxing.start=self.performance.now();var n=this.transmuxer,p=this.worker;if(p)p.postMessage({cmd:"flush",chunkMeta:r});else if(n){var d=n.flush(r);Object(G.isPromise)(d)?d.then(function(c){s.handleFlushResult(c,r)}):this.handleFlushResult(d,r)}},x.handleFlushResult=function(r,s){var n=this;r.forEach(function(p){n.handleTransmuxComplete(p)}),this.onFlush(s)},x.onWorkerMessage=function(r){var s=r.data,n=this.hls;switch(s.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(s.data);break}case"flush":{this.onFlush(s.data);break}default:{s.data=s.data||{},s.data.frag=this.frag,s.data.id=this.id,n.trigger(s.event,s.data);break}}},x.configureTransmuxer=function(r){var s=this.worker,n=this.transmuxer;s?s.postMessage({cmd:"configure",config:r}):n&&n.configure(r)},x.handleTransmuxComplete=function(r){r.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(r)},E}()},"./src/demux/transmuxer-worker.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"default",function(){return _});var B=D("./src/demux/transmuxer.ts"),R=D("./src/events.ts"),L=D("./src/utils/logger.ts"),G=D("./node_modules/eventemitter3/index.js"),O=D.n(G);function _(T){var E=new G.EventEmitter,x=function(r,s){T.postMessage({event:r,data:s})};E.on(R.Events.FRAG_DECRYPTED,x),E.on(R.Events.ERROR,x),T.addEventListener("message",function(l){var r=l.data;switch(r.cmd){case"init":{var s=JSON.parse(r.config);T.transmuxer=new B.default(E,r.typeSupported,s,r.vendor,r.id),Object(L.enableLogs)(s.debug),x("init",null);break}case"configure":{T.transmuxer.configure(r.config);break}case"demux":{var n=T.transmuxer.push(r.data,r.decryptdata,r.chunkMeta,r.state);Object(B.isPromise)(n)?n.then(function(c){A(T,c)}):A(T,n);break}case"flush":{var p=r.chunkMeta,d=T.transmuxer.flush(p);Object(B.isPromise)(d)?d.then(function(c){S(T,c,p)}):S(T,d,p);break}default:break}})}function A(T,E){if(C(E.remuxResult))return;var x=[],l=E.remuxResult,r=l.audio,s=l.video;r&&y(x,r),s&&y(x,s),T.postMessage({event:"transmuxComplete",data:E},x)}function y(T,E){E.data1&&T.push(E.data1.buffer),E.data2&&T.push(E.data2.buffer)}function S(T,E,x){E.forEach(function(l){A(T,l)}),T.postMessage({event:"flush",data:x})}function C(T){return!T.audio&&!T.video&&!T.text&&!T.id3&&!T.initSegment}},"./src/demux/transmuxer.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"default",function(){return s}),D.d(j,"isPromise",function(){return d}),D.d(j,"TransmuxConfig",function(){return c}),D.d(j,"TransmuxState",function(){return b});var B=D("./src/events.ts"),R=D("./src/errors.ts"),L=D("./src/crypt/decrypter.ts"),G=D("./src/demux/aacdemuxer.ts"),O=D("./src/demux/mp4demuxer.ts"),_=D("./src/demux/tsdemuxer.ts"),A=D("./src/demux/mp3demuxer.ts"),y=D("./src/remux/mp4-remuxer.ts"),S=D("./src/remux/passthrough-remuxer.ts"),C=D("./src/demux/chunk-cache.ts"),T=D("./src/utils/mp4-tools.ts"),E=D("./src/utils/logger.ts"),x;try{x=self.performance.now.bind(self.performance)}catch(f){E.logger.debug("Unable to use Performance API on this environment"),x=self.Date.now}var l=[{demux:_.default,remux:y.default},{demux:O.default,remux:S.default},{demux:G.default,remux:y.default},{demux:A.default,remux:y.default}],r=1024;l.forEach(function(f){var u=f.demux;r=Math.max(r,u.minProbeByteLength)});var s=function(){function f(o,a,i,v,g){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=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.cache=new C.default,this.observer=o,this.typeSupported=a,this.config=i,this.vendor=v,this.id=g}var u=f.prototype;return u.configure=function(a){this.transmuxConfig=a,this.decrypter&&this.decrypter.reset()},u.push=function(a,i,v,g){var m=this,w=v.transmuxing;w.executeStart=x();var P=new Uint8Array(a),N=this.cache,K=this.config,Y=this.currentTransmuxState,ne=this.transmuxConfig;g&&(this.currentTransmuxState=g);var q=n(P,i);if(q&&q.method==="AES-128"){var se=this.getDecrypter();if(K.enableSoftwareAES){var fe=se.softwareDecrypt(P,q.key.buffer,q.iv.buffer);if(!fe)return w.executeEnd=x(),p(v);P=new Uint8Array(fe)}else return this.decryptionPromise=se.webCryptoDecrypt(P,q.key.buffer,q.iv.buffer).then(function(Te){var we=m.push(Te,null,v);return m.decryptionPromise=null,we}),this.decryptionPromise}var le=g||Y,ve=le.contiguous,Se=le.discontinuity,ke=le.trackSwitch,Ce=le.accurateTimeOffset,Le=le.timeOffset,ge=ne.audioCodec,me=ne.videoCodec,de=ne.defaultInitPts,nt=ne.duration,Qe=ne.initSegmentData;if((Se||ke)&&this.resetInitSegment(Qe,ge,me,nt),Se&&this.resetInitialTimestamp(de),ve||this.resetContiguity(),this.needsProbing(P,Se,ke)){if(N.dataLength){var qe=N.flush();P=Object(T.appendUint8Array)(qe,P)}this.configureTransmuxer(P,ne)}var We=this.transmux(P,q,Le,Ce,v),xe=this.currentTransmuxState;return xe.contiguous=!0,xe.discontinuity=!1,xe.trackSwitch=!1,w.executeEnd=x(),We},u.flush=function(a){var i=this,v=a.transmuxing;v.executeStart=x();var g=this.decrypter,m=this.cache,w=this.currentTransmuxState,P=this.decryptionPromise;if(P)return P.then(function(){return i.flush(a)});var N=[],K=w.timeOffset;if(g){var Y=g.flush();Y&&N.push(this.push(Y,null,a))}var ne=m.dataLength;m.reset();var q=this.demuxer,se=this.remuxer;if(!q||!se)return ne>=r&&this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),v.executeEnd=x(),[p(a)];var fe=q.flush(K);return d(fe)?fe.then(function(le){return i.flushRemux(N,le,a),N}):(this.flushRemux(N,fe,a),N)},u.flushRemux=function(a,i,v){var g=i.audioTrack,m=i.avcTrack,w=i.id3Track,P=i.textTrack,N=this.currentTransmuxState,K=N.accurateTimeOffset,Y=N.timeOffset;E.logger.log("[transmuxer.ts]: Flushed fragment "+v.sn+(v.part>-1?" p: "+v.part:"")+" of level "+v.level);var ne=this.remuxer.remux(g,m,w,P,Y,K,!0,this.id);a.push({remuxResult:ne,chunkMeta:v}),v.transmuxing.executeEnd=x()},u.resetInitialTimestamp=function(a){var i=this.demuxer,v=this.remuxer;if(!i||!v)return;i.resetTimeStamp(a),v.resetTimeStamp(a)},u.resetContiguity=function(){var a=this.demuxer,i=this.remuxer;if(!a||!i)return;a.resetContiguity(),i.resetNextTimestamp()},u.resetInitSegment=function(a,i,v,g){var m=this.demuxer,w=this.remuxer;if(!m||!w)return;m.resetInitSegment(i,v,g),w.resetInitSegment(a,i,v)},u.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},u.transmux=function(a,i,v,g,m){var w;return i&&i.method==="SAMPLE-AES"?w=this.transmuxSampleAes(a,i,v,g,m):w=this.transmuxUnencrypted(a,v,g,m),w},u.transmuxUnencrypted=function(a,i,v,g){var m=this.demuxer.demux(a,i,!1,!this.config.progressive),w=m.audioTrack,P=m.avcTrack,N=m.id3Track,K=m.textTrack,Y=this.remuxer.remux(w,P,N,K,i,v,!1,this.id);return{remuxResult:Y,chunkMeta:g}},u.transmuxSampleAes=function(a,i,v,g,m){var w=this;return this.demuxer.demuxSampleAes(a,i,v).then(function(P){var N=w.remuxer.remux(P.audioTrack,P.avcTrack,P.id3Track,P.textTrack,v,g,!1,w.id);return{remuxResult:N,chunkMeta:m}})},u.configureTransmuxer=function(a,i){for(var v=this.config,g=this.observer,m=this.typeSupported,w=this.vendor,P=i.audioCodec,N=i.defaultInitPts,K=i.duration,Y=i.initSegmentData,ne=i.videoCodec,q,se=0,fe=l.length;se<fe;se++)if(l[se].demux.probe(a)){q=l[se];break}q||(E.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),q={demux:O.default,remux:S.default});var le=this.demuxer,ve=this.remuxer,Se=q.remux,ke=q.demux;(!ve||!(ve instanceof Se))&&(this.remuxer=new Se(g,v,m,w)),(!le||!(le instanceof ke))&&(this.demuxer=new ke(g,v,m),this.probe=ke.probe),this.resetInitSegment(Y,P,ne,K),this.resetInitialTimestamp(N)},u.needsProbing=function(a,i,v){return!this.demuxer||!this.remuxer||i||v},u.getDecrypter=function(){var a=this.decrypter;return a||(a=this.decrypter=new L.default(this.observer,this.config)),a},f}();function n(f,u){var o=null;return f.byteLength>0&&u!=null&&u.key!=null&&u.iv!==null&&u.method!=null&&(o=u),o}var p=function(u){return{remuxResult:{},chunkMeta:u}};function d(f){return"then"in f&&f.then instanceof Function}var c=function(u,o,a,i,v){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=u,this.videoCodec=o,this.initSegmentData=a,this.duration=i,this.defaultInitPts=v},b=function(u,o,a,i,v){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=u,this.contiguous=o,this.accurateTimeOffset=a,this.trackSwitch=i,this.timeOffset=v}},"./src/demux/tsdemuxer.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"discardEPB",function(){return p});var B=D("./src/demux/adts.ts"),R=D("./src/demux/mpegaudio.ts"),L=D("./src/demux/exp-golomb.ts"),G=D("./src/demux/id3.ts"),O=D("./src/demux/sample-aes.ts"),_=D("./src/events.ts"),A=D("./src/utils/mp4-tools.ts"),y=D("./src/utils/logger.ts"),S=D("./src/errors.ts"),C={video:1,audio:2,id3:3,text:4},T=function(){function d(b,f,u){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=b,this.config=f,this.typeSupported=u}d.probe=function(f){var u=d.syncOffset(f);return u<0?!1:(u&&y.logger.warn("MPEG2-TS detected but first sync word found @ offset "+u+", junk ahead ?"),!0)},d.syncOffset=function(f){for(var u=Math.min(1e3,f.length-3*188),o=0;o<u;){if(f[o]===71&&f[o+188]===71&&f[o+2*188]===71)return o;o++}return-1},d.createTrack=function(f,u){return{container:f==="video"||f==="audio"?"video/mp2t":void 0,type:f,id:C[f],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:f==="audio"?u:void 0}};var c=d.prototype;return c.resetInitSegment=function(f,u,o){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=d.createTrack("video",o),this._audioTrack=d.createTrack("audio",o),this._id3Track=d.createTrack("id3",o),this._txtTrack=d.createTrack("text",o),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=f,this.videoCodec=u,this._duration=o},c.resetTimeStamp=function(){},c.resetContiguity=function(){var f=this._audioTrack,u=this._avcTrack,o=this._id3Track;f&&(f.pesData=null),u&&(u.pesData=null),o&&(o.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},c.demux=function(f,u,o,a){o===void 0&&(o=!1),a===void 0&&(a=!1),o||(this.sampleAes=null);var i,v=this._avcTrack,g=this._audioTrack,m=this._id3Track,w=v.pid,P=v.pesData,N=g.pid,K=m.pid,Y=g.pesData,ne=m.pesData,q=!1,se=this.pmtParsed,fe=this._pmtId,le=f.length;if(this.remainderData&&(f=Object(A.appendUint8Array)(this.remainderData,f),le=f.length,this.remainderData=null),le<188&&!a)return this.remainderData=f,{audioTrack:g,avcTrack:v,id3Track:m,textTrack:this._txtTrack};var ve=Math.max(0,d.syncOffset(f));le-=(le+ve)%188,le<f.byteLength&&!a&&(this.remainderData=new Uint8Array(f.buffer,le,f.buffer.byteLength-le));for(var Se=ve;Se<le;Se+=188)if(f[Se]===71){var ke=!!(f[Se+1]&64),Ce=((f[Se+1]&31)<<8)+f[Se+2],Le=(f[Se+3]&48)>>4,ge=void 0;if(Le>1){if(ge=Se+5+f[Se+4],ge===Se+188)continue}else ge=Se+4;switch(Ce){case w:ke&&(P&&(i=r(P))&&this.parseAVCPES(i,!1),P={data:[],size:0}),P&&(P.data.push(f.subarray(ge,Se+188)),P.size+=Se+188-ge);break;case N:ke&&(Y&&(i=r(Y))&&(g.isAAC?this.parseAACPES(i):this.parseMPEGPES(i)),Y={data:[],size:0}),Y&&(Y.data.push(f.subarray(ge,Se+188)),Y.size+=Se+188-ge);break;case K:ke&&(ne&&(i=r(ne))&&this.parseID3PES(i),ne={data:[],size:0}),ne&&(ne.data.push(f.subarray(ge,Se+188)),ne.size+=Se+188-ge);break;case 0:ke&&(ge+=f[ge]+1),fe=this._pmtId=x(f,ge);break;case fe:{ke&&(ge+=f[ge]+1);var me=l(f,ge,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,o);w=me.avc,w>0&&(v.pid=w),N=me.audio,N>0&&(g.pid=N,g.isAAC=me.isAAC),K=me.id3,K>0&&(m.pid=K),q&&!se&&(y.logger.log("reparse from beginning"),q=!1,Se=ve-188),se=this.pmtParsed=!0;break}case 17:case 8191:break;default:q=!0;break}}else this.observer.emit(_.Events.ERROR,_.Events.ERROR,{type:S.ErrorTypes.MEDIA_ERROR,details:S.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});v.pesData=P,g.pesData=Y,m.pesData=ne;var de={audioTrack:g,avcTrack:v,id3Track:m,textTrack:this._txtTrack};return a&&this.extractRemainingSamples(de),de},c.flush=function(){var f=this.remainderData;this.remainderData=null;var u;return f?u=this.demux(f,-1,!1,!0):u={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(u),this.sampleAes?this.decrypt(u,this.sampleAes):u},c.extractRemainingSamples=function(f){var u=f.audioTrack,o=f.avcTrack,a=f.id3Track,i=o.pesData,v=u.pesData,g=a.pesData,m;i&&(m=r(i))?(this.parseAVCPES(m,!0),o.pesData=null):o.pesData=i,v&&(m=r(v))?(u.isAAC?this.parseAACPES(m):this.parseMPEGPES(m),u.pesData=null):(v!=null&&v.size&&y.logger.log("last AAC PES packet truncated,might overlap between fragments"),u.pesData=v),g&&(m=r(g))?(this.parseID3PES(m),a.pesData=null):a.pesData=g},c.demuxSampleAes=function(f,u,o){var a=this.demux(f,o,!0,!this.config.progressive),i=this.sampleAes=new O.default(this.observer,this.config,u);return this.decrypt(a,i)},c.decrypt=function(f,u){return new Promise(function(o){var a=f.audioTrack,i=f.avcTrack;a.samples&&a.isAAC?u.decryptAacSamples(a.samples,0,function(){i.samples?u.decryptAvcSamples(i.samples,0,0,function(){o(f)}):o(f)}):i.samples&&u.decryptAvcSamples(i.samples,0,0,function(){o(f)})})},c.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},c.parseAVCPES=function(f,u){var o=this,a=this._avcTrack,i=this.parseAVCNALu(f.data),v=!1,g=this.avcSample,m,w=!1;f.data=null,g&&i.length&&!a.audFound&&(s(g,a),g=this.avcSample=E(!1,f.pts,f.dts,"")),i.forEach(function(P){switch(P.type){case 1:{m=!0,g||(g=o.avcSample=E(!0,f.pts,f.dts,"")),v&&(g.debug+="NDR "),g.frame=!0;var N=P.data;if(w&&N.length>4){var K=new L.default(N).readSliceType();(K===2||K===4||K===7||K===9)&&(g.key=!0)}break}case 5:m=!0,g||(g=o.avcSample=E(!0,f.pts,f.dts,"")),v&&(g.debug+="IDR "),g.key=!0,g.frame=!0;break;case 6:{m=!0,v&&g&&(g.debug+="SEI ");var Y=new L.default(p(P.data));Y.readUByte();for(var ne=0,q=0,se=!1,fe=0;!se&&Y.bytesAvailable>1;){ne=0;do fe=Y.readUByte(),ne+=fe;while(fe===255);q=0;do fe=Y.readUByte(),q+=fe;while(fe===255);if(ne===4&&Y.bytesAvailable!==0){se=!0;var le=Y.readUByte();if(le===181){var ve=Y.readUShort();if(ve===49){var Se=Y.readUInt();if(Se===1195456820){var ke=Y.readUByte();if(ke===3){for(var Ce=Y.readUByte(),Le=Y.readUByte(),ge=31&Ce,me=[Ce,Le],de=0;de<ge;de++)me.push(Y.readUByte()),me.push(Y.readUByte()),me.push(Y.readUByte());n(o._txtTrack.samples,{type:3,pts:f.pts,bytes:me})}}}}}else if(ne===5&&Y.bytesAvailable!==0){if(se=!0,q>16){for(var nt=[],Qe=0;Qe<16;Qe++)nt.push(Y.readUByte().toString(16)),(Qe===3||Qe===5||Qe===7||Qe===9)&&nt.push("-");for(var qe=q-16,We=new Uint8Array(qe),xe=0;xe<qe;xe++)We[xe]=Y.readUByte();n(o._txtTrack.samples,{pts:f.pts,payloadType:ne,uuid:nt.join(""),userData:Object(G.utf8ArrayToStr)(We),userDataBytes:We})}}else if(q<Y.bytesAvailable)for(var Te=0;Te<q;Te++)Y.readUByte()}break}case 7:if(m=!0,w=!0,v&&g&&(g.debug+="SPS "),!a.sps){var we=new L.default(P.data),Oe=we.readSPS();a.width=Oe.width,a.height=Oe.height,a.pixelRatio=Oe.pixelRatio,a.sps=[P.data],a.duration=o._duration;for(var Ne=P.data.subarray(1,4),De="avc1.",Ee=0;Ee<3;Ee++){var Ie=Ne[Ee].toString(16);Ie.length<2&&(Ie="0"+Ie),De+=Ie}a.codec=De}break;case 8:m=!0,v&&g&&(g.debug+="PPS "),a.pps||(a.pps=[P.data]);break;case 9:m=!1,a.audFound=!0,g&&s(g,a),g=o.avcSample=E(!1,f.pts,f.dts,v?"AUD ":"");break;case 12:m=!1;break;default:m=!1,g&&(g.debug+="unknown NAL "+P.type+" ");break}if(g&&m){var _e=g.units;_e.push(P)}}),u&&g&&(s(g,a),this.avcSample=null)},c.getLastNalUnit=function(){var f,u=this.avcSample,o;if(!u||u.units.length===0){var a=this._avcTrack.samples;u=a[a.length-1]}if((f=u)!==null&&f!==void 0&&f.units){var i=u.units;o=i[i.length-1]}return o},c.parseAVCNALu=function(f){var u=f.byteLength,o=this._avcTrack,a=o.naluState||0,i=a,v=[],g=0,m,w,P,N=-1,K=0;for(a===-1&&(N=0,K=f[0]&31,a=0,g=1);g<u;){if(m=f[g++],!a){a=m?0:1;continue}if(a===1){a=m?0:2;continue}if(!m)a=3;else if(m===1){if(N>=0){var Y={data:f.subarray(N,g-a-1),type:K};v.push(Y)}else{var ne=this.getLastNalUnit();if(ne&&(i&&g<=4-i&&(ne.state&&(ne.data=ne.data.subarray(0,ne.data.byteLength-i))),w=g-a-1,w>0)){var q=new Uint8Array(ne.data.byteLength+w);q.set(ne.data,0),q.set(f.subarray(0,w),ne.data.byteLength),ne.data=q,ne.state=0}}g<u?(P=f[g]&31,N=g,K=P,a=0):a=-1}else a=0}if(N>=0&&a>=0){var se={data:f.subarray(N,u),type:K,state:a};v.push(se)}if(v.length===0){var fe=this.getLastNalUnit();if(fe){var le=new Uint8Array(fe.data.byteLength+f.byteLength);le.set(fe.data,0),le.set(f,fe.data.byteLength),fe.data=le}}return o.naluState=a,v},c.parseAACPES=function(f){var u=0,o=this._audioTrack,a=this.aacOverFlow,i=f.data;if(a){this.aacOverFlow=null;var v=a.sample.unit.byteLength,g=Math.min(a.missing,v),m=v-g;a.sample.unit.set(i.subarray(0,g),m),o.samples.push(a.sample),u=a.missing}var w,P;for(w=u,P=i.length;w<P-1&&!B.isHeader(i,w);w++);if(w!==u){var N,K;if(w<P-1?(N="AAC PES did not start with ADTS header,offset:"+w,K=!1):(N="no ADTS header found in AAC PES",K=!0),y.logger.warn("parsing error:"+N),this.observer.emit(_.Events.ERROR,_.Events.ERROR,{type:S.ErrorTypes.MEDIA_ERROR,details:S.ErrorDetails.FRAG_PARSING_ERROR,fatal:K,reason:N}),K)return}B.initTrackConfig(o,this.observer,i,w,this.audioCodec);var Y;if(f.pts!==void 0)Y=f.pts;else if(a){var ne=B.getFrameDuration(o.samplerate);Y=a.sample.pts+ne}else{y.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var q=0;w<P;)if(B.isHeader(i,w)){if(w+5<P){var se=B.appendFrame(o,i,w,Y,q);if(se)if(se.missing)this.aacOverFlow=se;else{w+=se.length,q++;continue}}break}else w++},c.parseMPEGPES=function(f){var u=f.data,o=u.length,a=0,i=0,v=f.pts;if(v===void 0){y.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;i<o;)if(R.isHeader(u,i)){var g=R.appendFrame(this._audioTrack,u,i,v,a);if(g)i+=g.length,a++;else break}else i++},c.parseID3PES=function(f){if(f.pts===void 0){y.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(f)},d}();T.minProbeByteLength=188;function E(d,c,b,f){return{key:d,frame:!1,pts:c,dts:b,units:[],debug:f,length:0}}function x(d,c){return(d[c+10]&31)<<8|d[c+11]}function l(d,c,b,f){var u={audio:-1,avc:-1,id3:-1,isAAC:!0},o=(d[c+1]&15)<<8|d[c+2],a=c+3+o-4,i=(d[c+10]&15)<<8|d[c+11];for(c+=12+i;c<a;){var v=(d[c+1]&31)<<8|d[c+2];switch(d[c]){case 207:if(!f){y.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:u.audio===-1&&(u.audio=v);break;case 21:u.id3===-1&&(u.id3=v);break;case 219:if(!f){y.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:u.avc===-1&&(u.avc=v);break;case 3:case 4:b?u.audio===-1&&(u.audio=v,u.isAAC=!1):y.logger.log("MPEG audio found, not supported in this browser");break;case 36:y.logger.warn("Unsupported HEVC stream type found");break;default:break}c+=((d[c+3]&15)<<8|d[c+4])+5}return u}function r(d){var c=0,b,f,u,o,a,i=d.data;if(!d||d.size===0)return null;for(;i[0].length<19&&i.length>1;){var v=new Uint8Array(i[0].length+i[1].length);v.set(i[0]),v.set(i[1],i[0].length),i[0]=v,i.splice(1,1)}b=i[0];var g=(b[0]<<16)+(b[1]<<8)+b[2];if(g===1){if(f=(b[4]<<8)+b[5],f&&f>d.size-6)return null;var m=b[7];m&192&&(o=(b[9]&14)*536870912+(b[10]&255)*4194304+(b[11]&254)*16384+(b[12]&255)*128+(b[13]&254)/2,m&64?(a=(b[14]&14)*536870912+(b[15]&255)*4194304+(b[16]&254)*16384+(b[17]&255)*128+(b[18]&254)/2,o-a>60*9e4&&(y.logger.warn(Math.round((o-a)/9e4)+"s delta between PTS and DTS, align them"),o=a)):a=o),u=b[8];var w=u+9;if(d.size<=w)return null;d.size-=w;for(var P=new Uint8Array(d.size),N=0,K=i.length;N<K;N++){b=i[N];var Y=b.byteLength;if(w)if(w>Y){w-=Y;continue}else b=b.subarray(w),Y-=w,w=0;P.set(b,c),c+=Y}return f&&(f-=u+3),{data:P,pts:o,dts:a,len:f}}return null}function s(d,c){if(d.units.length&&d.frame){if(d.pts===void 0){var b=c.samples,f=b.length;if(f){var u=b[f-1];d.pts=u.pts,d.dts=u.dts}else{c.dropped++;return}}c.samples.push(d)}d.debug.length&&y.logger.log(d.pts+"/"+d.dts+":"+d.debug)}function n(d,c){var b=d.length;if(b>0){if(c.pts>=d[b-1].pts)d.push(c);else for(var f=b-1;f>=0;f--)if(c.pts<d[f].pts){d.splice(f,0,c);break}}else d.push(c)}function p(d){for(var c=d.byteLength,b=[],f=1;f<c-2;)d[f]===0&&d[f+1]===0&&d[f+2]===3?(b.push(f+2),f+=2):f++;if(b.length===0)return d;var u=c-b.length,o=new Uint8Array(u),a=0;for(f=0;f<u;a++,f++)a===b[0]&&(a++,b.shift()),o[f]=d[a];return o}j.default=T},"./src/errors.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"ErrorTypes",function(){return B}),D.d(j,"ErrorDetails",function(){return R});var B;(function(L){L.NETWORK_ERROR="networkError",L.MEDIA_ERROR="mediaError",L.KEY_SYSTEM_ERROR="keySystemError",L.MUX_ERROR="muxError",L.OTHER_ERROR="otherError"})(B||(B={}));var R;(function(L){L.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",L.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",L.KEY_SYSTEM_NO_SESSION="keySystemNoSession",L.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",L.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",L.MANIFEST_LOAD_ERROR="manifestLoadError",L.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",L.MANIFEST_PARSING_ERROR="manifestParsingError",L.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",L.LEVEL_EMPTY_ERROR="levelEmptyError",L.LEVEL_LOAD_ERROR="levelLoadError",L.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",L.LEVEL_SWITCH_ERROR="levelSwitchError",L.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",L.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",L.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",L.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",L.FRAG_LOAD_ERROR="fragLoadError",L.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",L.FRAG_DECRYPT_ERROR="fragDecryptError",L.FRAG_PARSING_ERROR="fragParsingError",L.REMUX_ALLOC_ERROR="remuxAllocError",L.KEY_LOAD_ERROR="keyLoadError",L.KEY_LOAD_TIMEOUT="keyLoadTimeOut",L.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",L.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",L.BUFFER_APPEND_ERROR="bufferAppendError",L.BUFFER_APPENDING_ERROR="bufferAppendingError",L.BUFFER_STALLED_ERROR="bufferStalledError",L.BUFFER_FULL_ERROR="bufferFullError",L.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",L.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",L.INTERNAL_EXCEPTION="internalException",L.INTERNAL_ABORTED="aborted",L.UNKNOWN="unknown"})(R||(R={}))},"./src/events.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"Events",function(){return B});var B;(function(R){R.MEDIA_ATTACHING="hlsMediaAttaching",R.MEDIA_ATTACHED="hlsMediaAttached",R.MEDIA_DETACHING="hlsMediaDetaching",R.MEDIA_DETACHED="hlsMediaDetached",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.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.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_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.ERROR="hlsError",R.DESTROYING="hlsDestroying",R.KEY_LOADING="hlsKeyLoading",R.KEY_LOADED="hlsKeyLoaded",R.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",R.BACK_BUFFER_REACHED="hlsBackBufferReached"})(B||(B={}))},"./src/hls.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"default",function(){return d});var B=D("./node_modules/url-toolkit/src/url-toolkit.js"),R=D.n(B),L=D("./src/loader/playlist-loader.ts"),G=D("./src/loader/key-loader.ts"),O=D("./src/controller/id3-track-controller.ts"),_=D("./src/controller/latency-controller.ts"),A=D("./src/controller/level-controller.ts"),y=D("./src/controller/fragment-tracker.ts"),S=D("./src/controller/stream-controller.ts"),C=D("./src/is-supported.ts"),T=D("./src/utils/logger.ts"),E=D("./src/config.ts"),x=D("./node_modules/eventemitter3/index.js"),l=D.n(x),r=D("./src/events.ts"),s=D("./src/errors.ts");function n(c,b){for(var f=0;f<b.length;f++){var u=b[f];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(c,u.key,u)}}function p(c,b,f){return b&&n(c.prototype,b),f&&n(c,f),c}var d=function(){c.isSupported=function(){return Object(C.isSupported)()};function c(f){f===void 0&&(f={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new x.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var u=this.config=Object(E.mergeConfig)(c.DefaultConfig,f);this.userConfig=f,Object(T.enableLogs)(u.debug),this._autoLevelCapping=-1,u.progressive&&Object(E.enableStreamingMode)(u);var o=u.abrController,a=u.bufferController,i=u.capLevelController,v=u.fpsController,g=this.abrController=new o(this),m=this.bufferController=new a(this),w=this.capLevelController=new i(this),P=new v(this),N=new L.default(this),K=new G.default(this),Y=new O.default(this),ne=this.levelController=new A.default(this),q=new y.FragmentTracker(this),se=this.streamController=new S.default(this,q);w.setStreamController(se),P.setStreamController(se);var fe=[ne,se];this.networkControllers=fe;var le=[N,K,g,m,w,P,Y,q];this.audioTrackController=this.createController(u.audioTrackController,null,fe),this.createController(u.audioStreamController,q,fe),this.subtitleTrackController=this.createController(u.subtitleTrackController,null,fe),this.createController(u.subtitleStreamController,q,fe),this.createController(u.timelineController,null,le),this.emeController=this.createController(u.emeController,null,le),this.cmcdController=this.createController(u.cmcdController,null,le),this.latencyController=this.createController(_.default,null,le),this.coreComponents=le}var b=c.prototype;return b.createController=function(u,o,a){if(u){var i=o?new u(this,o):new u(this);return a&&a.push(i),i}return null},b.on=function(u,o,a){a===void 0&&(a=this),this._emitter.on(u,o,a)},b.once=function(u,o,a){a===void 0&&(a=this),this._emitter.once(u,o,a)},b.removeAllListeners=function(u){this._emitter.removeAllListeners(u)},b.off=function(u,o,a,i){a===void 0&&(a=this),this._emitter.off(u,o,a,i)},b.listeners=function(u){return this._emitter.listeners(u)},b.emit=function(u,o,a){return this._emitter.emit(u,o,a)},b.trigger=function(u,o){if(this.config.debug)return this.emit(u,u,o);try{return this.emit(u,u,o)}catch(a){T.logger.error("An internal error happened while handling event "+u+'. Error message: "'+a.message+'". Here is a stacktrace:',a),this.trigger(r.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:u,error:a})}return!1},b.listenerCount=function(u){return this._emitter.listenerCount(u)},b.destroy=function(){T.logger.log("destroy"),this.trigger(r.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(u){return u.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(u){return u.destroy()}),this.coreComponents.length=0},b.attachMedia=function(u){T.logger.log("attachMedia"),this._media=u,this.trigger(r.Events.MEDIA_ATTACHING,{media:u})},b.detachMedia=function(){T.logger.log("detachMedia"),this.trigger(r.Events.MEDIA_DETACHING,void 0),this._media=null},b.loadSource=function(u){this.stopLoad();var o=this.media,a=this.url,i=this.url=B.buildAbsoluteURL(self.location.href,u,{alwaysNormalize:!0});T.logger.log("loadSource:"+i),o&&a&&a!==i&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(o)),this.trigger(r.Events.MANIFEST_LOADING,{url:u})},b.startLoad=function(u){u===void 0&&(u=-1),T.logger.log("startLoad("+u+")"),this.networkControllers.forEach(function(o){o.startLoad(u)})},b.stopLoad=function(){T.logger.log("stopLoad"),this.networkControllers.forEach(function(u){u.stopLoad()})},b.swapAudioCodec=function(){T.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},b.recoverMediaError=function(){T.logger.log("recoverMediaError");var u=this._media;this.detachMedia(),u&&this.attachMedia(u)},b.removeLevel=function(u,o){o===void 0&&(o=0),this.levelController.removeLevel(u,o)},p(c,[{key:"levels",get:function(){var u=this.levelController.levels;return u||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(u){T.logger.log("set currentLevel:"+u),this.loadLevel=u,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(u){T.logger.log("set nextLevel:"+u),this.levelController.manualLevel=u,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(u){T.logger.log("set loadLevel:"+u),this.levelController.manualLevel=u}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(u){this.levelController.nextLoadLevel=u}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(u){T.logger.log("set firstLevel:"+u),this.levelController.firstLevel=u}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(u){T.logger.log("set startLevel:"+u),u!==-1&&(u=Math.max(u,this.minAutoLevel)),this.levelController.startLevel=u}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(u){var o=!!u;o!==this.config.capLevelToPlayerSize&&(o?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=o)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(u){this._autoLevelCapping!==u&&(T.logger.log("set autoLevelCapping:"+u),this._autoLevelCapping=u)}},{key:"bandwidthEstimate",get:function(){var u=this.abrController.bwEstimator;return u?u.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var u=this.levels,o=this.config.minAutoBitrate;if(!u)return 0;for(var a=u.length,i=0;i<a;i++)if(u[i].maxBitrate>o)return i;return 0}},{key:"maxAutoLevel",get:function(){var u=this.levels,o=this.autoLevelCapping,a;return o===-1&&u&&u.length?a=u.length-1:a=o,a}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(u){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,u)}},{key:"audioTracks",get:function(){var u=this.audioTrackController;return u?u.audioTracks:[]}},{key:"audioTrack",get:function(){var u=this.audioTrackController;return u?u.audioTrack:-1},set:function(u){var o=this.audioTrackController;o&&(o.audioTrack=u)}},{key:"subtitleTracks",get:function(){var u=this.subtitleTrackController;return u?u.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var u=this.subtitleTrackController;return u?u.subtitleTrack:-1},set:function(u){var o=this.subtitleTrackController;o&&(o.subtitleTrack=u)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var u=this.subtitleTrackController;return u?u.subtitleDisplay:!1},set:function(u){var o=this.subtitleTrackController;o&&(o.subtitleDisplay=u)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(u){this.config.lowLatencyMode=u}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return r.Events}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return c.defaultConfig?c.defaultConfig:E.hlsDefaultConfig},set:function(u){c.defaultConfig=u}}]),c}();d.defaultConfig=void 0},"./src/is-supported.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"isSupported",function(){return L}),D.d(j,"changeTypeSupported",function(){return G});var B=D("./src/utils/mediasource-helper.ts");function R(){return self.SourceBuffer||self.WebKitSourceBuffer}function L(){var O=Object(B.getMediaSource)();if(!O)return!1;var _=R(),A=O&&typeof O.isTypeSupported=="function"&&O.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),y=!_||_.prototype&&typeof _.prototype.appendBuffer=="function"&&typeof _.prototype.remove=="function";return!!A&&!!y}function G(){var O,_=R();return typeof(_==null||((O=_.prototype)===null||O===void 0)?void 0:O.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"default",function(){return T}),D.d(j,"LoadError",function(){return x});var B=D("./src/polyfills/number.ts"),R=D("./src/errors.ts");function L(l,r){l.prototype=Object.create(r.prototype),l.prototype.constructor=l,y(l,r)}function G(l){var r=typeof Map=="function"?new Map:void 0;return G=function(n){if(n===null||!A(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof r!="undefined"){if(r.has(n))return r.get(n);r.set(n,p)}function p(){return O(n,arguments,S(this).constructor)}return p.prototype=Object.create(n.prototype,{constructor:{value:p,enumerable:!1,writable:!0,configurable:!0}}),y(p,n)},G(l)}function O(l,r,s){return _()?O=Reflect.construct:O=function(p,d,c){var b=[null];b.push.apply(b,d);var f=Function.bind.apply(p,b),u=new f;return c&&y(u,c.prototype),u},O.apply(null,arguments)}function _(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(l){return!1}}function A(l){return Function.toString.call(l).indexOf("[native code]")!==-1}function y(l,r){return y=Object.setPrototypeOf||function(n,p){return n.__proto__=p,n},y(l,r)}function S(l){return S=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},S(l)}var C=Math.pow(2,17),T=function(){function l(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var r=l.prototype;return r.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},r.abort=function(){this.loader&&this.loader.abort()},r.load=function(n,p){var d=this,c=n.url;if(!c)return Promise.reject(new x({type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:n,networkDetails:null},"Fragment does not have a "+(c?"part list":"url")));this.abort();var b=this.config,f=b.fLoader,u=b.loader;return new Promise(function(o,a){d.loader&&d.loader.destroy();var i=d.loader=n.loader=f?new f(b):new u(b),v=E(n),g={timeout:b.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:b.fragLoadingMaxRetryTimeout,highWaterMark:C};n.stats=i.stats,i.load(v,g,{onSuccess:function(w,P,N,K){d.resetLoader(n,i),o({frag:n,part:null,payload:w.data,networkDetails:K})},onError:function(w,P,N){d.resetLoader(n,i),a(new x({type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:n,response:w,networkDetails:N}))},onAbort:function(w,P,N){d.resetLoader(n,i),a(new x({type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:n,networkDetails:N}))},onTimeout:function(w,P,N){d.resetLoader(n,i),a(new x({type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:n,networkDetails:N}))},onProgress:function(w,P,N,K){p&&p({frag:n,part:null,payload:N,networkDetails:K})}})})},r.loadPart=function(n,p,d){var c=this;this.abort();var b=this.config,f=b.fLoader,u=b.loader;return new Promise(function(o,a){c.loader&&c.loader.destroy();var i=c.loader=n.loader=f?new f(b):new u(b),v=E(n,p),g={timeout:b.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:b.fragLoadingMaxRetryTimeout,highWaterMark:C};p.stats=i.stats,i.load(v,g,{onSuccess:function(w,P,N,K){c.resetLoader(n,i),c.updateStatsFromPart(n,p);var Y={frag:n,part:p,payload:w.data,networkDetails:K};d(Y),o(Y)},onError:function(w,P,N){c.resetLoader(n,i),a(new x({type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:n,part:p,response:w,networkDetails:N}))},onAbort:function(w,P,N){n.stats.aborted=p.stats.aborted,c.resetLoader(n,i),a(new x({type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:n,part:p,networkDetails:N}))},onTimeout:function(w,P,N){c.resetLoader(n,i),a(new x({type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:n,part:p,networkDetails:N}))}})})},r.updateStatsFromPart=function(n,p){var d=n.stats,c=p.stats,b=c.total;if(d.loaded+=c.loaded,b){var f=Math.round(n.duration/p.duration),u=Math.min(Math.round(d.loaded/b),f),o=f-u,a=o*Math.round(d.loaded/u);d.total=d.loaded+a}else d.total=Math.max(d.loaded,d.total);var i=d.loading,v=c.loading;i.start?i.first+=v.first-v.start:(i.start=v.start,i.first=v.first),i.end=v.end},r.resetLoader=function(n,p){n.loader=null,this.loader===p&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),p.destroy()},l}();function E(l,r){r===void 0&&(r=null);var s=r||l,n={frag:l,part:r,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},p=s.byteRangeStartOffset,d=s.byteRangeEndOffset;return Object(B.isFiniteNumber)(p)&&Object(B.isFiniteNumber)(d)&&(n.rangeStart=p,n.rangeEnd=d),n}var x=function(l){L(r,l);function r(s){for(var n,p=arguments.length,d=new Array(p>1?p-1:0),c=1;c<p;c++)d[c-1]=arguments[c];return n=l.call.apply(l,[this].concat(d))||this,n.data=void 0,n.data=s,n}return r}(G(Error))},"./src/loader/fragment.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"ElementaryStreamTypes",function(){return T}),D.d(j,"BaseSegment",function(){return E}),D.d(j,"Fragment",function(){return x}),D.d(j,"Part",function(){return l});var B=D("./src/polyfills/number.ts"),R=D("./node_modules/url-toolkit/src/url-toolkit.js"),L=D.n(R),G=D("./src/utils/logger.ts"),O=D("./src/loader/level-key.ts"),_=D("./src/loader/load-stats.ts");function A(r,s){r.prototype=Object.create(s.prototype),r.prototype.constructor=r,y(r,s)}function y(r,s){return y=Object.setPrototypeOf||function(p,d){return p.__proto__=d,p},y(r,s)}function S(r,s){for(var n=0;n<s.length;n++){var p=s[n];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(r,p.key,p)}}function C(r,s,n){return s&&S(r.prototype,s),n&&S(r,n),r}var T;(function(r){r.AUDIO="audio",r.VIDEO="video",r.AUDIOVIDEO="audiovideo"})(T||(T={}));var E=function(){function r(n){var p;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(p={},p[T.AUDIO]=null,p[T.VIDEO]=null,p[T.AUDIOVIDEO]=null,p),this.baseurl=n}var s=r.prototype;return s.setByteRange=function(p,d){var c=p.split("@",2),b=[];c.length===1?b[0]=d?d.byteRangeEndOffset:0:b[0]=parseInt(c[1]),b[1]=parseInt(c[0])+b[0],this._byteRange=b},C(r,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(R.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(p){this._url=p}}]),r}(),x=function(r){A(s,r);function s(p,d){var c;return c=r.call(this,d)||this,c._decryptdata=null,c.rawProgramDateTime=null,c.programDateTime=null,c.tagList=[],c.duration=0,c.sn=0,c.levelkey=void 0,c.type=void 0,c.loader=null,c.level=-1,c.cc=0,c.startPTS=void 0,c.endPTS=void 0,c.appendedPTS=void 0,c.startDTS=void 0,c.endDTS=void 0,c.start=0,c.deltaPTS=void 0,c.maxStartPTS=void 0,c.minEndPTS=void 0,c.stats=new _.LoadStats,c.urlId=0,c.data=void 0,c.bitrateTest=!1,c.title=null,c.initSegment=null,c.type=p,c}var n=s.prototype;return n.createInitializationVector=function(d){for(var c=new Uint8Array(16),b=12;b<16;b++)c[b]=d>>8*(15-b)&255;return c},n.setDecryptDataFromLevelKey=function(d,c){var b=d;return(d==null?void 0:d.method)==="AES-128"&&d.uri&&!d.iv&&(b=O.LevelKey.fromURI(d.uri),b.method=d.method,b.iv=this.createInitializationVector(c),b.keyFormat="identity"),b},n.setElementaryStreamInfo=function(d,c,b,f,u,o){o===void 0&&(o=!1);var a=this.elementaryStreams,i=a[d];if(!i){a[d]={startPTS:c,endPTS:b,startDTS:f,endDTS:u,partial:o};return}i.startPTS=Math.min(i.startPTS,c),i.endPTS=Math.max(i.endPTS,b),i.startDTS=Math.min(i.startDTS,f),i.endDTS=Math.max(i.endDTS,u)},n.clearElementaryStreamInfo=function(){var d=this.elementaryStreams;d[T.AUDIO]=null,d[T.VIDEO]=null,d[T.AUDIOVIDEO]=null},C(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var d=this.sn;typeof d!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&G.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),d=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,d)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(B.isFiniteNumber)(this.programDateTime))return null;var d=Object(B.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+d*1e3}},{key:"encrypted",get:function(){var d;return!!((d=this.decryptdata)!==null&&d!==void 0&&d.keyFormat&&this.decryptdata.uri)}}]),s}(E),l=function(r){A(s,r);function s(n,p,d,c,b){var f;f=r.call(this,d)||this,f.fragOffset=0,f.duration=0,f.gap=!1,f.independent=!1,f.relurl=void 0,f.fragment=void 0,f.index=void 0,f.stats=new _.LoadStats,f.duration=n.decimalFloatingPoint("DURATION"),f.gap=n.bool("GAP"),f.independent=n.bool("INDEPENDENT"),f.relurl=n.enumeratedString("URI"),f.fragment=p,f.index=c;var u=n.enumeratedString("BYTERANGE");return u&&f.setByteRange(u,b),b&&(f.fragOffset=b.fragOffset+b.duration),f}return C(s,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var p=this.elementaryStreams;return!!(p.audio||p.video||p.audiovideo)}}]),s}(E)},"./src/loader/key-loader.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"default",function(){return G});var B=D("./src/events.ts"),R=D("./src/errors.ts"),L=D("./src/utils/logger.ts"),G=function(){function O(A){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=A,this._registerListeners()}var _=O.prototype;return _._registerListeners=function(){this.hls.on(B.Events.KEY_LOADING,this.onKeyLoading,this)},_._unregisterListeners=function(){this.hls.off(B.Events.KEY_LOADING,this.onKeyLoading)},_.destroy=function(){this._unregisterListeners();for(var y in this.loaders){var S=this.loaders[y];S&&S.destroy()}this.loaders={}},_.onKeyLoading=function(y,S){var C=S.frag,T=C.type,E=this.loaders[T];if(!C.decryptdata){L.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var x=C.decryptdata.uri;if(x!==this.decrypturl||this.decryptkey===null){var l=this.hls.config;if(E&&(L.logger.warn("abort previous key loader for type:"+T),E.abort()),!x){L.logger.warn("key uri is falsy");return}var r=l.loader,s=C.loader=this.loaders[T]=new r(l);this.decrypturl=x,this.decryptkey=null;var n={url:x,frag:C,responseType:"arraybuffer"},p={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:l.fragLoadingRetryDelay,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:0},d={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(n,p,d)}else this.decryptkey&&(C.decryptdata.key=this.decryptkey,this.hls.trigger(B.Events.KEY_LOADED,{frag:C}))},_.loadsuccess=function(y,S,C){var T=C.frag;if(!T.decryptdata){L.logger.error("after key load, decryptdata unset");return}this.decryptkey=T.decryptdata.key=new Uint8Array(y.data),T.loader=null,delete this.loaders[T.type],this.hls.trigger(B.Events.KEY_LOADED,{frag:T})},_.loaderror=function(y,S){var C=S.frag,T=C.loader;T&&T.abort(),delete this.loaders[C.type],this.hls.trigger(B.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:C,response:y})},_.loadtimeout=function(y,S){var C=S.frag,T=C.loader;T&&T.abort(),delete this.loaders[C.type],this.hls.trigger(B.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:C})},O}()},"./src/loader/level-details.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"LevelDetails",function(){return O});var B=D("./src/polyfills/number.ts");function R(_,A){for(var y=0;y<A.length;y++){var S=A[y];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(_,S.key,S)}}function L(_,A,y){return A&&R(_.prototype,A),y&&R(_,y),_}var G=10,O=function(){function _(y){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.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,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.fragments=[],this.url=y}var A=_.prototype;return A.reloaded=function(S){if(!S){this.advanced=!0,this.updated=!0;return}var C=this.lastPartSn-S.lastPartSn,T=this.lastPartIndex-S.lastPartIndex;this.updated=this.endSN!==S.endSN||!!T||!!C,this.advanced=this.endSN>S.endSN||C>0||C===0&&T>0,this.updated||this.advanced?this.misses=Math.floor(S.misses*.6):this.misses=S.misses+1,this.availabilityDelay=S.availabilityDelay},L(_,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(B.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||G}},{key:"drift",get:function(){var S=this.driftEndTime-this.driftStartTime;if(S>0){var C=this.driftEnd-this.driftStart;return C*1e3/S}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var S;return(S=this.partList)!==null&&S!==void 0&&S.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var S;return(S=this.fragments)!==null&&S!==void 0&&S.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var S;return(S=this.partList)!==null&&S!==void 0&&S.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var S;return(S=this.partList)!==null&&S!==void 0&&S.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),_}()},"./src/loader/level-key.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"LevelKey",function(){return O});var B=D("./node_modules/url-toolkit/src/url-toolkit.js"),R=D.n(B);function L(_,A){for(var y=0;y<A.length;y++){var S=A[y];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(_,S.key,S)}}function G(_,A,y){return A&&L(_.prototype,A),y&&L(_,y),_}var O=function(){_.fromURL=function(y,S){return new _(y,S)},_.fromURI=function(y){return new _(y)};function _(A,y){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,y?this._uri=Object(B.buildAbsoluteURL)(A,y,{alwaysNormalize:!0}):this._uri=A}return G(_,[{key:"uri",get:function(){return this._uri}}]),_}()},"./src/loader/load-stats.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"LoadStats",function(){return B});var B=function(){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}}},"./src/loader/m3u8-parser.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"default",function(){return s});var B=D("./src/polyfills/number.ts"),R=D("./node_modules/url-toolkit/src/url-toolkit.js"),L=D.n(R),G=D("./src/loader/fragment.ts"),O=D("./src/loader/level-details.ts"),_=D("./src/loader/level-key.ts"),A=D("./src/utils/attr-list.ts"),y=D("./src/utils/logger.ts"),S=D("./src/utils/codecs.ts"),C=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,T=/#EXT-X-MEDIA:(.*)/g,E=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),x=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),l=/\.(mp4|m4s|m4v|m4a)$/i;function r(b){var f,u;return l.test((f=(u=R.parseURL(b))===null||u===void 0?void 0:u.path)!=null?f:"")}var s=function(){function b(){}return b.findGroup=function(u,o){for(var a=0;a<u.length;a++){var i=u[a];if(i.id===o)return i}},b.convertAVC1ToAVCOTI=function(u){var o=u.split(".");if(o.length>2){var a=o.shift()+".";return a+=parseInt(o.shift()).toString(16),a+=("000"+parseInt(o.shift()).toString(16)).substr(-4),a}return u},b.resolve=function(u,o){return R.buildAbsoluteURL(o,u,{alwaysNormalize:!0})},b.parseMasterPlaylist=function(u,o){var a=[],i={},v=!1;C.lastIndex=0;for(var g;(g=C.exec(u))!=null;)if(g[1]){var m=new A.AttrList(g[1]),w={attrs:m,bitrate:m.decimalInteger("AVERAGE-BANDWIDTH")||m.decimalInteger("BANDWIDTH"),name:m.NAME,url:b.resolve(g[2],o)},P=m.decimalResolution("RESOLUTION");P&&(w.width=P.width,w.height=P.height),n((m.CODECS||"").split(/[ ,]+/).filter(function(K){return K}),w),w.videoCodec&&w.videoCodec.indexOf("avc1")!==-1&&(w.videoCodec=b.convertAVC1ToAVCOTI(w.videoCodec)),a.push(w)}else if(g[3]){var N=new A.AttrList(g[3]);N["DATA-ID"]&&(v=!0,i[N["DATA-ID"]]=N)}return{levels:a,sessionData:v?i:null}},b.parseMasterPlaylistMedia=function(u,o,a,i){i===void 0&&(i=[]);var v,g=[],m=0;for(T.lastIndex=0;(v=T.exec(u))!==null;){var w=new A.AttrList(v[1]);if(w.TYPE===a){var P={attrs:w,bitrate:0,id:m++,groupId:w["GROUP-ID"],instreamId:w["INSTREAM-ID"],name:w.NAME||w.LANGUAGE||"",type:a,default:w.bool("DEFAULT"),autoselect:w.bool("AUTOSELECT"),forced:w.bool("FORCED"),lang:w.LANGUAGE,url:w.URI?b.resolve(w.URI,o):""};if(i.length){var N=b.findGroup(i,P.groupId)||i[0];p(P,N,"audioCodec"),p(P,N,"textCodec")}g.push(P)}}return g},b.parseLevelPlaylist=function(u,o,a,i,v){var g=new O.LevelDetails(o),m=g.fragments,w=null,P=0,N=0,K=0,Y=0,ne=null,q=new G.Fragment(i,o),se,fe,le,ve=-1,Se=!1;for(E.lastIndex=0,g.m3u8=u;(se=E.exec(u))!==null;){Se&&(Se=!1,q=new G.Fragment(i,o),q.start=K,q.sn=P,q.cc=Y,q.level=a,w&&(q.initSegment=w,q.rawProgramDateTime=w.rawProgramDateTime));var ke=se[1];if(ke){q.duration=parseFloat(ke);var Ce=(" "+se[2]).slice(1);q.title=Ce||null,q.tagList.push(Ce?["INF",ke,Ce]:["INF",ke])}else if(se[3])Object(B.isFiniteNumber)(q.duration)&&(q.start=K,le&&(q.levelkey=le),q.sn=P,q.level=a,q.cc=Y,q.urlId=v,m.push(q),q.relurl=(" "+se[3]).slice(1),c(q,ne),ne=q,K+=q.duration,P++,N=0,Se=!0);else if(se[4]){var Le=(" "+se[4]).slice(1);ne?q.setByteRange(Le,ne):q.setByteRange(Le)}else if(se[5])q.rawProgramDateTime=(" "+se[5]).slice(1),q.tagList.push(["PROGRAM-DATE-TIME",q.rawProgramDateTime]),ve===-1&&(ve=m.length);else{if(se=se[0].match(x),!se){y.logger.warn("No matches on slow regex match for level playlist!");continue}for(fe=1;fe<se.length&&!(typeof se[fe]!="undefined");fe++);var ge=(" "+se[fe]).slice(1),me=(" "+se[fe+1]).slice(1),de=se[fe+2]?(" "+se[fe+2]).slice(1):"";switch(ge){case"PLAYLIST-TYPE":g.type=me.toUpperCase();break;case"MEDIA-SEQUENCE":P=g.startSN=parseInt(me);break;case"SKIP":{var nt=new A.AttrList(me),Qe=nt.decimalInteger("SKIPPED-SEGMENTS");if(Object(B.isFiniteNumber)(Qe)){g.skippedSegments=Qe;for(var qe=Qe;qe--;)m.unshift(null);P+=Qe}var We=nt.enumeratedString("RECENTLY-REMOVED-DATERANGES");We&&(g.recentlyRemovedDateranges=We.split(" "));break}case"TARGETDURATION":g.targetduration=parseFloat(me);break;case"VERSION":g.version=parseInt(me);break;case"EXTM3U":break;case"ENDLIST":g.live=!1;break;case"#":(me||de)&&q.tagList.push(de?[me,de]:[me]);break;case"DIS":Y++;case"GAP":q.tagList.push([ge]);break;case"BITRATE":q.tagList.push([ge,me]);break;case"DISCONTINUITY-SEQ":Y=parseInt(me);break;case"KEY":{var xe,Te=new A.AttrList(me),we=Te.enumeratedString("METHOD"),Oe=Te.URI,Ne=Te.hexadecimalInteger("IV"),De=Te.enumeratedString("KEYFORMATVERSIONS"),Ee=Te.enumeratedString("KEYID"),Ie=(xe=Te.enumeratedString("KEYFORMAT"))!=null?xe:"identity",_e=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(_e.indexOf(Ie)>-1){y.logger.warn("Keyformat "+Ie+" is not supported from the manifest");continue}else if(Ie!=="identity")continue;we&&(le=_.LevelKey.fromURL(o,Oe),Oe&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(we)>=0&&(le.method=we,le.keyFormat=Ie,Ee&&(le.keyID=Ee),De&&(le.keyFormatVersions=De),le.iv=Ne));break}case"START":{var Me=new A.AttrList(me),Ue=Me.decimalFloatingPoint("TIME-OFFSET");Object(B.isFiniteNumber)(Ue)&&(g.startTimeOffset=Ue);break}case"MAP":{var je=new A.AttrList(me);q.relurl=je.URI,je.BYTERANGE&&q.setByteRange(je.BYTERANGE),q.level=a,q.sn="initSegment",le&&(q.levelkey=le),q.initSegment=null,w=q,Se=!0;break}case"SERVER-CONTROL":{var Ge=new A.AttrList(me);g.canBlockReload=Ge.bool("CAN-BLOCK-RELOAD"),g.canSkipUntil=Ge.optionalFloat("CAN-SKIP-UNTIL",0),g.canSkipDateRanges=g.canSkipUntil>0&&Ge.bool("CAN-SKIP-DATERANGES"),g.partHoldBack=Ge.optionalFloat("PART-HOLD-BACK",0),g.holdBack=Ge.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Ke=new A.AttrList(me);g.partTarget=Ke.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ae=g.partList;Ae||(Ae=g.partList=[]);var Xe=N>0?Ae[Ae.length-1]:void 0,Ve=N++,X=new G.Part(new A.AttrList(me),q,o,Ve,Xe);Ae.push(X),q.duration+=X.duration;break}case"PRELOAD-HINT":{var F=new A.AttrList(me);g.preloadHint=F;break}case"RENDITION-REPORT":{var U=new A.AttrList(me);g.renditionReports=g.renditionReports||[],g.renditionReports.push(U);break}default:y.logger.warn("line parsed but not handled: "+se);break}}}ne&&!ne.relurl?(m.pop(),K-=ne.duration,g.partList&&(g.fragmentHint=ne)):g.partList&&(c(q,ne),q.cc=Y,g.fragmentHint=q);var $=m.length,J=m[0],W=m[$-1];if(K+=g.skippedSegments*g.targetduration,K>0&&$&&W){g.averagetargetduration=K/$;var H=W.sn;g.endSN=H!=="initSegment"?H:0,J&&(g.startCC=J.cc,J.initSegment||g.fragments.every(function(Q){return Q.relurl&&r(Q.relurl)})&&(y.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),q=new G.Fragment(i,o),q.relurl=W.relurl,q.level=a,q.sn="initSegment",J.initSegment=q,g.needSidxRanges=!0))}else g.endSN=0,g.startCC=0;return g.fragmentHint&&(K+=g.fragmentHint.duration),g.totalduration=K,g.endCC=Y,ve>0&&d(m,ve),g},b}();function n(b,f){["video","audio","text"].forEach(function(u){var o=b.filter(function(i){return Object(S.isCodecType)(i,u)});if(o.length){var a=o.filter(function(i){return i.lastIndexOf("avc1",0)===0||i.lastIndexOf("mp4a",0)===0});f[u+"Codec"]=a.length>0?a[0]:o[0],b=b.filter(function(i){return o.indexOf(i)===-1})}}),f.unknownCodecs=b}function p(b,f,u){var o=f[u];o&&(b[u]=o)}function d(b,f){for(var u=b[f],o=f;o--;){var a=b[o];if(!a)return;a.programDateTime=u.programDateTime-a.duration*1e3,u=a}}function c(b,f){b.rawProgramDateTime?b.programDateTime=Date.parse(b.rawProgramDateTime):f!=null&&f.programDateTime&&(b.programDateTime=f.endProgramDateTime),Object(B.isFiniteNumber)(b.programDateTime)||(b.programDateTime=null,b.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(he,j,D){"use strict";D.r(j);var B=D("./src/polyfills/number.ts"),R=D("./src/events.ts"),L=D("./src/errors.ts"),G=D("./src/utils/logger.ts"),O=D("./src/utils/mp4-tools.ts"),_=D("./src/loader/m3u8-parser.ts"),A=D("./src/types/loader.ts"),y=D("./src/utils/attr-list.ts");function S(E){var x=E.type;switch(x){case A.PlaylistContextType.AUDIO_TRACK:return A.PlaylistLevelType.AUDIO;case A.PlaylistContextType.SUBTITLE_TRACK:return A.PlaylistLevelType.SUBTITLE;default:return A.PlaylistLevelType.MAIN}}function C(E,x){var l=E.url;return(l===void 0||l.indexOf("data:")===0)&&(l=x.url),l}var T=function(){function E(l){this.hls=void 0,this.loaders=Object.create(null),this.hls=l,this.registerListeners()}var x=E.prototype;return x.registerListeners=function(){var r=this.hls;r.on(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.on(R.Events.LEVEL_LOADING,this.onLevelLoading,this),r.on(R.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),r.on(R.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},x.unregisterListeners=function(){var r=this.hls;r.off(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.off(R.Events.LEVEL_LOADING,this.onLevelLoading,this),r.off(R.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),r.off(R.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},x.createInternalLoader=function(r){var s=this.hls.config,n=s.pLoader,p=s.loader,d=n||p,c=new d(s);return r.loader=c,this.loaders[r.type]=c,c},x.getInternalLoader=function(r){return this.loaders[r.type]},x.resetInternalLoader=function(r){this.loaders[r]&&delete this.loaders[r]},x.destroyInternalLoaders=function(){for(var r in this.loaders){var s=this.loaders[r];s&&s.destroy(),this.resetInternalLoader(r)}},x.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},x.onManifestLoading=function(r,s){var n=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:A.PlaylistContextType.MANIFEST,url:n,deliveryDirectives:null})},x.onLevelLoading=function(r,s){var n=s.id,p=s.level,d=s.url,c=s.deliveryDirectives;this.load({id:n,groupId:null,level:p,responseType:"text",type:A.PlaylistContextType.LEVEL,url:d,deliveryDirectives:c})},x.onAudioTrackLoading=function(r,s){var n=s.id,p=s.groupId,d=s.url,c=s.deliveryDirectives;this.load({id:n,groupId:p,level:null,responseType:"text",type:A.PlaylistContextType.AUDIO_TRACK,url:d,deliveryDirectives:c})},x.onSubtitleTrackLoading=function(r,s){var n=s.id,p=s.groupId,d=s.url,c=s.deliveryDirectives;this.load({id:n,groupId:p,level:null,responseType:"text",type:A.PlaylistContextType.SUBTITLE_TRACK,url:d,deliveryDirectives:c})},x.load=function(r){var s,n=this.hls.config,p=this.getInternalLoader(r);if(p){var d=p.context;if(d&&d.url===r.url){G.logger.trace("[playlist-loader]: playlist request ongoing");return}G.logger.log("[playlist-loader]: aborting previous loader for type: "+r.type),p.abort()}var c,b,f,u;switch(r.type){case A.PlaylistContextType.MANIFEST:c=n.manifestLoadingMaxRetry,b=n.manifestLoadingTimeOut,f=n.manifestLoadingRetryDelay,u=n.manifestLoadingMaxRetryTimeout;break;case A.PlaylistContextType.LEVEL:case A.PlaylistContextType.AUDIO_TRACK:case A.PlaylistContextType.SUBTITLE_TRACK:c=0,b=n.levelLoadingTimeOut;break;default:c=n.levelLoadingMaxRetry,b=n.levelLoadingTimeOut,f=n.levelLoadingRetryDelay,u=n.levelLoadingMaxRetryTimeout;break}if(p=this.createInternalLoader(r),(s=r.deliveryDirectives)!==null&&s!==void 0&&s.part){var o;if(r.type===A.PlaylistContextType.LEVEL&&r.level!==null?o=this.hls.levels[r.level].details:r.type===A.PlaylistContextType.AUDIO_TRACK&&r.id!==null?o=this.hls.audioTracks[r.id].details:r.type===A.PlaylistContextType.SUBTITLE_TRACK&&r.id!==null&&(o=this.hls.subtitleTracks[r.id].details),o){var a=o.partTarget,i=o.targetduration;a&&i&&(b=Math.min(Math.max(a*3,i*.8)*1e3,b))}}var v={timeout:b,maxRetry:c,retryDelay:f,maxRetryDelay:u,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};p.load(r,v,g)},x.loadsuccess=function(r,s,n,p){if(p===void 0&&(p=null),n.isSidxRequest){this.handleSidxRequest(r,n),this.handlePlaylistLoaded(r,s,n,p);return}this.resetInternalLoader(n.type);var d=r.data;if(d.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(r,n,"no EXTM3U delimiter",p);return}s.parsing.start=performance.now(),d.indexOf("#EXTINF:")>0||d.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(r,s,n,p):this.handleMasterPlaylist(r,s,n,p)},x.loaderror=function(r,s,n){n===void 0&&(n=null),this.handleNetworkError(s,n,!1,r)},x.loadtimeout=function(r,s,n){n===void 0&&(n=null),this.handleNetworkError(s,n,!0)},x.handleMasterPlaylist=function(r,s,n,p){var d=this.hls,c=r.data,b=C(r,n),f=_.default.parseMasterPlaylist(c,b),u=f.levels,o=f.sessionData;if(!u.length){this.handleManifestParsingError(r,n,"no level found in manifest",p);return}var a=u.map(function(P){return{id:P.attrs.AUDIO,audioCodec:P.audioCodec}}),i=u.map(function(P){return{id:P.attrs.SUBTITLES,textCodec:P.textCodec}}),v=_.default.parseMasterPlaylistMedia(c,b,"AUDIO",a),g=_.default.parseMasterPlaylistMedia(c,b,"SUBTITLES",i),m=_.default.parseMasterPlaylistMedia(c,b,"CLOSED-CAPTIONS");if(v.length){var w=v.some(function(P){return!P.url});!w&&u[0].audioCodec&&!u[0].attrs.AUDIO&&(G.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),v.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new y.AttrList({}),bitrate:0,url:""}))}d.trigger(R.Events.MANIFEST_LOADED,{levels:u,audioTracks:v,subtitles:g,captions:m,url:b,stats:s,networkDetails:p,sessionData:o})},x.handleTrackOrLevelPlaylist=function(r,s,n,p){var d=this.hls,c=n.id,b=n.level,f=n.type,u=C(r,n),o=Object(B.isFiniteNumber)(c)?c:0,a=Object(B.isFiniteNumber)(b)?b:o,i=S(n),v=_.default.parseLevelPlaylist(r.data,u,a,i,o);if(!v.fragments.length){d.trigger(R.Events.ERROR,{type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:u,reason:"no fragments found in level",level:typeof n.level=="number"?n.level:void 0});return}if(f===A.PlaylistContextType.MANIFEST){var g={attrs:new y.AttrList({}),bitrate:0,details:v,name:"",url:u};d.trigger(R.Events.MANIFEST_LOADED,{levels:[g],audioTracks:[],url:u,stats:s,networkDetails:p,sessionData:null})}if(s.parsing.end=performance.now(),v.needSidxRanges){var m,w=(m=v.fragments[0].initSegment)===null||m===void 0?void 0:m.url;this.load({url:w,isSidxRequest:!0,type:f,level:b,levelDetails:v,id:c,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}n.levelDetails=v,this.handlePlaylistLoaded(r,s,n,p)},x.handleSidxRequest=function(r,s){var n=Object(O.parseSegmentIndex)(new Uint8Array(r.data));if(!n)return;var p=n.references,d=s.levelDetails;p.forEach(function(c,b){var f=c.info,u=d.fragments[b];u.byteRange.length===0&&u.setByteRange(String(1+f.end-f.start)+"@"+String(f.start)),u.initSegment&&u.initSegment.setByteRange(String(n.moovEndOffset)+"@0")})},x.handleManifestParsingError=function(r,s,n,p){this.hls.trigger(R.Events.ERROR,{type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===A.PlaylistContextType.MANIFEST,url:r.url,reason:n,response:r,context:s,networkDetails:p})},x.handleNetworkError=function(r,s,n,p){n===void 0&&(n=!1),G.logger.warn("[playlist-loader]: A network "+(n?"timeout":"error")+" occurred while loading "+r.type+" level: "+r.level+" id: "+r.id+' group-id: "'+r.groupId+'"');var d=L.ErrorDetails.UNKNOWN,c=!1,b=this.getInternalLoader(r);switch(r.type){case A.PlaylistContextType.MANIFEST:d=n?L.ErrorDetails.MANIFEST_LOAD_TIMEOUT:L.ErrorDetails.MANIFEST_LOAD_ERROR,c=!0;break;case A.PlaylistContextType.LEVEL:d=n?L.ErrorDetails.LEVEL_LOAD_TIMEOUT:L.ErrorDetails.LEVEL_LOAD_ERROR,c=!1;break;case A.PlaylistContextType.AUDIO_TRACK:d=n?L.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:L.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,c=!1;break;case A.PlaylistContextType.SUBTITLE_TRACK:d=n?L.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:L.ErrorDetails.SUBTITLE_LOAD_ERROR,c=!1;break}b&&this.resetInternalLoader(r.type);var f={type:L.ErrorTypes.NETWORK_ERROR,details:d,fatal:c,url:r.url,loader:b,context:r,networkDetails:s};p&&(f.response=p),this.hls.trigger(R.Events.ERROR,f)},x.handlePlaylistLoaded=function(r,s,n,p){var d=n.type,c=n.level,b=n.id,f=n.groupId,u=n.loader,o=n.levelDetails,a=n.deliveryDirectives;if(!(o!=null&&o.targetduration)){this.handleManifestParsingError(r,n,"invalid target duration",p);return}if(!u)return;o.live&&(u.getCacheAge&&(o.ageHeader=u.getCacheAge()||0),(!u.getCacheAge||isNaN(o.ageHeader))&&(o.ageHeader=0));switch(d){case A.PlaylistContextType.MANIFEST:case A.PlaylistContextType.LEVEL:this.hls.trigger(R.Events.LEVEL_LOADED,{details:o,level:c||0,id:b||0,stats:s,networkDetails:p,deliveryDirectives:a});break;case A.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(R.Events.AUDIO_TRACK_LOADED,{details:o,id:b||0,groupId:f||"",stats:s,networkDetails:p,deliveryDirectives:a});break;case A.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(R.Events.SUBTITLE_TRACK_LOADED,{details:o,id:b||0,groupId:f||"",stats:s,networkDetails:p,deliveryDirectives:a});break}},E}();j.default=T},"./src/polyfills/number.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"isFiniteNumber",function(){return B}),D.d(j,"MAX_SAFE_INTEGER",function(){return R});var B=Number.isFinite||function(L){return typeof L=="number"&&isFinite(L)},R=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(he,j,D){"use strict";D.r(j);var B=function(){function R(){}return R.getSilentFrame=function(G,O){switch(G){case"mp4a.40.2":if(O===1)return new Uint8Array([0,200,0,128,35,128]);if(O===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(O===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(O===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(O===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(O===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(O===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(O===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(O===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}return},R}();j.default=B},"./src/remux/mp4-generator.ts":function(he,j,D){"use strict";D.r(j);var B=Math.pow(2,32)-1,R=function(){function L(){}return L.init=function(){L.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var O;for(O in L.types)L.types.hasOwnProperty(O)&&(L.types[O]=[O.charCodeAt(0),O.charCodeAt(1),O.charCodeAt(2),O.charCodeAt(3)]);var _=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]),A=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]);L.HDLR_TYPES={video:_,audio:A};var y=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),S=new Uint8Array([0,0,0,0,0,0,0,0]);L.STTS=L.STSC=L.STCO=S,L.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),L.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),L.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),L.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var C=new Uint8Array([105,115,111,109]),T=new Uint8Array([97,118,99,49]),E=new Uint8Array([0,0,0,1]);L.FTYP=L.box(L.types.ftyp,C,E,C,T),L.DINF=L.box(L.types.dinf,L.box(L.types.dref,y))},L.box=function(O){for(var _=8,A=arguments.length,y=new Array(A>1?A-1:0),S=1;S<A;S++)y[S-1]=arguments[S];for(var C=y.length,T=C;C--;)_+=y[C].byteLength;var E=new Uint8Array(_);for(E[0]=_>>24&255,E[1]=_>>16&255,E[2]=_>>8&255,E[3]=_&255,E.set(O,4),C=0,_=8;C<T;C++)E.set(y[C],_),_+=y[C].byteLength;return E},L.hdlr=function(O){return L.box(L.types.hdlr,L.HDLR_TYPES[O])},L.mdat=function(O){return L.box(L.types.mdat,O)},L.mdhd=function(O,_){_*=O;var A=Math.floor(_/(B+1)),y=Math.floor(_%(B+1));return L.box(L.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,O>>24&255,O>>16&255,O>>8&255,O&255,A>>24,A>>16&255,A>>8&255,A&255,y>>24,y>>16&255,y>>8&255,y&255,85,196,0,0]))},L.mdia=function(O){return L.box(L.types.mdia,L.mdhd(O.timescale,O.duration),L.hdlr(O.type),L.minf(O))},L.mfhd=function(O){return L.box(L.types.mfhd,new Uint8Array([0,0,0,0,O>>24,O>>16&255,O>>8&255,O&255]))},L.minf=function(O){return O.type==="audio"?L.box(L.types.minf,L.box(L.types.smhd,L.SMHD),L.DINF,L.stbl(O)):L.box(L.types.minf,L.box(L.types.vmhd,L.VMHD),L.DINF,L.stbl(O))},L.moof=function(O,_,A){return L.box(L.types.moof,L.mfhd(O),L.traf(A,_))},L.moov=function(O){for(var _=O.length,A=[];_--;)A[_]=L.trak(O[_]);return L.box.apply(null,[L.types.moov,L.mvhd(O[0].timescale,O[0].duration)].concat(A).concat(L.mvex(O)))},L.mvex=function(O){for(var _=O.length,A=[];_--;)A[_]=L.trex(O[_]);return L.box.apply(null,[L.types.mvex].concat(A))},L.mvhd=function(O,_){_*=O;var A=Math.floor(_/(B+1)),y=Math.floor(_%(B+1)),S=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,O>>24&255,O>>16&255,O>>8&255,O&255,A>>24,A>>16&255,A>>8&255,A&255,y>>24,y>>16&255,y>>8&255,y&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 L.box(L.types.mvhd,S)},L.sdtp=function(O){var _=O.samples||[],A=new Uint8Array(4+_.length),y,S;for(y=0;y<_.length;y++)S=_[y].flags,A[y+4]=S.dependsOn<<4|S.isDependedOn<<2|S.hasRedundancy;return L.box(L.types.sdtp,A)},L.stbl=function(O){return L.box(L.types.stbl,L.stsd(O),L.box(L.types.stts,L.STTS),L.box(L.types.stsc,L.STSC),L.box(L.types.stsz,L.STSZ),L.box(L.types.stco,L.STCO))},L.avc1=function(O){var _=[],A=[],y,S,C;for(y=0;y<O.sps.length;y++)S=O.sps[y],C=S.byteLength,_.push(C>>>8&255),_.push(C&255),_=_.concat(Array.prototype.slice.call(S));for(y=0;y<O.pps.length;y++)S=O.pps[y],C=S.byteLength,A.push(C>>>8&255),A.push(C&255),A=A.concat(Array.prototype.slice.call(S));var T=L.box(L.types.avcC,new Uint8Array([1,_[3],_[4],_[5],252|3,224|O.sps.length].concat(_).concat([O.pps.length]).concat(A))),E=O.width,x=O.height,l=O.pixelRatio[0],r=O.pixelRatio[1];return L.box(L.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,E>>8&255,E&255,x>>8&255,x&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]),T,L.box(L.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),L.box(L.types.pasp,new Uint8Array([l>>24,l>>16&255,l>>8&255,l&255,r>>24,r>>16&255,r>>8&255,r&255])))},L.esds=function(O){var _=O.config.length;return new Uint8Array([0,0,0,0,3,23+_,0,1,0,4,15+_,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([_]).concat(O.config).concat([6,1,2]))},L.mp4a=function(O){var _=O.samplerate;return L.box(L.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,O.channelCount,0,16,0,0,0,0,_>>8&255,_&255,0,0]),L.box(L.types.esds,L.esds(O)))},L.mp3=function(O){var _=O.samplerate;return L.box(L.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,O.channelCount,0,16,0,0,0,0,_>>8&255,_&255,0,0]))},L.stsd=function(O){return O.type==="audio"?!O.isAAC&&O.codec==="mp3"?L.box(L.types.stsd,L.STSD,L.mp3(O)):L.box(L.types.stsd,L.STSD,L.mp4a(O)):L.box(L.types.stsd,L.STSD,L.avc1(O))},L.tkhd=function(O){var _=O.id,A=O.duration*O.timescale,y=O.width,S=O.height,C=Math.floor(A/(B+1)),T=Math.floor(A%(B+1));return L.box(L.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,_>>24&255,_>>16&255,_>>8&255,_&255,0,0,0,0,C>>24,C>>16&255,C>>8&255,C&255,T>>24,T>>16&255,T>>8&255,T&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,y>>8&255,y&255,0,0,S>>8&255,S&255,0,0]))},L.traf=function(O,_){var A=L.sdtp(O),y=O.id,S=Math.floor(_/(B+1)),C=Math.floor(_%(B+1));return L.box(L.types.traf,L.box(L.types.tfhd,new Uint8Array([0,0,0,0,y>>24,y>>16&255,y>>8&255,y&255])),L.box(L.types.tfdt,new Uint8Array([1,0,0,0,S>>24,S>>16&255,S>>8&255,S&255,C>>24,C>>16&255,C>>8&255,C&255])),L.trun(O,A.length+16+20+8+16+8+8),A)},L.trak=function(O){return O.duration=O.duration||4294967295,L.box(L.types.trak,L.tkhd(O),L.mdia(O))},L.trex=function(O){var _=O.id;return L.box(L.types.trex,new Uint8Array([0,0,0,0,_>>24,_>>16&255,_>>8&255,_&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},L.trun=function(O,_){var A=O.samples||[],y=A.length,S=12+16*y,C=new Uint8Array(S),T,E,x,l,r,s;for(_+=8+S,C.set([0,0,15,1,y>>>24&255,y>>>16&255,y>>>8&255,y&255,_>>>24&255,_>>>16&255,_>>>8&255,_&255],0),T=0;T<y;T++)E=A[T],x=E.duration,l=E.size,r=E.flags,s=E.cts,C.set([x>>>24&255,x>>>16&255,x>>>8&255,x&255,l>>>24&255,l>>>16&255,l>>>8&255,l&255,r.isLeading<<2|r.dependsOn,r.isDependedOn<<6|r.hasRedundancy<<4|r.paddingValue<<1|r.isNonSync,r.degradPrio&240<<8,r.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*T);return L.box(L.types.trun,C)},L.initSegment=function(O){L.types||L.init();var _=L.moov(O),A=new Uint8Array(L.FTYP.byteLength+_.byteLength);return A.set(L.FTYP),A.set(_,L.FTYP.byteLength),A},L}();R.types=void 0,R.HDLR_TYPES=void 0,R.STTS=void 0,R.STSC=void 0,R.STCO=void 0,R.STSZ=void 0,R.VMHD=void 0,R.SMHD=void 0,R.STSD=void 0,R.FTYP=void 0,R.DINF=void 0,j.default=R},"./src/remux/mp4-remuxer.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"default",function(){return s}),D.d(j,"normalizePts",function(){return n});var B=D("./src/polyfills/number.ts"),R=D("./src/remux/aac-helper.ts"),L=D("./src/remux/mp4-generator.ts"),G=D("./src/events.ts"),O=D("./src/errors.ts"),_=D("./src/utils/logger.ts"),A=D("./src/types/loader.ts"),y=D("./src/utils/timescale-conversion.ts");function S(){return S=Object.assign||function(b){for(var f=1;f<arguments.length;f++){var u=arguments[f];for(var o in u)Object.prototype.hasOwnProperty.call(u,o)&&(b[o]=u[o])}return b},S.apply(this,arguments)}var C=10*1e3,T=1024,E=1152,x=null,l=null,r=!1,s=function(){function b(u,o,a,i){if(i===void 0&&(i=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=u,this.config=o,this.typeSupported=a,this.ISGenerated=!1,x===null){var v=navigator.userAgent||"",g=v.match(/Chrome\/(\d+)/i);x=g?parseInt(g[1]):0}if(l===null){var m=navigator.userAgent.match(/Safari\/(\d+)/i);l=m?parseInt(m[1]):0}r=!!x&&x<75||!!l&&l<600}var f=b.prototype;return f.destroy=function(){},f.resetTimeStamp=function(o){_.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=o},f.resetNextTimestamp=function(){_.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},f.resetInitSegment=function(){_.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},f.getVideoStartPts=function(o){var a=!1,i=o.reduce(function(v,g){var m=g.pts-v;return m<-4294967296?(a=!0,n(v,g.pts)):m>0?v:g.pts},o[0].pts);return a&&_.logger.debug("PTS rollover detected"),i},f.remux=function(o,a,i,v,g,m,w,P){var N,K,Y,ne,q,se,fe=g,le=g,ve=o.pid>-1,Se=a.pid>-1,ke=a.samples.length,Ce=o.samples.length>0,Le=ke>1,ge=(!ve||Ce)&&(!Se||Le)||this.ISGenerated||w;if(ge){this.ISGenerated||(Y=this.generateIS(o,a,g));var me=this.isVideoContiguous,de=-1;if(Le&&(de=p(a.samples),!me&&this.config.forceKeyFrameOnDiscontinuity))if(se=!0,de>0){_.logger.warn("[mp4-remuxer]: Dropped "+de+" out of "+ke+" video samples due to a missing keyframe");var nt=this.getVideoStartPts(a.samples);a.samples=a.samples.slice(de),a.dropped+=de,le+=(a.samples[0].pts-nt)/(a.timescale||9e4)}else de===-1&&(_.logger.warn("[mp4-remuxer]: No keyframe found out of "+ke+" video samples"),se=!1);if(this.ISGenerated){if(Ce&&Le){var Qe=this.getVideoStartPts(a.samples),qe=n(o.samples[0].pts,Qe)-Qe,We=qe/a.inputTimeScale;fe+=Math.max(0,We),le+=Math.max(0,-We)}if(Ce){if(o.samplerate||(_.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),Y=this.generateIS(o,a,g)),K=this.remuxAudio(o,fe,this.isAudioContiguous,m,Se||Le||P===A.PlaylistLevelType.AUDIO?le:void 0),Le){var xe=K?K.endPTS-K.startPTS:0;a.inputTimeScale||(_.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),Y=this.generateIS(o,a,g)),N=this.remuxVideo(a,le,me,xe)}}else Le&&(N=this.remuxVideo(a,le,me,0));N&&(N.firstKeyFrame=de,N.independent=de!==-1)}}return this.ISGenerated&&(i.samples.length&&(q=this.remuxID3(i,g)),v.samples.length&&(ne=this.remuxText(v,g))),{audio:K,video:N,initSegment:Y,independent:se,text:ne,id3:q}},f.generateIS=function(o,a,i){var v=o.samples,g=a.samples,m=this.typeSupported,w={},P=!Object(B.isFiniteNumber)(this._initPTS),N="audio/mp4",K,Y,ne;if(P&&(K=Y=Infinity),o.config&&v.length&&(o.timescale=o.samplerate,o.isAAC||(m.mpeg?(N="audio/mpeg",o.codec=""):m.mp3&&(o.codec="mp3")),w.audio={id:"audio",container:N,codec:o.codec,initSegment:!o.isAAC&&m.mpeg?new Uint8Array(0):L.default.initSegment([o]),metadata:{channelCount:o.channelCount}},P&&(ne=o.inputTimeScale,K=Y=v[0].pts-Math.round(ne*i))),a.sps&&a.pps&&g.length&&(a.timescale=a.inputTimeScale,w.video={id:"main",container:"video/mp4",codec:a.codec,initSegment:L.default.initSegment([a]),metadata:{width:a.width,height:a.height}},P)){ne=a.inputTimeScale;var q=this.getVideoStartPts(g),se=Math.round(ne*i);Y=Math.min(Y,n(g[0].dts,q)-se),K=Math.min(K,q-se)}if(Object.keys(w).length)return this.ISGenerated=!0,P&&(this._initPTS=K,this._initDTS=Y),{tracks:w,initPTS:K,timescale:ne}},f.remuxVideo=function(o,a,i,v){var g=o.inputTimeScale,m=o.samples,w=[],P=m.length,N=this._initPTS,K=this.nextAvcDts,Y=8,ne,q,se,fe=Number.POSITIVE_INFINITY,le=Number.NEGATIVE_INFINITY,ve=0,Se=!1;if(!i||K===null){var ke=a*g,Ce=m[0].pts-n(m[0].dts,m[0].pts);K=ke-Ce}for(var Le=0;Le<P;Le++){var ge=m[Le];if(ge.pts=n(ge.pts-N,K),ge.dts=n(ge.dts-N,K),ge.dts>ge.pts){var me=9e4*.2;ve=Math.max(Math.min(ve,ge.pts-ge.dts),-1*me)}ge.dts<m[Le>0?Le-1:Le].dts&&(Se=!0)}Se&&m.sort(function(dt,et){var Ze=dt.dts-et.dts,gt=dt.pts-et.pts;return Ze||gt}),q=m[0].dts,se=m[m.length-1].dts;var de=Math.round((se-q)/(P-1));if(ve<0){if(ve<de*-2){_.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(y.toMsFromMpegTsClock)(-de,!0)+" ms");for(var nt=ve,Qe=0;Qe<P;Qe++)m[Qe].dts=nt=Math.max(nt,m[Qe].pts-de),m[Qe].pts=Math.max(nt,m[Qe].pts)}else{_.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(y.toMsFromMpegTsClock)(ve,!0)+" ms to overcome this issue");for(var qe=0;qe<P;qe++)m[qe].dts=m[qe].dts+ve}q=m[0].dts}if(i){var We=q-K,xe=We>de,Te=We<-1;if(xe||Te){xe?_.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(We,!0)+" ms ("+We+"dts) hole between fragments detected, filling it"):_.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(-We,!0)+" ms ("+We+"dts) overlapping between fragments detected"),q=K;var we=m[0].pts-We;m[0].dts=q,m[0].pts=we,_.logger.log("Video: First PTS/DTS adjusted: "+Object(y.toMsFromMpegTsClock)(we,!0)+"/"+Object(y.toMsFromMpegTsClock)(q,!0)+", delta: "+Object(y.toMsFromMpegTsClock)(We,!0)+" ms")}}r&&(q=Math.max(0,q));for(var Oe=0,Ne=0,De=0;De<P;De++){for(var Ee=m[De],Ie=Ee.units,_e=Ie.length,Me=0,Ue=0;Ue<_e;Ue++)Me+=Ie[Ue].data.length;Ne+=Me,Oe+=_e,Ee.length=Me,Ee.dts=Math.max(Ee.dts,q),Ee.pts=Math.max(Ee.pts,Ee.dts,0),fe=Math.min(Ee.pts,fe),le=Math.max(Ee.pts,le)}se=m[P-1].dts;var je=Ne+4*Oe+8,Ge;try{Ge=new Uint8Array(je)}catch(dt){this.observer.emit(G.Events.ERROR,G.Events.ERROR,{type:O.ErrorTypes.MUX_ERROR,details:O.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:je,reason:"fail allocating video mdat "+je});return}var Ke=new DataView(Ge.buffer);Ke.setUint32(0,je),Ge.set(L.default.types.mdat,4);for(var Ae=0;Ae<P;Ae++){for(var Xe=m[Ae],Ve=Xe.units,X=0,F=0,U=Ve.length;F<U;F++){var $=Ve[F],J=$.data,W=$.data.byteLength;Ke.setUint32(Y,W),Y+=4,Ge.set(J,Y),Y+=W,X+=4+W}if(Ae<P-1)ne=m[Ae+1].dts-Xe.dts;else{var H=this.config,Q=Xe.dts-m[Ae>0?Ae-1:Ae].dts;if(H.stretchShortVideoTrack&&this.nextAudioPts!==null){var Z=Math.floor(H.maxBufferHole*g),ce=(v?fe+v*g:this.nextAudioPts)-Xe.pts;ce>Z?(ne=ce-Q,ne<0&&(ne=Q),_.logger.log("[mp4-remuxer]: It is approximately "+ce/90+" ms to the next segment; using duration "+ne/90+" ms for the last video frame.")):ne=Q}else ne=Q}var ue=Math.round(Xe.pts-Xe.dts);w.push(new d(Xe.key,ne,X,ue))}if(w.length&&x&&x<70){var ye=w[0].flags;ye.dependsOn=2,ye.isNonSync=0}console.assert(ne!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=K=se+ne,this.isVideoContiguous=!0;var Fe=L.default.moof(o.sequenceNumber++,q,S({},o,{samples:w})),Ye="video",ze={data1:Fe,data2:Ge,startPTS:fe/g,endPTS:(le+ne)/g,startDTS:q/g,endDTS:K/g,type:Ye,hasAudio:!1,hasVideo:!0,nb:w.length,dropped:o.dropped};return o.samples=[],o.dropped=0,console.assert(Ge.length,"MDAT length must not be zero"),ze},f.remuxAudio=function(o,a,i,v,g){var m=o.inputTimeScale,w=o.samplerate?o.samplerate:m,P=m/w,N=o.isAAC?T:E,K=N*P,Y=this._initPTS,ne=!o.isAAC&&this.typeSupported.mpeg,q=[],se=o.samples,fe=ne?0:8,le=this.nextAudioPts||-1,ve=a*m;if(this.isAudioContiguous=i=i||se.length&&le>0&&(v&&Math.abs(ve-le)<9e3||Math.abs(n(se[0].pts-Y,ve)-le)<20*K),se.forEach(function(J){J.pts=n(J.pts-Y,ve)}),!i||le<0){if(se=se.filter(function(J){return J.pts>=0}),!se.length)return;g===0?le=0:v?le=Math.max(0,ve):le=se[0].pts}if(o.isAAC)for(var Se=g!==void 0,ke=this.config.maxAudioFramesDrift,Ce=0,Le=le;Ce<se.length;Ce++){var ge=se[Ce],me=ge.pts,de=me-Le,nt=Math.abs(1e3*de/m);if(de<=-ke*K&&Se)Ce===0&&(_.logger.warn("Audio frame @ "+(me/m).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*de/m)+" ms."),this.nextAudioPts=le=Le=me);else if(de>=ke*K&&nt<C&&Se){var Qe=Math.round(de/K);Le=me-Qe*K,Le<0&&(Qe--,Le+=K),Ce===0&&(this.nextAudioPts=le=Le),_.logger.warn("[mp4-remuxer]: Injecting "+Qe+" audio frame @ "+(Le/m).toFixed(3)+"s due to "+Math.round(1e3*de/m)+" ms gap.");for(var qe=0;qe<Qe;qe++){var We=Math.max(Le,0),xe=R.default.getSilentFrame(o.manifestCodec||o.codec,o.channelCount);xe||(_.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),xe=ge.unit.subarray()),se.splice(Ce,0,{unit:xe,pts:We}),Le+=K,Ce++}}ge.pts=Le,Le+=K}for(var Te=null,we=null,Oe,Ne=0,De=se.length;De--;)Ne+=se[De].unit.byteLength;for(var Ee=0,Ie=se.length;Ee<Ie;Ee++){var _e=se[Ee],Me=_e.unit,Ue=_e.pts;if(we!==null){var je=q[Ee-1];je.duration=Math.round((Ue-we)/P)}else if(i&&o.isAAC&&(Ue=le),Te=Ue,Ne>0){Ne+=fe;try{Oe=new Uint8Array(Ne)}catch(J){this.observer.emit(G.Events.ERROR,G.Events.ERROR,{type:O.ErrorTypes.MUX_ERROR,details:O.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ne,reason:"fail allocating audio mdat "+Ne});return}if(!ne){var Ge=new DataView(Oe.buffer);Ge.setUint32(0,Ne),Oe.set(L.default.types.mdat,4)}}else return;Oe.set(Me,fe);var Ke=Me.byteLength;fe+=Ke,q.push(new d(!0,N,Ke,0)),we=Ue}var Ae=q.length;if(!Ae)return;var Xe=q[q.length-1];this.nextAudioPts=le=we+P*Xe.duration;var Ve=ne?new Uint8Array(0):L.default.moof(o.sequenceNumber++,Te/P,S({},o,{samples:q}));o.samples=[];var X=Te/m,F=le/m,U="audio",$={data1:Ve,data2:Oe,startPTS:X,endPTS:F,startDTS:X,endDTS:F,type:U,hasAudio:!0,hasVideo:!1,nb:Ae};return this.isAudioContiguous=!0,console.assert(Oe.length,"MDAT length must not be zero"),$},f.remuxEmptyAudio=function(o,a,i,v){var g=o.inputTimeScale,m=o.samplerate?o.samplerate:g,w=g/m,P=this.nextAudioPts,N=(P!==null?P:v.startDTS*g)+this._initDTS,K=v.endDTS*g+this._initDTS,Y=w*T,ne=Math.ceil((K-N)/Y),q=R.default.getSilentFrame(o.manifestCodec||o.codec,o.channelCount);if(_.logger.warn("[mp4-remuxer]: remux empty Audio"),!q){_.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var se=[],fe=0;fe<ne;fe++){var le=N+fe*Y;se.push({unit:q,pts:le,dts:le})}return o.samples=se,this.remuxAudio(o,a,i,!1)},f.remuxID3=function(o,a){var i=o.samples.length;if(!i)return;for(var v=o.inputTimeScale,g=this._initPTS,m=this._initDTS,w=0;w<i;w++){var P=o.samples[w];P.pts=n(P.pts-g,a*v)/v,P.dts=n(P.dts-m,a*v)/v}var N=o.samples;return o.samples=[],{samples:N}},f.remuxText=function(o,a){var i=o.samples.length;if(!i)return;for(var v=o.inputTimeScale,g=this._initPTS,m=0;m<i;m++){var w=o.samples[m];w.pts=n(w.pts-g,a*v)/v}o.samples.sort(function(N,K){return N.pts-K.pts});var P=o.samples;return o.samples=[],{samples:P}},b}();function n(b,f){var u;if(f===null)return b;for(f<b?u=-8589934592:u=8589934592;Math.abs(b-f)>4294967296;)b+=u;return b}function p(b){for(var f=0;f<b.length;f++)if(b[f].key)return f;return-1}var d=function(f,u,o,a){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=u,this.size=o,this.cts=a,this.flags=new c(f)},c=function(f){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=f?2:1,this.isNonSync=f?0:1}},"./src/remux/passthrough-remuxer.ts":function(he,j,D){"use strict";D.r(j);var B=D("./src/polyfills/number.ts"),R=D("./src/utils/mp4-tools.ts"),L=D("./src/loader/fragment.ts"),G=D("./src/utils/logger.ts"),O=function(){function y(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var S=y.prototype;return S.destroy=function(){},S.resetTimeStamp=function(T){this.initPTS=T,this.lastEndDTS=null},S.resetNextTimestamp=function(){this.lastEndDTS=null},S.resetInitSegment=function(T,E,x){this.audioCodec=E,this.videoCodec=x,this.generateInitSegment(T),this.emitInitSegment=!0},S.generateInitSegment=function(T){var E=this.audioCodec,x=this.videoCodec;if(!T||!T.byteLength){this.initTracks=void 0,this.initData=void 0;return}var l=this.initData=Object(R.parseInitSegment)(T);E||(E=A(l.audio,L.ElementaryStreamTypes.AUDIO)),x||(x=A(l.video,L.ElementaryStreamTypes.VIDEO));var r={};l.audio&&l.video?r.audiovideo={container:"video/mp4",codec:E+","+x,initSegment:T,id:"main"}:l.audio?r.audio={container:"audio/mp4",codec:E,initSegment:T,id:"audio"}:l.video?r.video={container:"video/mp4",codec:x,initSegment:T,id:"main"}:G.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=r},S.remux=function(T,E,x,l,r){var s=this.initPTS,n=this.lastEndDTS,p={audio:void 0,video:void 0,text:l,id3:x,initSegment:void 0};Object(B.isFiniteNumber)(n)||(n=this.lastEndDTS=r||0);var d=E.samples;if(!d||!d.length)return p;var c={initPTS:void 0,timescale:1},b=this.initData;if((!b||!b.length)&&(this.generateInitSegment(d),b=this.initData),!b||!b.length)return G.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),p;this.emitInitSegment&&(c.tracks=this.initTracks,this.emitInitSegment=!1),Object(B.isFiniteNumber)(s)||(this.initPTS=c.initPTS=s=_(b,d,n));var f=Object(R.getDuration)(d,b),u=n,o=f+u;Object(R.offsetStartDTS)(b,d,s),f>0?this.lastEndDTS=o:(G.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var a=!!b.audio,i=!!b.video,v="";a&&(v+="audio"),i&&(v+="video");var g={data1:d,startPTS:u,startDTS:u,endPTS:o,endDTS:o,type:v,hasAudio:a,hasVideo:i,nb:1,dropped:0};return p.audio=g.type==="audio"?g:void 0,p.video=g.type!=="audio"?g:void 0,p.text=l,p.id3=x,p.initSegment=c,p},y}(),_=function(S,C,T){return Object(R.getStartDTS)(S,C)-T};function A(y,S){var C=y==null?void 0:y.codec;return C&&C.length>4?C:C==="hvc1"?"hvc1.1.c.L120.90":C==="av01"?"av01.0.04M.08":C==="avc1"||S===L.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}j.default=O},"./src/task-loop.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"default",function(){return B});var B=function(){function R(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var L=R.prototype;return L.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},L.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},L.onHandlerDestroyed=function(){},L.hasInterval=function(){return!!this._tickInterval},L.hasNextTick=function(){return!!this._tickTimer},L.setInterval=function(O){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,O),!0)},L.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},L.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},L.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},L.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},L.doTick=function(){},R}()},"./src/types/cmcd.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"CMCDVersion",function(){return B}),D.d(j,"CMCDObjectType",function(){return R}),D.d(j,"CMCDStreamingFormat",function(){return L}),D.d(j,"CMCDStreamType",function(){return G});var B=1,R;(function(O){O.MANIFEST="m",O.AUDIO="a",O.VIDEO="v",O.MUXED="av",O.INIT="i",O.CAPTION="c",O.TIMED_TEXT="tt",O.KEY="k",O.OTHER="o"})(R||(R={}));var L;(function(O){O.DASH="d",O.HLS="h",O.SMOOTH="s",O.OTHER="o"})(L||(L={}));var G;(function(O){O.VOD="v",O.LIVE="l"})(G||(G={}))},"./src/types/level.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"HlsSkip",function(){return L}),D.d(j,"getSkipValue",function(){return G}),D.d(j,"HlsUrlParameters",function(){return O}),D.d(j,"Level",function(){return _});function B(A,y){for(var S=0;S<y.length;S++){var C=y[S];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(A,C.key,C)}}function R(A,y,S){return y&&B(A.prototype,y),S&&B(A,S),A}var L;(function(A){A.No="",A.Yes="YES",A.v2="v2"})(L||(L={}));function G(A,y){var S=A.canSkipUntil,C=A.canSkipDateRanges,T=A.endSN,E=y!==void 0?y-T:0;return S&&E<S?C?L.v2:L.Yes:L.No}var O=function(){function A(S,C,T){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=S,this.part=C,this.skip=T}var y=A.prototype;return y.addDirectives=function(C){var T=new self.URL(C);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.toString()},A}(),_=function(){function A(y){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[y.url],this.attrs=y.attrs,this.bitrate=y.bitrate,y.details&&(this.details=y.details),this.id=y.id||0,this.name=y.name,this.width=y.width||0,this.height=y.height||0,this.audioCodec=y.audioCodec,this.videoCodec=y.videoCodec,this.unknownCodecs=y.unknownCodecs,this.codecSet=[y.videoCodec,y.audioCodec].filter(function(S){return S}).join(",").replace(/\.[^.,]+/g,"")}return R(A,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(S){var C=S%this.url.length;this._urlId!==C&&(this.details=void 0,this._urlId=C)}}]),A}()},"./src/types/loader.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"PlaylistContextType",function(){return B}),D.d(j,"PlaylistLevelType",function(){return R});var B;(function(L){L.MANIFEST="manifest",L.LEVEL="level",L.AUDIO_TRACK="audioTrack",L.SUBTITLE_TRACK="subtitleTrack"})(B||(B={}));var R;(function(L){L.MAIN="main",L.AUDIO="audio",L.SUBTITLE="subtitle"})(R||(R={}))},"./src/types/transmuxer.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"ChunkMetadata",function(){return B});var B=function(G,O,_,A,y,S){A===void 0&&(A=0),y===void 0&&(y=-1),S===void 0&&(S=!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=R(),this.buffering={audio:R(),video:R(),audiovideo:R()},this.level=G,this.sn=O,this.id=_,this.size=A,this.part=y,this.partial=S};function R(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"AttrList",function(){return L});var B=/^(\d+)x(\d+)$/,R=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,L=function(){function G(_){typeof _=="string"&&(_=G.parseAttrList(_));for(var A in _)_.hasOwnProperty(A)&&(this[A]=_[A])}var O=G.prototype;return O.decimalInteger=function(A){var y=parseInt(this[A],10);return y>Number.MAX_SAFE_INTEGER?Infinity:y},O.hexadecimalInteger=function(A){if(this[A]){var y=(this[A]||"0x").slice(2);y=(y.length&1?"0":"")+y;for(var S=new Uint8Array(y.length/2),C=0;C<y.length/2;C++)S[C]=parseInt(y.slice(C*2,C*2+2),16);return S}else return null},O.hexadecimalIntegerAsNumber=function(A){var y=parseInt(this[A],16);return y>Number.MAX_SAFE_INTEGER?Infinity:y},O.decimalFloatingPoint=function(A){return parseFloat(this[A])},O.optionalFloat=function(A,y){var S=this[A];return S?parseFloat(S):y},O.enumeratedString=function(A){return this[A]},O.bool=function(A){return this[A]==="YES"},O.decimalResolution=function(A){var y=B.exec(this[A]);return y===null?void 0:{width:parseInt(y[1],10),height:parseInt(y[2],10)}},G.parseAttrList=function(A){var y,S={},C='"';for(R.lastIndex=0;(y=R.exec(A))!==null;){var T=y[2];T.indexOf(C)===0&&T.lastIndexOf(C)===T.length-1&&(T=T.slice(1,-1)),S[y[1]]=T}return S},G}()},"./src/utils/binary-search.ts":function(he,j,D){"use strict";D.r(j);var B={search:function(L,G){for(var O=0,_=L.length-1,A=null,y=null;O<=_;){A=(O+_)/2|0,y=L[A];var S=G(y);if(S>0)O=A+1;else if(S<0)_=A-1;else return y}return null}};j.default=B},"./src/utils/buffer-helper.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"BufferHelper",function(){return L});var B=D("./src/utils/logger.ts"),R={length:0,start:function(){return 0},end:function(){return 0}},L=function(){function G(){}return G.isBuffered=function(_,A){try{if(_){for(var y=G.getBuffered(_),S=0;S<y.length;S++)if(A>=y.start(S)&&A<=y.end(S))return!0}}catch(C){}return!1},G.bufferInfo=function(_,A,y){try{if(_){var S=G.getBuffered(_),C=[],T;for(T=0;T<S.length;T++)C.push({start:S.start(T),end:S.end(T)});return this.bufferedInfo(C,A,y)}}catch(E){}return{len:0,start:A,end:A,nextStart:void 0}},G.bufferedInfo=function(_,A,y){A=Math.max(0,A),_.sort(function(c,b){var f=c.start-b.start;return f||b.end-c.end});var S=[];if(y)for(var C=0;C<_.length;C++){var T=S.length;if(T){var E=S[T-1].end;_[C].start-E<y?_[C].end>E&&(S[T-1].end=_[C].end):S.push(_[C])}else S.push(_[C])}else S=_;for(var x=0,l,r=A,s=A,n=0;n<S.length;n++){var p=S[n].start,d=S[n].end;if(A+y>=p&&A<d)r=p,s=d,x=s-A;else if(A+y<p){l=p;break}}return{len:x,start:r||0,end:s||0,nextStart:l}},G.getBuffered=function(_){try{return _.buffered}catch(A){return B.logger.log("failed to get media.buffered",A),R}},G}()},"./src/utils/cea-608-parser.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"Row",function(){return s}),D.d(j,"CaptionScreen",function(){return n});var B=D("./src/utils/logger.ts"),R={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},L=function(o){var a=o;return R.hasOwnProperty(o)&&(a=R[o]),String.fromCharCode(a)},G=15,O=100,_={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},A={17:2,18:4,21:6,22:8,23:10,19:13,20:15},y={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},S={25:2,26:4,29:6,30:8,31:10,27:13,28:15},C=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],T;(function(u){u[u.ERROR=0]="ERROR",u[u.TEXT=1]="TEXT",u[u.WARNING=2]="WARNING",u[u.INFO=2]="INFO",u[u.DEBUG=3]="DEBUG",u[u.DATA=3]="DATA"})(T||(T={}));var E=function(){function u(){this.time=null,this.verboseLevel=T.ERROR}var o=u.prototype;return o.log=function(i,v){this.verboseLevel>=i&&B.logger.log(this.time+" ["+i+"] "+v)},u}(),x=function(o){for(var a=[],i=0;i<o.length;i++)a.push(o[i].toString(16));return a},l=function(){function u(a,i,v,g,m){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=a||"white",this.underline=i||!1,this.italics=v||!1,this.background=g||"black",this.flash=m||!1}var o=u.prototype;return o.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},o.setStyles=function(i){for(var v=["foreground","underline","italics","background","flash"],g=0;g<v.length;g++){var m=v[g];i.hasOwnProperty(m)&&(this[m]=i[m])}},o.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},o.equals=function(i){return this.foreground===i.foreground&&this.underline===i.underline&&this.italics===i.italics&&this.background===i.background&&this.flash===i.flash},o.copy=function(i){this.foreground=i.foreground,this.underline=i.underline,this.italics=i.italics,this.background=i.background,this.flash=i.flash},o.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},u}(),r=function(){function u(a,i,v,g,m,w){this.uchar=void 0,this.penState=void 0,this.uchar=a||" ",this.penState=new l(i,v,g,m,w)}var o=u.prototype;return o.reset=function(){this.uchar=" ",this.penState.reset()},o.setChar=function(i,v){this.uchar=i,this.penState.copy(v)},o.setPenState=function(i){this.penState.copy(i)},o.equals=function(i){return this.uchar===i.uchar&&this.penState.equals(i.penState)},o.copy=function(i){this.uchar=i.uchar,this.penState.copy(i.penState)},o.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},u}(),s=function(){function u(a){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var i=0;i<O;i++)this.chars.push(new r);this.logger=a,this.pos=0,this.currPenState=new l}var o=u.prototype;return o.equals=function(i){for(var v=!0,g=0;g<O;g++)if(!this.chars[g].equals(i.chars[g])){v=!1;break}return v},o.copy=function(i){for(var v=0;v<O;v++)this.chars[v].copy(i.chars[v])},o.isEmpty=function(){for(var i=!0,v=0;v<O;v++)if(!this.chars[v].isEmpty()){i=!1;break}return i},o.setCursor=function(i){this.pos!==i&&(this.pos=i),this.pos<0?(this.logger.log(T.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>O&&(this.logger.log(T.DEBUG,"Too large cursor position "+this.pos),this.pos=O)},o.moveCursor=function(i){var v=this.pos+i;if(i>1)for(var g=this.pos+1;g<v+1;g++)this.chars[g].setPenState(this.currPenState);this.setCursor(v)},o.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},o.insertChar=function(i){i>=144&&this.backSpace();var v=L(i);if(this.pos>=O){this.logger.log(T.ERROR,"Cannot insert "+i.toString(16)+" ("+v+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(v,this.currPenState),this.moveCursor(1)},o.clearFromPos=function(i){var v;for(v=i;v<O;v++)this.chars[v].reset()},o.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},o.clearToEndOfRow=function(){this.clearFromPos(this.pos)},o.getTextString=function(){for(var i=[],v=!0,g=0;g<O;g++){var m=this.chars[g].uchar;m!==" "&&(v=!1),i.push(m)}return v?"":i.join("")},o.setPenStyles=function(i){this.currPenState.setStyles(i);var v=this.chars[this.pos];v.setPenState(this.currPenState)},u}(),n=function(){function u(a){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var i=0;i<G;i++)this.rows.push(new s(a));this.logger=a,this.currRow=G-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var o=u.prototype;return o.reset=function(){for(var i=0;i<G;i++)this.rows[i].clear();this.currRow=G-1},o.equals=function(i){for(var v=!0,g=0;g<G;g++)if(!this.rows[g].equals(i.rows[g])){v=!1;break}return v},o.copy=function(i){for(var v=0;v<G;v++)this.rows[v].copy(i.rows[v])},o.isEmpty=function(){for(var i=!0,v=0;v<G;v++)if(!this.rows[v].isEmpty()){i=!1;break}return i},o.backSpace=function(){var i=this.rows[this.currRow];i.backSpace()},o.clearToEndOfRow=function(){var i=this.rows[this.currRow];i.clearToEndOfRow()},o.insertChar=function(i){var v=this.rows[this.currRow];v.insertChar(i)},o.setPen=function(i){var v=this.rows[this.currRow];v.setPenStyles(i)},o.moveCursor=function(i){var v=this.rows[this.currRow];v.moveCursor(i)},o.setCursor=function(i){this.logger.log(T.INFO,"setCursor: "+i);var v=this.rows[this.currRow];v.setCursor(i)},o.setPAC=function(i){this.logger.log(T.INFO,"pacData = "+JSON.stringify(i));var v=i.row-1;if(this.nrRollUpRows&&v<this.nrRollUpRows-1&&(v=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==v){for(var g=0;g<G;g++)this.rows[g].clear();var m=this.currRow+1-this.nrRollUpRows,w=this.lastOutputScreen;if(w){var P=w.rows[m].cueStartTime,N=this.logger.time;if(P&&N!==null&&P<N)for(var K=0;K<this.nrRollUpRows;K++)this.rows[v-this.nrRollUpRows+K+1].copy(w.rows[m+K])}}this.currRow=v;var Y=this.rows[this.currRow];if(i.indent!==null){var ne=i.indent,q=Math.max(ne-1,0);Y.setCursor(i.indent),i.color=Y.chars[q].penState.foreground}var se={foreground:i.color,underline:i.underline,italics:i.italics,background:"black",flash:!1};this.setPen(se)},o.setBkgData=function(i){this.logger.log(T.INFO,"bkgData = "+JSON.stringify(i)),this.backSpace(),this.setPen(i),this.insertChar(32)},o.setRollUpRows=function(i){this.nrRollUpRows=i},o.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(T.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(T.TEXT,this.getDisplayText());var i=this.currRow+1-this.nrRollUpRows,v=this.rows.splice(i,1)[0];v.clear(),this.rows.splice(this.currRow,0,v),this.logger.log(T.INFO,"Rolling up")},o.getDisplayText=function(i){i=i||!1;for(var v=[],g="",m=-1,w=0;w<G;w++){var P=this.rows[w].getTextString();P&&(m=w+1,i?v.push("Row "+m+": '"+P+"'"):v.push(P.trim()))}return v.length>0&&(i?g="["+v.join(" | ")+"]":g=v.join(`
`)),g},o.getTextAndFormat=function(){return this.rows},u}(),p=function(){function u(a,i,v){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=a,this.outputFilter=i,this.mode=null,this.verbose=0,this.displayedMemory=new n(v),this.nonDisplayedMemory=new n(v),this.lastOutputScreen=new n(v),this.currRollUpRow=this.displayedMemory.rows[G-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=v}var o=u.prototype;return o.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[G-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},o.getHandler=function(){return this.outputFilter},o.setHandler=function(i){this.outputFilter=i},o.setPAC=function(i){this.writeScreen.setPAC(i)},o.setBkgData=function(i){this.writeScreen.setBkgData(i)},o.setMode=function(i){if(i===this.mode)return;this.mode=i,this.logger.log(T.INFO,"MODE="+i),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=i},o.insertChars=function(i){for(var v=0;v<i.length;v++)this.writeScreen.insertChar(i[v]);var g=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(T.INFO,g+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(T.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},o.ccRCL=function(){this.logger.log(T.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},o.ccBS=function(){if(this.logger.log(T.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},o.ccAOF=function(){},o.ccAON=function(){},o.ccDER=function(){this.logger.log(T.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},o.ccRU=function(i){this.logger.log(T.INFO,"RU("+i+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(i)},o.ccFON=function(){this.logger.log(T.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},o.ccRDC=function(){this.logger.log(T.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},o.ccTR=function(){this.logger.log(T.INFO,"TR"),this.setMode("MODE_TEXT")},o.ccRTD=function(){this.logger.log(T.INFO,"RTD"),this.setMode("MODE_TEXT")},o.ccEDM=function(){this.logger.log(T.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},o.ccCR=function(){this.logger.log(T.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},o.ccENM=function(){this.logger.log(T.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},o.ccEOC=function(){if(this.logger.log(T.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var i=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=i,this.writeScreen=this.nonDisplayedMemory,this.logger.log(T.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},o.ccTO=function(i){this.logger.log(T.INFO,"TO("+i+") - Tab Offset"),this.writeScreen.moveCursor(i)},o.ccMIDROW=function(i){var v={flash:!1};if(v.underline=i%2===1,v.italics=i>=46,v.italics)v.foreground="white";else{var g=Math.floor(i/2)-16,m=["white","green","blue","cyan","red","yellow","magenta"];v.foreground=m[g]}this.logger.log(T.INFO,"MIDROW: "+JSON.stringify(v)),this.writeScreen.setPen(v)},o.outputDataUpdate=function(i){i===void 0&&(i=!1);var v=this.logger.time;if(v===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=v:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,v,this.lastOutputScreen),i&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:v),this.lastOutputScreen.copy(this.displayedMemory))},o.cueSplitAtTime=function(i){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,i,this.displayedMemory),this.cueStartTime=i))},u}(),d=function(){function u(a,i,v){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var g=new E;this.channels=[null,new p(a,i,g),new p(a+1,v,g)],this.cmdHistory=f(),this.logger=g}var o=u.prototype;return o.getHandler=function(i){return this.channels[i].getHandler()},o.setHandler=function(i,v){this.channels[i].setHandler(v)},o.addData=function(i,v){var g,m,w,P=!1;this.logger.time=i;for(var N=0;N<v.length;N+=2){if(m=v[N]&127,w=v[N+1]&127,m===0&&w===0)continue;if(this.logger.log(T.DATA,"["+x([v[N],v[N+1]])+"] -> ("+x([m,w])+")"),g=this.parseCmd(m,w),g||(g=this.parseMidrow(m,w)),g||(g=this.parsePAC(m,w)),g||(g=this.parseBackgroundAttributes(m,w)),!g&&(P=this.parseChars(m,w),P)){var K=this.currentChannel;if(K&&K>0){var Y=this.channels[K];Y.insertChars(P)}else this.logger.log(T.WARNING,"No channel found yet. TEXT-MODE?")}!g&&!P&&this.logger.log(T.WARNING,"Couldn't parse cleaned data "+x([m,w])+" orig: "+x([v[N],v[N+1]]))}},o.parseCmd=function(i,v){var g=this.cmdHistory,m=(i===20||i===28||i===21||i===29)&&v>=32&&v<=47,w=(i===23||i===31)&&v>=33&&v<=35;if(!(m||w))return!1;if(b(i,v,g))return c(null,null,g),this.logger.log(T.DEBUG,"Repeated command ("+x([i,v])+") is dropped"),!0;var P=i===20||i===21||i===23?1:2,N=this.channels[P];return i===20||i===21||i===28||i===29?v===32?N.ccRCL():v===33?N.ccBS():v===34?N.ccAOF():v===35?N.ccAON():v===36?N.ccDER():v===37?N.ccRU(2):v===38?N.ccRU(3):v===39?N.ccRU(4):v===40?N.ccFON():v===41?N.ccRDC():v===42?N.ccTR():v===43?N.ccRTD():v===44?N.ccEDM():v===45?N.ccCR():v===46?N.ccENM():v===47&&N.ccEOC():N.ccTO(v-32),c(i,v,g),this.currentChannel=P,!0},o.parseMidrow=function(i,v){var g=0;if((i===17||i===25)&&v>=32&&v<=47){if(i===17?g=1:g=2,g!==this.currentChannel)return this.logger.log(T.ERROR,"Mismatch channel in midrow parsing"),!1;var m=this.channels[g];return m?(m.ccMIDROW(v),this.logger.log(T.DEBUG,"MIDROW ("+x([i,v])+")"),!0):!1}return!1},o.parsePAC=function(i,v){var g,m=this.cmdHistory,w=(i>=17&&i<=23||i>=25&&i<=31)&&v>=64&&v<=127,P=(i===16||i===24)&&v>=64&&v<=95;if(!(w||P))return!1;if(b(i,v,m))return c(null,null,m),!0;var N=i<=23?1:2;v>=64&&v<=95?g=N===1?_[i]:y[i]:g=N===1?A[i]:S[i];var K=this.channels[N];return K?(K.setPAC(this.interpretPAC(g,v)),c(i,v,m),this.currentChannel=N,!0):!1},o.interpretPAC=function(i,v){var g,m={color:null,italics:!1,indent:null,underline:!1,row:i};return v>95?g=v-96:g=v-64,m.underline=(g&1)===1,g<=13?m.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(g/2)]:g<=15?(m.italics=!0,m.color="white"):m.indent=Math.floor((g-16)/2)*4,m},o.parseChars=function(i,v){var g,m=null,w=null;if(i>=25?(g=2,w=i-8):(g=1,w=i),w>=17&&w<=19){var P;w===17?P=v+80:w===18?P=v+112:P=v+144,this.logger.log(T.INFO,"Special char '"+L(P)+"' in channel "+g),m=[P]}else i>=32&&i<=127&&(m=v===0?[i]:[i,v]);if(m){var N=x(m);this.logger.log(T.DEBUG,"Char codes = "+N.join(",")),c(i,v,this.cmdHistory)}return m},o.parseBackgroundAttributes=function(i,v){var g=(i===16||i===24)&&v>=32&&v<=47,m=(i===23||i===31)&&v>=45&&v<=47;if(!(g||m))return!1;var w,P={};i===16||i===24?(w=Math.floor((v-32)/2),P.background=C[w],v%2===1&&(P.background=P.background+"_semi")):v===45?P.background="transparent":(P.foreground="black",v===47&&(P.underline=!0));var N=i<=23?1:2,K=this.channels[N];return K.setBkgData(P),c(i,v,this.cmdHistory),!0},o.reset=function(){for(var i=0;i<Object.keys(this.channels).length;i++){var v=this.channels[i];v&&v.reset()}this.cmdHistory=f()},o.cueSplitAtTime=function(i){for(var v=0;v<this.channels.length;v++){var g=this.channels[v];g&&g.cueSplitAtTime(i)}},u}();function c(u,o,a){a.a=u,a.b=o}function b(u,o,a){return a.a===u&&a.b===o}function f(){return{a:null,b:null}}j.default=d},"./src/utils/codecs.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"isCodecType",function(){return R}),D.d(j,"isCodecSupportedInMp4",function(){return L});var B={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function R(G,O){var _=B[O];return!!_&&_[G.slice(0,4)]===!0}function L(G,O){return MediaSource.isTypeSupported((O||"video")+'/mp4;codecs="'+G+'"')}},"./src/utils/cues.ts":function(he,j,D){"use strict";D.r(j);var B=D("./src/utils/vttparser.ts"),R=D("./src/utils/webvtt-parser.ts"),L=D("./src/utils/texttrack-utils.ts"),G=/\s/,O={newCue:function(A,y,S,C){for(var T=[],E,x,l,r,s,n=self.VTTCue||self.TextTrackCue,p=0;p<C.rows.length;p++)if(E=C.rows[p],l=!0,r=0,s="",!E.isEmpty()){for(var d=0;d<E.chars.length;d++)G.test(E.chars[d].uchar)&&l?r++:(s+=E.chars[d].uchar,l=!1);E.cueStartTime=y,y===S&&(S+=1e-4),r>=16?r--:r++;var c=Object(B.fixLineBreaks)(s.trim()),b=Object(R.generateCueId)(y,S,c);(!A||!A.cues||!A.cues.getCueById(b))&&(x=new n(y,S,c),x.id=b,x.line=p+1,x.align="left",x.position=10+Math.min(80,Math.floor(r*8/32)*10),T.push(x))}return A&&T.length&&(T.sort(function(f,u){return f.line==="auto"||u.line==="auto"?0:f.line>8&&u.line>8?u.line-f.line:f.line-u.line}),T.forEach(function(f){return Object(L.addCueToTrack)(A,f)})),T}};j.default=O},"./src/utils/discontinuities.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"findFirstFragWithCC",function(){return G}),D.d(j,"shouldAlignOnDiscontinuities",function(){return O}),D.d(j,"findDiscontinuousReferenceFrag",function(){return _}),D.d(j,"adjustSlidingStart",function(){return y}),D.d(j,"alignStream",function(){return S}),D.d(j,"alignPDT",function(){return T}),D.d(j,"alignFragmentByPDTDelta",function(){return E}),D.d(j,"alignMediaPlaylistByPDT",function(){return x});var B=D("./src/polyfills/number.ts"),R=D("./src/utils/logger.ts"),L=D("./src/controller/level-helper.ts");function G(l,r){for(var s=null,n=0,p=l.length;n<p;n++){var d=l[n];if(d&&d.cc===r){s=d;break}}return s}function O(l,r,s){return!!(r.details&&(s.endCC>s.startCC||l&&l.cc<s.startCC))}function _(l,r){var s=l.fragments,n=r.fragments;if(!n.length||!s.length){R.logger.log("No fragments to align");return}var p=G(s,n[0].cc);if(!p||p&&!p.startPTS){R.logger.log("No frag in previous level to align on");return}return p}function A(l,r){if(l){var s=l.start+r;l.start=l.startPTS=s,l.endPTS=s+l.duration}}function y(l,r){for(var s=r.fragments,n=0,p=s.length;n<p;n++)A(s[n],l);r.fragmentHint&&A(r.fragmentHint,l),r.alignedSliding=!0}function S(l,r,s){if(!r)return;C(l,s,r),!s.alignedSliding&&r.details&&T(s,r.details),!s.alignedSliding&&r.details&&!s.skippedSegments&&Object(L.adjustSliding)(r.details,s)}function C(l,r,s){if(O(l,s,r)){var n=_(s.details,r);n&&Object(B.isFiniteNumber)(n.start)&&(R.logger.log("Adjusting PTS using last level due to CC increase within current level "+r.url),y(n.start,r))}}function T(l,r){if(!r.fragments.length||!l.hasProgramDateTime||!r.hasProgramDateTime)return;var s=r.fragments[0].programDateTime,n=l.fragments[0].programDateTime,p=(n-s)/1e3+r.fragments[0].start;p&&Object(B.isFiniteNumber)(p)&&(R.logger.log("Adjusting PTS using programDateTime delta "+(n-s)+"ms, sliding:"+p.toFixed(3)+" "+l.url+" "),y(p,l))}function E(l,r){var s=l.programDateTime;if(!s)return;var n=(s-r)/1e3;l.start=l.startPTS=n,l.endPTS=n+l.duration}function x(l,r){if(!r.fragments.length||!l.hasProgramDateTime||!r.hasProgramDateTime)return;var s=r.fragments[0].programDateTime,n=r.fragments[0].start,p=s-n*1e3;l.fragments.forEach(function(d){E(d,p)}),l.fragmentHint&&E(l.fragmentHint,p),l.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(he,j,D){"use strict";D.r(j);var B=D("./src/utils/ewma.ts"),R=function(){function L(O,_,A){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=A,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new B.default(O),this.fast_=new B.default(_)}var G=L.prototype;return G.update=function(_,A){var y=this.slow_,S=this.fast_;this.slow_.halfLife!==_&&(this.slow_=new B.default(_,y.getEstimate(),y.getTotalWeight())),this.fast_.halfLife!==A&&(this.fast_=new B.default(A,S.getEstimate(),S.getTotalWeight()))},G.sample=function(_,A){_=Math.max(_,this.minDelayMs_);var y=8*A,S=_/1e3,C=y/S;this.fast_.sample(S,C),this.slow_.sample(S,C)},G.canEstimate=function(){var _=this.fast_;return _&&_.getTotalWeight()>=this.minWeight_},G.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},G.destroy=function(){},L}();j.default=R},"./src/utils/ewma.ts":function(he,j,D){"use strict";D.r(j);var B=function(){function R(G,O,_){O===void 0&&(O=0),_===void 0&&(_=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=G,this.alpha_=G?Math.exp(Math.log(.5)/G):0,this.estimate_=O,this.totalWeight_=_}var L=R.prototype;return L.sample=function(O,_){var A=Math.pow(this.alpha_,O);this.estimate_=_*(1-A)+A*this.estimate_,this.totalWeight_+=O},L.getTotalWeight=function(){return this.totalWeight_},L.getEstimate=function(){if(this.alpha_){var O=1-Math.pow(this.alpha_,this.totalWeight_);if(O)return this.estimate_/O}return this.estimate_},R}();j.default=B},"./src/utils/fetch-loader.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"fetchSupported",function(){return E});var B=D("./src/polyfills/number.ts"),R=D("./src/loader/load-stats.ts"),L=D("./src/demux/chunk-cache.ts");function G(n,p){n.prototype=Object.create(p.prototype),n.prototype.constructor=n,S(n,p)}function O(n){var p=typeof Map=="function"?new Map:void 0;return O=function(c){if(c===null||!y(c))return c;if(typeof c!="function")throw new TypeError("Super expression must either be null or a function");if(typeof p!="undefined"){if(p.has(c))return p.get(c);p.set(c,b)}function b(){return _(c,arguments,C(this).constructor)}return b.prototype=Object.create(c.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),S(b,c)},O(n)}function _(n,p,d){return A()?_=Reflect.construct:_=function(b,f,u){var o=[null];o.push.apply(o,f);var a=Function.bind.apply(b,o),i=new a;return u&&S(i,u.prototype),i},_.apply(null,arguments)}function A(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(n){return!1}}function y(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function S(n,p){return S=Object.setPrototypeOf||function(c,b){return c.__proto__=b,c},S(n,p)}function C(n){return C=Object.setPrototypeOf?Object.getPrototypeOf:function(d){return d.__proto__||Object.getPrototypeOf(d)},C(n)}function T(){return T=Object.assign||function(n){for(var p=1;p<arguments.length;p++){var d=arguments[p];for(var c in d)Object.prototype.hasOwnProperty.call(d,c)&&(n[c]=d[c])}return n},T.apply(this,arguments)}function E(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(n){}return!1}var x=function(){function n(d){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=d.fetchSetup||r,this.controller=new self.AbortController,this.stats=new R.LoadStats}var p=n.prototype;return p.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},p.abortInternal=function(){var c=this.response;(!c||!c.ok)&&(this.stats.aborted=!0,this.controller.abort())},p.abort=function(){var c;this.abortInternal(),(c=this.callbacks)!==null&&c!==void 0&&c.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},p.load=function(c,b,f){var u=this,o=this.stats;if(o.loading.start)throw new Error("Loader can only be used once.");o.loading.start=self.performance.now();var a=l(c,this.controller.signal),i=f.onProgress,v=c.responseType==="arraybuffer",g=v?"byteLength":"length";this.context=c,this.config=b,this.callbacks=f,this.request=this.fetchSetup(c,a),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){u.abortInternal(),f.onTimeout(o,c,u.response)},b.timeout),self.fetch(this.request).then(function(m){if(u.response=u.loader=m,!m.ok){var w=m.status,P=m.statusText;throw new s(P||"fetch, bad network response",w,m)}return o.loading.first=Math.max(self.performance.now(),o.loading.start),o.total=parseInt(m.headers.get("Content-Length")||"0"),i&&Object(B.isFiniteNumber)(b.highWaterMark)?u.loadProgressively(m,o,c,b.highWaterMark,i):v?m.arrayBuffer():m.text()}).then(function(m){var w=u.response;self.clearTimeout(u.requestTimeout),o.loading.end=Math.max(self.performance.now(),o.loading.first),o.loaded=o.total=m[g];var P={url:w.url,data:m};i&&!Object(B.isFiniteNumber)(b.highWaterMark)&&i(o,c,m,w),f.onSuccess(P,o,c,w)}).catch(function(m){if(self.clearTimeout(u.requestTimeout),o.aborted)return;var w=m.code||0;f.onError({code:w,text:m.message},c,m.details)})},p.getCacheAge=function(){var c=null;if(this.response){var b=this.response.headers.get("age");c=b?parseFloat(b):null}return c},p.loadProgressively=function(c,b,f,u,o){u===void 0&&(u=0);var a=new L.default,i=c.body.getReader(),v=function g(){return i.read().then(function(m){if(m.done)return a.dataLength&&o(b,f,a.flush(),c),Promise.resolve(new ArrayBuffer(0));var w=m.value,P=w.length;return b.loaded+=P,P<u||a.dataLength?(a.push(w),a.dataLength>=u&&o(b,f,a.flush(),c)):o(b,f,w,c),g()}).catch(function(){return Promise.reject()})};return v()},n}();function l(n,p){var d={method:"GET",mode:"cors",credentials:"same-origin",signal:p,headers:new self.Headers(T({},n.headers))};return n.rangeEnd&&d.headers.set("Range","bytes="+n.rangeStart+"-"+String(n.rangeEnd-1)),d}function r(n,p){return new self.Request(n.url,p)}var s=function(n){G(p,n);function p(d,c,b){var f;return f=n.call(this,d)||this,f.code=void 0,f.details=void 0,f.code=c,f.details=b,f}return p}(O(Error));j.default=x},"./src/utils/imsc1-ttml-parser.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"IMSC1_CODEC",function(){return y}),D.d(j,"parseIMSC1",function(){return E});var B=D("./src/utils/mp4-tools.ts"),R=D("./src/utils/vttparser.ts"),L=D("./src/utils/vttcue.ts"),G=D("./src/demux/id3.ts"),O=D("./src/utils/timescale-conversion.ts"),_=D("./src/utils/webvtt-parser.ts");function A(){return A=Object.assign||function(u){for(var o=1;o<arguments.length;o++){var a=arguments[o];for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(u[i]=a[i])}return u},A.apply(this,arguments)}var y="stpp.ttml.im1t",S=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,C=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,T={left:"start",center:"center",right:"end",start:"start",end:"end"};function E(u,o,a,i,v){var g=Object(B.findBox)(new Uint8Array(u),["mdat"]);if(g.length===0){v(new Error("Could not parse IMSC1 mdat"));return}var m=g[0],w=Object(G.utf8ArrayToStr)(new Uint8Array(u,m.start,m.end-m.start)),P=Object(O.toTimescaleFromScale)(o,1,a);try{i(x(w,P))}catch(N){v(N)}}function x(u,o){var a=new DOMParser,i=a.parseFromString(u,"text/xml"),v=i.getElementsByTagName("tt")[0];if(!v)throw new Error("Invalid ttml");var g={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},m=Object.keys(g).reduce(function(Y,ne){return Y[ne]=v.getAttribute("ttp:"+ne)||g[ne],Y},{}),w=v.getAttribute("xml:space")!=="preserve",P=r(l(v,"styling","style")),N=r(l(v,"layout","region")),K=l(v,"body","[begin]");return[].map.call(K,function(Y){var ne=s(Y,w);if(!ne||!Y.hasAttribute("begin"))return null;var q=c(Y.getAttribute("begin"),m),se=c(Y.getAttribute("dur"),m),fe=c(Y.getAttribute("end"),m);if(q===null)throw d(Y);if(fe===null){if(se===null)throw d(Y);fe=q+se}var le=new L.default(q-o,fe-o,ne);le.id=Object(_.generateCueId)(le.startTime,le.endTime,le.text);var ve=N[Y.getAttribute("region")],Se=P[Y.getAttribute("style")];le.position=10,le.size=80;var ke=n(ve,Se),Ce=ke.textAlign;if(Ce){var Le=T[Ce];Le&&(le.lineAlign=Le),le.align=Ce}return A(le,ke),le}).filter(function(Y){return Y!==null})}function l(u,o,a){var i=u.getElementsByTagName(o)[0];return i?[].slice.call(i.querySelectorAll(a)):[]}function r(u){return u.reduce(function(o,a){var i=a.getAttribute("xml:id");return i&&(o[i]=a),o},{})}function s(u,o){return[].slice.call(u.childNodes).reduce(function(a,i,v){var g;return i.nodeName==="br"&&v?a+`
`:(g=i.childNodes)!==null&&g!==void 0&&g.length?s(i,o):o?a+i.textContent.trim().replace(/\s+/g," "):a+i.textContent},"")}function n(u,o){var a="http://www.w3.org/ns/ttml#styling",i=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return i.reduce(function(v,g){var m=p(o,a,g)||p(u,a,g);return m&&(v[g]=m),v},{})}function p(u,o,a){return u.hasAttributeNS(o,a)?u.getAttributeNS(o,a):null}function d(u){return new Error("Could not parse ttml timestamp "+u)}function c(u,o){if(!u)return null;var a=Object(R.parseTimeStamp)(u);return a===null&&(S.test(u)?a=b(u,o):C.test(u)&&(a=f(u,o))),a}function b(u,o){var a=S.exec(u),i=(a[4]|0)+(a[5]|0)/o.subFrameRate;return(a[1]|0)*3600+(a[2]|0)*60+(a[3]|0)+i/o.frameRate}function f(u,o){var a=C.exec(u),i=Number(a[1]),v=a[2];switch(v){case"h":return i*3600;case"m":return i*60;case"ms":return i*1e3;case"f":return i/o.frameRate;case"t":return i/o.tickRate}return i}},"./src/utils/logger.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"enableLogs",function(){return _}),D.d(j,"logger",function(){return A});var B=function(){},R={trace:B,debug:B,log:B,warn:B,info:B,error:B},L=R;function G(y){var S=self.console[y];return S?S.bind(self.console,"["+y+"] >"):B}function O(y){for(var S=arguments.length,C=new Array(S>1?S-1:0),T=1;T<S;T++)C[T-1]=arguments[T];C.forEach(function(E){L[E]=y[E]?y[E].bind(y):G(E)})}function _(y){if(self.console&&y===!0||typeof y=="object"){O(y,"debug","log","info","warn","error");try{L.log()}catch(S){L=R}}else L=R}var A=L},"./src/utils/mediakeys-helper.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"KeySystems",function(){return B}),D.d(j,"requestMediaKeySystemAccess",function(){return R});var B;(function(L){L.WIDEVINE="com.widevine.alpha",L.PLAYREADY="com.microsoft.playready"})(B||(B={}));var R=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"getMediaSource",function(){return B});function B(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"bin2str",function(){return O}),D.d(j,"readUint16",function(){return _}),D.d(j,"readUint32",function(){return A}),D.d(j,"writeUint32",function(){return y}),D.d(j,"findBox",function(){return S}),D.d(j,"parseSegmentIndex",function(){return C}),D.d(j,"parseInitSegment",function(){return T}),D.d(j,"getStartDTS",function(){return E}),D.d(j,"getDuration",function(){return x}),D.d(j,"computeRawDurationFromSamples",function(){return l}),D.d(j,"offsetStartDTS",function(){return r}),D.d(j,"segmentValidRange",function(){return s}),D.d(j,"appendUint8Array",function(){return n});var B=D("./src/utils/typed-array.ts"),R=D("./src/loader/fragment.ts"),L=Math.pow(2,32)-1,G=[].push;function O(p){return String.fromCharCode.apply(null,p)}function _(p,d){"data"in p&&(d+=p.start,p=p.data);var c=p[d]<<8|p[d+1];return c<0?65536+c:c}function A(p,d){"data"in p&&(d+=p.start,p=p.data);var c=p[d]<<24|p[d+1]<<16|p[d+2]<<8|p[d+3];return c<0?4294967296+c:c}function y(p,d,c){"data"in p&&(d+=p.start,p=p.data),p[d]=c>>24,p[d+1]=c>>16&255,p[d+2]=c>>8&255,p[d+3]=c&255}function S(p,d){var c=[];if(!d.length)return c;var b,f,u;"data"in p?(b=p.data,f=p.start,u=p.end):(b=p,f=0,u=b.byteLength);for(var o=f;o<u;){var a=A(b,o),i=O(b.subarray(o+4,o+8)),v=a>1?o+a:u;if(i===d[0])if(d.length===1)c.push({data:b,start:o+8,end:v});else{var g=S({data:b,start:o+8,end:v},d.slice(1));g.length&&G.apply(c,g)}o=v}return c}function C(p){var d=S(p,["moov"]),c=d[0],b=c?c.end:null,f=S(p,["sidx"]);if(!f||!f[0])return null;var u=[],o=f[0],a=o.data[0],i=a===0?8:16,v=A(o,i);i+=4;var g=0,m=0;a===0?i+=8:i+=16,i+=2;var w=o.end+m,P=_(o,i);i+=2;for(var N=0;N<P;N++){var K=i,Y=A(o,K);K+=4;var ne=Y&2147483647,q=(Y&2147483648)>>>31;if(q===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var se=A(o,K);K+=4,u.push({referenceSize:ne,subsegmentDuration:se,info:{duration:se/v,start:w,end:w+ne-1}}),w+=ne,K+=4,i=K}return{earliestPresentationTime:g,timescale:v,version:a,referencesCount:P,references:u,moovEndOffset:b}}function T(p){for(var d=[],c=S(p,["moov","trak"]),b=0;b<c.length;b++){var f=c[b],u=S(f,["tkhd"])[0];if(u){var o=u.data[u.start],a=o===0?12:20,i=A(u,a),v=S(f,["mdia","mdhd"])[0];if(v){o=v.data[v.start],a=o===0?12:20;var g=A(v,a),m=S(f,["mdia","hdlr"])[0];if(m){var w=O(m.data.subarray(m.start+8,m.start+12)),P={soun:R.ElementaryStreamTypes.AUDIO,vide:R.ElementaryStreamTypes.VIDEO}[w];if(P){var N=S(f,["mdia","minf","stbl","stsd"])[0],K=void 0;N&&(K=O(N.data.subarray(N.start+12,N.start+16))),d[i]={timescale:g,type:P},d[P]={timescale:g,id:i,codec:K}}}}}}var Y=S(p,["moov","mvex","trex"]);return Y.forEach(function(ne){var q=A(ne,4),se=d[q];se&&(se.default={duration:A(ne,12),flags:A(ne,20)})}),d}function E(p,d){return S(d,["moof","traf"]).reduce(function(c,b){var f=S(b,["tfdt"])[0],u=f.data[f.start],o=S(b,["tfhd"]).reduce(function(a,i){var v=A(i,4),g=p[v];if(g){var m=A(f,4);u===1&&(m*=Math.pow(2,32),m+=A(f,8));var w=g.timescale||9e4,P=m/w;if(isFinite(P)&&(a===null||P<a))return P}return a},null);return o!==null&&isFinite(o)&&(c===null||o<c)?o:c},null)||0}function x(p,d){for(var c=0,b=0,f=0,u=S(p,["moof","traf"]),o=0;o<u.length;o++){var a=u[o],i=S(a,["tfhd"])[0],v=A(i,4),g=d[v];if(!g)continue;var m=g.default,w=A(i,0)|(m==null?void 0:m.flags),P=m==null?void 0:m.duration;w&8&&(w&2?P=A(i,12):P=A(i,8));for(var N=g.timescale||9e4,K=S(a,["trun"]),Y=0;Y<K.length;Y++){if(P){var ne=A(K[Y],4);c=P*ne}else c=l(K[Y]);g.type===R.ElementaryStreamTypes.VIDEO?b+=c/N:g.type===R.ElementaryStreamTypes.AUDIO&&(f+=c/N)}}if(b===0&&f===0){var q=C(p);if(q!=null&&q.references)return q.references.reduce(function(se,fe){return se+fe.info.duration||0},0)}return b||f}function l(p){var d=A(p,0),c=8;d&1&&(c+=4),d&4&&(c+=4);for(var b=0,f=A(p,4),u=0;u<f;u++){if(d&256){var o=A(p,c);b+=o,c+=4}d&512&&(c+=4),d&1024&&(c+=4),d&2048&&(c+=4)}return b}function r(p,d,c){S(d,["moof","traf"]).forEach(function(b){S(b,["tfhd"]).forEach(function(f){var u=A(f,4),o=p[u];if(!o)return;var a=o.timescale||9e4;S(b,["tfdt"]).forEach(function(i){var v=i.data[i.start],g=A(i,4);if(v===0)y(i,4,g-c*a);else{g*=Math.pow(2,32),g+=A(i,8),g-=c*a,g=Math.max(g,0);var m=Math.floor(g/(L+1)),w=Math.floor(g%(L+1));y(i,4,m),y(i,8,w)}})})})}function s(p){var d={valid:null,remainder:null},c=S(p,["moof"]);if(c){if(c.length<2)return d.remainder=p,d}else return d;var b=c[c.length-1];return d.valid=Object(B.sliceUint8)(p,0,b.start-8),d.remainder=Object(B.sliceUint8)(p,b.start-8),d}function n(p,d){var c=new Uint8Array(p.length+d.length);return c.set(p),c.set(d,p.length),c}},"./src/utils/output-filter.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"default",function(){return B});var B=function(){function R(G,O){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=G,this.trackName=O}var L=R.prototype;return L.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},L.newCue=function(O,_,A){(this.startTime===null||this.startTime>O)&&(this.startTime=O),this.endTime=_,this.screen=A,this.timelineController.createCaptionsTrack(this.trackName)},L.reset=function(){this.cueRanges=[]},R}()},"./src/utils/texttrack-utils.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"sendAddTrackEvent",function(){return R}),D.d(j,"addCueToTrack",function(){return L}),D.d(j,"clearCurrentCues",function(){return G}),D.d(j,"removeCuesInRange",function(){return O}),D.d(j,"getCuesInRange",function(){return A});var B=D("./src/utils/logger.ts");function R(y,S){var C;try{C=new Event("addtrack")}catch(T){C=document.createEvent("Event"),C.initEvent("addtrack",!1,!1)}C.track=y,S.dispatchEvent(C)}function L(y,S){var C=y.mode;if(C==="disabled"&&(y.mode="hidden"),y.cues&&!y.cues.getCueById(S.id))try{if(y.addCue(S),!y.cues.getCueById(S.id))throw new Error("addCue is failed for: "+S)}catch(E){B.logger.debug("[texttrack-utils]: "+E);var T=new self.TextTrackCue(S.startTime,S.endTime,S.text);T.id=S.id,y.addCue(T)}C==="disabled"&&(y.mode=C)}function G(y){var S=y.mode;if(S==="disabled"&&(y.mode="hidden"),y.cues)for(var C=y.cues.length;C--;)y.removeCue(y.cues[C]);S==="disabled"&&(y.mode=S)}function O(y,S,C){var T=y.mode;if(T==="disabled"&&(y.mode="hidden"),y.cues&&y.cues.length>0)for(var E=A(y.cues,S,C),x=0;x<E.length;x++)y.removeCue(E[x]);T==="disabled"&&(y.mode=T)}function _(y,S){if(S<y[0].startTime)return 0;var C=y.length-1;if(S>y[C].endTime)return-1;for(var T=0,E=C;T<=E;){var x=Math.floor((E+T)/2);if(S<y[x].startTime)E=x-1;else if(S>y[x].startTime&&T<C)T=x+1;else return x}return y[T].startTime-S<S-y[E].startTime?T:E}function A(y,S,C){var T=[],E=_(y,S);if(E>-1)for(var x=E,l=y.length;x<l;x++){var r=y[x];if(r.startTime>=S&&r.endTime<=C)T.push(r);else if(r.startTime>C)return T}return T}},"./src/utils/time-ranges.ts":function(he,j,D){"use strict";D.r(j);var B={toString:function(L){for(var G="",O=L.length,_=0;_<O;_++)G+="["+L.start(_).toFixed(3)+","+L.end(_).toFixed(3)+"]";return G}};j.default=B},"./src/utils/timescale-conversion.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"toTimescaleFromBase",function(){return R}),D.d(j,"toTimescaleFromScale",function(){return L}),D.d(j,"toMsFromMpegTsClock",function(){return G}),D.d(j,"toMpegTsClockFromTimescale",function(){return O});var B=9e4;function R(_,A,y,S){y===void 0&&(y=1),S===void 0&&(S=!1);var C=_*A*y;return S?Math.round(C):C}function L(_,A,y,S){return y===void 0&&(y=1),S===void 0&&(S=!1),R(_,A,1/y,S)}function G(_,A){return A===void 0&&(A=!1),R(_,1e3,1/B,A)}function O(_,A){return A===void 0&&(A=1),R(_,B,1/A)}},"./src/utils/typed-array.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"sliceUint8",function(){return B});function B(R,L,G){return Uint8Array.prototype.slice?R.slice(L,G):new Uint8Array(Array.prototype.slice.call(R,L,G))}},"./src/utils/vttcue.ts":function(he,j,D){"use strict";D.r(j),j.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var B=["","lr","rl"],R=["start","middle","end","left","right"];function L(y,S){if(typeof S!="string")return!1;if(!Array.isArray(y))return!1;var C=S.toLowerCase();return~y.indexOf(C)?C:!1}function G(y){return L(B,y)}function O(y){return L(R,y)}function _(y){for(var S=arguments.length,C=new Array(S>1?S-1:0),T=1;T<S;T++)C[T-1]=arguments[T];for(var E=1;E<arguments.length;E++){var x=arguments[E];for(var l in x)y[l]=x[l]}return y}function A(y,S,C){var T=this,E={enumerable:!0};T.hasBeenReset=!1;var x="",l=!1,r=y,s=S,n=C,p=null,d="",c=!0,b="auto",f="start",u=50,o="middle",a=50,i="middle";Object.defineProperty(T,"id",_({},E,{get:function(){return x},set:function(g){x=""+g}})),Object.defineProperty(T,"pauseOnExit",_({},E,{get:function(){return l},set:function(g){l=!!g}})),Object.defineProperty(T,"startTime",_({},E,{get:function(){return r},set:function(g){if(typeof g!="number")throw new TypeError("Start time must be set to a number.");r=g,this.hasBeenReset=!0}})),Object.defineProperty(T,"endTime",_({},E,{get:function(){return s},set:function(g){if(typeof g!="number")throw new TypeError("End time must be set to a number.");s=g,this.hasBeenReset=!0}})),Object.defineProperty(T,"text",_({},E,{get:function(){return n},set:function(g){n=""+g,this.hasBeenReset=!0}})),Object.defineProperty(T,"region",_({},E,{get:function(){return p},set:function(g){p=g,this.hasBeenReset=!0}})),Object.defineProperty(T,"vertical",_({},E,{get:function(){return d},set:function(g){var m=G(g);if(m===!1)throw new SyntaxError("An invalid or illegal string was specified.");d=m,this.hasBeenReset=!0}})),Object.defineProperty(T,"snapToLines",_({},E,{get:function(){return c},set:function(g){c=!!g,this.hasBeenReset=!0}})),Object.defineProperty(T,"line",_({},E,{get:function(){return b},set:function(g){if(typeof g!="number"&&g!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");b=g,this.hasBeenReset=!0}})),Object.defineProperty(T,"lineAlign",_({},E,{get:function(){return f},set:function(g){var m=O(g);if(!m)throw new SyntaxError("An invalid or illegal string was specified.");f=m,this.hasBeenReset=!0}})),Object.defineProperty(T,"position",_({},E,{get:function(){return u},set:function(g){if(g<0||g>100)throw new Error("Position must be between 0 and 100.");u=g,this.hasBeenReset=!0}})),Object.defineProperty(T,"positionAlign",_({},E,{get:function(){return o},set:function(g){var m=O(g);if(!m)throw new SyntaxError("An invalid or illegal string was specified.");o=m,this.hasBeenReset=!0}})),Object.defineProperty(T,"size",_({},E,{get:function(){return a},set:function(g){if(g<0||g>100)throw new Error("Size must be between 0 and 100.");a=g,this.hasBeenReset=!0}})),Object.defineProperty(T,"align",_({},E,{get:function(){return i},set:function(g){var m=O(g);if(!m)throw new SyntaxError("An invalid or illegal string was specified.");i=m,this.hasBeenReset=!0}})),T.displayState=void 0}return A.prototype.getCueAsHTML=function(){var y=self.WebVTT;return y.convertCueToDOMTree(self,this.text)},A}()},"./src/utils/vttparser.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"parseTimeStamp",function(){return L}),D.d(j,"fixLineBreaks",function(){return S}),D.d(j,"VTTParser",function(){return C});var B=D("./src/utils/vttcue.ts"),R=function(){function T(){}var E=T.prototype;return E.decode=function(l,r){if(!l)return"";if(typeof l!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(l))},T}();function L(T){function E(l,r,s,n){return(l|0)*3600+(r|0)*60+(s|0)+parseFloat(n||0)}var x=T.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return x?parseFloat(x[2])>59?E(x[2],x[3],0,x[4]):E(x[1],x[2],x[3],x[4]):null}var G=function(){function T(){this.values=Object.create(null)}var E=T.prototype;return E.set=function(l,r){!this.get(l)&&r!==""&&(this.values[l]=r)},E.get=function(l,r,s){return s?this.has(l)?this.values[l]:r[s]:this.has(l)?this.values[l]:r},E.has=function(l){return l in this.values},E.alt=function(l,r,s){for(var n=0;n<s.length;++n)if(r===s[n]){this.set(l,r);break}},E.integer=function(l,r){/^-?\d+$/.test(r)&&this.set(l,parseInt(r,10))},E.percent=function(l,r){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(r)){var s=parseFloat(r);if(s>=0&&s<=100)return this.set(l,s),!0}return!1},T}();function O(T,E,x,l){var r=l?T.split(l):[T];for(var s in r){if(typeof r[s]!="string")continue;var n=r[s].split(x);if(n.length!==2)continue;var p=n[0],d=n[1];E(p,d)}}var _=new B.default(0,0,""),A=_.align==="middle"?"middle":"center";function y(T,E,x){var l=T;function r(){var p=L(T);if(p===null)throw new Error("Malformed timestamp: "+l);return T=T.replace(/^[^\sa-zA-Z-]+/,""),p}function s(p,d){var c=new G;O(p,function(u,o){var a;switch(u){case"region":for(var i=x.length-1;i>=0;i--)if(x[i].id===o){c.set(u,x[i].region);break}break;case"vertical":c.alt(u,o,["rl","lr"]);break;case"line":a=o.split(","),c.integer(u,a[0]),c.percent(u,a[0])&&c.set("snapToLines",!1),c.alt(u,a[0],["auto"]),a.length===2&&c.alt("lineAlign",a[1],["start",A,"end"]);break;case"position":a=o.split(","),c.percent(u,a[0]),a.length===2&&c.alt("positionAlign",a[1],["start",A,"end","line-left","line-right","auto"]);break;case"size":c.percent(u,o);break;case"align":c.alt(u,o,["start",A,"end","left","right"]);break}},/:/,/\s/),d.region=c.get("region",null),d.vertical=c.get("vertical","");var b=c.get("line","auto");b==="auto"&&_.line===-1&&(b=-1),d.line=b,d.lineAlign=c.get("lineAlign","start"),d.snapToLines=c.get("snapToLines",!0),d.size=c.get("size",100),d.align=c.get("align",A);var f=c.get("position","auto");f==="auto"&&_.position===50&&(f=d.align==="start"||d.align==="left"?0:d.align==="end"||d.align==="right"?100:50),d.position=f}function n(){T=T.replace(/^\s+/,"")}if(n(),E.startTime=r(),n(),T.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+l);T=T.substr(3),n(),E.endTime=r(),n(),s(T,E)}function S(T){return T.replace(/<br(?: \/)?>/gi,`
`)}var C=function(){function T(){this.state="INITIAL",this.buffer="",this.decoder=new R,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var E=T.prototype;return E.parse=function(l){var r=this;l&&(r.buffer+=r.decoder.decode(l,{stream:!0}));function s(){var f=r.buffer,u=0;for(f=S(f);u<f.length&&f[u]!=="\r"&&f[u]!==`
`;)++u;var o=f.substr(0,u);return f[u]==="\r"&&++u,f[u]===`
`&&++u,r.buffer=f.substr(u),o}function n(f){O(f,function(u,o){},/:/)}try{var p="";if(r.state==="INITIAL"){if(!/\r\n|\n/.test(r.buffer))return this;p=s();var d=p.match(/^()?WEBVTT([ \t].*)?$/);if(!d||!d[0])throw new Error("Malformed WebVTT signature.");r.state="HEADER"}for(var c=!1;r.buffer;){if(!/\r\n|\n/.test(r.buffer))return this;c?c=!1:p=s();switch(r.state){case"HEADER":/:/.test(p)?n(p):p||(r.state="ID");continue;case"NOTE":p||(r.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(p)){r.state="NOTE";break}if(!p)continue;if(r.cue=new B.default(0,0,""),r.state="CUE",p.indexOf("-->")===-1){r.cue.id=p;continue}case"CUE":if(!r.cue){r.state="BADCUE";continue}try{y(p,r.cue,r.regionList)}catch(f){r.cue=null,r.state="BADCUE";continue}r.state="CUETEXT";continue;case"CUETEXT":{var b=p.indexOf("-->")!==-1;if(!p||b&&(c=!0)){r.oncue&&r.cue&&r.oncue(r.cue),r.cue=null,r.state="ID";continue}if(r.cue===null)continue;r.cue.text&&(r.cue.text+=`
`),r.cue.text+=p}continue;case"BADCUE":p||(r.state="ID")}}}catch(f){r.state==="CUETEXT"&&r.cue&&r.oncue&&r.oncue(r.cue),r.cue=null,r.state=r.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},E.flush=function(){var l=this;try{if((l.cue||l.state==="HEADER")&&(l.buffer+=`
`,l.parse()),l.state==="INITIAL"||l.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(r){l.onparsingerror&&l.onparsingerror(r)}return l.onflush&&l.onflush(),this},T}()},"./src/utils/webvtt-parser.ts":function(he,j,D){"use strict";D.r(j),D.d(j,"generateCueId",function(){return C}),D.d(j,"parseWebVTT",function(){return E});var B=D("./src/polyfills/number.ts"),R=D("./src/utils/vttparser.ts"),L=D("./src/demux/id3.ts"),G=D("./src/utils/timescale-conversion.ts"),O=D("./src/remux/mp4-remuxer.ts"),_=/\r\n|\n\r|\n|\r/g,A=function(l,r,s){return s===void 0&&(s=0),l.substr(s,r.length)===r},y=function(l){var r=parseInt(l.substr(-3)),s=parseInt(l.substr(-6,2)),n=parseInt(l.substr(-9,2)),p=l.length>9?parseInt(l.substr(0,l.indexOf(":"))):0;if(!Object(B.isFiniteNumber)(r)||!Object(B.isFiniteNumber)(s)||!Object(B.isFiniteNumber)(n)||!Object(B.isFiniteNumber)(p))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+l);return r+=1e3*s,r+=60*1e3*n,r+=60*60*1e3*p,r},S=function(l){for(var r=5381,s=l.length;s;)r=r*33^l.charCodeAt(--s);return(r>>>0).toString()};function C(x,l,r){return S(x.toString())+S(l.toString())+S(r)}var T=function(l,r,s){var n=l[r],p=l[n.prevCC];if(!p||!p.new&&n.new){l.ccOffset=l.presentationOffset=n.start,n.new=!1;return}for(;(d=p)!==null&&d!==void 0&&d.new;){var d;l.ccOffset+=n.start-p.start,n.new=!1,n=p,p=l[n.prevCC]}l.presentationOffset=s};function E(x,l,r,s,n,p,d,c){var b=new R.VTTParser,f=Object(L.utf8ArrayToStr)(new Uint8Array(x)).trim().replace(_,`
`).split(`
`),u=[],o=Object(G.toMpegTsClockFromTimescale)(l,r),a="00:00.000",i=0,v=0,g,m=!0,w=!1;b.oncue=function(P){var N=s[n],K=s.ccOffset,Y=(i-o)/9e4;if(N!=null&&N.new&&(v!==void 0?K=s.ccOffset=N.start:T(s,n,Y)),Y&&(K=Y-s.presentationOffset),w){var ne=P.endTime-P.startTime,q=Object(O.normalizePts)((P.startTime+K-v)*9e4,p*9e4)/9e4;P.startTime=q,P.endTime=q+ne}var se=P.text.trim();P.text=decodeURIComponent(encodeURIComponent(se)),P.id||(P.id=C(P.startTime,P.endTime,se)),P.endTime>0&&u.push(P)},b.onparsingerror=function(P){g=P},b.onflush=function(){if(g){c(g);return}d(u)},f.forEach(function(P){if(m)if(A(P,"X-TIMESTAMP-MAP=")){m=!1,w=!0,P.substr(16).split(",").forEach(function(N){A(N,"LOCAL:")?a=N.substr(6):A(N,"MPEGTS:")&&(i=parseInt(N.substr(7)))});try{v=y(a)/1e3}catch(N){w=!1,g=N}return}else P===""&&(m=!1);b.parse(P+`
`)}),b.flush()}},"./src/utils/xhr-loader.ts":function(he,j,D){"use strict";D.r(j);var B=D("./src/utils/logger.ts"),R=D("./src/loader/load-stats.ts"),L=/^age:\s*[\d.]+\s*$/m,G=function(){function O(A){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=A?A.xhrSetup:null,this.stats=new R.LoadStats,this.retryDelay=0}var _=O.prototype;return _.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},_.abortInternal=function(){var y=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),y&&(y.onreadystatechange=null,y.onprogress=null,y.readyState!==4&&(this.stats.aborted=!0,y.abort()))},_.abort=function(){var y;this.abortInternal(),(y=this.callbacks)!==null&&y!==void 0&&y.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},_.load=function(y,S,C){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=y,this.config=S,this.callbacks=C,this.retryDelay=S.retryDelay,this.loadInternal()},_.loadInternal=function(){var y=this.config,S=this.context;if(!y)return;var C=this.loader=new self.XMLHttpRequest,T=this.stats;T.loading.first=0,T.loaded=0;var E=this.xhrSetup;try{if(E)try{E(C,S.url)}catch(r){C.open("GET",S.url,!0),E(C,S.url)}C.readyState||C.open("GET",S.url,!0);var x=this.context.headers;if(x)for(var l in x)C.setRequestHeader(l,x[l])}catch(r){this.callbacks.onError({code:C.status,text:r.message},S,C);return}S.rangeEnd&&C.setRequestHeader("Range","bytes="+S.rangeStart+"-"+(S.rangeEnd-1)),C.onreadystatechange=this.readystatechange.bind(this),C.onprogress=this.loadprogress.bind(this),C.responseType=S.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),y.timeout),C.send()},_.readystatechange=function(){var y=this.context,S=this.loader,C=this.stats;if(!y||!S)return;var T=S.readyState,E=this.config;if(C.aborted)return;if(T>=2)if(self.clearTimeout(this.requestTimeout),C.loading.first===0&&(C.loading.first=Math.max(self.performance.now(),C.loading.start)),T===4){S.onreadystatechange=null,S.onprogress=null;var x=S.status;if(x>=200&&x<300){C.loading.end=Math.max(self.performance.now(),C.loading.first);var l,r;if(y.responseType==="arraybuffer"?(l=S.response,r=l.byteLength):(l=S.responseText,r=l.length),C.loaded=C.total=r,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(C,y,l,S),!this.callbacks)return;var n={url:S.responseURL,data:l};this.callbacks.onSuccess(n,C,y,S)}else C.retry>=E.maxRetry||x>=400&&x<499?(B.logger.error(x+" while loading "+y.url),this.callbacks.onError({code:x,text:S.statusText},y,S)):(B.logger.warn(x+" while loading "+y.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,E.maxRetryDelay),C.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),E.timeout)},_.loadtimeout=function(){B.logger.warn("timeout while loading "+this.context.url);var y=this.callbacks;y&&(this.abortInternal(),y.onTimeout(this.stats,this.context,this.loader))},_.loadprogress=function(y){var S=this.stats;S.loaded=y.loaded,y.lengthComputable&&(S.total=y.total)},_.getCacheAge=function(){var y=null;if(this.loader&&L.test(this.loader.getAllResponseHeaders())){var S=this.loader.getResponseHeader("age");y=S?parseFloat(S):null}return y},O}();j.default=G}}).default})}}]);