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
872 KiB
384 lines
872 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[99,5,7,8],{"+92d":function(Ge,Ee,z){Ge.exports=z.p+"static/b1.8d46544a.svg"},"+ua5":function(Ge,Ee,z){},"55Ip":function(Ge,Ee,z){"use strict";z.d(Ee,"a",function(){return t});var re=z("Ty5D"),W=z("dI71"),I=z("cDcd"),H=z.n(I),L=z("YS25"),C=z("17x9"),j=z.n(C),U=z("wx14"),O=z("zLVn"),S=z("9R94"),_=function(u){Object(W.a)(i,u);function i(){for(var p,f=arguments.length,c=new Array(f),w=0;w<f;w++)c[w]=arguments[w];return p=u.call.apply(u,[this].concat(c))||this,p.history=Object(L.a)(p.props),p}var o=i.prototype;return o.render=function(){return H.a.createElement(re.c,{history:this.history,children:this.props.children})},i}(H.a.Component),b=function(u){Object(W.a)(i,u);function i(){for(var p,f=arguments.length,c=new Array(f),w=0;w<f;w++)c[w]=arguments[w];return p=u.call.apply(u,[this].concat(c))||this,p.history=Object(L.b)(p.props),p}var o=i.prototype;return o.render=function(){return H.a.createElement(re.c,{history:this.history,children:this.props.children})},i}(H.a.Component),h=function(i,o){return typeof i=="function"?i(o):i},l=function(i,o){return typeof i=="string"?Object(L.c)(i,null,null,o):i},r=function(i){return i},s=H.a.forwardRef;typeof s=="undefined"&&(s=r);function a(u){return!!(u.metaKey||u.altKey||u.ctrlKey||u.shiftKey)}var e=s(function(u,i){var o=u.innerRef,p=u.navigate,f=u.onClick,c=Object(O.a)(u,["innerRef","navigate","onClick"]),w=c.target,A=Object(U.a)({},c,{onClick:function(N){try{f&&f(N)}catch(B){throw N.preventDefault(),B}!N.defaultPrevented&&N.button===0&&(!w||w==="_self")&&!a(N)&&(N.preventDefault(),p())}});return r!==s?A.ref=i||o:A.ref=o,H.a.createElement("a",A)}),t=s(function(u,i){var o=u.component,p=o===void 0?e:o,f=u.replace,c=u.to,w=u.innerRef,A=Object(O.a)(u,["component","replace","to","innerRef"]);return H.a.createElement(re.e.Consumer,null,function(P){P||Object(S.a)(!1);var N=P.history,B=l(h(c,P.location),P.location),R=B?N.createHref(B):"",F=Object(U.a)({},A,{href:R,navigate:function(){var X=h(c,P.location),ee=f?N.replace:N.push;ee(X)}});return r!==s?F.ref=i||w:F.innerRef=w,H.a.createElement(p,F)})});if(!1)var n,x;var E=function(i){return i},g=H.a.forwardRef;typeof g=="undefined"&&(g=E);function y(){for(var u=arguments.length,i=new Array(u),o=0;o<u;o++)i[o]=arguments[o];return i.filter(function(p){return p}).join(" ")}var v=g(function(u,i){var o=u["aria-current"],p=o===void 0?"page":o,f=u.activeClassName,c=f===void 0?"active":f,w=u.activeStyle,A=u.className,P=u.exact,N=u.isActive,B=u.location,R=u.sensitive,F=u.strict,K=u.style,X=u.to,ee=u.innerRef,oe=Object(O.a)(u,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return H.a.createElement(re.e.Consumer,null,function(ce){ce||Object(S.a)(!1);var le=B||ce.location,be=l(h(X,le),le),pe=be.pathname,de=pe&&pe.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),te=de?Object(re.f)(le.pathname,{path:de,exact:P,sensitive:R,strict:F}):null,Le=!!(N?N(te,le):te),Ve=Le?y(A,c):A,Ne=Le?Object(U.a)({},K,{},w):K,Be=Object(U.a)({"aria-current":Le&&p||null,className:Ve,style:Ne,to:be},oe);return E!==g?Be.ref=i||ee:Be.innerRef=ee,H.a.createElement(t,Be)})});if(!1)var d},"5VLF":function(Ge,Ee,z){"use strict";var re,W;function I(H,L,C){var j=function(U,O){return H.js_beautify(U,O)};return j.js=H.js_beautify,j.css=L.css_beautify,j.html=C.html_beautify,j.js_beautify=H.js_beautify,j.css_beautify=L.css_beautify,j.html_beautify=C.html_beautify,j}!(re=[z("6UM0"),z("TXwP"),z("psGv")],W=function(H,L,C){return I(H,L,C)}.apply(Ee,re),W!==void 0&&(Ge.exports=W))},"6+eU":function(Ge,Ee,z){"use strict";z.d(Ee,"a",function(){return g});var re=z("wx14"),W=z("rePB"),I=z("VTBJ"),H=z("1OyB"),L=z("vuIU"),C=z("Ji7U"),j=z("LK+K"),U=z("cDcd"),O=z.n(U),S=z("TSYQ"),_=z.n(S),b=function(v){var d,u="".concat(v.rootPrefixCls,"-item"),i=_()(u,"".concat(u,"-").concat(v.page),(d={},Object(W.a)(d,"".concat(u,"-active"),v.active),Object(W.a)(d,v.className,!!v.className),Object(W.a)(d,"".concat(u,"-disabled"),!v.page),d)),o=function(){v.onClick(v.page)},p=function(c){v.onKeyPress(c,v.onClick,v.page)};return O.a.createElement("li",{title:v.showTitle?v.page:null,className:i,onClick:o,onKeyPress:p,tabIndex:"0"},v.itemRender(v.page,"page",O.a.createElement("a",{rel:"nofollow"},v.page)))},h=b,l={ZERO:48,NINE:57,NUMPAD_ZERO:96,NUMPAD_NINE:105,BACKSPACE:8,DELETE:46,ENTER:13,ARROW_UP:38,ARROW_DOWN:40},r=function(y){Object(C.a)(d,y);var v=Object(j.a)(d);function d(){var u;Object(H.a)(this,d);for(var i=arguments.length,o=new Array(i),p=0;p<i;p++)o[p]=arguments[p];return u=v.call.apply(v,[this].concat(o)),u.state={goInputText:""},u.buildOptionText=function(f){return"".concat(f," ").concat(u.props.locale.items_per_page)},u.changeSize=function(f){u.props.changeSize(Number(f))},u.handleChange=function(f){u.setState({goInputText:f.target.value})},u.handleBlur=function(f){var c=u.props,w=c.goButton,A=c.quickGo,P=c.rootPrefixCls,N=u.state.goInputText;if(w||N==="")return;if(f.relatedTarget&&(f.relatedTarget.className.indexOf("".concat(P,"-prev"))>=0||f.relatedTarget.className.indexOf("".concat(P,"-next"))>=0))return;u.setState({goInputText:""}),A(u.getValidValue())},u.go=function(f){var c=u.state.goInputText;if(c==="")return;(f.keyCode===l.ENTER||f.type==="click")&&(u.setState({goInputText:""}),u.props.quickGo(u.getValidValue()))},u}return Object(L.a)(d,[{key:"getValidValue",value:function(){var i=this.state,o=i.goInputText,p=i.current;return!o||isNaN(o)?p:Number(o)}},{key:"getPageSizeOptions",value:function(){var i=this.props,o=i.pageSize,p=i.pageSizeOptions;return p.some(function(f){return f.toString()===o.toString()})?p:p.concat([o.toString()]).sort(function(f,c){var w=isNaN(Number(f))?0:Number(f),A=isNaN(Number(c))?0:Number(c);return w-A})}},{key:"render",value:function(){var i=this,o=this.props,p=o.pageSize,f=o.locale,c=o.rootPrefixCls,w=o.changeSize,A=o.quickGo,P=o.goButton,N=o.selectComponentClass,B=o.buildOptionText,R=o.selectPrefixCls,F=o.disabled,K=this.state.goInputText,X="".concat(c,"-options"),ee=N,oe=null,ce=null,le=null;if(!w&&!A)return null;var be=this.getPageSizeOptions();if(w&&ee){var pe=be.map(function(de,te){return O.a.createElement(ee.Option,{key:te,value:de.toString()},(B||i.buildOptionText)(de))});oe=O.a.createElement(ee,{disabled:F,prefixCls:R,showSearch:!1,className:"".concat(X,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(p||be[0]).toString(),onChange:this.changeSize,getPopupContainer:function(te){return te.parentNode}},pe)}return A&&(P&&(le=typeof P=="boolean"?O.a.createElement("button",{type:"button",onClick:this.go,onKeyUp:this.go,disabled:F,className:"".concat(X,"-quick-jumper-button")},f.jump_to_confirm):O.a.createElement("span",{onClick:this.go,onKeyUp:this.go},P)),ce=O.a.createElement("div",{className:"".concat(X,"-quick-jumper")},f.jump_to,O.a.createElement("input",{disabled:F,type:"text",value:K,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur}),f.page,le)),O.a.createElement("li",{className:"".concat(X)},oe,ce)}}]),d}(O.a.Component);r.defaultProps={pageSizeOptions:["10","20","50","100"]};var s=r,a=z("N2Kk");function e(){}function t(y){return typeof y=="number"&&isFinite(y)&&Math.floor(y)===y}function n(y,v,d){return d}function x(y,v,d){var u=typeof y=="undefined"?v.pageSize:y;return Math.floor((d.total-1)/u)+1}var E=function(y){Object(C.a)(d,y);var v=Object(j.a)(d);function d(u){var i;Object(H.a)(this,d),i=v.call(this,u),i.getJumpPrevPage=function(){return Math.max(1,i.state.current-(i.props.showLessItems?3:5))},i.getJumpNextPage=function(){return Math.min(x(void 0,i.state,i.props),i.state.current+(i.props.showLessItems?3:5))},i.getItemIcon=function(w,A){var P=i.props.prefixCls,N=w||O.a.createElement("button",{type:"button","aria-label":A,className:"".concat(P,"-item-link")});return typeof w=="function"&&(N=O.a.createElement(w,Object(I.a)({},i.props))),N},i.savePaginationNode=function(w){i.paginationNode=w},i.isValid=function(w){return t(w)&&w!==i.state.current},i.shouldDisplayQuickJumper=function(){var w=i.props,A=w.showQuickJumper,P=w.pageSize,N=w.total;return N<=P?!1:A},i.handleKeyDown=function(w){(w.keyCode===l.ARROW_UP||w.keyCode===l.ARROW_DOWN)&&w.preventDefault()},i.handleKeyUp=function(w){var A=i.getValidValue(w),P=i.state.currentInputValue;A!==P&&i.setState({currentInputValue:A}),w.keyCode===l.ENTER?i.handleChange(A):w.keyCode===l.ARROW_UP?i.handleChange(A-1):w.keyCode===l.ARROW_DOWN&&i.handleChange(A+1)},i.changePageSize=function(w){var A=i.state.current,P=x(w,i.state,i.props);A=A>P?P:A,P===0&&(A=i.state.current),typeof w=="number"&&("pageSize"in i.props||i.setState({pageSize:w}),"current"in i.props||i.setState({current:A,currentInputValue:A})),i.props.onShowSizeChange(A,w),"onChange"in i.props&&i.props.onChange&&i.props.onChange(A,w)},i.handleChange=function(w){var A=i.props.disabled,P=w;if(i.isValid(P)&&!A){var N=x(void 0,i.state,i.props);P>N?P=N:P<1&&(P=1),"current"in i.props||i.setState({current:P,currentInputValue:P});var B=i.state.pageSize;return i.props.onChange(P,B),P}return i.state.current},i.prev=function(){i.hasPrev()&&i.handleChange(i.state.current-1)},i.next=function(){i.hasNext()&&i.handleChange(i.state.current+1)},i.jumpPrev=function(){i.handleChange(i.getJumpPrevPage())},i.jumpNext=function(){i.handleChange(i.getJumpNextPage())},i.hasPrev=function(){return i.state.current>1},i.hasNext=function(){return i.state.current<x(void 0,i.state,i.props)},i.runIfEnter=function(w,A){if(w.key==="Enter"||w.charCode===13){for(var P=arguments.length,N=new Array(P>2?P-2:0),B=2;B<P;B++)N[B-2]=arguments[B];A.apply(void 0,N)}},i.runIfEnterPrev=function(w){i.runIfEnter(w,i.prev)},i.runIfEnterNext=function(w){i.runIfEnter(w,i.next)},i.runIfEnterJumpPrev=function(w){i.runIfEnter(w,i.jumpPrev)},i.runIfEnterJumpNext=function(w){i.runIfEnter(w,i.jumpNext)},i.handleGoTO=function(w){(w.keyCode===l.ENTER||w.type==="click")&&i.handleChange(i.state.currentInputValue)};var o=u.onChange!==e,p="current"in u;p&&!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=u.defaultCurrent;"current"in u&&(f=u.current);var c=u.defaultPageSize;return"pageSize"in u&&(c=u.pageSize),f=Math.min(f,x(c,void 0,u)),i.state={current:f,currentInputValue:f,pageSize:c},i}return Object(L.a)(d,[{key:"componentDidUpdate",value:function(i,o){var p=this.props.prefixCls;if(o.current!==this.state.current&&this.paginationNode){var f=this.paginationNode.querySelector(".".concat(p,"-item-").concat(o.current));f&&document.activeElement===f&&f.blur()}}},{key:"getValidValue",value:function(i){var o=i.target.value,p=x(void 0,this.state,this.props),f=this.state.currentInputValue,c;return o===""?c=o:isNaN(Number(o))?c=f:o>=p?c=p:c=Number(o),c}},{key:"getShowSizeChanger",value:function(){var i=this.props,o=i.showSizeChanger,p=i.total,f=i.totalBoundaryShowSizeChanger;return typeof o!="undefined"?o:p>f}},{key:"renderPrev",value:function(i){var o=this.props,p=o.prevIcon,f=o.itemRender,c=f(i,"prev",this.getItemIcon(p,"prev page")),w=!this.hasPrev();return Object(U.isValidElement)(c)?Object(U.cloneElement)(c,{disabled:w}):c}},{key:"renderNext",value:function(i){var o=this.props,p=o.nextIcon,f=o.itemRender,c=f(i,"next",this.getItemIcon(p,"next page")),w=!this.hasNext();return Object(U.isValidElement)(c)?Object(U.cloneElement)(c,{disabled:w}):c}},{key:"render",value:function(){var i=this,o=this.props,p=o.prefixCls,f=o.className,c=o.style,w=o.disabled,A=o.hideOnSinglePage,P=o.total,N=o.locale,B=o.showQuickJumper,R=o.showLessItems,F=o.showTitle,K=o.showTotal,X=o.simple,ee=o.itemRender,oe=o.showPrevNextJumpers,ce=o.jumpPrevIcon,le=o.jumpNextIcon,be=o.selectComponentClass,pe=o.selectPrefixCls,de=o.pageSizeOptions,te=this.state,Le=te.current,Ve=te.pageSize,Ne=te.currentInputValue;if(A===!0&&P<=Ve)return null;var Be=x(void 0,this.state,this.props),ve=[],ye=null,Ie=null,Ae=null,ge=null,Ce=null,Oe=B&&B.goButton,Se=R?1:2,De=Le-1>0?Le-1:0,je=Le+1<Be?Le+1:Be,Me=Object.keys(this.props).reduce(function(V,Y){return(Y.substr(0,5)==="data-"||Y.substr(0,5)==="aria-"||Y==="role")&&(V[Y]=i.props[Y]),V},{});if(X)return Oe&&(typeof Oe=="boolean"?Ce=O.a.createElement("button",{type:"button",onClick:this.handleGoTO,onKeyUp:this.handleGoTO},N.jump_to_confirm):Ce=O.a.createElement("span",{onClick:this.handleGoTO,onKeyUp:this.handleGoTO},Oe),Ce=O.a.createElement("li",{title:F?"".concat(N.jump_to).concat(Le,"/").concat(Be):null,className:"".concat(p,"-simple-pager")},Ce)),O.a.createElement("ul",Object(re.a)({className:_()(p,"".concat(p,"-simple"),Object(W.a)({},"".concat(p,"-disabled"),w),f),style:c,ref:this.savePaginationNode},Me),O.a.createElement("li",{title:F?N.prev_page:null,onClick:this.prev,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterPrev,className:_()("".concat(p,"-prev"),Object(W.a)({},"".concat(p,"-disabled"),!this.hasPrev())),"aria-disabled":!this.hasPrev()},this.renderPrev(De)),O.a.createElement("li",{title:F?"".concat(Le,"/").concat(Be):null,className:"".concat(p,"-simple-pager")},O.a.createElement("input",{type:"text",value:Ne,disabled:w,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onChange:this.handleKeyUp,size:"3"}),O.a.createElement("span",{className:"".concat(p,"-slash")},"/"),Be),O.a.createElement("li",{title:F?N.next_page:null,onClick:this.next,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterNext,className:_()("".concat(p,"-next"),Object(W.a)({},"".concat(p,"-disabled"),!this.hasNext())),"aria-disabled":!this.hasNext()},this.renderNext(je)),Ce);if(Be<=3+Se*2){var Fe={locale:N,rootPrefixCls:p,onClick:this.handleChange,onKeyPress:this.runIfEnter,showTitle:F,itemRender:ee};Be||ve.push(O.a.createElement(h,Object(re.a)({},Fe,{key:"noPager",page:Be,className:"".concat(p,"-disabled")})));for(var We=1;We<=Be;We+=1){var ze=Le===We;ve.push(O.a.createElement(h,Object(re.a)({},Fe,{key:We,page:We,active:ze})))}}else{var ne=R?N.prev_3:N.prev_5,ue=R?N.next_3:N.next_5;oe&&(ye=O.a.createElement("li",{title:F?ne:null,key:"prev",onClick:this.jumpPrev,tabIndex:"0",onKeyPress:this.runIfEnterJumpPrev,className:_()("".concat(p,"-jump-prev"),Object(W.a)({},"".concat(p,"-jump-prev-custom-icon"),!!ce))},ee(this.getJumpPrevPage(),"jump-prev",this.getItemIcon(ce,"prev page"))),Ie=O.a.createElement("li",{title:F?ue:null,key:"next",tabIndex:"0",onClick:this.jumpNext,onKeyPress:this.runIfEnterJumpNext,className:_()("".concat(p,"-jump-next"),Object(W.a)({},"".concat(p,"-jump-next-custom-icon"),!!le))},ee(this.getJumpNextPage(),"jump-next",this.getItemIcon(le,"next page")))),ge=O.a.createElement(h,{locale:N,last:!0,rootPrefixCls:p,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:Be,page:Be,active:!1,showTitle:F,itemRender:ee}),Ae=O.a.createElement(h,{locale:N,rootPrefixCls:p,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:1,page:1,active:!1,showTitle:F,itemRender:ee});var me=Math.max(1,Le-Se),_e=Math.min(Le+Se,Be);Le-1<=Se&&(_e=1+Se*2),Be-Le<=Se&&(me=Be-Se*2);for(var se=me;se<=_e;se+=1){var fe=Le===se;ve.push(O.a.createElement(h,{locale:N,rootPrefixCls:p,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:se,page:se,active:fe,showTitle:F,itemRender:ee}))}Le-1>=Se*2&&Le!==1+2&&(ve[0]=Object(U.cloneElement)(ve[0],{className:"".concat(p,"-item-after-jump-prev")}),ve.unshift(ye)),Be-Le>=Se*2&&Le!==Be-2&&(ve[ve.length-1]=Object(U.cloneElement)(ve[ve.length-1],{className:"".concat(p,"-item-before-jump-next")}),ve.push(Ie)),me!==1&&ve.unshift(Ae),_e!==Be&&ve.push(ge)}var Z=null;K&&(Z=O.a.createElement("li",{className:"".concat(p,"-total-text")},K(P,[P===0?0:(Le-1)*Ve+1,Le*Ve>P?P:Le*Ve])));var Q=!this.hasPrev()||!Be,$=!this.hasNext()||!Be;return O.a.createElement("ul",Object(re.a)({className:_()(p,f,Object(W.a)({},"".concat(p,"-disabled"),w)),style:c,unselectable:"unselectable",ref:this.savePaginationNode},Me),Z,O.a.createElement("li",{title:F?N.prev_page:null,onClick:this.prev,tabIndex:Q?null:0,onKeyPress:this.runIfEnterPrev,className:_()("".concat(p,"-prev"),Object(W.a)({},"".concat(p,"-disabled"),Q)),"aria-disabled":Q},this.renderPrev(De)),ve,O.a.createElement("li",{title:F?N.next_page:null,onClick:this.next,tabIndex:$?null:0,onKeyPress:this.runIfEnterNext,className:_()("".concat(p,"-next"),Object(W.a)({},"".concat(p,"-disabled"),$)),"aria-disabled":$},this.renderNext(je)),O.a.createElement(s,{disabled:w,locale:N,rootPrefixCls:p,selectComponentClass:be,selectPrefixCls:pe,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:Le,pageSize:Ve,pageSizeOptions:de,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:Oe}))}}],[{key:"getDerivedStateFromProps",value:function(i,o){var p={};if("current"in i&&(p.current=i.current,i.current!==o.current&&(p.currentInputValue=p.current)),"pageSize"in i&&i.pageSize!==o.pageSize){var f=o.current,c=x(i.pageSize,o,i);f=f>c?c:f,"current"in i||(p.current=f,p.currentInputValue=f),p.pageSize=i.pageSize}return p}}]),d}(O.a.Component);E.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:a.a,style:{},itemRender:n,totalBoundaryShowSizeChanger:50};var g=E},"6RRn":function(Ge,Ee,z){"use strict";var re=z("wCXF"),W=z("n6Qo");z.d(Ee,"b",function(){return W.a});var I=z("IBYe"),H=z("6eGT"),L=z("hW8S");z.d(Ee,"a",function(){return L.a}),Ee.c=re.b},"6UM0":function(Ge,Ee,z){var re,W;(function(){var I;(function(){"use strict";var L=[function(O,S,_){var b=_(1).Beautifier,h=_(5).Options;function l(r,s){var a=new b(r,s);return a.beautify()}O.exports=l,O.exports.defaultOptions=function(){return new h}},function(O,S,_){var b=_(2).Output,h=_(3).Token,l=_(4),r=_(5).Options,s=_(7).Tokenizer,a=_(7).line_starters,e=_(7).positionable_operators,t=_(7).TOKEN;function n(R,F){return F.indexOf(R)!==-1}function x(R){return R.replace(/^\s+/g,"")}function E(R){for(var F={},K=0;K<R.length;K++)F[R[K].replace(/-/g,"_")]=R[K];return F}function g(R,F){return R&&R.type===t.RESERVED&&R.text===F}function y(R,F){return R&&R.type===t.RESERVED&&n(R.text,F)}var v=["case","return","do","if","throw","else","await","break","continue","async"],d=["before-newline","after-newline","preserve-newline"],u=E(d),i=[u.before_newline,u.preserve_newline],o={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function p(R,F){if(F.multiline_frame||F.mode===o.ForInitializer||F.mode===o.Conditional)return;R.remove_indent(F.start_line_index)}function f(R){R=R.replace(l.allLineBreaks,`
|
|
`);for(var F=[],K=R.indexOf(`
|
|
`);K!==-1;)F.push(R.substring(0,K)),R=R.substring(K+1),K=R.indexOf(`
|
|
`);return R.length&&F.push(R),F}function c(R){return R===o.ArrayLiteral}function w(R){return n(R,[o.Expression,o.ForInitializer,o.Conditional])}function A(R,F){for(var K=0;K<R.length;K++){var X=R[K].trim();if(X.charAt(0)!==F)return!1}return!0}function P(R,F){for(var K=0,X=R.length,ee;K<X;K++)if(ee=R[K],ee&&ee.indexOf(F)!==0)return!1;return!0}function N(R,F){F=F||{},this._source_text=R||"",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 r(F)}N.prototype.create_flags=function(R,F){var K=0;R&&(K=R.indentation_level,!this._output.just_added_newline()&&R.line_indent_level>K&&(K=R.line_indent_level));var X={mode:F,parent:R,last_token:R?R.last_token:new h(t.START_BLOCK,""),last_word:R?R.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:K,alignment:0,line_indent_level:R?R.line_indent_level:K,start_line_index:this._output.get_line_number(),ternary_depth:0};return X},N.prototype._reset=function(R){var F=R.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new b(this._options,F),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(o.BlockStatement);var K=new s(R,this._options);return this._tokens=K.tokenize(),R},N.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var R,F=this._reset(this._source_text),K=this._options.eol;this._options.eol==="auto"&&(K=`
|
|
`,F&&l.lineBreak.test(F||"")&&(K=F.match(l.lineBreak)[0]));for(var X=this._tokens.next();X;)this.handle_token(X),this._last_last_text=this._flags.last_token.text,this._flags.last_token=X,X=this._tokens.next();return R=this._output.get_code(K),R},N.prototype.handle_token=function(R,F){R.type===t.START_EXPR?this.handle_start_expr(R):R.type===t.END_EXPR?this.handle_end_expr(R):R.type===t.START_BLOCK?this.handle_start_block(R):R.type===t.END_BLOCK?this.handle_end_block(R):R.type===t.WORD?this.handle_word(R):R.type===t.RESERVED?this.handle_word(R):R.type===t.SEMICOLON?this.handle_semicolon(R):R.type===t.STRING?this.handle_string(R):R.type===t.EQUALS?this.handle_equals(R):R.type===t.OPERATOR?this.handle_operator(R):R.type===t.COMMA?this.handle_comma(R):R.type===t.BLOCK_COMMENT?this.handle_block_comment(R,F):R.type===t.COMMENT?this.handle_comment(R,F):R.type===t.DOT?this.handle_dot(R):R.type===t.EOF?this.handle_eof(R):R.type===t.UNKNOWN?this.handle_unknown(R,F):this.handle_unknown(R,F)},N.prototype.handle_whitespace_and_comments=function(R,F){var K=R.newlines,X=this._options.keep_array_indentation&&c(this._flags.mode);if(R.comments_before)for(var ee=R.comments_before.next();ee;)this.handle_whitespace_and_comments(ee,F),this.handle_token(ee,F),ee=R.comments_before.next();if(X)for(var oe=0;oe<K;oe+=1)this.print_newline(oe>0,F);else if(this._options.max_preserve_newlines&&K>this._options.max_preserve_newlines&&(K=this._options.max_preserve_newlines),this._options.preserve_newlines&&K>1){this.print_newline(!1,F);for(var ce=1;ce<K;ce+=1)this.print_newline(!0,F)}};var B=["async","break","continue","return","throw","yield"];N.prototype.allow_wrap_or_preserved_newline=function(R,F){if(F=F===void 0?!1:F,this._output.just_added_newline())return;var K=this._options.preserve_newlines&&R.newlines||F,X=n(this._flags.last_token.text,e)||n(R.text,e);if(X){var ee=n(this._flags.last_token.text,e)&&n(this._options.operator_position,i)||n(R.text,e);K=K&&ee}if(K)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(y(this._flags.last_token,B))return;this._output.set_wrap_point()}},N.prototype.print_newline=function(R,F){if(!F&&(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 K=this._tokens.peek();this._flags.mode===o.Statement&&!(this._flags.if_block&&g(K,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(R)&&(this._flags.multiline_frame=!0)},N.prototype.print_token_line_indentation=function(R){this._output.just_added_newline()&&(this._options.keep_array_indentation&&R.newlines&&(R.text==="["||c(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(R.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))},N.prototype.print_token=function(R){if(this._output.raw){this._output.add_raw_token(R);return}if(this._options.comma_first&&R.previous&&R.previous.type===t.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var F=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(F),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(R),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(R),this._output.non_breaking_space=!0,this._output.add_token(R.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},N.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},N.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))},N.prototype.set_mode=function(R){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,R),this._flags=this.create_flags(this._previous_flags,R),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},N.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&&p(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},N.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||y(this._flags.last_token,["get","set"]))},N.prototype.start_of_statement=function(R){var F=!1;return F=F||y(this._flags.last_token,["var","let","const"])&&R.type===t.WORD,F=F||g(this._flags.last_token,"do"),F=F||!(this._flags.parent.mode===o.ObjectLiteral&&this._flags.mode===o.Statement)&&y(this._flags.last_token,B)&&!R.newlines,F=F||g(this._flags.last_token,"else")&&!(g(R,"if")&&!R.comments_before),F=F||this._flags.last_token.type===t.END_EXPR&&(this._previous_flags.mode===o.ForInitializer||this._previous_flags.mode===o.Conditional),F=F||this._flags.last_token.type===t.WORD&&this._flags.mode===o.BlockStatement&&!this._flags.in_case&&!(R.text==="--"||R.text==="++")&&this._last_last_text!=="function"&&R.type!==t.WORD&&R.type!==t.RESERVED,F=F||this._flags.mode===o.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||y(this._flags.last_token,["get","set"])),F?(this.set_mode(o.Statement),this.indent(),this.handle_whitespace_and_comments(R,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(R,y(R,["do","for","if","while"])),!0):!1},N.prototype.handle_start_expr=function(R){this.start_of_statement(R)||this.handle_whitespace_and_comments(R);var F=o.Expression;if(R.text==="["){if(this._flags.last_token.type===t.WORD||this._flags.last_token.text===")"){y(this._flags.last_token,a)&&(this._output.space_before_token=!0),this.print_token(R),this.set_mode(F),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}F=o.ArrayLiteral,c(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,F=o.ForInitializer):n(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,F=o.Conditional):n(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&R.whitespace_before===""?this._output.space_before_token=!1:(n(this._flags.last_token.text,a)||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(R);else if(this._flags.last_token.type===t.WORD){this._output.space_before_token=!1;var K=this._tokens.peek(-3);if(this._options.space_after_named_function&&K){var X=this._tokens.peek(-4);y(K,["async","function"])||K.text==="*"&&y(X,["async","function"])?this._output.space_before_token=!0:this._flags.mode===o.ObjectLiteral?(K.text==="{"||K.text===","||K.text==="*"&&(X.text==="{"||X.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(R);(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(R,R.newlines),this.print_token(R),this.set_mode(F),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},N.prototype.handle_end_expr=function(R){for(;this._flags.mode===o.Statement;)this.restore_mode();this.handle_whitespace_and_comments(R),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(R,R.text==="]"&&c(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(R),this.restore_mode(),p(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)},N.prototype.handle_start_block=function(R){this.handle_whitespace_and_comments(R);var F=this._tokens.peek(),K=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):K&&(n(K.text,[":",","])&&n(F.type,[t.STRING,t.WORD,t.RESERVED])||n(F.text,["get","set","..."])&&n(K.type,[t.WORD,t.RESERVED]))?n(this._last_last_text,["class","interface"])&&!n(K.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])||y(this._flags.last_token,["return","throw","import","default"])?this.set_mode(o.ObjectLiteral):this.set_mode(o.BlockStatement),this._flags.last_token&&(y(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0));var X=!F.comments_before&&F.text==="}",ee=X&&this._flags.last_word==="function"&&this._flags.last_token.type===t.END_EXPR;if(this._options.brace_preserve_inline){var oe=0,ce=null;this._flags.inline_frame=!0;do if(oe+=1,ce=this._tokens.peek(oe-1),ce.newlines){this._flags.inline_frame=!1;break}while(ce.type!==t.EOF&&!(ce.type===t.END_BLOCK&&ce.opened===R))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&R.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==t.OPERATOR&&(ee||this._flags.last_token.type===t.EQUALS||y(this._flags.last_token,v)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(c(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(R),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(R),this.indent(),!X&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},N.prototype.handle_end_block=function(R){for(this.handle_whitespace_and_comments(R);this._flags.mode===o.Statement;)this.restore_mode();var F=this._flags.last_token.type===t.START_BLOCK;this._flags.inline_frame&&!F?this._output.space_before_token=!0:this._options.brace_style==="expand"?F||this.print_newline():F||(c(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(R)},N.prototype.handle_word=function(R){if(R.type===t.RESERVED){if(n(R.text,["set","get"])&&this._flags.mode!==o.ObjectLiteral)R.type=t.WORD;else if(R.text==="import"&&n(this._tokens.peek().text,["(","."]))R.type=t.WORD;else if(n(R.text,["as","from"])&&!this._flags.import_block)R.type=t.WORD;else if(this._flags.mode===o.ObjectLiteral){var F=this._tokens.peek();F.text===":"&&(R.type=t.WORD)}}if(this.start_of_statement(R)?y(this._flags.last_token,["var","let","const"])&&R.type===t.WORD&&(this._flags.declaration_statement=!0):R.newlines&&!w(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||!y(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(R),this.print_newline()):this.handle_whitespace_and_comments(R),this._flags.do_block&&!this._flags.do_while)if(g(R,"while")){this._output.space_before_token=!0,this.print_token(R),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(R,"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&&y(R,["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(R),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(R)),g(R,"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()&&!R.comments_before&&(this.print_newline(),this.print_newline(!0))),this._flags.last_token.type===t.RESERVED||this._flags.last_token.type===t.WORD?y(this._flags.last_token,["get","set","new","export"])||y(this._flags.last_token,B)?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&&(w(this._flags.mode)||c(this._flags.mode))||this.print_newline(),this.print_token(R),this._flags.last_word=R.text;return}var K="NONE";if(this._flags.last_token.type===t.END_BLOCK?this._previous_flags.inline_frame?K="SPACE":y(R,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&R.newlines?K="NEWLINE":(K="SPACE",this._output.space_before_token=!0):K="NEWLINE":this._flags.last_token.type===t.SEMICOLON&&this._flags.mode===o.BlockStatement?K="NEWLINE":this._flags.last_token.type===t.SEMICOLON&&w(this._flags.mode)?K="SPACE":this._flags.last_token.type===t.STRING?K="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,["{",","]))?K="SPACE":this._flags.last_token.type===t.START_BLOCK?this._flags.inline_frame?K="SPACE":K="NEWLINE":this._flags.last_token.type===t.END_EXPR&&(this._output.space_before_token=!0,K="NEWLINE"),y(R,a)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?K="SPACE":K="NEWLINE"),y(R,["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"&&R.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var X=this._output.current_line;X.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else K==="NEWLINE"?y(this._flags.last_token,v)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&y(R,["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||!y(R,["var","let","const"]))&&this._flags.last_token.text!==":"&&(g(R,"if")&&g(R.previous,"else")?this._output.space_before_token=!0:this.print_newline()):y(R,a)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&c(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():K==="SPACE"&&(this._output.space_before_token=!0);R.previous&&(R.previous.type===t.WORD||R.previous.type===t.RESERVED)&&(this._output.space_before_token=!0),this.print_token(R),this._flags.last_word=R.text,R.type===t.RESERVED&&(R.text==="do"?this._flags.do_block=!0:R.text==="if"?this._flags.if_block=!0:R.text==="import"?this._flags.import_block=!0:this._flags.import_block&&g(R,"from")&&(this._flags.import_block=!1))},N.prototype.handle_semicolon=function(R){this.start_of_statement(R)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(R);for(var F=this._tokens.peek();this._flags.mode===o.Statement&&!(this._flags.if_block&&g(F,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(R)},N.prototype.handle_string=function(R){R.text.startsWith("`")&&R.newlines===0&&R.whitespace_before===""&&(R.previous.text===")"||this._flags.last_token.type===t.WORD)||(this.start_of_statement(R)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(R),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(R):R.text.startsWith("`")&&this._flags.last_token.type===t.END_EXPR&&(R.previous.text==="]"||R.previous.text===")")&&R.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(R)},N.prototype.handle_equals=function(R){this.start_of_statement(R)||this.handle_whitespace_and_comments(R),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(R),this._output.space_before_token=!0},N.prototype.handle_comma=function(R){this.handle_whitespace_and_comments(R,!0),this.print_token(R),this._output.space_before_token=!0,this._flags.declaration_statement?(w(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(R)):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(R)},N.prototype.handle_operator=function(R){var F=R.text==="*"&&(y(this._flags.last_token,["function","yield"])||n(this._flags.last_token.type,[t.START_BLOCK,t.COMMA,t.END_BLOCK,t.SEMICOLON])),K=n(R.text,["-","+"])&&(n(this._flags.last_token.type,[t.START_BLOCK,t.START_EXPR,t.EQUALS,t.OPERATOR])||n(this._flags.last_token.text,a)||this._flags.last_token.text===",");if(!this.start_of_statement(R)){var X=!F;this.handle_whitespace_and_comments(R,X)}if(R.text==="*"&&this._flags.last_token.type===t.DOT){this.print_token(R);return}if(R.text==="::"){this.print_token(R);return}if(this._flags.last_token.type===t.OPERATOR&&n(this._options.operator_position,i)&&this.allow_wrap_or_preserved_newline(R),R.text===":"&&this._flags.in_case){this.print_token(R),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 ee=!0,oe=!0,ce=!1;if(R.text===":"?this._flags.ternary_depth===0?ee=!1:(this._flags.ternary_depth-=1,ce=!0):R.text==="?"&&(this._flags.ternary_depth+=1),!K&&!F&&this._options.preserve_newlines&&n(R.text,e)){var le=R.text===":",be=le&&ce,pe=le&&!ce;switch(this._options.operator_position){case u.before_newline:this._output.space_before_token=!pe,this.print_token(R),(!le||be)&&this.allow_wrap_or_preserved_newline(R),this._output.space_before_token=!0;return;case u.after_newline:this._output.space_before_token=!0,!le||be?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(R):this._output.space_before_token=!1,this.print_token(R),this._output.space_before_token=!0;return;case u.preserve_newline:pe||this.allow_wrap_or_preserved_newline(R),ee=!(this._output.just_added_newline()||pe),this._output.space_before_token=ee,this.print_token(R),this._output.space_before_token=!0;return}}if(F){this.allow_wrap_or_preserved_newline(R),ee=!1;var de=this._tokens.peek();oe=de&&n(de.type,[t.WORD,t.RESERVED])}else if(R.text==="...")this.allow_wrap_or_preserved_newline(R),ee=this._flags.last_token.type===t.START_BLOCK,oe=!1;else if(n(R.text,["--","++","!","~"])||K){if((this._flags.last_token.type===t.COMMA||this._flags.last_token.type===t.START_EXPR)&&this.allow_wrap_or_preserved_newline(R),ee=!1,oe=!1,R.newlines&&(R.text==="--"||R.text==="++"||R.text==="~")){var te=y(this._flags.last_token,v)&&R.newlines;te&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(te,!0)}this._flags.last_token.text===";"&&w(this._flags.mode)&&(ee=!0),this._flags.last_token.type===t.RESERVED?ee=!0:this._flags.last_token.type===t.END_EXPR?ee=!(this._flags.last_token.text==="]"&&(R.text==="--"||R.text==="++")):this._flags.last_token.type===t.OPERATOR&&(ee=n(R.text,["--","-","++","+"])&&n(this._flags.last_token.text,["--","-","++","+"]),n(R.text,["+","-"])&&n(this._flags.last_token.text,["--","++"])&&(oe=!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||ee,this.print_token(R),this._output.space_before_token=oe},N.prototype.handle_block_comment=function(R,F){if(this._output.raw){this._output.add_raw_token(R),R.directives&&R.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(R.directives){this.print_newline(!1,F),this.print_token(R),R.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!l.newline.test(R.text)&&!R.newlines){this._output.space_before_token=!0,this.print_token(R),this._output.space_before_token=!0;return}else this.print_block_commment(R,F)},N.prototype.print_block_commment=function(R,F){var K=f(R.text),X,ee=!1,oe=!1,ce=R.whitespace_before,le=ce.length;if(this.print_newline(!1,F),this.print_token_line_indentation(R),this._output.add_token(K[0]),this.print_newline(!1,F),K.length>1){for(K=K.slice(1),ee=A(K,"*"),oe=P(K,ce),ee&&(this._flags.alignment=1),X=0;X<K.length;X++)ee?(this.print_token_line_indentation(R),this._output.add_token(x(K[X]))):oe&&K[X]?(this.print_token_line_indentation(R),this._output.add_token(K[X].substring(le))):(this._output.current_line.set_indent(-1),this._output.add_token(K[X])),this.print_newline(!1,F);this._flags.alignment=0}},N.prototype.handle_comment=function(R,F){R.newlines?this.print_newline(!1,F):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(R),this.print_newline(!1,F)},N.prototype.handle_dot=function(R){this.start_of_statement(R)||this.handle_whitespace_and_comments(R,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),y(this._flags.last_token,v)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(R,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(R)},N.prototype.handle_unknown=function(R,F){this.print_token(R),R.text[R.text.length-1]===`
|
|
`&&this.print_newline(!1,F)},N.prototype.handle_eof=function(R){for(;this._flags.mode===o.Statement;)this.restore_mode();this.handle_whitespace_and_comments(R)},O.exports.Beautifier=N},function(O){function S(h){this.__parent=h,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=[]}S.prototype.clone_empty=function(){var h=new S(this.__parent);return h.set_indent(this.__indent_count,this.__alignment_count),h},S.prototype.item=function(h){return h<0?this.__items[this.__items.length+h]:this.__items[h]},S.prototype.has_match=function(h){for(var l=this.__items.length-1;l>=0;l--)if(this.__items[l].match(h))return!0;return!1},S.prototype.set_indent=function(h,l){this.is_empty()&&(this.__indent_count=h||0,this.__alignment_count=l||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},S.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)},S.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},S.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var h=this.__parent.current_line;return h.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),h.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),h.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,h.__items[0]===" "&&(h.__items.splice(0,1),h.__character_count-=1),!0}return!1},S.prototype.is_empty=function(){return this.__items.length===0},S.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},S.prototype.push=function(h){this.__items.push(h);var l=h.lastIndexOf(`
|
|
`);l!==-1?this.__character_count=h.length-l:this.__character_count+=h.length},S.prototype.pop=function(){var h=null;return this.is_empty()||(h=this.__items.pop(),this.__character_count-=h.length),h},S.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},S.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},S.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},S.prototype.toString=function(){var h="";return this.is_empty()?this.__parent.indent_empty_lines&&(h=this.__parent.get_indent_string(this.__indent_count)):(h=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),h+=this.__items.join("")),h};function _(h,l){this.__cache=[""],this.__indent_size=h.indent_size,this.__indent_string=h.indent_char,h.indent_with_tabs||(this.__indent_string=new Array(h.indent_size+1).join(h.indent_char)),l=l||"",h.indent_level>0&&(l=new Array(h.indent_level+1).join(this.__indent_string)),this.__base_string=l,this.__base_string_length=l.length}_.prototype.get_indent_size=function(h,l){var r=this.__base_string_length;return l=l||0,h<0&&(r=0),r+=h*this.__indent_size,r+=l,r},_.prototype.get_indent_string=function(h,l){var r=this.__base_string;return l=l||0,h<0&&(h=0,r=""),l+=h*this.__indent_size,this.__ensure_cache(l),r+=this.__cache[l],r},_.prototype.__ensure_cache=function(h){for(;h>=this.__cache.length;)this.__add_column()},_.prototype.__add_column=function(){var h=this.__cache.length,l=0,r="";this.__indent_size&&h>=this.__indent_size&&(l=Math.floor(h/this.__indent_size),h-=l*this.__indent_size,r=new Array(l+1).join(this.__indent_string)),h&&(r+=new Array(h+1).join(" ")),this.__cache.push(r)};function b(h,l){this.__indent_cache=new _(h,l),this.raw=!1,this._end_with_newline=h.end_with_newline,this.indent_size=h.indent_size,this.wrap_line_length=h.wrap_line_length,this.indent_empty_lines=h.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new S(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}b.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},b.prototype.get_line_number=function(){return this.__lines.length},b.prototype.get_indent_string=function(h,l){return this.__indent_cache.get_indent_string(h,l)},b.prototype.get_indent_size=function(h,l){return this.__indent_cache.get_indent_size(h,l)},b.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},b.prototype.add_new_line=function(h){return this.is_empty()||!h&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},b.prototype.get_code=function(h){this.trim(!0);var l=this.current_line.pop();l&&(l[l.length-1]===`
|
|
`&&(l=l.replace(/\n+$/g,"")),this.current_line.push(l)),this._end_with_newline&&this.__add_outputline();var r=this.__lines.join(`
|
|
`);return h!==`
|
|
`&&(r=r.replace(/[\n]/g,h)),r},b.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},b.prototype.set_indent=function(h,l){return h=h||0,l=l||0,this.next_line.set_indent(h,l),this.__lines.length>1?(this.current_line.set_indent(h,l),!0):(this.current_line.set_indent(),!1)},b.prototype.add_raw_token=function(h){for(var l=0;l<h.newlines;l++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(h.whitespace_before),this.current_line.push(h.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},b.prototype.add_token=function(h){this.__add_space_before_token(),this.current_line.push(h),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},b.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(" "))},b.prototype.remove_indent=function(h){for(var l=this.__lines.length;h<l;)this.__lines[h]._remove_indent(),h++;this.current_line._remove_wrap_indent()},b.prototype.trim=function(h){for(h=h===void 0?!1:h,this.current_line.trim();h&&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},b.prototype.just_added_newline=function(){return this.current_line.is_empty()},b.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},b.prototype.ensure_empty_line_above=function(h,l){for(var r=this.__lines.length-2;r>=0;){var s=this.__lines[r];if(s.is_empty())break;if(s.item(0).indexOf(h)!==0&&s.item(-1)!==l){this.__lines.splice(r+1,0,new S(this)),this.previous_line=this.__lines[this.__lines.length-2];break}r--}},O.exports.Output=b},function(O){function S(_,b,h,l){this.type=_,this.text=b,this.comments_before=null,this.newlines=h||0,this.whitespace_before=l||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}O.exports.Token=S},function(O,S){var _="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",b="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",h="\\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",l="\\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",r="(?:\\\\u[0-9a-fA-F]{4}|["+_+h+"])",s="(?:\\\\u[0-9a-fA-F]{4}|["+b+h+l+"])*";S.identifier=new RegExp(r+s,"g"),S.identifierStart=new RegExp(r),S.identifierMatch=new RegExp("(?:\\\\u[0-9a-fA-F]{4}|["+b+h+l+"])+");var a=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;S.newline=/[\n\r\u2028\u2029]/,S.lineBreak=new RegExp(`\r
|
|
|`+S.newline.source),S.allLineBreaks=new RegExp(S.lineBreak.source,"g")},function(O,S,_){var b=_(6).Options,h=["before-newline","after-newline","preserve-newline"];function l(r){b.call(this,r,"js");var s=this.raw_options.brace_style||null;s==="expand-strict"?this.raw_options.brace_style="expand":s==="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 a=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<a.length;e++)a[e]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=a[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",h),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}l.prototype=new b,O.exports.Options=l},function(O){function S(h,l){this.raw_options=_(h,l),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"])}S.prototype._get_array=function(h,l){var r=this.raw_options[h],s=l||[];return typeof r=="object"?r!==null&&typeof r.concat=="function"&&(s=r.concat()):typeof r=="string"&&(s=r.split(/[^a-zA-Z0-9_\/\-]+/)),s},S.prototype._get_boolean=function(h,l){var r=this.raw_options[h],s=r===void 0?!!l:!!r;return s},S.prototype._get_characters=function(h,l){var r=this.raw_options[h],s=l||"";return typeof r=="string"&&(s=r.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),s},S.prototype._get_number=function(h,l){var r=this.raw_options[h];l=parseInt(l,10),isNaN(l)&&(l=0);var s=parseInt(r,10);return isNaN(s)&&(s=l),s},S.prototype._get_selection=function(h,l,r){var s=this._get_selection_list(h,l,r);if(s.length!==1)throw new Error("Invalid Option Value: The option '"+h+`' can only be one of the following values:
|
|
`+l+`
|
|
You passed in: '`+this.raw_options[h]+"'");return s[0]},S.prototype._get_selection_list=function(h,l,r){if(!l||l.length===0)throw new Error("Selection list cannot be empty.");if(r=r||[l[0]],!this._is_valid_selection(r,l))throw new Error("Invalid Default Value!");var s=this._get_array(h,r);if(!this._is_valid_selection(s,l))throw new Error("Invalid Option Value: The option '"+h+`' can contain only the following values:
|
|
`+l+`
|
|
You passed in: '`+this.raw_options[h]+"'");return s},S.prototype._is_valid_selection=function(h,l){return h.length&&l.length&&!h.some(function(r){return l.indexOf(r)===-1})};function _(h,l){var r={};h=b(h);var s;for(s in h)s!==l&&(r[s]=h[s]);if(l&&h[l])for(s in h[l])r[s]=h[l][s];return r}function b(h){var l={},r;for(r in h){var s=r.replace(/-/g,"_");l[s]=h[r]}return l}O.exports.Options=S,O.exports.normalizeOpts=b,O.exports.mergeOpts=_},function(O,S,_){var b=_(8).InputScanner,h=_(9).Tokenizer,l=_(9).TOKEN,r=_(13).Directives,s=_(4),a=_(12).Pattern,e=_(14).TemplatablePattern;function t(A,P){return P.indexOf(A)!==-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:l.START,RAW:l.RAW,EOF:l.EOF},x=new r(/\/\*/,/\*\//),E=/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]/,y=/[^\d\.]/,v=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),d=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";d=d.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),d="\\?\\.(?!\\d) "+d,d=d.replace(/ /g,"|");var u=new RegExp(d),i="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),o=i.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),p=new RegExp("^(?:"+o.join("|")+")$"),f,c=function(A,P){h.call(this,A,P),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var N=new a(this._input),B=new e(this._input).read_options(this._options);this.__patterns={template:B,identifier:B.starting_with(s.identifier).matching(s.identifierMatch),number:N.matching(E),punct:N.matching(u),comment:N.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:N.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:N.matching(/<!--/),html_comment_end:N.matching(/-->/),include:N.starting_with(/#include/).until_after(s.lineBreak),shebang:N.starting_with(/#!/).until_after(s.lineBreak),xml:N.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:B.until(/['\\\n\r\u2028\u2029]/),double_quote:B.until(/["\\\n\r\u2028\u2029]/),template_text:B.until(/[`\\$]/),template_expression:B.until(/[`}\\]/)}};c.prototype=new h,c.prototype._is_comment=function(A){return A.type===n.COMMENT||A.type===n.BLOCK_COMMENT||A.type===n.UNKNOWN},c.prototype._is_opening=function(A){return A.type===n.START_BLOCK||A.type===n.START_EXPR},c.prototype._is_closing=function(A,P){return(A.type===n.END_BLOCK||A.type===n.END_EXPR)&&P&&(A.text==="]"&&P.text==="["||A.text===")"&&P.text==="("||A.text==="}"&&P.text==="{")},c.prototype._reset=function(){f=!1},c.prototype._get_next_token=function(A,P){var N=null;this._readWhitespace();var B=this._input.peek();return B===null?this._create_token(n.EOF,""):(N=N||this._read_non_javascript(B),N=N||this._read_string(B),N=N||this._read_word(A),N=N||this._read_singles(B),N=N||this._read_comment(B),N=N||this._read_regexp(B,A),N=N||this._read_xml(B,A),N=N||this._read_punctuation(),N=N||this._create_token(n.UNKNOWN,this._input.next()),N)},c.prototype._read_word=function(A){var P;if(P=this.__patterns.identifier.read(),P!=="")return P=P.replace(s.allLineBreaks,`
|
|
`),!(A.type===n.DOT||A.type===n.RESERVED&&(A.text==="set"||A.text==="get"))&&p.test(P)?(P==="in"||P==="of")&&(A.type===n.WORD||A.type===n.STRING)?this._create_token(n.OPERATOR,P):this._create_token(n.RESERVED,P):this._create_token(n.WORD,P);if(P=this.__patterns.number.read(),P!=="")return this._create_token(n.WORD,P)},c.prototype._read_singles=function(A){var P=null;return A==="("||A==="["?P=this._create_token(n.START_EXPR,A):A===")"||A==="]"?P=this._create_token(n.END_EXPR,A):A==="{"?P=this._create_token(n.START_BLOCK,A):A==="}"?P=this._create_token(n.END_BLOCK,A):A===";"?P=this._create_token(n.SEMICOLON,A):A==="."&&y.test(this._input.peek(1))?P=this._create_token(n.DOT,A):A===","&&(P=this._create_token(n.COMMA,A)),P&&this._input.next(),P},c.prototype._read_punctuation=function(){var A=this.__patterns.punct.read();if(A!=="")return A==="="?this._create_token(n.EQUALS,A):A==="?."?this._create_token(n.DOT,A):this._create_token(n.OPERATOR,A)},c.prototype._read_non_javascript=function(A){var P="";if(A==="#"){if(this._is_first_token()&&(P=this.__patterns.shebang.read(),P))return this._create_token(n.UNKNOWN,P.trim()+`
|
|
`);if(P=this.__patterns.include.read(),P)return this._create_token(n.UNKNOWN,P.trim()+`
|
|
`);A=this._input.next();var N="#";if(this._input.hasNext()&&this._input.testChar(g)){do A=this._input.next(),N+=A;while(this._input.hasNext()&&A!=="#"&&A!=="=");return A==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(N+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(N+="{}",this._input.next(),this._input.next())),this._create_token(n.WORD,N)}this._input.back()}else if(A==="<"&&this._is_first_token()){if(P=this.__patterns.html_comment_start.read(),P){for(;this._input.hasNext()&&!this._input.testChar(s.newline);)P+=this._input.next();return f=!0,this._create_token(n.COMMENT,P)}}else if(f&&A==="-"&&(P=this.__patterns.html_comment_end.read(),P))return f=!1,this._create_token(n.COMMENT,P);return null},c.prototype._read_comment=function(A){var P=null;if(A==="/"){var N="";if(this._input.peek(1)==="*"){N=this.__patterns.block_comment.read();var B=x.get_directives(N);B&&B.ignore==="start"&&(N+=x.readIgnored(this._input)),N=N.replace(s.allLineBreaks,`
|
|
`),P=this._create_token(n.BLOCK_COMMENT,N),P.directives=B}else this._input.peek(1)==="/"&&(N=this.__patterns.comment.read(),P=this._create_token(n.COMMENT,N))}return P},c.prototype._read_string=function(A){if(A==="`"||A==="'"||A==='"'){var P=this._input.next();return this.has_char_escapes=!1,A==="`"?P+=this._read_string_recursive("`",!0,"${"):P+=this._read_string_recursive(A),this.has_char_escapes&&this._options.unescape_strings&&(P=w(P)),this._input.peek()===A&&(P+=this._input.next()),P=P.replace(s.allLineBreaks,`
|
|
`),this._create_token(n.STRING,P)}return null},c.prototype._allow_regexp_or_xml=function(A){return A.type===n.RESERVED&&t(A.text,["return","case","throw","else","do","typeof","yield"])||A.type===n.END_EXPR&&A.text===")"&&A.opened.previous.type===n.RESERVED&&t(A.opened.previous.text,["if","while","for"])||t(A.type,[n.COMMENT,n.START_EXPR,n.START_BLOCK,n.START,n.END_BLOCK,n.OPERATOR,n.EQUALS,n.EOF,n.SEMICOLON,n.COMMA])},c.prototype._read_regexp=function(A,P){if(A==="/"&&this._allow_regexp_or_xml(P)){for(var N=this._input.next(),B=!1,R=!1;this._input.hasNext()&&(B||R||this._input.peek()!==A)&&!this._input.testChar(s.newline);)N+=this._input.peek(),B?B=!1:(B=this._input.peek()==="\\",this._input.peek()==="["?R=!0:this._input.peek()==="]"&&(R=!1)),this._input.next();return this._input.peek()===A&&(N+=this._input.next(),N+=this._input.read(s.identifier)),this._create_token(n.STRING,N)}return null},c.prototype._read_xml=function(A,P){if(this._options.e4x&&A==="<"&&this._allow_regexp_or_xml(P)){var N="",B=this.__patterns.xml.read_match();if(B){for(var R=B[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),F=R.indexOf("{")===0,K=0;B;){var X=!!B[1],ee=B[2],oe=!!B[B.length-1]||ee.slice(0,8)==="![CDATA[";if(!oe&&(ee===R||F&&ee.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(X?--K:++K),N+=B[0],K<=0)break;B=this.__patterns.xml.read_match()}return B||(N+=this._input.match(/[\s\S]*/g)[0]),N=N.replace(s.allLineBreaks,`
|
|
`),this._create_token(n.STRING,N)}}return null};function w(A){for(var P="",N=0,B=new b(A),R=null;B.hasNext();)if(R=B.match(/([\s]|[^\\]|\\\\)+/g),R&&(P+=R[0]),B.peek()==="\\"){if(B.next(),B.peek()==="x")R=B.match(/x([0-9A-Fa-f]{2})/g);else if(B.peek()==="u")R=B.match(/u([0-9A-Fa-f]{4})/g);else{P+="\\",B.hasNext()&&(P+=B.next());continue}if(!R)return A;if(N=parseInt(R[1],16),N>126&&N<=255&&R[0].indexOf("x")===0)return A;if(N>=0&&N<32){P+="\\"+R[0];continue}else N===34||N===39||N===92?P+="\\"+String.fromCharCode(N):P+=String.fromCharCode(N)}return P}c.prototype._read_string_recursive=function(A,P,N){var B,R;A==="'"?R=this.__patterns.single_quote:A==='"'?R=this.__patterns.double_quote:A==="`"?R=this.__patterns.template_text:A==="}"&&(R=this.__patterns.template_expression);for(var F=R.read(),K="";this._input.hasNext();){if(K=this._input.next(),K===A||!P&&s.newline.test(K)){this._input.back();break}else K==="\\"&&this._input.hasNext()?(B=this._input.peek(),B==="x"||B==="u"?this.has_char_escapes=!0:B==="\r"&&this._input.peek(1)===`
|
|
`&&this._input.next(),K+=this._input.next()):N&&(N==="${"&&K==="$"&&this._input.peek()==="{"&&(K+=this._input.next()),N===K&&(A==="`"?K+=this._read_string_recursive("}",P,"`"):K+=this._read_string_recursive("`",P,"${"),this._input.hasNext()&&(K+=this._input.next())));K+=R.read(),F+=K}return F},O.exports.Tokenizer=c,O.exports.TOKEN=n,O.exports.positionable_operators=v.slice(),O.exports.line_starters=i.slice()},function(O){var S=RegExp.prototype.hasOwnProperty("sticky");function _(b){this.__input=b||"",this.__input_length=this.__input.length,this.__position=0}_.prototype.restart=function(){this.__position=0},_.prototype.back=function(){this.__position>0&&(this.__position-=1)},_.prototype.hasNext=function(){return this.__position<this.__input_length},_.prototype.next=function(){var b=null;return this.hasNext()&&(b=this.__input.charAt(this.__position),this.__position+=1),b},_.prototype.peek=function(b){var h=null;return b=b||0,b+=this.__position,b>=0&&b<this.__input_length&&(h=this.__input.charAt(b)),h},_.prototype.__match=function(b,h){b.lastIndex=h;var l=b.exec(this.__input);return l&&!(S&&b.sticky)&&(l.index!==h&&(l=null)),l},_.prototype.test=function(b,h){return h=h||0,h+=this.__position,h>=0&&h<this.__input_length?!!this.__match(b,h):!1},_.prototype.testChar=function(b,h){var l=this.peek(h);return b.lastIndex=0,l!==null&&b.test(l)},_.prototype.match=function(b){var h=this.__match(b,this.__position);return h?this.__position+=h[0].length:h=null,h},_.prototype.read=function(b,h,l){var r="",s;return b&&(s=this.match(b),s&&(r+=s[0])),h&&(s||!b)&&(r+=this.readUntil(h,l)),r},_.prototype.readUntil=function(b,h){var l="",r=this.__position;b.lastIndex=this.__position;var s=b.exec(this.__input);return s?(r=s.index,h&&(r+=s[0].length)):r=this.__input_length,l=this.__input.substring(this.__position,r),this.__position=r,l},_.prototype.readUntilAfter=function(b){return this.readUntil(b,!0)},_.prototype.get_regexp=function(b,h){var l=null,r="g";return h&&S&&(r="y"),typeof b=="string"&&b!==""?l=new RegExp(b,r):b&&(l=new RegExp(b.source,r)),l},_.prototype.get_literal_regexp=function(b){return RegExp(b.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},_.prototype.peekUntilAfter=function(b){var h=this.__position,l=this.readUntilAfter(b);return this.__position=h,l},_.prototype.lookBack=function(b){var h=this.__position-1;return h>=b.length&&this.__input.substring(h-b.length,h).toLowerCase()===b},O.exports.InputScanner=_},function(O,S,_){var b=_(8).InputScanner,h=_(3).Token,l=_(10).TokenStream,r=_(11).WhitespacePattern,s={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},a=function(e,t){this._input=new b(e),this._options=t||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new r(this._input)};a.prototype.tokenize=function(){this._input.restart(),this.__tokens=new l,this._reset();for(var e,t=new h(s.START,""),n=null,x=[],E=new l;t.type!==s.EOF;){for(e=this._get_next_token(t,n);this._is_comment(e);)E.add(e),e=this._get_next_token(t,n);E.isEmpty()||(e.comments_before=E,E=new l),e.parent=n,this._is_opening(e)?(x.push(n),n=e):n&&this._is_closing(e,n)&&(e.opened=n,n.closed=e,n=x.pop(),e.parent=n),e.previous=t,t.next=e,this.__tokens.add(e),t=e}return this.__tokens},a.prototype._is_first_token=function(){return this.__tokens.isEmpty()},a.prototype._reset=function(){},a.prototype._get_next_token=function(e,t){this._readWhitespace();var n=this._input.read(/.+/g);return n?this._create_token(s.RAW,n):this._create_token(s.EOF,"")},a.prototype._is_comment=function(e){return!1},a.prototype._is_opening=function(e){return!1},a.prototype._is_closing=function(e,t){return!1},a.prototype._create_token=function(e,t){var n=new h(e,t,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return n},a.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},O.exports.Tokenizer=a,O.exports.TOKEN=s},function(O){function S(_){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=_}S.prototype.restart=function(){this.__position=0},S.prototype.isEmpty=function(){return this.__tokens_length===0},S.prototype.hasNext=function(){return this.__position<this.__tokens_length},S.prototype.next=function(){var _=null;return this.hasNext()&&(_=this.__tokens[this.__position],this.__position+=1),_},S.prototype.peek=function(_){var b=null;return _=_||0,_+=this.__position,_>=0&&_<this.__tokens_length&&(b=this.__tokens[_]),b},S.prototype.add=function(_){this.__parent_token&&(_.parent=this.__parent_token),this.__tokens.push(_),this.__tokens_length+=1},O.exports.TokenStream=S},function(O,S,_){var b=_(12).Pattern;function h(l,r){b.call(this,l,r),r?this._line_regexp=this._input.get_regexp(r._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}h.prototype=new b,h.prototype.__set_whitespace_patterns=function(l,r){l+="\\t ",r+="\\n\\r",this._match_pattern=this._input.get_regexp("["+l+r+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+r+"]")},h.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var l=this._input.read(this._match_pattern);if(l===" ")this.whitespace_before_token=" ";else if(l){var r=this.__split(this._newline_regexp,l);this.newline_count=r.length-1,this.whitespace_before_token=r[this.newline_count]}return l},h.prototype.matching=function(l,r){var s=this._create();return s.__set_whitespace_patterns(l,r),s._update(),s},h.prototype._create=function(){return new h(this._input,this)},h.prototype.__split=function(l,r){l.lastIndex=0;for(var s=0,a=[],e=l.exec(r);e;)a.push(r.substring(s,e.index)),s=e.index+e[0].length,e=l.exec(r);return s<r.length?a.push(r.substring(s,r.length)):a.push(""),a},O.exports.WhitespacePattern=h},function(O){function S(_,b){this._input=_,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,b&&(this._starting_pattern=this._input.get_regexp(b._starting_pattern,!0),this._match_pattern=this._input.get_regexp(b._match_pattern,!0),this._until_pattern=this._input.get_regexp(b._until_pattern),this._until_after=b._until_after)}S.prototype.read=function(){var _=this._input.read(this._starting_pattern);return(!this._starting_pattern||_)&&(_+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),_},S.prototype.read_match=function(){return this._input.match(this._match_pattern)},S.prototype.until_after=function(_){var b=this._create();return b._until_after=!0,b._until_pattern=this._input.get_regexp(_),b._update(),b},S.prototype.until=function(_){var b=this._create();return b._until_after=!1,b._until_pattern=this._input.get_regexp(_),b._update(),b},S.prototype.starting_with=function(_){var b=this._create();return b._starting_pattern=this._input.get_regexp(_,!0),b._update(),b},S.prototype.matching=function(_){var b=this._create();return b._match_pattern=this._input.get_regexp(_,!0),b._update(),b},S.prototype._create=function(){return new S(this._input,this)},S.prototype._update=function(){},O.exports.Pattern=S},function(O){function S(_,b){_=typeof _=="string"?_:_.source,b=typeof b=="string"?b:b.source,this.__directives_block_pattern=new RegExp(_+/ beautify( \w+[:]\w+)+ /.source+b,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(_+/\sbeautify\signore:end\s/.source+b,"g")}S.prototype.get_directives=function(_){if(!_.match(this.__directives_block_pattern))return null;var b={};this.__directive_pattern.lastIndex=0;for(var h=this.__directive_pattern.exec(_);h;)b[h[1]]=h[2],h=this.__directive_pattern.exec(_);return b},S.prototype.readIgnored=function(_){return _.readUntilAfter(this.__directives_end_ignore_pattern)},O.exports.Directives=S},function(O,S,_){var b=_(12).Pattern,h={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function l(r,s){b.call(this,r,s),this.__template_pattern=null,this._disabled=Object.assign({},h),this._excluded=Object.assign({},h),s&&(this.__template_pattern=this._input.get_regexp(s.__template_pattern),this._excluded=Object.assign(this._excluded,s._excluded),this._disabled=Object.assign(this._disabled,s._disabled));var a=new b(r);this.__patterns={handlebars_comment:a.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:a.starting_with(/{{{/).until_after(/}}}/),handlebars:a.starting_with(/{{/).until_after(/}}/),php:a.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:a.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:a.starting_with(/{%/).until_after(/%}/),django_value:a.starting_with(/{{/).until_after(/}}/),django_comment:a.starting_with(/{#/).until_after(/#}/),smarty:a.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:a.starting_with(/{\*/).until_after(/\*}/),smarty_literal:a.starting_with(/{literal}/).until_after(/{\/literal}/)}}l.prototype=new b,l.prototype._create=function(){return new l(this._input,this)},l.prototype._update=function(){this.__set_templated_pattern()},l.prototype.disable=function(r){var s=this._create();return s._disabled[r]=!0,s._update(),s},l.prototype.read_options=function(r){var s=this._create();for(var a in h)s._disabled[a]=r.templating.indexOf(a)===-1;return s._update(),s},l.prototype.exclude=function(r){var s=this._create();return s._excluded[r]=!0,s._update(),s},l.prototype.read=function(){var r="";this._match_pattern?r=this._input.read(this._starting_pattern):r=this._input.read(this._starting_pattern,this.__template_pattern);for(var s=this._read_template();s;)this._match_pattern?s+=this._input.read(this._match_pattern):s+=this._input.readUntil(this.__template_pattern),r+=s,s=this._read_template();return this._until_after&&(r+=this._input.readUntilAfter(this._until_pattern)),r},l.prototype.__set_templated_pattern=function(){var r=[];this._disabled.php||r.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||r.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||r.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(r.push(this.__patterns.django._starting_pattern.source),r.push(this.__patterns.django_value._starting_pattern.source),r.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||r.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&r.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+r.join("|")+")")},l.prototype._read_template=function(){var r="",s=this._input.peek();if(s==="<"){var a=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&a==="?"&&(r=r||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&a==="%"&&(r=r||this.__patterns.erb.read())}else s==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(r=r||this.__patterns.handlebars_comment.read(),r=r||this.__patterns.handlebars_unescaped.read(),r=r||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(r=r||this.__patterns.django_value.read()),this._excluded.django||(r=r||this.__patterns.django_comment.read(),r=r||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(r=r||this.__patterns.smarty_comment.read(),r=r||this.__patterns.smarty_literal.read(),r=r||this.__patterns.smarty.read()));return r},O.exports.TemplatablePattern=l}],C={};function j(O){var S=C[O];if(S!==void 0)return S.exports;var _=C[O]={exports:{}};return L[O](_,_.exports,j),_.exports}var U=j(0);I=U})();var H=I;!(re=[],W=function(){return{js_beautify:H}}.apply(Ee,re),W!==void 0&&(Ge.exports=W))})()},"6eGT":function(Ge,Ee,z){"use strict";function re(W){return null}Ee.a=re},"815F":function(Ge,Ee,z){"use strict";z.d(Ee,"e",function(){return j}),z.d(Ee,"c",function(){return O}),z.d(Ee,"d",function(){return S}),z.d(Ee,"a",function(){return b}),z.d(Ee,"f",function(){return h}),z.d(Ee,"b",function(){return l});var re=z("KQm4"),W=z("VTBJ"),I=z("Ff2n"),H=z("Zm9Q"),L=z("Kwbf"),C=z("OZM5");function j(r,s){return r!=null?r:s}function U(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],s=new Map;function a(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";(e||[]).forEach(function(n){var x=n.key,E=n.children;Object(L.a)(x!=null,"Tree node must have a certain key: [".concat(t).concat(x,"]"));var g=String(x);Object(L.a)(!s.has(g)||x===null||x===void 0,"Same 'key' exist in the Tree: ".concat(g)),s.set(g,!0),a(E,"".concat(t).concat(g," > "))})}a(r)}function O(r){function s(a){var e=Object(H.a)(a);return e.map(function(t){if(!Object(C.i)(t))return Object(L.a)(!t,"Tree/TreeNode can only accept TreeNode as children."),null;var n=t.key,x=t.props,E=x.children,g=Object(I.a)(x,["children"]),y=Object(W.a)({key:n},g),v=s(E);return v.length&&(y.children=v),y}).filter(function(t){return t})}return s(r)}function S(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],a=new Set(s===!0?[]:s),e=[];function t(n){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return n.map(function(E,g){var y=Object(C.h)(x?x.pos:"0",g),v=j(E.key,y),d=Object(W.a)(Object(W.a)({},E),{},{parent:x,pos:y,children:null,data:E,isStart:[].concat(Object(re.a)(x?x.isStart:[]),[g===0]),isEnd:[].concat(Object(re.a)(x?x.isEnd:[]),[g===n.length-1])});return e.push(d),s===!0||a.has(v)?d.children=t(E.children||[],d):d.children=[],d})}return t(r),e}function _(r,s,a){var e;a?typeof a=="string"?e=function(x){return x[a]}:typeof a=="function"&&(e=function(x){return a(x)}):e=function(x,E){return j(x.key,E)};function t(n,x,E){var g=n?n.children:r,y=n?Object(C.h)(E.pos,x):"0";if(n){var v=e(n,y),d={node:n,index:x,pos:y,key:v,parentPos:E.node?E.pos:null,level:E.level+1};s(d)}g&&g.forEach(function(u,i){t(u,i,{node:n,pos:y,level:E?E.level+1:-1})})}t(null)}function b(r){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=s.initWrapper,e=s.processEntity,t=s.onProcessFinished,n=arguments.length>2?arguments[2]:void 0,x={},E={},g={posEntities:x,keyEntities:E};return a&&(g=a(g)||g),_(r,function(y){var v=y.node,d=y.index,u=y.pos,i=y.key,o=y.parentPos,p=y.level,f={node:v,index:d,key:i,pos:u,level:p},c=j(i,u);x[u]=f,E[c]=f,f.parent=x[o],f.parent&&(f.parent.children=f.parent.children||[],f.parent.children.push(f)),e&&e(f,g)},n),t&&t(g),g}function h(r,s){var a=s.expandedKeys,e=s.selectedKeys,t=s.loadedKeys,n=s.loadingKeys,x=s.checkedKeys,E=s.halfCheckedKeys,g=s.dragOverNodeKey,y=s.dropPosition,v=s.keyEntities,d=v[r],u={eventKey:r,expanded:a.indexOf(r)!==-1,selected:e.indexOf(r)!==-1,loaded:t.indexOf(r)!==-1,loading:n.indexOf(r)!==-1,checked:x.indexOf(r)!==-1,halfChecked:E.indexOf(r)!==-1,pos:String(d?d.pos:""),dragOver:g===r&&y===0,dragOverGapTop:g===r&&y===-1,dragOverGapBottom:g===r&&y===1};return u}function l(r){var s=r.data,a=r.expanded,e=r.selected,t=r.checked,n=r.loaded,x=r.loading,E=r.halfChecked,g=r.dragOver,y=r.dragOverGapTop,v=r.dragOverGapBottom,d=r.pos,u=r.active,i=Object(W.a)(Object(W.a)({},s),{},{expanded:a,selected:e,checked:t,loaded:n,loading:x,halfChecked:E,dragOver:g,dragOverGapTop:y,dragOverGapBottom:v,pos:d,active:u});return"props"in i||Object.defineProperty(i,"props",{get:function(){return Object(L.a)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),r}}),i}},"8hTe":function(Ge,Ee,z){Ge.exports={button:"button___1wy9m"}},"9Bee":function(Ge,Ee,z){"use strict";var re=z("DYRE"),W=z("zeV3"),I=z("+L6B"),H=z("2/Rp"),L=z("k1fw"),C=z("9og8"),j=z("tJVT"),U=z("WmNS"),O=z.n(U),S=z("cDcd"),_=z.n(S),b=z("vg9a"),h=z("DlQD"),l=z.n(h),r=z("rUJ1");function s(M,m){var T=M.match(/^(\s+)(?:```)/);if(T===null)return m;var D=T[1];return m.split(`
|
|
`).map(function(G){var k=G.match(/^\s+/);if(k===null)return G;var ie=Object(j.a)(k,1),xe=ie[0];return xe.length>=D.length?G.slice(D.length):G}).join(`
|
|
`)}var a=[],e=["<ul>"],t=new l.a.Renderer,n=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function x(){a.length=0,e=["<ul>"]}var E={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function g(M,m,T,D){if(m>=M.length||M[m].level<=T)return m;var G=M[m];D.push("<li><a href='#"+G.anchor+"'>"+G.text+"</a>"),m++;var k=[];return m=g(M,m,G.level,k),k.length>0&&(D.push("<ul>"),k.forEach(function(ie){D.push(ie)}),D.push("</ul>")),D.push("</li>"),m=g(M,m,T,D),m}function y(){return g(a,0,0,e),e.push("</ul>"),e.join("")}var v={heading:function(m){var T=n.exec(m);if(T)return{type:"heading",raw:T[0],depth:T[1].length,text:T[2]}},fences:function(m){var T=this.rules.block.fences.exec(m);if(T){var D=T[0],G=s(D,T[3]||""),k=T[2]?T[2].trim():T[2];if(["latex","katex","math"].indexOf(k)>=0){var ie=i(),xe=G;G=ie,o[ie]={type:"block",expression:xe}}return{type:"code",raw:D,lang:k,text:G}}}},d=/(?:\${2})([^\n`]+?)(?:\${2})/gi,u=0,i=function(){return"__special_katext_id_".concat(u++,"__")},o={};function p(){return o}function f(){u=0,o={}}function c(M){return M=M.replace(d,function(m,T){var D=i();return o[D]={type:"inline",expression:T},D}),M}var w=t.listitem;t.listitem=function(M){return w(c(M))};var A=t.paragraph;t.paragraph=function(M){return A(c(M))};var P=t.tablecell;t.tablecell=function(M,m){return P(c(M),m)},t.code=function(M,m,T){var D=(m||"").match(/\S*/)[0];return D?["latex","katex","math"].indexOf(D)>=0?"<p class='editormd-tex'>".concat(M,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(m,'">').concat(T?M:Object(r.escape)(M,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(T?M:Object(r.escape)(M,!0))+"</code></pre>"},t.heading=function(M,m,T){var D=this.options.headerPrefix+T.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return a.push({anchor:D,level:m,text:M}),"<h"+m+' id="'+D+'">'+M+"</h"+m+">"},l.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),l.a.use({tokenizer:v,renderer:t});var N=l.a,B=z("SJMd"),R=z("ulZh"),F=z.n(R),K=z("m3rI"),X=z("Oy/b"),ee=z("p5ED"),oe=z("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 ce=function(M,m){return(ce=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(T,D){T.__proto__=D}||function(T,D){for(var G in D)Object.prototype.hasOwnProperty.call(D,G)&&(T[G]=D[G])})(M,m)};function le(M,m){function T(){this.constructor=M}ce(M,m),M.prototype=m===null?Object.create(m):(T.prototype=m.prototype,new T)}function be(M,m,T,D){return new(T||(T=Promise))(function(G,k){function ie(Ye){try{ke(D.next(Ye))}catch(Re){k(Re)}}function xe(Ye){try{ke(D.throw(Ye))}catch(Re){k(Re)}}function ke(Ye){var Re;Ye.done?G(Ye.value):(Re=Ye.value,Re instanceof T?Re:new T(function(Je){Je(Re)})).then(ie,xe)}ke((D=D.apply(M,m||[])).next())})}function pe(M,m){var T,D,G,k,ie={label:0,sent:function(){if(1&G[0])throw G[1];return G[1]},trys:[],ops:[]};return k={next:xe(0),throw:xe(1),return:xe(2)},typeof Symbol=="function"&&(k[Symbol.iterator]=function(){return this}),k;function xe(ke){return function(Ye){return function(Re){if(T)throw new TypeError("Generator is already executing.");for(;ie;)try{if(T=1,D&&(G=2&Re[0]?D.return:Re[0]?D.throw||((G=D.return)&&G.call(D),0):D.next)&&!(G=G.call(D,Re[1])).done)return G;switch(D=0,G&&(Re=[2&Re[0],G.value]),Re[0]){case 0:case 1:G=Re;break;case 4:return ie.label++,{value:Re[1],done:!1};case 5:ie.label++,D=Re[1],Re=[0];continue;case 7:Re=ie.ops.pop(),ie.trys.pop();continue;default:if(!(G=ie.trys,(G=G.length>0&&G[G.length-1])||Re[0]!==6&&Re[0]!==2)){ie=0;continue}if(Re[0]===3&&(!G||Re[1]>G[0]&&Re[1]<G[3])){ie.label=Re[1];break}if(Re[0]===6&&ie.label<G[1]){ie.label=G[1],G=Re;break}if(G&&ie.label<G[2]){ie.label=G[2],ie.ops.push(Re);break}G[2]&&ie.ops.pop(),ie.trys.pop();continue}Re=m.call(M,ie)}catch(Je){Re=[6,Je],D=0}finally{T=G=0}if(5&Re[0])throw Re[1];return{value:Re[0]?Re[1]:void 0,done:!0}}([ke,Ye])}}}function de(){for(var M=0,m=0,T=arguments.length;m<T;m++)M+=arguments[m].length;var D=Array(M),G=0;for(m=0;m<T;m++)for(var k=arguments[m],ie=0,xe=k.length;ie<xe;ie++,G++)D[G]=k[ie];return D}var te=function(){function M(){}return M.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},M.setAttributes=function(m,T){for(var D=0,G=T;D<G.length;D++){var k=G[D],ie=k[0],xe=k[1];m.setAttribute(ie,xe)}},M.createRect=function(m,T,D){var G=document.createElementNS("http://www.w3.org/2000/svg","rect");return G.setAttribute("width",m.toString()),G.setAttribute("height",T.toString()),D&&M.setAttributes(G,D),G},M.createLine=function(m,T,D,G,k){var ie=document.createElementNS("http://www.w3.org/2000/svg","line");return ie.setAttribute("x1",m.toString()),ie.setAttribute("y1",T.toString()),ie.setAttribute("x2",D.toString()),ie.setAttribute("y2",G.toString()),k&&M.setAttributes(ie,k),ie},M.createPolygon=function(m,T){var D=document.createElementNS("http://www.w3.org/2000/svg","polygon");return D.setAttribute("points",m),T&&M.setAttributes(D,T),D},M.createCircle=function(m,T){var D=document.createElementNS("http://www.w3.org/2000/svg","circle");return D.setAttribute("cx",(m/2).toString()),D.setAttribute("cy",(m/2).toString()),D.setAttribute("r",m.toString()),T&&M.setAttributes(D,T),D},M.createEllipse=function(m,T,D){var G=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return G.setAttribute("cx",(m/2).toString()),G.setAttribute("cy",(T/2).toString()),G.setAttribute("rx",(m/2).toString()),G.setAttribute("ry",(T/2).toString()),D&&M.setAttributes(G,D),G},M.createGroup=function(m){var T=document.createElementNS("http://www.w3.org/2000/svg","g");return m&&M.setAttributes(T,m),T},M.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},M.createMarker=function(m,T,D,G,k,ie,xe){var ke=document.createElementNS("http://www.w3.org/2000/svg","marker");return M.setAttributes(ke,[["id",m],["orient",T],["markerWidth",D.toString()],["markerHeight",G.toString()],["refX",k.toString()],["refY",ie.toString()]]),ke.appendChild(xe),ke},M.createText=function(m){var T=document.createElementNS("http://www.w3.org/2000/svg","text");return T.setAttribute("x","0"),T.setAttribute("y","0"),m&&M.setAttributes(T,m),T},M.createTSpan=function(m,T){var D=document.createElementNS("http://www.w3.org/2000/svg","tspan");return D.textContent=m,T&&M.setAttributes(D,T),D},M.createImage=function(m){var T=document.createElementNS("http://www.w3.org/2000/svg","image");return m&&M.setAttributes(T,m),T},M.createPoint=function(m,T){var D=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return D.x=m,D.y=T,D},M.createPath=function(m,T){var D=document.createElementNS("http://www.w3.org/2000/svg","path");return D.setAttribute("d",m),T&&M.setAttributes(D,T),D},M}(),Le=function(){function M(){}return M.addKey=function(m){M.key=m},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}(),Ve=function(){function M(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return M.prototype.rasterize=function(m,T,D){var G=this;return new Promise(function(k){var ie=D!==void 0?D:document.createElement("canvas");m===null&&(G.markersOnly=!0,G.naturalSize=!1);var xe=document.createElementNS("http://www.w3.org/2000/svg","svg");xe.setAttribute("xmlns","http://www.w3.org/2000/svg"),xe.setAttribute("width",T.width.baseVal.valueAsString),xe.setAttribute("height",T.height.baseVal.valueAsString),xe.setAttribute("viewBox","0 0 "+T.viewBox.baseVal.width.toString()+" "+T.viewBox.baseVal.height.toString()),xe.innerHTML=T.innerHTML,G.naturalSize===!0?(xe.width.baseVal.value=m.naturalWidth,xe.height.baseVal.value=m.naturalHeight):G.width!==void 0&&G.height!==void 0&&(xe.width.baseVal.value=G.width,xe.height.baseVal.value=G.height),ie.width=xe.width.baseVal.value,ie.height=xe.height.baseVal.value;var ke=xe.outerHTML,Ye=ie.getContext("2d");G.markersOnly!==!0&&Ye.drawImage(m,0,0,ie.width,ie.height);var Re=window.URL,Je=new Image(ie.width,ie.height);Je.setAttribute("crossOrigin","anonymous");var Ze=new Blob([ke],{type:"image/svg+xml"}),ft=Re.createObjectURL(Ze);Je.onload=function(){Ye.drawImage(Je,0,0),Re.revokeObjectURL(ft);var St=ie.toDataURL(G.imageType,G.imageQuality);k(St)},Je.src=ft})},M}(),Ne=function(){},Be=function(){function M(m){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+m+"_"}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(m){return this.styleSheet===void 0&&this.addStyleSheet(),m.name=""+this.classNamePrefix+m.localName,this.classes.push(m),this.styleSheet.sheet.insertRule("."+m.name+" {"+m.style+"}",this.styleSheet.sheet.cssRules.length),m},M.prototype.addRule=function(m){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(m),this.styleSheet.sheet.insertRule(m.selector+" {"+m.style+"}",this.styleSheet.sheet.cssRules.length)},M.prototype.addStyleSheet=function(){var m;this.styleSheet=document.createElement("style"),((m=this.styleSheetRoot)!==null&&m!==void 0?m:document.head).appendChild(this.styleSheet),this.addRule(new ve("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new ve("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new ve("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new ye("fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new ye("fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},M.prototype.removeStyleSheet=function(){var m;this.styleSheet&&(((m=this.styleSheetRoot)!==null&&m!==void 0?m:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},M}(),ve=function(M,m){this.selector=M,this.style=m},ye=function(M,m){this.localName=M,this.style=m},Ie=function(){function M(m,T,D,G,k){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=m,this.displayMode=T,this.markerItems=D,this.uiStyleSettings=G,this.styles=k,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(m){var T=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=m,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var D=document.createElement("div");D.className=this.toolbarBlockStyleClass.name,D.style.whiteSpace="nowrap",this.uiContainer.appendChild(D),this.addActionButton(D,'<svg viewBox="0 0 24 24"><path d="M10.07 14.27a.997.997 0 011.33.48l2.3 4.99 1.8-.85-2.31-4.98c-.24-.5-.02-1.1.48-1.33l.28-.08 2.3-.45L8 5.12V15.9l1.82-1.47.25-.16m3.57 7.7a.99.99 0 01-1.33-.47l-2.18-4.74-2.51 2.02c-.17.14-.38.22-.62.22a1 1 0 01-1-1V3a1 1 0 011-1c.24 0 .47.09.64.23l.01-.01 11.49 9.64a1.001 1.001 0 01-.44 1.75l-3.16.62 2.2 4.73c.26.5.02 1.09-.48 1.32l-3.62 1.69z"/></svg>',"select"),this.addActionButton(D,'<svg viewBox="0 0 24 24"><path d="M9 3v1H4v2h1v13a2 2 0 002 2h10a2 2 0 002-2V6h1V4h-5V3H9M7 6h10v13H7V6m2 2v9h2V8H9m4 0v9h2V8h-2z"/></svg>',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(D,'<svg viewBox="0 0 24 24"><path d="M19.36 2.72l1.42 1.42-5.72 5.71c1.07 1.54 1.22 3.39.32 4.59L9.06 8.12c1.2-.9 3.05-.75 4.59.32l5.71-5.72M5.93 17.57c-2.01-2.01-3.24-4.41-3.58-6.65l4.88-2.09 7.44 7.44-2.09 4.88c-2.24-.34-4.64-1.57-6.65-3.58z"/></svg>',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(D,'<svg viewBox="0 0 24 24"><path d="M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"/></svg>',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(D,'<svg viewBox="0 0 24 24"><path d="M18.4 10.6C16.55 9 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 017.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"/></svg>',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(D,'<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(D,'<svg viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 009.5 3 6.5 6.5 0 003 9.5 6.5 6.5 0 009.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 5 1.5-1.5-5-5m-6 0C7 14 5 12 5 9.5S7 5 9.5 5 14 7 14 9.5 12 14 9.5 14M7 9h5v1H7V9z"/></svg>',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(D,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(k){var ie=document.createElement("div");ie.className=""+T.toolbarButtonStyleClass.name,ie.setAttribute("data-type-name",k.typeName),ie.innerHTML=k.icon,ie.addEventListener("click",function(){T.markerToolbarButtonClicked(ie,k)}),T.buttons.push(ie),T.markerButtons.push(ie)}),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 G=document.createElement("div");G.className=this.toolbarBlockStyleClass.name,G.style.whiteSpace="nowrap",G.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(G),this.addActionButton(G,'<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(G,'<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(m){this.buttonClickListeners.push(m)},M.prototype.removeButtonClickListener=function(m){this.buttonClickListeners.indexOf(m)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(m),1)},M.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},M.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var m=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var T=0;T<this.markerButtons.length;T++)T<m||T===m&&this.markerButtons.length-1===m?this.markerButtonBlock.appendChild(this.markerButtons[T]):(T===m&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[T]))}},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 m=this;this.buttons.forEach(function(T){T.className=T.className.replace(m.uiStyleSettings.toolbarButtonStyleColorsClassName?m.uiStyleSettings.toolbarButtonStyleColorsClassName:m.toolbarButtonStyleColorsClass.name,"").trim(),T.className=T.className.replace(m.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?m.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:m.toolbarActiveButtonStyleColorsClass.name,"").trim(),T.className+=" "+(m.uiStyleSettings.toolbarButtonStyleColorsClassName?m.uiStyleSettings.toolbarButtonStyleColorsClassName:m.toolbarButtonStyleColorsClass.name)})},M.prototype.addActionButton=function(m,T,D){var G=this,k=document.createElement("div");switch(k.className=""+this.toolbarButtonStyleClass.name,k.innerHTML=T,k.setAttribute("data-action",D),k.addEventListener("click",function(){G.actionToolbarButtonClicked(k,D)}),D){case"select":k.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":k.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":k.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":k.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":k.style.fill=this.uiStyleSettings.closeButtonColor}m.appendChild(k),this.buttons.push(k)},M.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new ye("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 ye("toolbar_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new ye("toolbar-block",`
|
|
display: inline-block;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new ye("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 ye("toolbar-overflow-block_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`));var m=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new ye("toolbar_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.toolbarButtonStyleColorsClass=this.styles.addClass(new ye("toolbar_button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new ye("toolbar_active_button",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new ve("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new ve("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`))},M.prototype.markerToolbarButtonClicked=function(m,T){this.setActiveButton(m),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(D){return D("marker",T)}),this.markerButtonOverflowBlock.style.display="none"},M.prototype.actionToolbarButtonClicked=function(m,T){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(D){return D("action",T)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},M.prototype.setActiveButton=function(m){this.resetButtonStyles(),m.className=m.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),m.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},M.prototype.setActiveMarkerButton=function(m){var T=this.markerButtons.find(function(D){return D.getAttribute("data-type-name")===m});T&&this.setActiveButton(T)},M.prototype.setCurrentMarker=function(m){var T=this;this.currentMarker=m,this.buttons.filter(function(D){return/delete|notes/.test(D.getAttribute("data-action"))}).forEach(function(D){T.currentMarker===void 0?(D.style.fillOpacity="0.4",D.style.pointerEvents="none"):(D.style.fillOpacity="1",D.style.pointerEvents="all")})},M}(),Ae=function(){function M(m,T,D,G){this.panels=[],this.panelButtons=[],this.markerjsContainer=m,this.displayMode=T,this.uiStyleSettings=D,this.styles=G,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return M.prototype.addStyles=function(){var m;this.toolboxStyleClass=this.styles.addClass(new ye("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 ye("toolbox_colors",`
|
|
color: `+this.uiStyleSettings.toolboxColor+`;
|
|
`));var T=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new ye("toolbox-button-row",`
|
|
display: flex;
|
|
cursor: default;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new ye("toolbox-button-row_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new ye("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 ye("toolbox-panel-row_colors",`
|
|
background-color: `+((m=this.uiStyleSettings.toolboxBackgroundColor)!==null&&m!==void 0?m:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new ye("toolbox_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*T)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*T)+`px;
|
|
padding: `+T+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new ye("toolbox-button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new ye("toolbox-active-button_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.styles.addRule(new ve("."+this.toolboxButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new ve("."+this.toolboxButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`))},M.prototype.show=function(m){var T;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=m,this.uiContainer.className=this.toolboxStyleClass.name+" "+((T=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&T!==void 0?T:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},M.prototype.setPanelButtons=function(m){var T,D,G=this;this.panels=m,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((T=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&T!==void 0?T:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((D=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&D!==void 0?D:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(k){var ie;k.uiStyleSettings=G.uiStyleSettings;var xe=document.createElement("div");xe.className=G.toolboxButtonStyleClass.name+" "+((ie=G.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ie!==void 0?ie:G.toolboxButtonStyleColorsClass.name),xe.innerHTML=k.icon,xe.title=k.title,xe.addEventListener("click",function(){G.panelButtonClick(k)}),G.panelButtons.push(xe),G.buttonRow.appendChild(xe)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},M.prototype.panelButtonClick=function(m){var T=this,D=-1;if(m!==this.activePanel){D=this.panels.indexOf(m),this.panelRow.innerHTML="";var G=m.getUi();G.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(G),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=m}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){T.displayMode==="inline"?T.panelRow.style.display="none":T.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(k,ie){var xe,ke;k.className=T.toolboxButtonStyleClass.name+" "+(ie===D?""+((xe=T.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&xe!==void 0?xe:T.toolboxActiveButtonStyleColorsClass.name):""+((ke=T.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ke!==void 0?ke:T.toolboxButtonStyleColorsClass.name))})},M}(),ge=function(M,m){this.title=M,this.icon=m},Ce=function(M){function m(T,D,G,k){var ie=M.call(this,T,k||'<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 ie.colors=[],ie.addTransparent=!1,ie.colorBoxes=[],ie.colors=D,ie.currentColor=G,ie.setCurrentColor=ie.setCurrentColor.bind(ie),ie.getColorBox=ie.getColorBox.bind(ie),ie}return le(m,M),m.prototype.getUi=function(){var T=this,D=document.createElement("div");return D.style.overflow="hidden",D.style.whiteSpace="nowrap",this.colors.forEach(function(G){var k=T.getColorBox(G);D.appendChild(k),T.colorBoxes.push(k)}),D},m.prototype.getColorBox=function(T){var D=this,G=this.uiStyleSettings.toolbarHeight/4,k=this.uiStyleSettings.toolbarHeight-G,ie=document.createElement("div");ie.style.display="inline-block",ie.style.boxSizing="content-box",ie.style.width=k-2+"px",ie.style.height=k-2+"px",ie.style.padding="1px",ie.style.marginRight="2px",ie.style.marginBottom="2px",ie.style.borderWidth="2px",ie.style.borderStyle="solid",ie.style.borderRadius=(k+2)/2+"px",ie.style.borderColor=T===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ie.addEventListener("click",function(){D.setCurrentColor(T,ie)});var xe=document.createElement("div");return xe.style.display="inline-block",xe.style.width=k-2+"px",xe.style.height=k-2+"px",xe.style.backgroundColor=T,xe.style.borderRadius=k/2+"px",T==="transparent"&&(xe.style.fill=this.uiStyleSettings.toolboxAccentColor,xe.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>`),ie.appendChild(xe),ie},m.prototype.setCurrentColor=function(T,D){var G=this;this.currentColor=T,this.colorBoxes.forEach(function(k){k.style.borderColor=k===D?G.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(T)},m}(ge),Oe=function(){function M(m,T,D){this._state="new",this._isSelected=!1,this._container=m,this._overlayContainer=T,this.globalSettings=D,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(m){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(m,T){},M.prototype.dblClick=function(m,T){},M.prototype.manipulate=function(m){},M.prototype.pointerUp=function(m){this.stateChanged()},M.prototype.dispose=function(){},M.prototype.addMarkerVisualToContainer=function(m){this.container.childNodes.length>0?this.container.insertBefore(m,this.container.childNodes[0]):this.container.appendChild(m)},M.prototype.getState=function(){return{typeName:M.typeName,state:this.state,notes:this.notes}},M.prototype.restoreState=function(m){this._state=m.state,this.notes=m.notes},M.prototype.scale=function(m,T){},M.prototype.colorChanged=function(m){this.onColorChanged&&this.onColorChanged(m),this.stateChanged()},M.prototype.fillColorChanged=function(m){this.onFillColorChanged&&this.onFillColorChanged(m),this.stateChanged()},M.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var m=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),m.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(m)&&this.onStateChanged(this)}},M.typeName="MarkerBase",M}(),Se=function(){function M(){this.findGripByVisual=this.findGripByVisual.bind(this)}return M.prototype.findGripByVisual=function(m){return this.topLeft.ownsTarget(m)?this.topLeft:this.topCenter.ownsTarget(m)?this.topCenter:this.topRight.ownsTarget(m)?this.topRight:this.centerLeft.ownsTarget(m)?this.centerLeft:this.centerRight.ownsTarget(m)?this.centerRight:this.bottomLeft.ownsTarget(m)?this.bottomLeft:this.bottomCenter.ownsTarget(m)?this.bottomCenter:this.bottomRight.ownsTarget(m)?this.bottomRight:void 0},M}(),De=function(){function M(){this.GRIP_SIZE=10,this.visual=te.createGroup(),this.visual.appendChild(te.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(te.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return M.prototype.ownsTarget=function(m){return m===this.visual||m===this.visual.childNodes[0]||m===this.visual.childNodes[1]},M}(),je=function(){function M(){}return M.toITransformMatrix=function(m){return{a:m.a,b:m.b,c:m.c,d:m.d,e:m.e,f:m.f}},M.toSVGMatrix=function(m,T){return m.a=T.a,m.b=T.b,m.c=T.c,m.d=T.d,m.e=T.e,m.f=T.f,m},M}(),Me=function(M){function m(T,D,G){var k=M.call(this,T,D,G)||this;return k.left=0,k.top=0,k.width=0,k.height=0,k.defaultSize={x:50,y:20},k.offsetX=0,k.offsetY=0,k.rotationAngle=0,k.CB_DISTANCE=10,k._suppressMarkerCreateEvent=!1,k.container.transform.baseVal.appendItem(te.createTransform()),k.setupControlBox(),k}return le(m,M),Object.defineProperty(m.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"visual",{get:function(){return this._visual},set:function(T){this._visual=T;var D=te.createTransform();this._visual.transform.baseVal.appendItem(D)},enumerable:!1,configurable:!0}),m.prototype.ownsTarget=function(T){return!!M.prototype.ownsTarget.call(this,T)||!!(this.controlGrips.findGripByVisual(T)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(T))},m.prototype.pointerDown=function(T,D){M.prototype.pointerDown.call(this,T,D),this.state==="new"&&(this.left=T.x,this.top=T.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var G=this.unrotatePoint(T);if(this.manipulationStartX=G.x,this.manipulationStartY=G.y,this.offsetX=G.x-this.left,this.offsetY=G.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(D),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(D)){this.activeGrip=this.rotatorGrip;var k=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=k.x-this.width/2,this.top=k.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var ie=this.container.transform.baseVal.getItem(0);ie.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(ie,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},m.prototype.pointerUp=function(T){var D=this.state;M.prototype.pointerUp.call(this,T),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(T),this._state="select",D==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},m.prototype.moveVisual=function(T){this.visual.style.transform="translate("+T.x+"px, "+T.y+"px)"},m.prototype.manipulate=function(T){var D=this.unrotatePoint(T);this.state==="creating"?this.resize(T):this.state==="move"?(this.left=this.manipulationStartLeft+(D.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(D.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(D):this.state==="rotate"&&this.rotate(T)},m.prototype.resize=function(T){var D=this.manipulationStartLeft,G=this.manipulationStartWidth,k=this.manipulationStartTop,ie=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:D=this.manipulationStartLeft+T.x-this.manipulationStartX,G=this.manipulationStartWidth+this.manipulationStartLeft-D;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:G=this.manipulationStartWidth+T.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:k=this.manipulationStartTop+T.y-this.manipulationStartY,ie=this.manipulationStartHeight+this.manipulationStartTop-k;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:ie=this.manipulationStartHeight+T.y-this.manipulationStartY}G>=0?(this.left=D,this.width=G):(this.left=D+G,this.width=-G),ie>=0?(this.top=k,this.height=ie):(this.top=k+ie,this.height=-ie),this.setSize()},m.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},m.prototype.rotate=function(T){if(Math.abs(T.x-this.centerX)>.1){var D=Math.sign(T.x-this.centerX);this.rotationAngle=180*Math.atan((T.y-this.centerY)/(T.x-this.centerX))/Math.PI+90*D,this.applyRotation()}},m.prototype.applyRotation=function(){var T=this.container.transform.baseVal.getItem(0);T.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(T,0)},m.prototype.rotatePoint=function(T){if(this.rotationAngle===0)return T;var D=this.container.getCTM(),G=te.createPoint(T.x,T.y);return{x:(G=G.matrixTransform(D)).x,y:G.y}},m.prototype.unrotatePoint=function(T){if(this.rotationAngle===0)return T;var D=this.container.getCTM();D=D.inverse();var G=te.createPoint(T.x,T.y);return{x:(G=G.matrixTransform(D)).x,y:G.y}},m.prototype.select=function(){M.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},m.prototype.deselect=function(){M.prototype.deselect.call(this),this.controlBox.style.display="none"},m.prototype.setupControlBox=function(){this.controlBox=te.createGroup();var T=te.createTransform();T.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(T),this.container.appendChild(this.controlBox),this.controlRect=te.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=te.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 Se,this.addControlGrips(),this.controlBox.style.display="none"},m.prototype.adjustControlBox=function(){var T=this.controlBox.transform.baseVal.getItem(0);T.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(T,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()},m.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()},m.prototype.createGrip=function(){var T=new De;return T.visual.transform.baseVal.appendItem(te.createTransform()),this.controlBox.appendChild(T.visual),T},m.prototype.positionGrips=function(){var T=this.controlGrips.topLeft.GRIP_SIZE,D=-T/2,G=D,k=(this.width+this.CB_DISTANCE)/2-T/2,ie=(this.height+this.CB_DISTANCE)/2-T/2,xe=this.height+this.CB_DISTANCE-T/2,ke=this.width+this.CB_DISTANCE-T/2;this.positionGrip(this.controlGrips.topLeft.visual,D,G),this.positionGrip(this.controlGrips.topCenter.visual,k,G),this.positionGrip(this.controlGrips.topRight.visual,ke,G),this.positionGrip(this.controlGrips.centerLeft.visual,D,ie),this.positionGrip(this.controlGrips.centerRight.visual,ke,ie),this.positionGrip(this.controlGrips.bottomLeft.visual,D,xe),this.positionGrip(this.controlGrips.bottomCenter.visual,k,xe),this.positionGrip(this.controlGrips.bottomRight.visual,ke,xe),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,k,G-3*this.CB_DISTANCE)},m.prototype.positionGrip=function(T,D,G){var k=T.transform.baseVal.getItem(0);k.setTranslate(D,G),T.transform.baseVal.replaceItem(k,0)},m.prototype.hideControlBox=function(){this.controlBox.style.display="none"},m.prototype.showControlBox=function(){this.controlBox.style.display=""},m.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:je.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:je.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},M.prototype.getState.call(this))},m.prototype.restoreState=function(T){M.prototype.restoreState.call(this,T);var D=T;this.left=D.left,this.top=D.top,this.width=D.width,this.height=D.height,this.rotationAngle=D.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(je.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,D.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(je.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,D.containerTransformMatrix))},m.prototype.scale=function(T,D){M.prototype.scale.call(this,T,D);var G=this.rotatePoint({x:this.left,y:this.top}),k=this.unrotatePoint({x:G.x*T,y:G.y*D});this.left=k.x,this.top=k.y,this.width=this.width*T,this.height=this.height*D,this.adjustControlBox()},m}(Oe),Fe=function(M){function m(T,D,G){var k=M.call(this,T,D,G)||this;return k.fillColor="transparent",k.strokeColor="transparent",k.strokeWidth=0,k.strokeDasharray="",k.opacity=1,k.setStrokeColor=k.setStrokeColor.bind(k),k.setFillColor=k.setFillColor.bind(k),k.setStrokeWidth=k.setStrokeWidth.bind(k),k.setStrokeDasharray=k.setStrokeDasharray.bind(k),k.createVisual=k.createVisual.bind(k),k}return le(m,M),m.prototype.ownsTarget=function(T){return!(!M.prototype.ownsTarget.call(this,T)&&T!==this.visual)},m.prototype.createVisual=function(){this.visual=te.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)},m.prototype.pointerDown=function(T,D){M.prototype.pointerDown.call(this,T,D),this.state==="new"&&(this.createVisual(),this.moveVisual(T),this._state="creating")},m.prototype.manipulate=function(T){M.prototype.manipulate.call(this,T)},m.prototype.resize=function(T){M.prototype.resize.call(this,T),this.setSize()},m.prototype.setSize=function(){M.prototype.setSize.call(this),te.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},m.prototype.pointerUp=function(T){M.prototype.pointerUp.call(this,T),this.setSize()},m.prototype.setStrokeColor=function(T){this.strokeColor=T,this.visual&&te.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(T),this.stateChanged()},m.prototype.setFillColor=function(T){this.fillColor=T,this.visual&&te.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},m.prototype.setStrokeWidth=function(T){this.strokeWidth=T,this.visual&&te.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},m.prototype.setStrokeDasharray=function(T){this.strokeDasharray=T,this.visual&&te.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},m.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))},m.prototype.restoreState=function(T){var D=T;this.fillColor=D.fillColor,this.strokeColor=D.strokeColor,this.strokeWidth=D.strokeWidth,this.strokeDasharray=D.strokeDasharray,this.opacity=D.opacity,this.createVisual(),M.prototype.restoreState.call(this,T),this.setSize()},m.prototype.scale=function(T,D){M.prototype.scale.call(this,T,D),this.setSize()},m.title="Rectangle marker",m}(Me),We=function(M){function m(T,D,G,k){var ie=M.call(this,T,k||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return ie.widths=[],ie.widthBoxes=[],ie.widths=D,ie.currentWidth=G,ie.setCurrentWidth=ie.setCurrentWidth.bind(ie),ie}return le(m,M),m.prototype.getUi=function(){var T=this,D=document.createElement("div");return D.style.display="flex",D.style.overflow="hidden",D.style.flexGrow="2",this.widths.forEach(function(G){var k=document.createElement("div");k.style.display="flex",k.style.flexGrow="2",k.style.alignItems="center",k.style.justifyContent="space-between",k.style.padding="5px",k.style.borderWidth="2px",k.style.borderStyle="solid",k.style.borderColor=G===T.currentWidth?T.uiStyleSettings.toolboxAccentColor:"transparent",k.addEventListener("click",function(){T.setCurrentWidth(G,k)}),D.appendChild(k);var ie=document.createElement("div");ie.innerText=G.toString(),ie.style.marginRight="5px",k.appendChild(ie);var xe=document.createElement("div");xe.style.minHeight="20px",xe.style.flexGrow="2",xe.style.display="flex",xe.style.alignItems="center";var ke=document.createElement("hr");ke.style.minWidth="20px",ke.style.border="0px",ke.style.borderTop=G+"px solid "+T.uiStyleSettings.toolboxColor,ke.style.flexGrow="2",xe.appendChild(ke),k.appendChild(xe),T.widthBoxes.push(k)}),D},m.prototype.setCurrentWidth=function(T,D){var G=this;this.currentWidth=T,this.widthBoxes.forEach(function(k){k.style.borderColor=k===D?G.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},m}(ge),ze=function(M){function m(T,D,G,k){var ie=M.call(this,T,k||'<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 ie.styles=[],ie.styleBoxes=[],ie.styles=D,ie.currentStyle=G,ie.setCurrentStyle=ie.setCurrentStyle.bind(ie),ie}return le(m,M),m.prototype.getUi=function(){var T=this,D=document.createElement("div");return D.style.display="flex",D.style.overflow="hidden",D.style.flexGrow="2",this.styles.forEach(function(G){var k=document.createElement("div");k.style.display="flex",k.style.alignItems="center",k.style.justifyContent="space-between",k.style.padding="5px",k.style.borderWidth="2px",k.style.borderStyle="solid",k.style.overflow="hidden",k.style.maxWidth=100/T.styles.length-5+"%",k.style.borderColor=G===T.currentStyle?T.uiStyleSettings.toolboxAccentColor:"transparent",k.addEventListener("click",function(){T.setCurrentStyle(G,k)}),D.appendChild(k);var ie=document.createElement("div");ie.style.minHeight="20px",ie.style.flexGrow="2",ie.style.overflow="hidden";var xe=`<svg width="100" height="20">
|
|
<line x1="0" y1="10" x2="100" y2="10" stroke="`+T.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(G!==""?'stroke-dasharray="'+G+'"':"")+` />
|
|
</svg>`;ie.innerHTML=xe,k.appendChild(ie),T.styleBoxes.push(k)}),D},m.prototype.setCurrentStyle=function(T,D){var G=this;this.currentStyle=T,this.styleBoxes.forEach(function(k){k.style.borderColor=k===D?G.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},m}(ge),ne=function(M){function m(T,D,G){var k=M.call(this,T,D,G)||this;return k.strokeColor=G.defaultColor,k.strokeWidth=G.defaultStrokeWidth,k.strokeDasharray=G.defaultStrokeDasharray,k.strokePanel=new Ce("Line color",G.defaultColorSet,G.defaultColor),k.strokePanel.onColorChanged=k.setStrokeColor,k.strokeWidthPanel=new We("Line width",G.defaultStrokeWidths,G.defaultStrokeWidth),k.strokeWidthPanel.onWidthChanged=k.setStrokeWidth,k.strokeStylePanel=new ze("Line style",G.defaultStrokeDasharrays,G.defaultStrokeDasharray),k.strokeStylePanel.onStyleChanged=k.setStrokeDasharray,k}return le(m,M),Object.defineProperty(m.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),m.prototype.getState=function(){var T=M.prototype.getState.call(this);return T.typeName=m.typeName,T},m.typeName="FrameMarker",m.title="Frame marker",m.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',m}(Fe),ue=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},me=function(M){function m(T,D,G){var k=M.call(this,T,D,G)||this;return k.x1=0,k.y1=0,k.x2=0,k.y2=0,k.defaultLength=50,k.manipulationStartX=0,k.manipulationStartY=0,k.manipulationStartX1=0,k.manipulationStartY1=0,k.manipulationStartX2=0,k.manipulationStartY2=0,k.setupControlBox(),k}return le(m,M),m.prototype.ownsTarget=function(T){return!!M.prototype.ownsTarget.call(this,T)||!(!this.grip1.ownsTarget(T)&&!this.grip2.ownsTarget(T))},m.prototype.pointerDown=function(T,D){M.prototype.pointerDown.call(this,T,D),this.manipulationStartX=T.x,this.manipulationStartY=T.y,this.state==="new"&&(this.x1=T.x,this.y1=T.y,this.x2=T.x,this.y2=T.y),this.manipulationStartX1=this.x1,this.manipulationStartY1=this.y1,this.manipulationStartX2=this.x2,this.manipulationStartY2=this.y2,this.state!=="new"&&(this.select(),this.grip1.ownsTarget(D)?this.activeGrip=this.grip1:this.grip2.ownsTarget(D)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},m.prototype.pointerUp=function(T){var D=this.state;M.prototype.pointerUp.call(this,T),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(T),this._state="select",D==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},m.prototype.adjustVisual=function(){},m.prototype.manipulate=function(T){this.state==="creating"?this.resize(T):this.state==="move"?(this.x1=this.manipulationStartX1+T.x-this.manipulationStartX,this.y1=this.manipulationStartY1+T.y-this.manipulationStartY,this.x2=this.manipulationStartX2+T.x-this.manipulationStartX,this.y2=this.manipulationStartY2+T.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(T)},m.prototype.resize=function(T){switch(this.activeGrip){case this.grip1:this.x1=T.x,this.y1=T.y;break;case this.grip2:case void 0:this.x2=T.x,this.y2=T.y}this.adjustVisual(),this.adjustControlBox()},m.prototype.select=function(){M.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},m.prototype.deselect=function(){M.prototype.deselect.call(this),this.controlBox.style.display="none"},m.prototype.setupControlBox=function(){this.controlBox=te.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},m.prototype.adjustControlBox=function(){this.positionGrips()},m.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},m.prototype.createGrip=function(){var T=new De;return T.visual.transform.baseVal.appendItem(te.createTransform()),this.controlBox.appendChild(T.visual),T},m.prototype.positionGrips=function(){var T=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-T/2,this.y1-T/2),this.positionGrip(this.grip2.visual,this.x2-T/2,this.y2-T/2)},m.prototype.positionGrip=function(T,D,G){var k=T.transform.baseVal.getItem(0);k.setTranslate(D,G),T.transform.baseVal.replaceItem(k,0)},m.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},M.prototype.getState.call(this))},m.prototype.restoreState=function(T){M.prototype.restoreState.call(this,T);var D=T;this.x1=D.x1,this.y1=D.y1,this.x2=D.x2,this.y2=D.y2},m.prototype.scale=function(T,D){M.prototype.scale.call(this,T,D),this.x1=this.x1*T,this.y1=this.y1*D,this.x2=this.x2*T,this.y2=this.y2*D,this.adjustVisual(),this.adjustControlBox()},m}(Oe),_e=function(M){function m(T,D,G){var k=M.call(this,T,D,G)||this;return k.strokeColor="transparent",k.strokeWidth=0,k.strokeDasharray="",k.setStrokeColor=k.setStrokeColor.bind(k),k.setStrokeWidth=k.setStrokeWidth.bind(k),k.setStrokeDasharray=k.setStrokeDasharray.bind(k),k.strokeColor=G.defaultColor,k.strokeWidth=G.defaultStrokeWidth,k.strokeDasharray=G.defaultStrokeDasharray,k.strokePanel=new Ce("Line color",G.defaultColorSet,G.defaultColor),k.strokePanel.onColorChanged=k.setStrokeColor,k.strokeWidthPanel=new We("Line width",G.defaultStrokeWidths,G.defaultStrokeWidth),k.strokeWidthPanel.onWidthChanged=k.setStrokeWidth,k.strokeStylePanel=new ze("Line style",G.defaultStrokeDasharrays,G.defaultStrokeDasharray),k.strokeStylePanel.onStyleChanged=k.setStrokeDasharray,k}return le(m,M),m.prototype.ownsTarget=function(T){return!(!M.prototype.ownsTarget.call(this,T)&&T!==this.visual&&T!==this.selectorLine&&T!==this.visibleLine)},m.prototype.createVisual=function(){this.visual=te.createGroup(),this.selectorLine=te.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=te.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)},m.prototype.pointerDown=function(T,D){M.prototype.pointerDown.call(this,T,D),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},m.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()),te.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),te.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),te.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},m.prototype.setStrokeColor=function(T){this.strokeColor=T,this.adjustVisual(),this.colorChanged(T)},m.prototype.setStrokeWidth=function(T){this.strokeWidth=T,this.adjustVisual()},m.prototype.setStrokeDasharray=function(T){this.strokeDasharray=T,this.adjustVisual(),this.stateChanged()},Object.defineProperty(m.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),m.prototype.getState=function(){var T=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},M.prototype.getState.call(this));return T.typeName=m.typeName,T},m.prototype.restoreState=function(T){M.prototype.restoreState.call(this,T);var D=T;this.strokeColor=D.strokeColor,this.strokeWidth=D.strokeWidth,this.strokeDasharray=D.strokeDasharray,this.createVisual(),this.adjustVisual()},m.typeName="LineMarker",m.title="Line marker",m.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',m}(me),se=function(M){function m(T,D,G,k){var ie=M.call(this,T,k||'<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 ie.fonts=[],ie.fontBoxes=[],ie.fonts=D,ie.currentFont=G,ie.setCurrentFont=ie.setCurrentFont.bind(ie),ie}return le(m,M),m.prototype.getUi=function(){var T=this,D=document.createElement("div");return D.style.overflow="hidden",D.style.flexGrow="2",this.fonts.forEach(function(G){var k=document.createElement("div");k.style.display="inline-block",k.style.alignItems="center",k.style.justifyContent="space-between",k.style.padding="5px",k.style.borderWidth="2px",k.style.borderStyle="solid",k.style.overflow="hidden",k.style.maxWidth=100/T.fonts.length-5+"%",k.style.borderColor=G===T.currentFont?T.uiStyleSettings.toolboxAccentColor:"transparent",k.addEventListener("click",function(){T.setCurrentFont(G,k)}),D.appendChild(k);var ie=document.createElement("div");ie.style.display="flex",ie.style.minHeight="20px",ie.style.flexGrow="2",ie.style.fontFamily=G,ie.style.overflow="hidden";var xe=document.createElement("div");xe.style.whiteSpace="nowrap",xe.style.overflow="hidden",xe.style.textOverflow="ellipsis",xe.innerHTML="The quick brown fox jumps over the lazy dog",ie.appendChild(xe),k.appendChild(ie),T.fontBoxes.push(k)}),D},m.prototype.setCurrentFont=function(T,D){var G=this;this.currentFont=T,this.fontBoxes.forEach(function(k){k.style.borderColor=k===D?G.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},m}(ge),fe=function(M){function m(T,D,G){var k=M.call(this,T,D,G)||this;return k.color="transparent",k.padding=5,k.DEFAULT_TEXT="your text here",k.text=k.DEFAULT_TEXT,k.isMoved=!1,k.color=G.defaultColor,k.fontFamily=G.defaultFontFamily,k.defaultSize={x:100,y:30},k.setColor=k.setColor.bind(k),k.setFont=k.setFont.bind(k),k.renderText=k.renderText.bind(k),k.sizeText=k.sizeText.bind(k),k.textEditDivClicked=k.textEditDivClicked.bind(k),k.showTextEditor=k.showTextEditor.bind(k),k.setSize=k.setSize.bind(k),k.positionTextEditor=k.positionTextEditor.bind(k),k.colorPanel=new Ce("Color",G.defaultColorSet,G.defaultColor),k.colorPanel.onColorChanged=k.setColor,k.fontFamilyPanel=new se("Font",G.defaultFontFamilies,G.defaultFontFamily),k.fontFamilyPanel.onFontChanged=k.setFont,k}return le(m,M),m.prototype.ownsTarget=function(T){if(M.prototype.ownsTarget.call(this,T)||T===this.visual||T===this.textElement||T===this.bgRectangle)return!0;var D=!1;return this.textElement.childNodes.forEach(function(G){G===T&&(D=!0)}),D},m.prototype.createVisual=function(){this.visual=te.createGroup(),this.bgRectangle=te.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=te.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(te.createTransform()),this.textElement.transform.baseVal.appendItem(te.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},m.prototype.pointerDown=function(T,D){M.prototype.pointerDown.call(this,T,D),this.isMoved=!1,this.pointerDownPoint=T,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(T),this._state="creating")},m.prototype.renderText=function(){var T=this;if(this.textElement){for(;this.textElement.lastChild;)this.textElement.removeChild(this.textElement.lastChild);this.text.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/).forEach(function(D){T.textElement.appendChild(te.createTSpan(D.trim()===""?" ":D.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},m.prototype.getTextScale=function(){var T=this.textElement.getBBox(),D=1;if(T.width>0&&T.height>0){var G=(1*this.width-this.width*this.padding*2/100)/T.width,k=(1*this.height-this.height*this.padding*2/100)/T.height;D=Math.min(G,k)}return D},m.prototype.getTextPosition=function(T){var D=this.textElement.getBBox(),G=0,k=0;return D.width>0&&D.height>0&&(G=(this.width-D.width*T)/2,k=this.height/2-D.height*T/2),{x:G,y:k}},m.prototype.sizeText=function(){var T=this.textElement.getBBox(),D=this.getTextScale(),G=this.getTextPosition(D);G.y-=T.y*D,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+G.x+"px, "+G.y+"px) scale("+D+", "+D+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(G.x,G.y),this.textElement.transform.baseVal.getItem(1).setScale(D,D))},m.prototype.manipulate=function(T){M.prototype.manipulate.call(this,T),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(T.x-this.pointerDownPoint.x)>5||Math.abs(T.y-this.pointerDownPoint.y)>5)},m.prototype.resize=function(T){M.prototype.resize.call(this,T),this.isMoved=!0,this.setSize(),this.sizeText()},m.prototype.setSize=function(){M.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(te.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),te.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},m.prototype.pointerUp=function(T){var D=this.state;D==="creating"&&(this._suppressMarkerCreateEvent=!0),M.prototype.pointerUp.call(this,T),this.setSize(),(D==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},m.prototype.showTextEditor=function(){var T=this;this._state="edit",this.overlayContainer.innerHTML="",this.textEditDiv=document.createElement("div"),this.textEditDiv.style.flexGrow="2",this.textEditDiv.style.alignItems="center",this.textEditDiv.style.justifyContent="center",this.textEditDiv.style.pointerEvents="auto",this.textEditDiv.style.overflow="hidden",this.textEditor=document.createElement("div"),this.textEditor.style.position="absolute",this.textEditor.style.fontFamily=this.fontFamily,this.textEditor.style.lineHeight="1em",this.textEditor.innerText=this.text,this.textEditor.contentEditable="true",this.textEditor.style.color=this.color,this.textEditor.style.whiteSpace="pre",this.positionTextEditor(),this.textEditor.addEventListener("pointerup",function(D){D.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var D=Number.parseFloat(T.textEditor.style.fontSize);T.textEditor.clientWidth>=Number.parseInt(T.textEditor.style.maxWidth)&&D>.9;)D-=.1,T.textEditor.style.fontSize=Math.max(D,.9)+"em"}),this.textEditor.addEventListener("keyup",function(D){D.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(D){if(D.clipboardData){var G=D.clipboardData.getData("text"),k=window.getSelection();if(!k.rangeCount)return!1;k.deleteFromDocument(),k.getRangeAt(0).insertNode(document.createTextNode(G)),D.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){T.textEditDivClicked(T.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},m.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var T=this.getTextScale(),D=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),G=this.textElement.getBBox(),k={x:G.width*T,y:G.height*T};D.x-=k.x/2,D.y-=k.y/2,this.textEditor.style.top=D.y+"px",this.textEditor.style.left=D.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-D.x+"px",this.textEditor.style.fontSize=Math.max(16*T,12)+"px",this.textElement.style.display="none"}},m.prototype.textEditDivClicked=function(T){this.text=T.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},m.prototype.select=function(){M.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},m.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),M.prototype.deselect.call(this)},m.prototype.dblClick=function(T,D){M.prototype.dblClick.call(this,T,D),this.showTextEditor()},m.prototype.setColor=function(T){this.textElement&&te.setAttributes(this.textElement,[["fill",T]]),this.color=T,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(T)},m.prototype.setFont=function(T){this.textElement&&te.setAttributes(this.textElement,[["font-family",T]]),this.fontFamily=T,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},m.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},m.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(m.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),m.prototype.getState=function(){var T=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},M.prototype.getState.call(this));return T.typeName=m.typeName,T},m.prototype.restoreState=function(T){var D=T;this.color=D.color,this.fontFamily=D.fontFamily,this.padding=D.padding,this.text=D.text,this.createVisual(),M.prototype.restoreState.call(this,T),this.setSize()},m.prototype.scale=function(T,D){M.prototype.scale.call(this,T,D),this.setSize(),this.sizeText(),this.positionTextEditor()},m.typeName="TextMarker",m.title="Text marker",m.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>',m}(Me),Z=function(M){function m(T,D,G){var k=M.call(this,T,D,G)||this;return k.color="transparent",k.lineWidth=3,k.drawing=!1,k.pixelRatio=1,k.color=G.defaultColor,k.lineWidth=G.defaultStrokeWidth,k.pixelRatio=G.freehandPixelRatio,k.setColor=k.setColor.bind(k),k.addCanvas=k.addCanvas.bind(k),k.finishCreation=k.finishCreation.bind(k),k.setLineWidth=k.setLineWidth.bind(k),k.colorPanel=new Ce("Color",G.defaultColorSet,G.defaultColor),k.colorPanel.onColorChanged=k.setColor,k.lineWidthPanel=new We("Line width",G.defaultStrokeWidths,G.defaultStrokeWidth),k.lineWidthPanel.onWidthChanged=k.setLineWidth,k}return le(m,M),m.prototype.ownsTarget=function(T){return!(!M.prototype.ownsTarget.call(this,T)&&T!==this.visual&&T!==this.drawingImage)},m.prototype.createVisual=function(){this.visual=te.createGroup(),this.drawingImage=te.createImage(),this.visual.appendChild(this.drawingImage);var T=te.createTransform();this.visual.transform.baseVal.appendItem(T),this.addMarkerVisualToContainer(this.visual)},m.prototype.pointerDown=function(T,D){this.state==="new"&&(this.addCanvas(),this.createVisual(),this._state="creating"),this.state==="creating"?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(T.x,T.y),this.drawing=!0):M.prototype.pointerDown.call(this,T,D)},m.prototype.manipulate=function(T){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(T.x,T.y),this.canvasContext.stroke()):M.prototype.manipulate.call(this,T)},m.prototype.resize=function(T){M.prototype.resize.call(this,T),te.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),te.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},m.prototype.pointerUp=function(T){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):M.prototype.pointerUp.call(this,T)},m.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)},m.prototype.select=function(){this.state==="creating"&&this.finishCreation(),M.prototype.select.call(this)},m.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),M.prototype.deselect.call(this)},m.prototype.finishCreation=function(){for(var T=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),D=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],G=D[0],k=D[1],ie=D[2],xe=D[3],ke=!1,Ye=0;Ye<this.canvasElement.height;Ye++)for(var Re=0;Re<this.canvasElement.width;Re++)T.data[Ye*this.canvasElement.width*4+4*Re+3]>0&&(ke=!0,Ye<k&&(k=Ye),Re<G&&(G=Re),Ye>xe&&(xe=Ye),Re>ie&&(ie=Re));if(ke){this.left=G/this.pixelRatio,this.top=k/this.pixelRatio,this.width=(ie-G)/this.pixelRatio,this.height=(xe-k)/this.pixelRatio;var Je=document.createElement("canvas");Je.width=ie-G,Je.height=xe-k,Je.getContext("2d").putImageData(this.canvasContext.getImageData(G,k,ie-G,xe-k),0,0),this.drawingImgUrl=Je.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},m.prototype.setDrawingImage=function(){te.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),te.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},m.prototype.setColor=function(T){this.color=T,this.colorChanged(T)},m.prototype.setLineWidth=function(T){this.lineWidth=T},Object.defineProperty(m.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),m.prototype.getState=function(){var T=Object.assign({drawingImgUrl:this.drawingImgUrl},M.prototype.getState.call(this));return T.typeName=m.typeName,T},m.prototype.restoreState=function(T){this.createVisual(),M.prototype.restoreState.call(this,T),this.drawingImgUrl=T.drawingImgUrl,this.setDrawingImage()},m.prototype.scale=function(T,D){M.prototype.scale.call(this,T,D),this.setDrawingImage()},m.typeName="FreehandMarker",m.title="Freehand marker",m.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>',m}(Me),Q=function(M){function m(T,D,G){var k=M.call(this,T,G||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return k.typeBoxes=[],k.currentType=D,k.setCurrentType=k.setCurrentType.bind(k),k}return le(m,M),m.prototype.getUi=function(){var T=this,D=document.createElement("div");D.style.display="flex",D.style.overflow="hidden",D.style.flexGrow="2";for(var G=function(xe){var ke="both";switch(xe){case 0:ke="both";break;case 1:ke="start";break;case 2:ke="end";break;case 3:ke="none"}var Ye=document.createElement("div");if(Ye.style.display="flex",Ye.style.flexGrow="2",Ye.style.alignItems="center",Ye.style.justifyContent="space-between",Ye.style.padding="5px",Ye.style.borderWidth="2px",Ye.style.borderStyle="solid",Ye.style.borderColor=ke===k.currentType?k.uiStyleSettings.toolboxAccentColor:"transparent",Ye.addEventListener("click",function(){T.setCurrentType(ke,Ye)}),D.appendChild(Ye),ke==="both"||ke==="start"){var Re=document.createElement("div");Re.style.display="flex",Re.style.alignItems="center",Re.style.minHeight="20px",Re.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="`+(k.uiStyleSettings!==void 0?k.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Re.style.marginLeft="5px",Ye.appendChild(Re)}var Je=document.createElement("div");Je.style.display="flex",Je.style.alignItems="center",Je.style.minHeight="20px",Je.style.flexGrow="2";var Ze=document.createElement("hr");if(Ze.style.minWidth="20px",Ze.style.border="0px",Ze.style.borderTop="3px solid "+(k.uiStyleSettings!==void 0?k.uiStyleSettings.toolboxColor:"#eeeeee"),Ze.style.flexGrow="2",Je.appendChild(Ze),Ye.appendChild(Je),ke==="both"||ke==="end"){var ft=document.createElement("div");ft.style.display="flex",ft.style.alignItems="center",ft.style.minHeight="20px",ft.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="`+(k.uiStyleSettings!==void 0?k.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,ft.style.marginRight="5px",Ye.appendChild(ft)}k.typeBoxes.push(Ye)},k=this,ie=0;ie<4;ie++)G(ie);return D},m.prototype.setCurrentType=function(T,D){var G=this;this.currentType=T,this.typeBoxes.forEach(function(k){k.style.borderColor=k===D?G.uiStyleSettings!==void 0?G.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},m}(ge),$=function(M){function m(T,D,G){var k=M.call(this,T,D,G)||this;return k.arrowType="end",k.arrowBaseHeight=10,k.arrowBaseWidth=10,k.getArrowPoints=k.getArrowPoints.bind(k),k.setArrowType=k.setArrowType.bind(k),k.arrowTypePanel=new Q("Arrow type","end"),k.arrowTypePanel.onArrowTypeChanged=k.setArrowType,k}return le(m,M),m.prototype.ownsTarget=function(T){return!(!M.prototype.ownsTarget.call(this,T)&&T!==this.arrow1&&T!==this.arrow2)},m.prototype.getArrowPoints=function(T,D){var G=this.arrowBaseWidth+2*this.strokeWidth,k=this.arrowBaseHeight+2*this.strokeWidth;return T-G/2+","+(D+k/2)+" "+T+","+(D-k/2)+" "+(T+G/2)+","+(D+k/2)},m.prototype.createTips=function(){this.arrow1=te.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(te.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=te.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(te.createTransform()),this.visual.appendChild(this.arrow2)},m.prototype.pointerDown=function(T,D){M.prototype.pointerDown.call(this,T,D),this.state==="creating"&&this.createTips()},m.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",te.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),te.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var T=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),D=this.arrow1.transform.baseVal.getItem(0);D.setRotate(T,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(D,0);var G=this.arrow2.transform.baseVal.getItem(0);G.setRotate(T+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(G,0)}},m.prototype.setArrowType=function(T){this.arrowType=T,this.adjustVisual(),this.stateChanged()},Object.defineProperty(m.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),m.prototype.getState=function(){var T=Object.assign({arrowType:this.arrowType},M.prototype.getState.call(this));return T.typeName=m.typeName,T},m.prototype.restoreState=function(T){M.prototype.restoreState.call(this,T);var D=T;this.arrowType=D.arrowType,this.createTips(),this.adjustVisual()},m.typeName="ArrowMarker",m.title="Arrow marker",m.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',m}(_e),V=function(M){function m(T,D,G){var k=M.call(this,T,D,G)||this;return k.fillColor=G.defaultFillColor,k.strokeWidth=0,k.fillPanel=new Ce("Color",G.defaultColorSet,G.defaultFillColor),k.fillPanel.onColorChanged=k.setFillColor,k}return le(m,M),Object.defineProperty(m.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),m.prototype.getState=function(){var T=M.prototype.getState.call(this);return T.typeName=m.typeName,T},m.typeName="CoverMarker",m.title="Cover marker",m.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',m}(Fe),Y=function(M){function m(T,D,G,k){var ie=M.call(this,T,k||'<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 ie.opacities=[],ie.opacityBoxes=[],ie.opacities=D,ie.currentOpacity=G,ie.setCurrentOpacity=ie.setCurrentOpacity.bind(ie),ie}return le(m,M),m.prototype.getUi=function(){var T=this,D=document.createElement("div");return D.style.display="flex",D.style.overflow="hidden",D.style.flexGrow="2",D.style.justifyContent="space-between",this.opacities.forEach(function(G){var k=document.createElement("div");k.style.display="flex",k.style.alignItems="center",k.style.justifyContent="center",k.style.padding="5px",k.style.borderWidth="2px",k.style.borderStyle="solid",k.style.borderColor=G===T.currentOpacity?T.uiStyleSettings.toolboxAccentColor:"transparent",k.addEventListener("click",function(){T.setCurrentOpacity(G,k)}),D.appendChild(k);var ie=document.createElement("div");ie.innerText=100*G+"%",k.appendChild(ie),T.opacityBoxes.push(k)}),D},m.prototype.setCurrentOpacity=function(T,D){var G=this;this.currentOpacity=T,this.opacityBoxes.forEach(function(k){k.style.borderColor=k===D?G.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},m}(ge),J=function(M){function m(T,D,G){var k=M.call(this,T,D,G)||this;return k.setOpacity=k.setOpacity.bind(k),k.fillColor=G.defaultHighlightColor,k.strokeWidth=0,k.opacity=G.defaultHighlightOpacity,k.fillPanel=new Ce("Color",G.defaultColorSet,k.fillColor),k.fillPanel.onColorChanged=k.setFillColor,k.opacityPanel=new Y("Opacity",G.defaultOpacitySteps,k.opacity),k.opacityPanel.onOpacityChanged=k.setOpacity,k}return le(m,M),m.prototype.setOpacity=function(T){this.opacity=T,this.visual&&te.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(m.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),m.prototype.getState=function(){var T=M.prototype.getState.call(this);return T.typeName=m.typeName,T},m.typeName="HighlightMarker",m.title="Highlight marker",m.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>',m}(V),q='<svg viewBox="0 0 24 24"><path d="M19 11.5s-2 2.17-2 3.5a2 2 0 002 2 2 2 0 002-2c0-1.33-2-3.5-2-3.5M5.21 10L10 5.21 14.79 10m1.77-1.06L7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.56-.59 1.53 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.59.59-1.56 0-2.12z"/></svg>',ae=function(M){function m(T,D,G){var k=M.call(this,T,D,G)||this;return k.bgColor="transparent",k.tipPosition={x:0,y:0},k.tipBase1Position={x:0,y:0},k.tipBase2Position={x:0,y:0},k.tipMoving=!1,k.color=G.defaultStrokeColor,k.bgColor=G.defaultFillColor,k.fontFamily=G.defaultFontFamily,k.defaultSize={x:100,y:30},k.setBgColor=k.setBgColor.bind(k),k.getTipPoints=k.getTipPoints.bind(k),k.positionTip=k.positionTip.bind(k),k.setTipPoints=k.setTipPoints.bind(k),k.colorPanel=new Ce("Text color",G.defaultColorSet,k.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>'),k.colorPanel.onColorChanged=k.setColor,k.bgColorPanel=new Ce("Fill color",G.defaultColorSet,k.bgColor,q),k.bgColorPanel.onColorChanged=k.setBgColor,k.fontFamilyPanel=new se("Font",G.defaultFontFamilies,G.defaultFontFamily),k.fontFamilyPanel.onFontChanged=k.setFont,k.tipGrip=new De,k.tipGrip.visual.transform.baseVal.appendItem(te.createTransform()),k.controlBox.appendChild(k.tipGrip.visual),k}return le(m,M),m.prototype.ownsTarget=function(T){return M.prototype.ownsTarget.call(this,T)||this.tipGrip.ownsTarget(T)||this.tip===T},m.prototype.createTip=function(){te.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=te.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},m.prototype.pointerDown=function(T,D){this.state==="new"&&M.prototype.pointerDown.call(this,T,D),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(D)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):M.prototype.pointerDown.call(this,T,D)},m.prototype.pointerUp=function(T){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,M.prototype.pointerUp.call(this,T);else{var D=this.state==="creating";M.prototype.pointerUp.call(this,T),this.setTipPoints(D),this.positionTip()}},m.prototype.manipulate=function(T){if(this.tipMoving){var D=this.unrotatePoint(T);this.tipPosition={x:D.x-this.manipulationStartLeft,y:D.y-this.manipulationStartTop},this.positionTip()}else M.prototype.manipulate.call(this,T)},m.prototype.setBgColor=function(T){this.bgRectangle&&this.tip&&(te.setAttributes(this.bgRectangle,[["fill",T]]),te.setAttributes(this.tip,[["fill",T]])),this.bgColor=T,this.fillColorChanged(T)},m.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},m.prototype.setTipPoints=function(T){T===void 0&&(T=!1);var D=Math.min(this.height/2,15),G=this.height/5;T&&(this.tipPosition={x:D+G/2,y:this.height+20});var k=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?k<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(G=this.width/5,D=Math.min(this.width/2,15),this.tipBase1Position={x:D,y:0},this.tipBase2Position={x:D+G,y:0}):(this.tipBase1Position={x:0,y:D},this.tipBase2Position={x:0,y:D+G}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?k<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(G=this.width/5,D=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-D-G,y:0},this.tipBase2Position={x:this.width-D,y:0}):(this.tipBase1Position={x:this.width,y:D},this.tipBase2Position={x:this.width,y:D+G}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?k<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(G=this.width/5,D=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-D-G,y:this.height},this.tipBase2Position={x:this.width-D,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-D-G},this.tipBase2Position={x:this.width,y:this.height-D}):k<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(G=this.width/5,D=Math.min(this.width/2,15),this.tipBase1Position={x:D,y:this.height},this.tipBase2Position={x:D+G,y:this.height}):(this.tipBase1Position={x:0,y:this.height-D},this.tipBase2Position={x:0,y:this.height-D-G})},m.prototype.resize=function(T){M.prototype.resize.call(this,T),this.positionTip()},m.prototype.positionTip=function(){te.setAttributes(this.tip,[["points",this.getTipPoints()]]);var T=this.tipGrip.visual.transform.baseVal.getItem(0);T.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(T,0)},Object.defineProperty(m.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),m.prototype.select=function(){this.positionTip(),M.prototype.select.call(this)},m.prototype.getState=function(){var T=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},M.prototype.getState.call(this));return T.typeName=m.typeName,T},m.prototype.restoreState=function(T){var D=T;this.bgColor=D.bgColor,this.tipPosition=D.tipPosition,M.prototype.restoreState.call(this,T),this.createTip(),this.setTipPoints()},m.prototype.scale=function(T,D){M.prototype.scale.call(this,T,D),this.tipPosition={x:this.tipPosition.x*T,y:this.tipPosition.y*D},this.positionTip()},m.typeName="CalloutMarker",m.title="Callout marker",m.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>',m}(fe),he=function(M){function m(T,D,G){var k=M.call(this,T,D,G)||this;return k.fillColor="transparent",k.strokeColor="transparent",k.strokeWidth=0,k.strokeDasharray="",k.opacity=1,k.strokeColor=G.defaultColor,k.strokeWidth=G.defaultStrokeWidth,k.strokeDasharray=G.defaultStrokeDasharray,k.fillColor=G.defaultFillColor,k.setStrokeColor=k.setStrokeColor.bind(k),k.setFillColor=k.setFillColor.bind(k),k.setStrokeWidth=k.setStrokeWidth.bind(k),k.setStrokeDasharray=k.setStrokeDasharray.bind(k),k.setOpacity=k.setOpacity.bind(k),k.createVisual=k.createVisual.bind(k),k.strokePanel=new Ce("Line color",de(G.defaultColorSet,["transparent"]),G.defaultColor),k.strokePanel.onColorChanged=k.setStrokeColor,k.fillPanel=new Ce("Fill color",de(G.defaultColorSet,["transparent"]),k.fillColor,q),k.fillPanel.onColorChanged=k.setFillColor,k.strokeWidthPanel=new We("Line width",G.defaultStrokeWidths,G.defaultStrokeWidth),k.strokeWidthPanel.onWidthChanged=k.setStrokeWidth,k.strokeStylePanel=new ze("Line style",G.defaultStrokeDasharrays,G.defaultStrokeDasharray),k.strokeStylePanel.onStyleChanged=k.setStrokeDasharray,k.opacityPanel=new Y("Opacity",G.defaultOpacitySteps,k.opacity),k.opacityPanel.onOpacityChanged=k.setOpacity,k}return le(m,M),m.prototype.ownsTarget=function(T){return!(!M.prototype.ownsTarget.call(this,T)&&T!==this.visual)},m.prototype.createVisual=function(){this.visual=te.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)},m.prototype.pointerDown=function(T,D){M.prototype.pointerDown.call(this,T,D),this.state==="new"&&(this.createVisual(),this.moveVisual(T),this._state="creating")},m.prototype.manipulate=function(T){M.prototype.manipulate.call(this,T)},m.prototype.resize=function(T){M.prototype.resize.call(this,T),this.setSize()},m.prototype.setSize=function(){M.prototype.setSize.call(this),te.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},m.prototype.pointerUp=function(T){M.prototype.pointerUp.call(this,T),this.setSize()},m.prototype.setStrokeColor=function(T){this.strokeColor=T,this.visual&&te.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(T),this.stateChanged()},m.prototype.setFillColor=function(T){this.fillColor=T,this.visual&&te.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(T),this.stateChanged()},m.prototype.setStrokeWidth=function(T){this.strokeWidth=T,this.visual&&te.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},m.prototype.setStrokeDasharray=function(T){this.strokeDasharray=T,this.visual&&te.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},m.prototype.setOpacity=function(T){this.opacity=T,this.visual&&te.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(m.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),m.prototype.getState=function(){var T=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},M.prototype.getState.call(this));return T.typeName=m.typeName,T},m.prototype.restoreState=function(T){var D=T;this.fillColor=D.fillColor,this.strokeColor=D.strokeColor,this.strokeWidth=D.strokeWidth,this.strokeDasharray=D.strokeDasharray,this.opacity=D.opacity,this.createVisual(),M.prototype.restoreState.call(this,T),this.setSize()},m.prototype.scale=function(T,D){M.prototype.scale.call(this,T,D),this.setSize()},m.typeName="EllipseMarker",m.title="Ellipse marker",m.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>',m}(Me),we=function(M){function m(T,D,G){return M.call(this,T,D,G)||this}return le(m,M),Object.defineProperty(m.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),m.prototype.ownsTarget=function(T){return!(!M.prototype.ownsTarget.call(this,T)&&T!==this.tip1&&T!==this.tip2)},m.prototype.createTips=function(){this.tip1=te.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(te.createTransform()),this.visual.appendChild(this.tip1),this.tip2=te.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(te.createTransform()),this.visual.appendChild(this.tip2)},m.prototype.pointerDown=function(T,D){M.prototype.pointerDown.call(this,T,D),this.state==="creating"&&this.createTips()},m.prototype.adjustVisual=function(){if(M.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(te.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()]]),te.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 T=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),D=this.tip1.transform.baseVal.getItem(0);D.setRotate(T,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(D,0);var G=this.tip2.transform.baseVal.getItem(0);G.setRotate(T+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(G,0)}},Object.defineProperty(m.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),m.prototype.getState=function(){var T=M.prototype.getState.call(this);return T.typeName=m.typeName,T},m.prototype.restoreState=function(T){M.prototype.restoreState.call(this,T),this.createTips(),this.adjustVisual()},m.typeName="MeasurementMarker",m.title="Measurement marker",m.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>',m}(_e),Ue=function(M){function m(T,D,G){var k=M.call(this,T,D,G)||this;return k.strokePanel.colors=G.defaultColorSet,k.fillColor="transparent",k}return le(m,M),Object.defineProperty(m.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),m.prototype.getState=function(){var T=M.prototype.getState.call(this);return T.typeName=m.typeName,T},m.typeName="EllipseFrameMarker",m.title="Ellipse frame marker",m.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>',m}(he),Ke=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(m){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(m)||(this.undoStack.push(m),JSON.stringify(this.lastRedoStep)!==JSON.stringify(m)&&this.redoStack.splice(0,this.redoStack.length))},M.prototype.replaceLastUndoStep=function(m){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=m)},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 m=this.undoStack.pop();return m!==void 0&&this.redoStack.push(m),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}(),Pe=function(M){function m(T,D,G){var k=M.call(this,T,D,G)||this;return k.strokeColor="transparent",k.strokeWidth=0,k.strokeDasharray="",k.curveX=0,k.curveY=0,k.manipulationStartCurveX=0,k.manipulationStartCurveY=0,k.setStrokeColor=k.setStrokeColor.bind(k),k.setStrokeWidth=k.setStrokeWidth.bind(k),k.setStrokeDasharray=k.setStrokeDasharray.bind(k),k.positionGrips=k.positionGrips.bind(k),k.addControlGrips=k.addControlGrips.bind(k),k.adjustVisual=k.adjustVisual.bind(k),k.setupControlBox=k.setupControlBox.bind(k),k.resize=k.resize.bind(k),k.strokeColor=G.defaultColor,k.strokeWidth=G.defaultStrokeWidth,k.strokeDasharray=G.defaultStrokeDasharray,k.strokePanel=new Ce("Line color",G.defaultColorSet,G.defaultColor),k.strokePanel.onColorChanged=k.setStrokeColor,k.strokeWidthPanel=new We("Line width",G.defaultStrokeWidths,G.defaultStrokeWidth),k.strokeWidthPanel.onWidthChanged=k.setStrokeWidth,k.strokeStylePanel=new ze("Line style",G.defaultStrokeDasharrays,G.defaultStrokeDasharray),k.strokeStylePanel.onStyleChanged=k.setStrokeDasharray,k}return le(m,M),m.prototype.ownsTarget=function(T){return!(!M.prototype.ownsTarget.call(this,T)&&T!==this.visual&&T!==this.selectorCurve&&T!==this.visibleCurve&&!this.curveGrip.ownsTarget(T))},m.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},m.prototype.createVisual=function(){this.visual=te.createGroup(),this.selectorCurve=te.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=te.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)},m.prototype.pointerDown=function(T,D){M.prototype.pointerDown.call(this,T,D),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=T.x,this.curveY=T.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(D)&&(this.activeGrip=this.curveGrip,this._state="resize")},m.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),te.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),te.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),te.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},m.prototype.setupControlBox=function(){M.prototype.setupControlBox.call(this),this.curveControlLine1=te.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=te.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)},m.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,M.prototype.addControlGrips.call(this)},m.prototype.positionGrips=function(){M.prototype.positionGrips.call(this);var T=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-T/2,this.curveY-T/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()))},m.prototype.manipulate=function(T){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+T.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+T.y-this.manipulationStartY),M.prototype.manipulate.call(this,T)},m.prototype.resize=function(T){this.activeGrip===this.curveGrip&&(this.curveX=T.x,this.curveY=T.y),M.prototype.resize.call(this,T),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},m.prototype.setStrokeColor=function(T){this.strokeColor=T,this.adjustVisual(),this.colorChanged(T)},m.prototype.setStrokeWidth=function(T){this.strokeWidth=T,this.adjustVisual()},m.prototype.setStrokeDasharray=function(T){this.strokeDasharray=T,this.adjustVisual()},m.prototype.scale=function(T,D){this.curveX=this.curveX*T,this.curveY=this.curveY*D,M.prototype.scale.call(this,T,D)},Object.defineProperty(m.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),m.prototype.getState=function(){var T=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},M.prototype.getState.call(this));return T.typeName=m.typeName,T},m.prototype.restoreState=function(T){M.prototype.restoreState.call(this,T);var D=T;this.strokeColor=D.strokeColor,this.strokeWidth=D.strokeWidth,this.strokeDasharray=D.strokeDasharray,this.curveX=D.curveX,this.curveY=D.curveY,this.createVisual(),this.adjustVisual()},m.typeName="CurveMarker",m.title="Curve marker",m.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>',m}(me),et=function(){function M(m,T){T===void 0&&(T=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=m,this.cancelable=T}return Object.defineProperty(M.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),M.prototype.preventDefault=function(){this._defaultPrevented=!0},M}(),$e=function(M){function m(T,D,G){var k=M.call(this,T,!1)||this;return k.dataUrl=D,k.state=G,k}return le(m,M),m}(et),He=function(M){function m(T,D,G){G===void 0&&(G=!1);var k=M.call(this,T,G)||this;return k.marker=D,k}return le(m,M),m}(et),at=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(m,T){this[m].push(T)},M.prototype.removeEventListener=function(m,T){var D=this[m].indexOf(T);D>-1&&this[m].splice(D,1)},M}(),rt=function(){function M(m){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new ue,this._isOpen=!1,this.undoRedoManager=new Ke,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 at,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=M.instanceCounter++,this.styles=new Be(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=m,this.targetRoot=document.body,this.width=m.clientWidth,this.height=m.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[ne,Z,$,fe,Ue,he,J,ae,we,V,_e,Pe]},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[ne,Z,$,fe,he,J,ae]},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"BASIC_MARKER_TYPES",{get:function(){return[ne,Z,$,fe,J]},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(m){var T=this;this._availableMarkerTypes.splice(0),m.forEach(function(D){if(typeof D=="string"){var G=T.ALL_MARKER_TYPES.find(function(k){return k.typeName===D});G!==void 0&&T._availableMarkerTypes.push(G)}else T._availableMarkerTypes.push(D)})},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(m){this._zoomLevel=m,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(),Le.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},M.prototype.show=function(){var m=this;this.styles.styleSheetRoot===void 0&&Ne.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=Ne.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(T){return T(new et(m))})},M.prototype.render=function(){return be(this,void 0,void 0,function(){var m;return pe(this,function(T){switch(T.label){case 0:return this.setCurrentMarker(),(m=new Ve).naturalSize=this.renderAtNaturalSize,m.imageType=this.renderImageType,m.imageQuality=this.renderImageQuality,m.markersOnly=this.renderMarkersOnly,m.width=this.renderWidth,m.height=this.renderHeight,[4,m.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return T.sent(),[4,m.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,T.sent()]}})})},M.prototype.close=function(m){var T=this;if(m===void 0&&(m=!1),this.isOpen){var D=!1;m||this.eventListeners.beforeclose.forEach(function(G){var k=new et(T,!0);G(k),k.defaultPrevented&&(D=!0)}),D||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.settings.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach(function(G){return G(new et(T))}),this.detachEvents(),this._isOpen=!1)}},M.prototype.addMarkersToToolbar=function(){for(var m,T=[],D=0;D<arguments.length;D++)T[D]=arguments[D];(m=this._availableMarkerTypes).push.apply(m,T)},M.prototype.addRenderEventListener=function(m){this.addEventListener("render",function(T){m(T.dataUrl,T.state)})},M.prototype.removeRenderEventListener=function(m){},M.prototype.addCloseEventListener=function(m){this.addEventListener("close",function(){m()})},M.prototype.removeCloseEventListener=function(m){},M.prototype.setupResizeObserver=function(){var m=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){m.resize(m.target.clientWidth,m.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return m.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},M.prototype.onPopupTargetResize=function(){var m=1*this.target.clientWidth/this.target.clientHeight,T=this.editorCanvas.clientWidth/m>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*m:this.editorCanvas.clientWidth,D=T<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/m;this.resize(T,D)},M.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},M.prototype.resize=function(m,T){this._isResizing=!0;var D=m/this.imageWidth,G=T/this.imageHeight;this.imageWidth=Math.round(m),this.imageHeight=Math.round(T),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px",this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.settings.displayMode!=="popup"?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),this.toolbar!==void 0&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(D,G),this._isResizing=!1},M.prototype.scaleMarkers=function(m,T){var D,G=this;this._currentMarker&&this._currentMarker instanceof fe?this._currentMarker.scale(m,T):(D=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(k){k!==G._currentMarker&&k.scale(m,T)}),D!==void 0&&this.setCurrentMarker(D)},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 m=this.editingTarget.getBoundingClientRect(),T=this.editorCanvas.getBoundingClientRect();this.left=m.left-T.left,this.top=m.top-T.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 m,T=[],D=0;D<arguments.length;D++)T[D]=arguments[D];this.defs=te.createDefs(),this.addDefsToImage(),(m=this.defs).append.apply(m,T)},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 m=document.createElement("a");m.href="https://markerjs.com/",m.target="_blank",m.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>',m.title="Powered by marker.js",m.style.display="grid",m.style.alignItems="center",m.style.justifyItems="center",m.style.padding="3px",m.style.width="20px",m.style.height="20px",this.logoUI.appendChild(m),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 m=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=m+"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 Ie(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 Ae(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(m){this.markerImage.removeChild(m.container),this.markers.indexOf(m)>-1&&this.markers.splice(this.markers.indexOf(m),1),m.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(m,T){if(m==="marker"&&T!==void 0)this.createNewMarker(T);else if(m==="action")switch(T){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 m=this;if(this._currentMarker!==void 0){var T=!1;if(this.eventListeners.markerbeforedelete.forEach(function(G){var k=new He(m,m._currentMarker,!0);G(k),k.defaultPrevented&&(T=!0)}),!T){var D=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach(function(G){return G(new He(m,D))})}}},M.prototype.clear=function(){var m=this,T=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ie){var xe=new He(m,void 0,!0);ie(xe),xe.defaultPrevented&&(T=!0)}),!T)){this.setCurrentMarker();for(var D=function(ie){var xe=G.markers[ie];G.setCurrentMarker(G.markers[ie]),G._currentMarker.dispose(),G.markerImage.removeChild(G._currentMarker.container),G.markers.splice(G.markers.indexOf(G._currentMarker),1),G.eventListeners.markerdelete.forEach(function(ke){return ke(new He(m,xe))})},G=this,k=this.markers.length-1;k>=0;k--)D(k);this.addUndoStep()}},Object.defineProperty(M.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),M.prototype.showNotesEditor=function(){var m;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=(m=this._currentMarker.notes)!==null&&m!==void 0?m:"",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 m=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var T=this.getState(),D=this.undoRedoManager.getLastUndoStep();if(!D||D.width===T.width&&D.height===T.height){var G=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(T),G<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(k){return k(new et(m))})}else this.undoRedoManager.replaceLastUndoStep(T),this.eventListeners.statechange.forEach(function(k){return k(new et(m))})}},M.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},M.prototype.undoStep=function(){var m=this,T=this.undoRedoManager.undo();T!==void 0&&(this.restoreState(T),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(D){return D(new et(m))}))},M.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},M.prototype.redoStep=function(){var m=this,T=this.undoRedoManager.redo();T!==void 0&&(this.restoreState(T),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(D){return D(new et(m))}))},M.prototype.stepZoom=function(){var m=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=m<this.zoomSteps.length-1?this.zoomSteps[m+1]:this.zoomSteps[0]},M.prototype.panTo=function(m){this.contentDiv.scrollBy({left:this.prevPanPoint.x-m.x,top:this.prevPanPoint.y-m.y}),this.prevPanPoint=m},M.prototype.startRenderAndClose=function(){return be(this,void 0,void 0,function(){var m,T,D=this;return pe(this,function(G){switch(G.label){case 0:return[4,this.render()];case 1:return m=G.sent(),T=this.getState(),this.eventListeners.render.forEach(function(k){return k(new $e(D,m,T))}),this.close(!0),[2]}})})},M.prototype.getState=function(m){m===!0&&this.setCurrentMarker();var T={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(D){return T.markers.push(D.getState())}),T},M.prototype.restoreState=function(m){var T=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);m.markers.forEach(function(D){var G=T._availableMarkerTypes.find(function(ie){return ie.typeName===D.typeName});if(G!==void 0){var k=T.addNewMarker(G);k.restoreState(D),T.markers.push(k)}}),m.width&&m.height&&(m.width!==this.imageWidth||m.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/m.width,this.imageHeight/m.height),this.eventListeners.restorestate.forEach(function(D){return D(new et(T))})},M.prototype.addNewMarker=function(m){var T=te.createGroup();return this.markerImage.appendChild(T),new m(T,this.overlayContainer,this.settings)},M.prototype.createNewMarker=function(m){var T,D=this;(T=typeof m=="string"?this._availableMarkerTypes.find(function(G){return G.typeName===m}):m)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(T),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(T.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(G){return G(new He(D,D._currentMarker))}))},M.prototype.markerCreated=function(m){var T=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(m),this.setCurrentMarker(m),m instanceof Z&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(Z):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(D){return D(new He(T,T._currentMarker))})},M.prototype.colorChanged=function(m){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=m,this.settings.defaultStrokeColor=m)},M.prototype.fillColorChanged=function(m){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=m)},M.prototype.markerStateChanged=function(m){var T=this;this.eventListeners.markerchange.forEach(function(D){return D(new He(T,m))})},M.prototype.setCurrentMarker=function(m){var T=this;this._currentMarker!==m&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(D){return D(new He(T,T._currentMarker))})),this._currentMarker=m,this._currentMarker===void 0||this._currentMarker.isSelected||(this._currentMarker.state!=="new"&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach(function(D){return D(new He(T,T._currentMarker))}))},M.prototype.onPointerDown=function(m){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||m.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var T=this.markers.find(function(D){return D.ownsTarget(m.target)});T!==void 0?(this.setCurrentMarker(T),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(m.clientX,m.clientY),m.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:m.clientX,y:m.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(m.clientX,m.clientY))},M.prototype.onDblClick=function(m){if(this._isFocused||this.focus(),this.mode==="select"){var T=this.markers.find(function(D){return D.ownsTarget(m.target)});T!==void 0&&T!==this._currentMarker&&this.setCurrentMarker(T),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(m.clientX,m.clientY),m.target):this.setCurrentMarker()}},M.prototype.onPointerMove=function(m){this.touchPoints!==1&&m.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||m.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(m.clientX,m.clientY)):this.zoomLevel>1&&this.panTo({x:m.clientX,y:m.clientY}))},M.prototype.onPointerUp=function(m){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(m.clientX,m.clientY)),this.isDragging=!1,this.addUndoStep()},M.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},M.prototype.onKeyUp=function(m){this._currentMarker===void 0||this.notesArea!==void 0||m.key!=="Delete"&&m.key!=="Backspace"||this.deleteSelectedMarker()},M.prototype.clientToLocalCoordinates=function(m,T){var D=this.markerImage.getBoundingClientRect();return{x:(m-D.left)/this.zoomLevel,y:(T-D.top)/this.zoomLevel}},M.prototype.onWindowResize=function(){this.positionUI()},M.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var m=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=m+"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(m){Le.addKey(m)},M.prototype.addEventListener=function(m,T){this.eventListeners.addEventListener(m,T)},M.prototype.removeEventListener=function(m,T){this.eventListeners.removeEventListener(m,T)},M.prototype.renderState=function(m){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(m),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(M.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),M.prototype.focus=function(){var m=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(T){return T(new et(m))}))},M.prototype.blur=function(){var m=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(T){return T(new et(m))}))},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 it=function(M,m){return(it=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(T,D){T.__proto__=D}||function(T,D){for(var G in D)Object.prototype.hasOwnProperty.call(D,G)&&(T[G]=D[G])})(M,m)};function ht(M,m){if(typeof m!="function"&&m!==null)throw new TypeError("Class extends value "+String(m)+" is not a constructor or null");function T(){this.constructor=M}it(M,m),M.prototype=m===null?Object.create(m):(T.prototype=m.prototype,new T)}function qe(M,m,T,D){return new(T||(T=Promise))(function(G,k){function ie(Ye){try{ke(D.next(Ye))}catch(Re){k(Re)}}function xe(Ye){try{ke(D.throw(Ye))}catch(Re){k(Re)}}function ke(Ye){var Re;Ye.done?G(Ye.value):(Re=Ye.value,Re instanceof T?Re:new T(function(Je){Je(Re)})).then(ie,xe)}ke((D=D.apply(M,m||[])).next())})}function ot(M,m){var T,D,G,k,ie={label:0,sent:function(){if(1&G[0])throw G[1];return G[1]},trys:[],ops:[]};return k={next:xe(0),throw:xe(1),return:xe(2)},typeof Symbol=="function"&&(k[Symbol.iterator]=function(){return this}),k;function xe(ke){return function(Ye){return function(Re){if(T)throw new TypeError("Generator is already executing.");for(;ie;)try{if(T=1,D&&(G=2&Re[0]?D.return:Re[0]?D.throw||((G=D.return)&&G.call(D),0):D.next)&&!(G=G.call(D,Re[1])).done)return G;switch(D=0,G&&(Re=[2&Re[0],G.value]),Re[0]){case 0:case 1:G=Re;break;case 4:return ie.label++,{value:Re[1],done:!1};case 5:ie.label++,D=Re[1],Re=[0];continue;case 7:Re=ie.ops.pop(),ie.trys.pop();continue;default:if(!(G=ie.trys,(G=G.length>0&&G[G.length-1])||Re[0]!==6&&Re[0]!==2)){ie=0;continue}if(Re[0]===3&&(!G||Re[1]>G[0]&&Re[1]<G[3])){ie.label=Re[1];break}if(Re[0]===6&&ie.label<G[1]){ie.label=G[1],G=Re;break}if(G&&ie.label<G[2]){ie.label=G[2],ie.ops.push(Re);break}G[2]&&ie.ops.pop(),ie.trys.pop();continue}Re=m.call(M,ie)}catch(Je){Re=[6,Je],D=0}finally{T=G=0}if(5&Re[0])throw Re[1];return{value:Re[0]?Re[1]:void 0,done:!0}}([ke,Ye])}}}var dt=function(){function M(){}return M.addKey=function(m){M.key=m},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}(),Te=function(){function M(){}return M.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},M.setAttributes=function(m,T){for(var D=0,G=T;D<G.length;D++){var k=G[D],ie=k[0],xe=k[1];m.setAttribute(ie,xe)}},M.createRect=function(m,T,D){var G=document.createElementNS("http://www.w3.org/2000/svg","rect");return G.setAttribute("width",m.toString()),G.setAttribute("height",T.toString()),D&&M.setAttributes(G,D),G},M.createLine=function(m,T,D,G,k){var ie=document.createElementNS("http://www.w3.org/2000/svg","line");return ie.setAttribute("x1",m.toString()),ie.setAttribute("y1",T.toString()),ie.setAttribute("x2",D.toString()),ie.setAttribute("y2",G.toString()),k&&M.setAttributes(ie,k),ie},M.createPolygon=function(m,T){var D=document.createElementNS("http://www.w3.org/2000/svg","polygon");return D.setAttribute("points",m),T&&M.setAttributes(D,T),D},M.createCircle=function(m,T){var D=document.createElementNS("http://www.w3.org/2000/svg","circle");return D.setAttribute("cx",(m/2).toString()),D.setAttribute("cy",(m/2).toString()),D.setAttribute("r",m.toString()),T&&M.setAttributes(D,T),D},M.createEllipse=function(m,T,D){var G=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return G.setAttribute("cx",(m/2).toString()),G.setAttribute("cy",(T/2).toString()),G.setAttribute("rx",(m/2).toString()),G.setAttribute("ry",(T/2).toString()),D&&M.setAttributes(G,D),G},M.createGroup=function(m){var T=document.createElementNS("http://www.w3.org/2000/svg","g");return m&&M.setAttributes(T,m),T},M.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},M.createMarker=function(m,T,D,G,k,ie,xe){var ke=document.createElementNS("http://www.w3.org/2000/svg","marker");return M.setAttributes(ke,[["id",m],["orient",T],["markerWidth",D.toString()],["markerHeight",G.toString()],["refX",k.toString()],["refY",ie.toString()]]),ke.appendChild(xe),ke},M.createText=function(m){var T=document.createElementNS("http://www.w3.org/2000/svg","text");return T.setAttribute("x","0"),T.setAttribute("y","0"),m&&M.setAttributes(T,m),T},M.createTSpan=function(m,T){var D=document.createElementNS("http://www.w3.org/2000/svg","tspan");return D.textContent=m,T&&M.setAttributes(D,T),D},M.createImage=function(m){var T=document.createElementNS("http://www.w3.org/2000/svg","image");return m&&M.setAttributes(T,m),T},M.createPoint=function(m,T){var D=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return D.x=m,D.y=T,D},M.createPath=function(m,T){var D=document.createElementNS("http://www.w3.org/2000/svg","path");return D.setAttribute("d",m),T&&M.setAttributes(D,T),D},M.createElement=function(m,T){var D=document.createElementNS("http://www.w3.org/2000/svg",m);return T&&M.setAttributes(D,T),D},M.getHollowRectanglePath=function(m,T,D,G,k,ie,xe,ke){return"M"+m+","+T+"V"+(T+G)+"H"+(m+D)+"V"+T+"H"+k+"V"+ie+"H"+(k+xe)+"V"+(ie+ke)+"H"+k+"V"+T+"Z"},M}(),Xe=function(){function M(m){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+m+"_"}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(m){return this.styleSheet===void 0&&this.addStyleSheet(),m.name=""+this.classNamePrefix+m.localName,this.classes.push(m),this.styleSheet.sheet.insertRule("."+m.name+" {"+m.style+"}",this.styleSheet.sheet.cssRules.length),m},M.prototype.addRule=function(m){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(m),this.styleSheet.sheet.insertRule(m.selector+" {"+m.style+"}",this.styleSheet.sheet.cssRules.length)},M.prototype.addStyleSheet=function(){var m;this.styleSheet=document.createElement("style"),((m=this.styleSheetRoot)!==null&&m!==void 0?m:document.head).appendChild(this.styleSheet),this.addRule(new tt("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new tt("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new tt("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new Qe("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new Qe("_fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},M.prototype.removeStyleSheet=function(){var m;this.styleSheet&&(((m=this.styleSheetRoot)!==null&&m!==void 0?m:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},M}(),tt=function(M,m){this.selector=M,this.style=m},Qe=function(M,m){this.localName=M,this.style=m},st=function(){function M(){this.blocks=[],this.display=""}return M.prototype.addButtonBlock=function(m){m.className=this.blockClassName,m.buttonClassName=this.buttonClassName,m.buttonColorsClassName=this.buttonColorsClassName,m.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(m)},M.prototype.addElementBlock=function(m){m.className===void 0&&(m.className=this.blockClassName),this.blocks.push(m)},M.prototype.getUI=function(){var m=document.createElement("div");return m.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,m.style.display=this.display,this.blocks.forEach(function(T){return m.appendChild(T.getUI())}),m},M}(),Rt=function(){function M(){}return M.prototype.getUI=function(){var m=document.createElement("div");if(m.className=this.className,this.minWidth!==void 0&&(m.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":m.style.justifyContent="flex-start";break;case"center":m.style.justifyContent="center";break;case"end":m.style.justifyContent="flex-end"}return m.style.whiteSpace="nowrap",m},M}(),At=function(M){function m(){var T=M!==null&&M.apply(this,arguments)||this;return T.buttons=[],T}return ht(m,M),m.prototype.addButton=function(T){T.className=this.buttonClassName,T.colorsClassName=this.buttonColorsClassName,T.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(T)},m.prototype.getUI=function(){var T=M.prototype.getUI.call(this);return this.buttons.forEach(function(D){return T.appendChild(D.getUI())}),T},m}(Rt),Et=function(){function M(m,T){this._isActive=!1,this._isHidden=!1,this._icon=m,this.title=T,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(M.prototype,"icon",{get:function(){return this._icon},set:function(m){this._icon=m,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"isActive",{get:function(){return this._isActive},set:function(m){this._isActive=m,this.adjustClassName()},enumerable:!1,configurable:!0}),M.prototype.getUI=function(){var m=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 m.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}(),xt=function(M){function m(){var T=M!==null&&M.apply(this,arguments)||this;return T.elements=[],T}return ht(m,M),m.prototype.addElement=function(T){this.elements.push(T)},m.prototype.getUI=function(){var T=M.prototype.getUI.call(this);return this.elements.forEach(function(D){return T.appendChild(D)}),T},m}(Rt),Ct=function(){function M(m,T){this.horizontal=m,this.vertical=T}return Object.defineProperty(M.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),M.prototype.getVerticalLength=function(m){return m/this.ratio},M.prototype.getHorizontalLength=function(m){return m*this.ratio},M}(),Ot=function(){function M(){}return M.getIcon=function(m,T){if(m>0&&T>0){var D=new Ct(m,T),G=D.ratio>=1?20:D.getHorizontalLength(20),k=D.ratio<1?20:D.getVerticalLength(20),ie=document.createElementNS("http://www.w3.org/2000/svg","svg");ie.setAttribute("xmlns","http://www.w3.org/2000/svg"),ie.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ie);var xe=Te.createDefs();ie.appendChild(xe);var ke=Te.createElement("clipPath",[["id","text-bg-clip"]]);xe.appendChild(ke);var Ye=Te.createPath(Te.getHollowRectanglePath((24-G)/2,(24-k)/2,G,k,(24-G)/2+2,(24-k)/2+2,G-4,k-4));ie.appendChild(Ye);var Re=Te.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Re.appendChild(Te.createTSpan(m+":"+T)),ie.appendChild(Re);var Je=Re.getBBox();Te.setAttributes(Re,[["x",((24-Je.width)/2).toString()],["y",((24-Je.height)/2-Je.y).toString()]]);var Ze=Te.createPath(Te.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Je.width))/2,(24-Math.ceil(Je.height))/2,Math.ceil(Je.width),Math.ceil(Je.height)));return ke.appendChild(Ze),Te.setAttributes(Ye,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ie),ie.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}(),Mt=function(M){function m(T,D,G){var k=M.call(this,T,D)||this;return k.isDropdownOpen=!1,k.onClick=k.dropdownButtonClicked,k.dropdownButtons=G,k}return ht(m,M),m.prototype.setupDropdown=function(){var T=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(D){D.className=T.className,D.colorsClassName=T.colorsClassName,T.dropdownBlock.appendChild(D.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},m.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},m.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},m.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},m.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},m.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},m}(Et),It=function(){function M(m,T){this.GRIP_SIZE=10,this.color=m,this.fillColor=T,this.visual=Te.createGroup(),this.visual.appendChild(Te.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(Te.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(m){return m===this.visual||m===this.visual.childNodes[0]||m===this.visual.childNodes[1]},M.prototype.setCenter=function(m,T){this.visual.childNodes.forEach(function(D){return Te.setAttributes(D,[["cx",m.toString()],["cy",T.toString()]])})},M}(),Tt=function(){function M(m,T,D,G){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=m,this.canvasHeight=T,this.margin=D,this.container=G,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(m){this._aspectRatio=m,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(m){this._isGridVisible=m,this.gridContainer&&Te.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(m){this._zoomFactor=m,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),M.prototype.open=function(){var m=this;this.cropShadeElement=Te.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=Te.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var T=0;T<this.numberOfGridLines;T++)this.horizontalGridLines.push(Te.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(Te.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(D){return m.gridContainer.appendChild(D)}),this.verticalGridLines.forEach(function(D){return m.gridContainer.appendChild(D)}),this.cropRectElement=Te.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new It(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new It(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new It(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new It(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},M.prototype.setCropRectangle=function(m){this.cropRect=m;var T=Object.assign({},this.cropRect);this.zoomFactor!==1&&(T.width=this.cropRect.width*this.zoomFactor,T.height=this.cropRect.height*this.zoomFactor,T.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-T.width/2,T.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-T.height/2),Te.setAttributes(this.cropRectElement,[["x",T.x.toString()],["y",T.y.toString()],["width",T.width.toString()],["height",T.height.toString()]]);var D=T.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(k,ie){var xe=T.y+D*(ie+1);Te.setAttributes(k,[["x1",""+T.x],["y1",""+xe],["x2",""+(T.x+T.width)],["y2",""+xe]])});var G=T.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(k,ie){var xe=T.x+G*(ie+1);Te.setAttributes(k,[["x1",""+xe],["y1",""+T.y],["x2",""+xe],["y2",""+(T.y+T.height)]])}),Te.setAttributes(this.cropShadeElement,[["d",Te.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,T.x,T.y,T.width,T.height)]]),this.topLeftGrip.setCenter(T.x,T.y),this.topRightGrip.setCenter(T.x+T.width,T.y),this.bottomLeftGrip.setCenter(T.x,T.y+T.height),this.bottomRightGrip.setCenter(T.x+T.width,T.y+T.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(m,T){var D=this.container.getBoundingClientRect();return{x:m-D.left+this.margin,y:T-D.top+this.margin}},M.prototype.onPointerDown=function(m){this.container.setPointerCapture(m.pointerId),this.previousPoint=this.clientToLocalCoordinates(m.clientX,m.clientY),this.cropRectElement===m.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(m.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(m.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(m.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(m.target)&&(this.activeGrip=this.bottomRightGrip)},M.prototype.onPointerMove=function(m){if(this.isMoving)this.move(this.clientToLocalCoordinates(m.clientX,m.clientY));else if(this.activeGrip){var T=this.clientToLocalCoordinates(m.clientX,m.clientY);this.resize(T)}m.preventDefault()},M.prototype.onPointerUp=function(m){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(m.pointerId)},M.prototype.move=function(m){var T=m.x-this.previousPoint.x,D=m.y-this.previousPoint.y;this.zoomFactor!==1&&(T=-T/this.zoomFactor,D=-D/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+T),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+D),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=m},M.prototype.resize=function(m){var T=Object.assign({},this.cropRect),D=m.x-this.previousPoint.x,G=m.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:T.x+D<this.margin&&(D=this.margin-T.x),T.x+=D,T.width=this.cropRect.x+this.cropRect.width-T.x;break;case this.bottomRightGrip:case this.topRightGrip:T.width+D>this.canvasWidth*this.zoomFactor&&(D=this.canvasWidth*this.zoomFactor-T.width),T.width+=D}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(T.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(D),T.height=this.aspectRatio.getVerticalLength(T.width)):(T.y+=G,T.height=this.cropRect.y+this.cropRect.height-T.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?T.height=this.aspectRatio.getVerticalLength(T.width):T.height+=G}T.width<10&&(T.x=this.cropRect.x,T.width=10),T.height<10&&(T.y=this.cropRect.y,T.height=10),this.previousPoint=m,T.x>=this.margin&&T.y>=this.margin&&T.x-this.margin+T.width<=this.canvasWidth&&T.y-this.margin+T.height<=this.canvasHeight&&(this.cropRect=T,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 m=this.cropRect.x+this.cropRect.width/2,T=this.cropRect.y+this.cropRect.height/2,D=this.aspectRatio.getHorizontalLength(this.cropRect.height),G=this.aspectRatio.getVerticalLength(this.cropRect.width);D/this.canvasWidth<G/this.canvasHeight?this.cropRect.width=D:this.cropRect.height=G,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=m-this.cropRect.width/2,this.cropRect.y=T-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(m,T,D,G,k,ie){var xe=D/m,ke=G/T;return{x:(k.x-ie)*xe+ie,y:(k.y-ie)*ke+ie,width:k.width*xe,height:k.height*ke}},M.prototype.scaleCanvas=function(m,T){var D=this.getRescaledRect(this.canvasWidth,this.canvasHeight,m,T,this.cropRect,this.margin);this.canvasWidth=m,this.canvasHeight=T,this.onCropChange&&this.onCropChange(D),this.setCropRectangle(D)},M}(),Ut=function(){function M(m){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=m,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(m){this._angle=m,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(m){this.controlContainer.setPointerCapture(m.pointerId),this.isDragging=!0,this.previousPoint={x:m.clientX,y:m.clientY}},M.prototype.onPointerMove=function(m){this.isDragging&&(this.onAngleChange&&this.onAngleChange((m.clientX-this.previousPoint.x)/5),this.previousPoint.x=m.clientX)},M.prototype.onPointerUp=function(m){this.isDragging&&this.onAngleChange&&this.onAngleChange((m.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(m.pointerId)},M.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var m=this.angleLabelText.getBBox();Te.setAttributes(this.angleLabelElement,[["x",((this.width-m.width)/2).toString()],["y",(this.height/2).toString()]])}},M.prototype.positionScaleShape=function(){if(this.scaleShape){var m=this.scaleShape.transform.baseVal.getItem(0);m.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(m,0)}},M.prototype.getVisual=function(){var m=document.createElementNS("http://www.w3.org/2000/svg","svg");m.setAttribute("xmlns","http://www.w3.org/2000/svg"),m.setAttribute("width",this.width+"px"),m.setAttribute("height",this.height+"px"),m.setAttribute("viewBox","0 0 "+this.width+" "+this.height),m.style.flexShrink="0",document.body.appendChild(m);for(var T="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,D=1;D<=this.width/5+10;D++){var G=D%5==0?this.height/3:this.height/6;T+="h4v"+-G+"h1v"+G}T+="v1H0Z",this.scaleShape=Te.createPath(T);var k=Te.createTransform();this.scaleShape.transform.baseVal.appendItem(k),m.appendChild(this.scaleShape),this.angleLabelElement=Te.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=Te.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ie=Te.createTSpan("");return ie.innerHTML="°",this.angleLabelElement.appendChild(ie),m.appendChild(this.angleLabelElement),document.body.removeChild(m),m},M}(),kt=function(){function M(){this.naturalSize=!1,this.imageType="image/png"}return M.prototype.rasterize=function(m,T,D,G,k,ie,xe){var ke=this;return new Promise(function(Ye){var Re=document.createElement("canvas");Re.width=m.width.baseVal.value-2*G,Re.height=m.height.baseVal.value-2*G;var Je=1,Ze=1;ke.naturalSize===!0?(Je=T.naturalWidth/(m.width.baseVal.value-2*G)/ie,Ze=T.naturalHeight/(m.height.baseVal.value-2*G)/xe,Re.width=T.naturalWidth/ie,Re.height=T.naturalHeight/xe):ke.width!==void 0&&ke.height!==void 0&&(Je=ke.width/D.width,Ze=ke.height/D.height,Re.width*=Je,Re.height*=Ze);var ft=Re.getContext("2d");ft.translate(Re.width/2,Re.height/2),ft.rotate(k*Math.PI/180),ft.scale(ie,xe),ft.translate(-Re.width/2,-Re.height/2),ft.drawImage(T,0,0,Re.width,Re.height);var St=document.createElement("canvas");St.width=D.width*Je,St.height=D.height*Ze,St.getContext("2d").putImageData(ft.getImageData((D.x-G)*Je,(D.y-G)*Ze,D.width*Je,D.height*Ze),0,0),Ye(St.toDataURL(ke.imageType,ke.imageQuality))})},M}(),$t=function(){function M(m){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 Xe(this.instanceNo),this.target=m,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(m){this._zoomToCropEnabled=m,m?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(m){this._isGridVisible=m,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"gridLines",{get:function(){return this._gridLines},set:function(m){this._gridLines=m,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(m){this._rotationAngle=m,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 m;return(m=this._aspectRatio)!==null&&m!==void 0?m:this.aspectRatios[0]},set:function(m){this._aspectRatio=m},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(m){m===void 0&&(m=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),m||this.closeEventListeners.forEach(function(T){return T()}),this._isOpen=!1)},M.prototype.addRenderEventListener=function(m){this.renderEventListeners.push(m)},M.prototype.removeRenderEventListener=function(m){this.renderEventListeners.indexOf(m)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(m),1)},M.prototype.addCloseEventListener=function(m){this.closeEventListeners.push(m)},M.prototype.removeCloseEventListener=function(m){this.closeEventListeners.indexOf(m)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(m),1)},M.prototype.setupResizeObserver=function(){var m=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){m.resize(m.target.clientWidth,m.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 m=1*this.target.clientWidth/this.target.clientHeight,T=this.contentDiv.clientWidth/m>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*m:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,D=T+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/m;this.resize(T,D)}},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",Te.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(m,T){this.imageWidth=Math.round(m),this.imageHeight=Math.round(T),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 m=document.createElement("canvas");m.width=this.target.naturalWidth,m.height=this.target.naturalHeight,m.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var T=m.toDataURL();Te.setAttributes(this.editingTarget,[["href",T]]),this.setEditingTargetSize()},M.prototype.setTopLeft=function(){var m=this.target.getBoundingClientRect(),T=this.editorCanvas.getBoundingClientRect();this.left=m.left-T.left-this.CANVAS_MARGIN,this.top=m.top-T.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=Te.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=Te.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=Te.createGroup(),this.editingTargetRotationScaleContainer=Te.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var m=Te.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(m);var T=Te.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(T),this.editingTargetContainer=Te.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=Te.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Tt(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 m=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,T=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=m+"px "+T+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-m+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-T+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(m){this.cropRect=m,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 m=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,T=this.target.offsetTop>m+this.CANVAS_MARGIN?this.target.offsetTop-(m+this.CANVAS_MARGIN):0;this.coverDiv.style.top=T+"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 m=this;this.topToolbar=new st,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 T=new At;T.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(T);var D=[];this.aspectRatios.forEach(function(Ze){var ft=new Et(Ot.getIcon(Ze.horizontal,Ze.vertical),Ze.horizontal===0&&Ze.vertical===0?"FREE":Ze.horizontal+":"+Ze.vertical);ft.onClick=function(){return m.ratioButtonClicked(Ze)},D.push(ft)}),this.aspectRatioButton=new Mt(Ot.getIcon(0,0),"Aspect ratio",D),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,T.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var G=new Et('<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");G.isActive=this.isGridVisible,G.onClick=function(){m.isGridVisible=!m.isGridVisible,G.isActive=m.isGridVisible},T.addButton(G);var k=new Et('<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(k.isActive=this.zoomToCropEnabled,k.onClick=function(){m.zoomToCropEnabled=!m.zoomToCropEnabled,k.isActive=m.zoomToCropEnabled},T.addButton(k),!dt.isLicensed){var ie=new xt;this.topToolbar.addElementBlock(ie);var xe=document.createElement("div");xe.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var ke=document.createElement("a");ke.style.color="currentColor",ke.href="https://markerjs.com/products/cropro",ke.target="_blank",ke.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>',xe.appendChild(ke),ie.addElement(xe)}var Ye=new At;Ye.minWidth=3*this.toolbarHeight+"px",Ye.contentAlign="end",this.topToolbar.addButtonBlock(Ye);var Re=new Et('<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");Re.onClick=this.startRenderAndClose,Ye.addButton(Re),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Re.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Je=new Et('<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");Je.onClick=this.close,Ye.addButton(Je),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Je.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},M.prototype.addBottomToolbar=function(){var m=this;this.bottomToolbar=new st,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 T=new At;T.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(T);var D=new Et('<svg viewBox="0 0 24 24"><path d="M13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93M7.1 18.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32M6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47m1.02-4.47L5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47z"/></svg>',"Rotate left");D.onClick=this.rotateLeftButtonClicked,T.addButton(D);var G=new Et('<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");G.onClick=this.rotateRightButtonClicked,T.addButton(G);var k=new xt;k.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(k),this.straightener=new Ut("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(Ye){m.rotateBy(Ye),m.straightener.angle=m.rotationAngle},k.addElement(this.straightener.getUI());var ie=new At;ie.minWidth=2*this.toolbarHeight+"px",ie.contentAlign="end",this.bottomToolbar.addButtonBlock(ie);var xe=new Et('<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");xe.onClick=this.flipHorizontallyButtonClicked,ie.addButton(xe);var ke=new Et('<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");ke.onClick=this.flipVerticallyButtonClicked,ie.addButton(ke)},M.prototype.ratioButtonClicked=function(m){this.aspectRatio=m,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},M.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=Ot.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 Ct(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(m){if(m){var T=this.cropLayer.getRescaledRect(m.width,m.height,this.imageWidth,this.imageHeight,m.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(T),this.cropRectChanged(T),this.flippedHorizontally=m.flippedHorizontally,this.flippedVertically=m.flippedVertically,this.applyFlip(),this.rotationAngle=m.rotationAngle,this.applyRotation()}},M.prototype.clientToLocalCoordinates=function(m,T){var D=this.cropImage.getBoundingClientRect();return{x:m-D.left,y:T-D.top}},M.prototype.onWindowResize=function(){this.positionUI()},M.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var m=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=m+"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 m=this.rotationAngle-90;this.rotationAngle%90!=0&&(m+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(m)},M.prototype.rotateRightButtonClicked=function(){var m=this.rotationAngle+90;this.rotationAngle%90!=0&&(m-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(m)},M.prototype.rotateTo=function(m){m=(m=m>180?m-360:m)<=-180?m+360:m,this.rotationAngle=m,this.applyRotation()},M.prototype.rotateBy=function(m){this.rotateTo((this.rotationAngle+m)%360)},M.prototype.applyRotation=function(){var m=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var T=this.editingTargetRotationContainer.transform.baseVal.getItem(0);T.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(T,0);var D=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/D.width,this.imageHeight/D.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=m},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 qe(this,void 0,void 0,function(){var m,T;return ot(this,function(D){switch(D.label){case 0:return[4,this.render()];case 1:return m=D.sent(),T=this.getState(),this.renderEventListeners.forEach(function(G){return G(m,T)}),this.close(!0),[2]}})})},M.prototype.render=function(){return qe(this,void 0,void 0,function(){var m;return ot(this,function(T){switch(T.label){case 0:return(m=new kt).naturalSize=this.renderAtNaturalSize,m.imageType=this.renderImageType,m.imageQuality=this.renderImageQuality,m.width=this.renderWidth,m.height=this.renderHeight,this.unzoomFromCrop(),Te.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,m.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 T.sent(),[4,m.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,T.sent()]}})})},M.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Qe("toolbar",`
|
|
width: `+(this.displayMode==="inline"?"100%":"calc(100vw - "+2*this.popupMargin+"px)")+`;
|
|
flex-shrink: 0;
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: space-between;
|
|
height: `+this.toolbarHeight+`px;
|
|
box-sizing: content-box;
|
|
overflow: hidden;
|
|
line-height: 0px;
|
|
`)),this.toolbarStyleColorsClass=this.styles.addClass(new Qe("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Qe("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var m=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Qe("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.toolbarHeight-2*m)+`px;
|
|
height: `+(this.toolbarHeight-2*m)+`px;
|
|
padding: `+m+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Qe("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Qe("toolbar_active_button",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
|
|
`)),this.styles.addRule(new tt("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new tt("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
|
|
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new Qe("toolbar_dropdown",`
|
|
position: absolute;
|
|
max-width: `+4*this.toolbarHeight+`px;
|
|
z-index: 20;
|
|
white-space: normal;
|
|
box-sizing: content-box;
|
|
box-shadow: 3px 3px rgba(33, 33, 33, 0.1);
|
|
margin: `+(this.displayMode==="inline"?"0":this.popupMargin)+`px;
|
|
line-height: 0px;
|
|
`)),this.toolbarDropdownStyleColorsClass=this.styles.addClass(new Qe("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Qe("toolbar_straightener_block",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
-webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 30%, rgba(0,0,0,1) 70%, rgba(0,0,0,0) 100%);
|
|
`)),this.toolbarStraightenerStyleClass=this.styles.addClass(new Qe("toolbar_straightener",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
height: `+(this.toolbarHeight-2*m)+`px;
|
|
padding: `+m+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new Qe("toolbar_straightener_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`))},M.instanceCounter=0,M}(),jt=z("8hTe"),Lt=z.n(jt),Bt=/<pre[^>]*>/g;function Ht(M){var m=document.createElement("div");return m.innerHTML=M,m.childNodes.length===0?"":m.childNodes[0].nodeValue}var Qt=Ee.a=function(M){var m=M.value,T=m===void 0?"":m,D=M.edit,G=D===void 0?!1:D,k=M.className,ie=M.showTextOnly,xe=M.showLines,ke=M.replaces,Ye=M.zoomImg,Re=M.hasMask,Je=M.style,Ze=Je===void 0?{}:Je,ft=M.stylesPrev,St=ft===void 0?{}:ft,Nt=String(T),gt=Object(S.useRef)(),Dt=Object(S.useRef)(),ii=Object(S.useState)(""),Jt=Object(j.a)(ii,2),Wt=Jt[0],Ft=Jt[1],ri=Object(S.useState)("office"),Zt=Object(j.a)(ri,2),li=Zt[0],Kt=Zt[1],ni=function(){var nt=new $t(Dt.current);nt.displayMode="popup",nt.addRenderEventListener(function(){var vt=Object(C.a)(O.a.mark(function lt(_t){var pt;return O.a.wrap(function(bt){for(;;)switch(bt.prev=bt.next){case 0:return gt.current.style.display="none",bt.next=3,Object(oe.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:_t}});case 3:pt=bt.sent,pt!=null&&pt.id&&ke(Dt.current.getAttribute("src").replace(K.a.API_SERVER,""),"/api/attachments/".concat(pt==null?void 0:pt.id,"?type=").concat(pt.content_type));case 5:case"end":return bt.stop()}},lt)}));return function(lt){return vt.apply(this,arguments)}}()),nt.show()},ui=function(){var nt=new rt(Dt.current);nt.settings.displayMode="popup",nt.addEventListener("render",function(){var vt=Object(C.a)(O.a.mark(function lt(_t){var pt;return O.a.wrap(function(bt){for(;;)switch(bt.prev=bt.next){case 0:if(gt.current.style.display="none",!Dt.current){bt.next=6;break}return bt.next=4,Object(oe.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:_t.dataUrl}});case 4:pt=bt.sent,pt!=null&&pt.id&&ke(Dt.current.getAttribute("src").replace(K.a.API_SERVER,""),"/api/attachments/".concat(pt==null?void 0:pt.id,"?type=").concat(pt.content_type));case 6:case"end":return bt.stop()}},lt)}));return function(lt){return vt.apply(this,arguments)}}()),nt.show(),window.markerArea=nt},Gt=Object(S.useMemo)(function(){gt.current&&(gt.current.style.zIndex=-1);try{var mt=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,nt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,vt=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Nt=Nt.replace(mt,"("+K.a.API_SERVER+"/api/attachments/").replace(nt,'"'+K.a.API_SERVER+"/api/attachments/").replace(vt,'"'+K.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(qt){}var lt=N(Nt),_t=p();if(Nt.match(/\[TOC\]/)&&(lt=lt.replace("<p>[TOC]</p>",y()),x()),lt=lt.replace(/(__special_katext_id_\d+__)/g,function(qt,bt){var si=_t[bt],ei=si.type,Yt=si.expression;return Object(X.renderToString)(Ht(Yt)||"",{displayMode:ei==="block",throwOnError:!1,output:"html"})}),lt=lt.replace(/▁/g,"\u2581\u2581\u2581"),f(),ie){var pt=document.createElement("div");return pt.innerHTML=lt,pt.innerText}return setTimeout(function(){return ai()},500),lt},[Nt]),Pt=Object(S.useRef)();E.WebkitLineClamp=xe,xe&&(Ze=Object(L.a)(Object(L.a)({},Ze),E));function zt(mt){var nt=mt.target;if(nt.tagName.toUpperCase()==="IMG"){if(Ye){var vt=nt.getAttribute("src");Ft(vt),Kt("image")}}else if(nt.tagName.toUpperCase()==="A"){var lt=nt.getAttribute("href");if(lt.indexOf("office")>-1)mt.preventDefault(),Ft(lt),Kt("office");else if(lt.indexOf("application/pdf")>-1)mt.preventDefault(),Ft(lt),Kt("pdf");else if(lt.indexOf("text/html")>-1)mt.preventDefault(),Ft(lt),Kt("html");else if(lt.startsWith("#")){mt.preventDefault();var _t=document.getElementById(lt.replace("#",""));_t&&_t.scrollIntoView(!0)}}}var ai=function(){var nt,vt=(nt=Pt.current)===null||nt===void 0?void 0:nt.querySelectorAll("video");vt==null||vt.forEach(function(lt){if(lt.oncontextmenu=function(){return!1},lt.src.indexOf(".m3u8")>-1&&!lt.canPlayType("application/vnd.apple.mpegurl")){if(F.a.isSupported()){var _t=new F.a;_t.loadSource(lt.src),_t.attachMedia(lt)}}})};Object(S.useEffect)(function(){if(Pt.current&&Gt&&(Gt.match(Bt)&&window.PR.prettyPrint()),Pt.current)return Pt.current.addEventListener("click",zt),function(){Pt.current.removeEventListener("click",zt),f(),x()}},[Gt,Pt.current,zt]);var Vt=function(nt){if(!G)return;nt.target.nodeName==="IMG"?(gt.current.style.zIndex=1,gt.current.style.display="flex",gt.current.style.width=nt.target.clientWidth+"px",gt.current.style.height=nt.target.clientHeight+"px",gt.current.style.top=nt.target.offsetTop+"px",gt.current.style.left=nt.target.offsetLeft+"px",Dt.current.src=nt.target.getAttribute("src")):gt.current.style.display="none"};return _.a.createElement("div",{style:{position:"relative"}},_.a.createElement("div",{ref:Pt,style:Object(L.a)({},Ze),className:"".concat(k||""," markdown-body ").concat(Lt.a.mdBody),onMouseOver:Vt,dangerouslySetInnerHTML:{__html:Gt}}),_.a.createElement("div",{ref:gt,className:Lt.a.button},_.a.createElement(W.a,null,_.a.createElement(H.a,{onClick:function(){return ni()}},"\u88C1\u526A"),_.a.createElement(H.a,{onClick:function(){return ui()}},"\u7F16\u8F91"))),_.a.createElement("img",{ref:Dt,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),_.a.createElement(ee.a,{close:!0,data:Wt,type:Wt!=null&&Wt.length?li:"",style:Object(L.a)({},St),onClose:function(){return Ft("")}}))}},BU3w:function(Ge,Ee,z){"use strict";z.d(Ee,"a",function(){return C});var re=z("MNnm"),W="rc-util-key";function I(j){if(j.attachTo)return j.attachTo;var U=document.querySelector("head");return U||document.body}function H(j){var U,O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(re.a)())return null;var S=document.createElement("style");if((U=O.csp)===null||U===void 0?void 0:U.nonce){var _;S.nonce=(_=O.csp)===null||_===void 0?void 0:_.nonce}S.innerHTML=j;var b=I(O),h=b.firstChild;return O.prepend&&b.prepend?b.prepend(S):O.prepend&&h?b.insertBefore(S,h):b.appendChild(S),S}var L=new Map;function C(j,U){var O=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},S=I(O);if(!L.has(S)){var _=H("",O),b=_.parentNode;L.set(S,b),b.removeChild(_)}var h=Array.from(L.get(S).children).find(function(e){return e.tagName==="STYLE"&&e[W]===U});if(h){var l,r;if(((l=O.csp)===null||l===void 0?void 0:l.nonce)&&h.nonce!==((r=O.csp)===null||r===void 0?void 0:r.nonce)){var s;h.nonce=(s=O.csp)===null||s===void 0?void 0:s.nonce}return h.innerHTML!==j&&(h.innerHTML=j),h}var a=H(j,O);return a[W]=U,a}},DlQD:function(Ge,Ee,z){(function(re,W){Ge.exports=W()})(this,function(){"use strict";function re(Z,Q){for(var $=0;$<Q.length;$++){var V=Q[$];V.enumerable=V.enumerable||!1,V.configurable=!0,"value"in V&&(V.writable=!0),Object.defineProperty(Z,V.key,V)}}function W(Z,Q,$){return Q&&re(Z.prototype,Q),$&&re(Z,$),Z}function I(Z,Q){if(!Z)return;if(typeof Z=="string")return H(Z,Q);var $=Object.prototype.toString.call(Z).slice(8,-1);if($==="Object"&&Z.constructor&&($=Z.constructor.name),$==="Map"||$==="Set")return Array.from(Z);if($==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test($))return H(Z,Q)}function H(Z,Q){(Q==null||Q>Z.length)&&(Q=Z.length);for(var $=0,V=new Array(Q);$<Q;$++)V[$]=Z[$];return V}function L(Z,Q){var $;if(typeof Symbol=="undefined"||Z[Symbol.iterator]==null){if(Array.isArray(Z)||($=I(Z))||Q&&Z&&typeof Z.length=="number"){$&&(Z=$);var V=0;return function(){return V>=Z.length?{done:!0}:{done:!1,value:Z[V++]}}}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 $=Z[Symbol.iterator](),$.next.bind($)}function C(Z,Q){return Q={exports:{}},Z(Q,Q.exports),Q.exports}var j=C(function(Z){function Q(){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 $(V){Z.exports.defaults=V}Z.exports={defaults:Q(),getDefaults:Q,changeDefaults:$}}),U=j.defaults,O=j.getDefaults,S=j.changeDefaults,_=/[&<>"']/,b=/[&<>"']/g,h=/[<>"']|&(?!#?\w+;)/,l=/[<>"']|&(?!#?\w+;)/g,r={"&":"&","<":"<",">":">",'"':""","'":"'"},s=function(Q){return r[Q]};function a(Z,Q){if(Q){if(_.test(Z))return Z.replace(b,s)}else if(h.test(Z))return Z.replace(l,s);return Z}var e=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function t(Z){return Z.replace(e,function(Q,$){return $=$.toLowerCase(),$==="colon"?":":$.charAt(0)==="#"?$.charAt(1)==="x"?String.fromCharCode(parseInt($.substring(2),16)):String.fromCharCode(+$.substring(1)):""})}var n=/(^|[^\[])\^/g;function x(Z,Q){Z=Z.source||Z,Q=Q||"";var $={replace:function(Y,J){return J=J.source||J,J=J.replace(n,"$1"),Z=Z.replace(Y,J),$},getRegex:function(){return new RegExp(Z,Q)}};return $}var E=/[^\w:]/g,g=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function y(Z,Q,$){if(Z){var V;try{V=decodeURIComponent(t($)).replace(E,"").toLowerCase()}catch(Y){return null}if(V.indexOf("javascript:")===0||V.indexOf("vbscript:")===0||V.indexOf("data:")===0)return null}Q&&!g.test($)&&($=o(Q,$));try{$=encodeURI($).replace(/%25/g,"%")}catch(Y){return null}return $}var v={},d=/^[^:]+:\/*[^/]*$/,u=/^([^:]+:)[\s\S]*$/,i=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(Z,Q){v[" "+Z]||(d.test(Z)?v[" "+Z]=Z+"/":v[" "+Z]=w(Z,"/",!0)),Z=v[" "+Z];var $=Z.indexOf(":")===-1;return Q.substring(0,2)==="//"?$?Q:Z.replace(u,"$1")+Q:Q.charAt(0)==="/"?$?Q:Z.replace(i,"$1")+Q:Z+Q}var p={exec:function(){}};function f(Z){for(var Q=1,$,V;Q<arguments.length;Q++){$=arguments[Q];for(V in $)Object.prototype.hasOwnProperty.call($,V)&&(Z[V]=$[V])}return Z}function c(Z,Q){var $=Z.replace(/\|/g,function(J,q,ae){for(var he=!1,we=q;--we>=0&&ae[we]==="\\";)he=!he;return he?"|":" |"}),V=$.split(/ \|/),Y=0;if(V.length>Q)V.splice(Q);else for(;V.length<Q;)V.push("");for(;Y<V.length;Y++)V[Y]=V[Y].trim().replace(/\\\|/g,"|");return V}function w(Z,Q,$){var V=Z.length;if(V===0)return"";for(var Y=0;Y<V;){var J=Z.charAt(V-Y-1);if(J===Q&&!$)Y++;else if(J!==Q&&$)Y++;else break}return Z.substr(0,V-Y)}function A(Z,Q){if(Z.indexOf(Q[1])===-1)return-1;for(var $=Z.length,V=0,Y=0;Y<$;Y++)if(Z[Y]==="\\")Y++;else if(Z[Y]===Q[0])V++;else if(Z[Y]===Q[1]&&(V--,V<0))return Y;return-1}function P(Z){Z&&Z.sanitize&&!Z.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 N={escape:a,unescape:t,edit:x,cleanUrl:y,resolveUrl:o,noopTest:p,merge:f,splitCells:c,rtrim:w,findClosingBracket:A,checkSanitizeDeprecation:P},B=j.defaults,R=N.rtrim,F=N.splitCells,K=N.escape,X=N.findClosingBracket;function ee(Z,Q,$){var V=Q.href,Y=Q.title?K(Q.title):null,J=Z[1].replace(/\\([\[\]])/g,"$1");return Z[0].charAt(0)!=="!"?{type:"link",raw:$,href:V,title:Y,text:J}:{type:"image",raw:$,href:V,title:Y,text:K(J)}}function oe(Z,Q){var $=Z.match(/^(\s+)(?:```)/);if($===null)return Q;var V=$[1];return Q.split(`
|
|
`).map(function(Y){var J=Y.match(/^\s+/);if(J===null)return Y;var q=J[0];return q.length>=V.length?Y.slice(V.length):Y}).join(`
|
|
`)}var ce=function(){function Z($){this.options=$||B}var Q=Z.prototype;return Q.space=function(V){var Y=this.rules.block.newline.exec(V);if(Y)return Y[0].length>1?{type:"space",raw:Y[0]}:{raw:`
|
|
`}},Q.code=function(V,Y){var J=this.rules.block.code.exec(V);if(J){var q=Y[Y.length-1];if(q&&q.type==="paragraph")return{raw:J[0],text:J[0].trimRight()};var ae=J[0].replace(/^ {4}/gm,"");return{type:"code",raw:J[0],codeBlockStyle:"indented",text:this.options.pedantic?ae:R(ae,`
|
|
`)}}},Q.fences=function(V){var Y=this.rules.block.fences.exec(V);if(Y){var J=Y[0],q=oe(J,Y[3]||"");return{type:"code",raw:J,lang:Y[2]?Y[2].trim():Y[2],text:q}}},Q.heading=function(V){var Y=this.rules.block.heading.exec(V);if(Y)return{type:"heading",raw:Y[0],depth:Y[1].length,text:Y[2]}},Q.nptable=function(V){var Y=this.rules.block.nptable.exec(V);if(Y){var J={type:"table",header:F(Y[1].replace(/^ *| *\| *$/g,"")),align:Y[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Y[3]?Y[3].replace(/\n$/,"").split(`
|
|
`):[],raw:Y[0]};if(J.header.length===J.align.length){var q=J.align.length,ae;for(ae=0;ae<q;ae++)/^ *-+: *$/.test(J.align[ae])?J.align[ae]="right":/^ *:-+: *$/.test(J.align[ae])?J.align[ae]="center":/^ *:-+ *$/.test(J.align[ae])?J.align[ae]="left":J.align[ae]=null;for(q=J.cells.length,ae=0;ae<q;ae++)J.cells[ae]=F(J.cells[ae],J.header.length);return J}}},Q.hr=function(V){var Y=this.rules.block.hr.exec(V);if(Y)return{type:"hr",raw:Y[0]}},Q.blockquote=function(V){var Y=this.rules.block.blockquote.exec(V);if(Y){var J=Y[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:Y[0],text:J}}},Q.list=function(V){var Y=this.rules.block.list.exec(V);if(Y){for(var J=Y[0],q=Y[2],ae=q.length>1,he=q[q.length-1]===")",we={type:"list",raw:J,ordered:ae,start:ae?+q.slice(0,-1):"",loose:!1,items:[]},Ue=Y[0].match(this.rules.block.item),Ke=!1,Pe,et,$e,He,at,rt,it,ht=Ue.length,qe=0;qe<ht;qe++)Pe=Ue[qe],J=Pe,et=Pe.length,Pe=Pe.replace(/^ *([*+-]|\d+[.)]) */,""),~Pe.indexOf(`
|
|
`)&&(et-=Pe.length,Pe=this.options.pedantic?Pe.replace(/^ {1,4}/gm,""):Pe.replace(new RegExp("^ {1,"+et+"}","gm"),"")),qe!==ht-1&&($e=this.rules.block.bullet.exec(Ue[qe+1])[0],(ae?$e.length===1||!he&&$e[$e.length-1]===")":$e.length>1||this.options.smartLists&&$e!==q)&&(He=Ue.slice(qe+1).join(`
|
|
`),we.raw=we.raw.substring(0,we.raw.length-He.length),qe=ht-1)),at=Ke||/\n\n(?!\s*$)/.test(Pe),qe!==ht-1&&(Ke=Pe.charAt(Pe.length-1)===`
|
|
`,at||(at=Ke)),at&&(we.loose=!0),rt=/^\[[ xX]\] /.test(Pe),it=void 0,rt&&(it=Pe[1]!==" ",Pe=Pe.replace(/^\[[ xX]\] +/,"")),we.items.push({type:"list_item",raw:J,task:rt,checked:it,loose:at,text:Pe});return we}},Q.html=function(V){var Y=this.rules.block.html.exec(V);if(Y)return{type:this.options.sanitize?"paragraph":"html",raw:Y[0],pre:!this.options.sanitizer&&(Y[1]==="pre"||Y[1]==="script"||Y[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Y[0]):K(Y[0]):Y[0]}},Q.def=function(V){var Y=this.rules.block.def.exec(V);if(Y){Y[3]&&(Y[3]=Y[3].substring(1,Y[3].length-1));var J=Y[1].toLowerCase().replace(/\s+/g," ");return{tag:J,raw:Y[0],href:Y[2],title:Y[3]}}},Q.table=function(V){var Y=this.rules.block.table.exec(V);if(Y){var J={type:"table",header:F(Y[1].replace(/^ *| *\| *$/g,"")),align:Y[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Y[3]?Y[3].replace(/\n$/,"").split(`
|
|
`):[]};if(J.header.length===J.align.length){J.raw=Y[0];var q=J.align.length,ae;for(ae=0;ae<q;ae++)/^ *-+: *$/.test(J.align[ae])?J.align[ae]="right":/^ *:-+: *$/.test(J.align[ae])?J.align[ae]="center":/^ *:-+ *$/.test(J.align[ae])?J.align[ae]="left":J.align[ae]=null;for(q=J.cells.length,ae=0;ae<q;ae++)J.cells[ae]=F(J.cells[ae].replace(/^ *\| *| *\| *$/g,""),J.header.length);return J}}},Q.lheading=function(V){var Y=this.rules.block.lheading.exec(V);if(Y)return{type:"heading",raw:Y[0],depth:Y[2].charAt(0)==="="?1:2,text:Y[1]}},Q.paragraph=function(V){var Y=this.rules.block.paragraph.exec(V);if(Y)return{type:"paragraph",raw:Y[0],text:Y[1].charAt(Y[1].length-1)===`
|
|
`?Y[1].slice(0,-1):Y[1]}},Q.text=function(V,Y){var J=this.rules.block.text.exec(V);if(J){var q=Y[Y.length-1];return q&&q.type==="text"?{raw:J[0],text:J[0]}:{type:"text",raw:J[0],text:J[0]}}},Q.escape=function(V){var Y=this.rules.inline.escape.exec(V);if(Y)return{type:"escape",raw:Y[0],text:K(Y[1])}},Q.tag=function(V,Y,J){var q=this.rules.inline.tag.exec(V);if(q)return!Y&&/^<a /i.test(q[0])?Y=!0:Y&&/^<\/a>/i.test(q[0])&&(Y=!1),!J&&/^<(pre|code|kbd|script)(\s|>)/i.test(q[0])?J=!0:J&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(q[0])&&(J=!1),{type:this.options.sanitize?"text":"html",raw:q[0],inLink:Y,inRawBlock:J,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(q[0]):K(q[0]):q[0]}},Q.link=function(V){var Y=this.rules.inline.link.exec(V);if(Y){var J=X(Y[2],"()");if(J>-1){var q=Y[0].indexOf("!")===0?5:4,ae=q+Y[1].length+J;Y[2]=Y[2].substring(0,J),Y[0]=Y[0].substring(0,ae).trim(),Y[3]=""}var he=Y[2],we="";if(this.options.pedantic){var Ue=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(he);Ue?(he=Ue[1],we=Ue[3]):we=""}else we=Y[3]?Y[3].slice(1,-1):"";he=he.trim().replace(/^<([\s\S]*)>$/,"$1");var Ke=ee(Y,{href:he&&he.replace(this.rules.inline._escapes,"$1"),title:we&&we.replace(this.rules.inline._escapes,"$1")},Y[0]);return Ke}},Q.reflink=function(V,Y){var J;if((J=this.rules.inline.reflink.exec(V))||(J=this.rules.inline.nolink.exec(V))){var q=(J[2]||J[1]).replace(/\s+/g," ");if(q=Y[q.toLowerCase()],!q||!q.href){var ae=J[0].charAt(0);return{type:"text",raw:ae,text:ae}}var he=ee(J,q,J[0]);return he}},Q.strong=function(V,Y,J){J===void 0&&(J="");var q=this.rules.inline.strong.start.exec(V);if(q&&(!q[1]||q[1]&&(J===""||this.rules.inline.punctuation.exec(J)))){Y=Y.slice(-1*V.length);var ae=q[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ae.lastIndex=0;for(var he;(q=ae.exec(Y))!=null;)if(he=this.rules.inline.strong.middle.exec(Y.slice(0,q.index+3)),he)return{type:"strong",raw:V.slice(0,he[0].length),text:V.slice(2,he[0].length-2)}}},Q.em=function(V,Y,J){J===void 0&&(J="");var q=this.rules.inline.em.start.exec(V);if(q&&(!q[1]||q[1]&&(J===""||this.rules.inline.punctuation.exec(J)))){Y=Y.slice(-1*V.length);var ae=q[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ae.lastIndex=0;for(var he;(q=ae.exec(Y))!=null;)if(he=this.rules.inline.em.middle.exec(Y.slice(0,q.index+2)),he)return{type:"em",raw:V.slice(0,he[0].length),text:V.slice(1,he[0].length-1)}}},Q.codespan=function(V){var Y=this.rules.inline.code.exec(V);if(Y){var J=Y[2].replace(/\n/g," "),q=/[^ ]/.test(J),ae=J.startsWith(" ")&&J.endsWith(" ");return q&&ae&&(J=J.substring(1,J.length-1)),J=K(J,!0),{type:"codespan",raw:Y[0],text:J}}},Q.br=function(V){var Y=this.rules.inline.br.exec(V);if(Y)return{type:"br",raw:Y[0]}},Q.del=function(V){var Y=this.rules.inline.del.exec(V);if(Y)return{type:"del",raw:Y[0],text:Y[1]}},Q.autolink=function(V,Y){var J=this.rules.inline.autolink.exec(V);if(J){var q,ae;return J[2]==="@"?(q=K(this.options.mangle?Y(J[1]):J[1]),ae="mailto:"+q):(q=K(J[1]),ae=q),{type:"link",raw:J[0],text:q,href:ae,tokens:[{type:"text",raw:q,text:q}]}}},Q.url=function(V,Y){var J;if(J=this.rules.inline.url.exec(V)){var q,ae;if(J[2]==="@")q=K(this.options.mangle?Y(J[0]):J[0]),ae="mailto:"+q;else{var he;do he=J[0],J[0]=this.rules.inline._backpedal.exec(J[0])[0];while(he!==J[0]);q=K(J[0]),J[1]==="www."?ae="http://"+q:ae=q}return{type:"link",raw:J[0],text:q,href:ae,tokens:[{type:"text",raw:q,text:q}]}}},Q.inlineText=function(V,Y,J){var q=this.rules.inline.text.exec(V);if(q){var ae;return Y?ae=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(q[0]):K(q[0]):q[0]:ae=K(this.options.smartypants?J(q[0]):q[0]),{type:"text",raw:q[0],text:ae}}},Z}(),le=N.noopTest,be=N.edit,pe=N.merge,de={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:le,table:le,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};de._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,de._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,de.def=be(de.def).replace("label",de._label).replace("title",de._title).getRegex(),de.bullet=/(?:[*+-]|\d{1,9}[.)])/,de.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,de.item=be(de.item,"gm").replace(/bull/g,de.bullet).getRegex(),de.list=be(de.list).replace(/bull/g,de.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+de.def.source+")").getRegex(),de._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",de._comment=/<!--(?!-?>)[\s\S]*?-->/,de.html=be(de.html,"i").replace("comment",de._comment).replace("tag",de._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),de.paragraph=be(de._paragraph).replace("hr",de.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",de._tag).getRegex(),de.blockquote=be(de.blockquote).replace("paragraph",de.paragraph).getRegex(),de.normal=pe({},de),de.gfm=pe({},de.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*|$)"}),de.gfm.nptable=be(de.gfm.nptable).replace("hr",de.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",de._tag).getRegex(),de.gfm.table=be(de.gfm.table).replace("hr",de.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",de._tag).getRegex(),de.pedantic=pe({},de.normal,{html:be(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",de._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:le,paragraph:be(de.normal._paragraph).replace("hr",de.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",de.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var te={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:le,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:le,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};te._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",te.punctuation=be(te.punctuation).replace(/punctuation/g,te._punctuation).getRegex(),te._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",te._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",te.em.start=be(te.em.start).replace(/punctuation/g,te._punctuation).getRegex(),te.em.middle=be(te.em.middle).replace(/punctuation/g,te._punctuation).replace(/overlapSkip/g,te._overlapSkip).getRegex(),te.em.endAst=be(te.em.endAst,"g").replace(/punctuation/g,te._punctuation).getRegex(),te.em.endUnd=be(te.em.endUnd,"g").replace(/punctuation/g,te._punctuation).getRegex(),te.strong.start=be(te.strong.start).replace(/punctuation/g,te._punctuation).getRegex(),te.strong.middle=be(te.strong.middle).replace(/punctuation/g,te._punctuation).replace(/blockSkip/g,te._blockSkip).getRegex(),te.strong.endAst=be(te.strong.endAst,"g").replace(/punctuation/g,te._punctuation).getRegex(),te.strong.endUnd=be(te.strong.endUnd,"g").replace(/punctuation/g,te._punctuation).getRegex(),te.blockSkip=be(te._blockSkip,"g").getRegex(),te.overlapSkip=be(te._overlapSkip,"g").getRegex(),te._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,te._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,te._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])?)+(?![-_])/,te.autolink=be(te.autolink).replace("scheme",te._scheme).replace("email",te._email).getRegex(),te._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,te.tag=be(te.tag).replace("comment",de._comment).replace("attribute",te._attribute).getRegex(),te._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,te._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,te._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,te.link=be(te.link).replace("label",te._label).replace("href",te._href).replace("title",te._title).getRegex(),te.reflink=be(te.reflink).replace("label",te._label).getRegex(),te.reflinkSearch=be(te.reflinkSearch,"g").replace("reflink",te.reflink).replace("nolink",te.nolink).getRegex(),te.normal=pe({},te),te.pedantic=pe({},te.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:be(/^!?\[(label)\]\((.*?)\)/).replace("label",te._label).getRegex(),reflink:be(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",te._label).getRegex()}),te.gfm=pe({},te.normal,{escape:be(te.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),te.gfm.url=be(te.gfm.url,"i").replace("email",te.gfm._extended_email).getRegex(),te.breaks=pe({},te.gfm,{br:be(te.br).replace("{2,}","*").getRegex(),text:be(te.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Le={block:de,inline:te},Ve=j.defaults,Ne=Le.block,Be=Le.inline;function ve(Z){return Z.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 ye(Z){var Q="",$,V,Y=Z.length;for($=0;$<Y;$++)V=Z.charCodeAt($),Math.random()>.5&&(V="x"+V.toString(16)),Q+="&#"+V+";";return Q}var Ie=function(){function Z($){this.tokens=[],this.tokens.links=Object.create(null),this.options=$||Ve,this.options.tokenizer=this.options.tokenizer||new ce,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var V={block:Ne.normal,inline:Be.normal};this.options.pedantic?(V.block=Ne.pedantic,V.inline=Be.pedantic):this.options.gfm&&(V.block=Ne.gfm,this.options.breaks?V.inline=Be.breaks:V.inline=Be.gfm),this.tokenizer.rules=V}Z.lex=function(V,Y){var J=new Z(Y);return J.lex(V)};var Q=Z.prototype;return Q.lex=function(V){return V=V.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(V,this.tokens,!0),this.inline(this.tokens),this.tokens},Q.blockTokens=function(V,Y,J){Y===void 0&&(Y=[]),J===void 0&&(J=!0),V=V.replace(/^ +$/gm,"");for(var q,ae,he,we;V;){if(q=this.tokenizer.space(V)){V=V.substring(q.raw.length),q.type&&Y.push(q);continue}if(q=this.tokenizer.code(V,Y)){V=V.substring(q.raw.length),q.type?Y.push(q):(we=Y[Y.length-1],we.raw+=`
|
|
`+q.raw,we.text+=`
|
|
`+q.text);continue}if(q=this.tokenizer.fences(V)){V=V.substring(q.raw.length),Y.push(q);continue}if(q=this.tokenizer.heading(V)){V=V.substring(q.raw.length),Y.push(q);continue}if(q=this.tokenizer.nptable(V)){V=V.substring(q.raw.length),Y.push(q);continue}if(q=this.tokenizer.hr(V)){V=V.substring(q.raw.length),Y.push(q);continue}if(q=this.tokenizer.blockquote(V)){V=V.substring(q.raw.length),q.tokens=this.blockTokens(q.text,[],J),Y.push(q);continue}if(q=this.tokenizer.list(V)){for(V=V.substring(q.raw.length),he=q.items.length,ae=0;ae<he;ae++)q.items[ae].tokens=this.blockTokens(q.items[ae].text,[],!1);Y.push(q);continue}if(q=this.tokenizer.html(V)){V=V.substring(q.raw.length),Y.push(q);continue}if(J&&(q=this.tokenizer.def(V))){V=V.substring(q.raw.length),this.tokens.links[q.tag]||(this.tokens.links[q.tag]={href:q.href,title:q.title});continue}if(q=this.tokenizer.table(V)){V=V.substring(q.raw.length),Y.push(q);continue}if(q=this.tokenizer.lheading(V)){V=V.substring(q.raw.length),Y.push(q);continue}if(J&&(q=this.tokenizer.paragraph(V))){V=V.substring(q.raw.length),Y.push(q);continue}if(q=this.tokenizer.text(V,Y)){V=V.substring(q.raw.length),q.type?Y.push(q):(we=Y[Y.length-1],we.raw+=`
|
|
`+q.raw,we.text+=`
|
|
`+q.text);continue}if(V){var Ue="Infinite loop on byte: "+V.charCodeAt(0);if(this.options.silent){console.error(Ue);break}else throw new Error(Ue)}}return Y},Q.inline=function(V){var Y,J,q,ae,he,we,Ue=V.length;for(Y=0;Y<Ue;Y++){we=V[Y];switch(we.type){case"paragraph":case"text":case"heading":{we.tokens=[],this.inlineTokens(we.text,we.tokens);break}case"table":{for(we.tokens={header:[],cells:[]},ae=we.header.length,J=0;J<ae;J++)we.tokens.header[J]=[],this.inlineTokens(we.header[J],we.tokens.header[J]);for(ae=we.cells.length,J=0;J<ae;J++)for(he=we.cells[J],we.tokens.cells[J]=[],q=0;q<he.length;q++)we.tokens.cells[J][q]=[],this.inlineTokens(he[q],we.tokens.cells[J][q]);break}case"blockquote":{this.inline(we.tokens);break}case"list":{for(ae=we.items.length,J=0;J<ae;J++)this.inline(we.items[J].tokens);break}}}return V},Q.inlineTokens=function(V,Y,J,q,ae){Y===void 0&&(Y=[]),J===void 0&&(J=!1),q===void 0&&(q=!1),ae===void 0&&(ae="");var he,we=V,Ue;if(this.tokens.links){var Ke=Object.keys(this.tokens.links);if(Ke.length>0)for(;(Ue=this.tokenizer.rules.inline.reflinkSearch.exec(we))!=null;)Ke.includes(Ue[0].slice(Ue[0].lastIndexOf("[")+1,-1))&&(we=we.slice(0,Ue.index)+"["+"a".repeat(Ue[0].length-2)+"]"+we.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Ue=this.tokenizer.rules.inline.blockSkip.exec(we))!=null;)we=we.slice(0,Ue.index)+"["+"a".repeat(Ue[0].length-2)+"]"+we.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;V;){if(he=this.tokenizer.escape(V)){V=V.substring(he.raw.length),Y.push(he);continue}if(he=this.tokenizer.tag(V,J,q)){V=V.substring(he.raw.length),J=he.inLink,q=he.inRawBlock,Y.push(he);continue}if(he=this.tokenizer.link(V)){V=V.substring(he.raw.length),he.type==="link"&&(he.tokens=this.inlineTokens(he.text,[],!0,q)),Y.push(he);continue}if(he=this.tokenizer.reflink(V,this.tokens.links)){V=V.substring(he.raw.length),he.type==="link"&&(he.tokens=this.inlineTokens(he.text,[],!0,q)),Y.push(he);continue}if(he=this.tokenizer.strong(V,we,ae)){V=V.substring(he.raw.length),he.tokens=this.inlineTokens(he.text,[],J,q),Y.push(he);continue}if(he=this.tokenizer.em(V,we,ae)){V=V.substring(he.raw.length),he.tokens=this.inlineTokens(he.text,[],J,q),Y.push(he);continue}if(he=this.tokenizer.codespan(V)){V=V.substring(he.raw.length),Y.push(he);continue}if(he=this.tokenizer.br(V)){V=V.substring(he.raw.length),Y.push(he);continue}if(he=this.tokenizer.del(V)){V=V.substring(he.raw.length),he.tokens=this.inlineTokens(he.text,[],J,q),Y.push(he);continue}if(he=this.tokenizer.autolink(V,ye)){V=V.substring(he.raw.length),Y.push(he);continue}if(!J&&(he=this.tokenizer.url(V,ye))){V=V.substring(he.raw.length),Y.push(he);continue}if(he=this.tokenizer.inlineText(V,q,ve)){V=V.substring(he.raw.length),ae=he.raw.slice(-1),Y.push(he);continue}if(V){var Pe="Infinite loop on byte: "+V.charCodeAt(0);if(this.options.silent){console.error(Pe);break}else throw new Error(Pe)}}return Y},W(Z,null,[{key:"rules",get:function(){return{block:Ne,inline:Be}}}]),Z}(),Ae=j.defaults,ge=N.cleanUrl,Ce=N.escape,Oe=function(){function Z($){this.options=$||Ae}var Q=Z.prototype;return Q.code=function(V,Y,J){var q=(Y||"").match(/\S*/)[0];if(this.options.highlight){var ae=this.options.highlight(V,q);ae!=null&&ae!==V&&(J=!0,V=ae)}return q?'<pre><code class="'+this.options.langPrefix+Ce(q,!0)+'">'+(J?V:Ce(V,!0))+`</code></pre>
|
|
`:"<pre><code>"+(J?V:Ce(V,!0))+`</code></pre>
|
|
`},Q.blockquote=function(V){return`<blockquote>
|
|
`+V+`</blockquote>
|
|
`},Q.html=function(V){return V},Q.heading=function(V,Y,J,q){return this.options.headerIds?"<h"+Y+' id="'+this.options.headerPrefix+q.slug(J)+'">'+V+"</h"+Y+`>
|
|
`:"<h"+Y+">"+V+"</h"+Y+`>
|
|
`},Q.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},Q.list=function(V,Y,J){var q=Y?"ol":"ul",ae=Y&&J!==1?' start="'+J+'"':"";return"<"+q+ae+`>
|
|
`+V+"</"+q+`>
|
|
`},Q.listitem=function(V){return"<li>"+V+`</li>
|
|
`},Q.checkbox=function(V){return"<input "+(V?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},Q.paragraph=function(V){return"<p>"+V+`</p>
|
|
`},Q.table=function(V,Y){return Y&&(Y="<tbody>"+Y+"</tbody>"),`<table>
|
|
<thead>
|
|
`+V+`</thead>
|
|
`+Y+`</table>
|
|
`},Q.tablerow=function(V){return`<tr>
|
|
`+V+`</tr>
|
|
`},Q.tablecell=function(V,Y){var J=Y.header?"th":"td",q=Y.align?"<"+J+' align="'+Y.align+'">':"<"+J+">";return q+V+"</"+J+`>
|
|
`},Q.strong=function(V){return"<strong>"+V+"</strong>"},Q.em=function(V){return"<em>"+V+"</em>"},Q.codespan=function(V){return"<code>"+V+"</code>"},Q.br=function(){return this.options.xhtml?"<br/>":"<br>"},Q.del=function(V){return"<del>"+V+"</del>"},Q.link=function(V,Y,J){if(V=ge(this.options.sanitize,this.options.baseUrl,V),V===null)return J;var q='<a href="'+Ce(V)+'"';return Y&&(q+=' title="'+Y+'"'),q+=">"+J+"</a>",q},Q.image=function(V,Y,J){if(V=ge(this.options.sanitize,this.options.baseUrl,V),V===null)return J;var q='<img src="'+V+'" alt="'+J+'"';return Y&&(q+=' title="'+Y+'"'),q+=this.options.xhtml?"/>":">",q},Q.text=function(V){return V},Z}(),Se=function(){function Z(){}var Q=Z.prototype;return Q.strong=function(V){return V},Q.em=function(V){return V},Q.codespan=function(V){return V},Q.del=function(V){return V},Q.html=function(V){return V},Q.text=function(V){return V},Q.link=function(V,Y,J){return""+J},Q.image=function(V,Y,J){return""+J},Q.br=function(){return""},Z}(),De=function(){function Z(){this.seen={}}var Q=Z.prototype;return Q.slug=function(V){var Y=V.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(Y)){var J=Y;do this.seen[J]++,Y=J+"-"+this.seen[J];while(this.seen.hasOwnProperty(Y))}return this.seen[Y]=0,Y},Z}(),je=j.defaults,Me=N.unescape,Fe=function(){function Z($){this.options=$||je,this.options.renderer=this.options.renderer||new Oe,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Se,this.slugger=new De}Z.parse=function(V,Y){var J=new Z(Y);return J.parse(V)};var Q=Z.prototype;return Q.parse=function(V,Y){Y===void 0&&(Y=!0);var J="",q,ae,he,we,Ue,Ke,Pe,et,$e,He,at,rt,it,ht,qe,ot,dt,Te,Xe=V.length;for(q=0;q<Xe;q++){He=V[q];switch(He.type){case"space":continue;case"hr":{J+=this.renderer.hr();continue}case"heading":{J+=this.renderer.heading(this.parseInline(He.tokens),He.depth,Me(this.parseInline(He.tokens,this.textRenderer)),this.slugger);continue}case"code":{J+=this.renderer.code(He.text,He.lang,He.escaped);continue}case"table":{for(et="",Pe="",we=He.header.length,ae=0;ae<we;ae++)Pe+=this.renderer.tablecell(this.parseInline(He.tokens.header[ae]),{header:!0,align:He.align[ae]});for(et+=this.renderer.tablerow(Pe),$e="",we=He.cells.length,ae=0;ae<we;ae++){for(Ke=He.tokens.cells[ae],Pe="",Ue=Ke.length,he=0;he<Ue;he++)Pe+=this.renderer.tablecell(this.parseInline(Ke[he]),{header:!1,align:He.align[he]});$e+=this.renderer.tablerow(Pe)}J+=this.renderer.table(et,$e);continue}case"blockquote":{$e=this.parse(He.tokens),J+=this.renderer.blockquote($e);continue}case"list":{for(at=He.ordered,rt=He.start,it=He.loose,we=He.items.length,$e="",ae=0;ae<we;ae++)qe=He.items[ae],ot=qe.checked,dt=qe.task,ht="",qe.task&&(Te=this.renderer.checkbox(ot),it?qe.tokens.length>0&&qe.tokens[0].type==="text"?(qe.tokens[0].text=Te+" "+qe.tokens[0].text,qe.tokens[0].tokens&&qe.tokens[0].tokens.length>0&&qe.tokens[0].tokens[0].type==="text"&&(qe.tokens[0].tokens[0].text=Te+" "+qe.tokens[0].tokens[0].text)):qe.tokens.unshift({type:"text",text:Te}):ht+=Te),ht+=this.parse(qe.tokens,it),$e+=this.renderer.listitem(ht,dt,ot);J+=this.renderer.list($e,at,rt);continue}case"html":{J+=this.renderer.html(He.text);continue}case"paragraph":{J+=this.renderer.paragraph(this.parseInline(He.tokens));continue}case"text":{for($e=He.tokens?this.parseInline(He.tokens):He.text;q+1<Xe&&V[q+1].type==="text";)He=V[++q],$e+=`
|
|
`+(He.tokens?this.parseInline(He.tokens):He.text);J+=Y?this.renderer.paragraph($e):$e;continue}default:{var tt='Token with "'+He.type+'" type was not found.';if(this.options.silent){console.error(tt);return}else throw new Error(tt)}}}return J},Q.parseInline=function(V,Y){Y=Y||this.renderer;var J="",q,ae,he=V.length;for(q=0;q<he;q++){ae=V[q];switch(ae.type){case"escape":{J+=Y.text(ae.text);break}case"html":{J+=Y.html(ae.text);break}case"link":{J+=Y.link(ae.href,ae.title,this.parseInline(ae.tokens,Y));break}case"image":{J+=Y.image(ae.href,ae.title,ae.text);break}case"strong":{J+=Y.strong(this.parseInline(ae.tokens,Y));break}case"em":{J+=Y.em(this.parseInline(ae.tokens,Y));break}case"codespan":{J+=Y.codespan(ae.text);break}case"br":{J+=Y.br();break}case"del":{J+=Y.del(this.parseInline(ae.tokens,Y));break}case"text":{J+=Y.text(ae.text);break}default:{var we='Token with "'+ae.type+'" type was not found.';if(this.options.silent){console.error(we);return}else throw new Error(we)}}}return J},Z}(),We=N.merge,ze=N.checkSanitizeDeprecation,ne=N.escape,ue=j.getDefaults,me=j.changeDefaults,_e=j.defaults;function se(Z,Q,$){if(typeof Z=="undefined"||Z===null)throw new Error("marked(): input parameter is undefined or null");if(typeof Z!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(Z)+", string expected");if(typeof Q=="function"&&($=Q,Q=null),Q=We({},se.defaults,Q||{}),ze(Q),$){var V=Q.highlight,Y;try{Y=Ie.lex(Z,Q)}catch(he){return $(he)}var J=function(we){var Ue;if(!we)try{Ue=Fe.parse(Y,Q)}catch(Ke){we=Ke}return Q.highlight=V,we?$(we):$(null,Ue)};if(!V||V.length<3)return J();if(delete Q.highlight,!Y.length)return J();var q=0;se.walkTokens(Y,function(he){he.type==="code"&&(q++,setTimeout(function(){V(he.text,he.lang,function(we,Ue){if(we)return J(we);Ue!=null&&Ue!==he.text&&(he.text=Ue,he.escaped=!0),q--,q===0&&J()})},0))}),q===0&&J();return}try{var ae=Ie.lex(Z,Q);return Q.walkTokens&&se.walkTokens(ae,Q.walkTokens),Fe.parse(ae,Q)}catch(he){if(he.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,Q.silent)return"<p>An error occurred:</p><pre>"+ne(he.message+"",!0)+"</pre>";throw he}}se.options=se.setOptions=function(Z){return We(se.defaults,Z),me(se.defaults),se},se.getDefaults=ue,se.defaults=_e,se.use=function(Z){var Q=We({},Z);if(Z.renderer&&function(){var V=se.defaults.renderer||new Oe,Y=function(ae){var he=V[ae];V[ae]=function(){for(var we=arguments.length,Ue=new Array(we),Ke=0;Ke<we;Ke++)Ue[Ke]=arguments[Ke];var Pe=Z.renderer[ae].apply(V,Ue);return Pe===!1&&(Pe=he.apply(V,Ue)),Pe}};for(var J in Z.renderer)Y(J);Q.renderer=V}(),Z.tokenizer&&function(){var V=se.defaults.tokenizer||new ce,Y=function(ae){var he=V[ae];V[ae]=function(){for(var we=arguments.length,Ue=new Array(we),Ke=0;Ke<we;Ke++)Ue[Ke]=arguments[Ke];var Pe=Z.tokenizer[ae].apply(V,Ue);return Pe===!1&&(Pe=he.apply(V,Ue)),Pe}};for(var J in Z.tokenizer)Y(J);Q.tokenizer=V}(),Z.walkTokens){var $=se.defaults.walkTokens;Q.walkTokens=function(V){Z.walkTokens(V),$&&$(V)}}se.setOptions(Q)},se.walkTokens=function(Z,Q){for(var $=L(Z),V;!(V=$()).done;){var Y=V.value;Q(Y);switch(Y.type){case"table":{for(var J=L(Y.tokens.header),q;!(q=J()).done;){var ae=q.value;se.walkTokens(ae,Q)}for(var he=L(Y.tokens.cells),we;!(we=he()).done;)for(var Ue=we.value,Ke=L(Ue),Pe;!(Pe=Ke()).done;){var et=Pe.value;se.walkTokens(et,Q)}break}case"list":{se.walkTokens(Y.items,Q);break}default:Y.tokens&&se.walkTokens(Y.tokens,Q)}}},se.Parser=Fe,se.parser=Fe.parse,se.Renderer=Oe,se.TextRenderer=Se,se.Lexer=Ie,se.lexer=Ie.lex,se.Tokenizer=ce,se.Slugger=De,se.parse=se;var fe=se;return fe})},F0VM:function(Ge,Ee,z){Ge.exports={flex_box_center:"flex_box_center___2fDN3",flex_space_between:"flex_space_between___BHBBv",flex_box_vertical_center:"flex_box_vertical_center___tpxsE",flex_box_center_end:"flex_box_center_end___rP7bQ",flex_box_column:"flex_box_column___1_rF-",md:"md___3SObb",title:"title___HfZ1b"}},IBYe:function(Ge,Ee,z){"use strict";function re(W){return null}Ee.a=re},J66h:function(Ge,Ee,z){(function(re){var W,I;(function(H,L){Ge.exports=L(H)})(typeof self!="undefined"?self:typeof window!="undefined"?window:typeof re!="undefined"?re:this,function(H){"use strict";H=H||{};var L=H.Base64,C="2.6.4",j="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",U=function(c){for(var w={},A=0,P=c.length;A<P;A++)w[c.charAt(A)]=A;return w}(j),O=String.fromCharCode,S=function(c){if(c.length<2){var w=c.charCodeAt(0);return w<128?c:w<2048?O(192|w>>>6)+O(128|w&63):O(224|w>>>12&15)+O(128|w>>>6&63)+O(128|w&63)}else{var w=65536+(c.charCodeAt(0)-55296)*1024+(c.charCodeAt(1)-56320);return O(240|w>>>18&7)+O(128|w>>>12&63)+O(128|w>>>6&63)+O(128|w&63)}},_=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,b=function(c){return c.replace(_,S)},h=function(c){var w=[0,2,1][c.length%3],A=c.charCodeAt(0)<<16|(c.length>1?c.charCodeAt(1):0)<<8|(c.length>2?c.charCodeAt(2):0),P=[j.charAt(A>>>18),j.charAt(A>>>12&63),w>=2?"=":j.charAt(A>>>6&63),w>=1?"=":j.charAt(A&63)];return P.join("")},l=H.btoa&&typeof H.btoa=="function"?function(c){return H.btoa(c)}:function(c){if(c.match(/[^\x00-\xFF]/))throw new RangeError("The string contains invalid characters.");return c.replace(/[\s\S]{1,3}/g,h)},r=function(c){return l(b(String(c)))},s=function(c){return c.replace(/[+\/]/g,function(w){return w=="+"?"-":"_"}).replace(/=/g,"")},a=function(c,w){return w?s(r(c)):r(c)},e=function(c){return a(c,!0)},t;H.Uint8Array&&(t=function(c,w){for(var A="",P=0,N=c.length;P<N;P+=3){var B=c[P],R=c[P+1],F=c[P+2],K=B<<16|R<<8|F;A+=j.charAt(K>>>18)+j.charAt(K>>>12&63)+(typeof R!="undefined"?j.charAt(K>>>6&63):"=")+(typeof F!="undefined"?j.charAt(K&63):"=")}return w?s(A):A});var n=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,x=function(c){switch(c.length){case 4:var w=(7&c.charCodeAt(0))<<18|(63&c.charCodeAt(1))<<12|(63&c.charCodeAt(2))<<6|63&c.charCodeAt(3),A=w-65536;return O((A>>>10)+55296)+O((A&1023)+56320);case 3:return O((15&c.charCodeAt(0))<<12|(63&c.charCodeAt(1))<<6|63&c.charCodeAt(2));default:return O((31&c.charCodeAt(0))<<6|63&c.charCodeAt(1))}},E=function(c){return c.replace(n,x)},g=function(c){var w=c.length,A=w%4,P=(w>0?U[c.charAt(0)]<<18:0)|(w>1?U[c.charAt(1)]<<12:0)|(w>2?U[c.charAt(2)]<<6:0)|(w>3?U[c.charAt(3)]:0),N=[O(P>>>16),O(P>>>8&255),O(P&255)];return N.length-=[0,0,2,1][A],N.join("")},y=H.atob&&typeof H.atob=="function"?function(c){return H.atob(c)}:function(c){return c.replace(/\S{1,4}/g,g)},v=function(c){return y(String(c).replace(/[^A-Za-z0-9\+\/]/g,""))},d=function(c){return E(y(c))},u=function(c){return String(c).replace(/[-_]/g,function(w){return w=="-"?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,"")},i=function(c){return d(u(c))},o;H.Uint8Array&&(o=function(c){return Uint8Array.from(v(u(c)),function(w){return w.charCodeAt(0)})});var p=function(){var c=H.Base64;return H.Base64=L,c};if(H.Base64={VERSION:C,atob:v,btoa:l,fromBase64:i,toBase64:a,utob:b,encode:a,encodeURI:e,btou:E,decode:i,noConflict:p,fromUint8Array:t,toUint8Array:o},typeof Object.defineProperty=="function"){var f=function(c){return{value:c,enumerable:!1,writable:!0,configurable:!0}};H.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",f(function(){return i(this)})),Object.defineProperty(String.prototype,"toBase64",f(function(c){return a(this,c)})),Object.defineProperty(String.prototype,"toBase64URI",f(function(){return a(this,!0)}))}}return H.Meteor&&(Base64=H.Base64),Ge.exports?Ge.exports.Base64=H.Base64:!(W=[],I=function(){return H.Base64}.apply(Ee,W),I!==void 0&&(Ge.exports=I)),{Base64:H.Base64}})}).call(this,z("IyRk"))},LdHM:function(Ge,Ee,z){"use strict";z.d(Ee,"b",function(){return n}),z.d(Ee,"a",function(){return E});var re=z("1OyB"),W=z("vuIU"),I=z("Ji7U"),H=z("LK+K"),L=z("cDcd"),C=z("rePB"),j=z("Ff2n"),U=z("ODXe"),O=z("4IlW"),S=z("bX4T"),_=z("YrtM"),b=z("TSYQ"),h=z.n(b),l=z("+nKL"),r=z("8OUc"),s=function(F,K){var X=F.prefixCls,ee=F.id,oe=F.flattenOptions,ce=F.childrenAsData,le=F.values,be=F.searchValue,pe=F.multiple,de=F.defaultActiveFirstOption,te=F.height,Le=F.itemHeight,Ve=F.notFoundContent,Ne=F.open,Be=F.menuItemSelectedIcon,ve=F.virtual,ye=F.onSelect,Ie=F.onToggleOpen,Ae=F.onActiveValue,ge=F.onScroll,Ce=F.onMouseEnter,Oe="".concat(X,"-item"),Se=Object(_.a)(function(){return oe},[Ne,oe],function(fe,Z){return Z[0]&&fe[1]!==Z[1]}),De=L.useRef(null),je=function(Z){Z.preventDefault()},Me=function(Z){De.current&&De.current.scrollTo({index:Z})},Fe=function(Z){for(var Q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,$=Se.length,V=0;V<$;V+=1){var Y=(Z+V*Q+$)%$,J=Se[Y],q=J.group,ae=J.data;if(!q&&!ae.disabled)return Y}return-1},We=L.useState(function(){return Fe(0)}),ze=Object(U.a)(We,2),ne=ze[0],ue=ze[1],me=function(Z){ue(Z);var Q=Se[Z];if(!Q){Ae(null,-1);return}Ae(Q.data.value,Z)};L.useEffect(function(){me(de!==!1?Fe(0):-1)},[Se.length,be]),L.useEffect(function(){var fe=setTimeout(function(){if(!pe&&Ne&&le.size===1){var Z=Array.from(le)[0],Q=Se.findIndex(function($){var V=$.data;return V.value===Z});me(Q),Me(Q)}});return function(){return clearTimeout(fe)}},[Ne]);var _e=function(Z){Z!==void 0&&ye(Z,{selected:!le.has(Z)}),pe||Ie(!1)};if(L.useImperativeHandle(K,function(){return{onKeyDown:function(Z){var Q=Z.which;switch(Q){case O.a.UP:case O.a.DOWN:{var $=0;if(Q===O.a.UP?$=-1:Q===O.a.DOWN&&($=1),$!==0){var V=Fe(ne+$,$);Me(V),me(V)}break}case O.a.ENTER:{var Y=Se[ne];Y&&!Y.data.disabled?_e(Y.data.value):_e(void 0),Ne&&Z.preventDefault();break}case O.a.ESC:Ie(!1)}},onKeyUp:function(){},scrollTo:function(Z){Me(Z)}}}),Se.length===0)return L.createElement("div",{role:"listbox",id:"".concat(ee,"_list"),className:"".concat(Oe,"-empty"),onMouseDown:je},Ve);function se(fe){var Z=Se[fe];if(!Z)return null;var Q=Z.data||{},$=Q.value,V=Q.label,Y=Q.children,J=Object(S.a)(Q,!0),q=ce?Y:V;return Z?L.createElement("div",Object.assign({"aria-label":typeof q=="string"?q:null},J,{key:fe,role:"option",id:"".concat(ee,"_list_").concat(fe),"aria-selected":le.has($)}),$):null}return L.createElement(L.Fragment,null,L.createElement("div",{role:"listbox",id:"".concat(ee,"_list"),style:{height:0,width:0,overflow:"hidden"}},se(ne-1),se(ne),se(ne+1)),L.createElement(l.a,{itemKey:"key",ref:De,data:Se,height:te,itemHeight:Le,fullHeight:!1,onMouseDown:je,onScroll:ge,virtual:ve,onMouseEnter:Ce},function(fe,Z){var Q,$=fe.group,V=fe.groupOption,Y=fe.data,J=Y.label,q=Y.key;if($)return L.createElement("div",{className:h()(Oe,"".concat(Oe,"-group"))},J!==void 0?J:q);var ae=Y.disabled,he=Y.value,we=Y.title,Ue=Y.children,Ke=Y.style,Pe=Y.className,et=Object(j.a)(Y,["disabled","value","title","children","style","className"]),$e=le.has(he),He="".concat(Oe,"-option"),at=h()(Oe,He,Pe,(Q={},Object(C.a)(Q,"".concat(He,"-grouped"),V),Object(C.a)(Q,"".concat(He,"-active"),ne===Z&&!ae),Object(C.a)(Q,"".concat(He,"-disabled"),ae),Object(C.a)(Q,"".concat(He,"-selected"),$e),Q)),rt=ce?Ue:J,it=!Be||typeof Be=="function"||$e;return L.createElement("div",Object.assign({},et,{"aria-selected":$e,className:at,title:we,onMouseMove:function(){if(ne===Z||ae)return;me(Z)},onClick:function(){ae||_e(he)},style:Ke}),L.createElement("div",{className:"".concat(He,"-content")},rt||he),L.isValidElement(Be)||$e,it&&L.createElement(r.a,{className:"".concat(Oe,"-option-state"),customizeIcon:Be,customizeIconProps:{isSelected:$e}},$e?"\u2713":null))}))},a=L.forwardRef(s);a.displayName="OptionList";var e=a,t=function(){return null};t.isSelectOption=!0;var n=t,x=function(){return null};x.isSelectOptGroup=!0;var E=x,g=z("VTBJ"),y=z("Zm9Q");function v(R){var F=R.key,K=R.props,X=K.children,ee=K.value,oe=Object(j.a)(K,["children","value"]);return Object(g.a)({key:F,value:ee!==void 0?ee:F,children:X},oe)}function d(R){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(y.a)(R).map(function(K,X){if(!L.isValidElement(K)||!K.type)return null;var ee=K.type.isSelectOptGroup,oe=K.key,ce=K.props,le=ce.children,be=Object(j.a)(ce,["children"]);return F||!ee?v(K):Object(g.a)(Object(g.a)({key:"__RC_SELECT_GRP__".concat(oe===null?X:oe,"__"),label:oe},be),{},{options:d(le)})}).filter(function(K){return K})}var u=z("2Qr1"),i=z("qNPg"),o=z("U8pU"),p=z("Kwbf"),f=z("WKfj");function c(R){var F=R.mode,K=R.options,X=R.children,ee=R.backfill,oe=R.allowClear,ce=R.placeholder,le=R.getInputElement,be=R.showSearch,pe=R.onSearch,de=R.defaultOpen,te=R.autoFocus,Le=R.labelInValue,Ve=R.value,Ne=R.inputValue,Be=R.optionLabelProp,ve=F==="multiple"||F==="tags",ye=be!==void 0?be:ve||F==="combobox",Ie=K||d(X);if(Object(p.a)(F!=="tags"||Ie.every(function(Oe){return!Oe.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),F==="tags"||F==="combobox"){var Ae=Ie.some(function(Oe){return Oe.options?Oe.options.some(function(Se){return typeof("value"in Se?Se.value:Se.key)=="number"}):typeof("value"in Oe?Oe.value:Oe.key)=="number"});Object(p.a)(!Ae,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(p.a)(F!=="combobox"||!Be,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(p.a)(F==="combobox"||!ee,"`backfill` only works with `combobox` mode."),Object(p.a)(F==="combobox"||!le,"`getInputElement` only work with `combobox` mode."),Object(p.b)(F!=="combobox"||!le||!oe||!ce,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),pe&&!ye&&F!=="combobox"&&F!=="tags"&&Object(p.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(p.b)(!de||te,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),Ve!=null){var ge=Object(f.d)(Ve);Object(p.a)(!Le||ge.every(function(Oe){return Object(o.a)(Oe)==="object"&&("key"in Oe||"value"in Oe)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(p.a)(!ve||Array.isArray(Ve),"`value` should be array when `mode` is `multiple` or `tags`")}if(X){var Ce=null;Object(y.a)(X).some(function(Oe){if(!L.isValidElement(Oe)||!Oe.type)return!1;var Se=Oe.type;if(Se.isSelectOption)return!1;if(Se.isSelectOptGroup){var De=Object(y.a)(Oe.props.children).every(function(je){return!L.isValidElement(je)||!Oe.type||je.type.isSelectOption?!0:(Ce=je.type,!1)});return!De}return Ce=Se,!0}),Ce&&Object(p.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Ce.displayName||Ce.name||Ce,"`.")),Object(p.a)(Ne===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var w=c,A=Object(i.a)({prefixCls:"rc-select",components:{optionList:e},convertChildrenToData:d,flattenOptions:u.d,getLabeledValue:u.e,filterOptions:u.b,isValueDisabled:u.g,findValueOption:u.c,warningProps:w,fillOptionsWithMissingValue:u.a}),P=function(R){Object(I.a)(K,R);var F=Object(H.a)(K);function K(){var X;return Object(re.a)(this,K),X=F.apply(this,arguments),X.selectRef=L.createRef(),X.focus=function(){X.selectRef.current.focus()},X.blur=function(){X.selectRef.current.blur()},X}return Object(W.a)(K,[{key:"render",value:function(){return L.createElement(A,Object.assign({ref:this.selectRef},this.props))}}]),K}(L.Component);P.Option=n,P.OptGroup=E;var N=P,B=Ee.c=N},NvD2:function(Ge,Ee,z){"use strict";z.d(Ee,"a",function(){return C});var re=z("Kwbf");function W(j,U){var O=new Set;return j.forEach(function(S){U.has(S)||O.add(S)}),O}function I(j){var U=j||{},O=U.disabled,S=U.disableCheckbox,_=U.checkable;return!!(O||S)||_===!1}function H(j,U,O,S){for(var _=new Set(j),b=new Set,h=0;h<=O;h+=1){var l=U.get(h)||new Set;l.forEach(function(e){var t=e.key,n=e.node,x=e.children,E=x===void 0?[]:x;_.has(t)&&!S(n)&&E.filter(function(g){return!S(g.node)}).forEach(function(g){_.add(g.key)})})}for(var r=new Set,s=O;s>=0;s-=1){var a=U.get(s)||new Set;a.forEach(function(e){var t=e.parent,n=e.node;if(S(n)||!e.parent||r.has(e.parent.key))return;if(S(e.parent.node)){r.add(t.key);return}var x=!0,E=!1;(t.children||[]).filter(function(g){return!S(g.node)}).forEach(function(g){var y=g.key,v=_.has(y);x&&!v&&(x=!1),!E&&(v||b.has(y))&&(E=!0)}),x&&_.add(t.key),E&&b.add(t.key),r.add(t.key)})}return{checkedKeys:Array.from(_),halfCheckedKeys:Array.from(W(b,_))}}function L(j,U,O,S,_){for(var b=new Set(j),h=new Set(U),l=0;l<=S;l+=1){var r=O.get(l)||new Set;r.forEach(function(t){var n=t.key,x=t.node,E=t.children,g=E===void 0?[]:E;!b.has(n)&&!h.has(n)&&!_(x)&&g.filter(function(y){return!_(y.node)}).forEach(function(y){b.delete(y.key)})})}h=new Set;for(var s=new Set,a=S;a>=0;a-=1){var e=O.get(a)||new Set;e.forEach(function(t){var n=t.parent,x=t.node;if(_(x)||!t.parent||s.has(t.parent.key))return;if(_(t.parent.node)){s.add(n.key);return}var E=!0,g=!1;(n.children||[]).filter(function(y){return!_(y.node)}).forEach(function(y){var v=y.key,d=b.has(v);E&&!d&&(E=!1),!g&&(d||h.has(v))&&(g=!0)}),E||b.delete(n.key),g&&h.add(n.key),s.add(n.key)})}return{checkedKeys:Array.from(b),halfCheckedKeys:Array.from(W(h,b))}}function C(j,U,O,S){var _=[],b;S?b=S:b=I;var h=new Set(j.filter(function(a){var e=!!O[a];return e||_.push(a),e})),l=new Map,r=0;Object.keys(O).forEach(function(a){var e=O[a],t=e.level,n=l.get(t);n||(n=new Set,l.set(t,n)),n.add(e),r=Math.max(r,t)}),Object(re.a)(!_.length,"Tree missing follow keys: ".concat(_.slice(0,100).map(function(a){return"'".concat(a,"'")}).join(", ")));var s;return U===!0?s=H(h,l,r,b):s=L(h,U.halfCheckedKeys,l,r,b),s}},OZM5:function(Ge,Ee,z){"use strict";z.d(Ee,"b",function(){return S}),z.d(Ee,"a",function(){return _}),z.d(Ee,"k",function(){return b}),z.d(Ee,"h",function(){return h}),z.d(Ee,"i",function(){return l}),z.d(Ee,"g",function(){return r}),z.d(Ee,"c",function(){return s}),z.d(Ee,"d",function(){return a}),z.d(Ee,"j",function(){return n}),z.d(Ee,"e",function(){return x}),z.d(Ee,"f",function(){return E});var re=z("KQm4"),W=z("U8pU"),I=z("Ff2n"),H=z("cDcd"),L=z.n(H),C=z("Kwbf"),j=z("WaYH"),U=.25,O=2;function S(g,y){var v=g.slice(),d=v.indexOf(y);return d>=0&&v.splice(d,1),v}function _(g,y){var v=g.slice();return v.indexOf(y)===-1&&v.push(y),v}function b(g){return g.split("-")}function h(g,y){return"".concat(g,"-").concat(y)}function l(g){return g&&g.type&&g.type.isTreeNode}function r(g,y){var v=[g],d=y[g];function u(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];i.forEach(function(o){var p=o.key,f=o.children;v.push(p),u(f)})}return u(d.children),v}function s(g,y){var v=g.clientY,d=y.selectHandle.getBoundingClientRect(),u=d.top,i=d.bottom,o=d.height,p=Math.max(o*U,O);return v<=u+p?-1:v>=i-p?1:0}function a(g,y){if(!g)return;var v=y.multiple;return v?g.slice():g.length?[g[0]]:g}var e=function(y){return y};function t(g,y){if(!g)return[];var v=y||{},d=v.processProps,u=d===void 0?e:d,i=Array.isArray(g)?g:[g];return i.map(function(o){var p=o.children,f=Object(I.a)(o,["children"]),c=t(p,y);return L.a.createElement(j.a,Object.assign({},u(f)),c)})}function n(g){if(!g)return null;var y;if(Array.isArray(g))y={checkedKeys:g,halfCheckedKeys:void 0};else if(Object(W.a)(g)==="object")y={checkedKeys:g.checked||void 0,halfCheckedKeys:g.halfChecked||void 0};else return Object(C.a)(!1,"`checkedKeys` is not an array or an object"),null;return y}function x(g,y){var v=new Set;function d(u){if(v.has(u))return;var i=y[u];if(!i)return;v.add(u);var o=i.parent,p=i.node;if(p.disabled)return;o&&d(o.key)}return(g||[]).forEach(function(u){d(u)}),Object(re.a)(v)}function E(g){var y={};return Object.keys(g).forEach(function(v){(v.startsWith("data-")||v.startsWith("aria-"))&&(y[v]=g[v])}),y}},"SA+Z":function(Ge,Ee,z){var re=z("wTVA"),W=z("EbDI"),I=z("ZhPi"),H=z("wkBT");function L(C){return re(C)||W(C)||I(C)||H()}Ge.exports=L,Ge.exports.__esModule=!0,Ge.exports.default=Ge.exports},SJMd:function(Ge,Ee){/**
|
|
* @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 z,re,W,I=!1,H,L;window.PR_SHOULD_USE_CONTINUATION=!0;var C,j;(function(){var U=window,O=["break,continue,do,else,for,if,return,while"],S=[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"],_=[S,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],b=[_,"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"],h=[_,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],l=[_,"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"],r="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",s=[_,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],a="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"],x=[b,l,h,s,a,e,t,n],E=/^(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",y="kwd",v="com",d="typ",u="lit",i="pun",o="pln",p="tag",f="dec",c="src",w="atn",A="atv",P="nocode",N="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function B(ye){for(var Ie=0,Ae=!1,ge=!1,Ce=0,Oe=ye.length;Ce<Oe;++Ce){var Se=ye[Ce];if(Se.ignoreCase)ge=!0;else if(/[a-z]/i.test(Se.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Ae=!0,ge=!1;break}}var De={b:8,t:9,n:10,v:11,f:12,r:13};function je(ne){var ue=ne.charCodeAt(0);if(ue!==92)return ue;var me=ne.charAt(1);return ue=De[me],ue||("0"<=me&&me<="7"?parseInt(ne.substring(1),8):me==="u"||me==="x"?parseInt(ne.substring(2),16):ne.charCodeAt(1))}function Me(ne){if(ne<32)return(ne<16?"\\x0":"\\x")+ne.toString(16);var ue=String.fromCharCode(ne);return ue==="\\"||ue==="-"||ue==="]"||ue==="^"?"\\"+ue:ue}function Fe(ne){var ue=ne.substring(1,ne.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")),me=[],_e=ue[0]==="^",se=["["];_e&&se.push("^");for(var fe=_e?1:0,Z=ue.length;fe<Z;++fe){var Q=ue[fe];if(/\\[bdsw]/i.test(Q))se.push(Q);else{var $=je(Q),V;fe+2<Z&&ue[fe+1]==="-"?(V=je(ue[fe+2]),fe+=2):V=$,me.push([$,V]),V<65||$>122||(V<65||$>90||me.push([Math.max(65,$)|32,Math.min(V,90)|32]),V<97||$>122||me.push([Math.max(97,$)&~32,Math.min(V,122)&~32]))}}me.sort(function(ae,he){return ae[0]-he[0]||he[1]-ae[1]});for(var Y=[],J=[],fe=0;fe<me.length;++fe){var q=me[fe];q[0]<=J[1]+1?J[1]=Math.max(J[1],q[1]):Y.push(J=q)}for(var fe=0;fe<Y.length;++fe){var q=Y[fe];se.push(Me(q[0])),q[1]>q[0]&&(q[1]+1>q[0]&&se.push("-"),se.push(Me(q[1])))}return se.push("]"),se.join("")}function We(ne){for(var ue=ne.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")),me=ue.length,_e=[],se=0,fe=0;se<me;++se){var Z=ue[se];if(Z==="(")++fe;else if(Z.charAt(0)==="\\"){var Q=+Z.substring(1);Q&&(Q<=fe?_e[Q]=-1:ue[se]=Me(Q))}}for(var se=1;se<_e.length;++se)_e[se]===-1&&(_e[se]=++Ie);for(var se=0,fe=0;se<me;++se){var Z=ue[se];if(Z==="(")++fe,_e[fe]||(ue[se]="(?:");else if(Z.charAt(0)==="\\"){var Q=+Z.substring(1);Q&&Q<=fe&&(ue[se]="\\"+_e[Q])}}for(var se=0;se<me;++se)ue[se]==="^"&&ue[se+1]!=="^"&&(ue[se]="");if(ne.ignoreCase&&Ae)for(var se=0;se<me;++se){var Z=ue[se],$=Z.charAt(0);Z.length>=2&&$==="["?ue[se]=Fe(Z):$!=="\\"&&(ue[se]=Z.replace(/[a-zA-Z]/g,function(J){var q=J.charCodeAt(0);return"["+String.fromCharCode(q&~32,q|32)+"]"}))}return ue.join("")}for(var ze=[],Ce=0,Oe=ye.length;Ce<Oe;++Ce){var Se=ye[Ce];if(Se.global||Se.multiline)throw new Error(""+Se);ze.push("(?:"+We(Se)+")")}return new RegExp(ze.join("|"),ge?"gi":"g")}function R(ye,Ie){var Ae=/(?:^|\s)nocode(?:\s|$)/,ge=[],Ce=0,Oe=[],Se=0;function De(je){var Me=je.nodeType;if(Me==1){if(Ae.test(je.className))return;for(var Fe=je.firstChild;Fe;Fe=Fe.nextSibling)De(Fe);var We=je.nodeName.toLowerCase();(We==="br"||We==="li")&&(ge[Se]=`
|
|
`,Oe[Se<<1]=Ce++,Oe[Se++<<1|1]=je)}else if(Me==3||Me==4){var ze=je.nodeValue;ze.length&&(Ie?ze=ze.replace(/\r\n?/g,`
|
|
`):ze=ze.replace(/[ \t\r\n]+/g," "),ge[Se]=ze,Oe[Se<<1]=Ce,Ce+=ze.length,Oe[Se++<<1|1]=je)}}return De(ye),{sourceCode:ge.join("").replace(/\n$/,""),spans:Oe}}function F(ye,Ie,Ae,ge,Ce){if(!Ae)return;var Oe={sourceNode:ye,pre:1,langExtension:null,numberLines:null,sourceCode:Ae,spans:null,basePos:Ie,decorations:null};ge(Oe),Ce.push.apply(Ce,Oe.decorations)}var K=/\S/;function X(ye){for(var Ie=void 0,Ae=ye.firstChild;Ae;Ae=Ae.nextSibling){var ge=Ae.nodeType;Ie=ge===1?Ie?ye:Ae:ge===3&&K.test(Ae.nodeValue)?ye:Ie}return Ie===ye?void 0:Ie}function ee(ye,Ie){var Ae={},ge;(function(){for(var Se=ye.concat(Ie),De=[],je={},Me=0,Fe=Se.length;Me<Fe;++Me){var We=Se[Me],ze=We[3];if(ze)for(var ne=ze.length;--ne>=0;)Ae[ze.charAt(ne)]=We;var ue=We[1],me=""+ue;je.hasOwnProperty(me)||(De.push(ue),je[me]=null)}De.push(/[\0-\uffff]/),ge=B(De)})();var Ce=Ie.length,Oe=function(Se){for(var De=Se.sourceCode,je=Se.basePos,Me=Se.sourceNode,Fe=[je,o],We=0,ze=De.match(ge)||[],ne={},ue=0,me=ze.length;ue<me;++ue){var _e=ze[ue],se=ne[_e],fe=void 0,Z;if(typeof se=="string")Z=!1;else{var Q=Ae[_e.charAt(0)];if(Q)fe=_e.match(Q[1]),se=Q[0];else{for(var $=0;$<Ce;++$)if(Q=Ie[$],fe=_e.match(Q[1]),fe){se=Q[0];break}fe||(se=o)}Z=se.length>=5&&se.substring(0,5)==="lang-",Z&&!(fe&&typeof fe[1]=="string")&&(Z=!1,se=c),Z||(ne[_e]=se)}var V=We;if(We+=_e.length,!Z)Fe.push(je+V,se);else{var Y=fe[1],J=_e.indexOf(Y),q=J+Y.length;fe[2]&&(q=_e.length-fe[2].length,J=q-Y.length);var ae=se.substring(5);F(Me,je+V,_e.substring(0,J),Oe,Fe),F(Me,je+V+J,Y,te(ae,Y),Fe),F(Me,je+V+q,_e.substring(q),Oe,Fe)}}Se.decorations=Fe};return Oe}function oe(ye){var Ie=[],Ae=[];ye.tripleQuotedStrings?Ie.push([g,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ye.multiLineStrings?Ie.push([g,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Ie.push([g,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ye.verbatimStrings&&Ae.push([g,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var ge=ye.hashComments;ge&&(ye.cStyleComments?(ge>1?Ie.push([v,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Ie.push([v,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Ae.push([g,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Ie.push([v,/^#[^\r\n]*/,null,"#"])),ye.cStyleComments&&(Ae.push([v,/^\/\/[^\r\n]*/,null]),Ae.push([v,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ce=ye.regexLiterals;if(Ce){var Oe=Ce>1?"":`
|
|
\r`,Se=Oe?".":"[\\S\\s]",De="/(?=[^/*"+Oe+"])(?:[^/\\x5B\\x5C"+Oe+"]|\\x5C"+Se+"|\\x5B(?:[^\\x5C\\x5D"+Oe+"]|\\x5C"+Se+")*(?:\\x5D|$))+/";Ae.push(["lang-regex",RegExp("^"+N+"("+De+")")])}var je=ye.types;je&&Ae.push([d,je]);var Me=(""+ye.keywords).replace(/^ | $/g,"");Me.length&&Ae.push([y,new RegExp("^(?:"+Me.replace(/[\s,]+/g,"|")+")\\b"),null]),Ie.push([o,/^\s+/,null,` \r
|
|
\xA0`]);var Fe="^.[^\\s\\w.$@'\"`/\\\\]*";return ye.regexLiterals&&(Fe+="(?!s*/)"),Ae.push([u,/^@[a-z_$][a-z_$@0-9]*/i,null],[d,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[o,/^[a-z_$][a-z_$@0-9]*/i,null],[u,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[o,/^\\[\s\S]?/,null],[i,new RegExp(Fe),null]),ee(Ie,Ae)}var ce=oe({keywords:x,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function le(ye,Ie,Ae){for(var ge=/(?:^|\s)nocode(?:\s|$)/,Ce=/\r\n?|\n/,Oe=ye.ownerDocument,Se=Oe.createElement("li");ye.firstChild;)Se.appendChild(ye.firstChild);var De=[Se];function je(ue){var me=ue.nodeType;if(me==1&&!ge.test(ue.className))if(ue.nodeName==="br")Me(ue),ue.parentNode&&ue.parentNode.removeChild(ue);else for(var _e=ue.firstChild;_e;_e=_e.nextSibling)je(_e);else if((me==3||me==4)&&Ae){var se=ue.nodeValue,fe=se.match(Ce);if(fe){var Z=se.substring(0,fe.index);ue.nodeValue=Z;var Q=se.substring(fe.index+fe[0].length);if(Q){var $=ue.parentNode;$.insertBefore(Oe.createTextNode(Q),ue.nextSibling)}Me(ue),Z||ue.parentNode.removeChild(ue)}}}function Me(ue){for(;!ue.nextSibling;)if(ue=ue.parentNode,!ue)return;function me(fe,Z){var Q=Z?fe.cloneNode(!1):fe,$=fe.parentNode;if($){var V=me($,1),Y=fe.nextSibling;V.appendChild(Q);for(var J=Y;J;J=Y)Y=J.nextSibling,V.appendChild(J)}return Q}for(var _e=me(ue.nextSibling,0),se;(se=_e.parentNode)&&se.nodeType===1;)_e=se;De.push(_e)}for(var Fe=0;Fe<De.length;++Fe)je(De[Fe]);Ie===(Ie|0)&&De[0].setAttribute("value",Ie);var We=Oe.createElement("ol");We.className="linenums";for(var ze=Math.max(0,Ie-1|0)||0,Fe=0,ne=De.length;Fe<ne;++Fe)Se=De[Fe],Se.className="L"+(Fe+ze)%10,Se.firstChild||Se.appendChild(Oe.createTextNode("\xA0")),We.appendChild(Se);ye.appendChild(We)}function be(ye){var Ie=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Ie=Ie&&+Ie[1]<=8;var Ae=/\n/g,ge=ye.sourceCode,Ce=ge.length,Oe=0,Se=ye.spans,De=Se.length,je=0,Me=ye.decorations,Fe=Me.length,We=0;Me[Fe]=Ce;var ze,ne;for(ne=ze=0;ne<Fe;)Me[ne]!==Me[ne+2]?(Me[ze++]=Me[ne++],Me[ze++]=Me[ne++]):ne+=2;for(Fe=ze,ne=ze=0;ne<Fe;){for(var ue=Me[ne],me=Me[ne+1],_e=ne+2;_e+2<=Fe&&Me[_e+1]===me;)_e+=2;Me[ze++]=ue,Me[ze++]=me,ne=_e}Fe=Me.length=ze;var se=ye.sourceNode,fe="";se&&(fe=se.style.display,se.style.display="none");try{for(var Z=null;je<De;){var Q=Se[je],$=Se[je+2]||Ce,V=Me[We+2]||Ce,_e=Math.min($,V),Y=Se[je+1],J;if(Y.nodeType!==1&&(J=ge.substring(Oe,_e))){Ie&&(J=J.replace(Ae,"\r")),Y.nodeValue=J;var q=Y.ownerDocument,ae=q.createElement("span");ae.className=Me[We+1];var he=Y.parentNode;he.replaceChild(ae,Y),ae.appendChild(Y),Oe<$&&(Se[je+1]=Y=q.createTextNode(ge.substring(_e,$)),he.insertBefore(Y,ae.nextSibling))}Oe=_e,Oe>=$&&(je+=2),Oe>=V&&(We+=2)}}finally{se&&(se.style.display=fe)}}var pe={};function de(ye,Ie){for(var Ae=Ie.length;--Ae>=0;){var ge=Ie[Ae];pe.hasOwnProperty(ge)?U.console&&console.warn("cannot override language handler %s",ge):pe[ge]=ye}}function te(ye,Ie){return ye&&pe.hasOwnProperty(ye)||(ye=/^\s*</.test(Ie)?"default-markup":"default-code"),pe[ye]}de(ce,["default-code"]),de(ee([],[[o,/^[^<?]+/],[f,/^<!\w[^>]*(?:>|$)/],[v,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[i,/^(?:<[%?]|[%?]>)/],["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"]),de(ee([[o,/^[\s]+/,null,` \r
|
|
`],[A,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[p,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[w,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[i,/^[=<>\/]+/],["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"]),de(ee([],[[A,/^[\s\S]+/]]),["uq.val"]),de(oe({keywords:b,hashComments:!0,cStyleComments:!0,types:E}),["c","cc","cpp","cxx","cyc","m"]),de(oe({keywords:"null,true,false"}),["json"]),de(oe({keywords:l,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:E}),["cs"]),de(oe({keywords:h,cStyleComments:!0}),["java"]),de(oe({keywords:n,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),de(oe({keywords:e,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),de(oe({keywords:a,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),de(oe({keywords:t,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),de(oe({keywords:s,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),de(oe({keywords:r,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),de(ee([],[[g,/^[\s\S]+/]]),["regex"]);function Le(ye){var Ie=ye.langExtension;try{var Ae=R(ye.sourceNode,ye.pre),ge=Ae.sourceCode;ye.sourceCode=ge,ye.spans=Ae.spans,ye.basePos=0,te(Ie,ge)(ye),be(ye)}catch(Ce){U.console&&console.log(Ce&&Ce.stack||Ce)}}function Ve(ye,Ie,Ae){var ge=Ae||!1,Ce=Ie||null,Oe=document.createElement("div");Oe.innerHTML="<pre>"+ye+"</pre>",Oe=Oe.firstChild,ge&&le(Oe,ge,!0);var Se={langExtension:Ce,numberLines:ge,sourceNode:Oe,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Le(Se),Oe.innerHTML}function Ne(ye,Ie){var Ae=Ie||document.body,ge=Ae.ownerDocument||document;function Ce(Q){return Ae.getElementsByTagName(Q)}for(var Oe=[Ce("pre"),Ce("code"),Ce("xmp")],Se=[],De=0;De<Oe.length;++De)for(var je=0,Me=Oe[De].length;je<Me;++je)Se.push(Oe[De][je]);Oe=null;var Fe=Date;Fe.now||(Fe={now:function(){return+new Date}});var We=0,ze=/\blang(?:uage)?-([\w.]+)(?!\S)/,ne=/\bprettyprint\b/,ue=/\bprettyprinted\b/,me=/pre|xmp/i,_e=/^code$/i,se=/^(?:pre|code|xmp)$/i,fe={};function Z(){for(var Q=U.PR_SHOULD_USE_CONTINUATION?Fe.now()+250:Infinity;We<Se.length&&Fe.now()<Q;We++){for(var $=Se[We],V=fe,Y=$;Y=Y.previousSibling;){var J=Y.nodeType,q=(J===7||J===8)&&Y.nodeValue;if(q?!/^\??prettify\b/.test(q):J!==3||/\S/.test(Y.nodeValue))break;if(q){V={},q.replace(/\b(\w+)=([\w:.%+-]+)/g,function(ht,qe,ot){V[qe]=ot});break}}var ae=$.className;if((V!==fe||ne.test(ae))&&!ue.test(ae)){for(var he=!1,we=$.parentNode;we;we=we.parentNode){var Ue=we.tagName;if(se.test(Ue)&&we.className&&ne.test(we.className)){he=!0;break}}if(!he){$.className+=" prettyprinted";var Ke=V.lang;if(!Ke){Ke=ae.match(ze);var Pe;!Ke&&(Pe=X($))&&_e.test(Pe.tagName)&&(Ke=Pe.className.match(ze)),Ke&&(Ke=Ke[1])}var et;if(me.test($.tagName))et=1;else{var $e=$.currentStyle,He=ge.defaultView,at=$e?$e.whiteSpace:He&&He.getComputedStyle?He.getComputedStyle($,null).getPropertyValue("white-space"):0;et=at&&at.substring(0,3)==="pre"}var rt=V.linenums;(rt=rt==="true"||+rt)||(rt=ae.match(/\blinenums\b(?::(\d+))?/),rt=rt?rt[1]&&rt[1].length?+rt[1]:!0:!1),rt&&le($,rt,et);var it={langExtension:Ke,sourceNode:$,numberLines:rt,pre:et,sourceCode:null,basePos:null,spans:null,decorations:null};Le(it)}}}We<Se.length?U.setTimeout(Z,250):typeof ye=="function"&&ye()}Z()}var Be=U.PR={createSimpleLexer:ee,registerLangHandler:de,sourceDecorator:oe,PR_ATTRIB_NAME:w,PR_ATTRIB_VALUE:A,PR_COMMENT:v,PR_DECLARATION:f,PR_KEYWORD:y,PR_LITERAL:u,PR_NOCODE:P,PR_PLAIN:o,PR_PUNCTUATION:i,PR_SOURCE:c,PR_STRING:g,PR_TAG:p,PR_TYPE:d,prettyPrintOne:I?U.prettyPrintOne=Ve:C=Ve,prettyPrint:j=I?U.prettyPrint=Ne:j=Ne},ve=U.define;typeof ve=="function"&&ve.amd&&ve("google-code-prettify",[],function(){return Be})})()},TXwP:function(Ge,Ee,z){var re,W;(function(){var I;(function(){"use strict";var L=[,,function(O){function S(h){this.__parent=h,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=[]}S.prototype.clone_empty=function(){var h=new S(this.__parent);return h.set_indent(this.__indent_count,this.__alignment_count),h},S.prototype.item=function(h){return h<0?this.__items[this.__items.length+h]:this.__items[h]},S.prototype.has_match=function(h){for(var l=this.__items.length-1;l>=0;l--)if(this.__items[l].match(h))return!0;return!1},S.prototype.set_indent=function(h,l){this.is_empty()&&(this.__indent_count=h||0,this.__alignment_count=l||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},S.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)},S.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},S.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var h=this.__parent.current_line;return h.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),h.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),h.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,h.__items[0]===" "&&(h.__items.splice(0,1),h.__character_count-=1),!0}return!1},S.prototype.is_empty=function(){return this.__items.length===0},S.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},S.prototype.push=function(h){this.__items.push(h);var l=h.lastIndexOf(`
|
|
`);l!==-1?this.__character_count=h.length-l:this.__character_count+=h.length},S.prototype.pop=function(){var h=null;return this.is_empty()||(h=this.__items.pop(),this.__character_count-=h.length),h},S.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},S.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},S.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},S.prototype.toString=function(){var h="";return this.is_empty()?this.__parent.indent_empty_lines&&(h=this.__parent.get_indent_string(this.__indent_count)):(h=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),h+=this.__items.join("")),h};function _(h,l){this.__cache=[""],this.__indent_size=h.indent_size,this.__indent_string=h.indent_char,h.indent_with_tabs||(this.__indent_string=new Array(h.indent_size+1).join(h.indent_char)),l=l||"",h.indent_level>0&&(l=new Array(h.indent_level+1).join(this.__indent_string)),this.__base_string=l,this.__base_string_length=l.length}_.prototype.get_indent_size=function(h,l){var r=this.__base_string_length;return l=l||0,h<0&&(r=0),r+=h*this.__indent_size,r+=l,r},_.prototype.get_indent_string=function(h,l){var r=this.__base_string;return l=l||0,h<0&&(h=0,r=""),l+=h*this.__indent_size,this.__ensure_cache(l),r+=this.__cache[l],r},_.prototype.__ensure_cache=function(h){for(;h>=this.__cache.length;)this.__add_column()},_.prototype.__add_column=function(){var h=this.__cache.length,l=0,r="";this.__indent_size&&h>=this.__indent_size&&(l=Math.floor(h/this.__indent_size),h-=l*this.__indent_size,r=new Array(l+1).join(this.__indent_string)),h&&(r+=new Array(h+1).join(" ")),this.__cache.push(r)};function b(h,l){this.__indent_cache=new _(h,l),this.raw=!1,this._end_with_newline=h.end_with_newline,this.indent_size=h.indent_size,this.wrap_line_length=h.wrap_line_length,this.indent_empty_lines=h.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new S(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}b.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},b.prototype.get_line_number=function(){return this.__lines.length},b.prototype.get_indent_string=function(h,l){return this.__indent_cache.get_indent_string(h,l)},b.prototype.get_indent_size=function(h,l){return this.__indent_cache.get_indent_size(h,l)},b.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},b.prototype.add_new_line=function(h){return this.is_empty()||!h&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},b.prototype.get_code=function(h){this.trim(!0);var l=this.current_line.pop();l&&(l[l.length-1]===`
|
|
`&&(l=l.replace(/\n+$/g,"")),this.current_line.push(l)),this._end_with_newline&&this.__add_outputline();var r=this.__lines.join(`
|
|
`);return h!==`
|
|
`&&(r=r.replace(/[\n]/g,h)),r},b.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},b.prototype.set_indent=function(h,l){return h=h||0,l=l||0,this.next_line.set_indent(h,l),this.__lines.length>1?(this.current_line.set_indent(h,l),!0):(this.current_line.set_indent(),!1)},b.prototype.add_raw_token=function(h){for(var l=0;l<h.newlines;l++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(h.whitespace_before),this.current_line.push(h.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},b.prototype.add_token=function(h){this.__add_space_before_token(),this.current_line.push(h),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},b.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(" "))},b.prototype.remove_indent=function(h){for(var l=this.__lines.length;h<l;)this.__lines[h]._remove_indent(),h++;this.current_line._remove_wrap_indent()},b.prototype.trim=function(h){for(h=h===void 0?!1:h,this.current_line.trim();h&&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},b.prototype.just_added_newline=function(){return this.current_line.is_empty()},b.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},b.prototype.ensure_empty_line_above=function(h,l){for(var r=this.__lines.length-2;r>=0;){var s=this.__lines[r];if(s.is_empty())break;if(s.item(0).indexOf(h)!==0&&s.item(-1)!==l){this.__lines.splice(r+1,0,new S(this)),this.previous_line=this.__lines[this.__lines.length-2];break}r--}},O.exports.Output=b},,,,function(O){function S(h,l){this.raw_options=_(h,l),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"])}S.prototype._get_array=function(h,l){var r=this.raw_options[h],s=l||[];return typeof r=="object"?r!==null&&typeof r.concat=="function"&&(s=r.concat()):typeof r=="string"&&(s=r.split(/[^a-zA-Z0-9_\/\-]+/)),s},S.prototype._get_boolean=function(h,l){var r=this.raw_options[h],s=r===void 0?!!l:!!r;return s},S.prototype._get_characters=function(h,l){var r=this.raw_options[h],s=l||"";return typeof r=="string"&&(s=r.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),s},S.prototype._get_number=function(h,l){var r=this.raw_options[h];l=parseInt(l,10),isNaN(l)&&(l=0);var s=parseInt(r,10);return isNaN(s)&&(s=l),s},S.prototype._get_selection=function(h,l,r){var s=this._get_selection_list(h,l,r);if(s.length!==1)throw new Error("Invalid Option Value: The option '"+h+`' can only be one of the following values:
|
|
`+l+`
|
|
You passed in: '`+this.raw_options[h]+"'");return s[0]},S.prototype._get_selection_list=function(h,l,r){if(!l||l.length===0)throw new Error("Selection list cannot be empty.");if(r=r||[l[0]],!this._is_valid_selection(r,l))throw new Error("Invalid Default Value!");var s=this._get_array(h,r);if(!this._is_valid_selection(s,l))throw new Error("Invalid Option Value: The option '"+h+`' can contain only the following values:
|
|
`+l+`
|
|
You passed in: '`+this.raw_options[h]+"'");return s},S.prototype._is_valid_selection=function(h,l){return h.length&&l.length&&!h.some(function(r){return l.indexOf(r)===-1})};function _(h,l){var r={};h=b(h);var s;for(s in h)s!==l&&(r[s]=h[s]);if(l&&h[l])for(s in h[l])r[s]=h[l][s];return r}function b(h){var l={},r;for(r in h){var s=r.replace(/-/g,"_");l[s]=h[r]}return l}O.exports.Options=S,O.exports.normalizeOpts=b,O.exports.mergeOpts=_},,function(O){var S=RegExp.prototype.hasOwnProperty("sticky");function _(b){this.__input=b||"",this.__input_length=this.__input.length,this.__position=0}_.prototype.restart=function(){this.__position=0},_.prototype.back=function(){this.__position>0&&(this.__position-=1)},_.prototype.hasNext=function(){return this.__position<this.__input_length},_.prototype.next=function(){var b=null;return this.hasNext()&&(b=this.__input.charAt(this.__position),this.__position+=1),b},_.prototype.peek=function(b){var h=null;return b=b||0,b+=this.__position,b>=0&&b<this.__input_length&&(h=this.__input.charAt(b)),h},_.prototype.__match=function(b,h){b.lastIndex=h;var l=b.exec(this.__input);return l&&!(S&&b.sticky)&&(l.index!==h&&(l=null)),l},_.prototype.test=function(b,h){return h=h||0,h+=this.__position,h>=0&&h<this.__input_length?!!this.__match(b,h):!1},_.prototype.testChar=function(b,h){var l=this.peek(h);return b.lastIndex=0,l!==null&&b.test(l)},_.prototype.match=function(b){var h=this.__match(b,this.__position);return h?this.__position+=h[0].length:h=null,h},_.prototype.read=function(b,h,l){var r="",s;return b&&(s=this.match(b),s&&(r+=s[0])),h&&(s||!b)&&(r+=this.readUntil(h,l)),r},_.prototype.readUntil=function(b,h){var l="",r=this.__position;b.lastIndex=this.__position;var s=b.exec(this.__input);return s?(r=s.index,h&&(r+=s[0].length)):r=this.__input_length,l=this.__input.substring(this.__position,r),this.__position=r,l},_.prototype.readUntilAfter=function(b){return this.readUntil(b,!0)},_.prototype.get_regexp=function(b,h){var l=null,r="g";return h&&S&&(r="y"),typeof b=="string"&&b!==""?l=new RegExp(b,r):b&&(l=new RegExp(b.source,r)),l},_.prototype.get_literal_regexp=function(b){return RegExp(b.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},_.prototype.peekUntilAfter=function(b){var h=this.__position,l=this.readUntilAfter(b);return this.__position=h,l},_.prototype.lookBack=function(b){var h=this.__position-1;return h>=b.length&&this.__input.substring(h-b.length,h).toLowerCase()===b},O.exports.InputScanner=_},,,,,function(O){function S(_,b){_=typeof _=="string"?_:_.source,b=typeof b=="string"?b:b.source,this.__directives_block_pattern=new RegExp(_+/ beautify( \w+[:]\w+)+ /.source+b,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(_+/\sbeautify\signore:end\s/.source+b,"g")}S.prototype.get_directives=function(_){if(!_.match(this.__directives_block_pattern))return null;var b={};this.__directive_pattern.lastIndex=0;for(var h=this.__directive_pattern.exec(_);h;)b[h[1]]=h[2],h=this.__directive_pattern.exec(_);return b},S.prototype.readIgnored=function(_){return _.readUntilAfter(this.__directives_end_ignore_pattern)},O.exports.Directives=S},,function(O,S,_){var b=_(16).Beautifier,h=_(17).Options;function l(r,s){var a=new b(r,s);return a.beautify()}O.exports=l,O.exports.defaultOptions=function(){return new h}},function(O,S,_){var b=_(17).Options,h=_(2).Output,l=_(8).InputScanner,r=_(13).Directives,s=new r(/\/\*/,/\*\//),a=/\r\n|[\r\n]/,e=/\r\n|[\r\n]/g,t=/\s/,n=/(?:\s|\n)+/g,x=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,E=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function g(y,v){this._source_text=y||"",this._options=new b(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(y){var v="";for(this._ch=this._input.next();this._ch;){if(v+=this._ch,this._ch==="\\")v+=this._input.next();else if(y.indexOf(this._ch)!==-1||this._ch===`
|
|
`)break;this._ch=this._input.next()}return v},g.prototype.eatWhitespace=function(y){for(var v=t.test(this._input.peek()),d=0;t.test(this._input.peek());)this._ch=this._input.next(),y&&this._ch===`
|
|
`&&((d===0||d<this._options.max_preserve_newlines)&&(d++,this._output.add_new_line(!0)));return v},g.prototype.foundNestedPseudoClass=function(){for(var y=0,v=1,d=this._input.peek(v);d;){if(d==="{")return!0;if(d==="(")y+=1;else if(d===")"){if(y===0)return!1;y-=1}else if(d===";"||d==="}")return!1;v++,d=this._input.peek(v)}return!1},g.prototype.print_string=function(y){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(y)},g.prototype.preserveSingleSpace=function(y){y&&(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 y=this._source_text,v=this._options.eol;v==="auto"&&(v=`
|
|
`,y&&a.test(y||"")&&(v=y.match(a)[0])),y=y.replace(e,`
|
|
`);var d=y.match(/^[\t ]*/)[0];this._output=new h(this._options,d),this._input=new l(y),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var u=0,i=!1,o=!1,p=!1,f=!1,c=!1,w=!1,A=this._ch,P=!1,N,B,R;N=this._input.read(n),B=N!=="",R=A,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),A=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var F=this._input.read(x),K=s.get_directives(F);K&&K.ignore==="start"&&(F+=s.readIgnored(this._input)),this.print_string(F),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(E)),this.eatWhitespace(!0);else if(this._ch==="@"||this._ch==="$")if(this.preserveSingleSpace(B),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var X=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);X.match(/[ :]$/)&&(X=this.eatString(": ").replace(/\s$/,""),this.print_string(X),this._output.space_before_token=!0),X=X.replace(/\s$/,""),X==="extend"?f=!0:X==="import"&&(c=!0),X in this.NESTED_AT_RULE?(this._nestedLevel+=1,X in this.CONDITIONAL_GROUP_RULE&&(p=!0)):!i&&u===0&&X.indexOf(":")!==-1&&(o=!0,this.indent())}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(B),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")o&&(o=!1,this.outdent()),p?(p=!1,i=this._indentLevel>=this._nestedLevel):i=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&i&&(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)):(R==="("?this._output.space_before_token=!1:R!==","&&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(),R==="{"&&this._output.trim(!0),c=!1,f=!1,o&&(this.outdent(),o=!1),this.print_string(this._ch),i=!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 ee=0;ee<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;ee++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[ee])){P=!0;break}(i||p)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!f&&u===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 oe=R==='"'||R==="'";this.preserveSingleSpace(oe||B),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")P=!1,u===0?(o&&(this.outdent(),o=!1),f=!1,c=!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(),u++,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(")")),u&&(u--,this.outdent()));else{var ce=!1;this._input.lookBack("with")&&(ce=!0),this.preserveSingleSpace(B||ce),this.print_string(this._ch),o&&R==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),w=!0):(this.eatWhitespace(),u++,this.indent())}else if(this._ch===")")u&&(u--,this.outdent()),w&&this._input.peek()===";"&&this._options.selector_separator_newline&&(w=!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||w)&&u===0&&!c&&!f?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!o&&u===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(B),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 le=R==='"'||R==="'";this.preserveSingleSpace(le||B),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
|
|
`&&P&&this._output.add_new_line()}var be=this._output.get_code(v);return be},O.exports.Beautifier=g},function(O,S,_){var b=_(6).Options;function h(l){b.call(this,l,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var r=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||r;var s=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var a=0;a<s.length;a++)s[a]!=="expand"?this.brace_style="collapse":this.brace_style=s[a]}h.prototype=new b,O.exports.Options=h}],C={};function j(O){var S=C[O];if(S!==void 0)return S.exports;var _=C[O]={exports:{}};return L[O](_,_.exports,j),_.exports}var U=j(15);I=U})();var H=I;!(re=[],W=function(){return{css_beautify:H}}.apply(Ee,re),W!==void 0&&(Ge.exports=W))})()},WaYH:function(Ge,Ee,z){"use strict";var re=z("rePB"),W=z("Ff2n"),I=z("VTBJ"),H=z("1OyB"),L=z("vuIU"),C=z("JX7q"),j=z("Ji7U"),U=z("LK+K"),O=z("cDcd"),S=z("TSYQ"),_=z.n(S),b=z("sboe"),h=z("OZM5"),l=function(y){var v=y.prefixCls,d=y.level,u=y.isStart,i=y.isEnd;if(!d)return null;for(var o="".concat(v,"-indent-unit"),p=[],f=0;f<d;f+=1){var c;p.push(O.createElement("span",{key:f,className:_()(o,(c={},Object(re.a)(c,"".concat(o,"-start"),u[f+1]),Object(re.a)(c,"".concat(o,"-end"),i[f+1]),Object(re.a)(c,"".concat(o,"-end-first-level"),!f&&i[0]),c))}))}return O.createElement("span",{"aria-hidden":"true",className:"".concat(v,"-indent")},p)},r=l,s=z("815F"),a="open",e="close",t="---",n=function(g){Object(j.a)(v,g);var y=Object(U.a)(v);function v(){var d;return Object(H.a)(this,v),d=y.apply(this,arguments),d.state={dragNodeHighlight:!1},d.onSelectorClick=function(u){var i=d.props.context.onNodeClick;i(u,Object(s.b)(d.props)),d.isSelectable()?d.onSelect(u):d.onCheck(u)},d.onSelectorDoubleClick=function(u){var i=d.props.context.onNodeDoubleClick;i(u,Object(s.b)(d.props))},d.onSelect=function(u){if(d.isDisabled())return;var i=d.props.context.onNodeSelect;u.preventDefault(),i(u,Object(s.b)(d.props))},d.onCheck=function(u){if(d.isDisabled())return;var i=d.props,o=i.disableCheckbox,p=i.checked,f=d.props.context.onNodeCheck;if(!d.isCheckable()||o)return;u.preventDefault();var c=!p;f(u,Object(s.b)(d.props),c)},d.onMouseEnter=function(u){var i=d.props.context.onNodeMouseEnter;i(u,Object(s.b)(d.props))},d.onMouseLeave=function(u){var i=d.props.context.onNodeMouseLeave;i(u,Object(s.b)(d.props))},d.onContextMenu=function(u){var i=d.props.context.onNodeContextMenu;i(u,Object(s.b)(d.props))},d.onDragStart=function(u){var i=d.props.context.onNodeDragStart;u.stopPropagation(),d.setState({dragNodeHighlight:!0}),i(u,Object(C.a)(d));try{u.dataTransfer.setData("text/plain","")}catch(o){}},d.onDragEnter=function(u){var i=d.props.context.onNodeDragEnter;u.preventDefault(),u.stopPropagation(),i(u,Object(C.a)(d))},d.onDragOver=function(u){var i=d.props.context.onNodeDragOver;u.preventDefault(),u.stopPropagation(),i(u,Object(C.a)(d))},d.onDragLeave=function(u){var i=d.props.context.onNodeDragLeave;u.stopPropagation(),i(u,Object(C.a)(d))},d.onDragEnd=function(u){var i=d.props.context.onNodeDragEnd;u.stopPropagation(),d.setState({dragNodeHighlight:!1}),i(u,Object(C.a)(d))},d.onDrop=function(u){var i=d.props.context.onNodeDrop;u.preventDefault(),u.stopPropagation(),d.setState({dragNodeHighlight:!1}),i(u,Object(C.a)(d))},d.onExpand=function(u){var i=d.props.context.onNodeExpand;i(u,Object(s.b)(d.props))},d.setSelectHandle=function(u){d.selectHandle=u},d.getNodeState=function(){var u=d.props.expanded;return d.isLeaf()?null:u?a:e},d.hasChildren=function(){var u=d.props.eventKey,i=d.props.context.keyEntities,o=i[u]||{},p=o.children;return!!(p||[]).length},d.isLeaf=function(){var u=d.props,i=u.isLeaf,o=u.loaded,p=d.props.context.loadData,f=d.hasChildren();return i===!1?!1:i||!p&&!f||p&&o&&!f},d.isDisabled=function(){var u=d.props.disabled,i=d.props.context.disabled;return!!(i||u)},d.isCheckable=function(){var u=d.props.checkable,i=d.props.context.checkable;return!i||u===!1?!1:i},d.syncLoadData=function(u){var i=u.expanded,o=u.loading,p=u.loaded,f=d.props.context,c=f.loadData,w=f.onNodeLoad;if(o)return;c&&i&&!d.isLeaf()&&(!d.hasChildren()&&!p&&w(Object(s.b)(d.props)))},d.renderSwitcher=function(){var u=d.props,i=u.expanded,o=u.switcherIcon,p=d.props.context,f=p.prefixCls,c=p.switcherIcon,w=o||c;if(d.isLeaf())return O.createElement("span",{className:_()("".concat(f,"-switcher"),"".concat(f,"-switcher-noop"))},typeof w=="function"?w(Object(I.a)(Object(I.a)({},d.props),{},{isLeaf:!0})):w);var A=_()("".concat(f,"-switcher"),"".concat(f,"-switcher_").concat(i?a:e));return O.createElement("span",{onClick:d.onExpand,className:A},typeof w=="function"?w(Object(I.a)(Object(I.a)({},d.props),{},{isLeaf:!1})):w)},d.renderCheckbox=function(){var u=d.props,i=u.checked,o=u.halfChecked,p=u.disableCheckbox,f=d.props.context.prefixCls,c=d.isDisabled(),w=d.isCheckable();if(!w)return null;var A=typeof w!="boolean"?w:null;return O.createElement("span",{className:_()("".concat(f,"-checkbox"),i&&"".concat(f,"-checkbox-checked"),!i&&o&&"".concat(f,"-checkbox-indeterminate"),(c||p)&&"".concat(f,"-checkbox-disabled")),onClick:d.onCheck},A)},d.renderIcon=function(){var u=d.props.loading,i=d.props.context.prefixCls;return O.createElement("span",{className:_()("".concat(i,"-iconEle"),"".concat(i,"-icon__").concat(d.getNodeState()||"docu"),u&&"".concat(i,"-icon_loading"))})},d.renderSelector=function(){var u=d.state.dragNodeHighlight,i=d.props,o=i.title,p=i.selected,f=i.icon,c=i.loading,w=i.data,A=d.props.context,P=A.prefixCls,N=A.showIcon,B=A.icon,R=A.draggable,F=A.loadData,K=A.titleRender,X=d.isDisabled(),ee="".concat(P,"-node-content-wrapper"),oe;if(N){var ce=f||B;oe=ce?O.createElement("span",{className:_()("".concat(P,"-iconEle"),"".concat(P,"-icon__customize"))},typeof ce=="function"?ce(d.props):ce):d.renderIcon()}else F&&c&&(oe=d.renderIcon());var le;typeof o=="function"?le=o(w):K?le=K(w):le=o;var be=O.createElement("span",{className:"".concat(P,"-title")},le);return O.createElement("span",{ref:d.setSelectHandle,title:typeof o=="string"?o:"",className:_()("".concat(ee),"".concat(ee,"-").concat(d.getNodeState()||"normal"),!X&&(p||u)&&"".concat(P,"-node-selected"),!X&&R&&"draggable"),draggable:!X&&R||void 0,"aria-grabbed":!X&&R||void 0,onMouseEnter:d.onMouseEnter,onMouseLeave:d.onMouseLeave,onContextMenu:d.onContextMenu,onClick:d.onSelectorClick,onDoubleClick:d.onSelectorDoubleClick,onDragStart:R?d.onDragStart:void 0},oe,be)},d}return Object(L.a)(v,[{key:"componentDidMount",value:function(){this.syncLoadData(this.props)}},{key:"componentDidUpdate",value:function(){this.syncLoadData(this.props)}},{key:"isSelectable",value:function(){var u=this.props.selectable,i=this.props.context.selectable;return typeof u=="boolean"?u:i}},{key:"render",value:function(){var u,i=this.props,o=i.eventKey,p=i.className,f=i.style,c=i.dragOver,w=i.dragOverGapTop,A=i.dragOverGapBottom,P=i.isLeaf,N=i.isStart,B=i.isEnd,R=i.expanded,F=i.selected,K=i.checked,X=i.halfChecked,ee=i.loading,oe=i.domRef,ce=i.active,le=i.onMouseMove,be=Object(W.a)(i,["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","onMouseMove"]),pe=this.props.context,de=pe.prefixCls,te=pe.filterTreeNode,Le=pe.draggable,Ve=pe.keyEntities,Ne=this.isDisabled(),Be=Object(h.f)(be),ve=Ve[o]||{},ye=ve.level,Ie=B[B.length-1];return O.createElement("div",Object.assign({ref:oe,className:_()(p,"".concat(de,"-treenode"),(u={},Object(re.a)(u,"".concat(de,"-treenode-disabled"),Ne),Object(re.a)(u,"".concat(de,"-treenode-switcher-").concat(R?"open":"close"),!P),Object(re.a)(u,"".concat(de,"-treenode-checkbox-checked"),K),Object(re.a)(u,"".concat(de,"-treenode-checkbox-indeterminate"),X),Object(re.a)(u,"".concat(de,"-treenode-selected"),F),Object(re.a)(u,"".concat(de,"-treenode-loading"),ee),Object(re.a)(u,"".concat(de,"-treenode-active"),ce),Object(re.a)(u,"".concat(de,"-treenode-leaf-last"),Ie),Object(re.a)(u,"drag-over",!Ne&&c),Object(re.a)(u,"drag-over-gap-top",!Ne&&w),Object(re.a)(u,"drag-over-gap-bottom",!Ne&&A),Object(re.a)(u,"filter-node",te&&te(Object(s.b)(this.props))),u)),style:f,onDragEnter:Le?this.onDragEnter:void 0,onDragOver:Le?this.onDragOver:void 0,onDragLeave:Le?this.onDragLeave:void 0,onDrop:Le?this.onDrop:void 0,onDragEnd:Le?this.onDragEnd:void 0,onMouseMove:le},Be),O.createElement(r,{prefixCls:de,level:ye,isStart:N,isEnd:B}),this.renderSwitcher(),this.renderCheckbox(),this.renderSelector())}}]),v}(O.Component),x=function(y){return O.createElement(b.a.Consumer,null,function(v){return O.createElement(n,Object.assign({},y,{context:v}))})};x.displayName="TreeNode",x.defaultProps={title:t},x.isTreeNode=1;var E=Ee.a=x},ZW9T:function(Ge,Ee,z){"use strict";z.d(Ee,"a",function(){return N});var re=z("k1fw"),W=z("miYZ"),I=z("tsqr"),H=z("rAM+"),L=z("tJVT"),C=z("PpiC"),j=z("cDcd"),U=z.n(j),O=z("bdgK"),S=z("oBTY"),_=z("9og8"),b=z("WmNS"),h=z.n(b),l={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"]},r={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"]},s={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(`
|
|
`)}]},a={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=z("5VLF"),t=z.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"]}},x=function(R,F){return F.map(function(K){return{label:K,kind:R.languages.CompletionItemKind.Keyword,insertText:K}})},E=function(R){return Object.keys(n.tables).map(function(F){return{label:F,kind:R.languages.CompletionItemKind.Variable,insertText:F}})},g=function(R,F){var K=n.tables[R];return K?K.map(function(X){return{label:X,kind:F.languages.CompletionItemKind.Field,insertText:X}}):[]};function y(B,R,F,K,X){var ee=R.getWordUntilPosition(F),oe={startLineNumber:F.lineNumber,endLineNumber:F.lineNumber,startColumn:ee.startColumn,endColumn:ee.endColumn},ce=K.map(function(le){return{label:le,kind:B.languages.CompletionItemKind.Keyword,insertText:le,insertTextRules:B.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:oe}});return X.map(function(le){ce.push(Object(re.a)(Object(re.a)({},le),{},{range:oe}))}),ce}var v=function(B){n.languages.map(function(X){return B.languages.registerDocumentFormattingEditProvider(X,{provideDocumentFormattingEdits:function(oe,ce,le){return Object(_.a)(h.a.mark(function be(){var pe;return h.a.wrap(function(te){for(;;)switch(te.prev=te.next){case 0:return pe=t()(oe.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}),te.abrupt("return",[{range:oe.getFullModelRange(),text:pe}]);case 2:case"end":return te.stop()}},be)}))()}}),X});var R=s.quickKey.map(function(X){return{label:X.label,kind:B.languages.CompletionItemKind.Method,insertText:X.content,insertTextRules:B.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),F=a.quickKey.map(function(X){return{label:X.label,kind:B.languages.CompletionItemKind.Method,insertText:X.content,insertTextRules:B.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),K=r.quickKey.map(function(X){return{label:X.label,kind:B.languages.CompletionItemKind.Method,insertText:X.content,insertTextRules:B.languages.CompletionItemInsertTextRule.InsertAsSnippet}});B.languages.registerCompletionItemProvider("cpp",{triggerCharacters:["."," ","#"].concat(Object(S.a)(s.keywords),Object(S.a)(s.quickKey.map(function(X){return X.label}))),provideCompletionItems:function(ee,oe){var ce=ee.getValueInRange({startLineNumber:oe.lineNumber,startColumn:1,endLineNumber:oe.lineNumber,endColumn:oe.column}),le=ce.match(/cu/gim);console.log("match:",le,oe,ce,ee);var be=[],pe=oe.lineNumber,de=oe.column,te=ee.getValueInRange({startLineNumber:pe,startColumn:0,endLineNumber:pe,endColumn:de}),Le=te.trim().split(/\s+/),Ve=Le[Le.length-1];if(Ve.endsWith(".")){var Ne=Ve.slice(0,Ve.length-1);Object.keys(n.tables).includes(Ne)&&(be=Object(S.a)(g(Ne,B)))}else Ve==="."?be=[]:be=[].concat(Object(S.a)(E(B)),Object(S.a)(x(B,s.keywords)),Object(S.a)(R));return{suggestions:be}}}),B.languages.registerCompletionItemProvider("c",{triggerCharacters:["."," ","#"].concat(Object(S.a)(l.keywords)),provideCompletionItems:function(ee,oe){var ce=ee.getValueInRange({startLineNumber:oe.lineNumber,startColumn:1,endLineNumber:oe.lineNumber,endColumn:oe.column}),le=ce.match(/cu/gim);console.log("match:",le,oe,ce,ee);var be=[],pe=oe.lineNumber,de=oe.column,te=ee.getValueInRange({startLineNumber:pe,startColumn:0,endLineNumber:pe,endColumn:de}),Le=te.trim().split(/\s+/),Ve=Le[Le.length-1];if(Ve.endsWith(".")){var Ne=Ve.slice(0,Ve.length-1);Object.keys(n.tables).includes(Ne)&&(be=Object(S.a)(g(Ne,B)))}else Ve==="."?be=[]:be=[].concat(Object(S.a)(E(B)),Object(S.a)(x(B,l.keywords)));return{suggestions:be}}}),B.languages.registerCompletionItemProvider("java",{triggerCharacters:["."," "].concat(Object(S.a)(r.keywords)),provideCompletionItems:function(ee,oe){var ce=[],le=oe.lineNumber,be=oe.column,pe=ee.getValueInRange({startLineNumber:le,startColumn:0,endLineNumber:le,endColumn:be}),de=pe.trim().split(/\s+/),te=de[de.length-1];if(te.endsWith(".")){var Le=te.slice(0,te.length-1);Object.keys(n.tables).includes(Le)&&(ce=Object(S.a)(g(Le,B)))}else te==="."?ce=[]:ce=[].concat(Object(S.a)(E(B)),Object(S.a)(x(B,r.keywords)),Object(S.a)(K));return{suggestions:ce}}}),B.languages.registerCompletionItemProvider("python",{triggerCharacters:["."," "].concat(Object(S.a)(a.keywords)),provideCompletionItems:function(ee,oe){var ce=[],le=oe.lineNumber,be=oe.column,pe=ee.getValueInRange({startLineNumber:le,startColumn:0,endLineNumber:le,endColumn:be}),de=pe.trim().split(/\s+/),te=de[de.length-1];if(te.endsWith(".")){var Le=te.slice(0,te.length-1);Object.keys(n.tables).includes(Le)&&(ce=Object(S.a)(g(Le,B)))}else te==="."?ce=[]:ce=[].concat(Object(S.a)(E(B)),Object(S.a)(x(B,a.keywords)),Object(S.a)(F));return{suggestions:ce}}})},d="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",u=z("LvDl"),i=z("+ua5");function o(B){return/^\d+$/.test(B)?"".concat(B,"px"):B}function p(){}var f=!1,c={"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 w(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],R=B;if(Array.isArray(B)){for(var F=0;F<B.length;F++){var K=c[B[F]];if(K)return K}return R[0]}return c[R]||R}var A=null,P=Ee.b=function(B){var R=B.width,F=R===void 0?"100%":R,K=B.height,X=K===void 0?"100%":K,ee=B.value,oe=B.language,ce=oe===void 0?"javascript":oe,le=B.style,be=le===void 0?{}:le,pe=B.options,de=pe===void 0?{}:pe,te=B.overrideServices,Le=te===void 0?{}:te,Ve=B.theme,Ne=Ve===void 0?"vs-dark":Ve,Be=B.onEditBlur,ve=B.onSave,ye=B.autoHeight,Ie=ye===void 0?!1:ye,Ae=B.forbidCopy,ge=Ae===void 0?!1:Ae,Ce=B.onChange,Oe=Ce===void 0?p:Ce,Se=B.editorDidMount,De=Se===void 0?p:Se,je=B.onFocus,Me=je===void 0?p:je,Fe=B.filename,We=Fe===void 0?"educoder.txt":Fe,ze=B.errorLine,ne=B.errorContent,ue=ne===void 0?"":ne,me=Object(C.a)(B,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),_e=Object(j.useRef)(),se=Object(j.useRef)({}),fe=Object(j.useRef)(),Z=Object(j.useRef)(!1),Q=Object(j.useRef)(),$=Object(j.useState)(!1),V=Object(L.a)($,2),Y=V[0],J=V[1];function q(){var Te;return _e.current&&(Te=new O.default(function(Xe){var tt=Object(H.a)(Xe),Qe;try{for(tt.s();!(Qe=tt.n()).done;){var st=Qe.value;(st.target.offsetHeight>0||st.target.offsetWidth>0)&&se.current.instance.layout()}}catch(Rt){tt.e(Rt)}finally{tt.f()}}),Te.observe(_e.current)),Te}function ae(){I.b.warn(decodeURIComponent(d))}var he=function(){var Xe=se.current.instance;if(ee!=null&&Xe&&Y){var tt=Xe.getModel();tt&&ee!==tt.getValue()&&(f=!0,tt.setValue(ee),Xe.layout(),f=!1)}};Object(j.useEffect)(function(){fe.current&&clearTimeout(fe.current),fe.current=setTimeout(function(){he()},500)},[ee,Y,se.current]),Object(j.useEffect)(function(){if(ze&&se.current&&se.current.instance){var Te=se.current.instance;Te.changeViewZones(function(tt){var Qe=document.createElement("div");Qe.style.padding="10px 20px",Qe.style.width="calc(100% - 20px)",Qe.className="my-error-line-wrp",Qe.innerHTML=ue,tt.addZone({afterLineNumber:ze||11,heightInLines:3,domNode:Qe})});var Xe={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}};Te.addOverlayWidget(Xe),Te.revealPositionInCenter({lineNumber:20,column:1})}},[ze,se.current,Y]);function we(){var Te=se.current.instance;if(Te){var Xe=Te.getSelection(),tt=se.current.pastePos||{},Qe=new A.Range(tt.startLineNumber||Xe.endLineNumber,tt.startColumn||Xe.endColumn,tt.endLineNumber||Xe.endLineNumber,tt.endColumn||Xe.endColumn);setTimeout(function(){Te.executeEdits("",[{range:Qe,text:""}])},300)}}function Ue(Te){(window.navigator.platform.match("Mac")?Te.metaKey:Te.ctrlKey)&&Te.keyCode==83&&(Te.preventDefault(),ve())}var Ke=function(){if(Ie&&se.current.instance){var Xe=se.current.instance.getContentHeight();ot(Xe<X?X:Xe)}else ot(X)};function Pe(Te){var Xe=document.createEvent("MouseEvents");Xe.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),Te.dispatchEvent(Xe)}function et(Te,Xe){var tt=window.URL||window.webkitURL||window,Qe=new Blob([Xe]),st=document.createElementNS("http://www.w3.org/1999/xhtml","a");st.href=tt.createObjectURL(Qe),st.download=Te,Pe(st)}Object(j.useEffect)(function(){Ke()},[Ke]),Object(j.useEffect)(function(){_e.current&&!Y&&z.e(27).then(z.t.bind(null,"M/lh",7)).then(function(Te){try{A=Te,se.current.instance=A.editor.create(_e.current,{value:ee,language:w(ce),theme:Ne,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},Le);var Xe=se.current.instance;if(De(Xe,A),setTimeout(function(){Ke(),se.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){et(We||"educoder.txt",Xe.getValue())}})},500),se.current.subscription=Xe.onDidChangeModelContent(function(Qe){Z.current?clearTimeout(Q.current):(Ke(),Oe(Xe.getValue(),Qe)),Q.current=setTimeout(function(){Z.current=!1},500)}),window.Monaco||v(A),ge&&(Xe.addCommand(A.KeyMod.CtrlCmd|A.KeyMod.Shift|A.KeyCode.KEY_V,function(){return ae(),null}),Xe.addCommand(A.KeyMod.CtrlCmd|A.KeyCode.KEY_C,function(){return ae(),null})),window.Monaco=A,Be&&Xe.onDidBlurEditorWidget(function(){Be(Xe.getValue())}),Me&&Xe.onDidFocusEditorText(function(){Me(Xe.getValue())}),ge){Xe.addCommand(A.KeyMod.CtrlCmd|A.KeyCode.KEY_V,function(){return ae(),null}),Xe.onDidPaste(function(Qe){se.current.pastePos=Qe});try{window.addEventListener("paste",we)}catch(Qe){}}var tt=q();return J(!0),function(){var Qe=se.current.instance;Qe.dispose();var st=Qe.getModel();st&&st.dispose(),se.current.subscription&&se.current.subscription.dispose(),ge&&window.removeEventListener("paste",we),tt.unobserve(_e.current)}}catch(Qe){}})},[]),Object(j.useEffect)(function(){var Te=se.current.instance;if(Te&&Y)return document.addEventListener("keydown",Ue,!1),function(){document.removeEventListener("keydown",Ue)}},[ve,Y]),Object(j.useEffect)(function(){var Te=se.current.instance;if(Te&&Y){var Xe=w(ce);A.editor.setModelLanguage(Te.getModel(),Xe),console.log("language:",ce,Te.getModel(),Xe)}},[ce,Y]),Object(j.useEffect)(function(){var Te=se.current.instance;Te&&Y&&A.editor.setTheme(Ne)},[Ne,Y]),Object(j.useEffect)(function(){var Te=se.current.instance;Te&&Y&&(Te.updateOptions(Object(re.a)({},de)),setTimeout(function(){Te.getModel().updateOptions(Object(re.a)({},de))},200))},[JSON.stringify(de),Y]),Object(j.useEffect)(function(){var Te=se.current.instance;Te&&Y&&Te.layout()},[F,X,Y]);var $e=Object(j.useState)(o(F)),He=Object(L.a)($e,2),at=He[0],rt=He[1],it=Object(j.useState)(o(X)),ht=Object(L.a)(it,2),qe=ht[0],ot=ht[1],dt=Object(re.a)(Object(re.a)({},be),{},{width:at,height:qe});return U.a.createElement("div",{className:"my-monaco-editor",ref:_e,style:dt})};function N(B){var R=B.width,F=R===void 0?"100%":R,K=B.height,X=K===void 0?"100%":K,ee=B.original,oe=B.modified,ce=B.language,le=B.options,be=le===void 0?{}:le,pe=Object(j.useRef)(),de=Object(j.useState)(null),te=Object(L.a)(de,2),Le=te[0],Ve=te[1];function Ne(Ie){var Ae;return pe.current&&(Ae=new O.default(function(ge){var Ce=Object(H.a)(ge),Oe;try{for(Ce.s();!(Oe=Ce.n()).done;){var Se=Oe.value;(Se.target.offsetHeight>0||Se.target.offsetWidth>0)&&Ie.layout()}}catch(De){Ce.e(De)}finally{Ce.f()}}),Ae.observe(pe.current)),Ae}Object(j.useEffect)(function(){pe.current&&z.e(27).then(z.t.bind(null,"M/lh",7)).then(function(Ie){A=Ie;var Ae=A.editor.createDiffEditor(pe.current,Object(re.a)(Object(re.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},be),{},{wordWrap:!0}));Ve(Ae);var ge=Ne(Ae);return function(){Ae.dispose();var Ce=Ae.getModel();Ce&&Ce.dispose(),ge.unobserve(pe.current)}})},[]),Object(j.useEffect)(function(){Le&&Le.setModel({original:A.editor.createModel(ee,ce),modified:A.editor.createModel(oe,ce)})},[ee,oe,ce,Le]);var Be=o(F),ve=o(X),ye={width:Be,height:ve};return U.a.createElement("div",{className:"my-diff-editor",ref:pe,style:ye})}},bTeP:function(Ge,Ee,z){Ge.exports={flex_box_center:"flex_box_center___14Ki3",flex_space_between:"flex_space_between___3TSad",flex_box_vertical_center:"flex_box_vertical_center___3pQXk",flex_box_center_end:"flex_box_center_end___29_cn",flex_box_column:"flex_box_column___16am0",title:"title___2mVJs",workListTabWrap:"workListTabWrap___1JlOB",workListTabButton:"workListTabButton___3umfp",tables:"tables___hLy6a",checkboxgroup:"checkboxgroup___2xMgu"}},biw7:function(Ge,Ee,z){"use strict";var re=z("cDcd"),W=z.n(re),I=re.createContext(null);Ee.a=I},deN7:function(Ge,Ee,z){"use strict";var re=z("/zsF"),W=z("PArb"),I=z("14J3"),H=z("BMrR"),L=z("jCWc"),C=z("kPKH"),j=z("+L6B"),U=z("2/Rp"),O=z("miYZ"),S=z("tsqr"),_=z("9og8"),b=z("giR+"),h=z("fyUT"),l=z("2qtc"),r=z("kLXV"),s=z("7Kak"),a=z("9yH6"),e=z("tJVT"),t=z("k1fw"),n=z("OaEy"),x=z("2fM7"),E=z("WmNS"),g=z.n(E),y=z("cDcd"),v=z.n(y),d=z("ZW9T"),u=z("F0VM"),i=z.n(u),o=z("xKgJ"),p=z("J66h"),f=z.n(p),c=z("ErOA"),w=z("Ty5D"),A=z("9Bee"),P=z("XYT7"),N=z("RCxd"),B=z("/MfK"),R=x.a.Option,F={selectOnLineNumbers:!0,readOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,enableSplitViewResizing:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1},K;(function(ee){ee[ee.SET_PATH=0]="SET_PATH",ee[ee.GET_PASSED_CONTENT=1]="GET_PASSED_CONTENT"})(K||(K={}));function X(ee,oe){switch(oe.type){case K.SET_PATH:return Object(t.a)(Object(t.a)({},ee),{},{selectedPath:oe.payload});case K.GET_PASSED_CONTENT:return Object(t.a)(Object(t.a)({},ee),{},{passedContent:oe.payload});default:throw new Error}}Ee.a=function(ee){var oe=ee.language,ce=ee.dispatch,le=ee.shixunWorkReport,be=ee.v,pe=ee.languages,de=ee.onPathChange,te=ee.autoHeight,Le=ee.diff_code_count,Ve=ee.data,Ne=Object(y.useState)(pe==null?void 0:pe[0]),Be=Object(e.a)(Ne,2),ve=Be[0],ye=Be[1],Ie=le!="shixunWorkReport"&&Object(w.i)();return Object(y.useEffect)(function(){ye(pe==null?void 0:pe[0])},[]),Object(y.useEffect)(function(){var Ae;ye(pe==null||((Ae=pe.filter(function(ge){return ge.language===(ve==null?void 0:ve.language)}))===null||Ae===void 0)?void 0:Ae[0])},[pe]),v.a.createElement(v.a.Fragment,null,v.a.createElement("h2",null," ",v.a.createElement("span",null,v.a.createElement("span",null,"\u6700\u540E\u901A\u5173\u7684\u4EE3\u7801"),(pe==null?void 0:pe.length)>1&&v.a.createElement(a.a.Group,{defaultValue:oe,style:{marginLeft:10},onChange:function(ge){var Ce;ye(pe==null||((Ce=pe.filter(function(Oe){return Oe.language===ge.target.value}))===null||Ce===void 0)?void 0:Ce[0])}},pe==null?void 0:pe.map(function(Ae){return v.a.createElement(a.a,{value:Ae==null?void 0:Ae.language},Ae==null?void 0:Ae.language)}))),Object(o.c)()&&le!="shixunWorkReport"&&v.a.createElement("span",null,v.a.createElement("span",null,"\u5F97\u5206 ",ve==null?void 0:ve.score,"/",ve==null?void 0:ve.total_score),v.a.createElement(U.a,{style:{margin:"0px 10px"},onClick:function(){var ge=ve==null?void 0:ve.score;r.a.confirm({title:"\u8C03\u5206",content:v.a.createElement("div",null,v.a.createElement("p",null,"\u5F97\u5206\uFF1A",ve==null?void 0:ve.score,"/",ve==null?void 0:ve.total_score),v.a.createElement("p",null,"\u8C03\u5206\uFF1A",v.a.createElement(h.a,{min:0,max:ve==null?void 0:ve.total_score,defaultValue:ve==null?void 0:ve.score,onChange:function(Oe){ge=Oe}}))),okText:"\u786E\u8BA4",onOk:function(){var Ce=Object(_.a)(g.a.mark(function Se(){var De;return g.a.wrap(function(Me){for(;;)switch(Me.prev=Me.next){case 0:return Me.next=2,Object(c.a)("/api/courses/".concat(Ie==null?void 0:Ie.coursesId,"/homework_commons/update_hack_score"),{method:"put",body:{course_id:Ie==null?void 0:Ie.coursesId,hack_user_code_id:ve==null?void 0:ve.hack_user_id,score:ge}});case 2:De=Me.sent,De.status===0&&(S.b.success("\u8C03\u5206\u6210\u529F"),ce({type:"shixunHomeworks/setActionTabs",payload:{}}),ce({type:"shixunHomeworks/getShixunWorkReports",payload:Object(t.a)({},Ie)}));case 4:case"end":return Me.stop()}},Se)}));function Oe(){return Ce.apply(this,arguments)}return Oe}(),cancelText:"\u53D6\u6D88"})},type:"primary"},"\u8C03\u5206"),Object(o.c)()&&le!="shixunWorkReport"&&v.a.createElement(U.a,{onClick:function(){ce({type:"shixunHomeworks/setActionTabs",payload:{key:"\u66F4\u6539\u70B9\u8BC4",selectArrs:{myshixun_identifier:le.user_id,type:"1",language:ve==null?void 0:ve.language,v:be,data:Object(t.a)({},le)}}})}},"\u70B9\u8BC4\u4EE3\u7801"))),v.a.createElement(d.b,{height:300,language:ve==null?void 0:ve.language,value:p.Base64.decode(ve==null?void 0:ve.code),autoHeight:te,theme:"default",options:F}),((ve==null?void 0:ve.comment)||(ve==null?void 0:ve.hidden_comment))&&v.a.createElement("div",null,v.a.createElement(H.a,{align:"middle",style:{borderTop:"1px solid #eee"}},v.a.createElement(C.a,{flex:1},v.a.createElement("h1",{className:i.a.title},"\u70B9\u8BC4\u5185\u5BB9")),v.a.createElement(C.a,{className:"pr30"},Object(o.c)()&&v.a.createElement(U.a,{onClick:Object(_.a)(g.a.mark(function Ae(){return g.a.wrap(function(Ce){for(;;)switch(Ce.prev=Ce.next){case 0:r.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",icon:v.a.createElement(N.a,null),content:"\u662F\u5426\u786E\u8BA4\u5220\u9664\uFF1F",onOk:function(){return Object(_.a)(g.a.mark(function Se(){var De;return g.a.wrap(function(Me){for(;;)switch(Me.prev=Me.next){case 0:return Me.next=2,Object(P.m)({comment_id:ve==null?void 0:ve.comment_id,homeworkId:Ie.homeworkId,type:"hack"});case 2:De=Me.sent,De.status===0&&(S.b.success("\u5220\u9664\u6210\u529F"),ce({type:"shixunHomeworks/getShixunWorkReports",payload:Object(t.a)({},Ie)}));case 4:case"end":return Me.stop()}},Se)}))()}});case 1:case"end":return Ce.stop()}},Ae)}))},v.a.createElement(B.a,null),"\u5220\u9664"))),v.a.createElement(W.a,{style:{margin:0}}),(ve==null?void 0:ve.comment)&&v.a.createElement("aside",{className:"pl30 pr30 mt20"},v.a.createElement("span",{className:"c-light-black font12"},"# \u5B66\u751F\u548C\u8BFE\u5802\u8001\u5E08\u53EF\u89C1"),v.a.createElement("br",null),v.a.createElement(A.a,{value:ve==null?void 0:ve.comment})),(ve==null?void 0:ve.hidden_comment)&&v.a.createElement("aside",{className:"pl30 pr30 mt20"},v.a.createElement("span",{className:"c-light-black font12"},"# \u4EC5\u8BFE\u5802\u8001\u5E08\u53EF\u89C1"),v.a.createElement("br",null),v.a.createElement(A.a,{value:ve==null?void 0:ve.hidden_comment}))))}},dmUQ:function(Ge,Ee,z){"use strict";var re=z("Ff2n"),W=z("rePB"),I=z("1OyB"),H=z("vuIU"),L=z("Ji7U"),C=z("md7G"),j=z("foSv"),U=z("cDcd"),O=z.n(U),S=z("TSYQ"),_=z.n(S),b=z("4IlW");function h(i,o){var p=Object.keys(i);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(i);o&&(f=f.filter(function(c){return Object.getOwnPropertyDescriptor(i,c).enumerable})),p.push.apply(p,f)}return p}function l(i){for(var o=1;o<arguments.length;o++){var p=arguments[o]!=null?arguments[o]:{};o%2?h(Object(p),!0).forEach(function(f){Object(W.a)(i,f,p[f])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(p)):h(Object(p)).forEach(function(f){Object.defineProperty(i,f,Object.getOwnPropertyDescriptor(p,f))})}return i}function r(i){var o=s();return function(){var f=Object(j.a)(i),c;if(o){var w=Object(j.a)(this).constructor;c=Reflect.construct(f,arguments,w)}else c=f.apply(this,arguments);return Object(C.a)(this,c)}}function s(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(i){return!1}}function a(){}function e(i){i.preventDefault()}var t=function(o){return o.replace(/[^\w.-]+/g,"")},n=200,x=600,E=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,g=function(o){return o!=null},y=function(o,p){return p===o||typeof p=="number"&&typeof o=="number"&&isNaN(p)&&isNaN(o)},v=function(i){Object(L.a)(p,i);var o=r(p);function p(f){var c;Object(I.a)(this,p),c=o.call(this,f),c.onKeyDown=function(P){var N=c.props,B=N.onKeyDown,R=N.onPressEnter;if(P.keyCode===b.a.UP){var F=c.getRatio(P);c.up(P,F,null),c.stop()}else if(P.keyCode===b.a.DOWN){var K=c.getRatio(P);c.down(P,K,null),c.stop()}else P.keyCode===b.a.ENTER&&R&&R(P);if(c.recordCursorPosition(),c.lastKeyCode=P.keyCode,B){for(var X=arguments.length,ee=new Array(X>1?X-1:0),oe=1;oe<X;oe++)ee[oe-1]=arguments[oe];B.apply(void 0,[P].concat(ee))}},c.onKeyUp=function(P){var N=c.props.onKeyUp;if(c.stop(),c.recordCursorPosition(),N){for(var B=arguments.length,R=new Array(B>1?B-1:0),F=1;F<B;F++)R[F-1]=arguments[F];N.apply(void 0,[P].concat(R))}},c.onChange=function(P){var N=c.props.onChange;c.state.focused&&(c.inputting=!0),c.rawInput=c.props.parser(c.getValueFromEvent(P)),c.setState({inputValue:c.rawInput}),N(c.toNumber(c.rawInput))},c.onMouseUp=function(){var P=c.props.onMouseUp;c.recordCursorPosition(),P&&P.apply(void 0,arguments)},c.onFocus=function(){var P;c.setState({focused:!0}),(P=c.props).onFocus.apply(P,arguments)},c.onBlur=function(){var P=c.props.onBlur;c.inputting=!1,c.setState({focused:!1});var N=c.getCurrentValidValue(c.state.inputValue),B=c.setValue(N,a);if(P){var R=c.input.value,F=c.getInputDisplayValue({focus:!1,value:B});c.input.value=F&&Number(F),P.apply(void 0,arguments),c.input.value=R}},c.getRatio=function(P){var N=1;return P.metaKey||P.ctrlKey?N=.1:P.shiftKey&&(N=10),N},c.getFullNum=function(P){return isNaN(P)?P:/e/i.test(String(P))?Number(P).toFixed(18).replace(/\.?0+$/,""):P},c.getPrecision=function(P){if(g(c.props.precision))return c.props.precision;var N=String(P);if(N.indexOf("e-")>=0)return parseInt(N.slice(N.indexOf("e-")+2),10);var B=0;return N.indexOf(".")>=0&&(B=N.length-N.indexOf(".")-1),B},c.getInputDisplayValue=function(P){var N=P||c.state,B=N.focused,R=N.inputValue,F=N.value,K;B?K=R:K=c.toPrecisionAsStep(F),K==null&&(K="");var X=c.formatWrapper(K);return g(c.props.decimalSeparator)&&(X=X.toString().replace(".",c.props.decimalSeparator)),X},c.recordCursorPosition=function(){try{c.cursorStart=c.input.selectionStart,c.cursorEnd=c.input.selectionEnd,c.currentValue=c.input.value,c.cursorBefore=c.input.value.substring(0,c.cursorStart),c.cursorAfter=c.input.value.substring(c.cursorEnd)}catch(P){}},c.restoreByAfter=function(P){if(P===void 0)return!1;var N=c.input.value,B=N.lastIndexOf(P);if(B===-1)return!1;var R=c.cursorBefore.length;return c.lastKeyCode===b.a.DELETE&&c.cursorBefore.charAt(R-1)===P[0]?(c.fixCaret(R,R),!0):B+P.length===N.length?(c.fixCaret(B,B),!0):!1},c.partRestoreByAfter=function(P){return P===void 0?!1:Array.prototype.some.call(P,function(N,B){var R=P.substring(B);return c.restoreByAfter(R)})},c.isNotCompleteNumber=function(P){return isNaN(P)||P===""||P===null||P&&P.toString().indexOf(".")===P.toString().length-1},c.stop=function(){c.autoStepTimer&&clearTimeout(c.autoStepTimer)},c.down=function(P,N,B){c.pressingUpOrDown=!0,c.step("down",P,N,B)},c.up=function(P,N,B){c.pressingUpOrDown=!0,c.step("up",P,N,B)},c.saveInput=function(P){c.input=P};var w=f.value;w===void 0&&(w=f.defaultValue),c.state={focused:f.autoFocus};var A=c.getValidValue(c.toNumber(w));return c.state=l(l({},c.state),{},{inputValue:c.toPrecisionAsStep(A),value:A}),c}return Object(H.a)(p,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(c){var w=this.props,A=w.value,P=w.onChange,N=w.max,B=w.min,R=this.state.focused;if(c){if(!y(c.value,A)||!y(c.max,N)||!y(c.min,B)){var F=R?A:this.getValidValue(A),K;this.pressingUpOrDown?K=F:this.inputting?K=this.rawInput:K=this.toPrecisionAsStep(F),this.setState({value:F,inputValue:K})}var X="value"in this.props?A:this.state.value;"max"in this.props&&c.max!==N&&typeof X=="number"&&X>N&&P&&P(N),"min"in this.props&&c.min!==B&&typeof X=="number"&&X<B&&P&&P(B)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var ee=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===b.a.BACKSPACE?ee=this.cursorStart-1:this.lastKeyCode===b.a.DELETE&&(ee=this.cursorStart):ee=this.input.value.length,this.fixCaret(ee,ee)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case b.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case b.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(oe){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(c){var w=c;return w===""?w="":this.isNotCompleteNumber(parseFloat(w))?w=this.state.value:w=this.getValidValue(w),this.toNumber(w)}},{key:"getValueFromEvent",value:function(c){var w=c.target.value.trim().replace(/。/g,".");return g(this.props.decimalSeparator)&&(w=w.replace(this.props.decimalSeparator,".")),w}},{key:"getValidValue",value:function(c){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,P=parseFloat(c);return isNaN(P)?c:(P<w&&(P=w),P>A&&(P=A),P)}},{key:"setValue",value:function(c,w){var A=this.props.precision,P=this.isNotCompleteNumber(parseFloat(c))?null:parseFloat(c),N=this.state.value,B=N===void 0?null:N,R=this.state.inputValue,F=R===void 0?null:R,K=typeof P=="number"?P.toFixed(A):"".concat(P),X=P!==B||K!=="".concat(F);return"value"in this.props?(F=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:F},w)):this.setState({value:P,inputValue:this.toPrecisionAsStep(c)},w),X&&this.props.onChange(P),P}},{key:"getMaxPrecision",value:function(c){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,A=this.props,P=A.precision,N=A.step;if(g(P))return P;var B=this.getPrecision(w),R=this.getPrecision(N),F=this.getPrecision(c);return c?Math.max(F,B+R):B+R}},{key:"getPrecisionFactor",value:function(c){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,A=this.getMaxPrecision(c,w);return Math.pow(10,A)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(c){return this.props.formatter?this.props.formatter(c):c}},{key:"toPrecisionAsStep",value:function(c){if(this.isNotCompleteNumber(c)||c==="")return c;var w=Math.abs(this.getMaxPrecision(c));return isNaN(w)?c.toString():Number(c).toFixed(w)}},{key:"toNumber",value:function(c){var w=this.props.precision,A=this.state.focused,P=c&&c.length>16&&A;return this.isNotCompleteNumber(c)||P?c:g(w)?Math.round(c*Math.pow(10,w))/Math.pow(10,w):Number(c)}},{key:"upStep",value:function(c,w){var A=this.props.step,P=this.getPrecisionFactor(c,w),N=Math.abs(this.getMaxPrecision(c,w)),B=((P*c+P*A*w)/P).toFixed(N);return this.toNumber(B)}},{key:"downStep",value:function(c,w){var A=this.props.step,P=this.getPrecisionFactor(c,w),N=Math.abs(this.getMaxPrecision(c,w)),B=((P*c-P*A*w)/P).toFixed(N);return this.toNumber(B)}},{key:"step",value:function(c,w){var A=this,P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,N=arguments.length>3?arguments[3]:void 0;this.stop(),w&&(w.persist(),w.preventDefault());var B=this.props;if(B.disabled)return;var R=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(R))return;var F=this["".concat(c,"Step")](R,P),K=F>B.max||F<B.min;if(F>B.max?F=B.max:F<B.min&&(F=B.min),this.setValue(F,null),this.setState({focused:!0},function(){A.pressingUpOrDown=!1}),K)return;this.autoStepTimer=setTimeout(function(){A[c](w,P,!0)},N?n:x)}},{key:"fixCaret",value:function(c,w){if(c===void 0||w===void 0||!this.input||!this.input.value)return;try{var A=this.input.selectionStart,P=this.input.selectionEnd;(c!==A||w!==P)&&this.input.setSelectionRange(c,w)}catch(N){}}},{key:"render",value:function(){var c,w=this.props,A=w.prefixCls,P=w.disabled,N=w.readOnly,B=w.useTouch,R=w.autoComplete,F=w.upHandler,K=w.downHandler,X=w.className,ee=w.max,oe=w.min,ce=w.style,le=w.title,be=w.onMouseEnter,pe=w.onMouseLeave,de=w.onMouseOver,te=w.onMouseOut,Le=w.required,Ve=w.onClick,Ne=w.tabIndex,Be=w.type,ve=w.placeholder,ye=w.id,Ie=w.inputMode,Ae=w.pattern,ge=w.step,Ce=w.maxLength,Oe=w.autoFocus,Se=w.name,De=w.onPaste,je=w.onInput,Me=Object(re.a)(w,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),Fe=this.state,We=Fe.value,ze=Fe.focused,ne=_()(A,(c={},Object(W.a)(c,X,!!X),Object(W.a)(c,"".concat(A,"-disabled"),P),Object(W.a)(c,"".concat(A,"-focused"),ze),c)),ue={};Object.keys(Me).forEach(function(q){(q.substr(0,5)==="data-"||q.substr(0,5)==="aria-"||q==="role")&&(ue[q]=Me[q])});var me=!N&&!P,_e=this.getInputDisplayValue(null),se=(We||We===0)&&(isNaN(We)||Number(We)>=ee),fe=(We||We===0)&&(isNaN(We)||Number(We)<=oe),Z=se||P||N,Q=fe||P||N,$=_()("".concat(A,"-handler"),"".concat(A,"-handler-up"),Object(W.a)({},"".concat(A,"-handler-up-disabled"),Z)),V=_()("".concat(A,"-handler"),"".concat(A,"-handler-down"),Object(W.a)({},"".concat(A,"-handler-down-disabled"),Q)),Y=B?{onTouchStart:Z?a:this.up,onTouchEnd:this.stop}:{onMouseDown:Z?a:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},J=B?{onTouchStart:Q?a:this.down,onTouchEnd:this.stop}:{onMouseDown:Q?a:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return O.a.createElement("div",{className:ne,style:ce,title:le,onMouseEnter:be,onMouseLeave:pe,onMouseOver:de,onMouseOut:te,onFocus:function(){return null},onBlur:function(){return null}},O.a.createElement("div",{className:"".concat(A,"-handler-wrap")},O.a.createElement("span",Object.assign({unselectable:"on"},Y,{role:"button","aria-label":"Increase Value","aria-disabled":Z,className:$}),F||O.a.createElement("span",{unselectable:"on",className:"".concat(A,"-handler-up-inner"),onClick:e})),O.a.createElement("span",Object.assign({unselectable:"on"},J,{role:"button","aria-label":"Decrease Value","aria-disabled":Q,className:V}),K||O.a.createElement("span",{unselectable:"on",className:"".concat(A,"-handler-down-inner"),onClick:e}))),O.a.createElement("div",{className:"".concat(A,"-input-wrap")},O.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":oe,"aria-valuemax":ee,"aria-valuenow":We,required:Le,type:Be,placeholder:ve,onPaste:De,onClick:Ve,onMouseUp:this.onMouseUp,className:"".concat(A,"-input"),tabIndex:Ne,autoComplete:R,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:me?this.onKeyDown:a,onKeyUp:me?this.onKeyUp:a,autoFocus:Oe,maxLength:Ce,readOnly:N,disabled:P,max:ee,min:oe,step:ge,name:Se,title:le,id:ye,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(_e),pattern:Ae,inputMode:Ie,onInput:je},ue))))}}]),p}(O.a.Component);v.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:E,min:-E,step:1,style:{},onChange:a,onKeyDown:a,onPressEnter:a,onFocus:a,onBlur:a,parser:t,required:!1,autoComplete:"off"};var d=v,u=Ee.a=d},fyJ8:function(Ge,Ee,z){"use strict";var re=z("rePB"),W=z("VTBJ"),I=z("Ff2n"),H=z("U8pU"),L=z("cDcd"),C=z.n(L),j=z("TSYQ"),U=z.n(j),O=z("c+Xe"),S=z("sR1s");function _(s){return s&&Object(H.a)(s)==="object"&&!Array.isArray(s)&&!L.isValidElement(s)}function b(s){return typeof s=="string"?!0:Object(O.c)(s)}function h(s,a){var e,t=s.prefixCls,n=s.className,x=s.record,E=s.index,g=s.dataIndex,y=s.render,v=s.children,d=s.component,u=d===void 0?"td":d,i=s.colSpan,o=s.rowSpan,p=s.fixLeft,f=s.fixRight,c=s.firstFixLeft,w=s.lastFixLeft,A=s.firstFixRight,P=s.lastFixRight,N=s.appendNode,B=s.additionalProps,R=B===void 0?{}:B,F=s.ellipsis,K=s.align,X=s.rowType,ee=s.isSticky,oe="".concat(t,"-cell"),ce,le;if(v)le=v;else{var be=Object(S.b)(x,g);if(le=be,y){var pe=y(be,x,E);_(pe)?(le=pe.children,ce=pe.props):le=pe}}Object(H.a)(le)==="object"&&!Array.isArray(le)&&!L.isValidElement(le)&&(le=null),F&&(w||A)&&(le=L.createElement("span",{className:"".concat(oe,"-content")},le));var de=ce||{},te=de.colSpan,Le=de.rowSpan,Ve=de.style,Ne=de.className,Be=Object(I.a)(de,["colSpan","rowSpan","style","className"]),ve=te!==void 0?te:i,ye=Le!==void 0?Le:o;if(ve===0||ye===0)return null;var Ie={},Ae=typeof p=="number",ge=typeof f=="number";Ae&&(Ie.position="sticky",Ie.left=p),ge&&(Ie.position="sticky",Ie.right=f);var Ce={};K&&(Ce.textAlign=K);var Oe,Se=F===!0?{showTitle:!0}:F;Se&&(Se.showTitle||X==="header")&&(typeof le=="string"||typeof le=="number"?Oe=le.toString():L.isValidElement(le)&&typeof le.props.children=="string"&&(Oe=le.props.children));var De=Object(W.a)(Object(W.a)(Object(W.a)({title:Oe},Be),R),{},{colSpan:ve&&ve!==1?ve:null,rowSpan:ye&&ye!==1?ye:null,className:U()(oe,n,(e={},Object(re.a)(e,"".concat(oe,"-fix-left"),Ae),Object(re.a)(e,"".concat(oe,"-fix-left-first"),c),Object(re.a)(e,"".concat(oe,"-fix-left-last"),w),Object(re.a)(e,"".concat(oe,"-fix-right"),ge),Object(re.a)(e,"".concat(oe,"-fix-right-first"),A),Object(re.a)(e,"".concat(oe,"-fix-right-last"),P),Object(re.a)(e,"".concat(oe,"-ellipsis"),F),Object(re.a)(e,"".concat(oe,"-with-append"),N),Object(re.a)(e,"".concat(oe,"-fix-sticky"),(Ae||ge)&&ee),e),R.className,Ne),style:Object(W.a)(Object(W.a)(Object(W.a)(Object(W.a)({},R.style),Ce),Ie),Ve),ref:b(u)?a:null});return L.createElement(u,Object.assign({},De),N,le)}var l=L.forwardRef(h);l.displayName="Cell";var r=L.memo(l,function(s,a){return a.shouldCellUpdate?!a.shouldCellUpdate(a.record,s.record):!1});Ee.a=r},hW8S:function(Ge,Ee,z){"use strict";z.d(Ee,"a",function(){return H}),z.d(Ee,"c",function(){return L}),z.d(Ee,"b",function(){return C});var re=z("VTBJ"),W=z("Ff2n"),I=z("Kwbf"),H="RC_TABLE_INTERNAL_COL_DEFINE";function L(j){var U=j.expandable,O=Object(W.a)(j,["expandable"]);return"expandable"in j?Object(re.a)(Object(re.a)({},O),U):O}function C(j){return Object.keys(j).reduce(function(U,O){return(O.substr(0,5)==="data-"||O.substr(0,5)==="aria-")&&(U[O]=j[O]),U},{})}},mauG:function(Ge,Ee,z){"use strict";z.r(Ee);var re=z("DjyN"),W=z("NUBc"),I=z("g9YV"),H=z("wCAj"),L=z("2qtc"),C=z("kLXV"),j=z("miYZ"),U=z("tsqr"),O=z("7Kak"),S=z("9yH6"),_=z("sRBo"),b=z("kaz8"),h=z("oBTY"),l=z("/zsF"),r=z("PArb"),s=z("+L6B"),a=z("2/Rp"),e=z("9og8"),t=z("k1fw"),n=z("tJVT"),x=z("WmNS"),E=z.n(x),g=z("cDcd"),y=z.n(g),v=z("Ty5D"),d=z("55Ip"),u=z("9kvl"),i=z("xKgJ"),o=z("bTeP"),p=z.n(o),f=z("ErOA"),c=z("jhfD"),w=z("m3rI"),A=z("deN7"),P=z("J66h"),N=z.n(P),B=z("mgmH"),R=z("sZk2"),F=z.n(R),K=z("+92d"),X=z.n(K),ee=z("wwSX"),oe=z.n(ee),ce=z("zlzj"),le=z.n(ce),be=[X.a,oe.a,le.a],pe=function(te){var Le,Ve,Ne,Be,ve,ye=te.user,Ie=Object(g.useState)(Object(t.a)(Object(t.a)({},Object(v.i)()),{},{page:1,per_page:10,rank_type:2,course_group:Object(i.s)()?[ye.userInfo.course.course_group_id]:[]})),Ae=Object(n.a)(Ie,2),ge=Ae[0],Ce=Ae[1],Oe=Object(g.useState)([]),Se=Object(n.a)(Oe,2),De=Se[0],je=Se[1],Me=Object(g.useState)([]),Fe=Object(n.a)(Me,2),We=Fe[0],ze=Fe[1],ne=Object(g.useState)([]),ue=Object(n.a)(ne,2),me=ue[0],_e=ue[1];Object(g.useEffect)(function(){var Z;ye!=null&&(Z=ye.userInfo)!==null&&Z!==void 0&&Z.course&&(Object(i.s)()&&(ge.course_group=Object(i.s)()?[ye.userInfo.course.course_group_id]:[],Ce(Object(t.a)({},ge))),se(1))},[ye==null?void 0:ye.userInfo]);function se(Z){return fe.apply(this,arguments)}function fe(){return fe=Object(e.a)(E.a.mark(function Z(Q){var $,V,Y;return E.a.wrap(function(q){for(;;)switch(q.prev=q.next){case 0:return q.next=2,Object(f.a)("/api/courses/question_rank_list.json",{method:"get",params:Object(t.a)(Object(t.a)({},ge),{},{id:ge.coursesId,identifier:ge.homeworkId})});case 2:$=q.sent,je($),Object(i.s)()?(Q===1&&ze([$==null||((V=$.course_group)===null||V===void 0||((Y=V[0])===null||Y===void 0))?void 0:Y.id]),$!=null&&$.my_rank?_e([$==null?void 0:$.my_rank].concat(Object(h.a)($==null?void 0:$.rank_list))):_e(Object(h.a)($==null?void 0:$.rank_list))):_e(Object(h.a)($==null?void 0:$.rank_list));case 5:case"end":return q.stop()}},Z)})),fe.apply(this,arguments)}return y.a.createElement("div",{style:{width:1200,margin:"0px auto"}},y.a.createElement("aside",{className:[p.a.title,"mt20"].join(" ")},y.a.createElement(d.a,{to:"/classrooms/".concat(ge.coursesId,"/program_homework/").concat(ge.categoryId,"/detail")},y.a.createElement(c.a,{className:"font16 c-black"})),y.a.createElement("strong",{className:"font20 ml5"},"\u6392\u884C\u699C ",y.a.createElement("span",{style:{fontSize:14,color:"#B1BACD"}},"\u6392\u884C\u89C4\u5219\uFF1A\u5728\u8FD0\u884C\u65F6\u95F4\u76F8\u540C\u65F6\uFF0C\u5C06\u6839\u636E\u8FD0\u884C\u5185\u5B58\u3001\u63D0\u4EA4\u65F6\u95F4\u4F9D\u6B21\u8FDB\u884C\u6392\u5E8F")),y.a.createElement("span",{style:{color:"#0152d9",textAlign:"end",flex:1,cursor:"pointer"}},y.a.createElement(a.a,{style:{marginRight:10},onClick:Object(e.a)(E.a.mark(function Z(){var Q;return E.a.wrap(function(V){for(;;)switch(V.prev=V.next){case 0:return V.next=2,Object(f.a)("/api/problems/".concat(ge.homeworkId,"/start.json"),{method:"get"});case 2:Q=V.sent,Q&&(window.open("/myproblems/".concat(Q==null?void 0:Q.identifier,"?type=1")),localStorage.setItem("program_homework",[ge.coursesId,ge.categoryId]));case 4:case"end":return V.stop()}},Z)}))},"\u67E5\u770B\u9898\u76EE"),Object(i.c)()&&y.a.createElement(a.a,{onClick:function(){Object(B.u)(Object(t.a)(Object(t.a)({},ge),{},{id:ge.coursesId,identifier:ge.homeworkId}))}},"\u5BFC\u51FA"))),y.a.createElement("div",{style:{background:"#fff",marginTop:10,padding:40}},y.a.createElement("div",null,y.a.createElement("p",{style:{color:"#165DFF",fontSize:18,fontWeight:400}},y.a.createElement("img",{width:20,src:F.a,style:{marginRight:5}})," \u9898\u76EE\u6392\u884C\u699C")),y.a.createElement(r.a,null),y.a.createElement("div",{style:{display:"inline-flex"}},y.a.createElement("label",null,"\u5206\u73ED\u60C5\u51B5\uFF1A"),Object(i.c)()&&y.a.createElement("div",{style:{flex:1}},y.a.createElement(b.a.Group,{className:p.a.checkboxgroup,value:We,onChange:function(Q){if(ge.type===1)ze([]),ge.course_group=[],ge.page=1,Ce(Object(t.a)({},ge)),se();else if(ge.type===2){var $;ze(["\u5168\u90E8"].concat()),ge.course_group=De==null||(($=De.course_group)===null||$===void 0)?void 0:$.map(function(V){return V.id}),ge.page=1,Ce(Object(t.a)({},ge)),se()}else ze(Object(h.a)(Q.filter(function(V){return V!="\u5168\u90E8"}))),ge.course_group=Q.filter(function(V){return V!="\u5168\u90E8"}),ge.page=1,Ce(Object(t.a)({},ge)),se()}},y.a.createElement(b.a,{value:"\u5168\u90E8",onChange:function(Q){Q.target.checked?ge.type=2:ge.type=1}},"\u5168\u90E8\u5206\u73ED"),De==null||((Le=De.course_group)===null||Le===void 0)?void 0:Le.map(function(Z,Q){return y.a.createElement(b.a,{onChange:function(V){ge.type=3},value:Z.id},Z==null?void 0:Z.name)}))),Object(i.s)()&&y.a.createElement(S.a.Group,{style:{flex:1,display:"flex",alignItems:"center"},onChange:function(Q){Q.target.value==="\u5168\u90E8"?(ge.course_group=[],ge.page=1,Ce(Object(t.a)({},ge)),se()):(ge.course_group=[Q.target.value],ge.page=1,Ce(Object(t.a)({},ge)),se())},defaultValue:ye.userInfo.course.course_group_id},y.a.createElement(S.a,{value:"\u5168\u90E8"},"\u5168\u90E8\u5206\u73ED"),De==null||((Ve=De.course_group)===null||Ve===void 0)?void 0:Ve.map(function(Z,Q){return y.a.createElement(S.a,{value:Z.id},Z.name)}))),(De==null||((Ne=De.all_language)===null||Ne===void 0)?void 0:Ne.length)>1&&y.a.createElement("div",{style:{marginTop:10}},y.a.createElement("label",null,"\u7F16\u8BD1\u8BED\u8A00\uFF1A"),y.a.createElement(S.a.Group,{className:p.a.checkboxgroup,style:{width:"90%"},onChange:function(Q){ge.language=encodeURIComponent(Q.target.value),ge.page=1,Ce(Object(t.a)({},ge)),se()},defaultValue:De==null||((Be=De.all_language)===null||Be===void 0)?void 0:Be[0]},De==null||((ve=De.all_language)===null||ve===void 0)?void 0:ve.map(function(Z,Q){return y.a.createElement(S.a,{value:Z},Z)}))),y.a.createElement(H.a,{style:{marginTop:10},pagination:!1,dataSource:me,rowClassName:function(Q,$){return $===0&&Object(i.s)()&&p.a.tables},columns:[{title:"\u6392\u884C",dataIndex:"rank",render:function(Q,$,V){return Q<4?y.a.createElement("img",{src:be[Q-1]}):Q}},{title:"\u7528\u6237",dataIndex:"user_name",key:"user_name",render:function(Q,$,V){return y.a.createElement("div",null,y.a.createElement("img",{style:{width:30,height:30,borderRadius:"50%",marginRight:10},src:w.a.IMG_SERVER+"/images/"+($==null?void 0:$.image_url)}),Q)}},{title:"\u5B66\u53F7",dataIndex:"student_id",key:"student_id",render:function(Q){return Q||"- -"}},{title:"\u5206\u73ED",dataIndex:"course_group",key:"course_group"},{title:"\u63D0\u4EA4\u65F6\u95F4",dataIndex:"submit_time",key:"submit_time"},{title:"\u8FD0\u7528\u65F6\u95F4\uFF08ms\uFF09",dataIndex:"run_time",key:"run_time"},{title:"\u5185\u5B58\uFF08kb\uFF09",dataIndex:"memory",key:"memory"},{title:"\u7F16\u8BD1\u8BED\u8A00",dataIndex:"language",key:"language"},(De==null?void 0:De.open_code)&&{title:"\u64CD\u4F5C",dataIndex:"passed_rate",key:"passed_rate",render:function(Q,$){return y.a.createElement("div",{style:{cursor:"pointer",color:"rgb(22, 93, 255)"},onClick:Object(e.a)(E.a.mark(function V(){var Y;return E.a.wrap(function(q){for(;;)switch(q.prev=q.next){case 0:if(!(($==null?void 0:$.code)==="-")){q.next=3;break}return U.b.info("\u6682\u65E0\u4EE3\u7801"),q.abrupt("return");case 3:return q.next=5,Object(f.a)("/api/courses/view_code.json",{method:"get",params:Object(t.a)(Object(t.a)({},ge),{},{id:ge.coursesId,homework_common_id:ge.homeworkId,hack_user_code_id:$==null?void 0:$.hack_user_code_id})});case 5:Y=q.sent,C.a.warning({icon:null,title:"\u67E5\u770B\u4EE3\u7801",content:y.a.createElement(A.a,{languages:[{language:$.language,code:Y.code}],v:$,shixunWorkReport:"shixunWorkReport",dispatch:"dispatch",autoHeight:!1,language:$.language,game_id:$.id,data:P.Base64.decode(Y.code),diff_code_count:$.diff_code_count})});case 7:case"end":return q.stop()}},V)}))},"\u67E5\u770B\u4EE3\u7801")}}].filter(function(Z){return!!Z})}),y.a.createElement("div",{style:{width:"100%",textAlign:"center",marginTop:10}},y.a.createElement(W.a,{current:ge.page,pageSize:ge.per_page,total:De==null?void 0:De.count,hideOnSinglePage:!0,onChange:function(Q,$){ge.page=Q,ge.per_page=$,Ce(Object(t.a)({},ge)),se()}}))))};Ee.default=Object(u.a)(function(de){var te=de.user;return{user:te}})(pe)},mgmH:function(Ge,Ee,z){"use strict";z.d(Ee,"d",function(){return h}),z.d(Ee,"b",function(){return l}),z.d(Ee,"e",function(){return r}),z.d(Ee,"c",function(){return s}),z.d(Ee,"n",function(){return a}),z.d(Ee,"g",function(){return e}),z.d(Ee,"h",function(){return t}),z.d(Ee,"j",function(){return x}),z.d(Ee,"a",function(){return E}),z.d(Ee,"l",function(){return g}),z.d(Ee,"f",function(){return y}),z.d(Ee,"k",function(){return v}),z.d(Ee,"m",function(){return d}),z.d(Ee,"i",function(){return u}),z.d(Ee,"o",function(){return i}),z.d(Ee,"t",function(){return o}),z.d(Ee,"s",function(){return p}),z.d(Ee,"p",function(){return f}),z.d(Ee,"q",function(){return c}),z.d(Ee,"r",function(){return w}),z.d(Ee,"v",function(){return A}),z.d(Ee,"u",function(){return P});var re=z("miYZ"),W=z("tsqr"),I=z("k1fw"),H=z("9og8"),L=z("WmNS"),C=z.n(L),j=z("oUNq"),U=z("9kvl"),O=z("1vsH"),S=z("m3rI"),_=function(){Object(U.c)()._store.dispatch({type:"globalSetting/setGlobalLoading",payload:{show:!0,text:"\u6B63\u5728\u751F\u6210\u6587\u4EF6\uFF0C\u8BF7\u7A0D\u540E..."}})},b=function(){Object(U.c)()._store.dispatch({type:"globalSetting/setGlobalLoading",payload:{show:!1,text:""}})},h=function(){var N=Object(H.a)(C.a.mark(function B(R){var F;return C.a.wrap(function(X){for(;;)switch(X.prev=X.next){case 0:return _(),X.next=3,Object(j.t)(Object(I.a)({},R));case 3:if(F=X.sent,!(F.status===0)){X.next=7;break}return X.next=7,Object(O.w)("",Object(O.ab)({url:S.a.API_SERVER+"/api/courses/".concat(R.coursesId,"/export_couser_info.json"),query:R}));case 7:b();case 8:case"end":return X.stop()}},B)}));return function(R){return N.apply(this,arguments)}}(),l=function(){var N=Object(H.a)(C.a.mark(function B(R){var F;return C.a.wrap(function(X){for(;;)switch(X.prev=X.next){case 0:return X.next=2,Object(j.r)(Object(I.a)({},R));case 2:if(F=X.sent,!(F.status===0)){X.next=8;break}W.b.info("\u5BFC\u51FA\u4EFB\u52A1\u751F\u6210\u6210\u529F"),U.d.push("/classrooms/".concat(R.coursesId,"/exportlist/course_member_act_score")),X.next=13;break;case 8:if(!(F.status===-2)){X.next=12;break}return X.abrupt("return",F);case 12:F.status===-3&&(Object(U.c)()._store.dispatch({type:"classroomList/setActionTabs",payload:{key:"\u5BFC\u51FA\u63D0\u9192"}}),U.d.push("/classrooms/".concat(R.coursesId,"/exportlist/course_member_act_score")));case 13:case"end":return X.stop()}},B)}));return function(R){return N.apply(this,arguments)}}(),r=function(){var N=Object(H.a)(C.a.mark(function B(R){var F;return C.a.wrap(function(X){for(;;)switch(X.prev=X.next){case 0:return X.next=2,Object(j.u)(Object(I.a)({},R));case 2:if(F=X.sent,!(F.status===0)){X.next=8;break}W.b.info("\u5BFC\u51FA\u4EFB\u52A1\u751F\u6210\u6210\u529F"),U.d.push("/classrooms/".concat(R.coursesId,"/exportlist/course_total_score")),X.next=13;break;case 8:if(!(F.status===-2)){X.next=12;break}return X.abrupt("return",F);case 12:F.status===-3&&(Object(U.c)()._store.dispatch({type:"classroomList/setActionTabs",payload:{key:"\u5BFC\u51FA\u63D0\u9192"}}),U.d.push("/classrooms/".concat(R.coursesId,"/exportlist/course_total_score")));case 13:case"end":return X.stop()}},B)}));return function(R){return N.apply(this,arguments)}}(),s=function(){var N=Object(H.a)(C.a.mark(function B(R){var F;return C.a.wrap(function(X){for(;;)switch(X.prev=X.next){case 0:return X.next=2,Object(j.s)(Object(I.a)({},R));case 2:if(F=X.sent,!(F.status===0)){X.next=8;break}W.b.info("\u5BFC\u51FA\u4EFB\u52A1\u751F\u6210\u6210\u529F"),U.d.push("/classrooms/".concat(R.coursesId,"/exportlist/course_total_exercise_and_other")),X.next=13;break;case 8:if(!(F.status===-2)){X.next=12;break}return X.abrupt("return",F);case 12:F.status===-3&&(Object(U.c)()._store.dispatch({type:"classroomList/setActionTabs",payload:{key:"\u5BFC\u51FA\u63D0\u9192"}}),U.d.push("/classrooms/".concat(R.coursesId,"/exportlist/course_total_exercise_and_other")));case 13:case"end":return X.stop()}},B)}));return function(R){return N.apply(this,arguments)}}(),a=function(){var N=Object(H.a)(C.a.mark(function B(R){var F;return C.a.wrap(function(X){for(;;)switch(X.prev=X.next){case 0:return X.next=2,Object(j.z)(Object(I.a)({},R));case 2:if(F=X.sent,!(F.status===0)){X.next=8;break}W.b.info("\u5BFC\u51FA\u4EFB\u52A1\u751F\u6210\u6210\u529F"),U.d.push("/classrooms/".concat(R.coursesId,"/exportlist/course_total_exercise_and_other")),X.next=13;break;case 8:if(!(F.status===-2)){X.next=12;break}return X.abrupt("return",F);case 12:F.status===-3&&(Object(U.c)()._store.dispatch({type:"classroomList/setActionTabs",payload:{key:"\u5BFC\u51FA\u63D0\u9192"}}),U.d.push("/classrooms/".concat(R.coursesId,"/exportlist/course_total_exercise_and_other")));case 13:case"end":return X.stop()}},B)}));return function(R){return N.apply(this,arguments)}}(),e=function(){var N=Object(H.a)(C.a.mark(function B(R){var F;return C.a.wrap(function(X){for(;;)switch(X.prev=X.next){case 0:return X.next=2,Object(j.v)(Object(I.a)({},R));case 2:if(F=X.sent,!(F.status===0)){X.next=8;break}W.b.info("\u5BFC\u51FA\u4EFB\u52A1\u751F\u6210\u6210\u529F"),U.d.push("/classrooms/".concat(R.coursesId,"/exportlist/course_total_homework")),X.next=13;break;case 8:if(!(F.status===-2)){X.next=12;break}return X.abrupt("return",F);case 12:F.status===-3&&(Object(U.c)()._store.dispatch({type:"classroomList/setActionTabs",payload:{key:"\u5BFC\u51FA\u63D0\u9192"}}),U.d.push("/classrooms/".concat(R.coursesId,"/exportlist/course_total_homework")));case 13:case"end":return X.stop()}},B)}));return function(R){return N.apply(this,arguments)}}(),t=function(){var N=Object(H.a)(C.a.mark(function B(R,F){var K;return C.a.wrap(function(ee){for(;;)switch(ee.prev=ee.next){case 0:return ee.next=2,Object(j.x)(Object(I.a)({},R));case 2:K=ee.sent,K.status===0?(W.b.info("\u5BFC\u51FA\u4EFB\u52A1\u751F\u6210\u6210\u529F"),U.d.push("/classrooms/".concat(R.coursesId,"/exportlist/").concat(F))):K.status===-3&&(Object(U.c)()._store.dispatch({type:"classroomList/setActionTabs",payload:{key:"\u5BFC\u51FA\u63D0\u9192"}}),U.d.push("/classrooms/".concat(R.coursesId,"/exportlist/").concat(F)));case 4:case"end":return ee.stop()}},B)}));return function(R,F){return N.apply(this,arguments)}}(),n=function(){var N=Object(H.a)(C.a.mark(function B(R){var F;return C.a.wrap(function(X){for(;;)switch(X.prev=X.next){case 0:return _(),X.next=3,Object(j.w)(Object(I.a)({},R));case 3:if(F=X.sent,!(F.status===0)){X.next=7;break}return X.next=7,Object(O.w)("",Object(O.ab)({url:S.a.API_SERVER+"/api/homework_commons/".concat(R.categoryId,"/works_list.zip"),query:R}));case 7:b();case 8:case"end":return X.stop()}},B)}));return function(R){return N.apply(this,arguments)}}(),x=function(){var N=Object(H.a)(C.a.mark(function B(R){var F;return C.a.wrap(function(X){for(;;)switch(X.prev=X.next){case 0:return _(),X.next=3,Object(j.A)(Object(I.a)({},R));case 3:if(F=X.sent,!(F.status===0)){X.next=7;break}return X.next=7,Object(O.w)("",Object(O.ab)({url:S.a.API_SERVER+"/api/polls/".concat(R.categoryId,"/commit_result.xlsx"),query:R}));case 7:b();case 8:case"end":return X.stop()}},B)}));return function(R){return N.apply(this,arguments)}}(),E=function(){var N=Object(H.a)(C.a.mark(function B(R){return C.a.wrap(function(K){for(;;)switch(K.prev=K.next){case 0:return K.next=2,Object(O.v)("",Object(O.ab)({url:S.a.API_SERVER+"/api/courses/".concat(R.coursesId,"/attendances/export_xlsx_data.xlsx"),query:R}));case 2:case"end":return K.stop()}},B)}));return function(R){return N.apply(this,arguments)}}(),g=function(){var N=Object(H.a)(C.a.mark(function B(R){return C.a.wrap(function(K){for(;;)switch(K.prev=K.next){case 0:return K.next=2,Object(O.v)("",Object(O.ab)({url:S.a.API_SERVER+"/api/courses/".concat(R.coursesId,"/video_study_statics.xlsx"),query:R}));case 2:case"end":return K.stop()}},B)}));return function(R){return N.apply(this,arguments)}}(),y=function(){var N=Object(H.a)(C.a.mark(function B(R){return C.a.wrap(function(K){for(;;)switch(K.prev=K.next){case 0:return K.next=2,Object(O.v)("",Object(O.ab)({url:S.a.API_SERVER+"/api/courses/".concat(R.coursesId,"/export_course_students_info.xlsx"),query:R}));case 2:case"end":return K.stop()}},B)}));return function(R){return N.apply(this,arguments)}}(),v=function(){var N=Object(H.a)(C.a.mark(function B(R){return C.a.wrap(function(K){for(;;)switch(K.prev=K.next){case 0:return K.next=2,Object(O.v)("",Object(O.ab)({url:S.a.API_SERVER+"/api/item_banks/export.xlsx",query:R}));case 2:case"end":return K.stop()}},B)}));return function(R){return N.apply(this,arguments)}}(),d=function(){var N=Object(H.a)(C.a.mark(function B(R){return C.a.wrap(function(K){for(;;)switch(K.prev=K.next){case 0:return K.next=2,Object(O.v)("",Object(O.ab)({url:S.a.API_SERVER+"/api/competitions/region_reports.xlsx",query:R}));case 2:case"end":return K.stop()}},B)}));return function(R){return N.apply(this,arguments)}}(),u=function(){var N=Object(H.a)(C.a.mark(function B(R){var F;return C.a.wrap(function(X){for(;;)switch(X.prev=X.next){case 0:return X.next=2,Object(j.y)(Object(I.a)({},R));case 2:F=X.sent,F.status===0?(W.b.info("\u5BFC\u51FA\u4EFB\u52A1\u751F\u6210\u6210\u529F"),U.d.push("/classrooms/".concat(R.coursesId,"/exportlist/exercise_score"))):F.status===-3&&(Object(U.c)()._store.dispatch({type:"classroomList/setActionTabs",payload:{key:"\u5BFC\u51FA\u63D0\u9192"}}),U.d.push("/classrooms/".concat(R.coursesId,"/exportlist/exercise_score")));case 4:case"end":return X.stop()}},B)}));return function(R){return N.apply(this,arguments)}}(),i=function(){var N=Object(H.a)(C.a.mark(function B(R){return C.a.wrap(function(K){for(;;)switch(K.prev=K.next){case 0:return console.log("----------","\u8C03\u7528\u4E0B\u8F7D"),K.next=3,Object(O.v)("",Object(O.ab)({url:S.a.API_SERVER+"/api/export_records/".concat(R.id,".xlsx"),query:R}));case 3:case"end":return K.stop()}},B)}));return function(R){return N.apply(this,arguments)}}(),o=function(){var N=Object(H.a)(C.a.mark(function B(R){return C.a.wrap(function(K){for(;;)switch(K.prev=K.next){case 0:return K.next=2,Object(O.v)("",Object(O.ab)({url:S.a.API_SERVER+"/api/ec_major_schools/0/ec_years.xlsx",query:R}));case 2:case"end":return K.stop()}},B)}));return function(R){return N.apply(this,arguments)}}(),p=function(){var N=Object(H.a)(C.a.mark(function B(R){return C.a.wrap(function(K){for(;;)switch(K.prev=K.next){case 0:return K.next=2,Object(O.v)("",Object(O.ab)({url:S.a.API_SERVER+"/api/ec_years/".concat(R==null?void 0:R.ec_year_id,"/ec_training_objectives.xlsx"),query:R}));case 2:case"end":return K.stop()}},B)}));return function(R){return N.apply(this,arguments)}}(),f=function(){var N=Object(H.a)(C.a.mark(function B(R){return C.a.wrap(function(K){for(;;)switch(K.prev=K.next){case 0:return K.next=2,Object(O.v)(R==null?void 0:R.name,Object(O.ab)({url:S.a.API_SERVER+"/api/attachments/get_ecs_attachment.docx",query:R}));case 2:case"end":return K.stop()}},B)}));return function(R){return N.apply(this,arguments)}}(),c=function(){var N=Object(H.a)(C.a.mark(function B(R){return C.a.wrap(function(K){for(;;)switch(K.prev=K.next){case 0:return K.next=2,Object(O.v)("",Object(O.ab)({url:S.a.API_SERVER+"/api/ec_years/".concat(R==null?void 0:R.ec_year_id,"/ec_courses.xlsx"),query:R}));case 2:case"end":return K.stop()}},B)}));return function(R){return N.apply(this,arguments)}}(),w=function(){var N=Object(H.a)(C.a.mark(function B(R){return C.a.wrap(function(K){for(;;)switch(K.prev=K.next){case 0:return K.next=2,Object(O.v)("",Object(O.ab)({url:S.a.API_SERVER+"/api/ec_years/".concat(R==null?void 0:R.ec_year_id,"/ec_graduation_requirements.xlsx"),query:R}));case 2:case"end":return K.stop()}},B)}));return function(R){return N.apply(this,arguments)}}(),A=function(){var N=Object(H.a)(C.a.mark(function B(R){return C.a.wrap(function(K){for(;;)switch(K.prev=K.next){case 0:return K.next=2,Object(O.v)("",Object(O.ab)({url:S.a.API_SERVER+"/api/courses/rank_list.xlsx",query:R}));case 2:case"end":return K.stop()}},B)}));return function(R){return N.apply(this,arguments)}}(),P=function(){var N=Object(H.a)(C.a.mark(function B(R){return C.a.wrap(function(K){for(;;)switch(K.prev=K.next){case 0:return K.next=2,Object(O.v)("",Object(O.ab)({url:S.a.API_SERVER+"/api/courses/question_rank_list.xlsx",query:R}));case 2:case"end":return K.stop()}},B)}));return function(R){return N.apply(this,arguments)}}()},n6Qo:function(Ge,Ee,z){"use strict";z.d(Ee,"a",function(){return U});var re=z("cDcd"),W=z("biw7"),I=z("fyJ8");function H(O){var S=O.className,_=O.index,b=O.children,h=O.colSpan,l=O.rowSpan,r=re.useContext(W.a),s=r.prefixCls,a=r.fixedInfoList,e=a[_];return re.createElement(I.a,Object.assign({className:S,index:_,component:"td",prefixCls:s,record:null,dataIndex:null,render:function(){return{children:b,props:{colSpan:h,rowSpan:l}}}},e))}function L(O){return re.createElement("tr",Object.assign({},O))}function C(O){var S=O.children,_=re.useContext(W.a),b=_.prefixCls;return re.createElement("tfoot",{className:"".concat(b,"-summary")},S)}var j=Ee.b=C,U={Cell:H,Row:L}},p5ED:function(Ge,Ee,z){"use strict";var re=z("+L6B"),W=z("2/Rp"),I=z("5Dmo"),H=z("3S7+"),L=z("k1fw"),C=z("tJVT"),j=z("cDcd"),U=z.n(j),O=z("vHTk"),S=z.n(O),_=z("yEEn"),b=z("ZW9T"),h=z("1vsH");Ee.a=function(l){var r=l.name,s=l.data,a=l.theme,e=l.type,t=l.filename,n=l.monacoEditor,x=l.className,E=l.style,g=l.close,y=l.onClose,v=l.hasMask,d=Object(j.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),u=Object(C.a)(d,2),i=u[0],o=u[1],p=Object(j.useState)(""),f=Object(C.a)(p,2),c=f[0],w=f[1],A,P=1024*1024,N=10*P,B=Object(j.useRef)();e==="office"&&(A=Object(h.V)(s).filesize,A>N&&(e="other")),t&&(n.filename=t),Object(j.useEffect)(function(){var K,X,ee=(K=document.cookie)===null||K===void 0||((X=K.replace(/\s/g,""))===null||X===void 0)?void 0:X.split(";");ee==null||ee.map(function(oe){var ce=oe.split("=");ce[0]==="_educoder_session"&&w(ce[1])})},[]);var R=function(){if(s.startsWith("http")||s.startsWith("/")){F();return}Object(h.z)(t||"educoder",s,t)},F=function(){Object(h.x)(t||r,s)};return console.log("data:",s,"fileanme:",t," name:",r),U.a.createElement("div",{style:Object(L.a)({},E||{}),className:"".concat(v&&S.a.bgBlack," ").concat(e?S.a.wrp:"hide")},g&&U.a.createElement("div",{className:S.a.close,ref:B},U.a.createElement(H.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return B.current}},U.a.createElement("span",{onClick:F},U.a.createElement("i",{className:"icon-quxiaozhiding"}))),U.a.createElement(H.a,{title:"\u5173\u95ED",getPopupContainer:function(){return B.current}},U.a.createElement("span",{className:"",onClick:y},U.a.createElement("i",{className:"icon-guanbi1"})))),U.a.createElement("div",{className:"".concat(S.a[x]," ").concat(x," ").concat(S.a.monaco," ").concat(e==="txt"?"show":"hide")},e==="txt"&&U.a.createElement(b.b,n)),e==="audio"&&U.a.createElement("audio",{src:"".concat(s!=null&&s.startsWith("/")||(s==null?void 0:s.indexOf("https://"))>-1?s:"data:audio/mp3;base64,").concat(s),autoPlay:!0}),e==="video"&&U.a.createElement(U.a.Fragment,null,s!=null&&s.startsWith("/")?U.a.createElement("video",{controls:!0,src:"".concat(s),autoPlay:!0}):U.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(s),autoPlay:!0})),e==="html"&&U.a.createElement("iframe",{src:s+"&disposition=inline"}),e==="pdf"&&U.a.createElement("embed",{className:S.a.embed,src:s}),e==="image"&&U.a.createElement(U.a.Fragment,null,U.a.createElement("img",{src:"".concat(s!=null&&s.startsWith("/")||(s==null?void 0:s.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(s)})),e==="other"&&U.a.createElement("div",null,U.a.createElement(W.a,{type:"primary",size:"large",onClick:R},U.a.createElement(_.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(e==="download"||e==="office")&&U.a.createElement(W.a,{type:"primary",size:"large",onClick:R},U.a.createElement(_.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},psGv:function(Ge,Ee,z){var re,W;(function(){var I;(function(){"use strict";var j=[,,function(_){function b(r){this.__parent=r,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=[]}b.prototype.clone_empty=function(){var r=new b(this.__parent);return r.set_indent(this.__indent_count,this.__alignment_count),r},b.prototype.item=function(r){return r<0?this.__items[this.__items.length+r]:this.__items[r]},b.prototype.has_match=function(r){for(var s=this.__items.length-1;s>=0;s--)if(this.__items[s].match(r))return!0;return!1},b.prototype.set_indent=function(r,s){this.is_empty()&&(this.__indent_count=r||0,this.__alignment_count=s||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},b.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)},b.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},b.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var r=this.__parent.current_line;return r.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),r.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),r.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,r.__items[0]===" "&&(r.__items.splice(0,1),r.__character_count-=1),!0}return!1},b.prototype.is_empty=function(){return this.__items.length===0},b.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},b.prototype.push=function(r){this.__items.push(r);var s=r.lastIndexOf(`
|
|
`);s!==-1?this.__character_count=r.length-s:this.__character_count+=r.length},b.prototype.pop=function(){var r=null;return this.is_empty()||(r=this.__items.pop(),this.__character_count-=r.length),r},b.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},b.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},b.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},b.prototype.toString=function(){var r="";return this.is_empty()?this.__parent.indent_empty_lines&&(r=this.__parent.get_indent_string(this.__indent_count)):(r=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),r+=this.__items.join("")),r};function h(r,s){this.__cache=[""],this.__indent_size=r.indent_size,this.__indent_string=r.indent_char,r.indent_with_tabs||(this.__indent_string=new Array(r.indent_size+1).join(r.indent_char)),s=s||"",r.indent_level>0&&(s=new Array(r.indent_level+1).join(this.__indent_string)),this.__base_string=s,this.__base_string_length=s.length}h.prototype.get_indent_size=function(r,s){var a=this.__base_string_length;return s=s||0,r<0&&(a=0),a+=r*this.__indent_size,a+=s,a},h.prototype.get_indent_string=function(r,s){var a=this.__base_string;return s=s||0,r<0&&(r=0,a=""),s+=r*this.__indent_size,this.__ensure_cache(s),a+=this.__cache[s],a},h.prototype.__ensure_cache=function(r){for(;r>=this.__cache.length;)this.__add_column()},h.prototype.__add_column=function(){var r=this.__cache.length,s=0,a="";this.__indent_size&&r>=this.__indent_size&&(s=Math.floor(r/this.__indent_size),r-=s*this.__indent_size,a=new Array(s+1).join(this.__indent_string)),r&&(a+=new Array(r+1).join(" ")),this.__cache.push(a)};function l(r,s){this.__indent_cache=new h(r,s),this.raw=!1,this._end_with_newline=r.end_with_newline,this.indent_size=r.indent_size,this.wrap_line_length=r.wrap_line_length,this.indent_empty_lines=r.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new b(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}l.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},l.prototype.get_line_number=function(){return this.__lines.length},l.prototype.get_indent_string=function(r,s){return this.__indent_cache.get_indent_string(r,s)},l.prototype.get_indent_size=function(r,s){return this.__indent_cache.get_indent_size(r,s)},l.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},l.prototype.add_new_line=function(r){return this.is_empty()||!r&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},l.prototype.get_code=function(r){this.trim(!0);var s=this.current_line.pop();s&&(s[s.length-1]===`
|
|
`&&(s=s.replace(/\n+$/g,"")),this.current_line.push(s)),this._end_with_newline&&this.__add_outputline();var a=this.__lines.join(`
|
|
`);return r!==`
|
|
`&&(a=a.replace(/[\n]/g,r)),a},l.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},l.prototype.set_indent=function(r,s){return r=r||0,s=s||0,this.next_line.set_indent(r,s),this.__lines.length>1?(this.current_line.set_indent(r,s),!0):(this.current_line.set_indent(),!1)},l.prototype.add_raw_token=function(r){for(var s=0;s<r.newlines;s++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(r.whitespace_before),this.current_line.push(r.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},l.prototype.add_token=function(r){this.__add_space_before_token(),this.current_line.push(r),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},l.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(" "))},l.prototype.remove_indent=function(r){for(var s=this.__lines.length;r<s;)this.__lines[r]._remove_indent(),r++;this.current_line._remove_wrap_indent()},l.prototype.trim=function(r){for(r=r===void 0?!1:r,this.current_line.trim();r&&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},l.prototype.just_added_newline=function(){return this.current_line.is_empty()},l.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},l.prototype.ensure_empty_line_above=function(r,s){for(var a=this.__lines.length-2;a>=0;){var e=this.__lines[a];if(e.is_empty())break;if(e.item(0).indexOf(r)!==0&&e.item(-1)!==s){this.__lines.splice(a+1,0,new b(this)),this.previous_line=this.__lines[this.__lines.length-2];break}a--}},_.exports.Output=l},function(_){function b(h,l,r,s){this.type=h,this.text=l,this.comments_before=null,this.newlines=r||0,this.whitespace_before=s||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}_.exports.Token=b},,,function(_){function b(r,s){this.raw_options=h(r,s),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"])}b.prototype._get_array=function(r,s){var a=this.raw_options[r],e=s||[];return typeof a=="object"?a!==null&&typeof a.concat=="function"&&(e=a.concat()):typeof a=="string"&&(e=a.split(/[^a-zA-Z0-9_\/\-]+/)),e},b.prototype._get_boolean=function(r,s){var a=this.raw_options[r],e=a===void 0?!!s:!!a;return e},b.prototype._get_characters=function(r,s){var a=this.raw_options[r],e=s||"";return typeof a=="string"&&(e=a.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),e},b.prototype._get_number=function(r,s){var a=this.raw_options[r];s=parseInt(s,10),isNaN(s)&&(s=0);var e=parseInt(a,10);return isNaN(e)&&(e=s),e},b.prototype._get_selection=function(r,s,a){var e=this._get_selection_list(r,s,a);if(e.length!==1)throw new Error("Invalid Option Value: The option '"+r+`' can only be one of the following values:
|
|
`+s+`
|
|
You passed in: '`+this.raw_options[r]+"'");return e[0]},b.prototype._get_selection_list=function(r,s,a){if(!s||s.length===0)throw new Error("Selection list cannot be empty.");if(a=a||[s[0]],!this._is_valid_selection(a,s))throw new Error("Invalid Default Value!");var e=this._get_array(r,a);if(!this._is_valid_selection(e,s))throw new Error("Invalid Option Value: The option '"+r+`' can contain only the following values:
|
|
`+s+`
|
|
You passed in: '`+this.raw_options[r]+"'");return e},b.prototype._is_valid_selection=function(r,s){return r.length&&s.length&&!r.some(function(a){return s.indexOf(a)===-1})};function h(r,s){var a={};r=l(r);var e;for(e in r)e!==s&&(a[e]=r[e]);if(s&&r[s])for(e in r[s])a[e]=r[s][e];return a}function l(r){var s={},a;for(a in r){var e=a.replace(/-/g,"_");s[e]=r[a]}return s}_.exports.Options=b,_.exports.normalizeOpts=l,_.exports.mergeOpts=h},,function(_){var b=RegExp.prototype.hasOwnProperty("sticky");function h(l){this.__input=l||"",this.__input_length=this.__input.length,this.__position=0}h.prototype.restart=function(){this.__position=0},h.prototype.back=function(){this.__position>0&&(this.__position-=1)},h.prototype.hasNext=function(){return this.__position<this.__input_length},h.prototype.next=function(){var l=null;return this.hasNext()&&(l=this.__input.charAt(this.__position),this.__position+=1),l},h.prototype.peek=function(l){var r=null;return l=l||0,l+=this.__position,l>=0&&l<this.__input_length&&(r=this.__input.charAt(l)),r},h.prototype.__match=function(l,r){l.lastIndex=r;var s=l.exec(this.__input);return s&&!(b&&l.sticky)&&(s.index!==r&&(s=null)),s},h.prototype.test=function(l,r){return r=r||0,r+=this.__position,r>=0&&r<this.__input_length?!!this.__match(l,r):!1},h.prototype.testChar=function(l,r){var s=this.peek(r);return l.lastIndex=0,s!==null&&l.test(s)},h.prototype.match=function(l){var r=this.__match(l,this.__position);return r?this.__position+=r[0].length:r=null,r},h.prototype.read=function(l,r,s){var a="",e;return l&&(e=this.match(l),e&&(a+=e[0])),r&&(e||!l)&&(a+=this.readUntil(r,s)),a},h.prototype.readUntil=function(l,r){var s="",a=this.__position;l.lastIndex=this.__position;var e=l.exec(this.__input);return e?(a=e.index,r&&(a+=e[0].length)):a=this.__input_length,s=this.__input.substring(this.__position,a),this.__position=a,s},h.prototype.readUntilAfter=function(l){return this.readUntil(l,!0)},h.prototype.get_regexp=function(l,r){var s=null,a="g";return r&&b&&(a="y"),typeof l=="string"&&l!==""?s=new RegExp(l,a):l&&(s=new RegExp(l.source,a)),s},h.prototype.get_literal_regexp=function(l){return RegExp(l.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},h.prototype.peekUntilAfter=function(l){var r=this.__position,s=this.readUntilAfter(l);return this.__position=r,s},h.prototype.lookBack=function(l){var r=this.__position-1;return r>=l.length&&this.__input.substring(r-l.length,r).toLowerCase()===l},_.exports.InputScanner=h},function(_,b,h){var l=h(8).InputScanner,r=h(3).Token,s=h(10).TokenStream,a=h(11).WhitespacePattern,e={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},t=function(n,x){this._input=new l(n),this._options=x||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new a(this._input)};t.prototype.tokenize=function(){this._input.restart(),this.__tokens=new s,this._reset();for(var n,x=new r(e.START,""),E=null,g=[],y=new s;x.type!==e.EOF;){for(n=this._get_next_token(x,E);this._is_comment(n);)y.add(n),n=this._get_next_token(x,E);y.isEmpty()||(n.comments_before=y,y=new s),n.parent=E,this._is_opening(n)?(g.push(E),E=n):E&&this._is_closing(n,E)&&(n.opened=E,E.closed=n,E=g.pop(),n.parent=E),n.previous=x,x.next=n,this.__tokens.add(n),x=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,x){this._readWhitespace();var E=this._input.read(/.+/g);return E?this._create_token(e.RAW,E):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,x){return!1},t.prototype._create_token=function(n,x){var E=new r(n,x,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return E},t.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},_.exports.Tokenizer=t,_.exports.TOKEN=e},function(_){function b(h){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=h}b.prototype.restart=function(){this.__position=0},b.prototype.isEmpty=function(){return this.__tokens_length===0},b.prototype.hasNext=function(){return this.__position<this.__tokens_length},b.prototype.next=function(){var h=null;return this.hasNext()&&(h=this.__tokens[this.__position],this.__position+=1),h},b.prototype.peek=function(h){var l=null;return h=h||0,h+=this.__position,h>=0&&h<this.__tokens_length&&(l=this.__tokens[h]),l},b.prototype.add=function(h){this.__parent_token&&(h.parent=this.__parent_token),this.__tokens.push(h),this.__tokens_length+=1},_.exports.TokenStream=b},function(_,b,h){var l=h(12).Pattern;function r(s,a){l.call(this,s,a),a?this._line_regexp=this._input.get_regexp(a._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}r.prototype=new l,r.prototype.__set_whitespace_patterns=function(s,a){s+="\\t ",a+="\\n\\r",this._match_pattern=this._input.get_regexp("["+s+a+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+a+"]")},r.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var s=this._input.read(this._match_pattern);if(s===" ")this.whitespace_before_token=" ";else if(s){var a=this.__split(this._newline_regexp,s);this.newline_count=a.length-1,this.whitespace_before_token=a[this.newline_count]}return s},r.prototype.matching=function(s,a){var e=this._create();return e.__set_whitespace_patterns(s,a),e._update(),e},r.prototype._create=function(){return new r(this._input,this)},r.prototype.__split=function(s,a){s.lastIndex=0;for(var e=0,t=[],n=s.exec(a);n;)t.push(a.substring(e,n.index)),e=n.index+n[0].length,n=s.exec(a);return e<a.length?t.push(a.substring(e,a.length)):t.push(""),t},_.exports.WhitespacePattern=r},function(_){function b(h,l){this._input=h,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,l&&(this._starting_pattern=this._input.get_regexp(l._starting_pattern,!0),this._match_pattern=this._input.get_regexp(l._match_pattern,!0),this._until_pattern=this._input.get_regexp(l._until_pattern),this._until_after=l._until_after)}b.prototype.read=function(){var h=this._input.read(this._starting_pattern);return(!this._starting_pattern||h)&&(h+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),h},b.prototype.read_match=function(){return this._input.match(this._match_pattern)},b.prototype.until_after=function(h){var l=this._create();return l._until_after=!0,l._until_pattern=this._input.get_regexp(h),l._update(),l},b.prototype.until=function(h){var l=this._create();return l._until_after=!1,l._until_pattern=this._input.get_regexp(h),l._update(),l},b.prototype.starting_with=function(h){var l=this._create();return l._starting_pattern=this._input.get_regexp(h,!0),l._update(),l},b.prototype.matching=function(h){var l=this._create();return l._match_pattern=this._input.get_regexp(h,!0),l._update(),l},b.prototype._create=function(){return new b(this._input,this)},b.prototype._update=function(){},_.exports.Pattern=b},function(_){function b(h,l){h=typeof h=="string"?h:h.source,l=typeof l=="string"?l:l.source,this.__directives_block_pattern=new RegExp(h+/ beautify( \w+[:]\w+)+ /.source+l,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(h+/\sbeautify\signore:end\s/.source+l,"g")}b.prototype.get_directives=function(h){if(!h.match(this.__directives_block_pattern))return null;var l={};this.__directive_pattern.lastIndex=0;for(var r=this.__directive_pattern.exec(h);r;)l[r[1]]=r[2],r=this.__directive_pattern.exec(h);return l},b.prototype.readIgnored=function(h){return h.readUntilAfter(this.__directives_end_ignore_pattern)},_.exports.Directives=b},function(_,b,h){var l=h(12).Pattern,r={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function s(a,e){l.call(this,a,e),this.__template_pattern=null,this._disabled=Object.assign({},r),this._excluded=Object.assign({},r),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 l(a);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}/)}}s.prototype=new l,s.prototype._create=function(){return new s(this._input,this)},s.prototype._update=function(){this.__set_templated_pattern()},s.prototype.disable=function(a){var e=this._create();return e._disabled[a]=!0,e._update(),e},s.prototype.read_options=function(a){var e=this._create();for(var t in r)e._disabled[t]=a.templating.indexOf(t)===-1;return e._update(),e},s.prototype.exclude=function(a){var e=this._create();return e._excluded[a]=!0,e._update(),e},s.prototype.read=function(){var a="";this._match_pattern?a=this._input.read(this._starting_pattern):a=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),a+=e,e=this._read_template();return this._until_after&&(a+=this._input.readUntilAfter(this._until_pattern)),a},s.prototype.__set_templated_pattern=function(){var a=[];this._disabled.php||a.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||a.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||a.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(a.push(this.__patterns.django._starting_pattern.source),a.push(this.__patterns.django_value._starting_pattern.source),a.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||a.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&a.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+a.join("|")+")")},s.prototype._read_template=function(){var a="",e=this._input.peek();if(e==="<"){var t=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&t==="?"&&(a=a||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&t==="%"&&(a=a||this.__patterns.erb.read())}else e==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(a=a||this.__patterns.handlebars_comment.read(),a=a||this.__patterns.handlebars_unescaped.read(),a=a||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(a=a||this.__patterns.django_value.read()),this._excluded.django||(a=a||this.__patterns.django_comment.read(),a=a||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(a=a||this.__patterns.smarty_comment.read(),a=a||this.__patterns.smarty_literal.read(),a=a||this.__patterns.smarty.read()));return a},_.exports.TemplatablePattern=s},,,,function(_,b,h){var l=h(19).Beautifier,r=h(20).Options;function s(a,e,t,n){var x=new l(a,e,t,n);return x.beautify()}_.exports=s,_.exports.defaultOptions=function(){return new r}},function(_,b,h){var l=h(20).Options,r=h(2).Output,s=h(21).Tokenizer,a=h(21).TOKEN,e=/\r\n|[\r\n]/,t=/\r\n|[\r\n]/g,n=function(p,f){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=p.max_preserve_newlines,this.preserve_newlines=p.preserve_newlines,this._output=new r(p,f)};n.prototype.current_line_has_match=function(p){return this._output.current_line.has_match(p)},n.prototype.set_space_before_token=function(p,f){this._output.space_before_token=p,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(p){this._output.add_raw_token(p)},n.prototype.print_preserved_newlines=function(p){var f=0;p.type!==a.TEXT&&p.previous.type!==a.TEXT&&(f=p.newlines?1:0),this.preserve_newlines&&(f=p.newlines<this.max_preserve_newlines+1?p.newlines:this.max_preserve_newlines+1);for(var c=0;c<f;c++)this.print_newline(c>0);return f!==0},n.prototype.traverse_whitespace=function(p){return p.whitespace_before||p.newlines?(this.print_preserved_newlines(p)||(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(p){this._output.add_new_line(p)},n.prototype.print_token=function(p){p.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(p.text))},n.prototype.indent=function(){this.indent_level++},n.prototype.get_full_indent=function(p){return p=this.indent_level+(p||0),p<1?"":this._output.get_indent_string(p)};var x=function(p){for(var f=null,c=p.next;c.type!==a.EOF&&p.closed!==c;){if(c.type===a.ATTRIBUTE&&c.text==="type"){c.next&&c.next.type===a.EQUALS&&c.next.next&&c.next.next.type===a.VALUE&&(f=c.next.next.text);break}c=c.next}return f},E=function(p,f){var c=null,w=null;return f.closed?(p==="script"?c="text/javascript":p==="style"&&(c="text/css"),c=x(f)||c,c.search("text/css")>-1?w="css":c.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?w="javascript":c.search(/(text|application|dojo)\/(x-)?(html)/)>-1?w="html":c.search(/test\/null/)>-1&&(w="null"),w):null};function g(p,f){return f.indexOf(p)!==-1}function y(p,f,c){this.parent=p||null,this.tag=f?f.tag_name:"",this.indent_level=c||0,this.parser_token=f||null}function v(p){this._printer=p,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(p){var f=new y(this._current_frame,p,this._printer.indent_level);this._current_frame=f},v.prototype._try_pop_frame=function(p){var f=null;return p&&(f=p.parser_token,this._printer.indent_level=p.indent_level,this._current_frame=p.parent),f},v.prototype._get_frame=function(p,f){for(var c=this._current_frame;c&&!(p.indexOf(c.tag)!==-1);){if(f&&f.indexOf(c.tag)!==-1){c=null;break}c=c.parent}return c},v.prototype.try_pop=function(p,f){var c=this._get_frame([p],f);return this._try_pop_frame(c)},v.prototype.indent_to_tag=function(p){var f=this._get_frame(p);f&&(this._printer.indent_level=f.indent_level)};function d(p,f,c,w){this._source_text=p||"",f=f||{},this._js_beautify=c,this._css_beautify=w,this._tag_stack=null;var A=new l(f,"html");this._options=A,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"}d.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var p=this._source_text,f=this._options.eol;this._options.eol==="auto"&&(f=`
|
|
`,p&&e.test(p)&&(f=p.match(e)[0])),p=p.replace(t,`
|
|
`);var c=p.match(/^[\t ]*/)[0],w={text:"",type:""},A=new u,P=new n(this._options,c),N=new s(p,this._options).tokenize();this._tag_stack=new v(P);for(var B=null,R=N.next();R.type!==a.EOF;)R.type===a.TAG_OPEN||R.type===a.COMMENT?(B=this._handle_tag_open(P,R,A,w),A=B):R.type===a.ATTRIBUTE||R.type===a.EQUALS||R.type===a.VALUE||R.type===a.TEXT&&!A.tag_complete?B=this._handle_inside_tag(P,R,A,N):R.type===a.TAG_CLOSE?B=this._handle_tag_close(P,R,A):R.type===a.TEXT?B=this._handle_text(P,R,A):P.add_raw_token(R),w=B,R=N.next();var F=P._output.get_code(f);return F},d.prototype._handle_tag_close=function(p,f,c){var w={text:f.text,type:f.type};return p.alignment_size=0,c.tag_complete=!0,p.set_space_before_token(f.newlines||f.whitespace_before!=="",!0),c.is_unformatted?p.add_raw_token(f):(c.tag_start_char==="<"&&(p.set_space_before_token(f.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&c.has_wrapped_attrs&&p.print_newline(!1)),p.print_token(f)),c.indent_content&&!(c.is_unformatted||c.is_content_unformatted)&&(p.indent(),c.indent_content=!1),!c.is_inline_element&&!(c.is_unformatted||c.is_content_unformatted)&&p.set_wrap_point(),w},d.prototype._handle_inside_tag=function(p,f,c,w){var A=c.has_wrapped_attrs,P={text:f.text,type:f.type};if(p.set_space_before_token(f.newlines||f.whitespace_before!=="",!0),c.is_unformatted)p.add_raw_token(f);else if(c.tag_start_char==="{"&&f.type===a.TEXT)p.print_preserved_newlines(f)?(f.newlines=0,p.add_raw_token(f)):p.print_token(f);else{if(f.type===a.ATTRIBUTE?(p.set_space_before_token(!0),c.attr_count+=1):(f.type===a.EQUALS||f.type===a.VALUE&&f.previous.type===a.EQUALS)&&p.set_space_before_token(!1),f.type===a.ATTRIBUTE&&c.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(p.traverse_whitespace(f),A=A||f.newlines!==0),this._is_wrap_attributes_force)){var N=c.attr_count>1;if(this._is_wrap_attributes_force_expand_multiline&&c.attr_count===1){var B=!0,R=0,F;do{if(F=w.peek(R),F.type===a.ATTRIBUTE){B=!1;break}R+=1}while(R<4&&F.type!==a.EOF&&F.type!==a.TAG_CLOSE);N=!B}N&&(p.print_newline(!1),A=!0)}p.print_token(f),A=A||p.previous_token_wrapped(),c.has_wrapped_attrs=A}return P},d.prototype._handle_text=function(p,f,c){var w={text:f.text,type:"TK_CONTENT"};return c.custom_beautifier_name?this._print_custom_beatifier_text(p,f,c):c.is_unformatted||c.is_content_unformatted?p.add_raw_token(f):(p.traverse_whitespace(f),p.print_token(f)),w},d.prototype._print_custom_beatifier_text=function(p,f,c){var w=this;if(f.text!==""){var A=f.text,P,N=1,B="",R="";c.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?P=this._js_beautify:c.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?P=this._css_beautify:c.custom_beautifier_name==="html"&&(P=function(ce,le){var be=new d(ce,le,w._js_beautify,w._css_beautify);return be.beautify()}),this._options.indent_scripts==="keep"?N=0:this._options.indent_scripts==="separate"&&(N=-p.indent_level);var F=p.get_full_indent(N);if(A=A.replace(/\n[ \t]*$/,""),c.custom_beautifier_name!=="html"&&A[0]==="<"&&A.match(/^(<!--|<!\[CDATA\[)/)){var K=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(A);if(!K){p.add_raw_token(f);return}B=F+K[1]+`
|
|
`,A=K[4],K[5]&&(R=F+K[5]),A=A.replace(/\n[ \t]*$/,""),(K[2]||K[3].indexOf(`
|
|
`)!==-1)&&(K=K[3].match(/[ \t]+$/),K&&(f.whitespace_before=K[0]))}if(A)if(P){var X=function(){this.eol=`
|
|
`};X.prototype=this._options.raw_options;var ee=new X;A=P(F+A,ee)}else{var oe=f.whitespace_before;oe&&(A=A.replace(new RegExp(`
|
|
(`+oe+")?","g"),`
|
|
`)),A=F+A.replace(/\n/g,`
|
|
`+F)}B&&(A?A=B+A+`
|
|
`+R:A=B+R),p.print_newline(!1),A&&(f.text=A,f.whitespace_before="",f.newlines=0,p.add_raw_token(f),p.print_newline(!0))}},d.prototype._handle_tag_open=function(p,f,c,w){var A=this._get_tag_open_token(f);return(c.is_unformatted||c.is_content_unformatted)&&!c.is_empty_element&&f.type===a.TAG_OPEN&&f.text.indexOf("</")===0?(p.add_raw_token(f),A.start_tag_token=this._tag_stack.try_pop(A.tag_name)):(p.traverse_whitespace(f),this._set_tag_position(p,f,A,c,w),A.is_inline_element||p.set_wrap_point(),p.print_token(f)),(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(A.alignment_size=f.text.length+1),!A.tag_complete&&!A.is_unformatted&&(p.alignment_size=A.alignment_size),A};var u=function(p,f){if(this.parent=p||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 c;this.tag_start_char=f.text[0],this.text=f.text,this.tag_start_char==="<"?(c=f.text.match(/^<([^\s>]*)/),this.tag_check=c?c[1]:""):(c=f.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=c?c[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===a.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 w=2;this.tag_start_char==="{"&&this.text.length>=3&&(this.text.charAt(2)==="~"&&(w=3)),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(this.text.length<3||/[^#\^]/.test(this.text.charAt(w)))}};d.prototype._get_tag_open_token=function(p){var f=new u(this._tag_stack.get_parser_token(),p);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},d.prototype._set_tag_position=function(p,f,c,w,A){if(c.is_empty_element||(c.is_end_tag?c.start_tag_token=this._tag_stack.try_pop(c.tag_name):(this._do_optional_end_element(c)&&(c.is_inline_element||p.print_newline(!1)),this._tag_stack.record_tag(c),(c.tag_name==="script"||c.tag_name==="style")&&!(c.is_unformatted||c.is_content_unformatted)&&(c.custom_beautifier_name=E(c.tag_check,f)))),g(c.tag_check,this._options.extra_liners)&&(p.print_newline(!1),p._output.just_added_blankline()||p.print_newline(!0)),c.is_empty_element){if(c.tag_start_char==="{"&&c.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),c.indent_content=!0;var P=p.current_line_has_match(/{{#if/);P||p.print_newline(!1)}c.tag_name==="!--"&&A.type===a.TAG_CLOSE&&w.is_end_tag&&c.text.indexOf(`
|
|
`)===-1||(c.is_inline_element||c.is_unformatted||p.print_newline(!1),this._calcluate_parent_multiline(p,c))}else if(c.is_end_tag){var N=!1;N=c.start_tag_token&&c.start_tag_token.multiline_content,N=N||!c.is_inline_element&&!(w.is_inline_element||w.is_unformatted)&&!(A.type===a.TAG_CLOSE&&c.start_tag_token===w)&&A.type!=="TK_CONTENT",(c.is_content_unformatted||c.is_unformatted)&&(N=!1),N&&p.print_newline(!1)}else c.indent_content=!c.custom_beautifier_name,c.tag_start_char==="<"&&(c.tag_name==="html"?c.indent_content=this._options.indent_inner_html:c.tag_name==="head"?c.indent_content=this._options.indent_head_inner_html:c.tag_name==="body"&&(c.indent_content=this._options.indent_body_inner_html)),!(c.is_inline_element||c.is_unformatted)&&(A.type!=="TK_CONTENT"||c.is_content_unformatted)&&p.print_newline(!1),this._calcluate_parent_multiline(p,c)},d.prototype._calcluate_parent_multiline=function(p,f){f.parent&&p._output.just_added_newline()&&!((f.is_inline_element||f.is_unformatted)&&f.parent.is_inline_element)&&(f.parent.multiline_content=!0)};var i=["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"];d.prototype._do_optional_end_element=function(p){var f=null;if(p.is_empty_element||!p.is_start_tag||!p.parent)return;if(p.tag_name==="body")f=f||this._tag_stack.try_pop("head");else if(p.tag_name==="li")f=f||this._tag_stack.try_pop("li",["ol","ul"]);else if(p.tag_name==="dd"||p.tag_name==="dt")f=f||this._tag_stack.try_pop("dt",["dl"]),f=f||this._tag_stack.try_pop("dd",["dl"]);else if(p.parent.tag_name==="p"&&i.indexOf(p.tag_name)!==-1){var c=p.parent.parent;(!c||o.indexOf(c.tag_name)===-1)&&(f=f||this._tag_stack.try_pop("p"))}else p.tag_name==="rp"||p.tag_name==="rt"?(f=f||this._tag_stack.try_pop("rt",["ruby","rtc"]),f=f||this._tag_stack.try_pop("rp",["ruby","rtc"])):p.tag_name==="optgroup"?f=f||this._tag_stack.try_pop("optgroup",["select"]):p.tag_name==="option"?f=f||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):p.tag_name==="colgroup"?f=f||this._tag_stack.try_pop("caption",["table"]):p.tag_name==="thead"?(f=f||this._tag_stack.try_pop("caption",["table"]),f=f||this._tag_stack.try_pop("colgroup",["table"])):p.tag_name==="tbody"||p.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"])):p.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"])):(p.tag_name==="th"||p.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 p.parent=this._tag_stack.get_parser_token(),f},_.exports.Beautifier=d},function(_,b,h){var l=h(6).Options;function r(s){l.call(this,s,"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"])}r.prototype=new l,_.exports.Options=r},function(_,b,h){var l=h(9).Tokenizer,r=h(9).TOKEN,s=h(13).Directives,a=h(14).TemplatablePattern,e=h(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:r.START,RAW:r.RAW,EOF:r.EOF},n=new s(/<\!--/,/-->/),x=function(E,g){l.call(this,E,g),this._current_tag_name="";var y=new a(this._input).read_options(this._options),v=new e(this._input);if(this.__patterns={word:y.until(/[\n\r\t <]/),single_quote:y.until_after(/'/),double_quote:y.until_after(/"/),attribute:y.until(/[\n\r\t =>]|\/>/),element_name:y.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 d=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=v.matching(d).until_after(d)}};x.prototype=new l,x.prototype._is_comment=function(E){return!1},x.prototype._is_opening=function(E){return E.type===t.TAG_OPEN},x.prototype._is_closing=function(E,g){return E.type===t.TAG_CLOSE&&g&&((E.text===">"||E.text==="/>")&&g.text[0]==="<"||E.text==="}}"&&g.text[0]==="{"&&g.text[1]==="{")},x.prototype._reset=function(){this._current_tag_name=""},x.prototype._get_next_token=function(E,g){var y=null;this._readWhitespace();var v=this._input.peek();return v===null?this._create_token(t.EOF,""):(y=y||this._read_open_handlebars(v,g),y=y||this._read_attribute(v,E,g),y=y||this._read_close(v,g),y=y||this._read_raw_content(v,E,g),y=y||this._read_content_word(v),y=y||this._read_comment_or_cdata(v),y=y||this._read_processing(v),y=y||this._read_open(v,g),y=y||this._create_token(t.UNKNOWN,this._input.next()),y)},x.prototype._read_comment_or_cdata=function(E){var g=null,y=null,v=null;if(E==="<"){var d=this._input.peek(1);d==="!"&&(y=this.__patterns.comment.read(),y?(v=n.get_directives(y),v&&v.ignore==="start"&&(y+=n.readIgnored(this._input))):y=this.__patterns.cdata.read()),y&&(g=this._create_token(t.COMMENT,y),g.directives=v)}return g},x.prototype._read_processing=function(E){var g=null,y=null,v=null;if(E==="<"){var d=this._input.peek(1);(d==="!"||d==="?")&&(y=this.__patterns.conditional_comment.read(),y=y||this.__patterns.processing.read()),y&&(g=this._create_token(t.COMMENT,y),g.directives=v)}return g},x.prototype._read_open=function(E,g){var y=null,v=null;return g||E==="<"&&(y=this._input.next(),this._input.peek()==="/"&&(y+=this._input.next()),y+=this.__patterns.element_name.read(),v=this._create_token(t.TAG_OPEN,y)),v},x.prototype._read_open_handlebars=function(E,g){var y=null,v=null;return g||this._options.indent_handlebars&&E==="{"&&this._input.peek(1)==="{"&&(this._input.peek(2)==="!"?(y=this.__patterns.handlebars_comment.read(),y=y||this.__patterns.handlebars.read(),v=this._create_token(t.COMMENT,y)):(y=this.__patterns.handlebars_open.read(),v=this._create_token(t.TAG_OPEN,y))),v},x.prototype._read_close=function(E,g){var y=null,v=null;return g&&(g.text[0]==="<"&&(E===">"||E==="/"&&this._input.peek(1)===">")?(y=this._input.next(),E==="/"&&(y+=this._input.next()),v=this._create_token(t.TAG_CLOSE,y)):g.text[0]==="{"&&E==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),v=this._create_token(t.TAG_CLOSE,"}}"))),v},x.prototype._read_attribute=function(E,g,y){var v=null,d="";if(y&&y.text[0]==="<")if(E==="=")v=this._create_token(t.EQUALS,this._input.next());else if(E==='"'||E==="'"){var u=this._input.next();E==='"'?u+=this.__patterns.double_quote.read():u+=this.__patterns.single_quote.read(),v=this._create_token(t.VALUE,u)}else d=this.__patterns.attribute.read(),d&&(g.type===t.EQUALS?v=this._create_token(t.VALUE,d):v=this._create_token(t.ATTRIBUTE,d));return v},x.prototype._is_content_unformatted=function(E){return this._options.void_elements.indexOf(E)===-1&&(this._options.content_unformatted.indexOf(E)!==-1||this._options.unformatted.indexOf(E)!==-1)},x.prototype._read_raw_content=function(E,g,y){var v="";if(y&&y.text[0]==="{")v=this.__patterns.handlebars_raw_close.read();else if(g.type===t.TAG_CLOSE&&g.opened.text[0]==="<"&&g.text[0]!=="/"){var d=g.opened.text.substr(1).toLowerCase();if(d==="script"||d==="style"){var u=this._read_comment_or_cdata(E);if(u)return u.type=t.TEXT,u;v=this._input.readUntil(new RegExp("</"+d+"[\\n\\r\\t ]*?>","ig"))}else this._is_content_unformatted(d)&&(v=this._input.readUntil(new RegExp("</"+d+"[\\n\\r\\t ]*?>","ig")))}return v?this._create_token(t.TEXT,v):null},x.prototype._read_content_word=function(E){var g="";if(this._options.unformatted_content_delimiter&&(E===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)},_.exports.Tokenizer=x,_.exports.TOKEN=t}],U={};function O(_){var b=U[_];if(b!==void 0)return b.exports;var h=U[_]={exports:{}};return j[_](h,h.exports,O),h.exports}var S=O(18);I=S})();var H=I;if(!0)!(re=[z,z("6UM0"),z("TXwP")],W=function(j){var U=z("6UM0"),O=z("TXwP");return{html_beautify:function(S,_){return H(S,_,U.js_beautify,O.css_beautify)}}}.apply(Ee,re),W!==void 0&&(Ge.exports=W));else var L,C})()},"rAM+":function(Ge,Ee,z){"use strict";z.d(Ee,"a",function(){return W});var re=z("Qw5x");function W(I,H){var L;if(typeof Symbol=="undefined"||I[Symbol.iterator]==null){if(Array.isArray(I)||(L=Object(re.a)(I))||H&&I&&typeof I.length=="number"){L&&(I=L);var C=0,j=function(){};return{s:j,n:function(){return C>=I.length?{done:!0}:{done:!1,value:I[C++]}},e:function(b){throw b},f:j}}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 U=!0,O=!1,S;return{s:function(){L=I[Symbol.iterator]()},n:function(){var b=L.next();return U=b.done,b},e:function(b){O=!0,S=b},f:function(){try{!U&&L.return!=null&&L.return()}finally{if(O)throw S}}}}},rUJ1:function(Ge,Ee){const z=/[&<>"']/,re=/[&<>"']/g,W=/[<>"']|&(?!#?\w+;)/,I=/[<>"']|&(?!#?\w+;)/g,H={"&":"&","<":"<",">":">",'"':""","'":"'"},L=v=>H[v];function C(v,d){if(d){if(z.test(v))return v.replace(re,L)}else if(W.test(v))return v.replace(I,L);return v}const j=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function U(v){return v.replace(j,(d,u)=>(u=u.toLowerCase(),u==="colon"?":":u.charAt(0)==="#"?u.charAt(1)==="x"?String.fromCharCode(parseInt(u.substring(2),16)):String.fromCharCode(+u.substring(1)):""))}const O=/(^|[^\[])\^/g;function S(v,d){v=v.source||v,d=d||"";const u={replace:(i,o)=>(o=o.source||o,o=o.replace(O,"$1"),v=v.replace(i,o),u),getRegex:()=>new RegExp(v,d)};return u}const _=/[^\w:]/g,b=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function h(v,d,u){if(v){let i;try{i=decodeURIComponent(U(u)).replace(_,"").toLowerCase()}catch(o){return null}if(i.indexOf("javascript:")===0||i.indexOf("vbscript:")===0||i.indexOf("data:")===0)return null}d&&!b.test(u)&&(u=e(d,u));try{u=encodeURI(u).replace(/%25/g,"%")}catch(i){return null}return u}const l={},r=/^[^:]+:\/*[^/]*$/,s=/^([^:]+:)[\s\S]*$/,a=/^([^:]+:\/*[^/]*)[\s\S]*$/;function e(v,d){l[" "+v]||(r.test(v)?l[" "+v]=v+"/":l[" "+v]=E(v,"/",!0)),v=l[" "+v];const u=v.indexOf(":")===-1;return d.substring(0,2)==="//"?u?d:v.replace(s,"$1")+d:d.charAt(0)==="/"?u?d:v.replace(a,"$1")+d:v+d}const t={exec:function(){}};function n(v){let d=1,u,i;for(;d<arguments.length;d++){u=arguments[d];for(i in u)Object.prototype.hasOwnProperty.call(u,i)&&(v[i]=u[i])}return v}function x(v,d){const u=v.replace(/\|/g,(p,f,c)=>{let w=!1,A=f;for(;--A>=0&&c[A]==="\\";)w=!w;return w?"|":" |"}),i=u.split(/ \|/);let o=0;if(i.length>d)i.splice(d);else for(;i.length<d;)i.push("");for(;o<i.length;o++)i[o]=i[o].trim().replace(/\\\|/g,"|");return i}function E(v,d,u){const i=v.length;if(i===0)return"";let o=0;for(;o<i;){const p=v.charAt(i-o-1);if(p===d&&!u)o++;else if(p!==d&&u)o++;else break}return v.substr(0,i-o)}function g(v,d){if(v.indexOf(d[1])===-1)return-1;const u=v.length;let i=0,o=0;for(;o<u;o++)if(v[o]==="\\")o++;else if(v[o]===d[0])i++;else if(v[o]===d[1]&&(i--,i<0))return o;return-1}function y(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")}Ge.exports={escape:C,unescape:U,edit:S,cleanUrl:h,resolveUrl:e,noopTest:t,merge:n,splitCells:x,rtrim:E,findClosingBracket:g,checkSanitizeDeprecation:y}},sR1s:function(Ge,Ee,z){"use strict";z.d(Ee,"b",function(){return H}),z.d(Ee,"a",function(){return L}),z.d(Ee,"c",function(){return C}),z.d(Ee,"d",function(){return j});var re=z("U8pU"),W="RC_TABLE_KEY";function I(U){return U==null?[]:Array.isArray(U)?U:[U]}function H(U,O){if(!O&&typeof O!="number")return U;for(var S=I(O),_=U,b=0;b<S.length;b+=1){if(!_)return null;var h=S[b];_=_[h]}return _}function L(U){var O=[],S={};return U.forEach(function(_){for(var b=_||{},h=b.key,l=b.dataIndex,r=h||I(l).join("-")||W;S[r];)r="".concat(r,"_next");S[r]=!0,O.push(r)}),O}function C(){var U={};function O(h,l){l&&Object.keys(l).forEach(function(r){var s=l[r];s&&Object(re.a)(s)==="object"?(h[r]=h[r]||{},O(h[r],s)):h[r]=s})}for(var S=arguments.length,_=new Array(S),b=0;b<S;b++)_[b]=arguments[b];return _.forEach(function(h){O(U,h)}),U}function j(U){return U!=null}},sZk2:function(Ge,Ee,z){Ge.exports=z.p+"static/paix.41effcff.svg"},sboe:function(Ge,Ee,z){"use strict";z.d(Ee,"a",function(){return I});var re=z("cDcd"),W=z.n(re),I=re.createContext(null)},t23M:function(Ge,Ee,z){"use strict";var re=z("VTBJ"),W=z("1OyB"),I=z("vuIU"),H=z("Ji7U"),L=z("LK+K"),C=z("cDcd"),j=z.n(C),U=z("m+aA"),O=z("Zm9Q"),S=z("Kwbf"),_=z("c+Xe"),b=z("bdgK"),h="rc-observer-key",l=function(r){Object(H.a)(a,r);var s=Object(L.a)(a);function a(){var e;return Object(W.a)(this,a),e=s.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,x=t[0].target,E=x.getBoundingClientRect(),g=E.width,y=E.height,v=x.offsetWidth,d=x.offsetHeight,u=Math.floor(g),i=Math.floor(y);if(e.state.width!==u||e.state.height!==i||e.state.offsetWidth!==v||e.state.offsetHeight!==d){var o={width:u,height:i,offsetWidth:v,offsetHeight:d};e.setState(o),n&&Promise.resolve().then(function(){n(Object(re.a)(Object(re.a)({},o),{},{offsetWidth:v,offsetHeight:d}))})}},e.setChildNode=function(t){e.childNode=t},e}return Object(I.a)(a,[{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(U.a)(this.childNode||this),x=n!==this.currentElement;x&&(this.destroyObserver(),this.currentElement=n),!this.resizeObserver&&n&&(this.resizeObserver=new b.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(S.a)(!1,"Find more than one child node with `children` in ResizeObserver. Will only observe first one.");else if(n.length===0)return Object(S.a)(!1,"`children` of ResizeObserver is empty. Nothing is in observe."),null;var x=n[0];if(C.isValidElement(x)&&Object(_.c)(x)){var E=x.ref;n[0]=C.cloneElement(x,{ref:Object(_.a)(E,this.setChildNode)})}return n.length===1?n[0]:n.map(function(g,y){return!C.isValidElement(g)||"key"in g&&g.key!==null?g:C.cloneElement(g,{key:"".concat(h,"-").concat(y)})})}}]),a}(C.Component);l.displayName="ResizeObserver",Ee.a=l},ulZh:function(Ge,Ee,z){typeof window!="undefined"&&function(W,I){Ge.exports=I()}(this,function(){return function(re){var W={};function I(H){if(W[H])return W[H].exports;var L=W[H]={i:H,l:!1,exports:{}};return re[H].call(L.exports,L,L.exports,I),L.l=!0,L.exports}return I.m=re,I.c=W,I.d=function(H,L,C){I.o(H,L)||Object.defineProperty(H,L,{enumerable:!0,get:C})},I.r=function(H){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(H,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(H,"__esModule",{value:!0})},I.t=function(H,L){if(L&1&&(H=I(H)),L&8)return H;if(L&4&&typeof H=="object"&&H&&H.__esModule)return H;var C=Object.create(null);if(I.r(C),Object.defineProperty(C,"default",{enumerable:!0,value:H}),L&2&&typeof H!="string")for(var j in H)I.d(C,j,function(U){return H[U]}.bind(null,j));return C},I.n=function(H){var L=H&&H.__esModule?function(){return H.default}:function(){return H};return I.d(L,"a",L),L},I.o=function(H,L){return Object.prototype.hasOwnProperty.call(H,L)},I.p="/dist/",I(I.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(re,W,I){"use strict";var H=Object.prototype.hasOwnProperty,L="~";function C(){}Object.create&&(C.prototype=Object.create(null),new C().__proto__||(L=!1));function j(_,b,h){this.fn=_,this.context=b,this.once=h||!1}function U(_,b,h,l,r){if(typeof h!="function")throw new TypeError("The listener must be a function");var s=new j(h,l||_,r),a=L?L+b:b;return _._events[a]?_._events[a].fn?_._events[a]=[_._events[a],s]:_._events[a].push(s):(_._events[a]=s,_._eventsCount++),_}function O(_,b){--_._eventsCount===0?_._events=new C:delete _._events[b]}function S(){this._events=new C,this._eventsCount=0}S.prototype.eventNames=function(){var b=[],h,l;if(this._eventsCount===0)return b;for(l in h=this._events)H.call(h,l)&&b.push(L?l.slice(1):l);return Object.getOwnPropertySymbols?b.concat(Object.getOwnPropertySymbols(h)):b},S.prototype.listeners=function(b){var h=L?L+b:b,l=this._events[h];if(!l)return[];if(l.fn)return[l.fn];for(var r=0,s=l.length,a=new Array(s);r<s;r++)a[r]=l[r].fn;return a},S.prototype.listenerCount=function(b){var h=L?L+b:b,l=this._events[h];return l?l.fn?1:l.length:0},S.prototype.emit=function(b,h,l,r,s,a){var e=L?L+b:b;if(!this._events[e])return!1;var t=this._events[e],n=arguments.length,x,E;if(t.fn){t.once&&this.removeListener(b,t.fn,void 0,!0);switch(n){case 1:return t.fn.call(t.context),!0;case 2:return t.fn.call(t.context,h),!0;case 3:return t.fn.call(t.context,h,l),!0;case 4:return t.fn.call(t.context,h,l,r),!0;case 5:return t.fn.call(t.context,h,l,r,s),!0;case 6:return t.fn.call(t.context,h,l,r,s,a),!0}for(E=1,x=new Array(n-1);E<n;E++)x[E-1]=arguments[E];t.fn.apply(t.context,x)}else{var g=t.length,y;for(E=0;E<g;E++){t[E].once&&this.removeListener(b,t[E].fn,void 0,!0);switch(n){case 1:t[E].fn.call(t[E].context);break;case 2:t[E].fn.call(t[E].context,h);break;case 3:t[E].fn.call(t[E].context,h,l);break;case 4:t[E].fn.call(t[E].context,h,l,r);break;default:if(!x)for(y=1,x=new Array(n-1);y<n;y++)x[y-1]=arguments[y];t[E].fn.apply(t[E].context,x)}}}return!0},S.prototype.on=function(b,h,l){return U(this,b,h,l,!1)},S.prototype.once=function(b,h,l){return U(this,b,h,l,!0)},S.prototype.removeListener=function(b,h,l,r){var s=L?L+b:b;if(!this._events[s])return this;if(!h)return O(this,s),this;var a=this._events[s];if(a.fn)a.fn===h&&(!r||a.once)&&(!l||a.context===l)&&O(this,s);else{for(var e=0,t=[],n=a.length;e<n;e++)(a[e].fn!==h||r&&!a[e].once||l&&a[e].context!==l)&&t.push(a[e]);t.length?this._events[s]=t.length===1?t[0]:t:O(this,s)}return this},S.prototype.removeAllListeners=function(b){var h;return b?(h=L?L+b:b,this._events[h]&&O(this,h)):(this._events=new C,this._eventsCount=0),this},S.prototype.off=S.prototype.removeListener,S.prototype.addListener=S.prototype.on,S.prefixed=L,S.EventEmitter=S,re.exports=S},"./node_modules/url-toolkit/src/url-toolkit.js":function(re,W,I){(function(H){var L=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,C=/^([^\/?#]*)([^]*)$/,j=/(?:\/|^)\.(?=\/)/g,U=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,O={buildAbsoluteURL:function(S,_,b){if(b=b||{},S=S.trim(),_=_.trim(),!_){if(!b.alwaysNormalize)return S;var h=O.parseURL(S);if(!h)throw new Error("Error trying to parse base URL.");return h.path=O.normalizePath(h.path),O.buildURLFromParts(h)}var l=O.parseURL(_);if(!l)throw new Error("Error trying to parse relative URL.");if(l.scheme)return b.alwaysNormalize?(l.path=O.normalizePath(l.path),O.buildURLFromParts(l)):_;var r=O.parseURL(S);if(!r)throw new Error("Error trying to parse base URL.");if(!r.netLoc&&r.path&&r.path[0]!=="/"){var s=C.exec(r.path);r.netLoc=s[1],r.path=s[2]}r.netLoc&&!r.path&&(r.path="/");var a={scheme:r.scheme,netLoc:l.netLoc,path:null,params:l.params,query:l.query,fragment:l.fragment};if(!l.netLoc&&(a.netLoc=r.netLoc,l.path[0]!=="/"))if(!l.path)a.path=r.path,l.params||(a.params=r.params,l.query||(a.query=r.query));else{var e=r.path,t=e.substring(0,e.lastIndexOf("/")+1)+l.path;a.path=O.normalizePath(t)}return a.path===null&&(a.path=b.alwaysNormalize?O.normalizePath(l.path):l.path),O.buildURLFromParts(a)},parseURL:function(S){var _=L.exec(S);return _?{scheme:_[1]||"",netLoc:_[2]||"",path:_[3]||"",params:_[4]||"",query:_[5]||"",fragment:_[6]||""}:null},normalizePath:function(S){for(S=S.split("").reverse().join("").replace(j,"");S.length!==(S=S.replace(U,"")).length;);return S.split("").reverse().join("")},buildURLFromParts:function(S){return S.scheme+S.netLoc+S.path+S.params+S.query+S.fragment}};re.exports=O})(this)},"./node_modules/webworkify-webpack/index.js":function(re,W,I){function H(b){var h={};function l(s){if(h[s])return h[s].exports;var a=h[s]={i:s,l:!1,exports:{}};return b[s].call(a.exports,a,a.exports,l),a.l=!0,a.exports}l.m=b,l.c=h,l.i=function(s){return s},l.d=function(s,a,e){l.o(s,a)||Object.defineProperty(s,a,{configurable:!1,enumerable:!0,get:e})},l.r=function(s){Object.defineProperty(s,"__esModule",{value:!0})},l.n=function(s){var a=s&&s.__esModule?function(){return s.default}:function(){return s};return l.d(a,"a",a),a},l.o=function(s,a){return Object.prototype.hasOwnProperty.call(s,a)},l.p="/",l.oe=function(s){throw console.error(s),s};var r=l(l.s=ENTRY_MODULE);return r.default||r}var L="[\\.|\\-|\\+|\\w|/|@]+",C="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+L+").*?\\)";function j(b){return(b+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function U(b){return!isNaN(1*b)}function O(b,h,l){var r={};r[l]=[];var s=h.toString(),a=s.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!a)return r;for(var e=a[1],t=new RegExp("(\\\\n|\\W)"+j(e)+C,"g"),n;n=t.exec(s);){if(n[3]==="dll-reference")continue;r[l].push(n[3])}for(t=new RegExp("\\("+j(e)+'\\("(dll-reference\\s('+L+'))"\\)\\)'+C,"g");n=t.exec(s);)b[n[2]]||(r[l].push(n[1]),b[n[2]]=I(n[1]).m),r[n[2]]=r[n[2]]||[],r[n[2]].push(n[4]);for(var x=Object.keys(r),E=0;E<x.length;E++)for(var g=0;g<r[x[E]].length;g++)U(r[x[E]][g])&&(r[x[E]][g]=1*r[x[E]][g]);return r}function S(b){var h=Object.keys(b);return h.reduce(function(l,r){return l||b[r].length>0},!1)}function _(b,h){for(var l={main:[h]},r={main:[]},s={main:{}};S(l);)for(var a=Object.keys(l),e=0;e<a.length;e++){var t=a[e],n=l[t],x=n.pop();if(s[t]=s[t]||{},s[t][x]||!b[t][x])continue;s[t][x]=!0,r[t]=r[t]||[],r[t].push(x);for(var E=O(b,b[t][x],t),g=Object.keys(E),y=0;y<g.length;y++)l[g[y]]=l[g[y]]||[],l[g[y]]=l[g[y]].concat(E[g[y]])}return r}re.exports=function(b,h){h=h||{};var l={main:I.m},r=h.all?{main:Object.keys(l.main)}:_(l,b),s="";Object.keys(r).filter(function(x){return x!=="main"}).forEach(function(x){for(var E=0;r[x][E];)E++;r[x].push(E),l[x][E]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",s=s+"var "+x+" = ("+H.toString().replace("ENTRY_MODULE",JSON.stringify(E))+")({"+r[x].map(function(g){return""+JSON.stringify(g)+": "+l[x][g].toString()}).join(",")+`});
|
|
`}),s=s+"new (("+H.toString().replace("ENTRY_MODULE",JSON.stringify(b))+")({"+r.main.map(function(x){return""+JSON.stringify(x)+": "+l.main[x].toString()}).join(",")+"}))(self);";var a=new window.Blob([s],{type:"text/javascript"});if(h.bare)return a;var e=window.URL||window.webkitURL||window.mozURL||window.msURL,t=e.createObjectURL(a),n=new window.Worker(t);return n.objectURL=t,n}},"./src/config.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"hlsDefaultConfig",function(){return y}),I.d(W,"mergeConfig",function(){return d}),I.d(W,"enableStreamingMode",function(){return u});var H=I("./src/controller/abr-controller.ts"),L=I("./src/controller/audio-stream-controller.ts"),C=I("./src/controller/audio-track-controller.ts"),j=I("./src/controller/subtitle-stream-controller.ts"),U=I("./src/controller/subtitle-track-controller.ts"),O=I("./src/controller/buffer-controller.ts"),S=I("./src/controller/timeline-controller.ts"),_=I("./src/controller/cap-level-controller.ts"),b=I("./src/controller/fps-controller.ts"),h=I("./src/controller/eme-controller.ts"),l=I("./src/controller/cmcd-controller.ts"),r=I("./src/utils/xhr-loader.ts"),s=I("./src/utils/fetch-loader.ts"),a=I("./src/utils/cues.ts"),e=I("./src/utils/mediakeys-helper.ts"),t=I("./src/utils/logger.ts");function n(){return n=Object.assign||function(i){for(var o=1;o<arguments.length;o++){var p=arguments[o];for(var f in p)Object.prototype.hasOwnProperty.call(p,f)&&(i[f]=p[f])}return i},n.apply(this,arguments)}function x(i,o){var p=Object.keys(i);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(i);o&&(f=f.filter(function(c){return Object.getOwnPropertyDescriptor(i,c).enumerable})),p.push.apply(p,f)}return p}function E(i){for(var o=1;o<arguments.length;o++){var p=arguments[o]!=null?arguments[o]:{};o%2?x(Object(p),!0).forEach(function(f){g(i,f,p[f])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(p)):x(Object(p)).forEach(function(f){Object.defineProperty(i,f,Object.getOwnPropertyDescriptor(p,f))})}return i}function g(i,o,p){return o in i?Object.defineProperty(i,o,{value:p,enumerable:!0,configurable:!0,writable:!0}):i[o]=p,i}var y=E(E({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:r.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:H.default,bufferController:O.default,capLevelController:_.default,fpsController:b.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:j.SubtitleStreamController,subtitleTrackController:U.default,timelineController:S.TimelineController,audioStreamController:L.default,audioTrackController:C.default,emeController:h.default,cmcdController:l.default});function v(){return{cueHandler:a.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 d(i,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({},i,o)}function u(i){var o=i.loader;if(o!==s.default&&o!==r.default)t.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),i.progressive=!1;else{var p=Object(s.fetchSupported)();p&&(i.loader=s.default,i.progressive=!0,i.enableSoftwareAES=!0,t.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(re,W,I){"use strict";I.r(W);var H=I("./src/polyfills/number.ts"),L=I("./src/utils/ewma-bandwidth-estimator.ts"),C=I("./src/events.ts"),j=I("./src/utils/buffer-helper.ts"),U=I("./src/errors.ts"),O=I("./src/types/loader.ts"),S=I("./src/utils/logger.ts");function _(l,r){for(var s=0;s<r.length;s++){var a=r[s];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(l,a.key,a)}}function b(l,r,s){return r&&_(l.prototype,r),s&&_(l,s),l}var h=function(){function l(s){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=s;var a=s.config;this.bwEstimator=new L.default(a.abrEwmaSlowVoD,a.abrEwmaFastVoD,a.abrEwmaDefaultEstimate),this.registerListeners()}var r=l.prototype;return r.registerListeners=function(){var a=this.hls;a.on(C.Events.FRAG_LOADING,this.onFragLoading,this),a.on(C.Events.FRAG_LOADED,this.onFragLoaded,this),a.on(C.Events.FRAG_BUFFERED,this.onFragBuffered,this),a.on(C.Events.LEVEL_LOADED,this.onLevelLoaded,this),a.on(C.Events.ERROR,this.onError,this)},r.unregisterListeners=function(){var a=this.hls;a.off(C.Events.FRAG_LOADING,this.onFragLoading,this),a.off(C.Events.FRAG_LOADED,this.onFragLoaded,this),a.off(C.Events.FRAG_BUFFERED,this.onFragBuffered,this),a.off(C.Events.LEVEL_LOADED,this.onLevelLoaded,this),a.off(C.Events.ERROR,this.onError,this)},r.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},r.onFragLoading=function(a,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)}},r.onLevelLoaded=function(a,e){var t=this.hls.config;e.details.live?this.bwEstimator.update(t.abrEwmaSlowLive,t.abrEwmaFastLive):this.bwEstimator.update(t.abrEwmaSlowVoD,t.abrEwmaFastVoD)},r._abandonRulesCheck=function(){var a=this.fragCurrent,e=this.partCurrent,t=this.hls,n=t.autoLevelEnabled,x=t.config,E=t.media;if(!a||!E)return;var g=e?e.stats:a.stats,y=e?e.duration:a.duration;if(g.aborted){S.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!n||E.paused||!E.playbackRate||!E.readyState)return;var v=performance.now()-g.loading.start,d=Math.abs(E.playbackRate);if(v<=500*y/d)return;var u=t.levels,i=t.minAutoLevel,o=u[a.level],p=g.total||Math.max(g.loaded,Math.round(y*o.maxBitrate/8)),f=Math.max(1,g.bwEstimate?g.bwEstimate/8:g.loaded*1e3/v),c=(p-g.loaded)/f,w=E.currentTime,A=(j.BufferHelper.bufferInfo(E,w,x.maxBufferHole).end-w)/d;if(A>=2*y/d||c<=A)return;var P=Number.POSITIVE_INFINITY,N;for(N=a.level-1;N>i;N--){var B=u[N].maxBitrate;if(P=y*B/(8*.8*f),P<A)break}if(P>=c)return;var R=this.bwEstimator.getEstimate();S.logger.warn("Fragment "+a.sn+(e?" part "+e.index:"")+" of level "+a.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+N+`
|
|
Current BW estimate: `+(Object(H.isFiniteNumber)(R)?(R/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+c.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+P.toFixed(3)+` s
|
|
Time to underbuffer: `+A.toFixed(3)+" s"),t.nextLoadLevel=N,this.bwEstimator.sample(v,g.loaded),this.clearTimer(),a.loader&&(this.fragCurrent=this.partCurrent=null,a.loader.abort()),t.trigger(C.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:a,part:e,stats:g})},r.onFragLoaded=function(a,e){var t=e.frag,n=e.part;if(t.type===O.PlaylistLevelType.MAIN&&Object(H.isFiniteNumber)(t.sn)){var x=n?n.stats:t.stats,E=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],y=(g.loaded?g.loaded.bytes:0)+x.loaded,v=(g.loaded?g.loaded.duration:0)+E;g.loaded={bytes:y,duration:v},g.realBitrate=Math.round(8*y/v)}if(t.bitrateTest){var d={stats:x,frag:t,part:n,id:t.type};this.onFragBuffered(C.Events.FRAG_BUFFERED,d),t.bitrateTest=!1}}},r.onFragBuffered=function(a,e){var t=e.frag,n=e.part,x=n?n.stats:t.stats;if(x.aborted)return;if(t.type!==O.PlaylistLevelType.MAIN||t.sn==="initSegment")return;var E=x.parsing.end-x.loading.start;this.bwEstimator.sample(E,x.loaded),x.bwEstimate=this.bwEstimator.getEstimate(),t.bitrateTest?this.bitrateTestDelay=E/1e3:this.bitrateTestDelay=0},r.onError=function(a,e){switch(e.details){case U.ErrorDetails.FRAG_LOAD_ERROR:case U.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},r.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},r.getNextABRAutoLevel=function(){var a=this.fragCurrent,e=this.partCurrent,t=this.hls,n=t.maxAutoLevel,x=t.config,E=t.minAutoLevel,g=t.media,y=e?e.duration:a?a.duration:0,v=g?g.currentTime:0,d=g&&g.playbackRate!==0?Math.abs(g.playbackRate):1,u=this.bwEstimator?this.bwEstimator.getEstimate():x.abrEwmaDefaultEstimate,i=(j.BufferHelper.bufferInfo(g,v,x.maxBufferHole).end-v)/d,o=this.findBestLevel(u,E,n,i,x.abrBandWidthFactor,x.abrBandWidthUpFactor);if(o>=0)return o;S.logger.trace((i?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var p=y?Math.min(y,x.maxStarvationDelay):x.maxStarvationDelay,f=x.abrBandWidthFactor,c=x.abrBandWidthUpFactor;if(!i){var w=this.bitrateTestDelay;if(w){var A=y?Math.min(y,x.maxLoadingDelay):x.maxLoadingDelay;p=A-w,S.logger.trace("bitrate test took "+Math.round(1e3*w)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*p)+" ms"),f=c=1}}return o=this.findBestLevel(u,E,n,i+p,f,c),Math.max(o,0)},r.findBestLevel=function(a,e,t,n,x,E){for(var g,y=this.fragCurrent,v=this.partCurrent,d=this.lastLoadedFragLevel,u=this.hls.levels,i=u[d],o=!!(i!=null&&(g=i.details)!==null&&g!==void 0&&g.live),p=i==null?void 0:i.codecSet,f=v?v.duration:y?y.duration:0,c=t;c>=e;c--){var w=u[c];if(!w||p&&w.codecSet!==p)continue;var A=w.details,P=(v?A==null?void 0:A.partTarget:A==null?void 0:A.averagetargetduration)||f,N=void 0;c<=d?N=x*a:N=E*a;var B=u[c].maxBitrate,R=B*P/N;if(S.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+c+"/"+Math.round(N)+"/"+B+"/"+P+"/"+n+"/"+R),N>B&&(!R||o&&!this.bitrateTestDelay||R<n))return c}return-1},b(l,[{key:"nextAutoLevel",get:function(){var a=this._nextAutoLevel,e=this.bwEstimator;if(a!==-1&&(!e||!e.canEstimate()))return a;var t=this.getNextABRAutoLevel();return a!==-1&&(t=Math.min(a,t)),t},set:function(a){this._nextAutoLevel=a}}]),l}();W.default=h},"./src/controller/audio-stream-controller.ts":function(re,W,I){"use strict";I.r(W);var H=I("./src/polyfills/number.ts"),L=I("./src/controller/base-stream-controller.ts"),C=I("./src/events.ts"),j=I("./src/utils/buffer-helper.ts"),U=I("./src/controller/fragment-tracker.ts"),O=I("./src/types/level.ts"),S=I("./src/types/loader.ts"),_=I("./src/loader/fragment.ts"),b=I("./src/demux/chunk-cache.ts"),h=I("./src/demux/transmuxer-interface.ts"),l=I("./src/types/transmuxer.ts"),r=I("./src/controller/fragment-finders.ts"),s=I("./src/utils/discontinuities.ts"),a=I("./src/errors.ts"),e=I("./src/utils/logger.ts");function t(){return t=Object.assign||function(y){for(var v=1;v<arguments.length;v++){var d=arguments[v];for(var u in d)Object.prototype.hasOwnProperty.call(d,u)&&(y[u]=d[u])}return y},t.apply(this,arguments)}function n(y,v){y.prototype=Object.create(v.prototype),y.prototype.constructor=y,x(y,v)}function x(y,v){return x=Object.setPrototypeOf||function(u,i){return u.__proto__=i,u},x(y,v)}var E=100,g=function(y){n(v,y);function v(u,i){var o;return o=y.call(this,u,i,"[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 d=v.prototype;return d.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},d._registerListeners=function(){var i=this.hls;i.on(C.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.on(C.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.on(C.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.on(C.Events.LEVEL_LOADED,this.onLevelLoaded,this),i.on(C.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),i.on(C.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),i.on(C.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),i.on(C.Events.ERROR,this.onError,this),i.on(C.Events.BUFFER_RESET,this.onBufferReset,this),i.on(C.Events.BUFFER_CREATED,this.onBufferCreated,this),i.on(C.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),i.on(C.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),i.on(C.Events.FRAG_BUFFERED,this.onFragBuffered,this)},d._unregisterListeners=function(){var i=this.hls;i.off(C.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.off(C.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.off(C.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.off(C.Events.LEVEL_LOADED,this.onLevelLoaded,this),i.off(C.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),i.off(C.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),i.off(C.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),i.off(C.Events.ERROR,this.onError,this),i.off(C.Events.BUFFER_RESET,this.onBufferReset,this),i.off(C.Events.BUFFER_CREATED,this.onBufferCreated,this),i.off(C.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),i.off(C.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),i.off(C.Events.FRAG_BUFFERED,this.onFragBuffered,this)},d.onInitPtsFound=function(i,o){var p=o.frag,f=o.id,c=o.initPTS;if(f==="main"){var w=p.cc;this.initPTS[p.cc]=c,this.log("InitPTS for cc: "+w+" found from main: "+c),this.videoTrackCC=w,this.state===L.State.WAITING_INIT_PTS&&this.tick()}},d.startLoad=function(i){if(!this.levels){this.startPosition=i,this.state=L.State.STOPPED;return}var o=this.lastCurrentTime;this.stopLoad(),this.setInterval(E),this.fragLoadError=0,o>0&&i===-1?(this.log("Override startPosition with lastCurrentTime @"+o.toFixed(3)),this.state=L.State.IDLE):(this.loadedmetadata=!1,this.state=L.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=i,this.tick()},d.doTick=function(){switch(this.state){case L.State.IDLE:this.doTickIdle();break;case L.State.WAITING_TRACK:{var i,o=this.levels,p=this.trackId,f=o==null||((i=o[p])===null||i===void 0)?void 0:i.details;if(f){if(this.waitForCdnTuneIn(f))break;this.state=L.State.WAITING_INIT_PTS}break}case L.State.FRAG_LOADING_WAITING_RETRY:{var c,w=performance.now(),A=this.retryDate;(!A||w>=A||(c=this.media)!==null&&c!==void 0&&c.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=L.State.IDLE);break}case L.State.WAITING_INIT_PTS:{var P=this.waitingData;if(P){var N=P.frag,B=P.part,R=P.cache,F=P.complete;if(this.initPTS[N.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=L.State.FRAG_LOADING;var K=R.flush(),X={frag:N,part:B,payload:K,networkDetails:null};this._handleFragmentLoadProgress(X),F&&y.prototype._handleFragmentLoadComplete.call(this,X)}else if(this.videoTrackCC!==this.waitingVideoCC)e.logger.log("Waiting fragment cc ("+N.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ee=this.getLoadPosition(),oe=j.BufferHelper.bufferInfo(this.mediaBuffer,ee,this.config.maxBufferHole),ce=Object(r.fragmentWithinToleranceTest)(oe.end,this.config.maxFragLookUpTolerance,N);ce<0&&(e.logger.log("Waiting fragment cc ("+N.cc+") @ "+N.start+" cancelled because another fragment at "+oe.end+" is needed"),this.clearWaitingFragment())}}else this.state=L.State.IDLE}}this.onTickEnd()},d.clearWaitingFragment=function(){var i=this.waitingData;i&&(this.fragmentTracker.removeFragment(i.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=L.State.IDLE)},d.onTickEnd=function(){var i=this.media;if(!i||!i.readyState)return;var o=this.mediaBuffer?this.mediaBuffer:i,p=o.buffered;!this.loadedmetadata&&p.length&&(this.loadedmetadata=!0),this.lastCurrentTime=i.currentTime},d.doTickIdle=function(){var i,o,p=this.hls,f=this.levels,c=this.media,w=this.trackId,A=p.config;if(!f||!f[w])return;if(!c&&(this.startFragRequested||!A.startFragPrefetch))return;var P=f[w],N=P.details;if(!N||N.live&&this.levelLastLoaded!==w||this.waitForCdnTuneIn(N)){this.state=L.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,_.ElementaryStreamTypes.AUDIO,S.PlaylistLevelType.AUDIO));var B=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,S.PlaylistLevelType.AUDIO);if(B===null)return;var R=B.len,F=this.getMaxBufferLength(),K=this.audioSwitch;if(R>=F&&!K)return;if(!K&&this._streamEnded(B,N)){p.trigger(C.Events.BUFFER_EOS,{type:"audio"}),this.state=L.State.ENDED;return}var X=N.fragments,ee=X[0].start,oe=B.end;if(K){var ce=this.getLoadPosition();oe=ce,N.PTSKnown&&ce<ee&&((B.end>ee||B.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),c.currentTime=ee+.05))}var le=this.getNextFragment(oe,N);if(!le){this.bufferFlushed=!0;return}((i=le.decryptdata)===null||i===void 0?void 0:i.keyFormat)==="identity"&&!((o=le.decryptdata)!==null&&o!==void 0&&o.key)?this.loadKey(le,N):this.loadFragment(le,N,oe)},d.getMaxBufferLength=function(){var i=y.prototype.getMaxBufferLength.call(this),o=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,S.PlaylistLevelType.MAIN);return o===null?i:Math.max(i,o.len)},d.onMediaDetaching=function(){this.videoBuffer=null,y.prototype.onMediaDetaching.call(this)},d.onAudioTracksUpdated=function(i,o){var p=o.audioTracks;this.resetTransmuxer(),this.levels=p.map(function(f){return new O.Level(f)})},d.onAudioTrackSwitching=function(i,o){var p=!!o.url;this.trackId=o.id;var f=this.fragCurrent;f!=null&&f.loader&&f.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),p?this.setInterval(E):this.resetTransmuxer(),p?(this.audioSwitch=!0,this.state=L.State.IDLE):this.state=L.State.STOPPED,this.tick()},d.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},d.onLevelLoaded=function(i,o){this.mainDetails=o.details},d.onAudioTrackLoaded=function(i,o){var p,f=this.levels,c=o.details,w=o.id;if(!f){this.warn("Audio tracks were reset while loading level "+w);return}this.log("Track "+w+" loaded ["+c.startSN+","+c.endSN+"],duration:"+c.totalduration);var A=f[w],P=0;if(c.live||(p=A.details)!==null&&p!==void 0&&p.live){var N=this.mainDetails;if(c.fragments[0]||(c.deltaUpdateFailed=!0),c.deltaUpdateFailed||!N)return;!A.details&&c.hasProgramDateTime&&N.hasProgramDateTime?(Object(s.alignMediaPlaylistByPDT)(c,N),P=c.fragments[0].start):P=this.alignPlaylists(c,A.details)}A.details=c,this.levelLastLoaded=w,!this.startFragRequested&&(this.mainDetails||!c.live)&&this.setStartPosition(A.details,P),this.state===L.State.WAITING_TRACK&&!this.waitForCdnTuneIn(c)&&(this.state=L.State.IDLE),this.tick()},d._handleFragmentLoadProgress=function(i){var o,p=i.frag,f=i.part,c=i.payload,w=this.config,A=this.trackId,P=this.levels;if(!P){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+p.sn+" of level "+p.level+" will not be buffered");return}var N=P[A];console.assert(N,"Audio track is defined on fragment load progress");var B=N.details;console.assert(B,"Audio track details are defined on fragment load progress");var R=w.defaultAudioCodec||N.audioCodec||"mp4a.40.2",F=this.transmuxer;F||(F=this.transmuxer=new h.default(this.hls,S.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var K=this.initPTS[p.cc],X=(o=p.initSegment)===null||o===void 0?void 0:o.data;if(K!==void 0){var ee=!1,oe=f?f.index:-1,ce=oe!==-1,le=new l.ChunkMetadata(p.level,p.sn,p.stats.chunkCount,c.byteLength,oe,ce);F.push(c,X,R,"",p,f,B.totalduration,ee,le,K)}else{e.logger.log("Unknown video PTS for cc "+p.cc+", waiting for video PTS before demuxing audio frag "+p.sn+" of ["+B.startSN+" ,"+B.endSN+"],track "+A);var be=this.waitingData=this.waitingData||{frag:p,part:f,cache:new b.default,complete:!1},pe=be.cache;pe.push(new Uint8Array(c)),this.waitingVideoCC=this.videoTrackCC,this.state=L.State.WAITING_INIT_PTS}},d._handleFragmentLoadComplete=function(i){if(this.waitingData){this.waitingData.complete=!0;return}y.prototype._handleFragmentLoadComplete.call(this,i)},d.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},d.onBufferCreated=function(i,o){var p=o.tracks.audio;p&&(this.mediaBuffer=p.buffer),o.tracks.video&&(this.videoBuffer=o.tracks.video.buffer)},d.onFragBuffered=function(i,o){var p=o.frag,f=o.part;if(p.type!==S.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(p)){this.warn("Fragment "+p.sn+(f?" p: "+f.index:"")+" of level "+p.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}p.sn!=="initSegment"&&(this.fragPrevious=p,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(C.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(p,f)},d.onError=function(i,o){switch(o.details){case a.ErrorDetails.FRAG_LOAD_ERROR:case a.ErrorDetails.FRAG_LOAD_TIMEOUT:case a.ErrorDetails.KEY_LOAD_ERROR:case a.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(S.PlaylistLevelType.AUDIO,o);break;case a.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case a.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==L.State.ERROR&&this.state!==L.State.STOPPED&&(this.state=o.fatal?L.State.ERROR:L.State.IDLE,this.warn(o.details+" while loading frag, switching to "+this.state+" state"));break;case a.ErrorDetails.BUFFER_FULL_ERROR:if(o.parent==="audio"&&(this.state===L.State.PARSING||this.state===L.State.PARSED)){var p=!0,f=this.getFwdBufferInfo(this.mediaBuffer,S.PlaylistLevelType.AUDIO);f&&f.len>.5&&(p=!this.reduceMaxBufferLength(f.len)),p&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,y.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},d.onBufferFlushed=function(i,o){var p=o.type;p===_.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},d._handleTransmuxComplete=function(i){var o,p="audio",f=this.hls,c=i.remuxResult,w=i.chunkMeta,A=this.getCurrentContext(w);if(!A){this.warn("The loading context changed while buffering fragment "+w.sn+" of level "+w.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(w.level);return}var P=A.frag,N=A.part,B=c.audio,R=c.text,F=c.id3,K=c.initSegment;if(this.fragContextChanged(P))return;if(this.state=L.State.PARSING,this.audioSwitch&&B&&this.completeAudioSwitch(),K!=null&&K.tracks&&(this._bufferInitSegment(K.tracks,P,w),f.trigger(C.Events.FRAG_PARSING_INIT_SEGMENT,{frag:P,id:p,tracks:K.tracks})),B){var X=B.startPTS,ee=B.endPTS,oe=B.startDTS,ce=B.endDTS;N&&(N.elementaryStreams[_.ElementaryStreamTypes.AUDIO]={startPTS:X,endPTS:ee,startDTS:oe,endDTS:ce}),P.setElementaryStreamInfo(_.ElementaryStreamTypes.AUDIO,X,ee,oe,ce),this.bufferFragmentData(B,P,N,w)}if(F!=null&&(o=F.samples)!==null&&o!==void 0&&o.length){var le=t({frag:P,id:p},F);f.trigger(C.Events.FRAG_PARSING_METADATA,le)}if(R){var be=t({frag:P,id:p},R);f.trigger(C.Events.FRAG_PARSING_USERDATA,be)}},d._bufferInitSegment=function(i,o,p){if(this.state!==L.State.PARSING)return;i.video&&delete i.video;var f=i.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(C.Events.BUFFER_CODECS,i);var c=f.initSegment;if(c!=null&&c.byteLength){var w={type:"audio",frag:o,part:null,chunkMeta:p,parent:o.type,data:c};this.hls.trigger(C.Events.BUFFER_APPENDING,w)}this.tick()},d.loadFragment=function(i,o,p){var f=this.fragmentTracker.getState(i);this.fragCurrent=i,(this.audioSwitch||f===U.FragmentState.NOT_LOADED||f===U.FragmentState.PARTIAL)&&(i.sn==="initSegment"?this._loadInitSegment(i):o.live&&!Object(H.isFiniteNumber)(this.initPTS[i.cc])?(this.log("Waiting for video PTS in continuity counter "+i.cc+" of live stream before loading audio fragment "+i.sn+" of level "+this.trackId),this.state=L.State.WAITING_INIT_PTS):(this.startFragRequested=!0,y.prototype.loadFragment.call(this,i,o,p)))},d.completeAudioSwitch=function(){var i=this.hls,o=this.media,p=this.trackId;o&&(this.log("Switching audio track : flushing all audio"),y.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,i.trigger(C.Events.AUDIO_TRACK_SWITCHED,{id:p})},v}(L.default);W.default=g},"./src/controller/audio-track-controller.ts":function(re,W,I){"use strict";I.r(W);var H=I("./src/events.ts"),L=I("./src/errors.ts"),C=I("./src/controller/base-playlist-controller.ts"),j=I("./src/types/loader.ts");function U(h,l){for(var r=0;r<l.length;r++){var s=l[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(h,s.key,s)}}function O(h,l,r){return l&&U(h.prototype,l),r&&U(h,r),h}function S(h,l){h.prototype=Object.create(l.prototype),h.prototype.constructor=h,_(h,l)}function _(h,l){return _=Object.setPrototypeOf||function(s,a){return s.__proto__=a,s},_(h,l)}var b=function(h){S(l,h);function l(s){var a;return a=h.call(this,s,"[audio-track-controller]")||this,a.tracks=[],a.groupId=null,a.tracksInGroup=[],a.trackId=-1,a.trackName="",a.selectDefaultTrack=!0,a.registerListeners(),a}var r=l.prototype;return r.registerListeners=function(){var a=this.hls;a.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(H.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.on(H.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),a.on(H.Events.ERROR,this.onError,this)},r.unregisterListeners=function(){var a=this.hls;a.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(H.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.off(H.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),a.off(H.Events.ERROR,this.onError,this)},r.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,h.prototype.destroy.call(this)},r.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},r.onManifestParsed=function(a,e){this.tracks=e.audioTracks||[]},r.onAudioTrackLoaded=function(a,e){var t=e.id,n=e.details,x=this.tracksInGroup[t];if(!x){this.warn("Invalid audio track id "+t);return}var E=x.details;x.details=e.details,this.log("audioTrack "+t+" loaded ["+n.startSN+"-"+n.endSN+"]"),t===this.trackId&&(this.retryCount=0,this.playlistLoaded(t,e,E))},r.onLevelLoading=function(a,e){this.switchLevel(e.level)},r.onLevelSwitching=function(a,e){this.switchLevel(e.level)},r.switchLevel=function(a){var e=this.hls.levels[a];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(E){return!t||E.groupId===t});this.selectDefaultTrack&&!n.some(function(E){return E.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=n;var x={audioTracks:n};this.log("Updating audio tracks, "+n.length+' track(s) found in "'+t+'" group-id'),this.hls.trigger(H.Events.AUDIO_TRACKS_UPDATED,x),this.selectInitialTrack()}},r.onError=function(a,e){if(h.prototype.onError.call(this,a,e),e.fatal||!e.context)return;e.context.type===j.PlaylistContextType.AUDIO_TRACK&&e.context.id===this.trackId&&e.context.groupId===this.groupId&&this.retryLoadingOrFail(e)},r.setAudioTrack=function(a){var e=this.tracksInGroup;if(a<0||a>=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 "+a);var n=e[a],x=n.id,E=n.groupId,g=E===void 0?"":E,y=n.name,v=n.type,d=n.url;if(this.trackId=a,this.trackName=y,this.selectDefaultTrack=!1,this.hls.trigger(H.Events.AUDIO_TRACK_SWITCHING,{id:x,groupId:g,name:y,type:v,url:d}),n.details&&!n.details.live)return;var u=this.switchParams(n.url,t==null?void 0:t.details);this.loadPlaylist(u)},r.selectInitialTrack=function(){var a=this.tracksInGroup;console.assert(a.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(H.Events.ERROR,{type:L.ErrorTypes.MEDIA_ERROR,details:L.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},r.findTrackId=function(a){for(var e=this.tracksInGroup,t=0;t<e.length;t++){var n=e[t];if((!this.selectDefaultTrack||n.default)&&(!a||a===n.name))return n.id}return-1},r.loadPlaylist=function(a){var e=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(e)){var t=e.id,n=e.groupId,x=e.url;if(a)try{x=a.addDirectives(x)}catch(E){this.warn("Could not construct new URL with HLS Delivery Directives: "+E)}this.log("loading audio-track playlist for id: "+t),this.clearTimer(),this.hls.trigger(H.Events.AUDIO_TRACK_LOADING,{url:x,id:t,groupId:n,deliveryDirectives:a||null})}},O(l,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(a){this.selectDefaultTrack=!1,this.setAudioTrack(a)}}]),l}(C.default);W.default=b},"./src/controller/base-playlist-controller.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"default",function(){return O});var H=I("./src/polyfills/number.ts"),L=I("./src/types/level.ts"),C=I("./src/controller/level-helper.ts"),j=I("./src/utils/logger.ts"),U=I("./src/errors.ts"),O=function(){function S(b,h){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=j.logger.log.bind(j.logger,h+":"),this.warn=j.logger.warn.bind(j.logger,h+":"),this.hls=b}var _=S.prototype;return _.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},_.onError=function(h,l){l.fatal&&l.type===U.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},_.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},_.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},_.stopLoad=function(){this.canLoad=!1,this.clearTimer()},_.switchParams=function(h,l){var r=l==null?void 0:l.renditionReports;if(r)for(var s=0;s<r.length;s++){var a=r[s],e=""+a.URI;if(e===h.substr(-e.length)){var t=parseInt(a["LAST-MSN"]),n=parseInt(a["LAST-PART"]);if(l&&this.hls.config.lowLatencyMode){var x=Math.min(l.age-l.partTarget,l.targetduration);n!==void 0&&x>l.partTarget&&(n+=1)}if(Object(H.isFiniteNumber)(t))return new L.HlsUrlParameters(t,Object(H.isFiniteNumber)(n)?n:void 0,L.HlsSkip.No)}}},_.loadPlaylist=function(h){},_.shouldLoadTrack=function(h){return this.canLoad&&h&&!!h.url&&(!h.details||h.details.live)},_.playlistLoaded=function(h,l,r){var s=this,a=l.details,e=l.stats,t=e.loading.end?Math.max(0,self.performance.now()-e.loading.end):0;if(a.advancedDateTime=Date.now()-t,a.live||r!=null&&r.live){if(a.reloaded(r),r&&this.log("live playlist "+h+" "+(a.advanced?"REFRESHED "+a.lastPartSn+"-"+a.lastPartIndex:"MISSED")),r&&a.fragments.length>0&&Object(C.mergeDetails)(r,a),!this.canLoad||!a.live)return;var n,x=void 0,E=void 0;if(a.canBlockReload&&a.endSN&&a.advanced){var g=this.hls.config.lowLatencyMode,y=a.lastPartSn,v=a.endSN,d=a.lastPartIndex,u=d!==-1,i=y===v,o=g?0:d;u?(x=i?v+1:y,E=i?o:d+1):x=v+1;var p=a.age,f=p+a.ageHeader,c=Math.min(f-a.partTarget,a.targetduration*1.5);if(c>0){if(r&&c>r.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+r.tuneInGoal+" to: "+c+" with playlist age: "+a.age),c=0;else{var w=Math.floor(c/a.targetduration);if(x+=w,E!==void 0){var A=Math.round(c%a.targetduration/a.partTarget);E+=A}this.log("CDN Tune-in age: "+a.ageHeader+"s last advanced "+p.toFixed(2)+"s goal: "+c+" skip sn "+w+" to part "+E)}a.tuneInGoal=c}if(n=this.getDeliveryDirectives(a,l.deliveryDirectives,x,E),g||!i){this.loadPlaylist(n);return}}else n=this.getDeliveryDirectives(a,l.deliveryDirectives,x,E);var P=Object(C.computeReloadInterval)(a,e);x!==void 0&&a.canBlockReload&&(P-=a.partTarget||1),this.log("reload live playlist "+h+" in "+Math.round(P)+" ms"),this.timer=self.setTimeout(function(){return s.loadPlaylist(n)},P)}else this.clearTimer()},_.getDeliveryDirectives=function(h,l,r,s){var a=Object(L.getSkipValue)(h,r);return l!=null&&l.skip&&h.deltaUpdateFailed&&(r=l.msn,s=l.part,a=L.HlsSkip.No),new L.HlsUrlParameters(r,s,a)},_.retryLoadingOrFail=function(h){var l=this,r=this.hls.config,s=this.retryCount<r.levelLoadingMaxRetry;if(s){var a;if(this.retryCount++,h.details.indexOf("LoadTimeOut")>-1&&(a=h.context)!==null&&a!==void 0&&a.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+h.details+'"'),this.loadPlaylist();else{var e=Math.min(Math.pow(2,this.retryCount)*r.levelLoadingRetryDelay,r.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return l.loadPlaylist()},e),this.warn("retry playlist loading #"+this.retryCount+" in "+e+' ms after "'+h.details+'"')}}else this.warn('cannot recover from error "'+h.details+'"'),this.clearTimer(),h.fatal=!0;return s},S}()},"./src/controller/base-stream-controller.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"State",function(){return v}),I.d(W,"default",function(){return d});var H=I("./src/polyfills/number.ts"),L=I("./src/task-loop.ts"),C=I("./src/controller/fragment-tracker.ts"),j=I("./src/utils/buffer-helper.ts"),U=I("./src/utils/logger.ts"),O=I("./src/events.ts"),S=I("./src/errors.ts"),_=I("./src/types/transmuxer.ts"),b=I("./src/utils/mp4-tools.ts"),h=I("./src/utils/discontinuities.ts"),l=I("./src/controller/fragment-finders.ts"),r=I("./src/controller/level-helper.ts"),s=I("./src/loader/fragment-loader.ts"),a=I("./src/crypt/decrypter.ts"),e=I("./src/utils/time-ranges.ts"),t=I("./src/types/loader.ts");function n(u,i){for(var o=0;o<i.length;o++){var p=i[o];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(u,p.key,p)}}function x(u,i,o){return i&&n(u.prototype,i),o&&n(u,o),u}function E(u){if(u===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u}function g(u,i){u.prototype=Object.create(i.prototype),u.prototype.constructor=u,y(u,i)}function y(u,i){return y=Object.setPrototypeOf||function(p,f){return p.__proto__=f,p},y(u,i)}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"},d=function(u){g(i,u);function i(p,f,c){var w;return w=u.call(this)||this,w.hls=void 0,w.fragPrevious=null,w.fragCurrent=null,w.fragmentTracker=void 0,w.transmuxer=null,w._state=v.STOPPED,w.media=void 0,w.mediaBuffer=void 0,w.config=void 0,w.bitrateTest=!1,w.lastCurrentTime=0,w.nextLoadPosition=0,w.startPosition=0,w.loadedmetadata=!1,w.fragLoadError=0,w.retryDate=0,w.levels=null,w.fragmentLoader=void 0,w.levelLastLoaded=null,w.startFragRequested=!1,w.decrypter=void 0,w.initPTS=[],w.onvseeking=null,w.onvended=null,w.logPrefix="",w.log=void 0,w.warn=void 0,w.logPrefix=c,w.log=U.logger.log.bind(U.logger,c+":"),w.warn=U.logger.warn.bind(U.logger,c+":"),w.hls=p,w.fragmentLoader=new s.default(p.config),w.fragmentTracker=f,w.config=p.config,w.decrypter=new a.default(p,p.config),p.on(O.Events.KEY_LOADED,w.onKeyLoaded,E(w)),w}var o=i.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,c){var w=this.fragCurrent,A=this.fragmentTracker;if(!c.live&&w&&w.sn===c.endSN&&!f.nextStart){var P=A.getState(w);return P===C.FragmentState.PARTIAL||P===C.FragmentState.OK}return!1},o.onMediaAttached=function(f,c){var w=this.media=this.mediaBuffer=c.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),w.addEventListener("seeking",this.onvseeking),w.addEventListener("ended",this.onvended);var A=this.config;this.levels&&A.autoStartLoad&&this.state===v.STOPPED&&this.startLoad(A.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,c=this.fragCurrent,w=this.media,A=this.mediaBuffer,P=this.state,N=w?w.currentTime:0,B=j.BufferHelper.bufferInfo(A||w,N,f.maxBufferHole);if(this.log("media seeking to "+(Object(H.isFiniteNumber)(N)?N.toFixed(3):N)+", state: "+P),P===v.ENDED)this.resetLoadingState();else if(c&&!B.len){var R=f.maxFragLookUpTolerance,F=c.start-R,K=c.start+c.duration+R,X=N>K;(N<F||X)&&(X&&c.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),c.loader.abort()),this.resetLoadingState())}w&&(this.lastCurrentTime=N),!this.loadedmetadata&&!B.len&&(this.nextLoadPosition=this.startPosition=N),this.tickImmediate()},o.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},o.onKeyLoaded=function(f,c){if(this.state!==v.KEY_LOADING||c.frag!==this.fragCurrent||!this.levels)return;this.state=v.IDLE;var w=this.levels[c.frag.level].details;w&&this.loadFragment(c.frag,w,c.frag.start)},o.onHandlerDestroying=function(){this.stopLoad(),u.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,u.prototype.onHandlerDestroyed.call(this)},o.loadKey=function(f,c){this.log("Loading key for "+f.sn+" of ["+c.startSN+"-"+c.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,c,w){this._loadFragForPlayback(f,c,w)},o._loadFragForPlayback=function(f,c,w){var A=this,P=function(B){if(A.fragContextChanged(f)){A.warn("Fragment "+f.sn+(B.part?" p: "+B.part.index:"")+" of level "+f.level+" was dropped during download."),A.fragmentTracker.removeFragment(f);return}f.stats.chunkCount++,A._handleFragmentLoadProgress(B)};this._doFragLoad(f,c,w,P).then(function(N){if(!N)return;A.fragLoadError=0;var B=A.state;if(A.fragContextChanged(f)){(B===v.FRAG_LOADING||B===v.BACKTRACKING||!A.fragCurrent&&B===v.PARSING)&&(A.fragmentTracker.removeFragment(f),A.state=v.IDLE);return}if("payload"in N&&(A.log("Loaded fragment "+f.sn+" of level "+f.level),A.hls.trigger(O.Events.FRAG_LOADED,N),A.state===v.BACKTRACKING)){A.fragmentTracker.backtrack(f,N),A.resetFragmentLoading(f);return}A._handleFragmentLoadComplete(N)}).catch(function(N){A.warn(N),A.resetFragmentLoading(f)})},o.flushMainBuffer=function(f,c,w){if(w===void 0&&(w=null),!(f-c))return;var A={startOffset:f,endOffset:c,type:w};this.fragLoadError=0,this.hls.trigger(O.Events.BUFFER_FLUSHING,A)},o._loadInitSegment=function(f){var c=this;this._doFragLoad(f).then(function(w){if(!w||c.fragContextChanged(f)||!c.levels)throw new Error("init load aborted");return w}).then(function(w){var A=c.hls,P=w.payload,N=f.decryptdata;if(P&&P.byteLength>0&&N&&N.key&&N.iv&&N.method==="AES-128"){var B=self.performance.now();return c.decrypter.webCryptoDecrypt(new Uint8Array(P),N.key.buffer,N.iv.buffer).then(function(R){var F=self.performance.now();return A.trigger(O.Events.FRAG_DECRYPTED,{frag:f,payload:R,stats:{tstart:B,tdecrypt:F}}),w.payload=R,w})}return w}).then(function(w){var A=c.fragCurrent,P=c.hls,N=c.levels;if(!N)throw new Error("init load aborted, missing levels");var B=N[f.level].details;console.assert(B,"Level details are defined when init segment is loaded");var R=f.stats;c.state=v.IDLE,c.fragLoadError=0,f.data=new Uint8Array(w.payload),R.parsing.start=R.buffering.start=self.performance.now(),R.parsing.end=R.buffering.end=self.performance.now(),w.frag===A&&P.trigger(O.Events.FRAG_BUFFERED,{stats:R,frag:A,part:null,id:f.type}),c.tick()}).catch(function(w){c.warn(w),c.resetFragmentLoading(f)})},o.fragContextChanged=function(f){var c=this.fragCurrent;return!f||!c||f.level!==c.level||f.sn!==c.sn||f.urlId!==c.urlId},o.fragBufferedComplete=function(f,c){var w=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+f.type+" sn: "+f.sn+(c?" part: "+c.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+f.level+" "+e.default.toString(j.BufferHelper.getBuffered(w))),this.state=v.IDLE,this.tick()},o._handleFragmentLoadComplete=function(f){var c=this.transmuxer;if(!c)return;var w=f.frag,A=f.part,P=f.partsLoaded,N=!P||P.length===0||P.some(function(R){return!R}),B=new _.ChunkMetadata(w.level,w.sn,w.stats.chunkCount+1,0,A?A.index:-1,!N);c.flush(B)},o._handleFragmentLoadProgress=function(f){},o._doFragLoad=function(f,c,w,A){var P=this;if(w===void 0&&(w=null),!this.levels)throw new Error("frag load aborted, missing levels");if(w=Math.max(f.start,w||0),this.config.lowLatencyMode&&c){var N=c.partList;if(N&&A){w>f.end&&c.fragmentHint&&(f=c.fragmentHint);var B=this.getNextPart(N,f,w);if(B>-1){var R=N[B];return this.log("Loading part sn: "+f.sn+" p: "+R.index+" cc: "+f.cc+" of playlist ["+c.startSN+"-"+c.endSN+"] parts [0-"+B+"-"+(N.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+f.level+", target: "+parseFloat(w.toFixed(3))),this.nextLoadPosition=R.start+R.duration,this.state=v.FRAG_LOADING,this.hls.trigger(O.Events.FRAG_LOADING,{frag:f,part:N[B],targetBufferTime:w}),this.doFragPartsLoad(f,N,B,A).catch(function(F){return P.handleFragLoadError(F)})}else if(!f.url||this.loadedEndOfParts(N,w))return Promise.resolve(null)}}return this.log("Loading fragment "+f.sn+" cc: "+f.cc+" "+(c?"of ["+c.startSN+"-"+c.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+f.level+", target: "+parseFloat(w.toFixed(3))),Object(H.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:w}),this.fragmentLoader.load(f,A).catch(function(F){return P.handleFragLoadError(F)})},o.doFragPartsLoad=function(f,c,w,A){var P=this;return new Promise(function(N,B){var R=[],F=function K(X){var ee=c[X];P.fragmentLoader.loadPart(f,ee,A).then(function(oe){R[ee.index]=oe;var ce=oe.part;P.hls.trigger(O.Events.FRAG_LOADED,oe);var le=c[X+1];if(le&&le.fragment===f)K(X+1);else return N({frag:f,part:ce,partsLoaded:R})}).catch(B)};F(w)})},o.handleFragLoadError=function(f){var c=f.data;return c&&c.details===S.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(c.frag,c.part):this.hls.trigger(O.Events.ERROR,c),null},o._handleTransmuxerFlush=function(f){var c=this.getCurrentContext(f);if(!c||this.state!==v.PARSING){this.fragCurrent||(this.state=v.IDLE);return}var w=c.frag,A=c.part,P=c.level,N=self.performance.now();w.stats.parsing.end=N,A&&(A.stats.parsing.end=N),this.updateLevelTiming(w,A,P,f.partial)},o.getCurrentContext=function(f){var c=this.levels,w=f.level,A=f.sn,P=f.part;if(!c||!c[w])return this.warn("Levels object was unset while buffering fragment "+A+" of level "+w+". The current chunk will not be buffered."),null;var N=c[w],B=P>-1?Object(r.getPartWith)(N,A,P):null,R=B?B.fragment:Object(r.getFragmentWithSN)(N,A,this.fragCurrent);return R?{frag:R,part:B,level:N}:null},o.bufferFragmentData=function(f,c,w,A){if(!f||this.state!==v.PARSING)return;var P=f.data1,N=f.data2,B=P;if(P&&N&&(B=Object(b.appendUint8Array)(P,N)),!B||!B.length)return;var R={type:f.type,frag:c,part:w,chunkMeta:A,parent:c.type,data:B};this.hls.trigger(O.Events.BUFFER_APPENDING,R),f.dropped&&f.independent&&!w&&this.flushBufferGap(c)},o.flushBufferGap=function(f){var c=this.media;if(!c)return;if(!j.BufferHelper.isBuffered(c,c.currentTime)){this.flushMainBuffer(0,f.start);return}var w=c.currentTime,A=j.BufferHelper.bufferInfo(c,w,0),P=f.duration,N=Math.min(this.config.maxFragLookUpTolerance*2,P*.25),B=Math.max(Math.min(f.start-N,A.end-N),w+N);f.start-B>N&&this.flushMainBuffer(B,f.start)},o.getFwdBufferInfo=function(f,c){var w=this.config,A=this.getLoadPosition();if(!Object(H.isFiniteNumber)(A))return null;var P=j.BufferHelper.bufferInfo(f,A,w.maxBufferHole);if(P.len===0&&P.nextStart!==void 0){var N=this.fragmentTracker.getBufferedFrag(A,c);if(N&&P.nextStart<N.end)return j.BufferHelper.bufferInfo(f,A,Math.max(P.nextStart,w.maxBufferHole))}return P},o.getMaxBufferLength=function(f){var c=this.config,w;return f?w=Math.max(8*c.maxBufferSize/f,c.maxBufferLength):w=c.maxBufferLength,Math.min(w,c.maxMaxBufferLength)},o.reduceMaxBufferLength=function(f){var c=this.config,w=f||c.maxBufferLength;return c.maxMaxBufferLength>=w?(c.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+c.maxMaxBufferLength+"s"),!0):!1},o.getNextFragment=function(f,c){var w,A,P=c.fragments,N=P.length;if(!N)return null;var B=this.config,R=P[0].start,F;if(c.live){var K=B.initialLiveManifestSize;if(N<K)return this.warn("Not enough fragments to start playback (have: "+N+", need: "+K+")"),null;!c.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(F=this.getInitialLiveFragment(c,P),this.startPosition=F?this.hls.liveSyncPosition||F.start:f)}else f<=R&&(F=P[0]);if(!F){var X=B.lowLatencyMode?c.partEnd:c.fragmentEnd;F=this.getFragmentAtPosition(f,X,c)}return(w=F)!==null&&w!==void 0&&w.initSegment&&!((A=F)!==null&&A!==void 0&&A.initSegment.data)&&!this.bitrateTest&&(F=F.initSegment),F},o.getNextPart=function(f,c,w){for(var A=-1,P=!1,N=!0,B=0,R=f.length;B<R;B++){var F=f[B];if(N=N&&!F.independent,A>-1&&w<F.start)break;var K=F.loaded;!K&&(P||F.independent||N)&&F.fragment===c&&(A=B),P=K}return A},o.loadedEndOfParts=function(f,c){var w=f[f.length-1];return w&&c>w.start&&w.loaded},o.getInitialLiveFragment=function(f,c){var w=this.fragPrevious,A=null;if(w){if(f.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+w.programDateTime),A=Object(l.findFragmentByPDT)(c,w.endProgramDateTime,this.config.maxFragLookUpTolerance)),!A){var P=w.sn+1;if(P>=f.startSN&&P<=f.endSN){var N=c[P-f.startSN];w.cc===N.cc&&(A=N,this.log("Live playlist, switching playlist, load frag with next SN: "+A.sn))}A||(A=Object(l.findFragWithCC)(c,w.cc),A&&this.log("Live playlist, switching playlist, load frag with same CC: "+A.sn))}}else{var B=this.hls.liveSyncPosition;B!==null&&(A=this.getFragmentAtPosition(B,this.bitrateTest?f.fragmentEnd:f.edge,f))}return A},o.getFragmentAtPosition=function(f,c,w){var A=this.config,P=this.fragPrevious,N=w.fragments,B=w.endSN,R=w.fragmentHint,F=A.maxFragLookUpTolerance,K=!!(A.lowLatencyMode&&w.partList&&R);K&&R&&!this.bitrateTest&&(N=N.concat(R),B=R.sn);var X;if(f<c){var ee=f>c-F?0:F;X=Object(l.findFragmentByPTS)(P,N,f,ee)}else X=N[N.length-1];if(X){var oe=X.sn-w.startSN,ce=P&&X.level===P.level,le=N[oe+1],be=this.fragmentTracker.getState(X);if(be===C.FragmentState.BACKTRACKED){X=null;for(var pe=oe;N[pe]&&this.fragmentTracker.getState(N[pe])===C.FragmentState.BACKTRACKED;)P?X=N[pe--]:X=N[--pe];X||(X=le)}else P&&X.sn===P.sn&&!K&&(ce&&(X.sn<B&&this.fragmentTracker.getState(le)!==C.FragmentState.OK?(this.log("SN "+X.sn+" just loaded, load next one: "+le.sn),X=le):X=null))}return X},o.synchronizeToLiveEdge=function(f){var c=this.config,w=this.media;if(!w)return;var A=this.hls.liveSyncPosition,P=w.currentTime,N=f.fragments[0].start,B=f.edge,R=P>=N-c.maxFragLookUpTolerance&&P<=B;if(A!==null&&w.duration>A&&(P<A||!R)){var F=c.liveMaxLatencyDuration!==void 0?c.liveMaxLatencyDuration:c.liveMaxLatencyDurationCount*f.targetduration;(!R&&w.readyState<4||P<B-F)&&(this.loadedmetadata||(this.nextLoadPosition=A),w.readyState&&(this.warn("Playback: "+P.toFixed(3)+" is located too far from the end of live sliding playlist: "+B+", reset currentTime to : "+A.toFixed(3)),w.currentTime=A))}},o.alignPlaylists=function(f,c){var w=this.levels,A=this.levelLastLoaded,P=this.fragPrevious,N=A!==null?w[A]:null,B=f.fragments.length;if(!B)return this.warn("No fragments in live playlist"),0;var R=f.fragments[0].start,F=!c,K=f.alignedSliding&&Object(H.isFiniteNumber)(R);if(F||!K&&!R){Object(h.alignStream)(P,N,f);var X=f.fragments[0].start;return this.log("Live playlist sliding: "+X.toFixed(2)+" start-sn: "+(c?c.startSN:"na")+"->"+f.startSN+" prev-sn: "+(P?P.sn:"na")+" fragments: "+B),X}return R},o.waitForCdnTuneIn=function(f){var c=3;return f.live&&f.canBlockReload&&f.tuneInGoal>Math.max(f.partHoldBack,f.partTarget*c)},o.setStartPosition=function(f,c){var w=this.startPosition;if(w<c&&(w=-1),w===-1||this.lastCurrentTime===-1){var A=f.startTimeOffset;Object(H.isFiniteNumber)(A)?(w=c+A,A<0&&(w+=f.totalduration),w=Math.min(Math.max(c,w),c+f.totalduration),this.log("Start time offset "+A+" found in playlist, adjust startPosition to "+w),this.startPosition=w):f.live?w=this.hls.liveSyncPosition||c:this.startPosition=w=0,this.lastCurrentTime=w}this.nextLoadPosition=w},o.getLoadPosition=function(){var f=this.media,c=0;return this.loadedmetadata&&f?c=f.currentTime:this.nextLoadPosition&&(c=this.nextLoadPosition),c},o.handleFragLoadAborted=function(f,c){this.transmuxer&&f.sn!=="initSegment"&&f.stats.aborted&&(this.warn("Fragment "+f.sn+(c?" part"+c.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,c){if(c.fatal)return;var w=c.frag;if(!w||w.type!==f)return;var A=this.fragCurrent;console.assert(A&&w.sn===A.sn&&w.level===A.level&&w.urlId===A.urlId,"Frag load error must match current frag to retry");var P=this.config;if(this.fragLoadError+1<=P.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(w.level))return;var N=Math.min(Math.pow(2,this.fragLoadError)*P.fragLoadingRetryDelay,P.fragLoadingMaxRetryTimeout);this.warn("Fragment "+w.sn+" of "+f+" "+w.level+" failed to load, retrying in "+N+"ms"),this.retryDate=self.performance.now()+N,this.fragLoadError++,this.state=v.FRAG_LOADING_WAITING_RETRY}else c.levelRetry?(f===t.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=v.IDLE):(U.logger.error(c.details+" reaches max retry, redispatch as fatal ..."),c.fatal=!0,this.hls.stopLoad(),this.state=v.ERROR)},o.afterBufferFlushed=function(f,c,w){if(!f)return;var A=j.BufferHelper.getBuffered(f);this.fragmentTracker.detectEvictedFragments(c,A,w),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 c=this.levels?this.levels[f].details:null;if(c!=null&&c.live)return this.startPosition=-1,this.setStartPosition(c,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},o.updateLevelTiming=function(f,c,w,A){var P=this,N=w.details;console.assert(!!N,"level.details must be defined");var B=Object.keys(f.elementaryStreams).reduce(function(R,F){var K=f.elementaryStreams[F];if(K){var X=K.endPTS-K.startPTS;if(X<=0)return P.warn("Could not parse fragment "+f.sn+" "+F+" duration reliably ("+X+") resetting transmuxer to fallback to playlist timing"),P.resetTransmuxer(),R||!1;var ee=A?0:Object(r.updateFragPTSDTS)(N,f,K.startPTS,K.endPTS,K.startDTS,K.endDTS);return P.hls.trigger(O.Events.LEVEL_PTS_UPDATED,{details:N,level:w,drift:ee,type:F,frag:f,start:K.startPTS,end:K.endPTS}),!0}return R},!1);B?(this.state=v.PARSED,this.hls.trigger(O.Events.FRAG_PARSED,{frag:f,part:c})):this.resetLoadingState()},o.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},x(i,[{key:"state",get:function(){return this._state},set:function(f){var c=this._state;c!==f&&(this._state=f,this.log(c+"->"+f))}}]),i}(L.default)},"./src/controller/buffer-controller.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"default",function(){return l});var H=I("./src/polyfills/number.ts"),L=I("./src/events.ts"),C=I("./src/utils/logger.ts"),j=I("./src/errors.ts"),U=I("./src/utils/buffer-helper.ts"),O=I("./src/utils/mediasource-helper.ts"),S=I("./src/loader/fragment.ts"),_=I("./src/controller/buffer-operation-queue.ts"),b=Object(O.getMediaSource)(),h=/([ha]vc.)(?:\.[^.,]+)+/,l=function(){function r(a){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,x=e.mediaSource;C.logger.log("[buffer-controller]: Media source opened"),n&&(e.updateMediaElementDuration(),t.trigger(L.Events.MEDIA_ATTACHED,{media:n})),x&&x.removeEventListener("sourceopen",e._onMediaSourceOpen),e.checkPendingTracks()},this._onMediaSourceClose=function(){C.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){C.logger.log("[buffer-controller]: Media source ended")},this.hls=a,this._initSourceBuffer(),this.registerListeners()}var s=r.prototype;return s.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},s.destroy=function(){this.unregisterListeners(),this.details=null},s.registerListeners=function(){var e=this.hls;e.on(L.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(L.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(L.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(L.Events.BUFFER_RESET,this.onBufferReset,this),e.on(L.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.on(L.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.on(L.Events.BUFFER_EOS,this.onBufferEos,this),e.on(L.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(L.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(L.Events.FRAG_PARSED,this.onFragParsed,this),e.on(L.Events.FRAG_CHANGED,this.onFragChanged,this)},s.unregisterListeners=function(){var e=this.hls;e.off(L.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(L.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(L.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(L.Events.BUFFER_RESET,this.onBufferReset,this),e.off(L.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.off(L.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.off(L.Events.BUFFER_EOS,this.onBufferEos,this),e.off(L.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(L.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(L.Events.FRAG_PARSED,this.onFragParsed,this),e.off(L.Events.FRAG_CHANGED,this.onFragChanged,this)},s._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new _.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},s.onManifestParsed=function(e,t){var n=2;(t.audio&&!t.video||!t.altAudio)&&(n=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=n,this.details=null,C.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},s.onMediaAttaching=function(e,t){var n=this.media=t.media;if(n&&b){var x=this.mediaSource=new b;x.addEventListener("sourceopen",this._onMediaSourceOpen),x.addEventListener("sourceended",this._onMediaSourceEnded),x.addEventListener("sourceclose",this._onMediaSourceClose),n.src=self.URL.createObjectURL(x),this._objectUrl=n.src}},s.onMediaDetaching=function(){var e=this.media,t=this.mediaSource,n=this._objectUrl;if(t){if(C.logger.log("[buffer-controller]: media source detaching"),t.readyState==="open")try{t.endOfStream()}catch(x){C.logger.warn("[buffer-controller]: onMediaDetaching: "+x.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()):C.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(L.Events.MEDIA_DETACHED,void 0)},s.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(x){C.logger.warn("[buffer-controller]: Failed to reset the "+t+" buffer",x)}}),this._initSourceBuffer()},s.onBufferCodecs=function(e,t){var n=this,x=this.getSourceBufferTypes().length;if(Object.keys(t).forEach(function(E){if(x){var g=n.tracks[E];if(g&&typeof g.buffer.changeType=="function"){var y=t[E],v=y.codec,d=y.levelCodec,u=y.container,i=(g.levelCodec||g.codec).replace(h,"$1"),o=(d||v).replace(h,"$1");if(i!==o){var p=u+";codecs="+(d||v);n.appendChangeType(E,p)}}}else n.pendingTracks[E]=t[E]}),x)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},s.appendChangeType=function(e,t){var n=this,x=this.operationQueue,E={execute:function(){var y=n.sourceBuffer[e];y&&(C.logger.log("[buffer-controller]: changing "+e+" sourceBuffer type to "+t),y.changeType(t)),x.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(y){C.logger.warn("[buffer-controller]: Failed to change "+e+" SourceBuffer type",y)}};x.append(E,e)},s.onBufferAppending=function(e,t){var n=this,x=this.hls,E=this.operationQueue,g=this.tracks,y=t.data,v=t.type,d=t.frag,u=t.part,i=t.chunkMeta,o=i.buffering[v],p=self.performance.now();o.start=p;var f=d.stats.buffering,c=u?u.stats.buffering:null;f.start===0&&(f.start=p),c&&c.start===0&&(c.start=p);var w=g.audio,A=v==="audio"&&i.id===1&&(w==null?void 0:w.container)==="audio/mpeg",P={execute:function(){if(o.executeStart=self.performance.now(),A){var B=n.sourceBuffer[v];if(B){var R=d.start-B.timestampOffset;Math.abs(R)>=.1&&(C.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+d.start+" (delta: "+R+") sn: "+d.sn+")"),B.timestampOffset=d.start)}}n.appendExecutor(y,v)},onStart:function(){},onComplete:function(){var B=self.performance.now();o.executeEnd=o.end=B,f.first===0&&(f.first=B),c&&c.first===0&&(c.first=B);var R=n.sourceBuffer,F={};for(var K in R)F[K]=U.BufferHelper.getBuffered(R[K]);n.appendError=0,n.hls.trigger(L.Events.BUFFER_APPENDED,{type:v,frag:d,part:u,chunkMeta:i,parent:d.type,timeRanges:F})},onError:function(B){C.logger.error("[buffer-controller]: Error encountered while trying to append to the "+v+" SourceBuffer",B);var R={type:j.ErrorTypes.MEDIA_ERROR,parent:d.type,details:j.ErrorDetails.BUFFER_APPEND_ERROR,err:B,fatal:!1};B.code===DOMException.QUOTA_EXCEEDED_ERR?R.details=j.ErrorDetails.BUFFER_FULL_ERROR:(n.appendError++,R.details=j.ErrorDetails.BUFFER_APPEND_ERROR,n.appendError>x.config.appendErrorMaxRetry&&(C.logger.error("[buffer-controller]: Failed "+x.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),R.fatal=!0)),x.trigger(L.Events.ERROR,R)}};E.append(P,v)},s.onBufferFlushing=function(e,t){var n=this,x=this.operationQueue,E=function(y){return{execute:n.removeExecutor.bind(n,y,t.startOffset,t.endOffset),onStart:function(){},onComplete:function(){n.hls.trigger(L.Events.BUFFER_FLUSHED,{type:y})},onError:function(d){C.logger.warn("[buffer-controller]: Failed to remove from "+y+" SourceBuffer",d)}}};t.type?x.append(E(t.type),t.type):this.getSourceBufferTypes().forEach(function(g){x.append(E(g),g)})},s.onFragParsed=function(e,t){var n=this,x=t.frag,E=t.part,g=[],y=E?E.elementaryStreams:x.elementaryStreams;y[S.ElementaryStreamTypes.AUDIOVIDEO]?g.push("audiovideo"):(y[S.ElementaryStreamTypes.AUDIO]&&g.push("audio"),y[S.ElementaryStreamTypes.VIDEO]&&g.push("video"));var v=function(){var u=self.performance.now();x.stats.buffering.end=u,E&&(E.stats.buffering.end=u);var i=E?E.stats:x.stats;n.hls.trigger(L.Events.FRAG_BUFFERED,{frag:x,part:E,stats:i,id:x.type})};g.length===0&&C.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+x.type+" level: "+x.level+" sn: "+x.sn),this.blockBuffers(v,g)},s.onFragChanged=function(e,t){this.flushBackBuffer()},s.onBufferEos=function(e,t){var n=this,x=this.getSourceBufferTypes().reduce(function(E,g){var y=n.sourceBuffer[g];return(!t.type||t.type===g)&&(y&&!y.ended&&(y.ended=!0,C.logger.log("[buffer-controller]: "+g+" sourceBuffer now EOS"))),E&&!!(!y||y.ended)},!0);x&&this.blockBuffers(function(){var E=n.mediaSource;if(!E||E.readyState!=="open")return;E.endOfStream()})},s.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()},s.flushBackBuffer=function(){var e=this.hls,t=this.details,n=this.media,x=this.sourceBuffer;if(!n||t===null)return;var E=this.getSourceBufferTypes();if(!E.length)return;var g=t.live&&e.config.liveBackBufferLength!==null?e.config.liveBackBufferLength:e.config.backBufferLength;if(!Object(H.isFiniteNumber)(g)||g<0)return;var y=n.currentTime,v=t.levelTargetDuration,d=Math.max(g,v),u=Math.floor(y/v)*v-d;E.forEach(function(i){var o=x[i];if(o){var p=U.BufferHelper.getBuffered(o);p.length>0&&u>p.start(0)&&(e.trigger(L.Events.BACK_BUFFER_REACHED,{bufferEnd:u}),t.live&&e.trigger(L.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:u}),e.trigger(L.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:u,type:i}))}})},s.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var e=this.details,t=this.hls,n=this.media,x=this.mediaSource,E=e.fragments[0].start+e.totalduration,g=n.duration,y=Object(H.isFiniteNumber)(x.duration)?x.duration:0;e.live&&t.config.liveDurationInfinity?(C.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),x.duration=Infinity,this.updateSeekableRange(e)):(E>y&&E>g||!Object(H.isFiniteNumber)(g))&&(C.logger.log("[buffer-controller]: Updating Media Source duration to "+E.toFixed(3)),x.duration=E)},s.updateSeekableRange=function(e){var t=this.mediaSource,n=e.fragments,x=n.length;if(x&&e.live&&t!==null&&t!==void 0&&t.setLiveSeekableRange){var E=Math.max(0,n[0].start),g=Math.max(E,E+e.totalduration);t.setLiveSeekableRange(E,g)}},s.checkPendingTracks=function(){var e=this.bufferCodecEventsExpected,t=this.operationQueue,n=this.pendingTracks,x=Object.keys(n).length;if(x&&!e||x===2){this.createSourceBuffers(n),this.pendingTracks={};var E=this.getSourceBufferTypes();if(E.length===0){this.hls.trigger(L.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}E.forEach(function(g){t.executeNext(g)})}},s.createSourceBuffers=function(e){var t=this.sourceBuffer,n=this.mediaSource;if(!n)throw Error("createSourceBuffers called when mediaSource was null");var x=0;for(var E in e)if(!t[E]){var g=e[E];if(!g)throw Error("source buffer exists for track "+E+", however track does not");var y=g.levelCodec||g.codec,v=g.container+";codecs="+y;C.logger.log("[buffer-controller]: creating sourceBuffer("+v+")");try{var d=t[E]=n.addSourceBuffer(v),u=E;this.addBufferListener(u,"updatestart",this._onSBUpdateStart),this.addBufferListener(u,"updateend",this._onSBUpdateEnd),this.addBufferListener(u,"error",this._onSBUpdateError),this.tracks[E]={buffer:d,codec:y,container:g.container,levelCodec:g.levelCodec,id:g.id},x++}catch(i){C.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+i.message),this.hls.trigger(L.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:i,mimeType:v})}}x&&this.hls.trigger(L.Events.BUFFER_CREATED,{tracks:this.tracks})},s._onSBUpdateStart=function(e){var t=this.operationQueue,n=t.current(e);n.onStart()},s._onSBUpdateEnd=function(e){var t=this.operationQueue,n=t.current(e);n.onComplete(),t.shiftAndExecuteNext(e)},s._onSBUpdateError=function(e,t){C.logger.error("[buffer-controller]: "+e+" SourceBuffer error",t),this.hls.trigger(L.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var n=this.operationQueue.current(e);n&&n.onError(t)},s.removeExecutor=function(e,t,n){var x=this.media,E=this.mediaSource,g=this.operationQueue,y=this.sourceBuffer,v=y[e];if(!x||!E||!v){C.logger.warn("[buffer-controller]: Attempting to remove from the "+e+" SourceBuffer, but it does not exist"),g.shiftAndExecuteNext(e);return}var d=Object(H.isFiniteNumber)(x.duration)?x.duration:Infinity,u=Object(H.isFiniteNumber)(E.duration)?E.duration:Infinity,i=Math.max(0,t),o=Math.min(n,d,u);o>i?(C.logger.log("[buffer-controller]: Removing ["+i+","+o+"] from the "+e+" SourceBuffer"),console.assert(!v.updating,e+" sourceBuffer must not be updating"),v.remove(i,o)):g.shiftAndExecuteNext(e)},s.appendExecutor=function(e,t){var n=this.operationQueue,x=this.sourceBuffer,E=x[t];if(!E){C.logger.warn("[buffer-controller]: Attempting to append to the "+t+" SourceBuffer, but it does not exist"),n.shiftAndExecuteNext(t);return}E.ended=!1,console.assert(!E.updating,t+" sourceBuffer must not be updating"),E.appendBuffer(e)},s.blockBuffers=function(e,t){var n=this;if(t===void 0&&(t=this.getSourceBufferTypes()),!t.length){C.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(e);return}var x=this.operationQueue,E=t.map(function(g){return x.appendBlocker(g)});Promise.all(E).then(function(){e(),t.forEach(function(g){var y=n.sourceBuffer[g];(!y||!y.updating)&&x.shiftAndExecuteNext(g)})})},s.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},s.addBufferListener=function(e,t,n){var x=this.sourceBuffer[e];if(!x)return;var E=n.bind(this,e);this.listeners[e].push({event:t,listener:E}),x.addEventListener(t,E)},s.removeBufferListeners=function(e){var t=this.sourceBuffer[e];if(!t)return;this.listeners[e].forEach(function(n){t.removeEventListener(n.event,n.listener)})},r}()},"./src/controller/buffer-operation-queue.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"default",function(){return L});var H=I("./src/utils/logger.ts"),L=function(){function C(U){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=U}var j=C.prototype;return j.append=function(O,S){var _=this.queues[S];_.push(O),_.length===1&&this.buffers[S]&&this.executeNext(S)},j.insertAbort=function(O,S){var _=this.queues[S];_.unshift(O),this.executeNext(S)},j.appendBlocker=function(O){var S,_=new Promise(function(h){S=h}),b={execute:S,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(b,O),_},j.executeNext=function(O){var S=this.buffers,_=this.queues,b=S[O],h=_[O];if(h.length){var l=h[0];try{l.execute()}catch(r){H.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),l.onError(r),(!b||!b.updating)&&(h.shift(),this.executeNext(O))}}},j.shiftAndExecuteNext=function(O){this.queues[O].shift(),this.executeNext(O)},j.current=function(O){return this.queues[O][0]},C}()},"./src/controller/cap-level-controller.ts":function(re,W,I){"use strict";I.r(W);var H=I("./src/events.ts");function L(U,O){for(var S=0;S<O.length;S++){var _=O[S];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(U,_.key,_)}}function C(U,O,S){return O&&L(U.prototype,O),S&&L(U,S),U}var j=function(){function U(S){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=S,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var O=U.prototype;return O.setStreamController=function(_){this.streamController=_},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 _=this.hls;_.on(H.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),_.on(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),_.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),_.on(H.Events.BUFFER_CODECS,this.onBufferCodecs,this),_.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},O.unregisterListener=function(){var _=this.hls;_.off(H.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),_.off(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),_.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),_.off(H.Events.BUFFER_CODECS,this.onBufferCodecs,this),_.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},O.onFpsDropLevelCapping=function(_,b){U.isLevelAllowed(b.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(b.droppedLevel)},O.onMediaAttaching=function(_,b){this.media=b.media instanceof HTMLVideoElement?b.media:null},O.onManifestParsed=function(_,b){var h=this.hls;this.restrictedLevels=[],this.firstLevel=b.firstLevel,h.config.capLevelToPlayerSize&&b.video&&this.startCapping()},O.onBufferCodecs=function(_,b){var h=this.hls;h.config.capLevelToPlayerSize&&b.video&&this.startCapping()},O.onMediaDetaching=function(){this.stopCapping()},O.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var _=this.hls.levels;if(_.length){var b=this.hls;b.autoLevelCapping=this.getMaxLevel(_.length-1),b.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=b.autoLevelCapping}}},O.getMaxLevel=function(_){var b=this,h=this.hls.levels;if(!h.length)return-1;var l=h.filter(function(r,s){return U.isLevelAllowed(s,b.restrictedLevels)&&s<=_});return this.clientRect=null,U.getMaxLevelByMediaSize(l,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 _=this.media,b={width:0,height:0};if(_){var h=_.getBoundingClientRect();b.width=h.width,b.height=h.height,!b.width&&!b.height&&(b.width=h.right-h.left||_.width||0,b.height=h.bottom-h.top||_.height||0)}return this.clientRect=b,b},U.isLevelAllowed=function(_,b){return b===void 0&&(b=[]),b.indexOf(_)===-1},U.getMaxLevelByMediaSize=function(_,b,h){if(!_||!_.length)return-1;for(var l=function(t,n){return n?t.width!==n.width||t.height!==n.height:!0},r=_.length-1,s=0;s<_.length;s+=1){var a=_[s];if((a.width>=b||a.height>=h)&&l(a,_[s+1])){r=s;break}}return r},C(U,[{key:"mediaWidth",get:function(){return this.getDimensions().width*U.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*U.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var _=1;try{_=self.devicePixelRatio}catch(b){}return _}}]),U}();W.default=j},"./src/controller/cmcd-controller.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"default",function(){return l});var H=I("./src/events.ts"),L=I("./src/types/cmcd.ts"),C=I("./src/utils/buffer-helper.ts"),j=I("./src/utils/logger.ts");function U(r,s){for(var a=0;a<s.length;a++){var e=s[a];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(r,e.key,e)}}function O(r,s,a){return s&&U(r.prototype,s),a&&U(r,a),r}function S(r,s){var a=typeof Symbol!="undefined"&&r[Symbol.iterator]||r["@@iterator"];if(a)return(a=a.call(r)).next.bind(a);if(Array.isArray(r)||(a=_(r))||s&&r&&typeof r.length=="number"){a&&(r=a);var e=0;return function(){return e>=r.length?{done:!0}:{done:!1,value:r[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 _(r,s){if(!r)return;if(typeof r=="string")return b(r,s);var a=Object.prototype.toString.call(r).slice(8,-1);if(a==="Object"&&r.constructor&&(a=r.constructor.name),a==="Map"||a==="Set")return Array.from(r);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return b(r,s)}function b(r,s){(s==null||s>r.length)&&(s=r.length);for(var a=0,e=new Array(s);a<s;a++)e[a]=r[a];return e}function h(){return h=Object.assign||function(r){for(var s=1;s<arguments.length;s++){var a=arguments[s];for(var e in a)Object.prototype.hasOwnProperty.call(a,e)&&(r[e]=a[e])}return r},h.apply(this,arguments)}var l=function(){function r(a){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(x){try{e.apply(x,{ot:L.CMCDObjectType.MANIFEST,su:!e.initialized})}catch(E){j.logger.warn("Could not generate manifest CMCD data.",E)}},this.applyFragmentData=function(x){try{var E=x.frag,g=e.hls.levels[E.level],y=e.getObjectType(E),v={d:E.duration*1e3,ot:y};(y===L.CMCDObjectType.VIDEO||y===L.CMCDObjectType.AUDIO||y==L.CMCDObjectType.MUXED)&&(v.br=g.bitrate/1e3,v.tb=e.getTopBandwidth(y),v.bl=e.getBufferLength(y)),e.apply(x,v)}catch(d){j.logger.warn("Could not generate segment CMCD data.",d)}},this.hls=a;var t=this.config=a.config,n=t.cmcd;n!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=n.sessionId||r.uuid(),this.cid=n.contentId,this.useHeaders=n.useHeaders===!0,this.registerListeners())}var s=r.prototype;return s.registerListeners=function(){var e=this.hls;e.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),e.on(H.Events.BUFFER_CREATED,this.onBufferCreated,this)},s.unregisterListeners=function(){var e=this.hls;e.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),e.off(H.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},s.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},s.onMediaAttached=function(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},s.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},s.onBufferCreated=function(e,t){var n,x;this.audioBuffer=(n=t.tracks.audio)===null||n===void 0?void 0:n.buffer,this.videoBuffer=(x=t.tracks.video)===null||x===void 0?void 0:x.buffer},s.createData=function(){var e;return{v:L.CMCDVersion,sf:L.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}},s.apply=function(e,t){t===void 0&&(t={}),h(t,this.createData());var n=t.ot===L.CMCDObjectType.INIT||t.ot===L.CMCDObjectType.VIDEO||t.ot===L.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 x=r.toHeaders(t);if(!Object.keys(x).length)return;e.headers||(e.headers={}),h(e.headers,x)}else{var E=r.toQuery(t);if(!E)return;e.url=r.appendQueryToUri(e.url,E)}},s.getObjectType=function(e){var t=e.type;return t==="subtitle"?L.CMCDObjectType.TIMED_TEXT:e.sn==="initSegment"?L.CMCDObjectType.INIT:t==="audio"?L.CMCDObjectType.AUDIO:t==="main"?this.hls.audioTracks.length?L.CMCDObjectType.VIDEO:L.CMCDObjectType.MUXED:void 0},s.getTopBandwidth=function(e){for(var t=0,n=e===L.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,x=S(n),E;!(E=x()).done;){var g=E.value;g.bitrate>t&&(t=g.bitrate)}return t>0?t:NaN},s.getBufferLength=function(e){var t=this.hls.media,n=e===L.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!n||!t)return NaN;var x=C.BufferHelper.bufferInfo(n,t.currentTime,this.config.maxBufferHole);return x.len*1e3},s.createPlaylistLoader=function(){var e=this.config.pLoader,t=this.applyPlaylistData,n=e||this.config.loader;return function(){function x(g){this.loader=void 0,this.loader=new n(g)}var E=x.prototype;return E.destroy=function(){this.loader.destroy()},E.abort=function(){this.loader.abort()},E.load=function(y,v,d){t(y),this.loader.load(y,v,d)},O(x,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),x}()},s.createFragmentLoader=function(){var e=this.config.fLoader,t=this.applyFragmentData,n=e||this.config.loader;return function(){function x(g){this.loader=void 0,this.loader=new n(g)}var E=x.prototype;return E.destroy=function(){this.loader.destroy()},E.abort=function(){this.loader.abort()},E.load=function(y,v,d){t(y),this.loader.load(y,v,d)},O(x,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),x}()},r.uuid=function(){var e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.substr(t.lastIndexOf("/")+1)},r.serialize=function(e){for(var t=[],n=function(A){return!Number.isNaN(A)&&A!=null&&A!==""&&A!==!1},x=function(A){return Math.round(A)},E=function(A){return x(A/100)*100},g=function(A){return encodeURIComponent(A)},y={br:x,d:x,bl:E,dl:E,mtp:E,nor:g,rtp:E,tb:x},v=Object.keys(e||{}).sort(),d=S(v),u;!(u=d()).done;){var i=u.value,o=e[i];if(!n(o))continue;if(i==="v"&&o===1)continue;if(i=="pr"&&o===1)continue;var p=y[i];p&&(o=p(o));var f=typeof o,c=void 0;i==="ot"||i==="sf"||i==="st"?c=i+"="+o:f==="boolean"?c=i:f==="number"?c=i+"="+o:c=i+"="+JSON.stringify(o),t.push(c)}return t.join(",")},r.toHeaders=function(e){for(var t=Object.keys(e),n={},x=["Object","Request","Session","Status"],E=[{},{},{},{}],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},y=0,v=t;y<v.length;y++){var d=v[y],u=g[d]!=null?g[d]:1;E[u][d]=e[d]}for(var i=0;i<E.length;i++){var o=r.serialize(E[i]);o&&(n["CMCD-"+x[i]]=o)}return n},r.toQuery=function(e){return"CMCD="+encodeURIComponent(r.serialize(e))},r.appendQueryToUri=function(e,t){if(!t)return e;var n=e.includes("?")?"&":"?";return""+e+n+t},r}()},"./src/controller/eme-controller.ts":function(re,W,I){"use strict";I.r(W);var H=I("./src/events.ts"),L=I("./src/errors.ts"),C=I("./src/utils/logger.ts"),j=I("./src/utils/mediakeys-helper.ts");function U(l,r){for(var s=0;s<r.length;s++){var a=r[s];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(l,a.key,a)}}function O(l,r,s){return r&&U(l.prototype,r),s&&U(l,s),l}var S=3,_=function(r,s,a){var e={audioCapabilities:[],videoCapabilities:[]};return r.forEach(function(t){e.audioCapabilities.push({contentType:'audio/mp4; codecs="'+t+'"',robustness:a.audioRobustness||""})}),s.forEach(function(t){e.videoCapabilities.push({contentType:'video/mp4; codecs="'+t+'"',robustness:a.videoRobustness||""})}),[e]},b=function(r,s,a,e){switch(r){case j.KeySystems.WIDEVINE:return _(s,a,e);default:throw new Error("Unknown key-system: "+r)}},h=function(){function l(s){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=s,this._config=s.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 r=l.prototype;return r.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},r._registerListeners=function(){this.hls.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this)},r._unregisterListeners=function(){this.hls.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this)},r.getLicenseServerUrl=function(a){switch(a){case j.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+a+'"')},r._attemptKeySystemAccess=function(a,e,t){var n=this,x=b(a,e,t,this._drmSystemOptions);C.logger.log("Requesting encrypted media key-system access");var E=this.requestMediaKeySystemAccess(a,x);this.mediaKeysPromise=E.then(function(g){return n._onMediaKeySystemAccessObtained(a,g)}),E.catch(function(g){C.logger.error('Failed to obtain key-system "'+a+'" access:',g)})},r._onMediaKeySystemAccessObtained=function(a,e){var t=this;C.logger.log('Access for key-system "'+a+'" obtained');var n={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:e,mediaKeySystemDomain:a};this._mediaKeysList.push(n);var x=Promise.resolve().then(function(){return e.createMediaKeys()}).then(function(E){return n.mediaKeys=E,C.logger.log('Media-keys created for key-system "'+a+'"'),t._onMediaKeysCreated(),E});return x.catch(function(E){C.logger.error("Failed to create media-keys:",E)}),x},r._onMediaKeysCreated=function(){var a=this;this._mediaKeysList.forEach(function(e){e.mediaKeysSession||(e.mediaKeysSession=e.mediaKeys.createSession(),a._onNewMediaKeySession(e.mediaKeysSession))})},r._onNewMediaKeySession=function(a){var e=this;C.logger.log("New key-system session "+a.sessionId),a.addEventListener("message",function(t){e._onKeySessionMessage(a,t.message)},!1)},r._onKeySessionMessage=function(a,e){C.logger.log("Got EME message event, creating license request"),this._requestLicense(e,function(t){C.logger.log("Received license data (length: "+(t&&t.byteLength)+"), updating key-session"),a.update(t)})},r.onMediaEncrypted=function(a){var e=this;if(C.logger.log('Media is encrypted using "'+a.initDataType+'" init data type'),!this.mediaKeysPromise){C.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(H.Events.ERROR,{type:L.ErrorTypes.KEY_SYSTEM_ERROR,details:L.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var t=function(x){if(!e._media)return;e._attemptSetMediaKeys(x),e._generateRequestWithPreferredKeySession(a.initDataType,a.initData)};this.mediaKeysPromise.then(t).catch(t)},r._attemptSetMediaKeys=function(a){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){C.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(H.Events.ERROR,{type:L.ErrorTypes.KEY_SYSTEM_ERROR,details:L.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}C.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(e.mediaKeys),this._hasSetMediaKeys=!0}},r._generateRequestWithPreferredKeySession=function(a,e){var t=this,n=this._mediaKeysList[0];if(!n){C.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(H.Events.ERROR,{type:L.ErrorTypes.KEY_SYSTEM_ERROR,details:L.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(n.mediaKeysSessionInitialized){C.logger.warn("Key-Session already initialized but requested again");return}var x=n.mediaKeysSession;if(!x){C.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(H.Events.ERROR,{type:L.ErrorTypes.KEY_SYSTEM_ERROR,details:L.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!e){C.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(H.Events.ERROR,{type:L.ErrorTypes.KEY_SYSTEM_ERROR,details:L.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}C.logger.log('Generating key-session request for "'+a+'" init data type'),n.mediaKeysSessionInitialized=!0,x.generateRequest(a,e).then(function(){C.logger.debug("Key-session generation succeeded")}).catch(function(E){C.logger.error("Error generating key-session request:",E),t.hls.trigger(H.Events.ERROR,{type:L.ErrorTypes.KEY_SYSTEM_ERROR,details:L.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},r._createLicenseXhr=function(a,e,t){var n=new XMLHttpRequest;n.responseType="arraybuffer",n.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,n,a,e,t);var x=this._licenseXhrSetup;if(x)try{x.call(this.hls,n,a),x=void 0}catch(E){C.logger.error(E)}try{n.readyState||n.open("POST",a,!0),x&&x.call(this.hls,n,a)}catch(E){throw new Error("issue setting up KeySystem license XHR "+E)}return n},r._onLicenseRequestReadyStageChange=function(a,e,t,n){switch(a.readyState){case 4:if(a.status===200){this._requestLicenseFailureCount=0,C.logger.log("License request succeeded");var x=a.response,E=this._licenseResponseCallback;if(E)try{x=E.call(this.hls,a,e)}catch(y){C.logger.error(y)}n(x)}else{if(C.logger.error("License Request XHR failed ("+e+"). Status: "+a.status+" ("+a.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>S){this.hls.trigger(H.Events.ERROR,{type:L.ErrorTypes.KEY_SYSTEM_ERROR,details:L.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var g=S-this._requestLicenseFailureCount+1;C.logger.warn("Retrying license request, "+g+" attempts left"),this._requestLicense(t,n)}break}},r._generateLicenseRequestChallenge=function(a,e){switch(a.mediaKeySystemDomain){case j.KeySystems.WIDEVINE:return e}throw new Error("unsupported key-system: "+a.mediaKeySystemDomain)},r._requestLicense=function(a,e){C.logger.log("Requesting content license for key-system");var t=this._mediaKeysList[0];if(!t){C.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(H.Events.ERROR,{type:L.ErrorTypes.KEY_SYSTEM_ERROR,details:L.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var n=this.getLicenseServerUrl(t.mediaKeySystemDomain),x=this._createLicenseXhr(n,a,e);C.logger.log("Sending license request to URL: "+n);var E=this._generateLicenseRequestChallenge(t,a);x.send(E)}catch(g){C.logger.error("Failure requesting DRM license: "+g),this.hls.trigger(H.Events.ERROR,{type:L.ErrorTypes.KEY_SYSTEM_ERROR,details:L.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},r.onMediaAttached=function(a,e){if(!this._emeEnabled)return;var t=e.media;this._media=t,t.addEventListener("encrypted",this._onMediaEncrypted)},r.onMediaDetached=function(){var a=this._media,e=this._mediaKeysList;if(!a)return;a.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 a.setMediaKeys(null)}).catch(function(){})},r.onManifestParsed=function(a,e){if(!this._emeEnabled)return;var t=e.levels.map(function(x){return x.audioCodec}).filter(function(x){return!!x}),n=e.levels.map(function(x){return x.videoCodec}).filter(function(x){return!!x});this._attemptKeySystemAccess(j.KeySystems.WIDEVINE,t,n)},O(l,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),l}();W.default=h},"./src/controller/fps-controller.ts":function(re,W,I){"use strict";I.r(W);var H=I("./src/events.ts"),L=I("./src/utils/logger.ts"),C=function(){function j(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 U=j.prototype;return U.setStreamController=function(S){this.streamController=S},U.registerListeners=function(){this.hls.on(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},U.unregisterListeners=function(){this.hls.off(H.Events.MEDIA_ATTACHING,this.onMediaAttaching)},U.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},U.onMediaAttaching=function(S,_){var b=this.hls.config;if(b.capLevelOnFPSDrop){var h=_.media instanceof self.HTMLVideoElement?_.media:null;this.media=h,h&&typeof h.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),b.fpsDroppedMonitoringPeriod)}},U.checkFPS=function(S,_,b){var h=performance.now();if(_){if(this.lastTime){var l=h-this.lastTime,r=b-this.lastDroppedFrames,s=_-this.lastDecodedFrames,a=1e3*r/l,e=this.hls;if(e.trigger(H.Events.FPS_DROP,{currentDropped:r,currentDecoded:s,totalDroppedFrames:b}),a>0&&r>e.config.fpsDroppedMonitoringThreshold*s){var t=e.currentLevel;L.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(H.Events.FPS_DROP_LEVEL_CAPPING,{level:t,droppedLevel:e.currentLevel}),e.autoLevelCapping=t,this.streamController.nextLevelSwitch())}}this.lastTime=h,this.lastDroppedFrames=b,this.lastDecodedFrames=_}},U.checkFPSInterval=function(){var S=this.media;if(S)if(this.isVideoPlaybackQualityAvailable){var _=S.getVideoPlaybackQuality();this.checkFPS(S,_.totalVideoFrames,_.droppedVideoFrames)}else this.checkFPS(S,S.webkitDecodedFrameCount,S.webkitDroppedFrameCount)},j}();W.default=C},"./src/controller/fragment-finders.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"findFragmentByPDT",function(){return C}),I.d(W,"findFragmentByPTS",function(){return j}),I.d(W,"fragmentWithinToleranceTest",function(){return U}),I.d(W,"pdtWithinToleranceTest",function(){return O}),I.d(W,"findFragWithCC",function(){return S});var H=I("./src/polyfills/number.ts"),L=I("./src/utils/binary-search.ts");function C(_,b,h){if(b===null||!Array.isArray(_)||!_.length||!Object(H.isFiniteNumber)(b))return null;var l=_[0].programDateTime;if(b<(l||0))return null;var r=_[_.length-1].endProgramDateTime;if(b>=(r||0))return null;h=h||0;for(var s=0;s<_.length;++s){var a=_[s];if(O(b,h,a))return a}return null}function j(_,b,h,l){h===void 0&&(h=0),l===void 0&&(l=0);var r=null;if(_?r=b[_.sn-b[0].sn+1]||null:h===0&&b[0].start===0&&(r=b[0]),r&&U(h,l,r)===0)return r;var s=L.default.search(b,U.bind(null,h,l));return s||r}function U(_,b,h){_===void 0&&(_=0),b===void 0&&(b=0);var l=Math.min(b,h.duration+(h.deltaPTS?h.deltaPTS:0));return h.start+h.duration-l<=_?1:h.start-l>_&&h.start?-1:0}function O(_,b,h){var l=Math.min(b,h.duration+(h.deltaPTS?h.deltaPTS:0))*1e3,r=h.endProgramDateTime||0;return r-l>_}function S(_,b){return L.default.search(_,function(h){return h.cc<b?1:h.cc>b?-1:0})}},"./src/controller/fragment-tracker.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"FragmentState",function(){return C}),I.d(W,"FragmentTracker",function(){return j});var H=I("./src/events.ts"),L=I("./src/types/loader.ts"),C;(function(S){S.NOT_LOADED="NOT_LOADED",S.BACKTRACKED="BACKTRACKED",S.APPENDING="APPENDING",S.PARTIAL="PARTIAL",S.OK="OK"})(C||(C={}));var j=function(){function S(b){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=b,this._registerListeners()}var _=S.prototype;return _._registerListeners=function(){var h=this.hls;h.on(H.Events.BUFFER_APPENDED,this.onBufferAppended,this),h.on(H.Events.FRAG_BUFFERED,this.onFragBuffered,this),h.on(H.Events.FRAG_LOADED,this.onFragLoaded,this)},_._unregisterListeners=function(){var h=this.hls;h.off(H.Events.BUFFER_APPENDED,this.onBufferAppended,this),h.off(H.Events.FRAG_BUFFERED,this.onFragBuffered,this),h.off(H.Events.FRAG_LOADED,this.onFragLoaded,this)},_.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},_.getAppendedFrag=function(h,l){if(l===L.PlaylistLevelType.MAIN){var r=this.activeFragment,s=this.activeParts;if(!r)return null;if(s)for(var a=s.length;a--;){var e=s[a],t=e?e.end:r.appendedPTS;if(e.start<=h&&t!==void 0&&h<=t)return a>9&&(this.activeParts=s.slice(a-9)),e}else if(r.start<=h&&r.appendedPTS!==void 0&&h<=r.appendedPTS)return r}return this.getBufferedFrag(h,l)},_.getBufferedFrag=function(h,l){for(var r=this.fragments,s=Object.keys(r),a=s.length;a--;){var e=r[s[a]];if((e==null?void 0:e.body.type)===l&&e.buffered){var t=e.body;if(t.start<=h&&h<=t.end)return t}}return null},_.detectEvictedFragments=function(h,l,r){var s=this;Object.keys(this.fragments).forEach(function(a){var e=s.fragments[a];if(!e)return;if(!e.buffered){e.body.type===r&&s.removeFragment(e.body);return}var t=e.range[h];if(!t)return;t.time.some(function(n){var x=!s.isTimeBuffered(n.startPTS,n.endPTS,l);return x&&s.removeFragment(e.body),x})})},_.detectPartialFragments=function(h){var l=this,r=this.timeRanges,s=h.frag,a=h.part;if(!r||s.sn==="initSegment")return;var e=O(s),t=this.fragments[e];if(!t)return;Object.keys(r).forEach(function(n){var x=s.elementaryStreams[n];if(!x)return;var E=r[n],g=a!==null||x.partial===!0;t.range[n]=l.getBufferedTimes(s,a,g,E)}),t.backtrack=t.loaded=null,Object.keys(t.range).length?t.buffered=!0:this.removeFragment(t.body)},_.fragBuffered=function(h){var l=O(h),r=this.fragments[l];r&&(r.backtrack=r.loaded=null,r.buffered=!0)},_.getBufferedTimes=function(h,l,r,s){for(var a={time:[],partial:r},e=l?l.start:h.start,t=l?l.end:h.end,n=h.minEndPTS||t,x=h.maxStartPTS||e,E=0;E<s.length;E++){var g=s.start(E)-this.bufferPadding,y=s.end(E)+this.bufferPadding;if(x>=g&&n<=y){a.time.push({startPTS:Math.max(e,s.start(E)),endPTS:Math.min(t,s.end(E))});break}else if(e<y&&t>g)a.partial=!0,a.time.push({startPTS:Math.max(e,s.start(E)),endPTS:Math.min(t,s.end(E))});else if(t<=g)break}return a},_.getPartialFragment=function(h){var l=null,r,s,a,e=0,t=this.bufferPadding,n=this.fragments;return Object.keys(n).forEach(function(x){var E=n[x];if(!E)return;U(E)&&(s=E.body.start-t,a=E.body.end+t,h>=s&&h<=a&&(r=Math.min(h-s,a-h),e<=r&&(l=E.body,e=r)))}),l},_.getState=function(h){var l=O(h),r=this.fragments[l];return r?r.buffered?U(r)?C.PARTIAL:C.OK:r.backtrack?C.BACKTRACKED:C.APPENDING:C.NOT_LOADED},_.backtrack=function(h,l){var r=O(h),s=this.fragments[r];if(!s||s.backtrack)return null;var a=s.backtrack=l||s.loaded;return s.loaded=null,a},_.getBacktrackData=function(h){var l=O(h),r=this.fragments[l];if(r){var s,a=r.backtrack;if(a!=null&&(s=a.payload)!==null&&s!==void 0&&s.byteLength)return a;this.removeFragment(h)}return null},_.isTimeBuffered=function(h,l,r){for(var s,a,e=0;e<r.length;e++){if(s=r.start(e)-this.bufferPadding,a=r.end(e)+this.bufferPadding,h>=s&&l<=a)return!0;if(l<=s)return!1}return!1},_.onFragLoaded=function(h,l){var r=l.frag,s=l.part;if(r.sn==="initSegment"||r.bitrateTest||s)return;var a=O(r);this.fragments[a]={body:r,loaded:l,backtrack:null,buffered:!1,range:Object.create(null)}},_.onBufferAppended=function(h,l){var r=this,s=l.frag,a=l.part,e=l.timeRanges;if(s.type===L.PlaylistLevelType.MAIN)if(this.activeFragment=s,a){var t=this.activeParts;t||(this.activeParts=t=[]),t.push(a)}else this.activeParts=null;this.timeRanges=e,Object.keys(e).forEach(function(n){var x=e[n];if(r.detectEvictedFragments(n,x),!a)for(var E=0;E<x.length;E++)s.appendedPTS=Math.max(x.end(E),s.appendedPTS||0)})},_.onFragBuffered=function(h,l){this.detectPartialFragments(l)},_.hasFragment=function(h){var l=O(h);return!!this.fragments[l]},_.removeFragmentsInRange=function(h,l,r){var s=this;Object.keys(this.fragments).forEach(function(a){var e=s.fragments[a];if(!e)return;if(e.buffered){var t=e.body;t.type===r&&t.start<l&&t.end>h&&s.removeFragment(t)}})},_.removeFragment=function(h){var l=O(h);h.stats.loaded=0,h.clearElementaryStreamInfo(),delete this.fragments[l]},_.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},S}();function U(S){var _,b;return S.buffered&&(((_=S.range.video)===null||_===void 0?void 0:_.partial)||((b=S.range.audio)===null||b===void 0?void 0:b.partial))}function O(S){return S.type+"_"+S.level+"_"+S.urlId+"_"+S.sn}},"./src/controller/gap-controller.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"STALL_MINIMUM_DURATION_MS",function(){return U}),I.d(W,"MAX_START_GAP_JUMP",function(){return O}),I.d(W,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return S}),I.d(W,"SKIP_BUFFER_RANGE_START",function(){return _}),I.d(W,"default",function(){return b});var H=I("./src/utils/buffer-helper.ts"),L=I("./src/errors.ts"),C=I("./src/events.ts"),j=I("./src/utils/logger.ts"),U=250,O=2,S=.1,_=.05,b=function(){function h(r,s,a,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=r,this.media=s,this.fragmentTracker=a,this.hls=e}var l=h.prototype;return l.destroy=function(){this.hls=this.fragmentTracker=this.media=null},l.poll=function(s){var a=this.config,e=this.media,t=this.stalled,n=e.currentTime,x=e.seeking,E=this.seeking&&!x,g=!this.seeking&&x;if(this.seeking=x,n!==s){if(this.moved=!0,t!==null){if(this.stallReported){var y=self.performance.now()-t;j.logger.warn("playback not stuck anymore @"+n+", after "+Math.round(y)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((g||E)&&(this.stalled=null),e.paused||e.ended||e.playbackRate===0||!H.BufferHelper.getBuffered(e).length)return;var v=H.BufferHelper.bufferInfo(e,n,0),d=v.len>0,u=v.nextStart||0;if(!d&&!u)return;if(x){var i=v.len>O,o=!u||u-n>O&&!this.fragmentTracker.getPartialFragment(n);if(i||o)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var p,f=Math.max(u,v.start||0)-n,c=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,w=c==null||((p=c.details)===null||p===void 0)?void 0:p.live,A=w?c.details.targetduration*2:O;if(f>0&&f<=A){this._trySkipBufferHole(null);return}}var P=self.performance.now();if(t===null){this.stalled=P;return}var N=P-t;!x&&N>=U&&this._reportStall(v.len);var B=H.BufferHelper.bufferInfo(e,n,a.maxBufferHole);this._tryFixBufferStall(B,N)},l._tryFixBufferStall=function(s,a){var e=this.config,t=this.fragmentTracker,n=this.media,x=n.currentTime,E=t.getPartialFragment(x);if(E){var g=this._trySkipBufferHole(E);if(g)return}s.len>e.maxBufferHole&&a>e.highBufferWatchdogPeriod*1e3&&(j.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},l._reportStall=function(s){var a=this.hls,e=this.media,t=this.stallReported;t||(this.stallReported=!0,j.logger.warn("Playback stalling at @"+e.currentTime+" due to low buffer (buffer="+s+")"),a.trigger(C.Events.ERROR,{type:L.ErrorTypes.MEDIA_ERROR,details:L.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:s}))},l._trySkipBufferHole=function(s){for(var a=this.config,e=this.hls,t=this.media,n=t.currentTime,x=0,E=H.BufferHelper.getBuffered(t),g=0;g<E.length;g++){var y=E.start(g);if(n+a.maxBufferHole>=x&&n<y){var v=Math.max(y+_,t.currentTime+S);return j.logger.warn("skipping hole, adjusting currentTime from "+n+" to "+v),this.moved=!0,this.stalled=null,t.currentTime=v,s&&e.trigger(C.Events.ERROR,{type:L.ErrorTypes.MEDIA_ERROR,details:L.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+n+" to "+v,frag:s}),v}x=E.end(g)}return 0},l._tryNudgeBuffer=function(){var s=this.config,a=this.hls,e=this.media,t=e.currentTime,n=(this.nudgeRetry||0)+1;if(this.nudgeRetry=n,n<s.nudgeMaxRetry){var x=t+n*s.nudgeOffset;j.logger.warn("Nudging 'currentTime' from "+t+" to "+x),e.currentTime=x,a.trigger(C.Events.ERROR,{type:L.ErrorTypes.MEDIA_ERROR,details:L.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else j.logger.error("Playhead still not moving while enough data buffered @"+t+" after "+s.nudgeMaxRetry+" nudges"),a.trigger(C.Events.ERROR,{type:L.ErrorTypes.MEDIA_ERROR,details:L.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},h}()},"./src/controller/id3-track-controller.ts":function(re,W,I){"use strict";I.r(W);var H=I("./src/events.ts"),L=I("./src/utils/texttrack-utils.ts"),C=I("./src/demux/id3.ts"),j=.25,U=function(){function O(_){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=_,this._registerListeners()}var S=O.prototype;return S.destroy=function(){this._unregisterListeners()},S._registerListeners=function(){var b=this.hls;b.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),b.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),b.on(H.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),b.on(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},S._unregisterListeners=function(){var b=this.hls;b.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),b.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),b.off(H.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),b.off(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},S.onMediaAttached=function(b,h){this.media=h.media},S.onMediaDetaching=function(){if(!this.id3Track)return;Object(L.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},S.getID3Track=function(b){if(!this.media)return;for(var h=0;h<b.length;h++){var l=b[h];if(l.kind==="metadata"&&l.label==="id3")return Object(L.sendAddTrackEvent)(l,this.media),l}return this.media.addTextTrack("metadata","id3")},S.onFragParsingMetadata=function(b,h){if(!this.media)return;var l=h.frag,r=h.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var s=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,a=0;a<r.length;a++){var e=C.getID3Frames(r[a].data);if(e){var t=r[a].pts,n=a<r.length-1?r[a+1].pts:l.end,x=n-t;x<=0&&(n=t+j);for(var E=0;E<e.length;E++){var g=e[E];if(!C.isTimeStampFrame(g)){var y=new s(t,n,"");y.value=g,this.id3Track.addCue(y)}}}}},S.onBufferFlushing=function(b,h){var l=h.startOffset,r=h.endOffset,s=h.type;if(!s||s==="audio"){var a=this.id3Track;a&&Object(L.removeCuesInRange)(a,l,r)}},O}();W.default=U},"./src/controller/latency-controller.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"default",function(){return O});var H=I("./src/errors.ts"),L=I("./src/events.ts"),C=I("./src/utils/logger.ts");function j(S,_){for(var b=0;b<_.length;b++){var h=_[b];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(S,h.key,h)}}function U(S,_,b){return _&&j(S.prototype,_),b&&j(S,b),S}var O=function(){function S(b){var h=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 h.timeupdate()},this.hls=b,this.config=b.config,this.registerListeners()}var _=S.prototype;return _.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},_.registerListeners=function(){this.hls.on(L.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(L.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(L.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(L.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(L.Events.ERROR,this.onError,this)},_.unregisterListeners=function(){this.hls.off(L.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(L.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(L.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(L.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(L.Events.ERROR,this.onError)},_.onMediaAttached=function(h,l){this.media=l.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},_.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},_.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},_.onLevelUpdated=function(h,l){var r=l.details;this.levelDetails=r,r.advanced&&this.timeupdate(),!r.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},_.onError=function(h,l){if(l.details!==H.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,C.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},_.timeupdate=function(){var h=this.media,l=this.levelDetails;if(!h||!l)return;this.currentTime=h.currentTime;var r=this.computeLatency();if(r===null)return;this._latency=r;var s=this.config,a=s.lowLatencyMode,e=s.maxLiveSyncPlaybackRate;if(!a||e===1)return;var t=this.targetLatency;if(t===null)return;var n=r-t,x=Math.min(this.maxLatency,t+l.targetduration),E=n<x;if(l.live&&E&&n>.05&&this.forwardBufferLength>1){var g=Math.min(2,Math.max(1,e)),y=Math.round(2/(1+Math.exp(-.75*n-this.edgeStalled))*20)/20;h.playbackRate=Math.min(g,Math.max(1,y))}else h.playbackRate!==1&&h.playbackRate!==0&&(h.playbackRate=1)},_.estimateLiveEdge=function(){var h=this.levelDetails;return h===null?null:h.edge+h.age},_.computeLatency=function(){var h=this.estimateLiveEdge();return h===null?null:h-this.currentTime},U(S,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var h=this.config,l=this.levelDetails;return h.liveMaxLatencyDuration!==void 0?h.liveMaxLatencyDuration:l?h.liveMaxLatencyDurationCount*l.targetduration:0}},{key:"targetLatency",get:function(){var h=this.levelDetails;if(h===null)return null;var l=h.holdBack,r=h.partHoldBack,s=h.targetduration,a=this.config,e=a.liveSyncDuration,t=a.liveSyncDurationCount,n=a.lowLatencyMode,x=this.hls.userConfig,E=n&&r||l;(x.liveSyncDuration||x.liveSyncDurationCount||E===0)&&(E=e!==void 0?e:t*s);var g=s,y=1;return E+Math.min(this.stallCount*y,g)}},{key:"liveSyncPosition",get:function(){var h=this.estimateLiveEdge(),l=this.targetLatency,r=this.levelDetails;if(h===null||l===null||r===null)return null;var s=r.edge,a=h-l-this.edgeStalled,e=s-r.totalduration,t=s-(this.config.lowLatencyMode&&r.partTarget||r.targetduration);return Math.min(Math.max(e,a),t)}},{key:"drift",get:function(){var h=this.levelDetails;return h===null?1:h.drift}},{key:"edgeStalled",get:function(){var h=this.levelDetails;if(h===null)return 0;var l=(this.config.lowLatencyMode&&h.partTarget||h.targetduration)*3;return Math.max(h.age-l,0)}},{key:"forwardBufferLength",get:function(){var h=this.media,l=this.levelDetails;if(!h||!l)return 0;var r=h.buffered.length;return r?h.buffered.end(r-1):l.edge-this.currentTime}}]),S}()},"./src/controller/level-controller.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"default",function(){return a});var H=I("./src/types/level.ts"),L=I("./src/events.ts"),C=I("./src/errors.ts"),j=I("./src/utils/codecs.ts"),U=I("./src/controller/level-helper.ts"),O=I("./src/controller/base-playlist-controller.ts"),S=I("./src/types/loader.ts");function _(){return _=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var x in n)Object.prototype.hasOwnProperty.call(n,x)&&(e[x]=n[x])}return e},_.apply(this,arguments)}function b(e,t){for(var n=0;n<t.length;n++){var x=t[n];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(e,x.key,x)}}function h(e,t,n){return t&&b(e.prototype,t),n&&b(e,n),e}function l(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r(e,t)}function r(e,t){return r=Object.setPrototypeOf||function(x,E){return x.__proto__=E,x},r(e,t)}var s=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),a=function(e){l(t,e);function t(x){var E;return E=e.call(this,x,"[level-controller]")||this,E._levels=[],E._firstLevel=-1,E._startLevel=void 0,E.currentLevelIndex=-1,E.manualLevelIndex=-1,E.onParsedComplete=void 0,E._registerListeners(),E}var n=t.prototype;return n._registerListeners=function(){var E=this.hls;E.on(L.Events.MANIFEST_LOADED,this.onManifestLoaded,this),E.on(L.Events.LEVEL_LOADED,this.onLevelLoaded,this),E.on(L.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),E.on(L.Events.FRAG_LOADED,this.onFragLoaded,this),E.on(L.Events.ERROR,this.onError,this)},n._unregisterListeners=function(){var E=this.hls;E.off(L.Events.MANIFEST_LOADED,this.onManifestLoaded,this),E.off(L.Events.LEVEL_LOADED,this.onLevelLoaded,this),E.off(L.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),E.off(L.Events.FRAG_LOADED,this.onFragLoaded,this),E.off(L.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 E=this._levels;E.forEach(function(g){g.loadError=0}),e.prototype.startLoad.call(this)},n.onManifestLoaded=function(E,g){var y=[],v=[],d=[],u,i={},o,p=!1,f=!1,c=!1;if(g.levels.forEach(function(N){var B=N.attrs;p=p||!!(N.width&&N.height),f=f||!!N.videoCodec,c=c||!!N.audioCodec,s&&N.audioCodec&&N.audioCodec.indexOf("mp4a.40.34")!==-1&&(N.audioCodec=void 0);var R=N.bitrate+"-"+N.attrs.RESOLUTION+"-"+N.attrs.CODECS;o=i[R],o?o.url.push(N.url):(o=new H.Level(N),i[R]=o,y.push(o)),B&&(B.AUDIO&&Object(U.addGroupId)(o,"audio",B.AUDIO),B.SUBTITLES&&Object(U.addGroupId)(o,"text",B.SUBTITLES))}),(p||f)&&c&&(y=y.filter(function(N){var B=N.videoCodec,R=N.width,F=N.height;return!!B||!!(R&&F)})),y=y.filter(function(N){var B=N.audioCodec,R=N.videoCodec;return(!B||Object(j.isCodecSupportedInMp4)(B,"audio"))&&(!R||Object(j.isCodecSupportedInMp4)(R,"video"))}),g.audioTracks&&(v=g.audioTracks.filter(function(N){return!N.audioCodec||Object(j.isCodecSupportedInMp4)(N.audioCodec,"audio")}),Object(U.assignTrackIdsByGroup)(v)),g.subtitles&&(d=g.subtitles,Object(U.assignTrackIdsByGroup)(d)),y.length>0){u=y[0].bitrate,y.sort(function(N,B){return N.bitrate-B.bitrate}),this._levels=y;for(var w=0;w<y.length;w++)if(y[w].bitrate===u){this._firstLevel=w,this.log("manifest loaded, "+y.length+" level(s) found, first bitrate: "+u);break}var A=c&&!f,P={levels:y,audioTracks:v,subtitleTracks:d,firstLevel:this._firstLevel,stats:g.stats,audio:c,video:f,altAudio:!A&&v.some(function(N){return!!N.url})};this.hls.trigger(L.Events.MANIFEST_PARSED,P),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(L.Events.ERROR,{type:C.ErrorTypes.MEDIA_ERROR,details:C.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:g.url,reason:"no level with compatible codecs found in manifest"})},n.onError=function(E,g){if(e.prototype.onError.call(this,E,g),g.fatal)return;var y=g.context,v=this._levels[this.currentLevelIndex];if(y&&(y.type===S.PlaylistContextType.AUDIO_TRACK&&v.audioGroupIds&&y.groupId===v.audioGroupIds[v.urlId]||y.type===S.PlaylistContextType.SUBTITLE_TRACK&&v.textGroupIds&&y.groupId===v.textGroupIds[v.urlId])){this.redundantFailover(this.currentLevelIndex);return}var d=!1,u=!0,i;switch(g.details){case C.ErrorDetails.FRAG_LOAD_ERROR:case C.ErrorDetails.FRAG_LOAD_TIMEOUT:case C.ErrorDetails.KEY_LOAD_ERROR:case C.ErrorDetails.KEY_LOAD_TIMEOUT:if(g.frag){var o=this._levels[g.frag.level];o?(o.fragmentError++,o.fragmentError>this.hls.config.fragLoadingMaxRetry&&(i=g.frag.level)):i=g.frag.level}break;case C.ErrorDetails.LEVEL_LOAD_ERROR:case C.ErrorDetails.LEVEL_LOAD_TIMEOUT:y&&(y.deliveryDirectives&&(u=!1),i=y.level),d=!0;break;case C.ErrorDetails.REMUX_ALLOC_ERROR:i=g.level,d=!0;break}i!==void 0&&this.recoverLevel(g,i,d,u)},n.recoverLevel=function(E,g,y,v){var d=E.details,u=this._levels[g];if(u.loadError++,y){var i=this.retryLoadingOrFail(E);if(i)E.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(v){var o=u.url.length;if(o>1&&u.loadError<o)E.levelRetry=!0,this.redundantFailover(g);else if(this.manualLevelIndex===-1){var p=g===0?this._levels.length-1:g-1;this.currentLevelIndex!==p&&this._levels[p].loadError===0&&(this.warn(d+": switch to "+p),E.levelRetry=!0,this.hls.nextAutoLevel=p)}}},n.redundantFailover=function(E){var g=this._levels[E],y=g.url.length;if(y>1){var v=(g.urlId+1)%y;this.warn("Switching to redundant URL-id "+v),this._levels.forEach(function(d){d.urlId=v}),this.level=E}},n.onFragLoaded=function(E,g){var y=g.frag;if(y!==void 0&&y.type===S.PlaylistLevelType.MAIN){var v=this._levels[y.level];v!==void 0&&(v.fragmentError=0,v.loadError=0)}},n.onLevelLoaded=function(E,g){var y,v=g.level,d=g.details,u=this._levels[v];if(!u){var i;this.warn("Invalid level index "+v),(i=g.deliveryDirectives)!==null&&i!==void 0&&i.skip&&(d.deltaUpdateFailed=!0);return}v===this.currentLevelIndex?(u.fragmentError===0&&(u.loadError=0,this.retryCount=0),this.playlistLoaded(v,g,u.details)):(y=g.deliveryDirectives)!==null&&y!==void 0&&y.skip&&(d.deltaUpdateFailed=!0)},n.onAudioTrackSwitched=function(E,g){var y=this.hls.levels[this.currentLevelIndex];if(!y)return;if(y.audioGroupIds){for(var v=-1,d=this.hls.audioTracks[g.id].groupId,u=0;u<y.audioGroupIds.length;u++)if(y.audioGroupIds[u]===d){v=u;break}v!==y.urlId&&(y.urlId=v,this.startLoad())}},n.loadPlaylist=function(E){var g=this.currentLevelIndex,y=this._levels[g];if(this.canLoad&&y&&y.url.length>0){var v=y.urlId,d=y.url[v];if(E)try{d=E.addDirectives(d)}catch(u){this.warn("Could not construct new URL with HLS Delivery Directives: "+u)}this.log("Attempt loading level index "+g+(E?" at sn "+E.msn+" part "+E.part:"")+" with URL-id "+v+" "+d),this.clearTimer(),this.hls.trigger(L.Events.LEVEL_LOADING,{url:d,level:g,id:v,deliveryDirectives:E||null})}},n.removeLevel=function(E,g){var y=function(u,i){return i!==g},v=this._levels.filter(function(d,u){return u!==E?!0:d.url.length>1&&g!==void 0?(d.url=d.url.filter(y),d.audioGroupIds&&(d.audioGroupIds=d.audioGroupIds.filter(y)),d.textGroupIds&&(d.textGroupIds=d.textGroupIds.filter(y)),d.urlId=0,!0):!1}).map(function(d,u){var i=d.details;return i!=null&&i.fragments&&i.fragments.forEach(function(o){o.level=u}),d});this._levels=v,this.hls.trigger(L.Events.LEVELS_UPDATED,{levels:v})},h(t,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(E){var g,y=this._levels;if(y.length===0)return;if(this.currentLevelIndex===E&&(g=y[E])!==null&&g!==void 0&&g.details)return;if(E<0||E>=y.length){var v=E<0;if(this.hls.trigger(L.Events.ERROR,{type:C.ErrorTypes.OTHER_ERROR,details:C.ErrorDetails.LEVEL_SWITCH_ERROR,level:E,fatal:v,reason:"invalid level idx"}),v)return;E=Math.min(E,y.length-1)}this.clearTimer();var d=this.currentLevelIndex,u=y[d],i=y[E];this.log("switching to level "+E+" from "+d),this.currentLevelIndex=E;var o=_({},i,{level:E,maxBitrate:i.maxBitrate,uri:i.uri,urlId:i.urlId});delete o._urlId,this.hls.trigger(L.Events.LEVEL_SWITCHING,o);var p=i.details;if(!p||p.live){var f=this.switchParams(i.uri,u==null?void 0:u.details);this.loadPlaylist(f)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(E){this.manualLevelIndex=E,this._startLevel===void 0&&(this._startLevel=E),E!==-1&&(this.level=E)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(E){this._firstLevel=E}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var E=this.hls.config.startLevel;return E!==void 0?E:this._firstLevel}else return this._startLevel},set:function(E){this._startLevel=E}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(E){this.level=E,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=E)}}]),t}(O.default)},"./src/controller/level-helper.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"addGroupId",function(){return C}),I.d(W,"assignTrackIdsByGroup",function(){return j}),I.d(W,"updatePTS",function(){return U}),I.d(W,"updateFragPTSDTS",function(){return S}),I.d(W,"mergeDetails",function(){return _}),I.d(W,"mapPartIntersection",function(){return b}),I.d(W,"mapFragmentIntersection",function(){return h}),I.d(W,"adjustSliding",function(){return l}),I.d(W,"addSliding",function(){return r}),I.d(W,"computeReloadInterval",function(){return s}),I.d(W,"getFragmentWithSN",function(){return a}),I.d(W,"getPartWith",function(){return e});var H=I("./src/polyfills/number.ts"),L=I("./src/utils/logger.ts");function C(t,n,x){switch(n){case"audio":t.audioGroupIds||(t.audioGroupIds=[]),t.audioGroupIds.push(x);break;case"text":t.textGroupIds||(t.textGroupIds=[]),t.textGroupIds.push(x);break}}function j(t){var n={};t.forEach(function(x){var E=x.groupId||"";x.id=n[E]=n[E]||0,n[E]++})}function U(t,n,x){var E=t[n],g=t[x];O(E,g)}function O(t,n){var x=n.startPTS;if(Object(H.isFiniteNumber)(x)){var E=0,g;n.sn>t.sn?(E=x-t.start,g=t):(E=t.start-x,g=n),g.duration!==E&&(g.duration=E)}else if(n.sn>t.sn){var y=t.cc===n.cc;y&&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 S(t,n,x,E,g,y){var v=E-x;v<=0&&(L.logger.warn("Fragment should have a positive duration",n),E=x+n.duration,y=g+n.duration);var d=x,u=E,i=n.startPTS,o=n.endPTS;if(Object(H.isFiniteNumber)(i)){var p=Math.abs(i-x);Object(H.isFiniteNumber)(n.deltaPTS)?n.deltaPTS=Math.max(p,n.deltaPTS):n.deltaPTS=p,d=Math.max(x,i),x=Math.min(x,i),g=Math.min(g,n.startDTS),u=Math.min(E,o),E=Math.max(E,o),y=Math.max(y,n.endDTS)}n.duration=E-x;var f=x-n.start;n.appendedPTS=E,n.start=n.startPTS=x,n.maxStartPTS=d,n.startDTS=g,n.endPTS=E,n.minEndPTS=u,n.endDTS=y;var c=n.sn;if(!t||c<t.startSN||c>t.endSN)return 0;var w,A=c-t.startSN,P=t.fragments;for(P[A]=n,w=A;w>0;w--)O(P[w],P[w-1]);for(w=A;w<P.length-1;w++)O(P[w],P[w+1]);return t.fragmentHint&&O(P[P.length-1],t.fragmentHint),t.PTSKnown=t.alignedSliding=!0,f}function _(t,n){for(var x=null,E=t.fragments,g=E.length-1;g>=0;g--){var y=E[g].initSegment;if(y){x=y;break}}t.fragmentHint&&delete t.fragmentHint.endPTS;var v=0,d;if(h(t,n,function(w,A){w.relurl&&(v=w.cc-A.cc),Object(H.isFiniteNumber)(w.startPTS)&&Object(H.isFiniteNumber)(w.endPTS)&&(A.start=A.startPTS=w.startPTS,A.startDTS=w.startDTS,A.appendedPTS=w.appendedPTS,A.maxStartPTS=w.maxStartPTS,A.endPTS=w.endPTS,A.endDTS=w.endDTS,A.minEndPTS=w.minEndPTS,A.duration=w.endPTS-w.startPTS,A.duration&&(d=A),n.PTSKnown=n.alignedSliding=!0),A.elementaryStreams=w.elementaryStreams,A.loader=w.loader,A.stats=w.stats,A.urlId=w.urlId,w.initSegment&&(A.initSegment=w.initSegment,x=w.initSegment)}),x){var u=n.fragmentHint?n.fragments.concat(n.fragmentHint):n.fragments;u.forEach(function(w){var A;(!w.initSegment||w.initSegment.relurl===((A=x)===null||A===void 0?void 0:A.relurl))&&(w.initSegment=x)})}if(n.skippedSegments&&(n.deltaUpdateFailed=n.fragments.some(function(w){return!w}),n.deltaUpdateFailed)){L.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var i=n.skippedSegments;i--;)n.fragments.shift();n.startSN=n.fragments[0].sn,n.startCC=n.fragments[0].cc}var o=n.fragments;if(v){L.logger.warn("discontinuity sliding from playlist, take drift into account");for(var p=0;p<o.length;p++)o[p].cc+=v}n.skippedSegments&&(n.startCC=n.fragments[0].cc),b(t.partList,n.partList,function(w,A){A.elementaryStreams=w.elementaryStreams,A.stats=w.stats}),d?S(n,d,d.startPTS,d.endPTS,d.startDTS,d.endDTS):l(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 c=n.edge;n.driftStart||(n.driftStartTime=f,n.driftStart=c),n.driftEndTime=f,n.driftEnd=c}else n.driftEndTime=t.driftEndTime,n.driftEnd=t.driftEnd,n.advancedDateTime=t.advancedDateTime}function b(t,n,x){if(t&&n)for(var E=0,g=0,y=t.length;g<=y;g++){var v=t[g],d=n[g+E];v&&d&&v.index===d.index&&v.fragment.sn===d.fragment.sn?x(v,d):E--}}function h(t,n,x){for(var E=n.skippedSegments,g=Math.max(t.startSN,n.startSN)-n.startSN,y=(t.fragmentHint?1:0)+(E?n.endSN:Math.min(t.endSN,n.endSN))-n.startSN,v=n.startSN-t.startSN,d=n.fragmentHint?n.fragments.concat(n.fragmentHint):n.fragments,u=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,i=g;i<=y;i++){var o=u[v+i],p=d[i];E&&!p&&i<E&&(p=n.fragments[i]=o),o&&p&&x(o,p)}}function l(t,n){var x=n.startSN+n.skippedSegments-t.startSN,E=t.fragments;if(x<0||x>=E.length)return;r(n,E[x].start)}function r(t,n){if(n){for(var x=t.fragments,E=t.skippedSegments;E<x.length;E++)x[E].start+=n;t.fragmentHint&&(t.fragmentHint.start+=n)}}function s(t,n){var x=1e3*t.levelTargetDuration,E=x/2,g=t.age,y=g>0&&g<x*3,v=n.loading.end-n.loading.start,d,u=t.availabilityDelay;if(t.updated===!1)if(y){var i=333*t.misses;d=Math.max(Math.min(E,v*2),i),t.availabilityDelay=(t.availabilityDelay||0)+d}else d=E;else y?(u=Math.min(u||x/2,g),t.availabilityDelay=u,d=u+x-g):d=x-v;return Math.round(d)}function a(t,n,x){if(!t||!t.details)return null;var E=t.details,g=E.fragments[n-E.startSN];return g||(g=E.fragmentHint,g&&g.sn===n?g:n<E.startSN&&x&&x.sn===n?x:null)}function e(t,n,x){if(!t||!t.details)return null;var E=t.details.partList;if(E)for(var g=E.length;g--;){var y=E[g];if(y.index===x&&y.fragment.sn===n)return y}return null}},"./src/controller/stream-controller.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"default",function(){return E});var H=I("./src/polyfills/number.ts"),L=I("./src/controller/base-stream-controller.ts"),C=I("./src/is-supported.ts"),j=I("./src/events.ts"),U=I("./src/utils/buffer-helper.ts"),O=I("./src/controller/fragment-tracker.ts"),S=I("./src/types/loader.ts"),_=I("./src/loader/fragment.ts"),b=I("./src/demux/transmuxer-interface.ts"),h=I("./src/types/transmuxer.ts"),l=I("./src/controller/gap-controller.ts"),r=I("./src/errors.ts"),s=I("./src/utils/logger.ts");function a(g,y){for(var v=0;v<y.length;v++){var d=y[v];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(g,d.key,d)}}function e(g,y,v){return y&&a(g.prototype,y),v&&a(g,v),g}function t(g,y){g.prototype=Object.create(y.prototype),g.prototype.constructor=g,n(g,y)}function n(g,y){return n=Object.setPrototypeOf||function(d,u){return d.__proto__=u,d},n(g,y)}var x=100,E=function(g){t(y,g);function y(d,u){var i;return i=g.call(this,d,u,"[stream-controller]")||this,i.audioCodecSwap=!1,i.gapController=null,i.level=-1,i._forceStartLoad=!1,i.altAudio=!1,i.audioOnly=!1,i.fragPlaying=null,i.onvplaying=null,i.onvseeked=null,i.fragLastKbps=0,i.stalled=!1,i.couldBacktrack=!1,i.audioCodecSwitch=!1,i.videoBuffer=null,i._registerListeners(),i}var v=y.prototype;return v._registerListeners=function(){var u=this.hls;u.on(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.on(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),u.on(j.Events.LEVEL_LOADING,this.onLevelLoading,this),u.on(j.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(j.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),u.on(j.Events.ERROR,this.onError,this),u.on(j.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),u.on(j.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),u.on(j.Events.BUFFER_CREATED,this.onBufferCreated,this),u.on(j.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),u.on(j.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),u.on(j.Events.FRAG_BUFFERED,this.onFragBuffered,this)},v._unregisterListeners=function(){var u=this.hls;u.off(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.off(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),u.off(j.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(j.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),u.off(j.Events.ERROR,this.onError,this),u.off(j.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),u.off(j.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),u.off(j.Events.BUFFER_CREATED,this.onBufferCreated,this),u.off(j.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),u.off(j.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),u.off(j.Events.FRAG_BUFFERED,this.onFragBuffered,this)},v.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},v.startLoad=function(u){if(this.levels){var i=this.lastCurrentTime,o=this.hls;if(this.stopLoad(),this.setInterval(x),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var p=o.startLevel;p===-1&&(o.config.testBandwidth?(p=0,this.bitrateTest=!0):p=o.nextAutoLevel),this.level=o.nextLoadLevel=p,this.loadedmetadata=!1}i>0&&u===-1&&(this.log("Override startPosition with lastCurrentTime @"+i.toFixed(3)),u=i),this.state=L.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=u,this.tick()}else this._forceStartLoad=!0,this.state=L.State.STOPPED},v.stopLoad=function(){this._forceStartLoad=!1,g.prototype.stopLoad.call(this)},v.doTick=function(){switch(this.state){case L.State.IDLE:this.doTickIdle();break;case L.State.WAITING_LEVEL:{var u,i=this.levels,o=this.level,p=i==null||((u=i[o])===null||u===void 0)?void 0:u.details;if(p&&(!p.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(p))break;this.state=L.State.IDLE;break}break}case L.State.FRAG_LOADING_WAITING_RETRY:{var f,c=self.performance.now(),w=this.retryDate;(!w||c>=w||(f=this.media)!==null&&f!==void 0&&f.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=L.State.IDLE)}break;default:break}this.onTickEnd()},v.onTickEnd=function(){g.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},v.doTickIdle=function(){var u,i,o=this.hls,p=this.levelLastLoaded,f=this.levels,c=this.media,w=o.config,A=o.nextLoadLevel;if(p===null||!c&&(this.startFragRequested||!w.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!f||!f[A])return;var P=f[A];this.level=o.nextLoadLevel=A;var N=P.details;if(!N||this.state===L.State.WAITING_LEVEL||N.live&&this.levelLastLoaded!==A){this.state=L.State.WAITING_LEVEL;return}var B=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:c,S.PlaylistLevelType.MAIN);if(B===null)return;var R=B.len,F=this.getMaxBufferLength(P.maxBitrate);if(R>=F)return;if(this._streamEnded(B,N)){var K={};this.altAudio&&(K.type="video"),this.hls.trigger(j.Events.BUFFER_EOS,K),this.state=L.State.ENDED;return}var X=B.end,ee=this.getNextFragment(X,N);if(this.couldBacktrack&&!this.fragPrevious&&ee&&ee.sn!=="initSegment"){var oe=ee.sn-N.startSN;oe>1&&(ee=N.fragments[oe-1],this.fragmentTracker.removeFragment(ee))}if(ee&&this.fragmentTracker.getState(ee)===O.FragmentState.OK&&this.nextLoadPosition>X){var ce=this.audioOnly&&!this.altAudio?_.ElementaryStreamTypes.AUDIO:_.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(c,ce,S.PlaylistLevelType.MAIN),ee=this.getNextFragment(this.nextLoadPosition,N)}if(!ee)return;ee.initSegment&&!ee.initSegment.data&&!this.bitrateTest&&(ee=ee.initSegment),((u=ee.decryptdata)===null||u===void 0?void 0:u.keyFormat)==="identity"&&!((i=ee.decryptdata)!==null&&i!==void 0&&i.key)?this.loadKey(ee,N):this.loadFragment(ee,N,X)},v.loadFragment=function(u,i,o){var p,f=this.fragmentTracker.getState(u);if(this.fragCurrent=u,f===O.FragmentState.BACKTRACKED){var c=this.fragmentTracker.getBacktrackData(u);if(c){this._handleFragmentLoadProgress(c),this._handleFragmentLoadComplete(c);return}else f=O.FragmentState.NOT_LOADED}f===O.FragmentState.NOT_LOADED||f===O.FragmentState.PARTIAL?u.sn==="initSegment"?this._loadInitSegment(u):this.bitrateTest?(u.bitrateTest=!0,this.log("Fragment "+u.sn+" of level "+u.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(u)):(this.startFragRequested=!0,g.prototype.loadFragment.call(this,u,i,o)):f===O.FragmentState.APPENDING?this.reduceMaxBufferLength(u.duration)&&this.fragmentTracker.removeFragment(u):((p=this.media)===null||p===void 0?void 0:p.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},v.getAppendedFrag=function(u){var i=this.fragmentTracker.getAppendedFrag(u,S.PlaylistLevelType.MAIN);return i&&"fragment"in i?i.fragment:i},v.getBufferedFrag=function(u){return this.fragmentTracker.getBufferedFrag(u,S.PlaylistLevelType.MAIN)},v.followingBufferedFrag=function(u){return u?this.getBufferedFrag(u.end+.5):null},v.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},v.nextLevelSwitch=function(){var u=this.levels,i=this.media;if(i!=null&&i.readyState){var o,p=this.getAppendedFrag(i.currentTime);if(p&&p.start>1&&this.flushMainBuffer(0,p.start-1),!i.paused&&u){var f=this.hls.nextLoadLevel,c=u[f],w=this.fragLastKbps;w&&this.fragCurrent?o=this.fragCurrent.duration*c.maxBitrate/(1e3*w)+1:o=0}else o=0;var A=this.getBufferedFrag(i.currentTime+o);if(A){var P=this.followingBufferedFrag(A);if(P){this.abortCurrentFrag();var N=P.maxStartPTS?P.maxStartPTS:P.start,B=P.duration,R=Math.max(A.end,N+Math.min(Math.max(B-this.config.maxFragLookUpTolerance,B*.5),B*.75));this.flushMainBuffer(R,Number.POSITIVE_INFINITY)}}}},v.abortCurrentFrag=function(){var u=this.fragCurrent;this.fragCurrent=null,u!=null&&u.loader&&u.loader.abort(),this.state===L.State.KEY_LOADING&&(this.state=L.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},v.flushMainBuffer=function(u,i){g.prototype.flushMainBuffer.call(this,u,i,this.altAudio?"video":null)},v.onMediaAttached=function(u,i){g.prototype.onMediaAttached.call(this,u,i);var o=i.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 l.default(this.config,o,this.fragmentTracker,this.hls)},v.onMediaDetaching=function(){var u=this.media;u&&(u.removeEventListener("playing",this.onvplaying),u.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 u=this.media,i=u?u.currentTime:null;Object(H.isFiniteNumber)(i)&&this.log("Media seeked to "+i.toFixed(3)),this.tick()},v.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(j.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},v.onManifestParsed=function(u,i){var o=!1,p=!1,f;i.levels.forEach(function(c){f=c.audioCodec,f&&(f.indexOf("mp4a.40.2")!==-1&&(o=!0),f.indexOf("mp4a.40.5")!==-1&&(p=!0))}),this.audioCodecSwitch=o&&p&&!Object(C.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=i.levels,this.startFragRequested=!1},v.onLevelLoading=function(u,i){var o=this.levels;if(!o||this.state!==L.State.IDLE)return;var p=o[i.level];(!p.details||p.details.live&&this.levelLastLoaded!==i.level||this.waitForCdnTuneIn(p.details))&&(this.state=L.State.WAITING_LEVEL)},v.onLevelLoaded=function(u,i){var o,p=this.levels,f=i.level,c=i.details,w=c.totalduration;if(!p){this.warn("Levels were reset while loading level "+f);return}this.log("Level "+f+" loaded ["+c.startSN+","+c.endSN+"], cc ["+c.startCC+", "+c.endCC+"] duration:"+w);var A=this.fragCurrent;A&&(this.state===L.State.FRAG_LOADING||this.state===L.State.FRAG_LOADING_WAITING_RETRY)&&(A.level!==i.level&&A.loader&&(this.state=L.State.IDLE,A.loader.abort()));var P=p[f],N=0;if(c.live||(o=P.details)!==null&&o!==void 0&&o.live){if(c.fragments[0]||(c.deltaUpdateFailed=!0),c.deltaUpdateFailed)return;N=this.alignPlaylists(c,P.details)}if(P.details=c,this.levelLastLoaded=f,this.hls.trigger(j.Events.LEVEL_UPDATED,{details:c,level:f}),this.state===L.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(c))return;this.state=L.State.IDLE}this.startFragRequested?c.live&&this.synchronizeToLiveEdge(c):this.setStartPosition(c,N),this.tick()},v._handleFragmentLoadProgress=function(u){var i,o=u.frag,p=u.part,f=u.payload,c=this.levels;if(!c){this.warn("Levels were reset while fragment load was in progress. Fragment "+o.sn+" of level "+o.level+" will not be buffered");return}var w=c[o.level],A=w.details;if(!A){this.warn("Dropping fragment "+o.sn+" of level "+o.level+" after level details were reset");return}var P=w.videoCodec,N=A.PTSKnown||!A.live,B=(i=o.initSegment)===null||i===void 0?void 0:i.data,R=this._getAudioCodec(w),F=this.transmuxer=this.transmuxer||new b.default(this.hls,S.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),K=p?p.index:-1,X=K!==-1,ee=new h.ChunkMetadata(o.level,o.sn,o.stats.chunkCount,f.byteLength,K,X),oe=this.initPTS[o.cc];F.push(f,B,R,P,o,p,A.totalduration,N,ee,oe)},v.onAudioTrackSwitching=function(u,i){var o=this.altAudio,p=!!i.url,f=i.id;if(!p){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var c=this.fragCurrent;c!=null&&c.loader&&(this.log("Switching to main audio track, cancel main fragment load"),c.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var w=this.hls;o&&w.trigger(j.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),w.trigger(j.Events.AUDIO_TRACK_SWITCHED,{id:f})}},v.onAudioTrackSwitched=function(u,i){var o=i.id,p=!!this.hls.audioTracks[o].url;if(p){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=p,this.tick()},v.onBufferCreated=function(u,i){var o=i.tracks,p,f,c=!1;for(var w in o){var A=o[w];if(A.id==="main"){if(f=w,p=A,w==="video"){var P=o[w];P&&(this.videoBuffer=P.buffer)}}else c=!0}c&&p?(this.log("Alternate track found, use "+f+".buffered to schedule main fragment loading"),this.mediaBuffer=p.buffer):this.mediaBuffer=this.media},v.onFragBuffered=function(u,i){var o=i.frag,p=i.part;if(o&&o.type!==S.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(o)){this.warn("Fragment "+o.sn+(p?" p: "+p.index:"")+" of level "+o.level+" finished buffering, but was aborted. state: "+this.state),this.state===L.State.PARSED&&(this.state=L.State.IDLE);return}var f=p?p.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,p)},v.onError=function(u,i){switch(i.details){case r.ErrorDetails.FRAG_LOAD_ERROR:case r.ErrorDetails.FRAG_LOAD_TIMEOUT:case r.ErrorDetails.KEY_LOAD_ERROR:case r.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(S.PlaylistLevelType.MAIN,i);break;case r.ErrorDetails.LEVEL_LOAD_ERROR:case r.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==L.State.ERROR&&(i.fatal?(this.warn(""+i.details),this.state=L.State.ERROR):!i.levelRetry&&this.state===L.State.WAITING_LEVEL&&(this.state=L.State.IDLE));break;case r.ErrorDetails.BUFFER_FULL_ERROR:if(i.parent==="main"&&(this.state===L.State.PARSING||this.state===L.State.PARSED)){var o=!0,p=this.getFwdBufferInfo(this.media,S.PlaylistLevelType.MAIN);p&&p.len>.5&&(o=!this.reduceMaxBufferLength(p.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 u=this.media,i=this.gapController;if(!u||!i||!u.readyState)return;var o=U.BufferHelper.getBuffered(u);!this.loadedmetadata&&o.length?(this.loadedmetadata=!0,this.seekToStartPos()):i.poll(this.lastCurrentTime),this.lastCurrentTime=u.currentTime},v.onFragLoadEmergencyAborted=function(){this.state=L.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},v.onBufferFlushed=function(u,i){var o=i.type;if(o!==_.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var p=(o===_.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(p,o,S.PlaylistLevelType.MAIN)}},v.onLevelsUpdated=function(u,i){this.levels=i.levels},v.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},v.seekToStartPos=function(){var u=this.media,i=u.currentTime,o=this.startPosition;if(o>=0&&i<o){if(u.seeking){s.logger.log("could not seek to "+o+", already seeking at "+i);return}var p=U.BufferHelper.getBuffered(u),f=p.length?p.start(0):0,c=f-o;c>0&&(c<this.config.maxBufferHole||c<this.config.maxFragLookUpTolerance)&&(s.logger.log("adjusting start position by "+c+" to match buffer start"),o+=c,this.startPosition=o),this.log("seek to target start position "+o+" from current time "+i),u.currentTime=o}},v._getAudioCodec=function(u){var i=this.config.defaultAudioCodec||u.audioCodec;return this.audioCodecSwap&&i&&(this.log("Swapping audio codec"),i.indexOf("mp4a.40.5")!==-1?i="mp4a.40.2":i="mp4a.40.5"),i},v._loadBitrateTestFrag=function(u){var i=this;this._doFragLoad(u).then(function(o){var p=i.hls;if(!o||p.nextLoadLevel||i.fragContextChanged(u))return;i.fragLoadError=0,i.state=L.State.IDLE,i.startFragRequested=!1,i.bitrateTest=!1;var f=u.stats;f.parsing.start=f.parsing.end=f.buffering.start=f.buffering.end=self.performance.now(),p.trigger(j.Events.FRAG_LOADED,o)})},v._handleTransmuxComplete=function(u){var i,o="main",p=this.hls,f=u.remuxResult,c=u.chunkMeta,w=this.getCurrentContext(c);if(!w){this.warn("The loading context changed while buffering fragment "+c.sn+" of level "+c.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(c.level);return}var A=w.frag,P=w.part,N=w.level,B=f.video,R=f.text,F=f.id3,K=f.initSegment,X=this.altAudio?void 0:f.audio;if(this.fragContextChanged(A))return;if(this.state=L.State.PARSING,K){K.tracks&&(this._bufferInitSegment(N,K.tracks,A,c),p.trigger(j.Events.FRAG_PARSING_INIT_SEGMENT,{frag:A,id:o,tracks:K.tracks}));var ee=K.initPTS,oe=K.timescale;Object(H.isFiniteNumber)(ee)&&(this.initPTS[A.cc]=ee,p.trigger(j.Events.INIT_PTS_FOUND,{frag:A,id:o,initPTS:ee,timescale:oe}))}if(B&&f.independent!==!1){if(N.details){var ce=B.startPTS,le=B.endPTS,be=B.startDTS,pe=B.endDTS;if(P)P.elementaryStreams[B.type]={startPTS:ce,endPTS:le,startDTS:be,endDTS:pe};else if(B.firstKeyFrame&&B.independent&&(this.couldBacktrack=!0),B.dropped&&B.independent){var de=this.getLoadPosition()+this.config.maxBufferHole;if(de<ce){this.backtrack(A);return}A.setElementaryStreamInfo(B.type,A.start,le,A.start,pe,!0)}A.setElementaryStreamInfo(B.type,ce,le,be,pe),this.bufferFragmentData(B,A,P,c)}}else if(f.independent===!1){this.backtrack(A);return}if(X){var te=X.startPTS,Le=X.endPTS,Ve=X.startDTS,Ne=X.endDTS;P&&(P.elementaryStreams[_.ElementaryStreamTypes.AUDIO]={startPTS:te,endPTS:Le,startDTS:Ve,endDTS:Ne}),A.setElementaryStreamInfo(_.ElementaryStreamTypes.AUDIO,te,Le,Ve,Ne),this.bufferFragmentData(X,A,P,c)}if(F!=null&&(i=F.samples)!==null&&i!==void 0&&i.length){var Be={frag:A,id:o,samples:F.samples};p.trigger(j.Events.FRAG_PARSING_METADATA,Be)}if(R){var ve={frag:A,id:o,samples:R.samples};p.trigger(j.Events.FRAG_PARSING_USERDATA,ve)}},v._bufferInitSegment=function(u,i,o,p){var f=this;if(this.state!==L.State.PARSING)return;this.audioOnly=!!i.audio&&!i.video,this.altAudio&&!this.audioOnly&&delete i.audio;var c=i.audio,w=i.video,A=i.audiovideo;if(c){var P=u.audioCodec,N=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(P&&(P.indexOf("mp4a.40.5")!==-1?P="mp4a.40.2":P="mp4a.40.5"),c.metadata.channelCount!==1&&N.indexOf("firefox")===-1&&(P="mp4a.40.5")),N.indexOf("android")!==-1&&c.container!=="audio/mpeg"&&(P="mp4a.40.2",this.log("Android: force audio codec to "+P)),u.audioCodec&&u.audioCodec!==P&&this.log('Swapping manifest audio codec "'+u.audioCodec+'" for "'+P+'"'),c.levelCodec=P,c.id="main",this.log("Init audio buffer, container:"+c.container+", codecs[selected/level/parsed]=["+(P||"")+"/"+(u.audioCodec||"")+"/"+c.codec+"]")}w&&(w.levelCodec=u.videoCodec,w.id="main",this.log("Init video buffer, container:"+w.container+", codecs[level/parsed]=["+(u.videoCodec||"")+"/"+w.codec+"]")),A&&this.log("Init audiovideo buffer, container:"+A.container+", codecs[level/parsed]=["+(u.attrs.CODECS||"")+"/"+A.codec+"]"),this.hls.trigger(j.Events.BUFFER_CODECS,i),Object.keys(i).forEach(function(B){var R=i[B],F=R.initSegment;F!=null&&F.byteLength&&f.hls.trigger(j.Events.BUFFER_APPENDING,{type:B,data:F,frag:o,part:null,chunkMeta:p,parent:o.type})}),this.tick()},v.backtrack=function(u){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(u);var i=this.fragmentTracker.backtrack(u);this.fragPrevious=null,this.nextLoadPosition=u.start,i?this.resetFragmentLoading(u):this.state=L.State.BACKTRACKING},v.checkFragmentChanged=function(){var u=this.media,i=null;if(u&&u.readyState>1&&u.seeking===!1){var o=u.currentTime;if(U.BufferHelper.isBuffered(u,o)?i=this.getAppendedFrag(o):U.BufferHelper.isBuffered(u,o+.1)&&(i=this.getAppendedFrag(o+.1)),i){var p=this.fragPlaying,f=i.level;(!p||i.sn!==p.sn||p.level!==f||i.urlId!==p.urlId)&&(this.hls.trigger(j.Events.FRAG_CHANGED,{frag:i}),(!p||p.level!==f)&&this.hls.trigger(j.Events.LEVEL_SWITCHED,{level:f}),this.fragPlaying=i)}}},e(y,[{key:"nextLevel",get:function(){var u=this.nextBufferedFrag;return u?u.level:-1}},{key:"currentLevel",get:function(){var u=this.media;if(u){var i=this.getAppendedFrag(u.currentTime);if(i)return i.level}return-1}},{key:"nextBufferedFrag",get:function(){var u=this.media;if(u){var i=this.getAppendedFrag(u.currentTime);return this.followingBufferedFrag(i)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),y}(L.default)},"./src/controller/subtitle-stream-controller.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"SubtitleStreamController",function(){return t});var H=I("./src/events.ts"),L=I("./src/utils/logger.ts"),C=I("./src/utils/buffer-helper.ts"),j=I("./src/controller/fragment-finders.ts"),U=I("./src/utils/discontinuities.ts"),O=I("./src/controller/level-helper.ts"),S=I("./src/controller/fragment-tracker.ts"),_=I("./src/controller/base-stream-controller.ts"),b=I("./src/types/loader.ts"),h=I("./src/types/level.ts");function l(n,x){for(var E=0;E<x.length;E++){var g=x[E];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(n,g.key,g)}}function r(n,x,E){return x&&l(n.prototype,x),E&&l(n,E),n}function s(n,x){n.prototype=Object.create(x.prototype),n.prototype.constructor=n,a(n,x)}function a(n,x){return a=Object.setPrototypeOf||function(g,y){return g.__proto__=y,g},a(n,x)}var e=500,t=function(n){s(x,n);function x(g,y){var v;return v=n.call(this,g,y,"[subtitle-stream-controller]")||this,v.levels=[],v.currentTrackId=-1,v.tracksBuffered=[],v.mainDetails=null,v._registerListeners(),v}var E=x.prototype;return E.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},E._registerListeners=function(){var y=this.hls;y.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),y.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),y.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),y.on(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),y.on(H.Events.ERROR,this.onError,this),y.on(H.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),y.on(H.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),y.on(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),y.on(H.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),y.on(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},E._unregisterListeners=function(){var y=this.hls;y.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),y.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),y.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),y.off(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),y.off(H.Events.ERROR,this.onError,this),y.off(H.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),y.off(H.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),y.off(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),y.off(H.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),y.off(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},E.startLoad=function(){this.stopLoad(),this.state=_.State.IDLE,this.setInterval(e),this.tick()},E.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},E.onLevelLoaded=function(y,v){this.mainDetails=v.details},E.onSubtitleFragProcessed=function(y,v){var d=v.frag,u=v.success;if(this.fragPrevious=d,this.state=_.State.IDLE,!u)return;var i=this.tracksBuffered[this.currentTrackId];if(!i)return;for(var o,p=d.start,f=0;f<i.length;f++)if(p>=i[f].start&&p<=i[f].end){o=i[f];break}var c=d.start+d.duration;o?o.end=c:(o={start:p,end:c},i.push(o)),this.fragmentTracker.fragBuffered(d)},E.onBufferFlushing=function(y,v){var d=v.startOffset,u=v.endOffset;if(d===0&&u!==Number.POSITIVE_INFINITY){var i=this.currentTrackId,o=this.levels;if(!o.length||!o[i]||!o[i].details)return;var p=o[i].details,f=p.targetduration,c=u-f;if(c<=0)return;v.endOffsetSubtitles=Math.max(0,c),this.tracksBuffered.forEach(function(w){for(var A=0;A<w.length;){if(w[A].end<=c){w.shift();continue}else if(w[A].start<c)w[A].start=c;else break;A++}}),this.fragmentTracker.removeFragmentsInRange(d,c,b.PlaylistLevelType.SUBTITLE)}},E.onError=function(y,v){var d,u=v.frag;if(!u||u.type!==b.PlaylistLevelType.SUBTITLE)return;(d=this.fragCurrent)!==null&&d!==void 0&&d.loader&&this.fragCurrent.loader.abort(),this.state=_.State.IDLE},E.onSubtitleTracksUpdated=function(y,v){var d=this,u=v.subtitleTracks;this.tracksBuffered=[],this.levels=u.map(function(i){return new h.Level(i)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(i){d.tracksBuffered[i.id]=[]}),this.mediaBuffer=null},E.onSubtitleTrackSwitch=function(y,v){if(this.currentTrackId=v.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var d=this.levels[this.currentTrackId];d!=null&&d.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,d&&this.setInterval(e)},E.onSubtitleTrackLoaded=function(y,v){var d,u=v.details,i=v.id,o=this.currentTrackId,p=this.levels;if(!p.length)return;var f=p[o];if(i>=p.length||i!==o||!f)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,u.live||(d=f.details)!==null&&d!==void 0&&d.live){var c=this.mainDetails;if(u.deltaUpdateFailed||!c)return;var w=c.fragments[0];if(!f.details)u.hasProgramDateTime&&c.hasProgramDateTime?Object(U.alignMediaPlaylistByPDT)(u,c):w&&Object(O.addSliding)(u,w.start);else{var A=this.alignPlaylists(u,f.details);A===0&&w&&Object(O.addSliding)(u,w.start)}}if(f.details=u,this.levelLastLoaded=i,this.tick(),u.live&&!this.fragCurrent&&this.media&&this.state===_.State.IDLE){var P=Object(j.findFragmentByPTS)(null,u.fragments,this.media.currentTime,0);P||(this.warn("Subtitle playlist not aligned with playback"),f.details=void 0)}},E._handleFragmentLoadComplete=function(y){var v=y.frag,d=y.payload,u=v.decryptdata,i=this.hls;if(this.fragContextChanged(v))return;if(d&&d.byteLength>0&&u&&u.key&&u.iv&&u.method==="AES-128"){var o=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(d),u.key.buffer,u.iv.buffer).then(function(p){var f=performance.now();i.trigger(H.Events.FRAG_DECRYPTED,{frag:v,payload:p,stats:{tstart:o,tdecrypt:f}})})}},E.doTick=function(){if(!this.media){this.state=_.State.IDLE;return}if(this.state===_.State.IDLE){var y,v=this.currentTrackId,d=this.levels;if(!d.length||!d[v]||!d[v].details)return;var u=d[v].details,i=u.targetduration,o=this.config,p=this.media,f=C.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,p.currentTime-i,o.maxBufferHole),c=f.end,w=f.len,A=this.getMaxBufferLength()+i;if(w>A)return;console.assert(u,"Subtitle track details are defined on idle subtitle stream controller tick");var P=u.fragments,N=P.length,B=u.edge,R,F=this.fragPrevious;if(c<B){var K=o.maxFragLookUpTolerance;F&&u.hasProgramDateTime&&(R=Object(j.findFragmentByPDT)(P,F.endProgramDateTime,K)),R||(R=Object(j.findFragmentByPTS)(F,P,c,K),!R&&F&&F.start<P[0].start&&(R=P[0]))}else R=P[N-1];(y=R)!==null&&y!==void 0&&y.encrypted?(L.logger.log("Loading key for "+R.sn),this.state=_.State.KEY_LOADING,this.hls.trigger(H.Events.KEY_LOADING,{frag:R})):R&&this.fragmentTracker.getState(R)===S.FragmentState.NOT_LOADED&&this.loadFragment(R,u,c)}},E.loadFragment=function(y,v,d){this.fragCurrent=y,n.prototype.loadFragment.call(this,y,v,d)},r(x,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),x}(_.default)},"./src/controller/subtitle-track-controller.ts":function(re,W,I){"use strict";I.r(W);var H=I("./src/events.ts"),L=I("./src/utils/texttrack-utils.ts"),C=I("./src/controller/base-playlist-controller.ts"),j=I("./src/types/loader.ts");function U(l,r){for(var s=0;s<r.length;s++){var a=r[s];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(l,a.key,a)}}function O(l,r,s){return r&&U(l.prototype,r),s&&U(l,s),l}function S(l,r){l.prototype=Object.create(r.prototype),l.prototype.constructor=l,_(l,r)}function _(l,r){return _=Object.setPrototypeOf||function(a,e){return a.__proto__=e,a},_(l,r)}var b=function(l){S(r,l);function r(a){var e;return e=l.call(this,a,"[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 s=r.prototype;return s.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,l.prototype.destroy.call(this)},s.registerListeners=function(){var e=this.hls;e.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(H.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(H.Events.ERROR,this.onError,this)},s.unregisterListeners=function(){var e=this.hls;e.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(H.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(H.Events.ERROR,this.onError,this)},s.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)},s.pollTrackChange=function(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,e)},s.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=h(this.media.textTracks);e.forEach(function(t){Object(L.clearCurrentCues)(t)}),this.subtitleTrack=-1,this.media=null},s.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},s.onManifestParsed=function(e,t){this.tracks=t.subtitleTracks},s.onSubtitleTrackLoaded=function(e,t){var n=t.id,x=t.details,E=this.trackId,g=this.tracksInGroup[E];if(!g){this.warn("Invalid subtitle track id "+n);return}var y=g.details;g.details=t.details,this.log("subtitle track "+n+" loaded ["+x.startSN+"-"+x.endSN+"]"),n===this.trackId&&(this.retryCount=0,this.playlistLoaded(n,t,y))},s.onLevelLoading=function(e,t){this.switchLevel(t.level)},s.onLevelSwitching=function(e,t){this.switchLevel(t.level)},s.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 x=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,E=this.tracks.filter(function(v){return!n||v.groupId===n});this.tracksInGroup=E;var g=this.findTrackId(x==null?void 0:x.name)||this.findTrackId();this.groupId=n;var y={subtitleTracks:E};this.log("Updating subtitle tracks, "+E.length+' track(s) found in "'+n+'" group-id'),this.hls.trigger(H.Events.SUBTITLE_TRACKS_UPDATED,y),g!==-1&&this.setSubtitleTrack(g,x)}},s.findTrackId=function(e){for(var t=this.tracksInGroup,n=0;n<t.length;n++){var x=t[n];if((!this.selectDefaultTrack||x.default)&&(!e||e===x.name))return x.id}return-1},s.onError=function(e,t){if(l.prototype.onError.call(this,e,t),t.fatal||!t.context)return;t.context.type===j.PlaylistContextType.SUBTITLE_TRACK&&t.context.id===this.trackId&&t.context.groupId===this.groupId&&this.retryLoadingOrFail(t)},s.loadPlaylist=function(e){var t=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(t)){var n=t.id,x=t.groupId,E=t.url;if(e)try{E=e.addDirectives(E)}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(H.Events.SUBTITLE_TRACK_LOADING,{url:E,id:n,groupId:x,deliveryDirectives:e||null})}},s.toggleTrackModes=function(e){var t=this,n=this.media,x=this.subtitleDisplay,E=this.trackId;if(!n)return;var g=h(n.textTracks),y=g.filter(function(u){return u.groupId===t.groupId});if(e===-1)[].slice.call(g).forEach(function(u){u.mode="disabled"});else{var v=y[E];v&&(v.mode="disabled")}var d=y[e];d&&(d.mode=x?"showing":"hidden")},s.setSubtitleTrack=function(e,t){var n,x=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(this.trackId!==e&&this.toggleTrackModes(e),this.trackId===e&&(e===-1||(n=x[e])!==null&&n!==void 0&&n.details)||e<-1||e>=x.length)return;this.clearTimer();var E=x[e];if(this.log("Switching to subtitle track "+e),this.trackId=e,E){var g=E.id,y=E.groupId,v=y===void 0?"":y,d=E.name,u=E.type,i=E.url;this.hls.trigger(H.Events.SUBTITLE_TRACK_SWITCH,{id:g,groupId:v,name:d,type:u,url:i});var o=this.switchParams(E.url,t==null?void 0:t.details);this.loadPlaylist(o)}else this.hls.trigger(H.Events.SUBTITLE_TRACK_SWITCH,{id:e})},s.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var e=-1,t=h(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(r,[{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)}}]),r}(C.default);function h(l){for(var r=[],s=0;s<l.length;s++){var a=l[s];a.kind==="subtitles"&&a.label&&r.push(l[s])}return r}W.default=b},"./src/controller/timeline-controller.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"TimelineController",function(){return h});var H=I("./src/polyfills/number.ts"),L=I("./src/events.ts"),C=I("./src/utils/cea-608-parser.ts"),j=I("./src/utils/output-filter.ts"),U=I("./src/utils/webvtt-parser.ts"),O=I("./src/utils/texttrack-utils.ts"),S=I("./src/utils/imsc1-ttml-parser.ts"),_=I("./src/types/loader.ts"),b=I("./src/utils/logger.ts"),h=function(){function a(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=s(),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 j.default(this,"textTrack1"),x=new j.default(this,"textTrack2"),E=new j.default(this,"textTrack3"),g=new j.default(this,"textTrack4");this.cea608Parser1=new C.default(1,n,x),this.cea608Parser2=new C.default(3,E,g)}t.on(L.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(L.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(L.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(L.Events.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(L.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(L.Events.FRAG_LOADING,this.onFragLoading,this),t.on(L.Events.FRAG_LOADED,this.onFragLoaded,this),t.on(L.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.on(L.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),t.on(L.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(L.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.on(L.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var e=a.prototype;return e.destroy=function(){var n=this.hls;n.off(L.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),n.off(L.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.off(L.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.off(L.Events.MANIFEST_LOADED,this.onManifestLoaded,this),n.off(L.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),n.off(L.Events.FRAG_LOADING,this.onFragLoading,this),n.off(L.Events.FRAG_LOADED,this.onFragLoaded,this),n.off(L.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),n.off(L.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),n.off(L.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),n.off(L.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),n.off(L.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},e.addCues=function(n,x,E,g,y){for(var v=!1,d=y.length;d--;){var u=y[d],i=r(u[0],u[1],x,E);if(i>=0&&(u[0]=Math.min(u[0],x),u[1]=Math.max(u[1],E),v=!0,i/(E-x)>.5))return}if(v||y.push([x,E]),this.config.renderTextTracksNatively){var o=this.captionsTracks[n];this.Cues.newCue(o,x,E,g)}else{var p=this.Cues.newCue(null,x,E,g);this.hls.trigger(L.Events.CUES_PARSED,{type:"captions",cues:p,track:n})}},e.onInitPtsFound=function(n,x){var E=this,g=x.frag,y=x.id,v=x.initPTS,d=x.timescale,u=this.unparsedVttFrags;y==="main"&&(this.initPTS[g.cc]=v,this.timescale[g.cc]=d),u.length&&(this.unparsedVttFrags=[],u.forEach(function(i){E.onFragLoaded(L.Events.FRAG_LOADED,i)}))},e.getExistingTrack=function(n){var x=this.media;if(x)for(var E=0;E<x.textTracks.length;E++){var g=x.textTracks[E];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 x=this.captionsProperties,E=this.captionsTracks,g=this.media,y=x[n],v=y.label,d=y.languageCode,u=this.getExistingTrack(n);if(u)E[n]=u,Object(O.clearCurrentCues)(E[n]),Object(O.sendAddTrackEvent)(E[n],g);else{var i=this.createTextTrack("captions",v,d);i&&(i[n]=!0,E[n]=i)}},e.createNonNativeTrack=function(n){if(this.nonNativeCaptionsTracks[n])return;var x=this.captionsProperties[n];if(!x)return;var E=x.label,g={_id:n,label:E,kind:"captions",default:x.media?!!x.media.default:!1,closedCaptions:x.media};this.nonNativeCaptionsTracks[n]=g,this.hls.trigger(L.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[g]})},e.createTextTrack=function(n,x,E){var g=this.media;return g?g.addTextTrack(n,x,E):void 0},e.onMediaAttaching=function(n,x){this.media=x.media,this._cleanTracks()},e.onMediaDetaching=function(){var n=this.captionsTracks;Object.keys(n).forEach(function(x){Object(O.clearCurrentCues)(n[x]),delete n[x]}),this.nonNativeCaptionsTracks={}},e.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=s(),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 x=n.textTracks;if(x)for(var E=0;E<x.length;E++)Object(O.clearCurrentCues)(x[E])},e.onSubtitleTracksUpdated=function(n,x){var E=this;this.textTracks=[];var g=x.subtitleTracks||[],y=g.some(function(i){return i.textCodec===S.IMSC1_CODEC});if(this.config.enableWebVTT||y&&this.config.enableIMSC1){var v=this.tracks&&g&&this.tracks.length===g.length;if(this.tracks=g||[],this.config.renderTextTracksNatively){var d=this.media?this.media.textTracks:[];this.tracks.forEach(function(i,o){var p;if(o<d.length){for(var f=null,c=0;c<d.length;c++)if(l(d[c],i)){f=d[c];break}f&&(p=f)}p?Object(O.clearCurrentCues)(p):(p=E.createTextTrack("subtitles",i.name,i.lang),p&&(p.mode="disabled")),p&&(p.groupId=i.groupId,E.textTracks.push(p))})}else if(!v&&this.tracks&&this.tracks.length){var u=this.tracks.map(function(i){return{label:i.name,kind:i.type.toLowerCase(),default:i.default,subtitleTrack:i}});this.hls.trigger(L.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:u})}}},e.onManifestLoaded=function(n,x){var E=this;this.config.enableCEA708Captions&&x.captions&&x.captions.forEach(function(g){var y=/(?:CC|SERVICE)([1-4])/.exec(g.instreamId);if(!y)return;var v="textTrack"+y[1],d=E.captionsProperties[v];if(!d)return;d.label=g.name,g.lang&&(d.languageCode=g.lang),d.media=g})},e.onFragLoading=function(n,x){var E=this.cea608Parser1,g=this.cea608Parser2,y=this.lastSn,v=this.lastPartIndex;if(!this.enabled||!(E&&g))return;if(x.frag.type===_.PlaylistLevelType.MAIN){var d,u,i=x.frag.sn,o=(d=x==null||((u=x.part)===null||u===void 0)?void 0:u.index)!=null?d:-1;i===y+1||i===y&&o===v+1||(E.reset(),g.reset()),this.lastSn=i,this.lastPartIndex=o}},e.onFragLoaded=function(n,x){var E=x.frag,g=x.payload,y=this.initPTS,v=this.unparsedVttFrags;if(E.type===_.PlaylistLevelType.SUBTITLE)if(g.byteLength){if(!Object(H.isFiniteNumber)(y[E.cc])){v.push(x),y.length&&this.hls.trigger(L.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:E,error:new Error("Missing initial subtitle PTS")});return}var d=E.decryptdata;if(d==null||d.key==null||d.method!=="AES-128"){var u=this.tracks[E.level],i=this.vttCCs;i[E.cc]||(i[E.cc]={start:E.start,prevCC:this.prevCC,new:!0},this.prevCC=E.cc),u&&u.textCodec===S.IMSC1_CODEC?this._parseIMSC1(E,g):this._parseVTTs(E,g,i)}}else this.hls.trigger(L.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:E,error:new Error("Empty subtitle payload")})},e._parseIMSC1=function(n,x){var E=this,g=this.hls;Object(S.parseIMSC1)(x,this.initPTS[n.cc],this.timescale[n.cc],function(y){E._appendCues(y,n.level),g.trigger(L.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:n})},function(y){b.logger.log("Failed to parse IMSC1: "+y),g.trigger(L.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:y})})},e._parseVTTs=function(n,x,E){var g=this,y=this.hls;Object(U.parseWebVTT)(x,this.initPTS[n.cc],this.timescale[n.cc],E,n.cc,n.start,function(v){g._appendCues(v,n.level),y.trigger(L.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:n})},function(v){g._fallbackToIMSC1(n,x),b.logger.log("Failed to parse VTT cue: "+v),y.trigger(L.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:v})})},e._fallbackToIMSC1=function(n,x){var E=this,g=this.tracks[n.level];g.textCodec||Object(S.parseIMSC1)(x,this.initPTS[n.cc],this.timescale[n.cc],function(){g.textCodec=S.IMSC1_CODEC,E._parseIMSC1(n,x)},function(){g.textCodec="wvtt"})},e._appendCues=function(n,x){var E=this.hls;if(this.config.renderTextTracksNatively){var g=this.textTracks[x];if(g.mode==="disabled")return;n.forEach(function(d){return Object(O.addCueToTrack)(g,d)})}else{var y=this.tracks[x],v=y.default?"default":"subtitles"+x;E.trigger(L.Events.CUES_PARSED,{type:"subtitles",cues:n,track:v})}},e.onFragDecrypted=function(n,x){var E=x.frag;if(E.type===_.PlaylistLevelType.SUBTITLE){if(!Object(H.isFiniteNumber)(this.initPTS[E.cc])){this.unparsedVttFrags.push(x);return}this.onFragLoaded(L.Events.FRAG_LOADED,x)}},e.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},e.onFragParsingUserdata=function(n,x){var E=this.cea608Parser1,g=this.cea608Parser2;if(!this.enabled||!(E&&g))return;for(var y=0;y<x.samples.length;y++){var v=x.samples[y].bytes;if(v){var d=this.extractCea608Data(v);E.addData(x.samples[y].pts,d[0]),g.addData(x.samples[y].pts,d[1])}}},e.onBufferFlushing=function(n,x){var E=x.startOffset,g=x.endOffset,y=x.endOffsetSubtitles,v=x.type,d=this.media;if(!d||d.currentTime<g)return;if(!v||v==="video"){var u=this.captionsTracks;Object.keys(u).forEach(function(o){return Object(O.removeCuesInRange)(u[o],E,g)})}if(this.config.renderTextTracksNatively&&(E===0&&y!==void 0)){var i=this.textTracks;Object.keys(i).forEach(function(o){return Object(O.removeCuesInRange)(i[o],E,y)})}},e.extractCea608Data=function(n){for(var x=n[0]&31,E=2,g=[[],[]],y=0;y<x;y++){var v=n[E++],d=127&n[E++],u=127&n[E++],i=(4&v)!==0,o=3&v;if(d===0&&u===0)continue;i&&((o===0||o===1)&&(g[o].push(d),g[o].push(u)))}return g},a}();function l(a,e){return a&&a.label===e.name&&!(a.textTrack1||a.textTrack2)}function r(a,e,t,n){return Math.min(e,n)-Math.max(a,t)}function s(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"default",function(){return H});var H=function(){function L(j,U){this.subtle=void 0,this.aesIV=void 0,this.subtle=j,this.aesIV=U}var C=L.prototype;return C.decrypt=function(U,O){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},O,U)},L}()},"./src/crypt/aes-decryptor.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"removePadding",function(){return L}),I.d(W,"default",function(){return C});var H=I("./src/utils/typed-array.ts");function L(j){var U=j.byteLength,O=U&&new DataView(j.buffer).getUint8(U-1);return O?Object(H.sliceUint8)(j,0,U-O):j}var C=function(){function j(){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 U=j.prototype;return U.uint8ArrayToUint32Array_=function(S){for(var _=new DataView(S),b=new Uint32Array(4),h=0;h<4;h++)b[h]=_.getUint32(h*4);return b},U.initTable=function(){var S=this.sBox,_=this.invSBox,b=this.subMix,h=b[0],l=b[1],r=b[2],s=b[3],a=this.invSubMix,e=a[0],t=a[1],n=a[2],x=a[3],E=new Uint32Array(256),g=0,y=0,v=0;for(v=0;v<256;v++)v<128?E[v]=v<<1:E[v]=v<<1^283;for(v=0;v<256;v++){var d=y^y<<1^y<<2^y<<3^y<<4;d=d>>>8^d&255^99,S[g]=d,_[d]=g;var u=E[g],i=E[u],o=E[i],p=E[d]*257^d*16843008;h[g]=p<<24|p>>>8,l[g]=p<<16|p>>>16,r[g]=p<<8|p>>>24,s[g]=p,p=o*16843009^i*65537^u*257^g*16843008,e[d]=p<<24|p>>>8,t[d]=p<<16|p>>>16,n[d]=p<<8|p>>>24,x[d]=p,g?(g=u^E[E[E[o^u]]],y^=E[E[y]]):g=y=1}},U.expandKey=function(S){for(var _=this.uint8ArrayToUint32Array_(S),b=!0,h=0;h<_.length&&b;)b=_[h]===this.key[h],h++;if(b)return;this.key=_;var l=this.keySize=_.length;if(l!==4&&l!==6&&l!==8)throw new Error("Invalid aes key size="+l);var r=this.ksRows=(l+6+1)*4,s,a,e=this.keySchedule=new Uint32Array(r),t=this.invKeySchedule=new Uint32Array(r),n=this.sBox,x=this.rcon,E=this.invSubMix,g=E[0],y=E[1],v=E[2],d=E[3],u,i;for(s=0;s<r;s++){if(s<l){u=e[s]=_[s];continue}i=u,s%l===0?(i=i<<8|i>>>24,i=n[i>>>24]<<24|n[i>>>16&255]<<16|n[i>>>8&255]<<8|n[i&255],i^=x[s/l|0]<<24):l>6&&s%l===4&&(i=n[i>>>24]<<24|n[i>>>16&255]<<16|n[i>>>8&255]<<8|n[i&255]),e[s]=u=(e[s-l]^i)>>>0}for(a=0;a<r;a++)s=r-a,a&3?i=e[s]:i=e[s-4],a<4||s<=4?t[a]=i:t[a]=g[n[i>>>24]]^y[n[i>>>16&255]]^v[n[i>>>8&255]]^d[n[i&255]],t[a]=t[a]>>>0},U.networkToHostOrderSwap=function(S){return S<<24|(S&65280)<<8|(S&16711680)>>8|S>>>24},U.decrypt=function(S,_,b){for(var h=this.keySize+6,l=this.invKeySchedule,r=this.invSBox,s=this.invSubMix,a=s[0],e=s[1],t=s[2],n=s[3],x=this.uint8ArrayToUint32Array_(b),E=x[0],g=x[1],y=x[2],v=x[3],d=new Int32Array(S),u=new Int32Array(d.length),i,o,p,f,c,w,A,P,N,B,R,F,K,X,ee=this.networkToHostOrderSwap;_<d.length;){for(N=ee(d[_]),B=ee(d[_+1]),R=ee(d[_+2]),F=ee(d[_+3]),c=N^l[0],w=F^l[1],A=R^l[2],P=B^l[3],K=4,X=1;X<h;X++)i=a[c>>>24]^e[w>>16&255]^t[A>>8&255]^n[P&255]^l[K],o=a[w>>>24]^e[A>>16&255]^t[P>>8&255]^n[c&255]^l[K+1],p=a[A>>>24]^e[P>>16&255]^t[c>>8&255]^n[w&255]^l[K+2],f=a[P>>>24]^e[c>>16&255]^t[w>>8&255]^n[A&255]^l[K+3],c=i,w=o,A=p,P=f,K=K+4;i=r[c>>>24]<<24^r[w>>16&255]<<16^r[A>>8&255]<<8^r[P&255]^l[K],o=r[w>>>24]<<24^r[A>>16&255]<<16^r[P>>8&255]<<8^r[c&255]^l[K+1],p=r[A>>>24]<<24^r[P>>16&255]<<16^r[c>>8&255]<<8^r[w&255]^l[K+2],f=r[P>>>24]<<24^r[c>>16&255]<<16^r[w>>8&255]<<8^r[A&255]^l[K+3],u[_]=ee(i^E),u[_+1]=ee(f^g),u[_+2]=ee(p^y),u[_+3]=ee(o^v),E=N,g=B,y=R,v=F,_=_+4}return u.buffer},j}()},"./src/crypt/decrypter.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"default",function(){return _});var H=I("./src/crypt/aes-crypto.ts"),L=I("./src/crypt/fast-aes-key.ts"),C=I("./src/crypt/aes-decryptor.ts"),j=I("./src/utils/logger.ts"),U=I("./src/utils/mp4-tools.ts"),O=I("./src/utils/typed-array.ts"),S=16,_=function(){function b(l,r,s){var a=s===void 0?{}:s,e=a.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=l,this.config=r,this.removePKCS7Padding=t,t)try{var n=self.crypto;n&&(this.subtle=n.subtle||n.webkitSubtle)}catch(x){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var h=b.prototype;return h.destroy=function(){this.observer=null},h.isSync=function(){return this.config.enableSoftwareAES},h.flush=function(){var r=this.currentResult;if(!r){this.reset();return}var s=new Uint8Array(r);return this.reset(),this.removePKCS7Padding?Object(C.removePadding)(s):s},h.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},h.decrypt=function(r,s,a,e){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(r),s,a);var t=this.flush();t&&e(t.buffer)}else this.webCryptoDecrypt(new Uint8Array(r),s,a).then(e)},h.softwareDecrypt=function(r,s,a){var e=this.currentIV,t=this.currentResult,n=this.remainderData;this.logOnce("JS AES decrypt"),n&&(r=Object(U.appendUint8Array)(n,r),this.remainderData=null);var x=this.getValidChunk(r);if(!x.length)return null;e&&(a=e);var E=this.softwareDecrypter;E||(E=this.softwareDecrypter=new C.default),E.expandKey(s);var g=t;return this.currentResult=E.decrypt(x.buffer,0,a),this.currentIV=Object(O.sliceUint8)(x,-16).buffer,g||null},h.webCryptoDecrypt=function(r,s,a){var e=this,t=this.subtle;return(this.key!==s||!this.fastAesKey)&&(this.key=s,this.fastAesKey=new L.default(t,s)),this.fastAesKey.expandKey().then(function(n){if(!t)return Promise.reject(new Error("web crypto not initialized"));var x=new H.default(t,a);return x.decrypt(r.buffer,n)}).catch(function(n){return e.onWebCryptoError(n,r,s,a)})},h.onWebCryptoError=function(r,s,a,e){return j.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",r),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(s,a,e)},h.getValidChunk=function(r){var s=r,a=r.length-r.length%S;return a!==r.length&&(s=Object(O.sliceUint8)(r,0,a),this.remainderData=Object(O.sliceUint8)(r,a)),s},h.logOnce=function(r){if(!this.logEnabled)return;j.logger.log("[decrypter.ts]: "+r),this.logEnabled=!1},b}()},"./src/crypt/fast-aes-key.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"default",function(){return H});var H=function(){function L(j,U){this.subtle=void 0,this.key=void 0,this.subtle=j,this.key=U}var C=L.prototype;return C.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},L}()},"./src/demux/aacdemuxer.ts":function(re,W,I){"use strict";I.r(W);var H=I("./src/demux/base-audio-demuxer.ts"),L=I("./src/demux/adts.ts"),C=I("./src/utils/logger.ts"),j=I("./src/demux/id3.ts");function U(_,b){_.prototype=Object.create(b.prototype),_.prototype.constructor=_,O(_,b)}function O(_,b){return O=Object.setPrototypeOf||function(l,r){return l.__proto__=r,l},O(_,b)}var S=function(_){U(b,_);function b(l,r){var s;return s=_.call(this)||this,s.observer=void 0,s.config=void 0,s.observer=l,s.config=r,s}var h=b.prototype;return h.resetInitSegment=function(r,s,a){_.prototype.resetInitSegment.call(this,r,s,a),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:r,duration:a,inputTimeScale:9e4,dropped:0}},b.probe=function(r){if(!r)return!1;for(var s=j.getID3Data(r,0)||[],a=s.length,e=r.length;a<e;a++)if(L.probe(r,a))return C.logger.log("ADTS sync word found !"),!0;return!1},h.canParse=function(r,s){return L.canParse(r,s)},h.appendFrame=function(r,s,a){L.initTrackConfig(r,this.observer,s,a,r.manifestCodec);var e=L.appendFrame(r,s,a,this.initPTS,this.frameIndex);if(e&&e.missing===0)return e},b}(H.default);S.minProbeByteLength=9,W.default=S},"./src/demux/adts.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"getAudioConfig",function(){return j}),I.d(W,"isHeaderPattern",function(){return U}),I.d(W,"getHeaderLength",function(){return O}),I.d(W,"getFullFrameLength",function(){return S}),I.d(W,"canGetFrameLength",function(){return _}),I.d(W,"isHeader",function(){return b}),I.d(W,"canParse",function(){return h}),I.d(W,"probe",function(){return l}),I.d(W,"initTrackConfig",function(){return r}),I.d(W,"getFrameDuration",function(){return s}),I.d(W,"parseFrameHeader",function(){return a}),I.d(W,"appendFrame",function(){return e});var H=I("./src/utils/logger.ts"),L=I("./src/errors.ts"),C=I("./src/events.ts");function j(t,n,x,E){var g,y,v,d,u=navigator.userAgent.toLowerCase(),i=E,o=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];g=((n[x+2]&192)>>>6)+1;var p=(n[x+2]&60)>>>2;if(p>o.length-1){t.trigger(C.Events.ERROR,{type:L.ErrorTypes.MEDIA_ERROR,details:L.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+p});return}return v=(n[x+2]&1)<<2,v|=(n[x+3]&192)>>>6,H.logger.log("manifest codec:"+E+", ADTS type:"+g+", samplingIndex:"+p),/firefox/i.test(u)?p>=6?(g=5,d=new Array(4),y=p-3):(g=2,d=new Array(2),y=p):u.indexOf("android")!==-1?(g=2,d=new Array(2),y=p):(g=5,d=new Array(4),E&&(E.indexOf("mp4a.40.29")!==-1||E.indexOf("mp4a.40.5")!==-1)||!E&&p>=6?y=p-3:((E&&E.indexOf("mp4a.40.2")!==-1&&(p>=6&&v===1||/vivaldi/i.test(u))||!E&&v===1)&&(g=2,d=new Array(2)),y=p)),d[0]=g<<3,d[0]|=(p&14)>>1,d[1]|=(p&1)<<7,d[1]|=v<<3,g===5&&(d[1]|=(y&14)>>1,d[2]=(y&1)<<7,d[2]|=2<<2,d[3]=0),{config:d,samplerate:o[p],channelCount:v,codec:"mp4a.40."+g,manifestCodec:i}}function U(t,n){return t[n]===255&&(t[n+1]&246)===240}function O(t,n){return t[n+1]&1?7:9}function S(t,n){return(t[n+3]&3)<<11|t[n+4]<<3|(t[n+5]&224)>>>5}function _(t,n){return n+5<t.length}function b(t,n){return n+1<t.length&&U(t,n)}function h(t,n){return _(t,n)&&U(t,n)&&S(t,n)<=t.length-n}function l(t,n){if(b(t,n)){var x=O(t,n);if(n+x>=t.length)return!1;var E=S(t,n);if(E<=x)return!1;var g=n+E;return g===t.length||b(t,g)}return!1}function r(t,n,x,E,g){if(!t.samplerate){var y=j(n,x,E,g);if(!y)return;t.config=y.config,t.samplerate=y.samplerate,t.channelCount=y.channelCount,t.codec=y.codec,t.manifestCodec=y.manifestCodec,H.logger.log("parsed codec:"+t.codec+", rate:"+y.samplerate+", channels:"+y.channelCount)}}function s(t){return 1024*9e4/t}function a(t,n,x,E,g){var y=O(t,n),v=S(t,n);if(v-=y,v>0){var d=x+E*g;return{headerLength:y,frameLength:v,stamp:d}}}function e(t,n,x,E,g){var y=s(t.samplerate),v=a(n,x,E,g,y);if(v){var d=v.frameLength,u=v.headerLength,i=v.stamp,o=u+d,p=Math.max(0,x+o-n.length),f;p?(f=new Uint8Array(o-u),f.set(n.subarray(x+u,n.length),0)):f=n.subarray(x+u,x+o);var c={unit:f,pts:i};return p||t.samples.push(c),{sample:c,length:o,missing:p}}}},"./src/demux/base-audio-demuxer.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"initPTSFn",function(){return S});var H=I("./src/polyfills/number.ts"),L=I("./src/demux/id3.ts"),C=I("./src/demux/dummy-demuxed-track.ts"),j=I("./src/utils/mp4-tools.ts"),U=I("./src/utils/typed-array.ts"),O=function(){function _(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var b=_.prototype;return b.resetInitSegment=function(l,r,s){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},b.resetTimeStamp=function(){},b.resetContiguity=function(){},b.canParse=function(l,r){return!1},b.appendFrame=function(l,r,s){},b.demux=function(l,r){this.cachedData&&(l=Object(j.appendUint8Array)(this.cachedData,l),this.cachedData=null);var s=L.getID3Data(l,0),a=s?s.length:0,e,t,n=this._audioTrack,x=this._id3Track,E=s?L.getTimeStamp(s):void 0,g=l.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=S(E,r)),s&&s.length>0&&x.samples.push({pts:this.initPTS,dts:this.initPTS,data:s}),t=this.initPTS;a<g;){if(this.canParse(l,a)){var y=this.appendFrame(n,l,a);y?(this.frameIndex++,t=y.sample.pts,a+=y.length,e=a):a=g}else L.canParse(l,a)?(s=L.getID3Data(l,a),x.samples.push({pts:t,dts:t,data:s}),a+=s.length,e=a):a++;if(a===g&&e!==g){var v=Object(U.sliceUint8)(l,e);this.cachedData?this.cachedData=Object(j.appendUint8Array)(this.cachedData,v):this.cachedData=v}}return{audioTrack:n,avcTrack:Object(C.dummyTrack)(),id3Track:x,textTrack:Object(C.dummyTrack)()}},b.demuxSampleAes=function(l,r,s){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},b.flush=function(l){var r=this.cachedData;return r&&(this.cachedData=null,this.demux(r,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(C.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(C.dummyTrack)()}},b.destroy=function(){},_}(),S=function(b,h){return Object(H.isFiniteNumber)(b)?b*90:h*9e4};W.default=O},"./src/demux/chunk-cache.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"default",function(){return H});var H=function(){function C(){this.chunks=[],this.dataLength=0}var j=C.prototype;return j.push=function(O){this.chunks.push(O),this.dataLength+=O.length},j.flush=function(){var O=this.chunks,S=this.dataLength,_;if(O.length)O.length===1?_=O[0]:_=L(O,S);else return new Uint8Array(0);return this.reset(),_},j.reset=function(){this.chunks.length=0,this.dataLength=0},C}();function L(C,j){for(var U=new Uint8Array(j),O=0,S=0;S<C.length;S++){var _=C[S];U.set(_,O),O+=_.length}return U}},"./src/demux/dummy-demuxed-track.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"dummyTrack",function(){return H});function H(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(re,W,I){"use strict";I.r(W);var H=I("./src/utils/logger.ts"),L=function(){function C(U){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=U,this.bytesAvailable=U.byteLength,this.word=0,this.bitsAvailable=0}var j=C.prototype;return j.loadWord=function(){var O=this.data,S=this.bytesAvailable,_=O.byteLength-S,b=new Uint8Array(4),h=Math.min(4,S);if(h===0)throw new Error("no bytes available");b.set(O.subarray(_,_+h)),this.word=new DataView(b.buffer).getUint32(0),this.bitsAvailable=h*8,this.bytesAvailable-=h},j.skipBits=function(O){var S;this.bitsAvailable>O?(this.word<<=O,this.bitsAvailable-=O):(O-=this.bitsAvailable,S=O>>3,O-=S>>3,this.bytesAvailable-=S,this.loadWord(),this.word<<=O,this.bitsAvailable-=O)},j.readBits=function(O){var S=Math.min(this.bitsAvailable,O),_=this.word>>>32-S;return O>32&&H.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=S,this.bitsAvailable>0?this.word<<=S:this.bytesAvailable>0&&this.loadWord(),S=O-S,S>0&&this.bitsAvailable?_<<S|this.readBits(S):_},j.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()},j.skipUEG=function(){this.skipBits(1+this.skipLZ())},j.skipEG=function(){this.skipBits(1+this.skipLZ())},j.readUEG=function(){var O=this.skipLZ();return this.readBits(O+1)-1},j.readEG=function(){var O=this.readUEG();return 1&O?1+O>>>1:-1*(O>>>1)},j.readBoolean=function(){return this.readBits(1)===1},j.readUByte=function(){return this.readBits(8)},j.readUShort=function(){return this.readBits(16)},j.readUInt=function(){return this.readBits(32)},j.skipScalingList=function(O){for(var S=8,_=8,b,h=0;h<O;h++)_!==0&&(b=this.readEG(),_=(S+b+256)%256),S=_===0?S:_},j.readSPS=function(){var O=0,S=0,_=0,b=0,h,l,r,s=this.readUByte.bind(this),a=this.readBits.bind(this),e=this.readUEG.bind(this),t=this.readBoolean.bind(this),n=this.skipBits.bind(this),x=this.skipEG.bind(this),E=this.skipUEG.bind(this),g=this.skipScalingList.bind(this);s();var y=s();if(a(5),n(3),s(),E(),y===100||y===110||y===122||y===244||y===44||y===83||y===86||y===118||y===128){var v=e();if(v===3&&n(1),E(),E(),n(1),t())for(l=v!==3?8:12,r=0;r<l;r++)t()&&(r<6?g(16):g(64))}E();var d=e();if(d===0)e();else if(d===1)for(n(1),x(),x(),h=e(),r=0;r<h;r++)x();E(),n(1);var u=e(),i=e(),o=a(1);o===0&&n(1),n(1),t()&&(O=e(),S=e(),_=e(),b=e());var p=[1,1];if(t()&&t()){var f=s();switch(f){case 1:p=[1,1];break;case 2:p=[12,11];break;case 3:p=[10,11];break;case 4:p=[16,11];break;case 5:p=[40,33];break;case 6:p=[24,11];break;case 7:p=[20,11];break;case 8:p=[32,11];break;case 9:p=[80,33];break;case 10:p=[18,11];break;case 11:p=[15,11];break;case 12:p=[64,33];break;case 13:p=[160,99];break;case 14:p=[4,3];break;case 15:p=[3,2];break;case 16:p=[2,1];break;case 255:{p=[s()<<8|s(),s()<<8|s()];break}}}return{width:Math.ceil((u+1)*16-O*2-S*2),height:(2-o)*(i+1)*16-(o?2:4)*(_+b),pixelRatio:p}},j.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},C}();W.default=L},"./src/demux/id3.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"isHeader",function(){return H}),I.d(W,"isFooter",function(){return L}),I.d(W,"getID3Data",function(){return C}),I.d(W,"canParse",function(){return U}),I.d(W,"getTimeStamp",function(){return O}),I.d(W,"isTimeStampFrame",function(){return S}),I.d(W,"getID3Frames",function(){return b}),I.d(W,"decodeFrame",function(){return h}),I.d(W,"utf8ArrayToStr",function(){return e}),I.d(W,"testables",function(){return t});var H=function(g,y){return y+10<=g.length&&(g[y]===73&&g[y+1]===68&&g[y+2]===51&&(g[y+3]<255&&g[y+4]<255&&(g[y+6]<128&&g[y+7]<128&&g[y+8]<128&&g[y+9]<128)))},L=function(g,y){return y+10<=g.length&&(g[y]===51&&g[y+1]===68&&g[y+2]===73&&(g[y+3]<255&&g[y+4]<255&&(g[y+6]<128&&g[y+7]<128&&g[y+8]<128&&g[y+9]<128)))},C=function(g,y){for(var v=y,d=0;H(g,y);){d+=10;var u=j(g,y+6);d+=u,L(g,y+10)&&(d+=10),y+=d}return d>0?g.subarray(v,v+d):void 0},j=function(g,y){var v=0;return v=(g[y]&127)<<21,v|=(g[y+1]&127)<<14,v|=(g[y+2]&127)<<7,v|=g[y+3]&127,v},U=function(g,y){return H(g,y)&&j(g,y+6)+10<=g.length-y},O=function(g){for(var y=b(g),v=0;v<y.length;v++){var d=y[v];if(S(d))return a(d)}return},S=function(g){return g&&g.key==="PRIV"&&g.info==="com.apple.streaming.transportStreamTimestamp"},_=function(g){var y=String.fromCharCode(g[0],g[1],g[2],g[3]),v=j(g,4),d=10;return{type:y,size:v,data:g.subarray(d,d+v)}},b=function(g){for(var y=0,v=[];H(g,y);){var d=j(g,y+6);y+=10;for(var u=y+d;y+8<u;){var i=_(g.subarray(y)),o=h(i);o&&v.push(o),y+=i.size+10}L(g,y)&&(y+=10)}return v},h=function(g){return g.type==="PRIV"?l(g):g.type[0]==="W"?s(g):r(g)},l=function(g){if(g.size<2)return;var y=e(g.data,!0),v=new Uint8Array(g.data.subarray(y.length+1));return{key:g.type,info:y,data:v.buffer}},r=function(g){if(g.size<2)return;if(g.type==="TXXX"){var y=1,v=e(g.data.subarray(y),!0);y+=v.length+1;var d=e(g.data.subarray(y));return{key:g.type,info:v,data:d}}var u=e(g.data.subarray(1));return{key:g.type,data:u}},s=function(g){if(g.type==="WXXX"){if(g.size<2)return;var y=1,v=e(g.data.subarray(y),!0);y+=v.length+1;var d=e(g.data.subarray(y));return{key:g.type,info:v,data:d}}var u=e(g.data);return{key:g.type,data:u}},a=function(g){if(g.data.byteLength===8){var y=new Uint8Array(g.data),v=y[3]&1,d=(y[4]<<23)+(y[5]<<15)+(y[6]<<7)+y[7];return d/=45,v&&(d+=4772185884e-2),Math.round(d)}return},e=function(g,y){y===void 0&&(y=!1);var v=x();if(v){var d=v.decode(g);if(y){var u=d.indexOf("\0");return u!==-1?d.substring(0,u):d}return d.replace(/\0/g,"")}for(var i=g.length,o,p,f,c="",w=0;w<i;){if(o=g[w++],o===0&&y)return c;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:c+=String.fromCharCode(o);break;case 12:case 13:p=g[w++],c+=String.fromCharCode((o&31)<<6|p&63);break;case 14:p=g[w++],f=g[w++],c+=String.fromCharCode((o&15)<<12|(p&63)<<6|(f&63)<<0);break;default:}}return c},t={decodeTextFrame:r},n;function x(){return!n&&typeof self.TextDecoder!="undefined"&&(n=new self.TextDecoder("utf-8")),n}},"./src/demux/mp3demuxer.ts":function(re,W,I){"use strict";I.r(W);var H=I("./src/demux/base-audio-demuxer.ts"),L=I("./src/demux/id3.ts"),C=I("./src/utils/logger.ts"),j=I("./src/demux/mpegaudio.ts");function U(_,b){_.prototype=Object.create(b.prototype),_.prototype.constructor=_,O(_,b)}function O(_,b){return O=Object.setPrototypeOf||function(l,r){return l.__proto__=r,l},O(_,b)}var S=function(_){U(b,_);function b(){return _.apply(this,arguments)||this}var h=b.prototype;return h.resetInitSegment=function(r,s,a){_.prototype.resetInitSegment.call(this,r,s,a),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:r,duration:a,inputTimeScale:9e4,dropped:0}},b.probe=function(r){if(!r)return!1;for(var s=L.getID3Data(r,0)||[],a=s.length,e=r.length;a<e;a++)if(j.probe(r,a))return C.logger.log("MPEG Audio sync word found !"),!0;return!1},h.canParse=function(r,s){return j.canParse(r,s)},h.appendFrame=function(r,s,a){return this.initPTS===null?void 0:j.appendFrame(r,s,a,this.initPTS,this.frameIndex)},b}(H.default);S.minProbeByteLength=4,W.default=S},"./src/demux/mp4demuxer.ts":function(re,W,I){"use strict";I.r(W);var H=I("./src/utils/mp4-tools.ts"),L=I("./src/demux/dummy-demuxed-track.ts"),C=function(){function j(O,S){this.remainderData=null,this.config=void 0,this.config=S}var U=j.prototype;return U.resetTimeStamp=function(){},U.resetInitSegment=function(){},U.resetContiguity=function(){},j.probe=function(S){return Object(H.findBox)({data:S,start:0,end:Math.min(S.length,16384)},["moof"]).length>0},U.demux=function(S){var _=S,b=Object(L.dummyTrack)();if(this.config.progressive){this.remainderData&&(_=Object(H.appendUint8Array)(this.remainderData,S));var h=Object(H.segmentValidRange)(_);this.remainderData=h.remainder,b.samples=h.valid||new Uint8Array}else b.samples=_;return{audioTrack:Object(L.dummyTrack)(),avcTrack:b,id3Track:Object(L.dummyTrack)(),textTrack:Object(L.dummyTrack)()}},U.flush=function(){var S=Object(L.dummyTrack)();return S.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(L.dummyTrack)(),avcTrack:S,id3Track:Object(L.dummyTrack)(),textTrack:Object(L.dummyTrack)()}},U.demuxSampleAes=function(S,_,b){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},U.destroy=function(){},j}();C.minProbeByteLength=1024,W.default=C},"./src/demux/mpegaudio.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"appendFrame",function(){return O}),I.d(W,"parseHeader",function(){return S}),I.d(W,"isHeaderPattern",function(){return _}),I.d(W,"isHeader",function(){return b}),I.d(W,"canParse",function(){return h}),I.d(W,"probe",function(){return l});var H=null,L=[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],C=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],j=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],U=[0,1,1,4];function O(r,s,a,e,t){if(a+24>s.length)return;var n=S(s,a);if(n&&a+n.frameLength<=s.length){var x=n.samplesPerFrame*9e4/n.sampleRate,E=e+t*x,g={unit:s.subarray(a,a+n.frameLength),pts:E,dts:E};return r.config=[],r.channelCount=n.channelCount,r.samplerate=n.sampleRate,r.samples.push(g),{sample:g,length:n.frameLength,missing:0}}}function S(r,s){var a=r[s+1]>>3&3,e=r[s+1]>>1&3,t=r[s+2]>>4&15,n=r[s+2]>>2&3;if(a!==1&&t!==0&&t!==15&&n!==3){var x=r[s+2]>>1&1,E=r[s+3]>>6,g=a===3?3-e:e===3?3:4,y=L[g*14+t-1]*1e3,v=a===3?0:a===2?1:2,d=C[v*3+n],u=E===3?1:2,i=j[a][e],o=U[e],p=i*8*o,f=Math.floor(i*y/d+x)*o;if(H===null){var c=navigator.userAgent||"",w=c.match(/Chrome\/(\d+)/i);H=w?parseInt(w[1]):0}var A=!!H&&H<=87;return A&&e===2&&y>=224e3&&E===0&&(r[s+3]=r[s+3]|128),{sampleRate:d,channelCount:u,frameLength:f,samplesPerFrame:p}}}function _(r,s){return r[s]===255&&(r[s+1]&224)===224&&(r[s+1]&6)!==0}function b(r,s){return s+1<r.length&&_(r,s)}function h(r,s){var a=4;return _(r,s)&&a<=r.length-s}function l(r,s){if(s+1<r.length&&_(r,s)){var a=4,e=S(r,s),t=a;e!=null&&e.frameLength&&(t=e.frameLength);var n=s+t;return n===r.length||b(r,n)}return!1}},"./src/demux/sample-aes.ts":function(re,W,I){"use strict";I.r(W);var H=I("./src/crypt/decrypter.ts"),L=I("./src/demux/tsdemuxer.ts"),C=function(){function j(O,S,_){this.keyData=void 0,this.decrypter=void 0,this.keyData=_,this.decrypter=new H.default(O,S,{removePKCS7Padding:!1})}var U=j.prototype;return U.decryptBuffer=function(S,_){this.decrypter.decrypt(S,this.keyData.key.buffer,this.keyData.iv.buffer,_)},U.decryptAacSample=function(S,_,b,h){var l=S[_].unit,r=l.subarray(16,l.length-l.length%16),s=r.buffer.slice(r.byteOffset,r.byteOffset+r.length),a=this;this.decryptBuffer(s,function(e){var t=new Uint8Array(e);l.set(t,16),h||a.decryptAacSamples(S,_+1,b)})},U.decryptAacSamples=function(S,_,b){for(;;_++){if(_>=S.length){b();return}if(S[_].unit.length<32)continue;var h=this.decrypter.isSync();if(this.decryptAacSample(S,_,b,h),!h)return}},U.getAvcEncryptedData=function(S){for(var _=Math.floor((S.length-48)/160)*16+16,b=new Int8Array(_),h=0,l=32;l<=S.length-16;l+=160,h+=16)b.set(S.subarray(l,l+16),h);return b},U.getAvcDecryptedUnit=function(S,_){for(var b=new Uint8Array(_),h=0,l=32;l<=S.length-16;l+=160,h+=16)S.set(b.subarray(h,h+16),l);return S},U.decryptAvcSample=function(S,_,b,h,l,r){var s=Object(L.discardEPB)(l.data),a=this.getAvcEncryptedData(s),e=this;this.decryptBuffer(a.buffer,function(t){l.data=e.getAvcDecryptedUnit(s,t),r||e.decryptAvcSamples(S,_,b+1,h)})},U.decryptAvcSamples=function(S,_,b,h){if(S instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;_++,b=0){if(_>=S.length){h();return}for(var l=S[_].units;!(b>=l.length);b++){var r=l[b];if(r.data.length<=48||r.type!==1&&r.type!==5)continue;var s=this.decrypter.isSync();if(this.decryptAvcSample(S,_,b,h,r,s),!s)return}}},j}();W.default=C},"./src/demux/transmuxer-interface.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"default",function(){return l});var H=I("./node_modules/webworkify-webpack/index.js"),L=I.n(H),C=I("./src/events.ts"),j=I("./src/demux/transmuxer.ts"),U=I("./src/utils/logger.ts"),O=I("./src/errors.ts"),S=I("./src/utils/mediasource-helper.ts"),_=I("./node_modules/eventemitter3/index.js"),b=I.n(_),h=Object(S.getMediaSource)()||{isTypeSupported:function(){return!1}},l=function(){function r(a,e,t,n){var x=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=a,this.id=e,this.onTransmuxComplete=t,this.onFlush=n;var E=a.config,g=function(i,o){o=o||{},o.frag=x.frag,o.id=x.id,a.trigger(i,o)};this.observer=new _.EventEmitter,this.observer.on(C.Events.FRAG_DECRYPTED,g),this.observer.on(C.Events.ERROR,g);var y={mp4:h.isTypeSupported("video/mp4"),mpeg:h.isTypeSupported("audio/mpeg"),mp3:h.isTypeSupported('audio/mp4; codecs="mp3"')},v=navigator.vendor;if(E.enableWorker&&typeof Worker!="undefined"){U.logger.log("demuxing in webworker");var d;try{d=this.worker=H("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),d.addEventListener("message",this.onwmsg),d.onerror=function(u){a.trigger(C.Events.ERROR,{type:O.ErrorTypes.OTHER_ERROR,details:O.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(u.message+" ("+u.filename+":"+u.lineno+")")})},d.postMessage({cmd:"init",typeSupported:y,vendor:v,id:e,config:JSON.stringify(E)})}catch(u){U.logger.warn("Error in worker:",u),U.logger.error("Error while initializing DemuxerWorker, fallback to inline"),d&&self.URL.revokeObjectURL(d.objectURL),this.transmuxer=new j.default(this.observer,y,E,v,e),this.worker=null}}else this.transmuxer=new j.default(this.observer,y,E,v,e)}var s=r.prototype;return s.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},s.push=function(e,t,n,x,E,g,y,v,d,u){var i=this;d.transmuxing.start=self.performance.now();var o=this.transmuxer,p=this.worker,f=g?g.start:E.start,c=E.decryptdata,w=this.frag,A=!(w&&E.cc===w.cc),P=!(w&&d.level===w.level),N=w?d.sn-w.sn:-1,B=this.part?d.part-this.part.index:1,R=!P&&(N===1||N===0&&B===1),F=self.performance.now();(P||N||E.stats.parsing.start===0)&&(E.stats.parsing.start=F),g&&(B||!R)&&(g.stats.parsing.start=F);var K=new j.TransmuxState(A,R,v,P,f);if(!R||A){U.logger.log("[transmuxer-interface, "+E.type+"]: Starting new transmux session for sn: "+d.sn+" p: "+d.part+" level: "+d.level+" id: "+d.id+`
|
|
discontinuity: `+A+`
|
|
trackSwitch: `+P+`
|
|
contiguous: `+R+`
|
|
accurateTimeOffset: `+v+`
|
|
timeOffset: `+f);var X=new j.TransmuxConfig(n,x,t,y,u);this.configureTransmuxer(X)}if(this.frag=E,this.part=g,p)p.postMessage({cmd:"demux",data:e,decryptdata:c,chunkMeta:d,state:K},e instanceof ArrayBuffer?[e]:[]);else if(o){var ee=o.push(e,c,d,K);Object(j.isPromise)(ee)?ee.then(function(oe){i.handleTransmuxComplete(oe)}):this.handleTransmuxComplete(ee)}},s.flush=function(e){var t=this;e.transmuxing.start=self.performance.now();var n=this.transmuxer,x=this.worker;if(x)x.postMessage({cmd:"flush",chunkMeta:e});else if(n){var E=n.flush(e);Object(j.isPromise)(E)?E.then(function(g){t.handleFlushResult(g,e)}):this.handleFlushResult(E,e)}},s.handleFlushResult=function(e,t){var n=this;e.forEach(function(x){n.handleTransmuxComplete(x)}),this.onFlush(t)},s.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}}},s.configureTransmuxer=function(e){var t=this.worker,n=this.transmuxer;t?t.postMessage({cmd:"configure",config:e}):n&&n.configure(e)},s.handleTransmuxComplete=function(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)},r}()},"./src/demux/transmuxer-worker.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"default",function(){return O});var H=I("./src/demux/transmuxer.ts"),L=I("./src/events.ts"),C=I("./src/utils/logger.ts"),j=I("./node_modules/eventemitter3/index.js"),U=I.n(j);function O(l){var r=new j.EventEmitter,s=function(e,t){l.postMessage({event:e,data:t})};r.on(L.Events.FRAG_DECRYPTED,s),r.on(L.Events.ERROR,s),l.addEventListener("message",function(a){var e=a.data;switch(e.cmd){case"init":{var t=JSON.parse(e.config);l.transmuxer=new H.default(r,e.typeSupported,t,e.vendor,e.id),Object(C.enableLogs)(t.debug),s("init",null);break}case"configure":{l.transmuxer.configure(e.config);break}case"demux":{var n=l.transmuxer.push(e.data,e.decryptdata,e.chunkMeta,e.state);Object(H.isPromise)(n)?n.then(function(g){S(l,g)}):S(l,n);break}case"flush":{var x=e.chunkMeta,E=l.transmuxer.flush(x);Object(H.isPromise)(E)?E.then(function(g){b(l,g,x)}):b(l,E,x);break}default:break}})}function S(l,r){if(h(r.remuxResult))return;var s=[],a=r.remuxResult,e=a.audio,t=a.video;e&&_(s,e),t&&_(s,t),l.postMessage({event:"transmuxComplete",data:r},s)}function _(l,r){r.data1&&l.push(r.data1.buffer),r.data2&&l.push(r.data2.buffer)}function b(l,r,s){r.forEach(function(a){S(l,a)}),l.postMessage({event:"flush",data:s})}function h(l){return!l.audio&&!l.video&&!l.text&&!l.id3&&!l.initSegment}},"./src/demux/transmuxer.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"default",function(){return t}),I.d(W,"isPromise",function(){return E}),I.d(W,"TransmuxConfig",function(){return g}),I.d(W,"TransmuxState",function(){return y});var H=I("./src/events.ts"),L=I("./src/errors.ts"),C=I("./src/crypt/decrypter.ts"),j=I("./src/demux/aacdemuxer.ts"),U=I("./src/demux/mp4demuxer.ts"),O=I("./src/demux/tsdemuxer.ts"),S=I("./src/demux/mp3demuxer.ts"),_=I("./src/remux/mp4-remuxer.ts"),b=I("./src/remux/passthrough-remuxer.ts"),h=I("./src/demux/chunk-cache.ts"),l=I("./src/utils/mp4-tools.ts"),r=I("./src/utils/logger.ts"),s;try{s=self.performance.now.bind(self.performance)}catch(v){r.logger.debug("Unable to use Performance API on this environment"),s=self.Date.now}var a=[{demux:O.default,remux:_.default},{demux:U.default,remux:b.default},{demux:j.default,remux:_.default},{demux:S.default,remux:_.default}],e=1024;a.forEach(function(v){var d=v.demux;e=Math.max(e,d.minProbeByteLength)});var t=function(){function v(u,i,o,p,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 h.default,this.observer=u,this.typeSupported=i,this.config=o,this.vendor=p,this.id=f}var d=v.prototype;return d.configure=function(i){this.transmuxConfig=i,this.decrypter&&this.decrypter.reset()},d.push=function(i,o,p,f){var c=this,w=p.transmuxing;w.executeStart=s();var A=new Uint8Array(i),P=this.cache,N=this.config,B=this.currentTransmuxState,R=this.transmuxConfig;f&&(this.currentTransmuxState=f);var F=n(A,o);if(F&&F.method==="AES-128"){var K=this.getDecrypter();if(N.enableSoftwareAES){var X=K.softwareDecrypt(A,F.key.buffer,F.iv.buffer);if(!X)return w.executeEnd=s(),x(p);A=new Uint8Array(X)}else return this.decryptionPromise=K.webCryptoDecrypt(A,F.key.buffer,F.iv.buffer).then(function(Ie){var Ae=c.push(Ie,null,p);return c.decryptionPromise=null,Ae}),this.decryptionPromise}var ee=f||B,oe=ee.contiguous,ce=ee.discontinuity,le=ee.trackSwitch,be=ee.accurateTimeOffset,pe=ee.timeOffset,de=R.audioCodec,te=R.videoCodec,Le=R.defaultInitPts,Ve=R.duration,Ne=R.initSegmentData;if((ce||le)&&this.resetInitSegment(Ne,de,te,Ve),ce&&this.resetInitialTimestamp(Le),oe||this.resetContiguity(),this.needsProbing(A,ce,le)){if(P.dataLength){var Be=P.flush();A=Object(l.appendUint8Array)(Be,A)}this.configureTransmuxer(A,R)}var ve=this.transmux(A,F,pe,be,p),ye=this.currentTransmuxState;return ye.contiguous=!0,ye.discontinuity=!1,ye.trackSwitch=!1,w.executeEnd=s(),ve},d.flush=function(i){var o=this,p=i.transmuxing;p.executeStart=s();var f=this.decrypter,c=this.cache,w=this.currentTransmuxState,A=this.decryptionPromise;if(A)return A.then(function(){return o.flush(i)});var P=[],N=w.timeOffset;if(f){var B=f.flush();B&&P.push(this.push(B,null,i))}var R=c.dataLength;c.reset();var F=this.demuxer,K=this.remuxer;if(!F||!K)return R>=e&&this.observer.emit(H.Events.ERROR,H.Events.ERROR,{type:L.ErrorTypes.MEDIA_ERROR,details:L.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),p.executeEnd=s(),[x(i)];var X=F.flush(N);return E(X)?X.then(function(ee){return o.flushRemux(P,ee,i),P}):(this.flushRemux(P,X,i),P)},d.flushRemux=function(i,o,p){var f=o.audioTrack,c=o.avcTrack,w=o.id3Track,A=o.textTrack,P=this.currentTransmuxState,N=P.accurateTimeOffset,B=P.timeOffset;r.logger.log("[transmuxer.ts]: Flushed fragment "+p.sn+(p.part>-1?" p: "+p.part:"")+" of level "+p.level);var R=this.remuxer.remux(f,c,w,A,B,N,!0,this.id);i.push({remuxResult:R,chunkMeta:p}),p.transmuxing.executeEnd=s()},d.resetInitialTimestamp=function(i){var o=this.demuxer,p=this.remuxer;if(!o||!p)return;o.resetTimeStamp(i),p.resetTimeStamp(i)},d.resetContiguity=function(){var i=this.demuxer,o=this.remuxer;if(!i||!o)return;i.resetContiguity(),o.resetNextTimestamp()},d.resetInitSegment=function(i,o,p,f){var c=this.demuxer,w=this.remuxer;if(!c||!w)return;c.resetInitSegment(o,p,f),w.resetInitSegment(i,o,p)},d.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},d.transmux=function(i,o,p,f,c){var w;return o&&o.method==="SAMPLE-AES"?w=this.transmuxSampleAes(i,o,p,f,c):w=this.transmuxUnencrypted(i,p,f,c),w},d.transmuxUnencrypted=function(i,o,p,f){var c=this.demuxer.demux(i,o,!1,!this.config.progressive),w=c.audioTrack,A=c.avcTrack,P=c.id3Track,N=c.textTrack,B=this.remuxer.remux(w,A,P,N,o,p,!1,this.id);return{remuxResult:B,chunkMeta:f}},d.transmuxSampleAes=function(i,o,p,f,c){var w=this;return this.demuxer.demuxSampleAes(i,o,p).then(function(A){var P=w.remuxer.remux(A.audioTrack,A.avcTrack,A.id3Track,A.textTrack,p,f,!1,w.id);return{remuxResult:P,chunkMeta:c}})},d.configureTransmuxer=function(i,o){for(var p=this.config,f=this.observer,c=this.typeSupported,w=this.vendor,A=o.audioCodec,P=o.defaultInitPts,N=o.duration,B=o.initSegmentData,R=o.videoCodec,F,K=0,X=a.length;K<X;K++)if(a[K].demux.probe(i)){F=a[K];break}F||(r.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),F={demux:U.default,remux:b.default});var ee=this.demuxer,oe=this.remuxer,ce=F.remux,le=F.demux;(!oe||!(oe instanceof ce))&&(this.remuxer=new ce(f,p,c,w)),(!ee||!(ee instanceof le))&&(this.demuxer=new le(f,p,c),this.probe=le.probe),this.resetInitSegment(B,A,R,N),this.resetInitialTimestamp(P)},d.needsProbing=function(i,o,p){return!this.demuxer||!this.remuxer||o||p},d.getDecrypter=function(){var i=this.decrypter;return i||(i=this.decrypter=new C.default(this.observer,this.config)),i},v}();function n(v,d){var u=null;return v.byteLength>0&&d!=null&&d.key!=null&&d.iv!==null&&d.method!=null&&(u=d),u}var x=function(d){return{remuxResult:{},chunkMeta:d}};function E(v){return"then"in v&&v.then instanceof Function}var g=function(d,u,i,o,p){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=d,this.videoCodec=u,this.initSegmentData=i,this.duration=o,this.defaultInitPts=p},y=function(d,u,i,o,p){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=d,this.contiguous=u,this.accurateTimeOffset=i,this.trackSwitch=o,this.timeOffset=p}},"./src/demux/tsdemuxer.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"discardEPB",function(){return x});var H=I("./src/demux/adts.ts"),L=I("./src/demux/mpegaudio.ts"),C=I("./src/demux/exp-golomb.ts"),j=I("./src/demux/id3.ts"),U=I("./src/demux/sample-aes.ts"),O=I("./src/events.ts"),S=I("./src/utils/mp4-tools.ts"),_=I("./src/utils/logger.ts"),b=I("./src/errors.ts"),h={video:1,audio:2,id3:3,text:4},l=function(){function E(y,v,d){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=y,this.config=v,this.typeSupported=d}E.probe=function(v){var d=E.syncOffset(v);return d<0?!1:(d&&_.logger.warn("MPEG2-TS detected but first sync word found @ offset "+d+", junk ahead ?"),!0)},E.syncOffset=function(v){for(var d=Math.min(1e3,v.length-3*188),u=0;u<d;){if(v[u]===71&&v[u+188]===71&&v[u+2*188]===71)return u;u++}return-1},E.createTrack=function(v,d){return{container:v==="video"||v==="audio"?"video/mp2t":void 0,type:v,id:h[v],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:v==="audio"?d:void 0}};var g=E.prototype;return g.resetInitSegment=function(v,d,u){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=E.createTrack("video",u),this._audioTrack=E.createTrack("audio",u),this._id3Track=E.createTrack("id3",u),this._txtTrack=E.createTrack("text",u),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=v,this.videoCodec=d,this._duration=u},g.resetTimeStamp=function(){},g.resetContiguity=function(){var v=this._audioTrack,d=this._avcTrack,u=this._id3Track;v&&(v.pesData=null),d&&(d.pesData=null),u&&(u.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},g.demux=function(v,d,u,i){u===void 0&&(u=!1),i===void 0&&(i=!1),u||(this.sampleAes=null);var o,p=this._avcTrack,f=this._audioTrack,c=this._id3Track,w=p.pid,A=p.pesData,P=f.pid,N=c.pid,B=f.pesData,R=c.pesData,F=!1,K=this.pmtParsed,X=this._pmtId,ee=v.length;if(this.remainderData&&(v=Object(S.appendUint8Array)(this.remainderData,v),ee=v.length,this.remainderData=null),ee<188&&!i)return this.remainderData=v,{audioTrack:f,avcTrack:p,id3Track:c,textTrack:this._txtTrack};var oe=Math.max(0,E.syncOffset(v));ee-=(ee+oe)%188,ee<v.byteLength&&!i&&(this.remainderData=new Uint8Array(v.buffer,ee,v.buffer.byteLength-ee));for(var ce=oe;ce<ee;ce+=188)if(v[ce]===71){var le=!!(v[ce+1]&64),be=((v[ce+1]&31)<<8)+v[ce+2],pe=(v[ce+3]&48)>>4,de=void 0;if(pe>1){if(de=ce+5+v[ce+4],de===ce+188)continue}else de=ce+4;switch(be){case w:le&&(A&&(o=e(A))&&this.parseAVCPES(o,!1),A={data:[],size:0}),A&&(A.data.push(v.subarray(de,ce+188)),A.size+=ce+188-de);break;case P:le&&(B&&(o=e(B))&&(f.isAAC?this.parseAACPES(o):this.parseMPEGPES(o)),B={data:[],size:0}),B&&(B.data.push(v.subarray(de,ce+188)),B.size+=ce+188-de);break;case N:le&&(R&&(o=e(R))&&this.parseID3PES(o),R={data:[],size:0}),R&&(R.data.push(v.subarray(de,ce+188)),R.size+=ce+188-de);break;case 0:le&&(de+=v[de]+1),X=this._pmtId=s(v,de);break;case X:{le&&(de+=v[de]+1);var te=a(v,de,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,u);w=te.avc,w>0&&(p.pid=w),P=te.audio,P>0&&(f.pid=P,f.isAAC=te.isAAC),N=te.id3,N>0&&(c.pid=N),F&&!K&&(_.logger.log("reparse from beginning"),F=!1,ce=oe-188),K=this.pmtParsed=!0;break}case 17:case 8191:break;default:F=!0;break}}else this.observer.emit(O.Events.ERROR,O.Events.ERROR,{type:b.ErrorTypes.MEDIA_ERROR,details:b.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});p.pesData=A,f.pesData=B,c.pesData=R;var Le={audioTrack:f,avcTrack:p,id3Track:c,textTrack:this._txtTrack};return i&&this.extractRemainingSamples(Le),Le},g.flush=function(){var v=this.remainderData;this.remainderData=null;var d;return v?d=this.demux(v,-1,!1,!0):d={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(d),this.sampleAes?this.decrypt(d,this.sampleAes):d},g.extractRemainingSamples=function(v){var d=v.audioTrack,u=v.avcTrack,i=v.id3Track,o=u.pesData,p=d.pesData,f=i.pesData,c;o&&(c=e(o))?(this.parseAVCPES(c,!0),u.pesData=null):u.pesData=o,p&&(c=e(p))?(d.isAAC?this.parseAACPES(c):this.parseMPEGPES(c),d.pesData=null):(p!=null&&p.size&&_.logger.log("last AAC PES packet truncated,might overlap between fragments"),d.pesData=p),f&&(c=e(f))?(this.parseID3PES(c),i.pesData=null):i.pesData=f},g.demuxSampleAes=function(v,d,u){var i=this.demux(v,u,!0,!this.config.progressive),o=this.sampleAes=new U.default(this.observer,this.config,d);return this.decrypt(i,o)},g.decrypt=function(v,d){return new Promise(function(u){var i=v.audioTrack,o=v.avcTrack;i.samples&&i.isAAC?d.decryptAacSamples(i.samples,0,function(){o.samples?d.decryptAvcSamples(o.samples,0,0,function(){u(v)}):u(v)}):o.samples&&d.decryptAvcSamples(o.samples,0,0,function(){u(v)})})},g.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},g.parseAVCPES=function(v,d){var u=this,i=this._avcTrack,o=this.parseAVCNALu(v.data),p=!1,f=this.avcSample,c,w=!1;v.data=null,f&&o.length&&!i.audFound&&(t(f,i),f=this.avcSample=r(!1,v.pts,v.dts,"")),o.forEach(function(A){switch(A.type){case 1:{c=!0,f||(f=u.avcSample=r(!0,v.pts,v.dts,"")),p&&(f.debug+="NDR "),f.frame=!0;var P=A.data;if(w&&P.length>4){var N=new C.default(P).readSliceType();(N===2||N===4||N===7||N===9)&&(f.key=!0)}break}case 5:c=!0,f||(f=u.avcSample=r(!0,v.pts,v.dts,"")),p&&(f.debug+="IDR "),f.key=!0,f.frame=!0;break;case 6:{c=!0,p&&f&&(f.debug+="SEI ");var B=new C.default(x(A.data));B.readUByte();for(var R=0,F=0,K=!1,X=0;!K&&B.bytesAvailable>1;){R=0;do X=B.readUByte(),R+=X;while(X===255);F=0;do X=B.readUByte(),F+=X;while(X===255);if(R===4&&B.bytesAvailable!==0){K=!0;var ee=B.readUByte();if(ee===181){var oe=B.readUShort();if(oe===49){var ce=B.readUInt();if(ce===1195456820){var le=B.readUByte();if(le===3){for(var be=B.readUByte(),pe=B.readUByte(),de=31&be,te=[be,pe],Le=0;Le<de;Le++)te.push(B.readUByte()),te.push(B.readUByte()),te.push(B.readUByte());n(u._txtTrack.samples,{type:3,pts:v.pts,bytes:te})}}}}}else if(R===5&&B.bytesAvailable!==0){if(K=!0,F>16){for(var Ve=[],Ne=0;Ne<16;Ne++)Ve.push(B.readUByte().toString(16)),(Ne===3||Ne===5||Ne===7||Ne===9)&&Ve.push("-");for(var Be=F-16,ve=new Uint8Array(Be),ye=0;ye<Be;ye++)ve[ye]=B.readUByte();n(u._txtTrack.samples,{pts:v.pts,payloadType:R,uuid:Ve.join(""),userData:Object(j.utf8ArrayToStr)(ve),userDataBytes:ve})}}else if(F<B.bytesAvailable)for(var Ie=0;Ie<F;Ie++)B.readUByte()}break}case 7:if(c=!0,w=!0,p&&f&&(f.debug+="SPS "),!i.sps){var Ae=new C.default(A.data),ge=Ae.readSPS();i.width=ge.width,i.height=ge.height,i.pixelRatio=ge.pixelRatio,i.sps=[A.data],i.duration=u._duration;for(var Ce=A.data.subarray(1,4),Oe="avc1.",Se=0;Se<3;Se++){var De=Ce[Se].toString(16);De.length<2&&(De="0"+De),Oe+=De}i.codec=Oe}break;case 8:c=!0,p&&f&&(f.debug+="PPS "),i.pps||(i.pps=[A.data]);break;case 9:c=!1,i.audFound=!0,f&&t(f,i),f=u.avcSample=r(!1,v.pts,v.dts,p?"AUD ":"");break;case 12:c=!1;break;default:c=!1,f&&(f.debug+="unknown NAL "+A.type+" ");break}if(f&&c){var je=f.units;je.push(A)}}),d&&f&&(t(f,i),this.avcSample=null)},g.getLastNalUnit=function(){var v,d=this.avcSample,u;if(!d||d.units.length===0){var i=this._avcTrack.samples;d=i[i.length-1]}if((v=d)!==null&&v!==void 0&&v.units){var o=d.units;u=o[o.length-1]}return u},g.parseAVCNALu=function(v){var d=v.byteLength,u=this._avcTrack,i=u.naluState||0,o=i,p=[],f=0,c,w,A,P=-1,N=0;for(i===-1&&(P=0,N=v[0]&31,i=0,f=1);f<d;){if(c=v[f++],!i){i=c?0:1;continue}if(i===1){i=c?0:2;continue}if(!c)i=3;else if(c===1){if(P>=0){var B={data:v.subarray(P,f-i-1),type:N};p.push(B)}else{var R=this.getLastNalUnit();if(R&&(o&&f<=4-o&&(R.state&&(R.data=R.data.subarray(0,R.data.byteLength-o))),w=f-i-1,w>0)){var F=new Uint8Array(R.data.byteLength+w);F.set(R.data,0),F.set(v.subarray(0,w),R.data.byteLength),R.data=F,R.state=0}}f<d?(A=v[f]&31,P=f,N=A,i=0):i=-1}else i=0}if(P>=0&&i>=0){var K={data:v.subarray(P,d),type:N,state:i};p.push(K)}if(p.length===0){var X=this.getLastNalUnit();if(X){var ee=new Uint8Array(X.data.byteLength+v.byteLength);ee.set(X.data,0),ee.set(v,X.data.byteLength),X.data=ee}}return u.naluState=i,p},g.parseAACPES=function(v){var d=0,u=this._audioTrack,i=this.aacOverFlow,o=v.data;if(i){this.aacOverFlow=null;var p=i.sample.unit.byteLength,f=Math.min(i.missing,p),c=p-f;i.sample.unit.set(o.subarray(0,f),c),u.samples.push(i.sample),d=i.missing}var w,A;for(w=d,A=o.length;w<A-1&&!H.isHeader(o,w);w++);if(w!==d){var P,N;if(w<A-1?(P="AAC PES did not start with ADTS header,offset:"+w,N=!1):(P="no ADTS header found in AAC PES",N=!0),_.logger.warn("parsing error:"+P),this.observer.emit(O.Events.ERROR,O.Events.ERROR,{type:b.ErrorTypes.MEDIA_ERROR,details:b.ErrorDetails.FRAG_PARSING_ERROR,fatal:N,reason:P}),N)return}H.initTrackConfig(u,this.observer,o,w,this.audioCodec);var B;if(v.pts!==void 0)B=v.pts;else if(i){var R=H.getFrameDuration(u.samplerate);B=i.sample.pts+R}else{_.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var F=0;w<A;)if(H.isHeader(o,w)){if(w+5<A){var K=H.appendFrame(u,o,w,B,F);if(K)if(K.missing)this.aacOverFlow=K;else{w+=K.length,F++;continue}}break}else w++},g.parseMPEGPES=function(v){var d=v.data,u=d.length,i=0,o=0,p=v.pts;if(p===void 0){_.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<u;)if(L.isHeader(d,o)){var f=L.appendFrame(this._audioTrack,d,o,p,i);if(f)o+=f.length,i++;else break}else o++},g.parseID3PES=function(v){if(v.pts===void 0){_.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(v)},E}();l.minProbeByteLength=188;function r(E,g,y,v){return{key:E,frame:!1,pts:g,dts:y,units:[],debug:v,length:0}}function s(E,g){return(E[g+10]&31)<<8|E[g+11]}function a(E,g,y,v){var d={audio:-1,avc:-1,id3:-1,isAAC:!0},u=(E[g+1]&15)<<8|E[g+2],i=g+3+u-4,o=(E[g+10]&15)<<8|E[g+11];for(g+=12+o;g<i;){var p=(E[g+1]&31)<<8|E[g+2];switch(E[g]){case 207:if(!v){_.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:d.audio===-1&&(d.audio=p);break;case 21:d.id3===-1&&(d.id3=p);break;case 219:if(!v){_.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:d.avc===-1&&(d.avc=p);break;case 3:case 4:y?d.audio===-1&&(d.audio=p,d.isAAC=!1):_.logger.log("MPEG audio found, not supported in this browser");break;case 36:_.logger.warn("Unsupported HEVC stream type found");break;default:break}g+=((E[g+3]&15)<<8|E[g+4])+5}return d}function e(E){var g=0,y,v,d,u,i,o=E.data;if(!E||E.size===0)return null;for(;o[0].length<19&&o.length>1;){var p=new Uint8Array(o[0].length+o[1].length);p.set(o[0]),p.set(o[1],o[0].length),o[0]=p,o.splice(1,1)}y=o[0];var f=(y[0]<<16)+(y[1]<<8)+y[2];if(f===1){if(v=(y[4]<<8)+y[5],v&&v>E.size-6)return null;var c=y[7];c&192&&(u=(y[9]&14)*536870912+(y[10]&255)*4194304+(y[11]&254)*16384+(y[12]&255)*128+(y[13]&254)/2,c&64?(i=(y[14]&14)*536870912+(y[15]&255)*4194304+(y[16]&254)*16384+(y[17]&255)*128+(y[18]&254)/2,u-i>60*9e4&&(_.logger.warn(Math.round((u-i)/9e4)+"s delta between PTS and DTS, align them"),u=i)):i=u),d=y[8];var w=d+9;if(E.size<=w)return null;E.size-=w;for(var A=new Uint8Array(E.size),P=0,N=o.length;P<N;P++){y=o[P];var B=y.byteLength;if(w)if(w>B){w-=B;continue}else y=y.subarray(w),B-=w,w=0;A.set(y,g),g+=B}return v&&(v-=d+3),{data:A,pts:u,dts:i,len:v}}return null}function t(E,g){if(E.units.length&&E.frame){if(E.pts===void 0){var y=g.samples,v=y.length;if(v){var d=y[v-1];E.pts=d.pts,E.dts=d.dts}else{g.dropped++;return}}g.samples.push(E)}E.debug.length&&_.logger.log(E.pts+"/"+E.dts+":"+E.debug)}function n(E,g){var y=E.length;if(y>0){if(g.pts>=E[y-1].pts)E.push(g);else for(var v=y-1;v>=0;v--)if(g.pts<E[v].pts){E.splice(v,0,g);break}}else E.push(g)}function x(E){for(var g=E.byteLength,y=[],v=1;v<g-2;)E[v]===0&&E[v+1]===0&&E[v+2]===3?(y.push(v+2),v+=2):v++;if(y.length===0)return E;var d=g-y.length,u=new Uint8Array(d),i=0;for(v=0;v<d;i++,v++)i===y[0]&&(i++,y.shift()),u[v]=E[i];return u}W.default=l},"./src/errors.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"ErrorTypes",function(){return H}),I.d(W,"ErrorDetails",function(){return L});var H;(function(C){C.NETWORK_ERROR="networkError",C.MEDIA_ERROR="mediaError",C.KEY_SYSTEM_ERROR="keySystemError",C.MUX_ERROR="muxError",C.OTHER_ERROR="otherError"})(H||(H={}));var L;(function(C){C.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",C.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",C.KEY_SYSTEM_NO_SESSION="keySystemNoSession",C.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",C.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",C.MANIFEST_LOAD_ERROR="manifestLoadError",C.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",C.MANIFEST_PARSING_ERROR="manifestParsingError",C.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",C.LEVEL_EMPTY_ERROR="levelEmptyError",C.LEVEL_LOAD_ERROR="levelLoadError",C.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",C.LEVEL_SWITCH_ERROR="levelSwitchError",C.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",C.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",C.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",C.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",C.FRAG_LOAD_ERROR="fragLoadError",C.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",C.FRAG_DECRYPT_ERROR="fragDecryptError",C.FRAG_PARSING_ERROR="fragParsingError",C.REMUX_ALLOC_ERROR="remuxAllocError",C.KEY_LOAD_ERROR="keyLoadError",C.KEY_LOAD_TIMEOUT="keyLoadTimeOut",C.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",C.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",C.BUFFER_APPEND_ERROR="bufferAppendError",C.BUFFER_APPENDING_ERROR="bufferAppendingError",C.BUFFER_STALLED_ERROR="bufferStalledError",C.BUFFER_FULL_ERROR="bufferFullError",C.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",C.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",C.INTERNAL_EXCEPTION="internalException",C.INTERNAL_ABORTED="aborted",C.UNKNOWN="unknown"})(L||(L={}))},"./src/events.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"Events",function(){return H});var H;(function(L){L.MEDIA_ATTACHING="hlsMediaAttaching",L.MEDIA_ATTACHED="hlsMediaAttached",L.MEDIA_DETACHING="hlsMediaDetaching",L.MEDIA_DETACHED="hlsMediaDetached",L.BUFFER_RESET="hlsBufferReset",L.BUFFER_CODECS="hlsBufferCodecs",L.BUFFER_CREATED="hlsBufferCreated",L.BUFFER_APPENDING="hlsBufferAppending",L.BUFFER_APPENDED="hlsBufferAppended",L.BUFFER_EOS="hlsBufferEos",L.BUFFER_FLUSHING="hlsBufferFlushing",L.BUFFER_FLUSHED="hlsBufferFlushed",L.MANIFEST_LOADING="hlsManifestLoading",L.MANIFEST_LOADED="hlsManifestLoaded",L.MANIFEST_PARSED="hlsManifestParsed",L.LEVEL_SWITCHING="hlsLevelSwitching",L.LEVEL_SWITCHED="hlsLevelSwitched",L.LEVEL_LOADING="hlsLevelLoading",L.LEVEL_LOADED="hlsLevelLoaded",L.LEVEL_UPDATED="hlsLevelUpdated",L.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",L.LEVELS_UPDATED="hlsLevelsUpdated",L.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",L.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",L.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",L.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",L.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",L.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",L.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",L.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",L.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",L.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",L.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",L.CUES_PARSED="hlsCuesParsed",L.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",L.INIT_PTS_FOUND="hlsInitPtsFound",L.FRAG_LOADING="hlsFragLoading",L.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",L.FRAG_LOADED="hlsFragLoaded",L.FRAG_DECRYPTED="hlsFragDecrypted",L.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",L.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",L.FRAG_PARSING_METADATA="hlsFragParsingMetadata",L.FRAG_PARSED="hlsFragParsed",L.FRAG_BUFFERED="hlsFragBuffered",L.FRAG_CHANGED="hlsFragChanged",L.FPS_DROP="hlsFpsDrop",L.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",L.ERROR="hlsError",L.DESTROYING="hlsDestroying",L.KEY_LOADING="hlsKeyLoading",L.KEY_LOADED="hlsKeyLoaded",L.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",L.BACK_BUFFER_REACHED="hlsBackBufferReached"})(H||(H={}))},"./src/hls.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"default",function(){return E});var H=I("./node_modules/url-toolkit/src/url-toolkit.js"),L=I.n(H),C=I("./src/loader/playlist-loader.ts"),j=I("./src/loader/key-loader.ts"),U=I("./src/controller/id3-track-controller.ts"),O=I("./src/controller/latency-controller.ts"),S=I("./src/controller/level-controller.ts"),_=I("./src/controller/fragment-tracker.ts"),b=I("./src/controller/stream-controller.ts"),h=I("./src/is-supported.ts"),l=I("./src/utils/logger.ts"),r=I("./src/config.ts"),s=I("./node_modules/eventemitter3/index.js"),a=I.n(s),e=I("./src/events.ts"),t=I("./src/errors.ts");function n(g,y){for(var v=0;v<y.length;v++){var d=y[v];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(g,d.key,d)}}function x(g,y,v){return y&&n(g.prototype,y),v&&n(g,v),g}var E=function(){g.isSupported=function(){return Object(h.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 s.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 d=this.config=Object(r.mergeConfig)(g.DefaultConfig,v);this.userConfig=v,Object(l.enableLogs)(d.debug),this._autoLevelCapping=-1,d.progressive&&Object(r.enableStreamingMode)(d);var u=d.abrController,i=d.bufferController,o=d.capLevelController,p=d.fpsController,f=this.abrController=new u(this),c=this.bufferController=new i(this),w=this.capLevelController=new o(this),A=new p(this),P=new C.default(this),N=new j.default(this),B=new U.default(this),R=this.levelController=new S.default(this),F=new _.FragmentTracker(this),K=this.streamController=new b.default(this,F);w.setStreamController(K),A.setStreamController(K);var X=[R,K];this.networkControllers=X;var ee=[P,N,f,c,w,A,B,F];this.audioTrackController=this.createController(d.audioTrackController,null,X),this.createController(d.audioStreamController,F,X),this.subtitleTrackController=this.createController(d.subtitleTrackController,null,X),this.createController(d.subtitleStreamController,F,X),this.createController(d.timelineController,null,ee),this.emeController=this.createController(d.emeController,null,ee),this.cmcdController=this.createController(d.cmcdController,null,ee),this.latencyController=this.createController(O.default,null,ee),this.coreComponents=ee}var y=g.prototype;return y.createController=function(d,u,i){if(d){var o=u?new d(this,u):new d(this);return i&&i.push(o),o}return null},y.on=function(d,u,i){i===void 0&&(i=this),this._emitter.on(d,u,i)},y.once=function(d,u,i){i===void 0&&(i=this),this._emitter.once(d,u,i)},y.removeAllListeners=function(d){this._emitter.removeAllListeners(d)},y.off=function(d,u,i,o){i===void 0&&(i=this),this._emitter.off(d,u,i,o)},y.listeners=function(d){return this._emitter.listeners(d)},y.emit=function(d,u,i){return this._emitter.emit(d,u,i)},y.trigger=function(d,u){if(this.config.debug)return this.emit(d,d,u);try{return this.emit(d,d,u)}catch(i){l.logger.error("An internal error happened while handling event "+d+'. Error message: "'+i.message+'". Here is a stacktrace:',i),this.trigger(e.Events.ERROR,{type:t.ErrorTypes.OTHER_ERROR,details:t.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:d,error:i})}return!1},y.listenerCount=function(d){return this._emitter.listenerCount(d)},y.destroy=function(){l.logger.log("destroy"),this.trigger(e.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(d){return d.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(d){return d.destroy()}),this.coreComponents.length=0},y.attachMedia=function(d){l.logger.log("attachMedia"),this._media=d,this.trigger(e.Events.MEDIA_ATTACHING,{media:d})},y.detachMedia=function(){l.logger.log("detachMedia"),this.trigger(e.Events.MEDIA_DETACHING,void 0),this._media=null},y.loadSource=function(d){this.stopLoad();var u=this.media,i=this.url,o=this.url=H.buildAbsoluteURL(self.location.href,d,{alwaysNormalize:!0});l.logger.log("loadSource:"+o),u&&i&&i!==o&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(u)),this.trigger(e.Events.MANIFEST_LOADING,{url:d})},y.startLoad=function(d){d===void 0&&(d=-1),l.logger.log("startLoad("+d+")"),this.networkControllers.forEach(function(u){u.startLoad(d)})},y.stopLoad=function(){l.logger.log("stopLoad"),this.networkControllers.forEach(function(d){d.stopLoad()})},y.swapAudioCodec=function(){l.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},y.recoverMediaError=function(){l.logger.log("recoverMediaError");var d=this._media;this.detachMedia(),d&&this.attachMedia(d)},y.removeLevel=function(d,u){u===void 0&&(u=0),this.levelController.removeLevel(d,u)},x(g,[{key:"levels",get:function(){var d=this.levelController.levels;return d||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(d){l.logger.log("set currentLevel:"+d),this.loadLevel=d,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(d){l.logger.log("set nextLevel:"+d),this.levelController.manualLevel=d,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(d){l.logger.log("set loadLevel:"+d),this.levelController.manualLevel=d}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(d){this.levelController.nextLoadLevel=d}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(d){l.logger.log("set firstLevel:"+d),this.levelController.firstLevel=d}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(d){l.logger.log("set startLevel:"+d),d!==-1&&(d=Math.max(d,this.minAutoLevel)),this.levelController.startLevel=d}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(d){var u=!!d;u!==this.config.capLevelToPlayerSize&&(u?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=u)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(d){this._autoLevelCapping!==d&&(l.logger.log("set autoLevelCapping:"+d),this._autoLevelCapping=d)}},{key:"bandwidthEstimate",get:function(){var d=this.abrController.bwEstimator;return d?d.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var d=this.levels,u=this.config.minAutoBitrate;if(!d)return 0;for(var i=d.length,o=0;o<i;o++)if(d[o].maxBitrate>u)return o;return 0}},{key:"maxAutoLevel",get:function(){var d=this.levels,u=this.autoLevelCapping,i;return u===-1&&d&&d.length?i=d.length-1:i=u,i}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(d){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,d)}},{key:"audioTracks",get:function(){var d=this.audioTrackController;return d?d.audioTracks:[]}},{key:"audioTrack",get:function(){var d=this.audioTrackController;return d?d.audioTrack:-1},set:function(d){var u=this.audioTrackController;u&&(u.audioTrack=d)}},{key:"subtitleTracks",get:function(){var d=this.subtitleTrackController;return d?d.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var d=this.subtitleTrackController;return d?d.subtitleTrack:-1},set:function(d){var u=this.subtitleTrackController;u&&(u.subtitleTrack=d)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var d=this.subtitleTrackController;return d?d.subtitleDisplay:!1},set:function(d){var u=this.subtitleTrackController;u&&(u.subtitleDisplay=d)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(d){this.config.lowLatencyMode=d}},{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:r.hlsDefaultConfig},set:function(d){g.defaultConfig=d}}]),g}();E.defaultConfig=void 0},"./src/is-supported.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"isSupported",function(){return C}),I.d(W,"changeTypeSupported",function(){return j});var H=I("./src/utils/mediasource-helper.ts");function L(){return self.SourceBuffer||self.WebKitSourceBuffer}function C(){var U=Object(H.getMediaSource)();if(!U)return!1;var O=L(),S=U&&typeof U.isTypeSupported=="function"&&U.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),_=!O||O.prototype&&typeof O.prototype.appendBuffer=="function"&&typeof O.prototype.remove=="function";return!!S&&!!_}function j(){var U,O=L();return typeof(O==null||((U=O.prototype)===null||U===void 0)?void 0:U.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"default",function(){return l}),I.d(W,"LoadError",function(){return s});var H=I("./src/polyfills/number.ts"),L=I("./src/errors.ts");function C(a,e){a.prototype=Object.create(e.prototype),a.prototype.constructor=a,_(a,e)}function j(a){var e=typeof Map=="function"?new Map:void 0;return j=function(n){if(n===null||!S(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,x)}function x(){return U(n,arguments,b(this).constructor)}return x.prototype=Object.create(n.prototype,{constructor:{value:x,enumerable:!1,writable:!0,configurable:!0}}),_(x,n)},j(a)}function U(a,e,t){return O()?U=Reflect.construct:U=function(x,E,g){var y=[null];y.push.apply(y,E);var v=Function.bind.apply(x,y),d=new v;return g&&_(d,g.prototype),d},U.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(a){return!1}}function S(a){return Function.toString.call(a).indexOf("[native code]")!==-1}function _(a,e){return _=Object.setPrototypeOf||function(n,x){return n.__proto__=x,n},_(a,e)}function b(a){return b=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},b(a)}var h=Math.pow(2,17),l=function(){function a(t){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=t}var e=a.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,x){var E=this,g=n.url;if(!g)return Promise.reject(new s({type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:n,networkDetails:null},"Fragment does not have a "+(g?"part list":"url")));this.abort();var y=this.config,v=y.fLoader,d=y.loader;return new Promise(function(u,i){E.loader&&E.loader.destroy();var o=E.loader=n.loader=v?new v(y):new d(y),p=r(n),f={timeout:y.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:y.fragLoadingMaxRetryTimeout,highWaterMark:h};n.stats=o.stats,o.load(p,f,{onSuccess:function(w,A,P,N){E.resetLoader(n,o),u({frag:n,part:null,payload:w.data,networkDetails:N})},onError:function(w,A,P){E.resetLoader(n,o),i(new s({type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:n,response:w,networkDetails:P}))},onAbort:function(w,A,P){E.resetLoader(n,o),i(new s({type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:n,networkDetails:P}))},onTimeout:function(w,A,P){E.resetLoader(n,o),i(new s({type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:n,networkDetails:P}))},onProgress:function(w,A,P,N){x&&x({frag:n,part:null,payload:P,networkDetails:N})}})})},e.loadPart=function(n,x,E){var g=this;this.abort();var y=this.config,v=y.fLoader,d=y.loader;return new Promise(function(u,i){g.loader&&g.loader.destroy();var o=g.loader=n.loader=v?new v(y):new d(y),p=r(n,x),f={timeout:y.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:y.fragLoadingMaxRetryTimeout,highWaterMark:h};x.stats=o.stats,o.load(p,f,{onSuccess:function(w,A,P,N){g.resetLoader(n,o),g.updateStatsFromPart(n,x);var B={frag:n,part:x,payload:w.data,networkDetails:N};E(B),u(B)},onError:function(w,A,P){g.resetLoader(n,o),i(new s({type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:n,part:x,response:w,networkDetails:P}))},onAbort:function(w,A,P){n.stats.aborted=x.stats.aborted,g.resetLoader(n,o),i(new s({type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:n,part:x,networkDetails:P}))},onTimeout:function(w,A,P){g.resetLoader(n,o),i(new s({type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:n,part:x,networkDetails:P}))}})})},e.updateStatsFromPart=function(n,x){var E=n.stats,g=x.stats,y=g.total;if(E.loaded+=g.loaded,y){var v=Math.round(n.duration/x.duration),d=Math.min(Math.round(E.loaded/y),v),u=v-d,i=u*Math.round(E.loaded/d);E.total=E.loaded+i}else E.total=Math.max(E.loaded,E.total);var o=E.loading,p=g.loading;o.start?o.first+=p.first-p.start:(o.start=p.start,o.first=p.first),o.end=p.end},e.resetLoader=function(n,x){n.loader=null,this.loader===x&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),x.destroy()},a}();function r(a,e){e===void 0&&(e=null);var t=e||a,n={frag:a,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},x=t.byteRangeStartOffset,E=t.byteRangeEndOffset;return Object(H.isFiniteNumber)(x)&&Object(H.isFiniteNumber)(E)&&(n.rangeStart=x,n.rangeEnd=E),n}var s=function(a){C(e,a);function e(t){for(var n,x=arguments.length,E=new Array(x>1?x-1:0),g=1;g<x;g++)E[g-1]=arguments[g];return n=a.call.apply(a,[this].concat(E))||this,n.data=void 0,n.data=t,n}return e}(j(Error))},"./src/loader/fragment.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"ElementaryStreamTypes",function(){return l}),I.d(W,"BaseSegment",function(){return r}),I.d(W,"Fragment",function(){return s}),I.d(W,"Part",function(){return a});var H=I("./src/polyfills/number.ts"),L=I("./node_modules/url-toolkit/src/url-toolkit.js"),C=I.n(L),j=I("./src/utils/logger.ts"),U=I("./src/loader/level-key.ts"),O=I("./src/loader/load-stats.ts");function S(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,_(e,t)}function _(e,t){return _=Object.setPrototypeOf||function(x,E){return x.__proto__=E,x},_(e,t)}function b(e,t){for(var n=0;n<t.length;n++){var x=t[n];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(e,x.key,x)}}function h(e,t,n){return t&&b(e.prototype,t),n&&b(e,n),e}var l;(function(e){e.AUDIO="audio",e.VIDEO="video",e.AUDIOVIDEO="audiovideo"})(l||(l={}));var r=function(){function e(n){var x;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(x={},x[l.AUDIO]=null,x[l.VIDEO]=null,x[l.AUDIOVIDEO]=null,x),this.baseurl=n}var t=e.prototype;return t.setByteRange=function(x,E){var g=x.split("@",2),y=[];g.length===1?y[0]=E?E.byteRangeEndOffset:0:y[0]=parseInt(g[1]),y[1]=parseInt(g[0])+y[0],this._byteRange=y},h(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(L.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(x){this._url=x}}]),e}(),s=function(e){S(t,e);function t(x,E){var g;return g=e.call(this,E)||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=x,g}var n=t.prototype;return n.createInitializationVector=function(E){for(var g=new Uint8Array(16),y=12;y<16;y++)g[y]=E>>8*(15-y)&255;return g},n.setDecryptDataFromLevelKey=function(E,g){var y=E;return(E==null?void 0:E.method)==="AES-128"&&E.uri&&!E.iv&&(y=U.LevelKey.fromURI(E.uri),y.method=E.method,y.iv=this.createInitializationVector(g),y.keyFormat="identity"),y},n.setElementaryStreamInfo=function(E,g,y,v,d,u){u===void 0&&(u=!1);var i=this.elementaryStreams,o=i[E];if(!o){i[E]={startPTS:g,endPTS:y,startDTS:v,endDTS:d,partial:u};return}o.startPTS=Math.min(o.startPTS,g),o.endPTS=Math.max(o.endPTS,y),o.startDTS=Math.min(o.startDTS,v),o.endDTS=Math.max(o.endDTS,d)},n.clearElementaryStreamInfo=function(){var E=this.elementaryStreams;E[l.AUDIO]=null,E[l.VIDEO]=null,E[l.AUDIOVIDEO]=null},h(t,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var E=this.sn;typeof E!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&j.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),E=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,E)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(H.isFiniteNumber)(this.programDateTime))return null;var E=Object(H.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+E*1e3}},{key:"encrypted",get:function(){var E;return!!((E=this.decryptdata)!==null&&E!==void 0&&E.keyFormat&&this.decryptdata.uri)}}]),t}(r),a=function(e){S(t,e);function t(n,x,E,g,y){var v;v=e.call(this,E)||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=x,v.index=g;var d=n.enumeratedString("BYTERANGE");return d&&v.setByteRange(d,y),y&&(v.fragOffset=y.fragOffset+y.duration),v}return h(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 x=this.elementaryStreams;return!!(x.audio||x.video||x.audiovideo)}}]),t}(r)},"./src/loader/key-loader.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"default",function(){return j});var H=I("./src/events.ts"),L=I("./src/errors.ts"),C=I("./src/utils/logger.ts"),j=function(){function U(S){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=S,this._registerListeners()}var O=U.prototype;return O._registerListeners=function(){this.hls.on(H.Events.KEY_LOADING,this.onKeyLoading,this)},O._unregisterListeners=function(){this.hls.off(H.Events.KEY_LOADING,this.onKeyLoading)},O.destroy=function(){this._unregisterListeners();for(var _ in this.loaders){var b=this.loaders[_];b&&b.destroy()}this.loaders={}},O.onKeyLoading=function(_,b){var h=b.frag,l=h.type,r=this.loaders[l];if(!h.decryptdata){C.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var s=h.decryptdata.uri;if(s!==this.decrypturl||this.decryptkey===null){var a=this.hls.config;if(r&&(C.logger.warn("abort previous key loader for type:"+l),r.abort()),!s){C.logger.warn("key uri is falsy");return}var e=a.loader,t=h.loader=this.loaders[l]=new e(a);this.decrypturl=s,this.decryptkey=null;var n={url:s,frag:h,responseType:"arraybuffer"},x={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:a.fragLoadingRetryDelay,maxRetryDelay:a.fragLoadingMaxRetryTimeout,highWaterMark:0},E={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};t.load(n,x,E)}else this.decryptkey&&(h.decryptdata.key=this.decryptkey,this.hls.trigger(H.Events.KEY_LOADED,{frag:h}))},O.loadsuccess=function(_,b,h){var l=h.frag;if(!l.decryptdata){C.logger.error("after key load, decryptdata unset");return}this.decryptkey=l.decryptdata.key=new Uint8Array(_.data),l.loader=null,delete this.loaders[l.type],this.hls.trigger(H.Events.KEY_LOADED,{frag:l})},O.loaderror=function(_,b){var h=b.frag,l=h.loader;l&&l.abort(),delete this.loaders[h.type],this.hls.trigger(H.Events.ERROR,{type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:h,response:_})},O.loadtimeout=function(_,b){var h=b.frag,l=h.loader;l&&l.abort(),delete this.loaders[h.type],this.hls.trigger(H.Events.ERROR,{type:L.ErrorTypes.NETWORK_ERROR,details:L.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:h})},U}()},"./src/loader/level-details.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"LevelDetails",function(){return U});var H=I("./src/polyfills/number.ts");function L(O,S){for(var _=0;_<S.length;_++){var b=S[_];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(O,b.key,b)}}function C(O,S,_){return S&&L(O.prototype,S),_&&L(O,_),O}var j=10,U=function(){function O(_){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=_}var S=O.prototype;return S.reloaded=function(b){if(!b){this.advanced=!0,this.updated=!0;return}var h=this.lastPartSn-b.lastPartSn,l=this.lastPartIndex-b.lastPartIndex;this.updated=this.endSN!==b.endSN||!!l||!!h,this.advanced=this.endSN>b.endSN||h>0||h===0&&l>0,this.updated||this.advanced?this.misses=Math.floor(b.misses*.6):this.misses=b.misses+1,this.availabilityDelay=b.availabilityDelay},C(O,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(H.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||j}},{key:"drift",get:function(){var b=this.driftEndTime-this.driftStartTime;if(b>0){var h=this.driftEnd-this.driftStart;return h*1e3/b}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var b;return(b=this.partList)!==null&&b!==void 0&&b.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var b;return(b=this.fragments)!==null&&b!==void 0&&b.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 b;return(b=this.partList)!==null&&b!==void 0&&b.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var b;return(b=this.partList)!==null&&b!==void 0&&b.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),O}()},"./src/loader/level-key.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"LevelKey",function(){return U});var H=I("./node_modules/url-toolkit/src/url-toolkit.js"),L=I.n(H);function C(O,S){for(var _=0;_<S.length;_++){var b=S[_];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(O,b.key,b)}}function j(O,S,_){return S&&C(O.prototype,S),_&&C(O,_),O}var U=function(){O.fromURL=function(_,b){return new O(_,b)},O.fromURI=function(_){return new O(_)};function O(S,_){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,_?this._uri=Object(H.buildAbsoluteURL)(S,_,{alwaysNormalize:!0}):this._uri=S}return j(O,[{key:"uri",get:function(){return this._uri}}]),O}()},"./src/loader/load-stats.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"LoadStats",function(){return H});var H=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(re,W,I){"use strict";I.r(W),I.d(W,"default",function(){return t});var H=I("./src/polyfills/number.ts"),L=I("./node_modules/url-toolkit/src/url-toolkit.js"),C=I.n(L),j=I("./src/loader/fragment.ts"),U=I("./src/loader/level-details.ts"),O=I("./src/loader/level-key.ts"),S=I("./src/utils/attr-list.ts"),_=I("./src/utils/logger.ts"),b=I("./src/utils/codecs.ts"),h=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,l=/#EXT-X-MEDIA:(.*)/g,r=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),s=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("|")),a=/\.(mp4|m4s|m4v|m4a)$/i;function e(y){var v,d;return a.test((v=(d=L.parseURL(y))===null||d===void 0?void 0:d.path)!=null?v:"")}var t=function(){function y(){}return y.findGroup=function(d,u){for(var i=0;i<d.length;i++){var o=d[i];if(o.id===u)return o}},y.convertAVC1ToAVCOTI=function(d){var u=d.split(".");if(u.length>2){var i=u.shift()+".";return i+=parseInt(u.shift()).toString(16),i+=("000"+parseInt(u.shift()).toString(16)).substr(-4),i}return d},y.resolve=function(d,u){return L.buildAbsoluteURL(u,d,{alwaysNormalize:!0})},y.parseMasterPlaylist=function(d,u){var i=[],o={},p=!1;h.lastIndex=0;for(var f;(f=h.exec(d))!=null;)if(f[1]){var c=new S.AttrList(f[1]),w={attrs:c,bitrate:c.decimalInteger("AVERAGE-BANDWIDTH")||c.decimalInteger("BANDWIDTH"),name:c.NAME,url:y.resolve(f[2],u)},A=c.decimalResolution("RESOLUTION");A&&(w.width=A.width,w.height=A.height),n((c.CODECS||"").split(/[ ,]+/).filter(function(N){return N}),w),w.videoCodec&&w.videoCodec.indexOf("avc1")!==-1&&(w.videoCodec=y.convertAVC1ToAVCOTI(w.videoCodec)),i.push(w)}else if(f[3]){var P=new S.AttrList(f[3]);P["DATA-ID"]&&(p=!0,o[P["DATA-ID"]]=P)}return{levels:i,sessionData:p?o:null}},y.parseMasterPlaylistMedia=function(d,u,i,o){o===void 0&&(o=[]);var p,f=[],c=0;for(l.lastIndex=0;(p=l.exec(d))!==null;){var w=new S.AttrList(p[1]);if(w.TYPE===i){var A={attrs:w,bitrate:0,id:c++,groupId:w["GROUP-ID"],instreamId:w["INSTREAM-ID"],name:w.NAME||w.LANGUAGE||"",type:i,default:w.bool("DEFAULT"),autoselect:w.bool("AUTOSELECT"),forced:w.bool("FORCED"),lang:w.LANGUAGE,url:w.URI?y.resolve(w.URI,u):""};if(o.length){var P=y.findGroup(o,A.groupId)||o[0];x(A,P,"audioCodec"),x(A,P,"textCodec")}f.push(A)}}return f},y.parseLevelPlaylist=function(d,u,i,o,p){var f=new U.LevelDetails(u),c=f.fragments,w=null,A=0,P=0,N=0,B=0,R=null,F=new j.Fragment(o,u),K,X,ee,oe=-1,ce=!1;for(r.lastIndex=0,f.m3u8=d;(K=r.exec(d))!==null;){ce&&(ce=!1,F=new j.Fragment(o,u),F.start=N,F.sn=A,F.cc=B,F.level=i,w&&(F.initSegment=w,F.rawProgramDateTime=w.rawProgramDateTime));var le=K[1];if(le){F.duration=parseFloat(le);var be=(" "+K[2]).slice(1);F.title=be||null,F.tagList.push(be?["INF",le,be]:["INF",le])}else if(K[3])Object(H.isFiniteNumber)(F.duration)&&(F.start=N,ee&&(F.levelkey=ee),F.sn=A,F.level=i,F.cc=B,F.urlId=p,c.push(F),F.relurl=(" "+K[3]).slice(1),g(F,R),R=F,N+=F.duration,A++,P=0,ce=!0);else if(K[4]){var pe=(" "+K[4]).slice(1);R?F.setByteRange(pe,R):F.setByteRange(pe)}else if(K[5])F.rawProgramDateTime=(" "+K[5]).slice(1),F.tagList.push(["PROGRAM-DATE-TIME",F.rawProgramDateTime]),oe===-1&&(oe=c.length);else{if(K=K[0].match(s),!K){_.logger.warn("No matches on slow regex match for level playlist!");continue}for(X=1;X<K.length&&!(typeof K[X]!="undefined");X++);var de=(" "+K[X]).slice(1),te=(" "+K[X+1]).slice(1),Le=K[X+2]?(" "+K[X+2]).slice(1):"";switch(de){case"PLAYLIST-TYPE":f.type=te.toUpperCase();break;case"MEDIA-SEQUENCE":A=f.startSN=parseInt(te);break;case"SKIP":{var Ve=new S.AttrList(te),Ne=Ve.decimalInteger("SKIPPED-SEGMENTS");if(Object(H.isFiniteNumber)(Ne)){f.skippedSegments=Ne;for(var Be=Ne;Be--;)c.unshift(null);A+=Ne}var ve=Ve.enumeratedString("RECENTLY-REMOVED-DATERANGES");ve&&(f.recentlyRemovedDateranges=ve.split(" "));break}case"TARGETDURATION":f.targetduration=parseFloat(te);break;case"VERSION":f.version=parseInt(te);break;case"EXTM3U":break;case"ENDLIST":f.live=!1;break;case"#":(te||Le)&&F.tagList.push(Le?[te,Le]:[te]);break;case"DIS":B++;case"GAP":F.tagList.push([de]);break;case"BITRATE":F.tagList.push([de,te]);break;case"DISCONTINUITY-SEQ":B=parseInt(te);break;case"KEY":{var ye,Ie=new S.AttrList(te),Ae=Ie.enumeratedString("METHOD"),ge=Ie.URI,Ce=Ie.hexadecimalInteger("IV"),Oe=Ie.enumeratedString("KEYFORMATVERSIONS"),Se=Ie.enumeratedString("KEYID"),De=(ye=Ie.enumeratedString("KEYFORMAT"))!=null?ye:"identity",je=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(je.indexOf(De)>-1){_.logger.warn("Keyformat "+De+" is not supported from the manifest");continue}else if(De!=="identity")continue;Ae&&(ee=O.LevelKey.fromURL(u,ge),ge&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Ae)>=0&&(ee.method=Ae,ee.keyFormat=De,Se&&(ee.keyID=Se),Oe&&(ee.keyFormatVersions=Oe),ee.iv=Ce));break}case"START":{var Me=new S.AttrList(te),Fe=Me.decimalFloatingPoint("TIME-OFFSET");Object(H.isFiniteNumber)(Fe)&&(f.startTimeOffset=Fe);break}case"MAP":{var We=new S.AttrList(te);F.relurl=We.URI,We.BYTERANGE&&F.setByteRange(We.BYTERANGE),F.level=i,F.sn="initSegment",ee&&(F.levelkey=ee),F.initSegment=null,w=F,ce=!0;break}case"SERVER-CONTROL":{var ze=new S.AttrList(te);f.canBlockReload=ze.bool("CAN-BLOCK-RELOAD"),f.canSkipUntil=ze.optionalFloat("CAN-SKIP-UNTIL",0),f.canSkipDateRanges=f.canSkipUntil>0&&ze.bool("CAN-SKIP-DATERANGES"),f.partHoldBack=ze.optionalFloat("PART-HOLD-BACK",0),f.holdBack=ze.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var ne=new S.AttrList(te);f.partTarget=ne.decimalFloatingPoint("PART-TARGET");break}case"PART":{var ue=f.partList;ue||(ue=f.partList=[]);var me=P>0?ue[ue.length-1]:void 0,_e=P++,se=new j.Part(new S.AttrList(te),F,u,_e,me);ue.push(se),F.duration+=se.duration;break}case"PRELOAD-HINT":{var fe=new S.AttrList(te);f.preloadHint=fe;break}case"RENDITION-REPORT":{var Z=new S.AttrList(te);f.renditionReports=f.renditionReports||[],f.renditionReports.push(Z);break}default:_.logger.warn("line parsed but not handled: "+K);break}}}R&&!R.relurl?(c.pop(),N-=R.duration,f.partList&&(f.fragmentHint=R)):f.partList&&(g(F,R),F.cc=B,f.fragmentHint=F);var Q=c.length,$=c[0],V=c[Q-1];if(N+=f.skippedSegments*f.targetduration,N>0&&Q&&V){f.averagetargetduration=N/Q;var Y=V.sn;f.endSN=Y!=="initSegment"?Y:0,$&&(f.startCC=$.cc,$.initSegment||f.fragments.every(function(J){return J.relurl&&e(J.relurl)})&&(_.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),F=new j.Fragment(o,u),F.relurl=V.relurl,F.level=i,F.sn="initSegment",$.initSegment=F,f.needSidxRanges=!0))}else f.endSN=0,f.startCC=0;return f.fragmentHint&&(N+=f.fragmentHint.duration),f.totalduration=N,f.endCC=B,oe>0&&E(c,oe),f},y}();function n(y,v){["video","audio","text"].forEach(function(d){var u=y.filter(function(o){return Object(b.isCodecType)(o,d)});if(u.length){var i=u.filter(function(o){return o.lastIndexOf("avc1",0)===0||o.lastIndexOf("mp4a",0)===0});v[d+"Codec"]=i.length>0?i[0]:u[0],y=y.filter(function(o){return u.indexOf(o)===-1})}}),v.unknownCodecs=y}function x(y,v,d){var u=v[d];u&&(y[d]=u)}function E(y,v){for(var d=y[v],u=v;u--;){var i=y[u];if(!i)return;i.programDateTime=d.programDateTime-i.duration*1e3,d=i}}function g(y,v){y.rawProgramDateTime?y.programDateTime=Date.parse(y.rawProgramDateTime):v!=null&&v.programDateTime&&(y.programDateTime=v.endProgramDateTime),Object(H.isFiniteNumber)(y.programDateTime)||(y.programDateTime=null,y.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(re,W,I){"use strict";I.r(W);var H=I("./src/polyfills/number.ts"),L=I("./src/events.ts"),C=I("./src/errors.ts"),j=I("./src/utils/logger.ts"),U=I("./src/utils/mp4-tools.ts"),O=I("./src/loader/m3u8-parser.ts"),S=I("./src/types/loader.ts"),_=I("./src/utils/attr-list.ts");function b(r){var s=r.type;switch(s){case S.PlaylistContextType.AUDIO_TRACK:return S.PlaylistLevelType.AUDIO;case S.PlaylistContextType.SUBTITLE_TRACK:return S.PlaylistLevelType.SUBTITLE;default:return S.PlaylistLevelType.MAIN}}function h(r,s){var a=r.url;return(a===void 0||a.indexOf("data:")===0)&&(a=s.url),a}var l=function(){function r(a){this.hls=void 0,this.loaders=Object.create(null),this.hls=a,this.registerListeners()}var s=r.prototype;return s.registerListeners=function(){var e=this.hls;e.on(L.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(L.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(L.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(L.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},s.unregisterListeners=function(){var e=this.hls;e.off(L.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(L.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(L.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(L.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},s.createInternalLoader=function(e){var t=this.hls.config,n=t.pLoader,x=t.loader,E=n||x,g=new E(t);return e.loader=g,this.loaders[e.type]=g,g},s.getInternalLoader=function(e){return this.loaders[e.type]},s.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},s.destroyInternalLoaders=function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}},s.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},s.onManifestLoading=function(e,t){var n=t.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:S.PlaylistContextType.MANIFEST,url:n,deliveryDirectives:null})},s.onLevelLoading=function(e,t){var n=t.id,x=t.level,E=t.url,g=t.deliveryDirectives;this.load({id:n,groupId:null,level:x,responseType:"text",type:S.PlaylistContextType.LEVEL,url:E,deliveryDirectives:g})},s.onAudioTrackLoading=function(e,t){var n=t.id,x=t.groupId,E=t.url,g=t.deliveryDirectives;this.load({id:n,groupId:x,level:null,responseType:"text",type:S.PlaylistContextType.AUDIO_TRACK,url:E,deliveryDirectives:g})},s.onSubtitleTrackLoading=function(e,t){var n=t.id,x=t.groupId,E=t.url,g=t.deliveryDirectives;this.load({id:n,groupId:x,level:null,responseType:"text",type:S.PlaylistContextType.SUBTITLE_TRACK,url:E,deliveryDirectives:g})},s.load=function(e){var t,n=this.hls.config,x=this.getInternalLoader(e);if(x){var E=x.context;if(E&&E.url===e.url){j.logger.trace("[playlist-loader]: playlist request ongoing");return}j.logger.log("[playlist-loader]: aborting previous loader for type: "+e.type),x.abort()}var g,y,v,d;switch(e.type){case S.PlaylistContextType.MANIFEST:g=n.manifestLoadingMaxRetry,y=n.manifestLoadingTimeOut,v=n.manifestLoadingRetryDelay,d=n.manifestLoadingMaxRetryTimeout;break;case S.PlaylistContextType.LEVEL:case S.PlaylistContextType.AUDIO_TRACK:case S.PlaylistContextType.SUBTITLE_TRACK:g=0,y=n.levelLoadingTimeOut;break;default:g=n.levelLoadingMaxRetry,y=n.levelLoadingTimeOut,v=n.levelLoadingRetryDelay,d=n.levelLoadingMaxRetryTimeout;break}if(x=this.createInternalLoader(e),(t=e.deliveryDirectives)!==null&&t!==void 0&&t.part){var u;if(e.type===S.PlaylistContextType.LEVEL&&e.level!==null?u=this.hls.levels[e.level].details:e.type===S.PlaylistContextType.AUDIO_TRACK&&e.id!==null?u=this.hls.audioTracks[e.id].details:e.type===S.PlaylistContextType.SUBTITLE_TRACK&&e.id!==null&&(u=this.hls.subtitleTracks[e.id].details),u){var i=u.partTarget,o=u.targetduration;i&&o&&(y=Math.min(Math.max(i*3,o*.8)*1e3,y))}}var p={timeout:y,maxRetry:g,retryDelay:v,maxRetryDelay:d,highWaterMark:0},f={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};x.load(e,p,f)},s.loadsuccess=function(e,t,n,x){if(x===void 0&&(x=null),n.isSidxRequest){this.handleSidxRequest(e,n),this.handlePlaylistLoaded(e,t,n,x);return}this.resetInternalLoader(n.type);var E=e.data;if(E.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(e,n,"no EXTM3U delimiter",x);return}t.parsing.start=performance.now(),E.indexOf("#EXTINF:")>0||E.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(e,t,n,x):this.handleMasterPlaylist(e,t,n,x)},s.loaderror=function(e,t,n){n===void 0&&(n=null),this.handleNetworkError(t,n,!1,e)},s.loadtimeout=function(e,t,n){n===void 0&&(n=null),this.handleNetworkError(t,n,!0)},s.handleMasterPlaylist=function(e,t,n,x){var E=this.hls,g=e.data,y=h(e,n),v=O.default.parseMasterPlaylist(g,y),d=v.levels,u=v.sessionData;if(!d.length){this.handleManifestParsingError(e,n,"no level found in manifest",x);return}var i=d.map(function(A){return{id:A.attrs.AUDIO,audioCodec:A.audioCodec}}),o=d.map(function(A){return{id:A.attrs.SUBTITLES,textCodec:A.textCodec}}),p=O.default.parseMasterPlaylistMedia(g,y,"AUDIO",i),f=O.default.parseMasterPlaylistMedia(g,y,"SUBTITLES",o),c=O.default.parseMasterPlaylistMedia(g,y,"CLOSED-CAPTIONS");if(p.length){var w=p.some(function(A){return!A.url});!w&&d[0].audioCodec&&!d[0].attrs.AUDIO&&(j.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),p.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new _.AttrList({}),bitrate:0,url:""}))}E.trigger(L.Events.MANIFEST_LOADED,{levels:d,audioTracks:p,subtitles:f,captions:c,url:y,stats:t,networkDetails:x,sessionData:u})},s.handleTrackOrLevelPlaylist=function(e,t,n,x){var E=this.hls,g=n.id,y=n.level,v=n.type,d=h(e,n),u=Object(H.isFiniteNumber)(g)?g:0,i=Object(H.isFiniteNumber)(y)?y:u,o=b(n),p=O.default.parseLevelPlaylist(e.data,d,i,o,u);if(!p.fragments.length){E.trigger(L.Events.ERROR,{type:C.ErrorTypes.NETWORK_ERROR,details:C.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:d,reason:"no fragments found in level",level:typeof n.level=="number"?n.level:void 0});return}if(v===S.PlaylistContextType.MANIFEST){var f={attrs:new _.AttrList({}),bitrate:0,details:p,name:"",url:d};E.trigger(L.Events.MANIFEST_LOADED,{levels:[f],audioTracks:[],url:d,stats:t,networkDetails:x,sessionData:null})}if(t.parsing.end=performance.now(),p.needSidxRanges){var c,w=(c=p.fragments[0].initSegment)===null||c===void 0?void 0:c.url;this.load({url:w,isSidxRequest:!0,type:v,level:y,levelDetails:p,id:g,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}n.levelDetails=p,this.handlePlaylistLoaded(e,t,n,x)},s.handleSidxRequest=function(e,t){var n=Object(U.parseSegmentIndex)(new Uint8Array(e.data));if(!n)return;var x=n.references,E=t.levelDetails;x.forEach(function(g,y){var v=g.info,d=E.fragments[y];d.byteRange.length===0&&d.setByteRange(String(1+v.end-v.start)+"@"+String(v.start)),d.initSegment&&d.initSegment.setByteRange(String(n.moovEndOffset)+"@0")})},s.handleManifestParsingError=function(e,t,n,x){this.hls.trigger(L.Events.ERROR,{type:C.ErrorTypes.NETWORK_ERROR,details:C.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:t.type===S.PlaylistContextType.MANIFEST,url:e.url,reason:n,response:e,context:t,networkDetails:x})},s.handleNetworkError=function(e,t,n,x){n===void 0&&(n=!1),j.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 E=C.ErrorDetails.UNKNOWN,g=!1,y=this.getInternalLoader(e);switch(e.type){case S.PlaylistContextType.MANIFEST:E=n?C.ErrorDetails.MANIFEST_LOAD_TIMEOUT:C.ErrorDetails.MANIFEST_LOAD_ERROR,g=!0;break;case S.PlaylistContextType.LEVEL:E=n?C.ErrorDetails.LEVEL_LOAD_TIMEOUT:C.ErrorDetails.LEVEL_LOAD_ERROR,g=!1;break;case S.PlaylistContextType.AUDIO_TRACK:E=n?C.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:C.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,g=!1;break;case S.PlaylistContextType.SUBTITLE_TRACK:E=n?C.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:C.ErrorDetails.SUBTITLE_LOAD_ERROR,g=!1;break}y&&this.resetInternalLoader(e.type);var v={type:C.ErrorTypes.NETWORK_ERROR,details:E,fatal:g,url:e.url,loader:y,context:e,networkDetails:t};x&&(v.response=x),this.hls.trigger(L.Events.ERROR,v)},s.handlePlaylistLoaded=function(e,t,n,x){var E=n.type,g=n.level,y=n.id,v=n.groupId,d=n.loader,u=n.levelDetails,i=n.deliveryDirectives;if(!(u!=null&&u.targetduration)){this.handleManifestParsingError(e,n,"invalid target duration",x);return}if(!d)return;u.live&&(d.getCacheAge&&(u.ageHeader=d.getCacheAge()||0),(!d.getCacheAge||isNaN(u.ageHeader))&&(u.ageHeader=0));switch(E){case S.PlaylistContextType.MANIFEST:case S.PlaylistContextType.LEVEL:this.hls.trigger(L.Events.LEVEL_LOADED,{details:u,level:g||0,id:y||0,stats:t,networkDetails:x,deliveryDirectives:i});break;case S.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(L.Events.AUDIO_TRACK_LOADED,{details:u,id:y||0,groupId:v||"",stats:t,networkDetails:x,deliveryDirectives:i});break;case S.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(L.Events.SUBTITLE_TRACK_LOADED,{details:u,id:y||0,groupId:v||"",stats:t,networkDetails:x,deliveryDirectives:i});break}},r}();W.default=l},"./src/polyfills/number.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"isFiniteNumber",function(){return H}),I.d(W,"MAX_SAFE_INTEGER",function(){return L});var H=Number.isFinite||function(C){return typeof C=="number"&&isFinite(C)},L=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(re,W,I){"use strict";I.r(W);var H=function(){function L(){}return L.getSilentFrame=function(j,U){switch(j){case"mp4a.40.2":if(U===1)return new Uint8Array([0,200,0,128,35,128]);if(U===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(U===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(U===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(U===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(U===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(U===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(U===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(U===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},L}();W.default=H},"./src/remux/mp4-generator.ts":function(re,W,I){"use strict";I.r(W);var H=Math.pow(2,32)-1,L=function(){function C(){}return C.init=function(){C.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 U;for(U in C.types)C.types.hasOwnProperty(U)&&(C.types[U]=[U.charCodeAt(0),U.charCodeAt(1),U.charCodeAt(2),U.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]),S=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]);C.HDLR_TYPES={video:O,audio:S};var _=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),b=new Uint8Array([0,0,0,0,0,0,0,0]);C.STTS=C.STSC=C.STCO=b,C.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),C.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),C.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),C.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var h=new Uint8Array([105,115,111,109]),l=new Uint8Array([97,118,99,49]),r=new Uint8Array([0,0,0,1]);C.FTYP=C.box(C.types.ftyp,h,r,h,l),C.DINF=C.box(C.types.dinf,C.box(C.types.dref,_))},C.box=function(U){for(var O=8,S=arguments.length,_=new Array(S>1?S-1:0),b=1;b<S;b++)_[b-1]=arguments[b];for(var h=_.length,l=h;h--;)O+=_[h].byteLength;var r=new Uint8Array(O);for(r[0]=O>>24&255,r[1]=O>>16&255,r[2]=O>>8&255,r[3]=O&255,r.set(U,4),h=0,O=8;h<l;h++)r.set(_[h],O),O+=_[h].byteLength;return r},C.hdlr=function(U){return C.box(C.types.hdlr,C.HDLR_TYPES[U])},C.mdat=function(U){return C.box(C.types.mdat,U)},C.mdhd=function(U,O){O*=U;var S=Math.floor(O/(H+1)),_=Math.floor(O%(H+1));return C.box(C.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,U>>24&255,U>>16&255,U>>8&255,U&255,S>>24,S>>16&255,S>>8&255,S&255,_>>24,_>>16&255,_>>8&255,_&255,85,196,0,0]))},C.mdia=function(U){return C.box(C.types.mdia,C.mdhd(U.timescale,U.duration),C.hdlr(U.type),C.minf(U))},C.mfhd=function(U){return C.box(C.types.mfhd,new Uint8Array([0,0,0,0,U>>24,U>>16&255,U>>8&255,U&255]))},C.minf=function(U){return U.type==="audio"?C.box(C.types.minf,C.box(C.types.smhd,C.SMHD),C.DINF,C.stbl(U)):C.box(C.types.minf,C.box(C.types.vmhd,C.VMHD),C.DINF,C.stbl(U))},C.moof=function(U,O,S){return C.box(C.types.moof,C.mfhd(U),C.traf(S,O))},C.moov=function(U){for(var O=U.length,S=[];O--;)S[O]=C.trak(U[O]);return C.box.apply(null,[C.types.moov,C.mvhd(U[0].timescale,U[0].duration)].concat(S).concat(C.mvex(U)))},C.mvex=function(U){for(var O=U.length,S=[];O--;)S[O]=C.trex(U[O]);return C.box.apply(null,[C.types.mvex].concat(S))},C.mvhd=function(U,O){O*=U;var S=Math.floor(O/(H+1)),_=Math.floor(O%(H+1)),b=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,U>>24&255,U>>16&255,U>>8&255,U&255,S>>24,S>>16&255,S>>8&255,S&255,_>>24,_>>16&255,_>>8&255,_&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 C.box(C.types.mvhd,b)},C.sdtp=function(U){var O=U.samples||[],S=new Uint8Array(4+O.length),_,b;for(_=0;_<O.length;_++)b=O[_].flags,S[_+4]=b.dependsOn<<4|b.isDependedOn<<2|b.hasRedundancy;return C.box(C.types.sdtp,S)},C.stbl=function(U){return C.box(C.types.stbl,C.stsd(U),C.box(C.types.stts,C.STTS),C.box(C.types.stsc,C.STSC),C.box(C.types.stsz,C.STSZ),C.box(C.types.stco,C.STCO))},C.avc1=function(U){var O=[],S=[],_,b,h;for(_=0;_<U.sps.length;_++)b=U.sps[_],h=b.byteLength,O.push(h>>>8&255),O.push(h&255),O=O.concat(Array.prototype.slice.call(b));for(_=0;_<U.pps.length;_++)b=U.pps[_],h=b.byteLength,S.push(h>>>8&255),S.push(h&255),S=S.concat(Array.prototype.slice.call(b));var l=C.box(C.types.avcC,new Uint8Array([1,O[3],O[4],O[5],252|3,224|U.sps.length].concat(O).concat([U.pps.length]).concat(S))),r=U.width,s=U.height,a=U.pixelRatio[0],e=U.pixelRatio[1];return C.box(C.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,r>>8&255,r&255,s>>8&255,s&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]),l,C.box(C.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),C.box(C.types.pasp,new Uint8Array([a>>24,a>>16&255,a>>8&255,a&255,e>>24,e>>16&255,e>>8&255,e&255])))},C.esds=function(U){var O=U.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(U.config).concat([6,1,2]))},C.mp4a=function(U){var O=U.samplerate;return C.box(C.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,U.channelCount,0,16,0,0,0,0,O>>8&255,O&255,0,0]),C.box(C.types.esds,C.esds(U)))},C.mp3=function(U){var O=U.samplerate;return C.box(C.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,U.channelCount,0,16,0,0,0,0,O>>8&255,O&255,0,0]))},C.stsd=function(U){return U.type==="audio"?!U.isAAC&&U.codec==="mp3"?C.box(C.types.stsd,C.STSD,C.mp3(U)):C.box(C.types.stsd,C.STSD,C.mp4a(U)):C.box(C.types.stsd,C.STSD,C.avc1(U))},C.tkhd=function(U){var O=U.id,S=U.duration*U.timescale,_=U.width,b=U.height,h=Math.floor(S/(H+1)),l=Math.floor(S%(H+1));return C.box(C.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,h>>24,h>>16&255,h>>8&255,h&255,l>>24,l>>16&255,l>>8&255,l&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,_>>8&255,_&255,0,0,b>>8&255,b&255,0,0]))},C.traf=function(U,O){var S=C.sdtp(U),_=U.id,b=Math.floor(O/(H+1)),h=Math.floor(O%(H+1));return C.box(C.types.traf,C.box(C.types.tfhd,new Uint8Array([0,0,0,0,_>>24,_>>16&255,_>>8&255,_&255])),C.box(C.types.tfdt,new Uint8Array([1,0,0,0,b>>24,b>>16&255,b>>8&255,b&255,h>>24,h>>16&255,h>>8&255,h&255])),C.trun(U,S.length+16+20+8+16+8+8),S)},C.trak=function(U){return U.duration=U.duration||4294967295,C.box(C.types.trak,C.tkhd(U),C.mdia(U))},C.trex=function(U){var O=U.id;return C.box(C.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]))},C.trun=function(U,O){var S=U.samples||[],_=S.length,b=12+16*_,h=new Uint8Array(b),l,r,s,a,e,t;for(O+=8+b,h.set([0,0,15,1,_>>>24&255,_>>>16&255,_>>>8&255,_&255,O>>>24&255,O>>>16&255,O>>>8&255,O&255],0),l=0;l<_;l++)r=S[l],s=r.duration,a=r.size,e=r.flags,t=r.cts,h.set([s>>>24&255,s>>>16&255,s>>>8&255,s&255,a>>>24&255,a>>>16&255,a>>>8&255,a&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*l);return C.box(C.types.trun,h)},C.initSegment=function(U){C.types||C.init();var O=C.moov(U),S=new Uint8Array(C.FTYP.byteLength+O.byteLength);return S.set(C.FTYP),S.set(O,C.FTYP.byteLength),S},C}();L.types=void 0,L.HDLR_TYPES=void 0,L.STTS=void 0,L.STSC=void 0,L.STCO=void 0,L.STSZ=void 0,L.VMHD=void 0,L.SMHD=void 0,L.STSD=void 0,L.FTYP=void 0,L.DINF=void 0,W.default=L},"./src/remux/mp4-remuxer.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"default",function(){return t}),I.d(W,"normalizePts",function(){return n});var H=I("./src/polyfills/number.ts"),L=I("./src/remux/aac-helper.ts"),C=I("./src/remux/mp4-generator.ts"),j=I("./src/events.ts"),U=I("./src/errors.ts"),O=I("./src/utils/logger.ts"),S=I("./src/types/loader.ts"),_=I("./src/utils/timescale-conversion.ts");function b(){return b=Object.assign||function(y){for(var v=1;v<arguments.length;v++){var d=arguments[v];for(var u in d)Object.prototype.hasOwnProperty.call(d,u)&&(y[u]=d[u])}return y},b.apply(this,arguments)}var h=10*1e3,l=1024,r=1152,s=null,a=null,e=!1,t=function(){function y(d,u,i,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=d,this.config=u,this.typeSupported=i,this.ISGenerated=!1,s===null){var p=navigator.userAgent||"",f=p.match(/Chrome\/(\d+)/i);s=f?parseInt(f[1]):0}if(a===null){var c=navigator.userAgent.match(/Safari\/(\d+)/i);a=c?parseInt(c[1]):0}e=!!s&&s<75||!!a&&a<600}var v=y.prototype;return v.destroy=function(){},v.resetTimeStamp=function(u){O.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=u},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(u){var i=!1,o=u.reduce(function(p,f){var c=f.pts-p;return c<-4294967296?(i=!0,n(p,f.pts)):c>0?p:f.pts},u[0].pts);return i&&O.logger.debug("PTS rollover detected"),o},v.remux=function(u,i,o,p,f,c,w,A){var P,N,B,R,F,K,X=f,ee=f,oe=u.pid>-1,ce=i.pid>-1,le=i.samples.length,be=u.samples.length>0,pe=le>1,de=(!oe||be)&&(!ce||pe)||this.ISGenerated||w;if(de){this.ISGenerated||(B=this.generateIS(u,i,f));var te=this.isVideoContiguous,Le=-1;if(pe&&(Le=x(i.samples),!te&&this.config.forceKeyFrameOnDiscontinuity))if(K=!0,Le>0){O.logger.warn("[mp4-remuxer]: Dropped "+Le+" out of "+le+" video samples due to a missing keyframe");var Ve=this.getVideoStartPts(i.samples);i.samples=i.samples.slice(Le),i.dropped+=Le,ee+=(i.samples[0].pts-Ve)/(i.timescale||9e4)}else Le===-1&&(O.logger.warn("[mp4-remuxer]: No keyframe found out of "+le+" video samples"),K=!1);if(this.ISGenerated){if(be&&pe){var Ne=this.getVideoStartPts(i.samples),Be=n(u.samples[0].pts,Ne)-Ne,ve=Be/i.inputTimeScale;X+=Math.max(0,ve),ee+=Math.max(0,-ve)}if(be){if(u.samplerate||(O.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),B=this.generateIS(u,i,f)),N=this.remuxAudio(u,X,this.isAudioContiguous,c,ce||pe||A===S.PlaylistLevelType.AUDIO?ee:void 0),pe){var ye=N?N.endPTS-N.startPTS:0;i.inputTimeScale||(O.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),B=this.generateIS(u,i,f)),P=this.remuxVideo(i,ee,te,ye)}}else pe&&(P=this.remuxVideo(i,ee,te,0));P&&(P.firstKeyFrame=Le,P.independent=Le!==-1)}}return this.ISGenerated&&(o.samples.length&&(F=this.remuxID3(o,f)),p.samples.length&&(R=this.remuxText(p,f))),{audio:N,video:P,initSegment:B,independent:K,text:R,id3:F}},v.generateIS=function(u,i,o){var p=u.samples,f=i.samples,c=this.typeSupported,w={},A=!Object(H.isFiniteNumber)(this._initPTS),P="audio/mp4",N,B,R;if(A&&(N=B=Infinity),u.config&&p.length&&(u.timescale=u.samplerate,u.isAAC||(c.mpeg?(P="audio/mpeg",u.codec=""):c.mp3&&(u.codec="mp3")),w.audio={id:"audio",container:P,codec:u.codec,initSegment:!u.isAAC&&c.mpeg?new Uint8Array(0):C.default.initSegment([u]),metadata:{channelCount:u.channelCount}},A&&(R=u.inputTimeScale,N=B=p[0].pts-Math.round(R*o))),i.sps&&i.pps&&f.length&&(i.timescale=i.inputTimeScale,w.video={id:"main",container:"video/mp4",codec:i.codec,initSegment:C.default.initSegment([i]),metadata:{width:i.width,height:i.height}},A)){R=i.inputTimeScale;var F=this.getVideoStartPts(f),K=Math.round(R*o);B=Math.min(B,n(f[0].dts,F)-K),N=Math.min(N,F-K)}if(Object.keys(w).length)return this.ISGenerated=!0,A&&(this._initPTS=N,this._initDTS=B),{tracks:w,initPTS:N,timescale:R}},v.remuxVideo=function(u,i,o,p){var f=u.inputTimeScale,c=u.samples,w=[],A=c.length,P=this._initPTS,N=this.nextAvcDts,B=8,R,F,K,X=Number.POSITIVE_INFINITY,ee=Number.NEGATIVE_INFINITY,oe=0,ce=!1;if(!o||N===null){var le=i*f,be=c[0].pts-n(c[0].dts,c[0].pts);N=le-be}for(var pe=0;pe<A;pe++){var de=c[pe];if(de.pts=n(de.pts-P,N),de.dts=n(de.dts-P,N),de.dts>de.pts){var te=9e4*.2;oe=Math.max(Math.min(oe,de.pts-de.dts),-1*te)}de.dts<c[pe>0?pe-1:pe].dts&&(ce=!0)}ce&&c.sort(function(et,$e){var He=et.dts-$e.dts,at=et.pts-$e.pts;return He||at}),F=c[0].dts,K=c[c.length-1].dts;var Le=Math.round((K-F)/(A-1));if(oe<0){if(oe<Le*-2){O.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(_.toMsFromMpegTsClock)(-Le,!0)+" ms");for(var Ve=oe,Ne=0;Ne<A;Ne++)c[Ne].dts=Ve=Math.max(Ve,c[Ne].pts-Le),c[Ne].pts=Math.max(Ve,c[Ne].pts)}else{O.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(_.toMsFromMpegTsClock)(oe,!0)+" ms to overcome this issue");for(var Be=0;Be<A;Be++)c[Be].dts=c[Be].dts+oe}F=c[0].dts}if(o){var ve=F-N,ye=ve>Le,Ie=ve<-1;if(ye||Ie){ye?O.logger.warn("AVC: "+Object(_.toMsFromMpegTsClock)(ve,!0)+" ms ("+ve+"dts) hole between fragments detected, filling it"):O.logger.warn("AVC: "+Object(_.toMsFromMpegTsClock)(-ve,!0)+" ms ("+ve+"dts) overlapping between fragments detected"),F=N;var Ae=c[0].pts-ve;c[0].dts=F,c[0].pts=Ae,O.logger.log("Video: First PTS/DTS adjusted: "+Object(_.toMsFromMpegTsClock)(Ae,!0)+"/"+Object(_.toMsFromMpegTsClock)(F,!0)+", delta: "+Object(_.toMsFromMpegTsClock)(ve,!0)+" ms")}}e&&(F=Math.max(0,F));for(var ge=0,Ce=0,Oe=0;Oe<A;Oe++){for(var Se=c[Oe],De=Se.units,je=De.length,Me=0,Fe=0;Fe<je;Fe++)Me+=De[Fe].data.length;Ce+=Me,ge+=je,Se.length=Me,Se.dts=Math.max(Se.dts,F),Se.pts=Math.max(Se.pts,Se.dts,0),X=Math.min(Se.pts,X),ee=Math.max(Se.pts,ee)}K=c[A-1].dts;var We=Ce+4*ge+8,ze;try{ze=new Uint8Array(We)}catch(et){this.observer.emit(j.Events.ERROR,j.Events.ERROR,{type:U.ErrorTypes.MUX_ERROR,details:U.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:We,reason:"fail allocating video mdat "+We});return}var ne=new DataView(ze.buffer);ne.setUint32(0,We),ze.set(C.default.types.mdat,4);for(var ue=0;ue<A;ue++){for(var me=c[ue],_e=me.units,se=0,fe=0,Z=_e.length;fe<Z;fe++){var Q=_e[fe],$=Q.data,V=Q.data.byteLength;ne.setUint32(B,V),B+=4,ze.set($,B),B+=V,se+=4+V}if(ue<A-1)R=c[ue+1].dts-me.dts;else{var Y=this.config,J=me.dts-c[ue>0?ue-1:ue].dts;if(Y.stretchShortVideoTrack&&this.nextAudioPts!==null){var q=Math.floor(Y.maxBufferHole*f),ae=(p?X+p*f:this.nextAudioPts)-me.pts;ae>q?(R=ae-J,R<0&&(R=J),O.logger.log("[mp4-remuxer]: It is approximately "+ae/90+" ms to the next segment; using duration "+R/90+" ms for the last video frame.")):R=J}else R=J}var he=Math.round(me.pts-me.dts);w.push(new E(me.key,R,se,he))}if(w.length&&s&&s<70){var we=w[0].flags;we.dependsOn=2,we.isNonSync=0}console.assert(R!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=N=K+R,this.isVideoContiguous=!0;var Ue=C.default.moof(u.sequenceNumber++,F,b({},u,{samples:w})),Ke="video",Pe={data1:Ue,data2:ze,startPTS:X/f,endPTS:(ee+R)/f,startDTS:F/f,endDTS:N/f,type:Ke,hasAudio:!1,hasVideo:!0,nb:w.length,dropped:u.dropped};return u.samples=[],u.dropped=0,console.assert(ze.length,"MDAT length must not be zero"),Pe},v.remuxAudio=function(u,i,o,p,f){var c=u.inputTimeScale,w=u.samplerate?u.samplerate:c,A=c/w,P=u.isAAC?l:r,N=P*A,B=this._initPTS,R=!u.isAAC&&this.typeSupported.mpeg,F=[],K=u.samples,X=R?0:8,ee=this.nextAudioPts||-1,oe=i*c;if(this.isAudioContiguous=o=o||K.length&&ee>0&&(p&&Math.abs(oe-ee)<9e3||Math.abs(n(K[0].pts-B,oe)-ee)<20*N),K.forEach(function($){$.pts=n($.pts-B,oe)}),!o||ee<0){if(K=K.filter(function($){return $.pts>=0}),!K.length)return;f===0?ee=0:p?ee=Math.max(0,oe):ee=K[0].pts}if(u.isAAC)for(var ce=f!==void 0,le=this.config.maxAudioFramesDrift,be=0,pe=ee;be<K.length;be++){var de=K[be],te=de.pts,Le=te-pe,Ve=Math.abs(1e3*Le/c);if(Le<=-le*N&&ce)be===0&&(O.logger.warn("Audio frame @ "+(te/c).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Le/c)+" ms."),this.nextAudioPts=ee=pe=te);else if(Le>=le*N&&Ve<h&&ce){var Ne=Math.round(Le/N);pe=te-Ne*N,pe<0&&(Ne--,pe+=N),be===0&&(this.nextAudioPts=ee=pe),O.logger.warn("[mp4-remuxer]: Injecting "+Ne+" audio frame @ "+(pe/c).toFixed(3)+"s due to "+Math.round(1e3*Le/c)+" ms gap.");for(var Be=0;Be<Ne;Be++){var ve=Math.max(pe,0),ye=L.default.getSilentFrame(u.manifestCodec||u.codec,u.channelCount);ye||(O.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ye=de.unit.subarray()),K.splice(be,0,{unit:ye,pts:ve}),pe+=N,be++}}de.pts=pe,pe+=N}for(var Ie=null,Ae=null,ge,Ce=0,Oe=K.length;Oe--;)Ce+=K[Oe].unit.byteLength;for(var Se=0,De=K.length;Se<De;Se++){var je=K[Se],Me=je.unit,Fe=je.pts;if(Ae!==null){var We=F[Se-1];We.duration=Math.round((Fe-Ae)/A)}else if(o&&u.isAAC&&(Fe=ee),Ie=Fe,Ce>0){Ce+=X;try{ge=new Uint8Array(Ce)}catch($){this.observer.emit(j.Events.ERROR,j.Events.ERROR,{type:U.ErrorTypes.MUX_ERROR,details:U.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ce,reason:"fail allocating audio mdat "+Ce});return}if(!R){var ze=new DataView(ge.buffer);ze.setUint32(0,Ce),ge.set(C.default.types.mdat,4)}}else return;ge.set(Me,X);var ne=Me.byteLength;X+=ne,F.push(new E(!0,P,ne,0)),Ae=Fe}var ue=F.length;if(!ue)return;var me=F[F.length-1];this.nextAudioPts=ee=Ae+A*me.duration;var _e=R?new Uint8Array(0):C.default.moof(u.sequenceNumber++,Ie/A,b({},u,{samples:F}));u.samples=[];var se=Ie/c,fe=ee/c,Z="audio",Q={data1:_e,data2:ge,startPTS:se,endPTS:fe,startDTS:se,endDTS:fe,type:Z,hasAudio:!0,hasVideo:!1,nb:ue};return this.isAudioContiguous=!0,console.assert(ge.length,"MDAT length must not be zero"),Q},v.remuxEmptyAudio=function(u,i,o,p){var f=u.inputTimeScale,c=u.samplerate?u.samplerate:f,w=f/c,A=this.nextAudioPts,P=(A!==null?A:p.startDTS*f)+this._initDTS,N=p.endDTS*f+this._initDTS,B=w*l,R=Math.ceil((N-P)/B),F=L.default.getSilentFrame(u.manifestCodec||u.codec,u.channelCount);if(O.logger.warn("[mp4-remuxer]: remux empty Audio"),!F){O.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var K=[],X=0;X<R;X++){var ee=P+X*B;K.push({unit:F,pts:ee,dts:ee})}return u.samples=K,this.remuxAudio(u,i,o,!1)},v.remuxID3=function(u,i){var o=u.samples.length;if(!o)return;for(var p=u.inputTimeScale,f=this._initPTS,c=this._initDTS,w=0;w<o;w++){var A=u.samples[w];A.pts=n(A.pts-f,i*p)/p,A.dts=n(A.dts-c,i*p)/p}var P=u.samples;return u.samples=[],{samples:P}},v.remuxText=function(u,i){var o=u.samples.length;if(!o)return;for(var p=u.inputTimeScale,f=this._initPTS,c=0;c<o;c++){var w=u.samples[c];w.pts=n(w.pts-f,i*p)/p}u.samples.sort(function(P,N){return P.pts-N.pts});var A=u.samples;return u.samples=[],{samples:A}},y}();function n(y,v){var d;if(v===null)return y;for(v<y?d=-8589934592:d=8589934592;Math.abs(y-v)>4294967296;)y+=d;return y}function x(y){for(var v=0;v<y.length;v++)if(y[v].key)return v;return-1}var E=function(v,d,u,i){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=d,this.size=u,this.cts=i,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(re,W,I){"use strict";I.r(W);var H=I("./src/polyfills/number.ts"),L=I("./src/utils/mp4-tools.ts"),C=I("./src/loader/fragment.ts"),j=I("./src/utils/logger.ts"),U=function(){function _(){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 b=_.prototype;return b.destroy=function(){},b.resetTimeStamp=function(l){this.initPTS=l,this.lastEndDTS=null},b.resetNextTimestamp=function(){this.lastEndDTS=null},b.resetInitSegment=function(l,r,s){this.audioCodec=r,this.videoCodec=s,this.generateInitSegment(l),this.emitInitSegment=!0},b.generateInitSegment=function(l){var r=this.audioCodec,s=this.videoCodec;if(!l||!l.byteLength){this.initTracks=void 0,this.initData=void 0;return}var a=this.initData=Object(L.parseInitSegment)(l);r||(r=S(a.audio,C.ElementaryStreamTypes.AUDIO)),s||(s=S(a.video,C.ElementaryStreamTypes.VIDEO));var e={};a.audio&&a.video?e.audiovideo={container:"video/mp4",codec:r+","+s,initSegment:l,id:"main"}:a.audio?e.audio={container:"audio/mp4",codec:r,initSegment:l,id:"audio"}:a.video?e.video={container:"video/mp4",codec:s,initSegment:l,id:"main"}:j.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=e},b.remux=function(l,r,s,a,e){var t=this.initPTS,n=this.lastEndDTS,x={audio:void 0,video:void 0,text:a,id3:s,initSegment:void 0};Object(H.isFiniteNumber)(n)||(n=this.lastEndDTS=e||0);var E=r.samples;if(!E||!E.length)return x;var g={initPTS:void 0,timescale:1},y=this.initData;if((!y||!y.length)&&(this.generateInitSegment(E),y=this.initData),!y||!y.length)return j.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),x;this.emitInitSegment&&(g.tracks=this.initTracks,this.emitInitSegment=!1),Object(H.isFiniteNumber)(t)||(this.initPTS=g.initPTS=t=O(y,E,n));var v=Object(L.getDuration)(E,y),d=n,u=v+d;Object(L.offsetStartDTS)(y,E,t),v>0?this.lastEndDTS=u:(j.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var i=!!y.audio,o=!!y.video,p="";i&&(p+="audio"),o&&(p+="video");var f={data1:E,startPTS:d,startDTS:d,endPTS:u,endDTS:u,type:p,hasAudio:i,hasVideo:o,nb:1,dropped:0};return x.audio=f.type==="audio"?f:void 0,x.video=f.type!=="audio"?f:void 0,x.text=a,x.id3=s,x.initSegment=g,x},_}(),O=function(b,h,l){return Object(L.getStartDTS)(b,h)-l};function S(_,b){var h=_==null?void 0:_.codec;return h&&h.length>4?h:h==="hvc1"?"hvc1.1.c.L120.90":h==="av01"?"av01.0.04M.08":h==="avc1"||b===C.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}W.default=U},"./src/task-loop.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"default",function(){return H});var H=function(){function L(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var C=L.prototype;return C.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},C.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},C.onHandlerDestroyed=function(){},C.hasInterval=function(){return!!this._tickInterval},C.hasNextTick=function(){return!!this._tickTimer},C.setInterval=function(U){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,U),!0)},C.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},C.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},C.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},C.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},C.doTick=function(){},L}()},"./src/types/cmcd.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"CMCDVersion",function(){return H}),I.d(W,"CMCDObjectType",function(){return L}),I.d(W,"CMCDStreamingFormat",function(){return C}),I.d(W,"CMCDStreamType",function(){return j});var H=1,L;(function(U){U.MANIFEST="m",U.AUDIO="a",U.VIDEO="v",U.MUXED="av",U.INIT="i",U.CAPTION="c",U.TIMED_TEXT="tt",U.KEY="k",U.OTHER="o"})(L||(L={}));var C;(function(U){U.DASH="d",U.HLS="h",U.SMOOTH="s",U.OTHER="o"})(C||(C={}));var j;(function(U){U.VOD="v",U.LIVE="l"})(j||(j={}))},"./src/types/level.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"HlsSkip",function(){return C}),I.d(W,"getSkipValue",function(){return j}),I.d(W,"HlsUrlParameters",function(){return U}),I.d(W,"Level",function(){return O});function H(S,_){for(var b=0;b<_.length;b++){var h=_[b];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(S,h.key,h)}}function L(S,_,b){return _&&H(S.prototype,_),b&&H(S,b),S}var C;(function(S){S.No="",S.Yes="YES",S.v2="v2"})(C||(C={}));function j(S,_){var b=S.canSkipUntil,h=S.canSkipDateRanges,l=S.endSN,r=_!==void 0?_-l:0;return b&&r<b?h?C.v2:C.Yes:C.No}var U=function(){function S(b,h,l){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=b,this.part=h,this.skip=l}var _=S.prototype;return _.addDirectives=function(h){var l=new self.URL(h);return this.msn!==void 0&&l.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&l.searchParams.set("_HLS_part",this.part.toString()),this.skip&&l.searchParams.set("_HLS_skip",this.skip),l.toString()},S}(),O=function(){function S(_){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[_.url],this.attrs=_.attrs,this.bitrate=_.bitrate,_.details&&(this.details=_.details),this.id=_.id||0,this.name=_.name,this.width=_.width||0,this.height=_.height||0,this.audioCodec=_.audioCodec,this.videoCodec=_.videoCodec,this.unknownCodecs=_.unknownCodecs,this.codecSet=[_.videoCodec,_.audioCodec].filter(function(b){return b}).join(",").replace(/\.[^.,]+/g,"")}return L(S,[{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(b){var h=b%this.url.length;this._urlId!==h&&(this.details=void 0,this._urlId=h)}}]),S}()},"./src/types/loader.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"PlaylistContextType",function(){return H}),I.d(W,"PlaylistLevelType",function(){return L});var H;(function(C){C.MANIFEST="manifest",C.LEVEL="level",C.AUDIO_TRACK="audioTrack",C.SUBTITLE_TRACK="subtitleTrack"})(H||(H={}));var L;(function(C){C.MAIN="main",C.AUDIO="audio",C.SUBTITLE="subtitle"})(L||(L={}))},"./src/types/transmuxer.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"ChunkMetadata",function(){return H});var H=function(j,U,O,S,_,b){S===void 0&&(S=0),_===void 0&&(_=-1),b===void 0&&(b=!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=L(),this.buffering={audio:L(),video:L(),audiovideo:L()},this.level=j,this.sn=U,this.id=O,this.size=S,this.part=_,this.partial=b};function L(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"AttrList",function(){return C});var H=/^(\d+)x(\d+)$/,L=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,C=function(){function j(O){typeof O=="string"&&(O=j.parseAttrList(O));for(var S in O)O.hasOwnProperty(S)&&(this[S]=O[S])}var U=j.prototype;return U.decimalInteger=function(S){var _=parseInt(this[S],10);return _>Number.MAX_SAFE_INTEGER?Infinity:_},U.hexadecimalInteger=function(S){if(this[S]){var _=(this[S]||"0x").slice(2);_=(_.length&1?"0":"")+_;for(var b=new Uint8Array(_.length/2),h=0;h<_.length/2;h++)b[h]=parseInt(_.slice(h*2,h*2+2),16);return b}else return null},U.hexadecimalIntegerAsNumber=function(S){var _=parseInt(this[S],16);return _>Number.MAX_SAFE_INTEGER?Infinity:_},U.decimalFloatingPoint=function(S){return parseFloat(this[S])},U.optionalFloat=function(S,_){var b=this[S];return b?parseFloat(b):_},U.enumeratedString=function(S){return this[S]},U.bool=function(S){return this[S]==="YES"},U.decimalResolution=function(S){var _=H.exec(this[S]);return _===null?void 0:{width:parseInt(_[1],10),height:parseInt(_[2],10)}},j.parseAttrList=function(S){var _,b={},h='"';for(L.lastIndex=0;(_=L.exec(S))!==null;){var l=_[2];l.indexOf(h)===0&&l.lastIndexOf(h)===l.length-1&&(l=l.slice(1,-1)),b[_[1]]=l}return b},j}()},"./src/utils/binary-search.ts":function(re,W,I){"use strict";I.r(W);var H={search:function(C,j){for(var U=0,O=C.length-1,S=null,_=null;U<=O;){S=(U+O)/2|0,_=C[S];var b=j(_);if(b>0)U=S+1;else if(b<0)O=S-1;else return _}return null}};W.default=H},"./src/utils/buffer-helper.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"BufferHelper",function(){return C});var H=I("./src/utils/logger.ts"),L={length:0,start:function(){return 0},end:function(){return 0}},C=function(){function j(){}return j.isBuffered=function(O,S){try{if(O){for(var _=j.getBuffered(O),b=0;b<_.length;b++)if(S>=_.start(b)&&S<=_.end(b))return!0}}catch(h){}return!1},j.bufferInfo=function(O,S,_){try{if(O){var b=j.getBuffered(O),h=[],l;for(l=0;l<b.length;l++)h.push({start:b.start(l),end:b.end(l)});return this.bufferedInfo(h,S,_)}}catch(r){}return{len:0,start:S,end:S,nextStart:void 0}},j.bufferedInfo=function(O,S,_){S=Math.max(0,S),O.sort(function(g,y){var v=g.start-y.start;return v||y.end-g.end});var b=[];if(_)for(var h=0;h<O.length;h++){var l=b.length;if(l){var r=b[l-1].end;O[h].start-r<_?O[h].end>r&&(b[l-1].end=O[h].end):b.push(O[h])}else b.push(O[h])}else b=O;for(var s=0,a,e=S,t=S,n=0;n<b.length;n++){var x=b[n].start,E=b[n].end;if(S+_>=x&&S<E)e=x,t=E,s=t-S;else if(S+_<x){a=x;break}}return{len:s,start:e||0,end:t||0,nextStart:a}},j.getBuffered=function(O){try{return O.buffered}catch(S){return H.logger.log("failed to get media.buffered",S),L}},j}()},"./src/utils/cea-608-parser.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"Row",function(){return t}),I.d(W,"CaptionScreen",function(){return n});var H=I("./src/utils/logger.ts"),L={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},C=function(u){var i=u;return L.hasOwnProperty(u)&&(i=L[u]),String.fromCharCode(i)},j=15,U=100,O={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},S={17:2,18:4,21:6,22:8,23:10,19:13,20:15},_={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},b={25:2,26:4,29:6,30:8,31:10,27:13,28:15},h=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],l;(function(d){d[d.ERROR=0]="ERROR",d[d.TEXT=1]="TEXT",d[d.WARNING=2]="WARNING",d[d.INFO=2]="INFO",d[d.DEBUG=3]="DEBUG",d[d.DATA=3]="DATA"})(l||(l={}));var r=function(){function d(){this.time=null,this.verboseLevel=l.ERROR}var u=d.prototype;return u.log=function(o,p){this.verboseLevel>=o&&H.logger.log(this.time+" ["+o+"] "+p)},d}(),s=function(u){for(var i=[],o=0;o<u.length;o++)i.push(u[o].toString(16));return i},a=function(){function d(i,o,p,f,c){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=i||"white",this.underline=o||!1,this.italics=p||!1,this.background=f||"black",this.flash=c||!1}var u=d.prototype;return u.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},u.setStyles=function(o){for(var p=["foreground","underline","italics","background","flash"],f=0;f<p.length;f++){var c=p[f];o.hasOwnProperty(c)&&(this[c]=o[c])}},u.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},u.equals=function(o){return this.foreground===o.foreground&&this.underline===o.underline&&this.italics===o.italics&&this.background===o.background&&this.flash===o.flash},u.copy=function(o){this.foreground=o.foreground,this.underline=o.underline,this.italics=o.italics,this.background=o.background,this.flash=o.flash},u.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},d}(),e=function(){function d(i,o,p,f,c,w){this.uchar=void 0,this.penState=void 0,this.uchar=i||" ",this.penState=new a(o,p,f,c,w)}var u=d.prototype;return u.reset=function(){this.uchar=" ",this.penState.reset()},u.setChar=function(o,p){this.uchar=o,this.penState.copy(p)},u.setPenState=function(o){this.penState.copy(o)},u.equals=function(o){return this.uchar===o.uchar&&this.penState.equals(o.penState)},u.copy=function(o){this.uchar=o.uchar,this.penState.copy(o.penState)},u.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},d}(),t=function(){function d(i){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<U;o++)this.chars.push(new e);this.logger=i,this.pos=0,this.currPenState=new a}var u=d.prototype;return u.equals=function(o){for(var p=!0,f=0;f<U;f++)if(!this.chars[f].equals(o.chars[f])){p=!1;break}return p},u.copy=function(o){for(var p=0;p<U;p++)this.chars[p].copy(o.chars[p])},u.isEmpty=function(){for(var o=!0,p=0;p<U;p++)if(!this.chars[p].isEmpty()){o=!1;break}return o},u.setCursor=function(o){this.pos!==o&&(this.pos=o),this.pos<0?(this.logger.log(l.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>U&&(this.logger.log(l.DEBUG,"Too large cursor position "+this.pos),this.pos=U)},u.moveCursor=function(o){var p=this.pos+o;if(o>1)for(var f=this.pos+1;f<p+1;f++)this.chars[f].setPenState(this.currPenState);this.setCursor(p)},u.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},u.insertChar=function(o){o>=144&&this.backSpace();var p=C(o);if(this.pos>=U){this.logger.log(l.ERROR,"Cannot insert "+o.toString(16)+" ("+p+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(p,this.currPenState),this.moveCursor(1)},u.clearFromPos=function(o){var p;for(p=o;p<U;p++)this.chars[p].reset()},u.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},u.clearToEndOfRow=function(){this.clearFromPos(this.pos)},u.getTextString=function(){for(var o=[],p=!0,f=0;f<U;f++){var c=this.chars[f].uchar;c!==" "&&(p=!1),o.push(c)}return p?"":o.join("")},u.setPenStyles=function(o){this.currPenState.setStyles(o);var p=this.chars[this.pos];p.setPenState(this.currPenState)},d}(),n=function(){function d(i){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<j;o++)this.rows.push(new t(i));this.logger=i,this.currRow=j-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var u=d.prototype;return u.reset=function(){for(var o=0;o<j;o++)this.rows[o].clear();this.currRow=j-1},u.equals=function(o){for(var p=!0,f=0;f<j;f++)if(!this.rows[f].equals(o.rows[f])){p=!1;break}return p},u.copy=function(o){for(var p=0;p<j;p++)this.rows[p].copy(o.rows[p])},u.isEmpty=function(){for(var o=!0,p=0;p<j;p++)if(!this.rows[p].isEmpty()){o=!1;break}return o},u.backSpace=function(){var o=this.rows[this.currRow];o.backSpace()},u.clearToEndOfRow=function(){var o=this.rows[this.currRow];o.clearToEndOfRow()},u.insertChar=function(o){var p=this.rows[this.currRow];p.insertChar(o)},u.setPen=function(o){var p=this.rows[this.currRow];p.setPenStyles(o)},u.moveCursor=function(o){var p=this.rows[this.currRow];p.moveCursor(o)},u.setCursor=function(o){this.logger.log(l.INFO,"setCursor: "+o);var p=this.rows[this.currRow];p.setCursor(o)},u.setPAC=function(o){this.logger.log(l.INFO,"pacData = "+JSON.stringify(o));var p=o.row-1;if(this.nrRollUpRows&&p<this.nrRollUpRows-1&&(p=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==p){for(var f=0;f<j;f++)this.rows[f].clear();var c=this.currRow+1-this.nrRollUpRows,w=this.lastOutputScreen;if(w){var A=w.rows[c].cueStartTime,P=this.logger.time;if(A&&P!==null&&A<P)for(var N=0;N<this.nrRollUpRows;N++)this.rows[p-this.nrRollUpRows+N+1].copy(w.rows[c+N])}}this.currRow=p;var B=this.rows[this.currRow];if(o.indent!==null){var R=o.indent,F=Math.max(R-1,0);B.setCursor(o.indent),o.color=B.chars[F].penState.foreground}var K={foreground:o.color,underline:o.underline,italics:o.italics,background:"black",flash:!1};this.setPen(K)},u.setBkgData=function(o){this.logger.log(l.INFO,"bkgData = "+JSON.stringify(o)),this.backSpace(),this.setPen(o),this.insertChar(32)},u.setRollUpRows=function(o){this.nrRollUpRows=o},u.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(l.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(l.TEXT,this.getDisplayText());var o=this.currRow+1-this.nrRollUpRows,p=this.rows.splice(o,1)[0];p.clear(),this.rows.splice(this.currRow,0,p),this.logger.log(l.INFO,"Rolling up")},u.getDisplayText=function(o){o=o||!1;for(var p=[],f="",c=-1,w=0;w<j;w++){var A=this.rows[w].getTextString();A&&(c=w+1,o?p.push("Row "+c+": '"+A+"'"):p.push(A.trim()))}return p.length>0&&(o?f="["+p.join(" | ")+"]":f=p.join(`
|
|
`)),f},u.getTextAndFormat=function(){return this.rows},d}(),x=function(){function d(i,o,p){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=i,this.outputFilter=o,this.mode=null,this.verbose=0,this.displayedMemory=new n(p),this.nonDisplayedMemory=new n(p),this.lastOutputScreen=new n(p),this.currRollUpRow=this.displayedMemory.rows[j-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=p}var u=d.prototype;return u.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[j-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},u.getHandler=function(){return this.outputFilter},u.setHandler=function(o){this.outputFilter=o},u.setPAC=function(o){this.writeScreen.setPAC(o)},u.setBkgData=function(o){this.writeScreen.setBkgData(o)},u.setMode=function(o){if(o===this.mode)return;this.mode=o,this.logger.log(l.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},u.insertChars=function(o){for(var p=0;p<o.length;p++)this.writeScreen.insertChar(o[p]);var f=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(l.INFO,f+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(l.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},u.ccRCL=function(){this.logger.log(l.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},u.ccBS=function(){if(this.logger.log(l.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},u.ccAOF=function(){},u.ccAON=function(){},u.ccDER=function(){this.logger.log(l.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},u.ccRU=function(o){this.logger.log(l.INFO,"RU("+o+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(o)},u.ccFON=function(){this.logger.log(l.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},u.ccRDC=function(){this.logger.log(l.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},u.ccTR=function(){this.logger.log(l.INFO,"TR"),this.setMode("MODE_TEXT")},u.ccRTD=function(){this.logger.log(l.INFO,"RTD"),this.setMode("MODE_TEXT")},u.ccEDM=function(){this.logger.log(l.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},u.ccCR=function(){this.logger.log(l.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},u.ccENM=function(){this.logger.log(l.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},u.ccEOC=function(){if(this.logger.log(l.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(l.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},u.ccTO=function(o){this.logger.log(l.INFO,"TO("+o+") - Tab Offset"),this.writeScreen.moveCursor(o)},u.ccMIDROW=function(o){var p={flash:!1};if(p.underline=o%2===1,p.italics=o>=46,p.italics)p.foreground="white";else{var f=Math.floor(o/2)-16,c=["white","green","blue","cyan","red","yellow","magenta"];p.foreground=c[f]}this.logger.log(l.INFO,"MIDROW: "+JSON.stringify(p)),this.writeScreen.setPen(p)},u.outputDataUpdate=function(o){o===void 0&&(o=!1);var p=this.logger.time;if(p===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=p:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,p,this.lastOutputScreen),o&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:p),this.lastOutputScreen.copy(this.displayedMemory))},u.cueSplitAtTime=function(o){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,o,this.displayedMemory),this.cueStartTime=o))},d}(),E=function(){function d(i,o,p){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var f=new r;this.channels=[null,new x(i,o,f),new x(i+1,p,f)],this.cmdHistory=v(),this.logger=f}var u=d.prototype;return u.getHandler=function(o){return this.channels[o].getHandler()},u.setHandler=function(o,p){this.channels[o].setHandler(p)},u.addData=function(o,p){var f,c,w,A=!1;this.logger.time=o;for(var P=0;P<p.length;P+=2){if(c=p[P]&127,w=p[P+1]&127,c===0&&w===0)continue;if(this.logger.log(l.DATA,"["+s([p[P],p[P+1]])+"] -> ("+s([c,w])+")"),f=this.parseCmd(c,w),f||(f=this.parseMidrow(c,w)),f||(f=this.parsePAC(c,w)),f||(f=this.parseBackgroundAttributes(c,w)),!f&&(A=this.parseChars(c,w),A)){var N=this.currentChannel;if(N&&N>0){var B=this.channels[N];B.insertChars(A)}else this.logger.log(l.WARNING,"No channel found yet. TEXT-MODE?")}!f&&!A&&this.logger.log(l.WARNING,"Couldn't parse cleaned data "+s([c,w])+" orig: "+s([p[P],p[P+1]]))}},u.parseCmd=function(o,p){var f=this.cmdHistory,c=(o===20||o===28||o===21||o===29)&&p>=32&&p<=47,w=(o===23||o===31)&&p>=33&&p<=35;if(!(c||w))return!1;if(y(o,p,f))return g(null,null,f),this.logger.log(l.DEBUG,"Repeated command ("+s([o,p])+") is dropped"),!0;var A=o===20||o===21||o===23?1:2,P=this.channels[A];return o===20||o===21||o===28||o===29?p===32?P.ccRCL():p===33?P.ccBS():p===34?P.ccAOF():p===35?P.ccAON():p===36?P.ccDER():p===37?P.ccRU(2):p===38?P.ccRU(3):p===39?P.ccRU(4):p===40?P.ccFON():p===41?P.ccRDC():p===42?P.ccTR():p===43?P.ccRTD():p===44?P.ccEDM():p===45?P.ccCR():p===46?P.ccENM():p===47&&P.ccEOC():P.ccTO(p-32),g(o,p,f),this.currentChannel=A,!0},u.parseMidrow=function(o,p){var f=0;if((o===17||o===25)&&p>=32&&p<=47){if(o===17?f=1:f=2,f!==this.currentChannel)return this.logger.log(l.ERROR,"Mismatch channel in midrow parsing"),!1;var c=this.channels[f];return c?(c.ccMIDROW(p),this.logger.log(l.DEBUG,"MIDROW ("+s([o,p])+")"),!0):!1}return!1},u.parsePAC=function(o,p){var f,c=this.cmdHistory,w=(o>=17&&o<=23||o>=25&&o<=31)&&p>=64&&p<=127,A=(o===16||o===24)&&p>=64&&p<=95;if(!(w||A))return!1;if(y(o,p,c))return g(null,null,c),!0;var P=o<=23?1:2;p>=64&&p<=95?f=P===1?O[o]:_[o]:f=P===1?S[o]:b[o];var N=this.channels[P];return N?(N.setPAC(this.interpretPAC(f,p)),g(o,p,c),this.currentChannel=P,!0):!1},u.interpretPAC=function(o,p){var f,c={color:null,italics:!1,indent:null,underline:!1,row:o};return p>95?f=p-96:f=p-64,c.underline=(f&1)===1,f<=13?c.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(f/2)]:f<=15?(c.italics=!0,c.color="white"):c.indent=Math.floor((f-16)/2)*4,c},u.parseChars=function(o,p){var f,c=null,w=null;if(o>=25?(f=2,w=o-8):(f=1,w=o),w>=17&&w<=19){var A;w===17?A=p+80:w===18?A=p+112:A=p+144,this.logger.log(l.INFO,"Special char '"+C(A)+"' in channel "+f),c=[A]}else o>=32&&o<=127&&(c=p===0?[o]:[o,p]);if(c){var P=s(c);this.logger.log(l.DEBUG,"Char codes = "+P.join(",")),g(o,p,this.cmdHistory)}return c},u.parseBackgroundAttributes=function(o,p){var f=(o===16||o===24)&&p>=32&&p<=47,c=(o===23||o===31)&&p>=45&&p<=47;if(!(f||c))return!1;var w,A={};o===16||o===24?(w=Math.floor((p-32)/2),A.background=h[w],p%2===1&&(A.background=A.background+"_semi")):p===45?A.background="transparent":(A.foreground="black",p===47&&(A.underline=!0));var P=o<=23?1:2,N=this.channels[P];return N.setBkgData(A),g(o,p,this.cmdHistory),!0},u.reset=function(){for(var o=0;o<Object.keys(this.channels).length;o++){var p=this.channels[o];p&&p.reset()}this.cmdHistory=v()},u.cueSplitAtTime=function(o){for(var p=0;p<this.channels.length;p++){var f=this.channels[p];f&&f.cueSplitAtTime(o)}},d}();function g(d,u,i){i.a=d,i.b=u}function y(d,u,i){return i.a===d&&i.b===u}function v(){return{a:null,b:null}}W.default=E},"./src/utils/codecs.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"isCodecType",function(){return L}),I.d(W,"isCodecSupportedInMp4",function(){return C});var H={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 L(j,U){var O=H[U];return!!O&&O[j.slice(0,4)]===!0}function C(j,U){return MediaSource.isTypeSupported((U||"video")+'/mp4;codecs="'+j+'"')}},"./src/utils/cues.ts":function(re,W,I){"use strict";I.r(W);var H=I("./src/utils/vttparser.ts"),L=I("./src/utils/webvtt-parser.ts"),C=I("./src/utils/texttrack-utils.ts"),j=/\s/,U={newCue:function(S,_,b,h){for(var l=[],r,s,a,e,t,n=self.VTTCue||self.TextTrackCue,x=0;x<h.rows.length;x++)if(r=h.rows[x],a=!0,e=0,t="",!r.isEmpty()){for(var E=0;E<r.chars.length;E++)j.test(r.chars[E].uchar)&&a?e++:(t+=r.chars[E].uchar,a=!1);r.cueStartTime=_,_===b&&(b+=1e-4),e>=16?e--:e++;var g=Object(H.fixLineBreaks)(t.trim()),y=Object(L.generateCueId)(_,b,g);(!S||!S.cues||!S.cues.getCueById(y))&&(s=new n(_,b,g),s.id=y,s.line=x+1,s.align="left",s.position=10+Math.min(80,Math.floor(e*8/32)*10),l.push(s))}return S&&l.length&&(l.sort(function(v,d){return v.line==="auto"||d.line==="auto"?0:v.line>8&&d.line>8?d.line-v.line:v.line-d.line}),l.forEach(function(v){return Object(C.addCueToTrack)(S,v)})),l}};W.default=U},"./src/utils/discontinuities.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"findFirstFragWithCC",function(){return j}),I.d(W,"shouldAlignOnDiscontinuities",function(){return U}),I.d(W,"findDiscontinuousReferenceFrag",function(){return O}),I.d(W,"adjustSlidingStart",function(){return _}),I.d(W,"alignStream",function(){return b}),I.d(W,"alignPDT",function(){return l}),I.d(W,"alignFragmentByPDTDelta",function(){return r}),I.d(W,"alignMediaPlaylistByPDT",function(){return s});var H=I("./src/polyfills/number.ts"),L=I("./src/utils/logger.ts"),C=I("./src/controller/level-helper.ts");function j(a,e){for(var t=null,n=0,x=a.length;n<x;n++){var E=a[n];if(E&&E.cc===e){t=E;break}}return t}function U(a,e,t){return!!(e.details&&(t.endCC>t.startCC||a&&a.cc<t.startCC))}function O(a,e){var t=a.fragments,n=e.fragments;if(!n.length||!t.length){L.logger.log("No fragments to align");return}var x=j(t,n[0].cc);if(!x||x&&!x.startPTS){L.logger.log("No frag in previous level to align on");return}return x}function S(a,e){if(a){var t=a.start+e;a.start=a.startPTS=t,a.endPTS=t+a.duration}}function _(a,e){for(var t=e.fragments,n=0,x=t.length;n<x;n++)S(t[n],a);e.fragmentHint&&S(e.fragmentHint,a),e.alignedSliding=!0}function b(a,e,t){if(!e)return;h(a,t,e),!t.alignedSliding&&e.details&&l(t,e.details),!t.alignedSliding&&e.details&&!t.skippedSegments&&Object(C.adjustSliding)(e.details,t)}function h(a,e,t){if(U(a,t,e)){var n=O(t.details,e);n&&Object(H.isFiniteNumber)(n.start)&&(L.logger.log("Adjusting PTS using last level due to CC increase within current level "+e.url),_(n.start,e))}}function l(a,e){if(!e.fragments.length||!a.hasProgramDateTime||!e.hasProgramDateTime)return;var t=e.fragments[0].programDateTime,n=a.fragments[0].programDateTime,x=(n-t)/1e3+e.fragments[0].start;x&&Object(H.isFiniteNumber)(x)&&(L.logger.log("Adjusting PTS using programDateTime delta "+(n-t)+"ms, sliding:"+x.toFixed(3)+" "+a.url+" "),_(x,a))}function r(a,e){var t=a.programDateTime;if(!t)return;var n=(t-e)/1e3;a.start=a.startPTS=n,a.endPTS=n+a.duration}function s(a,e){if(!e.fragments.length||!a.hasProgramDateTime||!e.hasProgramDateTime)return;var t=e.fragments[0].programDateTime,n=e.fragments[0].start,x=t-n*1e3;a.fragments.forEach(function(E){r(E,x)}),a.fragmentHint&&r(a.fragmentHint,x),a.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(re,W,I){"use strict";I.r(W);var H=I("./src/utils/ewma.ts"),L=function(){function C(U,O,S){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=S,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new H.default(U),this.fast_=new H.default(O)}var j=C.prototype;return j.update=function(O,S){var _=this.slow_,b=this.fast_;this.slow_.halfLife!==O&&(this.slow_=new H.default(O,_.getEstimate(),_.getTotalWeight())),this.fast_.halfLife!==S&&(this.fast_=new H.default(S,b.getEstimate(),b.getTotalWeight()))},j.sample=function(O,S){O=Math.max(O,this.minDelayMs_);var _=8*S,b=O/1e3,h=_/b;this.fast_.sample(b,h),this.slow_.sample(b,h)},j.canEstimate=function(){var O=this.fast_;return O&&O.getTotalWeight()>=this.minWeight_},j.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},j.destroy=function(){},C}();W.default=L},"./src/utils/ewma.ts":function(re,W,I){"use strict";I.r(W);var H=function(){function L(j,U,O){U===void 0&&(U=0),O===void 0&&(O=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=j,this.alpha_=j?Math.exp(Math.log(.5)/j):0,this.estimate_=U,this.totalWeight_=O}var C=L.prototype;return C.sample=function(U,O){var S=Math.pow(this.alpha_,U);this.estimate_=O*(1-S)+S*this.estimate_,this.totalWeight_+=U},C.getTotalWeight=function(){return this.totalWeight_},C.getEstimate=function(){if(this.alpha_){var U=1-Math.pow(this.alpha_,this.totalWeight_);if(U)return this.estimate_/U}return this.estimate_},L}();W.default=H},"./src/utils/fetch-loader.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"fetchSupported",function(){return r});var H=I("./src/polyfills/number.ts"),L=I("./src/loader/load-stats.ts"),C=I("./src/demux/chunk-cache.ts");function j(n,x){n.prototype=Object.create(x.prototype),n.prototype.constructor=n,b(n,x)}function U(n){var x=typeof Map=="function"?new Map:void 0;return U=function(g){if(g===null||!_(g))return g;if(typeof g!="function")throw new TypeError("Super expression must either be null or a function");if(typeof x!="undefined"){if(x.has(g))return x.get(g);x.set(g,y)}function y(){return O(g,arguments,h(this).constructor)}return y.prototype=Object.create(g.prototype,{constructor:{value:y,enumerable:!1,writable:!0,configurable:!0}}),b(y,g)},U(n)}function O(n,x,E){return S()?O=Reflect.construct:O=function(y,v,d){var u=[null];u.push.apply(u,v);var i=Function.bind.apply(y,u),o=new i;return d&&b(o,d.prototype),o},O.apply(null,arguments)}function S(){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 _(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function b(n,x){return b=Object.setPrototypeOf||function(g,y){return g.__proto__=y,g},b(n,x)}function h(n){return h=Object.setPrototypeOf?Object.getPrototypeOf:function(E){return E.__proto__||Object.getPrototypeOf(E)},h(n)}function l(){return l=Object.assign||function(n){for(var x=1;x<arguments.length;x++){var E=arguments[x];for(var g in E)Object.prototype.hasOwnProperty.call(E,g)&&(n[g]=E[g])}return n},l.apply(this,arguments)}function r(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(n){}return!1}var s=function(){function n(E){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=E.fetchSetup||e,this.controller=new self.AbortController,this.stats=new L.LoadStats}var x=n.prototype;return x.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},x.abortInternal=function(){var g=this.response;(!g||!g.ok)&&(this.stats.aborted=!0,this.controller.abort())},x.abort=function(){var g;this.abortInternal(),(g=this.callbacks)!==null&&g!==void 0&&g.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},x.load=function(g,y,v){var d=this,u=this.stats;if(u.loading.start)throw new Error("Loader can only be used once.");u.loading.start=self.performance.now();var i=a(g,this.controller.signal),o=v.onProgress,p=g.responseType==="arraybuffer",f=p?"byteLength":"length";this.context=g,this.config=y,this.callbacks=v,this.request=this.fetchSetup(g,i),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){d.abortInternal(),v.onTimeout(u,g,d.response)},y.timeout),self.fetch(this.request).then(function(c){if(d.response=d.loader=c,!c.ok){var w=c.status,A=c.statusText;throw new t(A||"fetch, bad network response",w,c)}return u.loading.first=Math.max(self.performance.now(),u.loading.start),u.total=parseInt(c.headers.get("Content-Length")||"0"),o&&Object(H.isFiniteNumber)(y.highWaterMark)?d.loadProgressively(c,u,g,y.highWaterMark,o):p?c.arrayBuffer():c.text()}).then(function(c){var w=d.response;self.clearTimeout(d.requestTimeout),u.loading.end=Math.max(self.performance.now(),u.loading.first),u.loaded=u.total=c[f];var A={url:w.url,data:c};o&&!Object(H.isFiniteNumber)(y.highWaterMark)&&o(u,g,c,w),v.onSuccess(A,u,g,w)}).catch(function(c){if(self.clearTimeout(d.requestTimeout),u.aborted)return;var w=c.code||0;v.onError({code:w,text:c.message},g,c.details)})},x.getCacheAge=function(){var g=null;if(this.response){var y=this.response.headers.get("age");g=y?parseFloat(y):null}return g},x.loadProgressively=function(g,y,v,d,u){d===void 0&&(d=0);var i=new C.default,o=g.body.getReader(),p=function f(){return o.read().then(function(c){if(c.done)return i.dataLength&&u(y,v,i.flush(),g),Promise.resolve(new ArrayBuffer(0));var w=c.value,A=w.length;return y.loaded+=A,A<d||i.dataLength?(i.push(w),i.dataLength>=d&&u(y,v,i.flush(),g)):u(y,v,w,g),f()}).catch(function(){return Promise.reject()})};return p()},n}();function a(n,x){var E={method:"GET",mode:"cors",credentials:"same-origin",signal:x,headers:new self.Headers(l({},n.headers))};return n.rangeEnd&&E.headers.set("Range","bytes="+n.rangeStart+"-"+String(n.rangeEnd-1)),E}function e(n,x){return new self.Request(n.url,x)}var t=function(n){j(x,n);function x(E,g,y){var v;return v=n.call(this,E)||this,v.code=void 0,v.details=void 0,v.code=g,v.details=y,v}return x}(U(Error));W.default=s},"./src/utils/imsc1-ttml-parser.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"IMSC1_CODEC",function(){return _}),I.d(W,"parseIMSC1",function(){return r});var H=I("./src/utils/mp4-tools.ts"),L=I("./src/utils/vttparser.ts"),C=I("./src/utils/vttcue.ts"),j=I("./src/demux/id3.ts"),U=I("./src/utils/timescale-conversion.ts"),O=I("./src/utils/webvtt-parser.ts");function S(){return S=Object.assign||function(d){for(var u=1;u<arguments.length;u++){var i=arguments[u];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(d[o]=i[o])}return d},S.apply(this,arguments)}var _="stpp.ttml.im1t",b=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,h=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,l={left:"start",center:"center",right:"end",start:"start",end:"end"};function r(d,u,i,o,p){var f=Object(H.findBox)(new Uint8Array(d),["mdat"]);if(f.length===0){p(new Error("Could not parse IMSC1 mdat"));return}var c=f[0],w=Object(j.utf8ArrayToStr)(new Uint8Array(d,c.start,c.end-c.start)),A=Object(U.toTimescaleFromScale)(u,1,i);try{o(s(w,A))}catch(P){p(P)}}function s(d,u){var i=new DOMParser,o=i.parseFromString(d,"text/xml"),p=o.getElementsByTagName("tt")[0];if(!p)throw new Error("Invalid ttml");var f={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},c=Object.keys(f).reduce(function(B,R){return B[R]=p.getAttribute("ttp:"+R)||f[R],B},{}),w=p.getAttribute("xml:space")!=="preserve",A=e(a(p,"styling","style")),P=e(a(p,"layout","region")),N=a(p,"body","[begin]");return[].map.call(N,function(B){var R=t(B,w);if(!R||!B.hasAttribute("begin"))return null;var F=g(B.getAttribute("begin"),c),K=g(B.getAttribute("dur"),c),X=g(B.getAttribute("end"),c);if(F===null)throw E(B);if(X===null){if(K===null)throw E(B);X=F+K}var ee=new C.default(F-u,X-u,R);ee.id=Object(O.generateCueId)(ee.startTime,ee.endTime,ee.text);var oe=P[B.getAttribute("region")],ce=A[B.getAttribute("style")];ee.position=10,ee.size=80;var le=n(oe,ce),be=le.textAlign;if(be){var pe=l[be];pe&&(ee.lineAlign=pe),ee.align=be}return S(ee,le),ee}).filter(function(B){return B!==null})}function a(d,u,i){var o=d.getElementsByTagName(u)[0];return o?[].slice.call(o.querySelectorAll(i)):[]}function e(d){return d.reduce(function(u,i){var o=i.getAttribute("xml:id");return o&&(u[o]=i),u},{})}function t(d,u){return[].slice.call(d.childNodes).reduce(function(i,o,p){var f;return o.nodeName==="br"&&p?i+`
|
|
`:(f=o.childNodes)!==null&&f!==void 0&&f.length?t(o,u):u?i+o.textContent.trim().replace(/\s+/g," "):i+o.textContent},"")}function n(d,u){var i="http://www.w3.org/ns/ttml#styling",o=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return o.reduce(function(p,f){var c=x(u,i,f)||x(d,i,f);return c&&(p[f]=c),p},{})}function x(d,u,i){return d.hasAttributeNS(u,i)?d.getAttributeNS(u,i):null}function E(d){return new Error("Could not parse ttml timestamp "+d)}function g(d,u){if(!d)return null;var i=Object(L.parseTimeStamp)(d);return i===null&&(b.test(d)?i=y(d,u):h.test(d)&&(i=v(d,u))),i}function y(d,u){var i=b.exec(d),o=(i[4]|0)+(i[5]|0)/u.subFrameRate;return(i[1]|0)*3600+(i[2]|0)*60+(i[3]|0)+o/u.frameRate}function v(d,u){var i=h.exec(d),o=Number(i[1]),p=i[2];switch(p){case"h":return o*3600;case"m":return o*60;case"ms":return o*1e3;case"f":return o/u.frameRate;case"t":return o/u.tickRate}return o}},"./src/utils/logger.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"enableLogs",function(){return O}),I.d(W,"logger",function(){return S});var H=function(){},L={trace:H,debug:H,log:H,warn:H,info:H,error:H},C=L;function j(_){var b=self.console[_];return b?b.bind(self.console,"["+_+"] >"):H}function U(_){for(var b=arguments.length,h=new Array(b>1?b-1:0),l=1;l<b;l++)h[l-1]=arguments[l];h.forEach(function(r){C[r]=_[r]?_[r].bind(_):j(r)})}function O(_){if(self.console&&_===!0||typeof _=="object"){U(_,"debug","log","info","warn","error");try{C.log()}catch(b){C=L}}else C=L}var S=C},"./src/utils/mediakeys-helper.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"KeySystems",function(){return H}),I.d(W,"requestMediaKeySystemAccess",function(){return L});var H;(function(C){C.WIDEVINE="com.widevine.alpha",C.PLAYREADY="com.microsoft.playready"})(H||(H={}));var L=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"getMediaSource",function(){return H});function H(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"bin2str",function(){return U}),I.d(W,"readUint16",function(){return O}),I.d(W,"readUint32",function(){return S}),I.d(W,"writeUint32",function(){return _}),I.d(W,"findBox",function(){return b}),I.d(W,"parseSegmentIndex",function(){return h}),I.d(W,"parseInitSegment",function(){return l}),I.d(W,"getStartDTS",function(){return r}),I.d(W,"getDuration",function(){return s}),I.d(W,"computeRawDurationFromSamples",function(){return a}),I.d(W,"offsetStartDTS",function(){return e}),I.d(W,"segmentValidRange",function(){return t}),I.d(W,"appendUint8Array",function(){return n});var H=I("./src/utils/typed-array.ts"),L=I("./src/loader/fragment.ts"),C=Math.pow(2,32)-1,j=[].push;function U(x){return String.fromCharCode.apply(null,x)}function O(x,E){"data"in x&&(E+=x.start,x=x.data);var g=x[E]<<8|x[E+1];return g<0?65536+g:g}function S(x,E){"data"in x&&(E+=x.start,x=x.data);var g=x[E]<<24|x[E+1]<<16|x[E+2]<<8|x[E+3];return g<0?4294967296+g:g}function _(x,E,g){"data"in x&&(E+=x.start,x=x.data),x[E]=g>>24,x[E+1]=g>>16&255,x[E+2]=g>>8&255,x[E+3]=g&255}function b(x,E){var g=[];if(!E.length)return g;var y,v,d;"data"in x?(y=x.data,v=x.start,d=x.end):(y=x,v=0,d=y.byteLength);for(var u=v;u<d;){var i=S(y,u),o=U(y.subarray(u+4,u+8)),p=i>1?u+i:d;if(o===E[0])if(E.length===1)g.push({data:y,start:u+8,end:p});else{var f=b({data:y,start:u+8,end:p},E.slice(1));f.length&&j.apply(g,f)}u=p}return g}function h(x){var E=b(x,["moov"]),g=E[0],y=g?g.end:null,v=b(x,["sidx"]);if(!v||!v[0])return null;var d=[],u=v[0],i=u.data[0],o=i===0?8:16,p=S(u,o);o+=4;var f=0,c=0;i===0?o+=8:o+=16,o+=2;var w=u.end+c,A=O(u,o);o+=2;for(var P=0;P<A;P++){var N=o,B=S(u,N);N+=4;var R=B&2147483647,F=(B&2147483648)>>>31;if(F===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var K=S(u,N);N+=4,d.push({referenceSize:R,subsegmentDuration:K,info:{duration:K/p,start:w,end:w+R-1}}),w+=R,N+=4,o=N}return{earliestPresentationTime:f,timescale:p,version:i,referencesCount:A,references:d,moovEndOffset:y}}function l(x){for(var E=[],g=b(x,["moov","trak"]),y=0;y<g.length;y++){var v=g[y],d=b(v,["tkhd"])[0];if(d){var u=d.data[d.start],i=u===0?12:20,o=S(d,i),p=b(v,["mdia","mdhd"])[0];if(p){u=p.data[p.start],i=u===0?12:20;var f=S(p,i),c=b(v,["mdia","hdlr"])[0];if(c){var w=U(c.data.subarray(c.start+8,c.start+12)),A={soun:L.ElementaryStreamTypes.AUDIO,vide:L.ElementaryStreamTypes.VIDEO}[w];if(A){var P=b(v,["mdia","minf","stbl","stsd"])[0],N=void 0;P&&(N=U(P.data.subarray(P.start+12,P.start+16))),E[o]={timescale:f,type:A},E[A]={timescale:f,id:o,codec:N}}}}}}var B=b(x,["moov","mvex","trex"]);return B.forEach(function(R){var F=S(R,4),K=E[F];K&&(K.default={duration:S(R,12),flags:S(R,20)})}),E}function r(x,E){return b(E,["moof","traf"]).reduce(function(g,y){var v=b(y,["tfdt"])[0],d=v.data[v.start],u=b(y,["tfhd"]).reduce(function(i,o){var p=S(o,4),f=x[p];if(f){var c=S(v,4);d===1&&(c*=Math.pow(2,32),c+=S(v,8));var w=f.timescale||9e4,A=c/w;if(isFinite(A)&&(i===null||A<i))return A}return i},null);return u!==null&&isFinite(u)&&(g===null||u<g)?u:g},null)||0}function s(x,E){for(var g=0,y=0,v=0,d=b(x,["moof","traf"]),u=0;u<d.length;u++){var i=d[u],o=b(i,["tfhd"])[0],p=S(o,4),f=E[p];if(!f)continue;var c=f.default,w=S(o,0)|(c==null?void 0:c.flags),A=c==null?void 0:c.duration;w&8&&(w&2?A=S(o,12):A=S(o,8));for(var P=f.timescale||9e4,N=b(i,["trun"]),B=0;B<N.length;B++){if(A){var R=S(N[B],4);g=A*R}else g=a(N[B]);f.type===L.ElementaryStreamTypes.VIDEO?y+=g/P:f.type===L.ElementaryStreamTypes.AUDIO&&(v+=g/P)}}if(y===0&&v===0){var F=h(x);if(F!=null&&F.references)return F.references.reduce(function(K,X){return K+X.info.duration||0},0)}return y||v}function a(x){var E=S(x,0),g=8;E&1&&(g+=4),E&4&&(g+=4);for(var y=0,v=S(x,4),d=0;d<v;d++){if(E&256){var u=S(x,g);y+=u,g+=4}E&512&&(g+=4),E&1024&&(g+=4),E&2048&&(g+=4)}return y}function e(x,E,g){b(E,["moof","traf"]).forEach(function(y){b(y,["tfhd"]).forEach(function(v){var d=S(v,4),u=x[d];if(!u)return;var i=u.timescale||9e4;b(y,["tfdt"]).forEach(function(o){var p=o.data[o.start],f=S(o,4);if(p===0)_(o,4,f-g*i);else{f*=Math.pow(2,32),f+=S(o,8),f-=g*i,f=Math.max(f,0);var c=Math.floor(f/(C+1)),w=Math.floor(f%(C+1));_(o,4,c),_(o,8,w)}})})})}function t(x){var E={valid:null,remainder:null},g=b(x,["moof"]);if(g){if(g.length<2)return E.remainder=x,E}else return E;var y=g[g.length-1];return E.valid=Object(H.sliceUint8)(x,0,y.start-8),E.remainder=Object(H.sliceUint8)(x,y.start-8),E}function n(x,E){var g=new Uint8Array(x.length+E.length);return g.set(x),g.set(E,x.length),g}},"./src/utils/output-filter.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"default",function(){return H});var H=function(){function L(j,U){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=j,this.trackName=U}var C=L.prototype;return C.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},C.newCue=function(U,O,S){(this.startTime===null||this.startTime>U)&&(this.startTime=U),this.endTime=O,this.screen=S,this.timelineController.createCaptionsTrack(this.trackName)},C.reset=function(){this.cueRanges=[]},L}()},"./src/utils/texttrack-utils.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"sendAddTrackEvent",function(){return L}),I.d(W,"addCueToTrack",function(){return C}),I.d(W,"clearCurrentCues",function(){return j}),I.d(W,"removeCuesInRange",function(){return U}),I.d(W,"getCuesInRange",function(){return S});var H=I("./src/utils/logger.ts");function L(_,b){var h;try{h=new Event("addtrack")}catch(l){h=document.createEvent("Event"),h.initEvent("addtrack",!1,!1)}h.track=_,b.dispatchEvent(h)}function C(_,b){var h=_.mode;if(h==="disabled"&&(_.mode="hidden"),_.cues&&!_.cues.getCueById(b.id))try{if(_.addCue(b),!_.cues.getCueById(b.id))throw new Error("addCue is failed for: "+b)}catch(r){H.logger.debug("[texttrack-utils]: "+r);var l=new self.TextTrackCue(b.startTime,b.endTime,b.text);l.id=b.id,_.addCue(l)}h==="disabled"&&(_.mode=h)}function j(_){var b=_.mode;if(b==="disabled"&&(_.mode="hidden"),_.cues)for(var h=_.cues.length;h--;)_.removeCue(_.cues[h]);b==="disabled"&&(_.mode=b)}function U(_,b,h){var l=_.mode;if(l==="disabled"&&(_.mode="hidden"),_.cues&&_.cues.length>0)for(var r=S(_.cues,b,h),s=0;s<r.length;s++)_.removeCue(r[s]);l==="disabled"&&(_.mode=l)}function O(_,b){if(b<_[0].startTime)return 0;var h=_.length-1;if(b>_[h].endTime)return-1;for(var l=0,r=h;l<=r;){var s=Math.floor((r+l)/2);if(b<_[s].startTime)r=s-1;else if(b>_[s].startTime&&l<h)l=s+1;else return s}return _[l].startTime-b<b-_[r].startTime?l:r}function S(_,b,h){var l=[],r=O(_,b);if(r>-1)for(var s=r,a=_.length;s<a;s++){var e=_[s];if(e.startTime>=b&&e.endTime<=h)l.push(e);else if(e.startTime>h)return l}return l}},"./src/utils/time-ranges.ts":function(re,W,I){"use strict";I.r(W);var H={toString:function(C){for(var j="",U=C.length,O=0;O<U;O++)j+="["+C.start(O).toFixed(3)+","+C.end(O).toFixed(3)+"]";return j}};W.default=H},"./src/utils/timescale-conversion.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"toTimescaleFromBase",function(){return L}),I.d(W,"toTimescaleFromScale",function(){return C}),I.d(W,"toMsFromMpegTsClock",function(){return j}),I.d(W,"toMpegTsClockFromTimescale",function(){return U});var H=9e4;function L(O,S,_,b){_===void 0&&(_=1),b===void 0&&(b=!1);var h=O*S*_;return b?Math.round(h):h}function C(O,S,_,b){return _===void 0&&(_=1),b===void 0&&(b=!1),L(O,S,1/_,b)}function j(O,S){return S===void 0&&(S=!1),L(O,1e3,1/H,S)}function U(O,S){return S===void 0&&(S=1),L(O,H,1/S)}},"./src/utils/typed-array.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"sliceUint8",function(){return H});function H(L,C,j){return Uint8Array.prototype.slice?L.slice(C,j):new Uint8Array(Array.prototype.slice.call(L,C,j))}},"./src/utils/vttcue.ts":function(re,W,I){"use strict";I.r(W),W.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var H=["","lr","rl"],L=["start","middle","end","left","right"];function C(_,b){if(typeof b!="string")return!1;if(!Array.isArray(_))return!1;var h=b.toLowerCase();return~_.indexOf(h)?h:!1}function j(_){return C(H,_)}function U(_){return C(L,_)}function O(_){for(var b=arguments.length,h=new Array(b>1?b-1:0),l=1;l<b;l++)h[l-1]=arguments[l];for(var r=1;r<arguments.length;r++){var s=arguments[r];for(var a in s)_[a]=s[a]}return _}function S(_,b,h){var l=this,r={enumerable:!0};l.hasBeenReset=!1;var s="",a=!1,e=_,t=b,n=h,x=null,E="",g=!0,y="auto",v="start",d=50,u="middle",i=50,o="middle";Object.defineProperty(l,"id",O({},r,{get:function(){return s},set:function(f){s=""+f}})),Object.defineProperty(l,"pauseOnExit",O({},r,{get:function(){return a},set:function(f){a=!!f}})),Object.defineProperty(l,"startTime",O({},r,{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(l,"endTime",O({},r,{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(l,"text",O({},r,{get:function(){return n},set:function(f){n=""+f,this.hasBeenReset=!0}})),Object.defineProperty(l,"region",O({},r,{get:function(){return x},set:function(f){x=f,this.hasBeenReset=!0}})),Object.defineProperty(l,"vertical",O({},r,{get:function(){return E},set:function(f){var c=j(f);if(c===!1)throw new SyntaxError("An invalid or illegal string was specified.");E=c,this.hasBeenReset=!0}})),Object.defineProperty(l,"snapToLines",O({},r,{get:function(){return g},set:function(f){g=!!f,this.hasBeenReset=!0}})),Object.defineProperty(l,"line",O({},r,{get:function(){return y},set:function(f){if(typeof f!="number"&&f!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");y=f,this.hasBeenReset=!0}})),Object.defineProperty(l,"lineAlign",O({},r,{get:function(){return v},set:function(f){var c=U(f);if(!c)throw new SyntaxError("An invalid or illegal string was specified.");v=c,this.hasBeenReset=!0}})),Object.defineProperty(l,"position",O({},r,{get:function(){return d},set:function(f){if(f<0||f>100)throw new Error("Position must be between 0 and 100.");d=f,this.hasBeenReset=!0}})),Object.defineProperty(l,"positionAlign",O({},r,{get:function(){return u},set:function(f){var c=U(f);if(!c)throw new SyntaxError("An invalid or illegal string was specified.");u=c,this.hasBeenReset=!0}})),Object.defineProperty(l,"size",O({},r,{get:function(){return i},set:function(f){if(f<0||f>100)throw new Error("Size must be between 0 and 100.");i=f,this.hasBeenReset=!0}})),Object.defineProperty(l,"align",O({},r,{get:function(){return o},set:function(f){var c=U(f);if(!c)throw new SyntaxError("An invalid or illegal string was specified.");o=c,this.hasBeenReset=!0}})),l.displayState=void 0}return S.prototype.getCueAsHTML=function(){var _=self.WebVTT;return _.convertCueToDOMTree(self,this.text)},S}()},"./src/utils/vttparser.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"parseTimeStamp",function(){return C}),I.d(W,"fixLineBreaks",function(){return b}),I.d(W,"VTTParser",function(){return h});var H=I("./src/utils/vttcue.ts"),L=function(){function l(){}var r=l.prototype;return r.decode=function(a,e){if(!a)return"";if(typeof a!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(a))},l}();function C(l){function r(a,e,t,n){return(a|0)*3600+(e|0)*60+(t|0)+parseFloat(n||0)}var s=l.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return s?parseFloat(s[2])>59?r(s[2],s[3],0,s[4]):r(s[1],s[2],s[3],s[4]):null}var j=function(){function l(){this.values=Object.create(null)}var r=l.prototype;return r.set=function(a,e){!this.get(a)&&e!==""&&(this.values[a]=e)},r.get=function(a,e,t){return t?this.has(a)?this.values[a]:e[t]:this.has(a)?this.values[a]:e},r.has=function(a){return a in this.values},r.alt=function(a,e,t){for(var n=0;n<t.length;++n)if(e===t[n]){this.set(a,e);break}},r.integer=function(a,e){/^-?\d+$/.test(e)&&this.set(a,parseInt(e,10))},r.percent=function(a,e){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(e)){var t=parseFloat(e);if(t>=0&&t<=100)return this.set(a,t),!0}return!1},l}();function U(l,r,s,a){var e=a?l.split(a):[l];for(var t in e){if(typeof e[t]!="string")continue;var n=e[t].split(s);if(n.length!==2)continue;var x=n[0],E=n[1];r(x,E)}}var O=new H.default(0,0,""),S=O.align==="middle"?"middle":"center";function _(l,r,s){var a=l;function e(){var x=C(l);if(x===null)throw new Error("Malformed timestamp: "+a);return l=l.replace(/^[^\sa-zA-Z-]+/,""),x}function t(x,E){var g=new j;U(x,function(d,u){var i;switch(d){case"region":for(var o=s.length-1;o>=0;o--)if(s[o].id===u){g.set(d,s[o].region);break}break;case"vertical":g.alt(d,u,["rl","lr"]);break;case"line":i=u.split(","),g.integer(d,i[0]),g.percent(d,i[0])&&g.set("snapToLines",!1),g.alt(d,i[0],["auto"]),i.length===2&&g.alt("lineAlign",i[1],["start",S,"end"]);break;case"position":i=u.split(","),g.percent(d,i[0]),i.length===2&&g.alt("positionAlign",i[1],["start",S,"end","line-left","line-right","auto"]);break;case"size":g.percent(d,u);break;case"align":g.alt(d,u,["start",S,"end","left","right"]);break}},/:/,/\s/),E.region=g.get("region",null),E.vertical=g.get("vertical","");var y=g.get("line","auto");y==="auto"&&O.line===-1&&(y=-1),E.line=y,E.lineAlign=g.get("lineAlign","start"),E.snapToLines=g.get("snapToLines",!0),E.size=g.get("size",100),E.align=g.get("align",S);var v=g.get("position","auto");v==="auto"&&O.position===50&&(v=E.align==="start"||E.align==="left"?0:E.align==="end"||E.align==="right"?100:50),E.position=v}function n(){l=l.replace(/^\s+/,"")}if(n(),r.startTime=e(),n(),l.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+a);l=l.substr(3),n(),r.endTime=e(),n(),t(l,r)}function b(l){return l.replace(/<br(?: \/)?>/gi,`
|
|
`)}var h=function(){function l(){this.state="INITIAL",this.buffer="",this.decoder=new L,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var r=l.prototype;return r.parse=function(a){var e=this;a&&(e.buffer+=e.decoder.decode(a,{stream:!0}));function t(){var v=e.buffer,d=0;for(v=b(v);d<v.length&&v[d]!=="\r"&&v[d]!==`
|
|
`;)++d;var u=v.substr(0,d);return v[d]==="\r"&&++d,v[d]===`
|
|
`&&++d,e.buffer=v.substr(d),u}function n(v){U(v,function(d,u){},/:/)}try{var x="";if(e.state==="INITIAL"){if(!/\r\n|\n/.test(e.buffer))return this;x=t();var E=x.match(/^()?WEBVTT([ \t].*)?$/);if(!E||!E[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:x=t();switch(e.state){case"HEADER":/:/.test(x)?n(x):x||(e.state="ID");continue;case"NOTE":x||(e.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(x)){e.state="NOTE";break}if(!x)continue;if(e.cue=new H.default(0,0,""),e.state="CUE",x.indexOf("-->")===-1){e.cue.id=x;continue}case"CUE":if(!e.cue){e.state="BADCUE";continue}try{_(x,e.cue,e.regionList)}catch(v){e.cue=null,e.state="BADCUE";continue}e.state="CUETEXT";continue;case"CUETEXT":{var y=x.indexOf("-->")!==-1;if(!x||y&&(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+=x}continue;case"BADCUE":x||(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},r.flush=function(){var a=this;try{if((a.cue||a.state==="HEADER")&&(a.buffer+=`
|
|
|
|
`,a.parse()),a.state==="INITIAL"||a.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(e){a.onparsingerror&&a.onparsingerror(e)}return a.onflush&&a.onflush(),this},l}()},"./src/utils/webvtt-parser.ts":function(re,W,I){"use strict";I.r(W),I.d(W,"generateCueId",function(){return h}),I.d(W,"parseWebVTT",function(){return r});var H=I("./src/polyfills/number.ts"),L=I("./src/utils/vttparser.ts"),C=I("./src/demux/id3.ts"),j=I("./src/utils/timescale-conversion.ts"),U=I("./src/remux/mp4-remuxer.ts"),O=/\r\n|\n\r|\n|\r/g,S=function(a,e,t){return t===void 0&&(t=0),a.substr(t,e.length)===e},_=function(a){var e=parseInt(a.substr(-3)),t=parseInt(a.substr(-6,2)),n=parseInt(a.substr(-9,2)),x=a.length>9?parseInt(a.substr(0,a.indexOf(":"))):0;if(!Object(H.isFiniteNumber)(e)||!Object(H.isFiniteNumber)(t)||!Object(H.isFiniteNumber)(n)||!Object(H.isFiniteNumber)(x))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+a);return e+=1e3*t,e+=60*1e3*n,e+=60*60*1e3*x,e},b=function(a){for(var e=5381,t=a.length;t;)e=e*33^a.charCodeAt(--t);return(e>>>0).toString()};function h(s,a,e){return b(s.toString())+b(a.toString())+b(e)}var l=function(a,e,t){var n=a[e],x=a[n.prevCC];if(!x||!x.new&&n.new){a.ccOffset=a.presentationOffset=n.start,n.new=!1;return}for(;(E=x)!==null&&E!==void 0&&E.new;){var E;a.ccOffset+=n.start-x.start,n.new=!1,n=x,x=a[n.prevCC]}a.presentationOffset=t};function r(s,a,e,t,n,x,E,g){var y=new L.VTTParser,v=Object(C.utf8ArrayToStr)(new Uint8Array(s)).trim().replace(O,`
|
|
`).split(`
|
|
`),d=[],u=Object(j.toMpegTsClockFromTimescale)(a,e),i="00:00.000",o=0,p=0,f,c=!0,w=!1;y.oncue=function(A){var P=t[n],N=t.ccOffset,B=(o-u)/9e4;if(P!=null&&P.new&&(p!==void 0?N=t.ccOffset=P.start:l(t,n,B)),B&&(N=B-t.presentationOffset),w){var R=A.endTime-A.startTime,F=Object(U.normalizePts)((A.startTime+N-p)*9e4,x*9e4)/9e4;A.startTime=F,A.endTime=F+R}var K=A.text.trim();A.text=decodeURIComponent(encodeURIComponent(K)),A.id||(A.id=h(A.startTime,A.endTime,K)),A.endTime>0&&d.push(A)},y.onparsingerror=function(A){f=A},y.onflush=function(){if(f){g(f);return}E(d)},v.forEach(function(A){if(c)if(S(A,"X-TIMESTAMP-MAP=")){c=!1,w=!0,A.substr(16).split(",").forEach(function(P){S(P,"LOCAL:")?i=P.substr(6):S(P,"MPEGTS:")&&(o=parseInt(P.substr(7)))});try{p=_(i)/1e3}catch(P){w=!1,f=P}return}else A===""&&(c=!1);y.parse(A+`
|
|
`)}),y.flush()}},"./src/utils/xhr-loader.ts":function(re,W,I){"use strict";I.r(W);var H=I("./src/utils/logger.ts"),L=I("./src/loader/load-stats.ts"),C=/^age:\s*[\d.]+\s*$/m,j=function(){function U(S){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=S?S.xhrSetup:null,this.stats=new L.LoadStats,this.retryDelay=0}var O=U.prototype;return O.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},O.abortInternal=function(){var _=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),_&&(_.onreadystatechange=null,_.onprogress=null,_.readyState!==4&&(this.stats.aborted=!0,_.abort()))},O.abort=function(){var _;this.abortInternal(),(_=this.callbacks)!==null&&_!==void 0&&_.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},O.load=function(_,b,h){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=_,this.config=b,this.callbacks=h,this.retryDelay=b.retryDelay,this.loadInternal()},O.loadInternal=function(){var _=this.config,b=this.context;if(!_)return;var h=this.loader=new self.XMLHttpRequest,l=this.stats;l.loading.first=0,l.loaded=0;var r=this.xhrSetup;try{if(r)try{r(h,b.url)}catch(e){h.open("GET",b.url,!0),r(h,b.url)}h.readyState||h.open("GET",b.url,!0);var s=this.context.headers;if(s)for(var a in s)h.setRequestHeader(a,s[a])}catch(e){this.callbacks.onError({code:h.status,text:e.message},b,h);return}b.rangeEnd&&h.setRequestHeader("Range","bytes="+b.rangeStart+"-"+(b.rangeEnd-1)),h.onreadystatechange=this.readystatechange.bind(this),h.onprogress=this.loadprogress.bind(this),h.responseType=b.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),_.timeout),h.send()},O.readystatechange=function(){var _=this.context,b=this.loader,h=this.stats;if(!_||!b)return;var l=b.readyState,r=this.config;if(h.aborted)return;if(l>=2)if(self.clearTimeout(this.requestTimeout),h.loading.first===0&&(h.loading.first=Math.max(self.performance.now(),h.loading.start)),l===4){b.onreadystatechange=null,b.onprogress=null;var s=b.status;if(s>=200&&s<300){h.loading.end=Math.max(self.performance.now(),h.loading.first);var a,e;if(_.responseType==="arraybuffer"?(a=b.response,e=a.byteLength):(a=b.responseText,e=a.length),h.loaded=h.total=e,!this.callbacks)return;var t=this.callbacks.onProgress;if(t&&t(h,_,a,b),!this.callbacks)return;var n={url:b.responseURL,data:a};this.callbacks.onSuccess(n,h,_,b)}else h.retry>=r.maxRetry||s>=400&&s<499?(H.logger.error(s+" while loading "+_.url),this.callbacks.onError({code:s,text:b.statusText},_,b)):(H.logger.warn(s+" while loading "+_.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,r.maxRetryDelay),h.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.timeout)},O.loadtimeout=function(){H.logger.warn("timeout while loading "+this.context.url);var _=this.callbacks;_&&(this.abortInternal(),_.onTimeout(this.stats,this.context,this.loader))},O.loadprogress=function(_){var b=this.stats;b.loaded=_.loaded,_.lengthComputable&&(b.total=_.total)},O.getCacheAge=function(){var _=null;if(this.loader&&C.test(this.loader.getAllResponseHeaders())){var b=this.loader.getResponseHeader("age");_=b?parseFloat(b):null}return _},U}();W.default=j}}).default})},vHTk:function(Ge,Ee,z){Ge.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wCXF:function(Ge,Ee,z){"use strict";z.d(Ee,"a",function(){return Me});var re=z("rePB"),W=z("VTBJ"),I=z("KQm4"),H=z("U8pU"),L=z("ODXe"),C=z("cDcd"),j=z("TSYQ"),U=z.n(j),O=z("Gytx"),S=z.n(O),_=z("Kwbf"),b=z("t23M"),h=z("qx4F"),l=z("6eGT"),r=z("IBYe"),s=z("Ff2n"),a=z("c+Xe"),e=z("fyJ8"),t=z("biw7");function n(ne,ue,me,_e,se){var fe=me[ne]||{},Z=me[ue]||{},Q,$;fe.fixed==="left"?Q=_e.left[ne]:Z.fixed==="right"&&($=_e.right[ue]);var V=!1,Y=!1,J=!1,q=!1,ae=me[ue+1],he=me[ne-1];if(se==="rtl"){if(Q!==void 0){var we=he&&he.fixed==="left";q=!we}else if($!==void 0){var Ue=ae&&ae.fixed==="right";J=!Ue}}else if(Q!==void 0){var Ke=ae&&ae.fixed==="left";V=!Ke}else if($!==void 0){var Pe=he&&he.fixed==="right";Y=!Pe}return{fixLeft:Q,fixRight:$,lastFixLeft:V,firstFixRight:Y,lastFixRight:J,firstFixLeft:q,isSticky:_e.isSticky}}var x=z("sR1s");function E(ne){var ue=ne.cells,me=ne.stickyOffsets,_e=ne.flattenColumns,se=ne.rowComponent,fe=ne.cellComponent,Z=ne.onHeaderRow,Q=ne.index,$=C.useContext(t.a),V=$.prefixCls,Y=$.direction,J;Z&&(J=Z(ue.map(function(ae){return ae.column}),Q));var q=Object(x.a)(ue.map(function(ae){return ae.column}));return C.createElement(se,Object.assign({},J),ue.map(function(ae,he){var we=ae.column,Ue=n(ae.colStart,ae.colEnd,_e,me,Y),Ke;return we&&we.onHeaderCell&&(Ke=ae.column.onHeaderCell(we)),C.createElement(e.a,Object.assign({},ae,{ellipsis:we.ellipsis,align:we.align,component:fe,prefixCls:V,key:q[he]},Ue,{additionalProps:Ke,rowType:"header"}))}))}E.displayName="HeaderRow";var g=E;function y(ne){var ue=[];function me(Z,Q){var $=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;ue[$]=ue[$]||[];var V=Q,Y=Z.filter(Boolean).map(function(J){var q={key:J.key,className:J.className||"",children:J.title,column:J,colStart:V},ae=1,he=J.children;return he&&he.length>0&&(ae=me(he,V,$+1).reduce(function(we,Ue){return we+Ue},0),q.hasSubColumns=!0),"colSpan"in J&&(ae=J.colSpan),"rowSpan"in J&&(q.rowSpan=J.rowSpan),q.colSpan=ae,q.colEnd=q.colStart+ae-1,ue[$].push(q),V+=ae,ae});return Y}me(ne,0);for(var _e=ue.length,se=function(Q){ue[Q].forEach(function($){!("rowSpan"in $)&&!$.hasSubColumns&&($.rowSpan=_e-Q)})},fe=0;fe<_e;fe+=1)se(fe);return ue}function v(ne){var ue=ne.stickyOffsets,me=ne.columns,_e=ne.flattenColumns,se=ne.onHeaderRow,fe=C.useContext(t.a),Z=fe.prefixCls,Q=fe.getComponent,$=C.useMemo(function(){return y(me)},[me]),V=Q(["header","wrapper"],"thead"),Y=Q(["header","row"],"tr"),J=Q(["header","cell"],"th");return C.createElement(V,{className:"".concat(Z,"-thead")},$.map(function(q,ae){var he=C.createElement(g,{key:ae,flattenColumns:_e,cells:q,stickyOffsets:ue,rowComponent:Y,cellComponent:J,onHeaderRow:se,index:ae});return he}))}var d=v,u=z("hW8S");function i(ne){for(var ue=ne.colWidths,me=ne.columns,_e=ne.columCount,se=[],fe=_e||me.length,Z=!1,Q=fe-1;Q>=0;Q-=1){var $=ue[Q],V=me&&me[Q],Y=V&&V[u.a];($||Y||Z)&&(se.unshift(C.createElement("col",Object.assign({key:Q,style:{width:$,minWidth:$}},Y))),Z=!0)}return C.createElement("colgroup",null,se)}var o=i;function p(ne,ue){return Object(C.useMemo)(function(){for(var me=[],_e=0;_e<ue;_e+=1){var se=ne[_e];if(se!==void 0)me[_e]=se;else return null}return me},[ne.join("_"),ue])}var f=C.forwardRef(function(ne,ue){var me=ne.noData,_e=ne.columns,se=ne.flattenColumns,fe=ne.colWidths,Z=ne.columCount,Q=ne.stickyOffsets,$=ne.direction,V=ne.fixHeader,Y=ne.offsetHeader,J=ne.stickyClassName,q=ne.onScroll,ae=Object(s.a)(ne,["noData","columns","flattenColumns","colWidths","columCount","stickyOffsets","direction","fixHeader","offsetHeader","stickyClassName","onScroll"]),he=C.useContext(t.a),we=he.prefixCls,Ue=he.scrollbarSize,Ke=he.isSticky,Pe=Ke&&!V?0:Ue,et=C.useRef(null),$e=C.useCallback(function(ot){Object(a.b)(ue,ot),Object(a.b)(et,ot)},[]);C.useEffect(function(){var ot;function dt(Te){var Xe=Te.currentTarget,tt=Te.deltaX;tt&&(q({currentTarget:Xe,scrollLeft:Xe.scrollLeft+tt}),Te.preventDefault())}return(ot=et.current)===null||ot===void 0||ot.addEventListener("wheel",dt),function(){var Te;(Te=et.current)===null||Te===void 0||Te.removeEventListener("wheel",dt)}},[]);var He=se[se.length-1],at={fixed:He?He.fixed:null,onHeaderCell:function(){return{className:"".concat(we,"-cell-scrollbar")}}},rt=Object(C.useMemo)(function(){return Pe?[].concat(Object(I.a)(_e),[at]):_e},[Pe,_e]),it=Object(C.useMemo)(function(){return Pe?[].concat(Object(I.a)(se),[at]):se},[Pe,se]),ht=Object(C.useMemo)(function(){var ot=Q.right,dt=Q.left;return Object(W.a)(Object(W.a)({},Q),{},{left:$==="rtl"?[].concat(Object(I.a)(dt.map(function(Te){return Te+Pe})),[0]):dt,right:$==="rtl"?ot:[].concat(Object(I.a)(ot.map(function(Te){return Te+Pe})),[0]),isSticky:Ke})},[Pe,Q,Ke]),qe=p(fe,Z);return C.createElement("div",{style:Object(W.a)({overflow:"hidden"},Ke?{top:Y}:{}),ref:$e,className:U()("".concat(we,"-header"),Object(re.a)({},J,!!J))},C.createElement("table",{style:{tableLayout:"fixed",visibility:me||qe?null:"hidden"}},C.createElement(o,{colWidths:qe?[].concat(Object(I.a)(qe),[Pe]):[],columCount:Z+1,columns:it}),C.createElement(d,Object.assign({},ae,{stickyOffsets:ht,columns:rt,flattenColumns:it}))))});f.displayName="FixedHeader";var c=f,w=C.createContext(null),A=w;function P(ne){var ue=ne.prefixCls,me=ne.children,_e=ne.component,se=ne.cellComponent,fe=ne.fixHeader,Z=ne.fixColumn,Q=ne.horizonScroll,$=ne.className,V=ne.expanded,Y=ne.componentWidth,J=ne.colSpan,q=C.useContext(t.a),ae=q.scrollbarSize;return C.useMemo(function(){var he=me;return Z&&(he=C.createElement("div",{style:{width:Y-(fe?ae:0),position:"sticky",left:0,overflow:"hidden"},className:"".concat(ue,"-expanded-row-fixed")},he)),C.createElement(_e,{className:$,style:{display:V?null:"none"}},C.createElement(e.a,{component:se,prefixCls:ue,colSpan:J},he))},[me,_e,fe,Q,$,V,Y,J,ae])}var N=P;function B(ne){var ue=ne.className,me=ne.style,_e=ne.record,se=ne.index,fe=ne.rowKey,Z=ne.getRowKey,Q=ne.rowExpandable,$=ne.expandedKeys,V=ne.onRow,Y=ne.indent,J=Y===void 0?0:Y,q=ne.rowComponent,ae=ne.cellComponent,he=ne.childrenColumnName,we=C.useContext(t.a),Ue=we.prefixCls,Ke=we.fixedInfoList,Pe=C.useContext(A),et=Pe.fixHeader,$e=Pe.fixColumn,He=Pe.horizonScroll,at=Pe.componentWidth,rt=Pe.flattenColumns,it=Pe.expandableType,ht=Pe.expandRowByClick,qe=Pe.onTriggerExpand,ot=Pe.rowClassName,dt=Pe.expandedRowClassName,Te=Pe.indentSize,Xe=Pe.expandIcon,tt=Pe.expandedRowRender,Qe=Pe.expandIconColumnIndex,st=C.useState(!1),Rt=Object(L.a)(st,2),At=Rt[0],Et=Rt[1],xt=$&&$.has(ne.recordKey);C.useEffect(function(){xt&&Et(!0)},[xt]);var Ct=it==="row"&&(!Q||Q(_e)),Ot=it==="nest",Mt=he&&_e&&_e[he],It=Ct||Ot,Tt;V&&(Tt=V(_e,se));var Ut=function(m){if(ht&&It&&qe(_e,m),Tt&&Tt.onClick){for(var T,D=arguments.length,G=new Array(D>1?D-1:0),k=1;k<D;k++)G[k-1]=arguments[k];(T=Tt).onClick.apply(T,[m].concat(G))}},kt;typeof ot=="string"?kt=ot:typeof ot=="function"&&(kt=ot(_e,se,J));var $t=Object(x.a)(rt),jt=C.createElement(q,Object.assign({},Tt,{"data-row-key":fe,className:U()(ue,"".concat(Ue,"-row"),"".concat(Ue,"-row-level-").concat(J),kt,Tt&&Tt.className),style:Object(W.a)(Object(W.a)({},me),Tt?Tt.style:null),onClick:Ut}),rt.map(function(M,m){var T=M.render,D=M.dataIndex,G=M.className,k=$t[m],ie=Ke[m],xe;m===(Qe||0)&&Ot&&(xe=C.createElement(C.Fragment,null,C.createElement("span",{style:{paddingLeft:"".concat(Te*J,"px")},className:"".concat(Ue,"-row-indent indent-level-").concat(J)}),Xe({prefixCls:Ue,expanded:xt,expandable:Mt,record:_e,onExpand:qe})));var ke;return M.onCell&&(ke=M.onCell(_e,se)),C.createElement(e.a,Object.assign({className:G,ellipsis:M.ellipsis,align:M.align,component:ae,prefixCls:Ue,key:k,record:_e,index:se,dataIndex:D,render:T,shouldCellUpdate:M.shouldCellUpdate},ie,{appendNode:xe,additionalProps:ke}))})),Lt;if(Ct&&(At||xt)){var Bt=tt(_e,se,J+1,xt),Ht=dt&&dt(_e,se,J);Lt=C.createElement(N,{expanded:xt,className:U()("".concat(Ue,"-expanded-row"),"".concat(Ue,"-expanded-row-level-").concat(J+1),Ht),prefixCls:Ue,fixHeader:et,fixColumn:$e,horizonScroll:He,component:q,componentWidth:at,cellComponent:ae,colSpan:rt.length},Bt)}var Qt;return Mt&&xt&&(Qt=(_e[he]||[]).map(function(M,m){var T=Z(M,m);return C.createElement(B,Object.assign({},ne,{key:T,rowKey:T,record:M,recordKey:T,index:m,indent:J+1}))})),C.createElement(C.Fragment,null,jt,Lt,Qt)}B.displayName="BodyRow";var R=B,F=C.createContext(null),K=F;function X(ne){var ue=ne.columnKey,me=ne.onColumnResize,_e=C.useRef();return C.useEffect(function(){_e.current&&me(ue,_e.current.offsetWidth)},[]),C.createElement(b.a,{onResize:function(fe){var Z=fe.offsetWidth;me(ue,Z)}},C.createElement("td",{ref:_e,style:{padding:0,border:0,height:0}},C.createElement("div",{style:{height:0,overflow:"hidden"}},"\xA0")))}function ee(ne){var ue=ne.data,me=ne.getRowKey,_e=ne.measureColumnWidth,se=ne.expandedKeys,fe=ne.onRow,Z=ne.rowExpandable,Q=ne.emptyNode,$=ne.childrenColumnName,V=C.useContext(K),Y=V.onColumnResize,J=C.useContext(t.a),q=J.prefixCls,ae=J.getComponent,he=C.useContext(A),we=he.fixHeader,Ue=he.horizonScroll,Ke=he.flattenColumns,Pe=he.componentWidth;return C.useMemo(function(){var et=ae(["body","wrapper"],"tbody"),$e=ae(["body","row"],"tr"),He=ae(["body","cell"],"td"),at;ue.length?at=ue.map(function(it,ht){var qe=me(it,ht);return C.createElement(R,{key:qe,rowKey:qe,record:it,recordKey:qe,index:ht,rowComponent:$e,cellComponent:He,expandedKeys:se,onRow:fe,getRowKey:me,rowExpandable:Z,childrenColumnName:$})}):at=C.createElement(N,{expanded:!0,className:"".concat(q,"-placeholder"),prefixCls:q,fixHeader:we,fixColumn:Ue,horizonScroll:Ue,component:$e,componentWidth:Pe,cellComponent:He,colSpan:Ke.length},Q);var rt=Object(x.a)(Ke);return C.createElement(et,{className:"".concat(q,"-tbody")},_e&&C.createElement("tr",{"aria-hidden":"true",className:"".concat(q,"-measure-row"),style:{height:0}},rt.map(function(it){return C.createElement(X,{key:it,columnKey:it,onColumnResize:Y})})),at)},[ue,q,fe,_e,se,me,ae,Pe,Q,Ke])}var oe=C.memo(ee);oe.displayName="Body";var ce=oe,le=z("wRmb"),be=z("xEkU"),pe=z.n(be);function de(ne){var ue=Object(C.useRef)(ne),me=Object(C.useState)({}),_e=Object(L.a)(me,2),se=_e[1],fe=Object(C.useRef)(null),Z=Object(C.useRef)([]);function Q($){fe.current===null&&(Z.current=[],fe.current=pe()(function(){Z.current.forEach(function(V){ue.current=V(ue.current)}),fe.current=null,se({})})),Z.current.push($)}return Object(C.useEffect)(function(){return function(){pe.a.cancel(fe.current)}},[]),[ue.current,Q]}function te(ne){var ue=Object(C.useRef)(ne),me=Object(C.useRef)(null);function _e(){window.clearTimeout(me.current)}function se(Z){ue.current=Z,_e(),me.current=window.setTimeout(function(){ue.current=null,me.current=null},100)}function fe(){return ue.current}return Object(C.useEffect)(function(){return _e},[]),[se,fe]}function Le(ne,ue,me){var _e=Object(C.useMemo)(function(){for(var se=[],fe=[],Z=0,Q=0,$=0;$<ue;$+=1)if(me==="rtl"){fe[$]=Q,Q+=ne[$]||0;var V=ue-$-1;se[V]=Z,Z+=ne[V]||0}else{se[$]=Z,Z+=ne[$]||0;var Y=ue-$-1;fe[Y]=Q,Q+=ne[Y]||0}return{left:se,right:fe}},[ne,ue,me]);return _e}var Ve=Le;function Ne(ne){var ue=ne.className,me=ne.children;return C.createElement("div",{className:ue},me)}var Be=Ne,ve=z("n6Qo");function ye(ne){var ue,me=ne.prefixCls,_e=ne.record,se=ne.onExpand,fe=ne.expanded,Z=ne.expandable,Q="".concat(me,"-row-expand-icon");if(!Z)return C.createElement("span",{className:U()(Q,"".concat(me,"-row-spaced"))});var $=function(Y){se(_e,Y),Y.stopPropagation()};return C.createElement("span",{className:U()(Q,(ue={},Object(re.a)(ue,"".concat(me,"-row-expanded"),fe),Object(re.a)(ue,"".concat(me,"-row-collapsed"),!fe),ue)),onClick:$})}function Ie(ne,ue,me){var _e=[];function se(fe){(fe||[]).forEach(function(Z,Q){_e.push(ue(Z,Q)),se(Z[me])})}return se(ne),_e}var Ae=z("zT1h"),ge=z("y0+3"),Ce=function(ue,me){var _e,se,fe=ue.scrollBodyRef,Z=ue.onScroll,Q=ue.offsetScroll,$=C.useContext(t.a),V=$.prefixCls,Y=((_e=fe.current)===null||_e===void 0?void 0:_e.scrollWidth)||0,J=((se=fe.current)===null||se===void 0?void 0:se.clientWidth)||0,q=Y&&J*(J/Y),ae=C.useRef(),he=de({scrollLeft:0,isHiddenScrollBar:!1}),we=Object(L.a)(he,2),Ue=we[0],Ke=we[1],Pe=C.useRef({delta:0,x:0}),et=C.useState(!1),$e=Object(L.a)(et,2),He=$e[0],at=$e[1],rt=function(){at(!1)},it=function(Te){Te.persist(),Pe.current.delta=Te.pageX-Ue.scrollLeft,Pe.current.x=0,at(!0),Te.preventDefault()},ht=function(Te){var Xe,tt=Te||((Xe=window)===null||Xe===void 0?void 0:Xe.event),Qe=tt.buttons;if(!He||Qe===0){He&&at(!1);return}var st=Pe.current.x+Te.pageX-Pe.current.x-Pe.current.delta;st<=0&&(st=0),st+q>=J&&(st=J-q),Z({scrollLeft:st/J*(Y+2)}),Pe.current.x=Te.pageX},qe=function(){var Te=Object(ge.b)(fe.current).top,Xe=Te+fe.current.offsetHeight,tt=document.documentElement.scrollTop+window.innerHeight;Xe-Object(h.a)()<=tt||Te>=tt-Q?Ke(function(Qe){return Object(W.a)(Object(W.a)({},Qe),{},{isHiddenScrollBar:!0})}):Ke(function(Qe){return Object(W.a)(Object(W.a)({},Qe),{},{isHiddenScrollBar:!1})})},ot=function(Te){Ke(function(Xe){return Object(W.a)(Object(W.a)({},Xe),{},{scrollLeft:Te/Y*J||0})})};return C.useImperativeHandle(me,function(){return{setScrollLeft:ot}}),C.useEffect(function(){var dt=Object(Ae.a)(document.body,"mouseup",rt,!1),Te=Object(Ae.a)(document.body,"mousemove",ht,!1);return qe(),function(){dt.remove(),Te.remove()}},[q,He]),C.useEffect(function(){var dt=Object(Ae.a)(window,"scroll",qe,!1),Te=Object(Ae.a)(window,"resize",qe,!1);return function(){dt.remove(),Te.remove()}},[]),C.useEffect(function(){Ue.isHiddenScrollBar||Ke(function(dt){var Te,Xe;return Object(W.a)(Object(W.a)({},dt),{},{scrollLeft:fe.current.scrollLeft/((Te=fe.current)===null||Te===void 0?void 0:Te.scrollWidth)*((Xe=fe.current)===null||Xe===void 0?void 0:Xe.clientWidth)})})},[Ue.isHiddenScrollBar]),Y<=J||!q||Ue.isHiddenScrollBar?null:C.createElement("div",{style:{height:Object(h.a)(),width:J,bottom:Q},className:"".concat(V,"-sticky-scroll")},C.createElement("div",{onMouseDown:it,ref:ae,className:U()("".concat(V,"-sticky-scroll-bar"),Object(re.a)({},"".concat(V,"-sticky-scroll-bar-active"),He)),style:{width:"".concat(q,"px"),transform:"translate3d(".concat(Ue.scrollLeft,"px, 0, 0)")}}))},Oe=C.forwardRef(Ce);function Se(ne,ue){return C.useMemo(function(){var me=!!ne;return{isSticky:me,stickyClassName:me?"".concat(ue,"-sticky-header"):"",offsetHeader:Object(H.a)(ne)==="object"&&ne.offsetHeader||0,offsetScroll:Object(H.a)(ne)==="object"&&ne.offsetScroll||0}},[ne,ue])}var De=[],je={},Me="rc-table-internal-hook",Fe=C.memo(function(ne){var ue=ne.children;return ue},function(ne,ue){return S()(ne.props,ue.props)?ne.pingLeft!==ue.pingLeft||ne.pingRight!==ue.pingRight:!1});function We(ne){var ue,me=ne.prefixCls,_e=ne.className,se=ne.rowClassName,fe=ne.style,Z=ne.data,Q=ne.rowKey,$=ne.scroll,V=ne.tableLayout,Y=ne.direction,J=ne.title,q=ne.footer,ae=ne.summary,he=ne.id,we=ne.showHeader,Ue=ne.components,Ke=ne.emptyText,Pe=ne.onRow,et=ne.onHeaderRow,$e=ne.internalHooks,He=ne.transformColumns,at=ne.internalRefs,rt=ne.sticky,it=Z||De,ht=!!it.length,qe=C.useState(0),ot=Object(L.a)(qe,2),dt=ot[0],Te=ot[1];C.useEffect(function(){Te(Object(h.a)())});var Xe=C.useMemo(function(){return Object(x.c)(Ue,{})},[Ue]),tt=C.useCallback(function(ut,ct){return Object(x.b)(Xe,ut)||ct},[Xe]),Qe=C.useMemo(function(){return typeof Q=="function"?Q:function(ut){var ct=ut&&ut[Q];return ct}},[Q]),st=Object(u.c)(ne),Rt=st.expandIcon,At=st.expandedRowKeys,Et=st.defaultExpandedRowKeys,xt=st.defaultExpandAllRows,Ct=st.expandedRowRender,Ot=st.onExpand,Mt=st.onExpandedRowsChange,It=st.expandRowByClick,Tt=st.rowExpandable,Ut=st.expandIconColumnIndex,kt=st.expandedRowClassName,$t=st.childrenColumnName,jt=st.indentSize,Lt=Rt||ye,Bt=$t||"children",Ht=C.useMemo(function(){return Ct?"row":ne.expandable&&$e===Me&&ne.expandable.__PARENT_RENDER_ICON__||it.some(function(ut){return ut&&Object(H.a)(ut)==="object"&&ut[Bt]})?"nest":!1},[!!Ct,it]),Qt=C.useState(function(){return Et||(xt?Ie(it,Qe,Bt):[])}),M=Object(L.a)(Qt,2),m=M[0],T=M[1],D=C.useMemo(function(){return new Set(At||m||[])},[At,m]),G=C.useCallback(function(ut){var ct=Qe(ut,it.indexOf(ut)),yt,wt=D.has(ct);wt?(D.delete(ct),yt=Object(I.a)(D)):yt=[].concat(Object(I.a)(D),[ct]),T(yt),Ot&&Ot(!wt,ut),Mt&&Mt(yt)},[Qe,D,it,Ot,Mt]),k=C.useState(0),ie=Object(L.a)(k,2),xe=ie[0],ke=ie[1],Ye=Object(le.b)(Object(W.a)(Object(W.a)(Object(W.a)({},ne),st),{},{expandable:!!Ct,expandedKeys:D,getRowKey:Qe,onTriggerExpand:G,expandIcon:Lt,expandIconColumnIndex:Ut,direction:Y}),$e===Me?He:null),Re=Object(L.a)(Ye,2),Je=Re[0],Ze=Re[1],ft=C.useMemo(function(){return{columns:Je,flattenColumns:Ze}},[Je,Ze]),St=C.useRef(),Nt=C.useRef(),gt=C.useRef(),Dt=C.useState(!1),ii=Object(L.a)(Dt,2),Jt=ii[0],Wt=ii[1],Ft=C.useState(!1),ri=Object(L.a)(Ft,2),Zt=ri[0],li=ri[1],Kt=de(new Map),ni=Object(L.a)(Kt,2),ui=ni[0],Gt=ni[1],Pt=Object(x.a)(Ze),zt=Pt.map(function(ut){return ui.get(ut)}),ai=C.useMemo(function(){return zt},[zt.join("_")]),Vt=Ve(ai,Ze.length,Y),mt=$&&Object(x.d)($.y),nt=$&&Object(x.d)($.x),vt=nt&&Ze.some(function(ut){var ct=ut.fixed;return ct}),lt=C.useRef(),_t=Se(rt,me),pt=_t.isSticky,qt=_t.offsetHeader,bt=_t.offsetScroll,si=_t.stickyClassName,ei,Yt,hi;mt&&(Yt={overflowY:"scroll",maxHeight:$.y}),nt&&(ei={overflowX:"auto"},mt||(Yt={overflowY:"hidden"}),hi={width:$.x===!0?"auto":$.x,minWidth:"100%"});var yi=C.useCallback(function(ut,ct){Gt(function(yt){var wt=new Map(yt);return wt.set(ut,ct),wt})},[]),Oi=te(null),_i=Object(L.a)(Oi,2),Ri=_i[0],bi=_i[1];function di(ut,ct){if(!ct)return;typeof ct=="function"?ct(ut):ct.scrollLeft!==ut&&(ct.scrollLeft=ut)}var Xt=function(ct){var yt=ct.currentTarget,wt=ct.scrollLeft,ti=typeof wt=="number"?wt:yt.scrollLeft,Ci=yt||je;if(!bi()||bi()===Ci){var vi;Ri(Ci),di(ti,Nt.current),di(ti,gt.current),di(ti,(vi=lt.current)===null||vi===void 0?void 0:vi.setScrollLeft)}if(yt){var ki=yt.scrollWidth,Ni=yt.clientWidth;Wt(ti>0),li(ti<ki-Ni)}},ci=function(){gt.current&&Xt({currentTarget:gt.current})},Ai=function(ct){var yt=ct.width;ci(),ke(St.current?St.current.offsetWidth:yt)};C.useEffect(function(){return ci},[]),C.useEffect(function(){nt&&ci()},[nt]),C.useEffect(function(){$e===Me&&at&&(at.body.current=gt.current)});var Ei=tt(["table"],"table"),oi=C.useMemo(function(){return V||(vt?$.x==="max-content"?"auto":"fixed":mt||Ze.some(function(ut){var ct=ut.ellipsis;return ct})?"fixed":"auto")},[mt,vt,Ze,V]),fi,pi={colWidths:ai,columCount:Ze.length,stickyOffsets:Vt,onHeaderRow:et,fixHeader:mt},Ii=C.useMemo(function(){return ht?null:typeof Ke=="function"?Ke():Ke},[ht,Ke]),Ti=C.createElement(ce,{data:it,measureColumnWidth:mt||nt||pt,expandedKeys:D,rowExpandable:Tt,getRowKey:Qe,onRow:Pe,emptyNode:Ii,childrenColumnName:Bt}),xi=C.createElement(o,{colWidths:Ze.map(function(ut){var ct=ut.width;return ct}),columns:Ze}),Si=ae&&C.createElement(ve.b,null,ae(it)),wi=tt(["body"]);if(mt||pt){var mi;typeof wi=="function"?(mi=wi(it,{scrollbarSize:dt,ref:gt,onScroll:Xt}),pi.colWidths=Ze.map(function(ut,ct){var yt=ut.width,wt=ct===Je.length-1?yt-dt:yt;return typeof wt=="number"&&!Number.isNaN(wt)?wt:(Object(_.a)(!1,"When use `components.body` with render props. Each column should have a fixed value."),0)})):mi=C.createElement("div",{style:Object(W.a)(Object(W.a)({},ei),Yt),onScroll:Xt,ref:gt,className:U()("".concat(me,"-body"))},C.createElement(Ei,{style:Object(W.a)(Object(W.a)({},hi),{},{tableLayout:oi})},xi,Ti,Si),pt&&C.createElement(Oe,{ref:lt,offsetScroll:bt,scrollBodyRef:gt,onScroll:Xt})),fi=C.createElement(C.Fragment,null,we!==!1&&C.createElement(c,Object.assign({noData:!it.length},pi,ft,{direction:Y,offsetHeader:qt,stickyClassName:si,ref:Nt,onScroll:Xt})),mi)}else fi=C.createElement("div",{style:Object(W.a)(Object(W.a)({},ei),Yt),className:U()("".concat(me,"-content")),onScroll:Xt,ref:gt},C.createElement(Ei,{style:Object(W.a)(Object(W.a)({},hi),{},{tableLayout:oi})},xi,we!==!1&&C.createElement(d,Object.assign({},pi,ft)),Ti,Si));var Li=Object(u.b)(ne),gi=C.createElement("div",Object.assign({className:U()(me,_e,(ue={},Object(re.a)(ue,"".concat(me,"-rtl"),Y==="rtl"),Object(re.a)(ue,"".concat(me,"-ping-left"),Jt),Object(re.a)(ue,"".concat(me,"-ping-right"),Zt),Object(re.a)(ue,"".concat(me,"-layout-fixed"),V==="fixed"),Object(re.a)(ue,"".concat(me,"-fixed-header"),mt),Object(re.a)(ue,"".concat(me,"-fixed-column"),vt),Object(re.a)(ue,"".concat(me,"-scroll-horizontal"),nt),Object(re.a)(ue,"".concat(me,"-has-fix-left"),Ze[0]&&Ze[0].fixed),Object(re.a)(ue,"".concat(me,"-has-fix-right"),Ze[Ze.length-1]&&Ze[Ze.length-1].fixed==="right"),ue)),style:fe,id:he,ref:St},Li),C.createElement(Fe,{pingLeft:Jt,pingRight:Zt,props:Object(W.a)(Object(W.a)({},ne),{},{stickyOffsets:Vt,mergedExpandedKeys:D})},J&&C.createElement(Be,{className:"".concat(me,"-title")},J(it)),C.createElement("div",{className:"".concat(me,"-container")},fi),q&&C.createElement(Be,{className:"".concat(me,"-footer")},q(it))));nt&&(gi=C.createElement(b.a,{onResize:Ai},gi));var Di=C.useMemo(function(){return{prefixCls:me,getComponent:tt,scrollbarSize:dt,direction:Y,fixedInfoList:Ze.map(function(ut,ct){return n(ct,ct,Ze,Vt,Y)}),isSticky:pt}},[me,tt,dt,Y,Ze,Vt,Y,pt]),Pi=C.useMemo(function(){return Object(W.a)(Object(W.a)({},ft),{},{tableLayout:oi,rowClassName:se,expandedRowClassName:kt,componentWidth:xe,fixHeader:mt,fixColumn:vt,horizonScroll:nt,expandIcon:Lt,expandableType:Ht,expandRowByClick:It,expandedRowRender:Ct,onTriggerExpand:G,expandIconColumnIndex:Ut,indentSize:jt})},[ft,oi,se,kt,xe,mt,vt,nt,Lt,Ht,It,Ct,G,Ut,jt]),Mi=C.useMemo(function(){return{onColumnResize:yi}},[yi]);return C.createElement(t.a.Provider,{value:Di},C.createElement(A.Provider,{value:Pi},C.createElement(K.Provider,{value:Mi},gi)))}We.Column=r.a,We.ColumnGroup=l.a,We.Summary=ve.a,We.defaultProps={rowKey:"key",prefixCls:"rc-table",emptyText:function(){return"No Data"}};var ze=Ee.b=We},wRmb:function(Ge,Ee,z){"use strict";z.d(Ee,"a",function(){return S});var re=z("rePB"),W=z("KQm4"),I=z("VTBJ"),H=z("Ff2n"),L=z("cDcd"),C=z.n(L),j=z("Kwbf"),U=z("Zm9Q"),O=z("hW8S");function S(r){return Object(U.a)(r).filter(function(s){return L.isValidElement(s)}).map(function(s){var a=s.key,e=s.props,t=e.children,n=Object(H.a)(e,["children"]),x=Object(I.a)({key:a},n);return t&&(x.children=S(t)),x})}function _(r){return r.reduce(function(s,a){var e=a.fixed,t=e===!0?"left":e,n=a.children;return n&&n.length>0?[].concat(Object(W.a)(s),Object(W.a)(_(n).map(function(x){return Object(I.a)({fixed:t},x)}))):[].concat(Object(W.a)(s),[Object(I.a)(Object(I.a)({},a),{},{fixed:t})])},[])}function b(r){for(var s=!0,a=0;a<r.length;a+=1){var e=r[a];if(s&&e.fixed!=="left")s=!1;else if(!s&&e.fixed==="left"){Object(j.a)(!1,"Index ".concat(a-1," of `columns` missing `fixed='left'` prop."));break}}for(var t=!0,n=r.length-1;n>=0;n-=1){var x=r[n];if(t&&x.fixed!=="right")t=!1;else if(!t&&x.fixed==="right"){Object(j.a)(!1,"Index ".concat(n+1," of `columns` missing `fixed='right'` prop."));break}}}function h(r){return r.map(function(s){var a=s.fixed,e=Object(H.a)(s,["fixed"]),t=a;return a==="left"?t="right":a==="right"&&(t="left"),Object(I.a)({fixed:t},e)})}function l(r,s){var a=r.prefixCls,e=r.columns,t=r.children,n=r.expandable,x=r.expandedKeys,E=r.getRowKey,g=r.onTriggerExpand,y=r.expandIcon,v=r.rowExpandable,d=r.expandIconColumnIndex,u=r.direction,i=r.expandRowByClick,o=L.useMemo(function(){return e||S(t)},[e,t]),p=L.useMemo(function(){if(n){var w,A=d||0,P=o[A],N=(w={},Object(re.a)(w,O.a,{className:"".concat(a,"-expand-icon-col")}),Object(re.a)(w,"title",""),Object(re.a)(w,"fixed",P?P.fixed:null),Object(re.a)(w,"className","".concat(a,"-row-expand-icon-cell")),Object(re.a)(w,"render",function(F,K,X){var ee=E(K,X),oe=x.has(ee),ce=v?v(K):!0,le=y({prefixCls:a,expanded:oe,expandable:ce,record:K,onExpand:g});return i?L.createElement("span",{onClick:function(pe){return pe.stopPropagation()}},le):le}),w),B=o.slice();return A>=0&&B.splice(A,0,N),B}return o},[n,o,E,x,y,u]),f=L.useMemo(function(){var w=p;return s&&(w=s(w)),w.length||(w=[{render:function(){return null}}]),w},[s,p,u]),c=L.useMemo(function(){return u==="rtl"?h(_(f)):_(f)},[f,u]);return[f,c]}Ee.b=l},wwSX:function(Ge,Ee,z){Ge.exports=z.p+"static/b2.2c844a2a.svg"},"y0+3":function(Ge,Ee,z){"use strict";z.d(Ee,"a",function(){return _}),z.d(Ee,"b",function(){return h});var re=/margin|padding|width|height|max|min|offset/,W={left:!0,top:!0},I={cssFloat:1,styleFloat:1,float:1};function H(l){return l.nodeType===1?l.ownerDocument.defaultView.getComputedStyle(l,null):{}}function L(l,r,s){if(r=r.toLowerCase(),s==="auto"){if(r==="height")return l.offsetHeight;if(r==="width")return l.offsetWidth}return r in W||(W[r]=re.test(r)),W[r]?parseFloat(s)||0:s}function C(l,r){var s=arguments.length,a=H(l);return r=I[r]?"cssFloat"in l.style?"cssFloat":"styleFloat":r,s===1?a:L(l,r,a[r]||l.style[r])}function j(l,r,s){var a=arguments.length;if(r=I[r]?"cssFloat"in l.style?"cssFloat":"styleFloat":r,a===3)return typeof s=="number"&&re.test(r)&&(s="".concat(s,"px")),l.style[r]=s,s;for(var e in r)r.hasOwnProperty(e)&&j(l,e,r[e]);return H(l)}function U(l){return l===document.body?document.documentElement.clientWidth:l.offsetWidth}function O(l){return l===document.body?window.innerHeight||document.documentElement.clientHeight:l.offsetHeight}function S(){var l=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),r=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);return{width:l,height:r}}function _(){var l=document.documentElement.clientWidth,r=window.innerHeight||document.documentElement.clientHeight;return{width:l,height:r}}function b(){return{scrollLeft:Math.max(document.documentElement.scrollLeft,document.body.scrollLeft),scrollTop:Math.max(document.documentElement.scrollTop,document.body.scrollTop)}}function h(l){var r=l.getBoundingClientRect(),s=document.documentElement;return{left:r.left+(window.pageXOffset||s.scrollLeft)-(s.clientLeft||document.body.clientLeft||0),top:r.top+(window.pageYOffset||s.scrollTop)-(s.clientTop||document.body.clientTop||0)}}},zlzj:function(Ge,Ee,z){Ge.exports=z.p+"static/b3.30079151.svg"}}]);
|