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__Messages__Private.88b2d1...

334 lines
751 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[166,5,7,8],{"+ua5":function(Ze,le,H){},"/cxE":function(Ze,le,H){"use strict";H.d(le,"e",function(){return S}),H.d(le,"f",function(){return k}),H.d(le,"g",function(){return D}),H.d(le,"d",function(){return B}),H.d(le,"a",function(){return _}),H.d(le,"b",function(){return A}),H.d(le,"c",function(){return C});var se=function(){function s(){this.listeners=[],this.unexpectedErrorHandler=function(m){setTimeout(function(){throw m.stack?new Error(m.message+`
`+m.stack):m},0)}}return s.prototype.emit=function(m){this.listeners.forEach(function(b){b(m)})},s.prototype.onUnexpectedError=function(m){this.unexpectedErrorHandler(m),this.emit(m)},s.prototype.onUnexpectedExternalError=function(m){this.unexpectedErrorHandler(m)},s}(),U=new se;function S(s){B(s)||U.onUnexpectedError(s);return}function k(s){B(s)||U.onUnexpectedExternalError(s);return}function D(s){if(s instanceof Error){var m=s.name,b=s.message,c=s.stacktrace||s.stack;return{$isError:!0,name:m,message:b,stack:c}}return s}var L="Canceled";function B(s){return s instanceof Error&&s.name===L&&s.message===L}function _(){var s=new Error(L);return s.name=s.message,s}function A(s){return s?new Error("Illegal argument: "+s):new Error("Illegal argument")}function C(s){return s?new Error("Illegal state: "+s):new Error("Illegal state")}},"24hK":function(Ze,le,H){"use strict";H.d(le,"a",function(){return S});var se=H("JYp7"),U=function(){function k(D){this.element=D,this.next=k.Undefined,this.prev=k.Undefined}return k.Undefined=new k(void 0),k}(),S=function(){function k(){this._first=U.Undefined,this._last=U.Undefined,this._size=0}return Object.defineProperty(k.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),k.prototype.isEmpty=function(){return this._first===U.Undefined},k.prototype.clear=function(){this._first=U.Undefined,this._last=U.Undefined,this._size=0},k.prototype.unshift=function(D){return this._insert(D,!1)},k.prototype.push=function(D){return this._insert(D,!0)},k.prototype._insert=function(D,L){var B=this,_=new U(D);if(this._first===U.Undefined)this._first=_,this._last=_;else if(L){var A=this._last;this._last=_,_.prev=A,A.next=_}else{var C=this._first;this._first=_,_.next=C,C.prev=_}this._size+=1;var s=!1;return function(){s||(s=!0,B._remove(_))}},k.prototype.shift=function(){if(this._first===U.Undefined)return;var D=this._first.element;return this._remove(this._first),D},k.prototype.pop=function(){if(this._last===U.Undefined)return;var D=this._last.element;return this._remove(this._last),D},k.prototype._remove=function(D){if(D.prev!==U.Undefined&&D.next!==U.Undefined){var L=D.prev;L.next=D.next,D.next.prev=L}else D.prev===U.Undefined&&D.next===U.Undefined?(this._first=U.Undefined,this._last=U.Undefined):D.next===U.Undefined?(this._last=this._last.prev,this._last.next=U.Undefined):D.prev===U.Undefined&&(this._first=this._first.next,this._first.prev=U.Undefined);this._size-=1},k.prototype.iterator=function(){var D,L=this._first;return{next:function(){return L===U.Undefined?se.c:(D?D.value=L.element:D={done:!1,value:L.element},L=L.next,D)}}},k.prototype.toArray=function(){for(var D=[],L=this._first;L!==U.Undefined;L=L.next)D.push(L.element);return D},k}()},"30zm":function(Ze,le,H){"use strict";var se=H("jCWc"),U=H("kPKH"),S=H("k1fw"),k=H("tJVT"),D=H("PpiC"),L=H("B9cy"),B=H("Ol7k"),_=H("lUTK"),A=H("BvKs"),C=H("q1tI"),s=H.n(C),m=H("Ty5D"),b=H("55Ip"),c=H("9kvl"),v=H("m3rI"),x=H("kzJb"),n=H.n(x),e=A.a.SubMenu,t=B.a.Sider,i=B.a.Content,p=function(h){var T=h.messages,g=h.globalSetting,f=h.loading,l=h.user,r=h.dispatch,a=Object(D.a)(h,["messages","globalSetting","loading","user","dispatch"]),y=Object(m.i)(),E=l.userInfo,w=Object(m.h)(),R=T.tidingsList,M=T.privateMessage,N=T.unreadInfo,j=Object(C.useState)({per_page:10,page:1}),K=Object(k.a)(j,2),V=K[0],z=K[1];Object(C.useEffect)(function(){Q()},[y.userId]);var Q=function(){r({type:"messages/unreadMessageInfo",payload:Object(S.a)(Object(S.a)({},V),y)})};return s.a.createElement(U.a,{flex:"264px"},s.a.createElement("aside",{className:n.a.userInfo},s.a.createElement("img",{className:"mt40",src:v.a.IMG_SERVER+"/images/"+(E==null?void 0:E.image_url)}),s.a.createElement("p",{className:"font24 mt10"},E==null?void 0:E.username),s.a.createElement("p",{className:"mt20"},E==null?void 0:E.user_identity)),s.a.createElement("ul",{className:n.a.navInfo},s.a.createElement(b.a,{to:"/messages/".concat(E==null?void 0:E.login,"/user_tidings")},s.a.createElement("li",{className:w.pathname.indexOf("user_tidings")>-1&&n.a.actived},"\u6D88\u606F",!!(N!=null&&N.unread_tiding_count)&&s.a.createElement("span",{className:n.a.newTip},N==null?void 0:N.unread_tiding_count))),s.a.createElement(b.a,{to:"/messages/".concat(E==null?void 0:E.login,"/private_messages")},s.a.createElement("li",{className:(w.pathname.indexOf("private_messages")>-1||w.pathname.indexOf("message_detail")>-1)&&n.a.actived},"\u79C1\u4FE1",!!(N!=null&&N.unread_message_count)&&s.a.createElement("span",{className:n.a.newTip},N==null?void 0:N.unread_message_count)))))};le.a=Object(c.a)(function(u){var h=u.messages,T=u.loading,g=u.user,f=u.globalSetting;return{messages:h,globalSetting:f,user:g,loading:T.effects}})(p)},"55Ip":function(Ze,le,H){"use strict";H.d(le,"a",function(){return t}),H.d(le,"b",function(){return g});var se=H("Ty5D"),U=H("dI71"),S=H("q1tI"),k=H.n(S),D=H("YS25"),L=H("17x9"),B=H.n(L),_=H("wx14"),A=H("zLVn"),C=H("9R94"),s=function(l){Object(U.a)(r,l);function r(){for(var y,E=arguments.length,w=new Array(E),R=0;R<E;R++)w[R]=arguments[R];return y=l.call.apply(l,[this].concat(w))||this,y.history=Object(D.a)(y.props),y}var a=r.prototype;return a.render=function(){return k.a.createElement(se.c,{history:this.history,children:this.props.children})},r}(k.a.Component),m=function(l){Object(U.a)(r,l);function r(){for(var y,E=arguments.length,w=new Array(E),R=0;R<E;R++)w[R]=arguments[R];return y=l.call.apply(l,[this].concat(w))||this,y.history=Object(D.b)(y.props),y}var a=r.prototype;return a.render=function(){return k.a.createElement(se.c,{history:this.history,children:this.props.children})},r}(k.a.Component),b=function(r,a){return typeof r=="function"?r(a):r},c=function(r,a){return typeof r=="string"?Object(D.c)(r,null,null,a):r},v=function(r){return r},x=k.a.forwardRef;typeof x=="undefined"&&(x=v);function n(l){return!!(l.metaKey||l.altKey||l.ctrlKey||l.shiftKey)}var e=x(function(l,r){var a=l.innerRef,y=l.navigate,E=l.onClick,w=Object(A.a)(l,["innerRef","navigate","onClick"]),R=w.target,M=Object(_.a)({},w,{onClick:function(j){try{E&&E(j)}catch(K){throw j.preventDefault(),K}!j.defaultPrevented&&j.button===0&&(!R||R==="_self")&&!n(j)&&(j.preventDefault(),y())}});return v!==x?M.ref=r||a:M.ref=a,k.a.createElement("a",M)}),t=x(function(l,r){var a=l.component,y=a===void 0?e:a,E=l.replace,w=l.to,R=l.innerRef,M=Object(A.a)(l,["component","replace","to","innerRef"]);return k.a.createElement(se.e.Consumer,null,function(N){N||Object(C.a)(!1);var j=N.history,K=c(b(w,N.location),N.location),V=K?j.createHref(K):"",z=Object(_.a)({},M,{href:V,navigate:function(){var ae=b(w,N.location),oe=E?j.replace:j.push;oe(ae)}});return v!==x?z.ref=r||R:z.innerRef=R,k.a.createElement(y,z)})});if(!1)var i,p;var u=function(r){return r},h=k.a.forwardRef;typeof h=="undefined"&&(h=u);function T(){for(var l=arguments.length,r=new Array(l),a=0;a<l;a++)r[a]=arguments[a];return r.filter(function(y){return y}).join(" ")}var g=h(function(l,r){var a=l["aria-current"],y=a===void 0?"page":a,E=l.activeClassName,w=E===void 0?"active":E,R=l.activeStyle,M=l.className,N=l.exact,j=l.isActive,K=l.location,V=l.sensitive,z=l.strict,Q=l.style,ae=l.to,oe=l.innerRef,Ce=Object(A.a)(l,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return k.a.createElement(se.e.Consumer,null,function(he){he||Object(C.a)(!1);var fe=K||he.location,pe=c(b(ae,fe),fe),me=pe.pathname,ie=me&&me.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),J=ie?Object(se.f)(fe.pathname,{path:ie,exact:N,sensitive:V,strict:z}):null,ye=!!(j?j(J,fe):J),Pe=ye?T(M,w):M,Le=ye?Object(_.a)({},Q,{},R):Q,Re=Object(_.a)({"aria-current":ye&&y||null,className:Pe,style:Le,to:pe},Ce);return u!==h?Re.ref=r||oe:Re.innerRef=oe,k.a.createElement(t,Re)})});if(!1)var f},"6+eU":function(Ze,le,H){"use strict";H.d(le,"a",function(){return h});var se=H("wx14"),U=H("rePB"),S=H("VTBJ"),k=H("1OyB"),D=H("vuIU"),L=H("Ji7U"),B=H("LK+K"),_=H("q1tI"),A=H.n(_),C=H("TSYQ"),s=H.n(C),m=function(g){var f,l="".concat(g.rootPrefixCls,"-item"),r=s()(l,"".concat(l,"-").concat(g.page),(f={},Object(U.a)(f,"".concat(l,"-active"),g.active),Object(U.a)(f,g.className,!!g.className),Object(U.a)(f,"".concat(l,"-disabled"),!g.page),f)),a=function(){g.onClick(g.page)},y=function(w){g.onKeyPress(w,g.onClick,g.page)};return A.a.createElement("li",{title:g.showTitle?g.page:null,className:r,onClick:a,onKeyPress:y,tabIndex:"0"},g.itemRender(g.page,"page",A.a.createElement("a",{rel:"nofollow"},g.page)))},b=m,c={ZERO:48,NINE:57,NUMPAD_ZERO:96,NUMPAD_NINE:105,BACKSPACE:8,DELETE:46,ENTER:13,ARROW_UP:38,ARROW_DOWN:40},v=function(T){Object(L.a)(f,T);var g=Object(B.a)(f);function f(){var l;Object(k.a)(this,f);for(var r=arguments.length,a=new Array(r),y=0;y<r;y++)a[y]=arguments[y];return l=g.call.apply(g,[this].concat(a)),l.state={goInputText:""},l.buildOptionText=function(E){return"".concat(E," ").concat(l.props.locale.items_per_page)},l.changeSize=function(E){l.props.changeSize(Number(E))},l.handleChange=function(E){l.setState({goInputText:E.target.value})},l.handleBlur=function(E){var w=l.props,R=w.goButton,M=w.quickGo,N=w.rootPrefixCls,j=l.state.goInputText;if(R||j==="")return;if(E.relatedTarget&&(E.relatedTarget.className.indexOf("".concat(N,"-prev"))>=0||E.relatedTarget.className.indexOf("".concat(N,"-next"))>=0))return;l.setState({goInputText:""}),M(l.getValidValue())},l.go=function(E){var w=l.state.goInputText;if(w==="")return;(E.keyCode===c.ENTER||E.type==="click")&&(l.setState({goInputText:""}),l.props.quickGo(l.getValidValue()))},l}return Object(D.a)(f,[{key:"getValidValue",value:function(){var r=this.state,a=r.goInputText,y=r.current;return!a||isNaN(a)?y:Number(a)}},{key:"getPageSizeOptions",value:function(){var r=this.props,a=r.pageSize,y=r.pageSizeOptions;return y.some(function(E){return E.toString()===a.toString()})?y:y.concat([a.toString()]).sort(function(E,w){var R=isNaN(Number(E))?0:Number(E),M=isNaN(Number(w))?0:Number(w);return R-M})}},{key:"render",value:function(){var r=this,a=this.props,y=a.pageSize,E=a.locale,w=a.rootPrefixCls,R=a.changeSize,M=a.quickGo,N=a.goButton,j=a.selectComponentClass,K=a.buildOptionText,V=a.selectPrefixCls,z=a.disabled,Q=this.state.goInputText,ae="".concat(w,"-options"),oe=j,Ce=null,he=null,fe=null;if(!R&&!M)return null;var pe=this.getPageSizeOptions();if(R&&oe){var me=pe.map(function(ie,J){return A.a.createElement(oe.Option,{key:J,value:ie.toString()},(K||r.buildOptionText)(ie))});Ce=A.a.createElement(oe,{disabled:z,prefixCls:V,showSearch:!1,className:"".concat(ae,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(y||pe[0]).toString(),onChange:this.changeSize,getPopupContainer:function(J){return J.parentNode}},me)}return M&&(N&&(fe=typeof N=="boolean"?A.a.createElement("button",{type:"button",onClick:this.go,onKeyUp:this.go,disabled:z,className:"".concat(ae,"-quick-jumper-button")},E.jump_to_confirm):A.a.createElement("span",{onClick:this.go,onKeyUp:this.go},N)),he=A.a.createElement("div",{className:"".concat(ae,"-quick-jumper")},E.jump_to,A.a.createElement("input",{disabled:z,type:"text",value:Q,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur}),E.page,fe)),A.a.createElement("li",{className:"".concat(ae)},Ce,he)}}]),f}(A.a.Component);v.defaultProps={pageSizeOptions:["10","20","50","100"]};var x=v,n=H("N2Kk");function e(){}function t(T){return typeof T=="number"&&isFinite(T)&&Math.floor(T)===T}function i(T,g,f){return f}function p(T,g,f){var l=typeof T=="undefined"?g.pageSize:T;return Math.floor((f.total-1)/l)+1}var u=function(T){Object(L.a)(f,T);var g=Object(B.a)(f);function f(l){var r;Object(k.a)(this,f),r=g.call(this,l),r.getJumpPrevPage=function(){return Math.max(1,r.state.current-(r.props.showLessItems?3:5))},r.getJumpNextPage=function(){return Math.min(p(void 0,r.state,r.props),r.state.current+(r.props.showLessItems?3:5))},r.getItemIcon=function(R,M){var N=r.props.prefixCls,j=R||A.a.createElement("button",{type:"button","aria-label":M,className:"".concat(N,"-item-link")});return typeof R=="function"&&(j=A.a.createElement(R,Object(S.a)({},r.props))),j},r.savePaginationNode=function(R){r.paginationNode=R},r.isValid=function(R){return t(R)&&R!==r.state.current},r.shouldDisplayQuickJumper=function(){var R=r.props,M=R.showQuickJumper,N=R.pageSize,j=R.total;return j<=N?!1:M},r.handleKeyDown=function(R){(R.keyCode===c.ARROW_UP||R.keyCode===c.ARROW_DOWN)&&R.preventDefault()},r.handleKeyUp=function(R){var M=r.getValidValue(R),N=r.state.currentInputValue;M!==N&&r.setState({currentInputValue:M}),R.keyCode===c.ENTER?r.handleChange(M):R.keyCode===c.ARROW_UP?r.handleChange(M-1):R.keyCode===c.ARROW_DOWN&&r.handleChange(M+1)},r.changePageSize=function(R){var M=r.state.current,N=p(R,r.state,r.props);M=M>N?N:M,N===0&&(M=r.state.current),typeof R=="number"&&("pageSize"in r.props||r.setState({pageSize:R}),"current"in r.props||r.setState({current:M,currentInputValue:M})),r.props.onShowSizeChange(M,R),"onChange"in r.props&&r.props.onChange&&r.props.onChange(M,R)},r.handleChange=function(R){var M=r.props.disabled,N=R;if(r.isValid(N)&&!M){var j=p(void 0,r.state,r.props);N>j?N=j:N<1&&(N=1),"current"in r.props||r.setState({current:N,currentInputValue:N});var K=r.state.pageSize;return r.props.onChange(N,K),N}return r.state.current},r.prev=function(){r.hasPrev()&&r.handleChange(r.state.current-1)},r.next=function(){r.hasNext()&&r.handleChange(r.state.current+1)},r.jumpPrev=function(){r.handleChange(r.getJumpPrevPage())},r.jumpNext=function(){r.handleChange(r.getJumpNextPage())},r.hasPrev=function(){return r.state.current>1},r.hasNext=function(){return r.state.current<p(void 0,r.state,r.props)},r.runIfEnter=function(R,M){if(R.key==="Enter"||R.charCode===13){for(var N=arguments.length,j=new Array(N>2?N-2:0),K=2;K<N;K++)j[K-2]=arguments[K];M.apply(void 0,j)}},r.runIfEnterPrev=function(R){r.runIfEnter(R,r.prev)},r.runIfEnterNext=function(R){r.runIfEnter(R,r.next)},r.runIfEnterJumpPrev=function(R){r.runIfEnter(R,r.jumpPrev)},r.runIfEnterJumpNext=function(R){r.runIfEnter(R,r.jumpNext)},r.handleGoTO=function(R){(R.keyCode===c.ENTER||R.type==="click")&&r.handleChange(r.state.currentInputValue)};var a=l.onChange!==e,y="current"in l;y&&!a&&console.warn("Warning: You provided a `current` prop to a Pagination component without an `onChange` handler. This will render a read-only component.");var E=l.defaultCurrent;"current"in l&&(E=l.current);var w=l.defaultPageSize;return"pageSize"in l&&(w=l.pageSize),E=Math.min(E,p(w,void 0,l)),r.state={current:E,currentInputValue:E,pageSize:w},r}return Object(D.a)(f,[{key:"componentDidUpdate",value:function(r,a){var y=this.props.prefixCls;if(a.current!==this.state.current&&this.paginationNode){var E=this.paginationNode.querySelector(".".concat(y,"-item-").concat(a.current));E&&document.activeElement===E&&E.blur()}}},{key:"getValidValue",value:function(r){var a=r.target.value,y=p(void 0,this.state,this.props),E=this.state.currentInputValue,w;return a===""?w=a:isNaN(Number(a))?w=E:a>=y?w=y:w=Number(a),w}},{key:"getShowSizeChanger",value:function(){var r=this.props,a=r.showSizeChanger,y=r.total,E=r.totalBoundaryShowSizeChanger;return typeof a!="undefined"?a:y>E}},{key:"renderPrev",value:function(r){var a=this.props,y=a.prevIcon,E=a.itemRender,w=E(r,"prev",this.getItemIcon(y,"prev page")),R=!this.hasPrev();return Object(_.isValidElement)(w)?Object(_.cloneElement)(w,{disabled:R}):w}},{key:"renderNext",value:function(r){var a=this.props,y=a.nextIcon,E=a.itemRender,w=E(r,"next",this.getItemIcon(y,"next page")),R=!this.hasNext();return Object(_.isValidElement)(w)?Object(_.cloneElement)(w,{disabled:R}):w}},{key:"render",value:function(){var r=this,a=this.props,y=a.prefixCls,E=a.className,w=a.style,R=a.disabled,M=a.hideOnSinglePage,N=a.total,j=a.locale,K=a.showQuickJumper,V=a.showLessItems,z=a.showTitle,Q=a.showTotal,ae=a.simple,oe=a.itemRender,Ce=a.showPrevNextJumpers,he=a.jumpPrevIcon,fe=a.jumpNextIcon,pe=a.selectComponentClass,me=a.selectPrefixCls,ie=a.pageSizeOptions,J=this.state,ye=J.current,Pe=J.pageSize,Le=J.currentInputValue;if(M===!0&&N<=Pe)return null;var Re=p(void 0,this.state,this.props),X=[],$=null,ne=null,de=null,be=null,ve=null,Ee=K&&K.goButton,xe=V?1:2,Be=ye-1>0?ye-1:0,Ie=ye+1<Re?ye+1:Re,ke=Object.keys(this.props).reduce(function(W,G){return(G.substr(0,5)==="data-"||G.substr(0,5)==="aria-"||G==="role")&&(W[G]=r.props[G]),W},{});if(ae)return Ee&&(typeof Ee=="boolean"?ve=A.a.createElement("button",{type:"button",onClick:this.handleGoTO,onKeyUp:this.handleGoTO},j.jump_to_confirm):ve=A.a.createElement("span",{onClick:this.handleGoTO,onKeyUp:this.handleGoTO},Ee),ve=A.a.createElement("li",{title:z?"".concat(j.jump_to).concat(ye,"/").concat(Re):null,className:"".concat(y,"-simple-pager")},ve)),A.a.createElement("ul",Object(se.a)({className:s()(y,"".concat(y,"-simple"),Object(U.a)({},"".concat(y,"-disabled"),R),E),style:w,ref:this.savePaginationNode},ke),A.a.createElement("li",{title:z?j.prev_page:null,onClick:this.prev,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterPrev,className:s()("".concat(y,"-prev"),Object(U.a)({},"".concat(y,"-disabled"),!this.hasPrev())),"aria-disabled":!this.hasPrev()},this.renderPrev(Be)),A.a.createElement("li",{title:z?"".concat(ye,"/").concat(Re):null,className:"".concat(y,"-simple-pager")},A.a.createElement("input",{type:"text",value:Le,disabled:R,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onChange:this.handleKeyUp,size:"3"}),A.a.createElement("span",{className:"".concat(y,"-slash")},"/"),Re),A.a.createElement("li",{title:z?j.next_page:null,onClick:this.next,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterNext,className:s()("".concat(y,"-next"),Object(U.a)({},"".concat(y,"-disabled"),!this.hasNext())),"aria-disabled":!this.hasNext()},this.renderNext(Ie)),ve);if(Re<=3+xe*2){var Me={locale:j,rootPrefixCls:y,onClick:this.handleChange,onKeyPress:this.runIfEnter,showTitle:z,itemRender:oe};Re||X.push(A.a.createElement(b,Object(se.a)({},Me,{key:"noPager",page:Re,className:"".concat(y,"-disabled")})));for(var Ue=1;Ue<=Re;Ue+=1){var Fe=ye===Ue;X.push(A.a.createElement(b,Object(se.a)({},Me,{key:Ue,page:Ue,active:Fe})))}}else{var je=V?j.prev_3:j.prev_5,we=V?j.next_3:j.next_5;Ce&&($=A.a.createElement("li",{title:z?je:null,key:"prev",onClick:this.jumpPrev,tabIndex:"0",onKeyPress:this.runIfEnterJumpPrev,className:s()("".concat(y,"-jump-prev"),Object(U.a)({},"".concat(y,"-jump-prev-custom-icon"),!!he))},oe(this.getJumpPrevPage(),"jump-prev",this.getItemIcon(he,"prev page"))),ne=A.a.createElement("li",{title:z?we:null,key:"next",tabIndex:"0",onClick:this.jumpNext,onKeyPress:this.runIfEnterJumpNext,className:s()("".concat(y,"-jump-next"),Object(U.a)({},"".concat(y,"-jump-next-custom-icon"),!!fe))},oe(this.getJumpNextPage(),"jump-next",this.getItemIcon(fe,"next page")))),be=A.a.createElement(b,{locale:j,last:!0,rootPrefixCls:y,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:Re,page:Re,active:!1,showTitle:z,itemRender:oe}),de=A.a.createElement(b,{locale:j,rootPrefixCls:y,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:1,page:1,active:!1,showTitle:z,itemRender:oe});var Oe=Math.max(1,ye-xe),_e=Math.min(ye+xe,Re);ye-1<=xe&&(_e=1+xe*2),Re-ye<=xe&&(Oe=Re-xe*2);for(var ge=Oe;ge<=_e;ge+=1){var De=ye===ge;X.push(A.a.createElement(b,{locale:j,rootPrefixCls:y,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:ge,page:ge,active:De,showTitle:z,itemRender:oe}))}ye-1>=xe*2&&ye!==1+2&&(X[0]=Object(_.cloneElement)(X[0],{className:"".concat(y,"-item-after-jump-prev")}),X.unshift($)),Re-ye>=xe*2&&ye!==Re-2&&(X[X.length-1]=Object(_.cloneElement)(X[X.length-1],{className:"".concat(y,"-item-before-jump-next")}),X.push(ne)),Oe!==1&&X.unshift(de),_e!==Re&&X.push(be)}var re=null;Q&&(re=A.a.createElement("li",{className:"".concat(y,"-total-text")},Q(N,[N===0?0:(ye-1)*Pe+1,ye*Pe>N?N:ye*Pe])));var ee=!this.hasPrev()||!Re,te=!this.hasNext()||!Re;return A.a.createElement("ul",Object(se.a)({className:s()(y,E,Object(U.a)({},"".concat(y,"-disabled"),R)),style:w,unselectable:"unselectable",ref:this.savePaginationNode},ke),re,A.a.createElement("li",{title:z?j.prev_page:null,onClick:this.prev,tabIndex:ee?null:0,onKeyPress:this.runIfEnterPrev,className:s()("".concat(y,"-prev"),Object(U.a)({},"".concat(y,"-disabled"),ee)),"aria-disabled":ee},this.renderPrev(Be)),X,A.a.createElement("li",{title:z?j.next_page:null,onClick:this.next,tabIndex:te?null:0,onKeyPress:this.runIfEnterNext,className:s()("".concat(y,"-next"),Object(U.a)({},"".concat(y,"-disabled"),te)),"aria-disabled":te},this.renderNext(Ie)),A.a.createElement(x,{disabled:R,locale:j,rootPrefixCls:y,selectComponentClass:pe,selectPrefixCls:me,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:ye,pageSize:Pe,pageSizeOptions:ie,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:Ee}))}}],[{key:"getDerivedStateFromProps",value:function(r,a){var y={};if("current"in r&&(y.current=r.current,r.current!==a.current&&(y.currentInputValue=y.current)),"pageSize"in r&&r.pageSize!==a.pageSize){var E=a.current,w=p(r.pageSize,a,r);E=E>w?w:E,"current"in r||(y.current=E,y.currentInputValue=E),y.pageSize=r.pageSize}return y}}]),f}(A.a.Component);u.defaultProps={defaultCurrent:1,total:0,defaultPageSize:10,onChange:e,className:"",selectPrefixCls:"rc-select",prefixCls:"rc-pagination",selectComponentClass:null,hideOnSinglePage:!1,showPrevNextJumpers:!0,showQuickJumper:!1,showLessItems:!1,showTitle:!0,onShowSizeChange:e,locale:n.a,style:{},itemRender:i,totalBoundaryShowSizeChanger:50};var h=u},"746U":function(Ze,le,H){"use strict";H.d(le,"d",function(){return U}),H.d(le,"j",function(){return S}),H.d(le,"i",function(){return k}),H.d(le,"h",function(){return D}),H.d(le,"e",function(){return L}),H.d(le,"k",function(){return B}),H.d(le,"l",function(){return _}),H.d(le,"a",function(){return A}),H.d(le,"f",function(){return s}),H.d(le,"g",function(){return m}),H.d(le,"m",function(){return b}),H.d(le,"c",function(){return x}),H.d(le,"b",function(){return n}),H.d(le,"n",function(){return e}),H.d(le,"o",function(){return t});var se={number:"number",string:"string",undefined:"undefined",object:"object",function:"function"};function U(i){return Array.isArray?Array.isArray(i):!!(i&&typeof i.length===se.number&&i.constructor===Array)}function S(i){return typeof i===se.string||i instanceof String}function k(i){return typeof i===se.object&&i!==null&&!Array.isArray(i)&&!(i instanceof RegExp)&&!(i instanceof Date)}function D(i){return(typeof i===se.number||i instanceof Number)&&!isNaN(i)}function L(i){return i===!0||i===!1}function B(i){return typeof i===se.undefined}function _(i){return B(i)||i===null}function A(i,p){if(!i)throw new Error(p?"Unexpected type, expected '"+p+"'":"Unexpected type")}var C=Object.prototype.hasOwnProperty;function s(i){if(!k(i))return!1;for(var p in i)if(C.call(i,p))return!1;return!0}function m(i){return typeof i===se.function}function b(i,p){for(var u=Math.min(i.length,p.length),h=0;h<u;h++)c(i[h],p[h])}function c(i,p){if(S(p)){if(typeof i!==p)throw new Error("argument does not match constraint: typeof "+p)}else if(m(p)){try{if(i instanceof p)return}catch(u){}if(!_(i)&&i.constructor===p)return;if(p.length===1&&p.call(void 0,i)===!0)return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function v(i){for(var p=[],u=Object.getPrototypeOf(i);Object.prototype!==u;)p=p.concat(Object.getOwnPropertyNames(u)),u=Object.getPrototypeOf(u);return p}function x(i){for(var p=[],u=0,h=v(i);u<h.length;u++){var T=h[u];typeof i[T]=="function"&&p.push(T)}return p}function n(i,p){for(var u=function(l){return function(){var r=Array.prototype.slice.call(arguments,0);return p(l,r)}},h={},T=0,g=i;T<g.length;T++){var f=g[T];h[f]=u(f)}return h}function e(i){return i===null?void 0:i}function t(i){return typeof i=="undefined"?null:i}},"8HAY":function(Ze,le,H){"use strict";H.d(le,"a",function(){return L}),H.d(le,"b",function(){return B});var se=H("pmY6"),U=H("MI8n"),S=function(){var _=function(A,C){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,m){s.__proto__=m}||function(s,m){for(var b in m)m.hasOwnProperty(b)&&(s[b]=m[b])},_(A,C)};return function(A,C){_(A,C);function s(){this.constructor=A}A.prototype=C===null?Object.create(C):(s.prototype=C.prototype,new s)}}(),k=function(_,A,C,s){function m(b){return b instanceof C?b:new C(function(c){c(b)})}return new(C||(C=Promise))(function(b,c){function v(e){try{n(s.next(e))}catch(t){c(t)}}function x(e){try{n(s.throw(e))}catch(t){c(t)}}function n(e){e.done?b(e.value):m(e.value).then(v,x)}n((s=s.apply(_,A||[])).next())})},D=function(_,A){var C={label:0,sent:function(){if(b[0]&1)throw b[1];return b[1]},trys:[],ops:[]},s,m,b,c;return c={next:v(0),throw:v(1),return:v(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function v(n){return function(e){return x([n,e])}}function x(n){if(s)throw new TypeError("Generator is already executing.");for(;C;)try{if(s=1,m&&(b=n[0]&2?m.return:n[0]?m.throw||((b=m.return)&&b.call(m),0):m.next)&&!(b=b.call(m,n[1])).done)return b;(m=0,b)&&(n=[n[0]&2,b.value]);switch(n[0]){case 0:case 1:b=n;break;case 4:return C.label++,{value:n[1],done:!1};case 5:C.label++,m=n[1],n=[0];continue;case 7:n=C.ops.pop(),C.trys.pop();continue;default:if(!(b=C.trys,b=b.length>0&&b[b.length-1])&&(n[0]===6||n[0]===2)){C=0;continue}if(n[0]===3&&(!b||n[1]>b[0]&&n[1]<b[3])){C.label=n[1];break}if(n[0]===6&&C.label<b[1]){C.label=b[1],b=n;break}if(b&&C.label<b[2]){C.label=b[2],C.ops.push(n);break}b[2]&&C.ops.pop(),C.trys.pop();continue}n=A.call(_,C)}catch(e){n=[6,e],m=0}finally{s=b=0}if(n[0]&5)throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}},L=function(_){S(A,_);function A(C,s,m,b,c){s===void 0&&(s=""),m===void 0&&(m=""),b===void 0&&(b=!0);var v=_.call(this)||this;return v._onDidChange=v._register(new U.a),v.onDidChange=v._onDidChange.event,v._enabled=!0,v._checked=!1,v._id=C,v._label=s,v._cssClass=m,v._enabled=b,v._actionCallback=c,v}return Object.defineProperty(A.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),Object.defineProperty(A.prototype,"label",{get:function(){return this._label},set:function(C){this._setLabel(C)},enumerable:!0,configurable:!0}),A.prototype._setLabel=function(C){this._label!==C&&(this._label=C,this._onDidChange.fire({label:C}))},Object.defineProperty(A.prototype,"tooltip",{get:function(){return this._tooltip||""},set:function(C){this._setTooltip(C)},enumerable:!0,configurable:!0}),A.prototype._setTooltip=function(C){this._tooltip!==C&&(this._tooltip=C,this._onDidChange.fire({tooltip:C}))},Object.defineProperty(A.prototype,"class",{get:function(){return this._cssClass},set:function(C){this._setClass(C)},enumerable:!0,configurable:!0}),A.prototype._setClass=function(C){this._cssClass!==C&&(this._cssClass=C,this._onDidChange.fire({class:C}))},Object.defineProperty(A.prototype,"enabled",{get:function(){return this._enabled},set:function(C){this._setEnabled(C)},enumerable:!0,configurable:!0}),A.prototype._setEnabled=function(C){this._enabled!==C&&(this._enabled=C,this._onDidChange.fire({enabled:C}))},Object.defineProperty(A.prototype,"checked",{get:function(){return this._checked},set:function(C){this._setChecked(C)},enumerable:!0,configurable:!0}),A.prototype._setChecked=function(C){this._checked!==C&&(this._checked=C,this._onDidChange.fire({checked:C}))},A.prototype.run=function(C,s){return this._actionCallback?this._actionCallback(C):Promise.resolve(!0)},A}(se.a),B=function(_){S(A,_);function A(){var C=_!==null&&_.apply(this,arguments)||this;return C._onDidBeforeRun=C._register(new U.a),C.onDidBeforeRun=C._onDidBeforeRun.event,C._onDidRun=C._register(new U.a),C.onDidRun=C._onDidRun.event,C}return A.prototype.run=function(C,s){return k(this,void 0,void 0,function(){var m,b;return D(this,function(c){switch(c.label){case 0:if(!C.enabled)return[2,Promise.resolve(null)];this._onDidBeforeRun.fire({action:C}),c.label=1;case 1:return c.trys.push([1,3,,4]),[4,this.runAction(C,s)];case 2:return m=c.sent(),this._onDidRun.fire({action:C,result:m}),[3,4];case 3:return b=c.sent(),this._onDidRun.fire({action:C,error:b}),[3,4];case 4:return[2]}})})},A.prototype.runAction=function(C,s){var m=s?C.run(s):C.run();return Promise.resolve(m)},A}(se.a)},"8hTe":function(Ze,le,H){Ze.exports={button:"button___1wy9m"}},"9Bee":function(Ze,le,H){"use strict";var se=H("DYRE"),U=H("zeV3"),S=H("+L6B"),k=H("2/Rp"),D=H("k1fw"),L=H("9og8"),B=H("tJVT"),_=H("WmNS"),A=H.n(_),C=H("q1tI"),s=H.n(C),m=H("vg9a"),b=H("DlQD"),c=H.n(b),v=H("rUJ1");function x(O,o){var d=O.match(/^(\s+)(?:```)/);if(d===null)return o;var P=d[1];return o.split(`
`).map(function(F){var I=F.match(/^\s+/);if(I===null)return F;var Z=Object(B.a)(I,1),Te=Z[0];return Te.length>=P.length?F.slice(P.length):F}).join(`
`)}var n=[],e=["<ul>"],t=new c.a.Renderer,i=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function p(){n.length=0,e=["<ul>"]}var u={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function h(O,o,d,P){if(o>=O.length||O[o].level<=d)return o;var F=O[o];P.push("<li><a href='#"+F.anchor+"'>"+F.text+"</a>"),o++;var I=[];return o=h(O,o,F.level,I),I.length>0&&(P.push("<ul>"),I.forEach(function(Z){P.push(Z)}),P.push("</ul>")),P.push("</li>"),o=h(O,o,d,P),o}function T(){return h(n,0,0,e),e.push("</ul>"),e.join("")}var g={heading:function(o){var d=i.exec(o);if(d)return{type:"heading",raw:d[0],depth:d[1].length,text:d[2]}},fences:function(o){var d=this.rules.block.fences.exec(o);if(d){var P=d[0],F=x(P,d[3]||""),I=d[2]?d[2].trim():d[2];if(["latex","katex","math"].indexOf(I)>=0){var Z=r(),Te=F;F=Z,a[Z]={type:"block",expression:Te}}return{type:"code",raw:P,lang:I,text:F}}}},f=/(?:\${2})([^\n`]+?)(?:\${2})/gi,l=0,r=function(){return"__special_katext_id_".concat(l++,"__")},a={};function y(){return a}function E(){l=0,a={}}function w(O){return O=O.replace(f,function(o,d){var P=r();return a[P]={type:"inline",expression:d},P}),O}var R=t.listitem;t.listitem=function(O){return R(w(O))};var M=t.paragraph;t.paragraph=function(O){return M(w(O))};var N=t.tablecell;t.tablecell=function(O,o){return N(w(O),o)},t.code=function(O,o,d){var P=(o||"").match(/\S*/)[0];return P?["latex","katex","math"].indexOf(P)>=0?"<p class='editormd-tex'>".concat(O,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(o,'">').concat(d?O:Object(v.escape)(O,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(d?O:Object(v.escape)(O,!0))+"</code></pre>"},t.heading=function(O,o,d){var P=this.options.headerPrefix+d.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return n.push({anchor:P,level:o,text:O}),"<h"+o+' id="'+P+'">'+O+"</h"+o+">"},c.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),c.a.use({tokenizer:g,renderer:t});var j=c.a,K=H("SJMd"),V=H("ulZh"),z=H.n(V),Q=H("m3rI"),ae=H("Oy/b"),oe=H("p5ED"),Ce=H("ErOA");/*! *****************************************************************************
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 he=function(O,o){return(he=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,P){d.__proto__=P}||function(d,P){for(var F in P)Object.prototype.hasOwnProperty.call(P,F)&&(d[F]=P[F])})(O,o)};function fe(O,o){function d(){this.constructor=O}he(O,o),O.prototype=o===null?Object.create(o):(d.prototype=o.prototype,new d)}function pe(O,o,d,P){return new(d||(d=Promise))(function(F,I){function Z(Ke){try{Ne(P.next(Ke))}catch(Se){I(Se)}}function Te(Ke){try{Ne(P.throw(Ke))}catch(Se){I(Se)}}function Ne(Ke){var Se;Ke.done?F(Ke.value):(Se=Ke.value,Se instanceof d?Se:new d(function(Qe){Qe(Se)})).then(Z,Te)}Ne((P=P.apply(O,o||[])).next())})}function me(O,o){var d,P,F,I,Z={label:0,sent:function(){if(1&F[0])throw F[1];return F[1]},trys:[],ops:[]};return I={next:Te(0),throw:Te(1),return:Te(2)},typeof Symbol=="function"&&(I[Symbol.iterator]=function(){return this}),I;function Te(Ne){return function(Ke){return function(Se){if(d)throw new TypeError("Generator is already executing.");for(;Z;)try{if(d=1,P&&(F=2&Se[0]?P.return:Se[0]?P.throw||((F=P.return)&&F.call(P),0):P.next)&&!(F=F.call(P,Se[1])).done)return F;switch(P=0,F&&(Se=[2&Se[0],F.value]),Se[0]){case 0:case 1:F=Se;break;case 4:return Z.label++,{value:Se[1],done:!1};case 5:Z.label++,P=Se[1],Se=[0];continue;case 7:Se=Z.ops.pop(),Z.trys.pop();continue;default:if(!(F=Z.trys,(F=F.length>0&&F[F.length-1])||Se[0]!==6&&Se[0]!==2)){Z=0;continue}if(Se[0]===3&&(!F||Se[1]>F[0]&&Se[1]<F[3])){Z.label=Se[1];break}if(Se[0]===6&&Z.label<F[1]){Z.label=F[1],F=Se;break}if(F&&Z.label<F[2]){Z.label=F[2],Z.ops.push(Se);break}F[2]&&Z.ops.pop(),Z.trys.pop();continue}Se=o.call(O,Z)}catch(Qe){Se=[6,Qe],P=0}finally{d=F=0}if(5&Se[0])throw Se[1];return{value:Se[0]?Se[1]:void 0,done:!0}}([Ne,Ke])}}}function ie(){for(var O=0,o=0,d=arguments.length;o<d;o++)O+=arguments[o].length;var P=Array(O),F=0;for(o=0;o<d;o++)for(var I=arguments[o],Z=0,Te=I.length;Z<Te;Z++,F++)P[F]=I[Z];return P}var J=function(){function O(){}return O.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},O.setAttributes=function(o,d){for(var P=0,F=d;P<F.length;P++){var I=F[P],Z=I[0],Te=I[1];o.setAttribute(Z,Te)}},O.createRect=function(o,d,P){var F=document.createElementNS("http://www.w3.org/2000/svg","rect");return F.setAttribute("width",o.toString()),F.setAttribute("height",d.toString()),P&&O.setAttributes(F,P),F},O.createLine=function(o,d,P,F,I){var Z=document.createElementNS("http://www.w3.org/2000/svg","line");return Z.setAttribute("x1",o.toString()),Z.setAttribute("y1",d.toString()),Z.setAttribute("x2",P.toString()),Z.setAttribute("y2",F.toString()),I&&O.setAttributes(Z,I),Z},O.createPolygon=function(o,d){var P=document.createElementNS("http://www.w3.org/2000/svg","polygon");return P.setAttribute("points",o),d&&O.setAttributes(P,d),P},O.createCircle=function(o,d){var P=document.createElementNS("http://www.w3.org/2000/svg","circle");return P.setAttribute("cx",(o/2).toString()),P.setAttribute("cy",(o/2).toString()),P.setAttribute("r",o.toString()),d&&O.setAttributes(P,d),P},O.createEllipse=function(o,d,P){var F=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return F.setAttribute("cx",(o/2).toString()),F.setAttribute("cy",(d/2).toString()),F.setAttribute("rx",(o/2).toString()),F.setAttribute("ry",(d/2).toString()),P&&O.setAttributes(F,P),F},O.createGroup=function(o){var d=document.createElementNS("http://www.w3.org/2000/svg","g");return o&&O.setAttributes(d,o),d},O.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},O.createMarker=function(o,d,P,F,I,Z,Te){var Ne=document.createElementNS("http://www.w3.org/2000/svg","marker");return O.setAttributes(Ne,[["id",o],["orient",d],["markerWidth",P.toString()],["markerHeight",F.toString()],["refX",I.toString()],["refY",Z.toString()]]),Ne.appendChild(Te),Ne},O.createText=function(o){var d=document.createElementNS("http://www.w3.org/2000/svg","text");return d.setAttribute("x","0"),d.setAttribute("y","0"),o&&O.setAttributes(d,o),d},O.createTSpan=function(o,d){var P=document.createElementNS("http://www.w3.org/2000/svg","tspan");return P.textContent=o,d&&O.setAttributes(P,d),P},O.createImage=function(o){var d=document.createElementNS("http://www.w3.org/2000/svg","image");return o&&O.setAttributes(d,o),d},O.createPoint=function(o,d){var P=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return P.x=o,P.y=d,P},O.createPath=function(o,d){var P=document.createElementNS("http://www.w3.org/2000/svg","path");return P.setAttribute("d",o),d&&O.setAttributes(P,d),P},O}(),ye=function(){function O(){}return O.addKey=function(o){O.key=o},Object.defineProperty(O,"isLicensed",{get:function(){return!!O.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(O.key)},enumerable:!1,configurable:!0}),O}(),Pe=function(){function O(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return O.prototype.rasterize=function(o,d,P){var F=this;return new Promise(function(I){var Z=P!==void 0?P:document.createElement("canvas");o===null&&(F.markersOnly=!0,F.naturalSize=!1);var Te=document.createElementNS("http://www.w3.org/2000/svg","svg");Te.setAttribute("xmlns","http://www.w3.org/2000/svg"),Te.setAttribute("width",d.width.baseVal.valueAsString),Te.setAttribute("height",d.height.baseVal.valueAsString),Te.setAttribute("viewBox","0 0 "+d.viewBox.baseVal.width.toString()+" "+d.viewBox.baseVal.height.toString()),Te.innerHTML=d.innerHTML,F.naturalSize===!0?(Te.width.baseVal.value=o.naturalWidth,Te.height.baseVal.value=o.naturalHeight):F.width!==void 0&&F.height!==void 0&&(Te.width.baseVal.value=F.width,Te.height.baseVal.value=F.height),Z.width=Te.width.baseVal.value,Z.height=Te.height.baseVal.value;var Ne=Te.outerHTML,Ke=Z.getContext("2d");F.markersOnly!==!0&&Ke.drawImage(o,0,0,Z.width,Z.height);var Se=window.URL,Qe=new Image(Z.width,Z.height);Qe.setAttribute("crossOrigin","anonymous");var it=new Blob([Ne],{type:"image/svg+xml"}),ht=Se.createObjectURL(it);Qe.onload=function(){Ke.drawImage(Qe,0,0),Se.revokeObjectURL(ht);var At=Z.toDataURL(F.imageType,F.imageQuality);I(At)},Qe.src=ht})},O}(),Le=function(){},Re=function(){function O(o){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+o+"_"}return Object.defineProperty(O.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#ffffff",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarColor:"#eeeeee",toolbarHeight:40,toolboxColor:"#eeeeee",toolboxAccentColor:"#3080c3",undoButtonVisible:!0,redoButtonVisible:!1,zoomButtonVisible:!1,zoomOutButtonVisible:!1,clearButtonVisible:!1,resultButtonBlockVisible:!0,logoPosition:"left"}},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),O.prototype.addClass=function(o){return this.styleSheet===void 0&&this.addStyleSheet(),o.name=""+this.classNamePrefix+o.localName,this.classes.push(o),this.styleSheet.sheet.insertRule("."+o.name+" {"+o.style+"}",this.styleSheet.sheet.cssRules.length),o},O.prototype.addRule=function(o){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(o),this.styleSheet.sheet.insertRule(o.selector+" {"+o.style+"}",this.styleSheet.sheet.cssRules.length)},O.prototype.addStyleSheet=function(){var o;this.styleSheet=document.createElement("style"),((o=this.styleSheetRoot)!==null&&o!==void 0?o:document.head).appendChild(this.styleSheet),this.addRule(new X("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new X("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new X("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new $("fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new $("fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},O.prototype.removeStyleSheet=function(){var o;this.styleSheet&&(((o=this.styleSheetRoot)!==null&&o!==void 0?o:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},O}(),X=function(O,o){this.selector=O,this.style=o},$=function(O,o){this.localName=O,this.style=o},ne=function(){function O(o,d,P,F,I){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=o,this.displayMode=d,this.markerItems=P,this.uiStyleSettings=F,this.styles=I,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return O.prototype.show=function(o){var d=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=o,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var P=document.createElement("div");P.className=this.toolbarBlockStyleClass.name,P.style.whiteSpace="nowrap",this.uiContainer.appendChild(P),this.addActionButton(P,'<svg viewBox="0 0 24 24"><path d="M10.07 14.27a.997.997 0 011.33.48l2.3 4.99 1.8-.85-2.31-4.98c-.24-.5-.02-1.1.48-1.33l.28-.08 2.3-.45L8 5.12V15.9l1.82-1.47.25-.16m3.57 7.7a.99.99 0 01-1.33-.47l-2.18-4.74-2.51 2.02c-.17.14-.38.22-.62.22a1 1 0 01-1-1V3a1 1 0 011-1c.24 0 .47.09.64.23l.01-.01 11.49 9.64a1.001 1.001 0 01-.44 1.75l-3.16.62 2.2 4.73c.26.5.02 1.09-.48 1.32l-3.62 1.69z"/></svg>',"select"),this.addActionButton(P,'<svg viewBox="0 0 24 24"><path d="M9 3v1H4v2h1v13a2 2 0 002 2h10a2 2 0 002-2V6h1V4h-5V3H9M7 6h10v13H7V6m2 2v9h2V8H9m4 0v9h2V8h-2z"/></svg>',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(P,'<svg viewBox="0 0 24 24"><path d="M19.36 2.72l1.42 1.42-5.72 5.71c1.07 1.54 1.22 3.39.32 4.59L9.06 8.12c1.2-.9 3.05-.75 4.59.32l5.71-5.72M5.93 17.57c-2.01-2.01-3.24-4.41-3.58-6.65l4.88-2.09 7.44 7.44-2.09 4.88c-2.24-.34-4.64-1.57-6.65-3.58z"/></svg>',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(P,'<svg viewBox="0 0 24 24"><path d="M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"/></svg>',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(P,'<svg viewBox="0 0 24 24"><path d="M18.4 10.6C16.55 9 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 017.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"/></svg>',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(P,'<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"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(P,'<svg viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 009.5 3 6.5 6.5 0 003 9.5 6.5 6.5 0 009.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 5 1.5-1.5-5-5m-6 0C7 14 5 12 5 9.5S7 5 9.5 5 14 7 14 9.5 12 14 9.5 14M7 9h5v1H7V9z"/></svg>',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(P,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(I){var Z=document.createElement("div");Z.className=""+d.toolbarButtonStyleClass.name,Z.setAttribute("data-type-name",I.typeName),Z.innerHTML=I.icon,Z.addEventListener("click",function(){d.markerToolbarButtonClicked(Z,I)}),d.buttons.push(Z),d.markerButtons.push(Z)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var F=document.createElement("div");F.className=this.toolbarBlockStyleClass.name,F.style.whiteSpace="nowrap",F.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(F),this.addActionButton(F,'<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>',"render"),this.addActionButton(F,'<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"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},O.prototype.addButtonClickListener=function(o){this.buttonClickListeners.push(o)},O.prototype.removeButtonClickListener=function(o){this.buttonClickListeners.indexOf(o)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(o),1)},O.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},O.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var o=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var d=0;d<this.markerButtons.length;d++)d<o||d===o&&this.markerButtons.length-1===o?this.markerButtonBlock.appendChild(this.markerButtons[d]):(d===o&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[d]))}},O.prototype.overflowButtonClicked=function(){this.markerButtonOverflowBlock.style.display!=="none"?(this.markerButtonOverflowBlock.className=this.markerButtonOverflowBlock.className.replace(this.styles.fadeInAnimationClassName,""),this.markerButtonOverflowBlock.style.display="none"):(this.markerButtonOverflowBlock.className+=" "+this.styles.fadeInAnimationClassName,this.markerButtonOverflowBlock.style.top=this.uiContainer.offsetTop+this.overflowButton.offsetHeight+"px",this.markerButtonOverflowBlock.style.right=this.uiContainer.offsetWidth-this.overflowButton.offsetLeft-this.overflowButton.offsetWidth+2*this.uiContainer.offsetLeft+"px",this.markerButtonOverflowBlock.style.display="inline-block")},O.prototype.resetButtonStyles=function(){var o=this;this.buttons.forEach(function(d){d.className=d.className.replace(o.uiStyleSettings.toolbarButtonStyleColorsClassName?o.uiStyleSettings.toolbarButtonStyleColorsClassName:o.toolbarButtonStyleColorsClass.name,"").trim(),d.className=d.className.replace(o.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?o.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:o.toolbarActiveButtonStyleColorsClass.name,"").trim(),d.className+=" "+(o.uiStyleSettings.toolbarButtonStyleColorsClassName?o.uiStyleSettings.toolbarButtonStyleColorsClassName:o.toolbarButtonStyleColorsClass.name)})},O.prototype.addActionButton=function(o,d,P){var F=this,I=document.createElement("div");switch(I.className=""+this.toolbarButtonStyleClass.name,I.innerHTML=d,I.setAttribute("data-action",P),I.addEventListener("click",function(){F.actionToolbarButtonClicked(I,P)}),P){case"select":I.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":I.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":I.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":I.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":I.style.fill=this.uiStyleSettings.closeButtonColor}o.appendChild(I),this.buttons.push(I)},O.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new $("toolbar",`
width: 100%;
flex-shrink: 0;
display: flex;
flex-direction: row;
justify-content: space-between;
height: `+this.uiStyleSettings.toolbarHeight+`px;
box-sizing: content-box;
`+(this.displayMode==="inline"?"border-top-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
`+(this.displayMode==="inline"?"border-top-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
overflow: hidden;
`)),this.toolbarStyleColorsClass=this.styles.addClass(new $("toolbar_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
`)),this.toolbarBlockStyleClass=this.styles.addClass(new $("toolbar-block",`
display: inline-block;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new $("toolbar-overflow-block",`
position: absolute;
top: `+this.uiStyleSettings.toolbarHeight+`px;
max-width: `+2*this.uiStyleSettings.toolbarHeight+`px;
z-index: 10;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleColorsClass=this.styles.addClass(new $("toolbar-overflow-block_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`));var o=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new $("toolbar_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*o)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*o)+`px;
padding: `+o+`px;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new $("toolbar_button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new $("toolbar_active_button",`
fill: `+this.uiStyleSettings.toolbarColor+`;
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new X("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`)),this.styles.addRule(new X("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`))},O.prototype.markerToolbarButtonClicked=function(o,d){this.setActiveButton(o),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(P){return P("marker",d)}),this.markerButtonOverflowBlock.style.display="none"},O.prototype.actionToolbarButtonClicked=function(o,d){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(P){return P("action",d)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},O.prototype.setActiveButton=function(o){this.resetButtonStyles(),o.className=o.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),o.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},O.prototype.setActiveMarkerButton=function(o){var d=this.markerButtons.find(function(P){return P.getAttribute("data-type-name")===o});d&&this.setActiveButton(d)},O.prototype.setCurrentMarker=function(o){var d=this;this.currentMarker=o,this.buttons.filter(function(P){return/delete|notes/.test(P.getAttribute("data-action"))}).forEach(function(P){d.currentMarker===void 0?(P.style.fillOpacity="0.4",P.style.pointerEvents="none"):(P.style.fillOpacity="1",P.style.pointerEvents="all")})},O}(),de=function(){function O(o,d,P,F){this.panels=[],this.panelButtons=[],this.markerjsContainer=o,this.displayMode=d,this.uiStyleSettings=P,this.styles=F,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return O.prototype.addStyles=function(){var o;this.toolboxStyleClass=this.styles.addClass(new $("toolbox",`
width: 100%;
flex-shrink: 0;
display: flex;
flex-direction: column;
font-family: sans-serif;
`+(this.displayMode==="popup"?"height:"+2.5*this.uiStyleSettings.toolbarHeight+"px;":"")+`
box-sizing: content-box;
`+(this.displayMode==="popup"?"background-color: "+this.uiStyleSettings.canvasBackgroundColor+";":"")+`
`+(this.displayMode==="inline"?"border-bottom-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
`+(this.displayMode==="inline"?"border-bottom-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
overflow: hidden;
`)),this.toolboxStyleColorsClass=this.styles.addClass(new $("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var d=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new $("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new $("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new $("toolbox-panel-row",`
display: flex;
`+(this.displayMode==="inline"?"position: absolute;":"")+`
`+(this.displayMode==="inline"?"bottom: "+this.uiStyleSettings.toolbarHeight+"px;":"")+`
cursor: default;
height: `+1.5*this.uiStyleSettings.toolbarHeight+`px;
`+(this.displayMode==="inline"?"width: 100%;":"")+`
box-sizing: content-box;
`)),this.toolboxPanelRowStyleColorsClass=this.styles.addClass(new $("toolbox-panel-row_colors",`
background-color: `+((o=this.uiStyleSettings.toolboxBackgroundColor)!==null&&o!==void 0?o:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new $("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*d)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*d)+`px;
padding: `+d+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new $("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new $("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new X("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new X("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},O.prototype.show=function(o){var d;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=o,this.uiContainer.className=this.toolboxStyleClass.name+" "+((d=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&d!==void 0?d:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},O.prototype.setPanelButtons=function(o){var d,P,F=this;this.panels=o,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((d=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&d!==void 0?d:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((P=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&P!==void 0?P:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(I){var Z;I.uiStyleSettings=F.uiStyleSettings;var Te=document.createElement("div");Te.className=F.toolboxButtonStyleClass.name+" "+((Z=F.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Z!==void 0?Z:F.toolboxButtonStyleColorsClass.name),Te.innerHTML=I.icon,Te.title=I.title,Te.addEventListener("click",function(){F.panelButtonClick(I)}),F.panelButtons.push(Te),F.buttonRow.appendChild(Te)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},O.prototype.panelButtonClick=function(o){var d=this,P=-1;if(o!==this.activePanel){P=this.panels.indexOf(o),this.panelRow.innerHTML="";var F=o.getUi();F.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(F),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=o}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){d.displayMode==="inline"?d.panelRow.style.display="none":d.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(I,Z){var Te,Ne;I.className=d.toolboxButtonStyleClass.name+" "+(Z===P?""+((Te=d.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Te!==void 0?Te:d.toolboxActiveButtonStyleColorsClass.name):""+((Ne=d.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Ne!==void 0?Ne:d.toolboxButtonStyleColorsClass.name))})},O}(),be=function(O,o){this.title=O,this.icon=o},ve=function(O){function o(d,P,F,I){var Z=O.call(this,d,I||'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 01-1.5-1.5A1.5 1.5 0 0117.5 9a1.5 1.5 0 011.5 1.5 1.5 1.5 0 01-1.5 1.5m-3-4A1.5 1.5 0 0113 6.5 1.5 1.5 0 0114.5 5 1.5 1.5 0 0116 6.5 1.5 1.5 0 0114.5 8m-5 0A1.5 1.5 0 018 6.5 1.5 1.5 0 019.5 5 1.5 1.5 0 0111 6.5 1.5 1.5 0 019.5 8m-3 4A1.5 1.5 0 015 10.5 1.5 1.5 0 016.5 9 1.5 1.5 0 018 10.5 1.5 1.5 0 016.5 12M12 3a9 9 0 00-9 9 9 9 0 009 9 1.5 1.5 0 001.5-1.5c0-.39-.15-.74-.39-1-.23-.27-.38-.62-.38-1a1.5 1.5 0 011.5-1.5H16a5 5 0 005-5c0-4.42-4.03-8-9-8z"/></svg>')||this;return Z.colors=[],Z.addTransparent=!1,Z.colorBoxes=[],Z.colors=P,Z.currentColor=F,Z.setCurrentColor=Z.setCurrentColor.bind(Z),Z.getColorBox=Z.getColorBox.bind(Z),Z}return fe(o,O),o.prototype.getUi=function(){var d=this,P=document.createElement("div");return P.style.overflow="hidden",P.style.whiteSpace="nowrap",this.colors.forEach(function(F){var I=d.getColorBox(F);P.appendChild(I),d.colorBoxes.push(I)}),P},o.prototype.getColorBox=function(d){var P=this,F=this.uiStyleSettings.toolbarHeight/4,I=this.uiStyleSettings.toolbarHeight-F,Z=document.createElement("div");Z.style.display="inline-block",Z.style.boxSizing="content-box",Z.style.width=I-2+"px",Z.style.height=I-2+"px",Z.style.padding="1px",Z.style.marginRight="2px",Z.style.marginBottom="2px",Z.style.borderWidth="2px",Z.style.borderStyle="solid",Z.style.borderRadius=(I+2)/2+"px",Z.style.borderColor=d===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",Z.addEventListener("click",function(){P.setCurrentColor(d,Z)});var Te=document.createElement("div");return Te.style.display="inline-block",Te.style.width=I-2+"px",Te.style.height=I-2+"px",Te.style.backgroundColor=d,Te.style.borderRadius=I/2+"px",d==="transparent"&&(Te.style.fill=this.uiStyleSettings.toolboxAccentColor,Te.innerHTML=`<svg viewBox="0 0 24 24">
<path d="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z" />
</svg>`),Z.appendChild(Te),Z},o.prototype.setCurrentColor=function(d,P){var F=this;this.currentColor=d,this.colorBoxes.forEach(function(I){I.style.borderColor=I===P?F.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(d)},o}(be),Ee=function(){function O(o,d,P){this._state="new",this._isSelected=!1,this._container=o,this._overlayContainer=d,this.globalSettings=P,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(O.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),O.prototype.ownsTarget=function(o){return!1},Object.defineProperty(O.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),O.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},O.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},O.prototype.pointerDown=function(o,d){},O.prototype.dblClick=function(o,d){},O.prototype.manipulate=function(o){},O.prototype.pointerUp=function(o){this.stateChanged()},O.prototype.dispose=function(){},O.prototype.addMarkerVisualToContainer=function(o){this.container.childNodes.length>0?this.container.insertBefore(o,this.container.childNodes[0]):this.container.appendChild(o)},O.prototype.getState=function(){return{typeName:O.typeName,state:this.state,notes:this.notes}},O.prototype.restoreState=function(o){this._state=o.state,this.notes=o.notes},O.prototype.scale=function(o,d){},O.prototype.colorChanged=function(o){this.onColorChanged&&this.onColorChanged(o),this.stateChanged()},O.prototype.fillColorChanged=function(o){this.onFillColorChanged&&this.onFillColorChanged(o),this.stateChanged()},O.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var o=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),o.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(o)&&this.onStateChanged(this)}},O.typeName="MarkerBase",O}(),xe=function(){function O(){this.findGripByVisual=this.findGripByVisual.bind(this)}return O.prototype.findGripByVisual=function(o){return this.topLeft.ownsTarget(o)?this.topLeft:this.topCenter.ownsTarget(o)?this.topCenter:this.topRight.ownsTarget(o)?this.topRight:this.centerLeft.ownsTarget(o)?this.centerLeft:this.centerRight.ownsTarget(o)?this.centerRight:this.bottomLeft.ownsTarget(o)?this.bottomLeft:this.bottomCenter.ownsTarget(o)?this.bottomCenter:this.bottomRight.ownsTarget(o)?this.bottomRight:void 0},O}(),Be=function(){function O(){this.GRIP_SIZE=10,this.visual=J.createGroup(),this.visual.appendChild(J.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(J.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return O.prototype.ownsTarget=function(o){return o===this.visual||o===this.visual.childNodes[0]||o===this.visual.childNodes[1]},O}(),Ie=function(){function O(){}return O.toITransformMatrix=function(o){return{a:o.a,b:o.b,c:o.c,d:o.d,e:o.e,f:o.f}},O.toSVGMatrix=function(o,d){return o.a=d.a,o.b=d.b,o.c=d.c,o.d=d.d,o.e=d.e,o.f=d.f,o},O}(),ke=function(O){function o(d,P,F){var I=O.call(this,d,P,F)||this;return I.left=0,I.top=0,I.width=0,I.height=0,I.defaultSize={x:50,y:20},I.offsetX=0,I.offsetY=0,I.rotationAngle=0,I.CB_DISTANCE=10,I._suppressMarkerCreateEvent=!1,I.container.transform.baseVal.appendItem(J.createTransform()),I.setupControlBox(),I}return fe(o,O),Object.defineProperty(o.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"visual",{get:function(){return this._visual},set:function(d){this._visual=d;var P=J.createTransform();this._visual.transform.baseVal.appendItem(P)},enumerable:!1,configurable:!0}),o.prototype.ownsTarget=function(d){return!!O.prototype.ownsTarget.call(this,d)||!!(this.controlGrips.findGripByVisual(d)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(d))},o.prototype.pointerDown=function(d,P){O.prototype.pointerDown.call(this,d,P),this.state==="new"&&(this.left=d.x,this.top=d.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var F=this.unrotatePoint(d);if(this.manipulationStartX=F.x,this.manipulationStartY=F.y,this.offsetX=F.x-this.left,this.offsetY=F.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(P),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(P)){this.activeGrip=this.rotatorGrip;var I=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=I.x-this.width/2,this.top=I.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var Z=this.container.transform.baseVal.getItem(0);Z.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(Z,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},o.prototype.pointerUp=function(d){var P=this.state;O.prototype.pointerUp.call(this,d),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(d),this._state="select",P==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},o.prototype.moveVisual=function(d){this.visual.style.transform="translate("+d.x+"px, "+d.y+"px)"},o.prototype.manipulate=function(d){var P=this.unrotatePoint(d);this.state==="creating"?this.resize(d):this.state==="move"?(this.left=this.manipulationStartLeft+(P.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(P.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(P):this.state==="rotate"&&this.rotate(d)},o.prototype.resize=function(d){var P=this.manipulationStartLeft,F=this.manipulationStartWidth,I=this.manipulationStartTop,Z=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:P=this.manipulationStartLeft+d.x-this.manipulationStartX,F=this.manipulationStartWidth+this.manipulationStartLeft-P;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:F=this.manipulationStartWidth+d.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:I=this.manipulationStartTop+d.y-this.manipulationStartY,Z=this.manipulationStartHeight+this.manipulationStartTop-I;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:Z=this.manipulationStartHeight+d.y-this.manipulationStartY}F>=0?(this.left=P,this.width=F):(this.left=P+F,this.width=-F),Z>=0?(this.top=I,this.height=Z):(this.top=I+Z,this.height=-Z),this.setSize()},o.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},o.prototype.rotate=function(d){if(Math.abs(d.x-this.centerX)>.1){var P=Math.sign(d.x-this.centerX);this.rotationAngle=180*Math.atan((d.y-this.centerY)/(d.x-this.centerX))/Math.PI+90*P,this.applyRotation()}},o.prototype.applyRotation=function(){var d=this.container.transform.baseVal.getItem(0);d.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(d,0)},o.prototype.rotatePoint=function(d){if(this.rotationAngle===0)return d;var P=this.container.getCTM(),F=J.createPoint(d.x,d.y);return{x:(F=F.matrixTransform(P)).x,y:F.y}},o.prototype.unrotatePoint=function(d){if(this.rotationAngle===0)return d;var P=this.container.getCTM();P=P.inverse();var F=J.createPoint(d.x,d.y);return{x:(F=F.matrixTransform(P)).x,y:F.y}},o.prototype.select=function(){O.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},o.prototype.deselect=function(){O.prototype.deselect.call(this),this.controlBox.style.display="none"},o.prototype.setupControlBox=function(){this.controlBox=J.createGroup();var d=J.createTransform();d.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(d),this.container.appendChild(this.controlBox),this.controlRect=J.createRect(this.width+this.CB_DISTANCE,this.height+this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"],["fill","transparent"],["pointer-events","none"]]),this.controlBox.appendChild(this.controlRect),this.globalSettings.disableRotation!==!0&&(this.rotatorGripLine=J.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new xe,this.addControlGrips(),this.controlBox.style.display="none"},o.prototype.adjustControlBox=function(){var d=this.controlBox.transform.baseVal.getItem(0);d.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(d,0),this.controlRect.setAttribute("width",(this.width+this.CB_DISTANCE).toString()),this.controlRect.setAttribute("height",(this.height+this.CB_DISTANCE).toString()),this.rotatorGripLine!==void 0&&(this.rotatorGripLine.setAttribute("x1",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y1",(-this.CB_DISTANCE/2).toString()),this.rotatorGripLine.setAttribute("x2",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y2",(3*-this.CB_DISTANCE).toString())),this.positionGrips()},o.prototype.addControlGrips=function(){this.controlGrips.topLeft=this.createGrip(),this.controlGrips.topCenter=this.createGrip(),this.controlGrips.topRight=this.createGrip(),this.controlGrips.centerLeft=this.createGrip(),this.controlGrips.centerRight=this.createGrip(),this.controlGrips.bottomLeft=this.createGrip(),this.controlGrips.bottomCenter=this.createGrip(),this.controlGrips.bottomRight=this.createGrip(),this.globalSettings.disableRotation!==!0&&(this.rotatorGrip=this.createGrip()),this.positionGrips()},o.prototype.createGrip=function(){var d=new Be;return d.visual.transform.baseVal.appendItem(J.createTransform()),this.controlBox.appendChild(d.visual),d},o.prototype.positionGrips=function(){var d=this.controlGrips.topLeft.GRIP_SIZE,P=-d/2,F=P,I=(this.width+this.CB_DISTANCE)/2-d/2,Z=(this.height+this.CB_DISTANCE)/2-d/2,Te=this.height+this.CB_DISTANCE-d/2,Ne=this.width+this.CB_DISTANCE-d/2;this.positionGrip(this.controlGrips.topLeft.visual,P,F),this.positionGrip(this.controlGrips.topCenter.visual,I,F),this.positionGrip(this.controlGrips.topRight.visual,Ne,F),this.positionGrip(this.controlGrips.centerLeft.visual,P,Z),this.positionGrip(this.controlGrips.centerRight.visual,Ne,Z),this.positionGrip(this.controlGrips.bottomLeft.visual,P,Te),this.positionGrip(this.controlGrips.bottomCenter.visual,I,Te),this.positionGrip(this.controlGrips.bottomRight.visual,Ne,Te),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,I,F-3*this.CB_DISTANCE)},o.prototype.positionGrip=function(d,P,F){var I=d.transform.baseVal.getItem(0);I.setTranslate(P,F),d.transform.baseVal.replaceItem(I,0)},o.prototype.hideControlBox=function(){this.controlBox.style.display="none"},o.prototype.showControlBox=function(){this.controlBox.style.display=""},o.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:Ie.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:Ie.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},O.prototype.getState.call(this))},o.prototype.restoreState=function(d){O.prototype.restoreState.call(this,d);var P=d;this.left=P.left,this.top=P.top,this.width=P.width,this.height=P.height,this.rotationAngle=P.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(Ie.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,P.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(Ie.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,P.containerTransformMatrix))},o.prototype.scale=function(d,P){O.prototype.scale.call(this,d,P);var F=this.rotatePoint({x:this.left,y:this.top}),I=this.unrotatePoint({x:F.x*d,y:F.y*P});this.left=I.x,this.top=I.y,this.width=this.width*d,this.height=this.height*P,this.adjustControlBox()},o}(Ee),Me=function(O){function o(d,P,F){var I=O.call(this,d,P,F)||this;return I.fillColor="transparent",I.strokeColor="transparent",I.strokeWidth=0,I.strokeDasharray="",I.opacity=1,I.setStrokeColor=I.setStrokeColor.bind(I),I.setFillColor=I.setFillColor.bind(I),I.setStrokeWidth=I.setStrokeWidth.bind(I),I.setStrokeDasharray=I.setStrokeDasharray.bind(I),I.createVisual=I.createVisual.bind(I),I}return fe(o,O),o.prototype.ownsTarget=function(d){return!(!O.prototype.ownsTarget.call(this,d)&&d!==this.visual)},o.prototype.createVisual=function(){this.visual=J.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},o.prototype.pointerDown=function(d,P){O.prototype.pointerDown.call(this,d,P),this.state==="new"&&(this.createVisual(),this.moveVisual(d),this._state="creating")},o.prototype.manipulate=function(d){O.prototype.manipulate.call(this,d)},o.prototype.resize=function(d){O.prototype.resize.call(this,d),this.setSize()},o.prototype.setSize=function(){O.prototype.setSize.call(this),J.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},o.prototype.pointerUp=function(d){O.prototype.pointerUp.call(this,d),this.setSize()},o.prototype.setStrokeColor=function(d){this.strokeColor=d,this.visual&&J.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(d),this.stateChanged()},o.prototype.setFillColor=function(d){this.fillColor=d,this.visual&&J.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},o.prototype.setStrokeWidth=function(d){this.strokeWidth=d,this.visual&&J.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},o.prototype.setStrokeDasharray=function(d){this.strokeDasharray=d,this.visual&&J.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},o.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},O.prototype.getState.call(this))},o.prototype.restoreState=function(d){var P=d;this.fillColor=P.fillColor,this.strokeColor=P.strokeColor,this.strokeWidth=P.strokeWidth,this.strokeDasharray=P.strokeDasharray,this.opacity=P.opacity,this.createVisual(),O.prototype.restoreState.call(this,d),this.setSize()},o.prototype.scale=function(d,P){O.prototype.scale.call(this,d,P),this.setSize()},o.title="Rectangle marker",o}(ke),Ue=function(O){function o(d,P,F,I){var Z=O.call(this,d,I||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return Z.widths=[],Z.widthBoxes=[],Z.widths=P,Z.currentWidth=F,Z.setCurrentWidth=Z.setCurrentWidth.bind(Z),Z}return fe(o,O),o.prototype.getUi=function(){var d=this,P=document.createElement("div");return P.style.display="flex",P.style.overflow="hidden",P.style.flexGrow="2",this.widths.forEach(function(F){var I=document.createElement("div");I.style.display="flex",I.style.flexGrow="2",I.style.alignItems="center",I.style.justifyContent="space-between",I.style.padding="5px",I.style.borderWidth="2px",I.style.borderStyle="solid",I.style.borderColor=F===d.currentWidth?d.uiStyleSettings.toolboxAccentColor:"transparent",I.addEventListener("click",function(){d.setCurrentWidth(F,I)}),P.appendChild(I);var Z=document.createElement("div");Z.innerText=F.toString(),Z.style.marginRight="5px",I.appendChild(Z);var Te=document.createElement("div");Te.style.minHeight="20px",Te.style.flexGrow="2",Te.style.display="flex",Te.style.alignItems="center";var Ne=document.createElement("hr");Ne.style.minWidth="20px",Ne.style.border="0px",Ne.style.borderTop=F+"px solid "+d.uiStyleSettings.toolboxColor,Ne.style.flexGrow="2",Te.appendChild(Ne),I.appendChild(Te),d.widthBoxes.push(I)}),P},o.prototype.setCurrentWidth=function(d,P){var F=this;this.currentWidth=d,this.widthBoxes.forEach(function(I){I.style.borderColor=I===P?F.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},o}(be),Fe=function(O){function o(d,P,F,I){var Z=O.call(this,d,I||'<svg viewBox="0 0 24 24"><path d="M3 16h5v-2H3v2m6.5 0h5v-2h-5v2m6.5 0h5v-2h-5v2M3 20h2v-2H3v2m4 0h2v-2H7v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2M3 12h8v-2H3v2m10 0h8v-2h-8v2M3 4v4h18V4H3z"/></svg>')||this;return Z.styles=[],Z.styleBoxes=[],Z.styles=P,Z.currentStyle=F,Z.setCurrentStyle=Z.setCurrentStyle.bind(Z),Z}return fe(o,O),o.prototype.getUi=function(){var d=this,P=document.createElement("div");return P.style.display="flex",P.style.overflow="hidden",P.style.flexGrow="2",this.styles.forEach(function(F){var I=document.createElement("div");I.style.display="flex",I.style.alignItems="center",I.style.justifyContent="space-between",I.style.padding="5px",I.style.borderWidth="2px",I.style.borderStyle="solid",I.style.overflow="hidden",I.style.maxWidth=100/d.styles.length-5+"%",I.style.borderColor=F===d.currentStyle?d.uiStyleSettings.toolboxAccentColor:"transparent",I.addEventListener("click",function(){d.setCurrentStyle(F,I)}),P.appendChild(I);var Z=document.createElement("div");Z.style.minHeight="20px",Z.style.flexGrow="2",Z.style.overflow="hidden";var Te=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+d.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(F!==""?'stroke-dasharray="'+F+'"':"")+` />
</svg>`;Z.innerHTML=Te,I.appendChild(Z),d.styleBoxes.push(I)}),P},o.prototype.setCurrentStyle=function(d,P){var F=this;this.currentStyle=d,this.styleBoxes.forEach(function(I){I.style.borderColor=I===P?F.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},o}(be),je=function(O){function o(d,P,F){var I=O.call(this,d,P,F)||this;return I.strokeColor=F.defaultColor,I.strokeWidth=F.defaultStrokeWidth,I.strokeDasharray=F.defaultStrokeDasharray,I.strokePanel=new ve("Line color",F.defaultColorSet,F.defaultColor),I.strokePanel.onColorChanged=I.setStrokeColor,I.strokeWidthPanel=new Ue("Line width",F.defaultStrokeWidths,F.defaultStrokeWidth),I.strokeWidthPanel.onWidthChanged=I.setStrokeWidth,I.strokeStylePanel=new Fe("Line style",F.defaultStrokeDasharrays,F.defaultStrokeDasharray),I.strokeStylePanel.onStyleChanged=I.setStrokeDasharray,I}return fe(o,O),Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var d=O.prototype.getState.call(this);return d.typeName=o.typeName,d},o.typeName="FrameMarker",o.title="Frame marker",o.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',o}(Me),we=function(){this.defaultColorSet=["#EF4444","#10B981","#2563EB","#FFFF00","#7C3AED","#F472B6","#000000","#FFFFFF"],this.defaultColor=this.defaultColorSet[0],this.defaultFillColor=this.defaultColorSet[0],this.defaultStrokeColor=this.defaultColorSet[7],this.defaultHighlightColor=this.defaultColorSet[3],this.defaultStrokeWidth=3,this.defaultStrokeDasharray="",this.defaultHighlightOpacity=.5,this.defaultFontFamily="Helvetica, Arial, sans-serif",this.defaultStrokeWidths=[1,2,3,5,10],this.defaultStrokeDasharrays=["","3","12 3","9 6 3 6"],this.defaultOpacitySteps=[.1,.25,.5,.75,1],this.displayMode="inline",this.defaultFontFamilies=['Times, "Times New Roman", serif',"Helvetica, Arial, sans-serif",'Courier, "Courier New", monospace',"cursive","fantasy"],this.popupMargin=30,this.newFreehandMarkerOnPointerUp=!1,this.defaultColorsFollowCurrentColors=!1,this.freehandPixelRatio=1,this.disableRotation=!1},Oe=function(O){function o(d,P,F){var I=O.call(this,d,P,F)||this;return I.x1=0,I.y1=0,I.x2=0,I.y2=0,I.defaultLength=50,I.manipulationStartX=0,I.manipulationStartY=0,I.manipulationStartX1=0,I.manipulationStartY1=0,I.manipulationStartX2=0,I.manipulationStartY2=0,I.setupControlBox(),I}return fe(o,O),o.prototype.ownsTarget=function(d){return!!O.prototype.ownsTarget.call(this,d)||!(!this.grip1.ownsTarget(d)&&!this.grip2.ownsTarget(d))},o.prototype.pointerDown=function(d,P){O.prototype.pointerDown.call(this,d,P),this.manipulationStartX=d.x,this.manipulationStartY=d.y,this.state==="new"&&(this.x1=d.x,this.y1=d.y,this.x2=d.x,this.y2=d.y),this.manipulationStartX1=this.x1,this.manipulationStartY1=this.y1,this.manipulationStartX2=this.x2,this.manipulationStartY2=this.y2,this.state!=="new"&&(this.select(),this.grip1.ownsTarget(P)?this.activeGrip=this.grip1:this.grip2.ownsTarget(P)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},o.prototype.pointerUp=function(d){var P=this.state;O.prototype.pointerUp.call(this,d),this.state==="creating"&&Math.abs(this.x1-this.x2)<10&&Math.abs(this.y1-this.y2)<10?(this.x2=this.x1+this.defaultLength,this.adjustVisual(),this.adjustControlBox()):this.manipulate(d),this._state="select",P==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},o.prototype.adjustVisual=function(){},o.prototype.manipulate=function(d){this.state==="creating"?this.resize(d):this.state==="move"?(this.x1=this.manipulationStartX1+d.x-this.manipulationStartX,this.y1=this.manipulationStartY1+d.y-this.manipulationStartY,this.x2=this.manipulationStartX2+d.x-this.manipulationStartX,this.y2=this.manipulationStartY2+d.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(d)},o.prototype.resize=function(d){switch(this.activeGrip){case this.grip1:this.x1=d.x,this.y1=d.y;break;case this.grip2:case void 0:this.x2=d.x,this.y2=d.y}this.adjustVisual(),this.adjustControlBox()},o.prototype.select=function(){O.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},o.prototype.deselect=function(){O.prototype.deselect.call(this),this.controlBox.style.display="none"},o.prototype.setupControlBox=function(){this.controlBox=J.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},o.prototype.adjustControlBox=function(){this.positionGrips()},o.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},o.prototype.createGrip=function(){var d=new Be;return d.visual.transform.baseVal.appendItem(J.createTransform()),this.controlBox.appendChild(d.visual),d},o.prototype.positionGrips=function(){var d=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-d/2,this.y1-d/2),this.positionGrip(this.grip2.visual,this.x2-d/2,this.y2-d/2)},o.prototype.positionGrip=function(d,P,F){var I=d.transform.baseVal.getItem(0);I.setTranslate(P,F),d.transform.baseVal.replaceItem(I,0)},o.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},O.prototype.getState.call(this))},o.prototype.restoreState=function(d){O.prototype.restoreState.call(this,d);var P=d;this.x1=P.x1,this.y1=P.y1,this.x2=P.x2,this.y2=P.y2},o.prototype.scale=function(d,P){O.prototype.scale.call(this,d,P),this.x1=this.x1*d,this.y1=this.y1*P,this.x2=this.x2*d,this.y2=this.y2*P,this.adjustVisual(),this.adjustControlBox()},o}(Ee),_e=function(O){function o(d,P,F){var I=O.call(this,d,P,F)||this;return I.strokeColor="transparent",I.strokeWidth=0,I.strokeDasharray="",I.setStrokeColor=I.setStrokeColor.bind(I),I.setStrokeWidth=I.setStrokeWidth.bind(I),I.setStrokeDasharray=I.setStrokeDasharray.bind(I),I.strokeColor=F.defaultColor,I.strokeWidth=F.defaultStrokeWidth,I.strokeDasharray=F.defaultStrokeDasharray,I.strokePanel=new ve("Line color",F.defaultColorSet,F.defaultColor),I.strokePanel.onColorChanged=I.setStrokeColor,I.strokeWidthPanel=new Ue("Line width",F.defaultStrokeWidths,F.defaultStrokeWidth),I.strokeWidthPanel.onWidthChanged=I.setStrokeWidth,I.strokeStylePanel=new Fe("Line style",F.defaultStrokeDasharrays,F.defaultStrokeDasharray),I.strokeStylePanel.onStyleChanged=I.setStrokeDasharray,I}return fe(o,O),o.prototype.ownsTarget=function(d){return!(!O.prototype.ownsTarget.call(this,d)&&d!==this.visual&&d!==this.selectorLine&&d!==this.visibleLine)},o.prototype.createVisual=function(){this.visual=J.createGroup(),this.selectorLine=J.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=J.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},o.prototype.pointerDown=function(d,P){O.prototype.pointerDown.call(this,d,P),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},o.prototype.adjustVisual=function(){this.selectorLine&&this.visibleLine&&(this.selectorLine.setAttribute("x1",this.x1.toString()),this.selectorLine.setAttribute("y1",this.y1.toString()),this.selectorLine.setAttribute("x2",this.x2.toString()),this.selectorLine.setAttribute("y2",this.y2.toString()),this.visibleLine.setAttribute("x1",this.x1.toString()),this.visibleLine.setAttribute("y1",this.y1.toString()),this.visibleLine.setAttribute("x2",this.x2.toString()),this.visibleLine.setAttribute("y2",this.y2.toString()),J.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),J.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),J.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},o.prototype.setStrokeColor=function(d){this.strokeColor=d,this.adjustVisual(),this.colorChanged(d)},o.prototype.setStrokeWidth=function(d){this.strokeWidth=d,this.adjustVisual()},o.prototype.setStrokeDasharray=function(d){this.strokeDasharray=d,this.adjustVisual(),this.stateChanged()},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var d=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},O.prototype.getState.call(this));return d.typeName=o.typeName,d},o.prototype.restoreState=function(d){O.prototype.restoreState.call(this,d);var P=d;this.strokeColor=P.strokeColor,this.strokeWidth=P.strokeWidth,this.strokeDasharray=P.strokeDasharray,this.createVisual(),this.adjustVisual()},o.typeName="LineMarker",o.title="Line marker",o.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',o}(Oe),ge=function(O){function o(d,P,F,I){var Z=O.call(this,d,I||'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1l-3.5 7H18V9M5 3h5c1.11 0 2 .89 2 2v11H9v-5H6v5H3V5c0-1.11.89-2 2-2m1 2v4h3V5H6z"/></svg>')||this;return Z.fonts=[],Z.fontBoxes=[],Z.fonts=P,Z.currentFont=F,Z.setCurrentFont=Z.setCurrentFont.bind(Z),Z}return fe(o,O),o.prototype.getUi=function(){var d=this,P=document.createElement("div");return P.style.overflow="hidden",P.style.flexGrow="2",this.fonts.forEach(function(F){var I=document.createElement("div");I.style.display="inline-block",I.style.alignItems="center",I.style.justifyContent="space-between",I.style.padding="5px",I.style.borderWidth="2px",I.style.borderStyle="solid",I.style.overflow="hidden",I.style.maxWidth=100/d.fonts.length-5+"%",I.style.borderColor=F===d.currentFont?d.uiStyleSettings.toolboxAccentColor:"transparent",I.addEventListener("click",function(){d.setCurrentFont(F,I)}),P.appendChild(I);var Z=document.createElement("div");Z.style.display="flex",Z.style.minHeight="20px",Z.style.flexGrow="2",Z.style.fontFamily=F,Z.style.overflow="hidden";var Te=document.createElement("div");Te.style.whiteSpace="nowrap",Te.style.overflow="hidden",Te.style.textOverflow="ellipsis",Te.innerHTML="The quick brown fox jumps over the lazy dog",Z.appendChild(Te),I.appendChild(Z),d.fontBoxes.push(I)}),P},o.prototype.setCurrentFont=function(d,P){var F=this;this.currentFont=d,this.fontBoxes.forEach(function(I){I.style.borderColor=I===P?F.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},o}(be),De=function(O){function o(d,P,F){var I=O.call(this,d,P,F)||this;return I.color="transparent",I.padding=5,I.DEFAULT_TEXT="your text here",I.text=I.DEFAULT_TEXT,I.isMoved=!1,I.color=F.defaultColor,I.fontFamily=F.defaultFontFamily,I.defaultSize={x:100,y:30},I.setColor=I.setColor.bind(I),I.setFont=I.setFont.bind(I),I.renderText=I.renderText.bind(I),I.sizeText=I.sizeText.bind(I),I.textEditDivClicked=I.textEditDivClicked.bind(I),I.showTextEditor=I.showTextEditor.bind(I),I.setSize=I.setSize.bind(I),I.positionTextEditor=I.positionTextEditor.bind(I),I.colorPanel=new ve("Color",F.defaultColorSet,F.defaultColor),I.colorPanel.onColorChanged=I.setColor,I.fontFamilyPanel=new ge("Font",F.defaultFontFamilies,F.defaultFontFamily),I.fontFamilyPanel.onFontChanged=I.setFont,I}return fe(o,O),o.prototype.ownsTarget=function(d){if(O.prototype.ownsTarget.call(this,d)||d===this.visual||d===this.textElement||d===this.bgRectangle)return!0;var P=!1;return this.textElement.childNodes.forEach(function(F){F===d&&(P=!0)}),P},o.prototype.createVisual=function(){this.visual=J.createGroup(),this.bgRectangle=J.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=J.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(J.createTransform()),this.textElement.transform.baseVal.appendItem(J.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},o.prototype.pointerDown=function(d,P){O.prototype.pointerDown.call(this,d,P),this.isMoved=!1,this.pointerDownPoint=d,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(d),this._state="creating")},o.prototype.renderText=function(){var d=this;if(this.textElement){for(;this.textElement.lastChild;)this.textElement.removeChild(this.textElement.lastChild);this.text.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/).forEach(function(P){d.textElement.appendChild(J.createTSpan(P.trim()===""?" ":P.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},o.prototype.getTextScale=function(){var d=this.textElement.getBBox(),P=1;if(d.width>0&&d.height>0){var F=(1*this.width-this.width*this.padding*2/100)/d.width,I=(1*this.height-this.height*this.padding*2/100)/d.height;P=Math.min(F,I)}return P},o.prototype.getTextPosition=function(d){var P=this.textElement.getBBox(),F=0,I=0;return P.width>0&&P.height>0&&(F=(this.width-P.width*d)/2,I=this.height/2-P.height*d/2),{x:F,y:I}},o.prototype.sizeText=function(){var d=this.textElement.getBBox(),P=this.getTextScale(),F=this.getTextPosition(P);F.y-=d.y*P,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+F.x+"px, "+F.y+"px) scale("+P+", "+P+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(F.x,F.y),this.textElement.transform.baseVal.getItem(1).setScale(P,P))},o.prototype.manipulate=function(d){O.prototype.manipulate.call(this,d),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(d.x-this.pointerDownPoint.x)>5||Math.abs(d.y-this.pointerDownPoint.y)>5)},o.prototype.resize=function(d){O.prototype.resize.call(this,d),this.isMoved=!0,this.setSize(),this.sizeText()},o.prototype.setSize=function(){O.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(J.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),J.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},o.prototype.pointerUp=function(d){var P=this.state;P==="creating"&&(this._suppressMarkerCreateEvent=!0),O.prototype.pointerUp.call(this,d),this.setSize(),(P==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},o.prototype.showTextEditor=function(){var d=this;this._state="edit",this.overlayContainer.innerHTML="",this.textEditDiv=document.createElement("div"),this.textEditDiv.style.flexGrow="2",this.textEditDiv.style.alignItems="center",this.textEditDiv.style.justifyContent="center",this.textEditDiv.style.pointerEvents="auto",this.textEditDiv.style.overflow="hidden",this.textEditor=document.createElement("div"),this.textEditor.style.position="absolute",this.textEditor.style.fontFamily=this.fontFamily,this.textEditor.style.lineHeight="1em",this.textEditor.innerText=this.text,this.textEditor.contentEditable="true",this.textEditor.style.color=this.color,this.textEditor.style.whiteSpace="pre",this.positionTextEditor(),this.textEditor.addEventListener("pointerup",function(P){P.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var P=Number.parseFloat(d.textEditor.style.fontSize);d.textEditor.clientWidth>=Number.parseInt(d.textEditor.style.maxWidth)&&P>.9;)P-=.1,d.textEditor.style.fontSize=Math.max(P,.9)+"em"}),this.textEditor.addEventListener("keyup",function(P){P.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(P){if(P.clipboardData){var F=P.clipboardData.getData("text"),I=window.getSelection();if(!I.rangeCount)return!1;I.deleteFromDocument(),I.getRangeAt(0).insertNode(document.createTextNode(F)),P.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){d.textEditDivClicked(d.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},o.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var d=this.getTextScale(),P=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),F=this.textElement.getBBox(),I={x:F.width*d,y:F.height*d};P.x-=I.x/2,P.y-=I.y/2,this.textEditor.style.top=P.y+"px",this.textEditor.style.left=P.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-P.x+"px",this.textEditor.style.fontSize=Math.max(16*d,12)+"px",this.textElement.style.display="none"}},o.prototype.textEditDivClicked=function(d){this.text=d.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},o.prototype.select=function(){O.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},o.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),O.prototype.deselect.call(this)},o.prototype.dblClick=function(d,P){O.prototype.dblClick.call(this,d,P),this.showTextEditor()},o.prototype.setColor=function(d){this.textElement&&J.setAttributes(this.textElement,[["fill",d]]),this.color=d,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(d)},o.prototype.setFont=function(d){this.textElement&&J.setAttributes(this.textElement,[["font-family",d]]),this.fontFamily=d,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},o.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},o.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var d=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},O.prototype.getState.call(this));return d.typeName=o.typeName,d},o.prototype.restoreState=function(d){var P=d;this.color=P.color,this.fontFamily=P.fontFamily,this.padding=P.padding,this.text=P.text,this.createVisual(),O.prototype.restoreState.call(this,d),this.setSize()},o.prototype.scale=function(d,P){O.prototype.scale.call(this,d,P),this.setSize(),this.sizeText(),this.positionTextEditor()},o.typeName="TextMarker",o.title="Text marker",o.icon='<svg viewBox="0 0 24 24"><path d="M9.6 14L12 7.7l2.4 6.3M11 5L5.5 19h2.2l1.1-3H15l1.1 3h2.2L13 5h-2z"/></svg>',o}(ke),re=function(O){function o(d,P,F){var I=O.call(this,d,P,F)||this;return I.color="transparent",I.lineWidth=3,I.drawing=!1,I.pixelRatio=1,I.color=F.defaultColor,I.lineWidth=F.defaultStrokeWidth,I.pixelRatio=F.freehandPixelRatio,I.setColor=I.setColor.bind(I),I.addCanvas=I.addCanvas.bind(I),I.finishCreation=I.finishCreation.bind(I),I.setLineWidth=I.setLineWidth.bind(I),I.colorPanel=new ve("Color",F.defaultColorSet,F.defaultColor),I.colorPanel.onColorChanged=I.setColor,I.lineWidthPanel=new Ue("Line width",F.defaultStrokeWidths,F.defaultStrokeWidth),I.lineWidthPanel.onWidthChanged=I.setLineWidth,I}return fe(o,O),o.prototype.ownsTarget=function(d){return!(!O.prototype.ownsTarget.call(this,d)&&d!==this.visual&&d!==this.drawingImage)},o.prototype.createVisual=function(){this.visual=J.createGroup(),this.drawingImage=J.createImage(),this.visual.appendChild(this.drawingImage);var d=J.createTransform();this.visual.transform.baseVal.appendItem(d),this.addMarkerVisualToContainer(this.visual)},o.prototype.pointerDown=function(d,P){this.state==="new"&&(this.addCanvas(),this.createVisual(),this._state="creating"),this.state==="creating"?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(d.x,d.y),this.drawing=!0):O.prototype.pointerDown.call(this,d,P)},o.prototype.manipulate=function(d){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(d.x,d.y),this.canvasContext.stroke()):O.prototype.manipulate.call(this,d)},o.prototype.resize=function(d){O.prototype.resize.call(this,d),J.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),J.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},o.prototype.pointerUp=function(d){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):O.prototype.pointerUp.call(this,d)},o.prototype.addCanvas=function(){this.overlayContainer.innerHTML="",this.canvasElement=document.createElement("canvas"),this.canvasElement.width=this.overlayContainer.clientWidth*this.pixelRatio,this.canvasElement.height=this.overlayContainer.clientHeight*this.pixelRatio,this.canvasContext=this.canvasElement.getContext("2d"),this.canvasContext.scale(this.pixelRatio,this.pixelRatio),this.overlayContainer.appendChild(this.canvasElement)},o.prototype.select=function(){this.state==="creating"&&this.finishCreation(),O.prototype.select.call(this)},o.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),O.prototype.deselect.call(this)},o.prototype.finishCreation=function(){for(var d=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),P=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],F=P[0],I=P[1],Z=P[2],Te=P[3],Ne=!1,Ke=0;Ke<this.canvasElement.height;Ke++)for(var Se=0;Se<this.canvasElement.width;Se++)d.data[Ke*this.canvasElement.width*4+4*Se+3]>0&&(Ne=!0,Ke<I&&(I=Ke),Se<F&&(F=Se),Ke>Te&&(Te=Ke),Se>Z&&(Z=Se));if(Ne){this.left=F/this.pixelRatio,this.top=I/this.pixelRatio,this.width=(Z-F)/this.pixelRatio,this.height=(Te-I)/this.pixelRatio;var Qe=document.createElement("canvas");Qe.width=Z-F,Qe.height=Te-I,Qe.getContext("2d").putImageData(this.canvasContext.getImageData(F,I,Z-F,Te-I),0,0),this.drawingImgUrl=Qe.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},o.prototype.setDrawingImage=function(){J.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),J.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},o.prototype.setColor=function(d){this.color=d,this.colorChanged(d)},o.prototype.setLineWidth=function(d){this.lineWidth=d},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var d=Object.assign({drawingImgUrl:this.drawingImgUrl},O.prototype.getState.call(this));return d.typeName=o.typeName,d},o.prototype.restoreState=function(d){this.createVisual(),O.prototype.restoreState.call(this,d),this.drawingImgUrl=d.drawingImgUrl,this.setDrawingImage()},o.prototype.scale=function(d,P){O.prototype.scale.call(this,d,P),this.setDrawingImage()},o.typeName="FreehandMarker",o.title="Freehand marker",o.icon='<svg viewBox="0 0 24 24"><path d="M9.75 20.85c1.78-.7 1.39-2.63.49-3.85-.89-1.25-2.12-2.11-3.36-2.94A9.817 9.817 0 014.54 12c-.28-.33-.85-.94-.27-1.06.59-.12 1.61.46 2.13.68.91.38 1.81.82 2.65 1.34l1.01-1.7C8.5 10.23 6.5 9.32 4.64 9.05c-1.06-.16-2.18.06-2.54 1.21-.32.99.19 1.99.77 2.77 1.37 1.83 3.5 2.71 5.09 4.29.34.33.75.72.95 1.18.21.44.16.47-.31.47-1.24 0-2.79-.97-3.8-1.61l-1.01 1.7c1.53.94 4.09 2.41 5.96 1.79m11.09-15.6c.22-.22.22-.58 0-.79l-1.3-1.3a.562.562 0 00-.78 0l-1.02 1.02 2.08 2.08M11 10.92V13h2.08l6.15-6.15-2.08-2.08L11 10.92z"/></svg>',o}(ke),ee=function(O){function o(d,P,F){var I=O.call(this,d,F||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return I.typeBoxes=[],I.currentType=P,I.setCurrentType=I.setCurrentType.bind(I),I}return fe(o,O),o.prototype.getUi=function(){var d=this,P=document.createElement("div");P.style.display="flex",P.style.overflow="hidden",P.style.flexGrow="2";for(var F=function(Te){var Ne="both";switch(Te){case 0:Ne="both";break;case 1:Ne="start";break;case 2:Ne="end";break;case 3:Ne="none"}var Ke=document.createElement("div");if(Ke.style.display="flex",Ke.style.flexGrow="2",Ke.style.alignItems="center",Ke.style.justifyContent="space-between",Ke.style.padding="5px",Ke.style.borderWidth="2px",Ke.style.borderStyle="solid",Ke.style.borderColor=Ne===I.currentType?I.uiStyleSettings.toolboxAccentColor:"transparent",Ke.addEventListener("click",function(){d.setCurrentType(Ne,Ke)}),P.appendChild(Ke),Ne==="both"||Ne==="start"){var Se=document.createElement("div");Se.style.display="flex",Se.style.alignItems="center",Se.style.minHeight="20px",Se.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
<polygon points="0,5 10,0 10,10" fill="`+(I.uiStyleSettings!==void 0?I.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Se.style.marginLeft="5px",Ke.appendChild(Se)}var Qe=document.createElement("div");Qe.style.display="flex",Qe.style.alignItems="center",Qe.style.minHeight="20px",Qe.style.flexGrow="2";var it=document.createElement("hr");if(it.style.minWidth="20px",it.style.border="0px",it.style.borderTop="3px solid "+(I.uiStyleSettings!==void 0?I.uiStyleSettings.toolboxColor:"#eeeeee"),it.style.flexGrow="2",Qe.appendChild(it),Ke.appendChild(Qe),Ne==="both"||Ne==="end"){var ht=document.createElement("div");ht.style.display="flex",ht.style.alignItems="center",ht.style.minHeight="20px",ht.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
<polygon points="0,0 10,5 0,10" fill="`+(I.uiStyleSettings!==void 0?I.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,ht.style.marginRight="5px",Ke.appendChild(ht)}I.typeBoxes.push(Ke)},I=this,Z=0;Z<4;Z++)F(Z);return P},o.prototype.setCurrentType=function(d,P){var F=this;this.currentType=d,this.typeBoxes.forEach(function(I){I.style.borderColor=I===P?F.uiStyleSettings!==void 0?F.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},o}(be),te=function(O){function o(d,P,F){var I=O.call(this,d,P,F)||this;return I.arrowType="end",I.arrowBaseHeight=10,I.arrowBaseWidth=10,I.getArrowPoints=I.getArrowPoints.bind(I),I.setArrowType=I.setArrowType.bind(I),I.arrowTypePanel=new ee("Arrow type","end"),I.arrowTypePanel.onArrowTypeChanged=I.setArrowType,I}return fe(o,O),o.prototype.ownsTarget=function(d){return!(!O.prototype.ownsTarget.call(this,d)&&d!==this.arrow1&&d!==this.arrow2)},o.prototype.getArrowPoints=function(d,P){var F=this.arrowBaseWidth+2*this.strokeWidth,I=this.arrowBaseHeight+2*this.strokeWidth;return d-F/2+","+(P+I/2)+" "+d+","+(P-I/2)+" "+(d+F/2)+","+(P+I/2)},o.prototype.createTips=function(){this.arrow1=J.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(J.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=J.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(J.createTransform()),this.visual.appendChild(this.arrow2)},o.prototype.pointerDown=function(d,P){O.prototype.pointerDown.call(this,d,P),this.state==="creating"&&this.createTips()},o.prototype.adjustVisual=function(){if(O.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display=this.arrowType==="both"||this.arrowType==="start"?"":"none",this.arrow2.style.display=this.arrowType==="both"||this.arrowType==="end"?"":"none",J.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),J.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var d=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),P=this.arrow1.transform.baseVal.getItem(0);P.setRotate(d,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(P,0);var F=this.arrow2.transform.baseVal.getItem(0);F.setRotate(d+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(F,0)}},o.prototype.setArrowType=function(d){this.arrowType=d,this.adjustVisual(),this.stateChanged()},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var d=Object.assign({arrowType:this.arrowType},O.prototype.getState.call(this));return d.typeName=o.typeName,d},o.prototype.restoreState=function(d){O.prototype.restoreState.call(this,d);var P=d;this.arrowType=P.arrowType,this.createTips(),this.adjustVisual()},o.typeName="ArrowMarker",o.title="Arrow marker",o.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',o}(_e),W=function(O){function o(d,P,F){var I=O.call(this,d,P,F)||this;return I.fillColor=F.defaultFillColor,I.strokeWidth=0,I.fillPanel=new ve("Color",F.defaultColorSet,F.defaultFillColor),I.fillPanel.onColorChanged=I.setFillColor,I}return fe(o,O),Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var d=O.prototype.getState.call(this);return d.typeName=o.typeName,d},o.typeName="CoverMarker",o.title="Cover marker",o.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',o}(Me),G=function(O){function o(d,P,F,I){var Z=O.call(this,d,I||'<svg viewBox="0 0 24 24"><path d="M17.66 8L12 2.35 6.34 8A8.02 8.02 0 004 13.64c0 2 .78 4.11 2.34 5.67a7.99 7.99 0 0011.32 0c1.56-1.56 2.34-3.67 2.34-5.67S19.22 9.56 17.66 8M6 14c0-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 18 12 18 14H6z"/></svg>')||this;return Z.opacities=[],Z.opacityBoxes=[],Z.opacities=P,Z.currentOpacity=F,Z.setCurrentOpacity=Z.setCurrentOpacity.bind(Z),Z}return fe(o,O),o.prototype.getUi=function(){var d=this,P=document.createElement("div");return P.style.display="flex",P.style.overflow="hidden",P.style.flexGrow="2",P.style.justifyContent="space-between",this.opacities.forEach(function(F){var I=document.createElement("div");I.style.display="flex",I.style.alignItems="center",I.style.justifyContent="center",I.style.padding="5px",I.style.borderWidth="2px",I.style.borderStyle="solid",I.style.borderColor=F===d.currentOpacity?d.uiStyleSettings.toolboxAccentColor:"transparent",I.addEventListener("click",function(){d.setCurrentOpacity(F,I)}),P.appendChild(I);var Z=document.createElement("div");Z.innerText=100*F+"%",I.appendChild(Z),d.opacityBoxes.push(I)}),P},o.prototype.setCurrentOpacity=function(d,P){var F=this;this.currentOpacity=d,this.opacityBoxes.forEach(function(I){I.style.borderColor=I===P?F.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},o}(be),Y=function(O){function o(d,P,F){var I=O.call(this,d,P,F)||this;return I.setOpacity=I.setOpacity.bind(I),I.fillColor=F.defaultHighlightColor,I.strokeWidth=0,I.opacity=F.defaultHighlightOpacity,I.fillPanel=new ve("Color",F.defaultColorSet,I.fillColor),I.fillPanel.onColorChanged=I.setFillColor,I.opacityPanel=new G("Opacity",F.defaultOpacitySteps,I.opacity),I.opacityPanel.onOpacityChanged=I.setOpacity,I}return fe(o,O),o.prototype.setOpacity=function(d){this.opacity=d,this.visual&&J.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var d=O.prototype.getState.call(this);return d.typeName=o.typeName,d},o.typeName="HighlightMarker",o.title="Highlight marker",o.icon='<svg viewBox="0 0 24 24"><path d="M18.5 1.15c-.53 0-1.04.19-1.43.58l-5.81 5.82 5.65 5.65 5.82-5.81c.77-.78.77-2.04 0-2.83l-2.84-2.83c-.39-.39-.89-.58-1.39-.58M10.3 8.5l-5.96 5.96c-.78.78-.78 2.04.02 2.85C3.14 18.54 1.9 19.77.67 21h5.66l.86-.86c.78.76 2.03.75 2.81-.02l5.95-5.96"/></svg>',o}(W),q='<svg viewBox="0 0 24 24"><path d="M19 11.5s-2 2.17-2 3.5a2 2 0 002 2 2 2 0 002-2c0-1.33-2-3.5-2-3.5M5.21 10L10 5.21 14.79 10m1.77-1.06L7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.56-.59 1.53 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.59.59-1.56 0-2.12z"/></svg>',ue=function(O){function o(d,P,F){var I=O.call(this,d,P,F)||this;return I.bgColor="transparent",I.tipPosition={x:0,y:0},I.tipBase1Position={x:0,y:0},I.tipBase2Position={x:0,y:0},I.tipMoving=!1,I.color=F.defaultStrokeColor,I.bgColor=F.defaultFillColor,I.fontFamily=F.defaultFontFamily,I.defaultSize={x:100,y:30},I.setBgColor=I.setBgColor.bind(I),I.getTipPoints=I.getTipPoints.bind(I),I.positionTip=I.positionTip.bind(I),I.setTipPoints=I.setTipPoints.bind(I),I.colorPanel=new ve("Text color",F.defaultColorSet,I.color,'<svg viewBox="0 0 24 24"><path d="M9.62 12L12 5.67 14.37 12M11 3L5.5 17h2.25l1.12-3h6.25l1.13 3h2.25L13 3h-2z"/></svg>'),I.colorPanel.onColorChanged=I.setColor,I.bgColorPanel=new ve("Fill color",F.defaultColorSet,I.bgColor,q),I.bgColorPanel.onColorChanged=I.setBgColor,I.fontFamilyPanel=new ge("Font",F.defaultFontFamilies,F.defaultFontFamily),I.fontFamilyPanel.onFontChanged=I.setFont,I.tipGrip=new Be,I.tipGrip.visual.transform.baseVal.appendItem(J.createTransform()),I.controlBox.appendChild(I.tipGrip.visual),I}return fe(o,O),o.prototype.ownsTarget=function(d){return O.prototype.ownsTarget.call(this,d)||this.tipGrip.ownsTarget(d)||this.tip===d},o.prototype.createTip=function(){J.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=J.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},o.prototype.pointerDown=function(d,P){this.state==="new"&&O.prototype.pointerDown.call(this,d,P),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(P)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):O.prototype.pointerDown.call(this,d,P)},o.prototype.pointerUp=function(d){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,O.prototype.pointerUp.call(this,d);else{var P=this.state==="creating";O.prototype.pointerUp.call(this,d),this.setTipPoints(P),this.positionTip()}},o.prototype.manipulate=function(d){if(this.tipMoving){var P=this.unrotatePoint(d);this.tipPosition={x:P.x-this.manipulationStartLeft,y:P.y-this.manipulationStartTop},this.positionTip()}else O.prototype.manipulate.call(this,d)},o.prototype.setBgColor=function(d){this.bgRectangle&&this.tip&&(J.setAttributes(this.bgRectangle,[["fill",d]]),J.setAttributes(this.tip,[["fill",d]])),this.bgColor=d,this.fillColorChanged(d)},o.prototype.getTipPoints=function(){return this.setTipPoints(this.state==="creating"),this.tipBase1Position.x+","+this.tipBase1Position.y+" "+this.tipBase2Position.x+","+this.tipBase2Position.y+" "+this.tipPosition.x+","+this.tipPosition.y},o.prototype.setTipPoints=function(d){d===void 0&&(d=!1);var P=Math.min(this.height/2,15),F=this.height/5;d&&(this.tipPosition={x:P+F/2,y:this.height+20});var I=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?I<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(F=this.width/5,P=Math.min(this.width/2,15),this.tipBase1Position={x:P,y:0},this.tipBase2Position={x:P+F,y:0}):(this.tipBase1Position={x:0,y:P},this.tipBase2Position={x:0,y:P+F}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?I<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(F=this.width/5,P=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-P-F,y:0},this.tipBase2Position={x:this.width-P,y:0}):(this.tipBase1Position={x:this.width,y:P},this.tipBase2Position={x:this.width,y:P+F}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?I<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(F=this.width/5,P=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-P-F,y:this.height},this.tipBase2Position={x:this.width-P,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-P-F},this.tipBase2Position={x:this.width,y:this.height-P}):I<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(F=this.width/5,P=Math.min(this.width/2,15),this.tipBase1Position={x:P,y:this.height},this.tipBase2Position={x:P+F,y:this.height}):(this.tipBase1Position={x:0,y:this.height-P},this.tipBase2Position={x:0,y:this.height-P-F})},o.prototype.resize=function(d){O.prototype.resize.call(this,d),this.positionTip()},o.prototype.positionTip=function(){J.setAttributes(this.tip,[["points",this.getTipPoints()]]);var d=this.tipGrip.visual.transform.baseVal.getItem(0);d.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(d,0)},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),o.prototype.select=function(){this.positionTip(),O.prototype.select.call(this)},o.prototype.getState=function(){var d=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},O.prototype.getState.call(this));return d.typeName=o.typeName,d},o.prototype.restoreState=function(d){var P=d;this.bgColor=P.bgColor,this.tipPosition=P.tipPosition,O.prototype.restoreState.call(this,d),this.createTip(),this.setTipPoints()},o.prototype.scale=function(d,P){O.prototype.scale.call(this,d,P),this.tipPosition={x:this.tipPosition.x*d,y:this.tipPosition.y*P},this.positionTip()},o.typeName="CalloutMarker",o.title="Callout marker",o.icon='<svg viewBox="0 0 24 24"><path d="M4 2h16a2 2 0 012 2v12a2 2 0 01-2 2h-4l-4 4-4-4H4a2 2 0 01-2-2V4a2 2 0 012-2m0 2v12h4.83L12 19.17 15.17 16H20V4H4m2 3h12v2H6V7m0 4h10v2H6v-2z"/></svg>',o}(De),ce=function(O){function o(d,P,F){var I=O.call(this,d,P,F)||this;return I.fillColor="transparent",I.strokeColor="transparent",I.strokeWidth=0,I.strokeDasharray="",I.opacity=1,I.strokeColor=F.defaultColor,I.strokeWidth=F.defaultStrokeWidth,I.strokeDasharray=F.defaultStrokeDasharray,I.fillColor=F.defaultFillColor,I.setStrokeColor=I.setStrokeColor.bind(I),I.setFillColor=I.setFillColor.bind(I),I.setStrokeWidth=I.setStrokeWidth.bind(I),I.setStrokeDasharray=I.setStrokeDasharray.bind(I),I.setOpacity=I.setOpacity.bind(I),I.createVisual=I.createVisual.bind(I),I.strokePanel=new ve("Line color",ie(F.defaultColorSet,["transparent"]),F.defaultColor),I.strokePanel.onColorChanged=I.setStrokeColor,I.fillPanel=new ve("Fill color",ie(F.defaultColorSet,["transparent"]),I.fillColor,q),I.fillPanel.onColorChanged=I.setFillColor,I.strokeWidthPanel=new Ue("Line width",F.defaultStrokeWidths,F.defaultStrokeWidth),I.strokeWidthPanel.onWidthChanged=I.setStrokeWidth,I.strokeStylePanel=new Fe("Line style",F.defaultStrokeDasharrays,F.defaultStrokeDasharray),I.strokeStylePanel.onStyleChanged=I.setStrokeDasharray,I.opacityPanel=new G("Opacity",F.defaultOpacitySteps,I.opacity),I.opacityPanel.onOpacityChanged=I.setOpacity,I}return fe(o,O),o.prototype.ownsTarget=function(d){return!(!O.prototype.ownsTarget.call(this,d)&&d!==this.visual)},o.prototype.createVisual=function(){this.visual=J.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},o.prototype.pointerDown=function(d,P){O.prototype.pointerDown.call(this,d,P),this.state==="new"&&(this.createVisual(),this.moveVisual(d),this._state="creating")},o.prototype.manipulate=function(d){O.prototype.manipulate.call(this,d)},o.prototype.resize=function(d){O.prototype.resize.call(this,d),this.setSize()},o.prototype.setSize=function(){O.prototype.setSize.call(this),J.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},o.prototype.pointerUp=function(d){O.prototype.pointerUp.call(this,d),this.setSize()},o.prototype.setStrokeColor=function(d){this.strokeColor=d,this.visual&&J.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(d),this.stateChanged()},o.prototype.setFillColor=function(d){this.fillColor=d,this.visual&&J.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(d),this.stateChanged()},o.prototype.setStrokeWidth=function(d){this.strokeWidth=d,this.visual&&J.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},o.prototype.setStrokeDasharray=function(d){this.strokeDasharray=d,this.visual&&J.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},o.prototype.setOpacity=function(d){this.opacity=d,this.visual&&J.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var d=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},O.prototype.getState.call(this));return d.typeName=o.typeName,d},o.prototype.restoreState=function(d){var P=d;this.fillColor=P.fillColor,this.strokeColor=P.strokeColor,this.strokeWidth=P.strokeWidth,this.strokeDasharray=P.strokeDasharray,this.opacity=P.opacity,this.createVisual(),O.prototype.restoreState.call(this,d),this.setSize()},o.prototype.scale=function(d,P){O.prototype.scale.call(this,d,P),this.setSize()},o.typeName="EllipseMarker",o.title="Ellipse marker",o.icon='<svg viewBox="0 0 24 24"><path d="M12 4C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',o}(ke),Ae=function(O){function o(d,P,F){return O.call(this,d,P,F)||this}return fe(o,O),Object.defineProperty(o.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),o.prototype.ownsTarget=function(d){return!(!O.prototype.ownsTarget.call(this,d)&&d!==this.tip1&&d!==this.tip2)},o.prototype.createTips=function(){this.tip1=J.createLine(this.x1-this.tipLength/2,this.y1,this.x1+this.tipLength/2,this.y1,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip1.transform.baseVal.appendItem(J.createTransform()),this.visual.appendChild(this.tip1),this.tip2=J.createLine(this.x2-this.tipLength/2,this.y2,this.x2+this.tipLength/2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip2.transform.baseVal.appendItem(J.createTransform()),this.visual.appendChild(this.tip2)},o.prototype.pointerDown=function(d,P){O.prototype.pointerDown.call(this,d,P),this.state==="creating"&&this.createTips()},o.prototype.adjustVisual=function(){if(O.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(J.setAttributes(this.tip1,[["x1",(this.x1-this.tipLength/2).toString()],["y1",this.y1.toString()],["x2",(this.x1+this.tipLength/2).toString()],["y2",this.y1.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),J.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var d=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),P=this.tip1.transform.baseVal.getItem(0);P.setRotate(d,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(P,0);var F=this.tip2.transform.baseVal.getItem(0);F.setRotate(d+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(F,0)}},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var d=O.prototype.getState.call(this);return d.typeName=o.typeName,d},o.prototype.restoreState=function(d){O.prototype.restoreState.call(this,d),this.createTips(),this.adjustVisual()},o.typeName="MeasurementMarker",o.title="Measurement marker",o.icon='<svg viewBox="0 0 24 24"><path d="M1.39 18.36l1.77-1.76L4.58 18l1.06-1.05-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.42 1.41L10.59 12l-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.41 1.41 1.07-1.06-1.42-1.41 1.42-1.42L18 6.7l1.07-1.06-2.47-2.48 1.76-1.77 4.25 4.25L5.64 22.61l-4.25-4.25z"/></svg>',o}(_e),Ge=function(O){function o(d,P,F){var I=O.call(this,d,P,F)||this;return I.strokePanel.colors=F.defaultColorSet,I.fillColor="transparent",I}return fe(o,O),Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var d=O.prototype.getState.call(this);return d.typeName=o.typeName,d},o.typeName="EllipseFrameMarker",o.title="Ellipse frame marker",o.icon='<svg viewBox="0 0 24 24"><path d="M12 6c4.41 0 8 2.69 8 6s-3.59 6-8 6-8-2.69-8-6 3.59-6 8-6m0-2C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',o}(ce),Xe=function(){function O(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(O.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),O.prototype.addUndoStep=function(o){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(o)||(this.undoStack.push(o),JSON.stringify(this.lastRedoStep)!==JSON.stringify(o)&&this.redoStack.splice(0,this.redoStack.length))},O.prototype.replaceLastUndoStep=function(o){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=o)},O.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},O.prototype.undo=function(){if(this.undoStack.length>1){var o=this.undoStack.pop();return o!==void 0&&this.redoStack.push(o),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},O.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},O}(),He=function(O){function o(d,P,F){var I=O.call(this,d,P,F)||this;return I.strokeColor="transparent",I.strokeWidth=0,I.strokeDasharray="",I.curveX=0,I.curveY=0,I.manipulationStartCurveX=0,I.manipulationStartCurveY=0,I.setStrokeColor=I.setStrokeColor.bind(I),I.setStrokeWidth=I.setStrokeWidth.bind(I),I.setStrokeDasharray=I.setStrokeDasharray.bind(I),I.positionGrips=I.positionGrips.bind(I),I.addControlGrips=I.addControlGrips.bind(I),I.adjustVisual=I.adjustVisual.bind(I),I.setupControlBox=I.setupControlBox.bind(I),I.resize=I.resize.bind(I),I.strokeColor=F.defaultColor,I.strokeWidth=F.defaultStrokeWidth,I.strokeDasharray=F.defaultStrokeDasharray,I.strokePanel=new ve("Line color",F.defaultColorSet,F.defaultColor),I.strokePanel.onColorChanged=I.setStrokeColor,I.strokeWidthPanel=new Ue("Line width",F.defaultStrokeWidths,F.defaultStrokeWidth),I.strokeWidthPanel.onWidthChanged=I.setStrokeWidth,I.strokeStylePanel=new Fe("Line style",F.defaultStrokeDasharrays,F.defaultStrokeDasharray),I.strokeStylePanel.onStyleChanged=I.setStrokeDasharray,I}return fe(o,O),o.prototype.ownsTarget=function(d){return!(!O.prototype.ownsTarget.call(this,d)&&d!==this.visual&&d!==this.selectorCurve&&d!==this.visibleCurve&&!this.curveGrip.ownsTarget(d))},o.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},o.prototype.createVisual=function(){this.visual=J.createGroup(),this.selectorCurve=J.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=J.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},o.prototype.pointerDown=function(d,P){O.prototype.pointerDown.call(this,d,P),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=d.x,this.curveY=d.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(P)&&(this.activeGrip=this.curveGrip,this._state="resize")},o.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),J.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),J.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),J.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},o.prototype.setupControlBox=function(){O.prototype.setupControlBox.call(this),this.curveControlLine1=J.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=J.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},o.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,O.prototype.addControlGrips.call(this)},o.prototype.positionGrips=function(){O.prototype.positionGrips.call(this);var d=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-d/2,this.curveY-d/2),this.curveControlLine1&&this.curveControlLine2&&(this.curveControlLine1.setAttribute("x1",this.x1.toString()),this.curveControlLine1.setAttribute("y1",this.y1.toString()),this.curveControlLine1.setAttribute("x2",this.curveX.toString()),this.curveControlLine1.setAttribute("y2",this.curveY.toString()),this.curveControlLine2.setAttribute("x1",this.x2.toString()),this.curveControlLine2.setAttribute("y1",this.y2.toString()),this.curveControlLine2.setAttribute("x2",this.curveX.toString()),this.curveControlLine2.setAttribute("y2",this.curveY.toString()))},o.prototype.manipulate=function(d){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+d.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+d.y-this.manipulationStartY),O.prototype.manipulate.call(this,d)},o.prototype.resize=function(d){this.activeGrip===this.curveGrip&&(this.curveX=d.x,this.curveY=d.y),O.prototype.resize.call(this,d),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},o.prototype.setStrokeColor=function(d){this.strokeColor=d,this.adjustVisual(),this.colorChanged(d)},o.prototype.setStrokeWidth=function(d){this.strokeWidth=d,this.adjustVisual()},o.prototype.setStrokeDasharray=function(d){this.strokeDasharray=d,this.adjustVisual()},o.prototype.scale=function(d,P){this.curveX=this.curveX*d,this.curveY=this.curveY*P,O.prototype.scale.call(this,d,P)},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var d=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},O.prototype.getState.call(this));return d.typeName=o.typeName,d},o.prototype.restoreState=function(d){O.prototype.restoreState.call(this,d);var P=d;this.strokeColor=P.strokeColor,this.strokeWidth=P.strokeWidth,this.strokeDasharray=P.strokeDasharray,this.curveX=P.curveX,this.curveY=P.curveY,this.createVisual(),this.adjustVisual()},o.typeName="CurveMarker",o.title="Curve marker",o.icon='<svg viewBox="0 0 24 24"><path d="M18.5 2A1.5 1.5 0 0120 3.5 1.5 1.5 0 0118.5 5c-.23 0-.45-.05-.65-.15l-3.69 3.7.34.45c2.19-1.26 4.76-2 7.5-2l1 .03v2.01L22 9c-2.58 0-5 .75-7 2.04A3.96 3.96 0 0111.04 15C9.75 17 9 19.42 9 22l.04 1H7.03L7 22c0-2.74.74-5.31 2-7.5l-.45-.34-3.7 3.69c.1.2.15.42.15.65A1.5 1.5 0 013.5 20 1.5 1.5 0 012 18.5 1.5 1.5 0 013.5 17c.23 0 .45.05.65.15l3.69-3.7C7.31 12.78 7 11.92 7 11a4 4 0 014-4c.92 0 1.78.31 2.45.84l3.7-3.69c-.1-.2-.15-.42-.15-.65A1.5 1.5 0 0118.5 2M11 9a2 2 0 00-2 2 2 2 0 002 2 2 2 0 002-2 2 2 0 00-2-2z"/></svg>',o}(Oe),Je=function(){function O(o,d){d===void 0&&(d=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=o,this.cancelable=d}return Object.defineProperty(O.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),O.prototype.preventDefault=function(){this._defaultPrevented=!0},O}(),qe=function(O){function o(d,P,F){var I=O.call(this,d,!1)||this;return I.dataUrl=P,I.state=F,I}return fe(o,O),o}(Je),ze=function(O){function o(d,P,F){F===void 0&&(F=!1);var I=O.call(this,d,F)||this;return I.marker=P,I}return fe(o,O),o}(Je),nt=function(){function O(){this.render=[],this.beforeclose=[],this.close=[],this.show=[],this.restorestate=[],this.statechange=[],this.markerselect=[],this.markerdeselect=[],this.markercreating=[],this.markercreate=[],this.markerbeforedelete=[],this.markerdelete=[],this.markerchange=[],this.focus=[],this.blur=[]}return O.prototype.addEventListener=function(o,d){this[o].push(d)},O.prototype.removeEventListener=function(o,d){var P=this[o].indexOf(d);P>-1&&this[o].splice(P,1)},O}(),lt=function(){function O(o){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new we,this._isOpen=!1,this.undoRedoManager=new Xe,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.renderMarkersOnly=!1,this.zoomSteps=[1,1.5,2,4],this._zoomLevel=1,this._isResizing=!1,this.prevPanPoint={x:0,y:0},this.eventListeners=new nt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=O.instanceCounter++,this.styles=new Re(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=o,this.targetRoot=document.body,this.width=o.clientWidth,this.height=o.clientHeight,this.styles.removeStyleSheet(),this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.toolbarButtonClicked=this.toolbarButtonClicked.bind(this),this.createNewMarker=this.createNewMarker.bind(this),this.addNewMarker=this.addNewMarker.bind(this),this.markerCreated=this.markerCreated.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onDblClick=this.onDblClick.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOut=this.onPointerOut.bind(this),this.onKeyUp=this.onKeyUp.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.deleteSelectedMarker=this.deleteSelectedMarker.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.removeMarker=this.removeMarker.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this),this.onPopupTargetResize=this.onPopupTargetResize.bind(this),this.showNotesEditor=this.showNotesEditor.bind(this),this.hideNotesEditor=this.hideNotesEditor.bind(this),this.stepZoom=this.stepZoom.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.markerStateChanged=this.markerStateChanged.bind(this),this.switchToSelectMode=this.switchToSelectMode.bind(this),this.addDefs=this.addDefs.bind(this),this.addDefsToImage=this.addDefsToImage.bind(this)}return Object.defineProperty(O.prototype,"ALL_MARKER_TYPES",{get:function(){return[je,re,te,De,Ge,ce,Y,ue,Ae,W,_e,He]},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[je,re,te,De,ce,Y,ue]},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"BASIC_MARKER_TYPES",{get:function(){return[je,re,te,De,Y]},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(o){var d=this;this._availableMarkerTypes.splice(0),o.forEach(function(P){if(typeof P=="string"){var F=d.ALL_MARKER_TYPES.find(function(I){return I.typeName===P});F!==void 0&&d._availableMarkerTypes.push(F)}else d._availableMarkerTypes.push(P)})},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(o){this._zoomLevel=o,this.editorCanvas&&this.contentDiv&&(this.editorCanvas.style.transform="scale("+this._zoomLevel+")",this.contentDiv.scrollTo({left:(this.editorCanvas.clientWidth*this._zoomLevel-this.contentDiv.clientWidth)/2,top:(this.editorCanvas.clientHeight*this._zoomLevel-this.contentDiv.clientHeight)/2}))},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),O.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),ye.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},O.prototype.show=function(){var o=this;this.styles.styleSheetRoot===void 0&&Le.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=Le.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(d){return d(new Je(o))})},O.prototype.render=function(){return pe(this,void 0,void 0,function(){var o;return me(this,function(d){switch(d.label){case 0:return this.setCurrentMarker(),(o=new Pe).naturalSize=this.renderAtNaturalSize,o.imageType=this.renderImageType,o.imageQuality=this.renderImageQuality,o.markersOnly=this.renderMarkersOnly,o.width=this.renderWidth,o.height=this.renderHeight,[4,o.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return d.sent(),[4,o.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,d.sent()]}})})},O.prototype.close=function(o){var d=this;if(o===void 0&&(o=!1),this.isOpen){var P=!1;o||this.eventListeners.beforeclose.forEach(function(F){var I=new Je(d,!0);F(I),I.defaultPrevented&&(P=!0)}),P||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.settings.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach(function(F){return F(new Je(d))}),this.detachEvents(),this._isOpen=!1)}},O.prototype.addMarkersToToolbar=function(){for(var o,d=[],P=0;P<arguments.length;P++)d[P]=arguments[P];(o=this._availableMarkerTypes).push.apply(o,d)},O.prototype.addRenderEventListener=function(o){this.addEventListener("render",function(d){o(d.dataUrl,d.state)})},O.prototype.removeRenderEventListener=function(o){},O.prototype.addCloseEventListener=function(o){this.addEventListener("close",function(){o()})},O.prototype.removeCloseEventListener=function(o){},O.prototype.setupResizeObserver=function(){var o=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){o.resize(o.target.clientWidth,o.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return o.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},O.prototype.onPopupTargetResize=function(){var o=1*this.target.clientWidth/this.target.clientHeight,d=this.editorCanvas.clientWidth/o>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*o:this.editorCanvas.clientWidth,P=d<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/o;this.resize(d,P)},O.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},O.prototype.resize=function(o,d){this._isResizing=!0;var P=o/this.imageWidth,F=d/this.imageHeight;this.imageWidth=Math.round(o),this.imageHeight=Math.round(d),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px",this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.settings.displayMode!=="popup"?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),this.toolbar!==void 0&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(P,F),this._isResizing=!1},O.prototype.scaleMarkers=function(o,d){var P,F=this;this._currentMarker&&this._currentMarker instanceof De?this._currentMarker.scale(o,d):(P=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(I){I!==F._currentMarker&&I.scale(o,d)}),P!==void 0&&this.setCurrentMarker(P)},O.prototype.setEditingTarget=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px"},O.prototype.setTopLeft=function(){var o=this.editingTarget.getBoundingClientRect(),d=this.editorCanvas.getBoundingClientRect();this.left=o.left-d.left,this.top=o.top-d.top},O.prototype.initMarkerCanvas=function(){this.markerImageHolder=document.createElement("div"),this.markerImageHolder.style.setProperty("touch-action","pinch-zoom"),this.markerImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.markerImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImage.style.pointerEvents="auto",this.markerImageHolder.style.position="absolute",this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.markerImageHolder.style.transformOrigin="top left",this.positionMarkerImage(),this.markerImageHolder.appendChild(this.markerImage),this.editorCanvas.appendChild(this.markerImageHolder)},O.prototype.addDefs=function(){for(var o,d=[],P=0;P<arguments.length;P++)d[P]=arguments[P];this.defs=J.createDefs(),this.addDefsToImage(),(o=this.defs).append.apply(o,d)},O.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},O.prototype.initOverlay=function(){this.overlayContainer=document.createElement("div"),this.overlayContainer.style.position="absolute",this.overlayContainer.style.left="0px",this.overlayContainer.style.top="0px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.overlayContainer.style.display="flex",this.markerImageHolder.appendChild(this.overlayContainer)},O.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},O.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},O.prototype.attachWindowEvents=function(){window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp),window.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("pointerout",this.onPointerOut),window.addEventListener("pointerleave",this.onPointerUp),window.addEventListener("resize",this.onWindowResize),window.addEventListener("keyup",this.onKeyUp)},O.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},O.prototype.detachWindowEvents=function(){window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("pointerout",this.onPointerOut),window.removeEventListener("pointerleave",this.onPointerUp),window.removeEventListener("resize",this.onWindowResize),window.removeEventListener("keyup",this.onKeyUp)},O.prototype.addLogo=function(){this.logoUI=document.createElement("div"),this.logoUI.style.display="inline-block",this.logoUI.style.margin="0px",this.logoUI.style.padding="0px",this.logoUI.style.fill="#333333";var o=document.createElement("a");o.href="https://markerjs.com/",o.target="_blank",o.innerHTML='<svg viewBox="0 0 112 96" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path fill="#e5f20d" fill-opacity=".647" d="M0 40.386h111.96V95.62H0z"/><path d="M93.61 61.452c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.591 1.048-1.481 0-2.222-.74-2.222-2.22 0-16.617-.533-29.347-1.604-38.192-1.068-8.842-2.92-13.265-5.552-13.265-4.443 0-10.94 15.509-19.497 46.52v.124c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.592 1.048-1.48 0-2.22-.74-2.22-2.22 0-3.29.165-8.392.493-15.302.33-7.732.494-13.82.494-18.262 0-6.17-.186-10.55-.556-13.142-.37-2.591-1.172-3.887-2.406-3.887-2.796 0-6.333 5.12-10.612 15.363C38.494 34.367 34.01 46.44 29.32 60.34l-1.11 3.209a5.714 5.714 0 01-1.42 2.097c-.617.578-1.295.864-2.036.864-.987 0-1.644-.081-1.974-.247-.328-.162-.533-.656-.617-1.48-.41-4.03-.74-9.418-.987-16.165-.163-1.728-.329-4.566-.494-8.515-.822-13.901-1.562-23.3-2.221-28.196-.657-4.893-.987-7.628-.987-8.205 0-.657.33-1.44.987-2.345.659-.903 1.276-1.357 1.85-1.357 1.319 0 2.387.947 3.21 2.838.411.906.863 4.526 1.357 10.859.493 6.335.905 14.19 1.233 23.568l.617 18.88c4.527-13.983 9.216-26.673 14.068-38.068C45.65 6.686 50.093.988 54.123.988c2.715 0 4.566 1.974 5.553 5.923.987 3.949 1.481 9.667 1.481 17.152 0 3.949-.081 9.625-.247 17.029l-.123 5.676c3.373-11.762 6.725-21.634 10.057-29.615 3.331-7.979 6.685-11.97 10.056-11.97 8.475 0 12.71 18.757 12.71 56.269z" fill-rule="nonzero"/></svg>',o.title="Powered by marker.js",o.style.display="grid",o.style.alignItems="center",o.style.justifyItems="center",o.style.padding="3px",o.style.width="20px",o.style.height="20px",this.logoUI.appendChild(o),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},O.prototype.positionLogo=function(){this.logoUI&&(this.uiStyleSettings.logoPosition!=="right"?this.logoUI.style.left=this.markerImageHolder.offsetLeft+10+"px":this.logoUI.style.left=this.markerImageHolder.offsetLeft+this.markerImageHolder.offsetWidth-this.logoUI.clientWidth-10+"px",this.logoUI.style.top=this.markerImageHolder.offsetTop+this.markerImageHolder.offsetHeight-this.logoUI.clientHeight-10+"px")},O.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"},O.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},O.prototype.showUI=function(){switch(this.settings.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.style.visibility=this._silentRenderMode?"hidden":"visible",this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.coverDiv.style.userSelect="none",this.settings.displayMode){case"inline":this.coverDiv.style.position="absolute";var o=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=o+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px",this.coverDiv.style.width=this.target.offsetWidth.toString()+"px",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.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.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.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.settings.displayMode==="popup"?this.settings.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.toolbar=new ne(this.uiDiv,this.settings.displayMode,this._availableMarkerTypes,this.uiStyleSettings,this.styles),this.toolbar.addButtonClickListener(this.toolbarButtonClicked),this.toolbar.show(this._silentRenderMode||this.uiStyleSettings.hideToolbar?"hidden":"visible"),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.settings.displayMode==="popup"&&(this.contentDiv.style.backgroundColor=this.uiStyleSettings.canvasBackgroundColor,this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.uiStyleSettings.toolbarHeight+"px",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.settings.popupMargin+"px)"),this.contentDiv.style.overflow="auto",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.settings.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.editorCanvas.style.transformOrigin="left top",this.editorCanvas.style.transform="scale("+this.zoomLevel+")",this.contentDiv.appendChild(this.editorCanvas),this.editingTarget=this.target instanceof HTMLImageElement?document.createElement("img"):document.createElement("canvas"),this.target.getClientRects().item(0).y<this.styles.settings.toolbarHeight&&(this.editingTarget.style.marginTop=this.target.offsetTop-this.styles.settings.toolbarHeight+"px"),this.editorCanvas.appendChild(this.editingTarget),this.toolbox=new de(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},O.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},O.prototype.removeMarker=function(o){this.markerImage.removeChild(o.container),this.markers.indexOf(o)>-1&&this.markers.splice(this.markers.indexOf(o),1),o.dispose()},O.prototype.switchToSelectMode=function(){this.mode="select",this.hideNotesEditor(),this._currentMarker!==void 0&&(this._currentMarker.state!=="new"?this._currentMarker.select():(this.removeMarker(this._currentMarker),this.setCurrentMarker(),this.markerImage.style.cursor="default"),this.addUndoStep())},O.prototype.toolbarButtonClicked=function(o,d){if(o==="marker"&&d!==void 0)this.createNewMarker(d);else if(o==="action")switch(d){case"select":this.switchToSelectMode(),this.switchToSelectMode();break;case"delete":this.deleteSelectedMarker();break;case"clear":this.clear();break;case"undo":this.undo();break;case"redo":this.redo();break;case"zoom":this.stepZoom();break;case"zoom-out":this.zoomLevel=1;break;case"notes":this.notesArea===void 0?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},O.prototype.deleteSelectedMarker=function(){var o=this;if(this._currentMarker!==void 0){var d=!1;if(this.eventListeners.markerbeforedelete.forEach(function(F){var I=new ze(o,o._currentMarker,!0);F(I),I.defaultPrevented&&(d=!0)}),!d){var P=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach(function(F){return F(new ze(o,P))})}}},O.prototype.clear=function(){var o=this,d=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(Z){var Te=new ze(o,void 0,!0);Z(Te),Te.defaultPrevented&&(d=!0)}),!d)){this.setCurrentMarker();for(var P=function(Z){var Te=F.markers[Z];F.setCurrentMarker(F.markers[Z]),F._currentMarker.dispose(),F.markerImage.removeChild(F._currentMarker.container),F.markers.splice(F.markers.indexOf(F._currentMarker),1),F.eventListeners.markerdelete.forEach(function(Ne){return Ne(new ze(o,Te))})},F=this,I=this.markers.length-1;I>=0;I--)P(I);this.addUndoStep()}},Object.defineProperty(O.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),O.prototype.showNotesEditor=function(){var o;this._currentMarker!==void 0&&(this.overlayContainer.innerHTML="",this.notesArea=document.createElement("textarea"),this.notesArea.className=this.uiStyleSettings.notesAreaStyleClassName,this.notesArea.style.pointerEvents="auto",this.notesArea.style.alignSelf="stretch",this.notesArea.style.width="100%",this.notesArea.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.notesArea.value=(o=this._currentMarker.notes)!==null&&o!==void 0?o:"",this.overlayContainer.appendChild(this.notesArea))},O.prototype.hideNotesEditor=function(){this.isNotesAreaOpen&&(this._currentMarker!==void 0&&(this._currentMarker.notes=this.notesArea.value.trim()!==""?this.notesArea.value:void 0),this.overlayContainer.removeChild(this.notesArea),this.notesArea=void 0)},O.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},O.prototype.addUndoStep=function(){var o=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var d=this.getState(),P=this.undoRedoManager.getLastUndoStep();if(!P||P.width===d.width&&P.height===d.height){var F=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(d),F<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(I){return I(new Je(o))})}else this.undoRedoManager.replaceLastUndoStep(d),this.eventListeners.statechange.forEach(function(I){return I(new Je(o))})}},O.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},O.prototype.undoStep=function(){var o=this,d=this.undoRedoManager.undo();d!==void 0&&(this.restoreState(d),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(P){return P(new Je(o))}))},O.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},O.prototype.redoStep=function(){var o=this,d=this.undoRedoManager.redo();d!==void 0&&(this.restoreState(d),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(P){return P(new Je(o))}))},O.prototype.stepZoom=function(){var o=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=o<this.zoomSteps.length-1?this.zoomSteps[o+1]:this.zoomSteps[0]},O.prototype.panTo=function(o){this.contentDiv.scrollBy({left:this.prevPanPoint.x-o.x,top:this.prevPanPoint.y-o.y}),this.prevPanPoint=o},O.prototype.startRenderAndClose=function(){return pe(this,void 0,void 0,function(){var o,d,P=this;return me(this,function(F){switch(F.label){case 0:return[4,this.render()];case 1:return o=F.sent(),d=this.getState(),this.eventListeners.render.forEach(function(I){return I(new qe(P,o,d))}),this.close(!0),[2]}})})},O.prototype.getState=function(o){o===!0&&this.setCurrentMarker();var d={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(P){return d.markers.push(P.getState())}),d},O.prototype.restoreState=function(o){var d=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);o.markers.forEach(function(P){var F=d._availableMarkerTypes.find(function(Z){return Z.typeName===P.typeName});if(F!==void 0){var I=d.addNewMarker(F);I.restoreState(P),d.markers.push(I)}}),o.width&&o.height&&(o.width!==this.imageWidth||o.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/o.width,this.imageHeight/o.height),this.eventListeners.restorestate.forEach(function(P){return P(new Je(d))})},O.prototype.addNewMarker=function(o){var d=J.createGroup();return this.markerImage.appendChild(d),new o(d,this.overlayContainer,this.settings)},O.prototype.createNewMarker=function(o){var d,P=this;(d=typeof o=="string"?this._availableMarkerTypes.find(function(F){return F.typeName===o}):o)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(d),this._currentMarker.onMarkerCreated=this.markerCreated,this._currentMarker.onColorChanged=this.colorChanged,this._currentMarker.onFillColorChanged=this.fillColorChanged,this._currentMarker.onStateChanged=this.markerStateChanged,this.markerImage.style.cursor="crosshair",this.toolbar.setActiveMarkerButton(d.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(F){return F(new ze(P,P._currentMarker))}))},O.prototype.markerCreated=function(o){var d=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(o),this.setCurrentMarker(o),o instanceof re&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(re):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(P){return P(new ze(d,d._currentMarker))})},O.prototype.colorChanged=function(o){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=o,this.settings.defaultStrokeColor=o)},O.prototype.fillColorChanged=function(o){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=o)},O.prototype.markerStateChanged=function(o){var d=this;this.eventListeners.markerchange.forEach(function(P){return P(new ze(d,o))})},O.prototype.setCurrentMarker=function(o){var d=this;this._currentMarker!==o&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(P){return P(new ze(d,d._currentMarker))})),this._currentMarker=o,this._currentMarker===void 0||this._currentMarker.isSelected||(this._currentMarker.state!=="new"&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach(function(P){return P(new ze(d,d._currentMarker))}))},O.prototype.onPointerDown=function(o){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||o.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var d=this.markers.find(function(P){return P.ownsTarget(o.target)});d!==void 0?(this.setCurrentMarker(d),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(o.clientX,o.clientY),o.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:o.clientX,y:o.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(o.clientX,o.clientY))},O.prototype.onDblClick=function(o){if(this._isFocused||this.focus(),this.mode==="select"){var d=this.markers.find(function(P){return P.ownsTarget(o.target)});d!==void 0&&d!==this._currentMarker&&this.setCurrentMarker(d),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(o.clientX,o.clientY),o.target):this.setCurrentMarker()}},O.prototype.onPointerMove=function(o){this.touchPoints!==1&&o.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||o.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(o.clientX,o.clientY)):this.zoomLevel>1&&this.panTo({x:o.clientX,y:o.clientY}))},O.prototype.onPointerUp=function(o){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(o.clientX,o.clientY)),this.isDragging=!1,this.addUndoStep()},O.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},O.prototype.onKeyUp=function(o){this._currentMarker===void 0||this.notesArea!==void 0||o.key!=="Delete"&&o.key!=="Backspace"||this.deleteSelectedMarker()},O.prototype.clientToLocalCoordinates=function(o,d){var P=this.markerImage.getBoundingClientRect();return{x:(o-P.left)/this.zoomLevel,y:(d-P.top)/this.zoomLevel}},O.prototype.onWindowResize=function(){this.positionUI()},O.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var o=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=o+"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=this.windowHeight-2*this.settings.popupMargin-3.5*this.styles.settings.toolbarHeight+"px"}this.positionMarkerImage(),this.positionLogo()},O.prototype.addLicenseKey=function(o){ye.addKey(o)},O.prototype.addEventListener=function(o,d){this.eventListeners.addEventListener(o,d)},O.prototype.removeEventListener=function(o,d){this.eventListeners.removeEventListener(o,d)},O.prototype.renderState=function(o){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(o),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(O.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),O.prototype.focus=function(){var o=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(d){return d(new Je(o))}))},O.prototype.blur=function(){var o=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(d){return d(new Je(o))}))},O.instanceCounter=0,O}();/* **********************************
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 bt=function(O,o){return(bt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,P){d.__proto__=P}||function(d,P){for(var F in P)Object.prototype.hasOwnProperty.call(P,F)&&(d[F]=P[F])})(O,o)};function vt(O,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function d(){this.constructor=O}bt(O,o),O.prototype=o===null?Object.create(o):(d.prototype=o.prototype,new d)}function tt(O,o,d,P){return new(d||(d=Promise))(function(F,I){function Z(Ke){try{Ne(P.next(Ke))}catch(Se){I(Se)}}function Te(Ke){try{Ne(P.throw(Ke))}catch(Se){I(Se)}}function Ne(Ke){var Se;Ke.done?F(Ke.value):(Se=Ke.value,Se instanceof d?Se:new d(function(Qe){Qe(Se)})).then(Z,Te)}Ne((P=P.apply(O,o||[])).next())})}function St(O,o){var d,P,F,I,Z={label:0,sent:function(){if(1&F[0])throw F[1];return F[1]},trys:[],ops:[]};return I={next:Te(0),throw:Te(1),return:Te(2)},typeof Symbol=="function"&&(I[Symbol.iterator]=function(){return this}),I;function Te(Ne){return function(Ke){return function(Se){if(d)throw new TypeError("Generator is already executing.");for(;Z;)try{if(d=1,P&&(F=2&Se[0]?P.return:Se[0]?P.throw||((F=P.return)&&F.call(P),0):P.next)&&!(F=F.call(P,Se[1])).done)return F;switch(P=0,F&&(Se=[2&Se[0],F.value]),Se[0]){case 0:case 1:F=Se;break;case 4:return Z.label++,{value:Se[1],done:!1};case 5:Z.label++,P=Se[1],Se=[0];continue;case 7:Se=Z.ops.pop(),Z.trys.pop();continue;default:if(!(F=Z.trys,(F=F.length>0&&F[F.length-1])||Se[0]!==6&&Se[0]!==2)){Z=0;continue}if(Se[0]===3&&(!F||Se[1]>F[0]&&Se[1]<F[3])){Z.label=Se[1];break}if(Se[0]===6&&Z.label<F[1]){Z.label=F[1],F=Se;break}if(F&&Z.label<F[2]){Z.label=F[2],Z.ops.push(Se);break}F[2]&&Z.ops.pop(),Z.trys.pop();continue}Se=o.call(O,Z)}catch(Qe){Se=[6,Qe],P=0}finally{d=F=0}if(5&Se[0])throw Se[1];return{value:Se[0]?Se[1]:void 0,done:!0}}([Ne,Ke])}}}var Lt=function(){function O(){}return O.addKey=function(o){O.key=o},Object.defineProperty(O,"isLicensed",{get:function(){return!!O.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(O.key)},enumerable:!1,configurable:!0}),O}(),Ye=function(){function O(){}return O.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},O.setAttributes=function(o,d){for(var P=0,F=d;P<F.length;P++){var I=F[P],Z=I[0],Te=I[1];o.setAttribute(Z,Te)}},O.createRect=function(o,d,P){var F=document.createElementNS("http://www.w3.org/2000/svg","rect");return F.setAttribute("width",o.toString()),F.setAttribute("height",d.toString()),P&&O.setAttributes(F,P),F},O.createLine=function(o,d,P,F,I){var Z=document.createElementNS("http://www.w3.org/2000/svg","line");return Z.setAttribute("x1",o.toString()),Z.setAttribute("y1",d.toString()),Z.setAttribute("x2",P.toString()),Z.setAttribute("y2",F.toString()),I&&O.setAttributes(Z,I),Z},O.createPolygon=function(o,d){var P=document.createElementNS("http://www.w3.org/2000/svg","polygon");return P.setAttribute("points",o),d&&O.setAttributes(P,d),P},O.createCircle=function(o,d){var P=document.createElementNS("http://www.w3.org/2000/svg","circle");return P.setAttribute("cx",(o/2).toString()),P.setAttribute("cy",(o/2).toString()),P.setAttribute("r",o.toString()),d&&O.setAttributes(P,d),P},O.createEllipse=function(o,d,P){var F=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return F.setAttribute("cx",(o/2).toString()),F.setAttribute("cy",(d/2).toString()),F.setAttribute("rx",(o/2).toString()),F.setAttribute("ry",(d/2).toString()),P&&O.setAttributes(F,P),F},O.createGroup=function(o){var d=document.createElementNS("http://www.w3.org/2000/svg","g");return o&&O.setAttributes(d,o),d},O.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},O.createMarker=function(o,d,P,F,I,Z,Te){var Ne=document.createElementNS("http://www.w3.org/2000/svg","marker");return O.setAttributes(Ne,[["id",o],["orient",d],["markerWidth",P.toString()],["markerHeight",F.toString()],["refX",I.toString()],["refY",Z.toString()]]),Ne.appendChild(Te),Ne},O.createText=function(o){var d=document.createElementNS("http://www.w3.org/2000/svg","text");return d.setAttribute("x","0"),d.setAttribute("y","0"),o&&O.setAttributes(d,o),d},O.createTSpan=function(o,d){var P=document.createElementNS("http://www.w3.org/2000/svg","tspan");return P.textContent=o,d&&O.setAttributes(P,d),P},O.createImage=function(o){var d=document.createElementNS("http://www.w3.org/2000/svg","image");return o&&O.setAttributes(d,o),d},O.createPoint=function(o,d){var P=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return P.x=o,P.y=d,P},O.createPath=function(o,d){var P=document.createElementNS("http://www.w3.org/2000/svg","path");return P.setAttribute("d",o),d&&O.setAttributes(P,d),P},O.createElement=function(o,d){var P=document.createElementNS("http://www.w3.org/2000/svg",o);return d&&O.setAttributes(P,d),P},O.getHollowRectanglePath=function(o,d,P,F,I,Z,Te,Ne){return"M"+o+","+d+"V"+(d+F)+"H"+(o+P)+"V"+d+"H"+I+"V"+Z+"H"+(I+Te)+"V"+(Z+Ne)+"H"+I+"V"+d+"Z"},O}(),$e=function(){function O(o){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+o+"_"}return Object.defineProperty(O.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(O.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(O.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),O.prototype.addClass=function(o){return this.styleSheet===void 0&&this.addStyleSheet(),o.name=""+this.classNamePrefix+o.localName,this.classes.push(o),this.styleSheet.sheet.insertRule("."+o.name+" {"+o.style+"}",this.styleSheet.sheet.cssRules.length),o},O.prototype.addRule=function(o){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(o),this.styleSheet.sheet.insertRule(o.selector+" {"+o.style+"}",this.styleSheet.sheet.cssRules.length)},O.prototype.addStyleSheet=function(){var o;this.styleSheet=document.createElement("style"),((o=this.styleSheetRoot)!==null&&o!==void 0?o:document.head).appendChild(this.styleSheet),this.addRule(new We("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new We("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new We("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new Ve("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new Ve("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},O.prototype.removeStyleSheet=function(){var o;this.styleSheet&&(((o=this.styleSheetRoot)!==null&&o!==void 0?o:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},O}(),We=function(O,o){this.selector=O,this.style=o},Ve=function(O,o){this.localName=O,this.style=o},pt=function(){function O(){this.blocks=[],this.display=""}return O.prototype.addButtonBlock=function(o){o.className=this.blockClassName,o.buttonClassName=this.buttonClassName,o.buttonColorsClassName=this.buttonColorsClassName,o.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(o)},O.prototype.addElementBlock=function(o){o.className===void 0&&(o.className=this.blockClassName),this.blocks.push(o)},O.prototype.getUI=function(){var o=document.createElement("div");return o.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,o.style.display=this.display,this.blocks.forEach(function(d){return o.appendChild(d.getUI())}),o},O}(),yt=function(){function O(){}return O.prototype.getUI=function(){var o=document.createElement("div");if(o.className=this.className,this.minWidth!==void 0&&(o.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":o.style.justifyContent="flex-start";break;case"center":o.style.justifyContent="center";break;case"end":o.style.justifyContent="flex-end"}return o.style.whiteSpace="nowrap",o},O}(),ct=function(O){function o(){var d=O!==null&&O.apply(this,arguments)||this;return d.buttons=[],d}return vt(o,O),o.prototype.addButton=function(d){d.className=this.buttonClassName,d.colorsClassName=this.buttonColorsClassName,d.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(d)},o.prototype.getUI=function(){var d=O.prototype.getUI.call(this);return this.buttons.forEach(function(P){return d.appendChild(P.getUI())}),d},o}(yt),gt=function(){function O(o,d){this._isActive=!1,this._isHidden=!1,this._icon=o,this.title=d,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(O.prototype,"icon",{get:function(){return this._icon},set:function(o){this._icon=o,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"isActive",{get:function(){return this._isActive},set:function(o){this._isActive=o,this.adjustClassName()},enumerable:!1,configurable:!0}),O.prototype.getUI=function(){var o=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 o.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},O.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,"")))},O.prototype.hide=function(){this._isHidden=!0},O}(),It=function(O){function o(){var d=O!==null&&O.apply(this,arguments)||this;return d.elements=[],d}return vt(o,O),o.prototype.addElement=function(d){this.elements.push(d)},o.prototype.getUI=function(){var d=O.prototype.getUI.call(this);return this.elements.forEach(function(P){return d.appendChild(P)}),d},o}(yt),kt=function(){function O(o,d){this.horizontal=o,this.vertical=d}return Object.defineProperty(O.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),O.prototype.getVerticalLength=function(o){return o/this.ratio},O.prototype.getHorizontalLength=function(o){return o*this.ratio},O}(),Mt=function(){function O(){}return O.getIcon=function(o,d){if(o>0&&d>0){var P=new kt(o,d),F=P.ratio>=1?20:P.getHorizontalLength(20),I=P.ratio<1?20:P.getVerticalLength(20),Z=document.createElementNS("http://www.w3.org/2000/svg","svg");Z.setAttribute("xmlns","http://www.w3.org/2000/svg"),Z.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(Z);var Te=Ye.createDefs();Z.appendChild(Te);var Ne=Ye.createElement("clipPath",[["id","text-bg-clip"]]);Te.appendChild(Ne);var Ke=Ye.createPath(Ye.getHollowRectanglePath((24-F)/2,(24-I)/2,F,I,(24-F)/2+2,(24-I)/2+2,F-4,I-4));Z.appendChild(Ke);var Se=Ye.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Se.appendChild(Ye.createTSpan(o+":"+d)),Z.appendChild(Se);var Qe=Se.getBBox();Ye.setAttributes(Se,[["x",((24-Qe.width)/2).toString()],["y",((24-Qe.height)/2-Qe.y).toString()]]);var it=Ye.createPath(Ye.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Qe.width))/2,(24-Math.ceil(Qe.height))/2,Math.ceil(Qe.width),Math.ceil(Qe.height)));return Ne.appendChild(it),Ye.setAttributes(Ke,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(Z),Z.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>'},O}(),jt=function(O){function o(d,P,F){var I=O.call(this,d,P)||this;return I.isDropdownOpen=!1,I.onClick=I.dropdownButtonClicked,I.dropdownButtons=F,I}return vt(o,O),o.prototype.setupDropdown=function(){var d=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(P){P.className=d.className,P.colorsClassName=d.colorsClassName,d.dropdownBlock.appendChild(P.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},o.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},o.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},o.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},o.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},o.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},o}(gt),Ot=function(){function O(o,d){this.GRIP_SIZE=10,this.color=o,this.fillColor=d,this.visual=Ye.createGroup(),this.visual.appendChild(Ye.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(Ye.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return O.prototype.ownsTarget=function(o){return o===this.visual||o===this.visual.childNodes[0]||o===this.visual.childNodes[1]},O.prototype.setCenter=function(o,d){this.visual.childNodes.forEach(function(P){return Ye.setAttributes(P,[["cx",o.toString()],["cy",d.toString()]])})},O}(),Nt=function(){function O(o,d,P,F){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=o,this.canvasHeight=d,this.margin=P,this.container=F,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(O.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(o){this._aspectRatio=o,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(o){this._isGridVisible=o,this.gridContainer&&Ye.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(o){this._zoomFactor=o,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),O.prototype.open=function(){var o=this;this.cropShadeElement=Ye.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=Ye.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var d=0;d<this.numberOfGridLines;d++)this.horizontalGridLines.push(Ye.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(Ye.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(P){return o.gridContainer.appendChild(P)}),this.verticalGridLines.forEach(function(P){return o.gridContainer.appendChild(P)}),this.cropRectElement=Ye.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},O.prototype.setCropRectangle=function(o){this.cropRect=o;var d=Object.assign({},this.cropRect);this.zoomFactor!==1&&(d.width=this.cropRect.width*this.zoomFactor,d.height=this.cropRect.height*this.zoomFactor,d.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-d.width/2,d.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-d.height/2),Ye.setAttributes(this.cropRectElement,[["x",d.x.toString()],["y",d.y.toString()],["width",d.width.toString()],["height",d.height.toString()]]);var P=d.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(I,Z){var Te=d.y+P*(Z+1);Ye.setAttributes(I,[["x1",""+d.x],["y1",""+Te],["x2",""+(d.x+d.width)],["y2",""+Te]])});var F=d.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(I,Z){var Te=d.x+F*(Z+1);Ye.setAttributes(I,[["x1",""+Te],["y1",""+d.y],["x2",""+Te],["y2",""+(d.y+d.height)]])}),Ye.setAttributes(this.cropShadeElement,[["d",Ye.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,d.x,d.y,d.width,d.height)]]),this.topLeftGrip.setCenter(d.x,d.y),this.topRightGrip.setCenter(d.x+d.width,d.y),this.bottomLeftGrip.setCenter(d.x,d.y+d.height),this.bottomRightGrip.setCenter(d.x+d.width,d.y+d.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},O.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)},O.prototype.clientToLocalCoordinates=function(o,d){var P=this.container.getBoundingClientRect();return{x:o-P.left+this.margin,y:d-P.top+this.margin}},O.prototype.onPointerDown=function(o){this.container.setPointerCapture(o.pointerId),this.previousPoint=this.clientToLocalCoordinates(o.clientX,o.clientY),this.cropRectElement===o.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(o.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(o.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(o.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(o.target)&&(this.activeGrip=this.bottomRightGrip)},O.prototype.onPointerMove=function(o){if(this.isMoving)this.move(this.clientToLocalCoordinates(o.clientX,o.clientY));else if(this.activeGrip){var d=this.clientToLocalCoordinates(o.clientX,o.clientY);this.resize(d)}o.preventDefault()},O.prototype.onPointerUp=function(o){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(o.pointerId)},O.prototype.move=function(o){var d=o.x-this.previousPoint.x,P=o.y-this.previousPoint.y;this.zoomFactor!==1&&(d=-d/this.zoomFactor,P=-P/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+d),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+P),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=o},O.prototype.resize=function(o){var d=Object.assign({},this.cropRect),P=o.x-this.previousPoint.x,F=o.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:d.x+P<this.margin&&(P=this.margin-d.x),d.x+=P,d.width=this.cropRect.x+this.cropRect.width-d.x;break;case this.bottomRightGrip:case this.topRightGrip:d.width+P>this.canvasWidth*this.zoomFactor&&(P=this.canvasWidth*this.zoomFactor-d.width),d.width+=P}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(d.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(P),d.height=this.aspectRatio.getVerticalLength(d.width)):(d.y+=F,d.height=this.cropRect.y+this.cropRect.height-d.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?d.height=this.aspectRatio.getVerticalLength(d.width):d.height+=F}d.width<10&&(d.x=this.cropRect.x,d.width=10),d.height<10&&(d.y=this.cropRect.y,d.height=10),this.previousPoint=o,d.x>=this.margin&&d.y>=this.margin&&d.x-this.margin+d.width<=this.canvasWidth&&d.y-this.margin+d.height<=this.canvasHeight&&(this.cropRect=d,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},O.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var o=this.cropRect.x+this.cropRect.width/2,d=this.cropRect.y+this.cropRect.height/2,P=this.aspectRatio.getHorizontalLength(this.cropRect.height),F=this.aspectRatio.getVerticalLength(this.cropRect.width);P/this.canvasWidth<F/this.canvasHeight?this.cropRect.width=P:this.cropRect.height=F,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=o-this.cropRect.width/2,this.cropRect.y=d-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)}},O.prototype.getRescaledRect=function(o,d,P,F,I,Z){var Te=P/o,Ne=F/d;return{x:(I.x-Z)*Te+Z,y:(I.y-Z)*Ne+Z,width:I.width*Te,height:I.height*Ne}},O.prototype.scaleCanvas=function(o,d){var P=this.getRescaledRect(this.canvasWidth,this.canvasHeight,o,d,this.cropRect,this.margin);this.canvasWidth=o,this.canvasHeight=d,this.onCropChange&&this.onCropChange(P),this.setCropRectangle(P)},O}(),Wt=function(){function O(o){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=o,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(O.prototype,"angle",{get:function(){return this._angle},set:function(o){this._angle=o,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),O.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},O.prototype.onPointerDown=function(o){this.controlContainer.setPointerCapture(o.pointerId),this.isDragging=!0,this.previousPoint={x:o.clientX,y:o.clientY}},O.prototype.onPointerMove=function(o){this.isDragging&&(this.onAngleChange&&this.onAngleChange((o.clientX-this.previousPoint.x)/5),this.previousPoint.x=o.clientX)},O.prototype.onPointerUp=function(o){this.isDragging&&this.onAngleChange&&this.onAngleChange((o.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(o.pointerId)},O.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var o=this.angleLabelText.getBBox();Ye.setAttributes(this.angleLabelElement,[["x",((this.width-o.width)/2).toString()],["y",(this.height/2).toString()]])}},O.prototype.positionScaleShape=function(){if(this.scaleShape){var o=this.scaleShape.transform.baseVal.getItem(0);o.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(o,0)}},O.prototype.getVisual=function(){var o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("xmlns","http://www.w3.org/2000/svg"),o.setAttribute("width",this.width+"px"),o.setAttribute("height",this.height+"px"),o.setAttribute("viewBox","0 0 "+this.width+" "+this.height),o.style.flexShrink="0",document.body.appendChild(o);for(var d="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,P=1;P<=this.width/5+10;P++){var F=P%5==0?this.height/3:this.height/6;d+="h4v"+-F+"h1v"+F}d+="v1H0Z",this.scaleShape=Ye.createPath(d);var I=Ye.createTransform();this.scaleShape.transform.baseVal.appendItem(I),o.appendChild(this.scaleShape),this.angleLabelElement=Ye.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=Ye.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var Z=Ye.createTSpan("");return Z.innerHTML="&deg;",this.angleLabelElement.appendChild(Z),o.appendChild(this.angleLabelElement),document.body.removeChild(o),o},O}(),Ht=function(){function O(){this.naturalSize=!1,this.imageType="image/png"}return O.prototype.rasterize=function(o,d,P,F,I,Z,Te){var Ne=this;return new Promise(function(Ke){var Se=document.createElement("canvas");Se.width=o.width.baseVal.value-2*F,Se.height=o.height.baseVal.value-2*F;var Qe=1,it=1;Ne.naturalSize===!0?(Qe=d.naturalWidth/(o.width.baseVal.value-2*F)/Z,it=d.naturalHeight/(o.height.baseVal.value-2*F)/Te,Se.width=d.naturalWidth/Z,Se.height=d.naturalHeight/Te):Ne.width!==void 0&&Ne.height!==void 0&&(Qe=Ne.width/P.width,it=Ne.height/P.height,Se.width*=Qe,Se.height*=it);var ht=Se.getContext("2d");ht.translate(Se.width/2,Se.height/2),ht.rotate(I*Math.PI/180),ht.scale(Z,Te),ht.translate(-Se.width/2,-Se.height/2),ht.drawImage(d,0,0,Se.width,Se.height);var At=document.createElement("canvas");At.width=P.width*Qe,At.height=P.height*it,At.getContext("2d").putImageData(ht.getImageData((P.x-F)*Qe,(P.y-F)*it,P.width*Qe,P.height*it),0,0),Ke(At.toDataURL(Ne.imageType,Ne.imageQuality))})},O}(),dt=function(){function O(o){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=O.instanceCounter++,this.styles=new $e(this.instanceNo),this.target=o,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(O.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(o){this._zoomToCropEnabled=o,o?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(o){this._isGridVisible=o,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"gridLines",{get:function(){return this._gridLines},set:function(o){this._gridLines=o,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(o){this._rotationAngle=o,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"aspectRatio",{get:function(){var o;return(o=this._aspectRatio)!==null&&o!==void 0?o:this.aspectRatios[0]},set:function(o){this._aspectRatio=o},enumerable:!1,configurable:!0}),O.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},O.prototype.show=function(){this.showUI(),this.open()},O.prototype.close=function(o){o===void 0&&(o=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),o||this.closeEventListeners.forEach(function(d){return d()}),this._isOpen=!1)},O.prototype.addRenderEventListener=function(o){this.renderEventListeners.push(o)},O.prototype.removeRenderEventListener=function(o){this.renderEventListeners.indexOf(o)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(o),1)},O.prototype.addCloseEventListener=function(o){this.closeEventListeners.push(o)},O.prototype.removeCloseEventListener=function(o){this.closeEventListeners.indexOf(o)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(o),1)},O.prototype.setupResizeObserver=function(){var o=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){o.resize(o.target.clientWidth,o.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))},O.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var o=1*this.target.clientWidth/this.target.clientHeight,d=this.contentDiv.clientWidth/o>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*o:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,P=d+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/o;this.resize(d,P)}},O.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},O.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",Ye.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},O.prototype.resize=function(o,d){this.imageWidth=Math.round(o),this.imageHeight=Math.round(d),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()},O.prototype.setEditingTarget=function(){var o=document.createElement("canvas");o.width=this.target.naturalWidth,o.height=this.target.naturalHeight,o.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var d=o.toDataURL();Ye.setAttributes(this.editingTarget,[["href",d]]),this.setEditingTargetSize()},O.prototype.setTopLeft=function(){var o=this.target.getBoundingClientRect(),d=this.editorCanvas.getBoundingClientRect();this.left=o.left-d.left-this.CANVAS_MARGIN,this.top=o.top-d.top-this.CANVAS_MARGIN},O.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=Ye.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=Ye.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=Ye.createGroup(),this.editingTargetRotationScaleContainer=Ye.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var o=Ye.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(o);var d=Ye.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(d),this.editingTargetContainer=Ye.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)},O.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},O.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=Ye.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Nt(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()},O.prototype.zoomToCrop=function(){if(this.cropRect){var o=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,d=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=o+"px "+d+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-o+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-d+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},O.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)},O.prototype.cropRectChanged=function(o){this.cropRect=o,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},O.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},O.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"},O.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},O.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 o=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,d=this.target.offsetTop>o+this.CANVAS_MARGIN?this.target.offsetTop-(o+this.CANVAS_MARGIN):0;this.coverDiv.style.top=d+"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},O.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},O.prototype.addTopToolbar=function(){var o=this;this.topToolbar=new pt,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 d=new ct;d.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(d);var P=[];this.aspectRatios.forEach(function(it){var ht=new gt(Mt.getIcon(it.horizontal,it.vertical),it.horizontal===0&&it.vertical===0?"FREE":it.horizontal+":"+it.vertical);ht.onClick=function(){return o.ratioButtonClicked(it)},P.push(ht)}),this.aspectRatioButton=new jt(Mt.getIcon(0,0),"Aspect ratio",P),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,d.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var F=new gt('<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");F.isActive=this.isGridVisible,F.onClick=function(){o.isGridVisible=!o.isGridVisible,F.isActive=o.isGridVisible},d.addButton(F);var I=new gt('<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(I.isActive=this.zoomToCropEnabled,I.onClick=function(){o.zoomToCropEnabled=!o.zoomToCropEnabled,I.isActive=o.zoomToCropEnabled},d.addButton(I),!Lt.isLicensed){var Z=new It;this.topToolbar.addElementBlock(Z);var Te=document.createElement("div");Te.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var Ne=document.createElement("a");Ne.style.color="currentColor",Ne.href="https://markerjs.com/products/cropro",Ne.target="_blank",Ne.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>',Te.appendChild(Ne),Z.addElement(Te)}var Ke=new ct;Ke.minWidth=3*this.toolbarHeight+"px",Ke.contentAlign="end",this.topToolbar.addButtonBlock(Ke);var Se=new gt('<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");Se.onClick=this.startRenderAndClose,Ke.addButton(Se),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Se.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Qe=new gt('<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");Qe.onClick=this.close,Ke.addButton(Qe),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Qe.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},O.prototype.addBottomToolbar=function(){var o=this;this.bottomToolbar=new pt,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 d=new ct;d.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(d);var P=new gt('<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");P.onClick=this.rotateLeftButtonClicked,d.addButton(P);var F=new gt('<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");F.onClick=this.rotateRightButtonClicked,d.addButton(F);var I=new It;I.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(I),this.straightener=new Wt("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(Ke){o.rotateBy(Ke),o.straightener.angle=o.rotationAngle},I.addElement(this.straightener.getUI());var Z=new ct;Z.minWidth=2*this.toolbarHeight+"px",Z.contentAlign="end",this.bottomToolbar.addButtonBlock(Z);var Te=new gt('<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");Te.onClick=this.flipHorizontallyButtonClicked,Z.addButton(Te);var Ne=new gt('<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");Ne.onClick=this.flipVerticallyButtonClicked,Z.addButton(Ne)},O.prototype.ratioButtonClicked=function(o){this.aspectRatio=o,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},O.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=Mt.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},O.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new kt(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},O.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},O.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},O.prototype.restoreState=function(o){if(o){var d=this.cropLayer.getRescaledRect(o.width,o.height,this.imageWidth,this.imageHeight,o.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(d),this.cropRectChanged(d),this.flippedHorizontally=o.flippedHorizontally,this.flippedVertically=o.flippedVertically,this.applyFlip(),this.rotationAngle=o.rotationAngle,this.applyRotation()}},O.prototype.clientToLocalCoordinates=function(o,d){var P=this.cropImage.getBoundingClientRect();return{x:o-P.left,y:d-P.top}},O.prototype.onWindowResize=function(){this.positionUI()},O.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var o=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=o+"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()},O.prototype.rotateLeftButtonClicked=function(){var o=this.rotationAngle-90;this.rotationAngle%90!=0&&(o+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(o)},O.prototype.rotateRightButtonClicked=function(){var o=this.rotationAngle+90;this.rotationAngle%90!=0&&(o-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(o)},O.prototype.rotateTo=function(o){o=(o=o>180?o-360:o)<=-180?o+360:o,this.rotationAngle=o,this.applyRotation()},O.prototype.rotateBy=function(o){this.rotateTo((this.rotationAngle+o)%360)},O.prototype.applyRotation=function(){var o=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var d=this.editingTargetRotationContainer.transform.baseVal.getItem(0);d.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(d,0);var P=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/P.width,this.imageHeight/P.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=o},O.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},O.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},O.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},O.prototype.startRenderAndClose=function(){return tt(this,void 0,void 0,function(){var o,d;return St(this,function(P){switch(P.label){case 0:return[4,this.render()];case 1:return o=P.sent(),d=this.getState(),this.renderEventListeners.forEach(function(F){return F(o,d)}),this.close(!0),[2]}})})},O.prototype.render=function(){return tt(this,void 0,void 0,function(){var o;return St(this,function(d){switch(d.label){case 0:return(o=new Ht).naturalSize=this.renderAtNaturalSize,o.imageType=this.renderImageType,o.imageQuality=this.renderImageQuality,o.width=this.renderWidth,o.height=this.renderHeight,this.unzoomFromCrop(),Ye.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,o.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 d.sent(),[4,o.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,d.sent()]}})})},O.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Ve("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 Ve("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Ve("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var o=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Ve("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*o)+`px;
height: `+(this.toolbarHeight-2*o)+`px;
padding: `+o+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Ve("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Ve("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new We("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new We("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new Ve("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 Ve("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Ve("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 Ve("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*o)+`px;
padding: `+o+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new Ve("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},O.instanceCounter=0,O}(),at=H("8hTe"),et=H.n(at),ot=/<pre[^>]*>/g;function ut(O){var o=document.createElement("div");return o.innerHTML=O,o.childNodes.length===0?"":o.childNodes[0].nodeValue}var ft=le.a=function(O){var o=O.value,d=o===void 0?"":o,P=O.edit,F=P===void 0?!1:P,I=O.className,Z=O.showTextOnly,Te=O.showLines,Ne=O.replaces,Ke=O.zoomImg,Se=O.hasMask,Qe=O.style,it=Qe===void 0?{}:Qe,ht=O.stylesPrev,At=ht===void 0?{}:ht,Rt=String(d),wt=Object(C.useRef)(),Dt=Object(C.useRef)(),$t=Object(C.useState)(""),zt=Object(B.a)($t,2),Bt=zt[0],_t=zt[1],Yt=Object(C.useState)("office"),Vt=Object(B.a)(Yt,2),Jt=Vt[0],Ut=Vt[1],Qt=function(){var st=new dt(Dt.current);st.displayMode="popup",st.addRenderEventListener(function(){var Tt=Object(L.a)(A.a.mark(function rt(Ct){var mt;return A.a.wrap(function(xt){for(;;)switch(xt.prev=xt.next){case 0:return wt.current.style.display="none",xt.next=3,Object(Ce.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Ct}});case 3:mt=xt.sent,mt!=null&&mt.id&&Ne(Dt.current.getAttribute("src").replace(Q.a.API_SERVER,""),"/api/attachments/".concat(mt==null?void 0:mt.id,"?type=").concat(mt.content_type));case 5:case"end":return xt.stop()}},rt)}));return function(rt){return Tt.apply(this,arguments)}}()),st.show()},Zt=function(){var st=new lt(Dt.current);st.settings.displayMode="popup",st.addEventListener("render",function(){var Tt=Object(L.a)(A.a.mark(function rt(Ct){var mt;return A.a.wrap(function(xt){for(;;)switch(xt.prev=xt.next){case 0:if(wt.current.style.display="none",!Dt.current){xt.next=6;break}return xt.next=4,Object(Ce.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Ct.dataUrl}});case 4:mt=xt.sent,mt!=null&&mt.id&&Ne(Dt.current.getAttribute("src").replace(Q.a.API_SERVER,""),"/api/attachments/".concat(mt==null?void 0:mt.id,"?type=").concat(mt.content_type));case 6:case"end":return xt.stop()}},rt)}));return function(rt){return Tt.apply(this,arguments)}}()),st.show(),window.markerArea=st},Ft=Object(C.useMemo)(function(){try{var Et=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,st=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Tt=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Rt=Rt.replace(Et,"("+Q.a.API_SERVER+"/api/attachments/").replace(st,'"'+Q.a.API_SERVER+"/api/attachments/").replace(Tt,'"'+Q.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,`
`),Rt=Rt.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
`)}catch(Kt){}var rt=j(Rt),Ct=y();if(Rt.match(/\[TOC\]/)&&(rt=rt.replace("<p>[TOC]</p>",T()),p()),rt=rt.replace(/(__special_katext_id_\d+__)/g,function(Kt,xt){var Xt=Ct[xt],tr=Xt.type,rr=Xt.expression;return Object(ae.renderToString)(ut(rr)||"",{displayMode:tr==="block",throwOnError:!1,output:"html"})}),rt=rt.replace(/▁/g,"\u2581\u2581\u2581"),E(),Z){var mt=document.createElement("div");return mt.innerHTML=rt,mt.innerText}return setTimeout(function(){return qt()},500),rt},[Rt]),Pt=Object(C.useRef)();u.WebkitLineClamp=Te,Te&&(it=Object(D.a)(Object(D.a)({},it),u));function Gt(Et){var st=Et.target;if(st.tagName.toUpperCase()==="IMG"){if(Ke){var Tt=st.getAttribute("src");_t(Tt),Ut("image")}}else if(st.tagName.toUpperCase()==="A"){var rt=st.getAttribute("href");if(rt.indexOf("office")>-1)Et.preventDefault(),_t(rt),Ut("office");else if(rt.indexOf("application/pdf")>-1)Et.preventDefault(),_t(rt),Ut("pdf");else if(rt.indexOf("type=text")>-1)Et.preventDefault(),_t(rt),Ut("html");else if(rt.startsWith("#")){Et.preventDefault();var Ct=document.getElementById(rt.replace("#",""));Ct&&Ct.scrollIntoView(!0)}}}var qt=function(){var st,Tt=(st=Pt.current)===null||st===void 0?void 0:st.querySelectorAll("video");Tt==null||Tt.forEach(function(rt){if(rt.oncontextmenu=function(){return!1},rt.src.indexOf(".m3u8")>-1&&!rt.canPlayType("application/vnd.apple.mpegurl")){if(z.a.isSupported()){var Ct=new z.a;Ct.loadSource(rt.src),Ct.attachMedia(rt)}}})};Object(C.useEffect)(function(){if(Pt.current&&Ft&&(Ft.match(ot)&&window.PR.prettyPrint()),Pt.current)return Pt.current.addEventListener("click",Gt),function(){Pt.current.removeEventListener("click",Gt),E(),p()}},[Ft,Pt.current,Gt]);var er=function(st){if(!F)return;st.target.nodeName==="IMG"?(wt.current.style.display="flex",wt.current.style.width=st.target.clientWidth+"px",wt.current.style.height=st.target.clientHeight+"px",wt.current.style.top=st.target.offsetTop+"px",wt.current.style.left=st.target.offsetLeft+"px",Dt.current.src=st.target.getAttribute("src")):wt.current.style.display="none"};return s.a.createElement("div",{style:{position:"relative"}},s.a.createElement("div",{ref:Pt,style:Object(D.a)({},it),className:"".concat(I||""," markdown-body ").concat(et.a.mdBody),onMouseOver:er,dangerouslySetInnerHTML:{__html:Ft}}),s.a.createElement("div",{ref:wt,className:et.a.button},s.a.createElement(U.a,null,s.a.createElement(k.a,{onClick:function(){return Qt()}},"\u88C1\u526A"),s.a.createElement(k.a,{onClick:function(){return Zt()}},"\u7F16\u8F91"))),s.a.createElement("img",{ref:Dt,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),s.a.createElement(oe.a,{close:!0,data:Bt,hasMask:Se,type:Bt!=null&&Bt.length?Jt:"",style:Object(D.a)({},At),onClose:function(){return _t("")}}))}},BU3w:function(Ze,le,H){"use strict";H.d(le,"a",function(){return L});var se=H("MNnm"),U="rc-util-key";function S(B){if(B.attachTo)return B.attachTo;var _=document.querySelector("head");return _||document.body}function k(B){var _,A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(se.a)())return null;var C=document.createElement("style");if((_=A.csp)===null||_===void 0?void 0:_.nonce){var s;C.nonce=(s=A.csp)===null||s===void 0?void 0:s.nonce}C.innerHTML=B;var m=S(A),b=m.firstChild;return A.prepend&&m.prepend?m.prepend(C):A.prepend&&b?m.insertBefore(C,b):m.appendChild(C),C}var D=new Map;function L(B,_){var A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},C=S(A);if(!D.has(C)){var s=k("",A),m=s.parentNode;D.set(C,m),m.removeChild(s)}var b=Array.from(D.get(C).children).find(function(e){return e.tagName==="STYLE"&&e[U]===_});if(b){var c,v;if(((c=A.csp)===null||c===void 0?void 0:c.nonce)&&b.nonce!==((v=A.csp)===null||v===void 0?void 0:v.nonce)){var x;b.nonce=(x=A.csp)===null||x===void 0?void 0:x.nonce}return b.innerHTML!==B&&(b.innerHTML=B),b}var n=k(B,A);return n[U]=_,n}},BdwD:function(Ze,le,H){"use strict";var se=H("+L6B"),U=H("2/Rp"),S=H("0Owb"),k=H("k1fw"),D=H("q1tI"),L=H.n(D),B=H("FOrL"),_=H.n(B),A=function(s){var m=s.buttonProps,b=m===void 0?{}:m,c=s.styles,v=c===void 0?{}:c,x=s.customText,n=s.ButtonText,e=s.ButtonClick,t=s.Buttonclass,i=s.ButtonTwo;return L.a.createElement("section",{className:"tc animated fadeIn",style:Object(k.a)(Object(k.a)({},{color:"#999",margin:"200px auto"}),v)},L.a.createElement("img",{src:_.a}),L.a.createElement("p",{className:"mt20 font14"},x||"\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!"),n&&L.a.createElement(U.a,Object(S.a)({className:t,onClick:e},b),n),i&&i)};le.a=A},"C/vA":function(Ze,le,H){"use strict";H.d(le,"a",function(){return se});function se(U){var S=this,k=!1,D;return function(){return k||(k=!0,D=U.apply(S,arguments)),D}}},"Cg/j":function(Ze,le,H){"use strict";H.d(le,"b",function(){return se}),H.d(le,"a",function(){return U}),H.d(le,"c",function(){return k}),H.d(le,"d",function(){return D});var se;(function(L){L.serviceIds=new Map,L.DI_TARGET="$di$target",L.DI_DEPENDENCIES="$di$dependencies";function B(_){return _[L.DI_DEPENDENCIES]||[]}L.getServiceDependencies=B})(se||(se={}));var U=k("instantiationService");function S(L,B,_,A){B[se.DI_TARGET]===B?B[se.DI_DEPENDENCIES].push({id:L,index:_,optional:A}):(B[se.DI_DEPENDENCIES]=[{id:L,index:_,optional:A}],B[se.DI_TARGET]=B)}function k(L){if(se.serviceIds.has(L))return se.serviceIds.get(L);var B=function(_,A,C){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");S(B,_,C,!1)};return B.toString=function(){return L},se.serviceIds.set(L,B),B}function D(L){return function(B,_,A){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");S(L,B,A,!0)}}},DlQD:function(Ze,le,H){(function(se,U){Ze.exports=U()})(this,function(){"use strict";function se(re,ee){for(var te=0;te<ee.length;te++){var W=ee[te];W.enumerable=W.enumerable||!1,W.configurable=!0,"value"in W&&(W.writable=!0),Object.defineProperty(re,W.key,W)}}function U(re,ee,te){return ee&&se(re.prototype,ee),te&&se(re,te),re}function S(re,ee){if(!re)return;if(typeof re=="string")return k(re,ee);var te=Object.prototype.toString.call(re).slice(8,-1);if(te==="Object"&&re.constructor&&(te=re.constructor.name),te==="Map"||te==="Set")return Array.from(re);if(te==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(te))return k(re,ee)}function k(re,ee){(ee==null||ee>re.length)&&(ee=re.length);for(var te=0,W=new Array(ee);te<ee;te++)W[te]=re[te];return W}function D(re,ee){var te;if(typeof Symbol=="undefined"||re[Symbol.iterator]==null){if(Array.isArray(re)||(te=S(re))||ee&&re&&typeof re.length=="number"){te&&(re=te);var W=0;return function(){return W>=re.length?{done:!0}:{done:!1,value:re[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 te=re[Symbol.iterator](),te.next.bind(te)}function L(re,ee){return ee={exports:{}},re(ee,ee.exports),ee.exports}var B=L(function(re){function ee(){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 te(W){re.exports.defaults=W}re.exports={defaults:ee(),getDefaults:ee,changeDefaults:te}}),_=B.defaults,A=B.getDefaults,C=B.changeDefaults,s=/[&<>"']/,m=/[&<>"']/g,b=/[<>"']|&(?!#?\w+;)/,c=/[<>"']|&(?!#?\w+;)/g,v={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},x=function(ee){return v[ee]};function n(re,ee){if(ee){if(s.test(re))return re.replace(m,x)}else if(b.test(re))return re.replace(c,x);return re}var e=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function t(re){return re.replace(e,function(ee,te){return te=te.toLowerCase(),te==="colon"?":":te.charAt(0)==="#"?te.charAt(1)==="x"?String.fromCharCode(parseInt(te.substring(2),16)):String.fromCharCode(+te.substring(1)):""})}var i=/(^|[^\[])\^/g;function p(re,ee){re=re.source||re,ee=ee||"";var te={replace:function(G,Y){return Y=Y.source||Y,Y=Y.replace(i,"$1"),re=re.replace(G,Y),te},getRegex:function(){return new RegExp(re,ee)}};return te}var u=/[^\w:]/g,h=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function T(re,ee,te){if(re){var W;try{W=decodeURIComponent(t(te)).replace(u,"").toLowerCase()}catch(G){return null}if(W.indexOf("javascript:")===0||W.indexOf("vbscript:")===0||W.indexOf("data:")===0)return null}ee&&!h.test(te)&&(te=a(ee,te));try{te=encodeURI(te).replace(/%25/g,"%")}catch(G){return null}return te}var g={},f=/^[^:]+:\/*[^/]*$/,l=/^([^:]+:)[\s\S]*$/,r=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(re,ee){g[" "+re]||(f.test(re)?g[" "+re]=re+"/":g[" "+re]=R(re,"/",!0)),re=g[" "+re];var te=re.indexOf(":")===-1;return ee.substring(0,2)==="//"?te?ee:re.replace(l,"$1")+ee:ee.charAt(0)==="/"?te?ee:re.replace(r,"$1")+ee:re+ee}var y={exec:function(){}};function E(re){for(var ee=1,te,W;ee<arguments.length;ee++){te=arguments[ee];for(W in te)Object.prototype.hasOwnProperty.call(te,W)&&(re[W]=te[W])}return re}function w(re,ee){var te=re.replace(/\|/g,function(Y,q,ue){for(var ce=!1,Ae=q;--Ae>=0&&ue[Ae]==="\\";)ce=!ce;return ce?"|":" |"}),W=te.split(/ \|/),G=0;if(W.length>ee)W.splice(ee);else for(;W.length<ee;)W.push("");for(;G<W.length;G++)W[G]=W[G].trim().replace(/\\\|/g,"|");return W}function R(re,ee,te){var W=re.length;if(W===0)return"";for(var G=0;G<W;){var Y=re.charAt(W-G-1);if(Y===ee&&!te)G++;else if(Y!==ee&&te)G++;else break}return re.substr(0,W-G)}function M(re,ee){if(re.indexOf(ee[1])===-1)return-1;for(var te=re.length,W=0,G=0;G<te;G++)if(re[G]==="\\")G++;else if(re[G]===ee[0])W++;else if(re[G]===ee[1]&&(W--,W<0))return G;return-1}function N(re){re&&re.sanitize&&!re.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 j={escape:n,unescape:t,edit:p,cleanUrl:T,resolveUrl:a,noopTest:y,merge:E,splitCells:w,rtrim:R,findClosingBracket:M,checkSanitizeDeprecation:N},K=B.defaults,V=j.rtrim,z=j.splitCells,Q=j.escape,ae=j.findClosingBracket;function oe(re,ee,te){var W=ee.href,G=ee.title?Q(ee.title):null,Y=re[1].replace(/\\([\[\]])/g,"$1");return re[0].charAt(0)!=="!"?{type:"link",raw:te,href:W,title:G,text:Y}:{type:"image",raw:te,href:W,title:G,text:Q(Y)}}function Ce(re,ee){var te=re.match(/^(\s+)(?:```)/);if(te===null)return ee;var W=te[1];return ee.split(`
`).map(function(G){var Y=G.match(/^\s+/);if(Y===null)return G;var q=Y[0];return q.length>=W.length?G.slice(W.length):G}).join(`
`)}var he=function(){function re(te){this.options=te||K}var ee=re.prototype;return ee.space=function(W){var G=this.rules.block.newline.exec(W);if(G)return G[0].length>1?{type:"space",raw:G[0]}:{raw:`
`}},ee.code=function(W,G){var Y=this.rules.block.code.exec(W);if(Y){var q=G[G.length-1];if(q&&q.type==="paragraph")return{raw:Y[0],text:Y[0].trimRight()};var ue=Y[0].replace(/^ {4}/gm,"");return{type:"code",raw:Y[0],codeBlockStyle:"indented",text:this.options.pedantic?ue:V(ue,`
`)}}},ee.fences=function(W){var G=this.rules.block.fences.exec(W);if(G){var Y=G[0],q=Ce(Y,G[3]||"");return{type:"code",raw:Y,lang:G[2]?G[2].trim():G[2],text:q}}},ee.heading=function(W){var G=this.rules.block.heading.exec(W);if(G)return{type:"heading",raw:G[0],depth:G[1].length,text:G[2]}},ee.nptable=function(W){var G=this.rules.block.nptable.exec(W);if(G){var Y={type:"table",header:z(G[1].replace(/^ *| *\| *$/g,"")),align:G[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:G[3]?G[3].replace(/\n$/,"").split(`
`):[],raw:G[0]};if(Y.header.length===Y.align.length){var q=Y.align.length,ue;for(ue=0;ue<q;ue++)/^ *-+: *$/.test(Y.align[ue])?Y.align[ue]="right":/^ *:-+: *$/.test(Y.align[ue])?Y.align[ue]="center":/^ *:-+ *$/.test(Y.align[ue])?Y.align[ue]="left":Y.align[ue]=null;for(q=Y.cells.length,ue=0;ue<q;ue++)Y.cells[ue]=z(Y.cells[ue],Y.header.length);return Y}}},ee.hr=function(W){var G=this.rules.block.hr.exec(W);if(G)return{type:"hr",raw:G[0]}},ee.blockquote=function(W){var G=this.rules.block.blockquote.exec(W);if(G){var Y=G[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:G[0],text:Y}}},ee.list=function(W){var G=this.rules.block.list.exec(W);if(G){for(var Y=G[0],q=G[2],ue=q.length>1,ce=q[q.length-1]===")",Ae={type:"list",raw:Y,ordered:ue,start:ue?+q.slice(0,-1):"",loose:!1,items:[]},Ge=G[0].match(this.rules.block.item),Xe=!1,He,Je,qe,ze,nt,lt,bt,vt=Ge.length,tt=0;tt<vt;tt++)He=Ge[tt],Y=He,Je=He.length,He=He.replace(/^ *([*+-]|\d+[.)]) */,""),~He.indexOf(`
`)&&(Je-=He.length,He=this.options.pedantic?He.replace(/^ {1,4}/gm,""):He.replace(new RegExp("^ {1,"+Je+"}","gm"),"")),tt!==vt-1&&(qe=this.rules.block.bullet.exec(Ge[tt+1])[0],(ue?qe.length===1||!ce&&qe[qe.length-1]===")":qe.length>1||this.options.smartLists&&qe!==q)&&(ze=Ge.slice(tt+1).join(`
`),Ae.raw=Ae.raw.substring(0,Ae.raw.length-ze.length),tt=vt-1)),nt=Xe||/\n\n(?!\s*$)/.test(He),tt!==vt-1&&(Xe=He.charAt(He.length-1)===`
`,nt||(nt=Xe)),nt&&(Ae.loose=!0),lt=/^\[[ xX]\] /.test(He),bt=void 0,lt&&(bt=He[1]!==" ",He=He.replace(/^\[[ xX]\] +/,"")),Ae.items.push({type:"list_item",raw:Y,task:lt,checked:bt,loose:nt,text:He});return Ae}},ee.html=function(W){var G=this.rules.block.html.exec(W);if(G)return{type:this.options.sanitize?"paragraph":"html",raw:G[0],pre:!this.options.sanitizer&&(G[1]==="pre"||G[1]==="script"||G[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(G[0]):Q(G[0]):G[0]}},ee.def=function(W){var G=this.rules.block.def.exec(W);if(G){G[3]&&(G[3]=G[3].substring(1,G[3].length-1));var Y=G[1].toLowerCase().replace(/\s+/g," ");return{tag:Y,raw:G[0],href:G[2],title:G[3]}}},ee.table=function(W){var G=this.rules.block.table.exec(W);if(G){var Y={type:"table",header:z(G[1].replace(/^ *| *\| *$/g,"")),align:G[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:G[3]?G[3].replace(/\n$/,"").split(`
`):[]};if(Y.header.length===Y.align.length){Y.raw=G[0];var q=Y.align.length,ue;for(ue=0;ue<q;ue++)/^ *-+: *$/.test(Y.align[ue])?Y.align[ue]="right":/^ *:-+: *$/.test(Y.align[ue])?Y.align[ue]="center":/^ *:-+ *$/.test(Y.align[ue])?Y.align[ue]="left":Y.align[ue]=null;for(q=Y.cells.length,ue=0;ue<q;ue++)Y.cells[ue]=z(Y.cells[ue].replace(/^ *\| *| *\| *$/g,""),Y.header.length);return Y}}},ee.lheading=function(W){var G=this.rules.block.lheading.exec(W);if(G)return{type:"heading",raw:G[0],depth:G[2].charAt(0)==="="?1:2,text:G[1]}},ee.paragraph=function(W){var G=this.rules.block.paragraph.exec(W);if(G)return{type:"paragraph",raw:G[0],text:G[1].charAt(G[1].length-1)===`
`?G[1].slice(0,-1):G[1]}},ee.text=function(W,G){var Y=this.rules.block.text.exec(W);if(Y){var q=G[G.length-1];return q&&q.type==="text"?{raw:Y[0],text:Y[0]}:{type:"text",raw:Y[0],text:Y[0]}}},ee.escape=function(W){var G=this.rules.inline.escape.exec(W);if(G)return{type:"escape",raw:G[0],text:Q(G[1])}},ee.tag=function(W,G,Y){var q=this.rules.inline.tag.exec(W);if(q)return!G&&/^<a /i.test(q[0])?G=!0:G&&/^<\/a>/i.test(q[0])&&(G=!1),!Y&&/^<(pre|code|kbd|script)(\s|>)/i.test(q[0])?Y=!0:Y&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(q[0])&&(Y=!1),{type:this.options.sanitize?"text":"html",raw:q[0],inLink:G,inRawBlock:Y,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(q[0]):Q(q[0]):q[0]}},ee.link=function(W){var G=this.rules.inline.link.exec(W);if(G){var Y=ae(G[2],"()");if(Y>-1){var q=G[0].indexOf("!")===0?5:4,ue=q+G[1].length+Y;G[2]=G[2].substring(0,Y),G[0]=G[0].substring(0,ue).trim(),G[3]=""}var ce=G[2],Ae="";if(this.options.pedantic){var Ge=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(ce);Ge?(ce=Ge[1],Ae=Ge[3]):Ae=""}else Ae=G[3]?G[3].slice(1,-1):"";ce=ce.trim().replace(/^<([\s\S]*)>$/,"$1");var Xe=oe(G,{href:ce&&ce.replace(this.rules.inline._escapes,"$1"),title:Ae&&Ae.replace(this.rules.inline._escapes,"$1")},G[0]);return Xe}},ee.reflink=function(W,G){var Y;if((Y=this.rules.inline.reflink.exec(W))||(Y=this.rules.inline.nolink.exec(W))){var q=(Y[2]||Y[1]).replace(/\s+/g," ");if(q=G[q.toLowerCase()],!q||!q.href){var ue=Y[0].charAt(0);return{type:"text",raw:ue,text:ue}}var ce=oe(Y,q,Y[0]);return ce}},ee.strong=function(W,G,Y){Y===void 0&&(Y="");var q=this.rules.inline.strong.start.exec(W);if(q&&(!q[1]||q[1]&&(Y===""||this.rules.inline.punctuation.exec(Y)))){G=G.slice(-1*W.length);var ue=q[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ue.lastIndex=0;for(var ce;(q=ue.exec(G))!=null;)if(ce=this.rules.inline.strong.middle.exec(G.slice(0,q.index+3)),ce)return{type:"strong",raw:W.slice(0,ce[0].length),text:W.slice(2,ce[0].length-2)}}},ee.em=function(W,G,Y){Y===void 0&&(Y="");var q=this.rules.inline.em.start.exec(W);if(q&&(!q[1]||q[1]&&(Y===""||this.rules.inline.punctuation.exec(Y)))){G=G.slice(-1*W.length);var ue=q[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ue.lastIndex=0;for(var ce;(q=ue.exec(G))!=null;)if(ce=this.rules.inline.em.middle.exec(G.slice(0,q.index+2)),ce)return{type:"em",raw:W.slice(0,ce[0].length),text:W.slice(1,ce[0].length-1)}}},ee.codespan=function(W){var G=this.rules.inline.code.exec(W);if(G){var Y=G[2].replace(/\n/g," "),q=/[^ ]/.test(Y),ue=Y.startsWith(" ")&&Y.endsWith(" ");return q&&ue&&(Y=Y.substring(1,Y.length-1)),Y=Q(Y,!0),{type:"codespan",raw:G[0],text:Y}}},ee.br=function(W){var G=this.rules.inline.br.exec(W);if(G)return{type:"br",raw:G[0]}},ee.del=function(W){var G=this.rules.inline.del.exec(W);if(G)return{type:"del",raw:G[0],text:G[1]}},ee.autolink=function(W,G){var Y=this.rules.inline.autolink.exec(W);if(Y){var q,ue;return Y[2]==="@"?(q=Q(this.options.mangle?G(Y[1]):Y[1]),ue="mailto:"+q):(q=Q(Y[1]),ue=q),{type:"link",raw:Y[0],text:q,href:ue,tokens:[{type:"text",raw:q,text:q}]}}},ee.url=function(W,G){var Y;if(Y=this.rules.inline.url.exec(W)){var q,ue;if(Y[2]==="@")q=Q(this.options.mangle?G(Y[0]):Y[0]),ue="mailto:"+q;else{var ce;do ce=Y[0],Y[0]=this.rules.inline._backpedal.exec(Y[0])[0];while(ce!==Y[0]);q=Q(Y[0]),Y[1]==="www."?ue="http://"+q:ue=q}return{type:"link",raw:Y[0],text:q,href:ue,tokens:[{type:"text",raw:q,text:q}]}}},ee.inlineText=function(W,G,Y){var q=this.rules.inline.text.exec(W);if(q){var ue;return G?ue=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(q[0]):Q(q[0]):q[0]:ue=Q(this.options.smartypants?Y(q[0]):q[0]),{type:"text",raw:q[0],text:ue}}},re}(),fe=j.noopTest,pe=j.edit,me=j.merge,ie={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:fe,table:fe,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ie._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ie._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ie.def=pe(ie.def).replace("label",ie._label).replace("title",ie._title).getRegex(),ie.bullet=/(?:[*+-]|\d{1,9}[.)])/,ie.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ie.item=pe(ie.item,"gm").replace(/bull/g,ie.bullet).getRegex(),ie.list=pe(ie.list).replace(/bull/g,ie.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ie.def.source+")").getRegex(),ie._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",ie._comment=/<!--(?!-?>)[\s\S]*?-->/,ie.html=pe(ie.html,"i").replace("comment",ie._comment).replace("tag",ie._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ie.paragraph=pe(ie._paragraph).replace("hr",ie.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",ie._tag).getRegex(),ie.blockquote=pe(ie.blockquote).replace("paragraph",ie.paragraph).getRegex(),ie.normal=me({},ie),ie.gfm=me({},ie.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*|$)"}),ie.gfm.nptable=pe(ie.gfm.nptable).replace("hr",ie.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",ie._tag).getRegex(),ie.gfm.table=pe(ie.gfm.table).replace("hr",ie.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",ie._tag).getRegex(),ie.pedantic=me({},ie.normal,{html:pe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ie._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:fe,paragraph:pe(ie.normal._paragraph).replace("hr",ie.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",ie.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var J={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:fe,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:fe,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};J._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",J.punctuation=pe(J.punctuation).replace(/punctuation/g,J._punctuation).getRegex(),J._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",J._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",J.em.start=pe(J.em.start).replace(/punctuation/g,J._punctuation).getRegex(),J.em.middle=pe(J.em.middle).replace(/punctuation/g,J._punctuation).replace(/overlapSkip/g,J._overlapSkip).getRegex(),J.em.endAst=pe(J.em.endAst,"g").replace(/punctuation/g,J._punctuation).getRegex(),J.em.endUnd=pe(J.em.endUnd,"g").replace(/punctuation/g,J._punctuation).getRegex(),J.strong.start=pe(J.strong.start).replace(/punctuation/g,J._punctuation).getRegex(),J.strong.middle=pe(J.strong.middle).replace(/punctuation/g,J._punctuation).replace(/blockSkip/g,J._blockSkip).getRegex(),J.strong.endAst=pe(J.strong.endAst,"g").replace(/punctuation/g,J._punctuation).getRegex(),J.strong.endUnd=pe(J.strong.endUnd,"g").replace(/punctuation/g,J._punctuation).getRegex(),J.blockSkip=pe(J._blockSkip,"g").getRegex(),J.overlapSkip=pe(J._overlapSkip,"g").getRegex(),J._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,J._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,J._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])?)+(?![-_])/,J.autolink=pe(J.autolink).replace("scheme",J._scheme).replace("email",J._email).getRegex(),J._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,J.tag=pe(J.tag).replace("comment",ie._comment).replace("attribute",J._attribute).getRegex(),J._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,J._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,J._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,J.link=pe(J.link).replace("label",J._label).replace("href",J._href).replace("title",J._title).getRegex(),J.reflink=pe(J.reflink).replace("label",J._label).getRegex(),J.reflinkSearch=pe(J.reflinkSearch,"g").replace("reflink",J.reflink).replace("nolink",J.nolink).getRegex(),J.normal=me({},J),J.pedantic=me({},J.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:pe(/^!?\[(label)\]\((.*?)\)/).replace("label",J._label).getRegex(),reflink:pe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",J._label).getRegex()}),J.gfm=me({},J.normal,{escape:pe(J.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),J.gfm.url=pe(J.gfm.url,"i").replace("email",J.gfm._extended_email).getRegex(),J.breaks=me({},J.gfm,{br:pe(J.br).replace("{2,}","*").getRegex(),text:pe(J.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var ye={block:ie,inline:J},Pe=B.defaults,Le=ye.block,Re=ye.inline;function X(re){return re.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 $(re){var ee="",te,W,G=re.length;for(te=0;te<G;te++)W=re.charCodeAt(te),Math.random()>.5&&(W="x"+W.toString(16)),ee+="&#"+W+";";return ee}var ne=function(){function re(te){this.tokens=[],this.tokens.links=Object.create(null),this.options=te||Pe,this.options.tokenizer=this.options.tokenizer||new he,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var W={block:Le.normal,inline:Re.normal};this.options.pedantic?(W.block=Le.pedantic,W.inline=Re.pedantic):this.options.gfm&&(W.block=Le.gfm,this.options.breaks?W.inline=Re.breaks:W.inline=Re.gfm),this.tokenizer.rules=W}re.lex=function(W,G){var Y=new re(G);return Y.lex(W)};var ee=re.prototype;return ee.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},ee.blockTokens=function(W,G,Y){G===void 0&&(G=[]),Y===void 0&&(Y=!0),W=W.replace(/^ +$/gm,"");for(var q,ue,ce,Ae;W;){if(q=this.tokenizer.space(W)){W=W.substring(q.raw.length),q.type&&G.push(q);continue}if(q=this.tokenizer.code(W,G)){W=W.substring(q.raw.length),q.type?G.push(q):(Ae=G[G.length-1],Ae.raw+=`
`+q.raw,Ae.text+=`
`+q.text);continue}if(q=this.tokenizer.fences(W)){W=W.substring(q.raw.length),G.push(q);continue}if(q=this.tokenizer.heading(W)){W=W.substring(q.raw.length),G.push(q);continue}if(q=this.tokenizer.nptable(W)){W=W.substring(q.raw.length),G.push(q);continue}if(q=this.tokenizer.hr(W)){W=W.substring(q.raw.length),G.push(q);continue}if(q=this.tokenizer.blockquote(W)){W=W.substring(q.raw.length),q.tokens=this.blockTokens(q.text,[],Y),G.push(q);continue}if(q=this.tokenizer.list(W)){for(W=W.substring(q.raw.length),ce=q.items.length,ue=0;ue<ce;ue++)q.items[ue].tokens=this.blockTokens(q.items[ue].text,[],!1);G.push(q);continue}if(q=this.tokenizer.html(W)){W=W.substring(q.raw.length),G.push(q);continue}if(Y&&(q=this.tokenizer.def(W))){W=W.substring(q.raw.length),this.tokens.links[q.tag]||(this.tokens.links[q.tag]={href:q.href,title:q.title});continue}if(q=this.tokenizer.table(W)){W=W.substring(q.raw.length),G.push(q);continue}if(q=this.tokenizer.lheading(W)){W=W.substring(q.raw.length),G.push(q);continue}if(Y&&(q=this.tokenizer.paragraph(W))){W=W.substring(q.raw.length),G.push(q);continue}if(q=this.tokenizer.text(W,G)){W=W.substring(q.raw.length),q.type?G.push(q):(Ae=G[G.length-1],Ae.raw+=`
`+q.raw,Ae.text+=`
`+q.text);continue}if(W){var Ge="Infinite loop on byte: "+W.charCodeAt(0);if(this.options.silent){console.error(Ge);break}else throw new Error(Ge)}}return G},ee.inline=function(W){var G,Y,q,ue,ce,Ae,Ge=W.length;for(G=0;G<Ge;G++){Ae=W[G];switch(Ae.type){case"paragraph":case"text":case"heading":{Ae.tokens=[],this.inlineTokens(Ae.text,Ae.tokens);break}case"table":{for(Ae.tokens={header:[],cells:[]},ue=Ae.header.length,Y=0;Y<ue;Y++)Ae.tokens.header[Y]=[],this.inlineTokens(Ae.header[Y],Ae.tokens.header[Y]);for(ue=Ae.cells.length,Y=0;Y<ue;Y++)for(ce=Ae.cells[Y],Ae.tokens.cells[Y]=[],q=0;q<ce.length;q++)Ae.tokens.cells[Y][q]=[],this.inlineTokens(ce[q],Ae.tokens.cells[Y][q]);break}case"blockquote":{this.inline(Ae.tokens);break}case"list":{for(ue=Ae.items.length,Y=0;Y<ue;Y++)this.inline(Ae.items[Y].tokens);break}}}return W},ee.inlineTokens=function(W,G,Y,q,ue){G===void 0&&(G=[]),Y===void 0&&(Y=!1),q===void 0&&(q=!1),ue===void 0&&(ue="");var ce,Ae=W,Ge;if(this.tokens.links){var Xe=Object.keys(this.tokens.links);if(Xe.length>0)for(;(Ge=this.tokenizer.rules.inline.reflinkSearch.exec(Ae))!=null;)Xe.includes(Ge[0].slice(Ge[0].lastIndexOf("[")+1,-1))&&(Ae=Ae.slice(0,Ge.index)+"["+"a".repeat(Ge[0].length-2)+"]"+Ae.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Ge=this.tokenizer.rules.inline.blockSkip.exec(Ae))!=null;)Ae=Ae.slice(0,Ge.index)+"["+"a".repeat(Ge[0].length-2)+"]"+Ae.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;W;){if(ce=this.tokenizer.escape(W)){W=W.substring(ce.raw.length),G.push(ce);continue}if(ce=this.tokenizer.tag(W,Y,q)){W=W.substring(ce.raw.length),Y=ce.inLink,q=ce.inRawBlock,G.push(ce);continue}if(ce=this.tokenizer.link(W)){W=W.substring(ce.raw.length),ce.type==="link"&&(ce.tokens=this.inlineTokens(ce.text,[],!0,q)),G.push(ce);continue}if(ce=this.tokenizer.reflink(W,this.tokens.links)){W=W.substring(ce.raw.length),ce.type==="link"&&(ce.tokens=this.inlineTokens(ce.text,[],!0,q)),G.push(ce);continue}if(ce=this.tokenizer.strong(W,Ae,ue)){W=W.substring(ce.raw.length),ce.tokens=this.inlineTokens(ce.text,[],Y,q),G.push(ce);continue}if(ce=this.tokenizer.em(W,Ae,ue)){W=W.substring(ce.raw.length),ce.tokens=this.inlineTokens(ce.text,[],Y,q),G.push(ce);continue}if(ce=this.tokenizer.codespan(W)){W=W.substring(ce.raw.length),G.push(ce);continue}if(ce=this.tokenizer.br(W)){W=W.substring(ce.raw.length),G.push(ce);continue}if(ce=this.tokenizer.del(W)){W=W.substring(ce.raw.length),ce.tokens=this.inlineTokens(ce.text,[],Y,q),G.push(ce);continue}if(ce=this.tokenizer.autolink(W,$)){W=W.substring(ce.raw.length),G.push(ce);continue}if(!Y&&(ce=this.tokenizer.url(W,$))){W=W.substring(ce.raw.length),G.push(ce);continue}if(ce=this.tokenizer.inlineText(W,q,X)){W=W.substring(ce.raw.length),ue=ce.raw.slice(-1),G.push(ce);continue}if(W){var He="Infinite loop on byte: "+W.charCodeAt(0);if(this.options.silent){console.error(He);break}else throw new Error(He)}}return G},U(re,null,[{key:"rules",get:function(){return{block:Le,inline:Re}}}]),re}(),de=B.defaults,be=j.cleanUrl,ve=j.escape,Ee=function(){function re(te){this.options=te||de}var ee=re.prototype;return ee.code=function(W,G,Y){var q=(G||"").match(/\S*/)[0];if(this.options.highlight){var ue=this.options.highlight(W,q);ue!=null&&ue!==W&&(Y=!0,W=ue)}return q?'<pre><code class="'+this.options.langPrefix+ve(q,!0)+'">'+(Y?W:ve(W,!0))+`</code></pre>
`:"<pre><code>"+(Y?W:ve(W,!0))+`</code></pre>
`},ee.blockquote=function(W){return`<blockquote>
`+W+`</blockquote>
`},ee.html=function(W){return W},ee.heading=function(W,G,Y,q){return this.options.headerIds?"<h"+G+' id="'+this.options.headerPrefix+q.slug(Y)+'">'+W+"</h"+G+`>
`:"<h"+G+">"+W+"</h"+G+`>
`},ee.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},ee.list=function(W,G,Y){var q=G?"ol":"ul",ue=G&&Y!==1?' start="'+Y+'"':"";return"<"+q+ue+`>
`+W+"</"+q+`>
`},ee.listitem=function(W){return"<li>"+W+`</li>
`},ee.checkbox=function(W){return"<input "+(W?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ee.paragraph=function(W){return"<p>"+W+`</p>
`},ee.table=function(W,G){return G&&(G="<tbody>"+G+"</tbody>"),`<table>
<thead>
`+W+`</thead>
`+G+`</table>
`},ee.tablerow=function(W){return`<tr>
`+W+`</tr>
`},ee.tablecell=function(W,G){var Y=G.header?"th":"td",q=G.align?"<"+Y+' align="'+G.align+'">':"<"+Y+">";return q+W+"</"+Y+`>
`},ee.strong=function(W){return"<strong>"+W+"</strong>"},ee.em=function(W){return"<em>"+W+"</em>"},ee.codespan=function(W){return"<code>"+W+"</code>"},ee.br=function(){return this.options.xhtml?"<br/>":"<br>"},ee.del=function(W){return"<del>"+W+"</del>"},ee.link=function(W,G,Y){if(W=be(this.options.sanitize,this.options.baseUrl,W),W===null)return Y;var q='<a href="'+ve(W)+'"';return G&&(q+=' title="'+G+'"'),q+=">"+Y+"</a>",q},ee.image=function(W,G,Y){if(W=be(this.options.sanitize,this.options.baseUrl,W),W===null)return Y;var q='<img src="'+W+'" alt="'+Y+'"';return G&&(q+=' title="'+G+'"'),q+=this.options.xhtml?"/>":">",q},ee.text=function(W){return W},re}(),xe=function(){function re(){}var ee=re.prototype;return ee.strong=function(W){return W},ee.em=function(W){return W},ee.codespan=function(W){return W},ee.del=function(W){return W},ee.html=function(W){return W},ee.text=function(W){return W},ee.link=function(W,G,Y){return""+Y},ee.image=function(W,G,Y){return""+Y},ee.br=function(){return""},re}(),Be=function(){function re(){this.seen={}}var ee=re.prototype;return ee.slug=function(W){var G=W.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(G)){var Y=G;do this.seen[Y]++,G=Y+"-"+this.seen[Y];while(this.seen.hasOwnProperty(G))}return this.seen[G]=0,G},re}(),Ie=B.defaults,ke=j.unescape,Me=function(){function re(te){this.options=te||Ie,this.options.renderer=this.options.renderer||new Ee,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new xe,this.slugger=new Be}re.parse=function(W,G){var Y=new re(G);return Y.parse(W)};var ee=re.prototype;return ee.parse=function(W,G){G===void 0&&(G=!0);var Y="",q,ue,ce,Ae,Ge,Xe,He,Je,qe,ze,nt,lt,bt,vt,tt,St,Lt,Ye,$e=W.length;for(q=0;q<$e;q++){ze=W[q];switch(ze.type){case"space":continue;case"hr":{Y+=this.renderer.hr();continue}case"heading":{Y+=this.renderer.heading(this.parseInline(ze.tokens),ze.depth,ke(this.parseInline(ze.tokens,this.textRenderer)),this.slugger);continue}case"code":{Y+=this.renderer.code(ze.text,ze.lang,ze.escaped);continue}case"table":{for(Je="",He="",Ae=ze.header.length,ue=0;ue<Ae;ue++)He+=this.renderer.tablecell(this.parseInline(ze.tokens.header[ue]),{header:!0,align:ze.align[ue]});for(Je+=this.renderer.tablerow(He),qe="",Ae=ze.cells.length,ue=0;ue<Ae;ue++){for(Xe=ze.tokens.cells[ue],He="",Ge=Xe.length,ce=0;ce<Ge;ce++)He+=this.renderer.tablecell(this.parseInline(Xe[ce]),{header:!1,align:ze.align[ce]});qe+=this.renderer.tablerow(He)}Y+=this.renderer.table(Je,qe);continue}case"blockquote":{qe=this.parse(ze.tokens),Y+=this.renderer.blockquote(qe);continue}case"list":{for(nt=ze.ordered,lt=ze.start,bt=ze.loose,Ae=ze.items.length,qe="",ue=0;ue<Ae;ue++)tt=ze.items[ue],St=tt.checked,Lt=tt.task,vt="",tt.task&&(Ye=this.renderer.checkbox(St),bt?tt.tokens.length>0&&tt.tokens[0].type==="text"?(tt.tokens[0].text=Ye+" "+tt.tokens[0].text,tt.tokens[0].tokens&&tt.tokens[0].tokens.length>0&&tt.tokens[0].tokens[0].type==="text"&&(tt.tokens[0].tokens[0].text=Ye+" "+tt.tokens[0].tokens[0].text)):tt.tokens.unshift({type:"text",text:Ye}):vt+=Ye),vt+=this.parse(tt.tokens,bt),qe+=this.renderer.listitem(vt,Lt,St);Y+=this.renderer.list(qe,nt,lt);continue}case"html":{Y+=this.renderer.html(ze.text);continue}case"paragraph":{Y+=this.renderer.paragraph(this.parseInline(ze.tokens));continue}case"text":{for(qe=ze.tokens?this.parseInline(ze.tokens):ze.text;q+1<$e&&W[q+1].type==="text";)ze=W[++q],qe+=`
`+(ze.tokens?this.parseInline(ze.tokens):ze.text);Y+=G?this.renderer.paragraph(qe):qe;continue}default:{var We='Token with "'+ze.type+'" type was not found.';if(this.options.silent){console.error(We);return}else throw new Error(We)}}}return Y},ee.parseInline=function(W,G){G=G||this.renderer;var Y="",q,ue,ce=W.length;for(q=0;q<ce;q++){ue=W[q];switch(ue.type){case"escape":{Y+=G.text(ue.text);break}case"html":{Y+=G.html(ue.text);break}case"link":{Y+=G.link(ue.href,ue.title,this.parseInline(ue.tokens,G));break}case"image":{Y+=G.image(ue.href,ue.title,ue.text);break}case"strong":{Y+=G.strong(this.parseInline(ue.tokens,G));break}case"em":{Y+=G.em(this.parseInline(ue.tokens,G));break}case"codespan":{Y+=G.codespan(ue.text);break}case"br":{Y+=G.br();break}case"del":{Y+=G.del(this.parseInline(ue.tokens,G));break}case"text":{Y+=G.text(ue.text);break}default:{var Ae='Token with "'+ue.type+'" type was not found.';if(this.options.silent){console.error(Ae);return}else throw new Error(Ae)}}}return Y},re}(),Ue=j.merge,Fe=j.checkSanitizeDeprecation,je=j.escape,we=B.getDefaults,Oe=B.changeDefaults,_e=B.defaults;function ge(re,ee,te){if(typeof re=="undefined"||re===null)throw new Error("marked(): input parameter is undefined or null");if(typeof re!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(re)+", string expected");if(typeof ee=="function"&&(te=ee,ee=null),ee=Ue({},ge.defaults,ee||{}),Fe(ee),te){var W=ee.highlight,G;try{G=ne.lex(re,ee)}catch(ce){return te(ce)}var Y=function(Ae){var Ge;if(!Ae)try{Ge=Me.parse(G,ee)}catch(Xe){Ae=Xe}return ee.highlight=W,Ae?te(Ae):te(null,Ge)};if(!W||W.length<3)return Y();if(delete ee.highlight,!G.length)return Y();var q=0;ge.walkTokens(G,function(ce){ce.type==="code"&&(q++,setTimeout(function(){W(ce.text,ce.lang,function(Ae,Ge){if(Ae)return Y(Ae);Ge!=null&&Ge!==ce.text&&(ce.text=Ge,ce.escaped=!0),q--,q===0&&Y()})},0))}),q===0&&Y();return}try{var ue=ne.lex(re,ee);return ee.walkTokens&&ge.walkTokens(ue,ee.walkTokens),Me.parse(ue,ee)}catch(ce){if(ce.message+=`
Please report this to https://github.com/markedjs/marked.`,ee.silent)return"<p>An error occurred:</p><pre>"+je(ce.message+"",!0)+"</pre>";throw ce}}ge.options=ge.setOptions=function(re){return Ue(ge.defaults,re),Oe(ge.defaults),ge},ge.getDefaults=we,ge.defaults=_e,ge.use=function(re){var ee=Ue({},re);if(re.renderer&&function(){var W=ge.defaults.renderer||new Ee,G=function(ue){var ce=W[ue];W[ue]=function(){for(var Ae=arguments.length,Ge=new Array(Ae),Xe=0;Xe<Ae;Xe++)Ge[Xe]=arguments[Xe];var He=re.renderer[ue].apply(W,Ge);return He===!1&&(He=ce.apply(W,Ge)),He}};for(var Y in re.renderer)G(Y);ee.renderer=W}(),re.tokenizer&&function(){var W=ge.defaults.tokenizer||new he,G=function(ue){var ce=W[ue];W[ue]=function(){for(var Ae=arguments.length,Ge=new Array(Ae),Xe=0;Xe<Ae;Xe++)Ge[Xe]=arguments[Xe];var He=re.tokenizer[ue].apply(W,Ge);return He===!1&&(He=ce.apply(W,Ge)),He}};for(var Y in re.tokenizer)G(Y);ee.tokenizer=W}(),re.walkTokens){var te=ge.defaults.walkTokens;ee.walkTokens=function(W){re.walkTokens(W),te&&te(W)}}ge.setOptions(ee)},ge.walkTokens=function(re,ee){for(var te=D(re),W;!(W=te()).done;){var G=W.value;ee(G);switch(G.type){case"table":{for(var Y=D(G.tokens.header),q;!(q=Y()).done;){var ue=q.value;ge.walkTokens(ue,ee)}for(var ce=D(G.tokens.cells),Ae;!(Ae=ce()).done;)for(var Ge=Ae.value,Xe=D(Ge),He;!(He=Xe()).done;){var Je=He.value;ge.walkTokens(Je,ee)}break}case"list":{ge.walkTokens(G.items,ee);break}default:G.tokens&&ge.walkTokens(G.tokens,ee)}}},ge.Parser=Me,ge.parser=Me.parse,ge.Renderer=Ee,ge.TextRenderer=xe,ge.Lexer=ne,ge.lexer=ne.lex,ge.Tokenizer=he,ge.Slugger=Be,ge.parse=ge;var De=ge;return De})},EjUQ:function(Ze,le,H){"use strict";H.r(le);var se=H("DjyN"),U=H("NUBc"),S=H("cWXX"),k=H("/ezw"),D=H("/zsF"),L=H("PArb"),B=H("14J3"),_=H("BMrR"),A=H("jCWc"),C=H("kPKH"),s=H("k1fw"),m=H("tJVT"),b=H("PpiC"),c=H("B9cy"),v=H("Ol7k"),x=H("lUTK"),n=H("BvKs"),e=H("q1tI"),t=H.n(e),i=H("9kvl"),p=H("wd/R"),u=H.n(p),h=H("m3rI"),T=H("BdwD"),g=H("2qtc"),f=H("kLXV"),l=H("5NDa"),r=H("5rEg"),a=H("jrin"),y=H("miYZ"),E=H("tsqr"),w=H("9og8"),R=H("y8nQ"),M=H("Vl3Y"),N=H("WmNS"),j=H.n(N),K=H("5WQS"),V=H("Ty5D"),z=H("NDqe"),Q=H.n(z),ae=function(Pe){var Le,Re=Pe.messages,X=Pe.loading,$=Pe.user,ne=Pe.dispatch,de=Object(V.i)(),be=Object(V.h)(),ve=Re.actionTabs,Ee=M.a.useForm(),xe=Object(m.a)(Ee,1),Be=xe[0],Ie=Re.recentContacts,ke=Object(e.useState)(""),Me=Object(m.a)(ke,2),Ue=Me[0],Fe=Me[1],je=Object(e.useState)([]),we=Object(m.a)(je,2),Oe=we[0],_e=we[1],ge=Object(e.useState)(!1),De=Object(m.a)(ge,2),re=De[0],ee=De[1],te=Object(e.useState)(),W=Object(m.a)(te,2),G=W[0],Y=W[1];Object(e.useEffect)(function(){Re.actionTabs.key==="\u5199\u79C1\u4FE1"&&q()},[Re.actionTabs.key]);var q=function(){var ce=Object(w.a)(j.a.mark(function Ae(){var Ge,Xe;return j.a.wrap(function(Je){for(;;)switch(Je.prev=Je.next){case 0:return Je.next=2,ne({type:"messages/getRecentContacts",payload:{id:$==null||((Ge=$.userInfo)===null||Ge===void 0)?void 0:Ge.user_id,keyword:Ue}});case 2:Xe=Je.sent,_e(Object(s.a)({},Xe));case 4:case"end":return Je.stop()}},Ae)}));return function(){return ce.apply(this,arguments)}}(),ue=function(){var ce=Object(w.a)(j.a.mark(function Ae(){var Ge;return j.a.wrap(function(He){for(;;)switch(He.prev=He.next){case 0:if(!(Ue!=="")){He.next=5;break}return He.next=3,ne({type:"messages/getUsersForPrivateMessages",payload:{keyword:Ue}});case 3:Ge=He.sent,_e(Object(s.a)({},Ge));case 5:case"end":return He.stop()}},Ae)}));return function(){return ce.apply(this,arguments)}}();return Object(e.useEffect)(function(){ue()},[Ue]),t.a.createElement(f.a,{centered:!0,title:"\u5199\u79C1\u4FE1",visible:Re.actionTabs.key==="\u5199\u79C1\u4FE1",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",bodyStyle:{height:320},onOk:Object(w.a)(j.a.mark(function ce(){var Ae,Ge,Xe,He,Je,qe;return j.a.wrap(function(nt){for(;;)switch(nt.prev=nt.next){case 0:return nt.next=2,Be.validateFields();case 2:return Ge=Be.getFieldValue(),Xe="/api/course_modules/".concat(de.categoryId,"/add_second_category.json"),nt.next=6,Object(K.g)({content:Ge.content,target_id:G,userId:$==null||((Ae=$.userInfo)===null||Ae===void 0)?void 0:Ae.user_id});case 6:He=nt.sent,He.status===0&&(E.b.success("\u6DFB\u52A0\u6210\u529F"),ne({type:"messages/setActionTabs",payload:{}}),i.d.push("/messages/".concat($==null||((Je=$.userInfo)===null||Je===void 0)?void 0:Je.login,"/message_detail?target_ids=").concat(He==null||((qe=He.private_message)===null||qe===void 0)?void 0:qe.receiver_id)));case 8:case"end":return nt.stop()}},ce)})),onCancel:function(){ne({type:"messages/setActionTabs",payload:{}})}},t.a.createElement(M.a,{form:Be,initialValues:Object(a.a)({},"name","")},t.a.createElement(M.a.Item,{name:"users",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u53D1\u9001\u5BF9\u8C61"}]},t.a.createElement(r.a.Search,{onFocus:function(){return ee(!0)},onSearch:function(Ae){Fe(Ae)},placeholder:"\u53D1\u9001\u7ED9..."})),re&&t.a.createElement(k.a,{loading:X["messages/getUsersForPrivateMessages"]},t.a.createElement("aside",{className:Q.a.searchWrp,style:{maxHeight:260,overflow:"auto"}},t.a.createElement("p",{className:"c-light-black mt10"},Ue===""?"\u6700\u8FD1\u8054\u7CFB\u4EBA":"\u641C\u7D22\u7ED3\u679C"),Oe==null||((Le=Oe.users)===null||Le===void 0)?void 0:Le.map(function(ce,Ae){return t.a.createElement(_.a,{key:Ae,align:"middle",className:"mt15 current",onClick:function(){Y(ce.id),Be.setFieldsValue({users:ce.name}),ee(!1)}},t.a.createElement(C.a,{flex:"58px"},t.a.createElement("img",{style:{width:48,borderRadius:48},src:h.a.IMG_SERVER+"/images/"+(ce==null?void 0:ce.image_url),alt:""})),t.a.createElement(C.a,null,ce.name))}))),t.a.createElement(M.a.Item,{rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u53D1\u9001\u5185\u5BB9"}],className:re&&"hide",name:"content"},t.a.createElement(r.a.TextArea,{rows:10,maxLength:200}))))},oe=Object(i.a)(function(ye){var Pe=ye.messages,Le=ye.loading,Re=ye.user;return{messages:Pe,user:Re,loading:Le.effects}})(ae),Ce=H("9Bee"),he=H("30zm"),fe=n.a.SubMenu,pe=v.a.Sider,me=v.a.Content,ie=function(Pe){var Le,Re,X=Pe.messages,$=Pe.globalSetting,ne=Pe.loading,de=Pe.user,be=Pe.dispatch,ve=Object(b.a)(Pe,["messages","globalSetting","loading","user","dispatch"]),Ee=ve.match.params,xe=de.userInfo,Be=X.tidingsList,Ie=X.privateMessage,ke=Object(e.useState)({per_page:10,page:1}),Me=Object(m.a)(ke,2),Ue=Me[0],Fe=Me[1];Object(e.useEffect)(function(){Ue.page=1,je()},[Ee.userId]);var je=function(){be({type:"messages/getPrivateMessages",payload:Object(s.a)(Object(s.a)({},Ue),Ee)})},we=function(ge){var De,re;ve.history.push("/messages/".concat(de==null||((De=de.userInfo)===null||De===void 0)?void 0:De.login,"/message_detail?target_ids=").concat(ge==null||((re=ge.target)===null||re===void 0)?void 0:re.id))},Oe=function(ge){var De;ve.history.push("/users/".concat(ge==null||((De=ge.target)===null||De===void 0)?void 0:De.login))};return t.a.createElement("section",{className:Q.a.bg},t.a.createElement("section",{className:"edu-container mt20"},t.a.createElement(_.a,{gutter:[20,20]},t.a.createElement(he.a,null),t.a.createElement(C.a,{flex:"1"},t.a.createElement("aside",{className:"bg-white"},t.a.createElement("aside",{className:"pt30 pl30 pr30 font16"},t.a.createElement(_.a,null,t.a.createElement(C.a,{flex:"1"},"\u5168\u90E8\u79C1\u4FE1"),t.a.createElement(C.a,null,t.a.createElement("span",{className:"c-blue current",onClick:function(){var ge;be({type:"messages/setActionTabs",payload:{key:"\u5199\u79C1\u4FE1",bodyParams:Object(s.a)(Object(s.a)({},Ue),{},{user_id:de==null||((ge=de.userInfo)===null||ge===void 0)?void 0:ge.user_id})}})}},"\u5199\u79C1\u4FE1")))),t.a.createElement(L.a,null),t.a.createElement("aside",{className:Q.a.list},t.a.createElement(k.a,{active:!0,avatar:{size:40},paragraph:{rows:5},loading:ne["messages/getPrivateMessages"]},!(Ie!=null&&(Le=Ie.private_messages)!==null&&Le!==void 0&&Le.length)&&t.a.createElement(T.a,null),Ie==null||((Re=Ie.private_messages)===null||Re===void 0)?void 0:Re.map(function(_e,ge){var De,re;return t.a.createElement("aside",null,t.a.createElement(_.a,null,t.a.createElement(C.a,{flex:"58px",onClick:function(){return Oe(_e)}},t.a.createElement("img",{src:h.a.IMG_SERVER+"/images/"+(_e==null||((De=_e.target)===null||De===void 0)?void 0:De.image_url),alt:""})),t.a.createElement(C.a,{flex:1},t.a.createElement(_.a,null,t.a.createElement(C.a,{span:24},t.a.createElement(_.a,null,t.a.createElement(C.a,{flex:"1"},t.a.createElement("span",{onClick:function(){return Oe(_e)}},_e==null||((re=_e.target)===null||re===void 0)?void 0:re.name),t.a.createElement("span",{className:"ml15"},"\u4E0E\u4F60\u7684\u79C1\u4FE1"),t.a.createElement("span",{className:"c-light-black mr15"},"[",_e==null?void 0:_e.message_count,"\u6761]"),t.a.createElement("span",{className:"ml15 c-light-black"},u()(_e.send_time).fromNow())),t.a.createElement(C.a,null,(_e==null?void 0:_e.unread)&&t.a.createElement("span",{className:Q.a.newlight})))),t.a.createElement(C.a,{span:24,onClick:function(){return we(_e)}},t.a.createElement("div",{className:"mt15"},t.a.createElement(Ce.a,{value:_e.content||""})))))))})))),t.a.createElement("aside",{className:"tc mt20"},!ne["messages/getTidings"]&&t.a.createElement(U.a,{hideOnSinglePage:!0,showSizeChanger:!1,onChange:function(ge){Ue.page=ge,Fe(Object(s.a)({},Ue)),je()},current:Ue.page||1,total:Ie==null?void 0:Ie.count}))))),t.a.createElement(oe,null))},J=le.default=Object(i.a)(function(ye){var Pe=ye.messages,Le=ye.loading,Re=ye.user,X=ye.globalSetting;return{messages:Pe,globalSetting:X,user:Re,loading:Le.effects}})(ie)},FOrL:function(Ze,le,H){Ze.exports=H.p+"static/nodata.a6b3f948.png"},JYp7:function(Ze,le,H){"use strict";H.d(le,"c",function(){return U}),H.d(le,"d",function(){return S}),H.d(le,"f",function(){return D}),H.d(le,"a",function(){return L}),H.d(le,"b",function(){return B}),H.d(le,"e",function(){return _});var se=function(){var A=function(C,s){return A=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,b){m.__proto__=b}||function(m,b){for(var c in b)b.hasOwnProperty(c)&&(m[c]=b[c])},A(C,s)};return function(C,s){A(C,s);function m(){this.constructor=C}C.prototype=s===null?Object.create(s):(m.prototype=s.prototype,new m)}}(),U={done:!0,value:void 0},S;(function(A){var C={next:function(){return U}};function s(){return C}A.empty=s;function m(u){var h=!1;return{next:function(){return h?U:(h=!0,{done:!1,value:u})}}}A.single=m;function b(u,h,T){return h===void 0&&(h=0),T===void 0&&(T=u.length),{next:function(){return h>=T?U:{done:!1,value:u[h++]}}}}A.fromArray=b;function c(u){return{next:function(){var h=u.next();return h.done?U:{done:!1,value:h.value}}}}A.fromNativeIterator=c;function v(u){return u?Array.isArray(u)?A.fromArray(u):u:A.empty()}A.from=v;function x(u,h){return{next:function(){var T=u.next();return T.done?U:{done:!1,value:h(T.value)}}}}A.map=x;function n(u,h){return{next:function(){for(;;){var T=u.next();if(T.done)return U;if(h(T.value))return{done:!1,value:T.value}}}}}A.filter=n;function e(u,h){for(var T=u.next();!T.done;T=u.next())h(T.value)}A.forEach=e;function t(u,h){h===void 0&&(h=Number.POSITIVE_INFINITY);var T=[];if(h===0)return T;for(var g=0,f=u.next();!f.done&&!(T.push(f.value),++g>=h);f=u.next());return T}A.collect=t;function i(){for(var u=[],h=0;h<arguments.length;h++)u[h]=arguments[h];var T=0;return{next:function(){if(T>=u.length)return U;var g=u[T],f=g.next();return f.done?(T++,this.next()):f}}}A.concat=i;function p(u){return new k(u)}A.chain=p})(S||(S={}));var k=function(){function A(C){this.it=C}return A.prototype.next=function(){return this.it.next()},A}();function D(A){return Array.isArray(A)?S.fromArray(A):A||S.empty()}var L=function(){function A(C,s,m,b){s===void 0&&(s=0),m===void 0&&(m=C.length),b===void 0&&(b=s-1),this.items=C,this.start=s,this.end=m,this.index=b}return A.prototype.first=function(){return this.index=this.start,this.current()},A.prototype.next=function(){return this.index=Math.min(this.index+1,this.end),this.current()},A.prototype.current=function(){return this.index===this.start-1||this.index===this.end?null:this.items[this.index]},A}(),B=function(A){se(C,A);function C(s,m,b,c){return m===void 0&&(m=0),b===void 0&&(b=s.length),c===void 0&&(c=m-1),A.call(this,s,m,b,c)||this}return C.prototype.current=function(){return A.prototype.current.call(this)},C.prototype.previous=function(){return this.index=Math.max(this.index-1,this.start-1),this.current()},C.prototype.first=function(){return this.index=this.start,this.current()},C.prototype.last=function(){return this.index=this.end-1,this.current()},C.prototype.parent=function(){return null},C}(L),_=function(){function A(C,s){this.iterator=C,this.fn=s}return A.prototype.next=function(){return this.fn(this.iterator.next())},A}()},LdHM:function(Ze,le,H){"use strict";H.d(le,"b",function(){return i}),H.d(le,"a",function(){return u});var se=H("1OyB"),U=H("vuIU"),S=H("Ji7U"),k=H("LK+K"),D=H("q1tI"),L=H("rePB"),B=H("Ff2n"),_=H("ODXe"),A=H("4IlW"),C=H("bX4T"),s=H("YrtM"),m=H("TSYQ"),b=H.n(m),c=H("+nKL"),v=H("8OUc"),x=function(z,Q){var ae=z.prefixCls,oe=z.id,Ce=z.flattenOptions,he=z.childrenAsData,fe=z.values,pe=z.searchValue,me=z.multiple,ie=z.defaultActiveFirstOption,J=z.height,ye=z.itemHeight,Pe=z.notFoundContent,Le=z.open,Re=z.menuItemSelectedIcon,X=z.virtual,$=z.onSelect,ne=z.onToggleOpen,de=z.onActiveValue,be=z.onScroll,ve=z.onMouseEnter,Ee="".concat(ae,"-item"),xe=Object(s.a)(function(){return Ce},[Le,Ce],function(De,re){return re[0]&&De[1]!==re[1]}),Be=D.useRef(null),Ie=function(re){re.preventDefault()},ke=function(re){Be.current&&Be.current.scrollTo({index:re})},Me=function(re){for(var ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,te=xe.length,W=0;W<te;W+=1){var G=(re+W*ee+te)%te,Y=xe[G],q=Y.group,ue=Y.data;if(!q&&!ue.disabled)return G}return-1},Ue=D.useState(function(){return Me(0)}),Fe=Object(_.a)(Ue,2),je=Fe[0],we=Fe[1],Oe=function(re){we(re);var ee=xe[re];if(!ee){de(null,-1);return}de(ee.data.value,re)};D.useEffect(function(){Oe(ie!==!1?Me(0):-1)},[xe.length,pe]),D.useEffect(function(){var De=setTimeout(function(){if(!me&&Le&&fe.size===1){var re=Array.from(fe)[0],ee=xe.findIndex(function(te){var W=te.data;return W.value===re});Oe(ee),ke(ee)}});return function(){return clearTimeout(De)}},[Le]);var _e=function(re){re!==void 0&&$(re,{selected:!fe.has(re)}),me||ne(!1)};if(D.useImperativeHandle(Q,function(){return{onKeyDown:function(re){var ee=re.which;switch(ee){case A.a.UP:case A.a.DOWN:{var te=0;if(ee===A.a.UP?te=-1:ee===A.a.DOWN&&(te=1),te!==0){var W=Me(je+te,te);ke(W),Oe(W)}break}case A.a.ENTER:{var G=xe[je];G&&!G.data.disabled?_e(G.data.value):_e(void 0),Le&&re.preventDefault();break}case A.a.ESC:ne(!1)}},onKeyUp:function(){},scrollTo:function(re){ke(re)}}}),xe.length===0)return D.createElement("div",{role:"listbox",id:"".concat(oe,"_list"),className:"".concat(Ee,"-empty"),onMouseDown:Ie},Pe);function ge(De){var re=xe[De];if(!re)return null;var ee=re.data||{},te=ee.value,W=ee.label,G=ee.children,Y=Object(C.a)(ee,!0),q=he?G:W;return re?D.createElement("div",Object.assign({"aria-label":typeof q=="string"?q:null},Y,{key:De,role:"option",id:"".concat(oe,"_list_").concat(De),"aria-selected":fe.has(te)}),te):null}return D.createElement(D.Fragment,null,D.createElement("div",{role:"listbox",id:"".concat(oe,"_list"),style:{height:0,width:0,overflow:"hidden"}},ge(je-1),ge(je),ge(je+1)),D.createElement(c.a,{itemKey:"key",ref:Be,data:xe,height:J,itemHeight:ye,fullHeight:!1,onMouseDown:Ie,onScroll:be,virtual:X,onMouseEnter:ve},function(De,re){var ee,te=De.group,W=De.groupOption,G=De.data,Y=G.label,q=G.key;if(te)return D.createElement("div",{className:b()(Ee,"".concat(Ee,"-group"))},Y!==void 0?Y:q);var ue=G.disabled,ce=G.value,Ae=G.title,Ge=G.children,Xe=G.style,He=G.className,Je=Object(B.a)(G,["disabled","value","title","children","style","className"]),qe=fe.has(ce),ze="".concat(Ee,"-option"),nt=b()(Ee,ze,He,(ee={},Object(L.a)(ee,"".concat(ze,"-grouped"),W),Object(L.a)(ee,"".concat(ze,"-active"),je===re&&!ue),Object(L.a)(ee,"".concat(ze,"-disabled"),ue),Object(L.a)(ee,"".concat(ze,"-selected"),qe),ee)),lt=he?Ge:Y,bt=!Re||typeof Re=="function"||qe;return D.createElement("div",Object.assign({},Je,{"aria-selected":qe,className:nt,title:Ae,onMouseMove:function(){if(je===re||ue)return;Oe(re)},onClick:function(){ue||_e(ce)},style:Xe}),D.createElement("div",{className:"".concat(ze,"-content")},lt||ce),D.isValidElement(Re)||qe,bt&&D.createElement(v.a,{className:"".concat(Ee,"-option-state"),customizeIcon:Re,customizeIconProps:{isSelected:qe}},qe?"\u2713":null))}))},n=D.forwardRef(x);n.displayName="OptionList";var e=n,t=function(){return null};t.isSelectOption=!0;var i=t,p=function(){return null};p.isSelectOptGroup=!0;var u=p,h=H("VTBJ"),T=H("Zm9Q");function g(V){var z=V.key,Q=V.props,ae=Q.children,oe=Q.value,Ce=Object(B.a)(Q,["children","value"]);return Object(h.a)({key:z,value:oe!==void 0?oe:z,children:ae},Ce)}function f(V){var z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(T.a)(V).map(function(Q,ae){if(!D.isValidElement(Q)||!Q.type)return null;var oe=Q.type.isSelectOptGroup,Ce=Q.key,he=Q.props,fe=he.children,pe=Object(B.a)(he,["children"]);return z||!oe?g(Q):Object(h.a)(Object(h.a)({key:"__RC_SELECT_GRP__".concat(Ce===null?ae:Ce,"__"),label:Ce},pe),{},{options:f(fe)})}).filter(function(Q){return Q})}var l=H("2Qr1"),r=H("qNPg"),a=H("U8pU"),y=H("Kwbf"),E=H("WKfj");function w(V){var z=V.mode,Q=V.options,ae=V.children,oe=V.backfill,Ce=V.allowClear,he=V.placeholder,fe=V.getInputElement,pe=V.showSearch,me=V.onSearch,ie=V.defaultOpen,J=V.autoFocus,ye=V.labelInValue,Pe=V.value,Le=V.inputValue,Re=V.optionLabelProp,X=z==="multiple"||z==="tags",$=pe!==void 0?pe:X||z==="combobox",ne=Q||f(ae);if(Object(y.a)(z!=="tags"||ne.every(function(Ee){return!Ee.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),z==="tags"||z==="combobox"){var de=ne.some(function(Ee){return Ee.options?Ee.options.some(function(xe){return typeof("value"in xe?xe.value:xe.key)=="number"}):typeof("value"in Ee?Ee.value:Ee.key)=="number"});Object(y.a)(!de,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(y.a)(z!=="combobox"||!Re,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(y.a)(z==="combobox"||!oe,"`backfill` only works with `combobox` mode."),Object(y.a)(z==="combobox"||!fe,"`getInputElement` only work with `combobox` mode."),Object(y.b)(z!=="combobox"||!fe||!Ce||!he,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),me&&!$&&z!=="combobox"&&z!=="tags"&&Object(y.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(y.b)(!ie||J,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),Pe!=null){var be=Object(E.d)(Pe);Object(y.a)(!ye||be.every(function(Ee){return Object(a.a)(Ee)==="object"&&("key"in Ee||"value"in Ee)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(y.a)(!X||Array.isArray(Pe),"`value` should be array when `mode` is `multiple` or `tags`")}if(ae){var ve=null;Object(T.a)(ae).some(function(Ee){if(!D.isValidElement(Ee)||!Ee.type)return!1;var xe=Ee.type;if(xe.isSelectOption)return!1;if(xe.isSelectOptGroup){var Be=Object(T.a)(Ee.props.children).every(function(Ie){return!D.isValidElement(Ie)||!Ee.type||Ie.type.isSelectOption?!0:(ve=Ie.type,!1)});return!Be}return ve=xe,!0}),ve&&Object(y.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(ve.displayName||ve.name||ve,"`.")),Object(y.a)(Le===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var R=w,M=Object(r.a)({prefixCls:"rc-select",components:{optionList:e},convertChildrenToData:f,flattenOptions:l.d,getLabeledValue:l.e,filterOptions:l.b,isValueDisabled:l.g,findValueOption:l.c,warningProps:R,fillOptionsWithMissingValue:l.a}),N=function(V){Object(S.a)(Q,V);var z=Object(k.a)(Q);function Q(){var ae;return Object(se.a)(this,Q),ae=z.apply(this,arguments),ae.selectRef=D.createRef(),ae.focus=function(){ae.selectRef.current.focus()},ae.blur=function(){ae.selectRef.current.blur()},ae}return Object(U.a)(Q,[{key:"render",value:function(){return D.createElement(M,Object.assign({ref:this.selectRef},this.props))}}]),Q}(D.Component);N.Option=i,N.OptGroup=u;var j=N,K=le.c=j},MI8n:function(Ze,le,H){"use strict";H.d(le,"b",function(){return L}),H.d(le,"a",function(){return A}),H.d(le,"e",function(){return C}),H.d(le,"d",function(){return s}),H.d(le,"c",function(){return m}),H.d(le,"f",function(){return b});var se=H("/cxE"),U=H("C/vA"),S=H("pmY6"),k=H("24hK"),D=function(){var c=function(v,x){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,e){n.__proto__=e}||function(n,e){for(var t in e)e.hasOwnProperty(t)&&(n[t]=e[t])},c(v,x)};return function(v,x){c(v,x);function n(){this.constructor=v}v.prototype=x===null?Object.create(x):(n.prototype=x.prototype,new n)}}(),L;(function(c){c.None=function(){return S.a.None};function v(R){return function(M,N,j){N===void 0&&(N=null);var K=!1,V;return V=R(function(z){return K?void 0:(V?V.dispose():K=!0,M.call(N,z))},null,j),K&&V.dispose(),V}}c.once=v;function x(R,M){return u(function(N,j,K){return j===void 0&&(j=null),R(function(V){return N.call(j,M(V))},null,K)})}c.map=x;function n(R,M){return u(function(N,j,K){return j===void 0&&(j=null),R(function(V){M(V),N.call(j,V)},null,K)})}c.forEach=n;function e(R,M){return u(function(N,j,K){return j===void 0&&(j=null),R(function(V){return M(V)&&N.call(j,V)},null,K)})}c.filter=e;function t(R){return R}c.signal=t;function i(){for(var R=[],M=0;M<arguments.length;M++)R[M]=arguments[M];return function(N,j,K){return j===void 0&&(j=null),S.e.apply(void 0,R.map(function(V){return V(function(z){return N.call(j,z)},null,K)}))}}c.any=i;function p(R,M,N){var j=N;return x(R,function(K){return j=M(j,K),j})}c.reduce=p;function u(R){var M,N=new A({onFirstListenerAdd:function(){M=R(N.fire,N)},onLastListenerRemove:function(){M.dispose()}});return N.event}c.snapshot=u;function h(R,M,N,j,K){N===void 0&&(N=100),j===void 0&&(j=!1);var V,z=void 0,Q=void 0,ae=0,oe=new A({leakWarningThreshold:K,onFirstListenerAdd:function(){V=R(function(Ce){ae++,z=M(z,Ce),j&&!Q&&(oe.fire(z),z=void 0),clearTimeout(Q),Q=setTimeout(function(){var he=z;z=void 0,Q=void 0,(!j||ae>1)&&oe.fire(he),ae=0},N)})},onLastListenerRemove:function(){V.dispose()}});return oe.event}c.debounce=h;function T(R){var M=new Date().getTime();return x(v(R),function(N){return new Date().getTime()-M})}c.stopwatch=T;function g(R){var M=!0,N;return e(R,function(j){var K=M||j!==N;return M=!1,N=j,K})}c.latch=g;function f(R,M,N){M===void 0&&(M=!1),N===void 0&&(N=[]);var j=N.slice(),K=R(function(Q){j?j.push(Q):z.fire(Q)}),V=function(){j&&j.forEach(function(Q){return z.fire(Q)}),j=null},z=new A({onFirstListenerAdd:function(){K||(K=R(function(Q){return z.fire(Q)}))},onFirstListenerDidAdd:function(){j&&(M?setTimeout(V):V())},onLastListenerRemove:function(){K&&K.dispose(),K=null}});return z.event}c.buffer=f;var l=function(){function R(M){this.event=M}return R.prototype.map=function(M){return new R(x(this.event,M))},R.prototype.forEach=function(M){return new R(n(this.event,M))},R.prototype.filter=function(M){return new R(e(this.event,M))},R.prototype.reduce=function(M,N){return new R(p(this.event,M,N))},R.prototype.latch=function(){return new R(g(this.event))},R.prototype.debounce=function(M,N,j,K){return N===void 0&&(N=100),j===void 0&&(j=!1),new R(h(this.event,M,N,j,K))},R.prototype.on=function(M,N,j){return this.event(M,N,j)},R.prototype.once=function(M,N,j){return v(this.event)(M,N,j)},R}();function r(R){return new l(R)}c.chain=r;function a(R,M,N){N===void 0&&(N=function(Q){return Q});var j=function(){for(var Q=[],ae=0;ae<arguments.length;ae++)Q[ae]=arguments[ae];return z.fire(N.apply(void 0,Q))},K=function(){return R.on(M,j)},V=function(){return R.removeListener(M,j)},z=new A({onFirstListenerAdd:K,onLastListenerRemove:V});return z.event}c.fromNodeEventEmitter=a;function y(R,M,N){N===void 0&&(N=function(Q){return Q});var j=function(){for(var Q=[],ae=0;ae<arguments.length;ae++)Q[ae]=arguments[ae];return z.fire(N.apply(void 0,Q))},K=function(){return R.addEventListener(M,j)},V=function(){return R.removeEventListener(M,j)},z=new A({onFirstListenerAdd:K,onLastListenerRemove:V});return z.event}c.fromDOMEventEmitter=y;function E(R){var M=new A,N=!1;return R.then(void 0,function(){return null}).then(function(){N?M.fire(void 0):setTimeout(function(){return M.fire(void 0)},0)}),N=!0,M.event}c.fromPromise=E;function w(R){return new Promise(function(M){return v(R)(M)})}c.toPromise=w})(L||(L={}));var B=-1,_=function(){function c(v,x){x===void 0&&(x=Math.random().toString(18).slice(2,5)),this.customThreshold=v,this.name=x,this._warnCountdown=0}return c.prototype.dispose=function(){this._stacks&&this._stacks.clear()},c.prototype.check=function(v){var x=this,n=B;if(typeof this.customThreshold=="number"&&(n=this.customThreshold),n<=0||v<n)return;this._stacks||(this._stacks=new Map);var e=new Error().stack.split(`
`).slice(3).join(`
`),t=this._stacks.get(e)||0;if(this._stacks.set(e,t+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=n*.5;var i,p=0;this._stacks.forEach(function(u,h){(!i||p<u)&&(i=h,p=u)}),console.warn("["+this.name+"] potential listener LEAK detected, having "+v+" listeners already. MOST frequent listener ("+p+"):"),console.warn(i)}return function(){var u=x._stacks.get(e)||0;x._stacks.set(e,u-1)}},c}(),A=function(){function c(v){this._disposed=!1,this._options=v,this._leakageMon=B>0?new _(this._options&&this._options.leakWarningThreshold):void 0}return Object.defineProperty(c.prototype,"event",{get:function(){var v=this;return this._event||(this._event=function(x,n,e){v._listeners||(v._listeners=new k.a);var t=v._listeners.isEmpty();t&&v._options&&v._options.onFirstListenerAdd&&v._options.onFirstListenerAdd(v);var i=v._listeners.push(n?[x,n]:x);t&&v._options&&v._options.onFirstListenerDidAdd&&v._options.onFirstListenerDidAdd(v),v._options&&v._options.onListenerDidAdd&&v._options.onListenerDidAdd(v,x,n);var p;v._leakageMon&&(p=v._leakageMon.check(v._listeners.size));var u;return u={dispose:function(){if(p&&p(),u.dispose=c._noop,!v._disposed&&(i(),v._options&&v._options.onLastListenerRemove)){var h=v._listeners&&!v._listeners.isEmpty();h||v._options.onLastListenerRemove(v)}}},e instanceof S.b?e.add(u):Array.isArray(e)&&e.push(u),u}),this._event},enumerable:!0,configurable:!0}),c.prototype.fire=function(v){if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new k.a);for(var x=this._listeners.iterator(),n=x.next();!n.done;n=x.next())this._deliveryQueue.push([n.value,v]);for(;this._deliveryQueue.size>0;){var e=this._deliveryQueue.shift(),t=e[0],i=e[1];try{typeof t=="function"?t.call(void 0,i):t[0].call(t[1],i)}catch(p){Object(se.e)(p)}}}},c.prototype.dispose=function(){this._listeners&&this._listeners.clear(),this._deliveryQueue&&this._deliveryQueue.clear(),this._leakageMon&&this._leakageMon.dispose(),this._disposed=!0},c._noop=function(){},c}(),C=function(c){D(v,c);function v(x){var n=c.call(this,x)||this;return n._isPaused=0,n._eventQueue=new k.a,n._mergeFn=x&&x.merge,n}return v.prototype.pause=function(){this._isPaused++},v.prototype.resume=function(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){var x=this._eventQueue.toArray();this._eventQueue.clear(),c.prototype.fire.call(this,this._mergeFn(x))}else for(;!this._isPaused&&this._eventQueue.size!==0;)c.prototype.fire.call(this,this._eventQueue.shift())},v.prototype.fire=function(x){this._listeners&&(this._isPaused!==0?this._eventQueue.push(x):c.prototype.fire.call(this,x))},v}(A),s=function(){function c(){var v=this;this.hasListeners=!1,this.events=[],this.emitter=new A({onFirstListenerAdd:function(){return v.onFirstListenerAdd()},onLastListenerRemove:function(){return v.onLastListenerRemove()}})}return Object.defineProperty(c.prototype,"event",{get:function(){return this.emitter.event},enumerable:!0,configurable:!0}),c.prototype.add=function(v){var x=this,n={event:v,listener:null};this.events.push(n),this.hasListeners&&this.hook(n);var e=function(){x.hasListeners&&x.unhook(n);var t=x.events.indexOf(n);x.events.splice(t,1)};return Object(S.h)(Object(U.a)(e))},c.prototype.onFirstListenerAdd=function(){var v=this;this.hasListeners=!0,this.events.forEach(function(x){return v.hook(x)})},c.prototype.onLastListenerRemove=function(){var v=this;this.hasListeners=!1,this.events.forEach(function(x){return v.unhook(x)})},c.prototype.hook=function(v){var x=this;v.listener=v.event(function(n){return x.emitter.fire(n)})},c.prototype.unhook=function(v){v.listener&&v.listener.dispose(),v.listener=null},c.prototype.dispose=function(){this.emitter.dispose()},c}(),m=function(){function c(){this.buffers=[]}return c.prototype.wrapEvent=function(v){var x=this;return function(n,e,t){return v(function(i){var p=x.buffers[x.buffers.length-1];p?p.push(function(){return n.call(e,i)}):n.call(e,i)},void 0,t)}},c.prototype.bufferEvents=function(v){var x=[];this.buffers.push(x);var n=v();return this.buffers.pop(),x.forEach(function(e){return e()}),n},c}(),b=function(){function c(){var v=this;this.listening=!1,this.inputEvent=L.None,this.inputEventListener=S.a.None,this.emitter=new A({onFirstListenerDidAdd:function(){v.listening=!0,v.inputEventListener=v.inputEvent(v.emitter.fire,v.emitter)},onLastListenerRemove:function(){v.listening=!1,v.inputEventListener.dispose()}}),this.event=this.emitter.event}return Object.defineProperty(c.prototype,"input",{set:function(v){this.inputEvent=v,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=v(this.emitter.fire,this.emitter))},enumerable:!0,configurable:!0}),c.prototype.dispose=function(){this.inputEventListener.dispose(),this.emitter.dispose()},c}()},N0LK:function(Ze,le,H){"use strict";H.d(le,"x",function(){return se}),H.d(le,"F",function(){return U}),H.d(le,"r",function(){return k}),H.d(le,"o",function(){return D}),H.d(le,"p",function(){return L}),H.d(le,"Q",function(){return B}),H.d(le,"K",function(){return A}),H.d(le,"k",function(){return C}),H.d(le,"N",function(){return s}),H.d(le,"m",function(){return m}),H.d(le,"l",function(){return b}),H.d(le,"I",function(){return c}),H.d(le,"H",function(){return v}),H.d(le,"q",function(){return x}),H.d(le,"t",function(){return n}),H.d(le,"D",function(){return e}),H.d(le,"e",function(){return t}),H.d(le,"f",function(){return i}),H.d(le,"B",function(){return p}),H.d(le,"C",function(){return u}),H.d(le,"n",function(){return T}),H.d(le,"O",function(){return f}),H.d(le,"c",function(){return l}),H.d(le,"d",function(){return r}),H.d(le,"z",function(){return a}),H.d(le,"A",function(){return y}),H.d(le,"u",function(){return E}),H.d(le,"E",function(){return R}),H.d(le,"G",function(){return M}),H.d(le,"i",function(){return j}),H.d(le,"g",function(){return V}),H.d(le,"v",function(){return Q}),H.d(le,"h",function(){return ae}),H.d(le,"y",function(){return oe}),H.d(le,"w",function(){return Ce}),H.d(le,"a",function(){return he}),H.d(le,"P",function(){return fe}),H.d(le,"L",function(){return pe}),H.d(le,"J",function(){return me}),H.d(le,"j",function(){return ie}),H.d(le,"M",function(){return J}),H.d(le,"s",function(){return ye}),H.d(le,"b",function(){return Pe});function se(X){return!X||typeof X!="string"?!0:X.trim().length===0}function U(X,$,ne){ne===void 0&&(ne="0");for(var de=""+X,be=[de],ve=de.length;ve<$;ve++)be.push(ne);return be.reverse().join("")}var S=/{(\d+)}/g;function k(X){for(var $=[],ne=1;ne<arguments.length;ne++)$[ne-1]=arguments[ne];return $.length===0?X:X.replace(S,function(de,be){var ve=parseInt(be,10);return isNaN(ve)||ve<0||ve>=$.length?de:$[ve]})}function D(X){return X.replace(/[<>&]/g,function($){switch($){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";default:return $}})}function L(X){return X.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function B(X,$){$===void 0&&($=" ");var ne=_(X,$);return A(ne,$)}function _(X,$){if(!X||!$)return X;var ne=$.length;if(ne===0||X.length===0)return X;for(var de=0;X.indexOf($,de)===de;)de=de+ne;return X.substring(de)}function A(X,$){if(!X||!$)return X;var ne=$.length,de=X.length;if(ne===0||de===0)return X;for(var be=de,ve=-1;!(ve=X.lastIndexOf($,be-1),ve===-1||ve+ne!==be);){if(ve===0)return"";be=ve}return X.substring(0,be)}function C(X){return X.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function s(X,$){if(X.length<$.length)return!1;if(X===$)return!0;for(var ne=0;ne<$.length;ne++)if(X[ne]!==$[ne])return!1;return!0}function m(X,$){var ne=X.length-$.length;return ne>0?X.indexOf($,ne)===ne:ne===0?X===$:!1}function b(X,$,ne){if(ne===void 0&&(ne={}),!X)throw new Error("Cannot create regex from empty string");$||(X=L(X)),ne.wholeWord&&(/\B/.test(X.charAt(0))||(X="\\b"+X),/\B/.test(X.charAt(X.length-1))||(X=X+"\\b"));var de="";return ne.global&&(de+="g"),ne.matchCase||(de+="i"),ne.multiline&&(de+="m"),ne.unicode&&(de+="u"),new RegExp(X,de)}function c(X){if(X.source==="^"||X.source==="^$"||X.source==="$"||X.source==="^\\s*$")return!1;var $=X.exec("");return!!($&&X.lastIndex===0)}function v(X){return(X.global?"g":"")+(X.ignoreCase?"i":"")+(X.multiline?"m":"")+(X.unicode?"u":"")}function x(X){for(var $=0,ne=X.length;$<ne;$++){var de=X.charCodeAt($);if(de!==32&&de!==9)return $}return-1}function n(X,$,ne){$===void 0&&($=0),ne===void 0&&(ne=X.length);for(var de=$;de<ne;de++){var be=X.charCodeAt(de);if(be!==32&&be!==9)return X.substring($,de)}return X.substring($,ne)}function e(X,$){$===void 0&&($=X.length-1);for(var ne=$;ne>=0;ne--){var de=X.charCodeAt(ne);if(de!==32&&de!==9)return ne}return-1}function t(X,$){return X<$?-1:X>$?1:0}function i(X,$){for(var ne=Math.min(X.length,$.length),de=0;de<ne;de++){var be=X.charCodeAt(de),ve=$.charCodeAt(de);if(be===ve)continue;u(be)&&(be+=32),u(ve)&&(ve+=32);var Ee=be-ve;if(Ee===0)continue;return p(be)&&p(ve)?Ee:t(X.toLowerCase(),$.toLowerCase())}return X.length<$.length?-1:X.length>$.length?1:0}function p(X){return X>=97&&X<=122}function u(X){return X>=65&&X<=90}function h(X){return p(X)||u(X)}function T(X,$){return X.length===$.length&&g(X,$)}function g(X,$,ne){ne===void 0&&(ne=X.length);for(var de=0;de<ne;de++){var be=X.charCodeAt(de),ve=$.charCodeAt(de);if(be===ve)continue;if(h(be)&&h(ve)){var Ee=Math.abs(be-ve);if(Ee!==0&&Ee!==32)return!1}else if(String.fromCharCode(be).toLowerCase()!==String.fromCharCode(ve).toLowerCase())return!1}return!0}function f(X,$){var ne=$.length;return $.length>X.length?!1:g(X,$,ne)}function l(X,$){var ne,de=Math.min(X.length,$.length);for(ne=0;ne<de;ne++)if(X.charCodeAt(ne)!==$.charCodeAt(ne))return ne;return de}function r(X,$){var ne,de=Math.min(X.length,$.length),be=X.length-1,ve=$.length-1;for(ne=0;ne<de;ne++)if(X.charCodeAt(be-ne)!==$.charCodeAt(ve-ne))return ne;return de}function a(X){return 55296<=X&&X<=56319}function y(X){return 56320<=X&&X<=57343}function E(X,$,ne){var de=X.charCodeAt(ne);if(a(de)&&ne+1<$){var be=X.charCodeAt(ne+1);if(y(be))return(de-55296<<10)+(be-56320)+65536}return de}function w(X,$){var ne=X.charCodeAt($-1);if(y(ne)&&$>1){var de=X.charCodeAt($-2);if(a(de))return(de-55296<<10)+(ne-56320)+65536}return ne}function R(X,$){var ne=Le.getInstance(),de=$,be=X.length,ve=E(X,be,$);$+=ve>=65536?2:1;for(var Ee=ne.getGraphemeBreakType(ve);$<be;){var xe=E(X,be,$),Be=ne.getGraphemeBreakType(xe);if(Pe(Ee,Be))break;$+=xe>=65536?2:1,Ee=Be}return $-de}function M(X,$){var ne=Le.getInstance(),de=$,be=w(X,$);$-=be>=65536?2:1;for(var ve=ne.getGraphemeBreakType(be);$>0;){var Ee=w(X,$),xe=ne.getGraphemeBreakType(Ee);if(Pe(xe,ve))break;$-=Ee>=65536?2:1,ve=xe}return de-$}var N=/(?:[\u05BE\u05C0\u05C3\u05C6\u05D0-\u05F4\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u0710\u0712-\u072F\u074D-\u07A5\u07B1-\u07EA\u07F4\u07F5\u07FA-\u0815\u081A\u0824\u0828\u0830-\u0858\u085E-\u08BD\u200F\uFB1D\uFB1F-\uFB28\uFB2A-\uFD3D\uFD50-\uFDFC\uFE70-\uFEFC]|\uD802[\uDC00-\uDD1B\uDD20-\uDE00\uDE10-\uDE33\uDE40-\uDEE4\uDEEB-\uDF35\uDF40-\uDFFF]|\uD803[\uDC00-\uDCFF]|\uD83A[\uDC00-\uDCCF\uDD00-\uDD43\uDD50-\uDFFF]|\uD83B[\uDC00-\uDEBB])/;function j(X){return N.test(X)}var K=/(?:[\u231A\u231B\u23F0\u23F3\u2600-\u27BF\u2B50\u2B55]|\uD83C[\uDDE6-\uDDFF\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F\uDE80-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD00-\uDDFF\uDE70-\uDE73\uDE78-\uDE82\uDE90-\uDE95])/;function V(X){return K.test(X)}var z=/^[\t\n\r\x20-\x7E]*$/;function Q(X){return z.test(X)}function ae(X){for(var $=0,ne=X.length;$<ne;$++)if(oe(X.charCodeAt($)))return!0;return!1}function oe(X){return X=+X,X>=11904&&X<=55215||X>=63744&&X<=64255||X>=65281&&X<=65374}function Ce(X){return X>=127462&&X<=127487||X>=9728&&X<=10175||X>=127744&&X<=128591||X>=128640&&X<=128764||X>=128992&&X<=129003||X>=129280&&X<=129535||X>=129648&&X<=129651||X>=129656&&X<=129666||X>=129680&&X<=129685}var he=String.fromCharCode(65279);function fe(X){return!!(X&&X.length>0&&X.charCodeAt(0)===65279)}function pe(X){return btoa(encodeURIComponent(X))}function me(X,$){for(var ne="",de=0;de<$;de++)ne+=X;return ne}function ie(X,$){return $===void 0&&($=!1),X?($&&(X=X.replace(/\\./g,"")),X.toLowerCase()!==X):!1}function J(X){var $=90-65+1;return X=X%(2*$),X<$?String.fromCharCode(97+X):String.fromCharCode(65+X-$)}function ye(X){var $=Le.getInstance();return $.getGraphemeBreakType(X)}function Pe(X,$){return X===0?$!==5&&$!==7:X===2&&$===3?!1:X===4||X===2||X===3||($===4||$===2||$===3)?!0:X===8&&($===8||$===9||$===11||$===12)||((X===11||X===9)&&($===9||$===10)||((X===12||X===10)&&$===10||($===5||$===13||($===7||(X===1||X===13&&$===14)))))?!1:!(X===6&&$===6)}var Le=function(){function X(){this._data=Re()}return X.getInstance=function(){return X._INSTANCE||(X._INSTANCE=new X),X._INSTANCE},X.prototype.getGraphemeBreakType=function($){if($<32)return $===10?3:$===13?2:4;if($<127)return 0;for(var ne=this._data,de=ne.length/3,be=1;be<=de;)if($<ne[3*be])be=2*be;else if($>ne[3*be+1])be=2*be+1;else return ne[3*be+2];return 0},X._INSTANCE=null,X}();function Re(){return JSON.parse("[0,0,0,51592,51592,11,44424,44424,11,72251,72254,5,7150,7150,7,48008,48008,11,55176,55176,11,128420,128420,14,3276,3277,5,9979,9980,14,46216,46216,11,49800,49800,11,53384,53384,11,70726,70726,5,122915,122916,5,129320,129327,14,2558,2558,5,5906,5908,5,9762,9763,14,43360,43388,8,45320,45320,11,47112,47112,11,48904,48904,11,50696,50696,11,52488,52488,11,54280,54280,11,70082,70083,1,71350,71350,7,73111,73111,5,127892,127893,14,128726,128727,14,129473,129474,14,2027,2035,5,2901,2902,5,3784,3789,5,6754,6754,5,8418,8420,5,9877,9877,14,11088,11088,14,44008,44008,5,44872,44872,11,45768,45768,11,46664,46664,11,47560,47560,11,48456,48456,11,49352,49352,11,50248,50248,11,51144,51144,11,52040,52040,11,52936,52936,11,53832,53832,11,54728,54728,11,69811,69814,5,70459,70460,5,71096,71099,7,71998,71998,5,72874,72880,5,119149,119149,7,127374,127374,14,128335,128335,14,128482,128482,14,128765,128767,14,129399,129400,14,129680,129685,14,1476,1477,5,2377,2380,7,2759,2760,5,3137,3140,7,3458,3459,7,4153,4154,5,6432,6434,5,6978,6978,5,7675,7679,5,9723,9726,14,9823,9823,14,9919,9923,14,10035,10036,14,42736,42737,5,43596,43596,5,44200,44200,11,44648,44648,11,45096,45096,11,45544,45544,11,45992,45992,11,46440,46440,11,46888,46888,11,47336,47336,11,47784,47784,11,48232,48232,11,48680,48680,11,49128,49128,11,49576,49576,11,50024,50024,11,50472,50472,11,50920,50920,11,51368,51368,11,51816,51816,11,52264,52264,11,52712,52712,11,53160,53160,11,53608,53608,11,54056,54056,11,54504,54504,11,54952,54952,11,68108,68111,5,69933,69940,5,70197,70197,7,70498,70499,7,70845,70845,5,71229,71229,5,71727,71735,5,72154,72155,5,72344,72345,5,73023,73029,5,94095,94098,5,121403,121452,5,126981,127182,14,127538,127546,14,127990,127990,14,128391,128391,14,128445,128449,14,128500,128505,14,128752,128752,14,129160,129167,14,129356,129356,14,129432,129442,14,129648,129651,14,129751,131069,14,173,173,4,1757,1757,1,2274,2274,1,2494,2494,5,2641,2641,5,2876,2876,5,3014,3016,7,3262,3262,7,3393,3396,5,3570,3571,7,3968,3972,5,4228,4228,7,6086,6086,5,6679,6680,5,6912,6915,5,7080,7081,5,7380,7392,5,8252,8252,14,9096,9096,14,9748,9749,14,9784,9786,14,9833,9850,14,9890,9894,14,9938,9938,14,9999,9999,14,10085,10087,14,12349,12349,14,43136,43137,7,43454,43456,7,43755,43755,7,44088,44088,11,44312,44312,11,44536,44536,11,44760,44760,11,44984,44984,11,45208,45208,11,45432,45432,11,45656,45656,11,45880,45880,11,46104,46104,11,46328,46328,11,46552,46552,11,46776,46776,11,47000,47000,11,47224,47224,11,47448,47448,11,47672,47672,11,47896,47896,11,48120,48120,11,48344,48344,11,48568,48568,11,48792,48792,11,49016,49016,11,49240,49240,11,49464,49464,11,49688,49688,11,49912,49912,11,50136,50136,11,50360,50360,11,50584,50584,11,50808,50808,11,51032,51032,11,51256,51256,11,51480,51480,11,51704,51704,11,51928,51928,11,52152,52152,11,52376,52376,11,52600,52600,11,52824,52824,11,53048,53048,11,53272,53272,11,53496,53496,11,53720,53720,11,53944,53944,11,54168,54168,11,54392,54392,11,54616,54616,11,54840,54840,11,55064,55064,11,65438,65439,5,69633,69633,5,69837,69837,1,70018,70018,7,70188,70190,7,70368,70370,7,70465,70468,7,70712,70719,5,70835,70840,5,70850,70851,5,71132,71133,5,71340,71340,7,71458,71461,5,71985,71989,7,72002,72002,7,72193,72202,5,72281,72283,5,72766,72766,7,72885,72886,5,73104,73105,5,92912,92916,5,113824,113827,4,119173,119179,5,121505,121519,5,125136,125142,5,127279,127279,14,127489,127490,14,127570,127743,14,127900,127901,14,128254,128254,14,128369,128370,14,128400,128400,14,128425,128432,14,128468,128475,14,128489,128494,14,128715,128720,14,128745,128745,14,128759,128760,14,129004,129023,14,129296,129304,14,129340,129342,14,129388,129392,14,129404,129407,14,129454,129455,14,129485,129487,14,129659,129663,14,129719,129727,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2363,2363,7,2402,2403,5,2507,2508,7,2622,2624,7,2691,2691,7,2786,2787,5,2881,2884,5,3006,3006,5,3072,3072,5,3170,3171,5,3267,3268,7,3330,3331,7,3406,3406,1,3538,3540,5,3655,3662,5,3897,3897,5,4038,4038,5,4184,4185,5,4352,4447,8,6068,6069,5,6155,6157,5,6448,6449,7,6742,6742,5,6783,6783,5,6966,6970,5,7042,7042,7,7143,7143,7,7212,7219,5,7412,7412,5,8206,8207,4,8294,8303,4,8596,8601,14,9410,9410,14,9742,9742,14,9757,9757,14,9770,9770,14,9794,9794,14,9828,9828,14,9855,9855,14,9882,9882,14,9900,9903,14,9929,9933,14,9963,9967,14,9987,9988,14,10006,10006,14,10062,10062,14,10175,10175,14,11744,11775,5,42607,42607,5,43043,43044,7,43263,43263,5,43444,43445,7,43569,43570,5,43698,43700,5,43766,43766,5,44032,44032,11,44144,44144,11,44256,44256,11,44368,44368,11,44480,44480,11,44592,44592,11,44704,44704,11,44816,44816,11,44928,44928,11,45040,45040,11,45152,45152,11,45264,45264,11,45376,45376,11,45488,45488,11,45600,45600,11,45712,45712,11,45824,45824,11,45936,45936,11,46048,46048,11,46160,46160,11,46272,46272,11,46384,46384,11,46496,46496,11,46608,46608,11,46720,46720,11,46832,46832,11,46944,46944,11,47056,47056,11,47168,47168,11,47280,47280,11,47392,47392,11,47504,47504,11,47616,47616,11,47728,47728,11,47840,47840,11,47952,47952,11,48064,48064,11,48176,48176,11,48288,48288,11,48400,48400,11,48512,48512,11,48624,48624,11,48736,48736,11,48848,48848,11,48960,48960,11,49072,49072,11,49184,49184,11,49296,49296,11,49408,49408,11,49520,49520,11,49632,49632,11,49744,49744,11,49856,49856,11,49968,49968,11,50080,50080,11,50192,50192,11,50304,50304,11,50416,50416,11,50528,50528,11,50640,50640,11,50752,50752,11,50864,50864,11,50976,50976,11,51088,51088,11,51200,51200,11,51312,51312,11,51424,51424,11,51536,51536,11,51648,51648,11,51760,51760,11,51872,51872,11,51984,51984,11,52096,52096,11,52208,52208,11,52320,52320,11,52432,52432,11,52544,52544,11,52656,52656,11,52768,52768,11,52880,52880,11,52992,52992,11,53104,53104,11,53216,53216,11,53328,53328,11,53440,53440,11,53552,53552,11,53664,53664,11,53776,53776,11,53888,53888,11,54000,54000,11,54112,54112,11,54224,54224,11,54336,54336,11,54448,54448,11,54560,54560,11,54672,54672,11,54784,54784,11,54896,54896,11,55008,55008,11,55120,55120,11,64286,64286,5,66272,66272,5,68900,68903,5,69762,69762,7,69817,69818,5,69927,69931,5,70003,70003,5,70070,70078,5,70094,70094,7,70194,70195,7,70206,70206,5,70400,70401,5,70463,70463,7,70475,70477,7,70512,70516,5,70722,70724,5,70832,70832,5,70842,70842,5,70847,70848,5,71088,71089,7,71102,71102,7,71219,71226,5,71231,71232,5,71342,71343,7,71453,71455,5,71463,71467,5,71737,71738,5,71995,71996,5,72000,72000,7,72145,72147,7,72160,72160,5,72249,72249,7,72273,72278,5,72330,72342,5,72752,72758,5,72850,72871,5,72882,72883,5,73018,73018,5,73031,73031,5,73109,73109,5,73461,73462,7,94031,94031,5,94192,94193,7,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,126976,126979,14,127184,127231,14,127344,127345,14,127405,127461,14,127514,127514,14,127561,127567,14,127778,127779,14,127896,127896,14,127985,127986,14,127995,127999,5,128326,128328,14,128360,128366,14,128378,128378,14,128394,128397,14,128405,128406,14,128422,128423,14,128435,128443,14,128453,128464,14,128479,128480,14,128484,128487,14,128496,128498,14,128640,128709,14,128723,128724,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129096,129103,14,129292,129292,14,129311,129311,14,129329,129330,14,129344,129349,14,129360,129374,14,129394,129394,14,129402,129402,14,129413,129425,14,129445,129450,14,129466,129471,14,129483,129483,14,129511,129535,14,129653,129655,14,129667,129670,14,129705,129711,14,129731,129743,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2307,2307,7,2366,2368,7,2382,2383,7,2434,2435,7,2497,2500,5,2519,2519,5,2563,2563,7,2631,2632,5,2677,2677,5,2750,2752,7,2763,2764,7,2817,2817,5,2879,2879,5,2891,2892,7,2914,2915,5,3008,3008,5,3021,3021,5,3076,3076,5,3146,3149,5,3202,3203,7,3264,3265,7,3271,3272,7,3298,3299,5,3390,3390,5,3402,3404,7,3426,3427,5,3535,3535,5,3544,3550,7,3635,3635,7,3763,3763,7,3893,3893,5,3953,3966,5,3981,3991,5,4145,4145,7,4157,4158,5,4209,4212,5,4237,4237,5,4520,4607,10,5970,5971,5,6071,6077,5,6089,6099,5,6277,6278,5,6439,6440,5,6451,6456,7,6683,6683,5,6744,6750,5,6765,6770,7,6846,6846,5,6964,6964,5,6972,6972,5,7019,7027,5,7074,7077,5,7083,7085,5,7146,7148,7,7154,7155,7,7222,7223,5,7394,7400,5,7416,7417,5,8204,8204,5,8233,8233,4,8288,8292,4,8413,8416,5,8482,8482,14,8986,8987,14,9193,9203,14,9654,9654,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9775,14,9792,9792,14,9800,9811,14,9825,9826,14,9831,9831,14,9852,9853,14,9872,9873,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9936,9936,14,9941,9960,14,9974,9974,14,9982,9985,14,9992,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10145,10145,14,11013,11015,14,11503,11505,5,12334,12335,5,12951,12951,14,42612,42621,5,43014,43014,5,43047,43047,7,43204,43205,5,43335,43345,5,43395,43395,7,43450,43451,7,43561,43566,5,43573,43574,5,43644,43644,5,43710,43711,5,43758,43759,7,44005,44005,5,44012,44012,7,44060,44060,11,44116,44116,11,44172,44172,11,44228,44228,11,44284,44284,11,44340,44340,11,44396,44396,11,44452,44452,11,44508,44508,11,44564,44564,11,44620,44620,11,44676,44676,11,44732,44732,11,44788,44788,11,44844,44844,11,44900,44900,11,44956,44956,11,45012,45012,11,45068,45068,11,45124,45124,11,45180,45180,11,45236,45236,11,45292,45292,11,45348,45348,11,45404,45404,11,45460,45460,11,45516,45516,11,45572,45572,11,45628,45628,11,45684,45684,11,45740,45740,11,45796,45796,11,45852,45852,11,45908,45908,11,45964,45964,11,46020,46020,11,46076,46076,11,46132,46132,11,46188,46188,11,46244,46244,11,46300,46300,11,46356,46356,11,46412,46412,11,46468,46468,11,46524,46524,11,46580,46580,11,46636,46636,11,46692,46692,11,46748,46748,11,46804,46804,11,46860,46860,11,46916,46916,11,46972,46972,11,47028,47028,11,47084,47084,11,47140,47140,11,47196,47196,11,47252,47252,11,47308,47308,11,47364,47364,11,47420,47420,11,47476,47476,11,47532,47532,11,47588,47588,11,47644,47644,11,47700,47700,11,47756,47756,11,47812,47812,11,47868,47868,11,47924,47924,11,47980,47980,11,48036,48036,11,48092,48092,11,48148,48148,11,48204,48204,11,48260,48260,11,48316,48316,11,48372,48372,11,48428,48428,11,48484,48484,11,48540,48540,11,48596,48596,11,48652,48652,11,48708,48708,11,48764,48764,11,48820,48820,11,48876,48876,11,48932,48932,11,48988,48988,11,49044,49044,11,49100,49100,11,49156,49156,11,49212,49212,11,49268,49268,11,49324,49324,11,49380,49380,11,49436,49436,11,49492,49492,11,49548,49548,11,49604,49604,11,49660,49660,11,49716,49716,11,49772,49772,11,49828,49828,11,49884,49884,11,49940,49940,11,49996,49996,11,50052,50052,11,50108,50108,11,50164,50164,11,50220,50220,11,50276,50276,11,50332,50332,11,50388,50388,11,50444,50444,11,50500,50500,11,50556,50556,11,50612,50612,11,50668,50668,11,50724,50724,11,50780,50780,11,50836,50836,11,50892,50892,11,50948,50948,11,51004,51004,11,51060,51060,11,51116,51116,11,51172,51172,11,51228,51228,11,51284,51284,11,51340,51340,11,51396,51396,11,51452,51452,11,51508,51508,11,51564,51564,11,51620,51620,11,51676,51676,11,51732,51732,11,51788,51788,11,51844,51844,11,51900,51900,11,51956,51956,11,52012,52012,11,52068,52068,11,52124,52124,11,52180,52180,11,52236,52236,11,52292,52292,11,52348,52348,11,52404,52404,11,52460,52460,11,52516,52516,11,52572,52572,11,52628,52628,11,52684,52684,11,52740,52740,11,52796,52796,11,52852,52852,11,52908,52908,11,52964,52964,11,53020,53020,11,53076,53076,11,53132,53132,11,53188,53188,11,53244,53244,11,53300,53300,11,53356,53356,11,53412,53412,11,53468,53468,11,53524,53524,11,53580,53580,11,53636,53636,11,53692,53692,11,53748,53748,11,53804,53804,11,53860,53860,11,53916,53916,11,53972,53972,11,54028,54028,11,54084,54084,11,54140,54140,11,54196,54196,11,54252,54252,11,54308,54308,11,54364,54364,11,54420,54420,11,54476,54476,11,54532,54532,11,54588,54588,11,54644,54644,11,54700,54700,11,54756,54756,11,54812,54812,11,54868,54868,11,54924,54924,11,54980,54980,11,55036,55036,11,55092,55092,11,55148,55148,11,55216,55238,9,65056,65071,5,65529,65531,4,68097,68099,5,68159,68159,5,69446,69456,5,69688,69702,5,69808,69810,7,69815,69816,7,69821,69821,1,69888,69890,5,69932,69932,7,69957,69958,7,70016,70017,5,70067,70069,7,70079,70080,7,70089,70092,5,70095,70095,5,70191,70193,5,70196,70196,5,70198,70199,5,70367,70367,5,70371,70378,5,70402,70403,7,70462,70462,5,70464,70464,5,70471,70472,7,70487,70487,5,70502,70508,5,70709,70711,7,70720,70721,7,70725,70725,7,70750,70750,5,70833,70834,7,70841,70841,7,70843,70844,7,70846,70846,7,70849,70849,7,71087,71087,5,71090,71093,5,71100,71101,5,71103,71104,5,71216,71218,7,71227,71228,7,71230,71230,7,71339,71339,5,71341,71341,5,71344,71349,5,71351,71351,5,71456,71457,7,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123628,123631,5,125252,125258,5,126980,126980,14,127183,127183,14,127245,127247,14,127340,127343,14,127358,127359,14,127377,127386,14,127462,127487,6,127491,127503,14,127535,127535,14,127548,127551,14,127568,127569,14,127744,127777,14,127780,127891,14,127894,127895,14,127897,127899,14,127902,127984,14,127987,127989,14,127991,127994,14,128000,128253,14,128255,128317,14,128329,128334,14,128336,128359,14,128367,128368,14,128371,128377,14,128379,128390,14,128392,128393,14,128398,128399,14,128401,128404,14,128407,128419,14,128421,128421,14,128424,128424,14,128433,128434,14,128444,128444,14,128450,128452,14,128465,128467,14,128476,128478,14,128481,128481,14,128483,128483,14,128488,128488,14,128495,128495,14,128499,128499,14,128506,128591,14,128710,128714,14,128721,128722,14,128725,128725,14,128728,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129664,129666,14,129671,129679,14,129686,129704,14,129712,129718,14,129728,129730,14,129744,129750,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2259,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3134,3136,5,3142,3144,5,3157,3158,5,3201,3201,5,3260,3260,5,3263,3263,5,3266,3266,5,3270,3270,5,3274,3275,7,3285,3286,5,3328,3329,5,3387,3388,5,3391,3392,7,3398,3400,7,3405,3405,5,3415,3415,5,3457,3457,5,3530,3530,5,3536,3537,7,3542,3542,5,3551,3551,5,3633,3633,5,3636,3642,5,3761,3761,5,3764,3772,5,3864,3865,5,3895,3895,5,3902,3903,7,3967,3967,7,3974,3975,5,3993,4028,5,4141,4144,5,4146,4151,5,4155,4156,7,4182,4183,7,4190,4192,5,4226,4226,5,4229,4230,5,4253,4253,5,4448,4519,9,4957,4959,5,5938,5940,5,6002,6003,5,6070,6070,7,6078,6085,7,6087,6088,7,6109,6109,5,6158,6158,4,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6848,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7673,5,8203,8203,4,8205,8205,13,8232,8232,4,8234,8238,4,8265,8265,14,8293,8293,4,8400,8412,5,8417,8417,5,8421,8432,5,8505,8505,14,8617,8618,14,9000,9000,14,9167,9167,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9776,9783,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9935,14,9937,9937,14,9939,9940,14,9961,9962,14,9968,9973,14,9975,9978,14,9981,9981,14,9986,9986,14,9989,9989,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10084,14,10133,10135,14,10160,10160,14,10548,10549,14,11035,11036,14,11093,11093,14,11647,11647,5,12330,12333,5,12336,12336,14,12441,12442,5,12953,12953,14,42608,42610,5,42654,42655,5,43010,43010,5,43019,43019,5,43045,43046,5,43052,43052,5,43188,43203,7,43232,43249,5,43302,43309,5,43346,43347,7,43392,43394,5,43443,43443,5,43446,43449,5,43452,43453,5,43493,43493,5,43567,43568,7,43571,43572,7,43587,43587,5,43597,43597,7,43696,43696,5,43703,43704,5,43713,43713,5,43756,43757,5,43765,43765,7,44003,44004,7,44006,44007,7,44009,44010,7,44013,44013,5,44033,44059,12,44061,44087,12,44089,44115,12,44117,44143,12,44145,44171,12,44173,44199,12,44201,44227,12,44229,44255,12,44257,44283,12,44285,44311,12,44313,44339,12,44341,44367,12,44369,44395,12,44397,44423,12,44425,44451,12,44453,44479,12,44481,44507,12,44509,44535,12,44537,44563,12,44565,44591,12,44593,44619,12,44621,44647,12,44649,44675,12,44677,44703,12,44705,44731,12,44733,44759,12,44761,44787,12,44789,44815,12,44817,44843,12,44845,44871,12,44873,44899,12,44901,44927,12,44929,44955,12,44957,44983,12,44985,45011,12,45013,45039,12,45041,45067,12,45069,45095,12,45097,45123,12,45125,45151,12,45153,45179,12,45181,45207,12,45209,45235,12,45237,45263,12,45265,45291,12,45293,45319,12,45321,45347,12,45349,45375,12,45377,45403,12,45405,45431,12,45433,45459,12,45461,45487,12,45489,45515,12,45517,45543,12,45545,45571,12,45573,45599,12,45601,45627,12,45629,45655,12,45657,45683,12,45685,45711,12,45713,45739,12,45741,45767,12,45769,45795,12,45797,45823,12,45825,45851,12,45853,45879,12,45881,45907,12,45909,45935,12,45937,45963,12,45965,45991,12,45993,46019,12,46021,46047,12,46049,46075,12,46077,46103,12,46105,46131,12,46133,46159,12,46161,46187,12,46189,46215,12,46217,46243,12,46245,46271,12,46273,46299,12,46301,46327,12,46329,46355,12,46357,46383,12,46385,46411,12,46413,46439,12,46441,46467,12,46469,46495,12,46497,46523,12,46525,46551,12,46553,46579,12,46581,46607,12,46609,46635,12,46637,46663,12,46665,46691,12,46693,46719,12,46721,46747,12,46749,46775,12,46777,46803,12,46805,46831,12,46833,46859,12,46861,46887,12,46889,46915,12,46917,46943,12,46945,46971,12,46973,46999,12,47001,47027,12,47029,47055,12,47057,47083,12,47085,47111,12,47113,47139,12,47141,47167,12,47169,47195,12,47197,47223,12,47225,47251,12,47253,47279,12,47281,47307,12,47309,47335,12,47337,47363,12,47365,47391,12,47393,47419,12,47421,47447,12,47449,47475,12,47477,47503,12,47505,47531,12,47533,47559,12,47561,47587,12,47589,47615,12,47617,47643,12,47645,47671,12,47673,47699,12,47701,47727,12,47729,47755,12,47757,47783,12,47785,47811,12,47813,47839,12,47841,47867,12,47869,47895,12,47897,47923,12,47925,47951,12,47953,47979,12,47981,48007,12,48009,48035,12,48037,48063,12,48065,48091,12,48093,48119,12,48121,48147,12,48149,48175,12,48177,48203,12,48205,48231,12,48233,48259,12,48261,48287,12,48289,48315,12,48317,48343,12,48345,48371,12,48373,48399,12,48401,48427,12,48429,48455,12,48457,48483,12,48485,48511,12,48513,48539,12,48541,48567,12,48569,48595,12,48597,48623,12,48625,48651,12,48653,48679,12,48681,48707,12,48709,48735,12,48737,48763,12,48765,48791,12,48793,48819,12,48821,48847,12,48849,48875,12,48877,48903,12,48905,48931,12,48933,48959,12,48961,48987,12,48989,49015,12,49017,49043,12,49045,49071,12,49073,49099,12,49101,49127,12,49129,49155,12,49157,49183,12,49185,49211,12,49213,49239,12,49241,49267,12,49269,49295,12,49297,49323,12,49325,49351,12,49353,49379,12,49381,49407,12,49409,49435,12,49437,49463,12,49465,49491,12,49493,49519,12,49521,49547,12,49549,49575,12,49577,49603,12,49605,49631,12,49633,49659,12,49661,49687,12,49689,49715,12,49717,49743,12,49745,49771,12,49773,49799,12,49801,49827,12,49829,49855,12,49857,49883,12,49885,49911,12,49913,49939,12,49941,49967,12,49969,49995,12,49997,50023,12,50025,50051,12,50053,50079,12,50081,50107,12,50109,50135,12,50137,50163,12,50165,50191,12,50193,50219,12,50221,50247,12,50249,50275,12,50277,50303,12,50305,50331,12,50333,50359,12,50361,50387,12,50389,50415,12,50417,50443,12,50445,50471,12,50473,50499,12,50501,50527,12,50529,50555,12,50557,50583,12,50585,50611,12,50613,50639,12,50641,50667,12,50669,50695,12,50697,50723,12,50725,50751,12,50753,50779,12,50781,50807,12,50809,50835,12,50837,50863,12,50865,50891,12,50893,50919,12,50921,50947,12,50949,50975,12,50977,51003,12,51005,51031,12,51033,51059,12,51061,51087,12,51089,51115,12,51117,51143,12,51145,51171,12,51173,51199,12,51201,51227,12,51229,51255,12,51257,51283,12,51285,51311,12,51313,51339,12,51341,51367,12,51369,51395,12,51397,51423,12,51425,51451,12,51453,51479,12,51481,51507,12,51509,51535,12,51537,51563,12,51565,51591,12,51593,51619,12,51621,51647,12,51649,51675,12,51677,51703,12,51705,51731,12,51733,51759,12,51761,51787,12,51789,51815,12,51817,51843,12,51845,51871,12,51873,51899,12,51901,51927,12,51929,51955,12,51957,51983,12,51985,52011,12,52013,52039,12,52041,52067,12,52069,52095,12,52097,52123,12,52125,52151,12,52153,52179,12,52181,52207,12,52209,52235,12,52237,52263,12,52265,52291,12,52293,52319,12,52321,52347,12,52349,52375,12,52377,52403,12,52405,52431,12,52433,52459,12,52461,52487,12,52489,52515,12,52517,52543,12,52545,52571,12,52573,52599,12,52601,52627,12,52629,52655,12,52657,52683,12,52685,52711,12,52713,52739,12,52741,52767,12,52769,52795,12,52797,52823,12,52825,52851,12,52853,52879,12,52881,52907,12,52909,52935,12,52937,52963,12,52965,52991,12,52993,53019,12,53021,53047,12,53049,53075,12,53077,53103,12,53105,53131,12,53133,53159,12,53161,53187,12,53189,53215,12,53217,53243,12,53245,53271,12,53273,53299,12,53301,53327,12,53329,53355,12,53357,53383,12,53385,53411,12,53413,53439,12,53441,53467,12,53469,53495,12,53497,53523,12,53525,53551,12,53553,53579,12,53581,53607,12,53609,53635,12,53637,53663,12,53665,53691,12,53693,53719,12,53721,53747,12,53749,53775,12,53777,53803,12,53805,53831,12,53833,53859,12,53861,53887,12,53889,53915,12,53917,53943,12,53945,53971,12,53973,53999,12,54001,54027,12,54029,54055,12,54057,54083,12,54085,54111,12,54113,54139,12,54141,54167,12,54169,54195,12,54197,54223,12,54225,54251,12,54253,54279,12,54281,54307,12,54309,54335,12,54337,54363,12,54365,54391,12,54393,54419,12,54421,54447,12,54449,54475,12,54477,54503,12,54505,54531,12,54533,54559,12,54561,54587,12,54589,54615,12,54617,54643,12,54645,54671,12,54673,54699,12,54701,54727,12,54729,54755,12,54757,54783,12,54785,54811,12,54813,54839,12,54841,54867,12,54869,54895,12,54897,54923,12,54925,54951,12,54953,54979,12,54981,55007,12,55009,55035,12,55037,55063,12,55065,55091,12,55093,55119,12,55121,55147,12,55149,55175,12,55177,55203,12,55243,55291,10,65024,65039,5,65279,65279,4,65520,65528,4,66045,66045,5,66422,66426,5,68101,68102,5,68152,68154,5,68325,68326,5,69291,69292,5,69632,69632,7,69634,69634,7,69759,69761,5]")}},NDqe:function(Ze,le,H){Ze.exports={flex_box_center:"flex_box_center___3oYZ2",flex_space_between:"flex_space_between___1FifH",flex_box_vertical_center:"flex_box_vertical_center___2iDXN",flex_box_center_end:"flex_box_center_end___2rJ_G",flex_box_column:"flex_box_column___3ucki",tabs:"tabs___3aVAD",active:"active___1eCl8",list:"list___2weuP",tags:"tags___10O8v",searchWrp:"searchWrp___xsrqM",newlight:"newlight___1S7Yv"}},QDVR:function(Ze,le,H){"use strict";H.d(le,"e",function(){return U}),H.d(le,"d",function(){return S}),H.d(le,"c",function(){return B}),H.d(le,"b",function(){return _}),H.d(le,"a",function(){return C});var se=function(){var s=function(m,b){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,v){c.__proto__=v}||function(c,v){for(var x in v)v.hasOwnProperty(x)&&(c[x]=v[x])},s(m,b)};return function(m,b){s(m,b);function c(){this.constructor=m}m.prototype=b===null?Object.create(b):(c.prototype=b.prototype,new c)}}();function U(s){var m=[];return s.forEach(function(b){return m.push(b)}),m}function S(s){var m=[];return s.forEach(function(b,c){return m.push(c)}),m}var k=function(){function s(){this._value="",this._pos=0}return s.prototype.reset=function(m){return this._value=m,this._pos=0,this},s.prototype.next=function(){return this._pos+=1,this},s.prototype.hasNext=function(){return this._pos<this._value.length-1},s.prototype.cmp=function(m){var b=m.charCodeAt(0),c=this._value.charCodeAt(this._pos);return b-c},s.prototype.value=function(){return this._value[this._pos]},s}(),D=function(){function s(m){m===void 0&&(m=!0),this._splitOnBackslash=m}return s.prototype.reset=function(m){return this._value=m.replace(/\\$|\/$/,""),this._from=0,this._to=0,this.next()},s.prototype.hasNext=function(){return this._to<this._value.length},s.prototype.next=function(){this._from=this._to;for(var m=!0;this._to<this._value.length;this._to++){var b=this._value.charCodeAt(this._to);if(b===47||this._splitOnBackslash&&b===92)if(m)this._from++;else break;else m=!1}return this},s.prototype.cmp=function(m){for(var b=0,c=m.length,v=this._from;b<c&&v<this._to;){var x=m.charCodeAt(b)-this._value.charCodeAt(v);if(x!==0)return x;b+=1,v+=1}return c===this._to-this._from?0:b<c?-1:1},s.prototype.value=function(){return this._value.substring(this._from,this._to)},s}(),L=function(){function s(){}return s}(),B=function(){function s(m){this._iter=m}return s.forPaths=function(){return new s(new D)},s.forStrings=function(){return new s(new k)},s.prototype.clear=function(){this._root=void 0},s.prototype.set=function(m,b){var c=this._iter.reset(m),v;for(this._root||(this._root=new L,this._root.segment=c.value()),v=this._root;;){var x=c.cmp(v.segment);if(x>0)v.left||(v.left=new L,v.left.segment=c.value()),v=v.left;else if(x<0)v.right||(v.right=new L,v.right.segment=c.value()),v=v.right;else if(c.hasNext())c.next(),v.mid||(v.mid=new L,v.mid.segment=c.value()),v=v.mid;else break}var n=v.value;return v.value=b,v.key=m,n},s.prototype.get=function(m){for(var b=this._iter.reset(m),c=this._root;c;){var v=b.cmp(c.segment);if(v>0)c=c.left;else if(v<0)c=c.right;else if(b.hasNext())b.next(),c=c.mid;else break}return c?c.value:void 0},s.prototype.findSubstr=function(m){for(var b=this._iter.reset(m),c=this._root,v=void 0;c;){var x=b.cmp(c.segment);if(x>0)c=c.left;else if(x<0)c=c.right;else if(b.hasNext())b.next(),v=c.value||v,c=c.mid;else break}return c&&c.value||v},s.prototype.forEach=function(m){this._forEach(this._root,m)},s.prototype._forEach=function(m,b){m&&(this._forEach(m.left,b),m.value&&b(m.value,m.key),this._forEach(m.mid,b),this._forEach(m.right,b))},s}(),_=function(){function s(){this.map=new Map,this.ignoreCase=!1}return s.prototype.set=function(m,b){this.map.set(this.toKey(m),b)},s.prototype.get=function(m){return this.map.get(this.toKey(m))},s.prototype.toKey=function(m){var b=m.toString();return this.ignoreCase&&(b=b.toLowerCase()),b},s}(),A=function(){function s(){this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0}return s.prototype.clear=function(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0},Object.defineProperty(s.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),s.prototype.get=function(m,b){b===void 0&&(b=0);var c=this._map.get(m);return c?(b!==0&&this.touch(c,b),c.value):void 0},s.prototype.set=function(m,b,c){c===void 0&&(c=0);var v=this._map.get(m);if(v)v.value=b,c!==0&&this.touch(v,c);else{v={key:m,value:b,next:void 0,previous:void 0};switch(c){case 0:this.addItemLast(v);break;case 1:this.addItemFirst(v);break;case 2:this.addItemLast(v);break;default:this.addItemLast(v);break}this._map.set(m,v),this._size++}},s.prototype.delete=function(m){return!!this.remove(m)},s.prototype.remove=function(m){var b=this._map.get(m);return b?(this._map.delete(m),this.removeItem(b),this._size--,b.value):void 0},s.prototype.forEach=function(m,b){for(var c=this._head;c;)b?m.bind(b)(c.value,c.key,this):m(c.value,c.key,this),c=c.next},s.prototype.trimOld=function(m){if(m>=this.size)return;if(m===0){this.clear();return}for(var b=this._head,c=this.size;b&&c>m;)this._map.delete(b.key),b=b.next,c--;this._head=b,this._size=c,b&&(b.previous=void 0)},s.prototype.addItemFirst=function(m){if(!this._head&&!this._tail)this._tail=m;else if(this._head)m.next=this._head,this._head.previous=m;else throw new Error("Invalid list");this._head=m},s.prototype.addItemLast=function(m){if(!this._head&&!this._tail)this._head=m;else if(this._tail)m.previous=this._tail,this._tail.next=m;else throw new Error("Invalid list");this._tail=m},s.prototype.removeItem=function(m){if(m===this._head&&m===this._tail)this._head=void 0,this._tail=void 0;else if(m===this._head){if(!m.next)throw new Error("Invalid list");m.next.previous=void 0,this._head=m.next}else if(m===this._tail){if(!m.previous)throw new Error("Invalid list");m.previous.next=void 0,this._tail=m.previous}else{var b=m.next,c=m.previous;if(!b||!c)throw new Error("Invalid list");b.previous=c,c.next=b}m.next=void 0,m.previous=void 0},s.prototype.touch=function(m,b){if(!this._head||!this._tail)throw new Error("Invalid list");if(b!==1&&b!==2)return;if(b===1){if(m===this._head)return;var c=m.next,v=m.previous;m===this._tail?(v.next=void 0,this._tail=v):(c.previous=v,v.next=c),m.previous=void 0,m.next=this._head,this._head.previous=m,this._head=m}else if(b===2){if(m===this._tail)return;var c=m.next,v=m.previous;m===this._head?(c.previous=void 0,this._head=c):(c.previous=v,v.next=c),m.next=void 0,m.previous=this._tail,this._tail.next=m,this._tail=m}},s.prototype.toJSON=function(){var m=[];return this.forEach(function(b,c){m.push([c,b])}),m},s}(),C=function(s){se(m,s);function m(b,c){c===void 0&&(c=1);var v=s.call(this)||this;return v._limit=b,v._ratio=Math.min(Math.max(0,c),1),v}return m.prototype.get=function(b){return s.prototype.get.call(this,b,2)},m.prototype.peek=function(b){return s.prototype.get.call(this,b,0)},m.prototype.set=function(b,c){s.prototype.set.call(this,b,c,2),this.checkTrim()},m.prototype.checkTrim=function(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))},m}(A)},SJMd:function(Ze,le){/**
* @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 H,se,U,S=!1,k,D;window.PR_SHOULD_USE_CONTINUATION=!0;var L,B;(function(){var _=window,A=["break,continue,do,else,for,if,return,while"],C=[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"],s=[C,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],m=[s,"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"],b=[s,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],c=[s,"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"],v="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=[s,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],n="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",e=[A,"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"],t=[A,"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"],i=[A,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],p=[m,c,b,x,n,e,t,i],u=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,h="str",T="kwd",g="com",f="typ",l="lit",r="pun",a="pln",y="tag",E="dec",w="src",R="atn",M="atv",N="nocode",j="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function K($){for(var ne=0,de=!1,be=!1,ve=0,Ee=$.length;ve<Ee;++ve){var xe=$[ve];if(xe.ignoreCase)be=!0;else if(/[a-z]/i.test(xe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){de=!0,be=!1;break}}var Be={b:8,t:9,n:10,v:11,f:12,r:13};function Ie(je){var we=je.charCodeAt(0);if(we!==92)return we;var Oe=je.charAt(1);return we=Be[Oe],we||("0"<=Oe&&Oe<="7"?parseInt(je.substring(1),8):Oe==="u"||Oe==="x"?parseInt(je.substring(2),16):je.charCodeAt(1))}function ke(je){if(je<32)return(je<16?"\\x0":"\\x")+je.toString(16);var we=String.fromCharCode(je);return we==="\\"||we==="-"||we==="]"||we==="^"?"\\"+we:we}function Me(je){var we=je.substring(1,je.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")),Oe=[],_e=we[0]==="^",ge=["["];_e&&ge.push("^");for(var De=_e?1:0,re=we.length;De<re;++De){var ee=we[De];if(/\\[bdsw]/i.test(ee))ge.push(ee);else{var te=Ie(ee),W;De+2<re&&we[De+1]==="-"?(W=Ie(we[De+2]),De+=2):W=te,Oe.push([te,W]),W<65||te>122||(W<65||te>90||Oe.push([Math.max(65,te)|32,Math.min(W,90)|32]),W<97||te>122||Oe.push([Math.max(97,te)&~32,Math.min(W,122)&~32]))}}Oe.sort(function(ue,ce){return ue[0]-ce[0]||ce[1]-ue[1]});for(var G=[],Y=[],De=0;De<Oe.length;++De){var q=Oe[De];q[0]<=Y[1]+1?Y[1]=Math.max(Y[1],q[1]):G.push(Y=q)}for(var De=0;De<G.length;++De){var q=G[De];ge.push(ke(q[0])),q[1]>q[0]&&(q[1]+1>q[0]&&ge.push("-"),ge.push(ke(q[1])))}return ge.push("]"),ge.join("")}function Ue(je){for(var we=je.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")),Oe=we.length,_e=[],ge=0,De=0;ge<Oe;++ge){var re=we[ge];if(re==="(")++De;else if(re.charAt(0)==="\\"){var ee=+re.substring(1);ee&&(ee<=De?_e[ee]=-1:we[ge]=ke(ee))}}for(var ge=1;ge<_e.length;++ge)_e[ge]===-1&&(_e[ge]=++ne);for(var ge=0,De=0;ge<Oe;++ge){var re=we[ge];if(re==="(")++De,_e[De]||(we[ge]="(?:");else if(re.charAt(0)==="\\"){var ee=+re.substring(1);ee&&ee<=De&&(we[ge]="\\"+_e[ee])}}for(var ge=0;ge<Oe;++ge)we[ge]==="^"&&we[ge+1]!=="^"&&(we[ge]="");if(je.ignoreCase&&de)for(var ge=0;ge<Oe;++ge){var re=we[ge],te=re.charAt(0);re.length>=2&&te==="["?we[ge]=Me(re):te!=="\\"&&(we[ge]=re.replace(/[a-zA-Z]/g,function(Y){var q=Y.charCodeAt(0);return"["+String.fromCharCode(q&~32,q|32)+"]"}))}return we.join("")}for(var Fe=[],ve=0,Ee=$.length;ve<Ee;++ve){var xe=$[ve];if(xe.global||xe.multiline)throw new Error(""+xe);Fe.push("(?:"+Ue(xe)+")")}return new RegExp(Fe.join("|"),be?"gi":"g")}function V($,ne){var de=/(?:^|\s)nocode(?:\s|$)/,be=[],ve=0,Ee=[],xe=0;function Be(Ie){var ke=Ie.nodeType;if(ke==1){if(de.test(Ie.className))return;for(var Me=Ie.firstChild;Me;Me=Me.nextSibling)Be(Me);var Ue=Ie.nodeName.toLowerCase();(Ue==="br"||Ue==="li")&&(be[xe]=`
`,Ee[xe<<1]=ve++,Ee[xe++<<1|1]=Ie)}else if(ke==3||ke==4){var Fe=Ie.nodeValue;Fe.length&&(ne?Fe=Fe.replace(/\r\n?/g,`
`):Fe=Fe.replace(/[ \t\r\n]+/g," "),be[xe]=Fe,Ee[xe<<1]=ve,ve+=Fe.length,Ee[xe++<<1|1]=Ie)}}return Be($),{sourceCode:be.join("").replace(/\n$/,""),spans:Ee}}function z($,ne,de,be,ve){if(!de)return;var Ee={sourceNode:$,pre:1,langExtension:null,numberLines:null,sourceCode:de,spans:null,basePos:ne,decorations:null};be(Ee),ve.push.apply(ve,Ee.decorations)}var Q=/\S/;function ae($){for(var ne=void 0,de=$.firstChild;de;de=de.nextSibling){var be=de.nodeType;ne=be===1?ne?$:de:be===3&&Q.test(de.nodeValue)?$:ne}return ne===$?void 0:ne}function oe($,ne){var de={},be;(function(){for(var xe=$.concat(ne),Be=[],Ie={},ke=0,Me=xe.length;ke<Me;++ke){var Ue=xe[ke],Fe=Ue[3];if(Fe)for(var je=Fe.length;--je>=0;)de[Fe.charAt(je)]=Ue;var we=Ue[1],Oe=""+we;Ie.hasOwnProperty(Oe)||(Be.push(we),Ie[Oe]=null)}Be.push(/[\0-\uffff]/),be=K(Be)})();var ve=ne.length,Ee=function(xe){for(var Be=xe.sourceCode,Ie=xe.basePos,ke=xe.sourceNode,Me=[Ie,a],Ue=0,Fe=Be.match(be)||[],je={},we=0,Oe=Fe.length;we<Oe;++we){var _e=Fe[we],ge=je[_e],De=void 0,re;if(typeof ge=="string")re=!1;else{var ee=de[_e.charAt(0)];if(ee)De=_e.match(ee[1]),ge=ee[0];else{for(var te=0;te<ve;++te)if(ee=ne[te],De=_e.match(ee[1]),De){ge=ee[0];break}De||(ge=a)}re=ge.length>=5&&ge.substring(0,5)==="lang-",re&&!(De&&typeof De[1]=="string")&&(re=!1,ge=w),re||(je[_e]=ge)}var W=Ue;if(Ue+=_e.length,!re)Me.push(Ie+W,ge);else{var G=De[1],Y=_e.indexOf(G),q=Y+G.length;De[2]&&(q=_e.length-De[2].length,Y=q-G.length);var ue=ge.substring(5);z(ke,Ie+W,_e.substring(0,Y),Ee,Me),z(ke,Ie+W+Y,G,J(ue,G),Me),z(ke,Ie+W+q,_e.substring(q),Ee,Me)}}xe.decorations=Me};return Ee}function Ce($){var ne=[],de=[];$.tripleQuotedStrings?ne.push([h,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):$.multiLineStrings?ne.push([h,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):ne.push([h,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),$.verbatimStrings&&de.push([h,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var be=$.hashComments;be&&($.cStyleComments?(be>1?ne.push([g,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):ne.push([g,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),de.push([h,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):ne.push([g,/^#[^\r\n]*/,null,"#"])),$.cStyleComments&&(de.push([g,/^\/\/[^\r\n]*/,null]),de.push([g,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var ve=$.regexLiterals;if(ve){var Ee=ve>1?"":`
\r`,xe=Ee?".":"[\\S\\s]",Be="/(?=[^/*"+Ee+"])(?:[^/\\x5B\\x5C"+Ee+"]|\\x5C"+xe+"|\\x5B(?:[^\\x5C\\x5D"+Ee+"]|\\x5C"+xe+")*(?:\\x5D|$))+/";de.push(["lang-regex",RegExp("^"+j+"("+Be+")")])}var Ie=$.types;Ie&&de.push([f,Ie]);var ke=(""+$.keywords).replace(/^ | $/g,"");ke.length&&de.push([T,new RegExp("^(?:"+ke.replace(/[\s,]+/g,"|")+")\\b"),null]),ne.push([a,/^\s+/,null,` \r
\xA0`]);var Me="^.[^\\s\\w.$@'\"`/\\\\]*";return $.regexLiterals&&(Me+="(?!s*/)"),de.push([l,/^@[a-z_$][a-z_$@0-9]*/i,null],[f,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[l,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[r,new RegExp(Me),null]),oe(ne,de)}var he=Ce({keywords:p,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function fe($,ne,de){for(var be=/(?:^|\s)nocode(?:\s|$)/,ve=/\r\n?|\n/,Ee=$.ownerDocument,xe=Ee.createElement("li");$.firstChild;)xe.appendChild($.firstChild);var Be=[xe];function Ie(we){var Oe=we.nodeType;if(Oe==1&&!be.test(we.className))if(we.nodeName==="br")ke(we),we.parentNode&&we.parentNode.removeChild(we);else for(var _e=we.firstChild;_e;_e=_e.nextSibling)Ie(_e);else if((Oe==3||Oe==4)&&de){var ge=we.nodeValue,De=ge.match(ve);if(De){var re=ge.substring(0,De.index);we.nodeValue=re;var ee=ge.substring(De.index+De[0].length);if(ee){var te=we.parentNode;te.insertBefore(Ee.createTextNode(ee),we.nextSibling)}ke(we),re||we.parentNode.removeChild(we)}}}function ke(we){for(;!we.nextSibling;)if(we=we.parentNode,!we)return;function Oe(De,re){var ee=re?De.cloneNode(!1):De,te=De.parentNode;if(te){var W=Oe(te,1),G=De.nextSibling;W.appendChild(ee);for(var Y=G;Y;Y=G)G=Y.nextSibling,W.appendChild(Y)}return ee}for(var _e=Oe(we.nextSibling,0),ge;(ge=_e.parentNode)&&ge.nodeType===1;)_e=ge;Be.push(_e)}for(var Me=0;Me<Be.length;++Me)Ie(Be[Me]);ne===(ne|0)&&Be[0].setAttribute("value",ne);var Ue=Ee.createElement("ol");Ue.className="linenums";for(var Fe=Math.max(0,ne-1|0)||0,Me=0,je=Be.length;Me<je;++Me)xe=Be[Me],xe.className="L"+(Me+Fe)%10,xe.firstChild||xe.appendChild(Ee.createTextNode("\xA0")),Ue.appendChild(xe);$.appendChild(Ue)}function pe($){var ne=/\bMSIE\s(\d+)/.exec(navigator.userAgent);ne=ne&&+ne[1]<=8;var de=/\n/g,be=$.sourceCode,ve=be.length,Ee=0,xe=$.spans,Be=xe.length,Ie=0,ke=$.decorations,Me=ke.length,Ue=0;ke[Me]=ve;var Fe,je;for(je=Fe=0;je<Me;)ke[je]!==ke[je+2]?(ke[Fe++]=ke[je++],ke[Fe++]=ke[je++]):je+=2;for(Me=Fe,je=Fe=0;je<Me;){for(var we=ke[je],Oe=ke[je+1],_e=je+2;_e+2<=Me&&ke[_e+1]===Oe;)_e+=2;ke[Fe++]=we,ke[Fe++]=Oe,je=_e}Me=ke.length=Fe;var ge=$.sourceNode,De="";ge&&(De=ge.style.display,ge.style.display="none");try{for(var re=null;Ie<Be;){var ee=xe[Ie],te=xe[Ie+2]||ve,W=ke[Ue+2]||ve,_e=Math.min(te,W),G=xe[Ie+1],Y;if(G.nodeType!==1&&(Y=be.substring(Ee,_e))){ne&&(Y=Y.replace(de,"\r")),G.nodeValue=Y;var q=G.ownerDocument,ue=q.createElement("span");ue.className=ke[Ue+1];var ce=G.parentNode;ce.replaceChild(ue,G),ue.appendChild(G),Ee<te&&(xe[Ie+1]=G=q.createTextNode(be.substring(_e,te)),ce.insertBefore(G,ue.nextSibling))}Ee=_e,Ee>=te&&(Ie+=2),Ee>=W&&(Ue+=2)}}finally{ge&&(ge.style.display=De)}}var me={};function ie($,ne){for(var de=ne.length;--de>=0;){var be=ne[de];me.hasOwnProperty(be)?_.console&&console.warn("cannot override language handler %s",be):me[be]=$}}function J($,ne){return $&&me.hasOwnProperty($)||($=/^\s*</.test(ne)?"default-markup":"default-code"),me[$]}ie(he,["default-code"]),ie(oe([],[[a,/^[^<?]+/],[E,/^<!\w[^>]*(?:>|$)/],[g,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[r,/^(?:<[%?]|[%?]>)/],["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"]),ie(oe([[a,/^[\s]+/,null,` \r
`],[M,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[y,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[R,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[r,/^[=<>\/]+/],["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"]),ie(oe([],[[M,/^[\s\S]+/]]),["uq.val"]),ie(Ce({keywords:m,hashComments:!0,cStyleComments:!0,types:u}),["c","cc","cpp","cxx","cyc","m"]),ie(Ce({keywords:"null,true,false"}),["json"]),ie(Ce({keywords:c,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:u}),["cs"]),ie(Ce({keywords:b,cStyleComments:!0}),["java"]),ie(Ce({keywords:i,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ie(Ce({keywords:e,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ie(Ce({keywords:n,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ie(Ce({keywords:t,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ie(Ce({keywords:x,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ie(Ce({keywords:v,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ie(oe([],[[h,/^[\s\S]+/]]),["regex"]);function ye($){var ne=$.langExtension;try{var de=V($.sourceNode,$.pre),be=de.sourceCode;$.sourceCode=be,$.spans=de.spans,$.basePos=0,J(ne,be)($),pe($)}catch(ve){_.console&&console.log(ve&&ve.stack||ve)}}function Pe($,ne,de){var be=de||!1,ve=ne||null,Ee=document.createElement("div");Ee.innerHTML="<pre>"+$+"</pre>",Ee=Ee.firstChild,be&&fe(Ee,be,!0);var xe={langExtension:ve,numberLines:be,sourceNode:Ee,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return ye(xe),Ee.innerHTML}function Le($,ne){var de=ne||document.body,be=de.ownerDocument||document;function ve(ee){return de.getElementsByTagName(ee)}for(var Ee=[ve("pre"),ve("code"),ve("xmp")],xe=[],Be=0;Be<Ee.length;++Be)for(var Ie=0,ke=Ee[Be].length;Ie<ke;++Ie)xe.push(Ee[Be][Ie]);Ee=null;var Me=Date;Me.now||(Me={now:function(){return+new Date}});var Ue=0,Fe=/\blang(?:uage)?-([\w.]+)(?!\S)/,je=/\bprettyprint\b/,we=/\bprettyprinted\b/,Oe=/pre|xmp/i,_e=/^code$/i,ge=/^(?:pre|code|xmp)$/i,De={};function re(){for(var ee=_.PR_SHOULD_USE_CONTINUATION?Me.now()+250:Infinity;Ue<xe.length&&Me.now()<ee;Ue++){for(var te=xe[Ue],W=De,G=te;G=G.previousSibling;){var Y=G.nodeType,q=(Y===7||Y===8)&&G.nodeValue;if(q?!/^\??prettify\b/.test(q):Y!==3||/\S/.test(G.nodeValue))break;if(q){W={},q.replace(/\b(\w+)=([\w:.%+-]+)/g,function(vt,tt,St){W[tt]=St});break}}var ue=te.className;if((W!==De||je.test(ue))&&!we.test(ue)){for(var ce=!1,Ae=te.parentNode;Ae;Ae=Ae.parentNode){var Ge=Ae.tagName;if(ge.test(Ge)&&Ae.className&&je.test(Ae.className)){ce=!0;break}}if(!ce){te.className+=" prettyprinted";var Xe=W.lang;if(!Xe){Xe=ue.match(Fe);var He;!Xe&&(He=ae(te))&&_e.test(He.tagName)&&(Xe=He.className.match(Fe)),Xe&&(Xe=Xe[1])}var Je;if(Oe.test(te.tagName))Je=1;else{var qe=te.currentStyle,ze=be.defaultView,nt=qe?qe.whiteSpace:ze&&ze.getComputedStyle?ze.getComputedStyle(te,null).getPropertyValue("white-space"):0;Je=nt&&nt.substring(0,3)==="pre"}var lt=W.linenums;(lt=lt==="true"||+lt)||(lt=ue.match(/\blinenums\b(?::(\d+))?/),lt=lt?lt[1]&&lt[1].length?+lt[1]:!0:!1),lt&&fe(te,lt,Je);var bt={langExtension:Xe,sourceNode:te,numberLines:lt,pre:Je,sourceCode:null,basePos:null,spans:null,decorations:null};ye(bt)}}}Ue<xe.length?_.setTimeout(re,250):typeof $=="function"&&$()}re()}var Re=_.PR={createSimpleLexer:oe,registerLangHandler:ie,sourceDecorator:Ce,PR_ATTRIB_NAME:R,PR_ATTRIB_VALUE:M,PR_COMMENT:g,PR_DECLARATION:E,PR_KEYWORD:T,PR_LITERAL:l,PR_NOCODE:N,PR_PLAIN:a,PR_PUNCTUATION:r,PR_SOURCE:w,PR_STRING:h,PR_TAG:y,PR_TYPE:f,prettyPrintOne:S?_.prettyPrintOne=Pe:L=Pe,prettyPrint:B=S?_.prettyPrint=Le:B=Le},X=_.define;typeof X=="function"&&X.amd&&X("google-code-prettify",[],function(){return Re})})()},T8No:function(Ze,le,H){"use strict";H.d(le,"a",function(){return k}),H.d(le,"b",function(){return b}),H.d(le,"d",function(){return c}),H.d(le,"c",function(){return v}),H.d(le,"e",function(){return x});var se=H("N0LK"),U=H("Cg/j"),S=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,p){i.__proto__=p}||function(i,p){for(var u in p)p.hasOwnProperty(u)&&(i[u]=p[u])},n(e,t)};return function(e,t){n(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}(),k=function(){function n(){}return n.has=function(e){return L.create(e)},n.equals=function(e,t){return B.create(e,t)},n.regex=function(e,t){return C.create(e,t)},n.not=function(e){return A.create(e)},n.and=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return m.create(e)},n.or=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return b.create(e)},n.deserialize=function(e,t){return t===void 0&&(t=!1),e?this._deserializeOrExpression(e,t):void 0},n._deserializeOrExpression=function(e,t){var i=this,p=e.split("||");return b.create(p.map(function(u){return i._deserializeAndExpression(u,t)}))},n._deserializeAndExpression=function(e,t){var i=this,p=e.split("&&");return m.create(p.map(function(u){return i._deserializeOne(u,t)}))},n._deserializeOne=function(e,t){if(e=e.trim(),e.indexOf("!=")>=0){var i=e.split("!=");return _.create(i[0].trim(),this._deserializeValue(i[1],t))}if(e.indexOf("==")>=0){var i=e.split("==");return B.create(i[0].trim(),this._deserializeValue(i[1],t))}if(e.indexOf("=~")>=0){var i=e.split("=~");return C.create(i[0].trim(),this._deserializeRegexValue(i[1],t))}return/^\!\s*/.test(e)?A.create(e.substr(1).trim()):L.create(e)},n._deserializeValue=function(e,t){if(e=e.trim(),e==="true")return!0;if(e==="false")return!1;var i=/^'([^']*)'$/.exec(e);return i?i[1].trim():e},n._deserializeRegexValue=function(e,t){if(Object(se.x)(e)){if(t)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}var i=e.indexOf("/"),p=e.lastIndexOf("/");if(i===p||i<0){if(t)throw new Error("bad regexp-value '"+e+"', missing /-enclosure");return console.warn("bad regexp-value '"+e+"', missing /-enclosure"),null}var u=e.slice(i+1,p),h=e[p+1]==="i"?"i":"";try{return new RegExp(u,h)}catch(T){if(t)throw new Error("bad regexp-value '"+e+"', parse error: "+T);return console.warn("bad regexp-value '"+e+"', parse error: "+T),null}},n}();function D(n,e){var t=n.getType(),i=e.getType();if(t!==i)return t-i;switch(t){case 1:return n.cmp(e);case 2:return n.cmp(e);case 3:return n.cmp(e);case 4:return n.cmp(e);case 6:return n.cmp(e);case 7:return n.cmp(e);case 5:return n.cmp(e);default:throw new Error("Unknown ContextKeyExpr!")}}var L=function(){function n(e){this.key=e}return n.create=function(e){return new n(e)},n.prototype.getType=function(){return 1},n.prototype.cmp=function(e){return this.key<e.key?-1:this.key>e.key?1:0},n.prototype.equals=function(e){return e instanceof n?this.key===e.key:!1},n.prototype.evaluate=function(e){return!!e.getValue(this.key)},n.prototype.keys=function(){return[this.key]},n.prototype.negate=function(){return A.create(this.key)},n}(),B=function(){function n(e,t){this.key=e,this.value=t}return n.create=function(e,t){return typeof t=="boolean"?t?L.create(e):A.create(e):new n(e,t)},n.prototype.getType=function(){return 3},n.prototype.cmp=function(e){return this.key<e.key?-1:this.key>e.key?1:this.value<e.value?-1:this.value>e.value?1:0},n.prototype.equals=function(e){return e instanceof n?this.key===e.key&&this.value===e.value:!1},n.prototype.evaluate=function(e){return e.getValue(this.key)==this.value},n.prototype.keys=function(){return[this.key]},n.prototype.negate=function(){return _.create(this.key,this.value)},n}(),_=function(){function n(e,t){this.key=e,this.value=t}return n.create=function(e,t){return typeof t=="boolean"?t?A.create(e):L.create(e):new n(e,t)},n.prototype.getType=function(){return 4},n.prototype.cmp=function(e){return this.key<e.key?-1:this.key>e.key?1:this.value<e.value?-1:this.value>e.value?1:0},n.prototype.equals=function(e){return e instanceof n?this.key===e.key&&this.value===e.value:!1},n.prototype.evaluate=function(e){return e.getValue(this.key)!=this.value},n.prototype.keys=function(){return[this.key]},n.prototype.negate=function(){return B.create(this.key,this.value)},n}(),A=function(){function n(e){this.key=e}return n.create=function(e){return new n(e)},n.prototype.getType=function(){return 2},n.prototype.cmp=function(e){return this.key<e.key?-1:this.key>e.key?1:0},n.prototype.equals=function(e){return e instanceof n?this.key===e.key:!1},n.prototype.evaluate=function(e){return!e.getValue(this.key)},n.prototype.keys=function(){return[this.key]},n.prototype.negate=function(){return L.create(this.key)},n}(),C=function(){function n(e,t){this.key=e,this.regexp=t}return n.create=function(e,t){return new n(e,t)},n.prototype.getType=function(){return 6},n.prototype.cmp=function(e){if(this.key<e.key)return-1;if(this.key>e.key)return 1;var t=this.regexp?this.regexp.source:"",i=e.regexp?e.regexp.source:"";return t<i?-1:t>i?1:0},n.prototype.equals=function(e){if(e instanceof n){var t=this.regexp?this.regexp.source:"",i=e.regexp?e.regexp.source:"";return this.key===e.key&&t===i}return!1},n.prototype.evaluate=function(e){var t=e.getValue(this.key);return this.regexp?this.regexp.test(t):!1},n.prototype.keys=function(){return[this.key]},n.prototype.negate=function(){return s.create(this)},n}(),s=function(){function n(e){this._actual=e}return n.create=function(e){return new n(e)},n.prototype.getType=function(){return 7},n.prototype.cmp=function(e){return this._actual.cmp(e._actual)},n.prototype.equals=function(e){return e instanceof n?this._actual.equals(e._actual):!1},n.prototype.evaluate=function(e){return!this._actual.evaluate(e)},n.prototype.keys=function(){return this._actual.keys()},n.prototype.negate=function(){return this._actual},n}(),m=function(){function n(e){this.expr=e}return n.create=function(e){var t=n._normalizeArr(e);return t.length===0?void 0:t.length===1?t[0]:new n(t)},n.prototype.getType=function(){return 5},n.prototype.cmp=function(e){if(this.expr.length<e.expr.length)return-1;if(this.expr.length>e.expr.length)return 1;for(var t=0,i=this.expr.length;t<i;t++){var p=D(this.expr[t],e.expr[t]);if(p!==0)return p}return 0},n.prototype.equals=function(e){if(e instanceof n){if(this.expr.length!==e.expr.length)return!1;for(var t=0,i=this.expr.length;t<i;t++)if(!this.expr[t].equals(e.expr[t]))return!1;return!0}return!1},n.prototype.evaluate=function(e){for(var t=0,i=this.expr.length;t<i;t++)if(!this.expr[t].evaluate(e))return!1;return!0},n._normalizeArr=function(e){var t=[];if(e){for(var i=0,p=e.length;i<p;i++){var u=e[i];if(!u)continue;if(u instanceof n){t=t.concat(u.expr);continue}if(u instanceof b)throw new Error('It is not allowed to have an or expression here due to lack of parens! For example "a && (b||c)" is not supported, use "(a&&b) || (a&&c)" instead.');t.push(u)}t.sort(D)}return t},n.prototype.keys=function(){for(var e=[],t=0,i=this.expr;t<i.length;t++){var p=i[t];e.push.apply(e,p.keys())}return e},n.prototype.negate=function(){for(var e=[],t=0,i=this.expr;t<i.length;t++){var p=i[t];e.push(p.negate())}return b.create(e)},n}(),b=function(){function n(e){this.expr=e}return n.create=function(e){var t=n._normalizeArr(e);return t.length===0?void 0:t.length===1?t[0]:new n(t)},n.prototype.getType=function(){return 8},n.prototype.equals=function(e){if(e instanceof n){if(this.expr.length!==e.expr.length)return!1;for(var t=0,i=this.expr.length;t<i;t++)if(!this.expr[t].equals(e.expr[t]))return!1;return!0}return!1},n.prototype.evaluate=function(e){for(var t=0,i=this.expr.length;t<i;t++)if(this.expr[t].evaluate(e))return!0;return!1},n._normalizeArr=function(e){var t=[];if(e){for(var i=0,p=e.length;i<p;i++){var u=e[i];if(!u)continue;if(u instanceof n){t=t.concat(u.expr);continue}t.push(u)}t.sort(D)}return t},n.prototype.keys=function(){for(var e=[],t=0,i=this.expr;t<i.length;t++){var p=i[t];e.push.apply(e,p.keys())}return e},n.prototype.negate=function(){for(var e=[],t=0,i=this.expr;t<i.length;t++){var p=i[t];e.push(p.negate())}for(var u=function(w){return w instanceof n?w.expr:[w]};e.length>1;){for(var h=e.shift(),T=e.shift(),g=[],f=0,l=u(h);f<l.length;f++)for(var r=l[f],a=0,y=u(T);a<y.length;a++){var E=y[a];g.push(k.and(r,E))}e.unshift(k.or.apply(k,g))}return e[0]},n}(),c=function(n){S(e,n);function e(t,i){var p=n.call(this,t)||this;return p._defaultValue=i,p}return e.prototype.bindTo=function(t){return t.createKey(this.key,this._defaultValue)},e.prototype.getValue=function(t){return t.getContextKeyValue(this.key)},e.prototype.toNegated=function(){return k.not(this.key)},e}(L),v=Object(U.c)("contextKeyService"),x="setContext"},Y1PL:function(Ze,le,H){"use strict";H.r(le),H.d(le,"ResizableTextArea",function(){return ae});var se=H("wx14"),U=H("1OyB"),S=H("vuIU"),k=H("Ji7U"),D=H("LK+K"),L=H("q1tI"),B=H("VTBJ"),_=H("rePB"),A=H("Zm9Q"),C=H("Kwbf"),s=H("c+Xe"),m=H("m+aA"),b=H("bdgK"),c=new Map;function v(he){he.forEach(function(fe){var pe,me=fe.target;(pe=c.get(me))===null||pe===void 0||pe.forEach(function(ie){return ie(me)})})}var x=new b.default(v),n=null,e=null;function t(he,fe){c.has(he)||(c.set(he,new Set),x.observe(he)),c.get(he).add(fe)}function i(he,fe){c.has(he)&&(c.get(he).delete(fe),c.get(he).size||(x.unobserve(he),c.delete(he)))}var p=function(he){Object(k.a)(pe,he);var fe=Object(D.a)(pe);function pe(){return Object(U.a)(this,pe),fe.apply(this,arguments)}return Object(S.a)(pe,[{key:"render",value:function(){return this.props.children}}]),pe}(L.Component),u=L.createContext(null);function h(he){var fe=he.children,pe=he.onBatchResize,me=L.useRef(0),ie=L.useRef([]),J=L.useContext(u),ye=L.useCallback(function(Pe,Le,Re){me.current+=1;var X=me.current;ie.current.push({size:Pe,element:Le,data:Re}),Promise.resolve().then(function(){X===me.current&&(pe==null||pe(ie.current),ie.current=[])}),J==null||J(Pe,Le,Re)},[pe,J]);return L.createElement(u.Provider,{value:ye},fe)}function T(he){var fe=he.children,pe=he.disabled,me=L.useRef(null),ie=L.useRef(null),J=L.useContext(u),ye=L.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Pe=L.isValidElement(fe)&&Object(s.c)(fe),Le=Pe?fe.ref:null,Re=L.useMemo(function(){return Object(s.a)(Le,me)},[Le,me]),X=L.useRef(he);X.current=he;var $=L.useCallback(function(ne){var de=X.current,be=de.onResize,ve=de.data,Ee=ne.getBoundingClientRect(),xe=Ee.width,Be=Ee.height,Ie=ne.offsetWidth,ke=ne.offsetHeight,Me=Math.floor(xe),Ue=Math.floor(Be);if(ye.current.width!==Me||ye.current.height!==Ue||ye.current.offsetWidth!==Ie||ye.current.offsetHeight!==ke){var Fe={width:Me,height:Ue,offsetWidth:Ie,offsetHeight:ke};ye.current=Fe;var je=Ie===Math.round(xe)?xe:Ie,we=ke===Math.round(Be)?Be:ke,Oe=Object(B.a)(Object(B.a)({},Fe),{},{offsetWidth:je,offsetHeight:we});J==null||J(Oe,ne,ve),be&&Promise.resolve().then(function(){be(Oe,ne)})}},[]);return L.useEffect(function(){var ne=Object(m.a)(me.current)||Object(m.a)(ie.current);return ne&&!pe&&t(ne,$),function(){return i(ne,$)}},[me.current,pe]),L.createElement(p,{ref:ie},Pe?L.cloneElement(fe,{ref:Re}):fe)}var g="rc-observer-key";function f(he){var fe=he.children,pe=Object(A.a)(fe);return pe.map(function(me,ie){var J=(me==null?void 0:me.key)||"".concat(g,"-").concat(ie);return L.createElement(T,Object(se.a)({},he,{key:J}),me)})}f.Collection=h;var l=f,r=H("bT9E"),a=H("TSYQ"),y=H.n(a),E=`
min-height:0 !important;
max-height:none !important;
height:0 !important;
visibility:hidden !important;
overflow:hidden !important;
position:absolute !important;
z-index:-1000 !important;
top:0 !important;
right:0 !important
`,w=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],R={},M;function N(he){var fe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,pe=he.getAttribute("id")||he.getAttribute("data-reactid")||he.getAttribute("name");if(fe&&R[pe])return R[pe];var me=window.getComputedStyle(he),ie=me.getPropertyValue("box-sizing")||me.getPropertyValue("-moz-box-sizing")||me.getPropertyValue("-webkit-box-sizing"),J=parseFloat(me.getPropertyValue("padding-bottom"))+parseFloat(me.getPropertyValue("padding-top")),ye=parseFloat(me.getPropertyValue("border-bottom-width"))+parseFloat(me.getPropertyValue("border-top-width")),Pe=w.map(function(Re){return"".concat(Re,":").concat(me.getPropertyValue(Re))}).join(";"),Le={sizingStyle:Pe,paddingSize:J,borderSize:ye,boxSizing:ie};return fe&&pe&&(R[pe]=Le),Le}function j(he){var fe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,pe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,me=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;M||(M=document.createElement("textarea"),M.setAttribute("tab-index","-1"),M.setAttribute("aria-hidden","true"),document.body.appendChild(M)),he.getAttribute("wrap")?M.setAttribute("wrap",he.getAttribute("wrap")):M.removeAttribute("wrap");var ie=N(he,fe),J=ie.paddingSize,ye=ie.borderSize,Pe=ie.boxSizing,Le=ie.sizingStyle;M.setAttribute("style","".concat(Le,";").concat(E)),M.value=he.value||he.placeholder||"";var Re=Number.MIN_SAFE_INTEGER,X=Number.MAX_SAFE_INTEGER,$=M.scrollHeight,ne;if(Pe==="border-box"?$+=ye:Pe==="content-box"&&($-=J),pe!==null||me!==null){M.value=" ";var de=M.scrollHeight-J;pe!==null&&(Re=de*pe,Pe==="border-box"&&(Re=Re+J+ye),$=Math.max(Re,$)),me!==null&&(X=de*me,Pe==="border-box"&&(X=X+J+ye),ne=$>X?"":"hidden",$=Math.min(X,$))}return{height:$,minHeight:Re,maxHeight:X,overflowY:ne,resize:"none"}}var K=H("Gytx"),V=H.n(K),z;(function(he){he[he.NONE=0]="NONE",he[he.RESIZING=1]="RESIZING",he[he.RESIZED=2]="RESIZED"})(z||(z={}));var Q=function(he){Object(k.a)(pe,he);var fe=Object(D.a)(pe);function pe(me){var ie;return Object(U.a)(this,pe),ie=fe.call(this,me),ie.nextFrameActionId=void 0,ie.resizeFrameId=void 0,ie.textArea=void 0,ie.saveTextArea=function(J){ie.textArea=J},ie.handleResize=function(J){var ye=ie.state.resizeStatus,Pe=ie.props,Le=Pe.autoSize,Re=Pe.onResize;if(ye!==z.NONE)return;typeof Re=="function"&&Re(J),Le&&ie.resizeOnNextFrame()},ie.resizeOnNextFrame=function(){cancelAnimationFrame(ie.nextFrameActionId),ie.nextFrameActionId=requestAnimationFrame(ie.resizeTextarea)},ie.resizeTextarea=function(){var J=ie.props.autoSize;if(!J||!ie.textArea)return;var ye=J.minRows,Pe=J.maxRows,Le=j(ie.textArea,!1,ye,Pe);ie.setState({textareaStyles:Le,resizeStatus:z.RESIZING},function(){cancelAnimationFrame(ie.resizeFrameId),ie.resizeFrameId=requestAnimationFrame(function(){ie.setState({resizeStatus:z.RESIZED},function(){ie.resizeFrameId=requestAnimationFrame(function(){ie.setState({resizeStatus:z.NONE}),ie.fixFirefoxAutoScroll()})})})})},ie.renderTextArea=function(){var J=ie.props,ye=J.prefixCls,Pe=ye===void 0?"rc-textarea":ye,Le=J.autoSize,Re=J.onResize,X=J.className,$=J.disabled,ne=ie.state,de=ne.textareaStyles,be=ne.resizeStatus,ve=Object(r.a)(ie.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ee=y()(Pe,X,Object(_.a)({},"".concat(Pe,"-disabled"),$));"value"in ve&&(ve.value=ve.value||"");var xe=Object(B.a)(Object(B.a)(Object(B.a)({},ie.props.style),de),be===z.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return L.createElement(l,{onResize:ie.handleResize,disabled:!(Le||Re)},L.createElement("textarea",Object(se.a)({},ve,{className:Ee,style:xe,ref:ie.saveTextArea})))},ie.state={textareaStyles:{},resizeStatus:z.NONE},ie}return Object(S.a)(pe,[{key:"componentDidUpdate",value:function(ie){(ie.value!==this.props.value||!V()(ie.autoSize,this.props.autoSize))&&this.resizeTextarea()}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.nextFrameActionId),cancelAnimationFrame(this.resizeFrameId)}},{key:"fixFirefoxAutoScroll",value:function(){try{if(document.activeElement===this.textArea){var ie=this.textArea.selectionStart,J=this.textArea.selectionEnd;this.textArea.setSelectionRange(ie,J)}}catch(ye){}}},{key:"render",value:function(){return this.renderTextArea()}}]),pe}(L.Component),ae=Q,oe=function(he){Object(k.a)(pe,he);var fe=Object(D.a)(pe);function pe(me){var ie;Object(U.a)(this,pe),ie=fe.call(this,me),ie.resizableTextArea=void 0,ie.focus=function(){ie.resizableTextArea.textArea.focus()},ie.saveTextArea=function(ye){ie.resizableTextArea=ye},ie.handleChange=function(ye){var Pe=ie.props.onChange;ie.setValue(ye.target.value,function(){ie.resizableTextArea.resizeTextarea()}),Pe&&Pe(ye)},ie.handleKeyDown=function(ye){var Pe=ie.props,Le=Pe.onPressEnter,Re=Pe.onKeyDown;ye.keyCode===13&&Le&&Le(ye),Re&&Re(ye)};var J=typeof me.value=="undefined"||me.value===null?me.defaultValue:me.value;return ie.state={value:J},ie}return Object(S.a)(pe,[{key:"setValue",value:function(ie,J){"value"in this.props||this.setState({value:ie},J)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return L.createElement(ae,Object(se.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ie){return"value"in ie?{value:ie.value}:null}}]),pe}(L.Component),Ce=le.default=oe},ZW9T:function(Ze,le,H){"use strict";H.d(le,"a",function(){return l});var se=H("k1fw"),U=H("oBTY"),S=H("9og8"),k=H("miYZ"),D=H("tsqr"),L=H("rAM+"),B=H("tJVT"),_=H("PpiC"),A=H("WmNS"),C=H.n(A),s=H("q1tI"),m=H.n(s),b=H("bdgK");function c(r,a,y,E,w){var R=a.getWordUntilPosition(y),M={startLineNumber:y.lineNumber,endLineNumber:y.lineNumber,startColumn:R.startColumn,endColumn:R.endColumn},N=E.map(function(j){return{label:j,kind:r.languages.CompletionItemKind.Keyword,insertText:j,insertTextRules:r.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:M}});return w.map(function(j){N.push(Object(se.a)(Object(se.a)({},j),{},{range:M}))}),N}var v=function(r){var a={label:"ifelse",kind:r.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`),insertTextRules:r.languages.CompletionItemInsertTextRule.InsertAsSnippet},y=["auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while","inline","restrict","_Bool","_Complex","_Imaginary","_Alignas","_Alignof","_Atomic","_Static_assert","_Noreturn","_Thread_local","_Generic"];r.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(M,N){var j=c(r,M,N,y,[a]);return{suggestions:j}}});var E=["False","None","True","and","as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"];r.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(M,N){var j=[{label:"print",kind:r.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
`),insertTextRules:r.languages.CompletionItemInsertTextRule.InsertAsSnippet}],K=c(r,M,N,E,j);return{suggestions:K}}});var w=["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instance of","int","interface","long","native","new","package","private","protected","public","return","strictfp","short","static","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while"];r.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(M,N){var j=[a,{label:"main",kind:r.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
`),insertTextRules:r.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:r.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
`),insertTextRules:r.languages.CompletionItemInsertTextRule.InsertAsSnippet}],K=c(r,M,N,w,j);return{suggestions:K}}})},x="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",n=H("fjLI"),e=H("LvDl"),t=H("+ua5");function i(r){return/^\d+$/.test(r)?"".concat(r,"px"):r}function p(){}var u=!1,h={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python",Scala:"scale"};function T(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],a=r;if(Array.isArray(r)){for(var y=0;y<r.length;y++){var E=h[r[y]];if(E)return E}return a[0]}return h[a]||a}var g=null,f=le.b=function(r){var a=r.width,y=a===void 0?"100%":a,E=r.height,w=E===void 0?"100%":E,R=r.value,M=r.language,N=M===void 0?"javascript":M,j=r.style,K=j===void 0?{}:j,V=r.options,z=V===void 0?{}:V,Q=r.overrideServices,ae=Q===void 0?{}:Q,oe=r.theme,Ce=oe===void 0?"vs-dark":oe,he=r.onEditBlur,fe=r.onSave,pe=r.autoHeight,me=pe===void 0?!1:pe,ie=r.forbidCopy,J=ie===void 0?!1:ie,ye=r.onChange,Pe=ye===void 0?p:ye,Le=r.editorDidMount,Re=Le===void 0?p:Le,X=r.onFocus,$=X===void 0?p:X,ne=r.onBreakPoint,de=ne===void 0?p:ne,be=r.breakPointValue,ve=be===void 0?[]:be,Ee=r.filename,xe=Ee===void 0?"educoder.txt":Ee,Be=r.errorLine,Ie=r.errorContent,ke=Ie===void 0?"":Ie,Me=r.highlightLine,Ue=r.openBreakPoint,Fe=Ue===void 0?!1:Ue,je=Object(_.a)(r,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","onBreakPoint","breakPointValue","filename","errorLine","errorContent","highlightLine","openBreakPoint"]),we=Object(s.useRef)(),Oe=Object(s.useRef)({}),_e=Object(s.useRef)(),ge=Object(s.useRef)(),De=Object(s.useRef)([]),re=Object(s.useRef)(!1),ee=Object(s.useRef)(),te=Object(s.useState)(!1),W=Object(B.a)(te,2),G=W[0],Y=W[1];function q(){var $e;return we.current&&($e=new b.default(function(We){var Ve=Object(L.a)(We),pt;try{for(Ve.s();!(pt=Ve.n()).done;){var yt=pt.value;(yt.target.offsetHeight>0||yt.target.offsetWidth>0)&&Oe.current.instance.layout()}}catch(ct){Ve.e(ct)}finally{Ve.f()}}),$e.observe(we.current)),$e}function ue(){D.b.warn({content:decodeURIComponent(x),key:"monaco-editor-tip"})}var ce=function(){var We=Oe.current.instance;if(R!=null&&We&&G){var Ve=We.getModel();Ve&&R!==Ve.getValue()&&(u=!0,Ve.setValue(R),We.layout(),u=!1)}};Object(s.useEffect)(function(){try{var $e,We=Oe.current.instance;ge.current&&clearTimeout(ge.current),ge.current=setTimeout(function(){ce()},500),We==null||(($e=We.updateOptions)===null||$e===void 0)||$e.call(We,{lineNumbersMinChars:Math.max(Math.floor(Math.log10(R.split(/\r\n|\r|\n/g).length))+3,5)})}catch(Ve){debugger}},[R,G,Oe.current]),Object(s.useEffect)(function(){try{if(Be&&Oe.current&&Oe.current.instance){var $e=Oe.current.instance;$e.changeViewZones(function(Ve){var pt=document.createElement("div");pt.style.padding="10px 20px",pt.style.width="calc(100% - 20px)",pt.className="my-error-line-wrp",pt.innerHTML=ke,Ve.addZone({afterLineNumber:Be||11,heightInLines:3,domNode:pt})});var We={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};$e.addOverlayWidget(We),$e.revealPositionInCenter({lineNumber:20,column:1})}}catch(Ve){debugger}},[Be,Oe.current,G]),Object(s.useEffect)(function(){var $e;if(($e=Oe.current)!==null&&$e!==void 0&&$e.instance&&G&&Fe){var We=Oe.current.instance,Ve=We.getModel();if(!Ve)return;var pt=function(){var at=[],et=[],ot=Ve.getAllDecorations(),ut=Object(L.a)(ot),ft;try{for(ut.s();!(ft=ut.n()).done;){var O=ft.value;if(O.options.className==="highlighted-line"){var o;at.push(O==null||((o=O.range)===null||o===void 0)?void 0:o.startLineNumber),et.push(O==null?void 0:O.id)}}}catch(P){ut.e(P)}finally{ut.f()}Ve.deltaDecorations(et,[]);var d=Ve.getLineCount();!!Me&&Me<=d&&(We.deltaDecorations([],[{range:new g.Range(Me,1,Me,Ve.getLineMaxColumn(Me)),options:{isWholeLine:!0,className:"highlighted-line"}}]),We.revealLineInCenter(Me))};pt();var yt=function(){var at=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,et=[],ot=[],ut=Ve.getAllDecorations(),ft=Object(L.a)(ut),O;try{for(ft.s();!(O=ft.n()).done;){var o=O.value;if(o.options.linesDecorationsClassName==="breakpoints"){var d;et.push(o==null||((d=o.range)===null||d===void 0)?void 0:d.startLineNumber),ot.push(o==null?void 0:o.id)}}}catch(P){ft.e(P)}finally{ft.f()}if(at)return{lines:et,ids:ot};de(et)},ct=function(){var dt=Object(S.a)(C.a.mark(function at(et){var ot;return C.a.wrap(function(ft){for(;;)switch(ft.prev=ft.next){case 0:return ot={range:new g.Range(et,1,et,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints"}},ft.next=3,Ve.deltaDecorations([],[ot]);case 3:yt();case 4:case"end":return ft.stop()}},at)}));return function(et){return dt.apply(this,arguments)}}(),gt=function(){var dt=Object(S.a)(C.a.mark(function at(et){var ot,ut,ft,O,o;return C.a.wrap(function(P){for(;;)switch(P.prev=P.next){case 0:ot=[],ut=We.getLineDecorations(et),ft=Object(L.a)(ut);try{for(ft.s();!(O=ft.n()).done;)o=O.value,o.options.linesDecorationsClassName==="breakpoints"&&ot.push(o.id)}catch(F){ft.e(F)}finally{ft.f()}return P.next=6,Ve.deltaDecorations(ot,[]);case 6:yt();case 7:case"end":return P.stop()}},at)}));return function(et){return dt.apply(this,arguments)}}(),It=function(at){var et=We.getLineDecorations(at),ot=Object(L.a)(et),ut;try{for(ot.s();!(ut=ot.n()).done;){var ft=ut.value;if(ft.options.linesDecorationsClassName==="breakpoints")return!0}}catch(O){ot.e(O)}finally{ot.f()}return!1};if(!Object(e.isEqual)(ve,yt(!0).lines)){Ve.deltaDecorations(yt(!0).ids,[]);var kt=ve.map(function(dt){return{range:new g.Range(dt,1,dt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints"}}});Ve.deltaDecorations([],kt)}var Mt=We.onDidChangeModelContent(function(dt){var at=We.getPosition();if(at){var et=at.lineNumber;Ve.getLineContent(et).trim()===""?gt(et):It(et)&&(gt(et),ct(et))}}),jt=We.onMouseDown(function(dt){var at,et,ot;if(dt.target.detail&&(at=dt.target)!==null&&at!==void 0&&(et=at.element)!==null&&et!==void 0&&(ot=et.className)!==null&&ot!==void 0&&ot.includes("line-numbers")){var ut=dt.target.position.lineNumber;if(Ve.getLineContent(ut).trim()==="")return;It(ut)?gt(ut):ct(ut)}}),Ot=function(at){var et={range:new g.Range(at,1,at,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-fake"}};De.current=We.deltaDecorations(De.current,[et])},Nt=function(){De.current=We.deltaDecorations(De.current,[])},Wt=We.onMouseMove(function(dt){var at,et,ot;if(Nt(),dt.target.detail&&(at=dt.target)!==null&&at!==void 0&&(et=at.element)!==null&&et!==void 0&&(ot=et.className)!==null&&ot!==void 0&&ot.includes("line-numbers")){var ut=dt.target.position.lineNumber;if(Ve.getLineContent(ut).trim()==="")return;Ot(ut)}}),Ht=We.onMouseLeave(function(){Nt()});return function(){Mt.dispose(),jt.dispose(),Wt.dispose(),Ht.dispose()}}},[Oe.current,G,ve,Me,Fe]);function Ae(){var $e=Oe.current.instance;if($e){var We=$e.getSelection(),Ve=Oe.current.pastePos||{},pt=new g.Range(Ve.startLineNumber||We.endLineNumber,Ve.startColumn||We.endColumn,Ve.endLineNumber||We.endLineNumber,Ve.endColumn||We.endColumn);setTimeout(function(){$e.executeEdits("",[{range:pt,text:""}])},300)}}function Ge($e){(window.navigator.platform.match("Mac")?$e.metaKey:$e.ctrlKey)&&$e.keyCode==83&&($e.preventDefault(),fe())}var Xe=function(){if(me&&Oe.current.instance){var We=Oe.current.instance.getContentHeight();Lt(We<w?w:We)}else Lt(w)};function He($e){var We=document.createEvent("MouseEvents");We.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),$e.dispatchEvent(We)}var Je=function(We){var Ve=We.keyCode,pt=We.ctrlKey,yt=We.metaKey,ct=We.target,gt=We.type;return(gt==="paste"||(Ve===67||Ve===86)&&(yt||pt))&&ct.nodeName==="TEXTAREA"&&(ue(),We.preventDefault()),!1};function qe($e,We){var Ve=window.URL||window.webkitURL||window,pt=new Blob([We]),yt=document.createElementNS("http://www.w3.org/1999/xhtml","a");yt.href=Ve.createObjectURL(pt),yt.download=$e,He(yt)}Object(s.useEffect)(function(){Xe()},[Xe]),Object(s.useEffect)(function(){we.current&&!G&&H.e(27).then(H.t.bind(null,"M/lh",7)).then(function($e){try{g=$e,Oe.current.instance=g.editor.create(we.current,{value:R,language:T(N),theme:Ce,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0,autoIndent:!0,contextmenu:!0,formatOnType:!0},ae);var We=Oe.current.instance,Ve=n.c._menuItems,pt=Object(U.a)(Ve).find(function(ct){return ct[0]._debugName=="EditorContext"});if(Re(We,g),setTimeout(function(){Xe(),Oe.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){qe(xe||"educoder.txt",We.getValue())}}),We.getDomNode().addEventListener("input",function(){_e.current.autoFormat&&We.getAction("editor.action.formatDocument").run()})},500),Oe.current.subscription=We.onDidChangeModelContent(function(ct){debugger;re.current?clearTimeout(ee.current):(Xe(),Pe(We.getValue(),ct)),ee.current=setTimeout(function(){re.current=!1},500)}),window.Monaco||v(g,T(N)),J&&(we.current.classList.add("noCopyPaste"),window.removeEventListener("keydown",Je),window.removeEventListener("paste",Je),window.addEventListener("keydown",Je),window.addEventListener("paste",Je)),window.Monaco=g,he&&We.onDidBlurEditorWidget(function(){he(We.getValue())}),$&&We.onDidFocusEditorText(function(){$(We.getValue())}),J)try{window.addEventListener("paste",Ae)}catch(ct){}var yt=q();return Y(!0),function(){var ct=Oe.current.instance;ct.dispose();var gt=ct.getModel();gt&&gt.dispose(),Oe.current.subscription&&Oe.current.subscription.dispose(),J&&window.removeEventListener("paste",Ae),yt.unobserve(we.current)}}catch(ct){debugger}})},[]),Object(s.useEffect)(function(){var $e=Oe.current.instance;if($e&&G)return document.addEventListener("keydown",Ge,!1),function(){document.removeEventListener("keydown",Ge)}},[fe,G]),Object(s.useEffect)(function(){var $e=Oe.current.instance;if($e&&G){var We=T(N);g.editor.setModelLanguage($e.getModel(),We)}},[N,G]),Object(s.useEffect)(function(){var $e=Oe.current.instance;$e&&G&&g.editor.setTheme(Ce)},[Ce,G]),Object(s.useEffect)(function(){var $e=Oe.current.instance;_e.current=z,$e&&G&&($e.updateOptions(Object(se.a)({},z)),setTimeout(function(){$e.getModel().updateOptions(Object(se.a)({},z))},200))},[JSON.stringify(z),G]),Object(s.useEffect)(function(){var $e=Oe.current.instance;$e&&G&&$e.layout()},[y,w,G]);var ze=Object(s.useState)(i(y)),nt=Object(B.a)(ze,2),lt=nt[0],bt=nt[1],vt=Object(s.useState)(i(w)),tt=Object(B.a)(vt,2),St=tt[0],Lt=tt[1],Ye=Object(se.a)(Object(se.a)({},K),{},{width:lt,height:St});return m.a.createElement("div",{className:"my-monaco-editor",ref:we,style:Ye})};function l(r){var a=r.width,y=a===void 0?"100%":a,E=r.height,w=E===void 0?"100%":E,R=r.original,M=r.modified,N=r.language,j=r.options,K=j===void 0?{}:j,V=Object(s.useRef)(),z=Object(s.useState)(null),Q=Object(B.a)(z,2),ae=Q[0],oe=Q[1];function Ce(me){var ie;return V.current&&(ie=new b.default(function(J){var ye=Object(L.a)(J),Pe;try{for(ye.s();!(Pe=ye.n()).done;){var Le=Pe.value;(Le.target.offsetHeight>0||Le.target.offsetWidth>0)&&me.layout()}}catch(Re){ye.e(Re)}finally{ye.f()}}),ie.observe(V.current)),ie}Object(s.useEffect)(function(){return V.current&&H.e(27).then(H.t.bind(null,"M/lh",7)).then(function(me){g=me;var ie=g.editor.createDiffEditor(V.current,Object(se.a)(Object(se.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",wordWrap:"off",ignoreTrimWhitespace:!1,"semanticHighlighting.enabled":!0,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},K),{},{wordWrap:!0}));oe(ie);var J=Ce(ie);return function(){ie.dispose();var ye=ie.getModel();ye&&ye.dispose(),J.unobserve(V.current)}}),function(){window.removeEventListener("keydown",checkPaste),window.removeEventListener("paste",checkPaste)}},[]),Object(s.useEffect)(function(){ae&&ae.setModel({original:g.editor.createModel(R,N),modified:g.editor.createModel(M,N)})},[R,M,N,ae]);var he=i(y),fe=i(w),pe={width:he,height:fe};return m.a.createElement("div",{className:"my-diff-editor",ref:V,style:pe})}},ZpRC:function(Ze,le,H){"use strict";function se(s){return typeof s=="object"&&s!=null&&s.nodeType===1}function U(s,m){return(!m||s!=="hidden")&&s!=="visible"&&s!=="clip"}function S(s,m){if(s.clientHeight<s.scrollHeight||s.clientWidth<s.scrollWidth){var b=getComputedStyle(s,null);return U(b.overflowY,m)||U(b.overflowX,m)||function(c){var v=function(x){if(!x.ownerDocument||!x.ownerDocument.defaultView)return null;try{return x.ownerDocument.defaultView.frameElement}catch(n){return null}}(c);return!!v&&(v.clientHeight<c.scrollHeight||v.clientWidth<c.scrollWidth)}(s)}return!1}function k(s,m,b,c,v,x,n,e){return x<s&&n>m||x>s&&n<m?0:x<=s&&e<=b||n>=m&&e>=b?x-s-c:n>m&&e<b||x<s&&e>b?n-m+v:0}var D=function(s,m){var b=window,c=m.scrollMode,v=m.block,x=m.inline,n=m.boundary,e=m.skipOverflowHiddenElements,t=typeof n=="function"?n:function(de){return de!==n};if(!se(s))throw new TypeError("Invalid target");for(var i=document.scrollingElement||document.documentElement,p=[],u=s;se(u)&&t(u);){if((u=u.parentElement)===i){p.push(u);break}u!=null&&u===document.body&&S(u)&&!S(document.documentElement)||u!=null&&S(u,e)&&p.push(u)}for(var h=b.visualViewport?b.visualViewport.width:innerWidth,T=b.visualViewport?b.visualViewport.height:innerHeight,g=window.scrollX||pageXOffset,f=window.scrollY||pageYOffset,l=s.getBoundingClientRect(),r=l.height,a=l.width,y=l.top,E=l.right,w=l.bottom,R=l.left,M=v==="start"||v==="nearest"?y:v==="end"?w:y+r/2,N=x==="center"?R+a/2:x==="end"?E:R,j=[],K=0;K<p.length;K++){var V=p[K],z=V.getBoundingClientRect(),Q=z.height,ae=z.width,oe=z.top,Ce=z.right,he=z.bottom,fe=z.left;if(c==="if-needed"&&y>=0&&R>=0&&w<=T&&E<=h&&y>=oe&&w<=he&&R>=fe&&E<=Ce)return j;var pe=getComputedStyle(V),me=parseInt(pe.borderLeftWidth,10),ie=parseInt(pe.borderTopWidth,10),J=parseInt(pe.borderRightWidth,10),ye=parseInt(pe.borderBottomWidth,10),Pe=0,Le=0,Re="offsetWidth"in V?V.offsetWidth-V.clientWidth-me-J:0,X="offsetHeight"in V?V.offsetHeight-V.clientHeight-ie-ye:0;if(i===V)Pe=v==="start"?M:v==="end"?M-T:v==="nearest"?k(f,f+T,T,ie,ye,f+M,f+M+r,r):M-T/2,Le=x==="start"?N:x==="center"?N-h/2:x==="end"?N-h:k(g,g+h,h,me,J,g+N,g+N+a,a),Pe=Math.max(0,Pe+f),Le=Math.max(0,Le+g);else{Pe=v==="start"?M-oe-ie:v==="end"?M-he+ye+X:v==="nearest"?k(oe,he,Q,ie,ye+X,M,M+r,r):M-(oe+Q/2)+X/2,Le=x==="start"?N-fe-me:x==="center"?N-(fe+ae/2)+Re/2:x==="end"?N-Ce+J+Re:k(fe,Ce,ae,me,J+Re,N,N+a,a);var $=V.scrollLeft,ne=V.scrollTop;M+=ne-(Pe=Math.max(0,Math.min(ne+Pe,V.scrollHeight-Q+X))),N+=$-(Le=Math.max(0,Math.min($+Le,V.scrollWidth-ae+Re)))}j.push({el:V,top:Pe,left:Le})}return j};function L(s){return s===Object(s)&&Object.keys(s).length!==0}function B(s,m){m===void 0&&(m="auto");var b="scrollBehavior"in document.body.style;s.forEach(function(c){var v=c.el,x=c.top,n=c.left;v.scroll&&b?v.scroll({top:x,left:n,behavior:m}):(v.scrollTop=x,v.scrollLeft=n)})}function _(s){return s===!1?{block:"end",inline:"nearest"}:L(s)?s:{block:"start",inline:"nearest"}}function A(s,m){var b=!s.ownerDocument.documentElement.contains(s);if(L(m)&&typeof m.behavior=="function")return m.behavior(b?[]:D(s,m));if(b)return;var c=_(m);return B(D(s,c),c.behavior)}var C=le.a=A},bT9E:function(Ze,le,H){"use strict";H.d(le,"a",function(){return U});var se=H("VTBJ");function U(S,k){var D=Object(se.a)({},S);return Array.isArray(k)&&k.forEach(function(L){delete D[L]}),D}},fjLI:function(Ze,le,H){"use strict";H.d(le,"e",function(){return C}),H.d(le,"a",function(){return s}),H.d(le,"c",function(){return m}),H.d(le,"d",function(){return c}),H.d(le,"b",function(){return v});var se=H("8HAY"),U=H("Cg/j"),S=H("T8No"),k=H("nnTU"),D=H("MI8n"),L=function(){var x=function(n,e){return x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var p in i)i.hasOwnProperty(p)&&(t[p]=i[p])},x(n,e)};return function(n,e){x(n,e);function t(){this.constructor=n}n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}}(),B=function(x,n,e,t){var i=arguments.length,p=i<3?n:t===null?t=Object.getOwnPropertyDescriptor(n,e):t,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(x,n,e,t);else for(var h=x.length-1;h>=0;h--)(u=x[h])&&(p=(i<3?u(p):i>3?u(n,e,p):u(n,e))||p);return i>3&&p&&Object.defineProperty(n,e,p),p},_=function(x,n){return function(e,t){n(e,t,x)}},A=function(){for(var x=0,n=0,e=arguments.length;n<e;n++)x+=arguments[n].length;for(var t=Array(x),i=0,n=0;n<e;n++)for(var p=arguments[n],u=0,h=p.length;u<h;u++,i++)t[i]=p[u];return t};function C(x){return x.command!==void 0}var s=Object(U.c)("menuService"),m=new(function(){function x(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new D.a,this.onDidChangeMenu=this._onDidChangeMenu.event}return x.prototype.addCommand=function(n){var e=this;return this._commands.set(n.id,n),this._onDidChangeMenu.fire(0),{dispose:function(){e._commands.delete(n.id)&&e._onDidChangeMenu.fire(0)}}},x.prototype.getCommand=function(n){return this._commands.get(n)},x.prototype.getCommands=function(){var n=new Map;return this._commands.forEach(function(e,t){return n.set(t,e)}),n},x.prototype.appendMenuItem=function(n,e){var t=this,i=this._menuItems.get(n);return i?i.push(e):(i=[e],this._menuItems.set(n,i)),this._onDidChangeMenu.fire(n),{dispose:function(){var p=i.indexOf(e);p>=0&&(i.splice(p,1),t._onDidChangeMenu.fire(n))}}},x.prototype.getMenuItems=function(n){var e=(this._menuItems.get(n)||[]).slice(0);return n===0&&this._appendImplicitItems(e),e},x.prototype._appendImplicitItems=function(n){for(var e=new Set,t=n.filter(function(g){return C(g)}),i=0,p=t;i<p.length;i++){var u=p[i],h=u.command,T=u.alt;e.add(h.id),T&&e.add(T.id)}this._commands.forEach(function(g,f){e.has(f)||n.push({command:g})})},x}()),b=function(x){L(n,x);function n(e,t,i){var p=x.call(this,e,t)||this;return p._commandService=i,p}return n.prototype.run=function(){for(var e,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return(e=this._commandService).executeCommand.apply(e,A([this.id],t))},n=B([_(2,k.b)],n),n}(se.a),c=function(x){L(n,x);function n(e){var t=this;return typeof e.title=="string"?t=x.call(this,"",e.title,"submenu")||this:t=x.call(this,"",e.title.value,"submenu")||this,t.item=e,t}return n}(se.a),v=function(x){L(n,x);function n(e,t,i,p,u){var h=this;return typeof e.title=="string"?h=x.call(this,e.id,e.title,u)||this:h=x.call(this,e.id,e.title.value,u)||this,h._cssClass=void 0,h._enabled=!e.precondition||p.contextMatchesRules(e.precondition),h._checked=Boolean(e.toggled&&p.contextMatchesRules(e.toggled)),h._options=i||{},h.item=e,h.alt=t?new n(t,void 0,h._options,p,u):void 0,h}return n.prototype.dispose=function(){this.alt&&this.alt.dispose(),x.prototype.dispose.call(this)},n.prototype.run=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=[];return this._options.arg&&(i=A(i,[this._options.arg])),this._options.shouldForwardArgs&&(i=A(i,e)),x.prototype.run.apply(this,i)},n=B([_(3,S.c),_(4,k.b)],n),n}(b)},kzJb:function(Ze,le,H){Ze.exports={flex_box_center:"flex_box_center___2qtoc",flex_space_between:"flex_space_between___NF1Yf",flex_box_vertical_center:"flex_box_vertical_center___2qH_j",flex_box_center_end:"flex_box_center_end___22P0N",flex_box_column:"flex_box_column___1IKP8",userInfo:"userInfo___2Dupy",navInfo:"navInfo___3fEvD",actived:"actived___3F322",newTip:"newTip___1Ta-b"}},nnTU:function(Ze,le,H){"use strict";H.d(le,"b",function(){return _}),H.d(le,"a",function(){return A});var se=H("pmY6"),U=H("746U"),S=H("Cg/j"),k=H("MI8n"),D=H("24hK"),L=H("QDVR"),B=function(){for(var C=0,s=0,m=arguments.length;s<m;s++)C+=arguments[s].length;for(var b=Array(C),c=0,s=0;s<m;s++)for(var v=arguments[s],x=0,n=v.length;x<n;x++,c++)b[c]=v[x];return b},_=Object(S.c)("commandService"),A=new(function(){function C(){this._commands=new Map,this._onDidRegisterCommand=new k.a,this.onDidRegisterCommand=this._onDidRegisterCommand.event}return C.prototype.registerCommand=function(s,m){var b=this;if(!s)throw new Error("invalid command");if(typeof s=="string"){if(!m)throw new Error("invalid command");return this.registerCommand({id:s,handler:m})}if(s.description){for(var c=[],v=0,x=s.description.args;v<x.length;v++){var n=x[v];c.push(n.constraint)}var e=s.handler;s.handler=function(h){for(var T=[],g=1;g<arguments.length;g++)T[g-1]=arguments[g];return Object(U.m)(T,c),e.apply(void 0,B([h],T))}}var t=s.id,i=this._commands.get(t);i||(i=new D.a,this._commands.set(t,i));var p=i.unshift(s),u=Object(se.h)(function(){p();var h=b._commands.get(t);(h==null?void 0:h.isEmpty())&&b._commands.delete(t)});return this._onDidRegisterCommand.fire(t),u},C.prototype.registerCommandAlias=function(s,m){return A.registerCommand(s,function(b){for(var c,v=[],x=1;x<arguments.length;x++)v[x-1]=arguments[x];return(c=b.get(_)).executeCommand.apply(c,B([m],v))})},C.prototype.getCommand=function(s){var m=this._commands.get(s);return!m||m.isEmpty()?void 0:m.iterator().next().value},C.prototype.getCommands=function(){for(var s=new Map,m=0,b=Object(L.d)(this._commands);m<b.length;m++){var c=b[m],v=this.getCommand(c);v&&s.set(c,v)}return s},C}())},p5ED:function(Ze,le,H){"use strict";var se=H("+L6B"),U=H("2/Rp"),S=H("5Dmo"),k=H("3S7+"),D=H("k1fw"),L=H("9og8"),B=H("tJVT"),_=H("WmNS"),A=H.n(_),C=H("q1tI"),s=H.n(C),m=H("vHTk"),b=H.n(m),c=H("yEEn"),v=H("ZW9T"),x=H("1vsH"),n=H("V0Rq"),e=H("m3rI");le.a=function(t){var i,p,u,h,T,g,f=t.editOffice,l=f===void 0?"view":f,r=t.name,a=t.data,y=t.theme,E=t.type,w=t.filename,R=t.monacoEditor,M=t.className,N=t.style,j=t.close,K=t.onClose,V=t.hasMask,z=t.disabledDownload,Q=t.onImgDimensions,ae=t.otherData,oe=Object(C.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),Ce=Object(B.a)(oe,2),he=Ce[0],fe=Ce[1],pe=Object(C.useState)(""),me=Object(B.a)(pe,2),ie=me[0],J=me[1],ye=Object(C.useState)(),Pe=Object(B.a)(ye,2),Le=Pe[0],Re=Pe[1],X=window.ENV==="build"?"/react/build":"",$=location.host.startsWith("localhost")?e.a.PROXY_SERVER:e.a.API_SERVER,ne,de=1024*1024,be=10*de,ve=Object(C.useRef)();(i=a)!==null&&i!==void 0&&i.startsWith("/api")&&E!=="txt"&&(a=e.a.API_SERVER+a),E==="office"&&(ne=Object(x.P)(a).filesize,ne>be&&(E="other")),w&&(R.filename=w),Object(C.useEffect)(function(){var Ie,ke,Me=(Ie=document.cookie)===null||Ie===void 0||((ke=Ie.replace(/\s/g,""))===null||ke===void 0)?void 0:ke.split(";");Me==null||Me.map(function(Ue){var Fe=Ue.split("=");Fe[0]==="_educoder_session"&&J(Fe[1])})},[]),Object(C.useEffect)(function(){E==="office"&&Ee()},[E,a]);var Ee=function(){var Ie=Object(L.a)(A.a.mark(function ke(){var Me,Ue,Fe;return A.a.wrap(function(we){for(;;)switch(we.prev=we.next){case 0:return console.log("data:",a),Me=a,a.startsWith("http")||(Me=location.origin+Me),Ue=new URL(Me).pathname.split("/").pop(),we.next=6,Object(n.U)({attachment_id:Ue});case 6:Fe=we.sent,Re(Fe);case 8:case"end":return we.stop()}},ke)}));return function(){return Ie.apply(this,arguments)}}(),xe=function(){if(a.startsWith("http")||a.startsWith("blob:")){Be();return}Object(x.x)(w||"educoder",a,w)},Be=function(){Object(x.v)(w||"educoder",decodeURIComponent(a))};return s.a.createElement("div",{style:Object(D.a)({},N||{}),className:"".concat(V&&b.a.bgBlack," ").concat(E?b.a.wrp:"hide")},j&&s.a.createElement("div",{className:b.a.close,ref:ve},!!Q&&s.a.createElement(k.a,{title:"\u70B9\u51FB\u5BF9\u56FE\u7247\u8FDB\u884C\u6279\u6CE8",getPopupContainer:function(){return ve.current}},s.a.createElement("span",{onClick:function(){K(),Q()}},s.a.createElement("i",{className:"icon-yulanpizhu"}))),!z&&s.a.createElement(k.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return ve.current}},s.a.createElement("span",{onClick:Be},s.a.createElement("i",{className:"icon-quxiaozhiding"}))),s.a.createElement(k.a,{title:"\u5173\u95ED",getPopupContainer:function(){return ve.current}},s.a.createElement("span",{className:"",onClick:K},s.a.createElement("i",{className:"icon-guanbi1"})))),s.a.createElement("div",{className:"".concat(b.a[M]," ").concat(M," ").concat(b.a.monaco," ").concat(E==="txt"?"show":"hide")},E==="txt"&&s.a.createElement(v.b,R)),E==="audio"&&s.a.createElement("audio",{src:"".concat(((p=a)===null||p===void 0?void 0:p.indexOf("http://"))>-1||((u=a)===null||u===void 0?void 0:u.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(a),autoPlay:!0}),E==="video"&&s.a.createElement(s.a.Fragment,null,((h=a)===null||h===void 0?void 0:h.indexOf("http"))>-1?s.a.createElement("video",{controls:!0,src:"".concat(a),autoPlay:!0}):s.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(a),autoPlay:!0})),E==="office"&&Le&&s.a.createElement("iframe",{src:"".concat(X,"/office.html?key=").concat(Le.key,"&url=").concat($+Le.url,"&callbackUrl=").concat($+Le.callbackUrl,"&fileType=").concat(Le.fileType,"&title=").concat(Le.title,"&model=").concat(l,"&officeServer=").concat(e.a.OFFICE_SERVER,"&disabledDownload=").concat(!!z)}),(E==="xlsx"||E==="doc"||E==="pptx"||E==="docx")&&s.a.createElement("iframe",{src:"/react/build/office.html?key=".concat(ae.key,"&url=").concat(e.a.API_SERVER+ae.url,"&callbackUrl=").concat(e.a.API_SERVER+ae.callbackUrl,"&fileType=").concat(ae.fileType,"&title=").concat(ae.title,"&model=").concat(ae.model)}),E==="html"&&s.a.createElement("iframe",{src:a+"&disposition=inline"}),E==="pdf"&&s.a.createElement("embed",{className:b.a.embed,src:a}),E==="image"&&s.a.createElement("img",{src:"".concat(((T=a)===null||T===void 0?void 0:T.indexOf("http://"))>-1||((g=a)===null||g===void 0?void 0:g.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(a)}),E==="other"&&s.a.createElement("div",null,s.a.createElement(U.a,{type:"primary",size:"large",onClick:xe},s.a.createElement(c.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),E==="download"&&s.a.createElement(U.a,{type:"primary",size:"large",onClick:xe},s.a.createElement(c.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},pmY6:function(Ze,le,H){"use strict";H.d(le,"g",function(){return D}),H.d(le,"f",function(){return L}),H.d(le,"e",function(){return B}),H.d(le,"h",function(){return _}),H.d(le,"b",function(){return A}),H.d(le,"a",function(){return C}),H.d(le,"d",function(){return s}),H.d(le,"c",function(){return m});var se=!1,U="__is_disposable_tracked__";function S(b){if(!se)return;if(b&&b!==C.None)try{b[U]=!0}catch(c){}}function k(b){if(!se)return b;var c=new Error("Potentially leaked disposable").stack;return setTimeout(function(){b[U]||console.log(c)},3e3),b}function D(b){return typeof b.dispose=="function"&&b.dispose.length===0}function L(b){return Array.isArray(b)?(b.forEach(function(c){c&&(S(c),c.dispose())}),[]):b?(S(b),b.dispose(),b):void 0}function B(){for(var b=[],c=0;c<arguments.length;c++)b[c]=arguments[c];return b.forEach(S),k({dispose:function(){return L(b)}})}function _(b){var c=k({dispose:function(){S(c),b()}});return c}var A=function(){function b(){this._toDispose=new Set,this._isDisposed=!1}return b.prototype.dispose=function(){if(this._isDisposed)return;S(this),this._isDisposed=!0,this.clear()},b.prototype.clear=function(){this._toDispose.forEach(function(c){return c.dispose()}),this._toDispose.clear()},b.prototype.add=function(c){if(!c)return c;if(c===this)throw new Error("Cannot register a disposable on itself!");return S(c),this._isDisposed?console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(c),c},b}(),C=function(){function b(){this._store=new A,k(this)}return b.prototype.dispose=function(){S(this),this._store.dispose()},b.prototype._register=function(c){if(c===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(c)},b.None=Object.freeze({dispose:function(){}}),b}(),s=function(){function b(){this._isDisposed=!1,k(this)}return Object.defineProperty(b.prototype,"value",{get:function(){return this._isDisposed?void 0:this._value},set:function(c){if(this._isDisposed||c===this._value)return;this._value&&this._value.dispose(),c&&S(c),this._value=c},enumerable:!0,configurable:!0}),b.prototype.clear=function(){this.value=void 0},b.prototype.dispose=function(){this._isDisposed=!0,S(this),this._value&&this._value.dispose(),this._value=void 0},b}(),m=function(){function b(c){this.object=c}return b.prototype.dispose=function(){},b}()},"rAM+":function(Ze,le,H){"use strict";H.d(le,"a",function(){return U});var se=H("Qw5x");function U(S,k){var D;if(typeof Symbol=="undefined"||S[Symbol.iterator]==null){if(Array.isArray(S)||(D=Object(se.a)(S))||k&&S&&typeof S.length=="number"){D&&(S=D);var L=0,B=function(){};return{s:B,n:function(){return L>=S.length?{done:!0}:{done:!1,value:S[L++]}},e:function(m){throw m},f:B}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var _=!0,A=!1,C;return{s:function(){D=S[Symbol.iterator]()},n:function(){var m=D.next();return _=m.done,m},e:function(m){A=!0,C=m},f:function(){try{!_&&D.return!=null&&D.return()}finally{if(A)throw C}}}}},rUJ1:function(Ze,le){const H=/[&<>"']/,se=/[&<>"']/g,U=/[<>"']|&(?!#?\w+;)/,S=/[<>"']|&(?!#?\w+;)/g,k={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},D=g=>k[g];function L(g,f){if(f){if(H.test(g))return g.replace(se,D)}else if(U.test(g))return g.replace(S,D);return g}const B=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function _(g){return g.replace(B,(f,l)=>(l=l.toLowerCase(),l==="colon"?":":l.charAt(0)==="#"?l.charAt(1)==="x"?String.fromCharCode(parseInt(l.substring(2),16)):String.fromCharCode(+l.substring(1)):""))}const A=/(^|[^\[])\^/g;function C(g,f){g=g.source||g,f=f||"";const l={replace:(r,a)=>(a=a.source||a,a=a.replace(A,"$1"),g=g.replace(r,a),l),getRegex:()=>new RegExp(g,f)};return l}const s=/[^\w:]/g,m=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function b(g,f,l){if(g){let r;try{r=decodeURIComponent(_(l)).replace(s,"").toLowerCase()}catch(a){return null}if(r.indexOf("javascript:")===0||r.indexOf("vbscript:")===0||r.indexOf("data:")===0)return null}f&&!m.test(l)&&(l=e(f,l));try{l=encodeURI(l).replace(/%25/g,"%")}catch(r){return null}return l}const c={},v=/^[^:]+:\/*[^/]*$/,x=/^([^:]+:)[\s\S]*$/,n=/^([^:]+:\/*[^/]*)[\s\S]*$/;function e(g,f){c[" "+g]||(v.test(g)?c[" "+g]=g+"/":c[" "+g]=u(g,"/",!0)),g=c[" "+g];const l=g.indexOf(":")===-1;return f.substring(0,2)==="//"?l?f:g.replace(x,"$1")+f:f.charAt(0)==="/"?l?f:g.replace(n,"$1")+f:g+f}const t={exec:function(){}};function i(g){let f=1,l,r;for(;f<arguments.length;f++){l=arguments[f];for(r in l)Object.prototype.hasOwnProperty.call(l,r)&&(g[r]=l[r])}return g}function p(g,f){const l=g.replace(/\|/g,(y,E,w)=>{let R=!1,M=E;for(;--M>=0&&w[M]==="\\";)R=!R;return R?"|":" |"}),r=l.split(/ \|/);let a=0;if(r.length>f)r.splice(f);else for(;r.length<f;)r.push("");for(;a<r.length;a++)r[a]=r[a].trim().replace(/\\\|/g,"|");return r}function u(g,f,l){const r=g.length;if(r===0)return"";let a=0;for(;a<r;){const y=g.charAt(r-a-1);if(y===f&&!l)a++;else if(y!==f&&l)a++;else break}return g.substr(0,r-a)}function h(g,f){if(g.indexOf(f[1])===-1)return-1;const l=g.length;let r=0,a=0;for(;a<l;a++)if(g[a]==="\\")a++;else if(g[a]===f[0])r++;else if(g[a]===f[1]&&(r--,r<0))return a;return-1}function T(g){g&&g.sanitize&&!g.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")}Ze.exports={escape:L,unescape:_,edit:C,cleanUrl:b,resolveUrl:e,noopTest:t,merge:i,splitCells:p,rtrim:u,findClosingBracket:h,checkSanitizeDeprecation:T}},ulZh:function(Ze,le,H){typeof window!="undefined"&&function(U,S){Ze.exports=S()}(this,function(){return function(se){var U={};function S(k){if(U[k])return U[k].exports;var D=U[k]={i:k,l:!1,exports:{}};return se[k].call(D.exports,D,D.exports,S),D.l=!0,D.exports}return S.m=se,S.c=U,S.d=function(k,D,L){S.o(k,D)||Object.defineProperty(k,D,{enumerable:!0,get:L})},S.r=function(k){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(k,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(k,"__esModule",{value:!0})},S.t=function(k,D){if(D&1&&(k=S(k)),D&8)return k;if(D&4&&typeof k=="object"&&k&&k.__esModule)return k;var L=Object.create(null);if(S.r(L),Object.defineProperty(L,"default",{enumerable:!0,value:k}),D&2&&typeof k!="string")for(var B in k)S.d(L,B,function(_){return k[_]}.bind(null,B));return L},S.n=function(k){var D=k&&k.__esModule?function(){return k.default}:function(){return k};return S.d(D,"a",D),D},S.o=function(k,D){return Object.prototype.hasOwnProperty.call(k,D)},S.p="/dist/",S(S.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(se,U,S){"use strict";var k=Object.prototype.hasOwnProperty,D="~";function L(){}Object.create&&(L.prototype=Object.create(null),new L().__proto__||(D=!1));function B(s,m,b){this.fn=s,this.context=m,this.once=b||!1}function _(s,m,b,c,v){if(typeof b!="function")throw new TypeError("The listener must be a function");var x=new B(b,c||s,v),n=D?D+m:m;return s._events[n]?s._events[n].fn?s._events[n]=[s._events[n],x]:s._events[n].push(x):(s._events[n]=x,s._eventsCount++),s}function A(s,m){--s._eventsCount===0?s._events=new L:delete s._events[m]}function C(){this._events=new L,this._eventsCount=0}C.prototype.eventNames=function(){var m=[],b,c;if(this._eventsCount===0)return m;for(c in b=this._events)k.call(b,c)&&m.push(D?c.slice(1):c);return Object.getOwnPropertySymbols?m.concat(Object.getOwnPropertySymbols(b)):m},C.prototype.listeners=function(m){var b=D?D+m:m,c=this._events[b];if(!c)return[];if(c.fn)return[c.fn];for(var v=0,x=c.length,n=new Array(x);v<x;v++)n[v]=c[v].fn;return n},C.prototype.listenerCount=function(m){var b=D?D+m:m,c=this._events[b];return c?c.fn?1:c.length:0},C.prototype.emit=function(m,b,c,v,x,n){var e=D?D+m:m;if(!this._events[e])return!1;var t=this._events[e],i=arguments.length,p,u;if(t.fn){t.once&&this.removeListener(m,t.fn,void 0,!0);switch(i){case 1:return t.fn.call(t.context),!0;case 2:return t.fn.call(t.context,b),!0;case 3:return t.fn.call(t.context,b,c),!0;case 4:return t.fn.call(t.context,b,c,v),!0;case 5:return t.fn.call(t.context,b,c,v,x),!0;case 6:return t.fn.call(t.context,b,c,v,x,n),!0}for(u=1,p=new Array(i-1);u<i;u++)p[u-1]=arguments[u];t.fn.apply(t.context,p)}else{var h=t.length,T;for(u=0;u<h;u++){t[u].once&&this.removeListener(m,t[u].fn,void 0,!0);switch(i){case 1:t[u].fn.call(t[u].context);break;case 2:t[u].fn.call(t[u].context,b);break;case 3:t[u].fn.call(t[u].context,b,c);break;case 4:t[u].fn.call(t[u].context,b,c,v);break;default:if(!p)for(T=1,p=new Array(i-1);T<i;T++)p[T-1]=arguments[T];t[u].fn.apply(t[u].context,p)}}}return!0},C.prototype.on=function(m,b,c){return _(this,m,b,c,!1)},C.prototype.once=function(m,b,c){return _(this,m,b,c,!0)},C.prototype.removeListener=function(m,b,c,v){var x=D?D+m:m;if(!this._events[x])return this;if(!b)return A(this,x),this;var n=this._events[x];if(n.fn)n.fn===b&&(!v||n.once)&&(!c||n.context===c)&&A(this,x);else{for(var e=0,t=[],i=n.length;e<i;e++)(n[e].fn!==b||v&&!n[e].once||c&&n[e].context!==c)&&t.push(n[e]);t.length?this._events[x]=t.length===1?t[0]:t:A(this,x)}return this},C.prototype.removeAllListeners=function(m){var b;return m?(b=D?D+m:m,this._events[b]&&A(this,b)):(this._events=new L,this._eventsCount=0),this},C.prototype.off=C.prototype.removeListener,C.prototype.addListener=C.prototype.on,C.prefixed=D,C.EventEmitter=C,se.exports=C},"./node_modules/url-toolkit/src/url-toolkit.js":function(se,U,S){(function(k){var D=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,L=/^([^\/?#]*)([^]*)$/,B=/(?:\/|^)\.(?=\/)/g,_=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,A={buildAbsoluteURL:function(C,s,m){if(m=m||{},C=C.trim(),s=s.trim(),!s){if(!m.alwaysNormalize)return C;var b=A.parseURL(C);if(!b)throw new Error("Error trying to parse base URL.");return b.path=A.normalizePath(b.path),A.buildURLFromParts(b)}var c=A.parseURL(s);if(!c)throw new Error("Error trying to parse relative URL.");if(c.scheme)return m.alwaysNormalize?(c.path=A.normalizePath(c.path),A.buildURLFromParts(c)):s;var v=A.parseURL(C);if(!v)throw new Error("Error trying to parse base URL.");if(!v.netLoc&&v.path&&v.path[0]!=="/"){var x=L.exec(v.path);v.netLoc=x[1],v.path=x[2]}v.netLoc&&!v.path&&(v.path="/");var n={scheme:v.scheme,netLoc:c.netLoc,path:null,params:c.params,query:c.query,fragment:c.fragment};if(!c.netLoc&&(n.netLoc=v.netLoc,c.path[0]!=="/"))if(!c.path)n.path=v.path,c.params||(n.params=v.params,c.query||(n.query=v.query));else{var e=v.path,t=e.substring(0,e.lastIndexOf("/")+1)+c.path;n.path=A.normalizePath(t)}return n.path===null&&(n.path=m.alwaysNormalize?A.normalizePath(c.path):c.path),A.buildURLFromParts(n)},parseURL:function(C){var s=D.exec(C);return s?{scheme:s[1]||"",netLoc:s[2]||"",path:s[3]||"",params:s[4]||"",query:s[5]||"",fragment:s[6]||""}:null},normalizePath:function(C){for(C=C.split("").reverse().join("").replace(B,"");C.length!==(C=C.replace(_,"")).length;);return C.split("").reverse().join("")},buildURLFromParts:function(C){return C.scheme+C.netLoc+C.path+C.params+C.query+C.fragment}};se.exports=A})(this)},"./node_modules/webworkify-webpack/index.js":function(se,U,S){function k(m){var b={};function c(x){if(b[x])return b[x].exports;var n=b[x]={i:x,l:!1,exports:{}};return m[x].call(n.exports,n,n.exports,c),n.l=!0,n.exports}c.m=m,c.c=b,c.i=function(x){return x},c.d=function(x,n,e){c.o(x,n)||Object.defineProperty(x,n,{configurable:!1,enumerable:!0,get:e})},c.r=function(x){Object.defineProperty(x,"__esModule",{value:!0})},c.n=function(x){var n=x&&x.__esModule?function(){return x.default}:function(){return x};return c.d(n,"a",n),n},c.o=function(x,n){return Object.prototype.hasOwnProperty.call(x,n)},c.p="/",c.oe=function(x){throw console.error(x),x};var v=c(c.s=ENTRY_MODULE);return v.default||v}var D="[\\.|\\-|\\+|\\w|/|@]+",L="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+D+").*?\\)";function B(m){return(m+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function _(m){return!isNaN(1*m)}function A(m,b,c){var v={};v[c]=[];var x=b.toString(),n=x.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!n)return v;for(var e=n[1],t=new RegExp("(\\\\n|\\W)"+B(e)+L,"g"),i;i=t.exec(x);){if(i[3]==="dll-reference")continue;v[c].push(i[3])}for(t=new RegExp("\\("+B(e)+'\\("(dll-reference\\s('+D+'))"\\)\\)'+L,"g");i=t.exec(x);)m[i[2]]||(v[c].push(i[1]),m[i[2]]=S(i[1]).m),v[i[2]]=v[i[2]]||[],v[i[2]].push(i[4]);for(var p=Object.keys(v),u=0;u<p.length;u++)for(var h=0;h<v[p[u]].length;h++)_(v[p[u]][h])&&(v[p[u]][h]=1*v[p[u]][h]);return v}function C(m){var b=Object.keys(m);return b.reduce(function(c,v){return c||m[v].length>0},!1)}function s(m,b){for(var c={main:[b]},v={main:[]},x={main:{}};C(c);)for(var n=Object.keys(c),e=0;e<n.length;e++){var t=n[e],i=c[t],p=i.pop();if(x[t]=x[t]||{},x[t][p]||!m[t][p])continue;x[t][p]=!0,v[t]=v[t]||[],v[t].push(p);for(var u=A(m,m[t][p],t),h=Object.keys(u),T=0;T<h.length;T++)c[h[T]]=c[h[T]]||[],c[h[T]]=c[h[T]].concat(u[h[T]])}return v}se.exports=function(m,b){b=b||{};var c={main:S.m},v=b.all?{main:Object.keys(c.main)}:s(c,m),x="";Object.keys(v).filter(function(p){return p!=="main"}).forEach(function(p){for(var u=0;v[p][u];)u++;v[p].push(u),c[p][u]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",x=x+"var "+p+" = ("+k.toString().replace("ENTRY_MODULE",JSON.stringify(u))+")({"+v[p].map(function(h){return""+JSON.stringify(h)+": "+c[p][h].toString()}).join(",")+`});
`}),x=x+"new (("+k.toString().replace("ENTRY_MODULE",JSON.stringify(m))+")({"+v.main.map(function(p){return""+JSON.stringify(p)+": "+c.main[p].toString()}).join(",")+"}))(self);";var n=new window.Blob([x],{type:"text/javascript"});if(b.bare)return n;var e=window.URL||window.webkitURL||window.mozURL||window.msURL,t=e.createObjectURL(n),i=new window.Worker(t);return i.objectURL=t,i}},"./src/config.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"hlsDefaultConfig",function(){return T}),S.d(U,"mergeConfig",function(){return f}),S.d(U,"enableStreamingMode",function(){return l});var k=S("./src/controller/abr-controller.ts"),D=S("./src/controller/audio-stream-controller.ts"),L=S("./src/controller/audio-track-controller.ts"),B=S("./src/controller/subtitle-stream-controller.ts"),_=S("./src/controller/subtitle-track-controller.ts"),A=S("./src/controller/buffer-controller.ts"),C=S("./src/controller/timeline-controller.ts"),s=S("./src/controller/cap-level-controller.ts"),m=S("./src/controller/fps-controller.ts"),b=S("./src/controller/eme-controller.ts"),c=S("./src/controller/cmcd-controller.ts"),v=S("./src/utils/xhr-loader.ts"),x=S("./src/utils/fetch-loader.ts"),n=S("./src/utils/cues.ts"),e=S("./src/utils/mediakeys-helper.ts"),t=S("./src/utils/logger.ts");function i(){return i=Object.assign||function(r){for(var a=1;a<arguments.length;a++){var y=arguments[a];for(var E in y)Object.prototype.hasOwnProperty.call(y,E)&&(r[E]=y[E])}return r},i.apply(this,arguments)}function p(r,a){var y=Object.keys(r);if(Object.getOwnPropertySymbols){var E=Object.getOwnPropertySymbols(r);a&&(E=E.filter(function(w){return Object.getOwnPropertyDescriptor(r,w).enumerable})),y.push.apply(y,E)}return y}function u(r){for(var a=1;a<arguments.length;a++){var y=arguments[a]!=null?arguments[a]:{};a%2?p(Object(y),!0).forEach(function(E){h(r,E,y[E])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(y)):p(Object(y)).forEach(function(E){Object.defineProperty(r,E,Object.getOwnPropertyDescriptor(y,E))})}return r}function h(r,a,y){return a in r?Object.defineProperty(r,a,{value:y,enumerable:!0,configurable:!0,writable:!0}):r[a]=y,r}var T=u(u({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:v.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:k.default,bufferController:A.default,capLevelController:s.default,fpsController:m.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:e.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},g()),{},{subtitleStreamController:B.SubtitleStreamController,subtitleTrackController:_.default,timelineController:C.TimelineController,audioStreamController:D.default,audioTrackController:L.default,emeController:b.default,cmcdController:c.default});function g(){return{cueHandler:n.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 f(r,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return i({},r,a)}function l(r){var a=r.loader;if(a!==x.default&&a!==v.default)t.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),r.progressive=!1;else{var y=Object(x.fetchSupported)();y&&(r.loader=x.default,r.progressive=!0,r.enableSoftwareAES=!0,t.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(se,U,S){"use strict";S.r(U);var k=S("./src/polyfills/number.ts"),D=S("./src/utils/ewma-bandwidth-estimator.ts"),L=S("./src/events.ts"),B=S("./src/utils/buffer-helper.ts"),_=S("./src/errors.ts"),A=S("./src/types/loader.ts"),C=S("./src/utils/logger.ts");function s(c,v){for(var x=0;x<v.length;x++){var n=v[x];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(c,n.key,n)}}function m(c,v,x){return v&&s(c.prototype,v),x&&s(c,x),c}var b=function(){function c(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 n=x.config;this.bwEstimator=new D.default(n.abrEwmaSlowVoD,n.abrEwmaFastVoD,n.abrEwmaDefaultEstimate),this.registerListeners()}var v=c.prototype;return v.registerListeners=function(){var n=this.hls;n.on(L.Events.FRAG_LOADING,this.onFragLoading,this),n.on(L.Events.FRAG_LOADED,this.onFragLoaded,this),n.on(L.Events.FRAG_BUFFERED,this.onFragBuffered,this),n.on(L.Events.LEVEL_LOADED,this.onLevelLoaded,this),n.on(L.Events.ERROR,this.onError,this)},v.unregisterListeners=function(){var n=this.hls;n.off(L.Events.FRAG_LOADING,this.onFragLoading,this),n.off(L.Events.FRAG_LOADED,this.onFragLoaded,this),n.off(L.Events.FRAG_BUFFERED,this.onFragBuffered,this),n.off(L.Events.LEVEL_LOADED,this.onLevelLoaded,this),n.off(L.Events.ERROR,this.onError,this)},v.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},v.onFragLoading=function(n,e){var t=e.frag;if(t.type===A.PlaylistLevelType.MAIN&&!this.timer){var i;this.fragCurrent=t,this.partCurrent=(i=e.part)!=null?i:null,this.timer=self.setInterval(this.onCheck,100)}},v.onLevelLoaded=function(n,e){var t=this.hls.config;e.details.live?this.bwEstimator.update(t.abrEwmaSlowLive,t.abrEwmaFastLive):this.bwEstimator.update(t.abrEwmaSlowVoD,t.abrEwmaFastVoD)},v._abandonRulesCheck=function(){var n=this.fragCurrent,e=this.partCurrent,t=this.hls,i=t.autoLevelEnabled,p=t.config,u=t.media;if(!n||!u)return;var h=e?e.stats:n.stats,T=e?e.duration:n.duration;if(h.aborted){C.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!i||u.paused||!u.playbackRate||!u.readyState)return;var g=performance.now()-h.loading.start,f=Math.abs(u.playbackRate);if(g<=500*T/f)return;var l=t.levels,r=t.minAutoLevel,a=l[n.level],y=h.total||Math.max(h.loaded,Math.round(T*a.maxBitrate/8)),E=Math.max(1,h.bwEstimate?h.bwEstimate/8:h.loaded*1e3/g),w=(y-h.loaded)/E,R=u.currentTime,M=(B.BufferHelper.bufferInfo(u,R,p.maxBufferHole).end-R)/f;if(M>=2*T/f||w<=M)return;var N=Number.POSITIVE_INFINITY,j;for(j=n.level-1;j>r;j--){var K=l[j].maxBitrate;if(N=T*K/(8*.8*E),N<M)break}if(N>=w)return;var V=this.bwEstimator.getEstimate();C.logger.warn("Fragment "+n.sn+(e?" part "+e.index:"")+" of level "+n.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+j+`
Current BW estimate: `+(Object(k.isFiniteNumber)(V)?(V/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+w.toFixed(3)+` s
Estimated load time for the next fragment: `+N.toFixed(3)+` s
Time to underbuffer: `+M.toFixed(3)+" s"),t.nextLoadLevel=j,this.bwEstimator.sample(g,h.loaded),this.clearTimer(),n.loader&&(this.fragCurrent=this.partCurrent=null,n.loader.abort()),t.trigger(L.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:n,part:e,stats:h})},v.onFragLoaded=function(n,e){var t=e.frag,i=e.part;if(t.type===A.PlaylistLevelType.MAIN&&Object(k.isFiniteNumber)(t.sn)){var p=i?i.stats:t.stats,u=i?i.duration:t.duration;if(this.clearTimer(),this.lastLoadedFragLevel=t.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var h=this.hls.levels[t.level],T=(h.loaded?h.loaded.bytes:0)+p.loaded,g=(h.loaded?h.loaded.duration:0)+u;h.loaded={bytes:T,duration:g},h.realBitrate=Math.round(8*T/g)}if(t.bitrateTest){var f={stats:p,frag:t,part:i,id:t.type};this.onFragBuffered(L.Events.FRAG_BUFFERED,f),t.bitrateTest=!1}}},v.onFragBuffered=function(n,e){var t=e.frag,i=e.part,p=i?i.stats:t.stats;if(p.aborted)return;if(t.type!==A.PlaylistLevelType.MAIN||t.sn==="initSegment")return;var u=p.parsing.end-p.loading.start;this.bwEstimator.sample(u,p.loaded),p.bwEstimate=this.bwEstimator.getEstimate(),t.bitrateTest?this.bitrateTestDelay=u/1e3:this.bitrateTestDelay=0},v.onError=function(n,e){switch(e.details){case _.ErrorDetails.FRAG_LOAD_ERROR:case _.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},v.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},v.getNextABRAutoLevel=function(){var n=this.fragCurrent,e=this.partCurrent,t=this.hls,i=t.maxAutoLevel,p=t.config,u=t.minAutoLevel,h=t.media,T=e?e.duration:n?n.duration:0,g=h?h.currentTime:0,f=h&&h.playbackRate!==0?Math.abs(h.playbackRate):1,l=this.bwEstimator?this.bwEstimator.getEstimate():p.abrEwmaDefaultEstimate,r=(B.BufferHelper.bufferInfo(h,g,p.maxBufferHole).end-g)/f,a=this.findBestLevel(l,u,i,r,p.abrBandWidthFactor,p.abrBandWidthUpFactor);if(a>=0)return a;C.logger.trace((r?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var y=T?Math.min(T,p.maxStarvationDelay):p.maxStarvationDelay,E=p.abrBandWidthFactor,w=p.abrBandWidthUpFactor;if(!r){var R=this.bitrateTestDelay;if(R){var M=T?Math.min(T,p.maxLoadingDelay):p.maxLoadingDelay;y=M-R,C.logger.trace("bitrate test took "+Math.round(1e3*R)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*y)+" ms"),E=w=1}}return a=this.findBestLevel(l,u,i,r+y,E,w),Math.max(a,0)},v.findBestLevel=function(n,e,t,i,p,u){for(var h,T=this.fragCurrent,g=this.partCurrent,f=this.lastLoadedFragLevel,l=this.hls.levels,r=l[f],a=!!(r!=null&&(h=r.details)!==null&&h!==void 0&&h.live),y=r==null?void 0:r.codecSet,E=g?g.duration:T?T.duration:0,w=t;w>=e;w--){var R=l[w];if(!R||y&&R.codecSet!==y)continue;var M=R.details,N=(g?M==null?void 0:M.partTarget:M==null?void 0:M.averagetargetduration)||E,j=void 0;w<=f?j=p*n:j=u*n;var K=l[w].maxBitrate,V=K*N/j;if(C.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+w+"/"+Math.round(j)+"/"+K+"/"+N+"/"+i+"/"+V),j>K&&(!V||a&&!this.bitrateTestDelay||V<i))return w}return-1},m(c,[{key:"nextAutoLevel",get:function(){var n=this._nextAutoLevel,e=this.bwEstimator;if(n!==-1&&(!e||!e.canEstimate()))return n;var t=this.getNextABRAutoLevel();return n!==-1&&(t=Math.min(n,t)),t},set:function(n){this._nextAutoLevel=n}}]),c}();U.default=b},"./src/controller/audio-stream-controller.ts":function(se,U,S){"use strict";S.r(U);var k=S("./src/polyfills/number.ts"),D=S("./src/controller/base-stream-controller.ts"),L=S("./src/events.ts"),B=S("./src/utils/buffer-helper.ts"),_=S("./src/controller/fragment-tracker.ts"),A=S("./src/types/level.ts"),C=S("./src/types/loader.ts"),s=S("./src/loader/fragment.ts"),m=S("./src/demux/chunk-cache.ts"),b=S("./src/demux/transmuxer-interface.ts"),c=S("./src/types/transmuxer.ts"),v=S("./src/controller/fragment-finders.ts"),x=S("./src/utils/discontinuities.ts"),n=S("./src/errors.ts"),e=S("./src/utils/logger.ts");function t(){return t=Object.assign||function(T){for(var g=1;g<arguments.length;g++){var f=arguments[g];for(var l in f)Object.prototype.hasOwnProperty.call(f,l)&&(T[l]=f[l])}return T},t.apply(this,arguments)}function i(T,g){T.prototype=Object.create(g.prototype),T.prototype.constructor=T,p(T,g)}function p(T,g){return p=Object.setPrototypeOf||function(l,r){return l.__proto__=r,l},p(T,g)}var u=100,h=function(T){i(g,T);function g(l,r){var a;return a=T.call(this,l,r,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var f=g.prototype;return f.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},f._registerListeners=function(){var r=this.hls;r.on(L.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.on(L.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.on(L.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.on(L.Events.LEVEL_LOADED,this.onLevelLoaded,this),r.on(L.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),r.on(L.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),r.on(L.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),r.on(L.Events.ERROR,this.onError,this),r.on(L.Events.BUFFER_RESET,this.onBufferReset,this),r.on(L.Events.BUFFER_CREATED,this.onBufferCreated,this),r.on(L.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),r.on(L.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),r.on(L.Events.FRAG_BUFFERED,this.onFragBuffered,this)},f._unregisterListeners=function(){var r=this.hls;r.off(L.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.off(L.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.off(L.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.off(L.Events.LEVEL_LOADED,this.onLevelLoaded,this),r.off(L.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),r.off(L.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),r.off(L.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),r.off(L.Events.ERROR,this.onError,this),r.off(L.Events.BUFFER_RESET,this.onBufferReset,this),r.off(L.Events.BUFFER_CREATED,this.onBufferCreated,this),r.off(L.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),r.off(L.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),r.off(L.Events.FRAG_BUFFERED,this.onFragBuffered,this)},f.onInitPtsFound=function(r,a){var y=a.frag,E=a.id,w=a.initPTS;if(E==="main"){var R=y.cc;this.initPTS[y.cc]=w,this.log("InitPTS for cc: "+R+" found from main: "+w),this.videoTrackCC=R,this.state===D.State.WAITING_INIT_PTS&&this.tick()}},f.startLoad=function(r){if(!this.levels){this.startPosition=r,this.state=D.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(u),this.fragLoadError=0,a>0&&r===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=D.State.IDLE):(this.loadedmetadata=!1,this.state=D.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=r,this.tick()},f.doTick=function(){switch(this.state){case D.State.IDLE:this.doTickIdle();break;case D.State.WAITING_TRACK:{var r,a=this.levels,y=this.trackId,E=a==null||((r=a[y])===null||r===void 0)?void 0:r.details;if(E){if(this.waitForCdnTuneIn(E))break;this.state=D.State.WAITING_INIT_PTS}break}case D.State.FRAG_LOADING_WAITING_RETRY:{var w,R=performance.now(),M=this.retryDate;(!M||R>=M||(w=this.media)!==null&&w!==void 0&&w.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=D.State.IDLE);break}case D.State.WAITING_INIT_PTS:{var N=this.waitingData;if(N){var j=N.frag,K=N.part,V=N.cache,z=N.complete;if(this.initPTS[j.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=D.State.FRAG_LOADING;var Q=V.flush(),ae={frag:j,part:K,payload:Q,networkDetails:null};this._handleFragmentLoadProgress(ae),z&&T.prototype._handleFragmentLoadComplete.call(this,ae)}else if(this.videoTrackCC!==this.waitingVideoCC)e.logger.log("Waiting fragment cc ("+j.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var oe=this.getLoadPosition(),Ce=B.BufferHelper.bufferInfo(this.mediaBuffer,oe,this.config.maxBufferHole),he=Object(v.fragmentWithinToleranceTest)(Ce.end,this.config.maxFragLookUpTolerance,j);he<0&&(e.logger.log("Waiting fragment cc ("+j.cc+") @ "+j.start+" cancelled because another fragment at "+Ce.end+" is needed"),this.clearWaitingFragment())}}else this.state=D.State.IDLE}}this.onTickEnd()},f.clearWaitingFragment=function(){var r=this.waitingData;r&&(this.fragmentTracker.removeFragment(r.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=D.State.IDLE)},f.onTickEnd=function(){var r=this.media;if(!r||!r.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:r,y=a.buffered;!this.loadedmetadata&&y.length&&(this.loadedmetadata=!0),this.lastCurrentTime=r.currentTime},f.doTickIdle=function(){var r,a,y=this.hls,E=this.levels,w=this.media,R=this.trackId,M=y.config;if(!E||!E[R])return;if(!w&&(this.startFragRequested||!M.startFragPrefetch))return;var N=E[R],j=N.details;if(!j||j.live&&this.levelLastLoaded!==R||this.waitForCdnTuneIn(j)){this.state=D.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,s.ElementaryStreamTypes.AUDIO,C.PlaylistLevelType.AUDIO));var K=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,C.PlaylistLevelType.AUDIO);if(K===null)return;var V=K.len,z=this.getMaxBufferLength(),Q=this.audioSwitch;if(V>=z&&!Q)return;if(!Q&&this._streamEnded(K,j)){y.trigger(L.Events.BUFFER_EOS,{type:"audio"}),this.state=D.State.ENDED;return}var ae=j.fragments,oe=ae[0].start,Ce=K.end;if(Q){var he=this.getLoadPosition();Ce=he,j.PTSKnown&&he<oe&&((K.end>oe||K.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),w.currentTime=oe+.05))}var fe=this.getNextFragment(Ce,j);if(!fe){this.bufferFlushed=!0;return}((r=fe.decryptdata)===null||r===void 0?void 0:r.keyFormat)==="identity"&&!((a=fe.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(fe,j):this.loadFragment(fe,j,Ce)},f.getMaxBufferLength=function(){var r=T.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,C.PlaylistLevelType.MAIN);return a===null?r:Math.max(r,a.len)},f.onMediaDetaching=function(){this.videoBuffer=null,T.prototype.onMediaDetaching.call(this)},f.onAudioTracksUpdated=function(r,a){var y=a.audioTracks;this.resetTransmuxer(),this.levels=y.map(function(E){return new A.Level(E)})},f.onAudioTrackSwitching=function(r,a){var y=!!a.url;this.trackId=a.id;var E=this.fragCurrent;E!=null&&E.loader&&E.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),y?this.setInterval(u):this.resetTransmuxer(),y?(this.audioSwitch=!0,this.state=D.State.IDLE):this.state=D.State.STOPPED,this.tick()},f.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},f.onLevelLoaded=function(r,a){this.mainDetails=a.details},f.onAudioTrackLoaded=function(r,a){var y,E=this.levels,w=a.details,R=a.id;if(!E){this.warn("Audio tracks were reset while loading level "+R);return}this.log("Track "+R+" loaded ["+w.startSN+","+w.endSN+"],duration:"+w.totalduration);var M=E[R],N=0;if(w.live||(y=M.details)!==null&&y!==void 0&&y.live){var j=this.mainDetails;if(w.fragments[0]||(w.deltaUpdateFailed=!0),w.deltaUpdateFailed||!j)return;!M.details&&w.hasProgramDateTime&&j.hasProgramDateTime?(Object(x.alignMediaPlaylistByPDT)(w,j),N=w.fragments[0].start):N=this.alignPlaylists(w,M.details)}M.details=w,this.levelLastLoaded=R,!this.startFragRequested&&(this.mainDetails||!w.live)&&this.setStartPosition(M.details,N),this.state===D.State.WAITING_TRACK&&!this.waitForCdnTuneIn(w)&&(this.state=D.State.IDLE),this.tick()},f._handleFragmentLoadProgress=function(r){var a,y=r.frag,E=r.part,w=r.payload,R=this.config,M=this.trackId,N=this.levels;if(!N){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+y.sn+" of level "+y.level+" will not be buffered");return}var j=N[M];console.assert(j,"Audio track is defined on fragment load progress");var K=j.details;console.assert(K,"Audio track details are defined on fragment load progress");var V=R.defaultAudioCodec||j.audioCodec||"mp4a.40.2",z=this.transmuxer;z||(z=this.transmuxer=new b.default(this.hls,C.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var Q=this.initPTS[y.cc],ae=(a=y.initSegment)===null||a===void 0?void 0:a.data;if(Q!==void 0){var oe=!1,Ce=E?E.index:-1,he=Ce!==-1,fe=new c.ChunkMetadata(y.level,y.sn,y.stats.chunkCount,w.byteLength,Ce,he);z.push(w,ae,V,"",y,E,K.totalduration,oe,fe,Q)}else{e.logger.log("Unknown video PTS for cc "+y.cc+", waiting for video PTS before demuxing audio frag "+y.sn+" of ["+K.startSN+" ,"+K.endSN+"],track "+M);var pe=this.waitingData=this.waitingData||{frag:y,part:E,cache:new m.default,complete:!1},me=pe.cache;me.push(new Uint8Array(w)),this.waitingVideoCC=this.videoTrackCC,this.state=D.State.WAITING_INIT_PTS}},f._handleFragmentLoadComplete=function(r){if(this.waitingData){this.waitingData.complete=!0;return}T.prototype._handleFragmentLoadComplete.call(this,r)},f.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},f.onBufferCreated=function(r,a){var y=a.tracks.audio;y&&(this.mediaBuffer=y.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},f.onFragBuffered=function(r,a){var y=a.frag,E=a.part;if(y.type!==C.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(y)){this.warn("Fragment "+y.sn+(E?" p: "+E.index:"")+" of level "+y.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}y.sn!=="initSegment"&&(this.fragPrevious=y,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(L.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(y,E)},f.onError=function(r,a){switch(a.details){case n.ErrorDetails.FRAG_LOAD_ERROR:case n.ErrorDetails.FRAG_LOAD_TIMEOUT:case n.ErrorDetails.KEY_LOAD_ERROR:case n.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(C.PlaylistLevelType.AUDIO,a);break;case n.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case n.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==D.State.ERROR&&this.state!==D.State.STOPPED&&(this.state=a.fatal?D.State.ERROR:D.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case n.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===D.State.PARSING||this.state===D.State.PARSED)){var y=!0,E=this.getFwdBufferInfo(this.mediaBuffer,C.PlaylistLevelType.AUDIO);E&&E.len>.5&&(y=!this.reduceMaxBufferLength(E.len)),y&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,T.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},f.onBufferFlushed=function(r,a){var y=a.type;y===s.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},f._handleTransmuxComplete=function(r){var a,y="audio",E=this.hls,w=r.remuxResult,R=r.chunkMeta,M=this.getCurrentContext(R);if(!M){this.warn("The loading context changed while buffering fragment "+R.sn+" of level "+R.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(R.level);return}var N=M.frag,j=M.part,K=w.audio,V=w.text,z=w.id3,Q=w.initSegment;if(this.fragContextChanged(N))return;if(this.state=D.State.PARSING,this.audioSwitch&&K&&this.completeAudioSwitch(),Q!=null&&Q.tracks&&(this._bufferInitSegment(Q.tracks,N,R),E.trigger(L.Events.FRAG_PARSING_INIT_SEGMENT,{frag:N,id:y,tracks:Q.tracks})),K){var ae=K.startPTS,oe=K.endPTS,Ce=K.startDTS,he=K.endDTS;j&&(j.elementaryStreams[s.ElementaryStreamTypes.AUDIO]={startPTS:ae,endPTS:oe,startDTS:Ce,endDTS:he}),N.setElementaryStreamInfo(s.ElementaryStreamTypes.AUDIO,ae,oe,Ce,he),this.bufferFragmentData(K,N,j,R)}if(z!=null&&(a=z.samples)!==null&&a!==void 0&&a.length){var fe=t({frag:N,id:y},z);E.trigger(L.Events.FRAG_PARSING_METADATA,fe)}if(V){var pe=t({frag:N,id:y},V);E.trigger(L.Events.FRAG_PARSING_USERDATA,pe)}},f._bufferInitSegment=function(r,a,y){if(this.state!==D.State.PARSING)return;r.video&&delete r.video;var E=r.audio;if(!E)return;E.levelCodec=E.codec,E.id="audio",this.log("Init audio buffer, container:"+E.container+", codecs[parsed]=["+E.codec+"]"),this.hls.trigger(L.Events.BUFFER_CODECS,r);var w=E.initSegment;if(w!=null&&w.byteLength){var R={type:"audio",frag:a,part:null,chunkMeta:y,parent:a.type,data:w};this.hls.trigger(L.Events.BUFFER_APPENDING,R)}this.tick()},f.loadFragment=function(r,a,y){var E=this.fragmentTracker.getState(r);this.fragCurrent=r,(this.audioSwitch||E===_.FragmentState.NOT_LOADED||E===_.FragmentState.PARTIAL)&&(r.sn==="initSegment"?this._loadInitSegment(r):a.live&&!Object(k.isFiniteNumber)(this.initPTS[r.cc])?(this.log("Waiting for video PTS in continuity counter "+r.cc+" of live stream before loading audio fragment "+r.sn+" of level "+this.trackId),this.state=D.State.WAITING_INIT_PTS):(this.startFragRequested=!0,T.prototype.loadFragment.call(this,r,a,y)))},f.completeAudioSwitch=function(){var r=this.hls,a=this.media,y=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),T.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,r.trigger(L.Events.AUDIO_TRACK_SWITCHED,{id:y})},g}(D.default);U.default=h},"./src/controller/audio-track-controller.ts":function(se,U,S){"use strict";S.r(U);var k=S("./src/events.ts"),D=S("./src/errors.ts"),L=S("./src/controller/base-playlist-controller.ts"),B=S("./src/types/loader.ts");function _(b,c){for(var v=0;v<c.length;v++){var x=c[v];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(b,x.key,x)}}function A(b,c,v){return c&&_(b.prototype,c),v&&_(b,v),b}function C(b,c){b.prototype=Object.create(c.prototype),b.prototype.constructor=b,s(b,c)}function s(b,c){return s=Object.setPrototypeOf||function(x,n){return x.__proto__=n,x},s(b,c)}var m=function(b){C(c,b);function c(x){var n;return n=b.call(this,x,"[audio-track-controller]")||this,n.tracks=[],n.groupId=null,n.tracksInGroup=[],n.trackId=-1,n.trackName="",n.selectDefaultTrack=!0,n.registerListeners(),n}var v=c.prototype;return v.registerListeners=function(){var n=this.hls;n.on(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.on(k.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.on(k.Events.LEVEL_LOADING,this.onLevelLoading,this),n.on(k.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),n.on(k.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),n.on(k.Events.ERROR,this.onError,this)},v.unregisterListeners=function(){var n=this.hls;n.off(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.off(k.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.off(k.Events.LEVEL_LOADING,this.onLevelLoading,this),n.off(k.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),n.off(k.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),n.off(k.Events.ERROR,this.onError,this)},v.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,b.prototype.destroy.call(this)},v.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},v.onManifestParsed=function(n,e){this.tracks=e.audioTracks||[]},v.onAudioTrackLoaded=function(n,e){var t=e.id,i=e.details,p=this.tracksInGroup[t];if(!p){this.warn("Invalid audio track id "+t);return}var u=p.details;p.details=e.details,this.log("audioTrack "+t+" loaded ["+i.startSN+"-"+i.endSN+"]"),t===this.trackId&&(this.retryCount=0,this.playlistLoaded(t,e,u))},v.onLevelLoading=function(n,e){this.switchLevel(e.level)},v.onLevelSwitching=function(n,e){this.switchLevel(e.level)},v.switchLevel=function(n){var e=this.hls.levels[n];if(!(e!=null&&e.audioGroupIds))return;var t=e.audioGroupIds[e.urlId];if(this.groupId!==t){this.groupId=t;var i=this.tracks.filter(function(u){return!t||u.groupId===t});this.selectDefaultTrack&&!i.some(function(u){return u.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=i;var p={audioTracks:i};this.log("Updating audio tracks, "+i.length+' track(s) found in "'+t+'" group-id'),this.hls.trigger(k.Events.AUDIO_TRACKS_UPDATED,p),this.selectInitialTrack()}},v.onError=function(n,e){if(b.prototype.onError.call(this,n,e),e.fatal||!e.context)return;e.context.type===B.PlaylistContextType.AUDIO_TRACK&&e.context.id===this.trackId&&e.context.groupId===this.groupId&&this.retryLoadingOrFail(e)},v.setAudioTrack=function(n){var e=this.tracksInGroup;if(n<0||n>=e.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var t=e[this.trackId];this.log("Now switching to audio-track index "+n);var i=e[n],p=i.id,u=i.groupId,h=u===void 0?"":u,T=i.name,g=i.type,f=i.url;if(this.trackId=n,this.trackName=T,this.selectDefaultTrack=!1,this.hls.trigger(k.Events.AUDIO_TRACK_SWITCHING,{id:p,groupId:h,name:T,type:g,url:f}),i.details&&!i.details.live)return;var l=this.switchParams(i.url,t==null?void 0:t.details);this.loadPlaylist(l)},v.selectInitialTrack=function(){var n=this.tracksInGroup;console.assert(n.length,"Initial audio track should be selected when tracks are known");var e=this.trackName,t=this.findTrackId(e)||this.findTrackId();t!==-1?this.setAudioTrack(t):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(k.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},v.findTrackId=function(n){for(var e=this.tracksInGroup,t=0;t<e.length;t++){var i=e[t];if((!this.selectDefaultTrack||i.default)&&(!n||n===i.name))return i.id}return-1},v.loadPlaylist=function(n){var e=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(e)){var t=e.id,i=e.groupId,p=e.url;if(n)try{p=n.addDirectives(p)}catch(u){this.warn("Could not construct new URL with HLS Delivery Directives: "+u)}this.log("loading audio-track playlist for id: "+t),this.clearTimer(),this.hls.trigger(k.Events.AUDIO_TRACK_LOADING,{url:p,id:t,groupId:i,deliveryDirectives:n||null})}},A(c,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(n){this.selectDefaultTrack=!1,this.setAudioTrack(n)}}]),c}(L.default);U.default=m},"./src/controller/base-playlist-controller.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"default",function(){return A});var k=S("./src/polyfills/number.ts"),D=S("./src/types/level.ts"),L=S("./src/controller/level-helper.ts"),B=S("./src/utils/logger.ts"),_=S("./src/errors.ts"),A=function(){function C(m,b){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=B.logger.log.bind(B.logger,b+":"),this.warn=B.logger.warn.bind(B.logger,b+":"),this.hls=m}var s=C.prototype;return s.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},s.onError=function(b,c){c.fatal&&c.type===_.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},s.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},s.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},s.stopLoad=function(){this.canLoad=!1,this.clearTimer()},s.switchParams=function(b,c){var v=c==null?void 0:c.renditionReports;if(v)for(var x=0;x<v.length;x++){var n=v[x],e=""+n.URI;if(e===b.substr(-e.length)){var t=parseInt(n["LAST-MSN"]),i=parseInt(n["LAST-PART"]);if(c&&this.hls.config.lowLatencyMode){var p=Math.min(c.age-c.partTarget,c.targetduration);i!==void 0&&p>c.partTarget&&(i+=1)}if(Object(k.isFiniteNumber)(t))return new D.HlsUrlParameters(t,Object(k.isFiniteNumber)(i)?i:void 0,D.HlsSkip.No)}}},s.loadPlaylist=function(b){},s.shouldLoadTrack=function(b){return this.canLoad&&b&&!!b.url&&(!b.details||b.details.live)},s.playlistLoaded=function(b,c,v){var x=this,n=c.details,e=c.stats,t=e.loading.end?Math.max(0,self.performance.now()-e.loading.end):0;if(n.advancedDateTime=Date.now()-t,n.live||v!=null&&v.live){if(n.reloaded(v),v&&this.log("live playlist "+b+" "+(n.advanced?"REFRESHED "+n.lastPartSn+"-"+n.lastPartIndex:"MISSED")),v&&n.fragments.length>0&&Object(L.mergeDetails)(v,n),!this.canLoad||!n.live)return;var i,p=void 0,u=void 0;if(n.canBlockReload&&n.endSN&&n.advanced){var h=this.hls.config.lowLatencyMode,T=n.lastPartSn,g=n.endSN,f=n.lastPartIndex,l=f!==-1,r=T===g,a=h?0:f;l?(p=r?g+1:T,u=r?a:f+1):p=g+1;var y=n.age,E=y+n.ageHeader,w=Math.min(E-n.partTarget,n.targetduration*1.5);if(w>0){if(v&&w>v.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+v.tuneInGoal+" to: "+w+" with playlist age: "+n.age),w=0;else{var R=Math.floor(w/n.targetduration);if(p+=R,u!==void 0){var M=Math.round(w%n.targetduration/n.partTarget);u+=M}this.log("CDN Tune-in age: "+n.ageHeader+"s last advanced "+y.toFixed(2)+"s goal: "+w+" skip sn "+R+" to part "+u)}n.tuneInGoal=w}if(i=this.getDeliveryDirectives(n,c.deliveryDirectives,p,u),h||!r){this.loadPlaylist(i);return}}else i=this.getDeliveryDirectives(n,c.deliveryDirectives,p,u);var N=Object(L.computeReloadInterval)(n,e);p!==void 0&&n.canBlockReload&&(N-=n.partTarget||1),this.log("reload live playlist "+b+" in "+Math.round(N)+" ms"),this.timer=self.setTimeout(function(){return x.loadPlaylist(i)},N)}else this.clearTimer()},s.getDeliveryDirectives=function(b,c,v,x){var n=Object(D.getSkipValue)(b,v);return c!=null&&c.skip&&b.deltaUpdateFailed&&(v=c.msn,x=c.part,n=D.HlsSkip.No),new D.HlsUrlParameters(v,x,n)},s.retryLoadingOrFail=function(b){var c=this,v=this.hls.config,x=this.retryCount<v.levelLoadingMaxRetry;if(x){var n;if(this.retryCount++,b.details.indexOf("LoadTimeOut")>-1&&(n=b.context)!==null&&n!==void 0&&n.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+b.details+'"'),this.loadPlaylist();else{var e=Math.min(Math.pow(2,this.retryCount)*v.levelLoadingRetryDelay,v.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return c.loadPlaylist()},e),this.warn("retry playlist loading #"+this.retryCount+" in "+e+' ms after "'+b.details+'"')}}else this.warn('cannot recover from error "'+b.details+'"'),this.clearTimer(),b.fatal=!0;return x},C}()},"./src/controller/base-stream-controller.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"State",function(){return g}),S.d(U,"default",function(){return f});var k=S("./src/polyfills/number.ts"),D=S("./src/task-loop.ts"),L=S("./src/controller/fragment-tracker.ts"),B=S("./src/utils/buffer-helper.ts"),_=S("./src/utils/logger.ts"),A=S("./src/events.ts"),C=S("./src/errors.ts"),s=S("./src/types/transmuxer.ts"),m=S("./src/utils/mp4-tools.ts"),b=S("./src/utils/discontinuities.ts"),c=S("./src/controller/fragment-finders.ts"),v=S("./src/controller/level-helper.ts"),x=S("./src/loader/fragment-loader.ts"),n=S("./src/crypt/decrypter.ts"),e=S("./src/utils/time-ranges.ts"),t=S("./src/types/loader.ts");function i(l,r){for(var a=0;a<r.length;a++){var y=r[a];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(l,y.key,y)}}function p(l,r,a){return r&&i(l.prototype,r),a&&i(l,a),l}function u(l){if(l===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return l}function h(l,r){l.prototype=Object.create(r.prototype),l.prototype.constructor=l,T(l,r)}function T(l,r){return T=Object.setPrototypeOf||function(y,E){return y.__proto__=E,y},T(l,r)}var g={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"},f=function(l){h(r,l);function r(y,E,w){var R;return R=l.call(this)||this,R.hls=void 0,R.fragPrevious=null,R.fragCurrent=null,R.fragmentTracker=void 0,R.transmuxer=null,R._state=g.STOPPED,R.media=void 0,R.mediaBuffer=void 0,R.config=void 0,R.bitrateTest=!1,R.lastCurrentTime=0,R.nextLoadPosition=0,R.startPosition=0,R.loadedmetadata=!1,R.fragLoadError=0,R.retryDate=0,R.levels=null,R.fragmentLoader=void 0,R.levelLastLoaded=null,R.startFragRequested=!1,R.decrypter=void 0,R.initPTS=[],R.onvseeking=null,R.onvended=null,R.logPrefix="",R.log=void 0,R.warn=void 0,R.logPrefix=w,R.log=_.logger.log.bind(_.logger,w+":"),R.warn=_.logger.warn.bind(_.logger,w+":"),R.hls=y,R.fragmentLoader=new x.default(y.config),R.fragmentTracker=E,R.config=y.config,R.decrypter=new n.default(y,y.config),y.on(A.Events.KEY_LOADED,R.onKeyLoaded,u(R)),R}var a=r.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(E){},a.stopLoad=function(){this.fragmentLoader.abort();var E=this.fragCurrent;E&&this.fragmentTracker.removeFragment(E),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=g.STOPPED},a._streamEnded=function(E,w){var R=this.fragCurrent,M=this.fragmentTracker;if(!w.live&&R&&R.sn===w.endSN&&!E.nextStart){var N=M.getState(R);return N===L.FragmentState.PARTIAL||N===L.FragmentState.OK}return!1},a.onMediaAttached=function(E,w){var R=this.media=this.mediaBuffer=w.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),R.addEventListener("seeking",this.onvseeking),R.addEventListener("ended",this.onvended);var M=this.config;this.levels&&M.autoStartLoad&&this.state===g.STOPPED&&this.startLoad(M.startPosition)},a.onMediaDetaching=function(){var E=this.media;E!=null&&E.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),E&&(E.removeEventListener("seeking",this.onvseeking),E.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var E=this.config,w=this.fragCurrent,R=this.media,M=this.mediaBuffer,N=this.state,j=R?R.currentTime:0,K=B.BufferHelper.bufferInfo(M||R,j,E.maxBufferHole);if(this.log("media seeking to "+(Object(k.isFiniteNumber)(j)?j.toFixed(3):j)+", state: "+N),N===g.ENDED)this.resetLoadingState();else if(w&&!K.len){var V=E.maxFragLookUpTolerance,z=w.start-V,Q=w.start+w.duration+V,ae=j>Q;(j<z||ae)&&(ae&&w.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),w.loader.abort()),this.resetLoadingState())}R&&(this.lastCurrentTime=j),!this.loadedmetadata&&!K.len&&(this.nextLoadPosition=this.startPosition=j),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(E,w){if(this.state!==g.KEY_LOADING||w.frag!==this.fragCurrent||!this.levels)return;this.state=g.IDLE;var R=this.levels[w.frag.level].details;R&&this.loadFragment(w.frag,R,w.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),l.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=g.STOPPED,this.hls.off(A.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,l.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(E,w){this.log("Loading key for "+E.sn+" of ["+w.startSN+"-"+w.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+E.level),this.state=g.KEY_LOADING,this.fragCurrent=E,this.hls.trigger(A.Events.KEY_LOADING,{frag:E})},a.loadFragment=function(E,w,R){this._loadFragForPlayback(E,w,R)},a._loadFragForPlayback=function(E,w,R){var M=this,N=function(K){if(M.fragContextChanged(E)){M.warn("Fragment "+E.sn+(K.part?" p: "+K.part.index:"")+" of level "+E.level+" was dropped during download."),M.fragmentTracker.removeFragment(E);return}E.stats.chunkCount++,M._handleFragmentLoadProgress(K)};this._doFragLoad(E,w,R,N).then(function(j){if(!j)return;M.fragLoadError=0;var K=M.state;if(M.fragContextChanged(E)){(K===g.FRAG_LOADING||K===g.BACKTRACKING||!M.fragCurrent&&K===g.PARSING)&&(M.fragmentTracker.removeFragment(E),M.state=g.IDLE);return}if("payload"in j&&(M.log("Loaded fragment "+E.sn+" of level "+E.level),M.hls.trigger(A.Events.FRAG_LOADED,j),M.state===g.BACKTRACKING)){M.fragmentTracker.backtrack(E,j),M.resetFragmentLoading(E);return}M._handleFragmentLoadComplete(j)}).catch(function(j){M.warn(j),M.resetFragmentLoading(E)})},a.flushMainBuffer=function(E,w,R){if(R===void 0&&(R=null),!(E-w))return;var M={startOffset:E,endOffset:w,type:R};this.fragLoadError=0,this.hls.trigger(A.Events.BUFFER_FLUSHING,M)},a._loadInitSegment=function(E){var w=this;this._doFragLoad(E).then(function(R){if(!R||w.fragContextChanged(E)||!w.levels)throw new Error("init load aborted");return R}).then(function(R){var M=w.hls,N=R.payload,j=E.decryptdata;if(N&&N.byteLength>0&&j&&j.key&&j.iv&&j.method==="AES-128"){var K=self.performance.now();return w.decrypter.webCryptoDecrypt(new Uint8Array(N),j.key.buffer,j.iv.buffer).then(function(V){var z=self.performance.now();return M.trigger(A.Events.FRAG_DECRYPTED,{frag:E,payload:V,stats:{tstart:K,tdecrypt:z}}),R.payload=V,R})}return R}).then(function(R){var M=w.fragCurrent,N=w.hls,j=w.levels;if(!j)throw new Error("init load aborted, missing levels");var K=j[E.level].details;console.assert(K,"Level details are defined when init segment is loaded");var V=E.stats;w.state=g.IDLE,w.fragLoadError=0,E.data=new Uint8Array(R.payload),V.parsing.start=V.buffering.start=self.performance.now(),V.parsing.end=V.buffering.end=self.performance.now(),R.frag===M&&N.trigger(A.Events.FRAG_BUFFERED,{stats:V,frag:M,part:null,id:E.type}),w.tick()}).catch(function(R){w.warn(R),w.resetFragmentLoading(E)})},a.fragContextChanged=function(E){var w=this.fragCurrent;return!E||!w||E.level!==w.level||E.sn!==w.sn||E.urlId!==w.urlId},a.fragBufferedComplete=function(E,w){var R=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+E.type+" sn: "+E.sn+(w?" part: "+w.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+E.level+" "+e.default.toString(B.BufferHelper.getBuffered(R))),this.state=g.IDLE,this.tick()},a._handleFragmentLoadComplete=function(E){var w=this.transmuxer;if(!w)return;var R=E.frag,M=E.part,N=E.partsLoaded,j=!N||N.length===0||N.some(function(V){return!V}),K=new s.ChunkMetadata(R.level,R.sn,R.stats.chunkCount+1,0,M?M.index:-1,!j);w.flush(K)},a._handleFragmentLoadProgress=function(E){},a._doFragLoad=function(E,w,R,M){var N=this;if(R===void 0&&(R=null),!this.levels)throw new Error("frag load aborted, missing levels");if(R=Math.max(E.start,R||0),this.config.lowLatencyMode&&w){var j=w.partList;if(j&&M){R>E.end&&w.fragmentHint&&(E=w.fragmentHint);var K=this.getNextPart(j,E,R);if(K>-1){var V=j[K];return this.log("Loading part sn: "+E.sn+" p: "+V.index+" cc: "+E.cc+" of playlist ["+w.startSN+"-"+w.endSN+"] parts [0-"+K+"-"+(j.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+E.level+", target: "+parseFloat(R.toFixed(3))),this.nextLoadPosition=V.start+V.duration,this.state=g.FRAG_LOADING,this.hls.trigger(A.Events.FRAG_LOADING,{frag:E,part:j[K],targetBufferTime:R}),this.doFragPartsLoad(E,j,K,M).catch(function(z){return N.handleFragLoadError(z)})}else if(!E.url||this.loadedEndOfParts(j,R))return Promise.resolve(null)}}return this.log("Loading fragment "+E.sn+" cc: "+E.cc+" "+(w?"of ["+w.startSN+"-"+w.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+E.level+", target: "+parseFloat(R.toFixed(3))),Object(k.isFiniteNumber)(E.sn)&&!this.bitrateTest&&(this.nextLoadPosition=E.start+E.duration),this.state=g.FRAG_LOADING,this.hls.trigger(A.Events.FRAG_LOADING,{frag:E,targetBufferTime:R}),this.fragmentLoader.load(E,M).catch(function(z){return N.handleFragLoadError(z)})},a.doFragPartsLoad=function(E,w,R,M){var N=this;return new Promise(function(j,K){var V=[],z=function Q(ae){var oe=w[ae];N.fragmentLoader.loadPart(E,oe,M).then(function(Ce){V[oe.index]=Ce;var he=Ce.part;N.hls.trigger(A.Events.FRAG_LOADED,Ce);var fe=w[ae+1];if(fe&&fe.fragment===E)Q(ae+1);else return j({frag:E,part:he,partsLoaded:V})}).catch(K)};z(R)})},a.handleFragLoadError=function(E){var w=E.data;return w&&w.details===C.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(w.frag,w.part):this.hls.trigger(A.Events.ERROR,w),null},a._handleTransmuxerFlush=function(E){var w=this.getCurrentContext(E);if(!w||this.state!==g.PARSING){this.fragCurrent||(this.state=g.IDLE);return}var R=w.frag,M=w.part,N=w.level,j=self.performance.now();R.stats.parsing.end=j,M&&(M.stats.parsing.end=j),this.updateLevelTiming(R,M,N,E.partial)},a.getCurrentContext=function(E){var w=this.levels,R=E.level,M=E.sn,N=E.part;if(!w||!w[R])return this.warn("Levels object was unset while buffering fragment "+M+" of level "+R+". The current chunk will not be buffered."),null;var j=w[R],K=N>-1?Object(v.getPartWith)(j,M,N):null,V=K?K.fragment:Object(v.getFragmentWithSN)(j,M,this.fragCurrent);return V?{frag:V,part:K,level:j}:null},a.bufferFragmentData=function(E,w,R,M){if(!E||this.state!==g.PARSING)return;var N=E.data1,j=E.data2,K=N;if(N&&j&&(K=Object(m.appendUint8Array)(N,j)),!K||!K.length)return;var V={type:E.type,frag:w,part:R,chunkMeta:M,parent:w.type,data:K};this.hls.trigger(A.Events.BUFFER_APPENDING,V),E.dropped&&E.independent&&!R&&this.flushBufferGap(w)},a.flushBufferGap=function(E){var w=this.media;if(!w)return;if(!B.BufferHelper.isBuffered(w,w.currentTime)){this.flushMainBuffer(0,E.start);return}var R=w.currentTime,M=B.BufferHelper.bufferInfo(w,R,0),N=E.duration,j=Math.min(this.config.maxFragLookUpTolerance*2,N*.25),K=Math.max(Math.min(E.start-j,M.end-j),R+j);E.start-K>j&&this.flushMainBuffer(K,E.start)},a.getFwdBufferInfo=function(E,w){var R=this.config,M=this.getLoadPosition();if(!Object(k.isFiniteNumber)(M))return null;var N=B.BufferHelper.bufferInfo(E,M,R.maxBufferHole);if(N.len===0&&N.nextStart!==void 0){var j=this.fragmentTracker.getBufferedFrag(M,w);if(j&&N.nextStart<j.end)return B.BufferHelper.bufferInfo(E,M,Math.max(N.nextStart,R.maxBufferHole))}return N},a.getMaxBufferLength=function(E){var w=this.config,R;return E?R=Math.max(8*w.maxBufferSize/E,w.maxBufferLength):R=w.maxBufferLength,Math.min(R,w.maxMaxBufferLength)},a.reduceMaxBufferLength=function(E){var w=this.config,R=E||w.maxBufferLength;return w.maxMaxBufferLength>=R?(w.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+w.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(E,w){var R,M,N=w.fragments,j=N.length;if(!j)return null;var K=this.config,V=N[0].start,z;if(w.live){var Q=K.initialLiveManifestSize;if(j<Q)return this.warn("Not enough fragments to start playback (have: "+j+", need: "+Q+")"),null;!w.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(z=this.getInitialLiveFragment(w,N),this.startPosition=z?this.hls.liveSyncPosition||z.start:E)}else E<=V&&(z=N[0]);if(!z){var ae=K.lowLatencyMode?w.partEnd:w.fragmentEnd;z=this.getFragmentAtPosition(E,ae,w)}return(R=z)!==null&&R!==void 0&&R.initSegment&&!((M=z)!==null&&M!==void 0&&M.initSegment.data)&&!this.bitrateTest&&(z=z.initSegment),z},a.getNextPart=function(E,w,R){for(var M=-1,N=!1,j=!0,K=0,V=E.length;K<V;K++){var z=E[K];if(j=j&&!z.independent,M>-1&&R<z.start)break;var Q=z.loaded;!Q&&(N||z.independent||j)&&z.fragment===w&&(M=K),N=Q}return M},a.loadedEndOfParts=function(E,w){var R=E[E.length-1];return R&&w>R.start&&R.loaded},a.getInitialLiveFragment=function(E,w){var R=this.fragPrevious,M=null;if(R){if(E.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+R.programDateTime),M=Object(c.findFragmentByPDT)(w,R.endProgramDateTime,this.config.maxFragLookUpTolerance)),!M){var N=R.sn+1;if(N>=E.startSN&&N<=E.endSN){var j=w[N-E.startSN];R.cc===j.cc&&(M=j,this.log("Live playlist, switching playlist, load frag with next SN: "+M.sn))}M||(M=Object(c.findFragWithCC)(w,R.cc),M&&this.log("Live playlist, switching playlist, load frag with same CC: "+M.sn))}}else{var K=this.hls.liveSyncPosition;K!==null&&(M=this.getFragmentAtPosition(K,this.bitrateTest?E.fragmentEnd:E.edge,E))}return M},a.getFragmentAtPosition=function(E,w,R){var M=this.config,N=this.fragPrevious,j=R.fragments,K=R.endSN,V=R.fragmentHint,z=M.maxFragLookUpTolerance,Q=!!(M.lowLatencyMode&&R.partList&&V);Q&&V&&!this.bitrateTest&&(j=j.concat(V),K=V.sn);var ae;if(E<w){var oe=E>w-z?0:z;ae=Object(c.findFragmentByPTS)(N,j,E,oe)}else ae=j[j.length-1];if(ae){var Ce=ae.sn-R.startSN,he=N&&ae.level===N.level,fe=j[Ce+1],pe=this.fragmentTracker.getState(ae);if(pe===L.FragmentState.BACKTRACKED){ae=null;for(var me=Ce;j[me]&&this.fragmentTracker.getState(j[me])===L.FragmentState.BACKTRACKED;)N?ae=j[me--]:ae=j[--me];ae||(ae=fe)}else N&&ae.sn===N.sn&&!Q&&(he&&(ae.sn<K&&this.fragmentTracker.getState(fe)!==L.FragmentState.OK?(this.log("SN "+ae.sn+" just loaded, load next one: "+fe.sn),ae=fe):ae=null))}return ae},a.synchronizeToLiveEdge=function(E){var w=this.config,R=this.media;if(!R)return;var M=this.hls.liveSyncPosition,N=R.currentTime,j=E.fragments[0].start,K=E.edge,V=N>=j-w.maxFragLookUpTolerance&&N<=K;if(M!==null&&R.duration>M&&(N<M||!V)){var z=w.liveMaxLatencyDuration!==void 0?w.liveMaxLatencyDuration:w.liveMaxLatencyDurationCount*E.targetduration;(!V&&R.readyState<4||N<K-z)&&(this.loadedmetadata||(this.nextLoadPosition=M),R.readyState&&(this.warn("Playback: "+N.toFixed(3)+" is located too far from the end of live sliding playlist: "+K+", reset currentTime to : "+M.toFixed(3)),R.currentTime=M))}},a.alignPlaylists=function(E,w){var R=this.levels,M=this.levelLastLoaded,N=this.fragPrevious,j=M!==null?R[M]:null,K=E.fragments.length;if(!K)return this.warn("No fragments in live playlist"),0;var V=E.fragments[0].start,z=!w,Q=E.alignedSliding&&Object(k.isFiniteNumber)(V);if(z||!Q&&!V){Object(b.alignStream)(N,j,E);var ae=E.fragments[0].start;return this.log("Live playlist sliding: "+ae.toFixed(2)+" start-sn: "+(w?w.startSN:"na")+"->"+E.startSN+" prev-sn: "+(N?N.sn:"na")+" fragments: "+K),ae}return V},a.waitForCdnTuneIn=function(E){var w=3;return E.live&&E.canBlockReload&&E.tuneInGoal>Math.max(E.partHoldBack,E.partTarget*w)},a.setStartPosition=function(E,w){var R=this.startPosition;if(R<w&&(R=-1),R===-1||this.lastCurrentTime===-1){var M=E.startTimeOffset;Object(k.isFiniteNumber)(M)?(R=w+M,M<0&&(R+=E.totalduration),R=Math.min(Math.max(w,R),w+E.totalduration),this.log("Start time offset "+M+" found in playlist, adjust startPosition to "+R),this.startPosition=R):E.live?R=this.hls.liveSyncPosition||w:this.startPosition=R=0,this.lastCurrentTime=R}this.nextLoadPosition=R},a.getLoadPosition=function(){var E=this.media,w=0;return this.loadedmetadata&&E?w=E.currentTime:this.nextLoadPosition&&(w=this.nextLoadPosition),w},a.handleFragLoadAborted=function(E,w){this.transmuxer&&E.sn!=="initSegment"&&E.stats.aborted&&(this.warn("Fragment "+E.sn+(w?" part"+w.index:"")+" of level "+E.level+" was aborted"),this.resetFragmentLoading(E))},a.resetFragmentLoading=function(E){(!this.fragCurrent||!this.fragContextChanged(E))&&(this.state=g.IDLE)},a.onFragmentOrKeyLoadError=function(E,w){if(w.fatal)return;var R=w.frag;if(!R||R.type!==E)return;var M=this.fragCurrent;console.assert(M&&R.sn===M.sn&&R.level===M.level&&R.urlId===M.urlId,"Frag load error must match current frag to retry");var N=this.config;if(this.fragLoadError+1<=N.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(R.level))return;var j=Math.min(Math.pow(2,this.fragLoadError)*N.fragLoadingRetryDelay,N.fragLoadingMaxRetryTimeout);this.warn("Fragment "+R.sn+" of "+E+" "+R.level+" failed to load, retrying in "+j+"ms"),this.retryDate=self.performance.now()+j,this.fragLoadError++,this.state=g.FRAG_LOADING_WAITING_RETRY}else w.levelRetry?(E===t.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=g.IDLE):(_.logger.error(w.details+" reaches max retry, redispatch as fatal ..."),w.fatal=!0,this.hls.stopLoad(),this.state=g.ERROR)},a.afterBufferFlushed=function(E,w,R){if(!E)return;var M=B.BufferHelper.getBuffered(E);this.fragmentTracker.detectEvictedFragments(w,M,R),this.state===g.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=g.IDLE},a.resetLiveStartWhenNotLoaded=function(E){if(!this.loadedmetadata){this.startFragRequested=!1;var w=this.levels?this.levels[E].details:null;if(w!=null&&w.live)return this.startPosition=-1,this.setStartPosition(w,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(E,w,R,M){var N=this,j=R.details;console.assert(!!j,"level.details must be defined");var K=Object.keys(E.elementaryStreams).reduce(function(V,z){var Q=E.elementaryStreams[z];if(Q){var ae=Q.endPTS-Q.startPTS;if(ae<=0)return N.warn("Could not parse fragment "+E.sn+" "+z+" duration reliably ("+ae+") resetting transmuxer to fallback to playlist timing"),N.resetTransmuxer(),V||!1;var oe=M?0:Object(v.updateFragPTSDTS)(j,E,Q.startPTS,Q.endPTS,Q.startDTS,Q.endDTS);return N.hls.trigger(A.Events.LEVEL_PTS_UPDATED,{details:j,level:R,drift:oe,type:z,frag:E,start:Q.startPTS,end:Q.endPTS}),!0}return V},!1);K?(this.state=g.PARSED,this.hls.trigger(A.Events.FRAG_PARSED,{frag:E,part:w})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},p(r,[{key:"state",get:function(){return this._state},set:function(E){var w=this._state;w!==E&&(this._state=E,this.log(w+"->"+E))}}]),r}(D.default)},"./src/controller/buffer-controller.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"default",function(){return c});var k=S("./src/polyfills/number.ts"),D=S("./src/events.ts"),L=S("./src/utils/logger.ts"),B=S("./src/errors.ts"),_=S("./src/utils/buffer-helper.ts"),A=S("./src/utils/mediasource-helper.ts"),C=S("./src/loader/fragment.ts"),s=S("./src/controller/buffer-operation-queue.ts"),m=Object(A.getMediaSource)(),b=/([ha]vc.)(?:\.[^.,]+)+/,c=function(){function v(n){var e=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 t=e.hls,i=e.media,p=e.mediaSource;L.logger.log("[buffer-controller]: Media source opened"),i&&(e.updateMediaElementDuration(),t.trigger(D.Events.MEDIA_ATTACHED,{media:i})),p&&p.removeEventListener("sourceopen",e._onMediaSourceOpen),e.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=n,this._initSourceBuffer(),this.registerListeners()}var x=v.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 e=this.hls;e.on(D.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(D.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(D.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(D.Events.BUFFER_RESET,this.onBufferReset,this),e.on(D.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.on(D.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.on(D.Events.BUFFER_EOS,this.onBufferEos,this),e.on(D.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(D.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(D.Events.FRAG_PARSED,this.onFragParsed,this),e.on(D.Events.FRAG_CHANGED,this.onFragChanged,this)},x.unregisterListeners=function(){var e=this.hls;e.off(D.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(D.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(D.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(D.Events.BUFFER_RESET,this.onBufferReset,this),e.off(D.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.off(D.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.off(D.Events.BUFFER_EOS,this.onBufferEos,this),e.off(D.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(D.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(D.Events.FRAG_PARSED,this.onFragParsed,this),e.off(D.Events.FRAG_CHANGED,this.onFragChanged,this)},x._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new s.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},x.onManifestParsed=function(e,t){var i=2;(t.audio&&!t.video||!t.altAudio)&&(i=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=i,this.details=null,L.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},x.onMediaAttaching=function(e,t){var i=this.media=t.media;if(i&&m){var p=this.mediaSource=new m;p.addEventListener("sourceopen",this._onMediaSourceOpen),p.addEventListener("sourceended",this._onMediaSourceEnded),p.addEventListener("sourceclose",this._onMediaSourceClose),i.src=self.URL.createObjectURL(p),this._objectUrl=i.src}},x.onMediaDetaching=function(){var e=this.media,t=this.mediaSource,i=this._objectUrl;if(t){if(L.logger.log("[buffer-controller]: media source detaching"),t.readyState==="open")try{t.endOfStream()}catch(p){L.logger.warn("[buffer-controller]: onMediaDetaching: "+p.message+" while calling endOfStream")}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),e&&(i&&self.URL.revokeObjectURL(i),e.src===i?(e.removeAttribute("src"),e.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(D.Events.MEDIA_DETACHED,void 0)},x.onBufferReset=function(){var e=this;this.getSourceBufferTypes().forEach(function(t){var i=e.sourceBuffer[t];try{i&&(e.removeBufferListeners(t),e.mediaSource&&e.mediaSource.removeSourceBuffer(i),e.sourceBuffer[t]=void 0)}catch(p){L.logger.warn("[buffer-controller]: Failed to reset the "+t+" buffer",p)}}),this._initSourceBuffer()},x.onBufferCodecs=function(e,t){var i=this,p=this.getSourceBufferTypes().length;if(Object.keys(t).forEach(function(u){if(p){var h=i.tracks[u];if(h&&typeof h.buffer.changeType=="function"){var T=t[u],g=T.codec,f=T.levelCodec,l=T.container,r=(h.levelCodec||h.codec).replace(b,"$1"),a=(f||g).replace(b,"$1");if(r!==a){var y=l+";codecs="+(f||g);i.appendChangeType(u,y)}}}else i.pendingTracks[u]=t[u]}),p)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},x.appendChangeType=function(e,t){var i=this,p=this.operationQueue,u={execute:function(){var T=i.sourceBuffer[e];T&&(L.logger.log("[buffer-controller]: changing "+e+" sourceBuffer type to "+t),T.changeType(t)),p.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(T){L.logger.warn("[buffer-controller]: Failed to change "+e+" SourceBuffer type",T)}};p.append(u,e)},x.onBufferAppending=function(e,t){var i=this,p=this.hls,u=this.operationQueue,h=this.tracks,T=t.data,g=t.type,f=t.frag,l=t.part,r=t.chunkMeta,a=r.buffering[g],y=self.performance.now();a.start=y;var E=f.stats.buffering,w=l?l.stats.buffering:null;E.start===0&&(E.start=y),w&&w.start===0&&(w.start=y);var R=h.audio,M=g==="audio"&&r.id===1&&(R==null?void 0:R.container)==="audio/mpeg",N={execute:function(){if(a.executeStart=self.performance.now(),M){var K=i.sourceBuffer[g];if(K){var V=f.start-K.timestampOffset;Math.abs(V)>=.1&&(L.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+f.start+" (delta: "+V+") sn: "+f.sn+")"),K.timestampOffset=f.start)}}i.appendExecutor(T,g)},onStart:function(){},onComplete:function(){var K=self.performance.now();a.executeEnd=a.end=K,E.first===0&&(E.first=K),w&&w.first===0&&(w.first=K);var V=i.sourceBuffer,z={};for(var Q in V)z[Q]=_.BufferHelper.getBuffered(V[Q]);i.appendError=0,i.hls.trigger(D.Events.BUFFER_APPENDED,{type:g,frag:f,part:l,chunkMeta:r,parent:f.type,timeRanges:z})},onError:function(K){L.logger.error("[buffer-controller]: Error encountered while trying to append to the "+g+" SourceBuffer",K);var V={type:B.ErrorTypes.MEDIA_ERROR,parent:f.type,details:B.ErrorDetails.BUFFER_APPEND_ERROR,err:K,fatal:!1};K.code===DOMException.QUOTA_EXCEEDED_ERR?V.details=B.ErrorDetails.BUFFER_FULL_ERROR:(i.appendError++,V.details=B.ErrorDetails.BUFFER_APPEND_ERROR,i.appendError>p.config.appendErrorMaxRetry&&(L.logger.error("[buffer-controller]: Failed "+p.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),V.fatal=!0)),p.trigger(D.Events.ERROR,V)}};u.append(N,g)},x.onBufferFlushing=function(e,t){var i=this,p=this.operationQueue,u=function(T){return{execute:i.removeExecutor.bind(i,T,t.startOffset,t.endOffset),onStart:function(){},onComplete:function(){i.hls.trigger(D.Events.BUFFER_FLUSHED,{type:T})},onError:function(f){L.logger.warn("[buffer-controller]: Failed to remove from "+T+" SourceBuffer",f)}}};t.type?p.append(u(t.type),t.type):this.getSourceBufferTypes().forEach(function(h){p.append(u(h),h)})},x.onFragParsed=function(e,t){var i=this,p=t.frag,u=t.part,h=[],T=u?u.elementaryStreams:p.elementaryStreams;T[C.ElementaryStreamTypes.AUDIOVIDEO]?h.push("audiovideo"):(T[C.ElementaryStreamTypes.AUDIO]&&h.push("audio"),T[C.ElementaryStreamTypes.VIDEO]&&h.push("video"));var g=function(){var l=self.performance.now();p.stats.buffering.end=l,u&&(u.stats.buffering.end=l);var r=u?u.stats:p.stats;i.hls.trigger(D.Events.FRAG_BUFFERED,{frag:p,part:u,stats:r,id:p.type})};h.length===0&&L.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+p.type+" level: "+p.level+" sn: "+p.sn),this.blockBuffers(g,h)},x.onFragChanged=function(e,t){this.flushBackBuffer()},x.onBufferEos=function(e,t){var i=this,p=this.getSourceBufferTypes().reduce(function(u,h){var T=i.sourceBuffer[h];return(!t.type||t.type===h)&&(T&&!T.ended&&(T.ended=!0,L.logger.log("[buffer-controller]: "+h+" sourceBuffer now EOS"))),u&&!!(!T||T.ended)},!0);p&&this.blockBuffers(function(){var u=i.mediaSource;if(!u||u.readyState!=="open")return;u.endOfStream()})},x.onLevelUpdated=function(e,t){var i=t.details;if(!i.fragments.length)return;this.details=i,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},x.flushBackBuffer=function(){var e=this.hls,t=this.details,i=this.media,p=this.sourceBuffer;if(!i||t===null)return;var u=this.getSourceBufferTypes();if(!u.length)return;var h=t.live&&e.config.liveBackBufferLength!==null?e.config.liveBackBufferLength:e.config.backBufferLength;if(!Object(k.isFiniteNumber)(h)||h<0)return;var T=i.currentTime,g=t.levelTargetDuration,f=Math.max(h,g),l=Math.floor(T/g)*g-f;u.forEach(function(r){var a=p[r];if(a){var y=_.BufferHelper.getBuffered(a);y.length>0&&l>y.start(0)&&(e.trigger(D.Events.BACK_BUFFER_REACHED,{bufferEnd:l}),t.live&&e.trigger(D.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:l}),e.trigger(D.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:l,type:r}))}})},x.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var e=this.details,t=this.hls,i=this.media,p=this.mediaSource,u=e.fragments[0].start+e.totalduration,h=i.duration,T=Object(k.isFiniteNumber)(p.duration)?p.duration:0;e.live&&t.config.liveDurationInfinity?(L.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),p.duration=Infinity,this.updateSeekableRange(e)):(u>T&&u>h||!Object(k.isFiniteNumber)(h))&&(L.logger.log("[buffer-controller]: Updating Media Source duration to "+u.toFixed(3)),p.duration=u)},x.updateSeekableRange=function(e){var t=this.mediaSource,i=e.fragments,p=i.length;if(p&&e.live&&t!==null&&t!==void 0&&t.setLiveSeekableRange){var u=Math.max(0,i[0].start),h=Math.max(u,u+e.totalduration);t.setLiveSeekableRange(u,h)}},x.checkPendingTracks=function(){var e=this.bufferCodecEventsExpected,t=this.operationQueue,i=this.pendingTracks,p=Object.keys(i).length;if(p&&!e||p===2){this.createSourceBuffers(i),this.pendingTracks={};var u=this.getSourceBufferTypes();if(u.length===0){this.hls.trigger(D.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}u.forEach(function(h){t.executeNext(h)})}},x.createSourceBuffers=function(e){var t=this.sourceBuffer,i=this.mediaSource;if(!i)throw Error("createSourceBuffers called when mediaSource was null");var p=0;for(var u in e)if(!t[u]){var h=e[u];if(!h)throw Error("source buffer exists for track "+u+", however track does not");var T=h.levelCodec||h.codec,g=h.container+";codecs="+T;L.logger.log("[buffer-controller]: creating sourceBuffer("+g+")");try{var f=t[u]=i.addSourceBuffer(g),l=u;this.addBufferListener(l,"updatestart",this._onSBUpdateStart),this.addBufferListener(l,"updateend",this._onSBUpdateEnd),this.addBufferListener(l,"error",this._onSBUpdateError),this.tracks[u]={buffer:f,codec:T,container:h.container,levelCodec:h.levelCodec,id:h.id},p++}catch(r){L.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+r.message),this.hls.trigger(D.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:r,mimeType:g})}}p&&this.hls.trigger(D.Events.BUFFER_CREATED,{tracks:this.tracks})},x._onSBUpdateStart=function(e){var t=this.operationQueue,i=t.current(e);i.onStart()},x._onSBUpdateEnd=function(e){var t=this.operationQueue,i=t.current(e);i.onComplete(),t.shiftAndExecuteNext(e)},x._onSBUpdateError=function(e,t){L.logger.error("[buffer-controller]: "+e+" SourceBuffer error",t),this.hls.trigger(D.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var i=this.operationQueue.current(e);i&&i.onError(t)},x.removeExecutor=function(e,t,i){var p=this.media,u=this.mediaSource,h=this.operationQueue,T=this.sourceBuffer,g=T[e];if(!p||!u||!g){L.logger.warn("[buffer-controller]: Attempting to remove from the "+e+" SourceBuffer, but it does not exist"),h.shiftAndExecuteNext(e);return}var f=Object(k.isFiniteNumber)(p.duration)?p.duration:Infinity,l=Object(k.isFiniteNumber)(u.duration)?u.duration:Infinity,r=Math.max(0,t),a=Math.min(i,f,l);a>r?(L.logger.log("[buffer-controller]: Removing ["+r+","+a+"] from the "+e+" SourceBuffer"),console.assert(!g.updating,e+" sourceBuffer must not be updating"),g.remove(r,a)):h.shiftAndExecuteNext(e)},x.appendExecutor=function(e,t){var i=this.operationQueue,p=this.sourceBuffer,u=p[t];if(!u){L.logger.warn("[buffer-controller]: Attempting to append to the "+t+" SourceBuffer, but it does not exist"),i.shiftAndExecuteNext(t);return}u.ended=!1,console.assert(!u.updating,t+" sourceBuffer must not be updating"),u.appendBuffer(e)},x.blockBuffers=function(e,t){var i=this;if(t===void 0&&(t=this.getSourceBufferTypes()),!t.length){L.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(e);return}var p=this.operationQueue,u=t.map(function(h){return p.appendBlocker(h)});Promise.all(u).then(function(){e(),t.forEach(function(h){var T=i.sourceBuffer[h];(!T||!T.updating)&&p.shiftAndExecuteNext(h)})})},x.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},x.addBufferListener=function(e,t,i){var p=this.sourceBuffer[e];if(!p)return;var u=i.bind(this,e);this.listeners[e].push({event:t,listener:u}),p.addEventListener(t,u)},x.removeBufferListeners=function(e){var t=this.sourceBuffer[e];if(!t)return;this.listeners[e].forEach(function(i){t.removeEventListener(i.event,i.listener)})},v}()},"./src/controller/buffer-operation-queue.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"default",function(){return D});var k=S("./src/utils/logger.ts"),D=function(){function L(_){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=_}var B=L.prototype;return B.append=function(A,C){var s=this.queues[C];s.push(A),s.length===1&&this.buffers[C]&&this.executeNext(C)},B.insertAbort=function(A,C){var s=this.queues[C];s.unshift(A),this.executeNext(C)},B.appendBlocker=function(A){var C,s=new Promise(function(b){C=b}),m={execute:C,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(m,A),s},B.executeNext=function(A){var C=this.buffers,s=this.queues,m=C[A],b=s[A];if(b.length){var c=b[0];try{c.execute()}catch(v){k.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),c.onError(v),(!m||!m.updating)&&(b.shift(),this.executeNext(A))}}},B.shiftAndExecuteNext=function(A){this.queues[A].shift(),this.executeNext(A)},B.current=function(A){return this.queues[A][0]},L}()},"./src/controller/cap-level-controller.ts":function(se,U,S){"use strict";S.r(U);var k=S("./src/events.ts");function D(_,A){for(var C=0;C<A.length;C++){var s=A[C];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(_,s.key,s)}}function L(_,A,C){return A&&D(_.prototype,A),C&&D(_,C),_}var B=function(){function _(C){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=C,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var A=_.prototype;return A.setStreamController=function(s){this.streamController=s},A.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},A.registerListeners=function(){var s=this.hls;s.on(k.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),s.on(k.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(k.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.on(k.Events.BUFFER_CODECS,this.onBufferCodecs,this),s.on(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},A.unregisterListener=function(){var s=this.hls;s.off(k.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),s.off(k.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.off(k.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.off(k.Events.BUFFER_CODECS,this.onBufferCodecs,this),s.off(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},A.onFpsDropLevelCapping=function(s,m){_.isLevelAllowed(m.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(m.droppedLevel)},A.onMediaAttaching=function(s,m){this.media=m.media instanceof HTMLVideoElement?m.media:null},A.onManifestParsed=function(s,m){var b=this.hls;this.restrictedLevels=[],this.firstLevel=m.firstLevel,b.config.capLevelToPlayerSize&&m.video&&this.startCapping()},A.onBufferCodecs=function(s,m){var b=this.hls;b.config.capLevelToPlayerSize&&m.video&&this.startCapping()},A.onMediaDetaching=function(){this.stopCapping()},A.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var s=this.hls.levels;if(s.length){var m=this.hls;m.autoLevelCapping=this.getMaxLevel(s.length-1),m.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=m.autoLevelCapping}}},A.getMaxLevel=function(s){var m=this,b=this.hls.levels;if(!b.length)return-1;var c=b.filter(function(v,x){return _.isLevelAllowed(x,m.restrictedLevels)&&x<=s});return this.clientRect=null,_.getMaxLevelByMediaSize(c,this.mediaWidth,this.mediaHeight)},A.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()},A.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},A.getDimensions=function(){if(this.clientRect)return this.clientRect;var s=this.media,m={width:0,height:0};if(s){var b=s.getBoundingClientRect();m.width=b.width,m.height=b.height,!m.width&&!m.height&&(m.width=b.right-b.left||s.width||0,m.height=b.bottom-b.top||s.height||0)}return this.clientRect=m,m},_.isLevelAllowed=function(s,m){return m===void 0&&(m=[]),m.indexOf(s)===-1},_.getMaxLevelByMediaSize=function(s,m,b){if(!s||!s.length)return-1;for(var c=function(t,i){return i?t.width!==i.width||t.height!==i.height:!0},v=s.length-1,x=0;x<s.length;x+=1){var n=s[x];if((n.width>=m||n.height>=b)&&c(n,s[x+1])){v=x;break}}return v},L(_,[{key:"mediaWidth",get:function(){return this.getDimensions().width*_.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*_.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var s=1;try{s=self.devicePixelRatio}catch(m){}return s}}]),_}();U.default=B},"./src/controller/cmcd-controller.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"default",function(){return c});var k=S("./src/events.ts"),D=S("./src/types/cmcd.ts"),L=S("./src/utils/buffer-helper.ts"),B=S("./src/utils/logger.ts");function _(v,x){for(var n=0;n<x.length;n++){var e=x[n];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(v,e.key,e)}}function A(v,x,n){return x&&_(v.prototype,x),n&&_(v,n),v}function C(v,x){var n=typeof Symbol!="undefined"&&v[Symbol.iterator]||v["@@iterator"];if(n)return(n=n.call(v)).next.bind(n);if(Array.isArray(v)||(n=s(v))||x&&v&&typeof v.length=="number"){n&&(v=n);var e=0;return function(){return e>=v.length?{done:!0}:{done:!1,value:v[e++]}}}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 s(v,x){if(!v)return;if(typeof v=="string")return m(v,x);var n=Object.prototype.toString.call(v).slice(8,-1);if(n==="Object"&&v.constructor&&(n=v.constructor.name),n==="Map"||n==="Set")return Array.from(v);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return m(v,x)}function m(v,x){(x==null||x>v.length)&&(x=v.length);for(var n=0,e=new Array(x);n<x;n++)e[n]=v[n];return e}function b(){return b=Object.assign||function(v){for(var x=1;x<arguments.length;x++){var n=arguments[x];for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(v[e]=n[e])}return v},b.apply(this,arguments)}var c=function(){function v(n){var e=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(){e.initialized&&(e.starved=!0),e.buffering=!0},this.onPlaying=function(){e.initialized||(e.initialized=!0),e.buffering=!1},this.applyPlaylistData=function(p){try{e.apply(p,{ot:D.CMCDObjectType.MANIFEST,su:!e.initialized})}catch(u){B.logger.warn("Could not generate manifest CMCD data.",u)}},this.applyFragmentData=function(p){try{var u=p.frag,h=e.hls.levels[u.level],T=e.getObjectType(u),g={d:u.duration*1e3,ot:T};(T===D.CMCDObjectType.VIDEO||T===D.CMCDObjectType.AUDIO||T==D.CMCDObjectType.MUXED)&&(g.br=h.bitrate/1e3,g.tb=e.getTopBandwidth(T),g.bl=e.getBufferLength(T)),e.apply(p,g)}catch(f){B.logger.warn("Could not generate segment CMCD data.",f)}},this.hls=n;var t=this.config=n.config,i=t.cmcd;i!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||v.uuid(),this.cid=i.contentId,this.useHeaders=i.useHeaders===!0,this.registerListeners())}var x=v.prototype;return x.registerListeners=function(){var e=this.hls;e.on(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(k.Events.MEDIA_DETACHED,this.onMediaDetached,this),e.on(k.Events.BUFFER_CREATED,this.onBufferCreated,this)},x.unregisterListeners=function(){var e=this.hls;e.off(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(k.Events.MEDIA_DETACHED,this.onMediaDetached,this),e.off(k.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(e,t){this.media=t.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(e,t){var i,p;this.audioBuffer=(i=t.tracks.audio)===null||i===void 0?void 0:i.buffer,this.videoBuffer=(p=t.tracks.video)===null||p===void 0?void 0:p.buffer},x.createData=function(){var e;return{v:D.CMCDVersion,sf:D.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)===null||e===void 0?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},x.apply=function(e,t){t===void 0&&(t={}),b(t,this.createData());var i=t.ot===D.CMCDObjectType.INIT||t.ot===D.CMCDObjectType.VIDEO||t.ot===D.CMCDObjectType.MUXED;if(this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering),this.useHeaders){var p=v.toHeaders(t);if(!Object.keys(p).length)return;e.headers||(e.headers={}),b(e.headers,p)}else{var u=v.toQuery(t);if(!u)return;e.url=v.appendQueryToUri(e.url,u)}},x.getObjectType=function(e){var t=e.type;return t==="subtitle"?D.CMCDObjectType.TIMED_TEXT:e.sn==="initSegment"?D.CMCDObjectType.INIT:t==="audio"?D.CMCDObjectType.AUDIO:t==="main"?this.hls.audioTracks.length?D.CMCDObjectType.VIDEO:D.CMCDObjectType.MUXED:void 0},x.getTopBandwidth=function(e){for(var t=0,i=e===D.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,p=C(i),u;!(u=p()).done;){var h=u.value;h.bitrate>t&&(t=h.bitrate)}return t>0?t:NaN},x.getBufferLength=function(e){var t=this.hls.media,i=e===D.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!i||!t)return NaN;var p=L.BufferHelper.bufferInfo(i,t.currentTime,this.config.maxBufferHole);return p.len*1e3},x.createPlaylistLoader=function(){var e=this.config.pLoader,t=this.applyPlaylistData,i=e||this.config.loader;return function(){function p(h){this.loader=void 0,this.loader=new i(h)}var u=p.prototype;return u.destroy=function(){this.loader.destroy()},u.abort=function(){this.loader.abort()},u.load=function(T,g,f){t(T),this.loader.load(T,g,f)},A(p,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),p}()},x.createFragmentLoader=function(){var e=this.config.fLoader,t=this.applyFragmentData,i=e||this.config.loader;return function(){function p(h){this.loader=void 0,this.loader=new i(h)}var u=p.prototype;return u.destroy=function(){this.loader.destroy()},u.abort=function(){this.loader.abort()},u.load=function(T,g,f){t(T),this.loader.load(T,g,f)},A(p,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),p}()},v.uuid=function(){var e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.substr(t.lastIndexOf("/")+1)},v.serialize=function(e){for(var t=[],i=function(M){return!Number.isNaN(M)&&M!=null&&M!==""&&M!==!1},p=function(M){return Math.round(M)},u=function(M){return p(M/100)*100},h=function(M){return encodeURIComponent(M)},T={br:p,d:p,bl:u,dl:u,mtp:u,nor:h,rtp:u,tb:p},g=Object.keys(e||{}).sort(),f=C(g),l;!(l=f()).done;){var r=l.value,a=e[r];if(!i(a))continue;if(r==="v"&&a===1)continue;if(r=="pr"&&a===1)continue;var y=T[r];y&&(a=y(a));var E=typeof a,w=void 0;r==="ot"||r==="sf"||r==="st"?w=r+"="+a:E==="boolean"?w=r:E==="number"?w=r+"="+a:w=r+"="+JSON.stringify(a),t.push(w)}return t.join(",")},v.toHeaders=function(e){for(var t=Object.keys(e),i={},p=["Object","Request","Session","Status"],u=[{},{},{},{}],h={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},T=0,g=t;T<g.length;T++){var f=g[T],l=h[f]!=null?h[f]:1;u[l][f]=e[f]}for(var r=0;r<u.length;r++){var a=v.serialize(u[r]);a&&(i["CMCD-"+p[r]]=a)}return i},v.toQuery=function(e){return"CMCD="+encodeURIComponent(v.serialize(e))},v.appendQueryToUri=function(e,t){if(!t)return e;var i=e.includes("?")?"&":"?";return""+e+i+t},v}()},"./src/controller/eme-controller.ts":function(se,U,S){"use strict";S.r(U);var k=S("./src/events.ts"),D=S("./src/errors.ts"),L=S("./src/utils/logger.ts"),B=S("./src/utils/mediakeys-helper.ts");function _(c,v){for(var x=0;x<v.length;x++){var n=v[x];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(c,n.key,n)}}function A(c,v,x){return v&&_(c.prototype,v),x&&_(c,x),c}var C=3,s=function(v,x,n){var e={audioCapabilities:[],videoCapabilities:[]};return v.forEach(function(t){e.audioCapabilities.push({contentType:'audio/mp4; codecs="'+t+'"',robustness:n.audioRobustness||""})}),x.forEach(function(t){e.videoCapabilities.push({contentType:'video/mp4; codecs="'+t+'"',robustness:n.videoRobustness||""})}),[e]},m=function(v,x,n,e){switch(v){case B.KeySystems.WIDEVINE:return s(x,n,e);default:throw new Error("Unknown key-system: "+v)}},b=function(){function c(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 v=c.prototype;return v.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},v._registerListeners=function(){this.hls.on(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(k.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(k.Events.MANIFEST_PARSED,this.onManifestParsed,this)},v._unregisterListeners=function(){this.hls.off(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(k.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(k.Events.MANIFEST_PARSED,this.onManifestParsed,this)},v.getLicenseServerUrl=function(n){switch(n){case B.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+n+'"')},v._attemptKeySystemAccess=function(n,e,t){var i=this,p=m(n,e,t,this._drmSystemOptions);L.logger.log("Requesting encrypted media key-system access");var u=this.requestMediaKeySystemAccess(n,p);this.mediaKeysPromise=u.then(function(h){return i._onMediaKeySystemAccessObtained(n,h)}),u.catch(function(h){L.logger.error('Failed to obtain key-system "'+n+'" access:',h)})},v._onMediaKeySystemAccessObtained=function(n,e){var t=this;L.logger.log('Access for key-system "'+n+'" obtained');var i={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:e,mediaKeySystemDomain:n};this._mediaKeysList.push(i);var p=Promise.resolve().then(function(){return e.createMediaKeys()}).then(function(u){return i.mediaKeys=u,L.logger.log('Media-keys created for key-system "'+n+'"'),t._onMediaKeysCreated(),u});return p.catch(function(u){L.logger.error("Failed to create media-keys:",u)}),p},v._onMediaKeysCreated=function(){var n=this;this._mediaKeysList.forEach(function(e){e.mediaKeysSession||(e.mediaKeysSession=e.mediaKeys.createSession(),n._onNewMediaKeySession(e.mediaKeysSession))})},v._onNewMediaKeySession=function(n){var e=this;L.logger.log("New key-system session "+n.sessionId),n.addEventListener("message",function(t){e._onKeySessionMessage(n,t.message)},!1)},v._onKeySessionMessage=function(n,e){L.logger.log("Got EME message event, creating license request"),this._requestLicense(e,function(t){L.logger.log("Received license data (length: "+(t&&t.byteLength)+"), updating key-session"),n.update(t)})},v.onMediaEncrypted=function(n){var e=this;if(L.logger.log('Media is encrypted using "'+n.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(k.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var t=function(p){if(!e._media)return;e._attemptSetMediaKeys(p),e._generateRequestWithPreferredKeySession(n.initDataType,n.initData)};this.mediaKeysPromise.then(t).catch(t)},v._attemptSetMediaKeys=function(n){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var e=this._mediaKeysList[0];if(!e||!e.mediaKeys){L.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(k.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}L.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(e.mediaKeys),this._hasSetMediaKeys=!0}},v._generateRequestWithPreferredKeySession=function(n,e){var t=this,i=this._mediaKeysList[0];if(!i){L.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(k.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(i.mediaKeysSessionInitialized){L.logger.warn("Key-Session already initialized but requested again");return}var p=i.mediaKeysSession;if(!p){L.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(k.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!e){L.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(k.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}L.logger.log('Generating key-session request for "'+n+'" init data type'),i.mediaKeysSessionInitialized=!0,p.generateRequest(n,e).then(function(){L.logger.debug("Key-session generation succeeded")}).catch(function(u){L.logger.error("Error generating key-session request:",u),t.hls.trigger(k.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},v._createLicenseXhr=function(n,e,t){var i=new XMLHttpRequest;i.responseType="arraybuffer",i.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,i,n,e,t);var p=this._licenseXhrSetup;if(p)try{p.call(this.hls,i,n),p=void 0}catch(u){L.logger.error(u)}try{i.readyState||i.open("POST",n,!0),p&&p.call(this.hls,i,n)}catch(u){throw new Error("issue setting up KeySystem license XHR "+u)}return i},v._onLicenseRequestReadyStageChange=function(n,e,t,i){switch(n.readyState){case 4:if(n.status===200){this._requestLicenseFailureCount=0,L.logger.log("License request succeeded");var p=n.response,u=this._licenseResponseCallback;if(u)try{p=u.call(this.hls,n,e)}catch(T){L.logger.error(T)}i(p)}else{if(L.logger.error("License Request XHR failed ("+e+"). Status: "+n.status+" ("+n.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>C){this.hls.trigger(k.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var h=C-this._requestLicenseFailureCount+1;L.logger.warn("Retrying license request, "+h+" attempts left"),this._requestLicense(t,i)}break}},v._generateLicenseRequestChallenge=function(n,e){switch(n.mediaKeySystemDomain){case B.KeySystems.WIDEVINE:return e}throw new Error("unsupported key-system: "+n.mediaKeySystemDomain)},v._requestLicense=function(n,e){L.logger.log("Requesting content license for key-system");var t=this._mediaKeysList[0];if(!t){L.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(k.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var i=this.getLicenseServerUrl(t.mediaKeySystemDomain),p=this._createLicenseXhr(i,n,e);L.logger.log("Sending license request to URL: "+i);var u=this._generateLicenseRequestChallenge(t,n);p.send(u)}catch(h){L.logger.error("Failure requesting DRM license: "+h),this.hls.trigger(k.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},v.onMediaAttached=function(n,e){if(!this._emeEnabled)return;var t=e.media;this._media=t,t.addEventListener("encrypted",this._onMediaEncrypted)},v.onMediaDetached=function(){var n=this._media,e=this._mediaKeysList;if(!n)return;n.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(e.map(function(t){if(t.mediaKeysSession)return t.mediaKeysSession.close().catch(function(){})})).then(function(){return n.setMediaKeys(null)}).catch(function(){})},v.onManifestParsed=function(n,e){if(!this._emeEnabled)return;var t=e.levels.map(function(p){return p.audioCodec}).filter(function(p){return!!p}),i=e.levels.map(function(p){return p.videoCodec}).filter(function(p){return!!p});this._attemptKeySystemAccess(B.KeySystems.WIDEVINE,t,i)},A(c,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),c}();U.default=b},"./src/controller/fps-controller.ts":function(se,U,S){"use strict";S.r(U);var k=S("./src/events.ts"),D=S("./src/utils/logger.ts"),L=function(){function B(A){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=A,this.registerListeners()}var _=B.prototype;return _.setStreamController=function(C){this.streamController=C},_.registerListeners=function(){this.hls.on(k.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},_.unregisterListeners=function(){this.hls.off(k.Events.MEDIA_ATTACHING,this.onMediaAttaching)},_.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},_.onMediaAttaching=function(C,s){var m=this.hls.config;if(m.capLevelOnFPSDrop){var b=s.media instanceof self.HTMLVideoElement?s.media:null;this.media=b,b&&typeof b.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),m.fpsDroppedMonitoringPeriod)}},_.checkFPS=function(C,s,m){var b=performance.now();if(s){if(this.lastTime){var c=b-this.lastTime,v=m-this.lastDroppedFrames,x=s-this.lastDecodedFrames,n=1e3*v/c,e=this.hls;if(e.trigger(k.Events.FPS_DROP,{currentDropped:v,currentDecoded:x,totalDroppedFrames:m}),n>0&&v>e.config.fpsDroppedMonitoringThreshold*x){var t=e.currentLevel;D.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+t),t>0&&(e.autoLevelCapping===-1||e.autoLevelCapping>=t)&&(t=t-1,e.trigger(k.Events.FPS_DROP_LEVEL_CAPPING,{level:t,droppedLevel:e.currentLevel}),e.autoLevelCapping=t,this.streamController.nextLevelSwitch())}}this.lastTime=b,this.lastDroppedFrames=m,this.lastDecodedFrames=s}},_.checkFPSInterval=function(){var C=this.media;if(C)if(this.isVideoPlaybackQualityAvailable){var s=C.getVideoPlaybackQuality();this.checkFPS(C,s.totalVideoFrames,s.droppedVideoFrames)}else this.checkFPS(C,C.webkitDecodedFrameCount,C.webkitDroppedFrameCount)},B}();U.default=L},"./src/controller/fragment-finders.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"findFragmentByPDT",function(){return L}),S.d(U,"findFragmentByPTS",function(){return B}),S.d(U,"fragmentWithinToleranceTest",function(){return _}),S.d(U,"pdtWithinToleranceTest",function(){return A}),S.d(U,"findFragWithCC",function(){return C});var k=S("./src/polyfills/number.ts"),D=S("./src/utils/binary-search.ts");function L(s,m,b){if(m===null||!Array.isArray(s)||!s.length||!Object(k.isFiniteNumber)(m))return null;var c=s[0].programDateTime;if(m<(c||0))return null;var v=s[s.length-1].endProgramDateTime;if(m>=(v||0))return null;b=b||0;for(var x=0;x<s.length;++x){var n=s[x];if(A(m,b,n))return n}return null}function B(s,m,b,c){b===void 0&&(b=0),c===void 0&&(c=0);var v=null;if(s?v=m[s.sn-m[0].sn+1]||null:b===0&&m[0].start===0&&(v=m[0]),v&&_(b,c,v)===0)return v;var x=D.default.search(m,_.bind(null,b,c));return x||v}function _(s,m,b){s===void 0&&(s=0),m===void 0&&(m=0);var c=Math.min(m,b.duration+(b.deltaPTS?b.deltaPTS:0));return b.start+b.duration-c<=s?1:b.start-c>s&&b.start?-1:0}function A(s,m,b){var c=Math.min(m,b.duration+(b.deltaPTS?b.deltaPTS:0))*1e3,v=b.endProgramDateTime||0;return v-c>s}function C(s,m){return D.default.search(s,function(b){return b.cc<m?1:b.cc>m?-1:0})}},"./src/controller/fragment-tracker.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"FragmentState",function(){return L}),S.d(U,"FragmentTracker",function(){return B});var k=S("./src/events.ts"),D=S("./src/types/loader.ts"),L;(function(C){C.NOT_LOADED="NOT_LOADED",C.BACKTRACKED="BACKTRACKED",C.APPENDING="APPENDING",C.PARTIAL="PARTIAL",C.OK="OK"})(L||(L={}));var B=function(){function C(m){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=m,this._registerListeners()}var s=C.prototype;return s._registerListeners=function(){var b=this.hls;b.on(k.Events.BUFFER_APPENDED,this.onBufferAppended,this),b.on(k.Events.FRAG_BUFFERED,this.onFragBuffered,this),b.on(k.Events.FRAG_LOADED,this.onFragLoaded,this)},s._unregisterListeners=function(){var b=this.hls;b.off(k.Events.BUFFER_APPENDED,this.onBufferAppended,this),b.off(k.Events.FRAG_BUFFERED,this.onFragBuffered,this),b.off(k.Events.FRAG_LOADED,this.onFragLoaded,this)},s.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},s.getAppendedFrag=function(b,c){if(c===D.PlaylistLevelType.MAIN){var v=this.activeFragment,x=this.activeParts;if(!v)return null;if(x)for(var n=x.length;n--;){var e=x[n],t=e?e.end:v.appendedPTS;if(e.start<=b&&t!==void 0&&b<=t)return n>9&&(this.activeParts=x.slice(n-9)),e}else if(v.start<=b&&v.appendedPTS!==void 0&&b<=v.appendedPTS)return v}return this.getBufferedFrag(b,c)},s.getBufferedFrag=function(b,c){for(var v=this.fragments,x=Object.keys(v),n=x.length;n--;){var e=v[x[n]];if((e==null?void 0:e.body.type)===c&&e.buffered){var t=e.body;if(t.start<=b&&b<=t.end)return t}}return null},s.detectEvictedFragments=function(b,c,v){var x=this;Object.keys(this.fragments).forEach(function(n){var e=x.fragments[n];if(!e)return;if(!e.buffered){e.body.type===v&&x.removeFragment(e.body);return}var t=e.range[b];if(!t)return;t.time.some(function(i){var p=!x.isTimeBuffered(i.startPTS,i.endPTS,c);return p&&x.removeFragment(e.body),p})})},s.detectPartialFragments=function(b){var c=this,v=this.timeRanges,x=b.frag,n=b.part;if(!v||x.sn==="initSegment")return;var e=A(x),t=this.fragments[e];if(!t)return;Object.keys(v).forEach(function(i){var p=x.elementaryStreams[i];if(!p)return;var u=v[i],h=n!==null||p.partial===!0;t.range[i]=c.getBufferedTimes(x,n,h,u)}),t.backtrack=t.loaded=null,Object.keys(t.range).length?t.buffered=!0:this.removeFragment(t.body)},s.fragBuffered=function(b){var c=A(b),v=this.fragments[c];v&&(v.backtrack=v.loaded=null,v.buffered=!0)},s.getBufferedTimes=function(b,c,v,x){for(var n={time:[],partial:v},e=c?c.start:b.start,t=c?c.end:b.end,i=b.minEndPTS||t,p=b.maxStartPTS||e,u=0;u<x.length;u++){var h=x.start(u)-this.bufferPadding,T=x.end(u)+this.bufferPadding;if(p>=h&&i<=T){n.time.push({startPTS:Math.max(e,x.start(u)),endPTS:Math.min(t,x.end(u))});break}else if(e<T&&t>h)n.partial=!0,n.time.push({startPTS:Math.max(e,x.start(u)),endPTS:Math.min(t,x.end(u))});else if(t<=h)break}return n},s.getPartialFragment=function(b){var c=null,v,x,n,e=0,t=this.bufferPadding,i=this.fragments;return Object.keys(i).forEach(function(p){var u=i[p];if(!u)return;_(u)&&(x=u.body.start-t,n=u.body.end+t,b>=x&&b<=n&&(v=Math.min(b-x,n-b),e<=v&&(c=u.body,e=v)))}),c},s.getState=function(b){var c=A(b),v=this.fragments[c];return v?v.buffered?_(v)?L.PARTIAL:L.OK:v.backtrack?L.BACKTRACKED:L.APPENDING:L.NOT_LOADED},s.backtrack=function(b,c){var v=A(b),x=this.fragments[v];if(!x||x.backtrack)return null;var n=x.backtrack=c||x.loaded;return x.loaded=null,n},s.getBacktrackData=function(b){var c=A(b),v=this.fragments[c];if(v){var x,n=v.backtrack;if(n!=null&&(x=n.payload)!==null&&x!==void 0&&x.byteLength)return n;this.removeFragment(b)}return null},s.isTimeBuffered=function(b,c,v){for(var x,n,e=0;e<v.length;e++){if(x=v.start(e)-this.bufferPadding,n=v.end(e)+this.bufferPadding,b>=x&&c<=n)return!0;if(c<=x)return!1}return!1},s.onFragLoaded=function(b,c){var v=c.frag,x=c.part;if(v.sn==="initSegment"||v.bitrateTest||x)return;var n=A(v);this.fragments[n]={body:v,loaded:c,backtrack:null,buffered:!1,range:Object.create(null)}},s.onBufferAppended=function(b,c){var v=this,x=c.frag,n=c.part,e=c.timeRanges;if(x.type===D.PlaylistLevelType.MAIN)if(this.activeFragment=x,n){var t=this.activeParts;t||(this.activeParts=t=[]),t.push(n)}else this.activeParts=null;this.timeRanges=e,Object.keys(e).forEach(function(i){var p=e[i];if(v.detectEvictedFragments(i,p),!n)for(var u=0;u<p.length;u++)x.appendedPTS=Math.max(p.end(u),x.appendedPTS||0)})},s.onFragBuffered=function(b,c){this.detectPartialFragments(c)},s.hasFragment=function(b){var c=A(b);return!!this.fragments[c]},s.removeFragmentsInRange=function(b,c,v){var x=this;Object.keys(this.fragments).forEach(function(n){var e=x.fragments[n];if(!e)return;if(e.buffered){var t=e.body;t.type===v&&t.start<c&&t.end>b&&x.removeFragment(t)}})},s.removeFragment=function(b){var c=A(b);b.stats.loaded=0,b.clearElementaryStreamInfo(),delete this.fragments[c]},s.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},C}();function _(C){var s,m;return C.buffered&&(((s=C.range.video)===null||s===void 0?void 0:s.partial)||((m=C.range.audio)===null||m===void 0?void 0:m.partial))}function A(C){return C.type+"_"+C.level+"_"+C.urlId+"_"+C.sn}},"./src/controller/gap-controller.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"STALL_MINIMUM_DURATION_MS",function(){return _}),S.d(U,"MAX_START_GAP_JUMP",function(){return A}),S.d(U,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return C}),S.d(U,"SKIP_BUFFER_RANGE_START",function(){return s}),S.d(U,"default",function(){return m});var k=S("./src/utils/buffer-helper.ts"),D=S("./src/errors.ts"),L=S("./src/events.ts"),B=S("./src/utils/logger.ts"),_=250,A=2,C=.1,s=.05,m=function(){function b(v,x,n,e){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=v,this.media=x,this.fragmentTracker=n,this.hls=e}var c=b.prototype;return c.destroy=function(){this.hls=this.fragmentTracker=this.media=null},c.poll=function(x){var n=this.config,e=this.media,t=this.stalled,i=e.currentTime,p=e.seeking,u=this.seeking&&!p,h=!this.seeking&&p;if(this.seeking=p,i!==x){if(this.moved=!0,t!==null){if(this.stallReported){var T=self.performance.now()-t;B.logger.warn("playback not stuck anymore @"+i+", after "+Math.round(T)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((h||u)&&(this.stalled=null),e.paused||e.ended||e.playbackRate===0||!k.BufferHelper.getBuffered(e).length)return;var g=k.BufferHelper.bufferInfo(e,i,0),f=g.len>0,l=g.nextStart||0;if(!f&&!l)return;if(p){var r=g.len>A,a=!l||l-i>A&&!this.fragmentTracker.getPartialFragment(i);if(r||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var y,E=Math.max(l,g.start||0)-i,w=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,R=w==null||((y=w.details)===null||y===void 0)?void 0:y.live,M=R?w.details.targetduration*2:A;if(E>0&&E<=M){this._trySkipBufferHole(null);return}}var N=self.performance.now();if(t===null){this.stalled=N;return}var j=N-t;!p&&j>=_&&this._reportStall(g.len);var K=k.BufferHelper.bufferInfo(e,i,n.maxBufferHole);this._tryFixBufferStall(K,j)},c._tryFixBufferStall=function(x,n){var e=this.config,t=this.fragmentTracker,i=this.media,p=i.currentTime,u=t.getPartialFragment(p);if(u){var h=this._trySkipBufferHole(u);if(h)return}x.len>e.maxBufferHole&&n>e.highBufferWatchdogPeriod*1e3&&(B.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},c._reportStall=function(x){var n=this.hls,e=this.media,t=this.stallReported;t||(this.stallReported=!0,B.logger.warn("Playback stalling at @"+e.currentTime+" due to low buffer (buffer="+x+")"),n.trigger(L.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:x}))},c._trySkipBufferHole=function(x){for(var n=this.config,e=this.hls,t=this.media,i=t.currentTime,p=0,u=k.BufferHelper.getBuffered(t),h=0;h<u.length;h++){var T=u.start(h);if(i+n.maxBufferHole>=p&&i<T){var g=Math.max(T+s,t.currentTime+C);return B.logger.warn("skipping hole, adjusting currentTime from "+i+" to "+g),this.moved=!0,this.stalled=null,t.currentTime=g,x&&e.trigger(L.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+i+" to "+g,frag:x}),g}p=u.end(h)}return 0},c._tryNudgeBuffer=function(){var x=this.config,n=this.hls,e=this.media,t=e.currentTime,i=(this.nudgeRetry||0)+1;if(this.nudgeRetry=i,i<x.nudgeMaxRetry){var p=t+i*x.nudgeOffset;B.logger.warn("Nudging 'currentTime' from "+t+" to "+p),e.currentTime=p,n.trigger(L.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else B.logger.error("Playhead still not moving while enough data buffered @"+t+" after "+x.nudgeMaxRetry+" nudges"),n.trigger(L.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},b}()},"./src/controller/id3-track-controller.ts":function(se,U,S){"use strict";S.r(U);var k=S("./src/events.ts"),D=S("./src/utils/texttrack-utils.ts"),L=S("./src/demux/id3.ts"),B=.25,_=function(){function A(s){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=s,this._registerListeners()}var C=A.prototype;return C.destroy=function(){this._unregisterListeners()},C._registerListeners=function(){var m=this.hls;m.on(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),m.on(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),m.on(k.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),m.on(k.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},C._unregisterListeners=function(){var m=this.hls;m.off(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),m.off(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),m.off(k.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),m.off(k.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},C.onMediaAttached=function(m,b){this.media=b.media},C.onMediaDetaching=function(){if(!this.id3Track)return;Object(D.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},C.getID3Track=function(m){if(!this.media)return;for(var b=0;b<m.length;b++){var c=m[b];if(c.kind==="metadata"&&c.label==="id3")return Object(D.sendAddTrackEvent)(c,this.media),c}return this.media.addTextTrack("metadata","id3")},C.onFragParsingMetadata=function(m,b){if(!this.media)return;var c=b.frag,v=b.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var x=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,n=0;n<v.length;n++){var e=L.getID3Frames(v[n].data);if(e){var t=v[n].pts,i=n<v.length-1?v[n+1].pts:c.end,p=i-t;p<=0&&(i=t+B);for(var u=0;u<e.length;u++){var h=e[u];if(!L.isTimeStampFrame(h)){var T=new x(t,i,"");T.value=h,this.id3Track.addCue(T)}}}}},C.onBufferFlushing=function(m,b){var c=b.startOffset,v=b.endOffset,x=b.type;if(!x||x==="audio"){var n=this.id3Track;n&&Object(D.removeCuesInRange)(n,c,v)}},A}();U.default=_},"./src/controller/latency-controller.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"default",function(){return A});var k=S("./src/errors.ts"),D=S("./src/events.ts"),L=S("./src/utils/logger.ts");function B(C,s){for(var m=0;m<s.length;m++){var b=s[m];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(C,b.key,b)}}function _(C,s,m){return s&&B(C.prototype,s),m&&B(C,m),C}var A=function(){function C(m){var b=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 b.timeupdate()},this.hls=m,this.config=m.config,this.registerListeners()}var s=C.prototype;return s.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},s.registerListeners=function(){this.hls.on(D.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(D.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(D.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(D.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(D.Events.ERROR,this.onError,this)},s.unregisterListeners=function(){this.hls.off(D.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(D.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(D.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(D.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(D.Events.ERROR,this.onError)},s.onMediaAttached=function(b,c){this.media=c.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},s.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},s.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},s.onLevelUpdated=function(b,c){var v=c.details;this.levelDetails=v,v.advanced&&this.timeupdate(),!v.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},s.onError=function(b,c){if(c.details!==k.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,L.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},s.timeupdate=function(){var b=this.media,c=this.levelDetails;if(!b||!c)return;this.currentTime=b.currentTime;var v=this.computeLatency();if(v===null)return;this._latency=v;var x=this.config,n=x.lowLatencyMode,e=x.maxLiveSyncPlaybackRate;if(!n||e===1)return;var t=this.targetLatency;if(t===null)return;var i=v-t,p=Math.min(this.maxLatency,t+c.targetduration),u=i<p;if(c.live&&u&&i>.05&&this.forwardBufferLength>1){var h=Math.min(2,Math.max(1,e)),T=Math.round(2/(1+Math.exp(-.75*i-this.edgeStalled))*20)/20;b.playbackRate=Math.min(h,Math.max(1,T))}else b.playbackRate!==1&&b.playbackRate!==0&&(b.playbackRate=1)},s.estimateLiveEdge=function(){var b=this.levelDetails;return b===null?null:b.edge+b.age},s.computeLatency=function(){var b=this.estimateLiveEdge();return b===null?null:b-this.currentTime},_(C,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var b=this.config,c=this.levelDetails;return b.liveMaxLatencyDuration!==void 0?b.liveMaxLatencyDuration:c?b.liveMaxLatencyDurationCount*c.targetduration:0}},{key:"targetLatency",get:function(){var b=this.levelDetails;if(b===null)return null;var c=b.holdBack,v=b.partHoldBack,x=b.targetduration,n=this.config,e=n.liveSyncDuration,t=n.liveSyncDurationCount,i=n.lowLatencyMode,p=this.hls.userConfig,u=i&&v||c;(p.liveSyncDuration||p.liveSyncDurationCount||u===0)&&(u=e!==void 0?e:t*x);var h=x,T=1;return u+Math.min(this.stallCount*T,h)}},{key:"liveSyncPosition",get:function(){var b=this.estimateLiveEdge(),c=this.targetLatency,v=this.levelDetails;if(b===null||c===null||v===null)return null;var x=v.edge,n=b-c-this.edgeStalled,e=x-v.totalduration,t=x-(this.config.lowLatencyMode&&v.partTarget||v.targetduration);return Math.min(Math.max(e,n),t)}},{key:"drift",get:function(){var b=this.levelDetails;return b===null?1:b.drift}},{key:"edgeStalled",get:function(){var b=this.levelDetails;if(b===null)return 0;var c=(this.config.lowLatencyMode&&b.partTarget||b.targetduration)*3;return Math.max(b.age-c,0)}},{key:"forwardBufferLength",get:function(){var b=this.media,c=this.levelDetails;if(!b||!c)return 0;var v=b.buffered.length;return v?b.buffered.end(v-1):c.edge-this.currentTime}}]),C}()},"./src/controller/level-controller.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"default",function(){return n});var k=S("./src/types/level.ts"),D=S("./src/events.ts"),L=S("./src/errors.ts"),B=S("./src/utils/codecs.ts"),_=S("./src/controller/level-helper.ts"),A=S("./src/controller/base-playlist-controller.ts"),C=S("./src/types/loader.ts");function s(){return s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var p in i)Object.prototype.hasOwnProperty.call(i,p)&&(e[p]=i[p])}return e},s.apply(this,arguments)}function m(e,t){for(var i=0;i<t.length;i++){var p=t[i];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(e,p.key,p)}}function b(e,t,i){return t&&m(e.prototype,t),i&&m(e,i),e}function c(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,v(e,t)}function v(e,t){return v=Object.setPrototypeOf||function(p,u){return p.__proto__=u,p},v(e,t)}var x=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),n=function(e){c(t,e);function t(p){var u;return u=e.call(this,p,"[level-controller]")||this,u._levels=[],u._firstLevel=-1,u._startLevel=void 0,u.currentLevelIndex=-1,u.manualLevelIndex=-1,u.onParsedComplete=void 0,u._registerListeners(),u}var i=t.prototype;return i._registerListeners=function(){var u=this.hls;u.on(D.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.on(D.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(D.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),u.on(D.Events.FRAG_LOADED,this.onFragLoaded,this),u.on(D.Events.ERROR,this.onError,this)},i._unregisterListeners=function(){var u=this.hls;u.off(D.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.off(D.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(D.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),u.off(D.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(D.Events.ERROR,this.onError,this)},i.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,e.prototype.destroy.call(this)},i.startLoad=function(){var u=this._levels;u.forEach(function(h){h.loadError=0}),e.prototype.startLoad.call(this)},i.onManifestLoaded=function(u,h){var T=[],g=[],f=[],l,r={},a,y=!1,E=!1,w=!1;if(h.levels.forEach(function(j){var K=j.attrs;y=y||!!(j.width&&j.height),E=E||!!j.videoCodec,w=w||!!j.audioCodec,x&&j.audioCodec&&j.audioCodec.indexOf("mp4a.40.34")!==-1&&(j.audioCodec=void 0);var V=j.bitrate+"-"+j.attrs.RESOLUTION+"-"+j.attrs.CODECS;a=r[V],a?a.url.push(j.url):(a=new k.Level(j),r[V]=a,T.push(a)),K&&(K.AUDIO&&Object(_.addGroupId)(a,"audio",K.AUDIO),K.SUBTITLES&&Object(_.addGroupId)(a,"text",K.SUBTITLES))}),(y||E)&&w&&(T=T.filter(function(j){var K=j.videoCodec,V=j.width,z=j.height;return!!K||!!(V&&z)})),T=T.filter(function(j){var K=j.audioCodec,V=j.videoCodec;return(!K||Object(B.isCodecSupportedInMp4)(K,"audio"))&&(!V||Object(B.isCodecSupportedInMp4)(V,"video"))}),h.audioTracks&&(g=h.audioTracks.filter(function(j){return!j.audioCodec||Object(B.isCodecSupportedInMp4)(j.audioCodec,"audio")}),Object(_.assignTrackIdsByGroup)(g)),h.subtitles&&(f=h.subtitles,Object(_.assignTrackIdsByGroup)(f)),T.length>0){l=T[0].bitrate,T.sort(function(j,K){return j.bitrate-K.bitrate}),this._levels=T;for(var R=0;R<T.length;R++)if(T[R].bitrate===l){this._firstLevel=R,this.log("manifest loaded, "+T.length+" level(s) found, first bitrate: "+l);break}var M=w&&!E,N={levels:T,audioTracks:g,subtitleTracks:f,firstLevel:this._firstLevel,stats:h.stats,audio:w,video:E,altAudio:!M&&g.some(function(j){return!!j.url})};this.hls.trigger(D.Events.MANIFEST_PARSED,N),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(D.Events.ERROR,{type:L.ErrorTypes.MEDIA_ERROR,details:L.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:h.url,reason:"no level with compatible codecs found in manifest"})},i.onError=function(u,h){if(e.prototype.onError.call(this,u,h),h.fatal)return;var T=h.context,g=this._levels[this.currentLevelIndex];if(T&&(T.type===C.PlaylistContextType.AUDIO_TRACK&&g.audioGroupIds&&T.groupId===g.audioGroupIds[g.urlId]||T.type===C.PlaylistContextType.SUBTITLE_TRACK&&g.textGroupIds&&T.groupId===g.textGroupIds[g.urlId])){this.redundantFailover(this.currentLevelIndex);return}var f=!1,l=!0,r;switch(h.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(h.frag){var a=this._levels[h.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(r=h.frag.level)):r=h.frag.level}break;case L.ErrorDetails.LEVEL_LOAD_ERROR:case L.ErrorDetails.LEVEL_LOAD_TIMEOUT:T&&(T.deliveryDirectives&&(l=!1),r=T.level),f=!0;break;case L.ErrorDetails.REMUX_ALLOC_ERROR:r=h.level,f=!0;break}r!==void 0&&this.recoverLevel(h,r,f,l)},i.recoverLevel=function(u,h,T,g){var f=u.details,l=this._levels[h];if(l.loadError++,T){var r=this.retryLoadingOrFail(u);if(r)u.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(g){var a=l.url.length;if(a>1&&l.loadError<a)u.levelRetry=!0,this.redundantFailover(h);else if(this.manualLevelIndex===-1){var y=h===0?this._levels.length-1:h-1;this.currentLevelIndex!==y&&this._levels[y].loadError===0&&(this.warn(f+": switch to "+y),u.levelRetry=!0,this.hls.nextAutoLevel=y)}}},i.redundantFailover=function(u){var h=this._levels[u],T=h.url.length;if(T>1){var g=(h.urlId+1)%T;this.warn("Switching to redundant URL-id "+g),this._levels.forEach(function(f){f.urlId=g}),this.level=u}},i.onFragLoaded=function(u,h){var T=h.frag;if(T!==void 0&&T.type===C.PlaylistLevelType.MAIN){var g=this._levels[T.level];g!==void 0&&(g.fragmentError=0,g.loadError=0)}},i.onLevelLoaded=function(u,h){var T,g=h.level,f=h.details,l=this._levels[g];if(!l){var r;this.warn("Invalid level index "+g),(r=h.deliveryDirectives)!==null&&r!==void 0&&r.skip&&(f.deltaUpdateFailed=!0);return}g===this.currentLevelIndex?(l.fragmentError===0&&(l.loadError=0,this.retryCount=0),this.playlistLoaded(g,h,l.details)):(T=h.deliveryDirectives)!==null&&T!==void 0&&T.skip&&(f.deltaUpdateFailed=!0)},i.onAudioTrackSwitched=function(u,h){var T=this.hls.levels[this.currentLevelIndex];if(!T)return;if(T.audioGroupIds){for(var g=-1,f=this.hls.audioTracks[h.id].groupId,l=0;l<T.audioGroupIds.length;l++)if(T.audioGroupIds[l]===f){g=l;break}g!==T.urlId&&(T.urlId=g,this.startLoad())}},i.loadPlaylist=function(u){var h=this.currentLevelIndex,T=this._levels[h];if(this.canLoad&&T&&T.url.length>0){var g=T.urlId,f=T.url[g];if(u)try{f=u.addDirectives(f)}catch(l){this.warn("Could not construct new URL with HLS Delivery Directives: "+l)}this.log("Attempt loading level index "+h+(u?" at sn "+u.msn+" part "+u.part:"")+" with URL-id "+g+" "+f),this.clearTimer(),this.hls.trigger(D.Events.LEVEL_LOADING,{url:f,level:h,id:g,deliveryDirectives:u||null})}},i.removeLevel=function(u,h){var T=function(l,r){return r!==h},g=this._levels.filter(function(f,l){return l!==u?!0:f.url.length>1&&h!==void 0?(f.url=f.url.filter(T),f.audioGroupIds&&(f.audioGroupIds=f.audioGroupIds.filter(T)),f.textGroupIds&&(f.textGroupIds=f.textGroupIds.filter(T)),f.urlId=0,!0):!1}).map(function(f,l){var r=f.details;return r!=null&&r.fragments&&r.fragments.forEach(function(a){a.level=l}),f});this._levels=g,this.hls.trigger(D.Events.LEVELS_UPDATED,{levels:g})},b(t,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(u){var h,T=this._levels;if(T.length===0)return;if(this.currentLevelIndex===u&&(h=T[u])!==null&&h!==void 0&&h.details)return;if(u<0||u>=T.length){var g=u<0;if(this.hls.trigger(D.Events.ERROR,{type:L.ErrorTypes.OTHER_ERROR,details:L.ErrorDetails.LEVEL_SWITCH_ERROR,level:u,fatal:g,reason:"invalid level idx"}),g)return;u=Math.min(u,T.length-1)}this.clearTimer();var f=this.currentLevelIndex,l=T[f],r=T[u];this.log("switching to level "+u+" from "+f),this.currentLevelIndex=u;var a=s({},r,{level:u,maxBitrate:r.maxBitrate,uri:r.uri,urlId:r.urlId});delete a._urlId,this.hls.trigger(D.Events.LEVEL_SWITCHING,a);var y=r.details;if(!y||y.live){var E=this.switchParams(r.uri,l==null?void 0:l.details);this.loadPlaylist(E)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(u){this.manualLevelIndex=u,this._startLevel===void 0&&(this._startLevel=u),u!==-1&&(this.level=u)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(u){this._firstLevel=u}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var u=this.hls.config.startLevel;return u!==void 0?u:this._firstLevel}else return this._startLevel},set:function(u){this._startLevel=u}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(u){this.level=u,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=u)}}]),t}(A.default)},"./src/controller/level-helper.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"addGroupId",function(){return L}),S.d(U,"assignTrackIdsByGroup",function(){return B}),S.d(U,"updatePTS",function(){return _}),S.d(U,"updateFragPTSDTS",function(){return C}),S.d(U,"mergeDetails",function(){return s}),S.d(U,"mapPartIntersection",function(){return m}),S.d(U,"mapFragmentIntersection",function(){return b}),S.d(U,"adjustSliding",function(){return c}),S.d(U,"addSliding",function(){return v}),S.d(U,"computeReloadInterval",function(){return x}),S.d(U,"getFragmentWithSN",function(){return n}),S.d(U,"getPartWith",function(){return e});var k=S("./src/polyfills/number.ts"),D=S("./src/utils/logger.ts");function L(t,i,p){switch(i){case"audio":t.audioGroupIds||(t.audioGroupIds=[]),t.audioGroupIds.push(p);break;case"text":t.textGroupIds||(t.textGroupIds=[]),t.textGroupIds.push(p);break}}function B(t){var i={};t.forEach(function(p){var u=p.groupId||"";p.id=i[u]=i[u]||0,i[u]++})}function _(t,i,p){var u=t[i],h=t[p];A(u,h)}function A(t,i){var p=i.startPTS;if(Object(k.isFiniteNumber)(p)){var u=0,h;i.sn>t.sn?(u=p-t.start,h=t):(u=t.start-p,h=i),h.duration!==u&&(h.duration=u)}else if(i.sn>t.sn){var T=t.cc===i.cc;T&&t.minEndPTS?i.start=t.start+(t.minEndPTS-t.start):i.start=t.start+t.duration}else i.start=Math.max(t.start-i.duration,0)}function C(t,i,p,u,h,T){var g=u-p;g<=0&&(D.logger.warn("Fragment should have a positive duration",i),u=p+i.duration,T=h+i.duration);var f=p,l=u,r=i.startPTS,a=i.endPTS;if(Object(k.isFiniteNumber)(r)){var y=Math.abs(r-p);Object(k.isFiniteNumber)(i.deltaPTS)?i.deltaPTS=Math.max(y,i.deltaPTS):i.deltaPTS=y,f=Math.max(p,r),p=Math.min(p,r),h=Math.min(h,i.startDTS),l=Math.min(u,a),u=Math.max(u,a),T=Math.max(T,i.endDTS)}i.duration=u-p;var E=p-i.start;i.appendedPTS=u,i.start=i.startPTS=p,i.maxStartPTS=f,i.startDTS=h,i.endPTS=u,i.minEndPTS=l,i.endDTS=T;var w=i.sn;if(!t||w<t.startSN||w>t.endSN)return 0;var R,M=w-t.startSN,N=t.fragments;for(N[M]=i,R=M;R>0;R--)A(N[R],N[R-1]);for(R=M;R<N.length-1;R++)A(N[R],N[R+1]);return t.fragmentHint&&A(N[N.length-1],t.fragmentHint),t.PTSKnown=t.alignedSliding=!0,E}function s(t,i){for(var p=null,u=t.fragments,h=u.length-1;h>=0;h--){var T=u[h].initSegment;if(T){p=T;break}}t.fragmentHint&&delete t.fragmentHint.endPTS;var g=0,f;if(b(t,i,function(R,M){R.relurl&&(g=R.cc-M.cc),Object(k.isFiniteNumber)(R.startPTS)&&Object(k.isFiniteNumber)(R.endPTS)&&(M.start=M.startPTS=R.startPTS,M.startDTS=R.startDTS,M.appendedPTS=R.appendedPTS,M.maxStartPTS=R.maxStartPTS,M.endPTS=R.endPTS,M.endDTS=R.endDTS,M.minEndPTS=R.minEndPTS,M.duration=R.endPTS-R.startPTS,M.duration&&(f=M),i.PTSKnown=i.alignedSliding=!0),M.elementaryStreams=R.elementaryStreams,M.loader=R.loader,M.stats=R.stats,M.urlId=R.urlId,R.initSegment&&(M.initSegment=R.initSegment,p=R.initSegment)}),p){var l=i.fragmentHint?i.fragments.concat(i.fragmentHint):i.fragments;l.forEach(function(R){var M;(!R.initSegment||R.initSegment.relurl===((M=p)===null||M===void 0?void 0:M.relurl))&&(R.initSegment=p)})}if(i.skippedSegments&&(i.deltaUpdateFailed=i.fragments.some(function(R){return!R}),i.deltaUpdateFailed)){D.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var r=i.skippedSegments;r--;)i.fragments.shift();i.startSN=i.fragments[0].sn,i.startCC=i.fragments[0].cc}var a=i.fragments;if(g){D.logger.warn("discontinuity sliding from playlist, take drift into account");for(var y=0;y<a.length;y++)a[y].cc+=g}i.skippedSegments&&(i.startCC=i.fragments[0].cc),m(t.partList,i.partList,function(R,M){M.elementaryStreams=R.elementaryStreams,M.stats=R.stats}),f?C(i,f,f.startPTS,f.endPTS,f.startDTS,f.endDTS):c(t,i),a.length&&(i.totalduration=i.edge-a[0].start),i.driftStartTime=t.driftStartTime,i.driftStart=t.driftStart;var E=i.advancedDateTime;if(i.advanced&&E){var w=i.edge;i.driftStart||(i.driftStartTime=E,i.driftStart=w),i.driftEndTime=E,i.driftEnd=w}else i.driftEndTime=t.driftEndTime,i.driftEnd=t.driftEnd,i.advancedDateTime=t.advancedDateTime}function m(t,i,p){if(t&&i)for(var u=0,h=0,T=t.length;h<=T;h++){var g=t[h],f=i[h+u];g&&f&&g.index===f.index&&g.fragment.sn===f.fragment.sn?p(g,f):u--}}function b(t,i,p){for(var u=i.skippedSegments,h=Math.max(t.startSN,i.startSN)-i.startSN,T=(t.fragmentHint?1:0)+(u?i.endSN:Math.min(t.endSN,i.endSN))-i.startSN,g=i.startSN-t.startSN,f=i.fragmentHint?i.fragments.concat(i.fragmentHint):i.fragments,l=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,r=h;r<=T;r++){var a=l[g+r],y=f[r];u&&!y&&r<u&&(y=i.fragments[r]=a),a&&y&&p(a,y)}}function c(t,i){var p=i.startSN+i.skippedSegments-t.startSN,u=t.fragments;if(p<0||p>=u.length)return;v(i,u[p].start)}function v(t,i){if(i){for(var p=t.fragments,u=t.skippedSegments;u<p.length;u++)p[u].start+=i;t.fragmentHint&&(t.fragmentHint.start+=i)}}function x(t,i){var p=1e3*t.levelTargetDuration,u=p/2,h=t.age,T=h>0&&h<p*3,g=i.loading.end-i.loading.start,f,l=t.availabilityDelay;if(t.updated===!1)if(T){var r=333*t.misses;f=Math.max(Math.min(u,g*2),r),t.availabilityDelay=(t.availabilityDelay||0)+f}else f=u;else T?(l=Math.min(l||p/2,h),t.availabilityDelay=l,f=l+p-h):f=p-g;return Math.round(f)}function n(t,i,p){if(!t||!t.details)return null;var u=t.details,h=u.fragments[i-u.startSN];return h||(h=u.fragmentHint,h&&h.sn===i?h:i<u.startSN&&p&&p.sn===i?p:null)}function e(t,i,p){if(!t||!t.details)return null;var u=t.details.partList;if(u)for(var h=u.length;h--;){var T=u[h];if(T.index===p&&T.fragment.sn===i)return T}return null}},"./src/controller/stream-controller.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"default",function(){return u});var k=S("./src/polyfills/number.ts"),D=S("./src/controller/base-stream-controller.ts"),L=S("./src/is-supported.ts"),B=S("./src/events.ts"),_=S("./src/utils/buffer-helper.ts"),A=S("./src/controller/fragment-tracker.ts"),C=S("./src/types/loader.ts"),s=S("./src/loader/fragment.ts"),m=S("./src/demux/transmuxer-interface.ts"),b=S("./src/types/transmuxer.ts"),c=S("./src/controller/gap-controller.ts"),v=S("./src/errors.ts"),x=S("./src/utils/logger.ts");function n(h,T){for(var g=0;g<T.length;g++){var f=T[g];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(h,f.key,f)}}function e(h,T,g){return T&&n(h.prototype,T),g&&n(h,g),h}function t(h,T){h.prototype=Object.create(T.prototype),h.prototype.constructor=h,i(h,T)}function i(h,T){return i=Object.setPrototypeOf||function(f,l){return f.__proto__=l,f},i(h,T)}var p=100,u=function(h){t(T,h);function T(f,l){var r;return r=h.call(this,f,l,"[stream-controller]")||this,r.audioCodecSwap=!1,r.gapController=null,r.level=-1,r._forceStartLoad=!1,r.altAudio=!1,r.audioOnly=!1,r.fragPlaying=null,r.onvplaying=null,r.onvseeked=null,r.fragLastKbps=0,r.stalled=!1,r.couldBacktrack=!1,r.audioCodecSwitch=!1,r.videoBuffer=null,r._registerListeners(),r}var g=T.prototype;return g._registerListeners=function(){var l=this.hls;l.on(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),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_LOADED,this.onLevelLoaded,this),l.on(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),l.on(B.Events.ERROR,this.onError,this),l.on(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),l.on(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),l.on(B.Events.BUFFER_CREATED,this.onBufferCreated,this),l.on(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),l.on(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),l.on(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},g._unregisterListeners=function(){var l=this.hls;l.off(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.off(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),l.off(B.Events.ERROR,this.onError,this),l.off(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),l.off(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),l.off(B.Events.BUFFER_CREATED,this.onBufferCreated,this),l.off(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),l.off(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),l.off(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},g.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},g.startLoad=function(l){if(this.levels){var r=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(p),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var y=a.startLevel;y===-1&&(a.config.testBandwidth?(y=0,this.bitrateTest=!0):y=a.nextAutoLevel),this.level=a.nextLoadLevel=y,this.loadedmetadata=!1}r>0&&l===-1&&(this.log("Override startPosition with lastCurrentTime @"+r.toFixed(3)),l=r),this.state=D.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=l,this.tick()}else this._forceStartLoad=!0,this.state=D.State.STOPPED},g.stopLoad=function(){this._forceStartLoad=!1,h.prototype.stopLoad.call(this)},g.doTick=function(){switch(this.state){case D.State.IDLE:this.doTickIdle();break;case D.State.WAITING_LEVEL:{var l,r=this.levels,a=this.level,y=r==null||((l=r[a])===null||l===void 0)?void 0:l.details;if(y&&(!y.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(y))break;this.state=D.State.IDLE;break}break}case D.State.FRAG_LOADING_WAITING_RETRY:{var E,w=self.performance.now(),R=this.retryDate;(!R||w>=R||(E=this.media)!==null&&E!==void 0&&E.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=D.State.IDLE)}break;default:break}this.onTickEnd()},g.onTickEnd=function(){h.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},g.doTickIdle=function(){var l,r,a=this.hls,y=this.levelLastLoaded,E=this.levels,w=this.media,R=a.config,M=a.nextLoadLevel;if(y===null||!w&&(this.startFragRequested||!R.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!E||!E[M])return;var N=E[M];this.level=a.nextLoadLevel=M;var j=N.details;if(!j||this.state===D.State.WAITING_LEVEL||j.live&&this.levelLastLoaded!==M){this.state=D.State.WAITING_LEVEL;return}var K=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:w,C.PlaylistLevelType.MAIN);if(K===null)return;var V=K.len,z=this.getMaxBufferLength(N.maxBitrate);if(V>=z)return;if(this._streamEnded(K,j)){var Q={};this.altAudio&&(Q.type="video"),this.hls.trigger(B.Events.BUFFER_EOS,Q),this.state=D.State.ENDED;return}var ae=K.end,oe=this.getNextFragment(ae,j);if(this.couldBacktrack&&!this.fragPrevious&&oe&&oe.sn!=="initSegment"){var Ce=oe.sn-j.startSN;Ce>1&&(oe=j.fragments[Ce-1],this.fragmentTracker.removeFragment(oe))}if(oe&&this.fragmentTracker.getState(oe)===A.FragmentState.OK&&this.nextLoadPosition>ae){var he=this.audioOnly&&!this.altAudio?s.ElementaryStreamTypes.AUDIO:s.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(w,he,C.PlaylistLevelType.MAIN),oe=this.getNextFragment(this.nextLoadPosition,j)}if(!oe)return;oe.initSegment&&!oe.initSegment.data&&!this.bitrateTest&&(oe=oe.initSegment),((l=oe.decryptdata)===null||l===void 0?void 0:l.keyFormat)==="identity"&&!((r=oe.decryptdata)!==null&&r!==void 0&&r.key)?this.loadKey(oe,j):this.loadFragment(oe,j,ae)},g.loadFragment=function(l,r,a){var y,E=this.fragmentTracker.getState(l);if(this.fragCurrent=l,E===A.FragmentState.BACKTRACKED){var w=this.fragmentTracker.getBacktrackData(l);if(w){this._handleFragmentLoadProgress(w),this._handleFragmentLoadComplete(w);return}else E=A.FragmentState.NOT_LOADED}E===A.FragmentState.NOT_LOADED||E===A.FragmentState.PARTIAL?l.sn==="initSegment"?this._loadInitSegment(l):this.bitrateTest?(l.bitrateTest=!0,this.log("Fragment "+l.sn+" of level "+l.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(l)):(this.startFragRequested=!0,h.prototype.loadFragment.call(this,l,r,a)):E===A.FragmentState.APPENDING?this.reduceMaxBufferLength(l.duration)&&this.fragmentTracker.removeFragment(l):((y=this.media)===null||y===void 0?void 0:y.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},g.getAppendedFrag=function(l){var r=this.fragmentTracker.getAppendedFrag(l,C.PlaylistLevelType.MAIN);return r&&"fragment"in r?r.fragment:r},g.getBufferedFrag=function(l){return this.fragmentTracker.getBufferedFrag(l,C.PlaylistLevelType.MAIN)},g.followingBufferedFrag=function(l){return l?this.getBufferedFrag(l.end+.5):null},g.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},g.nextLevelSwitch=function(){var l=this.levels,r=this.media;if(r!=null&&r.readyState){var a,y=this.getAppendedFrag(r.currentTime);if(y&&y.start>1&&this.flushMainBuffer(0,y.start-1),!r.paused&&l){var E=this.hls.nextLoadLevel,w=l[E],R=this.fragLastKbps;R&&this.fragCurrent?a=this.fragCurrent.duration*w.maxBitrate/(1e3*R)+1:a=0}else a=0;var M=this.getBufferedFrag(r.currentTime+a);if(M){var N=this.followingBufferedFrag(M);if(N){this.abortCurrentFrag();var j=N.maxStartPTS?N.maxStartPTS:N.start,K=N.duration,V=Math.max(M.end,j+Math.min(Math.max(K-this.config.maxFragLookUpTolerance,K*.5),K*.75));this.flushMainBuffer(V,Number.POSITIVE_INFINITY)}}}},g.abortCurrentFrag=function(){var l=this.fragCurrent;this.fragCurrent=null,l!=null&&l.loader&&l.loader.abort(),this.state===D.State.KEY_LOADING&&(this.state=D.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},g.flushMainBuffer=function(l,r){h.prototype.flushMainBuffer.call(this,l,r,this.altAudio?"video":null)},g.onMediaAttached=function(l,r){h.prototype.onMediaAttached.call(this,l,r);var a=r.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new c.default(this.config,a,this.fragmentTracker,this.hls)},g.onMediaDetaching=function(){var l=this.media;l&&(l.removeEventListener("playing",this.onvplaying),l.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),h.prototype.onMediaDetaching.call(this)},g.onMediaPlaying=function(){this.tick()},g.onMediaSeeked=function(){var l=this.media,r=l?l.currentTime:null;Object(k.isFiniteNumber)(r)&&this.log("Media seeked to "+r.toFixed(3)),this.tick()},g.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(B.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},g.onManifestParsed=function(l,r){var a=!1,y=!1,E;r.levels.forEach(function(w){E=w.audioCodec,E&&(E.indexOf("mp4a.40.2")!==-1&&(a=!0),E.indexOf("mp4a.40.5")!==-1&&(y=!0))}),this.audioCodecSwitch=a&&y&&!Object(L.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=r.levels,this.startFragRequested=!1},g.onLevelLoading=function(l,r){var a=this.levels;if(!a||this.state!==D.State.IDLE)return;var y=a[r.level];(!y.details||y.details.live&&this.levelLastLoaded!==r.level||this.waitForCdnTuneIn(y.details))&&(this.state=D.State.WAITING_LEVEL)},g.onLevelLoaded=function(l,r){var a,y=this.levels,E=r.level,w=r.details,R=w.totalduration;if(!y){this.warn("Levels were reset while loading level "+E);return}this.log("Level "+E+" loaded ["+w.startSN+","+w.endSN+"], cc ["+w.startCC+", "+w.endCC+"] duration:"+R);var M=this.fragCurrent;M&&(this.state===D.State.FRAG_LOADING||this.state===D.State.FRAG_LOADING_WAITING_RETRY)&&(M.level!==r.level&&M.loader&&(this.state=D.State.IDLE,M.loader.abort()));var N=y[E],j=0;if(w.live||(a=N.details)!==null&&a!==void 0&&a.live){if(w.fragments[0]||(w.deltaUpdateFailed=!0),w.deltaUpdateFailed)return;j=this.alignPlaylists(w,N.details)}if(N.details=w,this.levelLastLoaded=E,this.hls.trigger(B.Events.LEVEL_UPDATED,{details:w,level:E}),this.state===D.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(w))return;this.state=D.State.IDLE}this.startFragRequested?w.live&&this.synchronizeToLiveEdge(w):this.setStartPosition(w,j),this.tick()},g._handleFragmentLoadProgress=function(l){var r,a=l.frag,y=l.part,E=l.payload,w=this.levels;if(!w){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var R=w[a.level],M=R.details;if(!M){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var N=R.videoCodec,j=M.PTSKnown||!M.live,K=(r=a.initSegment)===null||r===void 0?void 0:r.data,V=this._getAudioCodec(R),z=this.transmuxer=this.transmuxer||new m.default(this.hls,C.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),Q=y?y.index:-1,ae=Q!==-1,oe=new b.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,E.byteLength,Q,ae),Ce=this.initPTS[a.cc];z.push(E,K,V,N,a,y,M.totalduration,j,oe,Ce)},g.onAudioTrackSwitching=function(l,r){var a=this.altAudio,y=!!r.url,E=r.id;if(!y){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var w=this.fragCurrent;w!=null&&w.loader&&(this.log("Switching to main audio track, cancel main fragment load"),w.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var R=this.hls;a&&R.trigger(B.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),R.trigger(B.Events.AUDIO_TRACK_SWITCHED,{id:E})}},g.onAudioTrackSwitched=function(l,r){var a=r.id,y=!!this.hls.audioTracks[a].url;if(y){var E=this.videoBuffer;E&&this.mediaBuffer!==E&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=E)}this.altAudio=y,this.tick()},g.onBufferCreated=function(l,r){var a=r.tracks,y,E,w=!1;for(var R in a){var M=a[R];if(M.id==="main"){if(E=R,y=M,R==="video"){var N=a[R];N&&(this.videoBuffer=N.buffer)}}else w=!0}w&&y?(this.log("Alternate track found, use "+E+".buffered to schedule main fragment loading"),this.mediaBuffer=y.buffer):this.mediaBuffer=this.media},g.onFragBuffered=function(l,r){var a=r.frag,y=r.part;if(a&&a.type!==C.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(y?" p: "+y.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===D.State.PARSED&&(this.state=D.State.IDLE);return}var E=y?y.stats:a.stats;this.fragLastKbps=Math.round(8*E.total/(E.buffering.end-E.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,y)},g.onError=function(l,r){switch(r.details){case v.ErrorDetails.FRAG_LOAD_ERROR:case v.ErrorDetails.FRAG_LOAD_TIMEOUT:case v.ErrorDetails.KEY_LOAD_ERROR:case v.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(C.PlaylistLevelType.MAIN,r);break;case v.ErrorDetails.LEVEL_LOAD_ERROR:case v.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==D.State.ERROR&&(r.fatal?(this.warn(""+r.details),this.state=D.State.ERROR):!r.levelRetry&&this.state===D.State.WAITING_LEVEL&&(this.state=D.State.IDLE));break;case v.ErrorDetails.BUFFER_FULL_ERROR:if(r.parent==="main"&&(this.state===D.State.PARSING||this.state===D.State.PARSED)){var a=!0,y=this.getFwdBufferInfo(this.media,C.PlaylistLevelType.MAIN);y&&y.len>.5&&(a=!this.reduceMaxBufferLength(y.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},g.checkBuffer=function(){var l=this.media,r=this.gapController;if(!l||!r||!l.readyState)return;var a=_.BufferHelper.getBuffered(l);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):r.poll(this.lastCurrentTime),this.lastCurrentTime=l.currentTime},g.onFragLoadEmergencyAborted=function(){this.state=D.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},g.onBufferFlushed=function(l,r){var a=r.type;if(a!==s.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var y=(a===s.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(y,a,C.PlaylistLevelType.MAIN)}},g.onLevelsUpdated=function(l,r){this.levels=r.levels},g.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},g.seekToStartPos=function(){var l=this.media,r=l.currentTime,a=this.startPosition;if(a>=0&&r<a){if(l.seeking){x.logger.log("could not seek to "+a+", already seeking at "+r);return}var y=_.BufferHelper.getBuffered(l),E=y.length?y.start(0):0,w=E-a;w>0&&(w<this.config.maxBufferHole||w<this.config.maxFragLookUpTolerance)&&(x.logger.log("adjusting start position by "+w+" to match buffer start"),a+=w,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+r),l.currentTime=a}},g._getAudioCodec=function(l){var r=this.config.defaultAudioCodec||l.audioCodec;return this.audioCodecSwap&&r&&(this.log("Swapping audio codec"),r.indexOf("mp4a.40.5")!==-1?r="mp4a.40.2":r="mp4a.40.5"),r},g._loadBitrateTestFrag=function(l){var r=this;this._doFragLoad(l).then(function(a){var y=r.hls;if(!a||y.nextLoadLevel||r.fragContextChanged(l))return;r.fragLoadError=0,r.state=D.State.IDLE,r.startFragRequested=!1,r.bitrateTest=!1;var E=l.stats;E.parsing.start=E.parsing.end=E.buffering.start=E.buffering.end=self.performance.now(),y.trigger(B.Events.FRAG_LOADED,a)})},g._handleTransmuxComplete=function(l){var r,a="main",y=this.hls,E=l.remuxResult,w=l.chunkMeta,R=this.getCurrentContext(w);if(!R){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 M=R.frag,N=R.part,j=R.level,K=E.video,V=E.text,z=E.id3,Q=E.initSegment,ae=this.altAudio?void 0:E.audio;if(this.fragContextChanged(M))return;if(this.state=D.State.PARSING,Q){Q.tracks&&(this._bufferInitSegment(j,Q.tracks,M,w),y.trigger(B.Events.FRAG_PARSING_INIT_SEGMENT,{frag:M,id:a,tracks:Q.tracks}));var oe=Q.initPTS,Ce=Q.timescale;Object(k.isFiniteNumber)(oe)&&(this.initPTS[M.cc]=oe,y.trigger(B.Events.INIT_PTS_FOUND,{frag:M,id:a,initPTS:oe,timescale:Ce}))}if(K&&E.independent!==!1){if(j.details){var he=K.startPTS,fe=K.endPTS,pe=K.startDTS,me=K.endDTS;if(N)N.elementaryStreams[K.type]={startPTS:he,endPTS:fe,startDTS:pe,endDTS:me};else if(K.firstKeyFrame&&K.independent&&(this.couldBacktrack=!0),K.dropped&&K.independent){var ie=this.getLoadPosition()+this.config.maxBufferHole;if(ie<he){this.backtrack(M);return}M.setElementaryStreamInfo(K.type,M.start,fe,M.start,me,!0)}M.setElementaryStreamInfo(K.type,he,fe,pe,me),this.bufferFragmentData(K,M,N,w)}}else if(E.independent===!1){this.backtrack(M);return}if(ae){var J=ae.startPTS,ye=ae.endPTS,Pe=ae.startDTS,Le=ae.endDTS;N&&(N.elementaryStreams[s.ElementaryStreamTypes.AUDIO]={startPTS:J,endPTS:ye,startDTS:Pe,endDTS:Le}),M.setElementaryStreamInfo(s.ElementaryStreamTypes.AUDIO,J,ye,Pe,Le),this.bufferFragmentData(ae,M,N,w)}if(z!=null&&(r=z.samples)!==null&&r!==void 0&&r.length){var Re={frag:M,id:a,samples:z.samples};y.trigger(B.Events.FRAG_PARSING_METADATA,Re)}if(V){var X={frag:M,id:a,samples:V.samples};y.trigger(B.Events.FRAG_PARSING_USERDATA,X)}},g._bufferInitSegment=function(l,r,a,y){var E=this;if(this.state!==D.State.PARSING)return;this.audioOnly=!!r.audio&&!r.video,this.altAudio&&!this.audioOnly&&delete r.audio;var w=r.audio,R=r.video,M=r.audiovideo;if(w){var N=l.audioCodec,j=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(N&&(N.indexOf("mp4a.40.5")!==-1?N="mp4a.40.2":N="mp4a.40.5"),w.metadata.channelCount!==1&&j.indexOf("firefox")===-1&&(N="mp4a.40.5")),j.indexOf("android")!==-1&&w.container!=="audio/mpeg"&&(N="mp4a.40.2",this.log("Android: force audio codec to "+N)),l.audioCodec&&l.audioCodec!==N&&this.log('Swapping manifest audio codec "'+l.audioCodec+'" for "'+N+'"'),w.levelCodec=N,w.id="main",this.log("Init audio buffer, container:"+w.container+", codecs[selected/level/parsed]=["+(N||"")+"/"+(l.audioCodec||"")+"/"+w.codec+"]")}R&&(R.levelCodec=l.videoCodec,R.id="main",this.log("Init video buffer, container:"+R.container+", codecs[level/parsed]=["+(l.videoCodec||"")+"/"+R.codec+"]")),M&&this.log("Init audiovideo buffer, container:"+M.container+", codecs[level/parsed]=["+(l.attrs.CODECS||"")+"/"+M.codec+"]"),this.hls.trigger(B.Events.BUFFER_CODECS,r),Object.keys(r).forEach(function(K){var V=r[K],z=V.initSegment;z!=null&&z.byteLength&&E.hls.trigger(B.Events.BUFFER_APPENDING,{type:K,data:z,frag:a,part:null,chunkMeta:y,parent:a.type})}),this.tick()},g.backtrack=function(l){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(l);var r=this.fragmentTracker.backtrack(l);this.fragPrevious=null,this.nextLoadPosition=l.start,r?this.resetFragmentLoading(l):this.state=D.State.BACKTRACKING},g.checkFragmentChanged=function(){var l=this.media,r=null;if(l&&l.readyState>1&&l.seeking===!1){var a=l.currentTime;if(_.BufferHelper.isBuffered(l,a)?r=this.getAppendedFrag(a):_.BufferHelper.isBuffered(l,a+.1)&&(r=this.getAppendedFrag(a+.1)),r){var y=this.fragPlaying,E=r.level;(!y||r.sn!==y.sn||y.level!==E||r.urlId!==y.urlId)&&(this.hls.trigger(B.Events.FRAG_CHANGED,{frag:r}),(!y||y.level!==E)&&this.hls.trigger(B.Events.LEVEL_SWITCHED,{level:E}),this.fragPlaying=r)}}},e(T,[{key:"nextLevel",get:function(){var l=this.nextBufferedFrag;return l?l.level:-1}},{key:"currentLevel",get:function(){var l=this.media;if(l){var r=this.getAppendedFrag(l.currentTime);if(r)return r.level}return-1}},{key:"nextBufferedFrag",get:function(){var l=this.media;if(l){var r=this.getAppendedFrag(l.currentTime);return this.followingBufferedFrag(r)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),T}(D.default)},"./src/controller/subtitle-stream-controller.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"SubtitleStreamController",function(){return t});var k=S("./src/events.ts"),D=S("./src/utils/logger.ts"),L=S("./src/utils/buffer-helper.ts"),B=S("./src/controller/fragment-finders.ts"),_=S("./src/utils/discontinuities.ts"),A=S("./src/controller/level-helper.ts"),C=S("./src/controller/fragment-tracker.ts"),s=S("./src/controller/base-stream-controller.ts"),m=S("./src/types/loader.ts"),b=S("./src/types/level.ts");function c(i,p){for(var u=0;u<p.length;u++){var h=p[u];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(i,h.key,h)}}function v(i,p,u){return p&&c(i.prototype,p),u&&c(i,u),i}function x(i,p){i.prototype=Object.create(p.prototype),i.prototype.constructor=i,n(i,p)}function n(i,p){return n=Object.setPrototypeOf||function(h,T){return h.__proto__=T,h},n(i,p)}var e=500,t=function(i){x(p,i);function p(h,T){var g;return g=i.call(this,h,T,"[subtitle-stream-controller]")||this,g.levels=[],g.currentTrackId=-1,g.tracksBuffered=[],g.mainDetails=null,g._registerListeners(),g}var u=p.prototype;return u.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},u._registerListeners=function(){var T=this.hls;T.on(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),T.on(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),T.on(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),T.on(k.Events.LEVEL_LOADED,this.onLevelLoaded,this),T.on(k.Events.ERROR,this.onError,this),T.on(k.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),T.on(k.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),T.on(k.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),T.on(k.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),T.on(k.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},u._unregisterListeners=function(){var T=this.hls;T.off(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),T.off(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),T.off(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),T.off(k.Events.LEVEL_LOADED,this.onLevelLoaded,this),T.off(k.Events.ERROR,this.onError,this),T.off(k.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),T.off(k.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),T.off(k.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),T.off(k.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),T.off(k.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},u.startLoad=function(){this.stopLoad(),this.state=s.State.IDLE,this.setInterval(e),this.tick()},u.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},u.onLevelLoaded=function(T,g){this.mainDetails=g.details},u.onSubtitleFragProcessed=function(T,g){var f=g.frag,l=g.success;if(this.fragPrevious=f,this.state=s.State.IDLE,!l)return;var r=this.tracksBuffered[this.currentTrackId];if(!r)return;for(var a,y=f.start,E=0;E<r.length;E++)if(y>=r[E].start&&y<=r[E].end){a=r[E];break}var w=f.start+f.duration;a?a.end=w:(a={start:y,end:w},r.push(a)),this.fragmentTracker.fragBuffered(f)},u.onBufferFlushing=function(T,g){var f=g.startOffset,l=g.endOffset;if(f===0&&l!==Number.POSITIVE_INFINITY){var r=this.currentTrackId,a=this.levels;if(!a.length||!a[r]||!a[r].details)return;var y=a[r].details,E=y.targetduration,w=l-E;if(w<=0)return;g.endOffsetSubtitles=Math.max(0,w),this.tracksBuffered.forEach(function(R){for(var M=0;M<R.length;){if(R[M].end<=w){R.shift();continue}else if(R[M].start<w)R[M].start=w;else break;M++}}),this.fragmentTracker.removeFragmentsInRange(f,w,m.PlaylistLevelType.SUBTITLE)}},u.onError=function(T,g){var f,l=g.frag;if(!l||l.type!==m.PlaylistLevelType.SUBTITLE)return;(f=this.fragCurrent)!==null&&f!==void 0&&f.loader&&this.fragCurrent.loader.abort(),this.state=s.State.IDLE},u.onSubtitleTracksUpdated=function(T,g){var f=this,l=g.subtitleTracks;this.tracksBuffered=[],this.levels=l.map(function(r){return new b.Level(r)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(r){f.tracksBuffered[r.id]=[]}),this.mediaBuffer=null},u.onSubtitleTrackSwitch=function(T,g){if(this.currentTrackId=g.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var f=this.levels[this.currentTrackId];f!=null&&f.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,f&&this.setInterval(e)},u.onSubtitleTrackLoaded=function(T,g){var f,l=g.details,r=g.id,a=this.currentTrackId,y=this.levels;if(!y.length)return;var E=y[a];if(r>=y.length||r!==a||!E)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,l.live||(f=E.details)!==null&&f!==void 0&&f.live){var w=this.mainDetails;if(l.deltaUpdateFailed||!w)return;var R=w.fragments[0];if(!E.details)l.hasProgramDateTime&&w.hasProgramDateTime?Object(_.alignMediaPlaylistByPDT)(l,w):R&&Object(A.addSliding)(l,R.start);else{var M=this.alignPlaylists(l,E.details);M===0&&R&&Object(A.addSliding)(l,R.start)}}if(E.details=l,this.levelLastLoaded=r,this.tick(),l.live&&!this.fragCurrent&&this.media&&this.state===s.State.IDLE){var N=Object(B.findFragmentByPTS)(null,l.fragments,this.media.currentTime,0);N||(this.warn("Subtitle playlist not aligned with playback"),E.details=void 0)}},u._handleFragmentLoadComplete=function(T){var g=T.frag,f=T.payload,l=g.decryptdata,r=this.hls;if(this.fragContextChanged(g))return;if(f&&f.byteLength>0&&l&&l.key&&l.iv&&l.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(f),l.key.buffer,l.iv.buffer).then(function(y){var E=performance.now();r.trigger(k.Events.FRAG_DECRYPTED,{frag:g,payload:y,stats:{tstart:a,tdecrypt:E}})})}},u.doTick=function(){if(!this.media){this.state=s.State.IDLE;return}if(this.state===s.State.IDLE){var T,g=this.currentTrackId,f=this.levels;if(!f.length||!f[g]||!f[g].details)return;var l=f[g].details,r=l.targetduration,a=this.config,y=this.media,E=L.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,y.currentTime-r,a.maxBufferHole),w=E.end,R=E.len,M=this.getMaxBufferLength()+r;if(R>M)return;console.assert(l,"Subtitle track details are defined on idle subtitle stream controller tick");var N=l.fragments,j=N.length,K=l.edge,V,z=this.fragPrevious;if(w<K){var Q=a.maxFragLookUpTolerance;z&&l.hasProgramDateTime&&(V=Object(B.findFragmentByPDT)(N,z.endProgramDateTime,Q)),V||(V=Object(B.findFragmentByPTS)(z,N,w,Q),!V&&z&&z.start<N[0].start&&(V=N[0]))}else V=N[j-1];(T=V)!==null&&T!==void 0&&T.encrypted?(D.logger.log("Loading key for "+V.sn),this.state=s.State.KEY_LOADING,this.hls.trigger(k.Events.KEY_LOADING,{frag:V})):V&&this.fragmentTracker.getState(V)===C.FragmentState.NOT_LOADED&&this.loadFragment(V,l,w)}},u.loadFragment=function(T,g,f){this.fragCurrent=T,i.prototype.loadFragment.call(this,T,g,f)},v(p,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),p}(s.default)},"./src/controller/subtitle-track-controller.ts":function(se,U,S){"use strict";S.r(U);var k=S("./src/events.ts"),D=S("./src/utils/texttrack-utils.ts"),L=S("./src/controller/base-playlist-controller.ts"),B=S("./src/types/loader.ts");function _(c,v){for(var x=0;x<v.length;x++){var n=v[x];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(c,n.key,n)}}function A(c,v,x){return v&&_(c.prototype,v),x&&_(c,x),c}function C(c,v){c.prototype=Object.create(v.prototype),c.prototype.constructor=c,s(c,v)}function s(c,v){return s=Object.setPrototypeOf||function(n,e){return n.__proto__=e,n},s(c,v)}var m=function(c){C(v,c);function v(n){var e;return e=c.call(this,n,"[subtitle-track-controller]")||this,e.media=null,e.tracks=[],e.groupId=null,e.tracksInGroup=[],e.trackId=-1,e.selectDefaultTrack=!0,e.queuedDefaultTrack=-1,e.trackChangeListener=function(){return e.onTextTracksChanged()},e.asyncPollTrackChange=function(){return e.pollTrackChange(0)},e.useTextTrackPolling=!1,e.subtitlePollingInterval=-1,e.subtitleDisplay=!0,e.registerListeners(),e}var x=v.prototype;return x.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,c.prototype.destroy.call(this)},x.registerListeners=function(){var e=this.hls;e.on(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(k.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(k.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(k.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(k.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(k.Events.ERROR,this.onError,this)},x.unregisterListeners=function(){var e=this.hls;e.off(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(k.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(k.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(k.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(k.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(k.Events.ERROR,this.onError,this)},x.onMediaAttached=function(e,t){if(this.media=t.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(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,e)},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 e=b(this.media.textTracks);e.forEach(function(t){Object(D.clearCurrentCues)(t)}),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(e,t){this.tracks=t.subtitleTracks},x.onSubtitleTrackLoaded=function(e,t){var i=t.id,p=t.details,u=this.trackId,h=this.tracksInGroup[u];if(!h){this.warn("Invalid subtitle track id "+i);return}var T=h.details;h.details=t.details,this.log("subtitle track "+i+" loaded ["+p.startSN+"-"+p.endSN+"]"),i===this.trackId&&(this.retryCount=0,this.playlistLoaded(i,t,T))},x.onLevelLoading=function(e,t){this.switchLevel(t.level)},x.onLevelSwitching=function(e,t){this.switchLevel(t.level)},x.switchLevel=function(e){var t=this.hls.levels[e];if(!(t!=null&&t.textGroupIds))return;var i=t.textGroupIds[t.urlId];if(this.groupId!==i){var p=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,u=this.tracks.filter(function(g){return!i||g.groupId===i});this.tracksInGroup=u;var h=this.findTrackId(p==null?void 0:p.name)||this.findTrackId();this.groupId=i;var T={subtitleTracks:u};this.log("Updating subtitle tracks, "+u.length+' track(s) found in "'+i+'" group-id'),this.hls.trigger(k.Events.SUBTITLE_TRACKS_UPDATED,T),h!==-1&&this.setSubtitleTrack(h,p)}},x.findTrackId=function(e){for(var t=this.tracksInGroup,i=0;i<t.length;i++){var p=t[i];if((!this.selectDefaultTrack||p.default)&&(!e||e===p.name))return p.id}return-1},x.onError=function(e,t){if(c.prototype.onError.call(this,e,t),t.fatal||!t.context)return;t.context.type===B.PlaylistContextType.SUBTITLE_TRACK&&t.context.id===this.trackId&&t.context.groupId===this.groupId&&this.retryLoadingOrFail(t)},x.loadPlaylist=function(e){var t=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(t)){var i=t.id,p=t.groupId,u=t.url;if(e)try{u=e.addDirectives(u)}catch(h){this.warn("Could not construct new URL with HLS Delivery Directives: "+h)}this.log("Loading subtitle playlist for id "+i),this.hls.trigger(k.Events.SUBTITLE_TRACK_LOADING,{url:u,id:i,groupId:p,deliveryDirectives:e||null})}},x.toggleTrackModes=function(e){var t=this,i=this.media,p=this.subtitleDisplay,u=this.trackId;if(!i)return;var h=b(i.textTracks),T=h.filter(function(l){return l.groupId===t.groupId});if(e===-1)[].slice.call(h).forEach(function(l){l.mode="disabled"});else{var g=T[u];g&&(g.mode="disabled")}var f=T[e];f&&(f.mode=p?"showing":"hidden")},x.setSubtitleTrack=function(e,t){var i,p=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(this.trackId!==e&&this.toggleTrackModes(e),this.trackId===e&&(e===-1||(i=p[e])!==null&&i!==void 0&&i.details)||e<-1||e>=p.length)return;this.clearTimer();var u=p[e];if(this.log("Switching to subtitle track "+e),this.trackId=e,u){var h=u.id,T=u.groupId,g=T===void 0?"":T,f=u.name,l=u.type,r=u.url;this.hls.trigger(k.Events.SUBTITLE_TRACK_SWITCH,{id:h,groupId:g,name:f,type:l,url:r});var a=this.switchParams(u.url,t==null?void 0:t.details);this.loadPlaylist(a)}else this.hls.trigger(k.Events.SUBTITLE_TRACK_SWITCH,{id:e})},x.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var e=-1,t=b(this.media.textTracks),i=0;i<t.length;i++)if(t[i].mode==="hidden")e=i;else if(t[i].mode==="showing"){e=i;break}this.subtitleTrack!==e&&(this.subtitleTrack=e)},A(v,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(e){this.selectDefaultTrack=!1;var t=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(e,t)}}]),v}(L.default);function b(c){for(var v=[],x=0;x<c.length;x++){var n=c[x];n.kind==="subtitles"&&n.label&&v.push(c[x])}return v}U.default=m},"./src/controller/timeline-controller.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"TimelineController",function(){return b});var k=S("./src/polyfills/number.ts"),D=S("./src/events.ts"),L=S("./src/utils/cea-608-parser.ts"),B=S("./src/utils/output-filter.ts"),_=S("./src/utils/webvtt-parser.ts"),A=S("./src/utils/texttrack-utils.ts"),C=S("./src/utils/imsc1-ttml-parser.ts"),s=S("./src/types/loader.ts"),m=S("./src/utils/logger.ts"),b=function(){function n(t){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=t,this.config=t.config,this.Cues=t.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var i=new B.default(this,"textTrack1"),p=new B.default(this,"textTrack2"),u=new B.default(this,"textTrack3"),h=new B.default(this,"textTrack4");this.cea608Parser1=new L.default(1,i,p),this.cea608Parser2=new L.default(3,u,h)}t.on(D.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(D.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(D.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(D.Events.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(D.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(D.Events.FRAG_LOADING,this.onFragLoading,this),t.on(D.Events.FRAG_LOADED,this.onFragLoaded,this),t.on(D.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.on(D.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),t.on(D.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(D.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.on(D.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var e=n.prototype;return e.destroy=function(){var i=this.hls;i.off(D.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),i.off(D.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.off(D.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.off(D.Events.MANIFEST_LOADED,this.onManifestLoaded,this),i.off(D.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),i.off(D.Events.FRAG_LOADING,this.onFragLoading,this),i.off(D.Events.FRAG_LOADED,this.onFragLoaded,this),i.off(D.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),i.off(D.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),i.off(D.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),i.off(D.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),i.off(D.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},e.addCues=function(i,p,u,h,T){for(var g=!1,f=T.length;f--;){var l=T[f],r=v(l[0],l[1],p,u);if(r>=0&&(l[0]=Math.min(l[0],p),l[1]=Math.max(l[1],u),g=!0,r/(u-p)>.5))return}if(g||T.push([p,u]),this.config.renderTextTracksNatively){var a=this.captionsTracks[i];this.Cues.newCue(a,p,u,h)}else{var y=this.Cues.newCue(null,p,u,h);this.hls.trigger(D.Events.CUES_PARSED,{type:"captions",cues:y,track:i})}},e.onInitPtsFound=function(i,p){var u=this,h=p.frag,T=p.id,g=p.initPTS,f=p.timescale,l=this.unparsedVttFrags;T==="main"&&(this.initPTS[h.cc]=g,this.timescale[h.cc]=f),l.length&&(this.unparsedVttFrags=[],l.forEach(function(r){u.onFragLoaded(D.Events.FRAG_LOADED,r)}))},e.getExistingTrack=function(i){var p=this.media;if(p)for(var u=0;u<p.textTracks.length;u++){var h=p.textTracks[u];if(h[i])return h}return null},e.createCaptionsTrack=function(i){this.config.renderTextTracksNatively?this.createNativeTrack(i):this.createNonNativeTrack(i)},e.createNativeTrack=function(i){if(this.captionsTracks[i])return;var p=this.captionsProperties,u=this.captionsTracks,h=this.media,T=p[i],g=T.label,f=T.languageCode,l=this.getExistingTrack(i);if(l)u[i]=l,Object(A.clearCurrentCues)(u[i]),Object(A.sendAddTrackEvent)(u[i],h);else{var r=this.createTextTrack("captions",g,f);r&&(r[i]=!0,u[i]=r)}},e.createNonNativeTrack=function(i){if(this.nonNativeCaptionsTracks[i])return;var p=this.captionsProperties[i];if(!p)return;var u=p.label,h={_id:i,label:u,kind:"captions",default:p.media?!!p.media.default:!1,closedCaptions:p.media};this.nonNativeCaptionsTracks[i]=h,this.hls.trigger(D.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[h]})},e.createTextTrack=function(i,p,u){var h=this.media;return h?h.addTextTrack(i,p,u):void 0},e.onMediaAttaching=function(i,p){this.media=p.media,this._cleanTracks()},e.onMediaDetaching=function(){var i=this.captionsTracks;Object.keys(i).forEach(function(p){Object(A.clearCurrentCues)(i[p]),delete i[p]}),this.nonNativeCaptionsTracks={}},e.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())},e._cleanTracks=function(){var i=this.media;if(!i)return;var p=i.textTracks;if(p)for(var u=0;u<p.length;u++)Object(A.clearCurrentCues)(p[u])},e.onSubtitleTracksUpdated=function(i,p){var u=this;this.textTracks=[];var h=p.subtitleTracks||[],T=h.some(function(r){return r.textCodec===C.IMSC1_CODEC});if(this.config.enableWebVTT||T&&this.config.enableIMSC1){var g=this.tracks&&h&&this.tracks.length===h.length;if(this.tracks=h||[],this.config.renderTextTracksNatively){var f=this.media?this.media.textTracks:[];this.tracks.forEach(function(r,a){var y;if(a<f.length){for(var E=null,w=0;w<f.length;w++)if(c(f[w],r)){E=f[w];break}E&&(y=E)}y?Object(A.clearCurrentCues)(y):(y=u.createTextTrack("subtitles",r.name,r.lang),y&&(y.mode="disabled")),y&&(y.groupId=r.groupId,u.textTracks.push(y))})}else if(!g&&this.tracks&&this.tracks.length){var l=this.tracks.map(function(r){return{label:r.name,kind:r.type.toLowerCase(),default:r.default,subtitleTrack:r}});this.hls.trigger(D.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:l})}}},e.onManifestLoaded=function(i,p){var u=this;this.config.enableCEA708Captions&&p.captions&&p.captions.forEach(function(h){var T=/(?:CC|SERVICE)([1-4])/.exec(h.instreamId);if(!T)return;var g="textTrack"+T[1],f=u.captionsProperties[g];if(!f)return;f.label=h.name,h.lang&&(f.languageCode=h.lang),f.media=h})},e.onFragLoading=function(i,p){var u=this.cea608Parser1,h=this.cea608Parser2,T=this.lastSn,g=this.lastPartIndex;if(!this.enabled||!(u&&h))return;if(p.frag.type===s.PlaylistLevelType.MAIN){var f,l,r=p.frag.sn,a=(f=p==null||((l=p.part)===null||l===void 0)?void 0:l.index)!=null?f:-1;r===T+1||r===T&&a===g+1||(u.reset(),h.reset()),this.lastSn=r,this.lastPartIndex=a}},e.onFragLoaded=function(i,p){var u=p.frag,h=p.payload,T=this.initPTS,g=this.unparsedVttFrags;if(u.type===s.PlaylistLevelType.SUBTITLE)if(h.byteLength){if(!Object(k.isFiniteNumber)(T[u.cc])){g.push(p),T.length&&this.hls.trigger(D.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:new Error("Missing initial subtitle PTS")});return}var f=u.decryptdata;if(f==null||f.key==null||f.method!=="AES-128"){var l=this.tracks[u.level],r=this.vttCCs;r[u.cc]||(r[u.cc]={start:u.start,prevCC:this.prevCC,new:!0},this.prevCC=u.cc),l&&l.textCodec===C.IMSC1_CODEC?this._parseIMSC1(u,h):this._parseVTTs(u,h,r)}}else this.hls.trigger(D.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:new Error("Empty subtitle payload")})},e._parseIMSC1=function(i,p){var u=this,h=this.hls;Object(C.parseIMSC1)(p,this.initPTS[i.cc],this.timescale[i.cc],function(T){u._appendCues(T,i.level),h.trigger(D.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},function(T){m.logger.log("Failed to parse IMSC1: "+T),h.trigger(D.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:T})})},e._parseVTTs=function(i,p,u){var h=this,T=this.hls;Object(_.parseWebVTT)(p,this.initPTS[i.cc],this.timescale[i.cc],u,i.cc,i.start,function(g){h._appendCues(g,i.level),T.trigger(D.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},function(g){h._fallbackToIMSC1(i,p),m.logger.log("Failed to parse VTT cue: "+g),T.trigger(D.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:g})})},e._fallbackToIMSC1=function(i,p){var u=this,h=this.tracks[i.level];h.textCodec||Object(C.parseIMSC1)(p,this.initPTS[i.cc],this.timescale[i.cc],function(){h.textCodec=C.IMSC1_CODEC,u._parseIMSC1(i,p)},function(){h.textCodec="wvtt"})},e._appendCues=function(i,p){var u=this.hls;if(this.config.renderTextTracksNatively){var h=this.textTracks[p];if(h.mode==="disabled")return;i.forEach(function(f){return Object(A.addCueToTrack)(h,f)})}else{var T=this.tracks[p],g=T.default?"default":"subtitles"+p;u.trigger(D.Events.CUES_PARSED,{type:"subtitles",cues:i,track:g})}},e.onFragDecrypted=function(i,p){var u=p.frag;if(u.type===s.PlaylistLevelType.SUBTITLE){if(!Object(k.isFiniteNumber)(this.initPTS[u.cc])){this.unparsedVttFrags.push(p);return}this.onFragLoaded(D.Events.FRAG_LOADED,p)}},e.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},e.onFragParsingUserdata=function(i,p){var u=this.cea608Parser1,h=this.cea608Parser2;if(!this.enabled||!(u&&h))return;for(var T=0;T<p.samples.length;T++){var g=p.samples[T].bytes;if(g){var f=this.extractCea608Data(g);u.addData(p.samples[T].pts,f[0]),h.addData(p.samples[T].pts,f[1])}}},e.onBufferFlushing=function(i,p){var u=p.startOffset,h=p.endOffset,T=p.endOffsetSubtitles,g=p.type,f=this.media;if(!f||f.currentTime<h)return;if(!g||g==="video"){var l=this.captionsTracks;Object.keys(l).forEach(function(a){return Object(A.removeCuesInRange)(l[a],u,h)})}if(this.config.renderTextTracksNatively&&(u===0&&T!==void 0)){var r=this.textTracks;Object.keys(r).forEach(function(a){return Object(A.removeCuesInRange)(r[a],u,T)})}},e.extractCea608Data=function(i){for(var p=i[0]&31,u=2,h=[[],[]],T=0;T<p;T++){var g=i[u++],f=127&i[u++],l=127&i[u++],r=(4&g)!==0,a=3&g;if(f===0&&l===0)continue;r&&((a===0||a===1)&&(h[a].push(f),h[a].push(l)))}return h},n}();function c(n,e){return n&&n.label===e.name&&!(n.textTrack1||n.textTrack2)}function v(n,e,t,i){return Math.min(e,i)-Math.max(n,t)}function x(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"default",function(){return k});var k=function(){function D(B,_){this.subtle=void 0,this.aesIV=void 0,this.subtle=B,this.aesIV=_}var L=D.prototype;return L.decrypt=function(_,A){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},A,_)},D}()},"./src/crypt/aes-decryptor.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"removePadding",function(){return D}),S.d(U,"default",function(){return L});var k=S("./src/utils/typed-array.ts");function D(B){var _=B.byteLength,A=_&&new DataView(B.buffer).getUint8(_-1);return A?Object(k.sliceUint8)(B,0,_-A):B}var L=function(){function B(){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 _=B.prototype;return _.uint8ArrayToUint32Array_=function(C){for(var s=new DataView(C),m=new Uint32Array(4),b=0;b<4;b++)m[b]=s.getUint32(b*4);return m},_.initTable=function(){var C=this.sBox,s=this.invSBox,m=this.subMix,b=m[0],c=m[1],v=m[2],x=m[3],n=this.invSubMix,e=n[0],t=n[1],i=n[2],p=n[3],u=new Uint32Array(256),h=0,T=0,g=0;for(g=0;g<256;g++)g<128?u[g]=g<<1:u[g]=g<<1^283;for(g=0;g<256;g++){var f=T^T<<1^T<<2^T<<3^T<<4;f=f>>>8^f&255^99,C[h]=f,s[f]=h;var l=u[h],r=u[l],a=u[r],y=u[f]*257^f*16843008;b[h]=y<<24|y>>>8,c[h]=y<<16|y>>>16,v[h]=y<<8|y>>>24,x[h]=y,y=a*16843009^r*65537^l*257^h*16843008,e[f]=y<<24|y>>>8,t[f]=y<<16|y>>>16,i[f]=y<<8|y>>>24,p[f]=y,h?(h=l^u[u[u[a^l]]],T^=u[u[T]]):h=T=1}},_.expandKey=function(C){for(var s=this.uint8ArrayToUint32Array_(C),m=!0,b=0;b<s.length&&m;)m=s[b]===this.key[b],b++;if(m)return;this.key=s;var c=this.keySize=s.length;if(c!==4&&c!==6&&c!==8)throw new Error("Invalid aes key size="+c);var v=this.ksRows=(c+6+1)*4,x,n,e=this.keySchedule=new Uint32Array(v),t=this.invKeySchedule=new Uint32Array(v),i=this.sBox,p=this.rcon,u=this.invSubMix,h=u[0],T=u[1],g=u[2],f=u[3],l,r;for(x=0;x<v;x++){if(x<c){l=e[x]=s[x];continue}r=l,x%c===0?(r=r<<8|r>>>24,r=i[r>>>24]<<24|i[r>>>16&255]<<16|i[r>>>8&255]<<8|i[r&255],r^=p[x/c|0]<<24):c>6&&x%c===4&&(r=i[r>>>24]<<24|i[r>>>16&255]<<16|i[r>>>8&255]<<8|i[r&255]),e[x]=l=(e[x-c]^r)>>>0}for(n=0;n<v;n++)x=v-n,n&3?r=e[x]:r=e[x-4],n<4||x<=4?t[n]=r:t[n]=h[i[r>>>24]]^T[i[r>>>16&255]]^g[i[r>>>8&255]]^f[i[r&255]],t[n]=t[n]>>>0},_.networkToHostOrderSwap=function(C){return C<<24|(C&65280)<<8|(C&16711680)>>8|C>>>24},_.decrypt=function(C,s,m){for(var b=this.keySize+6,c=this.invKeySchedule,v=this.invSBox,x=this.invSubMix,n=x[0],e=x[1],t=x[2],i=x[3],p=this.uint8ArrayToUint32Array_(m),u=p[0],h=p[1],T=p[2],g=p[3],f=new Int32Array(C),l=new Int32Array(f.length),r,a,y,E,w,R,M,N,j,K,V,z,Q,ae,oe=this.networkToHostOrderSwap;s<f.length;){for(j=oe(f[s]),K=oe(f[s+1]),V=oe(f[s+2]),z=oe(f[s+3]),w=j^c[0],R=z^c[1],M=V^c[2],N=K^c[3],Q=4,ae=1;ae<b;ae++)r=n[w>>>24]^e[R>>16&255]^t[M>>8&255]^i[N&255]^c[Q],a=n[R>>>24]^e[M>>16&255]^t[N>>8&255]^i[w&255]^c[Q+1],y=n[M>>>24]^e[N>>16&255]^t[w>>8&255]^i[R&255]^c[Q+2],E=n[N>>>24]^e[w>>16&255]^t[R>>8&255]^i[M&255]^c[Q+3],w=r,R=a,M=y,N=E,Q=Q+4;r=v[w>>>24]<<24^v[R>>16&255]<<16^v[M>>8&255]<<8^v[N&255]^c[Q],a=v[R>>>24]<<24^v[M>>16&255]<<16^v[N>>8&255]<<8^v[w&255]^c[Q+1],y=v[M>>>24]<<24^v[N>>16&255]<<16^v[w>>8&255]<<8^v[R&255]^c[Q+2],E=v[N>>>24]<<24^v[w>>16&255]<<16^v[R>>8&255]<<8^v[M&255]^c[Q+3],l[s]=oe(r^u),l[s+1]=oe(E^h),l[s+2]=oe(y^T),l[s+3]=oe(a^g),u=j,h=K,T=V,g=z,s=s+4}return l.buffer},B}()},"./src/crypt/decrypter.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"default",function(){return s});var k=S("./src/crypt/aes-crypto.ts"),D=S("./src/crypt/fast-aes-key.ts"),L=S("./src/crypt/aes-decryptor.ts"),B=S("./src/utils/logger.ts"),_=S("./src/utils/mp4-tools.ts"),A=S("./src/utils/typed-array.ts"),C=16,s=function(){function m(c,v,x){var n=x===void 0?{}:x,e=n.removePKCS7Padding,t=e===void 0?!0:e;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=c,this.config=v,this.removePKCS7Padding=t,t)try{var i=self.crypto;i&&(this.subtle=i.subtle||i.webkitSubtle)}catch(p){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var b=m.prototype;return b.destroy=function(){this.observer=null},b.isSync=function(){return this.config.enableSoftwareAES},b.flush=function(){var v=this.currentResult;if(!v){this.reset();return}var x=new Uint8Array(v);return this.reset(),this.removePKCS7Padding?Object(L.removePadding)(x):x},b.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},b.decrypt=function(v,x,n,e){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(v),x,n);var t=this.flush();t&&e(t.buffer)}else this.webCryptoDecrypt(new Uint8Array(v),x,n).then(e)},b.softwareDecrypt=function(v,x,n){var e=this.currentIV,t=this.currentResult,i=this.remainderData;this.logOnce("JS AES decrypt"),i&&(v=Object(_.appendUint8Array)(i,v),this.remainderData=null);var p=this.getValidChunk(v);if(!p.length)return null;e&&(n=e);var u=this.softwareDecrypter;u||(u=this.softwareDecrypter=new L.default),u.expandKey(x);var h=t;return this.currentResult=u.decrypt(p.buffer,0,n),this.currentIV=Object(A.sliceUint8)(p,-16).buffer,h||null},b.webCryptoDecrypt=function(v,x,n){var e=this,t=this.subtle;return(this.key!==x||!this.fastAesKey)&&(this.key=x,this.fastAesKey=new D.default(t,x)),this.fastAesKey.expandKey().then(function(i){if(!t)return Promise.reject(new Error("web crypto not initialized"));var p=new k.default(t,n);return p.decrypt(v.buffer,i)}).catch(function(i){return e.onWebCryptoError(i,v,x,n)})},b.onWebCryptoError=function(v,x,n,e){return B.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",v),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(x,n,e)},b.getValidChunk=function(v){var x=v,n=v.length-v.length%C;return n!==v.length&&(x=Object(A.sliceUint8)(v,0,n),this.remainderData=Object(A.sliceUint8)(v,n)),x},b.logOnce=function(v){if(!this.logEnabled)return;B.logger.log("[decrypter.ts]: "+v),this.logEnabled=!1},m}()},"./src/crypt/fast-aes-key.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"default",function(){return k});var k=function(){function D(B,_){this.subtle=void 0,this.key=void 0,this.subtle=B,this.key=_}var L=D.prototype;return L.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},D}()},"./src/demux/aacdemuxer.ts":function(se,U,S){"use strict";S.r(U);var k=S("./src/demux/base-audio-demuxer.ts"),D=S("./src/demux/adts.ts"),L=S("./src/utils/logger.ts"),B=S("./src/demux/id3.ts");function _(s,m){s.prototype=Object.create(m.prototype),s.prototype.constructor=s,A(s,m)}function A(s,m){return A=Object.setPrototypeOf||function(c,v){return c.__proto__=v,c},A(s,m)}var C=function(s){_(m,s);function m(c,v){var x;return x=s.call(this)||this,x.observer=void 0,x.config=void 0,x.observer=c,x.config=v,x}var b=m.prototype;return b.resetInitSegment=function(v,x,n){s.prototype.resetInitSegment.call(this,v,x,n),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:v,duration:n,inputTimeScale:9e4,dropped:0}},m.probe=function(v){if(!v)return!1;for(var x=B.getID3Data(v,0)||[],n=x.length,e=v.length;n<e;n++)if(D.probe(v,n))return L.logger.log("ADTS sync word found !"),!0;return!1},b.canParse=function(v,x){return D.canParse(v,x)},b.appendFrame=function(v,x,n){D.initTrackConfig(v,this.observer,x,n,v.manifestCodec);var e=D.appendFrame(v,x,n,this.initPTS,this.frameIndex);if(e&&e.missing===0)return e},m}(k.default);C.minProbeByteLength=9,U.default=C},"./src/demux/adts.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"getAudioConfig",function(){return B}),S.d(U,"isHeaderPattern",function(){return _}),S.d(U,"getHeaderLength",function(){return A}),S.d(U,"getFullFrameLength",function(){return C}),S.d(U,"canGetFrameLength",function(){return s}),S.d(U,"isHeader",function(){return m}),S.d(U,"canParse",function(){return b}),S.d(U,"probe",function(){return c}),S.d(U,"initTrackConfig",function(){return v}),S.d(U,"getFrameDuration",function(){return x}),S.d(U,"parseFrameHeader",function(){return n}),S.d(U,"appendFrame",function(){return e});var k=S("./src/utils/logger.ts"),D=S("./src/errors.ts"),L=S("./src/events.ts");function B(t,i,p,u){var h,T,g,f,l=navigator.userAgent.toLowerCase(),r=u,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];h=((i[p+2]&192)>>>6)+1;var y=(i[p+2]&60)>>>2;if(y>a.length-1){t.trigger(L.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+y});return}return g=(i[p+2]&1)<<2,g|=(i[p+3]&192)>>>6,k.logger.log("manifest codec:"+u+", ADTS type:"+h+", samplingIndex:"+y),/firefox/i.test(l)?y>=6?(h=5,f=new Array(4),T=y-3):(h=2,f=new Array(2),T=y):l.indexOf("android")!==-1?(h=2,f=new Array(2),T=y):(h=5,f=new Array(4),u&&(u.indexOf("mp4a.40.29")!==-1||u.indexOf("mp4a.40.5")!==-1)||!u&&y>=6?T=y-3:((u&&u.indexOf("mp4a.40.2")!==-1&&(y>=6&&g===1||/vivaldi/i.test(l))||!u&&g===1)&&(h=2,f=new Array(2)),T=y)),f[0]=h<<3,f[0]|=(y&14)>>1,f[1]|=(y&1)<<7,f[1]|=g<<3,h===5&&(f[1]|=(T&14)>>1,f[2]=(T&1)<<7,f[2]|=2<<2,f[3]=0),{config:f,samplerate:a[y],channelCount:g,codec:"mp4a.40."+h,manifestCodec:r}}function _(t,i){return t[i]===255&&(t[i+1]&246)===240}function A(t,i){return t[i+1]&1?7:9}function C(t,i){return(t[i+3]&3)<<11|t[i+4]<<3|(t[i+5]&224)>>>5}function s(t,i){return i+5<t.length}function m(t,i){return i+1<t.length&&_(t,i)}function b(t,i){return s(t,i)&&_(t,i)&&C(t,i)<=t.length-i}function c(t,i){if(m(t,i)){var p=A(t,i);if(i+p>=t.length)return!1;var u=C(t,i);if(u<=p)return!1;var h=i+u;return h===t.length||m(t,h)}return!1}function v(t,i,p,u,h){if(!t.samplerate){var T=B(i,p,u,h);if(!T)return;t.config=T.config,t.samplerate=T.samplerate,t.channelCount=T.channelCount,t.codec=T.codec,t.manifestCodec=T.manifestCodec,k.logger.log("parsed codec:"+t.codec+", rate:"+T.samplerate+", channels:"+T.channelCount)}}function x(t){return 1024*9e4/t}function n(t,i,p,u,h){var T=A(t,i),g=C(t,i);if(g-=T,g>0){var f=p+u*h;return{headerLength:T,frameLength:g,stamp:f}}}function e(t,i,p,u,h){var T=x(t.samplerate),g=n(i,p,u,h,T);if(g){var f=g.frameLength,l=g.headerLength,r=g.stamp,a=l+f,y=Math.max(0,p+a-i.length),E;y?(E=new Uint8Array(a-l),E.set(i.subarray(p+l,i.length),0)):E=i.subarray(p+l,p+a);var w={unit:E,pts:r};return y||t.samples.push(w),{sample:w,length:a,missing:y}}}},"./src/demux/base-audio-demuxer.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"initPTSFn",function(){return C});var k=S("./src/polyfills/number.ts"),D=S("./src/demux/id3.ts"),L=S("./src/demux/dummy-demuxed-track.ts"),B=S("./src/utils/mp4-tools.ts"),_=S("./src/utils/typed-array.ts"),A=function(){function s(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var m=s.prototype;return m.resetInitSegment=function(c,v,x){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},m.resetTimeStamp=function(){},m.resetContiguity=function(){},m.canParse=function(c,v){return!1},m.appendFrame=function(c,v,x){},m.demux=function(c,v){this.cachedData&&(c=Object(B.appendUint8Array)(this.cachedData,c),this.cachedData=null);var x=D.getID3Data(c,0),n=x?x.length:0,e,t,i=this._audioTrack,p=this._id3Track,u=x?D.getTimeStamp(x):void 0,h=c.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=C(u,v)),x&&x.length>0&&p.samples.push({pts:this.initPTS,dts:this.initPTS,data:x}),t=this.initPTS;n<h;){if(this.canParse(c,n)){var T=this.appendFrame(i,c,n);T?(this.frameIndex++,t=T.sample.pts,n+=T.length,e=n):n=h}else D.canParse(c,n)?(x=D.getID3Data(c,n),p.samples.push({pts:t,dts:t,data:x}),n+=x.length,e=n):n++;if(n===h&&e!==h){var g=Object(_.sliceUint8)(c,e);this.cachedData?this.cachedData=Object(B.appendUint8Array)(this.cachedData,g):this.cachedData=g}}return{audioTrack:i,avcTrack:Object(L.dummyTrack)(),id3Track:p,textTrack:Object(L.dummyTrack)()}},m.demuxSampleAes=function(c,v,x){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},m.flush=function(c){var v=this.cachedData;return v&&(this.cachedData=null,this.demux(v,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(L.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(L.dummyTrack)()}},m.destroy=function(){},s}(),C=function(m,b){return Object(k.isFiniteNumber)(m)?m*90:b*9e4};U.default=A},"./src/demux/chunk-cache.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"default",function(){return k});var k=function(){function L(){this.chunks=[],this.dataLength=0}var B=L.prototype;return B.push=function(A){this.chunks.push(A),this.dataLength+=A.length},B.flush=function(){var A=this.chunks,C=this.dataLength,s;if(A.length)A.length===1?s=A[0]:s=D(A,C);else return new Uint8Array(0);return this.reset(),s},B.reset=function(){this.chunks.length=0,this.dataLength=0},L}();function D(L,B){for(var _=new Uint8Array(B),A=0,C=0;C<L.length;C++){var s=L[C];_.set(s,A),A+=s.length}return _}},"./src/demux/dummy-demuxed-track.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"dummyTrack",function(){return k});function k(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(se,U,S){"use strict";S.r(U);var k=S("./src/utils/logger.ts"),D=function(){function L(_){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=_,this.bytesAvailable=_.byteLength,this.word=0,this.bitsAvailable=0}var B=L.prototype;return B.loadWord=function(){var A=this.data,C=this.bytesAvailable,s=A.byteLength-C,m=new Uint8Array(4),b=Math.min(4,C);if(b===0)throw new Error("no bytes available");m.set(A.subarray(s,s+b)),this.word=new DataView(m.buffer).getUint32(0),this.bitsAvailable=b*8,this.bytesAvailable-=b},B.skipBits=function(A){var C;this.bitsAvailable>A?(this.word<<=A,this.bitsAvailable-=A):(A-=this.bitsAvailable,C=A>>3,A-=C>>3,this.bytesAvailable-=C,this.loadWord(),this.word<<=A,this.bitsAvailable-=A)},B.readBits=function(A){var C=Math.min(this.bitsAvailable,A),s=this.word>>>32-C;return A>32&&k.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=C,this.bitsAvailable>0?this.word<<=C:this.bytesAvailable>0&&this.loadWord(),C=A-C,C>0&&this.bitsAvailable?s<<C|this.readBits(C):s},B.skipLZ=function(){var A;for(A=0;A<this.bitsAvailable;++A)if((this.word&2147483648>>>A)!==0)return this.word<<=A,this.bitsAvailable-=A,A;return this.loadWord(),A+this.skipLZ()},B.skipUEG=function(){this.skipBits(1+this.skipLZ())},B.skipEG=function(){this.skipBits(1+this.skipLZ())},B.readUEG=function(){var A=this.skipLZ();return this.readBits(A+1)-1},B.readEG=function(){var A=this.readUEG();return 1&A?1+A>>>1:-1*(A>>>1)},B.readBoolean=function(){return this.readBits(1)===1},B.readUByte=function(){return this.readBits(8)},B.readUShort=function(){return this.readBits(16)},B.readUInt=function(){return this.readBits(32)},B.skipScalingList=function(A){for(var C=8,s=8,m,b=0;b<A;b++)s!==0&&(m=this.readEG(),s=(C+m+256)%256),C=s===0?C:s},B.readSPS=function(){var A=0,C=0,s=0,m=0,b,c,v,x=this.readUByte.bind(this),n=this.readBits.bind(this),e=this.readUEG.bind(this),t=this.readBoolean.bind(this),i=this.skipBits.bind(this),p=this.skipEG.bind(this),u=this.skipUEG.bind(this),h=this.skipScalingList.bind(this);x();var T=x();if(n(5),i(3),x(),u(),T===100||T===110||T===122||T===244||T===44||T===83||T===86||T===118||T===128){var g=e();if(g===3&&i(1),u(),u(),i(1),t())for(c=g!==3?8:12,v=0;v<c;v++)t()&&(v<6?h(16):h(64))}u();var f=e();if(f===0)e();else if(f===1)for(i(1),p(),p(),b=e(),v=0;v<b;v++)p();u(),i(1);var l=e(),r=e(),a=n(1);a===0&&i(1),i(1),t()&&(A=e(),C=e(),s=e(),m=e());var y=[1,1];if(t()&&t()){var E=x();switch(E){case 1:y=[1,1];break;case 2:y=[12,11];break;case 3:y=[10,11];break;case 4:y=[16,11];break;case 5:y=[40,33];break;case 6:y=[24,11];break;case 7:y=[20,11];break;case 8:y=[32,11];break;case 9:y=[80,33];break;case 10:y=[18,11];break;case 11:y=[15,11];break;case 12:y=[64,33];break;case 13:y=[160,99];break;case 14:y=[4,3];break;case 15:y=[3,2];break;case 16:y=[2,1];break;case 255:{y=[x()<<8|x(),x()<<8|x()];break}}}return{width:Math.ceil((l+1)*16-A*2-C*2),height:(2-a)*(r+1)*16-(a?2:4)*(s+m),pixelRatio:y}},B.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},L}();U.default=D},"./src/demux/id3.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"isHeader",function(){return k}),S.d(U,"isFooter",function(){return D}),S.d(U,"getID3Data",function(){return L}),S.d(U,"canParse",function(){return _}),S.d(U,"getTimeStamp",function(){return A}),S.d(U,"isTimeStampFrame",function(){return C}),S.d(U,"getID3Frames",function(){return m}),S.d(U,"decodeFrame",function(){return b}),S.d(U,"utf8ArrayToStr",function(){return e}),S.d(U,"testables",function(){return t});var k=function(h,T){return T+10<=h.length&&(h[T]===73&&h[T+1]===68&&h[T+2]===51&&(h[T+3]<255&&h[T+4]<255&&(h[T+6]<128&&h[T+7]<128&&h[T+8]<128&&h[T+9]<128)))},D=function(h,T){return T+10<=h.length&&(h[T]===51&&h[T+1]===68&&h[T+2]===73&&(h[T+3]<255&&h[T+4]<255&&(h[T+6]<128&&h[T+7]<128&&h[T+8]<128&&h[T+9]<128)))},L=function(h,T){for(var g=T,f=0;k(h,T);){f+=10;var l=B(h,T+6);f+=l,D(h,T+10)&&(f+=10),T+=f}return f>0?h.subarray(g,g+f):void 0},B=function(h,T){var g=0;return g=(h[T]&127)<<21,g|=(h[T+1]&127)<<14,g|=(h[T+2]&127)<<7,g|=h[T+3]&127,g},_=function(h,T){return k(h,T)&&B(h,T+6)+10<=h.length-T},A=function(h){for(var T=m(h),g=0;g<T.length;g++){var f=T[g];if(C(f))return n(f)}return},C=function(h){return h&&h.key==="PRIV"&&h.info==="com.apple.streaming.transportStreamTimestamp"},s=function(h){var T=String.fromCharCode(h[0],h[1],h[2],h[3]),g=B(h,4),f=10;return{type:T,size:g,data:h.subarray(f,f+g)}},m=function(h){for(var T=0,g=[];k(h,T);){var f=B(h,T+6);T+=10;for(var l=T+f;T+8<l;){var r=s(h.subarray(T)),a=b(r);a&&g.push(a),T+=r.size+10}D(h,T)&&(T+=10)}return g},b=function(h){return h.type==="PRIV"?c(h):h.type[0]==="W"?x(h):v(h)},c=function(h){if(h.size<2)return;var T=e(h.data,!0),g=new Uint8Array(h.data.subarray(T.length+1));return{key:h.type,info:T,data:g.buffer}},v=function(h){if(h.size<2)return;if(h.type==="TXXX"){var T=1,g=e(h.data.subarray(T),!0);T+=g.length+1;var f=e(h.data.subarray(T));return{key:h.type,info:g,data:f}}var l=e(h.data.subarray(1));return{key:h.type,data:l}},x=function(h){if(h.type==="WXXX"){if(h.size<2)return;var T=1,g=e(h.data.subarray(T),!0);T+=g.length+1;var f=e(h.data.subarray(T));return{key:h.type,info:g,data:f}}var l=e(h.data);return{key:h.type,data:l}},n=function(h){if(h.data.byteLength===8){var T=new Uint8Array(h.data),g=T[3]&1,f=(T[4]<<23)+(T[5]<<15)+(T[6]<<7)+T[7];return f/=45,g&&(f+=4772185884e-2),Math.round(f)}return},e=function(h,T){T===void 0&&(T=!1);var g=p();if(g){var f=g.decode(h);if(T){var l=f.indexOf("\0");return l!==-1?f.substring(0,l):f}return f.replace(/\0/g,"")}for(var r=h.length,a,y,E,w="",R=0;R<r;){if(a=h[R++],a===0&&T)return w;if(a===0||a===3)continue;switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:w+=String.fromCharCode(a);break;case 12:case 13:y=h[R++],w+=String.fromCharCode((a&31)<<6|y&63);break;case 14:y=h[R++],E=h[R++],w+=String.fromCharCode((a&15)<<12|(y&63)<<6|(E&63)<<0);break;default:}}return w},t={decodeTextFrame:v},i;function p(){return!i&&typeof self.TextDecoder!="undefined"&&(i=new self.TextDecoder("utf-8")),i}},"./src/demux/mp3demuxer.ts":function(se,U,S){"use strict";S.r(U);var k=S("./src/demux/base-audio-demuxer.ts"),D=S("./src/demux/id3.ts"),L=S("./src/utils/logger.ts"),B=S("./src/demux/mpegaudio.ts");function _(s,m){s.prototype=Object.create(m.prototype),s.prototype.constructor=s,A(s,m)}function A(s,m){return A=Object.setPrototypeOf||function(c,v){return c.__proto__=v,c},A(s,m)}var C=function(s){_(m,s);function m(){return s.apply(this,arguments)||this}var b=m.prototype;return b.resetInitSegment=function(v,x,n){s.prototype.resetInitSegment.call(this,v,x,n),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:v,duration:n,inputTimeScale:9e4,dropped:0}},m.probe=function(v){if(!v)return!1;for(var x=D.getID3Data(v,0)||[],n=x.length,e=v.length;n<e;n++)if(B.probe(v,n))return L.logger.log("MPEG Audio sync word found !"),!0;return!1},b.canParse=function(v,x){return B.canParse(v,x)},b.appendFrame=function(v,x,n){return this.initPTS===null?void 0:B.appendFrame(v,x,n,this.initPTS,this.frameIndex)},m}(k.default);C.minProbeByteLength=4,U.default=C},"./src/demux/mp4demuxer.ts":function(se,U,S){"use strict";S.r(U);var k=S("./src/utils/mp4-tools.ts"),D=S("./src/demux/dummy-demuxed-track.ts"),L=function(){function B(A,C){this.remainderData=null,this.config=void 0,this.config=C}var _=B.prototype;return _.resetTimeStamp=function(){},_.resetInitSegment=function(){},_.resetContiguity=function(){},B.probe=function(C){return Object(k.findBox)({data:C,start:0,end:Math.min(C.length,16384)},["moof"]).length>0},_.demux=function(C){var s=C,m=Object(D.dummyTrack)();if(this.config.progressive){this.remainderData&&(s=Object(k.appendUint8Array)(this.remainderData,C));var b=Object(k.segmentValidRange)(s);this.remainderData=b.remainder,m.samples=b.valid||new Uint8Array}else m.samples=s;return{audioTrack:Object(D.dummyTrack)(),avcTrack:m,id3Track:Object(D.dummyTrack)(),textTrack:Object(D.dummyTrack)()}},_.flush=function(){var C=Object(D.dummyTrack)();return C.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(D.dummyTrack)(),avcTrack:C,id3Track:Object(D.dummyTrack)(),textTrack:Object(D.dummyTrack)()}},_.demuxSampleAes=function(C,s,m){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},_.destroy=function(){},B}();L.minProbeByteLength=1024,U.default=L},"./src/demux/mpegaudio.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"appendFrame",function(){return A}),S.d(U,"parseHeader",function(){return C}),S.d(U,"isHeaderPattern",function(){return s}),S.d(U,"isHeader",function(){return m}),S.d(U,"canParse",function(){return b}),S.d(U,"probe",function(){return c});var k=null,D=[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],B=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],_=[0,1,1,4];function A(v,x,n,e,t){if(n+24>x.length)return;var i=C(x,n);if(i&&n+i.frameLength<=x.length){var p=i.samplesPerFrame*9e4/i.sampleRate,u=e+t*p,h={unit:x.subarray(n,n+i.frameLength),pts:u,dts:u};return v.config=[],v.channelCount=i.channelCount,v.samplerate=i.sampleRate,v.samples.push(h),{sample:h,length:i.frameLength,missing:0}}}function C(v,x){var n=v[x+1]>>3&3,e=v[x+1]>>1&3,t=v[x+2]>>4&15,i=v[x+2]>>2&3;if(n!==1&&t!==0&&t!==15&&i!==3){var p=v[x+2]>>1&1,u=v[x+3]>>6,h=n===3?3-e:e===3?3:4,T=D[h*14+t-1]*1e3,g=n===3?0:n===2?1:2,f=L[g*3+i],l=u===3?1:2,r=B[n][e],a=_[e],y=r*8*a,E=Math.floor(r*T/f+p)*a;if(k===null){var w=navigator.userAgent||"",R=w.match(/Chrome\/(\d+)/i);k=R?parseInt(R[1]):0}var M=!!k&&k<=87;return M&&e===2&&T>=224e3&&u===0&&(v[x+3]=v[x+3]|128),{sampleRate:f,channelCount:l,frameLength:E,samplesPerFrame:y}}}function s(v,x){return v[x]===255&&(v[x+1]&224)===224&&(v[x+1]&6)!==0}function m(v,x){return x+1<v.length&&s(v,x)}function b(v,x){var n=4;return s(v,x)&&n<=v.length-x}function c(v,x){if(x+1<v.length&&s(v,x)){var n=4,e=C(v,x),t=n;e!=null&&e.frameLength&&(t=e.frameLength);var i=x+t;return i===v.length||m(v,i)}return!1}},"./src/demux/sample-aes.ts":function(se,U,S){"use strict";S.r(U);var k=S("./src/crypt/decrypter.ts"),D=S("./src/demux/tsdemuxer.ts"),L=function(){function B(A,C,s){this.keyData=void 0,this.decrypter=void 0,this.keyData=s,this.decrypter=new k.default(A,C,{removePKCS7Padding:!1})}var _=B.prototype;return _.decryptBuffer=function(C,s){this.decrypter.decrypt(C,this.keyData.key.buffer,this.keyData.iv.buffer,s)},_.decryptAacSample=function(C,s,m,b){var c=C[s].unit,v=c.subarray(16,c.length-c.length%16),x=v.buffer.slice(v.byteOffset,v.byteOffset+v.length),n=this;this.decryptBuffer(x,function(e){var t=new Uint8Array(e);c.set(t,16),b||n.decryptAacSamples(C,s+1,m)})},_.decryptAacSamples=function(C,s,m){for(;;s++){if(s>=C.length){m();return}if(C[s].unit.length<32)continue;var b=this.decrypter.isSync();if(this.decryptAacSample(C,s,m,b),!b)return}},_.getAvcEncryptedData=function(C){for(var s=Math.floor((C.length-48)/160)*16+16,m=new Int8Array(s),b=0,c=32;c<=C.length-16;c+=160,b+=16)m.set(C.subarray(c,c+16),b);return m},_.getAvcDecryptedUnit=function(C,s){for(var m=new Uint8Array(s),b=0,c=32;c<=C.length-16;c+=160,b+=16)C.set(m.subarray(b,b+16),c);return C},_.decryptAvcSample=function(C,s,m,b,c,v){var x=Object(D.discardEPB)(c.data),n=this.getAvcEncryptedData(x),e=this;this.decryptBuffer(n.buffer,function(t){c.data=e.getAvcDecryptedUnit(x,t),v||e.decryptAvcSamples(C,s,m+1,b)})},_.decryptAvcSamples=function(C,s,m,b){if(C instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;s++,m=0){if(s>=C.length){b();return}for(var c=C[s].units;!(m>=c.length);m++){var v=c[m];if(v.data.length<=48||v.type!==1&&v.type!==5)continue;var x=this.decrypter.isSync();if(this.decryptAvcSample(C,s,m,b,v,x),!x)return}}},B}();U.default=L},"./src/demux/transmuxer-interface.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"default",function(){return c});var k=S("./node_modules/webworkify-webpack/index.js"),D=S.n(k),L=S("./src/events.ts"),B=S("./src/demux/transmuxer.ts"),_=S("./src/utils/logger.ts"),A=S("./src/errors.ts"),C=S("./src/utils/mediasource-helper.ts"),s=S("./node_modules/eventemitter3/index.js"),m=S.n(s),b=Object(C.getMediaSource)()||{isTypeSupported:function(){return!1}},c=function(){function v(n,e,t,i){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=n,this.id=e,this.onTransmuxComplete=t,this.onFlush=i;var u=n.config,h=function(r,a){a=a||{},a.frag=p.frag,a.id=p.id,n.trigger(r,a)};this.observer=new s.EventEmitter,this.observer.on(L.Events.FRAG_DECRYPTED,h),this.observer.on(L.Events.ERROR,h);var T={mp4:b.isTypeSupported("video/mp4"),mpeg:b.isTypeSupported("audio/mpeg"),mp3:b.isTypeSupported('audio/mp4; codecs="mp3"')},g=navigator.vendor;if(u.enableWorker&&typeof Worker!="undefined"){_.logger.log("demuxing in webworker");var f;try{f=this.worker=k("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),f.addEventListener("message",this.onwmsg),f.onerror=function(l){n.trigger(L.Events.ERROR,{type:A.ErrorTypes.OTHER_ERROR,details:A.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(l.message+" ("+l.filename+":"+l.lineno+")")})},f.postMessage({cmd:"init",typeSupported:T,vendor:g,id:e,config:JSON.stringify(u)})}catch(l){_.logger.warn("Error in worker:",l),_.logger.error("Error while initializing DemuxerWorker, fallback to inline"),f&&self.URL.revokeObjectURL(f.objectURL),this.transmuxer=new B.default(this.observer,T,u,g,e),this.worker=null}}else this.transmuxer=new B.default(this.observer,T,u,g,e)}var x=v.prototype;return x.destroy=function(){var e=this.worker;if(e)e.removeEventListener("message",this.onwmsg),e.terminate(),this.worker=null;else{var t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}var i=this.observer;i&&i.removeAllListeners(),this.observer=null},x.push=function(e,t,i,p,u,h,T,g,f,l){var r=this;f.transmuxing.start=self.performance.now();var a=this.transmuxer,y=this.worker,E=h?h.start:u.start,w=u.decryptdata,R=this.frag,M=!(R&&u.cc===R.cc),N=!(R&&f.level===R.level),j=R?f.sn-R.sn:-1,K=this.part?f.part-this.part.index:1,V=!N&&(j===1||j===0&&K===1),z=self.performance.now();(N||j||u.stats.parsing.start===0)&&(u.stats.parsing.start=z),h&&(K||!V)&&(h.stats.parsing.start=z);var Q=new B.TransmuxState(M,V,g,N,E);if(!V||M){_.logger.log("[transmuxer-interface, "+u.type+"]: Starting new transmux session for sn: "+f.sn+" p: "+f.part+" level: "+f.level+" id: "+f.id+`
discontinuity: `+M+`
trackSwitch: `+N+`
contiguous: `+V+`
accurateTimeOffset: `+g+`
timeOffset: `+E);var ae=new B.TransmuxConfig(i,p,t,T,l);this.configureTransmuxer(ae)}if(this.frag=u,this.part=h,y)y.postMessage({cmd:"demux",data:e,decryptdata:w,chunkMeta:f,state:Q},e instanceof ArrayBuffer?[e]:[]);else if(a){var oe=a.push(e,w,f,Q);Object(B.isPromise)(oe)?oe.then(function(Ce){r.handleTransmuxComplete(Ce)}):this.handleTransmuxComplete(oe)}},x.flush=function(e){var t=this;e.transmuxing.start=self.performance.now();var i=this.transmuxer,p=this.worker;if(p)p.postMessage({cmd:"flush",chunkMeta:e});else if(i){var u=i.flush(e);Object(B.isPromise)(u)?u.then(function(h){t.handleFlushResult(h,e)}):this.handleFlushResult(u,e)}},x.handleFlushResult=function(e,t){var i=this;e.forEach(function(p){i.handleTransmuxComplete(p)}),this.onFlush(t)},x.onWorkerMessage=function(e){var t=e.data,i=this.hls;switch(t.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(t.data);break}case"flush":{this.onFlush(t.data);break}default:{t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,i.trigger(t.event,t.data);break}}},x.configureTransmuxer=function(e){var t=this.worker,i=this.transmuxer;t?t.postMessage({cmd:"configure",config:e}):i&&i.configure(e)},x.handleTransmuxComplete=function(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)},v}()},"./src/demux/transmuxer-worker.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"default",function(){return A});var k=S("./src/demux/transmuxer.ts"),D=S("./src/events.ts"),L=S("./src/utils/logger.ts"),B=S("./node_modules/eventemitter3/index.js"),_=S.n(B);function A(c){var v=new B.EventEmitter,x=function(e,t){c.postMessage({event:e,data:t})};v.on(D.Events.FRAG_DECRYPTED,x),v.on(D.Events.ERROR,x),c.addEventListener("message",function(n){var e=n.data;switch(e.cmd){case"init":{var t=JSON.parse(e.config);c.transmuxer=new k.default(v,e.typeSupported,t,e.vendor,e.id),Object(L.enableLogs)(t.debug),x("init",null);break}case"configure":{c.transmuxer.configure(e.config);break}case"demux":{var i=c.transmuxer.push(e.data,e.decryptdata,e.chunkMeta,e.state);Object(k.isPromise)(i)?i.then(function(h){C(c,h)}):C(c,i);break}case"flush":{var p=e.chunkMeta,u=c.transmuxer.flush(p);Object(k.isPromise)(u)?u.then(function(h){m(c,h,p)}):m(c,u,p);break}default:break}})}function C(c,v){if(b(v.remuxResult))return;var x=[],n=v.remuxResult,e=n.audio,t=n.video;e&&s(x,e),t&&s(x,t),c.postMessage({event:"transmuxComplete",data:v},x)}function s(c,v){v.data1&&c.push(v.data1.buffer),v.data2&&c.push(v.data2.buffer)}function m(c,v,x){v.forEach(function(n){C(c,n)}),c.postMessage({event:"flush",data:x})}function b(c){return!c.audio&&!c.video&&!c.text&&!c.id3&&!c.initSegment}},"./src/demux/transmuxer.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"default",function(){return t}),S.d(U,"isPromise",function(){return u}),S.d(U,"TransmuxConfig",function(){return h}),S.d(U,"TransmuxState",function(){return T});var k=S("./src/events.ts"),D=S("./src/errors.ts"),L=S("./src/crypt/decrypter.ts"),B=S("./src/demux/aacdemuxer.ts"),_=S("./src/demux/mp4demuxer.ts"),A=S("./src/demux/tsdemuxer.ts"),C=S("./src/demux/mp3demuxer.ts"),s=S("./src/remux/mp4-remuxer.ts"),m=S("./src/remux/passthrough-remuxer.ts"),b=S("./src/demux/chunk-cache.ts"),c=S("./src/utils/mp4-tools.ts"),v=S("./src/utils/logger.ts"),x;try{x=self.performance.now.bind(self.performance)}catch(g){v.logger.debug("Unable to use Performance API on this environment"),x=self.Date.now}var n=[{demux:A.default,remux:s.default},{demux:_.default,remux:m.default},{demux:B.default,remux:s.default},{demux:C.default,remux:s.default}],e=1024;n.forEach(function(g){var f=g.demux;e=Math.max(e,f.minProbeByteLength)});var t=function(){function g(l,r,a,y,E){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 b.default,this.observer=l,this.typeSupported=r,this.config=a,this.vendor=y,this.id=E}var f=g.prototype;return f.configure=function(r){this.transmuxConfig=r,this.decrypter&&this.decrypter.reset()},f.push=function(r,a,y,E){var w=this,R=y.transmuxing;R.executeStart=x();var M=new Uint8Array(r),N=this.cache,j=this.config,K=this.currentTransmuxState,V=this.transmuxConfig;E&&(this.currentTransmuxState=E);var z=i(M,a);if(z&&z.method==="AES-128"){var Q=this.getDecrypter();if(j.enableSoftwareAES){var ae=Q.softwareDecrypt(M,z.key.buffer,z.iv.buffer);if(!ae)return R.executeEnd=x(),p(y);M=new Uint8Array(ae)}else return this.decryptionPromise=Q.webCryptoDecrypt(M,z.key.buffer,z.iv.buffer).then(function(ne){var de=w.push(ne,null,y);return w.decryptionPromise=null,de}),this.decryptionPromise}var oe=E||K,Ce=oe.contiguous,he=oe.discontinuity,fe=oe.trackSwitch,pe=oe.accurateTimeOffset,me=oe.timeOffset,ie=V.audioCodec,J=V.videoCodec,ye=V.defaultInitPts,Pe=V.duration,Le=V.initSegmentData;if((he||fe)&&this.resetInitSegment(Le,ie,J,Pe),he&&this.resetInitialTimestamp(ye),Ce||this.resetContiguity(),this.needsProbing(M,he,fe)){if(N.dataLength){var Re=N.flush();M=Object(c.appendUint8Array)(Re,M)}this.configureTransmuxer(M,V)}var X=this.transmux(M,z,me,pe,y),$=this.currentTransmuxState;return $.contiguous=!0,$.discontinuity=!1,$.trackSwitch=!1,R.executeEnd=x(),X},f.flush=function(r){var a=this,y=r.transmuxing;y.executeStart=x();var E=this.decrypter,w=this.cache,R=this.currentTransmuxState,M=this.decryptionPromise;if(M)return M.then(function(){return a.flush(r)});var N=[],j=R.timeOffset;if(E){var K=E.flush();K&&N.push(this.push(K,null,r))}var V=w.dataLength;w.reset();var z=this.demuxer,Q=this.remuxer;if(!z||!Q)return V>=e&&this.observer.emit(k.Events.ERROR,k.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),y.executeEnd=x(),[p(r)];var ae=z.flush(j);return u(ae)?ae.then(function(oe){return a.flushRemux(N,oe,r),N}):(this.flushRemux(N,ae,r),N)},f.flushRemux=function(r,a,y){var E=a.audioTrack,w=a.avcTrack,R=a.id3Track,M=a.textTrack,N=this.currentTransmuxState,j=N.accurateTimeOffset,K=N.timeOffset;v.logger.log("[transmuxer.ts]: Flushed fragment "+y.sn+(y.part>-1?" p: "+y.part:"")+" of level "+y.level);var V=this.remuxer.remux(E,w,R,M,K,j,!0,this.id);r.push({remuxResult:V,chunkMeta:y}),y.transmuxing.executeEnd=x()},f.resetInitialTimestamp=function(r){var a=this.demuxer,y=this.remuxer;if(!a||!y)return;a.resetTimeStamp(r),y.resetTimeStamp(r)},f.resetContiguity=function(){var r=this.demuxer,a=this.remuxer;if(!r||!a)return;r.resetContiguity(),a.resetNextTimestamp()},f.resetInitSegment=function(r,a,y,E){var w=this.demuxer,R=this.remuxer;if(!w||!R)return;w.resetInitSegment(a,y,E),R.resetInitSegment(r,a,y)},f.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},f.transmux=function(r,a,y,E,w){var R;return a&&a.method==="SAMPLE-AES"?R=this.transmuxSampleAes(r,a,y,E,w):R=this.transmuxUnencrypted(r,y,E,w),R},f.transmuxUnencrypted=function(r,a,y,E){var w=this.demuxer.demux(r,a,!1,!this.config.progressive),R=w.audioTrack,M=w.avcTrack,N=w.id3Track,j=w.textTrack,K=this.remuxer.remux(R,M,N,j,a,y,!1,this.id);return{remuxResult:K,chunkMeta:E}},f.transmuxSampleAes=function(r,a,y,E,w){var R=this;return this.demuxer.demuxSampleAes(r,a,y).then(function(M){var N=R.remuxer.remux(M.audioTrack,M.avcTrack,M.id3Track,M.textTrack,y,E,!1,R.id);return{remuxResult:N,chunkMeta:w}})},f.configureTransmuxer=function(r,a){for(var y=this.config,E=this.observer,w=this.typeSupported,R=this.vendor,M=a.audioCodec,N=a.defaultInitPts,j=a.duration,K=a.initSegmentData,V=a.videoCodec,z,Q=0,ae=n.length;Q<ae;Q++)if(n[Q].demux.probe(r)){z=n[Q];break}z||(v.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),z={demux:_.default,remux:m.default});var oe=this.demuxer,Ce=this.remuxer,he=z.remux,fe=z.demux;(!Ce||!(Ce instanceof he))&&(this.remuxer=new he(E,y,w,R)),(!oe||!(oe instanceof fe))&&(this.demuxer=new fe(E,y,w),this.probe=fe.probe),this.resetInitSegment(K,M,V,j),this.resetInitialTimestamp(N)},f.needsProbing=function(r,a,y){return!this.demuxer||!this.remuxer||a||y},f.getDecrypter=function(){var r=this.decrypter;return r||(r=this.decrypter=new L.default(this.observer,this.config)),r},g}();function i(g,f){var l=null;return g.byteLength>0&&f!=null&&f.key!=null&&f.iv!==null&&f.method!=null&&(l=f),l}var p=function(f){return{remuxResult:{},chunkMeta:f}};function u(g){return"then"in g&&g.then instanceof Function}var h=function(f,l,r,a,y){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=f,this.videoCodec=l,this.initSegmentData=r,this.duration=a,this.defaultInitPts=y},T=function(f,l,r,a,y){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=f,this.contiguous=l,this.accurateTimeOffset=r,this.trackSwitch=a,this.timeOffset=y}},"./src/demux/tsdemuxer.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"discardEPB",function(){return p});var k=S("./src/demux/adts.ts"),D=S("./src/demux/mpegaudio.ts"),L=S("./src/demux/exp-golomb.ts"),B=S("./src/demux/id3.ts"),_=S("./src/demux/sample-aes.ts"),A=S("./src/events.ts"),C=S("./src/utils/mp4-tools.ts"),s=S("./src/utils/logger.ts"),m=S("./src/errors.ts"),b={video:1,audio:2,id3:3,text:4},c=function(){function u(T,g,f){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=T,this.config=g,this.typeSupported=f}u.probe=function(g){var f=u.syncOffset(g);return f<0?!1:(f&&s.logger.warn("MPEG2-TS detected but first sync word found @ offset "+f+", junk ahead ?"),!0)},u.syncOffset=function(g){for(var f=Math.min(1e3,g.length-3*188),l=0;l<f;){if(g[l]===71&&g[l+188]===71&&g[l+2*188]===71)return l;l++}return-1},u.createTrack=function(g,f){return{container:g==="video"||g==="audio"?"video/mp2t":void 0,type:g,id:b[g],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:g==="audio"?f:void 0}};var h=u.prototype;return h.resetInitSegment=function(g,f,l){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=u.createTrack("video",l),this._audioTrack=u.createTrack("audio",l),this._id3Track=u.createTrack("id3",l),this._txtTrack=u.createTrack("text",l),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=g,this.videoCodec=f,this._duration=l},h.resetTimeStamp=function(){},h.resetContiguity=function(){var g=this._audioTrack,f=this._avcTrack,l=this._id3Track;g&&(g.pesData=null),f&&(f.pesData=null),l&&(l.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},h.demux=function(g,f,l,r){l===void 0&&(l=!1),r===void 0&&(r=!1),l||(this.sampleAes=null);var a,y=this._avcTrack,E=this._audioTrack,w=this._id3Track,R=y.pid,M=y.pesData,N=E.pid,j=w.pid,K=E.pesData,V=w.pesData,z=!1,Q=this.pmtParsed,ae=this._pmtId,oe=g.length;if(this.remainderData&&(g=Object(C.appendUint8Array)(this.remainderData,g),oe=g.length,this.remainderData=null),oe<188&&!r)return this.remainderData=g,{audioTrack:E,avcTrack:y,id3Track:w,textTrack:this._txtTrack};var Ce=Math.max(0,u.syncOffset(g));oe-=(oe+Ce)%188,oe<g.byteLength&&!r&&(this.remainderData=new Uint8Array(g.buffer,oe,g.buffer.byteLength-oe));for(var he=Ce;he<oe;he+=188)if(g[he]===71){var fe=!!(g[he+1]&64),pe=((g[he+1]&31)<<8)+g[he+2],me=(g[he+3]&48)>>4,ie=void 0;if(me>1){if(ie=he+5+g[he+4],ie===he+188)continue}else ie=he+4;switch(pe){case R:fe&&(M&&(a=e(M))&&this.parseAVCPES(a,!1),M={data:[],size:0}),M&&(M.data.push(g.subarray(ie,he+188)),M.size+=he+188-ie);break;case N:fe&&(K&&(a=e(K))&&(E.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),K={data:[],size:0}),K&&(K.data.push(g.subarray(ie,he+188)),K.size+=he+188-ie);break;case j:fe&&(V&&(a=e(V))&&this.parseID3PES(a),V={data:[],size:0}),V&&(V.data.push(g.subarray(ie,he+188)),V.size+=he+188-ie);break;case 0:fe&&(ie+=g[ie]+1),ae=this._pmtId=x(g,ie);break;case ae:{fe&&(ie+=g[ie]+1);var J=n(g,ie,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,l);R=J.avc,R>0&&(y.pid=R),N=J.audio,N>0&&(E.pid=N,E.isAAC=J.isAAC),j=J.id3,j>0&&(w.pid=j),z&&!Q&&(s.logger.log("reparse from beginning"),z=!1,he=Ce-188),Q=this.pmtParsed=!0;break}case 17:case 8191:break;default:z=!0;break}}else this.observer.emit(A.Events.ERROR,A.Events.ERROR,{type:m.ErrorTypes.MEDIA_ERROR,details:m.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});y.pesData=M,E.pesData=K,w.pesData=V;var ye={audioTrack:E,avcTrack:y,id3Track:w,textTrack:this._txtTrack};return r&&this.extractRemainingSamples(ye),ye},h.flush=function(){var g=this.remainderData;this.remainderData=null;var f;return g?f=this.demux(g,-1,!1,!0):f={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(f),this.sampleAes?this.decrypt(f,this.sampleAes):f},h.extractRemainingSamples=function(g){var f=g.audioTrack,l=g.avcTrack,r=g.id3Track,a=l.pesData,y=f.pesData,E=r.pesData,w;a&&(w=e(a))?(this.parseAVCPES(w,!0),l.pesData=null):l.pesData=a,y&&(w=e(y))?(f.isAAC?this.parseAACPES(w):this.parseMPEGPES(w),f.pesData=null):(y!=null&&y.size&&s.logger.log("last AAC PES packet truncated,might overlap between fragments"),f.pesData=y),E&&(w=e(E))?(this.parseID3PES(w),r.pesData=null):r.pesData=E},h.demuxSampleAes=function(g,f,l){var r=this.demux(g,l,!0,!this.config.progressive),a=this.sampleAes=new _.default(this.observer,this.config,f);return this.decrypt(r,a)},h.decrypt=function(g,f){return new Promise(function(l){var r=g.audioTrack,a=g.avcTrack;r.samples&&r.isAAC?f.decryptAacSamples(r.samples,0,function(){a.samples?f.decryptAvcSamples(a.samples,0,0,function(){l(g)}):l(g)}):a.samples&&f.decryptAvcSamples(a.samples,0,0,function(){l(g)})})},h.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},h.parseAVCPES=function(g,f){var l=this,r=this._avcTrack,a=this.parseAVCNALu(g.data),y=!1,E=this.avcSample,w,R=!1;g.data=null,E&&a.length&&!r.audFound&&(t(E,r),E=this.avcSample=v(!1,g.pts,g.dts,"")),a.forEach(function(M){switch(M.type){case 1:{w=!0,E||(E=l.avcSample=v(!0,g.pts,g.dts,"")),y&&(E.debug+="NDR "),E.frame=!0;var N=M.data;if(R&&N.length>4){var j=new L.default(N).readSliceType();(j===2||j===4||j===7||j===9)&&(E.key=!0)}break}case 5:w=!0,E||(E=l.avcSample=v(!0,g.pts,g.dts,"")),y&&(E.debug+="IDR "),E.key=!0,E.frame=!0;break;case 6:{w=!0,y&&E&&(E.debug+="SEI ");var K=new L.default(p(M.data));K.readUByte();for(var V=0,z=0,Q=!1,ae=0;!Q&&K.bytesAvailable>1;){V=0;do ae=K.readUByte(),V+=ae;while(ae===255);z=0;do ae=K.readUByte(),z+=ae;while(ae===255);if(V===4&&K.bytesAvailable!==0){Q=!0;var oe=K.readUByte();if(oe===181){var Ce=K.readUShort();if(Ce===49){var he=K.readUInt();if(he===1195456820){var fe=K.readUByte();if(fe===3){for(var pe=K.readUByte(),me=K.readUByte(),ie=31&pe,J=[pe,me],ye=0;ye<ie;ye++)J.push(K.readUByte()),J.push(K.readUByte()),J.push(K.readUByte());i(l._txtTrack.samples,{type:3,pts:g.pts,bytes:J})}}}}}else if(V===5&&K.bytesAvailable!==0){if(Q=!0,z>16){for(var Pe=[],Le=0;Le<16;Le++)Pe.push(K.readUByte().toString(16)),(Le===3||Le===5||Le===7||Le===9)&&Pe.push("-");for(var Re=z-16,X=new Uint8Array(Re),$=0;$<Re;$++)X[$]=K.readUByte();i(l._txtTrack.samples,{pts:g.pts,payloadType:V,uuid:Pe.join(""),userData:Object(B.utf8ArrayToStr)(X),userDataBytes:X})}}else if(z<K.bytesAvailable)for(var ne=0;ne<z;ne++)K.readUByte()}break}case 7:if(w=!0,R=!0,y&&E&&(E.debug+="SPS "),!r.sps){var de=new L.default(M.data),be=de.readSPS();r.width=be.width,r.height=be.height,r.pixelRatio=be.pixelRatio,r.sps=[M.data],r.duration=l._duration;for(var ve=M.data.subarray(1,4),Ee="avc1.",xe=0;xe<3;xe++){var Be=ve[xe].toString(16);Be.length<2&&(Be="0"+Be),Ee+=Be}r.codec=Ee}break;case 8:w=!0,y&&E&&(E.debug+="PPS "),r.pps||(r.pps=[M.data]);break;case 9:w=!1,r.audFound=!0,E&&t(E,r),E=l.avcSample=v(!1,g.pts,g.dts,y?"AUD ":"");break;case 12:w=!1;break;default:w=!1,E&&(E.debug+="unknown NAL "+M.type+" ");break}if(E&&w){var Ie=E.units;Ie.push(M)}}),f&&E&&(t(E,r),this.avcSample=null)},h.getLastNalUnit=function(){var g,f=this.avcSample,l;if(!f||f.units.length===0){var r=this._avcTrack.samples;f=r[r.length-1]}if((g=f)!==null&&g!==void 0&&g.units){var a=f.units;l=a[a.length-1]}return l},h.parseAVCNALu=function(g){var f=g.byteLength,l=this._avcTrack,r=l.naluState||0,a=r,y=[],E=0,w,R,M,N=-1,j=0;for(r===-1&&(N=0,j=g[0]&31,r=0,E=1);E<f;){if(w=g[E++],!r){r=w?0:1;continue}if(r===1){r=w?0:2;continue}if(!w)r=3;else if(w===1){if(N>=0){var K={data:g.subarray(N,E-r-1),type:j};y.push(K)}else{var V=this.getLastNalUnit();if(V&&(a&&E<=4-a&&(V.state&&(V.data=V.data.subarray(0,V.data.byteLength-a))),R=E-r-1,R>0)){var z=new Uint8Array(V.data.byteLength+R);z.set(V.data,0),z.set(g.subarray(0,R),V.data.byteLength),V.data=z,V.state=0}}E<f?(M=g[E]&31,N=E,j=M,r=0):r=-1}else r=0}if(N>=0&&r>=0){var Q={data:g.subarray(N,f),type:j,state:r};y.push(Q)}if(y.length===0){var ae=this.getLastNalUnit();if(ae){var oe=new Uint8Array(ae.data.byteLength+g.byteLength);oe.set(ae.data,0),oe.set(g,ae.data.byteLength),ae.data=oe}}return l.naluState=r,y},h.parseAACPES=function(g){var f=0,l=this._audioTrack,r=this.aacOverFlow,a=g.data;if(r){this.aacOverFlow=null;var y=r.sample.unit.byteLength,E=Math.min(r.missing,y),w=y-E;r.sample.unit.set(a.subarray(0,E),w),l.samples.push(r.sample),f=r.missing}var R,M;for(R=f,M=a.length;R<M-1&&!k.isHeader(a,R);R++);if(R!==f){var N,j;if(R<M-1?(N="AAC PES did not start with ADTS header,offset:"+R,j=!1):(N="no ADTS header found in AAC PES",j=!0),s.logger.warn("parsing error:"+N),this.observer.emit(A.Events.ERROR,A.Events.ERROR,{type:m.ErrorTypes.MEDIA_ERROR,details:m.ErrorDetails.FRAG_PARSING_ERROR,fatal:j,reason:N}),j)return}k.initTrackConfig(l,this.observer,a,R,this.audioCodec);var K;if(g.pts!==void 0)K=g.pts;else if(r){var V=k.getFrameDuration(l.samplerate);K=r.sample.pts+V}else{s.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var z=0;R<M;)if(k.isHeader(a,R)){if(R+5<M){var Q=k.appendFrame(l,a,R,K,z);if(Q)if(Q.missing)this.aacOverFlow=Q;else{R+=Q.length,z++;continue}}break}else R++},h.parseMPEGPES=function(g){var f=g.data,l=f.length,r=0,a=0,y=g.pts;if(y===void 0){s.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<l;)if(D.isHeader(f,a)){var E=D.appendFrame(this._audioTrack,f,a,y,r);if(E)a+=E.length,r++;else break}else a++},h.parseID3PES=function(g){if(g.pts===void 0){s.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(g)},u}();c.minProbeByteLength=188;function v(u,h,T,g){return{key:u,frame:!1,pts:h,dts:T,units:[],debug:g,length:0}}function x(u,h){return(u[h+10]&31)<<8|u[h+11]}function n(u,h,T,g){var f={audio:-1,avc:-1,id3:-1,isAAC:!0},l=(u[h+1]&15)<<8|u[h+2],r=h+3+l-4,a=(u[h+10]&15)<<8|u[h+11];for(h+=12+a;h<r;){var y=(u[h+1]&31)<<8|u[h+2];switch(u[h]){case 207:if(!g){s.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:f.audio===-1&&(f.audio=y);break;case 21:f.id3===-1&&(f.id3=y);break;case 219:if(!g){s.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:f.avc===-1&&(f.avc=y);break;case 3:case 4:T?f.audio===-1&&(f.audio=y,f.isAAC=!1):s.logger.log("MPEG audio found, not supported in this browser");break;case 36:s.logger.warn("Unsupported HEVC stream type found");break;default:break}h+=((u[h+3]&15)<<8|u[h+4])+5}return f}function e(u){var h=0,T,g,f,l,r,a=u.data;if(!u||u.size===0)return null;for(;a[0].length<19&&a.length>1;){var y=new Uint8Array(a[0].length+a[1].length);y.set(a[0]),y.set(a[1],a[0].length),a[0]=y,a.splice(1,1)}T=a[0];var E=(T[0]<<16)+(T[1]<<8)+T[2];if(E===1){if(g=(T[4]<<8)+T[5],g&&g>u.size-6)return null;var w=T[7];w&192&&(l=(T[9]&14)*536870912+(T[10]&255)*4194304+(T[11]&254)*16384+(T[12]&255)*128+(T[13]&254)/2,w&64?(r=(T[14]&14)*536870912+(T[15]&255)*4194304+(T[16]&254)*16384+(T[17]&255)*128+(T[18]&254)/2,l-r>60*9e4&&(s.logger.warn(Math.round((l-r)/9e4)+"s delta between PTS and DTS, align them"),l=r)):r=l),f=T[8];var R=f+9;if(u.size<=R)return null;u.size-=R;for(var M=new Uint8Array(u.size),N=0,j=a.length;N<j;N++){T=a[N];var K=T.byteLength;if(R)if(R>K){R-=K;continue}else T=T.subarray(R),K-=R,R=0;M.set(T,h),h+=K}return g&&(g-=f+3),{data:M,pts:l,dts:r,len:g}}return null}function t(u,h){if(u.units.length&&u.frame){if(u.pts===void 0){var T=h.samples,g=T.length;if(g){var f=T[g-1];u.pts=f.pts,u.dts=f.dts}else{h.dropped++;return}}h.samples.push(u)}u.debug.length&&s.logger.log(u.pts+"/"+u.dts+":"+u.debug)}function i(u,h){var T=u.length;if(T>0){if(h.pts>=u[T-1].pts)u.push(h);else for(var g=T-1;g>=0;g--)if(h.pts<u[g].pts){u.splice(g,0,h);break}}else u.push(h)}function p(u){for(var h=u.byteLength,T=[],g=1;g<h-2;)u[g]===0&&u[g+1]===0&&u[g+2]===3?(T.push(g+2),g+=2):g++;if(T.length===0)return u;var f=h-T.length,l=new Uint8Array(f),r=0;for(g=0;g<f;r++,g++)r===T[0]&&(r++,T.shift()),l[g]=u[r];return l}U.default=c},"./src/errors.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"ErrorTypes",function(){return k}),S.d(U,"ErrorDetails",function(){return D});var k;(function(L){L.NETWORK_ERROR="networkError",L.MEDIA_ERROR="mediaError",L.KEY_SYSTEM_ERROR="keySystemError",L.MUX_ERROR="muxError",L.OTHER_ERROR="otherError"})(k||(k={}));var D;(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"})(D||(D={}))},"./src/events.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"Events",function(){return k});var k;(function(D){D.MEDIA_ATTACHING="hlsMediaAttaching",D.MEDIA_ATTACHED="hlsMediaAttached",D.MEDIA_DETACHING="hlsMediaDetaching",D.MEDIA_DETACHED="hlsMediaDetached",D.BUFFER_RESET="hlsBufferReset",D.BUFFER_CODECS="hlsBufferCodecs",D.BUFFER_CREATED="hlsBufferCreated",D.BUFFER_APPENDING="hlsBufferAppending",D.BUFFER_APPENDED="hlsBufferAppended",D.BUFFER_EOS="hlsBufferEos",D.BUFFER_FLUSHING="hlsBufferFlushing",D.BUFFER_FLUSHED="hlsBufferFlushed",D.MANIFEST_LOADING="hlsManifestLoading",D.MANIFEST_LOADED="hlsManifestLoaded",D.MANIFEST_PARSED="hlsManifestParsed",D.LEVEL_SWITCHING="hlsLevelSwitching",D.LEVEL_SWITCHED="hlsLevelSwitched",D.LEVEL_LOADING="hlsLevelLoading",D.LEVEL_LOADED="hlsLevelLoaded",D.LEVEL_UPDATED="hlsLevelUpdated",D.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",D.LEVELS_UPDATED="hlsLevelsUpdated",D.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",D.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",D.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",D.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",D.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",D.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",D.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",D.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",D.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",D.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",D.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",D.CUES_PARSED="hlsCuesParsed",D.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",D.INIT_PTS_FOUND="hlsInitPtsFound",D.FRAG_LOADING="hlsFragLoading",D.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",D.FRAG_LOADED="hlsFragLoaded",D.FRAG_DECRYPTED="hlsFragDecrypted",D.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",D.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",D.FRAG_PARSING_METADATA="hlsFragParsingMetadata",D.FRAG_PARSED="hlsFragParsed",D.FRAG_BUFFERED="hlsFragBuffered",D.FRAG_CHANGED="hlsFragChanged",D.FPS_DROP="hlsFpsDrop",D.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",D.ERROR="hlsError",D.DESTROYING="hlsDestroying",D.KEY_LOADING="hlsKeyLoading",D.KEY_LOADED="hlsKeyLoaded",D.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",D.BACK_BUFFER_REACHED="hlsBackBufferReached"})(k||(k={}))},"./src/hls.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"default",function(){return u});var k=S("./node_modules/url-toolkit/src/url-toolkit.js"),D=S.n(k),L=S("./src/loader/playlist-loader.ts"),B=S("./src/loader/key-loader.ts"),_=S("./src/controller/id3-track-controller.ts"),A=S("./src/controller/latency-controller.ts"),C=S("./src/controller/level-controller.ts"),s=S("./src/controller/fragment-tracker.ts"),m=S("./src/controller/stream-controller.ts"),b=S("./src/is-supported.ts"),c=S("./src/utils/logger.ts"),v=S("./src/config.ts"),x=S("./node_modules/eventemitter3/index.js"),n=S.n(x),e=S("./src/events.ts"),t=S("./src/errors.ts");function i(h,T){for(var g=0;g<T.length;g++){var f=T[g];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(h,f.key,f)}}function p(h,T,g){return T&&i(h.prototype,T),g&&i(h,g),h}var u=function(){h.isSupported=function(){return Object(b.isSupported)()};function h(g){g===void 0&&(g={}),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 f=this.config=Object(v.mergeConfig)(h.DefaultConfig,g);this.userConfig=g,Object(c.enableLogs)(f.debug),this._autoLevelCapping=-1,f.progressive&&Object(v.enableStreamingMode)(f);var l=f.abrController,r=f.bufferController,a=f.capLevelController,y=f.fpsController,E=this.abrController=new l(this),w=this.bufferController=new r(this),R=this.capLevelController=new a(this),M=new y(this),N=new L.default(this),j=new B.default(this),K=new _.default(this),V=this.levelController=new C.default(this),z=new s.FragmentTracker(this),Q=this.streamController=new m.default(this,z);R.setStreamController(Q),M.setStreamController(Q);var ae=[V,Q];this.networkControllers=ae;var oe=[N,j,E,w,R,M,K,z];this.audioTrackController=this.createController(f.audioTrackController,null,ae),this.createController(f.audioStreamController,z,ae),this.subtitleTrackController=this.createController(f.subtitleTrackController,null,ae),this.createController(f.subtitleStreamController,z,ae),this.createController(f.timelineController,null,oe),this.emeController=this.createController(f.emeController,null,oe),this.cmcdController=this.createController(f.cmcdController,null,oe),this.latencyController=this.createController(A.default,null,oe),this.coreComponents=oe}var T=h.prototype;return T.createController=function(f,l,r){if(f){var a=l?new f(this,l):new f(this);return r&&r.push(a),a}return null},T.on=function(f,l,r){r===void 0&&(r=this),this._emitter.on(f,l,r)},T.once=function(f,l,r){r===void 0&&(r=this),this._emitter.once(f,l,r)},T.removeAllListeners=function(f){this._emitter.removeAllListeners(f)},T.off=function(f,l,r,a){r===void 0&&(r=this),this._emitter.off(f,l,r,a)},T.listeners=function(f){return this._emitter.listeners(f)},T.emit=function(f,l,r){return this._emitter.emit(f,l,r)},T.trigger=function(f,l){if(this.config.debug)return this.emit(f,f,l);try{return this.emit(f,f,l)}catch(r){c.logger.error("An internal error happened while handling event "+f+'. Error message: "'+r.message+'". Here is a stacktrace:',r),this.trigger(e.Events.ERROR,{type:t.ErrorTypes.OTHER_ERROR,details:t.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:f,error:r})}return!1},T.listenerCount=function(f){return this._emitter.listenerCount(f)},T.destroy=function(){c.logger.log("destroy"),this.trigger(e.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(f){return f.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(f){return f.destroy()}),this.coreComponents.length=0},T.attachMedia=function(f){c.logger.log("attachMedia"),this._media=f,this.trigger(e.Events.MEDIA_ATTACHING,{media:f})},T.detachMedia=function(){c.logger.log("detachMedia"),this.trigger(e.Events.MEDIA_DETACHING,void 0),this._media=null},T.loadSource=function(f){this.stopLoad();var l=this.media,r=this.url,a=this.url=k.buildAbsoluteURL(self.location.href,f,{alwaysNormalize:!0});c.logger.log("loadSource:"+a),l&&r&&r!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(l)),this.trigger(e.Events.MANIFEST_LOADING,{url:f})},T.startLoad=function(f){f===void 0&&(f=-1),c.logger.log("startLoad("+f+")"),this.networkControllers.forEach(function(l){l.startLoad(f)})},T.stopLoad=function(){c.logger.log("stopLoad"),this.networkControllers.forEach(function(f){f.stopLoad()})},T.swapAudioCodec=function(){c.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},T.recoverMediaError=function(){c.logger.log("recoverMediaError");var f=this._media;this.detachMedia(),f&&this.attachMedia(f)},T.removeLevel=function(f,l){l===void 0&&(l=0),this.levelController.removeLevel(f,l)},p(h,[{key:"levels",get:function(){var f=this.levelController.levels;return f||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(f){c.logger.log("set currentLevel:"+f),this.loadLevel=f,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(f){c.logger.log("set nextLevel:"+f),this.levelController.manualLevel=f,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(f){c.logger.log("set loadLevel:"+f),this.levelController.manualLevel=f}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(f){this.levelController.nextLoadLevel=f}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(f){c.logger.log("set firstLevel:"+f),this.levelController.firstLevel=f}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(f){c.logger.log("set startLevel:"+f),f!==-1&&(f=Math.max(f,this.minAutoLevel)),this.levelController.startLevel=f}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(f){var l=!!f;l!==this.config.capLevelToPlayerSize&&(l?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=l)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(f){this._autoLevelCapping!==f&&(c.logger.log("set autoLevelCapping:"+f),this._autoLevelCapping=f)}},{key:"bandwidthEstimate",get:function(){var f=this.abrController.bwEstimator;return f?f.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var f=this.levels,l=this.config.minAutoBitrate;if(!f)return 0;for(var r=f.length,a=0;a<r;a++)if(f[a].maxBitrate>l)return a;return 0}},{key:"maxAutoLevel",get:function(){var f=this.levels,l=this.autoLevelCapping,r;return l===-1&&f&&f.length?r=f.length-1:r=l,r}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(f){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,f)}},{key:"audioTracks",get:function(){var f=this.audioTrackController;return f?f.audioTracks:[]}},{key:"audioTrack",get:function(){var f=this.audioTrackController;return f?f.audioTrack:-1},set:function(f){var l=this.audioTrackController;l&&(l.audioTrack=f)}},{key:"subtitleTracks",get:function(){var f=this.subtitleTrackController;return f?f.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var f=this.subtitleTrackController;return f?f.subtitleTrack:-1},set:function(f){var l=this.subtitleTrackController;l&&(l.subtitleTrack=f)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var f=this.subtitleTrackController;return f?f.subtitleDisplay:!1},set:function(f){var l=this.subtitleTrackController;l&&(l.subtitleDisplay=f)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(f){this.config.lowLatencyMode=f}},{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 e.Events}},{key:"ErrorTypes",get:function(){return t.ErrorTypes}},{key:"ErrorDetails",get:function(){return t.ErrorDetails}},{key:"DefaultConfig",get:function(){return h.defaultConfig?h.defaultConfig:v.hlsDefaultConfig},set:function(f){h.defaultConfig=f}}]),h}();u.defaultConfig=void 0},"./src/is-supported.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"isSupported",function(){return L}),S.d(U,"changeTypeSupported",function(){return B});var k=S("./src/utils/mediasource-helper.ts");function D(){return self.SourceBuffer||self.WebKitSourceBuffer}function L(){var _=Object(k.getMediaSource)();if(!_)return!1;var A=D(),C=_&&typeof _.isTypeSupported=="function"&&_.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),s=!A||A.prototype&&typeof A.prototype.appendBuffer=="function"&&typeof A.prototype.remove=="function";return!!C&&!!s}function B(){var _,A=D();return typeof(A==null||((_=A.prototype)===null||_===void 0)?void 0:_.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"default",function(){return c}),S.d(U,"LoadError",function(){return x});var k=S("./src/polyfills/number.ts"),D=S("./src/errors.ts");function L(n,e){n.prototype=Object.create(e.prototype),n.prototype.constructor=n,s(n,e)}function B(n){var e=typeof Map=="function"?new Map:void 0;return B=function(i){if(i===null||!C(i))return i;if(typeof i!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e!="undefined"){if(e.has(i))return e.get(i);e.set(i,p)}function p(){return _(i,arguments,m(this).constructor)}return p.prototype=Object.create(i.prototype,{constructor:{value:p,enumerable:!1,writable:!0,configurable:!0}}),s(p,i)},B(n)}function _(n,e,t){return A()?_=Reflect.construct:_=function(p,u,h){var T=[null];T.push.apply(T,u);var g=Function.bind.apply(p,T),f=new g;return h&&s(f,h.prototype),f},_.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 C(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function s(n,e){return s=Object.setPrototypeOf||function(i,p){return i.__proto__=p,i},s(n,e)}function m(n){return m=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},m(n)}var b=Math.pow(2,17),c=function(){function n(t){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=t}var e=n.prototype;return e.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},e.abort=function(){this.loader&&this.loader.abort()},e.load=function(i,p){var u=this,h=i.url;if(!h)return Promise.reject(new x({type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:i,networkDetails:null},"Fragment does not have a "+(h?"part list":"url")));this.abort();var T=this.config,g=T.fLoader,f=T.loader;return new Promise(function(l,r){u.loader&&u.loader.destroy();var a=u.loader=i.loader=g?new g(T):new f(T),y=v(i),E={timeout:T.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:T.fragLoadingMaxRetryTimeout,highWaterMark:b};i.stats=a.stats,a.load(y,E,{onSuccess:function(R,M,N,j){u.resetLoader(i,a),l({frag:i,part:null,payload:R.data,networkDetails:j})},onError:function(R,M,N){u.resetLoader(i,a),r(new x({type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:i,response:R,networkDetails:N}))},onAbort:function(R,M,N){u.resetLoader(i,a),r(new x({type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:i,networkDetails:N}))},onTimeout:function(R,M,N){u.resetLoader(i,a),r(new x({type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:i,networkDetails:N}))},onProgress:function(R,M,N,j){p&&p({frag:i,part:null,payload:N,networkDetails:j})}})})},e.loadPart=function(i,p,u){var h=this;this.abort();var T=this.config,g=T.fLoader,f=T.loader;return new Promise(function(l,r){h.loader&&h.loader.destroy();var a=h.loader=i.loader=g?new g(T):new f(T),y=v(i,p),E={timeout:T.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:T.fragLoadingMaxRetryTimeout,highWaterMark:b};p.stats=a.stats,a.load(y,E,{onSuccess:function(R,M,N,j){h.resetLoader(i,a),h.updateStatsFromPart(i,p);var K={frag:i,part:p,payload:R.data,networkDetails:j};u(K),l(K)},onError:function(R,M,N){h.resetLoader(i,a),r(new x({type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:i,part:p,response:R,networkDetails:N}))},onAbort:function(R,M,N){i.stats.aborted=p.stats.aborted,h.resetLoader(i,a),r(new x({type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:i,part:p,networkDetails:N}))},onTimeout:function(R,M,N){h.resetLoader(i,a),r(new x({type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:i,part:p,networkDetails:N}))}})})},e.updateStatsFromPart=function(i,p){var u=i.stats,h=p.stats,T=h.total;if(u.loaded+=h.loaded,T){var g=Math.round(i.duration/p.duration),f=Math.min(Math.round(u.loaded/T),g),l=g-f,r=l*Math.round(u.loaded/f);u.total=u.loaded+r}else u.total=Math.max(u.loaded,u.total);var a=u.loading,y=h.loading;a.start?a.first+=y.first-y.start:(a.start=y.start,a.first=y.first),a.end=y.end},e.resetLoader=function(i,p){i.loader=null,this.loader===p&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),p.destroy()},n}();function v(n,e){e===void 0&&(e=null);var t=e||n,i={frag:n,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},p=t.byteRangeStartOffset,u=t.byteRangeEndOffset;return Object(k.isFiniteNumber)(p)&&Object(k.isFiniteNumber)(u)&&(i.rangeStart=p,i.rangeEnd=u),i}var x=function(n){L(e,n);function e(t){for(var i,p=arguments.length,u=new Array(p>1?p-1:0),h=1;h<p;h++)u[h-1]=arguments[h];return i=n.call.apply(n,[this].concat(u))||this,i.data=void 0,i.data=t,i}return e}(B(Error))},"./src/loader/fragment.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"ElementaryStreamTypes",function(){return c}),S.d(U,"BaseSegment",function(){return v}),S.d(U,"Fragment",function(){return x}),S.d(U,"Part",function(){return n});var k=S("./src/polyfills/number.ts"),D=S("./node_modules/url-toolkit/src/url-toolkit.js"),L=S.n(D),B=S("./src/utils/logger.ts"),_=S("./src/loader/level-key.ts"),A=S("./src/loader/load-stats.ts");function C(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,s(e,t)}function s(e,t){return s=Object.setPrototypeOf||function(p,u){return p.__proto__=u,p},s(e,t)}function m(e,t){for(var i=0;i<t.length;i++){var p=t[i];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(e,p.key,p)}}function b(e,t,i){return t&&m(e.prototype,t),i&&m(e,i),e}var c;(function(e){e.AUDIO="audio",e.VIDEO="video",e.AUDIOVIDEO="audiovideo"})(c||(c={}));var v=function(){function e(i){var p;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(p={},p[c.AUDIO]=null,p[c.VIDEO]=null,p[c.AUDIOVIDEO]=null,p),this.baseurl=i}var t=e.prototype;return t.setByteRange=function(p,u){var h=p.split("@",2),T=[];h.length===1?T[0]=u?u.byteRangeEndOffset:0:T[0]=parseInt(h[1]),T[1]=parseInt(h[0])+T[0],this._byteRange=T},b(e,[{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(D.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(p){this._url=p}}]),e}(),x=function(e){C(t,e);function t(p,u){var h;return h=e.call(this,u)||this,h._decryptdata=null,h.rawProgramDateTime=null,h.programDateTime=null,h.tagList=[],h.duration=0,h.sn=0,h.levelkey=void 0,h.type=void 0,h.loader=null,h.level=-1,h.cc=0,h.startPTS=void 0,h.endPTS=void 0,h.appendedPTS=void 0,h.startDTS=void 0,h.endDTS=void 0,h.start=0,h.deltaPTS=void 0,h.maxStartPTS=void 0,h.minEndPTS=void 0,h.stats=new A.LoadStats,h.urlId=0,h.data=void 0,h.bitrateTest=!1,h.title=null,h.initSegment=null,h.type=p,h}var i=t.prototype;return i.createInitializationVector=function(u){for(var h=new Uint8Array(16),T=12;T<16;T++)h[T]=u>>8*(15-T)&255;return h},i.setDecryptDataFromLevelKey=function(u,h){var T=u;return(u==null?void 0:u.method)==="AES-128"&&u.uri&&!u.iv&&(T=_.LevelKey.fromURI(u.uri),T.method=u.method,T.iv=this.createInitializationVector(h),T.keyFormat="identity"),T},i.setElementaryStreamInfo=function(u,h,T,g,f,l){l===void 0&&(l=!1);var r=this.elementaryStreams,a=r[u];if(!a){r[u]={startPTS:h,endPTS:T,startDTS:g,endDTS:f,partial:l};return}a.startPTS=Math.min(a.startPTS,h),a.endPTS=Math.max(a.endPTS,T),a.startDTS=Math.min(a.startDTS,g),a.endDTS=Math.max(a.endDTS,f)},i.clearElementaryStreamInfo=function(){var u=this.elementaryStreams;u[c.AUDIO]=null,u[c.VIDEO]=null,u[c.AUDIOVIDEO]=null},b(t,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var u=this.sn;typeof u!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&B.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),u=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,u)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(k.isFiniteNumber)(this.programDateTime))return null;var u=Object(k.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+u*1e3}},{key:"encrypted",get:function(){var u;return!!((u=this.decryptdata)!==null&&u!==void 0&&u.keyFormat&&this.decryptdata.uri)}}]),t}(v),n=function(e){C(t,e);function t(i,p,u,h,T){var g;g=e.call(this,u)||this,g.fragOffset=0,g.duration=0,g.gap=!1,g.independent=!1,g.relurl=void 0,g.fragment=void 0,g.index=void 0,g.stats=new A.LoadStats,g.duration=i.decimalFloatingPoint("DURATION"),g.gap=i.bool("GAP"),g.independent=i.bool("INDEPENDENT"),g.relurl=i.enumeratedString("URI"),g.fragment=p,g.index=h;var f=i.enumeratedString("BYTERANGE");return f&&g.setByteRange(f,T),T&&(g.fragOffset=T.fragOffset+T.duration),g}return b(t,[{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)}}]),t}(v)},"./src/loader/key-loader.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"default",function(){return B});var k=S("./src/events.ts"),D=S("./src/errors.ts"),L=S("./src/utils/logger.ts"),B=function(){function _(C){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=C,this._registerListeners()}var A=_.prototype;return A._registerListeners=function(){this.hls.on(k.Events.KEY_LOADING,this.onKeyLoading,this)},A._unregisterListeners=function(){this.hls.off(k.Events.KEY_LOADING,this.onKeyLoading)},A.destroy=function(){this._unregisterListeners();for(var s in this.loaders){var m=this.loaders[s];m&&m.destroy()}this.loaders={}},A.onKeyLoading=function(s,m){var b=m.frag,c=b.type,v=this.loaders[c];if(!b.decryptdata){L.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var x=b.decryptdata.uri;if(x!==this.decrypturl||this.decryptkey===null){var n=this.hls.config;if(v&&(L.logger.warn("abort previous key loader for type:"+c),v.abort()),!x){L.logger.warn("key uri is falsy");return}var e=n.loader,t=b.loader=this.loaders[c]=new e(n);this.decrypturl=x,this.decryptkey=null;var i={url:x,frag:b,responseType:"arraybuffer"},p={timeout:n.fragLoadingTimeOut,maxRetry:0,retryDelay:n.fragLoadingRetryDelay,maxRetryDelay:n.fragLoadingMaxRetryTimeout,highWaterMark:0},u={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};t.load(i,p,u)}else this.decryptkey&&(b.decryptdata.key=this.decryptkey,this.hls.trigger(k.Events.KEY_LOADED,{frag:b}))},A.loadsuccess=function(s,m,b){var c=b.frag;if(!c.decryptdata){L.logger.error("after key load, decryptdata unset");return}this.decryptkey=c.decryptdata.key=new Uint8Array(s.data),c.loader=null,delete this.loaders[c.type],this.hls.trigger(k.Events.KEY_LOADED,{frag:c})},A.loaderror=function(s,m){var b=m.frag,c=b.loader;c&&c.abort(),delete this.loaders[b.type],this.hls.trigger(k.Events.ERROR,{type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:b,response:s})},A.loadtimeout=function(s,m){var b=m.frag,c=b.loader;c&&c.abort(),delete this.loaders[b.type],this.hls.trigger(k.Events.ERROR,{type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:b})},_}()},"./src/loader/level-details.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"LevelDetails",function(){return _});var k=S("./src/polyfills/number.ts");function D(A,C){for(var s=0;s<C.length;s++){var m=C[s];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(A,m.key,m)}}function L(A,C,s){return C&&D(A.prototype,C),s&&D(A,s),A}var B=10,_=function(){function A(s){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=s}var C=A.prototype;return C.reloaded=function(m){if(!m){this.advanced=!0,this.updated=!0;return}var b=this.lastPartSn-m.lastPartSn,c=this.lastPartIndex-m.lastPartIndex;this.updated=this.endSN!==m.endSN||!!c||!!b,this.advanced=this.endSN>m.endSN||b>0||b===0&&c>0,this.updated||this.advanced?this.misses=Math.floor(m.misses*.6):this.misses=m.misses+1,this.availabilityDelay=m.availabilityDelay},L(A,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(k.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||B}},{key:"drift",get:function(){var m=this.driftEndTime-this.driftStartTime;if(m>0){var b=this.driftEnd-this.driftStart;return b*1e3/m}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var m;return(m=this.partList)!==null&&m!==void 0&&m.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var m;return(m=this.fragments)!==null&&m!==void 0&&m.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 m;return(m=this.partList)!==null&&m!==void 0&&m.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var m;return(m=this.partList)!==null&&m!==void 0&&m.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),A}()},"./src/loader/level-key.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"LevelKey",function(){return _});var k=S("./node_modules/url-toolkit/src/url-toolkit.js"),D=S.n(k);function L(A,C){for(var s=0;s<C.length;s++){var m=C[s];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(A,m.key,m)}}function B(A,C,s){return C&&L(A.prototype,C),s&&L(A,s),A}var _=function(){A.fromURL=function(s,m){return new A(s,m)},A.fromURI=function(s){return new A(s)};function A(C,s){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,s?this._uri=Object(k.buildAbsoluteURL)(C,s,{alwaysNormalize:!0}):this._uri=C}return B(A,[{key:"uri",get:function(){return this._uri}}]),A}()},"./src/loader/load-stats.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"LoadStats",function(){return k});var k=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(se,U,S){"use strict";S.r(U),S.d(U,"default",function(){return t});var k=S("./src/polyfills/number.ts"),D=S("./node_modules/url-toolkit/src/url-toolkit.js"),L=S.n(D),B=S("./src/loader/fragment.ts"),_=S("./src/loader/level-details.ts"),A=S("./src/loader/level-key.ts"),C=S("./src/utils/attr-list.ts"),s=S("./src/utils/logger.ts"),m=S("./src/utils/codecs.ts"),b=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,c=/#EXT-X-MEDIA:(.*)/g,v=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("|")),n=/\.(mp4|m4s|m4v|m4a)$/i;function e(T){var g,f;return n.test((g=(f=D.parseURL(T))===null||f===void 0?void 0:f.path)!=null?g:"")}var t=function(){function T(){}return T.findGroup=function(f,l){for(var r=0;r<f.length;r++){var a=f[r];if(a.id===l)return a}},T.convertAVC1ToAVCOTI=function(f){var l=f.split(".");if(l.length>2){var r=l.shift()+".";return r+=parseInt(l.shift()).toString(16),r+=("000"+parseInt(l.shift()).toString(16)).substr(-4),r}return f},T.resolve=function(f,l){return D.buildAbsoluteURL(l,f,{alwaysNormalize:!0})},T.parseMasterPlaylist=function(f,l){var r=[],a={},y=!1;b.lastIndex=0;for(var E;(E=b.exec(f))!=null;)if(E[1]){var w=new C.AttrList(E[1]),R={attrs:w,bitrate:w.decimalInteger("AVERAGE-BANDWIDTH")||w.decimalInteger("BANDWIDTH"),name:w.NAME,url:T.resolve(E[2],l)},M=w.decimalResolution("RESOLUTION");M&&(R.width=M.width,R.height=M.height),i((w.CODECS||"").split(/[ ,]+/).filter(function(j){return j}),R),R.videoCodec&&R.videoCodec.indexOf("avc1")!==-1&&(R.videoCodec=T.convertAVC1ToAVCOTI(R.videoCodec)),r.push(R)}else if(E[3]){var N=new C.AttrList(E[3]);N["DATA-ID"]&&(y=!0,a[N["DATA-ID"]]=N)}return{levels:r,sessionData:y?a:null}},T.parseMasterPlaylistMedia=function(f,l,r,a){a===void 0&&(a=[]);var y,E=[],w=0;for(c.lastIndex=0;(y=c.exec(f))!==null;){var R=new C.AttrList(y[1]);if(R.TYPE===r){var M={attrs:R,bitrate:0,id:w++,groupId:R["GROUP-ID"],instreamId:R["INSTREAM-ID"],name:R.NAME||R.LANGUAGE||"",type:r,default:R.bool("DEFAULT"),autoselect:R.bool("AUTOSELECT"),forced:R.bool("FORCED"),lang:R.LANGUAGE,url:R.URI?T.resolve(R.URI,l):""};if(a.length){var N=T.findGroup(a,M.groupId)||a[0];p(M,N,"audioCodec"),p(M,N,"textCodec")}E.push(M)}}return E},T.parseLevelPlaylist=function(f,l,r,a,y){var E=new _.LevelDetails(l),w=E.fragments,R=null,M=0,N=0,j=0,K=0,V=null,z=new B.Fragment(a,l),Q,ae,oe,Ce=-1,he=!1;for(v.lastIndex=0,E.m3u8=f;(Q=v.exec(f))!==null;){he&&(he=!1,z=new B.Fragment(a,l),z.start=j,z.sn=M,z.cc=K,z.level=r,R&&(z.initSegment=R,z.rawProgramDateTime=R.rawProgramDateTime));var fe=Q[1];if(fe){z.duration=parseFloat(fe);var pe=(" "+Q[2]).slice(1);z.title=pe||null,z.tagList.push(pe?["INF",fe,pe]:["INF",fe])}else if(Q[3])Object(k.isFiniteNumber)(z.duration)&&(z.start=j,oe&&(z.levelkey=oe),z.sn=M,z.level=r,z.cc=K,z.urlId=y,w.push(z),z.relurl=(" "+Q[3]).slice(1),h(z,V),V=z,j+=z.duration,M++,N=0,he=!0);else if(Q[4]){var me=(" "+Q[4]).slice(1);V?z.setByteRange(me,V):z.setByteRange(me)}else if(Q[5])z.rawProgramDateTime=(" "+Q[5]).slice(1),z.tagList.push(["PROGRAM-DATE-TIME",z.rawProgramDateTime]),Ce===-1&&(Ce=w.length);else{if(Q=Q[0].match(x),!Q){s.logger.warn("No matches on slow regex match for level playlist!");continue}for(ae=1;ae<Q.length&&!(typeof Q[ae]!="undefined");ae++);var ie=(" "+Q[ae]).slice(1),J=(" "+Q[ae+1]).slice(1),ye=Q[ae+2]?(" "+Q[ae+2]).slice(1):"";switch(ie){case"PLAYLIST-TYPE":E.type=J.toUpperCase();break;case"MEDIA-SEQUENCE":M=E.startSN=parseInt(J);break;case"SKIP":{var Pe=new C.AttrList(J),Le=Pe.decimalInteger("SKIPPED-SEGMENTS");if(Object(k.isFiniteNumber)(Le)){E.skippedSegments=Le;for(var Re=Le;Re--;)w.unshift(null);M+=Le}var X=Pe.enumeratedString("RECENTLY-REMOVED-DATERANGES");X&&(E.recentlyRemovedDateranges=X.split(" "));break}case"TARGETDURATION":E.targetduration=parseFloat(J);break;case"VERSION":E.version=parseInt(J);break;case"EXTM3U":break;case"ENDLIST":E.live=!1;break;case"#":(J||ye)&&z.tagList.push(ye?[J,ye]:[J]);break;case"DIS":K++;case"GAP":z.tagList.push([ie]);break;case"BITRATE":z.tagList.push([ie,J]);break;case"DISCONTINUITY-SEQ":K=parseInt(J);break;case"KEY":{var $,ne=new C.AttrList(J),de=ne.enumeratedString("METHOD"),be=ne.URI,ve=ne.hexadecimalInteger("IV"),Ee=ne.enumeratedString("KEYFORMATVERSIONS"),xe=ne.enumeratedString("KEYID"),Be=($=ne.enumeratedString("KEYFORMAT"))!=null?$:"identity",Ie=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Ie.indexOf(Be)>-1){s.logger.warn("Keyformat "+Be+" is not supported from the manifest");continue}else if(Be!=="identity")continue;de&&(oe=A.LevelKey.fromURL(l,be),be&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(de)>=0&&(oe.method=de,oe.keyFormat=Be,xe&&(oe.keyID=xe),Ee&&(oe.keyFormatVersions=Ee),oe.iv=ve));break}case"START":{var ke=new C.AttrList(J),Me=ke.decimalFloatingPoint("TIME-OFFSET");Object(k.isFiniteNumber)(Me)&&(E.startTimeOffset=Me);break}case"MAP":{var Ue=new C.AttrList(J);z.relurl=Ue.URI,Ue.BYTERANGE&&z.setByteRange(Ue.BYTERANGE),z.level=r,z.sn="initSegment",oe&&(z.levelkey=oe),z.initSegment=null,R=z,he=!0;break}case"SERVER-CONTROL":{var Fe=new C.AttrList(J);E.canBlockReload=Fe.bool("CAN-BLOCK-RELOAD"),E.canSkipUntil=Fe.optionalFloat("CAN-SKIP-UNTIL",0),E.canSkipDateRanges=E.canSkipUntil>0&&Fe.bool("CAN-SKIP-DATERANGES"),E.partHoldBack=Fe.optionalFloat("PART-HOLD-BACK",0),E.holdBack=Fe.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var je=new C.AttrList(J);E.partTarget=je.decimalFloatingPoint("PART-TARGET");break}case"PART":{var we=E.partList;we||(we=E.partList=[]);var Oe=N>0?we[we.length-1]:void 0,_e=N++,ge=new B.Part(new C.AttrList(J),z,l,_e,Oe);we.push(ge),z.duration+=ge.duration;break}case"PRELOAD-HINT":{var De=new C.AttrList(J);E.preloadHint=De;break}case"RENDITION-REPORT":{var re=new C.AttrList(J);E.renditionReports=E.renditionReports||[],E.renditionReports.push(re);break}default:s.logger.warn("line parsed but not handled: "+Q);break}}}V&&!V.relurl?(w.pop(),j-=V.duration,E.partList&&(E.fragmentHint=V)):E.partList&&(h(z,V),z.cc=K,E.fragmentHint=z);var ee=w.length,te=w[0],W=w[ee-1];if(j+=E.skippedSegments*E.targetduration,j>0&&ee&&W){E.averagetargetduration=j/ee;var G=W.sn;E.endSN=G!=="initSegment"?G:0,te&&(E.startCC=te.cc,te.initSegment||E.fragments.every(function(Y){return Y.relurl&&e(Y.relurl)})&&(s.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),z=new B.Fragment(a,l),z.relurl=W.relurl,z.level=r,z.sn="initSegment",te.initSegment=z,E.needSidxRanges=!0))}else E.endSN=0,E.startCC=0;return E.fragmentHint&&(j+=E.fragmentHint.duration),E.totalduration=j,E.endCC=K,Ce>0&&u(w,Ce),E},T}();function i(T,g){["video","audio","text"].forEach(function(f){var l=T.filter(function(a){return Object(m.isCodecType)(a,f)});if(l.length){var r=l.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});g[f+"Codec"]=r.length>0?r[0]:l[0],T=T.filter(function(a){return l.indexOf(a)===-1})}}),g.unknownCodecs=T}function p(T,g,f){var l=g[f];l&&(T[f]=l)}function u(T,g){for(var f=T[g],l=g;l--;){var r=T[l];if(!r)return;r.programDateTime=f.programDateTime-r.duration*1e3,f=r}}function h(T,g){T.rawProgramDateTime?T.programDateTime=Date.parse(T.rawProgramDateTime):g!=null&&g.programDateTime&&(T.programDateTime=g.endProgramDateTime),Object(k.isFiniteNumber)(T.programDateTime)||(T.programDateTime=null,T.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(se,U,S){"use strict";S.r(U);var k=S("./src/polyfills/number.ts"),D=S("./src/events.ts"),L=S("./src/errors.ts"),B=S("./src/utils/logger.ts"),_=S("./src/utils/mp4-tools.ts"),A=S("./src/loader/m3u8-parser.ts"),C=S("./src/types/loader.ts"),s=S("./src/utils/attr-list.ts");function m(v){var x=v.type;switch(x){case C.PlaylistContextType.AUDIO_TRACK:return C.PlaylistLevelType.AUDIO;case C.PlaylistContextType.SUBTITLE_TRACK:return C.PlaylistLevelType.SUBTITLE;default:return C.PlaylistLevelType.MAIN}}function b(v,x){var n=v.url;return(n===void 0||n.indexOf("data:")===0)&&(n=x.url),n}var c=function(){function v(n){this.hls=void 0,this.loaders=Object.create(null),this.hls=n,this.registerListeners()}var x=v.prototype;return x.registerListeners=function(){var e=this.hls;e.on(D.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(D.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(D.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(D.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},x.unregisterListeners=function(){var e=this.hls;e.off(D.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(D.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(D.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(D.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},x.createInternalLoader=function(e){var t=this.hls.config,i=t.pLoader,p=t.loader,u=i||p,h=new u(t);return e.loader=h,this.loaders[e.type]=h,h},x.getInternalLoader=function(e){return this.loaders[e.type]},x.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},x.destroyInternalLoaders=function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}},x.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},x.onManifestLoading=function(e,t){var i=t.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:C.PlaylistContextType.MANIFEST,url:i,deliveryDirectives:null})},x.onLevelLoading=function(e,t){var i=t.id,p=t.level,u=t.url,h=t.deliveryDirectives;this.load({id:i,groupId:null,level:p,responseType:"text",type:C.PlaylistContextType.LEVEL,url:u,deliveryDirectives:h})},x.onAudioTrackLoading=function(e,t){var i=t.id,p=t.groupId,u=t.url,h=t.deliveryDirectives;this.load({id:i,groupId:p,level:null,responseType:"text",type:C.PlaylistContextType.AUDIO_TRACK,url:u,deliveryDirectives:h})},x.onSubtitleTrackLoading=function(e,t){var i=t.id,p=t.groupId,u=t.url,h=t.deliveryDirectives;this.load({id:i,groupId:p,level:null,responseType:"text",type:C.PlaylistContextType.SUBTITLE_TRACK,url:u,deliveryDirectives:h})},x.load=function(e){var t,i=this.hls.config,p=this.getInternalLoader(e);if(p){var u=p.context;if(u&&u.url===e.url){B.logger.trace("[playlist-loader]: playlist request ongoing");return}B.logger.log("[playlist-loader]: aborting previous loader for type: "+e.type),p.abort()}var h,T,g,f;switch(e.type){case C.PlaylistContextType.MANIFEST:h=i.manifestLoadingMaxRetry,T=i.manifestLoadingTimeOut,g=i.manifestLoadingRetryDelay,f=i.manifestLoadingMaxRetryTimeout;break;case C.PlaylistContextType.LEVEL:case C.PlaylistContextType.AUDIO_TRACK:case C.PlaylistContextType.SUBTITLE_TRACK:h=0,T=i.levelLoadingTimeOut;break;default:h=i.levelLoadingMaxRetry,T=i.levelLoadingTimeOut,g=i.levelLoadingRetryDelay,f=i.levelLoadingMaxRetryTimeout;break}if(p=this.createInternalLoader(e),(t=e.deliveryDirectives)!==null&&t!==void 0&&t.part){var l;if(e.type===C.PlaylistContextType.LEVEL&&e.level!==null?l=this.hls.levels[e.level].details:e.type===C.PlaylistContextType.AUDIO_TRACK&&e.id!==null?l=this.hls.audioTracks[e.id].details:e.type===C.PlaylistContextType.SUBTITLE_TRACK&&e.id!==null&&(l=this.hls.subtitleTracks[e.id].details),l){var r=l.partTarget,a=l.targetduration;r&&a&&(T=Math.min(Math.max(r*3,a*.8)*1e3,T))}}var y={timeout:T,maxRetry:h,retryDelay:g,maxRetryDelay:f,highWaterMark:0},E={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};p.load(e,y,E)},x.loadsuccess=function(e,t,i,p){if(p===void 0&&(p=null),i.isSidxRequest){this.handleSidxRequest(e,i),this.handlePlaylistLoaded(e,t,i,p);return}this.resetInternalLoader(i.type);var u=e.data;if(u.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(e,i,"no EXTM3U delimiter",p);return}t.parsing.start=performance.now(),u.indexOf("#EXTINF:")>0||u.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(e,t,i,p):this.handleMasterPlaylist(e,t,i,p)},x.loaderror=function(e,t,i){i===void 0&&(i=null),this.handleNetworkError(t,i,!1,e)},x.loadtimeout=function(e,t,i){i===void 0&&(i=null),this.handleNetworkError(t,i,!0)},x.handleMasterPlaylist=function(e,t,i,p){var u=this.hls,h=e.data,T=b(e,i),g=A.default.parseMasterPlaylist(h,T),f=g.levels,l=g.sessionData;if(!f.length){this.handleManifestParsingError(e,i,"no level found in manifest",p);return}var r=f.map(function(M){return{id:M.attrs.AUDIO,audioCodec:M.audioCodec}}),a=f.map(function(M){return{id:M.attrs.SUBTITLES,textCodec:M.textCodec}}),y=A.default.parseMasterPlaylistMedia(h,T,"AUDIO",r),E=A.default.parseMasterPlaylistMedia(h,T,"SUBTITLES",a),w=A.default.parseMasterPlaylistMedia(h,T,"CLOSED-CAPTIONS");if(y.length){var R=y.some(function(M){return!M.url});!R&&f[0].audioCodec&&!f[0].attrs.AUDIO&&(B.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),y.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new s.AttrList({}),bitrate:0,url:""}))}u.trigger(D.Events.MANIFEST_LOADED,{levels:f,audioTracks:y,subtitles:E,captions:w,url:T,stats:t,networkDetails:p,sessionData:l})},x.handleTrackOrLevelPlaylist=function(e,t,i,p){var u=this.hls,h=i.id,T=i.level,g=i.type,f=b(e,i),l=Object(k.isFiniteNumber)(h)?h:0,r=Object(k.isFiniteNumber)(T)?T:l,a=m(i),y=A.default.parseLevelPlaylist(e.data,f,r,a,l);if(!y.fragments.length){u.trigger(D.Events.ERROR,{type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:f,reason:"no fragments found in level",level:typeof i.level=="number"?i.level:void 0});return}if(g===C.PlaylistContextType.MANIFEST){var E={attrs:new s.AttrList({}),bitrate:0,details:y,name:"",url:f};u.trigger(D.Events.MANIFEST_LOADED,{levels:[E],audioTracks:[],url:f,stats:t,networkDetails:p,sessionData:null})}if(t.parsing.end=performance.now(),y.needSidxRanges){var w,R=(w=y.fragments[0].initSegment)===null||w===void 0?void 0:w.url;this.load({url:R,isSidxRequest:!0,type:g,level:T,levelDetails:y,id:h,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}i.levelDetails=y,this.handlePlaylistLoaded(e,t,i,p)},x.handleSidxRequest=function(e,t){var i=Object(_.parseSegmentIndex)(new Uint8Array(e.data));if(!i)return;var p=i.references,u=t.levelDetails;p.forEach(function(h,T){var g=h.info,f=u.fragments[T];f.byteRange.length===0&&f.setByteRange(String(1+g.end-g.start)+"@"+String(g.start)),f.initSegment&&f.initSegment.setByteRange(String(i.moovEndOffset)+"@0")})},x.handleManifestParsingError=function(e,t,i,p){this.hls.trigger(D.Events.ERROR,{type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:t.type===C.PlaylistContextType.MANIFEST,url:e.url,reason:i,response:e,context:t,networkDetails:p})},x.handleNetworkError=function(e,t,i,p){i===void 0&&(i=!1),B.logger.warn("[playlist-loader]: A network "+(i?"timeout":"error")+" occurred while loading "+e.type+" level: "+e.level+" id: "+e.id+' group-id: "'+e.groupId+'"');var u=L.ErrorDetails.UNKNOWN,h=!1,T=this.getInternalLoader(e);switch(e.type){case C.PlaylistContextType.MANIFEST:u=i?L.ErrorDetails.MANIFEST_LOAD_TIMEOUT:L.ErrorDetails.MANIFEST_LOAD_ERROR,h=!0;break;case C.PlaylistContextType.LEVEL:u=i?L.ErrorDetails.LEVEL_LOAD_TIMEOUT:L.ErrorDetails.LEVEL_LOAD_ERROR,h=!1;break;case C.PlaylistContextType.AUDIO_TRACK:u=i?L.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:L.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,h=!1;break;case C.PlaylistContextType.SUBTITLE_TRACK:u=i?L.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:L.ErrorDetails.SUBTITLE_LOAD_ERROR,h=!1;break}T&&this.resetInternalLoader(e.type);var g={type:L.ErrorTypes.NETWORK_ERROR,details:u,fatal:h,url:e.url,loader:T,context:e,networkDetails:t};p&&(g.response=p),this.hls.trigger(D.Events.ERROR,g)},x.handlePlaylistLoaded=function(e,t,i,p){var u=i.type,h=i.level,T=i.id,g=i.groupId,f=i.loader,l=i.levelDetails,r=i.deliveryDirectives;if(!(l!=null&&l.targetduration)){this.handleManifestParsingError(e,i,"invalid target duration",p);return}if(!f)return;l.live&&(f.getCacheAge&&(l.ageHeader=f.getCacheAge()||0),(!f.getCacheAge||isNaN(l.ageHeader))&&(l.ageHeader=0));switch(u){case C.PlaylistContextType.MANIFEST:case C.PlaylistContextType.LEVEL:this.hls.trigger(D.Events.LEVEL_LOADED,{details:l,level:h||0,id:T||0,stats:t,networkDetails:p,deliveryDirectives:r});break;case C.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(D.Events.AUDIO_TRACK_LOADED,{details:l,id:T||0,groupId:g||"",stats:t,networkDetails:p,deliveryDirectives:r});break;case C.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(D.Events.SUBTITLE_TRACK_LOADED,{details:l,id:T||0,groupId:g||"",stats:t,networkDetails:p,deliveryDirectives:r});break}},v}();U.default=c},"./src/polyfills/number.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"isFiniteNumber",function(){return k}),S.d(U,"MAX_SAFE_INTEGER",function(){return D});var k=Number.isFinite||function(L){return typeof L=="number"&&isFinite(L)},D=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(se,U,S){"use strict";S.r(U);var k=function(){function D(){}return D.getSilentFrame=function(B,_){switch(B){case"mp4a.40.2":if(_===1)return new Uint8Array([0,200,0,128,35,128]);if(_===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(_===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(_===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(_===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(_===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(_===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(_===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(_===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},D}();U.default=k},"./src/remux/mp4-generator.ts":function(se,U,S){"use strict";S.r(U);var k=Math.pow(2,32)-1,D=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 _;for(_ in L.types)L.types.hasOwnProperty(_)&&(L.types[_]=[_.charCodeAt(0),_.charCodeAt(1),_.charCodeAt(2),_.charCodeAt(3)]);var A=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]),C=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:A,audio:C};var s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),m=new Uint8Array([0,0,0,0,0,0,0,0]);L.STTS=L.STSC=L.STCO=m,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 b=new Uint8Array([105,115,111,109]),c=new Uint8Array([97,118,99,49]),v=new Uint8Array([0,0,0,1]);L.FTYP=L.box(L.types.ftyp,b,v,b,c),L.DINF=L.box(L.types.dinf,L.box(L.types.dref,s))},L.box=function(_){for(var A=8,C=arguments.length,s=new Array(C>1?C-1:0),m=1;m<C;m++)s[m-1]=arguments[m];for(var b=s.length,c=b;b--;)A+=s[b].byteLength;var v=new Uint8Array(A);for(v[0]=A>>24&255,v[1]=A>>16&255,v[2]=A>>8&255,v[3]=A&255,v.set(_,4),b=0,A=8;b<c;b++)v.set(s[b],A),A+=s[b].byteLength;return v},L.hdlr=function(_){return L.box(L.types.hdlr,L.HDLR_TYPES[_])},L.mdat=function(_){return L.box(L.types.mdat,_)},L.mdhd=function(_,A){A*=_;var C=Math.floor(A/(k+1)),s=Math.floor(A%(k+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,_>>24&255,_>>16&255,_>>8&255,_&255,C>>24,C>>16&255,C>>8&255,C&255,s>>24,s>>16&255,s>>8&255,s&255,85,196,0,0]))},L.mdia=function(_){return L.box(L.types.mdia,L.mdhd(_.timescale,_.duration),L.hdlr(_.type),L.minf(_))},L.mfhd=function(_){return L.box(L.types.mfhd,new Uint8Array([0,0,0,0,_>>24,_>>16&255,_>>8&255,_&255]))},L.minf=function(_){return _.type==="audio"?L.box(L.types.minf,L.box(L.types.smhd,L.SMHD),L.DINF,L.stbl(_)):L.box(L.types.minf,L.box(L.types.vmhd,L.VMHD),L.DINF,L.stbl(_))},L.moof=function(_,A,C){return L.box(L.types.moof,L.mfhd(_),L.traf(C,A))},L.moov=function(_){for(var A=_.length,C=[];A--;)C[A]=L.trak(_[A]);return L.box.apply(null,[L.types.moov,L.mvhd(_[0].timescale,_[0].duration)].concat(C).concat(L.mvex(_)))},L.mvex=function(_){for(var A=_.length,C=[];A--;)C[A]=L.trex(_[A]);return L.box.apply(null,[L.types.mvex].concat(C))},L.mvhd=function(_,A){A*=_;var C=Math.floor(A/(k+1)),s=Math.floor(A%(k+1)),m=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,_>>24&255,_>>16&255,_>>8&255,_&255,C>>24,C>>16&255,C>>8&255,C&255,s>>24,s>>16&255,s>>8&255,s&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return L.box(L.types.mvhd,m)},L.sdtp=function(_){var A=_.samples||[],C=new Uint8Array(4+A.length),s,m;for(s=0;s<A.length;s++)m=A[s].flags,C[s+4]=m.dependsOn<<4|m.isDependedOn<<2|m.hasRedundancy;return L.box(L.types.sdtp,C)},L.stbl=function(_){return L.box(L.types.stbl,L.stsd(_),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(_){var A=[],C=[],s,m,b;for(s=0;s<_.sps.length;s++)m=_.sps[s],b=m.byteLength,A.push(b>>>8&255),A.push(b&255),A=A.concat(Array.prototype.slice.call(m));for(s=0;s<_.pps.length;s++)m=_.pps[s],b=m.byteLength,C.push(b>>>8&255),C.push(b&255),C=C.concat(Array.prototype.slice.call(m));var c=L.box(L.types.avcC,new Uint8Array([1,A[3],A[4],A[5],252|3,224|_.sps.length].concat(A).concat([_.pps.length]).concat(C))),v=_.width,x=_.height,n=_.pixelRatio[0],e=_.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,v>>8&255,v&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]),c,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([n>>24,n>>16&255,n>>8&255,n&255,e>>24,e>>16&255,e>>8&255,e&255])))},L.esds=function(_){var A=_.config.length;return new Uint8Array([0,0,0,0,3,23+A,0,1,0,4,15+A,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([A]).concat(_.config).concat([6,1,2]))},L.mp4a=function(_){var A=_.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,_.channelCount,0,16,0,0,0,0,A>>8&255,A&255,0,0]),L.box(L.types.esds,L.esds(_)))},L.mp3=function(_){var A=_.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,_.channelCount,0,16,0,0,0,0,A>>8&255,A&255,0,0]))},L.stsd=function(_){return _.type==="audio"?!_.isAAC&&_.codec==="mp3"?L.box(L.types.stsd,L.STSD,L.mp3(_)):L.box(L.types.stsd,L.STSD,L.mp4a(_)):L.box(L.types.stsd,L.STSD,L.avc1(_))},L.tkhd=function(_){var A=_.id,C=_.duration*_.timescale,s=_.width,m=_.height,b=Math.floor(C/(k+1)),c=Math.floor(C%(k+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,A>>24&255,A>>16&255,A>>8&255,A&255,0,0,0,0,b>>24,b>>16&255,b>>8&255,b&255,c>>24,c>>16&255,c>>8&255,c&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,s>>8&255,s&255,0,0,m>>8&255,m&255,0,0]))},L.traf=function(_,A){var C=L.sdtp(_),s=_.id,m=Math.floor(A/(k+1)),b=Math.floor(A%(k+1));return L.box(L.types.traf,L.box(L.types.tfhd,new Uint8Array([0,0,0,0,s>>24,s>>16&255,s>>8&255,s&255])),L.box(L.types.tfdt,new Uint8Array([1,0,0,0,m>>24,m>>16&255,m>>8&255,m&255,b>>24,b>>16&255,b>>8&255,b&255])),L.trun(_,C.length+16+20+8+16+8+8),C)},L.trak=function(_){return _.duration=_.duration||4294967295,L.box(L.types.trak,L.tkhd(_),L.mdia(_))},L.trex=function(_){var A=_.id;return L.box(L.types.trex,new Uint8Array([0,0,0,0,A>>24,A>>16&255,A>>8&255,A&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},L.trun=function(_,A){var C=_.samples||[],s=C.length,m=12+16*s,b=new Uint8Array(m),c,v,x,n,e,t;for(A+=8+m,b.set([0,0,15,1,s>>>24&255,s>>>16&255,s>>>8&255,s&255,A>>>24&255,A>>>16&255,A>>>8&255,A&255],0),c=0;c<s;c++)v=C[c],x=v.duration,n=v.size,e=v.flags,t=v.cts,b.set([x>>>24&255,x>>>16&255,x>>>8&255,x&255,n>>>24&255,n>>>16&255,n>>>8&255,n&255,e.isLeading<<2|e.dependsOn,e.isDependedOn<<6|e.hasRedundancy<<4|e.paddingValue<<1|e.isNonSync,e.degradPrio&240<<8,e.degradPrio&15,t>>>24&255,t>>>16&255,t>>>8&255,t&255],12+16*c);return L.box(L.types.trun,b)},L.initSegment=function(_){L.types||L.init();var A=L.moov(_),C=new Uint8Array(L.FTYP.byteLength+A.byteLength);return C.set(L.FTYP),C.set(A,L.FTYP.byteLength),C},L}();D.types=void 0,D.HDLR_TYPES=void 0,D.STTS=void 0,D.STSC=void 0,D.STCO=void 0,D.STSZ=void 0,D.VMHD=void 0,D.SMHD=void 0,D.STSD=void 0,D.FTYP=void 0,D.DINF=void 0,U.default=D},"./src/remux/mp4-remuxer.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"default",function(){return t}),S.d(U,"normalizePts",function(){return i});var k=S("./src/polyfills/number.ts"),D=S("./src/remux/aac-helper.ts"),L=S("./src/remux/mp4-generator.ts"),B=S("./src/events.ts"),_=S("./src/errors.ts"),A=S("./src/utils/logger.ts"),C=S("./src/types/loader.ts"),s=S("./src/utils/timescale-conversion.ts");function m(){return m=Object.assign||function(T){for(var g=1;g<arguments.length;g++){var f=arguments[g];for(var l in f)Object.prototype.hasOwnProperty.call(f,l)&&(T[l]=f[l])}return T},m.apply(this,arguments)}var b=10*1e3,c=1024,v=1152,x=null,n=null,e=!1,t=function(){function T(f,l,r,a){if(a===void 0&&(a=""),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=f,this.config=l,this.typeSupported=r,this.ISGenerated=!1,x===null){var y=navigator.userAgent||"",E=y.match(/Chrome\/(\d+)/i);x=E?parseInt(E[1]):0}if(n===null){var w=navigator.userAgent.match(/Safari\/(\d+)/i);n=w?parseInt(w[1]):0}e=!!x&&x<75||!!n&&n<600}var g=T.prototype;return g.destroy=function(){},g.resetTimeStamp=function(l){A.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=l},g.resetNextTimestamp=function(){A.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},g.resetInitSegment=function(){A.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},g.getVideoStartPts=function(l){var r=!1,a=l.reduce(function(y,E){var w=E.pts-y;return w<-4294967296?(r=!0,i(y,E.pts)):w>0?y:E.pts},l[0].pts);return r&&A.logger.debug("PTS rollover detected"),a},g.remux=function(l,r,a,y,E,w,R,M){var N,j,K,V,z,Q,ae=E,oe=E,Ce=l.pid>-1,he=r.pid>-1,fe=r.samples.length,pe=l.samples.length>0,me=fe>1,ie=(!Ce||pe)&&(!he||me)||this.ISGenerated||R;if(ie){this.ISGenerated||(K=this.generateIS(l,r,E));var J=this.isVideoContiguous,ye=-1;if(me&&(ye=p(r.samples),!J&&this.config.forceKeyFrameOnDiscontinuity))if(Q=!0,ye>0){A.logger.warn("[mp4-remuxer]: Dropped "+ye+" out of "+fe+" video samples due to a missing keyframe");var Pe=this.getVideoStartPts(r.samples);r.samples=r.samples.slice(ye),r.dropped+=ye,oe+=(r.samples[0].pts-Pe)/(r.timescale||9e4)}else ye===-1&&(A.logger.warn("[mp4-remuxer]: No keyframe found out of "+fe+" video samples"),Q=!1);if(this.ISGenerated){if(pe&&me){var Le=this.getVideoStartPts(r.samples),Re=i(l.samples[0].pts,Le)-Le,X=Re/r.inputTimeScale;ae+=Math.max(0,X),oe+=Math.max(0,-X)}if(pe){if(l.samplerate||(A.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),K=this.generateIS(l,r,E)),j=this.remuxAudio(l,ae,this.isAudioContiguous,w,he||me||M===C.PlaylistLevelType.AUDIO?oe:void 0),me){var $=j?j.endPTS-j.startPTS:0;r.inputTimeScale||(A.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),K=this.generateIS(l,r,E)),N=this.remuxVideo(r,oe,J,$)}}else me&&(N=this.remuxVideo(r,oe,J,0));N&&(N.firstKeyFrame=ye,N.independent=ye!==-1)}}return this.ISGenerated&&(a.samples.length&&(z=this.remuxID3(a,E)),y.samples.length&&(V=this.remuxText(y,E))),{audio:j,video:N,initSegment:K,independent:Q,text:V,id3:z}},g.generateIS=function(l,r,a){var y=l.samples,E=r.samples,w=this.typeSupported,R={},M=!Object(k.isFiniteNumber)(this._initPTS),N="audio/mp4",j,K,V;if(M&&(j=K=Infinity),l.config&&y.length&&(l.timescale=l.samplerate,l.isAAC||(w.mpeg?(N="audio/mpeg",l.codec=""):w.mp3&&(l.codec="mp3")),R.audio={id:"audio",container:N,codec:l.codec,initSegment:!l.isAAC&&w.mpeg?new Uint8Array(0):L.default.initSegment([l]),metadata:{channelCount:l.channelCount}},M&&(V=l.inputTimeScale,j=K=y[0].pts-Math.round(V*a))),r.sps&&r.pps&&E.length&&(r.timescale=r.inputTimeScale,R.video={id:"main",container:"video/mp4",codec:r.codec,initSegment:L.default.initSegment([r]),metadata:{width:r.width,height:r.height}},M)){V=r.inputTimeScale;var z=this.getVideoStartPts(E),Q=Math.round(V*a);K=Math.min(K,i(E[0].dts,z)-Q),j=Math.min(j,z-Q)}if(Object.keys(R).length)return this.ISGenerated=!0,M&&(this._initPTS=j,this._initDTS=K),{tracks:R,initPTS:j,timescale:V}},g.remuxVideo=function(l,r,a,y){var E=l.inputTimeScale,w=l.samples,R=[],M=w.length,N=this._initPTS,j=this.nextAvcDts,K=8,V,z,Q,ae=Number.POSITIVE_INFINITY,oe=Number.NEGATIVE_INFINITY,Ce=0,he=!1;if(!a||j===null){var fe=r*E,pe=w[0].pts-i(w[0].dts,w[0].pts);j=fe-pe}for(var me=0;me<M;me++){var ie=w[me];if(ie.pts=i(ie.pts-N,j),ie.dts=i(ie.dts-N,j),ie.dts>ie.pts){var J=9e4*.2;Ce=Math.max(Math.min(Ce,ie.pts-ie.dts),-1*J)}ie.dts<w[me>0?me-1:me].dts&&(he=!0)}he&&w.sort(function(Je,qe){var ze=Je.dts-qe.dts,nt=Je.pts-qe.pts;return ze||nt}),z=w[0].dts,Q=w[w.length-1].dts;var ye=Math.round((Q-z)/(M-1));if(Ce<0){if(Ce<ye*-2){A.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(s.toMsFromMpegTsClock)(-ye,!0)+" ms");for(var Pe=Ce,Le=0;Le<M;Le++)w[Le].dts=Pe=Math.max(Pe,w[Le].pts-ye),w[Le].pts=Math.max(Pe,w[Le].pts)}else{A.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(s.toMsFromMpegTsClock)(Ce,!0)+" ms to overcome this issue");for(var Re=0;Re<M;Re++)w[Re].dts=w[Re].dts+Ce}z=w[0].dts}if(a){var X=z-j,$=X>ye,ne=X<-1;if($||ne){$?A.logger.warn("AVC: "+Object(s.toMsFromMpegTsClock)(X,!0)+" ms ("+X+"dts) hole between fragments detected, filling it"):A.logger.warn("AVC: "+Object(s.toMsFromMpegTsClock)(-X,!0)+" ms ("+X+"dts) overlapping between fragments detected"),z=j;var de=w[0].pts-X;w[0].dts=z,w[0].pts=de,A.logger.log("Video: First PTS/DTS adjusted: "+Object(s.toMsFromMpegTsClock)(de,!0)+"/"+Object(s.toMsFromMpegTsClock)(z,!0)+", delta: "+Object(s.toMsFromMpegTsClock)(X,!0)+" ms")}}e&&(z=Math.max(0,z));for(var be=0,ve=0,Ee=0;Ee<M;Ee++){for(var xe=w[Ee],Be=xe.units,Ie=Be.length,ke=0,Me=0;Me<Ie;Me++)ke+=Be[Me].data.length;ve+=ke,be+=Ie,xe.length=ke,xe.dts=Math.max(xe.dts,z),xe.pts=Math.max(xe.pts,xe.dts,0),ae=Math.min(xe.pts,ae),oe=Math.max(xe.pts,oe)}Q=w[M-1].dts;var Ue=ve+4*be+8,Fe;try{Fe=new Uint8Array(Ue)}catch(Je){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:_.ErrorTypes.MUX_ERROR,details:_.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ue,reason:"fail allocating video mdat "+Ue});return}var je=new DataView(Fe.buffer);je.setUint32(0,Ue),Fe.set(L.default.types.mdat,4);for(var we=0;we<M;we++){for(var Oe=w[we],_e=Oe.units,ge=0,De=0,re=_e.length;De<re;De++){var ee=_e[De],te=ee.data,W=ee.data.byteLength;je.setUint32(K,W),K+=4,Fe.set(te,K),K+=W,ge+=4+W}if(we<M-1)V=w[we+1].dts-Oe.dts;else{var G=this.config,Y=Oe.dts-w[we>0?we-1:we].dts;if(G.stretchShortVideoTrack&&this.nextAudioPts!==null){var q=Math.floor(G.maxBufferHole*E),ue=(y?ae+y*E:this.nextAudioPts)-Oe.pts;ue>q?(V=ue-Y,V<0&&(V=Y),A.logger.log("[mp4-remuxer]: It is approximately "+ue/90+" ms to the next segment; using duration "+V/90+" ms for the last video frame.")):V=Y}else V=Y}var ce=Math.round(Oe.pts-Oe.dts);R.push(new u(Oe.key,V,ge,ce))}if(R.length&&x&&x<70){var Ae=R[0].flags;Ae.dependsOn=2,Ae.isNonSync=0}console.assert(V!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=j=Q+V,this.isVideoContiguous=!0;var Ge=L.default.moof(l.sequenceNumber++,z,m({},l,{samples:R})),Xe="video",He={data1:Ge,data2:Fe,startPTS:ae/E,endPTS:(oe+V)/E,startDTS:z/E,endDTS:j/E,type:Xe,hasAudio:!1,hasVideo:!0,nb:R.length,dropped:l.dropped};return l.samples=[],l.dropped=0,console.assert(Fe.length,"MDAT length must not be zero"),He},g.remuxAudio=function(l,r,a,y,E){var w=l.inputTimeScale,R=l.samplerate?l.samplerate:w,M=w/R,N=l.isAAC?c:v,j=N*M,K=this._initPTS,V=!l.isAAC&&this.typeSupported.mpeg,z=[],Q=l.samples,ae=V?0:8,oe=this.nextAudioPts||-1,Ce=r*w;if(this.isAudioContiguous=a=a||Q.length&&oe>0&&(y&&Math.abs(Ce-oe)<9e3||Math.abs(i(Q[0].pts-K,Ce)-oe)<20*j),Q.forEach(function(te){te.pts=i(te.pts-K,Ce)}),!a||oe<0){if(Q=Q.filter(function(te){return te.pts>=0}),!Q.length)return;E===0?oe=0:y?oe=Math.max(0,Ce):oe=Q[0].pts}if(l.isAAC)for(var he=E!==void 0,fe=this.config.maxAudioFramesDrift,pe=0,me=oe;pe<Q.length;pe++){var ie=Q[pe],J=ie.pts,ye=J-me,Pe=Math.abs(1e3*ye/w);if(ye<=-fe*j&&he)pe===0&&(A.logger.warn("Audio frame @ "+(J/w).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*ye/w)+" ms."),this.nextAudioPts=oe=me=J);else if(ye>=fe*j&&Pe<b&&he){var Le=Math.round(ye/j);me=J-Le*j,me<0&&(Le--,me+=j),pe===0&&(this.nextAudioPts=oe=me),A.logger.warn("[mp4-remuxer]: Injecting "+Le+" audio frame @ "+(me/w).toFixed(3)+"s due to "+Math.round(1e3*ye/w)+" ms gap.");for(var Re=0;Re<Le;Re++){var X=Math.max(me,0),$=D.default.getSilentFrame(l.manifestCodec||l.codec,l.channelCount);$||(A.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),$=ie.unit.subarray()),Q.splice(pe,0,{unit:$,pts:X}),me+=j,pe++}}ie.pts=me,me+=j}for(var ne=null,de=null,be,ve=0,Ee=Q.length;Ee--;)ve+=Q[Ee].unit.byteLength;for(var xe=0,Be=Q.length;xe<Be;xe++){var Ie=Q[xe],ke=Ie.unit,Me=Ie.pts;if(de!==null){var Ue=z[xe-1];Ue.duration=Math.round((Me-de)/M)}else if(a&&l.isAAC&&(Me=oe),ne=Me,ve>0){ve+=ae;try{be=new Uint8Array(ve)}catch(te){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:_.ErrorTypes.MUX_ERROR,details:_.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ve,reason:"fail allocating audio mdat "+ve});return}if(!V){var Fe=new DataView(be.buffer);Fe.setUint32(0,ve),be.set(L.default.types.mdat,4)}}else return;be.set(ke,ae);var je=ke.byteLength;ae+=je,z.push(new u(!0,N,je,0)),de=Me}var we=z.length;if(!we)return;var Oe=z[z.length-1];this.nextAudioPts=oe=de+M*Oe.duration;var _e=V?new Uint8Array(0):L.default.moof(l.sequenceNumber++,ne/M,m({},l,{samples:z}));l.samples=[];var ge=ne/w,De=oe/w,re="audio",ee={data1:_e,data2:be,startPTS:ge,endPTS:De,startDTS:ge,endDTS:De,type:re,hasAudio:!0,hasVideo:!1,nb:we};return this.isAudioContiguous=!0,console.assert(be.length,"MDAT length must not be zero"),ee},g.remuxEmptyAudio=function(l,r,a,y){var E=l.inputTimeScale,w=l.samplerate?l.samplerate:E,R=E/w,M=this.nextAudioPts,N=(M!==null?M:y.startDTS*E)+this._initDTS,j=y.endDTS*E+this._initDTS,K=R*c,V=Math.ceil((j-N)/K),z=D.default.getSilentFrame(l.manifestCodec||l.codec,l.channelCount);if(A.logger.warn("[mp4-remuxer]: remux empty Audio"),!z){A.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var Q=[],ae=0;ae<V;ae++){var oe=N+ae*K;Q.push({unit:z,pts:oe,dts:oe})}return l.samples=Q,this.remuxAudio(l,r,a,!1)},g.remuxID3=function(l,r){var a=l.samples.length;if(!a)return;for(var y=l.inputTimeScale,E=this._initPTS,w=this._initDTS,R=0;R<a;R++){var M=l.samples[R];M.pts=i(M.pts-E,r*y)/y,M.dts=i(M.dts-w,r*y)/y}var N=l.samples;return l.samples=[],{samples:N}},g.remuxText=function(l,r){var a=l.samples.length;if(!a)return;for(var y=l.inputTimeScale,E=this._initPTS,w=0;w<a;w++){var R=l.samples[w];R.pts=i(R.pts-E,r*y)/y}l.samples.sort(function(N,j){return N.pts-j.pts});var M=l.samples;return l.samples=[],{samples:M}},T}();function i(T,g){var f;if(g===null)return T;for(g<T?f=-8589934592:f=8589934592;Math.abs(T-g)>4294967296;)T+=f;return T}function p(T){for(var g=0;g<T.length;g++)if(T[g].key)return g;return-1}var u=function(g,f,l,r){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=f,this.size=l,this.cts=r,this.flags=new h(g)},h=function(g){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=g?2:1,this.isNonSync=g?0:1}},"./src/remux/passthrough-remuxer.ts":function(se,U,S){"use strict";S.r(U);var k=S("./src/polyfills/number.ts"),D=S("./src/utils/mp4-tools.ts"),L=S("./src/loader/fragment.ts"),B=S("./src/utils/logger.ts"),_=function(){function s(){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 m=s.prototype;return m.destroy=function(){},m.resetTimeStamp=function(c){this.initPTS=c,this.lastEndDTS=null},m.resetNextTimestamp=function(){this.lastEndDTS=null},m.resetInitSegment=function(c,v,x){this.audioCodec=v,this.videoCodec=x,this.generateInitSegment(c),this.emitInitSegment=!0},m.generateInitSegment=function(c){var v=this.audioCodec,x=this.videoCodec;if(!c||!c.byteLength){this.initTracks=void 0,this.initData=void 0;return}var n=this.initData=Object(D.parseInitSegment)(c);v||(v=C(n.audio,L.ElementaryStreamTypes.AUDIO)),x||(x=C(n.video,L.ElementaryStreamTypes.VIDEO));var e={};n.audio&&n.video?e.audiovideo={container:"video/mp4",codec:v+","+x,initSegment:c,id:"main"}:n.audio?e.audio={container:"audio/mp4",codec:v,initSegment:c,id:"audio"}:n.video?e.video={container:"video/mp4",codec:x,initSegment:c,id:"main"}:B.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=e},m.remux=function(c,v,x,n,e){var t=this.initPTS,i=this.lastEndDTS,p={audio:void 0,video:void 0,text:n,id3:x,initSegment:void 0};Object(k.isFiniteNumber)(i)||(i=this.lastEndDTS=e||0);var u=v.samples;if(!u||!u.length)return p;var h={initPTS:void 0,timescale:1},T=this.initData;if((!T||!T.length)&&(this.generateInitSegment(u),T=this.initData),!T||!T.length)return B.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),p;this.emitInitSegment&&(h.tracks=this.initTracks,this.emitInitSegment=!1),Object(k.isFiniteNumber)(t)||(this.initPTS=h.initPTS=t=A(T,u,i));var g=Object(D.getDuration)(u,T),f=i,l=g+f;Object(D.offsetStartDTS)(T,u,t),g>0?this.lastEndDTS=l:(B.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var r=!!T.audio,a=!!T.video,y="";r&&(y+="audio"),a&&(y+="video");var E={data1:u,startPTS:f,startDTS:f,endPTS:l,endDTS:l,type:y,hasAudio:r,hasVideo:a,nb:1,dropped:0};return p.audio=E.type==="audio"?E:void 0,p.video=E.type!=="audio"?E:void 0,p.text=n,p.id3=x,p.initSegment=h,p},s}(),A=function(m,b,c){return Object(D.getStartDTS)(m,b)-c};function C(s,m){var b=s==null?void 0:s.codec;return b&&b.length>4?b:b==="hvc1"?"hvc1.1.c.L120.90":b==="av01"?"av01.0.04M.08":b==="avc1"||m===L.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}U.default=_},"./src/task-loop.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"default",function(){return k});var k=function(){function D(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var L=D.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(_){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,_),!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(){},D}()},"./src/types/cmcd.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"CMCDVersion",function(){return k}),S.d(U,"CMCDObjectType",function(){return D}),S.d(U,"CMCDStreamingFormat",function(){return L}),S.d(U,"CMCDStreamType",function(){return B});var k=1,D;(function(_){_.MANIFEST="m",_.AUDIO="a",_.VIDEO="v",_.MUXED="av",_.INIT="i",_.CAPTION="c",_.TIMED_TEXT="tt",_.KEY="k",_.OTHER="o"})(D||(D={}));var L;(function(_){_.DASH="d",_.HLS="h",_.SMOOTH="s",_.OTHER="o"})(L||(L={}));var B;(function(_){_.VOD="v",_.LIVE="l"})(B||(B={}))},"./src/types/level.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"HlsSkip",function(){return L}),S.d(U,"getSkipValue",function(){return B}),S.d(U,"HlsUrlParameters",function(){return _}),S.d(U,"Level",function(){return A});function k(C,s){for(var m=0;m<s.length;m++){var b=s[m];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(C,b.key,b)}}function D(C,s,m){return s&&k(C.prototype,s),m&&k(C,m),C}var L;(function(C){C.No="",C.Yes="YES",C.v2="v2"})(L||(L={}));function B(C,s){var m=C.canSkipUntil,b=C.canSkipDateRanges,c=C.endSN,v=s!==void 0?s-c:0;return m&&v<m?b?L.v2:L.Yes:L.No}var _=function(){function C(m,b,c){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=m,this.part=b,this.skip=c}var s=C.prototype;return s.addDirectives=function(b){var c=new self.URL(b);return this.msn!==void 0&&c.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&c.searchParams.set("_HLS_part",this.part.toString()),this.skip&&c.searchParams.set("_HLS_skip",this.skip),c.toString()},C}(),A=function(){function C(s){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=[s.url],this.attrs=s.attrs,this.bitrate=s.bitrate,s.details&&(this.details=s.details),this.id=s.id||0,this.name=s.name,this.width=s.width||0,this.height=s.height||0,this.audioCodec=s.audioCodec,this.videoCodec=s.videoCodec,this.unknownCodecs=s.unknownCodecs,this.codecSet=[s.videoCodec,s.audioCodec].filter(function(m){return m}).join(",").replace(/\.[^.,]+/g,"")}return D(C,[{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(m){var b=m%this.url.length;this._urlId!==b&&(this.details=void 0,this._urlId=b)}}]),C}()},"./src/types/loader.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"PlaylistContextType",function(){return k}),S.d(U,"PlaylistLevelType",function(){return D});var k;(function(L){L.MANIFEST="manifest",L.LEVEL="level",L.AUDIO_TRACK="audioTrack",L.SUBTITLE_TRACK="subtitleTrack"})(k||(k={}));var D;(function(L){L.MAIN="main",L.AUDIO="audio",L.SUBTITLE="subtitle"})(D||(D={}))},"./src/types/transmuxer.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"ChunkMetadata",function(){return k});var k=function(B,_,A,C,s,m){C===void 0&&(C=0),s===void 0&&(s=-1),m===void 0&&(m=!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=D(),this.buffering={audio:D(),video:D(),audiovideo:D()},this.level=B,this.sn=_,this.id=A,this.size=C,this.part=s,this.partial=m};function D(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"AttrList",function(){return L});var k=/^(\d+)x(\d+)$/,D=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,L=function(){function B(A){typeof A=="string"&&(A=B.parseAttrList(A));for(var C in A)A.hasOwnProperty(C)&&(this[C]=A[C])}var _=B.prototype;return _.decimalInteger=function(C){var s=parseInt(this[C],10);return s>Number.MAX_SAFE_INTEGER?Infinity:s},_.hexadecimalInteger=function(C){if(this[C]){var s=(this[C]||"0x").slice(2);s=(s.length&1?"0":"")+s;for(var m=new Uint8Array(s.length/2),b=0;b<s.length/2;b++)m[b]=parseInt(s.slice(b*2,b*2+2),16);return m}else return null},_.hexadecimalIntegerAsNumber=function(C){var s=parseInt(this[C],16);return s>Number.MAX_SAFE_INTEGER?Infinity:s},_.decimalFloatingPoint=function(C){return parseFloat(this[C])},_.optionalFloat=function(C,s){var m=this[C];return m?parseFloat(m):s},_.enumeratedString=function(C){return this[C]},_.bool=function(C){return this[C]==="YES"},_.decimalResolution=function(C){var s=k.exec(this[C]);return s===null?void 0:{width:parseInt(s[1],10),height:parseInt(s[2],10)}},B.parseAttrList=function(C){var s,m={},b='"';for(D.lastIndex=0;(s=D.exec(C))!==null;){var c=s[2];c.indexOf(b)===0&&c.lastIndexOf(b)===c.length-1&&(c=c.slice(1,-1)),m[s[1]]=c}return m},B}()},"./src/utils/binary-search.ts":function(se,U,S){"use strict";S.r(U);var k={search:function(L,B){for(var _=0,A=L.length-1,C=null,s=null;_<=A;){C=(_+A)/2|0,s=L[C];var m=B(s);if(m>0)_=C+1;else if(m<0)A=C-1;else return s}return null}};U.default=k},"./src/utils/buffer-helper.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"BufferHelper",function(){return L});var k=S("./src/utils/logger.ts"),D={length:0,start:function(){return 0},end:function(){return 0}},L=function(){function B(){}return B.isBuffered=function(A,C){try{if(A){for(var s=B.getBuffered(A),m=0;m<s.length;m++)if(C>=s.start(m)&&C<=s.end(m))return!0}}catch(b){}return!1},B.bufferInfo=function(A,C,s){try{if(A){var m=B.getBuffered(A),b=[],c;for(c=0;c<m.length;c++)b.push({start:m.start(c),end:m.end(c)});return this.bufferedInfo(b,C,s)}}catch(v){}return{len:0,start:C,end:C,nextStart:void 0}},B.bufferedInfo=function(A,C,s){C=Math.max(0,C),A.sort(function(h,T){var g=h.start-T.start;return g||T.end-h.end});var m=[];if(s)for(var b=0;b<A.length;b++){var c=m.length;if(c){var v=m[c-1].end;A[b].start-v<s?A[b].end>v&&(m[c-1].end=A[b].end):m.push(A[b])}else m.push(A[b])}else m=A;for(var x=0,n,e=C,t=C,i=0;i<m.length;i++){var p=m[i].start,u=m[i].end;if(C+s>=p&&C<u)e=p,t=u,x=t-C;else if(C+s<p){n=p;break}}return{len:x,start:e||0,end:t||0,nextStart:n}},B.getBuffered=function(A){try{return A.buffered}catch(C){return k.logger.log("failed to get media.buffered",C),D}},B}()},"./src/utils/cea-608-parser.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"Row",function(){return t}),S.d(U,"CaptionScreen",function(){return i});var k=S("./src/utils/logger.ts"),D={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(l){var r=l;return D.hasOwnProperty(l)&&(r=D[l]),String.fromCharCode(r)},B=15,_=100,A={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},C={17:2,18:4,21:6,22:8,23:10,19:13,20:15},s={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},m={25:2,26:4,29:6,30:8,31:10,27:13,28:15},b=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],c;(function(f){f[f.ERROR=0]="ERROR",f[f.TEXT=1]="TEXT",f[f.WARNING=2]="WARNING",f[f.INFO=2]="INFO",f[f.DEBUG=3]="DEBUG",f[f.DATA=3]="DATA"})(c||(c={}));var v=function(){function f(){this.time=null,this.verboseLevel=c.ERROR}var l=f.prototype;return l.log=function(a,y){this.verboseLevel>=a&&k.logger.log(this.time+" ["+a+"] "+y)},f}(),x=function(l){for(var r=[],a=0;a<l.length;a++)r.push(l[a].toString(16));return r},n=function(){function f(r,a,y,E,w){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=r||"white",this.underline=a||!1,this.italics=y||!1,this.background=E||"black",this.flash=w||!1}var l=f.prototype;return l.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},l.setStyles=function(a){for(var y=["foreground","underline","italics","background","flash"],E=0;E<y.length;E++){var w=y[E];a.hasOwnProperty(w)&&(this[w]=a[w])}},l.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},l.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},l.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},l.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},f}(),e=function(){function f(r,a,y,E,w,R){this.uchar=void 0,this.penState=void 0,this.uchar=r||" ",this.penState=new n(a,y,E,w,R)}var l=f.prototype;return l.reset=function(){this.uchar=" ",this.penState.reset()},l.setChar=function(a,y){this.uchar=a,this.penState.copy(y)},l.setPenState=function(a){this.penState.copy(a)},l.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},l.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},l.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},f}(),t=function(){function f(r){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<_;a++)this.chars.push(new e);this.logger=r,this.pos=0,this.currPenState=new n}var l=f.prototype;return l.equals=function(a){for(var y=!0,E=0;E<_;E++)if(!this.chars[E].equals(a.chars[E])){y=!1;break}return y},l.copy=function(a){for(var y=0;y<_;y++)this.chars[y].copy(a.chars[y])},l.isEmpty=function(){for(var a=!0,y=0;y<_;y++)if(!this.chars[y].isEmpty()){a=!1;break}return a},l.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(c.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>_&&(this.logger.log(c.DEBUG,"Too large cursor position "+this.pos),this.pos=_)},l.moveCursor=function(a){var y=this.pos+a;if(a>1)for(var E=this.pos+1;E<y+1;E++)this.chars[E].setPenState(this.currPenState);this.setCursor(y)},l.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},l.insertChar=function(a){a>=144&&this.backSpace();var y=L(a);if(this.pos>=_){this.logger.log(c.ERROR,"Cannot insert "+a.toString(16)+" ("+y+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(y,this.currPenState),this.moveCursor(1)},l.clearFromPos=function(a){var y;for(y=a;y<_;y++)this.chars[y].reset()},l.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},l.clearToEndOfRow=function(){this.clearFromPos(this.pos)},l.getTextString=function(){for(var a=[],y=!0,E=0;E<_;E++){var w=this.chars[E].uchar;w!==" "&&(y=!1),a.push(w)}return y?"":a.join("")},l.setPenStyles=function(a){this.currPenState.setStyles(a);var y=this.chars[this.pos];y.setPenState(this.currPenState)},f}(),i=function(){function f(r){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<B;a++)this.rows.push(new t(r));this.logger=r,this.currRow=B-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var l=f.prototype;return l.reset=function(){for(var a=0;a<B;a++)this.rows[a].clear();this.currRow=B-1},l.equals=function(a){for(var y=!0,E=0;E<B;E++)if(!this.rows[E].equals(a.rows[E])){y=!1;break}return y},l.copy=function(a){for(var y=0;y<B;y++)this.rows[y].copy(a.rows[y])},l.isEmpty=function(){for(var a=!0,y=0;y<B;y++)if(!this.rows[y].isEmpty()){a=!1;break}return a},l.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},l.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},l.insertChar=function(a){var y=this.rows[this.currRow];y.insertChar(a)},l.setPen=function(a){var y=this.rows[this.currRow];y.setPenStyles(a)},l.moveCursor=function(a){var y=this.rows[this.currRow];y.moveCursor(a)},l.setCursor=function(a){this.logger.log(c.INFO,"setCursor: "+a);var y=this.rows[this.currRow];y.setCursor(a)},l.setPAC=function(a){this.logger.log(c.INFO,"pacData = "+JSON.stringify(a));var y=a.row-1;if(this.nrRollUpRows&&y<this.nrRollUpRows-1&&(y=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==y){for(var E=0;E<B;E++)this.rows[E].clear();var w=this.currRow+1-this.nrRollUpRows,R=this.lastOutputScreen;if(R){var M=R.rows[w].cueStartTime,N=this.logger.time;if(M&&N!==null&&M<N)for(var j=0;j<this.nrRollUpRows;j++)this.rows[y-this.nrRollUpRows+j+1].copy(R.rows[w+j])}}this.currRow=y;var K=this.rows[this.currRow];if(a.indent!==null){var V=a.indent,z=Math.max(V-1,0);K.setCursor(a.indent),a.color=K.chars[z].penState.foreground}var Q={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(Q)},l.setBkgData=function(a){this.logger.log(c.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},l.setRollUpRows=function(a){this.nrRollUpRows=a},l.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(c.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(c.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,y=this.rows.splice(a,1)[0];y.clear(),this.rows.splice(this.currRow,0,y),this.logger.log(c.INFO,"Rolling up")},l.getDisplayText=function(a){a=a||!1;for(var y=[],E="",w=-1,R=0;R<B;R++){var M=this.rows[R].getTextString();M&&(w=R+1,a?y.push("Row "+w+": '"+M+"'"):y.push(M.trim()))}return y.length>0&&(a?E="["+y.join(" | ")+"]":E=y.join(`
`)),E},l.getTextAndFormat=function(){return this.rows},f}(),p=function(){function f(r,a,y){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=r,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new i(y),this.nonDisplayedMemory=new i(y),this.lastOutputScreen=new i(y),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=y}var l=f.prototype;return l.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},l.getHandler=function(){return this.outputFilter},l.setHandler=function(a){this.outputFilter=a},l.setPAC=function(a){this.writeScreen.setPAC(a)},l.setBkgData=function(a){this.writeScreen.setBkgData(a)},l.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(c.INFO,"MODE="+a),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=a},l.insertChars=function(a){for(var y=0;y<a.length;y++)this.writeScreen.insertChar(a[y]);var E=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(c.INFO,E+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(c.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},l.ccRCL=function(){this.logger.log(c.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},l.ccBS=function(){if(this.logger.log(c.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},l.ccAOF=function(){},l.ccAON=function(){},l.ccDER=function(){this.logger.log(c.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},l.ccRU=function(a){this.logger.log(c.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},l.ccFON=function(){this.logger.log(c.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},l.ccRDC=function(){this.logger.log(c.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},l.ccTR=function(){this.logger.log(c.INFO,"TR"),this.setMode("MODE_TEXT")},l.ccRTD=function(){this.logger.log(c.INFO,"RTD"),this.setMode("MODE_TEXT")},l.ccEDM=function(){this.logger.log(c.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},l.ccCR=function(){this.logger.log(c.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},l.ccENM=function(){this.logger.log(c.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},l.ccEOC=function(){if(this.logger.log(c.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(c.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},l.ccTO=function(a){this.logger.log(c.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},l.ccMIDROW=function(a){var y={flash:!1};if(y.underline=a%2===1,y.italics=a>=46,y.italics)y.foreground="white";else{var E=Math.floor(a/2)-16,w=["white","green","blue","cyan","red","yellow","magenta"];y.foreground=w[E]}this.logger.log(c.INFO,"MIDROW: "+JSON.stringify(y)),this.writeScreen.setPen(y)},l.outputDataUpdate=function(a){a===void 0&&(a=!1);var y=this.logger.time;if(y===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=y:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,y,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:y),this.lastOutputScreen.copy(this.displayedMemory))},l.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},f}(),u=function(){function f(r,a,y){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var E=new v;this.channels=[null,new p(r,a,E),new p(r+1,y,E)],this.cmdHistory=g(),this.logger=E}var l=f.prototype;return l.getHandler=function(a){return this.channels[a].getHandler()},l.setHandler=function(a,y){this.channels[a].setHandler(y)},l.addData=function(a,y){var E,w,R,M=!1;this.logger.time=a;for(var N=0;N<y.length;N+=2){if(w=y[N]&127,R=y[N+1]&127,w===0&&R===0)continue;if(this.logger.log(c.DATA,"["+x([y[N],y[N+1]])+"] -> ("+x([w,R])+")"),E=this.parseCmd(w,R),E||(E=this.parseMidrow(w,R)),E||(E=this.parsePAC(w,R)),E||(E=this.parseBackgroundAttributes(w,R)),!E&&(M=this.parseChars(w,R),M)){var j=this.currentChannel;if(j&&j>0){var K=this.channels[j];K.insertChars(M)}else this.logger.log(c.WARNING,"No channel found yet. TEXT-MODE?")}!E&&!M&&this.logger.log(c.WARNING,"Couldn't parse cleaned data "+x([w,R])+" orig: "+x([y[N],y[N+1]]))}},l.parseCmd=function(a,y){var E=this.cmdHistory,w=(a===20||a===28||a===21||a===29)&&y>=32&&y<=47,R=(a===23||a===31)&&y>=33&&y<=35;if(!(w||R))return!1;if(T(a,y,E))return h(null,null,E),this.logger.log(c.DEBUG,"Repeated command ("+x([a,y])+") is dropped"),!0;var M=a===20||a===21||a===23?1:2,N=this.channels[M];return a===20||a===21||a===28||a===29?y===32?N.ccRCL():y===33?N.ccBS():y===34?N.ccAOF():y===35?N.ccAON():y===36?N.ccDER():y===37?N.ccRU(2):y===38?N.ccRU(3):y===39?N.ccRU(4):y===40?N.ccFON():y===41?N.ccRDC():y===42?N.ccTR():y===43?N.ccRTD():y===44?N.ccEDM():y===45?N.ccCR():y===46?N.ccENM():y===47&&N.ccEOC():N.ccTO(y-32),h(a,y,E),this.currentChannel=M,!0},l.parseMidrow=function(a,y){var E=0;if((a===17||a===25)&&y>=32&&y<=47){if(a===17?E=1:E=2,E!==this.currentChannel)return this.logger.log(c.ERROR,"Mismatch channel in midrow parsing"),!1;var w=this.channels[E];return w?(w.ccMIDROW(y),this.logger.log(c.DEBUG,"MIDROW ("+x([a,y])+")"),!0):!1}return!1},l.parsePAC=function(a,y){var E,w=this.cmdHistory,R=(a>=17&&a<=23||a>=25&&a<=31)&&y>=64&&y<=127,M=(a===16||a===24)&&y>=64&&y<=95;if(!(R||M))return!1;if(T(a,y,w))return h(null,null,w),!0;var N=a<=23?1:2;y>=64&&y<=95?E=N===1?A[a]:s[a]:E=N===1?C[a]:m[a];var j=this.channels[N];return j?(j.setPAC(this.interpretPAC(E,y)),h(a,y,w),this.currentChannel=N,!0):!1},l.interpretPAC=function(a,y){var E,w={color:null,italics:!1,indent:null,underline:!1,row:a};return y>95?E=y-96:E=y-64,w.underline=(E&1)===1,E<=13?w.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(E/2)]:E<=15?(w.italics=!0,w.color="white"):w.indent=Math.floor((E-16)/2)*4,w},l.parseChars=function(a,y){var E,w=null,R=null;if(a>=25?(E=2,R=a-8):(E=1,R=a),R>=17&&R<=19){var M;R===17?M=y+80:R===18?M=y+112:M=y+144,this.logger.log(c.INFO,"Special char '"+L(M)+"' in channel "+E),w=[M]}else a>=32&&a<=127&&(w=y===0?[a]:[a,y]);if(w){var N=x(w);this.logger.log(c.DEBUG,"Char codes = "+N.join(",")),h(a,y,this.cmdHistory)}return w},l.parseBackgroundAttributes=function(a,y){var E=(a===16||a===24)&&y>=32&&y<=47,w=(a===23||a===31)&&y>=45&&y<=47;if(!(E||w))return!1;var R,M={};a===16||a===24?(R=Math.floor((y-32)/2),M.background=b[R],y%2===1&&(M.background=M.background+"_semi")):y===45?M.background="transparent":(M.foreground="black",y===47&&(M.underline=!0));var N=a<=23?1:2,j=this.channels[N];return j.setBkgData(M),h(a,y,this.cmdHistory),!0},l.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var y=this.channels[a];y&&y.reset()}this.cmdHistory=g()},l.cueSplitAtTime=function(a){for(var y=0;y<this.channels.length;y++){var E=this.channels[y];E&&E.cueSplitAtTime(a)}},f}();function h(f,l,r){r.a=f,r.b=l}function T(f,l,r){return r.a===f&&r.b===l}function g(){return{a:null,b:null}}U.default=u},"./src/utils/codecs.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"isCodecType",function(){return D}),S.d(U,"isCodecSupportedInMp4",function(){return L});var k={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 D(B,_){var A=k[_];return!!A&&A[B.slice(0,4)]===!0}function L(B,_){return MediaSource.isTypeSupported((_||"video")+'/mp4;codecs="'+B+'"')}},"./src/utils/cues.ts":function(se,U,S){"use strict";S.r(U);var k=S("./src/utils/vttparser.ts"),D=S("./src/utils/webvtt-parser.ts"),L=S("./src/utils/texttrack-utils.ts"),B=/\s/,_={newCue:function(C,s,m,b){for(var c=[],v,x,n,e,t,i=self.VTTCue||self.TextTrackCue,p=0;p<b.rows.length;p++)if(v=b.rows[p],n=!0,e=0,t="",!v.isEmpty()){for(var u=0;u<v.chars.length;u++)B.test(v.chars[u].uchar)&&n?e++:(t+=v.chars[u].uchar,n=!1);v.cueStartTime=s,s===m&&(m+=1e-4),e>=16?e--:e++;var h=Object(k.fixLineBreaks)(t.trim()),T=Object(D.generateCueId)(s,m,h);(!C||!C.cues||!C.cues.getCueById(T))&&(x=new i(s,m,h),x.id=T,x.line=p+1,x.align="left",x.position=10+Math.min(80,Math.floor(e*8/32)*10),c.push(x))}return C&&c.length&&(c.sort(function(g,f){return g.line==="auto"||f.line==="auto"?0:g.line>8&&f.line>8?f.line-g.line:g.line-f.line}),c.forEach(function(g){return Object(L.addCueToTrack)(C,g)})),c}};U.default=_},"./src/utils/discontinuities.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"findFirstFragWithCC",function(){return B}),S.d(U,"shouldAlignOnDiscontinuities",function(){return _}),S.d(U,"findDiscontinuousReferenceFrag",function(){return A}),S.d(U,"adjustSlidingStart",function(){return s}),S.d(U,"alignStream",function(){return m}),S.d(U,"alignPDT",function(){return c}),S.d(U,"alignFragmentByPDTDelta",function(){return v}),S.d(U,"alignMediaPlaylistByPDT",function(){return x});var k=S("./src/polyfills/number.ts"),D=S("./src/utils/logger.ts"),L=S("./src/controller/level-helper.ts");function B(n,e){for(var t=null,i=0,p=n.length;i<p;i++){var u=n[i];if(u&&u.cc===e){t=u;break}}return t}function _(n,e,t){return!!(e.details&&(t.endCC>t.startCC||n&&n.cc<t.startCC))}function A(n,e){var t=n.fragments,i=e.fragments;if(!i.length||!t.length){D.logger.log("No fragments to align");return}var p=B(t,i[0].cc);if(!p||p&&!p.startPTS){D.logger.log("No frag in previous level to align on");return}return p}function C(n,e){if(n){var t=n.start+e;n.start=n.startPTS=t,n.endPTS=t+n.duration}}function s(n,e){for(var t=e.fragments,i=0,p=t.length;i<p;i++)C(t[i],n);e.fragmentHint&&C(e.fragmentHint,n),e.alignedSliding=!0}function m(n,e,t){if(!e)return;b(n,t,e),!t.alignedSliding&&e.details&&c(t,e.details),!t.alignedSliding&&e.details&&!t.skippedSegments&&Object(L.adjustSliding)(e.details,t)}function b(n,e,t){if(_(n,t,e)){var i=A(t.details,e);i&&Object(k.isFiniteNumber)(i.start)&&(D.logger.log("Adjusting PTS using last level due to CC increase within current level "+e.url),s(i.start,e))}}function c(n,e){if(!e.fragments.length||!n.hasProgramDateTime||!e.hasProgramDateTime)return;var t=e.fragments[0].programDateTime,i=n.fragments[0].programDateTime,p=(i-t)/1e3+e.fragments[0].start;p&&Object(k.isFiniteNumber)(p)&&(D.logger.log("Adjusting PTS using programDateTime delta "+(i-t)+"ms, sliding:"+p.toFixed(3)+" "+n.url+" "),s(p,n))}function v(n,e){var t=n.programDateTime;if(!t)return;var i=(t-e)/1e3;n.start=n.startPTS=i,n.endPTS=i+n.duration}function x(n,e){if(!e.fragments.length||!n.hasProgramDateTime||!e.hasProgramDateTime)return;var t=e.fragments[0].programDateTime,i=e.fragments[0].start,p=t-i*1e3;n.fragments.forEach(function(u){v(u,p)}),n.fragmentHint&&v(n.fragmentHint,p),n.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(se,U,S){"use strict";S.r(U);var k=S("./src/utils/ewma.ts"),D=function(){function L(_,A,C){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=C,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new k.default(_),this.fast_=new k.default(A)}var B=L.prototype;return B.update=function(A,C){var s=this.slow_,m=this.fast_;this.slow_.halfLife!==A&&(this.slow_=new k.default(A,s.getEstimate(),s.getTotalWeight())),this.fast_.halfLife!==C&&(this.fast_=new k.default(C,m.getEstimate(),m.getTotalWeight()))},B.sample=function(A,C){A=Math.max(A,this.minDelayMs_);var s=8*C,m=A/1e3,b=s/m;this.fast_.sample(m,b),this.slow_.sample(m,b)},B.canEstimate=function(){var A=this.fast_;return A&&A.getTotalWeight()>=this.minWeight_},B.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},B.destroy=function(){},L}();U.default=D},"./src/utils/ewma.ts":function(se,U,S){"use strict";S.r(U);var k=function(){function D(B,_,A){_===void 0&&(_=0),A===void 0&&(A=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=B,this.alpha_=B?Math.exp(Math.log(.5)/B):0,this.estimate_=_,this.totalWeight_=A}var L=D.prototype;return L.sample=function(_,A){var C=Math.pow(this.alpha_,_);this.estimate_=A*(1-C)+C*this.estimate_,this.totalWeight_+=_},L.getTotalWeight=function(){return this.totalWeight_},L.getEstimate=function(){if(this.alpha_){var _=1-Math.pow(this.alpha_,this.totalWeight_);if(_)return this.estimate_/_}return this.estimate_},D}();U.default=k},"./src/utils/fetch-loader.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"fetchSupported",function(){return v});var k=S("./src/polyfills/number.ts"),D=S("./src/loader/load-stats.ts"),L=S("./src/demux/chunk-cache.ts");function B(i,p){i.prototype=Object.create(p.prototype),i.prototype.constructor=i,m(i,p)}function _(i){var p=typeof Map=="function"?new Map:void 0;return _=function(h){if(h===null||!s(h))return h;if(typeof h!="function")throw new TypeError("Super expression must either be null or a function");if(typeof p!="undefined"){if(p.has(h))return p.get(h);p.set(h,T)}function T(){return A(h,arguments,b(this).constructor)}return T.prototype=Object.create(h.prototype,{constructor:{value:T,enumerable:!1,writable:!0,configurable:!0}}),m(T,h)},_(i)}function A(i,p,u){return C()?A=Reflect.construct:A=function(T,g,f){var l=[null];l.push.apply(l,g);var r=Function.bind.apply(T,l),a=new r;return f&&m(a,f.prototype),a},A.apply(null,arguments)}function C(){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(i){return!1}}function s(i){return Function.toString.call(i).indexOf("[native code]")!==-1}function m(i,p){return m=Object.setPrototypeOf||function(h,T){return h.__proto__=T,h},m(i,p)}function b(i){return b=Object.setPrototypeOf?Object.getPrototypeOf:function(u){return u.__proto__||Object.getPrototypeOf(u)},b(i)}function c(){return c=Object.assign||function(i){for(var p=1;p<arguments.length;p++){var u=arguments[p];for(var h in u)Object.prototype.hasOwnProperty.call(u,h)&&(i[h]=u[h])}return i},c.apply(this,arguments)}function v(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(i){}return!1}var x=function(){function i(u){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=u.fetchSetup||e,this.controller=new self.AbortController,this.stats=new D.LoadStats}var p=i.prototype;return p.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},p.abortInternal=function(){var h=this.response;(!h||!h.ok)&&(this.stats.aborted=!0,this.controller.abort())},p.abort=function(){var h;this.abortInternal(),(h=this.callbacks)!==null&&h!==void 0&&h.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},p.load=function(h,T,g){var f=this,l=this.stats;if(l.loading.start)throw new Error("Loader can only be used once.");l.loading.start=self.performance.now();var r=n(h,this.controller.signal),a=g.onProgress,y=h.responseType==="arraybuffer",E=y?"byteLength":"length";this.context=h,this.config=T,this.callbacks=g,this.request=this.fetchSetup(h,r),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){f.abortInternal(),g.onTimeout(l,h,f.response)},T.timeout),self.fetch(this.request).then(function(w){if(f.response=f.loader=w,!w.ok){var R=w.status,M=w.statusText;throw new t(M||"fetch, bad network response",R,w)}return l.loading.first=Math.max(self.performance.now(),l.loading.start),l.total=parseInt(w.headers.get("Content-Length")||"0"),a&&Object(k.isFiniteNumber)(T.highWaterMark)?f.loadProgressively(w,l,h,T.highWaterMark,a):y?w.arrayBuffer():w.text()}).then(function(w){var R=f.response;self.clearTimeout(f.requestTimeout),l.loading.end=Math.max(self.performance.now(),l.loading.first),l.loaded=l.total=w[E];var M={url:R.url,data:w};a&&!Object(k.isFiniteNumber)(T.highWaterMark)&&a(l,h,w,R),g.onSuccess(M,l,h,R)}).catch(function(w){if(self.clearTimeout(f.requestTimeout),l.aborted)return;var R=w.code||0;g.onError({code:R,text:w.message},h,w.details)})},p.getCacheAge=function(){var h=null;if(this.response){var T=this.response.headers.get("age");h=T?parseFloat(T):null}return h},p.loadProgressively=function(h,T,g,f,l){f===void 0&&(f=0);var r=new L.default,a=h.body.getReader(),y=function E(){return a.read().then(function(w){if(w.done)return r.dataLength&&l(T,g,r.flush(),h),Promise.resolve(new ArrayBuffer(0));var R=w.value,M=R.length;return T.loaded+=M,M<f||r.dataLength?(r.push(R),r.dataLength>=f&&l(T,g,r.flush(),h)):l(T,g,R,h),E()}).catch(function(){return Promise.reject()})};return y()},i}();function n(i,p){var u={method:"GET",mode:"cors",credentials:"same-origin",signal:p,headers:new self.Headers(c({},i.headers))};return i.rangeEnd&&u.headers.set("Range","bytes="+i.rangeStart+"-"+String(i.rangeEnd-1)),u}function e(i,p){return new self.Request(i.url,p)}var t=function(i){B(p,i);function p(u,h,T){var g;return g=i.call(this,u)||this,g.code=void 0,g.details=void 0,g.code=h,g.details=T,g}return p}(_(Error));U.default=x},"./src/utils/imsc1-ttml-parser.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"IMSC1_CODEC",function(){return s}),S.d(U,"parseIMSC1",function(){return v});var k=S("./src/utils/mp4-tools.ts"),D=S("./src/utils/vttparser.ts"),L=S("./src/utils/vttcue.ts"),B=S("./src/demux/id3.ts"),_=S("./src/utils/timescale-conversion.ts"),A=S("./src/utils/webvtt-parser.ts");function C(){return C=Object.assign||function(f){for(var l=1;l<arguments.length;l++){var r=arguments[l];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(f[a]=r[a])}return f},C.apply(this,arguments)}var s="stpp.ttml.im1t",m=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,b=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,c={left:"start",center:"center",right:"end",start:"start",end:"end"};function v(f,l,r,a,y){var E=Object(k.findBox)(new Uint8Array(f),["mdat"]);if(E.length===0){y(new Error("Could not parse IMSC1 mdat"));return}var w=E[0],R=Object(B.utf8ArrayToStr)(new Uint8Array(f,w.start,w.end-w.start)),M=Object(_.toTimescaleFromScale)(l,1,r);try{a(x(R,M))}catch(N){y(N)}}function x(f,l){var r=new DOMParser,a=r.parseFromString(f,"text/xml"),y=a.getElementsByTagName("tt")[0];if(!y)throw new Error("Invalid ttml");var E={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},w=Object.keys(E).reduce(function(K,V){return K[V]=y.getAttribute("ttp:"+V)||E[V],K},{}),R=y.getAttribute("xml:space")!=="preserve",M=e(n(y,"styling","style")),N=e(n(y,"layout","region")),j=n(y,"body","[begin]");return[].map.call(j,function(K){var V=t(K,R);if(!V||!K.hasAttribute("begin"))return null;var z=h(K.getAttribute("begin"),w),Q=h(K.getAttribute("dur"),w),ae=h(K.getAttribute("end"),w);if(z===null)throw u(K);if(ae===null){if(Q===null)throw u(K);ae=z+Q}var oe=new L.default(z-l,ae-l,V);oe.id=Object(A.generateCueId)(oe.startTime,oe.endTime,oe.text);var Ce=N[K.getAttribute("region")],he=M[K.getAttribute("style")];oe.position=10,oe.size=80;var fe=i(Ce,he),pe=fe.textAlign;if(pe){var me=c[pe];me&&(oe.lineAlign=me),oe.align=pe}return C(oe,fe),oe}).filter(function(K){return K!==null})}function n(f,l,r){var a=f.getElementsByTagName(l)[0];return a?[].slice.call(a.querySelectorAll(r)):[]}function e(f){return f.reduce(function(l,r){var a=r.getAttribute("xml:id");return a&&(l[a]=r),l},{})}function t(f,l){return[].slice.call(f.childNodes).reduce(function(r,a,y){var E;return a.nodeName==="br"&&y?r+`
`:(E=a.childNodes)!==null&&E!==void 0&&E.length?t(a,l):l?r+a.textContent.trim().replace(/\s+/g," "):r+a.textContent},"")}function i(f,l){var r="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(y,E){var w=p(l,r,E)||p(f,r,E);return w&&(y[E]=w),y},{})}function p(f,l,r){return f.hasAttributeNS(l,r)?f.getAttributeNS(l,r):null}function u(f){return new Error("Could not parse ttml timestamp "+f)}function h(f,l){if(!f)return null;var r=Object(D.parseTimeStamp)(f);return r===null&&(m.test(f)?r=T(f,l):b.test(f)&&(r=g(f,l))),r}function T(f,l){var r=m.exec(f),a=(r[4]|0)+(r[5]|0)/l.subFrameRate;return(r[1]|0)*3600+(r[2]|0)*60+(r[3]|0)+a/l.frameRate}function g(f,l){var r=b.exec(f),a=Number(r[1]),y=r[2];switch(y){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/l.frameRate;case"t":return a/l.tickRate}return a}},"./src/utils/logger.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"enableLogs",function(){return A}),S.d(U,"logger",function(){return C});var k=function(){},D={trace:k,debug:k,log:k,warn:k,info:k,error:k},L=D;function B(s){var m=self.console[s];return m?m.bind(self.console,"["+s+"] >"):k}function _(s){for(var m=arguments.length,b=new Array(m>1?m-1:0),c=1;c<m;c++)b[c-1]=arguments[c];b.forEach(function(v){L[v]=s[v]?s[v].bind(s):B(v)})}function A(s){if(self.console&&s===!0||typeof s=="object"){_(s,"debug","log","info","warn","error");try{L.log()}catch(m){L=D}}else L=D}var C=L},"./src/utils/mediakeys-helper.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"KeySystems",function(){return k}),S.d(U,"requestMediaKeySystemAccess",function(){return D});var k;(function(L){L.WIDEVINE="com.widevine.alpha",L.PLAYREADY="com.microsoft.playready"})(k||(k={}));var D=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"getMediaSource",function(){return k});function k(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"bin2str",function(){return _}),S.d(U,"readUint16",function(){return A}),S.d(U,"readUint32",function(){return C}),S.d(U,"writeUint32",function(){return s}),S.d(U,"findBox",function(){return m}),S.d(U,"parseSegmentIndex",function(){return b}),S.d(U,"parseInitSegment",function(){return c}),S.d(U,"getStartDTS",function(){return v}),S.d(U,"getDuration",function(){return x}),S.d(U,"computeRawDurationFromSamples",function(){return n}),S.d(U,"offsetStartDTS",function(){return e}),S.d(U,"segmentValidRange",function(){return t}),S.d(U,"appendUint8Array",function(){return i});var k=S("./src/utils/typed-array.ts"),D=S("./src/loader/fragment.ts"),L=Math.pow(2,32)-1,B=[].push;function _(p){return String.fromCharCode.apply(null,p)}function A(p,u){"data"in p&&(u+=p.start,p=p.data);var h=p[u]<<8|p[u+1];return h<0?65536+h:h}function C(p,u){"data"in p&&(u+=p.start,p=p.data);var h=p[u]<<24|p[u+1]<<16|p[u+2]<<8|p[u+3];return h<0?4294967296+h:h}function s(p,u,h){"data"in p&&(u+=p.start,p=p.data),p[u]=h>>24,p[u+1]=h>>16&255,p[u+2]=h>>8&255,p[u+3]=h&255}function m(p,u){var h=[];if(!u.length)return h;var T,g,f;"data"in p?(T=p.data,g=p.start,f=p.end):(T=p,g=0,f=T.byteLength);for(var l=g;l<f;){var r=C(T,l),a=_(T.subarray(l+4,l+8)),y=r>1?l+r:f;if(a===u[0])if(u.length===1)h.push({data:T,start:l+8,end:y});else{var E=m({data:T,start:l+8,end:y},u.slice(1));E.length&&B.apply(h,E)}l=y}return h}function b(p){var u=m(p,["moov"]),h=u[0],T=h?h.end:null,g=m(p,["sidx"]);if(!g||!g[0])return null;var f=[],l=g[0],r=l.data[0],a=r===0?8:16,y=C(l,a);a+=4;var E=0,w=0;r===0?a+=8:a+=16,a+=2;var R=l.end+w,M=A(l,a);a+=2;for(var N=0;N<M;N++){var j=a,K=C(l,j);j+=4;var V=K&2147483647,z=(K&2147483648)>>>31;if(z===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var Q=C(l,j);j+=4,f.push({referenceSize:V,subsegmentDuration:Q,info:{duration:Q/y,start:R,end:R+V-1}}),R+=V,j+=4,a=j}return{earliestPresentationTime:E,timescale:y,version:r,referencesCount:M,references:f,moovEndOffset:T}}function c(p){for(var u=[],h=m(p,["moov","trak"]),T=0;T<h.length;T++){var g=h[T],f=m(g,["tkhd"])[0];if(f){var l=f.data[f.start],r=l===0?12:20,a=C(f,r),y=m(g,["mdia","mdhd"])[0];if(y){l=y.data[y.start],r=l===0?12:20;var E=C(y,r),w=m(g,["mdia","hdlr"])[0];if(w){var R=_(w.data.subarray(w.start+8,w.start+12)),M={soun:D.ElementaryStreamTypes.AUDIO,vide:D.ElementaryStreamTypes.VIDEO}[R];if(M){var N=m(g,["mdia","minf","stbl","stsd"])[0],j=void 0;N&&(j=_(N.data.subarray(N.start+12,N.start+16))),u[a]={timescale:E,type:M},u[M]={timescale:E,id:a,codec:j}}}}}}var K=m(p,["moov","mvex","trex"]);return K.forEach(function(V){var z=C(V,4),Q=u[z];Q&&(Q.default={duration:C(V,12),flags:C(V,20)})}),u}function v(p,u){return m(u,["moof","traf"]).reduce(function(h,T){var g=m(T,["tfdt"])[0],f=g.data[g.start],l=m(T,["tfhd"]).reduce(function(r,a){var y=C(a,4),E=p[y];if(E){var w=C(g,4);f===1&&(w*=Math.pow(2,32),w+=C(g,8));var R=E.timescale||9e4,M=w/R;if(isFinite(M)&&(r===null||M<r))return M}return r},null);return l!==null&&isFinite(l)&&(h===null||l<h)?l:h},null)||0}function x(p,u){for(var h=0,T=0,g=0,f=m(p,["moof","traf"]),l=0;l<f.length;l++){var r=f[l],a=m(r,["tfhd"])[0],y=C(a,4),E=u[y];if(!E)continue;var w=E.default,R=C(a,0)|(w==null?void 0:w.flags),M=w==null?void 0:w.duration;R&8&&(R&2?M=C(a,12):M=C(a,8));for(var N=E.timescale||9e4,j=m(r,["trun"]),K=0;K<j.length;K++){if(M){var V=C(j[K],4);h=M*V}else h=n(j[K]);E.type===D.ElementaryStreamTypes.VIDEO?T+=h/N:E.type===D.ElementaryStreamTypes.AUDIO&&(g+=h/N)}}if(T===0&&g===0){var z=b(p);if(z!=null&&z.references)return z.references.reduce(function(Q,ae){return Q+ae.info.duration||0},0)}return T||g}function n(p){var u=C(p,0),h=8;u&1&&(h+=4),u&4&&(h+=4);for(var T=0,g=C(p,4),f=0;f<g;f++){if(u&256){var l=C(p,h);T+=l,h+=4}u&512&&(h+=4),u&1024&&(h+=4),u&2048&&(h+=4)}return T}function e(p,u,h){m(u,["moof","traf"]).forEach(function(T){m(T,["tfhd"]).forEach(function(g){var f=C(g,4),l=p[f];if(!l)return;var r=l.timescale||9e4;m(T,["tfdt"]).forEach(function(a){var y=a.data[a.start],E=C(a,4);if(y===0)s(a,4,E-h*r);else{E*=Math.pow(2,32),E+=C(a,8),E-=h*r,E=Math.max(E,0);var w=Math.floor(E/(L+1)),R=Math.floor(E%(L+1));s(a,4,w),s(a,8,R)}})})})}function t(p){var u={valid:null,remainder:null},h=m(p,["moof"]);if(h){if(h.length<2)return u.remainder=p,u}else return u;var T=h[h.length-1];return u.valid=Object(k.sliceUint8)(p,0,T.start-8),u.remainder=Object(k.sliceUint8)(p,T.start-8),u}function i(p,u){var h=new Uint8Array(p.length+u.length);return h.set(p),h.set(u,p.length),h}},"./src/utils/output-filter.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"default",function(){return k});var k=function(){function D(B,_){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=B,this.trackName=_}var L=D.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(_,A,C){(this.startTime===null||this.startTime>_)&&(this.startTime=_),this.endTime=A,this.screen=C,this.timelineController.createCaptionsTrack(this.trackName)},L.reset=function(){this.cueRanges=[]},D}()},"./src/utils/texttrack-utils.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"sendAddTrackEvent",function(){return D}),S.d(U,"addCueToTrack",function(){return L}),S.d(U,"clearCurrentCues",function(){return B}),S.d(U,"removeCuesInRange",function(){return _}),S.d(U,"getCuesInRange",function(){return C});var k=S("./src/utils/logger.ts");function D(s,m){var b;try{b=new Event("addtrack")}catch(c){b=document.createEvent("Event"),b.initEvent("addtrack",!1,!1)}b.track=s,m.dispatchEvent(b)}function L(s,m){var b=s.mode;if(b==="disabled"&&(s.mode="hidden"),s.cues&&!s.cues.getCueById(m.id))try{if(s.addCue(m),!s.cues.getCueById(m.id))throw new Error("addCue is failed for: "+m)}catch(v){k.logger.debug("[texttrack-utils]: "+v);var c=new self.TextTrackCue(m.startTime,m.endTime,m.text);c.id=m.id,s.addCue(c)}b==="disabled"&&(s.mode=b)}function B(s){var m=s.mode;if(m==="disabled"&&(s.mode="hidden"),s.cues)for(var b=s.cues.length;b--;)s.removeCue(s.cues[b]);m==="disabled"&&(s.mode=m)}function _(s,m,b){var c=s.mode;if(c==="disabled"&&(s.mode="hidden"),s.cues&&s.cues.length>0)for(var v=C(s.cues,m,b),x=0;x<v.length;x++)s.removeCue(v[x]);c==="disabled"&&(s.mode=c)}function A(s,m){if(m<s[0].startTime)return 0;var b=s.length-1;if(m>s[b].endTime)return-1;for(var c=0,v=b;c<=v;){var x=Math.floor((v+c)/2);if(m<s[x].startTime)v=x-1;else if(m>s[x].startTime&&c<b)c=x+1;else return x}return s[c].startTime-m<m-s[v].startTime?c:v}function C(s,m,b){var c=[],v=A(s,m);if(v>-1)for(var x=v,n=s.length;x<n;x++){var e=s[x];if(e.startTime>=m&&e.endTime<=b)c.push(e);else if(e.startTime>b)return c}return c}},"./src/utils/time-ranges.ts":function(se,U,S){"use strict";S.r(U);var k={toString:function(L){for(var B="",_=L.length,A=0;A<_;A++)B+="["+L.start(A).toFixed(3)+","+L.end(A).toFixed(3)+"]";return B}};U.default=k},"./src/utils/timescale-conversion.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"toTimescaleFromBase",function(){return D}),S.d(U,"toTimescaleFromScale",function(){return L}),S.d(U,"toMsFromMpegTsClock",function(){return B}),S.d(U,"toMpegTsClockFromTimescale",function(){return _});var k=9e4;function D(A,C,s,m){s===void 0&&(s=1),m===void 0&&(m=!1);var b=A*C*s;return m?Math.round(b):b}function L(A,C,s,m){return s===void 0&&(s=1),m===void 0&&(m=!1),D(A,C,1/s,m)}function B(A,C){return C===void 0&&(C=!1),D(A,1e3,1/k,C)}function _(A,C){return C===void 0&&(C=1),D(A,k,1/C)}},"./src/utils/typed-array.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"sliceUint8",function(){return k});function k(D,L,B){return Uint8Array.prototype.slice?D.slice(L,B):new Uint8Array(Array.prototype.slice.call(D,L,B))}},"./src/utils/vttcue.ts":function(se,U,S){"use strict";S.r(U),U.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var k=["","lr","rl"],D=["start","middle","end","left","right"];function L(s,m){if(typeof m!="string")return!1;if(!Array.isArray(s))return!1;var b=m.toLowerCase();return~s.indexOf(b)?b:!1}function B(s){return L(k,s)}function _(s){return L(D,s)}function A(s){for(var m=arguments.length,b=new Array(m>1?m-1:0),c=1;c<m;c++)b[c-1]=arguments[c];for(var v=1;v<arguments.length;v++){var x=arguments[v];for(var n in x)s[n]=x[n]}return s}function C(s,m,b){var c=this,v={enumerable:!0};c.hasBeenReset=!1;var x="",n=!1,e=s,t=m,i=b,p=null,u="",h=!0,T="auto",g="start",f=50,l="middle",r=50,a="middle";Object.defineProperty(c,"id",A({},v,{get:function(){return x},set:function(E){x=""+E}})),Object.defineProperty(c,"pauseOnExit",A({},v,{get:function(){return n},set:function(E){n=!!E}})),Object.defineProperty(c,"startTime",A({},v,{get:function(){return e},set:function(E){if(typeof E!="number")throw new TypeError("Start time must be set to a number.");e=E,this.hasBeenReset=!0}})),Object.defineProperty(c,"endTime",A({},v,{get:function(){return t},set:function(E){if(typeof E!="number")throw new TypeError("End time must be set to a number.");t=E,this.hasBeenReset=!0}})),Object.defineProperty(c,"text",A({},v,{get:function(){return i},set:function(E){i=""+E,this.hasBeenReset=!0}})),Object.defineProperty(c,"region",A({},v,{get:function(){return p},set:function(E){p=E,this.hasBeenReset=!0}})),Object.defineProperty(c,"vertical",A({},v,{get:function(){return u},set:function(E){var w=B(E);if(w===!1)throw new SyntaxError("An invalid or illegal string was specified.");u=w,this.hasBeenReset=!0}})),Object.defineProperty(c,"snapToLines",A({},v,{get:function(){return h},set:function(E){h=!!E,this.hasBeenReset=!0}})),Object.defineProperty(c,"line",A({},v,{get:function(){return T},set:function(E){if(typeof E!="number"&&E!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");T=E,this.hasBeenReset=!0}})),Object.defineProperty(c,"lineAlign",A({},v,{get:function(){return g},set:function(E){var w=_(E);if(!w)throw new SyntaxError("An invalid or illegal string was specified.");g=w,this.hasBeenReset=!0}})),Object.defineProperty(c,"position",A({},v,{get:function(){return f},set:function(E){if(E<0||E>100)throw new Error("Position must be between 0 and 100.");f=E,this.hasBeenReset=!0}})),Object.defineProperty(c,"positionAlign",A({},v,{get:function(){return l},set:function(E){var w=_(E);if(!w)throw new SyntaxError("An invalid or illegal string was specified.");l=w,this.hasBeenReset=!0}})),Object.defineProperty(c,"size",A({},v,{get:function(){return r},set:function(E){if(E<0||E>100)throw new Error("Size must be between 0 and 100.");r=E,this.hasBeenReset=!0}})),Object.defineProperty(c,"align",A({},v,{get:function(){return a},set:function(E){var w=_(E);if(!w)throw new SyntaxError("An invalid or illegal string was specified.");a=w,this.hasBeenReset=!0}})),c.displayState=void 0}return C.prototype.getCueAsHTML=function(){var s=self.WebVTT;return s.convertCueToDOMTree(self,this.text)},C}()},"./src/utils/vttparser.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"parseTimeStamp",function(){return L}),S.d(U,"fixLineBreaks",function(){return m}),S.d(U,"VTTParser",function(){return b});var k=S("./src/utils/vttcue.ts"),D=function(){function c(){}var v=c.prototype;return v.decode=function(n,e){if(!n)return"";if(typeof n!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(n))},c}();function L(c){function v(n,e,t,i){return(n|0)*3600+(e|0)*60+(t|0)+parseFloat(i||0)}var x=c.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return x?parseFloat(x[2])>59?v(x[2],x[3],0,x[4]):v(x[1],x[2],x[3],x[4]):null}var B=function(){function c(){this.values=Object.create(null)}var v=c.prototype;return v.set=function(n,e){!this.get(n)&&e!==""&&(this.values[n]=e)},v.get=function(n,e,t){return t?this.has(n)?this.values[n]:e[t]:this.has(n)?this.values[n]:e},v.has=function(n){return n in this.values},v.alt=function(n,e,t){for(var i=0;i<t.length;++i)if(e===t[i]){this.set(n,e);break}},v.integer=function(n,e){/^-?\d+$/.test(e)&&this.set(n,parseInt(e,10))},v.percent=function(n,e){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(e)){var t=parseFloat(e);if(t>=0&&t<=100)return this.set(n,t),!0}return!1},c}();function _(c,v,x,n){var e=n?c.split(n):[c];for(var t in e){if(typeof e[t]!="string")continue;var i=e[t].split(x);if(i.length!==2)continue;var p=i[0],u=i[1];v(p,u)}}var A=new k.default(0,0,""),C=A.align==="middle"?"middle":"center";function s(c,v,x){var n=c;function e(){var p=L(c);if(p===null)throw new Error("Malformed timestamp: "+n);return c=c.replace(/^[^\sa-zA-Z-]+/,""),p}function t(p,u){var h=new B;_(p,function(f,l){var r;switch(f){case"region":for(var a=x.length-1;a>=0;a--)if(x[a].id===l){h.set(f,x[a].region);break}break;case"vertical":h.alt(f,l,["rl","lr"]);break;case"line":r=l.split(","),h.integer(f,r[0]),h.percent(f,r[0])&&h.set("snapToLines",!1),h.alt(f,r[0],["auto"]),r.length===2&&h.alt("lineAlign",r[1],["start",C,"end"]);break;case"position":r=l.split(","),h.percent(f,r[0]),r.length===2&&h.alt("positionAlign",r[1],["start",C,"end","line-left","line-right","auto"]);break;case"size":h.percent(f,l);break;case"align":h.alt(f,l,["start",C,"end","left","right"]);break}},/:/,/\s/),u.region=h.get("region",null),u.vertical=h.get("vertical","");var T=h.get("line","auto");T==="auto"&&A.line===-1&&(T=-1),u.line=T,u.lineAlign=h.get("lineAlign","start"),u.snapToLines=h.get("snapToLines",!0),u.size=h.get("size",100),u.align=h.get("align",C);var g=h.get("position","auto");g==="auto"&&A.position===50&&(g=u.align==="start"||u.align==="left"?0:u.align==="end"||u.align==="right"?100:50),u.position=g}function i(){c=c.replace(/^\s+/,"")}if(i(),v.startTime=e(),i(),c.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+n);c=c.substr(3),i(),v.endTime=e(),i(),t(c,v)}function m(c){return c.replace(/<br(?: \/)?>/gi,`
`)}var b=function(){function c(){this.state="INITIAL",this.buffer="",this.decoder=new D,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var v=c.prototype;return v.parse=function(n){var e=this;n&&(e.buffer+=e.decoder.decode(n,{stream:!0}));function t(){var g=e.buffer,f=0;for(g=m(g);f<g.length&&g[f]!=="\r"&&g[f]!==`
`;)++f;var l=g.substr(0,f);return g[f]==="\r"&&++f,g[f]===`
`&&++f,e.buffer=g.substr(f),l}function i(g){_(g,function(f,l){},/:/)}try{var p="";if(e.state==="INITIAL"){if(!/\r\n|\n/.test(e.buffer))return this;p=t();var u=p.match(/^()?WEBVTT([ \t].*)?$/);if(!u||!u[0])throw new Error("Malformed WebVTT signature.");e.state="HEADER"}for(var h=!1;e.buffer;){if(!/\r\n|\n/.test(e.buffer))return this;h?h=!1:p=t();switch(e.state){case"HEADER":/:/.test(p)?i(p):p||(e.state="ID");continue;case"NOTE":p||(e.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(p)){e.state="NOTE";break}if(!p)continue;if(e.cue=new k.default(0,0,""),e.state="CUE",p.indexOf("-->")===-1){e.cue.id=p;continue}case"CUE":if(!e.cue){e.state="BADCUE";continue}try{s(p,e.cue,e.regionList)}catch(g){e.cue=null,e.state="BADCUE";continue}e.state="CUETEXT";continue;case"CUETEXT":{var T=p.indexOf("-->")!==-1;if(!p||T&&(h=!0)){e.oncue&&e.cue&&e.oncue(e.cue),e.cue=null,e.state="ID";continue}if(e.cue===null)continue;e.cue.text&&(e.cue.text+=`
`),e.cue.text+=p}continue;case"BADCUE":p||(e.state="ID")}}}catch(g){e.state==="CUETEXT"&&e.cue&&e.oncue&&e.oncue(e.cue),e.cue=null,e.state=e.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},v.flush=function(){var n=this;try{if((n.cue||n.state==="HEADER")&&(n.buffer+=`
`,n.parse()),n.state==="INITIAL"||n.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(e){n.onparsingerror&&n.onparsingerror(e)}return n.onflush&&n.onflush(),this},c}()},"./src/utils/webvtt-parser.ts":function(se,U,S){"use strict";S.r(U),S.d(U,"generateCueId",function(){return b}),S.d(U,"parseWebVTT",function(){return v});var k=S("./src/polyfills/number.ts"),D=S("./src/utils/vttparser.ts"),L=S("./src/demux/id3.ts"),B=S("./src/utils/timescale-conversion.ts"),_=S("./src/remux/mp4-remuxer.ts"),A=/\r\n|\n\r|\n|\r/g,C=function(n,e,t){return t===void 0&&(t=0),n.substr(t,e.length)===e},s=function(n){var e=parseInt(n.substr(-3)),t=parseInt(n.substr(-6,2)),i=parseInt(n.substr(-9,2)),p=n.length>9?parseInt(n.substr(0,n.indexOf(":"))):0;if(!Object(k.isFiniteNumber)(e)||!Object(k.isFiniteNumber)(t)||!Object(k.isFiniteNumber)(i)||!Object(k.isFiniteNumber)(p))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+n);return e+=1e3*t,e+=60*1e3*i,e+=60*60*1e3*p,e},m=function(n){for(var e=5381,t=n.length;t;)e=e*33^n.charCodeAt(--t);return(e>>>0).toString()};function b(x,n,e){return m(x.toString())+m(n.toString())+m(e)}var c=function(n,e,t){var i=n[e],p=n[i.prevCC];if(!p||!p.new&&i.new){n.ccOffset=n.presentationOffset=i.start,i.new=!1;return}for(;(u=p)!==null&&u!==void 0&&u.new;){var u;n.ccOffset+=i.start-p.start,i.new=!1,i=p,p=n[i.prevCC]}n.presentationOffset=t};function v(x,n,e,t,i,p,u,h){var T=new D.VTTParser,g=Object(L.utf8ArrayToStr)(new Uint8Array(x)).trim().replace(A,`
`).split(`
`),f=[],l=Object(B.toMpegTsClockFromTimescale)(n,e),r="00:00.000",a=0,y=0,E,w=!0,R=!1;T.oncue=function(M){var N=t[i],j=t.ccOffset,K=(a-l)/9e4;if(N!=null&&N.new&&(y!==void 0?j=t.ccOffset=N.start:c(t,i,K)),K&&(j=K-t.presentationOffset),R){var V=M.endTime-M.startTime,z=Object(_.normalizePts)((M.startTime+j-y)*9e4,p*9e4)/9e4;M.startTime=z,M.endTime=z+V}var Q=M.text.trim();M.text=decodeURIComponent(encodeURIComponent(Q)),M.id||(M.id=b(M.startTime,M.endTime,Q)),M.endTime>0&&f.push(M)},T.onparsingerror=function(M){E=M},T.onflush=function(){if(E){h(E);return}u(f)},g.forEach(function(M){if(w)if(C(M,"X-TIMESTAMP-MAP=")){w=!1,R=!0,M.substr(16).split(",").forEach(function(N){C(N,"LOCAL:")?r=N.substr(6):C(N,"MPEGTS:")&&(a=parseInt(N.substr(7)))});try{y=s(r)/1e3}catch(N){R=!1,E=N}return}else M===""&&(w=!1);T.parse(M+`
`)}),T.flush()}},"./src/utils/xhr-loader.ts":function(se,U,S){"use strict";S.r(U);var k=S("./src/utils/logger.ts"),D=S("./src/loader/load-stats.ts"),L=/^age:\s*[\d.]+\s*$/m,B=function(){function _(C){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=C?C.xhrSetup:null,this.stats=new D.LoadStats,this.retryDelay=0}var A=_.prototype;return A.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},A.abortInternal=function(){var s=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),s&&(s.onreadystatechange=null,s.onprogress=null,s.readyState!==4&&(this.stats.aborted=!0,s.abort()))},A.abort=function(){var s;this.abortInternal(),(s=this.callbacks)!==null&&s!==void 0&&s.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},A.load=function(s,m,b){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=s,this.config=m,this.callbacks=b,this.retryDelay=m.retryDelay,this.loadInternal()},A.loadInternal=function(){var s=this.config,m=this.context;if(!s)return;var b=this.loader=new self.XMLHttpRequest,c=this.stats;c.loading.first=0,c.loaded=0;var v=this.xhrSetup;try{if(v)try{v(b,m.url)}catch(e){b.open("GET",m.url,!0),v(b,m.url)}b.readyState||b.open("GET",m.url,!0);var x=this.context.headers;if(x)for(var n in x)b.setRequestHeader(n,x[n])}catch(e){this.callbacks.onError({code:b.status,text:e.message},m,b);return}m.rangeEnd&&b.setRequestHeader("Range","bytes="+m.rangeStart+"-"+(m.rangeEnd-1)),b.onreadystatechange=this.readystatechange.bind(this),b.onprogress=this.loadprogress.bind(this),b.responseType=m.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.timeout),b.send()},A.readystatechange=function(){var s=this.context,m=this.loader,b=this.stats;if(!s||!m)return;var c=m.readyState,v=this.config;if(b.aborted)return;if(c>=2)if(self.clearTimeout(this.requestTimeout),b.loading.first===0&&(b.loading.first=Math.max(self.performance.now(),b.loading.start)),c===4){m.onreadystatechange=null,m.onprogress=null;var x=m.status;if(x>=200&&x<300){b.loading.end=Math.max(self.performance.now(),b.loading.first);var n,e;if(s.responseType==="arraybuffer"?(n=m.response,e=n.byteLength):(n=m.responseText,e=n.length),b.loaded=b.total=e,!this.callbacks)return;var t=this.callbacks.onProgress;if(t&&t(b,s,n,m),!this.callbacks)return;var i={url:m.responseURL,data:n};this.callbacks.onSuccess(i,b,s,m)}else b.retry>=v.maxRetry||x>=400&&x<499?(k.logger.error(x+" while loading "+s.url),this.callbacks.onError({code:x,text:m.statusText},s,m)):(k.logger.warn(x+" while loading "+s.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,v.maxRetryDelay),b.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),v.timeout)},A.loadtimeout=function(){k.logger.warn("timeout while loading "+this.context.url);var s=this.callbacks;s&&(this.abortInternal(),s.onTimeout(this.stats,this.context,this.loader))},A.loadprogress=function(s){var m=this.stats;m.loaded=s.loaded,s.lengthComputable&&(m.total=s.total)},A.getCacheAge=function(){var s=null;if(this.loader&&L.test(this.loader.getAllResponseHeaders())){var m=this.loader.getResponseHeader("age");s=m?parseFloat(m):null}return s},_}();U.default=B}}).default})},vHTk:function(Ze,le,H){Ze.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);