(window.webpackJsonp=window.webpackJsonp||[]).push([[199,7,8],{"+NIl":function(At,ft,re){(function(ae){ae(re("VrN/"))})(function(ae){"use strict";ae.defineMode("stex",function($,R){"use strict";function X(T,A){T.cmdState.push(A)}function N(T){return T.cmdState.length>0?T.cmdState[T.cmdState.length-1]:null}function I(T){var A=T.cmdState.pop();A&&A.closeBracket()}function z(T){for(var A=T.cmdState,w=A.length-1;w>=0;w--){var h=A[w];if(h.name=="DEFAULT")continue;return h}return{styleIdentifier:function(){return null}}}function j(T,A,w){return function(){this.name=T,this.bracketNo=0,this.style=A,this.styles=w,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var O={};O.importmodule=j("importmodule","tag",["string","builtin"]),O.documentclass=j("documentclass","tag",["","atom"]),O.usepackage=j("usepackage","tag",["atom"]),O.begin=j("begin","tag",["atom"]),O.end=j("end","tag",["atom"]),O.label=j("label","tag",["atom"]),O.ref=j("ref","tag",["atom"]),O.eqref=j("eqref","tag",["atom"]),O.cite=j("cite","tag",["atom"]),O.bibitem=j("bibitem","tag",["atom"]),O.Bibitem=j("Bibitem","tag",["atom"]),O.RBibitem=j("RBibitem","tag",["atom"]),O.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function P(T,A){T.f=A}function E(T,A){var w;if(T.match(/^\\[a-zA-Z@]+/)){var h=T.current().slice(1);return w=O.hasOwnProperty(h)?O[h]:O.DEFAULT,w=new w,X(A,w),P(A,D),w.style}if(T.match(/^\\[$&%#{}_]/))return"tag";if(T.match(/^\\[,;!\/\\]/))return"tag";if(T.match("\\["))return P(A,function(d,c){return L(d,c,"\\]")}),"keyword";if(T.match("\\("))return P(A,function(d,c){return L(d,c,"\\)")}),"keyword";if(T.match("$$"))return P(A,function(d,c){return L(d,c,"$$")}),"keyword";if(T.match("$"))return P(A,function(d,c){return L(d,c,"$")}),"keyword";var o=T.next();if(o=="%")return T.skipToEnd(),"comment";if(o=="}"||o=="]"){if(w=N(A),w)w.closeBracket(o),P(A,D);else return"error";return"bracket"}else return o=="{"||o=="["?(w=O.DEFAULT,w=new w,X(A,w),"bracket"):/\d/.test(o)?(T.eatWhile(/[\w.%]/),"atom"):(T.eatWhile(/[\w\-_]/),w=z(A),w.name=="begin"&&(w.argument=T.current()),w.styleIdentifier())}function L(T,A,w){if(T.eatSpace())return null;if(w&&T.match(w))return P(A,E),"keyword";if(T.match(/^\\[a-zA-Z@]+/))return"tag";if(T.match(/^[a-zA-Z]+/))return"variable-2";if(T.match(/^\\[$&%#{}_]/))return"tag";if(T.match(/^\\[,;!\/]/))return"tag";if(T.match(/^[\^_&]/))return"tag";if(T.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(T.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var h=T.next();return h=="{"||h=="}"||h=="["||h=="]"||h=="("||h==")"?"bracket":h=="%"?(T.skipToEnd(),"comment"):"error"}function D(T,A){var w=T.peek(),h;return w=="{"||w=="["?(h=N(A),h.openBracket(w),T.eat(w),P(A,E),"bracket"):/[ \t\r]/.test(w)?(T.eat(w),null):(P(A,E),I(A),E(T,A))}return{startState:function(){var T=R.inMathMode?function(A,w){return L(A,w)}:E;return{cmdState:[],f:T}},copyState:function(T){return{cmdState:T.cmdState.slice(),f:T.f}},token:function(T,A){return A.f(T,A)},blankLine:function(T){T.f=E,T.cmdState.length=0},lineComment:"%"}}),ae.defineMIME("text/x-stex","stex"),ae.defineMIME("text/x-latex","stex")})},"+yhJ":function(At,ft,re){At.exports=re.p+"static/xixi.d492fb65.svg"},"0eGx":function(At,ft,re){At.exports=re.p+"static/zhong.c1924b73.svg"},"19Vz":function(At,ft,re){(function(ae){ae(re("VrN/"))})(function(ae){ae.defineOption("placeholder","",function(j,O,P){var E=P&&P!=ae.Init;if(O&&!E)j.on("blur",N),j.on("change",I),j.on("swapDoc",I),ae.on(j.getInputField(),"compositionupdate",j.state.placeholderCompose=function(){X(j)}),I(j);else if(!O&&E){j.off("blur",N),j.off("change",I),j.off("swapDoc",I),ae.off(j.getInputField(),"compositionupdate",j.state.placeholderCompose),$(j);var L=j.getWrapperElement();L.className=L.className.replace(" CodeMirror-empty","")}O&&!j.hasFocus()&&N(j)});function $(j){j.state.placeholder&&(j.state.placeholder.parentNode.removeChild(j.state.placeholder),j.state.placeholder=null)}function R(j){$(j);var O=j.state.placeholder=document.createElement("pre");O.style.cssText="height: 0; overflow: visible",O.style.direction=j.getOption("direction"),O.className="CodeMirror-placeholder CodeMirror-line-like";var P=j.getOption("placeholder");typeof P=="string"&&(P=document.createTextNode(P)),O.appendChild(P),j.display.lineSpace.insertBefore(O,j.display.lineSpace.firstChild)}function X(j){setTimeout(function(){var O=!1,P=j.getInputField();P.nodeName=="TEXTAREA"?O=!P.value:j.lineCount()==1&&(O=!/[^\u200b]/.test(P.querySelector(".CodeMirror-line").textContent)),O?R(j):$(j)},20)}function N(j){z(j)&&R(j)}function I(j){var O=j.getWrapperElement(),P=z(j);O.className=O.className.replace(" CodeMirror-empty","")+(P?" CodeMirror-empty":""),P?R(j):$(j)}function z(j){return j.lineCount()===1&&j.getLine(0)===""}})},"1eCo":function(At,ft,re){(function(ae){ae(re("VrN/"))})(function(ae){"use strict";var $={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},R={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ae.defineMode("xml",function(X,N){var I=X.indentUnit,z={},j=N.htmlMode?$:R;for(var O in j)z[O]=j[O];for(var O in N)z[O]=N[O];var P,E;function L(a,b){function v(H){return b.tokenize=H,H(a,b)}var x=a.next();if(x=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?v(A("atom","]]>")):null:a.match("--")?v(A("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),v(w(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),b.tokenize=A("meta","?>"),"meta"):(P=a.eat("/")?"closeTag":"openTag",b.tokenize=D,"tag bracket");if(x=="&"){var k;return a.eat("#")?a.eat("x")?k=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):k=a.eatWhile(/[\d]/)&&a.eat(";"):k=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),k?"atom":"error"}else return a.eatWhile(/[^&<]/),null}L.isInText=!0;function D(a,b){var v=a.next();if(v==">"||v=="/"&&a.eat(">"))return b.tokenize=L,P=v==">"?"endTag":"selfcloseTag","tag bracket";if(v=="=")return P="equals",null;if(v=="<"){b.tokenize=L,b.state=c,b.tagName=b.tagStart=null;var x=b.tokenize(a,b);return x?x+" tag error":"tag error"}else return/[\'\"]/.test(v)?(b.tokenize=T(v),b.stringStartCol=a.column(),b.tokenize(a,b)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function T(a){var b=function(v,x){for(;!v.eol();)if(v.next()==a){x.tokenize=D;break}return"string"};return b.isInAttribute=!0,b}function A(a,b){return function(v,x){for(;!v.eol();){if(v.match(b)){x.tokenize=L;break}v.next()}return a}}function w(a){return function(b,v){for(var x;(x=b.next())!=null;){if(x=="<")return v.tokenize=w(a+1),v.tokenize(b,v);if(x==">")if(a==1){v.tokenize=L;break}else return v.tokenize=w(a-1),v.tokenize(b,v)}return"meta"}}function h(a,b,v){this.prev=a.context,this.tagName=b,this.indent=a.indented,this.startOfLine=v,(z.doNotIndent.hasOwnProperty(b)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function d(a,b){for(var v;;){if(!a.context)return;if(v=a.context.tagName,!z.contextGrabbers.hasOwnProperty(v)||!z.contextGrabbers[v].hasOwnProperty(b))return;o(a)}}function c(a,b,v){return a=="openTag"?(v.tagStart=b.column(),C):a=="closeTag"?y:c}function C(a,b,v){return a=="word"?(v.tagName=b.current(),E="tag",S):z.allowMissingTagName&&a=="endTag"?(E="tag bracket",S(a,b,v)):(E="error",C)}function y(a,b,v){if(a=="word"){var x=b.current();return v.context&&v.context.tagName!=x&&z.implicitlyClosed.hasOwnProperty(v.context.tagName)&&o(v),v.context&&v.context.tagName==x||z.matchClosing===!1?(E="tag",m):(E="tag error",l)}else return z.allowMissingTagName&&a=="endTag"?(E="tag bracket",m(a,b,v)):(E="error",l)}function m(a,b,v){return a!="endTag"?(E="error",m):(o(v),c)}function l(a,b,v){return E="error",m(a,b,v)}function S(a,b,v){if(a=="word")return E="attribute",f;if(a=="endTag"||a=="selfcloseTag"){var x=v.tagName,k=v.tagStart;return v.tagName=v.tagStart=null,a=="selfcloseTag"||z.autoSelfClosers.hasOwnProperty(x)?d(v,x):(d(v,x),v.context=new h(v,x,k==v.indented)),c}return E="error",S}function f(a,b,v){return a=="equals"?p:(z.allowMissing||(E="error"),S(a,b,v))}function p(a,b,v){return a=="string"?s:a=="word"&&z.allowUnquoted?(E="string",S):(E="error",S(a,b,v))}function s(a,b,v){return a=="string"?s:S(a,b,v)}return{startState:function(a){var b={tokenize:L,state:c,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(b.baseIndent=a),b},token:function(a,b){if(!b.tagName&&a.sol()&&(b.indented=a.indentation()),a.eatSpace())return null;P=null;var v=b.tokenize(a,b);return(v||P)&&v!="comment"&&(E=null,b.state=b.state(P||v,a,b),E&&(v=E=="error"?v+" error":E)),v},indent:function(a,b,v){var x=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+I;if(x&&x.noIndent)return ae.Pass;if(a.tokenize!=D&&a.tokenize!=L)return v?v.match(/^(\s*)/)[0].length:0;if(a.tagName)return z.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+I*(z.multilineTagIndentFactor||1);if(z.alignCDATA&&/$/,blockCommentStart:"",configuration:z.htmlMode?"html":"xml",helperType:z.htmlMode?"html":"xml",skipAttribute:function(a){a.state==p&&(a.state=S)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var b=[],v=a.context;v;v=v.prev)v.tagName&&b.push(v.tagName);return b.reverse()}}}),ae.defineMIME("text/xml","xml"),ae.defineMIME("application/xml","xml"),ae.mimeModes.hasOwnProperty("text/html")||ae.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"6+eU":function(At,ft,re){"use strict";re.d(ft,"a",function(){return m});var ae=re("wx14"),$=re("rePB"),R=re("VTBJ"),X=re("1OyB"),N=re("vuIU"),I=re("Ji7U"),z=re("LK+K"),j=re("q1tI"),O=re.n(j),P=re("TSYQ"),E=re.n(P),L=function(S){var f,p="".concat(S.rootPrefixCls,"-item"),s=E()(p,"".concat(p,"-").concat(S.page),(f={},Object($.a)(f,"".concat(p,"-active"),S.active),Object($.a)(f,S.className,!!S.className),Object($.a)(f,"".concat(p,"-disabled"),!S.page),f)),a=function(){S.onClick(S.page)},b=function(x){S.onKeyPress(x,S.onClick,S.page)};return O.a.createElement("li",{title:S.showTitle?S.page:null,className:s,onClick:a,onKeyPress:b,tabIndex:"0"},S.itemRender(S.page,"page",O.a.createElement("a",{rel:"nofollow"},S.page)))},D=L,T={ZERO:48,NINE:57,NUMPAD_ZERO:96,NUMPAD_NINE:105,BACKSPACE:8,DELETE:46,ENTER:13,ARROW_UP:38,ARROW_DOWN:40},A=function(l){Object(I.a)(f,l);var S=Object(z.a)(f);function f(){var p;Object(X.a)(this,f);for(var s=arguments.length,a=new Array(s),b=0;b=0||v.relatedTarget.className.indexOf("".concat(V,"-next"))>=0))return;p.setState({goInputText:""}),H(p.getValidValue())},p.go=function(v){var x=p.state.goInputText;if(x==="")return;(v.keyCode===T.ENTER||v.type==="click")&&(p.setState({goInputText:""}),p.props.quickGo(p.getValidValue()))},p}return Object(N.a)(f,[{key:"getValidValue",value:function(){var s=this.state,a=s.goInputText,b=s.current;return!a||isNaN(a)?b:Number(a)}},{key:"getPageSizeOptions",value:function(){var s=this.props,a=s.pageSize,b=s.pageSizeOptions;return b.some(function(v){return v.toString()===a.toString()})?b:b.concat([a.toString()]).sort(function(v,x){var k=isNaN(Number(v))?0:Number(v),H=isNaN(Number(x))?0:Number(x);return k-H})}},{key:"render",value:function(){var s=this,a=this.props,b=a.pageSize,v=a.locale,x=a.rootPrefixCls,k=a.changeSize,H=a.quickGo,V=a.goButton,Q=a.selectComponentClass,G=a.buildOptionText,W=a.selectPrefixCls,q=a.disabled,oe=this.state.goInputText,fe="".concat(x,"-options"),ve=Q,ke=null,Ee=null,_e=null;if(!k&&!H)return null;var Te=this.getPageSizeOptions();if(k&&ve){var Ce=Te.map(function(me,ne){return O.a.createElement(ve.Option,{key:ne,value:me.toString()},(G||s.buildOptionText)(me))});ke=O.a.createElement(ve,{disabled:q,prefixCls:W,showSearch:!1,className:"".concat(fe,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(b||Te[0]).toString(),onChange:this.changeSize,getPopupContainer:function(ne){return ne.parentNode}},Ce)}return H&&(V&&(_e=typeof V=="boolean"?O.a.createElement("button",{type:"button",onClick:this.go,onKeyUp:this.go,disabled:q,className:"".concat(fe,"-quick-jumper-button")},v.jump_to_confirm):O.a.createElement("span",{onClick:this.go,onKeyUp:this.go},V)),Ee=O.a.createElement("div",{className:"".concat(fe,"-quick-jumper")},v.jump_to,O.a.createElement("input",{disabled:q,type:"text",value:oe,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur}),v.page,_e)),O.a.createElement("li",{className:"".concat(fe)},ke,Ee)}}]),f}(O.a.Component);A.defaultProps={pageSizeOptions:["10","20","50","100"]};var w=A,h=re("N2Kk");function o(){}function d(l){return typeof l=="number"&&isFinite(l)&&Math.floor(l)===l}function c(l,S,f){return f}function C(l,S,f){var p=typeof l=="undefined"?S.pageSize:l;return Math.floor((f.total-1)/p)+1}var y=function(l){Object(I.a)(f,l);var S=Object(z.a)(f);function f(p){var s;Object(X.a)(this,f),s=S.call(this,p),s.getJumpPrevPage=function(){return Math.max(1,s.state.current-(s.props.showLessItems?3:5))},s.getJumpNextPage=function(){return Math.min(C(void 0,s.state,s.props),s.state.current+(s.props.showLessItems?3:5))},s.getItemIcon=function(k,H){var V=s.props.prefixCls,Q=k||O.a.createElement("button",{type:"button","aria-label":H,className:"".concat(V,"-item-link")});return typeof k=="function"&&(Q=O.a.createElement(k,Object(R.a)({},s.props))),Q},s.savePaginationNode=function(k){s.paginationNode=k},s.isValid=function(k){return d(k)&&k!==s.state.current},s.shouldDisplayQuickJumper=function(){var k=s.props,H=k.showQuickJumper,V=k.pageSize,Q=k.total;return Q<=V?!1:H},s.handleKeyDown=function(k){(k.keyCode===T.ARROW_UP||k.keyCode===T.ARROW_DOWN)&&k.preventDefault()},s.handleKeyUp=function(k){var H=s.getValidValue(k),V=s.state.currentInputValue;H!==V&&s.setState({currentInputValue:H}),k.keyCode===T.ENTER?s.handleChange(H):k.keyCode===T.ARROW_UP?s.handleChange(H-1):k.keyCode===T.ARROW_DOWN&&s.handleChange(H+1)},s.changePageSize=function(k){var H=s.state.current,V=C(k,s.state,s.props);H=H>V?V:H,V===0&&(H=s.state.current),typeof k=="number"&&("pageSize"in s.props||s.setState({pageSize:k}),"current"in s.props||s.setState({current:H,currentInputValue:H})),s.props.onShowSizeChange(H,k),"onChange"in s.props&&s.props.onChange&&s.props.onChange(H,k)},s.handleChange=function(k){var H=s.props.disabled,V=k;if(s.isValid(V)&&!H){var Q=C(void 0,s.state,s.props);V>Q?V=Q:V<1&&(V=1),"current"in s.props||s.setState({current:V,currentInputValue:V});var G=s.state.pageSize;return s.props.onChange(V,G),V}return s.state.current},s.prev=function(){s.hasPrev()&&s.handleChange(s.state.current-1)},s.next=function(){s.hasNext()&&s.handleChange(s.state.current+1)},s.jumpPrev=function(){s.handleChange(s.getJumpPrevPage())},s.jumpNext=function(){s.handleChange(s.getJumpNextPage())},s.hasPrev=function(){return s.state.current>1},s.hasNext=function(){return s.state.current2?V-2:0),G=2;G=b?x=b:x=Number(a),x}},{key:"getShowSizeChanger",value:function(){var s=this.props,a=s.showSizeChanger,b=s.total,v=s.totalBoundaryShowSizeChanger;return typeof a!="undefined"?a:b>v}},{key:"renderPrev",value:function(s){var a=this.props,b=a.prevIcon,v=a.itemRender,x=v(s,"prev",this.getItemIcon(b,"prev page")),k=!this.hasPrev();return Object(j.isValidElement)(x)?Object(j.cloneElement)(x,{disabled:k}):x}},{key:"renderNext",value:function(s){var a=this.props,b=a.nextIcon,v=a.itemRender,x=v(s,"next",this.getItemIcon(b,"next page")),k=!this.hasNext();return Object(j.isValidElement)(x)?Object(j.cloneElement)(x,{disabled:k}):x}},{key:"render",value:function(){var s=this,a=this.props,b=a.prefixCls,v=a.className,x=a.style,k=a.disabled,H=a.hideOnSinglePage,V=a.total,Q=a.locale,G=a.showQuickJumper,W=a.showLessItems,q=a.showTitle,oe=a.showTotal,fe=a.simple,ve=a.itemRender,ke=a.showPrevNextJumpers,Ee=a.jumpPrevIcon,_e=a.jumpNextIcon,Te=a.selectComponentClass,Ce=a.selectPrefixCls,me=a.pageSizeOptions,ne=this.state,we=ne.current,tt=ne.pageSize,Ye=ne.currentInputValue;if(H===!0&&V<=tt)return null;var Xe=C(void 0,this.state,this.props),Ve=[],Le=null,Me=null,He=null,Ge=null,je=null,Ue=G&&G.goButton,Re=W?1:2,st=we-1>0?we-1:0,Je=we+1=Re*2&&we!==1+2&&(Ve[0]=Object(j.cloneElement)(Ve[0],{className:"".concat(b,"-item-after-jump-prev")}),Ve.unshift(Le)),Xe-we>=Re*2&&we!==Xe-2&&(Ve[Ve.length-1]=Object(j.cloneElement)(Ve[Ve.length-1],{className:"".concat(b,"-item-before-jump-next")}),Ve.push(Me)),gt!==1&&Ve.unshift(He),dt!==Xe&&Ve.push(Ge)}var ge=null;oe&&(ge=O.a.createElement("li",{className:"".concat(b,"-total-text")},oe(V,[V===0?0:(we-1)*tt+1,we*tt>V?V:we*tt])));var de=!this.hasPrev()||!Xe,pe=!this.hasNext()||!Xe;return O.a.createElement("ul",Object(ae.a)({className:E()(b,v,Object($.a)({},"".concat(b,"-disabled"),k)),style:x,unselectable:"unselectable",ref:this.savePaginationNode},Qe),ge,O.a.createElement("li",{title:q?Q.prev_page:null,onClick:this.prev,tabIndex:de?null:0,onKeyPress:this.runIfEnterPrev,className:E()("".concat(b,"-prev"),Object($.a)({},"".concat(b,"-disabled"),de)),"aria-disabled":de},this.renderPrev(st)),Ve,O.a.createElement("li",{title:q?Q.next_page:null,onClick:this.next,tabIndex:pe?null:0,onKeyPress:this.runIfEnterNext,className:E()("".concat(b,"-next"),Object($.a)({},"".concat(b,"-disabled"),pe)),"aria-disabled":pe},this.renderNext(Je)),O.a.createElement(w,{disabled:k,locale:Q,rootPrefixCls:b,selectComponentClass:Te,selectPrefixCls:Ce,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:we,pageSize:tt,pageSizeOptions:me,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:Ue}))}}],[{key:"getDerivedStateFromProps",value:function(s,a){var b={};if("current"in s&&(b.current=s.current,s.current!==a.current&&(b.currentInputValue=b.current)),"pageSize"in s&&s.pageSize!==a.pageSize){var v=a.current,x=C(s.pageSize,a,s);v=v>x?x:v,"current"in s||(b.current=v,b.currentInputValue=v),b.pageSize=s.pageSize}return b}}]),f}(O.a.Component);y.defaultProps={defaultCurrent:1,total:0,defaultPageSize:10,onChange:o,className:"",selectPrefixCls:"rc-select",prefixCls:"rc-pagination",selectComponentClass:null,hideOnSinglePage:!1,showPrevNextJumpers:!0,showQuickJumper:!1,showLessItems:!1,showTitle:!0,onShowSizeChange:o,locale:h.a,style:{},itemRender:c,totalBoundaryShowSizeChanger:50};var m=y},"6K3P":function(At,ft,re){At.exports=re.p+"static/jinshi.9b74f304.svg"},"7Cbv":function(At,ft,re){"use strict";var ae=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),$=new Uint8Array(16);function R(){if(!ae)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ae($)}var X=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function N(D){return typeof D=="string"&&X.test(D)}for(var I=N,z=[],j=0;j<256;++j)z.push((j+256).toString(16).substr(1));function O(D){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,A=(z[D[T+0]]+z[D[T+1]]+z[D[T+2]]+z[D[T+3]]+"-"+z[D[T+4]]+z[D[T+5]]+"-"+z[D[T+6]]+z[D[T+7]]+"-"+z[D[T+8]]+z[D[T+9]]+"-"+z[D[T+10]]+z[D[T+11]]+z[D[T+12]]+z[D[T+13]]+z[D[T+14]]+z[D[T+15]]).toLowerCase();if(!I(A))throw TypeError("Stringified UUID is invalid");return A}var P=O;function E(D,T,A){D=D||{};var w=D.random||(D.rng||R)();if(w[6]=w[6]&15|64,w[8]=w[8]&63|128,T){A=A||0;for(var h=0;h<16;++h)T[A+h]=w[h];return T}return P(w)}var L=ft.a=E},"7ahc":function(At,ft,re){"use strict";re.d(ft,"a",function(){return C});var ae=re("k1fw"),$=re("0Owb"),R=re("+L6B"),X=re("2/Rp"),N=re("y8nQ"),I=re("Vl3Y"),z=re("tJVT"),j=re("OaEy"),O=re("2fM7"),P=re("q1tI"),E=re.n(P),L=re("VrN/"),D=re.n(L),T=re("p77/"),A=re.n(T),w=re("c5Ni"),h=re.n(w),o=O.a.Option,d={labelCol:{span:4},wrapperCol:{span:20}},c={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};ft.b=function(y){var m=y.callback,l=y.onCancel,S=Object(P.useState)("python"),f=Object(z.a)(S,2),p=f[0],s=f[1];function a(v){s(c[v][1])}function b(v){m(v)}return E.a.createElement(I.a,Object($.a)({},d,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:b}),E.a.createElement(I.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},E.a.createElement(O.a,{onChange:a},Object.keys(c).map(function(v){return E.a.createElement(o,{key:v,value:v},c[v][0])}))),E.a.createElement(I.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},E.a.createElement(C,{mode:p})),E.a.createElement("div",{className:"flex-container flex-end"},E.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),E.a.createElement(X.a,{type:"ghost",onClick:l},"\u53D6\u6D88")))};function C(y){var m=y.value,l=y.onChange,S=y.mode,f=y.options,p=f===void 0?{}:f,s=Object(P.useRef)(),a=Object(P.useState)(),b=Object(z.a)(a,2),v=b[0],x=b[1];return Object(P.useEffect)(function(){if(v){function k(H){var V=H.getValue();l&&l(V)}return v.on("change",k),function(){v.off("change",k)}}},[v,l]),Object(P.useEffect)(function(){v&&v.setOption("mode",S)},[v,S]),Object(P.useEffect)(function(){v&&((m!==v.getValue()||m==="")&&setTimeout(function(){v.setValue(m||" ")},300))},[v,m]),Object(P.useEffect)(function(){if(s.current&&!v){var k=D.a.fromTextArea(s.current,Object(ae.a)({mode:S,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},p));x(k)}},[s.current,v]),E.a.createElement("div",{className:"my-codemirror-container"},E.a.createElement("textarea",{ref:s}))}},"7ixt":function(At,ft,re){"use strict";re.d(ft,"a",function(){return R});var ae={adjustX:1,adjustY:1},$=[0,0],R={left:{points:["cr","cl"],overflow:ae,offset:[-4,0],targetOffset:$},right:{points:["cl","cr"],overflow:ae,offset:[4,0],targetOffset:$},top:{points:["bc","tc"],overflow:ae,offset:[0,-4],targetOffset:$},bottom:{points:["tc","bc"],overflow:ae,offset:[0,4],targetOffset:$},topLeft:{points:["bl","tl"],overflow:ae,offset:[0,-4],targetOffset:$},leftTop:{points:["tr","tl"],overflow:ae,offset:[-4,0],targetOffset:$},topRight:{points:["br","tr"],overflow:ae,offset:[0,-4],targetOffset:$},rightTop:{points:["tl","tr"],overflow:ae,offset:[4,0],targetOffset:$},bottomRight:{points:["tr","br"],overflow:ae,offset:[0,4],targetOffset:$},rightBottom:{points:["bl","br"],overflow:ae,offset:[4,0],targetOffset:$},bottomLeft:{points:["tl","bl"],overflow:ae,offset:[0,4],targetOffset:$},leftBottom:{points:["br","bl"],overflow:ae,offset:[-4,0],targetOffset:$}},X=R},"7qnI":function(At,ft,re){"use strict";var ae=re("5Dmo"),$=re("3S7+"),R=re("fWQN"),X=re("mtLc"),N=re("yKVA"),I=re("879j"),z=re("5NDa"),j=re("5rEg"),O=re("q1tI"),P=re.n(O),E=re("O2Wb"),L=re.n(E),D=j.a.TextArea,T=function(A){Object(N.a)(h,A);var w=Object(I.a)(h);function h(){return Object(R.a)(this,h),w.apply(this,arguments)}return Object(X.a)(h,[{key:"render",value:function(){var d=this,c=this.props,C=c.index,y=c.onAnswerChange,m=c.addChildAnswer,l=c.exerciseIsPublish,S=c.answers,f=c.activeOptionErrorIndex,p=c.flex,s=p===void 0?"0 0 1000px":p;return P.a.createElement("div",{className:L.a.flex},P.a.createElement("div",{className:"".concat(L.a.color666," mb5 mt6"),style:{flex:"0 0 90px"}},"\u7B54\u6848(\u586B\u7A7A",C+1,"):"),P.a.createElement("div",{className:"".concat(L.a.flex," ").concat(L.a.flex1),style:{flexDirection:"column"}},S.map(function(a,b){var v="".concat(C,"-").concat(b);return P.a.createElement("div",{className:"".concat(L.a.flex," ").concat(L.a.flex1),key:b},P.a.createElement("div",{className:L.a.flex1,style:{flex:s}},P.a.createElement("div",null,P.a.createElement(D,{className:v===f?L.a.error:"",spellCheck:!1,rows:4,value:a||"",defaultValue:"\u8BF7\u8F93\u5165\u53C2\u8003\u7B54\u6848".concat(b==0?"":"(\u53EF\u9009)"),onChange:function(k){return y(C,b,k.target.value)},style:{minHeight:95}}))),!l&&P.a.createElement(P.a.Fragment,null,b!=0&&P.a.createElement($.a,{title:"\u5220\u9664"},P.a.createElement("i",{className:"".concat(L.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return d.props.deleteChildAnswer(C,b)},style:{float:"right"}})),b===0&&P.a.createElement($.a,{title:"\u5220\u9664"},P.a.createElement("i",{className:"".concat(L.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return d.props.deleteChildAnswermain(C,b)},style:{float:"right"}})),P.a.createElement($.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},P.a.createElement("i",{className:"".concat(L.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return m(C)},style:{float:"right",visibility:b==S.length-1?"":"hidden"}}))))})))}}]),h}(O.Component);ft.a=T},"8EBN":function(At,ft,re){(function(ae){ae(re("VrN/"))})(function(ae){"use strict";ae.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var $=0;$-1&&X.substring(z+1,X.length);if(j)return ae.findModeByExtension(j)},ae.findModeByName=function(X){X=X.toLowerCase();for(var N=0;N=M.length?J.slice(M.length):J}).join(` `)}var h=[],o=["
    "],d=new T.a.Renderer,c=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function C(){h.length=0,o=["
      "]}var y={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function m(U,u,g,M){if(u>=U.length||U[u].level<=g)return u;var J=U[u];M.push("
    • "+J.text+""),u++;var F=[];return u=m(U,u,J.level,F),F.length>0&&(M.push("
        "),F.forEach(function(ce){M.push(ce)}),M.push("
      ")),M.push("
    • "),u=m(U,u,g,M),u}function l(){return m(h,0,0,o),o.push("
    "),o.join("")}var S={heading:function(u){var g=c.exec(u);if(g)return{type:"heading",raw:g[0],depth:g[1].length,text:g[2]}},fences:function(u){var g=this.rules.block.fences.exec(u);if(g){var M=g[0],J=w(M,g[3]||""),F=g[2]?g[2].trim():g[2];if(["latex","katex","math"].indexOf(F)>=0){var ce=s(),Ne=J;J=ce,a[ce]={type:"block",expression:Ne}}return{type:"code",raw:M,lang:F,text:J}}}},f=/(?:\${2})([^\n`]+?)(?:\${2})/gi,p=0,s=function(){return"__special_katext_id_".concat(p++,"__")},a={};function b(){return a}function v(){p=0,a={}}function x(U){return U=U.replace(f,function(u,g){var M=s();return a[M]={type:"inline",expression:g},M}),U}var k=d.listitem;d.listitem=function(U){return k(x(U))};var H=d.paragraph;d.paragraph=function(U){return H(x(U))};var V=d.tablecell;d.tablecell=function(U,u){return V(x(U),u)},d.code=function(U,u,g){var M=(u||"").match(/\S*/)[0];return M?["latex","katex","math"].indexOf(M)>=0?"

    ".concat(U,"

    "):'
    ').concat(g?U:Object(A.escape)(U,!0),`
    `):'
    '+(g?U:Object(A.escape)(U,!0))+"
    "},d.heading=function(U,u,g){var M=this.options.headerPrefix+g.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return h.push({anchor:M,level:u,text:U}),"'+U+""},T.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),T.a.use({tokenizer:S,renderer:d});var Q=T.a,G=re("SJMd"),W=re("ulZh"),q=re.n(W),oe=re("m3rI"),fe=re("Oy/b"),ve=re("p5ED"),ke=re("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 Ee=function(U,u){return(Ee=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,M){g.__proto__=M}||function(g,M){for(var J in M)Object.prototype.hasOwnProperty.call(M,J)&&(g[J]=M[J])})(U,u)};function _e(U,u){function g(){this.constructor=U}Ee(U,u),U.prototype=u===null?Object.create(u):(g.prototype=u.prototype,new g)}function Te(U,u,g,M){return new(g||(g=Promise))(function(J,F){function ce(Tt){try{rt(M.next(Tt))}catch(Be){F(Be)}}function Ne(Tt){try{rt(M.throw(Tt))}catch(Be){F(Be)}}function rt(Tt){var Be;Tt.done?J(Tt.value):(Be=Tt.value,Be instanceof g?Be:new g(function(kt){kt(Be)})).then(ce,Ne)}rt((M=M.apply(U,u||[])).next())})}function Ce(U,u){var g,M,J,F,ce={label:0,sent:function(){if(1&J[0])throw J[1];return J[1]},trys:[],ops:[]};return F={next:Ne(0),throw:Ne(1),return:Ne(2)},typeof Symbol=="function"&&(F[Symbol.iterator]=function(){return this}),F;function Ne(rt){return function(Tt){return function(Be){if(g)throw new TypeError("Generator is already executing.");for(;ce;)try{if(g=1,M&&(J=2&Be[0]?M.return:Be[0]?M.throw||((J=M.return)&&J.call(M),0):M.next)&&!(J=J.call(M,Be[1])).done)return J;switch(M=0,J&&(Be=[2&Be[0],J.value]),Be[0]){case 0:case 1:J=Be;break;case 4:return ce.label++,{value:Be[1],done:!1};case 5:ce.label++,M=Be[1],Be=[0];continue;case 7:Be=ce.ops.pop(),ce.trys.pop();continue;default:if(!(J=ce.trys,(J=J.length>0&&J[J.length-1])||Be[0]!==6&&Be[0]!==2)){ce=0;continue}if(Be[0]===3&&(!J||Be[1]>J[0]&&Be[1]',"select"),this.addActionButton(M,'',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(M,'',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(M,'',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(M,'',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(M,'',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(M,'',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(M,'',"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(F){var ce=document.createElement("div");ce.className=""+g.toolbarButtonStyleClass.name,ce.setAttribute("data-type-name",F.typeName),ce.innerHTML=F.icon,ce.addEventListener("click",function(){g.markerToolbarButtonClicked(ce,F)}),g.buttons.push(ce),g.markerButtons.push(ce)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var J=document.createElement("div");J.className=this.toolbarBlockStyleClass.name,J.style.whiteSpace="nowrap",J.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(J),this.addActionButton(J,'',"render"),this.addActionButton(J,'',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},U.prototype.addButtonClickListener=function(u){this.buttonClickListeners.push(u)},U.prototype.removeButtonClickListener=function(u){this.buttonClickListeners.indexOf(u)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(u),1)},U.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},U.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var u=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var g=0;g0&&this.buttonClickListeners.forEach(function(M){return M("marker",g)}),this.markerButtonOverflowBlock.style.display="none"},U.prototype.actionToolbarButtonClicked=function(u,g){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(M){return M("action",g)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},U.prototype.setActiveButton=function(u){this.resetButtonStyles(),u.className=u.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),u.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},U.prototype.setActiveMarkerButton=function(u){var g=this.markerButtons.find(function(M){return M.getAttribute("data-type-name")===u});g&&this.setActiveButton(g)},U.prototype.setCurrentMarker=function(u){var g=this;this.currentMarker=u,this.buttons.filter(function(M){return/delete|notes/.test(M.getAttribute("data-action"))}).forEach(function(M){g.currentMarker===void 0?(M.style.fillOpacity="0.4",M.style.pointerEvents="none"):(M.style.fillOpacity="1",M.style.pointerEvents="all")})},U}(),He=function(){function U(u,g,M,J){this.panels=[],this.panelButtons=[],this.markerjsContainer=u,this.displayMode=g,this.uiStyleSettings=M,this.styles=J,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return U.prototype.addStyles=function(){var u;this.toolboxStyleClass=this.styles.addClass(new Le("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 Le("toolbox_colors",` color: `+this.uiStyleSettings.toolboxColor+`; `));var g=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new Le("toolbox-button-row",` display: flex; cursor: default; box-sizing: content-box; `)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new Le("toolbox-button-row_colors",` background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`; `)),this.toolboxPanelRowStyleClass=this.styles.addClass(new Le("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 Le("toolbox-panel-row_colors",` background-color: `+((u=this.uiStyleSettings.toolboxBackgroundColor)!==null&&u!==void 0?u:this.uiStyleSettings.toolbarBackgroundHoverColor)+`; `)),this.toolboxButtonStyleClass=this.styles.addClass(new Le("toolbox_button",` display: inline-block; width: `+(this.uiStyleSettings.toolbarHeight-2*g)+`px; height: `+(this.uiStyleSettings.toolbarHeight-2*g)+`px; padding: `+g+`px; box-sizing: content-box; `)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new Le("toolbox-button_colors",` fill: `+this.uiStyleSettings.toolbarColor+`; `)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new Le("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; `))},U.prototype.show=function(u){var g;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=u,this.uiContainer.className=this.toolboxStyleClass.name+" "+((g=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&g!==void 0?g:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},U.prototype.setPanelButtons=function(u){var g,M,J=this;this.panels=u,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((g=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&g!==void 0?g:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((M=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&M!==void 0?M:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(F){var ce;F.uiStyleSettings=J.uiStyleSettings;var Ne=document.createElement("div");Ne.className=J.toolboxButtonStyleClass.name+" "+((ce=J.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ce!==void 0?ce:J.toolboxButtonStyleColorsClass.name),Ne.innerHTML=F.icon,Ne.title=F.title,Ne.addEventListener("click",function(){J.panelButtonClick(F)}),J.panelButtons.push(Ne),J.buttonRow.appendChild(Ne)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},U.prototype.panelButtonClick=function(u){var g=this,M=-1;if(u!==this.activePanel){M=this.panels.indexOf(u),this.panelRow.innerHTML="";var J=u.getUi();J.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(J),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=u}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){g.displayMode==="inline"?g.panelRow.style.display="none":g.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(F,ce){var Ne,rt;F.className=g.toolboxButtonStyleClass.name+" "+(ce===M?""+((Ne=g.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Ne!==void 0?Ne:g.toolboxActiveButtonStyleColorsClass.name):""+((rt=g.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&rt!==void 0?rt:g.toolboxButtonStyleColorsClass.name))})},U}(),Ge=function(U,u){this.title=U,this.icon=u},je=function(U){function u(g,M,J,F){var ce=U.call(this,g,F||'')||this;return ce.colors=[],ce.addTransparent=!1,ce.colorBoxes=[],ce.colors=M,ce.currentColor=J,ce.setCurrentColor=ce.setCurrentColor.bind(ce),ce.getColorBox=ce.getColorBox.bind(ce),ce}return _e(u,U),u.prototype.getUi=function(){var g=this,M=document.createElement("div");return M.style.overflow="hidden",M.style.whiteSpace="nowrap",this.colors.forEach(function(J){var F=g.getColorBox(J);M.appendChild(F),g.colorBoxes.push(F)}),M},u.prototype.getColorBox=function(g){var M=this,J=this.uiStyleSettings.toolbarHeight/4,F=this.uiStyleSettings.toolbarHeight-J,ce=document.createElement("div");ce.style.display="inline-block",ce.style.boxSizing="content-box",ce.style.width=F-2+"px",ce.style.height=F-2+"px",ce.style.padding="1px",ce.style.marginRight="2px",ce.style.marginBottom="2px",ce.style.borderWidth="2px",ce.style.borderStyle="solid",ce.style.borderRadius=(F+2)/2+"px",ce.style.borderColor=g===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ce.addEventListener("click",function(){M.setCurrentColor(g,ce)});var Ne=document.createElement("div");return Ne.style.display="inline-block",Ne.style.width=F-2+"px",Ne.style.height=F-2+"px",Ne.style.backgroundColor=g,Ne.style.borderRadius=F/2+"px",g==="transparent"&&(Ne.style.fill=this.uiStyleSettings.toolboxAccentColor,Ne.innerHTML=` `),ce.appendChild(Ne),ce},u.prototype.setCurrentColor=function(g,M){var J=this;this.currentColor=g,this.colorBoxes.forEach(function(F){F.style.borderColor=F===M?J.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(g)},u}(Ge),Ue=function(){function U(u,g,M){this._state="new",this._isSelected=!1,this._container=u,this._overlayContainer=g,this.globalSettings=M,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(U.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),U.prototype.ownsTarget=function(u){return!1},Object.defineProperty(U.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),U.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},U.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},U.prototype.pointerDown=function(u,g){},U.prototype.dblClick=function(u,g){},U.prototype.manipulate=function(u){},U.prototype.pointerUp=function(u){this.stateChanged()},U.prototype.dispose=function(){},U.prototype.addMarkerVisualToContainer=function(u){this.container.childNodes.length>0?this.container.insertBefore(u,this.container.childNodes[0]):this.container.appendChild(u)},U.prototype.getState=function(){return{typeName:U.typeName,state:this.state,notes:this.notes}},U.prototype.restoreState=function(u){this._state=u.state,this.notes=u.notes},U.prototype.scale=function(u,g){},U.prototype.colorChanged=function(u){this.onColorChanged&&this.onColorChanged(u),this.stateChanged()},U.prototype.fillColorChanged=function(u){this.onFillColorChanged&&this.onFillColorChanged(u),this.stateChanged()},U.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var u=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),u.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(u)&&this.onStateChanged(this)}},U.typeName="MarkerBase",U}(),Re=function(){function U(){this.findGripByVisual=this.findGripByVisual.bind(this)}return U.prototype.findGripByVisual=function(u){return this.topLeft.ownsTarget(u)?this.topLeft:this.topCenter.ownsTarget(u)?this.topCenter:this.topRight.ownsTarget(u)?this.topRight:this.centerLeft.ownsTarget(u)?this.centerLeft:this.centerRight.ownsTarget(u)?this.centerRight:this.bottomLeft.ownsTarget(u)?this.bottomLeft:this.bottomCenter.ownsTarget(u)?this.bottomCenter:this.bottomRight.ownsTarget(u)?this.bottomRight:void 0},U}(),st=function(){function U(){this.GRIP_SIZE=10,this.visual=ne.createGroup(),this.visual.appendChild(ne.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(ne.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return U.prototype.ownsTarget=function(u){return u===this.visual||u===this.visual.childNodes[0]||u===this.visual.childNodes[1]},U}(),Je=function(){function U(){}return U.toITransformMatrix=function(u){return{a:u.a,b:u.b,c:u.c,d:u.d,e:u.e,f:u.f}},U.toSVGMatrix=function(u,g){return u.a=g.a,u.b=g.b,u.c=g.c,u.d=g.d,u.e=g.e,u.f=g.f,u},U}(),Qe=function(U){function u(g,M,J){var F=U.call(this,g,M,J)||this;return F.left=0,F.top=0,F.width=0,F.height=0,F.defaultSize={x:50,y:20},F.offsetX=0,F.offsetY=0,F.rotationAngle=0,F.CB_DISTANCE=10,F._suppressMarkerCreateEvent=!1,F.container.transform.baseVal.appendItem(ne.createTransform()),F.setupControlBox(),F}return _e(u,U),Object.defineProperty(u.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"visual",{get:function(){return this._visual},set:function(g){this._visual=g;var M=ne.createTransform();this._visual.transform.baseVal.appendItem(M)},enumerable:!1,configurable:!0}),u.prototype.ownsTarget=function(g){return!!U.prototype.ownsTarget.call(this,g)||!!(this.controlGrips.findGripByVisual(g)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(g))},u.prototype.pointerDown=function(g,M){U.prototype.pointerDown.call(this,g,M),this.state==="new"&&(this.left=g.x,this.top=g.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var J=this.unrotatePoint(g);if(this.manipulationStartX=J.x,this.manipulationStartY=J.y,this.offsetX=J.x-this.left,this.offsetY=J.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(M),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(M)){this.activeGrip=this.rotatorGrip;var F=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=F.x-this.width/2,this.top=F.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var ce=this.container.transform.baseVal.getItem(0);ce.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(ce,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},u.prototype.pointerUp=function(g){var M=this.state;U.prototype.pointerUp.call(this,g),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(g),this._state="select",M==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},u.prototype.moveVisual=function(g){this.visual.style.transform="translate("+g.x+"px, "+g.y+"px)"},u.prototype.manipulate=function(g){var M=this.unrotatePoint(g);this.state==="creating"?this.resize(g):this.state==="move"?(this.left=this.manipulationStartLeft+(M.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(M.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(M):this.state==="rotate"&&this.rotate(g)},u.prototype.resize=function(g){var M=this.manipulationStartLeft,J=this.manipulationStartWidth,F=this.manipulationStartTop,ce=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:M=this.manipulationStartLeft+g.x-this.manipulationStartX,J=this.manipulationStartWidth+this.manipulationStartLeft-M;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:J=this.manipulationStartWidth+g.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:F=this.manipulationStartTop+g.y-this.manipulationStartY,ce=this.manipulationStartHeight+this.manipulationStartTop-F;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:ce=this.manipulationStartHeight+g.y-this.manipulationStartY}J>=0?(this.left=M,this.width=J):(this.left=M+J,this.width=-J),ce>=0?(this.top=F,this.height=ce):(this.top=F+ce,this.height=-ce),this.setSize()},u.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},u.prototype.rotate=function(g){if(Math.abs(g.x-this.centerX)>.1){var M=Math.sign(g.x-this.centerX);this.rotationAngle=180*Math.atan((g.y-this.centerY)/(g.x-this.centerX))/Math.PI+90*M,this.applyRotation()}},u.prototype.applyRotation=function(){var g=this.container.transform.baseVal.getItem(0);g.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(g,0)},u.prototype.rotatePoint=function(g){if(this.rotationAngle===0)return g;var M=this.container.getCTM(),J=ne.createPoint(g.x,g.y);return{x:(J=J.matrixTransform(M)).x,y:J.y}},u.prototype.unrotatePoint=function(g){if(this.rotationAngle===0)return g;var M=this.container.getCTM();M=M.inverse();var J=ne.createPoint(g.x,g.y);return{x:(J=J.matrixTransform(M)).x,y:J.y}},u.prototype.select=function(){U.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},u.prototype.deselect=function(){U.prototype.deselect.call(this),this.controlBox.style.display="none"},u.prototype.setupControlBox=function(){this.controlBox=ne.createGroup();var g=ne.createTransform();g.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(g),this.container.appendChild(this.controlBox),this.controlRect=ne.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=ne.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 Re,this.addControlGrips(),this.controlBox.style.display="none"},u.prototype.adjustControlBox=function(){var g=this.controlBox.transform.baseVal.getItem(0);g.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(g,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()},u.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()},u.prototype.createGrip=function(){var g=new st;return g.visual.transform.baseVal.appendItem(ne.createTransform()),this.controlBox.appendChild(g.visual),g},u.prototype.positionGrips=function(){var g=this.controlGrips.topLeft.GRIP_SIZE,M=-g/2,J=M,F=(this.width+this.CB_DISTANCE)/2-g/2,ce=(this.height+this.CB_DISTANCE)/2-g/2,Ne=this.height+this.CB_DISTANCE-g/2,rt=this.width+this.CB_DISTANCE-g/2;this.positionGrip(this.controlGrips.topLeft.visual,M,J),this.positionGrip(this.controlGrips.topCenter.visual,F,J),this.positionGrip(this.controlGrips.topRight.visual,rt,J),this.positionGrip(this.controlGrips.centerLeft.visual,M,ce),this.positionGrip(this.controlGrips.centerRight.visual,rt,ce),this.positionGrip(this.controlGrips.bottomLeft.visual,M,Ne),this.positionGrip(this.controlGrips.bottomCenter.visual,F,Ne),this.positionGrip(this.controlGrips.bottomRight.visual,rt,Ne),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,F,J-3*this.CB_DISTANCE)},u.prototype.positionGrip=function(g,M,J){var F=g.transform.baseVal.getItem(0);F.setTranslate(M,J),g.transform.baseVal.replaceItem(F,0)},u.prototype.hideControlBox=function(){this.controlBox.style.display="none"},u.prototype.showControlBox=function(){this.controlBox.style.display=""},u.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)},U.prototype.getState.call(this))},u.prototype.restoreState=function(g){U.prototype.restoreState.call(this,g);var M=g;this.left=M.left,this.top=M.top,this.width=M.width,this.height=M.height,this.rotationAngle=M.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(Je.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,M.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(Je.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,M.containerTransformMatrix))},u.prototype.scale=function(g,M){U.prototype.scale.call(this,g,M);var J=this.rotatePoint({x:this.left,y:this.top}),F=this.unrotatePoint({x:J.x*g,y:J.y*M});this.left=F.x,this.top=F.y,this.width=this.width*g,this.height=this.height*M,this.adjustControlBox()},u}(Ue),nt=function(U){function u(g,M,J){var F=U.call(this,g,M,J)||this;return F.fillColor="transparent",F.strokeColor="transparent",F.strokeWidth=0,F.strokeDasharray="",F.opacity=1,F.setStrokeColor=F.setStrokeColor.bind(F),F.setFillColor=F.setFillColor.bind(F),F.setStrokeWidth=F.setStrokeWidth.bind(F),F.setStrokeDasharray=F.setStrokeDasharray.bind(F),F.createVisual=F.createVisual.bind(F),F}return _e(u,U),u.prototype.ownsTarget=function(g){return!(!U.prototype.ownsTarget.call(this,g)&&g!==this.visual)},u.prototype.createVisual=function(){this.visual=ne.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)},u.prototype.pointerDown=function(g,M){U.prototype.pointerDown.call(this,g,M),this.state==="new"&&(this.createVisual(),this.moveVisual(g),this._state="creating")},u.prototype.manipulate=function(g){U.prototype.manipulate.call(this,g)},u.prototype.resize=function(g){U.prototype.resize.call(this,g),this.setSize()},u.prototype.setSize=function(){U.prototype.setSize.call(this),ne.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},u.prototype.pointerUp=function(g){U.prototype.pointerUp.call(this,g),this.setSize()},u.prototype.setStrokeColor=function(g){this.strokeColor=g,this.visual&&ne.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(g),this.stateChanged()},u.prototype.setFillColor=function(g){this.fillColor=g,this.visual&&ne.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},u.prototype.setStrokeWidth=function(g){this.strokeWidth=g,this.visual&&ne.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},u.prototype.setStrokeDasharray=function(g){this.strokeDasharray=g,this.visual&&ne.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},u.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},U.prototype.getState.call(this))},u.prototype.restoreState=function(g){var M=g;this.fillColor=M.fillColor,this.strokeColor=M.strokeColor,this.strokeWidth=M.strokeWidth,this.strokeDasharray=M.strokeDasharray,this.opacity=M.opacity,this.createVisual(),U.prototype.restoreState.call(this,g),this.setSize()},u.prototype.scale=function(g,M){U.prototype.scale.call(this,g,M),this.setSize()},u.title="Rectangle marker",u}(Qe),bt=function(U){function u(g,M,J,F){var ce=U.call(this,g,F||'')||this;return ce.widths=[],ce.widthBoxes=[],ce.widths=M,ce.currentWidth=J,ce.setCurrentWidth=ce.setCurrentWidth.bind(ce),ce}return _e(u,U),u.prototype.getUi=function(){var g=this,M=document.createElement("div");return M.style.display="flex",M.style.overflow="hidden",M.style.flexGrow="2",this.widths.forEach(function(J){var F=document.createElement("div");F.style.display="flex",F.style.flexGrow="2",F.style.alignItems="center",F.style.justifyContent="space-between",F.style.padding="5px",F.style.borderWidth="2px",F.style.borderStyle="solid",F.style.borderColor=J===g.currentWidth?g.uiStyleSettings.toolboxAccentColor:"transparent",F.addEventListener("click",function(){g.setCurrentWidth(J,F)}),M.appendChild(F);var ce=document.createElement("div");ce.innerText=J.toString(),ce.style.marginRight="5px",F.appendChild(ce);var Ne=document.createElement("div");Ne.style.minHeight="20px",Ne.style.flexGrow="2",Ne.style.display="flex",Ne.style.alignItems="center";var rt=document.createElement("hr");rt.style.minWidth="20px",rt.style.border="0px",rt.style.borderTop=J+"px solid "+g.uiStyleSettings.toolboxColor,rt.style.flexGrow="2",Ne.appendChild(rt),F.appendChild(Ne),g.widthBoxes.push(F)}),M},u.prototype.setCurrentWidth=function(g,M){var J=this;this.currentWidth=g,this.widthBoxes.forEach(function(F){F.style.borderColor=F===M?J.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},u}(Ge),at=function(U){function u(g,M,J,F){var ce=U.call(this,g,F||'')||this;return ce.styles=[],ce.styleBoxes=[],ce.styles=M,ce.currentStyle=J,ce.setCurrentStyle=ce.setCurrentStyle.bind(ce),ce}return _e(u,U),u.prototype.getUi=function(){var g=this,M=document.createElement("div");return M.style.display="flex",M.style.overflow="hidden",M.style.flexGrow="2",this.styles.forEach(function(J){var F=document.createElement("div");F.style.display="flex",F.style.alignItems="center",F.style.justifyContent="space-between",F.style.padding="5px",F.style.borderWidth="2px",F.style.borderStyle="solid",F.style.overflow="hidden",F.style.maxWidth=100/g.styles.length-5+"%",F.style.borderColor=J===g.currentStyle?g.uiStyleSettings.toolboxAccentColor:"transparent",F.addEventListener("click",function(){g.setCurrentStyle(J,F)}),M.appendChild(F);var ce=document.createElement("div");ce.style.minHeight="20px",ce.style.flexGrow="2",ce.style.overflow="hidden";var Ne=` `;ce.innerHTML=Ne,F.appendChild(ce),g.styleBoxes.push(F)}),M},u.prototype.setCurrentStyle=function(g,M){var J=this;this.currentStyle=g,this.styleBoxes.forEach(function(F){F.style.borderColor=F===M?J.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},u}(Ge),ht=function(U){function u(g,M,J){var F=U.call(this,g,M,J)||this;return F.strokeColor=J.defaultColor,F.strokeWidth=J.defaultStrokeWidth,F.strokeDasharray=J.defaultStrokeDasharray,F.strokePanel=new je("Line color",J.defaultColorSet,J.defaultColor),F.strokePanel.onColorChanged=F.setStrokeColor,F.strokeWidthPanel=new bt("Line width",J.defaultStrokeWidths,J.defaultStrokeWidth),F.strokeWidthPanel.onWidthChanged=F.setStrokeWidth,F.strokeStylePanel=new at("Line style",J.defaultStrokeDasharrays,J.defaultStrokeDasharray),F.strokeStylePanel.onStyleChanged=F.setStrokeDasharray,F}return _e(u,U),Object.defineProperty(u.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),u.prototype.getState=function(){var g=U.prototype.getState.call(this);return g.typeName=u.typeName,g},u.typeName="FrameMarker",u.title="Frame marker",u.icon='',u}(nt),Ae=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},gt=function(U){function u(g,M,J){var F=U.call(this,g,M,J)||this;return F.x1=0,F.y1=0,F.x2=0,F.y2=0,F.defaultLength=50,F.manipulationStartX=0,F.manipulationStartY=0,F.manipulationStartX1=0,F.manipulationStartY1=0,F.manipulationStartX2=0,F.manipulationStartY2=0,F.setupControlBox(),F}return _e(u,U),u.prototype.ownsTarget=function(g){return!!U.prototype.ownsTarget.call(this,g)||!(!this.grip1.ownsTarget(g)&&!this.grip2.ownsTarget(g))},u.prototype.pointerDown=function(g,M){U.prototype.pointerDown.call(this,g,M),this.manipulationStartX=g.x,this.manipulationStartY=g.y,this.state==="new"&&(this.x1=g.x,this.y1=g.y,this.x2=g.x,this.y2=g.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(M)?this.activeGrip=this.grip1:this.grip2.ownsTarget(M)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},u.prototype.pointerUp=function(g){var M=this.state;U.prototype.pointerUp.call(this,g),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(g),this._state="select",M==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},u.prototype.adjustVisual=function(){},u.prototype.manipulate=function(g){this.state==="creating"?this.resize(g):this.state==="move"?(this.x1=this.manipulationStartX1+g.x-this.manipulationStartX,this.y1=this.manipulationStartY1+g.y-this.manipulationStartY,this.x2=this.manipulationStartX2+g.x-this.manipulationStartX,this.y2=this.manipulationStartY2+g.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(g)},u.prototype.resize=function(g){switch(this.activeGrip){case this.grip1:this.x1=g.x,this.y1=g.y;break;case this.grip2:case void 0:this.x2=g.x,this.y2=g.y}this.adjustVisual(),this.adjustControlBox()},u.prototype.select=function(){U.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},u.prototype.deselect=function(){U.prototype.deselect.call(this),this.controlBox.style.display="none"},u.prototype.setupControlBox=function(){this.controlBox=ne.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},u.prototype.adjustControlBox=function(){this.positionGrips()},u.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},u.prototype.createGrip=function(){var g=new st;return g.visual.transform.baseVal.appendItem(ne.createTransform()),this.controlBox.appendChild(g.visual),g},u.prototype.positionGrips=function(){var g=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-g/2,this.y1-g/2),this.positionGrip(this.grip2.visual,this.x2-g/2,this.y2-g/2)},u.prototype.positionGrip=function(g,M,J){var F=g.transform.baseVal.getItem(0);F.setTranslate(M,J),g.transform.baseVal.replaceItem(F,0)},u.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},U.prototype.getState.call(this))},u.prototype.restoreState=function(g){U.prototype.restoreState.call(this,g);var M=g;this.x1=M.x1,this.y1=M.y1,this.x2=M.x2,this.y2=M.y2},u.prototype.scale=function(g,M){U.prototype.scale.call(this,g,M),this.x1=this.x1*g,this.y1=this.y1*M,this.x2=this.x2*g,this.y2=this.y2*M,this.adjustVisual(),this.adjustControlBox()},u}(Ue),dt=function(U){function u(g,M,J){var F=U.call(this,g,M,J)||this;return F.strokeColor="transparent",F.strokeWidth=0,F.strokeDasharray="",F.setStrokeColor=F.setStrokeColor.bind(F),F.setStrokeWidth=F.setStrokeWidth.bind(F),F.setStrokeDasharray=F.setStrokeDasharray.bind(F),F.strokeColor=J.defaultColor,F.strokeWidth=J.defaultStrokeWidth,F.strokeDasharray=J.defaultStrokeDasharray,F.strokePanel=new je("Line color",J.defaultColorSet,J.defaultColor),F.strokePanel.onColorChanged=F.setStrokeColor,F.strokeWidthPanel=new bt("Line width",J.defaultStrokeWidths,J.defaultStrokeWidth),F.strokeWidthPanel.onWidthChanged=F.setStrokeWidth,F.strokeStylePanel=new at("Line style",J.defaultStrokeDasharrays,J.defaultStrokeDasharray),F.strokeStylePanel.onStyleChanged=F.setStrokeDasharray,F}return _e(u,U),u.prototype.ownsTarget=function(g){return!(!U.prototype.ownsTarget.call(this,g)&&g!==this.visual&&g!==this.selectorLine&&g!==this.visibleLine)},u.prototype.createVisual=function(){this.visual=ne.createGroup(),this.selectorLine=ne.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=ne.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)},u.prototype.pointerDown=function(g,M){U.prototype.pointerDown.call(this,g,M),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},u.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()),ne.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),ne.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),ne.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},u.prototype.setStrokeColor=function(g){this.strokeColor=g,this.adjustVisual(),this.colorChanged(g)},u.prototype.setStrokeWidth=function(g){this.strokeWidth=g,this.adjustVisual()},u.prototype.setStrokeDasharray=function(g){this.strokeDasharray=g,this.adjustVisual(),this.stateChanged()},Object.defineProperty(u.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),u.prototype.getState=function(){var g=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},U.prototype.getState.call(this));return g.typeName=u.typeName,g},u.prototype.restoreState=function(g){U.prototype.restoreState.call(this,g);var M=g;this.strokeColor=M.strokeColor,this.strokeWidth=M.strokeWidth,this.strokeDasharray=M.strokeDasharray,this.createVisual(),this.adjustVisual()},u.typeName="LineMarker",u.title="Line marker",u.icon='',u}(gt),De=function(U){function u(g,M,J,F){var ce=U.call(this,g,F||'')||this;return ce.fonts=[],ce.fontBoxes=[],ce.fonts=M,ce.currentFont=J,ce.setCurrentFont=ce.setCurrentFont.bind(ce),ce}return _e(u,U),u.prototype.getUi=function(){var g=this,M=document.createElement("div");return M.style.overflow="hidden",M.style.flexGrow="2",this.fonts.forEach(function(J){var F=document.createElement("div");F.style.display="inline-block",F.style.alignItems="center",F.style.justifyContent="space-between",F.style.padding="5px",F.style.borderWidth="2px",F.style.borderStyle="solid",F.style.overflow="hidden",F.style.maxWidth=100/g.fonts.length-5+"%",F.style.borderColor=J===g.currentFont?g.uiStyleSettings.toolboxAccentColor:"transparent",F.addEventListener("click",function(){g.setCurrentFont(J,F)}),M.appendChild(F);var ce=document.createElement("div");ce.style.display="flex",ce.style.minHeight="20px",ce.style.flexGrow="2",ce.style.fontFamily=J,ce.style.overflow="hidden";var Ne=document.createElement("div");Ne.style.whiteSpace="nowrap",Ne.style.overflow="hidden",Ne.style.textOverflow="ellipsis",Ne.innerHTML="The quick brown fox jumps over the lazy dog",ce.appendChild(Ne),F.appendChild(ce),g.fontBoxes.push(F)}),M},u.prototype.setCurrentFont=function(g,M){var J=this;this.currentFont=g,this.fontBoxes.forEach(function(F){F.style.borderColor=F===M?J.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},u}(Ge),We=function(U){function u(g,M,J){var F=U.call(this,g,M,J)||this;return F.color="transparent",F.padding=5,F.DEFAULT_TEXT="your text here",F.text=F.DEFAULT_TEXT,F.isMoved=!1,F.color=J.defaultColor,F.fontFamily=J.defaultFontFamily,F.defaultSize={x:100,y:30},F.setColor=F.setColor.bind(F),F.setFont=F.setFont.bind(F),F.renderText=F.renderText.bind(F),F.sizeText=F.sizeText.bind(F),F.textEditDivClicked=F.textEditDivClicked.bind(F),F.showTextEditor=F.showTextEditor.bind(F),F.setSize=F.setSize.bind(F),F.positionTextEditor=F.positionTextEditor.bind(F),F.colorPanel=new je("Color",J.defaultColorSet,J.defaultColor),F.colorPanel.onColorChanged=F.setColor,F.fontFamilyPanel=new De("Font",J.defaultFontFamilies,J.defaultFontFamily),F.fontFamilyPanel.onFontChanged=F.setFont,F}return _e(u,U),u.prototype.ownsTarget=function(g){if(U.prototype.ownsTarget.call(this,g)||g===this.visual||g===this.textElement||g===this.bgRectangle)return!0;var M=!1;return this.textElement.childNodes.forEach(function(J){J===g&&(M=!0)}),M},u.prototype.createVisual=function(){this.visual=ne.createGroup(),this.bgRectangle=ne.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=ne.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(ne.createTransform()),this.textElement.transform.baseVal.appendItem(ne.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},u.prototype.pointerDown=function(g,M){U.prototype.pointerDown.call(this,g,M),this.isMoved=!1,this.pointerDownPoint=g,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(g),this._state="creating")},u.prototype.renderText=function(){var g=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(M){g.textElement.appendChild(ne.createTSpan(M.trim()===""?" ":M.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},u.prototype.getTextScale=function(){var g=this.textElement.getBBox(),M=1;if(g.width>0&&g.height>0){var J=(1*this.width-this.width*this.padding*2/100)/g.width,F=(1*this.height-this.height*this.padding*2/100)/g.height;M=Math.min(J,F)}return M},u.prototype.getTextPosition=function(g){var M=this.textElement.getBBox(),J=0,F=0;return M.width>0&&M.height>0&&(J=(this.width-M.width*g)/2,F=this.height/2-M.height*g/2),{x:J,y:F}},u.prototype.sizeText=function(){var g=this.textElement.getBBox(),M=this.getTextScale(),J=this.getTextPosition(M);J.y-=g.y*M,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+J.x+"px, "+J.y+"px) scale("+M+", "+M+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(J.x,J.y),this.textElement.transform.baseVal.getItem(1).setScale(M,M))},u.prototype.manipulate=function(g){U.prototype.manipulate.call(this,g),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(g.x-this.pointerDownPoint.x)>5||Math.abs(g.y-this.pointerDownPoint.y)>5)},u.prototype.resize=function(g){U.prototype.resize.call(this,g),this.isMoved=!0,this.setSize(),this.sizeText()},u.prototype.setSize=function(){U.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(ne.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),ne.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},u.prototype.pointerUp=function(g){var M=this.state;M==="creating"&&(this._suppressMarkerCreateEvent=!0),U.prototype.pointerUp.call(this,g),this.setSize(),(M==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},u.prototype.showTextEditor=function(){var g=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(M){M.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var M=Number.parseFloat(g.textEditor.style.fontSize);g.textEditor.clientWidth>=Number.parseInt(g.textEditor.style.maxWidth)&&M>.9;)M-=.1,g.textEditor.style.fontSize=Math.max(M,.9)+"em"}),this.textEditor.addEventListener("keyup",function(M){M.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(M){if(M.clipboardData){var J=M.clipboardData.getData("text"),F=window.getSelection();if(!F.rangeCount)return!1;F.deleteFromDocument(),F.getRangeAt(0).insertNode(document.createTextNode(J)),M.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){g.textEditDivClicked(g.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},u.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var g=this.getTextScale(),M=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),J=this.textElement.getBBox(),F={x:J.width*g,y:J.height*g};M.x-=F.x/2,M.y-=F.y/2,this.textEditor.style.top=M.y+"px",this.textEditor.style.left=M.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-M.x+"px",this.textEditor.style.fontSize=Math.max(16*g,12)+"px",this.textElement.style.display="none"}},u.prototype.textEditDivClicked=function(g){this.text=g.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},u.prototype.select=function(){U.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},u.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),U.prototype.deselect.call(this)},u.prototype.dblClick=function(g,M){U.prototype.dblClick.call(this,g,M),this.showTextEditor()},u.prototype.setColor=function(g){this.textElement&&ne.setAttributes(this.textElement,[["fill",g]]),this.color=g,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(g)},u.prototype.setFont=function(g){this.textElement&&ne.setAttributes(this.textElement,[["font-family",g]]),this.fontFamily=g,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},u.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},u.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(u.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),u.prototype.getState=function(){var g=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},U.prototype.getState.call(this));return g.typeName=u.typeName,g},u.prototype.restoreState=function(g){var M=g;this.color=M.color,this.fontFamily=M.fontFamily,this.padding=M.padding,this.text=M.text,this.createVisual(),U.prototype.restoreState.call(this,g),this.setSize()},u.prototype.scale=function(g,M){U.prototype.scale.call(this,g,M),this.setSize(),this.sizeText(),this.positionTextEditor()},u.typeName="TextMarker",u.title="Text marker",u.icon='',u}(Qe),ge=function(U){function u(g,M,J){var F=U.call(this,g,M,J)||this;return F.color="transparent",F.lineWidth=3,F.drawing=!1,F.pixelRatio=1,F.color=J.defaultColor,F.lineWidth=J.defaultStrokeWidth,F.pixelRatio=J.freehandPixelRatio,F.setColor=F.setColor.bind(F),F.addCanvas=F.addCanvas.bind(F),F.finishCreation=F.finishCreation.bind(F),F.setLineWidth=F.setLineWidth.bind(F),F.colorPanel=new je("Color",J.defaultColorSet,J.defaultColor),F.colorPanel.onColorChanged=F.setColor,F.lineWidthPanel=new bt("Line width",J.defaultStrokeWidths,J.defaultStrokeWidth),F.lineWidthPanel.onWidthChanged=F.setLineWidth,F}return _e(u,U),u.prototype.ownsTarget=function(g){return!(!U.prototype.ownsTarget.call(this,g)&&g!==this.visual&&g!==this.drawingImage)},u.prototype.createVisual=function(){this.visual=ne.createGroup(),this.drawingImage=ne.createImage(),this.visual.appendChild(this.drawingImage);var g=ne.createTransform();this.visual.transform.baseVal.appendItem(g),this.addMarkerVisualToContainer(this.visual)},u.prototype.pointerDown=function(g,M){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(g.x,g.y),this.drawing=!0):U.prototype.pointerDown.call(this,g,M)},u.prototype.manipulate=function(g){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(g.x,g.y),this.canvasContext.stroke()):U.prototype.manipulate.call(this,g)},u.prototype.resize=function(g){U.prototype.resize.call(this,g),ne.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),ne.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},u.prototype.pointerUp=function(g){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):U.prototype.pointerUp.call(this,g)},u.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)},u.prototype.select=function(){this.state==="creating"&&this.finishCreation(),U.prototype.select.call(this)},u.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),U.prototype.deselect.call(this)},u.prototype.finishCreation=function(){for(var g=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),M=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],J=M[0],F=M[1],ce=M[2],Ne=M[3],rt=!1,Tt=0;Tt0&&(rt=!0,TtNe&&(Ne=Tt),Be>ce&&(ce=Be));if(rt){this.left=J/this.pixelRatio,this.top=F/this.pixelRatio,this.width=(ce-J)/this.pixelRatio,this.height=(Ne-F)/this.pixelRatio;var kt=document.createElement("canvas");kt.width=ce-J,kt.height=Ne-F,kt.getContext("2d").putImageData(this.canvasContext.getImageData(J,F,ce-J,Ne-F),0,0),this.drawingImgUrl=kt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},u.prototype.setDrawingImage=function(){ne.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),ne.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},u.prototype.setColor=function(g){this.color=g,this.colorChanged(g)},u.prototype.setLineWidth=function(g){this.lineWidth=g},Object.defineProperty(u.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),u.prototype.getState=function(){var g=Object.assign({drawingImgUrl:this.drawingImgUrl},U.prototype.getState.call(this));return g.typeName=u.typeName,g},u.prototype.restoreState=function(g){this.createVisual(),U.prototype.restoreState.call(this,g),this.drawingImgUrl=g.drawingImgUrl,this.setDrawingImage()},u.prototype.scale=function(g,M){U.prototype.scale.call(this,g,M),this.setDrawingImage()},u.typeName="FreehandMarker",u.title="Freehand marker",u.icon='',u}(Qe),de=function(U){function u(g,M,J){var F=U.call(this,g,J||'')||this;return F.typeBoxes=[],F.currentType=M,F.setCurrentType=F.setCurrentType.bind(F),F}return _e(u,U),u.prototype.getUi=function(){var g=this,M=document.createElement("div");M.style.display="flex",M.style.overflow="hidden",M.style.flexGrow="2";for(var J=function(Ne){var rt="both";switch(Ne){case 0:rt="both";break;case 1:rt="start";break;case 2:rt="end";break;case 3:rt="none"}var Tt=document.createElement("div");if(Tt.style.display="flex",Tt.style.flexGrow="2",Tt.style.alignItems="center",Tt.style.justifyContent="space-between",Tt.style.padding="5px",Tt.style.borderWidth="2px",Tt.style.borderStyle="solid",Tt.style.borderColor=rt===F.currentType?F.uiStyleSettings.toolboxAccentColor:"transparent",Tt.addEventListener("click",function(){g.setCurrentType(rt,Tt)}),M.appendChild(Tt),rt==="both"||rt==="start"){var Be=document.createElement("div");Be.style.display="flex",Be.style.alignItems="center",Be.style.minHeight="20px",Be.innerHTML=` `,Be.style.marginLeft="5px",Tt.appendChild(Be)}var kt=document.createElement("div");kt.style.display="flex",kt.style.alignItems="center",kt.style.minHeight="20px",kt.style.flexGrow="2";var er=document.createElement("hr");if(er.style.minWidth="20px",er.style.border="0px",er.style.borderTop="3px solid "+(F.uiStyleSettings!==void 0?F.uiStyleSettings.toolboxColor:"#eeeeee"),er.style.flexGrow="2",kt.appendChild(er),Tt.appendChild(kt),rt==="both"||rt==="end"){var fr=document.createElement("div");fr.style.display="flex",fr.style.alignItems="center",fr.style.minHeight="20px",fr.innerHTML=` `,fr.style.marginRight="5px",Tt.appendChild(fr)}F.typeBoxes.push(Tt)},F=this,ce=0;ce<4;ce++)J(ce);return M},u.prototype.setCurrentType=function(g,M){var J=this;this.currentType=g,this.typeBoxes.forEach(function(F){F.style.borderColor=F===M?J.uiStyleSettings!==void 0?J.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},u}(Ge),pe=function(U){function u(g,M,J){var F=U.call(this,g,M,J)||this;return F.arrowType="end",F.arrowBaseHeight=10,F.arrowBaseWidth=10,F.getArrowPoints=F.getArrowPoints.bind(F),F.setArrowType=F.setArrowType.bind(F),F.arrowTypePanel=new de("Arrow type","end"),F.arrowTypePanel.onArrowTypeChanged=F.setArrowType,F}return _e(u,U),u.prototype.ownsTarget=function(g){return!(!U.prototype.ownsTarget.call(this,g)&&g!==this.arrow1&&g!==this.arrow2)},u.prototype.getArrowPoints=function(g,M){var J=this.arrowBaseWidth+2*this.strokeWidth,F=this.arrowBaseHeight+2*this.strokeWidth;return g-J/2+","+(M+F/2)+" "+g+","+(M-F/2)+" "+(g+J/2)+","+(M+F/2)},u.prototype.createTips=function(){this.arrow1=ne.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(ne.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=ne.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(ne.createTransform()),this.visual.appendChild(this.arrow2)},u.prototype.pointerDown=function(g,M){U.prototype.pointerDown.call(this,g,M),this.state==="creating"&&this.createTips()},u.prototype.adjustVisual=function(){if(U.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",ne.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),ne.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var g=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),M=this.arrow1.transform.baseVal.getItem(0);M.setRotate(g,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(M,0);var J=this.arrow2.transform.baseVal.getItem(0);J.setRotate(g+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(J,0)}},u.prototype.setArrowType=function(g){this.arrowType=g,this.adjustVisual(),this.stateChanged()},Object.defineProperty(u.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),u.prototype.getState=function(){var g=Object.assign({arrowType:this.arrowType},U.prototype.getState.call(this));return g.typeName=u.typeName,g},u.prototype.restoreState=function(g){U.prototype.restoreState.call(this,g);var M=g;this.arrowType=M.arrowType,this.createTips(),this.adjustVisual()},u.typeName="ArrowMarker",u.title="Arrow marker",u.icon='',u}(dt),ee=function(U){function u(g,M,J){var F=U.call(this,g,M,J)||this;return F.fillColor=J.defaultFillColor,F.strokeWidth=0,F.fillPanel=new je("Color",J.defaultColorSet,J.defaultFillColor),F.fillPanel.onColorChanged=F.setFillColor,F}return _e(u,U),Object.defineProperty(u.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),u.prototype.getState=function(){var g=U.prototype.getState.call(this);return g.typeName=u.typeName,g},u.typeName="CoverMarker",u.title="Cover marker",u.icon='',u}(nt),te=function(U){function u(g,M,J,F){var ce=U.call(this,g,F||'')||this;return ce.opacities=[],ce.opacityBoxes=[],ce.opacities=M,ce.currentOpacity=J,ce.setCurrentOpacity=ce.setCurrentOpacity.bind(ce),ce}return _e(u,U),u.prototype.getUi=function(){var g=this,M=document.createElement("div");return M.style.display="flex",M.style.overflow="hidden",M.style.flexGrow="2",M.style.justifyContent="space-between",this.opacities.forEach(function(J){var F=document.createElement("div");F.style.display="flex",F.style.alignItems="center",F.style.justifyContent="center",F.style.padding="5px",F.style.borderWidth="2px",F.style.borderStyle="solid",F.style.borderColor=J===g.currentOpacity?g.uiStyleSettings.toolboxAccentColor:"transparent",F.addEventListener("click",function(){g.setCurrentOpacity(J,F)}),M.appendChild(F);var ce=document.createElement("div");ce.innerText=100*J+"%",F.appendChild(ce),g.opacityBoxes.push(F)}),M},u.prototype.setCurrentOpacity=function(g,M){var J=this;this.currentOpacity=g,this.opacityBoxes.forEach(function(F){F.style.borderColor=F===M?J.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},u}(Ge),ie=function(U){function u(g,M,J){var F=U.call(this,g,M,J)||this;return F.setOpacity=F.setOpacity.bind(F),F.fillColor=J.defaultHighlightColor,F.strokeWidth=0,F.opacity=J.defaultHighlightOpacity,F.fillPanel=new je("Color",J.defaultColorSet,F.fillColor),F.fillPanel.onColorChanged=F.setFillColor,F.opacityPanel=new te("Opacity",J.defaultOpacitySteps,F.opacity),F.opacityPanel.onOpacityChanged=F.setOpacity,F}return _e(u,U),u.prototype.setOpacity=function(g){this.opacity=g,this.visual&&ne.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(u.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),u.prototype.getState=function(){var g=U.prototype.getState.call(this);return g.typeName=u.typeName,g},u.typeName="HighlightMarker",u.title="Highlight marker",u.icon='',u}(ee),se='',ue=function(U){function u(g,M,J){var F=U.call(this,g,M,J)||this;return F.bgColor="transparent",F.tipPosition={x:0,y:0},F.tipBase1Position={x:0,y:0},F.tipBase2Position={x:0,y:0},F.tipMoving=!1,F.color=J.defaultStrokeColor,F.bgColor=J.defaultFillColor,F.fontFamily=J.defaultFontFamily,F.defaultSize={x:100,y:30},F.setBgColor=F.setBgColor.bind(F),F.getTipPoints=F.getTipPoints.bind(F),F.positionTip=F.positionTip.bind(F),F.setTipPoints=F.setTipPoints.bind(F),F.colorPanel=new je("Text color",J.defaultColorSet,F.color,''),F.colorPanel.onColorChanged=F.setColor,F.bgColorPanel=new je("Fill color",J.defaultColorSet,F.bgColor,se),F.bgColorPanel.onColorChanged=F.setBgColor,F.fontFamilyPanel=new De("Font",J.defaultFontFamilies,J.defaultFontFamily),F.fontFamilyPanel.onFontChanged=F.setFont,F.tipGrip=new st,F.tipGrip.visual.transform.baseVal.appendItem(ne.createTransform()),F.controlBox.appendChild(F.tipGrip.visual),F}return _e(u,U),u.prototype.ownsTarget=function(g){return U.prototype.ownsTarget.call(this,g)||this.tipGrip.ownsTarget(g)||this.tip===g},u.prototype.createTip=function(){ne.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=ne.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},u.prototype.pointerDown=function(g,M){this.state==="new"&&U.prototype.pointerDown.call(this,g,M),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(M)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):U.prototype.pointerDown.call(this,g,M)},u.prototype.pointerUp=function(g){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,U.prototype.pointerUp.call(this,g);else{var M=this.state==="creating";U.prototype.pointerUp.call(this,g),this.setTipPoints(M),this.positionTip()}},u.prototype.manipulate=function(g){if(this.tipMoving){var M=this.unrotatePoint(g);this.tipPosition={x:M.x-this.manipulationStartLeft,y:M.y-this.manipulationStartTop},this.positionTip()}else U.prototype.manipulate.call(this,g)},u.prototype.setBgColor=function(g){this.bgRectangle&&this.tip&&(ne.setAttributes(this.bgRectangle,[["fill",g]]),ne.setAttributes(this.tip,[["fill",g]])),this.bgColor=g,this.fillColorChanged(g)},u.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},u.prototype.setTipPoints=function(g){g===void 0&&(g=!1);var M=Math.min(this.height/2,15),J=this.height/5;g&&(this.tipPosition={x:M+J/2,y:this.height+20});var F=Math.atan(this.height/2/(this.width/2));this.tipPosition.x=this.width/2&&this.tipPosition.y=this.width/2&&this.tipPosition.y>=this.height/2?F.1)){var g=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),M=this.tip1.transform.baseVal.getItem(0);M.setRotate(g,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(M,0);var J=this.tip2.transform.baseVal.getItem(0);J.setRotate(g+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(J,0)}},Object.defineProperty(u.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),u.prototype.getState=function(){var g=U.prototype.getState.call(this);return g.typeName=u.typeName,g},u.prototype.restoreState=function(g){U.prototype.restoreState.call(this,g),this.createTips(),this.adjustVisual()},u.typeName="MeasurementMarker",u.title="Measurement marker",u.icon='',u}(dt),Ze=function(U){function u(g,M,J){var F=U.call(this,g,M,J)||this;return F.strokePanel.colors=J.defaultColorSet,F.fillColor="transparent",F}return _e(u,U),Object.defineProperty(u.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),u.prototype.getState=function(){var g=U.prototype.getState.call(this);return g.typeName=u.typeName,g},u.typeName="EllipseFrameMarker",u.title="Ellipse frame marker",u.icon='',u}(Se),qe=function(){function U(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(U.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),U.prototype.addUndoStep=function(u){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(u)||(this.undoStack.push(u),JSON.stringify(this.lastRedoStep)!==JSON.stringify(u)&&this.redoStack.splice(0,this.redoStack.length))},U.prototype.replaceLastUndoStep=function(u){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=u)},U.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},U.prototype.undo=function(){if(this.undoStack.length>1){var u=this.undoStack.pop();return u!==void 0&&this.redoStack.push(u),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},U.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},U}(),Et=function(U){function u(g,M,J){var F=U.call(this,g,M,J)||this;return F.strokeColor="transparent",F.strokeWidth=0,F.strokeDasharray="",F.curveX=0,F.curveY=0,F.manipulationStartCurveX=0,F.manipulationStartCurveY=0,F.setStrokeColor=F.setStrokeColor.bind(F),F.setStrokeWidth=F.setStrokeWidth.bind(F),F.setStrokeDasharray=F.setStrokeDasharray.bind(F),F.positionGrips=F.positionGrips.bind(F),F.addControlGrips=F.addControlGrips.bind(F),F.adjustVisual=F.adjustVisual.bind(F),F.setupControlBox=F.setupControlBox.bind(F),F.resize=F.resize.bind(F),F.strokeColor=J.defaultColor,F.strokeWidth=J.defaultStrokeWidth,F.strokeDasharray=J.defaultStrokeDasharray,F.strokePanel=new je("Line color",J.defaultColorSet,J.defaultColor),F.strokePanel.onColorChanged=F.setStrokeColor,F.strokeWidthPanel=new bt("Line width",J.defaultStrokeWidths,J.defaultStrokeWidth),F.strokeWidthPanel.onWidthChanged=F.setStrokeWidth,F.strokeStylePanel=new at("Line style",J.defaultStrokeDasharrays,J.defaultStrokeDasharray),F.strokeStylePanel.onStyleChanged=F.setStrokeDasharray,F}return _e(u,U),u.prototype.ownsTarget=function(g){return!(!U.prototype.ownsTarget.call(this,g)&&g!==this.visual&&g!==this.selectorCurve&&g!==this.visibleCurve&&!this.curveGrip.ownsTarget(g))},u.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},u.prototype.createVisual=function(){this.visual=ne.createGroup(),this.selectorCurve=ne.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=ne.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)},u.prototype.pointerDown=function(g,M){U.prototype.pointerDown.call(this,g,M),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=g.x,this.curveY=g.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(M)&&(this.activeGrip=this.curveGrip,this._state="resize")},u.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),ne.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),ne.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),ne.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},u.prototype.setupControlBox=function(){U.prototype.setupControlBox.call(this),this.curveControlLine1=ne.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=ne.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)},u.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,U.prototype.addControlGrips.call(this)},u.prototype.positionGrips=function(){U.prototype.positionGrips.call(this);var g=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-g/2,this.curveY-g/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()))},u.prototype.manipulate=function(g){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+g.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+g.y-this.manipulationStartY),U.prototype.manipulate.call(this,g)},u.prototype.resize=function(g){this.activeGrip===this.curveGrip&&(this.curveX=g.x,this.curveY=g.y),U.prototype.resize.call(this,g),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},u.prototype.setStrokeColor=function(g){this.strokeColor=g,this.adjustVisual(),this.colorChanged(g)},u.prototype.setStrokeWidth=function(g){this.strokeWidth=g,this.adjustVisual()},u.prototype.setStrokeDasharray=function(g){this.strokeDasharray=g,this.adjustVisual()},u.prototype.scale=function(g,M){this.curveX=this.curveX*g,this.curveY=this.curveY*M,U.prototype.scale.call(this,g,M)},Object.defineProperty(u.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),u.prototype.getState=function(){var g=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},U.prototype.getState.call(this));return g.typeName=u.typeName,g},u.prototype.restoreState=function(g){U.prototype.restoreState.call(this,g);var M=g;this.strokeColor=M.strokeColor,this.strokeWidth=M.strokeWidth,this.strokeDasharray=M.strokeDasharray,this.curveX=M.curveX,this.curveY=M.curveY,this.createVisual(),this.adjustVisual()},u.typeName="CurveMarker",u.title="Curve marker",u.icon='',u}(gt),Pt=function(){function U(u,g){g===void 0&&(g=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=u,this.cancelable=g}return Object.defineProperty(U.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),U.prototype.preventDefault=function(){this._defaultPrevented=!0},U}(),et=function(U){function u(g,M,J){var F=U.call(this,g,!1)||this;return F.dataUrl=M,F.state=J,F}return _e(u,U),u}(Pt),ct=function(U){function u(g,M,J){J===void 0&&(J=!1);var F=U.call(this,g,J)||this;return F.marker=M,F}return _e(u,U),u}(Pt),Ft=function(){function U(){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 U.prototype.addEventListener=function(u,g){this[u].push(g)},U.prototype.removeEventListener=function(u,g){var M=this[u].indexOf(g);M>-1&&this[u].splice(M,1)},U}(),Ct=function(){function U(u){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Ae,this._isOpen=!1,this.undoRedoManager=new qe,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 Ft,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=U.instanceCounter++,this.styles=new Xe(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=u,this.targetRoot=document.body,this.width=u.clientWidth,this.height=u.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(U.prototype,"ALL_MARKER_TYPES",{get:function(){return[ht,ge,pe,We,Ze,Se,ie,ue,Pe,ee,dt,Et]},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[ht,ge,pe,We,Se,ie,ue]},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"BASIC_MARKER_TYPES",{get:function(){return[ht,ge,pe,We,ie]},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(u){var g=this;this._availableMarkerTypes.splice(0),u.forEach(function(M){if(typeof M=="string"){var J=g.ALL_MARKER_TYPES.find(function(F){return F.typeName===M});J!==void 0&&g._availableMarkerTypes.push(J)}else g._availableMarkerTypes.push(M)})},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(u){this._zoomLevel=u,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(U.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),U.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),we.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},U.prototype.show=function(){var u=this;this.styles.styleSheetRoot===void 0&&Ye.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=Ye.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(g){return g(new Pt(u))})},U.prototype.render=function(){return Te(this,void 0,void 0,function(){var u;return Ce(this,function(g){switch(g.label){case 0:return this.setCurrentMarker(),(u=new tt).naturalSize=this.renderAtNaturalSize,u.imageType=this.renderImageType,u.imageQuality=this.renderImageQuality,u.markersOnly=this.renderMarkersOnly,u.width=this.renderWidth,u.height=this.renderHeight,[4,u.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return g.sent(),[4,u.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,g.sent()]}})})},U.prototype.close=function(u){var g=this;if(u===void 0&&(u=!1),this.isOpen){var M=!1;u||this.eventListeners.beforeclose.forEach(function(J){var F=new Pt(g,!0);J(F),F.defaultPrevented&&(M=!0)}),M||(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(J){return J(new Pt(g))}),this.detachEvents(),this._isOpen=!1)}},U.prototype.addMarkersToToolbar=function(){for(var u,g=[],M=0;Mthis.editorCanvas.clientHeight?this.editorCanvas.clientHeight*u:this.editorCanvas.clientWidth,M=g',u.title="Powered by marker.js",u.style.display="grid",u.style.alignItems="center",u.style.justifyItems="center",u.style.padding="3px",u.style.width="20px",u.style.height="20px",this.logoUI.appendChild(u),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},U.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")},U.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"},U.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},U.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 u=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=u+"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 Me(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-1&&this.markers.splice(this.markers.indexOf(u),1),u.dispose()},U.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())},U.prototype.toolbarButtonClicked=function(u,g){if(u==="marker"&&g!==void 0)this.createNewMarker(g);else if(u==="action")switch(g){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()}},U.prototype.deleteSelectedMarker=function(){var u=this;if(this._currentMarker!==void 0){var g=!1;if(this.eventListeners.markerbeforedelete.forEach(function(J){var F=new ct(u,u._currentMarker,!0);J(F),F.defaultPrevented&&(g=!0)}),!g){var M=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(J){return J(new ct(u,M))})}}},U.prototype.clear=function(){var u=this,g=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ce){var Ne=new ct(u,void 0,!0);ce(Ne),Ne.defaultPrevented&&(g=!0)}),!g)){this.setCurrentMarker();for(var M=function(ce){var Ne=J.markers[ce];J.setCurrentMarker(J.markers[ce]),J._currentMarker.dispose(),J.markerImage.removeChild(J._currentMarker.container),J.markers.splice(J.markers.indexOf(J._currentMarker),1),J.eventListeners.markerdelete.forEach(function(rt){return rt(new ct(u,Ne))})},J=this,F=this.markers.length-1;F>=0;F--)M(F);this.addUndoStep()}},Object.defineProperty(U.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),U.prototype.showNotesEditor=function(){var u;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=(u=this._currentMarker.notes)!==null&&u!==void 0?u:"",this.overlayContainer.appendChild(this.notesArea))},U.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)},U.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},U.prototype.addUndoStep=function(){var u=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var g=this.getState(),M=this.undoRedoManager.getLastUndoStep();if(!M||M.width===g.width&&M.height===g.height){var J=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(g),J1&&this.panTo({x:u.clientX,y:u.clientY}))},U.prototype.onPointerUp=function(u){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(u.clientX,u.clientY)),this.isDragging=!1,this.addUndoStep()},U.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},U.prototype.onKeyUp=function(u){this._currentMarker===void 0||this.notesArea!==void 0||u.key!=="Delete"&&u.key!=="Backspace"||this.deleteSelectedMarker()},U.prototype.clientToLocalCoordinates=function(u,g){var M=this.markerImage.getBoundingClientRect();return{x:(u-M.left)/this.zoomLevel,y:(g-M.top)/this.zoomLevel}},U.prototype.onWindowResize=function(){this.positionUI()},U.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var u=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=u+"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()},U.prototype.addLicenseKey=function(u){we.addKey(u)},U.prototype.addEventListener=function(u,g){this.eventListeners.addEventListener(u,g)},U.prototype.removeEventListener=function(u,g){this.eventListeners.removeEventListener(u,g)},U.prototype.renderState=function(u){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(u),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(U.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),U.prototype.focus=function(){var u=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(g){return g(new Pt(u))}))},U.prototype.blur=function(){var u=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(g){return g(new Pt(u))}))},U.instanceCounter=0,U}();/* ********************************** 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 jt=function(U,u){return(jt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,M){g.__proto__=M}||function(g,M){for(var J in M)Object.prototype.hasOwnProperty.call(M,J)&&(g[J]=M[J])})(U,u)};function $t(U,u){if(typeof u!="function"&&u!==null)throw new TypeError("Class extends value "+String(u)+" is not a constructor or null");function g(){this.constructor=U}jt(U,u),U.prototype=u===null?Object.create(u):(g.prototype=u.prototype,new g)}function Lt(U,u,g,M){return new(g||(g=Promise))(function(J,F){function ce(Tt){try{rt(M.next(Tt))}catch(Be){F(Be)}}function Ne(Tt){try{rt(M.throw(Tt))}catch(Be){F(Be)}}function rt(Tt){var Be;Tt.done?J(Tt.value):(Be=Tt.value,Be instanceof g?Be:new g(function(kt){kt(Be)})).then(ce,Ne)}rt((M=M.apply(U,u||[])).next())})}function Qt(U,u){var g,M,J,F,ce={label:0,sent:function(){if(1&J[0])throw J[1];return J[1]},trys:[],ops:[]};return F={next:Ne(0),throw:Ne(1),return:Ne(2)},typeof Symbol=="function"&&(F[Symbol.iterator]=function(){return this}),F;function Ne(rt){return function(Tt){return function(Be){if(g)throw new TypeError("Generator is already executing.");for(;ce;)try{if(g=1,M&&(J=2&Be[0]?M.return:Be[0]?M.throw||((J=M.return)&&J.call(M),0):M.next)&&!(J=J.call(M,Be[1])).done)return J;switch(M=0,J&&(Be=[2&Be[0],J.value]),Be[0]){case 0:case 1:J=Be;break;case 4:return ce.label++,{value:Be[1],done:!1};case 5:ce.label++,M=Be[1],Be=[0];continue;case 7:Be=ce.ops.pop(),ce.trys.pop();continue;default:if(!(J=ce.trys,(J=J.length>0&&J[J.length-1])||Be[0]!==6&&Be[0]!==2)){ce=0;continue}if(Be[0]===3&&(!J||Be[1]>J[0]&&Be[1]0&&g>0){var M=new nr(u,g),J=M.ratio>=1?20:M.getHorizontalLength(20),F=M.ratio<1?20:M.getVerticalLength(20),ce=document.createElementNS("http://www.w3.org/2000/svg","svg");ce.setAttribute("xmlns","http://www.w3.org/2000/svg"),ce.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ce);var Ne=pt.createDefs();ce.appendChild(Ne);var rt=pt.createElement("clipPath",[["id","text-bg-clip"]]);Ne.appendChild(rt);var Tt=pt.createPath(pt.getHollowRectanglePath((24-J)/2,(24-F)/2,J,F,(24-J)/2+2,(24-F)/2+2,J-4,F-4));ce.appendChild(Tt);var Be=pt.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Be.appendChild(pt.createTSpan(u+":"+g)),ce.appendChild(Be);var kt=Be.getBBox();pt.setAttributes(Be,[["x",((24-kt.width)/2).toString()],["y",((24-kt.height)/2-kt.y).toString()]]);var er=pt.createPath(pt.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(kt.width))/2,(24-Math.ceil(kt.height))/2,Math.ceil(kt.width),Math.ceil(kt.height)));return rt.appendChild(er),pt.setAttributes(Tt,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ce),ce.outerHTML}return''},U}(),qt=function(U){function u(g,M,J){var F=U.call(this,g,M)||this;return F.isDropdownOpen=!1,F.onClick=F.dropdownButtonClicked,F.dropdownButtons=J,F}return $t(u,U),u.prototype.setupDropdown=function(){var g=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(M){M.className=g.className,M.colorsClassName=g.colorsClassName,g.dropdownBlock.appendChild(M.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},u.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},u.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},u.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},u.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},u.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},u}(it),Wt=function(){function U(u,g){this.GRIP_SIZE=10,this.color=u,this.fillColor=g,this.visual=pt.createGroup(),this.visual.appendChild(pt.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(pt.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return U.prototype.ownsTarget=function(u){return u===this.visual||u===this.visual.childNodes[0]||u===this.visual.childNodes[1]},U.prototype.setCenter=function(u,g){this.visual.childNodes.forEach(function(M){return pt.setAttributes(M,[["cx",u.toString()],["cy",g.toString()]])})},U}(),Tr=function(){function U(u,g,M,J){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=u,this.canvasHeight=g,this.margin=M,this.container=J,this.attachEvents=this.attachEvents.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.resize=this.resize.bind(this),this.adjustCropRect=this.adjustCropRect.bind(this),this.scaleCanvas=this.scaleCanvas.bind(this),this.getRescaledRect=this.getRescaledRect.bind(this)}return Object.defineProperty(U.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(u){this._aspectRatio=u,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(u){this._isGridVisible=u,this.gridContainer&&pt.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(u){this._zoomFactor=u,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),U.prototype.open=function(){var u=this;this.cropShadeElement=pt.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=pt.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var g=0;gthis.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-g.height/2),pt.setAttributes(this.cropRectElement,[["x",g.x.toString()],["y",g.y.toString()],["width",g.width.toString()],["height",g.height.toString()]]);var M=g.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(F,ce){var Ne=g.y+M*(ce+1);pt.setAttributes(F,[["x1",""+g.x],["y1",""+Ne],["x2",""+(g.x+g.width)],["y2",""+Ne]])});var J=g.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(F,ce){var Ne=g.x+J*(ce+1);pt.setAttributes(F,[["x1",""+Ne],["y1",""+g.y],["x2",""+Ne],["y2",""+(g.y+g.height)]])}),pt.setAttributes(this.cropShadeElement,[["d",pt.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,g.x,g.y,g.width,g.height)]]),this.topLeftGrip.setCenter(g.x,g.y),this.topRightGrip.setCenter(g.x+g.width,g.y),this.bottomLeftGrip.setCenter(g.x,g.y+g.height),this.bottomRightGrip.setCenter(g.x+g.width,g.y+g.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},U.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)},U.prototype.clientToLocalCoordinates=function(u,g){var M=this.container.getBoundingClientRect();return{x:u-M.left+this.margin,y:g-M.top+this.margin}},U.prototype.onPointerDown=function(u){this.container.setPointerCapture(u.pointerId),this.previousPoint=this.clientToLocalCoordinates(u.clientX,u.clientY),this.cropRectElement===u.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(u.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(u.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(u.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(u.target)&&(this.activeGrip=this.bottomRightGrip)},U.prototype.onPointerMove=function(u){if(this.isMoving)this.move(this.clientToLocalCoordinates(u.clientX,u.clientY));else if(this.activeGrip){var g=this.clientToLocalCoordinates(u.clientX,u.clientY);this.resize(g)}u.preventDefault()},U.prototype.onPointerUp=function(u){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(u.pointerId)},U.prototype.move=function(u){var g=u.x-this.previousPoint.x,M=u.y-this.previousPoint.y;this.zoomFactor!==1&&(g=-g/this.zoomFactor,M=-M/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+g),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+M),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=u},U.prototype.resize=function(u){var g=Object.assign({},this.cropRect),M=u.x-this.previousPoint.x,J=u.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:g.x+Mthis.canvasWidth*this.zoomFactor&&(M=this.canvasWidth*this.zoomFactor-g.width),g.width+=M}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(g.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(M),g.height=this.aspectRatio.getVerticalLength(g.width)):(g.y+=J,g.height=this.cropRect.y+this.cropRect.height-g.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?g.height=this.aspectRatio.getVerticalLength(g.width):g.height+=J}g.width<10&&(g.x=this.cropRect.x,g.width=10),g.height<10&&(g.y=this.cropRect.y,g.height=10),this.previousPoint=u,g.x>=this.margin&&g.y>=this.margin&&g.x-this.margin+g.width<=this.canvasWidth&&g.y-this.margin+g.height<=this.canvasHeight&&(this.cropRect=g,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},U.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var u=this.cropRect.x+this.cropRect.width/2,g=this.cropRect.y+this.cropRect.height/2,M=this.aspectRatio.getHorizontalLength(this.cropRect.height),J=this.aspectRatio.getVerticalLength(this.cropRect.width);M/this.canvasWidththis.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=u-this.cropRect.width/2,this.cropRect.y=g-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)}},U.prototype.getRescaledRect=function(u,g,M,J,F,ce){var Ne=M/u,rt=J/g;return{x:(F.x-ce)*Ne+ce,y:(F.y-ce)*rt+ce,width:F.width*Ne,height:F.height*rt}},U.prototype.scaleCanvas=function(u,g){var M=this.getRescaledRect(this.canvasWidth,this.canvasHeight,u,g,this.cropRect,this.margin);this.canvasWidth=u,this.canvasHeight=g,this.onCropChange&&this.onCropChange(M),this.setCropRectangle(M)},U}(),ir=function(){function U(u){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=u,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(U.prototype,"angle",{get:function(){return this._angle},set:function(u){this._angle=u,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),U.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},U.prototype.onPointerDown=function(u){this.controlContainer.setPointerCapture(u.pointerId),this.isDragging=!0,this.previousPoint={x:u.clientX,y:u.clientY}},U.prototype.onPointerMove=function(u){this.isDragging&&(this.onAngleChange&&this.onAngleChange((u.clientX-this.previousPoint.x)/5),this.previousPoint.x=u.clientX)},U.prototype.onPointerUp=function(u){this.isDragging&&this.onAngleChange&&this.onAngleChange((u.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(u.pointerId)},U.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var u=this.angleLabelText.getBBox();pt.setAttributes(this.angleLabelElement,[["x",((this.width-u.width)/2).toString()],["y",(this.height/2).toString()]])}},U.prototype.positionScaleShape=function(){if(this.scaleShape){var u=this.scaleShape.transform.baseVal.getItem(0);u.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(u,0)}},U.prototype.getVisual=function(){var u=document.createElementNS("http://www.w3.org/2000/svg","svg");u.setAttribute("xmlns","http://www.w3.org/2000/svg"),u.setAttribute("width",this.width+"px"),u.setAttribute("height",this.height+"px"),u.setAttribute("viewBox","0 0 "+this.width+" "+this.height),u.style.flexShrink="0",document.body.appendChild(u);for(var g="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,M=1;M<=this.width/5+10;M++){var J=M%5==0?this.height/3:this.height/6;g+="h4v"+-J+"h1v"+J}g+="v1H0Z",this.scaleShape=pt.createPath(g);var F=pt.createTransform();this.scaleShape.transform.baseVal.appendItem(F),u.appendChild(this.scaleShape),this.angleLabelElement=pt.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=pt.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ce=pt.createTSpan("");return ce.innerHTML="°",this.angleLabelElement.appendChild(ce),u.appendChild(this.angleLabelElement),document.body.removeChild(u),u},U}(),Rt=function(){function U(){this.naturalSize=!1,this.imageType="image/png"}return U.prototype.rasterize=function(u,g,M,J,F,ce,Ne){var rt=this;return new Promise(function(Tt){var Be=document.createElement("canvas");Be.width=u.width.baseVal.value-2*J,Be.height=u.height.baseVal.value-2*J;var kt=1,er=1;rt.naturalSize===!0?(kt=g.naturalWidth/(u.width.baseVal.value-2*J)/ce,er=g.naturalHeight/(u.height.baseVal.value-2*J)/Ne,Be.width=g.naturalWidth/ce,Be.height=g.naturalHeight/Ne):rt.width!==void 0&&rt.height!==void 0&&(kt=rt.width/M.width,er=rt.height/M.height,Be.width*=kt,Be.height*=er);var fr=Be.getContext("2d");fr.translate(Be.width/2,Be.height/2),fr.rotate(F*Math.PI/180),fr.scale(ce,Ne),fr.translate(-Be.width/2,-Be.height/2),fr.drawImage(g,0,0,Be.width,Be.height);var Gr=document.createElement("canvas");Gr.width=M.width*kt,Gr.height=M.height*er,Gr.getContext("2d").putImageData(fr.getImageData((M.x-J)*kt,(M.y-J)*er,M.width*kt,M.height*er),0,0),Tt(Gr.toDataURL(rt.imageType,rt.imageQuality))})},U}(),Ie=function(){function U(u){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=U.instanceCounter++,this.styles=new Xt(this.instanceNo),this.target=u,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(U.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(u){this._zoomToCropEnabled=u,u?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(u){this._isGridVisible=u,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"gridLines",{get:function(){return this._gridLines},set:function(u){this._gridLines=u,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(u){this._rotationAngle=u,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(U.prototype,"aspectRatio",{get:function(){var u;return(u=this._aspectRatio)!==null&&u!==void 0?u:this.aspectRatios[0]},set:function(u){this._aspectRatio=u},enumerable:!1,configurable:!0}),U.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},U.prototype.show=function(){this.showUI(),this.open()},U.prototype.close=function(u){u===void 0&&(u=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),u||this.closeEventListeners.forEach(function(g){return g()}),this._isOpen=!1)},U.prototype.addRenderEventListener=function(u){this.renderEventListeners.push(u)},U.prototype.removeRenderEventListener=function(u){this.renderEventListeners.indexOf(u)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(u),1)},U.prototype.addCloseEventListener=function(u){this.closeEventListeners.push(u)},U.prototype.removeCloseEventListener=function(u){this.closeEventListeners.indexOf(u)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(u),1)},U.prototype.setupResizeObserver=function(){var u=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){u.resize(u.target.clientWidth,u.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))},U.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var u=1*this.target.clientWidth/this.target.clientHeight,g=this.contentDiv.clientWidth/u>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*u:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,M=g+2*this.CANVAS_MARGINu+this.CANVAS_MARGIN?this.target.offsetTop-(u+this.CANVAS_MARGIN):0;this.coverDiv.style.top=g+"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},U.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},U.prototype.addTopToolbar=function(){var u=this;this.topToolbar=new Ut,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 g=new St;g.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(g);var M=[];this.aspectRatios.forEach(function(er){var fr=new it(Vt.getIcon(er.horizontal,er.vertical),er.horizontal===0&&er.vertical===0?"FREE":er.horizontal+":"+er.vertical);fr.onClick=function(){return u.ratioButtonClicked(er)},M.push(fr)}),this.aspectRatioButton=new qt(Vt.getIcon(0,0),"Aspect ratio",M),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,g.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var J=new it('',"Toggle grid");J.isActive=this.isGridVisible,J.onClick=function(){u.isGridVisible=!u.isGridVisible,J.isActive=u.isGridVisible},g.addButton(J);var F=new it('',"Zoom to selection");if(F.isActive=this.zoomToCropEnabled,F.onClick=function(){u.zoomToCropEnabled=!u.zoomToCropEnabled,F.isActive=u.zoomToCropEnabled},g.addButton(F),!Zt.isLicensed){var ce=new Fe;this.topToolbar.addElementBlock(ce);var Ne=document.createElement("div");Ne.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var rt=document.createElement("a");rt.style.color="currentColor",rt.href="https://markerjs.com/products/cropro",rt.target="_blank",rt.innerHTML='',Ne.appendChild(rt),ce.addElement(Ne)}var Tt=new St;Tt.minWidth=3*this.toolbarHeight+"px",Tt.contentAlign="end",this.topToolbar.addButtonBlock(Tt);var Be=new it('',"OK");Be.onClick=this.startRenderAndClose,Tt.addButton(Be),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Be.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var kt=new it('',"Close");kt.onClick=this.close,Tt.addButton(kt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(kt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},U.prototype.addBottomToolbar=function(){var u=this;this.bottomToolbar=new Ut,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 g=new St;g.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(g);var M=new it('',"Rotate left");M.onClick=this.rotateLeftButtonClicked,g.addButton(M);var J=new it('',"Rotate right");J.onClick=this.rotateRightButtonClicked,g.addButton(J);var F=new Fe;F.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(F),this.straightener=new ir("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(Tt){u.rotateBy(Tt),u.straightener.angle=u.rotationAngle},F.addElement(this.straightener.getUI());var ce=new St;ce.minWidth=2*this.toolbarHeight+"px",ce.contentAlign="end",this.bottomToolbar.addButtonBlock(ce);var Ne=new it('',"Flip horizontal");Ne.onClick=this.flipHorizontallyButtonClicked,ce.addButton(Ne);var rt=new it('',"Flip vertical");rt.onClick=this.flipVerticallyButtonClicked,ce.addButton(rt)},U.prototype.ratioButtonClicked=function(u){this.aspectRatio=u,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},U.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=Vt.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},U.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new nr(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},U.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},U.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},U.prototype.restoreState=function(u){if(u){var g=this.cropLayer.getRescaledRect(u.width,u.height,this.imageWidth,this.imageHeight,u.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(g),this.cropRectChanged(g),this.flippedHorizontally=u.flippedHorizontally,this.flippedVertically=u.flippedVertically,this.applyFlip(),this.rotationAngle=u.rotationAngle,this.applyRotation()}},U.prototype.clientToLocalCoordinates=function(u,g){var M=this.cropImage.getBoundingClientRect();return{x:u-M.left,y:g-M.top}},U.prototype.onWindowResize=function(){this.positionUI()},U.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var u=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=u+"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()},U.prototype.rotateLeftButtonClicked=function(){var u=this.rotationAngle-90;this.rotationAngle%90!=0&&(u+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(u)},U.prototype.rotateRightButtonClicked=function(){var u=this.rotationAngle+90;this.rotationAngle%90!=0&&(u-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(u)},U.prototype.rotateTo=function(u){u=(u=u>180?u-360:u)<=-180?u+360:u,this.rotationAngle=u,this.applyRotation()},U.prototype.rotateBy=function(u){this.rotateTo((this.rotationAngle+u)%360)},U.prototype.applyRotation=function(){var u=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var g=this.editingTargetRotationContainer.transform.baseVal.getItem(0);g.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(g,0);var M=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/M.width,this.imageHeight/M.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=u},U.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},U.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},U.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},U.prototype.startRenderAndClose=function(){return Lt(this,void 0,void 0,function(){var u,g;return Qt(this,function(M){switch(M.label){case 0:return[4,this.render()];case 1:return u=M.sent(),g=this.getState(),this.renderEventListeners.forEach(function(J){return J(u,g)}),this.close(!0),[2]}})})},U.prototype.render=function(){return Lt(this,void 0,void 0,function(){var u;return Qt(this,function(g){switch(g.label){case 0:return(u=new Rt).naturalSize=this.renderAtNaturalSize,u.imageType=this.renderImageType,u.imageQuality=this.renderImageQuality,u.width=this.renderWidth,u.height=this.renderHeight,this.unzoomFromCrop(),pt.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,u.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 g.sent(),[4,u.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,g.sent()]}})})},U.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Gt("toolbar",` width: `+(this.displayMode==="inline"?"100%":"calc(100vw - "+2*this.popupMargin+"px)")+`; flex-shrink: 0; display: flex; flex-direction: row; justify-content: space-between; height: `+this.toolbarHeight+`px; box-sizing: content-box; overflow: hidden; line-height: 0px; `)),this.toolbarStyleColorsClass=this.styles.addClass(new Gt("toolbar_colors",` background-color: `+this.styles.settings.toolbarBackgroundColor+`; `)),this.toolbarBlockStyleClass=this.styles.addClass(new Gt("toolbar-block",` display: flex; align-items: center; box-sizing: content-box; `));var u=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Gt("toolbar_button",` display: inline-block; width: `+(this.toolbarHeight-2*u)+`px; height: `+(this.toolbarHeight-2*u)+`px; padding: `+u+`px; cursor: default; user-select: none; box-sizing: content-box; `)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Gt("toolbar_button_colors",` color: `+this.styles.settings.toolbarColor+`; fill: currentColor; `)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Gt("toolbar_active_button",` color: `+this.styles.settings.toolbarColor+`; fill: currentColor; background-color: `+this.styles.settings.toolbarBackgroundActiveColor+` `)),this.styles.addRule(new zt("."+this.toolbarButtonStyleClass.name+" svg",` height: `+this.toolbarHeight/2+`px; `)),this.styles.addRule(new zt("."+this.toolbarButtonStyleColorsClass.name+":hover",` background-color: `+this.styles.settings.toolbarBackgroundHoverColor+` `)),this.toolbarDropdownStyleClass=this.styles.addClass(new Gt("toolbar_dropdown",` position: absolute; max-width: `+4*this.toolbarHeight+`px; z-index: 20; white-space: normal; box-sizing: content-box; box-shadow: 3px 3px rgba(33, 33, 33, 0.1); margin: `+(this.displayMode==="inline"?"0":this.popupMargin)+`px; line-height: 0px; `)),this.toolbarDropdownStyleColorsClass=this.styles.addClass(new Gt("toolbar_dropdown_colors",` background-color: `+this.styles.settings.toolbarBackgroundColor+`; `)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Gt("toolbar_straightener_block",` display: flex; overflow: hidden; justify-content: center; -webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 30%, rgba(0,0,0,1) 70%, rgba(0,0,0,0) 100%); `)),this.toolbarStraightenerStyleClass=this.styles.addClass(new Gt("toolbar_straightener",` display: flex; overflow: hidden; justify-content: center; height: `+(this.toolbarHeight-2*u)+`px; padding: `+u+`px; cursor: default; user-select: none; box-sizing: content-box; `)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new Gt("toolbar_straightener_colors",` color: `+this.styles.settings.toolbarColor+`; fill: currentColor; `))},U.instanceCounter=0,U}(),xt=re("8hTe"),Pr=re.n(xt),un=/]*>/g;function dn(U){var u=document.createElement("div");return u.innerHTML=U,u.childNodes.length===0?"":u.childNodes[0].nodeValue}var xr=ft.a=function(U){var u=U.value,g=u===void 0?"":u,M=U.edit,J=M===void 0?!1:M,F=U.className,ce=U.showTextOnly,Ne=U.showLines,rt=U.replaces,Tt=U.zoomImg,Be=U.hasMask,kt=U.style,er=kt===void 0?{}:kt,fr=U.stylesPrev,Gr=fr===void 0?{}:fr,Mr=String(g),Ir=Object(P.useRef)(),cn=Object(P.useRef)(),Sn=Object(P.useState)(""),wr=Object(z.a)(Sn,2),ot=wr[0],be=wr[1],Ke=Object(P.useState)("office"),wt=Object(z.a)(Ke,2),mt=wt[0],vt=wt[1],It=function(){var tr=new Ie(cn.current);tr.displayMode="popup",tr.addRenderEventListener(function(){var pr=Object(I.a)(O.a.mark(function Ht(br){var lr;return O.a.wrap(function(Nr){for(;;)switch(Nr.prev=Nr.next){case 0:return Ir.current.style.display="none",Nr.next=3,Object(ke.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:br}});case 3:lr=Nr.sent,lr!=null&&lr.id&&rt(cn.current.getAttribute("src").replace(oe.a.API_SERVER,""),"/api/attachments/".concat(lr==null?void 0:lr.id,"?type=").concat(lr.content_type));case 5:case"end":return Nr.stop()}},Ht)}));return function(Ht){return pr.apply(this,arguments)}}()),tr.show()},gr=function(){var tr=new Ct(cn.current);tr.settings.displayMode="popup",tr.addEventListener("render",function(){var pr=Object(I.a)(O.a.mark(function Ht(br){var lr;return O.a.wrap(function(Nr){for(;;)switch(Nr.prev=Nr.next){case 0:if(Ir.current.style.display="none",!cn.current){Nr.next=6;break}return Nr.next=4,Object(ke.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:br.dataUrl}});case 4:lr=Nr.sent,lr!=null&&lr.id&&rt(cn.current.getAttribute("src").replace(oe.a.API_SERVER,""),"/api/attachments/".concat(lr==null?void 0:lr.id,"?type=").concat(lr.content_type));case 6:case"end":return Nr.stop()}},Ht)}));return function(Ht){return pr.apply(this,arguments)}}()),tr.show(),window.markerArea=tr},cr=Object(P.useMemo)(function(){Ir.current&&(Ir.current.style.zIndex=-1);try{var or=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,tr=/\"\/api\/attachments\/|\"\/attachments\/download\//g,pr=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Mr=Mr.replace(or,"("+oe.a.API_SERVER+"/api/attachments/").replace(tr,'"'+oe.a.API_SERVER+"/api/attachments/").replace(pr,'"'+oe.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(vn){}var Ht=Q(Mr),br=b();if(Mr.match(/\[TOC\]/)&&(Ht=Ht.replace("

    [TOC]

    ",l()),C()),Ht=Ht.replace(/(__special_katext_id_\d+__)/g,function(vn,Nr){var Yr=br[Nr],Yn=Yr.type,An=Yr.expression;return Object(fe.renderToString)(dn(An)||"",{displayMode:Yn==="block",throwOnError:!1,output:"html"})}),Ht=Ht.replace(/▁/g,"\u2581\u2581\u2581"),v(),ce){var lr=document.createElement("div");return lr.innerHTML=Ht,lr.innerText}return setTimeout(function(){return Sr()},500),Ht},[Mr]),hr=Object(P.useRef)();y.WebkitLineClamp=Ne,Ne&&(er=Object(N.a)(Object(N.a)({},er),y));function Lr(or){var tr=or.target;if(tr.tagName.toUpperCase()==="IMG"){if(Tt){var pr=tr.getAttribute("src");be(pr),vt("image")}}else if(tr.tagName.toUpperCase()==="A"){var Ht=tr.getAttribute("href");if(Ht.indexOf("office")>-1)or.preventDefault(),be(Ht),vt("office");else if(Ht.indexOf("application/pdf")>-1)or.preventDefault(),be(Ht),vt("pdf");else if(Ht.indexOf("text/html")>-1)or.preventDefault(),be(Ht),vt("html");else if(Ht.startsWith("#")){or.preventDefault();var br=document.getElementById(Ht.replace("#",""));br&&br.scrollIntoView(!0)}}}var Sr=function(){var tr,pr=(tr=hr.current)===null||tr===void 0?void 0:tr.querySelectorAll("video");pr==null||pr.forEach(function(Ht){if(Ht.oncontextmenu=function(){return!1},Ht.src.indexOf(".m3u8")>-1&&!Ht.canPlayType("application/vnd.apple.mpegurl")){if(q.a.isSupported()){var br=new q.a;br.loadSource(Ht.src),br.attachMedia(Ht)}}})};Object(P.useEffect)(function(){if(hr.current&&cr&&(cr.match(un)&&window.PR.prettyPrint()),hr.current)return hr.current.addEventListener("click",Lr),function(){hr.current.removeEventListener("click",Lr),v(),C()}},[cr,hr.current,Lr]);var Wr=function(tr){if(!J)return;tr.target.nodeName==="IMG"?(Ir.current.style.zIndex=1,Ir.current.style.display="flex",Ir.current.style.width=tr.target.clientWidth+"px",Ir.current.style.height=tr.target.clientHeight+"px",Ir.current.style.top=tr.target.offsetTop+"px",Ir.current.style.left=tr.target.offsetLeft+"px",cn.current.src=tr.target.getAttribute("src")):Ir.current.style.display="none"};return E.a.createElement("div",{style:{position:"relative"}},E.a.createElement("div",{ref:hr,style:Object(N.a)({},er),className:"".concat(F||""," markdown-body ").concat(Pr.a.mdBody),onMouseOver:Wr,dangerouslySetInnerHTML:{__html:cr}}),E.a.createElement("div",{ref:Ir,className:Pr.a.button},E.a.createElement($.a,null,E.a.createElement(X.a,{onClick:function(){return It()}},"\u88C1\u526A"),E.a.createElement(X.a,{onClick:function(){return gr()}},"\u7F16\u8F91"))),E.a.createElement("img",{ref:cn,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),E.a.createElement(ve.a,{close:!0,data:ot,type:ot!=null&&ot.length?mt:"",style:Object(N.a)({},Gr),onClose:function(){return be("")}}))}},"9VGf":function(At,ft,re){"use strict";re.d(ft,"a",function(){return R});var ae=re("q1tI"),$=re.n(ae);function R(X,N){var I=Object(ae.useRef)();Object(ae.useEffect)(function(){I.current=X}),Object(ae.useEffect)(function(){function z(){I.current()}if(N!==null){var j=setInterval(z,N);return function(){return clearInterval(j)}}},[N])}},Bd2K:function(At,ft,re){(function(ae){ae(re("VrN/"),re("osHv"))})(function(ae){ae.defineOption("autoCloseTags",!1,function(O,P,E){if(E!=ae.Init&&E&&O.removeKeyMap("autoCloseTags"),!P)return;var L={name:"autoCloseTags"};(typeof P!="object"||P.whenClosing!==!1)&&(L["'/'"]=function(D){return I(D)}),(typeof P!="object"||P.whenOpening!==!1)&&(L["'>'"]=function(D){return X(D)}),O.addKeyMap(L)});var $=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],R=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function X(O){if(O.getOption("disableInput"))return ae.Pass;for(var P=O.listSelections(),E=[],L=O.getOption("autoCloseTags"),D=0;DT.ch&&(d=d.slice(0,d.length-A.end+T.ch));var m=d.toLowerCase();if(!d||A.type=="string"&&(A.end!=T.ch||!/[\"\']/.test(A.string.charAt(A.string.length-1))||A.string.length==1)||A.type=="tag"&&o.close||A.string.indexOf("/")==T.ch-A.start-1||C&&z(C,m)>-1||j(O,w.mode.xmlCurrentContext&&w.mode.xmlCurrentContext(h)||[],d,T,!0))return ae.Pass;var l=typeof L=="object"&&L.emptyTags;if(l&&z(l,d)>-1){E[D]={text:"/>",newPos:ae.Pos(T.line,T.ch+2)};continue}var S=y&&z(y,m)>-1;E[D]={indent:S,text:">"+(S?` `:"")+"",newPos:S?ae.Pos(T.line+1,0):ae.Pos(T.line,T.ch+1)}}for(var f=typeof L=="object"&&L.dontIndentOnAutoClose,D=P.length-1;D>=0;D--){var p=E[D];O.replaceRange(p.text,P[D].head,P[D].anchor,"+insert");var s=O.listSelections().slice(0);s[D]={head:p.newPos,anchor:p.newPos},O.setSelections(s),!f&&p.indent&&(O.indentLine(p.newPos.line,null,!0),O.indentLine(p.newPos.line+1,null,!0))}}function N(O,P){for(var E=O.listSelections(),L=[],D=P?"/":""&&(C+=">"),L[w]=C}if(O.replaceSelections(L),E=O.listSelections(),!A)for(var w=0;w=0&&P[h]==E;h--)++w;L=A.to;for(var h=1;h0){for(var P=0;P1&&arguments[1]!==void 0?arguments[1]:"",P=[],E=0;Ege.length)&&(de=ge.length);for(var pe=0,ee=new Array(de);pe=ge.length?{done:!0}:{done:!1,value:ge[ee++]}}}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 pe=ge[Symbol.iterator](),pe.next.bind(pe)}function I(ge,de){return de={exports:{}},ge(de,de.exports),de.exports}var z=I(function(ge){function de(){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 pe(ee){ge.exports.defaults=ee}ge.exports={defaults:de(),getDefaults:de,changeDefaults:pe}}),j=z.defaults,O=z.getDefaults,P=z.changeDefaults,E=/[&<>"']/,L=/[&<>"']/g,D=/[<>"']|&(?!#?\w+;)/,T=/[<>"']|&(?!#?\w+;)/g,A={"&":"&","<":"<",">":">",'"':""","'":"'"},w=function(de){return A[de]};function h(ge,de){if(de){if(E.test(ge))return ge.replace(L,w)}else if(D.test(ge))return ge.replace(T,w);return ge}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function d(ge){return ge.replace(o,function(de,pe){return pe=pe.toLowerCase(),pe==="colon"?":":pe.charAt(0)==="#"?pe.charAt(1)==="x"?String.fromCharCode(parseInt(pe.substring(2),16)):String.fromCharCode(+pe.substring(1)):""})}var c=/(^|[^\[])\^/g;function C(ge,de){ge=ge.source||ge,de=de||"";var pe={replace:function(te,ie){return ie=ie.source||ie,ie=ie.replace(c,"$1"),ge=ge.replace(te,ie),pe},getRegex:function(){return new RegExp(ge,de)}};return pe}var y=/[^\w:]/g,m=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function l(ge,de,pe){if(ge){var ee;try{ee=decodeURIComponent(d(pe)).replace(y,"").toLowerCase()}catch(te){return null}if(ee.indexOf("javascript:")===0||ee.indexOf("vbscript:")===0||ee.indexOf("data:")===0)return null}de&&!m.test(pe)&&(pe=a(de,pe));try{pe=encodeURI(pe).replace(/%25/g,"%")}catch(te){return null}return pe}var S={},f=/^[^:]+:\/*[^/]*$/,p=/^([^:]+:)[\s\S]*$/,s=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(ge,de){S[" "+ge]||(f.test(ge)?S[" "+ge]=ge+"/":S[" "+ge]=k(ge,"/",!0)),ge=S[" "+ge];var pe=ge.indexOf(":")===-1;return de.substring(0,2)==="//"?pe?de:ge.replace(p,"$1")+de:de.charAt(0)==="/"?pe?de:ge.replace(s,"$1")+de:ge+de}var b={exec:function(){}};function v(ge){for(var de=1,pe,ee;de=0&&ue[Pe]==="\\";)Se=!Se;return Se?"|":" |"}),ee=pe.split(/ \|/),te=0;if(ee.length>de)ee.splice(de);else for(;ee.length=ee.length?te.slice(ee.length):te}).join(` `)}var Ee=function(){function ge(pe){this.options=pe||G}var de=ge.prototype;return de.space=function(ee){var te=this.rules.block.newline.exec(ee);if(te)return te[0].length>1?{type:"space",raw:te[0]}:{raw:` `}},de.code=function(ee,te){var ie=this.rules.block.code.exec(ee);if(ie){var se=te[te.length-1];if(se&&se.type==="paragraph")return{raw:ie[0],text:ie[0].trimRight()};var ue=ie[0].replace(/^ {4}/gm,"");return{type:"code",raw:ie[0],codeBlockStyle:"indented",text:this.options.pedantic?ue:W(ue,` `)}}},de.fences=function(ee){var te=this.rules.block.fences.exec(ee);if(te){var ie=te[0],se=ke(ie,te[3]||"");return{type:"code",raw:ie,lang:te[2]?te[2].trim():te[2],text:se}}},de.heading=function(ee){var te=this.rules.block.heading.exec(ee);if(te)return{type:"heading",raw:te[0],depth:te[1].length,text:te[2]}},de.nptable=function(ee){var te=this.rules.block.nptable.exec(ee);if(te){var ie={type:"table",header:q(te[1].replace(/^ *| *\| *$/g,"")),align:te[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:te[3]?te[3].replace(/\n$/,"").split(` `):[],raw:te[0]};if(ie.header.length===ie.align.length){var se=ie.align.length,ue;for(ue=0;ue ?/gm,"");return{type:"blockquote",raw:te[0],text:ie}}},de.list=function(ee){var te=this.rules.block.list.exec(ee);if(te){for(var ie=te[0],se=te[2],ue=se.length>1,Se=se[se.length-1]===")",Pe={type:"list",raw:ie,ordered:ue,start:ue?+se.slice(0,-1):"",loose:!1,items:[]},Ze=te[0].match(this.rules.block.item),qe=!1,Et,Pt,et,ct,Ft,Ct,jt,$t=Ze.length,Lt=0;Lt<$t;Lt++)Et=Ze[Lt],ie=Et,Pt=Et.length,Et=Et.replace(/^ *([*+-]|\d+[.)]) */,""),~Et.indexOf(` `)&&(Pt-=Et.length,Et=this.options.pedantic?Et.replace(/^ {1,4}/gm,""):Et.replace(new RegExp("^ {1,"+Pt+"}","gm"),"")),Lt!==$t-1&&(et=this.rules.block.bullet.exec(Ze[Lt+1])[0],(ue?et.length===1||!Se&&et[et.length-1]===")":et.length>1||this.options.smartLists&&et!==se)&&(ct=Ze.slice(Lt+1).join(` `),Pe.raw=Pe.raw.substring(0,Pe.raw.length-ct.length),Lt=$t-1)),Ft=qe||/\n\n(?!\s*$)/.test(Et),Lt!==$t-1&&(qe=Et.charAt(Et.length-1)===` `,Ft||(Ft=qe)),Ft&&(Pe.loose=!0),Ct=/^\[[ xX]\] /.test(Et),jt=void 0,Ct&&(jt=Et[1]!==" ",Et=Et.replace(/^\[[ xX]\] +/,"")),Pe.items.push({type:"list_item",raw:ie,task:Ct,checked:jt,loose:Ft,text:Et});return Pe}},de.html=function(ee){var te=this.rules.block.html.exec(ee);if(te)return{type:this.options.sanitize?"paragraph":"html",raw:te[0],pre:!this.options.sanitizer&&(te[1]==="pre"||te[1]==="script"||te[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(te[0]):oe(te[0]):te[0]}},de.def=function(ee){var te=this.rules.block.def.exec(ee);if(te){te[3]&&(te[3]=te[3].substring(1,te[3].length-1));var ie=te[1].toLowerCase().replace(/\s+/g," ");return{tag:ie,raw:te[0],href:te[2],title:te[3]}}},de.table=function(ee){var te=this.rules.block.table.exec(ee);if(te){var ie={type:"table",header:q(te[1].replace(/^ *| *\| *$/g,"")),align:te[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:te[3]?te[3].replace(/\n$/,"").split(` `):[]};if(ie.header.length===ie.align.length){ie.raw=te[0];var se=ie.align.length,ue;for(ue=0;ue/i.test(se[0])&&(te=!1),!ie&&/^<(pre|code|kbd|script)(\s|>)/i.test(se[0])?ie=!0:ie&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(se[0])&&(ie=!1),{type:this.options.sanitize?"text":"html",raw:se[0],inLink:te,inRawBlock:ie,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(se[0]):oe(se[0]):se[0]}},de.link=function(ee){var te=this.rules.inline.link.exec(ee);if(te){var ie=fe(te[2],"()");if(ie>-1){var se=te[0].indexOf("!")===0?5:4,ue=se+te[1].length+ie;te[2]=te[2].substring(0,ie),te[0]=te[0].substring(0,ue).trim(),te[3]=""}var Se=te[2],Pe="";if(this.options.pedantic){var Ze=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Se);Ze?(Se=Ze[1],Pe=Ze[3]):Pe=""}else Pe=te[3]?te[3].slice(1,-1):"";Se=Se.trim().replace(/^<([\s\S]*)>$/,"$1");var qe=ve(te,{href:Se&&Se.replace(this.rules.inline._escapes,"$1"),title:Pe&&Pe.replace(this.rules.inline._escapes,"$1")},te[0]);return qe}},de.reflink=function(ee,te){var ie;if((ie=this.rules.inline.reflink.exec(ee))||(ie=this.rules.inline.nolink.exec(ee))){var se=(ie[2]||ie[1]).replace(/\s+/g," ");if(se=te[se.toLowerCase()],!se||!se.href){var ue=ie[0].charAt(0);return{type:"text",raw:ue,text:ue}}var Se=ve(ie,se,ie[0]);return Se}},de.strong=function(ee,te,ie){ie===void 0&&(ie="");var se=this.rules.inline.strong.start.exec(ee);if(se&&(!se[1]||se[1]&&(ie===""||this.rules.inline.punctuation.exec(ie)))){te=te.slice(-1*ee.length);var ue=se[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ue.lastIndex=0;for(var Se;(se=ue.exec(te))!=null;)if(Se=this.rules.inline.strong.middle.exec(te.slice(0,se.index+3)),Se)return{type:"strong",raw:ee.slice(0,Se[0].length),text:ee.slice(2,Se[0].length-2)}}},de.em=function(ee,te,ie){ie===void 0&&(ie="");var se=this.rules.inline.em.start.exec(ee);if(se&&(!se[1]||se[1]&&(ie===""||this.rules.inline.punctuation.exec(ie)))){te=te.slice(-1*ee.length);var ue=se[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ue.lastIndex=0;for(var Se;(se=ue.exec(te))!=null;)if(Se=this.rules.inline.em.middle.exec(te.slice(0,se.index+2)),Se)return{type:"em",raw:ee.slice(0,Se[0].length),text:ee.slice(1,Se[0].length-1)}}},de.codespan=function(ee){var te=this.rules.inline.code.exec(ee);if(te){var ie=te[2].replace(/\n/g," "),se=/[^ ]/.test(ie),ue=ie.startsWith(" ")&&ie.endsWith(" ");return se&&ue&&(ie=ie.substring(1,ie.length-1)),ie=oe(ie,!0),{type:"codespan",raw:te[0],text:ie}}},de.br=function(ee){var te=this.rules.inline.br.exec(ee);if(te)return{type:"br",raw:te[0]}},de.del=function(ee){var te=this.rules.inline.del.exec(ee);if(te)return{type:"del",raw:te[0],text:te[1]}},de.autolink=function(ee,te){var ie=this.rules.inline.autolink.exec(ee);if(ie){var se,ue;return ie[2]==="@"?(se=oe(this.options.mangle?te(ie[1]):ie[1]),ue="mailto:"+se):(se=oe(ie[1]),ue=se),{type:"link",raw:ie[0],text:se,href:ue,tokens:[{type:"text",raw:se,text:se}]}}},de.url=function(ee,te){var ie;if(ie=this.rules.inline.url.exec(ee)){var se,ue;if(ie[2]==="@")se=oe(this.options.mangle?te(ie[0]):ie[0]),ue="mailto:"+se;else{var Se;do Se=ie[0],ie[0]=this.rules.inline._backpedal.exec(ie[0])[0];while(Se!==ie[0]);se=oe(ie[0]),ie[1]==="www."?ue="http://"+se:ue=se}return{type:"link",raw:ie[0],text:se,href:ue,tokens:[{type:"text",raw:se,text:se}]}}},de.inlineText=function(ee,te,ie){var se=this.rules.inline.text.exec(ee);if(se){var ue;return te?ue=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(se[0]):oe(se[0]):se[0]:ue=oe(this.options.smartypants?ie(se[0]):se[0]),{type:"text",raw:se[0],text:ue}}},ge}(),_e=Q.noopTest,Te=Q.edit,Ce=Q.merge,me={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]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|\\n*|\\n*|)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:_e,table:_e,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};me._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,me._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,me.def=Te(me.def).replace("label",me._label).replace("title",me._title).getRegex(),me.bullet=/(?:[*+-]|\d{1,9}[.)])/,me.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,me.item=Te(me.item,"gm").replace(/bull/g,me.bullet).getRegex(),me.list=Te(me.list).replace(/bull/g,me.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+me.def.source+")").getRegex(),me._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",me._comment=//,me.html=Te(me.html,"i").replace("comment",me._comment).replace("tag",me._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),me.paragraph=Te(me._paragraph).replace("hr",me.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",")|<(?:script|pre|style|!--)").replace("tag",me._tag).getRegex(),me.blockquote=Te(me.blockquote).replace("paragraph",me.paragraph).getRegex(),me.normal=Ce({},me),me.gfm=Ce({},me.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*|$)"}),me.gfm.nptable=Te(me.gfm.nptable).replace("hr",me.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",")|<(?:script|pre|style|!--)").replace("tag",me._tag).getRegex(),me.gfm.table=Te(me.gfm.table).replace("hr",me.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",")|<(?:script|pre|style|!--)").replace("tag",me._tag).getRegex(),me.pedantic=Ce({},me.normal,{html:Te(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",me._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:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:_e,paragraph:Te(me.normal._paragraph).replace("hr",me.hr).replace("heading",` *#{1,6} *[^ ]`).replace("lheading",me.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var ne={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:_e,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\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:_e,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~",ne.punctuation=Te(ne.punctuation).replace(/punctuation/g,ne._punctuation).getRegex(),ne._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",ne._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",ne.em.start=Te(ne.em.start).replace(/punctuation/g,ne._punctuation).getRegex(),ne.em.middle=Te(ne.em.middle).replace(/punctuation/g,ne._punctuation).replace(/overlapSkip/g,ne._overlapSkip).getRegex(),ne.em.endAst=Te(ne.em.endAst,"g").replace(/punctuation/g,ne._punctuation).getRegex(),ne.em.endUnd=Te(ne.em.endUnd,"g").replace(/punctuation/g,ne._punctuation).getRegex(),ne.strong.start=Te(ne.strong.start).replace(/punctuation/g,ne._punctuation).getRegex(),ne.strong.middle=Te(ne.strong.middle).replace(/punctuation/g,ne._punctuation).replace(/blockSkip/g,ne._blockSkip).getRegex(),ne.strong.endAst=Te(ne.strong.endAst,"g").replace(/punctuation/g,ne._punctuation).getRegex(),ne.strong.endUnd=Te(ne.strong.endUnd,"g").replace(/punctuation/g,ne._punctuation).getRegex(),ne.blockSkip=Te(ne._blockSkip,"g").getRegex(),ne.overlapSkip=Te(ne._overlapSkip,"g").getRegex(),ne._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,ne._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,ne._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])?)+(?![-_])/,ne.autolink=Te(ne.autolink).replace("scheme",ne._scheme).replace("email",ne._email).getRegex(),ne._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,ne.tag=Te(ne.tag).replace("comment",me._comment).replace("attribute",ne._attribute).getRegex(),ne._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ne._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,ne._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,ne.link=Te(ne.link).replace("label",ne._label).replace("href",ne._href).replace("title",ne._title).getRegex(),ne.reflink=Te(ne.reflink).replace("label",ne._label).getRegex(),ne.reflinkSearch=Te(ne.reflinkSearch,"g").replace("reflink",ne.reflink).replace("nolink",ne.nolink).getRegex(),ne.normal=Ce({},ne),ne.pedantic=Ce({},ne.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:Te(/^!?\[(label)\]\((.*?)\)/).replace("label",ne._label).getRegex(),reflink:Te(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ne._label).getRegex()}),ne.gfm=Ce({},ne.normal,{escape:Te(ne.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]*?(?:(?=[\\.5&&(ee="x"+ee.toString(16)),de+="&#"+ee+";";return de}var Me=function(){function ge(pe){this.tokens=[],this.tokens.links=Object.create(null),this.options=pe||tt,this.options.tokenizer=this.options.tokenizer||new Ee,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var ee={block:Ye.normal,inline:Xe.normal};this.options.pedantic?(ee.block=Ye.pedantic,ee.inline=Xe.pedantic):this.options.gfm&&(ee.block=Ye.gfm,this.options.breaks?ee.inline=Xe.breaks:ee.inline=Xe.gfm),this.tokenizer.rules=ee}ge.lex=function(ee,te){var ie=new ge(te);return ie.lex(ee)};var de=ge.prototype;return de.lex=function(ee){return ee=ee.replace(/\r\n|\r/g,` `).replace(/\t/g," "),this.blockTokens(ee,this.tokens,!0),this.inline(this.tokens),this.tokens},de.blockTokens=function(ee,te,ie){te===void 0&&(te=[]),ie===void 0&&(ie=!0),ee=ee.replace(/^ +$/gm,"");for(var se,ue,Se,Pe;ee;){if(se=this.tokenizer.space(ee)){ee=ee.substring(se.raw.length),se.type&&te.push(se);continue}if(se=this.tokenizer.code(ee,te)){ee=ee.substring(se.raw.length),se.type?te.push(se):(Pe=te[te.length-1],Pe.raw+=` `+se.raw,Pe.text+=` `+se.text);continue}if(se=this.tokenizer.fences(ee)){ee=ee.substring(se.raw.length),te.push(se);continue}if(se=this.tokenizer.heading(ee)){ee=ee.substring(se.raw.length),te.push(se);continue}if(se=this.tokenizer.nptable(ee)){ee=ee.substring(se.raw.length),te.push(se);continue}if(se=this.tokenizer.hr(ee)){ee=ee.substring(se.raw.length),te.push(se);continue}if(se=this.tokenizer.blockquote(ee)){ee=ee.substring(se.raw.length),se.tokens=this.blockTokens(se.text,[],ie),te.push(se);continue}if(se=this.tokenizer.list(ee)){for(ee=ee.substring(se.raw.length),Se=se.items.length,ue=0;ue0)for(;(Ze=this.tokenizer.rules.inline.reflinkSearch.exec(Pe))!=null;)qe.includes(Ze[0].slice(Ze[0].lastIndexOf("[")+1,-1))&&(Pe=Pe.slice(0,Ze.index)+"["+"a".repeat(Ze[0].length-2)+"]"+Pe.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Ze=this.tokenizer.rules.inline.blockSkip.exec(Pe))!=null;)Pe=Pe.slice(0,Ze.index)+"["+"a".repeat(Ze[0].length-2)+"]"+Pe.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;ee;){if(Se=this.tokenizer.escape(ee)){ee=ee.substring(Se.raw.length),te.push(Se);continue}if(Se=this.tokenizer.tag(ee,ie,se)){ee=ee.substring(Se.raw.length),ie=Se.inLink,se=Se.inRawBlock,te.push(Se);continue}if(Se=this.tokenizer.link(ee)){ee=ee.substring(Se.raw.length),Se.type==="link"&&(Se.tokens=this.inlineTokens(Se.text,[],!0,se)),te.push(Se);continue}if(Se=this.tokenizer.reflink(ee,this.tokens.links)){ee=ee.substring(Se.raw.length),Se.type==="link"&&(Se.tokens=this.inlineTokens(Se.text,[],!0,se)),te.push(Se);continue}if(Se=this.tokenizer.strong(ee,Pe,ue)){ee=ee.substring(Se.raw.length),Se.tokens=this.inlineTokens(Se.text,[],ie,se),te.push(Se);continue}if(Se=this.tokenizer.em(ee,Pe,ue)){ee=ee.substring(Se.raw.length),Se.tokens=this.inlineTokens(Se.text,[],ie,se),te.push(Se);continue}if(Se=this.tokenizer.codespan(ee)){ee=ee.substring(Se.raw.length),te.push(Se);continue}if(Se=this.tokenizer.br(ee)){ee=ee.substring(Se.raw.length),te.push(Se);continue}if(Se=this.tokenizer.del(ee)){ee=ee.substring(Se.raw.length),Se.tokens=this.inlineTokens(Se.text,[],ie,se),te.push(Se);continue}if(Se=this.tokenizer.autolink(ee,Le)){ee=ee.substring(Se.raw.length),te.push(Se);continue}if(!ie&&(Se=this.tokenizer.url(ee,Le))){ee=ee.substring(Se.raw.length),te.push(Se);continue}if(Se=this.tokenizer.inlineText(ee,se,Ve)){ee=ee.substring(Se.raw.length),ue=Se.raw.slice(-1),te.push(Se);continue}if(ee){var Et="Infinite loop on byte: "+ee.charCodeAt(0);if(this.options.silent){console.error(Et);break}else throw new Error(Et)}}return te},$(ge,null,[{key:"rules",get:function(){return{block:Ye,inline:Xe}}}]),ge}(),He=z.defaults,Ge=Q.cleanUrl,je=Q.escape,Ue=function(){function ge(pe){this.options=pe||He}var de=ge.prototype;return de.code=function(ee,te,ie){var se=(te||"").match(/\S*/)[0];if(this.options.highlight){var ue=this.options.highlight(ee,se);ue!=null&&ue!==ee&&(ie=!0,ee=ue)}return se?'
    '+(ie?ee:je(ee,!0))+`
    `:"
    "+(ie?ee:je(ee,!0))+`
    `},de.blockquote=function(ee){return`
    `+ee+`
    `},de.html=function(ee){return ee},de.heading=function(ee,te,ie,se){return this.options.headerIds?"'+ee+" `:""+ee+" `},de.hr=function(){return this.options.xhtml?`
    `:`
    `},de.list=function(ee,te,ie){var se=te?"ol":"ul",ue=te&&ie!==1?' start="'+ie+'"':"";return"<"+se+ue+`> `+ee+" `},de.listitem=function(ee){return"
  • "+ee+`
  • `},de.checkbox=function(ee){return" "},de.paragraph=function(ee){return"

    "+ee+`

    `},de.table=function(ee,te){return te&&(te=""+te+""),` `+ee+` `+te+`
    `},de.tablerow=function(ee){return` `+ee+` `},de.tablecell=function(ee,te){var ie=te.header?"th":"td",se=te.align?"<"+ie+' align="'+te.align+'">':"<"+ie+">";return se+ee+" `},de.strong=function(ee){return""+ee+""},de.em=function(ee){return""+ee+""},de.codespan=function(ee){return""+ee+""},de.br=function(){return this.options.xhtml?"
    ":"
    "},de.del=function(ee){return""+ee+""},de.link=function(ee,te,ie){if(ee=Ge(this.options.sanitize,this.options.baseUrl,ee),ee===null)return ie;var se='",se},de.image=function(ee,te,ie){if(ee=Ge(this.options.sanitize,this.options.baseUrl,ee),ee===null)return ie;var se=''+ie+'":">",se},de.text=function(ee){return ee},ge}(),Re=function(){function ge(){}var de=ge.prototype;return de.strong=function(ee){return ee},de.em=function(ee){return ee},de.codespan=function(ee){return ee},de.del=function(ee){return ee},de.html=function(ee){return ee},de.text=function(ee){return ee},de.link=function(ee,te,ie){return""+ie},de.image=function(ee,te,ie){return""+ie},de.br=function(){return""},ge}(),st=function(){function ge(){this.seen={}}var de=ge.prototype;return de.slug=function(ee){var te=ee.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(te)){var ie=te;do this.seen[ie]++,te=ie+"-"+this.seen[ie];while(this.seen.hasOwnProperty(te))}return this.seen[te]=0,te},ge}(),Je=z.defaults,Qe=Q.unescape,nt=function(){function ge(pe){this.options=pe||Je,this.options.renderer=this.options.renderer||new Ue,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Re,this.slugger=new st}ge.parse=function(ee,te){var ie=new ge(te);return ie.parse(ee)};var de=ge.prototype;return de.parse=function(ee,te){te===void 0&&(te=!0);var ie="",se,ue,Se,Pe,Ze,qe,Et,Pt,et,ct,Ft,Ct,jt,$t,Lt,Qt,Zt,pt,Xt=ee.length;for(se=0;se0&&Lt.tokens[0].type==="text"?(Lt.tokens[0].text=pt+" "+Lt.tokens[0].text,Lt.tokens[0].tokens&&Lt.tokens[0].tokens.length>0&&Lt.tokens[0].tokens[0].type==="text"&&(Lt.tokens[0].tokens[0].text=pt+" "+Lt.tokens[0].tokens[0].text)):Lt.tokens.unshift({type:"text",text:pt}):$t+=pt),$t+=this.parse(Lt.tokens,jt),et+=this.renderer.listitem($t,Zt,Qt);ie+=this.renderer.list(et,Ft,Ct);continue}case"html":{ie+=this.renderer.html(ct.text);continue}case"paragraph":{ie+=this.renderer.paragraph(this.parseInline(ct.tokens));continue}case"text":{for(et=ct.tokens?this.parseInline(ct.tokens):ct.text;se+1An error occurred:

    "+ht(Se.message+"",!0)+"
    ";throw Se}}De.options=De.setOptions=function(ge){return bt(De.defaults,ge),gt(De.defaults),De},De.getDefaults=Ae,De.defaults=dt,De.use=function(ge){var de=bt({},ge);if(ge.renderer&&function(){var ee=De.defaults.renderer||new Ue,te=function(ue){var Se=ee[ue];ee[ue]=function(){for(var Pe=arguments.length,Ze=new Array(Pe),qe=0;qe`,triples:"",explode:"[]{}"},R=ae.Pos;ae.defineOption("autoCloseBrackets",!1,function(A,w,h){h&&h!=ae.Init&&(A.removeKeyMap(N),A.state.closeBrackets=null),w&&(I(X(w,"pairs")),A.state.closeBrackets=w,A.addKeyMap(N))});function X(A,w){return w=="pairs"&&typeof A=="string"?A:typeof A=="object"&&A[w]!=null?A[w]:$[w]}var N={Backspace:O,Enter:P};function I(A){for(var w=0;w=0;d--){var C=o[d].head;A.replaceRange("",R(C.line,C.ch-1),R(C.line,C.ch+1),"+delete")}}function P(A){var w=j(A),h=w&&X(w,"explode");if(!h||A.getOption("disableInput"))return ae.Pass;for(var o=A.listSelections(),d=0;d0;return{anchor:new R(A.anchor.line,A.anchor.ch+(w?-1:1)),head:new R(A.head.line,A.head.ch+(w?1:-1))}}function L(A,w){var h=j(A);if(!h||A.getOption("disableInput"))return ae.Pass;var o=X(h,"pairs"),d=o.indexOf(w);if(d==-1)return ae.Pass;for(var c=X(h,"closeBefore"),C=X(h,"triples"),y=o.charAt(d+1)==w,m=A.listSelections(),l=d%2==0,S,f=0;f=0&&A.getRange(s,R(s.line,s.ch+3))==w+w+w?a="skipThree":a="skip";else if(y&&s.ch>1&&C.indexOf(w)>=0&&A.getRange(R(s.line,s.ch-2),s)==w+w){if(s.ch>2&&/\bstring/.test(A.getTokenTypeAt(R(s.line,s.ch-2))))return ae.Pass;a="addFour"}else if(y){var v=s.ch==0?" ":A.getRange(R(s.line,s.ch-1),s);if(!ae.isWordChar(b)&&v!=w&&!ae.isWordChar(v))a="both";else return ae.Pass}else if(l&&(b.length===0||/\s/.test(b)||c.indexOf(b)>-1))a="both";else return ae.Pass;if(!S)S=a;else if(S!=a)return ae.Pass}var x=d%2?o.charAt(d-1):w,k=d%2?w:o.charAt(d+1);A.operation(function(){if(S=="skip")A.execCommand("goCharRight");else if(S=="skipThree")for(var H=0;H<3;H++)A.execCommand("goCharRight");else if(S=="surround"){for(var V=A.getSelections(),H=0;H1&&arguments[1]!==void 0?arguments[1]:1,pe=Re.length,ee=0;ee1&&arguments[1]!==void 0?arguments[1]:!1;return Object(l.a)(W).map(function(oe,fe){if(!N.isValidElement(oe)||!oe.type)return null;var ve=oe.type.isSelectOptGroup,ke=oe.key,Ee=oe.props,_e=Ee.children,Te=Object(z.a)(Ee,["children"]);return q||!ve?S(oe):Object(m.a)(Object(m.a)({key:"__RC_SELECT_GRP__".concat(ke===null?fe:ke,"__"),label:ke},Te),{},{options:f(_e)})}).filter(function(oe){return oe})}var p=re("2Qr1"),s=re("qNPg"),a=re("U8pU"),b=re("Kwbf"),v=re("WKfj");function x(W){var q=W.mode,oe=W.options,fe=W.children,ve=W.backfill,ke=W.allowClear,Ee=W.placeholder,_e=W.getInputElement,Te=W.showSearch,Ce=W.onSearch,me=W.defaultOpen,ne=W.autoFocus,we=W.labelInValue,tt=W.value,Ye=W.inputValue,Xe=W.optionLabelProp,Ve=q==="multiple"||q==="tags",Le=Te!==void 0?Te:Ve||q==="combobox",Me=oe||f(fe);if(Object(b.a)(q!=="tags"||Me.every(function(Ue){return!Ue.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),q==="tags"||q==="combobox"){var He=Me.some(function(Ue){return Ue.options?Ue.options.some(function(Re){return typeof("value"in Re?Re.value:Re.key)=="number"}):typeof("value"in Ue?Ue.value:Ue.key)=="number"});Object(b.a)(!He,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(b.a)(q!=="combobox"||!Xe,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(b.a)(q==="combobox"||!ve,"`backfill` only works with `combobox` mode."),Object(b.a)(q==="combobox"||!_e,"`getInputElement` only work with `combobox` mode."),Object(b.b)(q!=="combobox"||!_e||!ke||!Ee,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Ce&&!Le&&q!=="combobox"&&q!=="tags"&&Object(b.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(b.b)(!me||ne,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),tt!=null){var Ge=Object(v.d)(tt);Object(b.a)(!we||Ge.every(function(Ue){return Object(a.a)(Ue)==="object"&&("key"in Ue||"value"in Ue)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(b.a)(!Ve||Array.isArray(tt),"`value` should be array when `mode` is `multiple` or `tags`")}if(fe){var je=null;Object(l.a)(fe).some(function(Ue){if(!N.isValidElement(Ue)||!Ue.type)return!1;var Re=Ue.type;if(Re.isSelectOption)return!1;if(Re.isSelectOptGroup){var st=Object(l.a)(Ue.props.children).every(function(Je){return!N.isValidElement(Je)||!Ue.type||Je.type.isSelectOption?!0:(je=Je.type,!1)});return!st}return je=Re,!0}),je&&Object(b.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(je.displayName||je.name||je,"`.")),Object(b.a)(Ye===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var k=x,H=Object(s.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:f,flattenOptions:p.d,getLabeledValue:p.e,filterOptions:p.b,isValueDisabled:p.g,findValueOption:p.c,warningProps:k,fillOptionsWithMissingValue:p.a}),V=function(W){Object(R.a)(oe,W);var q=Object(X.a)(oe);function oe(){var fe;return Object(ae.a)(this,oe),fe=q.apply(this,arguments),fe.selectRef=N.createRef(),fe.focus=function(){fe.selectRef.current.focus()},fe.blur=function(){fe.selectRef.current.blur()},fe}return Object($.a)(oe,[{key:"render",value:function(){return N.createElement(H,Object.assign({ref:this.selectRef},this.props))}}]),oe}(N.Component);V.Option=c,V.OptGroup=y;var Q=V,G=ft.c=Q},M8RZ:function(At,ft,re){"use strict";re.d(ft,"a",function(){return O});var ae=re("fWQN"),$=re("mtLc"),R=re("yKVA"),X=re("879j"),N=re("q1tI"),I=re.n(N),z=re("i8i4"),j=re.n(z),O=function(P){Object(R.a)(L,P);var E=Object(X.a)(L);function L(D){var T;Object(ae.a)(this,L),T=E.call(this,D);var A=window.document;return T.node=A.createElement("div"),A.body.appendChild(T.node),T}return Object($.a)(L,[{key:"render",value:function(){var T=this.props.children;return Object(z.createPortal)(T,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),L}(I.a.Component)},O2Wb:function(At,ft,re){At.exports={flex:"flex___2gmSR",flex1:"flex1___3Tu1g",color666:"color666___2uyGL",error:"error___yJ86W",deleteIcon:"deleteIcon___1D2tg",addIcon:"addIcon___2VIYB"}},OLES:function(At,ft,re){"use strict";var ae=re("U8pU"),$=re("VTBJ"),R=re("Ff2n"),X=re("q1tI"),N=re("uciX"),I=re("7ixt"),z=function(D){var T=D.overlay,A=D.prefixCls,w=D.id,h=D.overlayInnerStyle;return X.createElement("div",{className:"".concat(A,"-inner"),id:w,role:"tooltip",style:h},typeof T=="function"?T():T)},j=z,O=function(D,T){var A=D.overlayClassName,w=D.trigger,h=w===void 0?["hover"]:w,o=D.mouseEnterDelay,d=o===void 0?0:o,c=D.mouseLeaveDelay,C=c===void 0?.1:c,y=D.overlayStyle,m=D.prefixCls,l=m===void 0?"rc-tooltip":m,S=D.children,f=D.onVisibleChange,p=D.afterVisibleChange,s=D.transitionName,a=D.animation,b=D.placement,v=b===void 0?"right":b,x=D.align,k=x===void 0?{}:x,H=D.destroyTooltipOnHide,V=H===void 0?!1:H,Q=D.defaultVisible,G=D.getTooltipContainer,W=D.overlayInnerStyle,q=Object(R.a)(D,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),oe=Object(X.useRef)(null);Object(X.useImperativeHandle)(T,function(){return oe.current});var fe=Object($.a)({},q);"visible"in D&&(fe.popupVisible=D.visible);var ve=function(){var Ce=D.arrowContent,me=Ce===void 0?null:Ce,ne=D.overlay,we=D.id;return[X.createElement("div",{className:"".concat(l,"-arrow"),key:"arrow"},me),X.createElement(j,{key:"content",prefixCls:l,id:we,overlay:ne,overlayInnerStyle:W})]},ke=!1,Ee=!1;if(typeof V=="boolean")ke=V;else if(V&&Object(ae.a)(V)==="object"){var _e=V.keepParent;ke=_e===!0,Ee=_e===!1}return X.createElement(N.a,Object.assign({popupClassName:A,prefixCls:l,popup:ve,action:h,builtinPlacements:I.a,popupPlacement:v,ref:oe,popupAlign:k,getPopupContainer:G,onPopupVisibleChange:f,afterPopupVisibleChange:p,popupTransitionName:s,popupAnimation:a,defaultPopupVisible:Q,destroyPopupOnHide:ke,autoDestroy:Ee,mouseLeaveDelay:C,popupStyle:y,mouseEnterDelay:d},fe),S)},P=Object(X.forwardRef)(O),E=ft.a=P},Ot1p:function(At,ft,re){"use strict";var ae=re("2qtc"),$=re("kLXV"),R=re("rAM+"),X=re("miYZ"),N=re("tsqr"),I=re("9og8"),z=re("tJVT"),j=re("jrin"),O=re("WmNS"),P=re.n(O),E=re("q1tI"),L=re.n(E),D=re("VrN/"),T=re.n(D),A=re("bdgK"),w=re("p77/"),h=re("Bd2K"),o=re("ELLl"),d=re("19Vz"),c=re("lZu9"),C=re("+NIl"),y=re("kSUc"),m=re("9Bee"),l=function(ue){var Se=ue.value,Pe=Se===void 0?"":Se,Ze=ue.className,qe=ue.showTextOnly,Et=ue.showLines,Pt=ue.style,et=Pt===void 0?{}:Pt,ct=Object(E.useMemo)(function(){return""},[Pe]);return L.a.createElement(L.a.Fragment,null,L.a.createElement("div",{dangerouslySetInnerHTML:{__html:ct}}))},S=re("0Owb"),f=re("dejd"),p=re("C+DQ"),s=re("1vsH"),a=re("m3rI"),b=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function v(ue){var Se=ue.onActionCallback,Pe=ue.title,Ze=ue.icon,qe=ue.actionName,Et=ue.className,Pt=Et===void 0?"":Et,et=ue.children;function ct(){Se(qe)}return L.a.createElement("a",{title:Pe,className:Pt,onClick:ct},L.a.createElement("i",{className:"md-iconfont ".concat(Ze)}),et)}var x=function(ue){var Se=ue.watch,Pe=ue.showNullButton,Ze=ue.onActionCallback,qe=ue.fullScreen,Et=ue.insertTemp,Pt=ue.hidetoolBar,et=ue.uuid,ct=ue.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(s.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(s.F)("_educoder_session"),"&key=").concat(et,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var Ft=[].concat(b,[{title:"".concat(Se?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Se?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return L.a.createElement("ul",{className:"markdown-toolbar-container"},!Pt&&Ft.map(function(Ct,jt){return L.a.createElement("li",{key:jt},Ct.actionName?L.a.createElement(v,Object(S.a)({},Ct,{onActionCallback:Ze})):L.a.createElement("span",{className:"v-line"}))}),Pe?L.a.createElement("li",null,L.a.createElement(v,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Ze},L.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,Et&&L.a.createElement("li",null,L.a.createElement(v,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(Et),onActionCallback:Ze},L.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),L.a.createElement("li",{className:"btn-full-screen"},L.a.createElement(v,{icon:"".concat(qe?"icon-shrink":"icon-enlarge"),title:qe?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Ze})))},k=re("M8RZ"),H=re("+L6B"),V=re("2/Rp"),Q=re("y8nQ"),G=re("Vl3Y"),W=re("5NDa"),q=re("5rEg"),oe={labelCol:{span:4},wrapperCol:{span:20}},fe=function(ue){var Se=ue.callback,Pe=ue.onCancel;function Ze(qe){Se(qe)}return L.a.createElement(G.a,Object(S.a)({},oe,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Ze}),L.a.createElement(G.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},L.a.createElement(q.a,null)),L.a.createElement(G.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},L.a.createElement(q.a,null)),L.a.createElement("div",{className:"flex-container flex-end"},L.a.createElement(V.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),L.a.createElement(V.a,{type:"ghost",onClick:Pe},"\u53D6\u6D88")))},ve=re("7ahc"),ke=re("HmJG"),Ee=re("BjJ7"),_e=G.a.useForm,Te={width:280,marginRight:10},Ce={labelCol:{span:5},wrapperCol:{span:19}},me=function(ue){var Se=ue.callback,Pe=ue.onCancel,Ze=_e(),qe=Object(z.a)(Ze,1),Et=qe[0];function Pt(Ft){Se(Ft)}function et(Ft,Ct){if(Ft.status===-1){N.b.error(Ft.message);return}Et.setFieldsValue({src:"/api/attachments/".concat(Ft.id),type:Ct.type})}function ct(Ft){var Ct=Ft.target.files[0];we(Ct,et)}return L.a.createElement(G.a,Object(S.a)({form:Et},Ce,{className:"upload-image-panel",onFinish:Pt}),L.a.createElement(G.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},L.a.createElement("div",{className:"flex-container"},L.a.createElement(G.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},L.a.createElement(q.a,{style:Te})),L.a.createElement(ne,{onFileChange:ct}))),L.a.createElement(G.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},L.a.createElement(q.a,{style:{width:264}})),L.a.createElement(G.a.Item,{style:{textAlign:"right"}},L.a.createElement(V.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),L.a.createElement(V.a,{type:"ghost",onClick:Pe},"\u53D6\u6D88")))};function ne(ue){var Se=ue.onFileChange;return L.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",L.a.createElement("input",{type:"file",onChange:Se}))}function we(ue,Se){if(!ue)throw new String("\u6CA1\u6709\u6587\u4EF6");var Pe=new FormData;Pe.append("editormd-image-file",ue),Pe.append("file_param_name","editormd-image-file"),Pe.append("byxhr","true");var Ze=new window.XMLHttpRequest;Ze.withCredentials=!0,Ze.addEventListener("load",function(qe){Se(JSON.parse(qe.target.responseText),ue)},!1),Ze.addEventListener("error",function(qe){console.error(qe)},!1),Ze.open("POST","".concat(Ee.a,"/api/attachments.json")),Ze.send(Pe)}var tt=re("giR+"),Ye=re("fyUT"),Xe=re("7Kak"),Ve=re("9yH6"),Le=Ve.a.Group,Me={margin:"0 8px"},He=function(ue){var Se=ue.callback,Pe=ue.onCancel;function Ze(qe){Se(qe)}return L.a.createElement(G.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Ze},L.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},L.a.createElement("span",{style:Me},"\u5355\u5143\u683C\u6570\uFF1A"),L.a.createElement("span",{style:Me},"\u884C\u6570"),L.a.createElement(G.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},L.a.createElement(Ye.a,null)),L.a.createElement("span",{style:Me},"\u5217\u6570"),L.a.createElement(G.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},L.a.createElement(Ye.a,null))),L.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},L.a.createElement("span",{style:Me},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),L.a.createElement(G.a.Item,{name:"align"},L.a.createElement(Le,null,L.a.createElement(Ve.a,{value:"default"},L.a.createElement("i",{className:"fa fa-align-justify"})),L.a.createElement(Ve.a,{value:"left"},L.a.createElement("i",{className:"fa fa-align-left"})),L.a.createElement(Ve.a,{value:"center"},L.a.createElement("i",{className:"fa fa-align-center"})),L.a.createElement(Ve.a,{value:"right"},L.a.createElement("i",{className:"fa fa-align-right"}))))),L.a.createElement("div",{className:"flex-container flex-end"},L.a.createElement(V.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),L.a.createElement(V.a,{type:"ghost",onClick:Pe},"\u53D6\u6D88")))},Ge=re("ErOA"),je=re("7Cbv"),Ue="link",Re="upload-image",st="code-block",Je="add-table",Qe="------------",nt={default:Qe,left:":".concat(Qe),center:":".concat(Qe,":"),right:"".concat(Qe,":")},bt=re("9VGf"),at,ht;function Ae(){}var gt=0,dt=1e4,De="\u2581",We=` **\u6A21\u677F\u6807\u9898** \u6A21\u677F\u6B63\u6587\u5185\u5BB9\uFF0C\u53EF\u8F93\u5165\u6587\u672C\u5185\u5BB9\u548C\u7C98\u8D34\u56FE\u7247\u7B49\u64CD\u4F5C`;function ge(ue){return/^\d+$/.test(ue)?"".concat(ue,"px"):ue}var de=navigator.platform.toUpperCase().indexOf("MAC")>=0,pe=de?"Cmd":"Ctrl",ee=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"],te=(at={},Object(j.a)(at,pe+"-B","bold"),Object(j.a)(at,pe+"-I","italic"),at),ie=(ht={},Object(j.a)(ht,Ue,"\u6DFB\u52A0\u94FE\u63A5"),Object(j.a)(ht,st,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(j.a)(ht,Re,"\u6DFB\u52A0\u6587\u4EF6"),Object(j.a)(ht,Je,"\u6DFB\u52A0\u8868\u683C"),ht),se=ft.a=function(ue){var Se=ue.defaultValue,Pe=Se===void 0?"":Se,Ze=ue.onChange,qe=ue.width,Et=qe===void 0?"100%":qe,Pt=ue.height,et=Pt===void 0?400:Pt,ct=ue.miniToolbar,Ft=ct===void 0?!1:ct,Ct=ue.isFocus,jt=Ct===void 0?!1:Ct,$t=ue.watch,Lt=ue.insertTemp,Qt=ue.mode,Zt=Qt===void 0?"markdown":Qt,pt=ue.id,Xt=pt===void 0?"markdown-editor-id":pt,zt=ue.showResizeBar,Gt=zt===void 0?!1:zt,Ut=ue.noStorage,Mt=Ut===void 0?!1:Ut,St=ue.showNullButton,it=St===void 0?!1:St,Fe=ue.hidetoolBar,nr=Fe===void 0?!1:Fe,Vt=ue.fullScreen,qt=Vt===void 0?!1:Vt,Wt=ue.onBlur,Tr=ue.onCMBeforeChange,ir=ue.onFullScreen,Rt=ue.className,Ie=Rt===void 0?"":Rt,xt=ue.disablePaste,Pr=xt===void 0?!1:xt,un=ue.placeholder,dn=un===void 0?"":un,xr=ue.values,U=xr===void 0?"":xr,u=Object(E.useState)(null),g=Object(z.a)(u,2),M=g[0],J=g[1],F=Object(E.useState)(Pe),ce=Object(z.a)(F,2),Ne=ce[0],rt=ce[1],Tt=Object(E.useState)($t),Be=Object(z.a)(Tt,2),kt=Be[0],er=Be[1],fr=Object(E.useState)(qt),Gr=Object(z.a)(fr,2),Mr=Gr[0],Ir=Gr[1],cn=Object(E.useState)(""),Sn=Object(z.a)(cn,2),wr=Sn[0],ot=Sn[1],be=Object(E.useState)(0),Ke=Object(z.a)(be,2),wt=Ke[0],mt=Ke[1],vt=Object(E.useState)(et),It=Object(z.a)(vt,2),gr=It[0],cr=It[1],hr=Object(E.useState)(!1),Lr=Object(z.a)(hr,2),Sr=Lr[0],Wr=Lr[1],or=Object(E.useRef)(Object(je.a)()),tr=Object(E.useRef)(!1),pr=Object(E.useRef)(),Ht=Object(E.useRef)(),br=Object(E.useRef)(),lr=Object(E.useRef)(),vn=Object(E.useRef)(),Nr=function(){var Dt=Object(I.a)(P.a.mark(function Kt(){var Nt,Jt;return P.a.wrap(function(vr){for(;;)switch(vr.prev=vr.next){case 0:return vr.next=2,Object(Ge.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:or.current}});case 2:Jt=vr.sent,Jt!=null&&(Nt=Jt.attachments)!==null&&Nt!==void 0&&Nt.length&&(console.log("cm:",M,Ht),Jt.attachments.map(function(ar){ar.content_type.indexOf("image")>-1?M.replaceSelection("![,](/api/attachments/".concat(ar.id,"?type=").concat(ar.content_type,")")):ar.content_type.indexOf("video")>-1?M.replaceSelection('')):ar.content_type.indexOf("pdf")>-1?M.replaceSelection('
    ').concat(ar.name,"")):M.replaceSelection("[".concat(ar.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(ar.id,"?type=").concat(ar.content_type,")"))}));case 4:case"end":return vr.stop()}},Kt)}));return function(){return Dt.apply(this,arguments)}}();Object(E.useEffect)(function(){rt(U),M==null||M.setValue(U)},[U]),Object(E.useEffect)(function(){ir==null||ir(Mr)},[Mr]),Object(E.useEffect)(function(){if(Ht.current){var Dt=T.a.fromTextArea(Ht.current,{mode:Zt,lineNumbers:!Ft,lineWrapping:!0,value:Pe,autoCloseTags:!0,autoCloseBrackets:!0});jt&&Dt.focus();function Kt(Nt,Jt){if(Pr){Jt.preventDefault();return}var sr=Jt.clipboardData;if(sr){var vr=sr.types.toString(),ar=sr.items;if(vr==="Files"||sr.types.indexOf("Files")>-1){if(Jt.preventDefault(),Zt=="stex")return;try{var kr,Qr=ar[1];((kr=ar[0])===null||kr===void 0?void 0:kr.kind)==="file"&&(Qr=ar[0]);var rr=Qr.getAsFile(),Cn=rr.name.split(".").pop();we(rr,function(ur){if(ur.id){var Zr,Kr,hn;(rr==null||((Zr=rr.type)===null||Zr===void 0)?void 0:Zr.indexOf("image"))>-1?Dt.replaceSelection("![,](/api/attachments/".concat(ur.id,"?type=").concat(ur.content_type,")")):(rr==null||((Kr=rr.type)===null||Kr===void 0)?void 0:Kr.indexOf("video"))>-1?Dt.replaceSelection('')):(rr==null||((hn=rr.type)===null||hn===void 0)?void 0:hn.indexOf("pdf"))>-1?Dt.replaceSelection('').concat(rr.name,"")):ee.includes(Cn)?Dt.replaceSelection('').concat(rr.name,"")):Dt.replaceSelection("[".concat(rr.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(ur.id,"?type=").concat(ur.content_type,")"))}else(ur==null?void 0:ur.status)===401&&(document.location.href="/user/login")})}catch(ur){N.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return Dt.on("paste",Kt),Dt.on("dragleave",function(Nt,Jt){br.current.classList.remove("mouse-hover-md")}),Dt.on("dragover",function(Nt,Jt){br.current.classList.add("mouse-hover-md")}),Dt.on("drop",function(Nt,Jt){br.current.classList.add("mouse-hover-md");var sr;if(sr=Jt.dataTransfer.files,sr.length>0){Jt.preventDefault(),Jt.stopPropagation();for(var vr=function(Qr){var rr=sr[Qr],Cn=rr.name.split(".").pop();we(rr,function(ur){if(ur.id){var Zr,Kr,hn;(rr==null||((Zr=rr.type)===null||Zr===void 0)?void 0:Zr.indexOf("image"))>-1?Dt.replaceSelection("![,](/api/attachments/".concat(ur.id,"?type=").concat(ur.content_type,")")):(rr==null||((Kr=rr.type)===null||Kr===void 0)?void 0:Kr.indexOf("video"))>-1?Dt.replaceSelection('')):(rr==null||((hn=rr.type)===null||hn===void 0)?void 0:hn.indexOf("pdf"))>-1?Dt.replaceSelection('').concat(rr.name,"")):ee.includes(Cn)?Dt.replaceSelection('').concat(rr.name,"")):Dt.replaceSelection("[".concat(rr.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(ur.id,"?type=").concat(ur.content_type,")"))}else(ur==null?void 0:ur.status)===401&&(document.location.href="/user/login")})},ar=0;ar0||ar.target.offsetWidth>0)&&(Yr(),M.setSize("100%","100%"),M.refresh())}}catch(kr){sr.e(kr)}finally{sr.f()}});return Nt.observe(Ht.current.parentElement),Nt}if(M){var Kt=Dt();return function(){Kt.unobserve(Ht.current.parentElement)}}},[M,Yr]),Object(E.useEffect)(function(){if(M){for(var Dt=[],Kt=function(){var ar=Jt[Nt];sr=Object(z.a)(ar,2);var kr=sr[0],Qr=sr[1],rr=Object(j.a)({},kr,function(){Yn(Qr)});Dt.push(rr),M.addKeyMap(rr)},Nt=0,Jt=Object.entries(te);Nt0){var Dt=new Date().getTime(),Kt=window.sessionStorage.getItem(Xt);Dt>=wt+dt&&(!Kt||Kt!==Ne)&&(window.sessionStorage.setItem(Xt,Ne),Wr(!0))}},dt),Object(E.useEffect)(function(){er($t)},[M,$t]),Object(E.useEffect)(function(){M&&(jt&&M.focus())},[M,jt]),Object(E.useEffect)(function(){if(kt&&M){var Dt=M.getScrollerElement();function Kt(Nt){var Jt=Nt.target;if(vn.current){var sr=Jt.scrollTop/Jt.scrollHeight;vn.current.scrollTop=vn.current.scrollHeight*sr}}return Dt.addEventListener("scroll",Kt),function(){Dt.removeEventListener("scroll",Kt)}}},[M,kt]),Object(E.useEffect)(function(){if(M&&Tr){function Dt(Kt,Nt){Tr(Kt,Nt)}return M.on("beforeChange",Dt),function(){M.off("beforeChange",Dt)}}},[M,Tr]),Object(E.useEffect)(function(){if(M&&Wt){function Dt(){Wt(M.getValue())}return M.on("blur",Dt),function(){M.off("blur",Dt)}}},[M,Wt]),Object(E.useEffect)(function(){if(M){function Dt(Kt){var Nt=Kt.getValue();rt(Nt),mt(new Date().getTime()),Kt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Ze&&Ze(Nt)}return M.on("change",Dt),function(){M.off("change",Dt)}}},[M,Ze]),Object(E.useEffect)(function(){M&&(Pe==null?(M.setValue(""),rt("")):Pe!==M.getValue()&&(M.setValue(Pe),rt(Pe),M.setCursor(M.lineCount(),0)))},[M,Pe]);var Yn=Object(E.useCallback)(function(Dt){var Kt=M.getCursor(),Nt=M.getSelection(),Jt=Nt.split(` `);switch(Dt){case"bold":return M.replaceSelection("**"+Nt+"**"),Nt===""&&M.setCursor(Kt.line,Kt.ch+2),M.focus();case"italic":return M.replaceSelection("*"+Nt+"*"),Nt===""&&M.setCursor(Kt.line,Kt.ch+1),M.focus();case"code":return M.replaceSelection("`"+Nt+"`"),Nt===""&&M.setCursor(Kt.line,Kt.ch+1),M.focus();case"inline-latex":return M.replaceSelection("`$$"+Nt+"$$`"),Nt===""&&M.setCursor(Kt.line,Kt.ch+3),M.focus();case"latex":return M.replaceSelection("```latex\n"+Nt+"\n```"),M.setCursor(Kt.line+1,Nt.length+1),M.focus();case"line-break":return M.replaceSelection(`
    `),M.focus();case"list-ul":return Nt===""?M.replaceSelection("- "+Nt):M.replaceSelection(Jt.map(function(sr){return sr===""?"":"- ".concat(sr)}).join(` `)),M.focus();case"list-ol":return Nt===""?M.replaceSelection("1. "+Nt):M.replaceSelection(Jt.map(function(sr,vr){return sr===""?"":"".concat(vr+1,". ").concat(sr)}).join(` `)),M.focus();case"add-null-ch":return Nt===""&&M.setCursor(Kt.line,Kt.ch+1),M.replaceSelection(De),M.focus();case"inster-template-1":return Nt===""&&M.setCursor(Kt.line,Kt.ch),M.replaceSelection(We),M.focus();case"eraser":return M.setValue(""),M.focus();case"trigger-watch":return er(!kt),M.focus();case"trigger-full-screen":return Ir(!Mr),M.focus();case Ue:ot(Ue);return;case st:ot(st);return;case Re:ot(Re);return;case Je:ot(Je);return;default:throw new Error}},[M,kt,Mr]),An=Object(E.useCallback)(function(Dt){ot("");switch(wr){case Ue:var Kt=Dt.title,Nt=Dt.link;return M.replaceSelection("[".concat(Kt,"](").concat(Nt,")")),M.focus();case st:var Jt=Dt.language,sr=Dt.content;return M.replaceSelection(["```"+Jt,sr,"```"].join(` `)),M.focus();case Re:var vr=Dt.src,ar=Dt.alt;return ar?M.replaceSelection("![ ".concat(ar," ]( ").concat(vr,' "').concat(ar,'" )')):M.replaceSelection("![,](".concat(vr,")")),M.focus();case Je:for(var kr=Dt.row,Qr=Dt.col,rr=Dt.align,Cn=` `,ur=0;ur300&&(kr=300);var Qr=et+kr+"px";cr(Qr)}}return Dt.addEventListener("mousedown",Jt),document.addEventListener("mousemove",vr),document.addEventListener("mouseup",sr),function(){Dt.removeEventListener("mousedown",Jt),document.removeEventListener("mousemove",vr),document.removeEventListener("mouseup",sr)}}},[M,lr]),Object(E.useEffect)(function(){cr(et)},[et]);var yn=ge(Et),fi=ge(gr),fn={width:yn,height:fi},pi=Object(E.useMemo)(function(){if(wt){var Dt=new Date(wt),Kt=Dt.getHours(),Nt=Dt.getMinutes(),Jt=Dt.getSeconds();return Kt=Kt<10?"0"+Kt:Kt,Nt=Nt<10?"0"+Nt:Nt,Jt=Jt<10?"0"+Jt:Jt,"".concat(Kt,":").concat(Nt,":").concat(Jt)}return 0},[wt]);function ji(){window.sessionStorage.removeItem(Xt),Wr(!1),mt(0)}function Un(){Wr(!1),mt(0),M.setValue(window.sessionStorage.getItem(Xt))}function ua(Dt,Kt){var Nt=M.getValue();Nt=Nt.replace(Dt,Kt),rt(Nt),M==null||M.setValue(Nt)}return L.a.createElement(E.Fragment,null,L.a.createElement("div",{className:"markdown-editor-wrapper",ref:br},L.a.createElement("div",{className:"markdown-editor-container ".concat(Ie," ").concat(kt?"on-preview":""," ").concat(Ft?"mini":""," ").concat(Mr?"full-screen":""),style:fn},L.a.createElement(x,{insertTemp:Lt,watch:kt,fullScreen:Mr,showNullButton:it,onActionCallback:Yn,hidetoolBar:nr,uuid:or.current,setOpenPhones:function(){tr.current=!0}}),L.a.createElement("div",{className:"markdown-editor-body"},L.a.createElement("div",{className:"codemirror-container"},L.a.createElement("textarea",{ref:Ht,placeholder:dn})),kt?L.a.createElement("div",{ref:vn,className:"preview-container"},Zt==="stex"&&L.a.createElement(l,{value:Ne}),Zt!=="stex"&&L.a.createElement(m.a,{edit:!0,value:Ne,replaces:ua})):null))),Gt?L.a.createElement("a",{ref:lr,className:"editor-resize"}):null,L.a.createElement(k.a,null,ie[wr]?L.a.createElement($.a,{centered:!0,title:ie[wr],visible:!0,onCancel:Ln,footer:null,className:"markdown-popup-form"},hi):null))}},PGNT:function(At,ft,re){At.exports={wrap:"wrap___orWmH",modal:"modal___142IN",titleWrap:"titleWrap___2UWGN",required:"required___lXOtq",title:"title___2wqMf",colorGray:"colorGray___3FkLm",choiceWrap:"choiceWrap___3pbic",answer:"answer___30LSv",activeAnswer:"activeAnswer___3ayAN",deleteIcon:"deleteIcon___2HHly",addIcon:"addIcon___29vcx",editorWrap:"editorWrap___ANVP6",htmlWrap:"htmlWrap___38sLf",radio:"radio___15wok",color333:"color333___sNPjh",color999:"color999___1ofkl",fold:"fold___6rnoE",head:"head___2muph"}},PsQE:function(At,ft,re){At.exports={flex_box_center:"flex_box_center___2PkN_",flex_space_between:"flex_space_between___36cDA",flex_box_vertical_center:"flex_box_vertical_center___2c88u",flex_box_center_end:"flex_box_center_end___14cXO",flex_box_column:"flex_box_column___3nalt",wrap:"wrap___3xZrs",left:"left___19hOK",title:"title___3Ti2k",total:"total___3MRC5",list:"list___3pdfL",name:"name___2IcTs",b:"b___2W0Sn",r:"r___2Tpj8",l:"l___1rMKQ",tag:"tag___jj2X5",right:"right___16831",examName:"examName___2TmgX",t:"t___1CJZd",num:"num___1qX6C",topWarp:"topWarp___3WuSr",head:"head___3z9Hq",so:"so___m2B6Z",btn:"btn___20VL7",content:"content___2tTuo",titleWrap:"titleWrap___1cYdQ",single:"single___1BKtz",analysis:"analysis___1qm4Y",text:"text___1JQUf",btnsElse:"btnsElse___2IzAs",btnsWrap:"btnsWrap___3ib37",btns:"btns___2DbBT",modalColumn:"modalColumn___1zs36",modalRow:"modalRow___14b2N",sup:"sup___1CIjI",popover:"popover___Mmcvb"}},"RZ/O":function(At,ft,re){At.exports=re.p+"static/bi.9c9b0364.svg"},SJMd:function(At,ft){/** * @license * Copyright (C) 2006 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */var re,ae,$,R=!1,X,N;window.PR_SHOULD_USE_CONTINUATION=!0;var I,z;(function(){var j=window,O=["break,continue,do,else,for,if,return,while"],P=[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"],E=[P,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],L=[E,"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"],D=[E,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],T=[E,"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"],A="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",w=[E,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],h="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",o=[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"],d=[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"],c=[O,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],C=[L,T,D,w,h,o,d,c],y=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,m="str",l="kwd",S="com",f="typ",p="lit",s="pun",a="pln",b="tag",v="dec",x="src",k="atn",H="atv",V="nocode",Q="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function G(Le){for(var Me=0,He=!1,Ge=!1,je=0,Ue=Le.length;je122||(ee<65||pe>90||gt.push([Math.max(65,pe)|32,Math.min(ee,90)|32]),ee<97||pe>122||gt.push([Math.max(97,pe)&~32,Math.min(ee,122)&~32]))}}gt.sort(function(ue,Se){return ue[0]-Se[0]||Se[1]-ue[1]});for(var te=[],ie=[],We=0;Wese[0]&&(se[1]+1>se[0]&&De.push("-"),De.push(Qe(se[1])))}return De.push("]"),De.join("")}function bt(ht){for(var Ae=ht.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")),gt=Ae.length,dt=[],De=0,We=0;De=2&&pe==="["?Ae[De]=nt(ge):pe!=="\\"&&(Ae[De]=ge.replace(/[a-zA-Z]/g,function(ie){var se=ie.charCodeAt(0);return"["+String.fromCharCode(se&~32,se|32)+"]"}))}return Ae.join("")}for(var at=[],je=0,Ue=Le.length;je=0;)He[at.charAt(ht)]=bt;var Ae=bt[1],gt=""+Ae;Je.hasOwnProperty(gt)||(st.push(Ae),Je[gt]=null)}st.push(/[\0-\uffff]/),Ge=G(st)})();var je=Me.length,Ue=function(Re){for(var st=Re.sourceCode,Je=Re.basePos,Qe=Re.sourceNode,nt=[Je,a],bt=0,at=st.match(Ge)||[],ht={},Ae=0,gt=at.length;Ae=5&&De.substring(0,5)==="lang-",ge&&!(We&&typeof We[1]=="string")&&(ge=!1,De=x),ge||(ht[dt]=De)}var ee=bt;if(bt+=dt.length,!ge)nt.push(Je+ee,De);else{var te=We[1],ie=dt.indexOf(te),se=ie+te.length;We[2]&&(se=dt.length-We[2].length,ie=se-te.length);var ue=De.substring(5);q(Qe,Je+ee,dt.substring(0,ie),Ue,nt),q(Qe,Je+ee+ie,te,ne(ue,te),nt),q(Qe,Je+ee+se,dt.substring(se),Ue,nt)}}Re.decorations=nt};return Ue}function ke(Le){var Me=[],He=[];Le.tripleQuotedStrings?Me.push([m,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Le.multiLineStrings?Me.push([m,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Me.push([m,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Le.verbatimStrings&&He.push([m,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Ge=Le.hashComments;Ge&&(Le.cStyleComments?(Ge>1?Me.push([S,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Me.push([S,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),He.push([m,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Me.push([S,/^#[^\r\n]*/,null,"#"])),Le.cStyleComments&&(He.push([S,/^\/\/[^\r\n]*/,null]),He.push([S,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var je=Le.regexLiterals;if(je){var Ue=je>1?"":` \r`,Re=Ue?".":"[\\S\\s]",st="/(?=[^/*"+Ue+"])(?:[^/\\x5B\\x5C"+Ue+"]|\\x5C"+Re+"|\\x5B(?:[^\\x5C\\x5D"+Ue+"]|\\x5C"+Re+")*(?:\\x5D|$))+/";He.push(["lang-regex",RegExp("^"+Q+"("+st+")")])}var Je=Le.types;Je&&He.push([f,Je]);var Qe=(""+Le.keywords).replace(/^ | $/g,"");Qe.length&&He.push([l,new RegExp("^(?:"+Qe.replace(/[\s,]+/g,"|")+")\\b"),null]),Me.push([a,/^\s+/,null,` \r \xA0`]);var nt="^.[^\\s\\w.$@'\"`/\\\\]*";return Le.regexLiterals&&(nt+="(?!s*/)"),He.push([p,/^@[a-z_$][a-z_$@0-9]*/i,null],[f,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[p,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[s,new RegExp(nt),null]),ve(Me,He)}var Ee=ke({keywords:C,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function _e(Le,Me,He){for(var Ge=/(?:^|\s)nocode(?:\s|$)/,je=/\r\n?|\n/,Ue=Le.ownerDocument,Re=Ue.createElement("li");Le.firstChild;)Re.appendChild(Le.firstChild);var st=[Re];function Je(Ae){var gt=Ae.nodeType;if(gt==1&&!Ge.test(Ae.className))if(Ae.nodeName==="br")Qe(Ae),Ae.parentNode&&Ae.parentNode.removeChild(Ae);else for(var dt=Ae.firstChild;dt;dt=dt.nextSibling)Je(dt);else if((gt==3||gt==4)&&He){var De=Ae.nodeValue,We=De.match(je);if(We){var ge=De.substring(0,We.index);Ae.nodeValue=ge;var de=De.substring(We.index+We[0].length);if(de){var pe=Ae.parentNode;pe.insertBefore(Ue.createTextNode(de),Ae.nextSibling)}Qe(Ae),ge||Ae.parentNode.removeChild(Ae)}}}function Qe(Ae){for(;!Ae.nextSibling;)if(Ae=Ae.parentNode,!Ae)return;function gt(We,ge){var de=ge?We.cloneNode(!1):We,pe=We.parentNode;if(pe){var ee=gt(pe,1),te=We.nextSibling;ee.appendChild(de);for(var ie=te;ie;ie=te)te=ie.nextSibling,ee.appendChild(ie)}return de}for(var dt=gt(Ae.nextSibling,0),De;(De=dt.parentNode)&&De.nodeType===1;)dt=De;st.push(dt)}for(var nt=0;nt=pe&&(Je+=2),Ue>=ee&&(bt+=2)}}finally{De&&(De.style.display=We)}}var Ce={};function me(Le,Me){for(var He=Me.length;--He>=0;){var Ge=Me[He];Ce.hasOwnProperty(Ge)?j.console&&console.warn("cannot override language handler %s",Ge):Ce[Ge]=Le}}function ne(Le,Me){return Le&&Ce.hasOwnProperty(Le)||(Le=/^\s*]*(?:>|$)/],[S,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[s,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),me(ve([[a,/^[\s]+/,null,` \r `],[H,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[b,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[k,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[s,/^[=<>\/]+/],["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"]),me(ve([],[[H,/^[\s\S]+/]]),["uq.val"]),me(ke({keywords:L,hashComments:!0,cStyleComments:!0,types:y}),["c","cc","cpp","cxx","cyc","m"]),me(ke({keywords:"null,true,false"}),["json"]),me(ke({keywords:T,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:y}),["cs"]),me(ke({keywords:D,cStyleComments:!0}),["java"]),me(ke({keywords:c,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),me(ke({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),me(ke({keywords:h,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),me(ke({keywords:d,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),me(ke({keywords:w,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),me(ke({keywords:A,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),me(ve([],[[m,/^[\s\S]+/]]),["regex"]);function we(Le){var Me=Le.langExtension;try{var He=W(Le.sourceNode,Le.pre),Ge=He.sourceCode;Le.sourceCode=Ge,Le.spans=He.spans,Le.basePos=0,ne(Me,Ge)(Le),Te(Le)}catch(je){j.console&&console.log(je&&je.stack||je)}}function tt(Le,Me,He){var Ge=He||!1,je=Me||null,Ue=document.createElement("div");Ue.innerHTML="
    "+Le+"
    ",Ue=Ue.firstChild,Ge&&_e(Ue,Ge,!0);var Re={langExtension:je,numberLines:Ge,sourceNode:Ue,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return we(Re),Ue.innerHTML}function Ye(Le,Me){var He=Me||document.body,Ge=He.ownerDocument||document;function je(de){return He.getElementsByTagName(de)}for(var Ue=[je("pre"),je("code"),je("xmp")],Re=[],st=0;st=15&&(L=!1,O=!0);var m=d&&(P||L&&(y==null||y<12.11)),l=R||z&&j>=9;function S(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var f=function(e,t){var n=e.className,r=S(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function p(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function s(e,t){return p(e).appendChild(t)}function a(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var _=0;_=t)return B+(t-_);B+=K-_,B+=n-B%n,_=K+1}}var oe=function(){this.id=null,this.f=null,this.time=0,this.handler=G(this.onTimeout,this)};oe.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},oe.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n=t)return r+Math.min(B,t-i);if(i+=_-r,i+=n-i%n,r=_+1,i>=t)return r}}var me=[""];function ne(e){for(;me.length<=e;)me.push(we(me)+" ");return me[e]}function we(e){return e[e.length-1]}function tt(e,t){for(var n=[],r=0;r"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Le.test(e))}function He(e,t){return t?t.source.indexOf("\\w")>-1&&Me(e)?!0:t.test(e):Me(e)}function Ge(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var je=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Ue(e){return e.charCodeAt(0)>=768&&je.test(e)}function Re(e,t,n){for(;(n<0?t>0:tn?-1:1;;){if(t==n)return t;var i=(t+n)/2,_=r<0?Math.ceil(i):Math.floor(i);if(_==t)return e(_)?t:n;e(_)?n=_:t=_+r}}function Je(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,_=0;_t||t==n&&B.to==t)&&(r(Math.max(B.from,t),Math.min(B.to,n),B.level==1?"rtl":"ltr",_),i=!0)}i||r(t,n,"ltr")}var Qe=null;function nt(e,t,n){var r;Qe=null;for(var i=0;it)return i;_.to==t&&(_.from!=_.to&&n=="before"?r=i:Qe=i),_.from==t&&(_.from!=_.to&&n!="before"?r=i:Qe=i)}return r!=null?r:Qe}var bt=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(Z){return Z<=247?e.charAt(Z):1424<=Z&&Z<=1524?"R":1536<=Z&&Z<=1785?t.charAt(Z-1536):1774<=Z&&Z<=2220?"r":8192<=Z&&Z<=8203?"w":Z==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,_=/[LRr]/,B=/[Lb1n]/,K=/[1n]/;function Y(Z,le,he){this.level=Z,this.from=le,this.to=he}return function(Z,le){var he=le=="ltr"?"L":"R";if(Z.length==0||le=="ltr"&&!r.test(Z))return!1;for(var xe=Z.length,ye=[],Oe=0;Oe-1&&(r[t]=i.slice(0,_).concat(i.slice(_+1)))}}}function De(e,t){var n=gt(e,t);if(!n.length)return;for(var r=Array.prototype.slice.call(arguments,2),i=0;i0}function pe(e){e.prototype.on=function(t,n){Ae(this,t,n)},e.prototype.off=function(t,n){dt(this,t,n)}}function ee(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function te(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ie(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function se(e){ee(e),te(e)}function ue(e){return e.target||e.srcElement}function Se(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),d&&e.ctrlKey&&t==1&&(t=3),t}var Pe=function(){if(z&&j<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),Ze;function qe(e){if(Ze==null){var t=a("span","\u200B");s(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Ze=t.offsetWidth<=1&&t.offsetHeight>2&&!(z&&j<8))}var n=Ze?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var Et;function Pt(e){if(Et!=null)return Et;var t=s(e,document.createTextNode("A\u062EA")),n=v(t,0,1).getBoundingClientRect(),r=v(t,1,2).getBoundingClientRect();return p(e),!n||n.left==n.right?!1:Et=r.right-n.right<3}var et=` b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(` `,t);i==-1&&(i=e.length);var _=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),B=_.indexOf("\r");B!=-1?(n.push(_.slice(0,B)),t+=B+1):(n.push(_),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},ct=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Ft=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Ct=null;function jt(e){if(Ct!=null)return Ct;var t=s(e,a("span","x")),n=t.getBoundingClientRect(),r=v(t,0,1).getBoundingClientRect();return Ct=Math.abs(n.left-r.left)>1}var $t={},Lt={};function Qt(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),$t[e]=t}function Zt(e,t){Lt[e]=t}function pt(e){if(typeof e=="string"&&Lt.hasOwnProperty(e))e=Lt[e];else if(e&&typeof e.name=="string"&&Lt.hasOwnProperty(e.name)){var t=Lt[e.name];typeof t=="string"&&(t={name:t}),e=Ve(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return pt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return pt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Xt(e,t){t=pt(t);var n=$t[t.name];if(!n)return Xt(e,"text/plain");var r=n(e,t);if(zt.hasOwnProperty(t.name)){var i=zt[t.name];for(var _ in i){if(!i.hasOwnProperty(_))continue;r.hasOwnProperty(_)&&(r["_"+_]=r[_]),r[_]=i[_]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var B in t.modeProps)r[B]=t.modeProps[B];return r}var zt={};function Gt(e,t){var n=zt.hasOwnProperty(e)?zt[e]:zt[e]={};W(t,n)}function Ut(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function Mt(e,t){for(var n;e.innerMode&&!(n=e.innerMode(t),!n||n.mode==e);)t=n.state,e=n.mode;return n||{mode:e,state:t}}function St(e,t,n){return e.startState?e.startState(t,n):!0}var it=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};it.prototype.eol=function(){return this.pos>=this.string.length},it.prototype.sol=function(){return this.pos==this.lineStart},it.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},it.prototype.next=function(){if(this.post},it.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},it.prototype.skipToEnd=function(){this.pos=this.string.length},it.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},it.prototype.backUp=function(e){this.pos-=e},it.prototype.column=function(){return this.lastColumnPos0?null:(_&&t!==!1&&(this.pos+=_[0].length),_)}},it.prototype.current=function(){return this.string.slice(this.start,this.pos)},it.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},it.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},it.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function Fe(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],_=i.chunkSize();if(t<_){n=i;break}t-=_}return n.lines[t]}function nr(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(_){var B=_.text;i==n.line&&(B=B.slice(0,n.ch)),i==t.line&&(B=B.slice(t.ch)),r.push(B),++i}),r}function Vt(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function qt(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function Wt(e){if(e.parent==null)return null;for(var t=e.parent,n=fe(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;!(r.children[i]==t);++i)n+=r.children[i].chunkSize();return n+t.first}function Tr(e,t){var n=e.first;e:do{for(var r=0;r=e.first&&tn?Ie(n,Fe(e,n).text.length):g(t,Fe(e,t.line).text.length)}function g(e,t){var n=e.ch;return n==null||n>t?Ie(e.line,t):n<0?Ie(e.line,0):e}function M(e,t){for(var n=[],r=0;rthis.maxLookAhead&&(this.maxLookAhead=e),t},F.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},F.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},F.fromSaved=function(e,t,n){return t instanceof J?new F(e,Ut(e.mode,t.state),n,t.lookAhead):new F(e,Ut(e.mode,t),n)},F.prototype.save=function(e){var t=e!==!1?Ut(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new J(t,this.maxLookAhead):t};function ce(e,t,n,r){var i=[e.state.modeGen],_={};Mr(e,t.text,e.doc.mode,n,function(Z,le){return i.push(Z,le)},_,r);for(var B=n.state,K=function(Z){n.baseTokens=i;var le=e.state.overlays[Z],he=1,xe=0;n.state=!0,Mr(e,t.text,le.mode,n,function(ye,Oe){for(var ze=he;xeye&&i.splice(he,1,ye,i[he+1],$e),he+=2,xe=Math.min(ye,$e)}if(!Oe)return;if(le.opaque)i.splice(ze,he-ze,ye,"overlay "+Oe),he=ze+2;else for(;zee.options.maxHighlightLength&&Ut(e.doc.mode,r.state),_=ce(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=_.styles,_.classes?t.styleClasses=_.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function rt(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new F(r,!0,t);var _=Ir(e,t,n),B=_>r.first&&Fe(r,_-1).stateAfter,K=B?F.fromSaved(r,B,_):new F(r,St(r.mode),_);return r.iter(_,t,function(Y){Tt(e,Y.text,K);var Z=K.line;Y.stateAfter=Z==t-1||Z%5==0||Z>=i.viewFrom&&Zt.start)return _}throw new Error("Mode "+e.name+" failed to advance stream.")}var er=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function fr(e,t,n,r){var i=e.doc,_=i.mode,B;t=u(i,t);var K=Fe(i,t.line),Y=rt(e,t.line,n),Z=new it(K.text,e.options.tabSize,Y),le;for(r&&(le=[]);(r||Z.pose.options.maxHighlightLength?(K=!1,B&&Tt(e,t,r,le.pos),le.pos=t.length,he=null):he=Gr(kt(n,le,r.state,xe),_),xe){var ye=xe[0].name;ye&&(he="m-"+(he?ye+" "+he:ye))}if(!K||Z!=he){for(;YB;--K){if(K<=_.first)return _.first;var Y=Fe(_,K-1),Z=Y.stateAfter;if(Z&&(!n||K+(Z instanceof J?Z.lookAhead:0)<=_.modeFrontier))return K;var le=q(Y.text,null,e.options.tabSize);(i==null||r>le)&&(i=K-1,r=le)}return i}function cn(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontiern;r--){var i=Fe(e,r).stateAfter;if(i&&(!(i instanceof J)||r+i.lookAhead=t:_.to>t);(r||(r=[])).push(new Ke(B,_.from,Y?null:_.to))}}return r}function gr(e,t,n){var r;if(e)for(var i=0;i=t:_.to>t);if(K||_.from==t&&B.type=="bookmark"&&(!n||_.marker.insertLeft)){var Y=_.from==null||(B.inclusiveLeft?_.from<=t:_.from0&&K)for(var _t=0;_t0)continue;var le=[Y,1],he=xt(Z.from,K.from),xe=xt(Z.to,K.to);(he<0||!B.inclusiveLeft&&!he)&&le.push({from:Z.from,to:K.from}),(xe>0||!B.inclusiveRight&&!xe)&&le.push({from:K.to,to:Z.to}),i.splice.apply(i,le),Y+=le.length-3}return i}function Sr(e){var t=e.markedSpans;if(!t)return;for(var n=0;nt)&&(!r||pr(r,_.marker)<0)&&(r=_.marker)}return r}function Nr(e,t,n,r,i){var _=Fe(e,t),B=wr&&_.markedSpans;if(B)for(var K=0;K=0&&he<=0||le<=0&&he>=0)continue;if(le<=0&&(Y.marker.inclusiveRight&&i.inclusiveLeft?xt(Z.to,n)>=0:xt(Z.to,n)>0)||le>=0&&(Y.marker.inclusiveRight&&i.inclusiveLeft?xt(Z.from,r)<=0:xt(Z.from,r)<0))return!0}}function Yr(e){for(var t;t=br(e);)e=t.find(-1,!0).line;return e}function Yn(e){for(var t;t=lr(e);)e=t.find(1,!0).line;return e}function An(e){for(var t,n;t=lr(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function hi(e,t){var n=Fe(e,t),r=Yr(n);return n==r?t:Wt(r)}function Ln(e,t){if(t>e.lastLine())return t;var n=Fe(e,t),r;if(!yn(e,n))return t;for(;r=lr(n);)n=r.find(1,!0).line;return Wt(n)+1}function yn(e,t){var n=wr&&t.markedSpans;if(n)for(var r=void 0,i=0;it.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var Un=function(e,t,n){this.text=e,Wr(this,t),this.height=n?n(this):1};Un.prototype.lineNo=function(){return Wt(this)},pe(Un);function ua(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Sr(e),Wr(e,n);var i=r?r(e):1;i!=e.height&&qt(e,i)}function Dt(e){e.parent=null,Sr(e)}var Kt={},Nt={};function Jt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Nt:Kt;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function sr(e,t){var n=b("span",null,null,O?"padding-right: .1px":null),r={pre:b("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var _=i?t.rest[i-1]:t.line,B=void 0;r.pos=0,r.addToken=ar,Pt(e.display.measure)&&(B=at(_,e.doc.direction))&&(r.addToken=Qr(r.addToken,B)),r.map=[];var K=t!=e.display.externalMeasured&&Wt(_);Cn(_,r,Ne(e,_,K)),_.styleClasses&&(_.styleClasses.bgClass&&(r.bgClass=V(_.styleClasses.bgClass,r.bgClass||"")),_.styleClasses.textClass&&(r.textClass=V(_.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(qe(e.display.measure))),i==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(O){var Y=r.content.lastChild;(/\bcm-tab\b/.test(Y.className)||Y.querySelector&&Y.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return De(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=V(r.pre.className,r.textClass||"")),r}function vr(e){var t=a("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function ar(e,t,n,r,i,_,B){if(!t)return;var K=e.splitSpaces?kr(t,e.trailingSpace):t,Y=e.cm.state.specialChars,Z=!1,le;if(!Y.test(t))e.col+=t.length,le=document.createTextNode(K),e.map.push(e.pos,e.pos+t.length,le),z&&j<9&&(Z=!0),e.pos+=t.length;else{le=document.createDocumentFragment();for(var he=0;;){Y.lastIndex=he;var xe=Y.exec(t),ye=xe?xe.index-he:t.length-he;if(ye){var Oe=document.createTextNode(K.slice(he,he+ye));z&&j<9?le.appendChild(a("span",[Oe])):le.appendChild(Oe),e.map.push(e.pos,e.pos+ye,Oe),e.col+=ye,e.pos+=ye}if(!xe)break;he+=ye+1;var ze=void 0;if(xe[0]==" "){var $e=e.cm.options.tabSize,lt=$e-e.col%$e;ze=le.appendChild(a("span",ne(lt),"cm-tab")),ze.setAttribute("role","presentation"),ze.setAttribute("cm-text"," "),e.col+=lt}else xe[0]=="\r"||xe[0]==` `?(ze=le.appendChild(a("span",xe[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),ze.setAttribute("cm-text",xe[0]),e.col+=1):(ze=e.cm.options.specialCharPlaceholder(xe[0]),ze.setAttribute("cm-text",xe[0]),z&&j<9?le.appendChild(a("span",[ze])):le.appendChild(ze),e.col+=1);e.map.push(e.pos,e.pos+1,ze),e.pos++}}if(e.trailingSpace=K.charCodeAt(t.length-1)==32,n||r||i||Z||_||B){var yt=n||"";r&&(yt+=r),i&&(yt+=i);var ut=a("span",[le],yt,_);if(B)for(var _t in B)B.hasOwnProperty(_t)&&_t!="style"&&_t!="class"&&ut.setAttribute(_t,B[_t]);return e.content.appendChild(ut)}e.content.appendChild(le)}function kr(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;iZ&&he.from<=Z);xe++);if(he.to>=le)return e(n,r,i,_,B,K,Y);e(n,r.slice(0,he.to-Z),i,_,null,K,Y),_=null,r=r.slice(he.to-Z),Z=he.to}}}function rr(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function Cn(e,t,n){var r=e.markedSpans,i=e.text,_=0;if(!r){for(var B=1;BY||Yt.collapsed&&Ot.to==Y&&Ot.from==Y)){if(Ot.to!=null&&Ot.to!=Y&&ye>Ot.to&&(ye=Ot.to,ze=""),Yt.className&&(Oe+=" "+Yt.className),Yt.css&&(xe=(xe?xe+";":"")+Yt.css),Yt.startStyle&&Ot.from==Y&&($e+=" "+Yt.startStyle),Yt.endStyle&&Ot.to==ye&&(_t||(_t=[])).push(Yt.endStyle,Ot.to),Yt.title&&((yt||(yt={})).title=Yt.title),Yt.attributes)for(var yr in Yt.attributes)(yt||(yt={}))[yr]=Yt.attributes[yr];Yt.collapsed&&(!lt||pr(lt.marker,Yt)<0)&&(lt=Ot)}else Ot.from>Y&&ye>Ot.from&&(ye=Ot.from)}if(_t)for(var Fr=0;Fr<_t.length;Fr+=2)_t[Fr+1]==ye&&(ze+=" "+_t[Fr]);if(!lt||lt.from==Y)for(var Cr=0;Cr=K)break;for(var on=Math.min(K,ye);;){if(le){var tn=Y+le.length;if(!lt){var Rr=tn>on?le.slice(0,on-Y):le;t.addToken(t,Rr,he?he+Oe:Oe,$e,Y+Rr.length==ye?ze:"",xe,yt)}if(tn>=on){le=le.slice(on-Y),Y=on;break}Y=tn,$e=""}le=i.slice(_,_=n[Z++]),he=Jt(n[Z++],t.cm.options)}}}function ur(e,t,n){this.line=t,this.rest=An(t),this.size=this.rest?Wt(we(this.rest))-n+1:1,this.node=this.text=null,this.hidden=yn(e,t)}function Zr(e,t,n){for(var r=[],i,_=t;_2&&_.push((Y.bottom+Z.top)/2-n.top)}}_.push(n.bottom-n.top)}}function eo(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;rn)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Fs(e,t){t=Yr(t);var n=Wt(t),r=e.display.externalMeasured=new ur(e.doc,t,n);r.lineN=n;var i=r.built=sr(e,r);return r.text=i.pre,s(e.display.lineMeasure,i.pre),r}function to(e,t,n,r){return En(e,$n(e,t),n,r)}function fa(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&tt)&&(_=Y-K,i=_-1,t>=Y&&(B="right")),i!=null){if(r=e[Z+2],K==Y&&n==(r.insertLeft?"left":"right")&&(B=n),n=="left"&&i==0)for(;Z&&e[Z-2]==e[Z-3]&&e[Z-1].insertLeft;)r=e[(Z-=3)+2],B="left";if(n=="right"&&i==Y-K)for(;Z=0&&!((n=e[i]).left!=n.right);i--);return n}function Ws(e,t,n,r){var i=no(t.map,n,r),_=i.node,B=i.start,K=i.end,Y=i.collapse,Z;if(_.nodeType==3){for(var le=0;le<4;le++){for(;B&&Ue(t.line.text.charAt(i.coverStart+B));)--B;for(;i.coverStart+K0&&(Y=r="right");var he;e.options.lineWrapping&&(he=_.getClientRects()).length>1?Z=he[r=="right"?he.length-1:0]:Z=_.getBoundingClientRect()}if(z&&j<9&&!B&&(!Z||!Z.left&&!Z.right)){var xe=_.parentNode.getClientRects()[0];xe?Z={left:xe.left,right:xe.left+Qn(e.display),top:xe.top,bottom:xe.bottom}:Z=ro}for(var ye=Z.top-t.rect.top,Oe=Z.bottom-t.rect.top,ze=(ye+Oe)/2,$e=t.view.measure.heights,lt=0;lt<$e.length-1&&!(ze<$e[lt]);lt++);var yt=lt?$e[lt-1]:0,ut=$e[lt],_t={left:(Y=="right"?Z.right:Z.left)-t.rect.left,right:(Y=="left"?Z.left:Z.right)-t.rect.left,top:yt,bottom:ut};return!Z.left&&!Z.right&&(_t.bogus=!0),e.options.singleCursorHeightPerLine||(_t.rtop=ye,_t.rbottom=Oe),_t}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!jt(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function io(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t=r.text.length?(Y=r.text.length,Z="before"):Y<=0&&(Y=0,Z="after"),!K)return B(Z=="before"?Y-1:Y,Z=="before");function le(Oe,ze,$e){var lt=K[ze],yt=lt.level==1;return B($e?Oe-1:Oe,yt!=$e)}var he=nt(K,Y,Z),xe=Qe,ye=le(Y,he,Z=="before");return xe!=null&&(ye.other=le(Y,xe,Z!="before")),ye}function uo(e,t){var n=0;t=u(e.doc,t),e.options.lineWrapping||(n=Qn(e.display)*t.ch);var r=Fe(e.doc,t.line),i=fn(r)+Wi(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function ga(e,t,n,r,i){var _=Ie(e,t,n);return _.xRel=i,r&&(_.outside=r),_}function va(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return ga(r.first,0,null,-1,-1);var i=Tr(r,n),_=r.first+r.size-1;if(i>_)return ga(r.first+r.size-1,Fe(r,_).text.length,null,1,1);t<0&&(t=0);for(var B=Fe(r,i);;){var K=zs(e,B,i,t,n),Y=vn(B,K.ch+(K.xRel>0||K.outside>0?1:0));if(!Y)return K;var Z=Y.find(1);if(Z.line==i)return Z;B=Fe(r,i=Z.line)}}function co(e,t,n,r){r-=pa(t);var i=t.text.length,_=st(function(B){return En(e,n,B-1).bottom<=r},i,0);return i=st(function(B){return En(e,n,B).top>r},_,i),{begin:_,end:i}}function ho(e,t,n,r){n||(n=$n(e,t));var i=Hi(e,t,En(e,n,r),"line").top;return co(e,t,n,i)}function ya(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function zs(e,t,n,r,i){i-=fn(t);var _=$n(e,t),B=pa(t),K=0,Y=t.text.length,Z=!0,le=at(t,e.doc.direction);if(le){var he=(e.options.lineWrapping?Ks:Gs)(e,t,n,_,le,r,i);Z=he.level!=1,K=Z?he.from:he.to-1,Y=Z?he.to:he.from-1}var xe=null,ye=null,Oe=st(function(Bt){var Ot=En(e,_,Bt);return Ot.top+=B,Ot.bottom+=B,ya(Ot,r,i,!1)?(Ot.top<=i&&Ot.left<=r&&(xe=Bt,ye=Ot),!0):!1},K,Y),ze,$e,lt=!1;if(ye){var yt=r-ye.left=_t.bottom?1:0}return Oe=Re(t.text,Oe,1),ga(n,Oe,$e,lt,r-ze)}function Gs(e,t,n,r,i,_,B){var K=st(function(he){var xe=i[he],ye=xe.level!=1;return ya(pn(e,Ie(n,ye?xe.to:xe.from,ye?"before":"after"),"line",t,r),_,B,!0)},0,i.length-1),Y=i[K];if(K>0){var Z=Y.level!=1,le=pn(e,Ie(n,Z?Y.from:Y.to,Z?"after":"before"),"line",t,r);ya(le,_,B,!0)&&le.top>B&&(Y=i[K-1])}return Y}function Ks(e,t,n,r,i,_,B){var K=co(e,t,r,B),Y=K.begin,Z=K.end;/\s/.test(t.text.charAt(Z-1))&&Z--;for(var le=null,he=null,xe=0;xe=Z||ye.to<=Y)continue;var Oe=ye.level!=1,ze=En(e,r,Oe?Math.min(Z,ye.to)-1:Math.max(Y,ye.from)).right,$e=ze<_?_-ze+1e9:ze-_;(!le||he>$e)&&(le=ye,he=$e)}return le||(le=i[i.length-1]),le.fromZ&&(le={from:le.from,to:Z,level:le.level}),le}var Fn;function Jn(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Fn==null){Fn=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Fn.appendChild(document.createTextNode("x")),Fn.appendChild(a("br"));Fn.appendChild(document.createTextNode("x"))}s(e.measure,Fn);var n=Fn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),p(e.measure),n||1}function Qn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),n=a("pre",[t],"CodeMirror-line-like");s(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function ba(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,_=t.gutters.firstChild,B=0;_;_=_.nextSibling,++B){var K=e.display.gutterSpecs[B].className;n[K]=_.offsetLeft+_.clientLeft+i,r[K]=_.clientWidth}return{fixedPos:Ea(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ea(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function fo(e){var t=Jn(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Qn(e.display)-3);return function(i){if(yn(e.doc,i))return 0;var _=0;if(i.widgets)for(var B=0;B0&&(Z=Fe(e.doc,Y.line).text).length==Y.ch){var le=q(Z,Z.length,e.options.tabSize)-Z.length;Y=Ie(Y.line,Math.max(0,Math.round((_-qa(e.display).left)/Qn(e.display))-le))}return Y}function Wn(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;rt)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)wr&&hi(e.doc,t)i.viewFrom?Dn(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Dn(e);else if(t<=i.viewFrom){var _=zi(e,n,n+r,1);_?(i.view=i.view.slice(_.index),i.viewFrom=_.lineN,i.viewTo+=r):Dn(e)}else if(n>=i.viewTo){var B=zi(e,t,t,-1);B?(i.view=i.view.slice(0,B.index),i.viewTo=B.lineN):Dn(e)}else{var K=zi(e,t,t,-1),Y=zi(e,n,n+r,1);K&&Y?(i.view=i.view.slice(0,K.index).concat(Zr(e,K.lineN,Y.lineN)).concat(i.view.slice(Y.index)),i.viewTo+=r):Dn(e)}var Z=i.externalMeasured;Z&&(n=i.lineN&&t=r.viewTo)return;var _=r.view[Wn(e,t)];if(_.node==null)return;var B=_.changes||(_.changes=[]);fe(B,n)==-1&&B.push(n)}function Dn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function zi(e,t,n,r){var i=Wn(e,t),_,B=e.display.view;if(!wr||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var K=e.display.viewFrom,Y=0;Y0){if(i==B.length-1)return null;_=K+B[i].size-t,i++}else _=K-t;t+=_,n+=_}for(;hi(e.doc,n)!=n;){if(i==(r<0?0:B.length-1))return null;n+=r*B[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function Vs(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=Zr(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Zr(e,t,r.viewFrom).concat(r.view):r.viewFromn&&(r.view=r.view.slice(0,Wn(e,n)))),r.viewTo=n}function po(e){for(var t=e.display.view,n=0,r=0;r=e.display.viewTo||K.to().line0?t.blinker=setInterval(function(){e.hasFocus()||Zn(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function vo(e){e.state.focused||(e.display.input.focus(),Ca(e))}function yo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Zn(e))},100)}function Ca(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(De(e,"focus",e,t),e.state.focused=!0,H(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),O&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Sa(e)}function Zn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(De(e,"blur",e,t),e.state.focused=!1,f(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Ki(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r.005||le<-.005)&&(qt(i.line,B),bo(i.line),i.rest))for(var he=0;hee.display.sizerWidth){var xe=Math.ceil(K/Qn(e.display));xe>e.display.maxLineLength&&(e.display.maxLineLength=xe,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function bo(e){if(e.widgets)for(var t=0;t=B&&(_=Tr(t,fn(Fe(t,Y))-e.wrapper.clientHeight),B=Y)}return{from:_,to:Math.max(B,_+1)}}function Ys(e,t){if(We(e,"scrollCursorIntoView"))return;var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),i!=null&&!A){var _=a("div","\u200B",null,`position: absolute; top: `+(t.top-n.viewOffset-Wi(e.display))+`px; height: `+(t.bottom-t.top+bn(e)+n.barHeight)+`px; left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(_),_.scrollIntoView(i),e.display.lineSpace.removeChild(_)}}function $s(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?Ie(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Ie(t.line,t.ch+1,"before"):t);for(var _=0;_<5;_++){var B=!1,K=pn(e,t),Y=!n||n==t?K:pn(e,n);i={left:Math.min(K.left,Y.left),top:Math.min(K.top,Y.top)-r,right:Math.max(K.left,Y.left),bottom:Math.max(K.bottom,Y.bottom)+r};var Z=_a(e,i),le=e.doc.scrollTop,he=e.doc.scrollLeft;if(Z.scrollTop!=null&&(xi(e,Z.scrollTop),Math.abs(e.doc.scrollTop-le)>1&&(B=!0)),Z.scrollLeft!=null&&(Hn(e,Z.scrollLeft),Math.abs(e.doc.scrollLeft-he)>1&&(B=!0)),!B)break}return i}function Js(e,t){var n=_a(e,t);n.scrollTop!=null&&xi(e,n.scrollTop),n.scrollLeft!=null&&Hn(e,n.scrollLeft)}function _a(e,t){var n=e.display,r=Jn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,_=ha(e),B={};t.bottom-t.top>_&&(t.bottom=t.top+_);var K=e.doc.height+ca(n),Y=t.topK-r;if(t.topi+_){var le=Math.min(t.top,(Z?K:t.bottom)-_);le!=i&&(B.scrollTop=le)}var he=e.options.fixedGutter?0:n.gutters.offsetWidth,xe=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-he,ye=Bn(e)-n.gutters.offsetWidth,Oe=t.right-t.left>ye;return Oe&&(t.right=t.left+ye),t.left<10?B.scrollLeft=0:t.leftye+xe-3&&(B.scrollLeft=t.right+(Oe?0:10)-ye),B}function Ta(e,t){if(t==null)return;Xi(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function qn(e){Xi(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Ei(e,t,n){(t!=null||n!=null)&&Xi(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Qs(e,t){Xi(e),e.curOp.scrollToPos=t}function Xi(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=uo(e,t.from),r=uo(e,t.to);Eo(e,n,r,t.margin)}}function Eo(e,t,n,r){var i=_a(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});Ei(e,i.scrollLeft,i.scrollTop)}function xi(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;R||Aa(e,{top:t}),xo(e,t,!0),R&&Aa(e),_i(e,100)}function xo(e,t,n){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!n)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function Hn(e,t,n,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,wo(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function Si(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+ca(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+bn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var zn=function(e,t,n){this.cm=n;var r=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),Ae(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Ae(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,z&&j<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};zn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var _=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+_)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},zn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},zn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},zn.prototype.zeroWidthHack=function(){var e=d&&!T?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new oe,this.disableVert=new oe},zn.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),_=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);_!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},zn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Ci=function(){};Ci.prototype.update=function(){return{bottom:0,right:0}},Ci.prototype.setScrollLeft=function(){},Ci.prototype.setScrollTop=function(){},Ci.prototype.clear=function(){};function ei(e,t){t||(t=Si(e));var n=e.display.barWidth,r=e.display.barHeight;So(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Ki(e),So(e,Si(e)),n=e.display.barWidth,r=e.display.barHeight}function So(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var Co={native:zn,null:Ci};function _o(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&f(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Co[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Ae(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?Hn(e,t):xi(e,t)},e),e.display.scrollbars.addClass&&H(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function Gn(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Zs},hn(e.curOp)}function Kn(e){var t=e.curOp;t&&Ps(t,function(n){for(var r=0;r=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Yi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&wa(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&Ki(t),e.barMeasure=Si(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=to(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+bn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Bn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function nl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=rt(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(_){if(r.line>=e.display.viewFrom){var B=_.styles,K=_.text.length>e.options.maxHighlightLength?Ut(t.mode,r.state):null,Y=ce(e,_,r,!0);K&&(r.state=K),_.styles=Y.styles;var Z=_.styleClasses,le=Y.classes;le?_.styleClasses=le:Z&&(_.styleClasses=null);for(var he=!B||B.length!=_.styles.length||Z!=le&&(!Z||!le||Z.bgClass!=le.bgClass||Z.textClass!=le.textClass),xe=0;!he&&xen)return _i(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&an(e,function(){for(var _=0;_=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&po(e)==0)return!1;Ao(e)&&(Dn(e),t.dims=ba(e));var i=r.first+r.size,_=Math.max(t.visible.from-e.options.viewportMargin,r.first),B=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<_&&_-n.viewFrom<20&&(_=Math.max(r.first,n.viewFrom)),n.viewTo>B&&n.viewTo-B<20&&(B=Math.min(i,n.viewTo)),wr&&(_=hi(e.doc,_),B=Ln(e.doc,B));var K=_!=n.viewFrom||B!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,_,B),n.viewOffset=fn(Fe(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var Y=po(e);if(!K&&Y==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var Z=sl(e);return Y>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),Y>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(Z),p(n.cursorDiv),p(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,K&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,_i(e,400)),n.updateLineNumbers=null,!0}function To(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==Bn(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ca(e.display)-ha(e),n.top)}),t.visible=Vi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Vi(e.display,e.doc,n));if(!wa(e,t))break;Ki(e);var i=Si(e);bi(e),ei(e,i),Ra(e,i),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Aa(e,t){var n=new Yi(e,t);if(wa(e,n)){Ki(e),To(e,n);var r=Si(e);bi(e),ei(e,r),Ra(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,_=r.lineDiv,B=_.firstChild;function K(Oe){var ze=Oe.nextSibling;return O&&d&&e.display.currentWheelTarget==Oe?Oe.style.display="none":Oe.parentNode.removeChild(Oe),ze}for(var Y=r.view,Z=r.viewFrom,le=0;le-1&&(ye=!1),Ya(e,he,Z,n)),ye&&(p(he.lineNumber),he.lineNumber.appendChild(document.createTextNode(Rt(e.options,Z)))),B=he.node.nextSibling}Z+=he.size}for(;B;)B=K(B)}function La(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Ra(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+bn(e)+"px"}function wo(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=Ea(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,_=r+"px",B=0;BB.clientWidth,Y=B.scrollHeight>B.clientHeight;if(!(r&&K||i&&Y))return;if(i&&d&&O){e:for(var Z=t.target,le=_.view;Z!=B;Z=Z.parentNode)for(var he=0;he=0&&xt(e,r.to())<=0)return n}return-1};var dr=function(e,t){this.anchor=e,this.head=t};dr.prototype.from=function(){return xr(this.anchor,this.head)},dr.prototype.to=function(){return dn(this.anchor,this.head)},dr.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function mn(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(xe,ye){return xt(xe.from(),ye.from())}),n=fe(t,i);for(var _=1;_0:Y>=0){var Z=xr(K.from(),B.from()),le=dn(K.to(),B.to()),he=K.empty()?B.from()==B.head:K.from()==K.head;_<=n&&--n,t.splice(--_,2,new dr(he?le:Z,he?Z:le))}}return new ln(t,n)}function Pn(e,t){return new ln([new dr(e,t||e)],0)}function kn(e){return e.text?Ie(e.from.line+e.text.length-1,we(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Po(e,t){if(xt(e,t.from)<0)return e;if(xt(e,t.to)<=0)return kn(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=kn(t).ch-t.to.ch),Ie(n,r)}function Pa(e,t){for(var n=[],r=0;r1&&e.remove(K.line+1,Oe-1),e.insert(K.line+1,lt)}Hr(e,"change",e,t)}function On(e,t,n){function r(i,_,B){if(i.linked)for(var K=0;K1&&!e.done[e.done.length-2].ranges)return e.done.pop(),we(e.done)}function Uo(e,t,n,r){var i=e.history;i.undone.length=0;var _=+new Date,B,K;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>_-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(B=pl(i,i.lastOp==r)))K=we(B.changes),xt(t.from,t.to)==0&&xt(t.from,K.to)==0?K.to=kn(t):B.changes.push(Ma(e,t));else{var Y=we(i.done);for((!Y||!Y.ranges)&&Qi(e.sel,i.done),B={changes:[Ma(e,t)],generation:i.generation},i.done.push(B);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=_,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,K||De(e,"historyAdded")}function ml(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,n,r){var i=e.history,_=r&&r.origin;n==i.lastSelOp||_&&i.lastSelOrigin==_&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==_||ml(e,_,we(i.done),t))?i.done[i.done.length-1]=t:Qi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=_,i.lastSelOp=n,r&&r.clearRedo!==!1&&No(i.undone)}function Qi(e,t){var n=we(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Bo(e,t,n,r){var i=t["spans_"+e.id],_=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(B){B.markedSpans&&((i||(i=t["spans_"+e.id]={}))[_]=B.markedSpans),++_})}function vl(e){if(!e)return null;for(var t,n=0;n-1&&(we(K)[he]=Z[he],delete Z[he]))}}return r}function Ia(e,t,n,r){if(r){var i=e.anchor;if(n){var _=xt(t,i)<0;_!=xt(n,i)<0?(i=t,t=n):_!=xt(t,n)<0&&(t=n)}return new dr(i,t)}else return new dr(n||t,t)}function Zi(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Vr(e,new ln([Ia(e.sel.primary(),t,n,i)],0),r)}function jo(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),_=0;_=t.ch:K.to>t.ch))){if(i&&(De(Y,"beforeCursorEnter"),Y.explicitlyCleared))if(_.markedSpans){--B;continue}else break;if(!Y.atomic)continue;if(n){var he=Y.find(r<0?1:-1),xe=void 0;if((r<0?le:Z)&&(he=Vo(e,he,-r,he&&he.line==t.line?_:null)),he&&he.line==t.line&&(xe=xt(he,n))&&(r<0?xe<0:xe>0))return ri(e,he,t,r,i)}var ye=Y.find(r<0?-1:1);return(r<0?Z:le)&&(ye=Vo(e,ye,r,ye.line==t.line?_:null)),ye?ri(e,ye,t,r,i):null}}return t}function ea(e,t,n,r,i){var _=r||1,B=ri(e,t,n,_,i)||!i&&ri(e,t,n,_,!0)||ri(e,t,n,-_,i)||!i&&ri(e,t,n,-_,!0);return B||(e.cantEdit=!0,Ie(e.first,0))}function Vo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?u(e,Ie(t.line-1)):null:n>0&&t.ch==(r||Fe(e,t.line)).text.length?t.line=0;--i)$o(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else $o(e,t)}function $o(e,t){if(t.text.length==1&&t.text[0]==""&&xt(t.from,t.to)==0)return;var n=Pa(e,t);Uo(e,t,n,e.cm?e.cm.curOp.id:NaN),Ai(e,t,n,cr(e,t));var r=[];On(e,function(i,_){!_&&fe(r,i.history)==-1&&(qo(i.history,t),r.push(i.history)),Ai(i,t,null,cr(i,t))})}function ta(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,_,B=e.sel,K=t=="undo"?i.done:i.undone,Y=t=="undo"?i.undone:i.done,Z=0;Z=0;--ye){var Oe=xe(ye);if(Oe)return Oe.v}}function Jo(e,t){if(t==0)return;if(e.first+=t,e.sel=new ln(tt(e.sel.ranges,function(i){return new dr(Ie(i.anchor.line+t,i.anchor.ch),Ie(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){qr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;re.lastLine())return;if(t.from.line_&&(t={from:t.from,to:Ie(_,Fe(e,_).text.length),text:[t.text[0]],origin:t.origin}),t.removed=nr(e,t.from,t.to),n||(n=Pa(e,t)),e.cm?El(e.cm,t,r):Oa(e,t,r),qi(e,n,Ee),e.cantEdit&&ea(e,Ie(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,_=t.from,B=t.to,K=!1,Y=_.line;e.options.lineWrapping||(Y=Wt(Yr(Fe(r,_.line))),r.iter(Y,B.line+1,function(ye){if(ye==i.maxLine)return K=!0,!0})),r.sel.contains(t.from,t.to)>-1&&ge(e),Oa(r,t,n,fo(e)),e.options.lineWrapping||(r.iter(Y,_.line+t.text.length,function(ye){var Oe=pi(ye);Oe>i.maxLineLength&&(i.maxLine=ye,i.maxLineLength=Oe,i.maxLineChanged=!0,K=!1)}),K&&(e.curOp.updateMaxLine=!0)),cn(r,_.line),_i(e,400);var Z=t.text.length-(B.line-_.line)-1;t.full?qr(e):_.line==B.line&&t.text.length==1&&!Oo(e.doc,t)?Rn(e,_.line,"text"):qr(e,_.line,B.line+1,Z);var le=de(e,"changes"),he=de(e,"change");if(he||le){var xe={from:_,to:B,text:t.text,removed:t.removed,origin:t.origin};he&&Hr(e,"change",e,xe),le&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(xe)}e.display.selForContextMenu=null}function ii(e,t,n,r,i){var _;r||(r=n),xt(r,n)<0&&(_=[r,n],n=_[0],r=_[1]),typeof t=="string"&&(t=e.splitLines(t)),ni(e,{from:n,to:r,text:t,origin:i})}function Qo(e,t,n,r){n1||!(this.children[0]instanceof Ri))){var K=[];this.collapse(K),this.children=[new Ri(K)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var B=i.lines.length%25+25,K=B;K10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0;re.display.maxLineLength&&(e.display.maxLine=Z,e.display.maxLineLength=le,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&qr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Go(e.doc)),e&&Hr(e,"markerCleared",e,this,r,i),t&&Kn(e),this.parent&&this.parent.clear()},Mn.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i0||B==0&&_.clearWhenEmpty!==!1)return _;if(_.replacedWith&&(_.collapsed=!0,_.widgetNode=b("span",[_.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||_.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(_.widgetNode.insertLeft=!0)),_.collapsed){if(Nr(e,t.line,t,n,_)||t.line!=n.line&&Nr(e,n.line,t,n,_))throw new Error("Inserting collapsed marker partially overlapping an existing one");be()}_.addToHistory&&Uo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var K=t.line,Y=e.cm,Z;if(e.iter(K,n.line+1,function(he){Y&&_.collapsed&&!Y.options.lineWrapping&&Yr(he)==Y.display.maxLine&&(Z=!0),_.collapsed&&K!=t.line&&qt(he,0),vt(he,new Ke(_,K==t.line?t.ch:null,K==n.line?n.ch:null)),++K}),_.collapsed&&e.iter(t.line,n.line+1,function(he){yn(e,he)&&qt(he,0)}),_.clearOnEnter&&Ae(_,"beforeCursorEnter",function(){return _.clear()}),_.readOnly&&(ot(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),_.collapsed&&(_.id=++ts,_.atomic=!0),Y){if(Z&&(Y.curOp.updateMaxLine=!0),_.collapsed)qr(Y,t.line,n.line+1);else if(_.className||_.startStyle||_.endStyle||_.css||_.attributes||_.title)for(var le=t.line;le<=n.line;le++)Rn(Y,le,"text");_.atomic&&Go(Y.doc),Hr(Y,"markerAdded",Y,_)}return _}var ki=function(e,t){this.markers=e,this.primary=t;for(var n=0;n=0;Y--)ni(this,r[Y]);K?Ho(this,K):this.cm&&qn(this.cm)}),undo:Br(function(){ta(this,"undo")}),redo:Br(function(){ta(this,"redo")}),undoSelection:Br(function(){ta(this,"undo",!0)}),redoSelection:Br(function(){ta(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=u(this,e),t=u(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(_){var B=_.markedSpans;if(B)for(var K=0;K=Y.to||Y.from==null&&i!=e.line||Y.from!=null&&i==t.line&&Y.from>=t.ch)&&(!n||n(Y.marker))&&r.push(Y.marker.parent||Y.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;re)return t=e,!0;e-=_,++n}),u(this,Ie(n,t))},indexFromPos:function(e){e=u(this,e);var t=e.ch;if(e.linet&&(t=e.from),e.to!=null&&e.to-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var le=e.dataTransfer.getData("Text");if(le){var he;if(t.state.draggingText&&!t.state.draggingText.copy&&(he=t.listSelections()),qi(t.doc,Pn(n,n)),he)for(var xe=0;xe=0;K--)ii(e.doc,"",r[K].from,r[K].to,"+delete");qn(e)})}function Ua(e,t,n){var r=Re(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Ba(e,t,n){var r=Ua(e,t.ch,n);return r==null?null:new Ie(t.line,r,n<0?"after":"before")}function Fa(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var _=at(n,t.doc.direction);if(_){var B=i<0?we(_):_[0],K=i<0==(B.level==1),Y=K?"after":"before",Z;if(B.level>0||t.doc.direction=="rtl"){var le=$n(t,n);Z=i<0?n.text.length-1:0;var he=En(t,le,Z).top;Z=st(function(xe){return En(t,le,xe).top==he},i<0==(B.level==1)?B.from:B.to-1,Z),Y=="before"&&(Z=Ua(n,Z,1))}else Z=i<0?B.to:B.from;return new Ie(r,Z,Y)}}return new Ie(r,i<0?n.text.length:0,i<0?"before":"after")}function Ml(e,t,n,r){var i=at(t,e.doc.direction);if(!i)return Ba(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var _=nt(i,n.ch,n.sticky),B=i[_];if(e.doc.direction=="ltr"&&B.level%2==0&&(r>0?B.to>n.ch:B.from=B.from&&xe>=le.begin)){var ye=he?"before":"after";return new Ie(n.line,xe,ye)}}var Oe=function(lt,yt,ut){for(var _t=function(yr,Fr){return Fr?new Ie(n.line,K(yr,1),"before"):new Ie(n.line,yr,"after")};lt>=0&<0==(Bt.level!=1),Yt=Ot?ut.begin:K(ut.end,-1);if(Bt.from<=Yt&&Yt0?le.end:K(le.begin,-1);return $e!=null&&!(r>0&&$e==t.text.length)&&(ze=Oe(r>0?0:i.length-1,r,Z($e)),ze)?ze:null}var Ii={selectAll:Xo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Ee)},killLine:function(e){return si(e,function(t){if(t.empty()){var n=Fe(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line0)i=new Ie(i.line,i.ch+1),e.replaceRange(_.charAt(i.ch-1)+_.charAt(i.ch-2),Ie(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var B=Fe(e.doc,i.line-1).text;B&&(i=new Ie(i.line,1),e.replaceRange(_.charAt(0)+e.doc.lineSeparator()+B.charAt(B.length-1),Ie(i.line-1,B.length-1),i,"+transpose"))}}n.push(new dr(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return an(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;re&&xt(t,this.pos)==0&&n==this.button};var Ui,Bi;function Wl(e,t){var n=+new Date;return Bi&&Bi.compare(n,e,t)?(Ui=Bi=null,"triple"):Ui&&Ui.compare(n,e,t)?(Bi=new Wa(n,e,t),Ui=null,"double"):(Ui=new Wa(n,e,t),Bi=null,"single")}function vs(e){var t=this,n=t.display;if(We(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,_n(n,e)){O||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ha(t,e))return;var r=jn(t,e),i=Se(e),_=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,_,e))return;i==1?r?Gl(t,r,_,e):ue(e)==n.scroller&&ee(e):i==2?(r&&Zi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(l?t.display.input.onContextMenu(e):yo(t))}function Hl(e,t,n,r,i){var _="Click";return r=="double"?_="Double"+_:r=="triple"&&(_="Triple"+_),_=(t==1?"Left":t==2?"Middle":"Right")+_,Ni(e,ls(_,i),i,function(B){if(typeof B=="string"&&(B=Ii[B]),!B)return!1;var K=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),K=B(e,n)!=ke}finally{e.state.suppressEdits=!1}return K})}function zl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var _=c?n.shiftKey&&n.metaKey:n.altKey;i.unit=_?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=d?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(d?n.altKey:n.ctrlKey)),i}function Gl(e,t,n,r){z?setTimeout(G(vo,e),0):e.curOp.focus=k();var i=zl(e,n,r),_=e.doc.sel,B;e.options.dragDrop&&Pe&&!e.isReadOnly()&&n=="single"&&(B=_.contains(t))>-1&&(xt((B=_.ranges[B]).from(),t)<0||t.xRel>0)&&(xt(B.to(),t)>0||t.xRel<0)?Kl(e,r,t,i):Vl(e,r,t,i)}function Kl(e,t,n,r){var i=e.display,_=!1,B=Ur(e,function(Z){O&&(i.scroller.draggable=!1),e.state.draggingText=!1,dt(i.wrapper.ownerDocument,"mouseup",B),dt(i.wrapper.ownerDocument,"mousemove",K),dt(i.scroller,"dragstart",Y),dt(i.scroller,"drop",B),_||(ee(Z),r.addNew||Zi(e.doc,n,null,null,r.extend),O&&!D||z&&j==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),K=function(Z){_=_||Math.abs(t.clientX-Z.clientX)+Math.abs(t.clientY-Z.clientY)>=10},Y=function(){return _=!0};O&&(i.scroller.draggable=!0),e.state.draggingText=B,B.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),Ae(i.wrapper.ownerDocument,"mouseup",B),Ae(i.wrapper.ownerDocument,"mousemove",K),Ae(i.scroller,"dragstart",Y),Ae(i.scroller,"drop",B),yo(e),setTimeout(function(){return i.input.focus()},20)}function ys(e,t,n){if(n=="char")return new dr(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new dr(Ie(t.line,0),u(e.doc,Ie(t.line+1,0)));var r=n(e,t);return new dr(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,_=e.doc;ee(t);var B,K,Y=_.sel,Z=Y.ranges;if(r.addNew&&!r.extend?(K=_.sel.contains(n),K>-1?B=Z[K]:B=new dr(n,n)):(B=_.sel.primary(),K=_.sel.primIndex),r.unit=="rectangle")r.addNew||(B=new dr(n,n)),n=jn(e,t,!0,!0),K=-1;else{var le=ys(e,n,r.unit);r.extend?B=Ia(B,le.anchor,le.head,r.extend):B=le}r.addNew?K==-1?(K=Z.length,Vr(_,mn(e,Z.concat([B]),K),{scroll:!1,origin:"*mouse"})):Z.length>1&&Z[K].empty()&&r.unit=="char"&&!r.extend?(Vr(_,mn(e,Z.slice(0,K).concat(Z.slice(K+1)),0),{scroll:!1,origin:"*mouse"}),Y=_.sel):Na(_,K,B,_e):(K=0,Vr(_,new ln([B],0),_e),Y=_.sel);var he=n;function xe(ut){if(xt(he,ut)==0)return;if(he=ut,r.unit=="rectangle"){for(var _t=[],Bt=e.options.tabSize,Ot=q(Fe(_,n.line).text,n.ch,Bt),Yt=q(Fe(_,ut.line).text,ut.ch,Bt),yr=Math.min(Ot,Yt),Fr=Math.max(Ot,Yt),Cr=Math.min(n.line,ut.line),on=Math.min(e.lastLine(),Math.max(n.line,ut.line));Cr<=on;Cr++){var tn=Fe(_,Cr).text,Rr=Ce(tn,yr,Bt);yr==Fr?_t.push(new dr(Ie(Cr,Rr),Ie(Cr,Rr))):tn.length>Rr&&_t.push(new dr(Ie(Cr,Rr),Ie(Cr,Ce(tn,Fr,Bt))))}_t.length||_t.push(new dr(n,n)),Vr(_,mn(e,Y.ranges.slice(0,K).concat(_t),K),{origin:"*mouse",scroll:!1}),e.scrollIntoView(ut)}else{var rn=B,zr=ys(e,ut,r.unit),Or=rn.anchor,Dr;xt(zr.anchor,Or)>0?(Dr=zr.head,Or=xr(rn.from(),zr.anchor)):(Dr=zr.anchor,Or=dn(rn.to(),zr.head));var _r=Y.ranges.slice(0);_r[K]=Xl(e,new dr(u(_,Or),Dr)),Vr(_,mn(e,_r,K),_e)}}var ye=i.wrapper.getBoundingClientRect(),Oe=0;function ze(ut){var _t=++Oe,Bt=jn(e,ut,!0,r.unit=="rectangle");if(!Bt)return;if(xt(Bt,he)!=0){e.curOp.focus=k(),xe(Bt);var Ot=Vi(i,_);(Bt.line>=Ot.to||Bt.lineye.bottom?20:0;Yt&&setTimeout(Ur(e,function(){if(Oe!=_t)return;i.scroller.scrollTop+=Yt,ze(ut)}),50)}}function $e(ut){e.state.selectingText=!1,Oe=Infinity,ut&&(ee(ut),i.input.focus()),dt(i.wrapper.ownerDocument,"mousemove",lt),dt(i.wrapper.ownerDocument,"mouseup",yt),_.history.lastSelOrigin=null}var lt=Ur(e,function(ut){ut.buttons===0||!Se(ut)?$e(ut):ze(ut)}),yt=Ur(e,$e);e.state.selectingText=yt,Ae(i.wrapper.ownerDocument,"mousemove",lt),Ae(i.wrapper.ownerDocument,"mouseup",yt)}function Xl(e,t){var n=t.anchor,r=t.head,i=Fe(e.doc,n.line);if(xt(n,r)==0&&n.sticky==r.sticky)return t;var _=at(i);if(!_)return t;var B=nt(_,n.ch,n.sticky),K=_[B];if(K.from!=n.ch&&K.to!=n.ch)return t;var Y=B+(K.from==n.ch==(K.level!=1)?0:1);if(Y==0||Y==_.length)return t;var Z;if(r.line!=n.line)Z=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var le=nt(_,r.ch,r.sticky),he=le-B||(r.ch-n.ch)*(K.level==1?-1:1);le==Y-1||le==Y?Z=he<0:Z=he>0}var xe=_[Y+(Z?-1:0)],ye=Z==(xe.level==1),Oe=ye?xe.from:xe.to,ze=ye?"after":"before";return n.ch==Oe&&n.sticky==ze?t:new dr(new Ie(n.line,Oe,ze),r)}function bs(e,t,n,r){var i,_;if(t.touches)i=t.touches[0].clientX,_=t.touches[0].clientY;else try{i=t.clientX,_=t.clientY}catch(xe){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&ee(t);var B=e.display,K=B.lineDiv.getBoundingClientRect();if(_>K.bottom||!de(e,n))return ie(t);_-=K.top-B.viewOffset;for(var Y=0;Y=i){var le=Tr(e.doc,_),he=e.display.gutterSpecs[Y];return De(e,n,e,le,he.className,t),ie(t)}}}function Ha(e,t){return bs(e,t,"gutterClick",!0)}function Es(e,t){if(_n(e.display,t)||Yl(e,t))return;if(We(e,t,"contextmenu"))return;l||e.display.input.onContextMenu(t)}function Yl(e,t){return de(e,"gutterContextMenu")?bs(e,t,"gutterContextMenu",!1):!1}function xs(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),yi(e)}var li={toString:function(){return"CodeMirror.Init"}},Ss={},aa={};function $l(e){var t=e.optionHandlers;function n(r,i,_,B){e.defaults[r]=i,_&&(t[r]=B?function(K,Y,Z){Z!=li&&_(K,Y,Z)}:_)}e.defineOption=n,e.Init=li,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,ka(r)},!0),n("indentUnit",2,ka,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){wi(r),yi(r),qr(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var _=[],B=r.doc.first;r.doc.iter(function(Y){for(var Z=0;;){var le=Y.text.indexOf(i,Z);if(le==-1)break;Z=le+i.length,_.push(Ie(B,le))}B++});for(var K=_.length-1;K>=0;K--)ii(r.doc,i,_[K],Ie(_[K].line,_[K].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,_){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),_!=li&&r.refresh()}),n("specialCharPlaceholder",vr,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",o?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!C),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){xs(r),Ti(r)},!0),n("keyMap","default",function(r,i,_){var B=na(i),K=_!=li&&na(_);K&&K.detach&&K.detach(r,B),B.attach&&B.attach(r,K||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Ql,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=Da(i,r.options.lineNumbers),Ti(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?Ea(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return ei(r)},!0),n("scrollbarStyle","native",function(r){_o(r),ei(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=Da(r.options.gutters,i),Ti(r)},!0),n("firstLineNumber",1,Ti,!0),n("lineNumberFormatter",function(r){return r},Ti,!0),n("showCursorWhenSelecting",!1,bi,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Zn(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Jl),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,bi,!0),n("singleCursorHeightPerLine",!0,bi,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,wi,!0),n("addModeClass",!1,wi,!0),n("pollInterval",100),n("undoDepth",200,function(r,i){return r.doc.history.undoDepth=i}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,wi,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Jl(e,t,n){var r=n&&n!=li;if(!t!=!r){var i=e.display.dragFunctions,_=t?Ae:dt;_(e.display.scroller,"dragstart",i.start),_(e.display.scroller,"dragenter",i.enter),_(e.display.scroller,"dragover",i.over),_(e.display.scroller,"dragleave",i.leave),_(e.display.scroller,"drop",i.drop)}}function Ql(e){e.options.lineWrapping?(H(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(f(e.display.wrapper,"CodeMirror-wrap"),ji(e)),xa(e),qr(e),yi(e),setTimeout(function(){return ei(e)},100)}function Er(e,t){var n=this;if(!(this instanceof Er))return new Er(e,t);this.options=t=t?W(t):{},W(Ss,t,!1);var r=t.value;typeof r=="string"?r=new en(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Er.inputStyles[t.inputStyle](this),_=this.display=new dl(e,r,i,t);_.wrapper.CodeMirror=this,xs(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),_o(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new oe,keySeq:null,specialChars:null},t.autofocus&&!o&&_.input.focus(),z&&j<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),Rl(),Gn(this),this.curOp.forceUpdate=!0,Mo(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Ca(n)},20):Zn(this);for(var B in aa)aa.hasOwnProperty(B)&&aa[B](this,t[B],li);Ao(this),t.finishInit&&t.finishInit(this);for(var K=0;K20*20}Ae(t.scroller,"touchstart",function(Y){if(!We(e,Y)&&!_(Y)&&!Ha(e,Y)){t.input.ensurePolled(),clearTimeout(n);var Z=+new Date;t.activeTouch={start:Z,moved:!1,prev:Z-r.end<=300?r:null},Y.touches.length==1&&(t.activeTouch.left=Y.touches[0].pageX,t.activeTouch.top=Y.touches[0].pageY)}}),Ae(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Ae(t.scroller,"touchend",function(Y){var Z=t.activeTouch;if(Z&&!_n(t,Y)&&Z.left!=null&&!Z.moved&&new Date-Z.start<300){var le=e.coordsChar(t.activeTouch,"page"),he;!Z.prev||B(Z,Z.prev)?he=new dr(le,le):!Z.prev.prev||B(Z,Z.prev.prev)?he=e.findWordAt(le):he=new dr(Ie(le.line,0),u(e.doc,Ie(le.line+1,0))),e.setSelection(he.anchor,he.head),e.focus(),ee(Y)}i()}),Ae(t.scroller,"touchcancel",i),Ae(t.scroller,"scroll",function(){t.scroller.clientHeight&&(xi(e,t.scroller.scrollTop),Hn(e,t.scroller.scrollLeft,!0),De(e,"scroll",e))}),Ae(t.scroller,"mousewheel",function(Y){return Do(e,Y)}),Ae(t.scroller,"DOMMouseScroll",function(Y){return Do(e,Y)}),Ae(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(Y){We(e,Y)||se(Y)},over:function(Y){We(e,Y)||(Ll(e,Y),se(Y))},start:function(Y){return Al(e,Y)},drop:Ur(e,wl),leave:function(Y){We(e,Y)||is(e)}};var K=t.input.getField();Ae(K,"keyup",function(Y){return ms.call(e,Y)}),Ae(K,"keydown",Ur(e,ps)),Ae(K,"keypress",Ur(e,gs)),Ae(K,"focus",function(Y){return Ca(e,Y)}),Ae(K,"blur",function(Y){return Zn(e,Y)})}var za=[];Er.defineInitHook=function(e){return za.push(e)};function Fi(e,t,n,r){var i=e.doc,_;n==null&&(n="add"),n=="smart"&&(i.mode.indent?_=rt(e,t).state:n="prev");var B=e.options.tabSize,K=Fe(i,t),Y=q(K.text,null,B);K.stateAfter&&(K.stateAfter=null);var Z=K.text.match(/^\s*/)[0],le;if(!r&&!/\S/.test(K.text))le=0,n="not";else if(n=="smart"&&(le=i.mode.indent(_,K.text.slice(Z.length),K.text),le==ke||le>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?le=q(Fe(i,t-1).text,null,B):le=0:n=="add"?le=Y+e.options.indentUnit:n=="subtract"?le=Y-e.options.indentUnit:typeof n=="number"&&(le=Y+n),le=Math.max(0,le);var he="",xe=0;if(e.options.indentWithTabs)for(var ye=Math.floor(le/B);ye;--ye)xe+=B,he+=" ";if(xeB,Y=et(t),Z=null;if(K&&r.ranges.length>1)if(gn&&gn.text.join(` `)==t){if(r.ranges.length%gn.text.length==0){Z=[];for(var le=0;le=0;xe--){var ye=r.ranges[xe],Oe=ye.from(),ze=ye.to();ye.empty()&&(n&&n>0?Oe=Ie(Oe.line,Oe.ch-n):e.state.overwrite&&!K?ze=Ie(ze.line,Math.min(Fe(_,ze.line).text.length,ze.ch+we(Y).length)):K&&gn&&gn.lineWise&&gn.text.join(` `)==Y.join(` `)&&(Oe=ze=Ie(Oe.line,0)));var $e={from:Oe,to:ze,text:Z?Z[xe%Z.length]:Y,origin:i||(K?"paste":e.state.cutIncoming>B?"cut":"+input")};ni(e.doc,$e),Hr(e,"inputRead",e,$e)}t&&!K&&_s(e,t),qn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=he),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Cs(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&an(t,function(){return Ga(t,n,0,null,"paste")}),!0}function _s(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)continue;var _=e.getModeAt(i.head),B=!1;if(_.electricChars){for(var K=0;K<_.electricChars.length;K++)if(t.indexOf(_.electricChars.charAt(K))>-1){B=Fi(e,i.head.line,"smart");break}}else _.electricInput&&(_.electricInput.test(Fe(e.doc,i.head.line).text.slice(0,i.head.ch))&&(B=Fi(e,i.head.line,"smart")));B&&Hr(e,"electricInput",e,i.head.line)}}function Ts(e){for(var t=[],n=[],r=0;r_&&(Fi(this,K.head.line,r,!0),_=K.head.line,B==this.doc.sel.primIndex&&qn(this));else{var Y=K.from(),Z=K.to(),le=Math.max(_,Y.line);_=Math.min(this.lastLine(),Z.line-(Z.ch?0:1))+1;for(var he=le;he<_;++he)Fi(this,he,r);var xe=this.doc.sel.ranges;Y.ch==0&&i.length==xe.length&&xe[B].from().ch>0&&Na(this.doc,B,new dr(Y,xe[B].to()),Ee)}}}),getTokenAt:function(r,i){return fr(this,r,i)},getLineTokens:function(r,i){return fr(this,Ie(r),i,!0)},getTokenTypeAt:function(r){r=u(this.doc,r);var i=Ne(this,Fe(this.doc,r.line)),_=0,B=(i.length-1)/2,K=r.ch,Y;if(K==0)Y=i[2];else for(;;){var Z=_+B>>1;if((Z?i[Z*2-1]:0)>=K)B=Z;else if(i[Z*2+1]Y&&(r=Y,B=!0),K=Fe(this.doc,r)}else K=r;return Hi(this,K,{top:0,left:0},i||"page",_||B).top+(B?this.doc.height-fn(K):0)},defaultTextHeight:function(){return Jn(this.display)},defaultCharWidth:function(){return Qn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,_,B,K){var Y=this.display;r=pn(this,u(this.doc,r));var Z=r.bottom,le=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),Y.sizer.appendChild(i),B=="over")Z=r.top;else if(B=="above"||B=="near"){var he=Math.max(Y.wrapper.clientHeight,this.doc.height),xe=Math.max(Y.sizer.clientWidth,Y.lineSpace.clientWidth);(B=="above"||r.bottom+i.offsetHeight>he)&&r.top>i.offsetHeight?Z=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=he&&(Z=r.bottom),le+i.offsetWidth>xe&&(le=xe-i.offsetWidth)}i.style.top=Z+"px",i.style.left=i.style.right="",K=="right"?(le=Y.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(K=="left"?le=0:K=="middle"&&(le=(Y.sizer.clientWidth-i.offsetWidth)/2),i.style.left=le+"px"),_&&Js(this,{left:le,top:Z,right:le+i.offsetWidth,bottom:Z+i.offsetHeight})},triggerOnKeyDown:$r(ps),triggerOnKeyPress:$r(gs),triggerOnKeyUp:ms,triggerOnMouseDown:$r(vs),execCommand:function(r){if(Ii.hasOwnProperty(r))return Ii[r].call(null,this)},triggerElectric:$r(function(r){_s(this,r)}),findPosH:function(r,i,_,B){var K=1;i<0&&(K=-1,i=-i);for(var Y=u(this.doc,r),Z=0;Z0&&le(_.charAt(B-1));)--B;for(;K<_.length&&le(_.charAt(K));)++K}return new dr(Ie(r.line,B),Ie(r.line,K))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?H(this.display.cursorDiv,"CodeMirror-overwrite"):f(this.display.cursorDiv,"CodeMirror-overwrite"),De(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==k()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:$r(function(r,i){Ei(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-bn(this)-this.display.barHeight,width:r.scrollWidth-bn(this)-this.display.barWidth,clientHeight:ha(this),clientWidth:Bn(this)}},scrollIntoView:$r(function(r,i){r==null?(r={from:this.doc.sel.primary().head,to:null},i==null&&(i=this.options.cursorScrollMargin)):typeof r=="number"?r={from:Ie(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=i||0,r.from.line!=null?Qs(this,r):Eo(this,r.from,r.to,r.margin)}),setSize:$r(function(r,i){var _=this,B=function(Y){return typeof Y=="number"||/^\d+$/.test(String(Y))?Y+"px":Y};r!=null&&(this.display.wrapper.style.width=B(r)),i!=null&&(this.display.wrapper.style.height=B(i)),this.options.lineWrapping&&ao(this);var K=this.display.viewFrom;this.doc.iter(K,this.display.viewTo,function(Y){if(Y.widgets){for(var Z=0;Z.5||this.options.lineWrapping)&&xa(this),De(this,"refresh",this)}),swapDoc:$r(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),Mo(this,r),yi(this),this.display.input.reset(),Ei(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Hr(this,"swapDoc",this,i),i}),phrase:function(r){var i=this.options.phrases;return i&&Object.prototype.hasOwnProperty.call(i,r)?i[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},pe(e),e.registerHelper=function(r,i,_){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=_},e.registerGlobalHelper=function(r,i,_,B){e.registerHelper(r,i,B),n[r]._global.push({pred:_,val:B})}}function Ka(e,t,n,r,i){var _=t,B=n,K=Fe(e,t.line),Y=i&&e.direction=="rtl"?-n:n;function Z(){var yt=t.line+Y;return yt=e.first+e.size?!1:(t=new Ie(yt,t.ch,t.sticky),K=Fe(e,yt))}function le(yt){var ut;if(r=="codepoint"){var _t=K.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(_t)?ut=null:ut=new Ie(t.line,Math.max(0,Math.min(K.text.length,t.ch+n*(_t>=55296&&_t<56320?2:1))),-n)}else i?ut=Ml(e.cm,K,t,n):ut=Ba(K,t,n);if(ut==null)if(!yt&&Z())t=Fa(i,e.cm,K,t.line,Y);else return!1;else t=ut;return!0}if(r=="char"||r=="codepoint")le();else if(r=="column")le(!0);else if(r=="word"||r=="group")for(var he=null,xe=r=="group",ye=e.cm&&e.cm.getHelper(t,"wordChars"),Oe=!0;!(n<0&&!le(!Oe));Oe=!1){var ze=K.text.charAt(t.ch)||` `,$e=He(ze,ye)?"w":xe&&ze==` `?"n":!xe||/\s/.test(ze)?null:"p";if(xe&&!Oe&&!$e&&($e="s"),he&&he!=$e){n<0&&(n=1,le(),t.sticky="after");break}if($e&&(he=$e),n>0&&!le(!Oe))break}var lt=ea(e,t,_,B,!0);return Pr(_,lt)&&(lt.hitSide=!0),lt}function Ls(e,t,n,r){var i=e.doc,_=t.left,B;if(r=="page"){var K=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),Y=Math.max(K-.5*Jn(e.display),3);B=(n>0?t.bottom:t.top)+n*Y}else r=="line"&&(B=n>0?t.bottom+3:t.top-3);for(var Z;!(Z=va(e,_,B),!Z.outside);){if(n<0?B<=0:B>=i.height){Z.hitSide=!0;break}B+=n*5}return Z}var mr=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new oe,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};mr.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;ws(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function _(K){for(var Y=K.target;Y;Y=Y.parentNode){if(Y==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(Y.className))break}return!1}Ae(i,"paste",function(K){if(!_(K)||We(r,K)||Cs(K,r))return;j<=11&&setTimeout(Ur(r,function(){return t.updateFromDOM()}),20)}),Ae(i,"compositionstart",function(K){t.composing={data:K.data,done:!1}}),Ae(i,"compositionupdate",function(K){t.composing||(t.composing={data:K.data,done:!1})}),Ae(i,"compositionend",function(K){t.composing&&(K.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Ae(i,"touchstart",function(){return n.forceCompositionEnd()}),Ae(i,"input",function(){t.composing||t.readFromDOMSoon()});function B(K){if(!_(K)||We(r,K))return;if(r.somethingSelected())oa({lineWise:!1,text:r.getSelections()}),K.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var Y=Ts(r);oa({lineWise:!0,text:Y.text}),K.type=="cut"&&r.operation(function(){r.setSelections(Y.ranges,0,Ee),r.replaceSelection("",null,"cut")})}else return;if(K.clipboardData){K.clipboardData.clearData();var Z=gn.text.join(` `);if(K.clipboardData.setData("Text",Z),K.clipboardData.getData("Text")==Z){K.preventDefault();return}}var le=As(),he=le.firstChild;r.display.lineSpace.insertBefore(le,r.display.lineSpace.firstChild),he.value=gn.text.join(` `);var xe=document.activeElement;Q(he),setTimeout(function(){r.display.lineSpace.removeChild(le),xe.focus(),xe==i&&n.showPrimarySelection()},50)}Ae(i,"copy",B),Ae(i,"cut",B)},mr.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},mr.prototype.prepareSelection=function(){var e=mo(this.cm,!1);return e.focus=document.activeElement==this.div,e},mr.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},mr.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},mr.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line=t.display.viewFrom&&Rs(t,r)||{node:K[0].measure.map[2],offset:0},Z=i.linee.firstLine()&&(r=Ie(r.line-1,Fe(e.doc,r.line-1).length)),i.ch==Fe(e.doc,i.line).text.length&&i.linet.viewTo-1)return!1;var _,B,K;r.line==t.viewFrom||(_=Wn(e,r.line))==0?(B=Wt(t.view[0].line),K=t.view[0].node):(B=Wt(t.view[_].line),K=t.view[_-1].node.nextSibling);var Y=Wn(e,i.line),Z,le;if(Y==t.view.length-1?(Z=t.viewTo-1,le=t.lineDiv.lastChild):(Z=Wt(t.view[Y+1].line)-1,le=t.view[Y+1].node.previousSibling),!K)return!1;for(var he=e.doc.splitLines(tu(e,K,le,B,Z)),xe=nr(e.doc,Ie(B,0),Ie(Z,Fe(e.doc,Z).text.length));he.length>1&&xe.length>1;)if(we(he)==we(xe))he.pop(),xe.pop(),Z--;else if(he[0]==xe[0])he.shift(),xe.shift(),B++;else break;for(var ye=0,Oe=0,ze=he[0],$e=xe[0],lt=Math.min(ze.length,$e.length);yer.ch&&yt.charCodeAt(yt.length-Oe-1)==ut.charCodeAt(ut.length-Oe-1);)ye--,Oe++;he[he.length-1]=yt.slice(0,yt.length-Oe).replace(/^\u200b+/,""),he[0]=he[0].slice(ye).replace(/\u200b+$/,"");var Bt=Ie(B,ye),Ot=Ie(Z,xe.length?we(xe).length-Oe:0);if(he.length>1||he[0]||xt(Bt,Ot))return ii(e.doc,he,Bt,Ot,"+input"),!0},mr.prototype.ensurePolled=function(){this.forceCompositionEnd()},mr.prototype.reset=function(){this.forceCompositionEnd()},mr.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},mr.prototype.readFromDOMSoon=function(){var e=this;if(this.readDOMTimeout!=null)return;this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80)},mr.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&an(this.cm,function(){return qr(e.cm)})},mr.prototype.setUneditable=function(e){e.contentEditable="false"},mr.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Ur(this.cm,Ga)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},mr.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},mr.prototype.onContextMenu=function(){},mr.prototype.resetPosition=function(){},mr.prototype.needsContentAttribute=!0;function Rs(e,t){var n=fa(e,t.line);if(!n||n.hidden)return null;var r=Fe(e.doc,t.line),i=eo(n,r,t.line),_=at(r,e.doc.direction),B="left";if(_){var K=nt(_,t.ch);B=K%2?"right":"left"}var Y=no(i.map,t.ch,B);return Y.offset=Y.collapse=="right"?Y.end:Y.start,Y}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function ui(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var _="",B=!1,K=e.doc.lineSeparator(),Y=!1;function Z(ye){return function(Oe){return Oe.id==ye}}function le(){B&&(_+=K,Y&&(_+=K),B=Y=!1)}function he(ye){ye&&(le(),_+=ye)}function xe(ye){if(ye.nodeType==1){var Oe=ye.getAttribute("cm-text");if(Oe){he(Oe);return}var ze=ye.getAttribute("cm-marker"),$e;if(ze){var lt=e.findMarks(Ie(r,0),Ie(i+1,0),Z(+ze));lt.length&&($e=lt[0].find(0))&&he(nr(e.doc,$e.from,$e.to).join(K));return}if(ye.getAttribute("contenteditable")=="false")return;var yt=/^(pre|div|p|li|table|br)$/i.test(ye.nodeName);if(!/^br$/i.test(ye.nodeName)&&ye.textContent.length==0)return;yt&&le();for(var ut=0;ut=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Ae(i,"paste",function(B){if(We(r,B)||Cs(B,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function _(B){if(We(r,B))return;if(r.somethingSelected())oa({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var K=Ts(r);oa({lineWise:!0,text:K.text}),B.type=="cut"?r.setSelections(K.ranges,null,Ee):(n.prevInput="",i.value=K.text.join(` `),Q(i))}else return;B.type=="cut"&&(r.state.cutIncoming=+new Date)}Ae(i,"cut",_),Ae(i,"copy",_),Ae(e.scroller,"paste",function(B){if(_n(e,B)||We(r,B))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var K=new Event("paste");K.clipboardData=B.clipboardData,i.dispatchEvent(K)}),Ae(e.lineSpace,"selectstart",function(B){_n(e,B)||ee(B)}),Ae(i,"compositionstart",function(){var B=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:B,range:r.markText(B,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Ae(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Ar.prototype.createField=function(e){this.wrapper=As(),this.textarea=this.wrapper.firstChild},Ar.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Ar.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=mo(e);if(e.options.moveInputWithCursor){var i=pn(e,n.sel.primary().head,"div"),_=t.wrapper.getBoundingClientRect(),B=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+B.top-_.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+B.left-_.left))}return r},Ar.prototype.showSelection=function(e){var t=this.cm,n=t.display;s(n.cursorDiv,e.cursors),s(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Ar.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&Q(this.textarea),z&&j>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",z&&j>=9&&(this.hasSelection=null))},Ar.prototype.getField=function(){return this.textarea},Ar.prototype.supportsTouch=function(){return!1},Ar.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||k()!=this.textarea))try{this.textarea.focus()}catch(e){}},Ar.prototype.blur=function(){this.textarea.blur()},Ar.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Ar.prototype.receivedFocus=function(){this.slowPoll()},Ar.prototype.slowPoll=function(){var e=this;if(this.pollingFast)return;this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Ar.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},Ar.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||ct(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(z&&j>=9&&this.hasSelection===i||d&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var _=i.charCodeAt(0);if(_==8203&&!r&&(r="\u200B"),_==8666)return this.reset(),this.cm.execCommand("undo")}for(var B=0,K=Math.min(r.length,i.length);B1e3||i.indexOf(` `)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Ar.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Ar.prototype.onKeyPress=function(){z&&j>=9&&(this.hasSelection=null),this.fastPoll()},Ar.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var _=jn(n,e),B=r.scroller.scrollTop;if(!_||L)return;var K=n.options.resetSelectionOnContextMenu;K&&n.doc.sel.contains(_)==-1&&Ur(n,Vr)(n.doc,Pn(_),Ee);var Y=i.style.cssText,Z=t.wrapper.style.cssText,le=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px; top: `+(e.clientY-le.top-5)+"px; left: "+(e.clientX-le.left-5)+`px; z-index: 1000; background: `+(z?"rgba(255, 255, 255, .05)":"transparent")+`; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var he;O&&(he=window.scrollY),r.input.focus(),O&&window.scrollTo(null,he),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=ye,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function xe(){if(i.selectionStart!=null){var ze=n.somethingSelected(),$e="\u200B"+(ze?i.value:"");i.value="\u21DA",i.value=$e,t.prevInput=ze?"":"\u200B",i.selectionStart=1,i.selectionEnd=$e.length,r.selForContextMenu=n.doc.sel}}function ye(){if(t.contextMenuPending!=ye)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=Z,i.style.cssText=Y,z&&j<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=B),i.selectionStart!=null){(!z||z&&j<9)&&xe();var ze=0,$e=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?Ur(n,Xo)(n):ze++<10?r.detectingSelectAll=setTimeout($e,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout($e,200)}}if(z&&j>=9&&xe(),l){se(e);var Oe=function(){dt(window,"mouseup",Oe),setTimeout(ye,20)};Ae(window,"mouseup",Oe)}else setTimeout(ye,50)},Ar.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Ar.prototype.setUneditable=function(){},Ar.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?W(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=k();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=K.getValue()}var i;if(e.form&&(Ae(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var _=e.form;i=_.submit;try{var B=_.submit=function(){r(),_.submit=i,_.submit(),_.submit=B}}catch(Y){}}t.finishInit=function(Y){Y.save=r,Y.getTextArea=function(){return e},Y.toTextArea=function(){Y.toTextArea=isNaN,r(),e.parentNode.removeChild(Y.getWrapperElement()),e.style.display="",e.form&&(dt(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var K=Er(function(Y){return e.parentNode.insertBefore(Y,e.nextSibling)},t);return K}function iu(e){e.off=dt,e.on=Ae,e.wheelEventPixels=cl,e.Doc=en,e.splitLines=et,e.countColumn=q,e.findColumn=Ce,e.isWordChar=Me,e.Pass=ke,e.signal=De,e.Line=Un,e.changeEnd=kn,e.scrollbarModel=Co,e.Pos=Ie,e.cmpPos=xt,e.modes=$t,e.mimeModes=Lt,e.resolveMode=pt,e.getMode=Xt,e.modeExtensions=zt,e.extendMode=Gt,e.copyState=Ut,e.startState=St,e.innerMode=Mt,e.commands=Ii,e.keyMap=Tn,e.keyName=us,e.isModifierKey=ss,e.lookupKey=oi,e.normalizeKeyMap=Ol,e.StringStream=it,e.SharedTextMarker=ki,e.TextMarker=Mn,e.LineWidget=Pi,e.e_preventDefault=ee,e.e_stopPropagation=te,e.e_stop=se,e.addClass=H,e.contains=x,e.rmClass=f,e.keyNames=In}$l(Er),ql(Er);var au="iter insert remove copy getEditor constructor".split(" ");for(var la in en.prototype)en.prototype.hasOwnProperty(la)&&fe(au,la)<0&&(Er.prototype[la]=function(e){return function(){return e.apply(this.doc,arguments)}}(en.prototype[la]));return pe(en),Er.inputStyles={textarea:Ar,contenteditable:mr},Er.defineMode=function(e){!Er.defaults.mode&&e!="null"&&(Er.defaults.mode=e),Qt.apply(this,arguments)},Er.defineMIME=Zt,Er.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Er.defineMIME("text/plain","null"),Er.defineExtension=function(e,t){Er.prototype[e]=t},Er.defineDocExtension=function(e,t){en.prototype[e]=t},Er.fromTextArea=nu,iu(Er),Er.version="5.58.2",Er})},Y1PL:function(At,ft,re){"use strict";re.r(ft),re.d(ft,"ResizableTextArea",function(){return fe});var ae=re("wx14"),$=re("1OyB"),R=re("vuIU"),X=re("Ji7U"),N=re("LK+K"),I=re("q1tI"),z=re("VTBJ"),j=re("rePB"),O=re("Zm9Q"),P=re("Kwbf"),E=re("c+Xe"),L=re("m+aA"),D=re("bdgK"),T=new Map;function A(Ee){Ee.forEach(function(_e){var Te,Ce=_e.target;(Te=T.get(Ce))===null||Te===void 0||Te.forEach(function(me){return me(Ce)})})}var w=new D.default(A),h=null,o=null;function d(Ee,_e){T.has(Ee)||(T.set(Ee,new Set),w.observe(Ee)),T.get(Ee).add(_e)}function c(Ee,_e){T.has(Ee)&&(T.get(Ee).delete(_e),T.get(Ee).size||(w.unobserve(Ee),T.delete(Ee)))}var C=function(Ee){Object(X.a)(Te,Ee);var _e=Object(N.a)(Te);function Te(){return Object($.a)(this,Te),_e.apply(this,arguments)}return Object(R.a)(Te,[{key:"render",value:function(){return this.props.children}}]),Te}(I.Component),y=I.createContext(null);function m(Ee){var _e=Ee.children,Te=Ee.onBatchResize,Ce=I.useRef(0),me=I.useRef([]),ne=I.useContext(y),we=I.useCallback(function(tt,Ye,Xe){Ce.current+=1;var Ve=Ce.current;me.current.push({size:tt,element:Ye,data:Xe}),Promise.resolve().then(function(){Ve===Ce.current&&(Te==null||Te(me.current),me.current=[])}),ne==null||ne(tt,Ye,Xe)},[Te,ne]);return I.createElement(y.Provider,{value:we},_e)}function l(Ee){var _e=Ee.children,Te=Ee.disabled,Ce=I.useRef(null),me=I.useRef(null),ne=I.useContext(y),we=I.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),tt=I.isValidElement(_e)&&Object(E.c)(_e),Ye=tt?_e.ref:null,Xe=I.useMemo(function(){return Object(E.a)(Ye,Ce)},[Ye,Ce]),Ve=I.useRef(Ee);Ve.current=Ee;var Le=I.useCallback(function(Me){var He=Ve.current,Ge=He.onResize,je=He.data,Ue=Me.getBoundingClientRect(),Re=Ue.width,st=Ue.height,Je=Me.offsetWidth,Qe=Me.offsetHeight,nt=Math.floor(Re),bt=Math.floor(st);if(we.current.width!==nt||we.current.height!==bt||we.current.offsetWidth!==Je||we.current.offsetHeight!==Qe){var at={width:nt,height:bt,offsetWidth:Je,offsetHeight:Qe};we.current=at;var ht=Je===Math.round(Re)?Re:Je,Ae=Qe===Math.round(st)?st:Qe,gt=Object(z.a)(Object(z.a)({},at),{},{offsetWidth:ht,offsetHeight:Ae});ne==null||ne(gt,Me,je),Ge&&Promise.resolve().then(function(){Ge(gt,Me)})}},[]);return I.useEffect(function(){var Me=Object(L.a)(Ce.current)||Object(L.a)(me.current);return Me&&!Te&&d(Me,Le),function(){return c(Me,Le)}},[Ce.current,Te]),I.createElement(C,{ref:me},tt?I.cloneElement(_e,{ref:Xe}):_e)}var S="rc-observer-key";function f(Ee){var _e=Ee.children,Te=Object(O.a)(_e);return Te.map(function(Ce,me){var ne=(Ce==null?void 0:Ce.key)||"".concat(S,"-").concat(me);return I.createElement(l,Object(ae.a)({},Ee,{key:ne}),Ce)})}f.Collection=m;var p=f,s=re("bT9E"),a=re("TSYQ"),b=re.n(a),v=` min-height:0 !important; max-height:none !important; height:0 !important; visibility:hidden !important; overflow:hidden !important; position:absolute !important; z-index:-1000 !important; top:0 !important; right:0 !important `,x=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],k={},H;function V(Ee){var _e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Te=Ee.getAttribute("id")||Ee.getAttribute("data-reactid")||Ee.getAttribute("name");if(_e&&k[Te])return k[Te];var Ce=window.getComputedStyle(Ee),me=Ce.getPropertyValue("box-sizing")||Ce.getPropertyValue("-moz-box-sizing")||Ce.getPropertyValue("-webkit-box-sizing"),ne=parseFloat(Ce.getPropertyValue("padding-bottom"))+parseFloat(Ce.getPropertyValue("padding-top")),we=parseFloat(Ce.getPropertyValue("border-bottom-width"))+parseFloat(Ce.getPropertyValue("border-top-width")),tt=x.map(function(Xe){return"".concat(Xe,":").concat(Ce.getPropertyValue(Xe))}).join(";"),Ye={sizingStyle:tt,paddingSize:ne,borderSize:we,boxSizing:me};return _e&&Te&&(k[Te]=Ye),Ye}function Q(Ee){var _e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,Ce=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;H||(H=document.createElement("textarea"),H.setAttribute("tab-index","-1"),H.setAttribute("aria-hidden","true"),document.body.appendChild(H)),Ee.getAttribute("wrap")?H.setAttribute("wrap",Ee.getAttribute("wrap")):H.removeAttribute("wrap");var me=V(Ee,_e),ne=me.paddingSize,we=me.borderSize,tt=me.boxSizing,Ye=me.sizingStyle;H.setAttribute("style","".concat(Ye,";").concat(v)),H.value=Ee.value||Ee.placeholder||"";var Xe=Number.MIN_SAFE_INTEGER,Ve=Number.MAX_SAFE_INTEGER,Le=H.scrollHeight,Me;if(tt==="border-box"?Le+=we:tt==="content-box"&&(Le-=ne),Te!==null||Ce!==null){H.value=" ";var He=H.scrollHeight-ne;Te!==null&&(Xe=He*Te,tt==="border-box"&&(Xe=Xe+ne+we),Le=Math.max(Xe,Le)),Ce!==null&&(Ve=He*Ce,tt==="border-box"&&(Ve=Ve+ne+we),Me=Le>Ve?"":"hidden",Le=Math.min(Ve,Le))}return{height:Le,minHeight:Xe,maxHeight:Ve,overflowY:Me,resize:"none"}}var G=re("Gytx"),W=re.n(G),q;(function(Ee){Ee[Ee.NONE=0]="NONE",Ee[Ee.RESIZING=1]="RESIZING",Ee[Ee.RESIZED=2]="RESIZED"})(q||(q={}));var oe=function(Ee){Object(X.a)(Te,Ee);var _e=Object(N.a)(Te);function Te(Ce){var me;return Object($.a)(this,Te),me=_e.call(this,Ce),me.nextFrameActionId=void 0,me.resizeFrameId=void 0,me.textArea=void 0,me.saveTextArea=function(ne){me.textArea=ne},me.handleResize=function(ne){var we=me.state.resizeStatus,tt=me.props,Ye=tt.autoSize,Xe=tt.onResize;if(we!==q.NONE)return;typeof Xe=="function"&&Xe(ne),Ye&&me.resizeOnNextFrame()},me.resizeOnNextFrame=function(){cancelAnimationFrame(me.nextFrameActionId),me.nextFrameActionId=requestAnimationFrame(me.resizeTextarea)},me.resizeTextarea=function(){var ne=me.props.autoSize;if(!ne||!me.textArea)return;var we=ne.minRows,tt=ne.maxRows,Ye=Q(me.textArea,!1,we,tt);me.setState({textareaStyles:Ye,resizeStatus:q.RESIZING},function(){cancelAnimationFrame(me.resizeFrameId),me.resizeFrameId=requestAnimationFrame(function(){me.setState({resizeStatus:q.RESIZED},function(){me.resizeFrameId=requestAnimationFrame(function(){me.setState({resizeStatus:q.NONE}),me.fixFirefoxAutoScroll()})})})})},me.renderTextArea=function(){var ne=me.props,we=ne.prefixCls,tt=we===void 0?"rc-textarea":we,Ye=ne.autoSize,Xe=ne.onResize,Ve=ne.className,Le=ne.disabled,Me=me.state,He=Me.textareaStyles,Ge=Me.resizeStatus,je=Object(s.a)(me.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ue=b()(tt,Ve,Object(j.a)({},"".concat(tt,"-disabled"),Le));"value"in je&&(je.value=je.value||"");var Re=Object(z.a)(Object(z.a)(Object(z.a)({},me.props.style),He),Ge===q.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return I.createElement(p,{onResize:me.handleResize,disabled:!(Ye||Xe)},I.createElement("textarea",Object(ae.a)({},je,{className:Ue,style:Re,ref:me.saveTextArea})))},me.state={textareaStyles:{},resizeStatus:q.NONE},me}return Object(R.a)(Te,[{key:"componentDidUpdate",value:function(me){(me.value!==this.props.value||!W()(me.autoSize,this.props.autoSize))&&this.resizeTextarea()}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.nextFrameActionId),cancelAnimationFrame(this.resizeFrameId)}},{key:"fixFirefoxAutoScroll",value:function(){try{if(document.activeElement===this.textArea){var me=this.textArea.selectionStart,ne=this.textArea.selectionEnd;this.textArea.setSelectionRange(me,ne)}}catch(we){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Te}(I.Component),fe=oe,ve=function(Ee){Object(X.a)(Te,Ee);var _e=Object(N.a)(Te);function Te(Ce){var me;Object($.a)(this,Te),me=_e.call(this,Ce),me.resizableTextArea=void 0,me.focus=function(){me.resizableTextArea.textArea.focus()},me.saveTextArea=function(we){me.resizableTextArea=we},me.handleChange=function(we){var tt=me.props.onChange;me.setValue(we.target.value,function(){me.resizableTextArea.resizeTextarea()}),tt&&tt(we)},me.handleKeyDown=function(we){var tt=me.props,Ye=tt.onPressEnter,Xe=tt.onKeyDown;we.keyCode===13&&Ye&&Ye(we),Xe&&Xe(we)};var ne=typeof Ce.value=="undefined"||Ce.value===null?Ce.defaultValue:Ce.value;return me.state={value:ne},me}return Object(R.a)(Te,[{key:"setValue",value:function(me,ne){"value"in this.props||this.setState({value:me},ne)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return I.createElement(fe,Object(ae.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(me){return"value"in me?{value:me.value}:null}}]),Te}(I.Component),ke=ft.default=ve},ZWs3:function(At,ft,re){"use strict";re.d(ft,"a",function(){return E});var ae=re("+L6B"),$=re("2/Rp"),R=re("0Owb"),X=re("9og8"),N=re("tJVT"),I=re("PpiC"),z=re("WmNS"),j=re.n(z),O=re("q1tI"),P=re.n(O),E=function(D){var T=D.children,A=Object(I.a)(D,["children"]),w=Object(O.useState)(!1),h=Object(N.a)(w,2),o=h[0],d=h[1];return P.a.createElement($.a,Object(R.a)({},A,{loading:o,onClick:function(){var c=Object(X.a)(j.a.mark(function C(y){return j.a.wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.prev=0,d(!0),l.next=4,A.onClick(y);case 4:d(!1),l.next=10;break;case 7:l.prev=7,l.t0=l.catch(0),d(!1);case 10:case"end":return l.stop()}},C,null,[[0,7]])}));return function(C){return c.apply(this,arguments)}}()}),T)}},ZpRC:function(At,ft,re){"use strict";function ae(E){return typeof E=="object"&&E!=null&&E.nodeType===1}function $(E,L){return(!L||E!=="hidden")&&E!=="visible"&&E!=="clip"}function R(E,L){if(E.clientHeightL||w>E&&h=L&&o>=D?w-E-T:h>L&&oD?h-L+A:0}var N=function(E,L){var D=window,T=L.scrollMode,A=L.block,w=L.inline,h=L.boundary,o=L.skipOverflowHiddenElements,d=typeof h=="function"?h:function(He){return He!==h};if(!ae(E))throw new TypeError("Invalid target");for(var c=document.scrollingElement||document.documentElement,C=[],y=E;ae(y)&&d(y);){if((y=y.parentElement)===c){C.push(y);break}y!=null&&y===document.body&&R(y)&&!R(document.documentElement)||y!=null&&R(y,o)&&C.push(y)}for(var m=D.visualViewport?D.visualViewport.width:innerWidth,l=D.visualViewport?D.visualViewport.height:innerHeight,S=window.scrollX||pageXOffset,f=window.scrollY||pageYOffset,p=E.getBoundingClientRect(),s=p.height,a=p.width,b=p.top,v=p.right,x=p.bottom,k=p.left,H=A==="start"||A==="nearest"?b:A==="end"?x:b+s/2,V=w==="center"?k+a/2:w==="end"?v:k,Q=[],G=0;G=0&&k>=0&&x<=l&&v<=m&&b>=ve&&x<=Ee&&k>=_e&&v<=ke)return Q;var Te=getComputedStyle(W),Ce=parseInt(Te.borderLeftWidth,10),me=parseInt(Te.borderTopWidth,10),ne=parseInt(Te.borderRightWidth,10),we=parseInt(Te.borderBottomWidth,10),tt=0,Ye=0,Xe="offsetWidth"in W?W.offsetWidth-W.clientWidth-Ce-ne:0,Ve="offsetHeight"in W?W.offsetHeight-W.clientHeight-me-we:0;if(c===W)tt=A==="start"?H:A==="end"?H-l:A==="nearest"?X(f,f+l,l,me,we,f+H,f+H+s,s):H-l/2,Ye=w==="start"?V:w==="center"?V-m/2:w==="end"?V-m:X(S,S+m,m,Ce,ne,S+V,S+V+a,a),tt=Math.max(0,tt+f),Ye=Math.max(0,Ye+S);else{tt=A==="start"?H-ve-me:A==="end"?H-Ee+we+Ve:A==="nearest"?X(ve,Ee,oe,me,we+Ve,H,H+s,s):H-(ve+oe/2)+Ve/2,Ye=w==="start"?V-_e-Ce:w==="center"?V-(_e+fe/2)+Xe/2:w==="end"?V-ke+ne+Xe:X(_e,ke,fe,Ce,ne+Xe,V,V+a,a);var Le=W.scrollLeft,Me=W.scrollTop;H+=Me-(tt=Math.max(0,Math.min(Me+tt,W.scrollHeight-oe+Ve))),V+=Le-(Ye=Math.max(0,Math.min(Le+Ye,W.scrollWidth-fe+Xe)))}Q.push({el:W,top:tt,left:Ye})}return Q};function I(E){return E===Object(E)&&Object.keys(E).length!==0}function z(E,L){L===void 0&&(L="auto");var D="scrollBehavior"in document.body.style;E.forEach(function(T){var A=T.el,w=T.top,h=T.left;A.scroll&&D?A.scroll({top:w,left:h,behavior:L}):(A.scrollTop=w,A.scrollLeft=h)})}function j(E){return E===!1?{block:"end",inline:"nearest"}:I(E)?E:{block:"start",inline:"nearest"}}function O(E,L){var D=!E.ownerDocument.documentElement.contains(E);if(I(L)&&typeof L.behavior=="function")return L.behavior(D?[]:N(E,L));if(D)return;var T=j(L);return z(N(E,T),T.behavior)}var P=ft.a=O},bT9E:function(At,ft,re){"use strict";re.d(ft,"a",function(){return $});var ae=re("VTBJ");function $(R,X){var N=Object(ae.a)({},R);return Array.isArray(X)&&X.forEach(function(I){delete N[I]}),N}},c5Ni:function(At,ft,re){},dejd:function(At,ft,re){},dmUQ:function(At,ft,re){"use strict";var ae=re("Ff2n"),$=re("rePB"),R=re("1OyB"),X=re("vuIU"),N=re("Ji7U"),I=re("md7G"),z=re("foSv"),j=re("q1tI"),O=re.n(j),P=re("TSYQ"),E=re.n(P),L=re("4IlW");function D(s,a){var b=Object.keys(s);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(s);a&&(v=v.filter(function(x){return Object.getOwnPropertyDescriptor(s,x).enumerable})),b.push.apply(b,v)}return b}function T(s){for(var a=1;a1?fe-1:0),ke=1;ke1?G-1:0),q=1;q=0)return parseInt(Q.slice(Q.indexOf("e-")+2),10);var G=0;return Q.indexOf(".")>=0&&(G=Q.length-Q.indexOf(".")-1),G},x.getInputDisplayValue=function(V){var Q=V||x.state,G=Q.focused,W=Q.inputValue,q=Q.value,oe;G?oe=W:oe=x.toPrecisionAsStep(q),oe==null&&(oe="");var fe=x.formatWrapper(oe);return m(x.props.decimalSeparator)&&(fe=fe.toString().replace(".",x.props.decimalSeparator)),fe},x.recordCursorPosition=function(){try{x.cursorStart=x.input.selectionStart,x.cursorEnd=x.input.selectionEnd,x.currentValue=x.input.value,x.cursorBefore=x.input.value.substring(0,x.cursorStart),x.cursorAfter=x.input.value.substring(x.cursorEnd)}catch(V){}},x.restoreByAfter=function(V){if(V===void 0)return!1;var Q=x.input.value,G=Q.lastIndexOf(V);if(G===-1)return!1;var W=x.cursorBefore.length;return x.lastKeyCode===L.a.DELETE&&x.cursorBefore.charAt(W-1)===V[0]?(x.fixCaret(W,W),!0):G+V.length===Q.length?(x.fixCaret(G,G),!0):!1},x.partRestoreByAfter=function(V){return V===void 0?!1:Array.prototype.some.call(V,function(Q,G){var W=V.substring(G);return x.restoreByAfter(W)})},x.isNotCompleteNumber=function(V){return isNaN(V)||V===""||V===null||V&&V.toString().indexOf(".")===V.toString().length-1},x.stop=function(){x.autoStepTimer&&clearTimeout(x.autoStepTimer)},x.down=function(V,Q,G){x.pressingUpOrDown=!0,x.step("down",V,Q,G)},x.up=function(V,Q,G){x.pressingUpOrDown=!0,x.step("up",V,Q,G)},x.saveInput=function(V){x.input=V};var k=v.value;k===void 0&&(k=v.defaultValue),x.state={focused:v.autoFocus};var H=x.getValidValue(x.toNumber(k));return x.state=T(T({},x.state),{},{inputValue:x.toPrecisionAsStep(H),value:H}),x}return Object(X.a)(b,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(x){var k=this.props,H=k.value,V=k.onChange,Q=k.max,G=k.min,W=this.state.focused;if(x){if(!l(x.value,H)||!l(x.max,Q)||!l(x.min,G)){var q=W?H:this.getValidValue(H),oe;this.pressingUpOrDown?oe=q:this.inputting?oe=this.rawInput:oe=this.toPrecisionAsStep(q),this.setState({value:q,inputValue:oe})}var fe="value"in this.props?H:this.state.value;"max"in this.props&&x.max!==Q&&typeof fe=="number"&&fe>Q&&V&&V(Q),"min"in this.props&&x.min!==G&&typeof fe=="number"&&fe1&&arguments[1]!==void 0?arguments[1]:this.props.min,H=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,V=parseFloat(x);return isNaN(V)?x:(VH&&(V=H),V)}},{key:"setValue",value:function(x,k){var H=this.props.precision,V=this.isNotCompleteNumber(parseFloat(x))?null:parseFloat(x),Q=this.state.value,G=Q===void 0?null:Q,W=this.state.inputValue,q=W===void 0?null:W,oe=typeof V=="number"?V.toFixed(H):"".concat(V),fe=V!==G||oe!=="".concat(q);return"value"in this.props?(q=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:q},k)):this.setState({value:V,inputValue:this.toPrecisionAsStep(x)},k),fe&&this.props.onChange(V),V}},{key:"getMaxPrecision",value:function(x){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,H=this.props,V=H.precision,Q=H.step;if(m(V))return V;var G=this.getPrecision(k),W=this.getPrecision(Q),q=this.getPrecision(x);return x?Math.max(q,G+W):G+W}},{key:"getPrecisionFactor",value:function(x){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,H=this.getMaxPrecision(x,k);return Math.pow(10,H)}},{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(x){return this.props.formatter?this.props.formatter(x):x}},{key:"toPrecisionAsStep",value:function(x){if(this.isNotCompleteNumber(x)||x==="")return x;var k=Math.abs(this.getMaxPrecision(x));return isNaN(k)?x.toString():Number(x).toFixed(k)}},{key:"toNumber",value:function(x){var k=this.props.precision,H=this.state.focused,V=x&&x.length>16&&H;return this.isNotCompleteNumber(x)||V?x:m(k)?Math.round(x*Math.pow(10,k))/Math.pow(10,k):Number(x)}},{key:"upStep",value:function(x,k){var H=this.props.step,V=this.getPrecisionFactor(x,k),Q=Math.abs(this.getMaxPrecision(x,k)),G=((V*x+V*H*k)/V).toFixed(Q);return this.toNumber(G)}},{key:"downStep",value:function(x,k){var H=this.props.step,V=this.getPrecisionFactor(x,k),Q=Math.abs(this.getMaxPrecision(x,k)),G=((V*x-V*H*k)/V).toFixed(Q);return this.toNumber(G)}},{key:"step",value:function(x,k){var H=this,V=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,Q=arguments.length>3?arguments[3]:void 0;this.stop(),k&&(k.persist(),k.preventDefault());var G=this.props;if(G.disabled)return;var W=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(W))return;var q=this["".concat(x,"Step")](W,V),oe=q>G.max||qG.max?q=G.max:q=ve),We=(bt||bt===0)&&(isNaN(bt)||Number(bt)<=ke),ge=De||V||Q,de=We||V||Q,pe=E()("".concat(H,"-handler"),"".concat(H,"-handler-up"),Object($.a)({},"".concat(H,"-handler-up-disabled"),ge)),ee=E()("".concat(H,"-handler"),"".concat(H,"-handler-down"),Object($.a)({},"".concat(H,"-handler-down-disabled"),de)),te=G?{onTouchStart:ge?h:this.up,onTouchEnd:this.stop}:{onMouseDown:ge?h:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},ie=G?{onTouchStart:de?h:this.down,onTouchEnd:this.stop}:{onMouseDown:de?h:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return O.a.createElement("div",{className:ht,style:Ee,title:_e,onMouseEnter:Te,onMouseLeave:Ce,onMouseOver:me,onMouseOut:ne,onFocus:function(){return null},onBlur:function(){return null}},O.a.createElement("div",{className:"".concat(H,"-handler-wrap")},O.a.createElement("span",Object.assign({unselectable:"on"},te,{role:"button","aria-label":"Increase Value","aria-disabled":ge,className:pe}),q||O.a.createElement("span",{unselectable:"on",className:"".concat(H,"-handler-up-inner"),onClick:o})),O.a.createElement("span",Object.assign({unselectable:"on"},ie,{role:"button","aria-label":"Decrease Value","aria-disabled":de,className:ee}),oe||O.a.createElement("span",{unselectable:"on",className:"".concat(H,"-handler-down-inner"),onClick:o}))),O.a.createElement("div",{className:"".concat(H,"-input-wrap")},O.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":ke,"aria-valuemax":ve,"aria-valuenow":bt,required:we,type:Xe,placeholder:Ve,onPaste:st,onClick:tt,onMouseUp:this.onMouseUp,className:"".concat(H,"-input"),tabIndex:Ye,autoComplete:W,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:gt?this.onKeyDown:h,onKeyUp:gt?this.onKeyUp:h,autoFocus:Ue,maxLength:je,readOnly:Q,disabled:V,max:ve,min:ke,step:Ge,name:Re,title:_e,id:Le,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(dt),pattern:He,inputMode:Me,onInput:Je},Ae))))}}]),b}(O.a.Component);S.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:y,min:-y,step:1,style:{},onChange:h,onKeyDown:h,onPressEnter:h,onFocus:h,onBlur:h,parser:d,required:!1,autoComplete:"off"};var f=S,p=ft.a=f},kSUc:function(At,ft,re){},kqOp:function(At,ft,re){"use strict";re.d(ft,"a",function(){return P});var ae=re("0Owb"),$=re("fWQN"),R=re("mtLc"),X=re("yKVA"),N=re("879j"),I=re("q1tI"),z=re.n(I),j=re("Ot1p"),O="\u2581",P=function(E){Object(X.a)(D,E);var L=Object(N.a)(D);function D(){var T;Object($.a)(this,D);for(var A=arguments.length,w=new Array(A),h=0;h` "'(~:]+/,A=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,w=/^\s*\[[^\]]+?\]:.*$/,h=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,o=" ";function d(G,W,q){return W.f=W.inline=q,q(G,W)}function c(G,W,q){return W.f=W.block=q,q(G,W)}function C(G){return!G||!/\S/.test(G.string)}function y(G){if(G.linkTitle=!1,G.linkHref=!1,G.linkText=!1,G.em=!1,G.strong=!1,G.strikethrough=!1,G.quote=0,G.indentedCode=!1,G.f==l){var W=N;if(!W){var q=ae.innerMode(X,G.htmlState);W=q.mode.name=="xml"&&q.state.tagStart===null&&!q.state.context&&q.state.tokenize.isInText}W&&(G.f=s,G.block=m,G.htmlState=null)}return G.trailingSpace=0,G.trailingSpaceNewLine=!1,G.prevLine=G.thisLine,G.thisLine={stream:null},null}function m(G,W){var q=G.column()===W.indentation,oe=C(W.prevLine.stream),fe=W.indentedCode,ve=W.prevLine.hr,ke=W.list!==!1,Ee=(W.listStack[W.listStack.length-1]||0)+3;W.indentedCode=!1;var _e=W.indentation;if(W.indentationDiff===null&&(W.indentationDiff=W.indentation,ke)){for(W.list=null;_e=4&&(fe||W.prevLine.fencedCodeEnd||W.prevLine.header||oe))return G.skipToEnd(),W.indentedCode=!0,z.code;if(G.eatSpace())return null;if(q&&W.indentation<=Ee&&(me=G.match(L))&&me[1].length<=6)return W.quote=0,W.header=me[1].length,W.thisLine.header=!0,R.highlightFormatting&&(W.formatting="header"),W.f=W.inline,f(W);if(W.indentation<=Ee&&G.eat(">"))return W.quote=q?1:W.quote+1,R.highlightFormatting&&(W.formatting="quote"),G.eatSpace(),f(W);if(!Ce&&!W.setext&&q&&W.indentation<=Ee&&(me=G.match(P))){var ne=me[1]?"ol":"ul";return W.indentation=_e+G.current().length,W.list=!0,W.quote=0,W.listStack.push(W.indentation),W.em=!1,W.strong=!1,W.code=!1,W.strikethrough=!1,R.taskLists&&G.match(E,!1)&&(W.taskList=!0),W.f=W.inline,R.highlightFormatting&&(W.formatting=["list","list-"+ne]),f(W)}else{if(q&&W.indentation<=Ee&&(me=G.match(A,!0)))return W.quote=0,W.fencedEndRE=new RegExp(me[1]+"+ *$"),W.localMode=R.fencedCodeBlockHighlighting&&I(me[2]||R.fencedCodeBlockDefaultMode),W.localMode&&(W.localState=ae.startState(W.localMode)),W.f=W.block=S,R.highlightFormatting&&(W.formatting="code-block"),W.code=-1,f(W);if(W.setext||(!Te||!ke)&&!W.quote&&W.list===!1&&!W.code&&!Ce&&!w.test(G.string)&&(me=G.lookAhead(1))&&(me=me.match(D)))return W.setext?(W.header=W.setext,W.setext=0,G.skipToEnd(),R.highlightFormatting&&(W.formatting="header")):(W.header=me[0].charAt(0)=="="?1:2,W.setext=W.header),W.thisLine.header=!0,W.f=W.inline,f(W);if(Ce)return G.skipToEnd(),W.hr=!0,W.thisLine.hr=!0,z.hr;if(G.peek()==="[")return d(G,W,k)}return d(G,W,W.inline)}function l(G,W){var q=X.token(G,W.htmlState);if(!N){var oe=ae.innerMode(X,W.htmlState);(oe.mode.name=="xml"&&oe.state.tagStart===null&&!oe.state.context&&oe.state.tokenize.isInText||W.md_inside&&G.current().indexOf(">")>-1)&&(W.f=s,W.block=m,W.htmlState=null)}return q}function S(G,W){var q=W.listStack[W.listStack.length-1]||0,oe=W.indentation=G.quote?W.push(z.formatting+"-"+G.formatting[q]+"-"+G.quote):W.push("error"))}if(G.taskOpen)return W.push("meta"),W.length?W.join(" "):null;if(G.taskClosed)return W.push("property"),W.length?W.join(" "):null;if(G.linkHref?W.push(z.linkHref,"url"):(G.strong&&W.push(z.strong),G.em&&W.push(z.em),G.strikethrough&&W.push(z.strikethrough),G.emoji&&W.push(z.emoji),G.linkText&&W.push(z.linkText),G.code&&W.push(z.code),G.image&&W.push(z.image),G.imageAltText&&W.push(z.imageAltText,"link"),G.imageMarker&&W.push(z.imageMarker)),G.header&&W.push(z.header,z.header+"-"+G.header),G.quote&&(W.push(z.quote),!R.maxBlockquoteDepth||R.maxBlockquoteDepth>=G.quote?W.push(z.quote+"-"+G.quote):W.push(z.quote+"-"+R.maxBlockquoteDepth)),G.list!==!1){var oe=(G.listStack.length-1)%3;oe?oe===1?W.push(z.list2):W.push(z.list3):W.push(z.list1)}return G.trailingSpaceNewLine?W.push("trailing-space-new-line"):G.trailingSpace&&W.push("trailing-space-"+(G.trailingSpace%2?"a":"b")),W.length?W.join(" "):null}function p(G,W){return G.match(T,!0)?f(W):void 0}function s(G,W){var q=W.text(G,W);if(typeof q!="undefined")return q;if(W.list)return W.list=null,f(W);if(W.taskList){var oe=G.match(E,!0)[1]===" ";return oe?W.taskOpen=!0:W.taskClosed=!0,R.highlightFormatting&&(W.formatting="task"),W.taskList=!1,f(W)}if(W.taskOpen=!1,W.taskClosed=!1,W.header&&G.match(/^#+$/,!0))return R.highlightFormatting&&(W.formatting="header"),f(W);var fe=G.next();if(W.linkTitle){W.linkTitle=!1;var ve=fe;fe==="("&&(ve=")"),ve=(ve+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var ke="^\\s*(?:[^"+ve+"\\\\]+|\\\\\\\\|\\\\.)"+ve;if(G.match(new RegExp(ke),!0))return z.linkHref}if(fe==="`"){var Ee=W.formatting;R.highlightFormatting&&(W.formatting="code"),G.eatWhile("`");var _e=G.current().length;if(W.code==0&&(!W.quote||_e==1))return W.code=_e,f(W);if(_e==W.code){var Te=f(W);return W.code=0,Te}else return W.formatting=Ee,f(W)}else if(W.code)return f(W);if(fe==="\\"&&(G.next(),R.highlightFormatting)){var Ce=f(W),me=z.formatting+"-escape";return Ce?Ce+" "+me:me}if(fe==="!"&&G.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return W.imageMarker=!0,W.image=!0,R.highlightFormatting&&(W.formatting="image"),f(W);if(fe==="["&&W.imageMarker&&G.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return W.imageMarker=!1,W.imageAltText=!0,R.highlightFormatting&&(W.formatting="image"),f(W);if(fe==="]"&&W.imageAltText){R.highlightFormatting&&(W.formatting="image");var Ce=f(W);return W.imageAltText=!1,W.image=!1,W.inline=W.f=b,Ce}if(fe==="["&&!W.image)return W.linkText&&G.match(/^.*?\]/)||(W.linkText=!0,R.highlightFormatting&&(W.formatting="link")),f(W);if(fe==="]"&&W.linkText){R.highlightFormatting&&(W.formatting="link");var Ce=f(W);return W.linkText=!1,W.inline=W.f=G.match(/\(.*?\)| ?\[.*?\]/,!1)?b:s,Ce}if(fe==="<"&&G.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){W.f=W.inline=a,R.highlightFormatting&&(W.formatting="link");var Ce=f(W);return Ce?Ce+=" ":Ce="",Ce+z.linkInline}if(fe==="<"&&G.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){W.f=W.inline=a,R.highlightFormatting&&(W.formatting="link");var Ce=f(W);return Ce?Ce+=" ":Ce="",Ce+z.linkEmail}if(R.xml&&fe==="<"&&G.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var ne=G.string.indexOf(">",G.pos);if(ne!=-1){var we=G.string.substring(G.start,ne);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(we)&&(W.md_inside=!0)}return G.backUp(1),W.htmlState=ae.startState(X),c(G,W,l)}if(R.xml&&fe==="<"&&G.match(/^\/\w*?>/))return W.md_inside=!1,"tag";if(fe==="*"||fe==="_"){for(var tt=1,Ye=G.pos==1?" ":G.string.charAt(G.pos-2);tt<3&&G.eat(fe);)tt++;var Xe=G.peek()||" ",Ve=!/\s/.test(Xe)&&(!h.test(Xe)||/\s/.test(Ye)||h.test(Ye)),Le=!/\s/.test(Ye)&&(!h.test(Ye)||/\s/.test(Xe)||h.test(Xe)),Me=null,He=null;if(tt%2&&(!W.em&&Ve&&(fe==="*"||!Le||h.test(Ye))?Me=!0:W.em==fe&&Le&&(fe==="*"||!Ve||h.test(Xe))&&(Me=!1)),tt>1&&(!W.strong&&Ve&&(fe==="*"||!Le||h.test(Ye))?He=!0:W.strong==fe&&Le&&(fe==="*"||!Ve||h.test(Xe))&&(He=!1)),He!=null||Me!=null){R.highlightFormatting&&(W.formatting=Me==null?"strong":He==null?"em":"strong em"),Me===!0&&(W.em=fe),He===!0&&(W.strong=fe);var Te=f(W);return Me===!1&&(W.em=!1),He===!1&&(W.strong=!1),Te}}else if(fe===" "&&(G.eat("*")||G.eat("_"))){if(G.peek()===" ")return f(W);G.backUp(1)}if(R.strikethrough){if(fe==="~"&&G.eatWhile(fe)){if(W.strikethrough){R.highlightFormatting&&(W.formatting="strikethrough");var Te=f(W);return W.strikethrough=!1,Te}else if(G.match(/^[^\s]/,!1))return W.strikethrough=!0,R.highlightFormatting&&(W.formatting="strikethrough"),f(W)}else if(fe===" "&&G.match(/^~~/,!0)){if(G.peek()===" ")return f(W);G.backUp(2)}}if(R.emoji&&fe===":"&&G.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){W.emoji=!0,R.highlightFormatting&&(W.formatting="emoji");var Ge=f(W);return W.emoji=!1,Ge}return fe===" "&&(G.match(/^ +$/,!1)?W.trailingSpace++:W.trailingSpace&&(W.trailingSpaceNewLine=!0)),f(W)}function a(G,W){var q=G.next();if(q===">"){W.f=W.inline=s,R.highlightFormatting&&(W.formatting="link");var oe=f(W);return oe?oe+=" ":oe="",oe+z.linkInline}return G.match(/^[^>]+/,!0),z.linkInline}function b(G,W){if(G.eatSpace())return null;var q=G.next();return q==="("||q==="["?(W.f=W.inline=x(q==="("?")":"]"),R.highlightFormatting&&(W.formatting="link-string"),W.linkHref=!0,f(W)):"error"}var v={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function x(G){return function(W,q){var oe=W.next();if(oe===G){q.f=q.inline=s,R.highlightFormatting&&(q.formatting="link-string");var fe=f(q);return q.linkHref=!1,fe}return W.match(v[G]),q.linkHref=!0,f(q)}}function k(G,W){return G.match(/^([^\]\\]|\\.)*\]:/,!1)?(W.f=H,G.next(),R.highlightFormatting&&(W.formatting="link"),W.linkText=!0,f(W)):d(G,W,s)}function H(G,W){if(G.match(/^\]:/,!0)){W.f=W.inline=V,R.highlightFormatting&&(W.formatting="link");var q=f(W);return W.linkText=!1,q}return G.match(/^([^\]\\]|\\.)+/,!0),z.linkText}function V(G,W){return G.eatSpace()?null:(G.match(/^[^\s]+/,!0),G.peek()===void 0?W.linkTitle=!0:G.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),W.f=W.inline=s,z.linkHref+" url")}var Q={startState:function(){return{f:m,prevLine:{stream:null},thisLine:{stream:null},block:m,htmlState:null,indentation:0,inline:s,text:p,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(G){return{f:G.f,prevLine:G.prevLine,thisLine:G.thisLine,block:G.block,htmlState:G.htmlState&&ae.copyState(X,G.htmlState),indentation:G.indentation,localMode:G.localMode,localState:G.localMode?ae.copyState(G.localMode,G.localState):null,inline:G.inline,text:G.text,formatting:!1,linkText:G.linkText,linkTitle:G.linkTitle,linkHref:G.linkHref,code:G.code,em:G.em,strong:G.strong,strikethrough:G.strikethrough,emoji:G.emoji,header:G.header,setext:G.setext,hr:G.hr,taskList:G.taskList,list:G.list,listStack:G.listStack.slice(0),quote:G.quote,indentedCode:G.indentedCode,trailingSpace:G.trailingSpace,trailingSpaceNewLine:G.trailingSpaceNewLine,md_inside:G.md_inside,fencedEndRE:G.fencedEndRE}},token:function(G,W){if(W.formatting=!1,G!=W.thisLine.stream){if(W.header=0,W.hr=!1,G.match(/^\s*$/,!0))return y(W),null;if(W.prevLine=W.thisLine,W.thisLine={stream:G},W.taskList=!1,W.trailingSpace=0,W.trailingSpaceNewLine=!1,!W.localState&&(W.f=W.block,W.f!=l)){var q=G.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(W.indentation=q,W.indentationDiff=null,q>0)return null}}return W.f(G,W)},innerMode:function(G){return G.block==l?{state:G.htmlState,mode:X}:G.localState?{state:G.localState,mode:G.localMode}:{state:G,mode:Q}},indent:function(G,W,q){return G.block==l&&X.indent?X.indent(G.htmlState,W,q):G.localState&&G.localMode.indent?G.localMode.indent(G.localState,W,q):ae.Pass},blankLine:y,getType:f,blockCommentStart:"",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return Q},"xml"),ae.defineMIME("text/markdown","markdown"),ae.defineMIME("text/x-markdown","markdown")})},osHv:function(At,ft,re){(function(ae){ae(re("VrN/"))})(function(ae){"use strict";var $=ae.Pos;function R(h,o){return h.line-o.line||h.ch-o.ch}var X="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",N=X+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",I=new RegExp("<(/?)(["+X+"]["+N+"]*)","g");function z(h,o,d,c){this.line=o,this.ch=d,this.cm=h,this.text=h.getLine(o),this.min=c?Math.max(c.from,h.firstLine()):h.firstLine(),this.max=c?Math.min(c.to-1,h.lastLine()):h.lastLine()}function j(h,o){var d=h.cm.getTokenTypeAt($(h.line,o));return d&&/\btag\b/.test(d)}function O(h){return h.line>=h.max?void 0:(h.ch=0,h.text=h.cm.getLine(++h.line),!0)}function P(h){return h.line<=h.min?void 0:(h.text=h.cm.getLine(--h.line),h.ch=h.text.length,!0)}function E(h){for(;;){var o=h.text.indexOf(">",h.ch);if(o==-1){if(O(h))continue;return}if(!j(h,o+1)){h.ch=o+1;continue}var d=h.text.lastIndexOf("/",o),c=d>-1&&!/\S/.test(h.text.slice(d+1,o));return h.ch=o+1,c?"selfClose":"regular"}}function L(h){for(;;){var o=h.ch?h.text.lastIndexOf("<",h.ch-1):-1;if(o==-1){if(P(h))continue;return}if(!j(h,o+1)){h.ch=o;continue}I.lastIndex=o,h.ch=o;var d=I.exec(h.text);if(d&&d.index==o)return d}}function D(h){for(;;){I.lastIndex=h.ch;var o=I.exec(h.text);if(!o){if(O(h))continue;return}if(!j(h,o.index+1)){h.ch=o.index+1;continue}return h.ch=o.index+o[0].length,o}}function T(h){for(;;){var o=h.ch?h.text.lastIndexOf(">",h.ch-1):-1;if(o==-1){if(P(h))continue;return}if(!j(h,o+1)){h.ch=o;continue}var d=h.text.lastIndexOf("/",o),c=d>-1&&!/\S/.test(h.text.slice(d+1,o));return h.ch=o+1,c?"selfClose":"regular"}}function A(h,o){for(var d=[];;){var c=D(h),C,y=h.line,m=h.ch-(c?c[0].length:0);if(!c||!(C=E(h)))return;if(C=="selfClose")continue;if(c[1]){for(var l=d.length-1;l>=0;--l)if(d[l]==c[2]){d.length=l;break}if(l<0&&(!o||o==c[2]))return{tag:c[2],from:$(y,m),to:$(h.line,h.ch)}}else d.push(c[2])}}function w(h,o){for(var d=[];;){var c=T(h);if(!c)return;if(c=="selfClose"){L(h);continue}var C=h.line,y=h.ch,m=L(h);if(!m)return;if(m[1])d.push(m[2]);else{for(var l=d.length-1;l>=0;--l)if(d[l]==m[2]){d.length=l;break}if(l<0&&(!o||o==m[2]))return{tag:m[2],from:$(h.line,h.ch),to:$(C,y)}}}}ae.registerHelper("fold","xml",function(h,o){for(var d=new z(h,o.line,0);;){var c=D(d);if(!c||d.line!=o.line)return;var C=E(d);if(!C)return;if(!c[1]&&C!="selfClose"){var y=$(d.line,d.ch),m=A(d,c[2]);return m&&R(m.from,y)>0?{from:y,to:m.from}:null}}}),ae.findMatchingTag=function(h,o,d){var c=new z(h,o.line,o.ch,d);if(c.text.indexOf(">")==-1&&c.text.indexOf("<")==-1)return;var C=E(c),y=C&&$(c.line,c.ch),m=C&&L(c);if(!C||!m||R(c,o)>0)return;var l={from:$(c.line,c.ch),to:y,tag:m[2]};return C=="selfClose"?{open:l,close:null,at:"open"}:m[1]?{open:w(c,m[2]),close:l,at:"close"}:(c=new z(h,y.line,y.ch,d),{open:l,close:A(c,m[2]),at:"open"})},ae.findEnclosingTag=function(h,o,d,c){for(var C=new z(h,o.line,o.ch,d);;){var y=w(C,c);if(!y)break;var m=new z(h,o.line,o.ch,d),l=A(m,y.tag);if(l)return{open:y,close:l}}},ae.scanForClosingTag=function(h,o,d,c){var C=new z(h,o.line,o.ch,c?{from:0,to:c}:null);return A(C,d)}})},p5ED:function(At,ft,re){"use strict";var ae=re("+L6B"),$=re("2/Rp"),R=re("5Dmo"),X=re("3S7+"),N=re("k1fw"),I=re("9og8"),z=re("tJVT"),j=re("WmNS"),O=re.n(j),P=re("q1tI"),E=re.n(P),L=re("vHTk"),D=re.n(L),T=re("yEEn"),A=re("ZW9T"),w=re("1vsH"),h=re("V0Rq"),o=re("m3rI");ft.a=function(d){var c,C,y,m,l,S,f,p=d.editOffice,s=p===void 0?"view":p,a=d.data,b=d.theme,v=d.type,x=d.filename,k=d.monacoEditor,H=d.className,V=d.style,Q=d.close,G=d.onClose,W=d.hasMask,q=d.disabledDownload,oe=Object(P.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),fe=Object(z.a)(oe,2),ve=fe[0],ke=fe[1],Ee=Object(P.useState)(""),_e=Object(z.a)(Ee,2),Te=_e[0],Ce=_e[1],me=Object(P.useState)(),ne=Object(z.a)(me,2),we=ne[0],tt=ne[1],Ye=window.ENV==="build"?"/react/build":"",Xe=o.a.PROXY_SERVER||location.origin,Ve,Le=1024*1024,Me=10*Le,He=Object(P.useRef)();(c=a)!==null&&c!==void 0&&c.startsWith("/api")&&v!=="txt"&&(a=o.a.API_SERVER+a),v==="office"&&(Ve=Object(w.T)(a).filesize,Ve>Me&&(v="other")),x&&k&&(k.filename=x),Object(P.useEffect)(function(){var Re,st,Je=(Re=document.cookie)===null||Re===void 0||((st=Re.replace(/\s/g,""))===null||st===void 0)?void 0:st.split(";");Je==null||Je.map(function(Qe){var nt=Qe.split("=");nt[0]==="_educoder_session"&&Ce(nt[1])})},[]),Object(P.useEffect)(function(){v==="office"&&Ge()},[v,a]);var Ge=function(){var Re=Object(I.a)(O.a.mark(function st(){var Je,Qe,nt;return O.a.wrap(function(at){for(;;)switch(at.prev=at.next){case 0:return console.log("data:",a),Je=a,a.startsWith("http")||(Je=location.origin+Je),Qe=new URL(Je).pathname.split("/").pop(),at.next=6,Object(h.W)({attachment_id:Qe});case 6:nt=at.sent,tt(nt);case 8:case"end":return at.stop()}},st)}));return function(){return Re.apply(this,arguments)}}(),je=function(){if(a.startsWith("http")||a.startsWith("blob:")){Ue();return}Object(w.z)(x||"educoder",a,x)},Ue=function(){Object(w.x)(x||"educoder",decodeURIComponent(a))};return E.a.createElement("div",{style:Object(N.a)({},V||{}),className:"".concat(W&&D.a.bgBlack," ").concat(v?D.a.wrp:"hide")},Q&&E.a.createElement("div",{className:D.a.close,ref:He},!q&&E.a.createElement(X.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return He.current}},E.a.createElement("span",{onClick:Ue},E.a.createElement("i",{className:"icon-quxiaozhiding"}))),E.a.createElement(X.a,{title:"\u5173\u95ED",getPopupContainer:function(){return He.current}},E.a.createElement("span",{className:"",onClick:G},E.a.createElement("i",{className:"icon-guanbi1"})))),E.a.createElement("div",{className:"".concat(D.a[H]," ").concat(H," ").concat(D.a.monaco," ").concat(v==="txt"?"show":"hide")},v==="txt"&&E.a.createElement(A.b,k)),v==="audio"&&E.a.createElement("audio",{src:"".concat(((C=a)===null||C===void 0?void 0:C.indexOf("http://"))>-1||((y=a)===null||y===void 0?void 0:y.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(a),autoPlay:!0}),v==="video"&&E.a.createElement(E.a.Fragment,null,((m=a)===null||m===void 0?void 0:m.indexOf("http"))>-1?E.a.createElement("video",{controls:!0,src:"".concat(a),autoPlay:!0}):E.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(a),autoPlay:!0})),v==="office"&&we&&E.a.createElement("iframe",{src:"".concat(Ye,"/office.html?key=").concat(we.key,"&url=").concat(Xe+we.url,"&callbackUrl=").concat(Xe+we.callbackUrl,"&fileType=").concat(we.fileType,"&title=").concat(we.title,"&model=").concat(s,"&officeServer=").concat(o.a.OFFICE_SERVER,"&disabledDownload=").concat(!!q)}),v==="html"&&E.a.createElement("iframe",{src:a+"&disposition=inline"}),v==="pdf"&&E.a.createElement("iframe",{src:"".concat(Ye,"/js/pdfview/index.html?url=").concat(a,"&disabledDownload=").concat(!!q)}),v==="image"&&E.a.createElement("img",{src:"".concat(((l=a)===null||l===void 0?void 0:l.indexOf("http://"))>-1||((S=a)===null||S===void 0?void 0:S.indexOf("https://"))>-1||(f=a)!==null&&f!==void 0&&f.startsWith("/api")?"":"data:image/png;base64,").concat(a)}),v==="other"&&E.a.createElement("div",null,E.a.createElement($.a,{type:"primary",size:"large",onClick:je},E.a.createElement(T.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),v==="download"&&E.a.createElement($.a,{type:"primary",size:"large",onClick:je},E.a.createElement(T.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(At,ft,re){},rUJ1:function(At,ft){const re=/[&<>"']/,ae=/[&<>"']/g,$=/[<>"']|&(?!#?\w+;)/,R=/[<>"']|&(?!#?\w+;)/g,X={"&":"&","<":"<",">":">",'"':""","'":"'"},N=S=>X[S];function I(S,f){if(f){if(re.test(S))return S.replace(ae,N)}else if($.test(S))return S.replace(R,N);return S}const z=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function j(S){return S.replace(z,(f,p)=>(p=p.toLowerCase(),p==="colon"?":":p.charAt(0)==="#"?p.charAt(1)==="x"?String.fromCharCode(parseInt(p.substring(2),16)):String.fromCharCode(+p.substring(1)):""))}const O=/(^|[^\[])\^/g;function P(S,f){S=S.source||S,f=f||"";const p={replace:(s,a)=>(a=a.source||a,a=a.replace(O,"$1"),S=S.replace(s,a),p),getRegex:()=>new RegExp(S,f)};return p}const E=/[^\w:]/g,L=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function D(S,f,p){if(S){let s;try{s=decodeURIComponent(j(p)).replace(E,"").toLowerCase()}catch(a){return null}if(s.indexOf("javascript:")===0||s.indexOf("vbscript:")===0||s.indexOf("data:")===0)return null}f&&!L.test(p)&&(p=o(f,p));try{p=encodeURI(p).replace(/%25/g,"%")}catch(s){return null}return p}const T={},A=/^[^:]+:\/*[^/]*$/,w=/^([^:]+:)[\s\S]*$/,h=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(S,f){T[" "+S]||(A.test(S)?T[" "+S]=S+"/":T[" "+S]=y(S,"/",!0)),S=T[" "+S];const p=S.indexOf(":")===-1;return f.substring(0,2)==="//"?p?f:S.replace(w,"$1")+f:f.charAt(0)==="/"?p?f:S.replace(h,"$1")+f:S+f}const d={exec:function(){}};function c(S){let f=1,p,s;for(;f{let k=!1,H=v;for(;--H>=0&&x[H]==="\\";)k=!k;return k?"|":" |"}),s=p.split(/ \|/);let a=0;if(s.length>f)s.splice(f);else for(;s.length0&&je[0]!==void 0?je[0]:0,console.log(Ce),Re.next=4,Object(A.a)("/api/exercises/".concat(Ce.categoryId,"/preview_random_exercise.json"),{method:"get",params:{num:He}});case 4:Ge=Re.sent,W(!1),Te(we(Ge));case 7:case"end":return Re.stop()}},Me)}));return function(){return Le.apply(this,arguments)}}(),we=function(Me){var He={1:"\u4E00",2:"\u4E8C",3:"\u4E09",4:"\u56DB",5:"\u4E94",6:"\u516D",7:"\u4E03"};if(!Me)return;var Ge=Me||{},je=Ge.exam,Ue=Ge.single_questions,Re=Ge.multiple_questions,st=Ge.judgement_questions,Je=Ge.program_questions,Qe=Ge.completion_questions,nt=Ge.subjective_questions,bt=Ge.practical_questions,at=Ge.combination_questions,ht=[Object(R.a)({type:"SINGLE",name:"\u5355\u9009\u9898"},Ue),Object(R.a)({type:"MULTIPLE",name:"\u591A\u9009\u9898"},Re),Object(R.a)({type:"COMPLETION",name:"\u586B\u7A7A\u9898"},Qe),Object(R.a)({type:"JUDGMENT",name:"\u5224\u65AD\u9898"},st),Object(R.a)({type:"SUBJECTIVE",name:"\u7B80\u7B54\u9898"},nt),Object(R.a)({type:"PROGRAM",name:"\u7F16\u7A0B\u9898"},Je),Object(R.a)({type:"PRACTICAL",name:"\u5B9E\u8BAD\u9898"},bt),Object(R.a)({type:"COMBINATION",name:"\u7EC4\u5408\u9898"},at)],Ae=[],gt=0,dt=0,De=ht.filter(function(We){return We.questions_count>0}).map(function(We,ge){var de;return(de=We.questions)===null||de===void 0||de.forEach(function(pe){Ae.push(pe.id),gt=gt+pe.score,dt=dt+1}),Object(R.a)(Object(R.a)({},We),{number:He[ge+1]})});return{all_questions_count:dt,all_score:gt,questionList:De,ids:Ae,exam:je}},tt=function(){E.d.push("/classrooms/".concat(Ce.coursesId,"/exercise"))},Ye=function(){alert("\u4FDD\u5B58")},Xe=function(){var Le=Object(X.a)(z.a.mark(function Me(He,Ge){var je,Ue,Re;return z.a.wrap(function(Je){for(;;)switch(Je.prev=Je.next){case 0:return Je.next=2,Object(A.a)("/api/exercises/".concat(Ce.categoryId,"/toggle_random_question.json"),{method:"post",body:{question_id:He==null?void 0:He.single_question_id}});case 2:je=Je.sent,je!=null&&je.question&&(Re=Object(w.cloneDeep)(_e),Re.questionList=Re==null||((Ue=Re.questionList)===null||Ue===void 0)?void 0:Ue.map(function(Qe){if(Qe.type===Ge.type){var nt=Object(w.cloneDeep)(Qe==null?void 0:Qe.questions);return nt.splice(Ge.index,1,je==null?void 0:je.question),Object(R.a)(Object(R.a)({},Qe),{},{questions:nt})}return Qe}),Te(Re));case 4:case"end":return Je.stop()}},Me)}));return function(He,Ge){return Le.apply(this,arguments)}}(),Ve=function(){var Le=Object(X.a)(z.a.mark(function Me(He){return z.a.wrap(function(je){for(;;)switch(je.prev=je.next){case 0:document.body.scrollIntoView(),ne(He),ve(He);case 3:case"end":return je.stop()}},Me)}));return function(He){return Le.apply(this,arguments)}}();return console.log(Object(P.h)(),"location333"),O.a.createElement("section",{className:D.a.wrap},O.a.createElement($.a,{loading:G,active:!0,paragraph:{rows:5}},((y=Object(P.h)())===null||y===void 0||((m=y.pathname)===null||m===void 0)?void 0:m.includes("preview"))&&O.a.createElement("div",{className:D.a.crumbs},O.a.createElement("b",null),O.a.createElement("span",{className:"current",onClick:function(){return E.d.push("/classrooms/".concat(Ce.coursesId,"/exercise"))}},"".concat(me==null||((l=me.course)===null||l===void 0)?void 0:l.course_name,">")),O.a.createElement("span",{className:"current",onClick:function(){return E.d.push("/classrooms/".concat(Ce.coursesId,"/exercise"))}},"\u8BD5\u5377\u5217\u8868>"),O.a.createElement("span",{style:{color:"#bebebe"}},"\u9884\u89C8")),O.a.createElement(T.a,{loading:k,submit:Ye,goBack:tt,data:_e,selectValue:fe,editPreview:!0,onExchange:Xe,onSkipExamination:Ve})))};ft.default=Object(E.a)(function(d){var c=d.paperlibrary,C=d.user,y=d.globalSetting;return{paperlibrary:c,user:C,globalSetting:y}})(o)},sbIO:function(At,ft,re){"use strict";var ae=re("DjyN"),$=re("NUBc"),R=re("5Dmo"),X=re("3S7+"),N=re("/zsF"),I=re("PArb"),z=re("Q9mQ"),j=re("diRs"),O=re("+L6B"),P=re("2/Rp"),E=re("5NDa"),L=re("5rEg"),D=re("miYZ"),T=re("tsqr"),A=re("9og8"),w=re("giR+"),h=re("fyUT"),o=re("2qtc"),d=re("kLXV"),c=re("tJVT"),C=re("WmNS"),y=re.n(C),m=re("q1tI"),l=re.n(m),S=re("PsQE"),f=re.n(S),p=re("0eGx"),s=re.n(p),a=re("9Bee"),b=re("Ty5D"),v=re("9kvl"),x=re("ErOA"),k=re("+yhJ"),H=re.n(k),V=re("RZ/O"),Q=re.n(V),G=re("LvDl"),W=re("6K3P"),q=re.n(W),oe=re("sRBo"),fe=re("kaz8"),ve=re("oBTY"),ke=re("PpiC"),Ee=re("Ot1p"),_e=re("kqOp"),Te=re("7qnI"),Ce=re("1vsH"),me=re("PGNT"),ne=re.n(me),we=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],tt=function(ie,se){var ue=ie.globalSetting,Se=ie.loading,Pe=ie.dispatch,Ze=ie.isEdit,qe=ie.editData,Et=Object(ke.a)(ie,["globalSetting","loading","dispatch","isEdit","editData"]),Pt=Object(m.useState)(""),et=Object(c.a)(Pt,2),ct=et[0],Ft=et[1],Ct=Object(m.useState)(""),jt=Object(c.a)(Ct,2),$t=jt[0],Lt=jt[1],Qt=Object(m.useState)([]),Zt=Object(c.a)(Qt,2),pt=Zt[0],Xt=Zt[1],zt=Object(m.useState)(""),Gt=Object(c.a)(zt,2),Ut=Gt[0],Mt=Gt[1],St=Object(m.useState)(),it=Object(c.a)(St,2),Fe=it[0],nr=it[1],Vt=Object(m.useState)(!1),qt=Object(c.a)(Vt,2),Wt=qt[0],Tr=qt[1];Object(m.useEffect)(function(){if(!qe||!Ze)return;Ft(qe==null?void 0:qe.name),Lt(qe==null?void 0:qe.analysis),nr(qe==null?void 0:qe.is_ordered),Tr(!0)},[qe]),Object(m.useEffect)(function(){if(!Wt)return;var xr=qe==null?void 0:qe.standard_answer.map(function(U){return U.answer_text});Xt(xr),Tr(!1)},[Wt]),Object(m.useImperativeHandle)(se,function(){return{onSave:ir,Clear:Rt}});var ir=function(){var U=[],u=!1;return ct?(pt.forEach(function(g,M){U.push({position:M+1,answer_text:[]}),g.forEach(function(J,F){U[M].answer_text.push(J),(!J||!Object(Ce.db)(J,1e4))&&(Mt("".concat(M,"-").concat(F)),T.b.info(J?"\u7B54\u6848\u4E0D\u80FD\u8D85\u8FC710000\u5B57\u7B26":"\u7B54\u6848\uFF1A\u4E0D\u80FD\u4E3A\u7A7A"),u=!0)})}),u?!1:(U==null?void 0:U.length)>20?(T.b.warn("\u586B\u7A7A\u9898\u6807\u51C6\u7B54\u6848\u4E0D\u80FD\u4E3A\u7A7A/\u4E0D\u80FD\u8D85\u8FC720\u4E2A\uFF01"),!1):{name:ct,analysis:$t,standard_answers:U,is_ordered:Fe}):(T.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1)},Rt=function(){Ft(""),Lt(""),Xt([]),nr(!1)},Ie=function(U,u,g){var M=pt.slice();if(u&&M.splice(U,u),g)for(var J=0;J1&&l.a.createElement("span",null,l.a.createElement(fe.a,{checked:Fe,onChange:function(U){return nr(U.target.checked)},className:"".concat(ne.a.color333," font14")},"\u591A\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u6709\u987A\u5E8F\u8981\u6C42"),l.a.createElement("span",{className:"".concat(ne.a.color999," font12")},"\uFF08\u9009\u4E2D\uFF0C\u6BCF\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u987A\u5E8F\u5FC5\u987B\u4E0E\u53C2\u8003\u7B54\u6848\u4E00\u81F4\uFF09"))),l.a.createElement("p",{className:ne.a.titleWrap},l.a.createElement("span",{className:ne.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),l.a.createElement(Ee.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:$t,onChange:function(U){return Lt(U)}}))},Ye=Object(v.a)(function(te){var ie=te.loading,se=te.globalSetting;return{globalSetting:se,loading:ie.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(tt)),Xe=re("7Kak"),Ve=re("9yH6"),Le=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Me=function(ie,se){var ue=ie.globalSetting,Se=ie.loading,Pe=ie.editData,Ze=ie.dispatch,qe=ie.onRef,Et=qe===void 0?function(){}:qe,Pt=ie.isEdit,et=Object(ke.a)(ie,["globalSetting","loading","editData","dispatch","onRef","isEdit"]),ct=Object(m.useState)(),Ft=Object(c.a)(ct,2),Ct=Ft[0],jt=Ft[1],$t=Object(m.useState)(""),Lt=Object(c.a)($t,2),Qt=Lt[0],Zt=Lt[1],pt=Object(m.useState)(""),Xt=Object(c.a)(pt,2),zt=Xt[0],Gt=Xt[1];Object(m.useEffect)(function(){if(!Pe||!Pt)return;Zt(Pe==null?void 0:Pe.name),Gt(Pe==null?void 0:Pe.analysis);var St=Pe==null?void 0:Pe.choices.find(function(it){return it.is_answer});jt(St.choice_text==="\u6B63\u786E"?"0":"1")},[Pe]),Object(m.useImperativeHandle)(se,function(){return{onSave:Ut,Clear:Mt}});var Ut=function(){if(!Qt)return T.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;if(!Ct)return T.b.info("\u8BF7\u5148\u70B9\u51FB\u9009\u62E9\u672C\u9009\u62E9\u9898\u7684\u6B63\u786E\u9009\u9879"),!1;var it=[{choice_text:"\u6B63\u786E",is_answer:Ct==="0"?1:0},{choice_text:"\u9519\u8BEF",is_answer:Ct==="1"?1:0}];return{name:Qt,choices:it,analysis:zt}},Mt=function(){Zt(""),Gt(""),jt("")};return l.a.createElement("section",{className:ne.a.wrap},l.a.createElement("p",{className:ne.a.titleWrap},l.a.createElement("span",{className:ne.a.required},"*"),l.a.createElement("span",{className:ne.a.title},"\u9898\u5E72\uFF1A")),l.a.createElement(Ee.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Qt,onChange:function(it){return Zt(it)}}),l.a.createElement("p",{className:ne.a.titleWrap},l.a.createElement("span",{className:ne.a.required},"*"),l.a.createElement("span",{className:ne.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",l.a.createElement("span",{className:ne.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),l.a.createElement(Ve.a.Group,{buttonStyle:"solid",value:Ct,onChange:function(it){return jt(it.target.value)}},l.a.createElement(Ve.a.Button,{value:"0",className:"".concat(ne.a.radio," mr40")},"\u6B63\u786E"),l.a.createElement(Ve.a.Button,{value:"1",className:ne.a.radio},"\u9519\u8BEF")),l.a.createElement("p",{className:ne.a.titleWrap},l.a.createElement("span",{className:ne.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),l.a.createElement(Ee.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:zt,onChange:function(it){return Gt(it)}}))},He=Object(v.a)(function(te){var ie=te.loading,se=te.globalSetting;return{globalSetting:se,loading:ie.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(Me)),Ge=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],je=function(ie,se){var ue=ie.editData,Se=ie.globalSetting,Pe=ie.loading,Ze=ie.dispatch,qe=ie.onRef,Et=qe===void 0?function(){}:qe,Pt=ie.isEdit,et=Object(ke.a)(ie,["editData","globalSetting","loading","dispatch","onRef","isEdit"]),ct=Object(m.useState)([]),Ft=Object(c.a)(ct,2),Ct=Ft[0],jt=Ft[1],$t=Object(m.useState)(),Lt=Object(c.a)($t,2),Qt=Lt[0],Zt=Lt[1],pt=Object(m.useState)([]),Xt=Object(c.a)(pt,2),zt=Xt[0],Gt=Xt[1],Ut=Object(m.useState)(""),Mt=Object(c.a)(Ut,2),St=Mt[0],it=Mt[1],Fe=Object(m.useState)(""),nr=Object(c.a)(Fe,2),Vt=nr[0],qt=nr[1];Object(m.useEffect)(function(){jt(["","","",""])},[]),Object(m.useEffect)(function(){if(!ue||!Pt)return;it(ue==null?void 0:ue.name),qt(ue==null?void 0:ue.analysis),jt(ue==null?void 0:ue.choices.map(function(Rt){return Rt.choice_text}));var ir=[];ue==null||ue.choices.map(function(Rt,Ie){Rt.is_answer&&ir.push(Ie)}),Gt(ir)},[ue]),Object(m.useImperativeHandle)(se,function(){return{onSave:Wt,Clear:Tr}});var Wt=function(){if(!St)return T.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;var Rt=Ct.findIndex(function(xt){return!xt});if(Rt>-1)return T.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(Ge[Rt]," \u9009\u9879\u7684\u5185\u5BB9")),!1;if(!zt.length)return T.b.info("\u8BF7\u8BBE\u7F6E\u672C\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E"),!1;if(zt.length<2)return T.b.info("\u591A\u9009\u9898\u6700\u5C0F\u6B63\u786E\u9009\u9879\u4E3A2\u4E2A"),!1;var Ie=Ct.map(function(xt,Pr){return{choice_text:xt,is_answer:zt.includes(Pr)?1:0}});return{name:St,choices:Ie,analysis:Vt}},Tr=function(){jt(["","","",""]),it(""),qt(""),Gt("")};return l.a.createElement("section",{className:ne.a.wrap},l.a.createElement("p",{className:ne.a.titleWrap},l.a.createElement("span",{className:ne.a.required},"*"),l.a.createElement("span",{className:ne.a.title},"\u9898\u5E72\uFF1A")),l.a.createElement(Ee.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:St,onChange:function(Rt){return it(Rt)}}),l.a.createElement("p",{className:ne.a.titleWrap},l.a.createElement("span",{className:ne.a.required},"*"),l.a.createElement("span",{className:ne.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",l.a.createElement("span",{className:ne.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),Ct.map(function(ir,Rt){return l.a.createElement("div",{className:ne.a.choiceWrap,key:Rt},l.a.createElement(X.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},l.a.createElement("div",{className:"".concat(ne.a.answer," ").concat(zt.includes(Rt)?ne.a.activeAnswer:""),onClick:function(){zt.includes(Rt)?Gt(zt.filter(function(xt){return xt!==Rt})):Gt([].concat(Object(ve.a)(zt),[Rt]))}},Ge[Rt])),l.a.createElement("div",{className:ne.a.editorWrap},Qt===Rt?l.a.createElement(Ee.a,{id:"single-question-option-".concat(Rt),watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:ir,onChange:function(xt){Ct[Rt]=xt,jt(Ct)}}):l.a.createElement("div",{className:ne.a.htmlWrap,onClick:function(){return Zt(Rt)}},l.a.createElement(a.a,{value:ir}))),Rt>1&&l.a.createElement(X.a,{title:"\u5220\u9664"},l.a.createElement("i",{className:"".concat(ne.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){jt(Ct.filter(function(xt,Pr){return Pr!==Rt})),zt.includes(Rt)?Gt(zt.filter(function(xt){return xt!==Rt})):Gt([].concat(Object(ve.a)(zt),[Rt]))}})),Rt<7&&Rt===Ct.length-1&&l.a.createElement(X.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},l.a.createElement("i",{className:"".concat(ne.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return jt([].concat(Object(ve.a)(Ct),[""]))}})))}),l.a.createElement("p",{className:ne.a.titleWrap},l.a.createElement("span",{className:ne.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),l.a.createElement(Ee.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Vt,onChange:function(Rt){return qt(Rt)}}))},Ue=Object(v.a)(function(te){var ie=te.loading,se=te.globalSetting;return{globalSetting:se,loading:ie.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(je)),Re=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],st=function(ie,se){var ue=ie.editData,Se=ie.globalSetting,Pe=ie.loading,Ze=ie.dispatch,qe=ie.onRef,Et=qe===void 0?function(){}:qe,Pt=ie.isEdit,et=Object(ke.a)(ie,["editData","globalSetting","loading","dispatch","onRef","isEdit"]),ct=Object(m.useState)([]),Ft=Object(c.a)(ct,2),Ct=Ft[0],jt=Ft[1],$t=Object(m.useState)(),Lt=Object(c.a)($t,2),Qt=Lt[0],Zt=Lt[1],pt=Object(m.useState)(),Xt=Object(c.a)(pt,2),zt=Xt[0],Gt=Xt[1],Ut=Object(m.useState)(""),Mt=Object(c.a)(Ut,2),St=Mt[0],it=Mt[1],Fe=Object(m.useState)(""),nr=Object(c.a)(Fe,2),Vt=nr[0],qt=nr[1];Object(m.useEffect)(function(){jt(["","","",""])},[]),Object(m.useEffect)(function(){if(!ue||!Pt)return;it(ue==null?void 0:ue.name),qt(ue==null?void 0:ue.analysis),jt(ue==null?void 0:ue.choices.map(function(ir){return ir.choice_text})),Gt(ue==null?void 0:ue.choices.findIndex(function(ir){return ir.is_answer}))},[ue]),Object(m.useImperativeHandle)(se,function(){return{onSave:Wt,Clear:Tr}});var Wt=function(){if(!St)return T.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;var Rt=Ct.findIndex(function(xt){return!xt});if(Rt>-1)return T.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(Re[Rt]," \u9009\u9879\u7684\u5185\u5BB9")),!1;if(console.log("activeAnswer: ",zt),!(typeof zt=="number"))return T.b.info("\u8BF7\u8BBE\u7F6E\u672C\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E"),!1;var Ie=Ct.map(function(xt,Pr){return{choice_text:xt,is_answer:zt===Pr?1:0}});return{name:St,choices:Ie,analysis:Vt}},Tr=function(){jt(["","","",""]),it(""),qt(""),Gt("")};return l.a.createElement("section",{className:ne.a.wrap},l.a.createElement("p",{className:ne.a.titleWrap},l.a.createElement("span",{className:ne.a.required},"*"),l.a.createElement("span",{className:ne.a.title},"\u9898\u5E72\uFF1A")),l.a.createElement(Ee.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:St,onChange:function(Rt){return it(Rt)}}),l.a.createElement("p",{className:ne.a.titleWrap},l.a.createElement("span",{className:ne.a.required},"*"),l.a.createElement("span",{className:ne.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",l.a.createElement("span",{className:ne.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),Ct.map(function(ir,Rt){return l.a.createElement("div",{className:ne.a.choiceWrap,key:Rt},l.a.createElement(X.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},l.a.createElement("div",{className:"".concat(ne.a.answer," ").concat(zt===Rt?ne.a.activeAnswer:""),onClick:function(){return Gt(Rt)}},Re[Rt])),l.a.createElement("div",{className:ne.a.editorWrap},Qt===Rt?l.a.createElement(Ee.a,{id:"single-question-option-".concat(Rt),watch:!0,height:155,isFocus:!0,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:ir,onChange:function(xt){Ct[Rt]=xt,jt(Ct)}}):l.a.createElement("div",{className:ne.a.htmlWrap,onClick:function(){return Zt(Rt)}},l.a.createElement(a.a,{value:ir}))),Rt>1&&l.a.createElement(X.a,{title:"\u5220\u9664"},l.a.createElement("i",{className:"".concat(ne.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){jt(Ct.filter(function(xt,Pr){return Pr!==Rt})),Rt===zt&&Gt(null)}})),Rt<7&&Rt===Ct.length-1&&l.a.createElement(X.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},l.a.createElement("i",{className:"".concat(ne.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return jt([].concat(Object(ve.a)(Ct),[""]))}})))}),l.a.createElement("p",{className:ne.a.titleWrap},l.a.createElement("span",{className:ne.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),l.a.createElement(Ee.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Vt,onChange:function(Rt){return qt(Rt)}}))},Je=Object(v.a)(function(te){var ie=te.loading,se=te.globalSetting;return{globalSetting:se,loading:ie.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(st)),Qe=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],nt=function(ie,se){var ue=ie.editData,Se=ie.globalSetting,Pe=ie.loading,Ze=ie.dispatch,qe=ie.onRef,Et=qe===void 0?function(){}:qe,Pt=ie.isEdit,et=Object(ke.a)(ie,["editData","globalSetting","loading","dispatch","onRef","isEdit"]),ct=Object(m.useState)(""),Ft=Object(c.a)(ct,2),Ct=Ft[0],jt=Ft[1],$t=Object(m.useState)(""),Lt=Object(c.a)($t,2),Qt=Lt[0],Zt=Lt[1],pt=Object(m.useState)(""),Xt=Object(c.a)(pt,2),zt=Xt[0],Gt=Xt[1];Object(m.useEffect)(function(){var St;if(!ue||!Pt)return;jt(ue==null?void 0:ue.name),Zt(ue==null?void 0:ue.analysis),Gt(ue==null||((St=ue.answer_texts)===null||St===void 0)?void 0:St[0])},[ue]),Object(m.useImperativeHandle)(se,function(){return{onSave:Ut,Clear:Mt}});var Ut=function(){return Ct?zt?{name:Ct,answer_texts:[zt],analysis:Qt}:(T.b.info("\u8BF7\u60A8\u8F93\u5165\u53C2\u8003\u7B54\u6848"),!1):(T.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1)},Mt=function(){jt(""),Zt(""),Gt("")};return l.a.createElement("section",{className:ne.a.wrap},l.a.createElement("p",{className:ne.a.titleWrap},l.a.createElement("span",{className:ne.a.required},"*"),l.a.createElement("span",{className:ne.a.title},"\u9898\u5E72\uFF1A")),l.a.createElement(Ee.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Ct,onChange:function(it){return jt(it)}}),l.a.createElement("p",{className:ne.a.titleWrap},l.a.createElement("span",{className:ne.a.title},"\u53C2\u8003\u7B54\u6848\uFF1A")),l.a.createElement(Ee.a,{id:"single-question-reference-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u53C2\u8003\u7B54\u6848",defaultValue:zt,onChange:function(it){return Gt(it)}}),l.a.createElement("p",{className:ne.a.titleWrap},l.a.createElement("span",{className:ne.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),l.a.createElement(Ee.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Qt,onChange:function(it){return Zt(it)}}))},bt=Object(v.a)(function(te){var ie=te.loading,se=te.globalSetting;return{globalSetting:se,loading:ie.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(nt)),at=re("k1fw"),ht=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Ae=function(ie,se){var ue=ie.globalSetting,Se=ie.loading,Pe=ie.dispatch,Ze=ie.editData,qe=ie.onRef,Et=qe===void 0?function(){}:qe,Pt=ie.isEdit,et=Object(ke.a)(ie,["globalSetting","loading","dispatch","editData","onRef","isEdit"]),ct=Object(m.useState)(""),Ft=Object(c.a)(ct,2),Ct=Ft[0],jt=Ft[1],$t=Object(m.useState)([]),Lt=Object(c.a)($t,2),Qt=Lt[0],Zt=Lt[1];console.log(Qt),Object(m.useEffect)(function(){var Ut;if(!Ze||!Pt)return;jt(Ze==null?void 0:Ze.name);var Mt=Ze==null||((Ut=Ze.sub_item_banks)===null||Ut===void 0)?void 0:Ut.map(function(St){var it,Fe,nr;return Object(at.a)(Object(at.a)({},St),{},{id:St.id,open:!1,qusList:St==null||((it=St.choices)===null||it===void 0)?void 0:it.map(function(Vt){return Vt.choice_text}),activeQusEditor:null,qusAnswer:(Fe=[St==null||((nr=St.choices)===null||nr===void 0)?void 0:nr.findIndex(function(Vt){return Vt.is_answer})])===null||Fe===void 0?void 0:Fe.filter(function(Vt){return Vt!==-1})})});Zt(Mt)},[Ze]),Object(m.useImperativeHandle)(se,function(){return{onSave:pt,Clear:Xt}});var pt=function(){if(!Ct)return T.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;if(Qt.length===0)return T.b.info("\u8BF7\u60A8\u6DFB\u52A0\u5C0F\u9898"),!1;for(var Mt=0;Mt-1)return T.b.info("\u8BF7\u5148\u8F93\u5165\u7B2C".concat(Mt+1,"\u5C0F\u9898").concat(ht[Fe],"\u9009\u9879\u7684\u5185\u5BB9")),!1;if(!(it!=null&&it.qusAnswer.length))return T.b.info("\u8BF7\u8BBE\u7F6E\u7B2C".concat(Mt+1,"\u5C0F\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E")),!1}var nr=Qt.map(function(Vt){return{id:Vt.id>1?Vt.id:null,name:Vt.name,item_type:Vt.item_type,analysis:Vt.analysis,choices:Vt.qusList.map(function(qt,Wt){return{choice_text:qt,is_answer:Vt.qusAnswer[0]===Wt?1:0}})}});return{name:Ct,sub_item_banks:nr}},Xt=function(){jt(""),Zt([])},zt=function(){var Mt={id:Math.random(),item_type:"SINGLE",open:!1,name:"",qusList:["","","",""],activeQusEditor:null,qusAnswer:[],analysis:""};Zt(Qt.concat(Mt))},Gt=function(Mt,St,it){var Fe=Object(G.cloneDeep)(Qt);if(Mt==="open"&&(Fe[St].open=!Fe[St].open),Mt==="delete"&&Fe.splice(St,1),Mt==="value"&&(Fe[St].name=it),Mt==="answer"&&(Fe[St].qusAnswer=[it]),Mt==="edit"&&(Fe[St].activeQusEditor=it),Mt==="details"&&(Fe[St].qusList[Fe[St].activeQusEditor]=it),Mt==="addQus"&&(Fe[St].qusList=Fe[St].qusList.concat("")),Mt==="deleteQus"){var nr;Fe[St].qusList=Fe[St].qusList.filter(function(Vt,qt){return qt!==it}),Fe[St].qusAnswer=(nr=Fe[St].qusAnswer)===null||nr===void 0?void 0:nr.filter(function(Vt){return Vt!==it})}Mt==="analysis"&&(Fe[St].analysis=it),Zt(Fe)};return l.a.createElement("section",{className:ne.a.wrap},l.a.createElement("p",{className:ne.a.titleWrap},l.a.createElement("span",{className:ne.a.required},"*"),l.a.createElement("span",{className:ne.a.title},"\u9898\u5E72\uFF1A")),l.a.createElement(Ee.a,{id:"combination-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Ct,onChange:function(Mt){return jt(Mt)}}),Qt==null?void 0:Qt.map(function(Ut,Mt){var St;return l.a.createElement("div",{className:ne.a.fold,key:Ut.id},l.a.createElement("div",{onClick:function(){return Gt("open",Mt)},className:ne.a.head},l.a.createElement("i",{className:"iconfont icon-sanjiaoxing",style:{transform:Ut.open?"initial":"rotate(270deg) translate(2px, 4px)"}}),l.a.createElement("span",null,"\u7B2C",Mt+1,"\u5C0F\u9898\uFF08\u5355\u9009\u9898\uFF09"),l.a.createElement("b",{style:{visibility:"hidden"},onClick:function(Fe){Fe.stopPropagation(),Gt("delete",Mt)},className:"iconfont icon-shanchu8"})),l.a.createElement("div",{className:"mb10",style:{display:Ut.open?"block":"none"}},l.a.createElement(Ee.a,{watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Ut==null?void 0:Ut.name,onChange:function(Fe){return Gt("value",Mt,Fe)}}),l.a.createElement("p",{className:ne.a.titleWrap},l.a.createElement("span",{className:ne.a.required},"*"),l.a.createElement("span",{className:ne.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",l.a.createElement("span",{className:ne.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),Ut==null||((St=Ut.qusList)===null||St===void 0)?void 0:St.map(function(it,Fe){var nr,Vt;return l.a.createElement("div",{className:ne.a.choiceWrap,key:Fe},l.a.createElement(X.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},l.a.createElement("div",{className:"".concat(ne.a.answer," ").concat(Ut!=null&&(nr=Ut.qusAnswer)!==null&&nr!==void 0&&nr.includes(Fe)?ne.a.activeAnswer:""),onClick:function(){return Gt("answer",Mt,Fe)}},ht[Fe])),l.a.createElement("div",{className:ne.a.editorWrap},(Ut==null?void 0:Ut.activeQusEditor)===Fe?l.a.createElement(Ee.a,{id:"single-question-option-".concat(Fe),watch:!0,height:155,isFocus:!0,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:it,onChange:function(Wt){return Gt("details",Mt,Wt)}}):l.a.createElement("div",{className:ne.a.htmlWrap,onClick:function(){return Gt("edit",Mt,Fe)}},l.a.createElement(a.a,{value:it}))),Fe>1&&l.a.createElement(X.a,{title:"\u5220\u9664"},l.a.createElement("i",{className:"".concat(ne.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return Gt("deleteQus",Mt,Fe)}})),Fe<7&&Fe===(Ut==null||((Vt=Ut.qusList)===null||Vt===void 0)?void 0:Vt.length)-1&&l.a.createElement(X.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},l.a.createElement("i",{className:"".concat(ne.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return Gt("addQus",Mt)}})))}),l.a.createElement("p",{className:"mb10 mt10"},l.a.createElement("span",{className:ne.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),l.a.createElement(Ee.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Ut.analysis,onChange:function(Fe){return Gt("analysis",Mt,Fe)}})))}))},gt=Object(v.a)(function(te){var ie=te.loading,se=te.globalSetting;return{globalSetting:se,loading:ie.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(Ae)),dt=re("14J3"),De=re("BMrR"),We=re("ZWs3"),ge=function(ie){var se=ie.visible,ue=ie.onCancel,Se=ie.onRandomExchange,Pe=ie.selectFromProblemSet;return l.a.createElement(d.a,{title:"\u8BF7\u9009\u62E9\u66FF\u6362\u65B9\u5F0F",visible:se,onCancel:ue,centered:!0,maskClosable:!0,footer:null},l.a.createElement(De.a,{justify:"center"},l.a.createElement(We.a,{onClick:Se},"\u968F\u673A\u66F4\u6362"),l.a.createElement(P.a,{style:{marginLeft:24},onClick:Pe},"\u4ECE\u9898\u5E93\u4E2D\u9009\u62E9")))},de=ge,pe=function(ie){var se,ue,Se,Pe,Ze,qe,Et,Pt,et=ie.data,ct=ie.submit,Ft=ie.goBack,Ct=ie.loading,jt=ie.onTypeScore,$t=ie.editPreview,Lt=$t===void 0?!1:$t,Qt=ie.onSkipExamination,Zt=ie.selectValue,pt=ie.onExchange,Xt=Object(m.useRef)(),zt=Object(m.useRef)(Object(G.debounce)(function(){return xr()},100,{leading:!0,trailing:!0})),Gt=Object(m.useState)(null),Ut=Object(c.a)(Gt,2),Mt=Ut[0],St=Ut[1],it=Object(m.useState)(!1),Fe=Object(c.a)(it,2),nr=Fe[0],Vt=Fe[1],qt=Object(m.useState)(!1),Wt=Object(c.a)(qt,2),Tr=Wt[0],ir=Wt[1],Rt=Object(m.useRef)(),Ie=Object(b.i)();Object(m.useEffect)(function(){return window.addEventListener("scroll",zt==null?void 0:zt.current),function(){window.removeEventListener("scroll",zt==null?void 0:zt.current)}},[]),Object(m.useEffect)(function(){Vt(!0)},[]),Object(m.useEffect)(function(){var ot,be,Ke,wt,mt=(ot=document.getElementById("examName"))===null||ot===void 0||((be=ot.getElementsByClassName("ant-pagination-options-quick-jumper"))===null||be===void 0||((Ke=be[0])===null||Ke===void 0||((wt=Ke.childNodes)===null||wt===void 0)))?void 0:wt[2];mt&&(mt.nodeValue="\u4EFD")},[et]);var xt=function(be){var Ke=parseInt(be);return isNaN(Ke)?"":Ke};function Pr(){var ot=0,be=0,Ke=0;return document.body&&(be=document.body.scrollTop),document.documentElement&&(Ke=document.documentElement.scrollTop),ot=be-Ke>0?be:Ke,ot}function un(){var ot=0,be=0,Ke=0;return document.body&&(be=document.body.scrollHeight),document.documentElement&&(Ke=document.documentElement.scrollHeight),ot=be-Ke>0?be:Ke,ot}function dn(){var ot=0;return document.compatMode=="CSS1Compat"?ot=document.documentElement.clientHeight:ot=document.body.clientHeight,ot}var xr=function(){var be=document.getElementById("preview_btns"),Ke=document.getElementById("preview_btns_else");Pr()+dn()>=un()-68?(be.style.visibility="hidden",Ke.style.visibility="visible"):(be.style.visibility="visible",Ke.style.visibility="hidden")},U=["\u5BB9\u6613","\u7B80\u5355","\u9002\u4E2D","\u56F0\u96BE"],u=function(be){var Ke,wt=[];return l.a.createElement(l.a.Fragment,null,l.a.createElement("aside",{className:f.a.single},be==null||((Ke=be.choices)===null||Ke===void 0)?void 0:Ke.map(function(mt,vt){return mt.is_answer&&wt.push(ce[vt]),l.a.createElement("ul",{key:vt},l.a.createElement("li",null,ce[vt],"\u3001"),l.a.createElement("li",null,l.a.createElement(a.a,{value:mt.choice_text})))})),l.a.createElement("div",{className:f.a.analysis},l.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",wt.join(""),l.a.createElement("span",{className:"ml30"},"\u96BE\u5EA6\uFF1A",U[be.difficulty])),l.a.createElement("aside",null,l.a.createElement("span",{className:f.a.text},"\u89E3\u6790:"),l.a.createElement(a.a,{value:be.analysis?be.analysis:"\u6682\u65E0\u89E3\u6790"})),l.a.createElement("ul",null,l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat(be==null?void 0:be.discipline_name,"/").concat(be==null?void 0:be.sub_discipline_name)),l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),be==null?void 0:be.tag_discipline_name))))},g=function(be){var Ke,wt=be==null||((Ke=be.standard_answer)===null||Ke===void 0)?void 0:Ke.map(function(mt){var vt;return"\u7B54\u6848\uFF08\u586B\u7A7A".concat(mt.position,"\uFF09\uFF1A").concat(mt==null||((vt=mt.answer_text)===null||vt===void 0)?void 0:vt.join("\u3001"))});return l.a.createElement(l.a.Fragment,null,l.a.createElement("div",{className:f.a.analysis},l.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",wt),l.a.createElement("aside",null,l.a.createElement("span",{className:f.a.text},"\u89E3\u6790:"),l.a.createElement(a.a,{value:be.analysis?be.analysis:"\u6682\u65E0\u89E3\u6790"})),l.a.createElement("ul",null,l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat(be==null?void 0:be.discipline_name,"/").concat(be==null?void 0:be.sub_discipline_name)),l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),be==null?void 0:be.tag_discipline_name))))},M=function(be){var Ke;return l.a.createElement("div",{className:f.a.analysis},l.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",be==null||((Ke=be.answer_texts)===null||Ke===void 0)?void 0:Ke[0]),l.a.createElement("aside",null,l.a.createElement("span",{className:f.a.text},"\u89E3\u6790:"),l.a.createElement(a.a,{value:be.analysis?be.analysis:"\u6682\u65E0\u89E3\u6790"})),l.a.createElement("ul",null,l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat(be==null?void 0:be.discipline_name,"/").concat(be==null?void 0:be.sub_discipline_name)),l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),be==null?void 0:be.tag_discipline_name)))},J=function(be){var Ke;return l.a.createElement("div",{className:f.a.analysis},l.a.createElement("aside",null,l.a.createElement("span",{className:f.a.text},"\u9884\u671F\u8F93\u51FA:"),l.a.createElement(a.a,{value:be==null||((Ke=be.program_attr)===null||Ke===void 0)?void 0:Ke.description})),l.a.createElement("ul",null,l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat(be==null?void 0:be.discipline_name,"/").concat(be==null?void 0:be.sub_discipline_name)),l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),be==null?void 0:be.tag_discipline_name)))},F=function(be,Ke){var wt;return l.a.createElement("div",null,be==null||((wt=be.sub_item_banks)===null||wt===void 0)?void 0:wt.map(function(mt,vt){var It,gr=[];return l.a.createElement(l.a.Fragment,null,l.a.createElement("div",{style:{marginLeft:25,fontSize:"16px",color:"#333"}},Ke+1+"."+(vt+1),"\uFF08\u5355\u9009\u9898\uFF09",mt.name),l.a.createElement("aside",{className:f.a.single},mt==null||((It=mt.choices)===null||It===void 0)?void 0:It.map(function(cr,hr){return cr.is_answer&&gr.push(ce[hr]),l.a.createElement("ul",{key:hr},l.a.createElement("li",null,ce[hr],"\u3001"),l.a.createElement("li",null,l.a.createElement(a.a,{value:cr.choice_text})))})),l.a.createElement("div",{className:f.a.analysis},l.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",gr.join(""),l.a.createElement("span",{className:"ml30"},"\u96BE\u5EA6\uFF1A",U[mt.difficulty])),l.a.createElement("aside",null,l.a.createElement("span",{className:f.a.text},"\u89E3\u6790:"),l.a.createElement(a.a,{value:mt.analysis?mt.analysis:"\u6682\u65E0\u89E3\u6790"})),l.a.createElement("ul",null,l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat(be==null?void 0:be.discipline_name,"/").concat(be==null?void 0:be.sub_discipline_name)),l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),be==null?void 0:be.tag_discipline_name))))}))},ce=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Ne=function(be){var Ke,wt=[];be==null||((Ke=be.questions)===null||Ke===void 0)||Ke.map(function(vt){var It;return vt==null||((It=vt.sub_item_banks)===null||It===void 0)?void 0:It.map(function(gr){wt.push(gr)})});var mt=0;be.type==="COMBINATION"?mt=be.questions_score/wt.length:mt=be.questions_score/be.questions_count,d.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u5206\u6570\u8BBE\u7F6E",content:l.a.createElement("div",{className:f.a.modalColumn},l.a.createElement("div",{className:f.a.modalRow,style:{justifyContent:"flex-start"}},l.a.createElement("sup",{className:f.a.sup},"*"),l.a.createElement("span",null,be==null?void 0:be.name,(be==null?void 0:be.type)==="COMBINATION"&&"\u4E2D\u7684\u6BCF\u5C0F\u9898","\uFF1A"),l.a.createElement(h.a,{min:1,parser:xt,defaultValue:mt,onChange:function(It){mt=It}}),l.a.createElement("span",{className:"ml5"},"\u5206/\u9898"))),okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var vt=Object(A.a)(y.a.mark(function gr(){var cr,hr;return y.a.wrap(function(Sr){for(;;)switch(Sr.prev=Sr.next){case 0:if(mt){Sr.next=3;break}return T.b.warn("\u5206\u6570\u4E0D\u80FD\u4E3A\u7A7A\u6216\u4E3A0"),Sr.abrupt("return",Promise.reject());case 3:be.type==="COMBINATION"?(cr={type:be==null?void 0:be.type,score:mt,scoreTotal:mt*(wt==null?void 0:wt.length)},jt(cr)):(hr={type:be==null?void 0:be.type,score:mt,scoreTotal:mt*be.questions_count},jt(hr));case 4:case"end":return Sr.stop()}},gr)}));function It(){return vt.apply(this,arguments)}return It}()})},rt=function(){var be="";d.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u4FDD\u5B58\u8BD5\u5377",content:l.a.createElement("div",{className:f.a.modalColumn},l.a.createElement("div",{style:{color:"#676A6C",display:"flex"},className:"font14 mt20"},l.a.createElement("img",{style:{marginRight:5},src:q.a}),"\u4FDD\u5B58\u540E\u5355\u72EC\u751F\u6210\u4E00\u4EFD\u4EBA\u5DE5\u7EC4\u5377\u7C7B\u578B\u7684\u56FA\u5B9A\u8BD5\u5377\u3002"),l.a.createElement("div",{className:f.a.modalRow,style:{marginTop:20}},l.a.createElement("sup",{className:f.a.sup},"*"),l.a.createElement("span",{style:{flexShrink:0}},"\u8BD5\u5377\u540D\u79F0\uFF1A"),l.a.createElement(L.a,{placeholder:"\u8BF7\u8F93\u5165\u8BD5\u5377\u540D\u79F0",min:0,maxLength:60,defaultValue:be,onChange:function(wt){be=wt.target.value}}))),okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var Ke=Object(A.a)(y.a.mark(function mt(){var vt,It,gr,cr,hr;return y.a.wrap(function(Sr){for(;;)switch(Sr.prev=Sr.next){case 0:if(be){Sr.next=3;break}return T.b.warn("\u8BD5\u5377\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A"),Sr.abrupt("return",Promise.reject());case 3:return It=[],gr=[],cr=[],et==null||((vt=et.questionList)===null||vt===void 0)||vt.forEach(function(Wr){var or;(or=Wr.questions)===null||or===void 0||or.forEach(function(tr){It.push(tr.id),gr.push(Wr.questions_score/Wr.questions_count),Wr.type==="COMBINATION"&&cr.push({id:tr.id,sub_item_bank_ids:tr.sub_item_banks.map(function(pr){return pr.id})})})}),console.log("-----",cr),hr={item_bank_ids:It,item_bank_scores:gr,name:be,combination_item_banks:cr},Sr.next=11,ct(hr);case 11:case"end":return Sr.stop()}},mt)}));function wt(){return Ke.apply(this,arguments)}return wt}()})},Tt=function(be,Ke,wt,mt){var vt,It="".concat(location.pathname).concat(location.search),gr=(vt=mt.questions)===null||vt===void 0?void 0:vt.map(function(hr){return hr.id});if(It.includes("exercise"))Rt.current={id:be,ids:gr,type:Ke,index:wt},ir(!0);else var cr=d.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u6E29\u99A8\u63D0\u793A",content:"\u786E\u8BA4\u8981\u66F4\u6362\u8BE5\u8BD5\u9898\u5417\uFF1F",cancelButtonProps:{disabled:!1},maskClosable:!0,keyboard:!1,okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var hr=Object(A.a)(y.a.mark(function Sr(){return y.a.wrap(function(or){for(;;)switch(or.prev=or.next){case 0:return cr.update({cancelButtonProps:{disabled:!0}}),or.next=3,pt({single_question_id:be,seleted_item_bank_ids:gr},{type:Ke,index:wt});case 3:cr.update({cancelButtonProps:{disabled:!1}}),T.b.success("\u5DF2\u91CD\u65B0\u968F\u673A\u751F\u6210\u8BD5\u9898");case 5:case"end":return or.stop()}},Sr)}));function Lr(){return hr.apply(this,arguments)}return Lr}()})},Be=function(be){var Ke,wt=(Ke=be.questions)===null||Ke===void 0?void 0:Ke.map(function(It){return It.id}),mt=be.name,vt=d.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u6E29\u99A8\u63D0\u793A",content:"\u786E\u8BA4\u66F4\u6362".concat(mt,"\u4E2D\u7684\u6240\u6709\u8BD5\u9898\u5417\uFF1F"),cancelButtonProps:{disabled:!1},maskClosable:!1,keyboard:!1,okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var It=Object(A.a)(y.a.mark(function cr(){return y.a.wrap(function(Lr){for(;;)switch(Lr.prev=Lr.next){case 0:return vt.update({cancelButtonProps:{disabled:!0}}),Lr.next=3,pt({seleted_item_bank_ids:wt},{type:be.type});case 3:vt.update({cancelButtonProps:{disabled:!1}}),T.b.success("\u5DF2\u91CD\u65B0\u968F\u673A\u751F\u6210".concat(mt,"\u8BD5\u9898"));case 5:case"end":return Lr.stop()}},cr)}));function gr(){return It.apply(this,arguments)}return gr}()})},kt=function(){var be=d.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u6E29\u99A8\u63D0\u793A",content:"\u786E\u8BA4\u66F4\u6362\u9884\u89C8\u4E2D\u7684\u6240\u6709\u8BD5\u9898\u5417\uFF1F",cancelButtonProps:{disabled:!1},maskClosable:!1,keyboard:!1,okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var Ke=Object(A.a)(y.a.mark(function mt(){return y.a.wrap(function(It){for(;;)switch(It.prev=It.next){case 0:return be.update({cancelButtonProps:{disabled:!0}}),It.next=3,pt();case 3:be.update({cancelButtonProps:{disabled:!1}}),T.b.success("\u5DF2\u91CD\u65B0\u968F\u673A\u751F\u6210\u6574\u5F20\u8BD5\u9898");case 5:case"end":return It.stop()}},mt)}));function wt(){return Ke.apply(this,arguments)}return wt}()})},er=function(be){console.log(be,"key"),Qt(be-1)},fr=function(){return l.a.createElement(l.a.Fragment,null,l.a.createElement(j.a,{color:"#55575D",overlayClassName:f.a.popover,visible:nr,getPopupContainer:function(Ke){return Ke==null?void 0:Ke.parentNode},content:"\u5982\u60A8\u5BF9\u6B64\u4EFD\u8BD5\u9898\u6EE1\u610F\uFF0C\u53EF\u5C06\u6B64\u4EFD\u8BD5\u9898\u4FDD\u5B58\u4E3A\u56FA\u5B9A\u8BD5\u5377"},l.a.createElement(P.a,{onMouseEnter:function(){return Vt(!0)},onMouseLeave:function(){return Vt(!1)},onClick:function(){rt()}},"\u4FDD\u5B58")),l.a.createElement(P.a,{onClick:function(){document.body.scrollIntoView(),Ft()}},"\u8FD4\u56DE"),l.a.createElement(P.a,{loading:Ct,onClick:function(){return ct()},type:"primary"},"\u63D0\u4EA4"))},Gr=function(){var be;return l.a.createElement(l.a.Fragment,null,l.a.createElement(P.a,{onClick:Ft},"\u8FD4\u56DE"),Zt>0&&l.a.createElement(P.a,{onClick:function(){return er(Zt)},type:"primary"},"\u4E0A\u4E00\u4EFD"),Zt<(et==null||((be=et.exam)===null||be===void 0)?void 0:be.total_num)-1&&l.a.createElement(P.a,{onClick:function(){return er(Zt+2)}},"\u4E0B\u4E00\u4EFD"))},Mr=function(be,Ke){if(Ke==="SINGLE")return l.a.createElement(l.a.Fragment,null,l.a.createElement(Je,{ref:Xt,editData:be,isEdit:!0}),l.a.createElement(I.a,null));if(Ke==="MULTIPLE")return l.a.createElement(l.a.Fragment,null,l.a.createElement(Ue,{ref:Xt,editData:be,isEdit:!0}),l.a.createElement(I.a,null));if(Ke==="JUDGMENT")return l.a.createElement(l.a.Fragment,null,l.a.createElement(He,{ref:Xt,editData:be,isEdit:!0}),l.a.createElement(I.a,null));if(Ke==="COMPLETION")return l.a.createElement(l.a.Fragment,null,l.a.createElement(Ye,{ref:Xt,editData:be,isEdit:!0}),l.a.createElement(I.a,null));if(Ke==="SUBJECTIVE")return l.a.createElement(l.a.Fragment,null,l.a.createElement(bt,{ref:Xt,editData:be,isEdit:!0}),l.a.createElement(I.a,null));if(Ke==="COMBINATION")return l.a.createElement(l.a.Fragment,null,l.a.createElement(gt,{ref:Xt,editData:be,isEdit:!0}),l.a.createElement(I.a,null));if(Ke==="PROGRAM"){var wt;v.d.push("/problems/".concat(be==null||((wt=be.program_attr)===null||wt===void 0)?void 0:wt.identifier,"/edit?type=exercises&express_id=").concat(Ie.categoryId,"&question_id=").concat(be==null?void 0:be.id,"&score=").concat(be==null?void 0:be.score,"&callback_url=").concat(location.pathname,"&select=").concat(Zt,"&exercise=true"))}},Ir=function(){var ot=Object(A.a)(y.a.mark(function be(Ke,wt){var mt,vt,It,gr,cr,hr,Lr,Sr,Wr,or;return y.a.wrap(function(pr){for(;;)switch(pr.prev=pr.next){case 0:return pr.next=2,(mt=Xt.current)===null||mt===void 0?void 0:mt.onSave();case 2:if(vt=pr.sent,vt){pr.next=5;break}return pr.abrupt("return");case 5:return It={question_score:wt.score,analysis:vt.analysis},(Ke==="SINGLE"||Ke==="MULTIPLE"||Ke==="JUDGMENT")&&(cr=[],hr=[],It.question_type=Ke==="JUDGMENT"?2:1,It.question_title=vt==null?void 0:vt.name,vt==null||((gr=vt.choices)===null||gr===void 0)||gr.forEach(function(Ht,br){cr.push(Ht.choice_text),Ht!=null&&Ht.is_answer&&hr.push(br+1)}),It.question_choices=cr,It.standard_answers=hr),Ke==="COMPLETION"&&(It.is_ordered=vt.is_ordered,It.question_title=vt==null?void 0:vt.name,It.question_type=3,Sr=[],vt==null||((Lr=vt.standard_answers)===null||Lr===void 0)||Lr.forEach(function(Ht,br){Sr.push({choice_id:Ht.position,answer_text:Ht.answer_text})}),It.standard_answers=Sr),Ke==="SUBJECTIVE"&&(It.question_title=vt==null?void 0:vt.name,It.question_type=3,It.standard_answers=vt==null?void 0:vt.answer_texts),Ke==="COMBINATION"&&(It.question_title=vt==null?void 0:vt.name,It.question_type=7,It.sub_questions=vt==null||((Wr=vt.sub_item_banks)===null||Wr===void 0)?void 0:Wr.map(function(Ht,br){return{id:Ht.id,question_title:Ht.name,question_type:1,question_choices:Ht.choices.map(function(lr){return lr.choice_text}),standard_answers:[Ht.choices.findIndex(function(lr){return lr.is_answer})+1],analysis:Ht.analysis}}),delete It.analysis),pr.next=12,Object(x.a)("/api/exercise_questions/".concat(wt.id,".json"),{method:"put",body:It});case 12:or=pr.sent,(or==null?void 0:or.status)===0&&(T.b.success("\u7F16\u8F91\u6210\u529F"),er(Zt+1)),St(null);case 15:case"end":return pr.stop()}},be)}));return function(Ke,wt){return ot.apply(this,arguments)}}(),cn=function(){for(var be=[],Ke=0;Ke<(et==null||((wt=et.exam)===null||wt===void 0)?void 0:wt.total_num);Ke++){var wt;be.push({})}return be},Sn=et==null||((se=et.questionList)===null||se===void 0)?void 0:se.reduce(function(ot,be){return ot+be.questions_score},0),wr=Lt&&(et==null||((ue=et.exam)===null||ue===void 0)?void 0:ue.exercise_status)!==1;return l.a.createElement("section",{className:f.a.wrap},l.a.createElement("div",{id:"id_left_preview",className:f.a.left,onMouseEnter:function(be){var Ke=document.getElementById("id_left_preview");Ke.style.overflowY="auto"},onMouseLeave:function(be){var Ke=document.getElementById("id_left_preview");Ke.style.overflowY="hidden"}},l.a.createElement("div",{className:f.a.title},l.a.createElement("div",null,l.a.createElement("b",null),l.a.createElement("span",null,"\u7B54\u9898\u5361"))),l.a.createElement("div",{className:f.a.total},l.a.createElement("div",null,l.a.createElement("img",{src:H.a}),l.a.createElement("span",null,"\u9898\u6570(\u9053)"),l.a.createElement("aside",null,et==null?void 0:et.all_questions_count)),l.a.createElement("div",{className:"mr30 ml30"},l.a.createElement("img",{src:Q.a}),l.a.createElement("span",null,"\u603B\u5206(\u5206)"),l.a.createElement("aside",null,Sn)),l.a.createElement("div",null,l.a.createElement("img",{src:s.a}),l.a.createElement("span",null,"\u65F6\u957F(\u5206)"),l.a.createElement("aside",null,et==null||((Se=et.exam)===null||Se===void 0)?void 0:Se.time))),et==null||((Pe=et.questionList)===null||Pe===void 0)?void 0:Pe.map(function(ot,be){var Ke;return l.a.createElement("div",{className:f.a.list,key:be},l.a.createElement("div",{className:f.a.name},l.a.createElement("b",null),l.a.createElement("span",null,ot.name)),l.a.createElement("aside",null,l.a.createElement("div",null,"\u5171",l.a.createElement("span",{className:f.a.b},ot.questions_count),"\u9898"," ",l.a.createElement("span",{className:f.a.l},"|"),"\u5171",l.a.createElement("span",{className:f.a.r},ot.questions_score),"\u5206"),l.a.createElement("div",{className:f.a.answerSheet},ot==null||((Ke=ot.questions)===null||Ke===void 0)?void 0:Ke.map(function(wt,mt){return l.a.createElement("div",{onClick:function(){var It="Anchor_".concat(wt.id),gr=document.getElementById(It);gr&&setTimeout(function(){return gr.scrollIntoView({block:"center",behavior:"smooth"})})},key:wt.id,className:f.a.tag},mt+1)}))))})),l.a.createElement("div",{className:f.a.right},l.a.createElement("div",{className:f.a.examName,id:"examName"},l.a.createElement("div",{className:f.a.name},l.a.createElement(X.a,{title:et==null||((Ze=et.exam)===null||Ze===void 0)?void 0:Ze.name,getPopupContainer:function(be){return be.parentNode}},l.a.createElement("span",{className:f.a.t},et==null||((qe=et.exam)===null||qe===void 0)?void 0:qe.name))),Lt?l.a.createElement($.a,{showTotal:function(be){return l.a.createElement("span",{style:{color:"#656F87",fontSize:14}},"\u5171\u8BA1",l.a.createElement("span",{className:"c-light-primary"},be),"\u4EFD\u8BD5\u5377")},total:et==null||((Et=et.exam)===null||Et===void 0)?void 0:Et.total_num,pageSize:1,current:Zt+1,showSizeChanger:!1,onChange:er,showQuickJumper:!0,hideOnSinglePage:!1}):l.a.createElement(P.a,{onClick:kt,type:"primary"},"\u968F\u673A\u66F4\u6362")),l.a.createElement("div",{className:f.a.topWarp},et==null||((Pt=et.questionList)===null||Pt===void 0)?void 0:Pt.map(function(ot,be){var Ke,wt;return l.a.createElement(l.a.Fragment,{key:be},l.a.createElement("div",{className:f.a.head,style:be===0?{border:0,marginTop:-16}:{}},l.a.createElement("div",{className:f.a.name},l.a.createElement("b",null),l.a.createElement("span",null,ot.name)),l.a.createElement("div",{className:f.a.so},"\u5171",l.a.createElement("span",{className:f.a.b},ot.questions_count," "),"\u9898"," ",ot.type==="COMBINATION"&&"\uFF08\u5305\u542B".concat(ot==null||((Ke=ot.questions)===null||Ke===void 0)?void 0:Ke.map(function(mt){var vt;return mt==null||((vt=mt.sub_item_banks)===null||vt===void 0)?void 0:vt.length}).reduce(function(mt,vt){return mt+vt}),"\u5C0F\u9898\uFF09"),l.a.createElement("span",{className:f.a.l},"|"),"\u5171",l.a.createElement("span",{className:f.a.r},ot.questions_score),"\u5206"),!Lt&&l.a.createElement("div",{className:f.a.btn},l.a.createElement(P.a,{onClick:function(){Ne(ot)},type:"primary",ghost:!0,className:"mr20"},"\u8BBE\u7F6E\u5F97\u5206"),l.a.createElement(P.a,{onClick:function(){return Be(ot)},type:"primary",ghost:!0},"\u968F\u673A\u66F4\u6362"))),ot==null||((wt=ot.questions)===null||wt===void 0)?void 0:wt.map(function(mt,vt){return Mt===mt.id?l.a.createElement("div",{id:"Anchor_".concat(mt.id),className:f.a.content,style:{padding:0,marginTop:10},key:mt.id},l.a.createElement("div",{style:{float:"right",marginTop:-6}},l.a.createElement(P.a,{onClick:function(){return St(null)},className:"mr20",type:"primary",ghost:!0},"\u53D6\u6D88"),l.a.createElement(P.a,{onClick:function(){return Ir(ot==null?void 0:ot.type,mt)},type:"primary"},"\u4FDD\u5B58")),Mr(mt,ot.type)):l.a.createElement("div",{id:"Anchor_".concat(mt.id),className:f.a.content,key:mt.id},l.a.createElement("div",{className:f.a.titleWrap},l.a.createElement(a.a,{style:{paddingRight:10},className:f.a.titleHtml,value:vt+1+"\u3001"+"".concat((mt==null?void 0:mt.item_type)==="combination"?"\uFF08\u9898\u5E72\uFF09":"")+mt.name}),Lt&&l.a.createElement(P.a,{disabled:wr,onClick:function(){if(Mt){T.b.warn("\u5148\u4FDD\u5B58\u6216\u53D6\u6D88\u5F53\u524D\u6B63\u5728\u7F16\u8F91\u7684\u8BD5\u9898");return}St(mt.id)},type:"primary",className:"mr20",style:{marginLeft:"auto"},ghost:!0},"\u7F16\u8F91"),l.a.createElement(P.a,{disabled:wr,onClick:function(){return Tt(mt.id,ot.type,vt,ot)},type:"primary",ghost:!0},"\u6362\u4E00\u9898")),(ot.type==="SINGLE"||ot.type==="JUDGMENT"||ot.type==="MULTIPLE")&&u(mt),ot.type==="COMPLETION"&&g(mt),ot.type==="SUBJECTIVE"&&M(mt),ot.type==="PROGRAM"&&J(mt),ot.type==="COMBINATION"&&F(mt,vt),l.a.createElement("div",null))}))})),l.a.createElement("div",{className:f.a.btnsElse,id:"preview_btns_else"},Lt?Gr():fr()),l.a.createElement("div",{className:f.a.btnsWrap,id:"preview_btns"},l.a.createElement("div",{className:f.a.btns},Lt?Gr():fr()))),l.a.createElement(de,{visible:Tr,onRandomExchange:Object(A.a)(y.a.mark(function ot(){var be;return y.a.wrap(function(wt){for(;;)switch(wt.prev=wt.next){case 0:return be=Rt.current,wt.next=3,pt({single_question_id:be.id,seleted_item_bank_ids:be.ids},{type:be.type,index:be.index});case 3:ir(!1);case 4:case"end":return wt.stop()}},ot)})),selectFromProblemSet:function(){var be=Rt.current,Ke="".concat(location.pathname).concat(location.search);Ke.includes("exercise")&&v.d.push("/paperlibrary/exchangequestion?type=exercise&qid=".concat(be.id,"&qtype=").concat(be.type,"&exerciseid=").concat(Ie.categoryId,"&from=").concat(Ke))},onCancel:function(){ir(!1)}}))},ee=ft.a=pe},ulZh:function(At,ft,re){typeof window!="undefined"&&function($,R){At.exports=R()}(this,function(){return function(ae){var $={};function R(X){if($[X])return $[X].exports;var N=$[X]={i:X,l:!1,exports:{}};return ae[X].call(N.exports,N,N.exports,R),N.l=!0,N.exports}return R.m=ae,R.c=$,R.d=function(X,N,I){R.o(X,N)||Object.defineProperty(X,N,{enumerable:!0,get:I})},R.r=function(X){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(X,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(X,"__esModule",{value:!0})},R.t=function(X,N){if(N&1&&(X=R(X)),N&8)return X;if(N&4&&typeof X=="object"&&X&&X.__esModule)return X;var I=Object.create(null);if(R.r(I),Object.defineProperty(I,"default",{enumerable:!0,value:X}),N&2&&typeof X!="string")for(var z in X)R.d(I,z,function(j){return X[j]}.bind(null,z));return I},R.n=function(X){var N=X&&X.__esModule?function(){return X.default}:function(){return X};return R.d(N,"a",N),N},R.o=function(X,N){return Object.prototype.hasOwnProperty.call(X,N)},R.p="/dist/",R(R.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ae,$,R){"use strict";var X=Object.prototype.hasOwnProperty,N="~";function I(){}Object.create&&(I.prototype=Object.create(null),new I().__proto__||(N=!1));function z(E,L,D){this.fn=E,this.context=L,this.once=D||!1}function j(E,L,D,T,A){if(typeof D!="function")throw new TypeError("The listener must be a function");var w=new z(D,T||E,A),h=N?N+L:L;return E._events[h]?E._events[h].fn?E._events[h]=[E._events[h],w]:E._events[h].push(w):(E._events[h]=w,E._eventsCount++),E}function O(E,L){--E._eventsCount===0?E._events=new I:delete E._events[L]}function P(){this._events=new I,this._eventsCount=0}P.prototype.eventNames=function(){var L=[],D,T;if(this._eventsCount===0)return L;for(T in D=this._events)X.call(D,T)&&L.push(N?T.slice(1):T);return Object.getOwnPropertySymbols?L.concat(Object.getOwnPropertySymbols(D)):L},P.prototype.listeners=function(L){var D=N?N+L:L,T=this._events[D];if(!T)return[];if(T.fn)return[T.fn];for(var A=0,w=T.length,h=new Array(w);A0},!1)}function E(L,D){for(var T={main:[D]},A={main:[]},w={main:{}};P(T);)for(var h=Object.keys(T),o=0;o=2*l/f||x<=H)return;var V=Number.POSITIVE_INFINITY,Q;for(Q=h.level-1;Q>s;Q--){var G=p[Q].maxBitrate;if(V=l*G/(8*.8*v),V=x)return;var W=this.bwEstimator.getEstimate();P.logger.warn("Fragment "+h.sn+(o?" part "+o.index:"")+" of level "+h.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+Q+` Current BW estimate: `+(Object(X.isFiniteNumber)(W)?(W/1024).toFixed(3):"Unknown")+` Kb/s Estimated load time for current fragment: `+x.toFixed(3)+` s Estimated load time for the next fragment: `+V.toFixed(3)+` s Time to underbuffer: `+H.toFixed(3)+" s"),d.nextLoadLevel=Q,this.bwEstimator.sample(S,m.loaded),this.clearTimer(),h.loader&&(this.fragCurrent=this.partCurrent=null,h.loader.abort()),d.trigger(I.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:h,part:o,stats:m})},A.onFragLoaded=function(h,o){var d=o.frag,c=o.part;if(d.type===O.PlaylistLevelType.MAIN&&Object(X.isFiniteNumber)(d.sn)){var C=c?c.stats:d.stats,y=c?c.duration:d.duration;if(this.clearTimer(),this.lastLoadedFragLevel=d.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var m=this.hls.levels[d.level],l=(m.loaded?m.loaded.bytes:0)+C.loaded,S=(m.loaded?m.loaded.duration:0)+y;m.loaded={bytes:l,duration:S},m.realBitrate=Math.round(8*l/S)}if(d.bitrateTest){var f={stats:C,frag:d,part:c,id:d.type};this.onFragBuffered(I.Events.FRAG_BUFFERED,f),d.bitrateTest=!1}}},A.onFragBuffered=function(h,o){var d=o.frag,c=o.part,C=c?c.stats:d.stats;if(C.aborted)return;if(d.type!==O.PlaylistLevelType.MAIN||d.sn==="initSegment")return;var y=C.parsing.end-C.loading.start;this.bwEstimator.sample(y,C.loaded),C.bwEstimate=this.bwEstimator.getEstimate(),d.bitrateTest?this.bitrateTestDelay=y/1e3:this.bitrateTestDelay=0},A.onError=function(h,o){switch(o.details){case j.ErrorDetails.FRAG_LOAD_ERROR:case j.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},A.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},A.getNextABRAutoLevel=function(){var h=this.fragCurrent,o=this.partCurrent,d=this.hls,c=d.maxAutoLevel,C=d.config,y=d.minAutoLevel,m=d.media,l=o?o.duration:h?h.duration:0,S=m?m.currentTime:0,f=m&&m.playbackRate!==0?Math.abs(m.playbackRate):1,p=this.bwEstimator?this.bwEstimator.getEstimate():C.abrEwmaDefaultEstimate,s=(z.BufferHelper.bufferInfo(m,S,C.maxBufferHole).end-S)/f,a=this.findBestLevel(p,y,c,s,C.abrBandWidthFactor,C.abrBandWidthUpFactor);if(a>=0)return a;P.logger.trace((s?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var b=l?Math.min(l,C.maxStarvationDelay):C.maxStarvationDelay,v=C.abrBandWidthFactor,x=C.abrBandWidthUpFactor;if(!s){var k=this.bitrateTestDelay;if(k){var H=l?Math.min(l,C.maxLoadingDelay):C.maxLoadingDelay;b=H-k,P.logger.trace("bitrate test took "+Math.round(1e3*k)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*b)+" ms"),v=x=1}}return a=this.findBestLevel(p,y,c,s+b,v,x),Math.max(a,0)},A.findBestLevel=function(h,o,d,c,C,y){for(var m,l=this.fragCurrent,S=this.partCurrent,f=this.lastLoadedFragLevel,p=this.hls.levels,s=p[f],a=!!(s!=null&&(m=s.details)!==null&&m!==void 0&&m.live),b=s==null?void 0:s.codecSet,v=S?S.duration:l?l.duration:0,x=d;x>=o;x--){var k=p[x];if(!k||b&&k.codecSet!==b)continue;var H=k.details,V=(S?H==null?void 0:H.partTarget:H==null?void 0:H.averagetargetduration)||v,Q=void 0;x<=f?Q=C*h:Q=y*h;var G=p[x].maxBitrate,W=G*V/Q;if(P.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+x+"/"+Math.round(Q)+"/"+G+"/"+V+"/"+c+"/"+W),Q>G&&(!W||a&&!this.bitrateTestDelay||W0&&s===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=N.State.IDLE):(this.loadedmetadata=!1,this.state=N.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=s,this.tick()},f.doTick=function(){switch(this.state){case N.State.IDLE:this.doTickIdle();break;case N.State.WAITING_TRACK:{var s,a=this.levels,b=this.trackId,v=a==null||((s=a[b])===null||s===void 0)?void 0:s.details;if(v){if(this.waitForCdnTuneIn(v))break;this.state=N.State.WAITING_INIT_PTS}break}case N.State.FRAG_LOADING_WAITING_RETRY:{var x,k=performance.now(),H=this.retryDate;(!H||k>=H||(x=this.media)!==null&&x!==void 0&&x.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=N.State.IDLE);break}case N.State.WAITING_INIT_PTS:{var V=this.waitingData;if(V){var Q=V.frag,G=V.part,W=V.cache,q=V.complete;if(this.initPTS[Q.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=N.State.FRAG_LOADING;var oe=W.flush(),fe={frag:Q,part:G,payload:oe,networkDetails:null};this._handleFragmentLoadProgress(fe),q&&l.prototype._handleFragmentLoadComplete.call(this,fe)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+Q.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ve=this.getLoadPosition(),ke=z.BufferHelper.bufferInfo(this.mediaBuffer,ve,this.config.maxBufferHole),Ee=Object(A.fragmentWithinToleranceTest)(ke.end,this.config.maxFragLookUpTolerance,Q);Ee<0&&(o.logger.log("Waiting fragment cc ("+Q.cc+") @ "+Q.start+" cancelled because another fragment at "+ke.end+" is needed"),this.clearWaitingFragment())}}else this.state=N.State.IDLE}}this.onTickEnd()},f.clearWaitingFragment=function(){var s=this.waitingData;s&&(this.fragmentTracker.removeFragment(s.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=N.State.IDLE)},f.onTickEnd=function(){var s=this.media;if(!s||!s.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:s,b=a.buffered;!this.loadedmetadata&&b.length&&(this.loadedmetadata=!0),this.lastCurrentTime=s.currentTime},f.doTickIdle=function(){var s,a,b=this.hls,v=this.levels,x=this.media,k=this.trackId,H=b.config;if(!v||!v[k])return;if(!x&&(this.startFragRequested||!H.startFragPrefetch))return;var V=v[k],Q=V.details;if(!Q||Q.live&&this.levelLastLoaded!==k||this.waitForCdnTuneIn(Q)){this.state=N.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,E.ElementaryStreamTypes.AUDIO,P.PlaylistLevelType.AUDIO));var G=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,P.PlaylistLevelType.AUDIO);if(G===null)return;var W=G.len,q=this.getMaxBufferLength(),oe=this.audioSwitch;if(W>=q&&!oe)return;if(!oe&&this._streamEnded(G,Q)){b.trigger(I.Events.BUFFER_EOS,{type:"audio"}),this.state=N.State.ENDED;return}var fe=Q.fragments,ve=fe[0].start,ke=G.end;if(oe){var Ee=this.getLoadPosition();ke=Ee,Q.PTSKnown&&Eeve||G.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),x.currentTime=ve+.05))}var _e=this.getNextFragment(ke,Q);if(!_e){this.bufferFlushed=!0;return}((s=_e.decryptdata)===null||s===void 0?void 0:s.keyFormat)==="identity"&&!((a=_e.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(_e,Q):this.loadFragment(_e,Q,ke)},f.getMaxBufferLength=function(){var s=l.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,P.PlaylistLevelType.MAIN);return a===null?s:Math.max(s,a.len)},f.onMediaDetaching=function(){this.videoBuffer=null,l.prototype.onMediaDetaching.call(this)},f.onAudioTracksUpdated=function(s,a){var b=a.audioTracks;this.resetTransmuxer(),this.levels=b.map(function(v){return new O.Level(v)})},f.onAudioTrackSwitching=function(s,a){var b=!!a.url;this.trackId=a.id;var v=this.fragCurrent;v!=null&&v.loader&&v.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),b?this.setInterval(y):this.resetTransmuxer(),b?(this.audioSwitch=!0,this.state=N.State.IDLE):this.state=N.State.STOPPED,this.tick()},f.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},f.onLevelLoaded=function(s,a){this.mainDetails=a.details},f.onAudioTrackLoaded=function(s,a){var b,v=this.levels,x=a.details,k=a.id;if(!v){this.warn("Audio tracks were reset while loading level "+k);return}this.log("Track "+k+" loaded ["+x.startSN+","+x.endSN+"],duration:"+x.totalduration);var H=v[k],V=0;if(x.live||(b=H.details)!==null&&b!==void 0&&b.live){var Q=this.mainDetails;if(x.fragments[0]||(x.deltaUpdateFailed=!0),x.deltaUpdateFailed||!Q)return;!H.details&&x.hasProgramDateTime&&Q.hasProgramDateTime?(Object(w.alignMediaPlaylistByPDT)(x,Q),V=x.fragments[0].start):V=this.alignPlaylists(x,H.details)}H.details=x,this.levelLastLoaded=k,!this.startFragRequested&&(this.mainDetails||!x.live)&&this.setStartPosition(H.details,V),this.state===N.State.WAITING_TRACK&&!this.waitForCdnTuneIn(x)&&(this.state=N.State.IDLE),this.tick()},f._handleFragmentLoadProgress=function(s){var a,b=s.frag,v=s.part,x=s.payload,k=this.config,H=this.trackId,V=this.levels;if(!V){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+b.sn+" of level "+b.level+" will not be buffered");return}var Q=V[H];console.assert(Q,"Audio track is defined on fragment load progress");var G=Q.details;console.assert(G,"Audio track details are defined on fragment load progress");var W=k.defaultAudioCodec||Q.audioCodec||"mp4a.40.2",q=this.transmuxer;q||(q=this.transmuxer=new D.default(this.hls,P.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var oe=this.initPTS[b.cc],fe=(a=b.initSegment)===null||a===void 0?void 0:a.data;if(oe!==void 0){var ve=!1,ke=v?v.index:-1,Ee=ke!==-1,_e=new T.ChunkMetadata(b.level,b.sn,b.stats.chunkCount,x.byteLength,ke,Ee);q.push(x,fe,W,"",b,v,G.totalduration,ve,_e,oe)}else{o.logger.log("Unknown video PTS for cc "+b.cc+", waiting for video PTS before demuxing audio frag "+b.sn+" of ["+G.startSN+" ,"+G.endSN+"],track "+H);var Te=this.waitingData=this.waitingData||{frag:b,part:v,cache:new L.default,complete:!1},Ce=Te.cache;Ce.push(new Uint8Array(x)),this.waitingVideoCC=this.videoTrackCC,this.state=N.State.WAITING_INIT_PTS}},f._handleFragmentLoadComplete=function(s){if(this.waitingData){this.waitingData.complete=!0;return}l.prototype._handleFragmentLoadComplete.call(this,s)},f.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},f.onBufferCreated=function(s,a){var b=a.tracks.audio;b&&(this.mediaBuffer=b.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},f.onFragBuffered=function(s,a){var b=a.frag,v=a.part;if(b.type!==P.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(b)){this.warn("Fragment "+b.sn+(v?" p: "+v.index:"")+" of level "+b.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}b.sn!=="initSegment"&&(this.fragPrevious=b,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(I.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(b,v)},f.onError=function(s,a){switch(a.details){case h.ErrorDetails.FRAG_LOAD_ERROR:case h.ErrorDetails.FRAG_LOAD_TIMEOUT:case h.ErrorDetails.KEY_LOAD_ERROR:case h.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(P.PlaylistLevelType.AUDIO,a);break;case h.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case h.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==N.State.ERROR&&this.state!==N.State.STOPPED&&(this.state=a.fatal?N.State.ERROR:N.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case h.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===N.State.PARSING||this.state===N.State.PARSED)){var b=!0,v=this.getFwdBufferInfo(this.mediaBuffer,P.PlaylistLevelType.AUDIO);v&&v.len>.5&&(b=!this.reduceMaxBufferLength(v.len)),b&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,l.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},f.onBufferFlushed=function(s,a){var b=a.type;b===E.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},f._handleTransmuxComplete=function(s){var a,b="audio",v=this.hls,x=s.remuxResult,k=s.chunkMeta,H=this.getCurrentContext(k);if(!H){this.warn("The loading context changed while buffering fragment "+k.sn+" of level "+k.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(k.level);return}var V=H.frag,Q=H.part,G=x.audio,W=x.text,q=x.id3,oe=x.initSegment;if(this.fragContextChanged(V))return;if(this.state=N.State.PARSING,this.audioSwitch&&G&&this.completeAudioSwitch(),oe!=null&&oe.tracks&&(this._bufferInitSegment(oe.tracks,V,k),v.trigger(I.Events.FRAG_PARSING_INIT_SEGMENT,{frag:V,id:b,tracks:oe.tracks})),G){var fe=G.startPTS,ve=G.endPTS,ke=G.startDTS,Ee=G.endDTS;Q&&(Q.elementaryStreams[E.ElementaryStreamTypes.AUDIO]={startPTS:fe,endPTS:ve,startDTS:ke,endDTS:Ee}),V.setElementaryStreamInfo(E.ElementaryStreamTypes.AUDIO,fe,ve,ke,Ee),this.bufferFragmentData(G,V,Q,k)}if(q!=null&&(a=q.samples)!==null&&a!==void 0&&a.length){var _e=d({frag:V,id:b},q);v.trigger(I.Events.FRAG_PARSING_METADATA,_e)}if(W){var Te=d({frag:V,id:b},W);v.trigger(I.Events.FRAG_PARSING_USERDATA,Te)}},f._bufferInitSegment=function(s,a,b){if(this.state!==N.State.PARSING)return;s.video&&delete s.video;var v=s.audio;if(!v)return;v.levelCodec=v.codec,v.id="audio",this.log("Init audio buffer, container:"+v.container+", codecs[parsed]=["+v.codec+"]"),this.hls.trigger(I.Events.BUFFER_CODECS,s);var x=v.initSegment;if(x!=null&&x.byteLength){var k={type:"audio",frag:a,part:null,chunkMeta:b,parent:a.type,data:x};this.hls.trigger(I.Events.BUFFER_APPENDING,k)}this.tick()},f.loadFragment=function(s,a,b){var v=this.fragmentTracker.getState(s);this.fragCurrent=s,(this.audioSwitch||v===j.FragmentState.NOT_LOADED||v===j.FragmentState.PARTIAL)&&(s.sn==="initSegment"?this._loadInitSegment(s):a.live&&!Object(X.isFiniteNumber)(this.initPTS[s.cc])?(this.log("Waiting for video PTS in continuity counter "+s.cc+" of live stream before loading audio fragment "+s.sn+" of level "+this.trackId),this.state=N.State.WAITING_INIT_PTS):(this.startFragRequested=!0,l.prototype.loadFragment.call(this,s,a,b)))},f.completeAudioSwitch=function(){var s=this.hls,a=this.media,b=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),l.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,s.trigger(I.Events.AUDIO_TRACK_SWITCHED,{id:b})},S}(N.default);$.default=m},"./src/controller/audio-track-controller.ts":function(ae,$,R){"use strict";R.r($);var X=R("./src/events.ts"),N=R("./src/errors.ts"),I=R("./src/controller/base-playlist-controller.ts"),z=R("./src/types/loader.ts");function j(D,T){for(var A=0;A=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var d=o[this.trackId];this.log("Now switching to audio-track index "+h);var c=o[h],C=c.id,y=c.groupId,m=y===void 0?"":y,l=c.name,S=c.type,f=c.url;if(this.trackId=h,this.trackName=l,this.selectDefaultTrack=!1,this.hls.trigger(X.Events.AUDIO_TRACK_SWITCHING,{id:C,groupId:m,name:l,type:S,url:f}),c.details&&!c.details.live)return;var p=this.switchParams(c.url,d==null?void 0:d.details);this.loadPlaylist(p)},A.selectInitialTrack=function(){var h=this.tracksInGroup;console.assert(h.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,d=this.findTrackId(o)||this.findTrackId();d!==-1?this.setAudioTrack(d):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(X.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},A.findTrackId=function(h){for(var o=this.tracksInGroup,d=0;dT.partTarget&&(c+=1)}if(Object(X.isFiniteNumber)(d))return new N.HlsUrlParameters(d,Object(X.isFiniteNumber)(c)?c:void 0,N.HlsSkip.No)}}},E.loadPlaylist=function(D){},E.shouldLoadTrack=function(D){return this.canLoad&&D&&!!D.url&&(!D.details||D.details.live)},E.playlistLoaded=function(D,T,A){var w=this,h=T.details,o=T.stats,d=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(h.advancedDateTime=Date.now()-d,h.live||A!=null&&A.live){if(h.reloaded(A),A&&this.log("live playlist "+D+" "+(h.advanced?"REFRESHED "+h.lastPartSn+"-"+h.lastPartIndex:"MISSED")),A&&h.fragments.length>0&&Object(I.mergeDetails)(A,h),!this.canLoad||!h.live)return;var c,C=void 0,y=void 0;if(h.canBlockReload&&h.endSN&&h.advanced){var m=this.hls.config.lowLatencyMode,l=h.lastPartSn,S=h.endSN,f=h.lastPartIndex,p=f!==-1,s=l===S,a=m?0:f;p?(C=s?S+1:l,y=s?a:f+1):C=S+1;var b=h.age,v=b+h.ageHeader,x=Math.min(v-h.partTarget,h.targetduration*1.5);if(x>0){if(A&&x>A.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+A.tuneInGoal+" to: "+x+" with playlist age: "+h.age),x=0;else{var k=Math.floor(x/h.targetduration);if(C+=k,y!==void 0){var H=Math.round(x%h.targetduration/h.partTarget);y+=H}this.log("CDN Tune-in age: "+h.ageHeader+"s last advanced "+b.toFixed(2)+"s goal: "+x+" skip sn "+k+" to part "+y)}h.tuneInGoal=x}if(c=this.getDeliveryDirectives(h,T.deliveryDirectives,C,y),m||!s){this.loadPlaylist(c);return}}else c=this.getDeliveryDirectives(h,T.deliveryDirectives,C,y);var V=Object(I.computeReloadInterval)(h,o);C!==void 0&&h.canBlockReload&&(V-=h.partTarget||1),this.log("reload live playlist "+D+" in "+Math.round(V)+" ms"),this.timer=self.setTimeout(function(){return w.loadPlaylist(c)},V)}else this.clearTimer()},E.getDeliveryDirectives=function(D,T,A,w){var h=Object(N.getSkipValue)(D,A);return T!=null&&T.skip&&D.deltaUpdateFailed&&(A=T.msn,w=T.part,h=N.HlsSkip.No),new N.HlsUrlParameters(A,w,h)},E.retryLoadingOrFail=function(D){var T=this,A=this.hls.config,w=this.retryCount-1&&(h=D.context)!==null&&h!==void 0&&h.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+D.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*A.levelLoadingRetryDelay,A.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return T.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+D.details+'"')}}else this.warn('cannot recover from error "'+D.details+'"'),this.clearTimer(),D.fatal=!0;return w},P}()},"./src/controller/base-stream-controller.ts":function(ae,$,R){"use strict";R.r($),R.d($,"State",function(){return S}),R.d($,"default",function(){return f});var X=R("./src/polyfills/number.ts"),N=R("./src/task-loop.ts"),I=R("./src/controller/fragment-tracker.ts"),z=R("./src/utils/buffer-helper.ts"),j=R("./src/utils/logger.ts"),O=R("./src/events.ts"),P=R("./src/errors.ts"),E=R("./src/types/transmuxer.ts"),L=R("./src/utils/mp4-tools.ts"),D=R("./src/utils/discontinuities.ts"),T=R("./src/controller/fragment-finders.ts"),A=R("./src/controller/level-helper.ts"),w=R("./src/loader/fragment-loader.ts"),h=R("./src/crypt/decrypter.ts"),o=R("./src/utils/time-ranges.ts"),d=R("./src/types/loader.ts");function c(p,s){for(var a=0;aoe;(Q0&&Q&&Q.key&&Q.iv&&Q.method==="AES-128"){var G=self.performance.now();return x.decrypter.webCryptoDecrypt(new Uint8Array(V),Q.key.buffer,Q.iv.buffer).then(function(W){var q=self.performance.now();return H.trigger(O.Events.FRAG_DECRYPTED,{frag:v,payload:W,stats:{tstart:G,tdecrypt:q}}),k.payload=W,k})}return k}).then(function(k){var H=x.fragCurrent,V=x.hls,Q=x.levels;if(!Q)throw new Error("init load aborted, missing levels");var G=Q[v.level].details;console.assert(G,"Level details are defined when init segment is loaded");var W=v.stats;x.state=S.IDLE,x.fragLoadError=0,v.data=new Uint8Array(k.payload),W.parsing.start=W.buffering.start=self.performance.now(),W.parsing.end=W.buffering.end=self.performance.now(),k.frag===H&&V.trigger(O.Events.FRAG_BUFFERED,{stats:W,frag:H,part:null,id:v.type}),x.tick()}).catch(function(k){x.warn(k),x.resetFragmentLoading(v)})},a.fragContextChanged=function(v){var x=this.fragCurrent;return!v||!x||v.level!==x.level||v.sn!==x.sn||v.urlId!==x.urlId},a.fragBufferedComplete=function(v,x){var k=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+v.type+" sn: "+v.sn+(x?" part: "+x.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+v.level+" "+o.default.toString(z.BufferHelper.getBuffered(k))),this.state=S.IDLE,this.tick()},a._handleFragmentLoadComplete=function(v){var x=this.transmuxer;if(!x)return;var k=v.frag,H=v.part,V=v.partsLoaded,Q=!V||V.length===0||V.some(function(W){return!W}),G=new E.ChunkMetadata(k.level,k.sn,k.stats.chunkCount+1,0,H?H.index:-1,!Q);x.flush(G)},a._handleFragmentLoadProgress=function(v){},a._doFragLoad=function(v,x,k,H){var V=this;if(k===void 0&&(k=null),!this.levels)throw new Error("frag load aborted, missing levels");if(k=Math.max(v.start,k||0),this.config.lowLatencyMode&&x){var Q=x.partList;if(Q&&H){k>v.end&&x.fragmentHint&&(v=x.fragmentHint);var G=this.getNextPart(Q,v,k);if(G>-1){var W=Q[G];return this.log("Loading part sn: "+v.sn+" p: "+W.index+" cc: "+v.cc+" of playlist ["+x.startSN+"-"+x.endSN+"] parts [0-"+G+"-"+(Q.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+v.level+", target: "+parseFloat(k.toFixed(3))),this.nextLoadPosition=W.start+W.duration,this.state=S.FRAG_LOADING,this.hls.trigger(O.Events.FRAG_LOADING,{frag:v,part:Q[G],targetBufferTime:k}),this.doFragPartsLoad(v,Q,G,H).catch(function(q){return V.handleFragLoadError(q)})}else if(!v.url||this.loadedEndOfParts(Q,k))return Promise.resolve(null)}}return this.log("Loading fragment "+v.sn+" cc: "+v.cc+" "+(x?"of ["+x.startSN+"-"+x.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+v.level+", target: "+parseFloat(k.toFixed(3))),Object(X.isFiniteNumber)(v.sn)&&!this.bitrateTest&&(this.nextLoadPosition=v.start+v.duration),this.state=S.FRAG_LOADING,this.hls.trigger(O.Events.FRAG_LOADING,{frag:v,targetBufferTime:k}),this.fragmentLoader.load(v,H).catch(function(q){return V.handleFragLoadError(q)})},a.doFragPartsLoad=function(v,x,k,H){var V=this;return new Promise(function(Q,G){var W=[],q=function oe(fe){var ve=x[fe];V.fragmentLoader.loadPart(v,ve,H).then(function(ke){W[ve.index]=ke;var Ee=ke.part;V.hls.trigger(O.Events.FRAG_LOADED,ke);var _e=x[fe+1];if(_e&&_e.fragment===v)oe(fe+1);else return Q({frag:v,part:Ee,partsLoaded:W})}).catch(G)};q(k)})},a.handleFragLoadError=function(v){var x=v.data;return x&&x.details===P.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(x.frag,x.part):this.hls.trigger(O.Events.ERROR,x),null},a._handleTransmuxerFlush=function(v){var x=this.getCurrentContext(v);if(!x||this.state!==S.PARSING){this.fragCurrent||(this.state=S.IDLE);return}var k=x.frag,H=x.part,V=x.level,Q=self.performance.now();k.stats.parsing.end=Q,H&&(H.stats.parsing.end=Q),this.updateLevelTiming(k,H,V,v.partial)},a.getCurrentContext=function(v){var x=this.levels,k=v.level,H=v.sn,V=v.part;if(!x||!x[k])return this.warn("Levels object was unset while buffering fragment "+H+" of level "+k+". The current chunk will not be buffered."),null;var Q=x[k],G=V>-1?Object(A.getPartWith)(Q,H,V):null,W=G?G.fragment:Object(A.getFragmentWithSN)(Q,H,this.fragCurrent);return W?{frag:W,part:G,level:Q}:null},a.bufferFragmentData=function(v,x,k,H){if(!v||this.state!==S.PARSING)return;var V=v.data1,Q=v.data2,G=V;if(V&&Q&&(G=Object(L.appendUint8Array)(V,Q)),!G||!G.length)return;var W={type:v.type,frag:x,part:k,chunkMeta:H,parent:x.type,data:G};this.hls.trigger(O.Events.BUFFER_APPENDING,W),v.dropped&&v.independent&&!k&&this.flushBufferGap(x)},a.flushBufferGap=function(v){var x=this.media;if(!x)return;if(!z.BufferHelper.isBuffered(x,x.currentTime)){this.flushMainBuffer(0,v.start);return}var k=x.currentTime,H=z.BufferHelper.bufferInfo(x,k,0),V=v.duration,Q=Math.min(this.config.maxFragLookUpTolerance*2,V*.25),G=Math.max(Math.min(v.start-Q,H.end-Q),k+Q);v.start-G>Q&&this.flushMainBuffer(G,v.start)},a.getFwdBufferInfo=function(v,x){var k=this.config,H=this.getLoadPosition();if(!Object(X.isFiniteNumber)(H))return null;var V=z.BufferHelper.bufferInfo(v,H,k.maxBufferHole);if(V.len===0&&V.nextStart!==void 0){var Q=this.fragmentTracker.getBufferedFrag(H,x);if(Q&&V.nextStart=k?(x.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+x.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(v,x){var k,H,V=x.fragments,Q=V.length;if(!Q)return null;var G=this.config,W=V[0].start,q;if(x.live){var oe=G.initialLiveManifestSize;if(Q-1&&kk.start&&k.loaded},a.getInitialLiveFragment=function(v,x){var k=this.fragPrevious,H=null;if(k){if(v.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+k.programDateTime),H=Object(T.findFragmentByPDT)(x,k.endProgramDateTime,this.config.maxFragLookUpTolerance)),!H){var V=k.sn+1;if(V>=v.startSN&&V<=v.endSN){var Q=x[V-v.startSN];k.cc===Q.cc&&(H=Q,this.log("Live playlist, switching playlist, load frag with next SN: "+H.sn))}H||(H=Object(T.findFragWithCC)(x,k.cc),H&&this.log("Live playlist, switching playlist, load frag with same CC: "+H.sn))}}else{var G=this.hls.liveSyncPosition;G!==null&&(H=this.getFragmentAtPosition(G,this.bitrateTest?v.fragmentEnd:v.edge,v))}return H},a.getFragmentAtPosition=function(v,x,k){var H=this.config,V=this.fragPrevious,Q=k.fragments,G=k.endSN,W=k.fragmentHint,q=H.maxFragLookUpTolerance,oe=!!(H.lowLatencyMode&&k.partList&&W);oe&&W&&!this.bitrateTest&&(Q=Q.concat(W),G=W.sn);var fe;if(vx-q?0:q;fe=Object(T.findFragmentByPTS)(V,Q,v,ve)}else fe=Q[Q.length-1];if(fe){var ke=fe.sn-k.startSN,Ee=V&&fe.level===V.level,_e=Q[ke+1],Te=this.fragmentTracker.getState(fe);if(Te===I.FragmentState.BACKTRACKED){fe=null;for(var Ce=ke;Q[Ce]&&this.fragmentTracker.getState(Q[Ce])===I.FragmentState.BACKTRACKED;)V?fe=Q[Ce--]:fe=Q[--Ce];fe||(fe=_e)}else V&&fe.sn===V.sn&&!oe&&(Ee&&(fe.sn=Q-x.maxFragLookUpTolerance&&V<=G;if(H!==null&&k.duration>H&&(V"+v.startSN+" prev-sn: "+(V?V.sn:"na")+" fragments: "+G),fe}return W},a.waitForCdnTuneIn=function(v){var x=3;return v.live&&v.canBlockReload&&v.tuneInGoal>Math.max(v.partHoldBack,v.partTarget*x)},a.setStartPosition=function(v,x){var k=this.startPosition;if(k"+v))}}]),s}(N.default)},"./src/controller/buffer-controller.ts":function(ae,$,R){"use strict";R.r($),R.d($,"default",function(){return T});var X=R("./src/polyfills/number.ts"),N=R("./src/events.ts"),I=R("./src/utils/logger.ts"),z=R("./src/errors.ts"),j=R("./src/utils/buffer-helper.ts"),O=R("./src/utils/mediasource-helper.ts"),P=R("./src/loader/fragment.ts"),E=R("./src/controller/buffer-operation-queue.ts"),L=Object(O.getMediaSource)(),D=/([ha]vc.)(?:\.[^.,]+)+/,T=function(){function A(h){var o=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 d=o.hls,c=o.media,C=o.mediaSource;I.logger.log("[buffer-controller]: Media source opened"),c&&(o.updateMediaElementDuration(),d.trigger(N.Events.MEDIA_ATTACHED,{media:c})),C&&C.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){I.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){I.logger.log("[buffer-controller]: Media source ended")},this.hls=h,this._initSourceBuffer(),this.registerListeners()}var w=A.prototype;return w.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},w.destroy=function(){this.unregisterListeners(),this.details=null},w.registerListeners=function(){var o=this.hls;o.on(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(N.Events.BUFFER_RESET,this.onBufferReset,this),o.on(N.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(N.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(N.Events.BUFFER_EOS,this.onBufferEos,this),o.on(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(N.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(N.Events.FRAG_PARSED,this.onFragParsed,this),o.on(N.Events.FRAG_CHANGED,this.onFragChanged,this)},w.unregisterListeners=function(){var o=this.hls;o.off(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(N.Events.BUFFER_RESET,this.onBufferReset,this),o.off(N.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(N.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(N.Events.BUFFER_EOS,this.onBufferEos,this),o.off(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(N.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(N.Events.FRAG_PARSED,this.onFragParsed,this),o.off(N.Events.FRAG_CHANGED,this.onFragChanged,this)},w._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new E.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},w.onManifestParsed=function(o,d){var c=2;(d.audio&&!d.video||!d.altAudio)&&(c=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=c,this.details=null,I.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},w.onMediaAttaching=function(o,d){var c=this.media=d.media;if(c&&L){var C=this.mediaSource=new L;C.addEventListener("sourceopen",this._onMediaSourceOpen),C.addEventListener("sourceended",this._onMediaSourceEnded),C.addEventListener("sourceclose",this._onMediaSourceClose),c.src=self.URL.createObjectURL(C),this._objectUrl=c.src}},w.onMediaDetaching=function(){var o=this.media,d=this.mediaSource,c=this._objectUrl;if(d){if(I.logger.log("[buffer-controller]: media source detaching"),d.readyState==="open")try{d.endOfStream()}catch(C){I.logger.warn("[buffer-controller]: onMediaDetaching: "+C.message+" while calling endOfStream")}this.onBufferReset(),d.removeEventListener("sourceopen",this._onMediaSourceOpen),d.removeEventListener("sourceended",this._onMediaSourceEnded),d.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(c&&self.URL.revokeObjectURL(c),o.src===c?(o.removeAttribute("src"),o.load()):I.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(N.Events.MEDIA_DETACHED,void 0)},w.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(d){var c=o.sourceBuffer[d];try{c&&(o.removeBufferListeners(d),o.mediaSource&&o.mediaSource.removeSourceBuffer(c),o.sourceBuffer[d]=void 0)}catch(C){I.logger.warn("[buffer-controller]: Failed to reset the "+d+" buffer",C)}}),this._initSourceBuffer()},w.onBufferCodecs=function(o,d){var c=this,C=this.getSourceBufferTypes().length;if(Object.keys(d).forEach(function(y){if(C){var m=c.tracks[y];if(m&&typeof m.buffer.changeType=="function"){var l=d[y],S=l.codec,f=l.levelCodec,p=l.container,s=(m.levelCodec||m.codec).replace(D,"$1"),a=(f||S).replace(D,"$1");if(s!==a){var b=p+";codecs="+(f||S);c.appendChangeType(y,b)}}}else c.pendingTracks[y]=d[y]}),C)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},w.appendChangeType=function(o,d){var c=this,C=this.operationQueue,y={execute:function(){var l=c.sourceBuffer[o];l&&(I.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+d),l.changeType(d)),C.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(l){I.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",l)}};C.append(y,o)},w.onBufferAppending=function(o,d){var c=this,C=this.hls,y=this.operationQueue,m=this.tracks,l=d.data,S=d.type,f=d.frag,p=d.part,s=d.chunkMeta,a=s.buffering[S],b=self.performance.now();a.start=b;var v=f.stats.buffering,x=p?p.stats.buffering:null;v.start===0&&(v.start=b),x&&x.start===0&&(x.start=b);var k=m.audio,H=S==="audio"&&s.id===1&&(k==null?void 0:k.container)==="audio/mpeg",V={execute:function(){if(a.executeStart=self.performance.now(),H){var G=c.sourceBuffer[S];if(G){var W=f.start-G.timestampOffset;Math.abs(W)>=.1&&(I.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+f.start+" (delta: "+W+") sn: "+f.sn+")"),G.timestampOffset=f.start)}}c.appendExecutor(l,S)},onStart:function(){},onComplete:function(){var G=self.performance.now();a.executeEnd=a.end=G,v.first===0&&(v.first=G),x&&x.first===0&&(x.first=G);var W=c.sourceBuffer,q={};for(var oe in W)q[oe]=j.BufferHelper.getBuffered(W[oe]);c.appendError=0,c.hls.trigger(N.Events.BUFFER_APPENDED,{type:S,frag:f,part:p,chunkMeta:s,parent:f.type,timeRanges:q})},onError:function(G){I.logger.error("[buffer-controller]: Error encountered while trying to append to the "+S+" SourceBuffer",G);var W={type:z.ErrorTypes.MEDIA_ERROR,parent:f.type,details:z.ErrorDetails.BUFFER_APPEND_ERROR,err:G,fatal:!1};G.code===DOMException.QUOTA_EXCEEDED_ERR?W.details=z.ErrorDetails.BUFFER_FULL_ERROR:(c.appendError++,W.details=z.ErrorDetails.BUFFER_APPEND_ERROR,c.appendError>C.config.appendErrorMaxRetry&&(I.logger.error("[buffer-controller]: Failed "+C.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),W.fatal=!0)),C.trigger(N.Events.ERROR,W)}};y.append(V,S)},w.onBufferFlushing=function(o,d){var c=this,C=this.operationQueue,y=function(l){return{execute:c.removeExecutor.bind(c,l,d.startOffset,d.endOffset),onStart:function(){},onComplete:function(){c.hls.trigger(N.Events.BUFFER_FLUSHED,{type:l})},onError:function(f){I.logger.warn("[buffer-controller]: Failed to remove from "+l+" SourceBuffer",f)}}};d.type?C.append(y(d.type),d.type):this.getSourceBufferTypes().forEach(function(m){C.append(y(m),m)})},w.onFragParsed=function(o,d){var c=this,C=d.frag,y=d.part,m=[],l=y?y.elementaryStreams:C.elementaryStreams;l[P.ElementaryStreamTypes.AUDIOVIDEO]?m.push("audiovideo"):(l[P.ElementaryStreamTypes.AUDIO]&&m.push("audio"),l[P.ElementaryStreamTypes.VIDEO]&&m.push("video"));var S=function(){var p=self.performance.now();C.stats.buffering.end=p,y&&(y.stats.buffering.end=p);var s=y?y.stats:C.stats;c.hls.trigger(N.Events.FRAG_BUFFERED,{frag:C,part:y,stats:s,id:C.type})};m.length===0&&I.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+C.type+" level: "+C.level+" sn: "+C.sn),this.blockBuffers(S,m)},w.onFragChanged=function(o,d){this.flushBackBuffer()},w.onBufferEos=function(o,d){var c=this,C=this.getSourceBufferTypes().reduce(function(y,m){var l=c.sourceBuffer[m];return(!d.type||d.type===m)&&(l&&!l.ended&&(l.ended=!0,I.logger.log("[buffer-controller]: "+m+" sourceBuffer now EOS"))),y&&!!(!l||l.ended)},!0);C&&this.blockBuffers(function(){var y=c.mediaSource;if(!y||y.readyState!=="open")return;y.endOfStream()})},w.onLevelUpdated=function(o,d){var c=d.details;if(!c.fragments.length)return;this.details=c,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},w.flushBackBuffer=function(){var o=this.hls,d=this.details,c=this.media,C=this.sourceBuffer;if(!c||d===null)return;var y=this.getSourceBufferTypes();if(!y.length)return;var m=d.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(X.isFiniteNumber)(m)||m<0)return;var l=c.currentTime,S=d.levelTargetDuration,f=Math.max(m,S),p=Math.floor(l/S)*S-f;y.forEach(function(s){var a=C[s];if(a){var b=j.BufferHelper.getBuffered(a);b.length>0&&p>b.start(0)&&(o.trigger(N.Events.BACK_BUFFER_REACHED,{bufferEnd:p}),d.live&&o.trigger(N.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:p}),o.trigger(N.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:p,type:s}))}})},w.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,d=this.hls,c=this.media,C=this.mediaSource,y=o.fragments[0].start+o.totalduration,m=c.duration,l=Object(X.isFiniteNumber)(C.duration)?C.duration:0;o.live&&d.config.liveDurationInfinity?(I.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),C.duration=Infinity,this.updateSeekableRange(o)):(y>l&&y>m||!Object(X.isFiniteNumber)(m))&&(I.logger.log("[buffer-controller]: Updating Media Source duration to "+y.toFixed(3)),C.duration=y)},w.updateSeekableRange=function(o){var d=this.mediaSource,c=o.fragments,C=c.length;if(C&&o.live&&d!==null&&d!==void 0&&d.setLiveSeekableRange){var y=Math.max(0,c[0].start),m=Math.max(y,y+o.totalduration);d.setLiveSeekableRange(y,m)}},w.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,d=this.operationQueue,c=this.pendingTracks,C=Object.keys(c).length;if(C&&!o||C===2){this.createSourceBuffers(c),this.pendingTracks={};var y=this.getSourceBufferTypes();if(y.length===0){this.hls.trigger(N.Events.ERROR,{type:z.ErrorTypes.MEDIA_ERROR,details:z.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}y.forEach(function(m){d.executeNext(m)})}},w.createSourceBuffers=function(o){var d=this.sourceBuffer,c=this.mediaSource;if(!c)throw Error("createSourceBuffers called when mediaSource was null");var C=0;for(var y in o)if(!d[y]){var m=o[y];if(!m)throw Error("source buffer exists for track "+y+", however track does not");var l=m.levelCodec||m.codec,S=m.container+";codecs="+l;I.logger.log("[buffer-controller]: creating sourceBuffer("+S+")");try{var f=d[y]=c.addSourceBuffer(S),p=y;this.addBufferListener(p,"updatestart",this._onSBUpdateStart),this.addBufferListener(p,"updateend",this._onSBUpdateEnd),this.addBufferListener(p,"error",this._onSBUpdateError),this.tracks[y]={buffer:f,codec:l,container:m.container,levelCodec:m.levelCodec,id:m.id},C++}catch(s){I.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+s.message),this.hls.trigger(N.Events.ERROR,{type:z.ErrorTypes.MEDIA_ERROR,details:z.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:s,mimeType:S})}}C&&this.hls.trigger(N.Events.BUFFER_CREATED,{tracks:this.tracks})},w._onSBUpdateStart=function(o){var d=this.operationQueue,c=d.current(o);c.onStart()},w._onSBUpdateEnd=function(o){var d=this.operationQueue,c=d.current(o);c.onComplete(),d.shiftAndExecuteNext(o)},w._onSBUpdateError=function(o,d){I.logger.error("[buffer-controller]: "+o+" SourceBuffer error",d),this.hls.trigger(N.Events.ERROR,{type:z.ErrorTypes.MEDIA_ERROR,details:z.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var c=this.operationQueue.current(o);c&&c.onError(d)},w.removeExecutor=function(o,d,c){var C=this.media,y=this.mediaSource,m=this.operationQueue,l=this.sourceBuffer,S=l[o];if(!C||!y||!S){I.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),m.shiftAndExecuteNext(o);return}var f=Object(X.isFiniteNumber)(C.duration)?C.duration:Infinity,p=Object(X.isFiniteNumber)(y.duration)?y.duration:Infinity,s=Math.max(0,d),a=Math.min(c,f,p);a>s?(I.logger.log("[buffer-controller]: Removing ["+s+","+a+"] from the "+o+" SourceBuffer"),console.assert(!S.updating,o+" sourceBuffer must not be updating"),S.remove(s,a)):m.shiftAndExecuteNext(o)},w.appendExecutor=function(o,d){var c=this.operationQueue,C=this.sourceBuffer,y=C[d];if(!y){I.logger.warn("[buffer-controller]: Attempting to append to the "+d+" SourceBuffer, but it does not exist"),c.shiftAndExecuteNext(d);return}y.ended=!1,console.assert(!y.updating,d+" sourceBuffer must not be updating"),y.appendBuffer(o)},w.blockBuffers=function(o,d){var c=this;if(d===void 0&&(d=this.getSourceBufferTypes()),!d.length){I.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var C=this.operationQueue,y=d.map(function(m){return C.appendBlocker(m)});Promise.all(y).then(function(){o(),d.forEach(function(m){var l=c.sourceBuffer[m];(!l||!l.updating)&&C.shiftAndExecuteNext(m)})})},w.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},w.addBufferListener=function(o,d,c){var C=this.sourceBuffer[o];if(!C)return;var y=c.bind(this,o);this.listeners[o].push({event:d,listener:y}),C.addEventListener(d,y)},w.removeBufferListeners=function(o){var d=this.sourceBuffer[o];if(!d)return;this.listeners[o].forEach(function(c){d.removeEventListener(c.event,c.listener)})},A}()},"./src/controller/buffer-operation-queue.ts":function(ae,$,R){"use strict";R.r($),R.d($,"default",function(){return N});var X=R("./src/utils/logger.ts"),N=function(){function I(j){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=j}var z=I.prototype;return z.append=function(O,P){var E=this.queues[P];E.push(O),E.length===1&&this.buffers[P]&&this.executeNext(P)},z.insertAbort=function(O,P){var E=this.queues[P];E.unshift(O),this.executeNext(P)},z.appendBlocker=function(O){var P,E=new Promise(function(D){P=D}),L={execute:P,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(L,O),E},z.executeNext=function(O){var P=this.buffers,E=this.queues,L=P[O],D=E[O];if(D.length){var T=D[0];try{T.execute()}catch(A){X.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),T.onError(A),(!L||!L.updating)&&(D.shift(),this.executeNext(O))}}},z.shiftAndExecuteNext=function(O){this.queues[O].shift(),this.executeNext(O)},z.current=function(O){return this.queues[O][0]},I}()},"./src/controller/cap-level-controller.ts":function(ae,$,R){"use strict";R.r($);var X=R("./src/events.ts");function N(j,O){for(var P=0;P0&&this.mediaWidth>0){var E=this.hls.levels;if(E.length){var L=this.hls;L.autoLevelCapping=this.getMaxLevel(E.length-1),L.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=L.autoLevelCapping}}},O.getMaxLevel=function(E){var L=this,D=this.hls.levels;if(!D.length)return-1;var T=D.filter(function(A,w){return j.isLevelAllowed(w,L.restrictedLevels)&&w<=E});return this.clientRect=null,j.getMaxLevelByMediaSize(T,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 E=this.media,L={width:0,height:0};if(E){var D=E.getBoundingClientRect();L.width=D.width,L.height=D.height,!L.width&&!L.height&&(L.width=D.right-D.left||E.width||0,L.height=D.bottom-D.top||E.height||0)}return this.clientRect=L,L},j.isLevelAllowed=function(E,L){return L===void 0&&(L=[]),L.indexOf(E)===-1},j.getMaxLevelByMediaSize=function(E,L,D){if(!E||!E.length)return-1;for(var T=function(d,c){return c?d.width!==c.width||d.height!==c.height:!0},A=E.length-1,w=0;w=L||h.height>=D)&&T(h,E[w+1])){A=w;break}}return A},I(j,[{key:"mediaWidth",get:function(){return this.getDimensions().width*j.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*j.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var E=1;try{E=self.devicePixelRatio}catch(L){}return E}}]),j}();$.default=z},"./src/controller/cmcd-controller.ts":function(ae,$,R){"use strict";R.r($),R.d($,"default",function(){return T});var X=R("./src/events.ts"),N=R("./src/types/cmcd.ts"),I=R("./src/utils/buffer-helper.ts"),z=R("./src/utils/logger.ts");function j(A,w){for(var h=0;h=A.length?{done:!0}:{done:!1,value:A[o++]}}}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 E(A,w){if(!A)return;if(typeof A=="string")return L(A,w);var h=Object.prototype.toString.call(A).slice(8,-1);if(h==="Object"&&A.constructor&&(h=A.constructor.name),h==="Map"||h==="Set")return Array.from(A);if(h==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h))return L(A,w)}function L(A,w){(w==null||w>A.length)&&(w=A.length);for(var h=0,o=new Array(w);hd&&(d=m.bitrate)}return d>0?d:NaN},w.getBufferLength=function(o){var d=this.hls.media,c=o===N.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!c||!d)return NaN;var C=I.BufferHelper.bufferInfo(c,d.currentTime,this.config.maxBufferHole);return C.len*1e3},w.createPlaylistLoader=function(){var o=this.config.pLoader,d=this.applyPlaylistData,c=o||this.config.loader;return function(){function C(m){this.loader=void 0,this.loader=new c(m)}var y=C.prototype;return y.destroy=function(){this.loader.destroy()},y.abort=function(){this.loader.abort()},y.load=function(l,S,f){d(l),this.loader.load(l,S,f)},O(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},w.createFragmentLoader=function(){var o=this.config.fLoader,d=this.applyFragmentData,c=o||this.config.loader;return function(){function C(m){this.loader=void 0,this.loader=new c(m)}var y=C.prototype;return y.destroy=function(){this.loader.destroy()},y.abort=function(){this.loader.abort()},y.load=function(l,S,f){d(l),this.loader.load(l,S,f)},O(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},A.uuid=function(){var o=URL.createObjectURL(new Blob),d=o.toString();return URL.revokeObjectURL(o),d.substr(d.lastIndexOf("/")+1)},A.serialize=function(o){for(var d=[],c=function(H){return!Number.isNaN(H)&&H!=null&&H!==""&&H!==!1},C=function(H){return Math.round(H)},y=function(H){return C(H/100)*100},m=function(H){return encodeURIComponent(H)},l={br:C,d:C,bl:y,dl:y,mtp:y,nor:m,rtp:y,tb:C},S=Object.keys(o||{}).sort(),f=P(S),p;!(p=f()).done;){var s=p.value,a=o[s];if(!c(a))continue;if(s==="v"&&a===1)continue;if(s=="pr"&&a===1)continue;var b=l[s];b&&(a=b(a));var v=typeof a,x=void 0;s==="ot"||s==="sf"||s==="st"?x=s+"="+a:v==="boolean"?x=s:v==="number"?x=s+"="+a:x=s+"="+JSON.stringify(a),d.push(x)}return d.join(",")},A.toHeaders=function(o){for(var d=Object.keys(o),c={},C=["Object","Request","Session","Status"],y=[{},{},{},{}],m={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},l=0,S=d;lP){this.hls.trigger(X.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var m=P-this._requestLicenseFailureCount+1;I.logger.warn("Retrying license request, "+m+" attempts left"),this._requestLicense(d,c)}break}},A._generateLicenseRequestChallenge=function(h,o){switch(h.mediaKeySystemDomain){case z.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+h.mediaKeySystemDomain)},A._requestLicense=function(h,o){I.logger.log("Requesting content license for key-system");var d=this._mediaKeysList[0];if(!d){I.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(X.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var c=this.getLicenseServerUrl(d.mediaKeySystemDomain),C=this._createLicenseXhr(c,h,o);I.logger.log("Sending license request to URL: "+c);var y=this._generateLicenseRequestChallenge(d,h);C.send(y)}catch(m){I.logger.error("Failure requesting DRM license: "+m),this.hls.trigger(X.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},A.onMediaAttached=function(h,o){if(!this._emeEnabled)return;var d=o.media;this._media=d,d.addEventListener("encrypted",this._onMediaEncrypted)},A.onMediaDetached=function(){var h=this._media,o=this._mediaKeysList;if(!h)return;h.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(d){if(d.mediaKeysSession)return d.mediaKeysSession.close().catch(function(){})})).then(function(){return h.setMediaKeys(null)}).catch(function(){})},A.onManifestParsed=function(h,o){if(!this._emeEnabled)return;var d=o.levels.map(function(C){return C.audioCodec}).filter(function(C){return!!C}),c=o.levels.map(function(C){return C.videoCodec}).filter(function(C){return!!C});this._attemptKeySystemAccess(z.KeySystems.WIDEVINE,d,c)},O(T,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),T}();$.default=D},"./src/controller/fps-controller.ts":function(ae,$,R){"use strict";R.r($);var X=R("./src/events.ts"),N=R("./src/utils/logger.ts"),I=function(){function z(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 j=z.prototype;return j.setStreamController=function(P){this.streamController=P},j.registerListeners=function(){this.hls.on(X.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},j.unregisterListeners=function(){this.hls.off(X.Events.MEDIA_ATTACHING,this.onMediaAttaching)},j.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},j.onMediaAttaching=function(P,E){var L=this.hls.config;if(L.capLevelOnFPSDrop){var D=E.media instanceof self.HTMLVideoElement?E.media:null;this.media=D,D&&typeof D.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),L.fpsDroppedMonitoringPeriod)}},j.checkFPS=function(P,E,L){var D=performance.now();if(E){if(this.lastTime){var T=D-this.lastTime,A=L-this.lastDroppedFrames,w=E-this.lastDecodedFrames,h=1e3*A/T,o=this.hls;if(o.trigger(X.Events.FPS_DROP,{currentDropped:A,currentDecoded:w,totalDroppedFrames:L}),h>0&&A>o.config.fpsDroppedMonitoringThreshold*w){var d=o.currentLevel;N.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+d),d>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=d)&&(d=d-1,o.trigger(X.Events.FPS_DROP_LEVEL_CAPPING,{level:d,droppedLevel:o.currentLevel}),o.autoLevelCapping=d,this.streamController.nextLevelSwitch())}}this.lastTime=D,this.lastDroppedFrames=L,this.lastDecodedFrames=E}},j.checkFPSInterval=function(){var P=this.media;if(P)if(this.isVideoPlaybackQualityAvailable){var E=P.getVideoPlaybackQuality();this.checkFPS(P,E.totalVideoFrames,E.droppedVideoFrames)}else this.checkFPS(P,P.webkitDecodedFrameCount,P.webkitDroppedFrameCount)},z}();$.default=I},"./src/controller/fragment-finders.ts":function(ae,$,R){"use strict";R.r($),R.d($,"findFragmentByPDT",function(){return I}),R.d($,"findFragmentByPTS",function(){return z}),R.d($,"fragmentWithinToleranceTest",function(){return j}),R.d($,"pdtWithinToleranceTest",function(){return O}),R.d($,"findFragWithCC",function(){return P});var X=R("./src/polyfills/number.ts"),N=R("./src/utils/binary-search.ts");function I(E,L,D){if(L===null||!Array.isArray(E)||!E.length||!Object(X.isFiniteNumber)(L))return null;var T=E[0].programDateTime;if(L<(T||0))return null;var A=E[E.length-1].endProgramDateTime;if(L>=(A||0))return null;D=D||0;for(var w=0;wE&&D.start?-1:0}function O(E,L,D){var T=Math.min(L,D.duration+(D.deltaPTS?D.deltaPTS:0))*1e3,A=D.endProgramDateTime||0;return A-T>E}function P(E,L){return N.default.search(E,function(D){return D.ccL?-1:0})}},"./src/controller/fragment-tracker.ts":function(ae,$,R){"use strict";R.r($),R.d($,"FragmentState",function(){return I}),R.d($,"FragmentTracker",function(){return z});var X=R("./src/events.ts"),N=R("./src/types/loader.ts"),I;(function(P){P.NOT_LOADED="NOT_LOADED",P.BACKTRACKED="BACKTRACKED",P.APPENDING="APPENDING",P.PARTIAL="PARTIAL",P.OK="OK"})(I||(I={}));var z=function(){function P(L){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=L,this._registerListeners()}var E=P.prototype;return E._registerListeners=function(){var D=this.hls;D.on(X.Events.BUFFER_APPENDED,this.onBufferAppended,this),D.on(X.Events.FRAG_BUFFERED,this.onFragBuffered,this),D.on(X.Events.FRAG_LOADED,this.onFragLoaded,this)},E._unregisterListeners=function(){var D=this.hls;D.off(X.Events.BUFFER_APPENDED,this.onBufferAppended,this),D.off(X.Events.FRAG_BUFFERED,this.onFragBuffered,this),D.off(X.Events.FRAG_LOADED,this.onFragLoaded,this)},E.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},E.getAppendedFrag=function(D,T){if(T===N.PlaylistLevelType.MAIN){var A=this.activeFragment,w=this.activeParts;if(!A)return null;if(w)for(var h=w.length;h--;){var o=w[h],d=o?o.end:A.appendedPTS;if(o.start<=D&&d!==void 0&&D<=d)return h>9&&(this.activeParts=w.slice(h-9)),o}else if(A.start<=D&&A.appendedPTS!==void 0&&D<=A.appendedPTS)return A}return this.getBufferedFrag(D,T)},E.getBufferedFrag=function(D,T){for(var A=this.fragments,w=Object.keys(A),h=w.length;h--;){var o=A[w[h]];if((o==null?void 0:o.body.type)===T&&o.buffered){var d=o.body;if(d.start<=D&&D<=d.end)return d}}return null},E.detectEvictedFragments=function(D,T,A){var w=this;Object.keys(this.fragments).forEach(function(h){var o=w.fragments[h];if(!o)return;if(!o.buffered){o.body.type===A&&w.removeFragment(o.body);return}var d=o.range[D];if(!d)return;d.time.some(function(c){var C=!w.isTimeBuffered(c.startPTS,c.endPTS,T);return C&&w.removeFragment(o.body),C})})},E.detectPartialFragments=function(D){var T=this,A=this.timeRanges,w=D.frag,h=D.part;if(!A||w.sn==="initSegment")return;var o=O(w),d=this.fragments[o];if(!d)return;Object.keys(A).forEach(function(c){var C=w.elementaryStreams[c];if(!C)return;var y=A[c],m=h!==null||C.partial===!0;d.range[c]=T.getBufferedTimes(w,h,m,y)}),d.backtrack=d.loaded=null,Object.keys(d.range).length?d.buffered=!0:this.removeFragment(d.body)},E.fragBuffered=function(D){var T=O(D),A=this.fragments[T];A&&(A.backtrack=A.loaded=null,A.buffered=!0)},E.getBufferedTimes=function(D,T,A,w){for(var h={time:[],partial:A},o=T?T.start:D.start,d=T?T.end:D.end,c=D.minEndPTS||d,C=D.maxStartPTS||o,y=0;y=m&&c<=l){h.time.push({startPTS:Math.max(o,w.start(y)),endPTS:Math.min(d,w.end(y))});break}else if(om)h.partial=!0,h.time.push({startPTS:Math.max(o,w.start(y)),endPTS:Math.min(d,w.end(y))});else if(d<=m)break}return h},E.getPartialFragment=function(D){var T=null,A,w,h,o=0,d=this.bufferPadding,c=this.fragments;return Object.keys(c).forEach(function(C){var y=c[C];if(!y)return;j(y)&&(w=y.body.start-d,h=y.body.end+d,D>=w&&D<=h&&(A=Math.min(D-w,h-D),o<=A&&(T=y.body,o=A)))}),T},E.getState=function(D){var T=O(D),A=this.fragments[T];return A?A.buffered?j(A)?I.PARTIAL:I.OK:A.backtrack?I.BACKTRACKED:I.APPENDING:I.NOT_LOADED},E.backtrack=function(D,T){var A=O(D),w=this.fragments[A];if(!w||w.backtrack)return null;var h=w.backtrack=T||w.loaded;return w.loaded=null,h},E.getBacktrackData=function(D){var T=O(D),A=this.fragments[T];if(A){var w,h=A.backtrack;if(h!=null&&(w=h.payload)!==null&&w!==void 0&&w.byteLength)return h;this.removeFragment(D)}return null},E.isTimeBuffered=function(D,T,A){for(var w,h,o=0;o=w&&T<=h)return!0;if(T<=w)return!1}return!1},E.onFragLoaded=function(D,T){var A=T.frag,w=T.part;if(A.sn==="initSegment"||A.bitrateTest||w)return;var h=O(A);this.fragments[h]={body:A,loaded:T,backtrack:null,buffered:!1,range:Object.create(null)}},E.onBufferAppended=function(D,T){var A=this,w=T.frag,h=T.part,o=T.timeRanges;if(w.type===N.PlaylistLevelType.MAIN)if(this.activeFragment=w,h){var d=this.activeParts;d||(this.activeParts=d=[]),d.push(h)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(c){var C=o[c];if(A.detectEvictedFragments(c,C),!h)for(var y=0;yD&&w.removeFragment(d)}})},E.removeFragment=function(D){var T=O(D);D.stats.loaded=0,D.clearElementaryStreamInfo(),delete this.fragments[T]},E.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},P}();function j(P){var E,L;return P.buffered&&(((E=P.range.video)===null||E===void 0?void 0:E.partial)||((L=P.range.audio)===null||L===void 0?void 0:L.partial))}function O(P){return P.type+"_"+P.level+"_"+P.urlId+"_"+P.sn}},"./src/controller/gap-controller.ts":function(ae,$,R){"use strict";R.r($),R.d($,"STALL_MINIMUM_DURATION_MS",function(){return j}),R.d($,"MAX_START_GAP_JUMP",function(){return O}),R.d($,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return P}),R.d($,"SKIP_BUFFER_RANGE_START",function(){return E}),R.d($,"default",function(){return L});var X=R("./src/utils/buffer-helper.ts"),N=R("./src/errors.ts"),I=R("./src/events.ts"),z=R("./src/utils/logger.ts"),j=250,O=2,P=.1,E=.05,L=function(){function D(A,w,h,o){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=A,this.media=w,this.fragmentTracker=h,this.hls=o}var T=D.prototype;return T.destroy=function(){this.hls=this.fragmentTracker=this.media=null},T.poll=function(w){var h=this.config,o=this.media,d=this.stalled,c=o.currentTime,C=o.seeking,y=this.seeking&&!C,m=!this.seeking&&C;if(this.seeking=C,c!==w){if(this.moved=!0,d!==null){if(this.stallReported){var l=self.performance.now()-d;z.logger.warn("playback not stuck anymore @"+c+", after "+Math.round(l)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((m||y)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!X.BufferHelper.getBuffered(o).length)return;var S=X.BufferHelper.bufferInfo(o,c,0),f=S.len>0,p=S.nextStart||0;if(!f&&!p)return;if(C){var s=S.len>O,a=!p||p-c>O&&!this.fragmentTracker.getPartialFragment(c);if(s||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var b,v=Math.max(p,S.start||0)-c,x=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,k=x==null||((b=x.details)===null||b===void 0)?void 0:b.live,H=k?x.details.targetduration*2:O;if(v>0&&v<=H){this._trySkipBufferHole(null);return}}var V=self.performance.now();if(d===null){this.stalled=V;return}var Q=V-d;!C&&Q>=j&&this._reportStall(S.len);var G=X.BufferHelper.bufferInfo(o,c,h.maxBufferHole);this._tryFixBufferStall(G,Q)},T._tryFixBufferStall=function(w,h){var o=this.config,d=this.fragmentTracker,c=this.media,C=c.currentTime,y=d.getPartialFragment(C);if(y){var m=this._trySkipBufferHole(y);if(m)return}w.len>o.maxBufferHole&&h>o.highBufferWatchdogPeriod*1e3&&(z.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},T._reportStall=function(w){var h=this.hls,o=this.media,d=this.stallReported;d||(this.stallReported=!0,z.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+w+")"),h.trigger(I.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:w}))},T._trySkipBufferHole=function(w){for(var h=this.config,o=this.hls,d=this.media,c=d.currentTime,C=0,y=X.BufferHelper.getBuffered(d),m=0;m=C&&c.05&&this.forwardBufferLength>1){var m=Math.min(2,Math.max(1,o)),l=Math.round(2/(1+Math.exp(-.75*c-this.edgeStalled))*20)/20;D.playbackRate=Math.min(m,Math.max(1,l))}else D.playbackRate!==1&&D.playbackRate!==0&&(D.playbackRate=1)},E.estimateLiveEdge=function(){var D=this.levelDetails;return D===null?null:D.edge+D.age},E.computeLatency=function(){var D=this.estimateLiveEdge();return D===null?null:D-this.currentTime},j(P,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var D=this.config,T=this.levelDetails;return D.liveMaxLatencyDuration!==void 0?D.liveMaxLatencyDuration:T?D.liveMaxLatencyDurationCount*T.targetduration:0}},{key:"targetLatency",get:function(){var D=this.levelDetails;if(D===null)return null;var T=D.holdBack,A=D.partHoldBack,w=D.targetduration,h=this.config,o=h.liveSyncDuration,d=h.liveSyncDurationCount,c=h.lowLatencyMode,C=this.hls.userConfig,y=c&&A||T;(C.liveSyncDuration||C.liveSyncDurationCount||y===0)&&(y=o!==void 0?o:d*w);var m=w,l=1;return y+Math.min(this.stallCount*l,m)}},{key:"liveSyncPosition",get:function(){var D=this.estimateLiveEdge(),T=this.targetLatency,A=this.levelDetails;if(D===null||T===null||A===null)return null;var w=A.edge,h=D-T-this.edgeStalled,o=w-A.totalduration,d=w-(this.config.lowLatencyMode&&A.partTarget||A.targetduration);return Math.min(Math.max(o,h),d)}},{key:"drift",get:function(){var D=this.levelDetails;return D===null?1:D.drift}},{key:"edgeStalled",get:function(){var D=this.levelDetails;if(D===null)return 0;var T=(this.config.lowLatencyMode&&D.partTarget||D.targetduration)*3;return Math.max(D.age-T,0)}},{key:"forwardBufferLength",get:function(){var D=this.media,T=this.levelDetails;if(!D||!T)return 0;var A=D.buffered.length;return A?D.buffered.end(A-1):T.edge-this.currentTime}}]),P}()},"./src/controller/level-controller.ts":function(ae,$,R){"use strict";R.r($),R.d($,"default",function(){return h});var X=R("./src/types/level.ts"),N=R("./src/events.ts"),I=R("./src/errors.ts"),z=R("./src/utils/codecs.ts"),j=R("./src/controller/level-helper.ts"),O=R("./src/controller/base-playlist-controller.ts"),P=R("./src/types/loader.ts");function E(){return E=Object.assign||function(o){for(var d=1;d0){p=l[0].bitrate,l.sort(function(Q,G){return Q.bitrate-G.bitrate}),this._levels=l;for(var k=0;kthis.hls.config.fragLoadingMaxRetry&&(s=m.frag.level)):s=m.frag.level}break;case I.ErrorDetails.LEVEL_LOAD_ERROR:case I.ErrorDetails.LEVEL_LOAD_TIMEOUT:l&&(l.deliveryDirectives&&(p=!1),s=l.level),f=!0;break;case I.ErrorDetails.REMUX_ALLOC_ERROR:s=m.level,f=!0;break}s!==void 0&&this.recoverLevel(m,s,f,p)},c.recoverLevel=function(y,m,l,S){var f=y.details,p=this._levels[m];if(p.loadError++,l){var s=this.retryLoadingOrFail(y);if(s)y.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(S){var a=p.url.length;if(a>1&&p.loadError1){var S=(m.urlId+1)%l;this.warn("Switching to redundant URL-id "+S),this._levels.forEach(function(f){f.urlId=S}),this.level=y}},c.onFragLoaded=function(y,m){var l=m.frag;if(l!==void 0&&l.type===P.PlaylistLevelType.MAIN){var S=this._levels[l.level];S!==void 0&&(S.fragmentError=0,S.loadError=0)}},c.onLevelLoaded=function(y,m){var l,S=m.level,f=m.details,p=this._levels[S];if(!p){var s;this.warn("Invalid level index "+S),(s=m.deliveryDirectives)!==null&&s!==void 0&&s.skip&&(f.deltaUpdateFailed=!0);return}S===this.currentLevelIndex?(p.fragmentError===0&&(p.loadError=0,this.retryCount=0),this.playlistLoaded(S,m,p.details)):(l=m.deliveryDirectives)!==null&&l!==void 0&&l.skip&&(f.deltaUpdateFailed=!0)},c.onAudioTrackSwitched=function(y,m){var l=this.hls.levels[this.currentLevelIndex];if(!l)return;if(l.audioGroupIds){for(var S=-1,f=this.hls.audioTracks[m.id].groupId,p=0;p0){var S=l.urlId,f=l.url[S];if(y)try{f=y.addDirectives(f)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("Attempt loading level index "+m+(y?" at sn "+y.msn+" part "+y.part:"")+" with URL-id "+S+" "+f),this.clearTimer(),this.hls.trigger(N.Events.LEVEL_LOADING,{url:f,level:m,id:S,deliveryDirectives:y||null})}},c.removeLevel=function(y,m){var l=function(p,s){return s!==m},S=this._levels.filter(function(f,p){return p!==y?!0:f.url.length>1&&m!==void 0?(f.url=f.url.filter(l),f.audioGroupIds&&(f.audioGroupIds=f.audioGroupIds.filter(l)),f.textGroupIds&&(f.textGroupIds=f.textGroupIds.filter(l)),f.urlId=0,!0):!1}).map(function(f,p){var s=f.details;return s!=null&&s.fragments&&s.fragments.forEach(function(a){a.level=p}),f});this._levels=S,this.hls.trigger(N.Events.LEVELS_UPDATED,{levels:S})},D(d,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(y){var m,l=this._levels;if(l.length===0)return;if(this.currentLevelIndex===y&&(m=l[y])!==null&&m!==void 0&&m.details)return;if(y<0||y>=l.length){var S=y<0;if(this.hls.trigger(N.Events.ERROR,{type:I.ErrorTypes.OTHER_ERROR,details:I.ErrorDetails.LEVEL_SWITCH_ERROR,level:y,fatal:S,reason:"invalid level idx"}),S)return;y=Math.min(y,l.length-1)}this.clearTimer();var f=this.currentLevelIndex,p=l[f],s=l[y];this.log("switching to level "+y+" from "+f),this.currentLevelIndex=y;var a=E({},s,{level:y,maxBitrate:s.maxBitrate,uri:s.uri,urlId:s.urlId});delete a._urlId,this.hls.trigger(N.Events.LEVEL_SWITCHING,a);var b=s.details;if(!b||b.live){var v=this.switchParams(s.uri,p==null?void 0:p.details);this.loadPlaylist(v)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(y){this.manualLevelIndex=y,this._startLevel===void 0&&(this._startLevel=y),y!==-1&&(this.level=y)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(y){this._firstLevel=y}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var y=this.hls.config.startLevel;return y!==void 0?y:this._firstLevel}else return this._startLevel},set:function(y){this._startLevel=y}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(y){this.level=y,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=y)}}]),d}(O.default)},"./src/controller/level-helper.ts":function(ae,$,R){"use strict";R.r($),R.d($,"addGroupId",function(){return I}),R.d($,"assignTrackIdsByGroup",function(){return z}),R.d($,"updatePTS",function(){return j}),R.d($,"updateFragPTSDTS",function(){return P}),R.d($,"mergeDetails",function(){return E}),R.d($,"mapPartIntersection",function(){return L}),R.d($,"mapFragmentIntersection",function(){return D}),R.d($,"adjustSliding",function(){return T}),R.d($,"addSliding",function(){return A}),R.d($,"computeReloadInterval",function(){return w}),R.d($,"getFragmentWithSN",function(){return h}),R.d($,"getPartWith",function(){return o});var X=R("./src/polyfills/number.ts"),N=R("./src/utils/logger.ts");function I(d,c,C){switch(c){case"audio":d.audioGroupIds||(d.audioGroupIds=[]),d.audioGroupIds.push(C);break;case"text":d.textGroupIds||(d.textGroupIds=[]),d.textGroupIds.push(C);break}}function z(d){var c={};d.forEach(function(C){var y=C.groupId||"";C.id=c[y]=c[y]||0,c[y]++})}function j(d,c,C){var y=d[c],m=d[C];O(y,m)}function O(d,c){var C=c.startPTS;if(Object(X.isFiniteNumber)(C)){var y=0,m;c.sn>d.sn?(y=C-d.start,m=d):(y=d.start-C,m=c),m.duration!==y&&(m.duration=y)}else if(c.sn>d.sn){var l=d.cc===c.cc;l&&d.minEndPTS?c.start=d.start+(d.minEndPTS-d.start):c.start=d.start+d.duration}else c.start=Math.max(d.start-c.duration,0)}function P(d,c,C,y,m,l){var S=y-C;S<=0&&(N.logger.warn("Fragment should have a positive duration",c),y=C+c.duration,l=m+c.duration);var f=C,p=y,s=c.startPTS,a=c.endPTS;if(Object(X.isFiniteNumber)(s)){var b=Math.abs(s-C);Object(X.isFiniteNumber)(c.deltaPTS)?c.deltaPTS=Math.max(b,c.deltaPTS):c.deltaPTS=b,f=Math.max(C,s),C=Math.min(C,s),m=Math.min(m,c.startDTS),p=Math.min(y,a),y=Math.max(y,a),l=Math.max(l,c.endDTS)}c.duration=y-C;var v=C-c.start;c.appendedPTS=y,c.start=c.startPTS=C,c.maxStartPTS=f,c.startDTS=m,c.endPTS=y,c.minEndPTS=p,c.endDTS=l;var x=c.sn;if(!d||xd.endSN)return 0;var k,H=x-d.startSN,V=d.fragments;for(V[H]=c,k=H;k>0;k--)O(V[k],V[k-1]);for(k=H;k=0;m--){var l=y[m].initSegment;if(l){C=l;break}}d.fragmentHint&&delete d.fragmentHint.endPTS;var S=0,f;if(D(d,c,function(k,H){k.relurl&&(S=k.cc-H.cc),Object(X.isFiniteNumber)(k.startPTS)&&Object(X.isFiniteNumber)(k.endPTS)&&(H.start=H.startPTS=k.startPTS,H.startDTS=k.startDTS,H.appendedPTS=k.appendedPTS,H.maxStartPTS=k.maxStartPTS,H.endPTS=k.endPTS,H.endDTS=k.endDTS,H.minEndPTS=k.minEndPTS,H.duration=k.endPTS-k.startPTS,H.duration&&(f=H),c.PTSKnown=c.alignedSliding=!0),H.elementaryStreams=k.elementaryStreams,H.loader=k.loader,H.stats=k.stats,H.urlId=k.urlId,k.initSegment&&(H.initSegment=k.initSegment,C=k.initSegment)}),C){var p=c.fragmentHint?c.fragments.concat(c.fragmentHint):c.fragments;p.forEach(function(k){var H;(!k.initSegment||k.initSegment.relurl===((H=C)===null||H===void 0?void 0:H.relurl))&&(k.initSegment=C)})}if(c.skippedSegments&&(c.deltaUpdateFailed=c.fragments.some(function(k){return!k}),c.deltaUpdateFailed)){N.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var s=c.skippedSegments;s--;)c.fragments.shift();c.startSN=c.fragments[0].sn,c.startCC=c.fragments[0].cc}var a=c.fragments;if(S){N.logger.warn("discontinuity sliding from playlist, take drift into account");for(var b=0;b=y.length)return;A(c,y[C].start)}function A(d,c){if(c){for(var C=d.fragments,y=d.skippedSegments;y0&&m0&&p===-1&&(this.log("Override startPosition with lastCurrentTime @"+s.toFixed(3)),p=s),this.state=N.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=p,this.tick()}else this._forceStartLoad=!0,this.state=N.State.STOPPED},S.stopLoad=function(){this._forceStartLoad=!1,m.prototype.stopLoad.call(this)},S.doTick=function(){switch(this.state){case N.State.IDLE:this.doTickIdle();break;case N.State.WAITING_LEVEL:{var p,s=this.levels,a=this.level,b=s==null||((p=s[a])===null||p===void 0)?void 0:p.details;if(b&&(!b.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(b))break;this.state=N.State.IDLE;break}break}case N.State.FRAG_LOADING_WAITING_RETRY:{var v,x=self.performance.now(),k=this.retryDate;(!k||x>=k||(v=this.media)!==null&&v!==void 0&&v.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=N.State.IDLE)}break;default:break}this.onTickEnd()},S.onTickEnd=function(){m.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},S.doTickIdle=function(){var p,s,a=this.hls,b=this.levelLastLoaded,v=this.levels,x=this.media,k=a.config,H=a.nextLoadLevel;if(b===null||!x&&(this.startFragRequested||!k.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!v||!v[H])return;var V=v[H];this.level=a.nextLoadLevel=H;var Q=V.details;if(!Q||this.state===N.State.WAITING_LEVEL||Q.live&&this.levelLastLoaded!==H){this.state=N.State.WAITING_LEVEL;return}var G=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:x,P.PlaylistLevelType.MAIN);if(G===null)return;var W=G.len,q=this.getMaxBufferLength(V.maxBitrate);if(W>=q)return;if(this._streamEnded(G,Q)){var oe={};this.altAudio&&(oe.type="video"),this.hls.trigger(z.Events.BUFFER_EOS,oe),this.state=N.State.ENDED;return}var fe=G.end,ve=this.getNextFragment(fe,Q);if(this.couldBacktrack&&!this.fragPrevious&&ve&&ve.sn!=="initSegment"){var ke=ve.sn-Q.startSN;ke>1&&(ve=Q.fragments[ke-1],this.fragmentTracker.removeFragment(ve))}if(ve&&this.fragmentTracker.getState(ve)===O.FragmentState.OK&&this.nextLoadPosition>fe){var Ee=this.audioOnly&&!this.altAudio?E.ElementaryStreamTypes.AUDIO:E.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(x,Ee,P.PlaylistLevelType.MAIN),ve=this.getNextFragment(this.nextLoadPosition,Q)}if(!ve)return;ve.initSegment&&!ve.initSegment.data&&!this.bitrateTest&&(ve=ve.initSegment),((p=ve.decryptdata)===null||p===void 0?void 0:p.keyFormat)==="identity"&&!((s=ve.decryptdata)!==null&&s!==void 0&&s.key)?this.loadKey(ve,Q):this.loadFragment(ve,Q,fe)},S.loadFragment=function(p,s,a){var b,v=this.fragmentTracker.getState(p);if(this.fragCurrent=p,v===O.FragmentState.BACKTRACKED){var x=this.fragmentTracker.getBacktrackData(p);if(x){this._handleFragmentLoadProgress(x),this._handleFragmentLoadComplete(x);return}else v=O.FragmentState.NOT_LOADED}v===O.FragmentState.NOT_LOADED||v===O.FragmentState.PARTIAL?p.sn==="initSegment"?this._loadInitSegment(p):this.bitrateTest?(p.bitrateTest=!0,this.log("Fragment "+p.sn+" of level "+p.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(p)):(this.startFragRequested=!0,m.prototype.loadFragment.call(this,p,s,a)):v===O.FragmentState.APPENDING?this.reduceMaxBufferLength(p.duration)&&this.fragmentTracker.removeFragment(p):((b=this.media)===null||b===void 0?void 0:b.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},S.getAppendedFrag=function(p){var s=this.fragmentTracker.getAppendedFrag(p,P.PlaylistLevelType.MAIN);return s&&"fragment"in s?s.fragment:s},S.getBufferedFrag=function(p){return this.fragmentTracker.getBufferedFrag(p,P.PlaylistLevelType.MAIN)},S.followingBufferedFrag=function(p){return p?this.getBufferedFrag(p.end+.5):null},S.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},S.nextLevelSwitch=function(){var p=this.levels,s=this.media;if(s!=null&&s.readyState){var a,b=this.getAppendedFrag(s.currentTime);if(b&&b.start>1&&this.flushMainBuffer(0,b.start-1),!s.paused&&p){var v=this.hls.nextLoadLevel,x=p[v],k=this.fragLastKbps;k&&this.fragCurrent?a=this.fragCurrent.duration*x.maxBitrate/(1e3*k)+1:a=0}else a=0;var H=this.getBufferedFrag(s.currentTime+a);if(H){var V=this.followingBufferedFrag(H);if(V){this.abortCurrentFrag();var Q=V.maxStartPTS?V.maxStartPTS:V.start,G=V.duration,W=Math.max(H.end,Q+Math.min(Math.max(G-this.config.maxFragLookUpTolerance,G*.5),G*.75));this.flushMainBuffer(W,Number.POSITIVE_INFINITY)}}}},S.abortCurrentFrag=function(){var p=this.fragCurrent;this.fragCurrent=null,p!=null&&p.loader&&p.loader.abort(),this.state===N.State.KEY_LOADING&&(this.state=N.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},S.flushMainBuffer=function(p,s){m.prototype.flushMainBuffer.call(this,p,s,this.altAudio?"video":null)},S.onMediaAttached=function(p,s){m.prototype.onMediaAttached.call(this,p,s);var a=s.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new T.default(this.config,a,this.fragmentTracker,this.hls)},S.onMediaDetaching=function(){var p=this.media;p&&(p.removeEventListener("playing",this.onvplaying),p.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),m.prototype.onMediaDetaching.call(this)},S.onMediaPlaying=function(){this.tick()},S.onMediaSeeked=function(){var p=this.media,s=p?p.currentTime:null;Object(X.isFiniteNumber)(s)&&this.log("Media seeked to "+s.toFixed(3)),this.tick()},S.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(z.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},S.onManifestParsed=function(p,s){var a=!1,b=!1,v;s.levels.forEach(function(x){v=x.audioCodec,v&&(v.indexOf("mp4a.40.2")!==-1&&(a=!0),v.indexOf("mp4a.40.5")!==-1&&(b=!0))}),this.audioCodecSwitch=a&&b&&!Object(I.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=s.levels,this.startFragRequested=!1},S.onLevelLoading=function(p,s){var a=this.levels;if(!a||this.state!==N.State.IDLE)return;var b=a[s.level];(!b.details||b.details.live&&this.levelLastLoaded!==s.level||this.waitForCdnTuneIn(b.details))&&(this.state=N.State.WAITING_LEVEL)},S.onLevelLoaded=function(p,s){var a,b=this.levels,v=s.level,x=s.details,k=x.totalduration;if(!b){this.warn("Levels were reset while loading level "+v);return}this.log("Level "+v+" loaded ["+x.startSN+","+x.endSN+"], cc ["+x.startCC+", "+x.endCC+"] duration:"+k);var H=this.fragCurrent;H&&(this.state===N.State.FRAG_LOADING||this.state===N.State.FRAG_LOADING_WAITING_RETRY)&&(H.level!==s.level&&H.loader&&(this.state=N.State.IDLE,H.loader.abort()));var V=b[v],Q=0;if(x.live||(a=V.details)!==null&&a!==void 0&&a.live){if(x.fragments[0]||(x.deltaUpdateFailed=!0),x.deltaUpdateFailed)return;Q=this.alignPlaylists(x,V.details)}if(V.details=x,this.levelLastLoaded=v,this.hls.trigger(z.Events.LEVEL_UPDATED,{details:x,level:v}),this.state===N.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(x))return;this.state=N.State.IDLE}this.startFragRequested?x.live&&this.synchronizeToLiveEdge(x):this.setStartPosition(x,Q),this.tick()},S._handleFragmentLoadProgress=function(p){var s,a=p.frag,b=p.part,v=p.payload,x=this.levels;if(!x){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var k=x[a.level],H=k.details;if(!H){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var V=k.videoCodec,Q=H.PTSKnown||!H.live,G=(s=a.initSegment)===null||s===void 0?void 0:s.data,W=this._getAudioCodec(k),q=this.transmuxer=this.transmuxer||new L.default(this.hls,P.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),oe=b?b.index:-1,fe=oe!==-1,ve=new D.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,v.byteLength,oe,fe),ke=this.initPTS[a.cc];q.push(v,G,W,V,a,b,H.totalduration,Q,ve,ke)},S.onAudioTrackSwitching=function(p,s){var a=this.altAudio,b=!!s.url,v=s.id;if(!b){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var x=this.fragCurrent;x!=null&&x.loader&&(this.log("Switching to main audio track, cancel main fragment load"),x.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var k=this.hls;a&&k.trigger(z.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),k.trigger(z.Events.AUDIO_TRACK_SWITCHED,{id:v})}},S.onAudioTrackSwitched=function(p,s){var a=s.id,b=!!this.hls.audioTracks[a].url;if(b){var v=this.videoBuffer;v&&this.mediaBuffer!==v&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=v)}this.altAudio=b,this.tick()},S.onBufferCreated=function(p,s){var a=s.tracks,b,v,x=!1;for(var k in a){var H=a[k];if(H.id==="main"){if(v=k,b=H,k==="video"){var V=a[k];V&&(this.videoBuffer=V.buffer)}}else x=!0}x&&b?(this.log("Alternate track found, use "+v+".buffered to schedule main fragment loading"),this.mediaBuffer=b.buffer):this.mediaBuffer=this.media},S.onFragBuffered=function(p,s){var a=s.frag,b=s.part;if(a&&a.type!==P.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(b?" p: "+b.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===N.State.PARSED&&(this.state=N.State.IDLE);return}var v=b?b.stats:a.stats;this.fragLastKbps=Math.round(8*v.total/(v.buffering.end-v.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,b)},S.onError=function(p,s){switch(s.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(P.PlaylistLevelType.MAIN,s);break;case A.ErrorDetails.LEVEL_LOAD_ERROR:case A.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==N.State.ERROR&&(s.fatal?(this.warn(""+s.details),this.state=N.State.ERROR):!s.levelRetry&&this.state===N.State.WAITING_LEVEL&&(this.state=N.State.IDLE));break;case A.ErrorDetails.BUFFER_FULL_ERROR:if(s.parent==="main"&&(this.state===N.State.PARSING||this.state===N.State.PARSED)){var a=!0,b=this.getFwdBufferInfo(this.media,P.PlaylistLevelType.MAIN);b&&b.len>.5&&(a=!this.reduceMaxBufferLength(b.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},S.checkBuffer=function(){var p=this.media,s=this.gapController;if(!p||!s||!p.readyState)return;var a=j.BufferHelper.getBuffered(p);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):s.poll(this.lastCurrentTime),this.lastCurrentTime=p.currentTime},S.onFragLoadEmergencyAborted=function(){this.state=N.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},S.onBufferFlushed=function(p,s){var a=s.type;if(a!==E.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var b=(a===E.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(b,a,P.PlaylistLevelType.MAIN)}},S.onLevelsUpdated=function(p,s){this.levels=s.levels},S.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},S.seekToStartPos=function(){var p=this.media,s=p.currentTime,a=this.startPosition;if(a>=0&&s0&&(x1&&p.seeking===!1){var a=p.currentTime;if(j.BufferHelper.isBuffered(p,a)?s=this.getAppendedFrag(a):j.BufferHelper.isBuffered(p,a+.1)&&(s=this.getAppendedFrag(a+.1)),s){var b=this.fragPlaying,v=s.level;(!b||s.sn!==b.sn||b.level!==v||s.urlId!==b.urlId)&&(this.hls.trigger(z.Events.FRAG_CHANGED,{frag:s}),(!b||b.level!==v)&&this.hls.trigger(z.Events.LEVEL_SWITCHED,{level:v}),this.fragPlaying=s)}}},o(l,[{key:"nextLevel",get:function(){var p=this.nextBufferedFrag;return p?p.level:-1}},{key:"currentLevel",get:function(){var p=this.media;if(p){var s=this.getAppendedFrag(p.currentTime);if(s)return s.level}return-1}},{key:"nextBufferedFrag",get:function(){var p=this.media;if(p){var s=this.getAppendedFrag(p.currentTime);return this.followingBufferedFrag(s)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),l}(N.default)},"./src/controller/subtitle-stream-controller.ts":function(ae,$,R){"use strict";R.r($),R.d($,"SubtitleStreamController",function(){return d});var X=R("./src/events.ts"),N=R("./src/utils/logger.ts"),I=R("./src/utils/buffer-helper.ts"),z=R("./src/controller/fragment-finders.ts"),j=R("./src/utils/discontinuities.ts"),O=R("./src/controller/level-helper.ts"),P=R("./src/controller/fragment-tracker.ts"),E=R("./src/controller/base-stream-controller.ts"),L=R("./src/types/loader.ts"),D=R("./src/types/level.ts");function T(c,C){for(var y=0;y=s[v].start&&b<=s[v].end){a=s[v];break}var x=f.start+f.duration;a?a.end=x:(a={start:b,end:x},s.push(a)),this.fragmentTracker.fragBuffered(f)},y.onBufferFlushing=function(l,S){var f=S.startOffset,p=S.endOffset;if(f===0&&p!==Number.POSITIVE_INFINITY){var s=this.currentTrackId,a=this.levels;if(!a.length||!a[s]||!a[s].details)return;var b=a[s].details,v=b.targetduration,x=p-v;if(x<=0)return;S.endOffsetSubtitles=Math.max(0,x),this.tracksBuffered.forEach(function(k){for(var H=0;H=b.length||s!==a||!v)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,p.live||(f=v.details)!==null&&f!==void 0&&f.live){var x=this.mainDetails;if(p.deltaUpdateFailed||!x)return;var k=x.fragments[0];if(!v.details)p.hasProgramDateTime&&x.hasProgramDateTime?Object(j.alignMediaPlaylistByPDT)(p,x):k&&Object(O.addSliding)(p,k.start);else{var H=this.alignPlaylists(p,v.details);H===0&&k&&Object(O.addSliding)(p,k.start)}}if(v.details=p,this.levelLastLoaded=s,this.tick(),p.live&&!this.fragCurrent&&this.media&&this.state===E.State.IDLE){var V=Object(z.findFragmentByPTS)(null,p.fragments,this.media.currentTime,0);V||(this.warn("Subtitle playlist not aligned with playback"),v.details=void 0)}},y._handleFragmentLoadComplete=function(l){var S=l.frag,f=l.payload,p=S.decryptdata,s=this.hls;if(this.fragContextChanged(S))return;if(f&&f.byteLength>0&&p&&p.key&&p.iv&&p.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(f),p.key.buffer,p.iv.buffer).then(function(b){var v=performance.now();s.trigger(X.Events.FRAG_DECRYPTED,{frag:S,payload:b,stats:{tstart:a,tdecrypt:v}})})}},y.doTick=function(){if(!this.media){this.state=E.State.IDLE;return}if(this.state===E.State.IDLE){var l,S=this.currentTrackId,f=this.levels;if(!f.length||!f[S]||!f[S].details)return;var p=f[S].details,s=p.targetduration,a=this.config,b=this.media,v=I.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,b.currentTime-s,a.maxBufferHole),x=v.end,k=v.len,H=this.getMaxBufferLength()+s;if(k>H)return;console.assert(p,"Subtitle track details are defined on idle subtitle stream controller tick");var V=p.fragments,Q=V.length,G=p.edge,W,q=this.fragPrevious;if(x-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)},w.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},w.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 o=D(this.media.textTracks);o.forEach(function(d){Object(N.clearCurrentCues)(d)}),this.subtitleTrack=-1,this.media=null},w.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},w.onManifestParsed=function(o,d){this.tracks=d.subtitleTracks},w.onSubtitleTrackLoaded=function(o,d){var c=d.id,C=d.details,y=this.trackId,m=this.tracksInGroup[y];if(!m){this.warn("Invalid subtitle track id "+c);return}var l=m.details;m.details=d.details,this.log("subtitle track "+c+" loaded ["+C.startSN+"-"+C.endSN+"]"),c===this.trackId&&(this.retryCount=0,this.playlistLoaded(c,d,l))},w.onLevelLoading=function(o,d){this.switchLevel(d.level)},w.onLevelSwitching=function(o,d){this.switchLevel(d.level)},w.switchLevel=function(o){var d=this.hls.levels[o];if(!(d!=null&&d.textGroupIds))return;var c=d.textGroupIds[d.urlId];if(this.groupId!==c){var C=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,y=this.tracks.filter(function(S){return!c||S.groupId===c});this.tracksInGroup=y;var m=this.findTrackId(C==null?void 0:C.name)||this.findTrackId();this.groupId=c;var l={subtitleTracks:y};this.log("Updating subtitle tracks, "+y.length+' track(s) found in "'+c+'" group-id'),this.hls.trigger(X.Events.SUBTITLE_TRACKS_UPDATED,l),m!==-1&&this.setSubtitleTrack(m,C)}},w.findTrackId=function(o){for(var d=this.tracksInGroup,c=0;c=C.length)return;this.clearTimer();var y=C[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,y){var m=y.id,l=y.groupId,S=l===void 0?"":l,f=y.name,p=y.type,s=y.url;this.hls.trigger(X.Events.SUBTITLE_TRACK_SWITCH,{id:m,groupId:S,name:f,type:p,url:s});var a=this.switchParams(y.url,d==null?void 0:d.details);this.loadPlaylist(a)}else this.hls.trigger(X.Events.SUBTITLE_TRACK_SWITCH,{id:o})},w.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,d=D(this.media.textTracks),c=0;c=0&&(p[0]=Math.min(p[0],C),p[1]=Math.max(p[1],y),S=!0,s/(y-C)>.5))return}if(S||l.push([C,y]),this.config.renderTextTracksNatively){var a=this.captionsTracks[c];this.Cues.newCue(a,C,y,m)}else{var b=this.Cues.newCue(null,C,y,m);this.hls.trigger(N.Events.CUES_PARSED,{type:"captions",cues:b,track:c})}},o.onInitPtsFound=function(c,C){var y=this,m=C.frag,l=C.id,S=C.initPTS,f=C.timescale,p=this.unparsedVttFrags;l==="main"&&(this.initPTS[m.cc]=S,this.timescale[m.cc]=f),p.length&&(this.unparsedVttFrags=[],p.forEach(function(s){y.onFragLoaded(N.Events.FRAG_LOADED,s)}))},o.getExistingTrack=function(c){var C=this.media;if(C)for(var y=0;y>>8^f&255^99,P[m]=f,E[f]=m;var p=y[m],s=y[p],a=y[s],b=y[f]*257^f*16843008;D[m]=b<<24|b>>>8,T[m]=b<<16|b>>>16,A[m]=b<<8|b>>>24,w[m]=b,b=a*16843009^s*65537^p*257^m*16843008,o[f]=b<<24|b>>>8,d[f]=b<<16|b>>>16,c[f]=b<<8|b>>>24,C[f]=b,m?(m=p^y[y[y[a^p]]],l^=y[y[l]]):m=l=1}},j.expandKey=function(P){for(var E=this.uint8ArrayToUint32Array_(P),L=!0,D=0;D>>6)+1;var b=(c[C+2]&60)>>>2;if(b>a.length-1){d.trigger(I.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+b});return}return S=(c[C+2]&1)<<2,S|=(c[C+3]&192)>>>6,X.logger.log("manifest codec:"+y+", ADTS type:"+m+", samplingIndex:"+b),/firefox/i.test(p)?b>=6?(m=5,f=new Array(4),l=b-3):(m=2,f=new Array(2),l=b):p.indexOf("android")!==-1?(m=2,f=new Array(2),l=b):(m=5,f=new Array(4),y&&(y.indexOf("mp4a.40.29")!==-1||y.indexOf("mp4a.40.5")!==-1)||!y&&b>=6?l=b-3:((y&&y.indexOf("mp4a.40.2")!==-1&&(b>=6&&S===1||/vivaldi/i.test(p))||!y&&S===1)&&(m=2,f=new Array(2)),l=b)),f[0]=m<<3,f[0]|=(b&14)>>1,f[1]|=(b&1)<<7,f[1]|=S<<3,m===5&&(f[1]|=(l&14)>>1,f[2]=(l&1)<<7,f[2]|=2<<2,f[3]=0),{config:f,samplerate:a[b],channelCount:S,codec:"mp4a.40."+m,manifestCodec:s}}function j(d,c){return d[c]===255&&(d[c+1]&246)===240}function O(d,c){return d[c+1]&1?7:9}function P(d,c){return(d[c+3]&3)<<11|d[c+4]<<3|(d[c+5]&224)>>>5}function E(d,c){return c+5=d.length)return!1;var y=P(d,c);if(y<=C)return!1;var m=c+y;return m===d.length||L(d,m)}return!1}function A(d,c,C,y,m){if(!d.samplerate){var l=z(c,C,y,m);if(!l)return;d.config=l.config,d.samplerate=l.samplerate,d.channelCount=l.channelCount,d.codec=l.codec,d.manifestCodec=l.manifestCodec,X.logger.log("parsed codec:"+d.codec+", rate:"+l.samplerate+", channels:"+l.channelCount)}}function w(d){return 1024*9e4/d}function h(d,c,C,y,m){var l=O(d,c),S=P(d,c);if(S-=l,S>0){var f=C+y*m;return{headerLength:l,frameLength:S,stamp:f}}}function o(d,c,C,y,m){var l=w(d.samplerate),S=h(c,C,y,m,l);if(S){var f=S.frameLength,p=S.headerLength,s=S.stamp,a=p+f,b=Math.max(0,C+a-c.length),v;b?(v=new Uint8Array(a-p),v.set(c.subarray(C+p,c.length),0)):v=c.subarray(C+p,C+a);var x={unit:v,pts:s};return b||d.samples.push(x),{sample:x,length:a,missing:b}}}},"./src/demux/base-audio-demuxer.ts":function(ae,$,R){"use strict";R.r($),R.d($,"initPTSFn",function(){return P});var X=R("./src/polyfills/number.ts"),N=R("./src/demux/id3.ts"),I=R("./src/demux/dummy-demuxed-track.ts"),z=R("./src/utils/mp4-tools.ts"),j=R("./src/utils/typed-array.ts"),O=function(){function E(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var L=E.prototype;return L.resetInitSegment=function(T,A,w){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},L.resetTimeStamp=function(){},L.resetContiguity=function(){},L.canParse=function(T,A){return!1},L.appendFrame=function(T,A,w){},L.demux=function(T,A){this.cachedData&&(T=Object(z.appendUint8Array)(this.cachedData,T),this.cachedData=null);var w=N.getID3Data(T,0),h=w?w.length:0,o,d,c=this._audioTrack,C=this._id3Track,y=w?N.getTimeStamp(w):void 0,m=T.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=P(y,A)),w&&w.length>0&&C.samples.push({pts:this.initPTS,dts:this.initPTS,data:w}),d=this.initPTS;hO?(this.word<<=O,this.bitsAvailable-=O):(O-=this.bitsAvailable,P=O>>3,O-=P>>3,this.bytesAvailable-=P,this.loadWord(),this.word<<=O,this.bitsAvailable-=O)},z.readBits=function(O){var P=Math.min(this.bitsAvailable,O),E=this.word>>>32-P;return O>32&&X.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=P,this.bitsAvailable>0?this.word<<=P:this.bytesAvailable>0&&this.loadWord(),P=O-P,P>0&&this.bitsAvailable?E<>>O)!==0)return this.word<<=O,this.bitsAvailable-=O,O;return this.loadWord(),O+this.skipLZ()},z.skipUEG=function(){this.skipBits(1+this.skipLZ())},z.skipEG=function(){this.skipBits(1+this.skipLZ())},z.readUEG=function(){var O=this.skipLZ();return this.readBits(O+1)-1},z.readEG=function(){var O=this.readUEG();return 1&O?1+O>>>1:-1*(O>>>1)},z.readBoolean=function(){return this.readBits(1)===1},z.readUByte=function(){return this.readBits(8)},z.readUShort=function(){return this.readBits(16)},z.readUInt=function(){return this.readBits(32)},z.skipScalingList=function(O){for(var P=8,E=8,L,D=0;D0?m.subarray(S,S+f):void 0},z=function(m,l){var S=0;return S=(m[l]&127)<<21,S|=(m[l+1]&127)<<14,S|=(m[l+2]&127)<<7,S|=m[l+3]&127,S},j=function(m,l){return X(m,l)&&z(m,l+6)+10<=m.length-l},O=function(m){for(var l=L(m),S=0;S>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:x+=String.fromCharCode(a);break;case 12:case 13:b=m[k++],x+=String.fromCharCode((a&31)<<6|b&63);break;case 14:b=m[k++],v=m[k++],x+=String.fromCharCode((a&15)<<12|(b&63)<<6|(v&63)<<0);break;default:}}return x},d={decodeTextFrame:A},c;function C(){return!c&&typeof self.TextDecoder!="undefined"&&(c=new self.TextDecoder("utf-8")),c}},"./src/demux/mp3demuxer.ts":function(ae,$,R){"use strict";R.r($);var X=R("./src/demux/base-audio-demuxer.ts"),N=R("./src/demux/id3.ts"),I=R("./src/utils/logger.ts"),z=R("./src/demux/mpegaudio.ts");function j(E,L){E.prototype=Object.create(L.prototype),E.prototype.constructor=E,O(E,L)}function O(E,L){return O=Object.setPrototypeOf||function(T,A){return T.__proto__=A,T},O(E,L)}var P=function(E){j(L,E);function L(){return E.apply(this,arguments)||this}var D=L.prototype;return D.resetInitSegment=function(A,w,h){E.prototype.resetInitSegment.call(this,A,w,h),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:A,duration:h,inputTimeScale:9e4,dropped:0}},L.probe=function(A){if(!A)return!1;for(var w=N.getID3Data(A,0)||[],h=w.length,o=A.length;h0},j.demux=function(P){var E=P,L=Object(N.dummyTrack)();if(this.config.progressive){this.remainderData&&(E=Object(X.appendUint8Array)(this.remainderData,P));var D=Object(X.segmentValidRange)(E);this.remainderData=D.remainder,L.samples=D.valid||new Uint8Array}else L.samples=E;return{audioTrack:Object(N.dummyTrack)(),avcTrack:L,id3Track:Object(N.dummyTrack)(),textTrack:Object(N.dummyTrack)()}},j.flush=function(){var P=Object(N.dummyTrack)();return P.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(N.dummyTrack)(),avcTrack:P,id3Track:Object(N.dummyTrack)(),textTrack:Object(N.dummyTrack)()}},j.demuxSampleAes=function(P,E,L){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},j.destroy=function(){},z}();I.minProbeByteLength=1024,$.default=I},"./src/demux/mpegaudio.ts":function(ae,$,R){"use strict";R.r($),R.d($,"appendFrame",function(){return O}),R.d($,"parseHeader",function(){return P}),R.d($,"isHeaderPattern",function(){return E}),R.d($,"isHeader",function(){return L}),R.d($,"canParse",function(){return D}),R.d($,"probe",function(){return T});var X=null,N=[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],I=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],z=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],j=[0,1,1,4];function O(A,w,h,o,d){if(h+24>w.length)return;var c=P(w,h);if(c&&h+c.frameLength<=w.length){var C=c.samplesPerFrame*9e4/c.sampleRate,y=o+d*C,m={unit:w.subarray(h,h+c.frameLength),pts:y,dts:y};return A.config=[],A.channelCount=c.channelCount,A.samplerate=c.sampleRate,A.samples.push(m),{sample:m,length:c.frameLength,missing:0}}}function P(A,w){var h=A[w+1]>>3&3,o=A[w+1]>>1&3,d=A[w+2]>>4&15,c=A[w+2]>>2&3;if(h!==1&&d!==0&&d!==15&&c!==3){var C=A[w+2]>>1&1,y=A[w+3]>>6,m=h===3?3-o:o===3?3:4,l=N[m*14+d-1]*1e3,S=h===3?0:h===2?1:2,f=I[S*3+c],p=y===3?1:2,s=z[h][o],a=j[o],b=s*8*a,v=Math.floor(s*l/f+C)*a;if(X===null){var x=navigator.userAgent||"",k=x.match(/Chrome\/(\d+)/i);X=k?parseInt(k[1]):0}var H=!!X&&X<=87;return H&&o===2&&l>=224e3&&y===0&&(A[w+3]=A[w+3]|128),{sampleRate:f,channelCount:p,frameLength:v,samplesPerFrame:b}}}function E(A,w){return A[w]===255&&(A[w+1]&224)===224&&(A[w+1]&6)!==0}function L(A,w){return w+1=P.length){L();return}if(P[E].unit.length<32)continue;var D=this.decrypter.isSync();if(this.decryptAacSample(P,E,L,D),!D)return}},j.getAvcEncryptedData=function(P){for(var E=Math.floor((P.length-48)/160)*16+16,L=new Int8Array(E),D=0,T=32;T<=P.length-16;T+=160,D+=16)L.set(P.subarray(T,T+16),D);return L},j.getAvcDecryptedUnit=function(P,E){for(var L=new Uint8Array(E),D=0,T=32;T<=P.length-16;T+=160,D+=16)P.set(L.subarray(D,D+16),T);return P},j.decryptAvcSample=function(P,E,L,D,T,A){var w=Object(N.discardEPB)(T.data),h=this.getAvcEncryptedData(w),o=this;this.decryptBuffer(h.buffer,function(d){T.data=o.getAvcDecryptedUnit(w,d),A||o.decryptAvcSamples(P,E,L+1,D)})},j.decryptAvcSamples=function(P,E,L,D){if(P instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;E++,L=0){if(E>=P.length){D();return}for(var T=P[E].units;!(L>=T.length);L++){var A=T[L];if(A.data.length<=48||A.type!==1&&A.type!==5)continue;var w=this.decrypter.isSync();if(this.decryptAvcSample(P,E,L,D,A,w),!w)return}}},z}();$.default=I},"./src/demux/transmuxer-interface.ts":function(ae,$,R){"use strict";R.r($),R.d($,"default",function(){return T});var X=R("./node_modules/webworkify-webpack/index.js"),N=R.n(X),I=R("./src/events.ts"),z=R("./src/demux/transmuxer.ts"),j=R("./src/utils/logger.ts"),O=R("./src/errors.ts"),P=R("./src/utils/mediasource-helper.ts"),E=R("./node_modules/eventemitter3/index.js"),L=R.n(E),D=Object(P.getMediaSource)()||{isTypeSupported:function(){return!1}},T=function(){function A(h,o,d,c){var C=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=h,this.id=o,this.onTransmuxComplete=d,this.onFlush=c;var y=h.config,m=function(s,a){a=a||{},a.frag=C.frag,a.id=C.id,h.trigger(s,a)};this.observer=new E.EventEmitter,this.observer.on(I.Events.FRAG_DECRYPTED,m),this.observer.on(I.Events.ERROR,m);var l={mp4:D.isTypeSupported("video/mp4"),mpeg:D.isTypeSupported("audio/mpeg"),mp3:D.isTypeSupported('audio/mp4; codecs="mp3"')},S=navigator.vendor;if(y.enableWorker&&typeof Worker!="undefined"){j.logger.log("demuxing in webworker");var f;try{f=this.worker=X("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),f.addEventListener("message",this.onwmsg),f.onerror=function(p){h.trigger(I.Events.ERROR,{type:O.ErrorTypes.OTHER_ERROR,details:O.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(p.message+" ("+p.filename+":"+p.lineno+")")})},f.postMessage({cmd:"init",typeSupported:l,vendor:S,id:o,config:JSON.stringify(y)})}catch(p){j.logger.warn("Error in worker:",p),j.logger.error("Error while initializing DemuxerWorker, fallback to inline"),f&&self.URL.revokeObjectURL(f.objectURL),this.transmuxer=new z.default(this.observer,l,y,S,o),this.worker=null}}else this.transmuxer=new z.default(this.observer,l,y,S,o)}var w=A.prototype;return w.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var d=this.transmuxer;d&&(d.destroy(),this.transmuxer=null)}var c=this.observer;c&&c.removeAllListeners(),this.observer=null},w.push=function(o,d,c,C,y,m,l,S,f,p){var s=this;f.transmuxing.start=self.performance.now();var a=this.transmuxer,b=this.worker,v=m?m.start:y.start,x=y.decryptdata,k=this.frag,H=!(k&&y.cc===k.cc),V=!(k&&f.level===k.level),Q=k?f.sn-k.sn:-1,G=this.part?f.part-this.part.index:1,W=!V&&(Q===1||Q===0&&G===1),q=self.performance.now();(V||Q||y.stats.parsing.start===0)&&(y.stats.parsing.start=q),m&&(G||!W)&&(m.stats.parsing.start=q);var oe=new z.TransmuxState(H,W,S,V,v);if(!W||H){j.logger.log("[transmuxer-interface, "+y.type+"]: Starting new transmux session for sn: "+f.sn+" p: "+f.part+" level: "+f.level+" id: "+f.id+` discontinuity: `+H+` trackSwitch: `+V+` contiguous: `+W+` accurateTimeOffset: `+S+` timeOffset: `+v);var fe=new z.TransmuxConfig(c,C,d,l,p);this.configureTransmuxer(fe)}if(this.frag=y,this.part=m,b)b.postMessage({cmd:"demux",data:o,decryptdata:x,chunkMeta:f,state:oe},o instanceof ArrayBuffer?[o]:[]);else if(a){var ve=a.push(o,x,f,oe);Object(z.isPromise)(ve)?ve.then(function(ke){s.handleTransmuxComplete(ke)}):this.handleTransmuxComplete(ve)}},w.flush=function(o){var d=this;o.transmuxing.start=self.performance.now();var c=this.transmuxer,C=this.worker;if(C)C.postMessage({cmd:"flush",chunkMeta:o});else if(c){var y=c.flush(o);Object(z.isPromise)(y)?y.then(function(m){d.handleFlushResult(m,o)}):this.handleFlushResult(y,o)}},w.handleFlushResult=function(o,d){var c=this;o.forEach(function(C){c.handleTransmuxComplete(C)}),this.onFlush(d)},w.onWorkerMessage=function(o){var d=o.data,c=this.hls;switch(d.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(d.data);break}case"flush":{this.onFlush(d.data);break}default:{d.data=d.data||{},d.data.frag=this.frag,d.data.id=this.id,c.trigger(d.event,d.data);break}}},w.configureTransmuxer=function(o){var d=this.worker,c=this.transmuxer;d?d.postMessage({cmd:"configure",config:o}):c&&c.configure(o)},w.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},A}()},"./src/demux/transmuxer-worker.ts":function(ae,$,R){"use strict";R.r($),R.d($,"default",function(){return O});var X=R("./src/demux/transmuxer.ts"),N=R("./src/events.ts"),I=R("./src/utils/logger.ts"),z=R("./node_modules/eventemitter3/index.js"),j=R.n(z);function O(T){var A=new z.EventEmitter,w=function(o,d){T.postMessage({event:o,data:d})};A.on(N.Events.FRAG_DECRYPTED,w),A.on(N.Events.ERROR,w),T.addEventListener("message",function(h){var o=h.data;switch(o.cmd){case"init":{var d=JSON.parse(o.config);T.transmuxer=new X.default(A,o.typeSupported,d,o.vendor,o.id),Object(I.enableLogs)(d.debug),w("init",null);break}case"configure":{T.transmuxer.configure(o.config);break}case"demux":{var c=T.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(X.isPromise)(c)?c.then(function(m){P(T,m)}):P(T,c);break}case"flush":{var C=o.chunkMeta,y=T.transmuxer.flush(C);Object(X.isPromise)(y)?y.then(function(m){L(T,m,C)}):L(T,y,C);break}default:break}})}function P(T,A){if(D(A.remuxResult))return;var w=[],h=A.remuxResult,o=h.audio,d=h.video;o&&E(w,o),d&&E(w,d),T.postMessage({event:"transmuxComplete",data:A},w)}function E(T,A){A.data1&&T.push(A.data1.buffer),A.data2&&T.push(A.data2.buffer)}function L(T,A,w){A.forEach(function(h){P(T,h)}),T.postMessage({event:"flush",data:w})}function D(T){return!T.audio&&!T.video&&!T.text&&!T.id3&&!T.initSegment}},"./src/demux/transmuxer.ts":function(ae,$,R){"use strict";R.r($),R.d($,"default",function(){return d}),R.d($,"isPromise",function(){return y}),R.d($,"TransmuxConfig",function(){return m}),R.d($,"TransmuxState",function(){return l});var X=R("./src/events.ts"),N=R("./src/errors.ts"),I=R("./src/crypt/decrypter.ts"),z=R("./src/demux/aacdemuxer.ts"),j=R("./src/demux/mp4demuxer.ts"),O=R("./src/demux/tsdemuxer.ts"),P=R("./src/demux/mp3demuxer.ts"),E=R("./src/remux/mp4-remuxer.ts"),L=R("./src/remux/passthrough-remuxer.ts"),D=R("./src/demux/chunk-cache.ts"),T=R("./src/utils/mp4-tools.ts"),A=R("./src/utils/logger.ts"),w;try{w=self.performance.now.bind(self.performance)}catch(S){A.logger.debug("Unable to use Performance API on this environment"),w=self.Date.now}var h=[{demux:O.default,remux:E.default},{demux:j.default,remux:L.default},{demux:z.default,remux:E.default},{demux:P.default,remux:E.default}],o=1024;h.forEach(function(S){var f=S.demux;o=Math.max(o,f.minProbeByteLength)});var d=function(){function S(p,s,a,b,v){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 D.default,this.observer=p,this.typeSupported=s,this.config=a,this.vendor=b,this.id=v}var f=S.prototype;return f.configure=function(s){this.transmuxConfig=s,this.decrypter&&this.decrypter.reset()},f.push=function(s,a,b,v){var x=this,k=b.transmuxing;k.executeStart=w();var H=new Uint8Array(s),V=this.cache,Q=this.config,G=this.currentTransmuxState,W=this.transmuxConfig;v&&(this.currentTransmuxState=v);var q=c(H,a);if(q&&q.method==="AES-128"){var oe=this.getDecrypter();if(Q.enableSoftwareAES){var fe=oe.softwareDecrypt(H,q.key.buffer,q.iv.buffer);if(!fe)return k.executeEnd=w(),C(b);H=new Uint8Array(fe)}else return this.decryptionPromise=oe.webCryptoDecrypt(H,q.key.buffer,q.iv.buffer).then(function(Me){var He=x.push(Me,null,b);return x.decryptionPromise=null,He}),this.decryptionPromise}var ve=v||G,ke=ve.contiguous,Ee=ve.discontinuity,_e=ve.trackSwitch,Te=ve.accurateTimeOffset,Ce=ve.timeOffset,me=W.audioCodec,ne=W.videoCodec,we=W.defaultInitPts,tt=W.duration,Ye=W.initSegmentData;if((Ee||_e)&&this.resetInitSegment(Ye,me,ne,tt),Ee&&this.resetInitialTimestamp(we),ke||this.resetContiguity(),this.needsProbing(H,Ee,_e)){if(V.dataLength){var Xe=V.flush();H=Object(T.appendUint8Array)(Xe,H)}this.configureTransmuxer(H,W)}var Ve=this.transmux(H,q,Ce,Te,b),Le=this.currentTransmuxState;return Le.contiguous=!0,Le.discontinuity=!1,Le.trackSwitch=!1,k.executeEnd=w(),Ve},f.flush=function(s){var a=this,b=s.transmuxing;b.executeStart=w();var v=this.decrypter,x=this.cache,k=this.currentTransmuxState,H=this.decryptionPromise;if(H)return H.then(function(){return a.flush(s)});var V=[],Q=k.timeOffset;if(v){var G=v.flush();G&&V.push(this.push(G,null,s))}var W=x.dataLength;x.reset();var q=this.demuxer,oe=this.remuxer;if(!q||!oe)return W>=o&&this.observer.emit(X.Events.ERROR,X.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),b.executeEnd=w(),[C(s)];var fe=q.flush(Q);return y(fe)?fe.then(function(ve){return a.flushRemux(V,ve,s),V}):(this.flushRemux(V,fe,s),V)},f.flushRemux=function(s,a,b){var v=a.audioTrack,x=a.avcTrack,k=a.id3Track,H=a.textTrack,V=this.currentTransmuxState,Q=V.accurateTimeOffset,G=V.timeOffset;A.logger.log("[transmuxer.ts]: Flushed fragment "+b.sn+(b.part>-1?" p: "+b.part:"")+" of level "+b.level);var W=this.remuxer.remux(v,x,k,H,G,Q,!0,this.id);s.push({remuxResult:W,chunkMeta:b}),b.transmuxing.executeEnd=w()},f.resetInitialTimestamp=function(s){var a=this.demuxer,b=this.remuxer;if(!a||!b)return;a.resetTimeStamp(s),b.resetTimeStamp(s)},f.resetContiguity=function(){var s=this.demuxer,a=this.remuxer;if(!s||!a)return;s.resetContiguity(),a.resetNextTimestamp()},f.resetInitSegment=function(s,a,b,v){var x=this.demuxer,k=this.remuxer;if(!x||!k)return;x.resetInitSegment(a,b,v),k.resetInitSegment(s,a,b)},f.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},f.transmux=function(s,a,b,v,x){var k;return a&&a.method==="SAMPLE-AES"?k=this.transmuxSampleAes(s,a,b,v,x):k=this.transmuxUnencrypted(s,b,v,x),k},f.transmuxUnencrypted=function(s,a,b,v){var x=this.demuxer.demux(s,a,!1,!this.config.progressive),k=x.audioTrack,H=x.avcTrack,V=x.id3Track,Q=x.textTrack,G=this.remuxer.remux(k,H,V,Q,a,b,!1,this.id);return{remuxResult:G,chunkMeta:v}},f.transmuxSampleAes=function(s,a,b,v,x){var k=this;return this.demuxer.demuxSampleAes(s,a,b).then(function(H){var V=k.remuxer.remux(H.audioTrack,H.avcTrack,H.id3Track,H.textTrack,b,v,!1,k.id);return{remuxResult:V,chunkMeta:x}})},f.configureTransmuxer=function(s,a){for(var b=this.config,v=this.observer,x=this.typeSupported,k=this.vendor,H=a.audioCodec,V=a.defaultInitPts,Q=a.duration,G=a.initSegmentData,W=a.videoCodec,q,oe=0,fe=h.length;oe0&&f!=null&&f.key!=null&&f.iv!==null&&f.method!=null&&(p=f),p}var C=function(f){return{remuxResult:{},chunkMeta:f}};function y(S){return"then"in S&&S.then instanceof Function}var m=function(f,p,s,a,b){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=f,this.videoCodec=p,this.initSegmentData=s,this.duration=a,this.defaultInitPts=b},l=function(f,p,s,a,b){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=f,this.contiguous=p,this.accurateTimeOffset=s,this.trackSwitch=a,this.timeOffset=b}},"./src/demux/tsdemuxer.ts":function(ae,$,R){"use strict";R.r($),R.d($,"discardEPB",function(){return C});var X=R("./src/demux/adts.ts"),N=R("./src/demux/mpegaudio.ts"),I=R("./src/demux/exp-golomb.ts"),z=R("./src/demux/id3.ts"),j=R("./src/demux/sample-aes.ts"),O=R("./src/events.ts"),P=R("./src/utils/mp4-tools.ts"),E=R("./src/utils/logger.ts"),L=R("./src/errors.ts"),D={video:1,audio:2,id3:3,text:4},T=function(){function y(l,S,f){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=l,this.config=S,this.typeSupported=f}y.probe=function(S){var f=y.syncOffset(S);return f<0?!1:(f&&E.logger.warn("MPEG2-TS detected but first sync word found @ offset "+f+", junk ahead ?"),!0)},y.syncOffset=function(S){for(var f=Math.min(1e3,S.length-3*188),p=0;p>4,me=void 0;if(Ce>1){if(me=Ee+5+S[Ee+4],me===Ee+188)continue}else me=Ee+4;switch(Te){case k:_e&&(H&&(a=o(H))&&this.parseAVCPES(a,!1),H={data:[],size:0}),H&&(H.data.push(S.subarray(me,Ee+188)),H.size+=Ee+188-me);break;case V:_e&&(G&&(a=o(G))&&(v.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),G={data:[],size:0}),G&&(G.data.push(S.subarray(me,Ee+188)),G.size+=Ee+188-me);break;case Q:_e&&(W&&(a=o(W))&&this.parseID3PES(a),W={data:[],size:0}),W&&(W.data.push(S.subarray(me,Ee+188)),W.size+=Ee+188-me);break;case 0:_e&&(me+=S[me]+1),fe=this._pmtId=w(S,me);break;case fe:{_e&&(me+=S[me]+1);var ne=h(S,me,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,p);k=ne.avc,k>0&&(b.pid=k),V=ne.audio,V>0&&(v.pid=V,v.isAAC=ne.isAAC),Q=ne.id3,Q>0&&(x.pid=Q),q&&!oe&&(E.logger.log("reparse from beginning"),q=!1,Ee=ke-188),oe=this.pmtParsed=!0;break}case 17:case 8191:break;default:q=!0;break}}else this.observer.emit(O.Events.ERROR,O.Events.ERROR,{type:L.ErrorTypes.MEDIA_ERROR,details:L.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});b.pesData=H,v.pesData=G,x.pesData=W;var we={audioTrack:v,avcTrack:b,id3Track:x,textTrack:this._txtTrack};return s&&this.extractRemainingSamples(we),we},m.flush=function(){var S=this.remainderData;this.remainderData=null;var f;return S?f=this.demux(S,-1,!1,!0):f={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(f),this.sampleAes?this.decrypt(f,this.sampleAes):f},m.extractRemainingSamples=function(S){var f=S.audioTrack,p=S.avcTrack,s=S.id3Track,a=p.pesData,b=f.pesData,v=s.pesData,x;a&&(x=o(a))?(this.parseAVCPES(x,!0),p.pesData=null):p.pesData=a,b&&(x=o(b))?(f.isAAC?this.parseAACPES(x):this.parseMPEGPES(x),f.pesData=null):(b!=null&&b.size&&E.logger.log("last AAC PES packet truncated,might overlap between fragments"),f.pesData=b),v&&(x=o(v))?(this.parseID3PES(x),s.pesData=null):s.pesData=v},m.demuxSampleAes=function(S,f,p){var s=this.demux(S,p,!0,!this.config.progressive),a=this.sampleAes=new j.default(this.observer,this.config,f);return this.decrypt(s,a)},m.decrypt=function(S,f){return new Promise(function(p){var s=S.audioTrack,a=S.avcTrack;s.samples&&s.isAAC?f.decryptAacSamples(s.samples,0,function(){a.samples?f.decryptAvcSamples(a.samples,0,0,function(){p(S)}):p(S)}):a.samples&&f.decryptAvcSamples(a.samples,0,0,function(){p(S)})})},m.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},m.parseAVCPES=function(S,f){var p=this,s=this._avcTrack,a=this.parseAVCNALu(S.data),b=!1,v=this.avcSample,x,k=!1;S.data=null,v&&a.length&&!s.audFound&&(d(v,s),v=this.avcSample=A(!1,S.pts,S.dts,"")),a.forEach(function(H){switch(H.type){case 1:{x=!0,v||(v=p.avcSample=A(!0,S.pts,S.dts,"")),b&&(v.debug+="NDR "),v.frame=!0;var V=H.data;if(k&&V.length>4){var Q=new I.default(V).readSliceType();(Q===2||Q===4||Q===7||Q===9)&&(v.key=!0)}break}case 5:x=!0,v||(v=p.avcSample=A(!0,S.pts,S.dts,"")),b&&(v.debug+="IDR "),v.key=!0,v.frame=!0;break;case 6:{x=!0,b&&v&&(v.debug+="SEI ");var G=new I.default(C(H.data));G.readUByte();for(var W=0,q=0,oe=!1,fe=0;!oe&&G.bytesAvailable>1;){W=0;do fe=G.readUByte(),W+=fe;while(fe===255);q=0;do fe=G.readUByte(),q+=fe;while(fe===255);if(W===4&&G.bytesAvailable!==0){oe=!0;var ve=G.readUByte();if(ve===181){var ke=G.readUShort();if(ke===49){var Ee=G.readUInt();if(Ee===1195456820){var _e=G.readUByte();if(_e===3){for(var Te=G.readUByte(),Ce=G.readUByte(),me=31&Te,ne=[Te,Ce],we=0;we16){for(var tt=[],Ye=0;Ye<16;Ye++)tt.push(G.readUByte().toString(16)),(Ye===3||Ye===5||Ye===7||Ye===9)&&tt.push("-");for(var Xe=q-16,Ve=new Uint8Array(Xe),Le=0;Le=0){var G={data:S.subarray(V,v-s-1),type:Q};b.push(G)}else{var W=this.getLastNalUnit();if(W&&(a&&v<=4-a&&(W.state&&(W.data=W.data.subarray(0,W.data.byteLength-a))),k=v-s-1,k>0)){var q=new Uint8Array(W.data.byteLength+k);q.set(W.data,0),q.set(S.subarray(0,k),W.data.byteLength),W.data=q,W.state=0}}v=0&&s>=0){var oe={data:S.subarray(V,f),type:Q,state:s};b.push(oe)}if(b.length===0){var fe=this.getLastNalUnit();if(fe){var ve=new Uint8Array(fe.data.byteLength+S.byteLength);ve.set(fe.data,0),ve.set(S,fe.data.byteLength),fe.data=ve}}return p.naluState=s,b},m.parseAACPES=function(S){var f=0,p=this._audioTrack,s=this.aacOverFlow,a=S.data;if(s){this.aacOverFlow=null;var b=s.sample.unit.byteLength,v=Math.min(s.missing,b),x=b-v;s.sample.unit.set(a.subarray(0,v),x),p.samples.push(s.sample),f=s.missing}var k,H;for(k=f,H=a.length;k1;){var b=new Uint8Array(a[0].length+a[1].length);b.set(a[0]),b.set(a[1],a[0].length),a[0]=b,a.splice(1,1)}l=a[0];var v=(l[0]<<16)+(l[1]<<8)+l[2];if(v===1){if(S=(l[4]<<8)+l[5],S&&S>y.size-6)return null;var x=l[7];x&192&&(p=(l[9]&14)*536870912+(l[10]&255)*4194304+(l[11]&254)*16384+(l[12]&255)*128+(l[13]&254)/2,x&64?(s=(l[14]&14)*536870912+(l[15]&255)*4194304+(l[16]&254)*16384+(l[17]&255)*128+(l[18]&254)/2,p-s>60*9e4&&(E.logger.warn(Math.round((p-s)/9e4)+"s delta between PTS and DTS, align them"),p=s)):s=p),f=l[8];var k=f+9;if(y.size<=k)return null;y.size-=k;for(var H=new Uint8Array(y.size),V=0,Q=a.length;VG){k-=G;continue}else l=l.subarray(k),G-=k,k=0;H.set(l,m),m+=G}return S&&(S-=f+3),{data:H,pts:p,dts:s,len:S}}return null}function d(y,m){if(y.units.length&&y.frame){if(y.pts===void 0){var l=m.samples,S=l.length;if(S){var f=l[S-1];y.pts=f.pts,y.dts=f.dts}else{m.dropped++;return}}m.samples.push(y)}y.debug.length&&E.logger.log(y.pts+"/"+y.dts+":"+y.debug)}function c(y,m){var l=y.length;if(l>0){if(m.pts>=y[l-1].pts)y.push(m);else for(var S=l-1;S>=0;S--)if(m.ptsp)return a;return 0}},{key:"maxAutoLevel",get:function(){var f=this.levels,p=this.autoLevelCapping,s;return p===-1&&f&&f.length?s=f.length-1:s=p,s}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(f){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,f)}},{key:"audioTracks",get:function(){var f=this.audioTrackController;return f?f.audioTracks:[]}},{key:"audioTrack",get:function(){var f=this.audioTrackController;return f?f.audioTrack:-1},set:function(f){var p=this.audioTrackController;p&&(p.audioTrack=f)}},{key:"subtitleTracks",get:function(){var f=this.subtitleTrackController;return f?f.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var f=this.subtitleTrackController;return f?f.subtitleTrack:-1},set:function(f){var p=this.subtitleTrackController;p&&(p.subtitleTrack=f)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var f=this.subtitleTrackController;return f?f.subtitleDisplay:!1},set:function(f){var p=this.subtitleTrackController;p&&(p.subtitleDisplay=f)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(f){this.config.lowLatencyMode=f}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return o.Events}},{key:"ErrorTypes",get:function(){return d.ErrorTypes}},{key:"ErrorDetails",get:function(){return d.ErrorDetails}},{key:"DefaultConfig",get:function(){return m.defaultConfig?m.defaultConfig:A.hlsDefaultConfig},set:function(f){m.defaultConfig=f}}]),m}();y.defaultConfig=void 0},"./src/is-supported.ts":function(ae,$,R){"use strict";R.r($),R.d($,"isSupported",function(){return I}),R.d($,"changeTypeSupported",function(){return z});var X=R("./src/utils/mediasource-helper.ts");function N(){return self.SourceBuffer||self.WebKitSourceBuffer}function I(){var j=Object(X.getMediaSource)();if(!j)return!1;var O=N(),P=j&&typeof j.isTypeSupported=="function"&&j.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),E=!O||O.prototype&&typeof O.prototype.appendBuffer=="function"&&typeof O.prototype.remove=="function";return!!P&&!!E}function z(){var j,O=N();return typeof(O==null||((j=O.prototype)===null||j===void 0)?void 0:j.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ae,$,R){"use strict";R.r($),R.d($,"default",function(){return T}),R.d($,"LoadError",function(){return w});var X=R("./src/polyfills/number.ts"),N=R("./src/errors.ts");function I(h,o){h.prototype=Object.create(o.prototype),h.prototype.constructor=h,E(h,o)}function z(h){var o=typeof Map=="function"?new Map:void 0;return z=function(c){if(c===null||!P(c))return c;if(typeof c!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(c))return o.get(c);o.set(c,C)}function C(){return j(c,arguments,L(this).constructor)}return C.prototype=Object.create(c.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),E(C,c)},z(h)}function j(h,o,d){return O()?j=Reflect.construct:j=function(C,y,m){var l=[null];l.push.apply(l,y);var S=Function.bind.apply(C,l),f=new S;return m&&E(f,m.prototype),f},j.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(h){return!1}}function P(h){return Function.toString.call(h).indexOf("[native code]")!==-1}function E(h,o){return E=Object.setPrototypeOf||function(c,C){return c.__proto__=C,c},E(h,o)}function L(h){return L=Object.setPrototypeOf?Object.getPrototypeOf:function(d){return d.__proto__||Object.getPrototypeOf(d)},L(h)}var D=Math.pow(2,17),T=function(){function h(d){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=d}var o=h.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(c,C){var y=this,m=c.url;if(!m)return Promise.reject(new w({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,networkDetails:null},"Fragment does not have a "+(m?"part list":"url")));this.abort();var l=this.config,S=l.fLoader,f=l.loader;return new Promise(function(p,s){y.loader&&y.loader.destroy();var a=y.loader=c.loader=S?new S(l):new f(l),b=A(c),v={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:D};c.stats=a.stats,a.load(b,v,{onSuccess:function(k,H,V,Q){y.resetLoader(c,a),p({frag:c,part:null,payload:k.data,networkDetails:Q})},onError:function(k,H,V){y.resetLoader(c,a),s(new w({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,response:k,networkDetails:V}))},onAbort:function(k,H,V){y.resetLoader(c,a),s(new w({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:c,networkDetails:V}))},onTimeout:function(k,H,V){y.resetLoader(c,a),s(new w({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:c,networkDetails:V}))},onProgress:function(k,H,V,Q){C&&C({frag:c,part:null,payload:V,networkDetails:Q})}})})},o.loadPart=function(c,C,y){var m=this;this.abort();var l=this.config,S=l.fLoader,f=l.loader;return new Promise(function(p,s){m.loader&&m.loader.destroy();var a=m.loader=c.loader=S?new S(l):new f(l),b=A(c,C),v={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:D};C.stats=a.stats,a.load(b,v,{onSuccess:function(k,H,V,Q){m.resetLoader(c,a),m.updateStatsFromPart(c,C);var G={frag:c,part:C,payload:k.data,networkDetails:Q};y(G),p(G)},onError:function(k,H,V){m.resetLoader(c,a),s(new w({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,part:C,response:k,networkDetails:V}))},onAbort:function(k,H,V){c.stats.aborted=C.stats.aborted,m.resetLoader(c,a),s(new w({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:c,part:C,networkDetails:V}))},onTimeout:function(k,H,V){m.resetLoader(c,a),s(new w({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:c,part:C,networkDetails:V}))}})})},o.updateStatsFromPart=function(c,C){var y=c.stats,m=C.stats,l=m.total;if(y.loaded+=m.loaded,l){var S=Math.round(c.duration/C.duration),f=Math.min(Math.round(y.loaded/l),S),p=S-f,s=p*Math.round(y.loaded/f);y.total=y.loaded+s}else y.total=Math.max(y.loaded,y.total);var a=y.loading,b=m.loading;a.start?a.first+=b.first-b.start:(a.start=b.start,a.first=b.first),a.end=b.end},o.resetLoader=function(c,C){c.loader=null,this.loader===C&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),C.destroy()},h}();function A(h,o){o===void 0&&(o=null);var d=o||h,c={frag:h,part:o,responseType:"arraybuffer",url:d.url,headers:{},rangeStart:0,rangeEnd:0},C=d.byteRangeStartOffset,y=d.byteRangeEndOffset;return Object(X.isFiniteNumber)(C)&&Object(X.isFiniteNumber)(y)&&(c.rangeStart=C,c.rangeEnd=y),c}var w=function(h){I(o,h);function o(d){for(var c,C=arguments.length,y=new Array(C>1?C-1:0),m=1;m>8*(15-l)&255;return m},c.setDecryptDataFromLevelKey=function(y,m){var l=y;return(y==null?void 0:y.method)==="AES-128"&&y.uri&&!y.iv&&(l=j.LevelKey.fromURI(y.uri),l.method=y.method,l.iv=this.createInitializationVector(m),l.keyFormat="identity"),l},c.setElementaryStreamInfo=function(y,m,l,S,f,p){p===void 0&&(p=!1);var s=this.elementaryStreams,a=s[y];if(!a){s[y]={startPTS:m,endPTS:l,startDTS:S,endDTS:f,partial:p};return}a.startPTS=Math.min(a.startPTS,m),a.endPTS=Math.max(a.endPTS,l),a.startDTS=Math.min(a.startDTS,S),a.endDTS=Math.max(a.endDTS,f)},c.clearElementaryStreamInfo=function(){var y=this.elementaryStreams;y[T.AUDIO]=null,y[T.VIDEO]=null,y[T.AUDIOVIDEO]=null},D(d,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var y=this.sn;typeof y!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&z.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),y=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,y)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(X.isFiniteNumber)(this.programDateTime))return null;var y=Object(X.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+y*1e3}},{key:"encrypted",get:function(){var y;return!!((y=this.decryptdata)!==null&&y!==void 0&&y.keyFormat&&this.decryptdata.uri)}}]),d}(A),h=function(o){P(d,o);function d(c,C,y,m,l){var S;S=o.call(this,y)||this,S.fragOffset=0,S.duration=0,S.gap=!1,S.independent=!1,S.relurl=void 0,S.fragment=void 0,S.index=void 0,S.stats=new O.LoadStats,S.duration=c.decimalFloatingPoint("DURATION"),S.gap=c.bool("GAP"),S.independent=c.bool("INDEPENDENT"),S.relurl=c.enumeratedString("URI"),S.fragment=C,S.index=m;var f=c.enumeratedString("BYTERANGE");return f&&S.setByteRange(f,l),l&&(S.fragOffset=l.fragOffset+l.duration),S}return D(d,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var C=this.elementaryStreams;return!!(C.audio||C.video||C.audiovideo)}}]),d}(A)},"./src/loader/key-loader.ts":function(ae,$,R){"use strict";R.r($),R.d($,"default",function(){return z});var X=R("./src/events.ts"),N=R("./src/errors.ts"),I=R("./src/utils/logger.ts"),z=function(){function j(P){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=P,this._registerListeners()}var O=j.prototype;return O._registerListeners=function(){this.hls.on(X.Events.KEY_LOADING,this.onKeyLoading,this)},O._unregisterListeners=function(){this.hls.off(X.Events.KEY_LOADING,this.onKeyLoading)},O.destroy=function(){this._unregisterListeners();for(var E in this.loaders){var L=this.loaders[E];L&&L.destroy()}this.loaders={}},O.onKeyLoading=function(E,L){var D=L.frag,T=D.type,A=this.loaders[T];if(!D.decryptdata){I.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var w=D.decryptdata.uri;if(w!==this.decrypturl||this.decryptkey===null){var h=this.hls.config;if(A&&(I.logger.warn("abort previous key loader for type:"+T),A.abort()),!w){I.logger.warn("key uri is falsy");return}var o=h.loader,d=D.loader=this.loaders[T]=new o(h);this.decrypturl=w,this.decryptkey=null;var c={url:w,frag:D,responseType:"arraybuffer"},C={timeout:h.fragLoadingTimeOut,maxRetry:0,retryDelay:h.fragLoadingRetryDelay,maxRetryDelay:h.fragLoadingMaxRetryTimeout,highWaterMark:0},y={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};d.load(c,C,y)}else this.decryptkey&&(D.decryptdata.key=this.decryptkey,this.hls.trigger(X.Events.KEY_LOADED,{frag:D}))},O.loadsuccess=function(E,L,D){var T=D.frag;if(!T.decryptdata){I.logger.error("after key load, decryptdata unset");return}this.decryptkey=T.decryptdata.key=new Uint8Array(E.data),T.loader=null,delete this.loaders[T.type],this.hls.trigger(X.Events.KEY_LOADED,{frag:T})},O.loaderror=function(E,L){var D=L.frag,T=D.loader;T&&T.abort(),delete this.loaders[D.type],this.hls.trigger(X.Events.ERROR,{type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:D,response:E})},O.loadtimeout=function(E,L){var D=L.frag,T=D.loader;T&&T.abort(),delete this.loaders[D.type],this.hls.trigger(X.Events.ERROR,{type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:D})},j}()},"./src/loader/level-details.ts":function(ae,$,R){"use strict";R.r($),R.d($,"LevelDetails",function(){return j});var X=R("./src/polyfills/number.ts");function N(O,P){for(var E=0;EL.endSN||D>0||D===0&&T>0,this.updated||this.advanced?this.misses=Math.floor(L.misses*.6):this.misses=L.misses+1,this.availabilityDelay=L.availabilityDelay},I(O,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(X.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||z}},{key:"drift",get:function(){var L=this.driftEndTime-this.driftStartTime;if(L>0){var D=this.driftEnd-this.driftStart;return D*1e3/L}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var L;return(L=this.partList)!==null&&L!==void 0&&L.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var L;return(L=this.fragments)!==null&&L!==void 0&&L.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 L;return(L=this.partList)!==null&&L!==void 0&&L.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var L;return(L=this.partList)!==null&&L!==void 0&&L.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),O}()},"./src/loader/level-key.ts":function(ae,$,R){"use strict";R.r($),R.d($,"LevelKey",function(){return j});var X=R("./node_modules/url-toolkit/src/url-toolkit.js"),N=R.n(X);function I(O,P){for(var E=0;E2){var s=p.shift()+".";return s+=parseInt(p.shift()).toString(16),s+=("000"+parseInt(p.shift()).toString(16)).substr(-4),s}return f},l.resolve=function(f,p){return N.buildAbsoluteURL(p,f,{alwaysNormalize:!0})},l.parseMasterPlaylist=function(f,p){var s=[],a={},b=!1;D.lastIndex=0;for(var v;(v=D.exec(f))!=null;)if(v[1]){var x=new P.AttrList(v[1]),k={attrs:x,bitrate:x.decimalInteger("AVERAGE-BANDWIDTH")||x.decimalInteger("BANDWIDTH"),name:x.NAME,url:l.resolve(v[2],p)},H=x.decimalResolution("RESOLUTION");H&&(k.width=H.width,k.height=H.height),c((x.CODECS||"").split(/[ ,]+/).filter(function(Q){return Q}),k),k.videoCodec&&k.videoCodec.indexOf("avc1")!==-1&&(k.videoCodec=l.convertAVC1ToAVCOTI(k.videoCodec)),s.push(k)}else if(v[3]){var V=new P.AttrList(v[3]);V["DATA-ID"]&&(b=!0,a[V["DATA-ID"]]=V)}return{levels:s,sessionData:b?a:null}},l.parseMasterPlaylistMedia=function(f,p,s,a){a===void 0&&(a=[]);var b,v=[],x=0;for(T.lastIndex=0;(b=T.exec(f))!==null;){var k=new P.AttrList(b[1]);if(k.TYPE===s){var H={attrs:k,bitrate:0,id:x++,groupId:k["GROUP-ID"],instreamId:k["INSTREAM-ID"],name:k.NAME||k.LANGUAGE||"",type:s,default:k.bool("DEFAULT"),autoselect:k.bool("AUTOSELECT"),forced:k.bool("FORCED"),lang:k.LANGUAGE,url:k.URI?l.resolve(k.URI,p):""};if(a.length){var V=l.findGroup(a,H.groupId)||a[0];C(H,V,"audioCodec"),C(H,V,"textCodec")}v.push(H)}}return v},l.parseLevelPlaylist=function(f,p,s,a,b){var v=new j.LevelDetails(p),x=v.fragments,k=null,H=0,V=0,Q=0,G=0,W=null,q=new z.Fragment(a,p),oe,fe,ve,ke=-1,Ee=!1;for(A.lastIndex=0,v.m3u8=f;(oe=A.exec(f))!==null;){Ee&&(Ee=!1,q=new z.Fragment(a,p),q.start=Q,q.sn=H,q.cc=G,q.level=s,k&&(q.initSegment=k,q.rawProgramDateTime=k.rawProgramDateTime));var _e=oe[1];if(_e){q.duration=parseFloat(_e);var Te=(" "+oe[2]).slice(1);q.title=Te||null,q.tagList.push(Te?["INF",_e,Te]:["INF",_e])}else if(oe[3])Object(X.isFiniteNumber)(q.duration)&&(q.start=Q,ve&&(q.levelkey=ve),q.sn=H,q.level=s,q.cc=G,q.urlId=b,x.push(q),q.relurl=(" "+oe[3]).slice(1),m(q,W),W=q,Q+=q.duration,H++,V=0,Ee=!0);else if(oe[4]){var Ce=(" "+oe[4]).slice(1);W?q.setByteRange(Ce,W):q.setByteRange(Ce)}else if(oe[5])q.rawProgramDateTime=(" "+oe[5]).slice(1),q.tagList.push(["PROGRAM-DATE-TIME",q.rawProgramDateTime]),ke===-1&&(ke=x.length);else{if(oe=oe[0].match(w),!oe){E.logger.warn("No matches on slow regex match for level playlist!");continue}for(fe=1;fe-1){E.logger.warn("Keyformat "+st+" is not supported from the manifest");continue}else if(st!=="identity")continue;He&&(ve=O.LevelKey.fromURL(p,Ge),Ge&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(He)>=0&&(ve.method=He,ve.keyFormat=st,Re&&(ve.keyID=Re),Ue&&(ve.keyFormatVersions=Ue),ve.iv=je));break}case"START":{var Qe=new P.AttrList(ne),nt=Qe.decimalFloatingPoint("TIME-OFFSET");Object(X.isFiniteNumber)(nt)&&(v.startTimeOffset=nt);break}case"MAP":{var bt=new P.AttrList(ne);q.relurl=bt.URI,bt.BYTERANGE&&q.setByteRange(bt.BYTERANGE),q.level=s,q.sn="initSegment",ve&&(q.levelkey=ve),q.initSegment=null,k=q,Ee=!0;break}case"SERVER-CONTROL":{var at=new P.AttrList(ne);v.canBlockReload=at.bool("CAN-BLOCK-RELOAD"),v.canSkipUntil=at.optionalFloat("CAN-SKIP-UNTIL",0),v.canSkipDateRanges=v.canSkipUntil>0&&at.bool("CAN-SKIP-DATERANGES"),v.partHoldBack=at.optionalFloat("PART-HOLD-BACK",0),v.holdBack=at.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var ht=new P.AttrList(ne);v.partTarget=ht.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ae=v.partList;Ae||(Ae=v.partList=[]);var gt=V>0?Ae[Ae.length-1]:void 0,dt=V++,De=new z.Part(new P.AttrList(ne),q,p,dt,gt);Ae.push(De),q.duration+=De.duration;break}case"PRELOAD-HINT":{var We=new P.AttrList(ne);v.preloadHint=We;break}case"RENDITION-REPORT":{var ge=new P.AttrList(ne);v.renditionReports=v.renditionReports||[],v.renditionReports.push(ge);break}default:E.logger.warn("line parsed but not handled: "+oe);break}}}W&&!W.relurl?(x.pop(),Q-=W.duration,v.partList&&(v.fragmentHint=W)):v.partList&&(m(q,W),q.cc=G,v.fragmentHint=q);var de=x.length,pe=x[0],ee=x[de-1];if(Q+=v.skippedSegments*v.targetduration,Q>0&&de&&ee){v.averagetargetduration=Q/de;var te=ee.sn;v.endSN=te!=="initSegment"?te:0,pe&&(v.startCC=pe.cc,pe.initSegment||v.fragments.every(function(ie){return ie.relurl&&o(ie.relurl)})&&(E.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),q=new z.Fragment(a,p),q.relurl=ee.relurl,q.level=s,q.sn="initSegment",pe.initSegment=q,v.needSidxRanges=!0))}else v.endSN=0,v.startCC=0;return v.fragmentHint&&(Q+=v.fragmentHint.duration),v.totalduration=Q,v.endCC=G,ke>0&&y(x,ke),v},l}();function c(l,S){["video","audio","text"].forEach(function(f){var p=l.filter(function(a){return Object(L.isCodecType)(a,f)});if(p.length){var s=p.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});S[f+"Codec"]=s.length>0?s[0]:p[0],l=l.filter(function(a){return p.indexOf(a)===-1})}}),S.unknownCodecs=l}function C(l,S,f){var p=S[f];p&&(l[f]=p)}function y(l,S){for(var f=l[S],p=S;p--;){var s=l[p];if(!s)return;s.programDateTime=f.programDateTime-s.duration*1e3,f=s}}function m(l,S){l.rawProgramDateTime?l.programDateTime=Date.parse(l.rawProgramDateTime):S!=null&&S.programDateTime&&(l.programDateTime=S.endProgramDateTime),Object(X.isFiniteNumber)(l.programDateTime)||(l.programDateTime=null,l.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ae,$,R){"use strict";R.r($);var X=R("./src/polyfills/number.ts"),N=R("./src/events.ts"),I=R("./src/errors.ts"),z=R("./src/utils/logger.ts"),j=R("./src/utils/mp4-tools.ts"),O=R("./src/loader/m3u8-parser.ts"),P=R("./src/types/loader.ts"),E=R("./src/utils/attr-list.ts");function L(A){var w=A.type;switch(w){case P.PlaylistContextType.AUDIO_TRACK:return P.PlaylistLevelType.AUDIO;case P.PlaylistContextType.SUBTITLE_TRACK:return P.PlaylistLevelType.SUBTITLE;default:return P.PlaylistLevelType.MAIN}}function D(A,w){var h=A.url;return(h===void 0||h.indexOf("data:")===0)&&(h=w.url),h}var T=function(){function A(h){this.hls=void 0,this.loaders=Object.create(null),this.hls=h,this.registerListeners()}var w=A.prototype;return w.registerListeners=function(){var o=this.hls;o.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(N.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(N.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(N.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},w.unregisterListeners=function(){var o=this.hls;o.off(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(N.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(N.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(N.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},w.createInternalLoader=function(o){var d=this.hls.config,c=d.pLoader,C=d.loader,y=c||C,m=new y(d);return o.loader=m,this.loaders[o.type]=m,m},w.getInternalLoader=function(o){return this.loaders[o.type]},w.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},w.destroyInternalLoaders=function(){for(var o in this.loaders){var d=this.loaders[o];d&&d.destroy(),this.resetInternalLoader(o)}},w.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},w.onManifestLoading=function(o,d){var c=d.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:P.PlaylistContextType.MANIFEST,url:c,deliveryDirectives:null})},w.onLevelLoading=function(o,d){var c=d.id,C=d.level,y=d.url,m=d.deliveryDirectives;this.load({id:c,groupId:null,level:C,responseType:"text",type:P.PlaylistContextType.LEVEL,url:y,deliveryDirectives:m})},w.onAudioTrackLoading=function(o,d){var c=d.id,C=d.groupId,y=d.url,m=d.deliveryDirectives;this.load({id:c,groupId:C,level:null,responseType:"text",type:P.PlaylistContextType.AUDIO_TRACK,url:y,deliveryDirectives:m})},w.onSubtitleTrackLoading=function(o,d){var c=d.id,C=d.groupId,y=d.url,m=d.deliveryDirectives;this.load({id:c,groupId:C,level:null,responseType:"text",type:P.PlaylistContextType.SUBTITLE_TRACK,url:y,deliveryDirectives:m})},w.load=function(o){var d,c=this.hls.config,C=this.getInternalLoader(o);if(C){var y=C.context;if(y&&y.url===o.url){z.logger.trace("[playlist-loader]: playlist request ongoing");return}z.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),C.abort()}var m,l,S,f;switch(o.type){case P.PlaylistContextType.MANIFEST:m=c.manifestLoadingMaxRetry,l=c.manifestLoadingTimeOut,S=c.manifestLoadingRetryDelay,f=c.manifestLoadingMaxRetryTimeout;break;case P.PlaylistContextType.LEVEL:case P.PlaylistContextType.AUDIO_TRACK:case P.PlaylistContextType.SUBTITLE_TRACK:m=0,l=c.levelLoadingTimeOut;break;default:m=c.levelLoadingMaxRetry,l=c.levelLoadingTimeOut,S=c.levelLoadingRetryDelay,f=c.levelLoadingMaxRetryTimeout;break}if(C=this.createInternalLoader(o),(d=o.deliveryDirectives)!==null&&d!==void 0&&d.part){var p;if(o.type===P.PlaylistContextType.LEVEL&&o.level!==null?p=this.hls.levels[o.level].details:o.type===P.PlaylistContextType.AUDIO_TRACK&&o.id!==null?p=this.hls.audioTracks[o.id].details:o.type===P.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(p=this.hls.subtitleTracks[o.id].details),p){var s=p.partTarget,a=p.targetduration;s&&a&&(l=Math.min(Math.max(s*3,a*.8)*1e3,l))}}var b={timeout:l,maxRetry:m,retryDelay:S,maxRetryDelay:f,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};C.load(o,b,v)},w.loadsuccess=function(o,d,c,C){if(C===void 0&&(C=null),c.isSidxRequest){this.handleSidxRequest(o,c),this.handlePlaylistLoaded(o,d,c,C);return}this.resetInternalLoader(c.type);var y=o.data;if(y.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,c,"no EXTM3U delimiter",C);return}d.parsing.start=performance.now(),y.indexOf("#EXTINF:")>0||y.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,d,c,C):this.handleMasterPlaylist(o,d,c,C)},w.loaderror=function(o,d,c){c===void 0&&(c=null),this.handleNetworkError(d,c,!1,o)},w.loadtimeout=function(o,d,c){c===void 0&&(c=null),this.handleNetworkError(d,c,!0)},w.handleMasterPlaylist=function(o,d,c,C){var y=this.hls,m=o.data,l=D(o,c),S=O.default.parseMasterPlaylist(m,l),f=S.levels,p=S.sessionData;if(!f.length){this.handleManifestParsingError(o,c,"no level found in manifest",C);return}var s=f.map(function(H){return{id:H.attrs.AUDIO,audioCodec:H.audioCodec}}),a=f.map(function(H){return{id:H.attrs.SUBTITLES,textCodec:H.textCodec}}),b=O.default.parseMasterPlaylistMedia(m,l,"AUDIO",s),v=O.default.parseMasterPlaylistMedia(m,l,"SUBTITLES",a),x=O.default.parseMasterPlaylistMedia(m,l,"CLOSED-CAPTIONS");if(b.length){var k=b.some(function(H){return!H.url});!k&&f[0].audioCodec&&!f[0].attrs.AUDIO&&(z.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),b.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new E.AttrList({}),bitrate:0,url:""}))}y.trigger(N.Events.MANIFEST_LOADED,{levels:f,audioTracks:b,subtitles:v,captions:x,url:l,stats:d,networkDetails:C,sessionData:p})},w.handleTrackOrLevelPlaylist=function(o,d,c,C){var y=this.hls,m=c.id,l=c.level,S=c.type,f=D(o,c),p=Object(X.isFiniteNumber)(m)?m:0,s=Object(X.isFiniteNumber)(l)?l:p,a=L(c),b=O.default.parseLevelPlaylist(o.data,f,s,a,p);if(!b.fragments.length){y.trigger(N.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:f,reason:"no fragments found in level",level:typeof c.level=="number"?c.level:void 0});return}if(S===P.PlaylistContextType.MANIFEST){var v={attrs:new E.AttrList({}),bitrate:0,details:b,name:"",url:f};y.trigger(N.Events.MANIFEST_LOADED,{levels:[v],audioTracks:[],url:f,stats:d,networkDetails:C,sessionData:null})}if(d.parsing.end=performance.now(),b.needSidxRanges){var x,k=(x=b.fragments[0].initSegment)===null||x===void 0?void 0:x.url;this.load({url:k,isSidxRequest:!0,type:S,level:l,levelDetails:b,id:m,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}c.levelDetails=b,this.handlePlaylistLoaded(o,d,c,C)},w.handleSidxRequest=function(o,d){var c=Object(j.parseSegmentIndex)(new Uint8Array(o.data));if(!c)return;var C=c.references,y=d.levelDetails;C.forEach(function(m,l){var S=m.info,f=y.fragments[l];f.byteRange.length===0&&f.setByteRange(String(1+S.end-S.start)+"@"+String(S.start)),f.initSegment&&f.initSegment.setByteRange(String(c.moovEndOffset)+"@0")})},w.handleManifestParsingError=function(o,d,c,C){this.hls.trigger(N.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:d.type===P.PlaylistContextType.MANIFEST,url:o.url,reason:c,response:o,context:d,networkDetails:C})},w.handleNetworkError=function(o,d,c,C){c===void 0&&(c=!1),z.logger.warn("[playlist-loader]: A network "+(c?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var y=I.ErrorDetails.UNKNOWN,m=!1,l=this.getInternalLoader(o);switch(o.type){case P.PlaylistContextType.MANIFEST:y=c?I.ErrorDetails.MANIFEST_LOAD_TIMEOUT:I.ErrorDetails.MANIFEST_LOAD_ERROR,m=!0;break;case P.PlaylistContextType.LEVEL:y=c?I.ErrorDetails.LEVEL_LOAD_TIMEOUT:I.ErrorDetails.LEVEL_LOAD_ERROR,m=!1;break;case P.PlaylistContextType.AUDIO_TRACK:y=c?I.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:I.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,m=!1;break;case P.PlaylistContextType.SUBTITLE_TRACK:y=c?I.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:I.ErrorDetails.SUBTITLE_LOAD_ERROR,m=!1;break}l&&this.resetInternalLoader(o.type);var S={type:I.ErrorTypes.NETWORK_ERROR,details:y,fatal:m,url:o.url,loader:l,context:o,networkDetails:d};C&&(S.response=C),this.hls.trigger(N.Events.ERROR,S)},w.handlePlaylistLoaded=function(o,d,c,C){var y=c.type,m=c.level,l=c.id,S=c.groupId,f=c.loader,p=c.levelDetails,s=c.deliveryDirectives;if(!(p!=null&&p.targetduration)){this.handleManifestParsingError(o,c,"invalid target duration",C);return}if(!f)return;p.live&&(f.getCacheAge&&(p.ageHeader=f.getCacheAge()||0),(!f.getCacheAge||isNaN(p.ageHeader))&&(p.ageHeader=0));switch(y){case P.PlaylistContextType.MANIFEST:case P.PlaylistContextType.LEVEL:this.hls.trigger(N.Events.LEVEL_LOADED,{details:p,level:m||0,id:l||0,stats:d,networkDetails:C,deliveryDirectives:s});break;case P.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(N.Events.AUDIO_TRACK_LOADED,{details:p,id:l||0,groupId:S||"",stats:d,networkDetails:C,deliveryDirectives:s});break;case P.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(N.Events.SUBTITLE_TRACK_LOADED,{details:p,id:l||0,groupId:S||"",stats:d,networkDetails:C,deliveryDirectives:s});break}},A}();$.default=T},"./src/polyfills/number.ts":function(ae,$,R){"use strict";R.r($),R.d($,"isFiniteNumber",function(){return X}),R.d($,"MAX_SAFE_INTEGER",function(){return N});var X=Number.isFinite||function(I){return typeof I=="number"&&isFinite(I)},N=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ae,$,R){"use strict";R.r($);var X=function(){function N(){}return N.getSilentFrame=function(z,j){switch(z){case"mp4a.40.2":if(j===1)return new Uint8Array([0,200,0,128,35,128]);if(j===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(j===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(j===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(j===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(j===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(j===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(j===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(j===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},N}();$.default=X},"./src/remux/mp4-generator.ts":function(ae,$,R){"use strict";R.r($);var X=Math.pow(2,32)-1,N=function(){function I(){}return I.init=function(){I.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 j;for(j in I.types)I.types.hasOwnProperty(j)&&(I.types[j]=[j.charCodeAt(0),j.charCodeAt(1),j.charCodeAt(2),j.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]),P=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]);I.HDLR_TYPES={video:O,audio:P};var E=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),L=new Uint8Array([0,0,0,0,0,0,0,0]);I.STTS=I.STSC=I.STCO=L,I.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),I.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),I.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),I.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var D=new Uint8Array([105,115,111,109]),T=new Uint8Array([97,118,99,49]),A=new Uint8Array([0,0,0,1]);I.FTYP=I.box(I.types.ftyp,D,A,D,T),I.DINF=I.box(I.types.dinf,I.box(I.types.dref,E))},I.box=function(j){for(var O=8,P=arguments.length,E=new Array(P>1?P-1:0),L=1;L>24&255,A[1]=O>>16&255,A[2]=O>>8&255,A[3]=O&255,A.set(j,4),D=0,O=8;D>24&255,j>>16&255,j>>8&255,j&255,P>>24,P>>16&255,P>>8&255,P&255,E>>24,E>>16&255,E>>8&255,E&255,85,196,0,0]))},I.mdia=function(j){return I.box(I.types.mdia,I.mdhd(j.timescale,j.duration),I.hdlr(j.type),I.minf(j))},I.mfhd=function(j){return I.box(I.types.mfhd,new Uint8Array([0,0,0,0,j>>24,j>>16&255,j>>8&255,j&255]))},I.minf=function(j){return j.type==="audio"?I.box(I.types.minf,I.box(I.types.smhd,I.SMHD),I.DINF,I.stbl(j)):I.box(I.types.minf,I.box(I.types.vmhd,I.VMHD),I.DINF,I.stbl(j))},I.moof=function(j,O,P){return I.box(I.types.moof,I.mfhd(j),I.traf(P,O))},I.moov=function(j){for(var O=j.length,P=[];O--;)P[O]=I.trak(j[O]);return I.box.apply(null,[I.types.moov,I.mvhd(j[0].timescale,j[0].duration)].concat(P).concat(I.mvex(j)))},I.mvex=function(j){for(var O=j.length,P=[];O--;)P[O]=I.trex(j[O]);return I.box.apply(null,[I.types.mvex].concat(P))},I.mvhd=function(j,O){O*=j;var P=Math.floor(O/(X+1)),E=Math.floor(O%(X+1)),L=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,j>>24&255,j>>16&255,j>>8&255,j&255,P>>24,P>>16&255,P>>8&255,P&255,E>>24,E>>16&255,E>>8&255,E&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 I.box(I.types.mvhd,L)},I.sdtp=function(j){var O=j.samples||[],P=new Uint8Array(4+O.length),E,L;for(E=0;E>>8&255),O.push(D&255),O=O.concat(Array.prototype.slice.call(L));for(E=0;E>>8&255),P.push(D&255),P=P.concat(Array.prototype.slice.call(L));var T=I.box(I.types.avcC,new Uint8Array([1,O[3],O[4],O[5],252|3,224|j.sps.length].concat(O).concat([j.pps.length]).concat(P))),A=j.width,w=j.height,h=j.pixelRatio[0],o=j.pixelRatio[1];return I.box(I.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,A>>8&255,A&255,w>>8&255,w&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),T,I.box(I.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),I.box(I.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,h&255,o>>24,o>>16&255,o>>8&255,o&255])))},I.esds=function(j){var O=j.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(j.config).concat([6,1,2]))},I.mp4a=function(j){var O=j.samplerate;return I.box(I.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,j.channelCount,0,16,0,0,0,0,O>>8&255,O&255,0,0]),I.box(I.types.esds,I.esds(j)))},I.mp3=function(j){var O=j.samplerate;return I.box(I.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,j.channelCount,0,16,0,0,0,0,O>>8&255,O&255,0,0]))},I.stsd=function(j){return j.type==="audio"?!j.isAAC&&j.codec==="mp3"?I.box(I.types.stsd,I.STSD,I.mp3(j)):I.box(I.types.stsd,I.STSD,I.mp4a(j)):I.box(I.types.stsd,I.STSD,I.avc1(j))},I.tkhd=function(j){var O=j.id,P=j.duration*j.timescale,E=j.width,L=j.height,D=Math.floor(P/(X+1)),T=Math.floor(P%(X+1));return I.box(I.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,D>>24,D>>16&255,D>>8&255,D&255,T>>24,T>>16&255,T>>8&255,T&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,E>>8&255,E&255,0,0,L>>8&255,L&255,0,0]))},I.traf=function(j,O){var P=I.sdtp(j),E=j.id,L=Math.floor(O/(X+1)),D=Math.floor(O%(X+1));return I.box(I.types.traf,I.box(I.types.tfhd,new Uint8Array([0,0,0,0,E>>24,E>>16&255,E>>8&255,E&255])),I.box(I.types.tfdt,new Uint8Array([1,0,0,0,L>>24,L>>16&255,L>>8&255,L&255,D>>24,D>>16&255,D>>8&255,D&255])),I.trun(j,P.length+16+20+8+16+8+8),P)},I.trak=function(j){return j.duration=j.duration||4294967295,I.box(I.types.trak,I.tkhd(j),I.mdia(j))},I.trex=function(j){var O=j.id;return I.box(I.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]))},I.trun=function(j,O){var P=j.samples||[],E=P.length,L=12+16*E,D=new Uint8Array(L),T,A,w,h,o,d;for(O+=8+L,D.set([0,0,15,1,E>>>24&255,E>>>16&255,E>>>8&255,E&255,O>>>24&255,O>>>16&255,O>>>8&255,O&255],0),T=0;T>>24&255,w>>>16&255,w>>>8&255,w&255,h>>>24&255,h>>>16&255,h>>>8&255,h&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,d>>>24&255,d>>>16&255,d>>>8&255,d&255],12+16*T);return I.box(I.types.trun,D)},I.initSegment=function(j){I.types||I.init();var O=I.moov(j),P=new Uint8Array(I.FTYP.byteLength+O.byteLength);return P.set(I.FTYP),P.set(O,I.FTYP.byteLength),P},I}();N.types=void 0,N.HDLR_TYPES=void 0,N.STTS=void 0,N.STSC=void 0,N.STCO=void 0,N.STSZ=void 0,N.VMHD=void 0,N.SMHD=void 0,N.STSD=void 0,N.FTYP=void 0,N.DINF=void 0,$.default=N},"./src/remux/mp4-remuxer.ts":function(ae,$,R){"use strict";R.r($),R.d($,"default",function(){return d}),R.d($,"normalizePts",function(){return c});var X=R("./src/polyfills/number.ts"),N=R("./src/remux/aac-helper.ts"),I=R("./src/remux/mp4-generator.ts"),z=R("./src/events.ts"),j=R("./src/errors.ts"),O=R("./src/utils/logger.ts"),P=R("./src/types/loader.ts"),E=R("./src/utils/timescale-conversion.ts");function L(){return L=Object.assign||function(l){for(var S=1;S0?b:v.pts},p[0].pts);return s&&O.logger.debug("PTS rollover detected"),a},S.remux=function(p,s,a,b,v,x,k,H){var V,Q,G,W,q,oe,fe=v,ve=v,ke=p.pid>-1,Ee=s.pid>-1,_e=s.samples.length,Te=p.samples.length>0,Ce=_e>1,me=(!ke||Te)&&(!Ee||Ce)||this.ISGenerated||k;if(me){this.ISGenerated||(G=this.generateIS(p,s,v));var ne=this.isVideoContiguous,we=-1;if(Ce&&(we=C(s.samples),!ne&&this.config.forceKeyFrameOnDiscontinuity))if(oe=!0,we>0){O.logger.warn("[mp4-remuxer]: Dropped "+we+" out of "+_e+" video samples due to a missing keyframe");var tt=this.getVideoStartPts(s.samples);s.samples=s.samples.slice(we),s.dropped+=we,ve+=(s.samples[0].pts-tt)/(s.timescale||9e4)}else we===-1&&(O.logger.warn("[mp4-remuxer]: No keyframe found out of "+_e+" video samples"),oe=!1);if(this.ISGenerated){if(Te&&Ce){var Ye=this.getVideoStartPts(s.samples),Xe=c(p.samples[0].pts,Ye)-Ye,Ve=Xe/s.inputTimeScale;fe+=Math.max(0,Ve),ve+=Math.max(0,-Ve)}if(Te){if(p.samplerate||(O.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),G=this.generateIS(p,s,v)),Q=this.remuxAudio(p,fe,this.isAudioContiguous,x,Ee||Ce||H===P.PlaylistLevelType.AUDIO?ve:void 0),Ce){var Le=Q?Q.endPTS-Q.startPTS:0;s.inputTimeScale||(O.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),G=this.generateIS(p,s,v)),V=this.remuxVideo(s,ve,ne,Le)}}else Ce&&(V=this.remuxVideo(s,ve,ne,0));V&&(V.firstKeyFrame=we,V.independent=we!==-1)}}return this.ISGenerated&&(a.samples.length&&(q=this.remuxID3(a,v)),b.samples.length&&(W=this.remuxText(b,v))),{audio:Q,video:V,initSegment:G,independent:oe,text:W,id3:q}},S.generateIS=function(p,s,a){var b=p.samples,v=s.samples,x=this.typeSupported,k={},H=!Object(X.isFiniteNumber)(this._initPTS),V="audio/mp4",Q,G,W;if(H&&(Q=G=Infinity),p.config&&b.length&&(p.timescale=p.samplerate,p.isAAC||(x.mpeg?(V="audio/mpeg",p.codec=""):x.mp3&&(p.codec="mp3")),k.audio={id:"audio",container:V,codec:p.codec,initSegment:!p.isAAC&&x.mpeg?new Uint8Array(0):I.default.initSegment([p]),metadata:{channelCount:p.channelCount}},H&&(W=p.inputTimeScale,Q=G=b[0].pts-Math.round(W*a))),s.sps&&s.pps&&v.length&&(s.timescale=s.inputTimeScale,k.video={id:"main",container:"video/mp4",codec:s.codec,initSegment:I.default.initSegment([s]),metadata:{width:s.width,height:s.height}},H)){W=s.inputTimeScale;var q=this.getVideoStartPts(v),oe=Math.round(W*a);G=Math.min(G,c(v[0].dts,q)-oe),Q=Math.min(Q,q-oe)}if(Object.keys(k).length)return this.ISGenerated=!0,H&&(this._initPTS=Q,this._initDTS=G),{tracks:k,initPTS:Q,timescale:W}},S.remuxVideo=function(p,s,a,b){var v=p.inputTimeScale,x=p.samples,k=[],H=x.length,V=this._initPTS,Q=this.nextAvcDts,G=8,W,q,oe,fe=Number.POSITIVE_INFINITY,ve=Number.NEGATIVE_INFINITY,ke=0,Ee=!1;if(!a||Q===null){var _e=s*v,Te=x[0].pts-c(x[0].dts,x[0].pts);Q=_e-Te}for(var Ce=0;Ceme.pts){var ne=9e4*.2;ke=Math.max(Math.min(ke,me.pts-me.dts),-1*ne)}me.dts0?Ce-1:Ce].dts&&(Ee=!0)}Ee&&x.sort(function(Pt,et){var ct=Pt.dts-et.dts,Ft=Pt.pts-et.pts;return ct||Ft}),q=x[0].dts,oe=x[x.length-1].dts;var we=Math.round((oe-q)/(H-1));if(ke<0){if(kewe,Me=Ve<-1;if(Le||Me){Le?O.logger.warn("AVC: "+Object(E.toMsFromMpegTsClock)(Ve,!0)+" ms ("+Ve+"dts) hole between fragments detected, filling it"):O.logger.warn("AVC: "+Object(E.toMsFromMpegTsClock)(-Ve,!0)+" ms ("+Ve+"dts) overlapping between fragments detected"),q=Q;var He=x[0].pts-Ve;x[0].dts=q,x[0].pts=He,O.logger.log("Video: First PTS/DTS adjusted: "+Object(E.toMsFromMpegTsClock)(He,!0)+"/"+Object(E.toMsFromMpegTsClock)(q,!0)+", delta: "+Object(E.toMsFromMpegTsClock)(Ve,!0)+" ms")}}o&&(q=Math.max(0,q));for(var Ge=0,je=0,Ue=0;Ue0?Ae-1:Ae].dts;if(te.stretchShortVideoTrack&&this.nextAudioPts!==null){var se=Math.floor(te.maxBufferHole*v),ue=(b?fe+b*v:this.nextAudioPts)-gt.pts;ue>se?(W=ue-ie,W<0&&(W=ie),O.logger.log("[mp4-remuxer]: It is approximately "+ue/90+" ms to the next segment; using duration "+W/90+" ms for the last video frame.")):W=ie}else W=ie}var Se=Math.round(gt.pts-gt.dts);k.push(new y(gt.key,W,De,Se))}if(k.length&&w&&w<70){var Pe=k[0].flags;Pe.dependsOn=2,Pe.isNonSync=0}console.assert(W!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=Q=oe+W,this.isVideoContiguous=!0;var Ze=I.default.moof(p.sequenceNumber++,q,L({},p,{samples:k})),qe="video",Et={data1:Ze,data2:at,startPTS:fe/v,endPTS:(ve+W)/v,startDTS:q/v,endDTS:Q/v,type:qe,hasAudio:!1,hasVideo:!0,nb:k.length,dropped:p.dropped};return p.samples=[],p.dropped=0,console.assert(at.length,"MDAT length must not be zero"),Et},S.remuxAudio=function(p,s,a,b,v){var x=p.inputTimeScale,k=p.samplerate?p.samplerate:x,H=x/k,V=p.isAAC?T:A,Q=V*H,G=this._initPTS,W=!p.isAAC&&this.typeSupported.mpeg,q=[],oe=p.samples,fe=W?0:8,ve=this.nextAudioPts||-1,ke=s*x;if(this.isAudioContiguous=a=a||oe.length&&ve>0&&(b&&Math.abs(ke-ve)<9e3||Math.abs(c(oe[0].pts-G,ke)-ve)<20*Q),oe.forEach(function(pe){pe.pts=c(pe.pts-G,ke)}),!a||ve<0){if(oe=oe.filter(function(pe){return pe.pts>=0}),!oe.length)return;v===0?ve=0:b?ve=Math.max(0,ke):ve=oe[0].pts}if(p.isAAC)for(var Ee=v!==void 0,_e=this.config.maxAudioFramesDrift,Te=0,Ce=ve;Te=_e*Q&&tt0){je+=fe;try{Ge=new Uint8Array(je)}catch(pe){this.observer.emit(z.Events.ERROR,z.Events.ERROR,{type:j.ErrorTypes.MUX_ERROR,details:j.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:je,reason:"fail allocating audio mdat "+je});return}if(!W){var at=new DataView(Ge.buffer);at.setUint32(0,je),Ge.set(I.default.types.mdat,4)}}else return;Ge.set(Qe,fe);var ht=Qe.byteLength;fe+=ht,q.push(new y(!0,V,ht,0)),He=nt}var Ae=q.length;if(!Ae)return;var gt=q[q.length-1];this.nextAudioPts=ve=He+H*gt.duration;var dt=W?new Uint8Array(0):I.default.moof(p.sequenceNumber++,Me/H,L({},p,{samples:q}));p.samples=[];var De=Me/x,We=ve/x,ge="audio",de={data1:dt,data2:Ge,startPTS:De,endPTS:We,startDTS:De,endDTS:We,type:ge,hasAudio:!0,hasVideo:!1,nb:Ae};return this.isAudioContiguous=!0,console.assert(Ge.length,"MDAT length must not be zero"),de},S.remuxEmptyAudio=function(p,s,a,b){var v=p.inputTimeScale,x=p.samplerate?p.samplerate:v,k=v/x,H=this.nextAudioPts,V=(H!==null?H:b.startDTS*v)+this._initDTS,Q=b.endDTS*v+this._initDTS,G=k*T,W=Math.ceil((Q-V)/G),q=N.default.getSilentFrame(p.manifestCodec||p.codec,p.channelCount);if(O.logger.warn("[mp4-remuxer]: remux empty Audio"),!q){O.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var oe=[],fe=0;fe4294967296;)l+=f;return l}function C(l){for(var S=0;S0?this.lastEndDTS=p:(z.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var s=!!l.audio,a=!!l.video,b="";s&&(b+="audio"),a&&(b+="video");var v={data1:y,startPTS:f,startDTS:f,endPTS:p,endDTS:p,type:b,hasAudio:s,hasVideo:a,nb:1,dropped:0};return C.audio=v.type==="audio"?v:void 0,C.video=v.type!=="audio"?v:void 0,C.text=h,C.id3=w,C.initSegment=m,C},E}(),O=function(L,D,T){return Object(N.getStartDTS)(L,D)-T};function P(E,L){var D=E==null?void 0:E.codec;return D&&D.length>4?D:D==="hvc1"?"hvc1.1.c.L120.90":D==="av01"?"av01.0.04M.08":D==="avc1"||L===I.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}$.default=j},"./src/task-loop.ts":function(ae,$,R){"use strict";R.r($),R.d($,"default",function(){return X});var X=function(){function N(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var I=N.prototype;return I.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},I.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},I.onHandlerDestroyed=function(){},I.hasInterval=function(){return!!this._tickInterval},I.hasNextTick=function(){return!!this._tickTimer},I.setInterval=function(j){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,j),!0)},I.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},I.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},I.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},I.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},I.doTick=function(){},N}()},"./src/types/cmcd.ts":function(ae,$,R){"use strict";R.r($),R.d($,"CMCDVersion",function(){return X}),R.d($,"CMCDObjectType",function(){return N}),R.d($,"CMCDStreamingFormat",function(){return I}),R.d($,"CMCDStreamType",function(){return z});var X=1,N;(function(j){j.MANIFEST="m",j.AUDIO="a",j.VIDEO="v",j.MUXED="av",j.INIT="i",j.CAPTION="c",j.TIMED_TEXT="tt",j.KEY="k",j.OTHER="o"})(N||(N={}));var I;(function(j){j.DASH="d",j.HLS="h",j.SMOOTH="s",j.OTHER="o"})(I||(I={}));var z;(function(j){j.VOD="v",j.LIVE="l"})(z||(z={}))},"./src/types/level.ts":function(ae,$,R){"use strict";R.r($),R.d($,"HlsSkip",function(){return I}),R.d($,"getSkipValue",function(){return z}),R.d($,"HlsUrlParameters",function(){return j}),R.d($,"Level",function(){return O});function X(P,E){for(var L=0;LNumber.MAX_SAFE_INTEGER?Infinity:E},j.hexadecimalInteger=function(P){if(this[P]){var E=(this[P]||"0x").slice(2);E=(E.length&1?"0":"")+E;for(var L=new Uint8Array(E.length/2),D=0;DNumber.MAX_SAFE_INTEGER?Infinity:E},j.decimalFloatingPoint=function(P){return parseFloat(this[P])},j.optionalFloat=function(P,E){var L=this[P];return L?parseFloat(L):E},j.enumeratedString=function(P){return this[P]},j.bool=function(P){return this[P]==="YES"},j.decimalResolution=function(P){var E=X.exec(this[P]);return E===null?void 0:{width:parseInt(E[1],10),height:parseInt(E[2],10)}},z.parseAttrList=function(P){var E,L={},D='"';for(N.lastIndex=0;(E=N.exec(P))!==null;){var T=E[2];T.indexOf(D)===0&&T.lastIndexOf(D)===T.length-1&&(T=T.slice(1,-1)),L[E[1]]=T}return L},z}()},"./src/utils/binary-search.ts":function(ae,$,R){"use strict";R.r($);var X={search:function(I,z){for(var j=0,O=I.length-1,P=null,E=null;j<=O;){P=(j+O)/2|0,E=I[P];var L=z(E);if(L>0)j=P+1;else if(L<0)O=P-1;else return E}return null}};$.default=X},"./src/utils/buffer-helper.ts":function(ae,$,R){"use strict";R.r($),R.d($,"BufferHelper",function(){return I});var X=R("./src/utils/logger.ts"),N={length:0,start:function(){return 0},end:function(){return 0}},I=function(){function z(){}return z.isBuffered=function(O,P){try{if(O){for(var E=z.getBuffered(O),L=0;L=E.start(L)&&P<=E.end(L))return!0}}catch(D){}return!1},z.bufferInfo=function(O,P,E){try{if(O){var L=z.getBuffered(O),D=[],T;for(T=0;TA&&(L[T-1].end=O[D].end):L.push(O[D])}else L.push(O[D])}else L=O;for(var w=0,h,o=P,d=P,c=0;c=C&&P=a&&X.logger.log(this.time+" ["+a+"] "+b)},f}(),w=function(p){for(var s=[],a=0;aj&&(this.logger.log(T.DEBUG,"Too large cursor position "+this.pos),this.pos=j)},p.moveCursor=function(a){var b=this.pos+a;if(a>1)for(var v=this.pos+1;v=144&&this.backSpace();var b=I(a);if(this.pos>=j){this.logger.log(T.ERROR,"Cannot insert "+a.toString(16)+" ("+b+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(b,this.currPenState),this.moveCursor(1)},p.clearFromPos=function(a){var b;for(b=a;b0&&(a?v="["+b.join(" | ")+"]":v=b.join(` `)),v},p.getTextAndFormat=function(){return this.rows},f}(),C=function(){function f(s,a,b){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=s,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new c(b),this.nonDisplayedMemory=new c(b),this.lastOutputScreen=new c(b),this.currRollUpRow=this.displayedMemory.rows[z-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=b}var p=f.prototype;return p.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[z-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},p.getHandler=function(){return this.outputFilter},p.setHandler=function(a){this.outputFilter=a},p.setPAC=function(a){this.writeScreen.setPAC(a)},p.setBkgData=function(a){this.writeScreen.setBkgData(a)},p.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(T.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a},p.insertChars=function(a){for(var b=0;b=46,b.italics)b.foreground="white";else{var v=Math.floor(a/2)-16,x=["white","green","blue","cyan","red","yellow","magenta"];b.foreground=x[v]}this.logger.log(T.INFO,"MIDROW: "+JSON.stringify(b)),this.writeScreen.setPen(b)},p.outputDataUpdate=function(a){a===void 0&&(a=!1);var b=this.logger.time;if(b===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=b:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,b,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:b),this.lastOutputScreen.copy(this.displayedMemory))},p.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},f}(),y=function(){function f(s,a,b){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var v=new A;this.channels=[null,new C(s,a,v),new C(s+1,b,v)],this.cmdHistory=S(),this.logger=v}var p=f.prototype;return p.getHandler=function(a){return this.channels[a].getHandler()},p.setHandler=function(a,b){this.channels[a].setHandler(b)},p.addData=function(a,b){var v,x,k,H=!1;this.logger.time=a;for(var V=0;V ("+w([x,k])+")"),v=this.parseCmd(x,k),v||(v=this.parseMidrow(x,k)),v||(v=this.parsePAC(x,k)),v||(v=this.parseBackgroundAttributes(x,k)),!v&&(H=this.parseChars(x,k),H)){var Q=this.currentChannel;if(Q&&Q>0){var G=this.channels[Q];G.insertChars(H)}else this.logger.log(T.WARNING,"No channel found yet. TEXT-MODE?")}!v&&!H&&this.logger.log(T.WARNING,"Couldn't parse cleaned data "+w([x,k])+" orig: "+w([b[V],b[V+1]]))}},p.parseCmd=function(a,b){var v=this.cmdHistory,x=(a===20||a===28||a===21||a===29)&&b>=32&&b<=47,k=(a===23||a===31)&&b>=33&&b<=35;if(!(x||k))return!1;if(l(a,b,v))return m(null,null,v),this.logger.log(T.DEBUG,"Repeated command ("+w([a,b])+") is dropped"),!0;var H=a===20||a===21||a===23?1:2,V=this.channels[H];return a===20||a===21||a===28||a===29?b===32?V.ccRCL():b===33?V.ccBS():b===34?V.ccAOF():b===35?V.ccAON():b===36?V.ccDER():b===37?V.ccRU(2):b===38?V.ccRU(3):b===39?V.ccRU(4):b===40?V.ccFON():b===41?V.ccRDC():b===42?V.ccTR():b===43?V.ccRTD():b===44?V.ccEDM():b===45?V.ccCR():b===46?V.ccENM():b===47&&V.ccEOC():V.ccTO(b-32),m(a,b,v),this.currentChannel=H,!0},p.parseMidrow=function(a,b){var v=0;if((a===17||a===25)&&b>=32&&b<=47){if(a===17?v=1:v=2,v!==this.currentChannel)return this.logger.log(T.ERROR,"Mismatch channel in midrow parsing"),!1;var x=this.channels[v];return x?(x.ccMIDROW(b),this.logger.log(T.DEBUG,"MIDROW ("+w([a,b])+")"),!0):!1}return!1},p.parsePAC=function(a,b){var v,x=this.cmdHistory,k=(a>=17&&a<=23||a>=25&&a<=31)&&b>=64&&b<=127,H=(a===16||a===24)&&b>=64&&b<=95;if(!(k||H))return!1;if(l(a,b,x))return m(null,null,x),!0;var V=a<=23?1:2;b>=64&&b<=95?v=V===1?O[a]:E[a]:v=V===1?P[a]:L[a];var Q=this.channels[V];return Q?(Q.setPAC(this.interpretPAC(v,b)),m(a,b,x),this.currentChannel=V,!0):!1},p.interpretPAC=function(a,b){var v,x={color:null,italics:!1,indent:null,underline:!1,row:a};return b>95?v=b-96:v=b-64,x.underline=(v&1)===1,v<=13?x.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(v/2)]:v<=15?(x.italics=!0,x.color="white"):x.indent=Math.floor((v-16)/2)*4,x},p.parseChars=function(a,b){var v,x=null,k=null;if(a>=25?(v=2,k=a-8):(v=1,k=a),k>=17&&k<=19){var H;k===17?H=b+80:k===18?H=b+112:H=b+144,this.logger.log(T.INFO,"Special char '"+I(H)+"' in channel "+v),x=[H]}else a>=32&&a<=127&&(x=b===0?[a]:[a,b]);if(x){var V=w(x);this.logger.log(T.DEBUG,"Char codes = "+V.join(",")),m(a,b,this.cmdHistory)}return x},p.parseBackgroundAttributes=function(a,b){var v=(a===16||a===24)&&b>=32&&b<=47,x=(a===23||a===31)&&b>=45&&b<=47;if(!(v||x))return!1;var k,H={};a===16||a===24?(k=Math.floor((b-32)/2),H.background=D[k],b%2===1&&(H.background=H.background+"_semi")):b===45?H.background="transparent":(H.foreground="black",b===47&&(H.underline=!0));var V=a<=23?1:2,Q=this.channels[V];return Q.setBkgData(H),m(a,b,this.cmdHistory),!0},p.reset=function(){for(var a=0;a=16?o--:o++;var m=Object(X.fixLineBreaks)(d.trim()),l=Object(N.generateCueId)(E,L,m);(!P||!P.cues||!P.cues.getCueById(l))&&(w=new c(E,L,m),w.id=l,w.line=C+1,w.align="left",w.position=10+Math.min(80,Math.floor(o*8/32)*10),T.push(w))}return P&&T.length&&(T.sort(function(S,f){return S.line==="auto"||f.line==="auto"?0:S.line>8&&f.line>8?f.line-S.line:S.line-f.line}),T.forEach(function(S){return Object(I.addCueToTrack)(P,S)})),T}};$.default=j},"./src/utils/discontinuities.ts":function(ae,$,R){"use strict";R.r($),R.d($,"findFirstFragWithCC",function(){return z}),R.d($,"shouldAlignOnDiscontinuities",function(){return j}),R.d($,"findDiscontinuousReferenceFrag",function(){return O}),R.d($,"adjustSlidingStart",function(){return E}),R.d($,"alignStream",function(){return L}),R.d($,"alignPDT",function(){return T}),R.d($,"alignFragmentByPDTDelta",function(){return A}),R.d($,"alignMediaPlaylistByPDT",function(){return w});var X=R("./src/polyfills/number.ts"),N=R("./src/utils/logger.ts"),I=R("./src/controller/level-helper.ts");function z(h,o){for(var d=null,c=0,C=h.length;cd.startCC||h&&h.cc=this.minWeight_},z.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},z.destroy=function(){},I}();$.default=N},"./src/utils/ewma.ts":function(ae,$,R){"use strict";R.r($);var X=function(){function N(z,j,O){j===void 0&&(j=0),O===void 0&&(O=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=z,this.alpha_=z?Math.exp(Math.log(.5)/z):0,this.estimate_=j,this.totalWeight_=O}var I=N.prototype;return I.sample=function(j,O){var P=Math.pow(this.alpha_,j);this.estimate_=O*(1-P)+P*this.estimate_,this.totalWeight_+=j},I.getTotalWeight=function(){return this.totalWeight_},I.getEstimate=function(){if(this.alpha_){var j=1-Math.pow(this.alpha_,this.totalWeight_);if(j)return this.estimate_/j}return this.estimate_},N}();$.default=X},"./src/utils/fetch-loader.ts":function(ae,$,R){"use strict";R.r($),R.d($,"fetchSupported",function(){return A});var X=R("./src/polyfills/number.ts"),N=R("./src/loader/load-stats.ts"),I=R("./src/demux/chunk-cache.ts");function z(c,C){c.prototype=Object.create(C.prototype),c.prototype.constructor=c,L(c,C)}function j(c){var C=typeof Map=="function"?new Map:void 0;return j=function(m){if(m===null||!E(m))return m;if(typeof m!="function")throw new TypeError("Super expression must either be null or a function");if(typeof C!="undefined"){if(C.has(m))return C.get(m);C.set(m,l)}function l(){return O(m,arguments,D(this).constructor)}return l.prototype=Object.create(m.prototype,{constructor:{value:l,enumerable:!1,writable:!0,configurable:!0}}),L(l,m)},j(c)}function O(c,C,y){return P()?O=Reflect.construct:O=function(l,S,f){var p=[null];p.push.apply(p,S);var s=Function.bind.apply(l,p),a=new s;return f&&L(a,f.prototype),a},O.apply(null,arguments)}function P(){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(c){return!1}}function E(c){return Function.toString.call(c).indexOf("[native code]")!==-1}function L(c,C){return L=Object.setPrototypeOf||function(m,l){return m.__proto__=l,m},L(c,C)}function D(c){return D=Object.setPrototypeOf?Object.getPrototypeOf:function(y){return y.__proto__||Object.getPrototypeOf(y)},D(c)}function T(){return T=Object.assign||function(c){for(var C=1;C=f&&p(l,S,s.flush(),m)):p(l,S,k,m),v()}).catch(function(){return Promise.reject()})};return b()},c}();function h(c,C){var y={method:"GET",mode:"cors",credentials:"same-origin",signal:C,headers:new self.Headers(T({},c.headers))};return c.rangeEnd&&y.headers.set("Range","bytes="+c.rangeStart+"-"+String(c.rangeEnd-1)),y}function o(c,C){return new self.Request(c.url,C)}var d=function(c){z(C,c);function C(y,m,l){var S;return S=c.call(this,y)||this,S.code=void 0,S.details=void 0,S.code=m,S.details=l,S}return C}(j(Error));$.default=w},"./src/utils/imsc1-ttml-parser.ts":function(ae,$,R){"use strict";R.r($),R.d($,"IMSC1_CODEC",function(){return E}),R.d($,"parseIMSC1",function(){return A});var X=R("./src/utils/mp4-tools.ts"),N=R("./src/utils/vttparser.ts"),I=R("./src/utils/vttcue.ts"),z=R("./src/demux/id3.ts"),j=R("./src/utils/timescale-conversion.ts"),O=R("./src/utils/webvtt-parser.ts");function P(){return P=Object.assign||function(f){for(var p=1;p"):X}function j(E){for(var L=arguments.length,D=new Array(L>1?L-1:0),T=1;T>24,C[y+1]=m>>16&255,C[y+2]=m>>8&255,C[y+3]=m&255}function L(C,y){var m=[];if(!y.length)return m;var l,S,f;"data"in C?(l=C.data,S=C.start,f=C.end):(l=C,S=0,f=l.byteLength);for(var p=S;p1?p+s:f;if(a===y[0])if(y.length===1)m.push({data:l,start:p+8,end:b});else{var v=L({data:l,start:p+8,end:b},y.slice(1));v.length&&z.apply(m,v)}p=b}return m}function D(C){var y=L(C,["moov"]),m=y[0],l=m?m.end:null,S=L(C,["sidx"]);if(!S||!S[0])return null;var f=[],p=S[0],s=p.data[0],a=s===0?8:16,b=P(p,a);a+=4;var v=0,x=0;s===0?a+=8:a+=16,a+=2;var k=p.end+x,H=O(p,a);a+=2;for(var V=0;V>>31;if(q===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var oe=P(p,Q);Q+=4,f.push({referenceSize:W,subsegmentDuration:oe,info:{duration:oe/b,start:k,end:k+W-1}}),k+=W,Q+=4,a=Q}return{earliestPresentationTime:v,timescale:b,version:s,referencesCount:H,references:f,moovEndOffset:l}}function T(C){for(var y=[],m=L(C,["moov","trak"]),l=0;lj)&&(this.startTime=j),this.endTime=O,this.screen=P,this.timelineController.createCaptionsTrack(this.trackName)},I.reset=function(){this.cueRanges=[]},N}()},"./src/utils/texttrack-utils.ts":function(ae,$,R){"use strict";R.r($),R.d($,"sendAddTrackEvent",function(){return N}),R.d($,"addCueToTrack",function(){return I}),R.d($,"clearCurrentCues",function(){return z}),R.d($,"removeCuesInRange",function(){return j}),R.d($,"getCuesInRange",function(){return P});var X=R("./src/utils/logger.ts");function N(E,L){var D;try{D=new Event("addtrack")}catch(T){D=document.createEvent("Event"),D.initEvent("addtrack",!1,!1)}D.track=E,L.dispatchEvent(D)}function I(E,L){var D=E.mode;if(D==="disabled"&&(E.mode="hidden"),E.cues&&!E.cues.getCueById(L.id))try{if(E.addCue(L),!E.cues.getCueById(L.id))throw new Error("addCue is failed for: "+L)}catch(A){X.logger.debug("[texttrack-utils]: "+A);var T=new self.TextTrackCue(L.startTime,L.endTime,L.text);T.id=L.id,E.addCue(T)}D==="disabled"&&(E.mode=D)}function z(E){var L=E.mode;if(L==="disabled"&&(E.mode="hidden"),E.cues)for(var D=E.cues.length;D--;)E.removeCue(E.cues[D]);L==="disabled"&&(E.mode=L)}function j(E,L,D){var T=E.mode;if(T==="disabled"&&(E.mode="hidden"),E.cues&&E.cues.length>0)for(var A=P(E.cues,L,D),w=0;wE[D].endTime)return-1;for(var T=0,A=D;T<=A;){var w=Math.floor((A+T)/2);if(LE[w].startTime&&T-1)for(var w=A,h=E.length;w=L&&o.endTime<=D)T.push(o);else if(o.startTime>D)return T}return T}},"./src/utils/time-ranges.ts":function(ae,$,R){"use strict";R.r($);var X={toString:function(I){for(var z="",j=I.length,O=0;O1?L-1:0),T=1;T100)throw new Error("Position must be between 0 and 100.");f=v,this.hasBeenReset=!0}})),Object.defineProperty(T,"positionAlign",O({},A,{get:function(){return p},set:function(v){var x=j(v);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");p=x,this.hasBeenReset=!0}})),Object.defineProperty(T,"size",O({},A,{get:function(){return s},set:function(v){if(v<0||v>100)throw new Error("Size must be between 0 and 100.");s=v,this.hasBeenReset=!0}})),Object.defineProperty(T,"align",O({},A,{get:function(){return a},set:function(v){var x=j(v);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");a=x,this.hasBeenReset=!0}})),T.displayState=void 0}return P.prototype.getCueAsHTML=function(){var E=self.WebVTT;return E.convertCueToDOMTree(self,this.text)},P}()},"./src/utils/vttparser.ts":function(ae,$,R){"use strict";R.r($),R.d($,"parseTimeStamp",function(){return I}),R.d($,"fixLineBreaks",function(){return L}),R.d($,"VTTParser",function(){return D});var X=R("./src/utils/vttcue.ts"),N=function(){function T(){}var A=T.prototype;return A.decode=function(h,o){if(!h)return"";if(typeof h!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(h))},T}();function I(T){function A(h,o,d,c){return(h|0)*3600+(o|0)*60+(d|0)+parseFloat(c||0)}var w=T.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return w?parseFloat(w[2])>59?A(w[2],w[3],0,w[4]):A(w[1],w[2],w[3],w[4]):null}var z=function(){function T(){this.values=Object.create(null)}var A=T.prototype;return A.set=function(h,o){!this.get(h)&&o!==""&&(this.values[h]=o)},A.get=function(h,o,d){return d?this.has(h)?this.values[h]:o[d]:this.has(h)?this.values[h]:o},A.has=function(h){return h in this.values},A.alt=function(h,o,d){for(var c=0;c=0&&d<=100)return this.set(h,d),!0}return!1},T}();function j(T,A,w,h){var o=h?T.split(h):[T];for(var d in o){if(typeof o[d]!="string")continue;var c=o[d].split(w);if(c.length!==2)continue;var C=c[0],y=c[1];A(C,y)}}var O=new X.default(0,0,""),P=O.align==="middle"?"middle":"center";function E(T,A,w){var h=T;function o(){var C=I(T);if(C===null)throw new Error("Malformed timestamp: "+h);return T=T.replace(/^[^\sa-zA-Z-]+/,""),C}function d(C,y){var m=new z;j(C,function(f,p){var s;switch(f){case"region":for(var a=w.length-1;a>=0;a--)if(w[a].id===p){m.set(f,w[a].region);break}break;case"vertical":m.alt(f,p,["rl","lr"]);break;case"line":s=p.split(","),m.integer(f,s[0]),m.percent(f,s[0])&&m.set("snapToLines",!1),m.alt(f,s[0],["auto"]),s.length===2&&m.alt("lineAlign",s[1],["start",P,"end"]);break;case"position":s=p.split(","),m.percent(f,s[0]),s.length===2&&m.alt("positionAlign",s[1],["start",P,"end","line-left","line-right","auto"]);break;case"size":m.percent(f,p);break;case"align":m.alt(f,p,["start",P,"end","left","right"]);break}},/:/,/\s/),y.region=m.get("region",null),y.vertical=m.get("vertical","");var l=m.get("line","auto");l==="auto"&&O.line===-1&&(l=-1),y.line=l,y.lineAlign=m.get("lineAlign","start"),y.snapToLines=m.get("snapToLines",!0),y.size=m.get("size",100),y.align=m.get("align",P);var S=m.get("position","auto");S==="auto"&&O.position===50&&(S=y.align==="start"||y.align==="left"?0:y.align==="end"||y.align==="right"?100:50),y.position=S}function c(){T=T.replace(/^\s+/,"")}if(c(),A.startTime=o(),c(),T.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+h);T=T.substr(3),c(),A.endTime=o(),c(),d(T,A)}function L(T){return T.replace(//gi,` `)}var D=function(){function T(){this.state="INITIAL",this.buffer="",this.decoder=new N,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var A=T.prototype;return A.parse=function(h){var o=this;h&&(o.buffer+=o.decoder.decode(h,{stream:!0}));function d(){var S=o.buffer,f=0;for(S=L(S);f")===-1){o.cue.id=C;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{E(C,o.cue,o.regionList)}catch(S){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var l=C.indexOf("-->")!==-1;if(!C||l&&(m=!0)){o.oncue&&o.cue&&o.oncue(o.cue),o.cue=null,o.state="ID";continue}if(o.cue===null)continue;o.cue.text&&(o.cue.text+=` `),o.cue.text+=C}continue;case"BADCUE":C||(o.state="ID")}}}catch(S){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},A.flush=function(){var h=this;try{if((h.cue||h.state==="HEADER")&&(h.buffer+=` `,h.parse()),h.state==="INITIAL"||h.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){h.onparsingerror&&h.onparsingerror(o)}return h.onflush&&h.onflush(),this},T}()},"./src/utils/webvtt-parser.ts":function(ae,$,R){"use strict";R.r($),R.d($,"generateCueId",function(){return D}),R.d($,"parseWebVTT",function(){return A});var X=R("./src/polyfills/number.ts"),N=R("./src/utils/vttparser.ts"),I=R("./src/demux/id3.ts"),z=R("./src/utils/timescale-conversion.ts"),j=R("./src/remux/mp4-remuxer.ts"),O=/\r\n|\n\r|\n|\r/g,P=function(h,o,d){return d===void 0&&(d=0),h.substr(d,o.length)===o},E=function(h){var o=parseInt(h.substr(-3)),d=parseInt(h.substr(-6,2)),c=parseInt(h.substr(-9,2)),C=h.length>9?parseInt(h.substr(0,h.indexOf(":"))):0;if(!Object(X.isFiniteNumber)(o)||!Object(X.isFiniteNumber)(d)||!Object(X.isFiniteNumber)(c)||!Object(X.isFiniteNumber)(C))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+h);return o+=1e3*d,o+=60*1e3*c,o+=60*60*1e3*C,o},L=function(h){for(var o=5381,d=h.length;d;)o=o*33^h.charCodeAt(--d);return(o>>>0).toString()};function D(w,h,o){return L(w.toString())+L(h.toString())+L(o)}var T=function(h,o,d){var c=h[o],C=h[c.prevCC];if(!C||!C.new&&c.new){h.ccOffset=h.presentationOffset=c.start,c.new=!1;return}for(;(y=C)!==null&&y!==void 0&&y.new;){var y;h.ccOffset+=c.start-C.start,c.new=!1,c=C,C=h[c.prevCC]}h.presentationOffset=d};function A(w,h,o,d,c,C,y,m){var l=new N.VTTParser,S=Object(I.utf8ArrayToStr)(new Uint8Array(w)).trim().replace(O,` `).split(` `),f=[],p=Object(z.toMpegTsClockFromTimescale)(h,o),s="00:00.000",a=0,b=0,v,x=!0,k=!1;l.oncue=function(H){var V=d[c],Q=d.ccOffset,G=(a-p)/9e4;if(V!=null&&V.new&&(b!==void 0?Q=d.ccOffset=V.start:T(d,c,G)),G&&(Q=G-d.presentationOffset),k){var W=H.endTime-H.startTime,q=Object(j.normalizePts)((H.startTime+Q-b)*9e4,C*9e4)/9e4;H.startTime=q,H.endTime=q+W}var oe=H.text.trim();H.text=decodeURIComponent(encodeURIComponent(oe)),H.id||(H.id=D(H.startTime,H.endTime,oe)),H.endTime>0&&f.push(H)},l.onparsingerror=function(H){v=H},l.onflush=function(){if(v){m(v);return}y(f)},S.forEach(function(H){if(x)if(P(H,"X-TIMESTAMP-MAP=")){x=!1,k=!0,H.substr(16).split(",").forEach(function(V){P(V,"LOCAL:")?s=V.substr(6):P(V,"MPEGTS:")&&(a=parseInt(V.substr(7)))});try{b=E(s)/1e3}catch(V){k=!1,v=V}return}else H===""&&(x=!1);l.parse(H+` `)}),l.flush()}},"./src/utils/xhr-loader.ts":function(ae,$,R){"use strict";R.r($);var X=R("./src/utils/logger.ts"),N=R("./src/loader/load-stats.ts"),I=/^age:\s*[\d.]+\s*$/m,z=function(){function j(P){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=P?P.xhrSetup:null,this.stats=new N.LoadStats,this.retryDelay=0}var O=j.prototype;return O.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},O.abortInternal=function(){var E=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),E&&(E.onreadystatechange=null,E.onprogress=null,E.readyState!==4&&(this.stats.aborted=!0,E.abort()))},O.abort=function(){var E;this.abortInternal(),(E=this.callbacks)!==null&&E!==void 0&&E.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},O.load=function(E,L,D){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=E,this.config=L,this.callbacks=D,this.retryDelay=L.retryDelay,this.loadInternal()},O.loadInternal=function(){var E=this.config,L=this.context;if(!E)return;var D=this.loader=new self.XMLHttpRequest,T=this.stats;T.loading.first=0,T.loaded=0;var A=this.xhrSetup;try{if(A)try{A(D,L.url)}catch(o){D.open("GET",L.url,!0),A(D,L.url)}D.readyState||D.open("GET",L.url,!0);var w=this.context.headers;if(w)for(var h in w)D.setRequestHeader(h,w[h])}catch(o){this.callbacks.onError({code:D.status,text:o.message},L,D);return}L.rangeEnd&&D.setRequestHeader("Range","bytes="+L.rangeStart+"-"+(L.rangeEnd-1)),D.onreadystatechange=this.readystatechange.bind(this),D.onprogress=this.loadprogress.bind(this),D.responseType=L.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),E.timeout),D.send()},O.readystatechange=function(){var E=this.context,L=this.loader,D=this.stats;if(!E||!L)return;var T=L.readyState,A=this.config;if(D.aborted)return;if(T>=2)if(self.clearTimeout(this.requestTimeout),D.loading.first===0&&(D.loading.first=Math.max(self.performance.now(),D.loading.start)),T===4){L.onreadystatechange=null,L.onprogress=null;var w=L.status;if(w>=200&&w<300){D.loading.end=Math.max(self.performance.now(),D.loading.first);var h,o;if(E.responseType==="arraybuffer"?(h=L.response,o=h.byteLength):(h=L.responseText,o=h.length),D.loaded=D.total=o,!this.callbacks)return;var d=this.callbacks.onProgress;if(d&&d(D,E,h,L),!this.callbacks)return;var c={url:L.responseURL,data:h};this.callbacks.onSuccess(c,D,E,L)}else D.retry>=A.maxRetry||w>=400&&w<499?(X.logger.error(w+" while loading "+E.url),this.callbacks.onError({code:w,text:L.statusText},E,L)):(X.logger.warn(w+" while loading "+E.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,A.maxRetryDelay),D.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),A.timeout)},O.loadtimeout=function(){X.logger.warn("timeout while loading "+this.context.url);var E=this.callbacks;E&&(this.abortInternal(),E.onTimeout(this.stats,this.context,this.loader))},O.loadprogress=function(E){var L=this.stats;L.loaded=E.loaded,E.lengthComputable&&(L.total=E.total)},O.getCacheAge=function(){var E=null;if(this.loader&&I.test(this.loader.getAllResponseHeaders())){var L=this.loader.getResponseHeader("age");E=L?parseFloat(L):null}return E},j}();$.default=z}}).default})},vHTk:function(At,ft,re){At.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);