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__Question__Index.1d328f82...

330 lines
812 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[196,5,7,8,10],{"+92d":function(ft,ze,K){ft.exports=K.p+"static/b1.8d46544a.svg"},"+RDj":function(ft,ze,K){ft.exports=K.p+"static/dau.0c862b4c.svg"},"3SPk":function(ft,ze,K){ft.exports=K.p+"static/c.893027ce.svg"},"5A5F":function(ft,ze,K){ft.exports={flex_box_center:"flex_box_center___3fvo9",flex_space_between:"flex_space_between___2dIWe",flex_box_vertical_center:"flex_box_vertical_center___213Et",flex_box_center_end:"flex_box_center_end___1GXlY",flex_box_column:"flex_box_column___2XTWO",wrap:"wrap___1JbzU",bg:"bg___Dxa5l",btnWrap:"btnWrap___1CEeA",text:"text___ufYpy",btn:"btn___33IXa",content:"content___2Crhb",left:"left___12ObT",filterPoint:"filterPoint___1wSyY",btnWarp:"btnWarp___XLUgV",btnActive:"btnActive___2vIUq",action:"action___m_eZE",btnMask:"btnMask___epWeB",filterOrigin:"filterOrigin___OKol4",line:"line___psQHn",control:"control___1SAJX",table:"table___1Q9AI",tabWarp:"tabWarp___3884f",tabWarp2:"tabWarp2___1f1Zo",customTable:"customTable___6Ubut","btn-style-1":"btn-style-1___m4kGi","btn-style-2":"btn-style-2___2uJ8s","btn-style-3":"btn-style-3___3kuYl",right:"right___Ie2u1",title:"title___1uK2v",sort:"sort___1hyjY",titles:"titles___1i-V6",li:"li___3lR-W",titleWarp:"titleWarp___t0Zdh",hov:"hov___30B5q",hovBtn:"hovBtn___3ciGX",tag:"tag___hllWE",problemsclose:"problemsclose___1X9HB",imgsrc:"imgsrc___3koep"}},"6+eU":function(ft,ze,K){"use strict";K.d(ze,"a",function(){return l});var oe=K("wx14"),N=K("rePB"),S=K("VTBJ"),I=K("1OyB"),g=K("vuIU"),E=K("Ji7U"),U=K("LK+K"),M=K("q1tI"),R=K.n(M),w=K("TSYQ"),x=K.n(w),T=function(c){var i,n="".concat(c.rootPrefixCls,"-item"),t=x()(n,"".concat(n,"-").concat(c.page),(i={},Object(N.a)(i,"".concat(n,"-active"),c.active),Object(N.a)(i,c.className,!!c.className),Object(N.a)(i,"".concat(n,"-disabled"),!c.page),i)),e=function(){c.onClick(c.page)},m=function(_){c.onKeyPress(_,c.onClick,c.page)};return R.a.createElement("li",{title:c.showTitle?c.page:null,className:t,onClick:e,onKeyPress:m,tabIndex:"0"},c.itemRender(c.page,"page",R.a.createElement("a",{rel:"nofollow"},c.page)))},O=T,C={ZERO:48,NINE:57,NUMPAD_ZERO:96,NUMPAD_NINE:105,BACKSPACE:8,DELETE:46,ENTER:13,ARROW_UP:38,ARROW_DOWN:40},b=function(p){Object(E.a)(i,p);var c=Object(U.a)(i);function i(){var n;Object(I.a)(this,i);for(var t=arguments.length,e=new Array(t),m=0;m<t;m++)e[m]=arguments[m];return n=c.call.apply(c,[this].concat(e)),n.state={goInputText:""},n.buildOptionText=function(y){return"".concat(y," ").concat(n.props.locale.items_per_page)},n.changeSize=function(y){n.props.changeSize(Number(y))},n.handleChange=function(y){n.setState({goInputText:y.target.value})},n.handleBlur=function(y){var _=n.props,A=_.goButton,k=_.quickGo,F=_.rootPrefixCls,z=n.state.goInputText;if(A||z==="")return;if(y.relatedTarget&&(y.relatedTarget.className.indexOf("".concat(F,"-prev"))>=0||y.relatedTarget.className.indexOf("".concat(F,"-next"))>=0))return;n.setState({goInputText:""}),k(n.getValidValue())},n.go=function(y){var _=n.state.goInputText;if(_==="")return;(y.keyCode===C.ENTER||y.type==="click")&&(n.setState({goInputText:""}),n.props.quickGo(n.getValidValue()))},n}return Object(g.a)(i,[{key:"getValidValue",value:function(){var t=this.state,e=t.goInputText,m=t.current;return!e||isNaN(e)?m:Number(e)}},{key:"getPageSizeOptions",value:function(){var t=this.props,e=t.pageSize,m=t.pageSizeOptions;return m.some(function(y){return y.toString()===e.toString()})?m:m.concat([e.toString()]).sort(function(y,_){var A=isNaN(Number(y))?0:Number(y),k=isNaN(Number(_))?0:Number(_);return A-k})}},{key:"render",value:function(){var t=this,e=this.props,m=e.pageSize,y=e.locale,_=e.rootPrefixCls,A=e.changeSize,k=e.quickGo,F=e.goButton,z=e.selectComponentClass,Q=e.buildOptionText,Y=e.selectPrefixCls,X=e.disabled,le=this.state.goInputText,ye="".concat(_,"-options"),ve=z,Ne=null,Te=null,Ce=null;if(!A&&!k)return null;var _e=this.getPageSizeOptions();if(A&&ve){var Re=_e.map(function(he,Z){return R.a.createElement(ve.Option,{key:Z,value:he.toString()},(Q||t.buildOptionText)(he))});Ne=R.a.createElement(ve,{disabled:X,prefixCls:Y,showSearch:!1,className:"".concat(ye,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(m||_e[0]).toString(),onChange:this.changeSize,getPopupContainer:function(Z){return Z.parentNode}},Re)}return k&&(F&&(Ce=typeof F=="boolean"?R.a.createElement("button",{type:"button",onClick:this.go,onKeyUp:this.go,disabled:X,className:"".concat(ye,"-quick-jumper-button")},y.jump_to_confirm):R.a.createElement("span",{onClick:this.go,onKeyUp:this.go},F)),Te=R.a.createElement("div",{className:"".concat(ye,"-quick-jumper")},y.jump_to,R.a.createElement("input",{disabled:X,type:"text",value:le,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur}),y.page,Ce)),R.a.createElement("li",{className:"".concat(ye)},Ne,Te)}}]),i}(R.a.Component);b.defaultProps={pageSizeOptions:["10","20","50","100"]};var v=b,h=K("N2Kk");function r(){}function o(p){return typeof p=="number"&&isFinite(p)&&Math.floor(p)===p}function s(p,c,i){return i}function f(p,c,i){var n=typeof p=="undefined"?c.pageSize:p;return Math.floor((i.total-1)/n)+1}var d=function(p){Object(E.a)(i,p);var c=Object(U.a)(i);function i(n){var t;Object(I.a)(this,i),t=c.call(this,n),t.getJumpPrevPage=function(){return Math.max(1,t.state.current-(t.props.showLessItems?3:5))},t.getJumpNextPage=function(){return Math.min(f(void 0,t.state,t.props),t.state.current+(t.props.showLessItems?3:5))},t.getItemIcon=function(A,k){var F=t.props.prefixCls,z=A||R.a.createElement("button",{type:"button","aria-label":k,className:"".concat(F,"-item-link")});return typeof A=="function"&&(z=R.a.createElement(A,Object(S.a)({},t.props))),z},t.savePaginationNode=function(A){t.paginationNode=A},t.isValid=function(A){return o(A)&&A!==t.state.current},t.shouldDisplayQuickJumper=function(){var A=t.props,k=A.showQuickJumper,F=A.pageSize,z=A.total;return z<=F?!1:k},t.handleKeyDown=function(A){(A.keyCode===C.ARROW_UP||A.keyCode===C.ARROW_DOWN)&&A.preventDefault()},t.handleKeyUp=function(A){var k=t.getValidValue(A),F=t.state.currentInputValue;k!==F&&t.setState({currentInputValue:k}),A.keyCode===C.ENTER?t.handleChange(k):A.keyCode===C.ARROW_UP?t.handleChange(k-1):A.keyCode===C.ARROW_DOWN&&t.handleChange(k+1)},t.changePageSize=function(A){var k=t.state.current,F=f(A,t.state,t.props);k=k>F?F:k,F===0&&(k=t.state.current),typeof A=="number"&&("pageSize"in t.props||t.setState({pageSize:A}),"current"in t.props||t.setState({current:k,currentInputValue:k})),t.props.onShowSizeChange(k,A),"onChange"in t.props&&t.props.onChange&&t.props.onChange(k,A)},t.handleChange=function(A){var k=t.props.disabled,F=A;if(t.isValid(F)&&!k){var z=f(void 0,t.state,t.props);F>z?F=z:F<1&&(F=1),"current"in t.props||t.setState({current:F,currentInputValue:F});var Q=t.state.pageSize;return t.props.onChange(F,Q),F}return t.state.current},t.prev=function(){t.hasPrev()&&t.handleChange(t.state.current-1)},t.next=function(){t.hasNext()&&t.handleChange(t.state.current+1)},t.jumpPrev=function(){t.handleChange(t.getJumpPrevPage())},t.jumpNext=function(){t.handleChange(t.getJumpNextPage())},t.hasPrev=function(){return t.state.current>1},t.hasNext=function(){return t.state.current<f(void 0,t.state,t.props)},t.runIfEnter=function(A,k){if(A.key==="Enter"||A.charCode===13){for(var F=arguments.length,z=new Array(F>2?F-2:0),Q=2;Q<F;Q++)z[Q-2]=arguments[Q];k.apply(void 0,z)}},t.runIfEnterPrev=function(A){t.runIfEnter(A,t.prev)},t.runIfEnterNext=function(A){t.runIfEnter(A,t.next)},t.runIfEnterJumpPrev=function(A){t.runIfEnter(A,t.jumpPrev)},t.runIfEnterJumpNext=function(A){t.runIfEnter(A,t.jumpNext)},t.handleGoTO=function(A){(A.keyCode===C.ENTER||A.type==="click")&&t.handleChange(t.state.currentInputValue)};var e=n.onChange!==r,m="current"in n;m&&!e&&console.warn("Warning: You provided a `current` prop to a Pagination component without an `onChange` handler. This will render a read-only component.");var y=n.defaultCurrent;"current"in n&&(y=n.current);var _=n.defaultPageSize;return"pageSize"in n&&(_=n.pageSize),y=Math.min(y,f(_,void 0,n)),t.state={current:y,currentInputValue:y,pageSize:_},t}return Object(g.a)(i,[{key:"componentDidUpdate",value:function(t,e){var m=this.props.prefixCls;if(e.current!==this.state.current&&this.paginationNode){var y=this.paginationNode.querySelector(".".concat(m,"-item-").concat(e.current));y&&document.activeElement===y&&y.blur()}}},{key:"getValidValue",value:function(t){var e=t.target.value,m=f(void 0,this.state,this.props),y=this.state.currentInputValue,_;return e===""?_=e:isNaN(Number(e))?_=y:e>=m?_=m:_=Number(e),_}},{key:"getShowSizeChanger",value:function(){var t=this.props,e=t.showSizeChanger,m=t.total,y=t.totalBoundaryShowSizeChanger;return typeof e!="undefined"?e:m>y}},{key:"renderPrev",value:function(t){var e=this.props,m=e.prevIcon,y=e.itemRender,_=y(t,"prev",this.getItemIcon(m,"prev page")),A=!this.hasPrev();return Object(M.isValidElement)(_)?Object(M.cloneElement)(_,{disabled:A}):_}},{key:"renderNext",value:function(t){var e=this.props,m=e.nextIcon,y=e.itemRender,_=y(t,"next",this.getItemIcon(m,"next page")),A=!this.hasNext();return Object(M.isValidElement)(_)?Object(M.cloneElement)(_,{disabled:A}):_}},{key:"render",value:function(){var t=this,e=this.props,m=e.prefixCls,y=e.className,_=e.style,A=e.disabled,k=e.hideOnSinglePage,F=e.total,z=e.locale,Q=e.showQuickJumper,Y=e.showLessItems,X=e.showTitle,le=e.showTotal,ye=e.simple,ve=e.itemRender,Ne=e.showPrevNextJumpers,Te=e.jumpPrevIcon,Ce=e.jumpNextIcon,_e=e.selectComponentClass,Re=e.selectPrefixCls,he=e.pageSizeOptions,Z=this.state,je=Z.current,lt=Z.pageSize,nt=Z.currentInputValue;if(k===!0&&F<=lt)return null;var Ke=f(void 0,this.state,this.props),Ge=[],Pe=null,We=null,Qe=null,Ze=null,$e=null,Ue=Q&&Q.goButton,Fe=Y?1:2,ct=je-1>0?je-1:0,ot=je+1<Ke?je+1:Ke,st=Object.keys(this.props).reduce(function(H,G){return(G.substr(0,5)==="data-"||G.substr(0,5)==="aria-"||G==="role")&&(H[G]=t.props[G]),H},{});if(ye)return Ue&&(typeof Ue=="boolean"?$e=R.a.createElement("button",{type:"button",onClick:this.handleGoTO,onKeyUp:this.handleGoTO},z.jump_to_confirm):$e=R.a.createElement("span",{onClick:this.handleGoTO,onKeyUp:this.handleGoTO},Ue),$e=R.a.createElement("li",{title:X?"".concat(z.jump_to).concat(je,"/").concat(Ke):null,className:"".concat(m,"-simple-pager")},$e)),R.a.createElement("ul",Object(oe.a)({className:x()(m,"".concat(m,"-simple"),Object(N.a)({},"".concat(m,"-disabled"),A),y),style:_,ref:this.savePaginationNode},st),R.a.createElement("li",{title:X?z.prev_page:null,onClick:this.prev,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterPrev,className:x()("".concat(m,"-prev"),Object(N.a)({},"".concat(m,"-disabled"),!this.hasPrev())),"aria-disabled":!this.hasPrev()},this.renderPrev(ct)),R.a.createElement("li",{title:X?"".concat(je,"/").concat(Ke):null,className:"".concat(m,"-simple-pager")},R.a.createElement("input",{type:"text",value:nt,disabled:A,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onChange:this.handleKeyUp,size:"3"}),R.a.createElement("span",{className:"".concat(m,"-slash")},"/"),Ke),R.a.createElement("li",{title:X?z.next_page:null,onClick:this.next,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterNext,className:x()("".concat(m,"-next"),Object(N.a)({},"".concat(m,"-disabled"),!this.hasNext())),"aria-disabled":!this.hasNext()},this.renderNext(ot)),$e);if(Ke<=3+Fe*2){var rt={locale:z,rootPrefixCls:m,onClick:this.handleChange,onKeyPress:this.runIfEnter,showTitle:X,itemRender:ve};Ke||Ge.push(R.a.createElement(O,Object(oe.a)({},rt,{key:"noPager",page:Ke,className:"".concat(m,"-disabled")})));for(var ht=1;ht<=Ke;ht+=1){var ut=je===ht;Ge.push(R.a.createElement(O,Object(oe.a)({},rt,{key:ht,page:ht,active:ut})))}}else{var fe=Y?z.prev_3:z.prev_5,be=Y?z.next_3:z.next_5;Ne&&(Pe=R.a.createElement("li",{title:X?fe:null,key:"prev",onClick:this.jumpPrev,tabIndex:"0",onKeyPress:this.runIfEnterJumpPrev,className:x()("".concat(m,"-jump-prev"),Object(N.a)({},"".concat(m,"-jump-prev-custom-icon"),!!Te))},ve(this.getJumpPrevPage(),"jump-prev",this.getItemIcon(Te,"prev page"))),We=R.a.createElement("li",{title:X?be:null,key:"next",tabIndex:"0",onClick:this.jumpNext,onKeyPress:this.runIfEnterJumpNext,className:x()("".concat(m,"-jump-next"),Object(N.a)({},"".concat(m,"-jump-next-custom-icon"),!!Ce))},ve(this.getJumpNextPage(),"jump-next",this.getItemIcon(Ce,"next page")))),Ze=R.a.createElement(O,{locale:z,last:!0,rootPrefixCls:m,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:Ke,page:Ke,active:!1,showTitle:X,itemRender:ve}),Qe=R.a.createElement(O,{locale:z,rootPrefixCls:m,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:1,page:1,active:!1,showTitle:X,itemRender:ve});var we=Math.max(1,je-Fe),ke=Math.min(je+Fe,Ke);je-1<=Fe&&(ke=1+Fe*2),Ke-je<=Fe&&(we=Ke-Fe*2);for(var xe=we;xe<=ke;xe+=1){var Oe=je===xe;Ge.push(R.a.createElement(O,{locale:z,rootPrefixCls:m,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:xe,page:xe,active:Oe,showTitle:X,itemRender:ve}))}je-1>=Fe*2&&je!==1+2&&(Ge[0]=Object(M.cloneElement)(Ge[0],{className:"".concat(m,"-item-after-jump-prev")}),Ge.unshift(Pe)),Ke-je>=Fe*2&&je!==Ke-2&&(Ge[Ge.length-1]=Object(M.cloneElement)(Ge[Ge.length-1],{className:"".concat(m,"-item-before-jump-next")}),Ge.push(We)),we!==1&&Ge.unshift(Qe),ke!==Ke&&Ge.push(Ze)}var ae=null;le&&(ae=R.a.createElement("li",{className:"".concat(m,"-total-text")},le(F,[F===0?0:(je-1)*lt+1,je*lt>F?F:je*lt])));var ee=!this.hasPrev()||!Ke,te=!this.hasNext()||!Ke;return R.a.createElement("ul",Object(oe.a)({className:x()(m,y,Object(N.a)({},"".concat(m,"-disabled"),A)),style:_,unselectable:"unselectable",ref:this.savePaginationNode},st),ae,R.a.createElement("li",{title:X?z.prev_page:null,onClick:this.prev,tabIndex:ee?null:0,onKeyPress:this.runIfEnterPrev,className:x()("".concat(m,"-prev"),Object(N.a)({},"".concat(m,"-disabled"),ee)),"aria-disabled":ee},this.renderPrev(ct)),Ge,R.a.createElement("li",{title:X?z.next_page:null,onClick:this.next,tabIndex:te?null:0,onKeyPress:this.runIfEnterNext,className:x()("".concat(m,"-next"),Object(N.a)({},"".concat(m,"-disabled"),te)),"aria-disabled":te},this.renderNext(ot)),R.a.createElement(v,{disabled:A,locale:z,rootPrefixCls:m,selectComponentClass:_e,selectPrefixCls:Re,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:je,pageSize:lt,pageSizeOptions:he,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:Ue}))}}],[{key:"getDerivedStateFromProps",value:function(t,e){var m={};if("current"in t&&(m.current=t.current,t.current!==e.current&&(m.currentInputValue=m.current)),"pageSize"in t&&t.pageSize!==e.pageSize){var y=e.current,_=f(t.pageSize,e,t);y=y>_?_:y,"current"in t||(m.current=y,m.currentInputValue=y),m.pageSize=t.pageSize}return m}}]),i}(R.a.Component);d.defaultProps={defaultCurrent:1,total:0,defaultPageSize:10,onChange:r,className:"",selectPrefixCls:"rc-select",prefixCls:"rc-pagination",selectComponentClass:null,hideOnSinglePage:!1,showPrevNextJumpers:!0,showQuickJumper:!1,showLessItems:!1,showTitle:!0,onShowSizeChange:r,locale:h.a,style:{},itemRender:s,totalBoundaryShowSizeChanger:50};var l=d},"6RRn":function(ft,ze,K){"use strict";var oe=K("wCXF"),N=K("n6Qo");K.d(ze,"b",function(){return N.a});var S=K("IBYe"),I=K("6eGT"),g=K("hW8S");K.d(ze,"a",function(){return g.a}),ze.c=oe.b},"6eGT":function(ft,ze,K){"use strict";function oe(N){return null}ze.a=oe},"815F":function(ft,ze,K){"use strict";K.d(ze,"e",function(){return U}),K.d(ze,"c",function(){return R}),K.d(ze,"d",function(){return w}),K.d(ze,"a",function(){return T}),K.d(ze,"f",function(){return O}),K.d(ze,"b",function(){return C});var oe=K("KQm4"),N=K("VTBJ"),S=K("Ff2n"),I=K("Zm9Q"),g=K("Kwbf"),E=K("OZM5");function U(b,v){return b!=null?b:v}function M(){var b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],v=new Map;function h(r){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";(r||[]).forEach(function(s){var f=s.key,d=s.children;Object(g.a)(f!=null,"Tree node must have a certain key: [".concat(o).concat(f,"]"));var l=String(f);Object(g.a)(!v.has(l)||f===null||f===void 0,"Same 'key' exist in the Tree: ".concat(l)),v.set(l,!0),h(d,"".concat(o).concat(l," > "))})}h(b)}function R(b){function v(h){var r=Object(I.a)(h);return r.map(function(o){if(!Object(E.i)(o))return Object(g.a)(!o,"Tree/TreeNode can only accept TreeNode as children."),null;var s=o.key,f=o.props,d=f.children,l=Object(S.a)(f,["children"]),p=Object(N.a)({key:s},l),c=v(d);return c.length&&(p.children=c),p}).filter(function(o){return o})}return v(b)}function w(){var b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],h=new Set(v===!0?[]:v),r=[];function o(s){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return s.map(function(d,l){var p=Object(E.h)(f?f.pos:"0",l),c=U(d.key,p),i=Object(N.a)(Object(N.a)({},d),{},{parent:f,pos:p,children:null,data:d,isStart:[].concat(Object(oe.a)(f?f.isStart:[]),[l===0]),isEnd:[].concat(Object(oe.a)(f?f.isEnd:[]),[l===s.length-1])});return r.push(i),v===!0||h.has(c)?i.children=o(d.children||[],i):i.children=[],i})}return o(b),r}function x(b,v,h){var r;h?typeof h=="string"?r=function(f){return f[h]}:typeof h=="function"&&(r=function(f){return h(f)}):r=function(f,d){return U(f.key,d)};function o(s,f,d){var l=s?s.children:b,p=s?Object(E.h)(d.pos,f):"0";if(s){var c=r(s,p),i={node:s,index:f,pos:p,key:c,parentPos:d.node?d.pos:null,level:d.level+1};v(i)}l&&l.forEach(function(n,t){o(n,t,{node:s,pos:p,level:d?d.level+1:-1})})}o(null)}function T(b){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},h=v.initWrapper,r=v.processEntity,o=v.onProcessFinished,s=arguments.length>2?arguments[2]:void 0,f={},d={},l={posEntities:f,keyEntities:d};return h&&(l=h(l)||l),x(b,function(p){var c=p.node,i=p.index,n=p.pos,t=p.key,e=p.parentPos,m=p.level,y={node:c,index:i,key:t,pos:n,level:m},_=U(t,n);f[n]=y,d[_]=y,y.parent=f[e],y.parent&&(y.parent.children=y.parent.children||[],y.parent.children.push(y)),r&&r(y,l)},s),o&&o(l),l}function O(b,v){var h=v.expandedKeys,r=v.selectedKeys,o=v.loadedKeys,s=v.loadingKeys,f=v.checkedKeys,d=v.halfCheckedKeys,l=v.dragOverNodeKey,p=v.dropPosition,c=v.keyEntities,i=c[b],n={eventKey:b,expanded:h.indexOf(b)!==-1,selected:r.indexOf(b)!==-1,loaded:o.indexOf(b)!==-1,loading:s.indexOf(b)!==-1,checked:f.indexOf(b)!==-1,halfChecked:d.indexOf(b)!==-1,pos:String(i?i.pos:""),dragOver:l===b&&p===0,dragOverGapTop:l===b&&p===-1,dragOverGapBottom:l===b&&p===1};return n}function C(b){var v=b.data,h=b.expanded,r=b.selected,o=b.checked,s=b.loaded,f=b.loading,d=b.halfChecked,l=b.dragOver,p=b.dragOverGapTop,c=b.dragOverGapBottom,i=b.pos,n=b.active,t=Object(N.a)(Object(N.a)({},v),{},{expanded:h,selected:r,checked:o,loaded:s,loading:f,halfChecked:d,dragOver:l,dragOverGapTop:p,dragOverGapBottom:c,pos:i,active:n});return"props"in t||Object.defineProperty(t,"props",{get:function(){return Object(g.a)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),b}}),t}},"8hTe":function(ft,ze,K){ft.exports={button:"button___1wy9m"}},"9Bee":function(ft,ze,K){"use strict";var oe=K("DYRE"),N=K("zeV3"),S=K("+L6B"),I=K("2/Rp"),g=K("k1fw"),E=K("9og8"),U=K("tJVT"),M=K("WmNS"),R=K.n(M),w=K("q1tI"),x=K.n(w),T=K("vg9a"),O=K("DlQD"),C=K.n(O),b=K("rUJ1");function v(P,a){var u=P.match(/^(\s+)(?:```)/);if(u===null)return a;var D=u[1];return a.split(`
`).map(function(B){var L=B.match(/^\s+/);if(L===null)return B;var se=Object(U.a)(L,1),Ie=se[0];return Ie.length>=D.length?B.slice(D.length):B}).join(`
`)}var h=[],r=["<ul>"],o=new C.a.Renderer,s=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function f(){h.length=0,r=["<ul>"]}var d={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function l(P,a,u,D){if(a>=P.length||P[a].level<=u)return a;var B=P[a];D.push("<li><a href='#"+B.anchor+"'>"+B.text+"</a>"),a++;var L=[];return a=l(P,a,B.level,L),L.length>0&&(D.push("<ul>"),L.forEach(function(se){D.push(se)}),D.push("</ul>")),D.push("</li>"),a=l(P,a,u,D),a}function p(){return l(h,0,0,r),r.push("</ul>"),r.join("")}var c={heading:function(a){var u=s.exec(a);if(u)return{type:"heading",raw:u[0],depth:u[1].length,text:u[2]}},fences:function(a){var u=this.rules.block.fences.exec(a);if(u){var D=u[0],B=v(D,u[3]||""),L=u[2]?u[2].trim():u[2];if(["latex","katex","math"].indexOf(L)>=0){var se=t(),Ie=B;B=se,e[se]={type:"block",expression:Ie}}return{type:"code",raw:D,lang:L,text:B}}}},i=/(?:\${2})([^\n`]+?)(?:\${2})/gi,n=0,t=function(){return"__special_katext_id_".concat(n++,"__")},e={};function m(){return e}function y(){n=0,e={}}function _(P){return P=P.replace(i,function(a,u){var D=t();return e[D]={type:"inline",expression:u},D}),P}var A=o.listitem;o.listitem=function(P){return A(_(P))};var k=o.paragraph;o.paragraph=function(P){return k(_(P))};var F=o.tablecell;o.tablecell=function(P,a){return F(_(P),a)},o.code=function(P,a,u){var D=(a||"").match(/\S*/)[0];return D?["latex","katex","math"].indexOf(D)>=0?"<p class='editormd-tex'>".concat(P,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(a,'">').concat(u?P:Object(b.escape)(P,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(u?P:Object(b.escape)(P,!0))+"</code></pre>"},o.heading=function(P,a,u){var D=this.options.headerPrefix+u.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return h.push({anchor:D,level:a,text:P}),"<h"+a+' id="'+D+'">'+P+"</h"+a+">"},C.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),C.a.use({tokenizer:c,renderer:o});var z=C.a,Q=K("SJMd"),Y=K("ulZh"),X=K.n(Y),le=K("m3rI"),ye=K("Oy/b"),ve=K("p5ED"),Ne=K("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 Te=function(P,a){return(Te=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,D){u.__proto__=D}||function(u,D){for(var B in D)Object.prototype.hasOwnProperty.call(D,B)&&(u[B]=D[B])})(P,a)};function Ce(P,a){function u(){this.constructor=P}Te(P,a),P.prototype=a===null?Object.create(a):(u.prototype=a.prototype,new u)}function _e(P,a,u,D){return new(u||(u=Promise))(function(B,L){function se(pt){try{tt(D.next(pt))}catch(Be){L(Be)}}function Ie(pt){try{tt(D.throw(pt))}catch(Be){L(Be)}}function tt(pt){var Be;pt.done?B(pt.value):(Be=pt.value,Be instanceof u?Be:new u(function(bt){bt(Be)})).then(se,Ie)}tt((D=D.apply(P,a||[])).next())})}function Re(P,a){var u,D,B,L,se={label:0,sent:function(){if(1&B[0])throw B[1];return B[1]},trys:[],ops:[]};return L={next:Ie(0),throw:Ie(1),return:Ie(2)},typeof Symbol=="function"&&(L[Symbol.iterator]=function(){return this}),L;function Ie(tt){return function(pt){return function(Be){if(u)throw new TypeError("Generator is already executing.");for(;se;)try{if(u=1,D&&(B=2&Be[0]?D.return:Be[0]?D.throw||((B=D.return)&&B.call(D),0):D.next)&&!(B=B.call(D,Be[1])).done)return B;switch(D=0,B&&(Be=[2&Be[0],B.value]),Be[0]){case 0:case 1:B=Be;break;case 4:return se.label++,{value:Be[1],done:!1};case 5:se.label++,D=Be[1],Be=[0];continue;case 7:Be=se.ops.pop(),se.trys.pop();continue;default:if(!(B=se.trys,(B=B.length>0&&B[B.length-1])||Be[0]!==6&&Be[0]!==2)){se=0;continue}if(Be[0]===3&&(!B||Be[1]>B[0]&&Be[1]<B[3])){se.label=Be[1];break}if(Be[0]===6&&se.label<B[1]){se.label=B[1],B=Be;break}if(B&&se.label<B[2]){se.label=B[2],se.ops.push(Be);break}B[2]&&se.ops.pop(),se.trys.pop();continue}Be=a.call(P,se)}catch(bt){Be=[6,bt],D=0}finally{u=B=0}if(5&Be[0])throw Be[1];return{value:Be[0]?Be[1]:void 0,done:!0}}([tt,pt])}}}function he(){for(var P=0,a=0,u=arguments.length;a<u;a++)P+=arguments[a].length;var D=Array(P),B=0;for(a=0;a<u;a++)for(var L=arguments[a],se=0,Ie=L.length;se<Ie;se++,B++)D[B]=L[se];return D}var Z=function(){function P(){}return P.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},P.setAttributes=function(a,u){for(var D=0,B=u;D<B.length;D++){var L=B[D],se=L[0],Ie=L[1];a.setAttribute(se,Ie)}},P.createRect=function(a,u,D){var B=document.createElementNS("http://www.w3.org/2000/svg","rect");return B.setAttribute("width",a.toString()),B.setAttribute("height",u.toString()),D&&P.setAttributes(B,D),B},P.createLine=function(a,u,D,B,L){var se=document.createElementNS("http://www.w3.org/2000/svg","line");return se.setAttribute("x1",a.toString()),se.setAttribute("y1",u.toString()),se.setAttribute("x2",D.toString()),se.setAttribute("y2",B.toString()),L&&P.setAttributes(se,L),se},P.createPolygon=function(a,u){var D=document.createElementNS("http://www.w3.org/2000/svg","polygon");return D.setAttribute("points",a),u&&P.setAttributes(D,u),D},P.createCircle=function(a,u){var D=document.createElementNS("http://www.w3.org/2000/svg","circle");return D.setAttribute("cx",(a/2).toString()),D.setAttribute("cy",(a/2).toString()),D.setAttribute("r",a.toString()),u&&P.setAttributes(D,u),D},P.createEllipse=function(a,u,D){var B=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return B.setAttribute("cx",(a/2).toString()),B.setAttribute("cy",(u/2).toString()),B.setAttribute("rx",(a/2).toString()),B.setAttribute("ry",(u/2).toString()),D&&P.setAttributes(B,D),B},P.createGroup=function(a){var u=document.createElementNS("http://www.w3.org/2000/svg","g");return a&&P.setAttributes(u,a),u},P.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},P.createMarker=function(a,u,D,B,L,se,Ie){var tt=document.createElementNS("http://www.w3.org/2000/svg","marker");return P.setAttributes(tt,[["id",a],["orient",u],["markerWidth",D.toString()],["markerHeight",B.toString()],["refX",L.toString()],["refY",se.toString()]]),tt.appendChild(Ie),tt},P.createText=function(a){var u=document.createElementNS("http://www.w3.org/2000/svg","text");return u.setAttribute("x","0"),u.setAttribute("y","0"),a&&P.setAttributes(u,a),u},P.createTSpan=function(a,u){var D=document.createElementNS("http://www.w3.org/2000/svg","tspan");return D.textContent=a,u&&P.setAttributes(D,u),D},P.createImage=function(a){var u=document.createElementNS("http://www.w3.org/2000/svg","image");return a&&P.setAttributes(u,a),u},P.createPoint=function(a,u){var D=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return D.x=a,D.y=u,D},P.createPath=function(a,u){var D=document.createElementNS("http://www.w3.org/2000/svg","path");return D.setAttribute("d",a),u&&P.setAttributes(D,u),D},P}(),je=function(){function P(){}return P.addKey=function(a){P.key=a},Object.defineProperty(P,"isLicensed",{get:function(){return!!P.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(P.key)},enumerable:!1,configurable:!0}),P}(),lt=function(){function P(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return P.prototype.rasterize=function(a,u,D){var B=this;return new Promise(function(L){var se=D!==void 0?D:document.createElement("canvas");a===null&&(B.markersOnly=!0,B.naturalSize=!1);var Ie=document.createElementNS("http://www.w3.org/2000/svg","svg");Ie.setAttribute("xmlns","http://www.w3.org/2000/svg"),Ie.setAttribute("width",u.width.baseVal.valueAsString),Ie.setAttribute("height",u.height.baseVal.valueAsString),Ie.setAttribute("viewBox","0 0 "+u.viewBox.baseVal.width.toString()+" "+u.viewBox.baseVal.height.toString()),Ie.innerHTML=u.innerHTML,B.naturalSize===!0?(Ie.width.baseVal.value=a.naturalWidth,Ie.height.baseVal.value=a.naturalHeight):B.width!==void 0&&B.height!==void 0&&(Ie.width.baseVal.value=B.width,Ie.height.baseVal.value=B.height),se.width=Ie.width.baseVal.value,se.height=Ie.height.baseVal.value;var tt=Ie.outerHTML,pt=se.getContext("2d");B.markersOnly!==!0&&pt.drawImage(a,0,0,se.width,se.height);var Be=window.URL,bt=new Image(se.width,se.height);bt.setAttribute("crossOrigin","anonymous");var Tt=new Blob([tt],{type:"image/svg+xml"}),Qt=Be.createObjectURL(Tt);bt.onload=function(){pt.drawImage(bt,0,0),Be.revokeObjectURL(Qt);var Ae=se.toDataURL(B.imageType,B.imageQuality);L(Ae)},bt.src=Qt})},P}(),nt=function(){},Ke=function(){function P(a){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+a+"_"}return Object.defineProperty(P.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(P.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(P.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),P.prototype.addClass=function(a){return this.styleSheet===void 0&&this.addStyleSheet(),a.name=""+this.classNamePrefix+a.localName,this.classes.push(a),this.styleSheet.sheet.insertRule("."+a.name+" {"+a.style+"}",this.styleSheet.sheet.cssRules.length),a},P.prototype.addRule=function(a){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(a),this.styleSheet.sheet.insertRule(a.selector+" {"+a.style+"}",this.styleSheet.sheet.cssRules.length)},P.prototype.addStyleSheet=function(){var a;this.styleSheet=document.createElement("style"),((a=this.styleSheetRoot)!==null&&a!==void 0?a:document.head).appendChild(this.styleSheet),this.addRule(new Ge("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Ge("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new Ge("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new Pe("fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new Pe("fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},P.prototype.removeStyleSheet=function(){var a;this.styleSheet&&(((a=this.styleSheetRoot)!==null&&a!==void 0?a:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},P}(),Ge=function(P,a){this.selector=P,this.style=a},Pe=function(P,a){this.localName=P,this.style=a},We=function(){function P(a,u,D,B,L){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=a,this.displayMode=u,this.markerItems=D,this.uiStyleSettings=B,this.styles=L,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return P.prototype.show=function(a){var u=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=a,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var D=document.createElement("div");D.className=this.toolbarBlockStyleClass.name,D.style.whiteSpace="nowrap",this.uiContainer.appendChild(D),this.addActionButton(D,'<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(D,'<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(D,'<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(D,'<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(D,'<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(D,'<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(D,'<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(D,'<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(L){var se=document.createElement("div");se.className=""+u.toolbarButtonStyleClass.name,se.setAttribute("data-type-name",L.typeName),se.innerHTML=L.icon,se.addEventListener("click",function(){u.markerToolbarButtonClicked(se,L)}),u.buttons.push(se),u.markerButtons.push(se)}),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 B=document.createElement("div");B.className=this.toolbarBlockStyleClass.name,B.style.whiteSpace="nowrap",B.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(B),this.addActionButton(B,'<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(B,'<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()},P.prototype.addButtonClickListener=function(a){this.buttonClickListeners.push(a)},P.prototype.removeButtonClickListener=function(a){this.buttonClickListeners.indexOf(a)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(a),1)},P.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},P.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var a=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var u=0;u<this.markerButtons.length;u++)u<a||u===a&&this.markerButtons.length-1===a?this.markerButtonBlock.appendChild(this.markerButtons[u]):(u===a&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[u]))}},P.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")},P.prototype.resetButtonStyles=function(){var a=this;this.buttons.forEach(function(u){u.className=u.className.replace(a.uiStyleSettings.toolbarButtonStyleColorsClassName?a.uiStyleSettings.toolbarButtonStyleColorsClassName:a.toolbarButtonStyleColorsClass.name,"").trim(),u.className=u.className.replace(a.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?a.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:a.toolbarActiveButtonStyleColorsClass.name,"").trim(),u.className+=" "+(a.uiStyleSettings.toolbarButtonStyleColorsClassName?a.uiStyleSettings.toolbarButtonStyleColorsClassName:a.toolbarButtonStyleColorsClass.name)})},P.prototype.addActionButton=function(a,u,D){var B=this,L=document.createElement("div");switch(L.className=""+this.toolbarButtonStyleClass.name,L.innerHTML=u,L.setAttribute("data-action",D),L.addEventListener("click",function(){B.actionToolbarButtonClicked(L,D)}),D){case"select":L.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":L.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":L.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":L.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":L.style.fill=this.uiStyleSettings.closeButtonColor}a.appendChild(L),this.buttons.push(L)},P.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Pe("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 Pe("toolbar_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Pe("toolbar-block",`
display: inline-block;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new Pe("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 Pe("toolbar-overflow-block_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`));var a=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Pe("toolbar_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*a)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*a)+`px;
padding: `+a+`px;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Pe("toolbar_button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Pe("toolbar_active_button",`
fill: `+this.uiStyleSettings.toolbarColor+`;
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new Ge("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`)),this.styles.addRule(new Ge("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`))},P.prototype.markerToolbarButtonClicked=function(a,u){this.setActiveButton(a),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(D){return D("marker",u)}),this.markerButtonOverflowBlock.style.display="none"},P.prototype.actionToolbarButtonClicked=function(a,u){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(D){return D("action",u)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},P.prototype.setActiveButton=function(a){this.resetButtonStyles(),a.className=a.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),a.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},P.prototype.setActiveMarkerButton=function(a){var u=this.markerButtons.find(function(D){return D.getAttribute("data-type-name")===a});u&&this.setActiveButton(u)},P.prototype.setCurrentMarker=function(a){var u=this;this.currentMarker=a,this.buttons.filter(function(D){return/delete|notes/.test(D.getAttribute("data-action"))}).forEach(function(D){u.currentMarker===void 0?(D.style.fillOpacity="0.4",D.style.pointerEvents="none"):(D.style.fillOpacity="1",D.style.pointerEvents="all")})},P}(),Qe=function(){function P(a,u,D,B){this.panels=[],this.panelButtons=[],this.markerjsContainer=a,this.displayMode=u,this.uiStyleSettings=D,this.styles=B,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return P.prototype.addStyles=function(){var a;this.toolboxStyleClass=this.styles.addClass(new Pe("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 Pe("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var u=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new Pe("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new Pe("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new Pe("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 Pe("toolbox-panel-row_colors",`
background-color: `+((a=this.uiStyleSettings.toolboxBackgroundColor)!==null&&a!==void 0?a:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new Pe("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*u)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*u)+`px;
padding: `+u+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new Pe("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new Pe("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new Ge("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new Ge("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},P.prototype.show=function(a){var u;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=a,this.uiContainer.className=this.toolboxStyleClass.name+" "+((u=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&u!==void 0?u:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},P.prototype.setPanelButtons=function(a){var u,D,B=this;this.panels=a,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((u=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&u!==void 0?u:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((D=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&D!==void 0?D:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(L){var se;L.uiStyleSettings=B.uiStyleSettings;var Ie=document.createElement("div");Ie.className=B.toolboxButtonStyleClass.name+" "+((se=B.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&se!==void 0?se:B.toolboxButtonStyleColorsClass.name),Ie.innerHTML=L.icon,Ie.title=L.title,Ie.addEventListener("click",function(){B.panelButtonClick(L)}),B.panelButtons.push(Ie),B.buttonRow.appendChild(Ie)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},P.prototype.panelButtonClick=function(a){var u=this,D=-1;if(a!==this.activePanel){D=this.panels.indexOf(a),this.panelRow.innerHTML="";var B=a.getUi();B.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(B),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=a}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){u.displayMode==="inline"?u.panelRow.style.display="none":u.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(L,se){var Ie,tt;L.className=u.toolboxButtonStyleClass.name+" "+(se===D?""+((Ie=u.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Ie!==void 0?Ie:u.toolboxActiveButtonStyleColorsClass.name):""+((tt=u.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&tt!==void 0?tt:u.toolboxButtonStyleColorsClass.name))})},P}(),Ze=function(P,a){this.title=P,this.icon=a},$e=function(P){function a(u,D,B,L){var se=P.call(this,u,L||'<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 se.colors=[],se.addTransparent=!1,se.colorBoxes=[],se.colors=D,se.currentColor=B,se.setCurrentColor=se.setCurrentColor.bind(se),se.getColorBox=se.getColorBox.bind(se),se}return Ce(a,P),a.prototype.getUi=function(){var u=this,D=document.createElement("div");return D.style.overflow="hidden",D.style.whiteSpace="nowrap",this.colors.forEach(function(B){var L=u.getColorBox(B);D.appendChild(L),u.colorBoxes.push(L)}),D},a.prototype.getColorBox=function(u){var D=this,B=this.uiStyleSettings.toolbarHeight/4,L=this.uiStyleSettings.toolbarHeight-B,se=document.createElement("div");se.style.display="inline-block",se.style.boxSizing="content-box",se.style.width=L-2+"px",se.style.height=L-2+"px",se.style.padding="1px",se.style.marginRight="2px",se.style.marginBottom="2px",se.style.borderWidth="2px",se.style.borderStyle="solid",se.style.borderRadius=(L+2)/2+"px",se.style.borderColor=u===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",se.addEventListener("click",function(){D.setCurrentColor(u,se)});var Ie=document.createElement("div");return Ie.style.display="inline-block",Ie.style.width=L-2+"px",Ie.style.height=L-2+"px",Ie.style.backgroundColor=u,Ie.style.borderRadius=L/2+"px",u==="transparent"&&(Ie.style.fill=this.uiStyleSettings.toolboxAccentColor,Ie.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>`),se.appendChild(Ie),se},a.prototype.setCurrentColor=function(u,D){var B=this;this.currentColor=u,this.colorBoxes.forEach(function(L){L.style.borderColor=L===D?B.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(u)},a}(Ze),Ue=function(){function P(a,u,D){this._state="new",this._isSelected=!1,this._container=a,this._overlayContainer=u,this.globalSettings=D,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(P.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),P.prototype.ownsTarget=function(a){return!1},Object.defineProperty(P.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),P.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},P.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},P.prototype.pointerDown=function(a,u){},P.prototype.dblClick=function(a,u){},P.prototype.manipulate=function(a){},P.prototype.pointerUp=function(a){this.stateChanged()},P.prototype.dispose=function(){},P.prototype.addMarkerVisualToContainer=function(a){this.container.childNodes.length>0?this.container.insertBefore(a,this.container.childNodes[0]):this.container.appendChild(a)},P.prototype.getState=function(){return{typeName:P.typeName,state:this.state,notes:this.notes}},P.prototype.restoreState=function(a){this._state=a.state,this.notes=a.notes},P.prototype.scale=function(a,u){},P.prototype.colorChanged=function(a){this.onColorChanged&&this.onColorChanged(a),this.stateChanged()},P.prototype.fillColorChanged=function(a){this.onFillColorChanged&&this.onFillColorChanged(a),this.stateChanged()},P.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var a=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),a.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(a)&&this.onStateChanged(this)}},P.typeName="MarkerBase",P}(),Fe=function(){function P(){this.findGripByVisual=this.findGripByVisual.bind(this)}return P.prototype.findGripByVisual=function(a){return this.topLeft.ownsTarget(a)?this.topLeft:this.topCenter.ownsTarget(a)?this.topCenter:this.topRight.ownsTarget(a)?this.topRight:this.centerLeft.ownsTarget(a)?this.centerLeft:this.centerRight.ownsTarget(a)?this.centerRight:this.bottomLeft.ownsTarget(a)?this.bottomLeft:this.bottomCenter.ownsTarget(a)?this.bottomCenter:this.bottomRight.ownsTarget(a)?this.bottomRight:void 0},P}(),ct=function(){function P(){this.GRIP_SIZE=10,this.visual=Z.createGroup(),this.visual.appendChild(Z.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(Z.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return P.prototype.ownsTarget=function(a){return a===this.visual||a===this.visual.childNodes[0]||a===this.visual.childNodes[1]},P}(),ot=function(){function P(){}return P.toITransformMatrix=function(a){return{a:a.a,b:a.b,c:a.c,d:a.d,e:a.e,f:a.f}},P.toSVGMatrix=function(a,u){return a.a=u.a,a.b=u.b,a.c=u.c,a.d=u.d,a.e=u.e,a.f=u.f,a},P}(),st=function(P){function a(u,D,B){var L=P.call(this,u,D,B)||this;return L.left=0,L.top=0,L.width=0,L.height=0,L.defaultSize={x:50,y:20},L.offsetX=0,L.offsetY=0,L.rotationAngle=0,L.CB_DISTANCE=10,L._suppressMarkerCreateEvent=!1,L.container.transform.baseVal.appendItem(Z.createTransform()),L.setupControlBox(),L}return Ce(a,P),Object.defineProperty(a.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"visual",{get:function(){return this._visual},set:function(u){this._visual=u;var D=Z.createTransform();this._visual.transform.baseVal.appendItem(D)},enumerable:!1,configurable:!0}),a.prototype.ownsTarget=function(u){return!!P.prototype.ownsTarget.call(this,u)||!!(this.controlGrips.findGripByVisual(u)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(u))},a.prototype.pointerDown=function(u,D){P.prototype.pointerDown.call(this,u,D),this.state==="new"&&(this.left=u.x,this.top=u.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var B=this.unrotatePoint(u);if(this.manipulationStartX=B.x,this.manipulationStartY=B.y,this.offsetX=B.x-this.left,this.offsetY=B.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(D),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(D)){this.activeGrip=this.rotatorGrip;var L=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=L.x-this.width/2,this.top=L.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var se=this.container.transform.baseVal.getItem(0);se.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(se,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},a.prototype.pointerUp=function(u){var D=this.state;P.prototype.pointerUp.call(this,u),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(u),this._state="select",D==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},a.prototype.moveVisual=function(u){this.visual.style.transform="translate("+u.x+"px, "+u.y+"px)"},a.prototype.manipulate=function(u){var D=this.unrotatePoint(u);this.state==="creating"?this.resize(u):this.state==="move"?(this.left=this.manipulationStartLeft+(D.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(D.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(D):this.state==="rotate"&&this.rotate(u)},a.prototype.resize=function(u){var D=this.manipulationStartLeft,B=this.manipulationStartWidth,L=this.manipulationStartTop,se=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:D=this.manipulationStartLeft+u.x-this.manipulationStartX,B=this.manipulationStartWidth+this.manipulationStartLeft-D;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:B=this.manipulationStartWidth+u.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:L=this.manipulationStartTop+u.y-this.manipulationStartY,se=this.manipulationStartHeight+this.manipulationStartTop-L;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:se=this.manipulationStartHeight+u.y-this.manipulationStartY}B>=0?(this.left=D,this.width=B):(this.left=D+B,this.width=-B),se>=0?(this.top=L,this.height=se):(this.top=L+se,this.height=-se),this.setSize()},a.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},a.prototype.rotate=function(u){if(Math.abs(u.x-this.centerX)>.1){var D=Math.sign(u.x-this.centerX);this.rotationAngle=180*Math.atan((u.y-this.centerY)/(u.x-this.centerX))/Math.PI+90*D,this.applyRotation()}},a.prototype.applyRotation=function(){var u=this.container.transform.baseVal.getItem(0);u.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(u,0)},a.prototype.rotatePoint=function(u){if(this.rotationAngle===0)return u;var D=this.container.getCTM(),B=Z.createPoint(u.x,u.y);return{x:(B=B.matrixTransform(D)).x,y:B.y}},a.prototype.unrotatePoint=function(u){if(this.rotationAngle===0)return u;var D=this.container.getCTM();D=D.inverse();var B=Z.createPoint(u.x,u.y);return{x:(B=B.matrixTransform(D)).x,y:B.y}},a.prototype.select=function(){P.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},a.prototype.deselect=function(){P.prototype.deselect.call(this),this.controlBox.style.display="none"},a.prototype.setupControlBox=function(){this.controlBox=Z.createGroup();var u=Z.createTransform();u.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(u),this.container.appendChild(this.controlBox),this.controlRect=Z.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=Z.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 Fe,this.addControlGrips(),this.controlBox.style.display="none"},a.prototype.adjustControlBox=function(){var u=this.controlBox.transform.baseVal.getItem(0);u.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(u,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()},a.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()},a.prototype.createGrip=function(){var u=new ct;return u.visual.transform.baseVal.appendItem(Z.createTransform()),this.controlBox.appendChild(u.visual),u},a.prototype.positionGrips=function(){var u=this.controlGrips.topLeft.GRIP_SIZE,D=-u/2,B=D,L=(this.width+this.CB_DISTANCE)/2-u/2,se=(this.height+this.CB_DISTANCE)/2-u/2,Ie=this.height+this.CB_DISTANCE-u/2,tt=this.width+this.CB_DISTANCE-u/2;this.positionGrip(this.controlGrips.topLeft.visual,D,B),this.positionGrip(this.controlGrips.topCenter.visual,L,B),this.positionGrip(this.controlGrips.topRight.visual,tt,B),this.positionGrip(this.controlGrips.centerLeft.visual,D,se),this.positionGrip(this.controlGrips.centerRight.visual,tt,se),this.positionGrip(this.controlGrips.bottomLeft.visual,D,Ie),this.positionGrip(this.controlGrips.bottomCenter.visual,L,Ie),this.positionGrip(this.controlGrips.bottomRight.visual,tt,Ie),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,L,B-3*this.CB_DISTANCE)},a.prototype.positionGrip=function(u,D,B){var L=u.transform.baseVal.getItem(0);L.setTranslate(D,B),u.transform.baseVal.replaceItem(L,0)},a.prototype.hideControlBox=function(){this.controlBox.style.display="none"},a.prototype.showControlBox=function(){this.controlBox.style.display=""},a.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:ot.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:ot.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},P.prototype.getState.call(this))},a.prototype.restoreState=function(u){P.prototype.restoreState.call(this,u);var D=u;this.left=D.left,this.top=D.top,this.width=D.width,this.height=D.height,this.rotationAngle=D.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(ot.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,D.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(ot.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,D.containerTransformMatrix))},a.prototype.scale=function(u,D){P.prototype.scale.call(this,u,D);var B=this.rotatePoint({x:this.left,y:this.top}),L=this.unrotatePoint({x:B.x*u,y:B.y*D});this.left=L.x,this.top=L.y,this.width=this.width*u,this.height=this.height*D,this.adjustControlBox()},a}(Ue),rt=function(P){function a(u,D,B){var L=P.call(this,u,D,B)||this;return L.fillColor="transparent",L.strokeColor="transparent",L.strokeWidth=0,L.strokeDasharray="",L.opacity=1,L.setStrokeColor=L.setStrokeColor.bind(L),L.setFillColor=L.setFillColor.bind(L),L.setStrokeWidth=L.setStrokeWidth.bind(L),L.setStrokeDasharray=L.setStrokeDasharray.bind(L),L.createVisual=L.createVisual.bind(L),L}return Ce(a,P),a.prototype.ownsTarget=function(u){return!(!P.prototype.ownsTarget.call(this,u)&&u!==this.visual)},a.prototype.createVisual=function(){this.visual=Z.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)},a.prototype.pointerDown=function(u,D){P.prototype.pointerDown.call(this,u,D),this.state==="new"&&(this.createVisual(),this.moveVisual(u),this._state="creating")},a.prototype.manipulate=function(u){P.prototype.manipulate.call(this,u)},a.prototype.resize=function(u){P.prototype.resize.call(this,u),this.setSize()},a.prototype.setSize=function(){P.prototype.setSize.call(this),Z.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},a.prototype.pointerUp=function(u){P.prototype.pointerUp.call(this,u),this.setSize()},a.prototype.setStrokeColor=function(u){this.strokeColor=u,this.visual&&Z.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(u),this.stateChanged()},a.prototype.setFillColor=function(u){this.fillColor=u,this.visual&&Z.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},a.prototype.setStrokeWidth=function(u){this.strokeWidth=u,this.visual&&Z.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},a.prototype.setStrokeDasharray=function(u){this.strokeDasharray=u,this.visual&&Z.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},a.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},P.prototype.getState.call(this))},a.prototype.restoreState=function(u){var D=u;this.fillColor=D.fillColor,this.strokeColor=D.strokeColor,this.strokeWidth=D.strokeWidth,this.strokeDasharray=D.strokeDasharray,this.opacity=D.opacity,this.createVisual(),P.prototype.restoreState.call(this,u),this.setSize()},a.prototype.scale=function(u,D){P.prototype.scale.call(this,u,D),this.setSize()},a.title="Rectangle marker",a}(st),ht=function(P){function a(u,D,B,L){var se=P.call(this,u,L||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return se.widths=[],se.widthBoxes=[],se.widths=D,se.currentWidth=B,se.setCurrentWidth=se.setCurrentWidth.bind(se),se}return Ce(a,P),a.prototype.getUi=function(){var u=this,D=document.createElement("div");return D.style.display="flex",D.style.overflow="hidden",D.style.flexGrow="2",this.widths.forEach(function(B){var L=document.createElement("div");L.style.display="flex",L.style.flexGrow="2",L.style.alignItems="center",L.style.justifyContent="space-between",L.style.padding="5px",L.style.borderWidth="2px",L.style.borderStyle="solid",L.style.borderColor=B===u.currentWidth?u.uiStyleSettings.toolboxAccentColor:"transparent",L.addEventListener("click",function(){u.setCurrentWidth(B,L)}),D.appendChild(L);var se=document.createElement("div");se.innerText=B.toString(),se.style.marginRight="5px",L.appendChild(se);var Ie=document.createElement("div");Ie.style.minHeight="20px",Ie.style.flexGrow="2",Ie.style.display="flex",Ie.style.alignItems="center";var tt=document.createElement("hr");tt.style.minWidth="20px",tt.style.border="0px",tt.style.borderTop=B+"px solid "+u.uiStyleSettings.toolboxColor,tt.style.flexGrow="2",Ie.appendChild(tt),L.appendChild(Ie),u.widthBoxes.push(L)}),D},a.prototype.setCurrentWidth=function(u,D){var B=this;this.currentWidth=u,this.widthBoxes.forEach(function(L){L.style.borderColor=L===D?B.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},a}(Ze),ut=function(P){function a(u,D,B,L){var se=P.call(this,u,L||'<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 se.styles=[],se.styleBoxes=[],se.styles=D,se.currentStyle=B,se.setCurrentStyle=se.setCurrentStyle.bind(se),se}return Ce(a,P),a.prototype.getUi=function(){var u=this,D=document.createElement("div");return D.style.display="flex",D.style.overflow="hidden",D.style.flexGrow="2",this.styles.forEach(function(B){var L=document.createElement("div");L.style.display="flex",L.style.alignItems="center",L.style.justifyContent="space-between",L.style.padding="5px",L.style.borderWidth="2px",L.style.borderStyle="solid",L.style.overflow="hidden",L.style.maxWidth=100/u.styles.length-5+"%",L.style.borderColor=B===u.currentStyle?u.uiStyleSettings.toolboxAccentColor:"transparent",L.addEventListener("click",function(){u.setCurrentStyle(B,L)}),D.appendChild(L);var se=document.createElement("div");se.style.minHeight="20px",se.style.flexGrow="2",se.style.overflow="hidden";var Ie=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+u.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(B!==""?'stroke-dasharray="'+B+'"':"")+` />
</svg>`;se.innerHTML=Ie,L.appendChild(se),u.styleBoxes.push(L)}),D},a.prototype.setCurrentStyle=function(u,D){var B=this;this.currentStyle=u,this.styleBoxes.forEach(function(L){L.style.borderColor=L===D?B.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},a}(Ze),fe=function(P){function a(u,D,B){var L=P.call(this,u,D,B)||this;return L.strokeColor=B.defaultColor,L.strokeWidth=B.defaultStrokeWidth,L.strokeDasharray=B.defaultStrokeDasharray,L.strokePanel=new $e("Line color",B.defaultColorSet,B.defaultColor),L.strokePanel.onColorChanged=L.setStrokeColor,L.strokeWidthPanel=new ht("Line width",B.defaultStrokeWidths,B.defaultStrokeWidth),L.strokeWidthPanel.onWidthChanged=L.setStrokeWidth,L.strokeStylePanel=new ut("Line style",B.defaultStrokeDasharrays,B.defaultStrokeDasharray),L.strokeStylePanel.onStyleChanged=L.setStrokeDasharray,L}return Ce(a,P),Object.defineProperty(a.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),a.prototype.getState=function(){var u=P.prototype.getState.call(this);return u.typeName=a.typeName,u},a.typeName="FrameMarker",a.title="Frame marker",a.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',a}(rt),be=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},we=function(P){function a(u,D,B){var L=P.call(this,u,D,B)||this;return L.x1=0,L.y1=0,L.x2=0,L.y2=0,L.defaultLength=50,L.manipulationStartX=0,L.manipulationStartY=0,L.manipulationStartX1=0,L.manipulationStartY1=0,L.manipulationStartX2=0,L.manipulationStartY2=0,L.setupControlBox(),L}return Ce(a,P),a.prototype.ownsTarget=function(u){return!!P.prototype.ownsTarget.call(this,u)||!(!this.grip1.ownsTarget(u)&&!this.grip2.ownsTarget(u))},a.prototype.pointerDown=function(u,D){P.prototype.pointerDown.call(this,u,D),this.manipulationStartX=u.x,this.manipulationStartY=u.y,this.state==="new"&&(this.x1=u.x,this.y1=u.y,this.x2=u.x,this.y2=u.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(D)?this.activeGrip=this.grip1:this.grip2.ownsTarget(D)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},a.prototype.pointerUp=function(u){var D=this.state;P.prototype.pointerUp.call(this,u),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(u),this._state="select",D==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},a.prototype.adjustVisual=function(){},a.prototype.manipulate=function(u){this.state==="creating"?this.resize(u):this.state==="move"?(this.x1=this.manipulationStartX1+u.x-this.manipulationStartX,this.y1=this.manipulationStartY1+u.y-this.manipulationStartY,this.x2=this.manipulationStartX2+u.x-this.manipulationStartX,this.y2=this.manipulationStartY2+u.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(u)},a.prototype.resize=function(u){switch(this.activeGrip){case this.grip1:this.x1=u.x,this.y1=u.y;break;case this.grip2:case void 0:this.x2=u.x,this.y2=u.y}this.adjustVisual(),this.adjustControlBox()},a.prototype.select=function(){P.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},a.prototype.deselect=function(){P.prototype.deselect.call(this),this.controlBox.style.display="none"},a.prototype.setupControlBox=function(){this.controlBox=Z.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},a.prototype.adjustControlBox=function(){this.positionGrips()},a.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},a.prototype.createGrip=function(){var u=new ct;return u.visual.transform.baseVal.appendItem(Z.createTransform()),this.controlBox.appendChild(u.visual),u},a.prototype.positionGrips=function(){var u=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-u/2,this.y1-u/2),this.positionGrip(this.grip2.visual,this.x2-u/2,this.y2-u/2)},a.prototype.positionGrip=function(u,D,B){var L=u.transform.baseVal.getItem(0);L.setTranslate(D,B),u.transform.baseVal.replaceItem(L,0)},a.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},P.prototype.getState.call(this))},a.prototype.restoreState=function(u){P.prototype.restoreState.call(this,u);var D=u;this.x1=D.x1,this.y1=D.y1,this.x2=D.x2,this.y2=D.y2},a.prototype.scale=function(u,D){P.prototype.scale.call(this,u,D),this.x1=this.x1*u,this.y1=this.y1*D,this.x2=this.x2*u,this.y2=this.y2*D,this.adjustVisual(),this.adjustControlBox()},a}(Ue),ke=function(P){function a(u,D,B){var L=P.call(this,u,D,B)||this;return L.strokeColor="transparent",L.strokeWidth=0,L.strokeDasharray="",L.setStrokeColor=L.setStrokeColor.bind(L),L.setStrokeWidth=L.setStrokeWidth.bind(L),L.setStrokeDasharray=L.setStrokeDasharray.bind(L),L.strokeColor=B.defaultColor,L.strokeWidth=B.defaultStrokeWidth,L.strokeDasharray=B.defaultStrokeDasharray,L.strokePanel=new $e("Line color",B.defaultColorSet,B.defaultColor),L.strokePanel.onColorChanged=L.setStrokeColor,L.strokeWidthPanel=new ht("Line width",B.defaultStrokeWidths,B.defaultStrokeWidth),L.strokeWidthPanel.onWidthChanged=L.setStrokeWidth,L.strokeStylePanel=new ut("Line style",B.defaultStrokeDasharrays,B.defaultStrokeDasharray),L.strokeStylePanel.onStyleChanged=L.setStrokeDasharray,L}return Ce(a,P),a.prototype.ownsTarget=function(u){return!(!P.prototype.ownsTarget.call(this,u)&&u!==this.visual&&u!==this.selectorLine&&u!==this.visibleLine)},a.prototype.createVisual=function(){this.visual=Z.createGroup(),this.selectorLine=Z.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=Z.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)},a.prototype.pointerDown=function(u,D){P.prototype.pointerDown.call(this,u,D),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},a.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()),Z.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),Z.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),Z.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},a.prototype.setStrokeColor=function(u){this.strokeColor=u,this.adjustVisual(),this.colorChanged(u)},a.prototype.setStrokeWidth=function(u){this.strokeWidth=u,this.adjustVisual()},a.prototype.setStrokeDasharray=function(u){this.strokeDasharray=u,this.adjustVisual(),this.stateChanged()},Object.defineProperty(a.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),a.prototype.getState=function(){var u=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},P.prototype.getState.call(this));return u.typeName=a.typeName,u},a.prototype.restoreState=function(u){P.prototype.restoreState.call(this,u);var D=u;this.strokeColor=D.strokeColor,this.strokeWidth=D.strokeWidth,this.strokeDasharray=D.strokeDasharray,this.createVisual(),this.adjustVisual()},a.typeName="LineMarker",a.title="Line marker",a.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',a}(we),xe=function(P){function a(u,D,B,L){var se=P.call(this,u,L||'<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 se.fonts=[],se.fontBoxes=[],se.fonts=D,se.currentFont=B,se.setCurrentFont=se.setCurrentFont.bind(se),se}return Ce(a,P),a.prototype.getUi=function(){var u=this,D=document.createElement("div");return D.style.overflow="hidden",D.style.flexGrow="2",this.fonts.forEach(function(B){var L=document.createElement("div");L.style.display="inline-block",L.style.alignItems="center",L.style.justifyContent="space-between",L.style.padding="5px",L.style.borderWidth="2px",L.style.borderStyle="solid",L.style.overflow="hidden",L.style.maxWidth=100/u.fonts.length-5+"%",L.style.borderColor=B===u.currentFont?u.uiStyleSettings.toolboxAccentColor:"transparent",L.addEventListener("click",function(){u.setCurrentFont(B,L)}),D.appendChild(L);var se=document.createElement("div");se.style.display="flex",se.style.minHeight="20px",se.style.flexGrow="2",se.style.fontFamily=B,se.style.overflow="hidden";var Ie=document.createElement("div");Ie.style.whiteSpace="nowrap",Ie.style.overflow="hidden",Ie.style.textOverflow="ellipsis",Ie.innerHTML="The quick brown fox jumps over the lazy dog",se.appendChild(Ie),L.appendChild(se),u.fontBoxes.push(L)}),D},a.prototype.setCurrentFont=function(u,D){var B=this;this.currentFont=u,this.fontBoxes.forEach(function(L){L.style.borderColor=L===D?B.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},a}(Ze),Oe=function(P){function a(u,D,B){var L=P.call(this,u,D,B)||this;return L.color="transparent",L.padding=5,L.DEFAULT_TEXT="your text here",L.text=L.DEFAULT_TEXT,L.isMoved=!1,L.color=B.defaultColor,L.fontFamily=B.defaultFontFamily,L.defaultSize={x:100,y:30},L.setColor=L.setColor.bind(L),L.setFont=L.setFont.bind(L),L.renderText=L.renderText.bind(L),L.sizeText=L.sizeText.bind(L),L.textEditDivClicked=L.textEditDivClicked.bind(L),L.showTextEditor=L.showTextEditor.bind(L),L.setSize=L.setSize.bind(L),L.positionTextEditor=L.positionTextEditor.bind(L),L.colorPanel=new $e("Color",B.defaultColorSet,B.defaultColor),L.colorPanel.onColorChanged=L.setColor,L.fontFamilyPanel=new xe("Font",B.defaultFontFamilies,B.defaultFontFamily),L.fontFamilyPanel.onFontChanged=L.setFont,L}return Ce(a,P),a.prototype.ownsTarget=function(u){if(P.prototype.ownsTarget.call(this,u)||u===this.visual||u===this.textElement||u===this.bgRectangle)return!0;var D=!1;return this.textElement.childNodes.forEach(function(B){B===u&&(D=!0)}),D},a.prototype.createVisual=function(){this.visual=Z.createGroup(),this.bgRectangle=Z.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=Z.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(Z.createTransform()),this.textElement.transform.baseVal.appendItem(Z.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},a.prototype.pointerDown=function(u,D){P.prototype.pointerDown.call(this,u,D),this.isMoved=!1,this.pointerDownPoint=u,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(u),this._state="creating")},a.prototype.renderText=function(){var u=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(D){u.textElement.appendChild(Z.createTSpan(D.trim()===""?" ":D.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},a.prototype.getTextScale=function(){var u=this.textElement.getBBox(),D=1;if(u.width>0&&u.height>0){var B=(1*this.width-this.width*this.padding*2/100)/u.width,L=(1*this.height-this.height*this.padding*2/100)/u.height;D=Math.min(B,L)}return D},a.prototype.getTextPosition=function(u){var D=this.textElement.getBBox(),B=0,L=0;return D.width>0&&D.height>0&&(B=(this.width-D.width*u)/2,L=this.height/2-D.height*u/2),{x:B,y:L}},a.prototype.sizeText=function(){var u=this.textElement.getBBox(),D=this.getTextScale(),B=this.getTextPosition(D);B.y-=u.y*D,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+B.x+"px, "+B.y+"px) scale("+D+", "+D+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(B.x,B.y),this.textElement.transform.baseVal.getItem(1).setScale(D,D))},a.prototype.manipulate=function(u){P.prototype.manipulate.call(this,u),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(u.x-this.pointerDownPoint.x)>5||Math.abs(u.y-this.pointerDownPoint.y)>5)},a.prototype.resize=function(u){P.prototype.resize.call(this,u),this.isMoved=!0,this.setSize(),this.sizeText()},a.prototype.setSize=function(){P.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(Z.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),Z.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},a.prototype.pointerUp=function(u){var D=this.state;D==="creating"&&(this._suppressMarkerCreateEvent=!0),P.prototype.pointerUp.call(this,u),this.setSize(),(D==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},a.prototype.showTextEditor=function(){var u=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(D){D.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var D=Number.parseFloat(u.textEditor.style.fontSize);u.textEditor.clientWidth>=Number.parseInt(u.textEditor.style.maxWidth)&&D>.9;)D-=.1,u.textEditor.style.fontSize=Math.max(D,.9)+"em"}),this.textEditor.addEventListener("keyup",function(D){D.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(D){if(D.clipboardData){var B=D.clipboardData.getData("text"),L=window.getSelection();if(!L.rangeCount)return!1;L.deleteFromDocument(),L.getRangeAt(0).insertNode(document.createTextNode(B)),D.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){u.textEditDivClicked(u.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},a.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var u=this.getTextScale(),D=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),B=this.textElement.getBBox(),L={x:B.width*u,y:B.height*u};D.x-=L.x/2,D.y-=L.y/2,this.textEditor.style.top=D.y+"px",this.textEditor.style.left=D.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-D.x+"px",this.textEditor.style.fontSize=Math.max(16*u,12)+"px",this.textElement.style.display="none"}},a.prototype.textEditDivClicked=function(u){this.text=u.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},a.prototype.select=function(){P.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},a.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),P.prototype.deselect.call(this)},a.prototype.dblClick=function(u,D){P.prototype.dblClick.call(this,u,D),this.showTextEditor()},a.prototype.setColor=function(u){this.textElement&&Z.setAttributes(this.textElement,[["fill",u]]),this.color=u,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(u)},a.prototype.setFont=function(u){this.textElement&&Z.setAttributes(this.textElement,[["font-family",u]]),this.fontFamily=u,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},a.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},a.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(a.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),a.prototype.getState=function(){var u=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},P.prototype.getState.call(this));return u.typeName=a.typeName,u},a.prototype.restoreState=function(u){var D=u;this.color=D.color,this.fontFamily=D.fontFamily,this.padding=D.padding,this.text=D.text,this.createVisual(),P.prototype.restoreState.call(this,u),this.setSize()},a.prototype.scale=function(u,D){P.prototype.scale.call(this,u,D),this.setSize(),this.sizeText(),this.positionTextEditor()},a.typeName="TextMarker",a.title="Text marker",a.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>',a}(st),ae=function(P){function a(u,D,B){var L=P.call(this,u,D,B)||this;return L.color="transparent",L.lineWidth=3,L.drawing=!1,L.pixelRatio=1,L.color=B.defaultColor,L.lineWidth=B.defaultStrokeWidth,L.pixelRatio=B.freehandPixelRatio,L.setColor=L.setColor.bind(L),L.addCanvas=L.addCanvas.bind(L),L.finishCreation=L.finishCreation.bind(L),L.setLineWidth=L.setLineWidth.bind(L),L.colorPanel=new $e("Color",B.defaultColorSet,B.defaultColor),L.colorPanel.onColorChanged=L.setColor,L.lineWidthPanel=new ht("Line width",B.defaultStrokeWidths,B.defaultStrokeWidth),L.lineWidthPanel.onWidthChanged=L.setLineWidth,L}return Ce(a,P),a.prototype.ownsTarget=function(u){return!(!P.prototype.ownsTarget.call(this,u)&&u!==this.visual&&u!==this.drawingImage)},a.prototype.createVisual=function(){this.visual=Z.createGroup(),this.drawingImage=Z.createImage(),this.visual.appendChild(this.drawingImage);var u=Z.createTransform();this.visual.transform.baseVal.appendItem(u),this.addMarkerVisualToContainer(this.visual)},a.prototype.pointerDown=function(u,D){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(u.x,u.y),this.drawing=!0):P.prototype.pointerDown.call(this,u,D)},a.prototype.manipulate=function(u){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(u.x,u.y),this.canvasContext.stroke()):P.prototype.manipulate.call(this,u)},a.prototype.resize=function(u){P.prototype.resize.call(this,u),Z.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),Z.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},a.prototype.pointerUp=function(u){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):P.prototype.pointerUp.call(this,u)},a.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)},a.prototype.select=function(){this.state==="creating"&&this.finishCreation(),P.prototype.select.call(this)},a.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),P.prototype.deselect.call(this)},a.prototype.finishCreation=function(){for(var u=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),D=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],B=D[0],L=D[1],se=D[2],Ie=D[3],tt=!1,pt=0;pt<this.canvasElement.height;pt++)for(var Be=0;Be<this.canvasElement.width;Be++)u.data[pt*this.canvasElement.width*4+4*Be+3]>0&&(tt=!0,pt<L&&(L=pt),Be<B&&(B=Be),pt>Ie&&(Ie=pt),Be>se&&(se=Be));if(tt){this.left=B/this.pixelRatio,this.top=L/this.pixelRatio,this.width=(se-B)/this.pixelRatio,this.height=(Ie-L)/this.pixelRatio;var bt=document.createElement("canvas");bt.width=se-B,bt.height=Ie-L,bt.getContext("2d").putImageData(this.canvasContext.getImageData(B,L,se-B,Ie-L),0,0),this.drawingImgUrl=bt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},a.prototype.setDrawingImage=function(){Z.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),Z.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},a.prototype.setColor=function(u){this.color=u,this.colorChanged(u)},a.prototype.setLineWidth=function(u){this.lineWidth=u},Object.defineProperty(a.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),a.prototype.getState=function(){var u=Object.assign({drawingImgUrl:this.drawingImgUrl},P.prototype.getState.call(this));return u.typeName=a.typeName,u},a.prototype.restoreState=function(u){this.createVisual(),P.prototype.restoreState.call(this,u),this.drawingImgUrl=u.drawingImgUrl,this.setDrawingImage()},a.prototype.scale=function(u,D){P.prototype.scale.call(this,u,D),this.setDrawingImage()},a.typeName="FreehandMarker",a.title="Freehand marker",a.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>',a}(st),ee=function(P){function a(u,D,B){var L=P.call(this,u,B||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return L.typeBoxes=[],L.currentType=D,L.setCurrentType=L.setCurrentType.bind(L),L}return Ce(a,P),a.prototype.getUi=function(){var u=this,D=document.createElement("div");D.style.display="flex",D.style.overflow="hidden",D.style.flexGrow="2";for(var B=function(Ie){var tt="both";switch(Ie){case 0:tt="both";break;case 1:tt="start";break;case 2:tt="end";break;case 3:tt="none"}var pt=document.createElement("div");if(pt.style.display="flex",pt.style.flexGrow="2",pt.style.alignItems="center",pt.style.justifyContent="space-between",pt.style.padding="5px",pt.style.borderWidth="2px",pt.style.borderStyle="solid",pt.style.borderColor=tt===L.currentType?L.uiStyleSettings.toolboxAccentColor:"transparent",pt.addEventListener("click",function(){u.setCurrentType(tt,pt)}),D.appendChild(pt),tt==="both"||tt==="start"){var Be=document.createElement("div");Be.style.display="flex",Be.style.alignItems="center",Be.style.minHeight="20px",Be.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="`+(L.uiStyleSettings!==void 0?L.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Be.style.marginLeft="5px",pt.appendChild(Be)}var bt=document.createElement("div");bt.style.display="flex",bt.style.alignItems="center",bt.style.minHeight="20px",bt.style.flexGrow="2";var Tt=document.createElement("hr");if(Tt.style.minWidth="20px",Tt.style.border="0px",Tt.style.borderTop="3px solid "+(L.uiStyleSettings!==void 0?L.uiStyleSettings.toolboxColor:"#eeeeee"),Tt.style.flexGrow="2",bt.appendChild(Tt),pt.appendChild(bt),tt==="both"||tt==="end"){var Qt=document.createElement("div");Qt.style.display="flex",Qt.style.alignItems="center",Qt.style.minHeight="20px",Qt.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="`+(L.uiStyleSettings!==void 0?L.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Qt.style.marginRight="5px",pt.appendChild(Qt)}L.typeBoxes.push(pt)},L=this,se=0;se<4;se++)B(se);return D},a.prototype.setCurrentType=function(u,D){var B=this;this.currentType=u,this.typeBoxes.forEach(function(L){L.style.borderColor=L===D?B.uiStyleSettings!==void 0?B.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},a}(Ze),te=function(P){function a(u,D,B){var L=P.call(this,u,D,B)||this;return L.arrowType="end",L.arrowBaseHeight=10,L.arrowBaseWidth=10,L.getArrowPoints=L.getArrowPoints.bind(L),L.setArrowType=L.setArrowType.bind(L),L.arrowTypePanel=new ee("Arrow type","end"),L.arrowTypePanel.onArrowTypeChanged=L.setArrowType,L}return Ce(a,P),a.prototype.ownsTarget=function(u){return!(!P.prototype.ownsTarget.call(this,u)&&u!==this.arrow1&&u!==this.arrow2)},a.prototype.getArrowPoints=function(u,D){var B=this.arrowBaseWidth+2*this.strokeWidth,L=this.arrowBaseHeight+2*this.strokeWidth;return u-B/2+","+(D+L/2)+" "+u+","+(D-L/2)+" "+(u+B/2)+","+(D+L/2)},a.prototype.createTips=function(){this.arrow1=Z.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(Z.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=Z.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(Z.createTransform()),this.visual.appendChild(this.arrow2)},a.prototype.pointerDown=function(u,D){P.prototype.pointerDown.call(this,u,D),this.state==="creating"&&this.createTips()},a.prototype.adjustVisual=function(){if(P.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",Z.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),Z.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var u=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),D=this.arrow1.transform.baseVal.getItem(0);D.setRotate(u,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(D,0);var B=this.arrow2.transform.baseVal.getItem(0);B.setRotate(u+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(B,0)}},a.prototype.setArrowType=function(u){this.arrowType=u,this.adjustVisual(),this.stateChanged()},Object.defineProperty(a.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),a.prototype.getState=function(){var u=Object.assign({arrowType:this.arrowType},P.prototype.getState.call(this));return u.typeName=a.typeName,u},a.prototype.restoreState=function(u){P.prototype.restoreState.call(this,u);var D=u;this.arrowType=D.arrowType,this.createTips(),this.adjustVisual()},a.typeName="ArrowMarker",a.title="Arrow marker",a.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',a}(ke),H=function(P){function a(u,D,B){var L=P.call(this,u,D,B)||this;return L.fillColor=B.defaultFillColor,L.strokeWidth=0,L.fillPanel=new $e("Color",B.defaultColorSet,B.defaultFillColor),L.fillPanel.onColorChanged=L.setFillColor,L}return Ce(a,P),Object.defineProperty(a.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),a.prototype.getState=function(){var u=P.prototype.getState.call(this);return u.typeName=a.typeName,u},a.typeName="CoverMarker",a.title="Cover marker",a.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',a}(rt),G=function(P){function a(u,D,B,L){var se=P.call(this,u,L||'<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 se.opacities=[],se.opacityBoxes=[],se.opacities=D,se.currentOpacity=B,se.setCurrentOpacity=se.setCurrentOpacity.bind(se),se}return Ce(a,P),a.prototype.getUi=function(){var u=this,D=document.createElement("div");return D.style.display="flex",D.style.overflow="hidden",D.style.flexGrow="2",D.style.justifyContent="space-between",this.opacities.forEach(function(B){var L=document.createElement("div");L.style.display="flex",L.style.alignItems="center",L.style.justifyContent="center",L.style.padding="5px",L.style.borderWidth="2px",L.style.borderStyle="solid",L.style.borderColor=B===u.currentOpacity?u.uiStyleSettings.toolboxAccentColor:"transparent",L.addEventListener("click",function(){u.setCurrentOpacity(B,L)}),D.appendChild(L);var se=document.createElement("div");se.innerText=100*B+"%",L.appendChild(se),u.opacityBoxes.push(L)}),D},a.prototype.setCurrentOpacity=function(u,D){var B=this;this.currentOpacity=u,this.opacityBoxes.forEach(function(L){L.style.borderColor=L===D?B.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},a}(Ze),V=function(P){function a(u,D,B){var L=P.call(this,u,D,B)||this;return L.setOpacity=L.setOpacity.bind(L),L.fillColor=B.defaultHighlightColor,L.strokeWidth=0,L.opacity=B.defaultHighlightOpacity,L.fillPanel=new $e("Color",B.defaultColorSet,L.fillColor),L.fillPanel.onColorChanged=L.setFillColor,L.opacityPanel=new G("Opacity",B.defaultOpacitySteps,L.opacity),L.opacityPanel.onOpacityChanged=L.setOpacity,L}return Ce(a,P),a.prototype.setOpacity=function(u){this.opacity=u,this.visual&&Z.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(a.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),a.prototype.getState=function(){var u=P.prototype.getState.call(this);return u.typeName=a.typeName,u},a.typeName="HighlightMarker",a.title="Highlight marker",a.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>',a}(H),J='<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>',de=function(P){function a(u,D,B){var L=P.call(this,u,D,B)||this;return L.bgColor="transparent",L.tipPosition={x:0,y:0},L.tipBase1Position={x:0,y:0},L.tipBase2Position={x:0,y:0},L.tipMoving=!1,L.color=B.defaultStrokeColor,L.bgColor=B.defaultFillColor,L.fontFamily=B.defaultFontFamily,L.defaultSize={x:100,y:30},L.setBgColor=L.setBgColor.bind(L),L.getTipPoints=L.getTipPoints.bind(L),L.positionTip=L.positionTip.bind(L),L.setTipPoints=L.setTipPoints.bind(L),L.colorPanel=new $e("Text color",B.defaultColorSet,L.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>'),L.colorPanel.onColorChanged=L.setColor,L.bgColorPanel=new $e("Fill color",B.defaultColorSet,L.bgColor,J),L.bgColorPanel.onColorChanged=L.setBgColor,L.fontFamilyPanel=new xe("Font",B.defaultFontFamilies,B.defaultFontFamily),L.fontFamilyPanel.onFontChanged=L.setFont,L.tipGrip=new ct,L.tipGrip.visual.transform.baseVal.appendItem(Z.createTransform()),L.controlBox.appendChild(L.tipGrip.visual),L}return Ce(a,P),a.prototype.ownsTarget=function(u){return P.prototype.ownsTarget.call(this,u)||this.tipGrip.ownsTarget(u)||this.tip===u},a.prototype.createTip=function(){Z.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=Z.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},a.prototype.pointerDown=function(u,D){this.state==="new"&&P.prototype.pointerDown.call(this,u,D),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(D)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):P.prototype.pointerDown.call(this,u,D)},a.prototype.pointerUp=function(u){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,P.prototype.pointerUp.call(this,u);else{var D=this.state==="creating";P.prototype.pointerUp.call(this,u),this.setTipPoints(D),this.positionTip()}},a.prototype.manipulate=function(u){if(this.tipMoving){var D=this.unrotatePoint(u);this.tipPosition={x:D.x-this.manipulationStartLeft,y:D.y-this.manipulationStartTop},this.positionTip()}else P.prototype.manipulate.call(this,u)},a.prototype.setBgColor=function(u){this.bgRectangle&&this.tip&&(Z.setAttributes(this.bgRectangle,[["fill",u]]),Z.setAttributes(this.tip,[["fill",u]])),this.bgColor=u,this.fillColorChanged(u)},a.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},a.prototype.setTipPoints=function(u){u===void 0&&(u=!1);var D=Math.min(this.height/2,15),B=this.height/5;u&&(this.tipPosition={x:D+B/2,y:this.height+20});var L=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?L<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(B=this.width/5,D=Math.min(this.width/2,15),this.tipBase1Position={x:D,y:0},this.tipBase2Position={x:D+B,y:0}):(this.tipBase1Position={x:0,y:D},this.tipBase2Position={x:0,y:D+B}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?L<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(B=this.width/5,D=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-D-B,y:0},this.tipBase2Position={x:this.width-D,y:0}):(this.tipBase1Position={x:this.width,y:D},this.tipBase2Position={x:this.width,y:D+B}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?L<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(B=this.width/5,D=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-D-B,y:this.height},this.tipBase2Position={x:this.width-D,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-D-B},this.tipBase2Position={x:this.width,y:this.height-D}):L<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(B=this.width/5,D=Math.min(this.width/2,15),this.tipBase1Position={x:D,y:this.height},this.tipBase2Position={x:D+B,y:this.height}):(this.tipBase1Position={x:0,y:this.height-D},this.tipBase2Position={x:0,y:this.height-D-B})},a.prototype.resize=function(u){P.prototype.resize.call(this,u),this.positionTip()},a.prototype.positionTip=function(){Z.setAttributes(this.tip,[["points",this.getTipPoints()]]);var u=this.tipGrip.visual.transform.baseVal.getItem(0);u.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(u,0)},Object.defineProperty(a.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),a.prototype.select=function(){this.positionTip(),P.prototype.select.call(this)},a.prototype.getState=function(){var u=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},P.prototype.getState.call(this));return u.typeName=a.typeName,u},a.prototype.restoreState=function(u){var D=u;this.bgColor=D.bgColor,this.tipPosition=D.tipPosition,P.prototype.restoreState.call(this,u),this.createTip(),this.setTipPoints()},a.prototype.scale=function(u,D){P.prototype.scale.call(this,u,D),this.tipPosition={x:this.tipPosition.x*u,y:this.tipPosition.y*D},this.positionTip()},a.typeName="CalloutMarker",a.title="Callout marker",a.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>',a}(Oe),ge=function(P){function a(u,D,B){var L=P.call(this,u,D,B)||this;return L.fillColor="transparent",L.strokeColor="transparent",L.strokeWidth=0,L.strokeDasharray="",L.opacity=1,L.strokeColor=B.defaultColor,L.strokeWidth=B.defaultStrokeWidth,L.strokeDasharray=B.defaultStrokeDasharray,L.fillColor=B.defaultFillColor,L.setStrokeColor=L.setStrokeColor.bind(L),L.setFillColor=L.setFillColor.bind(L),L.setStrokeWidth=L.setStrokeWidth.bind(L),L.setStrokeDasharray=L.setStrokeDasharray.bind(L),L.setOpacity=L.setOpacity.bind(L),L.createVisual=L.createVisual.bind(L),L.strokePanel=new $e("Line color",he(B.defaultColorSet,["transparent"]),B.defaultColor),L.strokePanel.onColorChanged=L.setStrokeColor,L.fillPanel=new $e("Fill color",he(B.defaultColorSet,["transparent"]),L.fillColor,J),L.fillPanel.onColorChanged=L.setFillColor,L.strokeWidthPanel=new ht("Line width",B.defaultStrokeWidths,B.defaultStrokeWidth),L.strokeWidthPanel.onWidthChanged=L.setStrokeWidth,L.strokeStylePanel=new ut("Line style",B.defaultStrokeDasharrays,B.defaultStrokeDasharray),L.strokeStylePanel.onStyleChanged=L.setStrokeDasharray,L.opacityPanel=new G("Opacity",B.defaultOpacitySteps,L.opacity),L.opacityPanel.onOpacityChanged=L.setOpacity,L}return Ce(a,P),a.prototype.ownsTarget=function(u){return!(!P.prototype.ownsTarget.call(this,u)&&u!==this.visual)},a.prototype.createVisual=function(){this.visual=Z.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)},a.prototype.pointerDown=function(u,D){P.prototype.pointerDown.call(this,u,D),this.state==="new"&&(this.createVisual(),this.moveVisual(u),this._state="creating")},a.prototype.manipulate=function(u){P.prototype.manipulate.call(this,u)},a.prototype.resize=function(u){P.prototype.resize.call(this,u),this.setSize()},a.prototype.setSize=function(){P.prototype.setSize.call(this),Z.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},a.prototype.pointerUp=function(u){P.prototype.pointerUp.call(this,u),this.setSize()},a.prototype.setStrokeColor=function(u){this.strokeColor=u,this.visual&&Z.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(u),this.stateChanged()},a.prototype.setFillColor=function(u){this.fillColor=u,this.visual&&Z.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(u),this.stateChanged()},a.prototype.setStrokeWidth=function(u){this.strokeWidth=u,this.visual&&Z.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},a.prototype.setStrokeDasharray=function(u){this.strokeDasharray=u,this.visual&&Z.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},a.prototype.setOpacity=function(u){this.opacity=u,this.visual&&Z.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(a.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),a.prototype.getState=function(){var u=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},P.prototype.getState.call(this));return u.typeName=a.typeName,u},a.prototype.restoreState=function(u){var D=u;this.fillColor=D.fillColor,this.strokeColor=D.strokeColor,this.strokeWidth=D.strokeWidth,this.strokeDasharray=D.strokeDasharray,this.opacity=D.opacity,this.createVisual(),P.prototype.restoreState.call(this,u),this.setSize()},a.prototype.scale=function(u,D){P.prototype.scale.call(this,u,D),this.setSize()},a.typeName="EllipseMarker",a.title="Ellipse marker",a.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>',a}(st),Me=function(P){function a(u,D,B){return P.call(this,u,D,B)||this}return Ce(a,P),Object.defineProperty(a.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),a.prototype.ownsTarget=function(u){return!(!P.prototype.ownsTarget.call(this,u)&&u!==this.tip1&&u!==this.tip2)},a.prototype.createTips=function(){this.tip1=Z.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(Z.createTransform()),this.visual.appendChild(this.tip1),this.tip2=Z.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(Z.createTransform()),this.visual.appendChild(this.tip2)},a.prototype.pointerDown=function(u,D){P.prototype.pointerDown.call(this,u,D),this.state==="creating"&&this.createTips()},a.prototype.adjustVisual=function(){if(P.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(Z.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()]]),Z.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 u=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),D=this.tip1.transform.baseVal.getItem(0);D.setRotate(u,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(D,0);var B=this.tip2.transform.baseVal.getItem(0);B.setRotate(u+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(B,0)}},Object.defineProperty(a.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),a.prototype.getState=function(){var u=P.prototype.getState.call(this);return u.typeName=a.typeName,u},a.prototype.restoreState=function(u){P.prototype.restoreState.call(this,u),this.createTips(),this.adjustVisual()},a.typeName="MeasurementMarker",a.title="Measurement marker",a.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>',a}(ke),et=function(P){function a(u,D,B){var L=P.call(this,u,D,B)||this;return L.strokePanel.colors=B.defaultColorSet,L.fillColor="transparent",L}return Ce(a,P),Object.defineProperty(a.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),a.prototype.getState=function(){var u=P.prototype.getState.call(this);return u.typeName=a.typeName,u},a.typeName="EllipseFrameMarker",a.title="Ellipse frame marker",a.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>',a}(ge),dt=function(){function P(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(P.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),P.prototype.addUndoStep=function(a){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(a)||(this.undoStack.push(a),JSON.stringify(this.lastRedoStep)!==JSON.stringify(a)&&this.redoStack.splice(0,this.redoStack.length))},P.prototype.replaceLastUndoStep=function(a){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=a)},P.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},P.prototype.undo=function(){if(this.undoStack.length>1){var a=this.undoStack.pop();return a!==void 0&&this.redoStack.push(a),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},P.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},P}(),qe=function(P){function a(u,D,B){var L=P.call(this,u,D,B)||this;return L.strokeColor="transparent",L.strokeWidth=0,L.strokeDasharray="",L.curveX=0,L.curveY=0,L.manipulationStartCurveX=0,L.manipulationStartCurveY=0,L.setStrokeColor=L.setStrokeColor.bind(L),L.setStrokeWidth=L.setStrokeWidth.bind(L),L.setStrokeDasharray=L.setStrokeDasharray.bind(L),L.positionGrips=L.positionGrips.bind(L),L.addControlGrips=L.addControlGrips.bind(L),L.adjustVisual=L.adjustVisual.bind(L),L.setupControlBox=L.setupControlBox.bind(L),L.resize=L.resize.bind(L),L.strokeColor=B.defaultColor,L.strokeWidth=B.defaultStrokeWidth,L.strokeDasharray=B.defaultStrokeDasharray,L.strokePanel=new $e("Line color",B.defaultColorSet,B.defaultColor),L.strokePanel.onColorChanged=L.setStrokeColor,L.strokeWidthPanel=new ht("Line width",B.defaultStrokeWidths,B.defaultStrokeWidth),L.strokeWidthPanel.onWidthChanged=L.setStrokeWidth,L.strokeStylePanel=new ut("Line style",B.defaultStrokeDasharrays,B.defaultStrokeDasharray),L.strokeStylePanel.onStyleChanged=L.setStrokeDasharray,L}return Ce(a,P),a.prototype.ownsTarget=function(u){return!(!P.prototype.ownsTarget.call(this,u)&&u!==this.visual&&u!==this.selectorCurve&&u!==this.visibleCurve&&!this.curveGrip.ownsTarget(u))},a.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},a.prototype.createVisual=function(){this.visual=Z.createGroup(),this.selectorCurve=Z.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=Z.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)},a.prototype.pointerDown=function(u,D){P.prototype.pointerDown.call(this,u,D),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=u.x,this.curveY=u.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(D)&&(this.activeGrip=this.curveGrip,this._state="resize")},a.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),Z.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),Z.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),Z.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},a.prototype.setupControlBox=function(){P.prototype.setupControlBox.call(this),this.curveControlLine1=Z.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=Z.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)},a.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,P.prototype.addControlGrips.call(this)},a.prototype.positionGrips=function(){P.prototype.positionGrips.call(this);var u=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-u/2,this.curveY-u/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()))},a.prototype.manipulate=function(u){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+u.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+u.y-this.manipulationStartY),P.prototype.manipulate.call(this,u)},a.prototype.resize=function(u){this.activeGrip===this.curveGrip&&(this.curveX=u.x,this.curveY=u.y),P.prototype.resize.call(this,u),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},a.prototype.setStrokeColor=function(u){this.strokeColor=u,this.adjustVisual(),this.colorChanged(u)},a.prototype.setStrokeWidth=function(u){this.strokeWidth=u,this.adjustVisual()},a.prototype.setStrokeDasharray=function(u){this.strokeDasharray=u,this.adjustVisual()},a.prototype.scale=function(u,D){this.curveX=this.curveX*u,this.curveY=this.curveY*D,P.prototype.scale.call(this,u,D)},Object.defineProperty(a.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),a.prototype.getState=function(){var u=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},P.prototype.getState.call(this));return u.typeName=a.typeName,u},a.prototype.restoreState=function(u){P.prototype.restoreState.call(this,u);var D=u;this.strokeColor=D.strokeColor,this.strokeWidth=D.strokeWidth,this.strokeDasharray=D.strokeDasharray,this.curveX=D.curveX,this.curveY=D.curveY,this.createVisual(),this.adjustVisual()},a.typeName="CurveMarker",a.title="Curve marker",a.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>',a}(we),Ct=function(){function P(a,u){u===void 0&&(u=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=a,this.cancelable=u}return Object.defineProperty(P.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),P.prototype.preventDefault=function(){this._defaultPrevented=!0},P}(),_t=function(P){function a(u,D,B){var L=P.call(this,u,!1)||this;return L.dataUrl=D,L.state=B,L}return Ce(a,P),a}(Ct),at=function(P){function a(u,D,B){B===void 0&&(B=!1);var L=P.call(this,u,B)||this;return L.marker=D,L}return Ce(a,P),a}(Ct),It=function(){function P(){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 P.prototype.addEventListener=function(a,u){this[a].push(u)},P.prototype.removeEventListener=function(a,u){var D=this[a].indexOf(u);D>-1&&this[a].splice(D,1)},P}(),At=function(){function P(a){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new be,this._isOpen=!1,this.undoRedoManager=new dt,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 It,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=P.instanceCounter++,this.styles=new Ke(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=a,this.targetRoot=document.body,this.width=a.clientWidth,this.height=a.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(P.prototype,"ALL_MARKER_TYPES",{get:function(){return[fe,ae,te,Oe,et,ge,V,de,Me,H,ke,qe]},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[fe,ae,te,Oe,ge,V,de]},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"BASIC_MARKER_TYPES",{get:function(){return[fe,ae,te,Oe,V]},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(a){var u=this;this._availableMarkerTypes.splice(0),a.forEach(function(D){if(typeof D=="string"){var B=u.ALL_MARKER_TYPES.find(function(L){return L.typeName===D});B!==void 0&&u._availableMarkerTypes.push(B)}else u._availableMarkerTypes.push(D)})},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(a){this._zoomLevel=a,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(P.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),P.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),je.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},P.prototype.show=function(){var a=this;this.styles.styleSheetRoot===void 0&&nt.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=nt.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(u){return u(new Ct(a))})},P.prototype.render=function(){return _e(this,void 0,void 0,function(){var a;return Re(this,function(u){switch(u.label){case 0:return this.setCurrentMarker(),(a=new lt).naturalSize=this.renderAtNaturalSize,a.imageType=this.renderImageType,a.imageQuality=this.renderImageQuality,a.markersOnly=this.renderMarkersOnly,a.width=this.renderWidth,a.height=this.renderHeight,[4,a.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return u.sent(),[4,a.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,u.sent()]}})})},P.prototype.close=function(a){var u=this;if(a===void 0&&(a=!1),this.isOpen){var D=!1;a||this.eventListeners.beforeclose.forEach(function(B){var L=new Ct(u,!0);B(L),L.defaultPrevented&&(D=!0)}),D||(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(B){return B(new Ct(u))}),this.detachEvents(),this._isOpen=!1)}},P.prototype.addMarkersToToolbar=function(){for(var a,u=[],D=0;D<arguments.length;D++)u[D]=arguments[D];(a=this._availableMarkerTypes).push.apply(a,u)},P.prototype.addRenderEventListener=function(a){this.addEventListener("render",function(u){a(u.dataUrl,u.state)})},P.prototype.removeRenderEventListener=function(a){},P.prototype.addCloseEventListener=function(a){this.addEventListener("close",function(){a()})},P.prototype.removeCloseEventListener=function(a){},P.prototype.setupResizeObserver=function(){var a=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){a.resize(a.target.clientWidth,a.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return a.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},P.prototype.onPopupTargetResize=function(){var a=1*this.target.clientWidth/this.target.clientHeight,u=this.editorCanvas.clientWidth/a>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*a:this.editorCanvas.clientWidth,D=u<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/a;this.resize(u,D)},P.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},P.prototype.resize=function(a,u){this._isResizing=!0;var D=a/this.imageWidth,B=u/this.imageHeight;this.imageWidth=Math.round(a),this.imageHeight=Math.round(u),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(D,B),this._isResizing=!1},P.prototype.scaleMarkers=function(a,u){var D,B=this;this._currentMarker&&this._currentMarker instanceof Oe?this._currentMarker.scale(a,u):(D=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(L){L!==B._currentMarker&&L.scale(a,u)}),D!==void 0&&this.setCurrentMarker(D)},P.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"},P.prototype.setTopLeft=function(){var a=this.editingTarget.getBoundingClientRect(),u=this.editorCanvas.getBoundingClientRect();this.left=a.left-u.left,this.top=a.top-u.top},P.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)},P.prototype.addDefs=function(){for(var a,u=[],D=0;D<arguments.length;D++)u[D]=arguments[D];this.defs=Z.createDefs(),this.addDefsToImage(),(a=this.defs).append.apply(a,u)},P.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},P.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)},P.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},P.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},P.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)},P.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},P.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)},P.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 a=document.createElement("a");a.href="https://markerjs.com/",a.target="_blank",a.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>',a.title="Powered by marker.js",a.style.display="grid",a.style.alignItems="center",a.style.justifyItems="center",a.style.padding="3px",a.style.width="20px",a.style.height="20px",this.logoUI.appendChild(a),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},P.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")},P.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"},P.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},P.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 a=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=a+"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 We(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 Qe(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},P.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},P.prototype.removeMarker=function(a){this.markerImage.removeChild(a.container),this.markers.indexOf(a)>-1&&this.markers.splice(this.markers.indexOf(a),1),a.dispose()},P.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())},P.prototype.toolbarButtonClicked=function(a,u){if(a==="marker"&&u!==void 0)this.createNewMarker(u);else if(a==="action")switch(u){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()}},P.prototype.deleteSelectedMarker=function(){var a=this;if(this._currentMarker!==void 0){var u=!1;if(this.eventListeners.markerbeforedelete.forEach(function(B){var L=new at(a,a._currentMarker,!0);B(L),L.defaultPrevented&&(u=!0)}),!u){var D=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(B){return B(new at(a,D))})}}},P.prototype.clear=function(){var a=this,u=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(se){var Ie=new at(a,void 0,!0);se(Ie),Ie.defaultPrevented&&(u=!0)}),!u)){this.setCurrentMarker();for(var D=function(se){var Ie=B.markers[se];B.setCurrentMarker(B.markers[se]),B._currentMarker.dispose(),B.markerImage.removeChild(B._currentMarker.container),B.markers.splice(B.markers.indexOf(B._currentMarker),1),B.eventListeners.markerdelete.forEach(function(tt){return tt(new at(a,Ie))})},B=this,L=this.markers.length-1;L>=0;L--)D(L);this.addUndoStep()}},Object.defineProperty(P.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),P.prototype.showNotesEditor=function(){var a;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=(a=this._currentMarker.notes)!==null&&a!==void 0?a:"",this.overlayContainer.appendChild(this.notesArea))},P.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)},P.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},P.prototype.addUndoStep=function(){var a=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var u=this.getState(),D=this.undoRedoManager.getLastUndoStep();if(!D||D.width===u.width&&D.height===u.height){var B=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(u),B<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(L){return L(new Ct(a))})}else this.undoRedoManager.replaceLastUndoStep(u),this.eventListeners.statechange.forEach(function(L){return L(new Ct(a))})}},P.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},P.prototype.undoStep=function(){var a=this,u=this.undoRedoManager.undo();u!==void 0&&(this.restoreState(u),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(D){return D(new Ct(a))}))},P.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},P.prototype.redoStep=function(){var a=this,u=this.undoRedoManager.redo();u!==void 0&&(this.restoreState(u),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(D){return D(new Ct(a))}))},P.prototype.stepZoom=function(){var a=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=a<this.zoomSteps.length-1?this.zoomSteps[a+1]:this.zoomSteps[0]},P.prototype.panTo=function(a){this.contentDiv.scrollBy({left:this.prevPanPoint.x-a.x,top:this.prevPanPoint.y-a.y}),this.prevPanPoint=a},P.prototype.startRenderAndClose=function(){return _e(this,void 0,void 0,function(){var a,u,D=this;return Re(this,function(B){switch(B.label){case 0:return[4,this.render()];case 1:return a=B.sent(),u=this.getState(),this.eventListeners.render.forEach(function(L){return L(new _t(D,a,u))}),this.close(!0),[2]}})})},P.prototype.getState=function(a){a===!0&&this.setCurrentMarker();var u={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(D){return u.markers.push(D.getState())}),u},P.prototype.restoreState=function(a){var u=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);a.markers.forEach(function(D){var B=u._availableMarkerTypes.find(function(se){return se.typeName===D.typeName});if(B!==void 0){var L=u.addNewMarker(B);L.restoreState(D),u.markers.push(L)}}),a.width&&a.height&&(a.width!==this.imageWidth||a.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/a.width,this.imageHeight/a.height),this.eventListeners.restorestate.forEach(function(D){return D(new Ct(u))})},P.prototype.addNewMarker=function(a){var u=Z.createGroup();return this.markerImage.appendChild(u),new a(u,this.overlayContainer,this.settings)},P.prototype.createNewMarker=function(a){var u,D=this;(u=typeof a=="string"?this._availableMarkerTypes.find(function(B){return B.typeName===a}):a)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(u),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(u.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(B){return B(new at(D,D._currentMarker))}))},P.prototype.markerCreated=function(a){var u=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(a),this.setCurrentMarker(a),a instanceof ae&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(ae):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(D){return D(new at(u,u._currentMarker))})},P.prototype.colorChanged=function(a){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=a,this.settings.defaultStrokeColor=a)},P.prototype.fillColorChanged=function(a){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=a)},P.prototype.markerStateChanged=function(a){var u=this;this.eventListeners.markerchange.forEach(function(D){return D(new at(u,a))})},P.prototype.setCurrentMarker=function(a){var u=this;this._currentMarker!==a&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(D){return D(new at(u,u._currentMarker))})),this._currentMarker=a,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(D){return D(new at(u,u._currentMarker))}))},P.prototype.onPointerDown=function(a){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||a.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var u=this.markers.find(function(D){return D.ownsTarget(a.target)});u!==void 0?(this.setCurrentMarker(u),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(a.clientX,a.clientY),a.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:a.clientX,y:a.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(a.clientX,a.clientY))},P.prototype.onDblClick=function(a){if(this._isFocused||this.focus(),this.mode==="select"){var u=this.markers.find(function(D){return D.ownsTarget(a.target)});u!==void 0&&u!==this._currentMarker&&this.setCurrentMarker(u),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(a.clientX,a.clientY),a.target):this.setCurrentMarker()}},P.prototype.onPointerMove=function(a){this.touchPoints!==1&&a.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||a.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(a.clientX,a.clientY)):this.zoomLevel>1&&this.panTo({x:a.clientX,y:a.clientY}))},P.prototype.onPointerUp=function(a){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(a.clientX,a.clientY)),this.isDragging=!1,this.addUndoStep()},P.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},P.prototype.onKeyUp=function(a){this._currentMarker===void 0||this.notesArea!==void 0||a.key!=="Delete"&&a.key!=="Backspace"||this.deleteSelectedMarker()},P.prototype.clientToLocalCoordinates=function(a,u){var D=this.markerImage.getBoundingClientRect();return{x:(a-D.left)/this.zoomLevel,y:(u-D.top)/this.zoomLevel}},P.prototype.onWindowResize=function(){this.positionUI()},P.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var a=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=a+"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()},P.prototype.addLicenseKey=function(a){je.addKey(a)},P.prototype.addEventListener=function(a,u){this.eventListeners.addEventListener(a,u)},P.prototype.removeEventListener=function(a,u){this.eventListeners.removeEventListener(a,u)},P.prototype.renderState=function(a){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(a),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(P.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),P.prototype.focus=function(){var a=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(u){return u(new Ct(a))}))},P.prototype.blur=function(){var a=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(u){return u(new Ct(a))}))},P.instanceCounter=0,P}();/* **********************************
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 Ot=function(P,a){return(Ot=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,D){u.__proto__=D}||function(u,D){for(var B in D)Object.prototype.hasOwnProperty.call(D,B)&&(u[B]=D[B])})(P,a)};function Wt(P,a){if(typeof a!="function"&&a!==null)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");function u(){this.constructor=P}Ot(P,a),P.prototype=a===null?Object.create(a):(u.prototype=a.prototype,new u)}function gt(P,a,u,D){return new(u||(u=Promise))(function(B,L){function se(pt){try{tt(D.next(pt))}catch(Be){L(Be)}}function Ie(pt){try{tt(D.throw(pt))}catch(Be){L(Be)}}function tt(pt){var Be;pt.done?B(pt.value):(Be=pt.value,Be instanceof u?Be:new u(function(bt){bt(Be)})).then(se,Ie)}tt((D=D.apply(P,a||[])).next())})}function Bt(P,a){var u,D,B,L,se={label:0,sent:function(){if(1&B[0])throw B[1];return B[1]},trys:[],ops:[]};return L={next:Ie(0),throw:Ie(1),return:Ie(2)},typeof Symbol=="function"&&(L[Symbol.iterator]=function(){return this}),L;function Ie(tt){return function(pt){return function(Be){if(u)throw new TypeError("Generator is already executing.");for(;se;)try{if(u=1,D&&(B=2&Be[0]?D.return:Be[0]?D.throw||((B=D.return)&&B.call(D),0):D.next)&&!(B=B.call(D,Be[1])).done)return B;switch(D=0,B&&(Be=[2&Be[0],B.value]),Be[0]){case 0:case 1:B=Be;break;case 4:return se.label++,{value:Be[1],done:!1};case 5:se.label++,D=Be[1],Be=[0];continue;case 7:Be=se.ops.pop(),se.trys.pop();continue;default:if(!(B=se.trys,(B=B.length>0&&B[B.length-1])||Be[0]!==6&&Be[0]!==2)){se=0;continue}if(Be[0]===3&&(!B||Be[1]>B[0]&&Be[1]<B[3])){se.label=Be[1];break}if(Be[0]===6&&se.label<B[1]){se.label=B[1],B=Be;break}if(B&&se.label<B[2]){se.label=B[2],se.ops.push(Be);break}B[2]&&se.ops.pop(),se.trys.pop();continue}Be=a.call(P,se)}catch(bt){Be=[6,bt],D=0}finally{u=B=0}if(5&Be[0])throw Be[1];return{value:Be[0]?Be[1]:void 0,done:!0}}([tt,pt])}}}var Nt=function(){function P(){}return P.addKey=function(a){P.key=a},Object.defineProperty(P,"isLicensed",{get:function(){return!!P.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(P.key)},enumerable:!1,configurable:!0}),P}(),Je=function(){function P(){}return P.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},P.setAttributes=function(a,u){for(var D=0,B=u;D<B.length;D++){var L=B[D],se=L[0],Ie=L[1];a.setAttribute(se,Ie)}},P.createRect=function(a,u,D){var B=document.createElementNS("http://www.w3.org/2000/svg","rect");return B.setAttribute("width",a.toString()),B.setAttribute("height",u.toString()),D&&P.setAttributes(B,D),B},P.createLine=function(a,u,D,B,L){var se=document.createElementNS("http://www.w3.org/2000/svg","line");return se.setAttribute("x1",a.toString()),se.setAttribute("y1",u.toString()),se.setAttribute("x2",D.toString()),se.setAttribute("y2",B.toString()),L&&P.setAttributes(se,L),se},P.createPolygon=function(a,u){var D=document.createElementNS("http://www.w3.org/2000/svg","polygon");return D.setAttribute("points",a),u&&P.setAttributes(D,u),D},P.createCircle=function(a,u){var D=document.createElementNS("http://www.w3.org/2000/svg","circle");return D.setAttribute("cx",(a/2).toString()),D.setAttribute("cy",(a/2).toString()),D.setAttribute("r",a.toString()),u&&P.setAttributes(D,u),D},P.createEllipse=function(a,u,D){var B=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return B.setAttribute("cx",(a/2).toString()),B.setAttribute("cy",(u/2).toString()),B.setAttribute("rx",(a/2).toString()),B.setAttribute("ry",(u/2).toString()),D&&P.setAttributes(B,D),B},P.createGroup=function(a){var u=document.createElementNS("http://www.w3.org/2000/svg","g");return a&&P.setAttributes(u,a),u},P.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},P.createMarker=function(a,u,D,B,L,se,Ie){var tt=document.createElementNS("http://www.w3.org/2000/svg","marker");return P.setAttributes(tt,[["id",a],["orient",u],["markerWidth",D.toString()],["markerHeight",B.toString()],["refX",L.toString()],["refY",se.toString()]]),tt.appendChild(Ie),tt},P.createText=function(a){var u=document.createElementNS("http://www.w3.org/2000/svg","text");return u.setAttribute("x","0"),u.setAttribute("y","0"),a&&P.setAttributes(u,a),u},P.createTSpan=function(a,u){var D=document.createElementNS("http://www.w3.org/2000/svg","tspan");return D.textContent=a,u&&P.setAttributes(D,u),D},P.createImage=function(a){var u=document.createElementNS("http://www.w3.org/2000/svg","image");return a&&P.setAttributes(u,a),u},P.createPoint=function(a,u){var D=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return D.x=a,D.y=u,D},P.createPath=function(a,u){var D=document.createElementNS("http://www.w3.org/2000/svg","path");return D.setAttribute("d",a),u&&P.setAttributes(D,u),D},P.createElement=function(a,u){var D=document.createElementNS("http://www.w3.org/2000/svg",a);return u&&P.setAttributes(D,u),D},P.getHollowRectanglePath=function(a,u,D,B,L,se,Ie,tt){return"M"+a+","+u+"V"+(u+B)+"H"+(a+D)+"V"+u+"H"+L+"V"+se+"H"+(L+Ie)+"V"+(se+tt)+"H"+L+"V"+u+"Z"},P}(),Yt=function(){function P(a){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+a+"_"}return Object.defineProperty(P.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(P.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(P.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),P.prototype.addClass=function(a){return this.styleSheet===void 0&&this.addStyleSheet(),a.name=""+this.classNamePrefix+a.localName,this.classes.push(a),this.styleSheet.sheet.insertRule("."+a.name+" {"+a.style+"}",this.styleSheet.sheet.cssRules.length),a},P.prototype.addRule=function(a){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(a),this.styleSheet.sheet.insertRule(a.selector+" {"+a.style+"}",this.styleSheet.sheet.cssRules.length)},P.prototype.addStyleSheet=function(){var a;this.styleSheet=document.createElement("style"),((a=this.styleSheetRoot)!==null&&a!==void 0?a:document.head).appendChild(this.styleSheet),this.addRule(new or("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new or("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new or("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new Gt("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new Gt("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},P.prototype.removeStyleSheet=function(){var a;this.styleSheet&&(((a=this.styleSheetRoot)!==null&&a!==void 0?a:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},P}(),or=function(P,a){this.selector=P,this.style=a},Gt=function(P,a){this.localName=P,this.style=a},rr=function(){function P(){this.blocks=[],this.display=""}return P.prototype.addButtonBlock=function(a){a.className=this.blockClassName,a.buttonClassName=this.buttonClassName,a.buttonColorsClassName=this.buttonColorsClassName,a.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(a)},P.prototype.addElementBlock=function(a){a.className===void 0&&(a.className=this.blockClassName),this.blocks.push(a)},P.prototype.getUI=function(){var a=document.createElement("div");return a.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,a.style.display=this.display,this.blocks.forEach(function(u){return a.appendChild(u.getUI())}),a},P}(),$r=function(){function P(){}return P.prototype.getUI=function(){var a=document.createElement("div");if(a.className=this.className,this.minWidth!==void 0&&(a.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":a.style.justifyContent="flex-start";break;case"center":a.style.justifyContent="center";break;case"end":a.style.justifyContent="flex-end"}return a.style.whiteSpace="nowrap",a},P}(),Ir=function(P){function a(){var u=P!==null&&P.apply(this,arguments)||this;return u.buttons=[],u}return Wt(a,P),a.prototype.addButton=function(u){u.className=this.buttonClassName,u.colorsClassName=this.buttonColorsClassName,u.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(u)},a.prototype.getUI=function(){var u=P.prototype.getUI.call(this);return this.buttons.forEach(function(D){return u.appendChild(D.getUI())}),u},a}($r),yr=function(){function P(a,u){this._isActive=!1,this._isHidden=!1,this._icon=a,this.title=u,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(P.prototype,"icon",{get:function(){return this._icon},set:function(a){this._icon=a,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isActive",{get:function(){return this._isActive},set:function(a){this._isActive=a,this.adjustClassName()},enumerable:!1,configurable:!0}),P.prototype.getUI=function(){var a=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 a.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},P.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,"")))},P.prototype.hide=function(){this._isHidden=!0},P}(),pr=function(P){function a(){var u=P!==null&&P.apply(this,arguments)||this;return u.elements=[],u}return Wt(a,P),a.prototype.addElement=function(u){this.elements.push(u)},a.prototype.getUI=function(){var u=P.prototype.getUI.call(this);return this.elements.forEach(function(D){return u.appendChild(D)}),u},a}($r),Mr=function(){function P(a,u){this.horizontal=a,this.vertical=u}return Object.defineProperty(P.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),P.prototype.getVerticalLength=function(a){return a/this.ratio},P.prototype.getHorizontalLength=function(a){return a*this.ratio},P}(),Nr=function(){function P(){}return P.getIcon=function(a,u){if(a>0&&u>0){var D=new Mr(a,u),B=D.ratio>=1?20:D.getHorizontalLength(20),L=D.ratio<1?20:D.getVerticalLength(20),se=document.createElementNS("http://www.w3.org/2000/svg","svg");se.setAttribute("xmlns","http://www.w3.org/2000/svg"),se.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(se);var Ie=Je.createDefs();se.appendChild(Ie);var tt=Je.createElement("clipPath",[["id","text-bg-clip"]]);Ie.appendChild(tt);var pt=Je.createPath(Je.getHollowRectanglePath((24-B)/2,(24-L)/2,B,L,(24-B)/2+2,(24-L)/2+2,B-4,L-4));se.appendChild(pt);var Be=Je.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Be.appendChild(Je.createTSpan(a+":"+u)),se.appendChild(Be);var bt=Be.getBBox();Je.setAttributes(Be,[["x",((24-bt.width)/2).toString()],["y",((24-bt.height)/2-bt.y).toString()]]);var Tt=Je.createPath(Je.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(bt.width))/2,(24-Math.ceil(bt.height))/2,Math.ceil(bt.width),Math.ceil(bt.height)));return tt.appendChild(Tt),Je.setAttributes(pt,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(se),se.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>'},P}(),Kr=function(P){function a(u,D,B){var L=P.call(this,u,D)||this;return L.isDropdownOpen=!1,L.onClick=L.dropdownButtonClicked,L.dropdownButtons=B,L}return Wt(a,P),a.prototype.setupDropdown=function(){var u=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(D){D.className=u.className,D.colorsClassName=u.colorsClassName,u.dropdownBlock.appendChild(D.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},a.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},a.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},a.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},a.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},a.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},a}(yr),Sr=function(){function P(a,u){this.GRIP_SIZE=10,this.color=a,this.fillColor=u,this.visual=Je.createGroup(),this.visual.appendChild(Je.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(Je.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return P.prototype.ownsTarget=function(a){return a===this.visual||a===this.visual.childNodes[0]||a===this.visual.childNodes[1]},P.prototype.setCenter=function(a,u){this.visual.childNodes.forEach(function(D){return Je.setAttributes(D,[["cx",a.toString()],["cy",u.toString()]])})},P}(),_r=function(){function P(a,u,D,B){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=a,this.canvasHeight=u,this.margin=D,this.container=B,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(P.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(a){this._aspectRatio=a,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(a){this._isGridVisible=a,this.gridContainer&&Je.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(a){this._zoomFactor=a,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),P.prototype.open=function(){var a=this;this.cropShadeElement=Je.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=Je.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var u=0;u<this.numberOfGridLines;u++)this.horizontalGridLines.push(Je.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(Je.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(D){return a.gridContainer.appendChild(D)}),this.verticalGridLines.forEach(function(D){return a.gridContainer.appendChild(D)}),this.cropRectElement=Je.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Sr(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Sr(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Sr(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Sr(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},P.prototype.setCropRectangle=function(a){this.cropRect=a;var u=Object.assign({},this.cropRect);this.zoomFactor!==1&&(u.width=this.cropRect.width*this.zoomFactor,u.height=this.cropRect.height*this.zoomFactor,u.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-u.width/2,u.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-u.height/2),Je.setAttributes(this.cropRectElement,[["x",u.x.toString()],["y",u.y.toString()],["width",u.width.toString()],["height",u.height.toString()]]);var D=u.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(L,se){var Ie=u.y+D*(se+1);Je.setAttributes(L,[["x1",""+u.x],["y1",""+Ie],["x2",""+(u.x+u.width)],["y2",""+Ie]])});var B=u.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(L,se){var Ie=u.x+B*(se+1);Je.setAttributes(L,[["x1",""+Ie],["y1",""+u.y],["x2",""+Ie],["y2",""+(u.y+u.height)]])}),Je.setAttributes(this.cropShadeElement,[["d",Je.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,u.x,u.y,u.width,u.height)]]),this.topLeftGrip.setCenter(u.x,u.y),this.topRightGrip.setCenter(u.x+u.width,u.y),this.bottomLeftGrip.setCenter(u.x,u.y+u.height),this.bottomRightGrip.setCenter(u.x+u.width,u.y+u.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},P.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)},P.prototype.clientToLocalCoordinates=function(a,u){var D=this.container.getBoundingClientRect();return{x:a-D.left+this.margin,y:u-D.top+this.margin}},P.prototype.onPointerDown=function(a){this.container.setPointerCapture(a.pointerId),this.previousPoint=this.clientToLocalCoordinates(a.clientX,a.clientY),this.cropRectElement===a.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(a.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(a.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(a.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(a.target)&&(this.activeGrip=this.bottomRightGrip)},P.prototype.onPointerMove=function(a){if(this.isMoving)this.move(this.clientToLocalCoordinates(a.clientX,a.clientY));else if(this.activeGrip){var u=this.clientToLocalCoordinates(a.clientX,a.clientY);this.resize(u)}a.preventDefault()},P.prototype.onPointerUp=function(a){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(a.pointerId)},P.prototype.move=function(a){var u=a.x-this.previousPoint.x,D=a.y-this.previousPoint.y;this.zoomFactor!==1&&(u=-u/this.zoomFactor,D=-D/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+u),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+D),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=a},P.prototype.resize=function(a){var u=Object.assign({},this.cropRect),D=a.x-this.previousPoint.x,B=a.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:u.x+D<this.margin&&(D=this.margin-u.x),u.x+=D,u.width=this.cropRect.x+this.cropRect.width-u.x;break;case this.bottomRightGrip:case this.topRightGrip:u.width+D>this.canvasWidth*this.zoomFactor&&(D=this.canvasWidth*this.zoomFactor-u.width),u.width+=D}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(u.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(D),u.height=this.aspectRatio.getVerticalLength(u.width)):(u.y+=B,u.height=this.cropRect.y+this.cropRect.height-u.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?u.height=this.aspectRatio.getVerticalLength(u.width):u.height+=B}u.width<10&&(u.x=this.cropRect.x,u.width=10),u.height<10&&(u.y=this.cropRect.y,u.height=10),this.previousPoint=a,u.x>=this.margin&&u.y>=this.margin&&u.x-this.margin+u.width<=this.canvasWidth&&u.y-this.margin+u.height<=this.canvasHeight&&(this.cropRect=u,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},P.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var a=this.cropRect.x+this.cropRect.width/2,u=this.cropRect.y+this.cropRect.height/2,D=this.aspectRatio.getHorizontalLength(this.cropRect.height),B=this.aspectRatio.getVerticalLength(this.cropRect.width);D/this.canvasWidth<B/this.canvasHeight?this.cropRect.width=D:this.cropRect.height=B,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=a-this.cropRect.width/2,this.cropRect.y=u-this.cropRect.height/2,this.cropRect.x+this.cropRect.width>this.margin+this.canvasWidth&&(this.cropRect.x=this.margin+this.canvasWidth-this.cropRect.width),this.cropRect.y+this.cropRect.height>this.margin+this.canvasHeight&&(this.cropRect.y=this.margin+this.canvasHeight-this.cropRect.height),this.cropRect.x=Math.max(this.cropRect.x,this.margin),this.cropRect.y=Math.max(this.cropRect.y,this.margin)}},P.prototype.getRescaledRect=function(a,u,D,B,L,se){var Ie=D/a,tt=B/u;return{x:(L.x-se)*Ie+se,y:(L.y-se)*tt+se,width:L.width*Ie,height:L.height*tt}},P.prototype.scaleCanvas=function(a,u){var D=this.getRescaledRect(this.canvasWidth,this.canvasHeight,a,u,this.cropRect,this.margin);this.canvasWidth=a,this.canvasHeight=u,this.onCropChange&&this.onCropChange(D),this.setCropRectangle(D)},P}(),tn=function(){function P(a){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=a,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(P.prototype,"angle",{get:function(){return this._angle},set:function(a){this._angle=a,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),P.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},P.prototype.onPointerDown=function(a){this.controlContainer.setPointerCapture(a.pointerId),this.isDragging=!0,this.previousPoint={x:a.clientX,y:a.clientY}},P.prototype.onPointerMove=function(a){this.isDragging&&(this.onAngleChange&&this.onAngleChange((a.clientX-this.previousPoint.x)/5),this.previousPoint.x=a.clientX)},P.prototype.onPointerUp=function(a){this.isDragging&&this.onAngleChange&&this.onAngleChange((a.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(a.pointerId)},P.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var a=this.angleLabelText.getBBox();Je.setAttributes(this.angleLabelElement,[["x",((this.width-a.width)/2).toString()],["y",(this.height/2).toString()]])}},P.prototype.positionScaleShape=function(){if(this.scaleShape){var a=this.scaleShape.transform.baseVal.getItem(0);a.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(a,0)}},P.prototype.getVisual=function(){var a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("xmlns","http://www.w3.org/2000/svg"),a.setAttribute("width",this.width+"px"),a.setAttribute("height",this.height+"px"),a.setAttribute("viewBox","0 0 "+this.width+" "+this.height),a.style.flexShrink="0",document.body.appendChild(a);for(var u="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,D=1;D<=this.width/5+10;D++){var B=D%5==0?this.height/3:this.height/6;u+="h4v"+-B+"h1v"+B}u+="v1H0Z",this.scaleShape=Je.createPath(u);var L=Je.createTransform();this.scaleShape.transform.baseVal.appendItem(L),a.appendChild(this.scaleShape),this.angleLabelElement=Je.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=Je.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var se=Je.createTSpan("");return se.innerHTML="&deg;",this.angleLabelElement.appendChild(se),a.appendChild(this.angleLabelElement),document.body.removeChild(a),a},P}(),Ur=function(){function P(){this.naturalSize=!1,this.imageType="image/png"}return P.prototype.rasterize=function(a,u,D,B,L,se,Ie){var tt=this;return new Promise(function(pt){var Be=document.createElement("canvas");Be.width=a.width.baseVal.value-2*B,Be.height=a.height.baseVal.value-2*B;var bt=1,Tt=1;tt.naturalSize===!0?(bt=u.naturalWidth/(a.width.baseVal.value-2*B)/se,Tt=u.naturalHeight/(a.height.baseVal.value-2*B)/Ie,Be.width=u.naturalWidth/se,Be.height=u.naturalHeight/Ie):tt.width!==void 0&&tt.height!==void 0&&(bt=tt.width/D.width,Tt=tt.height/D.height,Be.width*=bt,Be.height*=Tt);var Qt=Be.getContext("2d");Qt.translate(Be.width/2,Be.height/2),Qt.rotate(L*Math.PI/180),Qt.scale(se,Ie),Qt.translate(-Be.width/2,-Be.height/2),Qt.drawImage(u,0,0,Be.width,Be.height);var Ae=document.createElement("canvas");Ae.width=D.width*bt,Ae.height=D.height*Tt,Ae.getContext("2d").putImageData(Qt.getImageData((D.x-B)*bt,(D.y-B)*Tt,D.width*bt,D.height*Tt),0,0),pt(Ae.toDataURL(tt.imageType,tt.imageQuality))})},P}(),wt=function(){function P(a){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=P.instanceCounter++,this.styles=new Yt(this.instanceNo),this.target=a,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(P.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(a){this._zoomToCropEnabled=a,a?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(a){this._isGridVisible=a,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"gridLines",{get:function(){return this._gridLines},set:function(a){this._gridLines=a,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(a){this._rotationAngle=a,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"aspectRatio",{get:function(){var a;return(a=this._aspectRatio)!==null&&a!==void 0?a:this.aspectRatios[0]},set:function(a){this._aspectRatio=a},enumerable:!1,configurable:!0}),P.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},P.prototype.show=function(){this.showUI(),this.open()},P.prototype.close=function(a){a===void 0&&(a=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),a||this.closeEventListeners.forEach(function(u){return u()}),this._isOpen=!1)},P.prototype.addRenderEventListener=function(a){this.renderEventListeners.push(a)},P.prototype.removeRenderEventListener=function(a){this.renderEventListeners.indexOf(a)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(a),1)},P.prototype.addCloseEventListener=function(a){this.closeEventListeners.push(a)},P.prototype.removeCloseEventListener=function(a){this.closeEventListeners.indexOf(a)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(a),1)},P.prototype.setupResizeObserver=function(){var a=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){a.resize(a.target.clientWidth,a.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))},P.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var a=1*this.target.clientWidth/this.target.clientHeight,u=this.contentDiv.clientWidth/a>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*a:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,D=u+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/a;this.resize(u,D)}},P.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},P.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",Je.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},P.prototype.resize=function(a,u){this.imageWidth=Math.round(a),this.imageHeight=Math.round(u),this.setEditingTargetSize(),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.displayMode!=="popup"?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},P.prototype.setEditingTarget=function(){var a=document.createElement("canvas");a.width=this.target.naturalWidth,a.height=this.target.naturalHeight,a.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var u=a.toDataURL();Je.setAttributes(this.editingTarget,[["href",u]]),this.setEditingTargetSize()},P.prototype.setTopLeft=function(){var a=this.target.getBoundingClientRect(),u=this.editorCanvas.getBoundingClientRect();this.left=a.left-u.left-this.CANVAS_MARGIN,this.top=a.top-u.top-this.CANVAS_MARGIN},P.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=Je.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=Je.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=Je.createGroup(),this.editingTargetRotationScaleContainer=Je.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var a=Je.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(a);var u=Je.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(u),this.editingTargetContainer=Je.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)},P.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},P.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=Je.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new _r(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()},P.prototype.zoomToCrop=function(){if(this.cropRect){var a=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,u=this.cropRect.y-this.CANVAS_MARGIN+this.cropRect.height/2;this.zoomFactor=Math.min(this.imageWidth/this.cropRect.width,this.imageHeight/this.cropRect.height),this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin=a+"px "+u+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-a+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-u+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},P.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)},P.prototype.cropRectChanged=function(a){this.cropRect=a,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},P.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},P.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"},P.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},P.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 a=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,u=this.target.offsetTop>a+this.CANVAS_MARGIN?this.target.offsetTop-(a+this.CANVAS_MARGIN):0;this.coverDiv.style.top=u+"px",this.coverDiv.style.left=(this.target.offsetLeft>this.CANVAS_MARGIN?this.target.offsetLeft-this.CANVAS_MARGIN:0)+"px",this.coverDiv.style.width=this.target.offsetWidth+this.CANVAS_MARGIN+"px",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.displayMode==="popup"?this.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.addToolbars(),this.uiDiv.appendChild(this.topToolbar.getUI()),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.alignItems="center",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.contentDiv.style.overflow="hidden",this.contentDiv.style.backgroundColor=this.styles.settings.canvasBackgroundColor,this.displayMode==="popup"&&(this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.popupMargin+"px)"),this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.contentDiv.appendChild(this.editorCanvas),this.uiDiv.appendChild(this.bottomToolbar.getUI()),this.straightener.angle=this.rotationAngle},P.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},P.prototype.addTopToolbar=function(){var a=this;this.topToolbar=new rr,this.topToolbar.display=this.styles.settings.hideTopToolbar?"none":"",this.topToolbar.className=this.toolbarStyleClass.name,this.topToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.topToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.topToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.topToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.topToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.topToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var u=new Ir;u.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(u);var D=[];this.aspectRatios.forEach(function(Tt){var Qt=new yr(Nr.getIcon(Tt.horizontal,Tt.vertical),Tt.horizontal===0&&Tt.vertical===0?"FREE":Tt.horizontal+":"+Tt.vertical);Qt.onClick=function(){return a.ratioButtonClicked(Tt)},D.push(Qt)}),this.aspectRatioButton=new Kr(Nr.getIcon(0,0),"Aspect ratio",D),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,u.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var B=new yr('<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");B.isActive=this.isGridVisible,B.onClick=function(){a.isGridVisible=!a.isGridVisible,B.isActive=a.isGridVisible},u.addButton(B);var L=new yr('<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(L.isActive=this.zoomToCropEnabled,L.onClick=function(){a.zoomToCropEnabled=!a.zoomToCropEnabled,L.isActive=a.zoomToCropEnabled},u.addButton(L),!Nt.isLicensed){var se=new pr;this.topToolbar.addElementBlock(se);var Ie=document.createElement("div");Ie.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var tt=document.createElement("a");tt.style.color="currentColor",tt.href="https://markerjs.com/products/cropro",tt.target="_blank",tt.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>',Ie.appendChild(tt),se.addElement(Ie)}var pt=new Ir;pt.minWidth=3*this.toolbarHeight+"px",pt.contentAlign="end",this.topToolbar.addButtonBlock(pt);var Be=new yr('<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");Be.onClick=this.startRenderAndClose,pt.addButton(Be),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Be.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var bt=new yr('<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");bt.onClick=this.close,pt.addButton(bt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(bt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},P.prototype.addBottomToolbar=function(){var a=this;this.bottomToolbar=new rr,this.bottomToolbar.display=this.styles.settings.hideBottomToolbar?"none":"",this.bottomToolbar.className=this.toolbarStyleClass.name,this.bottomToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.bottomToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.bottomToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.bottomToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.bottomToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.bottomToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var u=new Ir;u.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(u);var D=new yr('<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");D.onClick=this.rotateLeftButtonClicked,u.addButton(D);var B=new yr('<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");B.onClick=this.rotateRightButtonClicked,u.addButton(B);var L=new pr;L.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(L),this.straightener=new tn("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(pt){a.rotateBy(pt),a.straightener.angle=a.rotationAngle},L.addElement(this.straightener.getUI());var se=new Ir;se.minWidth=2*this.toolbarHeight+"px",se.contentAlign="end",this.bottomToolbar.addButtonBlock(se);var Ie=new yr('<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");Ie.onClick=this.flipHorizontallyButtonClicked,se.addButton(Ie);var tt=new yr('<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");tt.onClick=this.flipVerticallyButtonClicked,se.addButton(tt)},P.prototype.ratioButtonClicked=function(a){this.aspectRatio=a,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},P.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=Nr.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},P.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Mr(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},P.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},P.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},P.prototype.restoreState=function(a){if(a){var u=this.cropLayer.getRescaledRect(a.width,a.height,this.imageWidth,this.imageHeight,a.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(u),this.cropRectChanged(u),this.flippedHorizontally=a.flippedHorizontally,this.flippedVertically=a.flippedVertically,this.applyFlip(),this.rotationAngle=a.rotationAngle,this.applyRotation()}},P.prototype.clientToLocalCoordinates=function(a,u){var D=this.cropImage.getBoundingClientRect();return{x:a-D.left,y:u-D.top}},P.prototype.onWindowResize=function(){this.positionUI()},P.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var a=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=a+"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()},P.prototype.rotateLeftButtonClicked=function(){var a=this.rotationAngle-90;this.rotationAngle%90!=0&&(a+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(a)},P.prototype.rotateRightButtonClicked=function(){var a=this.rotationAngle+90;this.rotationAngle%90!=0&&(a-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(a)},P.prototype.rotateTo=function(a){a=(a=a>180?a-360:a)<=-180?a+360:a,this.rotationAngle=a,this.applyRotation()},P.prototype.rotateBy=function(a){this.rotateTo((this.rotationAngle+a)%360)},P.prototype.applyRotation=function(){var a=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var u=this.editingTargetRotationContainer.transform.baseVal.getItem(0);u.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(u,0);var D=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/D.width,this.imageHeight/D.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=a},P.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},P.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},P.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},P.prototype.startRenderAndClose=function(){return gt(this,void 0,void 0,function(){var a,u;return Bt(this,function(D){switch(D.label){case 0:return[4,this.render()];case 1:return a=D.sent(),u=this.getState(),this.renderEventListeners.forEach(function(B){return B(a,u)}),this.close(!0),[2]}})})},P.prototype.render=function(){return gt(this,void 0,void 0,function(){var a;return Bt(this,function(u){switch(u.label){case 0:return(a=new Ur).naturalSize=this.renderAtNaturalSize,a.imageType=this.renderImageType,a.imageQuality=this.renderImageQuality,a.width=this.renderWidth,a.height=this.renderHeight,this.unzoomFromCrop(),Je.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,a.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 1:return u.sent(),[4,a.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 2:return[2,u.sent()]}})})},P.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Gt("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 Gt("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Gt("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var a=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Gt("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*a)+`px;
height: `+(this.toolbarHeight-2*a)+`px;
padding: `+a+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Gt("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Gt("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new or("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new or("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new Gt("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 Gt("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Gt("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 Gt("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*a)+`px;
padding: `+a+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new Gt("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},P.instanceCounter=0,P}(),Yr=K("8hTe"),kr=K.n(Yr),Hr=/<pre[^>]*>/g;function Br(P){var a=document.createElement("div");return a.innerHTML=P,a.childNodes.length===0?"":a.childNodes[0].nodeValue}var rn=ze.a=function(P){var a=P.value,u=a===void 0?"":a,D=P.edit,B=D===void 0?!1:D,L=P.className,se=P.showTextOnly,Ie=P.showLines,tt=P.replaces,pt=P.zoomImg,Be=P.hasMask,bt=P.style,Tt=bt===void 0?{}:bt,Qt=P.stylesPrev,Ae=Qt===void 0?{}:Qt,br=String(u),sr=Object(w.useRef)(),Rr=Object(w.useRef)(),Cn=Object(w.useState)(""),nn=Object(U.a)(Cn,2),jr=nn[0],Qr=nn[1],zr=Object(w.useState)("office"),an=Object(U.a)(zr,2),Tn=an[0],hn=an[1],bn=function(){var Lt=new wt(Rr.current);Lt.displayMode="popup",Lt.addRenderEventListener(function(){var lr=Object(E.a)(R.a.mark(function jt(mr){var Zt;return R.a.wrap(function(vr){for(;;)switch(vr.prev=vr.next){case 0:return sr.current.style.display="none",vr.next=3,Object(Ne.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:mr}});case 3:Zt=vr.sent,Zt!=null&&Zt.id&&tt(Rr.current.getAttribute("src").replace(le.a.API_SERVER,""),"/api/attachments/".concat(Zt==null?void 0:Zt.id,"?type=").concat(Zt.content_type));case 5:case"end":return vr.stop()}},jt)}));return function(jt){return lr.apply(this,arguments)}}()),Lt.show()},Mn=function(){var Lt=new At(Rr.current);Lt.settings.displayMode="popup",Lt.addEventListener("render",function(){var lr=Object(E.a)(R.a.mark(function jt(mr){var Zt;return R.a.wrap(function(vr){for(;;)switch(vr.prev=vr.next){case 0:if(sr.current.style.display="none",!Rr.current){vr.next=6;break}return vr.next=4,Object(Ne.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:mr.dataUrl}});case 4:Zt=vr.sent,Zt!=null&&Zt.id&&tt(Rr.current.getAttribute("src").replace(le.a.API_SERVER,""),"/api/attachments/".concat(Zt==null?void 0:Zt.id,"?type=").concat(Zt.content_type));case 6:case"end":return vr.stop()}},jt)}));return function(jt){return lr.apply(this,arguments)}}()),Lt.show(),window.markerArea=Lt},on=Object(w.useMemo)(function(){try{var qt=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Lt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,lr=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;br=br.replace(qt,"("+le.a.API_SERVER+"/api/attachments/").replace(Lt,'"'+le.a.API_SERVER+"/api/attachments/").replace(lr,'"'+le.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,`
`),br=br.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
`)}catch(pn){}var jt=z(br),mr=m();if(br.match(/\[TOC\]/)&&(jt=jt.replace("<p>[TOC]</p>",p()),f()),jt=jt.replace(/(__special_katext_id_\d+__)/g,function(pn,vr){var En=mr[vr],sn=En.type,mn=En.expression;return Object(ye.renderToString)(Br(mn)||"",{displayMode:sn==="block",throwOnError:!1,output:"html"})}),jt=jt.replace(/▁/g,"\u2581\u2581\u2581"),y(),se){var Zt=document.createElement("div");return Zt.innerHTML=jt,Zt.innerText}return setTimeout(function(){return Sn()},500),jt},[br]),Er=Object(w.useRef)();d.WebkitLineClamp=Ie,Ie&&(Tt=Object(g.a)(Object(g.a)({},Tt),d));function Jr(qt){var Lt=qt.target;if(Lt.tagName.toUpperCase()==="IMG"){if(pt){var lr=Lt.getAttribute("src");Qr(lr),hn("image")}}else if(Lt.tagName.toUpperCase()==="A"){var jt=Lt.getAttribute("href");if(jt.indexOf("office")>-1)qt.preventDefault(),Qr(jt),hn("office");else if(jt.indexOf("application/pdf")>-1)qt.preventDefault(),Qr(jt),hn("pdf");else if(jt.indexOf("type=text")>-1)qt.preventDefault(),Qr(jt),hn("html");else if(jt.startsWith("#")){qt.preventDefault();var mr=document.getElementById(jt.replace("#",""));mr&&mr.scrollIntoView(!0)}}}var Sn=function(){var Lt,lr=(Lt=Er.current)===null||Lt===void 0?void 0:Lt.querySelectorAll("video");lr==null||lr.forEach(function(jt){if(jt.oncontextmenu=function(){return!1},jt.src.indexOf(".m3u8")>-1&&!jt.canPlayType("application/vnd.apple.mpegurl")){if(X.a.isSupported()){var mr=new X.a;mr.loadSource(jt.src),mr.attachMedia(jt)}}})};Object(w.useEffect)(function(){if(Er.current&&on&&(on.match(Hr)&&window.PR.prettyPrint()),Er.current)return Er.current.addEventListener("click",Jr),function(){Er.current.removeEventListener("click",Jr),y(),f()}},[on,Er.current,Jr]);var fn=function(Lt){if(!B)return;Lt.target.nodeName==="IMG"?(sr.current.style.display="flex",sr.current.style.width=Lt.target.clientWidth+"px",sr.current.style.height=Lt.target.clientHeight+"px",sr.current.style.top=Lt.target.offsetTop+"px",sr.current.style.left=Lt.target.offsetLeft+"px",Rr.current.src=Lt.target.getAttribute("src")):sr.current.style.display="none"};return x.a.createElement("div",{style:{position:"relative"}},x.a.createElement("div",{ref:Er,style:Object(g.a)({},Tt),className:"".concat(L||""," markdown-body ").concat(kr.a.mdBody),onMouseOver:fn,dangerouslySetInnerHTML:{__html:on}}),x.a.createElement("div",{ref:sr,className:kr.a.button},x.a.createElement(N.a,null,x.a.createElement(I.a,{onClick:function(){return bn()}},"\u88C1\u526A"),x.a.createElement(I.a,{onClick:function(){return Mn()}},"\u7F16\u8F91"))),x.a.createElement("img",{ref:Rr,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),x.a.createElement(ve.a,{close:!0,data:jr,hasMask:Be,type:jr!=null&&jr.length?Tn:"",style:Object(g.a)({},Ae),onClose:function(){return Qr("")}}))}},BJfS:function(ft,ze){var K=function(oe){return oe.replace(/[A-Z]/g,function(N){return"-"+N.toLowerCase()}).toLowerCase()};ft.exports=K},BU3w:function(ft,ze,K){"use strict";K.d(ze,"a",function(){return E});var oe=K("MNnm"),N="rc-util-key";function S(U){if(U.attachTo)return U.attachTo;var M=document.querySelector("head");return M||document.body}function I(U){var M,R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(oe.a)())return null;var w=document.createElement("style");if((M=R.csp)===null||M===void 0?void 0:M.nonce){var x;w.nonce=(x=R.csp)===null||x===void 0?void 0:x.nonce}w.innerHTML=U;var T=S(R),O=T.firstChild;return R.prepend&&T.prepend?T.prepend(w):R.prepend&&O?T.insertBefore(w,O):T.appendChild(w),w}var g=new Map;function E(U,M){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},w=S(R);if(!g.has(w)){var x=I("",R),T=x.parentNode;g.set(w,T),T.removeChild(x)}var O=Array.from(g.get(w).children).find(function(r){return r.tagName==="STYLE"&&r[N]===M});if(O){var C,b;if(((C=R.csp)===null||C===void 0?void 0:C.nonce)&&O.nonce!==((b=R.csp)===null||b===void 0?void 0:b.nonce)){var v;O.nonce=(v=R.csp)===null||v===void 0?void 0:v.nonce}return O.innerHTML!==U&&(O.innerHTML=U),O}var h=I(U,R);return h[N]=M,h}},DlQD:function(ft,ze,K){(function(oe,N){ft.exports=N()})(this,function(){"use strict";function oe(ae,ee){for(var te=0;te<ee.length;te++){var H=ee[te];H.enumerable=H.enumerable||!1,H.configurable=!0,"value"in H&&(H.writable=!0),Object.defineProperty(ae,H.key,H)}}function N(ae,ee,te){return ee&&oe(ae.prototype,ee),te&&oe(ae,te),ae}function S(ae,ee){if(!ae)return;if(typeof ae=="string")return I(ae,ee);var te=Object.prototype.toString.call(ae).slice(8,-1);if(te==="Object"&&ae.constructor&&(te=ae.constructor.name),te==="Map"||te==="Set")return Array.from(ae);if(te==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(te))return I(ae,ee)}function I(ae,ee){(ee==null||ee>ae.length)&&(ee=ae.length);for(var te=0,H=new Array(ee);te<ee;te++)H[te]=ae[te];return H}function g(ae,ee){var te;if(typeof Symbol=="undefined"||ae[Symbol.iterator]==null){if(Array.isArray(ae)||(te=S(ae))||ee&&ae&&typeof ae.length=="number"){te&&(ae=te);var H=0;return function(){return H>=ae.length?{done:!0}:{done:!1,value:ae[H++]}}}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=ae[Symbol.iterator](),te.next.bind(te)}function E(ae,ee){return ee={exports:{}},ae(ee,ee.exports),ee.exports}var U=E(function(ae){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(H){ae.exports.defaults=H}ae.exports={defaults:ee(),getDefaults:ee,changeDefaults:te}}),M=U.defaults,R=U.getDefaults,w=U.changeDefaults,x=/[&<>"']/,T=/[&<>"']/g,O=/[<>"']|&(?!#?\w+;)/,C=/[<>"']|&(?!#?\w+;)/g,b={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},v=function(ee){return b[ee]};function h(ae,ee){if(ee){if(x.test(ae))return ae.replace(T,v)}else if(O.test(ae))return ae.replace(C,v);return ae}var r=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function o(ae){return ae.replace(r,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 s=/(^|[^\[])\^/g;function f(ae,ee){ae=ae.source||ae,ee=ee||"";var te={replace:function(G,V){return V=V.source||V,V=V.replace(s,"$1"),ae=ae.replace(G,V),te},getRegex:function(){return new RegExp(ae,ee)}};return te}var d=/[^\w:]/g,l=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function p(ae,ee,te){if(ae){var H;try{H=decodeURIComponent(o(te)).replace(d,"").toLowerCase()}catch(G){return null}if(H.indexOf("javascript:")===0||H.indexOf("vbscript:")===0||H.indexOf("data:")===0)return null}ee&&!l.test(te)&&(te=e(ee,te));try{te=encodeURI(te).replace(/%25/g,"%")}catch(G){return null}return te}var c={},i=/^[^:]+:\/*[^/]*$/,n=/^([^:]+:)[\s\S]*$/,t=/^([^:]+:\/*[^/]*)[\s\S]*$/;function e(ae,ee){c[" "+ae]||(i.test(ae)?c[" "+ae]=ae+"/":c[" "+ae]=A(ae,"/",!0)),ae=c[" "+ae];var te=ae.indexOf(":")===-1;return ee.substring(0,2)==="//"?te?ee:ae.replace(n,"$1")+ee:ee.charAt(0)==="/"?te?ee:ae.replace(t,"$1")+ee:ae+ee}var m={exec:function(){}};function y(ae){for(var ee=1,te,H;ee<arguments.length;ee++){te=arguments[ee];for(H in te)Object.prototype.hasOwnProperty.call(te,H)&&(ae[H]=te[H])}return ae}function _(ae,ee){var te=ae.replace(/\|/g,function(V,J,de){for(var ge=!1,Me=J;--Me>=0&&de[Me]==="\\";)ge=!ge;return ge?"|":" |"}),H=te.split(/ \|/),G=0;if(H.length>ee)H.splice(ee);else for(;H.length<ee;)H.push("");for(;G<H.length;G++)H[G]=H[G].trim().replace(/\\\|/g,"|");return H}function A(ae,ee,te){var H=ae.length;if(H===0)return"";for(var G=0;G<H;){var V=ae.charAt(H-G-1);if(V===ee&&!te)G++;else if(V!==ee&&te)G++;else break}return ae.substr(0,H-G)}function k(ae,ee){if(ae.indexOf(ee[1])===-1)return-1;for(var te=ae.length,H=0,G=0;G<te;G++)if(ae[G]==="\\")G++;else if(ae[G]===ee[0])H++;else if(ae[G]===ee[1]&&(H--,H<0))return G;return-1}function F(ae){ae&&ae.sanitize&&!ae.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 z={escape:h,unescape:o,edit:f,cleanUrl:p,resolveUrl:e,noopTest:m,merge:y,splitCells:_,rtrim:A,findClosingBracket:k,checkSanitizeDeprecation:F},Q=U.defaults,Y=z.rtrim,X=z.splitCells,le=z.escape,ye=z.findClosingBracket;function ve(ae,ee,te){var H=ee.href,G=ee.title?le(ee.title):null,V=ae[1].replace(/\\([\[\]])/g,"$1");return ae[0].charAt(0)!=="!"?{type:"link",raw:te,href:H,title:G,text:V}:{type:"image",raw:te,href:H,title:G,text:le(V)}}function Ne(ae,ee){var te=ae.match(/^(\s+)(?:```)/);if(te===null)return ee;var H=te[1];return ee.split(`
`).map(function(G){var V=G.match(/^\s+/);if(V===null)return G;var J=V[0];return J.length>=H.length?G.slice(H.length):G}).join(`
`)}var Te=function(){function ae(te){this.options=te||Q}var ee=ae.prototype;return ee.space=function(H){var G=this.rules.block.newline.exec(H);if(G)return G[0].length>1?{type:"space",raw:G[0]}:{raw:`
`}},ee.code=function(H,G){var V=this.rules.block.code.exec(H);if(V){var J=G[G.length-1];if(J&&J.type==="paragraph")return{raw:V[0],text:V[0].trimRight()};var de=V[0].replace(/^ {4}/gm,"");return{type:"code",raw:V[0],codeBlockStyle:"indented",text:this.options.pedantic?de:Y(de,`
`)}}},ee.fences=function(H){var G=this.rules.block.fences.exec(H);if(G){var V=G[0],J=Ne(V,G[3]||"");return{type:"code",raw:V,lang:G[2]?G[2].trim():G[2],text:J}}},ee.heading=function(H){var G=this.rules.block.heading.exec(H);if(G)return{type:"heading",raw:G[0],depth:G[1].length,text:G[2]}},ee.nptable=function(H){var G=this.rules.block.nptable.exec(H);if(G){var V={type:"table",header:X(G[1].replace(/^ *| *\| *$/g,"")),align:G[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:G[3]?G[3].replace(/\n$/,"").split(`
`):[],raw:G[0]};if(V.header.length===V.align.length){var J=V.align.length,de;for(de=0;de<J;de++)/^ *-+: *$/.test(V.align[de])?V.align[de]="right":/^ *:-+: *$/.test(V.align[de])?V.align[de]="center":/^ *:-+ *$/.test(V.align[de])?V.align[de]="left":V.align[de]=null;for(J=V.cells.length,de=0;de<J;de++)V.cells[de]=X(V.cells[de],V.header.length);return V}}},ee.hr=function(H){var G=this.rules.block.hr.exec(H);if(G)return{type:"hr",raw:G[0]}},ee.blockquote=function(H){var G=this.rules.block.blockquote.exec(H);if(G){var V=G[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:G[0],text:V}}},ee.list=function(H){var G=this.rules.block.list.exec(H);if(G){for(var V=G[0],J=G[2],de=J.length>1,ge=J[J.length-1]===")",Me={type:"list",raw:V,ordered:de,start:de?+J.slice(0,-1):"",loose:!1,items:[]},et=G[0].match(this.rules.block.item),dt=!1,qe,Ct,_t,at,It,At,Ot,Wt=et.length,gt=0;gt<Wt;gt++)qe=et[gt],V=qe,Ct=qe.length,qe=qe.replace(/^ *([*+-]|\d+[.)]) */,""),~qe.indexOf(`
`)&&(Ct-=qe.length,qe=this.options.pedantic?qe.replace(/^ {1,4}/gm,""):qe.replace(new RegExp("^ {1,"+Ct+"}","gm"),"")),gt!==Wt-1&&(_t=this.rules.block.bullet.exec(et[gt+1])[0],(de?_t.length===1||!ge&&_t[_t.length-1]===")":_t.length>1||this.options.smartLists&&_t!==J)&&(at=et.slice(gt+1).join(`
`),Me.raw=Me.raw.substring(0,Me.raw.length-at.length),gt=Wt-1)),It=dt||/\n\n(?!\s*$)/.test(qe),gt!==Wt-1&&(dt=qe.charAt(qe.length-1)===`
`,It||(It=dt)),It&&(Me.loose=!0),At=/^\[[ xX]\] /.test(qe),Ot=void 0,At&&(Ot=qe[1]!==" ",qe=qe.replace(/^\[[ xX]\] +/,"")),Me.items.push({type:"list_item",raw:V,task:At,checked:Ot,loose:It,text:qe});return Me}},ee.html=function(H){var G=this.rules.block.html.exec(H);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]):le(G[0]):G[0]}},ee.def=function(H){var G=this.rules.block.def.exec(H);if(G){G[3]&&(G[3]=G[3].substring(1,G[3].length-1));var V=G[1].toLowerCase().replace(/\s+/g," ");return{tag:V,raw:G[0],href:G[2],title:G[3]}}},ee.table=function(H){var G=this.rules.block.table.exec(H);if(G){var V={type:"table",header:X(G[1].replace(/^ *| *\| *$/g,"")),align:G[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:G[3]?G[3].replace(/\n$/,"").split(`
`):[]};if(V.header.length===V.align.length){V.raw=G[0];var J=V.align.length,de;for(de=0;de<J;de++)/^ *-+: *$/.test(V.align[de])?V.align[de]="right":/^ *:-+: *$/.test(V.align[de])?V.align[de]="center":/^ *:-+ *$/.test(V.align[de])?V.align[de]="left":V.align[de]=null;for(J=V.cells.length,de=0;de<J;de++)V.cells[de]=X(V.cells[de].replace(/^ *\| *| *\| *$/g,""),V.header.length);return V}}},ee.lheading=function(H){var G=this.rules.block.lheading.exec(H);if(G)return{type:"heading",raw:G[0],depth:G[2].charAt(0)==="="?1:2,text:G[1]}},ee.paragraph=function(H){var G=this.rules.block.paragraph.exec(H);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(H,G){var V=this.rules.block.text.exec(H);if(V){var J=G[G.length-1];return J&&J.type==="text"?{raw:V[0],text:V[0]}:{type:"text",raw:V[0],text:V[0]}}},ee.escape=function(H){var G=this.rules.inline.escape.exec(H);if(G)return{type:"escape",raw:G[0],text:le(G[1])}},ee.tag=function(H,G,V){var J=this.rules.inline.tag.exec(H);if(J)return!G&&/^<a /i.test(J[0])?G=!0:G&&/^<\/a>/i.test(J[0])&&(G=!1),!V&&/^<(pre|code|kbd|script)(\s|>)/i.test(J[0])?V=!0:V&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(J[0])&&(V=!1),{type:this.options.sanitize?"text":"html",raw:J[0],inLink:G,inRawBlock:V,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(J[0]):le(J[0]):J[0]}},ee.link=function(H){var G=this.rules.inline.link.exec(H);if(G){var V=ye(G[2],"()");if(V>-1){var J=G[0].indexOf("!")===0?5:4,de=J+G[1].length+V;G[2]=G[2].substring(0,V),G[0]=G[0].substring(0,de).trim(),G[3]=""}var ge=G[2],Me="";if(this.options.pedantic){var et=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(ge);et?(ge=et[1],Me=et[3]):Me=""}else Me=G[3]?G[3].slice(1,-1):"";ge=ge.trim().replace(/^<([\s\S]*)>$/,"$1");var dt=ve(G,{href:ge&&ge.replace(this.rules.inline._escapes,"$1"),title:Me&&Me.replace(this.rules.inline._escapes,"$1")},G[0]);return dt}},ee.reflink=function(H,G){var V;if((V=this.rules.inline.reflink.exec(H))||(V=this.rules.inline.nolink.exec(H))){var J=(V[2]||V[1]).replace(/\s+/g," ");if(J=G[J.toLowerCase()],!J||!J.href){var de=V[0].charAt(0);return{type:"text",raw:de,text:de}}var ge=ve(V,J,V[0]);return ge}},ee.strong=function(H,G,V){V===void 0&&(V="");var J=this.rules.inline.strong.start.exec(H);if(J&&(!J[1]||J[1]&&(V===""||this.rules.inline.punctuation.exec(V)))){G=G.slice(-1*H.length);var de=J[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;de.lastIndex=0;for(var ge;(J=de.exec(G))!=null;)if(ge=this.rules.inline.strong.middle.exec(G.slice(0,J.index+3)),ge)return{type:"strong",raw:H.slice(0,ge[0].length),text:H.slice(2,ge[0].length-2)}}},ee.em=function(H,G,V){V===void 0&&(V="");var J=this.rules.inline.em.start.exec(H);if(J&&(!J[1]||J[1]&&(V===""||this.rules.inline.punctuation.exec(V)))){G=G.slice(-1*H.length);var de=J[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;de.lastIndex=0;for(var ge;(J=de.exec(G))!=null;)if(ge=this.rules.inline.em.middle.exec(G.slice(0,J.index+2)),ge)return{type:"em",raw:H.slice(0,ge[0].length),text:H.slice(1,ge[0].length-1)}}},ee.codespan=function(H){var G=this.rules.inline.code.exec(H);if(G){var V=G[2].replace(/\n/g," "),J=/[^ ]/.test(V),de=V.startsWith(" ")&&V.endsWith(" ");return J&&de&&(V=V.substring(1,V.length-1)),V=le(V,!0),{type:"codespan",raw:G[0],text:V}}},ee.br=function(H){var G=this.rules.inline.br.exec(H);if(G)return{type:"br",raw:G[0]}},ee.del=function(H){var G=this.rules.inline.del.exec(H);if(G)return{type:"del",raw:G[0],text:G[1]}},ee.autolink=function(H,G){var V=this.rules.inline.autolink.exec(H);if(V){var J,de;return V[2]==="@"?(J=le(this.options.mangle?G(V[1]):V[1]),de="mailto:"+J):(J=le(V[1]),de=J),{type:"link",raw:V[0],text:J,href:de,tokens:[{type:"text",raw:J,text:J}]}}},ee.url=function(H,G){var V;if(V=this.rules.inline.url.exec(H)){var J,de;if(V[2]==="@")J=le(this.options.mangle?G(V[0]):V[0]),de="mailto:"+J;else{var ge;do ge=V[0],V[0]=this.rules.inline._backpedal.exec(V[0])[0];while(ge!==V[0]);J=le(V[0]),V[1]==="www."?de="http://"+J:de=J}return{type:"link",raw:V[0],text:J,href:de,tokens:[{type:"text",raw:J,text:J}]}}},ee.inlineText=function(H,G,V){var J=this.rules.inline.text.exec(H);if(J){var de;return G?de=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(J[0]):le(J[0]):J[0]:de=le(this.options.smartypants?V(J[0]):J[0]),{type:"text",raw:J[0],text:de}}},ae}(),Ce=z.noopTest,_e=z.edit,Re=z.merge,he={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:Ce,table:Ce,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};he._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,he._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,he.def=_e(he.def).replace("label",he._label).replace("title",he._title).getRegex(),he.bullet=/(?:[*+-]|\d{1,9}[.)])/,he.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,he.item=_e(he.item,"gm").replace(/bull/g,he.bullet).getRegex(),he.list=_e(he.list).replace(/bull/g,he.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+he.def.source+")").getRegex(),he._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",he._comment=/<!--(?!-?>)[\s\S]*?-->/,he.html=_e(he.html,"i").replace("comment",he._comment).replace("tag",he._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),he.paragraph=_e(he._paragraph).replace("hr",he.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",he._tag).getRegex(),he.blockquote=_e(he.blockquote).replace("paragraph",he.paragraph).getRegex(),he.normal=Re({},he),he.gfm=Re({},he.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*|$)"}),he.gfm.nptable=_e(he.gfm.nptable).replace("hr",he.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",he._tag).getRegex(),he.gfm.table=_e(he.gfm.table).replace("hr",he.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",he._tag).getRegex(),he.pedantic=Re({},he.normal,{html:_e(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",he._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:Ce,paragraph:_e(he.normal._paragraph).replace("hr",he.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",he.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var Z={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Ce,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:Ce,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};Z._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",Z.punctuation=_e(Z.punctuation).replace(/punctuation/g,Z._punctuation).getRegex(),Z._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",Z._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",Z.em.start=_e(Z.em.start).replace(/punctuation/g,Z._punctuation).getRegex(),Z.em.middle=_e(Z.em.middle).replace(/punctuation/g,Z._punctuation).replace(/overlapSkip/g,Z._overlapSkip).getRegex(),Z.em.endAst=_e(Z.em.endAst,"g").replace(/punctuation/g,Z._punctuation).getRegex(),Z.em.endUnd=_e(Z.em.endUnd,"g").replace(/punctuation/g,Z._punctuation).getRegex(),Z.strong.start=_e(Z.strong.start).replace(/punctuation/g,Z._punctuation).getRegex(),Z.strong.middle=_e(Z.strong.middle).replace(/punctuation/g,Z._punctuation).replace(/blockSkip/g,Z._blockSkip).getRegex(),Z.strong.endAst=_e(Z.strong.endAst,"g").replace(/punctuation/g,Z._punctuation).getRegex(),Z.strong.endUnd=_e(Z.strong.endUnd,"g").replace(/punctuation/g,Z._punctuation).getRegex(),Z.blockSkip=_e(Z._blockSkip,"g").getRegex(),Z.overlapSkip=_e(Z._overlapSkip,"g").getRegex(),Z._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,Z._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,Z._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])?)+(?![-_])/,Z.autolink=_e(Z.autolink).replace("scheme",Z._scheme).replace("email",Z._email).getRegex(),Z._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,Z.tag=_e(Z.tag).replace("comment",he._comment).replace("attribute",Z._attribute).getRegex(),Z._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Z._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,Z._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,Z.link=_e(Z.link).replace("label",Z._label).replace("href",Z._href).replace("title",Z._title).getRegex(),Z.reflink=_e(Z.reflink).replace("label",Z._label).getRegex(),Z.reflinkSearch=_e(Z.reflinkSearch,"g").replace("reflink",Z.reflink).replace("nolink",Z.nolink).getRegex(),Z.normal=Re({},Z),Z.pedantic=Re({},Z.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:_e(/^!?\[(label)\]\((.*?)\)/).replace("label",Z._label).getRegex(),reflink:_e(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Z._label).getRegex()}),Z.gfm=Re({},Z.normal,{escape:_e(Z.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),Z.gfm.url=_e(Z.gfm.url,"i").replace("email",Z.gfm._extended_email).getRegex(),Z.breaks=Re({},Z.gfm,{br:_e(Z.br).replace("{2,}","*").getRegex(),text:_e(Z.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var je={block:he,inline:Z},lt=U.defaults,nt=je.block,Ke=je.inline;function Ge(ae){return ae.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 Pe(ae){var ee="",te,H,G=ae.length;for(te=0;te<G;te++)H=ae.charCodeAt(te),Math.random()>.5&&(H="x"+H.toString(16)),ee+="&#"+H+";";return ee}var We=function(){function ae(te){this.tokens=[],this.tokens.links=Object.create(null),this.options=te||lt,this.options.tokenizer=this.options.tokenizer||new Te,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var H={block:nt.normal,inline:Ke.normal};this.options.pedantic?(H.block=nt.pedantic,H.inline=Ke.pedantic):this.options.gfm&&(H.block=nt.gfm,this.options.breaks?H.inline=Ke.breaks:H.inline=Ke.gfm),this.tokenizer.rules=H}ae.lex=function(H,G){var V=new ae(G);return V.lex(H)};var ee=ae.prototype;return ee.lex=function(H){return H=H.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(H,this.tokens,!0),this.inline(this.tokens),this.tokens},ee.blockTokens=function(H,G,V){G===void 0&&(G=[]),V===void 0&&(V=!0),H=H.replace(/^ +$/gm,"");for(var J,de,ge,Me;H;){if(J=this.tokenizer.space(H)){H=H.substring(J.raw.length),J.type&&G.push(J);continue}if(J=this.tokenizer.code(H,G)){H=H.substring(J.raw.length),J.type?G.push(J):(Me=G[G.length-1],Me.raw+=`
`+J.raw,Me.text+=`
`+J.text);continue}if(J=this.tokenizer.fences(H)){H=H.substring(J.raw.length),G.push(J);continue}if(J=this.tokenizer.heading(H)){H=H.substring(J.raw.length),G.push(J);continue}if(J=this.tokenizer.nptable(H)){H=H.substring(J.raw.length),G.push(J);continue}if(J=this.tokenizer.hr(H)){H=H.substring(J.raw.length),G.push(J);continue}if(J=this.tokenizer.blockquote(H)){H=H.substring(J.raw.length),J.tokens=this.blockTokens(J.text,[],V),G.push(J);continue}if(J=this.tokenizer.list(H)){for(H=H.substring(J.raw.length),ge=J.items.length,de=0;de<ge;de++)J.items[de].tokens=this.blockTokens(J.items[de].text,[],!1);G.push(J);continue}if(J=this.tokenizer.html(H)){H=H.substring(J.raw.length),G.push(J);continue}if(V&&(J=this.tokenizer.def(H))){H=H.substring(J.raw.length),this.tokens.links[J.tag]||(this.tokens.links[J.tag]={href:J.href,title:J.title});continue}if(J=this.tokenizer.table(H)){H=H.substring(J.raw.length),G.push(J);continue}if(J=this.tokenizer.lheading(H)){H=H.substring(J.raw.length),G.push(J);continue}if(V&&(J=this.tokenizer.paragraph(H))){H=H.substring(J.raw.length),G.push(J);continue}if(J=this.tokenizer.text(H,G)){H=H.substring(J.raw.length),J.type?G.push(J):(Me=G[G.length-1],Me.raw+=`
`+J.raw,Me.text+=`
`+J.text);continue}if(H){var et="Infinite loop on byte: "+H.charCodeAt(0);if(this.options.silent){console.error(et);break}else throw new Error(et)}}return G},ee.inline=function(H){var G,V,J,de,ge,Me,et=H.length;for(G=0;G<et;G++){Me=H[G];switch(Me.type){case"paragraph":case"text":case"heading":{Me.tokens=[],this.inlineTokens(Me.text,Me.tokens);break}case"table":{for(Me.tokens={header:[],cells:[]},de=Me.header.length,V=0;V<de;V++)Me.tokens.header[V]=[],this.inlineTokens(Me.header[V],Me.tokens.header[V]);for(de=Me.cells.length,V=0;V<de;V++)for(ge=Me.cells[V],Me.tokens.cells[V]=[],J=0;J<ge.length;J++)Me.tokens.cells[V][J]=[],this.inlineTokens(ge[J],Me.tokens.cells[V][J]);break}case"blockquote":{this.inline(Me.tokens);break}case"list":{for(de=Me.items.length,V=0;V<de;V++)this.inline(Me.items[V].tokens);break}}}return H},ee.inlineTokens=function(H,G,V,J,de){G===void 0&&(G=[]),V===void 0&&(V=!1),J===void 0&&(J=!1),de===void 0&&(de="");var ge,Me=H,et;if(this.tokens.links){var dt=Object.keys(this.tokens.links);if(dt.length>0)for(;(et=this.tokenizer.rules.inline.reflinkSearch.exec(Me))!=null;)dt.includes(et[0].slice(et[0].lastIndexOf("[")+1,-1))&&(Me=Me.slice(0,et.index)+"["+"a".repeat(et[0].length-2)+"]"+Me.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(et=this.tokenizer.rules.inline.blockSkip.exec(Me))!=null;)Me=Me.slice(0,et.index)+"["+"a".repeat(et[0].length-2)+"]"+Me.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;H;){if(ge=this.tokenizer.escape(H)){H=H.substring(ge.raw.length),G.push(ge);continue}if(ge=this.tokenizer.tag(H,V,J)){H=H.substring(ge.raw.length),V=ge.inLink,J=ge.inRawBlock,G.push(ge);continue}if(ge=this.tokenizer.link(H)){H=H.substring(ge.raw.length),ge.type==="link"&&(ge.tokens=this.inlineTokens(ge.text,[],!0,J)),G.push(ge);continue}if(ge=this.tokenizer.reflink(H,this.tokens.links)){H=H.substring(ge.raw.length),ge.type==="link"&&(ge.tokens=this.inlineTokens(ge.text,[],!0,J)),G.push(ge);continue}if(ge=this.tokenizer.strong(H,Me,de)){H=H.substring(ge.raw.length),ge.tokens=this.inlineTokens(ge.text,[],V,J),G.push(ge);continue}if(ge=this.tokenizer.em(H,Me,de)){H=H.substring(ge.raw.length),ge.tokens=this.inlineTokens(ge.text,[],V,J),G.push(ge);continue}if(ge=this.tokenizer.codespan(H)){H=H.substring(ge.raw.length),G.push(ge);continue}if(ge=this.tokenizer.br(H)){H=H.substring(ge.raw.length),G.push(ge);continue}if(ge=this.tokenizer.del(H)){H=H.substring(ge.raw.length),ge.tokens=this.inlineTokens(ge.text,[],V,J),G.push(ge);continue}if(ge=this.tokenizer.autolink(H,Pe)){H=H.substring(ge.raw.length),G.push(ge);continue}if(!V&&(ge=this.tokenizer.url(H,Pe))){H=H.substring(ge.raw.length),G.push(ge);continue}if(ge=this.tokenizer.inlineText(H,J,Ge)){H=H.substring(ge.raw.length),de=ge.raw.slice(-1),G.push(ge);continue}if(H){var qe="Infinite loop on byte: "+H.charCodeAt(0);if(this.options.silent){console.error(qe);break}else throw new Error(qe)}}return G},N(ae,null,[{key:"rules",get:function(){return{block:nt,inline:Ke}}}]),ae}(),Qe=U.defaults,Ze=z.cleanUrl,$e=z.escape,Ue=function(){function ae(te){this.options=te||Qe}var ee=ae.prototype;return ee.code=function(H,G,V){var J=(G||"").match(/\S*/)[0];if(this.options.highlight){var de=this.options.highlight(H,J);de!=null&&de!==H&&(V=!0,H=de)}return J?'<pre><code class="'+this.options.langPrefix+$e(J,!0)+'">'+(V?H:$e(H,!0))+`</code></pre>
`:"<pre><code>"+(V?H:$e(H,!0))+`</code></pre>
`},ee.blockquote=function(H){return`<blockquote>
`+H+`</blockquote>
`},ee.html=function(H){return H},ee.heading=function(H,G,V,J){return this.options.headerIds?"<h"+G+' id="'+this.options.headerPrefix+J.slug(V)+'">'+H+"</h"+G+`>
`:"<h"+G+">"+H+"</h"+G+`>
`},ee.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},ee.list=function(H,G,V){var J=G?"ol":"ul",de=G&&V!==1?' start="'+V+'"':"";return"<"+J+de+`>
`+H+"</"+J+`>
`},ee.listitem=function(H){return"<li>"+H+`</li>
`},ee.checkbox=function(H){return"<input "+(H?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ee.paragraph=function(H){return"<p>"+H+`</p>
`},ee.table=function(H,G){return G&&(G="<tbody>"+G+"</tbody>"),`<table>
<thead>
`+H+`</thead>
`+G+`</table>
`},ee.tablerow=function(H){return`<tr>
`+H+`</tr>
`},ee.tablecell=function(H,G){var V=G.header?"th":"td",J=G.align?"<"+V+' align="'+G.align+'">':"<"+V+">";return J+H+"</"+V+`>
`},ee.strong=function(H){return"<strong>"+H+"</strong>"},ee.em=function(H){return"<em>"+H+"</em>"},ee.codespan=function(H){return"<code>"+H+"</code>"},ee.br=function(){return this.options.xhtml?"<br/>":"<br>"},ee.del=function(H){return"<del>"+H+"</del>"},ee.link=function(H,G,V){if(H=Ze(this.options.sanitize,this.options.baseUrl,H),H===null)return V;var J='<a href="'+$e(H)+'"';return G&&(J+=' title="'+G+'"'),J+=">"+V+"</a>",J},ee.image=function(H,G,V){if(H=Ze(this.options.sanitize,this.options.baseUrl,H),H===null)return V;var J='<img src="'+H+'" alt="'+V+'"';return G&&(J+=' title="'+G+'"'),J+=this.options.xhtml?"/>":">",J},ee.text=function(H){return H},ae}(),Fe=function(){function ae(){}var ee=ae.prototype;return ee.strong=function(H){return H},ee.em=function(H){return H},ee.codespan=function(H){return H},ee.del=function(H){return H},ee.html=function(H){return H},ee.text=function(H){return H},ee.link=function(H,G,V){return""+V},ee.image=function(H,G,V){return""+V},ee.br=function(){return""},ae}(),ct=function(){function ae(){this.seen={}}var ee=ae.prototype;return ee.slug=function(H){var G=H.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(G)){var V=G;do this.seen[V]++,G=V+"-"+this.seen[V];while(this.seen.hasOwnProperty(G))}return this.seen[G]=0,G},ae}(),ot=U.defaults,st=z.unescape,rt=function(){function ae(te){this.options=te||ot,this.options.renderer=this.options.renderer||new Ue,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Fe,this.slugger=new ct}ae.parse=function(H,G){var V=new ae(G);return V.parse(H)};var ee=ae.prototype;return ee.parse=function(H,G){G===void 0&&(G=!0);var V="",J,de,ge,Me,et,dt,qe,Ct,_t,at,It,At,Ot,Wt,gt,Bt,Nt,Je,Yt=H.length;for(J=0;J<Yt;J++){at=H[J];switch(at.type){case"space":continue;case"hr":{V+=this.renderer.hr();continue}case"heading":{V+=this.renderer.heading(this.parseInline(at.tokens),at.depth,st(this.parseInline(at.tokens,this.textRenderer)),this.slugger);continue}case"code":{V+=this.renderer.code(at.text,at.lang,at.escaped);continue}case"table":{for(Ct="",qe="",Me=at.header.length,de=0;de<Me;de++)qe+=this.renderer.tablecell(this.parseInline(at.tokens.header[de]),{header:!0,align:at.align[de]});for(Ct+=this.renderer.tablerow(qe),_t="",Me=at.cells.length,de=0;de<Me;de++){for(dt=at.tokens.cells[de],qe="",et=dt.length,ge=0;ge<et;ge++)qe+=this.renderer.tablecell(this.parseInline(dt[ge]),{header:!1,align:at.align[ge]});_t+=this.renderer.tablerow(qe)}V+=this.renderer.table(Ct,_t);continue}case"blockquote":{_t=this.parse(at.tokens),V+=this.renderer.blockquote(_t);continue}case"list":{for(It=at.ordered,At=at.start,Ot=at.loose,Me=at.items.length,_t="",de=0;de<Me;de++)gt=at.items[de],Bt=gt.checked,Nt=gt.task,Wt="",gt.task&&(Je=this.renderer.checkbox(Bt),Ot?gt.tokens.length>0&&gt.tokens[0].type==="text"?(gt.tokens[0].text=Je+" "+gt.tokens[0].text,gt.tokens[0].tokens&&gt.tokens[0].tokens.length>0&&gt.tokens[0].tokens[0].type==="text"&&(gt.tokens[0].tokens[0].text=Je+" "+gt.tokens[0].tokens[0].text)):gt.tokens.unshift({type:"text",text:Je}):Wt+=Je),Wt+=this.parse(gt.tokens,Ot),_t+=this.renderer.listitem(Wt,Nt,Bt);V+=this.renderer.list(_t,It,At);continue}case"html":{V+=this.renderer.html(at.text);continue}case"paragraph":{V+=this.renderer.paragraph(this.parseInline(at.tokens));continue}case"text":{for(_t=at.tokens?this.parseInline(at.tokens):at.text;J+1<Yt&&H[J+1].type==="text";)at=H[++J],_t+=`
`+(at.tokens?this.parseInline(at.tokens):at.text);V+=G?this.renderer.paragraph(_t):_t;continue}default:{var or='Token with "'+at.type+'" type was not found.';if(this.options.silent){console.error(or);return}else throw new Error(or)}}}return V},ee.parseInline=function(H,G){G=G||this.renderer;var V="",J,de,ge=H.length;for(J=0;J<ge;J++){de=H[J];switch(de.type){case"escape":{V+=G.text(de.text);break}case"html":{V+=G.html(de.text);break}case"link":{V+=G.link(de.href,de.title,this.parseInline(de.tokens,G));break}case"image":{V+=G.image(de.href,de.title,de.text);break}case"strong":{V+=G.strong(this.parseInline(de.tokens,G));break}case"em":{V+=G.em(this.parseInline(de.tokens,G));break}case"codespan":{V+=G.codespan(de.text);break}case"br":{V+=G.br();break}case"del":{V+=G.del(this.parseInline(de.tokens,G));break}case"text":{V+=G.text(de.text);break}default:{var Me='Token with "'+de.type+'" type was not found.';if(this.options.silent){console.error(Me);return}else throw new Error(Me)}}}return V},ae}(),ht=z.merge,ut=z.checkSanitizeDeprecation,fe=z.escape,be=U.getDefaults,we=U.changeDefaults,ke=U.defaults;function xe(ae,ee,te){if(typeof ae=="undefined"||ae===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ae!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ae)+", string expected");if(typeof ee=="function"&&(te=ee,ee=null),ee=ht({},xe.defaults,ee||{}),ut(ee),te){var H=ee.highlight,G;try{G=We.lex(ae,ee)}catch(ge){return te(ge)}var V=function(Me){var et;if(!Me)try{et=rt.parse(G,ee)}catch(dt){Me=dt}return ee.highlight=H,Me?te(Me):te(null,et)};if(!H||H.length<3)return V();if(delete ee.highlight,!G.length)return V();var J=0;xe.walkTokens(G,function(ge){ge.type==="code"&&(J++,setTimeout(function(){H(ge.text,ge.lang,function(Me,et){if(Me)return V(Me);et!=null&&et!==ge.text&&(ge.text=et,ge.escaped=!0),J--,J===0&&V()})},0))}),J===0&&V();return}try{var de=We.lex(ae,ee);return ee.walkTokens&&xe.walkTokens(de,ee.walkTokens),rt.parse(de,ee)}catch(ge){if(ge.message+=`
Please report this to https://github.com/markedjs/marked.`,ee.silent)return"<p>An error occurred:</p><pre>"+fe(ge.message+"",!0)+"</pre>";throw ge}}xe.options=xe.setOptions=function(ae){return ht(xe.defaults,ae),we(xe.defaults),xe},xe.getDefaults=be,xe.defaults=ke,xe.use=function(ae){var ee=ht({},ae);if(ae.renderer&&function(){var H=xe.defaults.renderer||new Ue,G=function(de){var ge=H[de];H[de]=function(){for(var Me=arguments.length,et=new Array(Me),dt=0;dt<Me;dt++)et[dt]=arguments[dt];var qe=ae.renderer[de].apply(H,et);return qe===!1&&(qe=ge.apply(H,et)),qe}};for(var V in ae.renderer)G(V);ee.renderer=H}(),ae.tokenizer&&function(){var H=xe.defaults.tokenizer||new Te,G=function(de){var ge=H[de];H[de]=function(){for(var Me=arguments.length,et=new Array(Me),dt=0;dt<Me;dt++)et[dt]=arguments[dt];var qe=ae.tokenizer[de].apply(H,et);return qe===!1&&(qe=ge.apply(H,et)),qe}};for(var V in ae.tokenizer)G(V);ee.tokenizer=H}(),ae.walkTokens){var te=xe.defaults.walkTokens;ee.walkTokens=function(H){ae.walkTokens(H),te&&te(H)}}xe.setOptions(ee)},xe.walkTokens=function(ae,ee){for(var te=g(ae),H;!(H=te()).done;){var G=H.value;ee(G);switch(G.type){case"table":{for(var V=g(G.tokens.header),J;!(J=V()).done;){var de=J.value;xe.walkTokens(de,ee)}for(var ge=g(G.tokens.cells),Me;!(Me=ge()).done;)for(var et=Me.value,dt=g(et),qe;!(qe=dt()).done;){var Ct=qe.value;xe.walkTokens(Ct,ee)}break}case"list":{xe.walkTokens(G.items,ee);break}default:G.tokens&&xe.walkTokens(G.tokens,ee)}}},xe.Parser=rt,xe.parser=rt.parse,xe.Renderer=Ue,xe.TextRenderer=Fe,xe.Lexer=We,xe.lexer=We.lex,xe.Tokenizer=Te,xe.Slugger=ct,xe.parse=xe;var Oe=xe;return Oe})},IBYe:function(ft,ze,K){"use strict";function oe(N){return null}ze.a=oe},LdHM:function(ft,ze,K){"use strict";K.d(ze,"b",function(){return s}),K.d(ze,"a",function(){return d});var oe=K("1OyB"),N=K("vuIU"),S=K("Ji7U"),I=K("LK+K"),g=K("q1tI"),E=K("rePB"),U=K("Ff2n"),M=K("ODXe"),R=K("4IlW"),w=K("bX4T"),x=K("YrtM"),T=K("TSYQ"),O=K.n(T),C=K("+nKL"),b=K("8OUc"),v=function(X,le){var ye=X.prefixCls,ve=X.id,Ne=X.flattenOptions,Te=X.childrenAsData,Ce=X.values,_e=X.searchValue,Re=X.multiple,he=X.defaultActiveFirstOption,Z=X.height,je=X.itemHeight,lt=X.notFoundContent,nt=X.open,Ke=X.menuItemSelectedIcon,Ge=X.virtual,Pe=X.onSelect,We=X.onToggleOpen,Qe=X.onActiveValue,Ze=X.onScroll,$e=X.onMouseEnter,Ue="".concat(ye,"-item"),Fe=Object(x.a)(function(){return Ne},[nt,Ne],function(Oe,ae){return ae[0]&&Oe[1]!==ae[1]}),ct=g.useRef(null),ot=function(ae){ae.preventDefault()},st=function(ae){ct.current&&ct.current.scrollTo({index:ae})},rt=function(ae){for(var ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,te=Fe.length,H=0;H<te;H+=1){var G=(ae+H*ee+te)%te,V=Fe[G],J=V.group,de=V.data;if(!J&&!de.disabled)return G}return-1},ht=g.useState(function(){return rt(0)}),ut=Object(M.a)(ht,2),fe=ut[0],be=ut[1],we=function(ae){be(ae);var ee=Fe[ae];if(!ee){Qe(null,-1);return}Qe(ee.data.value,ae)};g.useEffect(function(){we(he!==!1?rt(0):-1)},[Fe.length,_e]),g.useEffect(function(){var Oe=setTimeout(function(){if(!Re&&nt&&Ce.size===1){var ae=Array.from(Ce)[0],ee=Fe.findIndex(function(te){var H=te.data;return H.value===ae});we(ee),st(ee)}});return function(){return clearTimeout(Oe)}},[nt]);var ke=function(ae){ae!==void 0&&Pe(ae,{selected:!Ce.has(ae)}),Re||We(!1)};if(g.useImperativeHandle(le,function(){return{onKeyDown:function(ae){var ee=ae.which;switch(ee){case R.a.UP:case R.a.DOWN:{var te=0;if(ee===R.a.UP?te=-1:ee===R.a.DOWN&&(te=1),te!==0){var H=rt(fe+te,te);st(H),we(H)}break}case R.a.ENTER:{var G=Fe[fe];G&&!G.data.disabled?ke(G.data.value):ke(void 0),nt&&ae.preventDefault();break}case R.a.ESC:We(!1)}},onKeyUp:function(){},scrollTo:function(ae){st(ae)}}}),Fe.length===0)return g.createElement("div",{role:"listbox",id:"".concat(ve,"_list"),className:"".concat(Ue,"-empty"),onMouseDown:ot},lt);function xe(Oe){var ae=Fe[Oe];if(!ae)return null;var ee=ae.data||{},te=ee.value,H=ee.label,G=ee.children,V=Object(w.a)(ee,!0),J=Te?G:H;return ae?g.createElement("div",Object.assign({"aria-label":typeof J=="string"?J:null},V,{key:Oe,role:"option",id:"".concat(ve,"_list_").concat(Oe),"aria-selected":Ce.has(te)}),te):null}return g.createElement(g.Fragment,null,g.createElement("div",{role:"listbox",id:"".concat(ve,"_list"),style:{height:0,width:0,overflow:"hidden"}},xe(fe-1),xe(fe),xe(fe+1)),g.createElement(C.a,{itemKey:"key",ref:ct,data:Fe,height:Z,itemHeight:je,fullHeight:!1,onMouseDown:ot,onScroll:Ze,virtual:Ge,onMouseEnter:$e},function(Oe,ae){var ee,te=Oe.group,H=Oe.groupOption,G=Oe.data,V=G.label,J=G.key;if(te)return g.createElement("div",{className:O()(Ue,"".concat(Ue,"-group"))},V!==void 0?V:J);var de=G.disabled,ge=G.value,Me=G.title,et=G.children,dt=G.style,qe=G.className,Ct=Object(U.a)(G,["disabled","value","title","children","style","className"]),_t=Ce.has(ge),at="".concat(Ue,"-option"),It=O()(Ue,at,qe,(ee={},Object(E.a)(ee,"".concat(at,"-grouped"),H),Object(E.a)(ee,"".concat(at,"-active"),fe===ae&&!de),Object(E.a)(ee,"".concat(at,"-disabled"),de),Object(E.a)(ee,"".concat(at,"-selected"),_t),ee)),At=Te?et:V,Ot=!Ke||typeof Ke=="function"||_t;return g.createElement("div",Object.assign({},Ct,{"aria-selected":_t,className:It,title:Me,onMouseMove:function(){if(fe===ae||de)return;we(ae)},onClick:function(){de||ke(ge)},style:dt}),g.createElement("div",{className:"".concat(at,"-content")},At||ge),g.isValidElement(Ke)||_t,Ot&&g.createElement(b.a,{className:"".concat(Ue,"-option-state"),customizeIcon:Ke,customizeIconProps:{isSelected:_t}},_t?"\u2713":null))}))},h=g.forwardRef(v);h.displayName="OptionList";var r=h,o=function(){return null};o.isSelectOption=!0;var s=o,f=function(){return null};f.isSelectOptGroup=!0;var d=f,l=K("VTBJ"),p=K("Zm9Q");function c(Y){var X=Y.key,le=Y.props,ye=le.children,ve=le.value,Ne=Object(U.a)(le,["children","value"]);return Object(l.a)({key:X,value:ve!==void 0?ve:X,children:ye},Ne)}function i(Y){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(p.a)(Y).map(function(le,ye){if(!g.isValidElement(le)||!le.type)return null;var ve=le.type.isSelectOptGroup,Ne=le.key,Te=le.props,Ce=Te.children,_e=Object(U.a)(Te,["children"]);return X||!ve?c(le):Object(l.a)(Object(l.a)({key:"__RC_SELECT_GRP__".concat(Ne===null?ye:Ne,"__"),label:Ne},_e),{},{options:i(Ce)})}).filter(function(le){return le})}var n=K("2Qr1"),t=K("qNPg"),e=K("U8pU"),m=K("Kwbf"),y=K("WKfj");function _(Y){var X=Y.mode,le=Y.options,ye=Y.children,ve=Y.backfill,Ne=Y.allowClear,Te=Y.placeholder,Ce=Y.getInputElement,_e=Y.showSearch,Re=Y.onSearch,he=Y.defaultOpen,Z=Y.autoFocus,je=Y.labelInValue,lt=Y.value,nt=Y.inputValue,Ke=Y.optionLabelProp,Ge=X==="multiple"||X==="tags",Pe=_e!==void 0?_e:Ge||X==="combobox",We=le||i(ye);if(Object(m.a)(X!=="tags"||We.every(function(Ue){return!Ue.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),X==="tags"||X==="combobox"){var Qe=We.some(function(Ue){return Ue.options?Ue.options.some(function(Fe){return typeof("value"in Fe?Fe.value:Fe.key)=="number"}):typeof("value"in Ue?Ue.value:Ue.key)=="number"});Object(m.a)(!Qe,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(m.a)(X!=="combobox"||!Ke,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(m.a)(X==="combobox"||!ve,"`backfill` only works with `combobox` mode."),Object(m.a)(X==="combobox"||!Ce,"`getInputElement` only work with `combobox` mode."),Object(m.b)(X!=="combobox"||!Ce||!Ne||!Te,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Re&&!Pe&&X!=="combobox"&&X!=="tags"&&Object(m.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(m.b)(!he||Z,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),lt!=null){var Ze=Object(y.d)(lt);Object(m.a)(!je||Ze.every(function(Ue){return Object(e.a)(Ue)==="object"&&("key"in Ue||"value"in Ue)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(m.a)(!Ge||Array.isArray(lt),"`value` should be array when `mode` is `multiple` or `tags`")}if(ye){var $e=null;Object(p.a)(ye).some(function(Ue){if(!g.isValidElement(Ue)||!Ue.type)return!1;var Fe=Ue.type;if(Fe.isSelectOption)return!1;if(Fe.isSelectOptGroup){var ct=Object(p.a)(Ue.props.children).every(function(ot){return!g.isValidElement(ot)||!Ue.type||ot.type.isSelectOption?!0:($e=ot.type,!1)});return!ct}return $e=Fe,!0}),$e&&Object(m.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat($e.displayName||$e.name||$e,"`.")),Object(m.a)(nt===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var A=_,k=Object(t.a)({prefixCls:"rc-select",components:{optionList:r},convertChildrenToData:i,flattenOptions:n.d,getLabeledValue:n.e,filterOptions:n.b,isValueDisabled:n.g,findValueOption:n.c,warningProps:A,fillOptionsWithMissingValue:n.a}),F=function(Y){Object(S.a)(le,Y);var X=Object(I.a)(le);function le(){var ye;return Object(oe.a)(this,le),ye=X.apply(this,arguments),ye.selectRef=g.createRef(),ye.focus=function(){ye.selectRef.current.focus()},ye.blur=function(){ye.selectRef.current.blur()},ye}return Object(N.a)(le,[{key:"render",value:function(){return g.createElement(k,Object.assign({ref:this.selectRef},this.props))}}]),le}(g.Component);F.Option=s,F.OptGroup=d;var z=F,Q=ze.c=z},NvD2:function(ft,ze,K){"use strict";K.d(ze,"a",function(){return E});var oe=K("Kwbf");function N(U,M){var R=new Set;return U.forEach(function(w){M.has(w)||R.add(w)}),R}function S(U){var M=U||{},R=M.disabled,w=M.disableCheckbox,x=M.checkable;return!!(R||w)||x===!1}function I(U,M,R,w){for(var x=new Set(U),T=new Set,O=0;O<=R;O+=1){var C=M.get(O)||new Set;C.forEach(function(r){var o=r.key,s=r.node,f=r.children,d=f===void 0?[]:f;x.has(o)&&!w(s)&&d.filter(function(l){return!w(l.node)}).forEach(function(l){x.add(l.key)})})}for(var b=new Set,v=R;v>=0;v-=1){var h=M.get(v)||new Set;h.forEach(function(r){var o=r.parent,s=r.node;if(w(s)||!r.parent||b.has(r.parent.key))return;if(w(r.parent.node)){b.add(o.key);return}var f=!0,d=!1;(o.children||[]).filter(function(l){return!w(l.node)}).forEach(function(l){var p=l.key,c=x.has(p);f&&!c&&(f=!1),!d&&(c||T.has(p))&&(d=!0)}),f&&x.add(o.key),d&&T.add(o.key),b.add(o.key)})}return{checkedKeys:Array.from(x),halfCheckedKeys:Array.from(N(T,x))}}function g(U,M,R,w,x){for(var T=new Set(U),O=new Set(M),C=0;C<=w;C+=1){var b=R.get(C)||new Set;b.forEach(function(o){var s=o.key,f=o.node,d=o.children,l=d===void 0?[]:d;!T.has(s)&&!O.has(s)&&!x(f)&&l.filter(function(p){return!x(p.node)}).forEach(function(p){T.delete(p.key)})})}O=new Set;for(var v=new Set,h=w;h>=0;h-=1){var r=R.get(h)||new Set;r.forEach(function(o){var s=o.parent,f=o.node;if(x(f)||!o.parent||v.has(o.parent.key))return;if(x(o.parent.node)){v.add(s.key);return}var d=!0,l=!1;(s.children||[]).filter(function(p){return!x(p.node)}).forEach(function(p){var c=p.key,i=T.has(c);d&&!i&&(d=!1),!l&&(i||O.has(c))&&(l=!0)}),d||T.delete(s.key),l&&O.add(s.key),v.add(s.key)})}return{checkedKeys:Array.from(T),halfCheckedKeys:Array.from(N(O,T))}}function E(U,M,R,w){var x=[],T;w?T=w:T=S;var O=new Set(U.filter(function(h){var r=!!R[h];return r||x.push(h),r})),C=new Map,b=0;Object.keys(R).forEach(function(h){var r=R[h],o=r.level,s=C.get(o);s||(s=new Set,C.set(o,s)),s.add(r),b=Math.max(b,o)}),Object(oe.a)(!x.length,"Tree missing follow keys: ".concat(x.slice(0,100).map(function(h){return"'".concat(h,"'")}).join(", ")));var v;return M===!0?v=I(O,C,b,T):v=g(O,M.halfCheckedKeys,C,b,T),v}},OZM5:function(ft,ze,K){"use strict";K.d(ze,"b",function(){return w}),K.d(ze,"a",function(){return x}),K.d(ze,"k",function(){return T}),K.d(ze,"h",function(){return O}),K.d(ze,"i",function(){return C}),K.d(ze,"g",function(){return b}),K.d(ze,"c",function(){return v}),K.d(ze,"d",function(){return h}),K.d(ze,"j",function(){return s}),K.d(ze,"e",function(){return f}),K.d(ze,"f",function(){return d});var oe=K("KQm4"),N=K("U8pU"),S=K("Ff2n"),I=K("q1tI"),g=K.n(I),E=K("Kwbf"),U=K("WaYH"),M=.25,R=2;function w(l,p){var c=l.slice(),i=c.indexOf(p);return i>=0&&c.splice(i,1),c}function x(l,p){var c=l.slice();return c.indexOf(p)===-1&&c.push(p),c}function T(l){return l.split("-")}function O(l,p){return"".concat(l,"-").concat(p)}function C(l){return l&&l.type&&l.type.isTreeNode}function b(l,p){var c=[l],i=p[l];function n(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];t.forEach(function(e){var m=e.key,y=e.children;c.push(m),n(y)})}return n(i.children),c}function v(l,p){var c=l.clientY,i=p.selectHandle.getBoundingClientRect(),n=i.top,t=i.bottom,e=i.height,m=Math.max(e*M,R);return c<=n+m?-1:c>=t-m?1:0}function h(l,p){if(!l)return;var c=p.multiple;return c?l.slice():l.length?[l[0]]:l}var r=function(p){return p};function o(l,p){if(!l)return[];var c=p||{},i=c.processProps,n=i===void 0?r:i,t=Array.isArray(l)?l:[l];return t.map(function(e){var m=e.children,y=Object(S.a)(e,["children"]),_=o(m,p);return g.a.createElement(U.a,Object.assign({},n(y)),_)})}function s(l){if(!l)return null;var p;if(Array.isArray(l))p={checkedKeys:l,halfCheckedKeys:void 0};else if(Object(N.a)(l)==="object")p={checkedKeys:l.checked||void 0,halfCheckedKeys:l.halfChecked||void 0};else return Object(E.a)(!1,"`checkedKeys` is not an array or an object"),null;return p}function f(l,p){var c=new Set;function i(n){if(c.has(n))return;var t=p[n];if(!t)return;c.add(n);var e=t.parent,m=t.node;if(m.disabled)return;e&&i(e.key)}return(l||[]).forEach(function(n){i(n)}),Object(oe.a)(c)}function d(l){var p={};return Object.keys(l).forEach(function(c){(c.startsWith("data-")||c.startsWith("aria-"))&&(p[c]=l[c])}),p}},"SA+Z":function(ft,ze,K){var oe=K("wTVA"),N=K("EbDI"),S=K("ZhPi"),I=K("wkBT");function g(E){return oe(E)||N(E)||S(E)||I()}ft.exports=g,ft.exports.__esModule=!0,ft.exports.default=ft.exports},SJMd:function(ft,ze){/**
* @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 K,oe,N,S=!1,I,g;window.PR_SHOULD_USE_CONTINUATION=!0;var E,U;(function(){var M=window,R=["break,continue,do,else,for,if,return,while"],w=[R,"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"],x=[w,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],T=[x,"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"],O=[x,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],C=[x,"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"],b="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",v=[x,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],h="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",r=[R,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],o=[R,"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"],s=[R,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],f=[T,C,O,v,h,r,o,s],d=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,l="str",p="kwd",c="com",i="typ",n="lit",t="pun",e="pln",m="tag",y="dec",_="src",A="atn",k="atv",F="nocode",z="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function Q(Pe){for(var We=0,Qe=!1,Ze=!1,$e=0,Ue=Pe.length;$e<Ue;++$e){var Fe=Pe[$e];if(Fe.ignoreCase)Ze=!0;else if(/[a-z]/i.test(Fe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Qe=!0,Ze=!1;break}}var ct={b:8,t:9,n:10,v:11,f:12,r:13};function ot(fe){var be=fe.charCodeAt(0);if(be!==92)return be;var we=fe.charAt(1);return be=ct[we],be||("0"<=we&&we<="7"?parseInt(fe.substring(1),8):we==="u"||we==="x"?parseInt(fe.substring(2),16):fe.charCodeAt(1))}function st(fe){if(fe<32)return(fe<16?"\\x0":"\\x")+fe.toString(16);var be=String.fromCharCode(fe);return be==="\\"||be==="-"||be==="]"||be==="^"?"\\"+be:be}function rt(fe){var be=fe.substring(1,fe.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")),we=[],ke=be[0]==="^",xe=["["];ke&&xe.push("^");for(var Oe=ke?1:0,ae=be.length;Oe<ae;++Oe){var ee=be[Oe];if(/\\[bdsw]/i.test(ee))xe.push(ee);else{var te=ot(ee),H;Oe+2<ae&&be[Oe+1]==="-"?(H=ot(be[Oe+2]),Oe+=2):H=te,we.push([te,H]),H<65||te>122||(H<65||te>90||we.push([Math.max(65,te)|32,Math.min(H,90)|32]),H<97||te>122||we.push([Math.max(97,te)&~32,Math.min(H,122)&~32]))}}we.sort(function(de,ge){return de[0]-ge[0]||ge[1]-de[1]});for(var G=[],V=[],Oe=0;Oe<we.length;++Oe){var J=we[Oe];J[0]<=V[1]+1?V[1]=Math.max(V[1],J[1]):G.push(V=J)}for(var Oe=0;Oe<G.length;++Oe){var J=G[Oe];xe.push(st(J[0])),J[1]>J[0]&&(J[1]+1>J[0]&&xe.push("-"),xe.push(st(J[1])))}return xe.push("]"),xe.join("")}function ht(fe){for(var be=fe.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")),we=be.length,ke=[],xe=0,Oe=0;xe<we;++xe){var ae=be[xe];if(ae==="(")++Oe;else if(ae.charAt(0)==="\\"){var ee=+ae.substring(1);ee&&(ee<=Oe?ke[ee]=-1:be[xe]=st(ee))}}for(var xe=1;xe<ke.length;++xe)ke[xe]===-1&&(ke[xe]=++We);for(var xe=0,Oe=0;xe<we;++xe){var ae=be[xe];if(ae==="(")++Oe,ke[Oe]||(be[xe]="(?:");else if(ae.charAt(0)==="\\"){var ee=+ae.substring(1);ee&&ee<=Oe&&(be[xe]="\\"+ke[ee])}}for(var xe=0;xe<we;++xe)be[xe]==="^"&&be[xe+1]!=="^"&&(be[xe]="");if(fe.ignoreCase&&Qe)for(var xe=0;xe<we;++xe){var ae=be[xe],te=ae.charAt(0);ae.length>=2&&te==="["?be[xe]=rt(ae):te!=="\\"&&(be[xe]=ae.replace(/[a-zA-Z]/g,function(V){var J=V.charCodeAt(0);return"["+String.fromCharCode(J&~32,J|32)+"]"}))}return be.join("")}for(var ut=[],$e=0,Ue=Pe.length;$e<Ue;++$e){var Fe=Pe[$e];if(Fe.global||Fe.multiline)throw new Error(""+Fe);ut.push("(?:"+ht(Fe)+")")}return new RegExp(ut.join("|"),Ze?"gi":"g")}function Y(Pe,We){var Qe=/(?:^|\s)nocode(?:\s|$)/,Ze=[],$e=0,Ue=[],Fe=0;function ct(ot){var st=ot.nodeType;if(st==1){if(Qe.test(ot.className))return;for(var rt=ot.firstChild;rt;rt=rt.nextSibling)ct(rt);var ht=ot.nodeName.toLowerCase();(ht==="br"||ht==="li")&&(Ze[Fe]=`
`,Ue[Fe<<1]=$e++,Ue[Fe++<<1|1]=ot)}else if(st==3||st==4){var ut=ot.nodeValue;ut.length&&(We?ut=ut.replace(/\r\n?/g,`
`):ut=ut.replace(/[ \t\r\n]+/g," "),Ze[Fe]=ut,Ue[Fe<<1]=$e,$e+=ut.length,Ue[Fe++<<1|1]=ot)}}return ct(Pe),{sourceCode:Ze.join("").replace(/\n$/,""),spans:Ue}}function X(Pe,We,Qe,Ze,$e){if(!Qe)return;var Ue={sourceNode:Pe,pre:1,langExtension:null,numberLines:null,sourceCode:Qe,spans:null,basePos:We,decorations:null};Ze(Ue),$e.push.apply($e,Ue.decorations)}var le=/\S/;function ye(Pe){for(var We=void 0,Qe=Pe.firstChild;Qe;Qe=Qe.nextSibling){var Ze=Qe.nodeType;We=Ze===1?We?Pe:Qe:Ze===3&&le.test(Qe.nodeValue)?Pe:We}return We===Pe?void 0:We}function ve(Pe,We){var Qe={},Ze;(function(){for(var Fe=Pe.concat(We),ct=[],ot={},st=0,rt=Fe.length;st<rt;++st){var ht=Fe[st],ut=ht[3];if(ut)for(var fe=ut.length;--fe>=0;)Qe[ut.charAt(fe)]=ht;var be=ht[1],we=""+be;ot.hasOwnProperty(we)||(ct.push(be),ot[we]=null)}ct.push(/[\0-\uffff]/),Ze=Q(ct)})();var $e=We.length,Ue=function(Fe){for(var ct=Fe.sourceCode,ot=Fe.basePos,st=Fe.sourceNode,rt=[ot,e],ht=0,ut=ct.match(Ze)||[],fe={},be=0,we=ut.length;be<we;++be){var ke=ut[be],xe=fe[ke],Oe=void 0,ae;if(typeof xe=="string")ae=!1;else{var ee=Qe[ke.charAt(0)];if(ee)Oe=ke.match(ee[1]),xe=ee[0];else{for(var te=0;te<$e;++te)if(ee=We[te],Oe=ke.match(ee[1]),Oe){xe=ee[0];break}Oe||(xe=e)}ae=xe.length>=5&&xe.substring(0,5)==="lang-",ae&&!(Oe&&typeof Oe[1]=="string")&&(ae=!1,xe=_),ae||(fe[ke]=xe)}var H=ht;if(ht+=ke.length,!ae)rt.push(ot+H,xe);else{var G=Oe[1],V=ke.indexOf(G),J=V+G.length;Oe[2]&&(J=ke.length-Oe[2].length,V=J-G.length);var de=xe.substring(5);X(st,ot+H,ke.substring(0,V),Ue,rt),X(st,ot+H+V,G,Z(de,G),rt),X(st,ot+H+J,ke.substring(J),Ue,rt)}}Fe.decorations=rt};return Ue}function Ne(Pe){var We=[],Qe=[];Pe.tripleQuotedStrings?We.push([l,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Pe.multiLineStrings?We.push([l,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):We.push([l,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Pe.verbatimStrings&&Qe.push([l,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Ze=Pe.hashComments;Ze&&(Pe.cStyleComments?(Ze>1?We.push([c,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):We.push([c,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Qe.push([l,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):We.push([c,/^#[^\r\n]*/,null,"#"])),Pe.cStyleComments&&(Qe.push([c,/^\/\/[^\r\n]*/,null]),Qe.push([c,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var $e=Pe.regexLiterals;if($e){var Ue=$e>1?"":`
\r`,Fe=Ue?".":"[\\S\\s]",ct="/(?=[^/*"+Ue+"])(?:[^/\\x5B\\x5C"+Ue+"]|\\x5C"+Fe+"|\\x5B(?:[^\\x5C\\x5D"+Ue+"]|\\x5C"+Fe+")*(?:\\x5D|$))+/";Qe.push(["lang-regex",RegExp("^"+z+"("+ct+")")])}var ot=Pe.types;ot&&Qe.push([i,ot]);var st=(""+Pe.keywords).replace(/^ | $/g,"");st.length&&Qe.push([p,new RegExp("^(?:"+st.replace(/[\s,]+/g,"|")+")\\b"),null]),We.push([e,/^\s+/,null,` \r
\xA0`]);var rt="^.[^\\s\\w.$@'\"`/\\\\]*";return Pe.regexLiterals&&(rt+="(?!s*/)"),Qe.push([n,/^@[a-z_$][a-z_$@0-9]*/i,null],[i,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[e,/^[a-z_$][a-z_$@0-9]*/i,null],[n,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[e,/^\\[\s\S]?/,null],[t,new RegExp(rt),null]),ve(We,Qe)}var Te=Ne({keywords:f,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Ce(Pe,We,Qe){for(var Ze=/(?:^|\s)nocode(?:\s|$)/,$e=/\r\n?|\n/,Ue=Pe.ownerDocument,Fe=Ue.createElement("li");Pe.firstChild;)Fe.appendChild(Pe.firstChild);var ct=[Fe];function ot(be){var we=be.nodeType;if(we==1&&!Ze.test(be.className))if(be.nodeName==="br")st(be),be.parentNode&&be.parentNode.removeChild(be);else for(var ke=be.firstChild;ke;ke=ke.nextSibling)ot(ke);else if((we==3||we==4)&&Qe){var xe=be.nodeValue,Oe=xe.match($e);if(Oe){var ae=xe.substring(0,Oe.index);be.nodeValue=ae;var ee=xe.substring(Oe.index+Oe[0].length);if(ee){var te=be.parentNode;te.insertBefore(Ue.createTextNode(ee),be.nextSibling)}st(be),ae||be.parentNode.removeChild(be)}}}function st(be){for(;!be.nextSibling;)if(be=be.parentNode,!be)return;function we(Oe,ae){var ee=ae?Oe.cloneNode(!1):Oe,te=Oe.parentNode;if(te){var H=we(te,1),G=Oe.nextSibling;H.appendChild(ee);for(var V=G;V;V=G)G=V.nextSibling,H.appendChild(V)}return ee}for(var ke=we(be.nextSibling,0),xe;(xe=ke.parentNode)&&xe.nodeType===1;)ke=xe;ct.push(ke)}for(var rt=0;rt<ct.length;++rt)ot(ct[rt]);We===(We|0)&&ct[0].setAttribute("value",We);var ht=Ue.createElement("ol");ht.className="linenums";for(var ut=Math.max(0,We-1|0)||0,rt=0,fe=ct.length;rt<fe;++rt)Fe=ct[rt],Fe.className="L"+(rt+ut)%10,Fe.firstChild||Fe.appendChild(Ue.createTextNode("\xA0")),ht.appendChild(Fe);Pe.appendChild(ht)}function _e(Pe){var We=/\bMSIE\s(\d+)/.exec(navigator.userAgent);We=We&&+We[1]<=8;var Qe=/\n/g,Ze=Pe.sourceCode,$e=Ze.length,Ue=0,Fe=Pe.spans,ct=Fe.length,ot=0,st=Pe.decorations,rt=st.length,ht=0;st[rt]=$e;var ut,fe;for(fe=ut=0;fe<rt;)st[fe]!==st[fe+2]?(st[ut++]=st[fe++],st[ut++]=st[fe++]):fe+=2;for(rt=ut,fe=ut=0;fe<rt;){for(var be=st[fe],we=st[fe+1],ke=fe+2;ke+2<=rt&&st[ke+1]===we;)ke+=2;st[ut++]=be,st[ut++]=we,fe=ke}rt=st.length=ut;var xe=Pe.sourceNode,Oe="";xe&&(Oe=xe.style.display,xe.style.display="none");try{for(var ae=null;ot<ct;){var ee=Fe[ot],te=Fe[ot+2]||$e,H=st[ht+2]||$e,ke=Math.min(te,H),G=Fe[ot+1],V;if(G.nodeType!==1&&(V=Ze.substring(Ue,ke))){We&&(V=V.replace(Qe,"\r")),G.nodeValue=V;var J=G.ownerDocument,de=J.createElement("span");de.className=st[ht+1];var ge=G.parentNode;ge.replaceChild(de,G),de.appendChild(G),Ue<te&&(Fe[ot+1]=G=J.createTextNode(Ze.substring(ke,te)),ge.insertBefore(G,de.nextSibling))}Ue=ke,Ue>=te&&(ot+=2),Ue>=H&&(ht+=2)}}finally{xe&&(xe.style.display=Oe)}}var Re={};function he(Pe,We){for(var Qe=We.length;--Qe>=0;){var Ze=We[Qe];Re.hasOwnProperty(Ze)?M.console&&console.warn("cannot override language handler %s",Ze):Re[Ze]=Pe}}function Z(Pe,We){return Pe&&Re.hasOwnProperty(Pe)||(Pe=/^\s*</.test(We)?"default-markup":"default-code"),Re[Pe]}he(Te,["default-code"]),he(ve([],[[e,/^[^<?]+/],[y,/^<!\w[^>]*(?:>|$)/],[c,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[t,/^(?:<[%?]|[%?]>)/],["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"]),he(ve([[e,/^[\s]+/,null,` \r
`],[k,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[A,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[t,/^[=<>\/]+/],["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"]),he(ve([],[[k,/^[\s\S]+/]]),["uq.val"]),he(Ne({keywords:T,hashComments:!0,cStyleComments:!0,types:d}),["c","cc","cpp","cxx","cyc","m"]),he(Ne({keywords:"null,true,false"}),["json"]),he(Ne({keywords:C,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:d}),["cs"]),he(Ne({keywords:O,cStyleComments:!0}),["java"]),he(Ne({keywords:s,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),he(Ne({keywords:r,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),he(Ne({keywords:h,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),he(Ne({keywords:o,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),he(Ne({keywords:v,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),he(Ne({keywords:b,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),he(ve([],[[l,/^[\s\S]+/]]),["regex"]);function je(Pe){var We=Pe.langExtension;try{var Qe=Y(Pe.sourceNode,Pe.pre),Ze=Qe.sourceCode;Pe.sourceCode=Ze,Pe.spans=Qe.spans,Pe.basePos=0,Z(We,Ze)(Pe),_e(Pe)}catch($e){M.console&&console.log($e&&$e.stack||$e)}}function lt(Pe,We,Qe){var Ze=Qe||!1,$e=We||null,Ue=document.createElement("div");Ue.innerHTML="<pre>"+Pe+"</pre>",Ue=Ue.firstChild,Ze&&Ce(Ue,Ze,!0);var Fe={langExtension:$e,numberLines:Ze,sourceNode:Ue,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return je(Fe),Ue.innerHTML}function nt(Pe,We){var Qe=We||document.body,Ze=Qe.ownerDocument||document;function $e(ee){return Qe.getElementsByTagName(ee)}for(var Ue=[$e("pre"),$e("code"),$e("xmp")],Fe=[],ct=0;ct<Ue.length;++ct)for(var ot=0,st=Ue[ct].length;ot<st;++ot)Fe.push(Ue[ct][ot]);Ue=null;var rt=Date;rt.now||(rt={now:function(){return+new Date}});var ht=0,ut=/\blang(?:uage)?-([\w.]+)(?!\S)/,fe=/\bprettyprint\b/,be=/\bprettyprinted\b/,we=/pre|xmp/i,ke=/^code$/i,xe=/^(?:pre|code|xmp)$/i,Oe={};function ae(){for(var ee=M.PR_SHOULD_USE_CONTINUATION?rt.now()+250:Infinity;ht<Fe.length&&rt.now()<ee;ht++){for(var te=Fe[ht],H=Oe,G=te;G=G.previousSibling;){var V=G.nodeType,J=(V===7||V===8)&&G.nodeValue;if(J?!/^\??prettify\b/.test(J):V!==3||/\S/.test(G.nodeValue))break;if(J){H={},J.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Wt,gt,Bt){H[gt]=Bt});break}}var de=te.className;if((H!==Oe||fe.test(de))&&!be.test(de)){for(var ge=!1,Me=te.parentNode;Me;Me=Me.parentNode){var et=Me.tagName;if(xe.test(et)&&Me.className&&fe.test(Me.className)){ge=!0;break}}if(!ge){te.className+=" prettyprinted";var dt=H.lang;if(!dt){dt=de.match(ut);var qe;!dt&&(qe=ye(te))&&ke.test(qe.tagName)&&(dt=qe.className.match(ut)),dt&&(dt=dt[1])}var Ct;if(we.test(te.tagName))Ct=1;else{var _t=te.currentStyle,at=Ze.defaultView,It=_t?_t.whiteSpace:at&&at.getComputedStyle?at.getComputedStyle(te,null).getPropertyValue("white-space"):0;Ct=It&&It.substring(0,3)==="pre"}var At=H.linenums;(At=At==="true"||+At)||(At=de.match(/\blinenums\b(?::(\d+))?/),At=At?At[1]&&At[1].length?+At[1]:!0:!1),At&&Ce(te,At,Ct);var Ot={langExtension:dt,sourceNode:te,numberLines:At,pre:Ct,sourceCode:null,basePos:null,spans:null,decorations:null};je(Ot)}}}ht<Fe.length?M.setTimeout(ae,250):typeof Pe=="function"&&Pe()}ae()}var Ke=M.PR={createSimpleLexer:ve,registerLangHandler:he,sourceDecorator:Ne,PR_ATTRIB_NAME:A,PR_ATTRIB_VALUE:k,PR_COMMENT:c,PR_DECLARATION:y,PR_KEYWORD:p,PR_LITERAL:n,PR_NOCODE:F,PR_PLAIN:e,PR_PUNCTUATION:t,PR_SOURCE:_,PR_STRING:l,PR_TAG:m,PR_TYPE:i,prettyPrintOne:S?M.prettyPrintOne=lt:E=lt,prettyPrint:U=S?M.prettyPrint=nt:U=nt},Ge=M.define;typeof Ge=="function"&&Ge.amd&&Ge("google-code-prettify",[],function(){return Ke})})()},WaYH:function(ft,ze,K){"use strict";var oe=K("rePB"),N=K("Ff2n"),S=K("VTBJ"),I=K("1OyB"),g=K("vuIU"),E=K("JX7q"),U=K("Ji7U"),M=K("LK+K"),R=K("q1tI"),w=K("TSYQ"),x=K.n(w),T=K("sboe"),O=K("OZM5"),C=function(p){var c=p.prefixCls,i=p.level,n=p.isStart,t=p.isEnd;if(!i)return null;for(var e="".concat(c,"-indent-unit"),m=[],y=0;y<i;y+=1){var _;m.push(R.createElement("span",{key:y,className:x()(e,(_={},Object(oe.a)(_,"".concat(e,"-start"),n[y+1]),Object(oe.a)(_,"".concat(e,"-end"),t[y+1]),Object(oe.a)(_,"".concat(e,"-end-first-level"),!y&&t[0]),_))}))}return R.createElement("span",{"aria-hidden":"true",className:"".concat(c,"-indent")},m)},b=C,v=K("815F"),h="open",r="close",o="---",s=function(l){Object(U.a)(c,l);var p=Object(M.a)(c);function c(){var i;return Object(I.a)(this,c),i=p.apply(this,arguments),i.state={dragNodeHighlight:!1},i.onSelectorClick=function(n){var t=i.props.context.onNodeClick;t(n,Object(v.b)(i.props)),i.isSelectable()?i.onSelect(n):i.onCheck(n)},i.onSelectorDoubleClick=function(n){var t=i.props.context.onNodeDoubleClick;t(n,Object(v.b)(i.props))},i.onSelect=function(n){if(i.isDisabled())return;var t=i.props.context.onNodeSelect;n.preventDefault(),t(n,Object(v.b)(i.props))},i.onCheck=function(n){if(i.isDisabled())return;var t=i.props,e=t.disableCheckbox,m=t.checked,y=i.props.context.onNodeCheck;if(!i.isCheckable()||e)return;n.preventDefault();var _=!m;y(n,Object(v.b)(i.props),_)},i.onMouseEnter=function(n){var t=i.props.context.onNodeMouseEnter;t(n,Object(v.b)(i.props))},i.onMouseLeave=function(n){var t=i.props.context.onNodeMouseLeave;t(n,Object(v.b)(i.props))},i.onContextMenu=function(n){var t=i.props.context.onNodeContextMenu;t(n,Object(v.b)(i.props))},i.onDragStart=function(n){var t=i.props.context.onNodeDragStart;n.stopPropagation(),i.setState({dragNodeHighlight:!0}),t(n,Object(E.a)(i));try{n.dataTransfer.setData("text/plain","")}catch(e){}},i.onDragEnter=function(n){var t=i.props.context.onNodeDragEnter;n.preventDefault(),n.stopPropagation(),t(n,Object(E.a)(i))},i.onDragOver=function(n){var t=i.props.context.onNodeDragOver;n.preventDefault(),n.stopPropagation(),t(n,Object(E.a)(i))},i.onDragLeave=function(n){var t=i.props.context.onNodeDragLeave;n.stopPropagation(),t(n,Object(E.a)(i))},i.onDragEnd=function(n){var t=i.props.context.onNodeDragEnd;n.stopPropagation(),i.setState({dragNodeHighlight:!1}),t(n,Object(E.a)(i))},i.onDrop=function(n){var t=i.props.context.onNodeDrop;n.preventDefault(),n.stopPropagation(),i.setState({dragNodeHighlight:!1}),t(n,Object(E.a)(i))},i.onExpand=function(n){var t=i.props.context.onNodeExpand;t(n,Object(v.b)(i.props))},i.setSelectHandle=function(n){i.selectHandle=n},i.getNodeState=function(){var n=i.props.expanded;return i.isLeaf()?null:n?h:r},i.hasChildren=function(){var n=i.props.eventKey,t=i.props.context.keyEntities,e=t[n]||{},m=e.children;return!!(m||[]).length},i.isLeaf=function(){var n=i.props,t=n.isLeaf,e=n.loaded,m=i.props.context.loadData,y=i.hasChildren();return t===!1?!1:t||!m&&!y||m&&e&&!y},i.isDisabled=function(){var n=i.props.disabled,t=i.props.context.disabled;return!!(t||n)},i.isCheckable=function(){var n=i.props.checkable,t=i.props.context.checkable;return!t||n===!1?!1:t},i.syncLoadData=function(n){var t=n.expanded,e=n.loading,m=n.loaded,y=i.props.context,_=y.loadData,A=y.onNodeLoad;if(e)return;_&&t&&!i.isLeaf()&&(!i.hasChildren()&&!m&&A(Object(v.b)(i.props)))},i.renderSwitcher=function(){var n=i.props,t=n.expanded,e=n.switcherIcon,m=i.props.context,y=m.prefixCls,_=m.switcherIcon,A=e||_;if(i.isLeaf())return R.createElement("span",{className:x()("".concat(y,"-switcher"),"".concat(y,"-switcher-noop"))},typeof A=="function"?A(Object(S.a)(Object(S.a)({},i.props),{},{isLeaf:!0})):A);var k=x()("".concat(y,"-switcher"),"".concat(y,"-switcher_").concat(t?h:r));return R.createElement("span",{onClick:i.onExpand,className:k},typeof A=="function"?A(Object(S.a)(Object(S.a)({},i.props),{},{isLeaf:!1})):A)},i.renderCheckbox=function(){var n=i.props,t=n.checked,e=n.halfChecked,m=n.disableCheckbox,y=i.props.context.prefixCls,_=i.isDisabled(),A=i.isCheckable();if(!A)return null;var k=typeof A!="boolean"?A:null;return R.createElement("span",{className:x()("".concat(y,"-checkbox"),t&&"".concat(y,"-checkbox-checked"),!t&&e&&"".concat(y,"-checkbox-indeterminate"),(_||m)&&"".concat(y,"-checkbox-disabled")),onClick:i.onCheck},k)},i.renderIcon=function(){var n=i.props.loading,t=i.props.context.prefixCls;return R.createElement("span",{className:x()("".concat(t,"-iconEle"),"".concat(t,"-icon__").concat(i.getNodeState()||"docu"),n&&"".concat(t,"-icon_loading"))})},i.renderSelector=function(){var n=i.state.dragNodeHighlight,t=i.props,e=t.title,m=t.selected,y=t.icon,_=t.loading,A=t.data,k=i.props.context,F=k.prefixCls,z=k.showIcon,Q=k.icon,Y=k.draggable,X=k.loadData,le=k.titleRender,ye=i.isDisabled(),ve="".concat(F,"-node-content-wrapper"),Ne;if(z){var Te=y||Q;Ne=Te?R.createElement("span",{className:x()("".concat(F,"-iconEle"),"".concat(F,"-icon__customize"))},typeof Te=="function"?Te(i.props):Te):i.renderIcon()}else X&&_&&(Ne=i.renderIcon());var Ce;typeof e=="function"?Ce=e(A):le?Ce=le(A):Ce=e;var _e=R.createElement("span",{className:"".concat(F,"-title")},Ce);return R.createElement("span",{ref:i.setSelectHandle,title:typeof e=="string"?e:"",className:x()("".concat(ve),"".concat(ve,"-").concat(i.getNodeState()||"normal"),!ye&&(m||n)&&"".concat(F,"-node-selected"),!ye&&Y&&"draggable"),draggable:!ye&&Y||void 0,"aria-grabbed":!ye&&Y||void 0,onMouseEnter:i.onMouseEnter,onMouseLeave:i.onMouseLeave,onContextMenu:i.onContextMenu,onClick:i.onSelectorClick,onDoubleClick:i.onSelectorDoubleClick,onDragStart:Y?i.onDragStart:void 0},Ne,_e)},i}return Object(g.a)(c,[{key:"componentDidMount",value:function(){this.syncLoadData(this.props)}},{key:"componentDidUpdate",value:function(){this.syncLoadData(this.props)}},{key:"isSelectable",value:function(){var n=this.props.selectable,t=this.props.context.selectable;return typeof n=="boolean"?n:t}},{key:"render",value:function(){var n,t=this.props,e=t.eventKey,m=t.className,y=t.style,_=t.dragOver,A=t.dragOverGapTop,k=t.dragOverGapBottom,F=t.isLeaf,z=t.isStart,Q=t.isEnd,Y=t.expanded,X=t.selected,le=t.checked,ye=t.halfChecked,ve=t.loading,Ne=t.domRef,Te=t.active,Ce=t.onMouseMove,_e=Object(N.a)(t,["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","onMouseMove"]),Re=this.props.context,he=Re.prefixCls,Z=Re.filterTreeNode,je=Re.draggable,lt=Re.keyEntities,nt=this.isDisabled(),Ke=Object(O.f)(_e),Ge=lt[e]||{},Pe=Ge.level,We=Q[Q.length-1];return R.createElement("div",Object.assign({ref:Ne,className:x()(m,"".concat(he,"-treenode"),(n={},Object(oe.a)(n,"".concat(he,"-treenode-disabled"),nt),Object(oe.a)(n,"".concat(he,"-treenode-switcher-").concat(Y?"open":"close"),!F),Object(oe.a)(n,"".concat(he,"-treenode-checkbox-checked"),le),Object(oe.a)(n,"".concat(he,"-treenode-checkbox-indeterminate"),ye),Object(oe.a)(n,"".concat(he,"-treenode-selected"),X),Object(oe.a)(n,"".concat(he,"-treenode-loading"),ve),Object(oe.a)(n,"".concat(he,"-treenode-active"),Te),Object(oe.a)(n,"".concat(he,"-treenode-leaf-last"),We),Object(oe.a)(n,"drag-over",!nt&&_),Object(oe.a)(n,"drag-over-gap-top",!nt&&A),Object(oe.a)(n,"drag-over-gap-bottom",!nt&&k),Object(oe.a)(n,"filter-node",Z&&Z(Object(v.b)(this.props))),n)),style:y,onDragEnter:je?this.onDragEnter:void 0,onDragOver:je?this.onDragOver:void 0,onDragLeave:je?this.onDragLeave:void 0,onDrop:je?this.onDrop:void 0,onDragEnd:je?this.onDragEnd:void 0,onMouseMove:Ce},Ke),R.createElement(b,{prefixCls:he,level:Pe,isStart:z,isEnd:Q}),this.renderSwitcher(),this.renderCheckbox(),this.renderSelector())}}]),c}(R.Component),f=function(p){return R.createElement(T.a.Consumer,null,function(c){return R.createElement(s,Object.assign({},p,{context:c}))})};f.displayName="TreeNode",f.defaultProps={title:o},f.isTreeNode=1;var d=ze.a=f},Y1PL:function(ft,ze,K){"use strict";K.r(ze),K.d(ze,"ResizableTextArea",function(){return ye});var oe=K("wx14"),N=K("1OyB"),S=K("vuIU"),I=K("Ji7U"),g=K("LK+K"),E=K("q1tI"),U=K("VTBJ"),M=K("rePB"),R=K("Zm9Q"),w=K("Kwbf"),x=K("c+Xe"),T=K("m+aA"),O=K("bdgK"),C=new Map;function b(Te){Te.forEach(function(Ce){var _e,Re=Ce.target;(_e=C.get(Re))===null||_e===void 0||_e.forEach(function(he){return he(Re)})})}var v=new O.default(b),h=null,r=null;function o(Te,Ce){C.has(Te)||(C.set(Te,new Set),v.observe(Te)),C.get(Te).add(Ce)}function s(Te,Ce){C.has(Te)&&(C.get(Te).delete(Ce),C.get(Te).size||(v.unobserve(Te),C.delete(Te)))}var f=function(Te){Object(I.a)(_e,Te);var Ce=Object(g.a)(_e);function _e(){return Object(N.a)(this,_e),Ce.apply(this,arguments)}return Object(S.a)(_e,[{key:"render",value:function(){return this.props.children}}]),_e}(E.Component),d=E.createContext(null);function l(Te){var Ce=Te.children,_e=Te.onBatchResize,Re=E.useRef(0),he=E.useRef([]),Z=E.useContext(d),je=E.useCallback(function(lt,nt,Ke){Re.current+=1;var Ge=Re.current;he.current.push({size:lt,element:nt,data:Ke}),Promise.resolve().then(function(){Ge===Re.current&&(_e==null||_e(he.current),he.current=[])}),Z==null||Z(lt,nt,Ke)},[_e,Z]);return E.createElement(d.Provider,{value:je},Ce)}function p(Te){var Ce=Te.children,_e=Te.disabled,Re=E.useRef(null),he=E.useRef(null),Z=E.useContext(d),je=E.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),lt=E.isValidElement(Ce)&&Object(x.c)(Ce),nt=lt?Ce.ref:null,Ke=E.useMemo(function(){return Object(x.a)(nt,Re)},[nt,Re]),Ge=E.useRef(Te);Ge.current=Te;var Pe=E.useCallback(function(We){var Qe=Ge.current,Ze=Qe.onResize,$e=Qe.data,Ue=We.getBoundingClientRect(),Fe=Ue.width,ct=Ue.height,ot=We.offsetWidth,st=We.offsetHeight,rt=Math.floor(Fe),ht=Math.floor(ct);if(je.current.width!==rt||je.current.height!==ht||je.current.offsetWidth!==ot||je.current.offsetHeight!==st){var ut={width:rt,height:ht,offsetWidth:ot,offsetHeight:st};je.current=ut;var fe=ot===Math.round(Fe)?Fe:ot,be=st===Math.round(ct)?ct:st,we=Object(U.a)(Object(U.a)({},ut),{},{offsetWidth:fe,offsetHeight:be});Z==null||Z(we,We,$e),Ze&&Promise.resolve().then(function(){Ze(we,We)})}},[]);return E.useEffect(function(){var We=Object(T.a)(Re.current)||Object(T.a)(he.current);return We&&!_e&&o(We,Pe),function(){return s(We,Pe)}},[Re.current,_e]),E.createElement(f,{ref:he},lt?E.cloneElement(Ce,{ref:Ke}):Ce)}var c="rc-observer-key";function i(Te){var Ce=Te.children,_e=Object(R.a)(Ce);return _e.map(function(Re,he){var Z=(Re==null?void 0:Re.key)||"".concat(c,"-").concat(he);return E.createElement(p,Object(oe.a)({},Te,{key:Z}),Re)})}i.Collection=l;var n=i,t=K("bT9E"),e=K("TSYQ"),m=K.n(e),y=`
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
`,_=["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"],A={},k;function F(Te){var Ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,_e=Te.getAttribute("id")||Te.getAttribute("data-reactid")||Te.getAttribute("name");if(Ce&&A[_e])return A[_e];var Re=window.getComputedStyle(Te),he=Re.getPropertyValue("box-sizing")||Re.getPropertyValue("-moz-box-sizing")||Re.getPropertyValue("-webkit-box-sizing"),Z=parseFloat(Re.getPropertyValue("padding-bottom"))+parseFloat(Re.getPropertyValue("padding-top")),je=parseFloat(Re.getPropertyValue("border-bottom-width"))+parseFloat(Re.getPropertyValue("border-top-width")),lt=_.map(function(Ke){return"".concat(Ke,":").concat(Re.getPropertyValue(Ke))}).join(";"),nt={sizingStyle:lt,paddingSize:Z,borderSize:je,boxSizing:he};return Ce&&_e&&(A[_e]=nt),nt}function z(Te){var Ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,_e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,Re=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;k||(k=document.createElement("textarea"),k.setAttribute("tab-index","-1"),k.setAttribute("aria-hidden","true"),document.body.appendChild(k)),Te.getAttribute("wrap")?k.setAttribute("wrap",Te.getAttribute("wrap")):k.removeAttribute("wrap");var he=F(Te,Ce),Z=he.paddingSize,je=he.borderSize,lt=he.boxSizing,nt=he.sizingStyle;k.setAttribute("style","".concat(nt,";").concat(y)),k.value=Te.value||Te.placeholder||"";var Ke=Number.MIN_SAFE_INTEGER,Ge=Number.MAX_SAFE_INTEGER,Pe=k.scrollHeight,We;if(lt==="border-box"?Pe+=je:lt==="content-box"&&(Pe-=Z),_e!==null||Re!==null){k.value=" ";var Qe=k.scrollHeight-Z;_e!==null&&(Ke=Qe*_e,lt==="border-box"&&(Ke=Ke+Z+je),Pe=Math.max(Ke,Pe)),Re!==null&&(Ge=Qe*Re,lt==="border-box"&&(Ge=Ge+Z+je),We=Pe>Ge?"":"hidden",Pe=Math.min(Ge,Pe))}return{height:Pe,minHeight:Ke,maxHeight:Ge,overflowY:We,resize:"none"}}var Q=K("Gytx"),Y=K.n(Q),X;(function(Te){Te[Te.NONE=0]="NONE",Te[Te.RESIZING=1]="RESIZING",Te[Te.RESIZED=2]="RESIZED"})(X||(X={}));var le=function(Te){Object(I.a)(_e,Te);var Ce=Object(g.a)(_e);function _e(Re){var he;return Object(N.a)(this,_e),he=Ce.call(this,Re),he.nextFrameActionId=void 0,he.resizeFrameId=void 0,he.textArea=void 0,he.saveTextArea=function(Z){he.textArea=Z},he.handleResize=function(Z){var je=he.state.resizeStatus,lt=he.props,nt=lt.autoSize,Ke=lt.onResize;if(je!==X.NONE)return;typeof Ke=="function"&&Ke(Z),nt&&he.resizeOnNextFrame()},he.resizeOnNextFrame=function(){cancelAnimationFrame(he.nextFrameActionId),he.nextFrameActionId=requestAnimationFrame(he.resizeTextarea)},he.resizeTextarea=function(){var Z=he.props.autoSize;if(!Z||!he.textArea)return;var je=Z.minRows,lt=Z.maxRows,nt=z(he.textArea,!1,je,lt);he.setState({textareaStyles:nt,resizeStatus:X.RESIZING},function(){cancelAnimationFrame(he.resizeFrameId),he.resizeFrameId=requestAnimationFrame(function(){he.setState({resizeStatus:X.RESIZED},function(){he.resizeFrameId=requestAnimationFrame(function(){he.setState({resizeStatus:X.NONE}),he.fixFirefoxAutoScroll()})})})})},he.renderTextArea=function(){var Z=he.props,je=Z.prefixCls,lt=je===void 0?"rc-textarea":je,nt=Z.autoSize,Ke=Z.onResize,Ge=Z.className,Pe=Z.disabled,We=he.state,Qe=We.textareaStyles,Ze=We.resizeStatus,$e=Object(t.a)(he.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ue=m()(lt,Ge,Object(M.a)({},"".concat(lt,"-disabled"),Pe));"value"in $e&&($e.value=$e.value||"");var Fe=Object(U.a)(Object(U.a)(Object(U.a)({},he.props.style),Qe),Ze===X.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return E.createElement(n,{onResize:he.handleResize,disabled:!(nt||Ke)},E.createElement("textarea",Object(oe.a)({},$e,{className:Ue,style:Fe,ref:he.saveTextArea})))},he.state={textareaStyles:{},resizeStatus:X.NONE},he}return Object(S.a)(_e,[{key:"componentDidUpdate",value:function(he){(he.value!==this.props.value||!Y()(he.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 he=this.textArea.selectionStart,Z=this.textArea.selectionEnd;this.textArea.setSelectionRange(he,Z)}}catch(je){}}},{key:"render",value:function(){return this.renderTextArea()}}]),_e}(E.Component),ye=le,ve=function(Te){Object(I.a)(_e,Te);var Ce=Object(g.a)(_e);function _e(Re){var he;Object(N.a)(this,_e),he=Ce.call(this,Re),he.resizableTextArea=void 0,he.focus=function(){he.resizableTextArea.textArea.focus()},he.saveTextArea=function(je){he.resizableTextArea=je},he.handleChange=function(je){var lt=he.props.onChange;he.setValue(je.target.value,function(){he.resizableTextArea.resizeTextarea()}),lt&&lt(je)},he.handleKeyDown=function(je){var lt=he.props,nt=lt.onPressEnter,Ke=lt.onKeyDown;je.keyCode===13&&nt&&nt(je),Ke&&Ke(je)};var Z=typeof Re.value=="undefined"||Re.value===null?Re.defaultValue:Re.value;return he.state={value:Z},he}return Object(S.a)(_e,[{key:"setValue",value:function(he,Z){"value"in this.props||this.setState({value:he},Z)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return E.createElement(ye,Object(oe.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(he){return"value"in he?{value:he.value}:null}}]),_e}(E.Component),Ne=ze.default=ve},ZW9T:function(ft,ze,K){"use strict";K.d(ze,"a",function(){return f});var oe=K("k1fw"),N=K("miYZ"),S=K("tsqr"),I=K("rAM+"),g=K("tJVT"),E=K("PpiC"),U=K("q1tI"),M=K.n(U),R=K("bdgK");function w(d,l,p,c,i){var n=l.getWordUntilPosition(p),t={startLineNumber:p.lineNumber,endLineNumber:p.lineNumber,startColumn:n.startColumn,endColumn:n.endColumn},e=c.map(function(m){return{label:m,kind:d.languages.CompletionItemKind.Keyword,insertText:m,insertTextRules:d.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:t}});return i.map(function(m){e.push(Object(oe.a)(Object(oe.a)({},m),{},{range:t}))}),e}var x=function(d){var l={label:"ifelse",kind:d.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`),insertTextRules:d.languages.CompletionItemInsertTextRule.InsertAsSnippet},p=["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"];d.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(t,e){var m=w(d,t,e,p,[l]);return{suggestions:m}}});var c=["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"];d.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(t,e){var m=[{label:"print",kind:d.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
`),insertTextRules:d.languages.CompletionItemInsertTextRule.InsertAsSnippet}],y=w(d,t,e,c,m);return{suggestions:y}}});var i=["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"];d.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(t,e){var m=[l,{label:"main",kind:d.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
`),insertTextRules:d.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:d.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
`),insertTextRules:d.languages.CompletionItemInsertTextRule.InsertAsSnippet}],y=w(d,t,e,i,m);return{suggestions:y}}})},T="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",O=K("LvDl");function C(d){return/^\d+$/.test(d)?"".concat(d,"px"):d}function b(){}var v=!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"};function r(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],l=d;if(Array.isArray(d)){for(var p=0;p<d.length;p++){var c=h[d[p]];if(c)return c}return l[0]}return h[l]||l}var o=null,s=ze.b=function(d){var l=d.width,p=l===void 0?"100%":l,c=d.height,i=c===void 0?"100%":c,n=d.value,t=d.language,e=t===void 0?"javascript":t,m=d.style,y=m===void 0?{}:m,_=d.options,A=_===void 0?{}:_,k=d.overrideServices,F=k===void 0?{}:k,z=d.theme,Q=z===void 0?"vs-dark":z,Y=d.onEditBlur,X=d.onSave,le=d.autoHeight,ye=le===void 0?!1:le,ve=d.forbidCopy,Ne=ve===void 0?!1:ve,Te=d.onChange,Ce=Te===void 0?b:Te,_e=d.editorDidMount,Re=_e===void 0?b:_e,he=d.onFocus,Z=he===void 0?b:he,je=d.filename,lt=je===void 0?"educoder.txt":je,nt=Object(E.a)(d,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),Ke=Object(U.useRef)(),Ge=Object(U.useRef)({}),Pe=Object(U.useRef)(),We=Object(U.useRef)(!1),Qe=Object(U.useRef)(),Ze=Object(U.useState)(!1),$e=Object(g.a)(Ze,2),Ue=$e[0],Fe=$e[1];function ct(){var V;return Ke.current&&(V=new R.default(function(J){var de=Object(I.a)(J),ge;try{for(de.s();!(ge=de.n()).done;){var Me=ge.value;(Me.target.offsetHeight>0||Me.target.offsetWidth>0)&&Ge.current.instance.layout()}}catch(et){de.e(et)}finally{de.f()}}),V.observe(Ke.current)),V}function ot(){S.b.warn(decodeURIComponent(T))}var st=function(){var J=Ge.current.instance;if(n!=null&&J&&Ue){var de=J.getModel();de&&n!==de.getValue()&&(v=!0,de.setValue(n),J.layout(),v=!1)}};Object(U.useEffect)(function(){Pe.current&&clearTimeout(Pe.current),Pe.current=setTimeout(function(){st()},500)},[n,Ue,Ge.current]);function rt(){var V=Ge.current.instance;if(V){var J=V.getSelection(),de=Ge.current.pastePos||{},ge=new o.Range(de.startLineNumber||J.endLineNumber,de.startColumn||J.endColumn,de.endLineNumber||J.endLineNumber,de.endColumn||J.endColumn);setTimeout(function(){V.executeEdits("",[{range:ge,text:""}])},300)}}function ht(V){(window.navigator.platform.match("Mac")?V.metaKey:V.ctrlKey)&&V.keyCode==83&&(V.preventDefault(),X())}var ut=function(){if(ye&&Ge.current.instance){var J=Ge.current.instance.getContentHeight();H(J<i?i:J)}else H(i)};function fe(V){var J=document.createEvent("MouseEvents");J.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),V.dispatchEvent(J)}function be(V,J){var de=window.URL||window.webkitURL||window,ge=new Blob([J]),Me=document.createElementNS("http://www.w3.org/1999/xhtml","a");Me.href=de.createObjectURL(ge),Me.download=V,fe(Me)}Object(U.useEffect)(function(){ut()},[ut]),Object(U.useEffect)(function(){Ke.current&&!Ue&&K.e(27).then(K.t.bind(null,"M/lh",7)).then(function(V){try{o=V,Ge.current.instance=o.editor.create(Ke.current,{value:n,language:r(e),theme:Q,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},F);var J=Ge.current.instance;if(Re(J,o),setTimeout(function(){ut(),Ge.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){be(lt||"educoder.txt",J.getValue())}})},500),Ge.current.subscription=J.onDidChangeModelContent(function(ge){We.current?clearTimeout(Qe.current):(ut(),Ce(J.getValue(),ge)),Qe.current=setTimeout(function(){We.current=!1},500)}),window.Monaco||x(o),Ne&&(J.addCommand(o.KeyMod.CtrlCmd|o.KeyMod.Shift|o.KeyCode.KEY_V,function(){return ot(),null}),J.addCommand(o.KeyMod.CtrlCmd|o.KeyCode.KEY_C,function(){return ot(),null})),window.Monaco=o,Y&&J.onDidBlurEditorWidget(function(){Y(J.getValue())}),Z&&J.onDidFocusEditorText(function(){Z(J.getValue())}),Ne){J.addCommand(o.KeyMod.CtrlCmd|o.KeyCode.KEY_V,function(){return ot(),null}),J.onDidPaste(function(ge){Ge.current.pastePos=ge});try{window.addEventListener("paste",rt)}catch(ge){}}var de=ct();return Fe(!0),function(){var ge=Ge.current.instance;ge.dispose();var Me=ge.getModel();Me&&Me.dispose(),Ge.current.subscription&&Ge.current.subscription.dispose(),Ne&&window.removeEventListener("paste",rt),de.unobserve(Ke.current)}}catch(ge){}})},[]),Object(U.useEffect)(function(){var V=Ge.current.instance;if(V&&Ue)return document.addEventListener("keydown",ht,!1),function(){document.removeEventListener("keydown",ht)}},[X,Ue]),Object(U.useEffect)(function(){var V=Ge.current.instance;if(V&&Ue){var J=r(e);o.editor.setModelLanguage(V.getModel(),J),console.log("language:",e,V.getModel(),J)}},[e,Ue]),Object(U.useEffect)(function(){var V=Ge.current.instance;V&&Ue&&o.editor.setTheme(Q)},[Q,Ue]),Object(U.useEffect)(function(){var V=Ge.current.instance;V&&Ue&&(V.updateOptions(Object(oe.a)({},A)),setTimeout(function(){V.getModel().updateOptions(Object(oe.a)({},A))},200))},[JSON.stringify(A),Ue]),Object(U.useEffect)(function(){var V=Ge.current.instance;V&&Ue&&V.layout()},[p,i,Ue]);var we=Object(U.useState)(C(p)),ke=Object(g.a)(we,2),xe=ke[0],Oe=ke[1],ae=Object(U.useState)(C(i)),ee=Object(g.a)(ae,2),te=ee[0],H=ee[1],G=Object(oe.a)(Object(oe.a)({},y),{},{width:xe,height:te});return M.a.createElement("div",{className:"my-monaco-editor",ref:Ke,style:G})};function f(d){var l=d.width,p=l===void 0?"100%":l,c=d.height,i=c===void 0?"100%":c,n=d.original,t=d.modified,e=d.language,m=d.options,y=m===void 0?{}:m,_=Object(U.useRef)(),A=Object(U.useState)(null),k=Object(g.a)(A,2),F=k[0],z=k[1];function Q(ye){var ve;return _.current&&(ve=new R.default(function(Ne){var Te=Object(I.a)(Ne),Ce;try{for(Te.s();!(Ce=Te.n()).done;){var _e=Ce.value;(_e.target.offsetHeight>0||_e.target.offsetWidth>0)&&ye.layout()}}catch(Re){Te.e(Re)}finally{Te.f()}}),ve.observe(_.current)),ve}Object(U.useEffect)(function(){_.current&&K.e(27).then(K.t.bind(null,"M/lh",7)).then(function(ye){o=ye;var ve=o.editor.createDiffEditor(_.current,Object(oe.a)(Object(oe.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},y),{},{wordWrap:!0}));z(ve);var Ne=Q(ve);return function(){ve.dispose();var Te=ve.getModel();Te&&Te.dispose(),Ne.unobserve(_.current)}})},[]),Object(U.useEffect)(function(){F&&F.setModel({original:o.editor.createModel(n,e),modified:o.editor.createModel(t,e)})},[n,t,e,F]);var Y=C(p),X=C(i),le={width:Y,height:X};return M.a.createElement("div",{className:"my-diff-editor",ref:_,style:le})}},bT9E:function(ft,ze,K){"use strict";K.d(ze,"a",function(){return N});var oe=K("VTBJ");function N(S,I){var g=Object(oe.a)({},S);return Array.isArray(I)&&I.forEach(function(E){delete g[E]}),g}},biw7:function(ft,ze,K){"use strict";var oe=K("q1tI"),N=K.n(oe),S=oe.createContext(null);ze.a=S},eZjB:function(ft,ze,K){ft.exports=K.p+"static/a1.80c95864.svg"},fyJ8:function(ft,ze,K){"use strict";var oe=K("rePB"),N=K("VTBJ"),S=K("Ff2n"),I=K("U8pU"),g=K("q1tI"),E=K.n(g),U=K("TSYQ"),M=K.n(U),R=K("c+Xe"),w=K("sR1s");function x(v){return v&&Object(I.a)(v)==="object"&&!Array.isArray(v)&&!g.isValidElement(v)}function T(v){return typeof v=="string"?!0:Object(R.c)(v)}function O(v,h){var r,o=v.prefixCls,s=v.className,f=v.record,d=v.index,l=v.dataIndex,p=v.render,c=v.children,i=v.component,n=i===void 0?"td":i,t=v.colSpan,e=v.rowSpan,m=v.fixLeft,y=v.fixRight,_=v.firstFixLeft,A=v.lastFixLeft,k=v.firstFixRight,F=v.lastFixRight,z=v.appendNode,Q=v.additionalProps,Y=Q===void 0?{}:Q,X=v.ellipsis,le=v.align,ye=v.rowType,ve=v.isSticky,Ne="".concat(o,"-cell"),Te,Ce;if(c)Ce=c;else{var _e=Object(w.b)(f,l);if(Ce=_e,p){var Re=p(_e,f,d);x(Re)?(Ce=Re.children,Te=Re.props):Ce=Re}}Object(I.a)(Ce)==="object"&&!Array.isArray(Ce)&&!g.isValidElement(Ce)&&(Ce=null),X&&(A||k)&&(Ce=g.createElement("span",{className:"".concat(Ne,"-content")},Ce));var he=Te||{},Z=he.colSpan,je=he.rowSpan,lt=he.style,nt=he.className,Ke=Object(S.a)(he,["colSpan","rowSpan","style","className"]),Ge=Z!==void 0?Z:t,Pe=je!==void 0?je:e;if(Ge===0||Pe===0)return null;var We={},Qe=typeof m=="number",Ze=typeof y=="number";Qe&&(We.position="sticky",We.left=m),Ze&&(We.position="sticky",We.right=y);var $e={};le&&($e.textAlign=le);var Ue,Fe=X===!0?{showTitle:!0}:X;Fe&&(Fe.showTitle||ye==="header")&&(typeof Ce=="string"||typeof Ce=="number"?Ue=Ce.toString():g.isValidElement(Ce)&&typeof Ce.props.children=="string"&&(Ue=Ce.props.children));var ct=Object(N.a)(Object(N.a)(Object(N.a)({title:Ue},Ke),Y),{},{colSpan:Ge&&Ge!==1?Ge:null,rowSpan:Pe&&Pe!==1?Pe:null,className:M()(Ne,s,(r={},Object(oe.a)(r,"".concat(Ne,"-fix-left"),Qe),Object(oe.a)(r,"".concat(Ne,"-fix-left-first"),_),Object(oe.a)(r,"".concat(Ne,"-fix-left-last"),A),Object(oe.a)(r,"".concat(Ne,"-fix-right"),Ze),Object(oe.a)(r,"".concat(Ne,"-fix-right-first"),k),Object(oe.a)(r,"".concat(Ne,"-fix-right-last"),F),Object(oe.a)(r,"".concat(Ne,"-ellipsis"),X),Object(oe.a)(r,"".concat(Ne,"-with-append"),z),Object(oe.a)(r,"".concat(Ne,"-fix-sticky"),(Qe||Ze)&&ve),r),Y.className,nt),style:Object(N.a)(Object(N.a)(Object(N.a)(Object(N.a)({},Y.style),$e),We),lt),ref:T(n)?h:null});return g.createElement(n,Object.assign({},ct),z,Ce)}var C=g.forwardRef(O);C.displayName="Cell";var b=g.memo(C,function(v,h){return h.shouldCellUpdate?!h.shouldCellUpdate(h.record,v.record):!1});ze.a=b},hW8S:function(ft,ze,K){"use strict";K.d(ze,"a",function(){return I}),K.d(ze,"c",function(){return g}),K.d(ze,"b",function(){return E});var oe=K("VTBJ"),N=K("Ff2n"),S=K("Kwbf"),I="RC_TABLE_INTERNAL_COL_DEFINE";function g(U){var M=U.expandable,R=Object(N.a)(U,["expandable"]);return"expandable"in U?Object(oe.a)(Object(oe.a)({},R),M):R}function E(U){return Object.keys(U).reduce(function(M,R){return(R.substr(0,5)==="data-"||R.substr(0,5)==="aria-")&&(M[R]=U[R]),M},{})}},k3GJ:function(ft,ze,K){"use strict";K.d(ze,"a",function(){return pi});var oe=K("rePB"),N=K("ODXe"),S=K("Ff2n"),I=K("VTBJ"),g=K("q1tI"),E=K("TSYQ"),U=K.n(E),M=K("Zm9Q"),R=K("6cGi"),w=K("KQm4"),x=K("xEkU"),T=K.n(x),O=K("t23M");function C(q){var ue=Object(g.useRef)(),pe=Object(g.useRef)(!1);function ne(){for(var j=arguments.length,$=new Array(j),W=0;W<j;W++)$[W]=arguments[W];pe.current||(T.a.cancel(ue.current),ue.current=T()(function(){q.apply(void 0,$)}))}return Object(g.useEffect)(function(){return function(){pe.current=!0,T.a.cancel(ue.current)}},[]),ne}function b(q){var ue=Object(g.useRef)([]),pe=Object(g.useState)({}),ne=Object(N.a)(pe,2),j=ne[1],$=Object(g.useRef)(typeof q=="function"?q():q),W=C(function(){var ie=$.current;ue.current.forEach(function(me){ie=me(ie)}),ue.current=[],$.current=ie,j({})});function re(ie){ue.current.push(ie),W()}return[$.current,re]}var v=K("4IlW");function h(q,ue){var pe,ne=q.prefixCls,j=q.id,$=q.active,W=q.rtl,re=q.tab,ie=re.key,me=re.tab,ce=re.disabled,Ee=re.closeIcon,De=q.tabBarGutter,Xe=q.tabPosition,Ve=q.closable,it=q.renderWrapper,St=q.removeAriaLabel,Mt=q.editable,Rt=q.onClick,Ut=q.onRemove,kt=q.onFocus,Dt="".concat(ne,"-tab");g.useEffect(function(){return Ut},[]);var Pt={};Xe==="top"||Xe==="bottom"?Pt[W?"marginLeft":"marginRight"]=De:Pt.marginBottom=De;var Vt=Mt&&Ve!==!1&&!ce;function Ft(xt){if(ce)return;Rt(xt)}function fr(xt){xt.preventDefault(),xt.stopPropagation(),Mt.onEdit("remove",{key:ie,event:xt})}var nr=g.createElement("div",{key:ie,ref:ue,className:U()(Dt,(pe={},Object(oe.a)(pe,"".concat(Dt,"-with-remove"),Vt),Object(oe.a)(pe,"".concat(Dt,"-active"),$),Object(oe.a)(pe,"".concat(Dt,"-disabled"),ce),pe)),style:Pt,onClick:Ft},g.createElement("div",{role:"tab","aria-selected":$,id:j&&"".concat(j,"-tab-").concat(ie),className:"".concat(Dt,"-btn"),"aria-controls":j&&"".concat(j,"-panel-").concat(ie),"aria-disabled":ce,tabIndex:ce?null:0,onClick:function(Et){Et.stopPropagation(),Ft(Et)},onKeyDown:function(Et){[v.a.SPACE,v.a.ENTER].includes(Et.which)&&(Et.preventDefault(),Ft(Et))},onFocus:kt},me),Vt&&g.createElement("button",{type:"button","aria-label":St||"remove",tabIndex:0,className:"".concat(Dt,"-remove"),onClick:function(Et){Et.stopPropagation(),fr(Et)}},Ee||Mt.removeIcon||"\xD7"));return it&&(nr=it(nr)),nr}var r=g.forwardRef(h),o={width:0,height:0,left:0,top:0};function s(q,ue,pe){return Object(g.useMemo)(function(){for(var ne,j=new Map,$=ue.get((ne=q[0])===null||ne===void 0?void 0:ne.key)||o,W=$.left+$.width,re=0;re<q.length;re+=1){var ie=q[re].key,me=ue.get(ie);if(!me){var ce;me=ue.get((ce=q[re-1])===null||ce===void 0?void 0:ce.key)||o}var Ee=j.get(ie)||Object(I.a)({},me);Ee.right=W-Ee.left-Ee.width,j.set(ie,Ee)}return j},[q.map(function(ne){return ne.key}).join("_"),ue,pe])}var f={width:0,height:0,left:0,top:0,right:0};function d(q,ue,pe,ne,j){var $=j.tabs,W=j.tabPosition,re=j.rtl,ie,me,ce;["top","bottom"].includes(W)?(ie="width",me=re?"right":"left",ce=Math.abs(ue.left)):(ie="height",me="top",ce=-ue.top);var Ee=ue[ie],De=pe[ie],Xe=ne[ie],Ve=Ee;return De+Xe>Ee&&(Ve=Ee-Xe),Object(g.useMemo)(function(){if(!$.length)return[0,0];for(var it=$.length,St=it,Mt=0;Mt<it;Mt+=1){var Rt=q.get($[Mt].key)||f;if(Rt[me]+Rt[ie]>ce+Ve){St=Mt-1;break}}for(var Ut=0,kt=it-1;kt>=0;kt-=1){var Dt=q.get($[kt].key)||f;if(Dt[me]<ce){Ut=kt+1;break}}return[Ut,St]},[q,ce,Ve,W,$.map(function(it){return it.key}).join("_"),re])}var l=K("wx14"),p=K("1OyB"),c=K("vuIU"),i=K("JX7q"),n=K("Ji7U"),t=K("LK+K"),e=K("I8Z2"),m=K("bT9E"),y=K("2GS6"),_=K("Gytx"),A=K.n(_),k=K("U8pU"),F=/iPhone/i,z=/iPod/i,Q=/iPad/i,Y=/\bAndroid(?:.+)Mobile\b/i,X=/Android/i,le=/\bAndroid(?:.+)SD4930UR\b/i,ye=/\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i,ve=/Windows Phone/i,Ne=/\bWindows(?:.+)ARM\b/i,Te=/BlackBerry/i,Ce=/BB10/i,_e=/Opera Mini/i,Re=/\b(CriOS|Chrome)(?:.+)Mobile/i,he=/Mobile(?:.+)Firefox\b/i;function Z(q,ue){return q.test(ue)}function je(q){var ue=q||(typeof navigator!="undefined"?navigator.userAgent:""),pe=(ue||"").split("[FBAN");if(typeof pe[1]!="undefined"){var ne=pe,j=Object(N.a)(ne,1);ue=j[0]}if(pe=ue.split("Twitter"),typeof pe[1]!="undefined"){var $=pe,W=Object(N.a)($,1);ue=W[0]}var re={apple:{phone:Z(F,ue)&&!Z(ve,ue),ipod:Z(z,ue),tablet:!Z(F,ue)&&Z(Q,ue)&&!Z(ve,ue),device:(Z(F,ue)||Z(z,ue)||Z(Q,ue))&&!Z(ve,ue)},amazon:{phone:Z(le,ue),tablet:!Z(le,ue)&&Z(ye,ue),device:Z(le,ue)||Z(ye,ue)},android:{phone:!Z(ve,ue)&&Z(le,ue)||!Z(ve,ue)&&Z(Y,ue),tablet:!Z(ve,ue)&&!Z(le,ue)&&!Z(Y,ue)&&(Z(ye,ue)||Z(X,ue)),device:!Z(ve,ue)&&(Z(le,ue)||Z(ye,ue)||Z(Y,ue)||Z(X,ue))||Z(/\bokhttp\b/i,ue)},windows:{phone:Z(ve,ue),tablet:Z(Ne,ue),device:Z(ve,ue)||Z(Ne,ue)},other:{blackberry:Z(Te,ue),blackberry10:Z(Ce,ue),opera:Z(_e,ue),firefox:Z(he,ue),chrome:Z(Re,ue),device:Z(Te,ue)||Z(Ce,ue)||Z(_e,ue)||Z(he,ue)||Z(Re,ue)},any:null,phone:null,tablet:null};return re.any=re.apple.device||re.android.device||re.windows.device||re.other.device,re.phone=re.apple.phone||re.android.phone||re.windows.phone,re.tablet=re.apple.tablet||re.android.tablet||re.windows.tablet,re}var lt=Object(I.a)(Object(I.a)({},je()),{},{isMobile:je}),nt=lt;function Ke(){}function Ge(q,ue,pe){var ne=ue||"";return q.key||"".concat(ne,"item_").concat(pe)}function Pe(q){return"".concat(q,"-menu-")}function We(q,ue){var pe=-1;g.Children.forEach(q,function(ne){pe+=1,ne&&ne.type&&ne.type.isMenuItemGroup?g.Children.forEach(ne.props.children,function(j){pe+=1,ue(j,pe)}):ue(ne,pe)})}function Qe(q,ue,pe){if(!q||pe.find)return;g.Children.forEach(q,function(ne){if(ne){var j=ne.type;if(!j||!(j.isSubMenu||j.isMenuItem||j.isMenuItemGroup))return;ue.indexOf(ne.key)!==-1?pe.find=!0:ne.props.children&&Qe(ne.props.children,ue,pe)}})}var Ze=["defaultSelectedKeys","selectedKeys","defaultOpenKeys","openKeys","mode","getPopupContainer","onSelect","onDeselect","onDestroy","openTransitionName","openAnimation","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","triggerSubMenuAction","level","selectable","multiple","onOpenChange","visible","focusable","defaultActiveFirst","prefixCls","inlineIndent","parentMenu","title","rootPrefixCls","eventKey","active","onItemHover","onTitleMouseEnter","onTitleMouseLeave","onTitleClick","popupAlign","popupOffset","isOpen","renderMenuItem","manualRef","subMenuKey","disabled","index","isSelected","store","activeKey","builtinPlacements","overflowedIndicator","motion","attribute","value","popupClassName","inlineCollapsed","menu","theme","itemIcon","expandIcon"],$e=function(ue){var pe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ne=ue&&typeof ue.getBoundingClientRect=="function"&&ue.getBoundingClientRect().width;if(ne){if(pe){var j=getComputedStyle(ue),$=j.marginLeft,W=j.marginRight;ne+=+$.replace("px","")+ +W.replace("px","")}ne=+ne.toFixed(6)}return ne||0},Ue=function(ue,pe,ne){ue&&Object(k.a)(ue.style)==="object"&&(ue.style[pe]=ne)},Fe=function(){return nt.any},ct=K("bdgK"),ot=K("i8i4"),st=K.n(ot),rt=K("wgJM"),ht=K("l4aY"),ut=K("m+aA"),fe=K("c+Xe"),be=K("zT1h"),we=K("QC+M");function ke(q,ue,pe){return pe?q[0]===ue[0]:q[0]===ue[0]&&q[1]===ue[1]}function xe(q,ue,pe){var ne=q[ue]||{};return Object(I.a)(Object(I.a)({},ne),pe)}function Oe(q,ue,pe,ne){for(var j=pe.points,$=Object.keys(q),W=0;W<$.length;W+=1){var re=$[W];if(ke(q[re].points,j,ne))return"".concat(ue,"-placement-").concat(re)}return""}var ae=function(){if(typeof navigator=="undefined"||typeof window=="undefined")return!1;var q=navigator.userAgent||navigator.vendor||window.opera;return!!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(q)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(q==null?void 0:q.substr(0,4)))},ee=K("MNnm");function te(q,ue){var pe={};return pe[q.toLowerCase()]=ue.toLowerCase(),pe["Webkit".concat(q)]="webkit".concat(ue),pe["Moz".concat(q)]="moz".concat(ue),pe["ms".concat(q)]="MS".concat(ue),pe["O".concat(q)]="o".concat(ue.toLowerCase()),pe}function H(q,ue){var pe={animationend:te("Animation","AnimationEnd"),transitionend:te("Transition","TransitionEnd")};return q&&("AnimationEvent"in ue||delete pe.animationend.animation,"TransitionEvent"in ue||delete pe.transitionend.transition),pe}var G=H(Object(ee.a)(),typeof window!="undefined"?window:{}),V={};if(Object(ee.a)()){var J=document.createElement("div");V=J.style}var de={};function ge(q){if(de[q])return de[q];var ue=G[q];if(ue)for(var pe=Object.keys(ue),ne=pe.length,j=0;j<ne;j+=1){var $=pe[j];if(Object.prototype.hasOwnProperty.call(ue,$)&&$ in V)return de[q]=ue[$],de[q]}return""}var Me=ge("animationend"),et=ge("transitionend"),dt=!!(Me&&et),qe=Me||"animationend",Ct=et||"transitionend";function _t(q,ue){if(!q)return null;if(Object(k.a)(q)==="object"){var pe=ue.replace(/-\w/g,function(ne){return ne[1].toUpperCase()});return q[pe]}return"".concat(q,"-").concat(ue)}var at="none",It="appear",At="enter",Ot="leave",Wt="none",gt="prepare",Bt="start",Nt="active",Je="end";function Yt(q){var ue=Object(g.useRef)(!1),pe=Object(g.useState)(q),ne=Object(N.a)(pe,2),j=ne[0],$=ne[1];function W(re){ue.current||$(re)}return Object(g.useEffect)(function(){return function(){ue.current=!0}},[]),[j,W]}var or=Object(ee.a)()?g.useLayoutEffect:g.useEffect,Gt=or,rr=function(){var q=g.useRef(null);function ue(){rt.a.cancel(q.current)}function pe(ne){var j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;ue();var $=Object(rt.a)(function(){j<=1?ne({isCanceled:function(){return $!==q.current}}):pe(ne,j-1)});q.current=$}return g.useEffect(function(){return function(){ue()}},[]),[pe,ue]},$r=[gt,Bt,Nt,Je],Ir=!1,yr=!0;function pr(q){return q===Nt||q===Je}var Mr=function(q,ue){var pe=g.useState(Wt),ne=Object(N.a)(pe,2),j=ne[0],$=ne[1],W=rr(),re=Object(N.a)(W,2),ie=re[0],me=re[1];function ce(){$(gt)}return Gt(function(){if(j!==Wt&&j!==Je){var Ee=$r.indexOf(j),De=$r[Ee+1],Xe=ue(j);Xe===Ir?$(De):ie(function(Ve){function it(){if(Ve.isCanceled())return;$(De)}Xe===!0?it():Promise.resolve(Xe).then(it)})}},[q,j]),g.useEffect(function(){return function(){me()}},[]),[ce,j]},Nr=function(q){var ue=Object(g.useRef)(),pe=Object(g.useRef)(q);pe.current=q;var ne=g.useCallback(function(W){pe.current(W)},[]);function j(W){W&&(W.removeEventListener(Ct,ne),W.removeEventListener(qe,ne))}function $(W){ue.current&&ue.current!==W&&j(ue.current),W&&W!==ue.current&&(W.addEventListener(Ct,ne),W.addEventListener(qe,ne),ue.current=W)}return g.useEffect(function(){return function(){j(ue.current)}},[]),[$,j]};function Kr(q,ue,pe,ne){var j=ne.motionEnter,$=j===void 0?!0:j,W=ne.motionAppear,re=W===void 0?!0:W,ie=ne.motionLeave,me=ie===void 0?!0:ie,ce=ne.motionDeadline,Ee=ne.motionLeaveImmediately,De=ne.onAppearPrepare,Xe=ne.onEnterPrepare,Ve=ne.onLeavePrepare,it=ne.onAppearStart,St=ne.onEnterStart,Mt=ne.onLeaveStart,Rt=ne.onAppearActive,Ut=ne.onEnterActive,kt=ne.onLeaveActive,Dt=ne.onAppearEnd,Pt=ne.onEnterEnd,Vt=ne.onLeaveEnd,Ft=ne.onVisibleChanged,fr=Yt(),nr=Object(N.a)(fr,2),xt=nr[0],Et=nr[1],Kt=Yt(at),zt=Object(N.a)(Kt,2),vt=zt[0],Xt=zt[1],dr=Yt(null),$t=Object(N.a)(dr,2),ar=$t[0],hr=$t[1],Dr=Object(g.useRef)(!1),Vr=Object(g.useRef)(null),gr=Object(g.useRef)(!1),Xr=Object(g.useRef)(null);function yn(){var cr=pe();return cr||Xr.current}var Zr=Object(g.useRef)(!1);function qr(cr){var tr=yn();if(cr&&!cr.deadline&&cr.target!==tr)return;var Lr;vt===It&&Zr.current?Lr=Dt==null?void 0:Dt(tr,cr):vt===At&&Zr.current?Lr=Pt==null?void 0:Pt(tr,cr):vt===Ot&&Zr.current&&(Lr=Vt==null?void 0:Vt(tr,cr)),Lr!==!1&&!gr.current&&(Xt(at),hr(null))}var Cr=Nr(qr),Wr=Object(N.a)(Cr,1),Pr=Wr[0],wr=g.useMemo(function(){var cr,tr,Lr;switch(vt){case"appear":return cr={},Object(oe.a)(cr,gt,De),Object(oe.a)(cr,Bt,it),Object(oe.a)(cr,Nt,Rt),cr;case"enter":return tr={},Object(oe.a)(tr,gt,Xe),Object(oe.a)(tr,Bt,St),Object(oe.a)(tr,Nt,Ut),tr;case"leave":return Lr={},Object(oe.a)(Lr,gt,Ve),Object(oe.a)(Lr,Bt,Mt),Object(oe.a)(Lr,Nt,kt),Lr;default:return{}}},[vt]),Dn=Mr(vt,function(cr){if(cr===gt){var tr=wr[gt];return tr?tr(yn()):Ir}if(ur in wr){var Lr;hr(((Lr=wr[ur])===null||Lr===void 0?void 0:Lr.call(wr,yn(),null))||null)}return ur===Nt&&(Pr(yn()),ce>0&&(clearTimeout(Vr.current),Vr.current=setTimeout(function(){qr({deadline:!0})},ce))),yr}),Pn=Object(N.a)(Dn,2),Fn=Pn[0],ur=Pn[1],xn=pr(ur);Zr.current=xn,Gt(function(){Et(ue);var cr=Dr.current;if(Dr.current=!0,!q)return;var tr;!cr&&ue&&re&&(tr=It),cr&&ue&&$&&(tr=At),(cr&&!ue&&me||!cr&&Ee&&!ue&&me)&&(tr=Ot),tr&&(Xt(tr),Fn())},[ue]),Object(g.useEffect)(function(){(vt===It&&!re||vt===At&&!$||vt===Ot&&!me)&&Xt(at)},[re,$,me]),Object(g.useEffect)(function(){return function(){clearTimeout(Vr.current),gr.current=!0}},[]),Object(g.useEffect)(function(){xt!==void 0&&vt===at&&(Ft==null||Ft(xt))},[xt,vt]);var Wn=ar;return wr[gt]&&ur===Bt&&(Wn=Object(I.a)({transition:"none"},Wn)),[vt,ur,Wn,xt!=null?xt:ue]}var Sr=function(q){Object(n.a)(pe,q);var ue=Object(t.a)(pe);function pe(){return Object(p.a)(this,pe),ue.apply(this,arguments)}return Object(c.a)(pe,[{key:"render",value:function(){return this.props.children}}]),pe}(g.Component),_r=Sr;function tn(q){var ue=q;Object(k.a)(q)==="object"&&(ue=q.transitionSupport);function pe(j){return!!(j.motionName&&ue)}var ne=g.forwardRef(function(j,$){var W=j.visible,re=W===void 0?!0:W,ie=j.removeOnLeave,me=ie===void 0?!0:ie,ce=j.forceRender,Ee=j.children,De=j.motionName,Xe=j.leavedClassName,Ve=j.eventProps,it=pe(j),St=Object(g.useRef)(),Mt=Object(g.useRef)();function Rt(){try{return Object(ut.a)(St.current||Mt.current)}catch(Xt){return null}}var Ut=Kr(it,re,Rt,j),kt=Object(N.a)(Ut,4),Dt=kt[0],Pt=kt[1],Vt=kt[2],Ft=kt[3],fr=g.useRef(Ft);Ft&&(fr.current=!0);var nr=Object(g.useRef)($);nr.current=$;var xt=g.useCallback(function(Xt){St.current=Xt,Object(fe.b)(nr.current,Xt)},[]),Et,Kt=Object(I.a)(Object(I.a)({},Ve),{},{visible:re});if(!Ee)Et=null;else if(Dt===at||!pe(j))Ft?Et=Ee(Object(I.a)({},Kt),xt):!me&&fr.current?Et=Ee(Object(I.a)(Object(I.a)({},Kt),{},{className:Xe}),xt):ce?Et=Ee(Object(I.a)(Object(I.a)({},Kt),{},{style:{display:"none"}}),xt):Et=null;else{var zt,vt;Pt===gt?vt="prepare":pr(Pt)?vt="active":Pt===Bt&&(vt="start"),Et=Ee(Object(I.a)(Object(I.a)({},Kt),{},{className:U()(_t(De,Dt),(zt={},Object(oe.a)(zt,_t(De,"".concat(Dt,"-").concat(vt)),vt),Object(oe.a)(zt,De,typeof De=="string"),zt)),style:Vt}),xt)}return g.createElement(_r,{ref:Mt},Et)});return ne.displayName="CSSMotion",ne}var Ur=tn(dt),wt="add",Yr="keep",kr="remove",Hr="removed";function Br(q){var ue;return q&&Object(k.a)(q)==="object"&&"key"in q?ue=q:ue={key:q},Object(I.a)(Object(I.a)({},ue),{},{key:String(ue.key)})}function rn(){var q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return q.map(Br)}function P(){var q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],pe=[],ne=0,j=ue.length,$=rn(q),W=rn(ue);$.forEach(function(me){for(var ce=!1,Ee=ne;Ee<j;Ee+=1){var De=W[Ee];if(De.key===me.key){ne<Ee&&(pe=pe.concat(W.slice(ne,Ee).map(function(Xe){return Object(I.a)(Object(I.a)({},Xe),{},{status:wt})})),ne=Ee),pe.push(Object(I.a)(Object(I.a)({},De),{},{status:Yr})),ne+=1,ce=!0;break}}ce||pe.push(Object(I.a)(Object(I.a)({},me),{},{status:kr}))}),ne<j&&(pe=pe.concat(W.slice(ne).map(function(me){return Object(I.a)(Object(I.a)({},me),{},{status:wt})})));var re={};pe.forEach(function(me){var ce=me.key;re[ce]=(re[ce]||0)+1});var ie=Object.keys(re).filter(function(me){return re[me]>1});return ie.forEach(function(me){pe=pe.filter(function(ce){var Ee=ce.key,De=ce.status;return Ee!==me||De!==kr}),pe.forEach(function(ce){ce.key===me&&(ce.status=Yr)})}),pe}var a=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function u(q){var ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ur,pe=function(ne){Object(n.a)($,ne);var j=Object(t.a)($);function $(){var W;return Object(p.a)(this,$),W=j.apply(this,arguments),W.state={keyEntities:[]},W.removeKey=function(re){W.setState(function(ie){var me=ie.keyEntities;return{keyEntities:me.map(function(ce){return ce.key!==re?ce:Object(I.a)(Object(I.a)({},ce),{},{status:Hr})})}})},W}return Object(c.a)($,[{key:"render",value:function(){var re=this,ie=this.state.keyEntities,me=this.props,ce=me.component,Ee=me.children,De=me.onVisibleChanged,Xe=Object(S.a)(me,["component","children","onVisibleChanged"]),Ve=ce||g.Fragment,it={};return a.forEach(function(St){it[St]=Xe[St],delete Xe[St]}),delete Xe.keys,g.createElement(Ve,Xe,ie.map(function(St){var Mt=St.status,Rt=Object(S.a)(St,["status"]),Ut=Mt===wt||Mt===Yr;return g.createElement(ue,Object(l.a)({},it,{key:Rt.key,visible:Ut,eventProps:Rt,onVisibleChanged:function(Dt){De==null||De(Dt,{key:Rt.key}),Dt||re.removeKey(Rt.key)}}),Ee)}))}}],[{key:"getDerivedStateFromProps",value:function(re,ie){var me=re.keys,ce=ie.keyEntities,Ee=rn(me),De=P(ce,Ee);return{keyEntities:De.filter(function(Xe){var Ve=ce.find(function(it){var St=it.key;return Xe.key===St});return!(Ve&&Ve.status===Hr&&Xe.status===kr)})}}}]),$}(g.Component);return pe.defaultProps={component:"div"},pe}var D=u(dt),B=Ur;function L(q){var ue=q.prefixCls,pe=q.motion,ne=q.animation,j=q.transitionName;return pe||(ne?{motionName:"".concat(ue,"-").concat(ne)}:j?{motionName:j}:null)}function se(q){var ue=q.prefixCls,pe=q.visible,ne=q.zIndex,j=q.mask,$=q.maskMotion,W=q.maskAnimation,re=q.maskTransitionName;if(!j)return null;var ie={};return($||re||W)&&(ie=Object(I.a)({motionAppear:!0},L({motion:$,prefixCls:ue,transitionName:re,animation:W}))),g.createElement(B,Object(l.a)({},ie,{visible:pe,removeOnLeave:!0}),function(me){var ce=me.className;return g.createElement("div",{style:{zIndex:ne},className:U()("".concat(ue,"-mask"),ce)})})}var Ie=K("9mu1"),tt=K("o0o1"),pt=K.n(tt),Be=K("HaE+"),bt=["measure","align",null,"motion"],Tt=function(q,ue){var pe=Object(g.useState)(null),ne=Object(N.a)(pe,2),j=ne[0],$=ne[1],W=Object(g.useRef)(),re=Object(g.useRef)(!1);function ie(Ee){re.current||$(Ee)}function me(){rt.a.cancel(W.current)}function ce(Ee){me(),W.current=Object(rt.a)(function(){ie(function(De){switch(j){case"align":return"motion";case"motion":return"stable";default:}return De}),Ee==null||Ee()})}return Object(g.useEffect)(function(){ie("measure")},[q]),Object(g.useEffect)(function(){switch(j){case"measure":ue();break;default:}j&&(W.current=Object(rt.a)(Object(Be.a)(pt.a.mark(function Ee(){var De,Xe;return pt.a.wrap(function(it){for(;;)switch(it.prev=it.next){case 0:De=bt.indexOf(j),Xe=bt[De+1],Xe&&De!==-1&&ie(Xe);case 3:case"end":return it.stop()}},Ee)}))))},[j]),Object(g.useEffect)(function(){return function(){re.current=!0,me()}},[]),[j,ce]},Qt=function(q){var ue=g.useState({width:0,height:0}),pe=Object(N.a)(ue,2),ne=pe[0],j=pe[1];function $(re){j({width:re.offsetWidth,height:re.offsetHeight})}var W=g.useMemo(function(){var re={};if(q){var ie=ne.width,me=ne.height;q.indexOf("height")!==-1&&me?re.height=me:q.indexOf("minHeight")!==-1&&me&&(re.minHeight=me),q.indexOf("width")!==-1&&ie?re.width=ie:q.indexOf("minWidth")!==-1&&ie&&(re.minWidth=ie)}return re},[q,ne]);return[W,$]},Ae=g.forwardRef(function(q,ue){var pe=q.visible,ne=q.prefixCls,j=q.className,$=q.style,W=q.children,re=q.zIndex,ie=q.stretch,me=q.destroyPopupOnHide,ce=q.forceRender,Ee=q.align,De=q.point,Xe=q.getRootDomNode,Ve=q.getClassNameFromAlign,it=q.onAlign,St=q.onMouseEnter,Mt=q.onMouseLeave,Rt=q.onMouseDown,Ut=q.onTouchStart,kt=Object(g.useRef)(),Dt=Object(g.useRef)(),Pt=Object(g.useState)(),Vt=Object(N.a)(Pt,2),Ft=Vt[0],fr=Vt[1],nr=Qt(ie),xt=Object(N.a)(nr,2),Et=xt[0],Kt=xt[1];function zt(){ie&&Kt(Xe())}var vt=Tt(pe,zt),Xt=Object(N.a)(vt,2),dr=Xt[0],$t=Xt[1],ar=Object(g.useRef)();function hr(){return De||Xe}function Dr(){var Cr;(Cr=kt.current)===null||Cr===void 0||Cr.forceAlign()}function Vr(Cr,Wr){var Pr=Ve(Wr);Ft!==Pr&&fr(Pr),dr==="align"&&(Ft!==Pr?Promise.resolve().then(function(){Dr()}):$t(function(){var wr;(wr=ar.current)===null||wr===void 0||wr.call(ar)}),it==null||it(Cr,Wr))}var gr=Object(I.a)({},L(q));["onAppearEnd","onEnterEnd","onLeaveEnd"].forEach(function(Cr){var Wr=gr[Cr];gr[Cr]=function(Pr,wr){return $t(),Wr==null?void 0:Wr(Pr,wr)}});function Xr(){return new Promise(function(Cr){ar.current=Cr})}g.useEffect(function(){!gr.motionName&&dr==="motion"&&$t()},[gr.motionName,dr]),g.useImperativeHandle(ue,function(){return{forceAlign:Dr,getElement:function(){return Dt.current}}});var yn=Object(I.a)(Object(I.a)({},Et),{},{zIndex:re,opacity:dr==="motion"||dr==="stable"||!pe?void 0:0,pointerEvents:dr==="stable"?void 0:"none"},$),Zr=!0;(Ee==null?void 0:Ee.points)&&(dr==="align"||dr==="stable")&&(Zr=!1);var qr=W;return g.Children.count(W)>1&&(qr=g.createElement("div",{className:"".concat(ne,"-content")},W)),g.createElement(B,Object(l.a)({visible:pe,ref:Dt,leavedClassName:"".concat(ne,"-hidden")},gr,{onAppearPrepare:Xr,onEnterPrepare:Xr,removeOnLeave:me,forceRender:ce}),function(Cr,Wr){var Pr=Cr.className,wr=Cr.style,Dn=U()(ne,j,Ft,Pr);return g.createElement(Ie.a,{target:hr(),key:"popup",ref:kt,monitorWindowResize:!0,disabled:Zr,align:Ee,onAlign:Vr},g.createElement("div",{ref:Wr,className:Dn,onMouseEnter:St,onMouseLeave:Mt,onMouseDownCapture:Rt,onTouchStartCapture:Ut,style:Object(I.a)(Object(I.a)({},wr),yn)},qr))})});Ae.displayName="PopupInner";var br=Ae,sr=g.forwardRef(function(q,ue){var pe=q.prefixCls,ne=q.visible,j=q.zIndex,$=q.children,W=q.mobile;W=W===void 0?{}:W;var re=W.popupClassName,ie=W.popupStyle,me=W.popupMotion,ce=me===void 0?{}:me,Ee=W.popupRender,De=g.useRef();g.useImperativeHandle(ue,function(){return{forceAlign:function(){},getElement:function(){return De.current}}});var Xe=Object(I.a)({zIndex:j},ie),Ve=$;return g.Children.count($)>1&&(Ve=g.createElement("div",{className:"".concat(pe,"-content")},$)),Ee&&(Ve=Ee(Ve)),g.createElement(B,Object(l.a)({visible:ne,ref:De,removeOnLeave:!0},ce),function(it,St){var Mt=it.className,Rt=it.style,Ut=U()(pe,re,Mt);return g.createElement("div",{ref:St,className:Ut,style:Object(I.a)(Object(I.a)({},Rt),Xe)},Ve)})});sr.displayName="MobilePopupInner";var Rr=sr,Cn=["visible","mobile"],nn=g.forwardRef(function(q,ue){var pe=q.visible,ne=q.mobile,j=Object(S.a)(q,Cn),$=Object(g.useState)(pe),W=Object(N.a)($,2),re=W[0],ie=W[1],me=Object(g.useState)(!1),ce=Object(N.a)(me,2),Ee=ce[0],De=ce[1],Xe=Object(I.a)(Object(I.a)({},j),{},{visible:re});Object(g.useEffect)(function(){ie(pe),pe&&ne&&De(ae())},[pe,ne]);var Ve=Ee?g.createElement(Rr,Object(l.a)({},Xe,{mobile:ne,ref:ue})):g.createElement(br,Object(l.a)({},Xe,{ref:ue}));return g.createElement("div",null,g.createElement(se,Xe),Ve)});nn.displayName="Popup";var jr=nn,Qr=g.createContext(null),zr=Qr;function an(){}function Tn(){return""}function hn(q){return q?q.ownerDocument:window.document}var bn=["onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur","onContextMenu"];function Mn(q){var ue=function(pe){Object(n.a)(j,pe);var ne=Object(t.a)(j);function j($){var W;Object(p.a)(this,j),W=ne.call(this,$),W.popupRef=g.createRef(),W.triggerRef=g.createRef(),W.attachId=void 0,W.clickOutsideHandler=void 0,W.touchOutsideHandler=void 0,W.contextMenuOutsideHandler1=void 0,W.contextMenuOutsideHandler2=void 0,W.mouseDownTimeout=void 0,W.focusTime=void 0,W.preClickTime=void 0,W.preTouchTime=void 0,W.delayTimer=void 0,W.hasPopupMouseDown=void 0,W.onMouseEnter=function(ie){var me=W.props.mouseEnterDelay;W.fireEvents("onMouseEnter",ie),W.delaySetPopupVisible(!0,me,me?null:ie)},W.onMouseMove=function(ie){W.fireEvents("onMouseMove",ie),W.setPoint(ie)},W.onMouseLeave=function(ie){W.fireEvents("onMouseLeave",ie),W.delaySetPopupVisible(!1,W.props.mouseLeaveDelay)},W.onPopupMouseEnter=function(){W.clearDelayTimer()},W.onPopupMouseLeave=function(ie){var me;if(ie.relatedTarget&&!ie.relatedTarget.setTimeout&&Object(ht.a)((me=W.popupRef.current)===null||me===void 0?void 0:me.getElement(),ie.relatedTarget))return;W.delaySetPopupVisible(!1,W.props.mouseLeaveDelay)},W.onFocus=function(ie){W.fireEvents("onFocus",ie),W.clearDelayTimer(),W.isFocusToShow()&&(W.focusTime=Date.now(),W.delaySetPopupVisible(!0,W.props.focusDelay))},W.onMouseDown=function(ie){W.fireEvents("onMouseDown",ie),W.preClickTime=Date.now()},W.onTouchStart=function(ie){W.fireEvents("onTouchStart",ie),W.preTouchTime=Date.now()},W.onBlur=function(ie){W.fireEvents("onBlur",ie),W.clearDelayTimer(),W.isBlurToHide()&&W.delaySetPopupVisible(!1,W.props.blurDelay)},W.onContextMenu=function(ie){ie.preventDefault(),W.fireEvents("onContextMenu",ie),W.setPopupVisible(!0,ie)},W.onContextMenuClose=function(){W.isContextMenuToShow()&&W.close()},W.onClick=function(ie){if(W.fireEvents("onClick",ie),W.focusTime){var me;if(W.preClickTime&&W.preTouchTime?me=Math.min(W.preClickTime,W.preTouchTime):W.preClickTime?me=W.preClickTime:W.preTouchTime&&(me=W.preTouchTime),Math.abs(me-W.focusTime)<20)return;W.focusTime=0}W.preClickTime=0,W.preTouchTime=0,W.isClickToShow()&&(W.isClickToHide()||W.isBlurToHide())&&ie&&ie.preventDefault&&ie.preventDefault();var ce=!W.state.popupVisible;(W.isClickToHide()&&!ce||ce&&W.isClickToShow())&&W.setPopupVisible(!W.state.popupVisible,ie)},W.onPopupMouseDown=function(){if(W.hasPopupMouseDown=!0,clearTimeout(W.mouseDownTimeout),W.mouseDownTimeout=window.setTimeout(function(){W.hasPopupMouseDown=!1},0),W.context){var ie;(ie=W.context).onPopupMouseDown.apply(ie,arguments)}},W.onDocumentClick=function(ie){if(W.props.mask&&!W.props.maskClosable)return;var me=ie.target,ce=W.getRootDomNode(),Ee=W.getPopupDomNode();(!Object(ht.a)(ce,me)||W.isContextMenuOnly())&&!Object(ht.a)(Ee,me)&&!W.hasPopupMouseDown&&W.close()},W.getRootDomNode=function(){var ie=W.props.getTriggerDOMNode;if(ie)return ie(W.triggerRef.current);try{var me=Object(ut.a)(W.triggerRef.current);if(me)return me}catch(ce){}return st.a.findDOMNode(Object(i.a)(W))},W.getPopupClassNameFromAlign=function(ie){var me=[],ce=W.props,Ee=ce.popupPlacement,De=ce.builtinPlacements,Xe=ce.prefixCls,Ve=ce.alignPoint,it=ce.getPopupClassNameFromAlign;return Ee&&De&&me.push(Oe(De,Xe,ie,Ve)),it&&me.push(it(ie)),me.join(" ")},W.getComponent=function(){var ie=W.props,me=ie.prefixCls,ce=ie.destroyPopupOnHide,Ee=ie.popupClassName,De=ie.onPopupAlign,Xe=ie.popupMotion,Ve=ie.popupAnimation,it=ie.popupTransitionName,St=ie.popupStyle,Mt=ie.mask,Rt=ie.maskAnimation,Ut=ie.maskTransitionName,kt=ie.maskMotion,Dt=ie.zIndex,Pt=ie.popup,Vt=ie.stretch,Ft=ie.alignPoint,fr=ie.mobile,nr=ie.forceRender,xt=W.state,Et=xt.popupVisible,Kt=xt.point,zt=W.getPopupAlign(),vt={};return W.isMouseEnterToShow()&&(vt.onMouseEnter=W.onPopupMouseEnter),W.isMouseLeaveToHide()&&(vt.onMouseLeave=W.onPopupMouseLeave),vt.onMouseDown=W.onPopupMouseDown,vt.onTouchStart=W.onPopupMouseDown,g.createElement(jr,Object(l.a)({prefixCls:me,destroyPopupOnHide:ce,visible:Et,point:Ft&&Kt,className:Ee,align:zt,onAlign:De,animation:Ve,getClassNameFromAlign:W.getPopupClassNameFromAlign},vt,{stretch:Vt,getRootDomNode:W.getRootDomNode,style:St,mask:Mt,zIndex:Dt,transitionName:it,maskAnimation:Rt,maskTransitionName:Ut,maskMotion:kt,ref:W.popupRef,motion:Xe,mobile:fr,forceRender:nr}),typeof Pt=="function"?Pt():Pt)},W.attachParent=function(ie){rt.a.cancel(W.attachId);var me=W.props,ce=me.getPopupContainer,Ee=me.getDocument,De=W.getRootDomNode(),Xe;ce?(De||ce.length===0)&&(Xe=ce(De)):Xe=Ee(W.getRootDomNode()).body,Xe?Xe.appendChild(ie):W.attachId=Object(rt.a)(function(){W.attachParent(ie)})},W.getContainer=function(){var ie=W.props.getDocument,me=ie(W.getRootDomNode()).createElement("div");return me.style.position="absolute",me.style.top="0",me.style.left="0",me.style.width="100%",W.attachParent(me),me},W.setPoint=function(ie){var me=W.props.alignPoint;if(!me||!ie)return;W.setState({point:{pageX:ie.pageX,pageY:ie.pageY}})},W.handlePortalUpdate=function(){W.state.prevPopupVisible!==W.state.popupVisible&&W.props.afterPopupVisibleChange(W.state.popupVisible)},W.triggerContextValue={onPopupMouseDown:W.onPopupMouseDown};var re;return"popupVisible"in $?re=!!$.popupVisible:re=!!$.defaultPopupVisible,W.state={prevPopupVisible:re,popupVisible:re},bn.forEach(function(ie){W["fire".concat(ie)]=function(me){W.fireEvents(ie,me)}}),W}return Object(c.a)(j,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var W=this.props,re=this.state;if(re.popupVisible){var ie;!this.clickOutsideHandler&&(this.isClickToHide()||this.isContextMenuToShow())&&(ie=W.getDocument(this.getRootDomNode()),this.clickOutsideHandler=Object(be.a)(ie,"mousedown",this.onDocumentClick)),this.touchOutsideHandler||(ie=ie||W.getDocument(this.getRootDomNode()),this.touchOutsideHandler=Object(be.a)(ie,"touchstart",this.onDocumentClick)),!this.contextMenuOutsideHandler1&&this.isContextMenuToShow()&&(ie=ie||W.getDocument(this.getRootDomNode()),this.contextMenuOutsideHandler1=Object(be.a)(ie,"scroll",this.onContextMenuClose)),!this.contextMenuOutsideHandler2&&this.isContextMenuToShow()&&(this.contextMenuOutsideHandler2=Object(be.a)(window,"blur",this.onContextMenuClose));return}this.clearOutsideHandler()}},{key:"componentWillUnmount",value:function(){this.clearDelayTimer(),this.clearOutsideHandler(),clearTimeout(this.mouseDownTimeout),rt.a.cancel(this.attachId)}},{key:"getPopupDomNode",value:function(){var W;return((W=this.popupRef.current)===null||W===void 0?void 0:W.getElement())||null}},{key:"getPopupAlign",value:function(){var W=this.props,re=W.popupPlacement,ie=W.popupAlign,me=W.builtinPlacements;return re&&me?xe(me,re,ie):ie}},{key:"setPopupVisible",value:function(W,re){var ie=this.props.alignPoint,me=this.state.popupVisible;this.clearDelayTimer(),me!==W&&("popupVisible"in this.props||this.setState({popupVisible:W,prevPopupVisible:me}),this.props.onPopupVisibleChange(W)),ie&&re&&W&&this.setPoint(re)}},{key:"delaySetPopupVisible",value:function(W,re,ie){var me=this,ce=re*1e3;if(this.clearDelayTimer(),ce){var Ee=ie?{pageX:ie.pageX,pageY:ie.pageY}:null;this.delayTimer=window.setTimeout(function(){me.setPopupVisible(W,Ee),me.clearDelayTimer()},ce)}else this.setPopupVisible(W,ie)}},{key:"clearDelayTimer",value:function(){this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=null)}},{key:"clearOutsideHandler",value:function(){this.clickOutsideHandler&&(this.clickOutsideHandler.remove(),this.clickOutsideHandler=null),this.contextMenuOutsideHandler1&&(this.contextMenuOutsideHandler1.remove(),this.contextMenuOutsideHandler1=null),this.contextMenuOutsideHandler2&&(this.contextMenuOutsideHandler2.remove(),this.contextMenuOutsideHandler2=null),this.touchOutsideHandler&&(this.touchOutsideHandler.remove(),this.touchOutsideHandler=null)}},{key:"createTwoChains",value:function(W){var re=this.props.children.props,ie=this.props;return re[W]&&ie[W]?this["fire".concat(W)]:re[W]||ie[W]}},{key:"isClickToShow",value:function(){var W=this.props,re=W.action,ie=W.showAction;return re.indexOf("click")!==-1||ie.indexOf("click")!==-1}},{key:"isContextMenuOnly",value:function(){var W=this.props.action;return W==="contextMenu"||W.length===1&&W[0]==="contextMenu"}},{key:"isContextMenuToShow",value:function(){var W=this.props,re=W.action,ie=W.showAction;return re.indexOf("contextMenu")!==-1||ie.indexOf("contextMenu")!==-1}},{key:"isClickToHide",value:function(){var W=this.props,re=W.action,ie=W.hideAction;return re.indexOf("click")!==-1||ie.indexOf("click")!==-1}},{key:"isMouseEnterToShow",value:function(){var W=this.props,re=W.action,ie=W.showAction;return re.indexOf("hover")!==-1||ie.indexOf("mouseEnter")!==-1}},{key:"isMouseLeaveToHide",value:function(){var W=this.props,re=W.action,ie=W.hideAction;return re.indexOf("hover")!==-1||ie.indexOf("mouseLeave")!==-1}},{key:"isFocusToShow",value:function(){var W=this.props,re=W.action,ie=W.showAction;return re.indexOf("focus")!==-1||ie.indexOf("focus")!==-1}},{key:"isBlurToHide",value:function(){var W=this.props,re=W.action,ie=W.hideAction;return re.indexOf("focus")!==-1||ie.indexOf("blur")!==-1}},{key:"forcePopupAlign",value:function(){if(this.state.popupVisible){var W;(W=this.popupRef.current)===null||W===void 0||W.forceAlign()}}},{key:"fireEvents",value:function(W,re){var ie=this.props.children.props[W];ie&&ie(re);var me=this.props[W];me&&me(re)}},{key:"close",value:function(){this.setPopupVisible(!1)}},{key:"render",value:function(){var W=this.state.popupVisible,re=this.props,ie=re.children,me=re.forceRender,ce=re.alignPoint,Ee=re.className,De=re.autoDestroy,Xe=g.Children.only(ie),Ve={key:"trigger"};this.isContextMenuToShow()?Ve.onContextMenu=this.onContextMenu:Ve.onContextMenu=this.createTwoChains("onContextMenu"),this.isClickToHide()||this.isClickToShow()?(Ve.onClick=this.onClick,Ve.onMouseDown=this.onMouseDown,Ve.onTouchStart=this.onTouchStart):(Ve.onClick=this.createTwoChains("onClick"),Ve.onMouseDown=this.createTwoChains("onMouseDown"),Ve.onTouchStart=this.createTwoChains("onTouchStart")),this.isMouseEnterToShow()?(Ve.onMouseEnter=this.onMouseEnter,ce&&(Ve.onMouseMove=this.onMouseMove)):Ve.onMouseEnter=this.createTwoChains("onMouseEnter"),this.isMouseLeaveToHide()?Ve.onMouseLeave=this.onMouseLeave:Ve.onMouseLeave=this.createTwoChains("onMouseLeave"),this.isFocusToShow()||this.isBlurToHide()?(Ve.onFocus=this.onFocus,Ve.onBlur=this.onBlur):(Ve.onFocus=this.createTwoChains("onFocus"),Ve.onBlur=this.createTwoChains("onBlur"));var it=U()(Xe&&Xe.props&&Xe.props.className,Ee);it&&(Ve.className=it);var St=Object(I.a)({},Ve);Object(fe.c)(Xe)&&(St.ref=Object(fe.a)(this.triggerRef,Xe.ref));var Mt=g.cloneElement(Xe,St),Rt;return(W||this.popupRef.current||me)&&(Rt=g.createElement(q,{key:"portal",getContainer:this.getContainer,didUpdate:this.handlePortalUpdate},this.getComponent())),!W&&De&&(Rt=null),g.createElement(zr.Provider,{value:this.triggerContextValue},Mt,Rt)}}],[{key:"getDerivedStateFromProps",value:function(W,re){var ie=W.popupVisible,me={};return ie!==void 0&&re.popupVisible!==ie&&(me.popupVisible=ie,me.prevPopupVisible=re.popupVisible),me}}]),j}(g.Component);return ue.contextType=zr,ue.defaultProps={prefixCls:"rc-trigger-popup",getPopupClassNameFromAlign:Tn,getDocument:hn,onPopupVisibleChange:an,afterPopupVisibleChange:an,onPopupAlign:an,popupClassName:"",mouseEnterDelay:0,mouseLeaveDelay:.1,focusDelay:0,blurDelay:.15,popupStyle:{},destroyPopupOnHide:!1,popupAlign:{},defaultPopupVisible:!1,mask:!1,maskClosable:!0,action:[],showAction:[],hideAction:[],autoDestroy:!1},ue}var on=Mn(we.a),Er={adjustX:1,adjustY:1},Jr={topLeft:{points:["bl","tl"],overflow:Er,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:Er,offset:[0,7]},leftTop:{points:["tr","tl"],overflow:Er,offset:[-4,0]},rightTop:{points:["tl","tr"],overflow:Er,offset:[4,0]}},Sn={topLeft:{points:["bl","tl"],overflow:Er,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:Er,offset:[0,7]},rightTop:{points:["tr","tl"],overflow:Er,offset:[-4,0]},leftTop:{points:["tl","tr"],overflow:Er,offset:[4,0]}},fn=Jr,qt=0,Lt={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"},lr=function(ue,pe,ne){var j=Pe(pe),$=ue.getState();ue.setState({defaultActiveFirst:Object(I.a)(Object(I.a)({},$.defaultActiveFirst),{},Object(oe.a)({},j,ne))})},jt=function(q){Object(n.a)(pe,q);var ue=Object(t.a)(pe);function pe(ne){var j;Object(p.a)(this,pe),j=ue.call(this,ne),j.onDestroy=function(ce){j.props.onDestroy(ce)},j.onKeyDown=function(ce){var Ee=ce.keyCode,De=j.menuInstance,Xe=j.props.store,Ve=j.getVisible();if(Ee===v.a.ENTER)return j.onTitleClick(ce),lr(Xe,j.props.eventKey,!0),!0;if(Ee===v.a.RIGHT)return Ve?De.onKeyDown(ce):(j.triggerOpenChange(!0),lr(Xe,j.props.eventKey,!0)),!0;if(Ee===v.a.LEFT){var it;if(Ve)it=De.onKeyDown(ce);else return;return it||(j.triggerOpenChange(!1),it=!0),it}return Ve&&(Ee===v.a.UP||Ee===v.a.DOWN)?De.onKeyDown(ce):void 0},j.onOpenChange=function(ce){j.props.onOpenChange(ce)},j.onPopupVisibleChange=function(ce){j.triggerOpenChange(ce,ce?"mouseenter":"mouseleave")},j.onMouseEnter=function(ce){var Ee=j.props,De=Ee.eventKey,Xe=Ee.onMouseEnter,Ve=Ee.store;lr(Ve,j.props.eventKey,!1),Xe({key:De,domEvent:ce})},j.onMouseLeave=function(ce){var Ee=j.props,De=Ee.parentMenu,Xe=Ee.eventKey,Ve=Ee.onMouseLeave;De.subMenuInstance=Object(i.a)(j),Ve({key:Xe,domEvent:ce})},j.onTitleMouseEnter=function(ce){var Ee=j.props,De=Ee.eventKey,Xe=Ee.onItemHover,Ve=Ee.onTitleMouseEnter;Xe({key:De,hover:!0}),Ve({key:De,domEvent:ce})},j.onTitleMouseLeave=function(ce){var Ee=j.props,De=Ee.parentMenu,Xe=Ee.eventKey,Ve=Ee.onItemHover,it=Ee.onTitleMouseLeave;De.subMenuInstance=Object(i.a)(j),Ve({key:Xe,hover:!1}),it({key:Xe,domEvent:ce})},j.onTitleClick=function(ce){var Ee=Object(i.a)(j),De=Ee.props;if(De.onTitleClick({key:De.eventKey,domEvent:ce}),De.triggerSubMenuAction==="hover")return;j.triggerOpenChange(!j.getVisible(),"click"),lr(De.store,j.props.eventKey,!1)},j.onSubMenuClick=function(ce){typeof j.props.onClick=="function"&&j.props.onClick(j.addKeyPath(ce))},j.onSelect=function(ce){j.props.onSelect(ce)},j.onDeselect=function(ce){j.props.onDeselect(ce)},j.getPrefixCls=function(){return"".concat(j.props.rootPrefixCls,"-submenu")},j.getActiveClassName=function(){return"".concat(j.getPrefixCls(),"-active")},j.getDisabledClassName=function(){return"".concat(j.getPrefixCls(),"-disabled")},j.getSelectedClassName=function(){return"".concat(j.getPrefixCls(),"-selected")},j.getOpenClassName=function(){return"".concat(j.props.rootPrefixCls,"-submenu-open")},j.getVisible=function(){return j.state.isOpen},j.getMode=function(){return j.state.mode},j.saveMenuInstance=function(ce){j.menuInstance=ce},j.addKeyPath=function(ce){return Object(I.a)(Object(I.a)({},ce),{},{keyPath:(ce.keyPath||[]).concat(j.props.eventKey)})},j.triggerOpenChange=function(ce,Ee){var De=j.props.eventKey,Xe=function(){j.onOpenChange({key:De,item:Object(i.a)(j),trigger:Ee,open:ce})};Ee==="mouseenter"?j.mouseenterTimeout=setTimeout(function(){Xe()},0):Xe()},j.isChildrenSelected=function(){var ce={find:!1};return Qe(j.props.children,j.props.selectedKeys,ce),ce.find},j.isInlineMode=function(){return j.getMode()==="inline"},j.adjustWidth=function(){if(!j.subMenuTitle||!j.menuInstance)return;var ce=ot.findDOMNode(j.menuInstance);if(ce.offsetWidth>=j.subMenuTitle.offsetWidth)return;ce.style.minWidth="".concat(j.subMenuTitle.offsetWidth,"px")},j.saveSubMenuTitle=function(ce){j.subMenuTitle=ce},j.getBaseProps=function(){var ce=Object(i.a)(j),Ee=ce.props,De=j.getMode();return{mode:De==="horizontal"?"vertical":De,visible:j.getVisible(),level:Ee.level+1,inlineIndent:Ee.inlineIndent,focusable:!1,onClick:j.onSubMenuClick,onSelect:j.onSelect,onDeselect:j.onDeselect,onDestroy:j.onDestroy,selectedKeys:Ee.selectedKeys,eventKey:"".concat(Ee.eventKey,"-menu-"),openKeys:Ee.openKeys,motion:Ee.motion,onOpenChange:j.onOpenChange,subMenuOpenDelay:Ee.subMenuOpenDelay,parentMenu:Object(i.a)(j),subMenuCloseDelay:Ee.subMenuCloseDelay,forceSubMenuRender:Ee.forceSubMenuRender,triggerSubMenuAction:Ee.triggerSubMenuAction,builtinPlacements:Ee.builtinPlacements,defaultActiveFirst:Ee.store.getState().defaultActiveFirst[Pe(Ee.eventKey)],multiple:Ee.multiple,prefixCls:Ee.rootPrefixCls,id:j.internalMenuId,manualRef:j.saveMenuInstance,itemIcon:Ee.itemIcon,expandIcon:Ee.expandIcon,direction:Ee.direction}},j.getMotion=function(ce,Ee){var De=Object(i.a)(j),Xe=De.haveRendered,Ve=j.props,it=Ve.motion,St=Ve.rootPrefixCls,Mt=Object(I.a)(Object(I.a)({},it),{},{leavedClassName:"".concat(St,"-hidden"),removeOnLeave:!1,motionAppear:Xe||!Ee||ce!=="inline"});return Mt};var $=ne.store,W=ne.eventKey,re=$.getState(),ie=re.defaultActiveFirst;j.isRootMenu=!1;var me=!1;return ie&&(me=ie[W]),lr($,W,me),j.state={mode:ne.mode,isOpen:ne.isOpen},j}return Object(c.a)(pe,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var j=this,$=this.props,W=$.mode,re=$.parentMenu,ie=$.manualRef,me=$.isOpen,ce=function(){j.setState({mode:W,isOpen:me})},Ee=me!==this.state.isOpen,De=W!==this.state.mode;if((De||Ee)&&(rt.a.cancel(this.updateStateRaf),De?this.updateStateRaf=Object(rt.a)(ce):ce()),ie&&ie(this),W!=="horizontal"||!(re==null?void 0:re.isRootMenu)||!me)return;this.minWidthTimeout=setTimeout(function(){return j.adjustWidth()},0)}},{key:"componentWillUnmount",value:function(){var j=this.props,$=j.onDestroy,W=j.eventKey;$&&$(W),this.minWidthTimeout&&clearTimeout(this.minWidthTimeout),this.mouseenterTimeout&&clearTimeout(this.mouseenterTimeout),rt.a.cancel(this.updateStateRaf)}},{key:"renderPopupMenu",value:function(j,$){var W=this.getBaseProps();return g.createElement(wn,Object(l.a)({},W,{id:this.internalMenuId,className:j,style:$}),this.props.children)}},{key:"renderChildren",value:function(){var j=this,$=this.getBaseProps(),W=$.mode,re=$.visible,ie=$.forceSubMenuRender,me=$.direction,ce=this.getMotion(W,re);if(this.haveRendered=!0,this.haveOpened=this.haveOpened||re||ie,!this.haveOpened)return g.createElement("div",null);var Ee=U()("".concat($.prefixCls,"-sub"),Object(oe.a)({},"".concat($.prefixCls,"-rtl"),me==="rtl"));return this.isInlineMode()?g.createElement(B,Object(l.a)({visible:$.visible,forceRender:ie},ce),function(De){var Xe=De.className,Ve=De.style,it=U()(Ee,Xe);return j.renderPopupMenu(it,Ve)}):this.renderPopupMenu(Ee)}},{key:"render",value:function(){var j,$,W,re=Object(I.a)({},this.props),ie=this.getVisible(),me=this.getPrefixCls(),ce=this.isInlineMode(),Ee=this.getMode(),De=U()(me,"".concat(me,"-").concat(Ee),(j={},Object(oe.a)(j,re.className,!!re.className),Object(oe.a)(j,this.getOpenClassName(),ie),Object(oe.a)(j,this.getActiveClassName(),re.active||ie&&!ce),Object(oe.a)(j,this.getDisabledClassName(),re.disabled),Object(oe.a)(j,this.getSelectedClassName(),this.isChildrenSelected()),j));this.internalMenuId||(re.eventKey?this.internalMenuId="".concat(re.eventKey,"$Menu"):(qt+=1,this.internalMenuId="$__$".concat(qt,"$Menu")));var Xe={},Ve={},it={};re.disabled||(Xe={onMouseLeave:this.onMouseLeave,onMouseEnter:this.onMouseEnter},Ve={onClick:this.onTitleClick},it={onMouseEnter:this.onTitleMouseEnter,onMouseLeave:this.onTitleMouseLeave});var St={},Mt=re.direction,Rt=Mt==="rtl";ce&&(Rt?St.paddingRight=re.inlineIndent*re.level:St.paddingLeft=re.inlineIndent*re.level);var Ut={};this.getVisible()&&(Ut={"aria-owns":this.internalMenuId});var kt=null;Ee!=="horizontal"&&(kt=this.props.expandIcon,typeof this.props.expandIcon=="function"&&(kt=g.createElement(this.props.expandIcon,Object(I.a)({},this.props))));var Dt=g.createElement("div",Object(l.a)({ref:this.saveSubMenuTitle,style:St,className:"".concat(me,"-title"),role:"button"},it,Ve,{"aria-expanded":ie},Ut,{"aria-haspopup":"true",title:typeof re.title=="string"?re.title:void 0}),re.title,kt||g.createElement("i",{className:"".concat(me,"-arrow")})),Pt=this.renderChildren(),Vt=(($=re.parentMenu)===null||$===void 0?void 0:$.isRootMenu)?re.parentMenu.props.getPopupContainer:function(hr){return hr.parentNode},Ft=Lt[Ee],fr=re.popupOffset?{offset:re.popupOffset}:{},nr=U()((W={},Object(oe.a)(W,re.popupClassName,re.popupClassName&&!ce),Object(oe.a)(W,"".concat(me,"-rtl"),Rt),W)),xt=re.disabled,Et=re.triggerSubMenuAction,Kt=re.subMenuOpenDelay,zt=re.forceSubMenuRender,vt=re.subMenuCloseDelay,Xt=re.builtinPlacements;Ze.forEach(function(hr){return delete re[hr]}),delete re.onClick;var dr=Rt?Object(I.a)(Object(I.a)({},Sn),Xt):Object(I.a)(Object(I.a)({},Jr),Xt);delete re.direction;var $t=this.getBaseProps(),ar=ce?null:this.getMotion($t.mode,$t.visible);return g.createElement("li",Object(l.a)({},re,Xe,{className:De,role:"menuitem"}),g.createElement(on,{prefixCls:me,popupClassName:U()("".concat(me,"-popup"),nr),getPopupContainer:Vt,builtinPlacements:dr,popupPlacement:Ft,popupVisible:ce?!1:ie,popupAlign:fr,popup:ce?null:Pt,action:xt||ce?[]:[Et],mouseEnterDelay:Kt,mouseLeaveDelay:vt,onPopupVisibleChange:this.onPopupVisibleChange,forceRender:zt,popupMotion:ar},Dt),ce?Pt:null)}}]),pe}(g.Component);jt.defaultProps={onMouseEnter:Ke,onMouseLeave:Ke,onTitleMouseEnter:Ke,onTitleMouseLeave:Ke,onTitleClick:Ke,manualRef:Ke,mode:"vertical",title:""};var mr=Object(e.b)(function(q,ue){var pe=q.openKeys,ne=q.activeKey,j=q.selectedKeys,$=ue.eventKey,W=ue.subMenuKey;return{isOpen:pe.indexOf($)>-1,active:ne[W]===$,selectedKeys:j}})(jt);mr.isSubMenu=!0;var Zt=mr,pn="menuitem-overflowed",vr=.5,En=function(q){Object(n.a)(pe,q);var ue=Object(t.a)(pe);function pe(){var ne;return Object(p.a)(this,pe),ne=ue.apply(this,arguments),ne.resizeObserver=null,ne.mutationObserver=null,ne.originalTotalWidth=0,ne.overflowedItems=[],ne.menuItemSizes=[],ne.cancelFrameId=null,ne.state={lastVisibleIndex:void 0},ne.childRef=g.createRef(),ne.getMenuItemNodes=function(){var j=ne.props.prefixCls,$=ne.childRef.current;return $?[].slice.call($.children).filter(function(W){return W.className.split(" ").indexOf("".concat(j,"-overflowed-submenu"))<0}):[]},ne.getOverflowedSubMenuItem=function(j,$,W){var re=ne.props,ie=re.overflowedIndicator,me=re.level,ce=re.mode,Ee=re.prefixCls,De=re.theme;if(me!==1||ce!=="horizontal")return null;var Xe=ne.props.children[0],Ve=Xe.props,it=Ve.children,St=Ve.title,Mt=Ve.style,Rt=Object(S.a)(Ve,["children","title","style"]),Ut=Object(I.a)({},Mt),kt="".concat(j,"-overflowed-indicator"),Dt="".concat(j,"-overflowed-indicator");$.length===0&&W!==!0?Ut=Object(I.a)(Object(I.a)({},Ut),{},{display:"none"}):W&&(Ut=Object(I.a)(Object(I.a)({},Ut),{},{visibility:"hidden",position:"absolute"}),kt="".concat(kt,"-placeholder"),Dt="".concat(Dt,"-placeholder"));var Pt=De?"".concat(Ee,"-").concat(De):"",Vt={};return Ze.forEach(function(Ft){Rt[Ft]!==void 0&&(Vt[Ft]=Rt[Ft])}),g.createElement(Zt,Object(l.a)({title:ie,className:"".concat(Ee,"-overflowed-submenu"),popupClassName:Pt},Vt,{key:kt,eventKey:Dt,disabled:!1,style:Ut}),$)},ne.setChildrenWidthAndResize=function(){if(ne.props.mode!=="horizontal")return;var j=ne.childRef.current;if(!j)return;var $=j.children;if(!$||$.length===0)return;var W=j.children[$.length-1];Ue(W,"display","inline-block");var re=ne.getMenuItemNodes(),ie=re.filter(function(me){return me.className.split(" ").indexOf(pn)>=0});ie.forEach(function(me){Ue(me,"display","inline-block")}),ne.menuItemSizes=re.map(function(me){return $e(me,!0)}),ie.forEach(function(me){Ue(me,"display","none")}),ne.overflowedIndicatorWidth=$e(j.children[j.children.length-1],!0),ne.originalTotalWidth=ne.menuItemSizes.reduce(function(me,ce){return me+ce},0),ne.handleResize(),Ue(W,"display","none")},ne.handleResize=function(){if(ne.props.mode!=="horizontal")return;var j=ne.childRef.current;if(!j)return;var $=$e(j);ne.overflowedItems=[];var W=0,re;ne.originalTotalWidth>$+vr&&(re=-1,ne.menuItemSizes.forEach(function(ie){W+=ie,W+ne.overflowedIndicatorWidth<=$&&(re+=1)})),ne.setState({lastVisibleIndex:re})},ne}return Object(c.a)(pe,[{key:"componentDidMount",value:function(){var j=this;if(this.setChildrenWidthAndResize(),this.props.level===1&&this.props.mode==="horizontal"){var $=this.childRef.current;if(!$)return;this.resizeObserver=new ct.default(function(W){W.forEach(function(){var re=j.cancelFrameId;cancelAnimationFrame(re),j.cancelFrameId=requestAnimationFrame(j.setChildrenWidthAndResize)})}),[].slice.call($.children).concat($).forEach(function(W){j.resizeObserver.observe(W)}),typeof MutationObserver!="undefined"&&(this.mutationObserver=new MutationObserver(function(){j.resizeObserver.disconnect(),[].slice.call($.children).concat($).forEach(function(W){j.resizeObserver.observe(W)}),j.setChildrenWidthAndResize()}),this.mutationObserver.observe($,{attributes:!1,childList:!0,subTree:!1}))}}},{key:"componentWillUnmount",value:function(){this.resizeObserver&&this.resizeObserver.disconnect(),this.mutationObserver&&this.mutationObserver.disconnect(),cancelAnimationFrame(this.cancelFrameId)}},{key:"renderChildren",value:function(j){var $=this,W=this.state.lastVisibleIndex;return(j||[]).reduce(function(re,ie,me){var ce=ie;if($.props.mode==="horizontal"){var Ee=$.getOverflowedSubMenuItem(ie.props.eventKey,[]);W!==void 0&&$.props.className.indexOf("".concat($.props.prefixCls,"-root"))!==-1&&(me>W&&(ce=g.cloneElement(ie,{style:{display:"none"},eventKey:"".concat(ie.props.eventKey,"-hidden"),className:"".concat(pn)})),me===W+1&&($.overflowedItems=j.slice(W+1).map(function(Xe){return g.cloneElement(Xe,{key:Xe.props.eventKey,mode:"vertical-left"})}),Ee=$.getOverflowedSubMenuItem(ie.props.eventKey,$.overflowedItems)));var De=[].concat(Object(w.a)(re),[Ee,ce]);return me===j.length-1&&De.push($.getOverflowedSubMenuItem(ie.props.eventKey,[],!0)),De}return[].concat(Object(w.a)(re),[ce])},[])}},{key:"render",value:function(){var j=this.props,$=j.visible,W=j.prefixCls,re=j.overflowedIndicator,ie=j.mode,me=j.level,ce=j.tag,Ee=j.children,De=j.theme,Xe=Object(S.a)(j,["visible","prefixCls","overflowedIndicator","mode","level","tag","children","theme"]),Ve=ce;return g.createElement(Ve,Object(l.a)({ref:this.childRef},Xe),this.renderChildren(Ee))}}]),pe}(g.Component);En.defaultProps={tag:"div",className:""};var sn=En;function mn(q){return q.length?q.every(function(ue){return!!ue.props.disabled}):!0}function ln(q,ue,pe){var ne=q.getState();q.setState({activeKey:Object(I.a)(Object(I.a)({},ne.activeKey),{},Object(oe.a)({},ue,pe))})}function Ar(q){return q.eventKey||"0-menu-"}function _n(q,ue){var pe=ue,ne=q.children,j=q.eventKey;if(pe){var $;if(We(ne,function(W,re){W&&W.props&&!W.props.disabled&&pe===Ge(W,j,re)&&($=!0)}),$)return pe}return pe=null,q.defaultActiveFirst&&We(ne,function(W,re){!pe&&W&&!W.props.disabled&&(pe=Ge(W,j,re))}),pe}function un(q){if(!q)return;var ue=this.instanceArray.indexOf(q);ue!==-1?this.instanceArray[ue]=q:this.instanceArray.push(q)}var Kn=function(q){Object(n.a)(pe,q);var ue=Object(t.a)(pe);function pe(ne){var j;return Object(p.a)(this,pe),j=ue.call(this,ne),j.onKeyDown=function($,W){var re=$.keyCode,ie;if(j.getFlatInstanceArray().forEach(function(ce){ce&&ce.props.active&&ce.onKeyDown&&(ie=ce.onKeyDown($))}),ie)return 1;var me=null;return(re===v.a.UP||re===v.a.DOWN)&&(me=j.step(re===v.a.UP?-1:1)),me?($.preventDefault(),ln(j.props.store,Ar(j.props),me.props.eventKey),typeof W=="function"&&W(me),1):void 0},j.onItemHover=function($){var W=$.key,re=$.hover;ln(j.props.store,Ar(j.props),re?W:null)},j.onDeselect=function($){j.props.onDeselect($)},j.onSelect=function($){j.props.onSelect($)},j.onClick=function($){j.props.onClick($)},j.onOpenChange=function($){j.props.onOpenChange($)},j.onDestroy=function($){j.props.onDestroy($)},j.getFlatInstanceArray=function(){return j.instanceArray},j.step=function($){var W=j.getFlatInstanceArray(),re=j.props.store.getState().activeKey[Ar(j.props)],ie=W.length;if(!ie)return null;$<0&&(W=W.concat().reverse());var me=-1;if(W.every(function(Xe,Ve){return Xe&&Xe.props.eventKey===re?(me=Ve,!1):!0}),!j.props.defaultActiveFirst&&me!==-1&&mn(W.slice(me,ie-1)))return;var ce=(me+1)%ie,Ee=ce;do{var De=W[Ee];if(!De||De.props.disabled)Ee=(Ee+1)%ie;else return De}while(Ee!==ce);return null},j.renderCommonMenuItem=function($,W,re){var ie=j.props.store.getState(),me=Object(i.a)(j),ce=me.props,Ee=Ge($,ce.eventKey,W),De=$.props;if(!De||typeof $.type=="string")return $;var Xe=Ee===ie.activeKey,Ve=Object(I.a)(Object(I.a)({mode:De.mode||ce.mode,level:ce.level,inlineIndent:ce.inlineIndent,renderMenuItem:j.renderMenuItem,rootPrefixCls:ce.prefixCls,index:W,parentMenu:ce.parentMenu,manualRef:De.disabled?void 0:Object(y.a)($.ref,un.bind(Object(i.a)(j))),eventKey:Ee,active:!De.disabled&&Xe,multiple:ce.multiple,onClick:function(St){(De.onClick||Ke)(St),j.onClick(St)},onItemHover:j.onItemHover,motion:ce.motion,subMenuOpenDelay:ce.subMenuOpenDelay,subMenuCloseDelay:ce.subMenuCloseDelay,forceSubMenuRender:ce.forceSubMenuRender,onOpenChange:j.onOpenChange,onDeselect:j.onDeselect,onSelect:j.onSelect,builtinPlacements:ce.builtinPlacements,itemIcon:De.itemIcon||j.props.itemIcon,expandIcon:De.expandIcon||j.props.expandIcon},re),{},{direction:ce.direction});return(ce.mode==="inline"||Fe())&&(Ve.triggerSubMenuAction="click"),g.cloneElement($,Object(I.a)(Object(I.a)({},Ve),{},{key:Ee||W}))},j.renderMenuItem=function($,W,re){if(!$)return null;var ie=j.props.store.getState(),me={openKeys:ie.openKeys,selectedKeys:ie.selectedKeys,triggerSubMenuAction:j.props.triggerSubMenuAction,subMenuKey:re};return j.renderCommonMenuItem($,W,me)},ne.store.setState({activeKey:Object(I.a)(Object(I.a)({},ne.store.getState().activeKey),{},Object(oe.a)({},ne.eventKey,_n(ne,ne.activeKey)))}),j.instanceArray=[],j}return Object(c.a)(pe,[{key:"componentDidMount",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"shouldComponentUpdate",value:function(j){return this.props.visible||j.visible||this.props.className!==j.className||!A()(this.props.style,j.style)}},{key:"componentDidUpdate",value:function(j){var $=this.props,W="activeKey"in $?$.activeKey:$.store.getState().activeKey[Ar($)],re=_n($,W);if(re!==W)ln($.store,Ar($),re);else if("activeKey"in j){var ie=_n(j,j.activeKey);re!==ie&&ln($.store,Ar($),re)}}},{key:"render",value:function(){var j=this,$=Object(l.a)({},this.props);this.instanceArray=[];var W=U()($.prefixCls,$.className,"".concat($.prefixCls,"-").concat($.mode)),re={className:W,role:$.role||"menu"};$.id&&(re.id=$.id),$.focusable&&(re.tabIndex=0,re.onKeyDown=this.onKeyDown);var ie=$.prefixCls,me=$.eventKey,ce=$.visible,Ee=$.level,De=$.mode,Xe=$.overflowedIndicator,Ve=$.theme;return Ze.forEach(function(it){return delete $[it]}),delete $.onClick,g.createElement(sn,Object(l.a)({},$,{prefixCls:ie,mode:De,tag:"ul",level:Ee,theme:Ve,visible:ce,overflowedIndicator:Xe},re),Object(M.a)($.children).map(function(it,St){return j.renderMenuItem(it,St,me||"0-menu-")}))}}]),pe}(g.Component);Kn.defaultProps={prefixCls:"rc-menu",className:"",mode:"vertical",level:1,inlineIndent:24,visible:!0,focusable:!0,style:{},manualRef:Ke};var Hn=Object(e.b)()(Kn),wn=Hn,vn=K("Kwbf");function kn(q,ue,pe){var ne=q.prefixCls,j=q.motion,$=q.defaultMotions,W=$===void 0?{}:$,re=q.openAnimation,ie=q.openTransitionName,me=ue.switchingModeFromInline;if(j)return j;if(Object(k.a)(re)==="object"&&re)Object(vn.a)(!1,"Object type of `openAnimation` is removed. Please use `motion` instead.");else if(typeof re=="string")return{motionName:"".concat(ne,"-open-").concat(re)};if(ie)return{motionName:ie};var ce=W[pe];return ce||(me?null:W.other)}var Fr=function(q){Object(n.a)(pe,q);var ue=Object(t.a)(pe);function pe(ne){var j;Object(p.a)(this,pe),j=ue.call(this,ne),j.onSelect=function(re){var ie=Object(i.a)(j),me=ie.props;if(me.selectable){var ce=j.store.getState(),Ee=ce.selectedKeys,De=re.key;me.multiple?Ee=Ee.concat([De]):Ee=[De],"selectedKeys"in me||j.store.setState({selectedKeys:Ee}),me.onSelect(Object(I.a)(Object(I.a)({},re),{},{selectedKeys:Ee}))}},j.onClick=function(re){var ie=j.getRealMenuMode(),me=Object(i.a)(j),ce=me.store,Ee=me.props.onOpenChange;ie!=="inline"&&!("openKeys"in j.props)&&(ce.setState({openKeys:[]}),Ee([])),j.props.onClick(re)},j.onKeyDown=function(re,ie){j.innerMenu.getWrappedInstance().onKeyDown(re,ie)},j.onOpenChange=function(re){var ie=Object(i.a)(j),me=ie.props,ce=j.store.getState().openKeys.concat(),Ee=!1,De=function(Ve){var it=!1;if(Ve.open)it=ce.indexOf(Ve.key)===-1,it&&ce.push(Ve.key);else{var St=ce.indexOf(Ve.key);it=St!==-1,it&&ce.splice(St,1)}Ee=Ee||it};Array.isArray(re)?re.forEach(De):De(re),Ee&&("openKeys"in j.props||j.store.setState({openKeys:ce}),me.onOpenChange(ce))},j.onDeselect=function(re){var ie=Object(i.a)(j),me=ie.props;if(me.selectable){var ce=j.store.getState().selectedKeys.concat(),Ee=re.key,De=ce.indexOf(Ee);De!==-1&&ce.splice(De,1),"selectedKeys"in me||j.store.setState({selectedKeys:ce}),me.onDeselect(Object(I.a)(Object(I.a)({},re),{},{selectedKeys:ce}))}},j.onMouseEnter=function(re){j.restoreModeVerticalFromInline();var ie=j.props.onMouseEnter;ie&&ie(re)},j.onTransitionEnd=function(re){var ie=re.propertyName==="width"&&re.target===re.currentTarget,me=re.target.className,ce=Object.prototype.toString.call(me)==="[object SVGAnimatedString]"?me.animVal:me,Ee=re.propertyName==="font-size"&&ce.indexOf("anticon")>=0;(ie||Ee)&&j.restoreModeVerticalFromInline()},j.setInnerMenu=function(re){j.innerMenu=re},j.isRootMenu=!0;var $=ne.defaultSelectedKeys,W=ne.defaultOpenKeys;return"selectedKeys"in ne&&($=ne.selectedKeys||[]),"openKeys"in ne&&(W=ne.openKeys||[]),j.store=Object(e.c)({selectedKeys:$,openKeys:W,activeKey:{"0-menu-":_n(ne,ne.activeKey)}}),j.state={switchingModeFromInline:!1,prevProps:ne,inlineOpenKeys:[],store:j.store},j}return Object(c.a)(pe,[{key:"componentDidMount",value:function(){this.updateMiniStore(),this.updateMenuDisplay()}},{key:"componentDidUpdate",value:function(j){var $=this.props,W=$.siderCollapsed,re=$.inlineCollapsed,ie=$.onOpenChange;(!j.inlineCollapsed&&re||!j.siderCollapsed&&W)&&ie([]),this.updateMiniStore(),this.updateMenuDisplay()}},{key:"updateMenuDisplay",value:function(){var j=this.props.collapsedWidth,$=this.store,W=this.prevOpenKeys,re=this.getInlineCollapsed()&&(j===0||j==="0"||j==="0px");re?(this.prevOpenKeys=$.getState().openKeys.concat(),this.store.setState({openKeys:[]})):W&&(this.store.setState({openKeys:W}),this.prevOpenKeys=null)}},{key:"getRealMenuMode",value:function(){var j=this.props.mode,$=this.state.switchingModeFromInline,W=this.getInlineCollapsed();return $&&W?"inline":W?"vertical":j}},{key:"getInlineCollapsed",value:function(){var j=this.props,$=j.inlineCollapsed,W=j.siderCollapsed;return W!==void 0?W:$}},{key:"restoreModeVerticalFromInline",value:function(){var j=this.state.switchingModeFromInline;j&&this.setState({switchingModeFromInline:!1})}},{key:"updateMiniStore",value:function(){"selectedKeys"in this.props&&this.store.setState({selectedKeys:this.props.selectedKeys||[]}),"openKeys"in this.props&&this.store.setState({openKeys:this.props.openKeys||[]})}},{key:"render",value:function(){var j=Object(I.a)({},Object(m.a)(this.props,["collapsedWidth","siderCollapsed","defaultMotions"])),$=this.getRealMenuMode();return j.className+=" ".concat(j.prefixCls,"-root"),j.direction==="rtl"&&(j.className+=" ".concat(j.prefixCls,"-rtl")),j=Object(I.a)(Object(I.a)({},j),{},{mode:$,onClick:this.onClick,onOpenChange:this.onOpenChange,onDeselect:this.onDeselect,onSelect:this.onSelect,onMouseEnter:this.onMouseEnter,onTransitionEnd:this.onTransitionEnd,parentMenu:this,motion:kn(this.props,this.state,$)}),delete j.openAnimation,delete j.openTransitionName,g.createElement(e.a,{store:this.store},g.createElement(wn,Object(l.a)({},j,{ref:this.setInnerMenu}),this.props.children))}}],[{key:"getDerivedStateFromProps",value:function(j,$){var W=$.prevProps,re=$.store,ie=re.getState(),me={},ce={prevProps:j};return W.mode==="inline"&&j.mode!=="inline"&&(ce.switchingModeFromInline=!0),"openKeys"in j?me.openKeys=j.openKeys||[]:((j.inlineCollapsed&&!W.inlineCollapsed||j.siderCollapsed&&!W.siderCollapsed)&&(ce.switchingModeFromInline=!0,ce.inlineOpenKeys=ie.openKeys,me.openKeys=[]),(!j.inlineCollapsed&&W.inlineCollapsed||!j.siderCollapsed&&W.siderCollapsed)&&(me.openKeys=$.inlineOpenKeys,ce.inlineOpenKeys=[])),Object.keys(me).length&&re.setState(me),ce}}]),pe}(g.Component);Fr.defaultProps={selectable:!0,onClick:Ke,onSelect:Ke,onOpenChange:Ke,onDeselect:Ke,defaultSelectedKeys:[],defaultOpenKeys:[],subMenuOpenDelay:.1,subMenuCloseDelay:.1,triggerSubMenuAction:"hover",prefixCls:"rc-menu",className:"",mode:"vertical",style:{},builtinPlacements:{},overflowedIndicator:g.createElement("span",null,"\xB7\xB7\xB7")};var In=Fr,dn=function(q){Object(n.a)(pe,q);var ue=Object(t.a)(pe);function pe(){var ne;return Object(p.a)(this,pe),ne=ue.apply(this,arguments),ne.onKeyDown=function(j){var $=j.keyCode;return $===v.a.ENTER?(ne.onClick(j),!0):void 0},ne.onMouseLeave=function(j){var $=ne.props,W=$.eventKey,re=$.onItemHover,ie=$.onMouseLeave;re({key:W,hover:!1}),ie({key:W,domEvent:j})},ne.onMouseEnter=function(j){var $=ne.props,W=$.eventKey,re=$.onItemHover,ie=$.onMouseEnter;re({key:W,hover:!0}),ie({key:W,domEvent:j})},ne.onClick=function(j){var $=ne.props,W=$.eventKey,re=$.multiple,ie=$.onClick,me=$.onSelect,ce=$.onDeselect,Ee=$.isSelected,De={key:W,keyPath:[W],item:Object(i.a)(ne),domEvent:j};ie(De),re?Ee?ce(De):me(De):Ee||me(De)},ne.saveNode=function(j){ne.node=j},ne}return Object(c.a)(pe,[{key:"componentDidMount",value:function(){this.callRef()}},{key:"componentDidUpdate",value:function(){this.callRef()}},{key:"componentWillUnmount",value:function(){var j=this.props;j.onDestroy&&j.onDestroy(j.eventKey)}},{key:"getPrefixCls",value:function(){return"".concat(this.props.rootPrefixCls,"-item")}},{key:"getActiveClassName",value:function(){return"".concat(this.getPrefixCls(),"-active")}},{key:"getSelectedClassName",value:function(){return"".concat(this.getPrefixCls(),"-selected")}},{key:"getDisabledClassName",value:function(){return"".concat(this.getPrefixCls(),"-disabled")}},{key:"callRef",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"render",value:function(){var j,$=Object(I.a)({},this.props),W=U()(this.getPrefixCls(),$.className,(j={},Object(oe.a)(j,this.getActiveClassName(),!$.disabled&&$.active),Object(oe.a)(j,this.getSelectedClassName(),$.isSelected),Object(oe.a)(j,this.getDisabledClassName(),$.disabled),j)),re=Object(I.a)(Object(I.a)({},$.attribute),{},{title:typeof $.title=="string"?$.title:void 0,className:W,role:$.role||"menuitem","aria-disabled":$.disabled});$.role==="option"?re=Object(I.a)(Object(I.a)({},re),{},{role:"option","aria-selected":$.isSelected}):($.role===null||$.role==="none")&&(re.role="none");var ie={onClick:$.disabled?null:this.onClick,onMouseLeave:$.disabled?null:this.onMouseLeave,onMouseEnter:$.disabled?null:this.onMouseEnter},me=Object(I.a)({},$.style);$.mode==="inline"&&($.direction==="rtl"?me.paddingRight=$.inlineIndent*$.level:me.paddingLeft=$.inlineIndent*$.level),Ze.forEach(function(Ee){return delete $[Ee]}),delete $.direction;var ce=this.props.itemIcon;return typeof this.props.itemIcon=="function"&&(ce=g.createElement(this.props.itemIcon,this.props)),g.createElement("li",Object(l.a)({},Object(m.a)($,["onClick","onMouseEnter","onMouseLeave","onSelect"]),re,ie,{style:me,ref:this.saveNode}),$.children,ce)}}]),pe}(g.Component);dn.isMenuItem=!0,dn.defaultProps={onSelect:Ke,onMouseEnter:Ke,onMouseLeave:Ke,manualRef:Ke};var Nn=Object(e.b)(function(q,ue){var pe=q.activeKey,ne=q.selectedKeys,j=ue.eventKey,$=ue.subMenuKey;return{active:pe[$]===j,isSelected:Array.isArray(ne)?ne.indexOf(j)!==-1:ne===j}})(dn),On=Nn,gn=function(q){Object(n.a)(pe,q);var ue=Object(t.a)(pe);function pe(){var ne;return Object(p.a)(this,pe),ne=ue.apply(this,arguments),ne.renderInnerMenuItem=function(j){var $=ne.props,W=$.renderMenuItem,re=$.index;return W(j,re,ne.props.subMenuKey)},ne}return Object(c.a)(pe,[{key:"render",value:function(){var j=Object(l.a)({},this.props),$=j.className,W=$===void 0?"":$,re=j.rootPrefixCls,ie="".concat(re,"-item-group-title"),me="".concat(re,"-item-group-list"),ce=j.title,Ee=j.children;return Ze.forEach(function(De){return delete j[De]}),delete j.direction,g.createElement("li",Object(l.a)({},j,{onClick:function(Xe){return Xe.stopPropagation()},className:"".concat(W," ").concat(re,"-item-group")}),g.createElement("div",{className:ie,title:typeof ce=="string"?ce:void 0},ce),g.createElement("ul",{className:me},g.Children.map(Ee,this.renderInnerMenuItem)))}}]),pe}(g.Component);gn.isMenuItemGroup=!0,gn.defaultProps={disabled:!0};var Vn=gn,Un=function(ue){var pe=ue.className,ne=ue.rootPrefixCls,j=ue.style;return g.createElement("li",{className:"".concat(pe," ").concat(ne,"-item-divider"),style:j})};Un.defaultProps={disabled:!0,className:"",style:{}};var Bn=Un,Gr=In,jn=K("eDIo");function Xn(q,ue){var pe=q.prefixCls,ne=q.editable,j=q.locale,$=q.style;return!ne||ne.showAdd===!1?null:g.createElement("button",{ref:ue,type:"button",className:"".concat(pe,"-nav-add"),style:$,"aria-label":(j==null?void 0:j.addAriaLabel)||"Add tab",onClick:function(re){ne.onEdit("add",{event:re})}},ne.addIcon||"+")}var Rn=g.forwardRef(Xn);function $n(q,ue){var pe=q.prefixCls,ne=q.id,j=q.tabs,$=q.locale,W=q.mobile,re=q.moreIcon,ie=re===void 0?"More":re,me=q.moreTransitionName,ce=q.style,Ee=q.className,De=q.editable,Xe=q.tabBarGutter,Ve=q.rtl,it=q.onTabClick,St=Object(g.useState)(!1),Mt=Object(N.a)(St,2),Rt=Mt[0],Ut=Mt[1],kt=Object(g.useState)(null),Dt=Object(N.a)(kt,2),Pt=Dt[0],Vt=Dt[1],Ft="".concat(ne,"-more-popup"),fr="".concat(pe,"-dropdown"),nr=Pt!==null?"".concat(Ft,"-").concat(Pt):null,xt=$==null?void 0:$.dropdownAriaLabel,Et=g.createElement(Gr,{onClick:function(ar){var hr=ar.key,Dr=ar.domEvent;it(hr,Dr),Ut(!1)},id:Ft,tabIndex:-1,role:"listbox","aria-activedescendant":nr,selectedKeys:[Pt],"aria-label":xt!==void 0?xt:"expanded dropdown"},j.map(function($t){return g.createElement(On,{key:$t.key,id:"".concat(Ft,"-").concat($t.key),role:"option","aria-controls":ne&&"".concat(ne,"-panel-").concat($t.key),disabled:$t.disabled},$t.tab)}));function Kt($t){for(var ar=j.filter(function(Xr){return!Xr.disabled}),hr=ar.findIndex(function(Xr){return Xr.key===Pt})||0,Dr=ar.length,Vr=0;Vr<Dr;Vr+=1){hr=(hr+$t+Dr)%Dr;var gr=ar[hr];if(!gr.disabled){Vt(gr.key);return}}}function zt($t){var ar=$t.which;if(!Rt){[v.a.DOWN,v.a.SPACE,v.a.ENTER].includes(ar)&&(Ut(!0),$t.preventDefault());return}switch(ar){case v.a.UP:Kt(-1),$t.preventDefault();break;case v.a.DOWN:Kt(1),$t.preventDefault();break;case v.a.ESC:Ut(!1);break;case v.a.SPACE:case v.a.ENTER:Pt!==null&&it(Pt,$t);break}}Object(g.useEffect)(function(){var $t=document.getElementById(nr);$t&&$t.scrollIntoView&&$t.scrollIntoView(!1)},[Pt]),Object(g.useEffect)(function(){Rt||Vt(null)},[Rt]);var vt=Object(oe.a)({},Ve?"marginLeft":"marginRight",Xe);j.length||(vt.visibility="hidden",vt.order=1);var Xt=U()(Object(oe.a)({},"".concat(fr,"-rtl"),Ve)),dr=W?null:g.createElement(jn.a,{prefixCls:fr,overlay:Et,trigger:["hover"],visible:Rt,transitionName:me,onVisibleChange:Ut,overlayClassName:Xt,mouseEnterDelay:.1,mouseLeaveDelay:.1},g.createElement("button",{type:"button",className:"".concat(pe,"-nav-more"),style:vt,tabIndex:-1,"aria-hidden":"true","aria-haspopup":"listbox","aria-controls":Ft,id:"".concat(ne,"-more"),"aria-expanded":Rt,onKeyDown:zt},ie));return g.createElement("div",{className:U()("".concat(pe,"-nav-operations"),Ee),style:ce,ref:ue},dr,g.createElement(Rn,{prefixCls:pe,locale:$,editable:De}))}var Yn=g.forwardRef($n),He=Object(g.createContext)(null),Se=.1,Le=.01,Ye=20,mt=Math.pow(.995,Ye);function yt(){var q=navigator.userAgent||navigator.vendor||window.opera;return!!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(q)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(q.substr(0,4)))}function er(q,ue){var pe=Object(g.useState)(),ne=Object(N.a)(pe,2),j=ne[0],$=ne[1],W=Object(g.useState)(0),re=Object(N.a)(W,2),ie=re[0],me=re[1],ce=Object(g.useState)(0),Ee=Object(N.a)(ce,2),De=Ee[0],Xe=Ee[1],Ve=Object(g.useState)(),it=Object(N.a)(Ve,2),St=it[0],Mt=it[1],Rt=Object(g.useRef)();function Ut(xt){var Et=xt.touches[0],Kt=Et.screenX,zt=Et.screenY;$({x:Kt,y:zt}),window.clearInterval(Rt.current)}function kt(xt){if(!j)return;xt.preventDefault();var Et=xt.touches[0],Kt=Et.screenX,zt=Et.screenY;$({x:Kt,y:zt});var vt=Kt-j.x,Xt=zt-j.y;ue(vt,Xt);var dr=Date.now();me(dr),Xe(dr-ie),Mt({x:vt,y:Xt})}function Dt(){if(!j)return;if($(null),Mt(null),St){var xt=St.x/De,Et=St.y/De,Kt=Math.abs(xt),zt=Math.abs(Et);if(Math.max(Kt,zt)<Se)return;var vt=xt,Xt=Et;Rt.current=window.setInterval(function(){if(Math.abs(vt)<Le&&Math.abs(Xt)<Le){window.clearInterval(Rt.current);return}vt*=mt,Xt*=mt,ue(vt*Ye,Xt*Ye)},Ye)}}var Pt=Object(g.useRef)(0),Vt=Object(g.useRef)(!1),Ft=Object(g.useRef)();function fr(xt){var Et=xt.deltaX,Kt=xt.deltaY,zt=0,vt=Math.abs(Et),Xt=Math.abs(Kt);vt===Xt?zt=Ft.current==="x"?Et:Kt:vt>Xt?(zt=Et,Ft.current="x"):(zt=Kt,Ft.current="y");var dr=Date.now();dr-Pt.current>100&&(Vt.current=!1),(ue(-zt,-zt)||Vt.current)&&(xt.preventDefault(),Vt.current=!0),Pt.current=dr}var nr=Object(g.useRef)(null);nr.current={onTouchStart:Ut,onTouchMove:kt,onTouchEnd:Dt,onWheel:fr},g.useEffect(function(){function xt(vt){nr.current.onTouchStart(vt)}function Et(vt){nr.current.onTouchMove(vt)}function Kt(vt){nr.current.onTouchEnd(vt)}function zt(vt){nr.current.onWheel(vt)}return document.addEventListener("touchmove",Et,{passive:!1}),document.addEventListener("touchend",Kt,{passive:!1}),q.current.addEventListener("touchstart",xt,{passive:!1}),q.current.addEventListener("wheel",zt),function(){document.removeEventListener("touchmove",Et),document.removeEventListener("touchend",Kt)}},[])}function Tr(){var q=Object(g.useRef)(new Map);function ue(ne){return q.current.has(ne)||q.current.set(ne,g.createRef()),q.current.get(ne)}function pe(ne){q.current.delete(ne)}return[ue,pe]}function xr(q,ue){var pe=g.useRef(q),ne=g.useState({}),j=Object(N.a)(ne,2),$=j[1];function W(re){var ie=typeof re=="function"?re(pe.current):re;ie!==pe.current&&ue(ie,pe.current),pe.current=ie,$({})}return[pe.current,W]}var Jt=function(ue){var pe=ue.position,ne=ue.prefixCls,j=ue.extra;if(!j)return null;var $,W=j;return pe==="right"&&($=W.right||!W.left&&W||null),pe==="left"&&($=W.left||null),$?g.createElement("div",{className:"".concat(ne,"-extra-content")},$):null};function An(q,ue){var pe,ne=g.useContext(He),j=ne.prefixCls,$=ne.tabs,W=q.className,re=q.style,ie=q.id,me=q.animated,ce=q.activeKey,Ee=q.rtl,De=q.extra,Xe=q.editable,Ve=q.locale,it=q.tabPosition,St=q.tabBarGutter,Mt=q.children,Rt=q.onTabClick,Ut=q.onTabScroll,kt=Object(g.useRef)(),Dt=Object(g.useRef)(),Pt=Object(g.useRef)(),Vt=Object(g.useRef)(),Ft=Tr(),fr=Object(N.a)(Ft,2),nr=fr[0],xt=fr[1],Et=it==="top"||it==="bottom",Kt=xr(0,function(ir,Ht){Et&&Ut&&Ut({direction:ir>Ht?"left":"right"})}),zt=Object(N.a)(Kt,2),vt=zt[0],Xt=zt[1],dr=xr(0,function(ir,Ht){!Et&&Ut&&Ut({direction:ir>Ht?"top":"bottom"})}),$t=Object(N.a)(dr,2),ar=$t[0],hr=$t[1],Dr=Object(g.useState)(0),Vr=Object(N.a)(Dr,2),gr=Vr[0],Xr=Vr[1],yn=Object(g.useState)(0),Zr=Object(N.a)(yn,2),qr=Zr[0],Cr=Zr[1],Wr=Object(g.useState)(0),Pr=Object(N.a)(Wr,2),wr=Pr[0],Dn=Pr[1],Pn=Object(g.useState)(0),Fn=Object(N.a)(Pn,2),ur=Fn[0],xn=Fn[1],Wn=Object(g.useState)(null),cr=Object(N.a)(Wn,2),tr=cr[0],Lr=cr[1],Gi=Object(g.useState)(null),gi=Object(N.a)(Gi,2),zn=gi[0],Vi=gi[1],Xi=Object(g.useState)(0),yi=Object(N.a)(Xi,2),$i=yi[0],Yi=yi[1],Qi=Object(g.useState)(0),bi=Object(N.a)(Qi,2),Ji=bi[0],Zi=bi[1],qi=b(new Map),Ei=Object(N.a)(qi,2),ea=Ei[0],ta=Ei[1],ii=s($,ea,gr),xi="".concat(j,"-nav-operations-hidden"),Qn=0,Jn=0;Et?Ee?(Qn=0,Jn=Math.max(0,gr-tr)):(Qn=Math.min(0,tr-gr),Jn=0):(Qn=Math.min(0,zn-qr),Jn=0);function ai(ir){return ir<Qn?[Qn,!1]:ir>Jn?[Jn,!1]:[ir,!0]}var Ci=Object(g.useRef)(),ra=Object(g.useState)(),Ti=Object(N.a)(ra,2),oi=Ti[0],Si=Ti[1];function si(){Si(Date.now())}function li(){window.clearTimeout(Ci.current)}er(kt,function(ir,Ht){var Or=!1;function en(qn,ei){qn(function(ti){var ri=ai(ti+ei),Gn=Object(N.a)(ri,2),hi=Gn[0],fi=Gn[1];return Or=fi,hi})}if(Et){if(tr>=gr)return Or;en(Xt,ir)}else{if(zn>=qr)return Or;en(hr,Ht)}return li(),si(),Or}),Object(g.useEffect)(function(){return li(),oi&&(Ci.current=window.setTimeout(function(){Si(0)},100)),li},[oi]);function _i(){var ir=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ce,Ht=ii.get(ir);if(!Ht)return;if(Et){var Or=vt;Ee?Ht.right<vt?Or=Ht.right:Ht.right+Ht.width>vt+tr&&(Or=Ht.right+Ht.width-tr):Ht.left<-vt?Or=-Ht.left:Ht.left+Ht.width>-vt+tr&&(Or=-(Ht.left+Ht.width-tr)),hr(0),Xt(ai(Or)[0])}else{var en=ar;Ht.top<-ar?en=-Ht.top:Ht.top+Ht.height>-ar+zn&&(en=-(Ht.top+Ht.height-zn)),Xt(0),hr(ai(en)[0])}}var na=d(ii,{width:tr,height:zn,left:vt,top:ar},{width:wr,height:ur},{width:$i,height:Ji},Object(I.a)(Object(I.a)({},q),{},{tabs:$})),wi=Object(N.a)(na,2),ia=wi[0],aa=wi[1],oa=$.map(function(ir){var Ht=ir.key;return g.createElement(r,{id:ie,prefixCls:j,key:Ht,rtl:Ee,tab:ir,closable:ir.closable,editable:Xe,active:Ht===ce,tabPosition:it,tabBarGutter:St,renderWrapper:Mt,removeAriaLabel:Ve==null?void 0:Ve.removeAriaLabel,ref:nr(Ht),onClick:function(en){Rt(Ht,en)},onRemove:function(){xt(Ht)},onFocus:function(){_i(Ht),si(),Ee||(kt.current.scrollLeft=0),kt.current.scrollTop=0}})}),ui=C(function(){var ir,Ht,Or,en,qn,ei,ti,ri,Gn,hi=((ir=kt.current)===null||ir===void 0?void 0:ir.offsetWidth)||0,fi=((Ht=kt.current)===null||Ht===void 0?void 0:Ht.offsetHeight)||0,ki=((Or=Vt.current)===null||Or===void 0?void 0:Or.offsetWidth)||0,Ii=((en=Vt.current)===null||en===void 0?void 0:en.offsetHeight)||0,ha=((qn=Pt.current)===null||qn===void 0?void 0:qn.offsetWidth)||0,fa=((ei=Pt.current)===null||ei===void 0?void 0:ei.offsetHeight)||0;Lr(hi),Vi(fi),Yi(ki),Zi(Ii);var Ni=(((ti=Dt.current)===null||ti===void 0?void 0:ti.offsetWidth)||0)-ki,Ui=(((ri=Dt.current)===null||ri===void 0?void 0:ri.offsetHeight)||0)-Ii;Xr(Ni),Cr(Ui);var Bi=(Gn=Pt.current)===null||Gn===void 0?void 0:Gn.className.includes(xi);Dn(Ni-(Bi?0:ha)),xn(Ui-(Bi?0:fa)),ta(function(){var ji=new Map;return $.forEach(function(pa){var Fi=pa.key,ni=nr(Fi).current;ni&&ji.set(Fi,{width:ni.offsetWidth,height:ni.offsetHeight,left:ni.offsetLeft,top:ni.offsetTop})}),ji})}),sa=$.slice(0,ia),la=$.slice(aa+1),Oi=[].concat(Object(w.a)(sa),Object(w.a)(la)),ua=Object(g.useState)(),Ri=Object(N.a)(ua,2),da=Ri[0],ca=Ri[1],Ln=ii.get(ce),Ai=Object(g.useRef)();function Di(){T.a.cancel(Ai.current)}Object(g.useEffect)(function(){var ir={};return Ln&&(Et?(Ee?ir.right=Ln.right:ir.left=Ln.left,ir.width=Ln.width):(ir.top=Ln.top,ir.height=Ln.height)),Di(),Ai.current=T()(function(){ca(ir)}),Di},[Ln,Et,Ee]),Object(g.useEffect)(function(){_i()},[ce,Ln,ii,Et]),Object(g.useEffect)(function(){ui()},[Ee,St,ce,$.map(function(ir){return ir.key}).join("_")]);var Pi=!!Oi.length,Zn="".concat(j,"-nav-wrap"),di,ci,Li,Mi;return Et?Ee?(ci=vt>0,di=vt+tr<gr):(di=vt<0,ci=-vt+tr<gr):(Li=ar<0,Mi=-ar+zn<qr),g.createElement("div",{ref:ue,role:"tablist",className:U()("".concat(j,"-nav"),W),style:re,onKeyDown:function(){si()}},g.createElement(Jt,{position:"left",extra:De,prefixCls:j}),g.createElement(O.a,{onResize:ui},g.createElement("div",{className:U()(Zn,(pe={},Object(oe.a)(pe,"".concat(Zn,"-ping-left"),di),Object(oe.a)(pe,"".concat(Zn,"-ping-right"),ci),Object(oe.a)(pe,"".concat(Zn,"-ping-top"),Li),Object(oe.a)(pe,"".concat(Zn,"-ping-bottom"),Mi),pe)),ref:kt},g.createElement(O.a,{onResize:ui},g.createElement("div",{ref:Dt,className:"".concat(j,"-nav-list"),style:{transform:"translate(".concat(vt,"px, ").concat(ar,"px)"),transition:oi?"none":void 0}},oa,g.createElement(Rn,{ref:Vt,prefixCls:j,locale:Ve,editable:Xe,style:{visibility:Pi?"hidden":null}}),g.createElement("div",{className:U()("".concat(j,"-ink-bar"),Object(oe.a)({},"".concat(j,"-ink-bar-animated"),me.inkBar)),style:da}))))),g.createElement(Yn,Object.assign({},q,{ref:Pt,prefixCls:j,tabs:Oi,className:!Pi&&xi})),g.createElement(Jt,{position:"right",extra:De,prefixCls:j}))}var cn=g.forwardRef(An);function Wi(q){var ue=q.id,pe=q.activeKey,ne=q.animated,j=q.tabPosition,$=q.rtl,W=q.destroyInactiveTabPane,re=g.useContext(He),ie=re.prefixCls,me=re.tabs,ce=ne.tabPane,Ee=me.findIndex(function(De){return De.key===pe});return g.createElement("div",{className:U()("".concat(ie,"-content-holder"))},g.createElement("div",{className:U()("".concat(ie,"-content"),"".concat(ie,"-content-").concat(j),Object(oe.a)({},"".concat(ie,"-content-animated"),ce)),style:Ee&&ce?Object(oe.a)({},$?"marginRight":"marginLeft","-".concat(Ee,"00%")):null},me.map(function(De){return g.cloneElement(De.node,{key:De.key,prefixCls:ie,tabKey:De.key,id:ue,animated:ce,active:De.key===pe,destroyInactiveTabPane:W})})))}function pi(q){var ue=q.prefixCls,pe=q.forceRender,ne=q.className,j=q.style,$=q.id,W=q.active,re=q.animated,ie=q.destroyInactiveTabPane,me=q.tabKey,ce=q.children,Ee=g.useState(pe),De=Object(N.a)(Ee,2),Xe=De[0],Ve=De[1];g.useEffect(function(){W?Ve(!0):ie&&Ve(!1)},[W,ie]);var it={};return W||(re?(it.visibility="hidden",it.height=0,it.overflowY="hidden"):it.display="none"),g.createElement("div",{id:$&&"".concat($,"-panel-").concat(me),role:"tabpanel",tabIndex:W?0:-1,"aria-labelledby":$&&"".concat($,"-tab-").concat(me),"aria-hidden":!W,style:Object(I.a)(Object(I.a)({},it),j),className:U()("".concat(ue,"-tabpane"),W&&"".concat(ue,"-tabpane-active"),ne)},(W||Xe||pe)&&ce)}var mi=0;function Ki(q){return Object(M.a)(q).map(function(ue){if(g.isValidElement(ue)){var pe=ue.key!==void 0?String(ue.key):void 0;return Object(I.a)(Object(I.a)({key:pe},ue.props),{},{node:ue})}return null}).filter(function(ue){return ue})}function Hi(q,ue){var pe,ne=q.id,j=q.prefixCls,$=j===void 0?"rc-tabs":j,W=q.className,re=q.children,ie=q.direction,me=q.activeKey,ce=q.defaultActiveKey,Ee=q.editable,De=q.animated,Xe=q.tabPosition,Ve=Xe===void 0?"top":Xe,it=q.tabBarGutter,St=q.tabBarStyle,Mt=q.tabBarExtraContent,Rt=q.locale,Ut=q.moreIcon,kt=q.moreTransitionName,Dt=q.destroyInactiveTabPane,Pt=q.renderTabBar,Vt=q.onChange,Ft=q.onTabClick,fr=q.onTabScroll,nr=Object(S.a)(q,["id","prefixCls","className","children","direction","activeKey","defaultActiveKey","editable","animated","tabPosition","tabBarGutter","tabBarStyle","tabBarExtraContent","locale","moreIcon","moreTransitionName","destroyInactiveTabPane","renderTabBar","onChange","onTabClick","onTabScroll"]),xt=Ki(re),Et=ie==="rtl",Kt;De===!1?Kt={inkBar:!1,tabPane:!1}:Kt=Object(I.a)({inkBar:!0,tabPane:!1},De!==!0?De:null);var zt=Object(g.useState)(!1),vt=Object(N.a)(zt,2),Xt=vt[0],dr=vt[1];Object(g.useEffect)(function(){dr(yt())},[]);var $t=Object(R.a)(function(){var ur;return(ur=xt[0])===null||ur===void 0?void 0:ur.key},{value:me,defaultValue:ce}),ar=Object(N.a)($t,2),hr=ar[0],Dr=ar[1],Vr=Object(g.useState)(function(){return xt.findIndex(function(ur){return ur.key===hr})}),gr=Object(N.a)(Vr,2),Xr=gr[0],yn=gr[1];Object(g.useEffect)(function(){var ur=xt.findIndex(function(Wn){return Wn.key===hr});if(ur===-1){var xn;ur=Math.max(0,Math.min(Xr,xt.length-1)),Dr((xn=xt[ur])===null||xn===void 0?void 0:xn.key)}yn(ur)},[xt.map(function(ur){return ur.key}).join("_"),hr,Xr]);var Zr=Object(R.a)(null,{value:ne}),qr=Object(N.a)(Zr,2),Cr=qr[0],Wr=qr[1],Pr=Ve;Xt&&!["left","right"].includes(Ve)&&(Pr="top"),Object(g.useEffect)(function(){ne||(Wr("rc-tabs-".concat(mi)),mi+=1)},[]);function wr(ur,xn){Ft==null||Ft(ur,xn),Dr(ur),Vt==null||Vt(ur)}var Dn={id:Cr,activeKey:hr,animated:Kt,tabPosition:Pr,rtl:Et,mobile:Xt},Pn,Fn=Object(I.a)(Object(I.a)({},Dn),{},{editable:Ee,locale:Rt,moreIcon:Ut,moreTransitionName:kt,tabBarGutter:it,onTabClick:wr,onTabScroll:fr,extra:Mt,style:St,panes:re});return Pt?Pn=Pt(Fn,cn):Pn=g.createElement(cn,Object.assign({},Fn)),g.createElement(He.Provider,{value:{tabs:xt,prefixCls:$}},g.createElement("div",Object.assign({ref:ue,id:ne,className:U()($,"".concat($,"-").concat(Pr),(pe={},Object(oe.a)(pe,"".concat($,"-mobile"),Xt),Object(oe.a)(pe,"".concat($,"-editable"),Ee),Object(oe.a)(pe,"".concat($,"-rtl"),Et),pe),W)},nr),Pn,g.createElement(Wi,Object.assign({destroyInactiveTabPane:Dt},Dn,{animated:Kt}))))}var vi=g.forwardRef(Hi);vi.TabPane=pi;var zi=vi,ma=ze.b=zi},n6Qo:function(ft,ze,K){"use strict";K.d(ze,"a",function(){return M});var oe=K("q1tI"),N=K("biw7"),S=K("fyJ8");function I(R){var w=R.className,x=R.index,T=R.children,O=R.colSpan,C=R.rowSpan,b=oe.useContext(N.a),v=b.prefixCls,h=b.fixedInfoList,r=h[x];return oe.createElement(S.a,Object.assign({className:w,index:x,component:"td",prefixCls:v,record:null,dataIndex:null,render:function(){return{children:T,props:{colSpan:O,rowSpan:C}}}},r))}function g(R){return oe.createElement("tr",Object.assign({},R))}function E(R){var w=R.children,x=oe.useContext(N.a),T=x.prefixCls;return oe.createElement("tfoot",{className:"".concat(T,"-summary")},w)}var U=ze.b=E,M={Cell:I,Row:g}},p5ED:function(ft,ze,K){"use strict";var oe=K("+L6B"),N=K("2/Rp"),S=K("5Dmo"),I=K("3S7+"),g=K("k1fw"),E=K("tJVT"),U=K("q1tI"),M=K.n(U),R=K("vHTk"),w=K.n(R),x=K("yEEn"),T=K("ZW9T"),O=K("1vsH");ze.a=function(C){var b=C.name,v=C.data,h=C.theme,r=C.type,o=C.filename,s=C.monacoEditor,f=C.className,d=C.style,l=C.close,p=C.onClose,c=C.hasMask,i=Object(U.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),n=Object(E.a)(i,2),t=n[0],e=n[1],m=Object(U.useState)(""),y=Object(E.a)(m,2),_=y[0],A=y[1],k=Object(U.useRef)();o&&(s.filename=o),Object(U.useEffect)(function(){var Q,Y,X=(Q=document.cookie)===null||Q===void 0||((Y=Q.replace(/\s/g,""))===null||Y===void 0)?void 0:Y.split(";");X==null||X.map(function(le){var ye=le.split("=");ye[0]==="_educoder_session"&&A(ye[1])})},[]);var F=function(){if(v.startsWith("http")||v.startsWith("/")){z();return}Object(O.x)(o||"educoder",v,o)},z=function(){Object(O.v)(o||b,v)};return console.log("data:",v,"fileanme:",o," name:",b),M.a.createElement("div",{style:Object(g.a)({},d||{}),className:"".concat(c&&w.a.bgBlack," ").concat(r?w.a.wrp:"hide")},l&&M.a.createElement("div",{className:w.a.close,ref:k},M.a.createElement(I.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return k.current}},M.a.createElement("span",{onClick:z},M.a.createElement("i",{className:"icon-quxiaozhiding"}))),M.a.createElement(I.a,{title:"\u5173\u95ED",getPopupContainer:function(){return k.current}},M.a.createElement("span",{className:"",onClick:p},M.a.createElement("i",{className:"icon-guanbi1"})))),M.a.createElement("div",{className:"".concat(w.a[f]," ").concat(f," ").concat(w.a.monaco," ").concat(r==="txt"?"show":"hide")},r==="txt"&&M.a.createElement(T.b,s)),r==="audio"&&M.a.createElement("audio",{src:"".concat(v!=null&&v.startsWith("/")||(v==null?void 0:v.indexOf("https://"))>-1?v:"data:audio/mp3;base64,").concat(v),autoPlay:!0}),r==="video"&&M.a.createElement(M.a.Fragment,null,v!=null&&v.startsWith("/")?M.a.createElement("video",{controls:!0,src:"".concat(v),autoPlay:!0}):M.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(v),autoPlay:!0})),r==="html"&&M.a.createElement("iframe",{src:v+"&disposition=inline"}),r==="pdf"&&M.a.createElement("embed",{className:w.a.embed,src:v}),r==="image"&&M.a.createElement(M.a.Fragment,null,M.a.createElement("img",{src:"".concat(v!=null&&v.startsWith("/")||(v==null?void 0:v.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(v)})),r==="other"&&M.a.createElement("div",null,M.a.createElement(N.a,{type:"primary",size:"large",onClick:F},M.a.createElement(x.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(r==="download"||r==="office")&&M.a.createElement(N.a,{type:"primary",size:"large",onClick:F},M.a.createElement(x.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},pIsd:function(ft,ze,K){var oe=K("BJfS"),N=function(g){var E=/[height|width]$/;return E.test(g)},S=function(g){var E="",U=Object.keys(g);return U.forEach(function(M,R){var w=g[M];M=oe(M),N(M)&&typeof w=="number"&&(w=w+"px"),w===!0?E+=M:w===!1?E+="not "+M:E+="("+M+": "+w+")",R<U.length-1&&(E+=" and ")}),E},I=function(g){var E="";return typeof g=="string"?g:g instanceof Array?(g.forEach(function(U,M){E+=S(U),M<g.length-1&&(E+=", ")}),E):S(g)};ft.exports=I},"rAM+":function(ft,ze,K){"use strict";K.d(ze,"a",function(){return N});var oe=K("Qw5x");function N(S,I){var g;if(typeof Symbol=="undefined"||S[Symbol.iterator]==null){if(Array.isArray(S)||(g=Object(oe.a)(S))||I&&S&&typeof S.length=="number"){g&&(S=g);var E=0,U=function(){};return{s:U,n:function(){return E>=S.length?{done:!0}:{done:!1,value:S[E++]}},e:function(T){throw T},f:U}}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 M=!0,R=!1,w;return{s:function(){g=S[Symbol.iterator]()},n:function(){var T=g.next();return M=T.done,T},e:function(T){R=!0,w=T},f:function(){try{!M&&g.return!=null&&g.return()}finally{if(R)throw w}}}}},rUJ1:function(ft,ze){const K=/[&<>"']/,oe=/[&<>"']/g,N=/[<>"']|&(?!#?\w+;)/,S=/[<>"']|&(?!#?\w+;)/g,I={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},g=c=>I[c];function E(c,i){if(i){if(K.test(c))return c.replace(oe,g)}else if(N.test(c))return c.replace(S,g);return c}const U=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function M(c){return c.replace(U,(i,n)=>(n=n.toLowerCase(),n==="colon"?":":n.charAt(0)==="#"?n.charAt(1)==="x"?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1)):""))}const R=/(^|[^\[])\^/g;function w(c,i){c=c.source||c,i=i||"";const n={replace:(t,e)=>(e=e.source||e,e=e.replace(R,"$1"),c=c.replace(t,e),n),getRegex:()=>new RegExp(c,i)};return n}const x=/[^\w:]/g,T=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function O(c,i,n){if(c){let t;try{t=decodeURIComponent(M(n)).replace(x,"").toLowerCase()}catch(e){return null}if(t.indexOf("javascript:")===0||t.indexOf("vbscript:")===0||t.indexOf("data:")===0)return null}i&&!T.test(n)&&(n=r(i,n));try{n=encodeURI(n).replace(/%25/g,"%")}catch(t){return null}return n}const C={},b=/^[^:]+:\/*[^/]*$/,v=/^([^:]+:)[\s\S]*$/,h=/^([^:]+:\/*[^/]*)[\s\S]*$/;function r(c,i){C[" "+c]||(b.test(c)?C[" "+c]=c+"/":C[" "+c]=d(c,"/",!0)),c=C[" "+c];const n=c.indexOf(":")===-1;return i.substring(0,2)==="//"?n?i:c.replace(v,"$1")+i:i.charAt(0)==="/"?n?i:c.replace(h,"$1")+i:c+i}const o={exec:function(){}};function s(c){let i=1,n,t;for(;i<arguments.length;i++){n=arguments[i];for(t in n)Object.prototype.hasOwnProperty.call(n,t)&&(c[t]=n[t])}return c}function f(c,i){const n=c.replace(/\|/g,(m,y,_)=>{let A=!1,k=y;for(;--k>=0&&_[k]==="\\";)A=!A;return A?"|":" |"}),t=n.split(/ \|/);let e=0;if(t.length>i)t.splice(i);else for(;t.length<i;)t.push("");for(;e<t.length;e++)t[e]=t[e].trim().replace(/\\\|/g,"|");return t}function d(c,i,n){const t=c.length;if(t===0)return"";let e=0;for(;e<t;){const m=c.charAt(t-e-1);if(m===i&&!n)e++;else if(m!==i&&n)e++;else break}return c.substr(0,t-e)}function l(c,i){if(c.indexOf(i[1])===-1)return-1;const n=c.length;let t=0,e=0;for(;e<n;e++)if(c[e]==="\\")e++;else if(c[e]===i[0])t++;else if(c[e]===i[1]&&(t--,t<0))return e;return-1}function p(c){c&&c.sanitize&&!c.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")}ft.exports={escape:E,unescape:M,edit:w,cleanUrl:O,resolveUrl:r,noopTest:o,merge:s,splitCells:f,rtrim:d,findClosingBracket:l,checkSanitizeDeprecation:p}},sR1s:function(ft,ze,K){"use strict";K.d(ze,"b",function(){return I}),K.d(ze,"a",function(){return g}),K.d(ze,"c",function(){return E}),K.d(ze,"d",function(){return U});var oe=K("U8pU"),N="RC_TABLE_KEY";function S(M){return M==null?[]:Array.isArray(M)?M:[M]}function I(M,R){if(!R&&typeof R!="number")return M;for(var w=S(R),x=M,T=0;T<w.length;T+=1){if(!x)return null;var O=w[T];x=x[O]}return x}function g(M){var R=[],w={};return M.forEach(function(x){for(var T=x||{},O=T.key,C=T.dataIndex,b=O||S(C).join("-")||N;w[b];)b="".concat(b,"_next");w[b]=!0,R.push(b)}),R}function E(){var M={};function R(O,C){C&&Object.keys(C).forEach(function(b){var v=C[b];v&&Object(oe.a)(v)==="object"?(O[b]=O[b]||{},R(O[b],v)):O[b]=v})}for(var w=arguments.length,x=new Array(w),T=0;T<w;T++)x[T]=arguments[T];return x.forEach(function(O){R(M,O)}),M}function U(M){return M!=null}},sboe:function(ft,ze,K){"use strict";K.d(ze,"a",function(){return S});var oe=K("q1tI"),N=K.n(oe),S=oe.createContext(null)},t23M:function(ft,ze,K){"use strict";var oe=K("VTBJ"),N=K("1OyB"),S=K("vuIU"),I=K("Ji7U"),g=K("LK+K"),E=K("q1tI"),U=K.n(E),M=K("m+aA"),R=K("Zm9Q"),w=K("Kwbf"),x=K("c+Xe"),T=K("bdgK"),O="rc-observer-key",C=function(b){Object(I.a)(h,b);var v=Object(g.a)(h);function h(){var r;return Object(N.a)(this,h),r=v.apply(this,arguments),r.resizeObserver=null,r.childNode=null,r.currentElement=null,r.state={width:0,height:0,offsetHeight:0,offsetWidth:0},r.onResize=function(o){var s=r.props.onResize,f=o[0].target,d=f.getBoundingClientRect(),l=d.width,p=d.height,c=f.offsetWidth,i=f.offsetHeight,n=Math.floor(l),t=Math.floor(p);if(r.state.width!==n||r.state.height!==t||r.state.offsetWidth!==c||r.state.offsetHeight!==i){var e={width:n,height:t,offsetWidth:c,offsetHeight:i};r.setState(e),s&&Promise.resolve().then(function(){s(Object(oe.a)(Object(oe.a)({},e),{},{offsetWidth:c,offsetHeight:i}))})}},r.setChildNode=function(o){r.childNode=o},r}return Object(S.a)(h,[{key:"componentDidMount",value:function(){this.onComponentUpdated()}},{key:"componentDidUpdate",value:function(){this.onComponentUpdated()}},{key:"componentWillUnmount",value:function(){this.destroyObserver()}},{key:"onComponentUpdated",value:function(){var o=this.props.disabled;if(o){this.destroyObserver();return}var s=Object(M.a)(this.childNode||this),f=s!==this.currentElement;f&&(this.destroyObserver(),this.currentElement=s),!this.resizeObserver&&s&&(this.resizeObserver=new T.default(this.onResize),this.resizeObserver.observe(s))}},{key:"destroyObserver",value:function(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}},{key:"render",value:function(){var o=this.props.children,s=Object(R.a)(o);if(s.length>1)Object(w.a)(!1,"Find more than one child node with `children` in ResizeObserver. Will only observe first one.");else if(s.length===0)return Object(w.a)(!1,"`children` of ResizeObserver is empty. Nothing is in observe."),null;var f=s[0];if(E.isValidElement(f)&&Object(x.c)(f)){var d=f.ref;s[0]=E.cloneElement(f,{ref:Object(x.a)(d,this.setChildNode)})}return s.length===1?s[0]:s.map(function(l,p){return!E.isValidElement(l)||"key"in l&&l.key!==null?l:E.cloneElement(l,{key:"".concat(O,"-").concat(p)})})}}]),h}(E.Component);C.displayName="ResizeObserver",ze.a=C},t6v1:function(ft,ze,K){ft.exports=K.p+"static/a2.d632a3a4.svg"},uf8j:function(ft,ze,K){ft.exports=K.p+"static/a.2d0eaf1f.svg"},ulZh:function(ft,ze,K){typeof window!="undefined"&&function(N,S){ft.exports=S()}(this,function(){return function(oe){var N={};function S(I){if(N[I])return N[I].exports;var g=N[I]={i:I,l:!1,exports:{}};return oe[I].call(g.exports,g,g.exports,S),g.l=!0,g.exports}return S.m=oe,S.c=N,S.d=function(I,g,E){S.o(I,g)||Object.defineProperty(I,g,{enumerable:!0,get:E})},S.r=function(I){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(I,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(I,"__esModule",{value:!0})},S.t=function(I,g){if(g&1&&(I=S(I)),g&8)return I;if(g&4&&typeof I=="object"&&I&&I.__esModule)return I;var E=Object.create(null);if(S.r(E),Object.defineProperty(E,"default",{enumerable:!0,value:I}),g&2&&typeof I!="string")for(var U in I)S.d(E,U,function(M){return I[M]}.bind(null,U));return E},S.n=function(I){var g=I&&I.__esModule?function(){return I.default}:function(){return I};return S.d(g,"a",g),g},S.o=function(I,g){return Object.prototype.hasOwnProperty.call(I,g)},S.p="/dist/",S(S.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(oe,N,S){"use strict";var I=Object.prototype.hasOwnProperty,g="~";function E(){}Object.create&&(E.prototype=Object.create(null),new E().__proto__||(g=!1));function U(x,T,O){this.fn=x,this.context=T,this.once=O||!1}function M(x,T,O,C,b){if(typeof O!="function")throw new TypeError("The listener must be a function");var v=new U(O,C||x,b),h=g?g+T:T;return x._events[h]?x._events[h].fn?x._events[h]=[x._events[h],v]:x._events[h].push(v):(x._events[h]=v,x._eventsCount++),x}function R(x,T){--x._eventsCount===0?x._events=new E:delete x._events[T]}function w(){this._events=new E,this._eventsCount=0}w.prototype.eventNames=function(){var T=[],O,C;if(this._eventsCount===0)return T;for(C in O=this._events)I.call(O,C)&&T.push(g?C.slice(1):C);return Object.getOwnPropertySymbols?T.concat(Object.getOwnPropertySymbols(O)):T},w.prototype.listeners=function(T){var O=g?g+T:T,C=this._events[O];if(!C)return[];if(C.fn)return[C.fn];for(var b=0,v=C.length,h=new Array(v);b<v;b++)h[b]=C[b].fn;return h},w.prototype.listenerCount=function(T){var O=g?g+T:T,C=this._events[O];return C?C.fn?1:C.length:0},w.prototype.emit=function(T,O,C,b,v,h){var r=g?g+T:T;if(!this._events[r])return!1;var o=this._events[r],s=arguments.length,f,d;if(o.fn){o.once&&this.removeListener(T,o.fn,void 0,!0);switch(s){case 1:return o.fn.call(o.context),!0;case 2:return o.fn.call(o.context,O),!0;case 3:return o.fn.call(o.context,O,C),!0;case 4:return o.fn.call(o.context,O,C,b),!0;case 5:return o.fn.call(o.context,O,C,b,v),!0;case 6:return o.fn.call(o.context,O,C,b,v,h),!0}for(d=1,f=new Array(s-1);d<s;d++)f[d-1]=arguments[d];o.fn.apply(o.context,f)}else{var l=o.length,p;for(d=0;d<l;d++){o[d].once&&this.removeListener(T,o[d].fn,void 0,!0);switch(s){case 1:o[d].fn.call(o[d].context);break;case 2:o[d].fn.call(o[d].context,O);break;case 3:o[d].fn.call(o[d].context,O,C);break;case 4:o[d].fn.call(o[d].context,O,C,b);break;default:if(!f)for(p=1,f=new Array(s-1);p<s;p++)f[p-1]=arguments[p];o[d].fn.apply(o[d].context,f)}}}return!0},w.prototype.on=function(T,O,C){return M(this,T,O,C,!1)},w.prototype.once=function(T,O,C){return M(this,T,O,C,!0)},w.prototype.removeListener=function(T,O,C,b){var v=g?g+T:T;if(!this._events[v])return this;if(!O)return R(this,v),this;var h=this._events[v];if(h.fn)h.fn===O&&(!b||h.once)&&(!C||h.context===C)&&R(this,v);else{for(var r=0,o=[],s=h.length;r<s;r++)(h[r].fn!==O||b&&!h[r].once||C&&h[r].context!==C)&&o.push(h[r]);o.length?this._events[v]=o.length===1?o[0]:o:R(this,v)}return this},w.prototype.removeAllListeners=function(T){var O;return T?(O=g?g+T:T,this._events[O]&&R(this,O)):(this._events=new E,this._eventsCount=0),this},w.prototype.off=w.prototype.removeListener,w.prototype.addListener=w.prototype.on,w.prefixed=g,w.EventEmitter=w,oe.exports=w},"./node_modules/url-toolkit/src/url-toolkit.js":function(oe,N,S){(function(I){var g=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,E=/^([^\/?#]*)([^]*)$/,U=/(?:\/|^)\.(?=\/)/g,M=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,R={buildAbsoluteURL:function(w,x,T){if(T=T||{},w=w.trim(),x=x.trim(),!x){if(!T.alwaysNormalize)return w;var O=R.parseURL(w);if(!O)throw new Error("Error trying to parse base URL.");return O.path=R.normalizePath(O.path),R.buildURLFromParts(O)}var C=R.parseURL(x);if(!C)throw new Error("Error trying to parse relative URL.");if(C.scheme)return T.alwaysNormalize?(C.path=R.normalizePath(C.path),R.buildURLFromParts(C)):x;var b=R.parseURL(w);if(!b)throw new Error("Error trying to parse base URL.");if(!b.netLoc&&b.path&&b.path[0]!=="/"){var v=E.exec(b.path);b.netLoc=v[1],b.path=v[2]}b.netLoc&&!b.path&&(b.path="/");var h={scheme:b.scheme,netLoc:C.netLoc,path:null,params:C.params,query:C.query,fragment:C.fragment};if(!C.netLoc&&(h.netLoc=b.netLoc,C.path[0]!=="/"))if(!C.path)h.path=b.path,C.params||(h.params=b.params,C.query||(h.query=b.query));else{var r=b.path,o=r.substring(0,r.lastIndexOf("/")+1)+C.path;h.path=R.normalizePath(o)}return h.path===null&&(h.path=T.alwaysNormalize?R.normalizePath(C.path):C.path),R.buildURLFromParts(h)},parseURL:function(w){var x=g.exec(w);return x?{scheme:x[1]||"",netLoc:x[2]||"",path:x[3]||"",params:x[4]||"",query:x[5]||"",fragment:x[6]||""}:null},normalizePath:function(w){for(w=w.split("").reverse().join("").replace(U,"");w.length!==(w=w.replace(M,"")).length;);return w.split("").reverse().join("")},buildURLFromParts:function(w){return w.scheme+w.netLoc+w.path+w.params+w.query+w.fragment}};oe.exports=R})(this)},"./node_modules/webworkify-webpack/index.js":function(oe,N,S){function I(T){var O={};function C(v){if(O[v])return O[v].exports;var h=O[v]={i:v,l:!1,exports:{}};return T[v].call(h.exports,h,h.exports,C),h.l=!0,h.exports}C.m=T,C.c=O,C.i=function(v){return v},C.d=function(v,h,r){C.o(v,h)||Object.defineProperty(v,h,{configurable:!1,enumerable:!0,get:r})},C.r=function(v){Object.defineProperty(v,"__esModule",{value:!0})},C.n=function(v){var h=v&&v.__esModule?function(){return v.default}:function(){return v};return C.d(h,"a",h),h},C.o=function(v,h){return Object.prototype.hasOwnProperty.call(v,h)},C.p="/",C.oe=function(v){throw console.error(v),v};var b=C(C.s=ENTRY_MODULE);return b.default||b}var g="[\\.|\\-|\\+|\\w|/|@]+",E="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+g+").*?\\)";function U(T){return(T+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function M(T){return!isNaN(1*T)}function R(T,O,C){var b={};b[C]=[];var v=O.toString(),h=v.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!h)return b;for(var r=h[1],o=new RegExp("(\\\\n|\\W)"+U(r)+E,"g"),s;s=o.exec(v);){if(s[3]==="dll-reference")continue;b[C].push(s[3])}for(o=new RegExp("\\("+U(r)+'\\("(dll-reference\\s('+g+'))"\\)\\)'+E,"g");s=o.exec(v);)T[s[2]]||(b[C].push(s[1]),T[s[2]]=S(s[1]).m),b[s[2]]=b[s[2]]||[],b[s[2]].push(s[4]);for(var f=Object.keys(b),d=0;d<f.length;d++)for(var l=0;l<b[f[d]].length;l++)M(b[f[d]][l])&&(b[f[d]][l]=1*b[f[d]][l]);return b}function w(T){var O=Object.keys(T);return O.reduce(function(C,b){return C||T[b].length>0},!1)}function x(T,O){for(var C={main:[O]},b={main:[]},v={main:{}};w(C);)for(var h=Object.keys(C),r=0;r<h.length;r++){var o=h[r],s=C[o],f=s.pop();if(v[o]=v[o]||{},v[o][f]||!T[o][f])continue;v[o][f]=!0,b[o]=b[o]||[],b[o].push(f);for(var d=R(T,T[o][f],o),l=Object.keys(d),p=0;p<l.length;p++)C[l[p]]=C[l[p]]||[],C[l[p]]=C[l[p]].concat(d[l[p]])}return b}oe.exports=function(T,O){O=O||{};var C={main:S.m},b=O.all?{main:Object.keys(C.main)}:x(C,T),v="";Object.keys(b).filter(function(f){return f!=="main"}).forEach(function(f){for(var d=0;b[f][d];)d++;b[f].push(d),C[f][d]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",v=v+"var "+f+" = ("+I.toString().replace("ENTRY_MODULE",JSON.stringify(d))+")({"+b[f].map(function(l){return""+JSON.stringify(l)+": "+C[f][l].toString()}).join(",")+`});
`}),v=v+"new (("+I.toString().replace("ENTRY_MODULE",JSON.stringify(T))+")({"+b.main.map(function(f){return""+JSON.stringify(f)+": "+C.main[f].toString()}).join(",")+"}))(self);";var h=new window.Blob([v],{type:"text/javascript"});if(O.bare)return h;var r=window.URL||window.webkitURL||window.mozURL||window.msURL,o=r.createObjectURL(h),s=new window.Worker(o);return s.objectURL=o,s}},"./src/config.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"hlsDefaultConfig",function(){return p}),S.d(N,"mergeConfig",function(){return i}),S.d(N,"enableStreamingMode",function(){return n});var I=S("./src/controller/abr-controller.ts"),g=S("./src/controller/audio-stream-controller.ts"),E=S("./src/controller/audio-track-controller.ts"),U=S("./src/controller/subtitle-stream-controller.ts"),M=S("./src/controller/subtitle-track-controller.ts"),R=S("./src/controller/buffer-controller.ts"),w=S("./src/controller/timeline-controller.ts"),x=S("./src/controller/cap-level-controller.ts"),T=S("./src/controller/fps-controller.ts"),O=S("./src/controller/eme-controller.ts"),C=S("./src/controller/cmcd-controller.ts"),b=S("./src/utils/xhr-loader.ts"),v=S("./src/utils/fetch-loader.ts"),h=S("./src/utils/cues.ts"),r=S("./src/utils/mediakeys-helper.ts"),o=S("./src/utils/logger.ts");function s(){return s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var m=arguments[e];for(var y in m)Object.prototype.hasOwnProperty.call(m,y)&&(t[y]=m[y])}return t},s.apply(this,arguments)}function f(t,e){var m=Object.keys(t);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(t);e&&(y=y.filter(function(_){return Object.getOwnPropertyDescriptor(t,_).enumerable})),m.push.apply(m,y)}return m}function d(t){for(var e=1;e<arguments.length;e++){var m=arguments[e]!=null?arguments[e]:{};e%2?f(Object(m),!0).forEach(function(y){l(t,y,m[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(m)):f(Object(m)).forEach(function(y){Object.defineProperty(t,y,Object.getOwnPropertyDescriptor(m,y))})}return t}function l(t,e,m){return e in t?Object.defineProperty(t,e,{value:m,enumerable:!0,configurable:!0,writable:!0}):t[e]=m,t}var p=d(d({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:b.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:I.default,bufferController:R.default,capLevelController:x.default,fpsController:T.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:r.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},c()),{},{subtitleStreamController:U.SubtitleStreamController,subtitleTrackController:M.default,timelineController:w.TimelineController,audioStreamController:g.default,audioTrackController:E.default,emeController:O.default,cmcdController:C.default});function c(){return{cueHandler:h.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 i(t,e){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return s({},t,e)}function n(t){var e=t.loader;if(e!==v.default&&e!==b.default)o.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),t.progressive=!1;else{var m=Object(v.fetchSupported)();m&&(t.loader=v.default,t.progressive=!0,t.enableSoftwareAES=!0,o.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/polyfills/number.ts"),g=S("./src/utils/ewma-bandwidth-estimator.ts"),E=S("./src/events.ts"),U=S("./src/utils/buffer-helper.ts"),M=S("./src/errors.ts"),R=S("./src/types/loader.ts"),w=S("./src/utils/logger.ts");function x(C,b){for(var v=0;v<b.length;v++){var h=b[v];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(C,h.key,h)}}function T(C,b,v){return b&&x(C.prototype,b),v&&x(C,v),C}var O=function(){function C(v){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=v;var h=v.config;this.bwEstimator=new g.default(h.abrEwmaSlowVoD,h.abrEwmaFastVoD,h.abrEwmaDefaultEstimate),this.registerListeners()}var b=C.prototype;return b.registerListeners=function(){var h=this.hls;h.on(E.Events.FRAG_LOADING,this.onFragLoading,this),h.on(E.Events.FRAG_LOADED,this.onFragLoaded,this),h.on(E.Events.FRAG_BUFFERED,this.onFragBuffered,this),h.on(E.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.on(E.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){var h=this.hls;h.off(E.Events.FRAG_LOADING,this.onFragLoading,this),h.off(E.Events.FRAG_LOADED,this.onFragLoaded,this),h.off(E.Events.FRAG_BUFFERED,this.onFragBuffered,this),h.off(E.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.off(E.Events.ERROR,this.onError,this)},b.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},b.onFragLoading=function(h,r){var o=r.frag;if(o.type===R.PlaylistLevelType.MAIN&&!this.timer){var s;this.fragCurrent=o,this.partCurrent=(s=r.part)!=null?s:null,this.timer=self.setInterval(this.onCheck,100)}},b.onLevelLoaded=function(h,r){var o=this.hls.config;r.details.live?this.bwEstimator.update(o.abrEwmaSlowLive,o.abrEwmaFastLive):this.bwEstimator.update(o.abrEwmaSlowVoD,o.abrEwmaFastVoD)},b._abandonRulesCheck=function(){var h=this.fragCurrent,r=this.partCurrent,o=this.hls,s=o.autoLevelEnabled,f=o.config,d=o.media;if(!h||!d)return;var l=r?r.stats:h.stats,p=r?r.duration:h.duration;if(l.aborted){w.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!s||d.paused||!d.playbackRate||!d.readyState)return;var c=performance.now()-l.loading.start,i=Math.abs(d.playbackRate);if(c<=500*p/i)return;var n=o.levels,t=o.minAutoLevel,e=n[h.level],m=l.total||Math.max(l.loaded,Math.round(p*e.maxBitrate/8)),y=Math.max(1,l.bwEstimate?l.bwEstimate/8:l.loaded*1e3/c),_=(m-l.loaded)/y,A=d.currentTime,k=(U.BufferHelper.bufferInfo(d,A,f.maxBufferHole).end-A)/i;if(k>=2*p/i||_<=k)return;var F=Number.POSITIVE_INFINITY,z;for(z=h.level-1;z>t;z--){var Q=n[z].maxBitrate;if(F=p*Q/(8*.8*y),F<k)break}if(F>=_)return;var Y=this.bwEstimator.getEstimate();w.logger.warn("Fragment "+h.sn+(r?" part "+r.index:"")+" of level "+h.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+z+`
Current BW estimate: `+(Object(I.isFiniteNumber)(Y)?(Y/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+_.toFixed(3)+` s
Estimated load time for the next fragment: `+F.toFixed(3)+` s
Time to underbuffer: `+k.toFixed(3)+" s"),o.nextLoadLevel=z,this.bwEstimator.sample(c,l.loaded),this.clearTimer(),h.loader&&(this.fragCurrent=this.partCurrent=null,h.loader.abort()),o.trigger(E.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:h,part:r,stats:l})},b.onFragLoaded=function(h,r){var o=r.frag,s=r.part;if(o.type===R.PlaylistLevelType.MAIN&&Object(I.isFiniteNumber)(o.sn)){var f=s?s.stats:o.stats,d=s?s.duration:o.duration;if(this.clearTimer(),this.lastLoadedFragLevel=o.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var l=this.hls.levels[o.level],p=(l.loaded?l.loaded.bytes:0)+f.loaded,c=(l.loaded?l.loaded.duration:0)+d;l.loaded={bytes:p,duration:c},l.realBitrate=Math.round(8*p/c)}if(o.bitrateTest){var i={stats:f,frag:o,part:s,id:o.type};this.onFragBuffered(E.Events.FRAG_BUFFERED,i),o.bitrateTest=!1}}},b.onFragBuffered=function(h,r){var o=r.frag,s=r.part,f=s?s.stats:o.stats;if(f.aborted)return;if(o.type!==R.PlaylistLevelType.MAIN||o.sn==="initSegment")return;var d=f.parsing.end-f.loading.start;this.bwEstimator.sample(d,f.loaded),f.bwEstimate=this.bwEstimator.getEstimate(),o.bitrateTest?this.bitrateTestDelay=d/1e3:this.bitrateTestDelay=0},b.onError=function(h,r){switch(r.details){case M.ErrorDetails.FRAG_LOAD_ERROR:case M.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},b.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},b.getNextABRAutoLevel=function(){var h=this.fragCurrent,r=this.partCurrent,o=this.hls,s=o.maxAutoLevel,f=o.config,d=o.minAutoLevel,l=o.media,p=r?r.duration:h?h.duration:0,c=l?l.currentTime:0,i=l&&l.playbackRate!==0?Math.abs(l.playbackRate):1,n=this.bwEstimator?this.bwEstimator.getEstimate():f.abrEwmaDefaultEstimate,t=(U.BufferHelper.bufferInfo(l,c,f.maxBufferHole).end-c)/i,e=this.findBestLevel(n,d,s,t,f.abrBandWidthFactor,f.abrBandWidthUpFactor);if(e>=0)return e;w.logger.trace((t?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var m=p?Math.min(p,f.maxStarvationDelay):f.maxStarvationDelay,y=f.abrBandWidthFactor,_=f.abrBandWidthUpFactor;if(!t){var A=this.bitrateTestDelay;if(A){var k=p?Math.min(p,f.maxLoadingDelay):f.maxLoadingDelay;m=k-A,w.logger.trace("bitrate test took "+Math.round(1e3*A)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*m)+" ms"),y=_=1}}return e=this.findBestLevel(n,d,s,t+m,y,_),Math.max(e,0)},b.findBestLevel=function(h,r,o,s,f,d){for(var l,p=this.fragCurrent,c=this.partCurrent,i=this.lastLoadedFragLevel,n=this.hls.levels,t=n[i],e=!!(t!=null&&(l=t.details)!==null&&l!==void 0&&l.live),m=t==null?void 0:t.codecSet,y=c?c.duration:p?p.duration:0,_=o;_>=r;_--){var A=n[_];if(!A||m&&A.codecSet!==m)continue;var k=A.details,F=(c?k==null?void 0:k.partTarget:k==null?void 0:k.averagetargetduration)||y,z=void 0;_<=i?z=f*h:z=d*h;var Q=n[_].maxBitrate,Y=Q*F/z;if(w.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+_+"/"+Math.round(z)+"/"+Q+"/"+F+"/"+s+"/"+Y),z>Q&&(!Y||e&&!this.bitrateTestDelay||Y<s))return _}return-1},T(C,[{key:"nextAutoLevel",get:function(){var h=this._nextAutoLevel,r=this.bwEstimator;if(h!==-1&&(!r||!r.canEstimate()))return h;var o=this.getNextABRAutoLevel();return h!==-1&&(o=Math.min(h,o)),o},set:function(h){this._nextAutoLevel=h}}]),C}();N.default=O},"./src/controller/audio-stream-controller.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/polyfills/number.ts"),g=S("./src/controller/base-stream-controller.ts"),E=S("./src/events.ts"),U=S("./src/utils/buffer-helper.ts"),M=S("./src/controller/fragment-tracker.ts"),R=S("./src/types/level.ts"),w=S("./src/types/loader.ts"),x=S("./src/loader/fragment.ts"),T=S("./src/demux/chunk-cache.ts"),O=S("./src/demux/transmuxer-interface.ts"),C=S("./src/types/transmuxer.ts"),b=S("./src/controller/fragment-finders.ts"),v=S("./src/utils/discontinuities.ts"),h=S("./src/errors.ts"),r=S("./src/utils/logger.ts");function o(){return o=Object.assign||function(p){for(var c=1;c<arguments.length;c++){var i=arguments[c];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(p[n]=i[n])}return p},o.apply(this,arguments)}function s(p,c){p.prototype=Object.create(c.prototype),p.prototype.constructor=p,f(p,c)}function f(p,c){return f=Object.setPrototypeOf||function(n,t){return n.__proto__=t,n},f(p,c)}var d=100,l=function(p){s(c,p);function c(n,t){var e;return e=p.call(this,n,t,"[audio-stream-controller]")||this,e.videoBuffer=null,e.videoTrackCC=-1,e.waitingVideoCC=-1,e.audioSwitch=!1,e.trackId=-1,e.waitingData=null,e.mainDetails=null,e.bufferFlushed=!1,e._registerListeners(),e}var i=c.prototype;return i.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},i._registerListeners=function(){var t=this.hls;t.on(E.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(E.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(E.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(E.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.on(E.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.on(E.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(E.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(E.Events.ERROR,this.onError,this),t.on(E.Events.BUFFER_RESET,this.onBufferReset,this),t.on(E.Events.BUFFER_CREATED,this.onBufferCreated,this),t.on(E.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(E.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(E.Events.FRAG_BUFFERED,this.onFragBuffered,this)},i._unregisterListeners=function(){var t=this.hls;t.off(E.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(E.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(E.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(E.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.off(E.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.off(E.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(E.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(E.Events.ERROR,this.onError,this),t.off(E.Events.BUFFER_RESET,this.onBufferReset,this),t.off(E.Events.BUFFER_CREATED,this.onBufferCreated,this),t.off(E.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(E.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(E.Events.FRAG_BUFFERED,this.onFragBuffered,this)},i.onInitPtsFound=function(t,e){var m=e.frag,y=e.id,_=e.initPTS;if(y==="main"){var A=m.cc;this.initPTS[m.cc]=_,this.log("InitPTS for cc: "+A+" found from main: "+_),this.videoTrackCC=A,this.state===g.State.WAITING_INIT_PTS&&this.tick()}},i.startLoad=function(t){if(!this.levels){this.startPosition=t,this.state=g.State.STOPPED;return}var e=this.lastCurrentTime;this.stopLoad(),this.setInterval(d),this.fragLoadError=0,e>0&&t===-1?(this.log("Override startPosition with lastCurrentTime @"+e.toFixed(3)),this.state=g.State.IDLE):(this.loadedmetadata=!1,this.state=g.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()},i.doTick=function(){switch(this.state){case g.State.IDLE:this.doTickIdle();break;case g.State.WAITING_TRACK:{var t,e=this.levels,m=this.trackId,y=e==null||((t=e[m])===null||t===void 0)?void 0:t.details;if(y){if(this.waitForCdnTuneIn(y))break;this.state=g.State.WAITING_INIT_PTS}break}case g.State.FRAG_LOADING_WAITING_RETRY:{var _,A=performance.now(),k=this.retryDate;(!k||A>=k||(_=this.media)!==null&&_!==void 0&&_.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=g.State.IDLE);break}case g.State.WAITING_INIT_PTS:{var F=this.waitingData;if(F){var z=F.frag,Q=F.part,Y=F.cache,X=F.complete;if(this.initPTS[z.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=g.State.FRAG_LOADING;var le=Y.flush(),ye={frag:z,part:Q,payload:le,networkDetails:null};this._handleFragmentLoadProgress(ye),X&&p.prototype._handleFragmentLoadComplete.call(this,ye)}else if(this.videoTrackCC!==this.waitingVideoCC)r.logger.log("Waiting fragment cc ("+z.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ve=this.getLoadPosition(),Ne=U.BufferHelper.bufferInfo(this.mediaBuffer,ve,this.config.maxBufferHole),Te=Object(b.fragmentWithinToleranceTest)(Ne.end,this.config.maxFragLookUpTolerance,z);Te<0&&(r.logger.log("Waiting fragment cc ("+z.cc+") @ "+z.start+" cancelled because another fragment at "+Ne.end+" is needed"),this.clearWaitingFragment())}}else this.state=g.State.IDLE}}this.onTickEnd()},i.clearWaitingFragment=function(){var t=this.waitingData;t&&(this.fragmentTracker.removeFragment(t.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=g.State.IDLE)},i.onTickEnd=function(){var t=this.media;if(!t||!t.readyState)return;var e=this.mediaBuffer?this.mediaBuffer:t,m=e.buffered;!this.loadedmetadata&&m.length&&(this.loadedmetadata=!0),this.lastCurrentTime=t.currentTime},i.doTickIdle=function(){var t,e,m=this.hls,y=this.levels,_=this.media,A=this.trackId,k=m.config;if(!y||!y[A])return;if(!_&&(this.startFragRequested||!k.startFragPrefetch))return;var F=y[A],z=F.details;if(!z||z.live&&this.levelLastLoaded!==A||this.waitForCdnTuneIn(z)){this.state=g.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,x.ElementaryStreamTypes.AUDIO,w.PlaylistLevelType.AUDIO));var Q=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,w.PlaylistLevelType.AUDIO);if(Q===null)return;var Y=Q.len,X=this.getMaxBufferLength(),le=this.audioSwitch;if(Y>=X&&!le)return;if(!le&&this._streamEnded(Q,z)){m.trigger(E.Events.BUFFER_EOS,{type:"audio"}),this.state=g.State.ENDED;return}var ye=z.fragments,ve=ye[0].start,Ne=Q.end;if(le){var Te=this.getLoadPosition();Ne=Te,z.PTSKnown&&Te<ve&&((Q.end>ve||Q.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),_.currentTime=ve+.05))}var Ce=this.getNextFragment(Ne,z);if(!Ce){this.bufferFlushed=!0;return}((t=Ce.decryptdata)===null||t===void 0?void 0:t.keyFormat)==="identity"&&!((e=Ce.decryptdata)!==null&&e!==void 0&&e.key)?this.loadKey(Ce,z):this.loadFragment(Ce,z,Ne)},i.getMaxBufferLength=function(){var t=p.prototype.getMaxBufferLength.call(this),e=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,w.PlaylistLevelType.MAIN);return e===null?t:Math.max(t,e.len)},i.onMediaDetaching=function(){this.videoBuffer=null,p.prototype.onMediaDetaching.call(this)},i.onAudioTracksUpdated=function(t,e){var m=e.audioTracks;this.resetTransmuxer(),this.levels=m.map(function(y){return new R.Level(y)})},i.onAudioTrackSwitching=function(t,e){var m=!!e.url;this.trackId=e.id;var y=this.fragCurrent;y!=null&&y.loader&&y.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),m?this.setInterval(d):this.resetTransmuxer(),m?(this.audioSwitch=!0,this.state=g.State.IDLE):this.state=g.State.STOPPED,this.tick()},i.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},i.onLevelLoaded=function(t,e){this.mainDetails=e.details},i.onAudioTrackLoaded=function(t,e){var m,y=this.levels,_=e.details,A=e.id;if(!y){this.warn("Audio tracks were reset while loading level "+A);return}this.log("Track "+A+" loaded ["+_.startSN+","+_.endSN+"],duration:"+_.totalduration);var k=y[A],F=0;if(_.live||(m=k.details)!==null&&m!==void 0&&m.live){var z=this.mainDetails;if(_.fragments[0]||(_.deltaUpdateFailed=!0),_.deltaUpdateFailed||!z)return;!k.details&&_.hasProgramDateTime&&z.hasProgramDateTime?(Object(v.alignMediaPlaylistByPDT)(_,z),F=_.fragments[0].start):F=this.alignPlaylists(_,k.details)}k.details=_,this.levelLastLoaded=A,!this.startFragRequested&&(this.mainDetails||!_.live)&&this.setStartPosition(k.details,F),this.state===g.State.WAITING_TRACK&&!this.waitForCdnTuneIn(_)&&(this.state=g.State.IDLE),this.tick()},i._handleFragmentLoadProgress=function(t){var e,m=t.frag,y=t.part,_=t.payload,A=this.config,k=this.trackId,F=this.levels;if(!F){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+m.sn+" of level "+m.level+" will not be buffered");return}var z=F[k];console.assert(z,"Audio track is defined on fragment load progress");var Q=z.details;console.assert(Q,"Audio track details are defined on fragment load progress");var Y=A.defaultAudioCodec||z.audioCodec||"mp4a.40.2",X=this.transmuxer;X||(X=this.transmuxer=new O.default(this.hls,w.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var le=this.initPTS[m.cc],ye=(e=m.initSegment)===null||e===void 0?void 0:e.data;if(le!==void 0){var ve=!1,Ne=y?y.index:-1,Te=Ne!==-1,Ce=new C.ChunkMetadata(m.level,m.sn,m.stats.chunkCount,_.byteLength,Ne,Te);X.push(_,ye,Y,"",m,y,Q.totalduration,ve,Ce,le)}else{r.logger.log("Unknown video PTS for cc "+m.cc+", waiting for video PTS before demuxing audio frag "+m.sn+" of ["+Q.startSN+" ,"+Q.endSN+"],track "+k);var _e=this.waitingData=this.waitingData||{frag:m,part:y,cache:new T.default,complete:!1},Re=_e.cache;Re.push(new Uint8Array(_)),this.waitingVideoCC=this.videoTrackCC,this.state=g.State.WAITING_INIT_PTS}},i._handleFragmentLoadComplete=function(t){if(this.waitingData){this.waitingData.complete=!0;return}p.prototype._handleFragmentLoadComplete.call(this,t)},i.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},i.onBufferCreated=function(t,e){var m=e.tracks.audio;m&&(this.mediaBuffer=m.buffer),e.tracks.video&&(this.videoBuffer=e.tracks.video.buffer)},i.onFragBuffered=function(t,e){var m=e.frag,y=e.part;if(m.type!==w.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(m)){this.warn("Fragment "+m.sn+(y?" p: "+y.index:"")+" of level "+m.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}m.sn!=="initSegment"&&(this.fragPrevious=m,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(E.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(m,y)},i.onError=function(t,e){switch(e.details){case h.ErrorDetails.FRAG_LOAD_ERROR:case h.ErrorDetails.FRAG_LOAD_TIMEOUT:case h.ErrorDetails.KEY_LOAD_ERROR:case h.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(w.PlaylistLevelType.AUDIO,e);break;case h.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case h.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==g.State.ERROR&&this.state!==g.State.STOPPED&&(this.state=e.fatal?g.State.ERROR:g.State.IDLE,this.warn(e.details+" while loading frag, switching to "+this.state+" state"));break;case h.ErrorDetails.BUFFER_FULL_ERROR:if(e.parent==="audio"&&(this.state===g.State.PARSING||this.state===g.State.PARSED)){var m=!0,y=this.getFwdBufferInfo(this.mediaBuffer,w.PlaylistLevelType.AUDIO);y&&y.len>.5&&(m=!this.reduceMaxBufferLength(y.len)),m&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,p.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},i.onBufferFlushed=function(t,e){var m=e.type;m===x.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},i._handleTransmuxComplete=function(t){var e,m="audio",y=this.hls,_=t.remuxResult,A=t.chunkMeta,k=this.getCurrentContext(A);if(!k){this.warn("The loading context changed while buffering fragment "+A.sn+" of level "+A.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(A.level);return}var F=k.frag,z=k.part,Q=_.audio,Y=_.text,X=_.id3,le=_.initSegment;if(this.fragContextChanged(F))return;if(this.state=g.State.PARSING,this.audioSwitch&&Q&&this.completeAudioSwitch(),le!=null&&le.tracks&&(this._bufferInitSegment(le.tracks,F,A),y.trigger(E.Events.FRAG_PARSING_INIT_SEGMENT,{frag:F,id:m,tracks:le.tracks})),Q){var ye=Q.startPTS,ve=Q.endPTS,Ne=Q.startDTS,Te=Q.endDTS;z&&(z.elementaryStreams[x.ElementaryStreamTypes.AUDIO]={startPTS:ye,endPTS:ve,startDTS:Ne,endDTS:Te}),F.setElementaryStreamInfo(x.ElementaryStreamTypes.AUDIO,ye,ve,Ne,Te),this.bufferFragmentData(Q,F,z,A)}if(X!=null&&(e=X.samples)!==null&&e!==void 0&&e.length){var Ce=o({frag:F,id:m},X);y.trigger(E.Events.FRAG_PARSING_METADATA,Ce)}if(Y){var _e=o({frag:F,id:m},Y);y.trigger(E.Events.FRAG_PARSING_USERDATA,_e)}},i._bufferInitSegment=function(t,e,m){if(this.state!==g.State.PARSING)return;t.video&&delete t.video;var y=t.audio;if(!y)return;y.levelCodec=y.codec,y.id="audio",this.log("Init audio buffer, container:"+y.container+", codecs[parsed]=["+y.codec+"]"),this.hls.trigger(E.Events.BUFFER_CODECS,t);var _=y.initSegment;if(_!=null&&_.byteLength){var A={type:"audio",frag:e,part:null,chunkMeta:m,parent:e.type,data:_};this.hls.trigger(E.Events.BUFFER_APPENDING,A)}this.tick()},i.loadFragment=function(t,e,m){var y=this.fragmentTracker.getState(t);this.fragCurrent=t,(this.audioSwitch||y===M.FragmentState.NOT_LOADED||y===M.FragmentState.PARTIAL)&&(t.sn==="initSegment"?this._loadInitSegment(t):e.live&&!Object(I.isFiniteNumber)(this.initPTS[t.cc])?(this.log("Waiting for video PTS in continuity counter "+t.cc+" of live stream before loading audio fragment "+t.sn+" of level "+this.trackId),this.state=g.State.WAITING_INIT_PTS):(this.startFragRequested=!0,p.prototype.loadFragment.call(this,t,e,m)))},i.completeAudioSwitch=function(){var t=this.hls,e=this.media,m=this.trackId;e&&(this.log("Switching audio track : flushing all audio"),p.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,t.trigger(E.Events.AUDIO_TRACK_SWITCHED,{id:m})},c}(g.default);N.default=l},"./src/controller/audio-track-controller.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/events.ts"),g=S("./src/errors.ts"),E=S("./src/controller/base-playlist-controller.ts"),U=S("./src/types/loader.ts");function M(O,C){for(var b=0;b<C.length;b++){var v=C[b];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(O,v.key,v)}}function R(O,C,b){return C&&M(O.prototype,C),b&&M(O,b),O}function w(O,C){O.prototype=Object.create(C.prototype),O.prototype.constructor=O,x(O,C)}function x(O,C){return x=Object.setPrototypeOf||function(v,h){return v.__proto__=h,v},x(O,C)}var T=function(O){w(C,O);function C(v){var h;return h=O.call(this,v,"[audio-track-controller]")||this,h.tracks=[],h.groupId=null,h.tracksInGroup=[],h.trackId=-1,h.trackName="",h.selectDefaultTrack=!0,h.registerListeners(),h}var b=C.prototype;return b.registerListeners=function(){var h=this.hls;h.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.on(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.on(I.Events.LEVEL_LOADING,this.onLevelLoading,this),h.on(I.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),h.on(I.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.on(I.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){var h=this.hls;h.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.off(I.Events.LEVEL_LOADING,this.onLevelLoading,this),h.off(I.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),h.off(I.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.off(I.Events.ERROR,this.onError,this)},b.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,O.prototype.destroy.call(this)},b.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},b.onManifestParsed=function(h,r){this.tracks=r.audioTracks||[]},b.onAudioTrackLoaded=function(h,r){var o=r.id,s=r.details,f=this.tracksInGroup[o];if(!f){this.warn("Invalid audio track id "+o);return}var d=f.details;f.details=r.details,this.log("audioTrack "+o+" loaded ["+s.startSN+"-"+s.endSN+"]"),o===this.trackId&&(this.retryCount=0,this.playlistLoaded(o,r,d))},b.onLevelLoading=function(h,r){this.switchLevel(r.level)},b.onLevelSwitching=function(h,r){this.switchLevel(r.level)},b.switchLevel=function(h){var r=this.hls.levels[h];if(!(r!=null&&r.audioGroupIds))return;var o=r.audioGroupIds[r.urlId];if(this.groupId!==o){this.groupId=o;var s=this.tracks.filter(function(d){return!o||d.groupId===o});this.selectDefaultTrack&&!s.some(function(d){return d.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=s;var f={audioTracks:s};this.log("Updating audio tracks, "+s.length+' track(s) found in "'+o+'" group-id'),this.hls.trigger(I.Events.AUDIO_TRACKS_UPDATED,f),this.selectInitialTrack()}},b.onError=function(h,r){if(O.prototype.onError.call(this,h,r),r.fatal||!r.context)return;r.context.type===U.PlaylistContextType.AUDIO_TRACK&&r.context.id===this.trackId&&r.context.groupId===this.groupId&&this.retryLoadingOrFail(r)},b.setAudioTrack=function(h){var r=this.tracksInGroup;if(h<0||h>=r.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var o=r[this.trackId];this.log("Now switching to audio-track index "+h);var s=r[h],f=s.id,d=s.groupId,l=d===void 0?"":d,p=s.name,c=s.type,i=s.url;if(this.trackId=h,this.trackName=p,this.selectDefaultTrack=!1,this.hls.trigger(I.Events.AUDIO_TRACK_SWITCHING,{id:f,groupId:l,name:p,type:c,url:i}),s.details&&!s.details.live)return;var n=this.switchParams(s.url,o==null?void 0:o.details);this.loadPlaylist(n)},b.selectInitialTrack=function(){var h=this.tracksInGroup;console.assert(h.length,"Initial audio track should be selected when tracks are known");var r=this.trackName,o=this.findTrackId(r)||this.findTrackId();o!==-1?this.setAudioTrack(o):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(I.Events.ERROR,{type:g.ErrorTypes.MEDIA_ERROR,details:g.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},b.findTrackId=function(h){for(var r=this.tracksInGroup,o=0;o<r.length;o++){var s=r[o];if((!this.selectDefaultTrack||s.default)&&(!h||h===s.name))return s.id}return-1},b.loadPlaylist=function(h){var r=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(r)){var o=r.id,s=r.groupId,f=r.url;if(h)try{f=h.addDirectives(f)}catch(d){this.warn("Could not construct new URL with HLS Delivery Directives: "+d)}this.log("loading audio-track playlist for id: "+o),this.clearTimer(),this.hls.trigger(I.Events.AUDIO_TRACK_LOADING,{url:f,id:o,groupId:s,deliveryDirectives:h||null})}},R(C,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(h){this.selectDefaultTrack=!1,this.setAudioTrack(h)}}]),C}(E.default);N.default=T},"./src/controller/base-playlist-controller.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return R});var I=S("./src/polyfills/number.ts"),g=S("./src/types/level.ts"),E=S("./src/controller/level-helper.ts"),U=S("./src/utils/logger.ts"),M=S("./src/errors.ts"),R=function(){function w(T,O){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=U.logger.log.bind(U.logger,O+":"),this.warn=U.logger.warn.bind(U.logger,O+":"),this.hls=T}var x=w.prototype;return x.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},x.onError=function(O,C){C.fatal&&C.type===M.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},x.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},x.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},x.stopLoad=function(){this.canLoad=!1,this.clearTimer()},x.switchParams=function(O,C){var b=C==null?void 0:C.renditionReports;if(b)for(var v=0;v<b.length;v++){var h=b[v],r=""+h.URI;if(r===O.substr(-r.length)){var o=parseInt(h["LAST-MSN"]),s=parseInt(h["LAST-PART"]);if(C&&this.hls.config.lowLatencyMode){var f=Math.min(C.age-C.partTarget,C.targetduration);s!==void 0&&f>C.partTarget&&(s+=1)}if(Object(I.isFiniteNumber)(o))return new g.HlsUrlParameters(o,Object(I.isFiniteNumber)(s)?s:void 0,g.HlsSkip.No)}}},x.loadPlaylist=function(O){},x.shouldLoadTrack=function(O){return this.canLoad&&O&&!!O.url&&(!O.details||O.details.live)},x.playlistLoaded=function(O,C,b){var v=this,h=C.details,r=C.stats,o=r.loading.end?Math.max(0,self.performance.now()-r.loading.end):0;if(h.advancedDateTime=Date.now()-o,h.live||b!=null&&b.live){if(h.reloaded(b),b&&this.log("live playlist "+O+" "+(h.advanced?"REFRESHED "+h.lastPartSn+"-"+h.lastPartIndex:"MISSED")),b&&h.fragments.length>0&&Object(E.mergeDetails)(b,h),!this.canLoad||!h.live)return;var s,f=void 0,d=void 0;if(h.canBlockReload&&h.endSN&&h.advanced){var l=this.hls.config.lowLatencyMode,p=h.lastPartSn,c=h.endSN,i=h.lastPartIndex,n=i!==-1,t=p===c,e=l?0:i;n?(f=t?c+1:p,d=t?e:i+1):f=c+1;var m=h.age,y=m+h.ageHeader,_=Math.min(y-h.partTarget,h.targetduration*1.5);if(_>0){if(b&&_>b.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+b.tuneInGoal+" to: "+_+" with playlist age: "+h.age),_=0;else{var A=Math.floor(_/h.targetduration);if(f+=A,d!==void 0){var k=Math.round(_%h.targetduration/h.partTarget);d+=k}this.log("CDN Tune-in age: "+h.ageHeader+"s last advanced "+m.toFixed(2)+"s goal: "+_+" skip sn "+A+" to part "+d)}h.tuneInGoal=_}if(s=this.getDeliveryDirectives(h,C.deliveryDirectives,f,d),l||!t){this.loadPlaylist(s);return}}else s=this.getDeliveryDirectives(h,C.deliveryDirectives,f,d);var F=Object(E.computeReloadInterval)(h,r);f!==void 0&&h.canBlockReload&&(F-=h.partTarget||1),this.log("reload live playlist "+O+" in "+Math.round(F)+" ms"),this.timer=self.setTimeout(function(){return v.loadPlaylist(s)},F)}else this.clearTimer()},x.getDeliveryDirectives=function(O,C,b,v){var h=Object(g.getSkipValue)(O,b);return C!=null&&C.skip&&O.deltaUpdateFailed&&(b=C.msn,v=C.part,h=g.HlsSkip.No),new g.HlsUrlParameters(b,v,h)},x.retryLoadingOrFail=function(O){var C=this,b=this.hls.config,v=this.retryCount<b.levelLoadingMaxRetry;if(v){var h;if(this.retryCount++,O.details.indexOf("LoadTimeOut")>-1&&(h=O.context)!==null&&h!==void 0&&h.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+O.details+'"'),this.loadPlaylist();else{var r=Math.min(Math.pow(2,this.retryCount)*b.levelLoadingRetryDelay,b.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return C.loadPlaylist()},r),this.warn("retry playlist loading #"+this.retryCount+" in "+r+' ms after "'+O.details+'"')}}else this.warn('cannot recover from error "'+O.details+'"'),this.clearTimer(),O.fatal=!0;return v},w}()},"./src/controller/base-stream-controller.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"State",function(){return c}),S.d(N,"default",function(){return i});var I=S("./src/polyfills/number.ts"),g=S("./src/task-loop.ts"),E=S("./src/controller/fragment-tracker.ts"),U=S("./src/utils/buffer-helper.ts"),M=S("./src/utils/logger.ts"),R=S("./src/events.ts"),w=S("./src/errors.ts"),x=S("./src/types/transmuxer.ts"),T=S("./src/utils/mp4-tools.ts"),O=S("./src/utils/discontinuities.ts"),C=S("./src/controller/fragment-finders.ts"),b=S("./src/controller/level-helper.ts"),v=S("./src/loader/fragment-loader.ts"),h=S("./src/crypt/decrypter.ts"),r=S("./src/utils/time-ranges.ts"),o=S("./src/types/loader.ts");function s(n,t){for(var e=0;e<t.length;e++){var m=t[e];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(n,m.key,m)}}function f(n,t,e){return t&&s(n.prototype,t),e&&s(n,e),n}function d(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function l(n,t){n.prototype=Object.create(t.prototype),n.prototype.constructor=n,p(n,t)}function p(n,t){return p=Object.setPrototypeOf||function(m,y){return m.__proto__=y,m},p(n,t)}var c={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"},i=function(n){l(t,n);function t(m,y,_){var A;return A=n.call(this)||this,A.hls=void 0,A.fragPrevious=null,A.fragCurrent=null,A.fragmentTracker=void 0,A.transmuxer=null,A._state=c.STOPPED,A.media=void 0,A.mediaBuffer=void 0,A.config=void 0,A.bitrateTest=!1,A.lastCurrentTime=0,A.nextLoadPosition=0,A.startPosition=0,A.loadedmetadata=!1,A.fragLoadError=0,A.retryDate=0,A.levels=null,A.fragmentLoader=void 0,A.levelLastLoaded=null,A.startFragRequested=!1,A.decrypter=void 0,A.initPTS=[],A.onvseeking=null,A.onvended=null,A.logPrefix="",A.log=void 0,A.warn=void 0,A.logPrefix=_,A.log=M.logger.log.bind(M.logger,_+":"),A.warn=M.logger.warn.bind(M.logger,_+":"),A.hls=m,A.fragmentLoader=new v.default(m.config),A.fragmentTracker=y,A.config=m.config,A.decrypter=new h.default(m,m.config),m.on(R.Events.KEY_LOADED,A.onKeyLoaded,d(A)),A}var e=t.prototype;return e.doTick=function(){this.onTickEnd()},e.onTickEnd=function(){},e.startLoad=function(y){},e.stopLoad=function(){this.fragmentLoader.abort();var y=this.fragCurrent;y&&this.fragmentTracker.removeFragment(y),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=c.STOPPED},e._streamEnded=function(y,_){var A=this.fragCurrent,k=this.fragmentTracker;if(!_.live&&A&&A.sn===_.endSN&&!y.nextStart){var F=k.getState(A);return F===E.FragmentState.PARTIAL||F===E.FragmentState.OK}return!1},e.onMediaAttached=function(y,_){var A=this.media=this.mediaBuffer=_.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),A.addEventListener("seeking",this.onvseeking),A.addEventListener("ended",this.onvended);var k=this.config;this.levels&&k.autoStartLoad&&this.state===c.STOPPED&&this.startLoad(k.startPosition)},e.onMediaDetaching=function(){var y=this.media;y!=null&&y.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),y&&(y.removeEventListener("seeking",this.onvseeking),y.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},e.onMediaSeeking=function(){var y=this.config,_=this.fragCurrent,A=this.media,k=this.mediaBuffer,F=this.state,z=A?A.currentTime:0,Q=U.BufferHelper.bufferInfo(k||A,z,y.maxBufferHole);if(this.log("media seeking to "+(Object(I.isFiniteNumber)(z)?z.toFixed(3):z)+", state: "+F),F===c.ENDED)this.resetLoadingState();else if(_&&!Q.len){var Y=y.maxFragLookUpTolerance,X=_.start-Y,le=_.start+_.duration+Y,ye=z>le;(z<X||ye)&&(ye&&_.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),_.loader.abort()),this.resetLoadingState())}A&&(this.lastCurrentTime=z),!this.loadedmetadata&&!Q.len&&(this.nextLoadPosition=this.startPosition=z),this.tickImmediate()},e.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},e.onKeyLoaded=function(y,_){if(this.state!==c.KEY_LOADING||_.frag!==this.fragCurrent||!this.levels)return;this.state=c.IDLE;var A=this.levels[_.frag.level].details;A&&this.loadFragment(_.frag,A,_.frag.start)},e.onHandlerDestroying=function(){this.stopLoad(),n.prototype.onHandlerDestroying.call(this)},e.onHandlerDestroyed=function(){this.state=c.STOPPED,this.hls.off(R.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,n.prototype.onHandlerDestroyed.call(this)},e.loadKey=function(y,_){this.log("Loading key for "+y.sn+" of ["+_.startSN+"-"+_.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+y.level),this.state=c.KEY_LOADING,this.fragCurrent=y,this.hls.trigger(R.Events.KEY_LOADING,{frag:y})},e.loadFragment=function(y,_,A){this._loadFragForPlayback(y,_,A)},e._loadFragForPlayback=function(y,_,A){var k=this,F=function(Q){if(k.fragContextChanged(y)){k.warn("Fragment "+y.sn+(Q.part?" p: "+Q.part.index:"")+" of level "+y.level+" was dropped during download."),k.fragmentTracker.removeFragment(y);return}y.stats.chunkCount++,k._handleFragmentLoadProgress(Q)};this._doFragLoad(y,_,A,F).then(function(z){if(!z)return;k.fragLoadError=0;var Q=k.state;if(k.fragContextChanged(y)){(Q===c.FRAG_LOADING||Q===c.BACKTRACKING||!k.fragCurrent&&Q===c.PARSING)&&(k.fragmentTracker.removeFragment(y),k.state=c.IDLE);return}if("payload"in z&&(k.log("Loaded fragment "+y.sn+" of level "+y.level),k.hls.trigger(R.Events.FRAG_LOADED,z),k.state===c.BACKTRACKING)){k.fragmentTracker.backtrack(y,z),k.resetFragmentLoading(y);return}k._handleFragmentLoadComplete(z)}).catch(function(z){k.warn(z),k.resetFragmentLoading(y)})},e.flushMainBuffer=function(y,_,A){if(A===void 0&&(A=null),!(y-_))return;var k={startOffset:y,endOffset:_,type:A};this.fragLoadError=0,this.hls.trigger(R.Events.BUFFER_FLUSHING,k)},e._loadInitSegment=function(y){var _=this;this._doFragLoad(y).then(function(A){if(!A||_.fragContextChanged(y)||!_.levels)throw new Error("init load aborted");return A}).then(function(A){var k=_.hls,F=A.payload,z=y.decryptdata;if(F&&F.byteLength>0&&z&&z.key&&z.iv&&z.method==="AES-128"){var Q=self.performance.now();return _.decrypter.webCryptoDecrypt(new Uint8Array(F),z.key.buffer,z.iv.buffer).then(function(Y){var X=self.performance.now();return k.trigger(R.Events.FRAG_DECRYPTED,{frag:y,payload:Y,stats:{tstart:Q,tdecrypt:X}}),A.payload=Y,A})}return A}).then(function(A){var k=_.fragCurrent,F=_.hls,z=_.levels;if(!z)throw new Error("init load aborted, missing levels");var Q=z[y.level].details;console.assert(Q,"Level details are defined when init segment is loaded");var Y=y.stats;_.state=c.IDLE,_.fragLoadError=0,y.data=new Uint8Array(A.payload),Y.parsing.start=Y.buffering.start=self.performance.now(),Y.parsing.end=Y.buffering.end=self.performance.now(),A.frag===k&&F.trigger(R.Events.FRAG_BUFFERED,{stats:Y,frag:k,part:null,id:y.type}),_.tick()}).catch(function(A){_.warn(A),_.resetFragmentLoading(y)})},e.fragContextChanged=function(y){var _=this.fragCurrent;return!y||!_||y.level!==_.level||y.sn!==_.sn||y.urlId!==_.urlId},e.fragBufferedComplete=function(y,_){var A=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+y.type+" sn: "+y.sn+(_?" part: "+_.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+y.level+" "+r.default.toString(U.BufferHelper.getBuffered(A))),this.state=c.IDLE,this.tick()},e._handleFragmentLoadComplete=function(y){var _=this.transmuxer;if(!_)return;var A=y.frag,k=y.part,F=y.partsLoaded,z=!F||F.length===0||F.some(function(Y){return!Y}),Q=new x.ChunkMetadata(A.level,A.sn,A.stats.chunkCount+1,0,k?k.index:-1,!z);_.flush(Q)},e._handleFragmentLoadProgress=function(y){},e._doFragLoad=function(y,_,A,k){var F=this;if(A===void 0&&(A=null),!this.levels)throw new Error("frag load aborted, missing levels");if(A=Math.max(y.start,A||0),this.config.lowLatencyMode&&_){var z=_.partList;if(z&&k){A>y.end&&_.fragmentHint&&(y=_.fragmentHint);var Q=this.getNextPart(z,y,A);if(Q>-1){var Y=z[Q];return this.log("Loading part sn: "+y.sn+" p: "+Y.index+" cc: "+y.cc+" of playlist ["+_.startSN+"-"+_.endSN+"] parts [0-"+Q+"-"+(z.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+y.level+", target: "+parseFloat(A.toFixed(3))),this.nextLoadPosition=Y.start+Y.duration,this.state=c.FRAG_LOADING,this.hls.trigger(R.Events.FRAG_LOADING,{frag:y,part:z[Q],targetBufferTime:A}),this.doFragPartsLoad(y,z,Q,k).catch(function(X){return F.handleFragLoadError(X)})}else if(!y.url||this.loadedEndOfParts(z,A))return Promise.resolve(null)}}return this.log("Loading fragment "+y.sn+" cc: "+y.cc+" "+(_?"of ["+_.startSN+"-"+_.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+y.level+", target: "+parseFloat(A.toFixed(3))),Object(I.isFiniteNumber)(y.sn)&&!this.bitrateTest&&(this.nextLoadPosition=y.start+y.duration),this.state=c.FRAG_LOADING,this.hls.trigger(R.Events.FRAG_LOADING,{frag:y,targetBufferTime:A}),this.fragmentLoader.load(y,k).catch(function(X){return F.handleFragLoadError(X)})},e.doFragPartsLoad=function(y,_,A,k){var F=this;return new Promise(function(z,Q){var Y=[],X=function le(ye){var ve=_[ye];F.fragmentLoader.loadPart(y,ve,k).then(function(Ne){Y[ve.index]=Ne;var Te=Ne.part;F.hls.trigger(R.Events.FRAG_LOADED,Ne);var Ce=_[ye+1];if(Ce&&Ce.fragment===y)le(ye+1);else return z({frag:y,part:Te,partsLoaded:Y})}).catch(Q)};X(A)})},e.handleFragLoadError=function(y){var _=y.data;return _&&_.details===w.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(_.frag,_.part):this.hls.trigger(R.Events.ERROR,_),null},e._handleTransmuxerFlush=function(y){var _=this.getCurrentContext(y);if(!_||this.state!==c.PARSING){this.fragCurrent||(this.state=c.IDLE);return}var A=_.frag,k=_.part,F=_.level,z=self.performance.now();A.stats.parsing.end=z,k&&(k.stats.parsing.end=z),this.updateLevelTiming(A,k,F,y.partial)},e.getCurrentContext=function(y){var _=this.levels,A=y.level,k=y.sn,F=y.part;if(!_||!_[A])return this.warn("Levels object was unset while buffering fragment "+k+" of level "+A+". The current chunk will not be buffered."),null;var z=_[A],Q=F>-1?Object(b.getPartWith)(z,k,F):null,Y=Q?Q.fragment:Object(b.getFragmentWithSN)(z,k,this.fragCurrent);return Y?{frag:Y,part:Q,level:z}:null},e.bufferFragmentData=function(y,_,A,k){if(!y||this.state!==c.PARSING)return;var F=y.data1,z=y.data2,Q=F;if(F&&z&&(Q=Object(T.appendUint8Array)(F,z)),!Q||!Q.length)return;var Y={type:y.type,frag:_,part:A,chunkMeta:k,parent:_.type,data:Q};this.hls.trigger(R.Events.BUFFER_APPENDING,Y),y.dropped&&y.independent&&!A&&this.flushBufferGap(_)},e.flushBufferGap=function(y){var _=this.media;if(!_)return;if(!U.BufferHelper.isBuffered(_,_.currentTime)){this.flushMainBuffer(0,y.start);return}var A=_.currentTime,k=U.BufferHelper.bufferInfo(_,A,0),F=y.duration,z=Math.min(this.config.maxFragLookUpTolerance*2,F*.25),Q=Math.max(Math.min(y.start-z,k.end-z),A+z);y.start-Q>z&&this.flushMainBuffer(Q,y.start)},e.getFwdBufferInfo=function(y,_){var A=this.config,k=this.getLoadPosition();if(!Object(I.isFiniteNumber)(k))return null;var F=U.BufferHelper.bufferInfo(y,k,A.maxBufferHole);if(F.len===0&&F.nextStart!==void 0){var z=this.fragmentTracker.getBufferedFrag(k,_);if(z&&F.nextStart<z.end)return U.BufferHelper.bufferInfo(y,k,Math.max(F.nextStart,A.maxBufferHole))}return F},e.getMaxBufferLength=function(y){var _=this.config,A;return y?A=Math.max(8*_.maxBufferSize/y,_.maxBufferLength):A=_.maxBufferLength,Math.min(A,_.maxMaxBufferLength)},e.reduceMaxBufferLength=function(y){var _=this.config,A=y||_.maxBufferLength;return _.maxMaxBufferLength>=A?(_.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+_.maxMaxBufferLength+"s"),!0):!1},e.getNextFragment=function(y,_){var A,k,F=_.fragments,z=F.length;if(!z)return null;var Q=this.config,Y=F[0].start,X;if(_.live){var le=Q.initialLiveManifestSize;if(z<le)return this.warn("Not enough fragments to start playback (have: "+z+", need: "+le+")"),null;!_.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(X=this.getInitialLiveFragment(_,F),this.startPosition=X?this.hls.liveSyncPosition||X.start:y)}else y<=Y&&(X=F[0]);if(!X){var ye=Q.lowLatencyMode?_.partEnd:_.fragmentEnd;X=this.getFragmentAtPosition(y,ye,_)}return(A=X)!==null&&A!==void 0&&A.initSegment&&!((k=X)!==null&&k!==void 0&&k.initSegment.data)&&!this.bitrateTest&&(X=X.initSegment),X},e.getNextPart=function(y,_,A){for(var k=-1,F=!1,z=!0,Q=0,Y=y.length;Q<Y;Q++){var X=y[Q];if(z=z&&!X.independent,k>-1&&A<X.start)break;var le=X.loaded;!le&&(F||X.independent||z)&&X.fragment===_&&(k=Q),F=le}return k},e.loadedEndOfParts=function(y,_){var A=y[y.length-1];return A&&_>A.start&&A.loaded},e.getInitialLiveFragment=function(y,_){var A=this.fragPrevious,k=null;if(A){if(y.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+A.programDateTime),k=Object(C.findFragmentByPDT)(_,A.endProgramDateTime,this.config.maxFragLookUpTolerance)),!k){var F=A.sn+1;if(F>=y.startSN&&F<=y.endSN){var z=_[F-y.startSN];A.cc===z.cc&&(k=z,this.log("Live playlist, switching playlist, load frag with next SN: "+k.sn))}k||(k=Object(C.findFragWithCC)(_,A.cc),k&&this.log("Live playlist, switching playlist, load frag with same CC: "+k.sn))}}else{var Q=this.hls.liveSyncPosition;Q!==null&&(k=this.getFragmentAtPosition(Q,this.bitrateTest?y.fragmentEnd:y.edge,y))}return k},e.getFragmentAtPosition=function(y,_,A){var k=this.config,F=this.fragPrevious,z=A.fragments,Q=A.endSN,Y=A.fragmentHint,X=k.maxFragLookUpTolerance,le=!!(k.lowLatencyMode&&A.partList&&Y);le&&Y&&!this.bitrateTest&&(z=z.concat(Y),Q=Y.sn);var ye;if(y<_){var ve=y>_-X?0:X;ye=Object(C.findFragmentByPTS)(F,z,y,ve)}else ye=z[z.length-1];if(ye){var Ne=ye.sn-A.startSN,Te=F&&ye.level===F.level,Ce=z[Ne+1],_e=this.fragmentTracker.getState(ye);if(_e===E.FragmentState.BACKTRACKED){ye=null;for(var Re=Ne;z[Re]&&this.fragmentTracker.getState(z[Re])===E.FragmentState.BACKTRACKED;)F?ye=z[Re--]:ye=z[--Re];ye||(ye=Ce)}else F&&ye.sn===F.sn&&!le&&(Te&&(ye.sn<Q&&this.fragmentTracker.getState(Ce)!==E.FragmentState.OK?(this.log("SN "+ye.sn+" just loaded, load next one: "+Ce.sn),ye=Ce):ye=null))}return ye},e.synchronizeToLiveEdge=function(y){var _=this.config,A=this.media;if(!A)return;var k=this.hls.liveSyncPosition,F=A.currentTime,z=y.fragments[0].start,Q=y.edge,Y=F>=z-_.maxFragLookUpTolerance&&F<=Q;if(k!==null&&A.duration>k&&(F<k||!Y)){var X=_.liveMaxLatencyDuration!==void 0?_.liveMaxLatencyDuration:_.liveMaxLatencyDurationCount*y.targetduration;(!Y&&A.readyState<4||F<Q-X)&&(this.loadedmetadata||(this.nextLoadPosition=k),A.readyState&&(this.warn("Playback: "+F.toFixed(3)+" is located too far from the end of live sliding playlist: "+Q+", reset currentTime to : "+k.toFixed(3)),A.currentTime=k))}},e.alignPlaylists=function(y,_){var A=this.levels,k=this.levelLastLoaded,F=this.fragPrevious,z=k!==null?A[k]:null,Q=y.fragments.length;if(!Q)return this.warn("No fragments in live playlist"),0;var Y=y.fragments[0].start,X=!_,le=y.alignedSliding&&Object(I.isFiniteNumber)(Y);if(X||!le&&!Y){Object(O.alignStream)(F,z,y);var ye=y.fragments[0].start;return this.log("Live playlist sliding: "+ye.toFixed(2)+" start-sn: "+(_?_.startSN:"na")+"->"+y.startSN+" prev-sn: "+(F?F.sn:"na")+" fragments: "+Q),ye}return Y},e.waitForCdnTuneIn=function(y){var _=3;return y.live&&y.canBlockReload&&y.tuneInGoal>Math.max(y.partHoldBack,y.partTarget*_)},e.setStartPosition=function(y,_){var A=this.startPosition;if(A<_&&(A=-1),A===-1||this.lastCurrentTime===-1){var k=y.startTimeOffset;Object(I.isFiniteNumber)(k)?(A=_+k,k<0&&(A+=y.totalduration),A=Math.min(Math.max(_,A),_+y.totalduration),this.log("Start time offset "+k+" found in playlist, adjust startPosition to "+A),this.startPosition=A):y.live?A=this.hls.liveSyncPosition||_:this.startPosition=A=0,this.lastCurrentTime=A}this.nextLoadPosition=A},e.getLoadPosition=function(){var y=this.media,_=0;return this.loadedmetadata&&y?_=y.currentTime:this.nextLoadPosition&&(_=this.nextLoadPosition),_},e.handleFragLoadAborted=function(y,_){this.transmuxer&&y.sn!=="initSegment"&&y.stats.aborted&&(this.warn("Fragment "+y.sn+(_?" part"+_.index:"")+" of level "+y.level+" was aborted"),this.resetFragmentLoading(y))},e.resetFragmentLoading=function(y){(!this.fragCurrent||!this.fragContextChanged(y))&&(this.state=c.IDLE)},e.onFragmentOrKeyLoadError=function(y,_){if(_.fatal)return;var A=_.frag;if(!A||A.type!==y)return;var k=this.fragCurrent;console.assert(k&&A.sn===k.sn&&A.level===k.level&&A.urlId===k.urlId,"Frag load error must match current frag to retry");var F=this.config;if(this.fragLoadError+1<=F.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(A.level))return;var z=Math.min(Math.pow(2,this.fragLoadError)*F.fragLoadingRetryDelay,F.fragLoadingMaxRetryTimeout);this.warn("Fragment "+A.sn+" of "+y+" "+A.level+" failed to load, retrying in "+z+"ms"),this.retryDate=self.performance.now()+z,this.fragLoadError++,this.state=c.FRAG_LOADING_WAITING_RETRY}else _.levelRetry?(y===o.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=c.IDLE):(M.logger.error(_.details+" reaches max retry, redispatch as fatal ..."),_.fatal=!0,this.hls.stopLoad(),this.state=c.ERROR)},e.afterBufferFlushed=function(y,_,A){if(!y)return;var k=U.BufferHelper.getBuffered(y);this.fragmentTracker.detectEvictedFragments(_,k,A),this.state===c.ENDED&&this.resetLoadingState()},e.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=c.IDLE},e.resetLiveStartWhenNotLoaded=function(y){if(!this.loadedmetadata){this.startFragRequested=!1;var _=this.levels?this.levels[y].details:null;if(_!=null&&_.live)return this.startPosition=-1,this.setStartPosition(_,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},e.updateLevelTiming=function(y,_,A,k){var F=this,z=A.details;console.assert(!!z,"level.details must be defined");var Q=Object.keys(y.elementaryStreams).reduce(function(Y,X){var le=y.elementaryStreams[X];if(le){var ye=le.endPTS-le.startPTS;if(ye<=0)return F.warn("Could not parse fragment "+y.sn+" "+X+" duration reliably ("+ye+") resetting transmuxer to fallback to playlist timing"),F.resetTransmuxer(),Y||!1;var ve=k?0:Object(b.updateFragPTSDTS)(z,y,le.startPTS,le.endPTS,le.startDTS,le.endDTS);return F.hls.trigger(R.Events.LEVEL_PTS_UPDATED,{details:z,level:A,drift:ve,type:X,frag:y,start:le.startPTS,end:le.endPTS}),!0}return Y},!1);Q?(this.state=c.PARSED,this.hls.trigger(R.Events.FRAG_PARSED,{frag:y,part:_})):this.resetLoadingState()},e.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},f(t,[{key:"state",get:function(){return this._state},set:function(y){var _=this._state;_!==y&&(this._state=y,this.log(_+"->"+y))}}]),t}(g.default)},"./src/controller/buffer-controller.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return C});var I=S("./src/polyfills/number.ts"),g=S("./src/events.ts"),E=S("./src/utils/logger.ts"),U=S("./src/errors.ts"),M=S("./src/utils/buffer-helper.ts"),R=S("./src/utils/mediasource-helper.ts"),w=S("./src/loader/fragment.ts"),x=S("./src/controller/buffer-operation-queue.ts"),T=Object(R.getMediaSource)(),O=/([ha]vc.)(?:\.[^.,]+)+/,C=function(){function b(h){var r=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var o=r.hls,s=r.media,f=r.mediaSource;E.logger.log("[buffer-controller]: Media source opened"),s&&(r.updateMediaElementDuration(),o.trigger(g.Events.MEDIA_ATTACHED,{media:s})),f&&f.removeEventListener("sourceopen",r._onMediaSourceOpen),r.checkPendingTracks()},this._onMediaSourceClose=function(){E.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){E.logger.log("[buffer-controller]: Media source ended")},this.hls=h,this._initSourceBuffer(),this.registerListeners()}var v=b.prototype;return v.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},v.destroy=function(){this.unregisterListeners(),this.details=null},v.registerListeners=function(){var r=this.hls;r.on(g.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),r.on(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.on(g.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.on(g.Events.BUFFER_RESET,this.onBufferReset,this),r.on(g.Events.BUFFER_APPENDING,this.onBufferAppending,this),r.on(g.Events.BUFFER_CODECS,this.onBufferCodecs,this),r.on(g.Events.BUFFER_EOS,this.onBufferEos,this),r.on(g.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),r.on(g.Events.LEVEL_UPDATED,this.onLevelUpdated,this),r.on(g.Events.FRAG_PARSED,this.onFragParsed,this),r.on(g.Events.FRAG_CHANGED,this.onFragChanged,this)},v.unregisterListeners=function(){var r=this.hls;r.off(g.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),r.off(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.off(g.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.off(g.Events.BUFFER_RESET,this.onBufferReset,this),r.off(g.Events.BUFFER_APPENDING,this.onBufferAppending,this),r.off(g.Events.BUFFER_CODECS,this.onBufferCodecs,this),r.off(g.Events.BUFFER_EOS,this.onBufferEos,this),r.off(g.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),r.off(g.Events.LEVEL_UPDATED,this.onLevelUpdated,this),r.off(g.Events.FRAG_PARSED,this.onFragParsed,this),r.off(g.Events.FRAG_CHANGED,this.onFragChanged,this)},v._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new x.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},v.onManifestParsed=function(r,o){var s=2;(o.audio&&!o.video||!o.altAudio)&&(s=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=s,this.details=null,E.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},v.onMediaAttaching=function(r,o){var s=this.media=o.media;if(s&&T){var f=this.mediaSource=new T;f.addEventListener("sourceopen",this._onMediaSourceOpen),f.addEventListener("sourceended",this._onMediaSourceEnded),f.addEventListener("sourceclose",this._onMediaSourceClose),s.src=self.URL.createObjectURL(f),this._objectUrl=s.src}},v.onMediaDetaching=function(){var r=this.media,o=this.mediaSource,s=this._objectUrl;if(o){if(E.logger.log("[buffer-controller]: media source detaching"),o.readyState==="open")try{o.endOfStream()}catch(f){E.logger.warn("[buffer-controller]: onMediaDetaching: "+f.message+" while calling endOfStream")}this.onBufferReset(),o.removeEventListener("sourceopen",this._onMediaSourceOpen),o.removeEventListener("sourceended",this._onMediaSourceEnded),o.removeEventListener("sourceclose",this._onMediaSourceClose),r&&(s&&self.URL.revokeObjectURL(s),r.src===s?(r.removeAttribute("src"),r.load()):E.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(g.Events.MEDIA_DETACHED,void 0)},v.onBufferReset=function(){var r=this;this.getSourceBufferTypes().forEach(function(o){var s=r.sourceBuffer[o];try{s&&(r.removeBufferListeners(o),r.mediaSource&&r.mediaSource.removeSourceBuffer(s),r.sourceBuffer[o]=void 0)}catch(f){E.logger.warn("[buffer-controller]: Failed to reset the "+o+" buffer",f)}}),this._initSourceBuffer()},v.onBufferCodecs=function(r,o){var s=this,f=this.getSourceBufferTypes().length;if(Object.keys(o).forEach(function(d){if(f){var l=s.tracks[d];if(l&&typeof l.buffer.changeType=="function"){var p=o[d],c=p.codec,i=p.levelCodec,n=p.container,t=(l.levelCodec||l.codec).replace(O,"$1"),e=(i||c).replace(O,"$1");if(t!==e){var m=n+";codecs="+(i||c);s.appendChangeType(d,m)}}}else s.pendingTracks[d]=o[d]}),f)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},v.appendChangeType=function(r,o){var s=this,f=this.operationQueue,d={execute:function(){var p=s.sourceBuffer[r];p&&(E.logger.log("[buffer-controller]: changing "+r+" sourceBuffer type to "+o),p.changeType(o)),f.shiftAndExecuteNext(r)},onStart:function(){},onComplete:function(){},onError:function(p){E.logger.warn("[buffer-controller]: Failed to change "+r+" SourceBuffer type",p)}};f.append(d,r)},v.onBufferAppending=function(r,o){var s=this,f=this.hls,d=this.operationQueue,l=this.tracks,p=o.data,c=o.type,i=o.frag,n=o.part,t=o.chunkMeta,e=t.buffering[c],m=self.performance.now();e.start=m;var y=i.stats.buffering,_=n?n.stats.buffering:null;y.start===0&&(y.start=m),_&&_.start===0&&(_.start=m);var A=l.audio,k=c==="audio"&&t.id===1&&(A==null?void 0:A.container)==="audio/mpeg",F={execute:function(){if(e.executeStart=self.performance.now(),k){var Q=s.sourceBuffer[c];if(Q){var Y=i.start-Q.timestampOffset;Math.abs(Y)>=.1&&(E.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+i.start+" (delta: "+Y+") sn: "+i.sn+")"),Q.timestampOffset=i.start)}}s.appendExecutor(p,c)},onStart:function(){},onComplete:function(){var Q=self.performance.now();e.executeEnd=e.end=Q,y.first===0&&(y.first=Q),_&&_.first===0&&(_.first=Q);var Y=s.sourceBuffer,X={};for(var le in Y)X[le]=M.BufferHelper.getBuffered(Y[le]);s.appendError=0,s.hls.trigger(g.Events.BUFFER_APPENDED,{type:c,frag:i,part:n,chunkMeta:t,parent:i.type,timeRanges:X})},onError:function(Q){E.logger.error("[buffer-controller]: Error encountered while trying to append to the "+c+" SourceBuffer",Q);var Y={type:U.ErrorTypes.MEDIA_ERROR,parent:i.type,details:U.ErrorDetails.BUFFER_APPEND_ERROR,err:Q,fatal:!1};Q.code===DOMException.QUOTA_EXCEEDED_ERR?Y.details=U.ErrorDetails.BUFFER_FULL_ERROR:(s.appendError++,Y.details=U.ErrorDetails.BUFFER_APPEND_ERROR,s.appendError>f.config.appendErrorMaxRetry&&(E.logger.error("[buffer-controller]: Failed "+f.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),Y.fatal=!0)),f.trigger(g.Events.ERROR,Y)}};d.append(F,c)},v.onBufferFlushing=function(r,o){var s=this,f=this.operationQueue,d=function(p){return{execute:s.removeExecutor.bind(s,p,o.startOffset,o.endOffset),onStart:function(){},onComplete:function(){s.hls.trigger(g.Events.BUFFER_FLUSHED,{type:p})},onError:function(i){E.logger.warn("[buffer-controller]: Failed to remove from "+p+" SourceBuffer",i)}}};o.type?f.append(d(o.type),o.type):this.getSourceBufferTypes().forEach(function(l){f.append(d(l),l)})},v.onFragParsed=function(r,o){var s=this,f=o.frag,d=o.part,l=[],p=d?d.elementaryStreams:f.elementaryStreams;p[w.ElementaryStreamTypes.AUDIOVIDEO]?l.push("audiovideo"):(p[w.ElementaryStreamTypes.AUDIO]&&l.push("audio"),p[w.ElementaryStreamTypes.VIDEO]&&l.push("video"));var c=function(){var n=self.performance.now();f.stats.buffering.end=n,d&&(d.stats.buffering.end=n);var t=d?d.stats:f.stats;s.hls.trigger(g.Events.FRAG_BUFFERED,{frag:f,part:d,stats:t,id:f.type})};l.length===0&&E.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+f.type+" level: "+f.level+" sn: "+f.sn),this.blockBuffers(c,l)},v.onFragChanged=function(r,o){this.flushBackBuffer()},v.onBufferEos=function(r,o){var s=this,f=this.getSourceBufferTypes().reduce(function(d,l){var p=s.sourceBuffer[l];return(!o.type||o.type===l)&&(p&&!p.ended&&(p.ended=!0,E.logger.log("[buffer-controller]: "+l+" sourceBuffer now EOS"))),d&&!!(!p||p.ended)},!0);f&&this.blockBuffers(function(){var d=s.mediaSource;if(!d||d.readyState!=="open")return;d.endOfStream()})},v.onLevelUpdated=function(r,o){var s=o.details;if(!s.fragments.length)return;this.details=s,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},v.flushBackBuffer=function(){var r=this.hls,o=this.details,s=this.media,f=this.sourceBuffer;if(!s||o===null)return;var d=this.getSourceBufferTypes();if(!d.length)return;var l=o.live&&r.config.liveBackBufferLength!==null?r.config.liveBackBufferLength:r.config.backBufferLength;if(!Object(I.isFiniteNumber)(l)||l<0)return;var p=s.currentTime,c=o.levelTargetDuration,i=Math.max(l,c),n=Math.floor(p/c)*c-i;d.forEach(function(t){var e=f[t];if(e){var m=M.BufferHelper.getBuffered(e);m.length>0&&n>m.start(0)&&(r.trigger(g.Events.BACK_BUFFER_REACHED,{bufferEnd:n}),o.live&&r.trigger(g.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:n}),r.trigger(g.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:n,type:t}))}})},v.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var r=this.details,o=this.hls,s=this.media,f=this.mediaSource,d=r.fragments[0].start+r.totalduration,l=s.duration,p=Object(I.isFiniteNumber)(f.duration)?f.duration:0;r.live&&o.config.liveDurationInfinity?(E.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),f.duration=Infinity,this.updateSeekableRange(r)):(d>p&&d>l||!Object(I.isFiniteNumber)(l))&&(E.logger.log("[buffer-controller]: Updating Media Source duration to "+d.toFixed(3)),f.duration=d)},v.updateSeekableRange=function(r){var o=this.mediaSource,s=r.fragments,f=s.length;if(f&&r.live&&o!==null&&o!==void 0&&o.setLiveSeekableRange){var d=Math.max(0,s[0].start),l=Math.max(d,d+r.totalduration);o.setLiveSeekableRange(d,l)}},v.checkPendingTracks=function(){var r=this.bufferCodecEventsExpected,o=this.operationQueue,s=this.pendingTracks,f=Object.keys(s).length;if(f&&!r||f===2){this.createSourceBuffers(s),this.pendingTracks={};var d=this.getSourceBufferTypes();if(d.length===0){this.hls.trigger(g.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}d.forEach(function(l){o.executeNext(l)})}},v.createSourceBuffers=function(r){var o=this.sourceBuffer,s=this.mediaSource;if(!s)throw Error("createSourceBuffers called when mediaSource was null");var f=0;for(var d in r)if(!o[d]){var l=r[d];if(!l)throw Error("source buffer exists for track "+d+", however track does not");var p=l.levelCodec||l.codec,c=l.container+";codecs="+p;E.logger.log("[buffer-controller]: creating sourceBuffer("+c+")");try{var i=o[d]=s.addSourceBuffer(c),n=d;this.addBufferListener(n,"updatestart",this._onSBUpdateStart),this.addBufferListener(n,"updateend",this._onSBUpdateEnd),this.addBufferListener(n,"error",this._onSBUpdateError),this.tracks[d]={buffer:i,codec:p,container:l.container,levelCodec:l.levelCodec,id:l.id},f++}catch(t){E.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+t.message),this.hls.trigger(g.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:t,mimeType:c})}}f&&this.hls.trigger(g.Events.BUFFER_CREATED,{tracks:this.tracks})},v._onSBUpdateStart=function(r){var o=this.operationQueue,s=o.current(r);s.onStart()},v._onSBUpdateEnd=function(r){var o=this.operationQueue,s=o.current(r);s.onComplete(),o.shiftAndExecuteNext(r)},v._onSBUpdateError=function(r,o){E.logger.error("[buffer-controller]: "+r+" SourceBuffer error",o),this.hls.trigger(g.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var s=this.operationQueue.current(r);s&&s.onError(o)},v.removeExecutor=function(r,o,s){var f=this.media,d=this.mediaSource,l=this.operationQueue,p=this.sourceBuffer,c=p[r];if(!f||!d||!c){E.logger.warn("[buffer-controller]: Attempting to remove from the "+r+" SourceBuffer, but it does not exist"),l.shiftAndExecuteNext(r);return}var i=Object(I.isFiniteNumber)(f.duration)?f.duration:Infinity,n=Object(I.isFiniteNumber)(d.duration)?d.duration:Infinity,t=Math.max(0,o),e=Math.min(s,i,n);e>t?(E.logger.log("[buffer-controller]: Removing ["+t+","+e+"] from the "+r+" SourceBuffer"),console.assert(!c.updating,r+" sourceBuffer must not be updating"),c.remove(t,e)):l.shiftAndExecuteNext(r)},v.appendExecutor=function(r,o){var s=this.operationQueue,f=this.sourceBuffer,d=f[o];if(!d){E.logger.warn("[buffer-controller]: Attempting to append to the "+o+" SourceBuffer, but it does not exist"),s.shiftAndExecuteNext(o);return}d.ended=!1,console.assert(!d.updating,o+" sourceBuffer must not be updating"),d.appendBuffer(r)},v.blockBuffers=function(r,o){var s=this;if(o===void 0&&(o=this.getSourceBufferTypes()),!o.length){E.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(r);return}var f=this.operationQueue,d=o.map(function(l){return f.appendBlocker(l)});Promise.all(d).then(function(){r(),o.forEach(function(l){var p=s.sourceBuffer[l];(!p||!p.updating)&&f.shiftAndExecuteNext(l)})})},v.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},v.addBufferListener=function(r,o,s){var f=this.sourceBuffer[r];if(!f)return;var d=s.bind(this,r);this.listeners[r].push({event:o,listener:d}),f.addEventListener(o,d)},v.removeBufferListeners=function(r){var o=this.sourceBuffer[r];if(!o)return;this.listeners[r].forEach(function(s){o.removeEventListener(s.event,s.listener)})},b}()},"./src/controller/buffer-operation-queue.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return g});var I=S("./src/utils/logger.ts"),g=function(){function E(M){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=M}var U=E.prototype;return U.append=function(R,w){var x=this.queues[w];x.push(R),x.length===1&&this.buffers[w]&&this.executeNext(w)},U.insertAbort=function(R,w){var x=this.queues[w];x.unshift(R),this.executeNext(w)},U.appendBlocker=function(R){var w,x=new Promise(function(O){w=O}),T={execute:w,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(T,R),x},U.executeNext=function(R){var w=this.buffers,x=this.queues,T=w[R],O=x[R];if(O.length){var C=O[0];try{C.execute()}catch(b){I.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),C.onError(b),(!T||!T.updating)&&(O.shift(),this.executeNext(R))}}},U.shiftAndExecuteNext=function(R){this.queues[R].shift(),this.executeNext(R)},U.current=function(R){return this.queues[R][0]},E}()},"./src/controller/cap-level-controller.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/events.ts");function g(M,R){for(var w=0;w<R.length;w++){var x=R[w];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(M,x.key,x)}}function E(M,R,w){return R&&g(M.prototype,R),w&&g(M,w),M}var U=function(){function M(w){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=w,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var R=M.prototype;return R.setStreamController=function(x){this.streamController=x},R.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},R.registerListeners=function(){var x=this.hls;x.on(I.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),x.on(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),x.on(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),x.on(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),x.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},R.unregisterListener=function(){var x=this.hls;x.off(I.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),x.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),x.off(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),x.off(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),x.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},R.onFpsDropLevelCapping=function(x,T){M.isLevelAllowed(T.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(T.droppedLevel)},R.onMediaAttaching=function(x,T){this.media=T.media instanceof HTMLVideoElement?T.media:null},R.onManifestParsed=function(x,T){var O=this.hls;this.restrictedLevels=[],this.firstLevel=T.firstLevel,O.config.capLevelToPlayerSize&&T.video&&this.startCapping()},R.onBufferCodecs=function(x,T){var O=this.hls;O.config.capLevelToPlayerSize&&T.video&&this.startCapping()},R.onMediaDetaching=function(){this.stopCapping()},R.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var x=this.hls.levels;if(x.length){var T=this.hls;T.autoLevelCapping=this.getMaxLevel(x.length-1),T.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=T.autoLevelCapping}}},R.getMaxLevel=function(x){var T=this,O=this.hls.levels;if(!O.length)return-1;var C=O.filter(function(b,v){return M.isLevelAllowed(v,T.restrictedLevels)&&v<=x});return this.clientRect=null,M.getMaxLevelByMediaSize(C,this.mediaWidth,this.mediaHeight)},R.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()},R.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},R.getDimensions=function(){if(this.clientRect)return this.clientRect;var x=this.media,T={width:0,height:0};if(x){var O=x.getBoundingClientRect();T.width=O.width,T.height=O.height,!T.width&&!T.height&&(T.width=O.right-O.left||x.width||0,T.height=O.bottom-O.top||x.height||0)}return this.clientRect=T,T},M.isLevelAllowed=function(x,T){return T===void 0&&(T=[]),T.indexOf(x)===-1},M.getMaxLevelByMediaSize=function(x,T,O){if(!x||!x.length)return-1;for(var C=function(o,s){return s?o.width!==s.width||o.height!==s.height:!0},b=x.length-1,v=0;v<x.length;v+=1){var h=x[v];if((h.width>=T||h.height>=O)&&C(h,x[v+1])){b=v;break}}return b},E(M,[{key:"mediaWidth",get:function(){return this.getDimensions().width*M.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*M.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var x=1;try{x=self.devicePixelRatio}catch(T){}return x}}]),M}();N.default=U},"./src/controller/cmcd-controller.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return C});var I=S("./src/events.ts"),g=S("./src/types/cmcd.ts"),E=S("./src/utils/buffer-helper.ts"),U=S("./src/utils/logger.ts");function M(b,v){for(var h=0;h<v.length;h++){var r=v[h];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(b,r.key,r)}}function R(b,v,h){return v&&M(b.prototype,v),h&&M(b,h),b}function w(b,v){var h=typeof Symbol!="undefined"&&b[Symbol.iterator]||b["@@iterator"];if(h)return(h=h.call(b)).next.bind(h);if(Array.isArray(b)||(h=x(b))||v&&b&&typeof b.length=="number"){h&&(b=h);var r=0;return function(){return r>=b.length?{done:!0}:{done:!1,value:b[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function x(b,v){if(!b)return;if(typeof b=="string")return T(b,v);var h=Object.prototype.toString.call(b).slice(8,-1);if(h==="Object"&&b.constructor&&(h=b.constructor.name),h==="Map"||h==="Set")return Array.from(b);if(h==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h))return T(b,v)}function T(b,v){(v==null||v>b.length)&&(v=b.length);for(var h=0,r=new Array(v);h<v;h++)r[h]=b[h];return r}function O(){return O=Object.assign||function(b){for(var v=1;v<arguments.length;v++){var h=arguments[v];for(var r in h)Object.prototype.hasOwnProperty.call(h,r)&&(b[r]=h[r])}return b},O.apply(this,arguments)}var C=function(){function b(h){var r=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){r.initialized&&(r.starved=!0),r.buffering=!0},this.onPlaying=function(){r.initialized||(r.initialized=!0),r.buffering=!1},this.applyPlaylistData=function(f){try{r.apply(f,{ot:g.CMCDObjectType.MANIFEST,su:!r.initialized})}catch(d){U.logger.warn("Could not generate manifest CMCD data.",d)}},this.applyFragmentData=function(f){try{var d=f.frag,l=r.hls.levels[d.level],p=r.getObjectType(d),c={d:d.duration*1e3,ot:p};(p===g.CMCDObjectType.VIDEO||p===g.CMCDObjectType.AUDIO||p==g.CMCDObjectType.MUXED)&&(c.br=l.bitrate/1e3,c.tb=r.getTopBandwidth(p),c.bl=r.getBufferLength(p)),r.apply(f,c)}catch(i){U.logger.warn("Could not generate segment CMCD data.",i)}},this.hls=h;var o=this.config=h.config,s=o.cmcd;s!=null&&(o.pLoader=this.createPlaylistLoader(),o.fLoader=this.createFragmentLoader(),this.sid=s.sessionId||b.uuid(),this.cid=s.contentId,this.useHeaders=s.useHeaders===!0,this.registerListeners())}var v=b.prototype;return v.registerListeners=function(){var r=this.hls;r.on(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.on(I.Events.MEDIA_DETACHED,this.onMediaDetached,this),r.on(I.Events.BUFFER_CREATED,this.onBufferCreated,this)},v.unregisterListeners=function(){var r=this.hls;r.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.off(I.Events.MEDIA_DETACHED,this.onMediaDetached,this),r.off(I.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},v.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},v.onMediaAttached=function(r,o){this.media=o.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},v.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},v.onBufferCreated=function(r,o){var s,f;this.audioBuffer=(s=o.tracks.audio)===null||s===void 0?void 0:s.buffer,this.videoBuffer=(f=o.tracks.video)===null||f===void 0?void 0:f.buffer},v.createData=function(){var r;return{v:g.CMCDVersion,sf:g.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(r=this.media)===null||r===void 0?void 0:r.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},v.apply=function(r,o){o===void 0&&(o={}),O(o,this.createData());var s=o.ot===g.CMCDObjectType.INIT||o.ot===g.CMCDObjectType.VIDEO||o.ot===g.CMCDObjectType.MUXED;if(this.starved&&s&&(o.bs=!0,o.su=!0,this.starved=!1),o.su==null&&(o.su=this.buffering),this.useHeaders){var f=b.toHeaders(o);if(!Object.keys(f).length)return;r.headers||(r.headers={}),O(r.headers,f)}else{var d=b.toQuery(o);if(!d)return;r.url=b.appendQueryToUri(r.url,d)}},v.getObjectType=function(r){var o=r.type;return o==="subtitle"?g.CMCDObjectType.TIMED_TEXT:r.sn==="initSegment"?g.CMCDObjectType.INIT:o==="audio"?g.CMCDObjectType.AUDIO:o==="main"?this.hls.audioTracks.length?g.CMCDObjectType.VIDEO:g.CMCDObjectType.MUXED:void 0},v.getTopBandwidth=function(r){for(var o=0,s=r===g.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,f=w(s),d;!(d=f()).done;){var l=d.value;l.bitrate>o&&(o=l.bitrate)}return o>0?o:NaN},v.getBufferLength=function(r){var o=this.hls.media,s=r===g.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!s||!o)return NaN;var f=E.BufferHelper.bufferInfo(s,o.currentTime,this.config.maxBufferHole);return f.len*1e3},v.createPlaylistLoader=function(){var r=this.config.pLoader,o=this.applyPlaylistData,s=r||this.config.loader;return function(){function f(l){this.loader=void 0,this.loader=new s(l)}var d=f.prototype;return d.destroy=function(){this.loader.destroy()},d.abort=function(){this.loader.abort()},d.load=function(p,c,i){o(p),this.loader.load(p,c,i)},R(f,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),f}()},v.createFragmentLoader=function(){var r=this.config.fLoader,o=this.applyFragmentData,s=r||this.config.loader;return function(){function f(l){this.loader=void 0,this.loader=new s(l)}var d=f.prototype;return d.destroy=function(){this.loader.destroy()},d.abort=function(){this.loader.abort()},d.load=function(p,c,i){o(p),this.loader.load(p,c,i)},R(f,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),f}()},b.uuid=function(){var r=URL.createObjectURL(new Blob),o=r.toString();return URL.revokeObjectURL(r),o.substr(o.lastIndexOf("/")+1)},b.serialize=function(r){for(var o=[],s=function(k){return!Number.isNaN(k)&&k!=null&&k!==""&&k!==!1},f=function(k){return Math.round(k)},d=function(k){return f(k/100)*100},l=function(k){return encodeURIComponent(k)},p={br:f,d:f,bl:d,dl:d,mtp:d,nor:l,rtp:d,tb:f},c=Object.keys(r||{}).sort(),i=w(c),n;!(n=i()).done;){var t=n.value,e=r[t];if(!s(e))continue;if(t==="v"&&e===1)continue;if(t=="pr"&&e===1)continue;var m=p[t];m&&(e=m(e));var y=typeof e,_=void 0;t==="ot"||t==="sf"||t==="st"?_=t+"="+e:y==="boolean"?_=t:y==="number"?_=t+"="+e:_=t+"="+JSON.stringify(e),o.push(_)}return o.join(",")},b.toHeaders=function(r){for(var o=Object.keys(r),s={},f=["Object","Request","Session","Status"],d=[{},{},{},{}],l={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},p=0,c=o;p<c.length;p++){var i=c[p],n=l[i]!=null?l[i]:1;d[n][i]=r[i]}for(var t=0;t<d.length;t++){var e=b.serialize(d[t]);e&&(s["CMCD-"+f[t]]=e)}return s},b.toQuery=function(r){return"CMCD="+encodeURIComponent(b.serialize(r))},b.appendQueryToUri=function(r,o){if(!o)return r;var s=r.includes("?")?"&":"?";return""+r+s+o},b}()},"./src/controller/eme-controller.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/events.ts"),g=S("./src/errors.ts"),E=S("./src/utils/logger.ts"),U=S("./src/utils/mediakeys-helper.ts");function M(C,b){for(var v=0;v<b.length;v++){var h=b[v];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(C,h.key,h)}}function R(C,b,v){return b&&M(C.prototype,b),v&&M(C,v),C}var w=3,x=function(b,v,h){var r={audioCapabilities:[],videoCapabilities:[]};return b.forEach(function(o){r.audioCapabilities.push({contentType:'audio/mp4; codecs="'+o+'"',robustness:h.audioRobustness||""})}),v.forEach(function(o){r.videoCapabilities.push({contentType:'video/mp4; codecs="'+o+'"',robustness:h.videoRobustness||""})}),[r]},T=function(b,v,h,r){switch(b){case U.KeySystems.WIDEVINE:return x(v,h,r);default:throw new Error("Unknown key-system: "+b)}},O=function(){function C(v){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=v,this._config=v.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 b=C.prototype;return b.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},b._registerListeners=function(){this.hls.on(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(I.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(I.Events.MANIFEST_PARSED,this.onManifestParsed,this)},b._unregisterListeners=function(){this.hls.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(I.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(I.Events.MANIFEST_PARSED,this.onManifestParsed,this)},b.getLicenseServerUrl=function(h){switch(h){case U.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+h+'"')},b._attemptKeySystemAccess=function(h,r,o){var s=this,f=T(h,r,o,this._drmSystemOptions);E.logger.log("Requesting encrypted media key-system access");var d=this.requestMediaKeySystemAccess(h,f);this.mediaKeysPromise=d.then(function(l){return s._onMediaKeySystemAccessObtained(h,l)}),d.catch(function(l){E.logger.error('Failed to obtain key-system "'+h+'" access:',l)})},b._onMediaKeySystemAccessObtained=function(h,r){var o=this;E.logger.log('Access for key-system "'+h+'" obtained');var s={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:r,mediaKeySystemDomain:h};this._mediaKeysList.push(s);var f=Promise.resolve().then(function(){return r.createMediaKeys()}).then(function(d){return s.mediaKeys=d,E.logger.log('Media-keys created for key-system "'+h+'"'),o._onMediaKeysCreated(),d});return f.catch(function(d){E.logger.error("Failed to create media-keys:",d)}),f},b._onMediaKeysCreated=function(){var h=this;this._mediaKeysList.forEach(function(r){r.mediaKeysSession||(r.mediaKeysSession=r.mediaKeys.createSession(),h._onNewMediaKeySession(r.mediaKeysSession))})},b._onNewMediaKeySession=function(h){var r=this;E.logger.log("New key-system session "+h.sessionId),h.addEventListener("message",function(o){r._onKeySessionMessage(h,o.message)},!1)},b._onKeySessionMessage=function(h,r){E.logger.log("Got EME message event, creating license request"),this._requestLicense(r,function(o){E.logger.log("Received license data (length: "+(o&&o.byteLength)+"), updating key-session"),h.update(o)})},b.onMediaEncrypted=function(h){var r=this;if(E.logger.log('Media is encrypted using "'+h.initDataType+'" init data type'),!this.mediaKeysPromise){E.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(I.Events.ERROR,{type:g.ErrorTypes.KEY_SYSTEM_ERROR,details:g.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var o=function(f){if(!r._media)return;r._attemptSetMediaKeys(f),r._generateRequestWithPreferredKeySession(h.initDataType,h.initData)};this.mediaKeysPromise.then(o).catch(o)},b._attemptSetMediaKeys=function(h){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var r=this._mediaKeysList[0];if(!r||!r.mediaKeys){E.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(I.Events.ERROR,{type:g.ErrorTypes.KEY_SYSTEM_ERROR,details:g.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}E.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(r.mediaKeys),this._hasSetMediaKeys=!0}},b._generateRequestWithPreferredKeySession=function(h,r){var o=this,s=this._mediaKeysList[0];if(!s){E.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(I.Events.ERROR,{type:g.ErrorTypes.KEY_SYSTEM_ERROR,details:g.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(s.mediaKeysSessionInitialized){E.logger.warn("Key-Session already initialized but requested again");return}var f=s.mediaKeysSession;if(!f){E.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(I.Events.ERROR,{type:g.ErrorTypes.KEY_SYSTEM_ERROR,details:g.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!r){E.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(I.Events.ERROR,{type:g.ErrorTypes.KEY_SYSTEM_ERROR,details:g.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}E.logger.log('Generating key-session request for "'+h+'" init data type'),s.mediaKeysSessionInitialized=!0,f.generateRequest(h,r).then(function(){E.logger.debug("Key-session generation succeeded")}).catch(function(d){E.logger.error("Error generating key-session request:",d),o.hls.trigger(I.Events.ERROR,{type:g.ErrorTypes.KEY_SYSTEM_ERROR,details:g.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},b._createLicenseXhr=function(h,r,o){var s=new XMLHttpRequest;s.responseType="arraybuffer",s.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,s,h,r,o);var f=this._licenseXhrSetup;if(f)try{f.call(this.hls,s,h),f=void 0}catch(d){E.logger.error(d)}try{s.readyState||s.open("POST",h,!0),f&&f.call(this.hls,s,h)}catch(d){throw new Error("issue setting up KeySystem license XHR "+d)}return s},b._onLicenseRequestReadyStageChange=function(h,r,o,s){switch(h.readyState){case 4:if(h.status===200){this._requestLicenseFailureCount=0,E.logger.log("License request succeeded");var f=h.response,d=this._licenseResponseCallback;if(d)try{f=d.call(this.hls,h,r)}catch(p){E.logger.error(p)}s(f)}else{if(E.logger.error("License Request XHR failed ("+r+"). Status: "+h.status+" ("+h.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>w){this.hls.trigger(I.Events.ERROR,{type:g.ErrorTypes.KEY_SYSTEM_ERROR,details:g.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var l=w-this._requestLicenseFailureCount+1;E.logger.warn("Retrying license request, "+l+" attempts left"),this._requestLicense(o,s)}break}},b._generateLicenseRequestChallenge=function(h,r){switch(h.mediaKeySystemDomain){case U.KeySystems.WIDEVINE:return r}throw new Error("unsupported key-system: "+h.mediaKeySystemDomain)},b._requestLicense=function(h,r){E.logger.log("Requesting content license for key-system");var o=this._mediaKeysList[0];if(!o){E.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(I.Events.ERROR,{type:g.ErrorTypes.KEY_SYSTEM_ERROR,details:g.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var s=this.getLicenseServerUrl(o.mediaKeySystemDomain),f=this._createLicenseXhr(s,h,r);E.logger.log("Sending license request to URL: "+s);var d=this._generateLicenseRequestChallenge(o,h);f.send(d)}catch(l){E.logger.error("Failure requesting DRM license: "+l),this.hls.trigger(I.Events.ERROR,{type:g.ErrorTypes.KEY_SYSTEM_ERROR,details:g.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},b.onMediaAttached=function(h,r){if(!this._emeEnabled)return;var o=r.media;this._media=o,o.addEventListener("encrypted",this._onMediaEncrypted)},b.onMediaDetached=function(){var h=this._media,r=this._mediaKeysList;if(!h)return;h.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(r.map(function(o){if(o.mediaKeysSession)return o.mediaKeysSession.close().catch(function(){})})).then(function(){return h.setMediaKeys(null)}).catch(function(){})},b.onManifestParsed=function(h,r){if(!this._emeEnabled)return;var o=r.levels.map(function(f){return f.audioCodec}).filter(function(f){return!!f}),s=r.levels.map(function(f){return f.videoCodec}).filter(function(f){return!!f});this._attemptKeySystemAccess(U.KeySystems.WIDEVINE,o,s)},R(C,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),C}();N.default=O},"./src/controller/fps-controller.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/events.ts"),g=S("./src/utils/logger.ts"),E=function(){function U(R){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=R,this.registerListeners()}var M=U.prototype;return M.setStreamController=function(w){this.streamController=w},M.registerListeners=function(){this.hls.on(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},M.unregisterListeners=function(){this.hls.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching)},M.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},M.onMediaAttaching=function(w,x){var T=this.hls.config;if(T.capLevelOnFPSDrop){var O=x.media instanceof self.HTMLVideoElement?x.media:null;this.media=O,O&&typeof O.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),T.fpsDroppedMonitoringPeriod)}},M.checkFPS=function(w,x,T){var O=performance.now();if(x){if(this.lastTime){var C=O-this.lastTime,b=T-this.lastDroppedFrames,v=x-this.lastDecodedFrames,h=1e3*b/C,r=this.hls;if(r.trigger(I.Events.FPS_DROP,{currentDropped:b,currentDecoded:v,totalDroppedFrames:T}),h>0&&b>r.config.fpsDroppedMonitoringThreshold*v){var o=r.currentLevel;g.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+o),o>0&&(r.autoLevelCapping===-1||r.autoLevelCapping>=o)&&(o=o-1,r.trigger(I.Events.FPS_DROP_LEVEL_CAPPING,{level:o,droppedLevel:r.currentLevel}),r.autoLevelCapping=o,this.streamController.nextLevelSwitch())}}this.lastTime=O,this.lastDroppedFrames=T,this.lastDecodedFrames=x}},M.checkFPSInterval=function(){var w=this.media;if(w)if(this.isVideoPlaybackQualityAvailable){var x=w.getVideoPlaybackQuality();this.checkFPS(w,x.totalVideoFrames,x.droppedVideoFrames)}else this.checkFPS(w,w.webkitDecodedFrameCount,w.webkitDroppedFrameCount)},U}();N.default=E},"./src/controller/fragment-finders.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"findFragmentByPDT",function(){return E}),S.d(N,"findFragmentByPTS",function(){return U}),S.d(N,"fragmentWithinToleranceTest",function(){return M}),S.d(N,"pdtWithinToleranceTest",function(){return R}),S.d(N,"findFragWithCC",function(){return w});var I=S("./src/polyfills/number.ts"),g=S("./src/utils/binary-search.ts");function E(x,T,O){if(T===null||!Array.isArray(x)||!x.length||!Object(I.isFiniteNumber)(T))return null;var C=x[0].programDateTime;if(T<(C||0))return null;var b=x[x.length-1].endProgramDateTime;if(T>=(b||0))return null;O=O||0;for(var v=0;v<x.length;++v){var h=x[v];if(R(T,O,h))return h}return null}function U(x,T,O,C){O===void 0&&(O=0),C===void 0&&(C=0);var b=null;if(x?b=T[x.sn-T[0].sn+1]||null:O===0&&T[0].start===0&&(b=T[0]),b&&M(O,C,b)===0)return b;var v=g.default.search(T,M.bind(null,O,C));return v||b}function M(x,T,O){x===void 0&&(x=0),T===void 0&&(T=0);var C=Math.min(T,O.duration+(O.deltaPTS?O.deltaPTS:0));return O.start+O.duration-C<=x?1:O.start-C>x&&O.start?-1:0}function R(x,T,O){var C=Math.min(T,O.duration+(O.deltaPTS?O.deltaPTS:0))*1e3,b=O.endProgramDateTime||0;return b-C>x}function w(x,T){return g.default.search(x,function(O){return O.cc<T?1:O.cc>T?-1:0})}},"./src/controller/fragment-tracker.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"FragmentState",function(){return E}),S.d(N,"FragmentTracker",function(){return U});var I=S("./src/events.ts"),g=S("./src/types/loader.ts"),E;(function(w){w.NOT_LOADED="NOT_LOADED",w.BACKTRACKED="BACKTRACKED",w.APPENDING="APPENDING",w.PARTIAL="PARTIAL",w.OK="OK"})(E||(E={}));var U=function(){function w(T){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=T,this._registerListeners()}var x=w.prototype;return x._registerListeners=function(){var O=this.hls;O.on(I.Events.BUFFER_APPENDED,this.onBufferAppended,this),O.on(I.Events.FRAG_BUFFERED,this.onFragBuffered,this),O.on(I.Events.FRAG_LOADED,this.onFragLoaded,this)},x._unregisterListeners=function(){var O=this.hls;O.off(I.Events.BUFFER_APPENDED,this.onBufferAppended,this),O.off(I.Events.FRAG_BUFFERED,this.onFragBuffered,this),O.off(I.Events.FRAG_LOADED,this.onFragLoaded,this)},x.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},x.getAppendedFrag=function(O,C){if(C===g.PlaylistLevelType.MAIN){var b=this.activeFragment,v=this.activeParts;if(!b)return null;if(v)for(var h=v.length;h--;){var r=v[h],o=r?r.end:b.appendedPTS;if(r.start<=O&&o!==void 0&&O<=o)return h>9&&(this.activeParts=v.slice(h-9)),r}else if(b.start<=O&&b.appendedPTS!==void 0&&O<=b.appendedPTS)return b}return this.getBufferedFrag(O,C)},x.getBufferedFrag=function(O,C){for(var b=this.fragments,v=Object.keys(b),h=v.length;h--;){var r=b[v[h]];if((r==null?void 0:r.body.type)===C&&r.buffered){var o=r.body;if(o.start<=O&&O<=o.end)return o}}return null},x.detectEvictedFragments=function(O,C,b){var v=this;Object.keys(this.fragments).forEach(function(h){var r=v.fragments[h];if(!r)return;if(!r.buffered){r.body.type===b&&v.removeFragment(r.body);return}var o=r.range[O];if(!o)return;o.time.some(function(s){var f=!v.isTimeBuffered(s.startPTS,s.endPTS,C);return f&&v.removeFragment(r.body),f})})},x.detectPartialFragments=function(O){var C=this,b=this.timeRanges,v=O.frag,h=O.part;if(!b||v.sn==="initSegment")return;var r=R(v),o=this.fragments[r];if(!o)return;Object.keys(b).forEach(function(s){var f=v.elementaryStreams[s];if(!f)return;var d=b[s],l=h!==null||f.partial===!0;o.range[s]=C.getBufferedTimes(v,h,l,d)}),o.backtrack=o.loaded=null,Object.keys(o.range).length?o.buffered=!0:this.removeFragment(o.body)},x.fragBuffered=function(O){var C=R(O),b=this.fragments[C];b&&(b.backtrack=b.loaded=null,b.buffered=!0)},x.getBufferedTimes=function(O,C,b,v){for(var h={time:[],partial:b},r=C?C.start:O.start,o=C?C.end:O.end,s=O.minEndPTS||o,f=O.maxStartPTS||r,d=0;d<v.length;d++){var l=v.start(d)-this.bufferPadding,p=v.end(d)+this.bufferPadding;if(f>=l&&s<=p){h.time.push({startPTS:Math.max(r,v.start(d)),endPTS:Math.min(o,v.end(d))});break}else if(r<p&&o>l)h.partial=!0,h.time.push({startPTS:Math.max(r,v.start(d)),endPTS:Math.min(o,v.end(d))});else if(o<=l)break}return h},x.getPartialFragment=function(O){var C=null,b,v,h,r=0,o=this.bufferPadding,s=this.fragments;return Object.keys(s).forEach(function(f){var d=s[f];if(!d)return;M(d)&&(v=d.body.start-o,h=d.body.end+o,O>=v&&O<=h&&(b=Math.min(O-v,h-O),r<=b&&(C=d.body,r=b)))}),C},x.getState=function(O){var C=R(O),b=this.fragments[C];return b?b.buffered?M(b)?E.PARTIAL:E.OK:b.backtrack?E.BACKTRACKED:E.APPENDING:E.NOT_LOADED},x.backtrack=function(O,C){var b=R(O),v=this.fragments[b];if(!v||v.backtrack)return null;var h=v.backtrack=C||v.loaded;return v.loaded=null,h},x.getBacktrackData=function(O){var C=R(O),b=this.fragments[C];if(b){var v,h=b.backtrack;if(h!=null&&(v=h.payload)!==null&&v!==void 0&&v.byteLength)return h;this.removeFragment(O)}return null},x.isTimeBuffered=function(O,C,b){for(var v,h,r=0;r<b.length;r++){if(v=b.start(r)-this.bufferPadding,h=b.end(r)+this.bufferPadding,O>=v&&C<=h)return!0;if(C<=v)return!1}return!1},x.onFragLoaded=function(O,C){var b=C.frag,v=C.part;if(b.sn==="initSegment"||b.bitrateTest||v)return;var h=R(b);this.fragments[h]={body:b,loaded:C,backtrack:null,buffered:!1,range:Object.create(null)}},x.onBufferAppended=function(O,C){var b=this,v=C.frag,h=C.part,r=C.timeRanges;if(v.type===g.PlaylistLevelType.MAIN)if(this.activeFragment=v,h){var o=this.activeParts;o||(this.activeParts=o=[]),o.push(h)}else this.activeParts=null;this.timeRanges=r,Object.keys(r).forEach(function(s){var f=r[s];if(b.detectEvictedFragments(s,f),!h)for(var d=0;d<f.length;d++)v.appendedPTS=Math.max(f.end(d),v.appendedPTS||0)})},x.onFragBuffered=function(O,C){this.detectPartialFragments(C)},x.hasFragment=function(O){var C=R(O);return!!this.fragments[C]},x.removeFragmentsInRange=function(O,C,b){var v=this;Object.keys(this.fragments).forEach(function(h){var r=v.fragments[h];if(!r)return;if(r.buffered){var o=r.body;o.type===b&&o.start<C&&o.end>O&&v.removeFragment(o)}})},x.removeFragment=function(O){var C=R(O);O.stats.loaded=0,O.clearElementaryStreamInfo(),delete this.fragments[C]},x.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},w}();function M(w){var x,T;return w.buffered&&(((x=w.range.video)===null||x===void 0?void 0:x.partial)||((T=w.range.audio)===null||T===void 0?void 0:T.partial))}function R(w){return w.type+"_"+w.level+"_"+w.urlId+"_"+w.sn}},"./src/controller/gap-controller.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"STALL_MINIMUM_DURATION_MS",function(){return M}),S.d(N,"MAX_START_GAP_JUMP",function(){return R}),S.d(N,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return w}),S.d(N,"SKIP_BUFFER_RANGE_START",function(){return x}),S.d(N,"default",function(){return T});var I=S("./src/utils/buffer-helper.ts"),g=S("./src/errors.ts"),E=S("./src/events.ts"),U=S("./src/utils/logger.ts"),M=250,R=2,w=.1,x=.05,T=function(){function O(b,v,h,r){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=b,this.media=v,this.fragmentTracker=h,this.hls=r}var C=O.prototype;return C.destroy=function(){this.hls=this.fragmentTracker=this.media=null},C.poll=function(v){var h=this.config,r=this.media,o=this.stalled,s=r.currentTime,f=r.seeking,d=this.seeking&&!f,l=!this.seeking&&f;if(this.seeking=f,s!==v){if(this.moved=!0,o!==null){if(this.stallReported){var p=self.performance.now()-o;U.logger.warn("playback not stuck anymore @"+s+", after "+Math.round(p)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((l||d)&&(this.stalled=null),r.paused||r.ended||r.playbackRate===0||!I.BufferHelper.getBuffered(r).length)return;var c=I.BufferHelper.bufferInfo(r,s,0),i=c.len>0,n=c.nextStart||0;if(!i&&!n)return;if(f){var t=c.len>R,e=!n||n-s>R&&!this.fragmentTracker.getPartialFragment(s);if(t||e)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var m,y=Math.max(n,c.start||0)-s,_=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,A=_==null||((m=_.details)===null||m===void 0)?void 0:m.live,k=A?_.details.targetduration*2:R;if(y>0&&y<=k){this._trySkipBufferHole(null);return}}var F=self.performance.now();if(o===null){this.stalled=F;return}var z=F-o;!f&&z>=M&&this._reportStall(c.len);var Q=I.BufferHelper.bufferInfo(r,s,h.maxBufferHole);this._tryFixBufferStall(Q,z)},C._tryFixBufferStall=function(v,h){var r=this.config,o=this.fragmentTracker,s=this.media,f=s.currentTime,d=o.getPartialFragment(f);if(d){var l=this._trySkipBufferHole(d);if(l)return}v.len>r.maxBufferHole&&h>r.highBufferWatchdogPeriod*1e3&&(U.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},C._reportStall=function(v){var h=this.hls,r=this.media,o=this.stallReported;o||(this.stallReported=!0,U.logger.warn("Playback stalling at @"+r.currentTime+" due to low buffer (buffer="+v+")"),h.trigger(E.Events.ERROR,{type:g.ErrorTypes.MEDIA_ERROR,details:g.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:v}))},C._trySkipBufferHole=function(v){for(var h=this.config,r=this.hls,o=this.media,s=o.currentTime,f=0,d=I.BufferHelper.getBuffered(o),l=0;l<d.length;l++){var p=d.start(l);if(s+h.maxBufferHole>=f&&s<p){var c=Math.max(p+x,o.currentTime+w);return U.logger.warn("skipping hole, adjusting currentTime from "+s+" to "+c),this.moved=!0,this.stalled=null,o.currentTime=c,v&&r.trigger(E.Events.ERROR,{type:g.ErrorTypes.MEDIA_ERROR,details:g.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+s+" to "+c,frag:v}),c}f=d.end(l)}return 0},C._tryNudgeBuffer=function(){var v=this.config,h=this.hls,r=this.media,o=r.currentTime,s=(this.nudgeRetry||0)+1;if(this.nudgeRetry=s,s<v.nudgeMaxRetry){var f=o+s*v.nudgeOffset;U.logger.warn("Nudging 'currentTime' from "+o+" to "+f),r.currentTime=f,h.trigger(E.Events.ERROR,{type:g.ErrorTypes.MEDIA_ERROR,details:g.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else U.logger.error("Playhead still not moving while enough data buffered @"+o+" after "+v.nudgeMaxRetry+" nudges"),h.trigger(E.Events.ERROR,{type:g.ErrorTypes.MEDIA_ERROR,details:g.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},O}()},"./src/controller/id3-track-controller.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/events.ts"),g=S("./src/utils/texttrack-utils.ts"),E=S("./src/demux/id3.ts"),U=.25,M=function(){function R(x){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=x,this._registerListeners()}var w=R.prototype;return w.destroy=function(){this._unregisterListeners()},w._registerListeners=function(){var T=this.hls;T.on(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),T.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),T.on(I.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),T.on(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},w._unregisterListeners=function(){var T=this.hls;T.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),T.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),T.off(I.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),T.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},w.onMediaAttached=function(T,O){this.media=O.media},w.onMediaDetaching=function(){if(!this.id3Track)return;Object(g.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},w.getID3Track=function(T){if(!this.media)return;for(var O=0;O<T.length;O++){var C=T[O];if(C.kind==="metadata"&&C.label==="id3")return Object(g.sendAddTrackEvent)(C,this.media),C}return this.media.addTextTrack("metadata","id3")},w.onFragParsingMetadata=function(T,O){if(!this.media)return;var C=O.frag,b=O.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var v=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,h=0;h<b.length;h++){var r=E.getID3Frames(b[h].data);if(r){var o=b[h].pts,s=h<b.length-1?b[h+1].pts:C.end,f=s-o;f<=0&&(s=o+U);for(var d=0;d<r.length;d++){var l=r[d];if(!E.isTimeStampFrame(l)){var p=new v(o,s,"");p.value=l,this.id3Track.addCue(p)}}}}},w.onBufferFlushing=function(T,O){var C=O.startOffset,b=O.endOffset,v=O.type;if(!v||v==="audio"){var h=this.id3Track;h&&Object(g.removeCuesInRange)(h,C,b)}},R}();N.default=M},"./src/controller/latency-controller.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return R});var I=S("./src/errors.ts"),g=S("./src/events.ts"),E=S("./src/utils/logger.ts");function U(w,x){for(var T=0;T<x.length;T++){var O=x[T];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(w,O.key,O)}}function M(w,x,T){return x&&U(w.prototype,x),T&&U(w,T),w}var R=function(){function w(T){var O=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 O.timeupdate()},this.hls=T,this.config=T.config,this.registerListeners()}var x=w.prototype;return x.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},x.registerListeners=function(){this.hls.on(g.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(g.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(g.Events.ERROR,this.onError,this)},x.unregisterListeners=function(){this.hls.off(g.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(g.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(g.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(g.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(g.Events.ERROR,this.onError)},x.onMediaAttached=function(O,C){this.media=C.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},x.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},x.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},x.onLevelUpdated=function(O,C){var b=C.details;this.levelDetails=b,b.advanced&&this.timeupdate(),!b.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},x.onError=function(O,C){if(C.details!==I.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,E.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},x.timeupdate=function(){var O=this.media,C=this.levelDetails;if(!O||!C)return;this.currentTime=O.currentTime;var b=this.computeLatency();if(b===null)return;this._latency=b;var v=this.config,h=v.lowLatencyMode,r=v.maxLiveSyncPlaybackRate;if(!h||r===1)return;var o=this.targetLatency;if(o===null)return;var s=b-o,f=Math.min(this.maxLatency,o+C.targetduration),d=s<f;if(C.live&&d&&s>.05&&this.forwardBufferLength>1){var l=Math.min(2,Math.max(1,r)),p=Math.round(2/(1+Math.exp(-.75*s-this.edgeStalled))*20)/20;O.playbackRate=Math.min(l,Math.max(1,p))}else O.playbackRate!==1&&O.playbackRate!==0&&(O.playbackRate=1)},x.estimateLiveEdge=function(){var O=this.levelDetails;return O===null?null:O.edge+O.age},x.computeLatency=function(){var O=this.estimateLiveEdge();return O===null?null:O-this.currentTime},M(w,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var O=this.config,C=this.levelDetails;return O.liveMaxLatencyDuration!==void 0?O.liveMaxLatencyDuration:C?O.liveMaxLatencyDurationCount*C.targetduration:0}},{key:"targetLatency",get:function(){var O=this.levelDetails;if(O===null)return null;var C=O.holdBack,b=O.partHoldBack,v=O.targetduration,h=this.config,r=h.liveSyncDuration,o=h.liveSyncDurationCount,s=h.lowLatencyMode,f=this.hls.userConfig,d=s&&b||C;(f.liveSyncDuration||f.liveSyncDurationCount||d===0)&&(d=r!==void 0?r:o*v);var l=v,p=1;return d+Math.min(this.stallCount*p,l)}},{key:"liveSyncPosition",get:function(){var O=this.estimateLiveEdge(),C=this.targetLatency,b=this.levelDetails;if(O===null||C===null||b===null)return null;var v=b.edge,h=O-C-this.edgeStalled,r=v-b.totalduration,o=v-(this.config.lowLatencyMode&&b.partTarget||b.targetduration);return Math.min(Math.max(r,h),o)}},{key:"drift",get:function(){var O=this.levelDetails;return O===null?1:O.drift}},{key:"edgeStalled",get:function(){var O=this.levelDetails;if(O===null)return 0;var C=(this.config.lowLatencyMode&&O.partTarget||O.targetduration)*3;return Math.max(O.age-C,0)}},{key:"forwardBufferLength",get:function(){var O=this.media,C=this.levelDetails;if(!O||!C)return 0;var b=O.buffered.length;return b?O.buffered.end(b-1):C.edge-this.currentTime}}]),w}()},"./src/controller/level-controller.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return h});var I=S("./src/types/level.ts"),g=S("./src/events.ts"),E=S("./src/errors.ts"),U=S("./src/utils/codecs.ts"),M=S("./src/controller/level-helper.ts"),R=S("./src/controller/base-playlist-controller.ts"),w=S("./src/types/loader.ts");function x(){return x=Object.assign||function(r){for(var o=1;o<arguments.length;o++){var s=arguments[o];for(var f in s)Object.prototype.hasOwnProperty.call(s,f)&&(r[f]=s[f])}return r},x.apply(this,arguments)}function T(r,o){for(var s=0;s<o.length;s++){var f=o[s];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(r,f.key,f)}}function O(r,o,s){return o&&T(r.prototype,o),s&&T(r,s),r}function C(r,o){r.prototype=Object.create(o.prototype),r.prototype.constructor=r,b(r,o)}function b(r,o){return b=Object.setPrototypeOf||function(f,d){return f.__proto__=d,f},b(r,o)}var v=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),h=function(r){C(o,r);function o(f){var d;return d=r.call(this,f,"[level-controller]")||this,d._levels=[],d._firstLevel=-1,d._startLevel=void 0,d.currentLevelIndex=-1,d.manualLevelIndex=-1,d.onParsedComplete=void 0,d._registerListeners(),d}var s=o.prototype;return s._registerListeners=function(){var d=this.hls;d.on(g.Events.MANIFEST_LOADED,this.onManifestLoaded,this),d.on(g.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(g.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),d.on(g.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(g.Events.ERROR,this.onError,this)},s._unregisterListeners=function(){var d=this.hls;d.off(g.Events.MANIFEST_LOADED,this.onManifestLoaded,this),d.off(g.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(g.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),d.off(g.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(g.Events.ERROR,this.onError,this)},s.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,r.prototype.destroy.call(this)},s.startLoad=function(){var d=this._levels;d.forEach(function(l){l.loadError=0}),r.prototype.startLoad.call(this)},s.onManifestLoaded=function(d,l){var p=[],c=[],i=[],n,t={},e,m=!1,y=!1,_=!1;if(l.levels.forEach(function(z){var Q=z.attrs;m=m||!!(z.width&&z.height),y=y||!!z.videoCodec,_=_||!!z.audioCodec,v&&z.audioCodec&&z.audioCodec.indexOf("mp4a.40.34")!==-1&&(z.audioCodec=void 0);var Y=z.bitrate+"-"+z.attrs.RESOLUTION+"-"+z.attrs.CODECS;e=t[Y],e?e.url.push(z.url):(e=new I.Level(z),t[Y]=e,p.push(e)),Q&&(Q.AUDIO&&Object(M.addGroupId)(e,"audio",Q.AUDIO),Q.SUBTITLES&&Object(M.addGroupId)(e,"text",Q.SUBTITLES))}),(m||y)&&_&&(p=p.filter(function(z){var Q=z.videoCodec,Y=z.width,X=z.height;return!!Q||!!(Y&&X)})),p=p.filter(function(z){var Q=z.audioCodec,Y=z.videoCodec;return(!Q||Object(U.isCodecSupportedInMp4)(Q,"audio"))&&(!Y||Object(U.isCodecSupportedInMp4)(Y,"video"))}),l.audioTracks&&(c=l.audioTracks.filter(function(z){return!z.audioCodec||Object(U.isCodecSupportedInMp4)(z.audioCodec,"audio")}),Object(M.assignTrackIdsByGroup)(c)),l.subtitles&&(i=l.subtitles,Object(M.assignTrackIdsByGroup)(i)),p.length>0){n=p[0].bitrate,p.sort(function(z,Q){return z.bitrate-Q.bitrate}),this._levels=p;for(var A=0;A<p.length;A++)if(p[A].bitrate===n){this._firstLevel=A,this.log("manifest loaded, "+p.length+" level(s) found, first bitrate: "+n);break}var k=_&&!y,F={levels:p,audioTracks:c,subtitleTracks:i,firstLevel:this._firstLevel,stats:l.stats,audio:_,video:y,altAudio:!k&&c.some(function(z){return!!z.url})};this.hls.trigger(g.Events.MANIFEST_PARSED,F),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(g.Events.ERROR,{type:E.ErrorTypes.MEDIA_ERROR,details:E.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:l.url,reason:"no level with compatible codecs found in manifest"})},s.onError=function(d,l){if(r.prototype.onError.call(this,d,l),l.fatal)return;var p=l.context,c=this._levels[this.currentLevelIndex];if(p&&(p.type===w.PlaylistContextType.AUDIO_TRACK&&c.audioGroupIds&&p.groupId===c.audioGroupIds[c.urlId]||p.type===w.PlaylistContextType.SUBTITLE_TRACK&&c.textGroupIds&&p.groupId===c.textGroupIds[c.urlId])){this.redundantFailover(this.currentLevelIndex);return}var i=!1,n=!0,t;switch(l.details){case E.ErrorDetails.FRAG_LOAD_ERROR:case E.ErrorDetails.FRAG_LOAD_TIMEOUT:case E.ErrorDetails.KEY_LOAD_ERROR:case E.ErrorDetails.KEY_LOAD_TIMEOUT:if(l.frag){var e=this._levels[l.frag.level];e?(e.fragmentError++,e.fragmentError>this.hls.config.fragLoadingMaxRetry&&(t=l.frag.level)):t=l.frag.level}break;case E.ErrorDetails.LEVEL_LOAD_ERROR:case E.ErrorDetails.LEVEL_LOAD_TIMEOUT:p&&(p.deliveryDirectives&&(n=!1),t=p.level),i=!0;break;case E.ErrorDetails.REMUX_ALLOC_ERROR:t=l.level,i=!0;break}t!==void 0&&this.recoverLevel(l,t,i,n)},s.recoverLevel=function(d,l,p,c){var i=d.details,n=this._levels[l];if(n.loadError++,p){var t=this.retryLoadingOrFail(d);if(t)d.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(c){var e=n.url.length;if(e>1&&n.loadError<e)d.levelRetry=!0,this.redundantFailover(l);else if(this.manualLevelIndex===-1){var m=l===0?this._levels.length-1:l-1;this.currentLevelIndex!==m&&this._levels[m].loadError===0&&(this.warn(i+": switch to "+m),d.levelRetry=!0,this.hls.nextAutoLevel=m)}}},s.redundantFailover=function(d){var l=this._levels[d],p=l.url.length;if(p>1){var c=(l.urlId+1)%p;this.warn("Switching to redundant URL-id "+c),this._levels.forEach(function(i){i.urlId=c}),this.level=d}},s.onFragLoaded=function(d,l){var p=l.frag;if(p!==void 0&&p.type===w.PlaylistLevelType.MAIN){var c=this._levels[p.level];c!==void 0&&(c.fragmentError=0,c.loadError=0)}},s.onLevelLoaded=function(d,l){var p,c=l.level,i=l.details,n=this._levels[c];if(!n){var t;this.warn("Invalid level index "+c),(t=l.deliveryDirectives)!==null&&t!==void 0&&t.skip&&(i.deltaUpdateFailed=!0);return}c===this.currentLevelIndex?(n.fragmentError===0&&(n.loadError=0,this.retryCount=0),this.playlistLoaded(c,l,n.details)):(p=l.deliveryDirectives)!==null&&p!==void 0&&p.skip&&(i.deltaUpdateFailed=!0)},s.onAudioTrackSwitched=function(d,l){var p=this.hls.levels[this.currentLevelIndex];if(!p)return;if(p.audioGroupIds){for(var c=-1,i=this.hls.audioTracks[l.id].groupId,n=0;n<p.audioGroupIds.length;n++)if(p.audioGroupIds[n]===i){c=n;break}c!==p.urlId&&(p.urlId=c,this.startLoad())}},s.loadPlaylist=function(d){var l=this.currentLevelIndex,p=this._levels[l];if(this.canLoad&&p&&p.url.length>0){var c=p.urlId,i=p.url[c];if(d)try{i=d.addDirectives(i)}catch(n){this.warn("Could not construct new URL with HLS Delivery Directives: "+n)}this.log("Attempt loading level index "+l+(d?" at sn "+d.msn+" part "+d.part:"")+" with URL-id "+c+" "+i),this.clearTimer(),this.hls.trigger(g.Events.LEVEL_LOADING,{url:i,level:l,id:c,deliveryDirectives:d||null})}},s.removeLevel=function(d,l){var p=function(n,t){return t!==l},c=this._levels.filter(function(i,n){return n!==d?!0:i.url.length>1&&l!==void 0?(i.url=i.url.filter(p),i.audioGroupIds&&(i.audioGroupIds=i.audioGroupIds.filter(p)),i.textGroupIds&&(i.textGroupIds=i.textGroupIds.filter(p)),i.urlId=0,!0):!1}).map(function(i,n){var t=i.details;return t!=null&&t.fragments&&t.fragments.forEach(function(e){e.level=n}),i});this._levels=c,this.hls.trigger(g.Events.LEVELS_UPDATED,{levels:c})},O(o,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(d){var l,p=this._levels;if(p.length===0)return;if(this.currentLevelIndex===d&&(l=p[d])!==null&&l!==void 0&&l.details)return;if(d<0||d>=p.length){var c=d<0;if(this.hls.trigger(g.Events.ERROR,{type:E.ErrorTypes.OTHER_ERROR,details:E.ErrorDetails.LEVEL_SWITCH_ERROR,level:d,fatal:c,reason:"invalid level idx"}),c)return;d=Math.min(d,p.length-1)}this.clearTimer();var i=this.currentLevelIndex,n=p[i],t=p[d];this.log("switching to level "+d+" from "+i),this.currentLevelIndex=d;var e=x({},t,{level:d,maxBitrate:t.maxBitrate,uri:t.uri,urlId:t.urlId});delete e._urlId,this.hls.trigger(g.Events.LEVEL_SWITCHING,e);var m=t.details;if(!m||m.live){var y=this.switchParams(t.uri,n==null?void 0:n.details);this.loadPlaylist(y)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(d){this.manualLevelIndex=d,this._startLevel===void 0&&(this._startLevel=d),d!==-1&&(this.level=d)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(d){this._firstLevel=d}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var d=this.hls.config.startLevel;return d!==void 0?d:this._firstLevel}else return this._startLevel},set:function(d){this._startLevel=d}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(d){this.level=d,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=d)}}]),o}(R.default)},"./src/controller/level-helper.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"addGroupId",function(){return E}),S.d(N,"assignTrackIdsByGroup",function(){return U}),S.d(N,"updatePTS",function(){return M}),S.d(N,"updateFragPTSDTS",function(){return w}),S.d(N,"mergeDetails",function(){return x}),S.d(N,"mapPartIntersection",function(){return T}),S.d(N,"mapFragmentIntersection",function(){return O}),S.d(N,"adjustSliding",function(){return C}),S.d(N,"addSliding",function(){return b}),S.d(N,"computeReloadInterval",function(){return v}),S.d(N,"getFragmentWithSN",function(){return h}),S.d(N,"getPartWith",function(){return r});var I=S("./src/polyfills/number.ts"),g=S("./src/utils/logger.ts");function E(o,s,f){switch(s){case"audio":o.audioGroupIds||(o.audioGroupIds=[]),o.audioGroupIds.push(f);break;case"text":o.textGroupIds||(o.textGroupIds=[]),o.textGroupIds.push(f);break}}function U(o){var s={};o.forEach(function(f){var d=f.groupId||"";f.id=s[d]=s[d]||0,s[d]++})}function M(o,s,f){var d=o[s],l=o[f];R(d,l)}function R(o,s){var f=s.startPTS;if(Object(I.isFiniteNumber)(f)){var d=0,l;s.sn>o.sn?(d=f-o.start,l=o):(d=o.start-f,l=s),l.duration!==d&&(l.duration=d)}else if(s.sn>o.sn){var p=o.cc===s.cc;p&&o.minEndPTS?s.start=o.start+(o.minEndPTS-o.start):s.start=o.start+o.duration}else s.start=Math.max(o.start-s.duration,0)}function w(o,s,f,d,l,p){var c=d-f;c<=0&&(g.logger.warn("Fragment should have a positive duration",s),d=f+s.duration,p=l+s.duration);var i=f,n=d,t=s.startPTS,e=s.endPTS;if(Object(I.isFiniteNumber)(t)){var m=Math.abs(t-f);Object(I.isFiniteNumber)(s.deltaPTS)?s.deltaPTS=Math.max(m,s.deltaPTS):s.deltaPTS=m,i=Math.max(f,t),f=Math.min(f,t),l=Math.min(l,s.startDTS),n=Math.min(d,e),d=Math.max(d,e),p=Math.max(p,s.endDTS)}s.duration=d-f;var y=f-s.start;s.appendedPTS=d,s.start=s.startPTS=f,s.maxStartPTS=i,s.startDTS=l,s.endPTS=d,s.minEndPTS=n,s.endDTS=p;var _=s.sn;if(!o||_<o.startSN||_>o.endSN)return 0;var A,k=_-o.startSN,F=o.fragments;for(F[k]=s,A=k;A>0;A--)R(F[A],F[A-1]);for(A=k;A<F.length-1;A++)R(F[A],F[A+1]);return o.fragmentHint&&R(F[F.length-1],o.fragmentHint),o.PTSKnown=o.alignedSliding=!0,y}function x(o,s){for(var f=null,d=o.fragments,l=d.length-1;l>=0;l--){var p=d[l].initSegment;if(p){f=p;break}}o.fragmentHint&&delete o.fragmentHint.endPTS;var c=0,i;if(O(o,s,function(A,k){A.relurl&&(c=A.cc-k.cc),Object(I.isFiniteNumber)(A.startPTS)&&Object(I.isFiniteNumber)(A.endPTS)&&(k.start=k.startPTS=A.startPTS,k.startDTS=A.startDTS,k.appendedPTS=A.appendedPTS,k.maxStartPTS=A.maxStartPTS,k.endPTS=A.endPTS,k.endDTS=A.endDTS,k.minEndPTS=A.minEndPTS,k.duration=A.endPTS-A.startPTS,k.duration&&(i=k),s.PTSKnown=s.alignedSliding=!0),k.elementaryStreams=A.elementaryStreams,k.loader=A.loader,k.stats=A.stats,k.urlId=A.urlId,A.initSegment&&(k.initSegment=A.initSegment,f=A.initSegment)}),f){var n=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments;n.forEach(function(A){var k;(!A.initSegment||A.initSegment.relurl===((k=f)===null||k===void 0?void 0:k.relurl))&&(A.initSegment=f)})}if(s.skippedSegments&&(s.deltaUpdateFailed=s.fragments.some(function(A){return!A}),s.deltaUpdateFailed)){g.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var t=s.skippedSegments;t--;)s.fragments.shift();s.startSN=s.fragments[0].sn,s.startCC=s.fragments[0].cc}var e=s.fragments;if(c){g.logger.warn("discontinuity sliding from playlist, take drift into account");for(var m=0;m<e.length;m++)e[m].cc+=c}s.skippedSegments&&(s.startCC=s.fragments[0].cc),T(o.partList,s.partList,function(A,k){k.elementaryStreams=A.elementaryStreams,k.stats=A.stats}),i?w(s,i,i.startPTS,i.endPTS,i.startDTS,i.endDTS):C(o,s),e.length&&(s.totalduration=s.edge-e[0].start),s.driftStartTime=o.driftStartTime,s.driftStart=o.driftStart;var y=s.advancedDateTime;if(s.advanced&&y){var _=s.edge;s.driftStart||(s.driftStartTime=y,s.driftStart=_),s.driftEndTime=y,s.driftEnd=_}else s.driftEndTime=o.driftEndTime,s.driftEnd=o.driftEnd,s.advancedDateTime=o.advancedDateTime}function T(o,s,f){if(o&&s)for(var d=0,l=0,p=o.length;l<=p;l++){var c=o[l],i=s[l+d];c&&i&&c.index===i.index&&c.fragment.sn===i.fragment.sn?f(c,i):d--}}function O(o,s,f){for(var d=s.skippedSegments,l=Math.max(o.startSN,s.startSN)-s.startSN,p=(o.fragmentHint?1:0)+(d?s.endSN:Math.min(o.endSN,s.endSN))-s.startSN,c=s.startSN-o.startSN,i=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,n=o.fragmentHint?o.fragments.concat(o.fragmentHint):o.fragments,t=l;t<=p;t++){var e=n[c+t],m=i[t];d&&!m&&t<d&&(m=s.fragments[t]=e),e&&m&&f(e,m)}}function C(o,s){var f=s.startSN+s.skippedSegments-o.startSN,d=o.fragments;if(f<0||f>=d.length)return;b(s,d[f].start)}function b(o,s){if(s){for(var f=o.fragments,d=o.skippedSegments;d<f.length;d++)f[d].start+=s;o.fragmentHint&&(o.fragmentHint.start+=s)}}function v(o,s){var f=1e3*o.levelTargetDuration,d=f/2,l=o.age,p=l>0&&l<f*3,c=s.loading.end-s.loading.start,i,n=o.availabilityDelay;if(o.updated===!1)if(p){var t=333*o.misses;i=Math.max(Math.min(d,c*2),t),o.availabilityDelay=(o.availabilityDelay||0)+i}else i=d;else p?(n=Math.min(n||f/2,l),o.availabilityDelay=n,i=n+f-l):i=f-c;return Math.round(i)}function h(o,s,f){if(!o||!o.details)return null;var d=o.details,l=d.fragments[s-d.startSN];return l||(l=d.fragmentHint,l&&l.sn===s?l:s<d.startSN&&f&&f.sn===s?f:null)}function r(o,s,f){if(!o||!o.details)return null;var d=o.details.partList;if(d)for(var l=d.length;l--;){var p=d[l];if(p.index===f&&p.fragment.sn===s)return p}return null}},"./src/controller/stream-controller.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return d});var I=S("./src/polyfills/number.ts"),g=S("./src/controller/base-stream-controller.ts"),E=S("./src/is-supported.ts"),U=S("./src/events.ts"),M=S("./src/utils/buffer-helper.ts"),R=S("./src/controller/fragment-tracker.ts"),w=S("./src/types/loader.ts"),x=S("./src/loader/fragment.ts"),T=S("./src/demux/transmuxer-interface.ts"),O=S("./src/types/transmuxer.ts"),C=S("./src/controller/gap-controller.ts"),b=S("./src/errors.ts"),v=S("./src/utils/logger.ts");function h(l,p){for(var c=0;c<p.length;c++){var i=p[c];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(l,i.key,i)}}function r(l,p,c){return p&&h(l.prototype,p),c&&h(l,c),l}function o(l,p){l.prototype=Object.create(p.prototype),l.prototype.constructor=l,s(l,p)}function s(l,p){return s=Object.setPrototypeOf||function(i,n){return i.__proto__=n,i},s(l,p)}var f=100,d=function(l){o(p,l);function p(i,n){var t;return t=l.call(this,i,n,"[stream-controller]")||this,t.audioCodecSwap=!1,t.gapController=null,t.level=-1,t._forceStartLoad=!1,t.altAudio=!1,t.audioOnly=!1,t.fragPlaying=null,t.onvplaying=null,t.onvseeked=null,t.fragLastKbps=0,t.stalled=!1,t.couldBacktrack=!1,t.audioCodecSwitch=!1,t.videoBuffer=null,t._registerListeners(),t}var c=p.prototype;return c._registerListeners=function(){var n=this.hls;n.on(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.on(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.on(U.Events.LEVEL_LOADING,this.onLevelLoading,this),n.on(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),n.on(U.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),n.on(U.Events.ERROR,this.onError,this),n.on(U.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),n.on(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),n.on(U.Events.BUFFER_CREATED,this.onBufferCreated,this),n.on(U.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),n.on(U.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),n.on(U.Events.FRAG_BUFFERED,this.onFragBuffered,this)},c._unregisterListeners=function(){var n=this.hls;n.off(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.off(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.off(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),n.off(U.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),n.off(U.Events.ERROR,this.onError,this),n.off(U.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),n.off(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),n.off(U.Events.BUFFER_CREATED,this.onBufferCreated,this),n.off(U.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),n.off(U.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),n.off(U.Events.FRAG_BUFFERED,this.onFragBuffered,this)},c.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},c.startLoad=function(n){if(this.levels){var t=this.lastCurrentTime,e=this.hls;if(this.stopLoad(),this.setInterval(f),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var m=e.startLevel;m===-1&&(e.config.testBandwidth?(m=0,this.bitrateTest=!0):m=e.nextAutoLevel),this.level=e.nextLoadLevel=m,this.loadedmetadata=!1}t>0&&n===-1&&(this.log("Override startPosition with lastCurrentTime @"+t.toFixed(3)),n=t),this.state=g.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=n,this.tick()}else this._forceStartLoad=!0,this.state=g.State.STOPPED},c.stopLoad=function(){this._forceStartLoad=!1,l.prototype.stopLoad.call(this)},c.doTick=function(){switch(this.state){case g.State.IDLE:this.doTickIdle();break;case g.State.WAITING_LEVEL:{var n,t=this.levels,e=this.level,m=t==null||((n=t[e])===null||n===void 0)?void 0:n.details;if(m&&(!m.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(m))break;this.state=g.State.IDLE;break}break}case g.State.FRAG_LOADING_WAITING_RETRY:{var y,_=self.performance.now(),A=this.retryDate;(!A||_>=A||(y=this.media)!==null&&y!==void 0&&y.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=g.State.IDLE)}break;default:break}this.onTickEnd()},c.onTickEnd=function(){l.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},c.doTickIdle=function(){var n,t,e=this.hls,m=this.levelLastLoaded,y=this.levels,_=this.media,A=e.config,k=e.nextLoadLevel;if(m===null||!_&&(this.startFragRequested||!A.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!y||!y[k])return;var F=y[k];this.level=e.nextLoadLevel=k;var z=F.details;if(!z||this.state===g.State.WAITING_LEVEL||z.live&&this.levelLastLoaded!==k){this.state=g.State.WAITING_LEVEL;return}var Q=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:_,w.PlaylistLevelType.MAIN);if(Q===null)return;var Y=Q.len,X=this.getMaxBufferLength(F.maxBitrate);if(Y>=X)return;if(this._streamEnded(Q,z)){var le={};this.altAudio&&(le.type="video"),this.hls.trigger(U.Events.BUFFER_EOS,le),this.state=g.State.ENDED;return}var ye=Q.end,ve=this.getNextFragment(ye,z);if(this.couldBacktrack&&!this.fragPrevious&&ve&&ve.sn!=="initSegment"){var Ne=ve.sn-z.startSN;Ne>1&&(ve=z.fragments[Ne-1],this.fragmentTracker.removeFragment(ve))}if(ve&&this.fragmentTracker.getState(ve)===R.FragmentState.OK&&this.nextLoadPosition>ye){var Te=this.audioOnly&&!this.altAudio?x.ElementaryStreamTypes.AUDIO:x.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(_,Te,w.PlaylistLevelType.MAIN),ve=this.getNextFragment(this.nextLoadPosition,z)}if(!ve)return;ve.initSegment&&!ve.initSegment.data&&!this.bitrateTest&&(ve=ve.initSegment),((n=ve.decryptdata)===null||n===void 0?void 0:n.keyFormat)==="identity"&&!((t=ve.decryptdata)!==null&&t!==void 0&&t.key)?this.loadKey(ve,z):this.loadFragment(ve,z,ye)},c.loadFragment=function(n,t,e){var m,y=this.fragmentTracker.getState(n);if(this.fragCurrent=n,y===R.FragmentState.BACKTRACKED){var _=this.fragmentTracker.getBacktrackData(n);if(_){this._handleFragmentLoadProgress(_),this._handleFragmentLoadComplete(_);return}else y=R.FragmentState.NOT_LOADED}y===R.FragmentState.NOT_LOADED||y===R.FragmentState.PARTIAL?n.sn==="initSegment"?this._loadInitSegment(n):this.bitrateTest?(n.bitrateTest=!0,this.log("Fragment "+n.sn+" of level "+n.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(n)):(this.startFragRequested=!0,l.prototype.loadFragment.call(this,n,t,e)):y===R.FragmentState.APPENDING?this.reduceMaxBufferLength(n.duration)&&this.fragmentTracker.removeFragment(n):((m=this.media)===null||m===void 0?void 0:m.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},c.getAppendedFrag=function(n){var t=this.fragmentTracker.getAppendedFrag(n,w.PlaylistLevelType.MAIN);return t&&"fragment"in t?t.fragment:t},c.getBufferedFrag=function(n){return this.fragmentTracker.getBufferedFrag(n,w.PlaylistLevelType.MAIN)},c.followingBufferedFrag=function(n){return n?this.getBufferedFrag(n.end+.5):null},c.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},c.nextLevelSwitch=function(){var n=this.levels,t=this.media;if(t!=null&&t.readyState){var e,m=this.getAppendedFrag(t.currentTime);if(m&&m.start>1&&this.flushMainBuffer(0,m.start-1),!t.paused&&n){var y=this.hls.nextLoadLevel,_=n[y],A=this.fragLastKbps;A&&this.fragCurrent?e=this.fragCurrent.duration*_.maxBitrate/(1e3*A)+1:e=0}else e=0;var k=this.getBufferedFrag(t.currentTime+e);if(k){var F=this.followingBufferedFrag(k);if(F){this.abortCurrentFrag();var z=F.maxStartPTS?F.maxStartPTS:F.start,Q=F.duration,Y=Math.max(k.end,z+Math.min(Math.max(Q-this.config.maxFragLookUpTolerance,Q*.5),Q*.75));this.flushMainBuffer(Y,Number.POSITIVE_INFINITY)}}}},c.abortCurrentFrag=function(){var n=this.fragCurrent;this.fragCurrent=null,n!=null&&n.loader&&n.loader.abort(),this.state===g.State.KEY_LOADING&&(this.state=g.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},c.flushMainBuffer=function(n,t){l.prototype.flushMainBuffer.call(this,n,t,this.altAudio?"video":null)},c.onMediaAttached=function(n,t){l.prototype.onMediaAttached.call(this,n,t);var e=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),e.addEventListener("playing",this.onvplaying),e.addEventListener("seeked",this.onvseeked),this.gapController=new C.default(this.config,e,this.fragmentTracker,this.hls)},c.onMediaDetaching=function(){var n=this.media;n&&(n.removeEventListener("playing",this.onvplaying),n.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),l.prototype.onMediaDetaching.call(this)},c.onMediaPlaying=function(){this.tick()},c.onMediaSeeked=function(){var n=this.media,t=n?n.currentTime:null;Object(I.isFiniteNumber)(t)&&this.log("Media seeked to "+t.toFixed(3)),this.tick()},c.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(U.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},c.onManifestParsed=function(n,t){var e=!1,m=!1,y;t.levels.forEach(function(_){y=_.audioCodec,y&&(y.indexOf("mp4a.40.2")!==-1&&(e=!0),y.indexOf("mp4a.40.5")!==-1&&(m=!0))}),this.audioCodecSwitch=e&&m&&!Object(E.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1},c.onLevelLoading=function(n,t){var e=this.levels;if(!e||this.state!==g.State.IDLE)return;var m=e[t.level];(!m.details||m.details.live&&this.levelLastLoaded!==t.level||this.waitForCdnTuneIn(m.details))&&(this.state=g.State.WAITING_LEVEL)},c.onLevelLoaded=function(n,t){var e,m=this.levels,y=t.level,_=t.details,A=_.totalduration;if(!m){this.warn("Levels were reset while loading level "+y);return}this.log("Level "+y+" loaded ["+_.startSN+","+_.endSN+"], cc ["+_.startCC+", "+_.endCC+"] duration:"+A);var k=this.fragCurrent;k&&(this.state===g.State.FRAG_LOADING||this.state===g.State.FRAG_LOADING_WAITING_RETRY)&&(k.level!==t.level&&k.loader&&(this.state=g.State.IDLE,k.loader.abort()));var F=m[y],z=0;if(_.live||(e=F.details)!==null&&e!==void 0&&e.live){if(_.fragments[0]||(_.deltaUpdateFailed=!0),_.deltaUpdateFailed)return;z=this.alignPlaylists(_,F.details)}if(F.details=_,this.levelLastLoaded=y,this.hls.trigger(U.Events.LEVEL_UPDATED,{details:_,level:y}),this.state===g.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(_))return;this.state=g.State.IDLE}this.startFragRequested?_.live&&this.synchronizeToLiveEdge(_):this.setStartPosition(_,z),this.tick()},c._handleFragmentLoadProgress=function(n){var t,e=n.frag,m=n.part,y=n.payload,_=this.levels;if(!_){this.warn("Levels were reset while fragment load was in progress. Fragment "+e.sn+" of level "+e.level+" will not be buffered");return}var A=_[e.level],k=A.details;if(!k){this.warn("Dropping fragment "+e.sn+" of level "+e.level+" after level details were reset");return}var F=A.videoCodec,z=k.PTSKnown||!k.live,Q=(t=e.initSegment)===null||t===void 0?void 0:t.data,Y=this._getAudioCodec(A),X=this.transmuxer=this.transmuxer||new T.default(this.hls,w.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),le=m?m.index:-1,ye=le!==-1,ve=new O.ChunkMetadata(e.level,e.sn,e.stats.chunkCount,y.byteLength,le,ye),Ne=this.initPTS[e.cc];X.push(y,Q,Y,F,e,m,k.totalduration,z,ve,Ne)},c.onAudioTrackSwitching=function(n,t){var e=this.altAudio,m=!!t.url,y=t.id;if(!m){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var _=this.fragCurrent;_!=null&&_.loader&&(this.log("Switching to main audio track, cancel main fragment load"),_.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var A=this.hls;e&&A.trigger(U.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),A.trigger(U.Events.AUDIO_TRACK_SWITCHED,{id:y})}},c.onAudioTrackSwitched=function(n,t){var e=t.id,m=!!this.hls.audioTracks[e].url;if(m){var y=this.videoBuffer;y&&this.mediaBuffer!==y&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=y)}this.altAudio=m,this.tick()},c.onBufferCreated=function(n,t){var e=t.tracks,m,y,_=!1;for(var A in e){var k=e[A];if(k.id==="main"){if(y=A,m=k,A==="video"){var F=e[A];F&&(this.videoBuffer=F.buffer)}}else _=!0}_&&m?(this.log("Alternate track found, use "+y+".buffered to schedule main fragment loading"),this.mediaBuffer=m.buffer):this.mediaBuffer=this.media},c.onFragBuffered=function(n,t){var e=t.frag,m=t.part;if(e&&e.type!==w.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(e)){this.warn("Fragment "+e.sn+(m?" p: "+m.index:"")+" of level "+e.level+" finished buffering, but was aborted. state: "+this.state),this.state===g.State.PARSED&&(this.state=g.State.IDLE);return}var y=m?m.stats:e.stats;this.fragLastKbps=Math.round(8*y.total/(y.buffering.end-y.loading.first)),e.sn!=="initSegment"&&(this.fragPrevious=e),this.fragBufferedComplete(e,m)},c.onError=function(n,t){switch(t.details){case b.ErrorDetails.FRAG_LOAD_ERROR:case b.ErrorDetails.FRAG_LOAD_TIMEOUT:case b.ErrorDetails.KEY_LOAD_ERROR:case b.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(w.PlaylistLevelType.MAIN,t);break;case b.ErrorDetails.LEVEL_LOAD_ERROR:case b.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==g.State.ERROR&&(t.fatal?(this.warn(""+t.details),this.state=g.State.ERROR):!t.levelRetry&&this.state===g.State.WAITING_LEVEL&&(this.state=g.State.IDLE));break;case b.ErrorDetails.BUFFER_FULL_ERROR:if(t.parent==="main"&&(this.state===g.State.PARSING||this.state===g.State.PARSED)){var e=!0,m=this.getFwdBufferInfo(this.media,w.PlaylistLevelType.MAIN);m&&m.len>.5&&(e=!this.reduceMaxBufferLength(m.len)),e&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},c.checkBuffer=function(){var n=this.media,t=this.gapController;if(!n||!t||!n.readyState)return;var e=M.BufferHelper.getBuffered(n);!this.loadedmetadata&&e.length?(this.loadedmetadata=!0,this.seekToStartPos()):t.poll(this.lastCurrentTime),this.lastCurrentTime=n.currentTime},c.onFragLoadEmergencyAborted=function(){this.state=g.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},c.onBufferFlushed=function(n,t){var e=t.type;if(e!==x.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var m=(e===x.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(m,e,w.PlaylistLevelType.MAIN)}},c.onLevelsUpdated=function(n,t){this.levels=t.levels},c.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},c.seekToStartPos=function(){var n=this.media,t=n.currentTime,e=this.startPosition;if(e>=0&&t<e){if(n.seeking){v.logger.log("could not seek to "+e+", already seeking at "+t);return}var m=M.BufferHelper.getBuffered(n),y=m.length?m.start(0):0,_=y-e;_>0&&(_<this.config.maxBufferHole||_<this.config.maxFragLookUpTolerance)&&(v.logger.log("adjusting start position by "+_+" to match buffer start"),e+=_,this.startPosition=e),this.log("seek to target start position "+e+" from current time "+t),n.currentTime=e}},c._getAudioCodec=function(n){var t=this.config.defaultAudioCodec||n.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t},c._loadBitrateTestFrag=function(n){var t=this;this._doFragLoad(n).then(function(e){var m=t.hls;if(!e||m.nextLoadLevel||t.fragContextChanged(n))return;t.fragLoadError=0,t.state=g.State.IDLE,t.startFragRequested=!1,t.bitrateTest=!1;var y=n.stats;y.parsing.start=y.parsing.end=y.buffering.start=y.buffering.end=self.performance.now(),m.trigger(U.Events.FRAG_LOADED,e)})},c._handleTransmuxComplete=function(n){var t,e="main",m=this.hls,y=n.remuxResult,_=n.chunkMeta,A=this.getCurrentContext(_);if(!A){this.warn("The loading context changed while buffering fragment "+_.sn+" of level "+_.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(_.level);return}var k=A.frag,F=A.part,z=A.level,Q=y.video,Y=y.text,X=y.id3,le=y.initSegment,ye=this.altAudio?void 0:y.audio;if(this.fragContextChanged(k))return;if(this.state=g.State.PARSING,le){le.tracks&&(this._bufferInitSegment(z,le.tracks,k,_),m.trigger(U.Events.FRAG_PARSING_INIT_SEGMENT,{frag:k,id:e,tracks:le.tracks}));var ve=le.initPTS,Ne=le.timescale;Object(I.isFiniteNumber)(ve)&&(this.initPTS[k.cc]=ve,m.trigger(U.Events.INIT_PTS_FOUND,{frag:k,id:e,initPTS:ve,timescale:Ne}))}if(Q&&y.independent!==!1){if(z.details){var Te=Q.startPTS,Ce=Q.endPTS,_e=Q.startDTS,Re=Q.endDTS;if(F)F.elementaryStreams[Q.type]={startPTS:Te,endPTS:Ce,startDTS:_e,endDTS:Re};else if(Q.firstKeyFrame&&Q.independent&&(this.couldBacktrack=!0),Q.dropped&&Q.independent){var he=this.getLoadPosition()+this.config.maxBufferHole;if(he<Te){this.backtrack(k);return}k.setElementaryStreamInfo(Q.type,k.start,Ce,k.start,Re,!0)}k.setElementaryStreamInfo(Q.type,Te,Ce,_e,Re),this.bufferFragmentData(Q,k,F,_)}}else if(y.independent===!1){this.backtrack(k);return}if(ye){var Z=ye.startPTS,je=ye.endPTS,lt=ye.startDTS,nt=ye.endDTS;F&&(F.elementaryStreams[x.ElementaryStreamTypes.AUDIO]={startPTS:Z,endPTS:je,startDTS:lt,endDTS:nt}),k.setElementaryStreamInfo(x.ElementaryStreamTypes.AUDIO,Z,je,lt,nt),this.bufferFragmentData(ye,k,F,_)}if(X!=null&&(t=X.samples)!==null&&t!==void 0&&t.length){var Ke={frag:k,id:e,samples:X.samples};m.trigger(U.Events.FRAG_PARSING_METADATA,Ke)}if(Y){var Ge={frag:k,id:e,samples:Y.samples};m.trigger(U.Events.FRAG_PARSING_USERDATA,Ge)}},c._bufferInitSegment=function(n,t,e,m){var y=this;if(this.state!==g.State.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;var _=t.audio,A=t.video,k=t.audiovideo;if(_){var F=n.audioCodec,z=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(F&&(F.indexOf("mp4a.40.5")!==-1?F="mp4a.40.2":F="mp4a.40.5"),_.metadata.channelCount!==1&&z.indexOf("firefox")===-1&&(F="mp4a.40.5")),z.indexOf("android")!==-1&&_.container!=="audio/mpeg"&&(F="mp4a.40.2",this.log("Android: force audio codec to "+F)),n.audioCodec&&n.audioCodec!==F&&this.log('Swapping manifest audio codec "'+n.audioCodec+'" for "'+F+'"'),_.levelCodec=F,_.id="main",this.log("Init audio buffer, container:"+_.container+", codecs[selected/level/parsed]=["+(F||"")+"/"+(n.audioCodec||"")+"/"+_.codec+"]")}A&&(A.levelCodec=n.videoCodec,A.id="main",this.log("Init video buffer, container:"+A.container+", codecs[level/parsed]=["+(n.videoCodec||"")+"/"+A.codec+"]")),k&&this.log("Init audiovideo buffer, container:"+k.container+", codecs[level/parsed]=["+(n.attrs.CODECS||"")+"/"+k.codec+"]"),this.hls.trigger(U.Events.BUFFER_CODECS,t),Object.keys(t).forEach(function(Q){var Y=t[Q],X=Y.initSegment;X!=null&&X.byteLength&&y.hls.trigger(U.Events.BUFFER_APPENDING,{type:Q,data:X,frag:e,part:null,chunkMeta:m,parent:e.type})}),this.tick()},c.backtrack=function(n){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(n);var t=this.fragmentTracker.backtrack(n);this.fragPrevious=null,this.nextLoadPosition=n.start,t?this.resetFragmentLoading(n):this.state=g.State.BACKTRACKING},c.checkFragmentChanged=function(){var n=this.media,t=null;if(n&&n.readyState>1&&n.seeking===!1){var e=n.currentTime;if(M.BufferHelper.isBuffered(n,e)?t=this.getAppendedFrag(e):M.BufferHelper.isBuffered(n,e+.1)&&(t=this.getAppendedFrag(e+.1)),t){var m=this.fragPlaying,y=t.level;(!m||t.sn!==m.sn||m.level!==y||t.urlId!==m.urlId)&&(this.hls.trigger(U.Events.FRAG_CHANGED,{frag:t}),(!m||m.level!==y)&&this.hls.trigger(U.Events.LEVEL_SWITCHED,{level:y}),this.fragPlaying=t)}}},r(p,[{key:"nextLevel",get:function(){var n=this.nextBufferedFrag;return n?n.level:-1}},{key:"currentLevel",get:function(){var n=this.media;if(n){var t=this.getAppendedFrag(n.currentTime);if(t)return t.level}return-1}},{key:"nextBufferedFrag",get:function(){var n=this.media;if(n){var t=this.getAppendedFrag(n.currentTime);return this.followingBufferedFrag(t)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),p}(g.default)},"./src/controller/subtitle-stream-controller.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"SubtitleStreamController",function(){return o});var I=S("./src/events.ts"),g=S("./src/utils/logger.ts"),E=S("./src/utils/buffer-helper.ts"),U=S("./src/controller/fragment-finders.ts"),M=S("./src/utils/discontinuities.ts"),R=S("./src/controller/level-helper.ts"),w=S("./src/controller/fragment-tracker.ts"),x=S("./src/controller/base-stream-controller.ts"),T=S("./src/types/loader.ts"),O=S("./src/types/level.ts");function C(s,f){for(var d=0;d<f.length;d++){var l=f[d];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(s,l.key,l)}}function b(s,f,d){return f&&C(s.prototype,f),d&&C(s,d),s}function v(s,f){s.prototype=Object.create(f.prototype),s.prototype.constructor=s,h(s,f)}function h(s,f){return h=Object.setPrototypeOf||function(l,p){return l.__proto__=p,l},h(s,f)}var r=500,o=function(s){v(f,s);function f(l,p){var c;return c=s.call(this,l,p,"[subtitle-stream-controller]")||this,c.levels=[],c.currentTrackId=-1,c.tracksBuffered=[],c.mainDetails=null,c._registerListeners(),c}var d=f.prototype;return d.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},d._registerListeners=function(){var p=this.hls;p.on(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),p.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.on(I.Events.ERROR,this.onError,this),p.on(I.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),p.on(I.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),p.on(I.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),p.on(I.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),p.on(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},d._unregisterListeners=function(){var p=this.hls;p.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),p.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.off(I.Events.ERROR,this.onError,this),p.off(I.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),p.off(I.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),p.off(I.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),p.off(I.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),p.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},d.startLoad=function(){this.stopLoad(),this.state=x.State.IDLE,this.setInterval(r),this.tick()},d.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},d.onLevelLoaded=function(p,c){this.mainDetails=c.details},d.onSubtitleFragProcessed=function(p,c){var i=c.frag,n=c.success;if(this.fragPrevious=i,this.state=x.State.IDLE,!n)return;var t=this.tracksBuffered[this.currentTrackId];if(!t)return;for(var e,m=i.start,y=0;y<t.length;y++)if(m>=t[y].start&&m<=t[y].end){e=t[y];break}var _=i.start+i.duration;e?e.end=_:(e={start:m,end:_},t.push(e)),this.fragmentTracker.fragBuffered(i)},d.onBufferFlushing=function(p,c){var i=c.startOffset,n=c.endOffset;if(i===0&&n!==Number.POSITIVE_INFINITY){var t=this.currentTrackId,e=this.levels;if(!e.length||!e[t]||!e[t].details)return;var m=e[t].details,y=m.targetduration,_=n-y;if(_<=0)return;c.endOffsetSubtitles=Math.max(0,_),this.tracksBuffered.forEach(function(A){for(var k=0;k<A.length;){if(A[k].end<=_){A.shift();continue}else if(A[k].start<_)A[k].start=_;else break;k++}}),this.fragmentTracker.removeFragmentsInRange(i,_,T.PlaylistLevelType.SUBTITLE)}},d.onError=function(p,c){var i,n=c.frag;if(!n||n.type!==T.PlaylistLevelType.SUBTITLE)return;(i=this.fragCurrent)!==null&&i!==void 0&&i.loader&&this.fragCurrent.loader.abort(),this.state=x.State.IDLE},d.onSubtitleTracksUpdated=function(p,c){var i=this,n=c.subtitleTracks;this.tracksBuffered=[],this.levels=n.map(function(t){return new O.Level(t)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(t){i.tracksBuffered[t.id]=[]}),this.mediaBuffer=null},d.onSubtitleTrackSwitch=function(p,c){if(this.currentTrackId=c.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var i=this.levels[this.currentTrackId];i!=null&&i.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,i&&this.setInterval(r)},d.onSubtitleTrackLoaded=function(p,c){var i,n=c.details,t=c.id,e=this.currentTrackId,m=this.levels;if(!m.length)return;var y=m[e];if(t>=m.length||t!==e||!y)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,n.live||(i=y.details)!==null&&i!==void 0&&i.live){var _=this.mainDetails;if(n.deltaUpdateFailed||!_)return;var A=_.fragments[0];if(!y.details)n.hasProgramDateTime&&_.hasProgramDateTime?Object(M.alignMediaPlaylistByPDT)(n,_):A&&Object(R.addSliding)(n,A.start);else{var k=this.alignPlaylists(n,y.details);k===0&&A&&Object(R.addSliding)(n,A.start)}}if(y.details=n,this.levelLastLoaded=t,this.tick(),n.live&&!this.fragCurrent&&this.media&&this.state===x.State.IDLE){var F=Object(U.findFragmentByPTS)(null,n.fragments,this.media.currentTime,0);F||(this.warn("Subtitle playlist not aligned with playback"),y.details=void 0)}},d._handleFragmentLoadComplete=function(p){var c=p.frag,i=p.payload,n=c.decryptdata,t=this.hls;if(this.fragContextChanged(c))return;if(i&&i.byteLength>0&&n&&n.key&&n.iv&&n.method==="AES-128"){var e=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(i),n.key.buffer,n.iv.buffer).then(function(m){var y=performance.now();t.trigger(I.Events.FRAG_DECRYPTED,{frag:c,payload:m,stats:{tstart:e,tdecrypt:y}})})}},d.doTick=function(){if(!this.media){this.state=x.State.IDLE;return}if(this.state===x.State.IDLE){var p,c=this.currentTrackId,i=this.levels;if(!i.length||!i[c]||!i[c].details)return;var n=i[c].details,t=n.targetduration,e=this.config,m=this.media,y=E.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,m.currentTime-t,e.maxBufferHole),_=y.end,A=y.len,k=this.getMaxBufferLength()+t;if(A>k)return;console.assert(n,"Subtitle track details are defined on idle subtitle stream controller tick");var F=n.fragments,z=F.length,Q=n.edge,Y,X=this.fragPrevious;if(_<Q){var le=e.maxFragLookUpTolerance;X&&n.hasProgramDateTime&&(Y=Object(U.findFragmentByPDT)(F,X.endProgramDateTime,le)),Y||(Y=Object(U.findFragmentByPTS)(X,F,_,le),!Y&&X&&X.start<F[0].start&&(Y=F[0]))}else Y=F[z-1];(p=Y)!==null&&p!==void 0&&p.encrypted?(g.logger.log("Loading key for "+Y.sn),this.state=x.State.KEY_LOADING,this.hls.trigger(I.Events.KEY_LOADING,{frag:Y})):Y&&this.fragmentTracker.getState(Y)===w.FragmentState.NOT_LOADED&&this.loadFragment(Y,n,_)}},d.loadFragment=function(p,c,i){this.fragCurrent=p,s.prototype.loadFragment.call(this,p,c,i)},b(f,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),f}(x.default)},"./src/controller/subtitle-track-controller.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/events.ts"),g=S("./src/utils/texttrack-utils.ts"),E=S("./src/controller/base-playlist-controller.ts"),U=S("./src/types/loader.ts");function M(C,b){for(var v=0;v<b.length;v++){var h=b[v];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(C,h.key,h)}}function R(C,b,v){return b&&M(C.prototype,b),v&&M(C,v),C}function w(C,b){C.prototype=Object.create(b.prototype),C.prototype.constructor=C,x(C,b)}function x(C,b){return x=Object.setPrototypeOf||function(h,r){return h.__proto__=r,h},x(C,b)}var T=function(C){w(b,C);function b(h){var r;return r=C.call(this,h,"[subtitle-track-controller]")||this,r.media=null,r.tracks=[],r.groupId=null,r.tracksInGroup=[],r.trackId=-1,r.selectDefaultTrack=!0,r.queuedDefaultTrack=-1,r.trackChangeListener=function(){return r.onTextTracksChanged()},r.asyncPollTrackChange=function(){return r.pollTrackChange(0)},r.useTextTrackPolling=!1,r.subtitlePollingInterval=-1,r.subtitleDisplay=!0,r.registerListeners(),r}var v=b.prototype;return v.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,C.prototype.destroy.call(this)},v.registerListeners=function(){var r=this.hls;r.on(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.on(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.on(I.Events.LEVEL_LOADING,this.onLevelLoading,this),r.on(I.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),r.on(I.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),r.on(I.Events.ERROR,this.onError,this)},v.unregisterListeners=function(){var r=this.hls;r.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.off(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.off(I.Events.LEVEL_LOADING,this.onLevelLoading,this),r.off(I.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),r.off(I.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),r.off(I.Events.ERROR,this.onError,this)},v.onMediaAttached=function(r,o){if(this.media=o.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)},v.pollTrackChange=function(r){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,r)},v.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var r=O(this.media.textTracks);r.forEach(function(o){Object(g.clearCurrentCues)(o)}),this.subtitleTrack=-1,this.media=null},v.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},v.onManifestParsed=function(r,o){this.tracks=o.subtitleTracks},v.onSubtitleTrackLoaded=function(r,o){var s=o.id,f=o.details,d=this.trackId,l=this.tracksInGroup[d];if(!l){this.warn("Invalid subtitle track id "+s);return}var p=l.details;l.details=o.details,this.log("subtitle track "+s+" loaded ["+f.startSN+"-"+f.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,o,p))},v.onLevelLoading=function(r,o){this.switchLevel(o.level)},v.onLevelSwitching=function(r,o){this.switchLevel(o.level)},v.switchLevel=function(r){var o=this.hls.levels[r];if(!(o!=null&&o.textGroupIds))return;var s=o.textGroupIds[o.urlId];if(this.groupId!==s){var f=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,d=this.tracks.filter(function(c){return!s||c.groupId===s});this.tracksInGroup=d;var l=this.findTrackId(f==null?void 0:f.name)||this.findTrackId();this.groupId=s;var p={subtitleTracks:d};this.log("Updating subtitle tracks, "+d.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(I.Events.SUBTITLE_TRACKS_UPDATED,p),l!==-1&&this.setSubtitleTrack(l,f)}},v.findTrackId=function(r){for(var o=this.tracksInGroup,s=0;s<o.length;s++){var f=o[s];if((!this.selectDefaultTrack||f.default)&&(!r||r===f.name))return f.id}return-1},v.onError=function(r,o){if(C.prototype.onError.call(this,r,o),o.fatal||!o.context)return;o.context.type===U.PlaylistContextType.SUBTITLE_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},v.loadPlaylist=function(r){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var s=o.id,f=o.groupId,d=o.url;if(r)try{d=r.addDirectives(d)}catch(l){this.warn("Could not construct new URL with HLS Delivery Directives: "+l)}this.log("Loading subtitle playlist for id "+s),this.hls.trigger(I.Events.SUBTITLE_TRACK_LOADING,{url:d,id:s,groupId:f,deliveryDirectives:r||null})}},v.toggleTrackModes=function(r){var o=this,s=this.media,f=this.subtitleDisplay,d=this.trackId;if(!s)return;var l=O(s.textTracks),p=l.filter(function(n){return n.groupId===o.groupId});if(r===-1)[].slice.call(l).forEach(function(n){n.mode="disabled"});else{var c=p[d];c&&(c.mode="disabled")}var i=p[r];i&&(i.mode=f?"showing":"hidden")},v.setSubtitleTrack=function(r,o){var s,f=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=r;return}if(this.trackId!==r&&this.toggleTrackModes(r),this.trackId===r&&(r===-1||(s=f[r])!==null&&s!==void 0&&s.details)||r<-1||r>=f.length)return;this.clearTimer();var d=f[r];if(this.log("Switching to subtitle track "+r),this.trackId=r,d){var l=d.id,p=d.groupId,c=p===void 0?"":p,i=d.name,n=d.type,t=d.url;this.hls.trigger(I.Events.SUBTITLE_TRACK_SWITCH,{id:l,groupId:c,name:i,type:n,url:t});var e=this.switchParams(d.url,o==null?void 0:o.details);this.loadPlaylist(e)}else this.hls.trigger(I.Events.SUBTITLE_TRACK_SWITCH,{id:r})},v.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var r=-1,o=O(this.media.textTracks),s=0;s<o.length;s++)if(o[s].mode==="hidden")r=s;else if(o[s].mode==="showing"){r=s;break}this.subtitleTrack!==r&&(this.subtitleTrack=r)},R(b,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(r){this.selectDefaultTrack=!1;var o=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(r,o)}}]),b}(E.default);function O(C){for(var b=[],v=0;v<C.length;v++){var h=C[v];h.kind==="subtitles"&&h.label&&b.push(C[v])}return b}N.default=T},"./src/controller/timeline-controller.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"TimelineController",function(){return O});var I=S("./src/polyfills/number.ts"),g=S("./src/events.ts"),E=S("./src/utils/cea-608-parser.ts"),U=S("./src/utils/output-filter.ts"),M=S("./src/utils/webvtt-parser.ts"),R=S("./src/utils/texttrack-utils.ts"),w=S("./src/utils/imsc1-ttml-parser.ts"),x=S("./src/types/loader.ts"),T=S("./src/utils/logger.ts"),O=function(){function h(o){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=v(),this.captionsProperties=void 0,this.hls=o,this.config=o.config,this.Cues=o.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 s=new U.default(this,"textTrack1"),f=new U.default(this,"textTrack2"),d=new U.default(this,"textTrack3"),l=new U.default(this,"textTrack4");this.cea608Parser1=new E.default(1,s,f),this.cea608Parser2=new E.default(3,d,l)}o.on(g.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(g.Events.MANIFEST_LOADED,this.onManifestLoaded,this),o.on(g.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),o.on(g.Events.FRAG_LOADING,this.onFragLoading,this),o.on(g.Events.FRAG_LOADED,this.onFragLoaded,this),o.on(g.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),o.on(g.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),o.on(g.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),o.on(g.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),o.on(g.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var r=h.prototype;return r.destroy=function(){var s=this.hls;s.off(g.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.off(g.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(g.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.off(g.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.off(g.Events.FRAG_LOADING,this.onFragLoading,this),s.off(g.Events.FRAG_LOADED,this.onFragLoaded,this),s.off(g.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.off(g.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.off(g.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.off(g.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.off(g.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},r.addCues=function(s,f,d,l,p){for(var c=!1,i=p.length;i--;){var n=p[i],t=b(n[0],n[1],f,d);if(t>=0&&(n[0]=Math.min(n[0],f),n[1]=Math.max(n[1],d),c=!0,t/(d-f)>.5))return}if(c||p.push([f,d]),this.config.renderTextTracksNatively){var e=this.captionsTracks[s];this.Cues.newCue(e,f,d,l)}else{var m=this.Cues.newCue(null,f,d,l);this.hls.trigger(g.Events.CUES_PARSED,{type:"captions",cues:m,track:s})}},r.onInitPtsFound=function(s,f){var d=this,l=f.frag,p=f.id,c=f.initPTS,i=f.timescale,n=this.unparsedVttFrags;p==="main"&&(this.initPTS[l.cc]=c,this.timescale[l.cc]=i),n.length&&(this.unparsedVttFrags=[],n.forEach(function(t){d.onFragLoaded(g.Events.FRAG_LOADED,t)}))},r.getExistingTrack=function(s){var f=this.media;if(f)for(var d=0;d<f.textTracks.length;d++){var l=f.textTracks[d];if(l[s])return l}return null},r.createCaptionsTrack=function(s){this.config.renderTextTracksNatively?this.createNativeTrack(s):this.createNonNativeTrack(s)},r.createNativeTrack=function(s){if(this.captionsTracks[s])return;var f=this.captionsProperties,d=this.captionsTracks,l=this.media,p=f[s],c=p.label,i=p.languageCode,n=this.getExistingTrack(s);if(n)d[s]=n,Object(R.clearCurrentCues)(d[s]),Object(R.sendAddTrackEvent)(d[s],l);else{var t=this.createTextTrack("captions",c,i);t&&(t[s]=!0,d[s]=t)}},r.createNonNativeTrack=function(s){if(this.nonNativeCaptionsTracks[s])return;var f=this.captionsProperties[s];if(!f)return;var d=f.label,l={_id:s,label:d,kind:"captions",default:f.media?!!f.media.default:!1,closedCaptions:f.media};this.nonNativeCaptionsTracks[s]=l,this.hls.trigger(g.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[l]})},r.createTextTrack=function(s,f,d){var l=this.media;return l?l.addTextTrack(s,f,d):void 0},r.onMediaAttaching=function(s,f){this.media=f.media,this._cleanTracks()},r.onMediaDetaching=function(){var s=this.captionsTracks;Object.keys(s).forEach(function(f){Object(R.clearCurrentCues)(s[f]),delete s[f]}),this.nonNativeCaptionsTracks={}},r.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=v(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},r._cleanTracks=function(){var s=this.media;if(!s)return;var f=s.textTracks;if(f)for(var d=0;d<f.length;d++)Object(R.clearCurrentCues)(f[d])},r.onSubtitleTracksUpdated=function(s,f){var d=this;this.textTracks=[];var l=f.subtitleTracks||[],p=l.some(function(t){return t.textCodec===w.IMSC1_CODEC});if(this.config.enableWebVTT||p&&this.config.enableIMSC1){var c=this.tracks&&l&&this.tracks.length===l.length;if(this.tracks=l||[],this.config.renderTextTracksNatively){var i=this.media?this.media.textTracks:[];this.tracks.forEach(function(t,e){var m;if(e<i.length){for(var y=null,_=0;_<i.length;_++)if(C(i[_],t)){y=i[_];break}y&&(m=y)}m?Object(R.clearCurrentCues)(m):(m=d.createTextTrack("subtitles",t.name,t.lang),m&&(m.mode="disabled")),m&&(m.groupId=t.groupId,d.textTracks.push(m))})}else if(!c&&this.tracks&&this.tracks.length){var n=this.tracks.map(function(t){return{label:t.name,kind:t.type.toLowerCase(),default:t.default,subtitleTrack:t}});this.hls.trigger(g.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:n})}}},r.onManifestLoaded=function(s,f){var d=this;this.config.enableCEA708Captions&&f.captions&&f.captions.forEach(function(l){var p=/(?:CC|SERVICE)([1-4])/.exec(l.instreamId);if(!p)return;var c="textTrack"+p[1],i=d.captionsProperties[c];if(!i)return;i.label=l.name,l.lang&&(i.languageCode=l.lang),i.media=l})},r.onFragLoading=function(s,f){var d=this.cea608Parser1,l=this.cea608Parser2,p=this.lastSn,c=this.lastPartIndex;if(!this.enabled||!(d&&l))return;if(f.frag.type===x.PlaylistLevelType.MAIN){var i,n,t=f.frag.sn,e=(i=f==null||((n=f.part)===null||n===void 0)?void 0:n.index)!=null?i:-1;t===p+1||t===p&&e===c+1||(d.reset(),l.reset()),this.lastSn=t,this.lastPartIndex=e}},r.onFragLoaded=function(s,f){var d=f.frag,l=f.payload,p=this.initPTS,c=this.unparsedVttFrags;if(d.type===x.PlaylistLevelType.SUBTITLE)if(l.byteLength){if(!Object(I.isFiniteNumber)(p[d.cc])){c.push(f),p.length&&this.hls.trigger(g.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:new Error("Missing initial subtitle PTS")});return}var i=d.decryptdata;if(i==null||i.key==null||i.method!=="AES-128"){var n=this.tracks[d.level],t=this.vttCCs;t[d.cc]||(t[d.cc]={start:d.start,prevCC:this.prevCC,new:!0},this.prevCC=d.cc),n&&n.textCodec===w.IMSC1_CODEC?this._parseIMSC1(d,l):this._parseVTTs(d,l,t)}}else this.hls.trigger(g.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:new Error("Empty subtitle payload")})},r._parseIMSC1=function(s,f){var d=this,l=this.hls;Object(w.parseIMSC1)(f,this.initPTS[s.cc],this.timescale[s.cc],function(p){d._appendCues(p,s.level),l.trigger(g.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},function(p){T.logger.log("Failed to parse IMSC1: "+p),l.trigger(g.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:p})})},r._parseVTTs=function(s,f,d){var l=this,p=this.hls;Object(M.parseWebVTT)(f,this.initPTS[s.cc],this.timescale[s.cc],d,s.cc,s.start,function(c){l._appendCues(c,s.level),p.trigger(g.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},function(c){l._fallbackToIMSC1(s,f),T.logger.log("Failed to parse VTT cue: "+c),p.trigger(g.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:c})})},r._fallbackToIMSC1=function(s,f){var d=this,l=this.tracks[s.level];l.textCodec||Object(w.parseIMSC1)(f,this.initPTS[s.cc],this.timescale[s.cc],function(){l.textCodec=w.IMSC1_CODEC,d._parseIMSC1(s,f)},function(){l.textCodec="wvtt"})},r._appendCues=function(s,f){var d=this.hls;if(this.config.renderTextTracksNatively){var l=this.textTracks[f];if(l.mode==="disabled")return;s.forEach(function(i){return Object(R.addCueToTrack)(l,i)})}else{var p=this.tracks[f],c=p.default?"default":"subtitles"+f;d.trigger(g.Events.CUES_PARSED,{type:"subtitles",cues:s,track:c})}},r.onFragDecrypted=function(s,f){var d=f.frag;if(d.type===x.PlaylistLevelType.SUBTITLE){if(!Object(I.isFiniteNumber)(this.initPTS[d.cc])){this.unparsedVttFrags.push(f);return}this.onFragLoaded(g.Events.FRAG_LOADED,f)}},r.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},r.onFragParsingUserdata=function(s,f){var d=this.cea608Parser1,l=this.cea608Parser2;if(!this.enabled||!(d&&l))return;for(var p=0;p<f.samples.length;p++){var c=f.samples[p].bytes;if(c){var i=this.extractCea608Data(c);d.addData(f.samples[p].pts,i[0]),l.addData(f.samples[p].pts,i[1])}}},r.onBufferFlushing=function(s,f){var d=f.startOffset,l=f.endOffset,p=f.endOffsetSubtitles,c=f.type,i=this.media;if(!i||i.currentTime<l)return;if(!c||c==="video"){var n=this.captionsTracks;Object.keys(n).forEach(function(e){return Object(R.removeCuesInRange)(n[e],d,l)})}if(this.config.renderTextTracksNatively&&(d===0&&p!==void 0)){var t=this.textTracks;Object.keys(t).forEach(function(e){return Object(R.removeCuesInRange)(t[e],d,p)})}},r.extractCea608Data=function(s){for(var f=s[0]&31,d=2,l=[[],[]],p=0;p<f;p++){var c=s[d++],i=127&s[d++],n=127&s[d++],t=(4&c)!==0,e=3&c;if(i===0&&n===0)continue;t&&((e===0||e===1)&&(l[e].push(i),l[e].push(n)))}return l},h}();function C(h,r){return h&&h.label===r.name&&!(h.textTrack1||h.textTrack2)}function b(h,r,o,s){return Math.min(r,s)-Math.max(h,o)}function v(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return I});var I=function(){function g(U,M){this.subtle=void 0,this.aesIV=void 0,this.subtle=U,this.aesIV=M}var E=g.prototype;return E.decrypt=function(M,R){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},R,M)},g}()},"./src/crypt/aes-decryptor.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"removePadding",function(){return g}),S.d(N,"default",function(){return E});var I=S("./src/utils/typed-array.ts");function g(U){var M=U.byteLength,R=M&&new DataView(U.buffer).getUint8(M-1);return R?Object(I.sliceUint8)(U,0,M-R):U}var E=function(){function U(){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 M=U.prototype;return M.uint8ArrayToUint32Array_=function(w){for(var x=new DataView(w),T=new Uint32Array(4),O=0;O<4;O++)T[O]=x.getUint32(O*4);return T},M.initTable=function(){var w=this.sBox,x=this.invSBox,T=this.subMix,O=T[0],C=T[1],b=T[2],v=T[3],h=this.invSubMix,r=h[0],o=h[1],s=h[2],f=h[3],d=new Uint32Array(256),l=0,p=0,c=0;for(c=0;c<256;c++)c<128?d[c]=c<<1:d[c]=c<<1^283;for(c=0;c<256;c++){var i=p^p<<1^p<<2^p<<3^p<<4;i=i>>>8^i&255^99,w[l]=i,x[i]=l;var n=d[l],t=d[n],e=d[t],m=d[i]*257^i*16843008;O[l]=m<<24|m>>>8,C[l]=m<<16|m>>>16,b[l]=m<<8|m>>>24,v[l]=m,m=e*16843009^t*65537^n*257^l*16843008,r[i]=m<<24|m>>>8,o[i]=m<<16|m>>>16,s[i]=m<<8|m>>>24,f[i]=m,l?(l=n^d[d[d[e^n]]],p^=d[d[p]]):l=p=1}},M.expandKey=function(w){for(var x=this.uint8ArrayToUint32Array_(w),T=!0,O=0;O<x.length&&T;)T=x[O]===this.key[O],O++;if(T)return;this.key=x;var C=this.keySize=x.length;if(C!==4&&C!==6&&C!==8)throw new Error("Invalid aes key size="+C);var b=this.ksRows=(C+6+1)*4,v,h,r=this.keySchedule=new Uint32Array(b),o=this.invKeySchedule=new Uint32Array(b),s=this.sBox,f=this.rcon,d=this.invSubMix,l=d[0],p=d[1],c=d[2],i=d[3],n,t;for(v=0;v<b;v++){if(v<C){n=r[v]=x[v];continue}t=n,v%C===0?(t=t<<8|t>>>24,t=s[t>>>24]<<24|s[t>>>16&255]<<16|s[t>>>8&255]<<8|s[t&255],t^=f[v/C|0]<<24):C>6&&v%C===4&&(t=s[t>>>24]<<24|s[t>>>16&255]<<16|s[t>>>8&255]<<8|s[t&255]),r[v]=n=(r[v-C]^t)>>>0}for(h=0;h<b;h++)v=b-h,h&3?t=r[v]:t=r[v-4],h<4||v<=4?o[h]=t:o[h]=l[s[t>>>24]]^p[s[t>>>16&255]]^c[s[t>>>8&255]]^i[s[t&255]],o[h]=o[h]>>>0},M.networkToHostOrderSwap=function(w){return w<<24|(w&65280)<<8|(w&16711680)>>8|w>>>24},M.decrypt=function(w,x,T){for(var O=this.keySize+6,C=this.invKeySchedule,b=this.invSBox,v=this.invSubMix,h=v[0],r=v[1],o=v[2],s=v[3],f=this.uint8ArrayToUint32Array_(T),d=f[0],l=f[1],p=f[2],c=f[3],i=new Int32Array(w),n=new Int32Array(i.length),t,e,m,y,_,A,k,F,z,Q,Y,X,le,ye,ve=this.networkToHostOrderSwap;x<i.length;){for(z=ve(i[x]),Q=ve(i[x+1]),Y=ve(i[x+2]),X=ve(i[x+3]),_=z^C[0],A=X^C[1],k=Y^C[2],F=Q^C[3],le=4,ye=1;ye<O;ye++)t=h[_>>>24]^r[A>>16&255]^o[k>>8&255]^s[F&255]^C[le],e=h[A>>>24]^r[k>>16&255]^o[F>>8&255]^s[_&255]^C[le+1],m=h[k>>>24]^r[F>>16&255]^o[_>>8&255]^s[A&255]^C[le+2],y=h[F>>>24]^r[_>>16&255]^o[A>>8&255]^s[k&255]^C[le+3],_=t,A=e,k=m,F=y,le=le+4;t=b[_>>>24]<<24^b[A>>16&255]<<16^b[k>>8&255]<<8^b[F&255]^C[le],e=b[A>>>24]<<24^b[k>>16&255]<<16^b[F>>8&255]<<8^b[_&255]^C[le+1],m=b[k>>>24]<<24^b[F>>16&255]<<16^b[_>>8&255]<<8^b[A&255]^C[le+2],y=b[F>>>24]<<24^b[_>>16&255]<<16^b[A>>8&255]<<8^b[k&255]^C[le+3],n[x]=ve(t^d),n[x+1]=ve(y^l),n[x+2]=ve(m^p),n[x+3]=ve(e^c),d=z,l=Q,p=Y,c=X,x=x+4}return n.buffer},U}()},"./src/crypt/decrypter.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return x});var I=S("./src/crypt/aes-crypto.ts"),g=S("./src/crypt/fast-aes-key.ts"),E=S("./src/crypt/aes-decryptor.ts"),U=S("./src/utils/logger.ts"),M=S("./src/utils/mp4-tools.ts"),R=S("./src/utils/typed-array.ts"),w=16,x=function(){function T(C,b,v){var h=v===void 0?{}:v,r=h.removePKCS7Padding,o=r===void 0?!0:r;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=C,this.config=b,this.removePKCS7Padding=o,o)try{var s=self.crypto;s&&(this.subtle=s.subtle||s.webkitSubtle)}catch(f){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var O=T.prototype;return O.destroy=function(){this.observer=null},O.isSync=function(){return this.config.enableSoftwareAES},O.flush=function(){var b=this.currentResult;if(!b){this.reset();return}var v=new Uint8Array(b);return this.reset(),this.removePKCS7Padding?Object(E.removePadding)(v):v},O.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},O.decrypt=function(b,v,h,r){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(b),v,h);var o=this.flush();o&&r(o.buffer)}else this.webCryptoDecrypt(new Uint8Array(b),v,h).then(r)},O.softwareDecrypt=function(b,v,h){var r=this.currentIV,o=this.currentResult,s=this.remainderData;this.logOnce("JS AES decrypt"),s&&(b=Object(M.appendUint8Array)(s,b),this.remainderData=null);var f=this.getValidChunk(b);if(!f.length)return null;r&&(h=r);var d=this.softwareDecrypter;d||(d=this.softwareDecrypter=new E.default),d.expandKey(v);var l=o;return this.currentResult=d.decrypt(f.buffer,0,h),this.currentIV=Object(R.sliceUint8)(f,-16).buffer,l||null},O.webCryptoDecrypt=function(b,v,h){var r=this,o=this.subtle;return(this.key!==v||!this.fastAesKey)&&(this.key=v,this.fastAesKey=new g.default(o,v)),this.fastAesKey.expandKey().then(function(s){if(!o)return Promise.reject(new Error("web crypto not initialized"));var f=new I.default(o,h);return f.decrypt(b.buffer,s)}).catch(function(s){return r.onWebCryptoError(s,b,v,h)})},O.onWebCryptoError=function(b,v,h,r){return U.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",b),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(v,h,r)},O.getValidChunk=function(b){var v=b,h=b.length-b.length%w;return h!==b.length&&(v=Object(R.sliceUint8)(b,0,h),this.remainderData=Object(R.sliceUint8)(b,h)),v},O.logOnce=function(b){if(!this.logEnabled)return;U.logger.log("[decrypter.ts]: "+b),this.logEnabled=!1},T}()},"./src/crypt/fast-aes-key.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return I});var I=function(){function g(U,M){this.subtle=void 0,this.key=void 0,this.subtle=U,this.key=M}var E=g.prototype;return E.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},g}()},"./src/demux/aacdemuxer.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/demux/base-audio-demuxer.ts"),g=S("./src/demux/adts.ts"),E=S("./src/utils/logger.ts"),U=S("./src/demux/id3.ts");function M(x,T){x.prototype=Object.create(T.prototype),x.prototype.constructor=x,R(x,T)}function R(x,T){return R=Object.setPrototypeOf||function(C,b){return C.__proto__=b,C},R(x,T)}var w=function(x){M(T,x);function T(C,b){var v;return v=x.call(this)||this,v.observer=void 0,v.config=void 0,v.observer=C,v.config=b,v}var O=T.prototype;return O.resetInitSegment=function(b,v,h){x.prototype.resetInitSegment.call(this,b,v,h),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:b,duration:h,inputTimeScale:9e4,dropped:0}},T.probe=function(b){if(!b)return!1;for(var v=U.getID3Data(b,0)||[],h=v.length,r=b.length;h<r;h++)if(g.probe(b,h))return E.logger.log("ADTS sync word found !"),!0;return!1},O.canParse=function(b,v){return g.canParse(b,v)},O.appendFrame=function(b,v,h){g.initTrackConfig(b,this.observer,v,h,b.manifestCodec);var r=g.appendFrame(b,v,h,this.initPTS,this.frameIndex);if(r&&r.missing===0)return r},T}(I.default);w.minProbeByteLength=9,N.default=w},"./src/demux/adts.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"getAudioConfig",function(){return U}),S.d(N,"isHeaderPattern",function(){return M}),S.d(N,"getHeaderLength",function(){return R}),S.d(N,"getFullFrameLength",function(){return w}),S.d(N,"canGetFrameLength",function(){return x}),S.d(N,"isHeader",function(){return T}),S.d(N,"canParse",function(){return O}),S.d(N,"probe",function(){return C}),S.d(N,"initTrackConfig",function(){return b}),S.d(N,"getFrameDuration",function(){return v}),S.d(N,"parseFrameHeader",function(){return h}),S.d(N,"appendFrame",function(){return r});var I=S("./src/utils/logger.ts"),g=S("./src/errors.ts"),E=S("./src/events.ts");function U(o,s,f,d){var l,p,c,i,n=navigator.userAgent.toLowerCase(),t=d,e=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];l=((s[f+2]&192)>>>6)+1;var m=(s[f+2]&60)>>>2;if(m>e.length-1){o.trigger(E.Events.ERROR,{type:g.ErrorTypes.MEDIA_ERROR,details:g.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+m});return}return c=(s[f+2]&1)<<2,c|=(s[f+3]&192)>>>6,I.logger.log("manifest codec:"+d+", ADTS type:"+l+", samplingIndex:"+m),/firefox/i.test(n)?m>=6?(l=5,i=new Array(4),p=m-3):(l=2,i=new Array(2),p=m):n.indexOf("android")!==-1?(l=2,i=new Array(2),p=m):(l=5,i=new Array(4),d&&(d.indexOf("mp4a.40.29")!==-1||d.indexOf("mp4a.40.5")!==-1)||!d&&m>=6?p=m-3:((d&&d.indexOf("mp4a.40.2")!==-1&&(m>=6&&c===1||/vivaldi/i.test(n))||!d&&c===1)&&(l=2,i=new Array(2)),p=m)),i[0]=l<<3,i[0]|=(m&14)>>1,i[1]|=(m&1)<<7,i[1]|=c<<3,l===5&&(i[1]|=(p&14)>>1,i[2]=(p&1)<<7,i[2]|=2<<2,i[3]=0),{config:i,samplerate:e[m],channelCount:c,codec:"mp4a.40."+l,manifestCodec:t}}function M(o,s){return o[s]===255&&(o[s+1]&246)===240}function R(o,s){return o[s+1]&1?7:9}function w(o,s){return(o[s+3]&3)<<11|o[s+4]<<3|(o[s+5]&224)>>>5}function x(o,s){return s+5<o.length}function T(o,s){return s+1<o.length&&M(o,s)}function O(o,s){return x(o,s)&&M(o,s)&&w(o,s)<=o.length-s}function C(o,s){if(T(o,s)){var f=R(o,s);if(s+f>=o.length)return!1;var d=w(o,s);if(d<=f)return!1;var l=s+d;return l===o.length||T(o,l)}return!1}function b(o,s,f,d,l){if(!o.samplerate){var p=U(s,f,d,l);if(!p)return;o.config=p.config,o.samplerate=p.samplerate,o.channelCount=p.channelCount,o.codec=p.codec,o.manifestCodec=p.manifestCodec,I.logger.log("parsed codec:"+o.codec+", rate:"+p.samplerate+", channels:"+p.channelCount)}}function v(o){return 1024*9e4/o}function h(o,s,f,d,l){var p=R(o,s),c=w(o,s);if(c-=p,c>0){var i=f+d*l;return{headerLength:p,frameLength:c,stamp:i}}}function r(o,s,f,d,l){var p=v(o.samplerate),c=h(s,f,d,l,p);if(c){var i=c.frameLength,n=c.headerLength,t=c.stamp,e=n+i,m=Math.max(0,f+e-s.length),y;m?(y=new Uint8Array(e-n),y.set(s.subarray(f+n,s.length),0)):y=s.subarray(f+n,f+e);var _={unit:y,pts:t};return m||o.samples.push(_),{sample:_,length:e,missing:m}}}},"./src/demux/base-audio-demuxer.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"initPTSFn",function(){return w});var I=S("./src/polyfills/number.ts"),g=S("./src/demux/id3.ts"),E=S("./src/demux/dummy-demuxed-track.ts"),U=S("./src/utils/mp4-tools.ts"),M=S("./src/utils/typed-array.ts"),R=function(){function x(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var T=x.prototype;return T.resetInitSegment=function(C,b,v){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},T.resetTimeStamp=function(){},T.resetContiguity=function(){},T.canParse=function(C,b){return!1},T.appendFrame=function(C,b,v){},T.demux=function(C,b){this.cachedData&&(C=Object(U.appendUint8Array)(this.cachedData,C),this.cachedData=null);var v=g.getID3Data(C,0),h=v?v.length:0,r,o,s=this._audioTrack,f=this._id3Track,d=v?g.getTimeStamp(v):void 0,l=C.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=w(d,b)),v&&v.length>0&&f.samples.push({pts:this.initPTS,dts:this.initPTS,data:v}),o=this.initPTS;h<l;){if(this.canParse(C,h)){var p=this.appendFrame(s,C,h);p?(this.frameIndex++,o=p.sample.pts,h+=p.length,r=h):h=l}else g.canParse(C,h)?(v=g.getID3Data(C,h),f.samples.push({pts:o,dts:o,data:v}),h+=v.length,r=h):h++;if(h===l&&r!==l){var c=Object(M.sliceUint8)(C,r);this.cachedData?this.cachedData=Object(U.appendUint8Array)(this.cachedData,c):this.cachedData=c}}return{audioTrack:s,avcTrack:Object(E.dummyTrack)(),id3Track:f,textTrack:Object(E.dummyTrack)()}},T.demuxSampleAes=function(C,b,v){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},T.flush=function(C){var b=this.cachedData;return b&&(this.cachedData=null,this.demux(b,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(E.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(E.dummyTrack)()}},T.destroy=function(){},x}(),w=function(T,O){return Object(I.isFiniteNumber)(T)?T*90:O*9e4};N.default=R},"./src/demux/chunk-cache.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return I});var I=function(){function E(){this.chunks=[],this.dataLength=0}var U=E.prototype;return U.push=function(R){this.chunks.push(R),this.dataLength+=R.length},U.flush=function(){var R=this.chunks,w=this.dataLength,x;if(R.length)R.length===1?x=R[0]:x=g(R,w);else return new Uint8Array(0);return this.reset(),x},U.reset=function(){this.chunks.length=0,this.dataLength=0},E}();function g(E,U){for(var M=new Uint8Array(U),R=0,w=0;w<E.length;w++){var x=E[w];M.set(x,R),R+=x.length}return M}},"./src/demux/dummy-demuxed-track.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"dummyTrack",function(){return I});function I(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/utils/logger.ts"),g=function(){function E(M){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=M,this.bytesAvailable=M.byteLength,this.word=0,this.bitsAvailable=0}var U=E.prototype;return U.loadWord=function(){var R=this.data,w=this.bytesAvailable,x=R.byteLength-w,T=new Uint8Array(4),O=Math.min(4,w);if(O===0)throw new Error("no bytes available");T.set(R.subarray(x,x+O)),this.word=new DataView(T.buffer).getUint32(0),this.bitsAvailable=O*8,this.bytesAvailable-=O},U.skipBits=function(R){var w;this.bitsAvailable>R?(this.word<<=R,this.bitsAvailable-=R):(R-=this.bitsAvailable,w=R>>3,R-=w>>3,this.bytesAvailable-=w,this.loadWord(),this.word<<=R,this.bitsAvailable-=R)},U.readBits=function(R){var w=Math.min(this.bitsAvailable,R),x=this.word>>>32-w;return R>32&&I.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=w,this.bitsAvailable>0?this.word<<=w:this.bytesAvailable>0&&this.loadWord(),w=R-w,w>0&&this.bitsAvailable?x<<w|this.readBits(w):x},U.skipLZ=function(){var R;for(R=0;R<this.bitsAvailable;++R)if((this.word&2147483648>>>R)!==0)return this.word<<=R,this.bitsAvailable-=R,R;return this.loadWord(),R+this.skipLZ()},U.skipUEG=function(){this.skipBits(1+this.skipLZ())},U.skipEG=function(){this.skipBits(1+this.skipLZ())},U.readUEG=function(){var R=this.skipLZ();return this.readBits(R+1)-1},U.readEG=function(){var R=this.readUEG();return 1&R?1+R>>>1:-1*(R>>>1)},U.readBoolean=function(){return this.readBits(1)===1},U.readUByte=function(){return this.readBits(8)},U.readUShort=function(){return this.readBits(16)},U.readUInt=function(){return this.readBits(32)},U.skipScalingList=function(R){for(var w=8,x=8,T,O=0;O<R;O++)x!==0&&(T=this.readEG(),x=(w+T+256)%256),w=x===0?w:x},U.readSPS=function(){var R=0,w=0,x=0,T=0,O,C,b,v=this.readUByte.bind(this),h=this.readBits.bind(this),r=this.readUEG.bind(this),o=this.readBoolean.bind(this),s=this.skipBits.bind(this),f=this.skipEG.bind(this),d=this.skipUEG.bind(this),l=this.skipScalingList.bind(this);v();var p=v();if(h(5),s(3),v(),d(),p===100||p===110||p===122||p===244||p===44||p===83||p===86||p===118||p===128){var c=r();if(c===3&&s(1),d(),d(),s(1),o())for(C=c!==3?8:12,b=0;b<C;b++)o()&&(b<6?l(16):l(64))}d();var i=r();if(i===0)r();else if(i===1)for(s(1),f(),f(),O=r(),b=0;b<O;b++)f();d(),s(1);var n=r(),t=r(),e=h(1);e===0&&s(1),s(1),o()&&(R=r(),w=r(),x=r(),T=r());var m=[1,1];if(o()&&o()){var y=v();switch(y){case 1:m=[1,1];break;case 2:m=[12,11];break;case 3:m=[10,11];break;case 4:m=[16,11];break;case 5:m=[40,33];break;case 6:m=[24,11];break;case 7:m=[20,11];break;case 8:m=[32,11];break;case 9:m=[80,33];break;case 10:m=[18,11];break;case 11:m=[15,11];break;case 12:m=[64,33];break;case 13:m=[160,99];break;case 14:m=[4,3];break;case 15:m=[3,2];break;case 16:m=[2,1];break;case 255:{m=[v()<<8|v(),v()<<8|v()];break}}}return{width:Math.ceil((n+1)*16-R*2-w*2),height:(2-e)*(t+1)*16-(e?2:4)*(x+T),pixelRatio:m}},U.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},E}();N.default=g},"./src/demux/id3.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"isHeader",function(){return I}),S.d(N,"isFooter",function(){return g}),S.d(N,"getID3Data",function(){return E}),S.d(N,"canParse",function(){return M}),S.d(N,"getTimeStamp",function(){return R}),S.d(N,"isTimeStampFrame",function(){return w}),S.d(N,"getID3Frames",function(){return T}),S.d(N,"decodeFrame",function(){return O}),S.d(N,"utf8ArrayToStr",function(){return r}),S.d(N,"testables",function(){return o});var I=function(l,p){return p+10<=l.length&&(l[p]===73&&l[p+1]===68&&l[p+2]===51&&(l[p+3]<255&&l[p+4]<255&&(l[p+6]<128&&l[p+7]<128&&l[p+8]<128&&l[p+9]<128)))},g=function(l,p){return p+10<=l.length&&(l[p]===51&&l[p+1]===68&&l[p+2]===73&&(l[p+3]<255&&l[p+4]<255&&(l[p+6]<128&&l[p+7]<128&&l[p+8]<128&&l[p+9]<128)))},E=function(l,p){for(var c=p,i=0;I(l,p);){i+=10;var n=U(l,p+6);i+=n,g(l,p+10)&&(i+=10),p+=i}return i>0?l.subarray(c,c+i):void 0},U=function(l,p){var c=0;return c=(l[p]&127)<<21,c|=(l[p+1]&127)<<14,c|=(l[p+2]&127)<<7,c|=l[p+3]&127,c},M=function(l,p){return I(l,p)&&U(l,p+6)+10<=l.length-p},R=function(l){for(var p=T(l),c=0;c<p.length;c++){var i=p[c];if(w(i))return h(i)}return},w=function(l){return l&&l.key==="PRIV"&&l.info==="com.apple.streaming.transportStreamTimestamp"},x=function(l){var p=String.fromCharCode(l[0],l[1],l[2],l[3]),c=U(l,4),i=10;return{type:p,size:c,data:l.subarray(i,i+c)}},T=function(l){for(var p=0,c=[];I(l,p);){var i=U(l,p+6);p+=10;for(var n=p+i;p+8<n;){var t=x(l.subarray(p)),e=O(t);e&&c.push(e),p+=t.size+10}g(l,p)&&(p+=10)}return c},O=function(l){return l.type==="PRIV"?C(l):l.type[0]==="W"?v(l):b(l)},C=function(l){if(l.size<2)return;var p=r(l.data,!0),c=new Uint8Array(l.data.subarray(p.length+1));return{key:l.type,info:p,data:c.buffer}},b=function(l){if(l.size<2)return;if(l.type==="TXXX"){var p=1,c=r(l.data.subarray(p),!0);p+=c.length+1;var i=r(l.data.subarray(p));return{key:l.type,info:c,data:i}}var n=r(l.data.subarray(1));return{key:l.type,data:n}},v=function(l){if(l.type==="WXXX"){if(l.size<2)return;var p=1,c=r(l.data.subarray(p),!0);p+=c.length+1;var i=r(l.data.subarray(p));return{key:l.type,info:c,data:i}}var n=r(l.data);return{key:l.type,data:n}},h=function(l){if(l.data.byteLength===8){var p=new Uint8Array(l.data),c=p[3]&1,i=(p[4]<<23)+(p[5]<<15)+(p[6]<<7)+p[7];return i/=45,c&&(i+=4772185884e-2),Math.round(i)}return},r=function(l,p){p===void 0&&(p=!1);var c=f();if(c){var i=c.decode(l);if(p){var n=i.indexOf("\0");return n!==-1?i.substring(0,n):i}return i.replace(/\0/g,"")}for(var t=l.length,e,m,y,_="",A=0;A<t;){if(e=l[A++],e===0&&p)return _;if(e===0||e===3)continue;switch(e>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:_+=String.fromCharCode(e);break;case 12:case 13:m=l[A++],_+=String.fromCharCode((e&31)<<6|m&63);break;case 14:m=l[A++],y=l[A++],_+=String.fromCharCode((e&15)<<12|(m&63)<<6|(y&63)<<0);break;default:}}return _},o={decodeTextFrame:b},s;function f(){return!s&&typeof self.TextDecoder!="undefined"&&(s=new self.TextDecoder("utf-8")),s}},"./src/demux/mp3demuxer.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/demux/base-audio-demuxer.ts"),g=S("./src/demux/id3.ts"),E=S("./src/utils/logger.ts"),U=S("./src/demux/mpegaudio.ts");function M(x,T){x.prototype=Object.create(T.prototype),x.prototype.constructor=x,R(x,T)}function R(x,T){return R=Object.setPrototypeOf||function(C,b){return C.__proto__=b,C},R(x,T)}var w=function(x){M(T,x);function T(){return x.apply(this,arguments)||this}var O=T.prototype;return O.resetInitSegment=function(b,v,h){x.prototype.resetInitSegment.call(this,b,v,h),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:b,duration:h,inputTimeScale:9e4,dropped:0}},T.probe=function(b){if(!b)return!1;for(var v=g.getID3Data(b,0)||[],h=v.length,r=b.length;h<r;h++)if(U.probe(b,h))return E.logger.log("MPEG Audio sync word found !"),!0;return!1},O.canParse=function(b,v){return U.canParse(b,v)},O.appendFrame=function(b,v,h){return this.initPTS===null?void 0:U.appendFrame(b,v,h,this.initPTS,this.frameIndex)},T}(I.default);w.minProbeByteLength=4,N.default=w},"./src/demux/mp4demuxer.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/utils/mp4-tools.ts"),g=S("./src/demux/dummy-demuxed-track.ts"),E=function(){function U(R,w){this.remainderData=null,this.config=void 0,this.config=w}var M=U.prototype;return M.resetTimeStamp=function(){},M.resetInitSegment=function(){},M.resetContiguity=function(){},U.probe=function(w){return Object(I.findBox)({data:w,start:0,end:Math.min(w.length,16384)},["moof"]).length>0},M.demux=function(w){var x=w,T=Object(g.dummyTrack)();if(this.config.progressive){this.remainderData&&(x=Object(I.appendUint8Array)(this.remainderData,w));var O=Object(I.segmentValidRange)(x);this.remainderData=O.remainder,T.samples=O.valid||new Uint8Array}else T.samples=x;return{audioTrack:Object(g.dummyTrack)(),avcTrack:T,id3Track:Object(g.dummyTrack)(),textTrack:Object(g.dummyTrack)()}},M.flush=function(){var w=Object(g.dummyTrack)();return w.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(g.dummyTrack)(),avcTrack:w,id3Track:Object(g.dummyTrack)(),textTrack:Object(g.dummyTrack)()}},M.demuxSampleAes=function(w,x,T){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},M.destroy=function(){},U}();E.minProbeByteLength=1024,N.default=E},"./src/demux/mpegaudio.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"appendFrame",function(){return R}),S.d(N,"parseHeader",function(){return w}),S.d(N,"isHeaderPattern",function(){return x}),S.d(N,"isHeader",function(){return T}),S.d(N,"canParse",function(){return O}),S.d(N,"probe",function(){return C});var I=null,g=[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],E=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],U=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],M=[0,1,1,4];function R(b,v,h,r,o){if(h+24>v.length)return;var s=w(v,h);if(s&&h+s.frameLength<=v.length){var f=s.samplesPerFrame*9e4/s.sampleRate,d=r+o*f,l={unit:v.subarray(h,h+s.frameLength),pts:d,dts:d};return b.config=[],b.channelCount=s.channelCount,b.samplerate=s.sampleRate,b.samples.push(l),{sample:l,length:s.frameLength,missing:0}}}function w(b,v){var h=b[v+1]>>3&3,r=b[v+1]>>1&3,o=b[v+2]>>4&15,s=b[v+2]>>2&3;if(h!==1&&o!==0&&o!==15&&s!==3){var f=b[v+2]>>1&1,d=b[v+3]>>6,l=h===3?3-r:r===3?3:4,p=g[l*14+o-1]*1e3,c=h===3?0:h===2?1:2,i=E[c*3+s],n=d===3?1:2,t=U[h][r],e=M[r],m=t*8*e,y=Math.floor(t*p/i+f)*e;if(I===null){var _=navigator.userAgent||"",A=_.match(/Chrome\/(\d+)/i);I=A?parseInt(A[1]):0}var k=!!I&&I<=87;return k&&r===2&&p>=224e3&&d===0&&(b[v+3]=b[v+3]|128),{sampleRate:i,channelCount:n,frameLength:y,samplesPerFrame:m}}}function x(b,v){return b[v]===255&&(b[v+1]&224)===224&&(b[v+1]&6)!==0}function T(b,v){return v+1<b.length&&x(b,v)}function O(b,v){var h=4;return x(b,v)&&h<=b.length-v}function C(b,v){if(v+1<b.length&&x(b,v)){var h=4,r=w(b,v),o=h;r!=null&&r.frameLength&&(o=r.frameLength);var s=v+o;return s===b.length||T(b,s)}return!1}},"./src/demux/sample-aes.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/crypt/decrypter.ts"),g=S("./src/demux/tsdemuxer.ts"),E=function(){function U(R,w,x){this.keyData=void 0,this.decrypter=void 0,this.keyData=x,this.decrypter=new I.default(R,w,{removePKCS7Padding:!1})}var M=U.prototype;return M.decryptBuffer=function(w,x){this.decrypter.decrypt(w,this.keyData.key.buffer,this.keyData.iv.buffer,x)},M.decryptAacSample=function(w,x,T,O){var C=w[x].unit,b=C.subarray(16,C.length-C.length%16),v=b.buffer.slice(b.byteOffset,b.byteOffset+b.length),h=this;this.decryptBuffer(v,function(r){var o=new Uint8Array(r);C.set(o,16),O||h.decryptAacSamples(w,x+1,T)})},M.decryptAacSamples=function(w,x,T){for(;;x++){if(x>=w.length){T();return}if(w[x].unit.length<32)continue;var O=this.decrypter.isSync();if(this.decryptAacSample(w,x,T,O),!O)return}},M.getAvcEncryptedData=function(w){for(var x=Math.floor((w.length-48)/160)*16+16,T=new Int8Array(x),O=0,C=32;C<=w.length-16;C+=160,O+=16)T.set(w.subarray(C,C+16),O);return T},M.getAvcDecryptedUnit=function(w,x){for(var T=new Uint8Array(x),O=0,C=32;C<=w.length-16;C+=160,O+=16)w.set(T.subarray(O,O+16),C);return w},M.decryptAvcSample=function(w,x,T,O,C,b){var v=Object(g.discardEPB)(C.data),h=this.getAvcEncryptedData(v),r=this;this.decryptBuffer(h.buffer,function(o){C.data=r.getAvcDecryptedUnit(v,o),b||r.decryptAvcSamples(w,x,T+1,O)})},M.decryptAvcSamples=function(w,x,T,O){if(w instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;x++,T=0){if(x>=w.length){O();return}for(var C=w[x].units;!(T>=C.length);T++){var b=C[T];if(b.data.length<=48||b.type!==1&&b.type!==5)continue;var v=this.decrypter.isSync();if(this.decryptAvcSample(w,x,T,O,b,v),!v)return}}},U}();N.default=E},"./src/demux/transmuxer-interface.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return C});var I=S("./node_modules/webworkify-webpack/index.js"),g=S.n(I),E=S("./src/events.ts"),U=S("./src/demux/transmuxer.ts"),M=S("./src/utils/logger.ts"),R=S("./src/errors.ts"),w=S("./src/utils/mediasource-helper.ts"),x=S("./node_modules/eventemitter3/index.js"),T=S.n(x),O=Object(w.getMediaSource)()||{isTypeSupported:function(){return!1}},C=function(){function b(h,r,o,s){var f=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=h,this.id=r,this.onTransmuxComplete=o,this.onFlush=s;var d=h.config,l=function(t,e){e=e||{},e.frag=f.frag,e.id=f.id,h.trigger(t,e)};this.observer=new x.EventEmitter,this.observer.on(E.Events.FRAG_DECRYPTED,l),this.observer.on(E.Events.ERROR,l);var p={mp4:O.isTypeSupported("video/mp4"),mpeg:O.isTypeSupported("audio/mpeg"),mp3:O.isTypeSupported('audio/mp4; codecs="mp3"')},c=navigator.vendor;if(d.enableWorker&&typeof Worker!="undefined"){M.logger.log("demuxing in webworker");var i;try{i=this.worker=I("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),i.addEventListener("message",this.onwmsg),i.onerror=function(n){h.trigger(E.Events.ERROR,{type:R.ErrorTypes.OTHER_ERROR,details:R.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(n.message+" ("+n.filename+":"+n.lineno+")")})},i.postMessage({cmd:"init",typeSupported:p,vendor:c,id:r,config:JSON.stringify(d)})}catch(n){M.logger.warn("Error in worker:",n),M.logger.error("Error while initializing DemuxerWorker, fallback to inline"),i&&self.URL.revokeObjectURL(i.objectURL),this.transmuxer=new U.default(this.observer,p,d,c,r),this.worker=null}}else this.transmuxer=new U.default(this.observer,p,d,c,r)}var v=b.prototype;return v.destroy=function(){var r=this.worker;if(r)r.removeEventListener("message",this.onwmsg),r.terminate(),this.worker=null;else{var o=this.transmuxer;o&&(o.destroy(),this.transmuxer=null)}var s=this.observer;s&&s.removeAllListeners(),this.observer=null},v.push=function(r,o,s,f,d,l,p,c,i,n){var t=this;i.transmuxing.start=self.performance.now();var e=this.transmuxer,m=this.worker,y=l?l.start:d.start,_=d.decryptdata,A=this.frag,k=!(A&&d.cc===A.cc),F=!(A&&i.level===A.level),z=A?i.sn-A.sn:-1,Q=this.part?i.part-this.part.index:1,Y=!F&&(z===1||z===0&&Q===1),X=self.performance.now();(F||z||d.stats.parsing.start===0)&&(d.stats.parsing.start=X),l&&(Q||!Y)&&(l.stats.parsing.start=X);var le=new U.TransmuxState(k,Y,c,F,y);if(!Y||k){M.logger.log("[transmuxer-interface, "+d.type+"]: Starting new transmux session for sn: "+i.sn+" p: "+i.part+" level: "+i.level+" id: "+i.id+`
discontinuity: `+k+`
trackSwitch: `+F+`
contiguous: `+Y+`
accurateTimeOffset: `+c+`
timeOffset: `+y);var ye=new U.TransmuxConfig(s,f,o,p,n);this.configureTransmuxer(ye)}if(this.frag=d,this.part=l,m)m.postMessage({cmd:"demux",data:r,decryptdata:_,chunkMeta:i,state:le},r instanceof ArrayBuffer?[r]:[]);else if(e){var ve=e.push(r,_,i,le);Object(U.isPromise)(ve)?ve.then(function(Ne){t.handleTransmuxComplete(Ne)}):this.handleTransmuxComplete(ve)}},v.flush=function(r){var o=this;r.transmuxing.start=self.performance.now();var s=this.transmuxer,f=this.worker;if(f)f.postMessage({cmd:"flush",chunkMeta:r});else if(s){var d=s.flush(r);Object(U.isPromise)(d)?d.then(function(l){o.handleFlushResult(l,r)}):this.handleFlushResult(d,r)}},v.handleFlushResult=function(r,o){var s=this;r.forEach(function(f){s.handleTransmuxComplete(f)}),this.onFlush(o)},v.onWorkerMessage=function(r){var o=r.data,s=this.hls;switch(o.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(o.data);break}case"flush":{this.onFlush(o.data);break}default:{o.data=o.data||{},o.data.frag=this.frag,o.data.id=this.id,s.trigger(o.event,o.data);break}}},v.configureTransmuxer=function(r){var o=this.worker,s=this.transmuxer;o?o.postMessage({cmd:"configure",config:r}):s&&s.configure(r)},v.handleTransmuxComplete=function(r){r.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(r)},b}()},"./src/demux/transmuxer-worker.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return R});var I=S("./src/demux/transmuxer.ts"),g=S("./src/events.ts"),E=S("./src/utils/logger.ts"),U=S("./node_modules/eventemitter3/index.js"),M=S.n(U);function R(C){var b=new U.EventEmitter,v=function(r,o){C.postMessage({event:r,data:o})};b.on(g.Events.FRAG_DECRYPTED,v),b.on(g.Events.ERROR,v),C.addEventListener("message",function(h){var r=h.data;switch(r.cmd){case"init":{var o=JSON.parse(r.config);C.transmuxer=new I.default(b,r.typeSupported,o,r.vendor,r.id),Object(E.enableLogs)(o.debug),v("init",null);break}case"configure":{C.transmuxer.configure(r.config);break}case"demux":{var s=C.transmuxer.push(r.data,r.decryptdata,r.chunkMeta,r.state);Object(I.isPromise)(s)?s.then(function(l){w(C,l)}):w(C,s);break}case"flush":{var f=r.chunkMeta,d=C.transmuxer.flush(f);Object(I.isPromise)(d)?d.then(function(l){T(C,l,f)}):T(C,d,f);break}default:break}})}function w(C,b){if(O(b.remuxResult))return;var v=[],h=b.remuxResult,r=h.audio,o=h.video;r&&x(v,r),o&&x(v,o),C.postMessage({event:"transmuxComplete",data:b},v)}function x(C,b){b.data1&&C.push(b.data1.buffer),b.data2&&C.push(b.data2.buffer)}function T(C,b,v){b.forEach(function(h){w(C,h)}),C.postMessage({event:"flush",data:v})}function O(C){return!C.audio&&!C.video&&!C.text&&!C.id3&&!C.initSegment}},"./src/demux/transmuxer.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return o}),S.d(N,"isPromise",function(){return d}),S.d(N,"TransmuxConfig",function(){return l}),S.d(N,"TransmuxState",function(){return p});var I=S("./src/events.ts"),g=S("./src/errors.ts"),E=S("./src/crypt/decrypter.ts"),U=S("./src/demux/aacdemuxer.ts"),M=S("./src/demux/mp4demuxer.ts"),R=S("./src/demux/tsdemuxer.ts"),w=S("./src/demux/mp3demuxer.ts"),x=S("./src/remux/mp4-remuxer.ts"),T=S("./src/remux/passthrough-remuxer.ts"),O=S("./src/demux/chunk-cache.ts"),C=S("./src/utils/mp4-tools.ts"),b=S("./src/utils/logger.ts"),v;try{v=self.performance.now.bind(self.performance)}catch(c){b.logger.debug("Unable to use Performance API on this environment"),v=self.Date.now}var h=[{demux:R.default,remux:x.default},{demux:M.default,remux:T.default},{demux:U.default,remux:x.default},{demux:w.default,remux:x.default}],r=1024;h.forEach(function(c){var i=c.demux;r=Math.max(r,i.minProbeByteLength)});var o=function(){function c(n,t,e,m,y){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 O.default,this.observer=n,this.typeSupported=t,this.config=e,this.vendor=m,this.id=y}var i=c.prototype;return i.configure=function(t){this.transmuxConfig=t,this.decrypter&&this.decrypter.reset()},i.push=function(t,e,m,y){var _=this,A=m.transmuxing;A.executeStart=v();var k=new Uint8Array(t),F=this.cache,z=this.config,Q=this.currentTransmuxState,Y=this.transmuxConfig;y&&(this.currentTransmuxState=y);var X=s(k,e);if(X&&X.method==="AES-128"){var le=this.getDecrypter();if(z.enableSoftwareAES){var ye=le.softwareDecrypt(k,X.key.buffer,X.iv.buffer);if(!ye)return A.executeEnd=v(),f(m);k=new Uint8Array(ye)}else return this.decryptionPromise=le.webCryptoDecrypt(k,X.key.buffer,X.iv.buffer).then(function(We){var Qe=_.push(We,null,m);return _.decryptionPromise=null,Qe}),this.decryptionPromise}var ve=y||Q,Ne=ve.contiguous,Te=ve.discontinuity,Ce=ve.trackSwitch,_e=ve.accurateTimeOffset,Re=ve.timeOffset,he=Y.audioCodec,Z=Y.videoCodec,je=Y.defaultInitPts,lt=Y.duration,nt=Y.initSegmentData;if((Te||Ce)&&this.resetInitSegment(nt,he,Z,lt),Te&&this.resetInitialTimestamp(je),Ne||this.resetContiguity(),this.needsProbing(k,Te,Ce)){if(F.dataLength){var Ke=F.flush();k=Object(C.appendUint8Array)(Ke,k)}this.configureTransmuxer(k,Y)}var Ge=this.transmux(k,X,Re,_e,m),Pe=this.currentTransmuxState;return Pe.contiguous=!0,Pe.discontinuity=!1,Pe.trackSwitch=!1,A.executeEnd=v(),Ge},i.flush=function(t){var e=this,m=t.transmuxing;m.executeStart=v();var y=this.decrypter,_=this.cache,A=this.currentTransmuxState,k=this.decryptionPromise;if(k)return k.then(function(){return e.flush(t)});var F=[],z=A.timeOffset;if(y){var Q=y.flush();Q&&F.push(this.push(Q,null,t))}var Y=_.dataLength;_.reset();var X=this.demuxer,le=this.remuxer;if(!X||!le)return Y>=r&&this.observer.emit(I.Events.ERROR,I.Events.ERROR,{type:g.ErrorTypes.MEDIA_ERROR,details:g.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),m.executeEnd=v(),[f(t)];var ye=X.flush(z);return d(ye)?ye.then(function(ve){return e.flushRemux(F,ve,t),F}):(this.flushRemux(F,ye,t),F)},i.flushRemux=function(t,e,m){var y=e.audioTrack,_=e.avcTrack,A=e.id3Track,k=e.textTrack,F=this.currentTransmuxState,z=F.accurateTimeOffset,Q=F.timeOffset;b.logger.log("[transmuxer.ts]: Flushed fragment "+m.sn+(m.part>-1?" p: "+m.part:"")+" of level "+m.level);var Y=this.remuxer.remux(y,_,A,k,Q,z,!0,this.id);t.push({remuxResult:Y,chunkMeta:m}),m.transmuxing.executeEnd=v()},i.resetInitialTimestamp=function(t){var e=this.demuxer,m=this.remuxer;if(!e||!m)return;e.resetTimeStamp(t),m.resetTimeStamp(t)},i.resetContiguity=function(){var t=this.demuxer,e=this.remuxer;if(!t||!e)return;t.resetContiguity(),e.resetNextTimestamp()},i.resetInitSegment=function(t,e,m,y){var _=this.demuxer,A=this.remuxer;if(!_||!A)return;_.resetInitSegment(e,m,y),A.resetInitSegment(t,e,m)},i.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},i.transmux=function(t,e,m,y,_){var A;return e&&e.method==="SAMPLE-AES"?A=this.transmuxSampleAes(t,e,m,y,_):A=this.transmuxUnencrypted(t,m,y,_),A},i.transmuxUnencrypted=function(t,e,m,y){var _=this.demuxer.demux(t,e,!1,!this.config.progressive),A=_.audioTrack,k=_.avcTrack,F=_.id3Track,z=_.textTrack,Q=this.remuxer.remux(A,k,F,z,e,m,!1,this.id);return{remuxResult:Q,chunkMeta:y}},i.transmuxSampleAes=function(t,e,m,y,_){var A=this;return this.demuxer.demuxSampleAes(t,e,m).then(function(k){var F=A.remuxer.remux(k.audioTrack,k.avcTrack,k.id3Track,k.textTrack,m,y,!1,A.id);return{remuxResult:F,chunkMeta:_}})},i.configureTransmuxer=function(t,e){for(var m=this.config,y=this.observer,_=this.typeSupported,A=this.vendor,k=e.audioCodec,F=e.defaultInitPts,z=e.duration,Q=e.initSegmentData,Y=e.videoCodec,X,le=0,ye=h.length;le<ye;le++)if(h[le].demux.probe(t)){X=h[le];break}X||(b.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),X={demux:M.default,remux:T.default});var ve=this.demuxer,Ne=this.remuxer,Te=X.remux,Ce=X.demux;(!Ne||!(Ne instanceof Te))&&(this.remuxer=new Te(y,m,_,A)),(!ve||!(ve instanceof Ce))&&(this.demuxer=new Ce(y,m,_),this.probe=Ce.probe),this.resetInitSegment(Q,k,Y,z),this.resetInitialTimestamp(F)},i.needsProbing=function(t,e,m){return!this.demuxer||!this.remuxer||e||m},i.getDecrypter=function(){var t=this.decrypter;return t||(t=this.decrypter=new E.default(this.observer,this.config)),t},c}();function s(c,i){var n=null;return c.byteLength>0&&i!=null&&i.key!=null&&i.iv!==null&&i.method!=null&&(n=i),n}var f=function(i){return{remuxResult:{},chunkMeta:i}};function d(c){return"then"in c&&c.then instanceof Function}var l=function(i,n,t,e,m){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=i,this.videoCodec=n,this.initSegmentData=t,this.duration=e,this.defaultInitPts=m},p=function(i,n,t,e,m){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=i,this.contiguous=n,this.accurateTimeOffset=t,this.trackSwitch=e,this.timeOffset=m}},"./src/demux/tsdemuxer.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"discardEPB",function(){return f});var I=S("./src/demux/adts.ts"),g=S("./src/demux/mpegaudio.ts"),E=S("./src/demux/exp-golomb.ts"),U=S("./src/demux/id3.ts"),M=S("./src/demux/sample-aes.ts"),R=S("./src/events.ts"),w=S("./src/utils/mp4-tools.ts"),x=S("./src/utils/logger.ts"),T=S("./src/errors.ts"),O={video:1,audio:2,id3:3,text:4},C=function(){function d(p,c,i){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=p,this.config=c,this.typeSupported=i}d.probe=function(c){var i=d.syncOffset(c);return i<0?!1:(i&&x.logger.warn("MPEG2-TS detected but first sync word found @ offset "+i+", junk ahead ?"),!0)},d.syncOffset=function(c){for(var i=Math.min(1e3,c.length-3*188),n=0;n<i;){if(c[n]===71&&c[n+188]===71&&c[n+2*188]===71)return n;n++}return-1},d.createTrack=function(c,i){return{container:c==="video"||c==="audio"?"video/mp2t":void 0,type:c,id:O[c],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:c==="audio"?i:void 0}};var l=d.prototype;return l.resetInitSegment=function(c,i,n){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=d.createTrack("video",n),this._audioTrack=d.createTrack("audio",n),this._id3Track=d.createTrack("id3",n),this._txtTrack=d.createTrack("text",n),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=c,this.videoCodec=i,this._duration=n},l.resetTimeStamp=function(){},l.resetContiguity=function(){var c=this._audioTrack,i=this._avcTrack,n=this._id3Track;c&&(c.pesData=null),i&&(i.pesData=null),n&&(n.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},l.demux=function(c,i,n,t){n===void 0&&(n=!1),t===void 0&&(t=!1),n||(this.sampleAes=null);var e,m=this._avcTrack,y=this._audioTrack,_=this._id3Track,A=m.pid,k=m.pesData,F=y.pid,z=_.pid,Q=y.pesData,Y=_.pesData,X=!1,le=this.pmtParsed,ye=this._pmtId,ve=c.length;if(this.remainderData&&(c=Object(w.appendUint8Array)(this.remainderData,c),ve=c.length,this.remainderData=null),ve<188&&!t)return this.remainderData=c,{audioTrack:y,avcTrack:m,id3Track:_,textTrack:this._txtTrack};var Ne=Math.max(0,d.syncOffset(c));ve-=(ve+Ne)%188,ve<c.byteLength&&!t&&(this.remainderData=new Uint8Array(c.buffer,ve,c.buffer.byteLength-ve));for(var Te=Ne;Te<ve;Te+=188)if(c[Te]===71){var Ce=!!(c[Te+1]&64),_e=((c[Te+1]&31)<<8)+c[Te+2],Re=(c[Te+3]&48)>>4,he=void 0;if(Re>1){if(he=Te+5+c[Te+4],he===Te+188)continue}else he=Te+4;switch(_e){case A:Ce&&(k&&(e=r(k))&&this.parseAVCPES(e,!1),k={data:[],size:0}),k&&(k.data.push(c.subarray(he,Te+188)),k.size+=Te+188-he);break;case F:Ce&&(Q&&(e=r(Q))&&(y.isAAC?this.parseAACPES(e):this.parseMPEGPES(e)),Q={data:[],size:0}),Q&&(Q.data.push(c.subarray(he,Te+188)),Q.size+=Te+188-he);break;case z:Ce&&(Y&&(e=r(Y))&&this.parseID3PES(e),Y={data:[],size:0}),Y&&(Y.data.push(c.subarray(he,Te+188)),Y.size+=Te+188-he);break;case 0:Ce&&(he+=c[he]+1),ye=this._pmtId=v(c,he);break;case ye:{Ce&&(he+=c[he]+1);var Z=h(c,he,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,n);A=Z.avc,A>0&&(m.pid=A),F=Z.audio,F>0&&(y.pid=F,y.isAAC=Z.isAAC),z=Z.id3,z>0&&(_.pid=z),X&&!le&&(x.logger.log("reparse from beginning"),X=!1,Te=Ne-188),le=this.pmtParsed=!0;break}case 17:case 8191:break;default:X=!0;break}}else this.observer.emit(R.Events.ERROR,R.Events.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});m.pesData=k,y.pesData=Q,_.pesData=Y;var je={audioTrack:y,avcTrack:m,id3Track:_,textTrack:this._txtTrack};return t&&this.extractRemainingSamples(je),je},l.flush=function(){var c=this.remainderData;this.remainderData=null;var i;return c?i=this.demux(c,-1,!1,!0):i={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(i),this.sampleAes?this.decrypt(i,this.sampleAes):i},l.extractRemainingSamples=function(c){var i=c.audioTrack,n=c.avcTrack,t=c.id3Track,e=n.pesData,m=i.pesData,y=t.pesData,_;e&&(_=r(e))?(this.parseAVCPES(_,!0),n.pesData=null):n.pesData=e,m&&(_=r(m))?(i.isAAC?this.parseAACPES(_):this.parseMPEGPES(_),i.pesData=null):(m!=null&&m.size&&x.logger.log("last AAC PES packet truncated,might overlap between fragments"),i.pesData=m),y&&(_=r(y))?(this.parseID3PES(_),t.pesData=null):t.pesData=y},l.demuxSampleAes=function(c,i,n){var t=this.demux(c,n,!0,!this.config.progressive),e=this.sampleAes=new M.default(this.observer,this.config,i);return this.decrypt(t,e)},l.decrypt=function(c,i){return new Promise(function(n){var t=c.audioTrack,e=c.avcTrack;t.samples&&t.isAAC?i.decryptAacSamples(t.samples,0,function(){e.samples?i.decryptAvcSamples(e.samples,0,0,function(){n(c)}):n(c)}):e.samples&&i.decryptAvcSamples(e.samples,0,0,function(){n(c)})})},l.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},l.parseAVCPES=function(c,i){var n=this,t=this._avcTrack,e=this.parseAVCNALu(c.data),m=!1,y=this.avcSample,_,A=!1;c.data=null,y&&e.length&&!t.audFound&&(o(y,t),y=this.avcSample=b(!1,c.pts,c.dts,"")),e.forEach(function(k){switch(k.type){case 1:{_=!0,y||(y=n.avcSample=b(!0,c.pts,c.dts,"")),m&&(y.debug+="NDR "),y.frame=!0;var F=k.data;if(A&&F.length>4){var z=new E.default(F).readSliceType();(z===2||z===4||z===7||z===9)&&(y.key=!0)}break}case 5:_=!0,y||(y=n.avcSample=b(!0,c.pts,c.dts,"")),m&&(y.debug+="IDR "),y.key=!0,y.frame=!0;break;case 6:{_=!0,m&&y&&(y.debug+="SEI ");var Q=new E.default(f(k.data));Q.readUByte();for(var Y=0,X=0,le=!1,ye=0;!le&&Q.bytesAvailable>1;){Y=0;do ye=Q.readUByte(),Y+=ye;while(ye===255);X=0;do ye=Q.readUByte(),X+=ye;while(ye===255);if(Y===4&&Q.bytesAvailable!==0){le=!0;var ve=Q.readUByte();if(ve===181){var Ne=Q.readUShort();if(Ne===49){var Te=Q.readUInt();if(Te===1195456820){var Ce=Q.readUByte();if(Ce===3){for(var _e=Q.readUByte(),Re=Q.readUByte(),he=31&_e,Z=[_e,Re],je=0;je<he;je++)Z.push(Q.readUByte()),Z.push(Q.readUByte()),Z.push(Q.readUByte());s(n._txtTrack.samples,{type:3,pts:c.pts,bytes:Z})}}}}}else if(Y===5&&Q.bytesAvailable!==0){if(le=!0,X>16){for(var lt=[],nt=0;nt<16;nt++)lt.push(Q.readUByte().toString(16)),(nt===3||nt===5||nt===7||nt===9)&&lt.push("-");for(var Ke=X-16,Ge=new Uint8Array(Ke),Pe=0;Pe<Ke;Pe++)Ge[Pe]=Q.readUByte();s(n._txtTrack.samples,{pts:c.pts,payloadType:Y,uuid:lt.join(""),userData:Object(U.utf8ArrayToStr)(Ge),userDataBytes:Ge})}}else if(X<Q.bytesAvailable)for(var We=0;We<X;We++)Q.readUByte()}break}case 7:if(_=!0,A=!0,m&&y&&(y.debug+="SPS "),!t.sps){var Qe=new E.default(k.data),Ze=Qe.readSPS();t.width=Ze.width,t.height=Ze.height,t.pixelRatio=Ze.pixelRatio,t.sps=[k.data],t.duration=n._duration;for(var $e=k.data.subarray(1,4),Ue="avc1.",Fe=0;Fe<3;Fe++){var ct=$e[Fe].toString(16);ct.length<2&&(ct="0"+ct),Ue+=ct}t.codec=Ue}break;case 8:_=!0,m&&y&&(y.debug+="PPS "),t.pps||(t.pps=[k.data]);break;case 9:_=!1,t.audFound=!0,y&&o(y,t),y=n.avcSample=b(!1,c.pts,c.dts,m?"AUD ":"");break;case 12:_=!1;break;default:_=!1,y&&(y.debug+="unknown NAL "+k.type+" ");break}if(y&&_){var ot=y.units;ot.push(k)}}),i&&y&&(o(y,t),this.avcSample=null)},l.getLastNalUnit=function(){var c,i=this.avcSample,n;if(!i||i.units.length===0){var t=this._avcTrack.samples;i=t[t.length-1]}if((c=i)!==null&&c!==void 0&&c.units){var e=i.units;n=e[e.length-1]}return n},l.parseAVCNALu=function(c){var i=c.byteLength,n=this._avcTrack,t=n.naluState||0,e=t,m=[],y=0,_,A,k,F=-1,z=0;for(t===-1&&(F=0,z=c[0]&31,t=0,y=1);y<i;){if(_=c[y++],!t){t=_?0:1;continue}if(t===1){t=_?0:2;continue}if(!_)t=3;else if(_===1){if(F>=0){var Q={data:c.subarray(F,y-t-1),type:z};m.push(Q)}else{var Y=this.getLastNalUnit();if(Y&&(e&&y<=4-e&&(Y.state&&(Y.data=Y.data.subarray(0,Y.data.byteLength-e))),A=y-t-1,A>0)){var X=new Uint8Array(Y.data.byteLength+A);X.set(Y.data,0),X.set(c.subarray(0,A),Y.data.byteLength),Y.data=X,Y.state=0}}y<i?(k=c[y]&31,F=y,z=k,t=0):t=-1}else t=0}if(F>=0&&t>=0){var le={data:c.subarray(F,i),type:z,state:t};m.push(le)}if(m.length===0){var ye=this.getLastNalUnit();if(ye){var ve=new Uint8Array(ye.data.byteLength+c.byteLength);ve.set(ye.data,0),ve.set(c,ye.data.byteLength),ye.data=ve}}return n.naluState=t,m},l.parseAACPES=function(c){var i=0,n=this._audioTrack,t=this.aacOverFlow,e=c.data;if(t){this.aacOverFlow=null;var m=t.sample.unit.byteLength,y=Math.min(t.missing,m),_=m-y;t.sample.unit.set(e.subarray(0,y),_),n.samples.push(t.sample),i=t.missing}var A,k;for(A=i,k=e.length;A<k-1&&!I.isHeader(e,A);A++);if(A!==i){var F,z;if(A<k-1?(F="AAC PES did not start with ADTS header,offset:"+A,z=!1):(F="no ADTS header found in AAC PES",z=!0),x.logger.warn("parsing error:"+F),this.observer.emit(R.Events.ERROR,R.Events.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.FRAG_PARSING_ERROR,fatal:z,reason:F}),z)return}I.initTrackConfig(n,this.observer,e,A,this.audioCodec);var Q;if(c.pts!==void 0)Q=c.pts;else if(t){var Y=I.getFrameDuration(n.samplerate);Q=t.sample.pts+Y}else{x.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var X=0;A<k;)if(I.isHeader(e,A)){if(A+5<k){var le=I.appendFrame(n,e,A,Q,X);if(le)if(le.missing)this.aacOverFlow=le;else{A+=le.length,X++;continue}}break}else A++},l.parseMPEGPES=function(c){var i=c.data,n=i.length,t=0,e=0,m=c.pts;if(m===void 0){x.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;e<n;)if(g.isHeader(i,e)){var y=g.appendFrame(this._audioTrack,i,e,m,t);if(y)e+=y.length,t++;else break}else e++},l.parseID3PES=function(c){if(c.pts===void 0){x.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(c)},d}();C.minProbeByteLength=188;function b(d,l,p,c){return{key:d,frame:!1,pts:l,dts:p,units:[],debug:c,length:0}}function v(d,l){return(d[l+10]&31)<<8|d[l+11]}function h(d,l,p,c){var i={audio:-1,avc:-1,id3:-1,isAAC:!0},n=(d[l+1]&15)<<8|d[l+2],t=l+3+n-4,e=(d[l+10]&15)<<8|d[l+11];for(l+=12+e;l<t;){var m=(d[l+1]&31)<<8|d[l+2];switch(d[l]){case 207:if(!c){x.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:i.audio===-1&&(i.audio=m);break;case 21:i.id3===-1&&(i.id3=m);break;case 219:if(!c){x.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:i.avc===-1&&(i.avc=m);break;case 3:case 4:p?i.audio===-1&&(i.audio=m,i.isAAC=!1):x.logger.log("MPEG audio found, not supported in this browser");break;case 36:x.logger.warn("Unsupported HEVC stream type found");break;default:break}l+=((d[l+3]&15)<<8|d[l+4])+5}return i}function r(d){var l=0,p,c,i,n,t,e=d.data;if(!d||d.size===0)return null;for(;e[0].length<19&&e.length>1;){var m=new Uint8Array(e[0].length+e[1].length);m.set(e[0]),m.set(e[1],e[0].length),e[0]=m,e.splice(1,1)}p=e[0];var y=(p[0]<<16)+(p[1]<<8)+p[2];if(y===1){if(c=(p[4]<<8)+p[5],c&&c>d.size-6)return null;var _=p[7];_&192&&(n=(p[9]&14)*536870912+(p[10]&255)*4194304+(p[11]&254)*16384+(p[12]&255)*128+(p[13]&254)/2,_&64?(t=(p[14]&14)*536870912+(p[15]&255)*4194304+(p[16]&254)*16384+(p[17]&255)*128+(p[18]&254)/2,n-t>60*9e4&&(x.logger.warn(Math.round((n-t)/9e4)+"s delta between PTS and DTS, align them"),n=t)):t=n),i=p[8];var A=i+9;if(d.size<=A)return null;d.size-=A;for(var k=new Uint8Array(d.size),F=0,z=e.length;F<z;F++){p=e[F];var Q=p.byteLength;if(A)if(A>Q){A-=Q;continue}else p=p.subarray(A),Q-=A,A=0;k.set(p,l),l+=Q}return c&&(c-=i+3),{data:k,pts:n,dts:t,len:c}}return null}function o(d,l){if(d.units.length&&d.frame){if(d.pts===void 0){var p=l.samples,c=p.length;if(c){var i=p[c-1];d.pts=i.pts,d.dts=i.dts}else{l.dropped++;return}}l.samples.push(d)}d.debug.length&&x.logger.log(d.pts+"/"+d.dts+":"+d.debug)}function s(d,l){var p=d.length;if(p>0){if(l.pts>=d[p-1].pts)d.push(l);else for(var c=p-1;c>=0;c--)if(l.pts<d[c].pts){d.splice(c,0,l);break}}else d.push(l)}function f(d){for(var l=d.byteLength,p=[],c=1;c<l-2;)d[c]===0&&d[c+1]===0&&d[c+2]===3?(p.push(c+2),c+=2):c++;if(p.length===0)return d;var i=l-p.length,n=new Uint8Array(i),t=0;for(c=0;c<i;t++,c++)t===p[0]&&(t++,p.shift()),n[c]=d[t];return n}N.default=C},"./src/errors.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"ErrorTypes",function(){return I}),S.d(N,"ErrorDetails",function(){return g});var I;(function(E){E.NETWORK_ERROR="networkError",E.MEDIA_ERROR="mediaError",E.KEY_SYSTEM_ERROR="keySystemError",E.MUX_ERROR="muxError",E.OTHER_ERROR="otherError"})(I||(I={}));var g;(function(E){E.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",E.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",E.KEY_SYSTEM_NO_SESSION="keySystemNoSession",E.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",E.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",E.MANIFEST_LOAD_ERROR="manifestLoadError",E.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",E.MANIFEST_PARSING_ERROR="manifestParsingError",E.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",E.LEVEL_EMPTY_ERROR="levelEmptyError",E.LEVEL_LOAD_ERROR="levelLoadError",E.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",E.LEVEL_SWITCH_ERROR="levelSwitchError",E.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",E.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",E.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",E.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",E.FRAG_LOAD_ERROR="fragLoadError",E.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",E.FRAG_DECRYPT_ERROR="fragDecryptError",E.FRAG_PARSING_ERROR="fragParsingError",E.REMUX_ALLOC_ERROR="remuxAllocError",E.KEY_LOAD_ERROR="keyLoadError",E.KEY_LOAD_TIMEOUT="keyLoadTimeOut",E.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",E.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",E.BUFFER_APPEND_ERROR="bufferAppendError",E.BUFFER_APPENDING_ERROR="bufferAppendingError",E.BUFFER_STALLED_ERROR="bufferStalledError",E.BUFFER_FULL_ERROR="bufferFullError",E.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",E.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",E.INTERNAL_EXCEPTION="internalException",E.INTERNAL_ABORTED="aborted",E.UNKNOWN="unknown"})(g||(g={}))},"./src/events.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"Events",function(){return I});var I;(function(g){g.MEDIA_ATTACHING="hlsMediaAttaching",g.MEDIA_ATTACHED="hlsMediaAttached",g.MEDIA_DETACHING="hlsMediaDetaching",g.MEDIA_DETACHED="hlsMediaDetached",g.BUFFER_RESET="hlsBufferReset",g.BUFFER_CODECS="hlsBufferCodecs",g.BUFFER_CREATED="hlsBufferCreated",g.BUFFER_APPENDING="hlsBufferAppending",g.BUFFER_APPENDED="hlsBufferAppended",g.BUFFER_EOS="hlsBufferEos",g.BUFFER_FLUSHING="hlsBufferFlushing",g.BUFFER_FLUSHED="hlsBufferFlushed",g.MANIFEST_LOADING="hlsManifestLoading",g.MANIFEST_LOADED="hlsManifestLoaded",g.MANIFEST_PARSED="hlsManifestParsed",g.LEVEL_SWITCHING="hlsLevelSwitching",g.LEVEL_SWITCHED="hlsLevelSwitched",g.LEVEL_LOADING="hlsLevelLoading",g.LEVEL_LOADED="hlsLevelLoaded",g.LEVEL_UPDATED="hlsLevelUpdated",g.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",g.LEVELS_UPDATED="hlsLevelsUpdated",g.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",g.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",g.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",g.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",g.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",g.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",g.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",g.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",g.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",g.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",g.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",g.CUES_PARSED="hlsCuesParsed",g.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",g.INIT_PTS_FOUND="hlsInitPtsFound",g.FRAG_LOADING="hlsFragLoading",g.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",g.FRAG_LOADED="hlsFragLoaded",g.FRAG_DECRYPTED="hlsFragDecrypted",g.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",g.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",g.FRAG_PARSING_METADATA="hlsFragParsingMetadata",g.FRAG_PARSED="hlsFragParsed",g.FRAG_BUFFERED="hlsFragBuffered",g.FRAG_CHANGED="hlsFragChanged",g.FPS_DROP="hlsFpsDrop",g.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",g.ERROR="hlsError",g.DESTROYING="hlsDestroying",g.KEY_LOADING="hlsKeyLoading",g.KEY_LOADED="hlsKeyLoaded",g.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",g.BACK_BUFFER_REACHED="hlsBackBufferReached"})(I||(I={}))},"./src/hls.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return d});var I=S("./node_modules/url-toolkit/src/url-toolkit.js"),g=S.n(I),E=S("./src/loader/playlist-loader.ts"),U=S("./src/loader/key-loader.ts"),M=S("./src/controller/id3-track-controller.ts"),R=S("./src/controller/latency-controller.ts"),w=S("./src/controller/level-controller.ts"),x=S("./src/controller/fragment-tracker.ts"),T=S("./src/controller/stream-controller.ts"),O=S("./src/is-supported.ts"),C=S("./src/utils/logger.ts"),b=S("./src/config.ts"),v=S("./node_modules/eventemitter3/index.js"),h=S.n(v),r=S("./src/events.ts"),o=S("./src/errors.ts");function s(l,p){for(var c=0;c<p.length;c++){var i=p[c];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(l,i.key,i)}}function f(l,p,c){return p&&s(l.prototype,p),c&&s(l,c),l}var d=function(){l.isSupported=function(){return Object(O.isSupported)()};function l(c){c===void 0&&(c={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new v.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 i=this.config=Object(b.mergeConfig)(l.DefaultConfig,c);this.userConfig=c,Object(C.enableLogs)(i.debug),this._autoLevelCapping=-1,i.progressive&&Object(b.enableStreamingMode)(i);var n=i.abrController,t=i.bufferController,e=i.capLevelController,m=i.fpsController,y=this.abrController=new n(this),_=this.bufferController=new t(this),A=this.capLevelController=new e(this),k=new m(this),F=new E.default(this),z=new U.default(this),Q=new M.default(this),Y=this.levelController=new w.default(this),X=new x.FragmentTracker(this),le=this.streamController=new T.default(this,X);A.setStreamController(le),k.setStreamController(le);var ye=[Y,le];this.networkControllers=ye;var ve=[F,z,y,_,A,k,Q,X];this.audioTrackController=this.createController(i.audioTrackController,null,ye),this.createController(i.audioStreamController,X,ye),this.subtitleTrackController=this.createController(i.subtitleTrackController,null,ye),this.createController(i.subtitleStreamController,X,ye),this.createController(i.timelineController,null,ve),this.emeController=this.createController(i.emeController,null,ve),this.cmcdController=this.createController(i.cmcdController,null,ve),this.latencyController=this.createController(R.default,null,ve),this.coreComponents=ve}var p=l.prototype;return p.createController=function(i,n,t){if(i){var e=n?new i(this,n):new i(this);return t&&t.push(e),e}return null},p.on=function(i,n,t){t===void 0&&(t=this),this._emitter.on(i,n,t)},p.once=function(i,n,t){t===void 0&&(t=this),this._emitter.once(i,n,t)},p.removeAllListeners=function(i){this._emitter.removeAllListeners(i)},p.off=function(i,n,t,e){t===void 0&&(t=this),this._emitter.off(i,n,t,e)},p.listeners=function(i){return this._emitter.listeners(i)},p.emit=function(i,n,t){return this._emitter.emit(i,n,t)},p.trigger=function(i,n){if(this.config.debug)return this.emit(i,i,n);try{return this.emit(i,i,n)}catch(t){C.logger.error("An internal error happened while handling event "+i+'. Error message: "'+t.message+'". Here is a stacktrace:',t),this.trigger(r.Events.ERROR,{type:o.ErrorTypes.OTHER_ERROR,details:o.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:i,error:t})}return!1},p.listenerCount=function(i){return this._emitter.listenerCount(i)},p.destroy=function(){C.logger.log("destroy"),this.trigger(r.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(i){return i.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(i){return i.destroy()}),this.coreComponents.length=0},p.attachMedia=function(i){C.logger.log("attachMedia"),this._media=i,this.trigger(r.Events.MEDIA_ATTACHING,{media:i})},p.detachMedia=function(){C.logger.log("detachMedia"),this.trigger(r.Events.MEDIA_DETACHING,void 0),this._media=null},p.loadSource=function(i){this.stopLoad();var n=this.media,t=this.url,e=this.url=I.buildAbsoluteURL(self.location.href,i,{alwaysNormalize:!0});C.logger.log("loadSource:"+e),n&&t&&t!==e&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(n)),this.trigger(r.Events.MANIFEST_LOADING,{url:i})},p.startLoad=function(i){i===void 0&&(i=-1),C.logger.log("startLoad("+i+")"),this.networkControllers.forEach(function(n){n.startLoad(i)})},p.stopLoad=function(){C.logger.log("stopLoad"),this.networkControllers.forEach(function(i){i.stopLoad()})},p.swapAudioCodec=function(){C.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},p.recoverMediaError=function(){C.logger.log("recoverMediaError");var i=this._media;this.detachMedia(),i&&this.attachMedia(i)},p.removeLevel=function(i,n){n===void 0&&(n=0),this.levelController.removeLevel(i,n)},f(l,[{key:"levels",get:function(){var i=this.levelController.levels;return i||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(i){C.logger.log("set currentLevel:"+i),this.loadLevel=i,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(i){C.logger.log("set nextLevel:"+i),this.levelController.manualLevel=i,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(i){C.logger.log("set loadLevel:"+i),this.levelController.manualLevel=i}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(i){this.levelController.nextLoadLevel=i}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(i){C.logger.log("set firstLevel:"+i),this.levelController.firstLevel=i}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(i){C.logger.log("set startLevel:"+i),i!==-1&&(i=Math.max(i,this.minAutoLevel)),this.levelController.startLevel=i}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(i){var n=!!i;n!==this.config.capLevelToPlayerSize&&(n?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=n)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(i){this._autoLevelCapping!==i&&(C.logger.log("set autoLevelCapping:"+i),this._autoLevelCapping=i)}},{key:"bandwidthEstimate",get:function(){var i=this.abrController.bwEstimator;return i?i.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var i=this.levels,n=this.config.minAutoBitrate;if(!i)return 0;for(var t=i.length,e=0;e<t;e++)if(i[e].maxBitrate>n)return e;return 0}},{key:"maxAutoLevel",get:function(){var i=this.levels,n=this.autoLevelCapping,t;return n===-1&&i&&i.length?t=i.length-1:t=n,t}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(i){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,i)}},{key:"audioTracks",get:function(){var i=this.audioTrackController;return i?i.audioTracks:[]}},{key:"audioTrack",get:function(){var i=this.audioTrackController;return i?i.audioTrack:-1},set:function(i){var n=this.audioTrackController;n&&(n.audioTrack=i)}},{key:"subtitleTracks",get:function(){var i=this.subtitleTrackController;return i?i.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var i=this.subtitleTrackController;return i?i.subtitleTrack:-1},set:function(i){var n=this.subtitleTrackController;n&&(n.subtitleTrack=i)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var i=this.subtitleTrackController;return i?i.subtitleDisplay:!1},set:function(i){var n=this.subtitleTrackController;n&&(n.subtitleDisplay=i)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(i){this.config.lowLatencyMode=i}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return r.Events}},{key:"ErrorTypes",get:function(){return o.ErrorTypes}},{key:"ErrorDetails",get:function(){return o.ErrorDetails}},{key:"DefaultConfig",get:function(){return l.defaultConfig?l.defaultConfig:b.hlsDefaultConfig},set:function(i){l.defaultConfig=i}}]),l}();d.defaultConfig=void 0},"./src/is-supported.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"isSupported",function(){return E}),S.d(N,"changeTypeSupported",function(){return U});var I=S("./src/utils/mediasource-helper.ts");function g(){return self.SourceBuffer||self.WebKitSourceBuffer}function E(){var M=Object(I.getMediaSource)();if(!M)return!1;var R=g(),w=M&&typeof M.isTypeSupported=="function"&&M.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),x=!R||R.prototype&&typeof R.prototype.appendBuffer=="function"&&typeof R.prototype.remove=="function";return!!w&&!!x}function U(){var M,R=g();return typeof(R==null||((M=R.prototype)===null||M===void 0)?void 0:M.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return C}),S.d(N,"LoadError",function(){return v});var I=S("./src/polyfills/number.ts"),g=S("./src/errors.ts");function E(h,r){h.prototype=Object.create(r.prototype),h.prototype.constructor=h,x(h,r)}function U(h){var r=typeof Map=="function"?new Map:void 0;return U=function(s){if(s===null||!w(s))return s;if(typeof s!="function")throw new TypeError("Super expression must either be null or a function");if(typeof r!="undefined"){if(r.has(s))return r.get(s);r.set(s,f)}function f(){return M(s,arguments,T(this).constructor)}return f.prototype=Object.create(s.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),x(f,s)},U(h)}function M(h,r,o){return R()?M=Reflect.construct:M=function(f,d,l){var p=[null];p.push.apply(p,d);var c=Function.bind.apply(f,p),i=new c;return l&&x(i,l.prototype),i},M.apply(null,arguments)}function R(){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(h){return!1}}function w(h){return Function.toString.call(h).indexOf("[native code]")!==-1}function x(h,r){return x=Object.setPrototypeOf||function(s,f){return s.__proto__=f,s},x(h,r)}function T(h){return T=Object.setPrototypeOf?Object.getPrototypeOf:function(o){return o.__proto__||Object.getPrototypeOf(o)},T(h)}var O=Math.pow(2,17),C=function(){function h(o){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=o}var r=h.prototype;return r.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},r.abort=function(){this.loader&&this.loader.abort()},r.load=function(s,f){var d=this,l=s.url;if(!l)return Promise.reject(new v({type:g.ErrorTypes.NETWORK_ERROR,details:g.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,networkDetails:null},"Fragment does not have a "+(l?"part list":"url")));this.abort();var p=this.config,c=p.fLoader,i=p.loader;return new Promise(function(n,t){d.loader&&d.loader.destroy();var e=d.loader=s.loader=c?new c(p):new i(p),m=b(s),y={timeout:p.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:p.fragLoadingMaxRetryTimeout,highWaterMark:O};s.stats=e.stats,e.load(m,y,{onSuccess:function(A,k,F,z){d.resetLoader(s,e),n({frag:s,part:null,payload:A.data,networkDetails:z})},onError:function(A,k,F){d.resetLoader(s,e),t(new v({type:g.ErrorTypes.NETWORK_ERROR,details:g.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,response:A,networkDetails:F}))},onAbort:function(A,k,F){d.resetLoader(s,e),t(new v({type:g.ErrorTypes.NETWORK_ERROR,details:g.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:s,networkDetails:F}))},onTimeout:function(A,k,F){d.resetLoader(s,e),t(new v({type:g.ErrorTypes.NETWORK_ERROR,details:g.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:s,networkDetails:F}))},onProgress:function(A,k,F,z){f&&f({frag:s,part:null,payload:F,networkDetails:z})}})})},r.loadPart=function(s,f,d){var l=this;this.abort();var p=this.config,c=p.fLoader,i=p.loader;return new Promise(function(n,t){l.loader&&l.loader.destroy();var e=l.loader=s.loader=c?new c(p):new i(p),m=b(s,f),y={timeout:p.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:p.fragLoadingMaxRetryTimeout,highWaterMark:O};f.stats=e.stats,e.load(m,y,{onSuccess:function(A,k,F,z){l.resetLoader(s,e),l.updateStatsFromPart(s,f);var Q={frag:s,part:f,payload:A.data,networkDetails:z};d(Q),n(Q)},onError:function(A,k,F){l.resetLoader(s,e),t(new v({type:g.ErrorTypes.NETWORK_ERROR,details:g.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,part:f,response:A,networkDetails:F}))},onAbort:function(A,k,F){s.stats.aborted=f.stats.aborted,l.resetLoader(s,e),t(new v({type:g.ErrorTypes.NETWORK_ERROR,details:g.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:s,part:f,networkDetails:F}))},onTimeout:function(A,k,F){l.resetLoader(s,e),t(new v({type:g.ErrorTypes.NETWORK_ERROR,details:g.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:s,part:f,networkDetails:F}))}})})},r.updateStatsFromPart=function(s,f){var d=s.stats,l=f.stats,p=l.total;if(d.loaded+=l.loaded,p){var c=Math.round(s.duration/f.duration),i=Math.min(Math.round(d.loaded/p),c),n=c-i,t=n*Math.round(d.loaded/i);d.total=d.loaded+t}else d.total=Math.max(d.loaded,d.total);var e=d.loading,m=l.loading;e.start?e.first+=m.first-m.start:(e.start=m.start,e.first=m.first),e.end=m.end},r.resetLoader=function(s,f){s.loader=null,this.loader===f&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),f.destroy()},h}();function b(h,r){r===void 0&&(r=null);var o=r||h,s={frag:h,part:r,responseType:"arraybuffer",url:o.url,headers:{},rangeStart:0,rangeEnd:0},f=o.byteRangeStartOffset,d=o.byteRangeEndOffset;return Object(I.isFiniteNumber)(f)&&Object(I.isFiniteNumber)(d)&&(s.rangeStart=f,s.rangeEnd=d),s}var v=function(h){E(r,h);function r(o){for(var s,f=arguments.length,d=new Array(f>1?f-1:0),l=1;l<f;l++)d[l-1]=arguments[l];return s=h.call.apply(h,[this].concat(d))||this,s.data=void 0,s.data=o,s}return r}(U(Error))},"./src/loader/fragment.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"ElementaryStreamTypes",function(){return C}),S.d(N,"BaseSegment",function(){return b}),S.d(N,"Fragment",function(){return v}),S.d(N,"Part",function(){return h});var I=S("./src/polyfills/number.ts"),g=S("./node_modules/url-toolkit/src/url-toolkit.js"),E=S.n(g),U=S("./src/utils/logger.ts"),M=S("./src/loader/level-key.ts"),R=S("./src/loader/load-stats.ts");function w(r,o){r.prototype=Object.create(o.prototype),r.prototype.constructor=r,x(r,o)}function x(r,o){return x=Object.setPrototypeOf||function(f,d){return f.__proto__=d,f},x(r,o)}function T(r,o){for(var s=0;s<o.length;s++){var f=o[s];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(r,f.key,f)}}function O(r,o,s){return o&&T(r.prototype,o),s&&T(r,s),r}var C;(function(r){r.AUDIO="audio",r.VIDEO="video",r.AUDIOVIDEO="audiovideo"})(C||(C={}));var b=function(){function r(s){var f;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(f={},f[C.AUDIO]=null,f[C.VIDEO]=null,f[C.AUDIOVIDEO]=null,f),this.baseurl=s}var o=r.prototype;return o.setByteRange=function(f,d){var l=f.split("@",2),p=[];l.length===1?p[0]=d?d.byteRangeEndOffset:0:p[0]=parseInt(l[1]),p[1]=parseInt(l[0])+p[0],this._byteRange=p},O(r,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(g.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(f){this._url=f}}]),r}(),v=function(r){w(o,r);function o(f,d){var l;return l=r.call(this,d)||this,l._decryptdata=null,l.rawProgramDateTime=null,l.programDateTime=null,l.tagList=[],l.duration=0,l.sn=0,l.levelkey=void 0,l.type=void 0,l.loader=null,l.level=-1,l.cc=0,l.startPTS=void 0,l.endPTS=void 0,l.appendedPTS=void 0,l.startDTS=void 0,l.endDTS=void 0,l.start=0,l.deltaPTS=void 0,l.maxStartPTS=void 0,l.minEndPTS=void 0,l.stats=new R.LoadStats,l.urlId=0,l.data=void 0,l.bitrateTest=!1,l.title=null,l.initSegment=null,l.type=f,l}var s=o.prototype;return s.createInitializationVector=function(d){for(var l=new Uint8Array(16),p=12;p<16;p++)l[p]=d>>8*(15-p)&255;return l},s.setDecryptDataFromLevelKey=function(d,l){var p=d;return(d==null?void 0:d.method)==="AES-128"&&d.uri&&!d.iv&&(p=M.LevelKey.fromURI(d.uri),p.method=d.method,p.iv=this.createInitializationVector(l),p.keyFormat="identity"),p},s.setElementaryStreamInfo=function(d,l,p,c,i,n){n===void 0&&(n=!1);var t=this.elementaryStreams,e=t[d];if(!e){t[d]={startPTS:l,endPTS:p,startDTS:c,endDTS:i,partial:n};return}e.startPTS=Math.min(e.startPTS,l),e.endPTS=Math.max(e.endPTS,p),e.startDTS=Math.min(e.startDTS,c),e.endDTS=Math.max(e.endDTS,i)},s.clearElementaryStreamInfo=function(){var d=this.elementaryStreams;d[C.AUDIO]=null,d[C.VIDEO]=null,d[C.AUDIOVIDEO]=null},O(o,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var d=this.sn;typeof d!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&U.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),d=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,d)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(I.isFiniteNumber)(this.programDateTime))return null;var d=Object(I.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+d*1e3}},{key:"encrypted",get:function(){var d;return!!((d=this.decryptdata)!==null&&d!==void 0&&d.keyFormat&&this.decryptdata.uri)}}]),o}(b),h=function(r){w(o,r);function o(s,f,d,l,p){var c;c=r.call(this,d)||this,c.fragOffset=0,c.duration=0,c.gap=!1,c.independent=!1,c.relurl=void 0,c.fragment=void 0,c.index=void 0,c.stats=new R.LoadStats,c.duration=s.decimalFloatingPoint("DURATION"),c.gap=s.bool("GAP"),c.independent=s.bool("INDEPENDENT"),c.relurl=s.enumeratedString("URI"),c.fragment=f,c.index=l;var i=s.enumeratedString("BYTERANGE");return i&&c.setByteRange(i,p),p&&(c.fragOffset=p.fragOffset+p.duration),c}return O(o,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var f=this.elementaryStreams;return!!(f.audio||f.video||f.audiovideo)}}]),o}(b)},"./src/loader/key-loader.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return U});var I=S("./src/events.ts"),g=S("./src/errors.ts"),E=S("./src/utils/logger.ts"),U=function(){function M(w){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=w,this._registerListeners()}var R=M.prototype;return R._registerListeners=function(){this.hls.on(I.Events.KEY_LOADING,this.onKeyLoading,this)},R._unregisterListeners=function(){this.hls.off(I.Events.KEY_LOADING,this.onKeyLoading)},R.destroy=function(){this._unregisterListeners();for(var x in this.loaders){var T=this.loaders[x];T&&T.destroy()}this.loaders={}},R.onKeyLoading=function(x,T){var O=T.frag,C=O.type,b=this.loaders[C];if(!O.decryptdata){E.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var v=O.decryptdata.uri;if(v!==this.decrypturl||this.decryptkey===null){var h=this.hls.config;if(b&&(E.logger.warn("abort previous key loader for type:"+C),b.abort()),!v){E.logger.warn("key uri is falsy");return}var r=h.loader,o=O.loader=this.loaders[C]=new r(h);this.decrypturl=v,this.decryptkey=null;var s={url:v,frag:O,responseType:"arraybuffer"},f={timeout:h.fragLoadingTimeOut,maxRetry:0,retryDelay:h.fragLoadingRetryDelay,maxRetryDelay:h.fragLoadingMaxRetryTimeout,highWaterMark:0},d={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};o.load(s,f,d)}else this.decryptkey&&(O.decryptdata.key=this.decryptkey,this.hls.trigger(I.Events.KEY_LOADED,{frag:O}))},R.loadsuccess=function(x,T,O){var C=O.frag;if(!C.decryptdata){E.logger.error("after key load, decryptdata unset");return}this.decryptkey=C.decryptdata.key=new Uint8Array(x.data),C.loader=null,delete this.loaders[C.type],this.hls.trigger(I.Events.KEY_LOADED,{frag:C})},R.loaderror=function(x,T){var O=T.frag,C=O.loader;C&&C.abort(),delete this.loaders[O.type],this.hls.trigger(I.Events.ERROR,{type:g.ErrorTypes.NETWORK_ERROR,details:g.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:O,response:x})},R.loadtimeout=function(x,T){var O=T.frag,C=O.loader;C&&C.abort(),delete this.loaders[O.type],this.hls.trigger(I.Events.ERROR,{type:g.ErrorTypes.NETWORK_ERROR,details:g.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:O})},M}()},"./src/loader/level-details.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"LevelDetails",function(){return M});var I=S("./src/polyfills/number.ts");function g(R,w){for(var x=0;x<w.length;x++){var T=w[x];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(R,T.key,T)}}function E(R,w,x){return w&&g(R.prototype,w),x&&g(R,x),R}var U=10,M=function(){function R(x){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=x}var w=R.prototype;return w.reloaded=function(T){if(!T){this.advanced=!0,this.updated=!0;return}var O=this.lastPartSn-T.lastPartSn,C=this.lastPartIndex-T.lastPartIndex;this.updated=this.endSN!==T.endSN||!!C||!!O,this.advanced=this.endSN>T.endSN||O>0||O===0&&C>0,this.updated||this.advanced?this.misses=Math.floor(T.misses*.6):this.misses=T.misses+1,this.availabilityDelay=T.availabilityDelay},E(R,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(I.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||U}},{key:"drift",get:function(){var T=this.driftEndTime-this.driftStartTime;if(T>0){var O=this.driftEnd-this.driftStart;return O*1e3/T}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var T;return(T=this.fragments)!==null&&T!==void 0&&T.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 T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),R}()},"./src/loader/level-key.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"LevelKey",function(){return M});var I=S("./node_modules/url-toolkit/src/url-toolkit.js"),g=S.n(I);function E(R,w){for(var x=0;x<w.length;x++){var T=w[x];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(R,T.key,T)}}function U(R,w,x){return w&&E(R.prototype,w),x&&E(R,x),R}var M=function(){R.fromURL=function(x,T){return new R(x,T)},R.fromURI=function(x){return new R(x)};function R(w,x){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,x?this._uri=Object(I.buildAbsoluteURL)(w,x,{alwaysNormalize:!0}):this._uri=w}return U(R,[{key:"uri",get:function(){return this._uri}}]),R}()},"./src/loader/load-stats.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"LoadStats",function(){return I});var I=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(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return o});var I=S("./src/polyfills/number.ts"),g=S("./node_modules/url-toolkit/src/url-toolkit.js"),E=S.n(g),U=S("./src/loader/fragment.ts"),M=S("./src/loader/level-details.ts"),R=S("./src/loader/level-key.ts"),w=S("./src/utils/attr-list.ts"),x=S("./src/utils/logger.ts"),T=S("./src/utils/codecs.ts"),O=/#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,b=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),v=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("|")),h=/\.(mp4|m4s|m4v|m4a)$/i;function r(p){var c,i;return h.test((c=(i=g.parseURL(p))===null||i===void 0?void 0:i.path)!=null?c:"")}var o=function(){function p(){}return p.findGroup=function(i,n){for(var t=0;t<i.length;t++){var e=i[t];if(e.id===n)return e}},p.convertAVC1ToAVCOTI=function(i){var n=i.split(".");if(n.length>2){var t=n.shift()+".";return t+=parseInt(n.shift()).toString(16),t+=("000"+parseInt(n.shift()).toString(16)).substr(-4),t}return i},p.resolve=function(i,n){return g.buildAbsoluteURL(n,i,{alwaysNormalize:!0})},p.parseMasterPlaylist=function(i,n){var t=[],e={},m=!1;O.lastIndex=0;for(var y;(y=O.exec(i))!=null;)if(y[1]){var _=new w.AttrList(y[1]),A={attrs:_,bitrate:_.decimalInteger("AVERAGE-BANDWIDTH")||_.decimalInteger("BANDWIDTH"),name:_.NAME,url:p.resolve(y[2],n)},k=_.decimalResolution("RESOLUTION");k&&(A.width=k.width,A.height=k.height),s((_.CODECS||"").split(/[ ,]+/).filter(function(z){return z}),A),A.videoCodec&&A.videoCodec.indexOf("avc1")!==-1&&(A.videoCodec=p.convertAVC1ToAVCOTI(A.videoCodec)),t.push(A)}else if(y[3]){var F=new w.AttrList(y[3]);F["DATA-ID"]&&(m=!0,e[F["DATA-ID"]]=F)}return{levels:t,sessionData:m?e:null}},p.parseMasterPlaylistMedia=function(i,n,t,e){e===void 0&&(e=[]);var m,y=[],_=0;for(C.lastIndex=0;(m=C.exec(i))!==null;){var A=new w.AttrList(m[1]);if(A.TYPE===t){var k={attrs:A,bitrate:0,id:_++,groupId:A["GROUP-ID"],instreamId:A["INSTREAM-ID"],name:A.NAME||A.LANGUAGE||"",type:t,default:A.bool("DEFAULT"),autoselect:A.bool("AUTOSELECT"),forced:A.bool("FORCED"),lang:A.LANGUAGE,url:A.URI?p.resolve(A.URI,n):""};if(e.length){var F=p.findGroup(e,k.groupId)||e[0];f(k,F,"audioCodec"),f(k,F,"textCodec")}y.push(k)}}return y},p.parseLevelPlaylist=function(i,n,t,e,m){var y=new M.LevelDetails(n),_=y.fragments,A=null,k=0,F=0,z=0,Q=0,Y=null,X=new U.Fragment(e,n),le,ye,ve,Ne=-1,Te=!1;for(b.lastIndex=0,y.m3u8=i;(le=b.exec(i))!==null;){Te&&(Te=!1,X=new U.Fragment(e,n),X.start=z,X.sn=k,X.cc=Q,X.level=t,A&&(X.initSegment=A,X.rawProgramDateTime=A.rawProgramDateTime));var Ce=le[1];if(Ce){X.duration=parseFloat(Ce);var _e=(" "+le[2]).slice(1);X.title=_e||null,X.tagList.push(_e?["INF",Ce,_e]:["INF",Ce])}else if(le[3])Object(I.isFiniteNumber)(X.duration)&&(X.start=z,ve&&(X.levelkey=ve),X.sn=k,X.level=t,X.cc=Q,X.urlId=m,_.push(X),X.relurl=(" "+le[3]).slice(1),l(X,Y),Y=X,z+=X.duration,k++,F=0,Te=!0);else if(le[4]){var Re=(" "+le[4]).slice(1);Y?X.setByteRange(Re,Y):X.setByteRange(Re)}else if(le[5])X.rawProgramDateTime=(" "+le[5]).slice(1),X.tagList.push(["PROGRAM-DATE-TIME",X.rawProgramDateTime]),Ne===-1&&(Ne=_.length);else{if(le=le[0].match(v),!le){x.logger.warn("No matches on slow regex match for level playlist!");continue}for(ye=1;ye<le.length&&!(typeof le[ye]!="undefined");ye++);var he=(" "+le[ye]).slice(1),Z=(" "+le[ye+1]).slice(1),je=le[ye+2]?(" "+le[ye+2]).slice(1):"";switch(he){case"PLAYLIST-TYPE":y.type=Z.toUpperCase();break;case"MEDIA-SEQUENCE":k=y.startSN=parseInt(Z);break;case"SKIP":{var lt=new w.AttrList(Z),nt=lt.decimalInteger("SKIPPED-SEGMENTS");if(Object(I.isFiniteNumber)(nt)){y.skippedSegments=nt;for(var Ke=nt;Ke--;)_.unshift(null);k+=nt}var Ge=lt.enumeratedString("RECENTLY-REMOVED-DATERANGES");Ge&&(y.recentlyRemovedDateranges=Ge.split(" "));break}case"TARGETDURATION":y.targetduration=parseFloat(Z);break;case"VERSION":y.version=parseInt(Z);break;case"EXTM3U":break;case"ENDLIST":y.live=!1;break;case"#":(Z||je)&&X.tagList.push(je?[Z,je]:[Z]);break;case"DIS":Q++;case"GAP":X.tagList.push([he]);break;case"BITRATE":X.tagList.push([he,Z]);break;case"DISCONTINUITY-SEQ":Q=parseInt(Z);break;case"KEY":{var Pe,We=new w.AttrList(Z),Qe=We.enumeratedString("METHOD"),Ze=We.URI,$e=We.hexadecimalInteger("IV"),Ue=We.enumeratedString("KEYFORMATVERSIONS"),Fe=We.enumeratedString("KEYID"),ct=(Pe=We.enumeratedString("KEYFORMAT"))!=null?Pe:"identity",ot=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(ot.indexOf(ct)>-1){x.logger.warn("Keyformat "+ct+" is not supported from the manifest");continue}else if(ct!=="identity")continue;Qe&&(ve=R.LevelKey.fromURL(n,Ze),Ze&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Qe)>=0&&(ve.method=Qe,ve.keyFormat=ct,Fe&&(ve.keyID=Fe),Ue&&(ve.keyFormatVersions=Ue),ve.iv=$e));break}case"START":{var st=new w.AttrList(Z),rt=st.decimalFloatingPoint("TIME-OFFSET");Object(I.isFiniteNumber)(rt)&&(y.startTimeOffset=rt);break}case"MAP":{var ht=new w.AttrList(Z);X.relurl=ht.URI,ht.BYTERANGE&&X.setByteRange(ht.BYTERANGE),X.level=t,X.sn="initSegment",ve&&(X.levelkey=ve),X.initSegment=null,A=X,Te=!0;break}case"SERVER-CONTROL":{var ut=new w.AttrList(Z);y.canBlockReload=ut.bool("CAN-BLOCK-RELOAD"),y.canSkipUntil=ut.optionalFloat("CAN-SKIP-UNTIL",0),y.canSkipDateRanges=y.canSkipUntil>0&&ut.bool("CAN-SKIP-DATERANGES"),y.partHoldBack=ut.optionalFloat("PART-HOLD-BACK",0),y.holdBack=ut.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var fe=new w.AttrList(Z);y.partTarget=fe.decimalFloatingPoint("PART-TARGET");break}case"PART":{var be=y.partList;be||(be=y.partList=[]);var we=F>0?be[be.length-1]:void 0,ke=F++,xe=new U.Part(new w.AttrList(Z),X,n,ke,we);be.push(xe),X.duration+=xe.duration;break}case"PRELOAD-HINT":{var Oe=new w.AttrList(Z);y.preloadHint=Oe;break}case"RENDITION-REPORT":{var ae=new w.AttrList(Z);y.renditionReports=y.renditionReports||[],y.renditionReports.push(ae);break}default:x.logger.warn("line parsed but not handled: "+le);break}}}Y&&!Y.relurl?(_.pop(),z-=Y.duration,y.partList&&(y.fragmentHint=Y)):y.partList&&(l(X,Y),X.cc=Q,y.fragmentHint=X);var ee=_.length,te=_[0],H=_[ee-1];if(z+=y.skippedSegments*y.targetduration,z>0&&ee&&H){y.averagetargetduration=z/ee;var G=H.sn;y.endSN=G!=="initSegment"?G:0,te&&(y.startCC=te.cc,te.initSegment||y.fragments.every(function(V){return V.relurl&&r(V.relurl)})&&(x.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),X=new U.Fragment(e,n),X.relurl=H.relurl,X.level=t,X.sn="initSegment",te.initSegment=X,y.needSidxRanges=!0))}else y.endSN=0,y.startCC=0;return y.fragmentHint&&(z+=y.fragmentHint.duration),y.totalduration=z,y.endCC=Q,Ne>0&&d(_,Ne),y},p}();function s(p,c){["video","audio","text"].forEach(function(i){var n=p.filter(function(e){return Object(T.isCodecType)(e,i)});if(n.length){var t=n.filter(function(e){return e.lastIndexOf("avc1",0)===0||e.lastIndexOf("mp4a",0)===0});c[i+"Codec"]=t.length>0?t[0]:n[0],p=p.filter(function(e){return n.indexOf(e)===-1})}}),c.unknownCodecs=p}function f(p,c,i){var n=c[i];n&&(p[i]=n)}function d(p,c){for(var i=p[c],n=c;n--;){var t=p[n];if(!t)return;t.programDateTime=i.programDateTime-t.duration*1e3,i=t}}function l(p,c){p.rawProgramDateTime?p.programDateTime=Date.parse(p.rawProgramDateTime):c!=null&&c.programDateTime&&(p.programDateTime=c.endProgramDateTime),Object(I.isFiniteNumber)(p.programDateTime)||(p.programDateTime=null,p.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/polyfills/number.ts"),g=S("./src/events.ts"),E=S("./src/errors.ts"),U=S("./src/utils/logger.ts"),M=S("./src/utils/mp4-tools.ts"),R=S("./src/loader/m3u8-parser.ts"),w=S("./src/types/loader.ts"),x=S("./src/utils/attr-list.ts");function T(b){var v=b.type;switch(v){case w.PlaylistContextType.AUDIO_TRACK:return w.PlaylistLevelType.AUDIO;case w.PlaylistContextType.SUBTITLE_TRACK:return w.PlaylistLevelType.SUBTITLE;default:return w.PlaylistLevelType.MAIN}}function O(b,v){var h=b.url;return(h===void 0||h.indexOf("data:")===0)&&(h=v.url),h}var C=function(){function b(h){this.hls=void 0,this.loaders=Object.create(null),this.hls=h,this.registerListeners()}var v=b.prototype;return v.registerListeners=function(){var r=this.hls;r.on(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.on(g.Events.LEVEL_LOADING,this.onLevelLoading,this),r.on(g.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),r.on(g.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},v.unregisterListeners=function(){var r=this.hls;r.off(g.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.off(g.Events.LEVEL_LOADING,this.onLevelLoading,this),r.off(g.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),r.off(g.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},v.createInternalLoader=function(r){var o=this.hls.config,s=o.pLoader,f=o.loader,d=s||f,l=new d(o);return r.loader=l,this.loaders[r.type]=l,l},v.getInternalLoader=function(r){return this.loaders[r.type]},v.resetInternalLoader=function(r){this.loaders[r]&&delete this.loaders[r]},v.destroyInternalLoaders=function(){for(var r in this.loaders){var o=this.loaders[r];o&&o.destroy(),this.resetInternalLoader(r)}},v.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},v.onManifestLoading=function(r,o){var s=o.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:w.PlaylistContextType.MANIFEST,url:s,deliveryDirectives:null})},v.onLevelLoading=function(r,o){var s=o.id,f=o.level,d=o.url,l=o.deliveryDirectives;this.load({id:s,groupId:null,level:f,responseType:"text",type:w.PlaylistContextType.LEVEL,url:d,deliveryDirectives:l})},v.onAudioTrackLoading=function(r,o){var s=o.id,f=o.groupId,d=o.url,l=o.deliveryDirectives;this.load({id:s,groupId:f,level:null,responseType:"text",type:w.PlaylistContextType.AUDIO_TRACK,url:d,deliveryDirectives:l})},v.onSubtitleTrackLoading=function(r,o){var s=o.id,f=o.groupId,d=o.url,l=o.deliveryDirectives;this.load({id:s,groupId:f,level:null,responseType:"text",type:w.PlaylistContextType.SUBTITLE_TRACK,url:d,deliveryDirectives:l})},v.load=function(r){var o,s=this.hls.config,f=this.getInternalLoader(r);if(f){var d=f.context;if(d&&d.url===r.url){U.logger.trace("[playlist-loader]: playlist request ongoing");return}U.logger.log("[playlist-loader]: aborting previous loader for type: "+r.type),f.abort()}var l,p,c,i;switch(r.type){case w.PlaylistContextType.MANIFEST:l=s.manifestLoadingMaxRetry,p=s.manifestLoadingTimeOut,c=s.manifestLoadingRetryDelay,i=s.manifestLoadingMaxRetryTimeout;break;case w.PlaylistContextType.LEVEL:case w.PlaylistContextType.AUDIO_TRACK:case w.PlaylistContextType.SUBTITLE_TRACK:l=0,p=s.levelLoadingTimeOut;break;default:l=s.levelLoadingMaxRetry,p=s.levelLoadingTimeOut,c=s.levelLoadingRetryDelay,i=s.levelLoadingMaxRetryTimeout;break}if(f=this.createInternalLoader(r),(o=r.deliveryDirectives)!==null&&o!==void 0&&o.part){var n;if(r.type===w.PlaylistContextType.LEVEL&&r.level!==null?n=this.hls.levels[r.level].details:r.type===w.PlaylistContextType.AUDIO_TRACK&&r.id!==null?n=this.hls.audioTracks[r.id].details:r.type===w.PlaylistContextType.SUBTITLE_TRACK&&r.id!==null&&(n=this.hls.subtitleTracks[r.id].details),n){var t=n.partTarget,e=n.targetduration;t&&e&&(p=Math.min(Math.max(t*3,e*.8)*1e3,p))}}var m={timeout:p,maxRetry:l,retryDelay:c,maxRetryDelay:i,highWaterMark:0},y={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};f.load(r,m,y)},v.loadsuccess=function(r,o,s,f){if(f===void 0&&(f=null),s.isSidxRequest){this.handleSidxRequest(r,s),this.handlePlaylistLoaded(r,o,s,f);return}this.resetInternalLoader(s.type);var d=r.data;if(d.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(r,s,"no EXTM3U delimiter",f);return}o.parsing.start=performance.now(),d.indexOf("#EXTINF:")>0||d.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(r,o,s,f):this.handleMasterPlaylist(r,o,s,f)},v.loaderror=function(r,o,s){s===void 0&&(s=null),this.handleNetworkError(o,s,!1,r)},v.loadtimeout=function(r,o,s){s===void 0&&(s=null),this.handleNetworkError(o,s,!0)},v.handleMasterPlaylist=function(r,o,s,f){var d=this.hls,l=r.data,p=O(r,s),c=R.default.parseMasterPlaylist(l,p),i=c.levels,n=c.sessionData;if(!i.length){this.handleManifestParsingError(r,s,"no level found in manifest",f);return}var t=i.map(function(k){return{id:k.attrs.AUDIO,audioCodec:k.audioCodec}}),e=i.map(function(k){return{id:k.attrs.SUBTITLES,textCodec:k.textCodec}}),m=R.default.parseMasterPlaylistMedia(l,p,"AUDIO",t),y=R.default.parseMasterPlaylistMedia(l,p,"SUBTITLES",e),_=R.default.parseMasterPlaylistMedia(l,p,"CLOSED-CAPTIONS");if(m.length){var A=m.some(function(k){return!k.url});!A&&i[0].audioCodec&&!i[0].attrs.AUDIO&&(U.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),m.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new x.AttrList({}),bitrate:0,url:""}))}d.trigger(g.Events.MANIFEST_LOADED,{levels:i,audioTracks:m,subtitles:y,captions:_,url:p,stats:o,networkDetails:f,sessionData:n})},v.handleTrackOrLevelPlaylist=function(r,o,s,f){var d=this.hls,l=s.id,p=s.level,c=s.type,i=O(r,s),n=Object(I.isFiniteNumber)(l)?l:0,t=Object(I.isFiniteNumber)(p)?p:n,e=T(s),m=R.default.parseLevelPlaylist(r.data,i,t,e,n);if(!m.fragments.length){d.trigger(g.Events.ERROR,{type:E.ErrorTypes.NETWORK_ERROR,details:E.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:i,reason:"no fragments found in level",level:typeof s.level=="number"?s.level:void 0});return}if(c===w.PlaylistContextType.MANIFEST){var y={attrs:new x.AttrList({}),bitrate:0,details:m,name:"",url:i};d.trigger(g.Events.MANIFEST_LOADED,{levels:[y],audioTracks:[],url:i,stats:o,networkDetails:f,sessionData:null})}if(o.parsing.end=performance.now(),m.needSidxRanges){var _,A=(_=m.fragments[0].initSegment)===null||_===void 0?void 0:_.url;this.load({url:A,isSidxRequest:!0,type:c,level:p,levelDetails:m,id:l,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}s.levelDetails=m,this.handlePlaylistLoaded(r,o,s,f)},v.handleSidxRequest=function(r,o){var s=Object(M.parseSegmentIndex)(new Uint8Array(r.data));if(!s)return;var f=s.references,d=o.levelDetails;f.forEach(function(l,p){var c=l.info,i=d.fragments[p];i.byteRange.length===0&&i.setByteRange(String(1+c.end-c.start)+"@"+String(c.start)),i.initSegment&&i.initSegment.setByteRange(String(s.moovEndOffset)+"@0")})},v.handleManifestParsingError=function(r,o,s,f){this.hls.trigger(g.Events.ERROR,{type:E.ErrorTypes.NETWORK_ERROR,details:E.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:o.type===w.PlaylistContextType.MANIFEST,url:r.url,reason:s,response:r,context:o,networkDetails:f})},v.handleNetworkError=function(r,o,s,f){s===void 0&&(s=!1),U.logger.warn("[playlist-loader]: A network "+(s?"timeout":"error")+" occurred while loading "+r.type+" level: "+r.level+" id: "+r.id+' group-id: "'+r.groupId+'"');var d=E.ErrorDetails.UNKNOWN,l=!1,p=this.getInternalLoader(r);switch(r.type){case w.PlaylistContextType.MANIFEST:d=s?E.ErrorDetails.MANIFEST_LOAD_TIMEOUT:E.ErrorDetails.MANIFEST_LOAD_ERROR,l=!0;break;case w.PlaylistContextType.LEVEL:d=s?E.ErrorDetails.LEVEL_LOAD_TIMEOUT:E.ErrorDetails.LEVEL_LOAD_ERROR,l=!1;break;case w.PlaylistContextType.AUDIO_TRACK:d=s?E.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:E.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case w.PlaylistContextType.SUBTITLE_TRACK:d=s?E.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:E.ErrorDetails.SUBTITLE_LOAD_ERROR,l=!1;break}p&&this.resetInternalLoader(r.type);var c={type:E.ErrorTypes.NETWORK_ERROR,details:d,fatal:l,url:r.url,loader:p,context:r,networkDetails:o};f&&(c.response=f),this.hls.trigger(g.Events.ERROR,c)},v.handlePlaylistLoaded=function(r,o,s,f){var d=s.type,l=s.level,p=s.id,c=s.groupId,i=s.loader,n=s.levelDetails,t=s.deliveryDirectives;if(!(n!=null&&n.targetduration)){this.handleManifestParsingError(r,s,"invalid target duration",f);return}if(!i)return;n.live&&(i.getCacheAge&&(n.ageHeader=i.getCacheAge()||0),(!i.getCacheAge||isNaN(n.ageHeader))&&(n.ageHeader=0));switch(d){case w.PlaylistContextType.MANIFEST:case w.PlaylistContextType.LEVEL:this.hls.trigger(g.Events.LEVEL_LOADED,{details:n,level:l||0,id:p||0,stats:o,networkDetails:f,deliveryDirectives:t});break;case w.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(g.Events.AUDIO_TRACK_LOADED,{details:n,id:p||0,groupId:c||"",stats:o,networkDetails:f,deliveryDirectives:t});break;case w.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(g.Events.SUBTITLE_TRACK_LOADED,{details:n,id:p||0,groupId:c||"",stats:o,networkDetails:f,deliveryDirectives:t});break}},b}();N.default=C},"./src/polyfills/number.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"isFiniteNumber",function(){return I}),S.d(N,"MAX_SAFE_INTEGER",function(){return g});var I=Number.isFinite||function(E){return typeof E=="number"&&isFinite(E)},g=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(oe,N,S){"use strict";S.r(N);var I=function(){function g(){}return g.getSilentFrame=function(U,M){switch(U){case"mp4a.40.2":if(M===1)return new Uint8Array([0,200,0,128,35,128]);if(M===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(M===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(M===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(M===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(M===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(M===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(M===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(M===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},g}();N.default=I},"./src/remux/mp4-generator.ts":function(oe,N,S){"use strict";S.r(N);var I=Math.pow(2,32)-1,g=function(){function E(){}return E.init=function(){E.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 M;for(M in E.types)E.types.hasOwnProperty(M)&&(E.types[M]=[M.charCodeAt(0),M.charCodeAt(1),M.charCodeAt(2),M.charCodeAt(3)]);var R=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]),w=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]);E.HDLR_TYPES={video:R,audio:w};var x=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),T=new Uint8Array([0,0,0,0,0,0,0,0]);E.STTS=E.STSC=E.STCO=T,E.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),E.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),E.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),E.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var O=new Uint8Array([105,115,111,109]),C=new Uint8Array([97,118,99,49]),b=new Uint8Array([0,0,0,1]);E.FTYP=E.box(E.types.ftyp,O,b,O,C),E.DINF=E.box(E.types.dinf,E.box(E.types.dref,x))},E.box=function(M){for(var R=8,w=arguments.length,x=new Array(w>1?w-1:0),T=1;T<w;T++)x[T-1]=arguments[T];for(var O=x.length,C=O;O--;)R+=x[O].byteLength;var b=new Uint8Array(R);for(b[0]=R>>24&255,b[1]=R>>16&255,b[2]=R>>8&255,b[3]=R&255,b.set(M,4),O=0,R=8;O<C;O++)b.set(x[O],R),R+=x[O].byteLength;return b},E.hdlr=function(M){return E.box(E.types.hdlr,E.HDLR_TYPES[M])},E.mdat=function(M){return E.box(E.types.mdat,M)},E.mdhd=function(M,R){R*=M;var w=Math.floor(R/(I+1)),x=Math.floor(R%(I+1));return E.box(E.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,M>>24&255,M>>16&255,M>>8&255,M&255,w>>24,w>>16&255,w>>8&255,w&255,x>>24,x>>16&255,x>>8&255,x&255,85,196,0,0]))},E.mdia=function(M){return E.box(E.types.mdia,E.mdhd(M.timescale,M.duration),E.hdlr(M.type),E.minf(M))},E.mfhd=function(M){return E.box(E.types.mfhd,new Uint8Array([0,0,0,0,M>>24,M>>16&255,M>>8&255,M&255]))},E.minf=function(M){return M.type==="audio"?E.box(E.types.minf,E.box(E.types.smhd,E.SMHD),E.DINF,E.stbl(M)):E.box(E.types.minf,E.box(E.types.vmhd,E.VMHD),E.DINF,E.stbl(M))},E.moof=function(M,R,w){return E.box(E.types.moof,E.mfhd(M),E.traf(w,R))},E.moov=function(M){for(var R=M.length,w=[];R--;)w[R]=E.trak(M[R]);return E.box.apply(null,[E.types.moov,E.mvhd(M[0].timescale,M[0].duration)].concat(w).concat(E.mvex(M)))},E.mvex=function(M){for(var R=M.length,w=[];R--;)w[R]=E.trex(M[R]);return E.box.apply(null,[E.types.mvex].concat(w))},E.mvhd=function(M,R){R*=M;var w=Math.floor(R/(I+1)),x=Math.floor(R%(I+1)),T=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,M>>24&255,M>>16&255,M>>8&255,M&255,w>>24,w>>16&255,w>>8&255,w&255,x>>24,x>>16&255,x>>8&255,x&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 E.box(E.types.mvhd,T)},E.sdtp=function(M){var R=M.samples||[],w=new Uint8Array(4+R.length),x,T;for(x=0;x<R.length;x++)T=R[x].flags,w[x+4]=T.dependsOn<<4|T.isDependedOn<<2|T.hasRedundancy;return E.box(E.types.sdtp,w)},E.stbl=function(M){return E.box(E.types.stbl,E.stsd(M),E.box(E.types.stts,E.STTS),E.box(E.types.stsc,E.STSC),E.box(E.types.stsz,E.STSZ),E.box(E.types.stco,E.STCO))},E.avc1=function(M){var R=[],w=[],x,T,O;for(x=0;x<M.sps.length;x++)T=M.sps[x],O=T.byteLength,R.push(O>>>8&255),R.push(O&255),R=R.concat(Array.prototype.slice.call(T));for(x=0;x<M.pps.length;x++)T=M.pps[x],O=T.byteLength,w.push(O>>>8&255),w.push(O&255),w=w.concat(Array.prototype.slice.call(T));var C=E.box(E.types.avcC,new Uint8Array([1,R[3],R[4],R[5],252|3,224|M.sps.length].concat(R).concat([M.pps.length]).concat(w))),b=M.width,v=M.height,h=M.pixelRatio[0],r=M.pixelRatio[1];return E.box(E.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,b>>8&255,b&255,v>>8&255,v&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,E.box(E.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),E.box(E.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,h&255,r>>24,r>>16&255,r>>8&255,r&255])))},E.esds=function(M){var R=M.config.length;return new Uint8Array([0,0,0,0,3,23+R,0,1,0,4,15+R,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([R]).concat(M.config).concat([6,1,2]))},E.mp4a=function(M){var R=M.samplerate;return E.box(E.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,M.channelCount,0,16,0,0,0,0,R>>8&255,R&255,0,0]),E.box(E.types.esds,E.esds(M)))},E.mp3=function(M){var R=M.samplerate;return E.box(E.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,M.channelCount,0,16,0,0,0,0,R>>8&255,R&255,0,0]))},E.stsd=function(M){return M.type==="audio"?!M.isAAC&&M.codec==="mp3"?E.box(E.types.stsd,E.STSD,E.mp3(M)):E.box(E.types.stsd,E.STSD,E.mp4a(M)):E.box(E.types.stsd,E.STSD,E.avc1(M))},E.tkhd=function(M){var R=M.id,w=M.duration*M.timescale,x=M.width,T=M.height,O=Math.floor(w/(I+1)),C=Math.floor(w%(I+1));return E.box(E.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,R>>24&255,R>>16&255,R>>8&255,R&255,0,0,0,0,O>>24,O>>16&255,O>>8&255,O&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,x>>8&255,x&255,0,0,T>>8&255,T&255,0,0]))},E.traf=function(M,R){var w=E.sdtp(M),x=M.id,T=Math.floor(R/(I+1)),O=Math.floor(R%(I+1));return E.box(E.types.traf,E.box(E.types.tfhd,new Uint8Array([0,0,0,0,x>>24,x>>16&255,x>>8&255,x&255])),E.box(E.types.tfdt,new Uint8Array([1,0,0,0,T>>24,T>>16&255,T>>8&255,T&255,O>>24,O>>16&255,O>>8&255,O&255])),E.trun(M,w.length+16+20+8+16+8+8),w)},E.trak=function(M){return M.duration=M.duration||4294967295,E.box(E.types.trak,E.tkhd(M),E.mdia(M))},E.trex=function(M){var R=M.id;return E.box(E.types.trex,new Uint8Array([0,0,0,0,R>>24,R>>16&255,R>>8&255,R&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},E.trun=function(M,R){var w=M.samples||[],x=w.length,T=12+16*x,O=new Uint8Array(T),C,b,v,h,r,o;for(R+=8+T,O.set([0,0,15,1,x>>>24&255,x>>>16&255,x>>>8&255,x&255,R>>>24&255,R>>>16&255,R>>>8&255,R&255],0),C=0;C<x;C++)b=w[C],v=b.duration,h=b.size,r=b.flags,o=b.cts,O.set([v>>>24&255,v>>>16&255,v>>>8&255,v&255,h>>>24&255,h>>>16&255,h>>>8&255,h&255,r.isLeading<<2|r.dependsOn,r.isDependedOn<<6|r.hasRedundancy<<4|r.paddingValue<<1|r.isNonSync,r.degradPrio&240<<8,r.degradPrio&15,o>>>24&255,o>>>16&255,o>>>8&255,o&255],12+16*C);return E.box(E.types.trun,O)},E.initSegment=function(M){E.types||E.init();var R=E.moov(M),w=new Uint8Array(E.FTYP.byteLength+R.byteLength);return w.set(E.FTYP),w.set(R,E.FTYP.byteLength),w},E}();g.types=void 0,g.HDLR_TYPES=void 0,g.STTS=void 0,g.STSC=void 0,g.STCO=void 0,g.STSZ=void 0,g.VMHD=void 0,g.SMHD=void 0,g.STSD=void 0,g.FTYP=void 0,g.DINF=void 0,N.default=g},"./src/remux/mp4-remuxer.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return o}),S.d(N,"normalizePts",function(){return s});var I=S("./src/polyfills/number.ts"),g=S("./src/remux/aac-helper.ts"),E=S("./src/remux/mp4-generator.ts"),U=S("./src/events.ts"),M=S("./src/errors.ts"),R=S("./src/utils/logger.ts"),w=S("./src/types/loader.ts"),x=S("./src/utils/timescale-conversion.ts");function T(){return T=Object.assign||function(p){for(var c=1;c<arguments.length;c++){var i=arguments[c];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(p[n]=i[n])}return p},T.apply(this,arguments)}var O=10*1e3,C=1024,b=1152,v=null,h=null,r=!1,o=function(){function p(i,n,t,e){if(e===void 0&&(e=""),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=i,this.config=n,this.typeSupported=t,this.ISGenerated=!1,v===null){var m=navigator.userAgent||"",y=m.match(/Chrome\/(\d+)/i);v=y?parseInt(y[1]):0}if(h===null){var _=navigator.userAgent.match(/Safari\/(\d+)/i);h=_?parseInt(_[1]):0}r=!!v&&v<75||!!h&&h<600}var c=p.prototype;return c.destroy=function(){},c.resetTimeStamp=function(n){R.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=n},c.resetNextTimestamp=function(){R.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},c.resetInitSegment=function(){R.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},c.getVideoStartPts=function(n){var t=!1,e=n.reduce(function(m,y){var _=y.pts-m;return _<-4294967296?(t=!0,s(m,y.pts)):_>0?m:y.pts},n[0].pts);return t&&R.logger.debug("PTS rollover detected"),e},c.remux=function(n,t,e,m,y,_,A,k){var F,z,Q,Y,X,le,ye=y,ve=y,Ne=n.pid>-1,Te=t.pid>-1,Ce=t.samples.length,_e=n.samples.length>0,Re=Ce>1,he=(!Ne||_e)&&(!Te||Re)||this.ISGenerated||A;if(he){this.ISGenerated||(Q=this.generateIS(n,t,y));var Z=this.isVideoContiguous,je=-1;if(Re&&(je=f(t.samples),!Z&&this.config.forceKeyFrameOnDiscontinuity))if(le=!0,je>0){R.logger.warn("[mp4-remuxer]: Dropped "+je+" out of "+Ce+" video samples due to a missing keyframe");var lt=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(je),t.dropped+=je,ve+=(t.samples[0].pts-lt)/(t.timescale||9e4)}else je===-1&&(R.logger.warn("[mp4-remuxer]: No keyframe found out of "+Ce+" video samples"),le=!1);if(this.ISGenerated){if(_e&&Re){var nt=this.getVideoStartPts(t.samples),Ke=s(n.samples[0].pts,nt)-nt,Ge=Ke/t.inputTimeScale;ye+=Math.max(0,Ge),ve+=Math.max(0,-Ge)}if(_e){if(n.samplerate||(R.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),Q=this.generateIS(n,t,y)),z=this.remuxAudio(n,ye,this.isAudioContiguous,_,Te||Re||k===w.PlaylistLevelType.AUDIO?ve:void 0),Re){var Pe=z?z.endPTS-z.startPTS:0;t.inputTimeScale||(R.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),Q=this.generateIS(n,t,y)),F=this.remuxVideo(t,ve,Z,Pe)}}else Re&&(F=this.remuxVideo(t,ve,Z,0));F&&(F.firstKeyFrame=je,F.independent=je!==-1)}}return this.ISGenerated&&(e.samples.length&&(X=this.remuxID3(e,y)),m.samples.length&&(Y=this.remuxText(m,y))),{audio:z,video:F,initSegment:Q,independent:le,text:Y,id3:X}},c.generateIS=function(n,t,e){var m=n.samples,y=t.samples,_=this.typeSupported,A={},k=!Object(I.isFiniteNumber)(this._initPTS),F="audio/mp4",z,Q,Y;if(k&&(z=Q=Infinity),n.config&&m.length&&(n.timescale=n.samplerate,n.isAAC||(_.mpeg?(F="audio/mpeg",n.codec=""):_.mp3&&(n.codec="mp3")),A.audio={id:"audio",container:F,codec:n.codec,initSegment:!n.isAAC&&_.mpeg?new Uint8Array(0):E.default.initSegment([n]),metadata:{channelCount:n.channelCount}},k&&(Y=n.inputTimeScale,z=Q=m[0].pts-Math.round(Y*e))),t.sps&&t.pps&&y.length&&(t.timescale=t.inputTimeScale,A.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:E.default.initSegment([t]),metadata:{width:t.width,height:t.height}},k)){Y=t.inputTimeScale;var X=this.getVideoStartPts(y),le=Math.round(Y*e);Q=Math.min(Q,s(y[0].dts,X)-le),z=Math.min(z,X-le)}if(Object.keys(A).length)return this.ISGenerated=!0,k&&(this._initPTS=z,this._initDTS=Q),{tracks:A,initPTS:z,timescale:Y}},c.remuxVideo=function(n,t,e,m){var y=n.inputTimeScale,_=n.samples,A=[],k=_.length,F=this._initPTS,z=this.nextAvcDts,Q=8,Y,X,le,ye=Number.POSITIVE_INFINITY,ve=Number.NEGATIVE_INFINITY,Ne=0,Te=!1;if(!e||z===null){var Ce=t*y,_e=_[0].pts-s(_[0].dts,_[0].pts);z=Ce-_e}for(var Re=0;Re<k;Re++){var he=_[Re];if(he.pts=s(he.pts-F,z),he.dts=s(he.dts-F,z),he.dts>he.pts){var Z=9e4*.2;Ne=Math.max(Math.min(Ne,he.pts-he.dts),-1*Z)}he.dts<_[Re>0?Re-1:Re].dts&&(Te=!0)}Te&&_.sort(function(Ct,_t){var at=Ct.dts-_t.dts,It=Ct.pts-_t.pts;return at||It}),X=_[0].dts,le=_[_.length-1].dts;var je=Math.round((le-X)/(k-1));if(Ne<0){if(Ne<je*-2){R.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(x.toMsFromMpegTsClock)(-je,!0)+" ms");for(var lt=Ne,nt=0;nt<k;nt++)_[nt].dts=lt=Math.max(lt,_[nt].pts-je),_[nt].pts=Math.max(lt,_[nt].pts)}else{R.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(x.toMsFromMpegTsClock)(Ne,!0)+" ms to overcome this issue");for(var Ke=0;Ke<k;Ke++)_[Ke].dts=_[Ke].dts+Ne}X=_[0].dts}if(e){var Ge=X-z,Pe=Ge>je,We=Ge<-1;if(Pe||We){Pe?R.logger.warn("AVC: "+Object(x.toMsFromMpegTsClock)(Ge,!0)+" ms ("+Ge+"dts) hole between fragments detected, filling it"):R.logger.warn("AVC: "+Object(x.toMsFromMpegTsClock)(-Ge,!0)+" ms ("+Ge+"dts) overlapping between fragments detected"),X=z;var Qe=_[0].pts-Ge;_[0].dts=X,_[0].pts=Qe,R.logger.log("Video: First PTS/DTS adjusted: "+Object(x.toMsFromMpegTsClock)(Qe,!0)+"/"+Object(x.toMsFromMpegTsClock)(X,!0)+", delta: "+Object(x.toMsFromMpegTsClock)(Ge,!0)+" ms")}}r&&(X=Math.max(0,X));for(var Ze=0,$e=0,Ue=0;Ue<k;Ue++){for(var Fe=_[Ue],ct=Fe.units,ot=ct.length,st=0,rt=0;rt<ot;rt++)st+=ct[rt].data.length;$e+=st,Ze+=ot,Fe.length=st,Fe.dts=Math.max(Fe.dts,X),Fe.pts=Math.max(Fe.pts,Fe.dts,0),ye=Math.min(Fe.pts,ye),ve=Math.max(Fe.pts,ve)}le=_[k-1].dts;var ht=$e+4*Ze+8,ut;try{ut=new Uint8Array(ht)}catch(Ct){this.observer.emit(U.Events.ERROR,U.Events.ERROR,{type:M.ErrorTypes.MUX_ERROR,details:M.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ht,reason:"fail allocating video mdat "+ht});return}var fe=new DataView(ut.buffer);fe.setUint32(0,ht),ut.set(E.default.types.mdat,4);for(var be=0;be<k;be++){for(var we=_[be],ke=we.units,xe=0,Oe=0,ae=ke.length;Oe<ae;Oe++){var ee=ke[Oe],te=ee.data,H=ee.data.byteLength;fe.setUint32(Q,H),Q+=4,ut.set(te,Q),Q+=H,xe+=4+H}if(be<k-1)Y=_[be+1].dts-we.dts;else{var G=this.config,V=we.dts-_[be>0?be-1:be].dts;if(G.stretchShortVideoTrack&&this.nextAudioPts!==null){var J=Math.floor(G.maxBufferHole*y),de=(m?ye+m*y:this.nextAudioPts)-we.pts;de>J?(Y=de-V,Y<0&&(Y=V),R.logger.log("[mp4-remuxer]: It is approximately "+de/90+" ms to the next segment; using duration "+Y/90+" ms for the last video frame.")):Y=V}else Y=V}var ge=Math.round(we.pts-we.dts);A.push(new d(we.key,Y,xe,ge))}if(A.length&&v&&v<70){var Me=A[0].flags;Me.dependsOn=2,Me.isNonSync=0}console.assert(Y!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=z=le+Y,this.isVideoContiguous=!0;var et=E.default.moof(n.sequenceNumber++,X,T({},n,{samples:A})),dt="video",qe={data1:et,data2:ut,startPTS:ye/y,endPTS:(ve+Y)/y,startDTS:X/y,endDTS:z/y,type:dt,hasAudio:!1,hasVideo:!0,nb:A.length,dropped:n.dropped};return n.samples=[],n.dropped=0,console.assert(ut.length,"MDAT length must not be zero"),qe},c.remuxAudio=function(n,t,e,m,y){var _=n.inputTimeScale,A=n.samplerate?n.samplerate:_,k=_/A,F=n.isAAC?C:b,z=F*k,Q=this._initPTS,Y=!n.isAAC&&this.typeSupported.mpeg,X=[],le=n.samples,ye=Y?0:8,ve=this.nextAudioPts||-1,Ne=t*_;if(this.isAudioContiguous=e=e||le.length&&ve>0&&(m&&Math.abs(Ne-ve)<9e3||Math.abs(s(le[0].pts-Q,Ne)-ve)<20*z),le.forEach(function(te){te.pts=s(te.pts-Q,Ne)}),!e||ve<0){if(le=le.filter(function(te){return te.pts>=0}),!le.length)return;y===0?ve=0:m?ve=Math.max(0,Ne):ve=le[0].pts}if(n.isAAC)for(var Te=y!==void 0,Ce=this.config.maxAudioFramesDrift,_e=0,Re=ve;_e<le.length;_e++){var he=le[_e],Z=he.pts,je=Z-Re,lt=Math.abs(1e3*je/_);if(je<=-Ce*z&&Te)_e===0&&(R.logger.warn("Audio frame @ "+(Z/_).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*je/_)+" ms."),this.nextAudioPts=ve=Re=Z);else if(je>=Ce*z&&lt<O&&Te){var nt=Math.round(je/z);Re=Z-nt*z,Re<0&&(nt--,Re+=z),_e===0&&(this.nextAudioPts=ve=Re),R.logger.warn("[mp4-remuxer]: Injecting "+nt+" audio frame @ "+(Re/_).toFixed(3)+"s due to "+Math.round(1e3*je/_)+" ms gap.");for(var Ke=0;Ke<nt;Ke++){var Ge=Math.max(Re,0),Pe=g.default.getSilentFrame(n.manifestCodec||n.codec,n.channelCount);Pe||(R.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Pe=he.unit.subarray()),le.splice(_e,0,{unit:Pe,pts:Ge}),Re+=z,_e++}}he.pts=Re,Re+=z}for(var We=null,Qe=null,Ze,$e=0,Ue=le.length;Ue--;)$e+=le[Ue].unit.byteLength;for(var Fe=0,ct=le.length;Fe<ct;Fe++){var ot=le[Fe],st=ot.unit,rt=ot.pts;if(Qe!==null){var ht=X[Fe-1];ht.duration=Math.round((rt-Qe)/k)}else if(e&&n.isAAC&&(rt=ve),We=rt,$e>0){$e+=ye;try{Ze=new Uint8Array($e)}catch(te){this.observer.emit(U.Events.ERROR,U.Events.ERROR,{type:M.ErrorTypes.MUX_ERROR,details:M.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:$e,reason:"fail allocating audio mdat "+$e});return}if(!Y){var ut=new DataView(Ze.buffer);ut.setUint32(0,$e),Ze.set(E.default.types.mdat,4)}}else return;Ze.set(st,ye);var fe=st.byteLength;ye+=fe,X.push(new d(!0,F,fe,0)),Qe=rt}var be=X.length;if(!be)return;var we=X[X.length-1];this.nextAudioPts=ve=Qe+k*we.duration;var ke=Y?new Uint8Array(0):E.default.moof(n.sequenceNumber++,We/k,T({},n,{samples:X}));n.samples=[];var xe=We/_,Oe=ve/_,ae="audio",ee={data1:ke,data2:Ze,startPTS:xe,endPTS:Oe,startDTS:xe,endDTS:Oe,type:ae,hasAudio:!0,hasVideo:!1,nb:be};return this.isAudioContiguous=!0,console.assert(Ze.length,"MDAT length must not be zero"),ee},c.remuxEmptyAudio=function(n,t,e,m){var y=n.inputTimeScale,_=n.samplerate?n.samplerate:y,A=y/_,k=this.nextAudioPts,F=(k!==null?k:m.startDTS*y)+this._initDTS,z=m.endDTS*y+this._initDTS,Q=A*C,Y=Math.ceil((z-F)/Q),X=g.default.getSilentFrame(n.manifestCodec||n.codec,n.channelCount);if(R.logger.warn("[mp4-remuxer]: remux empty Audio"),!X){R.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var le=[],ye=0;ye<Y;ye++){var ve=F+ye*Q;le.push({unit:X,pts:ve,dts:ve})}return n.samples=le,this.remuxAudio(n,t,e,!1)},c.remuxID3=function(n,t){var e=n.samples.length;if(!e)return;for(var m=n.inputTimeScale,y=this._initPTS,_=this._initDTS,A=0;A<e;A++){var k=n.samples[A];k.pts=s(k.pts-y,t*m)/m,k.dts=s(k.dts-_,t*m)/m}var F=n.samples;return n.samples=[],{samples:F}},c.remuxText=function(n,t){var e=n.samples.length;if(!e)return;for(var m=n.inputTimeScale,y=this._initPTS,_=0;_<e;_++){var A=n.samples[_];A.pts=s(A.pts-y,t*m)/m}n.samples.sort(function(F,z){return F.pts-z.pts});var k=n.samples;return n.samples=[],{samples:k}},p}();function s(p,c){var i;if(c===null)return p;for(c<p?i=-8589934592:i=8589934592;Math.abs(p-c)>4294967296;)p+=i;return p}function f(p){for(var c=0;c<p.length;c++)if(p[c].key)return c;return-1}var d=function(c,i,n,t){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=i,this.size=n,this.cts=t,this.flags=new l(c)},l=function(c){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=c?2:1,this.isNonSync=c?0:1}},"./src/remux/passthrough-remuxer.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/polyfills/number.ts"),g=S("./src/utils/mp4-tools.ts"),E=S("./src/loader/fragment.ts"),U=S("./src/utils/logger.ts"),M=function(){function x(){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 T=x.prototype;return T.destroy=function(){},T.resetTimeStamp=function(C){this.initPTS=C,this.lastEndDTS=null},T.resetNextTimestamp=function(){this.lastEndDTS=null},T.resetInitSegment=function(C,b,v){this.audioCodec=b,this.videoCodec=v,this.generateInitSegment(C),this.emitInitSegment=!0},T.generateInitSegment=function(C){var b=this.audioCodec,v=this.videoCodec;if(!C||!C.byteLength){this.initTracks=void 0,this.initData=void 0;return}var h=this.initData=Object(g.parseInitSegment)(C);b||(b=w(h.audio,E.ElementaryStreamTypes.AUDIO)),v||(v=w(h.video,E.ElementaryStreamTypes.VIDEO));var r={};h.audio&&h.video?r.audiovideo={container:"video/mp4",codec:b+","+v,initSegment:C,id:"main"}:h.audio?r.audio={container:"audio/mp4",codec:b,initSegment:C,id:"audio"}:h.video?r.video={container:"video/mp4",codec:v,initSegment:C,id:"main"}:U.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=r},T.remux=function(C,b,v,h,r){var o=this.initPTS,s=this.lastEndDTS,f={audio:void 0,video:void 0,text:h,id3:v,initSegment:void 0};Object(I.isFiniteNumber)(s)||(s=this.lastEndDTS=r||0);var d=b.samples;if(!d||!d.length)return f;var l={initPTS:void 0,timescale:1},p=this.initData;if((!p||!p.length)&&(this.generateInitSegment(d),p=this.initData),!p||!p.length)return U.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),f;this.emitInitSegment&&(l.tracks=this.initTracks,this.emitInitSegment=!1),Object(I.isFiniteNumber)(o)||(this.initPTS=l.initPTS=o=R(p,d,s));var c=Object(g.getDuration)(d,p),i=s,n=c+i;Object(g.offsetStartDTS)(p,d,o),c>0?this.lastEndDTS=n:(U.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var t=!!p.audio,e=!!p.video,m="";t&&(m+="audio"),e&&(m+="video");var y={data1:d,startPTS:i,startDTS:i,endPTS:n,endDTS:n,type:m,hasAudio:t,hasVideo:e,nb:1,dropped:0};return f.audio=y.type==="audio"?y:void 0,f.video=y.type!=="audio"?y:void 0,f.text=h,f.id3=v,f.initSegment=l,f},x}(),R=function(T,O,C){return Object(g.getStartDTS)(T,O)-C};function w(x,T){var O=x==null?void 0:x.codec;return O&&O.length>4?O:O==="hvc1"?"hvc1.1.c.L120.90":O==="av01"?"av01.0.04M.08":O==="avc1"||T===E.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}N.default=M},"./src/task-loop.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return I});var I=function(){function g(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var E=g.prototype;return E.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},E.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},E.onHandlerDestroyed=function(){},E.hasInterval=function(){return!!this._tickInterval},E.hasNextTick=function(){return!!this._tickTimer},E.setInterval=function(M){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,M),!0)},E.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},E.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},E.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},E.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},E.doTick=function(){},g}()},"./src/types/cmcd.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"CMCDVersion",function(){return I}),S.d(N,"CMCDObjectType",function(){return g}),S.d(N,"CMCDStreamingFormat",function(){return E}),S.d(N,"CMCDStreamType",function(){return U});var I=1,g;(function(M){M.MANIFEST="m",M.AUDIO="a",M.VIDEO="v",M.MUXED="av",M.INIT="i",M.CAPTION="c",M.TIMED_TEXT="tt",M.KEY="k",M.OTHER="o"})(g||(g={}));var E;(function(M){M.DASH="d",M.HLS="h",M.SMOOTH="s",M.OTHER="o"})(E||(E={}));var U;(function(M){M.VOD="v",M.LIVE="l"})(U||(U={}))},"./src/types/level.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"HlsSkip",function(){return E}),S.d(N,"getSkipValue",function(){return U}),S.d(N,"HlsUrlParameters",function(){return M}),S.d(N,"Level",function(){return R});function I(w,x){for(var T=0;T<x.length;T++){var O=x[T];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(w,O.key,O)}}function g(w,x,T){return x&&I(w.prototype,x),T&&I(w,T),w}var E;(function(w){w.No="",w.Yes="YES",w.v2="v2"})(E||(E={}));function U(w,x){var T=w.canSkipUntil,O=w.canSkipDateRanges,C=w.endSN,b=x!==void 0?x-C:0;return T&&b<T?O?E.v2:E.Yes:E.No}var M=function(){function w(T,O,C){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=T,this.part=O,this.skip=C}var x=w.prototype;return x.addDirectives=function(O){var C=new self.URL(O);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()},w}(),R=function(){function w(x){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=[x.url],this.attrs=x.attrs,this.bitrate=x.bitrate,x.details&&(this.details=x.details),this.id=x.id||0,this.name=x.name,this.width=x.width||0,this.height=x.height||0,this.audioCodec=x.audioCodec,this.videoCodec=x.videoCodec,this.unknownCodecs=x.unknownCodecs,this.codecSet=[x.videoCodec,x.audioCodec].filter(function(T){return T}).join(",").replace(/\.[^.,]+/g,"")}return g(w,[{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(T){var O=T%this.url.length;this._urlId!==O&&(this.details=void 0,this._urlId=O)}}]),w}()},"./src/types/loader.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"PlaylistContextType",function(){return I}),S.d(N,"PlaylistLevelType",function(){return g});var I;(function(E){E.MANIFEST="manifest",E.LEVEL="level",E.AUDIO_TRACK="audioTrack",E.SUBTITLE_TRACK="subtitleTrack"})(I||(I={}));var g;(function(E){E.MAIN="main",E.AUDIO="audio",E.SUBTITLE="subtitle"})(g||(g={}))},"./src/types/transmuxer.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"ChunkMetadata",function(){return I});var I=function(U,M,R,w,x,T){w===void 0&&(w=0),x===void 0&&(x=-1),T===void 0&&(T=!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=g(),this.buffering={audio:g(),video:g(),audiovideo:g()},this.level=U,this.sn=M,this.id=R,this.size=w,this.part=x,this.partial=T};function g(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"AttrList",function(){return E});var I=/^(\d+)x(\d+)$/,g=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,E=function(){function U(R){typeof R=="string"&&(R=U.parseAttrList(R));for(var w in R)R.hasOwnProperty(w)&&(this[w]=R[w])}var M=U.prototype;return M.decimalInteger=function(w){var x=parseInt(this[w],10);return x>Number.MAX_SAFE_INTEGER?Infinity:x},M.hexadecimalInteger=function(w){if(this[w]){var x=(this[w]||"0x").slice(2);x=(x.length&1?"0":"")+x;for(var T=new Uint8Array(x.length/2),O=0;O<x.length/2;O++)T[O]=parseInt(x.slice(O*2,O*2+2),16);return T}else return null},M.hexadecimalIntegerAsNumber=function(w){var x=parseInt(this[w],16);return x>Number.MAX_SAFE_INTEGER?Infinity:x},M.decimalFloatingPoint=function(w){return parseFloat(this[w])},M.optionalFloat=function(w,x){var T=this[w];return T?parseFloat(T):x},M.enumeratedString=function(w){return this[w]},M.bool=function(w){return this[w]==="YES"},M.decimalResolution=function(w){var x=I.exec(this[w]);return x===null?void 0:{width:parseInt(x[1],10),height:parseInt(x[2],10)}},U.parseAttrList=function(w){var x,T={},O='"';for(g.lastIndex=0;(x=g.exec(w))!==null;){var C=x[2];C.indexOf(O)===0&&C.lastIndexOf(O)===C.length-1&&(C=C.slice(1,-1)),T[x[1]]=C}return T},U}()},"./src/utils/binary-search.ts":function(oe,N,S){"use strict";S.r(N);var I={search:function(E,U){for(var M=0,R=E.length-1,w=null,x=null;M<=R;){w=(M+R)/2|0,x=E[w];var T=U(x);if(T>0)M=w+1;else if(T<0)R=w-1;else return x}return null}};N.default=I},"./src/utils/buffer-helper.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"BufferHelper",function(){return E});var I=S("./src/utils/logger.ts"),g={length:0,start:function(){return 0},end:function(){return 0}},E=function(){function U(){}return U.isBuffered=function(R,w){try{if(R){for(var x=U.getBuffered(R),T=0;T<x.length;T++)if(w>=x.start(T)&&w<=x.end(T))return!0}}catch(O){}return!1},U.bufferInfo=function(R,w,x){try{if(R){var T=U.getBuffered(R),O=[],C;for(C=0;C<T.length;C++)O.push({start:T.start(C),end:T.end(C)});return this.bufferedInfo(O,w,x)}}catch(b){}return{len:0,start:w,end:w,nextStart:void 0}},U.bufferedInfo=function(R,w,x){w=Math.max(0,w),R.sort(function(l,p){var c=l.start-p.start;return c||p.end-l.end});var T=[];if(x)for(var O=0;O<R.length;O++){var C=T.length;if(C){var b=T[C-1].end;R[O].start-b<x?R[O].end>b&&(T[C-1].end=R[O].end):T.push(R[O])}else T.push(R[O])}else T=R;for(var v=0,h,r=w,o=w,s=0;s<T.length;s++){var f=T[s].start,d=T[s].end;if(w+x>=f&&w<d)r=f,o=d,v=o-w;else if(w+x<f){h=f;break}}return{len:v,start:r||0,end:o||0,nextStart:h}},U.getBuffered=function(R){try{return R.buffered}catch(w){return I.logger.log("failed to get media.buffered",w),g}},U}()},"./src/utils/cea-608-parser.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"Row",function(){return o}),S.d(N,"CaptionScreen",function(){return s});var I=S("./src/utils/logger.ts"),g={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},E=function(n){var t=n;return g.hasOwnProperty(n)&&(t=g[n]),String.fromCharCode(t)},U=15,M=100,R={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},w={17:2,18:4,21:6,22:8,23:10,19:13,20:15},x={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},T={25:2,26:4,29:6,30:8,31:10,27:13,28:15},O=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],C;(function(i){i[i.ERROR=0]="ERROR",i[i.TEXT=1]="TEXT",i[i.WARNING=2]="WARNING",i[i.INFO=2]="INFO",i[i.DEBUG=3]="DEBUG",i[i.DATA=3]="DATA"})(C||(C={}));var b=function(){function i(){this.time=null,this.verboseLevel=C.ERROR}var n=i.prototype;return n.log=function(e,m){this.verboseLevel>=e&&I.logger.log(this.time+" ["+e+"] "+m)},i}(),v=function(n){for(var t=[],e=0;e<n.length;e++)t.push(n[e].toString(16));return t},h=function(){function i(t,e,m,y,_){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=t||"white",this.underline=e||!1,this.italics=m||!1,this.background=y||"black",this.flash=_||!1}var n=i.prototype;return n.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},n.setStyles=function(e){for(var m=["foreground","underline","italics","background","flash"],y=0;y<m.length;y++){var _=m[y];e.hasOwnProperty(_)&&(this[_]=e[_])}},n.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},n.equals=function(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash},n.copy=function(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash},n.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},i}(),r=function(){function i(t,e,m,y,_,A){this.uchar=void 0,this.penState=void 0,this.uchar=t||" ",this.penState=new h(e,m,y,_,A)}var n=i.prototype;return n.reset=function(){this.uchar=" ",this.penState.reset()},n.setChar=function(e,m){this.uchar=e,this.penState.copy(m)},n.setPenState=function(e){this.penState.copy(e)},n.equals=function(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)},n.copy=function(e){this.uchar=e.uchar,this.penState.copy(e.penState)},n.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},i}(),o=function(){function i(t){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var e=0;e<M;e++)this.chars.push(new r);this.logger=t,this.pos=0,this.currPenState=new h}var n=i.prototype;return n.equals=function(e){for(var m=!0,y=0;y<M;y++)if(!this.chars[y].equals(e.chars[y])){m=!1;break}return m},n.copy=function(e){for(var m=0;m<M;m++)this.chars[m].copy(e.chars[m])},n.isEmpty=function(){for(var e=!0,m=0;m<M;m++)if(!this.chars[m].isEmpty()){e=!1;break}return e},n.setCursor=function(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(C.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>M&&(this.logger.log(C.DEBUG,"Too large cursor position "+this.pos),this.pos=M)},n.moveCursor=function(e){var m=this.pos+e;if(e>1)for(var y=this.pos+1;y<m+1;y++)this.chars[y].setPenState(this.currPenState);this.setCursor(m)},n.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},n.insertChar=function(e){e>=144&&this.backSpace();var m=E(e);if(this.pos>=M){this.logger.log(C.ERROR,"Cannot insert "+e.toString(16)+" ("+m+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(m,this.currPenState),this.moveCursor(1)},n.clearFromPos=function(e){var m;for(m=e;m<M;m++)this.chars[m].reset()},n.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},n.clearToEndOfRow=function(){this.clearFromPos(this.pos)},n.getTextString=function(){for(var e=[],m=!0,y=0;y<M;y++){var _=this.chars[y].uchar;_!==" "&&(m=!1),e.push(_)}return m?"":e.join("")},n.setPenStyles=function(e){this.currPenState.setStyles(e);var m=this.chars[this.pos];m.setPenState(this.currPenState)},i}(),s=function(){function i(t){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var e=0;e<U;e++)this.rows.push(new o(t));this.logger=t,this.currRow=U-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var n=i.prototype;return n.reset=function(){for(var e=0;e<U;e++)this.rows[e].clear();this.currRow=U-1},n.equals=function(e){for(var m=!0,y=0;y<U;y++)if(!this.rows[y].equals(e.rows[y])){m=!1;break}return m},n.copy=function(e){for(var m=0;m<U;m++)this.rows[m].copy(e.rows[m])},n.isEmpty=function(){for(var e=!0,m=0;m<U;m++)if(!this.rows[m].isEmpty()){e=!1;break}return e},n.backSpace=function(){var e=this.rows[this.currRow];e.backSpace()},n.clearToEndOfRow=function(){var e=this.rows[this.currRow];e.clearToEndOfRow()},n.insertChar=function(e){var m=this.rows[this.currRow];m.insertChar(e)},n.setPen=function(e){var m=this.rows[this.currRow];m.setPenStyles(e)},n.moveCursor=function(e){var m=this.rows[this.currRow];m.moveCursor(e)},n.setCursor=function(e){this.logger.log(C.INFO,"setCursor: "+e);var m=this.rows[this.currRow];m.setCursor(e)},n.setPAC=function(e){this.logger.log(C.INFO,"pacData = "+JSON.stringify(e));var m=e.row-1;if(this.nrRollUpRows&&m<this.nrRollUpRows-1&&(m=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==m){for(var y=0;y<U;y++)this.rows[y].clear();var _=this.currRow+1-this.nrRollUpRows,A=this.lastOutputScreen;if(A){var k=A.rows[_].cueStartTime,F=this.logger.time;if(k&&F!==null&&k<F)for(var z=0;z<this.nrRollUpRows;z++)this.rows[m-this.nrRollUpRows+z+1].copy(A.rows[_+z])}}this.currRow=m;var Q=this.rows[this.currRow];if(e.indent!==null){var Y=e.indent,X=Math.max(Y-1,0);Q.setCursor(e.indent),e.color=Q.chars[X].penState.foreground}var le={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(le)},n.setBkgData=function(e){this.logger.log(C.INFO,"bkgData = "+JSON.stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)},n.setRollUpRows=function(e){this.nrRollUpRows=e},n.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 e=this.currRow+1-this.nrRollUpRows,m=this.rows.splice(e,1)[0];m.clear(),this.rows.splice(this.currRow,0,m),this.logger.log(C.INFO,"Rolling up")},n.getDisplayText=function(e){e=e||!1;for(var m=[],y="",_=-1,A=0;A<U;A++){var k=this.rows[A].getTextString();k&&(_=A+1,e?m.push("Row "+_+": '"+k+"'"):m.push(k.trim()))}return m.length>0&&(e?y="["+m.join(" | ")+"]":y=m.join(`
`)),y},n.getTextAndFormat=function(){return this.rows},i}(),f=function(){function i(t,e,m){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=t,this.outputFilter=e,this.mode=null,this.verbose=0,this.displayedMemory=new s(m),this.nonDisplayedMemory=new s(m),this.lastOutputScreen=new s(m),this.currRollUpRow=this.displayedMemory.rows[U-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=m}var n=i.prototype;return n.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[U-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},n.getHandler=function(){return this.outputFilter},n.setHandler=function(e){this.outputFilter=e},n.setPAC=function(e){this.writeScreen.setPAC(e)},n.setBkgData=function(e){this.writeScreen.setBkgData(e)},n.setMode=function(e){if(e===this.mode)return;this.mode=e,this.logger.log(C.INFO,"MODE="+e),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e},n.insertChars=function(e){for(var m=0;m<e.length;m++)this.writeScreen.insertChar(e[m]);var y=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(C.INFO,y+": "+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())},n.ccRCL=function(){this.logger.log(C.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},n.ccBS=function(){if(this.logger.log(C.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},n.ccAOF=function(){},n.ccAON=function(){},n.ccDER=function(){this.logger.log(C.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},n.ccRU=function(e){this.logger.log(C.INFO,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)},n.ccFON=function(){this.logger.log(C.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},n.ccRDC=function(){this.logger.log(C.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},n.ccTR=function(){this.logger.log(C.INFO,"TR"),this.setMode("MODE_TEXT")},n.ccRTD=function(){this.logger.log(C.INFO,"RTD"),this.setMode("MODE_TEXT")},n.ccEDM=function(){this.logger.log(C.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},n.ccCR=function(){this.logger.log(C.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},n.ccENM=function(){this.logger.log(C.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},n.ccEOC=function(){if(this.logger.log(C.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(C.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},n.ccTO=function(e){this.logger.log(C.INFO,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)},n.ccMIDROW=function(e){var m={flash:!1};if(m.underline=e%2===1,m.italics=e>=46,m.italics)m.foreground="white";else{var y=Math.floor(e/2)-16,_=["white","green","blue","cyan","red","yellow","magenta"];m.foreground=_[y]}this.logger.log(C.INFO,"MIDROW: "+JSON.stringify(m)),this.writeScreen.setPen(m)},n.outputDataUpdate=function(e){e===void 0&&(e=!1);var m=this.logger.time;if(m===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=m:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,m,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:m),this.lastOutputScreen.copy(this.displayedMemory))},n.cueSplitAtTime=function(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))},i}(),d=function(){function i(t,e,m){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var y=new b;this.channels=[null,new f(t,e,y),new f(t+1,m,y)],this.cmdHistory=c(),this.logger=y}var n=i.prototype;return n.getHandler=function(e){return this.channels[e].getHandler()},n.setHandler=function(e,m){this.channels[e].setHandler(m)},n.addData=function(e,m){var y,_,A,k=!1;this.logger.time=e;for(var F=0;F<m.length;F+=2){if(_=m[F]&127,A=m[F+1]&127,_===0&&A===0)continue;if(this.logger.log(C.DATA,"["+v([m[F],m[F+1]])+"] -> ("+v([_,A])+")"),y=this.parseCmd(_,A),y||(y=this.parseMidrow(_,A)),y||(y=this.parsePAC(_,A)),y||(y=this.parseBackgroundAttributes(_,A)),!y&&(k=this.parseChars(_,A),k)){var z=this.currentChannel;if(z&&z>0){var Q=this.channels[z];Q.insertChars(k)}else this.logger.log(C.WARNING,"No channel found yet. TEXT-MODE?")}!y&&!k&&this.logger.log(C.WARNING,"Couldn't parse cleaned data "+v([_,A])+" orig: "+v([m[F],m[F+1]]))}},n.parseCmd=function(e,m){var y=this.cmdHistory,_=(e===20||e===28||e===21||e===29)&&m>=32&&m<=47,A=(e===23||e===31)&&m>=33&&m<=35;if(!(_||A))return!1;if(p(e,m,y))return l(null,null,y),this.logger.log(C.DEBUG,"Repeated command ("+v([e,m])+") is dropped"),!0;var k=e===20||e===21||e===23?1:2,F=this.channels[k];return e===20||e===21||e===28||e===29?m===32?F.ccRCL():m===33?F.ccBS():m===34?F.ccAOF():m===35?F.ccAON():m===36?F.ccDER():m===37?F.ccRU(2):m===38?F.ccRU(3):m===39?F.ccRU(4):m===40?F.ccFON():m===41?F.ccRDC():m===42?F.ccTR():m===43?F.ccRTD():m===44?F.ccEDM():m===45?F.ccCR():m===46?F.ccENM():m===47&&F.ccEOC():F.ccTO(m-32),l(e,m,y),this.currentChannel=k,!0},n.parseMidrow=function(e,m){var y=0;if((e===17||e===25)&&m>=32&&m<=47){if(e===17?y=1:y=2,y!==this.currentChannel)return this.logger.log(C.ERROR,"Mismatch channel in midrow parsing"),!1;var _=this.channels[y];return _?(_.ccMIDROW(m),this.logger.log(C.DEBUG,"MIDROW ("+v([e,m])+")"),!0):!1}return!1},n.parsePAC=function(e,m){var y,_=this.cmdHistory,A=(e>=17&&e<=23||e>=25&&e<=31)&&m>=64&&m<=127,k=(e===16||e===24)&&m>=64&&m<=95;if(!(A||k))return!1;if(p(e,m,_))return l(null,null,_),!0;var F=e<=23?1:2;m>=64&&m<=95?y=F===1?R[e]:x[e]:y=F===1?w[e]:T[e];var z=this.channels[F];return z?(z.setPAC(this.interpretPAC(y,m)),l(e,m,_),this.currentChannel=F,!0):!1},n.interpretPAC=function(e,m){var y,_={color:null,italics:!1,indent:null,underline:!1,row:e};return m>95?y=m-96:y=m-64,_.underline=(y&1)===1,y<=13?_.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(y/2)]:y<=15?(_.italics=!0,_.color="white"):_.indent=Math.floor((y-16)/2)*4,_},n.parseChars=function(e,m){var y,_=null,A=null;if(e>=25?(y=2,A=e-8):(y=1,A=e),A>=17&&A<=19){var k;A===17?k=m+80:A===18?k=m+112:k=m+144,this.logger.log(C.INFO,"Special char '"+E(k)+"' in channel "+y),_=[k]}else e>=32&&e<=127&&(_=m===0?[e]:[e,m]);if(_){var F=v(_);this.logger.log(C.DEBUG,"Char codes = "+F.join(",")),l(e,m,this.cmdHistory)}return _},n.parseBackgroundAttributes=function(e,m){var y=(e===16||e===24)&&m>=32&&m<=47,_=(e===23||e===31)&&m>=45&&m<=47;if(!(y||_))return!1;var A,k={};e===16||e===24?(A=Math.floor((m-32)/2),k.background=O[A],m%2===1&&(k.background=k.background+"_semi")):m===45?k.background="transparent":(k.foreground="black",m===47&&(k.underline=!0));var F=e<=23?1:2,z=this.channels[F];return z.setBkgData(k),l(e,m,this.cmdHistory),!0},n.reset=function(){for(var e=0;e<Object.keys(this.channels).length;e++){var m=this.channels[e];m&&m.reset()}this.cmdHistory=c()},n.cueSplitAtTime=function(e){for(var m=0;m<this.channels.length;m++){var y=this.channels[m];y&&y.cueSplitAtTime(e)}},i}();function l(i,n,t){t.a=i,t.b=n}function p(i,n,t){return t.a===i&&t.b===n}function c(){return{a:null,b:null}}N.default=d},"./src/utils/codecs.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"isCodecType",function(){return g}),S.d(N,"isCodecSupportedInMp4",function(){return E});var I={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 g(U,M){var R=I[M];return!!R&&R[U.slice(0,4)]===!0}function E(U,M){return MediaSource.isTypeSupported((M||"video")+'/mp4;codecs="'+U+'"')}},"./src/utils/cues.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/utils/vttparser.ts"),g=S("./src/utils/webvtt-parser.ts"),E=S("./src/utils/texttrack-utils.ts"),U=/\s/,M={newCue:function(w,x,T,O){for(var C=[],b,v,h,r,o,s=self.VTTCue||self.TextTrackCue,f=0;f<O.rows.length;f++)if(b=O.rows[f],h=!0,r=0,o="",!b.isEmpty()){for(var d=0;d<b.chars.length;d++)U.test(b.chars[d].uchar)&&h?r++:(o+=b.chars[d].uchar,h=!1);b.cueStartTime=x,x===T&&(T+=1e-4),r>=16?r--:r++;var l=Object(I.fixLineBreaks)(o.trim()),p=Object(g.generateCueId)(x,T,l);(!w||!w.cues||!w.cues.getCueById(p))&&(v=new s(x,T,l),v.id=p,v.line=f+1,v.align="left",v.position=10+Math.min(80,Math.floor(r*8/32)*10),C.push(v))}return w&&C.length&&(C.sort(function(c,i){return c.line==="auto"||i.line==="auto"?0:c.line>8&&i.line>8?i.line-c.line:c.line-i.line}),C.forEach(function(c){return Object(E.addCueToTrack)(w,c)})),C}};N.default=M},"./src/utils/discontinuities.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"findFirstFragWithCC",function(){return U}),S.d(N,"shouldAlignOnDiscontinuities",function(){return M}),S.d(N,"findDiscontinuousReferenceFrag",function(){return R}),S.d(N,"adjustSlidingStart",function(){return x}),S.d(N,"alignStream",function(){return T}),S.d(N,"alignPDT",function(){return C}),S.d(N,"alignFragmentByPDTDelta",function(){return b}),S.d(N,"alignMediaPlaylistByPDT",function(){return v});var I=S("./src/polyfills/number.ts"),g=S("./src/utils/logger.ts"),E=S("./src/controller/level-helper.ts");function U(h,r){for(var o=null,s=0,f=h.length;s<f;s++){var d=h[s];if(d&&d.cc===r){o=d;break}}return o}function M(h,r,o){return!!(r.details&&(o.endCC>o.startCC||h&&h.cc<o.startCC))}function R(h,r){var o=h.fragments,s=r.fragments;if(!s.length||!o.length){g.logger.log("No fragments to align");return}var f=U(o,s[0].cc);if(!f||f&&!f.startPTS){g.logger.log("No frag in previous level to align on");return}return f}function w(h,r){if(h){var o=h.start+r;h.start=h.startPTS=o,h.endPTS=o+h.duration}}function x(h,r){for(var o=r.fragments,s=0,f=o.length;s<f;s++)w(o[s],h);r.fragmentHint&&w(r.fragmentHint,h),r.alignedSliding=!0}function T(h,r,o){if(!r)return;O(h,o,r),!o.alignedSliding&&r.details&&C(o,r.details),!o.alignedSliding&&r.details&&!o.skippedSegments&&Object(E.adjustSliding)(r.details,o)}function O(h,r,o){if(M(h,o,r)){var s=R(o.details,r);s&&Object(I.isFiniteNumber)(s.start)&&(g.logger.log("Adjusting PTS using last level due to CC increase within current level "+r.url),x(s.start,r))}}function C(h,r){if(!r.fragments.length||!h.hasProgramDateTime||!r.hasProgramDateTime)return;var o=r.fragments[0].programDateTime,s=h.fragments[0].programDateTime,f=(s-o)/1e3+r.fragments[0].start;f&&Object(I.isFiniteNumber)(f)&&(g.logger.log("Adjusting PTS using programDateTime delta "+(s-o)+"ms, sliding:"+f.toFixed(3)+" "+h.url+" "),x(f,h))}function b(h,r){var o=h.programDateTime;if(!o)return;var s=(o-r)/1e3;h.start=h.startPTS=s,h.endPTS=s+h.duration}function v(h,r){if(!r.fragments.length||!h.hasProgramDateTime||!r.hasProgramDateTime)return;var o=r.fragments[0].programDateTime,s=r.fragments[0].start,f=o-s*1e3;h.fragments.forEach(function(d){b(d,f)}),h.fragmentHint&&b(h.fragmentHint,f),h.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/utils/ewma.ts"),g=function(){function E(M,R,w){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=w,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new I.default(M),this.fast_=new I.default(R)}var U=E.prototype;return U.update=function(R,w){var x=this.slow_,T=this.fast_;this.slow_.halfLife!==R&&(this.slow_=new I.default(R,x.getEstimate(),x.getTotalWeight())),this.fast_.halfLife!==w&&(this.fast_=new I.default(w,T.getEstimate(),T.getTotalWeight()))},U.sample=function(R,w){R=Math.max(R,this.minDelayMs_);var x=8*w,T=R/1e3,O=x/T;this.fast_.sample(T,O),this.slow_.sample(T,O)},U.canEstimate=function(){var R=this.fast_;return R&&R.getTotalWeight()>=this.minWeight_},U.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},U.destroy=function(){},E}();N.default=g},"./src/utils/ewma.ts":function(oe,N,S){"use strict";S.r(N);var I=function(){function g(U,M,R){M===void 0&&(M=0),R===void 0&&(R=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=U,this.alpha_=U?Math.exp(Math.log(.5)/U):0,this.estimate_=M,this.totalWeight_=R}var E=g.prototype;return E.sample=function(M,R){var w=Math.pow(this.alpha_,M);this.estimate_=R*(1-w)+w*this.estimate_,this.totalWeight_+=M},E.getTotalWeight=function(){return this.totalWeight_},E.getEstimate=function(){if(this.alpha_){var M=1-Math.pow(this.alpha_,this.totalWeight_);if(M)return this.estimate_/M}return this.estimate_},g}();N.default=I},"./src/utils/fetch-loader.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"fetchSupported",function(){return b});var I=S("./src/polyfills/number.ts"),g=S("./src/loader/load-stats.ts"),E=S("./src/demux/chunk-cache.ts");function U(s,f){s.prototype=Object.create(f.prototype),s.prototype.constructor=s,T(s,f)}function M(s){var f=typeof Map=="function"?new Map:void 0;return M=function(l){if(l===null||!x(l))return l;if(typeof l!="function")throw new TypeError("Super expression must either be null or a function");if(typeof f!="undefined"){if(f.has(l))return f.get(l);f.set(l,p)}function p(){return R(l,arguments,O(this).constructor)}return p.prototype=Object.create(l.prototype,{constructor:{value:p,enumerable:!1,writable:!0,configurable:!0}}),T(p,l)},M(s)}function R(s,f,d){return w()?R=Reflect.construct:R=function(p,c,i){var n=[null];n.push.apply(n,c);var t=Function.bind.apply(p,n),e=new t;return i&&T(e,i.prototype),e},R.apply(null,arguments)}function w(){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(s){return!1}}function x(s){return Function.toString.call(s).indexOf("[native code]")!==-1}function T(s,f){return T=Object.setPrototypeOf||function(l,p){return l.__proto__=p,l},T(s,f)}function O(s){return O=Object.setPrototypeOf?Object.getPrototypeOf:function(d){return d.__proto__||Object.getPrototypeOf(d)},O(s)}function C(){return C=Object.assign||function(s){for(var f=1;f<arguments.length;f++){var d=arguments[f];for(var l in d)Object.prototype.hasOwnProperty.call(d,l)&&(s[l]=d[l])}return s},C.apply(this,arguments)}function b(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(s){}return!1}var v=function(){function s(d){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=d.fetchSetup||r,this.controller=new self.AbortController,this.stats=new g.LoadStats}var f=s.prototype;return f.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},f.abortInternal=function(){var l=this.response;(!l||!l.ok)&&(this.stats.aborted=!0,this.controller.abort())},f.abort=function(){var l;this.abortInternal(),(l=this.callbacks)!==null&&l!==void 0&&l.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},f.load=function(l,p,c){var i=this,n=this.stats;if(n.loading.start)throw new Error("Loader can only be used once.");n.loading.start=self.performance.now();var t=h(l,this.controller.signal),e=c.onProgress,m=l.responseType==="arraybuffer",y=m?"byteLength":"length";this.context=l,this.config=p,this.callbacks=c,this.request=this.fetchSetup(l,t),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){i.abortInternal(),c.onTimeout(n,l,i.response)},p.timeout),self.fetch(this.request).then(function(_){if(i.response=i.loader=_,!_.ok){var A=_.status,k=_.statusText;throw new o(k||"fetch, bad network response",A,_)}return n.loading.first=Math.max(self.performance.now(),n.loading.start),n.total=parseInt(_.headers.get("Content-Length")||"0"),e&&Object(I.isFiniteNumber)(p.highWaterMark)?i.loadProgressively(_,n,l,p.highWaterMark,e):m?_.arrayBuffer():_.text()}).then(function(_){var A=i.response;self.clearTimeout(i.requestTimeout),n.loading.end=Math.max(self.performance.now(),n.loading.first),n.loaded=n.total=_[y];var k={url:A.url,data:_};e&&!Object(I.isFiniteNumber)(p.highWaterMark)&&e(n,l,_,A),c.onSuccess(k,n,l,A)}).catch(function(_){if(self.clearTimeout(i.requestTimeout),n.aborted)return;var A=_.code||0;c.onError({code:A,text:_.message},l,_.details)})},f.getCacheAge=function(){var l=null;if(this.response){var p=this.response.headers.get("age");l=p?parseFloat(p):null}return l},f.loadProgressively=function(l,p,c,i,n){i===void 0&&(i=0);var t=new E.default,e=l.body.getReader(),m=function y(){return e.read().then(function(_){if(_.done)return t.dataLength&&n(p,c,t.flush(),l),Promise.resolve(new ArrayBuffer(0));var A=_.value,k=A.length;return p.loaded+=k,k<i||t.dataLength?(t.push(A),t.dataLength>=i&&n(p,c,t.flush(),l)):n(p,c,A,l),y()}).catch(function(){return Promise.reject()})};return m()},s}();function h(s,f){var d={method:"GET",mode:"cors",credentials:"same-origin",signal:f,headers:new self.Headers(C({},s.headers))};return s.rangeEnd&&d.headers.set("Range","bytes="+s.rangeStart+"-"+String(s.rangeEnd-1)),d}function r(s,f){return new self.Request(s.url,f)}var o=function(s){U(f,s);function f(d,l,p){var c;return c=s.call(this,d)||this,c.code=void 0,c.details=void 0,c.code=l,c.details=p,c}return f}(M(Error));N.default=v},"./src/utils/imsc1-ttml-parser.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"IMSC1_CODEC",function(){return x}),S.d(N,"parseIMSC1",function(){return b});var I=S("./src/utils/mp4-tools.ts"),g=S("./src/utils/vttparser.ts"),E=S("./src/utils/vttcue.ts"),U=S("./src/demux/id3.ts"),M=S("./src/utils/timescale-conversion.ts"),R=S("./src/utils/webvtt-parser.ts");function w(){return w=Object.assign||function(i){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(i[e]=t[e])}return i},w.apply(this,arguments)}var x="stpp.ttml.im1t",T=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,O=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,C={left:"start",center:"center",right:"end",start:"start",end:"end"};function b(i,n,t,e,m){var y=Object(I.findBox)(new Uint8Array(i),["mdat"]);if(y.length===0){m(new Error("Could not parse IMSC1 mdat"));return}var _=y[0],A=Object(U.utf8ArrayToStr)(new Uint8Array(i,_.start,_.end-_.start)),k=Object(M.toTimescaleFromScale)(n,1,t);try{e(v(A,k))}catch(F){m(F)}}function v(i,n){var t=new DOMParser,e=t.parseFromString(i,"text/xml"),m=e.getElementsByTagName("tt")[0];if(!m)throw new Error("Invalid ttml");var y={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},_=Object.keys(y).reduce(function(Q,Y){return Q[Y]=m.getAttribute("ttp:"+Y)||y[Y],Q},{}),A=m.getAttribute("xml:space")!=="preserve",k=r(h(m,"styling","style")),F=r(h(m,"layout","region")),z=h(m,"body","[begin]");return[].map.call(z,function(Q){var Y=o(Q,A);if(!Y||!Q.hasAttribute("begin"))return null;var X=l(Q.getAttribute("begin"),_),le=l(Q.getAttribute("dur"),_),ye=l(Q.getAttribute("end"),_);if(X===null)throw d(Q);if(ye===null){if(le===null)throw d(Q);ye=X+le}var ve=new E.default(X-n,ye-n,Y);ve.id=Object(R.generateCueId)(ve.startTime,ve.endTime,ve.text);var Ne=F[Q.getAttribute("region")],Te=k[Q.getAttribute("style")];ve.position=10,ve.size=80;var Ce=s(Ne,Te),_e=Ce.textAlign;if(_e){var Re=C[_e];Re&&(ve.lineAlign=Re),ve.align=_e}return w(ve,Ce),ve}).filter(function(Q){return Q!==null})}function h(i,n,t){var e=i.getElementsByTagName(n)[0];return e?[].slice.call(e.querySelectorAll(t)):[]}function r(i){return i.reduce(function(n,t){var e=t.getAttribute("xml:id");return e&&(n[e]=t),n},{})}function o(i,n){return[].slice.call(i.childNodes).reduce(function(t,e,m){var y;return e.nodeName==="br"&&m?t+`
`:(y=e.childNodes)!==null&&y!==void 0&&y.length?o(e,n):n?t+e.textContent.trim().replace(/\s+/g," "):t+e.textContent},"")}function s(i,n){var t="http://www.w3.org/ns/ttml#styling",e=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return e.reduce(function(m,y){var _=f(n,t,y)||f(i,t,y);return _&&(m[y]=_),m},{})}function f(i,n,t){return i.hasAttributeNS(n,t)?i.getAttributeNS(n,t):null}function d(i){return new Error("Could not parse ttml timestamp "+i)}function l(i,n){if(!i)return null;var t=Object(g.parseTimeStamp)(i);return t===null&&(T.test(i)?t=p(i,n):O.test(i)&&(t=c(i,n))),t}function p(i,n){var t=T.exec(i),e=(t[4]|0)+(t[5]|0)/n.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+e/n.frameRate}function c(i,n){var t=O.exec(i),e=Number(t[1]),m=t[2];switch(m){case"h":return e*3600;case"m":return e*60;case"ms":return e*1e3;case"f":return e/n.frameRate;case"t":return e/n.tickRate}return e}},"./src/utils/logger.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"enableLogs",function(){return R}),S.d(N,"logger",function(){return w});var I=function(){},g={trace:I,debug:I,log:I,warn:I,info:I,error:I},E=g;function U(x){var T=self.console[x];return T?T.bind(self.console,"["+x+"] >"):I}function M(x){for(var T=arguments.length,O=new Array(T>1?T-1:0),C=1;C<T;C++)O[C-1]=arguments[C];O.forEach(function(b){E[b]=x[b]?x[b].bind(x):U(b)})}function R(x){if(self.console&&x===!0||typeof x=="object"){M(x,"debug","log","info","warn","error");try{E.log()}catch(T){E=g}}else E=g}var w=E},"./src/utils/mediakeys-helper.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"KeySystems",function(){return I}),S.d(N,"requestMediaKeySystemAccess",function(){return g});var I;(function(E){E.WIDEVINE="com.widevine.alpha",E.PLAYREADY="com.microsoft.playready"})(I||(I={}));var g=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"getMediaSource",function(){return I});function I(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"bin2str",function(){return M}),S.d(N,"readUint16",function(){return R}),S.d(N,"readUint32",function(){return w}),S.d(N,"writeUint32",function(){return x}),S.d(N,"findBox",function(){return T}),S.d(N,"parseSegmentIndex",function(){return O}),S.d(N,"parseInitSegment",function(){return C}),S.d(N,"getStartDTS",function(){return b}),S.d(N,"getDuration",function(){return v}),S.d(N,"computeRawDurationFromSamples",function(){return h}),S.d(N,"offsetStartDTS",function(){return r}),S.d(N,"segmentValidRange",function(){return o}),S.d(N,"appendUint8Array",function(){return s});var I=S("./src/utils/typed-array.ts"),g=S("./src/loader/fragment.ts"),E=Math.pow(2,32)-1,U=[].push;function M(f){return String.fromCharCode.apply(null,f)}function R(f,d){"data"in f&&(d+=f.start,f=f.data);var l=f[d]<<8|f[d+1];return l<0?65536+l:l}function w(f,d){"data"in f&&(d+=f.start,f=f.data);var l=f[d]<<24|f[d+1]<<16|f[d+2]<<8|f[d+3];return l<0?4294967296+l:l}function x(f,d,l){"data"in f&&(d+=f.start,f=f.data),f[d]=l>>24,f[d+1]=l>>16&255,f[d+2]=l>>8&255,f[d+3]=l&255}function T(f,d){var l=[];if(!d.length)return l;var p,c,i;"data"in f?(p=f.data,c=f.start,i=f.end):(p=f,c=0,i=p.byteLength);for(var n=c;n<i;){var t=w(p,n),e=M(p.subarray(n+4,n+8)),m=t>1?n+t:i;if(e===d[0])if(d.length===1)l.push({data:p,start:n+8,end:m});else{var y=T({data:p,start:n+8,end:m},d.slice(1));y.length&&U.apply(l,y)}n=m}return l}function O(f){var d=T(f,["moov"]),l=d[0],p=l?l.end:null,c=T(f,["sidx"]);if(!c||!c[0])return null;var i=[],n=c[0],t=n.data[0],e=t===0?8:16,m=w(n,e);e+=4;var y=0,_=0;t===0?e+=8:e+=16,e+=2;var A=n.end+_,k=R(n,e);e+=2;for(var F=0;F<k;F++){var z=e,Q=w(n,z);z+=4;var Y=Q&2147483647,X=(Q&2147483648)>>>31;if(X===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var le=w(n,z);z+=4,i.push({referenceSize:Y,subsegmentDuration:le,info:{duration:le/m,start:A,end:A+Y-1}}),A+=Y,z+=4,e=z}return{earliestPresentationTime:y,timescale:m,version:t,referencesCount:k,references:i,moovEndOffset:p}}function C(f){for(var d=[],l=T(f,["moov","trak"]),p=0;p<l.length;p++){var c=l[p],i=T(c,["tkhd"])[0];if(i){var n=i.data[i.start],t=n===0?12:20,e=w(i,t),m=T(c,["mdia","mdhd"])[0];if(m){n=m.data[m.start],t=n===0?12:20;var y=w(m,t),_=T(c,["mdia","hdlr"])[0];if(_){var A=M(_.data.subarray(_.start+8,_.start+12)),k={soun:g.ElementaryStreamTypes.AUDIO,vide:g.ElementaryStreamTypes.VIDEO}[A];if(k){var F=T(c,["mdia","minf","stbl","stsd"])[0],z=void 0;F&&(z=M(F.data.subarray(F.start+12,F.start+16))),d[e]={timescale:y,type:k},d[k]={timescale:y,id:e,codec:z}}}}}}var Q=T(f,["moov","mvex","trex"]);return Q.forEach(function(Y){var X=w(Y,4),le=d[X];le&&(le.default={duration:w(Y,12),flags:w(Y,20)})}),d}function b(f,d){return T(d,["moof","traf"]).reduce(function(l,p){var c=T(p,["tfdt"])[0],i=c.data[c.start],n=T(p,["tfhd"]).reduce(function(t,e){var m=w(e,4),y=f[m];if(y){var _=w(c,4);i===1&&(_*=Math.pow(2,32),_+=w(c,8));var A=y.timescale||9e4,k=_/A;if(isFinite(k)&&(t===null||k<t))return k}return t},null);return n!==null&&isFinite(n)&&(l===null||n<l)?n:l},null)||0}function v(f,d){for(var l=0,p=0,c=0,i=T(f,["moof","traf"]),n=0;n<i.length;n++){var t=i[n],e=T(t,["tfhd"])[0],m=w(e,4),y=d[m];if(!y)continue;var _=y.default,A=w(e,0)|(_==null?void 0:_.flags),k=_==null?void 0:_.duration;A&8&&(A&2?k=w(e,12):k=w(e,8));for(var F=y.timescale||9e4,z=T(t,["trun"]),Q=0;Q<z.length;Q++){if(k){var Y=w(z[Q],4);l=k*Y}else l=h(z[Q]);y.type===g.ElementaryStreamTypes.VIDEO?p+=l/F:y.type===g.ElementaryStreamTypes.AUDIO&&(c+=l/F)}}if(p===0&&c===0){var X=O(f);if(X!=null&&X.references)return X.references.reduce(function(le,ye){return le+ye.info.duration||0},0)}return p||c}function h(f){var d=w(f,0),l=8;d&1&&(l+=4),d&4&&(l+=4);for(var p=0,c=w(f,4),i=0;i<c;i++){if(d&256){var n=w(f,l);p+=n,l+=4}d&512&&(l+=4),d&1024&&(l+=4),d&2048&&(l+=4)}return p}function r(f,d,l){T(d,["moof","traf"]).forEach(function(p){T(p,["tfhd"]).forEach(function(c){var i=w(c,4),n=f[i];if(!n)return;var t=n.timescale||9e4;T(p,["tfdt"]).forEach(function(e){var m=e.data[e.start],y=w(e,4);if(m===0)x(e,4,y-l*t);else{y*=Math.pow(2,32),y+=w(e,8),y-=l*t,y=Math.max(y,0);var _=Math.floor(y/(E+1)),A=Math.floor(y%(E+1));x(e,4,_),x(e,8,A)}})})})}function o(f){var d={valid:null,remainder:null},l=T(f,["moof"]);if(l){if(l.length<2)return d.remainder=f,d}else return d;var p=l[l.length-1];return d.valid=Object(I.sliceUint8)(f,0,p.start-8),d.remainder=Object(I.sliceUint8)(f,p.start-8),d}function s(f,d){var l=new Uint8Array(f.length+d.length);return l.set(f),l.set(d,f.length),l}},"./src/utils/output-filter.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return I});var I=function(){function g(U,M){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=U,this.trackName=M}var E=g.prototype;return E.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},E.newCue=function(M,R,w){(this.startTime===null||this.startTime>M)&&(this.startTime=M),this.endTime=R,this.screen=w,this.timelineController.createCaptionsTrack(this.trackName)},E.reset=function(){this.cueRanges=[]},g}()},"./src/utils/texttrack-utils.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"sendAddTrackEvent",function(){return g}),S.d(N,"addCueToTrack",function(){return E}),S.d(N,"clearCurrentCues",function(){return U}),S.d(N,"removeCuesInRange",function(){return M}),S.d(N,"getCuesInRange",function(){return w});var I=S("./src/utils/logger.ts");function g(x,T){var O;try{O=new Event("addtrack")}catch(C){O=document.createEvent("Event"),O.initEvent("addtrack",!1,!1)}O.track=x,T.dispatchEvent(O)}function E(x,T){var O=x.mode;if(O==="disabled"&&(x.mode="hidden"),x.cues&&!x.cues.getCueById(T.id))try{if(x.addCue(T),!x.cues.getCueById(T.id))throw new Error("addCue is failed for: "+T)}catch(b){I.logger.debug("[texttrack-utils]: "+b);var C=new self.TextTrackCue(T.startTime,T.endTime,T.text);C.id=T.id,x.addCue(C)}O==="disabled"&&(x.mode=O)}function U(x){var T=x.mode;if(T==="disabled"&&(x.mode="hidden"),x.cues)for(var O=x.cues.length;O--;)x.removeCue(x.cues[O]);T==="disabled"&&(x.mode=T)}function M(x,T,O){var C=x.mode;if(C==="disabled"&&(x.mode="hidden"),x.cues&&x.cues.length>0)for(var b=w(x.cues,T,O),v=0;v<b.length;v++)x.removeCue(b[v]);C==="disabled"&&(x.mode=C)}function R(x,T){if(T<x[0].startTime)return 0;var O=x.length-1;if(T>x[O].endTime)return-1;for(var C=0,b=O;C<=b;){var v=Math.floor((b+C)/2);if(T<x[v].startTime)b=v-1;else if(T>x[v].startTime&&C<O)C=v+1;else return v}return x[C].startTime-T<T-x[b].startTime?C:b}function w(x,T,O){var C=[],b=R(x,T);if(b>-1)for(var v=b,h=x.length;v<h;v++){var r=x[v];if(r.startTime>=T&&r.endTime<=O)C.push(r);else if(r.startTime>O)return C}return C}},"./src/utils/time-ranges.ts":function(oe,N,S){"use strict";S.r(N);var I={toString:function(E){for(var U="",M=E.length,R=0;R<M;R++)U+="["+E.start(R).toFixed(3)+","+E.end(R).toFixed(3)+"]";return U}};N.default=I},"./src/utils/timescale-conversion.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"toTimescaleFromBase",function(){return g}),S.d(N,"toTimescaleFromScale",function(){return E}),S.d(N,"toMsFromMpegTsClock",function(){return U}),S.d(N,"toMpegTsClockFromTimescale",function(){return M});var I=9e4;function g(R,w,x,T){x===void 0&&(x=1),T===void 0&&(T=!1);var O=R*w*x;return T?Math.round(O):O}function E(R,w,x,T){return x===void 0&&(x=1),T===void 0&&(T=!1),g(R,w,1/x,T)}function U(R,w){return w===void 0&&(w=!1),g(R,1e3,1/I,w)}function M(R,w){return w===void 0&&(w=1),g(R,I,1/w)}},"./src/utils/typed-array.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"sliceUint8",function(){return I});function I(g,E,U){return Uint8Array.prototype.slice?g.slice(E,U):new Uint8Array(Array.prototype.slice.call(g,E,U))}},"./src/utils/vttcue.ts":function(oe,N,S){"use strict";S.r(N),N.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var I=["","lr","rl"],g=["start","middle","end","left","right"];function E(x,T){if(typeof T!="string")return!1;if(!Array.isArray(x))return!1;var O=T.toLowerCase();return~x.indexOf(O)?O:!1}function U(x){return E(I,x)}function M(x){return E(g,x)}function R(x){for(var T=arguments.length,O=new Array(T>1?T-1:0),C=1;C<T;C++)O[C-1]=arguments[C];for(var b=1;b<arguments.length;b++){var v=arguments[b];for(var h in v)x[h]=v[h]}return x}function w(x,T,O){var C=this,b={enumerable:!0};C.hasBeenReset=!1;var v="",h=!1,r=x,o=T,s=O,f=null,d="",l=!0,p="auto",c="start",i=50,n="middle",t=50,e="middle";Object.defineProperty(C,"id",R({},b,{get:function(){return v},set:function(y){v=""+y}})),Object.defineProperty(C,"pauseOnExit",R({},b,{get:function(){return h},set:function(y){h=!!y}})),Object.defineProperty(C,"startTime",R({},b,{get:function(){return r},set:function(y){if(typeof y!="number")throw new TypeError("Start time must be set to a number.");r=y,this.hasBeenReset=!0}})),Object.defineProperty(C,"endTime",R({},b,{get:function(){return o},set:function(y){if(typeof y!="number")throw new TypeError("End time must be set to a number.");o=y,this.hasBeenReset=!0}})),Object.defineProperty(C,"text",R({},b,{get:function(){return s},set:function(y){s=""+y,this.hasBeenReset=!0}})),Object.defineProperty(C,"region",R({},b,{get:function(){return f},set:function(y){f=y,this.hasBeenReset=!0}})),Object.defineProperty(C,"vertical",R({},b,{get:function(){return d},set:function(y){var _=U(y);if(_===!1)throw new SyntaxError("An invalid or illegal string was specified.");d=_,this.hasBeenReset=!0}})),Object.defineProperty(C,"snapToLines",R({},b,{get:function(){return l},set:function(y){l=!!y,this.hasBeenReset=!0}})),Object.defineProperty(C,"line",R({},b,{get:function(){return p},set:function(y){if(typeof y!="number"&&y!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");p=y,this.hasBeenReset=!0}})),Object.defineProperty(C,"lineAlign",R({},b,{get:function(){return c},set:function(y){var _=M(y);if(!_)throw new SyntaxError("An invalid or illegal string was specified.");c=_,this.hasBeenReset=!0}})),Object.defineProperty(C,"position",R({},b,{get:function(){return i},set:function(y){if(y<0||y>100)throw new Error("Position must be between 0 and 100.");i=y,this.hasBeenReset=!0}})),Object.defineProperty(C,"positionAlign",R({},b,{get:function(){return n},set:function(y){var _=M(y);if(!_)throw new SyntaxError("An invalid or illegal string was specified.");n=_,this.hasBeenReset=!0}})),Object.defineProperty(C,"size",R({},b,{get:function(){return t},set:function(y){if(y<0||y>100)throw new Error("Size must be between 0 and 100.");t=y,this.hasBeenReset=!0}})),Object.defineProperty(C,"align",R({},b,{get:function(){return e},set:function(y){var _=M(y);if(!_)throw new SyntaxError("An invalid or illegal string was specified.");e=_,this.hasBeenReset=!0}})),C.displayState=void 0}return w.prototype.getCueAsHTML=function(){var x=self.WebVTT;return x.convertCueToDOMTree(self,this.text)},w}()},"./src/utils/vttparser.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"parseTimeStamp",function(){return E}),S.d(N,"fixLineBreaks",function(){return T}),S.d(N,"VTTParser",function(){return O});var I=S("./src/utils/vttcue.ts"),g=function(){function C(){}var b=C.prototype;return b.decode=function(h,r){if(!h)return"";if(typeof h!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(h))},C}();function E(C){function b(h,r,o,s){return(h|0)*3600+(r|0)*60+(o|0)+parseFloat(s||0)}var v=C.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return v?parseFloat(v[2])>59?b(v[2],v[3],0,v[4]):b(v[1],v[2],v[3],v[4]):null}var U=function(){function C(){this.values=Object.create(null)}var b=C.prototype;return b.set=function(h,r){!this.get(h)&&r!==""&&(this.values[h]=r)},b.get=function(h,r,o){return o?this.has(h)?this.values[h]:r[o]:this.has(h)?this.values[h]:r},b.has=function(h){return h in this.values},b.alt=function(h,r,o){for(var s=0;s<o.length;++s)if(r===o[s]){this.set(h,r);break}},b.integer=function(h,r){/^-?\d+$/.test(r)&&this.set(h,parseInt(r,10))},b.percent=function(h,r){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(r)){var o=parseFloat(r);if(o>=0&&o<=100)return this.set(h,o),!0}return!1},C}();function M(C,b,v,h){var r=h?C.split(h):[C];for(var o in r){if(typeof r[o]!="string")continue;var s=r[o].split(v);if(s.length!==2)continue;var f=s[0],d=s[1];b(f,d)}}var R=new I.default(0,0,""),w=R.align==="middle"?"middle":"center";function x(C,b,v){var h=C;function r(){var f=E(C);if(f===null)throw new Error("Malformed timestamp: "+h);return C=C.replace(/^[^\sa-zA-Z-]+/,""),f}function o(f,d){var l=new U;M(f,function(i,n){var t;switch(i){case"region":for(var e=v.length-1;e>=0;e--)if(v[e].id===n){l.set(i,v[e].region);break}break;case"vertical":l.alt(i,n,["rl","lr"]);break;case"line":t=n.split(","),l.integer(i,t[0]),l.percent(i,t[0])&&l.set("snapToLines",!1),l.alt(i,t[0],["auto"]),t.length===2&&l.alt("lineAlign",t[1],["start",w,"end"]);break;case"position":t=n.split(","),l.percent(i,t[0]),t.length===2&&l.alt("positionAlign",t[1],["start",w,"end","line-left","line-right","auto"]);break;case"size":l.percent(i,n);break;case"align":l.alt(i,n,["start",w,"end","left","right"]);break}},/:/,/\s/),d.region=l.get("region",null),d.vertical=l.get("vertical","");var p=l.get("line","auto");p==="auto"&&R.line===-1&&(p=-1),d.line=p,d.lineAlign=l.get("lineAlign","start"),d.snapToLines=l.get("snapToLines",!0),d.size=l.get("size",100),d.align=l.get("align",w);var c=l.get("position","auto");c==="auto"&&R.position===50&&(c=d.align==="start"||d.align==="left"?0:d.align==="end"||d.align==="right"?100:50),d.position=c}function s(){C=C.replace(/^\s+/,"")}if(s(),b.startTime=r(),s(),C.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+h);C=C.substr(3),s(),b.endTime=r(),s(),o(C,b)}function T(C){return C.replace(/<br(?: \/)?>/gi,`
`)}var O=function(){function C(){this.state="INITIAL",this.buffer="",this.decoder=new g,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var b=C.prototype;return b.parse=function(h){var r=this;h&&(r.buffer+=r.decoder.decode(h,{stream:!0}));function o(){var c=r.buffer,i=0;for(c=T(c);i<c.length&&c[i]!=="\r"&&c[i]!==`
`;)++i;var n=c.substr(0,i);return c[i]==="\r"&&++i,c[i]===`
`&&++i,r.buffer=c.substr(i),n}function s(c){M(c,function(i,n){},/:/)}try{var f="";if(r.state==="INITIAL"){if(!/\r\n|\n/.test(r.buffer))return this;f=o();var d=f.match(/^()?WEBVTT([ \t].*)?$/);if(!d||!d[0])throw new Error("Malformed WebVTT signature.");r.state="HEADER"}for(var l=!1;r.buffer;){if(!/\r\n|\n/.test(r.buffer))return this;l?l=!1:f=o();switch(r.state){case"HEADER":/:/.test(f)?s(f):f||(r.state="ID");continue;case"NOTE":f||(r.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(f)){r.state="NOTE";break}if(!f)continue;if(r.cue=new I.default(0,0,""),r.state="CUE",f.indexOf("-->")===-1){r.cue.id=f;continue}case"CUE":if(!r.cue){r.state="BADCUE";continue}try{x(f,r.cue,r.regionList)}catch(c){r.cue=null,r.state="BADCUE";continue}r.state="CUETEXT";continue;case"CUETEXT":{var p=f.indexOf("-->")!==-1;if(!f||p&&(l=!0)){r.oncue&&r.cue&&r.oncue(r.cue),r.cue=null,r.state="ID";continue}if(r.cue===null)continue;r.cue.text&&(r.cue.text+=`
`),r.cue.text+=f}continue;case"BADCUE":f||(r.state="ID")}}}catch(c){r.state==="CUETEXT"&&r.cue&&r.oncue&&r.oncue(r.cue),r.cue=null,r.state=r.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},b.flush=function(){var h=this;try{if((h.cue||h.state==="HEADER")&&(h.buffer+=`
`,h.parse()),h.state==="INITIAL"||h.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(r){h.onparsingerror&&h.onparsingerror(r)}return h.onflush&&h.onflush(),this},C}()},"./src/utils/webvtt-parser.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"generateCueId",function(){return O}),S.d(N,"parseWebVTT",function(){return b});var I=S("./src/polyfills/number.ts"),g=S("./src/utils/vttparser.ts"),E=S("./src/demux/id3.ts"),U=S("./src/utils/timescale-conversion.ts"),M=S("./src/remux/mp4-remuxer.ts"),R=/\r\n|\n\r|\n|\r/g,w=function(h,r,o){return o===void 0&&(o=0),h.substr(o,r.length)===r},x=function(h){var r=parseInt(h.substr(-3)),o=parseInt(h.substr(-6,2)),s=parseInt(h.substr(-9,2)),f=h.length>9?parseInt(h.substr(0,h.indexOf(":"))):0;if(!Object(I.isFiniteNumber)(r)||!Object(I.isFiniteNumber)(o)||!Object(I.isFiniteNumber)(s)||!Object(I.isFiniteNumber)(f))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+h);return r+=1e3*o,r+=60*1e3*s,r+=60*60*1e3*f,r},T=function(h){for(var r=5381,o=h.length;o;)r=r*33^h.charCodeAt(--o);return(r>>>0).toString()};function O(v,h,r){return T(v.toString())+T(h.toString())+T(r)}var C=function(h,r,o){var s=h[r],f=h[s.prevCC];if(!f||!f.new&&s.new){h.ccOffset=h.presentationOffset=s.start,s.new=!1;return}for(;(d=f)!==null&&d!==void 0&&d.new;){var d;h.ccOffset+=s.start-f.start,s.new=!1,s=f,f=h[s.prevCC]}h.presentationOffset=o};function b(v,h,r,o,s,f,d,l){var p=new g.VTTParser,c=Object(E.utf8ArrayToStr)(new Uint8Array(v)).trim().replace(R,`
`).split(`
`),i=[],n=Object(U.toMpegTsClockFromTimescale)(h,r),t="00:00.000",e=0,m=0,y,_=!0,A=!1;p.oncue=function(k){var F=o[s],z=o.ccOffset,Q=(e-n)/9e4;if(F!=null&&F.new&&(m!==void 0?z=o.ccOffset=F.start:C(o,s,Q)),Q&&(z=Q-o.presentationOffset),A){var Y=k.endTime-k.startTime,X=Object(M.normalizePts)((k.startTime+z-m)*9e4,f*9e4)/9e4;k.startTime=X,k.endTime=X+Y}var le=k.text.trim();k.text=decodeURIComponent(encodeURIComponent(le)),k.id||(k.id=O(k.startTime,k.endTime,le)),k.endTime>0&&i.push(k)},p.onparsingerror=function(k){y=k},p.onflush=function(){if(y){l(y);return}d(i)},c.forEach(function(k){if(_)if(w(k,"X-TIMESTAMP-MAP=")){_=!1,A=!0,k.substr(16).split(",").forEach(function(F){w(F,"LOCAL:")?t=F.substr(6):w(F,"MPEGTS:")&&(e=parseInt(F.substr(7)))});try{m=x(t)/1e3}catch(F){A=!1,y=F}return}else k===""&&(_=!1);p.parse(k+`
`)}),p.flush()}},"./src/utils/xhr-loader.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/utils/logger.ts"),g=S("./src/loader/load-stats.ts"),E=/^age:\s*[\d.]+\s*$/m,U=function(){function M(w){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=w?w.xhrSetup:null,this.stats=new g.LoadStats,this.retryDelay=0}var R=M.prototype;return R.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},R.abortInternal=function(){var x=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),x&&(x.onreadystatechange=null,x.onprogress=null,x.readyState!==4&&(this.stats.aborted=!0,x.abort()))},R.abort=function(){var x;this.abortInternal(),(x=this.callbacks)!==null&&x!==void 0&&x.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},R.load=function(x,T,O){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=x,this.config=T,this.callbacks=O,this.retryDelay=T.retryDelay,this.loadInternal()},R.loadInternal=function(){var x=this.config,T=this.context;if(!x)return;var O=this.loader=new self.XMLHttpRequest,C=this.stats;C.loading.first=0,C.loaded=0;var b=this.xhrSetup;try{if(b)try{b(O,T.url)}catch(r){O.open("GET",T.url,!0),b(O,T.url)}O.readyState||O.open("GET",T.url,!0);var v=this.context.headers;if(v)for(var h in v)O.setRequestHeader(h,v[h])}catch(r){this.callbacks.onError({code:O.status,text:r.message},T,O);return}T.rangeEnd&&O.setRequestHeader("Range","bytes="+T.rangeStart+"-"+(T.rangeEnd-1)),O.onreadystatechange=this.readystatechange.bind(this),O.onprogress=this.loadprogress.bind(this),O.responseType=T.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),x.timeout),O.send()},R.readystatechange=function(){var x=this.context,T=this.loader,O=this.stats;if(!x||!T)return;var C=T.readyState,b=this.config;if(O.aborted)return;if(C>=2)if(self.clearTimeout(this.requestTimeout),O.loading.first===0&&(O.loading.first=Math.max(self.performance.now(),O.loading.start)),C===4){T.onreadystatechange=null,T.onprogress=null;var v=T.status;if(v>=200&&v<300){O.loading.end=Math.max(self.performance.now(),O.loading.first);var h,r;if(x.responseType==="arraybuffer"?(h=T.response,r=h.byteLength):(h=T.responseText,r=h.length),O.loaded=O.total=r,!this.callbacks)return;var o=this.callbacks.onProgress;if(o&&o(O,x,h,T),!this.callbacks)return;var s={url:T.responseURL,data:h};this.callbacks.onSuccess(s,O,x,T)}else O.retry>=b.maxRetry||v>=400&&v<499?(I.logger.error(v+" while loading "+x.url),this.callbacks.onError({code:v,text:T.statusText},x,T)):(I.logger.warn(v+" while loading "+x.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,b.maxRetryDelay),O.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),b.timeout)},R.loadtimeout=function(){I.logger.warn("timeout while loading "+this.context.url);var x=this.callbacks;x&&(this.abortInternal(),x.onTimeout(this.stats,this.context,this.loader))},R.loadprogress=function(x){var T=this.stats;T.loaded=x.loaded,x.lengthComputable&&(T.total=x.total)},R.getCacheAge=function(){var x=null;if(this.loader&&E.test(this.loader.getAllResponseHeaders())){var T=this.loader.getResponseHeader("age");x=T?parseFloat(T):null}return x},M}();N.default=U}}).default})},vHTk:function(ft,ze,K){ft.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wCXF:function(ft,ze,K){"use strict";K.d(ze,"a",function(){return st});var oe=K("rePB"),N=K("VTBJ"),S=K("KQm4"),I=K("U8pU"),g=K("ODXe"),E=K("q1tI"),U=K("TSYQ"),M=K.n(U),R=K("Gytx"),w=K.n(R),x=K("Kwbf"),T=K("t23M"),O=K("qx4F"),C=K("6eGT"),b=K("IBYe"),v=K("Ff2n"),h=K("c+Xe"),r=K("fyJ8"),o=K("biw7");function s(fe,be,we,ke,xe){var Oe=we[fe]||{},ae=we[be]||{},ee,te;Oe.fixed==="left"?ee=ke.left[fe]:ae.fixed==="right"&&(te=ke.right[be]);var H=!1,G=!1,V=!1,J=!1,de=we[be+1],ge=we[fe-1];if(xe==="rtl"){if(ee!==void 0){var Me=ge&&ge.fixed==="left";J=!Me}else if(te!==void 0){var et=de&&de.fixed==="right";V=!et}}else if(ee!==void 0){var dt=de&&de.fixed==="left";H=!dt}else if(te!==void 0){var qe=ge&&ge.fixed==="right";G=!qe}return{fixLeft:ee,fixRight:te,lastFixLeft:H,firstFixRight:G,lastFixRight:V,firstFixLeft:J,isSticky:ke.isSticky}}var f=K("sR1s");function d(fe){var be=fe.cells,we=fe.stickyOffsets,ke=fe.flattenColumns,xe=fe.rowComponent,Oe=fe.cellComponent,ae=fe.onHeaderRow,ee=fe.index,te=E.useContext(o.a),H=te.prefixCls,G=te.direction,V;ae&&(V=ae(be.map(function(de){return de.column}),ee));var J=Object(f.a)(be.map(function(de){return de.column}));return E.createElement(xe,Object.assign({},V),be.map(function(de,ge){var Me=de.column,et=s(de.colStart,de.colEnd,ke,we,G),dt;return Me&&Me.onHeaderCell&&(dt=de.column.onHeaderCell(Me)),E.createElement(r.a,Object.assign({},de,{ellipsis:Me.ellipsis,align:Me.align,component:Oe,prefixCls:H,key:J[ge]},et,{additionalProps:dt,rowType:"header"}))}))}d.displayName="HeaderRow";var l=d;function p(fe){var be=[];function we(ae,ee){var te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;be[te]=be[te]||[];var H=ee,G=ae.filter(Boolean).map(function(V){var J={key:V.key,className:V.className||"",children:V.title,column:V,colStart:H},de=1,ge=V.children;return ge&&ge.length>0&&(de=we(ge,H,te+1).reduce(function(Me,et){return Me+et},0),J.hasSubColumns=!0),"colSpan"in V&&(de=V.colSpan),"rowSpan"in V&&(J.rowSpan=V.rowSpan),J.colSpan=de,J.colEnd=J.colStart+de-1,be[te].push(J),H+=de,de});return G}we(fe,0);for(var ke=be.length,xe=function(ee){be[ee].forEach(function(te){!("rowSpan"in te)&&!te.hasSubColumns&&(te.rowSpan=ke-ee)})},Oe=0;Oe<ke;Oe+=1)xe(Oe);return be}function c(fe){var be=fe.stickyOffsets,we=fe.columns,ke=fe.flattenColumns,xe=fe.onHeaderRow,Oe=E.useContext(o.a),ae=Oe.prefixCls,ee=Oe.getComponent,te=E.useMemo(function(){return p(we)},[we]),H=ee(["header","wrapper"],"thead"),G=ee(["header","row"],"tr"),V=ee(["header","cell"],"th");return E.createElement(H,{className:"".concat(ae,"-thead")},te.map(function(J,de){var ge=E.createElement(l,{key:de,flattenColumns:ke,cells:J,stickyOffsets:be,rowComponent:G,cellComponent:V,onHeaderRow:xe,index:de});return ge}))}var i=c,n=K("hW8S");function t(fe){for(var be=fe.colWidths,we=fe.columns,ke=fe.columCount,xe=[],Oe=ke||we.length,ae=!1,ee=Oe-1;ee>=0;ee-=1){var te=be[ee],H=we&&we[ee],G=H&&H[n.a];(te||G||ae)&&(xe.unshift(E.createElement("col",Object.assign({key:ee,style:{width:te,minWidth:te}},G))),ae=!0)}return E.createElement("colgroup",null,xe)}var e=t;function m(fe,be){return Object(E.useMemo)(function(){for(var we=[],ke=0;ke<be;ke+=1){var xe=fe[ke];if(xe!==void 0)we[ke]=xe;else return null}return we},[fe.join("_"),be])}var y=E.forwardRef(function(fe,be){var we=fe.noData,ke=fe.columns,xe=fe.flattenColumns,Oe=fe.colWidths,ae=fe.columCount,ee=fe.stickyOffsets,te=fe.direction,H=fe.fixHeader,G=fe.offsetHeader,V=fe.stickyClassName,J=fe.onScroll,de=Object(v.a)(fe,["noData","columns","flattenColumns","colWidths","columCount","stickyOffsets","direction","fixHeader","offsetHeader","stickyClassName","onScroll"]),ge=E.useContext(o.a),Me=ge.prefixCls,et=ge.scrollbarSize,dt=ge.isSticky,qe=dt&&!H?0:et,Ct=E.useRef(null),_t=E.useCallback(function(Bt){Object(h.b)(be,Bt),Object(h.b)(Ct,Bt)},[]);E.useEffect(function(){var Bt;function Nt(Je){var Yt=Je.currentTarget,or=Je.deltaX;or&&(J({currentTarget:Yt,scrollLeft:Yt.scrollLeft+or}),Je.preventDefault())}return(Bt=Ct.current)===null||Bt===void 0||Bt.addEventListener("wheel",Nt),function(){var Je;(Je=Ct.current)===null||Je===void 0||Je.removeEventListener("wheel",Nt)}},[]);var at=xe[xe.length-1],It={fixed:at?at.fixed:null,onHeaderCell:function(){return{className:"".concat(Me,"-cell-scrollbar")}}},At=Object(E.useMemo)(function(){return qe?[].concat(Object(S.a)(ke),[It]):ke},[qe,ke]),Ot=Object(E.useMemo)(function(){return qe?[].concat(Object(S.a)(xe),[It]):xe},[qe,xe]),Wt=Object(E.useMemo)(function(){var Bt=ee.right,Nt=ee.left;return Object(N.a)(Object(N.a)({},ee),{},{left:te==="rtl"?[].concat(Object(S.a)(Nt.map(function(Je){return Je+qe})),[0]):Nt,right:te==="rtl"?Bt:[].concat(Object(S.a)(Bt.map(function(Je){return Je+qe})),[0]),isSticky:dt})},[qe,ee,dt]),gt=m(Oe,ae);return E.createElement("div",{style:Object(N.a)({overflow:"hidden"},dt?{top:G}:{}),ref:_t,className:M()("".concat(Me,"-header"),Object(oe.a)({},V,!!V))},E.createElement("table",{style:{tableLayout:"fixed",visibility:we||gt?null:"hidden"}},E.createElement(e,{colWidths:gt?[].concat(Object(S.a)(gt),[qe]):[],columCount:ae+1,columns:Ot}),E.createElement(i,Object.assign({},de,{stickyOffsets:Wt,columns:At,flattenColumns:Ot}))))});y.displayName="FixedHeader";var _=y,A=E.createContext(null),k=A;function F(fe){var be=fe.prefixCls,we=fe.children,ke=fe.component,xe=fe.cellComponent,Oe=fe.fixHeader,ae=fe.fixColumn,ee=fe.horizonScroll,te=fe.className,H=fe.expanded,G=fe.componentWidth,V=fe.colSpan,J=E.useContext(o.a),de=J.scrollbarSize;return E.useMemo(function(){var ge=we;return ae&&(ge=E.createElement("div",{style:{width:G-(Oe?de:0),position:"sticky",left:0,overflow:"hidden"},className:"".concat(be,"-expanded-row-fixed")},ge)),E.createElement(ke,{className:te,style:{display:H?null:"none"}},E.createElement(r.a,{component:xe,prefixCls:be,colSpan:V},ge))},[we,ke,Oe,ee,te,H,G,V,de])}var z=F;function Q(fe){var be=fe.className,we=fe.style,ke=fe.record,xe=fe.index,Oe=fe.rowKey,ae=fe.getRowKey,ee=fe.rowExpandable,te=fe.expandedKeys,H=fe.onRow,G=fe.indent,V=G===void 0?0:G,J=fe.rowComponent,de=fe.cellComponent,ge=fe.childrenColumnName,Me=E.useContext(o.a),et=Me.prefixCls,dt=Me.fixedInfoList,qe=E.useContext(k),Ct=qe.fixHeader,_t=qe.fixColumn,at=qe.horizonScroll,It=qe.componentWidth,At=qe.flattenColumns,Ot=qe.expandableType,Wt=qe.expandRowByClick,gt=qe.onTriggerExpand,Bt=qe.rowClassName,Nt=qe.expandedRowClassName,Je=qe.indentSize,Yt=qe.expandIcon,or=qe.expandedRowRender,Gt=qe.expandIconColumnIndex,rr=E.useState(!1),$r=Object(g.a)(rr,2),Ir=$r[0],yr=$r[1],pr=te&&te.has(fe.recordKey);E.useEffect(function(){pr&&yr(!0)},[pr]);var Mr=Ot==="row"&&(!ee||ee(ke)),Nr=Ot==="nest",Kr=ge&&ke&&ke[ge],Sr=Mr||Nr,_r;H&&(_r=H(ke,xe));var tn=function(a){if(Wt&&Sr&&gt(ke,a),_r&&_r.onClick){for(var u,D=arguments.length,B=new Array(D>1?D-1:0),L=1;L<D;L++)B[L-1]=arguments[L];(u=_r).onClick.apply(u,[a].concat(B))}},Ur;typeof Bt=="string"?Ur=Bt:typeof Bt=="function"&&(Ur=Bt(ke,xe,V));var wt=Object(f.a)(At),Yr=E.createElement(J,Object.assign({},_r,{"data-row-key":Oe,className:M()(be,"".concat(et,"-row"),"".concat(et,"-row-level-").concat(V),Ur,_r&&_r.className),style:Object(N.a)(Object(N.a)({},we),_r?_r.style:null),onClick:tn}),At.map(function(P,a){var u=P.render,D=P.dataIndex,B=P.className,L=wt[a],se=dt[a],Ie;a===(Gt||0)&&Nr&&(Ie=E.createElement(E.Fragment,null,E.createElement("span",{style:{paddingLeft:"".concat(Je*V,"px")},className:"".concat(et,"-row-indent indent-level-").concat(V)}),Yt({prefixCls:et,expanded:pr,expandable:Kr,record:ke,onExpand:gt})));var tt;return P.onCell&&(tt=P.onCell(ke,xe)),E.createElement(r.a,Object.assign({className:B,ellipsis:P.ellipsis,align:P.align,component:de,prefixCls:et,key:L,record:ke,index:xe,dataIndex:D,render:u,shouldCellUpdate:P.shouldCellUpdate},se,{appendNode:Ie,additionalProps:tt}))})),kr;if(Mr&&(Ir||pr)){var Hr=or(ke,xe,V+1,pr),Br=Nt&&Nt(ke,xe,V);kr=E.createElement(z,{expanded:pr,className:M()("".concat(et,"-expanded-row"),"".concat(et,"-expanded-row-level-").concat(V+1),Br),prefixCls:et,fixHeader:Ct,fixColumn:_t,horizonScroll:at,component:J,componentWidth:It,cellComponent:de,colSpan:At.length},Hr)}var rn;return Kr&&pr&&(rn=(ke[ge]||[]).map(function(P,a){var u=ae(P,a);return E.createElement(Q,Object.assign({},fe,{key:u,rowKey:u,record:P,recordKey:u,index:a,indent:V+1}))})),E.createElement(E.Fragment,null,Yr,kr,rn)}Q.displayName="BodyRow";var Y=Q,X=E.createContext(null),le=X;function ye(fe){var be=fe.columnKey,we=fe.onColumnResize,ke=E.useRef();return E.useEffect(function(){ke.current&&we(be,ke.current.offsetWidth)},[]),E.createElement(T.a,{onResize:function(Oe){var ae=Oe.offsetWidth;we(be,ae)}},E.createElement("td",{ref:ke,style:{padding:0,border:0,height:0}},E.createElement("div",{style:{height:0,overflow:"hidden"}},"\xA0")))}function ve(fe){var be=fe.data,we=fe.getRowKey,ke=fe.measureColumnWidth,xe=fe.expandedKeys,Oe=fe.onRow,ae=fe.rowExpandable,ee=fe.emptyNode,te=fe.childrenColumnName,H=E.useContext(le),G=H.onColumnResize,V=E.useContext(o.a),J=V.prefixCls,de=V.getComponent,ge=E.useContext(k),Me=ge.fixHeader,et=ge.horizonScroll,dt=ge.flattenColumns,qe=ge.componentWidth;return E.useMemo(function(){var Ct=de(["body","wrapper"],"tbody"),_t=de(["body","row"],"tr"),at=de(["body","cell"],"td"),It;be.length?It=be.map(function(Ot,Wt){var gt=we(Ot,Wt);return E.createElement(Y,{key:gt,rowKey:gt,record:Ot,recordKey:gt,index:Wt,rowComponent:_t,cellComponent:at,expandedKeys:xe,onRow:Oe,getRowKey:we,rowExpandable:ae,childrenColumnName:te})}):It=E.createElement(z,{expanded:!0,className:"".concat(J,"-placeholder"),prefixCls:J,fixHeader:Me,fixColumn:et,horizonScroll:et,component:_t,componentWidth:qe,cellComponent:at,colSpan:dt.length},ee);var At=Object(f.a)(dt);return E.createElement(Ct,{className:"".concat(J,"-tbody")},ke&&E.createElement("tr",{"aria-hidden":"true",className:"".concat(J,"-measure-row"),style:{height:0}},At.map(function(Ot){return E.createElement(ye,{key:Ot,columnKey:Ot,onColumnResize:G})})),It)},[be,J,Oe,ke,xe,we,de,qe,ee,dt])}var Ne=E.memo(ve);Ne.displayName="Body";var Te=Ne,Ce=K("wRmb"),_e=K("xEkU"),Re=K.n(_e);function he(fe){var be=Object(E.useRef)(fe),we=Object(E.useState)({}),ke=Object(g.a)(we,2),xe=ke[1],Oe=Object(E.useRef)(null),ae=Object(E.useRef)([]);function ee(te){Oe.current===null&&(ae.current=[],Oe.current=Re()(function(){ae.current.forEach(function(H){be.current=H(be.current)}),Oe.current=null,xe({})})),ae.current.push(te)}return Object(E.useEffect)(function(){return function(){Re.a.cancel(Oe.current)}},[]),[be.current,ee]}function Z(fe){var be=Object(E.useRef)(fe),we=Object(E.useRef)(null);function ke(){window.clearTimeout(we.current)}function xe(ae){be.current=ae,ke(),we.current=window.setTimeout(function(){be.current=null,we.current=null},100)}function Oe(){return be.current}return Object(E.useEffect)(function(){return ke},[]),[xe,Oe]}function je(fe,be,we){var ke=Object(E.useMemo)(function(){for(var xe=[],Oe=[],ae=0,ee=0,te=0;te<be;te+=1)if(we==="rtl"){Oe[te]=ee,ee+=fe[te]||0;var H=be-te-1;xe[H]=ae,ae+=fe[H]||0}else{xe[te]=ae,ae+=fe[te]||0;var G=be-te-1;Oe[G]=ee,ee+=fe[G]||0}return{left:xe,right:Oe}},[fe,be,we]);return ke}var lt=je;function nt(fe){var be=fe.className,we=fe.children;return E.createElement("div",{className:be},we)}var Ke=nt,Ge=K("n6Qo");function Pe(fe){var be,we=fe.prefixCls,ke=fe.record,xe=fe.onExpand,Oe=fe.expanded,ae=fe.expandable,ee="".concat(we,"-row-expand-icon");if(!ae)return E.createElement("span",{className:M()(ee,"".concat(we,"-row-spaced"))});var te=function(G){xe(ke,G),G.stopPropagation()};return E.createElement("span",{className:M()(ee,(be={},Object(oe.a)(be,"".concat(we,"-row-expanded"),Oe),Object(oe.a)(be,"".concat(we,"-row-collapsed"),!Oe),be)),onClick:te})}function We(fe,be,we){var ke=[];function xe(Oe){(Oe||[]).forEach(function(ae,ee){ke.push(be(ae,ee)),xe(ae[we])})}return xe(fe),ke}var Qe=K("zT1h"),Ze=K("y0+3"),$e=function(be,we){var ke,xe,Oe=be.scrollBodyRef,ae=be.onScroll,ee=be.offsetScroll,te=E.useContext(o.a),H=te.prefixCls,G=((ke=Oe.current)===null||ke===void 0?void 0:ke.scrollWidth)||0,V=((xe=Oe.current)===null||xe===void 0?void 0:xe.clientWidth)||0,J=G&&V*(V/G),de=E.useRef(),ge=he({scrollLeft:0,isHiddenScrollBar:!1}),Me=Object(g.a)(ge,2),et=Me[0],dt=Me[1],qe=E.useRef({delta:0,x:0}),Ct=E.useState(!1),_t=Object(g.a)(Ct,2),at=_t[0],It=_t[1],At=function(){It(!1)},Ot=function(Je){Je.persist(),qe.current.delta=Je.pageX-et.scrollLeft,qe.current.x=0,It(!0),Je.preventDefault()},Wt=function(Je){var Yt,or=Je||((Yt=window)===null||Yt===void 0?void 0:Yt.event),Gt=or.buttons;if(!at||Gt===0){at&&It(!1);return}var rr=qe.current.x+Je.pageX-qe.current.x-qe.current.delta;rr<=0&&(rr=0),rr+J>=V&&(rr=V-J),ae({scrollLeft:rr/V*(G+2)}),qe.current.x=Je.pageX},gt=function(){var Je=Object(Ze.b)(Oe.current).top,Yt=Je+Oe.current.offsetHeight,or=document.documentElement.scrollTop+window.innerHeight;Yt-Object(O.a)()<=or||Je>=or-ee?dt(function(Gt){return Object(N.a)(Object(N.a)({},Gt),{},{isHiddenScrollBar:!0})}):dt(function(Gt){return Object(N.a)(Object(N.a)({},Gt),{},{isHiddenScrollBar:!1})})},Bt=function(Je){dt(function(Yt){return Object(N.a)(Object(N.a)({},Yt),{},{scrollLeft:Je/G*V||0})})};return E.useImperativeHandle(we,function(){return{setScrollLeft:Bt}}),E.useEffect(function(){var Nt=Object(Qe.a)(document.body,"mouseup",At,!1),Je=Object(Qe.a)(document.body,"mousemove",Wt,!1);return gt(),function(){Nt.remove(),Je.remove()}},[J,at]),E.useEffect(function(){var Nt=Object(Qe.a)(window,"scroll",gt,!1),Je=Object(Qe.a)(window,"resize",gt,!1);return function(){Nt.remove(),Je.remove()}},[]),E.useEffect(function(){et.isHiddenScrollBar||dt(function(Nt){var Je,Yt;return Object(N.a)(Object(N.a)({},Nt),{},{scrollLeft:Oe.current.scrollLeft/((Je=Oe.current)===null||Je===void 0?void 0:Je.scrollWidth)*((Yt=Oe.current)===null||Yt===void 0?void 0:Yt.clientWidth)})})},[et.isHiddenScrollBar]),G<=V||!J||et.isHiddenScrollBar?null:E.createElement("div",{style:{height:Object(O.a)(),width:V,bottom:ee},className:"".concat(H,"-sticky-scroll")},E.createElement("div",{onMouseDown:Ot,ref:de,className:M()("".concat(H,"-sticky-scroll-bar"),Object(oe.a)({},"".concat(H,"-sticky-scroll-bar-active"),at)),style:{width:"".concat(J,"px"),transform:"translate3d(".concat(et.scrollLeft,"px, 0, 0)")}}))},Ue=E.forwardRef($e);function Fe(fe,be){return E.useMemo(function(){var we=!!fe;return{isSticky:we,stickyClassName:we?"".concat(be,"-sticky-header"):"",offsetHeader:Object(I.a)(fe)==="object"&&fe.offsetHeader||0,offsetScroll:Object(I.a)(fe)==="object"&&fe.offsetScroll||0}},[fe,be])}var ct=[],ot={},st="rc-table-internal-hook",rt=E.memo(function(fe){var be=fe.children;return be},function(fe,be){return w()(fe.props,be.props)?fe.pingLeft!==be.pingLeft||fe.pingRight!==be.pingRight:!1});function ht(fe){var be,we=fe.prefixCls,ke=fe.className,xe=fe.rowClassName,Oe=fe.style,ae=fe.data,ee=fe.rowKey,te=fe.scroll,H=fe.tableLayout,G=fe.direction,V=fe.title,J=fe.footer,de=fe.summary,ge=fe.id,Me=fe.showHeader,et=fe.components,dt=fe.emptyText,qe=fe.onRow,Ct=fe.onHeaderRow,_t=fe.internalHooks,at=fe.transformColumns,It=fe.internalRefs,At=fe.sticky,Ot=ae||ct,Wt=!!Ot.length,gt=E.useState(0),Bt=Object(g.a)(gt,2),Nt=Bt[0],Je=Bt[1];E.useEffect(function(){Je(Object(O.a)())});var Yt=E.useMemo(function(){return Object(f.c)(et,{})},[et]),or=E.useCallback(function(Se,Le){return Object(f.b)(Yt,Se)||Le},[Yt]),Gt=E.useMemo(function(){return typeof ee=="function"?ee:function(Se){var Le=Se&&Se[ee];return Le}},[ee]),rr=Object(n.c)(fe),$r=rr.expandIcon,Ir=rr.expandedRowKeys,yr=rr.defaultExpandedRowKeys,pr=rr.defaultExpandAllRows,Mr=rr.expandedRowRender,Nr=rr.onExpand,Kr=rr.onExpandedRowsChange,Sr=rr.expandRowByClick,_r=rr.rowExpandable,tn=rr.expandIconColumnIndex,Ur=rr.expandedRowClassName,wt=rr.childrenColumnName,Yr=rr.indentSize,kr=$r||Pe,Hr=wt||"children",Br=E.useMemo(function(){return Mr?"row":fe.expandable&&_t===st&&fe.expandable.__PARENT_RENDER_ICON__||Ot.some(function(Se){return Se&&Object(I.a)(Se)==="object"&&Se[Hr]})?"nest":!1},[!!Mr,Ot]),rn=E.useState(function(){return yr||(pr?We(Ot,Gt,Hr):[])}),P=Object(g.a)(rn,2),a=P[0],u=P[1],D=E.useMemo(function(){return new Set(Ir||a||[])},[Ir,a]),B=E.useCallback(function(Se){var Le=Gt(Se,Ot.indexOf(Se)),Ye,mt=D.has(Le);mt?(D.delete(Le),Ye=Object(S.a)(D)):Ye=[].concat(Object(S.a)(D),[Le]),u(Ye),Nr&&Nr(!mt,Se),Kr&&Kr(Ye)},[Gt,D,Ot,Nr,Kr]),L=E.useState(0),se=Object(g.a)(L,2),Ie=se[0],tt=se[1],pt=Object(Ce.b)(Object(N.a)(Object(N.a)(Object(N.a)({},fe),rr),{},{expandable:!!Mr,expandedKeys:D,getRowKey:Gt,onTriggerExpand:B,expandIcon:kr,expandIconColumnIndex:tn,direction:G}),_t===st?at:null),Be=Object(g.a)(pt,2),bt=Be[0],Tt=Be[1],Qt=E.useMemo(function(){return{columns:bt,flattenColumns:Tt}},[bt,Tt]),Ae=E.useRef(),br=E.useRef(),sr=E.useRef(),Rr=E.useState(!1),Cn=Object(g.a)(Rr,2),nn=Cn[0],jr=Cn[1],Qr=E.useState(!1),zr=Object(g.a)(Qr,2),an=zr[0],Tn=zr[1],hn=he(new Map),bn=Object(g.a)(hn,2),Mn=bn[0],on=bn[1],Er=Object(f.a)(Tt),Jr=Er.map(function(Se){return Mn.get(Se)}),Sn=E.useMemo(function(){return Jr},[Jr.join("_")]),fn=lt(Sn,Tt.length,G),qt=te&&Object(f.d)(te.y),Lt=te&&Object(f.d)(te.x),lr=Lt&&Tt.some(function(Se){var Le=Se.fixed;return Le}),jt=E.useRef(),mr=Fe(At,we),Zt=mr.isSticky,pn=mr.offsetHeader,vr=mr.offsetScroll,En=mr.stickyClassName,sn,mn,ln;qt&&(mn={overflowY:"scroll",maxHeight:te.y}),Lt&&(sn={overflowX:"auto"},qt||(mn={overflowY:"hidden"}),ln={width:te.x===!0?"auto":te.x,minWidth:"100%"});var Ar=E.useCallback(function(Se,Le){on(function(Ye){var mt=new Map(Ye);return mt.set(Se,Le),mt})},[]),_n=Z(null),un=Object(g.a)(_n,2),Kn=un[0],Hn=un[1];function wn(Se,Le){if(!Le)return;typeof Le=="function"?Le(Se):Le.scrollLeft!==Se&&(Le.scrollLeft=Se)}var vn=function(Le){var Ye=Le.currentTarget,mt=Le.scrollLeft,yt=typeof mt=="number"?mt:Ye.scrollLeft,er=Ye||ot;if(!Hn()||Hn()===er){var Tr;Kn(er),wn(yt,br.current),wn(yt,sr.current),wn(yt,(Tr=jt.current)===null||Tr===void 0?void 0:Tr.setScrollLeft)}if(Ye){var xr=Ye.scrollWidth,Jt=Ye.clientWidth;jr(yt>0),Tn(yt<xr-Jt)}},kn=function(){sr.current&&vn({currentTarget:sr.current})},Fr=function(Le){var Ye=Le.width;kn(),tt(Ae.current?Ae.current.offsetWidth:Ye)};E.useEffect(function(){return kn},[]),E.useEffect(function(){Lt&&kn()},[Lt]),E.useEffect(function(){_t===st&&It&&(It.body.current=sr.current)});var In=or(["table"],"table"),dn=E.useMemo(function(){return H||(lr?te.x==="max-content"?"auto":"fixed":qt||Tt.some(function(Se){var Le=Se.ellipsis;return Le})?"fixed":"auto")},[qt,lr,Tt,H]),Nn,On={colWidths:Sn,columCount:Tt.length,stickyOffsets:fn,onHeaderRow:Ct,fixHeader:qt},gn=E.useMemo(function(){return Wt?null:typeof dt=="function"?dt():dt},[Wt,dt]),Vn=E.createElement(Te,{data:Ot,measureColumnWidth:qt||Lt||Zt,expandedKeys:D,rowExpandable:_r,getRowKey:Gt,onRow:qe,emptyNode:gn,childrenColumnName:Hr}),Un=E.createElement(e,{colWidths:Tt.map(function(Se){var Le=Se.width;return Le}),columns:Tt}),Bn=de&&E.createElement(Ge.b,null,de(Ot)),Gr=or(["body"]);if(qt||Zt){var jn;typeof Gr=="function"?(jn=Gr(Ot,{scrollbarSize:Nt,ref:sr,onScroll:vn}),On.colWidths=Tt.map(function(Se,Le){var Ye=Se.width,mt=Le===bt.length-1?Ye-Nt:Ye;return typeof mt=="number"&&!Number.isNaN(mt)?mt:(Object(x.a)(!1,"When use `components.body` with render props. Each column should have a fixed value."),0)})):jn=E.createElement("div",{style:Object(N.a)(Object(N.a)({},sn),mn),onScroll:vn,ref:sr,className:M()("".concat(we,"-body"))},E.createElement(In,{style:Object(N.a)(Object(N.a)({},ln),{},{tableLayout:dn})},Un,Vn,Bn),Zt&&E.createElement(Ue,{ref:jt,offsetScroll:vr,scrollBodyRef:sr,onScroll:vn})),Nn=E.createElement(E.Fragment,null,Me!==!1&&E.createElement(_,Object.assign({noData:!Ot.length},On,Qt,{direction:G,offsetHeader:pn,stickyClassName:En,ref:br,onScroll:vn})),jn)}else Nn=E.createElement("div",{style:Object(N.a)(Object(N.a)({},sn),mn),className:M()("".concat(we,"-content")),onScroll:vn,ref:sr},E.createElement(In,{style:Object(N.a)(Object(N.a)({},ln),{},{tableLayout:dn})},Un,Me!==!1&&E.createElement(i,Object.assign({},On,Qt)),Vn,Bn));var Xn=Object(n.b)(fe),Rn=E.createElement("div",Object.assign({className:M()(we,ke,(be={},Object(oe.a)(be,"".concat(we,"-rtl"),G==="rtl"),Object(oe.a)(be,"".concat(we,"-ping-left"),nn),Object(oe.a)(be,"".concat(we,"-ping-right"),an),Object(oe.a)(be,"".concat(we,"-layout-fixed"),H==="fixed"),Object(oe.a)(be,"".concat(we,"-fixed-header"),qt),Object(oe.a)(be,"".concat(we,"-fixed-column"),lr),Object(oe.a)(be,"".concat(we,"-scroll-horizontal"),Lt),Object(oe.a)(be,"".concat(we,"-has-fix-left"),Tt[0]&&Tt[0].fixed),Object(oe.a)(be,"".concat(we,"-has-fix-right"),Tt[Tt.length-1]&&Tt[Tt.length-1].fixed==="right"),be)),style:Oe,id:ge,ref:Ae},Xn),E.createElement(rt,{pingLeft:nn,pingRight:an,props:Object(N.a)(Object(N.a)({},fe),{},{stickyOffsets:fn,mergedExpandedKeys:D})},V&&E.createElement(Ke,{className:"".concat(we,"-title")},V(Ot)),E.createElement("div",{className:"".concat(we,"-container")},Nn),J&&E.createElement(Ke,{className:"".concat(we,"-footer")},J(Ot))));Lt&&(Rn=E.createElement(T.a,{onResize:Fr},Rn));var $n=E.useMemo(function(){return{prefixCls:we,getComponent:or,scrollbarSize:Nt,direction:G,fixedInfoList:Tt.map(function(Se,Le){return s(Le,Le,Tt,fn,G)}),isSticky:Zt}},[we,or,Nt,G,Tt,fn,G,Zt]),Yn=E.useMemo(function(){return Object(N.a)(Object(N.a)({},Qt),{},{tableLayout:dn,rowClassName:xe,expandedRowClassName:Ur,componentWidth:Ie,fixHeader:qt,fixColumn:lr,horizonScroll:Lt,expandIcon:kr,expandableType:Br,expandRowByClick:Sr,expandedRowRender:Mr,onTriggerExpand:B,expandIconColumnIndex:tn,indentSize:Yr})},[Qt,dn,xe,Ur,Ie,qt,lr,Lt,kr,Br,Sr,Mr,B,tn,Yr]),He=E.useMemo(function(){return{onColumnResize:Ar}},[Ar]);return E.createElement(o.a.Provider,{value:$n},E.createElement(k.Provider,{value:Yn},E.createElement(le.Provider,{value:He},Rn)))}ht.Column=b.a,ht.ColumnGroup=C.a,ht.Summary=Ge.a,ht.defaultProps={rowKey:"key",prefixCls:"rc-table",emptyText:function(){return"No Data"}};var ut=ze.b=ht},wRmb:function(ft,ze,K){"use strict";K.d(ze,"a",function(){return w});var oe=K("rePB"),N=K("KQm4"),S=K("VTBJ"),I=K("Ff2n"),g=K("q1tI"),E=K.n(g),U=K("Kwbf"),M=K("Zm9Q"),R=K("hW8S");function w(b){return Object(M.a)(b).filter(function(v){return g.isValidElement(v)}).map(function(v){var h=v.key,r=v.props,o=r.children,s=Object(I.a)(r,["children"]),f=Object(S.a)({key:h},s);return o&&(f.children=w(o)),f})}function x(b){return b.reduce(function(v,h){var r=h.fixed,o=r===!0?"left":r,s=h.children;return s&&s.length>0?[].concat(Object(N.a)(v),Object(N.a)(x(s).map(function(f){return Object(S.a)({fixed:o},f)}))):[].concat(Object(N.a)(v),[Object(S.a)(Object(S.a)({},h),{},{fixed:o})])},[])}function T(b){for(var v=!0,h=0;h<b.length;h+=1){var r=b[h];if(v&&r.fixed!=="left")v=!1;else if(!v&&r.fixed==="left"){Object(U.a)(!1,"Index ".concat(h-1," of `columns` missing `fixed='left'` prop."));break}}for(var o=!0,s=b.length-1;s>=0;s-=1){var f=b[s];if(o&&f.fixed!=="right")o=!1;else if(!o&&f.fixed==="right"){Object(U.a)(!1,"Index ".concat(s+1," of `columns` missing `fixed='right'` prop."));break}}}function O(b){return b.map(function(v){var h=v.fixed,r=Object(I.a)(v,["fixed"]),o=h;return h==="left"?o="right":h==="right"&&(o="left"),Object(S.a)({fixed:o},r)})}function C(b,v){var h=b.prefixCls,r=b.columns,o=b.children,s=b.expandable,f=b.expandedKeys,d=b.getRowKey,l=b.onTriggerExpand,p=b.expandIcon,c=b.rowExpandable,i=b.expandIconColumnIndex,n=b.direction,t=b.expandRowByClick,e=g.useMemo(function(){return r||w(o)},[r,o]),m=g.useMemo(function(){if(s){var A,k=i||0,F=e[k],z=(A={},Object(oe.a)(A,R.a,{className:"".concat(h,"-expand-icon-col")}),Object(oe.a)(A,"title",""),Object(oe.a)(A,"fixed",F?F.fixed:null),Object(oe.a)(A,"className","".concat(h,"-row-expand-icon-cell")),Object(oe.a)(A,"render",function(X,le,ye){var ve=d(le,ye),Ne=f.has(ve),Te=c?c(le):!0,Ce=p({prefixCls:h,expanded:Ne,expandable:Te,record:le,onExpand:l});return t?g.createElement("span",{onClick:function(Re){return Re.stopPropagation()}},Ce):Ce}),A),Q=e.slice();return k>=0&&Q.splice(k,0,z),Q}return e},[s,e,d,f,p,n]),y=g.useMemo(function(){var A=m;return v&&(A=v(A)),A.length||(A=[{render:function(){return null}}]),A},[v,m,n]),_=g.useMemo(function(){return n==="rtl"?O(x(y)):x(y)},[y,n]);return[y,_]}ze.b=C},wwSX:function(ft,ze,K){ft.exports=K.p+"static/b2.2c844a2a.svg"},"y0+3":function(ft,ze,K){"use strict";K.d(ze,"a",function(){return x}),K.d(ze,"b",function(){return O});var oe=/margin|padding|width|height|max|min|offset/,N={left:!0,top:!0},S={cssFloat:1,styleFloat:1,float:1};function I(C){return C.nodeType===1?C.ownerDocument.defaultView.getComputedStyle(C,null):{}}function g(C,b,v){if(b=b.toLowerCase(),v==="auto"){if(b==="height")return C.offsetHeight;if(b==="width")return C.offsetWidth}return b in N||(N[b]=oe.test(b)),N[b]?parseFloat(v)||0:v}function E(C,b){var v=arguments.length,h=I(C);return b=S[b]?"cssFloat"in C.style?"cssFloat":"styleFloat":b,v===1?h:g(C,b,h[b]||C.style[b])}function U(C,b,v){var h=arguments.length;if(b=S[b]?"cssFloat"in C.style?"cssFloat":"styleFloat":b,h===3)return typeof v=="number"&&oe.test(b)&&(v="".concat(v,"px")),C.style[b]=v,v;for(var r in b)b.hasOwnProperty(r)&&U(C,r,b[r]);return I(C)}function M(C){return C===document.body?document.documentElement.clientWidth:C.offsetWidth}function R(C){return C===document.body?window.innerHeight||document.documentElement.clientHeight:C.offsetHeight}function w(){var C=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),b=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);return{width:C,height:b}}function x(){var C=document.documentElement.clientWidth,b=window.innerHeight||document.documentElement.clientHeight;return{width:C,height:b}}function T(){return{scrollLeft:Math.max(document.documentElement.scrollLeft,document.body.scrollLeft),scrollTop:Math.max(document.documentElement.scrollTop,document.body.scrollTop)}}function O(C){var b=C.getBoundingClientRect(),v=document.documentElement;return{left:b.left+(window.pageXOffset||v.scrollLeft)-(v.clientLeft||document.body.clientLeft||0),top:b.top+(window.pageYOffset||v.scrollTop)-(v.clientTop||document.body.clientTop||0)}}},y3Jh:function(ft,ze,K){"use strict";K.r(ze);var oe=K("fV52"),N=K("3I+P"),S=K("g9YV"),I=K("wCAj"),g=K("Znn+"),E=K("ZTPi"),U=K("5NDa"),M=K("5rEg"),R=K("OaEy"),w=K("2fM7"),x=K("lUTK"),T=K("BvKs"),O=K("2qtc"),C=K("kLXV"),b=K("miYZ"),v=K("tsqr"),h=K("k1fw"),r=K("oBTY"),o=K("+L6B"),s=K("2/Rp"),f=K("qVdP"),d=K("jsC+"),l=K("9og8"),p=K("tJVT"),c=K("PpiC"),i=K("WmNS"),n=K.n(i),t=K("q1tI"),e=K.n(t),m=K("Ty5D"),y=K("9kvl"),_=K("9Bee"),A=K("wd/R"),k=K.n(A),F=K("m3rI"),z=K("ErOA"),Q=K("5A5F"),Y=K.n(Q),X=K("xKgJ"),le=K("zqRK"),ye=K.n(le),ve=K("uf8j"),Ne=K.n(ve),Te=K("yR49"),Ce=K.n(Te),_e=K("3SPk"),Re=K.n(_e),he=K("eZjB"),Z=K.n(he),je=K("t6v1"),lt=K.n(je),nt=K("+92d"),Ke=K.n(nt),Ge=K("wwSX"),Pe=K.n(Ge),We=K("zlzj"),Qe=K.n(We),Ze=K("+RDj"),$e=K.n(Ze),Ue=K("LvDl"),Fe=K.n(Ue),ct=K("1vsH"),ot=K("yDOu"),st=K.n(ot),rt=function(ut){var fe,be,we,ke,xe,Oe,ae,ee,te,H,G,V,J,de,ge,Me,et,dt=ut.globalSetting,qe=ut.user,Ct=ut.dispatch,_t=Object(c.a)(ut,["globalSetting","user","dispatch"]),at=Object(m.h)(),It={page:1,per_page:30,tag_discipline_id:[-1],source_discipline_id:[-1],status:null,difficulty:null,search:"",save_search:"",sort_by:null,sort_direction:null,filter:(at==null||((fe=at.query)===null||fe===void 0)?void 0:fe.tab)||"public"},At=Object(t.useState)(0),Ot=Object(p.a)(At,2),Wt=Ot[0],gt=Ot[1],Bt=Object(t.useState)(0),Nt=Object(p.a)(Bt,2),Je=Nt[0],Yt=Nt[1],or=Object(t.useState)(0),Gt=Object(p.a)(or,2),rr=Gt[0],$r=Gt[1],Ir=Object(t.useState)([]),yr=Object(p.a)(Ir,2),pr=yr[0],Mr=yr[1],Nr=Object(t.useState)([]),Kr=Object(p.a)(Nr,2),Sr=Kr[0],_r=Kr[1],tn=Object(t.useState)({}),Ur=Object(p.a)(tn,2),wt=Ur[0],Yr=Ur[1],kr=Object(t.useState)(!1),Hr=Object(p.a)(kr,2),Br=Hr[0],rn=Hr[1],P=Object(t.useState)([]),a=Object(p.a)(P,2),u=a[0],D=a[1],B=Object(t.useState)(!0),L=Object(p.a)(B,2),se=L[0],Ie=L[1],tt=Object(t.useState)(null),pt=Object(p.a)(tt,2),Be=pt[0],bt=pt[1],Tt=Object(t.useState)(It),Qt=Object(p.a)(Tt,2),Ae=Qt[0],br=Qt[1],sr=Object(t.useRef)(null),Rr=Object(t.useRef)(null),Cn=Object(t.useState)([]),nn=Object(p.a)(Cn,2),jr=nn[0],Qr=nn[1],zr=Object(t.useMemo)(function(){return["not_reviewed","under_review","review_finished"].includes(Ae.filter)},[Ae.filter]),an=Object(t.useState)(!1),Tn=Object(p.a)(an,2),hn=Tn[0],bn=Tn[1],Mn=Object(t.useState)(!1),on=Object(p.a)(Mn,2),Er=on[0],Jr=on[1],Sn=Object(t.useState)(""),fn=Object(p.a)(Sn,2),qt=fn[0],Lt=fn[1],lr=Object(t.useState)([]),jt=Object(p.a)(lr,2),mr=jt[0],Zt=jt[1],pn=Object(t.useState)(!1),vr=Object(p.a)(pn,2),En=vr[0],sn=vr[1],mn=Object(t.useState)([]),ln=Object(p.a)(mn,2),Ar=ln[0],_n=ln[1],un=function(){var He=Object(l.a)(n.a.mark(function Se(Le,Ye,mt){var yt,er,Tr,xr,Jt;return n.a.wrap(function(cn){for(;;)switch(cn.prev=cn.next){case 0:return Le.persist(),Le!=null&&(yt=Le.target)!==null&&yt!==void 0&&(er=yt.style)!==null&&er!==void 0&&er.pointerEvents&&(Le.target.style.pointerEvents="none"),cn.next=4,Object(z.a)("/api/practices/".concat(Ye.identifier,"/start"),{method:"get"});case 4:if(Jt=cn.sent,!((Jt==null?void 0:Jt.status)===0)){cn.next=10;break}if(!mt){cn.next=9;break}return Object(ct.Q)("/problems/".concat(Jt==null?void 0:Jt.identifier,"/oj/").concat(Ye==null?void 0:Ye.identifier,"?tab=3")),cn.abrupt("return");case 9:Object(ct.Q)("/problems/".concat(Jt==null?void 0:Jt.identifier,"/oj/").concat(Ye==null?void 0:Ye.identifier));case 10:Le!=null&&(Tr=Le.target)!==null&&Tr!==void 0&&(xr=Tr.style)!==null&&xr!==void 0&&xr.pointerEvents&&(Le.target.style.pointerEvents="auto");case 11:case"end":return cn.stop()}},Se)}));return function(Le,Ye,mt){return He.apply(this,arguments)}}();Object(t.useEffect)(function(){var He=k()().add(0,"days").unix(),Se=localStorage.getItem("problemsclose");if(!Se){sn(!0);return}He>parseInt(Se)&&sn(!0)},[]);var Kn=["\u672A\u53D1\u5E03","\u5DF2\u516C\u5F00","\u672A\u5BA1\u6838","\u5BA1\u6838\u4E2D","\u672A\u516C\u5F00","\u672A\u901A\u8FC7"],Hn=[{title:"\u9898\u76EE\u540D\u79F0",dataIndex:"name",ellipsis:!0,render:function(Se,Le){return e.a.createElement("div",{className:Y.a.titleWarp},(Ae==null?void 0:Ae.filter)==="mine"?e.a.createElement("span",{className:Y.a.tag},Kn[Le.practice_status]):null,e.a.createElement("span",{title:Se,className:Y.a.hov,onClick:function(mt){return un(mt,Le)}},Se))}},(Ae==null?void 0:Ae.filter)==="public"?{title:"\u9898\u89E3",dataIndex:"solution_count",width:100,sorter:!0,render:function(Se,Le){return e.a.createElement("span",{style:{display:"flex"}},e.a.createElement("span",{onClick:function(mt){return un(mt,Le,!0)},className:"current"},Se),(Le==null?void 0:Le.has_video_solution)&&e.a.createElement("img",{className:"ml5",src:ye.a}))}}:null,(Ae==null?void 0:Ae.filter)==="public"?{title:"\u901A\u8FC7\u7387",dataIndex:"pass_ratio",sorter:!0,width:90}:null,{title:"\u96BE\u5EA6",dataIndex:"difficulty",sorter:!0,align:"center",width:90,render:function(Se){return e.a.createElement(e.a.Fragment,null,Se===1&&e.a.createElement("span",{className:Y.a["btn-style-1"]},"\u7B80\u5355"),Se===2&&e.a.createElement("span",{className:Y.a["btn-style-2"]},"\u9002\u4E2D"),Se===3&&e.a.createElement("span",{className:Y.a["btn-style-3"]},"\u56F0\u96BE"))}},(Ae==null?void 0:Ae.filter)==="public"?{title:"\u4EBA\u6570",dataIndex:"user_count",align:"center",sorter:!0,width:80}:null,(Ae==null?void 0:Ae.filter)==="public"?{title:"\u72B6\u6001",dataIndex:"status",width:90,render:function(Se,Le){return Object(X.q)()?e.a.createElement(e.a.Fragment,null,Be===(Le==null?void 0:Le.identifier)?e.a.createElement("span",{className:Y.a.hovBtn,onClick:function(mt){return un(mt,Le)}},"\u5F00\u542F\u5237\u9898"):e.a.createElement(e.a.Fragment,null,Se===0&&e.a.createElement("span",{style:{color:"#666666"}},"\u672A\u5F00\u542F"),Se===1&&e.a.createElement("span",{style:{color:"#666666"}},"\u8FDB\u884C\u4E2D"),Se===2&&e.a.createElement("span",{style:{color:"#666666"}},"\u5DF2\u901A\u8FC7"))):"-"}}:null,(Ae==null?void 0:Ae.filter)!=="public"?{title:"\u77E5\u8BC6\u70B9",dataIndex:"tag_disciplines_name",ellipsis:!0,width:200,render:function(Se){return e.a.createElement("span",null,Se==null?void 0:Se.join("\u3001"))}}:null,(Ae==null?void 0:Ae.filter)==="all"?{title:"\u521B\u5EFA\u8005",dataIndex:"creator",ellipsis:!0,width:100}:null,(Ae==null?void 0:Ae.filter)!=="public"?{title:"\u66F4\u65B0\u65F6\u95F4",dataIndex:"updated_at",sorter:!0,width:180}:null,Object(X.w)()?{title:"\u64CD\u4F5C",dataIndex:"action",key:"action",align:"center",width:80,render:function(Se,Le){return e.a.createElement(d.a,{className:"ml10",overlay:Xn(Le==null?void 0:Le.identifier,Le)},e.a.createElement("span",{style:{cursor:"default"},onClick:function(mt){return mt.preventDefault()}},e.a.createElement("span",{className:"c-grey-666"},"\u66F4\u591A"),e.a.createElement("i",{style:{display:"inline-block",transform:"scale(0.6)",fontSize:12},className:"c-grey-c iconfont icon-xiajiantou1"})))}}:Br&&(Ae==null?void 0:Ae.filter)!=="public"?{title:"\u64CD\u4F5C",dataIndex:"action",key:"action",align:"center",width:80,render:function(Se,Le){return Le!=null&&Le.is_self&&(Le==null?void 0:Le.practice_status)!==1?e.a.createElement(d.a,{className:"ml10",overlay:Rn(Le==null?void 0:Le.identifier,Le)},e.a.createElement("span",{style:{cursor:"default"},onClick:function(mt){return mt.preventDefault()}},e.a.createElement("span",{className:"c-grey-666"},"\u66F4\u591A"),e.a.createElement("i",{style:{display:"inline-block",transform:"scale(0.6)",fontSize:12},className:"c-grey-c iconfont icon-xiajiantou1"}))):"-"}}:null].filter(function(He){return!!He}),wn=[{title:"\u9898\u76EE\u540D\u79F0",dataIndex:"name",ellipsis:!0,render:function(Se,Le){return e.a.createElement("span",{className:Y.a.hov,onClick:function(mt){return un(mt,Le)}},Se)}},{title:"\u96BE\u5EA6",dataIndex:"difficulty",sorter:!0,align:"center",width:90,render:function(Se){return e.a.createElement(e.a.Fragment,null,Se===1&&e.a.createElement("span",{className:Y.a["btn-style-1"]},"\u7B80\u5355"),Se===2&&e.a.createElement("span",{className:Y.a["btn-style-2"]},"\u9002\u4E2D"),Se===3&&e.a.createElement("span",{className:Y.a["btn-style-3"]},"\u56F0\u96BE"))}},(Ae==null?void 0:Ae.filter)==="not_reviewed"?{title:"\u521B\u5EFA\u8005",dataIndex:"creator",ellipsis:!0,width:100}:{title:"\u5BA1\u6838\u8005",dataIndex:"reviewer",ellipsis:!0,width:100},(Ae==null?void 0:Ae.filter)==="not_reviewed"?{title:"\u53D1\u5E03\u65F6\u95F4",dataIndex:"submit_time",width:180}:null,(Ae==null?void 0:Ae.filter)==="under_review"?{title:"\u5F00\u59CB\u5BA1\u6838\u65F6\u95F4",dataIndex:"start_review_time",width:180}:null,(Ae==null?void 0:Ae.filter)==="review_finished"?{title:"\u6700\u540E\u5BA1\u6838\u65F6\u95F4",dataIndex:"review_time",width:180}:null,{title:"\u64CD\u4F5C",dataIndex:"action",key:"action",align:"center",width:120,render:function(Se,Le){var Ye;switch(Ae==null?void 0:Ae.filter){case"under_review":Ye=e.a.createElement("div",{style:{display:"flex"}},e.a.createElement(s.a,{type:"link",size:"small",onClick:function(yt){return un(yt,Le)}},"\u5BA1\u6838"),e.a.createElement(s.a,{type:"link",style:{color:"#666"},size:"small",onClick:function(yt){return In({e:yt,record:Le,op:"release"})}},"\u79FB\u51FA"));break;case"review_finished":Ye=e.a.createElement(s.a,{type:"link",size:"small",onClick:function(yt){bn(!0),vn(Le)}},"\u5BA1\u6838\u8BB0\u5F55");break;default:Ye=e.a.createElement(s.a,{type:"link",block:!0,onClick:function(yt){return In({e:yt,record:Le,op:"claim"})}},"\u5F00\u59CB\u5BA1\u6838");break}return Ye}}].filter(function(He){return!!He}),vn=function(){var He=Object(l.a)(n.a.mark(function Se(Le){var Ye;return n.a.wrap(function(yt){for(;;)switch(yt.prev=yt.next){case 0:return Zt([]),yt.next=3,Object(z.a)("/api/practices/".concat(Le.identifier,"/review_list"),{method:"get"});case 3:Ye=yt.sent,Zt(Ye==null?void 0:Ye.reviews_list);case 5:case"end":return yt.stop()}},Se)}));return function(Le){return He.apply(this,arguments)}}(),kn=[{title:"\u5BA1\u6838\u65F6\u95F4",dataIndex:"review_time",key:"review_time",render:function(Se,Le){return e.a.createElement("span",null,k()(Se).format("YYYY-MM-DD HH:mm:ss"))}},{title:"\u5BA1\u6838\u8005",dataIndex:"reviewer",key:"reviewer"},{title:"\u5BA1\u6838\u7ED3\u679C",dataIndex:"status",width:120,key:"status",render:function(Se,Le){return Se==="5"||Se===5?e.a.createElement("div",{style:{display:"flex",alignItems:"center"}},e.a.createElement("div",{style:{color:"#333333",marginRight:"5px",whiteSpace:"nowrap"}},"\u672A\u901A\u8FC7"),e.a.createElement("div",{style:{color:"#0152d9",whiteSpace:"nowrap",cursor:"pointer"},onClick:function(){Lt(Le.description),Jr(!0)}},"\u67E5\u770B\u539F\u56E0")):e.a.createElement("span",null,"\u5DF2\u901A\u8FC7")}}];Object(t.useEffect)(function(){Nn(),Fr(Ae)},[]),Object(t.useEffect)(function(){if(pr.length!==0){var He;(sr==null||((He=sr.current)===null||He===void 0)?void 0:He.clientHeight)>92&&gt(1)}},[pr]),Object(t.useEffect)(function(){if(Sr.length!==0){var He;(Rr==null||((He=Rr.current)===null||He===void 0)?void 0:He.clientHeight)>92&&Yt(1)}},[Sr]),Object(t.useEffect)(function(){return Ct({type:"globalSetting/onlyShowBackTopToggle",payload:!0}),Ct({type:"globalSetting/setShowQuestionBackTop",payload:!0}),function(){Ct({type:"globalSetting/onlyShowBackTopToggle",payload:!1}),Ct({type:"globalSetting/setShowQuestionBackTop",payload:!1})}},[]),Object(t.useEffect)(function(){var He;(document.title==="\u4EBA\u5DE5\u667A\u80FD\u79D1\u7814\u670D\u52A1\u5E73\u53F0"||document.title==="\u9996\u9875"||document.title==="\u5B9E\u8DF5\u6559\u5B66\u5E73\u53F0"||(He=document.title)!==null&&He!==void 0&&He.includes("img"))&&(document.title="\u5728\u7EBF\u5237\u9898")},[dt]),Object(t.useEffect)(function(){return document.body.setAttribute("data-custom","initial"),function(){document.body.removeAttribute("data-custom")}},[]);var Fr=function(){var He=Object(l.a)(n.a.mark(function Se(Le){var Ye,mt,yt,er;return n.a.wrap(function(xr){for(;;)switch(xr.prev=xr.next){case 0:return yt=Fe.a.cloneDeep(Le),yt.tag_discipline_id=(Ye=yt.tag_discipline_id)!==null&&Ye!==void 0&&Ye.includes(-1)?[]:yt.tag_discipline_id,yt.source_discipline_id=(mt=yt.source_discipline_id)!==null&&mt!==void 0&&mt.includes(-1)?[]:yt.source_discipline_id,console.log(yt,"sendData"),Ie(!0),D([]),xr.next=8,Object(z.a)("/api/practices.json",{method:"get",params:yt});case 8:er=xr.sent,Qr([]),Ie(!1),$r(er==null?void 0:er.practices_count),D(er==null?void 0:er.practices_list),_n((er==null?void 0:er.recommend_subjects)||[]);case 14:case"end":return xr.stop()}},Se)}));return function(Le){return He.apply(this,arguments)}}(),In=function(){var He=Object(l.a)(n.a.mark(function Se(Le){var Ye,mt,yt,er,Tr,xr;return n.a.wrap(function(An){for(;;)switch(An.prev=An.next){case 0:return Ye=Le.op,mt=Le.description,yt=Le.record,er=Le.e,Tr={op:Ye,description:mt},Ie(!0),An.next=5,Object(z.a)("/api/practices/".concat(yt.identifier,"/review"),{method:"post",body:Tr});case 5:xr=An.sent,Ie(!1),Ye==="claim"&&(xr.status===0||xr.status==="0")&&un(er,yt),Fr(Ae);case 9:case"end":return An.stop()}},Se)}));return function(Le){return He.apply(this,arguments)}}(),dn=function(){var He=Object(l.a)(n.a.mark(function Se(Le){var Ye;return n.a.wrap(function(yt){for(;;)switch(yt.prev=yt.next){case 0:return Ie(!0),yt.next=3,Object(z.a)("/api/practices/".concat(Le.identifier,"/publish"),{method:"post"});case 3:Ye=yt.sent,Ie(!1),Fr(Ae);case 6:case"end":return yt.stop()}},Se)}));return function(Le){return He.apply(this,arguments)}}(),Nn=function(){var He=Object(l.a)(n.a.mark(function Se(){var Le,Ye,mt,yt,er,Tr;return n.a.wrap(function(Jt){for(;;)switch(Jt.prev=Jt.next){case 0:return Jt.next=2,Object(z.a)("/api/tag_disciplines.json",{method:"get",params:{target:"practice",position:"index"}});case 2:return Ye=Jt.sent,Jt.next=5,Object(z.a)("/api/tag_disciplines.json",{method:"get",params:{target:"practice_source",position:"index"}});case 5:return mt=Jt.sent,Jt.next=8,Object(z.a)("/api/mypractices/rank_list",{method:"get",params:{}});case 8:yt=Jt.sent,Ye!=null&&Ye.tag_disciplines&&(er=[{id:-1,name:"\u5168\u90E8",count:Ye==null?void 0:Ye.totalCount}].concat(Object(r.a)(Ye==null?void 0:Ye.tag_disciplines)),Mr(er)),mt!=null&&mt.tag_disciplines&&(Tr=[{id:-1,name:"\u5168\u90E8",count:mt==null?void 0:mt.totalCount}].concat(Object(r.a)(mt==null?void 0:mt.tag_disciplines)),_r(Tr)),Yr(yt||{}),rn(yt==null||((Le=yt.my_record)===null||Le===void 0)?void 0:Le.outsource);case 13:case"end":return Jt.stop()}},Se)}));return function(){return He.apply(this,arguments)}}(),On=function(Se,Le){var Ye;Ae.page=1;var mt=Ae["".concat(Le,"_discipline_id")];(Ye=Ae["".concat(Le,"_discipline_id")])!==null&&Ye!==void 0&&Ye.includes(Se)?mt=mt.filter(function(yt){return yt!==Se}):mt.push(Se),Se===-1?mt=[-1]:(mt=mt.filter(function(yt){return yt!==-1}),mt.length||(mt=[-1])),Ae["".concat(Le,"_discipline_id")]=mt,br(Object(h.a)({},Ae)),Fr(Ae)},gn=function(Se,Le){Ae.page=1,Ae[Le]=typeof Se=="number"?Se:null,br(Object(h.a)({},Ae)),Fr(Ae)},Vn=function(Se){Ae.page=1,Ae.save_search=Se,br(Object(h.a)({},Ae))},Un=function(Se,Le,Ye){Ae.page=Se==null?void 0:Se.current,Ae.per_page=Se==null?void 0:Se.pageSize,Ye!=null&&Ye.order?(Ae.sort_by=Ye==null?void 0:Ye.field,Ae.sort_direction=(Ye==null?void 0:Ye.order)==="ascend"?"asc":"desc"):(Ae.sort_by=null,Ae.sort_direction=null),br(Object(h.a)({},Ae)),Fr(Ae)},Bn=function(Se){Ae.page=1,Ae.filter=Se,Ae.status=null,Ae.practice_status=null,br(Object(h.a)({},Ae)),Fr(Ae)},Gr=function(Se,Le){if((Le==null?void 0:Le.length)===0){v.b.warn("\u8BF7\u9009\u62E9\u8BD5\u9898");return}var Ye=function(){var mt=Object(l.a)(n.a.mark(function yt(){var er,Tr;return n.a.wrap(function(Jt){for(;;)switch(Jt.prev=Jt.next){case 0:return Jt.next=2,Object(z.a)("/api/practices/batch_op.json",{method:"post",body:{identifier:Le,op:Se}});case 2:er=Jt.sent,(er==null?void 0:er.status)===0&&(Tr=u.length===1&&Ae.page!==1?Ae.page-1:Ae.page,Ae.page=Tr,br(Object(h.a)({},Ae)),Fr(Ae));case 4:case"end":return Jt.stop()}},yt)}));return function(){return mt.apply(this,arguments)}}();if(Se===-1){C.a.confirm({centered:!0,width:500,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u5220\u9664\u786E\u8BA4",icon:null,className:"custom-modal-divider",content:"\u5220\u9664\u540E\u9898\u76EE\u5C06\u4E0D\u53EF\u518D\u627E\u56DE\u3002",onOk:Ye});return}Ye()},jn=e.a.createElement(T.a,null,(Ae==null?void 0:Ae.filter)==="public"?e.a.createElement(T.a.Item,{onClick:function(){return Gr(0,jr)}},"\u6279\u91CF\u79FB\u51FA\u516C\u5171"):[e.a.createElement(T.a.Item,{key:2,onClick:function(){return Gr(1,jr)}},"\u6279\u91CF\u79FB\u5165\u516C\u5171"),e.a.createElement(T.a.Item,{key:1,onClick:function(){return Gr(0,jr)}},"\u6279\u91CF\u79FB\u51FA\u516C\u5171")],(Ae==null?void 0:Ae.filter)!=="public"&&e.a.createElement(T.a.Item,{onClick:function(){return Gr(-1,jr)}},"\u6279\u91CF\u5220\u9664")),Xn=function(Se,Le){return e.a.createElement(T.a,null,(Le==null?void 0:Le.practice_status)===1?e.a.createElement(T.a.Item,{onClick:function(){return Gr(0,[Se])}},"\u79FB\u51FA\u516C\u5171"):e.a.createElement(T.a.Item,{onClick:function(){return Gr(1,[Se])}},"\u79FB\u5165\u516C\u5171"),(Ae==null?void 0:Ae.filter)==="mine"?e.a.createElement(T.a.Item,{onClick:function(){return dn(Le)},disabled:![0,4,5].includes(Le.practice_status)},[0,4,5].includes(Le.practice_status)?"\u53D1\u5E03\u5BA1\u6838":"\u5DF2\u53D1\u5E03\u5BA1\u6838"):null,e.a.createElement(T.a.Item,{onClick:function(){return Object(ct.Q)("/problems/".concat(Se,"/ojedit"))}},"\u7F16\u8F91"),(Ae==null?void 0:Ae.filter)!=="public"&&e.a.createElement(T.a.Item,{onClick:function(){return Gr(-1,[Se])}},"\u5220\u9664"))},Rn=function(Se,Le){return e.a.createElement(T.a,null,e.a.createElement(T.a.Item,{onClick:function(){return dn(Le)},disabled:![0,4,5].includes(Le.practice_status)},[0,4,5].includes(Le.practice_status)?"\u53D1\u5E03\u5BA1\u6838":"\u5DF2\u53D1\u5E03\u5BA1\u6838"),e.a.createElement(T.a.Item,{onClick:function(){return Object(ct.Q)("/problems/".concat(Se,"/ojedit"))}},"\u7F16\u8F91"),e.a.createElement(T.a.Item,{onClick:function(){return Gr(-1,[Se])}},"\u5220\u9664"))},$n=function(Se){Qr(Se)},Yn={selectedRowKeys:jr,columnWidth:40,onChange:$n};return e.a.createElement("section",{className:Y.a.wrap},e.a.createElement("div",{className:Y.a.bg},e.a.createElement("div",{className:Y.a.btnWrap},e.a.createElement("div",{className:Y.a.text},e.a.createElement("span",null,"\u5728\u7EBF\u5237\u9898"),e.a.createElement("span",null,"\u5FEB\u901F\u63D0\u9AD8\u7F16\u7A0B\u80FD\u529B")),e.a.createElement(d.a,{className:"ml10",overlay:e.a.createElement(T.a,null,e.a.createElement(T.a.Item,{key:1,onClick:function(){y.d.push("/problems/add")}},"\u65B0\u5EFA\u9898\u76EE"),e.a.createElement(T.a.Item,{key:2,onClick:function(){y.d.push("/problems/batchAdd")}},"\u6279\u91CF\u5BFC\u5165\u9898\u76EE"))},e.a.createElement("div",{className:Y.a.btn,style:{visibility:Object(X.w)()||Br?"visible":"hidden"}},e.a.createElement("i",{className:"iconfont icon-a-hao font12 mr5"}),e.a.createElement("span",null,"\u65B0\u5EFA\u9898\u76EE"))))),e.a.createElement("div",{className:Y.a.content},e.a.createElement("div",{className:Y.a.left},e.a.createElement("div",{className:Y.a.filterPoint},e.a.createElement("div",{className:Y.a.btnWarp,ref:sr,style:Wt>0?{height:Wt===1?92:"auto"}:{}},pr==null?void 0:pr.map(function(He){var Se;return e.a.createElement("div",{onClick:function(){return On(He.id,"tag")},key:He.id,className:Ae!=null&&(Se=Ae.tag_discipline_id)!==null&&Se!==void 0&&Se.includes(He.id)?Y.a.btnActive:Y.a.btn},e.a.createElement("span",{title:He.name},He.name),e.a.createElement("span",{style:{display:He.count?"block":"none"}},He.count))}),!!Wt&&e.a.createElement(e.a.Fragment,null,Wt===1?e.a.createElement("div",{onClick:function(){return gt(2)},className:Y.a.action},"\u5C55\u5F00",e.a.createElement("i",{style:{transform:"scale(0.7)"},className:"iconfont icon-xiala"})):e.a.createElement("div",{onClick:function(){return gt(1)},className:Y.a.action},"\u6536\u8D77",e.a.createElement("i",{style:{transform:"rotate(180deg) translateY(1px) scale(0.7)"},className:"iconfont icon-xiala"}))))),!!Sr.length&&e.a.createElement(e.a.Fragment,null,e.a.createElement("div",{className:Y.a.line}),e.a.createElement("div",{className:Y.a.filterOrigin},e.a.createElement("div",{className:Y.a.btnWarp,ref:Rr,style:Je>0?{height:Je===1?92:"auto"}:{}},Sr==null?void 0:Sr.map(function(He){var Se;return e.a.createElement("div",{onClick:function(){return On(He.id,"source")},key:He.id,className:Ae!=null&&(Se=Ae.source_discipline_id)!==null&&Se!==void 0&&Se.includes(He.id)?Y.a.btnActive:Y.a.btn},e.a.createElement("span",{title:He.name},He.name),e.a.createElement("span",null,He.count))}),!!Je&&e.a.createElement(e.a.Fragment,null,Je===1?e.a.createElement("div",{onClick:function(){return Yt(2)},className:Y.a.action},"\u5C55\u5F00",e.a.createElement("i",{style:{transform:"scale(0.7)"},className:"iconfont icon-xiala"})):e.a.createElement("div",{onClick:function(){return Yt(1)},className:Y.a.action},"\u6536\u8D77",e.a.createElement("i",{style:{transform:"rotate(180deg) translateY(1px) scale(0.7)"},className:"iconfont icon-xiala"})))))),e.a.createElement("div",{className:Y.a.control},e.a.createElement(w.a,{allowClear:!0,placeholder:"\u96BE\u5EA6",value:Ae==null?void 0:Ae.difficulty,onChange:function(Se){return gn(Se,"difficulty")}},e.a.createElement(w.a.Option,{value:1},"\u7B80\u5355"),e.a.createElement(w.a.Option,{value:2},"\u9002\u4E2D"),e.a.createElement(w.a.Option,{value:3},"\u56F0\u96BE")),Object(X.q)()&&Ae.filter==="public"&&e.a.createElement(w.a,{allowClear:!0,placeholder:"\u72B6\u6001",value:Ae==null?void 0:Ae.status,onChange:function(Se){return gn(Se,"status")}},e.a.createElement(w.a.Option,{value:0},"\u672A\u5F00\u542F"),e.a.createElement(w.a.Option,{value:1},"\u8FDB\u884C\u4E2D"),e.a.createElement(w.a.Option,{value:2},"\u5DF2\u901A\u8FC7")),Object(X.q)()&&Ae.filter==="mine"&&e.a.createElement(w.a,{allowClear:!0,placeholder:"\u72B6\u6001",value:Ae==null?void 0:Ae.practice_status,onChange:function(Se){return gn(Se,"practice_status")}},e.a.createElement(w.a.Option,{value:0},"\u672A\u53D1\u5E03"),e.a.createElement(w.a.Option,{value:1},"\u5DF2\u516C\u5F00"),e.a.createElement(w.a.Option,{value:2},"\u672A\u5BA1\u6838"),e.a.createElement(w.a.Option,{value:3},"\u5BA1\u6838\u4E2D"),e.a.createElement(w.a.Option,{value:4},"\u672A\u516C\u5F00"),e.a.createElement(w.a.Option,{value:5},"\u672A\u901A\u8FC7")),Object(X.q)()&&Ae.filter==="all"&&e.a.createElement(w.a,{allowClear:!0,placeholder:"\u72B6\u6001",value:Ae==null?void 0:Ae.practice_status,onChange:function(Se){return gn(Se,"practice_status")}},e.a.createElement(w.a.Option,{value:0},"\u672A\u53D1\u5E03"),e.a.createElement(w.a.Option,{value:1},"\u5DF2\u516C\u5F00"),e.a.createElement(w.a.Option,{value:2},"\u672A\u5BA1\u6838"),e.a.createElement(w.a.Option,{value:3},"\u5BA1\u6838\u4E2D"),e.a.createElement(w.a.Option,{value:4},"\u672A\u516C\u5F00"),e.a.createElement(w.a.Option,{value:5},"\u672A\u901A\u8FC7")),e.a.createElement(M.a.Search,{placeholder:Object(X.w)()?"\u8BF7\u8F93\u5165\u9898\u76EE\u540D\u79F0\u3001\u521B\u5EFA\u8005\u641C\u7D22":"\u8BF7\u8F93\u5165\u9898\u76EE\u540D\u79F0\u641C\u7D22",value:Ae==null?void 0:Ae.save_search,onChange:function(Se){return Vn(Se.target.value)},onSearch:function(){Ae.page=1,Ae.search=Ae.save_search,br(Object(h.a)({},Ae)),Fr(Ae)}})),e.a.createElement("div",{className:Y.a.table},e.a.createElement("div",{className:Y.a.tabWarp,style:Object(X.w)()||Br?{}:{height:10,border:0}},Object(X.w)()?e.a.createElement(E.a,{className:Y.a.tab,activeKey:zr?"not_reviewed":Ae.filter,onChange:Bn},e.a.createElement(E.a.TabPane,{tab:"\u516C\u5171",key:"public"}),e.a.createElement(E.a.TabPane,{tab:"\u5168\u90E8",key:"all"}),e.a.createElement(E.a.TabPane,{tab:"\u6211\u521B\u5EFA\u7684",key:"mine"}),e.a.createElement(E.a.TabPane,{tab:"\u5BA1\u6838\u5217\u8868",key:"not_reviewed"})):Br?e.a.createElement(E.a,{className:Y.a.tab,activeKey:zr?"not_reviewed":Ae.filter,onChange:Bn},e.a.createElement(E.a.TabPane,{tab:"\u516C\u5171",key:"public"}),e.a.createElement(E.a.TabPane,{tab:"\u6211\u521B\u5EFA\u7684",key:"mine"}),e.a.createElement(E.a.TabPane,{tab:"\u5BA1\u6838\u5217\u8868",key:"not_reviewed"})):null,Object(X.w)()&&!zr&&e.a.createElement(d.a,{overlay:jn},e.a.createElement("span",{className:"ant-dropdown-link font14 current",onClick:function(Se){return Se.preventDefault()}},"\u6279\u91CF\u64CD\u4F5C ",e.a.createElement("i",{style:{display:"inline-block",transform:"scale(0.6)",fontSize:12},className:"iconfont icon-xiajiantou1"})))),zr?e.a.createElement("div",{className:Y.a.tabWarp2,style:Object(X.w)()||Br?{}:{height:10,border:0}},e.a.createElement(E.a,{className:Y.a.tab,activeKey:Ae.filter,onChange:Bn},e.a.createElement(E.a.TabPane,{tab:"\u5F85\u5BA1\u6838",key:"not_reviewed"}),e.a.createElement(E.a.TabPane,{tab:"\u5BA1\u6838\u4E2D",key:"under_review"}),e.a.createElement(E.a.TabPane,{tab:"\u5DF2\u5BA1\u6838",key:"review_finished"}))):null,e.a.createElement(I.a,{rowSelection:Object(X.w)()?Yn:void 0,className:Y.a.customTable,dataSource:u,bordered:!1,rowKey:function(Se){return Se.identifier},columns:zr?wn:Hn,rowClassName:Y.a.row,loading:se,onRow:function(Se){return{onMouseEnter:function(Ye){bt(Se==null?void 0:Se.identifier)},onMouseLeave:function(Ye){bt(null)}}},onChange:Un,pagination:{pageSize:Ae.per_page,total:rr,current:Ae.page,showQuickJumper:!0,hideOnSinglePage:!0,showSizeChanger:!1,position:["bottomCenter"],showTotal:function(Se){return e.a.createElement("span",{className:"mr10"},"\u5171",e.a.createElement("span",{className:"c-orange"},Se),"\u6761\u6570\u636E")}}}))),e.a.createElement("div",{className:Y.a.right},e.a.createElement("div",{className:Y.a.title},e.a.createElement("img",{src:Object(X.q)()?F.a.IMG_SERVER+"/images/"+(wt==null||((be=wt.my_record)===null||be===void 0)?void 0:be.image_url):$e.a}),e.a.createElement("span",null,"\u6211\u7684\u5237\u9898\u7EDF\u8BA1")),e.a.createElement("ul",null,e.a.createElement("li",null,e.a.createElement("div",null,e.a.createElement("span",null,"\u901A\u8FC7\u7387"),Object(X.q)()?e.a.createElement("span",null,(wt==null||((we=wt.my_record)===null||we===void 0)?void 0:we.passed_ratio)||0,"%"):e.a.createElement("span",null,"-")),e.a.createElement("img",{src:Ne.a})),e.a.createElement("li",null,e.a.createElement("div",null,e.a.createElement("span",null,"\u5237\u9898\u6570"),Object(X.q)()?e.a.createElement("span",null,(wt==null||((ke=wt.my_record)===null||ke===void 0)?void 0:ke.passed_count)||0):e.a.createElement("span",null,"-")),e.a.createElement("img",{src:Ce.a})),e.a.createElement("li",null,e.a.createElement("div",null,e.a.createElement("span",null,"\u65F6\u957F(h)"),Object(X.q)()?e.a.createElement("span",null,wt==null||((xe=wt.my_record)===null||xe===void 0||((Oe=xe.time_count)===null||Oe===void 0))?void 0:Oe.toFixed(2)):e.a.createElement("span",null,"-")),e.a.createElement("img",{src:Re.a}))),!!(wt!=null&&(ae=wt.rank_list)!==null&&ae!==void 0&&ae.length)&&e.a.createElement(e.a.Fragment,null,e.a.createElement("div",{className:Y.a.line}),((ee=qe.userInfo)===null||ee===void 0?void 0:ee.user_id)!=2&&Object(X.m)()&&(dt==null||((te=dt.setting)===null||te===void 0)?void 0:te.main_site)&&En&&(Ar==null?void 0:Ar.length)>0&&e.a.createElement("div",{className:Y.a.problemsclose,style:{position:"relative"}},e.a.createElement(N.a,{autoplay:!0,pauseOnDotsHover:!0,style:{width:292,height:170,marginBottom:"10px",overflow:"hidden"}},Ar==null?void 0:Ar.map(function(He,Se){return e.a.createElement("div",{style:{display:"flex"},key:Se},e.a.createElement("a",{href:"/paths/".concat(He.identifier)},e.a.createElement("img",{style:{width:"292px",height:"170px",borderRadius:"4px"},src:F.a.IMG_SERVER+"/"+He.image_url})))})),e.a.createElement("img",{className:Y.a.imgsrc,onClick:function(){localStorage.setItem("problemsclose",k()().add(1,"days").unix()+""),sn(!1)},src:st.a})),e.a.createElement("div",{className:Y.a.sort},e.a.createElement("div",{className:Y.a.titles},e.a.createElement("img",{src:Z.a}),e.a.createElement("span",null,"\u6392\u884C\u699C")),!!(wt!=null&&(H=wt.my_record)!==null&&H!==void 0&&H.rank)&&e.a.createElement("div",{className:Y.a.li,style:{background:"#D3EAFF"}},e.a.createElement("span",null,e.a.createElement("span",{style:{fontWeight:600,color:"#0152d9"}},(wt==null||((G=wt.my_record)===null||G===void 0)?void 0:G.rank)>999?"999+":wt==null||((V=wt.my_record)===null||V===void 0)?void 0:V.rank)),e.a.createElement("img",{className:"ml10 mr10",style:{borderRadius:"50%"},width:26,height:26,src:F.a.IMG_SERVER+"/images/"+(wt==null||((J=wt.my_record)===null||J===void 0)?void 0:J.image_url)}),e.a.createElement("span",{title:wt==null||((de=wt.my_record)===null||de===void 0)?void 0:de.nickname,style:{color:"#656F87",maxWidth:96,whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden"}},wt==null||((ge=wt.my_record)===null||ge===void 0)?void 0:ge.nickname),e.a.createElement("img",{className:"ml10",src:lt.a}),e.a.createElement("span",{style:{marginLeft:"auto",color:"#0152d9"}},wt==null||((Me=wt.my_record)===null||Me===void 0)?void 0:Me.passed_count,"\u9898")),wt==null||((et=wt.rank_list)===null||et===void 0)?void 0:et.map(function(He,Se){var Le=Se+1;return Se===0&&(Le=Ke.a),Se===1&&(Le=Pe.a),Se===2&&(Le=Qe.a),e.a.createElement("div",{className:Y.a.li},e.a.createElement("span",null,typeof Le=="number"?e.a.createElement("span",{style:{fontWeight:600}},Le):e.a.createElement("img",{src:Le})),e.a.createElement("img",{className:"ml10 mr10",style:{borderRadius:"50%"},width:26,height:26,src:F.a.IMG_SERVER+"/images/"+(He==null?void 0:He.image_url)}),e.a.createElement("span",{title:He==null?void 0:He.nickname,style:{color:"#656F87",width:96,whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden"}},He==null?void 0:He.nickname),e.a.createElement("span",{style:{marginLeft:"auto"}},He.passed_count,"\u9898"))}))))),e.a.createElement(C.a,{title:"\u5BA1\u6838\u8BB0\u5F55",visible:hn,onOk:function(){},onCancel:function(){bn(!1)},footer:null,closable:!0},e.a.createElement(I.a,{dataSource:mr,columns:kn})),e.a.createElement(C.a,{title:"\u672A\u901A\u8FC7\u539F\u56E0",visible:Er,onOk:function(){},onCancel:function(){Jr(!1)},footer:null,closable:!0},e.a.createElement(_.a,{value:qt})))};ze.default=Object(y.a)(function(ht){var ut=ht.user,fe=ht.globalSetting;return{user:ut,globalSetting:fe}})(rt)},yDOu:function(ft,ze){ft.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABZlJREFUaEPtmd1rXNUah5/1tfdkkrSNMdWO+C0pp6mKYhURURRFvPFGiwj+A4p44Y30pngj5+ZcHET/AUGkeuONiKIoIqJVRO0UDdpzPAen2hhTm2Qye68vWdlOmYQ2M/2gYaQDw2K+f8/7/t53r/WOYMhvYsj1cxFgszN4MQN/mwzEGM8om0KIeD7gz+hH1//getEvvDBYU9i/nzXizwXmrAB6hXdFN3dV4mcOV2urtRam0ahEN3dV68zhau2FORuQMwI4nfAkurUDsXC0Er00j1hZXAswMk4cm6xET+wgNo4SE8y5ggwM0BXfG/Gu8P8fQibBUxOIzjKi2ILY2l4L8EedmJ8g1kaJcwvEBHTlbsLpQAbNxkAA68V/CHJ6B2JV+CRivIWsaWQxhmgfR47VEbZYC2By4lKbWN9GyJeIHUdYbBBG5iuQ2aPEeyH02moQiIEBegpUNkEmm4xpJAVqSSGlQ3UkMpNIbxG1HOFsBaENsVMQlSGWgVALhKDxY55Ajl9yhGSvmQrgJMR5AeiNfor8FMi5/yLHM6TYhpIlatGitnhUO6BkjvIeoQUy+ApAKqKLBKWIocDXJf6Ewo8bfMjw8Th+sSRMXUOYg5Ay0S3ufhB9M5AAUvRTl5lYQCbb6AKVxPtFdNBo4VFRoaNFC4MSAeUE0oQKwEqijoQo8dHihcEJj4sKLx1OjeMShMvxyU4LE4RU3AninAC60d+7Fzkzg/hsHpVsUxh0V7yJGBcxUaJ1gXnwXhq7ruPqiS1sN4aRVQDLysIJjh0+wk/vfkjL5VgRcFpgrcB2IXKLS3a6YxLfbBIPHKjstBHEhhlYH/3Zo6ipY2iboQuPSeJLR6YzzC3TXPLw3dyxZZTLfED5gOy98ClJUMk6y/z69sd89tUsv7sSm2nKBJErrClxc9tx0zvwg2ZhIIBk4xT9ZB2Xo8uAySMGQS4V2f17uOK+27lHCEasR4VkqYg8iRBSFAlS4Y3Cx8jKB5/z0fsH+Tl4SiJFIbCZxOoCl6yUspAKup+NTgtw0j5vIJP3e6MvOmQdQwbkt+3k0kcf4KEYqTuPDin6EeUdSvz17TGC0ngl8FLitcIJQfvN93jni+/5DShqljLWKNdn4cBjG9toQ4Bu8XIYxR+o5P3lZTJtyYQkN4Havqd5cHSERmkxLqC9Q6c1ZSDGqoiFSMVI0BKnNC6tmcEur9B68WXetZJODBTOUI6OUqZaYCueXfh+xdwXoNc+K2BMXkU+3R++k6vvu537O5bMO4x1mD27eWL+OP9pHuEb/gJAEGeu46bJbVx78BCvGY1VGlszlB98zvtvf8pPKQvpbgvKEbCD2mhgAJ+j6w7T7pAhybVg5LknuWvqEnYWJZkLmNKSTV/Fnssv5ZbWHN8e+oFvUwZ238CNjSlu/OU3vpr9HwczQ6klNs8o537n+3+9yicuskKgqNco2wmwwA1SB30BWi3UbImaqqPbEaMyMueoOcHIP5/iESGZtJYsiU8QzmP+cS23JsGtYzQTQGM7MwnouyN8mSxkFGXKgjGUMTD//Cu8pSMrWtPxJWVdYOfauOkM32jgNyrkMwaIgjwEakZTe/FZHneeuvVktiRLLdV7jA/o3ddzcxK+urU+RvPQj3ytUg2oqnWajDKBaEV737953To6UtIRkeLCATzD4y6eI4Cgve+lCwgwdBbqdqGhLeLz2UYntnLll00OXNA2unrWHdYLWeogezdjK5Fa6J3Vhu6stxJJfHc3OpSbuV6A7mFmKLfTqzYa1gPNqbIwVEfKLkBa09Z6KA/164p5dcgwVGOV9VlIj4dusHUqiNSZhma02J0uDPVwt3dEMrTj9V6IXlt1nx+aPzjWg5wK5lTv6X2u38iw3+e7r/edjQ76RZv1vosAmxX5ixba7Mj/bTLwJ/OqjXyXcOSkAAAAAElFTkSuQmCC"},yR49:function(ft,ze,K){ft.exports=K.p+"static/b.3edd9583.svg"},zlzj:function(ft,ze,K){ft.exports=K.p+"static/b3.30079151.svg"},zqRK:function(ft,ze,K){ft.exports=K.p+"static/v.7a1274ca.svg"}}]);