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.
384 lines
876 KiB
384 lines
876 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[100,5,7,8,13],{"+ua5":function(xt,ft,se){},"479L":function(xt,ft){xt.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAWCAYAAAAvg9c4AAAAAXNSR0IArs4c6QAABPdJREFUSEullWloHGUYx//vzO7sHDuzm93sZpM2l/SgRyK7xSYxrfYgbdUq6JcixXqAUrxItGAVMT1A+kH7Re1WWppa6afiAYJIi7ZB07vkIARzVJqYbJMmu90zszOzM6/MVEXQotR3mPky8/7e//N7ZuYl+J+jt7fX7/f7i/X19cU/UORemZRSZnBwsKNQKLztdrtHOI57sqGhYcbm3ROUUsoOD4++Mz9f2CtJItE0DaVSqTMWi+27Jyil1DM0NLTfsmgHpZbLhthQSmlfTU3NmkgkUvjPSSmlZGRkZI2maZ2mWdpAGBehpgnd0KBpOkzTLPn9/gei0Wjfv0JHR0cXGpq2xTDNHZTSJsu0OJNaIIRFUc07KXXdgGVZCAQCL7e0tMT/Br3ja3iRaZptlmU9YVHayhBGoAApGTpKhgHCsFCLRaRvp+yEtk9QaiEYDHy0cWPb639CbdjAwADP8/zRkmk9BYADIU4nLUqdycX5Agxdh4cXkLh5E8m5WTD2A4SAZVmEwxVnNm3a9AiJx+MrdSI8nslm25YtqlMaVi6LWab1+2IUFIB9NXQDuUwapmFAUnwYHBhAOp0Ex3nAcRx4QUA4FL62ecuWVnL01Om8V1YkXdewpMoLn6zYC4NhGLhcLng4t4OdnEognUqCIQSSJOPipYvI5gsQBBGyV4KiyAgFgz83NDauImevDtFUJo+ZqXGsW7UcvjK/zQDDEBBCHF+pZBKTU1NOl1mWgYfnMTNzy1FTWbUA6UzWuVce9N2QRKmRfP3d9zSRLOBS9xlsbVsLv893p2TLcjzqhgGtqEEvGWAI47izyx27ft2ppq6uHpIoIFcowqfIkz7Fu4LEjxyhVUtX4cuTn2FxdQiiKILYKe3DbpTtwu4Fw4Bzu8F5PGAZFqnbKWdhRVEQDkegm5YNnVhYFVlJ9uzbb2x++iXXxwf2o0Jxg+N5J4ENs/0RlgVLCFwuNyRJhCAITgX+sgCyubzjXZK88Hq9ttuRMr8SI2d+OHdCqFz8zMkjh1SeqqXy8qBsGIbj0rQs56UGpXCxLCRZhiLLmFdVyF4FmmFAUXzw+RRIogSvV+xdUFX5ILl07drBIh/quHD2bNeK+vLLum7ENXUe+Xweqqo6p6brMEsleDweJ1Eul0MgWA7Too6uYCAAryxDEvlzzU1NbeTClSsHDTHScaG7+/D6pmU9k2nt8/TU+NUl91UP53K5dblcrjKfzzOFQsFpmu01k8mgrCwAC4yjygZXVkYgy9LR1paWF0n3jz0fMMGaN8+f6z68oXnp+V/T1omRgd7ju9t3Pp9IJMTZ2dmHMpnMtnQ6/Wg2mw2pqkqy2SzcbjdcnAiOczuJIxUhVIRCu5qbV39Ivj19+oBSvfytyz/1HG5trLs4NU+O3xge6npj53Mv/PUHPj09HR4bG9s+NzfXnkymatSiCoEX4C8rA+fh4eE4GioPrI1Goz3k1Fdf7KlcEuvsu3z1mN9jjY3fSr/vgX5oV/trr/zTrtDf379wYmIinkqlHrMsi8iyDFnxQRCFsdrq6tW1tbW3yXt79z77y42J44KL5FPJOeJiXUb0/oYdu9/t/OZuW42tpa+v75iqqtvy+RwqwiEIvPjJw+vXv+q8011dXXx/f/9WWZaVQCBwE0Bfe3v7NCHE/rDuOmzw+Pj4p4lEYruLZWeqa2o2xmKxIXvCb487Tm3fsdeDAAAAAElFTkSuQmCC"},"55Ip":function(xt,ft,se){"use strict";se.d(ft,"a",function(){return t});var pe=se("Ty5D"),j=se("dI71"),C=se("q1tI"),k=se.n(C),x=se("YS25"),L=se("17x9"),F=se.n(L),N=se("wx14"),O=se("zLVn"),w=se("9R94"),y=function(d){Object(j.a)(a,d);function a(){for(var c,f=arguments.length,S=new Array(f),A=0;A<f;A++)S[A]=arguments[A];return c=d.call.apply(d,[this].concat(S))||this,c.history=Object(x.a)(c.props),c}var o=a.prototype;return o.render=function(){return k.a.createElement(pe.c,{history:this.history,children:this.props.children})},a}(k.a.Component),_=function(d){Object(j.a)(a,d);function a(){for(var c,f=arguments.length,S=new Array(f),A=0;A<f;A++)S[A]=arguments[A];return c=d.call.apply(d,[this].concat(S))||this,c.history=Object(x.b)(c.props),c}var o=a.prototype;return o.render=function(){return k.a.createElement(pe.c,{history:this.history,children:this.props.children})},a}(k.a.Component),s=function(a,o){return typeof a=="function"?a(o):a},r=function(a,o){return typeof a=="string"?Object(x.c)(a,null,null,o):a},i=function(a){return a},u=k.a.forwardRef;typeof u=="undefined"&&(u=i);function l(d){return!!(d.metaKey||d.altKey||d.ctrlKey||d.shiftKey)}var e=u(function(d,a){var o=d.innerRef,c=d.navigate,f=d.onClick,S=Object(O.a)(d,["innerRef","navigate","onClick"]),A=S.target,R=Object(N.a)({},S,{onClick:function(U){try{f&&f(U)}catch(K){throw U.preventDefault(),K}!U.defaultPrevented&&U.button===0&&(!A||A==="_self")&&!l(U)&&(U.preventDefault(),c())}});return i!==u?R.ref=a||o:R.ref=o,k.a.createElement("a",R)}),t=u(function(d,a){var o=d.component,c=o===void 0?e:o,f=d.replace,S=d.to,A=d.innerRef,R=Object(O.a)(d,["component","replace","to","innerRef"]);return k.a.createElement(pe.e.Consumer,null,function(B){B||Object(w.a)(!1);var U=B.history,K=r(s(S,B.location),B.location),D=K?U.createHref(K):"",H=Object(N.a)({},R,{href:D,navigate:function(){var ne=s(S,B.location),ie=f?U.replace:U.push;ie(ne)}});return i!==u?H.ref=a||A:H.innerRef=A,k.a.createElement(c,H)})});if(!1)var n,T;var b=function(a){return a},g=k.a.forwardRef;typeof g=="undefined"&&(g=b);function E(){for(var d=arguments.length,a=new Array(d),o=0;o<d;o++)a[o]=arguments[o];return a.filter(function(c){return c}).join(" ")}var v=g(function(d,a){var o=d["aria-current"],c=o===void 0?"page":o,f=d.activeClassName,S=f===void 0?"active":f,A=d.activeStyle,R=d.className,B=d.exact,U=d.isActive,K=d.location,D=d.sensitive,H=d.strict,V=d.style,ne=d.to,ie=d.innerRef,_e=Object(O.a)(d,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return k.a.createElement(pe.e.Consumer,null,function(ye){ye||Object(w.a)(!1);var be=K||ye.location,we=r(s(ne,be),be),Re=we.pathname,ge=Re&&Re.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),Q=ge?Object(pe.f)(be.pathname,{path:ge,exact:B,sensitive:D,strict:H}):null,Pe=!!(U?U(Q,be):Q),$e=Pe?E(R,S):R,Fe=Pe?Object(N.a)({},V,{},A):V,Me=Object(N.a)({"aria-current":Pe&&c||null,className:$e,style:Fe,to:we},_e);return b!==g?Me.ref=a||ie:Me.innerRef=ie,k.a.createElement(t,Me)})});if(!1)var p},"5VLF":function(xt,ft,se){"use strict";var pe,j;function C(k,x,L){var F=function(N,O){return k.js_beautify(N,O)};return F.js=k.js_beautify,F.css=x.css_beautify,F.html=L.html_beautify,F.js_beautify=k.js_beautify,F.css_beautify=x.css_beautify,F.html_beautify=L.html_beautify,F}!(pe=[se("6UM0"),se("TXwP"),se("psGv")],j=function(k,x,L){return C(k,x,L)}.apply(ft,pe),j!==void 0&&(xt.exports=j))},"6+eU":function(xt,ft,se){"use strict";se.d(ft,"a",function(){return g});var pe=se("wx14"),j=se("rePB"),C=se("VTBJ"),k=se("1OyB"),x=se("vuIU"),L=se("Ji7U"),F=se("LK+K"),N=se("q1tI"),O=se.n(N),w=se("TSYQ"),y=se.n(w),_=function(v){var p,d="".concat(v.rootPrefixCls,"-item"),a=y()(d,"".concat(d,"-").concat(v.page),(p={},Object(j.a)(p,"".concat(d,"-active"),v.active),Object(j.a)(p,v.className,!!v.className),Object(j.a)(p,"".concat(d,"-disabled"),!v.page),p)),o=function(){v.onClick(v.page)},c=function(S){v.onKeyPress(S,v.onClick,v.page)};return O.a.createElement("li",{title:v.showTitle?v.page:null,className:a,onClick:o,onKeyPress:c,tabIndex:"0"},v.itemRender(v.page,"page",O.a.createElement("a",{rel:"nofollow"},v.page)))},s=_,r={ZERO:48,NINE:57,NUMPAD_ZERO:96,NUMPAD_NINE:105,BACKSPACE:8,DELETE:46,ENTER:13,ARROW_UP:38,ARROW_DOWN:40},i=function(E){Object(L.a)(p,E);var v=Object(F.a)(p);function p(){var d;Object(k.a)(this,p);for(var a=arguments.length,o=new Array(a),c=0;c<a;c++)o[c]=arguments[c];return d=v.call.apply(v,[this].concat(o)),d.state={goInputText:""},d.buildOptionText=function(f){return"".concat(f," ").concat(d.props.locale.items_per_page)},d.changeSize=function(f){d.props.changeSize(Number(f))},d.handleChange=function(f){d.setState({goInputText:f.target.value})},d.handleBlur=function(f){var S=d.props,A=S.goButton,R=S.quickGo,B=S.rootPrefixCls,U=d.state.goInputText;if(A||U==="")return;if(f.relatedTarget&&(f.relatedTarget.className.indexOf("".concat(B,"-prev"))>=0||f.relatedTarget.className.indexOf("".concat(B,"-next"))>=0))return;d.setState({goInputText:""}),R(d.getValidValue())},d.go=function(f){var S=d.state.goInputText;if(S==="")return;(f.keyCode===r.ENTER||f.type==="click")&&(d.setState({goInputText:""}),d.props.quickGo(d.getValidValue()))},d}return Object(x.a)(p,[{key:"getValidValue",value:function(){var a=this.state,o=a.goInputText,c=a.current;return!o||isNaN(o)?c:Number(o)}},{key:"getPageSizeOptions",value:function(){var a=this.props,o=a.pageSize,c=a.pageSizeOptions;return c.some(function(f){return f.toString()===o.toString()})?c:c.concat([o.toString()]).sort(function(f,S){var A=isNaN(Number(f))?0:Number(f),R=isNaN(Number(S))?0:Number(S);return A-R})}},{key:"render",value:function(){var a=this,o=this.props,c=o.pageSize,f=o.locale,S=o.rootPrefixCls,A=o.changeSize,R=o.quickGo,B=o.goButton,U=o.selectComponentClass,K=o.buildOptionText,D=o.selectPrefixCls,H=o.disabled,V=this.state.goInputText,ne="".concat(S,"-options"),ie=U,_e=null,ye=null,be=null;if(!A&&!R)return null;var we=this.getPageSizeOptions();if(A&&ie){var Re=we.map(function(ge,Q){return O.a.createElement(ie.Option,{key:Q,value:ge.toString()},(K||a.buildOptionText)(ge))});_e=O.a.createElement(ie,{disabled:H,prefixCls:D,showSearch:!1,className:"".concat(ne,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(c||we[0]).toString(),onChange:this.changeSize,getPopupContainer:function(Q){return Q.parentNode}},Re)}return R&&(B&&(be=typeof B=="boolean"?O.a.createElement("button",{type:"button",onClick:this.go,onKeyUp:this.go,disabled:H,className:"".concat(ne,"-quick-jumper-button")},f.jump_to_confirm):O.a.createElement("span",{onClick:this.go,onKeyUp:this.go},B)),ye=O.a.createElement("div",{className:"".concat(ne,"-quick-jumper")},f.jump_to,O.a.createElement("input",{disabled:H,type:"text",value:V,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur}),f.page,be)),O.a.createElement("li",{className:"".concat(ne)},_e,ye)}}]),p}(O.a.Component);i.defaultProps={pageSizeOptions:["10","20","50","100"]};var u=i,l=se("N2Kk");function e(){}function t(E){return typeof E=="number"&&isFinite(E)&&Math.floor(E)===E}function n(E,v,p){return p}function T(E,v,p){var d=typeof E=="undefined"?v.pageSize:E;return Math.floor((p.total-1)/d)+1}var b=function(E){Object(L.a)(p,E);var v=Object(F.a)(p);function p(d){var a;Object(k.a)(this,p),a=v.call(this,d),a.getJumpPrevPage=function(){return Math.max(1,a.state.current-(a.props.showLessItems?3:5))},a.getJumpNextPage=function(){return Math.min(T(void 0,a.state,a.props),a.state.current+(a.props.showLessItems?3:5))},a.getItemIcon=function(A,R){var B=a.props.prefixCls,U=A||O.a.createElement("button",{type:"button","aria-label":R,className:"".concat(B,"-item-link")});return typeof A=="function"&&(U=O.a.createElement(A,Object(C.a)({},a.props))),U},a.savePaginationNode=function(A){a.paginationNode=A},a.isValid=function(A){return t(A)&&A!==a.state.current},a.shouldDisplayQuickJumper=function(){var A=a.props,R=A.showQuickJumper,B=A.pageSize,U=A.total;return U<=B?!1:R},a.handleKeyDown=function(A){(A.keyCode===r.ARROW_UP||A.keyCode===r.ARROW_DOWN)&&A.preventDefault()},a.handleKeyUp=function(A){var R=a.getValidValue(A),B=a.state.currentInputValue;R!==B&&a.setState({currentInputValue:R}),A.keyCode===r.ENTER?a.handleChange(R):A.keyCode===r.ARROW_UP?a.handleChange(R-1):A.keyCode===r.ARROW_DOWN&&a.handleChange(R+1)},a.changePageSize=function(A){var R=a.state.current,B=T(A,a.state,a.props);R=R>B?B:R,B===0&&(R=a.state.current),typeof A=="number"&&("pageSize"in a.props||a.setState({pageSize:A}),"current"in a.props||a.setState({current:R,currentInputValue:R})),a.props.onShowSizeChange(R,A),"onChange"in a.props&&a.props.onChange&&a.props.onChange(R,A)},a.handleChange=function(A){var R=a.props.disabled,B=A;if(a.isValid(B)&&!R){var U=T(void 0,a.state,a.props);B>U?B=U:B<1&&(B=1),"current"in a.props||a.setState({current:B,currentInputValue:B});var K=a.state.pageSize;return a.props.onChange(B,K),B}return a.state.current},a.prev=function(){a.hasPrev()&&a.handleChange(a.state.current-1)},a.next=function(){a.hasNext()&&a.handleChange(a.state.current+1)},a.jumpPrev=function(){a.handleChange(a.getJumpPrevPage())},a.jumpNext=function(){a.handleChange(a.getJumpNextPage())},a.hasPrev=function(){return a.state.current>1},a.hasNext=function(){return a.state.current<T(void 0,a.state,a.props)},a.runIfEnter=function(A,R){if(A.key==="Enter"||A.charCode===13){for(var B=arguments.length,U=new Array(B>2?B-2:0),K=2;K<B;K++)U[K-2]=arguments[K];R.apply(void 0,U)}},a.runIfEnterPrev=function(A){a.runIfEnter(A,a.prev)},a.runIfEnterNext=function(A){a.runIfEnter(A,a.next)},a.runIfEnterJumpPrev=function(A){a.runIfEnter(A,a.jumpPrev)},a.runIfEnterJumpNext=function(A){a.runIfEnter(A,a.jumpNext)},a.handleGoTO=function(A){(A.keyCode===r.ENTER||A.type==="click")&&a.handleChange(a.state.currentInputValue)};var o=d.onChange!==e,c="current"in d;c&&!o&&console.warn("Warning: You provided a `current` prop to a Pagination component without an `onChange` handler. This will render a read-only component.");var f=d.defaultCurrent;"current"in d&&(f=d.current);var S=d.defaultPageSize;return"pageSize"in d&&(S=d.pageSize),f=Math.min(f,T(S,void 0,d)),a.state={current:f,currentInputValue:f,pageSize:S},a}return Object(x.a)(p,[{key:"componentDidUpdate",value:function(a,o){var c=this.props.prefixCls;if(o.current!==this.state.current&&this.paginationNode){var f=this.paginationNode.querySelector(".".concat(c,"-item-").concat(o.current));f&&document.activeElement===f&&f.blur()}}},{key:"getValidValue",value:function(a){var o=a.target.value,c=T(void 0,this.state,this.props),f=this.state.currentInputValue,S;return o===""?S=o:isNaN(Number(o))?S=f:o>=c?S=c:S=Number(o),S}},{key:"getShowSizeChanger",value:function(){var a=this.props,o=a.showSizeChanger,c=a.total,f=a.totalBoundaryShowSizeChanger;return typeof o!="undefined"?o:c>f}},{key:"renderPrev",value:function(a){var o=this.props,c=o.prevIcon,f=o.itemRender,S=f(a,"prev",this.getItemIcon(c,"prev page")),A=!this.hasPrev();return Object(N.isValidElement)(S)?Object(N.cloneElement)(S,{disabled:A}):S}},{key:"renderNext",value:function(a){var o=this.props,c=o.nextIcon,f=o.itemRender,S=f(a,"next",this.getItemIcon(c,"next page")),A=!this.hasNext();return Object(N.isValidElement)(S)?Object(N.cloneElement)(S,{disabled:A}):S}},{key:"render",value:function(){var a=this,o=this.props,c=o.prefixCls,f=o.className,S=o.style,A=o.disabled,R=o.hideOnSinglePage,B=o.total,U=o.locale,K=o.showQuickJumper,D=o.showLessItems,H=o.showTitle,V=o.showTotal,ne=o.simple,ie=o.itemRender,_e=o.showPrevNextJumpers,ye=o.jumpPrevIcon,be=o.jumpNextIcon,we=o.selectComponentClass,Re=o.selectPrefixCls,ge=o.pageSizeOptions,Q=this.state,Pe=Q.current,$e=Q.pageSize,Fe=Q.currentInputValue;if(R===!0&&B<=$e)return null;var Me=T(void 0,this.state,this.props),ze=[],xe=null,ke=null,je=null,Ge=null,Ue=null,Le=K&&K.goButton,Ae=D?1:2,nt=Pe-1>0?Pe-1:0,Qe=Pe+1<Me?Pe+1:Me,Ze=Object.keys(this.props).reduce(function(Y,X){return(X.substr(0,5)==="data-"||X.substr(0,5)==="aria-"||X==="role")&&(Y[X]=a.props[X]),Y},{});if(ne)return Le&&(typeof Le=="boolean"?Ue=O.a.createElement("button",{type:"button",onClick:this.handleGoTO,onKeyUp:this.handleGoTO},U.jump_to_confirm):Ue=O.a.createElement("span",{onClick:this.handleGoTO,onKeyUp:this.handleGoTO},Le),Ue=O.a.createElement("li",{title:H?"".concat(U.jump_to).concat(Pe,"/").concat(Me):null,className:"".concat(c,"-simple-pager")},Ue)),O.a.createElement("ul",Object(pe.a)({className:y()(c,"".concat(c,"-simple"),Object(j.a)({},"".concat(c,"-disabled"),A),f),style:S,ref:this.savePaginationNode},Ze),O.a.createElement("li",{title:H?U.prev_page:null,onClick:this.prev,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterPrev,className:y()("".concat(c,"-prev"),Object(j.a)({},"".concat(c,"-disabled"),!this.hasPrev())),"aria-disabled":!this.hasPrev()},this.renderPrev(nt)),O.a.createElement("li",{title:H?"".concat(Pe,"/").concat(Me):null,className:"".concat(c,"-simple-pager")},O.a.createElement("input",{type:"text",value:Fe,disabled:A,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onChange:this.handleKeyUp,size:"3"}),O.a.createElement("span",{className:"".concat(c,"-slash")},"/"),Me),O.a.createElement("li",{title:H?U.next_page:null,onClick:this.next,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterNext,className:y()("".concat(c,"-next"),Object(j.a)({},"".concat(c,"-disabled"),!this.hasNext())),"aria-disabled":!this.hasNext()},this.renderNext(Qe)),Ue);if(Me<=3+Ae*2){var Ye={locale:U,rootPrefixCls:c,onClick:this.handleChange,onKeyPress:this.runIfEnter,showTitle:H,itemRender:ie};Me||ze.push(O.a.createElement(s,Object(pe.a)({},Ye,{key:"noPager",page:Me,className:"".concat(c,"-disabled")})));for(var at=1;at<=Me;at+=1){var qe=Pe===at;ze.push(O.a.createElement(s,Object(pe.a)({},Ye,{key:at,page:at,active:qe})))}}else{var Xe=D?U.prev_3:U.prev_5,Be=D?U.next_3:U.next_5;_e&&(xe=O.a.createElement("li",{title:H?Xe:null,key:"prev",onClick:this.jumpPrev,tabIndex:"0",onKeyPress:this.runIfEnterJumpPrev,className:y()("".concat(c,"-jump-prev"),Object(j.a)({},"".concat(c,"-jump-prev-custom-icon"),!!ye))},ie(this.getJumpPrevPage(),"jump-prev",this.getItemIcon(ye,"prev page"))),ke=O.a.createElement("li",{title:H?Be:null,key:"next",tabIndex:"0",onClick:this.jumpNext,onKeyPress:this.runIfEnterJumpNext,className:y()("".concat(c,"-jump-next"),Object(j.a)({},"".concat(c,"-jump-next-custom-icon"),!!be))},ie(this.getJumpNextPage(),"jump-next",this.getItemIcon(be,"next page")))),Ge=O.a.createElement(s,{locale:U,last:!0,rootPrefixCls:c,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:Me,page:Me,active:!1,showTitle:H,itemRender:ie}),je=O.a.createElement(s,{locale:U,rootPrefixCls:c,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:1,page:1,active:!1,showTitle:H,itemRender:ie});var rt=Math.max(1,Pe-Ae),Je=Math.min(Pe+Ae,Me);Pe-1<=Ae&&(Je=1+Ae*2),Me-Pe<=Ae&&(rt=Me-Ae*2);for(var Ee=rt;Ee<=Je;Ee+=1){var He=Pe===Ee;ze.push(O.a.createElement(s,{locale:U,rootPrefixCls:c,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:Ee,page:Ee,active:He,showTitle:H,itemRender:ie}))}Pe-1>=Ae*2&&Pe!==1+2&&(ze[0]=Object(N.cloneElement)(ze[0],{className:"".concat(c,"-item-after-jump-prev")}),ze.unshift(xe)),Me-Pe>=Ae*2&&Pe!==Me-2&&(ze[ze.length-1]=Object(N.cloneElement)(ze[ze.length-1],{className:"".concat(c,"-item-before-jump-next")}),ze.push(ke)),rt!==1&&ze.unshift(je),Je!==Me&&ze.push(Ge)}var de=null;V&&(de=O.a.createElement("li",{className:"".concat(c,"-total-text")},V(B,[B===0?0:(Pe-1)*$e+1,Pe*$e>B?B:Pe*$e])));var oe=!this.hasPrev()||!Me,ue=!this.hasNext()||!Me;return O.a.createElement("ul",Object(pe.a)({className:y()(c,f,Object(j.a)({},"".concat(c,"-disabled"),A)),style:S,unselectable:"unselectable",ref:this.savePaginationNode},Ze),de,O.a.createElement("li",{title:H?U.prev_page:null,onClick:this.prev,tabIndex:oe?null:0,onKeyPress:this.runIfEnterPrev,className:y()("".concat(c,"-prev"),Object(j.a)({},"".concat(c,"-disabled"),oe)),"aria-disabled":oe},this.renderPrev(nt)),ze,O.a.createElement("li",{title:H?U.next_page:null,onClick:this.next,tabIndex:ue?null:0,onKeyPress:this.runIfEnterNext,className:y()("".concat(c,"-next"),Object(j.a)({},"".concat(c,"-disabled"),ue)),"aria-disabled":ue},this.renderNext(Qe)),O.a.createElement(u,{disabled:A,locale:U,rootPrefixCls:c,selectComponentClass:we,selectPrefixCls:Re,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:Pe,pageSize:$e,pageSizeOptions:ge,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:Le}))}}],[{key:"getDerivedStateFromProps",value:function(a,o){var c={};if("current"in a&&(c.current=a.current,a.current!==o.current&&(c.currentInputValue=c.current)),"pageSize"in a&&a.pageSize!==o.pageSize){var f=o.current,S=T(a.pageSize,o,a);f=f>S?S:f,"current"in a||(c.current=f,c.currentInputValue=f),c.pageSize=a.pageSize}return c}}]),p}(O.a.Component);b.defaultProps={defaultCurrent:1,total:0,defaultPageSize:10,onChange:e,className:"",selectPrefixCls:"rc-select",prefixCls:"rc-pagination",selectComponentClass:null,hideOnSinglePage:!1,showPrevNextJumpers:!0,showQuickJumper:!1,showLessItems:!1,showTitle:!0,onShowSizeChange:e,locale:l.a,style:{},itemRender:n,totalBoundaryShowSizeChanger:50};var g=b},"6UM0":function(xt,ft,se){var pe,j;(function(){var C;(function(){"use strict";var x=[function(O,w,y){var _=y(1).Beautifier,s=y(5).Options;function r(i,u){var l=new _(i,u);return l.beautify()}O.exports=r,O.exports.defaultOptions=function(){return new s}},function(O,w,y){var _=y(2).Output,s=y(3).Token,r=y(4),i=y(5).Options,u=y(7).Tokenizer,l=y(7).line_starters,e=y(7).positionable_operators,t=y(7).TOKEN;function n(D,H){return H.indexOf(D)!==-1}function T(D){return D.replace(/^\s+/g,"")}function b(D){for(var H={},V=0;V<D.length;V++)H[D[V].replace(/-/g,"_")]=D[V];return H}function g(D,H){return D&&D.type===t.RESERVED&&D.text===H}function E(D,H){return D&&D.type===t.RESERVED&&n(D.text,H)}var v=["case","return","do","if","throw","else","await","break","continue","async"],p=["before-newline","after-newline","preserve-newline"],d=b(p),a=[d.before_newline,d.preserve_newline],o={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function c(D,H){if(H.multiline_frame||H.mode===o.ForInitializer||H.mode===o.Conditional)return;D.remove_indent(H.start_line_index)}function f(D){D=D.replace(r.allLineBreaks,`
|
|
`);for(var H=[],V=D.indexOf(`
|
|
`);V!==-1;)H.push(D.substring(0,V)),D=D.substring(V+1),V=D.indexOf(`
|
|
`);return D.length&&H.push(D),H}function S(D){return D===o.ArrayLiteral}function A(D){return n(D,[o.Expression,o.ForInitializer,o.Conditional])}function R(D,H){for(var V=0;V<D.length;V++){var ne=D[V].trim();if(ne.charAt(0)!==H)return!1}return!0}function B(D,H){for(var V=0,ne=D.length,ie;V<ne;V++)if(ie=D[V],ie&&ie.indexOf(H)!==0)return!1;return!0}function U(D,H){H=H||{},this._source_text=D||"",this._output=null,this._tokens=null,this._last_last_text=null,this._flags=null,this._previous_flags=null,this._flag_store=null,this._options=new i(H)}U.prototype.create_flags=function(D,H){var V=0;D&&(V=D.indentation_level,!this._output.just_added_newline()&&D.line_indent_level>V&&(V=D.line_indent_level));var ne={mode:H,parent:D,last_token:D?D.last_token:new s(t.START_BLOCK,""),last_word:D?D.last_word:"",declaration_statement:!1,declaration_assignment:!1,multiline_frame:!1,inline_frame:!1,if_block:!1,else_block:!1,class_start_block:!1,do_block:!1,do_while:!1,import_block:!1,in_case_statement:!1,in_case:!1,case_body:!1,case_block:!1,indentation_level:V,alignment:0,line_indent_level:D?D.line_indent_level:V,start_line_index:this._output.get_line_number(),ternary_depth:0};return ne},U.prototype._reset=function(D){var H=D.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new _(this._options,H),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(o.BlockStatement);var V=new u(D,this._options);return this._tokens=V.tokenize(),D},U.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var D,H=this._reset(this._source_text),V=this._options.eol;this._options.eol==="auto"&&(V=`
|
|
`,H&&r.lineBreak.test(H||"")&&(V=H.match(r.lineBreak)[0]));for(var ne=this._tokens.next();ne;)this.handle_token(ne),this._last_last_text=this._flags.last_token.text,this._flags.last_token=ne,ne=this._tokens.next();return D=this._output.get_code(V),D},U.prototype.handle_token=function(D,H){D.type===t.START_EXPR?this.handle_start_expr(D):D.type===t.END_EXPR?this.handle_end_expr(D):D.type===t.START_BLOCK?this.handle_start_block(D):D.type===t.END_BLOCK?this.handle_end_block(D):D.type===t.WORD?this.handle_word(D):D.type===t.RESERVED?this.handle_word(D):D.type===t.SEMICOLON?this.handle_semicolon(D):D.type===t.STRING?this.handle_string(D):D.type===t.EQUALS?this.handle_equals(D):D.type===t.OPERATOR?this.handle_operator(D):D.type===t.COMMA?this.handle_comma(D):D.type===t.BLOCK_COMMENT?this.handle_block_comment(D,H):D.type===t.COMMENT?this.handle_comment(D,H):D.type===t.DOT?this.handle_dot(D):D.type===t.EOF?this.handle_eof(D):D.type===t.UNKNOWN?this.handle_unknown(D,H):this.handle_unknown(D,H)},U.prototype.handle_whitespace_and_comments=function(D,H){var V=D.newlines,ne=this._options.keep_array_indentation&&S(this._flags.mode);if(D.comments_before)for(var ie=D.comments_before.next();ie;)this.handle_whitespace_and_comments(ie,H),this.handle_token(ie,H),ie=D.comments_before.next();if(ne)for(var _e=0;_e<V;_e+=1)this.print_newline(_e>0,H);else if(this._options.max_preserve_newlines&&V>this._options.max_preserve_newlines&&(V=this._options.max_preserve_newlines),this._options.preserve_newlines&&V>1){this.print_newline(!1,H);for(var ye=1;ye<V;ye+=1)this.print_newline(!0,H)}};var K=["async","break","continue","return","throw","yield"];U.prototype.allow_wrap_or_preserved_newline=function(D,H){if(H=H===void 0?!1:H,this._output.just_added_newline())return;var V=this._options.preserve_newlines&&D.newlines||H,ne=n(this._flags.last_token.text,e)||n(D.text,e);if(ne){var ie=n(this._flags.last_token.text,e)&&n(this._options.operator_position,a)||n(D.text,e);V=V&&ie}if(V)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(E(this._flags.last_token,K))return;this._output.set_wrap_point()}},U.prototype.print_newline=function(D,H){if(!H&&(this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==t.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")))for(var V=this._tokens.peek();this._flags.mode===o.Statement&&!(this._flags.if_block&&g(V,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(D)&&(this._flags.multiline_frame=!0)},U.prototype.print_token_line_indentation=function(D){this._output.just_added_newline()&&(this._options.keep_array_indentation&&D.newlines&&(D.text==="["||S(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(D.whitespace_before),this._output.space_before_token=!1):this._output.set_indent(this._flags.indentation_level,this._flags.alignment)&&(this._flags.line_indent_level=this._flags.indentation_level))},U.prototype.print_token=function(D){if(this._output.raw){this._output.add_raw_token(D);return}if(this._options.comma_first&&D.previous&&D.previous.type===t.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var H=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(H),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(D),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(D),this._output.non_breaking_space=!0,this._output.add_token(D.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},U.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},U.prototype.deindent=function(){this._flags.indentation_level>0&&(!this._flags.parent||this._flags.indentation_level>this._flags.parent.indentation_level)&&(this._flags.indentation_level-=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},U.prototype.set_mode=function(D){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,D),this._flags=this.create_flags(this._previous_flags,D),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},U.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===o.Statement&&c(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},U.prototype.start_of_object_property=function(){return this._flags.parent.mode===o.ObjectLiteral&&this._flags.mode===o.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||E(this._flags.last_token,["get","set"]))},U.prototype.start_of_statement=function(D){var H=!1;return H=H||E(this._flags.last_token,["var","let","const"])&&D.type===t.WORD,H=H||g(this._flags.last_token,"do"),H=H||!(this._flags.parent.mode===o.ObjectLiteral&&this._flags.mode===o.Statement)&&E(this._flags.last_token,K)&&!D.newlines,H=H||g(this._flags.last_token,"else")&&!(g(D,"if")&&!D.comments_before),H=H||this._flags.last_token.type===t.END_EXPR&&(this._previous_flags.mode===o.ForInitializer||this._previous_flags.mode===o.Conditional),H=H||this._flags.last_token.type===t.WORD&&this._flags.mode===o.BlockStatement&&!this._flags.in_case&&!(D.text==="--"||D.text==="++")&&this._last_last_text!=="function"&&D.type!==t.WORD&&D.type!==t.RESERVED,H=H||this._flags.mode===o.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||E(this._flags.last_token,["get","set"])),H?(this.set_mode(o.Statement),this.indent(),this.handle_whitespace_and_comments(D,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(D,E(D,["do","for","if","while"])),!0):!1},U.prototype.handle_start_expr=function(D){this.start_of_statement(D)||this.handle_whitespace_and_comments(D);var H=o.Expression;if(D.text==="["){if(this._flags.last_token.type===t.WORD||this._flags.last_token.text===")"){E(this._flags.last_token,l)&&(this._output.space_before_token=!0),this.print_token(D),this.set_mode(H),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}H=o.ArrayLiteral,S(this._flags.mode)&&((this._flags.last_token.text==="["||this._flags.last_token.text===","&&(this._last_last_text==="]"||this._last_last_text==="}"))&&(this._options.keep_array_indentation||this.print_newline())),n(this._flags.last_token.type,[t.START_EXPR,t.END_EXPR,t.WORD,t.OPERATOR,t.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===t.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,H=o.ForInitializer):n(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,H=o.Conditional):n(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&D.whitespace_before===""?this._output.space_before_token=!1:(n(this._flags.last_token.text,l)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===t.EQUALS||this._flags.last_token.type===t.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(D);else if(this._flags.last_token.type===t.WORD){this._output.space_before_token=!1;var V=this._tokens.peek(-3);if(this._options.space_after_named_function&&V){var ne=this._tokens.peek(-4);E(V,["async","function"])||V.text==="*"&&E(ne,["async","function"])?this._output.space_before_token=!0:this._flags.mode===o.ObjectLiteral?(V.text==="{"||V.text===","||V.text==="*"&&(ne.text==="{"||ne.text===","))&&(this._output.space_before_token=!0):this._flags.parent&&this._flags.parent.class_start_block&&(this._output.space_before_token=!0)}}else this.allow_wrap_or_preserved_newline(D);(this._flags.last_token.type===t.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(n(this._last_last_text,["function","yield"])||this._flags.mode===o.ObjectLiteral&&n(this._last_last_text,["{",","])))&&(this._output.space_before_token=this._options.space_after_anon_function)}this._flags.last_token.text===";"||this._flags.last_token.type===t.START_BLOCK?this.print_newline():(this._flags.last_token.type===t.END_EXPR||this._flags.last_token.type===t.START_EXPR||this._flags.last_token.type===t.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===t.COMMA)&&this.allow_wrap_or_preserved_newline(D,D.newlines),this.print_token(D),this.set_mode(H),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},U.prototype.handle_end_expr=function(D){for(;this._flags.mode===o.Statement;)this.restore_mode();this.handle_whitespace_and_comments(D),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(D,D.text==="]"&&S(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===t.START_EXPR&&!this._options.space_in_empty_paren?(this._output.trim(),this._output.space_before_token=!1):this._output.space_before_token=!0),this.deindent(),this.print_token(D),this.restore_mode(),c(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===o.Conditional&&(this._previous_flags.mode=o.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},U.prototype.handle_start_block=function(D){this.handle_whitespace_and_comments(D);var H=this._tokens.peek(),V=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===t.END_EXPR?(this.set_mode(o.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(o.BlockStatement):V&&(n(V.text,[":",","])&&n(H.type,[t.STRING,t.WORD,t.RESERVED])||n(H.text,["get","set","..."])&&n(V.type,[t.WORD,t.RESERVED]))?n(this._last_last_text,["class","interface"])&&!n(V.text,[":",","])?this.set_mode(o.BlockStatement):this.set_mode(o.ObjectLiteral):this._flags.last_token.type===t.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(o.BlockStatement):n(this._flags.last_token.type,[t.EQUALS,t.START_EXPR,t.COMMA,t.OPERATOR])||E(this._flags.last_token,["return","throw","import","default"])?this.set_mode(o.ObjectLiteral):this.set_mode(o.BlockStatement),this._flags.last_token&&(E(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0));var ne=!H.comments_before&&H.text==="}",ie=ne&&this._flags.last_word==="function"&&this._flags.last_token.type===t.END_EXPR;if(this._options.brace_preserve_inline){var _e=0,ye=null;this._flags.inline_frame=!0;do if(_e+=1,ye=this._tokens.peek(_e-1),ye.newlines){this._flags.inline_frame=!1;break}while(ye.type!==t.EOF&&!(ye.type===t.END_BLOCK&&ye.opened===D))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&D.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==t.OPERATOR&&(ie||this._flags.last_token.type===t.EQUALS||E(this._flags.last_token,v)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(S(this._previous_flags.mode)&&(this._flags.last_token.type===t.START_EXPR||this._flags.last_token.type===t.COMMA)&&((this._flags.last_token.type===t.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===t.COMMA||this._flags.last_token.type===t.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(D),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==t.OPERATOR&&this._flags.last_token.type!==t.START_EXPR&&(this._flags.last_token.type===t.START_BLOCK&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(D),this.indent(),!ne&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},U.prototype.handle_end_block=function(D){for(this.handle_whitespace_and_comments(D);this._flags.mode===o.Statement;)this.restore_mode();var H=this._flags.last_token.type===t.START_BLOCK;this._flags.inline_frame&&!H?this._output.space_before_token=!0:this._options.brace_style==="expand"?H||this.print_newline():H||(S(this._flags.mode)&&this._options.keep_array_indentation?(this._options.keep_array_indentation=!1,this.print_newline(),this._options.keep_array_indentation=!0):this.print_newline()),this.restore_mode(),this.print_token(D)},U.prototype.handle_word=function(D){if(D.type===t.RESERVED){if(n(D.text,["set","get"])&&this._flags.mode!==o.ObjectLiteral)D.type=t.WORD;else if(D.text==="import"&&n(this._tokens.peek().text,["(","."]))D.type=t.WORD;else if(n(D.text,["as","from"])&&!this._flags.import_block)D.type=t.WORD;else if(this._flags.mode===o.ObjectLiteral){var H=this._tokens.peek();H.text===":"&&(D.type=t.WORD)}}if(this.start_of_statement(D)?E(this._flags.last_token,["var","let","const"])&&D.type===t.WORD&&(this._flags.declaration_statement=!0):D.newlines&&!A(this._flags.mode)&&(this._flags.last_token.type!==t.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==t.EQUALS&&(this._options.preserve_newlines||!E(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(D),this.print_newline()):this.handle_whitespace_and_comments(D),this._flags.do_block&&!this._flags.do_while)if(g(D,"while")){this._output.space_before_token=!0,this.print_token(D),this._output.space_before_token=!0,this._flags.do_while=!0;return}else this.print_newline(),this._flags.do_block=!1;if(this._flags.if_block)if(!this._flags.else_block&&g(D,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===o.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&E(D,["case","default"])){this.print_newline(),!this._flags.case_block&&(this._flags.case_body||this._options.jslint_happy)&&this.deindent(),this._flags.case_body=!1,this.print_token(D),this._flags.in_case=!0;return}if((this._flags.last_token.type===t.COMMA||this._flags.last_token.type===t.START_EXPR||this._flags.last_token.type===t.EQUALS||this._flags.last_token.type===t.OPERATOR)&&(this.start_of_object_property()||this.allow_wrap_or_preserved_newline(D)),g(D,"function")){(n(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(n(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===t.OPERATOR))&&(!this._output.just_added_blankline()&&!D.comments_before&&(this.print_newline(),this.print_newline(!0))),this._flags.last_token.type===t.RESERVED||this._flags.last_token.type===t.WORD?E(this._flags.last_token,["get","set","new","export"])||E(this._flags.last_token,K)?this._output.space_before_token=!0:g(this._flags.last_token,"default")&&this._last_last_text==="export"?this._output.space_before_token=!0:this._flags.last_token.text==="declare"?this._output.space_before_token=!0:this.print_newline():this._flags.last_token.type===t.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(A(this._flags.mode)||S(this._flags.mode))||this.print_newline(),this.print_token(D),this._flags.last_word=D.text;return}var V="NONE";if(this._flags.last_token.type===t.END_BLOCK?this._previous_flags.inline_frame?V="SPACE":E(D,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&D.newlines?V="NEWLINE":(V="SPACE",this._output.space_before_token=!0):V="NEWLINE":this._flags.last_token.type===t.SEMICOLON&&this._flags.mode===o.BlockStatement?V="NEWLINE":this._flags.last_token.type===t.SEMICOLON&&A(this._flags.mode)?V="SPACE":this._flags.last_token.type===t.STRING?V="NEWLINE":this._flags.last_token.type===t.RESERVED||this._flags.last_token.type===t.WORD||this._flags.last_token.text==="*"&&(n(this._last_last_text,["function","yield"])||this._flags.mode===o.ObjectLiteral&&n(this._last_last_text,["{",","]))?V="SPACE":this._flags.last_token.type===t.START_BLOCK?this._flags.inline_frame?V="SPACE":V="NEWLINE":this._flags.last_token.type===t.END_EXPR&&(this._output.space_before_token=!0,V="NEWLINE"),E(D,l)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?V="SPACE":V="NEWLINE"),E(D,["else","catch","finally"]))if((!(this._flags.last_token.type===t.END_BLOCK&&this._previous_flags.mode===o.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&D.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var ne=this._output.current_line;ne.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else V==="NEWLINE"?E(this._flags.last_token,v)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&E(D,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==t.END_EXPR?(this._flags.last_token.type!==t.START_EXPR||!E(D,["var","let","const"]))&&this._flags.last_token.text!==":"&&(g(D,"if")&&g(D.previous,"else")?this._output.space_before_token=!0:this.print_newline()):E(D,l)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&S(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():V==="SPACE"&&(this._output.space_before_token=!0);D.previous&&(D.previous.type===t.WORD||D.previous.type===t.RESERVED)&&(this._output.space_before_token=!0),this.print_token(D),this._flags.last_word=D.text,D.type===t.RESERVED&&(D.text==="do"?this._flags.do_block=!0:D.text==="if"?this._flags.if_block=!0:D.text==="import"?this._flags.import_block=!0:this._flags.import_block&&g(D,"from")&&(this._flags.import_block=!1))},U.prototype.handle_semicolon=function(D){this.start_of_statement(D)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(D);for(var H=this._tokens.peek();this._flags.mode===o.Statement&&!(this._flags.if_block&&g(H,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(D)},U.prototype.handle_string=function(D){D.text.startsWith("`")&&D.newlines===0&&D.whitespace_before===""&&(D.previous.text===")"||this._flags.last_token.type===t.WORD)||(this.start_of_statement(D)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(D),this._flags.last_token.type===t.RESERVED||this._flags.last_token.type===t.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===t.COMMA||this._flags.last_token.type===t.START_EXPR||this._flags.last_token.type===t.EQUALS||this._flags.last_token.type===t.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(D):D.text.startsWith("`")&&this._flags.last_token.type===t.END_EXPR&&(D.previous.text==="]"||D.previous.text===")")&&D.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(D)},U.prototype.handle_equals=function(D){this.start_of_statement(D)||this.handle_whitespace_and_comments(D),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(D),this._output.space_before_token=!0},U.prototype.handle_comma=function(D){this.handle_whitespace_and_comments(D,!0),this.print_token(D),this._output.space_before_token=!0,this._flags.declaration_statement?(A(this._flags.parent.mode)&&(this._flags.declaration_assignment=!1),this._flags.declaration_assignment?(this._flags.declaration_assignment=!1,this.print_newline(!1,!0)):this._options.comma_first&&this.allow_wrap_or_preserved_newline(D)):this._flags.mode===o.ObjectLiteral||this._flags.mode===o.Statement&&this._flags.parent.mode===o.ObjectLiteral?(this._flags.mode===o.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(D)},U.prototype.handle_operator=function(D){var H=D.text==="*"&&(E(this._flags.last_token,["function","yield"])||n(this._flags.last_token.type,[t.START_BLOCK,t.COMMA,t.END_BLOCK,t.SEMICOLON])),V=n(D.text,["-","+"])&&(n(this._flags.last_token.type,[t.START_BLOCK,t.START_EXPR,t.EQUALS,t.OPERATOR])||n(this._flags.last_token.text,l)||this._flags.last_token.text===",");if(!this.start_of_statement(D)){var ne=!H;this.handle_whitespace_and_comments(D,ne)}if(D.text==="*"&&this._flags.last_token.type===t.DOT){this.print_token(D);return}if(D.text==="::"){this.print_token(D);return}if(this._flags.last_token.type===t.OPERATOR&&n(this._options.operator_position,a)&&this.allow_wrap_or_preserved_newline(D),D.text===":"&&this._flags.in_case){this.print_token(D),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==t.START_BLOCK?(this.indent(),this.print_newline(),this._flags.case_block=!1):(this._flags.case_block=!0,this._output.space_before_token=!0);return}var ie=!0,_e=!0,ye=!1;if(D.text===":"?this._flags.ternary_depth===0?ie=!1:(this._flags.ternary_depth-=1,ye=!0):D.text==="?"&&(this._flags.ternary_depth+=1),!V&&!H&&this._options.preserve_newlines&&n(D.text,e)){var be=D.text===":",we=be&&ye,Re=be&&!ye;switch(this._options.operator_position){case d.before_newline:this._output.space_before_token=!Re,this.print_token(D),(!be||we)&&this.allow_wrap_or_preserved_newline(D),this._output.space_before_token=!0;return;case d.after_newline:this._output.space_before_token=!0,!be||we?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(D):this._output.space_before_token=!1,this.print_token(D),this._output.space_before_token=!0;return;case d.preserve_newline:Re||this.allow_wrap_or_preserved_newline(D),ie=!(this._output.just_added_newline()||Re),this._output.space_before_token=ie,this.print_token(D),this._output.space_before_token=!0;return}}if(H){this.allow_wrap_or_preserved_newline(D),ie=!1;var ge=this._tokens.peek();_e=ge&&n(ge.type,[t.WORD,t.RESERVED])}else if(D.text==="...")this.allow_wrap_or_preserved_newline(D),ie=this._flags.last_token.type===t.START_BLOCK,_e=!1;else if(n(D.text,["--","++","!","~"])||V){if((this._flags.last_token.type===t.COMMA||this._flags.last_token.type===t.START_EXPR)&&this.allow_wrap_or_preserved_newline(D),ie=!1,_e=!1,D.newlines&&(D.text==="--"||D.text==="++"||D.text==="~")){var Q=E(this._flags.last_token,v)&&D.newlines;Q&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(Q,!0)}this._flags.last_token.text===";"&&A(this._flags.mode)&&(ie=!0),this._flags.last_token.type===t.RESERVED?ie=!0:this._flags.last_token.type===t.END_EXPR?ie=!(this._flags.last_token.text==="]"&&(D.text==="--"||D.text==="++")):this._flags.last_token.type===t.OPERATOR&&(ie=n(D.text,["--","-","++","+"])&&n(this._flags.last_token.text,["--","-","++","+"]),n(D.text,["+","-"])&&n(this._flags.last_token.text,["--","++"])&&(_e=!0)),(this._flags.mode===o.BlockStatement&&!this._flags.inline_frame||this._flags.mode===o.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||ie,this.print_token(D),this._output.space_before_token=_e},U.prototype.handle_block_comment=function(D,H){if(this._output.raw){this._output.add_raw_token(D),D.directives&&D.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(D.directives){this.print_newline(!1,H),this.print_token(D),D.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!r.newline.test(D.text)&&!D.newlines){this._output.space_before_token=!0,this.print_token(D),this._output.space_before_token=!0;return}else this.print_block_commment(D,H)},U.prototype.print_block_commment=function(D,H){var V=f(D.text),ne,ie=!1,_e=!1,ye=D.whitespace_before,be=ye.length;if(this.print_newline(!1,H),this.print_token_line_indentation(D),this._output.add_token(V[0]),this.print_newline(!1,H),V.length>1){for(V=V.slice(1),ie=R(V,"*"),_e=B(V,ye),ie&&(this._flags.alignment=1),ne=0;ne<V.length;ne++)ie?(this.print_token_line_indentation(D),this._output.add_token(T(V[ne]))):_e&&V[ne]?(this.print_token_line_indentation(D),this._output.add_token(V[ne].substring(be))):(this._output.current_line.set_indent(-1),this._output.add_token(V[ne])),this.print_newline(!1,H);this._flags.alignment=0}},U.prototype.handle_comment=function(D,H){D.newlines?this.print_newline(!1,H):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(D),this.print_newline(!1,H)},U.prototype.handle_dot=function(D){this.start_of_statement(D)||this.handle_whitespace_and_comments(D,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),E(this._flags.last_token,v)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(D,this._flags.last_token.text===")"&&this._options.break_chained_methods),this._options.unindent_chained_methods&&this._output.just_added_newline()&&this.deindent(),this.print_token(D)},U.prototype.handle_unknown=function(D,H){this.print_token(D),D.text[D.text.length-1]===`
|
|
`&&this.print_newline(!1,H)},U.prototype.handle_eof=function(D){for(;this._flags.mode===o.Statement;)this.restore_mode();this.handle_whitespace_and_comments(D)},O.exports.Beautifier=U},function(O){function w(s){this.__parent=s,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}w.prototype.clone_empty=function(){var s=new w(this.__parent);return s.set_indent(this.__indent_count,this.__alignment_count),s},w.prototype.item=function(s){return s<0?this.__items[this.__items.length+s]:this.__items[s]},w.prototype.has_match=function(s){for(var r=this.__items.length-1;r>=0;r--)if(this.__items[r].match(s))return!0;return!1},w.prototype.set_indent=function(s,r){this.is_empty()&&(this.__indent_count=s||0,this.__alignment_count=r||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},w.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},w.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},w.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var s=this.__parent.current_line;return s.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),s.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),s.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,s.__items[0]===" "&&(s.__items.splice(0,1),s.__character_count-=1),!0}return!1},w.prototype.is_empty=function(){return this.__items.length===0},w.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},w.prototype.push=function(s){this.__items.push(s);var r=s.lastIndexOf(`
|
|
`);r!==-1?this.__character_count=s.length-r:this.__character_count+=s.length},w.prototype.pop=function(){var s=null;return this.is_empty()||(s=this.__items.pop(),this.__character_count-=s.length),s},w.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},w.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},w.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},w.prototype.toString=function(){var s="";return this.is_empty()?this.__parent.indent_empty_lines&&(s=this.__parent.get_indent_string(this.__indent_count)):(s=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),s+=this.__items.join("")),s};function y(s,r){this.__cache=[""],this.__indent_size=s.indent_size,this.__indent_string=s.indent_char,s.indent_with_tabs||(this.__indent_string=new Array(s.indent_size+1).join(s.indent_char)),r=r||"",s.indent_level>0&&(r=new Array(s.indent_level+1).join(this.__indent_string)),this.__base_string=r,this.__base_string_length=r.length}y.prototype.get_indent_size=function(s,r){var i=this.__base_string_length;return r=r||0,s<0&&(i=0),i+=s*this.__indent_size,i+=r,i},y.prototype.get_indent_string=function(s,r){var i=this.__base_string;return r=r||0,s<0&&(s=0,i=""),r+=s*this.__indent_size,this.__ensure_cache(r),i+=this.__cache[r],i},y.prototype.__ensure_cache=function(s){for(;s>=this.__cache.length;)this.__add_column()},y.prototype.__add_column=function(){var s=this.__cache.length,r=0,i="";this.__indent_size&&s>=this.__indent_size&&(r=Math.floor(s/this.__indent_size),s-=r*this.__indent_size,i=new Array(r+1).join(this.__indent_string)),s&&(i+=new Array(s+1).join(" ")),this.__cache.push(i)};function _(s,r){this.__indent_cache=new y(s,r),this.raw=!1,this._end_with_newline=s.end_with_newline,this.indent_size=s.indent_size,this.wrap_line_length=s.wrap_line_length,this.indent_empty_lines=s.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new w(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}_.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},_.prototype.get_line_number=function(){return this.__lines.length},_.prototype.get_indent_string=function(s,r){return this.__indent_cache.get_indent_string(s,r)},_.prototype.get_indent_size=function(s,r){return this.__indent_cache.get_indent_size(s,r)},_.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},_.prototype.add_new_line=function(s){return this.is_empty()||!s&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},_.prototype.get_code=function(s){this.trim(!0);var r=this.current_line.pop();r&&(r[r.length-1]===`
|
|
`&&(r=r.replace(/\n+$/g,"")),this.current_line.push(r)),this._end_with_newline&&this.__add_outputline();var i=this.__lines.join(`
|
|
`);return s!==`
|
|
`&&(i=i.replace(/[\n]/g,s)),i},_.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},_.prototype.set_indent=function(s,r){return s=s||0,r=r||0,this.next_line.set_indent(s,r),this.__lines.length>1?(this.current_line.set_indent(s,r),!0):(this.current_line.set_indent(),!1)},_.prototype.add_raw_token=function(s){for(var r=0;r<s.newlines;r++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(s.whitespace_before),this.current_line.push(s.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},_.prototype.add_token=function(s){this.__add_space_before_token(),this.current_line.push(s),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},_.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},_.prototype.remove_indent=function(s){for(var r=this.__lines.length;s<r;)this.__lines[s]._remove_indent(),s++;this.current_line._remove_wrap_indent()},_.prototype.trim=function(s){for(s=s===void 0?!1:s,this.current_line.trim();s&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},_.prototype.just_added_newline=function(){return this.current_line.is_empty()},_.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},_.prototype.ensure_empty_line_above=function(s,r){for(var i=this.__lines.length-2;i>=0;){var u=this.__lines[i];if(u.is_empty())break;if(u.item(0).indexOf(s)!==0&&u.item(-1)!==r){this.__lines.splice(i+1,0,new w(this)),this.previous_line=this.__lines[this.__lines.length-2];break}i--}},O.exports.Output=_},function(O){function w(y,_,s,r){this.type=y,this.text=_,this.comments_before=null,this.newlines=s||0,this.whitespace_before=r||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}O.exports.Token=w},function(O,w){var y="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",_="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",s="\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05d0-\\u05ea\\u05f0-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u08a0\\u08a2-\\u08ac\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097f\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c33\\u0c35-\\u0c39\\u0c3d\\u0c58\\u0c59\\u0c60\\u0c61\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d60\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e87\\u0e88\\u0e8a\\u0e8d\\u0e94-\\u0e97\\u0e99-\\u0e9f\\u0ea1-\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f4\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f0\\u1700-\\u170c\\u170e-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1877\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191c\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19c1-\\u19c7\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4b\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1ce9-\\u1cec\\u1cee-\\u1cf1\\u1cf5\\u1cf6\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2119-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u212d\\u212f-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u2e2f\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309d-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312d\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua697\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua78e\\ua790-\\ua793\\ua7a0-\\ua7aa\\ua7f8-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa80-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uabc0-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc",r="\\u0300-\\u036f\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u0620-\\u0649\\u0672-\\u06d3\\u06e7-\\u06e8\\u06fb-\\u06fc\\u0730-\\u074a\\u0800-\\u0814\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0840-\\u0857\\u08e4-\\u08fe\\u0900-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962-\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09d7\\u09df-\\u09e0\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2-\\u0ae3\\u0ae6-\\u0aef\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b5f-\\u0b60\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c01-\\u0c03\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62-\\u0c63\\u0c66-\\u0c6f\\u0c82\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2-\\u0ce3\\u0ce6-\\u0cef\\u0d02\\u0d03\\u0d46-\\u0d48\\u0d57\\u0d62-\\u0d63\\u0d66-\\u0d6f\\u0d82\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0df2\\u0df3\\u0e34-\\u0e3a\\u0e40-\\u0e45\\u0e50-\\u0e59\\u0eb4-\\u0eb9\\u0ec8-\\u0ecd\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f41-\\u0f47\\u0f71-\\u0f84\\u0f86-\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u1000-\\u1029\\u1040-\\u1049\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u170e-\\u1710\\u1720-\\u1730\\u1740-\\u1750\\u1772\\u1773\\u1780-\\u17b2\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u1810-\\u1819\\u1920-\\u192b\\u1930-\\u193b\\u1951-\\u196d\\u19b0-\\u19c0\\u19c8-\\u19c9\\u19d0-\\u19d9\\u1a00-\\u1a15\\u1a20-\\u1a53\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1b46-\\u1b4b\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c00-\\u1c22\\u1c40-\\u1c49\\u1c5b-\\u1c7d\\u1cd0-\\u1cd2\\u1d00-\\u1dbe\\u1e01-\\u1f15\\u200c\\u200d\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2d81-\\u2d96\\u2de0-\\u2dff\\u3021-\\u3028\\u3099\\u309a\\ua640-\\ua66d\\ua674-\\ua67d\\ua69f\\ua6f0-\\ua6f1\\ua7f8-\\ua800\\ua806\\ua80b\\ua823-\\ua827\\ua880-\\ua881\\ua8b4-\\ua8c4\\ua8d0-\\ua8d9\\ua8f3-\\ua8f7\\ua900-\\ua909\\ua926-\\ua92d\\ua930-\\ua945\\ua980-\\ua983\\ua9b3-\\ua9c0\\uaa00-\\uaa27\\uaa40-\\uaa41\\uaa4c-\\uaa4d\\uaa50-\\uaa59\\uaa7b\\uaae0-\\uaae9\\uaaf2-\\uaaf3\\uabc0-\\uabe1\\uabec\\uabed\\uabf0-\\uabf9\\ufb20-\\ufb28\\ufe00-\\ufe0f\\ufe20-\\ufe26\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f",i="(?:\\\\u[0-9a-fA-F]{4}|["+y+s+"])",u="(?:\\\\u[0-9a-fA-F]{4}|["+_+s+r+"])*";w.identifier=new RegExp(i+u,"g"),w.identifierStart=new RegExp(i),w.identifierMatch=new RegExp("(?:\\\\u[0-9a-fA-F]{4}|["+_+s+r+"])+");var l=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;w.newline=/[\n\r\u2028\u2029]/,w.lineBreak=new RegExp(`\r
|
|
|`+w.newline.source),w.allLineBreaks=new RegExp(w.lineBreak.source,"g")},function(O,w,y){var _=y(6).Options,s=["before-newline","after-newline","preserve-newline"];function r(i){_.call(this,i,"js");var u=this.raw_options.brace_style||null;u==="expand-strict"?this.raw_options.brace_style="expand":u==="collapse-preserve-inline"?this.raw_options.brace_style="collapse,preserve-inline":this.raw_options.braces_on_own_line!==void 0&&(this.raw_options.brace_style=this.raw_options.braces_on_own_line?"expand":"collapse");var l=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var e=0;e<l.length;e++)l[e]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=l[e];this.unindent_chained_methods=this._get_boolean("unindent_chained_methods"),this.break_chained_methods=this._get_boolean("break_chained_methods"),this.space_in_paren=this._get_boolean("space_in_paren"),this.space_in_empty_paren=this._get_boolean("space_in_empty_paren"),this.jslint_happy=this._get_boolean("jslint_happy"),this.space_after_anon_function=this._get_boolean("space_after_anon_function"),this.space_after_named_function=this._get_boolean("space_after_named_function"),this.keep_array_indentation=this._get_boolean("keep_array_indentation"),this.space_before_conditional=this._get_boolean("space_before_conditional",!0),this.unescape_strings=this._get_boolean("unescape_strings"),this.e4x=this._get_boolean("e4x"),this.comma_first=this._get_boolean("comma_first"),this.operator_position=this._get_selection("operator_position",s),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}r.prototype=new _,O.exports.Options=r},function(O){function w(s,r){this.raw_options=y(s,r),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}w.prototype._get_array=function(s,r){var i=this.raw_options[s],u=r||[];return typeof i=="object"?i!==null&&typeof i.concat=="function"&&(u=i.concat()):typeof i=="string"&&(u=i.split(/[^a-zA-Z0-9_\/\-]+/)),u},w.prototype._get_boolean=function(s,r){var i=this.raw_options[s],u=i===void 0?!!r:!!i;return u},w.prototype._get_characters=function(s,r){var i=this.raw_options[s],u=r||"";return typeof i=="string"&&(u=i.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),u},w.prototype._get_number=function(s,r){var i=this.raw_options[s];r=parseInt(r,10),isNaN(r)&&(r=0);var u=parseInt(i,10);return isNaN(u)&&(u=r),u},w.prototype._get_selection=function(s,r,i){var u=this._get_selection_list(s,r,i);if(u.length!==1)throw new Error("Invalid Option Value: The option '"+s+`' can only be one of the following values:
|
|
`+r+`
|
|
You passed in: '`+this.raw_options[s]+"'");return u[0]},w.prototype._get_selection_list=function(s,r,i){if(!r||r.length===0)throw new Error("Selection list cannot be empty.");if(i=i||[r[0]],!this._is_valid_selection(i,r))throw new Error("Invalid Default Value!");var u=this._get_array(s,i);if(!this._is_valid_selection(u,r))throw new Error("Invalid Option Value: The option '"+s+`' can contain only the following values:
|
|
`+r+`
|
|
You passed in: '`+this.raw_options[s]+"'");return u},w.prototype._is_valid_selection=function(s,r){return s.length&&r.length&&!s.some(function(i){return r.indexOf(i)===-1})};function y(s,r){var i={};s=_(s);var u;for(u in s)u!==r&&(i[u]=s[u]);if(r&&s[r])for(u in s[r])i[u]=s[r][u];return i}function _(s){var r={},i;for(i in s){var u=i.replace(/-/g,"_");r[u]=s[i]}return r}O.exports.Options=w,O.exports.normalizeOpts=_,O.exports.mergeOpts=y},function(O,w,y){var _=y(8).InputScanner,s=y(9).Tokenizer,r=y(9).TOKEN,i=y(13).Directives,u=y(4),l=y(12).Pattern,e=y(14).TemplatablePattern;function t(R,B){return B.indexOf(R)!==-1}var n={START_EXPR:"TK_START_EXPR",END_EXPR:"TK_END_EXPR",START_BLOCK:"TK_START_BLOCK",END_BLOCK:"TK_END_BLOCK",WORD:"TK_WORD",RESERVED:"TK_RESERVED",SEMICOLON:"TK_SEMICOLON",STRING:"TK_STRING",EQUALS:"TK_EQUALS",OPERATOR:"TK_OPERATOR",COMMA:"TK_COMMA",BLOCK_COMMENT:"TK_BLOCK_COMMENT",COMMENT:"TK_COMMENT",DOT:"TK_DOT",UNKNOWN:"TK_UNKNOWN",START:r.START,RAW:r.RAW,EOF:r.EOF},T=new i(/\/\*/,/\*\//),b=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,g=/[0-9]/,E=/[^\d\.]/,v=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),p=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";p=p.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),p="\\?\\.(?!\\d) "+p,p=p.replace(/ /g,"|");var d=new RegExp(p),a="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),o=a.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),c=new RegExp("^(?:"+o.join("|")+")$"),f,S=function(R,B){s.call(this,R,B),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var U=new l(this._input),K=new e(this._input).read_options(this._options);this.__patterns={template:K,identifier:K.starting_with(u.identifier).matching(u.identifierMatch),number:U.matching(b),punct:U.matching(d),comment:U.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:U.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:U.matching(/<!--/),html_comment_end:U.matching(/-->/),include:U.starting_with(/#include/).until_after(u.lineBreak),shebang:U.starting_with(/#!/).until_after(u.lineBreak),xml:U.matching(/[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[^}]+?}|!\[CDATA\[[^\]]*?\]\]|)(\s*{[^}]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{([^{}]|{[^}]+?})+?}))*\s*(\/?)\s*>/),single_quote:K.until(/['\\\n\r\u2028\u2029]/),double_quote:K.until(/["\\\n\r\u2028\u2029]/),template_text:K.until(/[`\\$]/),template_expression:K.until(/[`}\\]/)}};S.prototype=new s,S.prototype._is_comment=function(R){return R.type===n.COMMENT||R.type===n.BLOCK_COMMENT||R.type===n.UNKNOWN},S.prototype._is_opening=function(R){return R.type===n.START_BLOCK||R.type===n.START_EXPR},S.prototype._is_closing=function(R,B){return(R.type===n.END_BLOCK||R.type===n.END_EXPR)&&B&&(R.text==="]"&&B.text==="["||R.text===")"&&B.text==="("||R.text==="}"&&B.text==="{")},S.prototype._reset=function(){f=!1},S.prototype._get_next_token=function(R,B){var U=null;this._readWhitespace();var K=this._input.peek();return K===null?this._create_token(n.EOF,""):(U=U||this._read_non_javascript(K),U=U||this._read_string(K),U=U||this._read_word(R),U=U||this._read_singles(K),U=U||this._read_comment(K),U=U||this._read_regexp(K,R),U=U||this._read_xml(K,R),U=U||this._read_punctuation(),U=U||this._create_token(n.UNKNOWN,this._input.next()),U)},S.prototype._read_word=function(R){var B;if(B=this.__patterns.identifier.read(),B!=="")return B=B.replace(u.allLineBreaks,`
|
|
`),!(R.type===n.DOT||R.type===n.RESERVED&&(R.text==="set"||R.text==="get"))&&c.test(B)?(B==="in"||B==="of")&&(R.type===n.WORD||R.type===n.STRING)?this._create_token(n.OPERATOR,B):this._create_token(n.RESERVED,B):this._create_token(n.WORD,B);if(B=this.__patterns.number.read(),B!=="")return this._create_token(n.WORD,B)},S.prototype._read_singles=function(R){var B=null;return R==="("||R==="["?B=this._create_token(n.START_EXPR,R):R===")"||R==="]"?B=this._create_token(n.END_EXPR,R):R==="{"?B=this._create_token(n.START_BLOCK,R):R==="}"?B=this._create_token(n.END_BLOCK,R):R===";"?B=this._create_token(n.SEMICOLON,R):R==="."&&E.test(this._input.peek(1))?B=this._create_token(n.DOT,R):R===","&&(B=this._create_token(n.COMMA,R)),B&&this._input.next(),B},S.prototype._read_punctuation=function(){var R=this.__patterns.punct.read();if(R!=="")return R==="="?this._create_token(n.EQUALS,R):R==="?."?this._create_token(n.DOT,R):this._create_token(n.OPERATOR,R)},S.prototype._read_non_javascript=function(R){var B="";if(R==="#"){if(this._is_first_token()&&(B=this.__patterns.shebang.read(),B))return this._create_token(n.UNKNOWN,B.trim()+`
|
|
`);if(B=this.__patterns.include.read(),B)return this._create_token(n.UNKNOWN,B.trim()+`
|
|
`);R=this._input.next();var U="#";if(this._input.hasNext()&&this._input.testChar(g)){do R=this._input.next(),U+=R;while(this._input.hasNext()&&R!=="#"&&R!=="=");return R==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(U+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(U+="{}",this._input.next(),this._input.next())),this._create_token(n.WORD,U)}this._input.back()}else if(R==="<"&&this._is_first_token()){if(B=this.__patterns.html_comment_start.read(),B){for(;this._input.hasNext()&&!this._input.testChar(u.newline);)B+=this._input.next();return f=!0,this._create_token(n.COMMENT,B)}}else if(f&&R==="-"&&(B=this.__patterns.html_comment_end.read(),B))return f=!1,this._create_token(n.COMMENT,B);return null},S.prototype._read_comment=function(R){var B=null;if(R==="/"){var U="";if(this._input.peek(1)==="*"){U=this.__patterns.block_comment.read();var K=T.get_directives(U);K&&K.ignore==="start"&&(U+=T.readIgnored(this._input)),U=U.replace(u.allLineBreaks,`
|
|
`),B=this._create_token(n.BLOCK_COMMENT,U),B.directives=K}else this._input.peek(1)==="/"&&(U=this.__patterns.comment.read(),B=this._create_token(n.COMMENT,U))}return B},S.prototype._read_string=function(R){if(R==="`"||R==="'"||R==='"'){var B=this._input.next();return this.has_char_escapes=!1,R==="`"?B+=this._read_string_recursive("`",!0,"${"):B+=this._read_string_recursive(R),this.has_char_escapes&&this._options.unescape_strings&&(B=A(B)),this._input.peek()===R&&(B+=this._input.next()),B=B.replace(u.allLineBreaks,`
|
|
`),this._create_token(n.STRING,B)}return null},S.prototype._allow_regexp_or_xml=function(R){return R.type===n.RESERVED&&t(R.text,["return","case","throw","else","do","typeof","yield"])||R.type===n.END_EXPR&&R.text===")"&&R.opened.previous.type===n.RESERVED&&t(R.opened.previous.text,["if","while","for"])||t(R.type,[n.COMMENT,n.START_EXPR,n.START_BLOCK,n.START,n.END_BLOCK,n.OPERATOR,n.EQUALS,n.EOF,n.SEMICOLON,n.COMMA])},S.prototype._read_regexp=function(R,B){if(R==="/"&&this._allow_regexp_or_xml(B)){for(var U=this._input.next(),K=!1,D=!1;this._input.hasNext()&&(K||D||this._input.peek()!==R)&&!this._input.testChar(u.newline);)U+=this._input.peek(),K?K=!1:(K=this._input.peek()==="\\",this._input.peek()==="["?D=!0:this._input.peek()==="]"&&(D=!1)),this._input.next();return this._input.peek()===R&&(U+=this._input.next(),U+=this._input.read(u.identifier)),this._create_token(n.STRING,U)}return null},S.prototype._read_xml=function(R,B){if(this._options.e4x&&R==="<"&&this._allow_regexp_or_xml(B)){var U="",K=this.__patterns.xml.read_match();if(K){for(var D=K[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),H=D.indexOf("{")===0,V=0;K;){var ne=!!K[1],ie=K[2],_e=!!K[K.length-1]||ie.slice(0,8)==="![CDATA[";if(!_e&&(ie===D||H&&ie.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(ne?--V:++V),U+=K[0],V<=0)break;K=this.__patterns.xml.read_match()}return K||(U+=this._input.match(/[\s\S]*/g)[0]),U=U.replace(u.allLineBreaks,`
|
|
`),this._create_token(n.STRING,U)}}return null};function A(R){for(var B="",U=0,K=new _(R),D=null;K.hasNext();)if(D=K.match(/([\s]|[^\\]|\\\\)+/g),D&&(B+=D[0]),K.peek()==="\\"){if(K.next(),K.peek()==="x")D=K.match(/x([0-9A-Fa-f]{2})/g);else if(K.peek()==="u")D=K.match(/u([0-9A-Fa-f]{4})/g);else{B+="\\",K.hasNext()&&(B+=K.next());continue}if(!D)return R;if(U=parseInt(D[1],16),U>126&&U<=255&&D[0].indexOf("x")===0)return R;if(U>=0&&U<32){B+="\\"+D[0];continue}else U===34||U===39||U===92?B+="\\"+String.fromCharCode(U):B+=String.fromCharCode(U)}return B}S.prototype._read_string_recursive=function(R,B,U){var K,D;R==="'"?D=this.__patterns.single_quote:R==='"'?D=this.__patterns.double_quote:R==="`"?D=this.__patterns.template_text:R==="}"&&(D=this.__patterns.template_expression);for(var H=D.read(),V="";this._input.hasNext();){if(V=this._input.next(),V===R||!B&&u.newline.test(V)){this._input.back();break}else V==="\\"&&this._input.hasNext()?(K=this._input.peek(),K==="x"||K==="u"?this.has_char_escapes=!0:K==="\r"&&this._input.peek(1)===`
|
|
`&&this._input.next(),V+=this._input.next()):U&&(U==="${"&&V==="$"&&this._input.peek()==="{"&&(V+=this._input.next()),U===V&&(R==="`"?V+=this._read_string_recursive("}",B,"`"):V+=this._read_string_recursive("`",B,"${"),this._input.hasNext()&&(V+=this._input.next())));V+=D.read(),H+=V}return H},O.exports.Tokenizer=S,O.exports.TOKEN=n,O.exports.positionable_operators=v.slice(),O.exports.line_starters=a.slice()},function(O){var w=RegExp.prototype.hasOwnProperty("sticky");function y(_){this.__input=_||"",this.__input_length=this.__input.length,this.__position=0}y.prototype.restart=function(){this.__position=0},y.prototype.back=function(){this.__position>0&&(this.__position-=1)},y.prototype.hasNext=function(){return this.__position<this.__input_length},y.prototype.next=function(){var _=null;return this.hasNext()&&(_=this.__input.charAt(this.__position),this.__position+=1),_},y.prototype.peek=function(_){var s=null;return _=_||0,_+=this.__position,_>=0&&_<this.__input_length&&(s=this.__input.charAt(_)),s},y.prototype.__match=function(_,s){_.lastIndex=s;var r=_.exec(this.__input);return r&&!(w&&_.sticky)&&(r.index!==s&&(r=null)),r},y.prototype.test=function(_,s){return s=s||0,s+=this.__position,s>=0&&s<this.__input_length?!!this.__match(_,s):!1},y.prototype.testChar=function(_,s){var r=this.peek(s);return _.lastIndex=0,r!==null&&_.test(r)},y.prototype.match=function(_){var s=this.__match(_,this.__position);return s?this.__position+=s[0].length:s=null,s},y.prototype.read=function(_,s,r){var i="",u;return _&&(u=this.match(_),u&&(i+=u[0])),s&&(u||!_)&&(i+=this.readUntil(s,r)),i},y.prototype.readUntil=function(_,s){var r="",i=this.__position;_.lastIndex=this.__position;var u=_.exec(this.__input);return u?(i=u.index,s&&(i+=u[0].length)):i=this.__input_length,r=this.__input.substring(this.__position,i),this.__position=i,r},y.prototype.readUntilAfter=function(_){return this.readUntil(_,!0)},y.prototype.get_regexp=function(_,s){var r=null,i="g";return s&&w&&(i="y"),typeof _=="string"&&_!==""?r=new RegExp(_,i):_&&(r=new RegExp(_.source,i)),r},y.prototype.get_literal_regexp=function(_){return RegExp(_.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},y.prototype.peekUntilAfter=function(_){var s=this.__position,r=this.readUntilAfter(_);return this.__position=s,r},y.prototype.lookBack=function(_){var s=this.__position-1;return s>=_.length&&this.__input.substring(s-_.length,s).toLowerCase()===_},O.exports.InputScanner=y},function(O,w,y){var _=y(8).InputScanner,s=y(3).Token,r=y(10).TokenStream,i=y(11).WhitespacePattern,u={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},l=function(e,t){this._input=new _(e),this._options=t||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new i(this._input)};l.prototype.tokenize=function(){this._input.restart(),this.__tokens=new r,this._reset();for(var e,t=new s(u.START,""),n=null,T=[],b=new r;t.type!==u.EOF;){for(e=this._get_next_token(t,n);this._is_comment(e);)b.add(e),e=this._get_next_token(t,n);b.isEmpty()||(e.comments_before=b,b=new r),e.parent=n,this._is_opening(e)?(T.push(n),n=e):n&&this._is_closing(e,n)&&(e.opened=n,n.closed=e,n=T.pop(),e.parent=n),e.previous=t,t.next=e,this.__tokens.add(e),t=e}return this.__tokens},l.prototype._is_first_token=function(){return this.__tokens.isEmpty()},l.prototype._reset=function(){},l.prototype._get_next_token=function(e,t){this._readWhitespace();var n=this._input.read(/.+/g);return n?this._create_token(u.RAW,n):this._create_token(u.EOF,"")},l.prototype._is_comment=function(e){return!1},l.prototype._is_opening=function(e){return!1},l.prototype._is_closing=function(e,t){return!1},l.prototype._create_token=function(e,t){var n=new s(e,t,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return n},l.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},O.exports.Tokenizer=l,O.exports.TOKEN=u},function(O){function w(y){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=y}w.prototype.restart=function(){this.__position=0},w.prototype.isEmpty=function(){return this.__tokens_length===0},w.prototype.hasNext=function(){return this.__position<this.__tokens_length},w.prototype.next=function(){var y=null;return this.hasNext()&&(y=this.__tokens[this.__position],this.__position+=1),y},w.prototype.peek=function(y){var _=null;return y=y||0,y+=this.__position,y>=0&&y<this.__tokens_length&&(_=this.__tokens[y]),_},w.prototype.add=function(y){this.__parent_token&&(y.parent=this.__parent_token),this.__tokens.push(y),this.__tokens_length+=1},O.exports.TokenStream=w},function(O,w,y){var _=y(12).Pattern;function s(r,i){_.call(this,r,i),i?this._line_regexp=this._input.get_regexp(i._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}s.prototype=new _,s.prototype.__set_whitespace_patterns=function(r,i){r+="\\t ",i+="\\n\\r",this._match_pattern=this._input.get_regexp("["+r+i+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+i+"]")},s.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var r=this._input.read(this._match_pattern);if(r===" ")this.whitespace_before_token=" ";else if(r){var i=this.__split(this._newline_regexp,r);this.newline_count=i.length-1,this.whitespace_before_token=i[this.newline_count]}return r},s.prototype.matching=function(r,i){var u=this._create();return u.__set_whitespace_patterns(r,i),u._update(),u},s.prototype._create=function(){return new s(this._input,this)},s.prototype.__split=function(r,i){r.lastIndex=0;for(var u=0,l=[],e=r.exec(i);e;)l.push(i.substring(u,e.index)),u=e.index+e[0].length,e=r.exec(i);return u<i.length?l.push(i.substring(u,i.length)):l.push(""),l},O.exports.WhitespacePattern=s},function(O){function w(y,_){this._input=y,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,_&&(this._starting_pattern=this._input.get_regexp(_._starting_pattern,!0),this._match_pattern=this._input.get_regexp(_._match_pattern,!0),this._until_pattern=this._input.get_regexp(_._until_pattern),this._until_after=_._until_after)}w.prototype.read=function(){var y=this._input.read(this._starting_pattern);return(!this._starting_pattern||y)&&(y+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),y},w.prototype.read_match=function(){return this._input.match(this._match_pattern)},w.prototype.until_after=function(y){var _=this._create();return _._until_after=!0,_._until_pattern=this._input.get_regexp(y),_._update(),_},w.prototype.until=function(y){var _=this._create();return _._until_after=!1,_._until_pattern=this._input.get_regexp(y),_._update(),_},w.prototype.starting_with=function(y){var _=this._create();return _._starting_pattern=this._input.get_regexp(y,!0),_._update(),_},w.prototype.matching=function(y){var _=this._create();return _._match_pattern=this._input.get_regexp(y,!0),_._update(),_},w.prototype._create=function(){return new w(this._input,this)},w.prototype._update=function(){},O.exports.Pattern=w},function(O){function w(y,_){y=typeof y=="string"?y:y.source,_=typeof _=="string"?_:_.source,this.__directives_block_pattern=new RegExp(y+/ beautify( \w+[:]\w+)+ /.source+_,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(y+/\sbeautify\signore:end\s/.source+_,"g")}w.prototype.get_directives=function(y){if(!y.match(this.__directives_block_pattern))return null;var _={};this.__directive_pattern.lastIndex=0;for(var s=this.__directive_pattern.exec(y);s;)_[s[1]]=s[2],s=this.__directive_pattern.exec(y);return _},w.prototype.readIgnored=function(y){return y.readUntilAfter(this.__directives_end_ignore_pattern)},O.exports.Directives=w},function(O,w,y){var _=y(12).Pattern,s={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function r(i,u){_.call(this,i,u),this.__template_pattern=null,this._disabled=Object.assign({},s),this._excluded=Object.assign({},s),u&&(this.__template_pattern=this._input.get_regexp(u.__template_pattern),this._excluded=Object.assign(this._excluded,u._excluded),this._disabled=Object.assign(this._disabled,u._disabled));var l=new _(i);this.__patterns={handlebars_comment:l.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:l.starting_with(/{{{/).until_after(/}}}/),handlebars:l.starting_with(/{{/).until_after(/}}/),php:l.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:l.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:l.starting_with(/{%/).until_after(/%}/),django_value:l.starting_with(/{{/).until_after(/}}/),django_comment:l.starting_with(/{#/).until_after(/#}/),smarty:l.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:l.starting_with(/{\*/).until_after(/\*}/),smarty_literal:l.starting_with(/{literal}/).until_after(/{\/literal}/)}}r.prototype=new _,r.prototype._create=function(){return new r(this._input,this)},r.prototype._update=function(){this.__set_templated_pattern()},r.prototype.disable=function(i){var u=this._create();return u._disabled[i]=!0,u._update(),u},r.prototype.read_options=function(i){var u=this._create();for(var l in s)u._disabled[l]=i.templating.indexOf(l)===-1;return u._update(),u},r.prototype.exclude=function(i){var u=this._create();return u._excluded[i]=!0,u._update(),u},r.prototype.read=function(){var i="";this._match_pattern?i=this._input.read(this._starting_pattern):i=this._input.read(this._starting_pattern,this.__template_pattern);for(var u=this._read_template();u;)this._match_pattern?u+=this._input.read(this._match_pattern):u+=this._input.readUntil(this.__template_pattern),i+=u,u=this._read_template();return this._until_after&&(i+=this._input.readUntilAfter(this._until_pattern)),i},r.prototype.__set_templated_pattern=function(){var i=[];this._disabled.php||i.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||i.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||i.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(i.push(this.__patterns.django._starting_pattern.source),i.push(this.__patterns.django_value._starting_pattern.source),i.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||i.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&i.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+i.join("|")+")")},r.prototype._read_template=function(){var i="",u=this._input.peek();if(u==="<"){var l=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&l==="?"&&(i=i||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&l==="%"&&(i=i||this.__patterns.erb.read())}else u==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(i=i||this.__patterns.handlebars_comment.read(),i=i||this.__patterns.handlebars_unescaped.read(),i=i||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(i=i||this.__patterns.django_value.read()),this._excluded.django||(i=i||this.__patterns.django_comment.read(),i=i||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(i=i||this.__patterns.smarty_comment.read(),i=i||this.__patterns.smarty_literal.read(),i=i||this.__patterns.smarty.read()));return i},O.exports.TemplatablePattern=r}],L={};function F(O){var w=L[O];if(w!==void 0)return w.exports;var y=L[O]={exports:{}};return x[O](y,y.exports,F),y.exports}var N=F(0);C=N})();var k=C;!(pe=[],j=function(){return{js_beautify:k}}.apply(ft,pe),j!==void 0&&(xt.exports=j))})()},"8hTe":function(xt,ft,se){xt.exports={button:"button___1wy9m"}},"9Bee":function(xt,ft,se){"use strict";var pe=se("DYRE"),j=se("zeV3"),C=se("+L6B"),k=se("2/Rp"),x=se("k1fw"),L=se("9og8"),F=se("tJVT"),N=se("WmNS"),O=se.n(N),w=se("q1tI"),y=se.n(w),_=se("vg9a"),s=se("DlQD"),r=se.n(s),i=se("rUJ1");function u(M,h){var m=M.match(/^(\s+)(?:```)/);if(m===null)return h;var I=m[1];return h.split(`
|
|
`).map(function(W){var P=W.match(/^\s+/);if(P===null)return W;var re=Object(F.a)(P,1),Ce=re[0];return Ce.length>=I.length?W.slice(I.length):W}).join(`
|
|
`)}var l=[],e=["<ul>"],t=new r.a.Renderer,n=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function T(){l.length=0,e=["<ul>"]}var b={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function g(M,h,m,I){if(h>=M.length||M[h].level<=m)return h;var W=M[h];I.push("<li><a href='#"+W.anchor+"'>"+W.text+"</a>"),h++;var P=[];return h=g(M,h,W.level,P),P.length>0&&(I.push("<ul>"),P.forEach(function(re){I.push(re)}),I.push("</ul>")),I.push("</li>"),h=g(M,h,m,I),h}function E(){return g(l,0,0,e),e.push("</ul>"),e.join("")}var v={heading:function(h){var m=n.exec(h);if(m)return{type:"heading",raw:m[0],depth:m[1].length,text:m[2]}},fences:function(h){var m=this.rules.block.fences.exec(h);if(m){var I=m[0],W=u(I,m[3]||""),P=m[2]?m[2].trim():m[2];if(["latex","katex","math"].indexOf(P)>=0){var re=a(),Ce=W;W=re,o[re]={type:"block",expression:Ce}}return{type:"code",raw:I,lang:P,text:W}}}},p=/(?:\${2})([^\n`]+?)(?:\${2})/gi,d=0,a=function(){return"__special_katext_id_".concat(d++,"__")},o={};function c(){return o}function f(){d=0,o={}}function S(M){return M=M.replace(p,function(h,m){var I=a();return o[I]={type:"inline",expression:m},I}),M}var A=t.listitem;t.listitem=function(M){return A(S(M))};var R=t.paragraph;t.paragraph=function(M){return R(S(M))};var B=t.tablecell;t.tablecell=function(M,h){return B(S(M),h)},t.code=function(M,h,m){var I=(h||"").match(/\S*/)[0];return I?["latex","katex","math"].indexOf(I)>=0?"<p class='editormd-tex'>".concat(M,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(h,'">').concat(m?M:Object(i.escape)(M,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(m?M:Object(i.escape)(M,!0))+"</code></pre>"},t.heading=function(M,h,m){var I=this.options.headerPrefix+m.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return l.push({anchor:I,level:h,text:M}),"<h"+h+' id="'+I+'">'+M+"</h"+h+">"},r.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),r.a.use({tokenizer:v,renderer:t});var U=r.a,K=se("SJMd"),D=se("ulZh"),H=se.n(D),V=se("m3rI"),ne=se("Oy/b"),ie=se("p5ED"),_e=se("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 ye=function(M,h){return(ye=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,I){m.__proto__=I}||function(m,I){for(var W in I)Object.prototype.hasOwnProperty.call(I,W)&&(m[W]=I[W])})(M,h)};function be(M,h){function m(){this.constructor=M}ye(M,h),M.prototype=h===null?Object.create(h):(m.prototype=h.prototype,new m)}function we(M,h,m,I){return new(m||(m=Promise))(function(W,P){function re(it){try{Ve(I.next(it))}catch(Oe){P(Oe)}}function Ce(it){try{Ve(I.throw(it))}catch(Oe){P(Oe)}}function Ve(it){var Oe;it.done?W(it.value):(Oe=it.value,Oe instanceof m?Oe:new m(function(ct){ct(Oe)})).then(re,Ce)}Ve((I=I.apply(M,h||[])).next())})}function Re(M,h){var m,I,W,P,re={label:0,sent:function(){if(1&W[0])throw W[1];return W[1]},trys:[],ops:[]};return P={next:Ce(0),throw:Ce(1),return:Ce(2)},typeof Symbol=="function"&&(P[Symbol.iterator]=function(){return this}),P;function Ce(Ve){return function(it){return function(Oe){if(m)throw new TypeError("Generator is already executing.");for(;re;)try{if(m=1,I&&(W=2&Oe[0]?I.return:Oe[0]?I.throw||((W=I.return)&&W.call(I),0):I.next)&&!(W=W.call(I,Oe[1])).done)return W;switch(I=0,W&&(Oe=[2&Oe[0],W.value]),Oe[0]){case 0:case 1:W=Oe;break;case 4:return re.label++,{value:Oe[1],done:!1};case 5:re.label++,I=Oe[1],Oe=[0];continue;case 7:Oe=re.ops.pop(),re.trys.pop();continue;default:if(!(W=re.trys,(W=W.length>0&&W[W.length-1])||Oe[0]!==6&&Oe[0]!==2)){re=0;continue}if(Oe[0]===3&&(!W||Oe[1]>W[0]&&Oe[1]<W[3])){re.label=Oe[1];break}if(Oe[0]===6&&re.label<W[1]){re.label=W[1],W=Oe;break}if(W&&re.label<W[2]){re.label=W[2],re.ops.push(Oe);break}W[2]&&re.ops.pop(),re.trys.pop();continue}Oe=h.call(M,re)}catch(ct){Oe=[6,ct],I=0}finally{m=W=0}if(5&Oe[0])throw Oe[1];return{value:Oe[0]?Oe[1]:void 0,done:!0}}([Ve,it])}}}function ge(){for(var M=0,h=0,m=arguments.length;h<m;h++)M+=arguments[h].length;var I=Array(M),W=0;for(h=0;h<m;h++)for(var P=arguments[h],re=0,Ce=P.length;re<Ce;re++,W++)I[W]=P[re];return I}var Q=function(){function M(){}return M.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},M.setAttributes=function(h,m){for(var I=0,W=m;I<W.length;I++){var P=W[I],re=P[0],Ce=P[1];h.setAttribute(re,Ce)}},M.createRect=function(h,m,I){var W=document.createElementNS("http://www.w3.org/2000/svg","rect");return W.setAttribute("width",h.toString()),W.setAttribute("height",m.toString()),I&&M.setAttributes(W,I),W},M.createLine=function(h,m,I,W,P){var re=document.createElementNS("http://www.w3.org/2000/svg","line");return re.setAttribute("x1",h.toString()),re.setAttribute("y1",m.toString()),re.setAttribute("x2",I.toString()),re.setAttribute("y2",W.toString()),P&&M.setAttributes(re,P),re},M.createPolygon=function(h,m){var I=document.createElementNS("http://www.w3.org/2000/svg","polygon");return I.setAttribute("points",h),m&&M.setAttributes(I,m),I},M.createCircle=function(h,m){var I=document.createElementNS("http://www.w3.org/2000/svg","circle");return I.setAttribute("cx",(h/2).toString()),I.setAttribute("cy",(h/2).toString()),I.setAttribute("r",h.toString()),m&&M.setAttributes(I,m),I},M.createEllipse=function(h,m,I){var W=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return W.setAttribute("cx",(h/2).toString()),W.setAttribute("cy",(m/2).toString()),W.setAttribute("rx",(h/2).toString()),W.setAttribute("ry",(m/2).toString()),I&&M.setAttributes(W,I),W},M.createGroup=function(h){var m=document.createElementNS("http://www.w3.org/2000/svg","g");return h&&M.setAttributes(m,h),m},M.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},M.createMarker=function(h,m,I,W,P,re,Ce){var Ve=document.createElementNS("http://www.w3.org/2000/svg","marker");return M.setAttributes(Ve,[["id",h],["orient",m],["markerWidth",I.toString()],["markerHeight",W.toString()],["refX",P.toString()],["refY",re.toString()]]),Ve.appendChild(Ce),Ve},M.createText=function(h){var m=document.createElementNS("http://www.w3.org/2000/svg","text");return m.setAttribute("x","0"),m.setAttribute("y","0"),h&&M.setAttributes(m,h),m},M.createTSpan=function(h,m){var I=document.createElementNS("http://www.w3.org/2000/svg","tspan");return I.textContent=h,m&&M.setAttributes(I,m),I},M.createImage=function(h){var m=document.createElementNS("http://www.w3.org/2000/svg","image");return h&&M.setAttributes(m,h),m},M.createPoint=function(h,m){var I=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return I.x=h,I.y=m,I},M.createPath=function(h,m){var I=document.createElementNS("http://www.w3.org/2000/svg","path");return I.setAttribute("d",h),m&&M.setAttributes(I,m),I},M}(),Pe=function(){function M(){}return M.addKey=function(h){M.key=h},Object.defineProperty(M,"isLicensed",{get:function(){return!!M.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(M.key)},enumerable:!1,configurable:!0}),M}(),$e=function(){function M(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return M.prototype.rasterize=function(h,m,I){var W=this;return new Promise(function(P){var re=I!==void 0?I:document.createElement("canvas");h===null&&(W.markersOnly=!0,W.naturalSize=!1);var Ce=document.createElementNS("http://www.w3.org/2000/svg","svg");Ce.setAttribute("xmlns","http://www.w3.org/2000/svg"),Ce.setAttribute("width",m.width.baseVal.valueAsString),Ce.setAttribute("height",m.height.baseVal.valueAsString),Ce.setAttribute("viewBox","0 0 "+m.viewBox.baseVal.width.toString()+" "+m.viewBox.baseVal.height.toString()),Ce.innerHTML=m.innerHTML,W.naturalSize===!0?(Ce.width.baseVal.value=h.naturalWidth,Ce.height.baseVal.value=h.naturalHeight):W.width!==void 0&&W.height!==void 0&&(Ce.width.baseVal.value=W.width,Ce.height.baseVal.value=W.height),re.width=Ce.width.baseVal.value,re.height=Ce.height.baseVal.value;var Ve=Ce.outerHTML,it=re.getContext("2d");W.markersOnly!==!0&&it.drawImage(h,0,0,re.width,re.height);var Oe=window.URL,ct=new Image(re.width,re.height);ct.setAttribute("crossOrigin","anonymous");var kt=new Blob([Ve],{type:"image/svg+xml"}),Gt=Oe.createObjectURL(kt);ct.onload=function(){it.drawImage(ct,0,0),Oe.revokeObjectURL(Gt);var Ei=re.toDataURL(W.imageType,W.imageQuality);P(Ei)},ct.src=Gt})},M}(),Fe=function(){},Me=function(){function M(h){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+h+"_"}return Object.defineProperty(M.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(M.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(M.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),M.prototype.addClass=function(h){return this.styleSheet===void 0&&this.addStyleSheet(),h.name=""+this.classNamePrefix+h.localName,this.classes.push(h),this.styleSheet.sheet.insertRule("."+h.name+" {"+h.style+"}",this.styleSheet.sheet.cssRules.length),h},M.prototype.addRule=function(h){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(h),this.styleSheet.sheet.insertRule(h.selector+" {"+h.style+"}",this.styleSheet.sheet.cssRules.length)},M.prototype.addStyleSheet=function(){var h;this.styleSheet=document.createElement("style"),((h=this.styleSheetRoot)!==null&&h!==void 0?h:document.head).appendChild(this.styleSheet),this.addRule(new ze("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new ze("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new ze("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new xe("fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new xe("fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},M.prototype.removeStyleSheet=function(){var h;this.styleSheet&&(((h=this.styleSheetRoot)!==null&&h!==void 0?h:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},M}(),ze=function(M,h){this.selector=M,this.style=h},xe=function(M,h){this.localName=M,this.style=h},ke=function(){function M(h,m,I,W,P){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=h,this.displayMode=m,this.markerItems=I,this.uiStyleSettings=W,this.styles=P,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return M.prototype.show=function(h){var m=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=h,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var I=document.createElement("div");I.className=this.toolbarBlockStyleClass.name,I.style.whiteSpace="nowrap",this.uiContainer.appendChild(I),this.addActionButton(I,'<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(I,'<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(I,'<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(I,'<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(I,'<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(I,'<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(I,'<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(I,'<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(P){var re=document.createElement("div");re.className=""+m.toolbarButtonStyleClass.name,re.setAttribute("data-type-name",P.typeName),re.innerHTML=P.icon,re.addEventListener("click",function(){m.markerToolbarButtonClicked(re,P)}),m.buttons.push(re),m.markerButtons.push(re)}),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 W=document.createElement("div");W.className=this.toolbarBlockStyleClass.name,W.style.whiteSpace="nowrap",W.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(W),this.addActionButton(W,'<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(W,'<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()},M.prototype.addButtonClickListener=function(h){this.buttonClickListeners.push(h)},M.prototype.removeButtonClickListener=function(h){this.buttonClickListeners.indexOf(h)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(h),1)},M.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},M.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var h=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var m=0;m<this.markerButtons.length;m++)m<h||m===h&&this.markerButtons.length-1===h?this.markerButtonBlock.appendChild(this.markerButtons[m]):(m===h&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[m]))}},M.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")},M.prototype.resetButtonStyles=function(){var h=this;this.buttons.forEach(function(m){m.className=m.className.replace(h.uiStyleSettings.toolbarButtonStyleColorsClassName?h.uiStyleSettings.toolbarButtonStyleColorsClassName:h.toolbarButtonStyleColorsClass.name,"").trim(),m.className=m.className.replace(h.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?h.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:h.toolbarActiveButtonStyleColorsClass.name,"").trim(),m.className+=" "+(h.uiStyleSettings.toolbarButtonStyleColorsClassName?h.uiStyleSettings.toolbarButtonStyleColorsClassName:h.toolbarButtonStyleColorsClass.name)})},M.prototype.addActionButton=function(h,m,I){var W=this,P=document.createElement("div");switch(P.className=""+this.toolbarButtonStyleClass.name,P.innerHTML=m,P.setAttribute("data-action",I),P.addEventListener("click",function(){W.actionToolbarButtonClicked(P,I)}),I){case"select":P.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":P.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":P.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":P.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":P.style.fill=this.uiStyleSettings.closeButtonColor}h.appendChild(P),this.buttons.push(P)},M.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new xe("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 xe("toolbar_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new xe("toolbar-block",`
|
|
display: inline-block;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new xe("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 xe("toolbar-overflow-block_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`));var h=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new xe("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*h)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*h)+`px;
|
|
padding: `+h+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new xe("toolbar_button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new xe("toolbar_active_button",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new ze("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new ze("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`))},M.prototype.markerToolbarButtonClicked=function(h,m){this.setActiveButton(h),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(I){return I("marker",m)}),this.markerButtonOverflowBlock.style.display="none"},M.prototype.actionToolbarButtonClicked=function(h,m){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(I){return I("action",m)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},M.prototype.setActiveButton=function(h){this.resetButtonStyles(),h.className=h.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),h.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},M.prototype.setActiveMarkerButton=function(h){var m=this.markerButtons.find(function(I){return I.getAttribute("data-type-name")===h});m&&this.setActiveButton(m)},M.prototype.setCurrentMarker=function(h){var m=this;this.currentMarker=h,this.buttons.filter(function(I){return/delete|notes/.test(I.getAttribute("data-action"))}).forEach(function(I){m.currentMarker===void 0?(I.style.fillOpacity="0.4",I.style.pointerEvents="none"):(I.style.fillOpacity="1",I.style.pointerEvents="all")})},M}(),je=function(){function M(h,m,I,W){this.panels=[],this.panelButtons=[],this.markerjsContainer=h,this.displayMode=m,this.uiStyleSettings=I,this.styles=W,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return M.prototype.addStyles=function(){var h;this.toolboxStyleClass=this.styles.addClass(new xe("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 xe("toolbox_colors",`
|
|
color: `+this.uiStyleSettings.toolboxColor+`;
|
|
`));var m=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new xe("toolbox-button-row",`
|
|
display: flex;
|
|
cursor: default;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new xe("toolbox-button-row_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new xe("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 xe("toolbox-panel-row_colors",`
|
|
background-color: `+((h=this.uiStyleSettings.toolboxBackgroundColor)!==null&&h!==void 0?h:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new xe("toolbox_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*m)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*m)+`px;
|
|
padding: `+m+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new xe("toolbox-button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new xe("toolbox-active-button_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.styles.addRule(new ze("."+this.toolboxButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new ze("."+this.toolboxButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`))},M.prototype.show=function(h){var m;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=h,this.uiContainer.className=this.toolboxStyleClass.name+" "+((m=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&m!==void 0?m:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},M.prototype.setPanelButtons=function(h){var m,I,W=this;this.panels=h,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((m=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&m!==void 0?m:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((I=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&I!==void 0?I:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(P){var re;P.uiStyleSettings=W.uiStyleSettings;var Ce=document.createElement("div");Ce.className=W.toolboxButtonStyleClass.name+" "+((re=W.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&re!==void 0?re:W.toolboxButtonStyleColorsClass.name),Ce.innerHTML=P.icon,Ce.title=P.title,Ce.addEventListener("click",function(){W.panelButtonClick(P)}),W.panelButtons.push(Ce),W.buttonRow.appendChild(Ce)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},M.prototype.panelButtonClick=function(h){var m=this,I=-1;if(h!==this.activePanel){I=this.panels.indexOf(h),this.panelRow.innerHTML="";var W=h.getUi();W.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(W),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=h}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){m.displayMode==="inline"?m.panelRow.style.display="none":m.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(P,re){var Ce,Ve;P.className=m.toolboxButtonStyleClass.name+" "+(re===I?""+((Ce=m.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Ce!==void 0?Ce:m.toolboxActiveButtonStyleColorsClass.name):""+((Ve=m.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Ve!==void 0?Ve:m.toolboxButtonStyleColorsClass.name))})},M}(),Ge=function(M,h){this.title=M,this.icon=h},Ue=function(M){function h(m,I,W,P){var re=M.call(this,m,P||'<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 re.colors=[],re.addTransparent=!1,re.colorBoxes=[],re.colors=I,re.currentColor=W,re.setCurrentColor=re.setCurrentColor.bind(re),re.getColorBox=re.getColorBox.bind(re),re}return be(h,M),h.prototype.getUi=function(){var m=this,I=document.createElement("div");return I.style.overflow="hidden",I.style.whiteSpace="nowrap",this.colors.forEach(function(W){var P=m.getColorBox(W);I.appendChild(P),m.colorBoxes.push(P)}),I},h.prototype.getColorBox=function(m){var I=this,W=this.uiStyleSettings.toolbarHeight/4,P=this.uiStyleSettings.toolbarHeight-W,re=document.createElement("div");re.style.display="inline-block",re.style.boxSizing="content-box",re.style.width=P-2+"px",re.style.height=P-2+"px",re.style.padding="1px",re.style.marginRight="2px",re.style.marginBottom="2px",re.style.borderWidth="2px",re.style.borderStyle="solid",re.style.borderRadius=(P+2)/2+"px",re.style.borderColor=m===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",re.addEventListener("click",function(){I.setCurrentColor(m,re)});var Ce=document.createElement("div");return Ce.style.display="inline-block",Ce.style.width=P-2+"px",Ce.style.height=P-2+"px",Ce.style.backgroundColor=m,Ce.style.borderRadius=P/2+"px",m==="transparent"&&(Ce.style.fill=this.uiStyleSettings.toolboxAccentColor,Ce.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>`),re.appendChild(Ce),re},h.prototype.setCurrentColor=function(m,I){var W=this;this.currentColor=m,this.colorBoxes.forEach(function(P){P.style.borderColor=P===I?W.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(m)},h}(Ge),Le=function(){function M(h,m,I){this._state="new",this._isSelected=!1,this._container=h,this._overlayContainer=m,this.globalSettings=I,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(M.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),M.prototype.ownsTarget=function(h){return!1},Object.defineProperty(M.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),M.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},M.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},M.prototype.pointerDown=function(h,m){},M.prototype.dblClick=function(h,m){},M.prototype.manipulate=function(h){},M.prototype.pointerUp=function(h){this.stateChanged()},M.prototype.dispose=function(){},M.prototype.addMarkerVisualToContainer=function(h){this.container.childNodes.length>0?this.container.insertBefore(h,this.container.childNodes[0]):this.container.appendChild(h)},M.prototype.getState=function(){return{typeName:M.typeName,state:this.state,notes:this.notes}},M.prototype.restoreState=function(h){this._state=h.state,this.notes=h.notes},M.prototype.scale=function(h,m){},M.prototype.colorChanged=function(h){this.onColorChanged&&this.onColorChanged(h),this.stateChanged()},M.prototype.fillColorChanged=function(h){this.onFillColorChanged&&this.onFillColorChanged(h),this.stateChanged()},M.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var h=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),h.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(h)&&this.onStateChanged(this)}},M.typeName="MarkerBase",M}(),Ae=function(){function M(){this.findGripByVisual=this.findGripByVisual.bind(this)}return M.prototype.findGripByVisual=function(h){return this.topLeft.ownsTarget(h)?this.topLeft:this.topCenter.ownsTarget(h)?this.topCenter:this.topRight.ownsTarget(h)?this.topRight:this.centerLeft.ownsTarget(h)?this.centerLeft:this.centerRight.ownsTarget(h)?this.centerRight:this.bottomLeft.ownsTarget(h)?this.bottomLeft:this.bottomCenter.ownsTarget(h)?this.bottomCenter:this.bottomRight.ownsTarget(h)?this.bottomRight:void 0},M}(),nt=function(){function M(){this.GRIP_SIZE=10,this.visual=Q.createGroup(),this.visual.appendChild(Q.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(Q.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return M.prototype.ownsTarget=function(h){return h===this.visual||h===this.visual.childNodes[0]||h===this.visual.childNodes[1]},M}(),Qe=function(){function M(){}return M.toITransformMatrix=function(h){return{a:h.a,b:h.b,c:h.c,d:h.d,e:h.e,f:h.f}},M.toSVGMatrix=function(h,m){return h.a=m.a,h.b=m.b,h.c=m.c,h.d=m.d,h.e=m.e,h.f=m.f,h},M}(),Ze=function(M){function h(m,I,W){var P=M.call(this,m,I,W)||this;return P.left=0,P.top=0,P.width=0,P.height=0,P.defaultSize={x:50,y:20},P.offsetX=0,P.offsetY=0,P.rotationAngle=0,P.CB_DISTANCE=10,P._suppressMarkerCreateEvent=!1,P.container.transform.baseVal.appendItem(Q.createTransform()),P.setupControlBox(),P}return be(h,M),Object.defineProperty(h.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"visual",{get:function(){return this._visual},set:function(m){this._visual=m;var I=Q.createTransform();this._visual.transform.baseVal.appendItem(I)},enumerable:!1,configurable:!0}),h.prototype.ownsTarget=function(m){return!!M.prototype.ownsTarget.call(this,m)||!!(this.controlGrips.findGripByVisual(m)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(m))},h.prototype.pointerDown=function(m,I){M.prototype.pointerDown.call(this,m,I),this.state==="new"&&(this.left=m.x,this.top=m.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var W=this.unrotatePoint(m);if(this.manipulationStartX=W.x,this.manipulationStartY=W.y,this.offsetX=W.x-this.left,this.offsetY=W.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(I),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(I)){this.activeGrip=this.rotatorGrip;var P=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=P.x-this.width/2,this.top=P.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var re=this.container.transform.baseVal.getItem(0);re.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(re,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},h.prototype.pointerUp=function(m){var I=this.state;M.prototype.pointerUp.call(this,m),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(m),this._state="select",I==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},h.prototype.moveVisual=function(m){this.visual.style.transform="translate("+m.x+"px, "+m.y+"px)"},h.prototype.manipulate=function(m){var I=this.unrotatePoint(m);this.state==="creating"?this.resize(m):this.state==="move"?(this.left=this.manipulationStartLeft+(I.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(I.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(I):this.state==="rotate"&&this.rotate(m)},h.prototype.resize=function(m){var I=this.manipulationStartLeft,W=this.manipulationStartWidth,P=this.manipulationStartTop,re=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:I=this.manipulationStartLeft+m.x-this.manipulationStartX,W=this.manipulationStartWidth+this.manipulationStartLeft-I;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:W=this.manipulationStartWidth+m.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:P=this.manipulationStartTop+m.y-this.manipulationStartY,re=this.manipulationStartHeight+this.manipulationStartTop-P;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:re=this.manipulationStartHeight+m.y-this.manipulationStartY}W>=0?(this.left=I,this.width=W):(this.left=I+W,this.width=-W),re>=0?(this.top=P,this.height=re):(this.top=P+re,this.height=-re),this.setSize()},h.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},h.prototype.rotate=function(m){if(Math.abs(m.x-this.centerX)>.1){var I=Math.sign(m.x-this.centerX);this.rotationAngle=180*Math.atan((m.y-this.centerY)/(m.x-this.centerX))/Math.PI+90*I,this.applyRotation()}},h.prototype.applyRotation=function(){var m=this.container.transform.baseVal.getItem(0);m.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(m,0)},h.prototype.rotatePoint=function(m){if(this.rotationAngle===0)return m;var I=this.container.getCTM(),W=Q.createPoint(m.x,m.y);return{x:(W=W.matrixTransform(I)).x,y:W.y}},h.prototype.unrotatePoint=function(m){if(this.rotationAngle===0)return m;var I=this.container.getCTM();I=I.inverse();var W=Q.createPoint(m.x,m.y);return{x:(W=W.matrixTransform(I)).x,y:W.y}},h.prototype.select=function(){M.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},h.prototype.deselect=function(){M.prototype.deselect.call(this),this.controlBox.style.display="none"},h.prototype.setupControlBox=function(){this.controlBox=Q.createGroup();var m=Q.createTransform();m.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(m),this.container.appendChild(this.controlBox),this.controlRect=Q.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=Q.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 Ae,this.addControlGrips(),this.controlBox.style.display="none"},h.prototype.adjustControlBox=function(){var m=this.controlBox.transform.baseVal.getItem(0);m.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(m,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()},h.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()},h.prototype.createGrip=function(){var m=new nt;return m.visual.transform.baseVal.appendItem(Q.createTransform()),this.controlBox.appendChild(m.visual),m},h.prototype.positionGrips=function(){var m=this.controlGrips.topLeft.GRIP_SIZE,I=-m/2,W=I,P=(this.width+this.CB_DISTANCE)/2-m/2,re=(this.height+this.CB_DISTANCE)/2-m/2,Ce=this.height+this.CB_DISTANCE-m/2,Ve=this.width+this.CB_DISTANCE-m/2;this.positionGrip(this.controlGrips.topLeft.visual,I,W),this.positionGrip(this.controlGrips.topCenter.visual,P,W),this.positionGrip(this.controlGrips.topRight.visual,Ve,W),this.positionGrip(this.controlGrips.centerLeft.visual,I,re),this.positionGrip(this.controlGrips.centerRight.visual,Ve,re),this.positionGrip(this.controlGrips.bottomLeft.visual,I,Ce),this.positionGrip(this.controlGrips.bottomCenter.visual,P,Ce),this.positionGrip(this.controlGrips.bottomRight.visual,Ve,Ce),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,P,W-3*this.CB_DISTANCE)},h.prototype.positionGrip=function(m,I,W){var P=m.transform.baseVal.getItem(0);P.setTranslate(I,W),m.transform.baseVal.replaceItem(P,0)},h.prototype.hideControlBox=function(){this.controlBox.style.display="none"},h.prototype.showControlBox=function(){this.controlBox.style.display=""},h.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:Qe.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:Qe.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},M.prototype.getState.call(this))},h.prototype.restoreState=function(m){M.prototype.restoreState.call(this,m);var I=m;this.left=I.left,this.top=I.top,this.width=I.width,this.height=I.height,this.rotationAngle=I.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(Qe.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,I.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(Qe.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,I.containerTransformMatrix))},h.prototype.scale=function(m,I){M.prototype.scale.call(this,m,I);var W=this.rotatePoint({x:this.left,y:this.top}),P=this.unrotatePoint({x:W.x*m,y:W.y*I});this.left=P.x,this.top=P.y,this.width=this.width*m,this.height=this.height*I,this.adjustControlBox()},h}(Le),Ye=function(M){function h(m,I,W){var P=M.call(this,m,I,W)||this;return P.fillColor="transparent",P.strokeColor="transparent",P.strokeWidth=0,P.strokeDasharray="",P.opacity=1,P.setStrokeColor=P.setStrokeColor.bind(P),P.setFillColor=P.setFillColor.bind(P),P.setStrokeWidth=P.setStrokeWidth.bind(P),P.setStrokeDasharray=P.setStrokeDasharray.bind(P),P.createVisual=P.createVisual.bind(P),P}return be(h,M),h.prototype.ownsTarget=function(m){return!(!M.prototype.ownsTarget.call(this,m)&&m!==this.visual)},h.prototype.createVisual=function(){this.visual=Q.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)},h.prototype.pointerDown=function(m,I){M.prototype.pointerDown.call(this,m,I),this.state==="new"&&(this.createVisual(),this.moveVisual(m),this._state="creating")},h.prototype.manipulate=function(m){M.prototype.manipulate.call(this,m)},h.prototype.resize=function(m){M.prototype.resize.call(this,m),this.setSize()},h.prototype.setSize=function(){M.prototype.setSize.call(this),Q.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},h.prototype.pointerUp=function(m){M.prototype.pointerUp.call(this,m),this.setSize()},h.prototype.setStrokeColor=function(m){this.strokeColor=m,this.visual&&Q.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(m),this.stateChanged()},h.prototype.setFillColor=function(m){this.fillColor=m,this.visual&&Q.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},h.prototype.setStrokeWidth=function(m){this.strokeWidth=m,this.visual&&Q.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},h.prototype.setStrokeDasharray=function(m){this.strokeDasharray=m,this.visual&&Q.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},h.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},M.prototype.getState.call(this))},h.prototype.restoreState=function(m){var I=m;this.fillColor=I.fillColor,this.strokeColor=I.strokeColor,this.strokeWidth=I.strokeWidth,this.strokeDasharray=I.strokeDasharray,this.opacity=I.opacity,this.createVisual(),M.prototype.restoreState.call(this,m),this.setSize()},h.prototype.scale=function(m,I){M.prototype.scale.call(this,m,I),this.setSize()},h.title="Rectangle marker",h}(Ze),at=function(M){function h(m,I,W,P){var re=M.call(this,m,P||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return re.widths=[],re.widthBoxes=[],re.widths=I,re.currentWidth=W,re.setCurrentWidth=re.setCurrentWidth.bind(re),re}return be(h,M),h.prototype.getUi=function(){var m=this,I=document.createElement("div");return I.style.display="flex",I.style.overflow="hidden",I.style.flexGrow="2",this.widths.forEach(function(W){var P=document.createElement("div");P.style.display="flex",P.style.flexGrow="2",P.style.alignItems="center",P.style.justifyContent="space-between",P.style.padding="5px",P.style.borderWidth="2px",P.style.borderStyle="solid",P.style.borderColor=W===m.currentWidth?m.uiStyleSettings.toolboxAccentColor:"transparent",P.addEventListener("click",function(){m.setCurrentWidth(W,P)}),I.appendChild(P);var re=document.createElement("div");re.innerText=W.toString(),re.style.marginRight="5px",P.appendChild(re);var Ce=document.createElement("div");Ce.style.minHeight="20px",Ce.style.flexGrow="2",Ce.style.display="flex",Ce.style.alignItems="center";var Ve=document.createElement("hr");Ve.style.minWidth="20px",Ve.style.border="0px",Ve.style.borderTop=W+"px solid "+m.uiStyleSettings.toolboxColor,Ve.style.flexGrow="2",Ce.appendChild(Ve),P.appendChild(Ce),m.widthBoxes.push(P)}),I},h.prototype.setCurrentWidth=function(m,I){var W=this;this.currentWidth=m,this.widthBoxes.forEach(function(P){P.style.borderColor=P===I?W.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},h}(Ge),qe=function(M){function h(m,I,W,P){var re=M.call(this,m,P||'<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 re.styles=[],re.styleBoxes=[],re.styles=I,re.currentStyle=W,re.setCurrentStyle=re.setCurrentStyle.bind(re),re}return be(h,M),h.prototype.getUi=function(){var m=this,I=document.createElement("div");return I.style.display="flex",I.style.overflow="hidden",I.style.flexGrow="2",this.styles.forEach(function(W){var P=document.createElement("div");P.style.display="flex",P.style.alignItems="center",P.style.justifyContent="space-between",P.style.padding="5px",P.style.borderWidth="2px",P.style.borderStyle="solid",P.style.overflow="hidden",P.style.maxWidth=100/m.styles.length-5+"%",P.style.borderColor=W===m.currentStyle?m.uiStyleSettings.toolboxAccentColor:"transparent",P.addEventListener("click",function(){m.setCurrentStyle(W,P)}),I.appendChild(P);var re=document.createElement("div");re.style.minHeight="20px",re.style.flexGrow="2",re.style.overflow="hidden";var Ce=`<svg width="100" height="20">
|
|
<line x1="0" y1="10" x2="100" y2="10" stroke="`+m.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(W!==""?'stroke-dasharray="'+W+'"':"")+` />
|
|
</svg>`;re.innerHTML=Ce,P.appendChild(re),m.styleBoxes.push(P)}),I},h.prototype.setCurrentStyle=function(m,I){var W=this;this.currentStyle=m,this.styleBoxes.forEach(function(P){P.style.borderColor=P===I?W.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},h}(Ge),Xe=function(M){function h(m,I,W){var P=M.call(this,m,I,W)||this;return P.strokeColor=W.defaultColor,P.strokeWidth=W.defaultStrokeWidth,P.strokeDasharray=W.defaultStrokeDasharray,P.strokePanel=new Ue("Line color",W.defaultColorSet,W.defaultColor),P.strokePanel.onColorChanged=P.setStrokeColor,P.strokeWidthPanel=new at("Line width",W.defaultStrokeWidths,W.defaultStrokeWidth),P.strokeWidthPanel.onWidthChanged=P.setStrokeWidth,P.strokeStylePanel=new qe("Line style",W.defaultStrokeDasharrays,W.defaultStrokeDasharray),P.strokeStylePanel.onStyleChanged=P.setStrokeDasharray,P}return be(h,M),Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var m=M.prototype.getState.call(this);return m.typeName=h.typeName,m},h.typeName="FrameMarker",h.title="Frame marker",h.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',h}(Ye),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},rt=function(M){function h(m,I,W){var P=M.call(this,m,I,W)||this;return P.x1=0,P.y1=0,P.x2=0,P.y2=0,P.defaultLength=50,P.manipulationStartX=0,P.manipulationStartY=0,P.manipulationStartX1=0,P.manipulationStartY1=0,P.manipulationStartX2=0,P.manipulationStartY2=0,P.setupControlBox(),P}return be(h,M),h.prototype.ownsTarget=function(m){return!!M.prototype.ownsTarget.call(this,m)||!(!this.grip1.ownsTarget(m)&&!this.grip2.ownsTarget(m))},h.prototype.pointerDown=function(m,I){M.prototype.pointerDown.call(this,m,I),this.manipulationStartX=m.x,this.manipulationStartY=m.y,this.state==="new"&&(this.x1=m.x,this.y1=m.y,this.x2=m.x,this.y2=m.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(I)?this.activeGrip=this.grip1:this.grip2.ownsTarget(I)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},h.prototype.pointerUp=function(m){var I=this.state;M.prototype.pointerUp.call(this,m),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(m),this._state="select",I==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},h.prototype.adjustVisual=function(){},h.prototype.manipulate=function(m){this.state==="creating"?this.resize(m):this.state==="move"?(this.x1=this.manipulationStartX1+m.x-this.manipulationStartX,this.y1=this.manipulationStartY1+m.y-this.manipulationStartY,this.x2=this.manipulationStartX2+m.x-this.manipulationStartX,this.y2=this.manipulationStartY2+m.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(m)},h.prototype.resize=function(m){switch(this.activeGrip){case this.grip1:this.x1=m.x,this.y1=m.y;break;case this.grip2:case void 0:this.x2=m.x,this.y2=m.y}this.adjustVisual(),this.adjustControlBox()},h.prototype.select=function(){M.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},h.prototype.deselect=function(){M.prototype.deselect.call(this),this.controlBox.style.display="none"},h.prototype.setupControlBox=function(){this.controlBox=Q.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},h.prototype.adjustControlBox=function(){this.positionGrips()},h.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},h.prototype.createGrip=function(){var m=new nt;return m.visual.transform.baseVal.appendItem(Q.createTransform()),this.controlBox.appendChild(m.visual),m},h.prototype.positionGrips=function(){var m=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-m/2,this.y1-m/2),this.positionGrip(this.grip2.visual,this.x2-m/2,this.y2-m/2)},h.prototype.positionGrip=function(m,I,W){var P=m.transform.baseVal.getItem(0);P.setTranslate(I,W),m.transform.baseVal.replaceItem(P,0)},h.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},M.prototype.getState.call(this))},h.prototype.restoreState=function(m){M.prototype.restoreState.call(this,m);var I=m;this.x1=I.x1,this.y1=I.y1,this.x2=I.x2,this.y2=I.y2},h.prototype.scale=function(m,I){M.prototype.scale.call(this,m,I),this.x1=this.x1*m,this.y1=this.y1*I,this.x2=this.x2*m,this.y2=this.y2*I,this.adjustVisual(),this.adjustControlBox()},h}(Le),Je=function(M){function h(m,I,W){var P=M.call(this,m,I,W)||this;return P.strokeColor="transparent",P.strokeWidth=0,P.strokeDasharray="",P.setStrokeColor=P.setStrokeColor.bind(P),P.setStrokeWidth=P.setStrokeWidth.bind(P),P.setStrokeDasharray=P.setStrokeDasharray.bind(P),P.strokeColor=W.defaultColor,P.strokeWidth=W.defaultStrokeWidth,P.strokeDasharray=W.defaultStrokeDasharray,P.strokePanel=new Ue("Line color",W.defaultColorSet,W.defaultColor),P.strokePanel.onColorChanged=P.setStrokeColor,P.strokeWidthPanel=new at("Line width",W.defaultStrokeWidths,W.defaultStrokeWidth),P.strokeWidthPanel.onWidthChanged=P.setStrokeWidth,P.strokeStylePanel=new qe("Line style",W.defaultStrokeDasharrays,W.defaultStrokeDasharray),P.strokeStylePanel.onStyleChanged=P.setStrokeDasharray,P}return be(h,M),h.prototype.ownsTarget=function(m){return!(!M.prototype.ownsTarget.call(this,m)&&m!==this.visual&&m!==this.selectorLine&&m!==this.visibleLine)},h.prototype.createVisual=function(){this.visual=Q.createGroup(),this.selectorLine=Q.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=Q.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)},h.prototype.pointerDown=function(m,I){M.prototype.pointerDown.call(this,m,I),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},h.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()),Q.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),Q.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),Q.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},h.prototype.setStrokeColor=function(m){this.strokeColor=m,this.adjustVisual(),this.colorChanged(m)},h.prototype.setStrokeWidth=function(m){this.strokeWidth=m,this.adjustVisual()},h.prototype.setStrokeDasharray=function(m){this.strokeDasharray=m,this.adjustVisual(),this.stateChanged()},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var m=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},M.prototype.getState.call(this));return m.typeName=h.typeName,m},h.prototype.restoreState=function(m){M.prototype.restoreState.call(this,m);var I=m;this.strokeColor=I.strokeColor,this.strokeWidth=I.strokeWidth,this.strokeDasharray=I.strokeDasharray,this.createVisual(),this.adjustVisual()},h.typeName="LineMarker",h.title="Line marker",h.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',h}(rt),Ee=function(M){function h(m,I,W,P){var re=M.call(this,m,P||'<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 re.fonts=[],re.fontBoxes=[],re.fonts=I,re.currentFont=W,re.setCurrentFont=re.setCurrentFont.bind(re),re}return be(h,M),h.prototype.getUi=function(){var m=this,I=document.createElement("div");return I.style.overflow="hidden",I.style.flexGrow="2",this.fonts.forEach(function(W){var P=document.createElement("div");P.style.display="inline-block",P.style.alignItems="center",P.style.justifyContent="space-between",P.style.padding="5px",P.style.borderWidth="2px",P.style.borderStyle="solid",P.style.overflow="hidden",P.style.maxWidth=100/m.fonts.length-5+"%",P.style.borderColor=W===m.currentFont?m.uiStyleSettings.toolboxAccentColor:"transparent",P.addEventListener("click",function(){m.setCurrentFont(W,P)}),I.appendChild(P);var re=document.createElement("div");re.style.display="flex",re.style.minHeight="20px",re.style.flexGrow="2",re.style.fontFamily=W,re.style.overflow="hidden";var Ce=document.createElement("div");Ce.style.whiteSpace="nowrap",Ce.style.overflow="hidden",Ce.style.textOverflow="ellipsis",Ce.innerHTML="The quick brown fox jumps over the lazy dog",re.appendChild(Ce),P.appendChild(re),m.fontBoxes.push(P)}),I},h.prototype.setCurrentFont=function(m,I){var W=this;this.currentFont=m,this.fontBoxes.forEach(function(P){P.style.borderColor=P===I?W.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},h}(Ge),He=function(M){function h(m,I,W){var P=M.call(this,m,I,W)||this;return P.color="transparent",P.padding=5,P.DEFAULT_TEXT="your text here",P.text=P.DEFAULT_TEXT,P.isMoved=!1,P.color=W.defaultColor,P.fontFamily=W.defaultFontFamily,P.defaultSize={x:100,y:30},P.setColor=P.setColor.bind(P),P.setFont=P.setFont.bind(P),P.renderText=P.renderText.bind(P),P.sizeText=P.sizeText.bind(P),P.textEditDivClicked=P.textEditDivClicked.bind(P),P.showTextEditor=P.showTextEditor.bind(P),P.setSize=P.setSize.bind(P),P.positionTextEditor=P.positionTextEditor.bind(P),P.colorPanel=new Ue("Color",W.defaultColorSet,W.defaultColor),P.colorPanel.onColorChanged=P.setColor,P.fontFamilyPanel=new Ee("Font",W.defaultFontFamilies,W.defaultFontFamily),P.fontFamilyPanel.onFontChanged=P.setFont,P}return be(h,M),h.prototype.ownsTarget=function(m){if(M.prototype.ownsTarget.call(this,m)||m===this.visual||m===this.textElement||m===this.bgRectangle)return!0;var I=!1;return this.textElement.childNodes.forEach(function(W){W===m&&(I=!0)}),I},h.prototype.createVisual=function(){this.visual=Q.createGroup(),this.bgRectangle=Q.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=Q.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(Q.createTransform()),this.textElement.transform.baseVal.appendItem(Q.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},h.prototype.pointerDown=function(m,I){M.prototype.pointerDown.call(this,m,I),this.isMoved=!1,this.pointerDownPoint=m,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(m),this._state="creating")},h.prototype.renderText=function(){var m=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(I){m.textElement.appendChild(Q.createTSpan(I.trim()===""?" ":I.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},h.prototype.getTextScale=function(){var m=this.textElement.getBBox(),I=1;if(m.width>0&&m.height>0){var W=(1*this.width-this.width*this.padding*2/100)/m.width,P=(1*this.height-this.height*this.padding*2/100)/m.height;I=Math.min(W,P)}return I},h.prototype.getTextPosition=function(m){var I=this.textElement.getBBox(),W=0,P=0;return I.width>0&&I.height>0&&(W=(this.width-I.width*m)/2,P=this.height/2-I.height*m/2),{x:W,y:P}},h.prototype.sizeText=function(){var m=this.textElement.getBBox(),I=this.getTextScale(),W=this.getTextPosition(I);W.y-=m.y*I,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+W.x+"px, "+W.y+"px) scale("+I+", "+I+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(W.x,W.y),this.textElement.transform.baseVal.getItem(1).setScale(I,I))},h.prototype.manipulate=function(m){M.prototype.manipulate.call(this,m),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(m.x-this.pointerDownPoint.x)>5||Math.abs(m.y-this.pointerDownPoint.y)>5)},h.prototype.resize=function(m){M.prototype.resize.call(this,m),this.isMoved=!0,this.setSize(),this.sizeText()},h.prototype.setSize=function(){M.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(Q.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),Q.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},h.prototype.pointerUp=function(m){var I=this.state;I==="creating"&&(this._suppressMarkerCreateEvent=!0),M.prototype.pointerUp.call(this,m),this.setSize(),(I==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},h.prototype.showTextEditor=function(){var m=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(I){I.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var I=Number.parseFloat(m.textEditor.style.fontSize);m.textEditor.clientWidth>=Number.parseInt(m.textEditor.style.maxWidth)&&I>.9;)I-=.1,m.textEditor.style.fontSize=Math.max(I,.9)+"em"}),this.textEditor.addEventListener("keyup",function(I){I.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(I){if(I.clipboardData){var W=I.clipboardData.getData("text"),P=window.getSelection();if(!P.rangeCount)return!1;P.deleteFromDocument(),P.getRangeAt(0).insertNode(document.createTextNode(W)),I.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){m.textEditDivClicked(m.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},h.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var m=this.getTextScale(),I=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),W=this.textElement.getBBox(),P={x:W.width*m,y:W.height*m};I.x-=P.x/2,I.y-=P.y/2,this.textEditor.style.top=I.y+"px",this.textEditor.style.left=I.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-I.x+"px",this.textEditor.style.fontSize=Math.max(16*m,12)+"px",this.textElement.style.display="none"}},h.prototype.textEditDivClicked=function(m){this.text=m.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},h.prototype.select=function(){M.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},h.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),M.prototype.deselect.call(this)},h.prototype.dblClick=function(m,I){M.prototype.dblClick.call(this,m,I),this.showTextEditor()},h.prototype.setColor=function(m){this.textElement&&Q.setAttributes(this.textElement,[["fill",m]]),this.color=m,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(m)},h.prototype.setFont=function(m){this.textElement&&Q.setAttributes(this.textElement,[["font-family",m]]),this.fontFamily=m,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},h.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},h.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var m=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},M.prototype.getState.call(this));return m.typeName=h.typeName,m},h.prototype.restoreState=function(m){var I=m;this.color=I.color,this.fontFamily=I.fontFamily,this.padding=I.padding,this.text=I.text,this.createVisual(),M.prototype.restoreState.call(this,m),this.setSize()},h.prototype.scale=function(m,I){M.prototype.scale.call(this,m,I),this.setSize(),this.sizeText(),this.positionTextEditor()},h.typeName="TextMarker",h.title="Text marker",h.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>',h}(Ze),de=function(M){function h(m,I,W){var P=M.call(this,m,I,W)||this;return P.color="transparent",P.lineWidth=3,P.drawing=!1,P.pixelRatio=1,P.color=W.defaultColor,P.lineWidth=W.defaultStrokeWidth,P.pixelRatio=W.freehandPixelRatio,P.setColor=P.setColor.bind(P),P.addCanvas=P.addCanvas.bind(P),P.finishCreation=P.finishCreation.bind(P),P.setLineWidth=P.setLineWidth.bind(P),P.colorPanel=new Ue("Color",W.defaultColorSet,W.defaultColor),P.colorPanel.onColorChanged=P.setColor,P.lineWidthPanel=new at("Line width",W.defaultStrokeWidths,W.defaultStrokeWidth),P.lineWidthPanel.onWidthChanged=P.setLineWidth,P}return be(h,M),h.prototype.ownsTarget=function(m){return!(!M.prototype.ownsTarget.call(this,m)&&m!==this.visual&&m!==this.drawingImage)},h.prototype.createVisual=function(){this.visual=Q.createGroup(),this.drawingImage=Q.createImage(),this.visual.appendChild(this.drawingImage);var m=Q.createTransform();this.visual.transform.baseVal.appendItem(m),this.addMarkerVisualToContainer(this.visual)},h.prototype.pointerDown=function(m,I){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(m.x,m.y),this.drawing=!0):M.prototype.pointerDown.call(this,m,I)},h.prototype.manipulate=function(m){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(m.x,m.y),this.canvasContext.stroke()):M.prototype.manipulate.call(this,m)},h.prototype.resize=function(m){M.prototype.resize.call(this,m),Q.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),Q.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},h.prototype.pointerUp=function(m){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):M.prototype.pointerUp.call(this,m)},h.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)},h.prototype.select=function(){this.state==="creating"&&this.finishCreation(),M.prototype.select.call(this)},h.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),M.prototype.deselect.call(this)},h.prototype.finishCreation=function(){for(var m=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),I=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],W=I[0],P=I[1],re=I[2],Ce=I[3],Ve=!1,it=0;it<this.canvasElement.height;it++)for(var Oe=0;Oe<this.canvasElement.width;Oe++)m.data[it*this.canvasElement.width*4+4*Oe+3]>0&&(Ve=!0,it<P&&(P=it),Oe<W&&(W=Oe),it>Ce&&(Ce=it),Oe>re&&(re=Oe));if(Ve){this.left=W/this.pixelRatio,this.top=P/this.pixelRatio,this.width=(re-W)/this.pixelRatio,this.height=(Ce-P)/this.pixelRatio;var ct=document.createElement("canvas");ct.width=re-W,ct.height=Ce-P,ct.getContext("2d").putImageData(this.canvasContext.getImageData(W,P,re-W,Ce-P),0,0),this.drawingImgUrl=ct.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},h.prototype.setDrawingImage=function(){Q.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),Q.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},h.prototype.setColor=function(m){this.color=m,this.colorChanged(m)},h.prototype.setLineWidth=function(m){this.lineWidth=m},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var m=Object.assign({drawingImgUrl:this.drawingImgUrl},M.prototype.getState.call(this));return m.typeName=h.typeName,m},h.prototype.restoreState=function(m){this.createVisual(),M.prototype.restoreState.call(this,m),this.drawingImgUrl=m.drawingImgUrl,this.setDrawingImage()},h.prototype.scale=function(m,I){M.prototype.scale.call(this,m,I),this.setDrawingImage()},h.typeName="FreehandMarker",h.title="Freehand marker",h.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>',h}(Ze),oe=function(M){function h(m,I,W){var P=M.call(this,m,W||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return P.typeBoxes=[],P.currentType=I,P.setCurrentType=P.setCurrentType.bind(P),P}return be(h,M),h.prototype.getUi=function(){var m=this,I=document.createElement("div");I.style.display="flex",I.style.overflow="hidden",I.style.flexGrow="2";for(var W=function(Ce){var Ve="both";switch(Ce){case 0:Ve="both";break;case 1:Ve="start";break;case 2:Ve="end";break;case 3:Ve="none"}var it=document.createElement("div");if(it.style.display="flex",it.style.flexGrow="2",it.style.alignItems="center",it.style.justifyContent="space-between",it.style.padding="5px",it.style.borderWidth="2px",it.style.borderStyle="solid",it.style.borderColor=Ve===P.currentType?P.uiStyleSettings.toolboxAccentColor:"transparent",it.addEventListener("click",function(){m.setCurrentType(Ve,it)}),I.appendChild(it),Ve==="both"||Ve==="start"){var Oe=document.createElement("div");Oe.style.display="flex",Oe.style.alignItems="center",Oe.style.minHeight="20px",Oe.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="`+(P.uiStyleSettings!==void 0?P.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Oe.style.marginLeft="5px",it.appendChild(Oe)}var ct=document.createElement("div");ct.style.display="flex",ct.style.alignItems="center",ct.style.minHeight="20px",ct.style.flexGrow="2";var kt=document.createElement("hr");if(kt.style.minWidth="20px",kt.style.border="0px",kt.style.borderTop="3px solid "+(P.uiStyleSettings!==void 0?P.uiStyleSettings.toolboxColor:"#eeeeee"),kt.style.flexGrow="2",ct.appendChild(kt),it.appendChild(ct),Ve==="both"||Ve==="end"){var Gt=document.createElement("div");Gt.style.display="flex",Gt.style.alignItems="center",Gt.style.minHeight="20px",Gt.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="`+(P.uiStyleSettings!==void 0?P.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Gt.style.marginRight="5px",it.appendChild(Gt)}P.typeBoxes.push(it)},P=this,re=0;re<4;re++)W(re);return I},h.prototype.setCurrentType=function(m,I){var W=this;this.currentType=m,this.typeBoxes.forEach(function(P){P.style.borderColor=P===I?W.uiStyleSettings!==void 0?W.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},h}(Ge),ue=function(M){function h(m,I,W){var P=M.call(this,m,I,W)||this;return P.arrowType="end",P.arrowBaseHeight=10,P.arrowBaseWidth=10,P.getArrowPoints=P.getArrowPoints.bind(P),P.setArrowType=P.setArrowType.bind(P),P.arrowTypePanel=new oe("Arrow type","end"),P.arrowTypePanel.onArrowTypeChanged=P.setArrowType,P}return be(h,M),h.prototype.ownsTarget=function(m){return!(!M.prototype.ownsTarget.call(this,m)&&m!==this.arrow1&&m!==this.arrow2)},h.prototype.getArrowPoints=function(m,I){var W=this.arrowBaseWidth+2*this.strokeWidth,P=this.arrowBaseHeight+2*this.strokeWidth;return m-W/2+","+(I+P/2)+" "+m+","+(I-P/2)+" "+(m+W/2)+","+(I+P/2)},h.prototype.createTips=function(){this.arrow1=Q.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(Q.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=Q.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(Q.createTransform()),this.visual.appendChild(this.arrow2)},h.prototype.pointerDown=function(m,I){M.prototype.pointerDown.call(this,m,I),this.state==="creating"&&this.createTips()},h.prototype.adjustVisual=function(){if(M.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",Q.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),Q.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var m=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),I=this.arrow1.transform.baseVal.getItem(0);I.setRotate(m,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(I,0);var W=this.arrow2.transform.baseVal.getItem(0);W.setRotate(m+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(W,0)}},h.prototype.setArrowType=function(m){this.arrowType=m,this.adjustVisual(),this.stateChanged()},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var m=Object.assign({arrowType:this.arrowType},M.prototype.getState.call(this));return m.typeName=h.typeName,m},h.prototype.restoreState=function(m){M.prototype.restoreState.call(this,m);var I=m;this.arrowType=I.arrowType,this.createTips(),this.adjustVisual()},h.typeName="ArrowMarker",h.title="Arrow marker",h.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',h}(Je),Y=function(M){function h(m,I,W){var P=M.call(this,m,I,W)||this;return P.fillColor=W.defaultFillColor,P.strokeWidth=0,P.fillPanel=new Ue("Color",W.defaultColorSet,W.defaultFillColor),P.fillPanel.onColorChanged=P.setFillColor,P}return be(h,M),Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var m=M.prototype.getState.call(this);return m.typeName=h.typeName,m},h.typeName="CoverMarker",h.title="Cover marker",h.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',h}(Ye),X=function(M){function h(m,I,W,P){var re=M.call(this,m,P||'<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 re.opacities=[],re.opacityBoxes=[],re.opacities=I,re.currentOpacity=W,re.setCurrentOpacity=re.setCurrentOpacity.bind(re),re}return be(h,M),h.prototype.getUi=function(){var m=this,I=document.createElement("div");return I.style.display="flex",I.style.overflow="hidden",I.style.flexGrow="2",I.style.justifyContent="space-between",this.opacities.forEach(function(W){var P=document.createElement("div");P.style.display="flex",P.style.alignItems="center",P.style.justifyContent="center",P.style.padding="5px",P.style.borderWidth="2px",P.style.borderStyle="solid",P.style.borderColor=W===m.currentOpacity?m.uiStyleSettings.toolboxAccentColor:"transparent",P.addEventListener("click",function(){m.setCurrentOpacity(W,P)}),I.appendChild(P);var re=document.createElement("div");re.innerText=100*W+"%",P.appendChild(re),m.opacityBoxes.push(P)}),I},h.prototype.setCurrentOpacity=function(m,I){var W=this;this.currentOpacity=m,this.opacityBoxes.forEach(function(P){P.style.borderColor=P===I?W.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},h}(Ge),Z=function(M){function h(m,I,W){var P=M.call(this,m,I,W)||this;return P.setOpacity=P.setOpacity.bind(P),P.fillColor=W.defaultHighlightColor,P.strokeWidth=0,P.opacity=W.defaultHighlightOpacity,P.fillPanel=new Ue("Color",W.defaultColorSet,P.fillColor),P.fillPanel.onColorChanged=P.setFillColor,P.opacityPanel=new X("Opacity",W.defaultOpacitySteps,P.opacity),P.opacityPanel.onOpacityChanged=P.setOpacity,P}return be(h,M),h.prototype.setOpacity=function(m){this.opacity=m,this.visual&&Q.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var m=M.prototype.getState.call(this);return m.typeName=h.typeName,m},h.typeName="HighlightMarker",h.title="Highlight marker",h.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>',h}(Y),ae='<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>',ve=function(M){function h(m,I,W){var P=M.call(this,m,I,W)||this;return P.bgColor="transparent",P.tipPosition={x:0,y:0},P.tipBase1Position={x:0,y:0},P.tipBase2Position={x:0,y:0},P.tipMoving=!1,P.color=W.defaultStrokeColor,P.bgColor=W.defaultFillColor,P.fontFamily=W.defaultFontFamily,P.defaultSize={x:100,y:30},P.setBgColor=P.setBgColor.bind(P),P.getTipPoints=P.getTipPoints.bind(P),P.positionTip=P.positionTip.bind(P),P.setTipPoints=P.setTipPoints.bind(P),P.colorPanel=new Ue("Text color",W.defaultColorSet,P.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>'),P.colorPanel.onColorChanged=P.setColor,P.bgColorPanel=new Ue("Fill color",W.defaultColorSet,P.bgColor,ae),P.bgColorPanel.onColorChanged=P.setBgColor,P.fontFamilyPanel=new Ee("Font",W.defaultFontFamilies,W.defaultFontFamily),P.fontFamilyPanel.onFontChanged=P.setFont,P.tipGrip=new nt,P.tipGrip.visual.transform.baseVal.appendItem(Q.createTransform()),P.controlBox.appendChild(P.tipGrip.visual),P}return be(h,M),h.prototype.ownsTarget=function(m){return M.prototype.ownsTarget.call(this,m)||this.tipGrip.ownsTarget(m)||this.tip===m},h.prototype.createTip=function(){Q.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=Q.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},h.prototype.pointerDown=function(m,I){this.state==="new"&&M.prototype.pointerDown.call(this,m,I),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(I)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):M.prototype.pointerDown.call(this,m,I)},h.prototype.pointerUp=function(m){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,M.prototype.pointerUp.call(this,m);else{var I=this.state==="creating";M.prototype.pointerUp.call(this,m),this.setTipPoints(I),this.positionTip()}},h.prototype.manipulate=function(m){if(this.tipMoving){var I=this.unrotatePoint(m);this.tipPosition={x:I.x-this.manipulationStartLeft,y:I.y-this.manipulationStartTop},this.positionTip()}else M.prototype.manipulate.call(this,m)},h.prototype.setBgColor=function(m){this.bgRectangle&&this.tip&&(Q.setAttributes(this.bgRectangle,[["fill",m]]),Q.setAttributes(this.tip,[["fill",m]])),this.bgColor=m,this.fillColorChanged(m)},h.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},h.prototype.setTipPoints=function(m){m===void 0&&(m=!1);var I=Math.min(this.height/2,15),W=this.height/5;m&&(this.tipPosition={x:I+W/2,y:this.height+20});var P=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?P<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(W=this.width/5,I=Math.min(this.width/2,15),this.tipBase1Position={x:I,y:0},this.tipBase2Position={x:I+W,y:0}):(this.tipBase1Position={x:0,y:I},this.tipBase2Position={x:0,y:I+W}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?P<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(W=this.width/5,I=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-I-W,y:0},this.tipBase2Position={x:this.width-I,y:0}):(this.tipBase1Position={x:this.width,y:I},this.tipBase2Position={x:this.width,y:I+W}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?P<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(W=this.width/5,I=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-I-W,y:this.height},this.tipBase2Position={x:this.width-I,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-I-W},this.tipBase2Position={x:this.width,y:this.height-I}):P<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(W=this.width/5,I=Math.min(this.width/2,15),this.tipBase1Position={x:I,y:this.height},this.tipBase2Position={x:I+W,y:this.height}):(this.tipBase1Position={x:0,y:this.height-I},this.tipBase2Position={x:0,y:this.height-I-W})},h.prototype.resize=function(m){M.prototype.resize.call(this,m),this.positionTip()},h.prototype.positionTip=function(){Q.setAttributes(this.tip,[["points",this.getTipPoints()]]);var m=this.tipGrip.visual.transform.baseVal.getItem(0);m.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(m,0)},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),h.prototype.select=function(){this.positionTip(),M.prototype.select.call(this)},h.prototype.getState=function(){var m=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},M.prototype.getState.call(this));return m.typeName=h.typeName,m},h.prototype.restoreState=function(m){var I=m;this.bgColor=I.bgColor,this.tipPosition=I.tipPosition,M.prototype.restoreState.call(this,m),this.createTip(),this.setTipPoints()},h.prototype.scale=function(m,I){M.prototype.scale.call(this,m,I),this.tipPosition={x:this.tipPosition.x*m,y:this.tipPosition.y*I},this.positionTip()},h.typeName="CalloutMarker",h.title="Callout marker",h.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>',h}(He),Se=function(M){function h(m,I,W){var P=M.call(this,m,I,W)||this;return P.fillColor="transparent",P.strokeColor="transparent",P.strokeWidth=0,P.strokeDasharray="",P.opacity=1,P.strokeColor=W.defaultColor,P.strokeWidth=W.defaultStrokeWidth,P.strokeDasharray=W.defaultStrokeDasharray,P.fillColor=W.defaultFillColor,P.setStrokeColor=P.setStrokeColor.bind(P),P.setFillColor=P.setFillColor.bind(P),P.setStrokeWidth=P.setStrokeWidth.bind(P),P.setStrokeDasharray=P.setStrokeDasharray.bind(P),P.setOpacity=P.setOpacity.bind(P),P.createVisual=P.createVisual.bind(P),P.strokePanel=new Ue("Line color",ge(W.defaultColorSet,["transparent"]),W.defaultColor),P.strokePanel.onColorChanged=P.setStrokeColor,P.fillPanel=new Ue("Fill color",ge(W.defaultColorSet,["transparent"]),P.fillColor,ae),P.fillPanel.onColorChanged=P.setFillColor,P.strokeWidthPanel=new at("Line width",W.defaultStrokeWidths,W.defaultStrokeWidth),P.strokeWidthPanel.onWidthChanged=P.setStrokeWidth,P.strokeStylePanel=new qe("Line style",W.defaultStrokeDasharrays,W.defaultStrokeDasharray),P.strokeStylePanel.onStyleChanged=P.setStrokeDasharray,P.opacityPanel=new X("Opacity",W.defaultOpacitySteps,P.opacity),P.opacityPanel.onOpacityChanged=P.setOpacity,P}return be(h,M),h.prototype.ownsTarget=function(m){return!(!M.prototype.ownsTarget.call(this,m)&&m!==this.visual)},h.prototype.createVisual=function(){this.visual=Q.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)},h.prototype.pointerDown=function(m,I){M.prototype.pointerDown.call(this,m,I),this.state==="new"&&(this.createVisual(),this.moveVisual(m),this._state="creating")},h.prototype.manipulate=function(m){M.prototype.manipulate.call(this,m)},h.prototype.resize=function(m){M.prototype.resize.call(this,m),this.setSize()},h.prototype.setSize=function(){M.prototype.setSize.call(this),Q.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},h.prototype.pointerUp=function(m){M.prototype.pointerUp.call(this,m),this.setSize()},h.prototype.setStrokeColor=function(m){this.strokeColor=m,this.visual&&Q.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(m),this.stateChanged()},h.prototype.setFillColor=function(m){this.fillColor=m,this.visual&&Q.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(m),this.stateChanged()},h.prototype.setStrokeWidth=function(m){this.strokeWidth=m,this.visual&&Q.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},h.prototype.setStrokeDasharray=function(m){this.strokeDasharray=m,this.visual&&Q.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},h.prototype.setOpacity=function(m){this.opacity=m,this.visual&&Q.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var m=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},M.prototype.getState.call(this));return m.typeName=h.typeName,m},h.prototype.restoreState=function(m){var I=m;this.fillColor=I.fillColor,this.strokeColor=I.strokeColor,this.strokeWidth=I.strokeWidth,this.strokeDasharray=I.strokeDasharray,this.opacity=I.opacity,this.createVisual(),M.prototype.restoreState.call(this,m),this.setSize()},h.prototype.scale=function(m,I){M.prototype.scale.call(this,m,I),this.setSize()},h.typeName="EllipseMarker",h.title="Ellipse marker",h.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>',h}(Ze),Ne=function(M){function h(m,I,W){return M.call(this,m,I,W)||this}return be(h,M),Object.defineProperty(h.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),h.prototype.ownsTarget=function(m){return!(!M.prototype.ownsTarget.call(this,m)&&m!==this.tip1&&m!==this.tip2)},h.prototype.createTips=function(){this.tip1=Q.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(Q.createTransform()),this.visual.appendChild(this.tip1),this.tip2=Q.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(Q.createTransform()),this.visual.appendChild(this.tip2)},h.prototype.pointerDown=function(m,I){M.prototype.pointerDown.call(this,m,I),this.state==="creating"&&this.createTips()},h.prototype.adjustVisual=function(){if(M.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(Q.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()]]),Q.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 m=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),I=this.tip1.transform.baseVal.getItem(0);I.setRotate(m,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(I,0);var W=this.tip2.transform.baseVal.getItem(0);W.setRotate(m+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(W,0)}},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var m=M.prototype.getState.call(this);return m.typeName=h.typeName,m},h.prototype.restoreState=function(m){M.prototype.restoreState.call(this,m),this.createTips(),this.adjustVisual()},h.typeName="MeasurementMarker",h.title="Measurement marker",h.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>',h}(Je),st=function(M){function h(m,I,W){var P=M.call(this,m,I,W)||this;return P.strokePanel.colors=W.defaultColorSet,P.fillColor="transparent",P}return be(h,M),Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var m=M.prototype.getState.call(this);return m.typeName=h.typeName,m},h.typeName="EllipseFrameMarker",h.title="Ellipse frame marker",h.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>',h}(Se),dt=function(){function M(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(M.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),M.prototype.addUndoStep=function(h){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(h)||(this.undoStack.push(h),JSON.stringify(this.lastRedoStep)!==JSON.stringify(h)&&this.redoStack.splice(0,this.redoStack.length))},M.prototype.replaceLastUndoStep=function(h){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=h)},M.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},M.prototype.undo=function(){if(this.undoStack.length>1){var h=this.undoStack.pop();return h!==void 0&&this.redoStack.push(h),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},M.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},M}(),ut=function(M){function h(m,I,W){var P=M.call(this,m,I,W)||this;return P.strokeColor="transparent",P.strokeWidth=0,P.strokeDasharray="",P.curveX=0,P.curveY=0,P.manipulationStartCurveX=0,P.manipulationStartCurveY=0,P.setStrokeColor=P.setStrokeColor.bind(P),P.setStrokeWidth=P.setStrokeWidth.bind(P),P.setStrokeDasharray=P.setStrokeDasharray.bind(P),P.positionGrips=P.positionGrips.bind(P),P.addControlGrips=P.addControlGrips.bind(P),P.adjustVisual=P.adjustVisual.bind(P),P.setupControlBox=P.setupControlBox.bind(P),P.resize=P.resize.bind(P),P.strokeColor=W.defaultColor,P.strokeWidth=W.defaultStrokeWidth,P.strokeDasharray=W.defaultStrokeDasharray,P.strokePanel=new Ue("Line color",W.defaultColorSet,W.defaultColor),P.strokePanel.onColorChanged=P.setStrokeColor,P.strokeWidthPanel=new at("Line width",W.defaultStrokeWidths,W.defaultStrokeWidth),P.strokeWidthPanel.onWidthChanged=P.setStrokeWidth,P.strokeStylePanel=new qe("Line style",W.defaultStrokeDasharrays,W.defaultStrokeDasharray),P.strokeStylePanel.onStyleChanged=P.setStrokeDasharray,P}return be(h,M),h.prototype.ownsTarget=function(m){return!(!M.prototype.ownsTarget.call(this,m)&&m!==this.visual&&m!==this.selectorCurve&&m!==this.visibleCurve&&!this.curveGrip.ownsTarget(m))},h.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},h.prototype.createVisual=function(){this.visual=Q.createGroup(),this.selectorCurve=Q.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=Q.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)},h.prototype.pointerDown=function(m,I){M.prototype.pointerDown.call(this,m,I),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=m.x,this.curveY=m.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(I)&&(this.activeGrip=this.curveGrip,this._state="resize")},h.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),Q.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),Q.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),Q.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},h.prototype.setupControlBox=function(){M.prototype.setupControlBox.call(this),this.curveControlLine1=Q.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=Q.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)},h.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,M.prototype.addControlGrips.call(this)},h.prototype.positionGrips=function(){M.prototype.positionGrips.call(this);var m=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-m/2,this.curveY-m/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()))},h.prototype.manipulate=function(m){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+m.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+m.y-this.manipulationStartY),M.prototype.manipulate.call(this,m)},h.prototype.resize=function(m){this.activeGrip===this.curveGrip&&(this.curveX=m.x,this.curveY=m.y),M.prototype.resize.call(this,m),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},h.prototype.setStrokeColor=function(m){this.strokeColor=m,this.adjustVisual(),this.colorChanged(m)},h.prototype.setStrokeWidth=function(m){this.strokeWidth=m,this.adjustVisual()},h.prototype.setStrokeDasharray=function(m){this.strokeDasharray=m,this.adjustVisual()},h.prototype.scale=function(m,I){this.curveX=this.curveX*m,this.curveY=this.curveY*I,M.prototype.scale.call(this,m,I)},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var m=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},M.prototype.getState.call(this));return m.typeName=h.typeName,m},h.prototype.restoreState=function(m){M.prototype.restoreState.call(this,m);var I=m;this.strokeColor=I.strokeColor,this.strokeWidth=I.strokeWidth,this.strokeDasharray=I.strokeDasharray,this.curveX=I.curveX,this.curveY=I.curveY,this.createVisual(),this.adjustVisual()},h.typeName="CurveMarker",h.title="Curve marker",h.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>',h}(rt),wt=function(){function M(h,m){m===void 0&&(m=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=h,this.cancelable=m}return Object.defineProperty(M.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),M.prototype.preventDefault=function(){this._defaultPrevented=!0},M}(),Et=function(M){function h(m,I,W){var P=M.call(this,m,!1)||this;return P.dataUrl=I,P.state=W,P}return be(h,M),h}(wt),et=function(M){function h(m,I,W){W===void 0&&(W=!1);var P=M.call(this,m,W)||this;return P.marker=I,P}return be(h,M),h}(wt),Vt=function(){function M(){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 M.prototype.addEventListener=function(h,m){this[h].push(m)},M.prototype.removeEventListener=function(h,m){var I=this[h].indexOf(m);I>-1&&this[h].splice(I,1)},M}(),Ft=function(){function M(h){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 Vt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=M.instanceCounter++,this.styles=new Me(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=h,this.targetRoot=document.body,this.width=h.clientWidth,this.height=h.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(M.prototype,"ALL_MARKER_TYPES",{get:function(){return[Xe,de,ue,He,st,Se,Z,ve,Ne,Y,Je,ut]},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[Xe,de,ue,He,Se,Z,ve]},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"BASIC_MARKER_TYPES",{get:function(){return[Xe,de,ue,He,Z]},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(h){var m=this;this._availableMarkerTypes.splice(0),h.forEach(function(I){if(typeof I=="string"){var W=m.ALL_MARKER_TYPES.find(function(P){return P.typeName===I});W!==void 0&&m._availableMarkerTypes.push(W)}else m._availableMarkerTypes.push(I)})},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(h){this._zoomLevel=h,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(M.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),M.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),Pe.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},M.prototype.show=function(){var h=this;this.styles.styleSheetRoot===void 0&&Fe.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=Fe.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(m){return m(new wt(h))})},M.prototype.render=function(){return we(this,void 0,void 0,function(){var h;return Re(this,function(m){switch(m.label){case 0:return this.setCurrentMarker(),(h=new $e).naturalSize=this.renderAtNaturalSize,h.imageType=this.renderImageType,h.imageQuality=this.renderImageQuality,h.markersOnly=this.renderMarkersOnly,h.width=this.renderWidth,h.height=this.renderHeight,[4,h.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return m.sent(),[4,h.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,m.sent()]}})})},M.prototype.close=function(h){var m=this;if(h===void 0&&(h=!1),this.isOpen){var I=!1;h||this.eventListeners.beforeclose.forEach(function(W){var P=new wt(m,!0);W(P),P.defaultPrevented&&(I=!0)}),I||(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(W){return W(new wt(m))}),this.detachEvents(),this._isOpen=!1)}},M.prototype.addMarkersToToolbar=function(){for(var h,m=[],I=0;I<arguments.length;I++)m[I]=arguments[I];(h=this._availableMarkerTypes).push.apply(h,m)},M.prototype.addRenderEventListener=function(h){this.addEventListener("render",function(m){h(m.dataUrl,m.state)})},M.prototype.removeRenderEventListener=function(h){},M.prototype.addCloseEventListener=function(h){this.addEventListener("close",function(){h()})},M.prototype.removeCloseEventListener=function(h){},M.prototype.setupResizeObserver=function(){var h=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){h.resize(h.target.clientWidth,h.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return h.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},M.prototype.onPopupTargetResize=function(){var h=1*this.target.clientWidth/this.target.clientHeight,m=this.editorCanvas.clientWidth/h>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*h:this.editorCanvas.clientWidth,I=m<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/h;this.resize(m,I)},M.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},M.prototype.resize=function(h,m){this._isResizing=!0;var I=h/this.imageWidth,W=m/this.imageHeight;this.imageWidth=Math.round(h),this.imageHeight=Math.round(m),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(I,W),this._isResizing=!1},M.prototype.scaleMarkers=function(h,m){var I,W=this;this._currentMarker&&this._currentMarker instanceof He?this._currentMarker.scale(h,m):(I=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(P){P!==W._currentMarker&&P.scale(h,m)}),I!==void 0&&this.setCurrentMarker(I)},M.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"},M.prototype.setTopLeft=function(){var h=this.editingTarget.getBoundingClientRect(),m=this.editorCanvas.getBoundingClientRect();this.left=h.left-m.left,this.top=h.top-m.top},M.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)},M.prototype.addDefs=function(){for(var h,m=[],I=0;I<arguments.length;I++)m[I]=arguments[I];this.defs=Q.createDefs(),this.addDefsToImage(),(h=this.defs).append.apply(h,m)},M.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},M.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)},M.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},M.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},M.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)},M.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},M.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)},M.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 h=document.createElement("a");h.href="https://markerjs.com/",h.target="_blank",h.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>',h.title="Powered by marker.js",h.style.display="grid",h.style.alignItems="center",h.style.justifyItems="center",h.style.padding="3px",h.style.width="20px",h.style.height="20px",this.logoUI.appendChild(h),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},M.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")},M.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"},M.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},M.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 h=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=h+"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 ke(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 je(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},M.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},M.prototype.removeMarker=function(h){this.markerImage.removeChild(h.container),this.markers.indexOf(h)>-1&&this.markers.splice(this.markers.indexOf(h),1),h.dispose()},M.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())},M.prototype.toolbarButtonClicked=function(h,m){if(h==="marker"&&m!==void 0)this.createNewMarker(m);else if(h==="action")switch(m){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()}},M.prototype.deleteSelectedMarker=function(){var h=this;if(this._currentMarker!==void 0){var m=!1;if(this.eventListeners.markerbeforedelete.forEach(function(W){var P=new et(h,h._currentMarker,!0);W(P),P.defaultPrevented&&(m=!0)}),!m){var I=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(W){return W(new et(h,I))})}}},M.prototype.clear=function(){var h=this,m=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(re){var Ce=new et(h,void 0,!0);re(Ce),Ce.defaultPrevented&&(m=!0)}),!m)){this.setCurrentMarker();for(var I=function(re){var Ce=W.markers[re];W.setCurrentMarker(W.markers[re]),W._currentMarker.dispose(),W.markerImage.removeChild(W._currentMarker.container),W.markers.splice(W.markers.indexOf(W._currentMarker),1),W.eventListeners.markerdelete.forEach(function(Ve){return Ve(new et(h,Ce))})},W=this,P=this.markers.length-1;P>=0;P--)I(P);this.addUndoStep()}},Object.defineProperty(M.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),M.prototype.showNotesEditor=function(){var h;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=(h=this._currentMarker.notes)!==null&&h!==void 0?h:"",this.overlayContainer.appendChild(this.notesArea))},M.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)},M.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},M.prototype.addUndoStep=function(){var h=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var m=this.getState(),I=this.undoRedoManager.getLastUndoStep();if(!I||I.width===m.width&&I.height===m.height){var W=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(m),W<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(P){return P(new wt(h))})}else this.undoRedoManager.replaceLastUndoStep(m),this.eventListeners.statechange.forEach(function(P){return P(new wt(h))})}},M.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},M.prototype.undoStep=function(){var h=this,m=this.undoRedoManager.undo();m!==void 0&&(this.restoreState(m),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(I){return I(new wt(h))}))},M.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},M.prototype.redoStep=function(){var h=this,m=this.undoRedoManager.redo();m!==void 0&&(this.restoreState(m),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(I){return I(new wt(h))}))},M.prototype.stepZoom=function(){var h=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=h<this.zoomSteps.length-1?this.zoomSteps[h+1]:this.zoomSteps[0]},M.prototype.panTo=function(h){this.contentDiv.scrollBy({left:this.prevPanPoint.x-h.x,top:this.prevPanPoint.y-h.y}),this.prevPanPoint=h},M.prototype.startRenderAndClose=function(){return we(this,void 0,void 0,function(){var h,m,I=this;return Re(this,function(W){switch(W.label){case 0:return[4,this.render()];case 1:return h=W.sent(),m=this.getState(),this.eventListeners.render.forEach(function(P){return P(new Et(I,h,m))}),this.close(!0),[2]}})})},M.prototype.getState=function(h){h===!0&&this.setCurrentMarker();var m={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(I){return m.markers.push(I.getState())}),m},M.prototype.restoreState=function(h){var m=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);h.markers.forEach(function(I){var W=m._availableMarkerTypes.find(function(re){return re.typeName===I.typeName});if(W!==void 0){var P=m.addNewMarker(W);P.restoreState(I),m.markers.push(P)}}),h.width&&h.height&&(h.width!==this.imageWidth||h.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/h.width,this.imageHeight/h.height),this.eventListeners.restorestate.forEach(function(I){return I(new wt(m))})},M.prototype.addNewMarker=function(h){var m=Q.createGroup();return this.markerImage.appendChild(m),new h(m,this.overlayContainer,this.settings)},M.prototype.createNewMarker=function(h){var m,I=this;(m=typeof h=="string"?this._availableMarkerTypes.find(function(W){return W.typeName===h}):h)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(m),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(m.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(W){return W(new et(I,I._currentMarker))}))},M.prototype.markerCreated=function(h){var m=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(h),this.setCurrentMarker(h),h instanceof de&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(de):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(I){return I(new et(m,m._currentMarker))})},M.prototype.colorChanged=function(h){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=h,this.settings.defaultStrokeColor=h)},M.prototype.fillColorChanged=function(h){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=h)},M.prototype.markerStateChanged=function(h){var m=this;this.eventListeners.markerchange.forEach(function(I){return I(new et(m,h))})},M.prototype.setCurrentMarker=function(h){var m=this;this._currentMarker!==h&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(I){return I(new et(m,m._currentMarker))})),this._currentMarker=h,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(I){return I(new et(m,m._currentMarker))}))},M.prototype.onPointerDown=function(h){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||h.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var m=this.markers.find(function(I){return I.ownsTarget(h.target)});m!==void 0?(this.setCurrentMarker(m),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(h.clientX,h.clientY),h.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:h.clientX,y:h.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(h.clientX,h.clientY))},M.prototype.onDblClick=function(h){if(this._isFocused||this.focus(),this.mode==="select"){var m=this.markers.find(function(I){return I.ownsTarget(h.target)});m!==void 0&&m!==this._currentMarker&&this.setCurrentMarker(m),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(h.clientX,h.clientY),h.target):this.setCurrentMarker()}},M.prototype.onPointerMove=function(h){this.touchPoints!==1&&h.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||h.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(h.clientX,h.clientY)):this.zoomLevel>1&&this.panTo({x:h.clientX,y:h.clientY}))},M.prototype.onPointerUp=function(h){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(h.clientX,h.clientY)),this.isDragging=!1,this.addUndoStep()},M.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},M.prototype.onKeyUp=function(h){this._currentMarker===void 0||this.notesArea!==void 0||h.key!=="Delete"&&h.key!=="Backspace"||this.deleteSelectedMarker()},M.prototype.clientToLocalCoordinates=function(h,m){var I=this.markerImage.getBoundingClientRect();return{x:(h-I.left)/this.zoomLevel,y:(m-I.top)/this.zoomLevel}},M.prototype.onWindowResize=function(){this.positionUI()},M.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var h=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=h+"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()},M.prototype.addLicenseKey=function(h){Pe.addKey(h)},M.prototype.addEventListener=function(h,m){this.eventListeners.addEventListener(h,m)},M.prototype.removeEventListener=function(h,m){this.eventListeners.removeEventListener(h,m)},M.prototype.renderState=function(h){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(h),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(M.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),M.prototype.focus=function(){var h=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(m){return m(new wt(h))}))},M.prototype.blur=function(){var h=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(m){return m(new wt(h))}))},M.instanceCounter=0,M}();/* **********************************
|
|
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 Zt=function(M,h){return(Zt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,I){m.__proto__=I}||function(m,I){for(var W in I)Object.prototype.hasOwnProperty.call(I,W)&&(m[W]=I[W])})(M,h)};function Xt(M,h){if(typeof h!="function"&&h!==null)throw new TypeError("Class extends value "+String(h)+" is not a constructor or null");function m(){this.constructor=M}Zt(M,h),M.prototype=h===null?Object.create(h):(m.prototype=h.prototype,new m)}function gt(M,h,m,I){return new(m||(m=Promise))(function(W,P){function re(it){try{Ve(I.next(it))}catch(Oe){P(Oe)}}function Ce(it){try{Ve(I.throw(it))}catch(Oe){P(Oe)}}function Ve(it){var Oe;it.done?W(it.value):(Oe=it.value,Oe instanceof m?Oe:new m(function(ct){ct(Oe)})).then(re,Ce)}Ve((I=I.apply(M,h||[])).next())})}function ei(M,h){var m,I,W,P,re={label:0,sent:function(){if(1&W[0])throw W[1];return W[1]},trys:[],ops:[]};return P={next:Ce(0),throw:Ce(1),return:Ce(2)},typeof Symbol=="function"&&(P[Symbol.iterator]=function(){return this}),P;function Ce(Ve){return function(it){return function(Oe){if(m)throw new TypeError("Generator is already executing.");for(;re;)try{if(m=1,I&&(W=2&Oe[0]?I.return:Oe[0]?I.throw||((W=I.return)&&W.call(I),0):I.next)&&!(W=W.call(I,Oe[1])).done)return W;switch(I=0,W&&(Oe=[2&Oe[0],W.value]),Oe[0]){case 0:case 1:W=Oe;break;case 4:return re.label++,{value:Oe[1],done:!1};case 5:re.label++,I=Oe[1],Oe=[0];continue;case 7:Oe=re.ops.pop(),re.trys.pop();continue;default:if(!(W=re.trys,(W=W.length>0&&W[W.length-1])||Oe[0]!==6&&Oe[0]!==2)){re=0;continue}if(Oe[0]===3&&(!W||Oe[1]>W[0]&&Oe[1]<W[3])){re.label=Oe[1];break}if(Oe[0]===6&&re.label<W[1]){re.label=W[1],W=Oe;break}if(W&&re.label<W[2]){re.label=W[2],re.ops.push(Oe);break}W[2]&&re.ops.pop(),re.trys.pop();continue}Oe=h.call(M,re)}catch(ct){Oe=[6,ct],I=0}finally{m=W=0}if(5&Oe[0])throw Oe[1];return{value:Oe[0]?Oe[1]:void 0,done:!0}}([Ve,it])}}}var pi=function(){function M(){}return M.addKey=function(h){M.key=h},Object.defineProperty(M,"isLicensed",{get:function(){return!!M.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(M.key)},enumerable:!1,configurable:!0}),M}(),We=function(){function M(){}return M.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},M.setAttributes=function(h,m){for(var I=0,W=m;I<W.length;I++){var P=W[I],re=P[0],Ce=P[1];h.setAttribute(re,Ce)}},M.createRect=function(h,m,I){var W=document.createElementNS("http://www.w3.org/2000/svg","rect");return W.setAttribute("width",h.toString()),W.setAttribute("height",m.toString()),I&&M.setAttributes(W,I),W},M.createLine=function(h,m,I,W,P){var re=document.createElementNS("http://www.w3.org/2000/svg","line");return re.setAttribute("x1",h.toString()),re.setAttribute("y1",m.toString()),re.setAttribute("x2",I.toString()),re.setAttribute("y2",W.toString()),P&&M.setAttributes(re,P),re},M.createPolygon=function(h,m){var I=document.createElementNS("http://www.w3.org/2000/svg","polygon");return I.setAttribute("points",h),m&&M.setAttributes(I,m),I},M.createCircle=function(h,m){var I=document.createElementNS("http://www.w3.org/2000/svg","circle");return I.setAttribute("cx",(h/2).toString()),I.setAttribute("cy",(h/2).toString()),I.setAttribute("r",h.toString()),m&&M.setAttributes(I,m),I},M.createEllipse=function(h,m,I){var W=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return W.setAttribute("cx",(h/2).toString()),W.setAttribute("cy",(m/2).toString()),W.setAttribute("rx",(h/2).toString()),W.setAttribute("ry",(m/2).toString()),I&&M.setAttributes(W,I),W},M.createGroup=function(h){var m=document.createElementNS("http://www.w3.org/2000/svg","g");return h&&M.setAttributes(m,h),m},M.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},M.createMarker=function(h,m,I,W,P,re,Ce){var Ve=document.createElementNS("http://www.w3.org/2000/svg","marker");return M.setAttributes(Ve,[["id",h],["orient",m],["markerWidth",I.toString()],["markerHeight",W.toString()],["refX",P.toString()],["refY",re.toString()]]),Ve.appendChild(Ce),Ve},M.createText=function(h){var m=document.createElementNS("http://www.w3.org/2000/svg","text");return m.setAttribute("x","0"),m.setAttribute("y","0"),h&&M.setAttributes(m,h),m},M.createTSpan=function(h,m){var I=document.createElementNS("http://www.w3.org/2000/svg","tspan");return I.textContent=h,m&&M.setAttributes(I,m),I},M.createImage=function(h){var m=document.createElementNS("http://www.w3.org/2000/svg","image");return h&&M.setAttributes(m,h),m},M.createPoint=function(h,m){var I=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return I.x=h,I.y=m,I},M.createPath=function(h,m){var I=document.createElementNS("http://www.w3.org/2000/svg","path");return I.setAttribute("d",h),m&&M.setAttributes(I,m),I},M.createElement=function(h,m){var I=document.createElementNS("http://www.w3.org/2000/svg",h);return m&&M.setAttributes(I,m),I},M.getHollowRectanglePath=function(h,m,I,W,P,re,Ce,Ve){return"M"+h+","+m+"V"+(m+W)+"H"+(h+I)+"V"+m+"H"+P+"V"+re+"H"+(P+Ce)+"V"+(re+Ve)+"H"+P+"V"+m+"Z"},M}(),pt=function(){function M(h){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+h+"_"}return Object.defineProperty(M.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(M.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(M.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),M.prototype.addClass=function(h){return this.styleSheet===void 0&&this.addStyleSheet(),h.name=""+this.classNamePrefix+h.localName,this.classes.push(h),this.styleSheet.sheet.insertRule("."+h.name+" {"+h.style+"}",this.styleSheet.sheet.cssRules.length),h},M.prototype.addRule=function(h){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(h),this.styleSheet.sheet.insertRule(h.selector+" {"+h.style+"}",this.styleSheet.sheet.cssRules.length)},M.prototype.addStyleSheet=function(){var h;this.styleSheet=document.createElement("style"),((h=this.styleSheetRoot)!==null&&h!==void 0?h:document.head).appendChild(this.styleSheet),this.addRule(new It("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new It("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new It("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new Tt("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new Tt("_fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},M.prototype.removeStyleSheet=function(){var h;this.styleSheet&&(((h=this.styleSheetRoot)!==null&&h!==void 0?h:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},M}(),It=function(M,h){this.selector=M,this.style=h},Tt=function(M,h){this.localName=M,this.style=h},di=function(){function M(){this.blocks=[],this.display=""}return M.prototype.addButtonBlock=function(h){h.className=this.blockClassName,h.buttonClassName=this.buttonClassName,h.buttonColorsClassName=this.buttonColorsClassName,h.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(h)},M.prototype.addElementBlock=function(h){h.className===void 0&&(h.className=this.blockClassName),this.blocks.push(h)},M.prototype.getUI=function(){var h=document.createElement("div");return h.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,h.style.display=this.display,this.blocks.forEach(function(m){return h.appendChild(m.getUI())}),h},M}(),Ri=function(){function M(){}return M.prototype.getUI=function(){var h=document.createElement("div");if(h.className=this.className,this.minWidth!==void 0&&(h.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":h.style.justifyContent="flex-start";break;case"center":h.style.justifyContent="center";break;case"end":h.style.justifyContent="flex-end"}return h.style.whiteSpace="nowrap",h},M}(),Ai=function(M){function h(){var m=M!==null&&M.apply(this,arguments)||this;return m.buttons=[],m}return Xt(h,M),h.prototype.addButton=function(m){m.className=this.buttonClassName,m.colorsClassName=this.buttonColorsClassName,m.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(m)},h.prototype.getUI=function(){var m=M.prototype.getUI.call(this);return this.buttons.forEach(function(I){return m.appendChild(I.getUI())}),m},h}(Ri),vi=function(){function M(h,m){this._isActive=!1,this._isHidden=!1,this._icon=h,this.title=m,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(M.prototype,"icon",{get:function(){return this._icon},set:function(h){this._icon=h,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"isActive",{get:function(){return this._isActive},set:function(h){this._isActive=h,this.adjustClassName()},enumerable:!1,configurable:!0}),M.prototype.getUI=function(){var h=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 h.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},M.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,"")))},M.prototype.hide=function(){this._isHidden=!0},M}(),zi=function(M){function h(){var m=M!==null&&M.apply(this,arguments)||this;return m.elements=[],m}return Xt(h,M),h.prototype.addElement=function(m){this.elements.push(m)},h.prototype.getUI=function(){var m=M.prototype.getUI.call(this);return this.elements.forEach(function(I){return m.appendChild(I)}),m},h}(Ri),sn=function(){function M(h,m){this.horizontal=h,this.vertical=m}return Object.defineProperty(M.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),M.prototype.getVerticalLength=function(h){return h/this.ratio},M.prototype.getHorizontalLength=function(h){return h*this.ratio},M}(),Vi=function(){function M(){}return M.getIcon=function(h,m){if(h>0&&m>0){var I=new sn(h,m),W=I.ratio>=1?20:I.getHorizontalLength(20),P=I.ratio<1?20:I.getVerticalLength(20),re=document.createElementNS("http://www.w3.org/2000/svg","svg");re.setAttribute("xmlns","http://www.w3.org/2000/svg"),re.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(re);var Ce=We.createDefs();re.appendChild(Ce);var Ve=We.createElement("clipPath",[["id","text-bg-clip"]]);Ce.appendChild(Ve);var it=We.createPath(We.getHollowRectanglePath((24-W)/2,(24-P)/2,W,P,(24-W)/2+2,(24-P)/2+2,W-4,P-4));re.appendChild(it);var Oe=We.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Oe.appendChild(We.createTSpan(h+":"+m)),re.appendChild(Oe);var ct=Oe.getBBox();We.setAttributes(Oe,[["x",((24-ct.width)/2).toString()],["y",((24-ct.height)/2-ct.y).toString()]]);var kt=We.createPath(We.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(ct.width))/2,(24-Math.ceil(ct.height))/2,Math.ceil(ct.width),Math.ceil(ct.height)));return Ve.appendChild(kt),We.setAttributes(it,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(re),re.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>'},M}(),mn=function(M){function h(m,I,W){var P=M.call(this,m,I)||this;return P.isDropdownOpen=!1,P.onClick=P.dropdownButtonClicked,P.dropdownButtons=W,P}return Xt(h,M),h.prototype.setupDropdown=function(){var m=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(I){I.className=m.className,I.colorsClassName=m.colorsClassName,m.dropdownBlock.appendChild(I.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},h.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},h.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},h.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},h.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},h.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},h}(vi),Mi=function(){function M(h,m){this.GRIP_SIZE=10,this.color=h,this.fillColor=m,this.visual=We.createGroup(),this.visual.appendChild(We.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(We.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return M.prototype.ownsTarget=function(h){return h===this.visual||h===this.visual.childNodes[0]||h===this.visual.childNodes[1]},M.prototype.setCenter=function(h,m){this.visual.childNodes.forEach(function(I){return We.setAttributes(I,[["cx",h.toString()],["cy",m.toString()]])})},M}(),gn=function(){function M(h,m,I,W){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=h,this.canvasHeight=m,this.margin=I,this.container=W,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(M.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(h){this._aspectRatio=h,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(h){this._isGridVisible=h,this.gridContainer&&We.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(h){this._zoomFactor=h,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),M.prototype.open=function(){var h=this;this.cropShadeElement=We.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=We.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var m=0;m<this.numberOfGridLines;m++)this.horizontalGridLines.push(We.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(We.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(I){return h.gridContainer.appendChild(I)}),this.verticalGridLines.forEach(function(I){return h.gridContainer.appendChild(I)}),this.cropRectElement=We.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Mi(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Mi(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Mi(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Mi(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},M.prototype.setCropRectangle=function(h){this.cropRect=h;var m=Object.assign({},this.cropRect);this.zoomFactor!==1&&(m.width=this.cropRect.width*this.zoomFactor,m.height=this.cropRect.height*this.zoomFactor,m.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-m.width/2,m.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-m.height/2),We.setAttributes(this.cropRectElement,[["x",m.x.toString()],["y",m.y.toString()],["width",m.width.toString()],["height",m.height.toString()]]);var I=m.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(P,re){var Ce=m.y+I*(re+1);We.setAttributes(P,[["x1",""+m.x],["y1",""+Ce],["x2",""+(m.x+m.width)],["y2",""+Ce]])});var W=m.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(P,re){var Ce=m.x+W*(re+1);We.setAttributes(P,[["x1",""+Ce],["y1",""+m.y],["x2",""+Ce],["y2",""+(m.y+m.height)]])}),We.setAttributes(this.cropShadeElement,[["d",We.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,m.x,m.y,m.width,m.height)]]),this.topLeftGrip.setCenter(m.x,m.y),this.topRightGrip.setCenter(m.x+m.width,m.y),this.bottomLeftGrip.setCenter(m.x,m.y+m.height),this.bottomRightGrip.setCenter(m.x+m.width,m.y+m.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},M.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)},M.prototype.clientToLocalCoordinates=function(h,m){var I=this.container.getBoundingClientRect();return{x:h-I.left+this.margin,y:m-I.top+this.margin}},M.prototype.onPointerDown=function(h){this.container.setPointerCapture(h.pointerId),this.previousPoint=this.clientToLocalCoordinates(h.clientX,h.clientY),this.cropRectElement===h.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(h.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(h.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(h.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(h.target)&&(this.activeGrip=this.bottomRightGrip)},M.prototype.onPointerMove=function(h){if(this.isMoving)this.move(this.clientToLocalCoordinates(h.clientX,h.clientY));else if(this.activeGrip){var m=this.clientToLocalCoordinates(h.clientX,h.clientY);this.resize(m)}h.preventDefault()},M.prototype.onPointerUp=function(h){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(h.pointerId)},M.prototype.move=function(h){var m=h.x-this.previousPoint.x,I=h.y-this.previousPoint.y;this.zoomFactor!==1&&(m=-m/this.zoomFactor,I=-I/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+m),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+I),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=h},M.prototype.resize=function(h){var m=Object.assign({},this.cropRect),I=h.x-this.previousPoint.x,W=h.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:m.x+I<this.margin&&(I=this.margin-m.x),m.x+=I,m.width=this.cropRect.x+this.cropRect.width-m.x;break;case this.bottomRightGrip:case this.topRightGrip:m.width+I>this.canvasWidth*this.zoomFactor&&(I=this.canvasWidth*this.zoomFactor-m.width),m.width+=I}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(m.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(I),m.height=this.aspectRatio.getVerticalLength(m.width)):(m.y+=W,m.height=this.cropRect.y+this.cropRect.height-m.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?m.height=this.aspectRatio.getVerticalLength(m.width):m.height+=W}m.width<10&&(m.x=this.cropRect.x,m.width=10),m.height<10&&(m.y=this.cropRect.y,m.height=10),this.previousPoint=h,m.x>=this.margin&&m.y>=this.margin&&m.x-this.margin+m.width<=this.canvasWidth&&m.y-this.margin+m.height<=this.canvasHeight&&(this.cropRect=m,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},M.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var h=this.cropRect.x+this.cropRect.width/2,m=this.cropRect.y+this.cropRect.height/2,I=this.aspectRatio.getHorizontalLength(this.cropRect.height),W=this.aspectRatio.getVerticalLength(this.cropRect.width);I/this.canvasWidth<W/this.canvasHeight?this.cropRect.width=I:this.cropRect.height=W,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=h-this.cropRect.width/2,this.cropRect.y=m-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)}},M.prototype.getRescaledRect=function(h,m,I,W,P,re){var Ce=I/h,Ve=W/m;return{x:(P.x-re)*Ce+re,y:(P.y-re)*Ve+re,width:P.width*Ce,height:P.height*Ve}},M.prototype.scaleCanvas=function(h,m){var I=this.getRescaledRect(this.canvasWidth,this.canvasHeight,h,m,this.cropRect,this.margin);this.canvasWidth=h,this.canvasHeight=m,this.onCropChange&&this.onCropChange(I),this.setCropRectangle(I)},M}(),vn=function(){function M(h){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=h,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(M.prototype,"angle",{get:function(){return this._angle},set:function(h){this._angle=h,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),M.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},M.prototype.onPointerDown=function(h){this.controlContainer.setPointerCapture(h.pointerId),this.isDragging=!0,this.previousPoint={x:h.clientX,y:h.clientY}},M.prototype.onPointerMove=function(h){this.isDragging&&(this.onAngleChange&&this.onAngleChange((h.clientX-this.previousPoint.x)/5),this.previousPoint.x=h.clientX)},M.prototype.onPointerUp=function(h){this.isDragging&&this.onAngleChange&&this.onAngleChange((h.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(h.pointerId)},M.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var h=this.angleLabelText.getBBox();We.setAttributes(this.angleLabelElement,[["x",((this.width-h.width)/2).toString()],["y",(this.height/2).toString()]])}},M.prototype.positionScaleShape=function(){if(this.scaleShape){var h=this.scaleShape.transform.baseVal.getItem(0);h.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(h,0)}},M.prototype.getVisual=function(){var h=document.createElementNS("http://www.w3.org/2000/svg","svg");h.setAttribute("xmlns","http://www.w3.org/2000/svg"),h.setAttribute("width",this.width+"px"),h.setAttribute("height",this.height+"px"),h.setAttribute("viewBox","0 0 "+this.width+" "+this.height),h.style.flexShrink="0",document.body.appendChild(h);for(var m="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,I=1;I<=this.width/5+10;I++){var W=I%5==0?this.height/3:this.height/6;m+="h4v"+-W+"h1v"+W}m+="v1H0Z",this.scaleShape=We.createPath(m);var P=We.createTransform();this.scaleShape.transform.baseVal.appendItem(P),h.appendChild(this.scaleShape),this.angleLabelElement=We.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=We.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var re=We.createTSpan("");return re.innerHTML="°",this.angleLabelElement.appendChild(re),h.appendChild(this.angleLabelElement),document.body.removeChild(h),h},M}(),on=function(){function M(){this.naturalSize=!1,this.imageType="image/png"}return M.prototype.rasterize=function(h,m,I,W,P,re,Ce){var Ve=this;return new Promise(function(it){var Oe=document.createElement("canvas");Oe.width=h.width.baseVal.value-2*W,Oe.height=h.height.baseVal.value-2*W;var ct=1,kt=1;Ve.naturalSize===!0?(ct=m.naturalWidth/(h.width.baseVal.value-2*W)/re,kt=m.naturalHeight/(h.height.baseVal.value-2*W)/Ce,Oe.width=m.naturalWidth/re,Oe.height=m.naturalHeight/Ce):Ve.width!==void 0&&Ve.height!==void 0&&(ct=Ve.width/I.width,kt=Ve.height/I.height,Oe.width*=ct,Oe.height*=kt);var Gt=Oe.getContext("2d");Gt.translate(Oe.width/2,Oe.height/2),Gt.rotate(P*Math.PI/180),Gt.scale(re,Ce),Gt.translate(-Oe.width/2,-Oe.height/2),Gt.drawImage(m,0,0,Oe.width,Oe.height);var Ei=document.createElement("canvas");Ei.width=I.width*ct,Ei.height=I.height*kt,Ei.getContext("2d").putImageData(Gt.getImageData((I.x-W)*ct,(I.y-W)*kt,I.width*ct,I.height*kt),0,0),it(Ei.toDataURL(Ve.imageType,Ve.imageQuality))})},M}(),Yi=function(){function M(h){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=M.instanceCounter++,this.styles=new pt(this.instanceNo),this.target=h,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(M.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(h){this._zoomToCropEnabled=h,h?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(h){this._isGridVisible=h,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"gridLines",{get:function(){return this._gridLines},set:function(h){this._gridLines=h,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(h){this._rotationAngle=h,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"aspectRatio",{get:function(){var h;return(h=this._aspectRatio)!==null&&h!==void 0?h:this.aspectRatios[0]},set:function(h){this._aspectRatio=h},enumerable:!1,configurable:!0}),M.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},M.prototype.show=function(){this.showUI(),this.open()},M.prototype.close=function(h){h===void 0&&(h=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),h||this.closeEventListeners.forEach(function(m){return m()}),this._isOpen=!1)},M.prototype.addRenderEventListener=function(h){this.renderEventListeners.push(h)},M.prototype.removeRenderEventListener=function(h){this.renderEventListeners.indexOf(h)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(h),1)},M.prototype.addCloseEventListener=function(h){this.closeEventListeners.push(h)},M.prototype.removeCloseEventListener=function(h){this.closeEventListeners.indexOf(h)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(h),1)},M.prototype.setupResizeObserver=function(){var h=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){h.resize(h.target.clientWidth,h.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))},M.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var h=1*this.target.clientWidth/this.target.clientHeight,m=this.contentDiv.clientWidth/h>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*h:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,I=m+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/h;this.resize(m,I)}},M.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},M.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",We.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},M.prototype.resize=function(h,m){this.imageWidth=Math.round(h),this.imageHeight=Math.round(m),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()},M.prototype.setEditingTarget=function(){var h=document.createElement("canvas");h.width=this.target.naturalWidth,h.height=this.target.naturalHeight,h.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var m=h.toDataURL();We.setAttributes(this.editingTarget,[["href",m]]),this.setEditingTargetSize()},M.prototype.setTopLeft=function(){var h=this.target.getBoundingClientRect(),m=this.editorCanvas.getBoundingClientRect();this.left=h.left-m.left-this.CANVAS_MARGIN,this.top=h.top-m.top-this.CANVAS_MARGIN},M.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=We.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=We.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=We.createGroup(),this.editingTargetRotationScaleContainer=We.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var h=We.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(h);var m=We.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(m),this.editingTargetContainer=We.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)},M.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},M.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=We.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new gn(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()},M.prototype.zoomToCrop=function(){if(this.cropRect){var h=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,m=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=h+"px "+m+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-h+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-m+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},M.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)},M.prototype.cropRectChanged=function(h){this.cropRect=h,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},M.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},M.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"},M.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},M.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 h=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,m=this.target.offsetTop>h+this.CANVAS_MARGIN?this.target.offsetTop-(h+this.CANVAS_MARGIN):0;this.coverDiv.style.top=m+"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},M.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},M.prototype.addTopToolbar=function(){var h=this;this.topToolbar=new di,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 m=new Ai;m.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(m);var I=[];this.aspectRatios.forEach(function(kt){var Gt=new vi(Vi.getIcon(kt.horizontal,kt.vertical),kt.horizontal===0&&kt.vertical===0?"FREE":kt.horizontal+":"+kt.vertical);Gt.onClick=function(){return h.ratioButtonClicked(kt)},I.push(Gt)}),this.aspectRatioButton=new mn(Vi.getIcon(0,0),"Aspect ratio",I),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,m.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var W=new vi('<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");W.isActive=this.isGridVisible,W.onClick=function(){h.isGridVisible=!h.isGridVisible,W.isActive=h.isGridVisible},m.addButton(W);var P=new vi('<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(P.isActive=this.zoomToCropEnabled,P.onClick=function(){h.zoomToCropEnabled=!h.zoomToCropEnabled,P.isActive=h.zoomToCropEnabled},m.addButton(P),!pi.isLicensed){var re=new zi;this.topToolbar.addElementBlock(re);var Ce=document.createElement("div");Ce.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var Ve=document.createElement("a");Ve.style.color="currentColor",Ve.href="https://markerjs.com/products/cropro",Ve.target="_blank",Ve.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>',Ce.appendChild(Ve),re.addElement(Ce)}var it=new Ai;it.minWidth=3*this.toolbarHeight+"px",it.contentAlign="end",this.topToolbar.addButtonBlock(it);var Oe=new vi('<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");Oe.onClick=this.startRenderAndClose,it.addButton(Oe),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Oe.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var ct=new vi('<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");ct.onClick=this.close,it.addButton(ct),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(ct.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},M.prototype.addBottomToolbar=function(){var h=this;this.bottomToolbar=new di,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 m=new Ai;m.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(m);var I=new vi('<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");I.onClick=this.rotateLeftButtonClicked,m.addButton(I);var W=new vi('<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");W.onClick=this.rotateRightButtonClicked,m.addButton(W);var P=new zi;P.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(P),this.straightener=new vn("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(it){h.rotateBy(it),h.straightener.angle=h.rotationAngle},P.addElement(this.straightener.getUI());var re=new Ai;re.minWidth=2*this.toolbarHeight+"px",re.contentAlign="end",this.bottomToolbar.addButtonBlock(re);var Ce=new vi('<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");Ce.onClick=this.flipHorizontallyButtonClicked,re.addButton(Ce);var Ve=new vi('<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");Ve.onClick=this.flipVerticallyButtonClicked,re.addButton(Ve)},M.prototype.ratioButtonClicked=function(h){this.aspectRatio=h,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},M.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=Vi.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},M.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new sn(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},M.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},M.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},M.prototype.restoreState=function(h){if(h){var m=this.cropLayer.getRescaledRect(h.width,h.height,this.imageWidth,this.imageHeight,h.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(m),this.cropRectChanged(m),this.flippedHorizontally=h.flippedHorizontally,this.flippedVertically=h.flippedVertically,this.applyFlip(),this.rotationAngle=h.rotationAngle,this.applyRotation()}},M.prototype.clientToLocalCoordinates=function(h,m){var I=this.cropImage.getBoundingClientRect();return{x:h-I.left,y:m-I.top}},M.prototype.onWindowResize=function(){this.positionUI()},M.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var h=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=h+"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()},M.prototype.rotateLeftButtonClicked=function(){var h=this.rotationAngle-90;this.rotationAngle%90!=0&&(h+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(h)},M.prototype.rotateRightButtonClicked=function(){var h=this.rotationAngle+90;this.rotationAngle%90!=0&&(h-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(h)},M.prototype.rotateTo=function(h){h=(h=h>180?h-360:h)<=-180?h+360:h,this.rotationAngle=h,this.applyRotation()},M.prototype.rotateBy=function(h){this.rotateTo((this.rotationAngle+h)%360)},M.prototype.applyRotation=function(){var h=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var m=this.editingTargetRotationContainer.transform.baseVal.getItem(0);m.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(m,0);var I=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/I.width,this.imageHeight/I.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=h},M.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},M.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},M.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},M.prototype.startRenderAndClose=function(){return gt(this,void 0,void 0,function(){var h,m;return ei(this,function(I){switch(I.label){case 0:return[4,this.render()];case 1:return h=I.sent(),m=this.getState(),this.renderEventListeners.forEach(function(W){return W(h,m)}),this.close(!0),[2]}})})},M.prototype.render=function(){return gt(this,void 0,void 0,function(){var h;return ei(this,function(m){switch(m.label){case 0:return(h=new on).naturalSize=this.renderAtNaturalSize,h.imageType=this.renderImageType,h.imageQuality=this.renderImageQuality,h.width=this.renderWidth,h.height=this.renderHeight,this.unzoomFromCrop(),We.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,h.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 m.sent(),[4,h.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,m.sent()]}})})},M.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Tt("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 Tt("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Tt("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var h=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Tt("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.toolbarHeight-2*h)+`px;
|
|
height: `+(this.toolbarHeight-2*h)+`px;
|
|
padding: `+h+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Tt("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Tt("toolbar_active_button",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
|
|
`)),this.styles.addRule(new It("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new It("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
|
|
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new Tt("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 Tt("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Tt("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 Tt("toolbar_straightener",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
height: `+(this.toolbarHeight-2*h)+`px;
|
|
padding: `+h+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new Tt("toolbar_straightener_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`))},M.instanceCounter=0,M}(),Xi=se("8hTe"),ki=se.n(Xi),ln=/<pre[^>]*>/g;function yn(M){var h=document.createElement("div");return h.innerHTML=M,h.childNodes.length===0?"":h.childNodes[0].nodeValue}var un=ft.a=function(M){var h=M.value,m=h===void 0?"":h,I=M.edit,W=I===void 0?!1:I,P=M.className,re=M.showTextOnly,Ce=M.showLines,Ve=M.replaces,it=M.zoomImg,Oe=M.hasMask,ct=M.style,kt=ct===void 0?{}:ct,Gt=M.stylesPrev,Ei=Gt===void 0?{}:Gt,Ii=String(m),hi=Object(w.useRef)(),Si=Object(w.useRef)(),_n=Object(w.useState)(""),$i=Object(F.a)(_n,2),Ni=$i[0],Li=$i[1],hn=Object(w.useState)("office"),Ui=Object(F.a)(hn,2),bn=Ui[0],Bi=Ui[1],En=function(){var jt=new Yi(Si.current);jt.displayMode="popup",jt.addRenderEventListener(function(){var ii=Object(L.a)(O.a.mark(function Mt(ci){var $t;return O.a.wrap(function(si){for(;;)switch(si.prev=si.next){case 0:return hi.current.style.display="none",si.next=3,Object(_e.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:ci}});case 3:$t=si.sent,$t!=null&&$t.id&&Ve(Si.current.getAttribute("src").replace(V.a.API_SERVER,""),"/api/attachments/".concat($t==null?void 0:$t.id,"?type=").concat($t.content_type));case 5:case"end":return si.stop()}},Mt)}));return function(Mt){return ii.apply(this,arguments)}}()),jt.show()},Tn=function(){var jt=new Ft(Si.current);jt.settings.displayMode="popup",jt.addEventListener("render",function(){var ii=Object(L.a)(O.a.mark(function Mt(ci){var $t;return O.a.wrap(function(si){for(;;)switch(si.prev=si.next){case 0:if(hi.current.style.display="none",!Si.current){si.next=6;break}return si.next=4,Object(_e.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:ci.dataUrl}});case 4:$t=si.sent,$t!=null&&$t.id&&Ve(Si.current.getAttribute("src").replace(V.a.API_SERVER,""),"/api/attachments/".concat($t==null?void 0:$t.id,"?type=").concat($t.content_type));case 6:case"end":return si.stop()}},Mt)}));return function(Mt){return ii.apply(this,arguments)}}()),jt.show(),window.markerArea=jt},Fi=Object(w.useMemo)(function(){hi.current&&(hi.current.style.zIndex=-1);try{var ti=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,jt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,ii=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Ii=Ii.replace(ti,"("+V.a.API_SERVER+"/api/attachments/").replace(jt,'"'+V.a.API_SERVER+"/api/attachments/").replace(ii,'"'+V.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
|
|
`)}catch(Hi){}var Mt=U(Ii),ci=c();if(Ii.match(/\[TOC\]/)&&(Mt=Mt.replace("<p>[TOC]</p>",E()),T()),Mt=Mt.replace(/(__special_katext_id_\d+__)/g,function(Hi,si){var Ji=ci[si],xn=Ji.type,wn=Ji.expression;return Object(ne.renderToString)(yn(wn)||"",{displayMode:xn==="block",throwOnError:!1,output:"html"})}),Mt=Mt.replace(/▁/g,"\u2581\u2581\u2581"),f(),re){var $t=document.createElement("div");return $t.innerHTML=Mt,$t.innerText}return setTimeout(function(){return Sn()},500),Mt},[Ii]),ai=Object(w.useRef)();b.WebkitLineClamp=Ce,Ce&&(kt=Object(x.a)(Object(x.a)({},kt),b));function ji(ti){var jt=ti.target;if(jt.tagName.toUpperCase()==="IMG"){if(it){var ii=jt.getAttribute("src");Li(ii),Bi("image")}}else if(jt.tagName.toUpperCase()==="A"){var Mt=jt.getAttribute("href");if(Mt.indexOf("office")>-1)ti.preventDefault(),Li(Mt),Bi("office");else if(Mt.indexOf("application/pdf")>-1)ti.preventDefault(),Li(Mt),Bi("pdf");else if(Mt.indexOf("text/html")>-1)ti.preventDefault(),Li(Mt),Bi("html");else if(Mt.startsWith("#")){ti.preventDefault();var ci=document.getElementById(Mt.replace("#",""));ci&&ci.scrollIntoView(!0)}}}var Sn=function(){var jt,ii=(jt=ai.current)===null||jt===void 0?void 0:jt.querySelectorAll("video");ii==null||ii.forEach(function(Mt){if(Mt.oncontextmenu=function(){return!1},Mt.src.indexOf(".m3u8")>-1&&!Mt.canPlayType("application/vnd.apple.mpegurl")){if(H.a.isSupported()){var ci=new H.a;ci.loadSource(Mt.src),ci.attachMedia(Mt)}}})};Object(w.useEffect)(function(){if(ai.current&&Fi&&(Fi.match(ln)&&window.PR.prettyPrint()),ai.current)return ai.current.addEventListener("click",ji),function(){ai.current.removeEventListener("click",ji),f(),T()}},[Fi,ai.current,ji]);var Bn=function(jt){if(!W)return;jt.target.nodeName==="IMG"?(hi.current.style.zIndex=1,hi.current.style.display="flex",hi.current.style.width=jt.target.clientWidth+"px",hi.current.style.height=jt.target.clientHeight+"px",hi.current.style.top=jt.target.offsetTop+"px",hi.current.style.left=jt.target.offsetLeft+"px",Si.current.src=jt.target.getAttribute("src")):hi.current.style.display="none"};return y.a.createElement("div",{style:{position:"relative"}},y.a.createElement("div",{ref:ai,style:Object(x.a)({},kt),className:"".concat(P||""," markdown-body ").concat(ki.a.mdBody),onMouseOver:Bn,dangerouslySetInnerHTML:{__html:Fi}}),y.a.createElement("div",{ref:hi,className:ki.a.button},y.a.createElement(j.a,null,y.a.createElement(k.a,{onClick:function(){return En()}},"\u88C1\u526A"),y.a.createElement(k.a,{onClick:function(){return Tn()}},"\u7F16\u8F91"))),y.a.createElement("img",{ref:Si,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),y.a.createElement(ie.a,{close:!0,data:Ni,type:Ni!=null&&Ni.length?bn:"",style:Object(x.a)({},Ei),onClose:function(){return Li("")}}))}},BU3w:function(xt,ft,se){"use strict";se.d(ft,"a",function(){return L});var pe=se("MNnm"),j="rc-util-key";function C(F){if(F.attachTo)return F.attachTo;var N=document.querySelector("head");return N||document.body}function k(F){var N,O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(pe.a)())return null;var w=document.createElement("style");if((N=O.csp)===null||N===void 0?void 0:N.nonce){var y;w.nonce=(y=O.csp)===null||y===void 0?void 0:y.nonce}w.innerHTML=F;var _=C(O),s=_.firstChild;return O.prepend&&_.prepend?_.prepend(w):O.prepend&&s?_.insertBefore(w,s):_.appendChild(w),w}var x=new Map;function L(F,N){var O=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},w=C(O);if(!x.has(w)){var y=k("",O),_=y.parentNode;x.set(w,_),_.removeChild(y)}var s=Array.from(x.get(w).children).find(function(e){return e.tagName==="STYLE"&&e[j]===N});if(s){var r,i;if(((r=O.csp)===null||r===void 0?void 0:r.nonce)&&s.nonce!==((i=O.csp)===null||i===void 0?void 0:i.nonce)){var u;s.nonce=(u=O.csp)===null||u===void 0?void 0:u.nonce}return s.innerHTML!==F&&(s.innerHTML=F),s}var l=k(F,O);return l[j]=N,l}},BdwD:function(xt,ft,se){"use strict";var pe=se("+L6B"),j=se("2/Rp"),C=se("0Owb"),k=se("k1fw"),x=se("q1tI"),L=se.n(x),F=se("FOrL"),N=se.n(F),O=function(y){var _=y.buttonProps,s=_===void 0?{}:_,r=y.styles,i=r===void 0?{}:r,u=y.customText,l=y.ButtonText,e=y.ButtonClick,t=y.Buttonclass,n=y.ButtonTwo;return L.a.createElement("section",{className:"tc animated fadeIn",style:Object(k.a)(Object(k.a)({},{color:"#999",margin:"200px auto"}),i)},L.a.createElement("img",{src:N.a}),L.a.createElement("p",{className:"mt20 font14"},u||"\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!"),l&&L.a.createElement(j.a,Object(C.a)({className:t,onClick:e},s),l),n&&n)};ft.a=O},DlQD:function(xt,ft,se){(function(pe,j){xt.exports=j()})(this,function(){"use strict";function pe(de,oe){for(var ue=0;ue<oe.length;ue++){var Y=oe[ue];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(de,Y.key,Y)}}function j(de,oe,ue){return oe&&pe(de.prototype,oe),ue&&pe(de,ue),de}function C(de,oe){if(!de)return;if(typeof de=="string")return k(de,oe);var ue=Object.prototype.toString.call(de).slice(8,-1);if(ue==="Object"&&de.constructor&&(ue=de.constructor.name),ue==="Map"||ue==="Set")return Array.from(de);if(ue==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ue))return k(de,oe)}function k(de,oe){(oe==null||oe>de.length)&&(oe=de.length);for(var ue=0,Y=new Array(oe);ue<oe;ue++)Y[ue]=de[ue];return Y}function x(de,oe){var ue;if(typeof Symbol=="undefined"||de[Symbol.iterator]==null){if(Array.isArray(de)||(ue=C(de))||oe&&de&&typeof de.length=="number"){ue&&(de=ue);var Y=0;return function(){return Y>=de.length?{done:!0}:{done:!1,value:de[Y++]}}}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 ue=de[Symbol.iterator](),ue.next.bind(ue)}function L(de,oe){return oe={exports:{}},de(oe,oe.exports),oe.exports}var F=L(function(de){function oe(){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 ue(Y){de.exports.defaults=Y}de.exports={defaults:oe(),getDefaults:oe,changeDefaults:ue}}),N=F.defaults,O=F.getDefaults,w=F.changeDefaults,y=/[&<>"']/,_=/[&<>"']/g,s=/[<>"']|&(?!#?\w+;)/,r=/[<>"']|&(?!#?\w+;)/g,i={"&":"&","<":"<",">":">",'"':""","'":"'"},u=function(oe){return i[oe]};function l(de,oe){if(oe){if(y.test(de))return de.replace(_,u)}else if(s.test(de))return de.replace(r,u);return de}var e=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function t(de){return de.replace(e,function(oe,ue){return ue=ue.toLowerCase(),ue==="colon"?":":ue.charAt(0)==="#"?ue.charAt(1)==="x"?String.fromCharCode(parseInt(ue.substring(2),16)):String.fromCharCode(+ue.substring(1)):""})}var n=/(^|[^\[])\^/g;function T(de,oe){de=de.source||de,oe=oe||"";var ue={replace:function(X,Z){return Z=Z.source||Z,Z=Z.replace(n,"$1"),de=de.replace(X,Z),ue},getRegex:function(){return new RegExp(de,oe)}};return ue}var b=/[^\w:]/g,g=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function E(de,oe,ue){if(de){var Y;try{Y=decodeURIComponent(t(ue)).replace(b,"").toLowerCase()}catch(X){return null}if(Y.indexOf("javascript:")===0||Y.indexOf("vbscript:")===0||Y.indexOf("data:")===0)return null}oe&&!g.test(ue)&&(ue=o(oe,ue));try{ue=encodeURI(ue).replace(/%25/g,"%")}catch(X){return null}return ue}var v={},p=/^[^:]+:\/*[^/]*$/,d=/^([^:]+:)[\s\S]*$/,a=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(de,oe){v[" "+de]||(p.test(de)?v[" "+de]=de+"/":v[" "+de]=A(de,"/",!0)),de=v[" "+de];var ue=de.indexOf(":")===-1;return oe.substring(0,2)==="//"?ue?oe:de.replace(d,"$1")+oe:oe.charAt(0)==="/"?ue?oe:de.replace(a,"$1")+oe:de+oe}var c={exec:function(){}};function f(de){for(var oe=1,ue,Y;oe<arguments.length;oe++){ue=arguments[oe];for(Y in ue)Object.prototype.hasOwnProperty.call(ue,Y)&&(de[Y]=ue[Y])}return de}function S(de,oe){var ue=de.replace(/\|/g,function(Z,ae,ve){for(var Se=!1,Ne=ae;--Ne>=0&&ve[Ne]==="\\";)Se=!Se;return Se?"|":" |"}),Y=ue.split(/ \|/),X=0;if(Y.length>oe)Y.splice(oe);else for(;Y.length<oe;)Y.push("");for(;X<Y.length;X++)Y[X]=Y[X].trim().replace(/\\\|/g,"|");return Y}function A(de,oe,ue){var Y=de.length;if(Y===0)return"";for(var X=0;X<Y;){var Z=de.charAt(Y-X-1);if(Z===oe&&!ue)X++;else if(Z!==oe&&ue)X++;else break}return de.substr(0,Y-X)}function R(de,oe){if(de.indexOf(oe[1])===-1)return-1;for(var ue=de.length,Y=0,X=0;X<ue;X++)if(de[X]==="\\")X++;else if(de[X]===oe[0])Y++;else if(de[X]===oe[1]&&(Y--,Y<0))return X;return-1}function B(de){de&&de.sanitize&&!de.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 U={escape:l,unescape:t,edit:T,cleanUrl:E,resolveUrl:o,noopTest:c,merge:f,splitCells:S,rtrim:A,findClosingBracket:R,checkSanitizeDeprecation:B},K=F.defaults,D=U.rtrim,H=U.splitCells,V=U.escape,ne=U.findClosingBracket;function ie(de,oe,ue){var Y=oe.href,X=oe.title?V(oe.title):null,Z=de[1].replace(/\\([\[\]])/g,"$1");return de[0].charAt(0)!=="!"?{type:"link",raw:ue,href:Y,title:X,text:Z}:{type:"image",raw:ue,href:Y,title:X,text:V(Z)}}function _e(de,oe){var ue=de.match(/^(\s+)(?:```)/);if(ue===null)return oe;var Y=ue[1];return oe.split(`
|
|
`).map(function(X){var Z=X.match(/^\s+/);if(Z===null)return X;var ae=Z[0];return ae.length>=Y.length?X.slice(Y.length):X}).join(`
|
|
`)}var ye=function(){function de(ue){this.options=ue||K}var oe=de.prototype;return oe.space=function(Y){var X=this.rules.block.newline.exec(Y);if(X)return X[0].length>1?{type:"space",raw:X[0]}:{raw:`
|
|
`}},oe.code=function(Y,X){var Z=this.rules.block.code.exec(Y);if(Z){var ae=X[X.length-1];if(ae&&ae.type==="paragraph")return{raw:Z[0],text:Z[0].trimRight()};var ve=Z[0].replace(/^ {4}/gm,"");return{type:"code",raw:Z[0],codeBlockStyle:"indented",text:this.options.pedantic?ve:D(ve,`
|
|
`)}}},oe.fences=function(Y){var X=this.rules.block.fences.exec(Y);if(X){var Z=X[0],ae=_e(Z,X[3]||"");return{type:"code",raw:Z,lang:X[2]?X[2].trim():X[2],text:ae}}},oe.heading=function(Y){var X=this.rules.block.heading.exec(Y);if(X)return{type:"heading",raw:X[0],depth:X[1].length,text:X[2]}},oe.nptable=function(Y){var X=this.rules.block.nptable.exec(Y);if(X){var Z={type:"table",header:H(X[1].replace(/^ *| *\| *$/g,"")),align:X[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:X[3]?X[3].replace(/\n$/,"").split(`
|
|
`):[],raw:X[0]};if(Z.header.length===Z.align.length){var ae=Z.align.length,ve;for(ve=0;ve<ae;ve++)/^ *-+: *$/.test(Z.align[ve])?Z.align[ve]="right":/^ *:-+: *$/.test(Z.align[ve])?Z.align[ve]="center":/^ *:-+ *$/.test(Z.align[ve])?Z.align[ve]="left":Z.align[ve]=null;for(ae=Z.cells.length,ve=0;ve<ae;ve++)Z.cells[ve]=H(Z.cells[ve],Z.header.length);return Z}}},oe.hr=function(Y){var X=this.rules.block.hr.exec(Y);if(X)return{type:"hr",raw:X[0]}},oe.blockquote=function(Y){var X=this.rules.block.blockquote.exec(Y);if(X){var Z=X[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:X[0],text:Z}}},oe.list=function(Y){var X=this.rules.block.list.exec(Y);if(X){for(var Z=X[0],ae=X[2],ve=ae.length>1,Se=ae[ae.length-1]===")",Ne={type:"list",raw:Z,ordered:ve,start:ve?+ae.slice(0,-1):"",loose:!1,items:[]},st=X[0].match(this.rules.block.item),dt=!1,ut,wt,Et,et,Vt,Ft,Zt,Xt=st.length,gt=0;gt<Xt;gt++)ut=st[gt],Z=ut,wt=ut.length,ut=ut.replace(/^ *([*+-]|\d+[.)]) */,""),~ut.indexOf(`
|
|
`)&&(wt-=ut.length,ut=this.options.pedantic?ut.replace(/^ {1,4}/gm,""):ut.replace(new RegExp("^ {1,"+wt+"}","gm"),"")),gt!==Xt-1&&(Et=this.rules.block.bullet.exec(st[gt+1])[0],(ve?Et.length===1||!Se&&Et[Et.length-1]===")":Et.length>1||this.options.smartLists&&Et!==ae)&&(et=st.slice(gt+1).join(`
|
|
`),Ne.raw=Ne.raw.substring(0,Ne.raw.length-et.length),gt=Xt-1)),Vt=dt||/\n\n(?!\s*$)/.test(ut),gt!==Xt-1&&(dt=ut.charAt(ut.length-1)===`
|
|
`,Vt||(Vt=dt)),Vt&&(Ne.loose=!0),Ft=/^\[[ xX]\] /.test(ut),Zt=void 0,Ft&&(Zt=ut[1]!==" ",ut=ut.replace(/^\[[ xX]\] +/,"")),Ne.items.push({type:"list_item",raw:Z,task:Ft,checked:Zt,loose:Vt,text:ut});return Ne}},oe.html=function(Y){var X=this.rules.block.html.exec(Y);if(X)return{type:this.options.sanitize?"paragraph":"html",raw:X[0],pre:!this.options.sanitizer&&(X[1]==="pre"||X[1]==="script"||X[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(X[0]):V(X[0]):X[0]}},oe.def=function(Y){var X=this.rules.block.def.exec(Y);if(X){X[3]&&(X[3]=X[3].substring(1,X[3].length-1));var Z=X[1].toLowerCase().replace(/\s+/g," ");return{tag:Z,raw:X[0],href:X[2],title:X[3]}}},oe.table=function(Y){var X=this.rules.block.table.exec(Y);if(X){var Z={type:"table",header:H(X[1].replace(/^ *| *\| *$/g,"")),align:X[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:X[3]?X[3].replace(/\n$/,"").split(`
|
|
`):[]};if(Z.header.length===Z.align.length){Z.raw=X[0];var ae=Z.align.length,ve;for(ve=0;ve<ae;ve++)/^ *-+: *$/.test(Z.align[ve])?Z.align[ve]="right":/^ *:-+: *$/.test(Z.align[ve])?Z.align[ve]="center":/^ *:-+ *$/.test(Z.align[ve])?Z.align[ve]="left":Z.align[ve]=null;for(ae=Z.cells.length,ve=0;ve<ae;ve++)Z.cells[ve]=H(Z.cells[ve].replace(/^ *\| *| *\| *$/g,""),Z.header.length);return Z}}},oe.lheading=function(Y){var X=this.rules.block.lheading.exec(Y);if(X)return{type:"heading",raw:X[0],depth:X[2].charAt(0)==="="?1:2,text:X[1]}},oe.paragraph=function(Y){var X=this.rules.block.paragraph.exec(Y);if(X)return{type:"paragraph",raw:X[0],text:X[1].charAt(X[1].length-1)===`
|
|
`?X[1].slice(0,-1):X[1]}},oe.text=function(Y,X){var Z=this.rules.block.text.exec(Y);if(Z){var ae=X[X.length-1];return ae&&ae.type==="text"?{raw:Z[0],text:Z[0]}:{type:"text",raw:Z[0],text:Z[0]}}},oe.escape=function(Y){var X=this.rules.inline.escape.exec(Y);if(X)return{type:"escape",raw:X[0],text:V(X[1])}},oe.tag=function(Y,X,Z){var ae=this.rules.inline.tag.exec(Y);if(ae)return!X&&/^<a /i.test(ae[0])?X=!0:X&&/^<\/a>/i.test(ae[0])&&(X=!1),!Z&&/^<(pre|code|kbd|script)(\s|>)/i.test(ae[0])?Z=!0:Z&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ae[0])&&(Z=!1),{type:this.options.sanitize?"text":"html",raw:ae[0],inLink:X,inRawBlock:Z,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ae[0]):V(ae[0]):ae[0]}},oe.link=function(Y){var X=this.rules.inline.link.exec(Y);if(X){var Z=ne(X[2],"()");if(Z>-1){var ae=X[0].indexOf("!")===0?5:4,ve=ae+X[1].length+Z;X[2]=X[2].substring(0,Z),X[0]=X[0].substring(0,ve).trim(),X[3]=""}var Se=X[2],Ne="";if(this.options.pedantic){var st=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Se);st?(Se=st[1],Ne=st[3]):Ne=""}else Ne=X[3]?X[3].slice(1,-1):"";Se=Se.trim().replace(/^<([\s\S]*)>$/,"$1");var dt=ie(X,{href:Se&&Se.replace(this.rules.inline._escapes,"$1"),title:Ne&&Ne.replace(this.rules.inline._escapes,"$1")},X[0]);return dt}},oe.reflink=function(Y,X){var Z;if((Z=this.rules.inline.reflink.exec(Y))||(Z=this.rules.inline.nolink.exec(Y))){var ae=(Z[2]||Z[1]).replace(/\s+/g," ");if(ae=X[ae.toLowerCase()],!ae||!ae.href){var ve=Z[0].charAt(0);return{type:"text",raw:ve,text:ve}}var Se=ie(Z,ae,Z[0]);return Se}},oe.strong=function(Y,X,Z){Z===void 0&&(Z="");var ae=this.rules.inline.strong.start.exec(Y);if(ae&&(!ae[1]||ae[1]&&(Z===""||this.rules.inline.punctuation.exec(Z)))){X=X.slice(-1*Y.length);var ve=ae[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ve.lastIndex=0;for(var Se;(ae=ve.exec(X))!=null;)if(Se=this.rules.inline.strong.middle.exec(X.slice(0,ae.index+3)),Se)return{type:"strong",raw:Y.slice(0,Se[0].length),text:Y.slice(2,Se[0].length-2)}}},oe.em=function(Y,X,Z){Z===void 0&&(Z="");var ae=this.rules.inline.em.start.exec(Y);if(ae&&(!ae[1]||ae[1]&&(Z===""||this.rules.inline.punctuation.exec(Z)))){X=X.slice(-1*Y.length);var ve=ae[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ve.lastIndex=0;for(var Se;(ae=ve.exec(X))!=null;)if(Se=this.rules.inline.em.middle.exec(X.slice(0,ae.index+2)),Se)return{type:"em",raw:Y.slice(0,Se[0].length),text:Y.slice(1,Se[0].length-1)}}},oe.codespan=function(Y){var X=this.rules.inline.code.exec(Y);if(X){var Z=X[2].replace(/\n/g," "),ae=/[^ ]/.test(Z),ve=Z.startsWith(" ")&&Z.endsWith(" ");return ae&&ve&&(Z=Z.substring(1,Z.length-1)),Z=V(Z,!0),{type:"codespan",raw:X[0],text:Z}}},oe.br=function(Y){var X=this.rules.inline.br.exec(Y);if(X)return{type:"br",raw:X[0]}},oe.del=function(Y){var X=this.rules.inline.del.exec(Y);if(X)return{type:"del",raw:X[0],text:X[1]}},oe.autolink=function(Y,X){var Z=this.rules.inline.autolink.exec(Y);if(Z){var ae,ve;return Z[2]==="@"?(ae=V(this.options.mangle?X(Z[1]):Z[1]),ve="mailto:"+ae):(ae=V(Z[1]),ve=ae),{type:"link",raw:Z[0],text:ae,href:ve,tokens:[{type:"text",raw:ae,text:ae}]}}},oe.url=function(Y,X){var Z;if(Z=this.rules.inline.url.exec(Y)){var ae,ve;if(Z[2]==="@")ae=V(this.options.mangle?X(Z[0]):Z[0]),ve="mailto:"+ae;else{var Se;do Se=Z[0],Z[0]=this.rules.inline._backpedal.exec(Z[0])[0];while(Se!==Z[0]);ae=V(Z[0]),Z[1]==="www."?ve="http://"+ae:ve=ae}return{type:"link",raw:Z[0],text:ae,href:ve,tokens:[{type:"text",raw:ae,text:ae}]}}},oe.inlineText=function(Y,X,Z){var ae=this.rules.inline.text.exec(Y);if(ae){var ve;return X?ve=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ae[0]):V(ae[0]):ae[0]:ve=V(this.options.smartypants?Z(ae[0]):ae[0]),{type:"text",raw:ae[0],text:ve}}},de}(),be=U.noopTest,we=U.edit,Re=U.merge,ge={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:be,table:be,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ge._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ge._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ge.def=we(ge.def).replace("label",ge._label).replace("title",ge._title).getRegex(),ge.bullet=/(?:[*+-]|\d{1,9}[.)])/,ge.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ge.item=we(ge.item,"gm").replace(/bull/g,ge.bullet).getRegex(),ge.list=we(ge.list).replace(/bull/g,ge.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ge.def.source+")").getRegex(),ge._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ge._comment=/<!--(?!-?>)[\s\S]*?-->/,ge.html=we(ge.html,"i").replace("comment",ge._comment).replace("tag",ge._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ge.paragraph=we(ge._paragraph).replace("hr",ge.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ge._tag).getRegex(),ge.blockquote=we(ge.blockquote).replace("paragraph",ge.paragraph).getRegex(),ge.normal=Re({},ge),ge.gfm=Re({},ge.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n *([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n *\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),ge.gfm.nptable=we(ge.gfm.nptable).replace("hr",ge.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ge._tag).getRegex(),ge.gfm.table=we(ge.gfm.table).replace("hr",ge.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ge._tag).getRegex(),ge.pedantic=Re({},ge.normal,{html:we(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ge._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:be,paragraph:we(ge.normal._paragraph).replace("hr",ge.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",ge.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var Q={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:be,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:be,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};Q._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",Q.punctuation=we(Q.punctuation).replace(/punctuation/g,Q._punctuation).getRegex(),Q._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",Q._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",Q.em.start=we(Q.em.start).replace(/punctuation/g,Q._punctuation).getRegex(),Q.em.middle=we(Q.em.middle).replace(/punctuation/g,Q._punctuation).replace(/overlapSkip/g,Q._overlapSkip).getRegex(),Q.em.endAst=we(Q.em.endAst,"g").replace(/punctuation/g,Q._punctuation).getRegex(),Q.em.endUnd=we(Q.em.endUnd,"g").replace(/punctuation/g,Q._punctuation).getRegex(),Q.strong.start=we(Q.strong.start).replace(/punctuation/g,Q._punctuation).getRegex(),Q.strong.middle=we(Q.strong.middle).replace(/punctuation/g,Q._punctuation).replace(/blockSkip/g,Q._blockSkip).getRegex(),Q.strong.endAst=we(Q.strong.endAst,"g").replace(/punctuation/g,Q._punctuation).getRegex(),Q.strong.endUnd=we(Q.strong.endUnd,"g").replace(/punctuation/g,Q._punctuation).getRegex(),Q.blockSkip=we(Q._blockSkip,"g").getRegex(),Q.overlapSkip=we(Q._overlapSkip,"g").getRegex(),Q._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,Q._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,Q._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])?)+(?![-_])/,Q.autolink=we(Q.autolink).replace("scheme",Q._scheme).replace("email",Q._email).getRegex(),Q._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,Q.tag=we(Q.tag).replace("comment",ge._comment).replace("attribute",Q._attribute).getRegex(),Q._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Q._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,Q._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,Q.link=we(Q.link).replace("label",Q._label).replace("href",Q._href).replace("title",Q._title).getRegex(),Q.reflink=we(Q.reflink).replace("label",Q._label).getRegex(),Q.reflinkSearch=we(Q.reflinkSearch,"g").replace("reflink",Q.reflink).replace("nolink",Q.nolink).getRegex(),Q.normal=Re({},Q),Q.pedantic=Re({},Q.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:we(/^!?\[(label)\]\((.*?)\)/).replace("label",Q._label).getRegex(),reflink:we(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Q._label).getRegex()}),Q.gfm=Re({},Q.normal,{escape:we(Q.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),Q.gfm.url=we(Q.gfm.url,"i").replace("email",Q.gfm._extended_email).getRegex(),Q.breaks=Re({},Q.gfm,{br:we(Q.br).replace("{2,}","*").getRegex(),text:we(Q.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Pe={block:ge,inline:Q},$e=F.defaults,Fe=Pe.block,Me=Pe.inline;function ze(de){return de.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function xe(de){var oe="",ue,Y,X=de.length;for(ue=0;ue<X;ue++)Y=de.charCodeAt(ue),Math.random()>.5&&(Y="x"+Y.toString(16)),oe+="&#"+Y+";";return oe}var ke=function(){function de(ue){this.tokens=[],this.tokens.links=Object.create(null),this.options=ue||$e,this.options.tokenizer=this.options.tokenizer||new ye,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var Y={block:Fe.normal,inline:Me.normal};this.options.pedantic?(Y.block=Fe.pedantic,Y.inline=Me.pedantic):this.options.gfm&&(Y.block=Fe.gfm,this.options.breaks?Y.inline=Me.breaks:Y.inline=Me.gfm),this.tokenizer.rules=Y}de.lex=function(Y,X){var Z=new de(X);return Z.lex(Y)};var oe=de.prototype;return oe.lex=function(Y){return Y=Y.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(Y,this.tokens,!0),this.inline(this.tokens),this.tokens},oe.blockTokens=function(Y,X,Z){X===void 0&&(X=[]),Z===void 0&&(Z=!0),Y=Y.replace(/^ +$/gm,"");for(var ae,ve,Se,Ne;Y;){if(ae=this.tokenizer.space(Y)){Y=Y.substring(ae.raw.length),ae.type&&X.push(ae);continue}if(ae=this.tokenizer.code(Y,X)){Y=Y.substring(ae.raw.length),ae.type?X.push(ae):(Ne=X[X.length-1],Ne.raw+=`
|
|
`+ae.raw,Ne.text+=`
|
|
`+ae.text);continue}if(ae=this.tokenizer.fences(Y)){Y=Y.substring(ae.raw.length),X.push(ae);continue}if(ae=this.tokenizer.heading(Y)){Y=Y.substring(ae.raw.length),X.push(ae);continue}if(ae=this.tokenizer.nptable(Y)){Y=Y.substring(ae.raw.length),X.push(ae);continue}if(ae=this.tokenizer.hr(Y)){Y=Y.substring(ae.raw.length),X.push(ae);continue}if(ae=this.tokenizer.blockquote(Y)){Y=Y.substring(ae.raw.length),ae.tokens=this.blockTokens(ae.text,[],Z),X.push(ae);continue}if(ae=this.tokenizer.list(Y)){for(Y=Y.substring(ae.raw.length),Se=ae.items.length,ve=0;ve<Se;ve++)ae.items[ve].tokens=this.blockTokens(ae.items[ve].text,[],!1);X.push(ae);continue}if(ae=this.tokenizer.html(Y)){Y=Y.substring(ae.raw.length),X.push(ae);continue}if(Z&&(ae=this.tokenizer.def(Y))){Y=Y.substring(ae.raw.length),this.tokens.links[ae.tag]||(this.tokens.links[ae.tag]={href:ae.href,title:ae.title});continue}if(ae=this.tokenizer.table(Y)){Y=Y.substring(ae.raw.length),X.push(ae);continue}if(ae=this.tokenizer.lheading(Y)){Y=Y.substring(ae.raw.length),X.push(ae);continue}if(Z&&(ae=this.tokenizer.paragraph(Y))){Y=Y.substring(ae.raw.length),X.push(ae);continue}if(ae=this.tokenizer.text(Y,X)){Y=Y.substring(ae.raw.length),ae.type?X.push(ae):(Ne=X[X.length-1],Ne.raw+=`
|
|
`+ae.raw,Ne.text+=`
|
|
`+ae.text);continue}if(Y){var st="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error(st);break}else throw new Error(st)}}return X},oe.inline=function(Y){var X,Z,ae,ve,Se,Ne,st=Y.length;for(X=0;X<st;X++){Ne=Y[X];switch(Ne.type){case"paragraph":case"text":case"heading":{Ne.tokens=[],this.inlineTokens(Ne.text,Ne.tokens);break}case"table":{for(Ne.tokens={header:[],cells:[]},ve=Ne.header.length,Z=0;Z<ve;Z++)Ne.tokens.header[Z]=[],this.inlineTokens(Ne.header[Z],Ne.tokens.header[Z]);for(ve=Ne.cells.length,Z=0;Z<ve;Z++)for(Se=Ne.cells[Z],Ne.tokens.cells[Z]=[],ae=0;ae<Se.length;ae++)Ne.tokens.cells[Z][ae]=[],this.inlineTokens(Se[ae],Ne.tokens.cells[Z][ae]);break}case"blockquote":{this.inline(Ne.tokens);break}case"list":{for(ve=Ne.items.length,Z=0;Z<ve;Z++)this.inline(Ne.items[Z].tokens);break}}}return Y},oe.inlineTokens=function(Y,X,Z,ae,ve){X===void 0&&(X=[]),Z===void 0&&(Z=!1),ae===void 0&&(ae=!1),ve===void 0&&(ve="");var Se,Ne=Y,st;if(this.tokens.links){var dt=Object.keys(this.tokens.links);if(dt.length>0)for(;(st=this.tokenizer.rules.inline.reflinkSearch.exec(Ne))!=null;)dt.includes(st[0].slice(st[0].lastIndexOf("[")+1,-1))&&(Ne=Ne.slice(0,st.index)+"["+"a".repeat(st[0].length-2)+"]"+Ne.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(st=this.tokenizer.rules.inline.blockSkip.exec(Ne))!=null;)Ne=Ne.slice(0,st.index)+"["+"a".repeat(st[0].length-2)+"]"+Ne.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;Y;){if(Se=this.tokenizer.escape(Y)){Y=Y.substring(Se.raw.length),X.push(Se);continue}if(Se=this.tokenizer.tag(Y,Z,ae)){Y=Y.substring(Se.raw.length),Z=Se.inLink,ae=Se.inRawBlock,X.push(Se);continue}if(Se=this.tokenizer.link(Y)){Y=Y.substring(Se.raw.length),Se.type==="link"&&(Se.tokens=this.inlineTokens(Se.text,[],!0,ae)),X.push(Se);continue}if(Se=this.tokenizer.reflink(Y,this.tokens.links)){Y=Y.substring(Se.raw.length),Se.type==="link"&&(Se.tokens=this.inlineTokens(Se.text,[],!0,ae)),X.push(Se);continue}if(Se=this.tokenizer.strong(Y,Ne,ve)){Y=Y.substring(Se.raw.length),Se.tokens=this.inlineTokens(Se.text,[],Z,ae),X.push(Se);continue}if(Se=this.tokenizer.em(Y,Ne,ve)){Y=Y.substring(Se.raw.length),Se.tokens=this.inlineTokens(Se.text,[],Z,ae),X.push(Se);continue}if(Se=this.tokenizer.codespan(Y)){Y=Y.substring(Se.raw.length),X.push(Se);continue}if(Se=this.tokenizer.br(Y)){Y=Y.substring(Se.raw.length),X.push(Se);continue}if(Se=this.tokenizer.del(Y)){Y=Y.substring(Se.raw.length),Se.tokens=this.inlineTokens(Se.text,[],Z,ae),X.push(Se);continue}if(Se=this.tokenizer.autolink(Y,xe)){Y=Y.substring(Se.raw.length),X.push(Se);continue}if(!Z&&(Se=this.tokenizer.url(Y,xe))){Y=Y.substring(Se.raw.length),X.push(Se);continue}if(Se=this.tokenizer.inlineText(Y,ae,ze)){Y=Y.substring(Se.raw.length),ve=Se.raw.slice(-1),X.push(Se);continue}if(Y){var ut="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error(ut);break}else throw new Error(ut)}}return X},j(de,null,[{key:"rules",get:function(){return{block:Fe,inline:Me}}}]),de}(),je=F.defaults,Ge=U.cleanUrl,Ue=U.escape,Le=function(){function de(ue){this.options=ue||je}var oe=de.prototype;return oe.code=function(Y,X,Z){var ae=(X||"").match(/\S*/)[0];if(this.options.highlight){var ve=this.options.highlight(Y,ae);ve!=null&&ve!==Y&&(Z=!0,Y=ve)}return ae?'<pre><code class="'+this.options.langPrefix+Ue(ae,!0)+'">'+(Z?Y:Ue(Y,!0))+`</code></pre>
|
|
`:"<pre><code>"+(Z?Y:Ue(Y,!0))+`</code></pre>
|
|
`},oe.blockquote=function(Y){return`<blockquote>
|
|
`+Y+`</blockquote>
|
|
`},oe.html=function(Y){return Y},oe.heading=function(Y,X,Z,ae){return this.options.headerIds?"<h"+X+' id="'+this.options.headerPrefix+ae.slug(Z)+'">'+Y+"</h"+X+`>
|
|
`:"<h"+X+">"+Y+"</h"+X+`>
|
|
`},oe.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},oe.list=function(Y,X,Z){var ae=X?"ol":"ul",ve=X&&Z!==1?' start="'+Z+'"':"";return"<"+ae+ve+`>
|
|
`+Y+"</"+ae+`>
|
|
`},oe.listitem=function(Y){return"<li>"+Y+`</li>
|
|
`},oe.checkbox=function(Y){return"<input "+(Y?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},oe.paragraph=function(Y){return"<p>"+Y+`</p>
|
|
`},oe.table=function(Y,X){return X&&(X="<tbody>"+X+"</tbody>"),`<table>
|
|
<thead>
|
|
`+Y+`</thead>
|
|
`+X+`</table>
|
|
`},oe.tablerow=function(Y){return`<tr>
|
|
`+Y+`</tr>
|
|
`},oe.tablecell=function(Y,X){var Z=X.header?"th":"td",ae=X.align?"<"+Z+' align="'+X.align+'">':"<"+Z+">";return ae+Y+"</"+Z+`>
|
|
`},oe.strong=function(Y){return"<strong>"+Y+"</strong>"},oe.em=function(Y){return"<em>"+Y+"</em>"},oe.codespan=function(Y){return"<code>"+Y+"</code>"},oe.br=function(){return this.options.xhtml?"<br/>":"<br>"},oe.del=function(Y){return"<del>"+Y+"</del>"},oe.link=function(Y,X,Z){if(Y=Ge(this.options.sanitize,this.options.baseUrl,Y),Y===null)return Z;var ae='<a href="'+Ue(Y)+'"';return X&&(ae+=' title="'+X+'"'),ae+=">"+Z+"</a>",ae},oe.image=function(Y,X,Z){if(Y=Ge(this.options.sanitize,this.options.baseUrl,Y),Y===null)return Z;var ae='<img src="'+Y+'" alt="'+Z+'"';return X&&(ae+=' title="'+X+'"'),ae+=this.options.xhtml?"/>":">",ae},oe.text=function(Y){return Y},de}(),Ae=function(){function de(){}var oe=de.prototype;return oe.strong=function(Y){return Y},oe.em=function(Y){return Y},oe.codespan=function(Y){return Y},oe.del=function(Y){return Y},oe.html=function(Y){return Y},oe.text=function(Y){return Y},oe.link=function(Y,X,Z){return""+Z},oe.image=function(Y,X,Z){return""+Z},oe.br=function(){return""},de}(),nt=function(){function de(){this.seen={}}var oe=de.prototype;return oe.slug=function(Y){var X=Y.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(X)){var Z=X;do this.seen[Z]++,X=Z+"-"+this.seen[Z];while(this.seen.hasOwnProperty(X))}return this.seen[X]=0,X},de}(),Qe=F.defaults,Ze=U.unescape,Ye=function(){function de(ue){this.options=ue||Qe,this.options.renderer=this.options.renderer||new Le,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ae,this.slugger=new nt}de.parse=function(Y,X){var Z=new de(X);return Z.parse(Y)};var oe=de.prototype;return oe.parse=function(Y,X){X===void 0&&(X=!0);var Z="",ae,ve,Se,Ne,st,dt,ut,wt,Et,et,Vt,Ft,Zt,Xt,gt,ei,pi,We,pt=Y.length;for(ae=0;ae<pt;ae++){et=Y[ae];switch(et.type){case"space":continue;case"hr":{Z+=this.renderer.hr();continue}case"heading":{Z+=this.renderer.heading(this.parseInline(et.tokens),et.depth,Ze(this.parseInline(et.tokens,this.textRenderer)),this.slugger);continue}case"code":{Z+=this.renderer.code(et.text,et.lang,et.escaped);continue}case"table":{for(wt="",ut="",Ne=et.header.length,ve=0;ve<Ne;ve++)ut+=this.renderer.tablecell(this.parseInline(et.tokens.header[ve]),{header:!0,align:et.align[ve]});for(wt+=this.renderer.tablerow(ut),Et="",Ne=et.cells.length,ve=0;ve<Ne;ve++){for(dt=et.tokens.cells[ve],ut="",st=dt.length,Se=0;Se<st;Se++)ut+=this.renderer.tablecell(this.parseInline(dt[Se]),{header:!1,align:et.align[Se]});Et+=this.renderer.tablerow(ut)}Z+=this.renderer.table(wt,Et);continue}case"blockquote":{Et=this.parse(et.tokens),Z+=this.renderer.blockquote(Et);continue}case"list":{for(Vt=et.ordered,Ft=et.start,Zt=et.loose,Ne=et.items.length,Et="",ve=0;ve<Ne;ve++)gt=et.items[ve],ei=gt.checked,pi=gt.task,Xt="",gt.task&&(We=this.renderer.checkbox(ei),Zt?gt.tokens.length>0&>.tokens[0].type==="text"?(gt.tokens[0].text=We+" "+gt.tokens[0].text,gt.tokens[0].tokens&>.tokens[0].tokens.length>0&>.tokens[0].tokens[0].type==="text"&&(gt.tokens[0].tokens[0].text=We+" "+gt.tokens[0].tokens[0].text)):gt.tokens.unshift({type:"text",text:We}):Xt+=We),Xt+=this.parse(gt.tokens,Zt),Et+=this.renderer.listitem(Xt,pi,ei);Z+=this.renderer.list(Et,Vt,Ft);continue}case"html":{Z+=this.renderer.html(et.text);continue}case"paragraph":{Z+=this.renderer.paragraph(this.parseInline(et.tokens));continue}case"text":{for(Et=et.tokens?this.parseInline(et.tokens):et.text;ae+1<pt&&Y[ae+1].type==="text";)et=Y[++ae],Et+=`
|
|
`+(et.tokens?this.parseInline(et.tokens):et.text);Z+=X?this.renderer.paragraph(Et):Et;continue}default:{var It='Token with "'+et.type+'" type was not found.';if(this.options.silent){console.error(It);return}else throw new Error(It)}}}return Z},oe.parseInline=function(Y,X){X=X||this.renderer;var Z="",ae,ve,Se=Y.length;for(ae=0;ae<Se;ae++){ve=Y[ae];switch(ve.type){case"escape":{Z+=X.text(ve.text);break}case"html":{Z+=X.html(ve.text);break}case"link":{Z+=X.link(ve.href,ve.title,this.parseInline(ve.tokens,X));break}case"image":{Z+=X.image(ve.href,ve.title,ve.text);break}case"strong":{Z+=X.strong(this.parseInline(ve.tokens,X));break}case"em":{Z+=X.em(this.parseInline(ve.tokens,X));break}case"codespan":{Z+=X.codespan(ve.text);break}case"br":{Z+=X.br();break}case"del":{Z+=X.del(this.parseInline(ve.tokens,X));break}case"text":{Z+=X.text(ve.text);break}default:{var Ne='Token with "'+ve.type+'" type was not found.';if(this.options.silent){console.error(Ne);return}else throw new Error(Ne)}}}return Z},de}(),at=U.merge,qe=U.checkSanitizeDeprecation,Xe=U.escape,Be=F.getDefaults,rt=F.changeDefaults,Je=F.defaults;function Ee(de,oe,ue){if(typeof de=="undefined"||de===null)throw new Error("marked(): input parameter is undefined or null");if(typeof de!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(de)+", string expected");if(typeof oe=="function"&&(ue=oe,oe=null),oe=at({},Ee.defaults,oe||{}),qe(oe),ue){var Y=oe.highlight,X;try{X=ke.lex(de,oe)}catch(Se){return ue(Se)}var Z=function(Ne){var st;if(!Ne)try{st=Ye.parse(X,oe)}catch(dt){Ne=dt}return oe.highlight=Y,Ne?ue(Ne):ue(null,st)};if(!Y||Y.length<3)return Z();if(delete oe.highlight,!X.length)return Z();var ae=0;Ee.walkTokens(X,function(Se){Se.type==="code"&&(ae++,setTimeout(function(){Y(Se.text,Se.lang,function(Ne,st){if(Ne)return Z(Ne);st!=null&&st!==Se.text&&(Se.text=st,Se.escaped=!0),ae--,ae===0&&Z()})},0))}),ae===0&&Z();return}try{var ve=ke.lex(de,oe);return oe.walkTokens&&Ee.walkTokens(ve,oe.walkTokens),Ye.parse(ve,oe)}catch(Se){if(Se.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,oe.silent)return"<p>An error occurred:</p><pre>"+Xe(Se.message+"",!0)+"</pre>";throw Se}}Ee.options=Ee.setOptions=function(de){return at(Ee.defaults,de),rt(Ee.defaults),Ee},Ee.getDefaults=Be,Ee.defaults=Je,Ee.use=function(de){var oe=at({},de);if(de.renderer&&function(){var Y=Ee.defaults.renderer||new Le,X=function(ve){var Se=Y[ve];Y[ve]=function(){for(var Ne=arguments.length,st=new Array(Ne),dt=0;dt<Ne;dt++)st[dt]=arguments[dt];var ut=de.renderer[ve].apply(Y,st);return ut===!1&&(ut=Se.apply(Y,st)),ut}};for(var Z in de.renderer)X(Z);oe.renderer=Y}(),de.tokenizer&&function(){var Y=Ee.defaults.tokenizer||new ye,X=function(ve){var Se=Y[ve];Y[ve]=function(){for(var Ne=arguments.length,st=new Array(Ne),dt=0;dt<Ne;dt++)st[dt]=arguments[dt];var ut=de.tokenizer[ve].apply(Y,st);return ut===!1&&(ut=Se.apply(Y,st)),ut}};for(var Z in de.tokenizer)X(Z);oe.tokenizer=Y}(),de.walkTokens){var ue=Ee.defaults.walkTokens;oe.walkTokens=function(Y){de.walkTokens(Y),ue&&ue(Y)}}Ee.setOptions(oe)},Ee.walkTokens=function(de,oe){for(var ue=x(de),Y;!(Y=ue()).done;){var X=Y.value;oe(X);switch(X.type){case"table":{for(var Z=x(X.tokens.header),ae;!(ae=Z()).done;){var ve=ae.value;Ee.walkTokens(ve,oe)}for(var Se=x(X.tokens.cells),Ne;!(Ne=Se()).done;)for(var st=Ne.value,dt=x(st),ut;!(ut=dt()).done;){var wt=ut.value;Ee.walkTokens(wt,oe)}break}case"list":{Ee.walkTokens(X.items,oe);break}default:X.tokens&&Ee.walkTokens(X.tokens,oe)}}},Ee.Parser=Ye,Ee.parser=Ye.parse,Ee.Renderer=Le,Ee.TextRenderer=Ae,Ee.Lexer=ke,Ee.lexer=ke.lex,Ee.Tokenizer=ye,Ee.Slugger=nt,Ee.parse=Ee;var He=Ee;return He})},FOrL:function(xt,ft,se){xt.exports=se.p+"static/nodata.a6b3f948.png"},INg4:function(xt,ft,se){xt.exports={flex_box_center:"flex_box_center___2rJad",flex_space_between:"flex_space_between___3xFPg",flex_box_vertical_center:"flex_box_vertical_center___3_RIS",flex_box_center_end:"flex_box_center_end___h0Di5",flex_box_column:"flex_box_column___Q5LEA",right:"right___1Gnba",title:"title___2HvSR",titles:"titles___2UU6k",tips:"tips___1iWOB"}},LdHM:function(xt,ft,se){"use strict";se.d(ft,"b",function(){return n}),se.d(ft,"a",function(){return b});var pe=se("1OyB"),j=se("vuIU"),C=se("Ji7U"),k=se("LK+K"),x=se("q1tI"),L=se("rePB"),F=se("Ff2n"),N=se("ODXe"),O=se("4IlW"),w=se("bX4T"),y=se("YrtM"),_=se("TSYQ"),s=se.n(_),r=se("+nKL"),i=se("8OUc"),u=function(H,V){var ne=H.prefixCls,ie=H.id,_e=H.flattenOptions,ye=H.childrenAsData,be=H.values,we=H.searchValue,Re=H.multiple,ge=H.defaultActiveFirstOption,Q=H.height,Pe=H.itemHeight,$e=H.notFoundContent,Fe=H.open,Me=H.menuItemSelectedIcon,ze=H.virtual,xe=H.onSelect,ke=H.onToggleOpen,je=H.onActiveValue,Ge=H.onScroll,Ue=H.onMouseEnter,Le="".concat(ne,"-item"),Ae=Object(y.a)(function(){return _e},[Fe,_e],function(He,de){return de[0]&&He[1]!==de[1]}),nt=x.useRef(null),Qe=function(de){de.preventDefault()},Ze=function(de){nt.current&&nt.current.scrollTo({index:de})},Ye=function(de){for(var oe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ue=Ae.length,Y=0;Y<ue;Y+=1){var X=(de+Y*oe+ue)%ue,Z=Ae[X],ae=Z.group,ve=Z.data;if(!ae&&!ve.disabled)return X}return-1},at=x.useState(function(){return Ye(0)}),qe=Object(N.a)(at,2),Xe=qe[0],Be=qe[1],rt=function(de){Be(de);var oe=Ae[de];if(!oe){je(null,-1);return}je(oe.data.value,de)};x.useEffect(function(){rt(ge!==!1?Ye(0):-1)},[Ae.length,we]),x.useEffect(function(){var He=setTimeout(function(){if(!Re&&Fe&&be.size===1){var de=Array.from(be)[0],oe=Ae.findIndex(function(ue){var Y=ue.data;return Y.value===de});rt(oe),Ze(oe)}});return function(){return clearTimeout(He)}},[Fe]);var Je=function(de){de!==void 0&&xe(de,{selected:!be.has(de)}),Re||ke(!1)};if(x.useImperativeHandle(V,function(){return{onKeyDown:function(de){var oe=de.which;switch(oe){case O.a.UP:case O.a.DOWN:{var ue=0;if(oe===O.a.UP?ue=-1:oe===O.a.DOWN&&(ue=1),ue!==0){var Y=Ye(Xe+ue,ue);Ze(Y),rt(Y)}break}case O.a.ENTER:{var X=Ae[Xe];X&&!X.data.disabled?Je(X.data.value):Je(void 0),Fe&&de.preventDefault();break}case O.a.ESC:ke(!1)}},onKeyUp:function(){},scrollTo:function(de){Ze(de)}}}),Ae.length===0)return x.createElement("div",{role:"listbox",id:"".concat(ie,"_list"),className:"".concat(Le,"-empty"),onMouseDown:Qe},$e);function Ee(He){var de=Ae[He];if(!de)return null;var oe=de.data||{},ue=oe.value,Y=oe.label,X=oe.children,Z=Object(w.a)(oe,!0),ae=ye?X:Y;return de?x.createElement("div",Object.assign({"aria-label":typeof ae=="string"?ae:null},Z,{key:He,role:"option",id:"".concat(ie,"_list_").concat(He),"aria-selected":be.has(ue)}),ue):null}return x.createElement(x.Fragment,null,x.createElement("div",{role:"listbox",id:"".concat(ie,"_list"),style:{height:0,width:0,overflow:"hidden"}},Ee(Xe-1),Ee(Xe),Ee(Xe+1)),x.createElement(r.a,{itemKey:"key",ref:nt,data:Ae,height:Q,itemHeight:Pe,fullHeight:!1,onMouseDown:Qe,onScroll:Ge,virtual:ze,onMouseEnter:Ue},function(He,de){var oe,ue=He.group,Y=He.groupOption,X=He.data,Z=X.label,ae=X.key;if(ue)return x.createElement("div",{className:s()(Le,"".concat(Le,"-group"))},Z!==void 0?Z:ae);var ve=X.disabled,Se=X.value,Ne=X.title,st=X.children,dt=X.style,ut=X.className,wt=Object(F.a)(X,["disabled","value","title","children","style","className"]),Et=be.has(Se),et="".concat(Le,"-option"),Vt=s()(Le,et,ut,(oe={},Object(L.a)(oe,"".concat(et,"-grouped"),Y),Object(L.a)(oe,"".concat(et,"-active"),Xe===de&&!ve),Object(L.a)(oe,"".concat(et,"-disabled"),ve),Object(L.a)(oe,"".concat(et,"-selected"),Et),oe)),Ft=ye?st:Z,Zt=!Me||typeof Me=="function"||Et;return x.createElement("div",Object.assign({},wt,{"aria-selected":Et,className:Vt,title:Ne,onMouseMove:function(){if(Xe===de||ve)return;rt(de)},onClick:function(){ve||Je(Se)},style:dt}),x.createElement("div",{className:"".concat(et,"-content")},Ft||Se),x.isValidElement(Me)||Et,Zt&&x.createElement(i.a,{className:"".concat(Le,"-option-state"),customizeIcon:Me,customizeIconProps:{isSelected:Et}},Et?"\u2713":null))}))},l=x.forwardRef(u);l.displayName="OptionList";var e=l,t=function(){return null};t.isSelectOption=!0;var n=t,T=function(){return null};T.isSelectOptGroup=!0;var b=T,g=se("VTBJ"),E=se("Zm9Q");function v(D){var H=D.key,V=D.props,ne=V.children,ie=V.value,_e=Object(F.a)(V,["children","value"]);return Object(g.a)({key:H,value:ie!==void 0?ie:H,children:ne},_e)}function p(D){var H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(E.a)(D).map(function(V,ne){if(!x.isValidElement(V)||!V.type)return null;var ie=V.type.isSelectOptGroup,_e=V.key,ye=V.props,be=ye.children,we=Object(F.a)(ye,["children"]);return H||!ie?v(V):Object(g.a)(Object(g.a)({key:"__RC_SELECT_GRP__".concat(_e===null?ne:_e,"__"),label:_e},we),{},{options:p(be)})}).filter(function(V){return V})}var d=se("2Qr1"),a=se("qNPg"),o=se("U8pU"),c=se("Kwbf"),f=se("WKfj");function S(D){var H=D.mode,V=D.options,ne=D.children,ie=D.backfill,_e=D.allowClear,ye=D.placeholder,be=D.getInputElement,we=D.showSearch,Re=D.onSearch,ge=D.defaultOpen,Q=D.autoFocus,Pe=D.labelInValue,$e=D.value,Fe=D.inputValue,Me=D.optionLabelProp,ze=H==="multiple"||H==="tags",xe=we!==void 0?we:ze||H==="combobox",ke=V||p(ne);if(Object(c.a)(H!=="tags"||ke.every(function(Le){return!Le.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),H==="tags"||H==="combobox"){var je=ke.some(function(Le){return Le.options?Le.options.some(function(Ae){return typeof("value"in Ae?Ae.value:Ae.key)=="number"}):typeof("value"in Le?Le.value:Le.key)=="number"});Object(c.a)(!je,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(c.a)(H!=="combobox"||!Me,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(c.a)(H==="combobox"||!ie,"`backfill` only works with `combobox` mode."),Object(c.a)(H==="combobox"||!be,"`getInputElement` only work with `combobox` mode."),Object(c.b)(H!=="combobox"||!be||!_e||!ye,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Re&&!xe&&H!=="combobox"&&H!=="tags"&&Object(c.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(c.b)(!ge||Q,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),$e!=null){var Ge=Object(f.d)($e);Object(c.a)(!Pe||Ge.every(function(Le){return Object(o.a)(Le)==="object"&&("key"in Le||"value"in Le)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(c.a)(!ze||Array.isArray($e),"`value` should be array when `mode` is `multiple` or `tags`")}if(ne){var Ue=null;Object(E.a)(ne).some(function(Le){if(!x.isValidElement(Le)||!Le.type)return!1;var Ae=Le.type;if(Ae.isSelectOption)return!1;if(Ae.isSelectOptGroup){var nt=Object(E.a)(Le.props.children).every(function(Qe){return!x.isValidElement(Qe)||!Le.type||Qe.type.isSelectOption?!0:(Ue=Qe.type,!1)});return!nt}return Ue=Ae,!0}),Ue&&Object(c.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Ue.displayName||Ue.name||Ue,"`.")),Object(c.a)(Fe===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var A=S,R=Object(a.a)({prefixCls:"rc-select",components:{optionList:e},convertChildrenToData:p,flattenOptions:d.d,getLabeledValue:d.e,filterOptions:d.b,isValueDisabled:d.g,findValueOption:d.c,warningProps:A,fillOptionsWithMissingValue:d.a}),B=function(D){Object(C.a)(V,D);var H=Object(k.a)(V);function V(){var ne;return Object(pe.a)(this,V),ne=H.apply(this,arguments),ne.selectRef=x.createRef(),ne.focus=function(){ne.selectRef.current.focus()},ne.blur=function(){ne.selectRef.current.blur()},ne}return Object(j.a)(V,[{key:"render",value:function(){return x.createElement(R,Object.assign({ref:this.selectRef},this.props))}}]),V}(x.Component);B.Option=n,B.OptGroup=b;var U=B,K=ft.c=U},SJMd:function(xt,ft){/**
|
|
* @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 se,pe,j,C=!1,k,x;window.PR_SHOULD_USE_CONTINUATION=!0;var L,F;(function(){var N=window,O=["break,continue,do,else,for,if,return,while"],w=[O,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],y=[w,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],_=[y,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],s=[y,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],r=[y,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],i="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",u=[y,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],l="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",e=[O,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],t=[O,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],n=[O,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],T=[_,r,s,u,l,e,t,n],b=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,g="str",E="kwd",v="com",p="typ",d="lit",a="pun",o="pln",c="tag",f="dec",S="src",A="atn",R="atv",B="nocode",U="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function K(xe){for(var ke=0,je=!1,Ge=!1,Ue=0,Le=xe.length;Ue<Le;++Ue){var Ae=xe[Ue];if(Ae.ignoreCase)Ge=!0;else if(/[a-z]/i.test(Ae.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){je=!0,Ge=!1;break}}var nt={b:8,t:9,n:10,v:11,f:12,r:13};function Qe(Xe){var Be=Xe.charCodeAt(0);if(Be!==92)return Be;var rt=Xe.charAt(1);return Be=nt[rt],Be||("0"<=rt&&rt<="7"?parseInt(Xe.substring(1),8):rt==="u"||rt==="x"?parseInt(Xe.substring(2),16):Xe.charCodeAt(1))}function Ze(Xe){if(Xe<32)return(Xe<16?"\\x0":"\\x")+Xe.toString(16);var Be=String.fromCharCode(Xe);return Be==="\\"||Be==="-"||Be==="]"||Be==="^"?"\\"+Be:Be}function Ye(Xe){var Be=Xe.substring(1,Xe.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")),rt=[],Je=Be[0]==="^",Ee=["["];Je&&Ee.push("^");for(var He=Je?1:0,de=Be.length;He<de;++He){var oe=Be[He];if(/\\[bdsw]/i.test(oe))Ee.push(oe);else{var ue=Qe(oe),Y;He+2<de&&Be[He+1]==="-"?(Y=Qe(Be[He+2]),He+=2):Y=ue,rt.push([ue,Y]),Y<65||ue>122||(Y<65||ue>90||rt.push([Math.max(65,ue)|32,Math.min(Y,90)|32]),Y<97||ue>122||rt.push([Math.max(97,ue)&~32,Math.min(Y,122)&~32]))}}rt.sort(function(ve,Se){return ve[0]-Se[0]||Se[1]-ve[1]});for(var X=[],Z=[],He=0;He<rt.length;++He){var ae=rt[He];ae[0]<=Z[1]+1?Z[1]=Math.max(Z[1],ae[1]):X.push(Z=ae)}for(var He=0;He<X.length;++He){var ae=X[He];Ee.push(Ze(ae[0])),ae[1]>ae[0]&&(ae[1]+1>ae[0]&&Ee.push("-"),Ee.push(Ze(ae[1])))}return Ee.push("]"),Ee.join("")}function at(Xe){for(var Be=Xe.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")),rt=Be.length,Je=[],Ee=0,He=0;Ee<rt;++Ee){var de=Be[Ee];if(de==="(")++He;else if(de.charAt(0)==="\\"){var oe=+de.substring(1);oe&&(oe<=He?Je[oe]=-1:Be[Ee]=Ze(oe))}}for(var Ee=1;Ee<Je.length;++Ee)Je[Ee]===-1&&(Je[Ee]=++ke);for(var Ee=0,He=0;Ee<rt;++Ee){var de=Be[Ee];if(de==="(")++He,Je[He]||(Be[Ee]="(?:");else if(de.charAt(0)==="\\"){var oe=+de.substring(1);oe&&oe<=He&&(Be[Ee]="\\"+Je[oe])}}for(var Ee=0;Ee<rt;++Ee)Be[Ee]==="^"&&Be[Ee+1]!=="^"&&(Be[Ee]="");if(Xe.ignoreCase&&je)for(var Ee=0;Ee<rt;++Ee){var de=Be[Ee],ue=de.charAt(0);de.length>=2&&ue==="["?Be[Ee]=Ye(de):ue!=="\\"&&(Be[Ee]=de.replace(/[a-zA-Z]/g,function(Z){var ae=Z.charCodeAt(0);return"["+String.fromCharCode(ae&~32,ae|32)+"]"}))}return Be.join("")}for(var qe=[],Ue=0,Le=xe.length;Ue<Le;++Ue){var Ae=xe[Ue];if(Ae.global||Ae.multiline)throw new Error(""+Ae);qe.push("(?:"+at(Ae)+")")}return new RegExp(qe.join("|"),Ge?"gi":"g")}function D(xe,ke){var je=/(?:^|\s)nocode(?:\s|$)/,Ge=[],Ue=0,Le=[],Ae=0;function nt(Qe){var Ze=Qe.nodeType;if(Ze==1){if(je.test(Qe.className))return;for(var Ye=Qe.firstChild;Ye;Ye=Ye.nextSibling)nt(Ye);var at=Qe.nodeName.toLowerCase();(at==="br"||at==="li")&&(Ge[Ae]=`
|
|
`,Le[Ae<<1]=Ue++,Le[Ae++<<1|1]=Qe)}else if(Ze==3||Ze==4){var qe=Qe.nodeValue;qe.length&&(ke?qe=qe.replace(/\r\n?/g,`
|
|
`):qe=qe.replace(/[ \t\r\n]+/g," "),Ge[Ae]=qe,Le[Ae<<1]=Ue,Ue+=qe.length,Le[Ae++<<1|1]=Qe)}}return nt(xe),{sourceCode:Ge.join("").replace(/\n$/,""),spans:Le}}function H(xe,ke,je,Ge,Ue){if(!je)return;var Le={sourceNode:xe,pre:1,langExtension:null,numberLines:null,sourceCode:je,spans:null,basePos:ke,decorations:null};Ge(Le),Ue.push.apply(Ue,Le.decorations)}var V=/\S/;function ne(xe){for(var ke=void 0,je=xe.firstChild;je;je=je.nextSibling){var Ge=je.nodeType;ke=Ge===1?ke?xe:je:Ge===3&&V.test(je.nodeValue)?xe:ke}return ke===xe?void 0:ke}function ie(xe,ke){var je={},Ge;(function(){for(var Ae=xe.concat(ke),nt=[],Qe={},Ze=0,Ye=Ae.length;Ze<Ye;++Ze){var at=Ae[Ze],qe=at[3];if(qe)for(var Xe=qe.length;--Xe>=0;)je[qe.charAt(Xe)]=at;var Be=at[1],rt=""+Be;Qe.hasOwnProperty(rt)||(nt.push(Be),Qe[rt]=null)}nt.push(/[\0-\uffff]/),Ge=K(nt)})();var Ue=ke.length,Le=function(Ae){for(var nt=Ae.sourceCode,Qe=Ae.basePos,Ze=Ae.sourceNode,Ye=[Qe,o],at=0,qe=nt.match(Ge)||[],Xe={},Be=0,rt=qe.length;Be<rt;++Be){var Je=qe[Be],Ee=Xe[Je],He=void 0,de;if(typeof Ee=="string")de=!1;else{var oe=je[Je.charAt(0)];if(oe)He=Je.match(oe[1]),Ee=oe[0];else{for(var ue=0;ue<Ue;++ue)if(oe=ke[ue],He=Je.match(oe[1]),He){Ee=oe[0];break}He||(Ee=o)}de=Ee.length>=5&&Ee.substring(0,5)==="lang-",de&&!(He&&typeof He[1]=="string")&&(de=!1,Ee=S),de||(Xe[Je]=Ee)}var Y=at;if(at+=Je.length,!de)Ye.push(Qe+Y,Ee);else{var X=He[1],Z=Je.indexOf(X),ae=Z+X.length;He[2]&&(ae=Je.length-He[2].length,Z=ae-X.length);var ve=Ee.substring(5);H(Ze,Qe+Y,Je.substring(0,Z),Le,Ye),H(Ze,Qe+Y+Z,X,Q(ve,X),Ye),H(Ze,Qe+Y+ae,Je.substring(ae),Le,Ye)}}Ae.decorations=Ye};return Le}function _e(xe){var ke=[],je=[];xe.tripleQuotedStrings?ke.push([g,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):xe.multiLineStrings?ke.push([g,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):ke.push([g,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),xe.verbatimStrings&&je.push([g,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Ge=xe.hashComments;Ge&&(xe.cStyleComments?(Ge>1?ke.push([v,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):ke.push([v,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),je.push([g,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):ke.push([v,/^#[^\r\n]*/,null,"#"])),xe.cStyleComments&&(je.push([v,/^\/\/[^\r\n]*/,null]),je.push([v,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ue=xe.regexLiterals;if(Ue){var Le=Ue>1?"":`
|
|
\r`,Ae=Le?".":"[\\S\\s]",nt="/(?=[^/*"+Le+"])(?:[^/\\x5B\\x5C"+Le+"]|\\x5C"+Ae+"|\\x5B(?:[^\\x5C\\x5D"+Le+"]|\\x5C"+Ae+")*(?:\\x5D|$))+/";je.push(["lang-regex",RegExp("^"+U+"("+nt+")")])}var Qe=xe.types;Qe&&je.push([p,Qe]);var Ze=(""+xe.keywords).replace(/^ | $/g,"");Ze.length&&je.push([E,new RegExp("^(?:"+Ze.replace(/[\s,]+/g,"|")+")\\b"),null]),ke.push([o,/^\s+/,null,` \r
|
|
\xA0`]);var Ye="^.[^\\s\\w.$@'\"`/\\\\]*";return xe.regexLiterals&&(Ye+="(?!s*/)"),je.push([d,/^@[a-z_$][a-z_$@0-9]*/i,null],[p,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[o,/^[a-z_$][a-z_$@0-9]*/i,null],[d,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[o,/^\\[\s\S]?/,null],[a,new RegExp(Ye),null]),ie(ke,je)}var ye=_e({keywords:T,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function be(xe,ke,je){for(var Ge=/(?:^|\s)nocode(?:\s|$)/,Ue=/\r\n?|\n/,Le=xe.ownerDocument,Ae=Le.createElement("li");xe.firstChild;)Ae.appendChild(xe.firstChild);var nt=[Ae];function Qe(Be){var rt=Be.nodeType;if(rt==1&&!Ge.test(Be.className))if(Be.nodeName==="br")Ze(Be),Be.parentNode&&Be.parentNode.removeChild(Be);else for(var Je=Be.firstChild;Je;Je=Je.nextSibling)Qe(Je);else if((rt==3||rt==4)&&je){var Ee=Be.nodeValue,He=Ee.match(Ue);if(He){var de=Ee.substring(0,He.index);Be.nodeValue=de;var oe=Ee.substring(He.index+He[0].length);if(oe){var ue=Be.parentNode;ue.insertBefore(Le.createTextNode(oe),Be.nextSibling)}Ze(Be),de||Be.parentNode.removeChild(Be)}}}function Ze(Be){for(;!Be.nextSibling;)if(Be=Be.parentNode,!Be)return;function rt(He,de){var oe=de?He.cloneNode(!1):He,ue=He.parentNode;if(ue){var Y=rt(ue,1),X=He.nextSibling;Y.appendChild(oe);for(var Z=X;Z;Z=X)X=Z.nextSibling,Y.appendChild(Z)}return oe}for(var Je=rt(Be.nextSibling,0),Ee;(Ee=Je.parentNode)&&Ee.nodeType===1;)Je=Ee;nt.push(Je)}for(var Ye=0;Ye<nt.length;++Ye)Qe(nt[Ye]);ke===(ke|0)&&nt[0].setAttribute("value",ke);var at=Le.createElement("ol");at.className="linenums";for(var qe=Math.max(0,ke-1|0)||0,Ye=0,Xe=nt.length;Ye<Xe;++Ye)Ae=nt[Ye],Ae.className="L"+(Ye+qe)%10,Ae.firstChild||Ae.appendChild(Le.createTextNode("\xA0")),at.appendChild(Ae);xe.appendChild(at)}function we(xe){var ke=/\bMSIE\s(\d+)/.exec(navigator.userAgent);ke=ke&&+ke[1]<=8;var je=/\n/g,Ge=xe.sourceCode,Ue=Ge.length,Le=0,Ae=xe.spans,nt=Ae.length,Qe=0,Ze=xe.decorations,Ye=Ze.length,at=0;Ze[Ye]=Ue;var qe,Xe;for(Xe=qe=0;Xe<Ye;)Ze[Xe]!==Ze[Xe+2]?(Ze[qe++]=Ze[Xe++],Ze[qe++]=Ze[Xe++]):Xe+=2;for(Ye=qe,Xe=qe=0;Xe<Ye;){for(var Be=Ze[Xe],rt=Ze[Xe+1],Je=Xe+2;Je+2<=Ye&&Ze[Je+1]===rt;)Je+=2;Ze[qe++]=Be,Ze[qe++]=rt,Xe=Je}Ye=Ze.length=qe;var Ee=xe.sourceNode,He="";Ee&&(He=Ee.style.display,Ee.style.display="none");try{for(var de=null;Qe<nt;){var oe=Ae[Qe],ue=Ae[Qe+2]||Ue,Y=Ze[at+2]||Ue,Je=Math.min(ue,Y),X=Ae[Qe+1],Z;if(X.nodeType!==1&&(Z=Ge.substring(Le,Je))){ke&&(Z=Z.replace(je,"\r")),X.nodeValue=Z;var ae=X.ownerDocument,ve=ae.createElement("span");ve.className=Ze[at+1];var Se=X.parentNode;Se.replaceChild(ve,X),ve.appendChild(X),Le<ue&&(Ae[Qe+1]=X=ae.createTextNode(Ge.substring(Je,ue)),Se.insertBefore(X,ve.nextSibling))}Le=Je,Le>=ue&&(Qe+=2),Le>=Y&&(at+=2)}}finally{Ee&&(Ee.style.display=He)}}var Re={};function ge(xe,ke){for(var je=ke.length;--je>=0;){var Ge=ke[je];Re.hasOwnProperty(Ge)?N.console&&console.warn("cannot override language handler %s",Ge):Re[Ge]=xe}}function Q(xe,ke){return xe&&Re.hasOwnProperty(xe)||(xe=/^\s*</.test(ke)?"default-markup":"default-code"),Re[xe]}ge(ye,["default-code"]),ge(ie([],[[o,/^[^<?]+/],[f,/^<!\w[^>]*(?:>|$)/],[v,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[a,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),ge(ie([[o,/^[\s]+/,null,` \r
|
|
`],[R,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[c,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[A,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[a,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),ge(ie([],[[R,/^[\s\S]+/]]),["uq.val"]),ge(_e({keywords:_,hashComments:!0,cStyleComments:!0,types:b}),["c","cc","cpp","cxx","cyc","m"]),ge(_e({keywords:"null,true,false"}),["json"]),ge(_e({keywords:r,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:b}),["cs"]),ge(_e({keywords:s,cStyleComments:!0}),["java"]),ge(_e({keywords:n,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ge(_e({keywords:e,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ge(_e({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ge(_e({keywords:t,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ge(_e({keywords:u,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ge(_e({keywords:i,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ge(ie([],[[g,/^[\s\S]+/]]),["regex"]);function Pe(xe){var ke=xe.langExtension;try{var je=D(xe.sourceNode,xe.pre),Ge=je.sourceCode;xe.sourceCode=Ge,xe.spans=je.spans,xe.basePos=0,Q(ke,Ge)(xe),we(xe)}catch(Ue){N.console&&console.log(Ue&&Ue.stack||Ue)}}function $e(xe,ke,je){var Ge=je||!1,Ue=ke||null,Le=document.createElement("div");Le.innerHTML="<pre>"+xe+"</pre>",Le=Le.firstChild,Ge&&be(Le,Ge,!0);var Ae={langExtension:Ue,numberLines:Ge,sourceNode:Le,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Pe(Ae),Le.innerHTML}function Fe(xe,ke){var je=ke||document.body,Ge=je.ownerDocument||document;function Ue(oe){return je.getElementsByTagName(oe)}for(var Le=[Ue("pre"),Ue("code"),Ue("xmp")],Ae=[],nt=0;nt<Le.length;++nt)for(var Qe=0,Ze=Le[nt].length;Qe<Ze;++Qe)Ae.push(Le[nt][Qe]);Le=null;var Ye=Date;Ye.now||(Ye={now:function(){return+new Date}});var at=0,qe=/\blang(?:uage)?-([\w.]+)(?!\S)/,Xe=/\bprettyprint\b/,Be=/\bprettyprinted\b/,rt=/pre|xmp/i,Je=/^code$/i,Ee=/^(?:pre|code|xmp)$/i,He={};function de(){for(var oe=N.PR_SHOULD_USE_CONTINUATION?Ye.now()+250:Infinity;at<Ae.length&&Ye.now()<oe;at++){for(var ue=Ae[at],Y=He,X=ue;X=X.previousSibling;){var Z=X.nodeType,ae=(Z===7||Z===8)&&X.nodeValue;if(ae?!/^\??prettify\b/.test(ae):Z!==3||/\S/.test(X.nodeValue))break;if(ae){Y={},ae.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Xt,gt,ei){Y[gt]=ei});break}}var ve=ue.className;if((Y!==He||Xe.test(ve))&&!Be.test(ve)){for(var Se=!1,Ne=ue.parentNode;Ne;Ne=Ne.parentNode){var st=Ne.tagName;if(Ee.test(st)&&Ne.className&&Xe.test(Ne.className)){Se=!0;break}}if(!Se){ue.className+=" prettyprinted";var dt=Y.lang;if(!dt){dt=ve.match(qe);var ut;!dt&&(ut=ne(ue))&&Je.test(ut.tagName)&&(dt=ut.className.match(qe)),dt&&(dt=dt[1])}var wt;if(rt.test(ue.tagName))wt=1;else{var Et=ue.currentStyle,et=Ge.defaultView,Vt=Et?Et.whiteSpace:et&&et.getComputedStyle?et.getComputedStyle(ue,null).getPropertyValue("white-space"):0;wt=Vt&&Vt.substring(0,3)==="pre"}var Ft=Y.linenums;(Ft=Ft==="true"||+Ft)||(Ft=ve.match(/\blinenums\b(?::(\d+))?/),Ft=Ft?Ft[1]&&Ft[1].length?+Ft[1]:!0:!1),Ft&&be(ue,Ft,wt);var Zt={langExtension:dt,sourceNode:ue,numberLines:Ft,pre:wt,sourceCode:null,basePos:null,spans:null,decorations:null};Pe(Zt)}}}at<Ae.length?N.setTimeout(de,250):typeof xe=="function"&&xe()}de()}var Me=N.PR={createSimpleLexer:ie,registerLangHandler:ge,sourceDecorator:_e,PR_ATTRIB_NAME:A,PR_ATTRIB_VALUE:R,PR_COMMENT:v,PR_DECLARATION:f,PR_KEYWORD:E,PR_LITERAL:d,PR_NOCODE:B,PR_PLAIN:o,PR_PUNCTUATION:a,PR_SOURCE:S,PR_STRING:g,PR_TAG:c,PR_TYPE:p,prettyPrintOne:C?N.prettyPrintOne=$e:L=$e,prettyPrint:F=C?N.prettyPrint=Fe:F=Fe},ze=N.define;typeof ze=="function"&&ze.amd&&ze("google-code-prettify",[],function(){return Me})})()},TXwP:function(xt,ft,se){var pe,j;(function(){var C;(function(){"use strict";var x=[,,function(O){function w(s){this.__parent=s,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}w.prototype.clone_empty=function(){var s=new w(this.__parent);return s.set_indent(this.__indent_count,this.__alignment_count),s},w.prototype.item=function(s){return s<0?this.__items[this.__items.length+s]:this.__items[s]},w.prototype.has_match=function(s){for(var r=this.__items.length-1;r>=0;r--)if(this.__items[r].match(s))return!0;return!1},w.prototype.set_indent=function(s,r){this.is_empty()&&(this.__indent_count=s||0,this.__alignment_count=r||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},w.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},w.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},w.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var s=this.__parent.current_line;return s.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),s.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),s.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,s.__items[0]===" "&&(s.__items.splice(0,1),s.__character_count-=1),!0}return!1},w.prototype.is_empty=function(){return this.__items.length===0},w.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},w.prototype.push=function(s){this.__items.push(s);var r=s.lastIndexOf(`
|
|
`);r!==-1?this.__character_count=s.length-r:this.__character_count+=s.length},w.prototype.pop=function(){var s=null;return this.is_empty()||(s=this.__items.pop(),this.__character_count-=s.length),s},w.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},w.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},w.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},w.prototype.toString=function(){var s="";return this.is_empty()?this.__parent.indent_empty_lines&&(s=this.__parent.get_indent_string(this.__indent_count)):(s=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),s+=this.__items.join("")),s};function y(s,r){this.__cache=[""],this.__indent_size=s.indent_size,this.__indent_string=s.indent_char,s.indent_with_tabs||(this.__indent_string=new Array(s.indent_size+1).join(s.indent_char)),r=r||"",s.indent_level>0&&(r=new Array(s.indent_level+1).join(this.__indent_string)),this.__base_string=r,this.__base_string_length=r.length}y.prototype.get_indent_size=function(s,r){var i=this.__base_string_length;return r=r||0,s<0&&(i=0),i+=s*this.__indent_size,i+=r,i},y.prototype.get_indent_string=function(s,r){var i=this.__base_string;return r=r||0,s<0&&(s=0,i=""),r+=s*this.__indent_size,this.__ensure_cache(r),i+=this.__cache[r],i},y.prototype.__ensure_cache=function(s){for(;s>=this.__cache.length;)this.__add_column()},y.prototype.__add_column=function(){var s=this.__cache.length,r=0,i="";this.__indent_size&&s>=this.__indent_size&&(r=Math.floor(s/this.__indent_size),s-=r*this.__indent_size,i=new Array(r+1).join(this.__indent_string)),s&&(i+=new Array(s+1).join(" ")),this.__cache.push(i)};function _(s,r){this.__indent_cache=new y(s,r),this.raw=!1,this._end_with_newline=s.end_with_newline,this.indent_size=s.indent_size,this.wrap_line_length=s.wrap_line_length,this.indent_empty_lines=s.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new w(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}_.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},_.prototype.get_line_number=function(){return this.__lines.length},_.prototype.get_indent_string=function(s,r){return this.__indent_cache.get_indent_string(s,r)},_.prototype.get_indent_size=function(s,r){return this.__indent_cache.get_indent_size(s,r)},_.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},_.prototype.add_new_line=function(s){return this.is_empty()||!s&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},_.prototype.get_code=function(s){this.trim(!0);var r=this.current_line.pop();r&&(r[r.length-1]===`
|
|
`&&(r=r.replace(/\n+$/g,"")),this.current_line.push(r)),this._end_with_newline&&this.__add_outputline();var i=this.__lines.join(`
|
|
`);return s!==`
|
|
`&&(i=i.replace(/[\n]/g,s)),i},_.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},_.prototype.set_indent=function(s,r){return s=s||0,r=r||0,this.next_line.set_indent(s,r),this.__lines.length>1?(this.current_line.set_indent(s,r),!0):(this.current_line.set_indent(),!1)},_.prototype.add_raw_token=function(s){for(var r=0;r<s.newlines;r++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(s.whitespace_before),this.current_line.push(s.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},_.prototype.add_token=function(s){this.__add_space_before_token(),this.current_line.push(s),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},_.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},_.prototype.remove_indent=function(s){for(var r=this.__lines.length;s<r;)this.__lines[s]._remove_indent(),s++;this.current_line._remove_wrap_indent()},_.prototype.trim=function(s){for(s=s===void 0?!1:s,this.current_line.trim();s&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},_.prototype.just_added_newline=function(){return this.current_line.is_empty()},_.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},_.prototype.ensure_empty_line_above=function(s,r){for(var i=this.__lines.length-2;i>=0;){var u=this.__lines[i];if(u.is_empty())break;if(u.item(0).indexOf(s)!==0&&u.item(-1)!==r){this.__lines.splice(i+1,0,new w(this)),this.previous_line=this.__lines[this.__lines.length-2];break}i--}},O.exports.Output=_},,,,function(O){function w(s,r){this.raw_options=y(s,r),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}w.prototype._get_array=function(s,r){var i=this.raw_options[s],u=r||[];return typeof i=="object"?i!==null&&typeof i.concat=="function"&&(u=i.concat()):typeof i=="string"&&(u=i.split(/[^a-zA-Z0-9_\/\-]+/)),u},w.prototype._get_boolean=function(s,r){var i=this.raw_options[s],u=i===void 0?!!r:!!i;return u},w.prototype._get_characters=function(s,r){var i=this.raw_options[s],u=r||"";return typeof i=="string"&&(u=i.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),u},w.prototype._get_number=function(s,r){var i=this.raw_options[s];r=parseInt(r,10),isNaN(r)&&(r=0);var u=parseInt(i,10);return isNaN(u)&&(u=r),u},w.prototype._get_selection=function(s,r,i){var u=this._get_selection_list(s,r,i);if(u.length!==1)throw new Error("Invalid Option Value: The option '"+s+`' can only be one of the following values:
|
|
`+r+`
|
|
You passed in: '`+this.raw_options[s]+"'");return u[0]},w.prototype._get_selection_list=function(s,r,i){if(!r||r.length===0)throw new Error("Selection list cannot be empty.");if(i=i||[r[0]],!this._is_valid_selection(i,r))throw new Error("Invalid Default Value!");var u=this._get_array(s,i);if(!this._is_valid_selection(u,r))throw new Error("Invalid Option Value: The option '"+s+`' can contain only the following values:
|
|
`+r+`
|
|
You passed in: '`+this.raw_options[s]+"'");return u},w.prototype._is_valid_selection=function(s,r){return s.length&&r.length&&!s.some(function(i){return r.indexOf(i)===-1})};function y(s,r){var i={};s=_(s);var u;for(u in s)u!==r&&(i[u]=s[u]);if(r&&s[r])for(u in s[r])i[u]=s[r][u];return i}function _(s){var r={},i;for(i in s){var u=i.replace(/-/g,"_");r[u]=s[i]}return r}O.exports.Options=w,O.exports.normalizeOpts=_,O.exports.mergeOpts=y},,function(O){var w=RegExp.prototype.hasOwnProperty("sticky");function y(_){this.__input=_||"",this.__input_length=this.__input.length,this.__position=0}y.prototype.restart=function(){this.__position=0},y.prototype.back=function(){this.__position>0&&(this.__position-=1)},y.prototype.hasNext=function(){return this.__position<this.__input_length},y.prototype.next=function(){var _=null;return this.hasNext()&&(_=this.__input.charAt(this.__position),this.__position+=1),_},y.prototype.peek=function(_){var s=null;return _=_||0,_+=this.__position,_>=0&&_<this.__input_length&&(s=this.__input.charAt(_)),s},y.prototype.__match=function(_,s){_.lastIndex=s;var r=_.exec(this.__input);return r&&!(w&&_.sticky)&&(r.index!==s&&(r=null)),r},y.prototype.test=function(_,s){return s=s||0,s+=this.__position,s>=0&&s<this.__input_length?!!this.__match(_,s):!1},y.prototype.testChar=function(_,s){var r=this.peek(s);return _.lastIndex=0,r!==null&&_.test(r)},y.prototype.match=function(_){var s=this.__match(_,this.__position);return s?this.__position+=s[0].length:s=null,s},y.prototype.read=function(_,s,r){var i="",u;return _&&(u=this.match(_),u&&(i+=u[0])),s&&(u||!_)&&(i+=this.readUntil(s,r)),i},y.prototype.readUntil=function(_,s){var r="",i=this.__position;_.lastIndex=this.__position;var u=_.exec(this.__input);return u?(i=u.index,s&&(i+=u[0].length)):i=this.__input_length,r=this.__input.substring(this.__position,i),this.__position=i,r},y.prototype.readUntilAfter=function(_){return this.readUntil(_,!0)},y.prototype.get_regexp=function(_,s){var r=null,i="g";return s&&w&&(i="y"),typeof _=="string"&&_!==""?r=new RegExp(_,i):_&&(r=new RegExp(_.source,i)),r},y.prototype.get_literal_regexp=function(_){return RegExp(_.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},y.prototype.peekUntilAfter=function(_){var s=this.__position,r=this.readUntilAfter(_);return this.__position=s,r},y.prototype.lookBack=function(_){var s=this.__position-1;return s>=_.length&&this.__input.substring(s-_.length,s).toLowerCase()===_},O.exports.InputScanner=y},,,,,function(O){function w(y,_){y=typeof y=="string"?y:y.source,_=typeof _=="string"?_:_.source,this.__directives_block_pattern=new RegExp(y+/ beautify( \w+[:]\w+)+ /.source+_,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(y+/\sbeautify\signore:end\s/.source+_,"g")}w.prototype.get_directives=function(y){if(!y.match(this.__directives_block_pattern))return null;var _={};this.__directive_pattern.lastIndex=0;for(var s=this.__directive_pattern.exec(y);s;)_[s[1]]=s[2],s=this.__directive_pattern.exec(y);return _},w.prototype.readIgnored=function(y){return y.readUntilAfter(this.__directives_end_ignore_pattern)},O.exports.Directives=w},,function(O,w,y){var _=y(16).Beautifier,s=y(17).Options;function r(i,u){var l=new _(i,u);return l.beautify()}O.exports=r,O.exports.defaultOptions=function(){return new s}},function(O,w,y){var _=y(17).Options,s=y(2).Output,r=y(8).InputScanner,i=y(13).Directives,u=new i(/\/\*/,/\*\//),l=/\r\n|[\r\n]/,e=/\r\n|[\r\n]/g,t=/\s/,n=/(?:\s|\n)+/g,T=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,b=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function g(E,v){this._source_text=E||"",this._options=new _(v),this._ch=null,this._input=null,this.NESTED_AT_RULE={"@page":!0,"@font-face":!0,"@keyframes":!0,"@media":!0,"@supports":!0,"@document":!0},this.CONDITIONAL_GROUP_RULE={"@media":!0,"@supports":!0,"@document":!0},this.NON_SEMICOLON_NEWLINE_PROPERTY=["grid-template-areas","grid-template"]}g.prototype.eatString=function(E){var v="";for(this._ch=this._input.next();this._ch;){if(v+=this._ch,this._ch==="\\")v+=this._input.next();else if(E.indexOf(this._ch)!==-1||this._ch===`
|
|
`)break;this._ch=this._input.next()}return v},g.prototype.eatWhitespace=function(E){for(var v=t.test(this._input.peek()),p=0;t.test(this._input.peek());)this._ch=this._input.next(),E&&this._ch===`
|
|
`&&((p===0||p<this._options.max_preserve_newlines)&&(p++,this._output.add_new_line(!0)));return v},g.prototype.foundNestedPseudoClass=function(){for(var E=0,v=1,p=this._input.peek(v);p;){if(p==="{")return!0;if(p==="(")E+=1;else if(p===")"){if(E===0)return!1;E-=1}else if(p===";"||p==="}")return!1;v++,p=this._input.peek(v)}return!1},g.prototype.print_string=function(E){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(E)},g.prototype.preserveSingleSpace=function(E){E&&(this._output.space_before_token=!0)},g.prototype.indent=function(){this._indentLevel++},g.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},g.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var E=this._source_text,v=this._options.eol;v==="auto"&&(v=`
|
|
`,E&&l.test(E||"")&&(v=E.match(l)[0])),E=E.replace(e,`
|
|
`);var p=E.match(/^[\t ]*/)[0];this._output=new s(this._options,p),this._input=new r(E),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var d=0,a=!1,o=!1,c=!1,f=!1,S=!1,A=!1,R=this._ch,B=!1,U,K,D;U=this._input.read(n),K=U!=="",D=R,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),R=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var H=this._input.read(T),V=u.get_directives(H);V&&V.ignore==="start"&&(H+=u.readIgnored(this._input)),this.print_string(H),this.eatWhitespace(!0),this._output.add_new_line()}else if(this._ch==="/"&&this._input.peek()==="/")this._output.space_before_token=!0,this._input.back(),this.print_string(this._input.read(b)),this.eatWhitespace(!0);else if(this._ch==="@"||this._ch==="$")if(this.preserveSingleSpace(K),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var ne=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);ne.match(/[ :]$/)&&(ne=this.eatString(": ").replace(/\s$/,""),this.print_string(ne),this._output.space_before_token=!0),ne=ne.replace(/\s$/,""),ne==="extend"?f=!0:ne==="import"&&(S=!0),ne in this.NESTED_AT_RULE?(this._nestedLevel+=1,ne in this.CONDITIONAL_GROUP_RULE&&(c=!0)):!a&&d===0&&ne.indexOf(":")!==-1&&(o=!0,this.indent())}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(K),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")o&&(o=!1,this.outdent()),c?(c=!1,a=this._indentLevel>=this._nestedLevel):a=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&a&&(this._output.previous_line&&this._output.previous_line.item(-1)!=="{"&&this._output.ensure_empty_line_above("/",",")),this._output.space_before_token=!0,this._options.brace_style==="expand"?(this._output.add_new_line(),this.print_string(this._ch),this.indent(),this._output.set_indent(this._indentLevel)):(D==="("?this._output.space_before_token=!1:D!==","&&this.indent(),this.print_string(this._ch)),this.eatWhitespace(!0),this._output.add_new_line();else if(this._ch==="}")this.outdent(),this._output.add_new_line(),D==="{"&&this._output.trim(!0),S=!1,f=!1,o&&(this.outdent(),o=!1),this.print_string(this._ch),a=!1,this._nestedLevel&&this._nestedLevel--,this.eatWhitespace(!0),this._output.add_new_line(),this._options.newline_between_rules&&!this._output.just_added_blankline()&&(this._input.peek()!=="}"&&this._output.add_new_line(!0)),this._input.peek()===")"&&(this._output.trim(!0),this._options.brace_style==="expand"&&this._output.add_new_line(!0));else if(this._ch===":"){for(var ie=0;ie<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;ie++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[ie])){B=!0;break}(a||c)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!f&&d===0?(this.print_string(":"),o||(o=!0,this._output.space_before_token=!0,this.eatWhitespace(!0),this.indent())):(this._input.lookBack(" ")&&(this._output.space_before_token=!0),this._input.peek()===":"?(this._ch=this._input.next(),this.print_string("::")):this.print_string(":"))}else if(this._ch==='"'||this._ch==="'"){var _e=D==='"'||D==="'";this.preserveSingleSpace(_e||K),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")B=!1,d===0?(o&&(this.outdent(),o=!1),f=!1,S=!1,this.print_string(this._ch),this.eatWhitespace(!0),this._input.peek()!=="/"&&this._output.add_new_line()):(this.print_string(this._ch),this.eatWhitespace(!0),this._output.space_before_token=!0);else if(this._ch==="(")if(this._input.lookBack("url"))this.print_string(this._ch),this.eatWhitespace(),d++,this.indent(),this._ch=this._input.next(),this._ch===")"||this._ch==='"'||this._ch==="'"?this._input.back():this._ch&&(this.print_string(this._ch+this.eatString(")")),d&&(d--,this.outdent()));else{var ye=!1;this._input.lookBack("with")&&(ye=!0),this.preserveSingleSpace(K||ye),this.print_string(this._ch),o&&D==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),A=!0):(this.eatWhitespace(),d++,this.indent())}else if(this._ch===")")d&&(d--,this.outdent()),A&&this._input.peek()===";"&&this._options.selector_separator_newline&&(A=!1,this.outdent(),this._output.add_new_line()),this.print_string(this._ch);else if(this._ch===",")this.print_string(this._ch),this.eatWhitespace(!0),this._options.selector_separator_newline&&(!o||A)&&d===0&&!S&&!f?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!o&&d===0)this._options.space_around_combinator?(this._output.space_before_token=!0,this.print_string(this._ch),this._output.space_before_token=!0):(this.print_string(this._ch),this.eatWhitespace(),this._ch&&t.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(K),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),t.test(this._ch)&&(this._ch="");else if(this._ch==="!"&&!this._input.lookBack("\\"))this._output.space_before_token=!0,this.print_string(this._ch);else{var be=D==='"'||D==="'";this.preserveSingleSpace(be||K),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
|
|
`&&B&&this._output.add_new_line()}var we=this._output.get_code(v);return we},O.exports.Beautifier=g},function(O,w,y){var _=y(6).Options;function s(r){_.call(this,r,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var i=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||i;var u=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var l=0;l<u.length;l++)u[l]!=="expand"?this.brace_style="collapse":this.brace_style=u[l]}s.prototype=new _,O.exports.Options=s}],L={};function F(O){var w=L[O];if(w!==void 0)return w.exports;var y=L[O]={exports:{}};return x[O](y,y.exports,F),y.exports}var N=F(15);C=N})();var k=C;!(pe=[],j=function(){return{css_beautify:k}}.apply(ft,pe),j!==void 0&&(xt.exports=j))})()},ZW9T:function(xt,ft,se){"use strict";se.d(ft,"a",function(){return U});var pe=se("k1fw"),j=se("miYZ"),C=se("tsqr"),k=se("rAM+"),x=se("tJVT"),L=se("PpiC"),F=se("q1tI"),N=se.n(F),O=se("bdgK"),w=se("oBTY"),y=se("9og8"),_=se("WmNS"),s=se.n(_),r={keywords:["print","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"]},i={quickKey:[{label:"main",content:["public static void main(String[] args) {"," $0","}"].join(`
|
|
`)},{label:"System.out.println",content:["System.out.println($0)"].join(`
|
|
`)},{label:"System.out.print",content:["System.out.print($0)"].join(`
|
|
`)}],keywords:["abstract","continue","for","new","switch","assert","default","goto","package","synchronized","boolean","do","if","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","true","false"]},u={keywords:["abstract","amp","array","auto","bool","break","case","catch","char","class","const","constexpr","const_cast","continue","cpu","decltype","default","delegate","delete","do","double","dynamic_cast","each","else","enum","event","explicit","export","extern","false","final","finally","float","for","friend","gcnew","generic","goto","if","in","initonly","inline","int","interface","interior_ptr","internal","literal","long","mutable","namespace","new","noexcept","nullptr","__nullptr","operator","override","partial","pascal","pin_ptr","private","property","protected","public","ref","register","reinterpret_cast","restrict","return","safe_cast","sealed","short","signed","sizeof","static","static_assert","static_cast","struct","switch","template","this","thread_local","throw","tile_static","true","try","typedef","typeid","typename","union","unsigned","using","virtual","void","volatile","wchar_t","where","while","_asm","_based","_cdecl","_declspec","_fastcall","_if_exists","_if_not_exists","_inline","_multiple_inheritance","_pascal","_single_inheritance","_stdcall","_virtual_inheritance","_w64","__abstract","__alignof","__asm","__assume","__based","__box","__builtin_alignof","__cdecl","__clrcall","__declspec","__delegate","__event","__except","__fastcall","__finally","__forceinline","__gc","__hook","__identifier","__if_exists","__if_not_exists","__inline","__int128","__int16","__int32","__int64","__int8","__interface","__leave","__m128","__m128d","__m128i","__m256","__m256d","__m256i","__m64","__multiple_inheritance","__newslot","__nogc","__noop","__nounwind","__novtordisp","__pascal","__pin","__pragma","__property","__ptr32","__ptr64","__raise","__restrict","__resume","__sealed","__single_inheritance","__stdcall","__super","__thiscall","__try","__try_cast","__typeof","__unaligned","__unhook","__uuidof","__value","__virtual_inheritance","__w64","__wchar_t"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],quickKey:[{label:"ifelse",content:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`)},{label:"#include",content:'include "$0"'},{label:"printf",content:"printf($0)"},{label:"main",content:["int main () {"," $0","}"].join(`
|
|
`)},{label:"for",content:["for( ; ; ){"," $0","}"].join(`
|
|
`)},{label:"trycatch",content:["try{"," $0","}catch(ExceptionName e){","}"].join(`
|
|
`)},{label:"using namespace std;",content:["using namespace std;"].join(`
|
|
`)},{label:"#include <iostream>",content:["#include <iostream>"].join(`
|
|
`)},{label:"#include <vector>",content:["#include <vector>"].join(`
|
|
`)},{label:"#include <sstream>",content:["#include <sstream>"].join(`
|
|
`)},{label:"#include <string>",content:["#include <string>"].join(`
|
|
`)},{label:"#include <cmath>",content:["#include <cmath>"].join(`
|
|
`)}]},l={keywords:["and","as","assert","break","class","continue","def","del","elif","else","except","exec","finally","for","from","global","if","import","in","is","lambda","None","not","or","pass","raise","return","self","try","while","with","yield","int","float","long","complex","hex","abs","all","any","apply","basestring","bin","bool","buffer","bytearray","callable","chr","classmethod","cmp","coerce","compile","complex","delattr","dict","dir","divmod","enumerate","eval","execfile","file","filter","format","frozenset","getattr","globals","hasattr","hash","help","id","input","intern","isinstance","issubclass","iter","len","locals","list","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","reversed","range","raw_input","reduce","reload","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","unichr","unicode","vars","xrange","zip","True","False","__dict__","__methods__","__members__","__class__","__bases__","__name__","__mro__","__subclasses__","__init__","__import__"],quickKey:[{label:"print",content:["print($0)"].join(`
|
|
`)}]},e=se("5VLF"),t=se.n(e),n={languages:["c","abap","apex","azcli","bat","cameligo","clojure","coffee","cpp","csharp","csp","css","dockerfile","fsharp","go","graphql","handlebars","html","ini","java","javascript","json","kotlin","less","lua","markdown","mips","msdax","mysql","objective-c","pascal","pascaligo","perl","pgsql","php","postiats","powerquery","powershell","pug","python","r","razor","redis","redshift","restructuredtext","ruby","rust","sb","scheme","scss","shell","solidity","sophia","sql","st","swift","tcl","twig","vb","xml","yaml'"],tables:{users:["name","id","email","phone","password"],roles:["id","name","order","created_at","updated_at","deleted_at"]}},T=function(D,H){return H.map(function(V){return{label:V,kind:D.languages.CompletionItemKind.Keyword,insertText:V}})},b=function(D){return Object.keys(n.tables).map(function(H){return{label:H,kind:D.languages.CompletionItemKind.Variable,insertText:H}})},g=function(D,H){var V=n.tables[D];return V?V.map(function(ne){return{label:ne,kind:H.languages.CompletionItemKind.Field,insertText:ne}}):[]};function E(K,D,H,V,ne){var ie=D.getWordUntilPosition(H),_e={startLineNumber:H.lineNumber,endLineNumber:H.lineNumber,startColumn:ie.startColumn,endColumn:ie.endColumn},ye=V.map(function(be){return{label:be,kind:K.languages.CompletionItemKind.Keyword,insertText:be,insertTextRules:K.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:_e}});return ne.map(function(be){ye.push(Object(pe.a)(Object(pe.a)({},be),{},{range:_e}))}),ye}var v=function(K){n.languages.map(function(ne){return K.languages.registerDocumentFormattingEditProvider(ne,{provideDocumentFormattingEdits:function(_e,ye,be){return Object(y.a)(s.a.mark(function we(){var Re;return s.a.wrap(function(Q){for(;;)switch(Q.prev=Q.next){case 0:return Re=t()(_e.getValue(),{indent_size:"2",indent_char:" ",max_preserve_newlines:"2",preserve_newlines:!0,keep_array_indentation:!0,break_chained_methods:!1,indent_scripts:"normal",brace_style:"collapse",space_before_conditional:!0,unescape_strings:!1,jslint_happy:!1,end_with_newline:!0,wrap_line_length:"0",indent_inner_html:!1,comma_first:!1,e4x:!1,indent_empty_lines:!1}),Q.abrupt("return",[{range:_e.getFullModelRange(),text:Re}]);case 2:case"end":return Q.stop()}},we)}))()}}),ne});var D=u.quickKey.map(function(ne){return{label:ne.label,kind:K.languages.CompletionItemKind.Method,insertText:ne.content,insertTextRules:K.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),H=l.quickKey.map(function(ne){return{label:ne.label,kind:K.languages.CompletionItemKind.Method,insertText:ne.content,insertTextRules:K.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),V=i.quickKey.map(function(ne){return{label:ne.label,kind:K.languages.CompletionItemKind.Method,insertText:ne.content,insertTextRules:K.languages.CompletionItemInsertTextRule.InsertAsSnippet}});K.languages.registerCompletionItemProvider("cpp",{triggerCharacters:["."," ","#"].concat(Object(w.a)(u.keywords),Object(w.a)(u.quickKey.map(function(ne){return ne.label}))),provideCompletionItems:function(ie,_e){var ye=ie.getValueInRange({startLineNumber:_e.lineNumber,startColumn:1,endLineNumber:_e.lineNumber,endColumn:_e.column}),be=ye.match(/cu/gim);console.log("match:",be,_e,ye,ie);var we=[],Re=_e.lineNumber,ge=_e.column,Q=ie.getValueInRange({startLineNumber:Re,startColumn:0,endLineNumber:Re,endColumn:ge}),Pe=Q.trim().split(/\s+/),$e=Pe[Pe.length-1];if($e.endsWith(".")){var Fe=$e.slice(0,$e.length-1);Object.keys(n.tables).includes(Fe)&&(we=Object(w.a)(g(Fe,K)))}else $e==="."?we=[]:we=[].concat(Object(w.a)(b(K)),Object(w.a)(T(K,u.keywords)),Object(w.a)(D));return{suggestions:we}}}),K.languages.registerCompletionItemProvider("c",{triggerCharacters:["."," ","#"].concat(Object(w.a)(r.keywords)),provideCompletionItems:function(ie,_e){var ye=ie.getValueInRange({startLineNumber:_e.lineNumber,startColumn:1,endLineNumber:_e.lineNumber,endColumn:_e.column}),be=ye.match(/cu/gim);console.log("match:",be,_e,ye,ie);var we=[],Re=_e.lineNumber,ge=_e.column,Q=ie.getValueInRange({startLineNumber:Re,startColumn:0,endLineNumber:Re,endColumn:ge}),Pe=Q.trim().split(/\s+/),$e=Pe[Pe.length-1];if($e.endsWith(".")){var Fe=$e.slice(0,$e.length-1);Object.keys(n.tables).includes(Fe)&&(we=Object(w.a)(g(Fe,K)))}else $e==="."?we=[]:we=[].concat(Object(w.a)(b(K)),Object(w.a)(T(K,r.keywords)));return{suggestions:we}}}),K.languages.registerCompletionItemProvider("java",{triggerCharacters:["."," "].concat(Object(w.a)(i.keywords)),provideCompletionItems:function(ie,_e){var ye=[],be=_e.lineNumber,we=_e.column,Re=ie.getValueInRange({startLineNumber:be,startColumn:0,endLineNumber:be,endColumn:we}),ge=Re.trim().split(/\s+/),Q=ge[ge.length-1];if(Q.endsWith(".")){var Pe=Q.slice(0,Q.length-1);Object.keys(n.tables).includes(Pe)&&(ye=Object(w.a)(g(Pe,K)))}else Q==="."?ye=[]:ye=[].concat(Object(w.a)(b(K)),Object(w.a)(T(K,i.keywords)),Object(w.a)(V));return{suggestions:ye}}}),K.languages.registerCompletionItemProvider("python",{triggerCharacters:["."," "].concat(Object(w.a)(l.keywords)),provideCompletionItems:function(ie,_e){var ye=[],be=_e.lineNumber,we=_e.column,Re=ie.getValueInRange({startLineNumber:be,startColumn:0,endLineNumber:be,endColumn:we}),ge=Re.trim().split(/\s+/),Q=ge[ge.length-1];if(Q.endsWith(".")){var Pe=Q.slice(0,Q.length-1);Object.keys(n.tables).includes(Pe)&&(ye=Object(w.a)(g(Pe,K)))}else Q==="."?ye=[]:ye=[].concat(Object(w.a)(b(K)),Object(w.a)(T(K,l.keywords)),Object(w.a)(H));return{suggestions:ye}}})},p="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",d=se("LvDl"),a=se("+ua5");function o(K){return/^\d+$/.test(K)?"".concat(K,"px"):K}function c(){}var f=!1,S={"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 A(){var K=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],D=K;if(Array.isArray(K)){for(var H=0;H<K.length;H++){var V=S[K[H]];if(V)return V}return D[0]}return S[D]||D}var R=null,B=ft.b=function(K){var D=K.width,H=D===void 0?"100%":D,V=K.height,ne=V===void 0?"100%":V,ie=K.value,_e=K.language,ye=_e===void 0?"javascript":_e,be=K.style,we=be===void 0?{}:be,Re=K.options,ge=Re===void 0?{}:Re,Q=K.overrideServices,Pe=Q===void 0?{}:Q,$e=K.theme,Fe=$e===void 0?"vs-dark":$e,Me=K.onEditBlur,ze=K.onSave,xe=K.autoHeight,ke=xe===void 0?!1:xe,je=K.forbidCopy,Ge=je===void 0?!1:je,Ue=K.onChange,Le=Ue===void 0?c:Ue,Ae=K.editorDidMount,nt=Ae===void 0?c:Ae,Qe=K.onFocus,Ze=Qe===void 0?c:Qe,Ye=K.filename,at=Ye===void 0?"educoder.txt":Ye,qe=K.errorLine,Xe=K.errorContent,Be=Xe===void 0?"":Xe,rt=Object(L.a)(K,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),Je=Object(F.useRef)(),Ee=Object(F.useRef)({}),He=Object(F.useRef)(),de=Object(F.useRef)(!1),oe=Object(F.useRef)(),ue=Object(F.useState)(!1),Y=Object(x.a)(ue,2),X=Y[0],Z=Y[1];function ae(){var We;return Je.current&&(We=new O.default(function(pt){var It=Object(k.a)(pt),Tt;try{for(It.s();!(Tt=It.n()).done;){var di=Tt.value;(di.target.offsetHeight>0||di.target.offsetWidth>0)&&Ee.current.instance.layout()}}catch(Ri){It.e(Ri)}finally{It.f()}}),We.observe(Je.current)),We}function ve(){C.b.warn(decodeURIComponent(p))}var Se=function(){var pt=Ee.current.instance;if(ie!=null&&pt&&X){var It=pt.getModel();It&&ie!==It.getValue()&&(f=!0,It.setValue(ie),pt.layout(),f=!1)}};Object(F.useEffect)(function(){He.current&&clearTimeout(He.current),He.current=setTimeout(function(){Se()},500)},[ie,X,Ee.current]),Object(F.useEffect)(function(){if(qe&&Ee.current&&Ee.current.instance){var We=Ee.current.instance;We.changeViewZones(function(It){var Tt=document.createElement("div");Tt.style.padding="10px 20px",Tt.style.width="calc(100% - 20px)",Tt.className="my-error-line-wrp",Tt.innerHTML=Be,It.addZone({afterLineNumber:qe||11,heightInLines:3,domNode:Tt})});var pt={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};We.addOverlayWidget(pt),We.revealPositionInCenter({lineNumber:20,column:1})}},[qe,Ee.current,X]);function Ne(){var We=Ee.current.instance;if(We){var pt=We.getSelection(),It=Ee.current.pastePos||{},Tt=new R.Range(It.startLineNumber||pt.endLineNumber,It.startColumn||pt.endColumn,It.endLineNumber||pt.endLineNumber,It.endColumn||pt.endColumn);setTimeout(function(){We.executeEdits("",[{range:Tt,text:""}])},300)}}function st(We){(window.navigator.platform.match("Mac")?We.metaKey:We.ctrlKey)&&We.keyCode==83&&(We.preventDefault(),ze())}var dt=function(){if(ke&&Ee.current.instance){var pt=Ee.current.instance.getContentHeight();ei(pt<ne?ne:pt)}else ei(ne)};function ut(We){var pt=document.createEvent("MouseEvents");pt.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),We.dispatchEvent(pt)}function wt(We,pt){var It=window.URL||window.webkitURL||window,Tt=new Blob([pt]),di=document.createElementNS("http://www.w3.org/1999/xhtml","a");di.href=It.createObjectURL(Tt),di.download=We,ut(di)}Object(F.useEffect)(function(){dt()},[dt]),Object(F.useEffect)(function(){Je.current&&!X&&se.e(27).then(se.t.bind(null,"M/lh",7)).then(function(We){try{R=We,Ee.current.instance=R.editor.create(Je.current,{value:ie,language:A(ye),theme:Fe,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},Pe);var pt=Ee.current.instance;if(nt(pt,R),setTimeout(function(){dt(),Ee.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){wt(at||"educoder.txt",pt.getValue())}})},500),Ee.current.subscription=pt.onDidChangeModelContent(function(Tt){de.current?clearTimeout(oe.current):(dt(),Le(pt.getValue(),Tt)),oe.current=setTimeout(function(){de.current=!1},500)}),window.Monaco||v(R),Ge&&(pt.addCommand(R.KeyMod.CtrlCmd|R.KeyMod.Shift|R.KeyCode.KEY_V,function(){return ve(),null}),pt.addCommand(R.KeyMod.CtrlCmd|R.KeyCode.KEY_C,function(){return ve(),null})),window.Monaco=R,Me&&pt.onDidBlurEditorWidget(function(){Me(pt.getValue())}),Ze&&pt.onDidFocusEditorText(function(){Ze(pt.getValue())}),Ge){pt.addCommand(R.KeyMod.CtrlCmd|R.KeyCode.KEY_V,function(){return ve(),null}),pt.onDidPaste(function(Tt){Ee.current.pastePos=Tt});try{window.addEventListener("paste",Ne)}catch(Tt){}}var It=ae();return Z(!0),function(){var Tt=Ee.current.instance;Tt.dispose();var di=Tt.getModel();di&&di.dispose(),Ee.current.subscription&&Ee.current.subscription.dispose(),Ge&&window.removeEventListener("paste",Ne),It.unobserve(Je.current)}}catch(Tt){}})},[]),Object(F.useEffect)(function(){var We=Ee.current.instance;if(We&&X)return document.addEventListener("keydown",st,!1),function(){document.removeEventListener("keydown",st)}},[ze,X]),Object(F.useEffect)(function(){var We=Ee.current.instance;if(We&&X){var pt=A(ye);R.editor.setModelLanguage(We.getModel(),pt),console.log("language:",ye,We.getModel(),pt)}},[ye,X]),Object(F.useEffect)(function(){var We=Ee.current.instance;We&&X&&R.editor.setTheme(Fe)},[Fe,X]),Object(F.useEffect)(function(){var We=Ee.current.instance;We&&X&&(We.updateOptions(Object(pe.a)({},ge)),setTimeout(function(){We.getModel().updateOptions(Object(pe.a)({},ge))},200))},[JSON.stringify(ge),X]),Object(F.useEffect)(function(){var We=Ee.current.instance;We&&X&&We.layout()},[H,ne,X]);var Et=Object(F.useState)(o(H)),et=Object(x.a)(Et,2),Vt=et[0],Ft=et[1],Zt=Object(F.useState)(o(ne)),Xt=Object(x.a)(Zt,2),gt=Xt[0],ei=Xt[1],pi=Object(pe.a)(Object(pe.a)({},we),{},{width:Vt,height:gt});return N.a.createElement("div",{className:"my-monaco-editor",ref:Je,style:pi})};function U(K){var D=K.width,H=D===void 0?"100%":D,V=K.height,ne=V===void 0?"100%":V,ie=K.original,_e=K.modified,ye=K.language,be=K.options,we=be===void 0?{}:be,Re=Object(F.useRef)(),ge=Object(F.useState)(null),Q=Object(x.a)(ge,2),Pe=Q[0],$e=Q[1];function Fe(ke){var je;return Re.current&&(je=new O.default(function(Ge){var Ue=Object(k.a)(Ge),Le;try{for(Ue.s();!(Le=Ue.n()).done;){var Ae=Le.value;(Ae.target.offsetHeight>0||Ae.target.offsetWidth>0)&&ke.layout()}}catch(nt){Ue.e(nt)}finally{Ue.f()}}),je.observe(Re.current)),je}Object(F.useEffect)(function(){Re.current&&se.e(27).then(se.t.bind(null,"M/lh",7)).then(function(ke){R=ke;var je=R.editor.createDiffEditor(Re.current,Object(pe.a)(Object(pe.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},we),{},{wordWrap:!0}));$e(je);var Ge=Fe(je);return function(){je.dispose();var Ue=je.getModel();Ue&&Ue.dispose(),Ge.unobserve(Re.current)}})},[]),Object(F.useEffect)(function(){Pe&&Pe.setModel({original:R.editor.createModel(ie,ye),modified:R.editor.createModel(_e,ye)})},[ie,_e,ye,Pe]);var Me=o(H),ze=o(ne),xe={width:Me,height:ze};return N.a.createElement("div",{className:"my-diff-editor",ref:Re,style:xe})}},bT9E:function(xt,ft,se){"use strict";se.d(ft,"a",function(){return j});var pe=se("VTBJ");function j(C,k){var x=Object(pe.a)({},C);return Array.isArray(k)&&k.forEach(function(L){delete x[L]}),x}},k3GJ:function(xt,ft,se){"use strict";se.d(ft,"a",function(){return $n});var pe=se("rePB"),j=se("ODXe"),C=se("Ff2n"),k=se("VTBJ"),x=se("q1tI"),L=se("TSYQ"),F=se.n(L),N=se("Zm9Q"),O=se("6cGi"),w=se("KQm4"),y=se("xEkU"),_=se.n(y),s=se("t23M");function r(J){var le=Object(x.useRef)(),ce=Object(x.useRef)(!1);function ee(){for(var G=arguments.length,$=new Array(G),z=0;z<G;z++)$[z]=arguments[z];ce.current||(_.a.cancel(le.current),le.current=_()(function(){J.apply(void 0,$)}))}return Object(x.useEffect)(function(){return function(){ce.current=!0,_.a.cancel(le.current)}},[]),ee}function i(J){var le=Object(x.useRef)([]),ce=Object(x.useState)({}),ee=Object(j.a)(ce,2),G=ee[1],$=Object(x.useRef)(typeof J=="function"?J():J),z=r(function(){var te=$.current;le.current.forEach(function(fe){te=fe(te)}),le.current=[],$.current=te,G({})});function q(te){le.current.push(te),z()}return[$.current,q]}var u=se("4IlW");function l(J,le){var ce,ee=J.prefixCls,G=J.id,$=J.active,z=J.rtl,q=J.tab,te=q.key,fe=q.tab,he=q.disabled,me=q.closeIcon,Te=J.tabBarGutter,De=J.tabPosition,Ie=J.closable,Ke=J.renderWrapper,ht=J.removeAriaLabel,_t=J.editable,mt=J.onClick,St=J.onRemove,bt=J.onFocus,vt="".concat(ee,"-tab");x.useEffect(function(){return St},[]);var yt={};De==="top"||De==="bottom"?yt[z?"marginLeft":"marginRight"]=Te:yt.marginBottom=Te;var Lt=_t&&Ie!==!1&&!he;function Ct(lt){if(he)return;mt(lt)}function Jt(lt){lt.preventDefault(),lt.stopPropagation(),_t.onEdit("remove",{key:te,event:lt})}var Ut=x.createElement("div",{key:te,ref:le,className:F()(vt,(ce={},Object(pe.a)(ce,"".concat(vt,"-with-remove"),Lt),Object(pe.a)(ce,"".concat(vt,"-active"),$),Object(pe.a)(ce,"".concat(vt,"-disabled"),he),ce)),style:yt,onClick:Ct},x.createElement("div",{role:"tab","aria-selected":$,id:G&&"".concat(G,"-tab-").concat(te),className:"".concat(vt,"-btn"),"aria-controls":G&&"".concat(G,"-panel-").concat(te),"aria-disabled":he,tabIndex:he?null:0,onClick:function(ot){ot.stopPropagation(),Ct(ot)},onKeyDown:function(ot){[u.a.SPACE,u.a.ENTER].includes(ot.which)&&(ot.preventDefault(),Ct(ot))},onFocus:bt},fe),Lt&&x.createElement("button",{type:"button","aria-label":ht||"remove",tabIndex:0,className:"".concat(vt,"-remove"),onClick:function(ot){ot.stopPropagation(),Jt(ot)}},me||_t.removeIcon||"\xD7"));return Ke&&(Ut=Ke(Ut)),Ut}var e=x.forwardRef(l),t={width:0,height:0,left:0,top:0};function n(J,le,ce){return Object(x.useMemo)(function(){for(var ee,G=new Map,$=le.get((ee=J[0])===null||ee===void 0?void 0:ee.key)||t,z=$.left+$.width,q=0;q<J.length;q+=1){var te=J[q].key,fe=le.get(te);if(!fe){var he;fe=le.get((he=J[q-1])===null||he===void 0?void 0:he.key)||t}var me=G.get(te)||Object(k.a)({},fe);me.right=z-me.left-me.width,G.set(te,me)}return G},[J.map(function(ee){return ee.key}).join("_"),le,ce])}var T={width:0,height:0,left:0,top:0,right:0};function b(J,le,ce,ee,G){var $=G.tabs,z=G.tabPosition,q=G.rtl,te,fe,he;["top","bottom"].includes(z)?(te="width",fe=q?"right":"left",he=Math.abs(le.left)):(te="height",fe="top",he=-le.top);var me=le[te],Te=ce[te],De=ee[te],Ie=me;return Te+De>me&&(Ie=me-De),Object(x.useMemo)(function(){if(!$.length)return[0,0];for(var Ke=$.length,ht=Ke,_t=0;_t<Ke;_t+=1){var mt=J.get($[_t].key)||T;if(mt[fe]+mt[te]>he+Ie){ht=_t-1;break}}for(var St=0,bt=Ke-1;bt>=0;bt-=1){var vt=J.get($[bt].key)||T;if(vt[fe]<he){St=bt+1;break}}return[St,ht]},[J,he,Ie,z,$.map(function(Ke){return Ke.key}).join("_"),q])}var g=se("wx14"),E=se("1OyB"),v=se("vuIU"),p=se("JX7q"),d=se("Ji7U"),a=se("LK+K"),o=se("I8Z2"),c=se("bT9E"),f=se("2GS6"),S=se("Gytx"),A=se.n(S),R=se("U8pU"),B=/iPhone/i,U=/iPod/i,K=/iPad/i,D=/\bAndroid(?:.+)Mobile\b/i,H=/Android/i,V=/\bAndroid(?:.+)SD4930UR\b/i,ne=/\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i,ie=/Windows Phone/i,_e=/\bWindows(?:.+)ARM\b/i,ye=/BlackBerry/i,be=/BB10/i,we=/Opera Mini/i,Re=/\b(CriOS|Chrome)(?:.+)Mobile/i,ge=/Mobile(?:.+)Firefox\b/i;function Q(J,le){return J.test(le)}function Pe(J){var le=J||(typeof navigator!="undefined"?navigator.userAgent:""),ce=(le||"").split("[FBAN");if(typeof ce[1]!="undefined"){var ee=ce,G=Object(j.a)(ee,1);le=G[0]}if(ce=le.split("Twitter"),typeof ce[1]!="undefined"){var $=ce,z=Object(j.a)($,1);le=z[0]}var q={apple:{phone:Q(B,le)&&!Q(ie,le),ipod:Q(U,le),tablet:!Q(B,le)&&Q(K,le)&&!Q(ie,le),device:(Q(B,le)||Q(U,le)||Q(K,le))&&!Q(ie,le)},amazon:{phone:Q(V,le),tablet:!Q(V,le)&&Q(ne,le),device:Q(V,le)||Q(ne,le)},android:{phone:!Q(ie,le)&&Q(V,le)||!Q(ie,le)&&Q(D,le),tablet:!Q(ie,le)&&!Q(V,le)&&!Q(D,le)&&(Q(ne,le)||Q(H,le)),device:!Q(ie,le)&&(Q(V,le)||Q(ne,le)||Q(D,le)||Q(H,le))||Q(/\bokhttp\b/i,le)},windows:{phone:Q(ie,le),tablet:Q(_e,le),device:Q(ie,le)||Q(_e,le)},other:{blackberry:Q(ye,le),blackberry10:Q(be,le),opera:Q(we,le),firefox:Q(ge,le),chrome:Q(Re,le),device:Q(ye,le)||Q(be,le)||Q(we,le)||Q(ge,le)||Q(Re,le)},any:null,phone:null,tablet:null};return q.any=q.apple.device||q.android.device||q.windows.device||q.other.device,q.phone=q.apple.phone||q.android.phone||q.windows.phone,q.tablet=q.apple.tablet||q.android.tablet||q.windows.tablet,q}var $e=Object(k.a)(Object(k.a)({},Pe()),{},{isMobile:Pe}),Fe=$e;function Me(){}function ze(J,le,ce){var ee=le||"";return J.key||"".concat(ee,"item_").concat(ce)}function xe(J){return"".concat(J,"-menu-")}function ke(J,le){var ce=-1;x.Children.forEach(J,function(ee){ce+=1,ee&&ee.type&&ee.type.isMenuItemGroup?x.Children.forEach(ee.props.children,function(G){ce+=1,le(G,ce)}):le(ee,ce)})}function je(J,le,ce){if(!J||ce.find)return;x.Children.forEach(J,function(ee){if(ee){var G=ee.type;if(!G||!(G.isSubMenu||G.isMenuItem||G.isMenuItemGroup))return;le.indexOf(ee.key)!==-1?ce.find=!0:ee.props.children&&je(ee.props.children,le,ce)}})}var Ge=["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"],Ue=function(le){var ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ee=le&&typeof le.getBoundingClientRect=="function"&&le.getBoundingClientRect().width;if(ee){if(ce){var G=getComputedStyle(le),$=G.marginLeft,z=G.marginRight;ee+=+$.replace("px","")+ +z.replace("px","")}ee=+ee.toFixed(6)}return ee||0},Le=function(le,ce,ee){le&&Object(R.a)(le.style)==="object"&&(le.style[ce]=ee)},Ae=function(){return Fe.any},nt=se("bdgK"),Qe=se("i8i4"),Ze=se.n(Qe),Ye=se("wgJM"),at=se("l4aY"),qe=se("m+aA"),Xe=se("c+Xe"),Be=se("zT1h"),rt=se("QC+M");function Je(J,le,ce){return ce?J[0]===le[0]:J[0]===le[0]&&J[1]===le[1]}function Ee(J,le,ce){var ee=J[le]||{};return Object(k.a)(Object(k.a)({},ee),ce)}function He(J,le,ce,ee){for(var G=ce.points,$=Object.keys(J),z=0;z<$.length;z+=1){var q=$[z];if(Je(J[q].points,G,ee))return"".concat(le,"-placement-").concat(q)}return""}var de=function(){if(typeof navigator=="undefined"||typeof window=="undefined")return!1;var J=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(J)||/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(J==null?void 0:J.substr(0,4)))},oe=se("MNnm");function ue(J,le){var ce={};return ce[J.toLowerCase()]=le.toLowerCase(),ce["Webkit".concat(J)]="webkit".concat(le),ce["Moz".concat(J)]="moz".concat(le),ce["ms".concat(J)]="MS".concat(le),ce["O".concat(J)]="o".concat(le.toLowerCase()),ce}function Y(J,le){var ce={animationend:ue("Animation","AnimationEnd"),transitionend:ue("Transition","TransitionEnd")};return J&&("AnimationEvent"in le||delete ce.animationend.animation,"TransitionEvent"in le||delete ce.transitionend.transition),ce}var X=Y(Object(oe.a)(),typeof window!="undefined"?window:{}),Z={};if(Object(oe.a)()){var ae=document.createElement("div");Z=ae.style}var ve={};function Se(J){if(ve[J])return ve[J];var le=X[J];if(le)for(var ce=Object.keys(le),ee=ce.length,G=0;G<ee;G+=1){var $=ce[G];if(Object.prototype.hasOwnProperty.call(le,$)&&$ in Z)return ve[J]=le[$],ve[J]}return""}var Ne=Se("animationend"),st=Se("transitionend"),dt=!!(Ne&&st),ut=Ne||"animationend",wt=st||"transitionend";function Et(J,le){if(!J)return null;if(Object(R.a)(J)==="object"){var ce=le.replace(/-\w/g,function(ee){return ee[1].toUpperCase()});return J[ce]}return"".concat(J,"-").concat(le)}var et="none",Vt="appear",Ft="enter",Zt="leave",Xt="none",gt="prepare",ei="start",pi="active",We="end";function pt(J){var le=Object(x.useRef)(!1),ce=Object(x.useState)(J),ee=Object(j.a)(ce,2),G=ee[0],$=ee[1];function z(q){le.current||$(q)}return Object(x.useEffect)(function(){return function(){le.current=!0}},[]),[G,z]}var It=Object(oe.a)()?x.useLayoutEffect:x.useEffect,Tt=It,di=function(){var J=x.useRef(null);function le(){Ye.a.cancel(J.current)}function ce(ee){var G=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;le();var $=Object(Ye.a)(function(){G<=1?ee({isCanceled:function(){return $!==J.current}}):ce(ee,G-1)});J.current=$}return x.useEffect(function(){return function(){le()}},[]),[ce,le]},Ri=[gt,ei,pi,We],Ai=!1,vi=!0;function zi(J){return J===pi||J===We}var sn=function(J,le){var ce=x.useState(Xt),ee=Object(j.a)(ce,2),G=ee[0],$=ee[1],z=di(),q=Object(j.a)(z,2),te=q[0],fe=q[1];function he(){$(gt)}return Tt(function(){if(G!==Xt&&G!==We){var me=Ri.indexOf(G),Te=Ri[me+1],De=le(G);De===Ai?$(Te):te(function(Ie){function Ke(){if(Ie.isCanceled())return;$(Te)}De===!0?Ke():Promise.resolve(De).then(Ke)})}},[J,G]),x.useEffect(function(){return function(){fe()}},[]),[he,G]},Vi=function(J){var le=Object(x.useRef)(),ce=Object(x.useRef)(J);ce.current=J;var ee=x.useCallback(function(z){ce.current(z)},[]);function G(z){z&&(z.removeEventListener(wt,ee),z.removeEventListener(ut,ee))}function $(z){le.current&&le.current!==z&&G(le.current),z&&z!==le.current&&(z.addEventListener(wt,ee),z.addEventListener(ut,ee),le.current=z)}return x.useEffect(function(){return function(){G(le.current)}},[]),[$,G]};function mn(J,le,ce,ee){var G=ee.motionEnter,$=G===void 0?!0:G,z=ee.motionAppear,q=z===void 0?!0:z,te=ee.motionLeave,fe=te===void 0?!0:te,he=ee.motionDeadline,me=ee.motionLeaveImmediately,Te=ee.onAppearPrepare,De=ee.onEnterPrepare,Ie=ee.onLeavePrepare,Ke=ee.onAppearStart,ht=ee.onEnterStart,_t=ee.onLeaveStart,mt=ee.onAppearActive,St=ee.onEnterActive,bt=ee.onLeaveActive,vt=ee.onAppearEnd,yt=ee.onEnterEnd,Lt=ee.onLeaveEnd,Ct=ee.onVisibleChanged,Jt=pt(),Ut=Object(j.a)(Jt,2),lt=Ut[0],ot=Ut[1],Ot=pt(et),At=Object(j.a)(Ot,2),tt=At[0],Dt=At[1],Kt=pt(null),Pt=Object(j.a)(Kt,2),Ht=Pt[0],Yt=Pt[1],oi=Object(x.useRef)(!1),mi=Object(x.useRef)(null),Qt=Object(x.useRef)(!1),gi=Object(x.useRef)(null);function Ti(){var zt=ce();return zt||gi.current}var yi=Object(x.useRef)(!1);function _i(zt){var Nt=Ti();if(zt&&!zt.deadline&&zt.target!==Nt)return;var ui;tt===Vt&&yi.current?ui=vt==null?void 0:vt(Nt,zt):tt===Ft&&yi.current?ui=yt==null?void 0:yt(Nt,zt):tt===Zt&&yi.current&&(ui=Lt==null?void 0:Lt(Nt,zt)),ui!==!1&&!Qt.current&&(Dt(et),Yt(null))}var qt=Vi(_i),fi=Object(j.a)(qt,1),li=fi[0],ni=x.useMemo(function(){var zt,Nt,ui;switch(tt){case"appear":return zt={},Object(pe.a)(zt,gt,Te),Object(pe.a)(zt,ei,Ke),Object(pe.a)(zt,pi,mt),zt;case"enter":return Nt={},Object(pe.a)(Nt,gt,De),Object(pe.a)(Nt,ei,ht),Object(pe.a)(Nt,pi,St),Nt;case"leave":return ui={},Object(pe.a)(ui,gt,Ie),Object(pe.a)(ui,ei,_t),Object(pe.a)(ui,pi,bt),ui;default:return{}}},[tt]),wi=sn(tt,function(zt){if(zt===gt){var Nt=ni[gt];return Nt?Nt(Ti()):Ai}if(Wt in ni){var ui;Yt(((ui=ni[Wt])===null||ui===void 0?void 0:ui.call(ni,Ti(),null))||null)}return Wt===pi&&(li(Ti()),he>0&&(clearTimeout(mi.current),mi.current=setTimeout(function(){_i({deadline:!0})},he))),vi}),Ci=Object(j.a)(wi,2),Di=Ci[0],Wt=Ci[1],xi=zi(Wt);yi.current=xi,Tt(function(){ot(le);var zt=oi.current;if(oi.current=!0,!J)return;var Nt;!zt&&le&&q&&(Nt=Vt),zt&&le&&$&&(Nt=Ft),(zt&&!le&&fe||!zt&&me&&!le&&fe)&&(Nt=Zt),Nt&&(Dt(Nt),Di())},[le]),Object(x.useEffect)(function(){(tt===Vt&&!q||tt===Ft&&!$||tt===Zt&&!fe)&&Dt(et)},[q,$,fe]),Object(x.useEffect)(function(){return function(){clearTimeout(mi.current),Qt.current=!0}},[]),Object(x.useEffect)(function(){lt!==void 0&&tt===et&&(Ct==null||Ct(lt))},[lt,tt]);var Pi=Ht;return ni[gt]&&Wt===ei&&(Pi=Object(k.a)({transition:"none"},Pi)),[tt,Wt,Pi,lt!=null?lt:le]}var Mi=function(J){Object(d.a)(ce,J);var le=Object(a.a)(ce);function ce(){return Object(E.a)(this,ce),le.apply(this,arguments)}return Object(v.a)(ce,[{key:"render",value:function(){return this.props.children}}]),ce}(x.Component),gn=Mi;function vn(J){var le=J;Object(R.a)(J)==="object"&&(le=J.transitionSupport);function ce(G){return!!(G.motionName&&le)}var ee=x.forwardRef(function(G,$){var z=G.visible,q=z===void 0?!0:z,te=G.removeOnLeave,fe=te===void 0?!0:te,he=G.forceRender,me=G.children,Te=G.motionName,De=G.leavedClassName,Ie=G.eventProps,Ke=ce(G),ht=Object(x.useRef)(),_t=Object(x.useRef)();function mt(){try{return Object(qe.a)(ht.current||_t.current)}catch(Dt){return null}}var St=mn(Ke,q,mt,G),bt=Object(j.a)(St,4),vt=bt[0],yt=bt[1],Lt=bt[2],Ct=bt[3],Jt=x.useRef(Ct);Ct&&(Jt.current=!0);var Ut=Object(x.useRef)($);Ut.current=$;var lt=x.useCallback(function(Dt){ht.current=Dt,Object(Xe.b)(Ut.current,Dt)},[]),ot,Ot=Object(k.a)(Object(k.a)({},Ie),{},{visible:q});if(!me)ot=null;else if(vt===et||!ce(G))Ct?ot=me(Object(k.a)({},Ot),lt):!fe&&Jt.current?ot=me(Object(k.a)(Object(k.a)({},Ot),{},{className:De}),lt):he?ot=me(Object(k.a)(Object(k.a)({},Ot),{},{style:{display:"none"}}),lt):ot=null;else{var At,tt;yt===gt?tt="prepare":zi(yt)?tt="active":yt===ei&&(tt="start"),ot=me(Object(k.a)(Object(k.a)({},Ot),{},{className:F()(Et(Te,vt),(At={},Object(pe.a)(At,Et(Te,"".concat(vt,"-").concat(tt)),tt),Object(pe.a)(At,Te,typeof Te=="string"),At)),style:Lt}),lt)}return x.createElement(gn,{ref:_t},ot)});return ee.displayName="CSSMotion",ee}var on=vn(dt),Yi="add",Xi="keep",ki="remove",ln="removed";function yn(J){var le;return J&&Object(R.a)(J)==="object"&&"key"in J?le=J:le={key:J},Object(k.a)(Object(k.a)({},le),{},{key:String(le.key)})}function un(){var J=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return J.map(yn)}function M(){var J=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],ce=[],ee=0,G=le.length,$=un(J),z=un(le);$.forEach(function(fe){for(var he=!1,me=ee;me<G;me+=1){var Te=z[me];if(Te.key===fe.key){ee<me&&(ce=ce.concat(z.slice(ee,me).map(function(De){return Object(k.a)(Object(k.a)({},De),{},{status:Yi})})),ee=me),ce.push(Object(k.a)(Object(k.a)({},Te),{},{status:Xi})),ee+=1,he=!0;break}}he||ce.push(Object(k.a)(Object(k.a)({},fe),{},{status:ki}))}),ee<G&&(ce=ce.concat(z.slice(ee).map(function(fe){return Object(k.a)(Object(k.a)({},fe),{},{status:Yi})})));var q={};ce.forEach(function(fe){var he=fe.key;q[he]=(q[he]||0)+1});var te=Object.keys(q).filter(function(fe){return q[fe]>1});return te.forEach(function(fe){ce=ce.filter(function(he){var me=he.key,Te=he.status;return me!==fe||Te!==ki}),ce.forEach(function(he){he.key===fe&&(he.status=Xi)})}),ce}var h=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function m(J){var le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:on,ce=function(ee){Object(d.a)($,ee);var G=Object(a.a)($);function $(){var z;return Object(E.a)(this,$),z=G.apply(this,arguments),z.state={keyEntities:[]},z.removeKey=function(q){z.setState(function(te){var fe=te.keyEntities;return{keyEntities:fe.map(function(he){return he.key!==q?he:Object(k.a)(Object(k.a)({},he),{},{status:ln})})}})},z}return Object(v.a)($,[{key:"render",value:function(){var q=this,te=this.state.keyEntities,fe=this.props,he=fe.component,me=fe.children,Te=fe.onVisibleChanged,De=Object(C.a)(fe,["component","children","onVisibleChanged"]),Ie=he||x.Fragment,Ke={};return h.forEach(function(ht){Ke[ht]=De[ht],delete De[ht]}),delete De.keys,x.createElement(Ie,De,te.map(function(ht){var _t=ht.status,mt=Object(C.a)(ht,["status"]),St=_t===Yi||_t===Xi;return x.createElement(le,Object(g.a)({},Ke,{key:mt.key,visible:St,eventProps:mt,onVisibleChanged:function(vt){Te==null||Te(vt,{key:mt.key}),vt||q.removeKey(mt.key)}}),me)}))}}],[{key:"getDerivedStateFromProps",value:function(q,te){var fe=q.keys,he=te.keyEntities,me=un(fe),Te=M(he,me);return{keyEntities:Te.filter(function(De){var Ie=he.find(function(Ke){var ht=Ke.key;return De.key===ht});return!(Ie&&Ie.status===ln&&De.status===ki)})}}}]),$}(x.Component);return ce.defaultProps={component:"div"},ce}var I=m(dt),W=on;function P(J){var le=J.prefixCls,ce=J.motion,ee=J.animation,G=J.transitionName;return ce||(ee?{motionName:"".concat(le,"-").concat(ee)}:G?{motionName:G}:null)}function re(J){var le=J.prefixCls,ce=J.visible,ee=J.zIndex,G=J.mask,$=J.maskMotion,z=J.maskAnimation,q=J.maskTransitionName;if(!G)return null;var te={};return($||q||z)&&(te=Object(k.a)({motionAppear:!0},P({motion:$,prefixCls:le,transitionName:q,animation:z}))),x.createElement(W,Object(g.a)({},te,{visible:ce,removeOnLeave:!0}),function(fe){var he=fe.className;return x.createElement("div",{style:{zIndex:ee},className:F()("".concat(le,"-mask"),he)})})}var Ce=se("9mu1"),Ve=se("o0o1"),it=se.n(Ve),Oe=se("HaE+"),ct=["measure","align",null,"motion"],kt=function(J,le){var ce=Object(x.useState)(null),ee=Object(j.a)(ce,2),G=ee[0],$=ee[1],z=Object(x.useRef)(),q=Object(x.useRef)(!1);function te(me){q.current||$(me)}function fe(){Ye.a.cancel(z.current)}function he(me){fe(),z.current=Object(Ye.a)(function(){te(function(Te){switch(G){case"align":return"motion";case"motion":return"stable";default:}return Te}),me==null||me()})}return Object(x.useEffect)(function(){te("measure")},[J]),Object(x.useEffect)(function(){switch(G){case"measure":le();break;default:}G&&(z.current=Object(Ye.a)(Object(Oe.a)(it.a.mark(function me(){var Te,De;return it.a.wrap(function(Ke){for(;;)switch(Ke.prev=Ke.next){case 0:Te=ct.indexOf(G),De=ct[Te+1],De&&Te!==-1&&te(De);case 3:case"end":return Ke.stop()}},me)}))))},[G]),Object(x.useEffect)(function(){return function(){q.current=!0,fe()}},[]),[G,he]},Gt=function(J){var le=x.useState({width:0,height:0}),ce=Object(j.a)(le,2),ee=ce[0],G=ce[1];function $(q){G({width:q.offsetWidth,height:q.offsetHeight})}var z=x.useMemo(function(){var q={};if(J){var te=ee.width,fe=ee.height;J.indexOf("height")!==-1&&fe?q.height=fe:J.indexOf("minHeight")!==-1&&fe&&(q.minHeight=fe),J.indexOf("width")!==-1&&te?q.width=te:J.indexOf("minWidth")!==-1&&te&&(q.minWidth=te)}return q},[J,ee]);return[z,$]},Ei=x.forwardRef(function(J,le){var ce=J.visible,ee=J.prefixCls,G=J.className,$=J.style,z=J.children,q=J.zIndex,te=J.stretch,fe=J.destroyPopupOnHide,he=J.forceRender,me=J.align,Te=J.point,De=J.getRootDomNode,Ie=J.getClassNameFromAlign,Ke=J.onAlign,ht=J.onMouseEnter,_t=J.onMouseLeave,mt=J.onMouseDown,St=J.onTouchStart,bt=Object(x.useRef)(),vt=Object(x.useRef)(),yt=Object(x.useState)(),Lt=Object(j.a)(yt,2),Ct=Lt[0],Jt=Lt[1],Ut=Gt(te),lt=Object(j.a)(Ut,2),ot=lt[0],Ot=lt[1];function At(){te&&Ot(De())}var tt=kt(ce,At),Dt=Object(j.a)(tt,2),Kt=Dt[0],Pt=Dt[1],Ht=Object(x.useRef)();function Yt(){return Te||De}function oi(){var qt;(qt=bt.current)===null||qt===void 0||qt.forceAlign()}function mi(qt,fi){var li=Ie(fi);Ct!==li&&Jt(li),Kt==="align"&&(Ct!==li?Promise.resolve().then(function(){oi()}):Pt(function(){var ni;(ni=Ht.current)===null||ni===void 0||ni.call(Ht)}),Ke==null||Ke(qt,fi))}var Qt=Object(k.a)({},P(J));["onAppearEnd","onEnterEnd","onLeaveEnd"].forEach(function(qt){var fi=Qt[qt];Qt[qt]=function(li,ni){return Pt(),fi==null?void 0:fi(li,ni)}});function gi(){return new Promise(function(qt){Ht.current=qt})}x.useEffect(function(){!Qt.motionName&&Kt==="motion"&&Pt()},[Qt.motionName,Kt]),x.useImperativeHandle(le,function(){return{forceAlign:oi,getElement:function(){return vt.current}}});var Ti=Object(k.a)(Object(k.a)({},ot),{},{zIndex:q,opacity:Kt==="motion"||Kt==="stable"||!ce?void 0:0,pointerEvents:Kt==="stable"?void 0:"none"},$),yi=!0;(me==null?void 0:me.points)&&(Kt==="align"||Kt==="stable")&&(yi=!1);var _i=z;return x.Children.count(z)>1&&(_i=x.createElement("div",{className:"".concat(ee,"-content")},z)),x.createElement(W,Object(g.a)({visible:ce,ref:vt,leavedClassName:"".concat(ee,"-hidden")},Qt,{onAppearPrepare:gi,onEnterPrepare:gi,removeOnLeave:fe,forceRender:he}),function(qt,fi){var li=qt.className,ni=qt.style,wi=F()(ee,G,Ct,li);return x.createElement(Ce.a,{target:Yt(),key:"popup",ref:bt,monitorWindowResize:!0,disabled:yi,align:me,onAlign:mi},x.createElement("div",{ref:fi,className:wi,onMouseEnter:ht,onMouseLeave:_t,onMouseDownCapture:mt,onTouchStartCapture:St,style:Object(k.a)(Object(k.a)({},ni),Ti)},_i))})});Ei.displayName="PopupInner";var Ii=Ei,hi=x.forwardRef(function(J,le){var ce=J.prefixCls,ee=J.visible,G=J.zIndex,$=J.children,z=J.mobile;z=z===void 0?{}:z;var q=z.popupClassName,te=z.popupStyle,fe=z.popupMotion,he=fe===void 0?{}:fe,me=z.popupRender,Te=x.useRef();x.useImperativeHandle(le,function(){return{forceAlign:function(){},getElement:function(){return Te.current}}});var De=Object(k.a)({zIndex:G},te),Ie=$;return x.Children.count($)>1&&(Ie=x.createElement("div",{className:"".concat(ce,"-content")},$)),me&&(Ie=me(Ie)),x.createElement(W,Object(g.a)({visible:ee,ref:Te,removeOnLeave:!0},he),function(Ke,ht){var _t=Ke.className,mt=Ke.style,St=F()(ce,q,_t);return x.createElement("div",{ref:ht,className:St,style:Object(k.a)(Object(k.a)({},mt),De)},Ie)})});hi.displayName="MobilePopupInner";var Si=hi,_n=["visible","mobile"],$i=x.forwardRef(function(J,le){var ce=J.visible,ee=J.mobile,G=Object(C.a)(J,_n),$=Object(x.useState)(ce),z=Object(j.a)($,2),q=z[0],te=z[1],fe=Object(x.useState)(!1),he=Object(j.a)(fe,2),me=he[0],Te=he[1],De=Object(k.a)(Object(k.a)({},G),{},{visible:q});Object(x.useEffect)(function(){te(ce),ce&&ee&&Te(de())},[ce,ee]);var Ie=me?x.createElement(Si,Object(g.a)({},De,{mobile:ee,ref:le})):x.createElement(Ii,Object(g.a)({},De,{ref:le}));return x.createElement("div",null,x.createElement(re,De),Ie)});$i.displayName="Popup";var Ni=$i,Li=x.createContext(null),hn=Li;function Ui(){}function bn(){return""}function Bi(J){return J?J.ownerDocument:window.document}var En=["onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur","onContextMenu"];function Tn(J){var le=function(ce){Object(d.a)(G,ce);var ee=Object(a.a)(G);function G($){var z;Object(E.a)(this,G),z=ee.call(this,$),z.popupRef=x.createRef(),z.triggerRef=x.createRef(),z.attachId=void 0,z.clickOutsideHandler=void 0,z.touchOutsideHandler=void 0,z.contextMenuOutsideHandler1=void 0,z.contextMenuOutsideHandler2=void 0,z.mouseDownTimeout=void 0,z.focusTime=void 0,z.preClickTime=void 0,z.preTouchTime=void 0,z.delayTimer=void 0,z.hasPopupMouseDown=void 0,z.onMouseEnter=function(te){var fe=z.props.mouseEnterDelay;z.fireEvents("onMouseEnter",te),z.delaySetPopupVisible(!0,fe,fe?null:te)},z.onMouseMove=function(te){z.fireEvents("onMouseMove",te),z.setPoint(te)},z.onMouseLeave=function(te){z.fireEvents("onMouseLeave",te),z.delaySetPopupVisible(!1,z.props.mouseLeaveDelay)},z.onPopupMouseEnter=function(){z.clearDelayTimer()},z.onPopupMouseLeave=function(te){var fe;if(te.relatedTarget&&!te.relatedTarget.setTimeout&&Object(at.a)((fe=z.popupRef.current)===null||fe===void 0?void 0:fe.getElement(),te.relatedTarget))return;z.delaySetPopupVisible(!1,z.props.mouseLeaveDelay)},z.onFocus=function(te){z.fireEvents("onFocus",te),z.clearDelayTimer(),z.isFocusToShow()&&(z.focusTime=Date.now(),z.delaySetPopupVisible(!0,z.props.focusDelay))},z.onMouseDown=function(te){z.fireEvents("onMouseDown",te),z.preClickTime=Date.now()},z.onTouchStart=function(te){z.fireEvents("onTouchStart",te),z.preTouchTime=Date.now()},z.onBlur=function(te){z.fireEvents("onBlur",te),z.clearDelayTimer(),z.isBlurToHide()&&z.delaySetPopupVisible(!1,z.props.blurDelay)},z.onContextMenu=function(te){te.preventDefault(),z.fireEvents("onContextMenu",te),z.setPopupVisible(!0,te)},z.onContextMenuClose=function(){z.isContextMenuToShow()&&z.close()},z.onClick=function(te){if(z.fireEvents("onClick",te),z.focusTime){var fe;if(z.preClickTime&&z.preTouchTime?fe=Math.min(z.preClickTime,z.preTouchTime):z.preClickTime?fe=z.preClickTime:z.preTouchTime&&(fe=z.preTouchTime),Math.abs(fe-z.focusTime)<20)return;z.focusTime=0}z.preClickTime=0,z.preTouchTime=0,z.isClickToShow()&&(z.isClickToHide()||z.isBlurToHide())&&te&&te.preventDefault&&te.preventDefault();var he=!z.state.popupVisible;(z.isClickToHide()&&!he||he&&z.isClickToShow())&&z.setPopupVisible(!z.state.popupVisible,te)},z.onPopupMouseDown=function(){if(z.hasPopupMouseDown=!0,clearTimeout(z.mouseDownTimeout),z.mouseDownTimeout=window.setTimeout(function(){z.hasPopupMouseDown=!1},0),z.context){var te;(te=z.context).onPopupMouseDown.apply(te,arguments)}},z.onDocumentClick=function(te){if(z.props.mask&&!z.props.maskClosable)return;var fe=te.target,he=z.getRootDomNode(),me=z.getPopupDomNode();(!Object(at.a)(he,fe)||z.isContextMenuOnly())&&!Object(at.a)(me,fe)&&!z.hasPopupMouseDown&&z.close()},z.getRootDomNode=function(){var te=z.props.getTriggerDOMNode;if(te)return te(z.triggerRef.current);try{var fe=Object(qe.a)(z.triggerRef.current);if(fe)return fe}catch(he){}return Ze.a.findDOMNode(Object(p.a)(z))},z.getPopupClassNameFromAlign=function(te){var fe=[],he=z.props,me=he.popupPlacement,Te=he.builtinPlacements,De=he.prefixCls,Ie=he.alignPoint,Ke=he.getPopupClassNameFromAlign;return me&&Te&&fe.push(He(Te,De,te,Ie)),Ke&&fe.push(Ke(te)),fe.join(" ")},z.getComponent=function(){var te=z.props,fe=te.prefixCls,he=te.destroyPopupOnHide,me=te.popupClassName,Te=te.onPopupAlign,De=te.popupMotion,Ie=te.popupAnimation,Ke=te.popupTransitionName,ht=te.popupStyle,_t=te.mask,mt=te.maskAnimation,St=te.maskTransitionName,bt=te.maskMotion,vt=te.zIndex,yt=te.popup,Lt=te.stretch,Ct=te.alignPoint,Jt=te.mobile,Ut=te.forceRender,lt=z.state,ot=lt.popupVisible,Ot=lt.point,At=z.getPopupAlign(),tt={};return z.isMouseEnterToShow()&&(tt.onMouseEnter=z.onPopupMouseEnter),z.isMouseLeaveToHide()&&(tt.onMouseLeave=z.onPopupMouseLeave),tt.onMouseDown=z.onPopupMouseDown,tt.onTouchStart=z.onPopupMouseDown,x.createElement(Ni,Object(g.a)({prefixCls:fe,destroyPopupOnHide:he,visible:ot,point:Ct&&Ot,className:me,align:At,onAlign:Te,animation:Ie,getClassNameFromAlign:z.getPopupClassNameFromAlign},tt,{stretch:Lt,getRootDomNode:z.getRootDomNode,style:ht,mask:_t,zIndex:vt,transitionName:Ke,maskAnimation:mt,maskTransitionName:St,maskMotion:bt,ref:z.popupRef,motion:De,mobile:Jt,forceRender:Ut}),typeof yt=="function"?yt():yt)},z.attachParent=function(te){Ye.a.cancel(z.attachId);var fe=z.props,he=fe.getPopupContainer,me=fe.getDocument,Te=z.getRootDomNode(),De;he?(Te||he.length===0)&&(De=he(Te)):De=me(z.getRootDomNode()).body,De?De.appendChild(te):z.attachId=Object(Ye.a)(function(){z.attachParent(te)})},z.getContainer=function(){var te=z.props.getDocument,fe=te(z.getRootDomNode()).createElement("div");return fe.style.position="absolute",fe.style.top="0",fe.style.left="0",fe.style.width="100%",z.attachParent(fe),fe},z.setPoint=function(te){var fe=z.props.alignPoint;if(!fe||!te)return;z.setState({point:{pageX:te.pageX,pageY:te.pageY}})},z.handlePortalUpdate=function(){z.state.prevPopupVisible!==z.state.popupVisible&&z.props.afterPopupVisibleChange(z.state.popupVisible)},z.triggerContextValue={onPopupMouseDown:z.onPopupMouseDown};var q;return"popupVisible"in $?q=!!$.popupVisible:q=!!$.defaultPopupVisible,z.state={prevPopupVisible:q,popupVisible:q},En.forEach(function(te){z["fire".concat(te)]=function(fe){z.fireEvents(te,fe)}}),z}return Object(v.a)(G,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var z=this.props,q=this.state;if(q.popupVisible){var te;!this.clickOutsideHandler&&(this.isClickToHide()||this.isContextMenuToShow())&&(te=z.getDocument(this.getRootDomNode()),this.clickOutsideHandler=Object(Be.a)(te,"mousedown",this.onDocumentClick)),this.touchOutsideHandler||(te=te||z.getDocument(this.getRootDomNode()),this.touchOutsideHandler=Object(Be.a)(te,"touchstart",this.onDocumentClick)),!this.contextMenuOutsideHandler1&&this.isContextMenuToShow()&&(te=te||z.getDocument(this.getRootDomNode()),this.contextMenuOutsideHandler1=Object(Be.a)(te,"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),Ye.a.cancel(this.attachId)}},{key:"getPopupDomNode",value:function(){var z;return((z=this.popupRef.current)===null||z===void 0?void 0:z.getElement())||null}},{key:"getPopupAlign",value:function(){var z=this.props,q=z.popupPlacement,te=z.popupAlign,fe=z.builtinPlacements;return q&&fe?Ee(fe,q,te):te}},{key:"setPopupVisible",value:function(z,q){var te=this.props.alignPoint,fe=this.state.popupVisible;this.clearDelayTimer(),fe!==z&&("popupVisible"in this.props||this.setState({popupVisible:z,prevPopupVisible:fe}),this.props.onPopupVisibleChange(z)),te&&q&&z&&this.setPoint(q)}},{key:"delaySetPopupVisible",value:function(z,q,te){var fe=this,he=q*1e3;if(this.clearDelayTimer(),he){var me=te?{pageX:te.pageX,pageY:te.pageY}:null;this.delayTimer=window.setTimeout(function(){fe.setPopupVisible(z,me),fe.clearDelayTimer()},he)}else this.setPopupVisible(z,te)}},{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(z){var q=this.props.children.props,te=this.props;return q[z]&&te[z]?this["fire".concat(z)]:q[z]||te[z]}},{key:"isClickToShow",value:function(){var z=this.props,q=z.action,te=z.showAction;return q.indexOf("click")!==-1||te.indexOf("click")!==-1}},{key:"isContextMenuOnly",value:function(){var z=this.props.action;return z==="contextMenu"||z.length===1&&z[0]==="contextMenu"}},{key:"isContextMenuToShow",value:function(){var z=this.props,q=z.action,te=z.showAction;return q.indexOf("contextMenu")!==-1||te.indexOf("contextMenu")!==-1}},{key:"isClickToHide",value:function(){var z=this.props,q=z.action,te=z.hideAction;return q.indexOf("click")!==-1||te.indexOf("click")!==-1}},{key:"isMouseEnterToShow",value:function(){var z=this.props,q=z.action,te=z.showAction;return q.indexOf("hover")!==-1||te.indexOf("mouseEnter")!==-1}},{key:"isMouseLeaveToHide",value:function(){var z=this.props,q=z.action,te=z.hideAction;return q.indexOf("hover")!==-1||te.indexOf("mouseLeave")!==-1}},{key:"isFocusToShow",value:function(){var z=this.props,q=z.action,te=z.showAction;return q.indexOf("focus")!==-1||te.indexOf("focus")!==-1}},{key:"isBlurToHide",value:function(){var z=this.props,q=z.action,te=z.hideAction;return q.indexOf("focus")!==-1||te.indexOf("blur")!==-1}},{key:"forcePopupAlign",value:function(){if(this.state.popupVisible){var z;(z=this.popupRef.current)===null||z===void 0||z.forceAlign()}}},{key:"fireEvents",value:function(z,q){var te=this.props.children.props[z];te&&te(q);var fe=this.props[z];fe&&fe(q)}},{key:"close",value:function(){this.setPopupVisible(!1)}},{key:"render",value:function(){var z=this.state.popupVisible,q=this.props,te=q.children,fe=q.forceRender,he=q.alignPoint,me=q.className,Te=q.autoDestroy,De=x.Children.only(te),Ie={key:"trigger"};this.isContextMenuToShow()?Ie.onContextMenu=this.onContextMenu:Ie.onContextMenu=this.createTwoChains("onContextMenu"),this.isClickToHide()||this.isClickToShow()?(Ie.onClick=this.onClick,Ie.onMouseDown=this.onMouseDown,Ie.onTouchStart=this.onTouchStart):(Ie.onClick=this.createTwoChains("onClick"),Ie.onMouseDown=this.createTwoChains("onMouseDown"),Ie.onTouchStart=this.createTwoChains("onTouchStart")),this.isMouseEnterToShow()?(Ie.onMouseEnter=this.onMouseEnter,he&&(Ie.onMouseMove=this.onMouseMove)):Ie.onMouseEnter=this.createTwoChains("onMouseEnter"),this.isMouseLeaveToHide()?Ie.onMouseLeave=this.onMouseLeave:Ie.onMouseLeave=this.createTwoChains("onMouseLeave"),this.isFocusToShow()||this.isBlurToHide()?(Ie.onFocus=this.onFocus,Ie.onBlur=this.onBlur):(Ie.onFocus=this.createTwoChains("onFocus"),Ie.onBlur=this.createTwoChains("onBlur"));var Ke=F()(De&&De.props&&De.props.className,me);Ke&&(Ie.className=Ke);var ht=Object(k.a)({},Ie);Object(Xe.c)(De)&&(ht.ref=Object(Xe.a)(this.triggerRef,De.ref));var _t=x.cloneElement(De,ht),mt;return(z||this.popupRef.current||fe)&&(mt=x.createElement(J,{key:"portal",getContainer:this.getContainer,didUpdate:this.handlePortalUpdate},this.getComponent())),!z&&Te&&(mt=null),x.createElement(hn.Provider,{value:this.triggerContextValue},_t,mt)}}],[{key:"getDerivedStateFromProps",value:function(z,q){var te=z.popupVisible,fe={};return te!==void 0&&q.popupVisible!==te&&(fe.popupVisible=te,fe.prevPopupVisible=q.popupVisible),fe}}]),G}(x.Component);return le.contextType=hn,le.defaultProps={prefixCls:"rc-trigger-popup",getPopupClassNameFromAlign:bn,getDocument:Bi,onPopupVisibleChange:Ui,afterPopupVisibleChange:Ui,onPopupAlign:Ui,popupClassName:"",mouseEnterDelay:0,mouseLeaveDelay:.1,focusDelay:0,blurDelay:.15,popupStyle:{},destroyPopupOnHide:!1,popupAlign:{},defaultPopupVisible:!1,mask:!1,maskClosable:!0,action:[],showAction:[],hideAction:[],autoDestroy:!1},le}var Fi=Tn(rt.a),ai={adjustX:1,adjustY:1},ji={topLeft:{points:["bl","tl"],overflow:ai,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:ai,offset:[0,7]},leftTop:{points:["tr","tl"],overflow:ai,offset:[-4,0]},rightTop:{points:["tl","tr"],overflow:ai,offset:[4,0]}},Sn={topLeft:{points:["bl","tl"],overflow:ai,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:ai,offset:[0,7]},rightTop:{points:["tr","tl"],overflow:ai,offset:[-4,0]},leftTop:{points:["tl","tr"],overflow:ai,offset:[4,0]}},Bn=ji,ti=0,jt={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"},ii=function(le,ce,ee){var G=xe(ce),$=le.getState();le.setState({defaultActiveFirst:Object(k.a)(Object(k.a)({},$.defaultActiveFirst),{},Object(pe.a)({},G,ee))})},Mt=function(J){Object(d.a)(ce,J);var le=Object(a.a)(ce);function ce(ee){var G;Object(E.a)(this,ce),G=le.call(this,ee),G.onDestroy=function(he){G.props.onDestroy(he)},G.onKeyDown=function(he){var me=he.keyCode,Te=G.menuInstance,De=G.props.store,Ie=G.getVisible();if(me===u.a.ENTER)return G.onTitleClick(he),ii(De,G.props.eventKey,!0),!0;if(me===u.a.RIGHT)return Ie?Te.onKeyDown(he):(G.triggerOpenChange(!0),ii(De,G.props.eventKey,!0)),!0;if(me===u.a.LEFT){var Ke;if(Ie)Ke=Te.onKeyDown(he);else return;return Ke||(G.triggerOpenChange(!1),Ke=!0),Ke}return Ie&&(me===u.a.UP||me===u.a.DOWN)?Te.onKeyDown(he):void 0},G.onOpenChange=function(he){G.props.onOpenChange(he)},G.onPopupVisibleChange=function(he){G.triggerOpenChange(he,he?"mouseenter":"mouseleave")},G.onMouseEnter=function(he){var me=G.props,Te=me.eventKey,De=me.onMouseEnter,Ie=me.store;ii(Ie,G.props.eventKey,!1),De({key:Te,domEvent:he})},G.onMouseLeave=function(he){var me=G.props,Te=me.parentMenu,De=me.eventKey,Ie=me.onMouseLeave;Te.subMenuInstance=Object(p.a)(G),Ie({key:De,domEvent:he})},G.onTitleMouseEnter=function(he){var me=G.props,Te=me.eventKey,De=me.onItemHover,Ie=me.onTitleMouseEnter;De({key:Te,hover:!0}),Ie({key:Te,domEvent:he})},G.onTitleMouseLeave=function(he){var me=G.props,Te=me.parentMenu,De=me.eventKey,Ie=me.onItemHover,Ke=me.onTitleMouseLeave;Te.subMenuInstance=Object(p.a)(G),Ie({key:De,hover:!1}),Ke({key:De,domEvent:he})},G.onTitleClick=function(he){var me=Object(p.a)(G),Te=me.props;if(Te.onTitleClick({key:Te.eventKey,domEvent:he}),Te.triggerSubMenuAction==="hover")return;G.triggerOpenChange(!G.getVisible(),"click"),ii(Te.store,G.props.eventKey,!1)},G.onSubMenuClick=function(he){typeof G.props.onClick=="function"&&G.props.onClick(G.addKeyPath(he))},G.onSelect=function(he){G.props.onSelect(he)},G.onDeselect=function(he){G.props.onDeselect(he)},G.getPrefixCls=function(){return"".concat(G.props.rootPrefixCls,"-submenu")},G.getActiveClassName=function(){return"".concat(G.getPrefixCls(),"-active")},G.getDisabledClassName=function(){return"".concat(G.getPrefixCls(),"-disabled")},G.getSelectedClassName=function(){return"".concat(G.getPrefixCls(),"-selected")},G.getOpenClassName=function(){return"".concat(G.props.rootPrefixCls,"-submenu-open")},G.getVisible=function(){return G.state.isOpen},G.getMode=function(){return G.state.mode},G.saveMenuInstance=function(he){G.menuInstance=he},G.addKeyPath=function(he){return Object(k.a)(Object(k.a)({},he),{},{keyPath:(he.keyPath||[]).concat(G.props.eventKey)})},G.triggerOpenChange=function(he,me){var Te=G.props.eventKey,De=function(){G.onOpenChange({key:Te,item:Object(p.a)(G),trigger:me,open:he})};me==="mouseenter"?G.mouseenterTimeout=setTimeout(function(){De()},0):De()},G.isChildrenSelected=function(){var he={find:!1};return je(G.props.children,G.props.selectedKeys,he),he.find},G.isInlineMode=function(){return G.getMode()==="inline"},G.adjustWidth=function(){if(!G.subMenuTitle||!G.menuInstance)return;var he=Qe.findDOMNode(G.menuInstance);if(he.offsetWidth>=G.subMenuTitle.offsetWidth)return;he.style.minWidth="".concat(G.subMenuTitle.offsetWidth,"px")},G.saveSubMenuTitle=function(he){G.subMenuTitle=he},G.getBaseProps=function(){var he=Object(p.a)(G),me=he.props,Te=G.getMode();return{mode:Te==="horizontal"?"vertical":Te,visible:G.getVisible(),level:me.level+1,inlineIndent:me.inlineIndent,focusable:!1,onClick:G.onSubMenuClick,onSelect:G.onSelect,onDeselect:G.onDeselect,onDestroy:G.onDestroy,selectedKeys:me.selectedKeys,eventKey:"".concat(me.eventKey,"-menu-"),openKeys:me.openKeys,motion:me.motion,onOpenChange:G.onOpenChange,subMenuOpenDelay:me.subMenuOpenDelay,parentMenu:Object(p.a)(G),subMenuCloseDelay:me.subMenuCloseDelay,forceSubMenuRender:me.forceSubMenuRender,triggerSubMenuAction:me.triggerSubMenuAction,builtinPlacements:me.builtinPlacements,defaultActiveFirst:me.store.getState().defaultActiveFirst[xe(me.eventKey)],multiple:me.multiple,prefixCls:me.rootPrefixCls,id:G.internalMenuId,manualRef:G.saveMenuInstance,itemIcon:me.itemIcon,expandIcon:me.expandIcon,direction:me.direction}},G.getMotion=function(he,me){var Te=Object(p.a)(G),De=Te.haveRendered,Ie=G.props,Ke=Ie.motion,ht=Ie.rootPrefixCls,_t=Object(k.a)(Object(k.a)({},Ke),{},{leavedClassName:"".concat(ht,"-hidden"),removeOnLeave:!1,motionAppear:De||!me||he!=="inline"});return _t};var $=ee.store,z=ee.eventKey,q=$.getState(),te=q.defaultActiveFirst;G.isRootMenu=!1;var fe=!1;return te&&(fe=te[z]),ii($,z,fe),G.state={mode:ee.mode,isOpen:ee.isOpen},G}return Object(v.a)(ce,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var G=this,$=this.props,z=$.mode,q=$.parentMenu,te=$.manualRef,fe=$.isOpen,he=function(){G.setState({mode:z,isOpen:fe})},me=fe!==this.state.isOpen,Te=z!==this.state.mode;if((Te||me)&&(Ye.a.cancel(this.updateStateRaf),Te?this.updateStateRaf=Object(Ye.a)(he):he()),te&&te(this),z!=="horizontal"||!(q==null?void 0:q.isRootMenu)||!fe)return;this.minWidthTimeout=setTimeout(function(){return G.adjustWidth()},0)}},{key:"componentWillUnmount",value:function(){var G=this.props,$=G.onDestroy,z=G.eventKey;$&&$(z),this.minWidthTimeout&&clearTimeout(this.minWidthTimeout),this.mouseenterTimeout&&clearTimeout(this.mouseenterTimeout),Ye.a.cancel(this.updateStateRaf)}},{key:"renderPopupMenu",value:function(G,$){var z=this.getBaseProps();return x.createElement(jn,Object(g.a)({},z,{id:this.internalMenuId,className:G,style:$}),this.props.children)}},{key:"renderChildren",value:function(){var G=this,$=this.getBaseProps(),z=$.mode,q=$.visible,te=$.forceSubMenuRender,fe=$.direction,he=this.getMotion(z,q);if(this.haveRendered=!0,this.haveOpened=this.haveOpened||q||te,!this.haveOpened)return x.createElement("div",null);var me=F()("".concat($.prefixCls,"-sub"),Object(pe.a)({},"".concat($.prefixCls,"-rtl"),fe==="rtl"));return this.isInlineMode()?x.createElement(W,Object(g.a)({visible:$.visible,forceRender:te},he),function(Te){var De=Te.className,Ie=Te.style,Ke=F()(me,De);return G.renderPopupMenu(Ke,Ie)}):this.renderPopupMenu(me)}},{key:"render",value:function(){var G,$,z,q=Object(k.a)({},this.props),te=this.getVisible(),fe=this.getPrefixCls(),he=this.isInlineMode(),me=this.getMode(),Te=F()(fe,"".concat(fe,"-").concat(me),(G={},Object(pe.a)(G,q.className,!!q.className),Object(pe.a)(G,this.getOpenClassName(),te),Object(pe.a)(G,this.getActiveClassName(),q.active||te&&!he),Object(pe.a)(G,this.getDisabledClassName(),q.disabled),Object(pe.a)(G,this.getSelectedClassName(),this.isChildrenSelected()),G));this.internalMenuId||(q.eventKey?this.internalMenuId="".concat(q.eventKey,"$Menu"):(ti+=1,this.internalMenuId="$__$".concat(ti,"$Menu")));var De={},Ie={},Ke={};q.disabled||(De={onMouseLeave:this.onMouseLeave,onMouseEnter:this.onMouseEnter},Ie={onClick:this.onTitleClick},Ke={onMouseEnter:this.onTitleMouseEnter,onMouseLeave:this.onTitleMouseLeave});var ht={},_t=q.direction,mt=_t==="rtl";he&&(mt?ht.paddingRight=q.inlineIndent*q.level:ht.paddingLeft=q.inlineIndent*q.level);var St={};this.getVisible()&&(St={"aria-owns":this.internalMenuId});var bt=null;me!=="horizontal"&&(bt=this.props.expandIcon,typeof this.props.expandIcon=="function"&&(bt=x.createElement(this.props.expandIcon,Object(k.a)({},this.props))));var vt=x.createElement("div",Object(g.a)({ref:this.saveSubMenuTitle,style:ht,className:"".concat(fe,"-title"),role:"button"},Ke,Ie,{"aria-expanded":te},St,{"aria-haspopup":"true",title:typeof q.title=="string"?q.title:void 0}),q.title,bt||x.createElement("i",{className:"".concat(fe,"-arrow")})),yt=this.renderChildren(),Lt=(($=q.parentMenu)===null||$===void 0?void 0:$.isRootMenu)?q.parentMenu.props.getPopupContainer:function(Yt){return Yt.parentNode},Ct=jt[me],Jt=q.popupOffset?{offset:q.popupOffset}:{},Ut=F()((z={},Object(pe.a)(z,q.popupClassName,q.popupClassName&&!he),Object(pe.a)(z,"".concat(fe,"-rtl"),mt),z)),lt=q.disabled,ot=q.triggerSubMenuAction,Ot=q.subMenuOpenDelay,At=q.forceSubMenuRender,tt=q.subMenuCloseDelay,Dt=q.builtinPlacements;Ge.forEach(function(Yt){return delete q[Yt]}),delete q.onClick;var Kt=mt?Object(k.a)(Object(k.a)({},Sn),Dt):Object(k.a)(Object(k.a)({},ji),Dt);delete q.direction;var Pt=this.getBaseProps(),Ht=he?null:this.getMotion(Pt.mode,Pt.visible);return x.createElement("li",Object(g.a)({},q,De,{className:Te,role:"menuitem"}),x.createElement(Fi,{prefixCls:fe,popupClassName:F()("".concat(fe,"-popup"),Ut),getPopupContainer:Lt,builtinPlacements:Kt,popupPlacement:Ct,popupVisible:he?!1:te,popupAlign:Jt,popup:he?null:yt,action:lt||he?[]:[ot],mouseEnterDelay:Ot,mouseLeaveDelay:tt,onPopupVisibleChange:this.onPopupVisibleChange,forceRender:At,popupMotion:Ht},vt),he?yt:null)}}]),ce}(x.Component);Mt.defaultProps={onMouseEnter:Me,onMouseLeave:Me,onTitleMouseEnter:Me,onTitleMouseLeave:Me,onTitleClick:Me,manualRef:Me,mode:"vertical",title:""};var ci=Object(o.b)(function(J,le){var ce=J.openKeys,ee=J.activeKey,G=J.selectedKeys,$=le.eventKey,z=le.subMenuKey;return{isOpen:ce.indexOf($)>-1,active:ee[z]===$,selectedKeys:G}})(Mt);ci.isSubMenu=!0;var $t=ci,Hi="menuitem-overflowed",si=.5,Ji=function(J){Object(d.a)(ce,J);var le=Object(a.a)(ce);function ce(){var ee;return Object(E.a)(this,ce),ee=le.apply(this,arguments),ee.resizeObserver=null,ee.mutationObserver=null,ee.originalTotalWidth=0,ee.overflowedItems=[],ee.menuItemSizes=[],ee.cancelFrameId=null,ee.state={lastVisibleIndex:void 0},ee.childRef=x.createRef(),ee.getMenuItemNodes=function(){var G=ee.props.prefixCls,$=ee.childRef.current;return $?[].slice.call($.children).filter(function(z){return z.className.split(" ").indexOf("".concat(G,"-overflowed-submenu"))<0}):[]},ee.getOverflowedSubMenuItem=function(G,$,z){var q=ee.props,te=q.overflowedIndicator,fe=q.level,he=q.mode,me=q.prefixCls,Te=q.theme;if(fe!==1||he!=="horizontal")return null;var De=ee.props.children[0],Ie=De.props,Ke=Ie.children,ht=Ie.title,_t=Ie.style,mt=Object(C.a)(Ie,["children","title","style"]),St=Object(k.a)({},_t),bt="".concat(G,"-overflowed-indicator"),vt="".concat(G,"-overflowed-indicator");$.length===0&&z!==!0?St=Object(k.a)(Object(k.a)({},St),{},{display:"none"}):z&&(St=Object(k.a)(Object(k.a)({},St),{},{visibility:"hidden",position:"absolute"}),bt="".concat(bt,"-placeholder"),vt="".concat(vt,"-placeholder"));var yt=Te?"".concat(me,"-").concat(Te):"",Lt={};return Ge.forEach(function(Ct){mt[Ct]!==void 0&&(Lt[Ct]=mt[Ct])}),x.createElement($t,Object(g.a)({title:te,className:"".concat(me,"-overflowed-submenu"),popupClassName:yt},Lt,{key:bt,eventKey:vt,disabled:!1,style:St}),$)},ee.setChildrenWidthAndResize=function(){if(ee.props.mode!=="horizontal")return;var G=ee.childRef.current;if(!G)return;var $=G.children;if(!$||$.length===0)return;var z=G.children[$.length-1];Le(z,"display","inline-block");var q=ee.getMenuItemNodes(),te=q.filter(function(fe){return fe.className.split(" ").indexOf(Hi)>=0});te.forEach(function(fe){Le(fe,"display","inline-block")}),ee.menuItemSizes=q.map(function(fe){return Ue(fe,!0)}),te.forEach(function(fe){Le(fe,"display","none")}),ee.overflowedIndicatorWidth=Ue(G.children[G.children.length-1],!0),ee.originalTotalWidth=ee.menuItemSizes.reduce(function(fe,he){return fe+he},0),ee.handleResize(),Le(z,"display","none")},ee.handleResize=function(){if(ee.props.mode!=="horizontal")return;var G=ee.childRef.current;if(!G)return;var $=Ue(G);ee.overflowedItems=[];var z=0,q;ee.originalTotalWidth>$+si&&(q=-1,ee.menuItemSizes.forEach(function(te){z+=te,z+ee.overflowedIndicatorWidth<=$&&(q+=1)})),ee.setState({lastVisibleIndex:q})},ee}return Object(v.a)(ce,[{key:"componentDidMount",value:function(){var G=this;if(this.setChildrenWidthAndResize(),this.props.level===1&&this.props.mode==="horizontal"){var $=this.childRef.current;if(!$)return;this.resizeObserver=new nt.default(function(z){z.forEach(function(){var q=G.cancelFrameId;cancelAnimationFrame(q),G.cancelFrameId=requestAnimationFrame(G.setChildrenWidthAndResize)})}),[].slice.call($.children).concat($).forEach(function(z){G.resizeObserver.observe(z)}),typeof MutationObserver!="undefined"&&(this.mutationObserver=new MutationObserver(function(){G.resizeObserver.disconnect(),[].slice.call($.children).concat($).forEach(function(z){G.resizeObserver.observe(z)}),G.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(G){var $=this,z=this.state.lastVisibleIndex;return(G||[]).reduce(function(q,te,fe){var he=te;if($.props.mode==="horizontal"){var me=$.getOverflowedSubMenuItem(te.props.eventKey,[]);z!==void 0&&$.props.className.indexOf("".concat($.props.prefixCls,"-root"))!==-1&&(fe>z&&(he=x.cloneElement(te,{style:{display:"none"},eventKey:"".concat(te.props.eventKey,"-hidden"),className:"".concat(Hi)})),fe===z+1&&($.overflowedItems=G.slice(z+1).map(function(De){return x.cloneElement(De,{key:De.props.eventKey,mode:"vertical-left"})}),me=$.getOverflowedSubMenuItem(te.props.eventKey,$.overflowedItems)));var Te=[].concat(Object(w.a)(q),[me,he]);return fe===G.length-1&&Te.push($.getOverflowedSubMenuItem(te.props.eventKey,[],!0)),Te}return[].concat(Object(w.a)(q),[he])},[])}},{key:"render",value:function(){var G=this.props,$=G.visible,z=G.prefixCls,q=G.overflowedIndicator,te=G.mode,fe=G.level,he=G.tag,me=G.children,Te=G.theme,De=Object(C.a)(G,["visible","prefixCls","overflowedIndicator","mode","level","tag","children","theme"]),Ie=he;return x.createElement(Ie,Object(g.a)({ref:this.childRef},De),this.renderChildren(me))}}]),ce}(x.Component);Ji.defaultProps={tag:"div",className:""};var xn=Ji;function wn(J){return J.length?J.every(function(le){return!!le.props.disabled}):!0}function dn(J,le,ce){var ee=J.getState();J.setState({activeKey:Object(k.a)(Object(k.a)({},ee.activeKey),{},Object(pe.a)({},le,ce))})}function Wi(J){return J.eventKey||"0-menu-"}function cn(J,le){var ce=le,ee=J.children,G=J.eventKey;if(ce){var $;if(ke(ee,function(z,q){z&&z.props&&!z.props.disabled&&ce===ze(z,G,q)&&($=!0)}),$)return ce}return ce=null,J.defaultActiveFirst&&ke(ee,function(z,q){!ce&&z&&!z.props.disabled&&(ce=ze(z,G,q))}),ce}function Tr(J){if(!J)return;var le=this.instanceArray.indexOf(J);le!==-1?this.instanceArray[le]=J:this.instanceArray.push(J)}var Fn=function(J){Object(d.a)(ce,J);var le=Object(a.a)(ce);function ce(ee){var G;return Object(E.a)(this,ce),G=le.call(this,ee),G.onKeyDown=function($,z){var q=$.keyCode,te;if(G.getFlatInstanceArray().forEach(function(he){he&&he.props.active&&he.onKeyDown&&(te=he.onKeyDown($))}),te)return 1;var fe=null;return(q===u.a.UP||q===u.a.DOWN)&&(fe=G.step(q===u.a.UP?-1:1)),fe?($.preventDefault(),dn(G.props.store,Wi(G.props),fe.props.eventKey),typeof z=="function"&&z(fe),1):void 0},G.onItemHover=function($){var z=$.key,q=$.hover;dn(G.props.store,Wi(G.props),q?z:null)},G.onDeselect=function($){G.props.onDeselect($)},G.onSelect=function($){G.props.onSelect($)},G.onClick=function($){G.props.onClick($)},G.onOpenChange=function($){G.props.onOpenChange($)},G.onDestroy=function($){G.props.onDestroy($)},G.getFlatInstanceArray=function(){return G.instanceArray},G.step=function($){var z=G.getFlatInstanceArray(),q=G.props.store.getState().activeKey[Wi(G.props)],te=z.length;if(!te)return null;$<0&&(z=z.concat().reverse());var fe=-1;if(z.every(function(De,Ie){return De&&De.props.eventKey===q?(fe=Ie,!1):!0}),!G.props.defaultActiveFirst&&fe!==-1&&wn(z.slice(fe,te-1)))return;var he=(fe+1)%te,me=he;do{var Te=z[me];if(!Te||Te.props.disabled)me=(me+1)%te;else return Te}while(me!==he);return null},G.renderCommonMenuItem=function($,z,q){var te=G.props.store.getState(),fe=Object(p.a)(G),he=fe.props,me=ze($,he.eventKey,z),Te=$.props;if(!Te||typeof $.type=="string")return $;var De=me===te.activeKey,Ie=Object(k.a)(Object(k.a)({mode:Te.mode||he.mode,level:he.level,inlineIndent:he.inlineIndent,renderMenuItem:G.renderMenuItem,rootPrefixCls:he.prefixCls,index:z,parentMenu:he.parentMenu,manualRef:Te.disabled?void 0:Object(f.a)($.ref,Tr.bind(Object(p.a)(G))),eventKey:me,active:!Te.disabled&&De,multiple:he.multiple,onClick:function(ht){(Te.onClick||Me)(ht),G.onClick(ht)},onItemHover:G.onItemHover,motion:he.motion,subMenuOpenDelay:he.subMenuOpenDelay,subMenuCloseDelay:he.subMenuCloseDelay,forceSubMenuRender:he.forceSubMenuRender,onOpenChange:G.onOpenChange,onDeselect:G.onDeselect,onSelect:G.onSelect,builtinPlacements:he.builtinPlacements,itemIcon:Te.itemIcon||G.props.itemIcon,expandIcon:Te.expandIcon||G.props.expandIcon},q),{},{direction:he.direction});return(he.mode==="inline"||Ae())&&(Ie.triggerSubMenuAction="click"),x.cloneElement($,Object(k.a)(Object(k.a)({},Ie),{},{key:me||z}))},G.renderMenuItem=function($,z,q){if(!$)return null;var te=G.props.store.getState(),fe={openKeys:te.openKeys,selectedKeys:te.selectedKeys,triggerSubMenuAction:G.props.triggerSubMenuAction,subMenuKey:q};return G.renderCommonMenuItem($,z,fe)},ee.store.setState({activeKey:Object(k.a)(Object(k.a)({},ee.store.getState().activeKey),{},Object(pe.a)({},ee.eventKey,cn(ee,ee.activeKey)))}),G.instanceArray=[],G}return Object(v.a)(ce,[{key:"componentDidMount",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"shouldComponentUpdate",value:function(G){return this.props.visible||G.visible||this.props.className!==G.className||!A()(this.props.style,G.style)}},{key:"componentDidUpdate",value:function(G){var $=this.props,z="activeKey"in $?$.activeKey:$.store.getState().activeKey[Wi($)],q=cn($,z);if(q!==z)dn($.store,Wi($),q);else if("activeKey"in G){var te=cn(G,G.activeKey);q!==te&&dn($.store,Wi($),q)}}},{key:"render",value:function(){var G=this,$=Object(g.a)({},this.props);this.instanceArray=[];var z=F()($.prefixCls,$.className,"".concat($.prefixCls,"-").concat($.mode)),q={className:z,role:$.role||"menu"};$.id&&(q.id=$.id),$.focusable&&(q.tabIndex=0,q.onKeyDown=this.onKeyDown);var te=$.prefixCls,fe=$.eventKey,he=$.visible,me=$.level,Te=$.mode,De=$.overflowedIndicator,Ie=$.theme;return Ge.forEach(function(Ke){return delete $[Ke]}),delete $.onClick,x.createElement(xn,Object(g.a)({},$,{prefixCls:te,mode:Te,tag:"ul",level:me,theme:Ie,visible:he,overflowedIndicator:De},q),Object(N.a)($.children).map(function(Ke,ht){return G.renderMenuItem(Ke,ht,fe||"0-menu-")}))}}]),ce}(x.Component);Fn.defaultProps={prefixCls:"rc-menu",className:"",mode:"vertical",level:1,inlineIndent:24,visible:!0,focusable:!0,style:{},manualRef:Me};var Sr=Object(o.b)()(Fn),jn=Sr,xr=se("Kwbf");function wr(J,le,ce){var ee=J.prefixCls,G=J.motion,$=J.defaultMotions,z=$===void 0?{}:$,q=J.openAnimation,te=J.openTransitionName,fe=le.switchingModeFromInline;if(G)return G;if(Object(R.a)(q)==="object"&&q)Object(xr.a)(!1,"Object type of `openAnimation` is removed. Please use `motion` instead.");else if(typeof q=="string")return{motionName:"".concat(ee,"-open-").concat(q)};if(te)return{motionName:te};var he=z[ce];return he||(fe?null:z.other)}var Hn=function(J){Object(d.a)(ce,J);var le=Object(a.a)(ce);function ce(ee){var G;Object(E.a)(this,ce),G=le.call(this,ee),G.onSelect=function(q){var te=Object(p.a)(G),fe=te.props;if(fe.selectable){var he=G.store.getState(),me=he.selectedKeys,Te=q.key;fe.multiple?me=me.concat([Te]):me=[Te],"selectedKeys"in fe||G.store.setState({selectedKeys:me}),fe.onSelect(Object(k.a)(Object(k.a)({},q),{},{selectedKeys:me}))}},G.onClick=function(q){var te=G.getRealMenuMode(),fe=Object(p.a)(G),he=fe.store,me=fe.props.onOpenChange;te!=="inline"&&!("openKeys"in G.props)&&(he.setState({openKeys:[]}),me([])),G.props.onClick(q)},G.onKeyDown=function(q,te){G.innerMenu.getWrappedInstance().onKeyDown(q,te)},G.onOpenChange=function(q){var te=Object(p.a)(G),fe=te.props,he=G.store.getState().openKeys.concat(),me=!1,Te=function(Ie){var Ke=!1;if(Ie.open)Ke=he.indexOf(Ie.key)===-1,Ke&&he.push(Ie.key);else{var ht=he.indexOf(Ie.key);Ke=ht!==-1,Ke&&he.splice(ht,1)}me=me||Ke};Array.isArray(q)?q.forEach(Te):Te(q),me&&("openKeys"in G.props||G.store.setState({openKeys:he}),fe.onOpenChange(he))},G.onDeselect=function(q){var te=Object(p.a)(G),fe=te.props;if(fe.selectable){var he=G.store.getState().selectedKeys.concat(),me=q.key,Te=he.indexOf(me);Te!==-1&&he.splice(Te,1),"selectedKeys"in fe||G.store.setState({selectedKeys:he}),fe.onDeselect(Object(k.a)(Object(k.a)({},q),{},{selectedKeys:he}))}},G.onMouseEnter=function(q){G.restoreModeVerticalFromInline();var te=G.props.onMouseEnter;te&&te(q)},G.onTransitionEnd=function(q){var te=q.propertyName==="width"&&q.target===q.currentTarget,fe=q.target.className,he=Object.prototype.toString.call(fe)==="[object SVGAnimatedString]"?fe.animVal:fe,me=q.propertyName==="font-size"&&he.indexOf("anticon")>=0;(te||me)&&G.restoreModeVerticalFromInline()},G.setInnerMenu=function(q){G.innerMenu=q},G.isRootMenu=!0;var $=ee.defaultSelectedKeys,z=ee.defaultOpenKeys;return"selectedKeys"in ee&&($=ee.selectedKeys||[]),"openKeys"in ee&&(z=ee.openKeys||[]),G.store=Object(o.c)({selectedKeys:$,openKeys:z,activeKey:{"0-menu-":cn(ee,ee.activeKey)}}),G.state={switchingModeFromInline:!1,prevProps:ee,inlineOpenKeys:[],store:G.store},G}return Object(v.a)(ce,[{key:"componentDidMount",value:function(){this.updateMiniStore(),this.updateMenuDisplay()}},{key:"componentDidUpdate",value:function(G){var $=this.props,z=$.siderCollapsed,q=$.inlineCollapsed,te=$.onOpenChange;(!G.inlineCollapsed&&q||!G.siderCollapsed&&z)&&te([]),this.updateMiniStore(),this.updateMenuDisplay()}},{key:"updateMenuDisplay",value:function(){var G=this.props.collapsedWidth,$=this.store,z=this.prevOpenKeys,q=this.getInlineCollapsed()&&(G===0||G==="0"||G==="0px");q?(this.prevOpenKeys=$.getState().openKeys.concat(),this.store.setState({openKeys:[]})):z&&(this.store.setState({openKeys:z}),this.prevOpenKeys=null)}},{key:"getRealMenuMode",value:function(){var G=this.props.mode,$=this.state.switchingModeFromInline,z=this.getInlineCollapsed();return $&&z?"inline":z?"vertical":G}},{key:"getInlineCollapsed",value:function(){var G=this.props,$=G.inlineCollapsed,z=G.siderCollapsed;return z!==void 0?z:$}},{key:"restoreModeVerticalFromInline",value:function(){var G=this.state.switchingModeFromInline;G&&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 G=Object(k.a)({},Object(c.a)(this.props,["collapsedWidth","siderCollapsed","defaultMotions"])),$=this.getRealMenuMode();return G.className+=" ".concat(G.prefixCls,"-root"),G.direction==="rtl"&&(G.className+=" ".concat(G.prefixCls,"-rtl")),G=Object(k.a)(Object(k.a)({},G),{},{mode:$,onClick:this.onClick,onOpenChange:this.onOpenChange,onDeselect:this.onDeselect,onSelect:this.onSelect,onMouseEnter:this.onMouseEnter,onTransitionEnd:this.onTransitionEnd,parentMenu:this,motion:wr(this.props,this.state,$)}),delete G.openAnimation,delete G.openTransitionName,x.createElement(o.a,{store:this.store},x.createElement(jn,Object(g.a)({},G,{ref:this.setInnerMenu}),this.props.children))}}],[{key:"getDerivedStateFromProps",value:function(G,$){var z=$.prevProps,q=$.store,te=q.getState(),fe={},he={prevProps:G};return z.mode==="inline"&&G.mode!=="inline"&&(he.switchingModeFromInline=!0),"openKeys"in G?fe.openKeys=G.openKeys||[]:((G.inlineCollapsed&&!z.inlineCollapsed||G.siderCollapsed&&!z.siderCollapsed)&&(he.switchingModeFromInline=!0,he.inlineOpenKeys=te.openKeys,fe.openKeys=[]),(!G.inlineCollapsed&&z.inlineCollapsed||!G.siderCollapsed&&z.siderCollapsed)&&(fe.openKeys=$.inlineOpenKeys,he.inlineOpenKeys=[])),Object.keys(fe).length&&q.setState(fe),he}}]),ce}(x.Component);Hn.defaultProps={selectable:!0,onClick:Me,onSelect:Me,onOpenChange:Me,onDeselect:Me,defaultSelectedKeys:[],defaultOpenKeys:[],subMenuOpenDelay:.1,subMenuCloseDelay:.1,triggerSubMenuAction:"hover",prefixCls:"rc-menu",className:"",mode:"vertical",style:{},builtinPlacements:{},overflowedIndicator:x.createElement("span",null,"\xB7\xB7\xB7")};var Cr=Hn,Cn=function(J){Object(d.a)(ce,J);var le=Object(a.a)(ce);function ce(){var ee;return Object(E.a)(this,ce),ee=le.apply(this,arguments),ee.onKeyDown=function(G){var $=G.keyCode;return $===u.a.ENTER?(ee.onClick(G),!0):void 0},ee.onMouseLeave=function(G){var $=ee.props,z=$.eventKey,q=$.onItemHover,te=$.onMouseLeave;q({key:z,hover:!1}),te({key:z,domEvent:G})},ee.onMouseEnter=function(G){var $=ee.props,z=$.eventKey,q=$.onItemHover,te=$.onMouseEnter;q({key:z,hover:!0}),te({key:z,domEvent:G})},ee.onClick=function(G){var $=ee.props,z=$.eventKey,q=$.multiple,te=$.onClick,fe=$.onSelect,he=$.onDeselect,me=$.isSelected,Te={key:z,keyPath:[z],item:Object(p.a)(ee),domEvent:G};te(Te),q?me?he(Te):fe(Te):me||fe(Te)},ee.saveNode=function(G){ee.node=G},ee}return Object(v.a)(ce,[{key:"componentDidMount",value:function(){this.callRef()}},{key:"componentDidUpdate",value:function(){this.callRef()}},{key:"componentWillUnmount",value:function(){var G=this.props;G.onDestroy&&G.onDestroy(G.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 G,$=Object(k.a)({},this.props),z=F()(this.getPrefixCls(),$.className,(G={},Object(pe.a)(G,this.getActiveClassName(),!$.disabled&&$.active),Object(pe.a)(G,this.getSelectedClassName(),$.isSelected),Object(pe.a)(G,this.getDisabledClassName(),$.disabled),G)),q=Object(k.a)(Object(k.a)({},$.attribute),{},{title:typeof $.title=="string"?$.title:void 0,className:z,role:$.role||"menuitem","aria-disabled":$.disabled});$.role==="option"?q=Object(k.a)(Object(k.a)({},q),{},{role:"option","aria-selected":$.isSelected}):($.role===null||$.role==="none")&&(q.role="none");var te={onClick:$.disabled?null:this.onClick,onMouseLeave:$.disabled?null:this.onMouseLeave,onMouseEnter:$.disabled?null:this.onMouseEnter},fe=Object(k.a)({},$.style);$.mode==="inline"&&($.direction==="rtl"?fe.paddingRight=$.inlineIndent*$.level:fe.paddingLeft=$.inlineIndent*$.level),Ge.forEach(function(me){return delete $[me]}),delete $.direction;var he=this.props.itemIcon;return typeof this.props.itemIcon=="function"&&(he=x.createElement(this.props.itemIcon,this.props)),x.createElement("li",Object(g.a)({},Object(c.a)($,["onClick","onMouseEnter","onMouseLeave","onSelect"]),q,te,{style:fe,ref:this.saveNode}),$.children,he)}}]),ce}(x.Component);Cn.isMenuItem=!0,Cn.defaultProps={onSelect:Me,onMouseEnter:Me,onMouseLeave:Me,manualRef:Me};var Or=Object(o.b)(function(J,le){var ce=J.activeKey,ee=J.selectedKeys,G=le.eventKey,$=le.subMenuKey;return{active:ce[$]===G,isSelected:Array.isArray(ee)?ee.indexOf(G)!==-1:ee===G}})(Cn),Rr=Or,On=function(J){Object(d.a)(ce,J);var le=Object(a.a)(ce);function ce(){var ee;return Object(E.a)(this,ce),ee=le.apply(this,arguments),ee.renderInnerMenuItem=function(G){var $=ee.props,z=$.renderMenuItem,q=$.index;return z(G,q,ee.props.subMenuKey)},ee}return Object(v.a)(ce,[{key:"render",value:function(){var G=Object(g.a)({},this.props),$=G.className,z=$===void 0?"":$,q=G.rootPrefixCls,te="".concat(q,"-item-group-title"),fe="".concat(q,"-item-group-list"),he=G.title,me=G.children;return Ge.forEach(function(Te){return delete G[Te]}),delete G.direction,x.createElement("li",Object(g.a)({},G,{onClick:function(De){return De.stopPropagation()},className:"".concat(z," ").concat(q,"-item-group")}),x.createElement("div",{className:te,title:typeof he=="string"?he:void 0},he),x.createElement("ul",{className:fe},x.Children.map(me,this.renderInnerMenuItem)))}}]),ce}(x.Component);On.isMenuItemGroup=!0,On.defaultProps={disabled:!0};var fa=On,Wn=function(le){var ce=le.className,ee=le.rootPrefixCls,G=le.style;return x.createElement("li",{className:"".concat(ce," ").concat(ee,"-item-divider"),style:G})};Wn.defaultProps={disabled:!0,className:"",style:{}};var pa=Wn,Ar=Cr,Ir=se("eDIo");function Lr(J,le){var ce=J.prefixCls,ee=J.editable,G=J.locale,$=J.style;return!ee||ee.showAdd===!1?null:x.createElement("button",{ref:le,type:"button",className:"".concat(ce,"-nav-add"),style:$,"aria-label":(G==null?void 0:G.addAriaLabel)||"Add tab",onClick:function(q){ee.onEdit("add",{event:q})}},ee.addIcon||"+")}var Gn=x.forwardRef(Lr);function Dr(J,le){var ce=J.prefixCls,ee=J.id,G=J.tabs,$=J.locale,z=J.mobile,q=J.moreIcon,te=q===void 0?"More":q,fe=J.moreTransitionName,he=J.style,me=J.className,Te=J.editable,De=J.tabBarGutter,Ie=J.rtl,Ke=J.onTabClick,ht=Object(x.useState)(!1),_t=Object(j.a)(ht,2),mt=_t[0],St=_t[1],bt=Object(x.useState)(null),vt=Object(j.a)(bt,2),yt=vt[0],Lt=vt[1],Ct="".concat(ee,"-more-popup"),Jt="".concat(ce,"-dropdown"),Ut=yt!==null?"".concat(Ct,"-").concat(yt):null,lt=$==null?void 0:$.dropdownAriaLabel,ot=x.createElement(Ar,{onClick:function(Ht){var Yt=Ht.key,oi=Ht.domEvent;Ke(Yt,oi),St(!1)},id:Ct,tabIndex:-1,role:"listbox","aria-activedescendant":Ut,selectedKeys:[yt],"aria-label":lt!==void 0?lt:"expanded dropdown"},G.map(function(Pt){return x.createElement(Rr,{key:Pt.key,id:"".concat(Ct,"-").concat(Pt.key),role:"option","aria-controls":ee&&"".concat(ee,"-panel-").concat(Pt.key),disabled:Pt.disabled},Pt.tab)}));function Ot(Pt){for(var Ht=G.filter(function(gi){return!gi.disabled}),Yt=Ht.findIndex(function(gi){return gi.key===yt})||0,oi=Ht.length,mi=0;mi<oi;mi+=1){Yt=(Yt+Pt+oi)%oi;var Qt=Ht[Yt];if(!Qt.disabled){Lt(Qt.key);return}}}function At(Pt){var Ht=Pt.which;if(!mt){[u.a.DOWN,u.a.SPACE,u.a.ENTER].includes(Ht)&&(St(!0),Pt.preventDefault());return}switch(Ht){case u.a.UP:Ot(-1),Pt.preventDefault();break;case u.a.DOWN:Ot(1),Pt.preventDefault();break;case u.a.ESC:St(!1);break;case u.a.SPACE:case u.a.ENTER:yt!==null&&Ke(yt,Pt);break}}Object(x.useEffect)(function(){var Pt=document.getElementById(Ut);Pt&&Pt.scrollIntoView&&Pt.scrollIntoView(!1)},[yt]),Object(x.useEffect)(function(){mt||Lt(null)},[mt]);var tt=Object(pe.a)({},Ie?"marginLeft":"marginRight",De);G.length||(tt.visibility="hidden",tt.order=1);var Dt=F()(Object(pe.a)({},"".concat(Jt,"-rtl"),Ie)),Kt=z?null:x.createElement(Ir.a,{prefixCls:Jt,overlay:ot,trigger:["hover"],visible:mt,transitionName:fe,onVisibleChange:St,overlayClassName:Dt,mouseEnterDelay:.1,mouseLeaveDelay:.1},x.createElement("button",{type:"button",className:"".concat(ce,"-nav-more"),style:tt,tabIndex:-1,"aria-hidden":"true","aria-haspopup":"listbox","aria-controls":Ct,id:"".concat(ee,"-more"),"aria-expanded":mt,onKeyDown:At},te));return x.createElement("div",{className:F()("".concat(ce,"-nav-operations"),me),style:he,ref:le},Kt,x.createElement(Gn,{prefixCls:ce,locale:$,editable:Te}))}var Pr=x.forwardRef(Dr),Rn=Object(x.createContext)(null),Mr=.1,Kn=.01,fn=20,zn=Math.pow(.995,fn);function kr(){var J=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(J)||/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(J.substr(0,4)))}function Nr(J,le){var ce=Object(x.useState)(),ee=Object(j.a)(ce,2),G=ee[0],$=ee[1],z=Object(x.useState)(0),q=Object(j.a)(z,2),te=q[0],fe=q[1],he=Object(x.useState)(0),me=Object(j.a)(he,2),Te=me[0],De=me[1],Ie=Object(x.useState)(),Ke=Object(j.a)(Ie,2),ht=Ke[0],_t=Ke[1],mt=Object(x.useRef)();function St(lt){var ot=lt.touches[0],Ot=ot.screenX,At=ot.screenY;$({x:Ot,y:At}),window.clearInterval(mt.current)}function bt(lt){if(!G)return;lt.preventDefault();var ot=lt.touches[0],Ot=ot.screenX,At=ot.screenY;$({x:Ot,y:At});var tt=Ot-G.x,Dt=At-G.y;le(tt,Dt);var Kt=Date.now();fe(Kt),De(Kt-te),_t({x:tt,y:Dt})}function vt(){if(!G)return;if($(null),_t(null),ht){var lt=ht.x/Te,ot=ht.y/Te,Ot=Math.abs(lt),At=Math.abs(ot);if(Math.max(Ot,At)<Mr)return;var tt=lt,Dt=ot;mt.current=window.setInterval(function(){if(Math.abs(tt)<Kn&&Math.abs(Dt)<Kn){window.clearInterval(mt.current);return}tt*=zn,Dt*=zn,le(tt*fn,Dt*fn)},fn)}}var yt=Object(x.useRef)(0),Lt=Object(x.useRef)(!1),Ct=Object(x.useRef)();function Jt(lt){var ot=lt.deltaX,Ot=lt.deltaY,At=0,tt=Math.abs(ot),Dt=Math.abs(Ot);tt===Dt?At=Ct.current==="x"?ot:Ot:tt>Dt?(At=ot,Ct.current="x"):(At=Ot,Ct.current="y");var Kt=Date.now();Kt-yt.current>100&&(Lt.current=!1),(le(-At,-At)||Lt.current)&&(lt.preventDefault(),Lt.current=!0),yt.current=Kt}var Ut=Object(x.useRef)(null);Ut.current={onTouchStart:St,onTouchMove:bt,onTouchEnd:vt,onWheel:Jt},x.useEffect(function(){function lt(tt){Ut.current.onTouchStart(tt)}function ot(tt){Ut.current.onTouchMove(tt)}function Ot(tt){Ut.current.onTouchEnd(tt)}function At(tt){Ut.current.onWheel(tt)}return document.addEventListener("touchmove",ot,{passive:!1}),document.addEventListener("touchend",Ot,{passive:!1}),J.current.addEventListener("touchstart",lt,{passive:!1}),J.current.addEventListener("wheel",At),function(){document.removeEventListener("touchmove",ot),document.removeEventListener("touchend",Ot)}},[])}function Ur(){var J=Object(x.useRef)(new Map);function le(ee){return J.current.has(ee)||J.current.set(ee,x.createRef()),J.current.get(ee)}function ce(ee){J.current.delete(ee)}return[le,ce]}function Vn(J,le){var ce=x.useRef(J),ee=x.useState({}),G=Object(j.a)(ee,2),$=G[1];function z(q){var te=typeof q=="function"?q(ce.current):q;te!==ce.current&&le(te,ce.current),ce.current=te,$({})}return[ce.current,z]}var Yn=function(le){var ce=le.position,ee=le.prefixCls,G=le.extra;if(!G)return null;var $,z=G;return ce==="right"&&($=z.right||!z.left&&z||null),ce==="left"&&($=z.left||null),$?x.createElement("div",{className:"".concat(ee,"-extra-content")},$):null};function Br(J,le){var ce,ee=x.useContext(Rn),G=ee.prefixCls,$=ee.tabs,z=J.className,q=J.style,te=J.id,fe=J.animated,he=J.activeKey,me=J.rtl,Te=J.extra,De=J.editable,Ie=J.locale,Ke=J.tabPosition,ht=J.tabBarGutter,_t=J.children,mt=J.onTabClick,St=J.onTabScroll,bt=Object(x.useRef)(),vt=Object(x.useRef)(),yt=Object(x.useRef)(),Lt=Object(x.useRef)(),Ct=Ur(),Jt=Object(j.a)(Ct,2),Ut=Jt[0],lt=Jt[1],ot=Ke==="top"||Ke==="bottom",Ot=Vn(0,function(Bt,Rt){ot&&St&&St({direction:Bt>Rt?"left":"right"})}),At=Object(j.a)(Ot,2),tt=At[0],Dt=At[1],Kt=Vn(0,function(Bt,Rt){!ot&&St&&St({direction:Bt>Rt?"top":"bottom"})}),Pt=Object(j.a)(Kt,2),Ht=Pt[0],Yt=Pt[1],oi=Object(x.useState)(0),mi=Object(j.a)(oi,2),Qt=mi[0],gi=mi[1],Ti=Object(x.useState)(0),yi=Object(j.a)(Ti,2),_i=yi[0],qt=yi[1],fi=Object(x.useState)(0),li=Object(j.a)(fi,2),ni=li[0],wi=li[1],Ci=Object(x.useState)(0),Di=Object(j.a)(Ci,2),Wt=Di[0],xi=Di[1],Pi=Object(x.useState)(null),zt=Object(j.a)(Pi,2),Nt=zt[0],ui=zt[1],Gr=Object(x.useState)(null),Zn=Object(j.a)(Gr,2),Gi=Zn[0],Kr=Zn[1],zr=Object(x.useState)(0),qn=Object(j.a)(zr,2),Vr=qn[0],Yr=qn[1],Xr=Object(x.useState)(0),er=Object(j.a)(Xr,2),$r=er[0],Jr=er[1],Qr=i(new Map),tr=Object(j.a)(Qr,2),Zr=tr[0],qr=tr[1],pn=n($,Zr,Qt),ir="".concat(G,"-nav-operations-hidden"),Qi=0,Zi=0;ot?me?(Qi=0,Zi=Math.max(0,Qt-Nt)):(Qi=Math.min(0,Nt-Qt),Zi=0):(Qi=Math.min(0,Gi-_i),Zi=0);function An(Bt){return Bt<Qi?[Qi,!1]:Bt>Zi?[Zi,!1]:[Bt,!0]}var nr=Object(x.useRef)(),ea=Object(x.useState)(),rr=Object(j.a)(ea,2),In=rr[0],ar=rr[1];function Ln(){ar(Date.now())}function Dn(){window.clearTimeout(nr.current)}Nr(bt,function(Bt,Rt){var ri=!1;function bi(en,tn){en(function(nn){var rn=An(nn+tn),Ki=Object(j.a)(rn,2),Nn=Ki[0],Un=Ki[1];return ri=Un,Nn})}if(ot){if(Nt>=Qt)return ri;bi(Dt,Bt)}else{if(Gi>=_i)return ri;bi(Yt,Rt)}return Dn(),Ln(),ri}),Object(x.useEffect)(function(){return Dn(),In&&(nr.current=window.setTimeout(function(){ar(0)},100)),Dn},[In]);function sr(){var Bt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:he,Rt=pn.get(Bt);if(!Rt)return;if(ot){var ri=tt;me?Rt.right<tt?ri=Rt.right:Rt.right+Rt.width>tt+Nt&&(ri=Rt.right+Rt.width-Nt):Rt.left<-tt?ri=-Rt.left:Rt.left+Rt.width>-tt+Nt&&(ri=-(Rt.left+Rt.width-Nt)),Yt(0),Dt(An(ri)[0])}else{var bi=Ht;Rt.top<-Ht?bi=-Rt.top:Rt.top+Rt.height>-Ht+Gi&&(bi=-(Rt.top+Rt.height-Gi)),Dt(0),Yt(An(bi)[0])}}var ta=b(pn,{width:Nt,height:Gi,left:tt,top:Ht},{width:ni,height:Wt},{width:Vr,height:$r},Object(k.a)(Object(k.a)({},J),{},{tabs:$})),or=Object(j.a)(ta,2),ia=or[0],na=or[1],ra=$.map(function(Bt){var Rt=Bt.key;return x.createElement(e,{id:te,prefixCls:G,key:Rt,rtl:me,tab:Bt,closable:Bt.closable,editable:De,active:Rt===he,tabPosition:Ke,tabBarGutter:ht,renderWrapper:_t,removeAriaLabel:Ie==null?void 0:Ie.removeAriaLabel,ref:Ut(Rt),onClick:function(bi){mt(Rt,bi)},onRemove:function(){lt(Rt)},onFocus:function(){sr(Rt),Ln(),me||(bt.current.scrollLeft=0),bt.current.scrollTop=0}})}),Pn=r(function(){var Bt,Rt,ri,bi,en,tn,nn,rn,Ki,Nn=((Bt=bt.current)===null||Bt===void 0?void 0:Bt.offsetWidth)||0,Un=((Rt=bt.current)===null||Rt===void 0?void 0:Rt.offsetHeight)||0,mr=((ri=Lt.current)===null||ri===void 0?void 0:ri.offsetWidth)||0,gr=((bi=Lt.current)===null||bi===void 0?void 0:bi.offsetHeight)||0,ha=((en=yt.current)===null||en===void 0?void 0:en.offsetWidth)||0,da=((tn=yt.current)===null||tn===void 0?void 0:tn.offsetHeight)||0;ui(Nn),Kr(Un),Yr(mr),Jr(gr);var vr=(((nn=vt.current)===null||nn===void 0?void 0:nn.offsetWidth)||0)-mr,yr=(((rn=vt.current)===null||rn===void 0?void 0:rn.offsetHeight)||0)-gr;gi(vr),qt(yr);var _r=(Ki=yt.current)===null||Ki===void 0?void 0:Ki.className.includes(ir);wi(vr-(_r?0:ha)),xi(yr-(_r?0:da)),qr(function(){var br=new Map;return $.forEach(function(ca){var Er=ca.key,an=Ut(Er).current;an&&br.set(Er,{width:an.offsetWidth,height:an.offsetHeight,left:an.offsetLeft,top:an.offsetTop})}),br})}),aa=$.slice(0,ia),sa=$.slice(na+1),lr=[].concat(Object(w.a)(aa),Object(w.a)(sa)),oa=Object(x.useState)(),ur=Object(j.a)(oa,2),la=ur[0],ua=ur[1],Oi=pn.get(he),hr=Object(x.useRef)();function dr(){_.a.cancel(hr.current)}Object(x.useEffect)(function(){var Bt={};return Oi&&(ot?(me?Bt.right=Oi.right:Bt.left=Oi.left,Bt.width=Oi.width):(Bt.top=Oi.top,Bt.height=Oi.height)),dr(),hr.current=_()(function(){ua(Bt)}),dr},[Oi,ot,me]),Object(x.useEffect)(function(){sr()},[he,Oi,pn,ot]),Object(x.useEffect)(function(){Pn()},[me,ht,he,$.map(function(Bt){return Bt.key}).join("_")]);var cr=!!lr.length,qi="".concat(G,"-nav-wrap"),Mn,kn,fr,pr;return ot?me?(kn=tt>0,Mn=tt+Nt<Qt):(Mn=tt<0,kn=-tt+Nt<Qt):(fr=Ht<0,pr=-Ht+Gi<_i),x.createElement("div",{ref:le,role:"tablist",className:F()("".concat(G,"-nav"),z),style:q,onKeyDown:function(){Ln()}},x.createElement(Yn,{position:"left",extra:Te,prefixCls:G}),x.createElement(s.a,{onResize:Pn},x.createElement("div",{className:F()(qi,(ce={},Object(pe.a)(ce,"".concat(qi,"-ping-left"),Mn),Object(pe.a)(ce,"".concat(qi,"-ping-right"),kn),Object(pe.a)(ce,"".concat(qi,"-ping-top"),fr),Object(pe.a)(ce,"".concat(qi,"-ping-bottom"),pr),ce)),ref:bt},x.createElement(s.a,{onResize:Pn},x.createElement("div",{ref:vt,className:"".concat(G,"-nav-list"),style:{transform:"translate(".concat(tt,"px, ").concat(Ht,"px)"),transition:In?"none":void 0}},ra,x.createElement(Gn,{ref:Lt,prefixCls:G,locale:Ie,editable:De,style:{visibility:cr?"hidden":null}}),x.createElement("div",{className:F()("".concat(G,"-ink-bar"),Object(pe.a)({},"".concat(G,"-ink-bar-animated"),fe.inkBar)),style:la}))))),x.createElement(Pr,Object.assign({},J,{ref:yt,prefixCls:G,tabs:lr,className:!cr&&ir})),x.createElement(Yn,{position:"right",extra:Te,prefixCls:G}))}var Xn=x.forwardRef(Br);function Fr(J){var le=J.id,ce=J.activeKey,ee=J.animated,G=J.tabPosition,$=J.rtl,z=J.destroyInactiveTabPane,q=x.useContext(Rn),te=q.prefixCls,fe=q.tabs,he=ee.tabPane,me=fe.findIndex(function(Te){return Te.key===ce});return x.createElement("div",{className:F()("".concat(te,"-content-holder"))},x.createElement("div",{className:F()("".concat(te,"-content"),"".concat(te,"-content-").concat(G),Object(pe.a)({},"".concat(te,"-content-animated"),he)),style:me&&he?Object(pe.a)({},$?"marginRight":"marginLeft","-".concat(me,"00%")):null},fe.map(function(Te){return x.cloneElement(Te.node,{key:Te.key,prefixCls:te,tabKey:Te.key,id:le,animated:he,active:Te.key===ce,destroyInactiveTabPane:z})})))}function $n(J){var le=J.prefixCls,ce=J.forceRender,ee=J.className,G=J.style,$=J.id,z=J.active,q=J.animated,te=J.destroyInactiveTabPane,fe=J.tabKey,he=J.children,me=x.useState(ce),Te=Object(j.a)(me,2),De=Te[0],Ie=Te[1];x.useEffect(function(){z?Ie(!0):te&&Ie(!1)},[z,te]);var Ke={};return z||(q?(Ke.visibility="hidden",Ke.height=0,Ke.overflowY="hidden"):Ke.display="none"),x.createElement("div",{id:$&&"".concat($,"-panel-").concat(fe),role:"tabpanel",tabIndex:z?0:-1,"aria-labelledby":$&&"".concat($,"-tab-").concat(fe),"aria-hidden":!z,style:Object(k.a)(Object(k.a)({},Ke),G),className:F()("".concat(le,"-tabpane"),z&&"".concat(le,"-tabpane-active"),ee)},(z||De||ce)&&he)}var Jn=0;function jr(J){return Object(N.a)(J).map(function(le){if(x.isValidElement(le)){var ce=le.key!==void 0?String(le.key):void 0;return Object(k.a)(Object(k.a)({key:ce},le.props),{},{node:le})}return null}).filter(function(le){return le})}function Hr(J,le){var ce,ee=J.id,G=J.prefixCls,$=G===void 0?"rc-tabs":G,z=J.className,q=J.children,te=J.direction,fe=J.activeKey,he=J.defaultActiveKey,me=J.editable,Te=J.animated,De=J.tabPosition,Ie=De===void 0?"top":De,Ke=J.tabBarGutter,ht=J.tabBarStyle,_t=J.tabBarExtraContent,mt=J.locale,St=J.moreIcon,bt=J.moreTransitionName,vt=J.destroyInactiveTabPane,yt=J.renderTabBar,Lt=J.onChange,Ct=J.onTabClick,Jt=J.onTabScroll,Ut=Object(C.a)(J,["id","prefixCls","className","children","direction","activeKey","defaultActiveKey","editable","animated","tabPosition","tabBarGutter","tabBarStyle","tabBarExtraContent","locale","moreIcon","moreTransitionName","destroyInactiveTabPane","renderTabBar","onChange","onTabClick","onTabScroll"]),lt=jr(q),ot=te==="rtl",Ot;Te===!1?Ot={inkBar:!1,tabPane:!1}:Ot=Object(k.a)({inkBar:!0,tabPane:!1},Te!==!0?Te:null);var At=Object(x.useState)(!1),tt=Object(j.a)(At,2),Dt=tt[0],Kt=tt[1];Object(x.useEffect)(function(){Kt(kr())},[]);var Pt=Object(O.a)(function(){var Wt;return(Wt=lt[0])===null||Wt===void 0?void 0:Wt.key},{value:fe,defaultValue:he}),Ht=Object(j.a)(Pt,2),Yt=Ht[0],oi=Ht[1],mi=Object(x.useState)(function(){return lt.findIndex(function(Wt){return Wt.key===Yt})}),Qt=Object(j.a)(mi,2),gi=Qt[0],Ti=Qt[1];Object(x.useEffect)(function(){var Wt=lt.findIndex(function(Pi){return Pi.key===Yt});if(Wt===-1){var xi;Wt=Math.max(0,Math.min(gi,lt.length-1)),oi((xi=lt[Wt])===null||xi===void 0?void 0:xi.key)}Ti(Wt)},[lt.map(function(Wt){return Wt.key}).join("_"),Yt,gi]);var yi=Object(O.a)(null,{value:ee}),_i=Object(j.a)(yi,2),qt=_i[0],fi=_i[1],li=Ie;Dt&&!["left","right"].includes(Ie)&&(li="top"),Object(x.useEffect)(function(){ee||(fi("rc-tabs-".concat(Jn)),Jn+=1)},[]);function ni(Wt,xi){Ct==null||Ct(Wt,xi),oi(Wt),Lt==null||Lt(Wt)}var wi={id:qt,activeKey:Yt,animated:Ot,tabPosition:li,rtl:ot,mobile:Dt},Ci,Di=Object(k.a)(Object(k.a)({},wi),{},{editable:me,locale:mt,moreIcon:St,moreTransitionName:bt,tabBarGutter:Ke,onTabClick:ni,onTabScroll:Jt,extra:_t,style:ht,panes:q});return yt?Ci=yt(Di,Xn):Ci=x.createElement(Xn,Object.assign({},Di)),x.createElement(Rn.Provider,{value:{tabs:lt,prefixCls:$}},x.createElement("div",Object.assign({ref:le,id:ee,className:F()($,"".concat($,"-").concat(li),(ce={},Object(pe.a)(ce,"".concat($,"-mobile"),Dt),Object(pe.a)(ce,"".concat($,"-editable"),me),Object(pe.a)(ce,"".concat($,"-rtl"),ot),ce),z)},Ut),Ci,x.createElement(Fr,Object.assign({destroyInactiveTabPane:vt},wi,{animated:Ot}))))}var Qn=x.forwardRef(Hr);Qn.TabPane=$n;var Wr=Qn,ma=ft.b=Wr},kUb9:function(xt,ft,se){"use strict";se.r(ft);var pe=se("DjyN"),j=se("NUBc"),C=se("Znn+"),k=se("ZTPi"),x=se("+L6B"),L=se("2/Rp"),F=se("sPJy"),N=se("bE4q"),O=se("9og8"),w=se("k1fw"),y=se("tJVT"),_=se("WmNS"),s=se.n(_),r=se("q1tI"),i=se.n(r),u=se("Ty5D"),l=se("55Ip"),e=se("9kvl"),t=se("xKgJ"),n=se("ErOA"),T=se("BdwD"),b=se("INg4"),g=se.n(b),E=se("479L"),v=se.n(E),p=se("/zsF"),d=se("PArb"),a=se("rAM+"),o=se("9Bee"),c=se("m3rI"),f=function(U){var K,D=U.user,H=U.item,V=U.getdata,ne=U.params,ie=Object(r.useRef)(),_e=Object(r.useState)(),ye=Object(y.a)(_e,2),be=ye[0],we=ye[1],Re=Object(r.useState)(!0),ge=Object(y.a)(Re,2),Q=ge[0],Pe=ge[1];return Object(r.useEffect)(function(){if(!ie.current)return;function $e(){var Me,ze=new ResizeObserver(function(xe){var ke=Object(a.a)(xe),je;try{for(ke.s();!(je=ke.n()).done;){var Ge=je.value;console.log("----",Ge,xe),we(Ge.target.offsetHeight>=52)}}catch(Ue){ke.e(Ue)}finally{ke.f()}});return ze.observe((Me=ie.current)===null||Me===void 0?void 0:Me.firstElementChild),ze}var Fe=$e();return function(){var Me,ze;((Me=ie.current)===null||Me===void 0?void 0:Me.firstElementChild)&&Fe.unobserve((ze=ie.current)===null||ze===void 0?void 0:ze.firstElementChild)}},[ie.current]),i.a.createElement("div",{onClick:function(){e.d.push("/classrooms/".concat(ne.coursesId,"/program_homework/").concat(ne.categoryId,"/answer/").concat(H.id,"/detail"))},style:{marginTop:30,padding:"0px 20px",cursor:"pointer"}},i.a.createElement("div",{className:g.a.titles,style:{fontWeight:600,fontSize:18,color:"#000000"}},H.name),i.a.createElement("div",{style:{display:"flex",marginTop:10}},i.a.createElement("div",{style:{flex:1,display:"flex",alignItems:"center",color:"#5F6368"}},i.a.createElement("img",{style:{width:24,borderRadius:50},src:"".concat(c.a.IMG_SERVER,"/images/").concat(H.author.image_url)}),i.a.createElement("span",{style:{margin:"0px 12px 0px 8px"}},H==null||((K=H.author)===null||K===void 0)?void 0:K.name),i.a.createElement("span",null,"\u53D1\u8868\u4E8E",H.created_at)),i.a.createElement("div",null,i.a.createElement("span",{style:{color:"#5F6368",cursor:"pointer"},onClick:function(){}},"\u56DE\u590D\uFF08",(H==null?void 0:H.descendants_count)||0,"\uFF09"),Object(t.j)()&&i.a.createElement("span",{onClick:function(){var $e=Object(O.a)(s.a.mark(function Fe(Me){var ze;return s.a.wrap(function(ke){for(;;)switch(ke.prev=ke.next){case 0:return Me.stopPropagation(),ke.next=3,Object(n.a)("/api/hack_messages/".concat(H.id,"/update_public"),{method:"post"});case 3:ze=ke.sent,ze.status===0&&V();case 5:case"end":return ke.stop()}},Fe)}));return function(Fe){return $e.apply(this,arguments)}}(),style:{color:"#44D7B6",cursor:"pointer",marginLeft:20}},H.is_public?"\u53D6\u6D88\u516C\u5F00":"\u516C\u5F00"))),i.a.createElement("div",{ref:ie,style:{margin:"15px 0px",maxHeight:Q?52:"",overflow:"hidden"}},i.a.createElement(o.a,{style:{color:"#434D6C",fontSize:14},value:H.content})),(H==null?void 0:H.hack_identifier)&&i.a.createElement("span",{onClick:function(){var $e=Object(O.a)(s.a.mark(function Fe(Me){var ze,xe;return s.a.wrap(function(je){for(;;)switch(je.prev=je.next){case 0:if(Me.stopPropagation(),!Object(t.s)()){je.next=3;break}return je.abrupt("return");case 3:return je.next=5,Object(n.a)("/api/problems/".concat(H==null?void 0:H.hack_identifier,"/start.json"),{method:"get",params:{hack_user_id:H==null||((ze=H.author)===null||ze===void 0)?void 0:ze.id}});case 5:xe=je.sent,xe&&(window.open("/myproblems/".concat(xe==null?void 0:xe.identifier,"?type=1")),localStorage.setItem("program_homework",[ne.coursesId,ne.categoryId]));case 7:case"end":return je.stop()}},Fe)}));return function(Fe){return $e.apply(this,arguments)}}(),className:g.a.tips},H==null?void 0:H.hack_name),be&&i.a.createElement("div",{onClick:function(Fe){Fe.stopPropagation(),Pe(!Q)}},i.a.createElement(d.a,{dashed:!1,className:"",style:{cursor:"pointer"}},i.a.createElement("a",{className:"font14 ".concat(g.a.color999)},Q?"\u9605\u8BFB\u5168\u6587 ":"\u6536\u8D77\u5168\u6587 ",i.a.createElement("i",{className:"iconfont font14 ".concat(Q?"icon-jiantou9":"icon-changyongtubiao-xianxingdaochu-zhuanqu-")})))))},S=Object(e.a)(function(B){var U=B.user;return{user:U}})(f),A=function(U){var K,D,H,V,ne=U.user,ie=Object(r.useState)(Object(w.a)(Object(w.a)({},Object(u.i)()),{},{page:1,per_page:10,type:1,sort_by:"",course_group:Object(t.s)()?[ne.userInfo.course.course_group_id]:[]})),_e=Object(y.a)(ie,2),ye=_e[0],be=_e[1],we=Object(r.useState)([]),Re=Object(y.a)(we,2),ge=Re[0],Q=Re[1];Object(r.useEffect)(function(){Pe()},[]);function Pe(){return $e.apply(this,arguments)}function $e(){return $e=Object(O.a)(s.a.mark(function Fe(){var Me;return s.a.wrap(function(xe){for(;;)switch(xe.prev=xe.next){case 0:return xe.next=2,Object(n.a)("/api/homework_commons/".concat(ye.categoryId,"/hack_messages"),{method:"get",params:Object(w.a)(Object(w.a)({},ye),{},{type:1})});case 2:Me=xe.sent,Q(Me);case 4:case"end":return xe.stop()}},Fe)})),$e.apply(this,arguments)}return i.a.createElement("div",{style:{width:1200,margin:"0px auto"}},i.a.createElement(N.a,{separator:">",style:{marginTop:20}},i.a.createElement(N.a.Item,null,i.a.createElement(l.a,{to:"/classrooms/".concat(ge==null?void 0:ge.course_id,"/program_homework")},ge==null?void 0:ge.course_name)),i.a.createElement(N.a.Item,null,i.a.createElement(l.a,{to:"/classrooms/".concat(ge==null?void 0:ge.course_id,"/program_homework/").concat(ge==null?void 0:ge.homework_id,"/detail")},ge==null?void 0:ge.homework_name)),i.a.createElement(N.a.Item,null,"\u9898\u89E3&\u95EE\u7B54")),i.a.createElement("div",{style:{marginTop:10,display:"flex"}},i.a.createElement("div",{style:{width:"860px",marginRight:30,background:"#fff"}},i.a.createElement(k.a,{tabBarStyle:{padding:"0px 10px"},style:{width:"850px"},tabBarExtraContent:Object(t.s)()&&i.a.createElement(L.a,{type:"primary",style:{width:88},onClick:function(){e.d.push("/classrooms/".concat(ye.coursesId,"/program_homework/").concat(ye.categoryId,"/answer/add"))}},"\u53D1\u8868\u7B54\u7591"," "),onChange:function(Me){Me==="1"?ye.sort_by="":ye.sort_by="created_at",be(Object(w.a)({},ye)),Pe()}},i.a.createElement(k.a.TabPane,{key:"1",tab:"\u6700\u65B0\u56DE\u590D"}),i.a.createElement(k.a.TabPane,{key:"2",tab:"\u6700\u65B0\u53D1\u8868"})),(ge==null||((K=ge.data)===null||K===void 0)?void 0:K.length)<=0&&i.a.createElement(T.a,{customText:"\u6682\u65E0\u8BA8\u8BBA"}),ge==null||((D=ge.data)===null||D===void 0)?void 0:D.map(function(Fe){return i.a.createElement(S,{item:Fe,params:ye,getdata:Pe})}),i.a.createElement("div",{style:{width:"100%",textAlign:"center",marginTop:10}},i.a.createElement(j.a,{current:ye.page,pageSize:ye.per_page,total:ge==null?void 0:ge.count,hideOnSinglePage:!0,onChange:function(Me,ze){ye.page=Me,ye.per_page=ze,be(Object(w.a)({},ye)),Pe()}}))),i.a.createElement("div",{className:g.a.right,style:{width:300,height:"100%"}},i.a.createElement("div",{style:{display:"flex"}},i.a.createElement("div",{style:{flex:1,display:"flex",alignItems:"center"}},i.a.createElement("span",{style:{marginRight:3,fontSize:20,fontWeight:600,color:"#000"}},"\u5E7F\u64AD"),i.a.createElement("img",{width:21,src:v.a})," "),Object(t.c)()&&i.a.createElement(L.a,{type:"primary",onClick:function(){e.d.push("/classrooms/".concat(ye.coursesId,"/program_homework/").concat(ye.categoryId,"/answer/add"))}},"\u53D1\u5E03\u5E7F\u64AD")),(ge==null||((H=ge.radio_messages)===null||H===void 0)?void 0:H.length)<=0&&i.a.createElement(T.a,null),ge==null||((V=ge.radio_messages)===null||V===void 0)?void 0:V.map(function(Fe){return i.a.createElement("div",{onClick:function(){e.d.push("/classrooms/".concat(ye.coursesId,"/program_homework/").concat(ye.categoryId,"/answer/").concat(Fe.id,"/detail"))},style:{marginTop:30,cursor:"pointer"}},i.a.createElement("div",{className:g.a.title,style:{fontSize:"16px",fontWeight:600}},i.a.createElement("span",{style:{color:(Fe==null?void 0:Fe.message_type)===2?"#4C7BE6":"#E17E7E"}},(Fe==null?void 0:Fe.message_type)===2?"\u3010\u9898\u89E3\u3011":"\u3010\u901A\u77E5\u3011"),i.a.createElement("span",{title:Fe.name},Fe.name)),i.a.createElement("div",{style:{marginTop:15,color:"#5F6368"}},"\u53D1\u8868\u4E8E",Fe.created_at))}))))},R=ft.default=Object(e.a)(function(B){var U=B.user;return{user:U}})(A)},p5ED:function(xt,ft,se){"use strict";var pe=se("+L6B"),j=se("2/Rp"),C=se("5Dmo"),k=se("3S7+"),x=se("k1fw"),L=se("tJVT"),F=se("q1tI"),N=se.n(F),O=se("vHTk"),w=se.n(O),y=se("yEEn"),_=se("ZW9T"),s=se("1vsH");ft.a=function(r){var i=r.name,u=r.data,l=r.theme,e=r.type,t=r.filename,n=r.monacoEditor,T=r.className,b=r.style,g=r.close,E=r.onClose,v=r.hasMask,p=Object(F.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),d=Object(L.a)(p,2),a=d[0],o=d[1],c=Object(F.useState)(""),f=Object(L.a)(c,2),S=f[0],A=f[1],R,B=1024*1024,U=10*B,K=Object(F.useRef)();e==="office"&&(R=Object(s.T)(u).filesize,R>U&&(e="other")),t&&(n.filename=t),Object(F.useEffect)(function(){var V,ne,ie=(V=document.cookie)===null||V===void 0||((ne=V.replace(/\s/g,""))===null||ne===void 0)?void 0:ne.split(";");ie==null||ie.map(function(_e){var ye=_e.split("=");ye[0]==="_educoder_session"&&A(ye[1])})},[]);var D=function(){if(u.startsWith("http")||u.startsWith("/")){H();return}Object(s.z)(t||"educoder",u,t)},H=function(){Object(s.x)(t||i,u)};return console.log("data:",u,"fileanme:",t," name:",i),N.a.createElement("div",{style:Object(x.a)({},b||{}),className:"".concat(v&&w.a.bgBlack," ").concat(e?w.a.wrp:"hide")},g&&N.a.createElement("div",{className:w.a.close,ref:K},N.a.createElement(k.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return K.current}},N.a.createElement("span",{onClick:H},N.a.createElement("i",{className:"icon-quxiaozhiding"}))),N.a.createElement(k.a,{title:"\u5173\u95ED",getPopupContainer:function(){return K.current}},N.a.createElement("span",{className:"",onClick:E},N.a.createElement("i",{className:"icon-guanbi1"})))),N.a.createElement("div",{className:"".concat(w.a[T]," ").concat(T," ").concat(w.a.monaco," ").concat(e==="txt"?"show":"hide")},e==="txt"&&N.a.createElement(_.b,n)),e==="audio"&&N.a.createElement("audio",{src:"".concat(u!=null&&u.startsWith("/")||(u==null?void 0:u.indexOf("https://"))>-1?u:"data:audio/mp3;base64,").concat(u),autoPlay:!0}),e==="video"&&N.a.createElement(N.a.Fragment,null,u!=null&&u.startsWith("/")?N.a.createElement("video",{controls:!0,src:"".concat(u),autoPlay:!0}):N.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(u),autoPlay:!0})),e==="html"&&N.a.createElement("iframe",{src:u+"&disposition=inline"}),e==="pdf"&&N.a.createElement("embed",{className:w.a.embed,src:u}),e==="image"&&N.a.createElement(N.a.Fragment,null,N.a.createElement("img",{src:"".concat(u!=null&&u.startsWith("/")||(u==null?void 0:u.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(u)})),e==="other"&&N.a.createElement("div",null,N.a.createElement(j.a,{type:"primary",size:"large",onClick:D},N.a.createElement(y.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(e==="download"||e==="office")&&N.a.createElement(j.a,{type:"primary",size:"large",onClick:D},N.a.createElement(y.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},psGv:function(xt,ft,se){var pe,j;(function(){var C;(function(){"use strict";var F=[,,function(y){function _(i){this.__parent=i,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}_.prototype.clone_empty=function(){var i=new _(this.__parent);return i.set_indent(this.__indent_count,this.__alignment_count),i},_.prototype.item=function(i){return i<0?this.__items[this.__items.length+i]:this.__items[i]},_.prototype.has_match=function(i){for(var u=this.__items.length-1;u>=0;u--)if(this.__items[u].match(i))return!0;return!1},_.prototype.set_indent=function(i,u){this.is_empty()&&(this.__indent_count=i||0,this.__alignment_count=u||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},_.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},_.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},_.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var i=this.__parent.current_line;return i.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),i.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),i.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,i.__items[0]===" "&&(i.__items.splice(0,1),i.__character_count-=1),!0}return!1},_.prototype.is_empty=function(){return this.__items.length===0},_.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},_.prototype.push=function(i){this.__items.push(i);var u=i.lastIndexOf(`
|
|
`);u!==-1?this.__character_count=i.length-u:this.__character_count+=i.length},_.prototype.pop=function(){var i=null;return this.is_empty()||(i=this.__items.pop(),this.__character_count-=i.length),i},_.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},_.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},_.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},_.prototype.toString=function(){var i="";return this.is_empty()?this.__parent.indent_empty_lines&&(i=this.__parent.get_indent_string(this.__indent_count)):(i=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),i+=this.__items.join("")),i};function s(i,u){this.__cache=[""],this.__indent_size=i.indent_size,this.__indent_string=i.indent_char,i.indent_with_tabs||(this.__indent_string=new Array(i.indent_size+1).join(i.indent_char)),u=u||"",i.indent_level>0&&(u=new Array(i.indent_level+1).join(this.__indent_string)),this.__base_string=u,this.__base_string_length=u.length}s.prototype.get_indent_size=function(i,u){var l=this.__base_string_length;return u=u||0,i<0&&(l=0),l+=i*this.__indent_size,l+=u,l},s.prototype.get_indent_string=function(i,u){var l=this.__base_string;return u=u||0,i<0&&(i=0,l=""),u+=i*this.__indent_size,this.__ensure_cache(u),l+=this.__cache[u],l},s.prototype.__ensure_cache=function(i){for(;i>=this.__cache.length;)this.__add_column()},s.prototype.__add_column=function(){var i=this.__cache.length,u=0,l="";this.__indent_size&&i>=this.__indent_size&&(u=Math.floor(i/this.__indent_size),i-=u*this.__indent_size,l=new Array(u+1).join(this.__indent_string)),i&&(l+=new Array(i+1).join(" ")),this.__cache.push(l)};function r(i,u){this.__indent_cache=new s(i,u),this.raw=!1,this._end_with_newline=i.end_with_newline,this.indent_size=i.indent_size,this.wrap_line_length=i.wrap_line_length,this.indent_empty_lines=i.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new _(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}r.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},r.prototype.get_line_number=function(){return this.__lines.length},r.prototype.get_indent_string=function(i,u){return this.__indent_cache.get_indent_string(i,u)},r.prototype.get_indent_size=function(i,u){return this.__indent_cache.get_indent_size(i,u)},r.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},r.prototype.add_new_line=function(i){return this.is_empty()||!i&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},r.prototype.get_code=function(i){this.trim(!0);var u=this.current_line.pop();u&&(u[u.length-1]===`
|
|
`&&(u=u.replace(/\n+$/g,"")),this.current_line.push(u)),this._end_with_newline&&this.__add_outputline();var l=this.__lines.join(`
|
|
`);return i!==`
|
|
`&&(l=l.replace(/[\n]/g,i)),l},r.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},r.prototype.set_indent=function(i,u){return i=i||0,u=u||0,this.next_line.set_indent(i,u),this.__lines.length>1?(this.current_line.set_indent(i,u),!0):(this.current_line.set_indent(),!1)},r.prototype.add_raw_token=function(i){for(var u=0;u<i.newlines;u++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(i.whitespace_before),this.current_line.push(i.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},r.prototype.add_token=function(i){this.__add_space_before_token(),this.current_line.push(i),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},r.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},r.prototype.remove_indent=function(i){for(var u=this.__lines.length;i<u;)this.__lines[i]._remove_indent(),i++;this.current_line._remove_wrap_indent()},r.prototype.trim=function(i){for(i=i===void 0?!1:i,this.current_line.trim();i&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},r.prototype.just_added_newline=function(){return this.current_line.is_empty()},r.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},r.prototype.ensure_empty_line_above=function(i,u){for(var l=this.__lines.length-2;l>=0;){var e=this.__lines[l];if(e.is_empty())break;if(e.item(0).indexOf(i)!==0&&e.item(-1)!==u){this.__lines.splice(l+1,0,new _(this)),this.previous_line=this.__lines[this.__lines.length-2];break}l--}},y.exports.Output=r},function(y){function _(s,r,i,u){this.type=s,this.text=r,this.comments_before=null,this.newlines=i||0,this.whitespace_before=u||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}y.exports.Token=_},,,function(y){function _(i,u){this.raw_options=s(i,u),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}_.prototype._get_array=function(i,u){var l=this.raw_options[i],e=u||[];return typeof l=="object"?l!==null&&typeof l.concat=="function"&&(e=l.concat()):typeof l=="string"&&(e=l.split(/[^a-zA-Z0-9_\/\-]+/)),e},_.prototype._get_boolean=function(i,u){var l=this.raw_options[i],e=l===void 0?!!u:!!l;return e},_.prototype._get_characters=function(i,u){var l=this.raw_options[i],e=u||"";return typeof l=="string"&&(e=l.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),e},_.prototype._get_number=function(i,u){var l=this.raw_options[i];u=parseInt(u,10),isNaN(u)&&(u=0);var e=parseInt(l,10);return isNaN(e)&&(e=u),e},_.prototype._get_selection=function(i,u,l){var e=this._get_selection_list(i,u,l);if(e.length!==1)throw new Error("Invalid Option Value: The option '"+i+`' can only be one of the following values:
|
|
`+u+`
|
|
You passed in: '`+this.raw_options[i]+"'");return e[0]},_.prototype._get_selection_list=function(i,u,l){if(!u||u.length===0)throw new Error("Selection list cannot be empty.");if(l=l||[u[0]],!this._is_valid_selection(l,u))throw new Error("Invalid Default Value!");var e=this._get_array(i,l);if(!this._is_valid_selection(e,u))throw new Error("Invalid Option Value: The option '"+i+`' can contain only the following values:
|
|
`+u+`
|
|
You passed in: '`+this.raw_options[i]+"'");return e},_.prototype._is_valid_selection=function(i,u){return i.length&&u.length&&!i.some(function(l){return u.indexOf(l)===-1})};function s(i,u){var l={};i=r(i);var e;for(e in i)e!==u&&(l[e]=i[e]);if(u&&i[u])for(e in i[u])l[e]=i[u][e];return l}function r(i){var u={},l;for(l in i){var e=l.replace(/-/g,"_");u[e]=i[l]}return u}y.exports.Options=_,y.exports.normalizeOpts=r,y.exports.mergeOpts=s},,function(y){var _=RegExp.prototype.hasOwnProperty("sticky");function s(r){this.__input=r||"",this.__input_length=this.__input.length,this.__position=0}s.prototype.restart=function(){this.__position=0},s.prototype.back=function(){this.__position>0&&(this.__position-=1)},s.prototype.hasNext=function(){return this.__position<this.__input_length},s.prototype.next=function(){var r=null;return this.hasNext()&&(r=this.__input.charAt(this.__position),this.__position+=1),r},s.prototype.peek=function(r){var i=null;return r=r||0,r+=this.__position,r>=0&&r<this.__input_length&&(i=this.__input.charAt(r)),i},s.prototype.__match=function(r,i){r.lastIndex=i;var u=r.exec(this.__input);return u&&!(_&&r.sticky)&&(u.index!==i&&(u=null)),u},s.prototype.test=function(r,i){return i=i||0,i+=this.__position,i>=0&&i<this.__input_length?!!this.__match(r,i):!1},s.prototype.testChar=function(r,i){var u=this.peek(i);return r.lastIndex=0,u!==null&&r.test(u)},s.prototype.match=function(r){var i=this.__match(r,this.__position);return i?this.__position+=i[0].length:i=null,i},s.prototype.read=function(r,i,u){var l="",e;return r&&(e=this.match(r),e&&(l+=e[0])),i&&(e||!r)&&(l+=this.readUntil(i,u)),l},s.prototype.readUntil=function(r,i){var u="",l=this.__position;r.lastIndex=this.__position;var e=r.exec(this.__input);return e?(l=e.index,i&&(l+=e[0].length)):l=this.__input_length,u=this.__input.substring(this.__position,l),this.__position=l,u},s.prototype.readUntilAfter=function(r){return this.readUntil(r,!0)},s.prototype.get_regexp=function(r,i){var u=null,l="g";return i&&_&&(l="y"),typeof r=="string"&&r!==""?u=new RegExp(r,l):r&&(u=new RegExp(r.source,l)),u},s.prototype.get_literal_regexp=function(r){return RegExp(r.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},s.prototype.peekUntilAfter=function(r){var i=this.__position,u=this.readUntilAfter(r);return this.__position=i,u},s.prototype.lookBack=function(r){var i=this.__position-1;return i>=r.length&&this.__input.substring(i-r.length,i).toLowerCase()===r},y.exports.InputScanner=s},function(y,_,s){var r=s(8).InputScanner,i=s(3).Token,u=s(10).TokenStream,l=s(11).WhitespacePattern,e={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},t=function(n,T){this._input=new r(n),this._options=T||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new l(this._input)};t.prototype.tokenize=function(){this._input.restart(),this.__tokens=new u,this._reset();for(var n,T=new i(e.START,""),b=null,g=[],E=new u;T.type!==e.EOF;){for(n=this._get_next_token(T,b);this._is_comment(n);)E.add(n),n=this._get_next_token(T,b);E.isEmpty()||(n.comments_before=E,E=new u),n.parent=b,this._is_opening(n)?(g.push(b),b=n):b&&this._is_closing(n,b)&&(n.opened=b,b.closed=n,b=g.pop(),n.parent=b),n.previous=T,T.next=n,this.__tokens.add(n),T=n}return this.__tokens},t.prototype._is_first_token=function(){return this.__tokens.isEmpty()},t.prototype._reset=function(){},t.prototype._get_next_token=function(n,T){this._readWhitespace();var b=this._input.read(/.+/g);return b?this._create_token(e.RAW,b):this._create_token(e.EOF,"")},t.prototype._is_comment=function(n){return!1},t.prototype._is_opening=function(n){return!1},t.prototype._is_closing=function(n,T){return!1},t.prototype._create_token=function(n,T){var b=new i(n,T,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return b},t.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},y.exports.Tokenizer=t,y.exports.TOKEN=e},function(y){function _(s){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=s}_.prototype.restart=function(){this.__position=0},_.prototype.isEmpty=function(){return this.__tokens_length===0},_.prototype.hasNext=function(){return this.__position<this.__tokens_length},_.prototype.next=function(){var s=null;return this.hasNext()&&(s=this.__tokens[this.__position],this.__position+=1),s},_.prototype.peek=function(s){var r=null;return s=s||0,s+=this.__position,s>=0&&s<this.__tokens_length&&(r=this.__tokens[s]),r},_.prototype.add=function(s){this.__parent_token&&(s.parent=this.__parent_token),this.__tokens.push(s),this.__tokens_length+=1},y.exports.TokenStream=_},function(y,_,s){var r=s(12).Pattern;function i(u,l){r.call(this,u,l),l?this._line_regexp=this._input.get_regexp(l._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}i.prototype=new r,i.prototype.__set_whitespace_patterns=function(u,l){u+="\\t ",l+="\\n\\r",this._match_pattern=this._input.get_regexp("["+u+l+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+l+"]")},i.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var u=this._input.read(this._match_pattern);if(u===" ")this.whitespace_before_token=" ";else if(u){var l=this.__split(this._newline_regexp,u);this.newline_count=l.length-1,this.whitespace_before_token=l[this.newline_count]}return u},i.prototype.matching=function(u,l){var e=this._create();return e.__set_whitespace_patterns(u,l),e._update(),e},i.prototype._create=function(){return new i(this._input,this)},i.prototype.__split=function(u,l){u.lastIndex=0;for(var e=0,t=[],n=u.exec(l);n;)t.push(l.substring(e,n.index)),e=n.index+n[0].length,n=u.exec(l);return e<l.length?t.push(l.substring(e,l.length)):t.push(""),t},y.exports.WhitespacePattern=i},function(y){function _(s,r){this._input=s,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,r&&(this._starting_pattern=this._input.get_regexp(r._starting_pattern,!0),this._match_pattern=this._input.get_regexp(r._match_pattern,!0),this._until_pattern=this._input.get_regexp(r._until_pattern),this._until_after=r._until_after)}_.prototype.read=function(){var s=this._input.read(this._starting_pattern);return(!this._starting_pattern||s)&&(s+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),s},_.prototype.read_match=function(){return this._input.match(this._match_pattern)},_.prototype.until_after=function(s){var r=this._create();return r._until_after=!0,r._until_pattern=this._input.get_regexp(s),r._update(),r},_.prototype.until=function(s){var r=this._create();return r._until_after=!1,r._until_pattern=this._input.get_regexp(s),r._update(),r},_.prototype.starting_with=function(s){var r=this._create();return r._starting_pattern=this._input.get_regexp(s,!0),r._update(),r},_.prototype.matching=function(s){var r=this._create();return r._match_pattern=this._input.get_regexp(s,!0),r._update(),r},_.prototype._create=function(){return new _(this._input,this)},_.prototype._update=function(){},y.exports.Pattern=_},function(y){function _(s,r){s=typeof s=="string"?s:s.source,r=typeof r=="string"?r:r.source,this.__directives_block_pattern=new RegExp(s+/ beautify( \w+[:]\w+)+ /.source+r,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(s+/\sbeautify\signore:end\s/.source+r,"g")}_.prototype.get_directives=function(s){if(!s.match(this.__directives_block_pattern))return null;var r={};this.__directive_pattern.lastIndex=0;for(var i=this.__directive_pattern.exec(s);i;)r[i[1]]=i[2],i=this.__directive_pattern.exec(s);return r},_.prototype.readIgnored=function(s){return s.readUntilAfter(this.__directives_end_ignore_pattern)},y.exports.Directives=_},function(y,_,s){var r=s(12).Pattern,i={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function u(l,e){r.call(this,l,e),this.__template_pattern=null,this._disabled=Object.assign({},i),this._excluded=Object.assign({},i),e&&(this.__template_pattern=this._input.get_regexp(e.__template_pattern),this._excluded=Object.assign(this._excluded,e._excluded),this._disabled=Object.assign(this._disabled,e._disabled));var t=new r(l);this.__patterns={handlebars_comment:t.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:t.starting_with(/{{{/).until_after(/}}}/),handlebars:t.starting_with(/{{/).until_after(/}}/),php:t.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:t.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:t.starting_with(/{%/).until_after(/%}/),django_value:t.starting_with(/{{/).until_after(/}}/),django_comment:t.starting_with(/{#/).until_after(/#}/),smarty:t.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:t.starting_with(/{\*/).until_after(/\*}/),smarty_literal:t.starting_with(/{literal}/).until_after(/{\/literal}/)}}u.prototype=new r,u.prototype._create=function(){return new u(this._input,this)},u.prototype._update=function(){this.__set_templated_pattern()},u.prototype.disable=function(l){var e=this._create();return e._disabled[l]=!0,e._update(),e},u.prototype.read_options=function(l){var e=this._create();for(var t in i)e._disabled[t]=l.templating.indexOf(t)===-1;return e._update(),e},u.prototype.exclude=function(l){var e=this._create();return e._excluded[l]=!0,e._update(),e},u.prototype.read=function(){var l="";this._match_pattern?l=this._input.read(this._starting_pattern):l=this._input.read(this._starting_pattern,this.__template_pattern);for(var e=this._read_template();e;)this._match_pattern?e+=this._input.read(this._match_pattern):e+=this._input.readUntil(this.__template_pattern),l+=e,e=this._read_template();return this._until_after&&(l+=this._input.readUntilAfter(this._until_pattern)),l},u.prototype.__set_templated_pattern=function(){var l=[];this._disabled.php||l.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||l.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||l.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(l.push(this.__patterns.django._starting_pattern.source),l.push(this.__patterns.django_value._starting_pattern.source),l.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||l.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&l.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+l.join("|")+")")},u.prototype._read_template=function(){var l="",e=this._input.peek();if(e==="<"){var t=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&t==="?"&&(l=l||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&t==="%"&&(l=l||this.__patterns.erb.read())}else e==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(l=l||this.__patterns.handlebars_comment.read(),l=l||this.__patterns.handlebars_unescaped.read(),l=l||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(l=l||this.__patterns.django_value.read()),this._excluded.django||(l=l||this.__patterns.django_comment.read(),l=l||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(l=l||this.__patterns.smarty_comment.read(),l=l||this.__patterns.smarty_literal.read(),l=l||this.__patterns.smarty.read()));return l},y.exports.TemplatablePattern=u},,,,function(y,_,s){var r=s(19).Beautifier,i=s(20).Options;function u(l,e,t,n){var T=new r(l,e,t,n);return T.beautify()}y.exports=u,y.exports.defaultOptions=function(){return new i}},function(y,_,s){var r=s(20).Options,i=s(2).Output,u=s(21).Tokenizer,l=s(21).TOKEN,e=/\r\n|[\r\n]/,t=/\r\n|[\r\n]/g,n=function(c,f){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=c.max_preserve_newlines,this.preserve_newlines=c.preserve_newlines,this._output=new i(c,f)};n.prototype.current_line_has_match=function(c){return this._output.current_line.has_match(c)},n.prototype.set_space_before_token=function(c,f){this._output.space_before_token=c,this._output.non_breaking_space=f},n.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},n.prototype.add_raw_token=function(c){this._output.add_raw_token(c)},n.prototype.print_preserved_newlines=function(c){var f=0;c.type!==l.TEXT&&c.previous.type!==l.TEXT&&(f=c.newlines?1:0),this.preserve_newlines&&(f=c.newlines<this.max_preserve_newlines+1?c.newlines:this.max_preserve_newlines+1);for(var S=0;S<f;S++)this.print_newline(S>0);return f!==0},n.prototype.traverse_whitespace=function(c){return c.whitespace_before||c.newlines?(this.print_preserved_newlines(c)||(this._output.space_before_token=!0),!0):!1},n.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},n.prototype.print_newline=function(c){this._output.add_new_line(c)},n.prototype.print_token=function(c){c.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(c.text))},n.prototype.indent=function(){this.indent_level++},n.prototype.get_full_indent=function(c){return c=this.indent_level+(c||0),c<1?"":this._output.get_indent_string(c)};var T=function(c){for(var f=null,S=c.next;S.type!==l.EOF&&c.closed!==S;){if(S.type===l.ATTRIBUTE&&S.text==="type"){S.next&&S.next.type===l.EQUALS&&S.next.next&&S.next.next.type===l.VALUE&&(f=S.next.next.text);break}S=S.next}return f},b=function(c,f){var S=null,A=null;return f.closed?(c==="script"?S="text/javascript":c==="style"&&(S="text/css"),S=T(f)||S,S.search("text/css")>-1?A="css":S.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?A="javascript":S.search(/(text|application|dojo)\/(x-)?(html)/)>-1?A="html":S.search(/test\/null/)>-1&&(A="null"),A):null};function g(c,f){return f.indexOf(c)!==-1}function E(c,f,S){this.parent=c||null,this.tag=f?f.tag_name:"",this.indent_level=S||0,this.parser_token=f||null}function v(c){this._printer=c,this._current_frame=null}v.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},v.prototype.record_tag=function(c){var f=new E(this._current_frame,c,this._printer.indent_level);this._current_frame=f},v.prototype._try_pop_frame=function(c){var f=null;return c&&(f=c.parser_token,this._printer.indent_level=c.indent_level,this._current_frame=c.parent),f},v.prototype._get_frame=function(c,f){for(var S=this._current_frame;S&&!(c.indexOf(S.tag)!==-1);){if(f&&f.indexOf(S.tag)!==-1){S=null;break}S=S.parent}return S},v.prototype.try_pop=function(c,f){var S=this._get_frame([c],f);return this._try_pop_frame(S)},v.prototype.indent_to_tag=function(c){var f=this._get_frame(c);f&&(this._printer.indent_level=f.indent_level)};function p(c,f,S,A){this._source_text=c||"",f=f||{},this._js_beautify=S,this._css_beautify=A,this._tag_stack=null;var R=new r(f,"html");this._options=R,this._is_wrap_attributes_force=this._options.wrap_attributes.substr(0,"force".length)==="force",this._is_wrap_attributes_force_expand_multiline=this._options.wrap_attributes==="force-expand-multiline",this._is_wrap_attributes_force_aligned=this._options.wrap_attributes==="force-aligned",this._is_wrap_attributes_aligned_multiple=this._options.wrap_attributes==="aligned-multiple",this._is_wrap_attributes_preserve=this._options.wrap_attributes.substr(0,"preserve".length)==="preserve",this._is_wrap_attributes_preserve_aligned=this._options.wrap_attributes==="preserve-aligned"}p.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var c=this._source_text,f=this._options.eol;this._options.eol==="auto"&&(f=`
|
|
`,c&&e.test(c)&&(f=c.match(e)[0])),c=c.replace(t,`
|
|
`);var S=c.match(/^[\t ]*/)[0],A={text:"",type:""},R=new d,B=new n(this._options,S),U=new u(c,this._options).tokenize();this._tag_stack=new v(B);for(var K=null,D=U.next();D.type!==l.EOF;)D.type===l.TAG_OPEN||D.type===l.COMMENT?(K=this._handle_tag_open(B,D,R,A),R=K):D.type===l.ATTRIBUTE||D.type===l.EQUALS||D.type===l.VALUE||D.type===l.TEXT&&!R.tag_complete?K=this._handle_inside_tag(B,D,R,U):D.type===l.TAG_CLOSE?K=this._handle_tag_close(B,D,R):D.type===l.TEXT?K=this._handle_text(B,D,R):B.add_raw_token(D),A=K,D=U.next();var H=B._output.get_code(f);return H},p.prototype._handle_tag_close=function(c,f,S){var A={text:f.text,type:f.type};return c.alignment_size=0,S.tag_complete=!0,c.set_space_before_token(f.newlines||f.whitespace_before!=="",!0),S.is_unformatted?c.add_raw_token(f):(S.tag_start_char==="<"&&(c.set_space_before_token(f.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&S.has_wrapped_attrs&&c.print_newline(!1)),c.print_token(f)),S.indent_content&&!(S.is_unformatted||S.is_content_unformatted)&&(c.indent(),S.indent_content=!1),!S.is_inline_element&&!(S.is_unformatted||S.is_content_unformatted)&&c.set_wrap_point(),A},p.prototype._handle_inside_tag=function(c,f,S,A){var R=S.has_wrapped_attrs,B={text:f.text,type:f.type};if(c.set_space_before_token(f.newlines||f.whitespace_before!=="",!0),S.is_unformatted)c.add_raw_token(f);else if(S.tag_start_char==="{"&&f.type===l.TEXT)c.print_preserved_newlines(f)?(f.newlines=0,c.add_raw_token(f)):c.print_token(f);else{if(f.type===l.ATTRIBUTE?(c.set_space_before_token(!0),S.attr_count+=1):(f.type===l.EQUALS||f.type===l.VALUE&&f.previous.type===l.EQUALS)&&c.set_space_before_token(!1),f.type===l.ATTRIBUTE&&S.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(c.traverse_whitespace(f),R=R||f.newlines!==0),this._is_wrap_attributes_force)){var U=S.attr_count>1;if(this._is_wrap_attributes_force_expand_multiline&&S.attr_count===1){var K=!0,D=0,H;do{if(H=A.peek(D),H.type===l.ATTRIBUTE){K=!1;break}D+=1}while(D<4&&H.type!==l.EOF&&H.type!==l.TAG_CLOSE);U=!K}U&&(c.print_newline(!1),R=!0)}c.print_token(f),R=R||c.previous_token_wrapped(),S.has_wrapped_attrs=R}return B},p.prototype._handle_text=function(c,f,S){var A={text:f.text,type:"TK_CONTENT"};return S.custom_beautifier_name?this._print_custom_beatifier_text(c,f,S):S.is_unformatted||S.is_content_unformatted?c.add_raw_token(f):(c.traverse_whitespace(f),c.print_token(f)),A},p.prototype._print_custom_beatifier_text=function(c,f,S){var A=this;if(f.text!==""){var R=f.text,B,U=1,K="",D="";S.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?B=this._js_beautify:S.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?B=this._css_beautify:S.custom_beautifier_name==="html"&&(B=function(ye,be){var we=new p(ye,be,A._js_beautify,A._css_beautify);return we.beautify()}),this._options.indent_scripts==="keep"?U=0:this._options.indent_scripts==="separate"&&(U=-c.indent_level);var H=c.get_full_indent(U);if(R=R.replace(/\n[ \t]*$/,""),S.custom_beautifier_name!=="html"&&R[0]==="<"&&R.match(/^(<!--|<!\[CDATA\[)/)){var V=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(R);if(!V){c.add_raw_token(f);return}K=H+V[1]+`
|
|
`,R=V[4],V[5]&&(D=H+V[5]),R=R.replace(/\n[ \t]*$/,""),(V[2]||V[3].indexOf(`
|
|
`)!==-1)&&(V=V[3].match(/[ \t]+$/),V&&(f.whitespace_before=V[0]))}if(R)if(B){var ne=function(){this.eol=`
|
|
`};ne.prototype=this._options.raw_options;var ie=new ne;R=B(H+R,ie)}else{var _e=f.whitespace_before;_e&&(R=R.replace(new RegExp(`
|
|
(`+_e+")?","g"),`
|
|
`)),R=H+R.replace(/\n/g,`
|
|
`+H)}K&&(R?R=K+R+`
|
|
`+D:R=K+D),c.print_newline(!1),R&&(f.text=R,f.whitespace_before="",f.newlines=0,c.add_raw_token(f),c.print_newline(!0))}},p.prototype._handle_tag_open=function(c,f,S,A){var R=this._get_tag_open_token(f);return(S.is_unformatted||S.is_content_unformatted)&&!S.is_empty_element&&f.type===l.TAG_OPEN&&f.text.indexOf("</")===0?(c.add_raw_token(f),R.start_tag_token=this._tag_stack.try_pop(R.tag_name)):(c.traverse_whitespace(f),this._set_tag_position(c,f,R,S,A),R.is_inline_element||c.set_wrap_point(),c.print_token(f)),(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(R.alignment_size=f.text.length+1),!R.tag_complete&&!R.is_unformatted&&(c.alignment_size=R.alignment_size),R};var d=function(c,f){if(this.parent=c||null,this.text="",this.type="TK_TAG_OPEN",this.tag_name="",this.is_inline_element=!1,this.is_unformatted=!1,this.is_content_unformatted=!1,this.is_empty_element=!1,this.is_start_tag=!1,this.is_end_tag=!1,this.indent_content=!1,this.multiline_content=!1,this.custom_beautifier_name=null,this.start_tag_token=null,this.attr_count=0,this.has_wrapped_attrs=!1,this.alignment_size=0,this.tag_complete=!1,this.tag_start_char="",this.tag_check="",!f)this.tag_complete=!0;else{var S;this.tag_start_char=f.text[0],this.text=f.text,this.tag_start_char==="<"?(S=f.text.match(/^<([^\s>]*)/),this.tag_check=S?S[1]:""):(S=f.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=S?S[1]:"",(f.text.startsWith("{{#>")||f.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&f.next!==null?this.tag_check=f.next.text.split(" ")[0]:this.tag_check=f.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),f.type===l.COMMENT&&(this.tag_complete=!0),this.is_start_tag=this.tag_check.charAt(0)!=="/",this.tag_name=this.is_start_tag?this.tag_check:this.tag_check.substr(1),this.is_end_tag=!this.is_start_tag||f.closed&&f.closed.text==="/>";var A=2;this.tag_start_char==="{"&&this.text.length>=3&&(this.text.charAt(2)==="~"&&(A=3)),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(this.text.length<3||/[^#\^]/.test(this.text.charAt(A)))}};p.prototype._get_tag_open_token=function(c){var f=new d(this._tag_stack.get_parser_token(),c);return f.alignment_size=this._options.wrap_attributes_indent_size,f.is_end_tag=f.is_end_tag||g(f.tag_check,this._options.void_elements),f.is_empty_element=f.tag_complete||f.is_start_tag&&f.is_end_tag,f.is_unformatted=!f.tag_complete&&g(f.tag_check,this._options.unformatted),f.is_content_unformatted=!f.is_empty_element&&g(f.tag_check,this._options.content_unformatted),f.is_inline_element=g(f.tag_name,this._options.inline)||f.tag_name.includes("-")||f.tag_start_char==="{",f},p.prototype._set_tag_position=function(c,f,S,A,R){if(S.is_empty_element||(S.is_end_tag?S.start_tag_token=this._tag_stack.try_pop(S.tag_name):(this._do_optional_end_element(S)&&(S.is_inline_element||c.print_newline(!1)),this._tag_stack.record_tag(S),(S.tag_name==="script"||S.tag_name==="style")&&!(S.is_unformatted||S.is_content_unformatted)&&(S.custom_beautifier_name=b(S.tag_check,f)))),g(S.tag_check,this._options.extra_liners)&&(c.print_newline(!1),c._output.just_added_blankline()||c.print_newline(!0)),S.is_empty_element){if(S.tag_start_char==="{"&&S.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),S.indent_content=!0;var B=c.current_line_has_match(/{{#if/);B||c.print_newline(!1)}S.tag_name==="!--"&&R.type===l.TAG_CLOSE&&A.is_end_tag&&S.text.indexOf(`
|
|
`)===-1||(S.is_inline_element||S.is_unformatted||c.print_newline(!1),this._calcluate_parent_multiline(c,S))}else if(S.is_end_tag){var U=!1;U=S.start_tag_token&&S.start_tag_token.multiline_content,U=U||!S.is_inline_element&&!(A.is_inline_element||A.is_unformatted)&&!(R.type===l.TAG_CLOSE&&S.start_tag_token===A)&&R.type!=="TK_CONTENT",(S.is_content_unformatted||S.is_unformatted)&&(U=!1),U&&c.print_newline(!1)}else S.indent_content=!S.custom_beautifier_name,S.tag_start_char==="<"&&(S.tag_name==="html"?S.indent_content=this._options.indent_inner_html:S.tag_name==="head"?S.indent_content=this._options.indent_head_inner_html:S.tag_name==="body"&&(S.indent_content=this._options.indent_body_inner_html)),!(S.is_inline_element||S.is_unformatted)&&(R.type!=="TK_CONTENT"||S.is_content_unformatted)&&c.print_newline(!1),this._calcluate_parent_multiline(c,S)},p.prototype._calcluate_parent_multiline=function(c,f){f.parent&&c._output.just_added_newline()&&!((f.is_inline_element||f.is_unformatted)&&f.parent.is_inline_element)&&(f.parent.multiline_content=!0)};var a=["address","article","aside","blockquote","details","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","main","nav","ol","p","pre","section","table","ul"],o=["a","audio","del","ins","map","noscript","video"];p.prototype._do_optional_end_element=function(c){var f=null;if(c.is_empty_element||!c.is_start_tag||!c.parent)return;if(c.tag_name==="body")f=f||this._tag_stack.try_pop("head");else if(c.tag_name==="li")f=f||this._tag_stack.try_pop("li",["ol","ul"]);else if(c.tag_name==="dd"||c.tag_name==="dt")f=f||this._tag_stack.try_pop("dt",["dl"]),f=f||this._tag_stack.try_pop("dd",["dl"]);else if(c.parent.tag_name==="p"&&a.indexOf(c.tag_name)!==-1){var S=c.parent.parent;(!S||o.indexOf(S.tag_name)===-1)&&(f=f||this._tag_stack.try_pop("p"))}else c.tag_name==="rp"||c.tag_name==="rt"?(f=f||this._tag_stack.try_pop("rt",["ruby","rtc"]),f=f||this._tag_stack.try_pop("rp",["ruby","rtc"])):c.tag_name==="optgroup"?f=f||this._tag_stack.try_pop("optgroup",["select"]):c.tag_name==="option"?f=f||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):c.tag_name==="colgroup"?f=f||this._tag_stack.try_pop("caption",["table"]):c.tag_name==="thead"?(f=f||this._tag_stack.try_pop("caption",["table"]),f=f||this._tag_stack.try_pop("colgroup",["table"])):c.tag_name==="tbody"||c.tag_name==="tfoot"?(f=f||this._tag_stack.try_pop("caption",["table"]),f=f||this._tag_stack.try_pop("colgroup",["table"]),f=f||this._tag_stack.try_pop("thead",["table"]),f=f||this._tag_stack.try_pop("tbody",["table"])):c.tag_name==="tr"?(f=f||this._tag_stack.try_pop("caption",["table"]),f=f||this._tag_stack.try_pop("colgroup",["table"]),f=f||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):(c.tag_name==="th"||c.tag_name==="td")&&(f=f||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),f=f||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return c.parent=this._tag_stack.get_parser_token(),f},y.exports.Beautifier=p},function(y,_,s){var r=s(6).Options;function i(u){r.call(this,u,"html"),this.templating.length===1&&this.templating[0]==="auto"&&(this.templating=["django","erb","handlebars","php"]),this.indent_inner_html=this._get_boolean("indent_inner_html"),this.indent_body_inner_html=this._get_boolean("indent_body_inner_html",!0),this.indent_head_inner_html=this._get_boolean("indent_head_inner_html",!0),this.indent_handlebars=this._get_boolean("indent_handlebars",!0),this.wrap_attributes=this._get_selection("wrap_attributes",["auto","force","force-aligned","force-expand-multiline","aligned-multiple","preserve","preserve-aligned"]),this.wrap_attributes_indent_size=this._get_number("wrap_attributes_indent_size",this.indent_size),this.extra_liners=this._get_array("extra_liners",["head","body","/html"]),this.inline=this._get_array("inline",["a","abbr","area","audio","b","bdi","bdo","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","keygen","label","map","mark","math","meter","noscript","object","output","progress","q","ruby","s","samp","select","small","span","strong","sub","sup","svg","template","textarea","time","u","var","video","wbr","text","acronym","big","strike","tt"]),this.void_elements=this._get_array("void_elements",["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr","!doctype","?xml","basefont","isindex"]),this.unformatted=this._get_array("unformatted",[]),this.content_unformatted=this._get_array("content_unformatted",["pre","textarea"]),this.unformatted_content_delimiter=this._get_characters("unformatted_content_delimiter"),this.indent_scripts=this._get_selection("indent_scripts",["normal","keep","separate"])}i.prototype=new r,y.exports.Options=i},function(y,_,s){var r=s(9).Tokenizer,i=s(9).TOKEN,u=s(13).Directives,l=s(14).TemplatablePattern,e=s(12).Pattern,t={TAG_OPEN:"TK_TAG_OPEN",TAG_CLOSE:"TK_TAG_CLOSE",ATTRIBUTE:"TK_ATTRIBUTE",EQUALS:"TK_EQUALS",VALUE:"TK_VALUE",COMMENT:"TK_COMMENT",TEXT:"TK_TEXT",UNKNOWN:"TK_UNKNOWN",START:i.START,RAW:i.RAW,EOF:i.EOF},n=new u(/<\!--/,/-->/),T=function(b,g){r.call(this,b,g),this._current_tag_name="";var E=new l(this._input).read_options(this._options),v=new e(this._input);if(this.__patterns={word:E.until(/[\n\r\t <]/),single_quote:E.until_after(/'/),double_quote:E.until_after(/"/),attribute:E.until(/[\n\r\t =>]|\/>/),element_name:E.until(/[\n\r\t >\/]/),handlebars_comment:v.starting_with(/{{!--/).until_after(/--}}/),handlebars:v.starting_with(/{{/).until_after(/}}/),handlebars_open:v.until(/[\n\r\t }]/),handlebars_raw_close:v.until(/}}/),comment:v.starting_with(/<!--/).until_after(/-->/),cdata:v.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:v.starting_with(/<!\[/).until_after(/]>/),processing:v.starting_with(/<\?/).until_after(/\?>/)},this._options.indent_handlebars&&(this.__patterns.word=this.__patterns.word.exclude("handlebars")),this._unformatted_content_delimiter=null,this._options.unformatted_content_delimiter){var p=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=v.matching(p).until_after(p)}};T.prototype=new r,T.prototype._is_comment=function(b){return!1},T.prototype._is_opening=function(b){return b.type===t.TAG_OPEN},T.prototype._is_closing=function(b,g){return b.type===t.TAG_CLOSE&&g&&((b.text===">"||b.text==="/>")&&g.text[0]==="<"||b.text==="}}"&&g.text[0]==="{"&&g.text[1]==="{")},T.prototype._reset=function(){this._current_tag_name=""},T.prototype._get_next_token=function(b,g){var E=null;this._readWhitespace();var v=this._input.peek();return v===null?this._create_token(t.EOF,""):(E=E||this._read_open_handlebars(v,g),E=E||this._read_attribute(v,b,g),E=E||this._read_close(v,g),E=E||this._read_raw_content(v,b,g),E=E||this._read_content_word(v),E=E||this._read_comment_or_cdata(v),E=E||this._read_processing(v),E=E||this._read_open(v,g),E=E||this._create_token(t.UNKNOWN,this._input.next()),E)},T.prototype._read_comment_or_cdata=function(b){var g=null,E=null,v=null;if(b==="<"){var p=this._input.peek(1);p==="!"&&(E=this.__patterns.comment.read(),E?(v=n.get_directives(E),v&&v.ignore==="start"&&(E+=n.readIgnored(this._input))):E=this.__patterns.cdata.read()),E&&(g=this._create_token(t.COMMENT,E),g.directives=v)}return g},T.prototype._read_processing=function(b){var g=null,E=null,v=null;if(b==="<"){var p=this._input.peek(1);(p==="!"||p==="?")&&(E=this.__patterns.conditional_comment.read(),E=E||this.__patterns.processing.read()),E&&(g=this._create_token(t.COMMENT,E),g.directives=v)}return g},T.prototype._read_open=function(b,g){var E=null,v=null;return g||b==="<"&&(E=this._input.next(),this._input.peek()==="/"&&(E+=this._input.next()),E+=this.__patterns.element_name.read(),v=this._create_token(t.TAG_OPEN,E)),v},T.prototype._read_open_handlebars=function(b,g){var E=null,v=null;return g||this._options.indent_handlebars&&b==="{"&&this._input.peek(1)==="{"&&(this._input.peek(2)==="!"?(E=this.__patterns.handlebars_comment.read(),E=E||this.__patterns.handlebars.read(),v=this._create_token(t.COMMENT,E)):(E=this.__patterns.handlebars_open.read(),v=this._create_token(t.TAG_OPEN,E))),v},T.prototype._read_close=function(b,g){var E=null,v=null;return g&&(g.text[0]==="<"&&(b===">"||b==="/"&&this._input.peek(1)===">")?(E=this._input.next(),b==="/"&&(E+=this._input.next()),v=this._create_token(t.TAG_CLOSE,E)):g.text[0]==="{"&&b==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),v=this._create_token(t.TAG_CLOSE,"}}"))),v},T.prototype._read_attribute=function(b,g,E){var v=null,p="";if(E&&E.text[0]==="<")if(b==="=")v=this._create_token(t.EQUALS,this._input.next());else if(b==='"'||b==="'"){var d=this._input.next();b==='"'?d+=this.__patterns.double_quote.read():d+=this.__patterns.single_quote.read(),v=this._create_token(t.VALUE,d)}else p=this.__patterns.attribute.read(),p&&(g.type===t.EQUALS?v=this._create_token(t.VALUE,p):v=this._create_token(t.ATTRIBUTE,p));return v},T.prototype._is_content_unformatted=function(b){return this._options.void_elements.indexOf(b)===-1&&(this._options.content_unformatted.indexOf(b)!==-1||this._options.unformatted.indexOf(b)!==-1)},T.prototype._read_raw_content=function(b,g,E){var v="";if(E&&E.text[0]==="{")v=this.__patterns.handlebars_raw_close.read();else if(g.type===t.TAG_CLOSE&&g.opened.text[0]==="<"&&g.text[0]!=="/"){var p=g.opened.text.substr(1).toLowerCase();if(p==="script"||p==="style"){var d=this._read_comment_or_cdata(b);if(d)return d.type=t.TEXT,d;v=this._input.readUntil(new RegExp("</"+p+"[\\n\\r\\t ]*?>","ig"))}else this._is_content_unformatted(p)&&(v=this._input.readUntil(new RegExp("</"+p+"[\\n\\r\\t ]*?>","ig")))}return v?this._create_token(t.TEXT,v):null},T.prototype._read_content_word=function(b){var g="";if(this._options.unformatted_content_delimiter&&(b===this._options.unformatted_content_delimiter[0]&&(g=this.__patterns.unformatted_content_delimiter.read())),g||(g=this.__patterns.word.read()),g)return this._create_token(t.TEXT,g)},y.exports.Tokenizer=T,y.exports.TOKEN=t}],N={};function O(y){var _=N[y];if(_!==void 0)return _.exports;var s=N[y]={exports:{}};return F[y](s,s.exports,O),s.exports}var w=O(18);C=w})();var k=C;if(!0)!(pe=[se,se("6UM0"),se("TXwP")],j=function(F){var N=se("6UM0"),O=se("TXwP");return{html_beautify:function(w,y){return k(w,y,N.js_beautify,O.css_beautify)}}}.apply(ft,pe),j!==void 0&&(xt.exports=j));else var x,L})()},"rAM+":function(xt,ft,se){"use strict";se.d(ft,"a",function(){return j});var pe=se("Qw5x");function j(C,k){var x;if(typeof Symbol=="undefined"||C[Symbol.iterator]==null){if(Array.isArray(C)||(x=Object(pe.a)(C))||k&&C&&typeof C.length=="number"){x&&(C=x);var L=0,F=function(){};return{s:F,n:function(){return L>=C.length?{done:!0}:{done:!1,value:C[L++]}},e:function(_){throw _},f:F}}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 N=!0,O=!1,w;return{s:function(){x=C[Symbol.iterator]()},n:function(){var _=x.next();return N=_.done,_},e:function(_){O=!0,w=_},f:function(){try{!N&&x.return!=null&&x.return()}finally{if(O)throw w}}}}},rUJ1:function(xt,ft){const se=/[&<>"']/,pe=/[&<>"']/g,j=/[<>"']|&(?!#?\w+;)/,C=/[<>"']|&(?!#?\w+;)/g,k={"&":"&","<":"<",">":">",'"':""","'":"'"},x=v=>k[v];function L(v,p){if(p){if(se.test(v))return v.replace(pe,x)}else if(j.test(v))return v.replace(C,x);return v}const F=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function N(v){return v.replace(F,(p,d)=>(d=d.toLowerCase(),d==="colon"?":":d.charAt(0)==="#"?d.charAt(1)==="x"?String.fromCharCode(parseInt(d.substring(2),16)):String.fromCharCode(+d.substring(1)):""))}const O=/(^|[^\[])\^/g;function w(v,p){v=v.source||v,p=p||"";const d={replace:(a,o)=>(o=o.source||o,o=o.replace(O,"$1"),v=v.replace(a,o),d),getRegex:()=>new RegExp(v,p)};return d}const y=/[^\w:]/g,_=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function s(v,p,d){if(v){let a;try{a=decodeURIComponent(N(d)).replace(y,"").toLowerCase()}catch(o){return null}if(a.indexOf("javascript:")===0||a.indexOf("vbscript:")===0||a.indexOf("data:")===0)return null}p&&!_.test(d)&&(d=e(p,d));try{d=encodeURI(d).replace(/%25/g,"%")}catch(a){return null}return d}const r={},i=/^[^:]+:\/*[^/]*$/,u=/^([^:]+:)[\s\S]*$/,l=/^([^:]+:\/*[^/]*)[\s\S]*$/;function e(v,p){r[" "+v]||(i.test(v)?r[" "+v]=v+"/":r[" "+v]=b(v,"/",!0)),v=r[" "+v];const d=v.indexOf(":")===-1;return p.substring(0,2)==="//"?d?p:v.replace(u,"$1")+p:p.charAt(0)==="/"?d?p:v.replace(l,"$1")+p:v+p}const t={exec:function(){}};function n(v){let p=1,d,a;for(;p<arguments.length;p++){d=arguments[p];for(a in d)Object.prototype.hasOwnProperty.call(d,a)&&(v[a]=d[a])}return v}function T(v,p){const d=v.replace(/\|/g,(c,f,S)=>{let A=!1,R=f;for(;--R>=0&&S[R]==="\\";)A=!A;return A?"|":" |"}),a=d.split(/ \|/);let o=0;if(a.length>p)a.splice(p);else for(;a.length<p;)a.push("");for(;o<a.length;o++)a[o]=a[o].trim().replace(/\\\|/g,"|");return a}function b(v,p,d){const a=v.length;if(a===0)return"";let o=0;for(;o<a;){const c=v.charAt(a-o-1);if(c===p&&!d)o++;else if(c!==p&&d)o++;else break}return v.substr(0,a-o)}function g(v,p){if(v.indexOf(p[1])===-1)return-1;const d=v.length;let a=0,o=0;for(;o<d;o++)if(v[o]==="\\")o++;else if(v[o]===p[0])a++;else if(v[o]===p[1]&&(a--,a<0))return o;return-1}function E(v){v&&v.sanitize&&!v.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")}xt.exports={escape:L,unescape:N,edit:w,cleanUrl:s,resolveUrl:e,noopTest:t,merge:n,splitCells:T,rtrim:b,findClosingBracket:g,checkSanitizeDeprecation:E}},t23M:function(xt,ft,se){"use strict";var pe=se("VTBJ"),j=se("1OyB"),C=se("vuIU"),k=se("Ji7U"),x=se("LK+K"),L=se("q1tI"),F=se.n(L),N=se("m+aA"),O=se("Zm9Q"),w=se("Kwbf"),y=se("c+Xe"),_=se("bdgK"),s="rc-observer-key",r=function(i){Object(k.a)(l,i);var u=Object(x.a)(l);function l(){var e;return Object(j.a)(this,l),e=u.apply(this,arguments),e.resizeObserver=null,e.childNode=null,e.currentElement=null,e.state={width:0,height:0,offsetHeight:0,offsetWidth:0},e.onResize=function(t){var n=e.props.onResize,T=t[0].target,b=T.getBoundingClientRect(),g=b.width,E=b.height,v=T.offsetWidth,p=T.offsetHeight,d=Math.floor(g),a=Math.floor(E);if(e.state.width!==d||e.state.height!==a||e.state.offsetWidth!==v||e.state.offsetHeight!==p){var o={width:d,height:a,offsetWidth:v,offsetHeight:p};e.setState(o),n&&Promise.resolve().then(function(){n(Object(pe.a)(Object(pe.a)({},o),{},{offsetWidth:v,offsetHeight:p}))})}},e.setChildNode=function(t){e.childNode=t},e}return Object(C.a)(l,[{key:"componentDidMount",value:function(){this.onComponentUpdated()}},{key:"componentDidUpdate",value:function(){this.onComponentUpdated()}},{key:"componentWillUnmount",value:function(){this.destroyObserver()}},{key:"onComponentUpdated",value:function(){var t=this.props.disabled;if(t){this.destroyObserver();return}var n=Object(N.a)(this.childNode||this),T=n!==this.currentElement;T&&(this.destroyObserver(),this.currentElement=n),!this.resizeObserver&&n&&(this.resizeObserver=new _.default(this.onResize),this.resizeObserver.observe(n))}},{key:"destroyObserver",value:function(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}},{key:"render",value:function(){var t=this.props.children,n=Object(O.a)(t);if(n.length>1)Object(w.a)(!1,"Find more than one child node with `children` in ResizeObserver. Will only observe first one.");else if(n.length===0)return Object(w.a)(!1,"`children` of ResizeObserver is empty. Nothing is in observe."),null;var T=n[0];if(L.isValidElement(T)&&Object(y.c)(T)){var b=T.ref;n[0]=L.cloneElement(T,{ref:Object(y.a)(b,this.setChildNode)})}return n.length===1?n[0]:n.map(function(g,E){return!L.isValidElement(g)||"key"in g&&g.key!==null?g:L.cloneElement(g,{key:"".concat(s,"-").concat(E)})})}}]),l}(L.Component);r.displayName="ResizeObserver",ft.a=r},ulZh:function(xt,ft,se){typeof window!="undefined"&&function(j,C){xt.exports=C()}(this,function(){return function(pe){var j={};function C(k){if(j[k])return j[k].exports;var x=j[k]={i:k,l:!1,exports:{}};return pe[k].call(x.exports,x,x.exports,C),x.l=!0,x.exports}return C.m=pe,C.c=j,C.d=function(k,x,L){C.o(k,x)||Object.defineProperty(k,x,{enumerable:!0,get:L})},C.r=function(k){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(k,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(k,"__esModule",{value:!0})},C.t=function(k,x){if(x&1&&(k=C(k)),x&8)return k;if(x&4&&typeof k=="object"&&k&&k.__esModule)return k;var L=Object.create(null);if(C.r(L),Object.defineProperty(L,"default",{enumerable:!0,value:k}),x&2&&typeof k!="string")for(var F in k)C.d(L,F,function(N){return k[N]}.bind(null,F));return L},C.n=function(k){var x=k&&k.__esModule?function(){return k.default}:function(){return k};return C.d(x,"a",x),x},C.o=function(k,x){return Object.prototype.hasOwnProperty.call(k,x)},C.p="/dist/",C(C.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(pe,j,C){"use strict";var k=Object.prototype.hasOwnProperty,x="~";function L(){}Object.create&&(L.prototype=Object.create(null),new L().__proto__||(x=!1));function F(y,_,s){this.fn=y,this.context=_,this.once=s||!1}function N(y,_,s,r,i){if(typeof s!="function")throw new TypeError("The listener must be a function");var u=new F(s,r||y,i),l=x?x+_:_;return y._events[l]?y._events[l].fn?y._events[l]=[y._events[l],u]:y._events[l].push(u):(y._events[l]=u,y._eventsCount++),y}function O(y,_){--y._eventsCount===0?y._events=new L:delete y._events[_]}function w(){this._events=new L,this._eventsCount=0}w.prototype.eventNames=function(){var _=[],s,r;if(this._eventsCount===0)return _;for(r in s=this._events)k.call(s,r)&&_.push(x?r.slice(1):r);return Object.getOwnPropertySymbols?_.concat(Object.getOwnPropertySymbols(s)):_},w.prototype.listeners=function(_){var s=x?x+_:_,r=this._events[s];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,u=r.length,l=new Array(u);i<u;i++)l[i]=r[i].fn;return l},w.prototype.listenerCount=function(_){var s=x?x+_:_,r=this._events[s];return r?r.fn?1:r.length:0},w.prototype.emit=function(_,s,r,i,u,l){var e=x?x+_:_;if(!this._events[e])return!1;var t=this._events[e],n=arguments.length,T,b;if(t.fn){t.once&&this.removeListener(_,t.fn,void 0,!0);switch(n){case 1:return t.fn.call(t.context),!0;case 2:return t.fn.call(t.context,s),!0;case 3:return t.fn.call(t.context,s,r),!0;case 4:return t.fn.call(t.context,s,r,i),!0;case 5:return t.fn.call(t.context,s,r,i,u),!0;case 6:return t.fn.call(t.context,s,r,i,u,l),!0}for(b=1,T=new Array(n-1);b<n;b++)T[b-1]=arguments[b];t.fn.apply(t.context,T)}else{var g=t.length,E;for(b=0;b<g;b++){t[b].once&&this.removeListener(_,t[b].fn,void 0,!0);switch(n){case 1:t[b].fn.call(t[b].context);break;case 2:t[b].fn.call(t[b].context,s);break;case 3:t[b].fn.call(t[b].context,s,r);break;case 4:t[b].fn.call(t[b].context,s,r,i);break;default:if(!T)for(E=1,T=new Array(n-1);E<n;E++)T[E-1]=arguments[E];t[b].fn.apply(t[b].context,T)}}}return!0},w.prototype.on=function(_,s,r){return N(this,_,s,r,!1)},w.prototype.once=function(_,s,r){return N(this,_,s,r,!0)},w.prototype.removeListener=function(_,s,r,i){var u=x?x+_:_;if(!this._events[u])return this;if(!s)return O(this,u),this;var l=this._events[u];if(l.fn)l.fn===s&&(!i||l.once)&&(!r||l.context===r)&&O(this,u);else{for(var e=0,t=[],n=l.length;e<n;e++)(l[e].fn!==s||i&&!l[e].once||r&&l[e].context!==r)&&t.push(l[e]);t.length?this._events[u]=t.length===1?t[0]:t:O(this,u)}return this},w.prototype.removeAllListeners=function(_){var s;return _?(s=x?x+_:_,this._events[s]&&O(this,s)):(this._events=new L,this._eventsCount=0),this},w.prototype.off=w.prototype.removeListener,w.prototype.addListener=w.prototype.on,w.prefixed=x,w.EventEmitter=w,pe.exports=w},"./node_modules/url-toolkit/src/url-toolkit.js":function(pe,j,C){(function(k){var x=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,L=/^([^\/?#]*)([^]*)$/,F=/(?:\/|^)\.(?=\/)/g,N=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,O={buildAbsoluteURL:function(w,y,_){if(_=_||{},w=w.trim(),y=y.trim(),!y){if(!_.alwaysNormalize)return w;var s=O.parseURL(w);if(!s)throw new Error("Error trying to parse base URL.");return s.path=O.normalizePath(s.path),O.buildURLFromParts(s)}var r=O.parseURL(y);if(!r)throw new Error("Error trying to parse relative URL.");if(r.scheme)return _.alwaysNormalize?(r.path=O.normalizePath(r.path),O.buildURLFromParts(r)):y;var i=O.parseURL(w);if(!i)throw new Error("Error trying to parse base URL.");if(!i.netLoc&&i.path&&i.path[0]!=="/"){var u=L.exec(i.path);i.netLoc=u[1],i.path=u[2]}i.netLoc&&!i.path&&(i.path="/");var l={scheme:i.scheme,netLoc:r.netLoc,path:null,params:r.params,query:r.query,fragment:r.fragment};if(!r.netLoc&&(l.netLoc=i.netLoc,r.path[0]!=="/"))if(!r.path)l.path=i.path,r.params||(l.params=i.params,r.query||(l.query=i.query));else{var e=i.path,t=e.substring(0,e.lastIndexOf("/")+1)+r.path;l.path=O.normalizePath(t)}return l.path===null&&(l.path=_.alwaysNormalize?O.normalizePath(r.path):r.path),O.buildURLFromParts(l)},parseURL:function(w){var y=x.exec(w);return y?{scheme:y[1]||"",netLoc:y[2]||"",path:y[3]||"",params:y[4]||"",query:y[5]||"",fragment:y[6]||""}:null},normalizePath:function(w){for(w=w.split("").reverse().join("").replace(F,"");w.length!==(w=w.replace(N,"")).length;);return w.split("").reverse().join("")},buildURLFromParts:function(w){return w.scheme+w.netLoc+w.path+w.params+w.query+w.fragment}};pe.exports=O})(this)},"./node_modules/webworkify-webpack/index.js":function(pe,j,C){function k(_){var s={};function r(u){if(s[u])return s[u].exports;var l=s[u]={i:u,l:!1,exports:{}};return _[u].call(l.exports,l,l.exports,r),l.l=!0,l.exports}r.m=_,r.c=s,r.i=function(u){return u},r.d=function(u,l,e){r.o(u,l)||Object.defineProperty(u,l,{configurable:!1,enumerable:!0,get:e})},r.r=function(u){Object.defineProperty(u,"__esModule",{value:!0})},r.n=function(u){var l=u&&u.__esModule?function(){return u.default}:function(){return u};return r.d(l,"a",l),l},r.o=function(u,l){return Object.prototype.hasOwnProperty.call(u,l)},r.p="/",r.oe=function(u){throw console.error(u),u};var i=r(r.s=ENTRY_MODULE);return i.default||i}var x="[\\.|\\-|\\+|\\w|/|@]+",L="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+x+").*?\\)";function F(_){return(_+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function N(_){return!isNaN(1*_)}function O(_,s,r){var i={};i[r]=[];var u=s.toString(),l=u.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!l)return i;for(var e=l[1],t=new RegExp("(\\\\n|\\W)"+F(e)+L,"g"),n;n=t.exec(u);){if(n[3]==="dll-reference")continue;i[r].push(n[3])}for(t=new RegExp("\\("+F(e)+'\\("(dll-reference\\s('+x+'))"\\)\\)'+L,"g");n=t.exec(u);)_[n[2]]||(i[r].push(n[1]),_[n[2]]=C(n[1]).m),i[n[2]]=i[n[2]]||[],i[n[2]].push(n[4]);for(var T=Object.keys(i),b=0;b<T.length;b++)for(var g=0;g<i[T[b]].length;g++)N(i[T[b]][g])&&(i[T[b]][g]=1*i[T[b]][g]);return i}function w(_){var s=Object.keys(_);return s.reduce(function(r,i){return r||_[i].length>0},!1)}function y(_,s){for(var r={main:[s]},i={main:[]},u={main:{}};w(r);)for(var l=Object.keys(r),e=0;e<l.length;e++){var t=l[e],n=r[t],T=n.pop();if(u[t]=u[t]||{},u[t][T]||!_[t][T])continue;u[t][T]=!0,i[t]=i[t]||[],i[t].push(T);for(var b=O(_,_[t][T],t),g=Object.keys(b),E=0;E<g.length;E++)r[g[E]]=r[g[E]]||[],r[g[E]]=r[g[E]].concat(b[g[E]])}return i}pe.exports=function(_,s){s=s||{};var r={main:C.m},i=s.all?{main:Object.keys(r.main)}:y(r,_),u="";Object.keys(i).filter(function(T){return T!=="main"}).forEach(function(T){for(var b=0;i[T][b];)b++;i[T].push(b),r[T][b]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",u=u+"var "+T+" = ("+k.toString().replace("ENTRY_MODULE",JSON.stringify(b))+")({"+i[T].map(function(g){return""+JSON.stringify(g)+": "+r[T][g].toString()}).join(",")+`});
|
|
`}),u=u+"new (("+k.toString().replace("ENTRY_MODULE",JSON.stringify(_))+")({"+i.main.map(function(T){return""+JSON.stringify(T)+": "+r.main[T].toString()}).join(",")+"}))(self);";var l=new window.Blob([u],{type:"text/javascript"});if(s.bare)return l;var e=window.URL||window.webkitURL||window.mozURL||window.msURL,t=e.createObjectURL(l),n=new window.Worker(t);return n.objectURL=t,n}},"./src/config.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"hlsDefaultConfig",function(){return E}),C.d(j,"mergeConfig",function(){return p}),C.d(j,"enableStreamingMode",function(){return d});var k=C("./src/controller/abr-controller.ts"),x=C("./src/controller/audio-stream-controller.ts"),L=C("./src/controller/audio-track-controller.ts"),F=C("./src/controller/subtitle-stream-controller.ts"),N=C("./src/controller/subtitle-track-controller.ts"),O=C("./src/controller/buffer-controller.ts"),w=C("./src/controller/timeline-controller.ts"),y=C("./src/controller/cap-level-controller.ts"),_=C("./src/controller/fps-controller.ts"),s=C("./src/controller/eme-controller.ts"),r=C("./src/controller/cmcd-controller.ts"),i=C("./src/utils/xhr-loader.ts"),u=C("./src/utils/fetch-loader.ts"),l=C("./src/utils/cues.ts"),e=C("./src/utils/mediakeys-helper.ts"),t=C("./src/utils/logger.ts");function n(){return n=Object.assign||function(a){for(var o=1;o<arguments.length;o++){var c=arguments[o];for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(a[f]=c[f])}return a},n.apply(this,arguments)}function T(a,o){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(a);o&&(f=f.filter(function(S){return Object.getOwnPropertyDescriptor(a,S).enumerable})),c.push.apply(c,f)}return c}function b(a){for(var o=1;o<arguments.length;o++){var c=arguments[o]!=null?arguments[o]:{};o%2?T(Object(c),!0).forEach(function(f){g(a,f,c[f])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(c)):T(Object(c)).forEach(function(f){Object.defineProperty(a,f,Object.getOwnPropertyDescriptor(c,f))})}return a}function g(a,o,c){return o in a?Object.defineProperty(a,o,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[o]=c,a}var E=b(b({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:i.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:k.default,bufferController:O.default,capLevelController:y.default,fpsController:_.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:e.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},v()),{},{subtitleStreamController:F.SubtitleStreamController,subtitleTrackController:N.default,timelineController:w.TimelineController,audioStreamController:x.default,audioTrackController:L.default,emeController:s.default,cmcdController:r.default});function v(){return{cueHandler:l.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function p(a,o){if((o.liveSyncDurationCount||o.liveMaxLatencyDurationCount)&&(o.liveSyncDuration||o.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(o.liveMaxLatencyDurationCount!==void 0&&(o.liveSyncDurationCount===void 0||o.liveMaxLatencyDurationCount<=o.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(o.liveMaxLatencyDuration!==void 0&&(o.liveSyncDuration===void 0||o.liveMaxLatencyDuration<=o.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return n({},a,o)}function d(a){var o=a.loader;if(o!==u.default&&o!==i.default)t.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),a.progressive=!1;else{var c=Object(u.fetchSupported)();c&&(a.loader=u.default,a.progressive=!0,a.enableSoftwareAES=!0,t.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(pe,j,C){"use strict";C.r(j);var k=C("./src/polyfills/number.ts"),x=C("./src/utils/ewma-bandwidth-estimator.ts"),L=C("./src/events.ts"),F=C("./src/utils/buffer-helper.ts"),N=C("./src/errors.ts"),O=C("./src/types/loader.ts"),w=C("./src/utils/logger.ts");function y(r,i){for(var u=0;u<i.length;u++){var l=i[u];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(r,l.key,l)}}function _(r,i,u){return i&&y(r.prototype,i),u&&y(r,u),r}var s=function(){function r(u){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=u;var l=u.config;this.bwEstimator=new x.default(l.abrEwmaSlowVoD,l.abrEwmaFastVoD,l.abrEwmaDefaultEstimate),this.registerListeners()}var i=r.prototype;return i.registerListeners=function(){var l=this.hls;l.on(L.Events.FRAG_LOADING,this.onFragLoading,this),l.on(L.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(L.Events.FRAG_BUFFERED,this.onFragBuffered,this),l.on(L.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(L.Events.ERROR,this.onError,this)},i.unregisterListeners=function(){var l=this.hls;l.off(L.Events.FRAG_LOADING,this.onFragLoading,this),l.off(L.Events.FRAG_LOADED,this.onFragLoaded,this),l.off(L.Events.FRAG_BUFFERED,this.onFragBuffered,this),l.off(L.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(L.Events.ERROR,this.onError,this)},i.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},i.onFragLoading=function(l,e){var t=e.frag;if(t.type===O.PlaylistLevelType.MAIN&&!this.timer){var n;this.fragCurrent=t,this.partCurrent=(n=e.part)!=null?n:null,this.timer=self.setInterval(this.onCheck,100)}},i.onLevelLoaded=function(l,e){var t=this.hls.config;e.details.live?this.bwEstimator.update(t.abrEwmaSlowLive,t.abrEwmaFastLive):this.bwEstimator.update(t.abrEwmaSlowVoD,t.abrEwmaFastVoD)},i._abandonRulesCheck=function(){var l=this.fragCurrent,e=this.partCurrent,t=this.hls,n=t.autoLevelEnabled,T=t.config,b=t.media;if(!l||!b)return;var g=e?e.stats:l.stats,E=e?e.duration:l.duration;if(g.aborted){w.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!n||b.paused||!b.playbackRate||!b.readyState)return;var v=performance.now()-g.loading.start,p=Math.abs(b.playbackRate);if(v<=500*E/p)return;var d=t.levels,a=t.minAutoLevel,o=d[l.level],c=g.total||Math.max(g.loaded,Math.round(E*o.maxBitrate/8)),f=Math.max(1,g.bwEstimate?g.bwEstimate/8:g.loaded*1e3/v),S=(c-g.loaded)/f,A=b.currentTime,R=(F.BufferHelper.bufferInfo(b,A,T.maxBufferHole).end-A)/p;if(R>=2*E/p||S<=R)return;var B=Number.POSITIVE_INFINITY,U;for(U=l.level-1;U>a;U--){var K=d[U].maxBitrate;if(B=E*K/(8*.8*f),B<R)break}if(B>=S)return;var D=this.bwEstimator.getEstimate();w.logger.warn("Fragment "+l.sn+(e?" part "+e.index:"")+" of level "+l.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+U+`
|
|
Current BW estimate: `+(Object(k.isFiniteNumber)(D)?(D/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+S.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+B.toFixed(3)+` s
|
|
Time to underbuffer: `+R.toFixed(3)+" s"),t.nextLoadLevel=U,this.bwEstimator.sample(v,g.loaded),this.clearTimer(),l.loader&&(this.fragCurrent=this.partCurrent=null,l.loader.abort()),t.trigger(L.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:l,part:e,stats:g})},i.onFragLoaded=function(l,e){var t=e.frag,n=e.part;if(t.type===O.PlaylistLevelType.MAIN&&Object(k.isFiniteNumber)(t.sn)){var T=n?n.stats:t.stats,b=n?n.duration:t.duration;if(this.clearTimer(),this.lastLoadedFragLevel=t.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var g=this.hls.levels[t.level],E=(g.loaded?g.loaded.bytes:0)+T.loaded,v=(g.loaded?g.loaded.duration:0)+b;g.loaded={bytes:E,duration:v},g.realBitrate=Math.round(8*E/v)}if(t.bitrateTest){var p={stats:T,frag:t,part:n,id:t.type};this.onFragBuffered(L.Events.FRAG_BUFFERED,p),t.bitrateTest=!1}}},i.onFragBuffered=function(l,e){var t=e.frag,n=e.part,T=n?n.stats:t.stats;if(T.aborted)return;if(t.type!==O.PlaylistLevelType.MAIN||t.sn==="initSegment")return;var b=T.parsing.end-T.loading.start;this.bwEstimator.sample(b,T.loaded),T.bwEstimate=this.bwEstimator.getEstimate(),t.bitrateTest?this.bitrateTestDelay=b/1e3:this.bitrateTestDelay=0},i.onError=function(l,e){switch(e.details){case N.ErrorDetails.FRAG_LOAD_ERROR:case N.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},i.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},i.getNextABRAutoLevel=function(){var l=this.fragCurrent,e=this.partCurrent,t=this.hls,n=t.maxAutoLevel,T=t.config,b=t.minAutoLevel,g=t.media,E=e?e.duration:l?l.duration:0,v=g?g.currentTime:0,p=g&&g.playbackRate!==0?Math.abs(g.playbackRate):1,d=this.bwEstimator?this.bwEstimator.getEstimate():T.abrEwmaDefaultEstimate,a=(F.BufferHelper.bufferInfo(g,v,T.maxBufferHole).end-v)/p,o=this.findBestLevel(d,b,n,a,T.abrBandWidthFactor,T.abrBandWidthUpFactor);if(o>=0)return o;w.logger.trace((a?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var c=E?Math.min(E,T.maxStarvationDelay):T.maxStarvationDelay,f=T.abrBandWidthFactor,S=T.abrBandWidthUpFactor;if(!a){var A=this.bitrateTestDelay;if(A){var R=E?Math.min(E,T.maxLoadingDelay):T.maxLoadingDelay;c=R-A,w.logger.trace("bitrate test took "+Math.round(1e3*A)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*c)+" ms"),f=S=1}}return o=this.findBestLevel(d,b,n,a+c,f,S),Math.max(o,0)},i.findBestLevel=function(l,e,t,n,T,b){for(var g,E=this.fragCurrent,v=this.partCurrent,p=this.lastLoadedFragLevel,d=this.hls.levels,a=d[p],o=!!(a!=null&&(g=a.details)!==null&&g!==void 0&&g.live),c=a==null?void 0:a.codecSet,f=v?v.duration:E?E.duration:0,S=t;S>=e;S--){var A=d[S];if(!A||c&&A.codecSet!==c)continue;var R=A.details,B=(v?R==null?void 0:R.partTarget:R==null?void 0:R.averagetargetduration)||f,U=void 0;S<=p?U=T*l:U=b*l;var K=d[S].maxBitrate,D=K*B/U;if(w.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+S+"/"+Math.round(U)+"/"+K+"/"+B+"/"+n+"/"+D),U>K&&(!D||o&&!this.bitrateTestDelay||D<n))return S}return-1},_(r,[{key:"nextAutoLevel",get:function(){var l=this._nextAutoLevel,e=this.bwEstimator;if(l!==-1&&(!e||!e.canEstimate()))return l;var t=this.getNextABRAutoLevel();return l!==-1&&(t=Math.min(l,t)),t},set:function(l){this._nextAutoLevel=l}}]),r}();j.default=s},"./src/controller/audio-stream-controller.ts":function(pe,j,C){"use strict";C.r(j);var k=C("./src/polyfills/number.ts"),x=C("./src/controller/base-stream-controller.ts"),L=C("./src/events.ts"),F=C("./src/utils/buffer-helper.ts"),N=C("./src/controller/fragment-tracker.ts"),O=C("./src/types/level.ts"),w=C("./src/types/loader.ts"),y=C("./src/loader/fragment.ts"),_=C("./src/demux/chunk-cache.ts"),s=C("./src/demux/transmuxer-interface.ts"),r=C("./src/types/transmuxer.ts"),i=C("./src/controller/fragment-finders.ts"),u=C("./src/utils/discontinuities.ts"),l=C("./src/errors.ts"),e=C("./src/utils/logger.ts");function t(){return t=Object.assign||function(E){for(var v=1;v<arguments.length;v++){var p=arguments[v];for(var d in p)Object.prototype.hasOwnProperty.call(p,d)&&(E[d]=p[d])}return E},t.apply(this,arguments)}function n(E,v){E.prototype=Object.create(v.prototype),E.prototype.constructor=E,T(E,v)}function T(E,v){return T=Object.setPrototypeOf||function(d,a){return d.__proto__=a,d},T(E,v)}var b=100,g=function(E){n(v,E);function v(d,a){var o;return o=E.call(this,d,a,"[audio-stream-controller]")||this,o.videoBuffer=null,o.videoTrackCC=-1,o.waitingVideoCC=-1,o.audioSwitch=!1,o.trackId=-1,o.waitingData=null,o.mainDetails=null,o.bufferFlushed=!1,o._registerListeners(),o}var p=v.prototype;return p.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},p._registerListeners=function(){var a=this.hls;a.on(L.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(L.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(L.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(L.Events.LEVEL_LOADED,this.onLevelLoaded,this),a.on(L.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),a.on(L.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),a.on(L.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),a.on(L.Events.ERROR,this.onError,this),a.on(L.Events.BUFFER_RESET,this.onBufferReset,this),a.on(L.Events.BUFFER_CREATED,this.onBufferCreated,this),a.on(L.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),a.on(L.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),a.on(L.Events.FRAG_BUFFERED,this.onFragBuffered,this)},p._unregisterListeners=function(){var a=this.hls;a.off(L.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(L.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(L.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(L.Events.LEVEL_LOADED,this.onLevelLoaded,this),a.off(L.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),a.off(L.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),a.off(L.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),a.off(L.Events.ERROR,this.onError,this),a.off(L.Events.BUFFER_RESET,this.onBufferReset,this),a.off(L.Events.BUFFER_CREATED,this.onBufferCreated,this),a.off(L.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),a.off(L.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),a.off(L.Events.FRAG_BUFFERED,this.onFragBuffered,this)},p.onInitPtsFound=function(a,o){var c=o.frag,f=o.id,S=o.initPTS;if(f==="main"){var A=c.cc;this.initPTS[c.cc]=S,this.log("InitPTS for cc: "+A+" found from main: "+S),this.videoTrackCC=A,this.state===x.State.WAITING_INIT_PTS&&this.tick()}},p.startLoad=function(a){if(!this.levels){this.startPosition=a,this.state=x.State.STOPPED;return}var o=this.lastCurrentTime;this.stopLoad(),this.setInterval(b),this.fragLoadError=0,o>0&&a===-1?(this.log("Override startPosition with lastCurrentTime @"+o.toFixed(3)),this.state=x.State.IDLE):(this.loadedmetadata=!1,this.state=x.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=a,this.tick()},p.doTick=function(){switch(this.state){case x.State.IDLE:this.doTickIdle();break;case x.State.WAITING_TRACK:{var a,o=this.levels,c=this.trackId,f=o==null||((a=o[c])===null||a===void 0)?void 0:a.details;if(f){if(this.waitForCdnTuneIn(f))break;this.state=x.State.WAITING_INIT_PTS}break}case x.State.FRAG_LOADING_WAITING_RETRY:{var S,A=performance.now(),R=this.retryDate;(!R||A>=R||(S=this.media)!==null&&S!==void 0&&S.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=x.State.IDLE);break}case x.State.WAITING_INIT_PTS:{var B=this.waitingData;if(B){var U=B.frag,K=B.part,D=B.cache,H=B.complete;if(this.initPTS[U.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=x.State.FRAG_LOADING;var V=D.flush(),ne={frag:U,part:K,payload:V,networkDetails:null};this._handleFragmentLoadProgress(ne),H&&E.prototype._handleFragmentLoadComplete.call(this,ne)}else if(this.videoTrackCC!==this.waitingVideoCC)e.logger.log("Waiting fragment cc ("+U.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ie=this.getLoadPosition(),_e=F.BufferHelper.bufferInfo(this.mediaBuffer,ie,this.config.maxBufferHole),ye=Object(i.fragmentWithinToleranceTest)(_e.end,this.config.maxFragLookUpTolerance,U);ye<0&&(e.logger.log("Waiting fragment cc ("+U.cc+") @ "+U.start+" cancelled because another fragment at "+_e.end+" is needed"),this.clearWaitingFragment())}}else this.state=x.State.IDLE}}this.onTickEnd()},p.clearWaitingFragment=function(){var a=this.waitingData;a&&(this.fragmentTracker.removeFragment(a.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=x.State.IDLE)},p.onTickEnd=function(){var a=this.media;if(!a||!a.readyState)return;var o=this.mediaBuffer?this.mediaBuffer:a,c=o.buffered;!this.loadedmetadata&&c.length&&(this.loadedmetadata=!0),this.lastCurrentTime=a.currentTime},p.doTickIdle=function(){var a,o,c=this.hls,f=this.levels,S=this.media,A=this.trackId,R=c.config;if(!f||!f[A])return;if(!S&&(this.startFragRequested||!R.startFragPrefetch))return;var B=f[A],U=B.details;if(!U||U.live&&this.levelLastLoaded!==A||this.waitForCdnTuneIn(U)){this.state=x.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,y.ElementaryStreamTypes.AUDIO,w.PlaylistLevelType.AUDIO));var K=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,w.PlaylistLevelType.AUDIO);if(K===null)return;var D=K.len,H=this.getMaxBufferLength(),V=this.audioSwitch;if(D>=H&&!V)return;if(!V&&this._streamEnded(K,U)){c.trigger(L.Events.BUFFER_EOS,{type:"audio"}),this.state=x.State.ENDED;return}var ne=U.fragments,ie=ne[0].start,_e=K.end;if(V){var ye=this.getLoadPosition();_e=ye,U.PTSKnown&&ye<ie&&((K.end>ie||K.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),S.currentTime=ie+.05))}var be=this.getNextFragment(_e,U);if(!be){this.bufferFlushed=!0;return}((a=be.decryptdata)===null||a===void 0?void 0:a.keyFormat)==="identity"&&!((o=be.decryptdata)!==null&&o!==void 0&&o.key)?this.loadKey(be,U):this.loadFragment(be,U,_e)},p.getMaxBufferLength=function(){var a=E.prototype.getMaxBufferLength.call(this),o=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,w.PlaylistLevelType.MAIN);return o===null?a:Math.max(a,o.len)},p.onMediaDetaching=function(){this.videoBuffer=null,E.prototype.onMediaDetaching.call(this)},p.onAudioTracksUpdated=function(a,o){var c=o.audioTracks;this.resetTransmuxer(),this.levels=c.map(function(f){return new O.Level(f)})},p.onAudioTrackSwitching=function(a,o){var c=!!o.url;this.trackId=o.id;var f=this.fragCurrent;f!=null&&f.loader&&f.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),c?this.setInterval(b):this.resetTransmuxer(),c?(this.audioSwitch=!0,this.state=x.State.IDLE):this.state=x.State.STOPPED,this.tick()},p.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},p.onLevelLoaded=function(a,o){this.mainDetails=o.details},p.onAudioTrackLoaded=function(a,o){var c,f=this.levels,S=o.details,A=o.id;if(!f){this.warn("Audio tracks were reset while loading level "+A);return}this.log("Track "+A+" loaded ["+S.startSN+","+S.endSN+"],duration:"+S.totalduration);var R=f[A],B=0;if(S.live||(c=R.details)!==null&&c!==void 0&&c.live){var U=this.mainDetails;if(S.fragments[0]||(S.deltaUpdateFailed=!0),S.deltaUpdateFailed||!U)return;!R.details&&S.hasProgramDateTime&&U.hasProgramDateTime?(Object(u.alignMediaPlaylistByPDT)(S,U),B=S.fragments[0].start):B=this.alignPlaylists(S,R.details)}R.details=S,this.levelLastLoaded=A,!this.startFragRequested&&(this.mainDetails||!S.live)&&this.setStartPosition(R.details,B),this.state===x.State.WAITING_TRACK&&!this.waitForCdnTuneIn(S)&&(this.state=x.State.IDLE),this.tick()},p._handleFragmentLoadProgress=function(a){var o,c=a.frag,f=a.part,S=a.payload,A=this.config,R=this.trackId,B=this.levels;if(!B){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+c.sn+" of level "+c.level+" will not be buffered");return}var U=B[R];console.assert(U,"Audio track is defined on fragment load progress");var K=U.details;console.assert(K,"Audio track details are defined on fragment load progress");var D=A.defaultAudioCodec||U.audioCodec||"mp4a.40.2",H=this.transmuxer;H||(H=this.transmuxer=new s.default(this.hls,w.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var V=this.initPTS[c.cc],ne=(o=c.initSegment)===null||o===void 0?void 0:o.data;if(V!==void 0){var ie=!1,_e=f?f.index:-1,ye=_e!==-1,be=new r.ChunkMetadata(c.level,c.sn,c.stats.chunkCount,S.byteLength,_e,ye);H.push(S,ne,D,"",c,f,K.totalduration,ie,be,V)}else{e.logger.log("Unknown video PTS for cc "+c.cc+", waiting for video PTS before demuxing audio frag "+c.sn+" of ["+K.startSN+" ,"+K.endSN+"],track "+R);var we=this.waitingData=this.waitingData||{frag:c,part:f,cache:new _.default,complete:!1},Re=we.cache;Re.push(new Uint8Array(S)),this.waitingVideoCC=this.videoTrackCC,this.state=x.State.WAITING_INIT_PTS}},p._handleFragmentLoadComplete=function(a){if(this.waitingData){this.waitingData.complete=!0;return}E.prototype._handleFragmentLoadComplete.call(this,a)},p.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},p.onBufferCreated=function(a,o){var c=o.tracks.audio;c&&(this.mediaBuffer=c.buffer),o.tracks.video&&(this.videoBuffer=o.tracks.video.buffer)},p.onFragBuffered=function(a,o){var c=o.frag,f=o.part;if(c.type!==w.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(c)){this.warn("Fragment "+c.sn+(f?" p: "+f.index:"")+" of level "+c.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}c.sn!=="initSegment"&&(this.fragPrevious=c,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(L.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(c,f)},p.onError=function(a,o){switch(o.details){case l.ErrorDetails.FRAG_LOAD_ERROR:case l.ErrorDetails.FRAG_LOAD_TIMEOUT:case l.ErrorDetails.KEY_LOAD_ERROR:case l.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(w.PlaylistLevelType.AUDIO,o);break;case l.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case l.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==x.State.ERROR&&this.state!==x.State.STOPPED&&(this.state=o.fatal?x.State.ERROR:x.State.IDLE,this.warn(o.details+" while loading frag, switching to "+this.state+" state"));break;case l.ErrorDetails.BUFFER_FULL_ERROR:if(o.parent==="audio"&&(this.state===x.State.PARSING||this.state===x.State.PARSED)){var c=!0,f=this.getFwdBufferInfo(this.mediaBuffer,w.PlaylistLevelType.AUDIO);f&&f.len>.5&&(c=!this.reduceMaxBufferLength(f.len)),c&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,E.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},p.onBufferFlushed=function(a,o){var c=o.type;c===y.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},p._handleTransmuxComplete=function(a){var o,c="audio",f=this.hls,S=a.remuxResult,A=a.chunkMeta,R=this.getCurrentContext(A);if(!R){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 B=R.frag,U=R.part,K=S.audio,D=S.text,H=S.id3,V=S.initSegment;if(this.fragContextChanged(B))return;if(this.state=x.State.PARSING,this.audioSwitch&&K&&this.completeAudioSwitch(),V!=null&&V.tracks&&(this._bufferInitSegment(V.tracks,B,A),f.trigger(L.Events.FRAG_PARSING_INIT_SEGMENT,{frag:B,id:c,tracks:V.tracks})),K){var ne=K.startPTS,ie=K.endPTS,_e=K.startDTS,ye=K.endDTS;U&&(U.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:ne,endPTS:ie,startDTS:_e,endDTS:ye}),B.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,ne,ie,_e,ye),this.bufferFragmentData(K,B,U,A)}if(H!=null&&(o=H.samples)!==null&&o!==void 0&&o.length){var be=t({frag:B,id:c},H);f.trigger(L.Events.FRAG_PARSING_METADATA,be)}if(D){var we=t({frag:B,id:c},D);f.trigger(L.Events.FRAG_PARSING_USERDATA,we)}},p._bufferInitSegment=function(a,o,c){if(this.state!==x.State.PARSING)return;a.video&&delete a.video;var f=a.audio;if(!f)return;f.levelCodec=f.codec,f.id="audio",this.log("Init audio buffer, container:"+f.container+", codecs[parsed]=["+f.codec+"]"),this.hls.trigger(L.Events.BUFFER_CODECS,a);var S=f.initSegment;if(S!=null&&S.byteLength){var A={type:"audio",frag:o,part:null,chunkMeta:c,parent:o.type,data:S};this.hls.trigger(L.Events.BUFFER_APPENDING,A)}this.tick()},p.loadFragment=function(a,o,c){var f=this.fragmentTracker.getState(a);this.fragCurrent=a,(this.audioSwitch||f===N.FragmentState.NOT_LOADED||f===N.FragmentState.PARTIAL)&&(a.sn==="initSegment"?this._loadInitSegment(a):o.live&&!Object(k.isFiniteNumber)(this.initPTS[a.cc])?(this.log("Waiting for video PTS in continuity counter "+a.cc+" of live stream before loading audio fragment "+a.sn+" of level "+this.trackId),this.state=x.State.WAITING_INIT_PTS):(this.startFragRequested=!0,E.prototype.loadFragment.call(this,a,o,c)))},p.completeAudioSwitch=function(){var a=this.hls,o=this.media,c=this.trackId;o&&(this.log("Switching audio track : flushing all audio"),E.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,a.trigger(L.Events.AUDIO_TRACK_SWITCHED,{id:c})},v}(x.default);j.default=g},"./src/controller/audio-track-controller.ts":function(pe,j,C){"use strict";C.r(j);var k=C("./src/events.ts"),x=C("./src/errors.ts"),L=C("./src/controller/base-playlist-controller.ts"),F=C("./src/types/loader.ts");function N(s,r){for(var i=0;i<r.length;i++){var u=r[i];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(s,u.key,u)}}function O(s,r,i){return r&&N(s.prototype,r),i&&N(s,i),s}function w(s,r){s.prototype=Object.create(r.prototype),s.prototype.constructor=s,y(s,r)}function y(s,r){return y=Object.setPrototypeOf||function(u,l){return u.__proto__=l,u},y(s,r)}var _=function(s){w(r,s);function r(u){var l;return l=s.call(this,u,"[audio-track-controller]")||this,l.tracks=[],l.groupId=null,l.tracksInGroup=[],l.trackId=-1,l.trackName="",l.selectDefaultTrack=!0,l.registerListeners(),l}var i=r.prototype;return i.registerListeners=function(){var l=this.hls;l.on(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(k.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.on(k.Events.LEVEL_LOADING,this.onLevelLoading,this),l.on(k.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.on(k.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.on(k.Events.ERROR,this.onError,this)},i.unregisterListeners=function(){var l=this.hls;l.off(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(k.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.off(k.Events.LEVEL_LOADING,this.onLevelLoading,this),l.off(k.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.off(k.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.off(k.Events.ERROR,this.onError,this)},i.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,s.prototype.destroy.call(this)},i.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},i.onManifestParsed=function(l,e){this.tracks=e.audioTracks||[]},i.onAudioTrackLoaded=function(l,e){var t=e.id,n=e.details,T=this.tracksInGroup[t];if(!T){this.warn("Invalid audio track id "+t);return}var b=T.details;T.details=e.details,this.log("audioTrack "+t+" loaded ["+n.startSN+"-"+n.endSN+"]"),t===this.trackId&&(this.retryCount=0,this.playlistLoaded(t,e,b))},i.onLevelLoading=function(l,e){this.switchLevel(e.level)},i.onLevelSwitching=function(l,e){this.switchLevel(e.level)},i.switchLevel=function(l){var e=this.hls.levels[l];if(!(e!=null&&e.audioGroupIds))return;var t=e.audioGroupIds[e.urlId];if(this.groupId!==t){this.groupId=t;var n=this.tracks.filter(function(b){return!t||b.groupId===t});this.selectDefaultTrack&&!n.some(function(b){return b.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=n;var T={audioTracks:n};this.log("Updating audio tracks, "+n.length+' track(s) found in "'+t+'" group-id'),this.hls.trigger(k.Events.AUDIO_TRACKS_UPDATED,T),this.selectInitialTrack()}},i.onError=function(l,e){if(s.prototype.onError.call(this,l,e),e.fatal||!e.context)return;e.context.type===F.PlaylistContextType.AUDIO_TRACK&&e.context.id===this.trackId&&e.context.groupId===this.groupId&&this.retryLoadingOrFail(e)},i.setAudioTrack=function(l){var e=this.tracksInGroup;if(l<0||l>=e.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var t=e[this.trackId];this.log("Now switching to audio-track index "+l);var n=e[l],T=n.id,b=n.groupId,g=b===void 0?"":b,E=n.name,v=n.type,p=n.url;if(this.trackId=l,this.trackName=E,this.selectDefaultTrack=!1,this.hls.trigger(k.Events.AUDIO_TRACK_SWITCHING,{id:T,groupId:g,name:E,type:v,url:p}),n.details&&!n.details.live)return;var d=this.switchParams(n.url,t==null?void 0:t.details);this.loadPlaylist(d)},i.selectInitialTrack=function(){var l=this.tracksInGroup;console.assert(l.length,"Initial audio track should be selected when tracks are known");var e=this.trackName,t=this.findTrackId(e)||this.findTrackId();t!==-1?this.setAudioTrack(t):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(k.Events.ERROR,{type:x.ErrorTypes.MEDIA_ERROR,details:x.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},i.findTrackId=function(l){for(var e=this.tracksInGroup,t=0;t<e.length;t++){var n=e[t];if((!this.selectDefaultTrack||n.default)&&(!l||l===n.name))return n.id}return-1},i.loadPlaylist=function(l){var e=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(e)){var t=e.id,n=e.groupId,T=e.url;if(l)try{T=l.addDirectives(T)}catch(b){this.warn("Could not construct new URL with HLS Delivery Directives: "+b)}this.log("loading audio-track playlist for id: "+t),this.clearTimer(),this.hls.trigger(k.Events.AUDIO_TRACK_LOADING,{url:T,id:t,groupId:n,deliveryDirectives:l||null})}},O(r,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(l){this.selectDefaultTrack=!1,this.setAudioTrack(l)}}]),r}(L.default);j.default=_},"./src/controller/base-playlist-controller.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"default",function(){return O});var k=C("./src/polyfills/number.ts"),x=C("./src/types/level.ts"),L=C("./src/controller/level-helper.ts"),F=C("./src/utils/logger.ts"),N=C("./src/errors.ts"),O=function(){function w(_,s){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=F.logger.log.bind(F.logger,s+":"),this.warn=F.logger.warn.bind(F.logger,s+":"),this.hls=_}var y=w.prototype;return y.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},y.onError=function(s,r){r.fatal&&r.type===N.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},y.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},y.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},y.stopLoad=function(){this.canLoad=!1,this.clearTimer()},y.switchParams=function(s,r){var i=r==null?void 0:r.renditionReports;if(i)for(var u=0;u<i.length;u++){var l=i[u],e=""+l.URI;if(e===s.substr(-e.length)){var t=parseInt(l["LAST-MSN"]),n=parseInt(l["LAST-PART"]);if(r&&this.hls.config.lowLatencyMode){var T=Math.min(r.age-r.partTarget,r.targetduration);n!==void 0&&T>r.partTarget&&(n+=1)}if(Object(k.isFiniteNumber)(t))return new x.HlsUrlParameters(t,Object(k.isFiniteNumber)(n)?n:void 0,x.HlsSkip.No)}}},y.loadPlaylist=function(s){},y.shouldLoadTrack=function(s){return this.canLoad&&s&&!!s.url&&(!s.details||s.details.live)},y.playlistLoaded=function(s,r,i){var u=this,l=r.details,e=r.stats,t=e.loading.end?Math.max(0,self.performance.now()-e.loading.end):0;if(l.advancedDateTime=Date.now()-t,l.live||i!=null&&i.live){if(l.reloaded(i),i&&this.log("live playlist "+s+" "+(l.advanced?"REFRESHED "+l.lastPartSn+"-"+l.lastPartIndex:"MISSED")),i&&l.fragments.length>0&&Object(L.mergeDetails)(i,l),!this.canLoad||!l.live)return;var n,T=void 0,b=void 0;if(l.canBlockReload&&l.endSN&&l.advanced){var g=this.hls.config.lowLatencyMode,E=l.lastPartSn,v=l.endSN,p=l.lastPartIndex,d=p!==-1,a=E===v,o=g?0:p;d?(T=a?v+1:E,b=a?o:p+1):T=v+1;var c=l.age,f=c+l.ageHeader,S=Math.min(f-l.partTarget,l.targetduration*1.5);if(S>0){if(i&&S>i.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+i.tuneInGoal+" to: "+S+" with playlist age: "+l.age),S=0;else{var A=Math.floor(S/l.targetduration);if(T+=A,b!==void 0){var R=Math.round(S%l.targetduration/l.partTarget);b+=R}this.log("CDN Tune-in age: "+l.ageHeader+"s last advanced "+c.toFixed(2)+"s goal: "+S+" skip sn "+A+" to part "+b)}l.tuneInGoal=S}if(n=this.getDeliveryDirectives(l,r.deliveryDirectives,T,b),g||!a){this.loadPlaylist(n);return}}else n=this.getDeliveryDirectives(l,r.deliveryDirectives,T,b);var B=Object(L.computeReloadInterval)(l,e);T!==void 0&&l.canBlockReload&&(B-=l.partTarget||1),this.log("reload live playlist "+s+" in "+Math.round(B)+" ms"),this.timer=self.setTimeout(function(){return u.loadPlaylist(n)},B)}else this.clearTimer()},y.getDeliveryDirectives=function(s,r,i,u){var l=Object(x.getSkipValue)(s,i);return r!=null&&r.skip&&s.deltaUpdateFailed&&(i=r.msn,u=r.part,l=x.HlsSkip.No),new x.HlsUrlParameters(i,u,l)},y.retryLoadingOrFail=function(s){var r=this,i=this.hls.config,u=this.retryCount<i.levelLoadingMaxRetry;if(u){var l;if(this.retryCount++,s.details.indexOf("LoadTimeOut")>-1&&(l=s.context)!==null&&l!==void 0&&l.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+s.details+'"'),this.loadPlaylist();else{var e=Math.min(Math.pow(2,this.retryCount)*i.levelLoadingRetryDelay,i.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return r.loadPlaylist()},e),this.warn("retry playlist loading #"+this.retryCount+" in "+e+' ms after "'+s.details+'"')}}else this.warn('cannot recover from error "'+s.details+'"'),this.clearTimer(),s.fatal=!0;return u},w}()},"./src/controller/base-stream-controller.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"State",function(){return v}),C.d(j,"default",function(){return p});var k=C("./src/polyfills/number.ts"),x=C("./src/task-loop.ts"),L=C("./src/controller/fragment-tracker.ts"),F=C("./src/utils/buffer-helper.ts"),N=C("./src/utils/logger.ts"),O=C("./src/events.ts"),w=C("./src/errors.ts"),y=C("./src/types/transmuxer.ts"),_=C("./src/utils/mp4-tools.ts"),s=C("./src/utils/discontinuities.ts"),r=C("./src/controller/fragment-finders.ts"),i=C("./src/controller/level-helper.ts"),u=C("./src/loader/fragment-loader.ts"),l=C("./src/crypt/decrypter.ts"),e=C("./src/utils/time-ranges.ts"),t=C("./src/types/loader.ts");function n(d,a){for(var o=0;o<a.length;o++){var c=a[o];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(d,c.key,c)}}function T(d,a,o){return a&&n(d.prototype,a),o&&n(d,o),d}function b(d){if(d===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d}function g(d,a){d.prototype=Object.create(a.prototype),d.prototype.constructor=d,E(d,a)}function E(d,a){return E=Object.setPrototypeOf||function(c,f){return c.__proto__=f,c},E(d,a)}var v={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"},p=function(d){g(a,d);function a(c,f,S){var A;return A=d.call(this)||this,A.hls=void 0,A.fragPrevious=null,A.fragCurrent=null,A.fragmentTracker=void 0,A.transmuxer=null,A._state=v.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=S,A.log=N.logger.log.bind(N.logger,S+":"),A.warn=N.logger.warn.bind(N.logger,S+":"),A.hls=c,A.fragmentLoader=new u.default(c.config),A.fragmentTracker=f,A.config=c.config,A.decrypter=new l.default(c,c.config),c.on(O.Events.KEY_LOADED,A.onKeyLoaded,b(A)),A}var o=a.prototype;return o.doTick=function(){this.onTickEnd()},o.onTickEnd=function(){},o.startLoad=function(f){},o.stopLoad=function(){this.fragmentLoader.abort();var f=this.fragCurrent;f&&this.fragmentTracker.removeFragment(f),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=v.STOPPED},o._streamEnded=function(f,S){var A=this.fragCurrent,R=this.fragmentTracker;if(!S.live&&A&&A.sn===S.endSN&&!f.nextStart){var B=R.getState(A);return B===L.FragmentState.PARTIAL||B===L.FragmentState.OK}return!1},o.onMediaAttached=function(f,S){var A=this.media=this.mediaBuffer=S.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),A.addEventListener("seeking",this.onvseeking),A.addEventListener("ended",this.onvended);var R=this.config;this.levels&&R.autoStartLoad&&this.state===v.STOPPED&&this.startLoad(R.startPosition)},o.onMediaDetaching=function(){var f=this.media;f!=null&&f.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),f&&(f.removeEventListener("seeking",this.onvseeking),f.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},o.onMediaSeeking=function(){var f=this.config,S=this.fragCurrent,A=this.media,R=this.mediaBuffer,B=this.state,U=A?A.currentTime:0,K=F.BufferHelper.bufferInfo(R||A,U,f.maxBufferHole);if(this.log("media seeking to "+(Object(k.isFiniteNumber)(U)?U.toFixed(3):U)+", state: "+B),B===v.ENDED)this.resetLoadingState();else if(S&&!K.len){var D=f.maxFragLookUpTolerance,H=S.start-D,V=S.start+S.duration+D,ne=U>V;(U<H||ne)&&(ne&&S.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),S.loader.abort()),this.resetLoadingState())}A&&(this.lastCurrentTime=U),!this.loadedmetadata&&!K.len&&(this.nextLoadPosition=this.startPosition=U),this.tickImmediate()},o.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},o.onKeyLoaded=function(f,S){if(this.state!==v.KEY_LOADING||S.frag!==this.fragCurrent||!this.levels)return;this.state=v.IDLE;var A=this.levels[S.frag.level].details;A&&this.loadFragment(S.frag,A,S.frag.start)},o.onHandlerDestroying=function(){this.stopLoad(),d.prototype.onHandlerDestroying.call(this)},o.onHandlerDestroyed=function(){this.state=v.STOPPED,this.hls.off(O.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,d.prototype.onHandlerDestroyed.call(this)},o.loadKey=function(f,S){this.log("Loading key for "+f.sn+" of ["+S.startSN+"-"+S.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+f.level),this.state=v.KEY_LOADING,this.fragCurrent=f,this.hls.trigger(O.Events.KEY_LOADING,{frag:f})},o.loadFragment=function(f,S,A){this._loadFragForPlayback(f,S,A)},o._loadFragForPlayback=function(f,S,A){var R=this,B=function(K){if(R.fragContextChanged(f)){R.warn("Fragment "+f.sn+(K.part?" p: "+K.part.index:"")+" of level "+f.level+" was dropped during download."),R.fragmentTracker.removeFragment(f);return}f.stats.chunkCount++,R._handleFragmentLoadProgress(K)};this._doFragLoad(f,S,A,B).then(function(U){if(!U)return;R.fragLoadError=0;var K=R.state;if(R.fragContextChanged(f)){(K===v.FRAG_LOADING||K===v.BACKTRACKING||!R.fragCurrent&&K===v.PARSING)&&(R.fragmentTracker.removeFragment(f),R.state=v.IDLE);return}if("payload"in U&&(R.log("Loaded fragment "+f.sn+" of level "+f.level),R.hls.trigger(O.Events.FRAG_LOADED,U),R.state===v.BACKTRACKING)){R.fragmentTracker.backtrack(f,U),R.resetFragmentLoading(f);return}R._handleFragmentLoadComplete(U)}).catch(function(U){R.warn(U),R.resetFragmentLoading(f)})},o.flushMainBuffer=function(f,S,A){if(A===void 0&&(A=null),!(f-S))return;var R={startOffset:f,endOffset:S,type:A};this.fragLoadError=0,this.hls.trigger(O.Events.BUFFER_FLUSHING,R)},o._loadInitSegment=function(f){var S=this;this._doFragLoad(f).then(function(A){if(!A||S.fragContextChanged(f)||!S.levels)throw new Error("init load aborted");return A}).then(function(A){var R=S.hls,B=A.payload,U=f.decryptdata;if(B&&B.byteLength>0&&U&&U.key&&U.iv&&U.method==="AES-128"){var K=self.performance.now();return S.decrypter.webCryptoDecrypt(new Uint8Array(B),U.key.buffer,U.iv.buffer).then(function(D){var H=self.performance.now();return R.trigger(O.Events.FRAG_DECRYPTED,{frag:f,payload:D,stats:{tstart:K,tdecrypt:H}}),A.payload=D,A})}return A}).then(function(A){var R=S.fragCurrent,B=S.hls,U=S.levels;if(!U)throw new Error("init load aborted, missing levels");var K=U[f.level].details;console.assert(K,"Level details are defined when init segment is loaded");var D=f.stats;S.state=v.IDLE,S.fragLoadError=0,f.data=new Uint8Array(A.payload),D.parsing.start=D.buffering.start=self.performance.now(),D.parsing.end=D.buffering.end=self.performance.now(),A.frag===R&&B.trigger(O.Events.FRAG_BUFFERED,{stats:D,frag:R,part:null,id:f.type}),S.tick()}).catch(function(A){S.warn(A),S.resetFragmentLoading(f)})},o.fragContextChanged=function(f){var S=this.fragCurrent;return!f||!S||f.level!==S.level||f.sn!==S.sn||f.urlId!==S.urlId},o.fragBufferedComplete=function(f,S){var A=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+f.type+" sn: "+f.sn+(S?" part: "+S.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+f.level+" "+e.default.toString(F.BufferHelper.getBuffered(A))),this.state=v.IDLE,this.tick()},o._handleFragmentLoadComplete=function(f){var S=this.transmuxer;if(!S)return;var A=f.frag,R=f.part,B=f.partsLoaded,U=!B||B.length===0||B.some(function(D){return!D}),K=new y.ChunkMetadata(A.level,A.sn,A.stats.chunkCount+1,0,R?R.index:-1,!U);S.flush(K)},o._handleFragmentLoadProgress=function(f){},o._doFragLoad=function(f,S,A,R){var B=this;if(A===void 0&&(A=null),!this.levels)throw new Error("frag load aborted, missing levels");if(A=Math.max(f.start,A||0),this.config.lowLatencyMode&&S){var U=S.partList;if(U&&R){A>f.end&&S.fragmentHint&&(f=S.fragmentHint);var K=this.getNextPart(U,f,A);if(K>-1){var D=U[K];return this.log("Loading part sn: "+f.sn+" p: "+D.index+" cc: "+f.cc+" of playlist ["+S.startSN+"-"+S.endSN+"] parts [0-"+K+"-"+(U.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+f.level+", target: "+parseFloat(A.toFixed(3))),this.nextLoadPosition=D.start+D.duration,this.state=v.FRAG_LOADING,this.hls.trigger(O.Events.FRAG_LOADING,{frag:f,part:U[K],targetBufferTime:A}),this.doFragPartsLoad(f,U,K,R).catch(function(H){return B.handleFragLoadError(H)})}else if(!f.url||this.loadedEndOfParts(U,A))return Promise.resolve(null)}}return this.log("Loading fragment "+f.sn+" cc: "+f.cc+" "+(S?"of ["+S.startSN+"-"+S.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+f.level+", target: "+parseFloat(A.toFixed(3))),Object(k.isFiniteNumber)(f.sn)&&!this.bitrateTest&&(this.nextLoadPosition=f.start+f.duration),this.state=v.FRAG_LOADING,this.hls.trigger(O.Events.FRAG_LOADING,{frag:f,targetBufferTime:A}),this.fragmentLoader.load(f,R).catch(function(H){return B.handleFragLoadError(H)})},o.doFragPartsLoad=function(f,S,A,R){var B=this;return new Promise(function(U,K){var D=[],H=function V(ne){var ie=S[ne];B.fragmentLoader.loadPart(f,ie,R).then(function(_e){D[ie.index]=_e;var ye=_e.part;B.hls.trigger(O.Events.FRAG_LOADED,_e);var be=S[ne+1];if(be&&be.fragment===f)V(ne+1);else return U({frag:f,part:ye,partsLoaded:D})}).catch(K)};H(A)})},o.handleFragLoadError=function(f){var S=f.data;return S&&S.details===w.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(S.frag,S.part):this.hls.trigger(O.Events.ERROR,S),null},o._handleTransmuxerFlush=function(f){var S=this.getCurrentContext(f);if(!S||this.state!==v.PARSING){this.fragCurrent||(this.state=v.IDLE);return}var A=S.frag,R=S.part,B=S.level,U=self.performance.now();A.stats.parsing.end=U,R&&(R.stats.parsing.end=U),this.updateLevelTiming(A,R,B,f.partial)},o.getCurrentContext=function(f){var S=this.levels,A=f.level,R=f.sn,B=f.part;if(!S||!S[A])return this.warn("Levels object was unset while buffering fragment "+R+" of level "+A+". The current chunk will not be buffered."),null;var U=S[A],K=B>-1?Object(i.getPartWith)(U,R,B):null,D=K?K.fragment:Object(i.getFragmentWithSN)(U,R,this.fragCurrent);return D?{frag:D,part:K,level:U}:null},o.bufferFragmentData=function(f,S,A,R){if(!f||this.state!==v.PARSING)return;var B=f.data1,U=f.data2,K=B;if(B&&U&&(K=Object(_.appendUint8Array)(B,U)),!K||!K.length)return;var D={type:f.type,frag:S,part:A,chunkMeta:R,parent:S.type,data:K};this.hls.trigger(O.Events.BUFFER_APPENDING,D),f.dropped&&f.independent&&!A&&this.flushBufferGap(S)},o.flushBufferGap=function(f){var S=this.media;if(!S)return;if(!F.BufferHelper.isBuffered(S,S.currentTime)){this.flushMainBuffer(0,f.start);return}var A=S.currentTime,R=F.BufferHelper.bufferInfo(S,A,0),B=f.duration,U=Math.min(this.config.maxFragLookUpTolerance*2,B*.25),K=Math.max(Math.min(f.start-U,R.end-U),A+U);f.start-K>U&&this.flushMainBuffer(K,f.start)},o.getFwdBufferInfo=function(f,S){var A=this.config,R=this.getLoadPosition();if(!Object(k.isFiniteNumber)(R))return null;var B=F.BufferHelper.bufferInfo(f,R,A.maxBufferHole);if(B.len===0&&B.nextStart!==void 0){var U=this.fragmentTracker.getBufferedFrag(R,S);if(U&&B.nextStart<U.end)return F.BufferHelper.bufferInfo(f,R,Math.max(B.nextStart,A.maxBufferHole))}return B},o.getMaxBufferLength=function(f){var S=this.config,A;return f?A=Math.max(8*S.maxBufferSize/f,S.maxBufferLength):A=S.maxBufferLength,Math.min(A,S.maxMaxBufferLength)},o.reduceMaxBufferLength=function(f){var S=this.config,A=f||S.maxBufferLength;return S.maxMaxBufferLength>=A?(S.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+S.maxMaxBufferLength+"s"),!0):!1},o.getNextFragment=function(f,S){var A,R,B=S.fragments,U=B.length;if(!U)return null;var K=this.config,D=B[0].start,H;if(S.live){var V=K.initialLiveManifestSize;if(U<V)return this.warn("Not enough fragments to start playback (have: "+U+", need: "+V+")"),null;!S.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(H=this.getInitialLiveFragment(S,B),this.startPosition=H?this.hls.liveSyncPosition||H.start:f)}else f<=D&&(H=B[0]);if(!H){var ne=K.lowLatencyMode?S.partEnd:S.fragmentEnd;H=this.getFragmentAtPosition(f,ne,S)}return(A=H)!==null&&A!==void 0&&A.initSegment&&!((R=H)!==null&&R!==void 0&&R.initSegment.data)&&!this.bitrateTest&&(H=H.initSegment),H},o.getNextPart=function(f,S,A){for(var R=-1,B=!1,U=!0,K=0,D=f.length;K<D;K++){var H=f[K];if(U=U&&!H.independent,R>-1&&A<H.start)break;var V=H.loaded;!V&&(B||H.independent||U)&&H.fragment===S&&(R=K),B=V}return R},o.loadedEndOfParts=function(f,S){var A=f[f.length-1];return A&&S>A.start&&A.loaded},o.getInitialLiveFragment=function(f,S){var A=this.fragPrevious,R=null;if(A){if(f.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+A.programDateTime),R=Object(r.findFragmentByPDT)(S,A.endProgramDateTime,this.config.maxFragLookUpTolerance)),!R){var B=A.sn+1;if(B>=f.startSN&&B<=f.endSN){var U=S[B-f.startSN];A.cc===U.cc&&(R=U,this.log("Live playlist, switching playlist, load frag with next SN: "+R.sn))}R||(R=Object(r.findFragWithCC)(S,A.cc),R&&this.log("Live playlist, switching playlist, load frag with same CC: "+R.sn))}}else{var K=this.hls.liveSyncPosition;K!==null&&(R=this.getFragmentAtPosition(K,this.bitrateTest?f.fragmentEnd:f.edge,f))}return R},o.getFragmentAtPosition=function(f,S,A){var R=this.config,B=this.fragPrevious,U=A.fragments,K=A.endSN,D=A.fragmentHint,H=R.maxFragLookUpTolerance,V=!!(R.lowLatencyMode&&A.partList&&D);V&&D&&!this.bitrateTest&&(U=U.concat(D),K=D.sn);var ne;if(f<S){var ie=f>S-H?0:H;ne=Object(r.findFragmentByPTS)(B,U,f,ie)}else ne=U[U.length-1];if(ne){var _e=ne.sn-A.startSN,ye=B&&ne.level===B.level,be=U[_e+1],we=this.fragmentTracker.getState(ne);if(we===L.FragmentState.BACKTRACKED){ne=null;for(var Re=_e;U[Re]&&this.fragmentTracker.getState(U[Re])===L.FragmentState.BACKTRACKED;)B?ne=U[Re--]:ne=U[--Re];ne||(ne=be)}else B&&ne.sn===B.sn&&!V&&(ye&&(ne.sn<K&&this.fragmentTracker.getState(be)!==L.FragmentState.OK?(this.log("SN "+ne.sn+" just loaded, load next one: "+be.sn),ne=be):ne=null))}return ne},o.synchronizeToLiveEdge=function(f){var S=this.config,A=this.media;if(!A)return;var R=this.hls.liveSyncPosition,B=A.currentTime,U=f.fragments[0].start,K=f.edge,D=B>=U-S.maxFragLookUpTolerance&&B<=K;if(R!==null&&A.duration>R&&(B<R||!D)){var H=S.liveMaxLatencyDuration!==void 0?S.liveMaxLatencyDuration:S.liveMaxLatencyDurationCount*f.targetduration;(!D&&A.readyState<4||B<K-H)&&(this.loadedmetadata||(this.nextLoadPosition=R),A.readyState&&(this.warn("Playback: "+B.toFixed(3)+" is located too far from the end of live sliding playlist: "+K+", reset currentTime to : "+R.toFixed(3)),A.currentTime=R))}},o.alignPlaylists=function(f,S){var A=this.levels,R=this.levelLastLoaded,B=this.fragPrevious,U=R!==null?A[R]:null,K=f.fragments.length;if(!K)return this.warn("No fragments in live playlist"),0;var D=f.fragments[0].start,H=!S,V=f.alignedSliding&&Object(k.isFiniteNumber)(D);if(H||!V&&!D){Object(s.alignStream)(B,U,f);var ne=f.fragments[0].start;return this.log("Live playlist sliding: "+ne.toFixed(2)+" start-sn: "+(S?S.startSN:"na")+"->"+f.startSN+" prev-sn: "+(B?B.sn:"na")+" fragments: "+K),ne}return D},o.waitForCdnTuneIn=function(f){var S=3;return f.live&&f.canBlockReload&&f.tuneInGoal>Math.max(f.partHoldBack,f.partTarget*S)},o.setStartPosition=function(f,S){var A=this.startPosition;if(A<S&&(A=-1),A===-1||this.lastCurrentTime===-1){var R=f.startTimeOffset;Object(k.isFiniteNumber)(R)?(A=S+R,R<0&&(A+=f.totalduration),A=Math.min(Math.max(S,A),S+f.totalduration),this.log("Start time offset "+R+" found in playlist, adjust startPosition to "+A),this.startPosition=A):f.live?A=this.hls.liveSyncPosition||S:this.startPosition=A=0,this.lastCurrentTime=A}this.nextLoadPosition=A},o.getLoadPosition=function(){var f=this.media,S=0;return this.loadedmetadata&&f?S=f.currentTime:this.nextLoadPosition&&(S=this.nextLoadPosition),S},o.handleFragLoadAborted=function(f,S){this.transmuxer&&f.sn!=="initSegment"&&f.stats.aborted&&(this.warn("Fragment "+f.sn+(S?" part"+S.index:"")+" of level "+f.level+" was aborted"),this.resetFragmentLoading(f))},o.resetFragmentLoading=function(f){(!this.fragCurrent||!this.fragContextChanged(f))&&(this.state=v.IDLE)},o.onFragmentOrKeyLoadError=function(f,S){if(S.fatal)return;var A=S.frag;if(!A||A.type!==f)return;var R=this.fragCurrent;console.assert(R&&A.sn===R.sn&&A.level===R.level&&A.urlId===R.urlId,"Frag load error must match current frag to retry");var B=this.config;if(this.fragLoadError+1<=B.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(A.level))return;var U=Math.min(Math.pow(2,this.fragLoadError)*B.fragLoadingRetryDelay,B.fragLoadingMaxRetryTimeout);this.warn("Fragment "+A.sn+" of "+f+" "+A.level+" failed to load, retrying in "+U+"ms"),this.retryDate=self.performance.now()+U,this.fragLoadError++,this.state=v.FRAG_LOADING_WAITING_RETRY}else S.levelRetry?(f===t.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=v.IDLE):(N.logger.error(S.details+" reaches max retry, redispatch as fatal ..."),S.fatal=!0,this.hls.stopLoad(),this.state=v.ERROR)},o.afterBufferFlushed=function(f,S,A){if(!f)return;var R=F.BufferHelper.getBuffered(f);this.fragmentTracker.detectEvictedFragments(S,R,A),this.state===v.ENDED&&this.resetLoadingState()},o.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=v.IDLE},o.resetLiveStartWhenNotLoaded=function(f){if(!this.loadedmetadata){this.startFragRequested=!1;var S=this.levels?this.levels[f].details:null;if(S!=null&&S.live)return this.startPosition=-1,this.setStartPosition(S,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},o.updateLevelTiming=function(f,S,A,R){var B=this,U=A.details;console.assert(!!U,"level.details must be defined");var K=Object.keys(f.elementaryStreams).reduce(function(D,H){var V=f.elementaryStreams[H];if(V){var ne=V.endPTS-V.startPTS;if(ne<=0)return B.warn("Could not parse fragment "+f.sn+" "+H+" duration reliably ("+ne+") resetting transmuxer to fallback to playlist timing"),B.resetTransmuxer(),D||!1;var ie=R?0:Object(i.updateFragPTSDTS)(U,f,V.startPTS,V.endPTS,V.startDTS,V.endDTS);return B.hls.trigger(O.Events.LEVEL_PTS_UPDATED,{details:U,level:A,drift:ie,type:H,frag:f,start:V.startPTS,end:V.endPTS}),!0}return D},!1);K?(this.state=v.PARSED,this.hls.trigger(O.Events.FRAG_PARSED,{frag:f,part:S})):this.resetLoadingState()},o.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},T(a,[{key:"state",get:function(){return this._state},set:function(f){var S=this._state;S!==f&&(this._state=f,this.log(S+"->"+f))}}]),a}(x.default)},"./src/controller/buffer-controller.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"default",function(){return r});var k=C("./src/polyfills/number.ts"),x=C("./src/events.ts"),L=C("./src/utils/logger.ts"),F=C("./src/errors.ts"),N=C("./src/utils/buffer-helper.ts"),O=C("./src/utils/mediasource-helper.ts"),w=C("./src/loader/fragment.ts"),y=C("./src/controller/buffer-operation-queue.ts"),_=Object(O.getMediaSource)(),s=/([ha]vc.)(?:\.[^.,]+)+/,r=function(){function i(l){var e=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var t=e.hls,n=e.media,T=e.mediaSource;L.logger.log("[buffer-controller]: Media source opened"),n&&(e.updateMediaElementDuration(),t.trigger(x.Events.MEDIA_ATTACHED,{media:n})),T&&T.removeEventListener("sourceopen",e._onMediaSourceOpen),e.checkPendingTracks()},this._onMediaSourceClose=function(){L.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){L.logger.log("[buffer-controller]: Media source ended")},this.hls=l,this._initSourceBuffer(),this.registerListeners()}var u=i.prototype;return u.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},u.destroy=function(){this.unregisterListeners(),this.details=null},u.registerListeners=function(){var e=this.hls;e.on(x.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(x.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(x.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(x.Events.BUFFER_RESET,this.onBufferReset,this),e.on(x.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.on(x.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.on(x.Events.BUFFER_EOS,this.onBufferEos,this),e.on(x.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(x.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(x.Events.FRAG_PARSED,this.onFragParsed,this),e.on(x.Events.FRAG_CHANGED,this.onFragChanged,this)},u.unregisterListeners=function(){var e=this.hls;e.off(x.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(x.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(x.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(x.Events.BUFFER_RESET,this.onBufferReset,this),e.off(x.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.off(x.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.off(x.Events.BUFFER_EOS,this.onBufferEos,this),e.off(x.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(x.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(x.Events.FRAG_PARSED,this.onFragParsed,this),e.off(x.Events.FRAG_CHANGED,this.onFragChanged,this)},u._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new y.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},u.onManifestParsed=function(e,t){var n=2;(t.audio&&!t.video||!t.altAudio)&&(n=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=n,this.details=null,L.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},u.onMediaAttaching=function(e,t){var n=this.media=t.media;if(n&&_){var T=this.mediaSource=new _;T.addEventListener("sourceopen",this._onMediaSourceOpen),T.addEventListener("sourceended",this._onMediaSourceEnded),T.addEventListener("sourceclose",this._onMediaSourceClose),n.src=self.URL.createObjectURL(T),this._objectUrl=n.src}},u.onMediaDetaching=function(){var e=this.media,t=this.mediaSource,n=this._objectUrl;if(t){if(L.logger.log("[buffer-controller]: media source detaching"),t.readyState==="open")try{t.endOfStream()}catch(T){L.logger.warn("[buffer-controller]: onMediaDetaching: "+T.message+" while calling endOfStream")}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),e&&(n&&self.URL.revokeObjectURL(n),e.src===n?(e.removeAttribute("src"),e.load()):L.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(x.Events.MEDIA_DETACHED,void 0)},u.onBufferReset=function(){var e=this;this.getSourceBufferTypes().forEach(function(t){var n=e.sourceBuffer[t];try{n&&(e.removeBufferListeners(t),e.mediaSource&&e.mediaSource.removeSourceBuffer(n),e.sourceBuffer[t]=void 0)}catch(T){L.logger.warn("[buffer-controller]: Failed to reset the "+t+" buffer",T)}}),this._initSourceBuffer()},u.onBufferCodecs=function(e,t){var n=this,T=this.getSourceBufferTypes().length;if(Object.keys(t).forEach(function(b){if(T){var g=n.tracks[b];if(g&&typeof g.buffer.changeType=="function"){var E=t[b],v=E.codec,p=E.levelCodec,d=E.container,a=(g.levelCodec||g.codec).replace(s,"$1"),o=(p||v).replace(s,"$1");if(a!==o){var c=d+";codecs="+(p||v);n.appendChangeType(b,c)}}}else n.pendingTracks[b]=t[b]}),T)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},u.appendChangeType=function(e,t){var n=this,T=this.operationQueue,b={execute:function(){var E=n.sourceBuffer[e];E&&(L.logger.log("[buffer-controller]: changing "+e+" sourceBuffer type to "+t),E.changeType(t)),T.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(E){L.logger.warn("[buffer-controller]: Failed to change "+e+" SourceBuffer type",E)}};T.append(b,e)},u.onBufferAppending=function(e,t){var n=this,T=this.hls,b=this.operationQueue,g=this.tracks,E=t.data,v=t.type,p=t.frag,d=t.part,a=t.chunkMeta,o=a.buffering[v],c=self.performance.now();o.start=c;var f=p.stats.buffering,S=d?d.stats.buffering:null;f.start===0&&(f.start=c),S&&S.start===0&&(S.start=c);var A=g.audio,R=v==="audio"&&a.id===1&&(A==null?void 0:A.container)==="audio/mpeg",B={execute:function(){if(o.executeStart=self.performance.now(),R){var K=n.sourceBuffer[v];if(K){var D=p.start-K.timestampOffset;Math.abs(D)>=.1&&(L.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+p.start+" (delta: "+D+") sn: "+p.sn+")"),K.timestampOffset=p.start)}}n.appendExecutor(E,v)},onStart:function(){},onComplete:function(){var K=self.performance.now();o.executeEnd=o.end=K,f.first===0&&(f.first=K),S&&S.first===0&&(S.first=K);var D=n.sourceBuffer,H={};for(var V in D)H[V]=N.BufferHelper.getBuffered(D[V]);n.appendError=0,n.hls.trigger(x.Events.BUFFER_APPENDED,{type:v,frag:p,part:d,chunkMeta:a,parent:p.type,timeRanges:H})},onError:function(K){L.logger.error("[buffer-controller]: Error encountered while trying to append to the "+v+" SourceBuffer",K);var D={type:F.ErrorTypes.MEDIA_ERROR,parent:p.type,details:F.ErrorDetails.BUFFER_APPEND_ERROR,err:K,fatal:!1};K.code===DOMException.QUOTA_EXCEEDED_ERR?D.details=F.ErrorDetails.BUFFER_FULL_ERROR:(n.appendError++,D.details=F.ErrorDetails.BUFFER_APPEND_ERROR,n.appendError>T.config.appendErrorMaxRetry&&(L.logger.error("[buffer-controller]: Failed "+T.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),D.fatal=!0)),T.trigger(x.Events.ERROR,D)}};b.append(B,v)},u.onBufferFlushing=function(e,t){var n=this,T=this.operationQueue,b=function(E){return{execute:n.removeExecutor.bind(n,E,t.startOffset,t.endOffset),onStart:function(){},onComplete:function(){n.hls.trigger(x.Events.BUFFER_FLUSHED,{type:E})},onError:function(p){L.logger.warn("[buffer-controller]: Failed to remove from "+E+" SourceBuffer",p)}}};t.type?T.append(b(t.type),t.type):this.getSourceBufferTypes().forEach(function(g){T.append(b(g),g)})},u.onFragParsed=function(e,t){var n=this,T=t.frag,b=t.part,g=[],E=b?b.elementaryStreams:T.elementaryStreams;E[w.ElementaryStreamTypes.AUDIOVIDEO]?g.push("audiovideo"):(E[w.ElementaryStreamTypes.AUDIO]&&g.push("audio"),E[w.ElementaryStreamTypes.VIDEO]&&g.push("video"));var v=function(){var d=self.performance.now();T.stats.buffering.end=d,b&&(b.stats.buffering.end=d);var a=b?b.stats:T.stats;n.hls.trigger(x.Events.FRAG_BUFFERED,{frag:T,part:b,stats:a,id:T.type})};g.length===0&&L.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+T.type+" level: "+T.level+" sn: "+T.sn),this.blockBuffers(v,g)},u.onFragChanged=function(e,t){this.flushBackBuffer()},u.onBufferEos=function(e,t){var n=this,T=this.getSourceBufferTypes().reduce(function(b,g){var E=n.sourceBuffer[g];return(!t.type||t.type===g)&&(E&&!E.ended&&(E.ended=!0,L.logger.log("[buffer-controller]: "+g+" sourceBuffer now EOS"))),b&&!!(!E||E.ended)},!0);T&&this.blockBuffers(function(){var b=n.mediaSource;if(!b||b.readyState!=="open")return;b.endOfStream()})},u.onLevelUpdated=function(e,t){var n=t.details;if(!n.fragments.length)return;this.details=n,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},u.flushBackBuffer=function(){var e=this.hls,t=this.details,n=this.media,T=this.sourceBuffer;if(!n||t===null)return;var b=this.getSourceBufferTypes();if(!b.length)return;var g=t.live&&e.config.liveBackBufferLength!==null?e.config.liveBackBufferLength:e.config.backBufferLength;if(!Object(k.isFiniteNumber)(g)||g<0)return;var E=n.currentTime,v=t.levelTargetDuration,p=Math.max(g,v),d=Math.floor(E/v)*v-p;b.forEach(function(a){var o=T[a];if(o){var c=N.BufferHelper.getBuffered(o);c.length>0&&d>c.start(0)&&(e.trigger(x.Events.BACK_BUFFER_REACHED,{bufferEnd:d}),t.live&&e.trigger(x.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:d}),e.trigger(x.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:d,type:a}))}})},u.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var e=this.details,t=this.hls,n=this.media,T=this.mediaSource,b=e.fragments[0].start+e.totalduration,g=n.duration,E=Object(k.isFiniteNumber)(T.duration)?T.duration:0;e.live&&t.config.liveDurationInfinity?(L.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),T.duration=Infinity,this.updateSeekableRange(e)):(b>E&&b>g||!Object(k.isFiniteNumber)(g))&&(L.logger.log("[buffer-controller]: Updating Media Source duration to "+b.toFixed(3)),T.duration=b)},u.updateSeekableRange=function(e){var t=this.mediaSource,n=e.fragments,T=n.length;if(T&&e.live&&t!==null&&t!==void 0&&t.setLiveSeekableRange){var b=Math.max(0,n[0].start),g=Math.max(b,b+e.totalduration);t.setLiveSeekableRange(b,g)}},u.checkPendingTracks=function(){var e=this.bufferCodecEventsExpected,t=this.operationQueue,n=this.pendingTracks,T=Object.keys(n).length;if(T&&!e||T===2){this.createSourceBuffers(n),this.pendingTracks={};var b=this.getSourceBufferTypes();if(b.length===0){this.hls.trigger(x.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}b.forEach(function(g){t.executeNext(g)})}},u.createSourceBuffers=function(e){var t=this.sourceBuffer,n=this.mediaSource;if(!n)throw Error("createSourceBuffers called when mediaSource was null");var T=0;for(var b in e)if(!t[b]){var g=e[b];if(!g)throw Error("source buffer exists for track "+b+", however track does not");var E=g.levelCodec||g.codec,v=g.container+";codecs="+E;L.logger.log("[buffer-controller]: creating sourceBuffer("+v+")");try{var p=t[b]=n.addSourceBuffer(v),d=b;this.addBufferListener(d,"updatestart",this._onSBUpdateStart),this.addBufferListener(d,"updateend",this._onSBUpdateEnd),this.addBufferListener(d,"error",this._onSBUpdateError),this.tracks[b]={buffer:p,codec:E,container:g.container,levelCodec:g.levelCodec,id:g.id},T++}catch(a){L.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+a.message),this.hls.trigger(x.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:a,mimeType:v})}}T&&this.hls.trigger(x.Events.BUFFER_CREATED,{tracks:this.tracks})},u._onSBUpdateStart=function(e){var t=this.operationQueue,n=t.current(e);n.onStart()},u._onSBUpdateEnd=function(e){var t=this.operationQueue,n=t.current(e);n.onComplete(),t.shiftAndExecuteNext(e)},u._onSBUpdateError=function(e,t){L.logger.error("[buffer-controller]: "+e+" SourceBuffer error",t),this.hls.trigger(x.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var n=this.operationQueue.current(e);n&&n.onError(t)},u.removeExecutor=function(e,t,n){var T=this.media,b=this.mediaSource,g=this.operationQueue,E=this.sourceBuffer,v=E[e];if(!T||!b||!v){L.logger.warn("[buffer-controller]: Attempting to remove from the "+e+" SourceBuffer, but it does not exist"),g.shiftAndExecuteNext(e);return}var p=Object(k.isFiniteNumber)(T.duration)?T.duration:Infinity,d=Object(k.isFiniteNumber)(b.duration)?b.duration:Infinity,a=Math.max(0,t),o=Math.min(n,p,d);o>a?(L.logger.log("[buffer-controller]: Removing ["+a+","+o+"] from the "+e+" SourceBuffer"),console.assert(!v.updating,e+" sourceBuffer must not be updating"),v.remove(a,o)):g.shiftAndExecuteNext(e)},u.appendExecutor=function(e,t){var n=this.operationQueue,T=this.sourceBuffer,b=T[t];if(!b){L.logger.warn("[buffer-controller]: Attempting to append to the "+t+" SourceBuffer, but it does not exist"),n.shiftAndExecuteNext(t);return}b.ended=!1,console.assert(!b.updating,t+" sourceBuffer must not be updating"),b.appendBuffer(e)},u.blockBuffers=function(e,t){var n=this;if(t===void 0&&(t=this.getSourceBufferTypes()),!t.length){L.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(e);return}var T=this.operationQueue,b=t.map(function(g){return T.appendBlocker(g)});Promise.all(b).then(function(){e(),t.forEach(function(g){var E=n.sourceBuffer[g];(!E||!E.updating)&&T.shiftAndExecuteNext(g)})})},u.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},u.addBufferListener=function(e,t,n){var T=this.sourceBuffer[e];if(!T)return;var b=n.bind(this,e);this.listeners[e].push({event:t,listener:b}),T.addEventListener(t,b)},u.removeBufferListeners=function(e){var t=this.sourceBuffer[e];if(!t)return;this.listeners[e].forEach(function(n){t.removeEventListener(n.event,n.listener)})},i}()},"./src/controller/buffer-operation-queue.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"default",function(){return x});var k=C("./src/utils/logger.ts"),x=function(){function L(N){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=N}var F=L.prototype;return F.append=function(O,w){var y=this.queues[w];y.push(O),y.length===1&&this.buffers[w]&&this.executeNext(w)},F.insertAbort=function(O,w){var y=this.queues[w];y.unshift(O),this.executeNext(w)},F.appendBlocker=function(O){var w,y=new Promise(function(s){w=s}),_={execute:w,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(_,O),y},F.executeNext=function(O){var w=this.buffers,y=this.queues,_=w[O],s=y[O];if(s.length){var r=s[0];try{r.execute()}catch(i){k.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),r.onError(i),(!_||!_.updating)&&(s.shift(),this.executeNext(O))}}},F.shiftAndExecuteNext=function(O){this.queues[O].shift(),this.executeNext(O)},F.current=function(O){return this.queues[O][0]},L}()},"./src/controller/cap-level-controller.ts":function(pe,j,C){"use strict";C.r(j);var k=C("./src/events.ts");function x(N,O){for(var w=0;w<O.length;w++){var y=O[w];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(N,y.key,y)}}function L(N,O,w){return O&&x(N.prototype,O),w&&x(N,w),N}var F=function(){function N(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 O=N.prototype;return O.setStreamController=function(y){this.streamController=y},O.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},O.registerListeners=function(){var y=this.hls;y.on(k.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.on(k.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.on(k.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.on(k.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.on(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},O.unregisterListener=function(){var y=this.hls;y.off(k.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.off(k.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.off(k.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.off(k.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.off(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},O.onFpsDropLevelCapping=function(y,_){N.isLevelAllowed(_.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(_.droppedLevel)},O.onMediaAttaching=function(y,_){this.media=_.media instanceof HTMLVideoElement?_.media:null},O.onManifestParsed=function(y,_){var s=this.hls;this.restrictedLevels=[],this.firstLevel=_.firstLevel,s.config.capLevelToPlayerSize&&_.video&&this.startCapping()},O.onBufferCodecs=function(y,_){var s=this.hls;s.config.capLevelToPlayerSize&&_.video&&this.startCapping()},O.onMediaDetaching=function(){this.stopCapping()},O.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var y=this.hls.levels;if(y.length){var _=this.hls;_.autoLevelCapping=this.getMaxLevel(y.length-1),_.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=_.autoLevelCapping}}},O.getMaxLevel=function(y){var _=this,s=this.hls.levels;if(!s.length)return-1;var r=s.filter(function(i,u){return N.isLevelAllowed(u,_.restrictedLevels)&&u<=y});return this.clientRect=null,N.getMaxLevelByMediaSize(r,this.mediaWidth,this.mediaHeight)},O.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()},O.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},O.getDimensions=function(){if(this.clientRect)return this.clientRect;var y=this.media,_={width:0,height:0};if(y){var s=y.getBoundingClientRect();_.width=s.width,_.height=s.height,!_.width&&!_.height&&(_.width=s.right-s.left||y.width||0,_.height=s.bottom-s.top||y.height||0)}return this.clientRect=_,_},N.isLevelAllowed=function(y,_){return _===void 0&&(_=[]),_.indexOf(y)===-1},N.getMaxLevelByMediaSize=function(y,_,s){if(!y||!y.length)return-1;for(var r=function(t,n){return n?t.width!==n.width||t.height!==n.height:!0},i=y.length-1,u=0;u<y.length;u+=1){var l=y[u];if((l.width>=_||l.height>=s)&&r(l,y[u+1])){i=u;break}}return i},L(N,[{key:"mediaWidth",get:function(){return this.getDimensions().width*N.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*N.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var y=1;try{y=self.devicePixelRatio}catch(_){}return y}}]),N}();j.default=F},"./src/controller/cmcd-controller.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"default",function(){return r});var k=C("./src/events.ts"),x=C("./src/types/cmcd.ts"),L=C("./src/utils/buffer-helper.ts"),F=C("./src/utils/logger.ts");function N(i,u){for(var l=0;l<u.length;l++){var e=u[l];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(i,e.key,e)}}function O(i,u,l){return u&&N(i.prototype,u),l&&N(i,l),i}function w(i,u){var l=typeof Symbol!="undefined"&&i[Symbol.iterator]||i["@@iterator"];if(l)return(l=l.call(i)).next.bind(l);if(Array.isArray(i)||(l=y(i))||u&&i&&typeof i.length=="number"){l&&(i=l);var e=0;return function(){return e>=i.length?{done:!0}:{done:!1,value:i[e++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function y(i,u){if(!i)return;if(typeof i=="string")return _(i,u);var l=Object.prototype.toString.call(i).slice(8,-1);if(l==="Object"&&i.constructor&&(l=i.constructor.name),l==="Map"||l==="Set")return Array.from(i);if(l==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l))return _(i,u)}function _(i,u){(u==null||u>i.length)&&(u=i.length);for(var l=0,e=new Array(u);l<u;l++)e[l]=i[l];return e}function s(){return s=Object.assign||function(i){for(var u=1;u<arguments.length;u++){var l=arguments[u];for(var e in l)Object.prototype.hasOwnProperty.call(l,e)&&(i[e]=l[e])}return i},s.apply(this,arguments)}var r=function(){function i(l){var e=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){e.initialized&&(e.starved=!0),e.buffering=!0},this.onPlaying=function(){e.initialized||(e.initialized=!0),e.buffering=!1},this.applyPlaylistData=function(T){try{e.apply(T,{ot:x.CMCDObjectType.MANIFEST,su:!e.initialized})}catch(b){F.logger.warn("Could not generate manifest CMCD data.",b)}},this.applyFragmentData=function(T){try{var b=T.frag,g=e.hls.levels[b.level],E=e.getObjectType(b),v={d:b.duration*1e3,ot:E};(E===x.CMCDObjectType.VIDEO||E===x.CMCDObjectType.AUDIO||E==x.CMCDObjectType.MUXED)&&(v.br=g.bitrate/1e3,v.tb=e.getTopBandwidth(E),v.bl=e.getBufferLength(E)),e.apply(T,v)}catch(p){F.logger.warn("Could not generate segment CMCD data.",p)}},this.hls=l;var t=this.config=l.config,n=t.cmcd;n!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=n.sessionId||i.uuid(),this.cid=n.contentId,this.useHeaders=n.useHeaders===!0,this.registerListeners())}var u=i.prototype;return u.registerListeners=function(){var e=this.hls;e.on(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(k.Events.MEDIA_DETACHED,this.onMediaDetached,this),e.on(k.Events.BUFFER_CREATED,this.onBufferCreated,this)},u.unregisterListeners=function(){var e=this.hls;e.off(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(k.Events.MEDIA_DETACHED,this.onMediaDetached,this),e.off(k.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},u.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},u.onMediaAttached=function(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},u.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},u.onBufferCreated=function(e,t){var n,T;this.audioBuffer=(n=t.tracks.audio)===null||n===void 0?void 0:n.buffer,this.videoBuffer=(T=t.tracks.video)===null||T===void 0?void 0:T.buffer},u.createData=function(){var e;return{v:x.CMCDVersion,sf:x.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)===null||e===void 0?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},u.apply=function(e,t){t===void 0&&(t={}),s(t,this.createData());var n=t.ot===x.CMCDObjectType.INIT||t.ot===x.CMCDObjectType.VIDEO||t.ot===x.CMCDObjectType.MUXED;if(this.starved&&n&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering),this.useHeaders){var T=i.toHeaders(t);if(!Object.keys(T).length)return;e.headers||(e.headers={}),s(e.headers,T)}else{var b=i.toQuery(t);if(!b)return;e.url=i.appendQueryToUri(e.url,b)}},u.getObjectType=function(e){var t=e.type;return t==="subtitle"?x.CMCDObjectType.TIMED_TEXT:e.sn==="initSegment"?x.CMCDObjectType.INIT:t==="audio"?x.CMCDObjectType.AUDIO:t==="main"?this.hls.audioTracks.length?x.CMCDObjectType.VIDEO:x.CMCDObjectType.MUXED:void 0},u.getTopBandwidth=function(e){for(var t=0,n=e===x.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,T=w(n),b;!(b=T()).done;){var g=b.value;g.bitrate>t&&(t=g.bitrate)}return t>0?t:NaN},u.getBufferLength=function(e){var t=this.hls.media,n=e===x.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!n||!t)return NaN;var T=L.BufferHelper.bufferInfo(n,t.currentTime,this.config.maxBufferHole);return T.len*1e3},u.createPlaylistLoader=function(){var e=this.config.pLoader,t=this.applyPlaylistData,n=e||this.config.loader;return function(){function T(g){this.loader=void 0,this.loader=new n(g)}var b=T.prototype;return b.destroy=function(){this.loader.destroy()},b.abort=function(){this.loader.abort()},b.load=function(E,v,p){t(E),this.loader.load(E,v,p)},O(T,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),T}()},u.createFragmentLoader=function(){var e=this.config.fLoader,t=this.applyFragmentData,n=e||this.config.loader;return function(){function T(g){this.loader=void 0,this.loader=new n(g)}var b=T.prototype;return b.destroy=function(){this.loader.destroy()},b.abort=function(){this.loader.abort()},b.load=function(E,v,p){t(E),this.loader.load(E,v,p)},O(T,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),T}()},i.uuid=function(){var e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.substr(t.lastIndexOf("/")+1)},i.serialize=function(e){for(var t=[],n=function(R){return!Number.isNaN(R)&&R!=null&&R!==""&&R!==!1},T=function(R){return Math.round(R)},b=function(R){return T(R/100)*100},g=function(R){return encodeURIComponent(R)},E={br:T,d:T,bl:b,dl:b,mtp:b,nor:g,rtp:b,tb:T},v=Object.keys(e||{}).sort(),p=w(v),d;!(d=p()).done;){var a=d.value,o=e[a];if(!n(o))continue;if(a==="v"&&o===1)continue;if(a=="pr"&&o===1)continue;var c=E[a];c&&(o=c(o));var f=typeof o,S=void 0;a==="ot"||a==="sf"||a==="st"?S=a+"="+o:f==="boolean"?S=a:f==="number"?S=a+"="+o:S=a+"="+JSON.stringify(o),t.push(S)}return t.join(",")},i.toHeaders=function(e){for(var t=Object.keys(e),n={},T=["Object","Request","Session","Status"],b=[{},{},{},{}],g={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},E=0,v=t;E<v.length;E++){var p=v[E],d=g[p]!=null?g[p]:1;b[d][p]=e[p]}for(var a=0;a<b.length;a++){var o=i.serialize(b[a]);o&&(n["CMCD-"+T[a]]=o)}return n},i.toQuery=function(e){return"CMCD="+encodeURIComponent(i.serialize(e))},i.appendQueryToUri=function(e,t){if(!t)return e;var n=e.includes("?")?"&":"?";return""+e+n+t},i}()},"./src/controller/eme-controller.ts":function(pe,j,C){"use strict";C.r(j);var k=C("./src/events.ts"),x=C("./src/errors.ts"),L=C("./src/utils/logger.ts"),F=C("./src/utils/mediakeys-helper.ts");function N(r,i){for(var u=0;u<i.length;u++){var l=i[u];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(r,l.key,l)}}function O(r,i,u){return i&&N(r.prototype,i),u&&N(r,u),r}var w=3,y=function(i,u,l){var e={audioCapabilities:[],videoCapabilities:[]};return i.forEach(function(t){e.audioCapabilities.push({contentType:'audio/mp4; codecs="'+t+'"',robustness:l.audioRobustness||""})}),u.forEach(function(t){e.videoCapabilities.push({contentType:'video/mp4; codecs="'+t+'"',robustness:l.videoRobustness||""})}),[e]},_=function(i,u,l,e){switch(i){case F.KeySystems.WIDEVINE:return y(u,l,e);default:throw new Error("Unknown key-system: "+i)}},s=function(){function r(u){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=u,this._config=u.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 i=r.prototype;return i.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},i._registerListeners=function(){this.hls.on(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(k.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(k.Events.MANIFEST_PARSED,this.onManifestParsed,this)},i._unregisterListeners=function(){this.hls.off(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(k.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(k.Events.MANIFEST_PARSED,this.onManifestParsed,this)},i.getLicenseServerUrl=function(l){switch(l){case F.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+l+'"')},i._attemptKeySystemAccess=function(l,e,t){var n=this,T=_(l,e,t,this._drmSystemOptions);L.logger.log("Requesting encrypted media key-system access");var b=this.requestMediaKeySystemAccess(l,T);this.mediaKeysPromise=b.then(function(g){return n._onMediaKeySystemAccessObtained(l,g)}),b.catch(function(g){L.logger.error('Failed to obtain key-system "'+l+'" access:',g)})},i._onMediaKeySystemAccessObtained=function(l,e){var t=this;L.logger.log('Access for key-system "'+l+'" obtained');var n={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:e,mediaKeySystemDomain:l};this._mediaKeysList.push(n);var T=Promise.resolve().then(function(){return e.createMediaKeys()}).then(function(b){return n.mediaKeys=b,L.logger.log('Media-keys created for key-system "'+l+'"'),t._onMediaKeysCreated(),b});return T.catch(function(b){L.logger.error("Failed to create media-keys:",b)}),T},i._onMediaKeysCreated=function(){var l=this;this._mediaKeysList.forEach(function(e){e.mediaKeysSession||(e.mediaKeysSession=e.mediaKeys.createSession(),l._onNewMediaKeySession(e.mediaKeysSession))})},i._onNewMediaKeySession=function(l){var e=this;L.logger.log("New key-system session "+l.sessionId),l.addEventListener("message",function(t){e._onKeySessionMessage(l,t.message)},!1)},i._onKeySessionMessage=function(l,e){L.logger.log("Got EME message event, creating license request"),this._requestLicense(e,function(t){L.logger.log("Received license data (length: "+(t&&t.byteLength)+"), updating key-session"),l.update(t)})},i.onMediaEncrypted=function(l){var e=this;if(L.logger.log('Media is encrypted using "'+l.initDataType+'" init data type'),!this.mediaKeysPromise){L.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(k.Events.ERROR,{type:x.ErrorTypes.KEY_SYSTEM_ERROR,details:x.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var t=function(T){if(!e._media)return;e._attemptSetMediaKeys(T),e._generateRequestWithPreferredKeySession(l.initDataType,l.initData)};this.mediaKeysPromise.then(t).catch(t)},i._attemptSetMediaKeys=function(l){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var e=this._mediaKeysList[0];if(!e||!e.mediaKeys){L.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(k.Events.ERROR,{type:x.ErrorTypes.KEY_SYSTEM_ERROR,details:x.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}L.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(e.mediaKeys),this._hasSetMediaKeys=!0}},i._generateRequestWithPreferredKeySession=function(l,e){var t=this,n=this._mediaKeysList[0];if(!n){L.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(k.Events.ERROR,{type:x.ErrorTypes.KEY_SYSTEM_ERROR,details:x.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(n.mediaKeysSessionInitialized){L.logger.warn("Key-Session already initialized but requested again");return}var T=n.mediaKeysSession;if(!T){L.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(k.Events.ERROR,{type:x.ErrorTypes.KEY_SYSTEM_ERROR,details:x.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!e){L.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(k.Events.ERROR,{type:x.ErrorTypes.KEY_SYSTEM_ERROR,details:x.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}L.logger.log('Generating key-session request for "'+l+'" init data type'),n.mediaKeysSessionInitialized=!0,T.generateRequest(l,e).then(function(){L.logger.debug("Key-session generation succeeded")}).catch(function(b){L.logger.error("Error generating key-session request:",b),t.hls.trigger(k.Events.ERROR,{type:x.ErrorTypes.KEY_SYSTEM_ERROR,details:x.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},i._createLicenseXhr=function(l,e,t){var n=new XMLHttpRequest;n.responseType="arraybuffer",n.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,n,l,e,t);var T=this._licenseXhrSetup;if(T)try{T.call(this.hls,n,l),T=void 0}catch(b){L.logger.error(b)}try{n.readyState||n.open("POST",l,!0),T&&T.call(this.hls,n,l)}catch(b){throw new Error("issue setting up KeySystem license XHR "+b)}return n},i._onLicenseRequestReadyStageChange=function(l,e,t,n){switch(l.readyState){case 4:if(l.status===200){this._requestLicenseFailureCount=0,L.logger.log("License request succeeded");var T=l.response,b=this._licenseResponseCallback;if(b)try{T=b.call(this.hls,l,e)}catch(E){L.logger.error(E)}n(T)}else{if(L.logger.error("License Request XHR failed ("+e+"). Status: "+l.status+" ("+l.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>w){this.hls.trigger(k.Events.ERROR,{type:x.ErrorTypes.KEY_SYSTEM_ERROR,details:x.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var g=w-this._requestLicenseFailureCount+1;L.logger.warn("Retrying license request, "+g+" attempts left"),this._requestLicense(t,n)}break}},i._generateLicenseRequestChallenge=function(l,e){switch(l.mediaKeySystemDomain){case F.KeySystems.WIDEVINE:return e}throw new Error("unsupported key-system: "+l.mediaKeySystemDomain)},i._requestLicense=function(l,e){L.logger.log("Requesting content license for key-system");var t=this._mediaKeysList[0];if(!t){L.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(k.Events.ERROR,{type:x.ErrorTypes.KEY_SYSTEM_ERROR,details:x.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var n=this.getLicenseServerUrl(t.mediaKeySystemDomain),T=this._createLicenseXhr(n,l,e);L.logger.log("Sending license request to URL: "+n);var b=this._generateLicenseRequestChallenge(t,l);T.send(b)}catch(g){L.logger.error("Failure requesting DRM license: "+g),this.hls.trigger(k.Events.ERROR,{type:x.ErrorTypes.KEY_SYSTEM_ERROR,details:x.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},i.onMediaAttached=function(l,e){if(!this._emeEnabled)return;var t=e.media;this._media=t,t.addEventListener("encrypted",this._onMediaEncrypted)},i.onMediaDetached=function(){var l=this._media,e=this._mediaKeysList;if(!l)return;l.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(e.map(function(t){if(t.mediaKeysSession)return t.mediaKeysSession.close().catch(function(){})})).then(function(){return l.setMediaKeys(null)}).catch(function(){})},i.onManifestParsed=function(l,e){if(!this._emeEnabled)return;var t=e.levels.map(function(T){return T.audioCodec}).filter(function(T){return!!T}),n=e.levels.map(function(T){return T.videoCodec}).filter(function(T){return!!T});this._attemptKeySystemAccess(F.KeySystems.WIDEVINE,t,n)},O(r,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),r}();j.default=s},"./src/controller/fps-controller.ts":function(pe,j,C){"use strict";C.r(j);var k=C("./src/events.ts"),x=C("./src/utils/logger.ts"),L=function(){function F(O){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=O,this.registerListeners()}var N=F.prototype;return N.setStreamController=function(w){this.streamController=w},N.registerListeners=function(){this.hls.on(k.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},N.unregisterListeners=function(){this.hls.off(k.Events.MEDIA_ATTACHING,this.onMediaAttaching)},N.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},N.onMediaAttaching=function(w,y){var _=this.hls.config;if(_.capLevelOnFPSDrop){var s=y.media instanceof self.HTMLVideoElement?y.media:null;this.media=s,s&&typeof s.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),_.fpsDroppedMonitoringPeriod)}},N.checkFPS=function(w,y,_){var s=performance.now();if(y){if(this.lastTime){var r=s-this.lastTime,i=_-this.lastDroppedFrames,u=y-this.lastDecodedFrames,l=1e3*i/r,e=this.hls;if(e.trigger(k.Events.FPS_DROP,{currentDropped:i,currentDecoded:u,totalDroppedFrames:_}),l>0&&i>e.config.fpsDroppedMonitoringThreshold*u){var t=e.currentLevel;x.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+t),t>0&&(e.autoLevelCapping===-1||e.autoLevelCapping>=t)&&(t=t-1,e.trigger(k.Events.FPS_DROP_LEVEL_CAPPING,{level:t,droppedLevel:e.currentLevel}),e.autoLevelCapping=t,this.streamController.nextLevelSwitch())}}this.lastTime=s,this.lastDroppedFrames=_,this.lastDecodedFrames=y}},N.checkFPSInterval=function(){var w=this.media;if(w)if(this.isVideoPlaybackQualityAvailable){var y=w.getVideoPlaybackQuality();this.checkFPS(w,y.totalVideoFrames,y.droppedVideoFrames)}else this.checkFPS(w,w.webkitDecodedFrameCount,w.webkitDroppedFrameCount)},F}();j.default=L},"./src/controller/fragment-finders.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"findFragmentByPDT",function(){return L}),C.d(j,"findFragmentByPTS",function(){return F}),C.d(j,"fragmentWithinToleranceTest",function(){return N}),C.d(j,"pdtWithinToleranceTest",function(){return O}),C.d(j,"findFragWithCC",function(){return w});var k=C("./src/polyfills/number.ts"),x=C("./src/utils/binary-search.ts");function L(y,_,s){if(_===null||!Array.isArray(y)||!y.length||!Object(k.isFiniteNumber)(_))return null;var r=y[0].programDateTime;if(_<(r||0))return null;var i=y[y.length-1].endProgramDateTime;if(_>=(i||0))return null;s=s||0;for(var u=0;u<y.length;++u){var l=y[u];if(O(_,s,l))return l}return null}function F(y,_,s,r){s===void 0&&(s=0),r===void 0&&(r=0);var i=null;if(y?i=_[y.sn-_[0].sn+1]||null:s===0&&_[0].start===0&&(i=_[0]),i&&N(s,r,i)===0)return i;var u=x.default.search(_,N.bind(null,s,r));return u||i}function N(y,_,s){y===void 0&&(y=0),_===void 0&&(_=0);var r=Math.min(_,s.duration+(s.deltaPTS?s.deltaPTS:0));return s.start+s.duration-r<=y?1:s.start-r>y&&s.start?-1:0}function O(y,_,s){var r=Math.min(_,s.duration+(s.deltaPTS?s.deltaPTS:0))*1e3,i=s.endProgramDateTime||0;return i-r>y}function w(y,_){return x.default.search(y,function(s){return s.cc<_?1:s.cc>_?-1:0})}},"./src/controller/fragment-tracker.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"FragmentState",function(){return L}),C.d(j,"FragmentTracker",function(){return F});var k=C("./src/events.ts"),x=C("./src/types/loader.ts"),L;(function(w){w.NOT_LOADED="NOT_LOADED",w.BACKTRACKED="BACKTRACKED",w.APPENDING="APPENDING",w.PARTIAL="PARTIAL",w.OK="OK"})(L||(L={}));var F=function(){function w(_){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=_,this._registerListeners()}var y=w.prototype;return y._registerListeners=function(){var s=this.hls;s.on(k.Events.BUFFER_APPENDED,this.onBufferAppended,this),s.on(k.Events.FRAG_BUFFERED,this.onFragBuffered,this),s.on(k.Events.FRAG_LOADED,this.onFragLoaded,this)},y._unregisterListeners=function(){var s=this.hls;s.off(k.Events.BUFFER_APPENDED,this.onBufferAppended,this),s.off(k.Events.FRAG_BUFFERED,this.onFragBuffered,this),s.off(k.Events.FRAG_LOADED,this.onFragLoaded,this)},y.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},y.getAppendedFrag=function(s,r){if(r===x.PlaylistLevelType.MAIN){var i=this.activeFragment,u=this.activeParts;if(!i)return null;if(u)for(var l=u.length;l--;){var e=u[l],t=e?e.end:i.appendedPTS;if(e.start<=s&&t!==void 0&&s<=t)return l>9&&(this.activeParts=u.slice(l-9)),e}else if(i.start<=s&&i.appendedPTS!==void 0&&s<=i.appendedPTS)return i}return this.getBufferedFrag(s,r)},y.getBufferedFrag=function(s,r){for(var i=this.fragments,u=Object.keys(i),l=u.length;l--;){var e=i[u[l]];if((e==null?void 0:e.body.type)===r&&e.buffered){var t=e.body;if(t.start<=s&&s<=t.end)return t}}return null},y.detectEvictedFragments=function(s,r,i){var u=this;Object.keys(this.fragments).forEach(function(l){var e=u.fragments[l];if(!e)return;if(!e.buffered){e.body.type===i&&u.removeFragment(e.body);return}var t=e.range[s];if(!t)return;t.time.some(function(n){var T=!u.isTimeBuffered(n.startPTS,n.endPTS,r);return T&&u.removeFragment(e.body),T})})},y.detectPartialFragments=function(s){var r=this,i=this.timeRanges,u=s.frag,l=s.part;if(!i||u.sn==="initSegment")return;var e=O(u),t=this.fragments[e];if(!t)return;Object.keys(i).forEach(function(n){var T=u.elementaryStreams[n];if(!T)return;var b=i[n],g=l!==null||T.partial===!0;t.range[n]=r.getBufferedTimes(u,l,g,b)}),t.backtrack=t.loaded=null,Object.keys(t.range).length?t.buffered=!0:this.removeFragment(t.body)},y.fragBuffered=function(s){var r=O(s),i=this.fragments[r];i&&(i.backtrack=i.loaded=null,i.buffered=!0)},y.getBufferedTimes=function(s,r,i,u){for(var l={time:[],partial:i},e=r?r.start:s.start,t=r?r.end:s.end,n=s.minEndPTS||t,T=s.maxStartPTS||e,b=0;b<u.length;b++){var g=u.start(b)-this.bufferPadding,E=u.end(b)+this.bufferPadding;if(T>=g&&n<=E){l.time.push({startPTS:Math.max(e,u.start(b)),endPTS:Math.min(t,u.end(b))});break}else if(e<E&&t>g)l.partial=!0,l.time.push({startPTS:Math.max(e,u.start(b)),endPTS:Math.min(t,u.end(b))});else if(t<=g)break}return l},y.getPartialFragment=function(s){var r=null,i,u,l,e=0,t=this.bufferPadding,n=this.fragments;return Object.keys(n).forEach(function(T){var b=n[T];if(!b)return;N(b)&&(u=b.body.start-t,l=b.body.end+t,s>=u&&s<=l&&(i=Math.min(s-u,l-s),e<=i&&(r=b.body,e=i)))}),r},y.getState=function(s){var r=O(s),i=this.fragments[r];return i?i.buffered?N(i)?L.PARTIAL:L.OK:i.backtrack?L.BACKTRACKED:L.APPENDING:L.NOT_LOADED},y.backtrack=function(s,r){var i=O(s),u=this.fragments[i];if(!u||u.backtrack)return null;var l=u.backtrack=r||u.loaded;return u.loaded=null,l},y.getBacktrackData=function(s){var r=O(s),i=this.fragments[r];if(i){var u,l=i.backtrack;if(l!=null&&(u=l.payload)!==null&&u!==void 0&&u.byteLength)return l;this.removeFragment(s)}return null},y.isTimeBuffered=function(s,r,i){for(var u,l,e=0;e<i.length;e++){if(u=i.start(e)-this.bufferPadding,l=i.end(e)+this.bufferPadding,s>=u&&r<=l)return!0;if(r<=u)return!1}return!1},y.onFragLoaded=function(s,r){var i=r.frag,u=r.part;if(i.sn==="initSegment"||i.bitrateTest||u)return;var l=O(i);this.fragments[l]={body:i,loaded:r,backtrack:null,buffered:!1,range:Object.create(null)}},y.onBufferAppended=function(s,r){var i=this,u=r.frag,l=r.part,e=r.timeRanges;if(u.type===x.PlaylistLevelType.MAIN)if(this.activeFragment=u,l){var t=this.activeParts;t||(this.activeParts=t=[]),t.push(l)}else this.activeParts=null;this.timeRanges=e,Object.keys(e).forEach(function(n){var T=e[n];if(i.detectEvictedFragments(n,T),!l)for(var b=0;b<T.length;b++)u.appendedPTS=Math.max(T.end(b),u.appendedPTS||0)})},y.onFragBuffered=function(s,r){this.detectPartialFragments(r)},y.hasFragment=function(s){var r=O(s);return!!this.fragments[r]},y.removeFragmentsInRange=function(s,r,i){var u=this;Object.keys(this.fragments).forEach(function(l){var e=u.fragments[l];if(!e)return;if(e.buffered){var t=e.body;t.type===i&&t.start<r&&t.end>s&&u.removeFragment(t)}})},y.removeFragment=function(s){var r=O(s);s.stats.loaded=0,s.clearElementaryStreamInfo(),delete this.fragments[r]},y.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},w}();function N(w){var y,_;return w.buffered&&(((y=w.range.video)===null||y===void 0?void 0:y.partial)||((_=w.range.audio)===null||_===void 0?void 0:_.partial))}function O(w){return w.type+"_"+w.level+"_"+w.urlId+"_"+w.sn}},"./src/controller/gap-controller.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"STALL_MINIMUM_DURATION_MS",function(){return N}),C.d(j,"MAX_START_GAP_JUMP",function(){return O}),C.d(j,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return w}),C.d(j,"SKIP_BUFFER_RANGE_START",function(){return y}),C.d(j,"default",function(){return _});var k=C("./src/utils/buffer-helper.ts"),x=C("./src/errors.ts"),L=C("./src/events.ts"),F=C("./src/utils/logger.ts"),N=250,O=2,w=.1,y=.05,_=function(){function s(i,u,l,e){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=i,this.media=u,this.fragmentTracker=l,this.hls=e}var r=s.prototype;return r.destroy=function(){this.hls=this.fragmentTracker=this.media=null},r.poll=function(u){var l=this.config,e=this.media,t=this.stalled,n=e.currentTime,T=e.seeking,b=this.seeking&&!T,g=!this.seeking&&T;if(this.seeking=T,n!==u){if(this.moved=!0,t!==null){if(this.stallReported){var E=self.performance.now()-t;F.logger.warn("playback not stuck anymore @"+n+", after "+Math.round(E)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((g||b)&&(this.stalled=null),e.paused||e.ended||e.playbackRate===0||!k.BufferHelper.getBuffered(e).length)return;var v=k.BufferHelper.bufferInfo(e,n,0),p=v.len>0,d=v.nextStart||0;if(!p&&!d)return;if(T){var a=v.len>O,o=!d||d-n>O&&!this.fragmentTracker.getPartialFragment(n);if(a||o)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var c,f=Math.max(d,v.start||0)-n,S=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,A=S==null||((c=S.details)===null||c===void 0)?void 0:c.live,R=A?S.details.targetduration*2:O;if(f>0&&f<=R){this._trySkipBufferHole(null);return}}var B=self.performance.now();if(t===null){this.stalled=B;return}var U=B-t;!T&&U>=N&&this._reportStall(v.len);var K=k.BufferHelper.bufferInfo(e,n,l.maxBufferHole);this._tryFixBufferStall(K,U)},r._tryFixBufferStall=function(u,l){var e=this.config,t=this.fragmentTracker,n=this.media,T=n.currentTime,b=t.getPartialFragment(T);if(b){var g=this._trySkipBufferHole(b);if(g)return}u.len>e.maxBufferHole&&l>e.highBufferWatchdogPeriod*1e3&&(F.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},r._reportStall=function(u){var l=this.hls,e=this.media,t=this.stallReported;t||(this.stallReported=!0,F.logger.warn("Playback stalling at @"+e.currentTime+" due to low buffer (buffer="+u+")"),l.trigger(L.Events.ERROR,{type:x.ErrorTypes.MEDIA_ERROR,details:x.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:u}))},r._trySkipBufferHole=function(u){for(var l=this.config,e=this.hls,t=this.media,n=t.currentTime,T=0,b=k.BufferHelper.getBuffered(t),g=0;g<b.length;g++){var E=b.start(g);if(n+l.maxBufferHole>=T&&n<E){var v=Math.max(E+y,t.currentTime+w);return F.logger.warn("skipping hole, adjusting currentTime from "+n+" to "+v),this.moved=!0,this.stalled=null,t.currentTime=v,u&&e.trigger(L.Events.ERROR,{type:x.ErrorTypes.MEDIA_ERROR,details:x.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+n+" to "+v,frag:u}),v}T=b.end(g)}return 0},r._tryNudgeBuffer=function(){var u=this.config,l=this.hls,e=this.media,t=e.currentTime,n=(this.nudgeRetry||0)+1;if(this.nudgeRetry=n,n<u.nudgeMaxRetry){var T=t+n*u.nudgeOffset;F.logger.warn("Nudging 'currentTime' from "+t+" to "+T),e.currentTime=T,l.trigger(L.Events.ERROR,{type:x.ErrorTypes.MEDIA_ERROR,details:x.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else F.logger.error("Playhead still not moving while enough data buffered @"+t+" after "+u.nudgeMaxRetry+" nudges"),l.trigger(L.Events.ERROR,{type:x.ErrorTypes.MEDIA_ERROR,details:x.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},s}()},"./src/controller/id3-track-controller.ts":function(pe,j,C){"use strict";C.r(j);var k=C("./src/events.ts"),x=C("./src/utils/texttrack-utils.ts"),L=C("./src/demux/id3.ts"),F=.25,N=function(){function O(y){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=y,this._registerListeners()}var w=O.prototype;return w.destroy=function(){this._unregisterListeners()},w._registerListeners=function(){var _=this.hls;_.on(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),_.on(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),_.on(k.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),_.on(k.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},w._unregisterListeners=function(){var _=this.hls;_.off(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),_.off(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),_.off(k.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),_.off(k.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},w.onMediaAttached=function(_,s){this.media=s.media},w.onMediaDetaching=function(){if(!this.id3Track)return;Object(x.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},w.getID3Track=function(_){if(!this.media)return;for(var s=0;s<_.length;s++){var r=_[s];if(r.kind==="metadata"&&r.label==="id3")return Object(x.sendAddTrackEvent)(r,this.media),r}return this.media.addTextTrack("metadata","id3")},w.onFragParsingMetadata=function(_,s){if(!this.media)return;var r=s.frag,i=s.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var u=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,l=0;l<i.length;l++){var e=L.getID3Frames(i[l].data);if(e){var t=i[l].pts,n=l<i.length-1?i[l+1].pts:r.end,T=n-t;T<=0&&(n=t+F);for(var b=0;b<e.length;b++){var g=e[b];if(!L.isTimeStampFrame(g)){var E=new u(t,n,"");E.value=g,this.id3Track.addCue(E)}}}}},w.onBufferFlushing=function(_,s){var r=s.startOffset,i=s.endOffset,u=s.type;if(!u||u==="audio"){var l=this.id3Track;l&&Object(x.removeCuesInRange)(l,r,i)}},O}();j.default=N},"./src/controller/latency-controller.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"default",function(){return O});var k=C("./src/errors.ts"),x=C("./src/events.ts"),L=C("./src/utils/logger.ts");function F(w,y){for(var _=0;_<y.length;_++){var s=y[_];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(w,s.key,s)}}function N(w,y,_){return y&&F(w.prototype,y),_&&F(w,_),w}var O=function(){function w(_){var s=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 s.timeupdate()},this.hls=_,this.config=_.config,this.registerListeners()}var y=w.prototype;return y.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},y.registerListeners=function(){this.hls.on(x.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(x.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(x.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(x.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(x.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){this.hls.off(x.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(x.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(x.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(x.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(x.Events.ERROR,this.onError)},y.onMediaAttached=function(s,r){this.media=r.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},y.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},y.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},y.onLevelUpdated=function(s,r){var i=r.details;this.levelDetails=i,i.advanced&&this.timeupdate(),!i.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},y.onError=function(s,r){if(r.details!==k.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,L.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},y.timeupdate=function(){var s=this.media,r=this.levelDetails;if(!s||!r)return;this.currentTime=s.currentTime;var i=this.computeLatency();if(i===null)return;this._latency=i;var u=this.config,l=u.lowLatencyMode,e=u.maxLiveSyncPlaybackRate;if(!l||e===1)return;var t=this.targetLatency;if(t===null)return;var n=i-t,T=Math.min(this.maxLatency,t+r.targetduration),b=n<T;if(r.live&&b&&n>.05&&this.forwardBufferLength>1){var g=Math.min(2,Math.max(1,e)),E=Math.round(2/(1+Math.exp(-.75*n-this.edgeStalled))*20)/20;s.playbackRate=Math.min(g,Math.max(1,E))}else s.playbackRate!==1&&s.playbackRate!==0&&(s.playbackRate=1)},y.estimateLiveEdge=function(){var s=this.levelDetails;return s===null?null:s.edge+s.age},y.computeLatency=function(){var s=this.estimateLiveEdge();return s===null?null:s-this.currentTime},N(w,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var s=this.config,r=this.levelDetails;return s.liveMaxLatencyDuration!==void 0?s.liveMaxLatencyDuration:r?s.liveMaxLatencyDurationCount*r.targetduration:0}},{key:"targetLatency",get:function(){var s=this.levelDetails;if(s===null)return null;var r=s.holdBack,i=s.partHoldBack,u=s.targetduration,l=this.config,e=l.liveSyncDuration,t=l.liveSyncDurationCount,n=l.lowLatencyMode,T=this.hls.userConfig,b=n&&i||r;(T.liveSyncDuration||T.liveSyncDurationCount||b===0)&&(b=e!==void 0?e:t*u);var g=u,E=1;return b+Math.min(this.stallCount*E,g)}},{key:"liveSyncPosition",get:function(){var s=this.estimateLiveEdge(),r=this.targetLatency,i=this.levelDetails;if(s===null||r===null||i===null)return null;var u=i.edge,l=s-r-this.edgeStalled,e=u-i.totalduration,t=u-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(e,l),t)}},{key:"drift",get:function(){var s=this.levelDetails;return s===null?1:s.drift}},{key:"edgeStalled",get:function(){var s=this.levelDetails;if(s===null)return 0;var r=(this.config.lowLatencyMode&&s.partTarget||s.targetduration)*3;return Math.max(s.age-r,0)}},{key:"forwardBufferLength",get:function(){var s=this.media,r=this.levelDetails;if(!s||!r)return 0;var i=s.buffered.length;return i?s.buffered.end(i-1):r.edge-this.currentTime}}]),w}()},"./src/controller/level-controller.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"default",function(){return l});var k=C("./src/types/level.ts"),x=C("./src/events.ts"),L=C("./src/errors.ts"),F=C("./src/utils/codecs.ts"),N=C("./src/controller/level-helper.ts"),O=C("./src/controller/base-playlist-controller.ts"),w=C("./src/types/loader.ts");function y(){return y=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var T in n)Object.prototype.hasOwnProperty.call(n,T)&&(e[T]=n[T])}return e},y.apply(this,arguments)}function _(e,t){for(var n=0;n<t.length;n++){var T=t[n];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(e,T.key,T)}}function s(e,t,n){return t&&_(e.prototype,t),n&&_(e,n),e}function r(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,i(e,t)}function i(e,t){return i=Object.setPrototypeOf||function(T,b){return T.__proto__=b,T},i(e,t)}var u=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),l=function(e){r(t,e);function t(T){var b;return b=e.call(this,T,"[level-controller]")||this,b._levels=[],b._firstLevel=-1,b._startLevel=void 0,b.currentLevelIndex=-1,b.manualLevelIndex=-1,b.onParsedComplete=void 0,b._registerListeners(),b}var n=t.prototype;return n._registerListeners=function(){var b=this.hls;b.on(x.Events.MANIFEST_LOADED,this.onManifestLoaded,this),b.on(x.Events.LEVEL_LOADED,this.onLevelLoaded,this),b.on(x.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),b.on(x.Events.FRAG_LOADED,this.onFragLoaded,this),b.on(x.Events.ERROR,this.onError,this)},n._unregisterListeners=function(){var b=this.hls;b.off(x.Events.MANIFEST_LOADED,this.onManifestLoaded,this),b.off(x.Events.LEVEL_LOADED,this.onLevelLoaded,this),b.off(x.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),b.off(x.Events.FRAG_LOADED,this.onFragLoaded,this),b.off(x.Events.ERROR,this.onError,this)},n.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,e.prototype.destroy.call(this)},n.startLoad=function(){var b=this._levels;b.forEach(function(g){g.loadError=0}),e.prototype.startLoad.call(this)},n.onManifestLoaded=function(b,g){var E=[],v=[],p=[],d,a={},o,c=!1,f=!1,S=!1;if(g.levels.forEach(function(U){var K=U.attrs;c=c||!!(U.width&&U.height),f=f||!!U.videoCodec,S=S||!!U.audioCodec,u&&U.audioCodec&&U.audioCodec.indexOf("mp4a.40.34")!==-1&&(U.audioCodec=void 0);var D=U.bitrate+"-"+U.attrs.RESOLUTION+"-"+U.attrs.CODECS;o=a[D],o?o.url.push(U.url):(o=new k.Level(U),a[D]=o,E.push(o)),K&&(K.AUDIO&&Object(N.addGroupId)(o,"audio",K.AUDIO),K.SUBTITLES&&Object(N.addGroupId)(o,"text",K.SUBTITLES))}),(c||f)&&S&&(E=E.filter(function(U){var K=U.videoCodec,D=U.width,H=U.height;return!!K||!!(D&&H)})),E=E.filter(function(U){var K=U.audioCodec,D=U.videoCodec;return(!K||Object(F.isCodecSupportedInMp4)(K,"audio"))&&(!D||Object(F.isCodecSupportedInMp4)(D,"video"))}),g.audioTracks&&(v=g.audioTracks.filter(function(U){return!U.audioCodec||Object(F.isCodecSupportedInMp4)(U.audioCodec,"audio")}),Object(N.assignTrackIdsByGroup)(v)),g.subtitles&&(p=g.subtitles,Object(N.assignTrackIdsByGroup)(p)),E.length>0){d=E[0].bitrate,E.sort(function(U,K){return U.bitrate-K.bitrate}),this._levels=E;for(var A=0;A<E.length;A++)if(E[A].bitrate===d){this._firstLevel=A,this.log("manifest loaded, "+E.length+" level(s) found, first bitrate: "+d);break}var R=S&&!f,B={levels:E,audioTracks:v,subtitleTracks:p,firstLevel:this._firstLevel,stats:g.stats,audio:S,video:f,altAudio:!R&&v.some(function(U){return!!U.url})};this.hls.trigger(x.Events.MANIFEST_PARSED,B),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(x.Events.ERROR,{type:L.ErrorTypes.MEDIA_ERROR,details:L.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:g.url,reason:"no level with compatible codecs found in manifest"})},n.onError=function(b,g){if(e.prototype.onError.call(this,b,g),g.fatal)return;var E=g.context,v=this._levels[this.currentLevelIndex];if(E&&(E.type===w.PlaylistContextType.AUDIO_TRACK&&v.audioGroupIds&&E.groupId===v.audioGroupIds[v.urlId]||E.type===w.PlaylistContextType.SUBTITLE_TRACK&&v.textGroupIds&&E.groupId===v.textGroupIds[v.urlId])){this.redundantFailover(this.currentLevelIndex);return}var p=!1,d=!0,a;switch(g.details){case L.ErrorDetails.FRAG_LOAD_ERROR:case L.ErrorDetails.FRAG_LOAD_TIMEOUT:case L.ErrorDetails.KEY_LOAD_ERROR:case L.ErrorDetails.KEY_LOAD_TIMEOUT:if(g.frag){var o=this._levels[g.frag.level];o?(o.fragmentError++,o.fragmentError>this.hls.config.fragLoadingMaxRetry&&(a=g.frag.level)):a=g.frag.level}break;case L.ErrorDetails.LEVEL_LOAD_ERROR:case L.ErrorDetails.LEVEL_LOAD_TIMEOUT:E&&(E.deliveryDirectives&&(d=!1),a=E.level),p=!0;break;case L.ErrorDetails.REMUX_ALLOC_ERROR:a=g.level,p=!0;break}a!==void 0&&this.recoverLevel(g,a,p,d)},n.recoverLevel=function(b,g,E,v){var p=b.details,d=this._levels[g];if(d.loadError++,E){var a=this.retryLoadingOrFail(b);if(a)b.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(v){var o=d.url.length;if(o>1&&d.loadError<o)b.levelRetry=!0,this.redundantFailover(g);else if(this.manualLevelIndex===-1){var c=g===0?this._levels.length-1:g-1;this.currentLevelIndex!==c&&this._levels[c].loadError===0&&(this.warn(p+": switch to "+c),b.levelRetry=!0,this.hls.nextAutoLevel=c)}}},n.redundantFailover=function(b){var g=this._levels[b],E=g.url.length;if(E>1){var v=(g.urlId+1)%E;this.warn("Switching to redundant URL-id "+v),this._levels.forEach(function(p){p.urlId=v}),this.level=b}},n.onFragLoaded=function(b,g){var E=g.frag;if(E!==void 0&&E.type===w.PlaylistLevelType.MAIN){var v=this._levels[E.level];v!==void 0&&(v.fragmentError=0,v.loadError=0)}},n.onLevelLoaded=function(b,g){var E,v=g.level,p=g.details,d=this._levels[v];if(!d){var a;this.warn("Invalid level index "+v),(a=g.deliveryDirectives)!==null&&a!==void 0&&a.skip&&(p.deltaUpdateFailed=!0);return}v===this.currentLevelIndex?(d.fragmentError===0&&(d.loadError=0,this.retryCount=0),this.playlistLoaded(v,g,d.details)):(E=g.deliveryDirectives)!==null&&E!==void 0&&E.skip&&(p.deltaUpdateFailed=!0)},n.onAudioTrackSwitched=function(b,g){var E=this.hls.levels[this.currentLevelIndex];if(!E)return;if(E.audioGroupIds){for(var v=-1,p=this.hls.audioTracks[g.id].groupId,d=0;d<E.audioGroupIds.length;d++)if(E.audioGroupIds[d]===p){v=d;break}v!==E.urlId&&(E.urlId=v,this.startLoad())}},n.loadPlaylist=function(b){var g=this.currentLevelIndex,E=this._levels[g];if(this.canLoad&&E&&E.url.length>0){var v=E.urlId,p=E.url[v];if(b)try{p=b.addDirectives(p)}catch(d){this.warn("Could not construct new URL with HLS Delivery Directives: "+d)}this.log("Attempt loading level index "+g+(b?" at sn "+b.msn+" part "+b.part:"")+" with URL-id "+v+" "+p),this.clearTimer(),this.hls.trigger(x.Events.LEVEL_LOADING,{url:p,level:g,id:v,deliveryDirectives:b||null})}},n.removeLevel=function(b,g){var E=function(d,a){return a!==g},v=this._levels.filter(function(p,d){return d!==b?!0:p.url.length>1&&g!==void 0?(p.url=p.url.filter(E),p.audioGroupIds&&(p.audioGroupIds=p.audioGroupIds.filter(E)),p.textGroupIds&&(p.textGroupIds=p.textGroupIds.filter(E)),p.urlId=0,!0):!1}).map(function(p,d){var a=p.details;return a!=null&&a.fragments&&a.fragments.forEach(function(o){o.level=d}),p});this._levels=v,this.hls.trigger(x.Events.LEVELS_UPDATED,{levels:v})},s(t,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(b){var g,E=this._levels;if(E.length===0)return;if(this.currentLevelIndex===b&&(g=E[b])!==null&&g!==void 0&&g.details)return;if(b<0||b>=E.length){var v=b<0;if(this.hls.trigger(x.Events.ERROR,{type:L.ErrorTypes.OTHER_ERROR,details:L.ErrorDetails.LEVEL_SWITCH_ERROR,level:b,fatal:v,reason:"invalid level idx"}),v)return;b=Math.min(b,E.length-1)}this.clearTimer();var p=this.currentLevelIndex,d=E[p],a=E[b];this.log("switching to level "+b+" from "+p),this.currentLevelIndex=b;var o=y({},a,{level:b,maxBitrate:a.maxBitrate,uri:a.uri,urlId:a.urlId});delete o._urlId,this.hls.trigger(x.Events.LEVEL_SWITCHING,o);var c=a.details;if(!c||c.live){var f=this.switchParams(a.uri,d==null?void 0:d.details);this.loadPlaylist(f)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(b){this.manualLevelIndex=b,this._startLevel===void 0&&(this._startLevel=b),b!==-1&&(this.level=b)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(b){this._firstLevel=b}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var b=this.hls.config.startLevel;return b!==void 0?b:this._firstLevel}else return this._startLevel},set:function(b){this._startLevel=b}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(b){this.level=b,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=b)}}]),t}(O.default)},"./src/controller/level-helper.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"addGroupId",function(){return L}),C.d(j,"assignTrackIdsByGroup",function(){return F}),C.d(j,"updatePTS",function(){return N}),C.d(j,"updateFragPTSDTS",function(){return w}),C.d(j,"mergeDetails",function(){return y}),C.d(j,"mapPartIntersection",function(){return _}),C.d(j,"mapFragmentIntersection",function(){return s}),C.d(j,"adjustSliding",function(){return r}),C.d(j,"addSliding",function(){return i}),C.d(j,"computeReloadInterval",function(){return u}),C.d(j,"getFragmentWithSN",function(){return l}),C.d(j,"getPartWith",function(){return e});var k=C("./src/polyfills/number.ts"),x=C("./src/utils/logger.ts");function L(t,n,T){switch(n){case"audio":t.audioGroupIds||(t.audioGroupIds=[]),t.audioGroupIds.push(T);break;case"text":t.textGroupIds||(t.textGroupIds=[]),t.textGroupIds.push(T);break}}function F(t){var n={};t.forEach(function(T){var b=T.groupId||"";T.id=n[b]=n[b]||0,n[b]++})}function N(t,n,T){var b=t[n],g=t[T];O(b,g)}function O(t,n){var T=n.startPTS;if(Object(k.isFiniteNumber)(T)){var b=0,g;n.sn>t.sn?(b=T-t.start,g=t):(b=t.start-T,g=n),g.duration!==b&&(g.duration=b)}else if(n.sn>t.sn){var E=t.cc===n.cc;E&&t.minEndPTS?n.start=t.start+(t.minEndPTS-t.start):n.start=t.start+t.duration}else n.start=Math.max(t.start-n.duration,0)}function w(t,n,T,b,g,E){var v=b-T;v<=0&&(x.logger.warn("Fragment should have a positive duration",n),b=T+n.duration,E=g+n.duration);var p=T,d=b,a=n.startPTS,o=n.endPTS;if(Object(k.isFiniteNumber)(a)){var c=Math.abs(a-T);Object(k.isFiniteNumber)(n.deltaPTS)?n.deltaPTS=Math.max(c,n.deltaPTS):n.deltaPTS=c,p=Math.max(T,a),T=Math.min(T,a),g=Math.min(g,n.startDTS),d=Math.min(b,o),b=Math.max(b,o),E=Math.max(E,n.endDTS)}n.duration=b-T;var f=T-n.start;n.appendedPTS=b,n.start=n.startPTS=T,n.maxStartPTS=p,n.startDTS=g,n.endPTS=b,n.minEndPTS=d,n.endDTS=E;var S=n.sn;if(!t||S<t.startSN||S>t.endSN)return 0;var A,R=S-t.startSN,B=t.fragments;for(B[R]=n,A=R;A>0;A--)O(B[A],B[A-1]);for(A=R;A<B.length-1;A++)O(B[A],B[A+1]);return t.fragmentHint&&O(B[B.length-1],t.fragmentHint),t.PTSKnown=t.alignedSliding=!0,f}function y(t,n){for(var T=null,b=t.fragments,g=b.length-1;g>=0;g--){var E=b[g].initSegment;if(E){T=E;break}}t.fragmentHint&&delete t.fragmentHint.endPTS;var v=0,p;if(s(t,n,function(A,R){A.relurl&&(v=A.cc-R.cc),Object(k.isFiniteNumber)(A.startPTS)&&Object(k.isFiniteNumber)(A.endPTS)&&(R.start=R.startPTS=A.startPTS,R.startDTS=A.startDTS,R.appendedPTS=A.appendedPTS,R.maxStartPTS=A.maxStartPTS,R.endPTS=A.endPTS,R.endDTS=A.endDTS,R.minEndPTS=A.minEndPTS,R.duration=A.endPTS-A.startPTS,R.duration&&(p=R),n.PTSKnown=n.alignedSliding=!0),R.elementaryStreams=A.elementaryStreams,R.loader=A.loader,R.stats=A.stats,R.urlId=A.urlId,A.initSegment&&(R.initSegment=A.initSegment,T=A.initSegment)}),T){var d=n.fragmentHint?n.fragments.concat(n.fragmentHint):n.fragments;d.forEach(function(A){var R;(!A.initSegment||A.initSegment.relurl===((R=T)===null||R===void 0?void 0:R.relurl))&&(A.initSegment=T)})}if(n.skippedSegments&&(n.deltaUpdateFailed=n.fragments.some(function(A){return!A}),n.deltaUpdateFailed)){x.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var a=n.skippedSegments;a--;)n.fragments.shift();n.startSN=n.fragments[0].sn,n.startCC=n.fragments[0].cc}var o=n.fragments;if(v){x.logger.warn("discontinuity sliding from playlist, take drift into account");for(var c=0;c<o.length;c++)o[c].cc+=v}n.skippedSegments&&(n.startCC=n.fragments[0].cc),_(t.partList,n.partList,function(A,R){R.elementaryStreams=A.elementaryStreams,R.stats=A.stats}),p?w(n,p,p.startPTS,p.endPTS,p.startDTS,p.endDTS):r(t,n),o.length&&(n.totalduration=n.edge-o[0].start),n.driftStartTime=t.driftStartTime,n.driftStart=t.driftStart;var f=n.advancedDateTime;if(n.advanced&&f){var S=n.edge;n.driftStart||(n.driftStartTime=f,n.driftStart=S),n.driftEndTime=f,n.driftEnd=S}else n.driftEndTime=t.driftEndTime,n.driftEnd=t.driftEnd,n.advancedDateTime=t.advancedDateTime}function _(t,n,T){if(t&&n)for(var b=0,g=0,E=t.length;g<=E;g++){var v=t[g],p=n[g+b];v&&p&&v.index===p.index&&v.fragment.sn===p.fragment.sn?T(v,p):b--}}function s(t,n,T){for(var b=n.skippedSegments,g=Math.max(t.startSN,n.startSN)-n.startSN,E=(t.fragmentHint?1:0)+(b?n.endSN:Math.min(t.endSN,n.endSN))-n.startSN,v=n.startSN-t.startSN,p=n.fragmentHint?n.fragments.concat(n.fragmentHint):n.fragments,d=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,a=g;a<=E;a++){var o=d[v+a],c=p[a];b&&!c&&a<b&&(c=n.fragments[a]=o),o&&c&&T(o,c)}}function r(t,n){var T=n.startSN+n.skippedSegments-t.startSN,b=t.fragments;if(T<0||T>=b.length)return;i(n,b[T].start)}function i(t,n){if(n){for(var T=t.fragments,b=t.skippedSegments;b<T.length;b++)T[b].start+=n;t.fragmentHint&&(t.fragmentHint.start+=n)}}function u(t,n){var T=1e3*t.levelTargetDuration,b=T/2,g=t.age,E=g>0&&g<T*3,v=n.loading.end-n.loading.start,p,d=t.availabilityDelay;if(t.updated===!1)if(E){var a=333*t.misses;p=Math.max(Math.min(b,v*2),a),t.availabilityDelay=(t.availabilityDelay||0)+p}else p=b;else E?(d=Math.min(d||T/2,g),t.availabilityDelay=d,p=d+T-g):p=T-v;return Math.round(p)}function l(t,n,T){if(!t||!t.details)return null;var b=t.details,g=b.fragments[n-b.startSN];return g||(g=b.fragmentHint,g&&g.sn===n?g:n<b.startSN&&T&&T.sn===n?T:null)}function e(t,n,T){if(!t||!t.details)return null;var b=t.details.partList;if(b)for(var g=b.length;g--;){var E=b[g];if(E.index===T&&E.fragment.sn===n)return E}return null}},"./src/controller/stream-controller.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"default",function(){return b});var k=C("./src/polyfills/number.ts"),x=C("./src/controller/base-stream-controller.ts"),L=C("./src/is-supported.ts"),F=C("./src/events.ts"),N=C("./src/utils/buffer-helper.ts"),O=C("./src/controller/fragment-tracker.ts"),w=C("./src/types/loader.ts"),y=C("./src/loader/fragment.ts"),_=C("./src/demux/transmuxer-interface.ts"),s=C("./src/types/transmuxer.ts"),r=C("./src/controller/gap-controller.ts"),i=C("./src/errors.ts"),u=C("./src/utils/logger.ts");function l(g,E){for(var v=0;v<E.length;v++){var p=E[v];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(g,p.key,p)}}function e(g,E,v){return E&&l(g.prototype,E),v&&l(g,v),g}function t(g,E){g.prototype=Object.create(E.prototype),g.prototype.constructor=g,n(g,E)}function n(g,E){return n=Object.setPrototypeOf||function(p,d){return p.__proto__=d,p},n(g,E)}var T=100,b=function(g){t(E,g);function E(p,d){var a;return a=g.call(this,p,d,"[stream-controller]")||this,a.audioCodecSwap=!1,a.gapController=null,a.level=-1,a._forceStartLoad=!1,a.altAudio=!1,a.audioOnly=!1,a.fragPlaying=null,a.onvplaying=null,a.onvseeked=null,a.fragLastKbps=0,a.stalled=!1,a.couldBacktrack=!1,a.audioCodecSwitch=!1,a.videoBuffer=null,a._registerListeners(),a}var v=E.prototype;return v._registerListeners=function(){var d=this.hls;d.on(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(F.Events.LEVEL_LOADING,this.onLevelLoading,this),d.on(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(F.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),d.on(F.Events.ERROR,this.onError,this),d.on(F.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.on(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),d.on(F.Events.BUFFER_CREATED,this.onBufferCreated,this),d.on(F.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.on(F.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),d.on(F.Events.FRAG_BUFFERED,this.onFragBuffered,this)},v._unregisterListeners=function(){var d=this.hls;d.off(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(F.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),d.off(F.Events.ERROR,this.onError,this),d.off(F.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.off(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),d.off(F.Events.BUFFER_CREATED,this.onBufferCreated,this),d.off(F.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.off(F.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),d.off(F.Events.FRAG_BUFFERED,this.onFragBuffered,this)},v.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},v.startLoad=function(d){if(this.levels){var a=this.lastCurrentTime,o=this.hls;if(this.stopLoad(),this.setInterval(T),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var c=o.startLevel;c===-1&&(o.config.testBandwidth?(c=0,this.bitrateTest=!0):c=o.nextAutoLevel),this.level=o.nextLoadLevel=c,this.loadedmetadata=!1}a>0&&d===-1&&(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),d=a),this.state=x.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=d,this.tick()}else this._forceStartLoad=!0,this.state=x.State.STOPPED},v.stopLoad=function(){this._forceStartLoad=!1,g.prototype.stopLoad.call(this)},v.doTick=function(){switch(this.state){case x.State.IDLE:this.doTickIdle();break;case x.State.WAITING_LEVEL:{var d,a=this.levels,o=this.level,c=a==null||((d=a[o])===null||d===void 0)?void 0:d.details;if(c&&(!c.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(c))break;this.state=x.State.IDLE;break}break}case x.State.FRAG_LOADING_WAITING_RETRY:{var f,S=self.performance.now(),A=this.retryDate;(!A||S>=A||(f=this.media)!==null&&f!==void 0&&f.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=x.State.IDLE)}break;default:break}this.onTickEnd()},v.onTickEnd=function(){g.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},v.doTickIdle=function(){var d,a,o=this.hls,c=this.levelLastLoaded,f=this.levels,S=this.media,A=o.config,R=o.nextLoadLevel;if(c===null||!S&&(this.startFragRequested||!A.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!f||!f[R])return;var B=f[R];this.level=o.nextLoadLevel=R;var U=B.details;if(!U||this.state===x.State.WAITING_LEVEL||U.live&&this.levelLastLoaded!==R){this.state=x.State.WAITING_LEVEL;return}var K=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:S,w.PlaylistLevelType.MAIN);if(K===null)return;var D=K.len,H=this.getMaxBufferLength(B.maxBitrate);if(D>=H)return;if(this._streamEnded(K,U)){var V={};this.altAudio&&(V.type="video"),this.hls.trigger(F.Events.BUFFER_EOS,V),this.state=x.State.ENDED;return}var ne=K.end,ie=this.getNextFragment(ne,U);if(this.couldBacktrack&&!this.fragPrevious&&ie&&ie.sn!=="initSegment"){var _e=ie.sn-U.startSN;_e>1&&(ie=U.fragments[_e-1],this.fragmentTracker.removeFragment(ie))}if(ie&&this.fragmentTracker.getState(ie)===O.FragmentState.OK&&this.nextLoadPosition>ne){var ye=this.audioOnly&&!this.altAudio?y.ElementaryStreamTypes.AUDIO:y.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(S,ye,w.PlaylistLevelType.MAIN),ie=this.getNextFragment(this.nextLoadPosition,U)}if(!ie)return;ie.initSegment&&!ie.initSegment.data&&!this.bitrateTest&&(ie=ie.initSegment),((d=ie.decryptdata)===null||d===void 0?void 0:d.keyFormat)==="identity"&&!((a=ie.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(ie,U):this.loadFragment(ie,U,ne)},v.loadFragment=function(d,a,o){var c,f=this.fragmentTracker.getState(d);if(this.fragCurrent=d,f===O.FragmentState.BACKTRACKED){var S=this.fragmentTracker.getBacktrackData(d);if(S){this._handleFragmentLoadProgress(S),this._handleFragmentLoadComplete(S);return}else f=O.FragmentState.NOT_LOADED}f===O.FragmentState.NOT_LOADED||f===O.FragmentState.PARTIAL?d.sn==="initSegment"?this._loadInitSegment(d):this.bitrateTest?(d.bitrateTest=!0,this.log("Fragment "+d.sn+" of level "+d.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(d)):(this.startFragRequested=!0,g.prototype.loadFragment.call(this,d,a,o)):f===O.FragmentState.APPENDING?this.reduceMaxBufferLength(d.duration)&&this.fragmentTracker.removeFragment(d):((c=this.media)===null||c===void 0?void 0:c.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},v.getAppendedFrag=function(d){var a=this.fragmentTracker.getAppendedFrag(d,w.PlaylistLevelType.MAIN);return a&&"fragment"in a?a.fragment:a},v.getBufferedFrag=function(d){return this.fragmentTracker.getBufferedFrag(d,w.PlaylistLevelType.MAIN)},v.followingBufferedFrag=function(d){return d?this.getBufferedFrag(d.end+.5):null},v.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},v.nextLevelSwitch=function(){var d=this.levels,a=this.media;if(a!=null&&a.readyState){var o,c=this.getAppendedFrag(a.currentTime);if(c&&c.start>1&&this.flushMainBuffer(0,c.start-1),!a.paused&&d){var f=this.hls.nextLoadLevel,S=d[f],A=this.fragLastKbps;A&&this.fragCurrent?o=this.fragCurrent.duration*S.maxBitrate/(1e3*A)+1:o=0}else o=0;var R=this.getBufferedFrag(a.currentTime+o);if(R){var B=this.followingBufferedFrag(R);if(B){this.abortCurrentFrag();var U=B.maxStartPTS?B.maxStartPTS:B.start,K=B.duration,D=Math.max(R.end,U+Math.min(Math.max(K-this.config.maxFragLookUpTolerance,K*.5),K*.75));this.flushMainBuffer(D,Number.POSITIVE_INFINITY)}}}},v.abortCurrentFrag=function(){var d=this.fragCurrent;this.fragCurrent=null,d!=null&&d.loader&&d.loader.abort(),this.state===x.State.KEY_LOADING&&(this.state=x.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},v.flushMainBuffer=function(d,a){g.prototype.flushMainBuffer.call(this,d,a,this.altAudio?"video":null)},v.onMediaAttached=function(d,a){g.prototype.onMediaAttached.call(this,d,a);var o=a.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),o.addEventListener("playing",this.onvplaying),o.addEventListener("seeked",this.onvseeked),this.gapController=new r.default(this.config,o,this.fragmentTracker,this.hls)},v.onMediaDetaching=function(){var d=this.media;d&&(d.removeEventListener("playing",this.onvplaying),d.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),g.prototype.onMediaDetaching.call(this)},v.onMediaPlaying=function(){this.tick()},v.onMediaSeeked=function(){var d=this.media,a=d?d.currentTime:null;Object(k.isFiniteNumber)(a)&&this.log("Media seeked to "+a.toFixed(3)),this.tick()},v.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(F.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},v.onManifestParsed=function(d,a){var o=!1,c=!1,f;a.levels.forEach(function(S){f=S.audioCodec,f&&(f.indexOf("mp4a.40.2")!==-1&&(o=!0),f.indexOf("mp4a.40.5")!==-1&&(c=!0))}),this.audioCodecSwitch=o&&c&&!Object(L.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=a.levels,this.startFragRequested=!1},v.onLevelLoading=function(d,a){var o=this.levels;if(!o||this.state!==x.State.IDLE)return;var c=o[a.level];(!c.details||c.details.live&&this.levelLastLoaded!==a.level||this.waitForCdnTuneIn(c.details))&&(this.state=x.State.WAITING_LEVEL)},v.onLevelLoaded=function(d,a){var o,c=this.levels,f=a.level,S=a.details,A=S.totalduration;if(!c){this.warn("Levels were reset while loading level "+f);return}this.log("Level "+f+" loaded ["+S.startSN+","+S.endSN+"], cc ["+S.startCC+", "+S.endCC+"] duration:"+A);var R=this.fragCurrent;R&&(this.state===x.State.FRAG_LOADING||this.state===x.State.FRAG_LOADING_WAITING_RETRY)&&(R.level!==a.level&&R.loader&&(this.state=x.State.IDLE,R.loader.abort()));var B=c[f],U=0;if(S.live||(o=B.details)!==null&&o!==void 0&&o.live){if(S.fragments[0]||(S.deltaUpdateFailed=!0),S.deltaUpdateFailed)return;U=this.alignPlaylists(S,B.details)}if(B.details=S,this.levelLastLoaded=f,this.hls.trigger(F.Events.LEVEL_UPDATED,{details:S,level:f}),this.state===x.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(S))return;this.state=x.State.IDLE}this.startFragRequested?S.live&&this.synchronizeToLiveEdge(S):this.setStartPosition(S,U),this.tick()},v._handleFragmentLoadProgress=function(d){var a,o=d.frag,c=d.part,f=d.payload,S=this.levels;if(!S){this.warn("Levels were reset while fragment load was in progress. Fragment "+o.sn+" of level "+o.level+" will not be buffered");return}var A=S[o.level],R=A.details;if(!R){this.warn("Dropping fragment "+o.sn+" of level "+o.level+" after level details were reset");return}var B=A.videoCodec,U=R.PTSKnown||!R.live,K=(a=o.initSegment)===null||a===void 0?void 0:a.data,D=this._getAudioCodec(A),H=this.transmuxer=this.transmuxer||new _.default(this.hls,w.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),V=c?c.index:-1,ne=V!==-1,ie=new s.ChunkMetadata(o.level,o.sn,o.stats.chunkCount,f.byteLength,V,ne),_e=this.initPTS[o.cc];H.push(f,K,D,B,o,c,R.totalduration,U,ie,_e)},v.onAudioTrackSwitching=function(d,a){var o=this.altAudio,c=!!a.url,f=a.id;if(!c){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var S=this.fragCurrent;S!=null&&S.loader&&(this.log("Switching to main audio track, cancel main fragment load"),S.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var A=this.hls;o&&A.trigger(F.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),A.trigger(F.Events.AUDIO_TRACK_SWITCHED,{id:f})}},v.onAudioTrackSwitched=function(d,a){var o=a.id,c=!!this.hls.audioTracks[o].url;if(c){var f=this.videoBuffer;f&&this.mediaBuffer!==f&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=f)}this.altAudio=c,this.tick()},v.onBufferCreated=function(d,a){var o=a.tracks,c,f,S=!1;for(var A in o){var R=o[A];if(R.id==="main"){if(f=A,c=R,A==="video"){var B=o[A];B&&(this.videoBuffer=B.buffer)}}else S=!0}S&&c?(this.log("Alternate track found, use "+f+".buffered to schedule main fragment loading"),this.mediaBuffer=c.buffer):this.mediaBuffer=this.media},v.onFragBuffered=function(d,a){var o=a.frag,c=a.part;if(o&&o.type!==w.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(o)){this.warn("Fragment "+o.sn+(c?" p: "+c.index:"")+" of level "+o.level+" finished buffering, but was aborted. state: "+this.state),this.state===x.State.PARSED&&(this.state=x.State.IDLE);return}var f=c?c.stats:o.stats;this.fragLastKbps=Math.round(8*f.total/(f.buffering.end-f.loading.first)),o.sn!=="initSegment"&&(this.fragPrevious=o),this.fragBufferedComplete(o,c)},v.onError=function(d,a){switch(a.details){case i.ErrorDetails.FRAG_LOAD_ERROR:case i.ErrorDetails.FRAG_LOAD_TIMEOUT:case i.ErrorDetails.KEY_LOAD_ERROR:case i.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(w.PlaylistLevelType.MAIN,a);break;case i.ErrorDetails.LEVEL_LOAD_ERROR:case i.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==x.State.ERROR&&(a.fatal?(this.warn(""+a.details),this.state=x.State.ERROR):!a.levelRetry&&this.state===x.State.WAITING_LEVEL&&(this.state=x.State.IDLE));break;case i.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="main"&&(this.state===x.State.PARSING||this.state===x.State.PARSED)){var o=!0,c=this.getFwdBufferInfo(this.media,w.PlaylistLevelType.MAIN);c&&c.len>.5&&(o=!this.reduceMaxBufferLength(c.len)),o&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},v.checkBuffer=function(){var d=this.media,a=this.gapController;if(!d||!a||!d.readyState)return;var o=N.BufferHelper.getBuffered(d);!this.loadedmetadata&&o.length?(this.loadedmetadata=!0,this.seekToStartPos()):a.poll(this.lastCurrentTime),this.lastCurrentTime=d.currentTime},v.onFragLoadEmergencyAborted=function(){this.state=x.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},v.onBufferFlushed=function(d,a){var o=a.type;if(o!==y.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var c=(o===y.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(c,o,w.PlaylistLevelType.MAIN)}},v.onLevelsUpdated=function(d,a){this.levels=a.levels},v.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},v.seekToStartPos=function(){var d=this.media,a=d.currentTime,o=this.startPosition;if(o>=0&&a<o){if(d.seeking){u.logger.log("could not seek to "+o+", already seeking at "+a);return}var c=N.BufferHelper.getBuffered(d),f=c.length?c.start(0):0,S=f-o;S>0&&(S<this.config.maxBufferHole||S<this.config.maxFragLookUpTolerance)&&(u.logger.log("adjusting start position by "+S+" to match buffer start"),o+=S,this.startPosition=o),this.log("seek to target start position "+o+" from current time "+a),d.currentTime=o}},v._getAudioCodec=function(d){var a=this.config.defaultAudioCodec||d.audioCodec;return this.audioCodecSwap&&a&&(this.log("Swapping audio codec"),a.indexOf("mp4a.40.5")!==-1?a="mp4a.40.2":a="mp4a.40.5"),a},v._loadBitrateTestFrag=function(d){var a=this;this._doFragLoad(d).then(function(o){var c=a.hls;if(!o||c.nextLoadLevel||a.fragContextChanged(d))return;a.fragLoadError=0,a.state=x.State.IDLE,a.startFragRequested=!1,a.bitrateTest=!1;var f=d.stats;f.parsing.start=f.parsing.end=f.buffering.start=f.buffering.end=self.performance.now(),c.trigger(F.Events.FRAG_LOADED,o)})},v._handleTransmuxComplete=function(d){var a,o="main",c=this.hls,f=d.remuxResult,S=d.chunkMeta,A=this.getCurrentContext(S);if(!A){this.warn("The loading context changed while buffering fragment "+S.sn+" of level "+S.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(S.level);return}var R=A.frag,B=A.part,U=A.level,K=f.video,D=f.text,H=f.id3,V=f.initSegment,ne=this.altAudio?void 0:f.audio;if(this.fragContextChanged(R))return;if(this.state=x.State.PARSING,V){V.tracks&&(this._bufferInitSegment(U,V.tracks,R,S),c.trigger(F.Events.FRAG_PARSING_INIT_SEGMENT,{frag:R,id:o,tracks:V.tracks}));var ie=V.initPTS,_e=V.timescale;Object(k.isFiniteNumber)(ie)&&(this.initPTS[R.cc]=ie,c.trigger(F.Events.INIT_PTS_FOUND,{frag:R,id:o,initPTS:ie,timescale:_e}))}if(K&&f.independent!==!1){if(U.details){var ye=K.startPTS,be=K.endPTS,we=K.startDTS,Re=K.endDTS;if(B)B.elementaryStreams[K.type]={startPTS:ye,endPTS:be,startDTS:we,endDTS:Re};else if(K.firstKeyFrame&&K.independent&&(this.couldBacktrack=!0),K.dropped&&K.independent){var ge=this.getLoadPosition()+this.config.maxBufferHole;if(ge<ye){this.backtrack(R);return}R.setElementaryStreamInfo(K.type,R.start,be,R.start,Re,!0)}R.setElementaryStreamInfo(K.type,ye,be,we,Re),this.bufferFragmentData(K,R,B,S)}}else if(f.independent===!1){this.backtrack(R);return}if(ne){var Q=ne.startPTS,Pe=ne.endPTS,$e=ne.startDTS,Fe=ne.endDTS;B&&(B.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:Q,endPTS:Pe,startDTS:$e,endDTS:Fe}),R.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,Q,Pe,$e,Fe),this.bufferFragmentData(ne,R,B,S)}if(H!=null&&(a=H.samples)!==null&&a!==void 0&&a.length){var Me={frag:R,id:o,samples:H.samples};c.trigger(F.Events.FRAG_PARSING_METADATA,Me)}if(D){var ze={frag:R,id:o,samples:D.samples};c.trigger(F.Events.FRAG_PARSING_USERDATA,ze)}},v._bufferInitSegment=function(d,a,o,c){var f=this;if(this.state!==x.State.PARSING)return;this.audioOnly=!!a.audio&&!a.video,this.altAudio&&!this.audioOnly&&delete a.audio;var S=a.audio,A=a.video,R=a.audiovideo;if(S){var B=d.audioCodec,U=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(B&&(B.indexOf("mp4a.40.5")!==-1?B="mp4a.40.2":B="mp4a.40.5"),S.metadata.channelCount!==1&&U.indexOf("firefox")===-1&&(B="mp4a.40.5")),U.indexOf("android")!==-1&&S.container!=="audio/mpeg"&&(B="mp4a.40.2",this.log("Android: force audio codec to "+B)),d.audioCodec&&d.audioCodec!==B&&this.log('Swapping manifest audio codec "'+d.audioCodec+'" for "'+B+'"'),S.levelCodec=B,S.id="main",this.log("Init audio buffer, container:"+S.container+", codecs[selected/level/parsed]=["+(B||"")+"/"+(d.audioCodec||"")+"/"+S.codec+"]")}A&&(A.levelCodec=d.videoCodec,A.id="main",this.log("Init video buffer, container:"+A.container+", codecs[level/parsed]=["+(d.videoCodec||"")+"/"+A.codec+"]")),R&&this.log("Init audiovideo buffer, container:"+R.container+", codecs[level/parsed]=["+(d.attrs.CODECS||"")+"/"+R.codec+"]"),this.hls.trigger(F.Events.BUFFER_CODECS,a),Object.keys(a).forEach(function(K){var D=a[K],H=D.initSegment;H!=null&&H.byteLength&&f.hls.trigger(F.Events.BUFFER_APPENDING,{type:K,data:H,frag:o,part:null,chunkMeta:c,parent:o.type})}),this.tick()},v.backtrack=function(d){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(d);var a=this.fragmentTracker.backtrack(d);this.fragPrevious=null,this.nextLoadPosition=d.start,a?this.resetFragmentLoading(d):this.state=x.State.BACKTRACKING},v.checkFragmentChanged=function(){var d=this.media,a=null;if(d&&d.readyState>1&&d.seeking===!1){var o=d.currentTime;if(N.BufferHelper.isBuffered(d,o)?a=this.getAppendedFrag(o):N.BufferHelper.isBuffered(d,o+.1)&&(a=this.getAppendedFrag(o+.1)),a){var c=this.fragPlaying,f=a.level;(!c||a.sn!==c.sn||c.level!==f||a.urlId!==c.urlId)&&(this.hls.trigger(F.Events.FRAG_CHANGED,{frag:a}),(!c||c.level!==f)&&this.hls.trigger(F.Events.LEVEL_SWITCHED,{level:f}),this.fragPlaying=a)}}},e(E,[{key:"nextLevel",get:function(){var d=this.nextBufferedFrag;return d?d.level:-1}},{key:"currentLevel",get:function(){var d=this.media;if(d){var a=this.getAppendedFrag(d.currentTime);if(a)return a.level}return-1}},{key:"nextBufferedFrag",get:function(){var d=this.media;if(d){var a=this.getAppendedFrag(d.currentTime);return this.followingBufferedFrag(a)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),E}(x.default)},"./src/controller/subtitle-stream-controller.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"SubtitleStreamController",function(){return t});var k=C("./src/events.ts"),x=C("./src/utils/logger.ts"),L=C("./src/utils/buffer-helper.ts"),F=C("./src/controller/fragment-finders.ts"),N=C("./src/utils/discontinuities.ts"),O=C("./src/controller/level-helper.ts"),w=C("./src/controller/fragment-tracker.ts"),y=C("./src/controller/base-stream-controller.ts"),_=C("./src/types/loader.ts"),s=C("./src/types/level.ts");function r(n,T){for(var b=0;b<T.length;b++){var g=T[b];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(n,g.key,g)}}function i(n,T,b){return T&&r(n.prototype,T),b&&r(n,b),n}function u(n,T){n.prototype=Object.create(T.prototype),n.prototype.constructor=n,l(n,T)}function l(n,T){return l=Object.setPrototypeOf||function(g,E){return g.__proto__=E,g},l(n,T)}var e=500,t=function(n){u(T,n);function T(g,E){var v;return v=n.call(this,g,E,"[subtitle-stream-controller]")||this,v.levels=[],v.currentTrackId=-1,v.tracksBuffered=[],v.mainDetails=null,v._registerListeners(),v}var b=T.prototype;return b.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},b._registerListeners=function(){var E=this.hls;E.on(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),E.on(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),E.on(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),E.on(k.Events.LEVEL_LOADED,this.onLevelLoaded,this),E.on(k.Events.ERROR,this.onError,this),E.on(k.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),E.on(k.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),E.on(k.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),E.on(k.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),E.on(k.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},b._unregisterListeners=function(){var E=this.hls;E.off(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),E.off(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),E.off(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),E.off(k.Events.LEVEL_LOADED,this.onLevelLoaded,this),E.off(k.Events.ERROR,this.onError,this),E.off(k.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),E.off(k.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),E.off(k.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),E.off(k.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),E.off(k.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},b.startLoad=function(){this.stopLoad(),this.state=y.State.IDLE,this.setInterval(e),this.tick()},b.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},b.onLevelLoaded=function(E,v){this.mainDetails=v.details},b.onSubtitleFragProcessed=function(E,v){var p=v.frag,d=v.success;if(this.fragPrevious=p,this.state=y.State.IDLE,!d)return;var a=this.tracksBuffered[this.currentTrackId];if(!a)return;for(var o,c=p.start,f=0;f<a.length;f++)if(c>=a[f].start&&c<=a[f].end){o=a[f];break}var S=p.start+p.duration;o?o.end=S:(o={start:c,end:S},a.push(o)),this.fragmentTracker.fragBuffered(p)},b.onBufferFlushing=function(E,v){var p=v.startOffset,d=v.endOffset;if(p===0&&d!==Number.POSITIVE_INFINITY){var a=this.currentTrackId,o=this.levels;if(!o.length||!o[a]||!o[a].details)return;var c=o[a].details,f=c.targetduration,S=d-f;if(S<=0)return;v.endOffsetSubtitles=Math.max(0,S),this.tracksBuffered.forEach(function(A){for(var R=0;R<A.length;){if(A[R].end<=S){A.shift();continue}else if(A[R].start<S)A[R].start=S;else break;R++}}),this.fragmentTracker.removeFragmentsInRange(p,S,_.PlaylistLevelType.SUBTITLE)}},b.onError=function(E,v){var p,d=v.frag;if(!d||d.type!==_.PlaylistLevelType.SUBTITLE)return;(p=this.fragCurrent)!==null&&p!==void 0&&p.loader&&this.fragCurrent.loader.abort(),this.state=y.State.IDLE},b.onSubtitleTracksUpdated=function(E,v){var p=this,d=v.subtitleTracks;this.tracksBuffered=[],this.levels=d.map(function(a){return new s.Level(a)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(a){p.tracksBuffered[a.id]=[]}),this.mediaBuffer=null},b.onSubtitleTrackSwitch=function(E,v){if(this.currentTrackId=v.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var p=this.levels[this.currentTrackId];p!=null&&p.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,p&&this.setInterval(e)},b.onSubtitleTrackLoaded=function(E,v){var p,d=v.details,a=v.id,o=this.currentTrackId,c=this.levels;if(!c.length)return;var f=c[o];if(a>=c.length||a!==o||!f)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,d.live||(p=f.details)!==null&&p!==void 0&&p.live){var S=this.mainDetails;if(d.deltaUpdateFailed||!S)return;var A=S.fragments[0];if(!f.details)d.hasProgramDateTime&&S.hasProgramDateTime?Object(N.alignMediaPlaylistByPDT)(d,S):A&&Object(O.addSliding)(d,A.start);else{var R=this.alignPlaylists(d,f.details);R===0&&A&&Object(O.addSliding)(d,A.start)}}if(f.details=d,this.levelLastLoaded=a,this.tick(),d.live&&!this.fragCurrent&&this.media&&this.state===y.State.IDLE){var B=Object(F.findFragmentByPTS)(null,d.fragments,this.media.currentTime,0);B||(this.warn("Subtitle playlist not aligned with playback"),f.details=void 0)}},b._handleFragmentLoadComplete=function(E){var v=E.frag,p=E.payload,d=v.decryptdata,a=this.hls;if(this.fragContextChanged(v))return;if(p&&p.byteLength>0&&d&&d.key&&d.iv&&d.method==="AES-128"){var o=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(p),d.key.buffer,d.iv.buffer).then(function(c){var f=performance.now();a.trigger(k.Events.FRAG_DECRYPTED,{frag:v,payload:c,stats:{tstart:o,tdecrypt:f}})})}},b.doTick=function(){if(!this.media){this.state=y.State.IDLE;return}if(this.state===y.State.IDLE){var E,v=this.currentTrackId,p=this.levels;if(!p.length||!p[v]||!p[v].details)return;var d=p[v].details,a=d.targetduration,o=this.config,c=this.media,f=L.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,c.currentTime-a,o.maxBufferHole),S=f.end,A=f.len,R=this.getMaxBufferLength()+a;if(A>R)return;console.assert(d,"Subtitle track details are defined on idle subtitle stream controller tick");var B=d.fragments,U=B.length,K=d.edge,D,H=this.fragPrevious;if(S<K){var V=o.maxFragLookUpTolerance;H&&d.hasProgramDateTime&&(D=Object(F.findFragmentByPDT)(B,H.endProgramDateTime,V)),D||(D=Object(F.findFragmentByPTS)(H,B,S,V),!D&&H&&H.start<B[0].start&&(D=B[0]))}else D=B[U-1];(E=D)!==null&&E!==void 0&&E.encrypted?(x.logger.log("Loading key for "+D.sn),this.state=y.State.KEY_LOADING,this.hls.trigger(k.Events.KEY_LOADING,{frag:D})):D&&this.fragmentTracker.getState(D)===w.FragmentState.NOT_LOADED&&this.loadFragment(D,d,S)}},b.loadFragment=function(E,v,p){this.fragCurrent=E,n.prototype.loadFragment.call(this,E,v,p)},i(T,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),T}(y.default)},"./src/controller/subtitle-track-controller.ts":function(pe,j,C){"use strict";C.r(j);var k=C("./src/events.ts"),x=C("./src/utils/texttrack-utils.ts"),L=C("./src/controller/base-playlist-controller.ts"),F=C("./src/types/loader.ts");function N(r,i){for(var u=0;u<i.length;u++){var l=i[u];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(r,l.key,l)}}function O(r,i,u){return i&&N(r.prototype,i),u&&N(r,u),r}function w(r,i){r.prototype=Object.create(i.prototype),r.prototype.constructor=r,y(r,i)}function y(r,i){return y=Object.setPrototypeOf||function(l,e){return l.__proto__=e,l},y(r,i)}var _=function(r){w(i,r);function i(l){var e;return e=r.call(this,l,"[subtitle-track-controller]")||this,e.media=null,e.tracks=[],e.groupId=null,e.tracksInGroup=[],e.trackId=-1,e.selectDefaultTrack=!0,e.queuedDefaultTrack=-1,e.trackChangeListener=function(){return e.onTextTracksChanged()},e.asyncPollTrackChange=function(){return e.pollTrackChange(0)},e.useTextTrackPolling=!1,e.subtitlePollingInterval=-1,e.subtitleDisplay=!0,e.registerListeners(),e}var u=i.prototype;return u.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,r.prototype.destroy.call(this)},u.registerListeners=function(){var e=this.hls;e.on(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(k.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(k.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(k.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(k.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(k.Events.ERROR,this.onError,this)},u.unregisterListeners=function(){var e=this.hls;e.off(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(k.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(k.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(k.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(k.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(k.Events.ERROR,this.onError,this)},u.onMediaAttached=function(e,t){if(this.media=t.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},u.pollTrackChange=function(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,e)},u.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var e=s(this.media.textTracks);e.forEach(function(t){Object(x.clearCurrentCues)(t)}),this.subtitleTrack=-1,this.media=null},u.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},u.onManifestParsed=function(e,t){this.tracks=t.subtitleTracks},u.onSubtitleTrackLoaded=function(e,t){var n=t.id,T=t.details,b=this.trackId,g=this.tracksInGroup[b];if(!g){this.warn("Invalid subtitle track id "+n);return}var E=g.details;g.details=t.details,this.log("subtitle track "+n+" loaded ["+T.startSN+"-"+T.endSN+"]"),n===this.trackId&&(this.retryCount=0,this.playlistLoaded(n,t,E))},u.onLevelLoading=function(e,t){this.switchLevel(t.level)},u.onLevelSwitching=function(e,t){this.switchLevel(t.level)},u.switchLevel=function(e){var t=this.hls.levels[e];if(!(t!=null&&t.textGroupIds))return;var n=t.textGroupIds[t.urlId];if(this.groupId!==n){var T=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,b=this.tracks.filter(function(v){return!n||v.groupId===n});this.tracksInGroup=b;var g=this.findTrackId(T==null?void 0:T.name)||this.findTrackId();this.groupId=n;var E={subtitleTracks:b};this.log("Updating subtitle tracks, "+b.length+' track(s) found in "'+n+'" group-id'),this.hls.trigger(k.Events.SUBTITLE_TRACKS_UPDATED,E),g!==-1&&this.setSubtitleTrack(g,T)}},u.findTrackId=function(e){for(var t=this.tracksInGroup,n=0;n<t.length;n++){var T=t[n];if((!this.selectDefaultTrack||T.default)&&(!e||e===T.name))return T.id}return-1},u.onError=function(e,t){if(r.prototype.onError.call(this,e,t),t.fatal||!t.context)return;t.context.type===F.PlaylistContextType.SUBTITLE_TRACK&&t.context.id===this.trackId&&t.context.groupId===this.groupId&&this.retryLoadingOrFail(t)},u.loadPlaylist=function(e){var t=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(t)){var n=t.id,T=t.groupId,b=t.url;if(e)try{b=e.addDirectives(b)}catch(g){this.warn("Could not construct new URL with HLS Delivery Directives: "+g)}this.log("Loading subtitle playlist for id "+n),this.hls.trigger(k.Events.SUBTITLE_TRACK_LOADING,{url:b,id:n,groupId:T,deliveryDirectives:e||null})}},u.toggleTrackModes=function(e){var t=this,n=this.media,T=this.subtitleDisplay,b=this.trackId;if(!n)return;var g=s(n.textTracks),E=g.filter(function(d){return d.groupId===t.groupId});if(e===-1)[].slice.call(g).forEach(function(d){d.mode="disabled"});else{var v=E[b];v&&(v.mode="disabled")}var p=E[e];p&&(p.mode=T?"showing":"hidden")},u.setSubtitleTrack=function(e,t){var n,T=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(this.trackId!==e&&this.toggleTrackModes(e),this.trackId===e&&(e===-1||(n=T[e])!==null&&n!==void 0&&n.details)||e<-1||e>=T.length)return;this.clearTimer();var b=T[e];if(this.log("Switching to subtitle track "+e),this.trackId=e,b){var g=b.id,E=b.groupId,v=E===void 0?"":E,p=b.name,d=b.type,a=b.url;this.hls.trigger(k.Events.SUBTITLE_TRACK_SWITCH,{id:g,groupId:v,name:p,type:d,url:a});var o=this.switchParams(b.url,t==null?void 0:t.details);this.loadPlaylist(o)}else this.hls.trigger(k.Events.SUBTITLE_TRACK_SWITCH,{id:e})},u.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var e=-1,t=s(this.media.textTracks),n=0;n<t.length;n++)if(t[n].mode==="hidden")e=n;else if(t[n].mode==="showing"){e=n;break}this.subtitleTrack!==e&&(this.subtitleTrack=e)},O(i,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(e){this.selectDefaultTrack=!1;var t=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(e,t)}}]),i}(L.default);function s(r){for(var i=[],u=0;u<r.length;u++){var l=r[u];l.kind==="subtitles"&&l.label&&i.push(r[u])}return i}j.default=_},"./src/controller/timeline-controller.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"TimelineController",function(){return s});var k=C("./src/polyfills/number.ts"),x=C("./src/events.ts"),L=C("./src/utils/cea-608-parser.ts"),F=C("./src/utils/output-filter.ts"),N=C("./src/utils/webvtt-parser.ts"),O=C("./src/utils/texttrack-utils.ts"),w=C("./src/utils/imsc1-ttml-parser.ts"),y=C("./src/types/loader.ts"),_=C("./src/utils/logger.ts"),s=function(){function l(t){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=u(),this.captionsProperties=void 0,this.hls=t,this.config=t.config,this.Cues=t.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var n=new F.default(this,"textTrack1"),T=new F.default(this,"textTrack2"),b=new F.default(this,"textTrack3"),g=new F.default(this,"textTrack4");this.cea608Parser1=new L.default(1,n,T),this.cea608Parser2=new L.default(3,b,g)}t.on(x.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(x.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(x.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(x.Events.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(x.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(x.Events.FRAG_LOADING,this.onFragLoading,this),t.on(x.Events.FRAG_LOADED,this.onFragLoaded,this),t.on(x.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.on(x.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),t.on(x.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(x.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.on(x.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var e=l.prototype;return e.destroy=function(){var n=this.hls;n.off(x.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),n.off(x.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.off(x.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.off(x.Events.MANIFEST_LOADED,this.onManifestLoaded,this),n.off(x.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),n.off(x.Events.FRAG_LOADING,this.onFragLoading,this),n.off(x.Events.FRAG_LOADED,this.onFragLoaded,this),n.off(x.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),n.off(x.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),n.off(x.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),n.off(x.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),n.off(x.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},e.addCues=function(n,T,b,g,E){for(var v=!1,p=E.length;p--;){var d=E[p],a=i(d[0],d[1],T,b);if(a>=0&&(d[0]=Math.min(d[0],T),d[1]=Math.max(d[1],b),v=!0,a/(b-T)>.5))return}if(v||E.push([T,b]),this.config.renderTextTracksNatively){var o=this.captionsTracks[n];this.Cues.newCue(o,T,b,g)}else{var c=this.Cues.newCue(null,T,b,g);this.hls.trigger(x.Events.CUES_PARSED,{type:"captions",cues:c,track:n})}},e.onInitPtsFound=function(n,T){var b=this,g=T.frag,E=T.id,v=T.initPTS,p=T.timescale,d=this.unparsedVttFrags;E==="main"&&(this.initPTS[g.cc]=v,this.timescale[g.cc]=p),d.length&&(this.unparsedVttFrags=[],d.forEach(function(a){b.onFragLoaded(x.Events.FRAG_LOADED,a)}))},e.getExistingTrack=function(n){var T=this.media;if(T)for(var b=0;b<T.textTracks.length;b++){var g=T.textTracks[b];if(g[n])return g}return null},e.createCaptionsTrack=function(n){this.config.renderTextTracksNatively?this.createNativeTrack(n):this.createNonNativeTrack(n)},e.createNativeTrack=function(n){if(this.captionsTracks[n])return;var T=this.captionsProperties,b=this.captionsTracks,g=this.media,E=T[n],v=E.label,p=E.languageCode,d=this.getExistingTrack(n);if(d)b[n]=d,Object(O.clearCurrentCues)(b[n]),Object(O.sendAddTrackEvent)(b[n],g);else{var a=this.createTextTrack("captions",v,p);a&&(a[n]=!0,b[n]=a)}},e.createNonNativeTrack=function(n){if(this.nonNativeCaptionsTracks[n])return;var T=this.captionsProperties[n];if(!T)return;var b=T.label,g={_id:n,label:b,kind:"captions",default:T.media?!!T.media.default:!1,closedCaptions:T.media};this.nonNativeCaptionsTracks[n]=g,this.hls.trigger(x.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[g]})},e.createTextTrack=function(n,T,b){var g=this.media;return g?g.addTextTrack(n,T,b):void 0},e.onMediaAttaching=function(n,T){this.media=T.media,this._cleanTracks()},e.onMediaDetaching=function(){var n=this.captionsTracks;Object.keys(n).forEach(function(T){Object(O.clearCurrentCues)(n[T]),delete n[T]}),this.nonNativeCaptionsTracks={}},e.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=u(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},e._cleanTracks=function(){var n=this.media;if(!n)return;var T=n.textTracks;if(T)for(var b=0;b<T.length;b++)Object(O.clearCurrentCues)(T[b])},e.onSubtitleTracksUpdated=function(n,T){var b=this;this.textTracks=[];var g=T.subtitleTracks||[],E=g.some(function(a){return a.textCodec===w.IMSC1_CODEC});if(this.config.enableWebVTT||E&&this.config.enableIMSC1){var v=this.tracks&&g&&this.tracks.length===g.length;if(this.tracks=g||[],this.config.renderTextTracksNatively){var p=this.media?this.media.textTracks:[];this.tracks.forEach(function(a,o){var c;if(o<p.length){for(var f=null,S=0;S<p.length;S++)if(r(p[S],a)){f=p[S];break}f&&(c=f)}c?Object(O.clearCurrentCues)(c):(c=b.createTextTrack("subtitles",a.name,a.lang),c&&(c.mode="disabled")),c&&(c.groupId=a.groupId,b.textTracks.push(c))})}else if(!v&&this.tracks&&this.tracks.length){var d=this.tracks.map(function(a){return{label:a.name,kind:a.type.toLowerCase(),default:a.default,subtitleTrack:a}});this.hls.trigger(x.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:d})}}},e.onManifestLoaded=function(n,T){var b=this;this.config.enableCEA708Captions&&T.captions&&T.captions.forEach(function(g){var E=/(?:CC|SERVICE)([1-4])/.exec(g.instreamId);if(!E)return;var v="textTrack"+E[1],p=b.captionsProperties[v];if(!p)return;p.label=g.name,g.lang&&(p.languageCode=g.lang),p.media=g})},e.onFragLoading=function(n,T){var b=this.cea608Parser1,g=this.cea608Parser2,E=this.lastSn,v=this.lastPartIndex;if(!this.enabled||!(b&&g))return;if(T.frag.type===y.PlaylistLevelType.MAIN){var p,d,a=T.frag.sn,o=(p=T==null||((d=T.part)===null||d===void 0)?void 0:d.index)!=null?p:-1;a===E+1||a===E&&o===v+1||(b.reset(),g.reset()),this.lastSn=a,this.lastPartIndex=o}},e.onFragLoaded=function(n,T){var b=T.frag,g=T.payload,E=this.initPTS,v=this.unparsedVttFrags;if(b.type===y.PlaylistLevelType.SUBTITLE)if(g.byteLength){if(!Object(k.isFiniteNumber)(E[b.cc])){v.push(T),E.length&&this.hls.trigger(x.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:b,error:new Error("Missing initial subtitle PTS")});return}var p=b.decryptdata;if(p==null||p.key==null||p.method!=="AES-128"){var d=this.tracks[b.level],a=this.vttCCs;a[b.cc]||(a[b.cc]={start:b.start,prevCC:this.prevCC,new:!0},this.prevCC=b.cc),d&&d.textCodec===w.IMSC1_CODEC?this._parseIMSC1(b,g):this._parseVTTs(b,g,a)}}else this.hls.trigger(x.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:b,error:new Error("Empty subtitle payload")})},e._parseIMSC1=function(n,T){var b=this,g=this.hls;Object(w.parseIMSC1)(T,this.initPTS[n.cc],this.timescale[n.cc],function(E){b._appendCues(E,n.level),g.trigger(x.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:n})},function(E){_.logger.log("Failed to parse IMSC1: "+E),g.trigger(x.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:E})})},e._parseVTTs=function(n,T,b){var g=this,E=this.hls;Object(N.parseWebVTT)(T,this.initPTS[n.cc],this.timescale[n.cc],b,n.cc,n.start,function(v){g._appendCues(v,n.level),E.trigger(x.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:n})},function(v){g._fallbackToIMSC1(n,T),_.logger.log("Failed to parse VTT cue: "+v),E.trigger(x.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:v})})},e._fallbackToIMSC1=function(n,T){var b=this,g=this.tracks[n.level];g.textCodec||Object(w.parseIMSC1)(T,this.initPTS[n.cc],this.timescale[n.cc],function(){g.textCodec=w.IMSC1_CODEC,b._parseIMSC1(n,T)},function(){g.textCodec="wvtt"})},e._appendCues=function(n,T){var b=this.hls;if(this.config.renderTextTracksNatively){var g=this.textTracks[T];if(g.mode==="disabled")return;n.forEach(function(p){return Object(O.addCueToTrack)(g,p)})}else{var E=this.tracks[T],v=E.default?"default":"subtitles"+T;b.trigger(x.Events.CUES_PARSED,{type:"subtitles",cues:n,track:v})}},e.onFragDecrypted=function(n,T){var b=T.frag;if(b.type===y.PlaylistLevelType.SUBTITLE){if(!Object(k.isFiniteNumber)(this.initPTS[b.cc])){this.unparsedVttFrags.push(T);return}this.onFragLoaded(x.Events.FRAG_LOADED,T)}},e.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},e.onFragParsingUserdata=function(n,T){var b=this.cea608Parser1,g=this.cea608Parser2;if(!this.enabled||!(b&&g))return;for(var E=0;E<T.samples.length;E++){var v=T.samples[E].bytes;if(v){var p=this.extractCea608Data(v);b.addData(T.samples[E].pts,p[0]),g.addData(T.samples[E].pts,p[1])}}},e.onBufferFlushing=function(n,T){var b=T.startOffset,g=T.endOffset,E=T.endOffsetSubtitles,v=T.type,p=this.media;if(!p||p.currentTime<g)return;if(!v||v==="video"){var d=this.captionsTracks;Object.keys(d).forEach(function(o){return Object(O.removeCuesInRange)(d[o],b,g)})}if(this.config.renderTextTracksNatively&&(b===0&&E!==void 0)){var a=this.textTracks;Object.keys(a).forEach(function(o){return Object(O.removeCuesInRange)(a[o],b,E)})}},e.extractCea608Data=function(n){for(var T=n[0]&31,b=2,g=[[],[]],E=0;E<T;E++){var v=n[b++],p=127&n[b++],d=127&n[b++],a=(4&v)!==0,o=3&v;if(p===0&&d===0)continue;a&&((o===0||o===1)&&(g[o].push(p),g[o].push(d)))}return g},l}();function r(l,e){return l&&l.label===e.name&&!(l.textTrack1||l.textTrack2)}function i(l,e,t,n){return Math.min(e,n)-Math.max(l,t)}function u(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"default",function(){return k});var k=function(){function x(F,N){this.subtle=void 0,this.aesIV=void 0,this.subtle=F,this.aesIV=N}var L=x.prototype;return L.decrypt=function(N,O){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},O,N)},x}()},"./src/crypt/aes-decryptor.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"removePadding",function(){return x}),C.d(j,"default",function(){return L});var k=C("./src/utils/typed-array.ts");function x(F){var N=F.byteLength,O=N&&new DataView(F.buffer).getUint8(N-1);return O?Object(k.sliceUint8)(F,0,N-O):F}var L=function(){function F(){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 N=F.prototype;return N.uint8ArrayToUint32Array_=function(w){for(var y=new DataView(w),_=new Uint32Array(4),s=0;s<4;s++)_[s]=y.getUint32(s*4);return _},N.initTable=function(){var w=this.sBox,y=this.invSBox,_=this.subMix,s=_[0],r=_[1],i=_[2],u=_[3],l=this.invSubMix,e=l[0],t=l[1],n=l[2],T=l[3],b=new Uint32Array(256),g=0,E=0,v=0;for(v=0;v<256;v++)v<128?b[v]=v<<1:b[v]=v<<1^283;for(v=0;v<256;v++){var p=E^E<<1^E<<2^E<<3^E<<4;p=p>>>8^p&255^99,w[g]=p,y[p]=g;var d=b[g],a=b[d],o=b[a],c=b[p]*257^p*16843008;s[g]=c<<24|c>>>8,r[g]=c<<16|c>>>16,i[g]=c<<8|c>>>24,u[g]=c,c=o*16843009^a*65537^d*257^g*16843008,e[p]=c<<24|c>>>8,t[p]=c<<16|c>>>16,n[p]=c<<8|c>>>24,T[p]=c,g?(g=d^b[b[b[o^d]]],E^=b[b[E]]):g=E=1}},N.expandKey=function(w){for(var y=this.uint8ArrayToUint32Array_(w),_=!0,s=0;s<y.length&&_;)_=y[s]===this.key[s],s++;if(_)return;this.key=y;var r=this.keySize=y.length;if(r!==4&&r!==6&&r!==8)throw new Error("Invalid aes key size="+r);var i=this.ksRows=(r+6+1)*4,u,l,e=this.keySchedule=new Uint32Array(i),t=this.invKeySchedule=new Uint32Array(i),n=this.sBox,T=this.rcon,b=this.invSubMix,g=b[0],E=b[1],v=b[2],p=b[3],d,a;for(u=0;u<i;u++){if(u<r){d=e[u]=y[u];continue}a=d,u%r===0?(a=a<<8|a>>>24,a=n[a>>>24]<<24|n[a>>>16&255]<<16|n[a>>>8&255]<<8|n[a&255],a^=T[u/r|0]<<24):r>6&&u%r===4&&(a=n[a>>>24]<<24|n[a>>>16&255]<<16|n[a>>>8&255]<<8|n[a&255]),e[u]=d=(e[u-r]^a)>>>0}for(l=0;l<i;l++)u=i-l,l&3?a=e[u]:a=e[u-4],l<4||u<=4?t[l]=a:t[l]=g[n[a>>>24]]^E[n[a>>>16&255]]^v[n[a>>>8&255]]^p[n[a&255]],t[l]=t[l]>>>0},N.networkToHostOrderSwap=function(w){return w<<24|(w&65280)<<8|(w&16711680)>>8|w>>>24},N.decrypt=function(w,y,_){for(var s=this.keySize+6,r=this.invKeySchedule,i=this.invSBox,u=this.invSubMix,l=u[0],e=u[1],t=u[2],n=u[3],T=this.uint8ArrayToUint32Array_(_),b=T[0],g=T[1],E=T[2],v=T[3],p=new Int32Array(w),d=new Int32Array(p.length),a,o,c,f,S,A,R,B,U,K,D,H,V,ne,ie=this.networkToHostOrderSwap;y<p.length;){for(U=ie(p[y]),K=ie(p[y+1]),D=ie(p[y+2]),H=ie(p[y+3]),S=U^r[0],A=H^r[1],R=D^r[2],B=K^r[3],V=4,ne=1;ne<s;ne++)a=l[S>>>24]^e[A>>16&255]^t[R>>8&255]^n[B&255]^r[V],o=l[A>>>24]^e[R>>16&255]^t[B>>8&255]^n[S&255]^r[V+1],c=l[R>>>24]^e[B>>16&255]^t[S>>8&255]^n[A&255]^r[V+2],f=l[B>>>24]^e[S>>16&255]^t[A>>8&255]^n[R&255]^r[V+3],S=a,A=o,R=c,B=f,V=V+4;a=i[S>>>24]<<24^i[A>>16&255]<<16^i[R>>8&255]<<8^i[B&255]^r[V],o=i[A>>>24]<<24^i[R>>16&255]<<16^i[B>>8&255]<<8^i[S&255]^r[V+1],c=i[R>>>24]<<24^i[B>>16&255]<<16^i[S>>8&255]<<8^i[A&255]^r[V+2],f=i[B>>>24]<<24^i[S>>16&255]<<16^i[A>>8&255]<<8^i[R&255]^r[V+3],d[y]=ie(a^b),d[y+1]=ie(f^g),d[y+2]=ie(c^E),d[y+3]=ie(o^v),b=U,g=K,E=D,v=H,y=y+4}return d.buffer},F}()},"./src/crypt/decrypter.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"default",function(){return y});var k=C("./src/crypt/aes-crypto.ts"),x=C("./src/crypt/fast-aes-key.ts"),L=C("./src/crypt/aes-decryptor.ts"),F=C("./src/utils/logger.ts"),N=C("./src/utils/mp4-tools.ts"),O=C("./src/utils/typed-array.ts"),w=16,y=function(){function _(r,i,u){var l=u===void 0?{}:u,e=l.removePKCS7Padding,t=e===void 0?!0:e;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=r,this.config=i,this.removePKCS7Padding=t,t)try{var n=self.crypto;n&&(this.subtle=n.subtle||n.webkitSubtle)}catch(T){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var s=_.prototype;return s.destroy=function(){this.observer=null},s.isSync=function(){return this.config.enableSoftwareAES},s.flush=function(){var i=this.currentResult;if(!i){this.reset();return}var u=new Uint8Array(i);return this.reset(),this.removePKCS7Padding?Object(L.removePadding)(u):u},s.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},s.decrypt=function(i,u,l,e){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(i),u,l);var t=this.flush();t&&e(t.buffer)}else this.webCryptoDecrypt(new Uint8Array(i),u,l).then(e)},s.softwareDecrypt=function(i,u,l){var e=this.currentIV,t=this.currentResult,n=this.remainderData;this.logOnce("JS AES decrypt"),n&&(i=Object(N.appendUint8Array)(n,i),this.remainderData=null);var T=this.getValidChunk(i);if(!T.length)return null;e&&(l=e);var b=this.softwareDecrypter;b||(b=this.softwareDecrypter=new L.default),b.expandKey(u);var g=t;return this.currentResult=b.decrypt(T.buffer,0,l),this.currentIV=Object(O.sliceUint8)(T,-16).buffer,g||null},s.webCryptoDecrypt=function(i,u,l){var e=this,t=this.subtle;return(this.key!==u||!this.fastAesKey)&&(this.key=u,this.fastAesKey=new x.default(t,u)),this.fastAesKey.expandKey().then(function(n){if(!t)return Promise.reject(new Error("web crypto not initialized"));var T=new k.default(t,l);return T.decrypt(i.buffer,n)}).catch(function(n){return e.onWebCryptoError(n,i,u,l)})},s.onWebCryptoError=function(i,u,l,e){return F.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",i),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(u,l,e)},s.getValidChunk=function(i){var u=i,l=i.length-i.length%w;return l!==i.length&&(u=Object(O.sliceUint8)(i,0,l),this.remainderData=Object(O.sliceUint8)(i,l)),u},s.logOnce=function(i){if(!this.logEnabled)return;F.logger.log("[decrypter.ts]: "+i),this.logEnabled=!1},_}()},"./src/crypt/fast-aes-key.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"default",function(){return k});var k=function(){function x(F,N){this.subtle=void 0,this.key=void 0,this.subtle=F,this.key=N}var L=x.prototype;return L.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},x}()},"./src/demux/aacdemuxer.ts":function(pe,j,C){"use strict";C.r(j);var k=C("./src/demux/base-audio-demuxer.ts"),x=C("./src/demux/adts.ts"),L=C("./src/utils/logger.ts"),F=C("./src/demux/id3.ts");function N(y,_){y.prototype=Object.create(_.prototype),y.prototype.constructor=y,O(y,_)}function O(y,_){return O=Object.setPrototypeOf||function(r,i){return r.__proto__=i,r},O(y,_)}var w=function(y){N(_,y);function _(r,i){var u;return u=y.call(this)||this,u.observer=void 0,u.config=void 0,u.observer=r,u.config=i,u}var s=_.prototype;return s.resetInitSegment=function(i,u,l){y.prototype.resetInitSegment.call(this,i,u,l),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:i,duration:l,inputTimeScale:9e4,dropped:0}},_.probe=function(i){if(!i)return!1;for(var u=F.getID3Data(i,0)||[],l=u.length,e=i.length;l<e;l++)if(x.probe(i,l))return L.logger.log("ADTS sync word found !"),!0;return!1},s.canParse=function(i,u){return x.canParse(i,u)},s.appendFrame=function(i,u,l){x.initTrackConfig(i,this.observer,u,l,i.manifestCodec);var e=x.appendFrame(i,u,l,this.initPTS,this.frameIndex);if(e&&e.missing===0)return e},_}(k.default);w.minProbeByteLength=9,j.default=w},"./src/demux/adts.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"getAudioConfig",function(){return F}),C.d(j,"isHeaderPattern",function(){return N}),C.d(j,"getHeaderLength",function(){return O}),C.d(j,"getFullFrameLength",function(){return w}),C.d(j,"canGetFrameLength",function(){return y}),C.d(j,"isHeader",function(){return _}),C.d(j,"canParse",function(){return s}),C.d(j,"probe",function(){return r}),C.d(j,"initTrackConfig",function(){return i}),C.d(j,"getFrameDuration",function(){return u}),C.d(j,"parseFrameHeader",function(){return l}),C.d(j,"appendFrame",function(){return e});var k=C("./src/utils/logger.ts"),x=C("./src/errors.ts"),L=C("./src/events.ts");function F(t,n,T,b){var g,E,v,p,d=navigator.userAgent.toLowerCase(),a=b,o=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];g=((n[T+2]&192)>>>6)+1;var c=(n[T+2]&60)>>>2;if(c>o.length-1){t.trigger(L.Events.ERROR,{type:x.ErrorTypes.MEDIA_ERROR,details:x.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+c});return}return v=(n[T+2]&1)<<2,v|=(n[T+3]&192)>>>6,k.logger.log("manifest codec:"+b+", ADTS type:"+g+", samplingIndex:"+c),/firefox/i.test(d)?c>=6?(g=5,p=new Array(4),E=c-3):(g=2,p=new Array(2),E=c):d.indexOf("android")!==-1?(g=2,p=new Array(2),E=c):(g=5,p=new Array(4),b&&(b.indexOf("mp4a.40.29")!==-1||b.indexOf("mp4a.40.5")!==-1)||!b&&c>=6?E=c-3:((b&&b.indexOf("mp4a.40.2")!==-1&&(c>=6&&v===1||/vivaldi/i.test(d))||!b&&v===1)&&(g=2,p=new Array(2)),E=c)),p[0]=g<<3,p[0]|=(c&14)>>1,p[1]|=(c&1)<<7,p[1]|=v<<3,g===5&&(p[1]|=(E&14)>>1,p[2]=(E&1)<<7,p[2]|=2<<2,p[3]=0),{config:p,samplerate:o[c],channelCount:v,codec:"mp4a.40."+g,manifestCodec:a}}function N(t,n){return t[n]===255&&(t[n+1]&246)===240}function O(t,n){return t[n+1]&1?7:9}function w(t,n){return(t[n+3]&3)<<11|t[n+4]<<3|(t[n+5]&224)>>>5}function y(t,n){return n+5<t.length}function _(t,n){return n+1<t.length&&N(t,n)}function s(t,n){return y(t,n)&&N(t,n)&&w(t,n)<=t.length-n}function r(t,n){if(_(t,n)){var T=O(t,n);if(n+T>=t.length)return!1;var b=w(t,n);if(b<=T)return!1;var g=n+b;return g===t.length||_(t,g)}return!1}function i(t,n,T,b,g){if(!t.samplerate){var E=F(n,T,b,g);if(!E)return;t.config=E.config,t.samplerate=E.samplerate,t.channelCount=E.channelCount,t.codec=E.codec,t.manifestCodec=E.manifestCodec,k.logger.log("parsed codec:"+t.codec+", rate:"+E.samplerate+", channels:"+E.channelCount)}}function u(t){return 1024*9e4/t}function l(t,n,T,b,g){var E=O(t,n),v=w(t,n);if(v-=E,v>0){var p=T+b*g;return{headerLength:E,frameLength:v,stamp:p}}}function e(t,n,T,b,g){var E=u(t.samplerate),v=l(n,T,b,g,E);if(v){var p=v.frameLength,d=v.headerLength,a=v.stamp,o=d+p,c=Math.max(0,T+o-n.length),f;c?(f=new Uint8Array(o-d),f.set(n.subarray(T+d,n.length),0)):f=n.subarray(T+d,T+o);var S={unit:f,pts:a};return c||t.samples.push(S),{sample:S,length:o,missing:c}}}},"./src/demux/base-audio-demuxer.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"initPTSFn",function(){return w});var k=C("./src/polyfills/number.ts"),x=C("./src/demux/id3.ts"),L=C("./src/demux/dummy-demuxed-track.ts"),F=C("./src/utils/mp4-tools.ts"),N=C("./src/utils/typed-array.ts"),O=function(){function y(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var _=y.prototype;return _.resetInitSegment=function(r,i,u){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},_.resetTimeStamp=function(){},_.resetContiguity=function(){},_.canParse=function(r,i){return!1},_.appendFrame=function(r,i,u){},_.demux=function(r,i){this.cachedData&&(r=Object(F.appendUint8Array)(this.cachedData,r),this.cachedData=null);var u=x.getID3Data(r,0),l=u?u.length:0,e,t,n=this._audioTrack,T=this._id3Track,b=u?x.getTimeStamp(u):void 0,g=r.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=w(b,i)),u&&u.length>0&&T.samples.push({pts:this.initPTS,dts:this.initPTS,data:u}),t=this.initPTS;l<g;){if(this.canParse(r,l)){var E=this.appendFrame(n,r,l);E?(this.frameIndex++,t=E.sample.pts,l+=E.length,e=l):l=g}else x.canParse(r,l)?(u=x.getID3Data(r,l),T.samples.push({pts:t,dts:t,data:u}),l+=u.length,e=l):l++;if(l===g&&e!==g){var v=Object(N.sliceUint8)(r,e);this.cachedData?this.cachedData=Object(F.appendUint8Array)(this.cachedData,v):this.cachedData=v}}return{audioTrack:n,avcTrack:Object(L.dummyTrack)(),id3Track:T,textTrack:Object(L.dummyTrack)()}},_.demuxSampleAes=function(r,i,u){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},_.flush=function(r){var i=this.cachedData;return i&&(this.cachedData=null,this.demux(i,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(L.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(L.dummyTrack)()}},_.destroy=function(){},y}(),w=function(_,s){return Object(k.isFiniteNumber)(_)?_*90:s*9e4};j.default=O},"./src/demux/chunk-cache.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"default",function(){return k});var k=function(){function L(){this.chunks=[],this.dataLength=0}var F=L.prototype;return F.push=function(O){this.chunks.push(O),this.dataLength+=O.length},F.flush=function(){var O=this.chunks,w=this.dataLength,y;if(O.length)O.length===1?y=O[0]:y=x(O,w);else return new Uint8Array(0);return this.reset(),y},F.reset=function(){this.chunks.length=0,this.dataLength=0},L}();function x(L,F){for(var N=new Uint8Array(F),O=0,w=0;w<L.length;w++){var y=L[w];N.set(y,O),O+=y.length}return N}},"./src/demux/dummy-demuxed-track.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"dummyTrack",function(){return k});function k(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(pe,j,C){"use strict";C.r(j);var k=C("./src/utils/logger.ts"),x=function(){function L(N){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=N,this.bytesAvailable=N.byteLength,this.word=0,this.bitsAvailable=0}var F=L.prototype;return F.loadWord=function(){var O=this.data,w=this.bytesAvailable,y=O.byteLength-w,_=new Uint8Array(4),s=Math.min(4,w);if(s===0)throw new Error("no bytes available");_.set(O.subarray(y,y+s)),this.word=new DataView(_.buffer).getUint32(0),this.bitsAvailable=s*8,this.bytesAvailable-=s},F.skipBits=function(O){var w;this.bitsAvailable>O?(this.word<<=O,this.bitsAvailable-=O):(O-=this.bitsAvailable,w=O>>3,O-=w>>3,this.bytesAvailable-=w,this.loadWord(),this.word<<=O,this.bitsAvailable-=O)},F.readBits=function(O){var w=Math.min(this.bitsAvailable,O),y=this.word>>>32-w;return O>32&&k.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=O-w,w>0&&this.bitsAvailable?y<<w|this.readBits(w):y},F.skipLZ=function(){var O;for(O=0;O<this.bitsAvailable;++O)if((this.word&2147483648>>>O)!==0)return this.word<<=O,this.bitsAvailable-=O,O;return this.loadWord(),O+this.skipLZ()},F.skipUEG=function(){this.skipBits(1+this.skipLZ())},F.skipEG=function(){this.skipBits(1+this.skipLZ())},F.readUEG=function(){var O=this.skipLZ();return this.readBits(O+1)-1},F.readEG=function(){var O=this.readUEG();return 1&O?1+O>>>1:-1*(O>>>1)},F.readBoolean=function(){return this.readBits(1)===1},F.readUByte=function(){return this.readBits(8)},F.readUShort=function(){return this.readBits(16)},F.readUInt=function(){return this.readBits(32)},F.skipScalingList=function(O){for(var w=8,y=8,_,s=0;s<O;s++)y!==0&&(_=this.readEG(),y=(w+_+256)%256),w=y===0?w:y},F.readSPS=function(){var O=0,w=0,y=0,_=0,s,r,i,u=this.readUByte.bind(this),l=this.readBits.bind(this),e=this.readUEG.bind(this),t=this.readBoolean.bind(this),n=this.skipBits.bind(this),T=this.skipEG.bind(this),b=this.skipUEG.bind(this),g=this.skipScalingList.bind(this);u();var E=u();if(l(5),n(3),u(),b(),E===100||E===110||E===122||E===244||E===44||E===83||E===86||E===118||E===128){var v=e();if(v===3&&n(1),b(),b(),n(1),t())for(r=v!==3?8:12,i=0;i<r;i++)t()&&(i<6?g(16):g(64))}b();var p=e();if(p===0)e();else if(p===1)for(n(1),T(),T(),s=e(),i=0;i<s;i++)T();b(),n(1);var d=e(),a=e(),o=l(1);o===0&&n(1),n(1),t()&&(O=e(),w=e(),y=e(),_=e());var c=[1,1];if(t()&&t()){var f=u();switch(f){case 1:c=[1,1];break;case 2:c=[12,11];break;case 3:c=[10,11];break;case 4:c=[16,11];break;case 5:c=[40,33];break;case 6:c=[24,11];break;case 7:c=[20,11];break;case 8:c=[32,11];break;case 9:c=[80,33];break;case 10:c=[18,11];break;case 11:c=[15,11];break;case 12:c=[64,33];break;case 13:c=[160,99];break;case 14:c=[4,3];break;case 15:c=[3,2];break;case 16:c=[2,1];break;case 255:{c=[u()<<8|u(),u()<<8|u()];break}}}return{width:Math.ceil((d+1)*16-O*2-w*2),height:(2-o)*(a+1)*16-(o?2:4)*(y+_),pixelRatio:c}},F.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},L}();j.default=x},"./src/demux/id3.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"isHeader",function(){return k}),C.d(j,"isFooter",function(){return x}),C.d(j,"getID3Data",function(){return L}),C.d(j,"canParse",function(){return N}),C.d(j,"getTimeStamp",function(){return O}),C.d(j,"isTimeStampFrame",function(){return w}),C.d(j,"getID3Frames",function(){return _}),C.d(j,"decodeFrame",function(){return s}),C.d(j,"utf8ArrayToStr",function(){return e}),C.d(j,"testables",function(){return t});var k=function(g,E){return E+10<=g.length&&(g[E]===73&&g[E+1]===68&&g[E+2]===51&&(g[E+3]<255&&g[E+4]<255&&(g[E+6]<128&&g[E+7]<128&&g[E+8]<128&&g[E+9]<128)))},x=function(g,E){return E+10<=g.length&&(g[E]===51&&g[E+1]===68&&g[E+2]===73&&(g[E+3]<255&&g[E+4]<255&&(g[E+6]<128&&g[E+7]<128&&g[E+8]<128&&g[E+9]<128)))},L=function(g,E){for(var v=E,p=0;k(g,E);){p+=10;var d=F(g,E+6);p+=d,x(g,E+10)&&(p+=10),E+=p}return p>0?g.subarray(v,v+p):void 0},F=function(g,E){var v=0;return v=(g[E]&127)<<21,v|=(g[E+1]&127)<<14,v|=(g[E+2]&127)<<7,v|=g[E+3]&127,v},N=function(g,E){return k(g,E)&&F(g,E+6)+10<=g.length-E},O=function(g){for(var E=_(g),v=0;v<E.length;v++){var p=E[v];if(w(p))return l(p)}return},w=function(g){return g&&g.key==="PRIV"&&g.info==="com.apple.streaming.transportStreamTimestamp"},y=function(g){var E=String.fromCharCode(g[0],g[1],g[2],g[3]),v=F(g,4),p=10;return{type:E,size:v,data:g.subarray(p,p+v)}},_=function(g){for(var E=0,v=[];k(g,E);){var p=F(g,E+6);E+=10;for(var d=E+p;E+8<d;){var a=y(g.subarray(E)),o=s(a);o&&v.push(o),E+=a.size+10}x(g,E)&&(E+=10)}return v},s=function(g){return g.type==="PRIV"?r(g):g.type[0]==="W"?u(g):i(g)},r=function(g){if(g.size<2)return;var E=e(g.data,!0),v=new Uint8Array(g.data.subarray(E.length+1));return{key:g.type,info:E,data:v.buffer}},i=function(g){if(g.size<2)return;if(g.type==="TXXX"){var E=1,v=e(g.data.subarray(E),!0);E+=v.length+1;var p=e(g.data.subarray(E));return{key:g.type,info:v,data:p}}var d=e(g.data.subarray(1));return{key:g.type,data:d}},u=function(g){if(g.type==="WXXX"){if(g.size<2)return;var E=1,v=e(g.data.subarray(E),!0);E+=v.length+1;var p=e(g.data.subarray(E));return{key:g.type,info:v,data:p}}var d=e(g.data);return{key:g.type,data:d}},l=function(g){if(g.data.byteLength===8){var E=new Uint8Array(g.data),v=E[3]&1,p=(E[4]<<23)+(E[5]<<15)+(E[6]<<7)+E[7];return p/=45,v&&(p+=4772185884e-2),Math.round(p)}return},e=function(g,E){E===void 0&&(E=!1);var v=T();if(v){var p=v.decode(g);if(E){var d=p.indexOf("\0");return d!==-1?p.substring(0,d):p}return p.replace(/\0/g,"")}for(var a=g.length,o,c,f,S="",A=0;A<a;){if(o=g[A++],o===0&&E)return S;if(o===0||o===3)continue;switch(o>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:S+=String.fromCharCode(o);break;case 12:case 13:c=g[A++],S+=String.fromCharCode((o&31)<<6|c&63);break;case 14:c=g[A++],f=g[A++],S+=String.fromCharCode((o&15)<<12|(c&63)<<6|(f&63)<<0);break;default:}}return S},t={decodeTextFrame:i},n;function T(){return!n&&typeof self.TextDecoder!="undefined"&&(n=new self.TextDecoder("utf-8")),n}},"./src/demux/mp3demuxer.ts":function(pe,j,C){"use strict";C.r(j);var k=C("./src/demux/base-audio-demuxer.ts"),x=C("./src/demux/id3.ts"),L=C("./src/utils/logger.ts"),F=C("./src/demux/mpegaudio.ts");function N(y,_){y.prototype=Object.create(_.prototype),y.prototype.constructor=y,O(y,_)}function O(y,_){return O=Object.setPrototypeOf||function(r,i){return r.__proto__=i,r},O(y,_)}var w=function(y){N(_,y);function _(){return y.apply(this,arguments)||this}var s=_.prototype;return s.resetInitSegment=function(i,u,l){y.prototype.resetInitSegment.call(this,i,u,l),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:i,duration:l,inputTimeScale:9e4,dropped:0}},_.probe=function(i){if(!i)return!1;for(var u=x.getID3Data(i,0)||[],l=u.length,e=i.length;l<e;l++)if(F.probe(i,l))return L.logger.log("MPEG Audio sync word found !"),!0;return!1},s.canParse=function(i,u){return F.canParse(i,u)},s.appendFrame=function(i,u,l){return this.initPTS===null?void 0:F.appendFrame(i,u,l,this.initPTS,this.frameIndex)},_}(k.default);w.minProbeByteLength=4,j.default=w},"./src/demux/mp4demuxer.ts":function(pe,j,C){"use strict";C.r(j);var k=C("./src/utils/mp4-tools.ts"),x=C("./src/demux/dummy-demuxed-track.ts"),L=function(){function F(O,w){this.remainderData=null,this.config=void 0,this.config=w}var N=F.prototype;return N.resetTimeStamp=function(){},N.resetInitSegment=function(){},N.resetContiguity=function(){},F.probe=function(w){return Object(k.findBox)({data:w,start:0,end:Math.min(w.length,16384)},["moof"]).length>0},N.demux=function(w){var y=w,_=Object(x.dummyTrack)();if(this.config.progressive){this.remainderData&&(y=Object(k.appendUint8Array)(this.remainderData,w));var s=Object(k.segmentValidRange)(y);this.remainderData=s.remainder,_.samples=s.valid||new Uint8Array}else _.samples=y;return{audioTrack:Object(x.dummyTrack)(),avcTrack:_,id3Track:Object(x.dummyTrack)(),textTrack:Object(x.dummyTrack)()}},N.flush=function(){var w=Object(x.dummyTrack)();return w.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(x.dummyTrack)(),avcTrack:w,id3Track:Object(x.dummyTrack)(),textTrack:Object(x.dummyTrack)()}},N.demuxSampleAes=function(w,y,_){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},N.destroy=function(){},F}();L.minProbeByteLength=1024,j.default=L},"./src/demux/mpegaudio.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"appendFrame",function(){return O}),C.d(j,"parseHeader",function(){return w}),C.d(j,"isHeaderPattern",function(){return y}),C.d(j,"isHeader",function(){return _}),C.d(j,"canParse",function(){return s}),C.d(j,"probe",function(){return r});var k=null,x=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],L=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],F=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],N=[0,1,1,4];function O(i,u,l,e,t){if(l+24>u.length)return;var n=w(u,l);if(n&&l+n.frameLength<=u.length){var T=n.samplesPerFrame*9e4/n.sampleRate,b=e+t*T,g={unit:u.subarray(l,l+n.frameLength),pts:b,dts:b};return i.config=[],i.channelCount=n.channelCount,i.samplerate=n.sampleRate,i.samples.push(g),{sample:g,length:n.frameLength,missing:0}}}function w(i,u){var l=i[u+1]>>3&3,e=i[u+1]>>1&3,t=i[u+2]>>4&15,n=i[u+2]>>2&3;if(l!==1&&t!==0&&t!==15&&n!==3){var T=i[u+2]>>1&1,b=i[u+3]>>6,g=l===3?3-e:e===3?3:4,E=x[g*14+t-1]*1e3,v=l===3?0:l===2?1:2,p=L[v*3+n],d=b===3?1:2,a=F[l][e],o=N[e],c=a*8*o,f=Math.floor(a*E/p+T)*o;if(k===null){var S=navigator.userAgent||"",A=S.match(/Chrome\/(\d+)/i);k=A?parseInt(A[1]):0}var R=!!k&&k<=87;return R&&e===2&&E>=224e3&&b===0&&(i[u+3]=i[u+3]|128),{sampleRate:p,channelCount:d,frameLength:f,samplesPerFrame:c}}}function y(i,u){return i[u]===255&&(i[u+1]&224)===224&&(i[u+1]&6)!==0}function _(i,u){return u+1<i.length&&y(i,u)}function s(i,u){var l=4;return y(i,u)&&l<=i.length-u}function r(i,u){if(u+1<i.length&&y(i,u)){var l=4,e=w(i,u),t=l;e!=null&&e.frameLength&&(t=e.frameLength);var n=u+t;return n===i.length||_(i,n)}return!1}},"./src/demux/sample-aes.ts":function(pe,j,C){"use strict";C.r(j);var k=C("./src/crypt/decrypter.ts"),x=C("./src/demux/tsdemuxer.ts"),L=function(){function F(O,w,y){this.keyData=void 0,this.decrypter=void 0,this.keyData=y,this.decrypter=new k.default(O,w,{removePKCS7Padding:!1})}var N=F.prototype;return N.decryptBuffer=function(w,y){this.decrypter.decrypt(w,this.keyData.key.buffer,this.keyData.iv.buffer,y)},N.decryptAacSample=function(w,y,_,s){var r=w[y].unit,i=r.subarray(16,r.length-r.length%16),u=i.buffer.slice(i.byteOffset,i.byteOffset+i.length),l=this;this.decryptBuffer(u,function(e){var t=new Uint8Array(e);r.set(t,16),s||l.decryptAacSamples(w,y+1,_)})},N.decryptAacSamples=function(w,y,_){for(;;y++){if(y>=w.length){_();return}if(w[y].unit.length<32)continue;var s=this.decrypter.isSync();if(this.decryptAacSample(w,y,_,s),!s)return}},N.getAvcEncryptedData=function(w){for(var y=Math.floor((w.length-48)/160)*16+16,_=new Int8Array(y),s=0,r=32;r<=w.length-16;r+=160,s+=16)_.set(w.subarray(r,r+16),s);return _},N.getAvcDecryptedUnit=function(w,y){for(var _=new Uint8Array(y),s=0,r=32;r<=w.length-16;r+=160,s+=16)w.set(_.subarray(s,s+16),r);return w},N.decryptAvcSample=function(w,y,_,s,r,i){var u=Object(x.discardEPB)(r.data),l=this.getAvcEncryptedData(u),e=this;this.decryptBuffer(l.buffer,function(t){r.data=e.getAvcDecryptedUnit(u,t),i||e.decryptAvcSamples(w,y,_+1,s)})},N.decryptAvcSamples=function(w,y,_,s){if(w instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;y++,_=0){if(y>=w.length){s();return}for(var r=w[y].units;!(_>=r.length);_++){var i=r[_];if(i.data.length<=48||i.type!==1&&i.type!==5)continue;var u=this.decrypter.isSync();if(this.decryptAvcSample(w,y,_,s,i,u),!u)return}}},F}();j.default=L},"./src/demux/transmuxer-interface.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"default",function(){return r});var k=C("./node_modules/webworkify-webpack/index.js"),x=C.n(k),L=C("./src/events.ts"),F=C("./src/demux/transmuxer.ts"),N=C("./src/utils/logger.ts"),O=C("./src/errors.ts"),w=C("./src/utils/mediasource-helper.ts"),y=C("./node_modules/eventemitter3/index.js"),_=C.n(y),s=Object(w.getMediaSource)()||{isTypeSupported:function(){return!1}},r=function(){function i(l,e,t,n){var T=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=l,this.id=e,this.onTransmuxComplete=t,this.onFlush=n;var b=l.config,g=function(a,o){o=o||{},o.frag=T.frag,o.id=T.id,l.trigger(a,o)};this.observer=new y.EventEmitter,this.observer.on(L.Events.FRAG_DECRYPTED,g),this.observer.on(L.Events.ERROR,g);var E={mp4:s.isTypeSupported("video/mp4"),mpeg:s.isTypeSupported("audio/mpeg"),mp3:s.isTypeSupported('audio/mp4; codecs="mp3"')},v=navigator.vendor;if(b.enableWorker&&typeof Worker!="undefined"){N.logger.log("demuxing in webworker");var p;try{p=this.worker=k("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),p.addEventListener("message",this.onwmsg),p.onerror=function(d){l.trigger(L.Events.ERROR,{type:O.ErrorTypes.OTHER_ERROR,details:O.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(d.message+" ("+d.filename+":"+d.lineno+")")})},p.postMessage({cmd:"init",typeSupported:E,vendor:v,id:e,config:JSON.stringify(b)})}catch(d){N.logger.warn("Error in worker:",d),N.logger.error("Error while initializing DemuxerWorker, fallback to inline"),p&&self.URL.revokeObjectURL(p.objectURL),this.transmuxer=new F.default(this.observer,E,b,v,e),this.worker=null}}else this.transmuxer=new F.default(this.observer,E,b,v,e)}var u=i.prototype;return u.destroy=function(){var e=this.worker;if(e)e.removeEventListener("message",this.onwmsg),e.terminate(),this.worker=null;else{var t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}var n=this.observer;n&&n.removeAllListeners(),this.observer=null},u.push=function(e,t,n,T,b,g,E,v,p,d){var a=this;p.transmuxing.start=self.performance.now();var o=this.transmuxer,c=this.worker,f=g?g.start:b.start,S=b.decryptdata,A=this.frag,R=!(A&&b.cc===A.cc),B=!(A&&p.level===A.level),U=A?p.sn-A.sn:-1,K=this.part?p.part-this.part.index:1,D=!B&&(U===1||U===0&&K===1),H=self.performance.now();(B||U||b.stats.parsing.start===0)&&(b.stats.parsing.start=H),g&&(K||!D)&&(g.stats.parsing.start=H);var V=new F.TransmuxState(R,D,v,B,f);if(!D||R){N.logger.log("[transmuxer-interface, "+b.type+"]: Starting new transmux session for sn: "+p.sn+" p: "+p.part+" level: "+p.level+" id: "+p.id+`
|
|
discontinuity: `+R+`
|
|
trackSwitch: `+B+`
|
|
contiguous: `+D+`
|
|
accurateTimeOffset: `+v+`
|
|
timeOffset: `+f);var ne=new F.TransmuxConfig(n,T,t,E,d);this.configureTransmuxer(ne)}if(this.frag=b,this.part=g,c)c.postMessage({cmd:"demux",data:e,decryptdata:S,chunkMeta:p,state:V},e instanceof ArrayBuffer?[e]:[]);else if(o){var ie=o.push(e,S,p,V);Object(F.isPromise)(ie)?ie.then(function(_e){a.handleTransmuxComplete(_e)}):this.handleTransmuxComplete(ie)}},u.flush=function(e){var t=this;e.transmuxing.start=self.performance.now();var n=this.transmuxer,T=this.worker;if(T)T.postMessage({cmd:"flush",chunkMeta:e});else if(n){var b=n.flush(e);Object(F.isPromise)(b)?b.then(function(g){t.handleFlushResult(g,e)}):this.handleFlushResult(b,e)}},u.handleFlushResult=function(e,t){var n=this;e.forEach(function(T){n.handleTransmuxComplete(T)}),this.onFlush(t)},u.onWorkerMessage=function(e){var t=e.data,n=this.hls;switch(t.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(t.data);break}case"flush":{this.onFlush(t.data);break}default:{t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,n.trigger(t.event,t.data);break}}},u.configureTransmuxer=function(e){var t=this.worker,n=this.transmuxer;t?t.postMessage({cmd:"configure",config:e}):n&&n.configure(e)},u.handleTransmuxComplete=function(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)},i}()},"./src/demux/transmuxer-worker.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"default",function(){return O});var k=C("./src/demux/transmuxer.ts"),x=C("./src/events.ts"),L=C("./src/utils/logger.ts"),F=C("./node_modules/eventemitter3/index.js"),N=C.n(F);function O(r){var i=new F.EventEmitter,u=function(e,t){r.postMessage({event:e,data:t})};i.on(x.Events.FRAG_DECRYPTED,u),i.on(x.Events.ERROR,u),r.addEventListener("message",function(l){var e=l.data;switch(e.cmd){case"init":{var t=JSON.parse(e.config);r.transmuxer=new k.default(i,e.typeSupported,t,e.vendor,e.id),Object(L.enableLogs)(t.debug),u("init",null);break}case"configure":{r.transmuxer.configure(e.config);break}case"demux":{var n=r.transmuxer.push(e.data,e.decryptdata,e.chunkMeta,e.state);Object(k.isPromise)(n)?n.then(function(g){w(r,g)}):w(r,n);break}case"flush":{var T=e.chunkMeta,b=r.transmuxer.flush(T);Object(k.isPromise)(b)?b.then(function(g){_(r,g,T)}):_(r,b,T);break}default:break}})}function w(r,i){if(s(i.remuxResult))return;var u=[],l=i.remuxResult,e=l.audio,t=l.video;e&&y(u,e),t&&y(u,t),r.postMessage({event:"transmuxComplete",data:i},u)}function y(r,i){i.data1&&r.push(i.data1.buffer),i.data2&&r.push(i.data2.buffer)}function _(r,i,u){i.forEach(function(l){w(r,l)}),r.postMessage({event:"flush",data:u})}function s(r){return!r.audio&&!r.video&&!r.text&&!r.id3&&!r.initSegment}},"./src/demux/transmuxer.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"default",function(){return t}),C.d(j,"isPromise",function(){return b}),C.d(j,"TransmuxConfig",function(){return g}),C.d(j,"TransmuxState",function(){return E});var k=C("./src/events.ts"),x=C("./src/errors.ts"),L=C("./src/crypt/decrypter.ts"),F=C("./src/demux/aacdemuxer.ts"),N=C("./src/demux/mp4demuxer.ts"),O=C("./src/demux/tsdemuxer.ts"),w=C("./src/demux/mp3demuxer.ts"),y=C("./src/remux/mp4-remuxer.ts"),_=C("./src/remux/passthrough-remuxer.ts"),s=C("./src/demux/chunk-cache.ts"),r=C("./src/utils/mp4-tools.ts"),i=C("./src/utils/logger.ts"),u;try{u=self.performance.now.bind(self.performance)}catch(v){i.logger.debug("Unable to use Performance API on this environment"),u=self.Date.now}var l=[{demux:O.default,remux:y.default},{demux:N.default,remux:_.default},{demux:F.default,remux:y.default},{demux:w.default,remux:y.default}],e=1024;l.forEach(function(v){var p=v.demux;e=Math.max(e,p.minProbeByteLength)});var t=function(){function v(d,a,o,c,f){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 s.default,this.observer=d,this.typeSupported=a,this.config=o,this.vendor=c,this.id=f}var p=v.prototype;return p.configure=function(a){this.transmuxConfig=a,this.decrypter&&this.decrypter.reset()},p.push=function(a,o,c,f){var S=this,A=c.transmuxing;A.executeStart=u();var R=new Uint8Array(a),B=this.cache,U=this.config,K=this.currentTransmuxState,D=this.transmuxConfig;f&&(this.currentTransmuxState=f);var H=n(R,o);if(H&&H.method==="AES-128"){var V=this.getDecrypter();if(U.enableSoftwareAES){var ne=V.softwareDecrypt(R,H.key.buffer,H.iv.buffer);if(!ne)return A.executeEnd=u(),T(c);R=new Uint8Array(ne)}else return this.decryptionPromise=V.webCryptoDecrypt(R,H.key.buffer,H.iv.buffer).then(function(ke){var je=S.push(ke,null,c);return S.decryptionPromise=null,je}),this.decryptionPromise}var ie=f||K,_e=ie.contiguous,ye=ie.discontinuity,be=ie.trackSwitch,we=ie.accurateTimeOffset,Re=ie.timeOffset,ge=D.audioCodec,Q=D.videoCodec,Pe=D.defaultInitPts,$e=D.duration,Fe=D.initSegmentData;if((ye||be)&&this.resetInitSegment(Fe,ge,Q,$e),ye&&this.resetInitialTimestamp(Pe),_e||this.resetContiguity(),this.needsProbing(R,ye,be)){if(B.dataLength){var Me=B.flush();R=Object(r.appendUint8Array)(Me,R)}this.configureTransmuxer(R,D)}var ze=this.transmux(R,H,Re,we,c),xe=this.currentTransmuxState;return xe.contiguous=!0,xe.discontinuity=!1,xe.trackSwitch=!1,A.executeEnd=u(),ze},p.flush=function(a){var o=this,c=a.transmuxing;c.executeStart=u();var f=this.decrypter,S=this.cache,A=this.currentTransmuxState,R=this.decryptionPromise;if(R)return R.then(function(){return o.flush(a)});var B=[],U=A.timeOffset;if(f){var K=f.flush();K&&B.push(this.push(K,null,a))}var D=S.dataLength;S.reset();var H=this.demuxer,V=this.remuxer;if(!H||!V)return D>=e&&this.observer.emit(k.Events.ERROR,k.Events.ERROR,{type:x.ErrorTypes.MEDIA_ERROR,details:x.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),c.executeEnd=u(),[T(a)];var ne=H.flush(U);return b(ne)?ne.then(function(ie){return o.flushRemux(B,ie,a),B}):(this.flushRemux(B,ne,a),B)},p.flushRemux=function(a,o,c){var f=o.audioTrack,S=o.avcTrack,A=o.id3Track,R=o.textTrack,B=this.currentTransmuxState,U=B.accurateTimeOffset,K=B.timeOffset;i.logger.log("[transmuxer.ts]: Flushed fragment "+c.sn+(c.part>-1?" p: "+c.part:"")+" of level "+c.level);var D=this.remuxer.remux(f,S,A,R,K,U,!0,this.id);a.push({remuxResult:D,chunkMeta:c}),c.transmuxing.executeEnd=u()},p.resetInitialTimestamp=function(a){var o=this.demuxer,c=this.remuxer;if(!o||!c)return;o.resetTimeStamp(a),c.resetTimeStamp(a)},p.resetContiguity=function(){var a=this.demuxer,o=this.remuxer;if(!a||!o)return;a.resetContiguity(),o.resetNextTimestamp()},p.resetInitSegment=function(a,o,c,f){var S=this.demuxer,A=this.remuxer;if(!S||!A)return;S.resetInitSegment(o,c,f),A.resetInitSegment(a,o,c)},p.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},p.transmux=function(a,o,c,f,S){var A;return o&&o.method==="SAMPLE-AES"?A=this.transmuxSampleAes(a,o,c,f,S):A=this.transmuxUnencrypted(a,c,f,S),A},p.transmuxUnencrypted=function(a,o,c,f){var S=this.demuxer.demux(a,o,!1,!this.config.progressive),A=S.audioTrack,R=S.avcTrack,B=S.id3Track,U=S.textTrack,K=this.remuxer.remux(A,R,B,U,o,c,!1,this.id);return{remuxResult:K,chunkMeta:f}},p.transmuxSampleAes=function(a,o,c,f,S){var A=this;return this.demuxer.demuxSampleAes(a,o,c).then(function(R){var B=A.remuxer.remux(R.audioTrack,R.avcTrack,R.id3Track,R.textTrack,c,f,!1,A.id);return{remuxResult:B,chunkMeta:S}})},p.configureTransmuxer=function(a,o){for(var c=this.config,f=this.observer,S=this.typeSupported,A=this.vendor,R=o.audioCodec,B=o.defaultInitPts,U=o.duration,K=o.initSegmentData,D=o.videoCodec,H,V=0,ne=l.length;V<ne;V++)if(l[V].demux.probe(a)){H=l[V];break}H||(i.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),H={demux:N.default,remux:_.default});var ie=this.demuxer,_e=this.remuxer,ye=H.remux,be=H.demux;(!_e||!(_e instanceof ye))&&(this.remuxer=new ye(f,c,S,A)),(!ie||!(ie instanceof be))&&(this.demuxer=new be(f,c,S),this.probe=be.probe),this.resetInitSegment(K,R,D,U),this.resetInitialTimestamp(B)},p.needsProbing=function(a,o,c){return!this.demuxer||!this.remuxer||o||c},p.getDecrypter=function(){var a=this.decrypter;return a||(a=this.decrypter=new L.default(this.observer,this.config)),a},v}();function n(v,p){var d=null;return v.byteLength>0&&p!=null&&p.key!=null&&p.iv!==null&&p.method!=null&&(d=p),d}var T=function(p){return{remuxResult:{},chunkMeta:p}};function b(v){return"then"in v&&v.then instanceof Function}var g=function(p,d,a,o,c){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=p,this.videoCodec=d,this.initSegmentData=a,this.duration=o,this.defaultInitPts=c},E=function(p,d,a,o,c){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=p,this.contiguous=d,this.accurateTimeOffset=a,this.trackSwitch=o,this.timeOffset=c}},"./src/demux/tsdemuxer.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"discardEPB",function(){return T});var k=C("./src/demux/adts.ts"),x=C("./src/demux/mpegaudio.ts"),L=C("./src/demux/exp-golomb.ts"),F=C("./src/demux/id3.ts"),N=C("./src/demux/sample-aes.ts"),O=C("./src/events.ts"),w=C("./src/utils/mp4-tools.ts"),y=C("./src/utils/logger.ts"),_=C("./src/errors.ts"),s={video:1,audio:2,id3:3,text:4},r=function(){function b(E,v,p){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=E,this.config=v,this.typeSupported=p}b.probe=function(v){var p=b.syncOffset(v);return p<0?!1:(p&&y.logger.warn("MPEG2-TS detected but first sync word found @ offset "+p+", junk ahead ?"),!0)},b.syncOffset=function(v){for(var p=Math.min(1e3,v.length-3*188),d=0;d<p;){if(v[d]===71&&v[d+188]===71&&v[d+2*188]===71)return d;d++}return-1},b.createTrack=function(v,p){return{container:v==="video"||v==="audio"?"video/mp2t":void 0,type:v,id:s[v],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:v==="audio"?p:void 0}};var g=b.prototype;return g.resetInitSegment=function(v,p,d){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=b.createTrack("video",d),this._audioTrack=b.createTrack("audio",d),this._id3Track=b.createTrack("id3",d),this._txtTrack=b.createTrack("text",d),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=v,this.videoCodec=p,this._duration=d},g.resetTimeStamp=function(){},g.resetContiguity=function(){var v=this._audioTrack,p=this._avcTrack,d=this._id3Track;v&&(v.pesData=null),p&&(p.pesData=null),d&&(d.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},g.demux=function(v,p,d,a){d===void 0&&(d=!1),a===void 0&&(a=!1),d||(this.sampleAes=null);var o,c=this._avcTrack,f=this._audioTrack,S=this._id3Track,A=c.pid,R=c.pesData,B=f.pid,U=S.pid,K=f.pesData,D=S.pesData,H=!1,V=this.pmtParsed,ne=this._pmtId,ie=v.length;if(this.remainderData&&(v=Object(w.appendUint8Array)(this.remainderData,v),ie=v.length,this.remainderData=null),ie<188&&!a)return this.remainderData=v,{audioTrack:f,avcTrack:c,id3Track:S,textTrack:this._txtTrack};var _e=Math.max(0,b.syncOffset(v));ie-=(ie+_e)%188,ie<v.byteLength&&!a&&(this.remainderData=new Uint8Array(v.buffer,ie,v.buffer.byteLength-ie));for(var ye=_e;ye<ie;ye+=188)if(v[ye]===71){var be=!!(v[ye+1]&64),we=((v[ye+1]&31)<<8)+v[ye+2],Re=(v[ye+3]&48)>>4,ge=void 0;if(Re>1){if(ge=ye+5+v[ye+4],ge===ye+188)continue}else ge=ye+4;switch(we){case A:be&&(R&&(o=e(R))&&this.parseAVCPES(o,!1),R={data:[],size:0}),R&&(R.data.push(v.subarray(ge,ye+188)),R.size+=ye+188-ge);break;case B:be&&(K&&(o=e(K))&&(f.isAAC?this.parseAACPES(o):this.parseMPEGPES(o)),K={data:[],size:0}),K&&(K.data.push(v.subarray(ge,ye+188)),K.size+=ye+188-ge);break;case U:be&&(D&&(o=e(D))&&this.parseID3PES(o),D={data:[],size:0}),D&&(D.data.push(v.subarray(ge,ye+188)),D.size+=ye+188-ge);break;case 0:be&&(ge+=v[ge]+1),ne=this._pmtId=u(v,ge);break;case ne:{be&&(ge+=v[ge]+1);var Q=l(v,ge,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,d);A=Q.avc,A>0&&(c.pid=A),B=Q.audio,B>0&&(f.pid=B,f.isAAC=Q.isAAC),U=Q.id3,U>0&&(S.pid=U),H&&!V&&(y.logger.log("reparse from beginning"),H=!1,ye=_e-188),V=this.pmtParsed=!0;break}case 17:case 8191:break;default:H=!0;break}}else this.observer.emit(O.Events.ERROR,O.Events.ERROR,{type:_.ErrorTypes.MEDIA_ERROR,details:_.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});c.pesData=R,f.pesData=K,S.pesData=D;var Pe={audioTrack:f,avcTrack:c,id3Track:S,textTrack:this._txtTrack};return a&&this.extractRemainingSamples(Pe),Pe},g.flush=function(){var v=this.remainderData;this.remainderData=null;var p;return v?p=this.demux(v,-1,!1,!0):p={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(p),this.sampleAes?this.decrypt(p,this.sampleAes):p},g.extractRemainingSamples=function(v){var p=v.audioTrack,d=v.avcTrack,a=v.id3Track,o=d.pesData,c=p.pesData,f=a.pesData,S;o&&(S=e(o))?(this.parseAVCPES(S,!0),d.pesData=null):d.pesData=o,c&&(S=e(c))?(p.isAAC?this.parseAACPES(S):this.parseMPEGPES(S),p.pesData=null):(c!=null&&c.size&&y.logger.log("last AAC PES packet truncated,might overlap between fragments"),p.pesData=c),f&&(S=e(f))?(this.parseID3PES(S),a.pesData=null):a.pesData=f},g.demuxSampleAes=function(v,p,d){var a=this.demux(v,d,!0,!this.config.progressive),o=this.sampleAes=new N.default(this.observer,this.config,p);return this.decrypt(a,o)},g.decrypt=function(v,p){return new Promise(function(d){var a=v.audioTrack,o=v.avcTrack;a.samples&&a.isAAC?p.decryptAacSamples(a.samples,0,function(){o.samples?p.decryptAvcSamples(o.samples,0,0,function(){d(v)}):d(v)}):o.samples&&p.decryptAvcSamples(o.samples,0,0,function(){d(v)})})},g.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},g.parseAVCPES=function(v,p){var d=this,a=this._avcTrack,o=this.parseAVCNALu(v.data),c=!1,f=this.avcSample,S,A=!1;v.data=null,f&&o.length&&!a.audFound&&(t(f,a),f=this.avcSample=i(!1,v.pts,v.dts,"")),o.forEach(function(R){switch(R.type){case 1:{S=!0,f||(f=d.avcSample=i(!0,v.pts,v.dts,"")),c&&(f.debug+="NDR "),f.frame=!0;var B=R.data;if(A&&B.length>4){var U=new L.default(B).readSliceType();(U===2||U===4||U===7||U===9)&&(f.key=!0)}break}case 5:S=!0,f||(f=d.avcSample=i(!0,v.pts,v.dts,"")),c&&(f.debug+="IDR "),f.key=!0,f.frame=!0;break;case 6:{S=!0,c&&f&&(f.debug+="SEI ");var K=new L.default(T(R.data));K.readUByte();for(var D=0,H=0,V=!1,ne=0;!V&&K.bytesAvailable>1;){D=0;do ne=K.readUByte(),D+=ne;while(ne===255);H=0;do ne=K.readUByte(),H+=ne;while(ne===255);if(D===4&&K.bytesAvailable!==0){V=!0;var ie=K.readUByte();if(ie===181){var _e=K.readUShort();if(_e===49){var ye=K.readUInt();if(ye===1195456820){var be=K.readUByte();if(be===3){for(var we=K.readUByte(),Re=K.readUByte(),ge=31&we,Q=[we,Re],Pe=0;Pe<ge;Pe++)Q.push(K.readUByte()),Q.push(K.readUByte()),Q.push(K.readUByte());n(d._txtTrack.samples,{type:3,pts:v.pts,bytes:Q})}}}}}else if(D===5&&K.bytesAvailable!==0){if(V=!0,H>16){for(var $e=[],Fe=0;Fe<16;Fe++)$e.push(K.readUByte().toString(16)),(Fe===3||Fe===5||Fe===7||Fe===9)&&$e.push("-");for(var Me=H-16,ze=new Uint8Array(Me),xe=0;xe<Me;xe++)ze[xe]=K.readUByte();n(d._txtTrack.samples,{pts:v.pts,payloadType:D,uuid:$e.join(""),userData:Object(F.utf8ArrayToStr)(ze),userDataBytes:ze})}}else if(H<K.bytesAvailable)for(var ke=0;ke<H;ke++)K.readUByte()}break}case 7:if(S=!0,A=!0,c&&f&&(f.debug+="SPS "),!a.sps){var je=new L.default(R.data),Ge=je.readSPS();a.width=Ge.width,a.height=Ge.height,a.pixelRatio=Ge.pixelRatio,a.sps=[R.data],a.duration=d._duration;for(var Ue=R.data.subarray(1,4),Le="avc1.",Ae=0;Ae<3;Ae++){var nt=Ue[Ae].toString(16);nt.length<2&&(nt="0"+nt),Le+=nt}a.codec=Le}break;case 8:S=!0,c&&f&&(f.debug+="PPS "),a.pps||(a.pps=[R.data]);break;case 9:S=!1,a.audFound=!0,f&&t(f,a),f=d.avcSample=i(!1,v.pts,v.dts,c?"AUD ":"");break;case 12:S=!1;break;default:S=!1,f&&(f.debug+="unknown NAL "+R.type+" ");break}if(f&&S){var Qe=f.units;Qe.push(R)}}),p&&f&&(t(f,a),this.avcSample=null)},g.getLastNalUnit=function(){var v,p=this.avcSample,d;if(!p||p.units.length===0){var a=this._avcTrack.samples;p=a[a.length-1]}if((v=p)!==null&&v!==void 0&&v.units){var o=p.units;d=o[o.length-1]}return d},g.parseAVCNALu=function(v){var p=v.byteLength,d=this._avcTrack,a=d.naluState||0,o=a,c=[],f=0,S,A,R,B=-1,U=0;for(a===-1&&(B=0,U=v[0]&31,a=0,f=1);f<p;){if(S=v[f++],!a){a=S?0:1;continue}if(a===1){a=S?0:2;continue}if(!S)a=3;else if(S===1){if(B>=0){var K={data:v.subarray(B,f-a-1),type:U};c.push(K)}else{var D=this.getLastNalUnit();if(D&&(o&&f<=4-o&&(D.state&&(D.data=D.data.subarray(0,D.data.byteLength-o))),A=f-a-1,A>0)){var H=new Uint8Array(D.data.byteLength+A);H.set(D.data,0),H.set(v.subarray(0,A),D.data.byteLength),D.data=H,D.state=0}}f<p?(R=v[f]&31,B=f,U=R,a=0):a=-1}else a=0}if(B>=0&&a>=0){var V={data:v.subarray(B,p),type:U,state:a};c.push(V)}if(c.length===0){var ne=this.getLastNalUnit();if(ne){var ie=new Uint8Array(ne.data.byteLength+v.byteLength);ie.set(ne.data,0),ie.set(v,ne.data.byteLength),ne.data=ie}}return d.naluState=a,c},g.parseAACPES=function(v){var p=0,d=this._audioTrack,a=this.aacOverFlow,o=v.data;if(a){this.aacOverFlow=null;var c=a.sample.unit.byteLength,f=Math.min(a.missing,c),S=c-f;a.sample.unit.set(o.subarray(0,f),S),d.samples.push(a.sample),p=a.missing}var A,R;for(A=p,R=o.length;A<R-1&&!k.isHeader(o,A);A++);if(A!==p){var B,U;if(A<R-1?(B="AAC PES did not start with ADTS header,offset:"+A,U=!1):(B="no ADTS header found in AAC PES",U=!0),y.logger.warn("parsing error:"+B),this.observer.emit(O.Events.ERROR,O.Events.ERROR,{type:_.ErrorTypes.MEDIA_ERROR,details:_.ErrorDetails.FRAG_PARSING_ERROR,fatal:U,reason:B}),U)return}k.initTrackConfig(d,this.observer,o,A,this.audioCodec);var K;if(v.pts!==void 0)K=v.pts;else if(a){var D=k.getFrameDuration(d.samplerate);K=a.sample.pts+D}else{y.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var H=0;A<R;)if(k.isHeader(o,A)){if(A+5<R){var V=k.appendFrame(d,o,A,K,H);if(V)if(V.missing)this.aacOverFlow=V;else{A+=V.length,H++;continue}}break}else A++},g.parseMPEGPES=function(v){var p=v.data,d=p.length,a=0,o=0,c=v.pts;if(c===void 0){y.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<d;)if(x.isHeader(p,o)){var f=x.appendFrame(this._audioTrack,p,o,c,a);if(f)o+=f.length,a++;else break}else o++},g.parseID3PES=function(v){if(v.pts===void 0){y.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(v)},b}();r.minProbeByteLength=188;function i(b,g,E,v){return{key:b,frame:!1,pts:g,dts:E,units:[],debug:v,length:0}}function u(b,g){return(b[g+10]&31)<<8|b[g+11]}function l(b,g,E,v){var p={audio:-1,avc:-1,id3:-1,isAAC:!0},d=(b[g+1]&15)<<8|b[g+2],a=g+3+d-4,o=(b[g+10]&15)<<8|b[g+11];for(g+=12+o;g<a;){var c=(b[g+1]&31)<<8|b[g+2];switch(b[g]){case 207:if(!v){y.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:p.audio===-1&&(p.audio=c);break;case 21:p.id3===-1&&(p.id3=c);break;case 219:if(!v){y.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:p.avc===-1&&(p.avc=c);break;case 3:case 4:E?p.audio===-1&&(p.audio=c,p.isAAC=!1):y.logger.log("MPEG audio found, not supported in this browser");break;case 36:y.logger.warn("Unsupported HEVC stream type found");break;default:break}g+=((b[g+3]&15)<<8|b[g+4])+5}return p}function e(b){var g=0,E,v,p,d,a,o=b.data;if(!b||b.size===0)return null;for(;o[0].length<19&&o.length>1;){var c=new Uint8Array(o[0].length+o[1].length);c.set(o[0]),c.set(o[1],o[0].length),o[0]=c,o.splice(1,1)}E=o[0];var f=(E[0]<<16)+(E[1]<<8)+E[2];if(f===1){if(v=(E[4]<<8)+E[5],v&&v>b.size-6)return null;var S=E[7];S&192&&(d=(E[9]&14)*536870912+(E[10]&255)*4194304+(E[11]&254)*16384+(E[12]&255)*128+(E[13]&254)/2,S&64?(a=(E[14]&14)*536870912+(E[15]&255)*4194304+(E[16]&254)*16384+(E[17]&255)*128+(E[18]&254)/2,d-a>60*9e4&&(y.logger.warn(Math.round((d-a)/9e4)+"s delta between PTS and DTS, align them"),d=a)):a=d),p=E[8];var A=p+9;if(b.size<=A)return null;b.size-=A;for(var R=new Uint8Array(b.size),B=0,U=o.length;B<U;B++){E=o[B];var K=E.byteLength;if(A)if(A>K){A-=K;continue}else E=E.subarray(A),K-=A,A=0;R.set(E,g),g+=K}return v&&(v-=p+3),{data:R,pts:d,dts:a,len:v}}return null}function t(b,g){if(b.units.length&&b.frame){if(b.pts===void 0){var E=g.samples,v=E.length;if(v){var p=E[v-1];b.pts=p.pts,b.dts=p.dts}else{g.dropped++;return}}g.samples.push(b)}b.debug.length&&y.logger.log(b.pts+"/"+b.dts+":"+b.debug)}function n(b,g){var E=b.length;if(E>0){if(g.pts>=b[E-1].pts)b.push(g);else for(var v=E-1;v>=0;v--)if(g.pts<b[v].pts){b.splice(v,0,g);break}}else b.push(g)}function T(b){for(var g=b.byteLength,E=[],v=1;v<g-2;)b[v]===0&&b[v+1]===0&&b[v+2]===3?(E.push(v+2),v+=2):v++;if(E.length===0)return b;var p=g-E.length,d=new Uint8Array(p),a=0;for(v=0;v<p;a++,v++)a===E[0]&&(a++,E.shift()),d[v]=b[a];return d}j.default=r},"./src/errors.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"ErrorTypes",function(){return k}),C.d(j,"ErrorDetails",function(){return x});var k;(function(L){L.NETWORK_ERROR="networkError",L.MEDIA_ERROR="mediaError",L.KEY_SYSTEM_ERROR="keySystemError",L.MUX_ERROR="muxError",L.OTHER_ERROR="otherError"})(k||(k={}));var x;(function(L){L.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",L.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",L.KEY_SYSTEM_NO_SESSION="keySystemNoSession",L.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",L.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",L.MANIFEST_LOAD_ERROR="manifestLoadError",L.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",L.MANIFEST_PARSING_ERROR="manifestParsingError",L.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",L.LEVEL_EMPTY_ERROR="levelEmptyError",L.LEVEL_LOAD_ERROR="levelLoadError",L.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",L.LEVEL_SWITCH_ERROR="levelSwitchError",L.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",L.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",L.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",L.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",L.FRAG_LOAD_ERROR="fragLoadError",L.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",L.FRAG_DECRYPT_ERROR="fragDecryptError",L.FRAG_PARSING_ERROR="fragParsingError",L.REMUX_ALLOC_ERROR="remuxAllocError",L.KEY_LOAD_ERROR="keyLoadError",L.KEY_LOAD_TIMEOUT="keyLoadTimeOut",L.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",L.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",L.BUFFER_APPEND_ERROR="bufferAppendError",L.BUFFER_APPENDING_ERROR="bufferAppendingError",L.BUFFER_STALLED_ERROR="bufferStalledError",L.BUFFER_FULL_ERROR="bufferFullError",L.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",L.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",L.INTERNAL_EXCEPTION="internalException",L.INTERNAL_ABORTED="aborted",L.UNKNOWN="unknown"})(x||(x={}))},"./src/events.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"Events",function(){return k});var k;(function(x){x.MEDIA_ATTACHING="hlsMediaAttaching",x.MEDIA_ATTACHED="hlsMediaAttached",x.MEDIA_DETACHING="hlsMediaDetaching",x.MEDIA_DETACHED="hlsMediaDetached",x.BUFFER_RESET="hlsBufferReset",x.BUFFER_CODECS="hlsBufferCodecs",x.BUFFER_CREATED="hlsBufferCreated",x.BUFFER_APPENDING="hlsBufferAppending",x.BUFFER_APPENDED="hlsBufferAppended",x.BUFFER_EOS="hlsBufferEos",x.BUFFER_FLUSHING="hlsBufferFlushing",x.BUFFER_FLUSHED="hlsBufferFlushed",x.MANIFEST_LOADING="hlsManifestLoading",x.MANIFEST_LOADED="hlsManifestLoaded",x.MANIFEST_PARSED="hlsManifestParsed",x.LEVEL_SWITCHING="hlsLevelSwitching",x.LEVEL_SWITCHED="hlsLevelSwitched",x.LEVEL_LOADING="hlsLevelLoading",x.LEVEL_LOADED="hlsLevelLoaded",x.LEVEL_UPDATED="hlsLevelUpdated",x.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",x.LEVELS_UPDATED="hlsLevelsUpdated",x.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",x.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",x.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",x.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",x.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",x.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",x.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",x.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",x.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",x.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",x.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",x.CUES_PARSED="hlsCuesParsed",x.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",x.INIT_PTS_FOUND="hlsInitPtsFound",x.FRAG_LOADING="hlsFragLoading",x.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",x.FRAG_LOADED="hlsFragLoaded",x.FRAG_DECRYPTED="hlsFragDecrypted",x.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",x.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",x.FRAG_PARSING_METADATA="hlsFragParsingMetadata",x.FRAG_PARSED="hlsFragParsed",x.FRAG_BUFFERED="hlsFragBuffered",x.FRAG_CHANGED="hlsFragChanged",x.FPS_DROP="hlsFpsDrop",x.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",x.ERROR="hlsError",x.DESTROYING="hlsDestroying",x.KEY_LOADING="hlsKeyLoading",x.KEY_LOADED="hlsKeyLoaded",x.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",x.BACK_BUFFER_REACHED="hlsBackBufferReached"})(k||(k={}))},"./src/hls.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"default",function(){return b});var k=C("./node_modules/url-toolkit/src/url-toolkit.js"),x=C.n(k),L=C("./src/loader/playlist-loader.ts"),F=C("./src/loader/key-loader.ts"),N=C("./src/controller/id3-track-controller.ts"),O=C("./src/controller/latency-controller.ts"),w=C("./src/controller/level-controller.ts"),y=C("./src/controller/fragment-tracker.ts"),_=C("./src/controller/stream-controller.ts"),s=C("./src/is-supported.ts"),r=C("./src/utils/logger.ts"),i=C("./src/config.ts"),u=C("./node_modules/eventemitter3/index.js"),l=C.n(u),e=C("./src/events.ts"),t=C("./src/errors.ts");function n(g,E){for(var v=0;v<E.length;v++){var p=E[v];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(g,p.key,p)}}function T(g,E,v){return E&&n(g.prototype,E),v&&n(g,v),g}var b=function(){g.isSupported=function(){return Object(s.isSupported)()};function g(v){v===void 0&&(v={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new u.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 p=this.config=Object(i.mergeConfig)(g.DefaultConfig,v);this.userConfig=v,Object(r.enableLogs)(p.debug),this._autoLevelCapping=-1,p.progressive&&Object(i.enableStreamingMode)(p);var d=p.abrController,a=p.bufferController,o=p.capLevelController,c=p.fpsController,f=this.abrController=new d(this),S=this.bufferController=new a(this),A=this.capLevelController=new o(this),R=new c(this),B=new L.default(this),U=new F.default(this),K=new N.default(this),D=this.levelController=new w.default(this),H=new y.FragmentTracker(this),V=this.streamController=new _.default(this,H);A.setStreamController(V),R.setStreamController(V);var ne=[D,V];this.networkControllers=ne;var ie=[B,U,f,S,A,R,K,H];this.audioTrackController=this.createController(p.audioTrackController,null,ne),this.createController(p.audioStreamController,H,ne),this.subtitleTrackController=this.createController(p.subtitleTrackController,null,ne),this.createController(p.subtitleStreamController,H,ne),this.createController(p.timelineController,null,ie),this.emeController=this.createController(p.emeController,null,ie),this.cmcdController=this.createController(p.cmcdController,null,ie),this.latencyController=this.createController(O.default,null,ie),this.coreComponents=ie}var E=g.prototype;return E.createController=function(p,d,a){if(p){var o=d?new p(this,d):new p(this);return a&&a.push(o),o}return null},E.on=function(p,d,a){a===void 0&&(a=this),this._emitter.on(p,d,a)},E.once=function(p,d,a){a===void 0&&(a=this),this._emitter.once(p,d,a)},E.removeAllListeners=function(p){this._emitter.removeAllListeners(p)},E.off=function(p,d,a,o){a===void 0&&(a=this),this._emitter.off(p,d,a,o)},E.listeners=function(p){return this._emitter.listeners(p)},E.emit=function(p,d,a){return this._emitter.emit(p,d,a)},E.trigger=function(p,d){if(this.config.debug)return this.emit(p,p,d);try{return this.emit(p,p,d)}catch(a){r.logger.error("An internal error happened while handling event "+p+'. Error message: "'+a.message+'". Here is a stacktrace:',a),this.trigger(e.Events.ERROR,{type:t.ErrorTypes.OTHER_ERROR,details:t.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:p,error:a})}return!1},E.listenerCount=function(p){return this._emitter.listenerCount(p)},E.destroy=function(){r.logger.log("destroy"),this.trigger(e.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(p){return p.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(p){return p.destroy()}),this.coreComponents.length=0},E.attachMedia=function(p){r.logger.log("attachMedia"),this._media=p,this.trigger(e.Events.MEDIA_ATTACHING,{media:p})},E.detachMedia=function(){r.logger.log("detachMedia"),this.trigger(e.Events.MEDIA_DETACHING,void 0),this._media=null},E.loadSource=function(p){this.stopLoad();var d=this.media,a=this.url,o=this.url=k.buildAbsoluteURL(self.location.href,p,{alwaysNormalize:!0});r.logger.log("loadSource:"+o),d&&a&&a!==o&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(d)),this.trigger(e.Events.MANIFEST_LOADING,{url:p})},E.startLoad=function(p){p===void 0&&(p=-1),r.logger.log("startLoad("+p+")"),this.networkControllers.forEach(function(d){d.startLoad(p)})},E.stopLoad=function(){r.logger.log("stopLoad"),this.networkControllers.forEach(function(p){p.stopLoad()})},E.swapAudioCodec=function(){r.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},E.recoverMediaError=function(){r.logger.log("recoverMediaError");var p=this._media;this.detachMedia(),p&&this.attachMedia(p)},E.removeLevel=function(p,d){d===void 0&&(d=0),this.levelController.removeLevel(p,d)},T(g,[{key:"levels",get:function(){var p=this.levelController.levels;return p||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(p){r.logger.log("set currentLevel:"+p),this.loadLevel=p,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(p){r.logger.log("set nextLevel:"+p),this.levelController.manualLevel=p,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(p){r.logger.log("set loadLevel:"+p),this.levelController.manualLevel=p}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(p){this.levelController.nextLoadLevel=p}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(p){r.logger.log("set firstLevel:"+p),this.levelController.firstLevel=p}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(p){r.logger.log("set startLevel:"+p),p!==-1&&(p=Math.max(p,this.minAutoLevel)),this.levelController.startLevel=p}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(p){var d=!!p;d!==this.config.capLevelToPlayerSize&&(d?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=d)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(p){this._autoLevelCapping!==p&&(r.logger.log("set autoLevelCapping:"+p),this._autoLevelCapping=p)}},{key:"bandwidthEstimate",get:function(){var p=this.abrController.bwEstimator;return p?p.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var p=this.levels,d=this.config.minAutoBitrate;if(!p)return 0;for(var a=p.length,o=0;o<a;o++)if(p[o].maxBitrate>d)return o;return 0}},{key:"maxAutoLevel",get:function(){var p=this.levels,d=this.autoLevelCapping,a;return d===-1&&p&&p.length?a=p.length-1:a=d,a}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(p){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,p)}},{key:"audioTracks",get:function(){var p=this.audioTrackController;return p?p.audioTracks:[]}},{key:"audioTrack",get:function(){var p=this.audioTrackController;return p?p.audioTrack:-1},set:function(p){var d=this.audioTrackController;d&&(d.audioTrack=p)}},{key:"subtitleTracks",get:function(){var p=this.subtitleTrackController;return p?p.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var p=this.subtitleTrackController;return p?p.subtitleTrack:-1},set:function(p){var d=this.subtitleTrackController;d&&(d.subtitleTrack=p)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var p=this.subtitleTrackController;return p?p.subtitleDisplay:!1},set:function(p){var d=this.subtitleTrackController;d&&(d.subtitleDisplay=p)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(p){this.config.lowLatencyMode=p}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return e.Events}},{key:"ErrorTypes",get:function(){return t.ErrorTypes}},{key:"ErrorDetails",get:function(){return t.ErrorDetails}},{key:"DefaultConfig",get:function(){return g.defaultConfig?g.defaultConfig:i.hlsDefaultConfig},set:function(p){g.defaultConfig=p}}]),g}();b.defaultConfig=void 0},"./src/is-supported.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"isSupported",function(){return L}),C.d(j,"changeTypeSupported",function(){return F});var k=C("./src/utils/mediasource-helper.ts");function x(){return self.SourceBuffer||self.WebKitSourceBuffer}function L(){var N=Object(k.getMediaSource)();if(!N)return!1;var O=x(),w=N&&typeof N.isTypeSupported=="function"&&N.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),y=!O||O.prototype&&typeof O.prototype.appendBuffer=="function"&&typeof O.prototype.remove=="function";return!!w&&!!y}function F(){var N,O=x();return typeof(O==null||((N=O.prototype)===null||N===void 0)?void 0:N.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"default",function(){return r}),C.d(j,"LoadError",function(){return u});var k=C("./src/polyfills/number.ts"),x=C("./src/errors.ts");function L(l,e){l.prototype=Object.create(e.prototype),l.prototype.constructor=l,y(l,e)}function F(l){var e=typeof Map=="function"?new Map:void 0;return F=function(n){if(n===null||!w(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e!="undefined"){if(e.has(n))return e.get(n);e.set(n,T)}function T(){return N(n,arguments,_(this).constructor)}return T.prototype=Object.create(n.prototype,{constructor:{value:T,enumerable:!1,writable:!0,configurable:!0}}),y(T,n)},F(l)}function N(l,e,t){return O()?N=Reflect.construct:N=function(T,b,g){var E=[null];E.push.apply(E,b);var v=Function.bind.apply(T,E),p=new v;return g&&y(p,g.prototype),p},N.apply(null,arguments)}function O(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(l){return!1}}function w(l){return Function.toString.call(l).indexOf("[native code]")!==-1}function y(l,e){return y=Object.setPrototypeOf||function(n,T){return n.__proto__=T,n},y(l,e)}function _(l){return _=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},_(l)}var s=Math.pow(2,17),r=function(){function l(t){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=t}var e=l.prototype;return e.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},e.abort=function(){this.loader&&this.loader.abort()},e.load=function(n,T){var b=this,g=n.url;if(!g)return Promise.reject(new u({type:x.ErrorTypes.NETWORK_ERROR,details:x.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:n,networkDetails:null},"Fragment does not have a "+(g?"part list":"url")));this.abort();var E=this.config,v=E.fLoader,p=E.loader;return new Promise(function(d,a){b.loader&&b.loader.destroy();var o=b.loader=n.loader=v?new v(E):new p(E),c=i(n),f={timeout:E.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:E.fragLoadingMaxRetryTimeout,highWaterMark:s};n.stats=o.stats,o.load(c,f,{onSuccess:function(A,R,B,U){b.resetLoader(n,o),d({frag:n,part:null,payload:A.data,networkDetails:U})},onError:function(A,R,B){b.resetLoader(n,o),a(new u({type:x.ErrorTypes.NETWORK_ERROR,details:x.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:n,response:A,networkDetails:B}))},onAbort:function(A,R,B){b.resetLoader(n,o),a(new u({type:x.ErrorTypes.NETWORK_ERROR,details:x.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:n,networkDetails:B}))},onTimeout:function(A,R,B){b.resetLoader(n,o),a(new u({type:x.ErrorTypes.NETWORK_ERROR,details:x.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:n,networkDetails:B}))},onProgress:function(A,R,B,U){T&&T({frag:n,part:null,payload:B,networkDetails:U})}})})},e.loadPart=function(n,T,b){var g=this;this.abort();var E=this.config,v=E.fLoader,p=E.loader;return new Promise(function(d,a){g.loader&&g.loader.destroy();var o=g.loader=n.loader=v?new v(E):new p(E),c=i(n,T),f={timeout:E.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:E.fragLoadingMaxRetryTimeout,highWaterMark:s};T.stats=o.stats,o.load(c,f,{onSuccess:function(A,R,B,U){g.resetLoader(n,o),g.updateStatsFromPart(n,T);var K={frag:n,part:T,payload:A.data,networkDetails:U};b(K),d(K)},onError:function(A,R,B){g.resetLoader(n,o),a(new u({type:x.ErrorTypes.NETWORK_ERROR,details:x.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:n,part:T,response:A,networkDetails:B}))},onAbort:function(A,R,B){n.stats.aborted=T.stats.aborted,g.resetLoader(n,o),a(new u({type:x.ErrorTypes.NETWORK_ERROR,details:x.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:n,part:T,networkDetails:B}))},onTimeout:function(A,R,B){g.resetLoader(n,o),a(new u({type:x.ErrorTypes.NETWORK_ERROR,details:x.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:n,part:T,networkDetails:B}))}})})},e.updateStatsFromPart=function(n,T){var b=n.stats,g=T.stats,E=g.total;if(b.loaded+=g.loaded,E){var v=Math.round(n.duration/T.duration),p=Math.min(Math.round(b.loaded/E),v),d=v-p,a=d*Math.round(b.loaded/p);b.total=b.loaded+a}else b.total=Math.max(b.loaded,b.total);var o=b.loading,c=g.loading;o.start?o.first+=c.first-c.start:(o.start=c.start,o.first=c.first),o.end=c.end},e.resetLoader=function(n,T){n.loader=null,this.loader===T&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),T.destroy()},l}();function i(l,e){e===void 0&&(e=null);var t=e||l,n={frag:l,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},T=t.byteRangeStartOffset,b=t.byteRangeEndOffset;return Object(k.isFiniteNumber)(T)&&Object(k.isFiniteNumber)(b)&&(n.rangeStart=T,n.rangeEnd=b),n}var u=function(l){L(e,l);function e(t){for(var n,T=arguments.length,b=new Array(T>1?T-1:0),g=1;g<T;g++)b[g-1]=arguments[g];return n=l.call.apply(l,[this].concat(b))||this,n.data=void 0,n.data=t,n}return e}(F(Error))},"./src/loader/fragment.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"ElementaryStreamTypes",function(){return r}),C.d(j,"BaseSegment",function(){return i}),C.d(j,"Fragment",function(){return u}),C.d(j,"Part",function(){return l});var k=C("./src/polyfills/number.ts"),x=C("./node_modules/url-toolkit/src/url-toolkit.js"),L=C.n(x),F=C("./src/utils/logger.ts"),N=C("./src/loader/level-key.ts"),O=C("./src/loader/load-stats.ts");function w(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,y(e,t)}function y(e,t){return y=Object.setPrototypeOf||function(T,b){return T.__proto__=b,T},y(e,t)}function _(e,t){for(var n=0;n<t.length;n++){var T=t[n];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(e,T.key,T)}}function s(e,t,n){return t&&_(e.prototype,t),n&&_(e,n),e}var r;(function(e){e.AUDIO="audio",e.VIDEO="video",e.AUDIOVIDEO="audiovideo"})(r||(r={}));var i=function(){function e(n){var T;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(T={},T[r.AUDIO]=null,T[r.VIDEO]=null,T[r.AUDIOVIDEO]=null,T),this.baseurl=n}var t=e.prototype;return t.setByteRange=function(T,b){var g=T.split("@",2),E=[];g.length===1?E[0]=b?b.byteRangeEndOffset:0:E[0]=parseInt(g[1]),E[1]=parseInt(g[0])+E[0],this._byteRange=E},s(e,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(x.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(T){this._url=T}}]),e}(),u=function(e){w(t,e);function t(T,b){var g;return g=e.call(this,b)||this,g._decryptdata=null,g.rawProgramDateTime=null,g.programDateTime=null,g.tagList=[],g.duration=0,g.sn=0,g.levelkey=void 0,g.type=void 0,g.loader=null,g.level=-1,g.cc=0,g.startPTS=void 0,g.endPTS=void 0,g.appendedPTS=void 0,g.startDTS=void 0,g.endDTS=void 0,g.start=0,g.deltaPTS=void 0,g.maxStartPTS=void 0,g.minEndPTS=void 0,g.stats=new O.LoadStats,g.urlId=0,g.data=void 0,g.bitrateTest=!1,g.title=null,g.initSegment=null,g.type=T,g}var n=t.prototype;return n.createInitializationVector=function(b){for(var g=new Uint8Array(16),E=12;E<16;E++)g[E]=b>>8*(15-E)&255;return g},n.setDecryptDataFromLevelKey=function(b,g){var E=b;return(b==null?void 0:b.method)==="AES-128"&&b.uri&&!b.iv&&(E=N.LevelKey.fromURI(b.uri),E.method=b.method,E.iv=this.createInitializationVector(g),E.keyFormat="identity"),E},n.setElementaryStreamInfo=function(b,g,E,v,p,d){d===void 0&&(d=!1);var a=this.elementaryStreams,o=a[b];if(!o){a[b]={startPTS:g,endPTS:E,startDTS:v,endDTS:p,partial:d};return}o.startPTS=Math.min(o.startPTS,g),o.endPTS=Math.max(o.endPTS,E),o.startDTS=Math.min(o.startDTS,v),o.endDTS=Math.max(o.endDTS,p)},n.clearElementaryStreamInfo=function(){var b=this.elementaryStreams;b[r.AUDIO]=null,b[r.VIDEO]=null,b[r.AUDIOVIDEO]=null},s(t,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var b=this.sn;typeof b!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&F.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),b=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,b)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(k.isFiniteNumber)(this.programDateTime))return null;var b=Object(k.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+b*1e3}},{key:"encrypted",get:function(){var b;return!!((b=this.decryptdata)!==null&&b!==void 0&&b.keyFormat&&this.decryptdata.uri)}}]),t}(i),l=function(e){w(t,e);function t(n,T,b,g,E){var v;v=e.call(this,b)||this,v.fragOffset=0,v.duration=0,v.gap=!1,v.independent=!1,v.relurl=void 0,v.fragment=void 0,v.index=void 0,v.stats=new O.LoadStats,v.duration=n.decimalFloatingPoint("DURATION"),v.gap=n.bool("GAP"),v.independent=n.bool("INDEPENDENT"),v.relurl=n.enumeratedString("URI"),v.fragment=T,v.index=g;var p=n.enumeratedString("BYTERANGE");return p&&v.setByteRange(p,E),E&&(v.fragOffset=E.fragOffset+E.duration),v}return s(t,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var T=this.elementaryStreams;return!!(T.audio||T.video||T.audiovideo)}}]),t}(i)},"./src/loader/key-loader.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"default",function(){return F});var k=C("./src/events.ts"),x=C("./src/errors.ts"),L=C("./src/utils/logger.ts"),F=function(){function N(w){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=w,this._registerListeners()}var O=N.prototype;return O._registerListeners=function(){this.hls.on(k.Events.KEY_LOADING,this.onKeyLoading,this)},O._unregisterListeners=function(){this.hls.off(k.Events.KEY_LOADING,this.onKeyLoading)},O.destroy=function(){this._unregisterListeners();for(var y in this.loaders){var _=this.loaders[y];_&&_.destroy()}this.loaders={}},O.onKeyLoading=function(y,_){var s=_.frag,r=s.type,i=this.loaders[r];if(!s.decryptdata){L.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var u=s.decryptdata.uri;if(u!==this.decrypturl||this.decryptkey===null){var l=this.hls.config;if(i&&(L.logger.warn("abort previous key loader for type:"+r),i.abort()),!u){L.logger.warn("key uri is falsy");return}var e=l.loader,t=s.loader=this.loaders[r]=new e(l);this.decrypturl=u,this.decryptkey=null;var n={url:u,frag:s,responseType:"arraybuffer"},T={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:l.fragLoadingRetryDelay,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:0},b={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};t.load(n,T,b)}else this.decryptkey&&(s.decryptdata.key=this.decryptkey,this.hls.trigger(k.Events.KEY_LOADED,{frag:s}))},O.loadsuccess=function(y,_,s){var r=s.frag;if(!r.decryptdata){L.logger.error("after key load, decryptdata unset");return}this.decryptkey=r.decryptdata.key=new Uint8Array(y.data),r.loader=null,delete this.loaders[r.type],this.hls.trigger(k.Events.KEY_LOADED,{frag:r})},O.loaderror=function(y,_){var s=_.frag,r=s.loader;r&&r.abort(),delete this.loaders[s.type],this.hls.trigger(k.Events.ERROR,{type:x.ErrorTypes.NETWORK_ERROR,details:x.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:s,response:y})},O.loadtimeout=function(y,_){var s=_.frag,r=s.loader;r&&r.abort(),delete this.loaders[s.type],this.hls.trigger(k.Events.ERROR,{type:x.ErrorTypes.NETWORK_ERROR,details:x.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:s})},N}()},"./src/loader/level-details.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"LevelDetails",function(){return N});var k=C("./src/polyfills/number.ts");function x(O,w){for(var y=0;y<w.length;y++){var _=w[y];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(O,_.key,_)}}function L(O,w,y){return w&&x(O.prototype,w),y&&x(O,y),O}var F=10,N=function(){function O(y){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=y}var w=O.prototype;return w.reloaded=function(_){if(!_){this.advanced=!0,this.updated=!0;return}var s=this.lastPartSn-_.lastPartSn,r=this.lastPartIndex-_.lastPartIndex;this.updated=this.endSN!==_.endSN||!!r||!!s,this.advanced=this.endSN>_.endSN||s>0||s===0&&r>0,this.updated||this.advanced?this.misses=Math.floor(_.misses*.6):this.misses=_.misses+1,this.availabilityDelay=_.availabilityDelay},L(O,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(k.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||F}},{key:"drift",get:function(){var _=this.driftEndTime-this.driftStartTime;if(_>0){var s=this.driftEnd-this.driftStart;return s*1e3/_}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var _;return(_=this.partList)!==null&&_!==void 0&&_.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var _;return(_=this.fragments)!==null&&_!==void 0&&_.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 _;return(_=this.partList)!==null&&_!==void 0&&_.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var _;return(_=this.partList)!==null&&_!==void 0&&_.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),O}()},"./src/loader/level-key.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"LevelKey",function(){return N});var k=C("./node_modules/url-toolkit/src/url-toolkit.js"),x=C.n(k);function L(O,w){for(var y=0;y<w.length;y++){var _=w[y];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(O,_.key,_)}}function F(O,w,y){return w&&L(O.prototype,w),y&&L(O,y),O}var N=function(){O.fromURL=function(y,_){return new O(y,_)},O.fromURI=function(y){return new O(y)};function O(w,y){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,y?this._uri=Object(k.buildAbsoluteURL)(w,y,{alwaysNormalize:!0}):this._uri=w}return F(O,[{key:"uri",get:function(){return this._uri}}]),O}()},"./src/loader/load-stats.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"LoadStats",function(){return k});var k=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"default",function(){return t});var k=C("./src/polyfills/number.ts"),x=C("./node_modules/url-toolkit/src/url-toolkit.js"),L=C.n(x),F=C("./src/loader/fragment.ts"),N=C("./src/loader/level-details.ts"),O=C("./src/loader/level-key.ts"),w=C("./src/utils/attr-list.ts"),y=C("./src/utils/logger.ts"),_=C("./src/utils/codecs.ts"),s=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,r=/#EXT-X-MEDIA:(.*)/g,i=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),u=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),l=/\.(mp4|m4s|m4v|m4a)$/i;function e(E){var v,p;return l.test((v=(p=x.parseURL(E))===null||p===void 0?void 0:p.path)!=null?v:"")}var t=function(){function E(){}return E.findGroup=function(p,d){for(var a=0;a<p.length;a++){var o=p[a];if(o.id===d)return o}},E.convertAVC1ToAVCOTI=function(p){var d=p.split(".");if(d.length>2){var a=d.shift()+".";return a+=parseInt(d.shift()).toString(16),a+=("000"+parseInt(d.shift()).toString(16)).substr(-4),a}return p},E.resolve=function(p,d){return x.buildAbsoluteURL(d,p,{alwaysNormalize:!0})},E.parseMasterPlaylist=function(p,d){var a=[],o={},c=!1;s.lastIndex=0;for(var f;(f=s.exec(p))!=null;)if(f[1]){var S=new w.AttrList(f[1]),A={attrs:S,bitrate:S.decimalInteger("AVERAGE-BANDWIDTH")||S.decimalInteger("BANDWIDTH"),name:S.NAME,url:E.resolve(f[2],d)},R=S.decimalResolution("RESOLUTION");R&&(A.width=R.width,A.height=R.height),n((S.CODECS||"").split(/[ ,]+/).filter(function(U){return U}),A),A.videoCodec&&A.videoCodec.indexOf("avc1")!==-1&&(A.videoCodec=E.convertAVC1ToAVCOTI(A.videoCodec)),a.push(A)}else if(f[3]){var B=new w.AttrList(f[3]);B["DATA-ID"]&&(c=!0,o[B["DATA-ID"]]=B)}return{levels:a,sessionData:c?o:null}},E.parseMasterPlaylistMedia=function(p,d,a,o){o===void 0&&(o=[]);var c,f=[],S=0;for(r.lastIndex=0;(c=r.exec(p))!==null;){var A=new w.AttrList(c[1]);if(A.TYPE===a){var R={attrs:A,bitrate:0,id:S++,groupId:A["GROUP-ID"],instreamId:A["INSTREAM-ID"],name:A.NAME||A.LANGUAGE||"",type:a,default:A.bool("DEFAULT"),autoselect:A.bool("AUTOSELECT"),forced:A.bool("FORCED"),lang:A.LANGUAGE,url:A.URI?E.resolve(A.URI,d):""};if(o.length){var B=E.findGroup(o,R.groupId)||o[0];T(R,B,"audioCodec"),T(R,B,"textCodec")}f.push(R)}}return f},E.parseLevelPlaylist=function(p,d,a,o,c){var f=new N.LevelDetails(d),S=f.fragments,A=null,R=0,B=0,U=0,K=0,D=null,H=new F.Fragment(o,d),V,ne,ie,_e=-1,ye=!1;for(i.lastIndex=0,f.m3u8=p;(V=i.exec(p))!==null;){ye&&(ye=!1,H=new F.Fragment(o,d),H.start=U,H.sn=R,H.cc=K,H.level=a,A&&(H.initSegment=A,H.rawProgramDateTime=A.rawProgramDateTime));var be=V[1];if(be){H.duration=parseFloat(be);var we=(" "+V[2]).slice(1);H.title=we||null,H.tagList.push(we?["INF",be,we]:["INF",be])}else if(V[3])Object(k.isFiniteNumber)(H.duration)&&(H.start=U,ie&&(H.levelkey=ie),H.sn=R,H.level=a,H.cc=K,H.urlId=c,S.push(H),H.relurl=(" "+V[3]).slice(1),g(H,D),D=H,U+=H.duration,R++,B=0,ye=!0);else if(V[4]){var Re=(" "+V[4]).slice(1);D?H.setByteRange(Re,D):H.setByteRange(Re)}else if(V[5])H.rawProgramDateTime=(" "+V[5]).slice(1),H.tagList.push(["PROGRAM-DATE-TIME",H.rawProgramDateTime]),_e===-1&&(_e=S.length);else{if(V=V[0].match(u),!V){y.logger.warn("No matches on slow regex match for level playlist!");continue}for(ne=1;ne<V.length&&!(typeof V[ne]!="undefined");ne++);var ge=(" "+V[ne]).slice(1),Q=(" "+V[ne+1]).slice(1),Pe=V[ne+2]?(" "+V[ne+2]).slice(1):"";switch(ge){case"PLAYLIST-TYPE":f.type=Q.toUpperCase();break;case"MEDIA-SEQUENCE":R=f.startSN=parseInt(Q);break;case"SKIP":{var $e=new w.AttrList(Q),Fe=$e.decimalInteger("SKIPPED-SEGMENTS");if(Object(k.isFiniteNumber)(Fe)){f.skippedSegments=Fe;for(var Me=Fe;Me--;)S.unshift(null);R+=Fe}var ze=$e.enumeratedString("RECENTLY-REMOVED-DATERANGES");ze&&(f.recentlyRemovedDateranges=ze.split(" "));break}case"TARGETDURATION":f.targetduration=parseFloat(Q);break;case"VERSION":f.version=parseInt(Q);break;case"EXTM3U":break;case"ENDLIST":f.live=!1;break;case"#":(Q||Pe)&&H.tagList.push(Pe?[Q,Pe]:[Q]);break;case"DIS":K++;case"GAP":H.tagList.push([ge]);break;case"BITRATE":H.tagList.push([ge,Q]);break;case"DISCONTINUITY-SEQ":K=parseInt(Q);break;case"KEY":{var xe,ke=new w.AttrList(Q),je=ke.enumeratedString("METHOD"),Ge=ke.URI,Ue=ke.hexadecimalInteger("IV"),Le=ke.enumeratedString("KEYFORMATVERSIONS"),Ae=ke.enumeratedString("KEYID"),nt=(xe=ke.enumeratedString("KEYFORMAT"))!=null?xe:"identity",Qe=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Qe.indexOf(nt)>-1){y.logger.warn("Keyformat "+nt+" is not supported from the manifest");continue}else if(nt!=="identity")continue;je&&(ie=O.LevelKey.fromURL(d,Ge),Ge&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(je)>=0&&(ie.method=je,ie.keyFormat=nt,Ae&&(ie.keyID=Ae),Le&&(ie.keyFormatVersions=Le),ie.iv=Ue));break}case"START":{var Ze=new w.AttrList(Q),Ye=Ze.decimalFloatingPoint("TIME-OFFSET");Object(k.isFiniteNumber)(Ye)&&(f.startTimeOffset=Ye);break}case"MAP":{var at=new w.AttrList(Q);H.relurl=at.URI,at.BYTERANGE&&H.setByteRange(at.BYTERANGE),H.level=a,H.sn="initSegment",ie&&(H.levelkey=ie),H.initSegment=null,A=H,ye=!0;break}case"SERVER-CONTROL":{var qe=new w.AttrList(Q);f.canBlockReload=qe.bool("CAN-BLOCK-RELOAD"),f.canSkipUntil=qe.optionalFloat("CAN-SKIP-UNTIL",0),f.canSkipDateRanges=f.canSkipUntil>0&&qe.bool("CAN-SKIP-DATERANGES"),f.partHoldBack=qe.optionalFloat("PART-HOLD-BACK",0),f.holdBack=qe.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Xe=new w.AttrList(Q);f.partTarget=Xe.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Be=f.partList;Be||(Be=f.partList=[]);var rt=B>0?Be[Be.length-1]:void 0,Je=B++,Ee=new F.Part(new w.AttrList(Q),H,d,Je,rt);Be.push(Ee),H.duration+=Ee.duration;break}case"PRELOAD-HINT":{var He=new w.AttrList(Q);f.preloadHint=He;break}case"RENDITION-REPORT":{var de=new w.AttrList(Q);f.renditionReports=f.renditionReports||[],f.renditionReports.push(de);break}default:y.logger.warn("line parsed but not handled: "+V);break}}}D&&!D.relurl?(S.pop(),U-=D.duration,f.partList&&(f.fragmentHint=D)):f.partList&&(g(H,D),H.cc=K,f.fragmentHint=H);var oe=S.length,ue=S[0],Y=S[oe-1];if(U+=f.skippedSegments*f.targetduration,U>0&&oe&&Y){f.averagetargetduration=U/oe;var X=Y.sn;f.endSN=X!=="initSegment"?X:0,ue&&(f.startCC=ue.cc,ue.initSegment||f.fragments.every(function(Z){return Z.relurl&&e(Z.relurl)})&&(y.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),H=new F.Fragment(o,d),H.relurl=Y.relurl,H.level=a,H.sn="initSegment",ue.initSegment=H,f.needSidxRanges=!0))}else f.endSN=0,f.startCC=0;return f.fragmentHint&&(U+=f.fragmentHint.duration),f.totalduration=U,f.endCC=K,_e>0&&b(S,_e),f},E}();function n(E,v){["video","audio","text"].forEach(function(p){var d=E.filter(function(o){return Object(_.isCodecType)(o,p)});if(d.length){var a=d.filter(function(o){return o.lastIndexOf("avc1",0)===0||o.lastIndexOf("mp4a",0)===0});v[p+"Codec"]=a.length>0?a[0]:d[0],E=E.filter(function(o){return d.indexOf(o)===-1})}}),v.unknownCodecs=E}function T(E,v,p){var d=v[p];d&&(E[p]=d)}function b(E,v){for(var p=E[v],d=v;d--;){var a=E[d];if(!a)return;a.programDateTime=p.programDateTime-a.duration*1e3,p=a}}function g(E,v){E.rawProgramDateTime?E.programDateTime=Date.parse(E.rawProgramDateTime):v!=null&&v.programDateTime&&(E.programDateTime=v.endProgramDateTime),Object(k.isFiniteNumber)(E.programDateTime)||(E.programDateTime=null,E.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(pe,j,C){"use strict";C.r(j);var k=C("./src/polyfills/number.ts"),x=C("./src/events.ts"),L=C("./src/errors.ts"),F=C("./src/utils/logger.ts"),N=C("./src/utils/mp4-tools.ts"),O=C("./src/loader/m3u8-parser.ts"),w=C("./src/types/loader.ts"),y=C("./src/utils/attr-list.ts");function _(i){var u=i.type;switch(u){case w.PlaylistContextType.AUDIO_TRACK:return w.PlaylistLevelType.AUDIO;case w.PlaylistContextType.SUBTITLE_TRACK:return w.PlaylistLevelType.SUBTITLE;default:return w.PlaylistLevelType.MAIN}}function s(i,u){var l=i.url;return(l===void 0||l.indexOf("data:")===0)&&(l=u.url),l}var r=function(){function i(l){this.hls=void 0,this.loaders=Object.create(null),this.hls=l,this.registerListeners()}var u=i.prototype;return u.registerListeners=function(){var e=this.hls;e.on(x.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(x.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(x.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(x.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},u.unregisterListeners=function(){var e=this.hls;e.off(x.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(x.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(x.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(x.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},u.createInternalLoader=function(e){var t=this.hls.config,n=t.pLoader,T=t.loader,b=n||T,g=new b(t);return e.loader=g,this.loaders[e.type]=g,g},u.getInternalLoader=function(e){return this.loaders[e.type]},u.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},u.destroyInternalLoaders=function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}},u.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},u.onManifestLoading=function(e,t){var n=t.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:w.PlaylistContextType.MANIFEST,url:n,deliveryDirectives:null})},u.onLevelLoading=function(e,t){var n=t.id,T=t.level,b=t.url,g=t.deliveryDirectives;this.load({id:n,groupId:null,level:T,responseType:"text",type:w.PlaylistContextType.LEVEL,url:b,deliveryDirectives:g})},u.onAudioTrackLoading=function(e,t){var n=t.id,T=t.groupId,b=t.url,g=t.deliveryDirectives;this.load({id:n,groupId:T,level:null,responseType:"text",type:w.PlaylistContextType.AUDIO_TRACK,url:b,deliveryDirectives:g})},u.onSubtitleTrackLoading=function(e,t){var n=t.id,T=t.groupId,b=t.url,g=t.deliveryDirectives;this.load({id:n,groupId:T,level:null,responseType:"text",type:w.PlaylistContextType.SUBTITLE_TRACK,url:b,deliveryDirectives:g})},u.load=function(e){var t,n=this.hls.config,T=this.getInternalLoader(e);if(T){var b=T.context;if(b&&b.url===e.url){F.logger.trace("[playlist-loader]: playlist request ongoing");return}F.logger.log("[playlist-loader]: aborting previous loader for type: "+e.type),T.abort()}var g,E,v,p;switch(e.type){case w.PlaylistContextType.MANIFEST:g=n.manifestLoadingMaxRetry,E=n.manifestLoadingTimeOut,v=n.manifestLoadingRetryDelay,p=n.manifestLoadingMaxRetryTimeout;break;case w.PlaylistContextType.LEVEL:case w.PlaylistContextType.AUDIO_TRACK:case w.PlaylistContextType.SUBTITLE_TRACK:g=0,E=n.levelLoadingTimeOut;break;default:g=n.levelLoadingMaxRetry,E=n.levelLoadingTimeOut,v=n.levelLoadingRetryDelay,p=n.levelLoadingMaxRetryTimeout;break}if(T=this.createInternalLoader(e),(t=e.deliveryDirectives)!==null&&t!==void 0&&t.part){var d;if(e.type===w.PlaylistContextType.LEVEL&&e.level!==null?d=this.hls.levels[e.level].details:e.type===w.PlaylistContextType.AUDIO_TRACK&&e.id!==null?d=this.hls.audioTracks[e.id].details:e.type===w.PlaylistContextType.SUBTITLE_TRACK&&e.id!==null&&(d=this.hls.subtitleTracks[e.id].details),d){var a=d.partTarget,o=d.targetduration;a&&o&&(E=Math.min(Math.max(a*3,o*.8)*1e3,E))}}var c={timeout:E,maxRetry:g,retryDelay:v,maxRetryDelay:p,highWaterMark:0},f={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};T.load(e,c,f)},u.loadsuccess=function(e,t,n,T){if(T===void 0&&(T=null),n.isSidxRequest){this.handleSidxRequest(e,n),this.handlePlaylistLoaded(e,t,n,T);return}this.resetInternalLoader(n.type);var b=e.data;if(b.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(e,n,"no EXTM3U delimiter",T);return}t.parsing.start=performance.now(),b.indexOf("#EXTINF:")>0||b.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(e,t,n,T):this.handleMasterPlaylist(e,t,n,T)},u.loaderror=function(e,t,n){n===void 0&&(n=null),this.handleNetworkError(t,n,!1,e)},u.loadtimeout=function(e,t,n){n===void 0&&(n=null),this.handleNetworkError(t,n,!0)},u.handleMasterPlaylist=function(e,t,n,T){var b=this.hls,g=e.data,E=s(e,n),v=O.default.parseMasterPlaylist(g,E),p=v.levels,d=v.sessionData;if(!p.length){this.handleManifestParsingError(e,n,"no level found in manifest",T);return}var a=p.map(function(R){return{id:R.attrs.AUDIO,audioCodec:R.audioCodec}}),o=p.map(function(R){return{id:R.attrs.SUBTITLES,textCodec:R.textCodec}}),c=O.default.parseMasterPlaylistMedia(g,E,"AUDIO",a),f=O.default.parseMasterPlaylistMedia(g,E,"SUBTITLES",o),S=O.default.parseMasterPlaylistMedia(g,E,"CLOSED-CAPTIONS");if(c.length){var A=c.some(function(R){return!R.url});!A&&p[0].audioCodec&&!p[0].attrs.AUDIO&&(F.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),c.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new y.AttrList({}),bitrate:0,url:""}))}b.trigger(x.Events.MANIFEST_LOADED,{levels:p,audioTracks:c,subtitles:f,captions:S,url:E,stats:t,networkDetails:T,sessionData:d})},u.handleTrackOrLevelPlaylist=function(e,t,n,T){var b=this.hls,g=n.id,E=n.level,v=n.type,p=s(e,n),d=Object(k.isFiniteNumber)(g)?g:0,a=Object(k.isFiniteNumber)(E)?E:d,o=_(n),c=O.default.parseLevelPlaylist(e.data,p,a,o,d);if(!c.fragments.length){b.trigger(x.Events.ERROR,{type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:p,reason:"no fragments found in level",level:typeof n.level=="number"?n.level:void 0});return}if(v===w.PlaylistContextType.MANIFEST){var f={attrs:new y.AttrList({}),bitrate:0,details:c,name:"",url:p};b.trigger(x.Events.MANIFEST_LOADED,{levels:[f],audioTracks:[],url:p,stats:t,networkDetails:T,sessionData:null})}if(t.parsing.end=performance.now(),c.needSidxRanges){var S,A=(S=c.fragments[0].initSegment)===null||S===void 0?void 0:S.url;this.load({url:A,isSidxRequest:!0,type:v,level:E,levelDetails:c,id:g,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}n.levelDetails=c,this.handlePlaylistLoaded(e,t,n,T)},u.handleSidxRequest=function(e,t){var n=Object(N.parseSegmentIndex)(new Uint8Array(e.data));if(!n)return;var T=n.references,b=t.levelDetails;T.forEach(function(g,E){var v=g.info,p=b.fragments[E];p.byteRange.length===0&&p.setByteRange(String(1+v.end-v.start)+"@"+String(v.start)),p.initSegment&&p.initSegment.setByteRange(String(n.moovEndOffset)+"@0")})},u.handleManifestParsingError=function(e,t,n,T){this.hls.trigger(x.Events.ERROR,{type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:t.type===w.PlaylistContextType.MANIFEST,url:e.url,reason:n,response:e,context:t,networkDetails:T})},u.handleNetworkError=function(e,t,n,T){n===void 0&&(n=!1),F.logger.warn("[playlist-loader]: A network "+(n?"timeout":"error")+" occurred while loading "+e.type+" level: "+e.level+" id: "+e.id+' group-id: "'+e.groupId+'"');var b=L.ErrorDetails.UNKNOWN,g=!1,E=this.getInternalLoader(e);switch(e.type){case w.PlaylistContextType.MANIFEST:b=n?L.ErrorDetails.MANIFEST_LOAD_TIMEOUT:L.ErrorDetails.MANIFEST_LOAD_ERROR,g=!0;break;case w.PlaylistContextType.LEVEL:b=n?L.ErrorDetails.LEVEL_LOAD_TIMEOUT:L.ErrorDetails.LEVEL_LOAD_ERROR,g=!1;break;case w.PlaylistContextType.AUDIO_TRACK:b=n?L.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:L.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,g=!1;break;case w.PlaylistContextType.SUBTITLE_TRACK:b=n?L.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:L.ErrorDetails.SUBTITLE_LOAD_ERROR,g=!1;break}E&&this.resetInternalLoader(e.type);var v={type:L.ErrorTypes.NETWORK_ERROR,details:b,fatal:g,url:e.url,loader:E,context:e,networkDetails:t};T&&(v.response=T),this.hls.trigger(x.Events.ERROR,v)},u.handlePlaylistLoaded=function(e,t,n,T){var b=n.type,g=n.level,E=n.id,v=n.groupId,p=n.loader,d=n.levelDetails,a=n.deliveryDirectives;if(!(d!=null&&d.targetduration)){this.handleManifestParsingError(e,n,"invalid target duration",T);return}if(!p)return;d.live&&(p.getCacheAge&&(d.ageHeader=p.getCacheAge()||0),(!p.getCacheAge||isNaN(d.ageHeader))&&(d.ageHeader=0));switch(b){case w.PlaylistContextType.MANIFEST:case w.PlaylistContextType.LEVEL:this.hls.trigger(x.Events.LEVEL_LOADED,{details:d,level:g||0,id:E||0,stats:t,networkDetails:T,deliveryDirectives:a});break;case w.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(x.Events.AUDIO_TRACK_LOADED,{details:d,id:E||0,groupId:v||"",stats:t,networkDetails:T,deliveryDirectives:a});break;case w.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(x.Events.SUBTITLE_TRACK_LOADED,{details:d,id:E||0,groupId:v||"",stats:t,networkDetails:T,deliveryDirectives:a});break}},i}();j.default=r},"./src/polyfills/number.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"isFiniteNumber",function(){return k}),C.d(j,"MAX_SAFE_INTEGER",function(){return x});var k=Number.isFinite||function(L){return typeof L=="number"&&isFinite(L)},x=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(pe,j,C){"use strict";C.r(j);var k=function(){function x(){}return x.getSilentFrame=function(F,N){switch(F){case"mp4a.40.2":if(N===1)return new Uint8Array([0,200,0,128,35,128]);if(N===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(N===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(N===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(N===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(N===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(N===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(N===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(N===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},x}();j.default=k},"./src/remux/mp4-generator.ts":function(pe,j,C){"use strict";C.r(j);var k=Math.pow(2,32)-1,x=function(){function L(){}return L.init=function(){L.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var N;for(N in L.types)L.types.hasOwnProperty(N)&&(L.types[N]=[N.charCodeAt(0),N.charCodeAt(1),N.charCodeAt(2),N.charCodeAt(3)]);var O=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]);L.HDLR_TYPES={video:O,audio:w};var y=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),_=new Uint8Array([0,0,0,0,0,0,0,0]);L.STTS=L.STSC=L.STCO=_,L.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),L.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),L.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),L.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var s=new Uint8Array([105,115,111,109]),r=new Uint8Array([97,118,99,49]),i=new Uint8Array([0,0,0,1]);L.FTYP=L.box(L.types.ftyp,s,i,s,r),L.DINF=L.box(L.types.dinf,L.box(L.types.dref,y))},L.box=function(N){for(var O=8,w=arguments.length,y=new Array(w>1?w-1:0),_=1;_<w;_++)y[_-1]=arguments[_];for(var s=y.length,r=s;s--;)O+=y[s].byteLength;var i=new Uint8Array(O);for(i[0]=O>>24&255,i[1]=O>>16&255,i[2]=O>>8&255,i[3]=O&255,i.set(N,4),s=0,O=8;s<r;s++)i.set(y[s],O),O+=y[s].byteLength;return i},L.hdlr=function(N){return L.box(L.types.hdlr,L.HDLR_TYPES[N])},L.mdat=function(N){return L.box(L.types.mdat,N)},L.mdhd=function(N,O){O*=N;var w=Math.floor(O/(k+1)),y=Math.floor(O%(k+1));return L.box(L.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,N>>24&255,N>>16&255,N>>8&255,N&255,w>>24,w>>16&255,w>>8&255,w&255,y>>24,y>>16&255,y>>8&255,y&255,85,196,0,0]))},L.mdia=function(N){return L.box(L.types.mdia,L.mdhd(N.timescale,N.duration),L.hdlr(N.type),L.minf(N))},L.mfhd=function(N){return L.box(L.types.mfhd,new Uint8Array([0,0,0,0,N>>24,N>>16&255,N>>8&255,N&255]))},L.minf=function(N){return N.type==="audio"?L.box(L.types.minf,L.box(L.types.smhd,L.SMHD),L.DINF,L.stbl(N)):L.box(L.types.minf,L.box(L.types.vmhd,L.VMHD),L.DINF,L.stbl(N))},L.moof=function(N,O,w){return L.box(L.types.moof,L.mfhd(N),L.traf(w,O))},L.moov=function(N){for(var O=N.length,w=[];O--;)w[O]=L.trak(N[O]);return L.box.apply(null,[L.types.moov,L.mvhd(N[0].timescale,N[0].duration)].concat(w).concat(L.mvex(N)))},L.mvex=function(N){for(var O=N.length,w=[];O--;)w[O]=L.trex(N[O]);return L.box.apply(null,[L.types.mvex].concat(w))},L.mvhd=function(N,O){O*=N;var w=Math.floor(O/(k+1)),y=Math.floor(O%(k+1)),_=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,N>>24&255,N>>16&255,N>>8&255,N&255,w>>24,w>>16&255,w>>8&255,w&255,y>>24,y>>16&255,y>>8&255,y&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return L.box(L.types.mvhd,_)},L.sdtp=function(N){var O=N.samples||[],w=new Uint8Array(4+O.length),y,_;for(y=0;y<O.length;y++)_=O[y].flags,w[y+4]=_.dependsOn<<4|_.isDependedOn<<2|_.hasRedundancy;return L.box(L.types.sdtp,w)},L.stbl=function(N){return L.box(L.types.stbl,L.stsd(N),L.box(L.types.stts,L.STTS),L.box(L.types.stsc,L.STSC),L.box(L.types.stsz,L.STSZ),L.box(L.types.stco,L.STCO))},L.avc1=function(N){var O=[],w=[],y,_,s;for(y=0;y<N.sps.length;y++)_=N.sps[y],s=_.byteLength,O.push(s>>>8&255),O.push(s&255),O=O.concat(Array.prototype.slice.call(_));for(y=0;y<N.pps.length;y++)_=N.pps[y],s=_.byteLength,w.push(s>>>8&255),w.push(s&255),w=w.concat(Array.prototype.slice.call(_));var r=L.box(L.types.avcC,new Uint8Array([1,O[3],O[4],O[5],252|3,224|N.sps.length].concat(O).concat([N.pps.length]).concat(w))),i=N.width,u=N.height,l=N.pixelRatio[0],e=N.pixelRatio[1];return L.box(L.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,i>>8&255,i&255,u>>8&255,u&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),r,L.box(L.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),L.box(L.types.pasp,new Uint8Array([l>>24,l>>16&255,l>>8&255,l&255,e>>24,e>>16&255,e>>8&255,e&255])))},L.esds=function(N){var O=N.config.length;return new Uint8Array([0,0,0,0,3,23+O,0,1,0,4,15+O,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([O]).concat(N.config).concat([6,1,2]))},L.mp4a=function(N){var O=N.samplerate;return L.box(L.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,N.channelCount,0,16,0,0,0,0,O>>8&255,O&255,0,0]),L.box(L.types.esds,L.esds(N)))},L.mp3=function(N){var O=N.samplerate;return L.box(L.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,N.channelCount,0,16,0,0,0,0,O>>8&255,O&255,0,0]))},L.stsd=function(N){return N.type==="audio"?!N.isAAC&&N.codec==="mp3"?L.box(L.types.stsd,L.STSD,L.mp3(N)):L.box(L.types.stsd,L.STSD,L.mp4a(N)):L.box(L.types.stsd,L.STSD,L.avc1(N))},L.tkhd=function(N){var O=N.id,w=N.duration*N.timescale,y=N.width,_=N.height,s=Math.floor(w/(k+1)),r=Math.floor(w%(k+1));return L.box(L.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,O>>24&255,O>>16&255,O>>8&255,O&255,0,0,0,0,s>>24,s>>16&255,s>>8&255,s&255,r>>24,r>>16&255,r>>8&255,r&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,y>>8&255,y&255,0,0,_>>8&255,_&255,0,0]))},L.traf=function(N,O){var w=L.sdtp(N),y=N.id,_=Math.floor(O/(k+1)),s=Math.floor(O%(k+1));return L.box(L.types.traf,L.box(L.types.tfhd,new Uint8Array([0,0,0,0,y>>24,y>>16&255,y>>8&255,y&255])),L.box(L.types.tfdt,new Uint8Array([1,0,0,0,_>>24,_>>16&255,_>>8&255,_&255,s>>24,s>>16&255,s>>8&255,s&255])),L.trun(N,w.length+16+20+8+16+8+8),w)},L.trak=function(N){return N.duration=N.duration||4294967295,L.box(L.types.trak,L.tkhd(N),L.mdia(N))},L.trex=function(N){var O=N.id;return L.box(L.types.trex,new Uint8Array([0,0,0,0,O>>24,O>>16&255,O>>8&255,O&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},L.trun=function(N,O){var w=N.samples||[],y=w.length,_=12+16*y,s=new Uint8Array(_),r,i,u,l,e,t;for(O+=8+_,s.set([0,0,15,1,y>>>24&255,y>>>16&255,y>>>8&255,y&255,O>>>24&255,O>>>16&255,O>>>8&255,O&255],0),r=0;r<y;r++)i=w[r],u=i.duration,l=i.size,e=i.flags,t=i.cts,s.set([u>>>24&255,u>>>16&255,u>>>8&255,u&255,l>>>24&255,l>>>16&255,l>>>8&255,l&255,e.isLeading<<2|e.dependsOn,e.isDependedOn<<6|e.hasRedundancy<<4|e.paddingValue<<1|e.isNonSync,e.degradPrio&240<<8,e.degradPrio&15,t>>>24&255,t>>>16&255,t>>>8&255,t&255],12+16*r);return L.box(L.types.trun,s)},L.initSegment=function(N){L.types||L.init();var O=L.moov(N),w=new Uint8Array(L.FTYP.byteLength+O.byteLength);return w.set(L.FTYP),w.set(O,L.FTYP.byteLength),w},L}();x.types=void 0,x.HDLR_TYPES=void 0,x.STTS=void 0,x.STSC=void 0,x.STCO=void 0,x.STSZ=void 0,x.VMHD=void 0,x.SMHD=void 0,x.STSD=void 0,x.FTYP=void 0,x.DINF=void 0,j.default=x},"./src/remux/mp4-remuxer.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"default",function(){return t}),C.d(j,"normalizePts",function(){return n});var k=C("./src/polyfills/number.ts"),x=C("./src/remux/aac-helper.ts"),L=C("./src/remux/mp4-generator.ts"),F=C("./src/events.ts"),N=C("./src/errors.ts"),O=C("./src/utils/logger.ts"),w=C("./src/types/loader.ts"),y=C("./src/utils/timescale-conversion.ts");function _(){return _=Object.assign||function(E){for(var v=1;v<arguments.length;v++){var p=arguments[v];for(var d in p)Object.prototype.hasOwnProperty.call(p,d)&&(E[d]=p[d])}return E},_.apply(this,arguments)}var s=10*1e3,r=1024,i=1152,u=null,l=null,e=!1,t=function(){function E(p,d,a,o){if(o===void 0&&(o=""),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=p,this.config=d,this.typeSupported=a,this.ISGenerated=!1,u===null){var c=navigator.userAgent||"",f=c.match(/Chrome\/(\d+)/i);u=f?parseInt(f[1]):0}if(l===null){var S=navigator.userAgent.match(/Safari\/(\d+)/i);l=S?parseInt(S[1]):0}e=!!u&&u<75||!!l&&l<600}var v=E.prototype;return v.destroy=function(){},v.resetTimeStamp=function(d){O.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=d},v.resetNextTimestamp=function(){O.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},v.resetInitSegment=function(){O.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},v.getVideoStartPts=function(d){var a=!1,o=d.reduce(function(c,f){var S=f.pts-c;return S<-4294967296?(a=!0,n(c,f.pts)):S>0?c:f.pts},d[0].pts);return a&&O.logger.debug("PTS rollover detected"),o},v.remux=function(d,a,o,c,f,S,A,R){var B,U,K,D,H,V,ne=f,ie=f,_e=d.pid>-1,ye=a.pid>-1,be=a.samples.length,we=d.samples.length>0,Re=be>1,ge=(!_e||we)&&(!ye||Re)||this.ISGenerated||A;if(ge){this.ISGenerated||(K=this.generateIS(d,a,f));var Q=this.isVideoContiguous,Pe=-1;if(Re&&(Pe=T(a.samples),!Q&&this.config.forceKeyFrameOnDiscontinuity))if(V=!0,Pe>0){O.logger.warn("[mp4-remuxer]: Dropped "+Pe+" out of "+be+" video samples due to a missing keyframe");var $e=this.getVideoStartPts(a.samples);a.samples=a.samples.slice(Pe),a.dropped+=Pe,ie+=(a.samples[0].pts-$e)/(a.timescale||9e4)}else Pe===-1&&(O.logger.warn("[mp4-remuxer]: No keyframe found out of "+be+" video samples"),V=!1);if(this.ISGenerated){if(we&&Re){var Fe=this.getVideoStartPts(a.samples),Me=n(d.samples[0].pts,Fe)-Fe,ze=Me/a.inputTimeScale;ne+=Math.max(0,ze),ie+=Math.max(0,-ze)}if(we){if(d.samplerate||(O.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),K=this.generateIS(d,a,f)),U=this.remuxAudio(d,ne,this.isAudioContiguous,S,ye||Re||R===w.PlaylistLevelType.AUDIO?ie:void 0),Re){var xe=U?U.endPTS-U.startPTS:0;a.inputTimeScale||(O.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),K=this.generateIS(d,a,f)),B=this.remuxVideo(a,ie,Q,xe)}}else Re&&(B=this.remuxVideo(a,ie,Q,0));B&&(B.firstKeyFrame=Pe,B.independent=Pe!==-1)}}return this.ISGenerated&&(o.samples.length&&(H=this.remuxID3(o,f)),c.samples.length&&(D=this.remuxText(c,f))),{audio:U,video:B,initSegment:K,independent:V,text:D,id3:H}},v.generateIS=function(d,a,o){var c=d.samples,f=a.samples,S=this.typeSupported,A={},R=!Object(k.isFiniteNumber)(this._initPTS),B="audio/mp4",U,K,D;if(R&&(U=K=Infinity),d.config&&c.length&&(d.timescale=d.samplerate,d.isAAC||(S.mpeg?(B="audio/mpeg",d.codec=""):S.mp3&&(d.codec="mp3")),A.audio={id:"audio",container:B,codec:d.codec,initSegment:!d.isAAC&&S.mpeg?new Uint8Array(0):L.default.initSegment([d]),metadata:{channelCount:d.channelCount}},R&&(D=d.inputTimeScale,U=K=c[0].pts-Math.round(D*o))),a.sps&&a.pps&&f.length&&(a.timescale=a.inputTimeScale,A.video={id:"main",container:"video/mp4",codec:a.codec,initSegment:L.default.initSegment([a]),metadata:{width:a.width,height:a.height}},R)){D=a.inputTimeScale;var H=this.getVideoStartPts(f),V=Math.round(D*o);K=Math.min(K,n(f[0].dts,H)-V),U=Math.min(U,H-V)}if(Object.keys(A).length)return this.ISGenerated=!0,R&&(this._initPTS=U,this._initDTS=K),{tracks:A,initPTS:U,timescale:D}},v.remuxVideo=function(d,a,o,c){var f=d.inputTimeScale,S=d.samples,A=[],R=S.length,B=this._initPTS,U=this.nextAvcDts,K=8,D,H,V,ne=Number.POSITIVE_INFINITY,ie=Number.NEGATIVE_INFINITY,_e=0,ye=!1;if(!o||U===null){var be=a*f,we=S[0].pts-n(S[0].dts,S[0].pts);U=be-we}for(var Re=0;Re<R;Re++){var ge=S[Re];if(ge.pts=n(ge.pts-B,U),ge.dts=n(ge.dts-B,U),ge.dts>ge.pts){var Q=9e4*.2;_e=Math.max(Math.min(_e,ge.pts-ge.dts),-1*Q)}ge.dts<S[Re>0?Re-1:Re].dts&&(ye=!0)}ye&&S.sort(function(wt,Et){var et=wt.dts-Et.dts,Vt=wt.pts-Et.pts;return et||Vt}),H=S[0].dts,V=S[S.length-1].dts;var Pe=Math.round((V-H)/(R-1));if(_e<0){if(_e<Pe*-2){O.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(y.toMsFromMpegTsClock)(-Pe,!0)+" ms");for(var $e=_e,Fe=0;Fe<R;Fe++)S[Fe].dts=$e=Math.max($e,S[Fe].pts-Pe),S[Fe].pts=Math.max($e,S[Fe].pts)}else{O.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(y.toMsFromMpegTsClock)(_e,!0)+" ms to overcome this issue");for(var Me=0;Me<R;Me++)S[Me].dts=S[Me].dts+_e}H=S[0].dts}if(o){var ze=H-U,xe=ze>Pe,ke=ze<-1;if(xe||ke){xe?O.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(ze,!0)+" ms ("+ze+"dts) hole between fragments detected, filling it"):O.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(-ze,!0)+" ms ("+ze+"dts) overlapping between fragments detected"),H=U;var je=S[0].pts-ze;S[0].dts=H,S[0].pts=je,O.logger.log("Video: First PTS/DTS adjusted: "+Object(y.toMsFromMpegTsClock)(je,!0)+"/"+Object(y.toMsFromMpegTsClock)(H,!0)+", delta: "+Object(y.toMsFromMpegTsClock)(ze,!0)+" ms")}}e&&(H=Math.max(0,H));for(var Ge=0,Ue=0,Le=0;Le<R;Le++){for(var Ae=S[Le],nt=Ae.units,Qe=nt.length,Ze=0,Ye=0;Ye<Qe;Ye++)Ze+=nt[Ye].data.length;Ue+=Ze,Ge+=Qe,Ae.length=Ze,Ae.dts=Math.max(Ae.dts,H),Ae.pts=Math.max(Ae.pts,Ae.dts,0),ne=Math.min(Ae.pts,ne),ie=Math.max(Ae.pts,ie)}V=S[R-1].dts;var at=Ue+4*Ge+8,qe;try{qe=new Uint8Array(at)}catch(wt){this.observer.emit(F.Events.ERROR,F.Events.ERROR,{type:N.ErrorTypes.MUX_ERROR,details:N.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:at,reason:"fail allocating video mdat "+at});return}var Xe=new DataView(qe.buffer);Xe.setUint32(0,at),qe.set(L.default.types.mdat,4);for(var Be=0;Be<R;Be++){for(var rt=S[Be],Je=rt.units,Ee=0,He=0,de=Je.length;He<de;He++){var oe=Je[He],ue=oe.data,Y=oe.data.byteLength;Xe.setUint32(K,Y),K+=4,qe.set(ue,K),K+=Y,Ee+=4+Y}if(Be<R-1)D=S[Be+1].dts-rt.dts;else{var X=this.config,Z=rt.dts-S[Be>0?Be-1:Be].dts;if(X.stretchShortVideoTrack&&this.nextAudioPts!==null){var ae=Math.floor(X.maxBufferHole*f),ve=(c?ne+c*f:this.nextAudioPts)-rt.pts;ve>ae?(D=ve-Z,D<0&&(D=Z),O.logger.log("[mp4-remuxer]: It is approximately "+ve/90+" ms to the next segment; using duration "+D/90+" ms for the last video frame.")):D=Z}else D=Z}var Se=Math.round(rt.pts-rt.dts);A.push(new b(rt.key,D,Ee,Se))}if(A.length&&u&&u<70){var Ne=A[0].flags;Ne.dependsOn=2,Ne.isNonSync=0}console.assert(D!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=U=V+D,this.isVideoContiguous=!0;var st=L.default.moof(d.sequenceNumber++,H,_({},d,{samples:A})),dt="video",ut={data1:st,data2:qe,startPTS:ne/f,endPTS:(ie+D)/f,startDTS:H/f,endDTS:U/f,type:dt,hasAudio:!1,hasVideo:!0,nb:A.length,dropped:d.dropped};return d.samples=[],d.dropped=0,console.assert(qe.length,"MDAT length must not be zero"),ut},v.remuxAudio=function(d,a,o,c,f){var S=d.inputTimeScale,A=d.samplerate?d.samplerate:S,R=S/A,B=d.isAAC?r:i,U=B*R,K=this._initPTS,D=!d.isAAC&&this.typeSupported.mpeg,H=[],V=d.samples,ne=D?0:8,ie=this.nextAudioPts||-1,_e=a*S;if(this.isAudioContiguous=o=o||V.length&&ie>0&&(c&&Math.abs(_e-ie)<9e3||Math.abs(n(V[0].pts-K,_e)-ie)<20*U),V.forEach(function(ue){ue.pts=n(ue.pts-K,_e)}),!o||ie<0){if(V=V.filter(function(ue){return ue.pts>=0}),!V.length)return;f===0?ie=0:c?ie=Math.max(0,_e):ie=V[0].pts}if(d.isAAC)for(var ye=f!==void 0,be=this.config.maxAudioFramesDrift,we=0,Re=ie;we<V.length;we++){var ge=V[we],Q=ge.pts,Pe=Q-Re,$e=Math.abs(1e3*Pe/S);if(Pe<=-be*U&&ye)we===0&&(O.logger.warn("Audio frame @ "+(Q/S).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Pe/S)+" ms."),this.nextAudioPts=ie=Re=Q);else if(Pe>=be*U&&$e<s&&ye){var Fe=Math.round(Pe/U);Re=Q-Fe*U,Re<0&&(Fe--,Re+=U),we===0&&(this.nextAudioPts=ie=Re),O.logger.warn("[mp4-remuxer]: Injecting "+Fe+" audio frame @ "+(Re/S).toFixed(3)+"s due to "+Math.round(1e3*Pe/S)+" ms gap.");for(var Me=0;Me<Fe;Me++){var ze=Math.max(Re,0),xe=x.default.getSilentFrame(d.manifestCodec||d.codec,d.channelCount);xe||(O.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),xe=ge.unit.subarray()),V.splice(we,0,{unit:xe,pts:ze}),Re+=U,we++}}ge.pts=Re,Re+=U}for(var ke=null,je=null,Ge,Ue=0,Le=V.length;Le--;)Ue+=V[Le].unit.byteLength;for(var Ae=0,nt=V.length;Ae<nt;Ae++){var Qe=V[Ae],Ze=Qe.unit,Ye=Qe.pts;if(je!==null){var at=H[Ae-1];at.duration=Math.round((Ye-je)/R)}else if(o&&d.isAAC&&(Ye=ie),ke=Ye,Ue>0){Ue+=ne;try{Ge=new Uint8Array(Ue)}catch(ue){this.observer.emit(F.Events.ERROR,F.Events.ERROR,{type:N.ErrorTypes.MUX_ERROR,details:N.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ue,reason:"fail allocating audio mdat "+Ue});return}if(!D){var qe=new DataView(Ge.buffer);qe.setUint32(0,Ue),Ge.set(L.default.types.mdat,4)}}else return;Ge.set(Ze,ne);var Xe=Ze.byteLength;ne+=Xe,H.push(new b(!0,B,Xe,0)),je=Ye}var Be=H.length;if(!Be)return;var rt=H[H.length-1];this.nextAudioPts=ie=je+R*rt.duration;var Je=D?new Uint8Array(0):L.default.moof(d.sequenceNumber++,ke/R,_({},d,{samples:H}));d.samples=[];var Ee=ke/S,He=ie/S,de="audio",oe={data1:Je,data2:Ge,startPTS:Ee,endPTS:He,startDTS:Ee,endDTS:He,type:de,hasAudio:!0,hasVideo:!1,nb:Be};return this.isAudioContiguous=!0,console.assert(Ge.length,"MDAT length must not be zero"),oe},v.remuxEmptyAudio=function(d,a,o,c){var f=d.inputTimeScale,S=d.samplerate?d.samplerate:f,A=f/S,R=this.nextAudioPts,B=(R!==null?R:c.startDTS*f)+this._initDTS,U=c.endDTS*f+this._initDTS,K=A*r,D=Math.ceil((U-B)/K),H=x.default.getSilentFrame(d.manifestCodec||d.codec,d.channelCount);if(O.logger.warn("[mp4-remuxer]: remux empty Audio"),!H){O.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var V=[],ne=0;ne<D;ne++){var ie=B+ne*K;V.push({unit:H,pts:ie,dts:ie})}return d.samples=V,this.remuxAudio(d,a,o,!1)},v.remuxID3=function(d,a){var o=d.samples.length;if(!o)return;for(var c=d.inputTimeScale,f=this._initPTS,S=this._initDTS,A=0;A<o;A++){var R=d.samples[A];R.pts=n(R.pts-f,a*c)/c,R.dts=n(R.dts-S,a*c)/c}var B=d.samples;return d.samples=[],{samples:B}},v.remuxText=function(d,a){var o=d.samples.length;if(!o)return;for(var c=d.inputTimeScale,f=this._initPTS,S=0;S<o;S++){var A=d.samples[S];A.pts=n(A.pts-f,a*c)/c}d.samples.sort(function(B,U){return B.pts-U.pts});var R=d.samples;return d.samples=[],{samples:R}},E}();function n(E,v){var p;if(v===null)return E;for(v<E?p=-8589934592:p=8589934592;Math.abs(E-v)>4294967296;)E+=p;return E}function T(E){for(var v=0;v<E.length;v++)if(E[v].key)return v;return-1}var b=function(v,p,d,a){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=p,this.size=d,this.cts=a,this.flags=new g(v)},g=function(v){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=v?2:1,this.isNonSync=v?0:1}},"./src/remux/passthrough-remuxer.ts":function(pe,j,C){"use strict";C.r(j);var k=C("./src/polyfills/number.ts"),x=C("./src/utils/mp4-tools.ts"),L=C("./src/loader/fragment.ts"),F=C("./src/utils/logger.ts"),N=function(){function y(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var _=y.prototype;return _.destroy=function(){},_.resetTimeStamp=function(r){this.initPTS=r,this.lastEndDTS=null},_.resetNextTimestamp=function(){this.lastEndDTS=null},_.resetInitSegment=function(r,i,u){this.audioCodec=i,this.videoCodec=u,this.generateInitSegment(r),this.emitInitSegment=!0},_.generateInitSegment=function(r){var i=this.audioCodec,u=this.videoCodec;if(!r||!r.byteLength){this.initTracks=void 0,this.initData=void 0;return}var l=this.initData=Object(x.parseInitSegment)(r);i||(i=w(l.audio,L.ElementaryStreamTypes.AUDIO)),u||(u=w(l.video,L.ElementaryStreamTypes.VIDEO));var e={};l.audio&&l.video?e.audiovideo={container:"video/mp4",codec:i+","+u,initSegment:r,id:"main"}:l.audio?e.audio={container:"audio/mp4",codec:i,initSegment:r,id:"audio"}:l.video?e.video={container:"video/mp4",codec:u,initSegment:r,id:"main"}:F.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=e},_.remux=function(r,i,u,l,e){var t=this.initPTS,n=this.lastEndDTS,T={audio:void 0,video:void 0,text:l,id3:u,initSegment:void 0};Object(k.isFiniteNumber)(n)||(n=this.lastEndDTS=e||0);var b=i.samples;if(!b||!b.length)return T;var g={initPTS:void 0,timescale:1},E=this.initData;if((!E||!E.length)&&(this.generateInitSegment(b),E=this.initData),!E||!E.length)return F.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),T;this.emitInitSegment&&(g.tracks=this.initTracks,this.emitInitSegment=!1),Object(k.isFiniteNumber)(t)||(this.initPTS=g.initPTS=t=O(E,b,n));var v=Object(x.getDuration)(b,E),p=n,d=v+p;Object(x.offsetStartDTS)(E,b,t),v>0?this.lastEndDTS=d:(F.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var a=!!E.audio,o=!!E.video,c="";a&&(c+="audio"),o&&(c+="video");var f={data1:b,startPTS:p,startDTS:p,endPTS:d,endDTS:d,type:c,hasAudio:a,hasVideo:o,nb:1,dropped:0};return T.audio=f.type==="audio"?f:void 0,T.video=f.type!=="audio"?f:void 0,T.text=l,T.id3=u,T.initSegment=g,T},y}(),O=function(_,s,r){return Object(x.getStartDTS)(_,s)-r};function w(y,_){var s=y==null?void 0:y.codec;return s&&s.length>4?s:s==="hvc1"?"hvc1.1.c.L120.90":s==="av01"?"av01.0.04M.08":s==="avc1"||_===L.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}j.default=N},"./src/task-loop.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"default",function(){return k});var k=function(){function x(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var L=x.prototype;return L.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},L.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},L.onHandlerDestroyed=function(){},L.hasInterval=function(){return!!this._tickInterval},L.hasNextTick=function(){return!!this._tickTimer},L.setInterval=function(N){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,N),!0)},L.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},L.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},L.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},L.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},L.doTick=function(){},x}()},"./src/types/cmcd.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"CMCDVersion",function(){return k}),C.d(j,"CMCDObjectType",function(){return x}),C.d(j,"CMCDStreamingFormat",function(){return L}),C.d(j,"CMCDStreamType",function(){return F});var k=1,x;(function(N){N.MANIFEST="m",N.AUDIO="a",N.VIDEO="v",N.MUXED="av",N.INIT="i",N.CAPTION="c",N.TIMED_TEXT="tt",N.KEY="k",N.OTHER="o"})(x||(x={}));var L;(function(N){N.DASH="d",N.HLS="h",N.SMOOTH="s",N.OTHER="o"})(L||(L={}));var F;(function(N){N.VOD="v",N.LIVE="l"})(F||(F={}))},"./src/types/level.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"HlsSkip",function(){return L}),C.d(j,"getSkipValue",function(){return F}),C.d(j,"HlsUrlParameters",function(){return N}),C.d(j,"Level",function(){return O});function k(w,y){for(var _=0;_<y.length;_++){var s=y[_];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(w,s.key,s)}}function x(w,y,_){return y&&k(w.prototype,y),_&&k(w,_),w}var L;(function(w){w.No="",w.Yes="YES",w.v2="v2"})(L||(L={}));function F(w,y){var _=w.canSkipUntil,s=w.canSkipDateRanges,r=w.endSN,i=y!==void 0?y-r:0;return _&&i<_?s?L.v2:L.Yes:L.No}var N=function(){function w(_,s,r){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=_,this.part=s,this.skip=r}var y=w.prototype;return y.addDirectives=function(s){var r=new self.URL(s);return this.msn!==void 0&&r.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&r.searchParams.set("_HLS_part",this.part.toString()),this.skip&&r.searchParams.set("_HLS_skip",this.skip),r.toString()},w}(),O=function(){function w(y){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[y.url],this.attrs=y.attrs,this.bitrate=y.bitrate,y.details&&(this.details=y.details),this.id=y.id||0,this.name=y.name,this.width=y.width||0,this.height=y.height||0,this.audioCodec=y.audioCodec,this.videoCodec=y.videoCodec,this.unknownCodecs=y.unknownCodecs,this.codecSet=[y.videoCodec,y.audioCodec].filter(function(_){return _}).join(",").replace(/\.[^.,]+/g,"")}return x(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(_){var s=_%this.url.length;this._urlId!==s&&(this.details=void 0,this._urlId=s)}}]),w}()},"./src/types/loader.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"PlaylistContextType",function(){return k}),C.d(j,"PlaylistLevelType",function(){return x});var k;(function(L){L.MANIFEST="manifest",L.LEVEL="level",L.AUDIO_TRACK="audioTrack",L.SUBTITLE_TRACK="subtitleTrack"})(k||(k={}));var x;(function(L){L.MAIN="main",L.AUDIO="audio",L.SUBTITLE="subtitle"})(x||(x={}))},"./src/types/transmuxer.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"ChunkMetadata",function(){return k});var k=function(F,N,O,w,y,_){w===void 0&&(w=0),y===void 0&&(y=-1),_===void 0&&(_=!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=x(),this.buffering={audio:x(),video:x(),audiovideo:x()},this.level=F,this.sn=N,this.id=O,this.size=w,this.part=y,this.partial=_};function x(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"AttrList",function(){return L});var k=/^(\d+)x(\d+)$/,x=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,L=function(){function F(O){typeof O=="string"&&(O=F.parseAttrList(O));for(var w in O)O.hasOwnProperty(w)&&(this[w]=O[w])}var N=F.prototype;return N.decimalInteger=function(w){var y=parseInt(this[w],10);return y>Number.MAX_SAFE_INTEGER?Infinity:y},N.hexadecimalInteger=function(w){if(this[w]){var y=(this[w]||"0x").slice(2);y=(y.length&1?"0":"")+y;for(var _=new Uint8Array(y.length/2),s=0;s<y.length/2;s++)_[s]=parseInt(y.slice(s*2,s*2+2),16);return _}else return null},N.hexadecimalIntegerAsNumber=function(w){var y=parseInt(this[w],16);return y>Number.MAX_SAFE_INTEGER?Infinity:y},N.decimalFloatingPoint=function(w){return parseFloat(this[w])},N.optionalFloat=function(w,y){var _=this[w];return _?parseFloat(_):y},N.enumeratedString=function(w){return this[w]},N.bool=function(w){return this[w]==="YES"},N.decimalResolution=function(w){var y=k.exec(this[w]);return y===null?void 0:{width:parseInt(y[1],10),height:parseInt(y[2],10)}},F.parseAttrList=function(w){var y,_={},s='"';for(x.lastIndex=0;(y=x.exec(w))!==null;){var r=y[2];r.indexOf(s)===0&&r.lastIndexOf(s)===r.length-1&&(r=r.slice(1,-1)),_[y[1]]=r}return _},F}()},"./src/utils/binary-search.ts":function(pe,j,C){"use strict";C.r(j);var k={search:function(L,F){for(var N=0,O=L.length-1,w=null,y=null;N<=O;){w=(N+O)/2|0,y=L[w];var _=F(y);if(_>0)N=w+1;else if(_<0)O=w-1;else return y}return null}};j.default=k},"./src/utils/buffer-helper.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"BufferHelper",function(){return L});var k=C("./src/utils/logger.ts"),x={length:0,start:function(){return 0},end:function(){return 0}},L=function(){function F(){}return F.isBuffered=function(O,w){try{if(O){for(var y=F.getBuffered(O),_=0;_<y.length;_++)if(w>=y.start(_)&&w<=y.end(_))return!0}}catch(s){}return!1},F.bufferInfo=function(O,w,y){try{if(O){var _=F.getBuffered(O),s=[],r;for(r=0;r<_.length;r++)s.push({start:_.start(r),end:_.end(r)});return this.bufferedInfo(s,w,y)}}catch(i){}return{len:0,start:w,end:w,nextStart:void 0}},F.bufferedInfo=function(O,w,y){w=Math.max(0,w),O.sort(function(g,E){var v=g.start-E.start;return v||E.end-g.end});var _=[];if(y)for(var s=0;s<O.length;s++){var r=_.length;if(r){var i=_[r-1].end;O[s].start-i<y?O[s].end>i&&(_[r-1].end=O[s].end):_.push(O[s])}else _.push(O[s])}else _=O;for(var u=0,l,e=w,t=w,n=0;n<_.length;n++){var T=_[n].start,b=_[n].end;if(w+y>=T&&w<b)e=T,t=b,u=t-w;else if(w+y<T){l=T;break}}return{len:u,start:e||0,end:t||0,nextStart:l}},F.getBuffered=function(O){try{return O.buffered}catch(w){return k.logger.log("failed to get media.buffered",w),x}},F}()},"./src/utils/cea-608-parser.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"Row",function(){return t}),C.d(j,"CaptionScreen",function(){return n});var k=C("./src/utils/logger.ts"),x={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},L=function(d){var a=d;return x.hasOwnProperty(d)&&(a=x[d]),String.fromCharCode(a)},F=15,N=100,O={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},y={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},_={25:2,26:4,29:6,30:8,31:10,27:13,28:15},s=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],r;(function(p){p[p.ERROR=0]="ERROR",p[p.TEXT=1]="TEXT",p[p.WARNING=2]="WARNING",p[p.INFO=2]="INFO",p[p.DEBUG=3]="DEBUG",p[p.DATA=3]="DATA"})(r||(r={}));var i=function(){function p(){this.time=null,this.verboseLevel=r.ERROR}var d=p.prototype;return d.log=function(o,c){this.verboseLevel>=o&&k.logger.log(this.time+" ["+o+"] "+c)},p}(),u=function(d){for(var a=[],o=0;o<d.length;o++)a.push(d[o].toString(16));return a},l=function(){function p(a,o,c,f,S){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=a||"white",this.underline=o||!1,this.italics=c||!1,this.background=f||"black",this.flash=S||!1}var d=p.prototype;return d.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},d.setStyles=function(o){for(var c=["foreground","underline","italics","background","flash"],f=0;f<c.length;f++){var S=c[f];o.hasOwnProperty(S)&&(this[S]=o[S])}},d.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},d.equals=function(o){return this.foreground===o.foreground&&this.underline===o.underline&&this.italics===o.italics&&this.background===o.background&&this.flash===o.flash},d.copy=function(o){this.foreground=o.foreground,this.underline=o.underline,this.italics=o.italics,this.background=o.background,this.flash=o.flash},d.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},p}(),e=function(){function p(a,o,c,f,S,A){this.uchar=void 0,this.penState=void 0,this.uchar=a||" ",this.penState=new l(o,c,f,S,A)}var d=p.prototype;return d.reset=function(){this.uchar=" ",this.penState.reset()},d.setChar=function(o,c){this.uchar=o,this.penState.copy(c)},d.setPenState=function(o){this.penState.copy(o)},d.equals=function(o){return this.uchar===o.uchar&&this.penState.equals(o.penState)},d.copy=function(o){this.uchar=o.uchar,this.penState.copy(o.penState)},d.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},p}(),t=function(){function p(a){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var o=0;o<N;o++)this.chars.push(new e);this.logger=a,this.pos=0,this.currPenState=new l}var d=p.prototype;return d.equals=function(o){for(var c=!0,f=0;f<N;f++)if(!this.chars[f].equals(o.chars[f])){c=!1;break}return c},d.copy=function(o){for(var c=0;c<N;c++)this.chars[c].copy(o.chars[c])},d.isEmpty=function(){for(var o=!0,c=0;c<N;c++)if(!this.chars[c].isEmpty()){o=!1;break}return o},d.setCursor=function(o){this.pos!==o&&(this.pos=o),this.pos<0?(this.logger.log(r.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>N&&(this.logger.log(r.DEBUG,"Too large cursor position "+this.pos),this.pos=N)},d.moveCursor=function(o){var c=this.pos+o;if(o>1)for(var f=this.pos+1;f<c+1;f++)this.chars[f].setPenState(this.currPenState);this.setCursor(c)},d.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},d.insertChar=function(o){o>=144&&this.backSpace();var c=L(o);if(this.pos>=N){this.logger.log(r.ERROR,"Cannot insert "+o.toString(16)+" ("+c+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(c,this.currPenState),this.moveCursor(1)},d.clearFromPos=function(o){var c;for(c=o;c<N;c++)this.chars[c].reset()},d.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},d.clearToEndOfRow=function(){this.clearFromPos(this.pos)},d.getTextString=function(){for(var o=[],c=!0,f=0;f<N;f++){var S=this.chars[f].uchar;S!==" "&&(c=!1),o.push(S)}return c?"":o.join("")},d.setPenStyles=function(o){this.currPenState.setStyles(o);var c=this.chars[this.pos];c.setPenState(this.currPenState)},p}(),n=function(){function p(a){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var o=0;o<F;o++)this.rows.push(new t(a));this.logger=a,this.currRow=F-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var d=p.prototype;return d.reset=function(){for(var o=0;o<F;o++)this.rows[o].clear();this.currRow=F-1},d.equals=function(o){for(var c=!0,f=0;f<F;f++)if(!this.rows[f].equals(o.rows[f])){c=!1;break}return c},d.copy=function(o){for(var c=0;c<F;c++)this.rows[c].copy(o.rows[c])},d.isEmpty=function(){for(var o=!0,c=0;c<F;c++)if(!this.rows[c].isEmpty()){o=!1;break}return o},d.backSpace=function(){var o=this.rows[this.currRow];o.backSpace()},d.clearToEndOfRow=function(){var o=this.rows[this.currRow];o.clearToEndOfRow()},d.insertChar=function(o){var c=this.rows[this.currRow];c.insertChar(o)},d.setPen=function(o){var c=this.rows[this.currRow];c.setPenStyles(o)},d.moveCursor=function(o){var c=this.rows[this.currRow];c.moveCursor(o)},d.setCursor=function(o){this.logger.log(r.INFO,"setCursor: "+o);var c=this.rows[this.currRow];c.setCursor(o)},d.setPAC=function(o){this.logger.log(r.INFO,"pacData = "+JSON.stringify(o));var c=o.row-1;if(this.nrRollUpRows&&c<this.nrRollUpRows-1&&(c=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==c){for(var f=0;f<F;f++)this.rows[f].clear();var S=this.currRow+1-this.nrRollUpRows,A=this.lastOutputScreen;if(A){var R=A.rows[S].cueStartTime,B=this.logger.time;if(R&&B!==null&&R<B)for(var U=0;U<this.nrRollUpRows;U++)this.rows[c-this.nrRollUpRows+U+1].copy(A.rows[S+U])}}this.currRow=c;var K=this.rows[this.currRow];if(o.indent!==null){var D=o.indent,H=Math.max(D-1,0);K.setCursor(o.indent),o.color=K.chars[H].penState.foreground}var V={foreground:o.color,underline:o.underline,italics:o.italics,background:"black",flash:!1};this.setPen(V)},d.setBkgData=function(o){this.logger.log(r.INFO,"bkgData = "+JSON.stringify(o)),this.backSpace(),this.setPen(o),this.insertChar(32)},d.setRollUpRows=function(o){this.nrRollUpRows=o},d.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(r.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(r.TEXT,this.getDisplayText());var o=this.currRow+1-this.nrRollUpRows,c=this.rows.splice(o,1)[0];c.clear(),this.rows.splice(this.currRow,0,c),this.logger.log(r.INFO,"Rolling up")},d.getDisplayText=function(o){o=o||!1;for(var c=[],f="",S=-1,A=0;A<F;A++){var R=this.rows[A].getTextString();R&&(S=A+1,o?c.push("Row "+S+": '"+R+"'"):c.push(R.trim()))}return c.length>0&&(o?f="["+c.join(" | ")+"]":f=c.join(`
|
|
`)),f},d.getTextAndFormat=function(){return this.rows},p}(),T=function(){function p(a,o,c){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=a,this.outputFilter=o,this.mode=null,this.verbose=0,this.displayedMemory=new n(c),this.nonDisplayedMemory=new n(c),this.lastOutputScreen=new n(c),this.currRollUpRow=this.displayedMemory.rows[F-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=c}var d=p.prototype;return d.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[F-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},d.getHandler=function(){return this.outputFilter},d.setHandler=function(o){this.outputFilter=o},d.setPAC=function(o){this.writeScreen.setPAC(o)},d.setBkgData=function(o){this.writeScreen.setBkgData(o)},d.setMode=function(o){if(o===this.mode)return;this.mode=o,this.logger.log(r.INFO,"MODE="+o),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=o},d.insertChars=function(o){for(var c=0;c<o.length;c++)this.writeScreen.insertChar(o[c]);var f=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(r.INFO,f+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(r.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},d.ccRCL=function(){this.logger.log(r.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},d.ccBS=function(){if(this.logger.log(r.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},d.ccAOF=function(){},d.ccAON=function(){},d.ccDER=function(){this.logger.log(r.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},d.ccRU=function(o){this.logger.log(r.INFO,"RU("+o+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(o)},d.ccFON=function(){this.logger.log(r.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},d.ccRDC=function(){this.logger.log(r.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},d.ccTR=function(){this.logger.log(r.INFO,"TR"),this.setMode("MODE_TEXT")},d.ccRTD=function(){this.logger.log(r.INFO,"RTD"),this.setMode("MODE_TEXT")},d.ccEDM=function(){this.logger.log(r.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},d.ccCR=function(){this.logger.log(r.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},d.ccENM=function(){this.logger.log(r.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},d.ccEOC=function(){if(this.logger.log(r.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var o=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=o,this.writeScreen=this.nonDisplayedMemory,this.logger.log(r.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},d.ccTO=function(o){this.logger.log(r.INFO,"TO("+o+") - Tab Offset"),this.writeScreen.moveCursor(o)},d.ccMIDROW=function(o){var c={flash:!1};if(c.underline=o%2===1,c.italics=o>=46,c.italics)c.foreground="white";else{var f=Math.floor(o/2)-16,S=["white","green","blue","cyan","red","yellow","magenta"];c.foreground=S[f]}this.logger.log(r.INFO,"MIDROW: "+JSON.stringify(c)),this.writeScreen.setPen(c)},d.outputDataUpdate=function(o){o===void 0&&(o=!1);var c=this.logger.time;if(c===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=c:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,c,this.lastOutputScreen),o&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:c),this.lastOutputScreen.copy(this.displayedMemory))},d.cueSplitAtTime=function(o){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,o,this.displayedMemory),this.cueStartTime=o))},p}(),b=function(){function p(a,o,c){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var f=new i;this.channels=[null,new T(a,o,f),new T(a+1,c,f)],this.cmdHistory=v(),this.logger=f}var d=p.prototype;return d.getHandler=function(o){return this.channels[o].getHandler()},d.setHandler=function(o,c){this.channels[o].setHandler(c)},d.addData=function(o,c){var f,S,A,R=!1;this.logger.time=o;for(var B=0;B<c.length;B+=2){if(S=c[B]&127,A=c[B+1]&127,S===0&&A===0)continue;if(this.logger.log(r.DATA,"["+u([c[B],c[B+1]])+"] -> ("+u([S,A])+")"),f=this.parseCmd(S,A),f||(f=this.parseMidrow(S,A)),f||(f=this.parsePAC(S,A)),f||(f=this.parseBackgroundAttributes(S,A)),!f&&(R=this.parseChars(S,A),R)){var U=this.currentChannel;if(U&&U>0){var K=this.channels[U];K.insertChars(R)}else this.logger.log(r.WARNING,"No channel found yet. TEXT-MODE?")}!f&&!R&&this.logger.log(r.WARNING,"Couldn't parse cleaned data "+u([S,A])+" orig: "+u([c[B],c[B+1]]))}},d.parseCmd=function(o,c){var f=this.cmdHistory,S=(o===20||o===28||o===21||o===29)&&c>=32&&c<=47,A=(o===23||o===31)&&c>=33&&c<=35;if(!(S||A))return!1;if(E(o,c,f))return g(null,null,f),this.logger.log(r.DEBUG,"Repeated command ("+u([o,c])+") is dropped"),!0;var R=o===20||o===21||o===23?1:2,B=this.channels[R];return o===20||o===21||o===28||o===29?c===32?B.ccRCL():c===33?B.ccBS():c===34?B.ccAOF():c===35?B.ccAON():c===36?B.ccDER():c===37?B.ccRU(2):c===38?B.ccRU(3):c===39?B.ccRU(4):c===40?B.ccFON():c===41?B.ccRDC():c===42?B.ccTR():c===43?B.ccRTD():c===44?B.ccEDM():c===45?B.ccCR():c===46?B.ccENM():c===47&&B.ccEOC():B.ccTO(c-32),g(o,c,f),this.currentChannel=R,!0},d.parseMidrow=function(o,c){var f=0;if((o===17||o===25)&&c>=32&&c<=47){if(o===17?f=1:f=2,f!==this.currentChannel)return this.logger.log(r.ERROR,"Mismatch channel in midrow parsing"),!1;var S=this.channels[f];return S?(S.ccMIDROW(c),this.logger.log(r.DEBUG,"MIDROW ("+u([o,c])+")"),!0):!1}return!1},d.parsePAC=function(o,c){var f,S=this.cmdHistory,A=(o>=17&&o<=23||o>=25&&o<=31)&&c>=64&&c<=127,R=(o===16||o===24)&&c>=64&&c<=95;if(!(A||R))return!1;if(E(o,c,S))return g(null,null,S),!0;var B=o<=23?1:2;c>=64&&c<=95?f=B===1?O[o]:y[o]:f=B===1?w[o]:_[o];var U=this.channels[B];return U?(U.setPAC(this.interpretPAC(f,c)),g(o,c,S),this.currentChannel=B,!0):!1},d.interpretPAC=function(o,c){var f,S={color:null,italics:!1,indent:null,underline:!1,row:o};return c>95?f=c-96:f=c-64,S.underline=(f&1)===1,f<=13?S.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(f/2)]:f<=15?(S.italics=!0,S.color="white"):S.indent=Math.floor((f-16)/2)*4,S},d.parseChars=function(o,c){var f,S=null,A=null;if(o>=25?(f=2,A=o-8):(f=1,A=o),A>=17&&A<=19){var R;A===17?R=c+80:A===18?R=c+112:R=c+144,this.logger.log(r.INFO,"Special char '"+L(R)+"' in channel "+f),S=[R]}else o>=32&&o<=127&&(S=c===0?[o]:[o,c]);if(S){var B=u(S);this.logger.log(r.DEBUG,"Char codes = "+B.join(",")),g(o,c,this.cmdHistory)}return S},d.parseBackgroundAttributes=function(o,c){var f=(o===16||o===24)&&c>=32&&c<=47,S=(o===23||o===31)&&c>=45&&c<=47;if(!(f||S))return!1;var A,R={};o===16||o===24?(A=Math.floor((c-32)/2),R.background=s[A],c%2===1&&(R.background=R.background+"_semi")):c===45?R.background="transparent":(R.foreground="black",c===47&&(R.underline=!0));var B=o<=23?1:2,U=this.channels[B];return U.setBkgData(R),g(o,c,this.cmdHistory),!0},d.reset=function(){for(var o=0;o<Object.keys(this.channels).length;o++){var c=this.channels[o];c&&c.reset()}this.cmdHistory=v()},d.cueSplitAtTime=function(o){for(var c=0;c<this.channels.length;c++){var f=this.channels[c];f&&f.cueSplitAtTime(o)}},p}();function g(p,d,a){a.a=p,a.b=d}function E(p,d,a){return a.a===p&&a.b===d}function v(){return{a:null,b:null}}j.default=b},"./src/utils/codecs.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"isCodecType",function(){return x}),C.d(j,"isCodecSupportedInMp4",function(){return L});var k={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function x(F,N){var O=k[N];return!!O&&O[F.slice(0,4)]===!0}function L(F,N){return MediaSource.isTypeSupported((N||"video")+'/mp4;codecs="'+F+'"')}},"./src/utils/cues.ts":function(pe,j,C){"use strict";C.r(j);var k=C("./src/utils/vttparser.ts"),x=C("./src/utils/webvtt-parser.ts"),L=C("./src/utils/texttrack-utils.ts"),F=/\s/,N={newCue:function(w,y,_,s){for(var r=[],i,u,l,e,t,n=self.VTTCue||self.TextTrackCue,T=0;T<s.rows.length;T++)if(i=s.rows[T],l=!0,e=0,t="",!i.isEmpty()){for(var b=0;b<i.chars.length;b++)F.test(i.chars[b].uchar)&&l?e++:(t+=i.chars[b].uchar,l=!1);i.cueStartTime=y,y===_&&(_+=1e-4),e>=16?e--:e++;var g=Object(k.fixLineBreaks)(t.trim()),E=Object(x.generateCueId)(y,_,g);(!w||!w.cues||!w.cues.getCueById(E))&&(u=new n(y,_,g),u.id=E,u.line=T+1,u.align="left",u.position=10+Math.min(80,Math.floor(e*8/32)*10),r.push(u))}return w&&r.length&&(r.sort(function(v,p){return v.line==="auto"||p.line==="auto"?0:v.line>8&&p.line>8?p.line-v.line:v.line-p.line}),r.forEach(function(v){return Object(L.addCueToTrack)(w,v)})),r}};j.default=N},"./src/utils/discontinuities.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"findFirstFragWithCC",function(){return F}),C.d(j,"shouldAlignOnDiscontinuities",function(){return N}),C.d(j,"findDiscontinuousReferenceFrag",function(){return O}),C.d(j,"adjustSlidingStart",function(){return y}),C.d(j,"alignStream",function(){return _}),C.d(j,"alignPDT",function(){return r}),C.d(j,"alignFragmentByPDTDelta",function(){return i}),C.d(j,"alignMediaPlaylistByPDT",function(){return u});var k=C("./src/polyfills/number.ts"),x=C("./src/utils/logger.ts"),L=C("./src/controller/level-helper.ts");function F(l,e){for(var t=null,n=0,T=l.length;n<T;n++){var b=l[n];if(b&&b.cc===e){t=b;break}}return t}function N(l,e,t){return!!(e.details&&(t.endCC>t.startCC||l&&l.cc<t.startCC))}function O(l,e){var t=l.fragments,n=e.fragments;if(!n.length||!t.length){x.logger.log("No fragments to align");return}var T=F(t,n[0].cc);if(!T||T&&!T.startPTS){x.logger.log("No frag in previous level to align on");return}return T}function w(l,e){if(l){var t=l.start+e;l.start=l.startPTS=t,l.endPTS=t+l.duration}}function y(l,e){for(var t=e.fragments,n=0,T=t.length;n<T;n++)w(t[n],l);e.fragmentHint&&w(e.fragmentHint,l),e.alignedSliding=!0}function _(l,e,t){if(!e)return;s(l,t,e),!t.alignedSliding&&e.details&&r(t,e.details),!t.alignedSliding&&e.details&&!t.skippedSegments&&Object(L.adjustSliding)(e.details,t)}function s(l,e,t){if(N(l,t,e)){var n=O(t.details,e);n&&Object(k.isFiniteNumber)(n.start)&&(x.logger.log("Adjusting PTS using last level due to CC increase within current level "+e.url),y(n.start,e))}}function r(l,e){if(!e.fragments.length||!l.hasProgramDateTime||!e.hasProgramDateTime)return;var t=e.fragments[0].programDateTime,n=l.fragments[0].programDateTime,T=(n-t)/1e3+e.fragments[0].start;T&&Object(k.isFiniteNumber)(T)&&(x.logger.log("Adjusting PTS using programDateTime delta "+(n-t)+"ms, sliding:"+T.toFixed(3)+" "+l.url+" "),y(T,l))}function i(l,e){var t=l.programDateTime;if(!t)return;var n=(t-e)/1e3;l.start=l.startPTS=n,l.endPTS=n+l.duration}function u(l,e){if(!e.fragments.length||!l.hasProgramDateTime||!e.hasProgramDateTime)return;var t=e.fragments[0].programDateTime,n=e.fragments[0].start,T=t-n*1e3;l.fragments.forEach(function(b){i(b,T)}),l.fragmentHint&&i(l.fragmentHint,T),l.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(pe,j,C){"use strict";C.r(j);var k=C("./src/utils/ewma.ts"),x=function(){function L(N,O,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 k.default(N),this.fast_=new k.default(O)}var F=L.prototype;return F.update=function(O,w){var y=this.slow_,_=this.fast_;this.slow_.halfLife!==O&&(this.slow_=new k.default(O,y.getEstimate(),y.getTotalWeight())),this.fast_.halfLife!==w&&(this.fast_=new k.default(w,_.getEstimate(),_.getTotalWeight()))},F.sample=function(O,w){O=Math.max(O,this.minDelayMs_);var y=8*w,_=O/1e3,s=y/_;this.fast_.sample(_,s),this.slow_.sample(_,s)},F.canEstimate=function(){var O=this.fast_;return O&&O.getTotalWeight()>=this.minWeight_},F.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},F.destroy=function(){},L}();j.default=x},"./src/utils/ewma.ts":function(pe,j,C){"use strict";C.r(j);var k=function(){function x(F,N,O){N===void 0&&(N=0),O===void 0&&(O=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=F,this.alpha_=F?Math.exp(Math.log(.5)/F):0,this.estimate_=N,this.totalWeight_=O}var L=x.prototype;return L.sample=function(N,O){var w=Math.pow(this.alpha_,N);this.estimate_=O*(1-w)+w*this.estimate_,this.totalWeight_+=N},L.getTotalWeight=function(){return this.totalWeight_},L.getEstimate=function(){if(this.alpha_){var N=1-Math.pow(this.alpha_,this.totalWeight_);if(N)return this.estimate_/N}return this.estimate_},x}();j.default=k},"./src/utils/fetch-loader.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"fetchSupported",function(){return i});var k=C("./src/polyfills/number.ts"),x=C("./src/loader/load-stats.ts"),L=C("./src/demux/chunk-cache.ts");function F(n,T){n.prototype=Object.create(T.prototype),n.prototype.constructor=n,_(n,T)}function N(n){var T=typeof Map=="function"?new Map:void 0;return N=function(g){if(g===null||!y(g))return g;if(typeof g!="function")throw new TypeError("Super expression must either be null or a function");if(typeof T!="undefined"){if(T.has(g))return T.get(g);T.set(g,E)}function E(){return O(g,arguments,s(this).constructor)}return E.prototype=Object.create(g.prototype,{constructor:{value:E,enumerable:!1,writable:!0,configurable:!0}}),_(E,g)},N(n)}function O(n,T,b){return w()?O=Reflect.construct:O=function(E,v,p){var d=[null];d.push.apply(d,v);var a=Function.bind.apply(E,d),o=new a;return p&&_(o,p.prototype),o},O.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(n){return!1}}function y(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function _(n,T){return _=Object.setPrototypeOf||function(g,E){return g.__proto__=E,g},_(n,T)}function s(n){return s=Object.setPrototypeOf?Object.getPrototypeOf:function(b){return b.__proto__||Object.getPrototypeOf(b)},s(n)}function r(){return r=Object.assign||function(n){for(var T=1;T<arguments.length;T++){var b=arguments[T];for(var g in b)Object.prototype.hasOwnProperty.call(b,g)&&(n[g]=b[g])}return n},r.apply(this,arguments)}function i(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(n){}return!1}var u=function(){function n(b){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=b.fetchSetup||e,this.controller=new self.AbortController,this.stats=new x.LoadStats}var T=n.prototype;return T.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},T.abortInternal=function(){var g=this.response;(!g||!g.ok)&&(this.stats.aborted=!0,this.controller.abort())},T.abort=function(){var g;this.abortInternal(),(g=this.callbacks)!==null&&g!==void 0&&g.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},T.load=function(g,E,v){var p=this,d=this.stats;if(d.loading.start)throw new Error("Loader can only be used once.");d.loading.start=self.performance.now();var a=l(g,this.controller.signal),o=v.onProgress,c=g.responseType==="arraybuffer",f=c?"byteLength":"length";this.context=g,this.config=E,this.callbacks=v,this.request=this.fetchSetup(g,a),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){p.abortInternal(),v.onTimeout(d,g,p.response)},E.timeout),self.fetch(this.request).then(function(S){if(p.response=p.loader=S,!S.ok){var A=S.status,R=S.statusText;throw new t(R||"fetch, bad network response",A,S)}return d.loading.first=Math.max(self.performance.now(),d.loading.start),d.total=parseInt(S.headers.get("Content-Length")||"0"),o&&Object(k.isFiniteNumber)(E.highWaterMark)?p.loadProgressively(S,d,g,E.highWaterMark,o):c?S.arrayBuffer():S.text()}).then(function(S){var A=p.response;self.clearTimeout(p.requestTimeout),d.loading.end=Math.max(self.performance.now(),d.loading.first),d.loaded=d.total=S[f];var R={url:A.url,data:S};o&&!Object(k.isFiniteNumber)(E.highWaterMark)&&o(d,g,S,A),v.onSuccess(R,d,g,A)}).catch(function(S){if(self.clearTimeout(p.requestTimeout),d.aborted)return;var A=S.code||0;v.onError({code:A,text:S.message},g,S.details)})},T.getCacheAge=function(){var g=null;if(this.response){var E=this.response.headers.get("age");g=E?parseFloat(E):null}return g},T.loadProgressively=function(g,E,v,p,d){p===void 0&&(p=0);var a=new L.default,o=g.body.getReader(),c=function f(){return o.read().then(function(S){if(S.done)return a.dataLength&&d(E,v,a.flush(),g),Promise.resolve(new ArrayBuffer(0));var A=S.value,R=A.length;return E.loaded+=R,R<p||a.dataLength?(a.push(A),a.dataLength>=p&&d(E,v,a.flush(),g)):d(E,v,A,g),f()}).catch(function(){return Promise.reject()})};return c()},n}();function l(n,T){var b={method:"GET",mode:"cors",credentials:"same-origin",signal:T,headers:new self.Headers(r({},n.headers))};return n.rangeEnd&&b.headers.set("Range","bytes="+n.rangeStart+"-"+String(n.rangeEnd-1)),b}function e(n,T){return new self.Request(n.url,T)}var t=function(n){F(T,n);function T(b,g,E){var v;return v=n.call(this,b)||this,v.code=void 0,v.details=void 0,v.code=g,v.details=E,v}return T}(N(Error));j.default=u},"./src/utils/imsc1-ttml-parser.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"IMSC1_CODEC",function(){return y}),C.d(j,"parseIMSC1",function(){return i});var k=C("./src/utils/mp4-tools.ts"),x=C("./src/utils/vttparser.ts"),L=C("./src/utils/vttcue.ts"),F=C("./src/demux/id3.ts"),N=C("./src/utils/timescale-conversion.ts"),O=C("./src/utils/webvtt-parser.ts");function w(){return w=Object.assign||function(p){for(var d=1;d<arguments.length;d++){var a=arguments[d];for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(p[o]=a[o])}return p},w.apply(this,arguments)}var y="stpp.ttml.im1t",_=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,s=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,r={left:"start",center:"center",right:"end",start:"start",end:"end"};function i(p,d,a,o,c){var f=Object(k.findBox)(new Uint8Array(p),["mdat"]);if(f.length===0){c(new Error("Could not parse IMSC1 mdat"));return}var S=f[0],A=Object(F.utf8ArrayToStr)(new Uint8Array(p,S.start,S.end-S.start)),R=Object(N.toTimescaleFromScale)(d,1,a);try{o(u(A,R))}catch(B){c(B)}}function u(p,d){var a=new DOMParser,o=a.parseFromString(p,"text/xml"),c=o.getElementsByTagName("tt")[0];if(!c)throw new Error("Invalid ttml");var f={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},S=Object.keys(f).reduce(function(K,D){return K[D]=c.getAttribute("ttp:"+D)||f[D],K},{}),A=c.getAttribute("xml:space")!=="preserve",R=e(l(c,"styling","style")),B=e(l(c,"layout","region")),U=l(c,"body","[begin]");return[].map.call(U,function(K){var D=t(K,A);if(!D||!K.hasAttribute("begin"))return null;var H=g(K.getAttribute("begin"),S),V=g(K.getAttribute("dur"),S),ne=g(K.getAttribute("end"),S);if(H===null)throw b(K);if(ne===null){if(V===null)throw b(K);ne=H+V}var ie=new L.default(H-d,ne-d,D);ie.id=Object(O.generateCueId)(ie.startTime,ie.endTime,ie.text);var _e=B[K.getAttribute("region")],ye=R[K.getAttribute("style")];ie.position=10,ie.size=80;var be=n(_e,ye),we=be.textAlign;if(we){var Re=r[we];Re&&(ie.lineAlign=Re),ie.align=we}return w(ie,be),ie}).filter(function(K){return K!==null})}function l(p,d,a){var o=p.getElementsByTagName(d)[0];return o?[].slice.call(o.querySelectorAll(a)):[]}function e(p){return p.reduce(function(d,a){var o=a.getAttribute("xml:id");return o&&(d[o]=a),d},{})}function t(p,d){return[].slice.call(p.childNodes).reduce(function(a,o,c){var f;return o.nodeName==="br"&&c?a+`
|
|
`:(f=o.childNodes)!==null&&f!==void 0&&f.length?t(o,d):d?a+o.textContent.trim().replace(/\s+/g," "):a+o.textContent},"")}function n(p,d){var a="http://www.w3.org/ns/ttml#styling",o=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return o.reduce(function(c,f){var S=T(d,a,f)||T(p,a,f);return S&&(c[f]=S),c},{})}function T(p,d,a){return p.hasAttributeNS(d,a)?p.getAttributeNS(d,a):null}function b(p){return new Error("Could not parse ttml timestamp "+p)}function g(p,d){if(!p)return null;var a=Object(x.parseTimeStamp)(p);return a===null&&(_.test(p)?a=E(p,d):s.test(p)&&(a=v(p,d))),a}function E(p,d){var a=_.exec(p),o=(a[4]|0)+(a[5]|0)/d.subFrameRate;return(a[1]|0)*3600+(a[2]|0)*60+(a[3]|0)+o/d.frameRate}function v(p,d){var a=s.exec(p),o=Number(a[1]),c=a[2];switch(c){case"h":return o*3600;case"m":return o*60;case"ms":return o*1e3;case"f":return o/d.frameRate;case"t":return o/d.tickRate}return o}},"./src/utils/logger.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"enableLogs",function(){return O}),C.d(j,"logger",function(){return w});var k=function(){},x={trace:k,debug:k,log:k,warn:k,info:k,error:k},L=x;function F(y){var _=self.console[y];return _?_.bind(self.console,"["+y+"] >"):k}function N(y){for(var _=arguments.length,s=new Array(_>1?_-1:0),r=1;r<_;r++)s[r-1]=arguments[r];s.forEach(function(i){L[i]=y[i]?y[i].bind(y):F(i)})}function O(y){if(self.console&&y===!0||typeof y=="object"){N(y,"debug","log","info","warn","error");try{L.log()}catch(_){L=x}}else L=x}var w=L},"./src/utils/mediakeys-helper.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"KeySystems",function(){return k}),C.d(j,"requestMediaKeySystemAccess",function(){return x});var k;(function(L){L.WIDEVINE="com.widevine.alpha",L.PLAYREADY="com.microsoft.playready"})(k||(k={}));var x=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"getMediaSource",function(){return k});function k(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"bin2str",function(){return N}),C.d(j,"readUint16",function(){return O}),C.d(j,"readUint32",function(){return w}),C.d(j,"writeUint32",function(){return y}),C.d(j,"findBox",function(){return _}),C.d(j,"parseSegmentIndex",function(){return s}),C.d(j,"parseInitSegment",function(){return r}),C.d(j,"getStartDTS",function(){return i}),C.d(j,"getDuration",function(){return u}),C.d(j,"computeRawDurationFromSamples",function(){return l}),C.d(j,"offsetStartDTS",function(){return e}),C.d(j,"segmentValidRange",function(){return t}),C.d(j,"appendUint8Array",function(){return n});var k=C("./src/utils/typed-array.ts"),x=C("./src/loader/fragment.ts"),L=Math.pow(2,32)-1,F=[].push;function N(T){return String.fromCharCode.apply(null,T)}function O(T,b){"data"in T&&(b+=T.start,T=T.data);var g=T[b]<<8|T[b+1];return g<0?65536+g:g}function w(T,b){"data"in T&&(b+=T.start,T=T.data);var g=T[b]<<24|T[b+1]<<16|T[b+2]<<8|T[b+3];return g<0?4294967296+g:g}function y(T,b,g){"data"in T&&(b+=T.start,T=T.data),T[b]=g>>24,T[b+1]=g>>16&255,T[b+2]=g>>8&255,T[b+3]=g&255}function _(T,b){var g=[];if(!b.length)return g;var E,v,p;"data"in T?(E=T.data,v=T.start,p=T.end):(E=T,v=0,p=E.byteLength);for(var d=v;d<p;){var a=w(E,d),o=N(E.subarray(d+4,d+8)),c=a>1?d+a:p;if(o===b[0])if(b.length===1)g.push({data:E,start:d+8,end:c});else{var f=_({data:E,start:d+8,end:c},b.slice(1));f.length&&F.apply(g,f)}d=c}return g}function s(T){var b=_(T,["moov"]),g=b[0],E=g?g.end:null,v=_(T,["sidx"]);if(!v||!v[0])return null;var p=[],d=v[0],a=d.data[0],o=a===0?8:16,c=w(d,o);o+=4;var f=0,S=0;a===0?o+=8:o+=16,o+=2;var A=d.end+S,R=O(d,o);o+=2;for(var B=0;B<R;B++){var U=o,K=w(d,U);U+=4;var D=K&2147483647,H=(K&2147483648)>>>31;if(H===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var V=w(d,U);U+=4,p.push({referenceSize:D,subsegmentDuration:V,info:{duration:V/c,start:A,end:A+D-1}}),A+=D,U+=4,o=U}return{earliestPresentationTime:f,timescale:c,version:a,referencesCount:R,references:p,moovEndOffset:E}}function r(T){for(var b=[],g=_(T,["moov","trak"]),E=0;E<g.length;E++){var v=g[E],p=_(v,["tkhd"])[0];if(p){var d=p.data[p.start],a=d===0?12:20,o=w(p,a),c=_(v,["mdia","mdhd"])[0];if(c){d=c.data[c.start],a=d===0?12:20;var f=w(c,a),S=_(v,["mdia","hdlr"])[0];if(S){var A=N(S.data.subarray(S.start+8,S.start+12)),R={soun:x.ElementaryStreamTypes.AUDIO,vide:x.ElementaryStreamTypes.VIDEO}[A];if(R){var B=_(v,["mdia","minf","stbl","stsd"])[0],U=void 0;B&&(U=N(B.data.subarray(B.start+12,B.start+16))),b[o]={timescale:f,type:R},b[R]={timescale:f,id:o,codec:U}}}}}}var K=_(T,["moov","mvex","trex"]);return K.forEach(function(D){var H=w(D,4),V=b[H];V&&(V.default={duration:w(D,12),flags:w(D,20)})}),b}function i(T,b){return _(b,["moof","traf"]).reduce(function(g,E){var v=_(E,["tfdt"])[0],p=v.data[v.start],d=_(E,["tfhd"]).reduce(function(a,o){var c=w(o,4),f=T[c];if(f){var S=w(v,4);p===1&&(S*=Math.pow(2,32),S+=w(v,8));var A=f.timescale||9e4,R=S/A;if(isFinite(R)&&(a===null||R<a))return R}return a},null);return d!==null&&isFinite(d)&&(g===null||d<g)?d:g},null)||0}function u(T,b){for(var g=0,E=0,v=0,p=_(T,["moof","traf"]),d=0;d<p.length;d++){var a=p[d],o=_(a,["tfhd"])[0],c=w(o,4),f=b[c];if(!f)continue;var S=f.default,A=w(o,0)|(S==null?void 0:S.flags),R=S==null?void 0:S.duration;A&8&&(A&2?R=w(o,12):R=w(o,8));for(var B=f.timescale||9e4,U=_(a,["trun"]),K=0;K<U.length;K++){if(R){var D=w(U[K],4);g=R*D}else g=l(U[K]);f.type===x.ElementaryStreamTypes.VIDEO?E+=g/B:f.type===x.ElementaryStreamTypes.AUDIO&&(v+=g/B)}}if(E===0&&v===0){var H=s(T);if(H!=null&&H.references)return H.references.reduce(function(V,ne){return V+ne.info.duration||0},0)}return E||v}function l(T){var b=w(T,0),g=8;b&1&&(g+=4),b&4&&(g+=4);for(var E=0,v=w(T,4),p=0;p<v;p++){if(b&256){var d=w(T,g);E+=d,g+=4}b&512&&(g+=4),b&1024&&(g+=4),b&2048&&(g+=4)}return E}function e(T,b,g){_(b,["moof","traf"]).forEach(function(E){_(E,["tfhd"]).forEach(function(v){var p=w(v,4),d=T[p];if(!d)return;var a=d.timescale||9e4;_(E,["tfdt"]).forEach(function(o){var c=o.data[o.start],f=w(o,4);if(c===0)y(o,4,f-g*a);else{f*=Math.pow(2,32),f+=w(o,8),f-=g*a,f=Math.max(f,0);var S=Math.floor(f/(L+1)),A=Math.floor(f%(L+1));y(o,4,S),y(o,8,A)}})})})}function t(T){var b={valid:null,remainder:null},g=_(T,["moof"]);if(g){if(g.length<2)return b.remainder=T,b}else return b;var E=g[g.length-1];return b.valid=Object(k.sliceUint8)(T,0,E.start-8),b.remainder=Object(k.sliceUint8)(T,E.start-8),b}function n(T,b){var g=new Uint8Array(T.length+b.length);return g.set(T),g.set(b,T.length),g}},"./src/utils/output-filter.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"default",function(){return k});var k=function(){function x(F,N){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=F,this.trackName=N}var L=x.prototype;return L.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},L.newCue=function(N,O,w){(this.startTime===null||this.startTime>N)&&(this.startTime=N),this.endTime=O,this.screen=w,this.timelineController.createCaptionsTrack(this.trackName)},L.reset=function(){this.cueRanges=[]},x}()},"./src/utils/texttrack-utils.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"sendAddTrackEvent",function(){return x}),C.d(j,"addCueToTrack",function(){return L}),C.d(j,"clearCurrentCues",function(){return F}),C.d(j,"removeCuesInRange",function(){return N}),C.d(j,"getCuesInRange",function(){return w});var k=C("./src/utils/logger.ts");function x(y,_){var s;try{s=new Event("addtrack")}catch(r){s=document.createEvent("Event"),s.initEvent("addtrack",!1,!1)}s.track=y,_.dispatchEvent(s)}function L(y,_){var s=y.mode;if(s==="disabled"&&(y.mode="hidden"),y.cues&&!y.cues.getCueById(_.id))try{if(y.addCue(_),!y.cues.getCueById(_.id))throw new Error("addCue is failed for: "+_)}catch(i){k.logger.debug("[texttrack-utils]: "+i);var r=new self.TextTrackCue(_.startTime,_.endTime,_.text);r.id=_.id,y.addCue(r)}s==="disabled"&&(y.mode=s)}function F(y){var _=y.mode;if(_==="disabled"&&(y.mode="hidden"),y.cues)for(var s=y.cues.length;s--;)y.removeCue(y.cues[s]);_==="disabled"&&(y.mode=_)}function N(y,_,s){var r=y.mode;if(r==="disabled"&&(y.mode="hidden"),y.cues&&y.cues.length>0)for(var i=w(y.cues,_,s),u=0;u<i.length;u++)y.removeCue(i[u]);r==="disabled"&&(y.mode=r)}function O(y,_){if(_<y[0].startTime)return 0;var s=y.length-1;if(_>y[s].endTime)return-1;for(var r=0,i=s;r<=i;){var u=Math.floor((i+r)/2);if(_<y[u].startTime)i=u-1;else if(_>y[u].startTime&&r<s)r=u+1;else return u}return y[r].startTime-_<_-y[i].startTime?r:i}function w(y,_,s){var r=[],i=O(y,_);if(i>-1)for(var u=i,l=y.length;u<l;u++){var e=y[u];if(e.startTime>=_&&e.endTime<=s)r.push(e);else if(e.startTime>s)return r}return r}},"./src/utils/time-ranges.ts":function(pe,j,C){"use strict";C.r(j);var k={toString:function(L){for(var F="",N=L.length,O=0;O<N;O++)F+="["+L.start(O).toFixed(3)+","+L.end(O).toFixed(3)+"]";return F}};j.default=k},"./src/utils/timescale-conversion.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"toTimescaleFromBase",function(){return x}),C.d(j,"toTimescaleFromScale",function(){return L}),C.d(j,"toMsFromMpegTsClock",function(){return F}),C.d(j,"toMpegTsClockFromTimescale",function(){return N});var k=9e4;function x(O,w,y,_){y===void 0&&(y=1),_===void 0&&(_=!1);var s=O*w*y;return _?Math.round(s):s}function L(O,w,y,_){return y===void 0&&(y=1),_===void 0&&(_=!1),x(O,w,1/y,_)}function F(O,w){return w===void 0&&(w=!1),x(O,1e3,1/k,w)}function N(O,w){return w===void 0&&(w=1),x(O,k,1/w)}},"./src/utils/typed-array.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"sliceUint8",function(){return k});function k(x,L,F){return Uint8Array.prototype.slice?x.slice(L,F):new Uint8Array(Array.prototype.slice.call(x,L,F))}},"./src/utils/vttcue.ts":function(pe,j,C){"use strict";C.r(j),j.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var k=["","lr","rl"],x=["start","middle","end","left","right"];function L(y,_){if(typeof _!="string")return!1;if(!Array.isArray(y))return!1;var s=_.toLowerCase();return~y.indexOf(s)?s:!1}function F(y){return L(k,y)}function N(y){return L(x,y)}function O(y){for(var _=arguments.length,s=new Array(_>1?_-1:0),r=1;r<_;r++)s[r-1]=arguments[r];for(var i=1;i<arguments.length;i++){var u=arguments[i];for(var l in u)y[l]=u[l]}return y}function w(y,_,s){var r=this,i={enumerable:!0};r.hasBeenReset=!1;var u="",l=!1,e=y,t=_,n=s,T=null,b="",g=!0,E="auto",v="start",p=50,d="middle",a=50,o="middle";Object.defineProperty(r,"id",O({},i,{get:function(){return u},set:function(f){u=""+f}})),Object.defineProperty(r,"pauseOnExit",O({},i,{get:function(){return l},set:function(f){l=!!f}})),Object.defineProperty(r,"startTime",O({},i,{get:function(){return e},set:function(f){if(typeof f!="number")throw new TypeError("Start time must be set to a number.");e=f,this.hasBeenReset=!0}})),Object.defineProperty(r,"endTime",O({},i,{get:function(){return t},set:function(f){if(typeof f!="number")throw new TypeError("End time must be set to a number.");t=f,this.hasBeenReset=!0}})),Object.defineProperty(r,"text",O({},i,{get:function(){return n},set:function(f){n=""+f,this.hasBeenReset=!0}})),Object.defineProperty(r,"region",O({},i,{get:function(){return T},set:function(f){T=f,this.hasBeenReset=!0}})),Object.defineProperty(r,"vertical",O({},i,{get:function(){return b},set:function(f){var S=F(f);if(S===!1)throw new SyntaxError("An invalid or illegal string was specified.");b=S,this.hasBeenReset=!0}})),Object.defineProperty(r,"snapToLines",O({},i,{get:function(){return g},set:function(f){g=!!f,this.hasBeenReset=!0}})),Object.defineProperty(r,"line",O({},i,{get:function(){return E},set:function(f){if(typeof f!="number"&&f!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");E=f,this.hasBeenReset=!0}})),Object.defineProperty(r,"lineAlign",O({},i,{get:function(){return v},set:function(f){var S=N(f);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");v=S,this.hasBeenReset=!0}})),Object.defineProperty(r,"position",O({},i,{get:function(){return p},set:function(f){if(f<0||f>100)throw new Error("Position must be between 0 and 100.");p=f,this.hasBeenReset=!0}})),Object.defineProperty(r,"positionAlign",O({},i,{get:function(){return d},set:function(f){var S=N(f);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");d=S,this.hasBeenReset=!0}})),Object.defineProperty(r,"size",O({},i,{get:function(){return a},set:function(f){if(f<0||f>100)throw new Error("Size must be between 0 and 100.");a=f,this.hasBeenReset=!0}})),Object.defineProperty(r,"align",O({},i,{get:function(){return o},set:function(f){var S=N(f);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");o=S,this.hasBeenReset=!0}})),r.displayState=void 0}return w.prototype.getCueAsHTML=function(){var y=self.WebVTT;return y.convertCueToDOMTree(self,this.text)},w}()},"./src/utils/vttparser.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"parseTimeStamp",function(){return L}),C.d(j,"fixLineBreaks",function(){return _}),C.d(j,"VTTParser",function(){return s});var k=C("./src/utils/vttcue.ts"),x=function(){function r(){}var i=r.prototype;return i.decode=function(l,e){if(!l)return"";if(typeof l!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(l))},r}();function L(r){function i(l,e,t,n){return(l|0)*3600+(e|0)*60+(t|0)+parseFloat(n||0)}var u=r.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return u?parseFloat(u[2])>59?i(u[2],u[3],0,u[4]):i(u[1],u[2],u[3],u[4]):null}var F=function(){function r(){this.values=Object.create(null)}var i=r.prototype;return i.set=function(l,e){!this.get(l)&&e!==""&&(this.values[l]=e)},i.get=function(l,e,t){return t?this.has(l)?this.values[l]:e[t]:this.has(l)?this.values[l]:e},i.has=function(l){return l in this.values},i.alt=function(l,e,t){for(var n=0;n<t.length;++n)if(e===t[n]){this.set(l,e);break}},i.integer=function(l,e){/^-?\d+$/.test(e)&&this.set(l,parseInt(e,10))},i.percent=function(l,e){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(e)){var t=parseFloat(e);if(t>=0&&t<=100)return this.set(l,t),!0}return!1},r}();function N(r,i,u,l){var e=l?r.split(l):[r];for(var t in e){if(typeof e[t]!="string")continue;var n=e[t].split(u);if(n.length!==2)continue;var T=n[0],b=n[1];i(T,b)}}var O=new k.default(0,0,""),w=O.align==="middle"?"middle":"center";function y(r,i,u){var l=r;function e(){var T=L(r);if(T===null)throw new Error("Malformed timestamp: "+l);return r=r.replace(/^[^\sa-zA-Z-]+/,""),T}function t(T,b){var g=new F;N(T,function(p,d){var a;switch(p){case"region":for(var o=u.length-1;o>=0;o--)if(u[o].id===d){g.set(p,u[o].region);break}break;case"vertical":g.alt(p,d,["rl","lr"]);break;case"line":a=d.split(","),g.integer(p,a[0]),g.percent(p,a[0])&&g.set("snapToLines",!1),g.alt(p,a[0],["auto"]),a.length===2&&g.alt("lineAlign",a[1],["start",w,"end"]);break;case"position":a=d.split(","),g.percent(p,a[0]),a.length===2&&g.alt("positionAlign",a[1],["start",w,"end","line-left","line-right","auto"]);break;case"size":g.percent(p,d);break;case"align":g.alt(p,d,["start",w,"end","left","right"]);break}},/:/,/\s/),b.region=g.get("region",null),b.vertical=g.get("vertical","");var E=g.get("line","auto");E==="auto"&&O.line===-1&&(E=-1),b.line=E,b.lineAlign=g.get("lineAlign","start"),b.snapToLines=g.get("snapToLines",!0),b.size=g.get("size",100),b.align=g.get("align",w);var v=g.get("position","auto");v==="auto"&&O.position===50&&(v=b.align==="start"||b.align==="left"?0:b.align==="end"||b.align==="right"?100:50),b.position=v}function n(){r=r.replace(/^\s+/,"")}if(n(),i.startTime=e(),n(),r.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+l);r=r.substr(3),n(),i.endTime=e(),n(),t(r,i)}function _(r){return r.replace(/<br(?: \/)?>/gi,`
|
|
`)}var s=function(){function r(){this.state="INITIAL",this.buffer="",this.decoder=new x,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var i=r.prototype;return i.parse=function(l){var e=this;l&&(e.buffer+=e.decoder.decode(l,{stream:!0}));function t(){var v=e.buffer,p=0;for(v=_(v);p<v.length&&v[p]!=="\r"&&v[p]!==`
|
|
`;)++p;var d=v.substr(0,p);return v[p]==="\r"&&++p,v[p]===`
|
|
`&&++p,e.buffer=v.substr(p),d}function n(v){N(v,function(p,d){},/:/)}try{var T="";if(e.state==="INITIAL"){if(!/\r\n|\n/.test(e.buffer))return this;T=t();var b=T.match(/^()?WEBVTT([ \t].*)?$/);if(!b||!b[0])throw new Error("Malformed WebVTT signature.");e.state="HEADER"}for(var g=!1;e.buffer;){if(!/\r\n|\n/.test(e.buffer))return this;g?g=!1:T=t();switch(e.state){case"HEADER":/:/.test(T)?n(T):T||(e.state="ID");continue;case"NOTE":T||(e.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(T)){e.state="NOTE";break}if(!T)continue;if(e.cue=new k.default(0,0,""),e.state="CUE",T.indexOf("-->")===-1){e.cue.id=T;continue}case"CUE":if(!e.cue){e.state="BADCUE";continue}try{y(T,e.cue,e.regionList)}catch(v){e.cue=null,e.state="BADCUE";continue}e.state="CUETEXT";continue;case"CUETEXT":{var E=T.indexOf("-->")!==-1;if(!T||E&&(g=!0)){e.oncue&&e.cue&&e.oncue(e.cue),e.cue=null,e.state="ID";continue}if(e.cue===null)continue;e.cue.text&&(e.cue.text+=`
|
|
`),e.cue.text+=T}continue;case"BADCUE":T||(e.state="ID")}}}catch(v){e.state==="CUETEXT"&&e.cue&&e.oncue&&e.oncue(e.cue),e.cue=null,e.state=e.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},i.flush=function(){var l=this;try{if((l.cue||l.state==="HEADER")&&(l.buffer+=`
|
|
|
|
`,l.parse()),l.state==="INITIAL"||l.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(e){l.onparsingerror&&l.onparsingerror(e)}return l.onflush&&l.onflush(),this},r}()},"./src/utils/webvtt-parser.ts":function(pe,j,C){"use strict";C.r(j),C.d(j,"generateCueId",function(){return s}),C.d(j,"parseWebVTT",function(){return i});var k=C("./src/polyfills/number.ts"),x=C("./src/utils/vttparser.ts"),L=C("./src/demux/id3.ts"),F=C("./src/utils/timescale-conversion.ts"),N=C("./src/remux/mp4-remuxer.ts"),O=/\r\n|\n\r|\n|\r/g,w=function(l,e,t){return t===void 0&&(t=0),l.substr(t,e.length)===e},y=function(l){var e=parseInt(l.substr(-3)),t=parseInt(l.substr(-6,2)),n=parseInt(l.substr(-9,2)),T=l.length>9?parseInt(l.substr(0,l.indexOf(":"))):0;if(!Object(k.isFiniteNumber)(e)||!Object(k.isFiniteNumber)(t)||!Object(k.isFiniteNumber)(n)||!Object(k.isFiniteNumber)(T))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+l);return e+=1e3*t,e+=60*1e3*n,e+=60*60*1e3*T,e},_=function(l){for(var e=5381,t=l.length;t;)e=e*33^l.charCodeAt(--t);return(e>>>0).toString()};function s(u,l,e){return _(u.toString())+_(l.toString())+_(e)}var r=function(l,e,t){var n=l[e],T=l[n.prevCC];if(!T||!T.new&&n.new){l.ccOffset=l.presentationOffset=n.start,n.new=!1;return}for(;(b=T)!==null&&b!==void 0&&b.new;){var b;l.ccOffset+=n.start-T.start,n.new=!1,n=T,T=l[n.prevCC]}l.presentationOffset=t};function i(u,l,e,t,n,T,b,g){var E=new x.VTTParser,v=Object(L.utf8ArrayToStr)(new Uint8Array(u)).trim().replace(O,`
|
|
`).split(`
|
|
`),p=[],d=Object(F.toMpegTsClockFromTimescale)(l,e),a="00:00.000",o=0,c=0,f,S=!0,A=!1;E.oncue=function(R){var B=t[n],U=t.ccOffset,K=(o-d)/9e4;if(B!=null&&B.new&&(c!==void 0?U=t.ccOffset=B.start:r(t,n,K)),K&&(U=K-t.presentationOffset),A){var D=R.endTime-R.startTime,H=Object(N.normalizePts)((R.startTime+U-c)*9e4,T*9e4)/9e4;R.startTime=H,R.endTime=H+D}var V=R.text.trim();R.text=decodeURIComponent(encodeURIComponent(V)),R.id||(R.id=s(R.startTime,R.endTime,V)),R.endTime>0&&p.push(R)},E.onparsingerror=function(R){f=R},E.onflush=function(){if(f){g(f);return}b(p)},v.forEach(function(R){if(S)if(w(R,"X-TIMESTAMP-MAP=")){S=!1,A=!0,R.substr(16).split(",").forEach(function(B){w(B,"LOCAL:")?a=B.substr(6):w(B,"MPEGTS:")&&(o=parseInt(B.substr(7)))});try{c=y(a)/1e3}catch(B){A=!1,f=B}return}else R===""&&(S=!1);E.parse(R+`
|
|
`)}),E.flush()}},"./src/utils/xhr-loader.ts":function(pe,j,C){"use strict";C.r(j);var k=C("./src/utils/logger.ts"),x=C("./src/loader/load-stats.ts"),L=/^age:\s*[\d.]+\s*$/m,F=function(){function N(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 x.LoadStats,this.retryDelay=0}var O=N.prototype;return O.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},O.abortInternal=function(){var y=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),y&&(y.onreadystatechange=null,y.onprogress=null,y.readyState!==4&&(this.stats.aborted=!0,y.abort()))},O.abort=function(){var y;this.abortInternal(),(y=this.callbacks)!==null&&y!==void 0&&y.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},O.load=function(y,_,s){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=y,this.config=_,this.callbacks=s,this.retryDelay=_.retryDelay,this.loadInternal()},O.loadInternal=function(){var y=this.config,_=this.context;if(!y)return;var s=this.loader=new self.XMLHttpRequest,r=this.stats;r.loading.first=0,r.loaded=0;var i=this.xhrSetup;try{if(i)try{i(s,_.url)}catch(e){s.open("GET",_.url,!0),i(s,_.url)}s.readyState||s.open("GET",_.url,!0);var u=this.context.headers;if(u)for(var l in u)s.setRequestHeader(l,u[l])}catch(e){this.callbacks.onError({code:s.status,text:e.message},_,s);return}_.rangeEnd&&s.setRequestHeader("Range","bytes="+_.rangeStart+"-"+(_.rangeEnd-1)),s.onreadystatechange=this.readystatechange.bind(this),s.onprogress=this.loadprogress.bind(this),s.responseType=_.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),y.timeout),s.send()},O.readystatechange=function(){var y=this.context,_=this.loader,s=this.stats;if(!y||!_)return;var r=_.readyState,i=this.config;if(s.aborted)return;if(r>=2)if(self.clearTimeout(this.requestTimeout),s.loading.first===0&&(s.loading.first=Math.max(self.performance.now(),s.loading.start)),r===4){_.onreadystatechange=null,_.onprogress=null;var u=_.status;if(u>=200&&u<300){s.loading.end=Math.max(self.performance.now(),s.loading.first);var l,e;if(y.responseType==="arraybuffer"?(l=_.response,e=l.byteLength):(l=_.responseText,e=l.length),s.loaded=s.total=e,!this.callbacks)return;var t=this.callbacks.onProgress;if(t&&t(s,y,l,_),!this.callbacks)return;var n={url:_.responseURL,data:l};this.callbacks.onSuccess(n,s,y,_)}else s.retry>=i.maxRetry||u>=400&&u<499?(k.logger.error(u+" while loading "+y.url),this.callbacks.onError({code:u,text:_.statusText},y,_)):(k.logger.warn(u+" while loading "+y.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,i.maxRetryDelay),s.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout)},O.loadtimeout=function(){k.logger.warn("timeout while loading "+this.context.url);var y=this.callbacks;y&&(this.abortInternal(),y.onTimeout(this.stats,this.context,this.loader))},O.loadprogress=function(y){var _=this.stats;_.loaded=y.loaded,y.lengthComputable&&(_.total=y.total)},O.getCacheAge=function(){var y=null;if(this.loader&&L.test(this.loader.getAllResponseHeaders())){var _=this.loader.getResponseHeader("age");y=_?parseFloat(_):null}return y},N}();j.default=F}}).default})},vHTk:function(xt,ft,se){xt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);
|