(window.webpackJsonp=window.webpackJsonp||[]).push([[195,7,8],{"+NIl":function(at,Xe,V){(function(oe){oe(V("VrN/"))})(function(oe){"use strict";oe.defineMode("stex",function(Y,D){"use strict";function $(w,S){w.cmdState.push(S)}function U(w){return w.cmdState.length>0?w.cmdState[w.cmdState.length-1]:null}function I(w){var S=w.cmdState.pop();S&&S.closeBracket()}function K(w){for(var S=w.cmdState,T=S.length-1;T>=0;T--){var h=S[T];if(h.name=="DEFAULT")continue;return h}return{styleIdentifier:function(){return null}}}function N(w,S,T){return function(){this.name=w,this.bracketNo=0,this.style=S,this.styles=T,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=N("importmodule","tag",["string","builtin"]),O.documentclass=N("documentclass","tag",["","atom"]),O.usepackage=N("usepackage","tag",["atom"]),O.begin=N("begin","tag",["atom"]),O.end=N("end","tag",["atom"]),O.label=N("label","tag",["atom"]),O.ref=N("ref","tag",["atom"]),O.eqref=N("eqref","tag",["atom"]),O.cite=N("cite","tag",["atom"]),O.bibitem=N("bibitem","tag",["atom"]),O.Bibitem=N("Bibitem","tag",["atom"]),O.RBibitem=N("RBibitem","tag",["atom"]),O.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function L(w,S){w.f=S}function x(w,S){var T;if(w.match(/^\\[a-zA-Z@]+/)){var h=w.current().slice(1);return T=O.hasOwnProperty(h)?O[h]:O.DEFAULT,T=new T,$(S,T),L(S,P),T.style}if(w.match(/^\\[$&%#{}_]/))return"tag";if(w.match(/^\\[,;!\/\\]/))return"tag";if(w.match("\\["))return L(S,function(i,c){return A(i,c,"\\]")}),"keyword";if(w.match("\\("))return L(S,function(i,c){return A(i,c,"\\)")}),"keyword";if(w.match("$$"))return L(S,function(i,c){return A(i,c,"$$")}),"keyword";if(w.match("$"))return L(S,function(i,c){return A(i,c,"$")}),"keyword";var l=w.next();if(l=="%")return w.skipToEnd(),"comment";if(l=="}"||l=="]"){if(T=U(S),T)T.closeBracket(l),L(S,P);else return"error";return"bracket"}else return l=="{"||l=="["?(T=O.DEFAULT,T=new T,$(S,T),"bracket"):/\d/.test(l)?(w.eatWhile(/[\w.%]/),"atom"):(w.eatWhile(/[\w\-_]/),T=K(S),T.name=="begin"&&(T.argument=w.current()),T.styleIdentifier())}function A(w,S,T){if(w.eatSpace())return null;if(T&&w.match(T))return L(S,x),"keyword";if(w.match(/^\\[a-zA-Z@]+/))return"tag";if(w.match(/^[a-zA-Z]+/))return"variable-2";if(w.match(/^\\[$&%#{}_]/))return"tag";if(w.match(/^\\[,;!\/]/))return"tag";if(w.match(/^[\^_&]/))return"tag";if(w.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(w.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var h=w.next();return h=="{"||h=="}"||h=="["||h=="]"||h=="("||h==")"?"bracket":h=="%"?(w.skipToEnd(),"comment"):"error"}function P(w,S){var T=w.peek(),h;return T=="{"||T=="["?(h=U(S),h.openBracket(T),w.eat(T),L(S,x),"bracket"):/[ \t\r]/.test(T)?(w.eat(T),null):(L(S,x),I(S),x(w,S))}return{startState:function(){var w=D.inMathMode?function(S,T){return A(S,T)}:x;return{cmdState:[],f:w}},copyState:function(w){return{cmdState:w.cmdState.slice(),f:w.f}},token:function(w,S){return S.f(w,S)},blankLine:function(w){w.f=x,w.cmdState.length=0},lineComment:"%"}}),oe.defineMIME("text/x-stex","stex"),oe.defineMIME("text/x-latex","stex")})},"+RXH":function(at,Xe,V){at.exports=V.p+"static/shu.a39bf729.svg"},"+yhJ":function(at,Xe,V){at.exports=V.p+"static/xixi.d492fb65.svg"},"0eGx":function(at,Xe,V){at.exports=V.p+"static/zhong.c1924b73.svg"},"19Vz":function(at,Xe,V){(function(oe){oe(V("VrN/"))})(function(oe){oe.defineOption("placeholder","",function(N,O,L){var x=L&&L!=oe.Init;if(O&&!x)N.on("blur",U),N.on("change",I),N.on("swapDoc",I),oe.on(N.getInputField(),"compositionupdate",N.state.placeholderCompose=function(){$(N)}),I(N);else if(!O&&x){N.off("blur",U),N.off("change",I),N.off("swapDoc",I),oe.off(N.getInputField(),"compositionupdate",N.state.placeholderCompose),Y(N);var A=N.getWrapperElement();A.className=A.className.replace(" CodeMirror-empty","")}O&&!N.hasFocus()&&U(N)});function Y(N){N.state.placeholder&&(N.state.placeholder.parentNode.removeChild(N.state.placeholder),N.state.placeholder=null)}function D(N){Y(N);var O=N.state.placeholder=document.createElement("pre");O.style.cssText="height: 0; overflow: visible",O.style.direction=N.getOption("direction"),O.className="CodeMirror-placeholder CodeMirror-line-like";var L=N.getOption("placeholder");typeof L=="string"&&(L=document.createTextNode(L)),O.appendChild(L),N.display.lineSpace.insertBefore(O,N.display.lineSpace.firstChild)}function $(N){setTimeout(function(){var O=!1,L=N.getInputField();L.nodeName=="TEXTAREA"?O=!L.value:N.lineCount()==1&&(O=!/[^\u200b]/.test(L.querySelector(".CodeMirror-line").textContent)),O?D(N):Y(N)},20)}function U(N){K(N)&&D(N)}function I(N){var O=N.getWrapperElement(),L=K(N);O.className=O.className.replace(" CodeMirror-empty","")+(L?" CodeMirror-empty":""),L?D(N):Y(N)}function K(N){return N.lineCount()===1&&N.getLine(0)===""}})},"1eCo":function(at,Xe,V){(function(oe){oe(V("VrN/"))})(function(oe){"use strict";var Y={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},D={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};oe.defineMode("xml",function($,U){var I=$.indentUnit,K={},N=U.htmlMode?Y:D;for(var O in N)K[O]=N[O];for(var O in U)K[O]=U[O];var L,x;function A(a,b){function g(H){return b.tokenize=H,H(a,b)}var _=a.next();if(_=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?g(S("atom","]]>")):null:a.match("--")?g(S("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),g(T(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),b.tokenize=S("meta","?>"),"meta"):(L=a.eat("/")?"closeTag":"openTag",b.tokenize=P,"tag bracket");if(_=="&"){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}A.isInText=!0;function P(a,b){var g=a.next();if(g==">"||g=="/"&&a.eat(">"))return b.tokenize=A,L=g==">"?"endTag":"selfcloseTag","tag bracket";if(g=="=")return L="equals",null;if(g=="<"){b.tokenize=A,b.state=c,b.tagName=b.tagStart=null;var _=b.tokenize(a,b);return _?_+" tag error":"tag error"}else return/[\'\"]/.test(g)?(b.tokenize=w(g),b.stringStartCol=a.column(),b.tokenize(a,b)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function w(a){var b=function(g,_){for(;!g.eol();)if(g.next()==a){_.tokenize=P;break}return"string"};return b.isInAttribute=!0,b}function S(a,b){return function(g,_){for(;!g.eol();){if(g.match(b)){_.tokenize=A;break}g.next()}return a}}function T(a){return function(b,g){for(var _;(_=b.next())!=null;){if(_=="<")return g.tokenize=T(a+1),g.tokenize(b,g);if(_==">")if(a==1){g.tokenize=A;break}else return g.tokenize=T(a-1),g.tokenize(b,g)}return"meta"}}function h(a,b,g){this.prev=a.context,this.tagName=b,this.indent=a.indented,this.startOfLine=g,(K.doNotIndent.hasOwnProperty(b)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function l(a){a.context&&(a.context=a.context.prev)}function i(a,b){for(var g;;){if(!a.context)return;if(g=a.context.tagName,!K.contextGrabbers.hasOwnProperty(g)||!K.contextGrabbers[g].hasOwnProperty(b))return;l(a)}}function c(a,b,g){return a=="openTag"?(g.tagStart=b.column(),C):a=="closeTag"?v:c}function C(a,b,g){return a=="word"?(g.tagName=b.current(),x="tag",E):K.allowMissingTagName&&a=="endTag"?(x="tag bracket",E(a,b,g)):(x="error",C)}function v(a,b,g){if(a=="word"){var _=b.current();return g.context&&g.context.tagName!=_&&K.implicitlyClosed.hasOwnProperty(g.context.tagName)&&l(g),g.context&&g.context.tagName==_||K.matchClosing===!1?(x="tag",m):(x="tag error",u)}else return K.allowMissingTagName&&a=="endTag"?(x="tag bracket",m(a,b,g)):(x="error",u)}function m(a,b,g){return a!="endTag"?(x="error",m):(l(g),c)}function u(a,b,g){return x="error",m(a,b,g)}function E(a,b,g){if(a=="word")return x="attribute",d;if(a=="endTag"||a=="selfcloseTag"){var _=g.tagName,k=g.tagStart;return g.tagName=g.tagStart=null,a=="selfcloseTag"||K.autoSelfClosers.hasOwnProperty(_)?i(g,_):(i(g,_),g.context=new h(g,_,k==g.indented)),c}return x="error",E}function d(a,b,g){return a=="equals"?f:(K.allowMissing||(x="error"),E(a,b,g))}function f(a,b,g){return a=="string"?s:a=="word"&&K.allowUnquoted?(x="string",E):(x="error",E(a,b,g))}function s(a,b,g){return a=="string"?s:E(a,b,g)}return{startState:function(a){var b={tokenize:A,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;L=null;var g=b.tokenize(a,b);return(g||L)&&g!="comment"&&(x=null,b.state=b.state(L||g,a,b),x&&(g=x=="error"?g+" error":x)),g},indent:function(a,b,g){var _=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+I;if(_&&_.noIndent)return oe.Pass;if(a.tokenize!=P&&a.tokenize!=A)return g?g.match(/^(\s*)/)[0].length:0;if(a.tagName)return K.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+I*(K.multilineTagIndentFactor||1);if(K.alignCDATA&&/$/,blockCommentStart:"",configuration:K.htmlMode?"html":"xml",helperType:K.htmlMode?"html":"xml",skipAttribute:function(a){a.state==f&&(a.state=E)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var b=[],g=a.context;g;g=g.prev)g.tagName&&b.push(g.tagName);return b.reverse()}}}),oe.defineMIME("text/xml","xml"),oe.defineMIME("application/xml","xml"),oe.mimeModes.hasOwnProperty("text/html")||oe.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"2sxD":function(at,Xe,V){at.exports={list:"list___3_VOx",head:"head___37dUf",name:"name___1VbnU",right:"right___gDdSx",body:"body___1wO_8",top:"top___cjRoo",bottom:"bottom___O44ku",l:"l___3de2t",ListGroup:"ListGroup___22jzr",a:"a___3Rx6Z",b:"b___S9Ybp",c:"c___3CVXw",c1:"c1___3b8Zq",radio:"radio___LnwQZ",d:"d___2-cs-"}},"51dB":function(at,Xe,V){at.exports=V.p+"static/sc.c1696770.svg"},"5MlY":function(at,Xe,V){at.exports=V.p+"static/sm.8ccb50bf.svg"},"6+eU":function(at,Xe,V){"use strict";V.d(Xe,"a",function(){return m});var oe=V("wx14"),Y=V("rePB"),D=V("VTBJ"),$=V("1OyB"),U=V("vuIU"),I=V("Ji7U"),K=V("LK+K"),N=V("q1tI"),O=V.n(N),L=V("TSYQ"),x=V.n(L),A=function(E){var d,f="".concat(E.rootPrefixCls,"-item"),s=x()(f,"".concat(f,"-").concat(E.page),(d={},Object(Y.a)(d,"".concat(f,"-active"),E.active),Object(Y.a)(d,E.className,!!E.className),Object(Y.a)(d,"".concat(f,"-disabled"),!E.page),d)),a=function(){E.onClick(E.page)},b=function(_){E.onKeyPress(_,E.onClick,E.page)};return O.a.createElement("li",{title:E.showTitle?E.page:null,className:s,onClick:a,onKeyPress:b,tabIndex:"0"},E.itemRender(E.page,"page",O.a.createElement("a",{rel:"nofollow"},E.page)))},P=A,w={ZERO:48,NINE:57,NUMPAD_ZERO:96,NUMPAD_NINE:105,BACKSPACE:8,DELETE:46,ENTER:13,ARROW_UP:38,ARROW_DOWN:40},S=function(u){Object(I.a)(d,u);var E=Object(K.a)(d);function d(){var f;Object($.a)(this,d);for(var s=arguments.length,a=new Array(s),b=0;b=0||g.relatedTarget.className.indexOf("".concat(z,"-next"))>=0))return;f.setState({goInputText:""}),H(f.getValidValue())},f.go=function(g){var _=f.state.goInputText;if(_==="")return;(g.keyCode===w.ENTER||g.type==="click")&&(f.setState({goInputText:""}),f.props.quickGo(f.getValidValue()))},f}return Object(U.a)(d,[{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(g){return g.toString()===a.toString()})?b:b.concat([a.toString()]).sort(function(g,_){var k=isNaN(Number(g))?0:Number(g),H=isNaN(Number(_))?0:Number(_);return k-H})}},{key:"render",value:function(){var s=this,a=this.props,b=a.pageSize,g=a.locale,_=a.rootPrefixCls,k=a.changeSize,H=a.quickGo,z=a.goButton,Z=a.selectComponentClass,G=a.buildOptionText,B=a.selectPrefixCls,te=a.disabled,ce=this.state.goInputText,pe="".concat(_,"-options"),ye=Z,Ce=null,_e=null,le=null;if(!k&&!H)return null;var se=this.getPageSizeOptions();if(k&&ye){var ge=se.map(function(ie,q){return O.a.createElement(ye.Option,{key:q,value:ie.toString()},(G||s.buildOptionText)(ie))});Ce=O.a.createElement(ye,{disabled:te,prefixCls:B,showSearch:!1,className:"".concat(pe,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(b||se[0]).toString(),onChange:this.changeSize,getPopupContainer:function(q){return q.parentNode}},ge)}return H&&(z&&(le=typeof z=="boolean"?O.a.createElement("button",{type:"button",onClick:this.go,onKeyUp:this.go,disabled:te,className:"".concat(pe,"-quick-jumper-button")},g.jump_to_confirm):O.a.createElement("span",{onClick:this.go,onKeyUp:this.go},z)),_e=O.a.createElement("div",{className:"".concat(pe,"-quick-jumper")},g.jump_to,O.a.createElement("input",{disabled:te,type:"text",value:ce,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur}),g.page,le)),O.a.createElement("li",{className:"".concat(pe)},Ce,_e)}}]),d}(O.a.Component);S.defaultProps={pageSizeOptions:["10","20","50","100"]};var T=S,h=V("N2Kk");function l(){}function i(u){return typeof u=="number"&&isFinite(u)&&Math.floor(u)===u}function c(u,E,d){return d}function C(u,E,d){var f=typeof u=="undefined"?E.pageSize:u;return Math.floor((d.total-1)/f)+1}var v=function(u){Object(I.a)(d,u);var E=Object(K.a)(d);function d(f){var s;Object($.a)(this,d),s=E.call(this,f),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 z=s.props.prefixCls,Z=k||O.a.createElement("button",{type:"button","aria-label":H,className:"".concat(z,"-item-link")});return typeof k=="function"&&(Z=O.a.createElement(k,Object(D.a)({},s.props))),Z},s.savePaginationNode=function(k){s.paginationNode=k},s.isValid=function(k){return i(k)&&k!==s.state.current},s.shouldDisplayQuickJumper=function(){var k=s.props,H=k.showQuickJumper,z=k.pageSize,Z=k.total;return Z<=z?!1:H},s.handleKeyDown=function(k){(k.keyCode===w.ARROW_UP||k.keyCode===w.ARROW_DOWN)&&k.preventDefault()},s.handleKeyUp=function(k){var H=s.getValidValue(k),z=s.state.currentInputValue;H!==z&&s.setState({currentInputValue:H}),k.keyCode===w.ENTER?s.handleChange(H):k.keyCode===w.ARROW_UP?s.handleChange(H-1):k.keyCode===w.ARROW_DOWN&&s.handleChange(H+1)},s.changePageSize=function(k){var H=s.state.current,z=C(k,s.state,s.props);H=H>z?z:H,z===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,z=k;if(s.isValid(z)&&!H){var Z=C(void 0,s.state,s.props);z>Z?z=Z:z<1&&(z=1),"current"in s.props||s.setState({current:z,currentInputValue:z});var G=s.state.pageSize;return s.props.onChange(z,G),z}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?z-2:0),G=2;G=b?_=b:_=Number(a),_}},{key:"getShowSizeChanger",value:function(){var s=this.props,a=s.showSizeChanger,b=s.total,g=s.totalBoundaryShowSizeChanger;return typeof a!="undefined"?a:b>g}},{key:"renderPrev",value:function(s){var a=this.props,b=a.prevIcon,g=a.itemRender,_=g(s,"prev",this.getItemIcon(b,"prev page")),k=!this.hasPrev();return Object(N.isValidElement)(_)?Object(N.cloneElement)(_,{disabled:k}):_}},{key:"renderNext",value:function(s){var a=this.props,b=a.nextIcon,g=a.itemRender,_=g(s,"next",this.getItemIcon(b,"next page")),k=!this.hasNext();return Object(N.isValidElement)(_)?Object(N.cloneElement)(_,{disabled:k}):_}},{key:"render",value:function(){var s=this,a=this.props,b=a.prefixCls,g=a.className,_=a.style,k=a.disabled,H=a.hideOnSinglePage,z=a.total,Z=a.locale,G=a.showQuickJumper,B=a.showLessItems,te=a.showTitle,ce=a.showTotal,pe=a.simple,ye=a.itemRender,Ce=a.showPrevNextJumpers,_e=a.jumpPrevIcon,le=a.jumpNextIcon,se=a.selectComponentClass,ge=a.selectPrefixCls,ie=a.pageSizeOptions,q=this.state,Ee=q.current,Me=q.pageSize,Ne=q.currentInputValue;if(H===!0&&z<=Me)return null;var De=C(void 0,this.state,this.props),Be=[],Ae=null,Pe=null,Fe=null,ze=null,qe=null,He=G&&G.goButton,Oe=B?1:2,lt=Ee-1>0?Ee-1:0,tt=Ee+1=Oe*2&&Ee!==1+2&&(Be[0]=Object(N.cloneElement)(Be[0],{className:"".concat(b,"-item-after-jump-prev")}),Be.unshift(Ae)),De-Ee>=Oe*2&&Ee!==De-2&&(Be[Be.length-1]=Object(N.cloneElement)(Be[Be.length-1],{className:"".concat(b,"-item-before-jump-next")}),Be.push(Pe)),Pt!==1&&Be.unshift(Fe),Tt!==De&&Be.push(ze)}var xe=null;ce&&(xe=O.a.createElement("li",{className:"".concat(b,"-total-text")},ce(z,[z===0?0:(Ee-1)*Me+1,Ee*Me>z?z:Ee*Me])));var fe=!this.hasPrev()||!De,be=!this.hasNext()||!De;return O.a.createElement("ul",Object(oe.a)({className:x()(b,g,Object(Y.a)({},"".concat(b,"-disabled"),k)),style:_,unselectable:"unselectable",ref:this.savePaginationNode},ft),xe,O.a.createElement("li",{title:te?Z.prev_page:null,onClick:this.prev,tabIndex:fe?null:0,onKeyPress:this.runIfEnterPrev,className:x()("".concat(b,"-prev"),Object(Y.a)({},"".concat(b,"-disabled"),fe)),"aria-disabled":fe},this.renderPrev(lt)),Be,O.a.createElement("li",{title:te?Z.next_page:null,onClick:this.next,tabIndex:be?null:0,onKeyPress:this.runIfEnterNext,className:x()("".concat(b,"-next"),Object(Y.a)({},"".concat(b,"-disabled"),be)),"aria-disabled":be},this.renderNext(tt)),O.a.createElement(T,{disabled:k,locale:Z,rootPrefixCls:b,selectComponentClass:se,selectPrefixCls:ge,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:Ee,pageSize:Me,pageSizeOptions:ie,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:He}))}}],[{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 g=a.current,_=C(s.pageSize,a,s);g=g>_?_:g,"current"in s||(b.current=g,b.currentInputValue=g),b.pageSize=s.pageSize}return b}}]),d}(O.a.Component);v.defaultProps={defaultCurrent:1,total:0,defaultPageSize:10,onChange:l,className:"",selectPrefixCls:"rc-select",prefixCls:"rc-pagination",selectComponentClass:null,hideOnSinglePage:!1,showPrevNextJumpers:!0,showQuickJumper:!1,showLessItems:!1,showTitle:!0,onShowSizeChange:l,locale:h.a,style:{},itemRender:c,totalBoundaryShowSizeChanger:50};var m=v},"6K3P":function(at,Xe,V){at.exports=V.p+"static/jinshi.9b74f304.svg"},"7Cbv":function(at,Xe,V){"use strict";var oe=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),Y=new Uint8Array(16);function D(){if(!oe)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return oe(Y)}var $=/^(?:[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 U(P){return typeof P=="string"&&$.test(P)}for(var I=U,K=[],N=0;N<256;++N)K.push((N+256).toString(16).substr(1));function O(P){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,S=(K[P[w+0]]+K[P[w+1]]+K[P[w+2]]+K[P[w+3]]+"-"+K[P[w+4]]+K[P[w+5]]+"-"+K[P[w+6]]+K[P[w+7]]+"-"+K[P[w+8]]+K[P[w+9]]+"-"+K[P[w+10]]+K[P[w+11]]+K[P[w+12]]+K[P[w+13]]+K[P[w+14]]+K[P[w+15]]).toLowerCase();if(!I(S))throw TypeError("Stringified UUID is invalid");return S}var L=O;function x(P,w,S){P=P||{};var T=P.random||(P.rng||D)();if(T[6]=T[6]&15|64,T[8]=T[8]&63|128,w){S=S||0;for(var h=0;h<16;++h)w[S+h]=T[h];return w}return L(T)}var A=Xe.a=x},"7ahc":function(at,Xe,V){"use strict";V.d(Xe,"a",function(){return C});var oe=V("k1fw"),Y=V("0Owb"),D=V("+L6B"),$=V("2/Rp"),U=V("y8nQ"),I=V("Vl3Y"),K=V("tJVT"),N=V("OaEy"),O=V("2fM7"),L=V("q1tI"),x=V.n(L),A=V("VrN/"),P=V.n(A),w=V("p77/"),S=V.n(w),T=V("c5Ni"),h=V.n(T),l=O.a.Option,i={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"]};Xe.b=function(v){var m=v.callback,u=v.onCancel,E=Object(L.useState)("python"),d=Object(K.a)(E,2),f=d[0],s=d[1];function a(g){s(c[g][1])}function b(g){m(g)}return x.a.createElement(I.a,Object(Y.a)({},i,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:b}),x.a.createElement(I.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},x.a.createElement(O.a,{onChange:a},Object.keys(c).map(function(g){return x.a.createElement(l,{key:g,value:g},c[g][0])}))),x.a.createElement(I.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},x.a.createElement(C,{mode:f})),x.a.createElement("div",{className:"flex-container flex-end"},x.a.createElement($.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),x.a.createElement($.a,{type:"ghost",onClick:u},"\u53D6\u6D88")))};function C(v){var m=v.value,u=v.onChange,E=v.mode,d=v.options,f=d===void 0?{}:d,s=Object(L.useRef)(),a=Object(L.useState)(),b=Object(K.a)(a,2),g=b[0],_=b[1];return Object(L.useEffect)(function(){if(g){function k(H){var z=H.getValue();u&&u(z)}return g.on("change",k),function(){g.off("change",k)}}},[g,u]),Object(L.useEffect)(function(){g&&g.setOption("mode",E)},[g,E]),Object(L.useEffect)(function(){g&&((m!==g.getValue()||m==="")&&setTimeout(function(){g.setValue(m||" ")},300))},[g,m]),Object(L.useEffect)(function(){if(s.current&&!g){var k=P.a.fromTextArea(s.current,Object(oe.a)({mode:E,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},f));_(k)}},[s.current,g]),x.a.createElement("div",{className:"my-codemirror-container"},x.a.createElement("textarea",{ref:s}))}},"7ixt":function(at,Xe,V){"use strict";V.d(Xe,"a",function(){return D});var oe={adjustX:1,adjustY:1},Y=[0,0],D={left:{points:["cr","cl"],overflow:oe,offset:[-4,0],targetOffset:Y},right:{points:["cl","cr"],overflow:oe,offset:[4,0],targetOffset:Y},top:{points:["bc","tc"],overflow:oe,offset:[0,-4],targetOffset:Y},bottom:{points:["tc","bc"],overflow:oe,offset:[0,4],targetOffset:Y},topLeft:{points:["bl","tl"],overflow:oe,offset:[0,-4],targetOffset:Y},leftTop:{points:["tr","tl"],overflow:oe,offset:[-4,0],targetOffset:Y},topRight:{points:["br","tr"],overflow:oe,offset:[0,-4],targetOffset:Y},rightTop:{points:["tl","tr"],overflow:oe,offset:[4,0],targetOffset:Y},bottomRight:{points:["tr","br"],overflow:oe,offset:[0,4],targetOffset:Y},rightBottom:{points:["bl","br"],overflow:oe,offset:[4,0],targetOffset:Y},bottomLeft:{points:["tl","bl"],overflow:oe,offset:[0,4],targetOffset:Y},leftBottom:{points:["br","bl"],overflow:oe,offset:[-4,0],targetOffset:Y}},$=D},"7qnI":function(at,Xe,V){"use strict";var oe=V("5Dmo"),Y=V("3S7+"),D=V("fWQN"),$=V("mtLc"),U=V("yKVA"),I=V("879j"),K=V("5NDa"),N=V("5rEg"),O=V("q1tI"),L=V.n(O),x=V("O2Wb"),A=V.n(x),P=N.a.TextArea,w=function(S){Object(U.a)(h,S);var T=Object(I.a)(h);function h(){return Object(D.a)(this,h),T.apply(this,arguments)}return Object($.a)(h,[{key:"render",value:function(){var i=this,c=this.props,C=c.index,v=c.onAnswerChange,m=c.addChildAnswer,u=c.exerciseIsPublish,E=c.answers,d=c.activeOptionErrorIndex,f=c.flex,s=f===void 0?"0 0 1000px":f;return L.a.createElement("div",{className:A.a.flex},L.a.createElement("div",{className:"".concat(A.a.color666," mb5 mt6"),style:{flex:"0 0 90px"}},"\u7B54\u6848(\u586B\u7A7A",C+1,"):"),L.a.createElement("div",{className:"".concat(A.a.flex," ").concat(A.a.flex1),style:{flexDirection:"column"}},E.map(function(a,b){var g="".concat(C,"-").concat(b);return L.a.createElement("div",{className:"".concat(A.a.flex," ").concat(A.a.flex1),key:b},L.a.createElement("div",{className:A.a.flex1,style:{flex:s}},L.a.createElement("div",null,L.a.createElement(P,{className:g===d?A.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 v(C,b,k.target.value)},style:{minHeight:95}}))),!u&&L.a.createElement(L.a.Fragment,null,b!=0&&L.a.createElement(Y.a,{title:"\u5220\u9664"},L.a.createElement("i",{className:"".concat(A.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return i.props.deleteChildAnswer(C,b)},style:{float:"right"}})),b===0&&L.a.createElement(Y.a,{title:"\u5220\u9664"},L.a.createElement("i",{className:"".concat(A.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return i.props.deleteChildAnswermain(C,b)},style:{float:"right"}})),L.a.createElement(Y.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},L.a.createElement("i",{className:"".concat(A.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return m(C)},style:{float:"right",visibility:b==E.length-1?"":"hidden"}}))))})))}}]),h}(O.Component);Xe.a=w},"815F":function(at,Xe,V){"use strict";V.d(Xe,"e",function(){return K}),V.d(Xe,"c",function(){return O}),V.d(Xe,"d",function(){return L}),V.d(Xe,"a",function(){return A}),V.d(Xe,"f",function(){return P}),V.d(Xe,"b",function(){return w});var oe=V("KQm4"),Y=V("VTBJ"),D=V("Ff2n"),$=V("Zm9Q"),U=V("Kwbf"),I=V("OZM5");function K(S,T){return S!=null?S:T}function N(){var S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],T=new Map;function h(l){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";(l||[]).forEach(function(c){var C=c.key,v=c.children;Object(U.a)(C!=null,"Tree node must have a certain key: [".concat(i).concat(C,"]"));var m=String(C);Object(U.a)(!T.has(m)||C===null||C===void 0,"Same 'key' exist in the Tree: ".concat(m)),T.set(m,!0),h(v,"".concat(i).concat(m," > "))})}h(S)}function O(S){function T(h){var l=Object($.a)(h);return l.map(function(i){if(!Object(I.i)(i))return Object(U.a)(!i,"Tree/TreeNode can only accept TreeNode as children."),null;var c=i.key,C=i.props,v=C.children,m=Object(D.a)(C,["children"]),u=Object(Y.a)({key:c},m),E=T(v);return E.length&&(u.children=E),u}).filter(function(i){return i})}return T(S)}function L(){var S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],h=new Set(T===!0?[]:T),l=[];function i(c){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return c.map(function(v,m){var u=Object(I.h)(C?C.pos:"0",m),E=K(v.key,u),d=Object(Y.a)(Object(Y.a)({},v),{},{parent:C,pos:u,children:null,data:v,isStart:[].concat(Object(oe.a)(C?C.isStart:[]),[m===0]),isEnd:[].concat(Object(oe.a)(C?C.isEnd:[]),[m===c.length-1])});return l.push(d),T===!0||h.has(E)?d.children=i(v.children||[],d):d.children=[],d})}return i(S),l}function x(S,T,h){var l;h?typeof h=="string"?l=function(C){return C[h]}:typeof h=="function"&&(l=function(C){return h(C)}):l=function(C,v){return K(C.key,v)};function i(c,C,v){var m=c?c.children:S,u=c?Object(I.h)(v.pos,C):"0";if(c){var E=l(c,u),d={node:c,index:C,pos:u,key:E,parentPos:v.node?v.pos:null,level:v.level+1};T(d)}m&&m.forEach(function(f,s){i(f,s,{node:c,pos:u,level:v?v.level+1:-1})})}i(null)}function A(S){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},h=T.initWrapper,l=T.processEntity,i=T.onProcessFinished,c=arguments.length>2?arguments[2]:void 0,C={},v={},m={posEntities:C,keyEntities:v};return h&&(m=h(m)||m),x(S,function(u){var E=u.node,d=u.index,f=u.pos,s=u.key,a=u.parentPos,b=u.level,g={node:E,index:d,key:s,pos:f,level:b},_=K(s,f);C[f]=g,v[_]=g,g.parent=C[a],g.parent&&(g.parent.children=g.parent.children||[],g.parent.children.push(g)),l&&l(g,m)},c),i&&i(m),m}function P(S,T){var h=T.expandedKeys,l=T.selectedKeys,i=T.loadedKeys,c=T.loadingKeys,C=T.checkedKeys,v=T.halfCheckedKeys,m=T.dragOverNodeKey,u=T.dropPosition,E=T.keyEntities,d=E[S],f={eventKey:S,expanded:h.indexOf(S)!==-1,selected:l.indexOf(S)!==-1,loaded:i.indexOf(S)!==-1,loading:c.indexOf(S)!==-1,checked:C.indexOf(S)!==-1,halfChecked:v.indexOf(S)!==-1,pos:String(d?d.pos:""),dragOver:m===S&&u===0,dragOverGapTop:m===S&&u===-1,dragOverGapBottom:m===S&&u===1};return f}function w(S){var T=S.data,h=S.expanded,l=S.selected,i=S.checked,c=S.loaded,C=S.loading,v=S.halfChecked,m=S.dragOver,u=S.dragOverGapTop,E=S.dragOverGapBottom,d=S.pos,f=S.active,s=Object(Y.a)(Object(Y.a)({},T),{},{expanded:h,selected:l,checked:i,loaded:c,loading:C,halfChecked:v,dragOver:m,dragOverGapTop:u,dragOverGapBottom:E,pos:d,active:f});return"props"in s||Object.defineProperty(s,"props",{get:function(){return Object(U.a)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),S}}),s}},"8EBN":function(at,Xe,V){(function(oe){oe(V("VrN/"))})(function(oe){"use strict";oe.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 Y=0;Y-1&&$.substring(K+1,$.length);if(N)return oe.findModeByExtension(N)},oe.findModeByName=function($){$=$.toLowerCase();for(var U=0;U=M.length?Q.slice(M.length):Q}).join(` `)}var h=[],l=["
    "],i=new w.a.Renderer,c=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function C(){h.length=0,l=["
      "]}var v={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function m(F,p,y,M){if(p>=F.length||F[p].level<=y)return p;var Q=F[p];M.push("
    • "+Q.text+""),p++;var W=[];return p=m(F,p,Q.level,W),W.length>0&&(M.push("
        "),W.forEach(function(me){M.push(me)}),M.push("
      ")),M.push("
    • "),p=m(F,p,y,M),p}function u(){return m(h,0,0,l),l.push("
    "),l.join("")}var E={heading:function(p){var y=c.exec(p);if(y)return{type:"heading",raw:y[0],depth:y[1].length,text:y[2]}},fences:function(p){var y=this.rules.block.fences.exec(p);if(y){var M=y[0],Q=T(M,y[3]||""),W=y[2]?y[2].trim():y[2];if(["latex","katex","math"].indexOf(W)>=0){var me=s(),$e=Q;Q=me,a[me]={type:"block",expression:$e}}return{type:"code",raw:M,lang:W,text:Q}}}},d=/(?:\${2})([^\n`]+?)(?:\${2})/gi,f=0,s=function(){return"__special_katext_id_".concat(f++,"__")},a={};function b(){return a}function g(){f=0,a={}}function _(F){return F=F.replace(d,function(p,y){var M=s();return a[M]={type:"inline",expression:y},M}),F}var k=i.listitem;i.listitem=function(F){return k(_(F))};var H=i.paragraph;i.paragraph=function(F){return H(_(F))};var z=i.tablecell;i.tablecell=function(F,p){return z(_(F),p)},i.code=function(F,p,y){var M=(p||"").match(/\S*/)[0];return M?["latex","katex","math"].indexOf(M)>=0?"

    ".concat(F,"

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

    [TOC]

    ",u()),C()),en=en.replace(/(__special_katext_id_\d+__)/g,function(mr,ar){var gr=Un[ar],fi=gr.type,Jr=gr.expression;return Object(pe.renderToString)(Ar(Jr)||"",{displayMode:fi==="block",throwOnError:!1,output:"html"})}),en=en.replace(/▁/g,"\u2581\u2581\u2581"),g(),me){var _n=document.createElement("div");return _n.innerHTML=en,_n.innerText}return setTimeout(function(){return Kn()},500),en},[qn]),un=Object(L.useRef)();v.WebkitLineClamp=$e,$e&&(hn=Object(U.a)(Object(U.a)({},hn),v));function jn(yn){var mn=yn.target;if(mn.tagName.toUpperCase()==="IMG"){if(jt){var Ln=mn.getAttribute("src");Te(Ln),Nt("image")}}else if(mn.tagName.toUpperCase()==="A"){var en=mn.getAttribute("href");if(en.indexOf("office")>-1)yn.preventDefault(),Te(en),Nt("office");else if(en.indexOf("application/pdf")>-1)yn.preventDefault(),Te(en),Nt("pdf");else if(en.indexOf("text/html")>-1)yn.preventDefault(),Te(en),Nt("html");else if(en.startsWith("#")){yn.preventDefault();var Un=document.getElementById(en.replace("#",""));Un&&Un.scrollIntoView(!0)}}}var Kn=function(){var mn,Ln=(mn=un.current)===null||mn===void 0?void 0:mn.querySelectorAll("video");Ln==null||Ln.forEach(function(en){if(en.oncontextmenu=function(){return!1},en.src.indexOf(".m3u8")>-1&&!en.canPlayType("application/vnd.apple.mpegurl")){if(te.a.isSupported()){var Un=new te.a;Un.loadSource(en.src),Un.attachMedia(en)}}})};Object(L.useEffect)(function(){if(un.current&&Sn&&(Sn.match(fr)&&window.PR.prettyPrint()),un.current)return un.current.addEventListener("click",jn),function(){un.current.removeEventListener("click",jn),g(),C()}},[Sn,un.current,jn]);var ir=function(mn){if(!Q)return;mn.target.nodeName==="IMG"?(xn.current.style.zIndex=1,xn.current.style.display="flex",xn.current.style.width=mn.target.clientWidth+"px",xn.current.style.height=mn.target.clientHeight+"px",xn.current.style.top=mn.target.offsetTop+"px",xn.current.style.left=mn.target.offsetLeft+"px",Rr.current.src=mn.target.getAttribute("src")):xn.current.style.display="none"};return x.a.createElement("div",{style:{position:"relative"}},x.a.createElement("div",{ref:un,style:Object(U.a)({},hn),className:"".concat(W||""," markdown-body ").concat(Hn.a.mdBody),onMouseOver:ir,dangerouslySetInnerHTML:{__html:Sn}}),x.a.createElement("div",{ref:xn,className:Hn.a.button},x.a.createElement(Y.a,null,x.a.createElement($.a,{onClick:function(){return Xt()}},"\u88C1\u526A"),x.a.createElement($.a,{onClick:function(){return Dn()}},"\u7F16\u8F91"))),x.a.createElement("img",{ref:Rr,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),x.a.createElement(ye.a,{close:!0,data:_t,type:_t!=null&&_t.length?Ot:"",style:Object(U.a)({},pr),onClose:function(){return Te("")}}))}},"9VGf":function(at,Xe,V){"use strict";V.d(Xe,"a",function(){return D});var oe=V("q1tI"),Y=V.n(oe);function D($,U){var I=Object(oe.useRef)();Object(oe.useEffect)(function(){I.current=$}),Object(oe.useEffect)(function(){function K(){I.current()}if(U!==null){var N=setInterval(K,U);return function(){return clearInterval(N)}}},[U])}},"A+k2":function(at,Xe,V){at.exports={tabs:"tabs___2hYAP",active:"active___2Xkwd"}},Bd2K:function(at,Xe,V){(function(oe){oe(V("VrN/"),V("osHv"))})(function(oe){oe.defineOption("autoCloseTags",!1,function(O,L,x){if(x!=oe.Init&&x&&O.removeKeyMap("autoCloseTags"),!L)return;var A={name:"autoCloseTags"};(typeof L!="object"||L.whenClosing!==!1)&&(A["'/'"]=function(P){return I(P)}),(typeof L!="object"||L.whenOpening!==!1)&&(A["'>'"]=function(P){return $(P)}),O.addKeyMap(A)});var Y=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],D=["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 $(O){if(O.getOption("disableInput"))return oe.Pass;for(var L=O.listSelections(),x=[],A=O.getOption("autoCloseTags"),P=0;Pw.ch&&(i=i.slice(0,i.length-S.end+w.ch));var m=i.toLowerCase();if(!i||S.type=="string"&&(S.end!=w.ch||!/[\"\']/.test(S.string.charAt(S.string.length-1))||S.string.length==1)||S.type=="tag"&&l.close||S.string.indexOf("/")==w.ch-S.start-1||C&&K(C,m)>-1||N(O,T.mode.xmlCurrentContext&&T.mode.xmlCurrentContext(h)||[],i,w,!0))return oe.Pass;var u=typeof A=="object"&&A.emptyTags;if(u&&K(u,i)>-1){x[P]={text:"/>",newPos:oe.Pos(w.line,w.ch+2)};continue}var E=v&&K(v,m)>-1;x[P]={indent:E,text:">"+(E?` `:"")+"",newPos:E?oe.Pos(w.line+1,0):oe.Pos(w.line,w.ch+1)}}for(var d=typeof A=="object"&&A.dontIndentOnAutoClose,P=L.length-1;P>=0;P--){var f=x[P];O.replaceRange(f.text,L[P].head,L[P].anchor,"+insert");var s=O.listSelections().slice(0);s[P]={head:f.newPos,anchor:f.newPos},O.setSelections(s),!d&&f.indent&&(O.indentLine(f.newPos.line,null,!0),O.indentLine(f.newPos.line+1,null,!0))}}function U(O,L){for(var x=O.listSelections(),A=[],P=L?"/":""&&(C+=">"),A[T]=C}if(O.replaceSelections(A),x=O.listSelections(),!S)for(var T=0;T=0&&L[h]==x;h--)++T;A=S.to;for(var h=1;h0){for(var L=0;L1&&arguments[1]!==void 0?arguments[1]:"",L=[],x=0;xxe.length)&&(fe=xe.length);for(var be=0,ne=new Array(fe);be=xe.length?{done:!0}:{done:!1,value:xe[ne++]}}}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 be=xe[Symbol.iterator](),be.next.bind(be)}function I(xe,fe){return fe={exports:{}},xe(fe,fe.exports),fe.exports}var K=I(function(xe){function fe(){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 be(ne){xe.exports.defaults=ne}xe.exports={defaults:fe(),getDefaults:fe,changeDefaults:be}}),N=K.defaults,O=K.getDefaults,L=K.changeDefaults,x=/[&<>"']/,A=/[&<>"']/g,P=/[<>"']|&(?!#?\w+;)/,w=/[<>"']|&(?!#?\w+;)/g,S={"&":"&","<":"<",">":">",'"':""","'":"'"},T=function(fe){return S[fe]};function h(xe,fe){if(fe){if(x.test(xe))return xe.replace(A,T)}else if(P.test(xe))return xe.replace(w,T);return xe}var l=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function i(xe){return xe.replace(l,function(fe,be){return be=be.toLowerCase(),be==="colon"?":":be.charAt(0)==="#"?be.charAt(1)==="x"?String.fromCharCode(parseInt(be.substring(2),16)):String.fromCharCode(+be.substring(1)):""})}var c=/(^|[^\[])\^/g;function C(xe,fe){xe=xe.source||xe,fe=fe||"";var be={replace:function(re,ae){return ae=ae.source||ae,ae=ae.replace(c,"$1"),xe=xe.replace(re,ae),be},getRegex:function(){return new RegExp(xe,fe)}};return be}var v=/[^\w:]/g,m=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function u(xe,fe,be){if(xe){var ne;try{ne=decodeURIComponent(i(be)).replace(v,"").toLowerCase()}catch(re){return null}if(ne.indexOf("javascript:")===0||ne.indexOf("vbscript:")===0||ne.indexOf("data:")===0)return null}fe&&!m.test(be)&&(be=a(fe,be));try{be=encodeURI(be).replace(/%25/g,"%")}catch(re){return null}return be}var E={},d=/^[^:]+:\/*[^/]*$/,f=/^([^:]+:)[\s\S]*$/,s=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(xe,fe){E[" "+xe]||(d.test(xe)?E[" "+xe]=xe+"/":E[" "+xe]=k(xe,"/",!0)),xe=E[" "+xe];var be=xe.indexOf(":")===-1;return fe.substring(0,2)==="//"?be?fe:xe.replace(f,"$1")+fe:fe.charAt(0)==="/"?be?fe:xe.replace(s,"$1")+fe:xe+fe}var b={exec:function(){}};function g(xe){for(var fe=1,be,ne;fe=0&&ue[Le]==="\\";)we=!we;return we?"|":" |"}),ne=be.split(/ \|/),re=0;if(ne.length>fe)ne.splice(fe);else for(;ne.length=ne.length?re.slice(ne.length):re}).join(` `)}var _e=function(){function xe(be){this.options=be||G}var fe=xe.prototype;return fe.space=function(ne){var re=this.rules.block.newline.exec(ne);if(re)return re[0].length>1?{type:"space",raw:re[0]}:{raw:` `}},fe.code=function(ne,re){var ae=this.rules.block.code.exec(ne);if(ae){var de=re[re.length-1];if(de&&de.type==="paragraph")return{raw:ae[0],text:ae[0].trimRight()};var ue=ae[0].replace(/^ {4}/gm,"");return{type:"code",raw:ae[0],codeBlockStyle:"indented",text:this.options.pedantic?ue:B(ue,` `)}}},fe.fences=function(ne){var re=this.rules.block.fences.exec(ne);if(re){var ae=re[0],de=Ce(ae,re[3]||"");return{type:"code",raw:ae,lang:re[2]?re[2].trim():re[2],text:de}}},fe.heading=function(ne){var re=this.rules.block.heading.exec(ne);if(re)return{type:"heading",raw:re[0],depth:re[1].length,text:re[2]}},fe.nptable=function(ne){var re=this.rules.block.nptable.exec(ne);if(re){var ae={type:"table",header:te(re[1].replace(/^ *| *\| *$/g,"")),align:re[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:re[3]?re[3].replace(/\n$/,"").split(` `):[],raw:re[0]};if(ae.header.length===ae.align.length){var de=ae.align.length,ue;for(ue=0;ue ?/gm,"");return{type:"blockquote",raw:re[0],text:ae}}},fe.list=function(ne){var re=this.rules.block.list.exec(ne);if(re){for(var ae=re[0],de=re[2],ue=de.length>1,we=de[de.length-1]===")",Le={type:"list",raw:ae,ordered:ue,start:ue?+de.slice(0,-1):"",loose:!1,items:[]},rt=re[0].match(this.rules.block.item),je=!1,Ye,Dt,ut,mt,zt,Je,Kt,sn=rt.length,Bt=0;Bt1||this.options.smartLists&&ut!==de)&&(mt=rt.slice(Bt+1).join(` `),Le.raw=Le.raw.substring(0,Le.raw.length-mt.length),Bt=sn-1)),zt=je||/\n\n(?!\s*$)/.test(Ye),Bt!==sn-1&&(je=Ye.charAt(Ye.length-1)===` `,zt||(zt=je)),zt&&(Le.loose=!0),Je=/^\[[ xX]\] /.test(Ye),Kt=void 0,Je&&(Kt=Ye[1]!==" ",Ye=Ye.replace(/^\[[ xX]\] +/,"")),Le.items.push({type:"list_item",raw:ae,task:Je,checked:Kt,loose:zt,text:Ye});return Le}},fe.html=function(ne){var re=this.rules.block.html.exec(ne);if(re)return{type:this.options.sanitize?"paragraph":"html",raw:re[0],pre:!this.options.sanitizer&&(re[1]==="pre"||re[1]==="script"||re[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(re[0]):ce(re[0]):re[0]}},fe.def=function(ne){var re=this.rules.block.def.exec(ne);if(re){re[3]&&(re[3]=re[3].substring(1,re[3].length-1));var ae=re[1].toLowerCase().replace(/\s+/g," ");return{tag:ae,raw:re[0],href:re[2],title:re[3]}}},fe.table=function(ne){var re=this.rules.block.table.exec(ne);if(re){var ae={type:"table",header:te(re[1].replace(/^ *| *\| *$/g,"")),align:re[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:re[3]?re[3].replace(/\n$/,"").split(` `):[]};if(ae.header.length===ae.align.length){ae.raw=re[0];var de=ae.align.length,ue;for(ue=0;ue/i.test(de[0])&&(re=!1),!ae&&/^<(pre|code|kbd|script)(\s|>)/i.test(de[0])?ae=!0:ae&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(de[0])&&(ae=!1),{type:this.options.sanitize?"text":"html",raw:de[0],inLink:re,inRawBlock:ae,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(de[0]):ce(de[0]):de[0]}},fe.link=function(ne){var re=this.rules.inline.link.exec(ne);if(re){var ae=pe(re[2],"()");if(ae>-1){var de=re[0].indexOf("!")===0?5:4,ue=de+re[1].length+ae;re[2]=re[2].substring(0,ae),re[0]=re[0].substring(0,ue).trim(),re[3]=""}var we=re[2],Le="";if(this.options.pedantic){var rt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(we);rt?(we=rt[1],Le=rt[3]):Le=""}else Le=re[3]?re[3].slice(1,-1):"";we=we.trim().replace(/^<([\s\S]*)>$/,"$1");var je=ye(re,{href:we&&we.replace(this.rules.inline._escapes,"$1"),title:Le&&Le.replace(this.rules.inline._escapes,"$1")},re[0]);return je}},fe.reflink=function(ne,re){var ae;if((ae=this.rules.inline.reflink.exec(ne))||(ae=this.rules.inline.nolink.exec(ne))){var de=(ae[2]||ae[1]).replace(/\s+/g," ");if(de=re[de.toLowerCase()],!de||!de.href){var ue=ae[0].charAt(0);return{type:"text",raw:ue,text:ue}}var we=ye(ae,de,ae[0]);return we}},fe.strong=function(ne,re,ae){ae===void 0&&(ae="");var de=this.rules.inline.strong.start.exec(ne);if(de&&(!de[1]||de[1]&&(ae===""||this.rules.inline.punctuation.exec(ae)))){re=re.slice(-1*ne.length);var ue=de[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ue.lastIndex=0;for(var we;(de=ue.exec(re))!=null;)if(we=this.rules.inline.strong.middle.exec(re.slice(0,de.index+3)),we)return{type:"strong",raw:ne.slice(0,we[0].length),text:ne.slice(2,we[0].length-2)}}},fe.em=function(ne,re,ae){ae===void 0&&(ae="");var de=this.rules.inline.em.start.exec(ne);if(de&&(!de[1]||de[1]&&(ae===""||this.rules.inline.punctuation.exec(ae)))){re=re.slice(-1*ne.length);var ue=de[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ue.lastIndex=0;for(var we;(de=ue.exec(re))!=null;)if(we=this.rules.inline.em.middle.exec(re.slice(0,de.index+2)),we)return{type:"em",raw:ne.slice(0,we[0].length),text:ne.slice(1,we[0].length-1)}}},fe.codespan=function(ne){var re=this.rules.inline.code.exec(ne);if(re){var ae=re[2].replace(/\n/g," "),de=/[^ ]/.test(ae),ue=ae.startsWith(" ")&&ae.endsWith(" ");return de&&ue&&(ae=ae.substring(1,ae.length-1)),ae=ce(ae,!0),{type:"codespan",raw:re[0],text:ae}}},fe.br=function(ne){var re=this.rules.inline.br.exec(ne);if(re)return{type:"br",raw:re[0]}},fe.del=function(ne){var re=this.rules.inline.del.exec(ne);if(re)return{type:"del",raw:re[0],text:re[1]}},fe.autolink=function(ne,re){var ae=this.rules.inline.autolink.exec(ne);if(ae){var de,ue;return ae[2]==="@"?(de=ce(this.options.mangle?re(ae[1]):ae[1]),ue="mailto:"+de):(de=ce(ae[1]),ue=de),{type:"link",raw:ae[0],text:de,href:ue,tokens:[{type:"text",raw:de,text:de}]}}},fe.url=function(ne,re){var ae;if(ae=this.rules.inline.url.exec(ne)){var de,ue;if(ae[2]==="@")de=ce(this.options.mangle?re(ae[0]):ae[0]),ue="mailto:"+de;else{var we;do we=ae[0],ae[0]=this.rules.inline._backpedal.exec(ae[0])[0];while(we!==ae[0]);de=ce(ae[0]),ae[1]==="www."?ue="http://"+de:ue=de}return{type:"link",raw:ae[0],text:de,href:ue,tokens:[{type:"text",raw:de,text:de}]}}},fe.inlineText=function(ne,re,ae){var de=this.rules.inline.text.exec(ne);if(de){var ue;return re?ue=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(de[0]):ce(de[0]):de[0]:ue=ce(this.options.smartypants?ae(de[0]):de[0]),{type:"text",raw:de[0],text:ue}}},xe}(),le=Z.noopTest,se=Z.edit,ge=Z.merge,ie={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:[^\\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:le,table:le,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ie._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ie._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ie.def=se(ie.def).replace("label",ie._label).replace("title",ie._title).getRegex(),ie.bullet=/(?:[*+-]|\d{1,9}[.)])/,ie.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ie.item=se(ie.item,"gm").replace(/bull/g,ie.bullet).getRegex(),ie.list=se(ie.list).replace(/bull/g,ie.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ie.def.source+")").getRegex(),ie._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ie._comment=//,ie.html=se(ie.html,"i").replace("comment",ie._comment).replace("tag",ie._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ie.paragraph=se(ie._paragraph).replace("hr",ie.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|!--)").replace("tag",ie._tag).getRegex(),ie.blockquote=se(ie.blockquote).replace("paragraph",ie.paragraph).getRegex(),ie.normal=ge({},ie),ie.gfm=ge({},ie.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n *([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n *\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),ie.gfm.nptable=se(ie.gfm.nptable).replace("hr",ie.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|!--)").replace("tag",ie._tag).getRegex(),ie.gfm.table=se(ie.gfm.table).replace("hr",ie.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|!--)").replace("tag",ie._tag).getRegex(),ie.pedantic=ge({},ie.normal,{html:se(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ie._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:le,paragraph:se(ie.normal._paragraph).replace("hr",ie.hr).replace("heading",` *#{1,6} *[^ ]`).replace("lheading",ie.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var q={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:le,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:le,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~",q.punctuation=se(q.punctuation).replace(/punctuation/g,q._punctuation).getRegex(),q._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",q._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",q.em.start=se(q.em.start).replace(/punctuation/g,q._punctuation).getRegex(),q.em.middle=se(q.em.middle).replace(/punctuation/g,q._punctuation).replace(/overlapSkip/g,q._overlapSkip).getRegex(),q.em.endAst=se(q.em.endAst,"g").replace(/punctuation/g,q._punctuation).getRegex(),q.em.endUnd=se(q.em.endUnd,"g").replace(/punctuation/g,q._punctuation).getRegex(),q.strong.start=se(q.strong.start).replace(/punctuation/g,q._punctuation).getRegex(),q.strong.middle=se(q.strong.middle).replace(/punctuation/g,q._punctuation).replace(/blockSkip/g,q._blockSkip).getRegex(),q.strong.endAst=se(q.strong.endAst,"g").replace(/punctuation/g,q._punctuation).getRegex(),q.strong.endUnd=se(q.strong.endUnd,"g").replace(/punctuation/g,q._punctuation).getRegex(),q.blockSkip=se(q._blockSkip,"g").getRegex(),q.overlapSkip=se(q._overlapSkip,"g").getRegex(),q._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,q._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,q._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,q.autolink=se(q.autolink).replace("scheme",q._scheme).replace("email",q._email).getRegex(),q._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,q.tag=se(q.tag).replace("comment",ie._comment).replace("attribute",q._attribute).getRegex(),q._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,q._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,q._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,q.link=se(q.link).replace("label",q._label).replace("href",q._href).replace("title",q._title).getRegex(),q.reflink=se(q.reflink).replace("label",q._label).getRegex(),q.reflinkSearch=se(q.reflinkSearch,"g").replace("reflink",q.reflink).replace("nolink",q.nolink).getRegex(),q.normal=ge({},q),q.pedantic=ge({},q.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:se(/^!?\[(label)\]\((.*?)\)/).replace("label",q._label).getRegex(),reflink:se(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",q._label).getRegex()}),q.gfm=ge({},q.normal,{escape:se(q.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\.5&&(ne="x"+ne.toString(16)),fe+="&#"+ne+";";return fe}var Pe=function(){function xe(be){this.tokens=[],this.tokens.links=Object.create(null),this.options=be||Me,this.options.tokenizer=this.options.tokenizer||new _e,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var ne={block:Ne.normal,inline:De.normal};this.options.pedantic?(ne.block=Ne.pedantic,ne.inline=De.pedantic):this.options.gfm&&(ne.block=Ne.gfm,this.options.breaks?ne.inline=De.breaks:ne.inline=De.gfm),this.tokenizer.rules=ne}xe.lex=function(ne,re){var ae=new xe(re);return ae.lex(ne)};var fe=xe.prototype;return fe.lex=function(ne){return ne=ne.replace(/\r\n|\r/g,` `).replace(/\t/g," "),this.blockTokens(ne,this.tokens,!0),this.inline(this.tokens),this.tokens},fe.blockTokens=function(ne,re,ae){re===void 0&&(re=[]),ae===void 0&&(ae=!0),ne=ne.replace(/^ +$/gm,"");for(var de,ue,we,Le;ne;){if(de=this.tokenizer.space(ne)){ne=ne.substring(de.raw.length),de.type&&re.push(de);continue}if(de=this.tokenizer.code(ne,re)){ne=ne.substring(de.raw.length),de.type?re.push(de):(Le=re[re.length-1],Le.raw+=` `+de.raw,Le.text+=` `+de.text);continue}if(de=this.tokenizer.fences(ne)){ne=ne.substring(de.raw.length),re.push(de);continue}if(de=this.tokenizer.heading(ne)){ne=ne.substring(de.raw.length),re.push(de);continue}if(de=this.tokenizer.nptable(ne)){ne=ne.substring(de.raw.length),re.push(de);continue}if(de=this.tokenizer.hr(ne)){ne=ne.substring(de.raw.length),re.push(de);continue}if(de=this.tokenizer.blockquote(ne)){ne=ne.substring(de.raw.length),de.tokens=this.blockTokens(de.text,[],ae),re.push(de);continue}if(de=this.tokenizer.list(ne)){for(ne=ne.substring(de.raw.length),we=de.items.length,ue=0;ue0)for(;(rt=this.tokenizer.rules.inline.reflinkSearch.exec(Le))!=null;)je.includes(rt[0].slice(rt[0].lastIndexOf("[")+1,-1))&&(Le=Le.slice(0,rt.index)+"["+"a".repeat(rt[0].length-2)+"]"+Le.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(rt=this.tokenizer.rules.inline.blockSkip.exec(Le))!=null;)Le=Le.slice(0,rt.index)+"["+"a".repeat(rt[0].length-2)+"]"+Le.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;ne;){if(we=this.tokenizer.escape(ne)){ne=ne.substring(we.raw.length),re.push(we);continue}if(we=this.tokenizer.tag(ne,ae,de)){ne=ne.substring(we.raw.length),ae=we.inLink,de=we.inRawBlock,re.push(we);continue}if(we=this.tokenizer.link(ne)){ne=ne.substring(we.raw.length),we.type==="link"&&(we.tokens=this.inlineTokens(we.text,[],!0,de)),re.push(we);continue}if(we=this.tokenizer.reflink(ne,this.tokens.links)){ne=ne.substring(we.raw.length),we.type==="link"&&(we.tokens=this.inlineTokens(we.text,[],!0,de)),re.push(we);continue}if(we=this.tokenizer.strong(ne,Le,ue)){ne=ne.substring(we.raw.length),we.tokens=this.inlineTokens(we.text,[],ae,de),re.push(we);continue}if(we=this.tokenizer.em(ne,Le,ue)){ne=ne.substring(we.raw.length),we.tokens=this.inlineTokens(we.text,[],ae,de),re.push(we);continue}if(we=this.tokenizer.codespan(ne)){ne=ne.substring(we.raw.length),re.push(we);continue}if(we=this.tokenizer.br(ne)){ne=ne.substring(we.raw.length),re.push(we);continue}if(we=this.tokenizer.del(ne)){ne=ne.substring(we.raw.length),we.tokens=this.inlineTokens(we.text,[],ae,de),re.push(we);continue}if(we=this.tokenizer.autolink(ne,Ae)){ne=ne.substring(we.raw.length),re.push(we);continue}if(!ae&&(we=this.tokenizer.url(ne,Ae))){ne=ne.substring(we.raw.length),re.push(we);continue}if(we=this.tokenizer.inlineText(ne,de,Be)){ne=ne.substring(we.raw.length),ue=we.raw.slice(-1),re.push(we);continue}if(ne){var Ye="Infinite loop on byte: "+ne.charCodeAt(0);if(this.options.silent){console.error(Ye);break}else throw new Error(Ye)}}return re},Y(xe,null,[{key:"rules",get:function(){return{block:Ne,inline:De}}}]),xe}(),Fe=K.defaults,ze=Z.cleanUrl,qe=Z.escape,He=function(){function xe(be){this.options=be||Fe}var fe=xe.prototype;return fe.code=function(ne,re,ae){var de=(re||"").match(/\S*/)[0];if(this.options.highlight){var ue=this.options.highlight(ne,de);ue!=null&&ue!==ne&&(ae=!0,ne=ue)}return de?'
    '+(ae?ne:qe(ne,!0))+`
    `:"
    "+(ae?ne:qe(ne,!0))+`
    `},fe.blockquote=function(ne){return`
    `+ne+`
    `},fe.html=function(ne){return ne},fe.heading=function(ne,re,ae,de){return this.options.headerIds?"'+ne+" `:""+ne+" `},fe.hr=function(){return this.options.xhtml?`
    `:`
    `},fe.list=function(ne,re,ae){var de=re?"ol":"ul",ue=re&&ae!==1?' start="'+ae+'"':"";return"<"+de+ue+`> `+ne+" `},fe.listitem=function(ne){return"
  • "+ne+`
  • `},fe.checkbox=function(ne){return" "},fe.paragraph=function(ne){return"

    "+ne+`

    `},fe.table=function(ne,re){return re&&(re=""+re+""),` `+ne+` `+re+`
    `},fe.tablerow=function(ne){return` `+ne+` `},fe.tablecell=function(ne,re){var ae=re.header?"th":"td",de=re.align?"<"+ae+' align="'+re.align+'">':"<"+ae+">";return de+ne+" `},fe.strong=function(ne){return""+ne+""},fe.em=function(ne){return""+ne+""},fe.codespan=function(ne){return""+ne+""},fe.br=function(){return this.options.xhtml?"
    ":"
    "},fe.del=function(ne){return""+ne+""},fe.link=function(ne,re,ae){if(ne=ze(this.options.sanitize,this.options.baseUrl,ne),ne===null)return ae;var de='",de},fe.image=function(ne,re,ae){if(ne=ze(this.options.sanitize,this.options.baseUrl,ne),ne===null)return ae;var de=''+ae+'":">",de},fe.text=function(ne){return ne},xe}(),Oe=function(){function xe(){}var fe=xe.prototype;return fe.strong=function(ne){return ne},fe.em=function(ne){return ne},fe.codespan=function(ne){return ne},fe.del=function(ne){return ne},fe.html=function(ne){return ne},fe.text=function(ne){return ne},fe.link=function(ne,re,ae){return""+ae},fe.image=function(ne,re,ae){return""+ae},fe.br=function(){return""},xe}(),lt=function(){function xe(){this.seen={}}var fe=xe.prototype;return fe.slug=function(ne){var re=ne.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(re)){var ae=re;do this.seen[ae]++,re=ae+"-"+this.seen[ae];while(this.seen.hasOwnProperty(re))}return this.seen[re]=0,re},xe}(),tt=K.defaults,ft=Z.unescape,nt=function(){function xe(be){this.options=be||tt,this.options.renderer=this.options.renderer||new He,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Oe,this.slugger=new lt}xe.parse=function(ne,re){var ae=new xe(re);return ae.parse(ne)};var fe=xe.prototype;return fe.parse=function(ne,re){re===void 0&&(re=!0);var ae="",de,ue,we,Le,rt,je,Ye,Dt,ut,mt,zt,Je,Kt,sn,Bt,an,Qt,ot,Ft=ne.length;for(de=0;de0&&Bt.tokens[0].type==="text"?(Bt.tokens[0].text=ot+" "+Bt.tokens[0].text,Bt.tokens[0].tokens&&Bt.tokens[0].tokens.length>0&&Bt.tokens[0].tokens[0].type==="text"&&(Bt.tokens[0].tokens[0].text=ot+" "+Bt.tokens[0].tokens[0].text)):Bt.tokens.unshift({type:"text",text:ot}):sn+=ot),sn+=this.parse(Bt.tokens,Kt),ut+=this.renderer.listitem(sn,Qt,an);ae+=this.renderer.list(ut,zt,Je);continue}case"html":{ae+=this.renderer.html(mt.text);continue}case"paragraph":{ae+=this.renderer.paragraph(this.parseInline(mt.tokens));continue}case"text":{for(ut=mt.tokens?this.parseInline(mt.tokens):mt.text;de+1An error occurred:

    "+yt(we.message+"",!0)+"
    ";throw we}}Ue.options=Ue.setOptions=function(xe){return St(Ue.defaults,xe),Pt(Ue.defaults),Ue},Ue.getDefaults=ke,Ue.defaults=Tt,Ue.use=function(xe){var fe=St({},xe);if(xe.renderer&&function(){var ne=Ue.defaults.renderer||new He,re=function(ue){var we=ne[ue];ne[ue]=function(){for(var Le=arguments.length,rt=new Array(Le),je=0;jeot.length){var Lt=Object(Oe.xor)(Mt,ot);console.log(Lt,"newLevel"),It=It.filter(function(st){return!Lt.includes(st)})}rt(It),Je(ot.length===(je==null||((xt=je.tag_disciplines)===null||xt===void 0)?void 0:xt.length))},sn=function(ot){var Ft,xt=je==null||((Ft=je.tag_disciplines)===null||Ft===void 0)?void 0:Ft.map(function(kt){return kt.id});rt(ot.target.checked?Object(Oe.uniq)([].concat(Object(Z.a)(Le),Object(Z.a)(xt))):Le==null?void 0:Le.filter(function(kt){return!xt.includes(kt)})),Je(ot.target.checked)};console.log(je,"options");var Bt=function(){var ot,Ft,xt=(je==null?void 0:je.tag_disciplines)||[];if(Ye){var kt;xt=(kt=xt)===null||kt===void 0?void 0:kt.filter(function(Mt){var It;return Mt==null||((It=Mt.name)===null||It===void 0)?void 0:It.includes(Ye)})}return xt=(ot=xt)===null||ot===void 0?void 0:ot.map(function(Mt){return Object(L.a)(Object(L.a)({},Mt),{},{label:"".concat(Mt.name,"(".concat(Mt==null?void 0:Mt.item_count,")")),value:Mt.id})}),xt=(Ft=xt)===null||Ft===void 0?void 0:Ft.filter(function(Mt){return Mt.item_count!==0}),xt},an=function(){var ot=!1;if(!Ye)ot=!0;else{var Ft;(Ft=je.tag_disciplines)===null||Ft===void 0||Ft.forEach(function(xt){if(!ot){var kt;ot=((kt=xt.name)===null||kt===void 0?void 0:kt.includes(Ye))&&xt.item_count!==0}})}return ot};return(je==null?void 0:je.item_count)===0||!an()?i.a.createElement(i.a.Fragment,null):i.a.createElement("div",{className:He.a.cInput},i.a.createElement("div",{className:He.a.cl},i.a.createElement(g.a,{checked:zt,onChange:sn},i.a.createElement("span",{className:He.a.box},i.a.createElement("span",{className:"font14 c-light-primary"},i.a.createElement("span",{title:je==null?void 0:je.name,className:He.a.box1}," ",je==null?void 0:je.name),i.a.createElement("span",null," ","(".concat(je==null?void 0:je.item_count,")"))),i.a.createElement("i",{className:"iconfont icon-lujing font12 ml5"})))),i.a.createElement("div",{className:He.a.cr},i.a.createElement(lt,{options:Bt(),value:Le,onChange:Kt})))},ft=tt,nt=V("ErOA"),St=V("ozfa"),ht=V("MJZm"),yt=V("0Owb"),ke=V("tmPe"),Pt=V.n(ke),Tt=function(ue){var we=ue.value,Le=ue.onChange,rt=ue.defaultValue,je=ue.treeData,Ye=je===void 0?[]:je,Dt=Object(ze.a)(ue,["value","onChange","defaultValue","treeData"]);return i.a.createElement("div",{className:Pt.a.customTree},i.a.createElement(ht.a,Object(yt.a)({multiple:!0,showIcon:!0,selectedKeys:we,defaultExpandedKeys:rt,treeData:Ye,onSelect:Le},Dt)))},Ue=Tt,Ze=V("sbIO"),xe=S.a.Search,fe=function(ue){var we,Le=ue.formValue,rt=ue.setFatherTabs,je=ue.tabs,Ye=ue.editData,Dt=ue.dispatch,ut=Object(c.i)().id,mt=Object(l.useState)(["mine"]),zt=Object(P.a)(mt,2),Je=zt[0],Kt=zt[1],sn=Object(l.useState)(!0),Bt=Object(P.a)(sn,2),an=Bt[0],Qt=Bt[1],ot=Object(l.useState)(!1),Ft=Object(P.a)(ot,2),xt=Ft[0],kt=Ft[1],Mt=Object(l.useState)(!1),It=Object(P.a)(Mt,2),Lt=It[0],st=It[1],Ve=Object(l.useState)(""),ln=Object(P.a)(Ve,2),$t=ln[0],cn=ln[1],qt=Object(l.useState)(!1),En=Object(P.a)(qt,2),on=En[0],pt=En[1],Ge=Object(l.useState)(!1),wt=Object(P.a)(Ge,2),Hn=wt[0],fr=wt[1],Ar=Object(l.useState)({}),Fn=Object(P.a)(Ar,2),F=Fn[0],p=Fn[1],y=Object(l.useState)([]),M=Object(P.a)(y,2),Q=M[0],W=M[1],me=Object(l.useState)([]),$e=Object(P.a)(me,2),ct=$e[0],jt=$e[1],Qe=Object(l.useState)([]),Vt=Object(P.a)(Qe,2),hn=Vt[0],Rn=Vt[1],pr=Object(l.useState)([]),qn=Object(P.a)(pr,2),xn=qn[0],Rr=qn[1],qr=Object(l.useState)(null),Vn=Object(P.a)(qr,2),_t=Vn[0],Te=Vn[1],it=Object(l.useRef)([]),Ht=Object(l.useState)(!1),Ot=Object(P.a)(Ht,2),Nt=Ot[0],Xt=Ot[1],Dn=Object(l.useState)([]),Sn=Object(P.a)(Dn,2),un=Sn[0],jn=Sn[1],Kn=Object(l.useState)([0]),ir=Object(P.a)(Kn,2),yn=ir[0],mn=ir[1],Ln=Object(l.useState)([]),en=Object(P.a)(Ln,2),Un=en[0],_n=en[1],mr=Object(l.useRef)([]),ar=Object(l.useState)(!1),gr=Object(P.a)(ar,2),fi=gr[0],Jr=gr[1],Ti=Object(l.useState)([]),ei=Object(P.a)(Ti,2),On=ei[0],ti=ei[1],Xr=Object(l.useState)([]),pi=Object(P.a)(Xr,2),ni=pi[0],ui=pi[1],si=Object(l.useRef)([]),Gt=Object(l.useState)([]),nn=Object(P.a)(Gt,2),Jt=nn[0],fn=nn[1],bn=Object(l.useState)(!1),kn=Object(P.a)(bn,2),vn=kn[0],er=kn[1],vr=Object(l.useRef)([]),gn=Object(l.useState)(0),Qr=Object(P.a)(gn,2),Tn=Qr[0],or=Qr[1],tr=Un==null?void 0:Un.filter(function(bt){return un==null?void 0:un.includes(bt.id)}),Gr=ni==null?void 0:ni.filter(function(bt){return On==null?void 0:On.includes(bt.id)});Object(l.useEffect)(function(){wi()},[]),Object(l.useEffect)(function(){return je===1&&(Dt({type:"globalSetting/onlyShowBackTopToggle",payload:!1}),Dt({type:"globalSetting/onlyShowBackTopIconToggle",payload:!1})),function(){Dt({type:"globalSetting/onlyShowBackTopToggle",payload:!0}),Dt({type:"globalSetting/onlyShowBackTopIconToggle",payload:!0})}},[je]),Object(l.useEffect)(function(){ut?Ye&&cr():(Fi(Je),mi(),Qt(!1))},[Ye]),Object(l.useEffect)(function(){$t&&Ja()},[$t]);var Ja=function(){var dt=null;ct==null||ct.forEach(function(We){var Ie;(Ie=We.sub_disciplines)===null||Ie===void 0||Ie.forEach(function(Et){var vt;(vt=Et.tag_disciplines)===null||vt===void 0||vt.forEach(function(Ct){var Zt,dn=((Zt=Ct.name)===null||Zt===void 0?void 0:Zt.includes($t))&&Ct.item_count!==0;dn&&!dt&&(dt=We.id)})})}),dt&&Te(dt)},Qa=function(dt){function We(Ie){var Et=Ie.children,vt=Array.isArray(Et)&&Et.length>0,Ct=Ie==null?void 0:Ie.group_id;return vr.current.push({name:Ie==null?void 0:Ie.name,id:Ct,count:Ie==null?void 0:Ie.count}),{title:i.a.createElement("div",{title:Ie==null?void 0:Ie.name,className:B.a.name},Ie==null?void 0:Ie.name,"\uFF08".concat(Ie==null?void 0:Ie.count,"\uFF09")),value:Ct,name:Ie==null?void 0:Ie.name,key:Ct,count:Ie==null?void 0:Ie.count,id:Ct,icon:i.a.createElement("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:vt?Et==null?void 0:Et.map(function(Zt){return We(Zt)}):[]}}return dt==null?void 0:dt.map(function(Ie){return We(Ie)})},wi=function(){var bt=Object(O.a)(h.a.mark(function dt(){var We,Ie;return h.a.wrap(function(vt){for(;;)switch(vt.prev=vt.next){case 0:return vt.next=2,Object(te.A)({});case 2:We=vt.sent,vr.current=[{id:0,name:"\u6839\u76EE\u5F55",count:We==null?void 0:We.root_count}],We!=null&&We.data&&(Ie=[{title:i.a.createElement("div",{title:"\u6839\u76EE\u5F55",className:B.a.name},"\u6839\u76EE\u5F55","\uFF08".concat((We==null?void 0:We.root_count)||0,"\uFF09")),value:0,id:0,key:0,count:We==null?void 0:We.root_count,name:"\u6839\u76EE\u5F55",icon:i.a.createElement("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:Qa(We.data||[])}],_n(vr.current),fn(Ie));case 5:case"end":return vt.stop()}},dt)}));return function(){return bt.apply(this,arguments)}}(),cr=function(){var bt=Object(O.a)(h.a.mark(function dt(){var We,Ie,Et,vt,Ct,Zt,dn,Mn,An,In,wn,nr,Gn,zn,yr,sr,Qn,br;return h.a.wrap(function(rn){for(;;)switch(rn.prev=rn.next){case 0:return In=Ye==null||((We=Ye.tag_disciplines)===null||We===void 0)?void 0:We.map(function(Cn){return Cn.tag_discipline_id}),wn=Ye==null||((Ie=Ye.groups)===null||Ie===void 0)?void 0:Ie.map(function(Cn){return Cn.id}),nr={source:Ye==null||((Et=Ye.examination_bank)===null||Et===void 0)?void 0:Et.source,group_ids:wn,tag_discipline_ids:In,teach_group_ids:Ye==null?void 0:Ye.teach_group_ids},rn.next=5,Object(nt.a)("/api/examination_intelligent_settings/form_paper.json",{method:"post",body:nr});case 5:if(Gn=rn.sent,!((Gn==null?void 0:Gn.status)===-1)){rn.next=8;break}return rn.abrupt("return");case 8:zn=Gn==null?void 0:Gn.filter(function(Cn){var Yn;return!!(Cn!=null&&(Yn=Cn.item_banks)!==null&&Yn!==void 0&&Yn.length)}),zn=zn.map(function(Cn){return Object(L.a)(Object(L.a)({},Cn),{},{scoreTotal:0,score:0,questionTotal:0})}),zn=(vt=zn)===null||vt===void 0?void 0:vt.map(function(Cn,Yn){var Er,lr,Mr;return Object(L.a)(Object(L.a)({},Cn),{},{score:(Ye==null||((Er=Ye.score_settings)===null||Er===void 0||((lr=Er.find(function(Ir){return Ir.item_type===(Cn==null?void 0:Cn.item_type)}))===null||lr===void 0))?void 0:lr.score)||0,item_banks:Cn==null||((Mr=Cn.item_banks)===null||Mr===void 0)?void 0:Mr.map(function(Ir){var Bn;return Object(L.a)(Object(L.a)({},Ir),{},{tag_disciplines:Ir==null||((Bn=Ir.tag_disciplines)===null||Bn===void 0)?void 0:Bn.map(function(Xn){var xr;return Object(L.a)(Object(L.a)({},Xn),{},{difficulties:Xn==null||((xr=Xn.difficulties)===null||xr===void 0)?void 0:xr.map(function(Pr){var _r=Ye==null?void 0:Ye.contents.find(function(Br){return Br.item_type===Cn.item_type&&Br.sub_discipline_id===Ir.sub_discipline_id&&Br.tag_discipline_id===Xn.tag_discipline_id&&Br.difficulty===Pr.difficulty});return _r?Object(L.a)(Object(L.a)({},Pr),{},{num:_r==null?void 0:_r.quanlity}):Object(L.a)({},Pr)})})})})})})}),yr=Ai(zn),sr=yr.panel,Qn=yr.score_num_item,zn=(Ct=zn)===null||Ct===void 0?void 0:Ct.map(function(Cn,Yn){var Er,lr=(sr==null||((Er=sr[Yn])===null||Er===void 0)?void 0:Er.reduce(function(Mr,Ir){return Mr+Ir},0))||0;return Object(L.a)(Object(L.a)({},Cn),{},{scoreTotal:lr*(Qn[Yn]||0),questionTotal:lr})}),br=[],Ye==null||((Zt=Ye.sort_by_item_type)===null||Zt===void 0)||Zt.forEach(function(Cn){var Yn=zn.find(function(Er){var lr,Mr=(lr=Ri.find(function(Ir){return Ir.type===(Er==null?void 0:Er.item_type)}))===null||lr===void 0?void 0:lr.name;return Mr===Cn});br.push(Yn)}),br=Object(Oe.compact)(br),Fi(Ye==null||((dn=Ye.examination_bank)===null||dn===void 0)?void 0:dn.source),mi(),Kt(Ye==null||((Mn=Ye.examination_bank)===null||Mn===void 0)?void 0:Mn.source),Rr(In),it.current=In,jn(wn),ti((Ye==null?void 0:Ye.teach_group_ids)||[]),or(Ye==null||((An=Ye.groups)===null||An===void 0)?void 0:An.map(function(Cn){return Cn.count}).reduce(function(Cn,Yn){return Cn+Yn},0)),mr.current=wn,mn(wn!=null&&wn.length?wn:[0]),W(Object(Oe.cloneDeep)(br)),Qt(!1);case 29:case"end":return rn.stop()}},dt)}));return function(){return bt.apply(this,arguments)}}(),Za=function(){var bt=Object(O.a)(h.a.mark(function dt(){var We;return h.a.wrap(function(Et){for(;;)switch(Et.prev=Et.next){case 0:We={source:Je,group_ids:un,tag_discipline_ids:xn,teach_group_ids:On},di(We),it.current=xn,pt(!1);case 4:case"end":return Et.stop()}},dt)}));return function(){return bt.apply(this,arguments)}}(),Fi=function(){var bt=Object(O.a)(h.a.mark(function dt(We){var Ie,Et,vt,Ct,Zt,dn;return h.a.wrap(function(An){for(;;)switch(An.prev=An.next){case 0:return An.next=2,Object(nt.a)("/api/disciplines.json",{method:"get",params:{source:"question",question_source:We}});case 2:vt=An.sent,Ct=[],vt==null||((Ie=vt.disciplines)===null||Ie===void 0)||Ie.forEach(function(In){var wn;In==null||((wn=In.sub_disciplines)===null||wn===void 0)||wn.forEach(function(nr){Ct=Ct.concat((nr==null?void 0:nr.tag_disciplines)||[])})}),Zt=null,dn=vt==null||((Et=vt.disciplines)===null||Et===void 0)?void 0:Et.map(function(In){var wn,nr=In==null||((wn=In.sub_disciplines)===null||wn===void 0)?void 0:wn.reduce(function(Gn,zn){return Gn+zn.item_count},0);return!Zt&&nr!==0&&(Zt=In.id),Object(L.a)(Object(L.a)({},In),{},{item_count:nr})}),console.log(dn,48767874),jt(dn),Rn(Ct),Te(Zt);case 11:case"end":return An.stop()}},dt)}));return function(We){return bt.apply(this,arguments)}}(),mi=function(){var bt=Object(O.a)(h.a.mark(function dt(){var We;return h.a.wrap(function(Et){for(;;)switch(Et.prev=Et.next){case 0:return Et.next=2,Object(nt.a)("/api/teach_groups.json",{method:"get",params:{is_random_exam:!0}});case 2:We=Et.sent,ui((We==null?void 0:We.groups)||[]);case 4:case"end":return Et.stop()}},dt)}));return function(){return bt.apply(this,arguments)}}(),di=function(){var bt=Object(O.a)(h.a.mark(function dt(We){var Ie,Et;return h.a.wrap(function(Ct){for(;;)switch(Ct.prev=Ct.next){case 0:return Qt(!0),Ct.next=3,Object(nt.a)("/api/examination_intelligent_settings/form_paper.json",{method:"post",body:We});case 3:Ie=Ct.sent,Et=Ie==null?void 0:Ie.filter(function(Zt){var dn;return!!(Zt!=null&&(dn=Zt.item_banks)!==null&&dn!==void 0&&dn.length)}),Et=Et.map(function(Zt){return Object(L.a)(Object(L.a)({},Zt),{},{scoreTotal:0,score:0,questionTotal:0})}),W(Et),Qt(!1);case 8:case"end":return Ct.stop()}},dt)}));return function(We){return bt.apply(this,arguments)}}(),wa=function(){Rr(it.current),pt(!1),cn("")},qa=function(dt){Rr(dt)},ta=function(){for(var dt=hn==null?void 0:hn.filter(function(Mn){return xn==null?void 0:xn.includes(Mn.id)}),We=Object(Z.a)(dt),Ie=0,Et=[],vt=0;vt1&&dt!==0&&(We=gi(Ie,dt,dt-1)),W(We)},ji=function(dt){var We=[],Ie=Object(Oe.cloneDeep)(Q);Ie.length>1&&dt!==Ie.length-1&&(We=gi(Ie,dt,dt+1)),W(We)},Li=function(){var bt=Object(O.a)(h.a.mark(function dt(We){var Ie,Et,vt,Ct;return h.a.wrap(function(dn){for(;;)switch(dn.prev=dn.next){case 0:if(vt=Object(Z.a)(Je),Je.includes(We)?vt=vt.filter(function(Mn){return Mn!==We}):vt.push(We),!(vt.length===0)){dn.next=5;break}return z.b.warn("\u8BD5\u9898\u6765\u6E90\u4E3A\u5FC5\u9009\u9879"),dn.abrupt("return");case 5:(Ie=vt)!==null&&Ie!==void 0&&Ie.includes("mine")||(jn([]),mr.current=[]),(Et=vt)!==null&&Et!==void 0&&Et.includes("teach_groups")||(ti([]),si.current=[]),Kt(vt),Fi(vt),Rr([]),it.current=[],Ct={source:vt,group_ids:mr.current,tag_discipline_ids:[],teach_group_ids:si.current},di(Ct);case 13:case"end":return dn.stop()}},dt)}));return function(We){return bt.apply(this,arguments)}}(),La=function(dt){var We={1:"\u4E00",2:"\u4E8C",3:"\u4E09",4:"\u56DB",5:"\u4E94",6:"\u516D",7:"\u4E03"};if(!dt)return;var Ie=dt||{},Et=Ie.exam,vt=Ie.single_questions,Ct=Ie.multiple_questions,Zt=Ie.judgement_questions,dn=Ie.program_questions,Mn=Ie.completion_questions,An=Ie.subjective_questions,In=Ie.practical_questions,wn=Ie.combination_questions,nr=[Object(L.a)({type:"SINGLE",name:"\u5355\u9009\u9898"},vt),Object(L.a)({type:"MULTIPLE",name:"\u591A\u9009\u9898"},Ct),Object(L.a)({type:"COMPLETION",name:"\u586B\u7A7A\u9898"},Mn),Object(L.a)({type:"JUDGMENT",name:"\u5224\u65AD\u9898"},Zt),Object(L.a)({type:"SUBJECTIVE",name:"\u7B80\u7B54\u9898"},An),Object(L.a)({type:"PROGRAM",name:"\u7F16\u7A0B\u9898"},dn),Object(L.a)({type:"PRACTICAL",name:"\u5B9E\u8BAD\u9898"},In),Object(L.a)({type:"COMBINATION",name:"\u7EC4\u5408\u9898"},wn)],Gn=[],zn=0,yr=0,sr=nr.filter(function(Qn){return Qn.questions_count>0}).map(function(Qn,br){var kr;return(kr=Qn.questions)===null||kr===void 0||kr.forEach(function(rn){Gn.push(rn.id),zn=zn+rn.score,yr=yr+1}),Object(L.a)(Object(L.a)({},Qn),{number:We[br+1]})});return{all_questions_count:yr,all_score:zn,questionList:sr,ids:Gn,exam:Et}},Zr=function(dt){var We,Ie,Et=Object(Oe.cloneDeep)(F),vt=Object(Oe.cloneDeep)(Q);Et.questionList=Et==null||((We=Et.questionList)===null||We===void 0)?void 0:We.map(function(Ct){return Ct.type===dt.type?Object(L.a)(Object(L.a)({},Ct),{},{questions_score:dt.scoreTotal}):Ct}),vt=(Ie=vt)===null||Ie===void 0?void 0:Ie.map(function(Ct){return Ct.item_type===dt.type?Object(L.a)(Object(L.a)({},Ct),{},{score:dt.score,scoreTotal:dt.scoreTotal}):Ct}),W(vt),p(Et),console.log(dt,F,Q)},ii=ct==null||((we=ct.find(function(bt){return bt.id===_t}))===null||we===void 0)?void 0:we.sub_disciplines,Pi=ta();return Hn?i.a.createElement(Ze.a,{loading:xt,submit:Ra,goBack:function(){return fr(!1)},data:F,onTypeScore:Zr,onExchange:na}):i.a.createElement("section",{className:B.a.wrap,style:{display:je?"flex":"none"}},i.a.createElement("div",{id:"id_left",className:B.a.left,onMouseEnter:function(dt){var We=document.getElementById("id_left");We.style.overflowY="auto"},onMouseLeave:function(dt){var We=document.getElementById("id_left");We.style.overflowY="hidden"}},i.a.createElement(Y.a,{loading:an,active:!0,paragraph:{rows:5}},Q.map(function(bt,dt){var We;return i.a.createElement("div",{className:B.a.list,key:dt},i.a.createElement("div",{className:B.a.name},i.a.createElement("b",null),i.a.createElement("span",null,(We=Ri.find(function(Ie){return Ie.type===(bt==null?void 0:bt.item_type)}))===null||We===void 0?void 0:We.name)),i.a.createElement("aside",null,i.a.createElement("div",null,"\u5171",i.a.createElement("span",{className:B.a.b},bt.questionTotal),"\u9898",i.a.createElement("span",{className:B.a.l},"|"),"\u5171",i.a.createElement("span",{className:B.a.r},bt.scoreTotal),"\u5206"),i.a.createElement("div",null,dt>0?i.a.createElement(k.a,{getPopupContainer:function(Et){return document.getElementById("id_left")},title:"\u4E0A\u79FB"},i.a.createElement("span",{onClick:function(){return ri(dt)},className:"mb20",style:{transform:"rotate(270deg)"}}," ",i.a.createElement("i",{className:"icon-jiantou1"}))):i.a.createElement("span",{className:"mb20",style:{transform:"rotate(270deg)",cursor:"not-allowed"}}," ",i.a.createElement("i",{className:"icon-jiantou1"})),dt"),i.a.createElement("span",{className:"current",onClick:function(){return C.d.push("/paperlibrary")}},"\u8BD5\u5377\u5E93>"),i.a.createElement("span",{style:{color:"#bebebe"}},"\u968F\u673A\u7EC4\u5377")),ut===0&&i.a.createElement(f,{value:ut,onChange:cn}),ut===0&&i.a.createElement("section",{className:m.a.oneWrap},i.a.createElement("div",{className:m.a.title},i.a.createElement("b",null),i.a.createElement("span",null,"\u57FA\u672C\u4FE1\u606F"),i.a.createElement("div",null,"STEP1")," "),i.a.createElement(A.a,{className:m.a.formWrap,form:Kt,layout:"horizontal",onValuesChange:ln},i.a.createElement(A.a.Item,{label:"\u8BD5\u5377\u540D\u79F0",name:"name",rules:[{required:!0,message:"\u8BD5\u5377\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A"},{pattern:/^(?!(\s+$))/,message:"\u8F93\u5165\u6846\u4E0D\u80FD\u5168\u4E3A\u7A7A\u683C"}]},i.a.createElement(S.a,{className:m.a.in,bordered:!1,placeholder:"\u8BF7\u8F93\u5165\u8BD5\u5377\u540D\u79F0\uFF0C\u6700\u591A60\u4E2A\u5B57",maxLength:60})),i.a.createElement("div",{style:{position:"relative"}},i.a.createElement(A.a.Item,{label:"\u7B54\u9898\u65F6\u957F:",name:"time",rules:[{required:!0,message:"\u7B54\u9898\u65F6\u957F\u4E0D\u80FD\u4E3A\u7A7A"}]},i.a.createElement(N.a,{min:1,parser:qt,max:9999,placeholder:"\u8BF7\u8F93\u5165\u7B54\u9898\u65F6\u957F",style:{width:190}})),i.a.createElement("span",{style:{position:"absolute",top:26,left:310}},"\u5206\u949F")),i.a.createElement(A.a.Item,{label:"\u8BD5\u9898\u96BE\u5EA6",name:"difficulty",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u96BE\u5EA6"}]},i.a.createElement(I.a.Group,{style:{display:"flex",width:286,justifyContent:"space-between"},size:"large"},i.a.createElement(I.a.Button,{className:m.a.rb,value:1},"\u7B80\u5355"),i.a.createElement(I.a.Button,{className:m.a.rb,value:2},"\u9002\u4E2D"),i.a.createElement(I.a.Button,{className:m.a.rb,value:3},"\u56F0\u96BE"))),i.a.createElement(A.a.Item,{label:"\u8003\u8BD5\u987B\u77E5",name:"exam_notes"},i.a.createElement(ne,{placeholder:"\u8003\u751F\u5FC5\u987B\u4E25\u683C\u9075\u5B88\u8003\u573A\u7EAA\u5F8B\uFF0C\u4E0D\u51C6\u5192\u540D\u9876\u66FF\uFF0C\u4E0D\u51C6\u6709\u4EFB\u4F55\u4F5C\u5F0A\u884C\u4E3A\u3002\u5982\u53D1\u73B0\u8FDD\u7EAA\uFF0C\u5E76\u7ED9\u4E88\u4E25\u5389\u5904\u5206\u3002",rows:4,maxLength:300}))),i.a.createElement("div",{className:m.a.btns},i.a.createElement($.a,{className:"mr40",onClick:function(){return C.d.push("/paperlibrary")}},"\u8FD4\u56DE"),i.a.createElement($.a,{type:"primary",onClick:Object(O.a)(h.a.mark(function En(){return h.a.wrap(function(pt){for(;;)switch(pt.prev=pt.next){case 0:return pt.next=2,Kt.validateFields();case 2:mt(1);case 3:case"end":return pt.stop()}},En)}))},"\u4E0B\u4E00\u6B65"))),i.a.createElement(be,{tabs:ut,dispatch:je,editData:Lt,setFatherTabs:mt,formValue:an})))},ae=Xe.default=Object(C.a)(function(de){var ue=de.paperlibrary,we=de.user,Le=de.globalSetting;return{paperlibrary:ue,user:we,globalSetting:Le}})(re)},"E/GV":function(at,Xe,V){at.exports=V.p+"static/swenjianjia.1640bf70.svg"},ELLl:function(at,Xe,V){(function(oe){oe(V("VrN/"))})(function(oe){var Y={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},D=oe.Pos;oe.defineOption("autoCloseBrackets",!1,function(S,T,h){h&&h!=oe.Init&&(S.removeKeyMap(U),S.state.closeBrackets=null),T&&(I($(T,"pairs")),S.state.closeBrackets=T,S.addKeyMap(U))});function $(S,T){return T=="pairs"&&typeof S=="string"?S:typeof S=="object"&&S[T]!=null?S[T]:Y[T]}var U={Backspace:O,Enter:L};function I(S){for(var T=0;T=0;i--){var C=l[i].head;S.replaceRange("",D(C.line,C.ch-1),D(C.line,C.ch+1),"+delete")}}function L(S){var T=N(S),h=T&&$(T,"explode");if(!h||S.getOption("disableInput"))return oe.Pass;for(var l=S.listSelections(),i=0;i0;return{anchor:new D(S.anchor.line,S.anchor.ch+(T?-1:1)),head:new D(S.head.line,S.head.ch+(T?1:-1))}}function A(S,T){var h=N(S);if(!h||S.getOption("disableInput"))return oe.Pass;var l=$(h,"pairs"),i=l.indexOf(T);if(i==-1)return oe.Pass;for(var c=$(h,"closeBefore"),C=$(h,"triples"),v=l.charAt(i+1)==T,m=S.listSelections(),u=i%2==0,E,d=0;d=0&&S.getRange(s,D(s.line,s.ch+3))==T+T+T?a="skipThree":a="skip";else if(v&&s.ch>1&&C.indexOf(T)>=0&&S.getRange(D(s.line,s.ch-2),s)==T+T){if(s.ch>2&&/\bstring/.test(S.getTokenTypeAt(D(s.line,s.ch-2))))return oe.Pass;a="addFour"}else if(v){var g=s.ch==0?" ":S.getRange(D(s.line,s.ch-1),s);if(!oe.isWordChar(b)&&g!=T&&!oe.isWordChar(g))a="both";else return oe.Pass}else if(u&&(b.length===0||/\s/.test(b)||c.indexOf(b)>-1))a="both";else return oe.Pass;if(!E)E=a;else if(E!=a)return oe.Pass}var _=i%2?l.charAt(i-1):T,k=i%2?T:l.charAt(i+1);S.operation(function(){if(E=="skip")S.execCommand("goCharRight");else if(E=="skipThree")for(var H=0;H<3;H++)S.execCommand("goCharRight");else if(E=="surround"){for(var z=S.getSelections(),H=0;H1&&arguments[1]!==void 0?arguments[1]:1,be=Oe.length,ne=0;ne1&&arguments[1]!==void 0?arguments[1]:!1;return Object(u.a)(B).map(function(ce,pe){if(!U.isValidElement(ce)||!ce.type)return null;var ye=ce.type.isSelectOptGroup,Ce=ce.key,_e=ce.props,le=_e.children,se=Object(K.a)(_e,["children"]);return te||!ye?E(ce):Object(m.a)(Object(m.a)({key:"__RC_SELECT_GRP__".concat(Ce===null?pe:Ce,"__"),label:Ce},se),{},{options:d(le)})}).filter(function(ce){return ce})}var f=V("2Qr1"),s=V("qNPg"),a=V("U8pU"),b=V("Kwbf"),g=V("WKfj");function _(B){var te=B.mode,ce=B.options,pe=B.children,ye=B.backfill,Ce=B.allowClear,_e=B.placeholder,le=B.getInputElement,se=B.showSearch,ge=B.onSearch,ie=B.defaultOpen,q=B.autoFocus,Ee=B.labelInValue,Me=B.value,Ne=B.inputValue,De=B.optionLabelProp,Be=te==="multiple"||te==="tags",Ae=se!==void 0?se:Be||te==="combobox",Pe=ce||d(pe);if(Object(b.a)(te!=="tags"||Pe.every(function(He){return!He.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),te==="tags"||te==="combobox"){var Fe=Pe.some(function(He){return He.options?He.options.some(function(Oe){return typeof("value"in Oe?Oe.value:Oe.key)=="number"}):typeof("value"in He?He.value:He.key)=="number"});Object(b.a)(!Fe,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(b.a)(te!=="combobox"||!De,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(b.a)(te==="combobox"||!ye,"`backfill` only works with `combobox` mode."),Object(b.a)(te==="combobox"||!le,"`getInputElement` only work with `combobox` mode."),Object(b.b)(te!=="combobox"||!le||!Ce||!_e,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),ge&&!Ae&&te!=="combobox"&&te!=="tags"&&Object(b.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(b.b)(!ie||q,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),Me!=null){var ze=Object(g.d)(Me);Object(b.a)(!Ee||ze.every(function(He){return Object(a.a)(He)==="object"&&("key"in He||"value"in He)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(b.a)(!Be||Array.isArray(Me),"`value` should be array when `mode` is `multiple` or `tags`")}if(pe){var qe=null;Object(u.a)(pe).some(function(He){if(!U.isValidElement(He)||!He.type)return!1;var Oe=He.type;if(Oe.isSelectOption)return!1;if(Oe.isSelectOptGroup){var lt=Object(u.a)(He.props.children).every(function(tt){return!U.isValidElement(tt)||!He.type||tt.type.isSelectOption?!0:(qe=tt.type,!1)});return!lt}return qe=Oe,!0}),qe&&Object(b.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(qe.displayName||qe.name||qe,"`.")),Object(b.a)(Ne===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var k=_,H=Object(s.a)({prefixCls:"rc-select",components:{optionList:l},convertChildrenToData:d,flattenOptions:f.d,getLabeledValue:f.e,filterOptions:f.b,isValueDisabled:f.g,findValueOption:f.c,warningProps:k,fillOptionsWithMissingValue:f.a}),z=function(B){Object(D.a)(ce,B);var te=Object($.a)(ce);function ce(){var pe;return Object(oe.a)(this,ce),pe=te.apply(this,arguments),pe.selectRef=U.createRef(),pe.focus=function(){pe.selectRef.current.focus()},pe.blur=function(){pe.selectRef.current.blur()},pe}return Object(Y.a)(ce,[{key:"render",value:function(){return U.createElement(H,Object.assign({ref:this.selectRef},this.props))}}]),ce}(U.Component);z.Option=c,z.OptGroup=v;var Z=z,G=Xe.c=Z},M8RZ:function(at,Xe,V){"use strict";V.d(Xe,"a",function(){return O});var oe=V("fWQN"),Y=V("mtLc"),D=V("yKVA"),$=V("879j"),U=V("q1tI"),I=V.n(U),K=V("i8i4"),N=V.n(K),O=function(L){Object(D.a)(A,L);var x=Object($.a)(A);function A(P){var w;Object(oe.a)(this,A),w=x.call(this,P);var S=window.document;return w.node=S.createElement("div"),S.body.appendChild(w.node),w}return Object(Y.a)(A,[{key:"render",value:function(){var w=this.props.children;return Object(K.createPortal)(w,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),A}(I.a.Component)},NvD2:function(at,Xe,V){"use strict";V.d(Xe,"a",function(){return I});var oe=V("Kwbf");function Y(K,N){var O=new Set;return K.forEach(function(L){N.has(L)||O.add(L)}),O}function D(K){var N=K||{},O=N.disabled,L=N.disableCheckbox,x=N.checkable;return!!(O||L)||x===!1}function $(K,N,O,L){for(var x=new Set(K),A=new Set,P=0;P<=O;P+=1){var w=N.get(P)||new Set;w.forEach(function(l){var i=l.key,c=l.node,C=l.children,v=C===void 0?[]:C;x.has(i)&&!L(c)&&v.filter(function(m){return!L(m.node)}).forEach(function(m){x.add(m.key)})})}for(var S=new Set,T=O;T>=0;T-=1){var h=N.get(T)||new Set;h.forEach(function(l){var i=l.parent,c=l.node;if(L(c)||!l.parent||S.has(l.parent.key))return;if(L(l.parent.node)){S.add(i.key);return}var C=!0,v=!1;(i.children||[]).filter(function(m){return!L(m.node)}).forEach(function(m){var u=m.key,E=x.has(u);C&&!E&&(C=!1),!v&&(E||A.has(u))&&(v=!0)}),C&&x.add(i.key),v&&A.add(i.key),S.add(i.key)})}return{checkedKeys:Array.from(x),halfCheckedKeys:Array.from(Y(A,x))}}function U(K,N,O,L,x){for(var A=new Set(K),P=new Set(N),w=0;w<=L;w+=1){var S=O.get(w)||new Set;S.forEach(function(i){var c=i.key,C=i.node,v=i.children,m=v===void 0?[]:v;!A.has(c)&&!P.has(c)&&!x(C)&&m.filter(function(u){return!x(u.node)}).forEach(function(u){A.delete(u.key)})})}P=new Set;for(var T=new Set,h=L;h>=0;h-=1){var l=O.get(h)||new Set;l.forEach(function(i){var c=i.parent,C=i.node;if(x(C)||!i.parent||T.has(i.parent.key))return;if(x(i.parent.node)){T.add(c.key);return}var v=!0,m=!1;(c.children||[]).filter(function(u){return!x(u.node)}).forEach(function(u){var E=u.key,d=A.has(E);v&&!d&&(v=!1),!m&&(d||P.has(E))&&(m=!0)}),v||A.delete(c.key),m&&P.add(c.key),T.add(c.key)})}return{checkedKeys:Array.from(A),halfCheckedKeys:Array.from(Y(P,A))}}function I(K,N,O,L){var x=[],A;L?A=L:A=D;var P=new Set(K.filter(function(h){var l=!!O[h];return l||x.push(h),l})),w=new Map,S=0;Object.keys(O).forEach(function(h){var l=O[h],i=l.level,c=w.get(i);c||(c=new Set,w.set(i,c)),c.add(l),S=Math.max(S,i)}),Object(oe.a)(!x.length,"Tree missing follow keys: ".concat(x.slice(0,100).map(function(h){return"'".concat(h,"'")}).join(", ")));var T;return N===!0?T=$(P,w,S,A):T=U(P,N.halfCheckedKeys,w,S,A),T}},O2Wb:function(at,Xe,V){at.exports={flex:"flex___2gmSR",flex1:"flex1___3Tu1g",color666:"color666___2uyGL",error:"error___yJ86W",deleteIcon:"deleteIcon___1D2tg",addIcon:"addIcon___2VIYB"}},OLES:function(at,Xe,V){"use strict";var oe=V("U8pU"),Y=V("VTBJ"),D=V("Ff2n"),$=V("q1tI"),U=V("uciX"),I=V("7ixt"),K=function(P){var w=P.overlay,S=P.prefixCls,T=P.id,h=P.overlayInnerStyle;return $.createElement("div",{className:"".concat(S,"-inner"),id:T,role:"tooltip",style:h},typeof w=="function"?w():w)},N=K,O=function(P,w){var S=P.overlayClassName,T=P.trigger,h=T===void 0?["hover"]:T,l=P.mouseEnterDelay,i=l===void 0?0:l,c=P.mouseLeaveDelay,C=c===void 0?.1:c,v=P.overlayStyle,m=P.prefixCls,u=m===void 0?"rc-tooltip":m,E=P.children,d=P.onVisibleChange,f=P.afterVisibleChange,s=P.transitionName,a=P.animation,b=P.placement,g=b===void 0?"right":b,_=P.align,k=_===void 0?{}:_,H=P.destroyTooltipOnHide,z=H===void 0?!1:H,Z=P.defaultVisible,G=P.getTooltipContainer,B=P.overlayInnerStyle,te=Object(D.a)(P,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),ce=Object($.useRef)(null);Object($.useImperativeHandle)(w,function(){return ce.current});var pe=Object(Y.a)({},te);"visible"in P&&(pe.popupVisible=P.visible);var ye=function(){var ge=P.arrowContent,ie=ge===void 0?null:ge,q=P.overlay,Ee=P.id;return[$.createElement("div",{className:"".concat(u,"-arrow"),key:"arrow"},ie),$.createElement(N,{key:"content",prefixCls:u,id:Ee,overlay:q,overlayInnerStyle:B})]},Ce=!1,_e=!1;if(typeof z=="boolean")Ce=z;else if(z&&Object(oe.a)(z)==="object"){var le=z.keepParent;Ce=le===!0,_e=le===!1}return $.createElement(U.a,Object.assign({popupClassName:S,prefixCls:u,popup:ye,action:h,builtinPlacements:I.a,popupPlacement:g,ref:ce,popupAlign:k,getPopupContainer:G,onPopupVisibleChange:d,afterPopupVisibleChange:f,popupTransitionName:s,popupAnimation:a,defaultPopupVisible:Z,destroyPopupOnHide:Ce,autoDestroy:_e,mouseLeaveDelay:C,popupStyle:v,mouseEnterDelay:i},pe),E)},L=Object($.forwardRef)(O),x=Xe.a=L},OZM5:function(at,Xe,V){"use strict";V.d(Xe,"b",function(){return L}),V.d(Xe,"a",function(){return x}),V.d(Xe,"k",function(){return A}),V.d(Xe,"h",function(){return P}),V.d(Xe,"i",function(){return w}),V.d(Xe,"g",function(){return S}),V.d(Xe,"c",function(){return T}),V.d(Xe,"d",function(){return h}),V.d(Xe,"j",function(){return c}),V.d(Xe,"e",function(){return C}),V.d(Xe,"f",function(){return v});var oe=V("KQm4"),Y=V("U8pU"),D=V("Ff2n"),$=V("q1tI"),U=V.n($),I=V("Kwbf"),K=V("WaYH"),N=.25,O=2;function L(m,u){var E=m.slice(),d=E.indexOf(u);return d>=0&&E.splice(d,1),E}function x(m,u){var E=m.slice();return E.indexOf(u)===-1&&E.push(u),E}function A(m){return m.split("-")}function P(m,u){return"".concat(m,"-").concat(u)}function w(m){return m&&m.type&&m.type.isTreeNode}function S(m,u){var E=[m],d=u[m];function f(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];s.forEach(function(a){var b=a.key,g=a.children;E.push(b),f(g)})}return f(d.children),E}function T(m,u){var E=m.clientY,d=u.selectHandle.getBoundingClientRect(),f=d.top,s=d.bottom,a=d.height,b=Math.max(a*N,O);return E<=f+b?-1:E>=s-b?1:0}function h(m,u){if(!m)return;var E=u.multiple;return E?m.slice():m.length?[m[0]]:m}var l=function(u){return u};function i(m,u){if(!m)return[];var E=u||{},d=E.processProps,f=d===void 0?l:d,s=Array.isArray(m)?m:[m];return s.map(function(a){var b=a.children,g=Object(D.a)(a,["children"]),_=i(b,u);return U.a.createElement(K.a,Object.assign({},f(g)),_)})}function c(m){if(!m)return null;var u;if(Array.isArray(m))u={checkedKeys:m,halfCheckedKeys:void 0};else if(Object(Y.a)(m)==="object")u={checkedKeys:m.checked||void 0,halfCheckedKeys:m.halfChecked||void 0};else return Object(I.a)(!1,"`checkedKeys` is not an array or an object"),null;return u}function C(m,u){var E=new Set;function d(f){if(E.has(f))return;var s=u[f];if(!s)return;E.add(f);var a=s.parent,b=s.node;if(b.disabled)return;a&&d(a.key)}return(m||[]).forEach(function(f){d(f)}),Object(oe.a)(E)}function v(m){var u={};return Object.keys(m).forEach(function(E){(E.startsWith("data-")||E.startsWith("aria-"))&&(u[E]=m[E])}),u}},Ot1p:function(at,Xe,V){"use strict";var oe=V("2qtc"),Y=V("kLXV"),D=V("rAM+"),$=V("miYZ"),U=V("tsqr"),I=V("9og8"),K=V("tJVT"),N=V("jrin"),O=V("WmNS"),L=V.n(O),x=V("q1tI"),A=V.n(x),P=V("VrN/"),w=V.n(P),S=V("bdgK"),T=V("p77/"),h=V("Bd2K"),l=V("ELLl"),i=V("19Vz"),c=V("lZu9"),C=V("+NIl"),v=V("kSUc"),m=V("9Bee"),u=function(ue){var we=ue.value,Le=we===void 0?"":we,rt=ue.className,je=ue.showTextOnly,Ye=ue.showLines,Dt=ue.style,ut=Dt===void 0?{}:Dt,mt=Object(x.useMemo)(function(){return""},[Le]);return A.a.createElement(A.a.Fragment,null,A.a.createElement("div",{dangerouslySetInnerHTML:{__html:mt}}))},E=V("0Owb"),d=V("dejd"),f=V("C+DQ"),s=V("1vsH"),a=V("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 g(ue){var we=ue.onActionCallback,Le=ue.title,rt=ue.icon,je=ue.actionName,Ye=ue.className,Dt=Ye===void 0?"":Ye,ut=ue.children;function mt(){we(je)}return A.a.createElement("a",{title:Le,className:Dt,onClick:mt},A.a.createElement("i",{className:"md-iconfont ".concat(rt)}),ut)}var _=function(ue){var we=ue.watch,Le=ue.showNullButton,rt=ue.onActionCallback,je=ue.fullScreen,Ye=ue.insertTemp,Dt=ue.hidetoolBar,ut=ue.uuid,mt=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(ut,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var zt=[].concat(b,[{title:"".concat(we?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(we?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return A.a.createElement("ul",{className:"markdown-toolbar-container"},!Dt&&zt.map(function(Je,Kt){return A.a.createElement("li",{key:Kt},Je.actionName?A.a.createElement(g,Object(E.a)({},Je,{onActionCallback:rt})):A.a.createElement("span",{className:"v-line"}))}),Le?A.a.createElement("li",null,A.a.createElement(g,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:rt},A.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,Ye&&A.a.createElement("li",null,A.a.createElement(g,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(Ye),onActionCallback:rt},A.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),A.a.createElement("li",{className:"btn-full-screen"},A.a.createElement(g,{icon:"".concat(je?"icon-shrink":"icon-enlarge"),title:je?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:rt})))},k=V("M8RZ"),H=V("+L6B"),z=V("2/Rp"),Z=V("y8nQ"),G=V("Vl3Y"),B=V("5NDa"),te=V("5rEg"),ce={labelCol:{span:4},wrapperCol:{span:20}},pe=function(ue){var we=ue.callback,Le=ue.onCancel;function rt(je){we(je)}return A.a.createElement(G.a,Object(E.a)({},ce,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:rt}),A.a.createElement(G.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},A.a.createElement(te.a,null)),A.a.createElement(G.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},A.a.createElement(te.a,null)),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(z.a,{type:"ghost",onClick:Le},"\u53D6\u6D88")))},ye=V("7ahc"),Ce=V("HmJG"),_e=V("BjJ7"),le=G.a.useForm,se={width:280,marginRight:10},ge={labelCol:{span:5},wrapperCol:{span:19}},ie=function(ue){var we=ue.callback,Le=ue.onCancel,rt=le(),je=Object(K.a)(rt,1),Ye=je[0];function Dt(zt){we(zt)}function ut(zt,Je){if(zt.status===-1){U.b.error(zt.message);return}Ye.setFieldsValue({src:"/api/attachments/".concat(zt.id),type:Je.type})}function mt(zt){var Je=zt.target.files[0];Ee(Je,ut)}return A.a.createElement(G.a,Object(E.a)({form:Ye},ge,{className:"upload-image-panel",onFinish:Dt}),A.a.createElement(G.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},A.a.createElement("div",{className:"flex-container"},A.a.createElement(G.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},A.a.createElement(te.a,{style:se})),A.a.createElement(q,{onFileChange:mt}))),A.a.createElement(G.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},A.a.createElement(te.a,{style:{width:264}})),A.a.createElement(G.a.Item,{style:{textAlign:"right"}},A.a.createElement(z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(z.a,{type:"ghost",onClick:Le},"\u53D6\u6D88")))};function q(ue){var we=ue.onFileChange;return A.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",A.a.createElement("input",{type:"file",onChange:we}))}function Ee(ue,we){if(!ue)throw new String("\u6CA1\u6709\u6587\u4EF6");var Le=new FormData;Le.append("editormd-image-file",ue),Le.append("file_param_name","editormd-image-file"),Le.append("byxhr","true");var rt=new window.XMLHttpRequest;rt.withCredentials=!0,rt.addEventListener("load",function(je){we(JSON.parse(je.target.responseText),ue)},!1),rt.addEventListener("error",function(je){console.error(je)},!1),rt.open("POST","".concat(_e.a,"/api/attachments.json")),rt.send(Le)}var Me=V("giR+"),Ne=V("fyUT"),De=V("7Kak"),Be=V("9yH6"),Ae=Be.a.Group,Pe={margin:"0 8px"},Fe=function(ue){var we=ue.callback,Le=ue.onCancel;function rt(je){we(je)}return A.a.createElement(G.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:rt},A.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},A.a.createElement("span",{style:Pe},"\u5355\u5143\u683C\u6570\uFF1A"),A.a.createElement("span",{style:Pe},"\u884C\u6570"),A.a.createElement(G.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},A.a.createElement(Ne.a,null)),A.a.createElement("span",{style:Pe},"\u5217\u6570"),A.a.createElement(G.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},A.a.createElement(Ne.a,null))),A.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},A.a.createElement("span",{style:Pe},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),A.a.createElement(G.a.Item,{name:"align"},A.a.createElement(Ae,null,A.a.createElement(Be.a,{value:"default"},A.a.createElement("i",{className:"fa fa-align-justify"})),A.a.createElement(Be.a,{value:"left"},A.a.createElement("i",{className:"fa fa-align-left"})),A.a.createElement(Be.a,{value:"center"},A.a.createElement("i",{className:"fa fa-align-center"})),A.a.createElement(Be.a,{value:"right"},A.a.createElement("i",{className:"fa fa-align-right"}))))),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(z.a,{type:"ghost",onClick:Le},"\u53D6\u6D88")))},ze=V("ErOA"),qe=V("7Cbv"),He="link",Oe="upload-image",lt="code-block",tt="add-table",ft="------------",nt={default:ft,left:":".concat(ft),center:":".concat(ft,":"),right:"".concat(ft,":")},St=V("9VGf"),ht,yt;function ke(){}var Pt=0,Tt=1e4,Ue="\u2581",Ze=` **\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 xe(ue){return/^\d+$/.test(ue)?"".concat(ue,"px"):ue}var fe=navigator.platform.toUpperCase().indexOf("MAC")>=0,be=fe?"Cmd":"Ctrl",ne=["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"],re=(ht={},Object(N.a)(ht,be+"-B","bold"),Object(N.a)(ht,be+"-I","italic"),ht),ae=(yt={},Object(N.a)(yt,He,"\u6DFB\u52A0\u94FE\u63A5"),Object(N.a)(yt,lt,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(N.a)(yt,Oe,"\u6DFB\u52A0\u6587\u4EF6"),Object(N.a)(yt,tt,"\u6DFB\u52A0\u8868\u683C"),yt),de=Xe.a=function(ue){var we=ue.defaultValue,Le=we===void 0?"":we,rt=ue.onChange,je=ue.width,Ye=je===void 0?"100%":je,Dt=ue.height,ut=Dt===void 0?400:Dt,mt=ue.miniToolbar,zt=mt===void 0?!1:mt,Je=ue.isFocus,Kt=Je===void 0?!1:Je,sn=ue.watch,Bt=ue.insertTemp,an=ue.mode,Qt=an===void 0?"markdown":an,ot=ue.id,Ft=ot===void 0?"markdown-editor-id":ot,xt=ue.showResizeBar,kt=xt===void 0?!1:xt,Mt=ue.noStorage,It=Mt===void 0?!1:Mt,Lt=ue.showNullButton,st=Lt===void 0?!1:Lt,Ve=ue.hidetoolBar,ln=Ve===void 0?!1:Ve,$t=ue.fullScreen,cn=$t===void 0?!1:$t,qt=ue.onBlur,En=ue.onCMBeforeChange,on=ue.onFullScreen,pt=ue.className,Ge=pt===void 0?"":pt,wt=ue.disablePaste,Hn=wt===void 0?!1:wt,fr=ue.placeholder,Ar=fr===void 0?"":fr,Fn=ue.values,F=Fn===void 0?"":Fn,p=Object(x.useState)(null),y=Object(K.a)(p,2),M=y[0],Q=y[1],W=Object(x.useState)(Le),me=Object(K.a)(W,2),$e=me[0],ct=me[1],jt=Object(x.useState)(sn),Qe=Object(K.a)(jt,2),Vt=Qe[0],hn=Qe[1],Rn=Object(x.useState)(cn),pr=Object(K.a)(Rn,2),qn=pr[0],xn=pr[1],Rr=Object(x.useState)(""),qr=Object(K.a)(Rr,2),Vn=qr[0],_t=qr[1],Te=Object(x.useState)(0),it=Object(K.a)(Te,2),Ht=it[0],Ot=it[1],Nt=Object(x.useState)(ut),Xt=Object(K.a)(Nt,2),Dn=Xt[0],Sn=Xt[1],un=Object(x.useState)(!1),jn=Object(K.a)(un,2),Kn=jn[0],ir=jn[1],yn=Object(x.useRef)(Object(qe.a)()),mn=Object(x.useRef)(!1),Ln=Object(x.useRef)(),en=Object(x.useRef)(),Un=Object(x.useRef)(),_n=Object(x.useRef)(),mr=Object(x.useRef)(),ar=function(){var Gt=Object(I.a)(L.a.mark(function nn(){var Jt,fn;return L.a.wrap(function(kn){for(;;)switch(kn.prev=kn.next){case 0:return kn.next=2,Object(ze.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:yn.current}});case 2:fn=kn.sent,fn!=null&&(Jt=fn.attachments)!==null&&Jt!==void 0&&Jt.length&&(console.log("cm:",M,en),fn.attachments.map(function(vn){vn.content_type.indexOf("image")>-1?M.replaceSelection("![,](/api/attachments/".concat(vn.id,"?type=").concat(vn.content_type,")")):vn.content_type.indexOf("video")>-1?M.replaceSelection('')):vn.content_type.indexOf("pdf")>-1?M.replaceSelection('
    ').concat(vn.name,"")):M.replaceSelection("[".concat(vn.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(vn.id,"?type=").concat(vn.content_type,")"))}));case 4:case"end":return kn.stop()}},nn)}));return function(){return Gt.apply(this,arguments)}}();Object(x.useEffect)(function(){ct(F),M==null||M.setValue(F)},[F]),Object(x.useEffect)(function(){on==null||on(qn)},[qn]),Object(x.useEffect)(function(){if(en.current){var Gt=w.a.fromTextArea(en.current,{mode:Qt,lineNumbers:!zt,lineWrapping:!0,value:Le,autoCloseTags:!0,autoCloseBrackets:!0});Kt&&Gt.focus();function nn(Jt,fn){if(Hn){fn.preventDefault();return}var bn=fn.clipboardData;if(bn){var kn=bn.types.toString(),vn=bn.items;if(kn==="Files"||bn.types.indexOf("Files")>-1){if(fn.preventDefault(),Qt=="stex")return;try{var er,vr=vn[1];((er=vn[0])===null||er===void 0?void 0:er.kind)==="file"&&(vr=vn[0]);var gn=vr.getAsFile(),Qr=gn.name.split(".").pop();Ee(gn,function(Tn){if(Tn.id){var or,tr,Gr;(gn==null||((or=gn.type)===null||or===void 0)?void 0:or.indexOf("image"))>-1?Gt.replaceSelection("![,](/api/attachments/".concat(Tn.id,"?type=").concat(Tn.content_type,")")):(gn==null||((tr=gn.type)===null||tr===void 0)?void 0:tr.indexOf("video"))>-1?Gt.replaceSelection('')):(gn==null||((Gr=gn.type)===null||Gr===void 0)?void 0:Gr.indexOf("pdf"))>-1?Gt.replaceSelection('').concat(gn.name,"")):ne.includes(Qr)?Gt.replaceSelection('').concat(gn.name,"")):Gt.replaceSelection("[".concat(gn.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Tn.id,"?type=").concat(Tn.content_type,")"))}else(Tn==null?void 0:Tn.status)===401&&(document.location.href="/user/login")})}catch(Tn){U.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return Gt.on("paste",nn),Gt.on("dragleave",function(Jt,fn){Un.current.classList.remove("mouse-hover-md")}),Gt.on("dragover",function(Jt,fn){Un.current.classList.add("mouse-hover-md")}),Gt.on("drop",function(Jt,fn){Un.current.classList.add("mouse-hover-md");var bn;if(bn=fn.dataTransfer.files,bn.length>0){fn.preventDefault(),fn.stopPropagation();for(var kn=function(vr){var gn=bn[vr],Qr=gn.name.split(".").pop();Ee(gn,function(Tn){if(Tn.id){var or,tr,Gr;(gn==null||((or=gn.type)===null||or===void 0)?void 0:or.indexOf("image"))>-1?Gt.replaceSelection("![,](/api/attachments/".concat(Tn.id,"?type=").concat(Tn.content_type,")")):(gn==null||((tr=gn.type)===null||tr===void 0)?void 0:tr.indexOf("video"))>-1?Gt.replaceSelection('')):(gn==null||((Gr=gn.type)===null||Gr===void 0)?void 0:Gr.indexOf("pdf"))>-1?Gt.replaceSelection('').concat(gn.name,"")):ne.includes(Qr)?Gt.replaceSelection('').concat(gn.name,"")):Gt.replaceSelection("[".concat(gn.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Tn.id,"?type=").concat(Tn.content_type,")"))}else(Tn==null?void 0:Tn.status)===401&&(document.location.href="/user/login")})},vn=0;vn0||vn.target.offsetWidth>0)&&(gr(),M.setSize("100%","100%"),M.refresh())}}catch(er){bn.e(er)}finally{bn.f()}});return Jt.observe(en.current.parentElement),Jt}if(M){var nn=Gt();return function(){nn.unobserve(en.current.parentElement)}}},[M,gr]),Object(x.useEffect)(function(){if(M){for(var Gt=[],nn=function(){var vn=fn[Jt];bn=Object(K.a)(vn,2);var er=bn[0],vr=bn[1],gn=Object(N.a)({},er,function(){fi(vr)});Gt.push(gn),M.addKeyMap(gn)},Jt=0,fn=Object.entries(re);Jt0){var Gt=new Date().getTime(),nn=window.sessionStorage.getItem(Ft);Gt>=Ht+Tt&&(!nn||nn!==$e)&&(window.sessionStorage.setItem(Ft,$e),ir(!0))}},Tt),Object(x.useEffect)(function(){hn(sn)},[M,sn]),Object(x.useEffect)(function(){M&&(Kt&&M.focus())},[M,Kt]),Object(x.useEffect)(function(){if(Vt&&M){var Gt=M.getScrollerElement();function nn(Jt){var fn=Jt.target;if(mr.current){var bn=fn.scrollTop/fn.scrollHeight;mr.current.scrollTop=mr.current.scrollHeight*bn}}return Gt.addEventListener("scroll",nn),function(){Gt.removeEventListener("scroll",nn)}}},[M,Vt]),Object(x.useEffect)(function(){if(M&&En){function Gt(nn,Jt){En(nn,Jt)}return M.on("beforeChange",Gt),function(){M.off("beforeChange",Gt)}}},[M,En]),Object(x.useEffect)(function(){if(M&&qt){function Gt(){qt(M.getValue())}return M.on("blur",Gt),function(){M.off("blur",Gt)}}},[M,qt]),Object(x.useEffect)(function(){if(M){function Gt(nn){var Jt=nn.getValue();ct(Jt),Ot(new Date().getTime()),nn.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),rt&&rt(Jt)}return M.on("change",Gt),function(){M.off("change",Gt)}}},[M,rt]),Object(x.useEffect)(function(){M&&(Le==null?(M.setValue(""),ct("")):Le!==M.getValue()&&(M.setValue(Le),ct(Le),M.setCursor(M.lineCount(),0)))},[M,Le]);var fi=Object(x.useCallback)(function(Gt){var nn=M.getCursor(),Jt=M.getSelection(),fn=Jt.split(` `);switch(Gt){case"bold":return M.replaceSelection("**"+Jt+"**"),Jt===""&&M.setCursor(nn.line,nn.ch+2),M.focus();case"italic":return M.replaceSelection("*"+Jt+"*"),Jt===""&&M.setCursor(nn.line,nn.ch+1),M.focus();case"code":return M.replaceSelection("`"+Jt+"`"),Jt===""&&M.setCursor(nn.line,nn.ch+1),M.focus();case"inline-latex":return M.replaceSelection("`$$"+Jt+"$$`"),Jt===""&&M.setCursor(nn.line,nn.ch+3),M.focus();case"latex":return M.replaceSelection("```latex\n"+Jt+"\n```"),M.setCursor(nn.line+1,Jt.length+1),M.focus();case"line-break":return M.replaceSelection(`
    `),M.focus();case"list-ul":return Jt===""?M.replaceSelection("- "+Jt):M.replaceSelection(fn.map(function(bn){return bn===""?"":"- ".concat(bn)}).join(` `)),M.focus();case"list-ol":return Jt===""?M.replaceSelection("1. "+Jt):M.replaceSelection(fn.map(function(bn,kn){return bn===""?"":"".concat(kn+1,". ").concat(bn)}).join(` `)),M.focus();case"add-null-ch":return Jt===""&&M.setCursor(nn.line,nn.ch+1),M.replaceSelection(Ue),M.focus();case"inster-template-1":return Jt===""&&M.setCursor(nn.line,nn.ch),M.replaceSelection(Ze),M.focus();case"eraser":return M.setValue(""),M.focus();case"trigger-watch":return hn(!Vt),M.focus();case"trigger-full-screen":return xn(!qn),M.focus();case He:_t(He);return;case lt:_t(lt);return;case Oe:_t(Oe);return;case tt:_t(tt);return;default:throw new Error}},[M,Vt,qn]),Jr=Object(x.useCallback)(function(Gt){_t("");switch(Vn){case He:var nn=Gt.title,Jt=Gt.link;return M.replaceSelection("[".concat(nn,"](").concat(Jt,")")),M.focus();case lt:var fn=Gt.language,bn=Gt.content;return M.replaceSelection(["```"+fn,bn,"```"].join(` `)),M.focus();case Oe:var kn=Gt.src,vn=Gt.alt;return vn?M.replaceSelection("![ ".concat(vn," ]( ").concat(kn,' "').concat(vn,'" )')):M.replaceSelection("![,](".concat(kn,")")),M.focus();case tt:for(var er=Gt.row,vr=Gt.col,gn=Gt.align,Qr=` `,Tn=0;Tn300&&(er=300);var vr=ut+er+"px";Sn(vr)}}return Gt.addEventListener("mousedown",fn),document.addEventListener("mousemove",kn),document.addEventListener("mouseup",bn),function(){Gt.removeEventListener("mousedown",fn),document.removeEventListener("mousemove",kn),document.removeEventListener("mouseup",bn)}}},[M,_n]),Object(x.useEffect)(function(){Sn(ut)},[ut]);var On=xe(Ye),ti=xe(Dn),Xr={width:On,height:ti},pi=Object(x.useMemo)(function(){if(Ht){var Gt=new Date(Ht),nn=Gt.getHours(),Jt=Gt.getMinutes(),fn=Gt.getSeconds();return nn=nn<10?"0"+nn:nn,Jt=Jt<10?"0"+Jt:Jt,fn=fn<10?"0"+fn:fn,"".concat(nn,":").concat(Jt,":").concat(fn)}return 0},[Ht]);function ni(){window.sessionStorage.removeItem(Ft),ir(!1),Ot(0)}function ui(){ir(!1),Ot(0),M.setValue(window.sessionStorage.getItem(Ft))}function si(Gt,nn){var Jt=M.getValue();Jt=Jt.replace(Gt,nn),ct(Jt),M==null||M.setValue(Jt)}return A.a.createElement(x.Fragment,null,A.a.createElement("div",{className:"markdown-editor-wrapper",ref:Un},A.a.createElement("div",{className:"markdown-editor-container ".concat(Ge," ").concat(Vt?"on-preview":""," ").concat(zt?"mini":""," ").concat(qn?"full-screen":""),style:Xr},A.a.createElement(_,{insertTemp:Bt,watch:Vt,fullScreen:qn,showNullButton:st,onActionCallback:fi,hidetoolBar:ln,uuid:yn.current,setOpenPhones:function(){mn.current=!0}}),A.a.createElement("div",{className:"markdown-editor-body"},A.a.createElement("div",{className:"codemirror-container"},A.a.createElement("textarea",{ref:en,placeholder:Ar})),Vt?A.a.createElement("div",{ref:mr,className:"preview-container"},Qt==="stex"&&A.a.createElement(u,{value:$e}),Qt!=="stex"&&A.a.createElement(m.a,{edit:!0,value:$e,replaces:si})):null))),kt?A.a.createElement("a",{ref:_n,className:"editor-resize"}):null,A.a.createElement(k.a,null,ae[Vn]?A.a.createElement(Y.a,{centered:!0,title:ae[Vn],visible:!0,onCancel:ei,footer:null,className:"markdown-popup-form"},Ti):null))}},PGNT:function(at,Xe,V){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,Xe,V){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"}},QSKd:function(at,Xe,V){at.exports=V.p+"static/wenhao.50b63ac4.svg"},"RZ/O":function(at,Xe,V){at.exports=V.p+"static/bi.9c9b0364.svg"},SJMd:function(at,Xe){/** * @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 V,oe,Y,D=!1,$,U;window.PR_SHOULD_USE_CONTINUATION=!0;var I,K;(function(){var N=window,O=["break,continue,do,else,for,if,return,while"],L=[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"],x=[L,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],A=[x,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],P=[x,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],w=[x,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],S="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",T=[x,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],h="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",l=[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"],i=[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=[A,w,P,T,h,l,i,c],v=/^(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",u="kwd",E="com",d="typ",f="lit",s="pun",a="pln",b="tag",g="dec",_="src",k="atn",H="atv",z="nocode",Z="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function G(Ae){for(var Pe=0,Fe=!1,ze=!1,qe=0,He=Ae.length;qe122||(ne<65||be>90||Pt.push([Math.max(65,be)|32,Math.min(ne,90)|32]),ne<97||be>122||Pt.push([Math.max(97,be)&~32,Math.min(ne,122)&~32]))}}Pt.sort(function(ue,we){return ue[0]-we[0]||we[1]-ue[1]});for(var re=[],ae=[],Ze=0;Zede[0]&&(de[1]+1>de[0]&&Ue.push("-"),Ue.push(ft(de[1])))}return Ue.push("]"),Ue.join("")}function St(yt){for(var ke=yt.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")),Pt=ke.length,Tt=[],Ue=0,Ze=0;Ue=2&&be==="["?ke[Ue]=nt(xe):be!=="\\"&&(ke[Ue]=xe.replace(/[a-zA-Z]/g,function(ae){var de=ae.charCodeAt(0);return"["+String.fromCharCode(de&~32,de|32)+"]"}))}return ke.join("")}for(var ht=[],qe=0,He=Ae.length;qe=0;)Fe[ht.charAt(yt)]=St;var ke=St[1],Pt=""+ke;tt.hasOwnProperty(Pt)||(lt.push(ke),tt[Pt]=null)}lt.push(/[\0-\uffff]/),ze=G(lt)})();var qe=Pe.length,He=function(Oe){for(var lt=Oe.sourceCode,tt=Oe.basePos,ft=Oe.sourceNode,nt=[tt,a],St=0,ht=lt.match(ze)||[],yt={},ke=0,Pt=ht.length;ke=5&&Ue.substring(0,5)==="lang-",xe&&!(Ze&&typeof Ze[1]=="string")&&(xe=!1,Ue=_),xe||(yt[Tt]=Ue)}var ne=St;if(St+=Tt.length,!xe)nt.push(tt+ne,Ue);else{var re=Ze[1],ae=Tt.indexOf(re),de=ae+re.length;Ze[2]&&(de=Tt.length-Ze[2].length,ae=de-re.length);var ue=Ue.substring(5);te(ft,tt+ne,Tt.substring(0,ae),He,nt),te(ft,tt+ne+ae,re,q(ue,re),nt),te(ft,tt+ne+de,Tt.substring(de),He,nt)}}Oe.decorations=nt};return He}function Ce(Ae){var Pe=[],Fe=[];Ae.tripleQuotedStrings?Pe.push([m,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Ae.multiLineStrings?Pe.push([m,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Pe.push([m,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Ae.verbatimStrings&&Fe.push([m,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var ze=Ae.hashComments;ze&&(Ae.cStyleComments?(ze>1?Pe.push([E,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Pe.push([E,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Fe.push([m,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Pe.push([E,/^#[^\r\n]*/,null,"#"])),Ae.cStyleComments&&(Fe.push([E,/^\/\/[^\r\n]*/,null]),Fe.push([E,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var qe=Ae.regexLiterals;if(qe){var He=qe>1?"":` \r`,Oe=He?".":"[\\S\\s]",lt="/(?=[^/*"+He+"])(?:[^/\\x5B\\x5C"+He+"]|\\x5C"+Oe+"|\\x5B(?:[^\\x5C\\x5D"+He+"]|\\x5C"+Oe+")*(?:\\x5D|$))+/";Fe.push(["lang-regex",RegExp("^"+Z+"("+lt+")")])}var tt=Ae.types;tt&&Fe.push([d,tt]);var ft=(""+Ae.keywords).replace(/^ | $/g,"");ft.length&&Fe.push([u,new RegExp("^(?:"+ft.replace(/[\s,]+/g,"|")+")\\b"),null]),Pe.push([a,/^\s+/,null,` \r \xA0`]);var nt="^.[^\\s\\w.$@'\"`/\\\\]*";return Ae.regexLiterals&&(nt+="(?!s*/)"),Fe.push([f,/^@[a-z_$][a-z_$@0-9]*/i,null],[d,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[f,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]),ye(Pe,Fe)}var _e=Ce({keywords:C,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function le(Ae,Pe,Fe){for(var ze=/(?:^|\s)nocode(?:\s|$)/,qe=/\r\n?|\n/,He=Ae.ownerDocument,Oe=He.createElement("li");Ae.firstChild;)Oe.appendChild(Ae.firstChild);var lt=[Oe];function tt(ke){var Pt=ke.nodeType;if(Pt==1&&!ze.test(ke.className))if(ke.nodeName==="br")ft(ke),ke.parentNode&&ke.parentNode.removeChild(ke);else for(var Tt=ke.firstChild;Tt;Tt=Tt.nextSibling)tt(Tt);else if((Pt==3||Pt==4)&&Fe){var Ue=ke.nodeValue,Ze=Ue.match(qe);if(Ze){var xe=Ue.substring(0,Ze.index);ke.nodeValue=xe;var fe=Ue.substring(Ze.index+Ze[0].length);if(fe){var be=ke.parentNode;be.insertBefore(He.createTextNode(fe),ke.nextSibling)}ft(ke),xe||ke.parentNode.removeChild(ke)}}}function ft(ke){for(;!ke.nextSibling;)if(ke=ke.parentNode,!ke)return;function Pt(Ze,xe){var fe=xe?Ze.cloneNode(!1):Ze,be=Ze.parentNode;if(be){var ne=Pt(be,1),re=Ze.nextSibling;ne.appendChild(fe);for(var ae=re;ae;ae=re)re=ae.nextSibling,ne.appendChild(ae)}return fe}for(var Tt=Pt(ke.nextSibling,0),Ue;(Ue=Tt.parentNode)&&Ue.nodeType===1;)Tt=Ue;lt.push(Tt)}for(var nt=0;nt=be&&(tt+=2),He>=ne&&(St+=2)}}finally{Ue&&(Ue.style.display=Ze)}}var ge={};function ie(Ae,Pe){for(var Fe=Pe.length;--Fe>=0;){var ze=Pe[Fe];ge.hasOwnProperty(ze)?N.console&&console.warn("cannot override language handler %s",ze):ge[ze]=Ae}}function q(Ae,Pe){return Ae&&ge.hasOwnProperty(Ae)||(Ae=/^\s*]*(?:>|$)/],[E,/^<\!--[\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"]),ie(ye([[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"]),ie(ye([],[[H,/^[\s\S]+/]]),["uq.val"]),ie(Ce({keywords:A,hashComments:!0,cStyleComments:!0,types:v}),["c","cc","cpp","cxx","cyc","m"]),ie(Ce({keywords:"null,true,false"}),["json"]),ie(Ce({keywords:w,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:v}),["cs"]),ie(Ce({keywords:P,cStyleComments:!0}),["java"]),ie(Ce({keywords:c,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ie(Ce({keywords:l,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ie(Ce({keywords:h,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ie(Ce({keywords:i,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ie(Ce({keywords:T,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ie(Ce({keywords:S,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ie(ye([],[[m,/^[\s\S]+/]]),["regex"]);function Ee(Ae){var Pe=Ae.langExtension;try{var Fe=B(Ae.sourceNode,Ae.pre),ze=Fe.sourceCode;Ae.sourceCode=ze,Ae.spans=Fe.spans,Ae.basePos=0,q(Pe,ze)(Ae),se(Ae)}catch(qe){N.console&&console.log(qe&&qe.stack||qe)}}function Me(Ae,Pe,Fe){var ze=Fe||!1,qe=Pe||null,He=document.createElement("div");He.innerHTML="
    "+Ae+"
    ",He=He.firstChild,ze&&le(He,ze,!0);var Oe={langExtension:qe,numberLines:ze,sourceNode:He,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Ee(Oe),He.innerHTML}function Ne(Ae,Pe){var Fe=Pe||document.body,ze=Fe.ownerDocument||document;function qe(fe){return Fe.getElementsByTagName(fe)}for(var He=[qe("pre"),qe("code"),qe("xmp")],Oe=[],lt=0;lt=15&&(A=!1,O=!0);var m=i&&(L||A&&(v==null||v<12.11)),u=D||K&&N>=9;function E(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var d=function(e,t){var r=e.className,n=E(t).exec(r);if(n){var o=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(o?n[1]+o:"")}};function f(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function s(e,t){return f(e).appendChild(t)}function a(e,t,r,n){var o=document.createElement(e);if(r&&(o.className=r),n&&(o.style.cssText=n),typeof t=="string")o.appendChild(document.createTextNode(t));else if(t)for(var R=0;R=t)return j+(t-R);j+=X-R,j+=r-j%r,R=X+1}}var ce=function(){this.id=null,this.f=null,this.time=0,this.handler=G(this.onTimeout,this)};ce.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ce.prototype.set=function(e,t){this.f=t;var r=+new Date+e;(!this.id||r=t)return n+Math.min(j,t-o);if(o+=R-n,o+=r-o%r,n=R+1,o>=t)return n}}var ie=[""];function q(e){for(;ie.length<=e;)ie.push(Ee(ie)+" ");return ie[e]}function Ee(e){return e[e.length-1]}function Me(e,t){for(var r=[],n=0;n"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Ae.test(e))}function Fe(e,t){return t?t.source.indexOf("\\w")>-1&&Pe(e)?!0:t.test(e):Pe(e)}function ze(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var qe=/[\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 He(e){return e.charCodeAt(0)>=768&&qe.test(e)}function Oe(e,t,r){for(;(r<0?t>0:tr?-1:1;;){if(t==r)return t;var o=(t+r)/2,R=n<0?Math.ceil(o):Math.floor(o);if(R==t)return e(R)?t:r;e(R)?r=R:t=R+n}}function tt(e,t,r,n){if(!e)return n(t,r,"ltr",0);for(var o=!1,R=0;Rt||t==r&&j.to==t)&&(n(Math.max(j.from,t),Math.min(j.to,r),j.level==1?"rtl":"ltr",R),o=!0)}o||n(t,r,"ltr")}var ft=null;function nt(e,t,r){var n;ft=null;for(var o=0;ot)return o;R.to==t&&(R.from!=R.to&&r=="before"?n=o:ft=o),R.from==t&&(R.from!=R.to&&r!="before"?n=o:ft=o)}return n!=null?n:ft}var St=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function r(ee){return ee<=247?e.charAt(ee):1424<=ee&&ee<=1524?"R":1536<=ee&&ee<=1785?t.charAt(ee-1536):1774<=ee&&ee<=2220?"r":8192<=ee&&ee<=8203?"w":ee==8204?"b":"L"}var n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,R=/[LRr]/,j=/[Lb1n]/,X=/[1n]/;function J(ee,he,ve){this.level=ee,this.from=he,this.to=ve}return function(ee,he){var ve=he=="ltr"?"L":"R";if(ee.length==0||he=="ltr"&&!n.test(ee))return!1;for(var Re=ee.length,Se=[],Ke=0;Ke-1&&(n[t]=o.slice(0,R).concat(o.slice(R+1)))}}}function Ue(e,t){var r=Pt(e,t);if(!r.length)return;for(var n=Array.prototype.slice.call(arguments,2),o=0;o0}function be(e){e.prototype.on=function(t,r){ke(this,t,r)},e.prototype.off=function(t,r){Tt(this,t,r)}}function ne(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function re(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ae(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function de(e){ne(e),re(e)}function ue(e){return e.target||e.srcElement}function we(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),i&&e.ctrlKey&&t==1&&(t=3),t}var Le=function(){if(K&&N<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),rt;function je(e){if(rt==null){var t=a("span","\u200B");s(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(rt=t.offsetWidth<=1&&t.offsetHeight>2&&!(K&&N<8))}var r=rt?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}var Ye;function Dt(e){if(Ye!=null)return Ye;var t=s(e,document.createTextNode("A\u062EA")),r=g(t,0,1).getBoundingClientRect(),n=g(t,1,2).getBoundingClientRect();return f(e),!r||r.left==r.right?!1:Ye=n.right-r.right<3}var ut=` b`.split(/\n/).length!=3?function(e){for(var t=0,r=[],n=e.length;t<=n;){var o=e.indexOf(` `,t);o==-1&&(o=e.length);var R=e.slice(t,e.charAt(o-1)=="\r"?o-1:o),j=R.indexOf("\r");j!=-1?(r.push(R.slice(0,j)),t+=j+1):(r.push(R),t=o+1)}return r}:function(e){return e.split(/\r\n?|\n/)},mt=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(r){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},zt=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Je=null;function Kt(e){if(Je!=null)return Je;var t=s(e,a("span","x")),r=t.getBoundingClientRect(),n=g(t,0,1).getBoundingClientRect();return Je=Math.abs(r.left-n.left)>1}var sn={},Bt={};function an(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),sn[e]=t}function Qt(e,t){Bt[e]=t}function ot(e){if(typeof e=="string"&&Bt.hasOwnProperty(e))e=Bt[e];else if(e&&typeof e.name=="string"&&Bt.hasOwnProperty(e.name)){var t=Bt[e.name];typeof t=="string"&&(t={name:t}),e=Be(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return ot("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return ot("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Ft(e,t){t=ot(t);var r=sn[t.name];if(!r)return Ft(e,"text/plain");var n=r(e,t);if(xt.hasOwnProperty(t.name)){var o=xt[t.name];for(var R in o){if(!o.hasOwnProperty(R))continue;n.hasOwnProperty(R)&&(n["_"+R]=n[R]),n[R]=o[R]}}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var j in t.modeProps)n[j]=t.modeProps[j];return n}var xt={};function kt(e,t){var r=xt.hasOwnProperty(e)?xt[e]:xt[e]={};B(t,r)}function Mt(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var o=t[n];o instanceof Array&&(o=o.concat([])),r[n]=o}return r}function It(e,t){for(var r;e.innerMode&&!(r=e.innerMode(t),!r||r.mode==e);)t=r.state,e=r.mode;return r||{mode:e,state:t}}function Lt(e,t,r){return e.startState?e.startState(t,r):!0}var st=function(e,t,r){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=r};st.prototype.eol=function(){return this.pos>=this.string.length},st.prototype.sol=function(){return this.pos==this.lineStart},st.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},st.prototype.next=function(){if(this.post},st.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},st.prototype.skipToEnd=function(){this.pos=this.string.length},st.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},st.prototype.backUp=function(e){this.pos-=e},st.prototype.column=function(){return this.lastColumnPos0?null:(R&&t!==!1&&(this.pos+=R[0].length),R)}},st.prototype.current=function(){return this.string.slice(this.start,this.pos)},st.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},st.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},st.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function Ve(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 r=e;!r.lines;)for(var n=0;;++n){var o=r.children[n],R=o.chunkSize();if(t=e.first&&tr?Ge(r,Ve(e,r).text.length):y(t,Ve(e,t.line).text.length)}function y(e,t){var r=e.ch;return r==null||r>t?Ge(e.line,t):r<0?Ge(e.line,0):e}function M(e,t){for(var r=[],n=0;nthis.maxLookAhead&&(this.maxLookAhead=e),t},W.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}},W.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},W.fromSaved=function(e,t,r){return t instanceof Q?new W(e,Mt(e.mode,t.state),r,t.lookAhead):new W(e,Mt(e.mode,t),r)},W.prototype.save=function(e){var t=e!==!1?Mt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Q(t,this.maxLookAhead):t};function me(e,t,r,n){var o=[e.state.modeGen],R={};qn(e,t.text,e.doc.mode,r,function(ee,he){return o.push(ee,he)},R,n);for(var j=r.state,X=function(ee){r.baseTokens=o;var he=e.state.overlays[ee],ve=1,Re=0;r.state=!0,qn(e,t.text,he.mode,r,function(Se,Ke){for(var et=ve;ReSe&&o.splice(ve,1,Se,o[ve+1],gt),ve+=2,Re=Math.min(Se,gt)}if(!Ke)return;if(he.opaque)o.splice(et,ve-et,Se,"overlay "+Ke),ve=et+2;else for(;ete.options.maxHighlightLength&&Mt(e.doc.mode,n.state),R=me(e,t,n);o&&(n.state=o),t.stateAfter=n.save(!o),t.styles=R.styles,R.classes?t.styleClasses=R.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function ct(e,t,r){var n=e.doc,o=e.display;if(!n.mode.startState)return new W(n,!0,t);var R=xn(e,t,r),j=R>n.first&&Ve(n,R-1).stateAfter,X=j?W.fromSaved(n,j,R):new W(n,Lt(n.mode),R);return n.iter(R,t,function(J){jt(e,J.text,X);var ee=X.line;J.stateAfter=ee==t-1||ee%5==0||ee>=o.viewFrom&&eet.start)return R}throw new Error("Mode "+e.name+" failed to advance stream.")}var hn=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function Rn(e,t,r,n){var o=e.doc,R=o.mode,j;t=p(o,t);var X=Ve(o,t.line),J=ct(e,t.line,r),ee=new st(X.text,e.options.tabSize,J),he;for(n&&(he=[]);(n||ee.pose.options.maxHighlightLength?(X=!1,j&&jt(e,t,n,he.pos),he.pos=t.length,ve=null):ve=pr(Vt(r,he,n.state,Re),R),Re){var Se=Re[0].name;Se&&(ve="m-"+(ve?Se+" "+ve:Se))}if(!X||ee!=ve){for(;Jj;--X){if(X<=R.first)return R.first;var J=Ve(R,X-1),ee=J.stateAfter;if(ee&&(!r||X+(ee instanceof Q?ee.lookAhead:0)<=R.modeFrontier))return X;var he=te(J.text,null,e.options.tabSize);(o==null||n>he)&&(o=X-1,n=he)}return o}function Rr(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontierr;n--){var o=Ve(e,n).stateAfter;if(o&&(!(o instanceof Q)||n+o.lookAhead=t:R.to>t);(n||(n=[])).push(new it(j,R.from,J?null:R.to))}}return n}function Dn(e,t,r){var n;if(e)for(var o=0;o=t:R.to>t);if(X||R.from==t&&j.type=="bookmark"&&(!r||R.marker.insertLeft)){var J=R.from==null||(j.inclusiveLeft?R.from<=t:R.from0&&X)for(var Wt=0;Wt0)continue;var he=[J,1],ve=wt(ee.from,X.from),Re=wt(ee.to,X.to);(ve<0||!j.inclusiveLeft&&!ve)&&he.push({from:ee.from,to:X.from}),(Re>0||!j.inclusiveRight&&!Re)&&he.push({from:X.to,to:ee.to}),o.splice.apply(o,he),J+=he.length-3}return o}function Kn(e){var t=e.markedSpans;if(!t)return;for(var r=0;rt)&&(!n||Ln(n,R.marker)<0)&&(n=R.marker)}return n}function ar(e,t,r,n,o){var R=Ve(e,t),j=Vn&&R.markedSpans;if(j)for(var X=0;X=0&&ve<=0||he<=0&&ve>=0)continue;if(he<=0&&(J.marker.inclusiveRight&&o.inclusiveLeft?wt(ee.to,r)>=0:wt(ee.to,r)>0)||he>=0&&(J.marker.inclusiveRight&&o.inclusiveLeft?wt(ee.from,n)<=0:wt(ee.from,n)<0))return!0}}function gr(e){for(var t;t=Un(e);)e=t.find(-1,!0).line;return e}function fi(e){for(var t;t=_n(e);)e=t.find(1,!0).line;return e}function Jr(e){for(var t,r;t=_n(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function Ti(e,t){var r=Ve(e,t),n=gr(r);return r==n?t:qt(n)}function ei(e,t){if(t>e.lastLine())return t;var r=Ve(e,t),n;if(!On(e,r))return t;for(;n=_n(r);)r=n.find(1,!0).line;return qt(r)+1}function On(e,t){var r=Vn&&t.markedSpans;if(r)for(var n=void 0,o=0;ot.maxLineLength&&(t.maxLineLength=o,t.maxLine=n)})}var ui=function(e,t,r){this.text=e,ir(this,t),this.height=r?r(this):1};ui.prototype.lineNo=function(){return qt(this)},be(ui);function si(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Kn(e),ir(e,r);var o=n?n(e):1;o!=e.height&&cn(e,o)}function Gt(e){e.parent=null,Kn(e)}var nn={},Jt={};function fn(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?Jt:nn;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function bn(e,t){var r=b("span",null,null,O?"padding-right: .1px":null),n={pre:b("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var o=0;o<=(t.rest?t.rest.length:0);o++){var R=o?t.rest[o-1]:t.line,j=void 0;n.pos=0,n.addToken=vn,Dt(e.display.measure)&&(j=ht(R,e.doc.direction))&&(n.addToken=vr(n.addToken,j)),n.map=[];var X=t!=e.display.externalMeasured&&qt(R);Qr(R,n,$e(e,R,X)),R.styleClasses&&(R.styleClasses.bgClass&&(n.bgClass=z(R.styleClasses.bgClass,n.bgClass||"")),R.styleClasses.textClass&&(n.textClass=z(R.styleClasses.textClass,n.textClass||""))),n.map.length==0&&n.map.push(0,0,n.content.appendChild(je(e.display.measure))),o==0?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(O){var J=n.content.lastChild;(/\bcm-tab\b/.test(J.className)||J.querySelector&&J.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return Ue(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=z(n.pre.className,n.textClass||"")),n}function kn(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 vn(e,t,r,n,o,R,j){if(!t)return;var X=e.splitSpaces?er(t,e.trailingSpace):t,J=e.cm.state.specialChars,ee=!1,he;if(!J.test(t))e.col+=t.length,he=document.createTextNode(X),e.map.push(e.pos,e.pos+t.length,he),K&&N<9&&(ee=!0),e.pos+=t.length;else{he=document.createDocumentFragment();for(var ve=0;;){J.lastIndex=ve;var Re=J.exec(t),Se=Re?Re.index-ve:t.length-ve;if(Se){var Ke=document.createTextNode(X.slice(ve,ve+Se));K&&N<9?he.appendChild(a("span",[Ke])):he.appendChild(Ke),e.map.push(e.pos,e.pos+Se,Ke),e.col+=Se,e.pos+=Se}if(!Re)break;ve+=Se+1;var et=void 0;if(Re[0]==" "){var gt=e.cm.options.tabSize,At=gt-e.col%gt;et=he.appendChild(a("span",q(At),"cm-tab")),et.setAttribute("role","presentation"),et.setAttribute("cm-text"," "),e.col+=At}else Re[0]=="\r"||Re[0]==` `?(et=he.appendChild(a("span",Re[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),et.setAttribute("cm-text",Re[0]),e.col+=1):(et=e.cm.options.specialCharPlaceholder(Re[0]),et.setAttribute("cm-text",Re[0]),K&&N<9?he.appendChild(a("span",[et])):he.appendChild(et),e.col+=1);e.map.push(e.pos,e.pos+1,et),e.pos++}}if(e.trailingSpace=X.charCodeAt(t.length-1)==32,r||n||o||ee||R||j){var Ut=r||"";n&&(Ut+=n),o&&(Ut+=o);var Rt=a("span",[he],Ut,R);if(j)for(var Wt in j)j.hasOwnProperty(Wt)&&Wt!="style"&&Wt!="class"&&Rt.setAttribute(Wt,j[Wt]);return e.content.appendChild(Rt)}e.content.appendChild(he)}function er(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,n="",o=0;oee&&ve.from<=ee);Re++);if(ve.to>=he)return e(r,n,o,R,j,X,J);e(r,n.slice(0,ve.to-ee),o,R,null,X,J),R=null,n=n.slice(ve.to-ee),ee=ve.to}}}function gn(e,t,r,n){var o=!n&&r.widgetNode;o&&e.map.push(e.pos,e.pos+t,o),!n&&e.cm.display.input.needsContentAttribute&&(o||(o=e.content.appendChild(document.createElement("span"))),o.setAttribute("cm-marker",r.id)),o&&(e.cm.display.input.setUneditable(o),e.content.appendChild(o)),e.pos+=t,e.trailingSpace=!1}function Qr(e,t,r){var n=e.markedSpans,o=e.text,R=0;if(!n){for(var j=1;jJ||pn.collapsed&&Yt.to==J&&Yt.from==J)){if(Yt.to!=null&&Yt.to!=J&&Se>Yt.to&&(Se=Yt.to,et=""),pn.className&&(Ke+=" "+pn.className),pn.css&&(Re=(Re?Re+";":"")+pn.css),pn.startStyle&&Yt.from==J&&(gt+=" "+pn.startStyle),pn.endStyle&&Yt.to==Se&&(Wt||(Wt=[])).push(pn.endStyle,Yt.to),pn.title&&((Ut||(Ut={})).title=pn.title),pn.attributes)for(var Wn in pn.attributes)(Ut||(Ut={}))[Wn]=pn.attributes[Wn];pn.collapsed&&(!At||Ln(At.marker,pn)<0)&&(At=Yt)}else Yt.from>J&&Se>Yt.from&&(Se=Yt.from)}if(Wt)for(var Tr=0;Tr=X)break;for(var Vr=Math.min(X,Se);;){if(he){var Wr=J+he.length;if(!At){var ur=Wr>Vr?he.slice(0,Vr-J):he;t.addToken(t,ur,ve?ve+Ke:Ke,gt,J+ur.length==Se?et:"",Re,Ut)}if(Wr>=Vr){he=he.slice(Vr-J),J=Vr;break}J=Wr,gt=""}he=o.slice(R,R=r[ee++]),ve=fn(r[ee++],t.cm.options)}}}function Tn(e,t,r){this.line=t,this.rest=Jr(t),this.size=this.rest?qt(Ee(this.rest))-r+1:1,this.node=this.text=null,this.hidden=On(e,t)}function or(e,t,r){for(var n=[],o,R=t;R2&&R.push((J.bottom+ee.top)/2-r.top)}}R.push(r.bottom-r.top)}}function dt(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;nr)return{map:e.measure.maps[o],cache:e.measure.caches[o],before:!0}}function We(e,t){t=gr(t);var r=qt(t),n=e.display.externalMeasured=new Tn(e.doc,t,r);n.lineN=r;var o=n.built=bn(e,n);return n.text=o.pre,s(e.display.lineMeasure,o.pre),n}function Ie(e,t,r,n){return Ct(e,vt(e,t),r,n)}function Et(e,t){if(t>=e.display.viewFrom&&t=r.lineN&&tt)&&(R=J-X,o=R-1,t>=J&&(j="right")),o!=null){if(n=e[ee+2],X==J&&r==(n.insertLeft?"left":"right")&&(j=r),r=="left"&&o==0)for(;ee&&e[ee-2]==e[ee-3]&&e[ee-1].insertLeft;)n=e[(ee-=3)+2],j="left";if(r=="right"&&o==J-X)for(;ee=0&&!((r=e[o]).left!=r.right);o--);return r}function An(e,t,r,n){var o=dn(t.map,r,n),R=o.node,j=o.start,X=o.end,J=o.collapse,ee;if(R.nodeType==3){for(var he=0;he<4;he++){for(;j&&He(t.line.text.charAt(o.coverStart+j));)--j;for(;o.coverStart+X0&&(J=n="right");var ve;e.options.lineWrapping&&(ve=R.getClientRects()).length>1?ee=ve[n=="right"?ve.length-1:0]:ee=R.getBoundingClientRect()}if(K&&N<9&&!j&&(!ee||!ee.left&&!ee.right)){var Re=R.parentNode.getClientRects()[0];Re?ee={left:Re.left,right:Re.left+Br(e.display),top:Re.top,bottom:Re.bottom}:ee=Zt}for(var Se=ee.top-t.rect.top,Ke=ee.bottom-t.rect.top,et=(Se+Ke)/2,gt=t.view.measure.heights,At=0;At=n.text.length?(J=n.text.length,ee="before"):J<=0&&(J=0,ee="after"),!X)return j(ee=="before"?J-1:J,ee=="before");function he(Ke,et,gt){var At=X[et],Ut=At.level==1;return j(gt?Ke-1:Ke,Ut!=gt)}var ve=nt(X,J,ee),Re=ft,Se=he(J,ve,ee=="before");return Re!=null&&(Se.other=he(J,Re,ee!="before")),Se}function Cn(e,t){var r=0;t=p(e.doc,t),e.options.lineWrapping||(r=Br(e.display)*t.ch);var n=Ve(e.doc,t.line),o=Xr(n)+ji(e.display);return{left:r,right:r,top:o,bottom:o+n.height}}function Yn(e,t,r,n,o){var R=Ge(e,t,r);return R.xRel=o,n&&(R.outside=n),R}function Er(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,r<0)return Yn(n.first,0,null,-1,-1);var o=En(n,r),R=n.first+n.size-1;if(o>R)return Yn(n.first+n.size-1,Ve(n,R).text.length,null,1,1);t<0&&(t=0);for(var j=Ve(n,o);;){var X=Bn(e,j,o,t,r),J=mr(j,X.ch+(X.xRel>0||X.outside>0?1:0));if(!J)return X;var ee=J.find(1);if(ee.line==o)return ee;j=Ve(n,o=ee.line)}}function lr(e,t,r,n){n-=sr(t);var o=t.text.length,R=lt(function(j){return Ct(e,r,j-1).bottom<=n},o,0);return o=lt(function(j){return Ct(e,r,j).top>n},R,o),{begin:R,end:o}}function Mr(e,t,r,n){r||(r=vt(e,t));var o=Qn(e,t,Ct(e,r,n),"line").top;return lr(e,t,r,o)}function Ir(e,t,r,n){return e.bottom<=r?!1:e.top>r?!0:(n?e.left:e.right)>t}function Bn(e,t,r,n,o){o-=Xr(t);var R=vt(e,t),j=sr(t),X=0,J=t.text.length,ee=!0,he=ht(t,e.doc.direction);if(he){var ve=(e.options.lineWrapping?xr:Xn)(e,t,r,R,he,n,o);ee=ve.level!=1,X=ee?ve.from:ve.to-1,J=ee?ve.to:ve.from-1}var Re=null,Se=null,Ke=lt(function(tn){var Yt=Ct(e,R,tn);return Yt.top+=j,Yt.bottom+=j,Ir(Yt,n,o,!1)?(Yt.top<=o&&Yt.left<=n&&(Re=tn,Se=Yt),!0):!1},X,J),et,gt,At=!1;if(Se){var Ut=n-Se.left=Wt.bottom?1:0}return Ke=Oe(t.text,Ke,1),Yn(r,Ke,gt,At,n-et)}function Xn(e,t,r,n,o,R,j){var X=lt(function(ve){var Re=o[ve],Se=Re.level!=1;return Ir(rn(e,Ge(r,Se?Re.to:Re.from,Se?"before":"after"),"line",t,n),R,j,!0)},0,o.length-1),J=o[X];if(X>0){var ee=J.level!=1,he=rn(e,Ge(r,ee?J.from:J.to,ee?"after":"before"),"line",t,n);Ir(he,R,j,!0)&&he.top>j&&(J=o[X-1])}return J}function xr(e,t,r,n,o,R,j){var X=lr(e,t,n,j),J=X.begin,ee=X.end;/\s/.test(t.text.charAt(ee-1))&&ee--;for(var he=null,ve=null,Re=0;Re=ee||Se.to<=J)continue;var Ke=Se.level!=1,et=Ct(e,n,Ke?Math.min(ee,Se.to)-1:Math.max(J,Se.from)).right,gt=etgt)&&(he=Se,ve=gt)}return he||(he=o[o.length-1]),he.fromee&&(he={from:he.from,to:ee,level:he.level}),he}var Pr;function _r(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Pr==null){Pr=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Pr.appendChild(document.createTextNode("x")),Pr.appendChild(a("br"));Pr.appendChild(document.createTextNode("x"))}s(e.measure,Pr);var r=Pr.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),f(e.measure),r||1}function Br(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),r=a("pre",[t],"CodeMirror-line-like");s(e.measure,r);var n=t.getBoundingClientRect(),o=(n.right-n.left)/10;return o>2&&(e.cachedCharWidth=o),o||10}function ra(e){for(var t=e.display,r={},n={},o=t.gutters.clientLeft,R=t.gutters.firstChild,j=0;R;R=R.nextSibling,++j){var X=e.display.gutterSpecs[j].className;r[X]=R.offsetLeft+R.clientLeft+o,n[X]=R.clientWidth}return{fixedPos:ia(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function ia(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Lo(e){var t=_r(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/Br(e.display)-3);return function(o){if(On(e.doc,o))return 0;var R=0;if(o.widgets)for(var j=0;j0&&(ee=Ve(e.doc,J.line).text).length==J.ch){var he=te(ee,ee.length,e.options.tabSize)-ee.length;J=Ge(J.line,Math.max(0,Math.round((R-La(e.display).left)/Br(e.display))-he))}return J}function Oi(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var r=e.display.view,n=0;nt)&&(o.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=o.viewTo)Vn&&Ti(e.doc,t)o.viewFrom?yi(e):(o.viewFrom+=n,o.viewTo+=n);else if(t<=o.viewFrom&&r>=o.viewTo)yi(e);else if(t<=o.viewFrom){var R=Pa(e,r,r+n,1);R?(o.view=o.view.slice(R.index),o.viewFrom=R.lineN,o.viewTo+=n):yi(e)}else if(r>=o.viewTo){var j=Pa(e,t,t,-1);j?(o.view=o.view.slice(0,j.index),o.viewTo=j.lineN):yi(e)}else{var X=Pa(e,t,t,-1),J=Pa(e,r,r+n,1);X&&J?(o.view=o.view.slice(0,X.index).concat(or(e,X.lineN,J.lineN)).concat(o.view.slice(J.index)),o.viewTo+=n):yi(e)}var ee=o.externalMeasured;ee&&(r=o.lineN&&t=n.viewTo)return;var R=n.view[Oi(e,t)];if(R.node==null)return;var j=R.changes||(R.changes=[]);pe(j,r)==-1&&j.push(r)}function yi(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Pa(e,t,r,n){var o=Oi(e,t),R,j=e.display.view;if(!Vn||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var X=e.display.viewFrom,J=0;J0){if(o==j.length-1)return null;R=X+j[o].size-t,o++}else R=X-t;t+=R,r+=R}for(;Ti(e.doc,r)!=r;){if(o==(n<0?0:j.length-1))return null;r+=n*j[o-(n<0?1:0)].size,o+=n}return{index:o,lineN:r}}function Vs(e,t,r){var n=e.display,o=n.view;o.length==0||t>=n.viewTo||r<=n.viewFrom?(n.view=or(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=or(e,t,n.viewFrom).concat(n.view):n.viewFromr&&(n.view=n.view.slice(0,Oi(e,r)))),n.viewTo=r}function Po(e){for(var t=e.display.view,r=0,n=0;n=e.display.viewTo||X.to().line0?t.blinker=setInterval(function(){e.hasFocus()||Wi(e),t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function ko(e){e.state.focused||(e.display.input.focus(),ro(e))}function Mo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Wi(e))},100)}function ro(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Ue(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()),no(e)}function Wi(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Ue(e,"blur",e,t),e.state.focused=!1,d(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Oa(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n.005||he<-.005)&&(cn(o.line,j),Io(o.line),o.rest))for(var ve=0;vee.display.sizerWidth){var Re=Math.ceil(X/Br(e.display));Re>e.display.maxLineLength&&(e.display.maxLineLength=Re,e.display.maxLine=o.line,e.display.maxLineChanged=!0)}}}function Io(e){if(e.widgets)for(var t=0;t=j&&(R=En(t,Xr(Ve(t,J))-e.wrapper.clientHeight),j=J)}return{from:R,to:Math.max(j,R+1)}}function $s(e,t){if(Ze(e,"scrollCursorIntoView"))return;var r=e.display,n=r.sizer.getBoundingClientRect(),o=null;if(t.top+n.top<0?o=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(o=!1),o!=null&&!S){var R=a("div","\u200B",null,`position: absolute; top: `+(t.top-r.viewOffset-ji(e.display))+`px; height: `+(t.bottom-t.top+Zr(e)+r.barHeight)+`px; left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(R),R.scrollIntoView(o),e.display.lineSpace.removeChild(R)}}function Ys(e,t,r,n){n==null&&(n=0);var o;!e.options.lineWrapping&&t==r&&(t=t.ch?Ge(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,r=t.sticky=="before"?Ge(t.line,t.ch+1,"before"):t);for(var R=0;R<5;R++){var j=!1,X=rn(e,t),J=!r||r==t?X:rn(e,r);o={left:Math.min(X.left,J.left),top:Math.min(X.top,J.top)-n,right:Math.max(X.left,J.left),bottom:Math.max(X.bottom,J.bottom)+n};var ee=io(e,o),he=e.doc.scrollTop,ve=e.doc.scrollLeft;if(ee.scrollTop!=null&&(sa(e,ee.scrollTop),Math.abs(e.doc.scrollTop-he)>1&&(j=!0)),ee.scrollLeft!=null&&(ki(e,ee.scrollLeft),Math.abs(e.doc.scrollLeft-ve)>1&&(j=!0)),!j)break}return o}function Js(e,t){var r=io(e,t);r.scrollTop!=null&&sa(e,r.scrollTop),r.scrollLeft!=null&&ki(e,r.scrollLeft)}function io(e,t){var r=e.display,n=_r(e.display);t.top<0&&(t.top=0);var o=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:r.scroller.scrollTop,R=Pi(e),j={};t.bottom-t.top>R&&(t.bottom=t.top+R);var X=e.doc.height+Li(r),J=t.topX-n;if(t.topo+R){var he=Math.min(t.top,(ee?X:t.bottom)-R);he!=o&&(j.scrollTop=he)}var ve=e.options.fixedGutter?0:r.gutters.offsetWidth,Re=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:r.scroller.scrollLeft-ve,Se=ii(e)-r.gutters.offsetWidth,Ke=t.right-t.left>Se;return Ke&&(t.right=t.left+Se),t.left<10?j.scrollLeft=0:t.leftSe+Re-3&&(j.scrollLeft=t.right+(Ke?0:10)-Se),j}function ao(e,t){if(t==null)return;Ma(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Hi(e){Ma(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function oa(e,t,r){(t!=null||r!=null)&&Ma(e),t!=null&&(e.curOp.scrollLeft=t),r!=null&&(e.curOp.scrollTop=r)}function Qs(e,t){Ma(e),e.curOp.scrollToPos=t}function Ma(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=Cn(e,t.from),n=Cn(e,t.to);No(e,r,n,t.margin)}}function No(e,t,r,n){var o=io(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-n,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+n});oa(e,o.scrollLeft,o.scrollTop)}function sa(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;D||so(e,{top:t}),Uo(e,t,!0),D&&so(e),da(e,100)}function Uo(e,t,r){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!r)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function ki(e,t,r,n){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!n)return;e.doc.scrollLeft=t,Ho(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function la(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+Li(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?r:0,docHeight:n,scrollHeight:n+Zr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var Mi=function(e,t,r){this.cm=r;var n=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),o=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=o.tabIndex=-1,e(n),e(o),ke(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),ke(o,"scroll",function(){o.clientWidth&&t(o.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,K&&N<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Mi.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var o=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+o)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var R=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+R)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(n==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?n:0,bottom:t?n:0}},Mi.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Mi.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Mi.prototype.zeroWidthHack=function(){var e=i&&!w?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ce,this.disableVert=new ce},Mi.prototype.enableZeroWidthBar=function(e,t,r){e.style.pointerEvents="auto";function n(){var o=e.getBoundingClientRect(),R=r=="vert"?document.elementFromPoint(o.right-1,(o.top+o.bottom)/2):document.elementFromPoint((o.right+o.left)/2,o.bottom-1);R!=e?e.style.pointerEvents="none":t.set(1e3,n)}t.set(1e3,n)},Mi.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var ua=function(){};ua.prototype.update=function(){return{bottom:0,right:0}},ua.prototype.setScrollLeft=function(){},ua.prototype.setScrollTop=function(){},ua.prototype.clear=function(){};function Ki(e,t){t||(t=la(e));var r=e.display.barWidth,n=e.display.barHeight;Bo(e,t);for(var o=0;o<4&&r!=e.display.barWidth||n!=e.display.barHeight;o++)r!=e.display.barWidth&&e.options.lineWrapping&&Oa(e),Bo(e,la(e)),r=e.display.barWidth,n=e.display.barHeight}function Bo(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}var Fo={native:Mi,null:ua};function jo(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&d(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Fo[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),ke(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,r){r=="horizontal"?ki(e,t):sa(e,t)},e),e.display.scrollbars.addClass&&H(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function Ii(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},Gr(e.curOp)}function Ni(e){var t=e.curOp;t&&Qa(t,function(r){for(var n=0;n=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Ia(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&oo(e.cm,e.update)}function nl(e){var t=e.cm,r=t.display;e.updatedDisplay&&Oa(t),e.barMeasure=la(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Ie(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+Zr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-ii(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function rl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)return;var r=+new Date+e.options.workTime,n=ct(e,t.highlightFrontier),o=[];t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),function(R){if(n.line>=e.display.viewFrom){var j=R.styles,X=R.text.length>e.options.maxHighlightLength?Mt(t.mode,n.state):null,J=me(e,R,n,!0);X&&(n.state=X),R.styles=J.styles;var ee=R.styleClasses,he=J.classes;he?R.styleClasses=he:ee&&(R.styleClasses=null);for(var ve=!j||j.length!=R.styles.length||ee!=he&&(!ee||!he||ee.bgClass!=he.bgClass||ee.textClass!=he.textClass),Re=0;!ve&&Rer)return da(e,e.options.workDelay),!0}),t.highlightFrontier=n.line,t.modeFrontier=Math.max(t.modeFrontier,n.line),o.length&&zr(e,function(){for(var R=0;R=r.viewFrom&&t.visible.to<=r.viewTo&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&Po(e)==0)return!1;Ko(e)&&(yi(e),t.dims=ra(e));var o=n.first+n.size,R=Math.max(t.visible.from-e.options.viewportMargin,n.first),j=Math.min(o,t.visible.to+e.options.viewportMargin);r.viewFromj&&r.viewTo-j<20&&(j=Math.min(o,r.viewTo)),Vn&&(R=Ti(e.doc,R),j=ei(e.doc,j));var X=R!=r.viewFrom||j!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;Vs(e,R,j),r.viewOffset=Xr(Ve(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var J=Po(e);if(!X&&J==0&&!t.force&&r.renderedView==r.view&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo))return!1;var ee=sl(e);return J>4&&(r.lineDiv.style.display="none"),ul(e,r.updateLineNumbers,t.dims),J>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,ll(ee),f(r.cursorDiv),f(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,X&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,da(e,400)),r.updateLineNumbers=null,!0}function Wo(e,t){for(var r=t.viewport,n=!0;;n=!1){if(!n||!e.options.lineWrapping||t.oldDisplayWidth==ii(e)){if(r&&r.top!=null&&(r={top:Math.min(e.doc.height+Li(e.display)-Pi(e),r.top)}),t.visible=ka(e.display,e.doc,r),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else n&&(t.visible=ka(e.display,e.doc,r));if(!oo(e,t))break;Oa(e);var o=la(e);aa(e),Ki(e,o),uo(e,o),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 so(e,t){var r=new Ia(e,t);if(oo(e,r)){Oa(e),Wo(e,r);var n=la(e);aa(e),Ki(e,n),uo(e,n),r.finish()}}function ul(e,t,r){var n=e.display,o=e.options.lineNumbers,R=n.lineDiv,j=R.firstChild;function X(Ke){var et=Ke.nextSibling;return O&&i&&e.display.currentWheelTarget==Ke?Ke.style.display="none":Ke.parentNode.removeChild(Ke),et}for(var J=n.view,ee=n.viewFrom,he=0;he-1&&(Se=!1),Fi(e,ve,ee,r)),Se&&(f(ve.lineNumber),ve.lineNumber.appendChild(document.createTextNode(pt(e.options,ee)))),j=ve.node.nextSibling}ee+=ve.size}for(;j;)j=X(j)}function lo(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function uo(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+Zr(e)+"px"}function Ho(e){var t=e.display,r=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var n=ia(t)-t.scroller.scrollLeft+e.doc.scrollLeft,o=t.gutters.offsetWidth,R=n+"px",j=0;jj.clientWidth,J=j.scrollHeight>j.clientHeight;if(!(n&&X||o&&J))return;if(o&&i&&O){e:for(var ee=t.target,he=R.view;ee!=j;ee=ee.parentNode)for(var ve=0;ve=0&&wt(e,n.to())<=0)return r}return-1};var Pn=function(e,t){this.anchor=e,this.head=t};Pn.prototype.from=function(){return Fn(this.anchor,this.head)},Pn.prototype.to=function(){return Ar(this.anchor,this.head)},Pn.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function ai(e,t,r){var n=e&&e.options.selectionsMayTouch,o=t[r];t.sort(function(Re,Se){return wt(Re.from(),Se.from())}),r=pe(t,o);for(var R=1;R0:J>=0){var ee=Fn(X.from(),j.from()),he=Ar(X.to(),j.to()),ve=X.empty()?j.from()==j.head:X.from()==X.head;R<=r&&--r,t.splice(--R,2,new Pn(ve?he:ee,ve?ee:he))}}return new Yr(t,r)}function bi(e,t){return new Yr([new Pn(e,t||e)],0)}function Ei(e){return e.text?Ge(e.from.line+e.text.length-1,Ee(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Xo(e,t){if(wt(e,t.from)<0)return e;if(wt(e,t.to)<=0)return Ei(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=Ei(t).ch-t.to.ch),Ge(r,n)}function ho(e,t){for(var r=[],n=0;n1&&e.remove(X.line+1,Ke-1),e.insert(X.line+1,At)}cr(e,"change",e,t)}function xi(e,t,r){function n(o,R,j){if(o.linked)for(var X=0;X1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Ee(e.done)}function qo(e,t,r,n){var o=e.history;o.undone.length=0;var R=+new Date,j,X;if((o.lastOp==n||o.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&o.lastModTime>R-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(j=pl(o,o.lastOp==n)))X=Ee(j.changes),wt(t.from,t.to)==0&&wt(t.from,X.to)==0?X.to=Ei(t):j.changes.push(mo(e,t));else{var J=Ee(o.done);for((!J||!J.ranges)&&Ba(e.sel,o.done),j={changes:[mo(e,t)],generation:o.generation},o.done.push(j);o.done.length>o.undoDepth;)o.done.shift(),o.done[0].ranges||o.done.shift()}o.done.push(r),o.generation=++o.maxGeneration,o.lastModTime=o.lastSelTime=R,o.lastOp=o.lastSelOp=n,o.lastOrigin=o.lastSelOrigin=t.origin,X||Ue(e,"historyAdded")}function ml(e,t,r,n){var o=t.charAt(0);return o=="*"||o=="+"&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,r,n){var o=e.history,R=n&&n.origin;r==o.lastSelOp||R&&o.lastSelOrigin==R&&(o.lastModTime==o.lastSelTime&&o.lastOrigin==R||ml(e,R,Ee(o.done),t))?o.done[o.done.length-1]=t:Ba(t,o.done),o.lastSelTime=+new Date,o.lastSelOrigin=R,o.lastSelOp=r,n&&n.clearRedo!==!1&&Zo(o.undone)}function Ba(e,t){var r=Ee(t);r&&r.ranges&&r.equals(e)||t.push(e)}function es(e,t,r,n){var o=t["spans_"+e.id],R=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(j){j.markedSpans&&((o||(o=t["spans_"+e.id]={}))[R]=j.markedSpans),++R})}function vl(e){if(!e)return null;for(var t,r=0;r-1&&(Ee(X)[ve]=ee[ve],delete ee[ve]))}}return n}function go(e,t,r,n){if(n){var o=e.anchor;if(r){var R=wt(t,o)<0;R!=wt(r,o)<0?(o=t,t=r):R!=wt(t,r)<0&&(t=r)}return new Pn(o,t)}else return new Pn(r||t,t)}function Fa(e,t,r,n,o){o==null&&(o=e.cm&&(e.cm.display.shift||e.extend)),Dr(e,new Yr([go(e.sel.primary(),t,r,o)],0),n)}function ns(e,t,r){for(var n=[],o=e.cm&&(e.cm.display.shift||e.extend),R=0;R=t.ch:X.to>t.ch))){if(o&&(Ue(J,"beforeCursorEnter"),J.explicitlyCleared))if(R.markedSpans){--j;continue}else break;if(!J.atomic)continue;if(r){var ve=J.find(n<0?1:-1),Re=void 0;if((n<0?he:ee)&&(ve=ls(e,ve,-n,ve&&ve.line==t.line?R:null)),ve&&ve.line==t.line&&(Re=wt(ve,r))&&(n<0?Re<0:Re>0))return zi(e,ve,t,n,o)}var Se=J.find(n<0?-1:1);return(n<0?ee:he)&&(Se=ls(e,Se,n,Se.line==t.line?R:null)),Se?zi(e,Se,t,n,o):null}}return t}function Wa(e,t,r,n,o){var R=n||1,j=zi(e,t,r,R,o)||!o&&zi(e,t,r,R,!0)||zi(e,t,r,-R,o)||!o&&zi(e,t,r,-R,!0);return j||(e.cantEdit=!0,Ge(e.first,0))}function ls(e,t,r,n){return r<0&&t.ch==0?t.line>e.first?p(e,Ge(t.line-1)):null:r>0&&t.ch==(n||Ve(e,t.line)).text.length?t.line=0;--o)cs(e,{from:n[o].from,to:n[o].to,text:o?[""]:t.text,origin:t.origin});else cs(e,t)}function cs(e,t){if(t.text.length==1&&t.text[0]==""&&wt(t.from,t.to)==0)return;var r=ho(e,t);qo(e,t,r,e.cm?e.cm.curOp.id:NaN),fa(e,t,r,Sn(e,t));var n=[];xi(e,function(o,R){!R&&pe(n,o.history)==-1&&(ms(o.history,t),n.push(o.history)),fa(o,t,null,Sn(o,t))})}function Ha(e,t,r){var n=e.cm&&e.cm.state.suppressEdits;if(n&&!r)return;for(var o=e.history,R,j=e.sel,X=t=="undo"?o.done:o.undone,J=t=="undo"?o.undone:o.done,ee=0;ee=0;--Se){var Ke=Re(Se);if(Ke)return Ke.v}}function hs(e,t){if(t==0)return;if(e.first+=t,e.sel=new Yr(Me(e.sel.ranges,function(o){return new Pn(Ge(o.anchor.line+t,o.anchor.ch),Ge(o.head.line+t,o.head.ch))}),e.sel.primIndex),e.cm){Fr(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;ne.lastLine())return;if(t.from.lineR&&(t={from:t.from,to:Ge(R,Ve(e,R).text.length),text:[t.text[0]],origin:t.origin}),t.removed=ln(e,t.from,t.to),r||(r=ho(e,t)),e.cm?El(e.cm,t,n):po(e,t,n),ja(e,r,_e),e.cantEdit&&Wa(e,Ge(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,r){var n=e.doc,o=e.display,R=t.from,j=t.to,X=!1,J=R.line;e.options.lineWrapping||(J=qt(gr(Ve(n,R.line))),n.iter(J,j.line+1,function(Se){if(Se==o.maxLine)return X=!0,!0})),n.sel.contains(t.from,t.to)>-1&&xe(e),po(n,t,r,Lo(e)),e.options.lineWrapping||(n.iter(J,R.line+t.text.length,function(Se){var Ke=pi(Se);Ke>o.maxLineLength&&(o.maxLine=Se,o.maxLineLength=Ke,o.maxLineChanged=!0,X=!1)}),X&&(e.curOp.updateMaxLine=!0)),Rr(n,R.line),da(e,400);var ee=t.text.length-(j.line-R.line)-1;t.full?Fr(e):R.line==j.line&&t.text.length==1&&!Yo(e.doc,t)?vi(e,R.line,"text"):Fr(e,R.line,j.line+1,ee);var he=fe(e,"changes"),ve=fe(e,"change");if(ve||he){var Re={from:R,to:j,text:t.text,removed:t.removed,origin:t.origin};ve&&cr(e,"change",e,Re),he&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Re)}e.display.selForContextMenu=null}function Xi(e,t,r,n,o){var R;n||(n=r),wt(n,r)<0&&(R=[n,r],r=R[0],n=R[1]),typeof t=="string"&&(t=e.splitLines(t)),Vi(e,{from:r,to:n,text:t,origin:o})}function fs(e,t,r,n){r1||!(this.children[0]instanceof ma))){var X=[];this.collapse(X),this.children=[new ma(X)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var j=o.lines.length%25+25,X=j;X10);e.parent.maybeSpill()},iterN:function(e,t,r){for(var n=0;ne.display.maxLineLength&&(e.display.maxLine=ee,e.display.maxLineLength=he,e.display.maxLineChanged=!0)}n!=null&&e&&this.collapsed&&Fr(e,n,o+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&os(e.doc)),e&&cr(e,"markerCleared",e,this,n,o),t&&Ni(e),this.parent&&this.parent.clear()},_i.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var r,n,o=0;o0||j==0&&R.clearWhenEmpty!==!1)return R;if(R.replacedWith&&(R.collapsed=!0,R.widgetNode=b("span",[R.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||R.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(R.widgetNode.insertLeft=!0)),R.collapsed){if(ar(e,t.line,t,r,R)||t.line!=r.line&&ar(e,r.line,t,r,R))throw new Error("Inserting collapsed marker partially overlapping an existing one");Te()}R.addToHistory&&qo(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var X=t.line,J=e.cm,ee;if(e.iter(X,r.line+1,function(ve){J&&R.collapsed&&!J.options.lineWrapping&&gr(ve)==J.display.maxLine&&(ee=!0),R.collapsed&&X!=t.line&&cn(ve,0),Nt(ve,new it(R,X==t.line?t.ch:null,X==r.line?r.ch:null)),++X}),R.collapsed&&e.iter(t.line,r.line+1,function(ve){On(e,ve)&&cn(ve,0)}),R.clearOnEnter&&ke(R,"beforeCursorEnter",function(){return R.clear()}),R.readOnly&&(_t(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),R.collapsed&&(R.id=++vs,R.atomic=!0),J){if(ee&&(J.curOp.updateMaxLine=!0),R.collapsed)Fr(J,t.line,r.line+1);else if(R.className||R.startStyle||R.endStyle||R.css||R.attributes||R.title)for(var he=t.line;he<=r.line;he++)vi(J,he,"text");R.atomic&&os(J.doc),cr(J,"markerAdded",J,R)}return R}var ya=function(e,t){this.markers=e,this.primary=t;for(var r=0;r=0;J--)Vi(this,n[J]);X?is(this,X):this.cm&&Hi(this.cm)}),undo:Sr(function(){Ha(this,"undo")}),redo:Sr(function(){Ha(this,"redo")}),undoSelection:Sr(function(){Ha(this,"undo",!0)}),redoSelection:Sr(function(){Ha(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n=e.ch)&&t.push(o.marker.parent||o.marker)}return t},findMarks:function(e,t,r){e=p(this,e),t=p(this,t);var n=[],o=e.line;return this.iter(e.line,t.line+1,function(R){var j=R.markedSpans;if(j)for(var X=0;X=J.to||J.from==null&&o!=e.line||J.from!=null&&o==t.line&&J.from>=t.ch)&&(!r||r(J.marker))&&n.push(J.marker.parent||J.marker)}++o}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;ne)return t=e,!0;e-=R,++r}),p(this,Ge(r,t))},indexFromPos:function(e){e=p(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 he=e.dataTransfer.getData("Text");if(he){var ve;if(t.state.draggingText&&!t.state.draggingText.copy&&(ve=t.listSelections()),ja(t.doc,bi(r,r)),ve)for(var Re=0;Re=0;X--)Xi(e.doc,"",n[X].from,n[X].to,"+delete");Hi(e)})}function yo(e,t,r){var n=Oe(e.text,t+r,r);return n<0||n>e.text.length?null:n}function bo(e,t,r){var n=yo(e,t.ch,r);return n==null?null:new Ge(t.line,n,r<0?"after":"before")}function Eo(e,t,r,n,o){if(e){t.doc.direction=="rtl"&&(o=-o);var R=ht(r,t.doc.direction);if(R){var j=o<0?Ee(R):R[0],X=o<0==(j.level==1),J=X?"after":"before",ee;if(j.level>0||t.doc.direction=="rtl"){var he=vt(t,r);ee=o<0?r.text.length-1:0;var ve=Ct(t,he,ee).top;ee=lt(function(Re){return Ct(t,he,Re).top==ve},o<0==(j.level==1)?j.from:j.to-1,ee),J=="before"&&(ee=yo(r,ee,1))}else ee=o<0?j.to:j.from;return new Ge(n,ee,J)}}return new Ge(n,o<0?r.text.length:0,o<0?"before":"after")}function Ml(e,t,r,n){var o=ht(t,e.doc.direction);if(!o)return bo(t,r,n);r.ch>=t.text.length?(r.ch=t.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after");var R=nt(o,r.ch,r.sticky),j=o[R];if(e.doc.direction=="ltr"&&j.level%2==0&&(n>0?j.to>r.ch:j.from=j.from&&Re>=he.begin)){var Se=ve?"before":"after";return new Ge(r.line,Re,Se)}}var Ke=function(At,Ut,Rt){for(var Wt=function(Wn,Tr){return Tr?new Ge(r.line,X(Wn,1),"before"):new Ge(r.line,Wn,"after")};At>=0&&At0==(tn.level!=1),pn=Yt?Rt.begin:X(Rt.end,-1);if(tn.from<=pn&&pn0?he.end:X(he.begin,-1);return gt!=null&&!(n>0&>==t.text.length)&&(et=Ke(n>0?0:o.length-1,n,ee(gt)),et)?et:null}var xa={selectAll:us,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),_e)},killLine:function(e){return Ji(e,function(t){if(t.empty()){var r=Ve(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line0)o=new Ge(o.line,o.ch+1),e.replaceRange(R.charAt(o.ch-1)+R.charAt(o.ch-2),Ge(o.line,o.ch-2),o,"+transpose");else if(o.line>e.doc.first){var j=Ve(e.doc,o.line-1).text;j&&(o=new Ge(o.line,1),e.replaceRange(R.charAt(0)+e.doc.lineSeparator()+j.charAt(j.length-1),Ge(o.line-1,j.length-1),o,"+transpose"))}}r.push(new Pn(o,o))}e.setSelections(r)})},newlineAndIndent:function(e){return zr(e,function(){for(var t=e.listSelections(),r=t.length-1;r>=0;r--)e.replaceRange(e.doc.lineSeparator(),t[r].anchor,t[r].head,"+input");t=e.listSelections();for(var n=0;ne&&wt(t,this.pos)==0&&r==this.button};var Ca,Sa;function Wl(e,t){var r=+new Date;return Sa&&Sa.compare(r,e,t)?(Ca=Sa=null,"triple"):Ca&&Ca.compare(r,e,t)?(Sa=new _o(r,e,t),Ca=null,"double"):(Ca=new _o(r,e,t),Sa=null,"single")}function ks(e){var t=this,r=t.display;if(Ze(t,e)||r.activeTouch&&r.input.supportsTouch())return;if(r.input.ensurePolled(),r.shift=e.shiftKey,ri(r,e)){O||(r.scroller.draggable=!1,setTimeout(function(){return r.scroller.draggable=!0},100));return}if(Co(t,e))return;var n=Di(t,e),o=we(e),R=n?Wl(n,o):"single";if(window.focus(),o==1&&t.state.selectingText&&t.state.selectingText(e),n&&Hl(t,o,n,R,e))return;o==1?n?Gl(t,n,R,e):ue(e)==r.scroller&&ne(e):o==2?(n&&Fa(t.doc,n),setTimeout(function(){return r.input.focus()},20)):o==3&&(u?t.display.input.onContextMenu(e):Mo(t))}function Hl(e,t,r,n,o){var R="Click";return n=="double"?R="Double"+R:n=="triple"&&(R="Triple"+R),R=(t==1?"Left":t==2?"Middle":"Right")+R,_a(e,Ss(R,o),o,function(j){if(typeof j=="string"&&(j=xa[j]),!j)return!1;var X=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),X=j(e,r)!=Ce}finally{e.state.suppressEdits=!1}return X})}function Kl(e,t,r){var n=e.getOption("configureMouse"),o=n?n(e,t,r):{};if(o.unit==null){var R=c?r.shiftKey&&r.metaKey:r.altKey;o.unit=R?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(o.extend==null||e.doc.extend)&&(o.extend=e.doc.extend||r.shiftKey),o.addNew==null&&(o.addNew=i?r.metaKey:r.ctrlKey),o.moveOnDrag==null&&(o.moveOnDrag=!(i?r.altKey:r.ctrlKey)),o}function Gl(e,t,r,n){K?setTimeout(G(ko,e),0):e.curOp.focus=k();var o=Kl(e,r,n),R=e.doc.sel,j;e.options.dragDrop&&Le&&!e.isReadOnly()&&r=="single"&&(j=R.contains(t))>-1&&(wt((j=R.ranges[j]).from(),t)<0||t.xRel>0)&&(wt(j.to(),t)>0||t.xRel<0)?zl(e,n,t,o):Vl(e,n,t,o)}function zl(e,t,r,n){var o=e.display,R=!1,j=Cr(e,function(ee){O&&(o.scroller.draggable=!1),e.state.draggingText=!1,Tt(o.wrapper.ownerDocument,"mouseup",j),Tt(o.wrapper.ownerDocument,"mousemove",X),Tt(o.scroller,"dragstart",J),Tt(o.scroller,"drop",j),R||(ne(ee),n.addNew||Fa(e.doc,r,null,null,n.extend),O&&!P||K&&N==9?setTimeout(function(){o.wrapper.ownerDocument.body.focus({preventScroll:!0}),o.input.focus()},20):o.input.focus())}),X=function(ee){R=R||Math.abs(t.clientX-ee.clientX)+Math.abs(t.clientY-ee.clientY)>=10},J=function(){return R=!0};O&&(o.scroller.draggable=!0),e.state.draggingText=j,j.copy=!n.moveOnDrag,o.scroller.dragDrop&&o.scroller.dragDrop(),ke(o.wrapper.ownerDocument,"mouseup",j),ke(o.wrapper.ownerDocument,"mousemove",X),ke(o.scroller,"dragstart",J),ke(o.scroller,"drop",j),Mo(e),setTimeout(function(){return o.input.focus()},20)}function Ms(e,t,r){if(r=="char")return new Pn(t,t);if(r=="word")return e.findWordAt(t);if(r=="line")return new Pn(Ge(t.line,0),p(e.doc,Ge(t.line+1,0)));var n=r(e,t);return new Pn(n.from,n.to)}function Vl(e,t,r,n){var o=e.display,R=e.doc;ne(t);var j,X,J=R.sel,ee=J.ranges;if(n.addNew&&!n.extend?(X=R.sel.contains(r),X>-1?j=ee[X]:j=new Pn(r,r)):(j=R.sel.primary(),X=R.sel.primIndex),n.unit=="rectangle")n.addNew||(j=new Pn(r,r)),r=Di(e,t,!0,!0),X=-1;else{var he=Ms(e,r,n.unit);n.extend?j=go(j,he.anchor,he.head,n.extend):j=he}n.addNew?X==-1?(X=ee.length,Dr(R,ai(e,ee.concat([j]),X),{scroll:!1,origin:"*mouse"})):ee.length>1&&ee[X].empty()&&n.unit=="char"&&!n.extend?(Dr(R,ai(e,ee.slice(0,X).concat(ee.slice(X+1)),0),{scroll:!1,origin:"*mouse"}),J=R.sel):vo(R,X,j,le):(X=0,Dr(R,new Yr([j],0),le),J=R.sel);var ve=r;function Re(Rt){if(wt(ve,Rt)==0)return;if(ve=Rt,n.unit=="rectangle"){for(var Wt=[],tn=e.options.tabSize,Yt=te(Ve(R,r.line).text,r.ch,tn),pn=te(Ve(R,Rt.line).text,Rt.ch,tn),Wn=Math.min(Yt,pn),Tr=Math.max(Yt,pn),Jn=Math.min(r.line,Rt.line),Vr=Math.min(e.lastLine(),Math.max(r.line,Rt.line));Jn<=Vr;Jn++){var Wr=Ve(R,Jn).text,ur=ge(Wr,Wn,tn);Wn==Tr?Wt.push(new Pn(Ge(Jn,ur),Ge(Jn,ur))):Wr.length>ur&&Wt.push(new Pn(Ge(Jn,ur),Ge(Jn,ge(Wr,Tr,tn))))}Wt.length||Wt.push(new Pn(r,r)),Dr(R,ai(e,J.ranges.slice(0,X).concat(Wt),X),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Rt)}else{var Hr=j,Lr=Ms(e,Rt,n.unit),hr=Hr.anchor,dr;wt(Lr.anchor,hr)>0?(dr=Lr.head,hr=Fn(Hr.from(),Lr.anchor)):(dr=Lr.anchor,hr=Ar(Hr.to(),Lr.head));var Zn=J.ranges.slice(0);Zn[X]=Xl(e,new Pn(p(R,hr),dr)),Dr(R,ai(e,Zn,X),le)}}var Se=o.wrapper.getBoundingClientRect(),Ke=0;function et(Rt){var Wt=++Ke,tn=Di(e,Rt,!0,n.unit=="rectangle");if(!tn)return;if(wt(tn,ve)!=0){e.curOp.focus=k(),Re(tn);var Yt=ka(o,R);(tn.line>=Yt.to||tn.lineSe.bottom?20:0;pn&&setTimeout(Cr(e,function(){if(Ke!=Wt)return;o.scroller.scrollTop+=pn,et(Rt)}),50)}}function gt(Rt){e.state.selectingText=!1,Ke=Infinity,Rt&&(ne(Rt),o.input.focus()),Tt(o.wrapper.ownerDocument,"mousemove",At),Tt(o.wrapper.ownerDocument,"mouseup",Ut),R.history.lastSelOrigin=null}var At=Cr(e,function(Rt){Rt.buttons===0||!we(Rt)?gt(Rt):et(Rt)}),Ut=Cr(e,gt);e.state.selectingText=Ut,ke(o.wrapper.ownerDocument,"mousemove",At),ke(o.wrapper.ownerDocument,"mouseup",Ut)}function Xl(e,t){var r=t.anchor,n=t.head,o=Ve(e.doc,r.line);if(wt(r,n)==0&&r.sticky==n.sticky)return t;var R=ht(o);if(!R)return t;var j=nt(R,r.ch,r.sticky),X=R[j];if(X.from!=r.ch&&X.to!=r.ch)return t;var J=j+(X.from==r.ch==(X.level!=1)?0:1);if(J==0||J==R.length)return t;var ee;if(n.line!=r.line)ee=(n.line-r.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var he=nt(R,n.ch,n.sticky),ve=he-j||(n.ch-r.ch)*(X.level==1?-1:1);he==J-1||he==J?ee=ve<0:ee=ve>0}var Re=R[J+(ee?-1:0)],Se=ee==(Re.level==1),Ke=Se?Re.from:Re.to,et=Se?"after":"before";return r.ch==Ke&&r.sticky==et?t:new Pn(new Ge(r.line,Ke,et),n)}function Is(e,t,r,n){var o,R;if(t.touches)o=t.touches[0].clientX,R=t.touches[0].clientY;else try{o=t.clientX,R=t.clientY}catch(Re){return!1}if(o>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&ne(t);var j=e.display,X=j.lineDiv.getBoundingClientRect();if(R>X.bottom||!fe(e,r))return ae(t);R-=X.top-j.viewOffset;for(var J=0;J=o){var he=En(e.doc,R),ve=e.display.gutterSpecs[J];return Ue(e,r,e,he,ve.className,t),ae(t)}}}function Co(e,t){return Is(e,t,"gutterClick",!0)}function Ns(e,t){if(ri(e.display,t)||$l(e,t))return;if(Ze(e,t,"contextmenu"))return;u||e.display.input.onContextMenu(t)}function $l(e,t){return fe(e,"gutterContextMenu")?Is(e,t,"gutterContextMenu",!1):!1}function Us(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Gn(e)}var Qi={toString:function(){return"CodeMirror.Init"}},Bs={},Va={};function Yl(e){var t=e.optionHandlers;function r(n,o,R,j){e.defaults[n]=o,R&&(t[n]=j?function(X,J,ee){ee!=Qi&&R(X,J,ee)}:R)}e.defineOption=r,e.Init=Qi,r("value","",function(n,o){return n.setValue(o)},!0),r("mode",null,function(n,o){n.doc.modeOption=o,fo(n)},!0),r("indentUnit",2,fo,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,function(n){ha(n),Gn(n),Fr(n)},!0),r("lineSeparator",null,function(n,o){if(n.doc.lineSep=o,!o)return;var R=[],j=n.doc.first;n.doc.iter(function(J){for(var ee=0;;){var he=J.text.indexOf(o,ee);if(he==-1)break;ee=he+o.length,R.push(Ge(j,he))}j++});for(var X=R.length-1;X>=0;X--)Xi(n.doc,o,R[X],Ge(R[X].line,R[X].ch+o.length))}),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(n,o,R){n.state.specialChars=new RegExp(o.source+(o.test(" ")?"":"| "),"g"),R!=Qi&&n.refresh()}),r("specialCharPlaceholder",kn,function(n){return n.refresh()},!0),r("electricChars",!0),r("inputStyle",l?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),r("spellcheck",!1,function(n,o){return n.getInputField().spellcheck=o},!0),r("autocorrect",!1,function(n,o){return n.getInputField().autocorrect=o},!0),r("autocapitalize",!1,function(n,o){return n.getInputField().autocapitalize=o},!0),r("rtlMoveVisually",!C),r("wholeLineUpdateBefore",!0),r("theme","default",function(n){Us(n),ca(n)},!0),r("keyMap","default",function(n,o,R){var j=Ga(o),X=R!=Qi&&Ga(R);X&&X.detach&&X.detach(n,j),j.attach&&j.attach(n,X||null)}),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,Ql,!0),r("gutters",[],function(n,o){n.display.gutterSpecs=co(o,n.options.lineNumbers),ca(n)},!0),r("fixedGutter",!0,function(n,o){n.display.gutters.style.left=o?ia(n.display)+"px":"0",n.refresh()},!0),r("coverGutterNextToScrollbar",!1,function(n){return Ki(n)},!0),r("scrollbarStyle","native",function(n){jo(n),Ki(n),n.display.scrollbars.setScrollTop(n.doc.scrollTop),n.display.scrollbars.setScrollLeft(n.doc.scrollLeft)},!0),r("lineNumbers",!1,function(n,o){n.display.gutterSpecs=co(n.options.gutters,o),ca(n)},!0),r("firstLineNumber",1,ca,!0),r("lineNumberFormatter",function(n){return n},ca,!0),r("showCursorWhenSelecting",!1,aa,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("selectionsMayTouch",!1),r("readOnly",!1,function(n,o){o=="nocursor"&&(Wi(n),n.display.input.blur()),n.display.input.readOnlyChanged(o)}),r("screenReaderLabel",null,function(n,o){o=o===""?null:o,n.display.input.screenReaderLabelChanged(o)}),r("disableInput",!1,function(n,o){o||n.display.input.reset()},!0),r("dragDrop",!0,Jl),r("allowDropFileTypes",null),r("cursorBlinkRate",530),r("cursorScrollMargin",0),r("cursorHeight",1,aa,!0),r("singleCursorHeightPerLine",!0,aa,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,ha,!0),r("addModeClass",!1,ha,!0),r("pollInterval",100),r("undoDepth",200,function(n,o){return n.doc.history.undoDepth=o}),r("historyEventDelay",1250),r("viewportMargin",10,function(n){return n.refresh()},!0),r("maxHighlightLength",1e4,ha,!0),r("moveInputWithCursor",!0,function(n,o){o||n.display.input.resetPosition()}),r("tabindex",null,function(n,o){return n.display.input.getField().tabIndex=o||""}),r("autofocus",null),r("direction","ltr",function(n,o){return n.doc.setDirection(o)},!0),r("phrases",null)}function Jl(e,t,r){var n=r&&r!=Qi;if(!t!=!n){var o=e.display.dragFunctions,R=t?ke:Tt;R(e.display.scroller,"dragstart",o.start),R(e.display.scroller,"dragenter",o.enter),R(e.display.scroller,"dragover",o.over),R(e.display.scroller,"dragleave",o.leave),R(e.display.scroller,"drop",o.drop)}}function Ql(e){e.options.lineWrapping?(H(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(d(e.display.wrapper,"CodeMirror-wrap"),ni(e)),to(e),Fr(e),Gn(e),setTimeout(function(){return Ki(e)},100)}function $n(e,t){var r=this;if(!(this instanceof $n))return new $n(e,t);this.options=t=t?B(t):{},B(Bs,t,!1);var n=t.value;typeof n=="string"?n=new jr(n,t.mode,null,t.lineSeparator,t.direction):t.mode&&(n.modeOption=t.mode),this.doc=n;var o=new $n.inputStyles[t.inputStyle](this),R=this.display=new dl(e,n,o,t);R.wrapper.CodeMirror=this,Us(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),jo(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 ce,keySeq:null,specialChars:null},t.autofocus&&!l&&R.input.focus(),K&&N<11&&setTimeout(function(){return r.display.input.reset(!0)},20),Zl(this),Ll(),Ii(this),this.curOp.forceUpdate=!0,Jo(this,n),t.autofocus&&!l||this.hasFocus()?setTimeout(function(){r.hasFocus()&&!r.state.focused&&ro(r)},20):Wi(this);for(var j in Va)Va.hasOwnProperty(j)&&Va[j](this,t[j],Qi);Ko(this),t.finishInit&&t.finishInit(this);for(var X=0;X20*20}ke(t.scroller,"touchstart",function(J){if(!Ze(e,J)&&!R(J)&&!Co(e,J)){t.input.ensurePolled(),clearTimeout(r);var ee=+new Date;t.activeTouch={start:ee,moved:!1,prev:ee-n.end<=300?n:null},J.touches.length==1&&(t.activeTouch.left=J.touches[0].pageX,t.activeTouch.top=J.touches[0].pageY)}}),ke(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),ke(t.scroller,"touchend",function(J){var ee=t.activeTouch;if(ee&&!ri(t,J)&&ee.left!=null&&!ee.moved&&new Date-ee.start<300){var he=e.coordsChar(t.activeTouch,"page"),ve;!ee.prev||j(ee,ee.prev)?ve=new Pn(he,he):!ee.prev.prev||j(ee,ee.prev.prev)?ve=e.findWordAt(he):ve=new Pn(Ge(he.line,0),p(e.doc,Ge(he.line+1,0))),e.setSelection(ve.anchor,ve.head),e.focus(),ne(J)}o()}),ke(t.scroller,"touchcancel",o),ke(t.scroller,"scroll",function(){t.scroller.clientHeight&&(sa(e,t.scroller.scrollTop),ki(e,t.scroller.scrollLeft,!0),Ue(e,"scroll",e))}),ke(t.scroller,"mousewheel",function(J){return Vo(e,J)}),ke(t.scroller,"DOMMouseScroll",function(J){return Vo(e,J)}),ke(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(J){Ze(e,J)||de(J)},over:function(J){Ze(e,J)||(Rl(e,J),de(J))},start:function(J){return Al(e,J)},drop:Cr(e,wl),leave:function(J){Ze(e,J)||Es(e)}};var X=t.input.getField();ke(X,"keyup",function(J){return Ds.call(e,J)}),ke(X,"keydown",Cr(e,Ps)),ke(X,"keypress",Cr(e,Os)),ke(X,"focus",function(J){return ro(e,J)}),ke(X,"blur",function(J){return Wi(e,J)})}var So=[];$n.defineInitHook=function(e){return So.push(e)};function Ta(e,t,r,n){var o=e.doc,R;r==null&&(r="add"),r=="smart"&&(o.mode.indent?R=ct(e,t).state:r="prev");var j=e.options.tabSize,X=Ve(o,t),J=te(X.text,null,j);X.stateAfter&&(X.stateAfter=null);var ee=X.text.match(/^\s*/)[0],he;if(!n&&!/\S/.test(X.text))he=0,r="not";else if(r=="smart"&&(he=o.mode.indent(R,X.text.slice(ee.length),X.text),he==Ce||he>150)){if(!n)return;r="prev"}r=="prev"?t>o.first?he=te(Ve(o,t-1).text,null,j):he=0:r=="add"?he=J+e.options.indentUnit:r=="subtract"?he=J-e.options.indentUnit:typeof r=="number"&&(he=J+r),he=Math.max(0,he);var ve="",Re=0;if(e.options.indentWithTabs)for(var Se=Math.floor(he/j);Se;--Se)Re+=j,ve+=" ";if(Rej,J=ut(t),ee=null;if(X&&n.ranges.length>1)if(oi&&oi.text.join(` `)==t){if(n.ranges.length%oi.text.length==0){ee=[];for(var he=0;he=0;Re--){var Se=n.ranges[Re],Ke=Se.from(),et=Se.to();Se.empty()&&(r&&r>0?Ke=Ge(Ke.line,Ke.ch-r):e.state.overwrite&&!X?et=Ge(et.line,Math.min(Ve(R,et.line).text.length,et.ch+Ee(J).length)):X&&oi&&oi.lineWise&&oi.text.join(` `)==J.join(` `)&&(Ke=et=Ge(Ke.line,0)));var gt={from:Ke,to:et,text:ee?ee[Re%ee.length]:J,origin:o||(X?"paste":e.state.cutIncoming>j?"cut":"+input")};Vi(e.doc,gt),cr(e,"inputRead",e,gt)}t&&!X&&js(e,t),Hi(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ve),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Fs(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&zr(t,function(){return To(t,r,0,null,"paste")}),!0}function js(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var r=e.doc.sel,n=r.ranges.length-1;n>=0;n--){var o=r.ranges[n];if(o.head.ch>100||n&&r.ranges[n-1].head.line==o.head.line)continue;var R=e.getModeAt(o.head),j=!1;if(R.electricChars){for(var X=0;X-1){j=Ta(e,o.head.line,"smart");break}}else R.electricInput&&(R.electricInput.test(Ve(e.doc,o.head.line).text.slice(0,o.head.ch))&&(j=Ta(e,o.head.line,"smart")));j&&cr(e,"electricInput",e,o.head.line)}}function Ws(e){for(var t=[],r=[],n=0;nR&&(Ta(this,X.head.line,n,!0),R=X.head.line,j==this.doc.sel.primIndex&&Hi(this));else{var J=X.from(),ee=X.to(),he=Math.max(R,J.line);R=Math.min(this.lastLine(),ee.line-(ee.ch?0:1))+1;for(var ve=he;ve0&&vo(this.doc,j,new Pn(J,Re[j].to()),_e)}}}),getTokenAt:function(n,o){return Rn(this,n,o)},getLineTokens:function(n,o){return Rn(this,Ge(n),o,!0)},getTokenTypeAt:function(n){n=p(this.doc,n);var o=$e(this,Ve(this.doc,n.line)),R=0,j=(o.length-1)/2,X=n.ch,J;if(X==0)J=o[2];else for(;;){var ee=R+j>>1;if((ee?o[ee*2-1]:0)>=X)j=ee;else if(o[ee*2+1]J&&(n=J,j=!0),X=Ve(this.doc,n)}else X=n;return Qn(this,X,{top:0,left:0},o||"page",R||j).top+(j?this.doc.height-Xr(X):0)},defaultTextHeight:function(){return _r(this.display)},defaultCharWidth:function(){return Br(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(n,o,R,j,X){var J=this.display;n=rn(this,p(this.doc,n));var ee=n.bottom,he=n.left;if(o.style.position="absolute",o.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(o),J.sizer.appendChild(o),j=="over")ee=n.top;else if(j=="above"||j=="near"){var ve=Math.max(J.wrapper.clientHeight,this.doc.height),Re=Math.max(J.sizer.clientWidth,J.lineSpace.clientWidth);(j=="above"||n.bottom+o.offsetHeight>ve)&&n.top>o.offsetHeight?ee=n.top-o.offsetHeight:n.bottom+o.offsetHeight<=ve&&(ee=n.bottom),he+o.offsetWidth>Re&&(he=Re-o.offsetWidth)}o.style.top=ee+"px",o.style.left=o.style.right="",X=="right"?(he=J.sizer.clientWidth-o.offsetWidth,o.style.right="0px"):(X=="left"?he=0:X=="middle"&&(he=(J.sizer.clientWidth-o.offsetWidth)/2),o.style.left=he+"px"),R&&Js(this,{left:he,top:ee,right:he+o.offsetWidth,bottom:ee+o.offsetHeight})},triggerOnKeyDown:Nr(Ps),triggerOnKeyPress:Nr(Os),triggerOnKeyUp:Ds,triggerOnMouseDown:Nr(ks),execCommand:function(n){if(xa.hasOwnProperty(n))return xa[n].call(null,this)},triggerElectric:Nr(function(n){js(this,n)}),findPosH:function(n,o,R,j){var X=1;o<0&&(X=-1,o=-o);for(var J=p(this.doc,n),ee=0;ee0&&he(R.charAt(j-1));)--j;for(;X.5||this.options.lineWrapping)&&to(this),Ue(this,"refresh",this)}),swapDoc:Nr(function(n){var o=this.doc;return o.cm=null,this.state.selectingText&&this.state.selectingText(),Jo(this,n),Gn(this),this.display.input.reset(),oa(this,n.scrollLeft,n.scrollTop),this.curOp.forceScroll=!0,cr(this,"swapDoc",this,o),o}),phrase:function(n){var o=this.options.phrases;return o&&Object.prototype.hasOwnProperty.call(o,n)?o[n]:n},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}},be(e),e.registerHelper=function(n,o,R){r.hasOwnProperty(n)||(r[n]=e[n]={_global:[]}),r[n][o]=R},e.registerGlobalHelper=function(n,o,R,j){e.registerHelper(n,o,j),r[n]._global.push({pred:R,val:j})}}function wo(e,t,r,n,o){var R=t,j=r,X=Ve(e,t.line),J=o&&e.direction=="rtl"?-r:r;function ee(){var Ut=t.line+J;return Ut=e.first+e.size?!1:(t=new Ge(Ut,t.ch,t.sticky),X=Ve(e,Ut))}function he(Ut){var Rt;if(n=="codepoint"){var Wt=X.text.charCodeAt(t.ch+(n>0?0:-1));isNaN(Wt)?Rt=null:Rt=new Ge(t.line,Math.max(0,Math.min(X.text.length,t.ch+r*(Wt>=55296&&Wt<56320?2:1))),-r)}else o?Rt=Ml(e.cm,X,t,r):Rt=bo(X,t,r);if(Rt==null)if(!Ut&&ee())t=Eo(o,e.cm,X,t.line,J);else return!1;else t=Rt;return!0}if(n=="char"||n=="codepoint")he();else if(n=="column")he(!0);else if(n=="word"||n=="group")for(var ve=null,Re=n=="group",Se=e.cm&&e.cm.getHelper(t,"wordChars"),Ke=!0;!(r<0&&!he(!Ke));Ke=!1){var et=X.text.charAt(t.ch)||` `,gt=Fe(et,Se)?"w":Re&&et==` `?"n":!Re||/\s/.test(et)?null:"p";if(Re&&!Ke&&!gt&&(gt="s"),ve&&ve!=gt){r<0&&(r=1,he(),t.sticky="after");break}if(gt&&(ve=gt),r>0&&!he(!Ke))break}var At=Wa(e,t,R,j,!0);return Hn(R,At)&&(At.hitSide=!0),At}function Gs(e,t,r,n){var o=e.doc,R=t.left,j;if(n=="page"){var X=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),J=Math.max(X-.5*_r(e.display),3);j=(r>0?t.bottom:t.top)+r*J}else n=="line"&&(j=r>0?t.bottom+3:t.top-3);for(var ee;!(ee=Er(e,R,j),!ee.outside);){if(r<0?j<=0:j>=o.height){ee.hitSide=!0;break}j+=r*5}return ee}var Nn=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ce,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Nn.prototype.init=function(e){var t=this,r=this,n=r.cm,o=r.div=e.lineDiv;Hs(o,n.options.spellcheck,n.options.autocorrect,n.options.autocapitalize);function R(X){for(var J=X.target;J;J=J.parentNode){if(J==o)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(J.className))break}return!1}ke(o,"paste",function(X){if(!R(X)||Ze(n,X)||Fs(X,n))return;N<=11&&setTimeout(Cr(n,function(){return t.updateFromDOM()}),20)}),ke(o,"compositionstart",function(X){t.composing={data:X.data,done:!1}}),ke(o,"compositionupdate",function(X){t.composing||(t.composing={data:X.data,done:!1})}),ke(o,"compositionend",function(X){t.composing&&(X.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),ke(o,"touchstart",function(){return r.forceCompositionEnd()}),ke(o,"input",function(){t.composing||t.readFromDOMSoon()});function j(X){if(!R(X)||Ze(n,X))return;if(n.somethingSelected())Xa({lineWise:!1,text:n.getSelections()}),X.type=="cut"&&n.replaceSelection("",null,"cut");else if(n.options.lineWiseCopyCut){var J=Ws(n);Xa({lineWise:!0,text:J.text}),X.type=="cut"&&n.operation(function(){n.setSelections(J.ranges,0,_e),n.replaceSelection("",null,"cut")})}else return;if(X.clipboardData){X.clipboardData.clearData();var ee=oi.text.join(` `);if(X.clipboardData.setData("Text",ee),X.clipboardData.getData("Text")==ee){X.preventDefault();return}}var he=Ks(),ve=he.firstChild;n.display.lineSpace.insertBefore(he,n.display.lineSpace.firstChild),ve.value=oi.text.join(` `);var Re=document.activeElement;Z(ve),setTimeout(function(){n.display.lineSpace.removeChild(he),Re.focus(),Re==o&&r.showPrimarySelection()},50)}ke(o,"copy",j),ke(o,"cut",j)},Nn.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Nn.prototype.prepareSelection=function(){var e=Do(this.cm,!1);return e.focus=document.activeElement==this.div,e},Nn.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Nn.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Nn.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,r=t.doc.sel.primary(),n=r.from(),o=r.to();if(t.display.viewTo==t.display.viewFrom||n.line>=t.display.viewTo||o.line=t.display.viewFrom&&zs(t,n)||{node:X[0].measure.map[2],offset:0},ee=o.linee.firstLine()&&(n=Ge(n.line-1,Ve(e.doc,n.line-1).length)),o.ch==Ve(e.doc,o.line).text.length&&o.linet.viewTo-1)return!1;var R,j,X;n.line==t.viewFrom||(R=Oi(e,n.line))==0?(j=qt(t.view[0].line),X=t.view[0].node):(j=qt(t.view[R].line),X=t.view[R-1].node.nextSibling);var J=Oi(e,o.line),ee,he;if(J==t.view.length-1?(ee=t.viewTo-1,he=t.lineDiv.lastChild):(ee=qt(t.view[J+1].line)-1,he=t.view[J+1].node.previousSibling),!X)return!1;for(var ve=e.doc.splitLines(tu(e,X,he,j,ee)),Re=ln(e.doc,Ge(j,0),Ge(ee,Ve(e.doc,ee).text.length));ve.length>1&&Re.length>1;)if(Ee(ve)==Ee(Re))ve.pop(),Re.pop(),ee--;else if(ve[0]==Re[0])ve.shift(),Re.shift(),j++;else break;for(var Se=0,Ke=0,et=ve[0],gt=Re[0],At=Math.min(et.length,gt.length);Sen.ch&&Ut.charCodeAt(Ut.length-Ke-1)==Rt.charCodeAt(Rt.length-Ke-1);)Se--,Ke++;ve[ve.length-1]=Ut.slice(0,Ut.length-Ke).replace(/^\u200b+/,""),ve[0]=ve[0].slice(Se).replace(/\u200b+$/,"");var tn=Ge(j,Se),Yt=Ge(ee,Re.length?Ee(Re).length-Ke:0);if(ve.length>1||ve[0]||wt(tn,Yt))return Xi(e.doc,ve,tn,Yt,"+input"),!0},Nn.prototype.ensurePolled=function(){this.forceCompositionEnd()},Nn.prototype.reset=function(){this.forceCompositionEnd()},Nn.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Nn.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)},Nn.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&zr(this.cm,function(){return Fr(e.cm)})},Nn.prototype.setUneditable=function(e){e.contentEditable="false"},Nn.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Cr(this.cm,To)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Nn.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Nn.prototype.onContextMenu=function(){},Nn.prototype.resetPosition=function(){},Nn.prototype.needsContentAttribute=!0;function zs(e,t){var r=Et(e,t.line);if(!r||r.hidden)return null;var n=Ve(e.doc,t.line),o=dt(r,n,t.line),R=ht(n,e.doc.direction),j="left";if(R){var X=nt(R,t.ch);j=X%2?"right":"left"}var J=dn(o.map,t.ch,j);return J.offset=J.collapse=="right"?J.end:J.start,J}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Zi(e,t){return t&&(e.bad=!0),e}function tu(e,t,r,n,o){var R="",j=!1,X=e.doc.lineSeparator(),J=!1;function ee(Se){return function(Ke){return Ke.id==Se}}function he(){j&&(R+=X,J&&(R+=X),j=J=!1)}function ve(Se){Se&&(he(),R+=Se)}function Re(Se){if(Se.nodeType==1){var Ke=Se.getAttribute("cm-text");if(Ke){ve(Ke);return}var et=Se.getAttribute("cm-marker"),gt;if(et){var At=e.findMarks(Ge(n,0),Ge(o+1,0),ee(+et));At.length&&(gt=At[0].find(0))&&ve(ln(e.doc,gt.from,gt.to).join(X));return}if(Se.getAttribute("contenteditable")=="false")return;var Ut=/^(pre|div|p|li|table|br)$/i.test(Se.nodeName);if(!/^br$/i.test(Se.nodeName)&&Se.textContent.length==0)return;Ut&&he();for(var Rt=0;Rt=9&&t.hasSelection&&(t.hasSelection=null),r.poll()}),ke(o,"paste",function(j){if(Ze(n,j)||Fs(j,n))return;n.state.pasteIncoming=+new Date,r.fastPoll()});function R(j){if(Ze(n,j))return;if(n.somethingSelected())Xa({lineWise:!1,text:n.getSelections()});else if(n.options.lineWiseCopyCut){var X=Ws(n);Xa({lineWise:!0,text:X.text}),j.type=="cut"?n.setSelections(X.ranges,null,_e):(r.prevInput="",o.value=X.text.join(` `),Z(o))}else return;j.type=="cut"&&(n.state.cutIncoming=+new Date)}ke(o,"cut",R),ke(o,"copy",R),ke(e.scroller,"paste",function(j){if(ri(e,j)||Ze(n,j))return;if(!o.dispatchEvent){n.state.pasteIncoming=+new Date,r.focus();return}var X=new Event("paste");X.clipboardData=j.clipboardData,o.dispatchEvent(X)}),ke(e.lineSpace,"selectstart",function(j){ri(e,j)||ne(j)}),ke(o,"compositionstart",function(){var j=n.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:j,range:n.markText(j,n.getCursor("to"),{className:"CodeMirror-composing"})}}),ke(o,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},rr.prototype.createField=function(e){this.wrapper=Ks(),this.textarea=this.wrapper.firstChild},rr.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},rr.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=Do(e);if(e.options.moveInputWithCursor){var o=rn(e,r.sel.primary().head,"div"),R=t.wrapper.getBoundingClientRect(),j=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,o.top+j.top-R.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,o.left+j.left-R.left))}return n},rr.prototype.showSelection=function(e){var t=this.cm,r=t.display;s(r.cursorDiv,e.cursors),s(r.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},rr.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var r=t.getSelection();this.textarea.value=r,t.state.focused&&Z(this.textarea),K&&N>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",K&&N>=9&&(this.hasSelection=null))},rr.prototype.getField=function(){return this.textarea},rr.prototype.supportsTouch=function(){return!1},rr.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!l||k()!=this.textarea))try{this.textarea.focus()}catch(e){}},rr.prototype.blur=function(){this.textarea.blur()},rr.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},rr.prototype.receivedFocus=function(){this.slowPoll()},rr.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()})},rr.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function r(){var n=t.poll();!n&&!e?(e=!0,t.polling.set(60,r)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,r)},rr.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||mt(r)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var o=r.value;if(o==n&&!t.somethingSelected())return!1;if(K&&N>=9&&this.hasSelection===o||i&&/[\uf700-\uf7ff]/.test(o))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var R=o.charCodeAt(0);if(R==8203&&!n&&(n="\u200B"),R==8666)return this.reset(),this.cm.execCommand("undo")}for(var j=0,X=Math.min(n.length,o.length);j1e3||o.indexOf(` `)>-1?r.value=e.prevInput="":e.prevInput=o,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},rr.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},rr.prototype.onKeyPress=function(){K&&N>=9&&(this.hasSelection=null),this.fastPoll()},rr.prototype.onContextMenu=function(e){var t=this,r=t.cm,n=r.display,o=t.textarea;t.contextMenuPending&&t.contextMenuPending();var R=Di(r,e),j=n.scroller.scrollTop;if(!R||A)return;var X=r.options.resetSelectionOnContextMenu;X&&r.doc.sel.contains(R)==-1&&Cr(r,Dr)(r.doc,bi(R),_e);var J=o.style.cssText,ee=t.wrapper.style.cssText,he=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",o.style.cssText=`position: absolute; width: 30px; height: 30px; top: `+(e.clientY-he.top-5)+"px; left: "+(e.clientX-he.left-5)+`px; z-index: 1000; background: `+(K?"rgba(255, 255, 255, .05)":"transparent")+`; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ve;O&&(ve=window.scrollY),n.input.focus(),O&&window.scrollTo(null,ve),n.input.reset(),r.somethingSelected()||(o.value=t.prevInput=" "),t.contextMenuPending=Se,n.selForContextMenu=r.doc.sel,clearTimeout(n.detectingSelectAll);function Re(){if(o.selectionStart!=null){var et=r.somethingSelected(),gt="\u200B"+(et?o.value:"");o.value="\u21DA",o.value=gt,t.prevInput=et?"":"\u200B",o.selectionStart=1,o.selectionEnd=gt.length,n.selForContextMenu=r.doc.sel}}function Se(){if(t.contextMenuPending!=Se)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=ee,o.style.cssText=J,K&&N<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=j),o.selectionStart!=null){(!K||K&&N<9)&&Re();var et=0,gt=function(){n.selForContextMenu==r.doc.sel&&o.selectionStart==0&&o.selectionEnd>0&&t.prevInput=="\u200B"?Cr(r,us)(r):et++<10?n.detectingSelectAll=setTimeout(gt,500):(n.selForContextMenu=null,n.input.reset())};n.detectingSelectAll=setTimeout(gt,200)}}if(K&&N>=9&&Re(),u){de(e);var Ke=function(){Tt(window,"mouseup",Ke),setTimeout(Se,20)};ke(window,"mouseup",Ke)}else setTimeout(Se,50)},rr.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},rr.prototype.setUneditable=function(){},rr.prototype.needsContentAttribute=!1;function ru(e,t){if(t=t?B(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 r=k();t.autofocus=r==e||e.getAttribute("autofocus")!=null&&r==document.body}function n(){e.value=X.getValue()}var o;if(e.form&&(ke(e.form,"submit",n),!t.leaveSubmitMethodAlone)){var R=e.form;o=R.submit;try{var j=R.submit=function(){n(),R.submit=o,R.submit(),R.submit=j}}catch(J){}}t.finishInit=function(J){J.save=n,J.getTextArea=function(){return e},J.toTextArea=function(){J.toTextArea=isNaN,n(),e.parentNode.removeChild(J.getWrapperElement()),e.style.display="",e.form&&(Tt(e.form,"submit",n),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=o))}},e.style.display="none";var X=$n(function(J){return e.parentNode.insertBefore(J,e.nextSibling)},t);return X}function iu(e){e.off=Tt,e.on=ke,e.wheelEventPixels=cl,e.Doc=jr,e.splitLines=ut,e.countColumn=te,e.findColumn=ge,e.isWordChar=Pe,e.Pass=Ce,e.signal=Ue,e.Line=ui,e.changeEnd=Ei,e.scrollbarModel=Fo,e.Pos=Ge,e.cmpPos=wt,e.modes=sn,e.mimeModes=Bt,e.resolveMode=ot,e.getMode=Ft,e.modeExtensions=xt,e.extendMode=kt,e.copyState=Mt,e.startState=Lt,e.innerMode=It,e.commands=xa,e.keyMap=ci,e.keyName=Ts,e.isModifierKey=Cs,e.lookupKey=Yi,e.normalizeKeyMap=kl,e.StringStream=st,e.SharedTextMarker=ya,e.TextMarker=_i,e.LineWidget=va,e.e_preventDefault=ne,e.e_stopPropagation=re,e.e_stop=de,e.addClass=H,e.contains=_,e.rmClass=d,e.keyNames=Ci}Yl($n),ql($n);var au="iter insert remove copy getEditor constructor".split(" ");for(var Ya in jr.prototype)jr.prototype.hasOwnProperty(Ya)&&pe(au,Ya)<0&&($n.prototype[Ya]=function(e){return function(){return e.apply(this.doc,arguments)}}(jr.prototype[Ya]));return be(jr),$n.inputStyles={textarea:rr,contenteditable:Nn},$n.defineMode=function(e){!$n.defaults.mode&&e!="null"&&($n.defaults.mode=e),an.apply(this,arguments)},$n.defineMIME=Qt,$n.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),$n.defineMIME("text/plain","null"),$n.defineExtension=function(e,t){$n.prototype[e]=t},$n.defineDocExtension=function(e,t){jr.prototype[e]=t},$n.fromTextArea=ru,iu($n),$n.version="5.58.2",$n})},WaYH:function(at,Xe,V){"use strict";var oe=V("rePB"),Y=V("Ff2n"),D=V("VTBJ"),$=V("1OyB"),U=V("vuIU"),I=V("JX7q"),K=V("Ji7U"),N=V("LK+K"),O=V("q1tI"),L=V("TSYQ"),x=V.n(L),A=V("sboe"),P=V("OZM5"),w=function(u){var E=u.prefixCls,d=u.level,f=u.isStart,s=u.isEnd;if(!d)return null;for(var a="".concat(E,"-indent-unit"),b=[],g=0;g1&&arguments[1]!==void 0?arguments[1]:!1,se=_e.getAttribute("id")||_e.getAttribute("data-reactid")||_e.getAttribute("name");if(le&&k[se])return k[se];var ge=window.getComputedStyle(_e),ie=ge.getPropertyValue("box-sizing")||ge.getPropertyValue("-moz-box-sizing")||ge.getPropertyValue("-webkit-box-sizing"),q=parseFloat(ge.getPropertyValue("padding-bottom"))+parseFloat(ge.getPropertyValue("padding-top")),Ee=parseFloat(ge.getPropertyValue("border-bottom-width"))+parseFloat(ge.getPropertyValue("border-top-width")),Me=_.map(function(De){return"".concat(De,":").concat(ge.getPropertyValue(De))}).join(";"),Ne={sizingStyle:Me,paddingSize:q,borderSize:Ee,boxSizing:ie};return le&&se&&(k[se]=Ne),Ne}function Z(_e){var le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,se=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,ge=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)),_e.getAttribute("wrap")?H.setAttribute("wrap",_e.getAttribute("wrap")):H.removeAttribute("wrap");var ie=z(_e,le),q=ie.paddingSize,Ee=ie.borderSize,Me=ie.boxSizing,Ne=ie.sizingStyle;H.setAttribute("style","".concat(Ne,";").concat(g)),H.value=_e.value||_e.placeholder||"";var De=Number.MIN_SAFE_INTEGER,Be=Number.MAX_SAFE_INTEGER,Ae=H.scrollHeight,Pe;if(Me==="border-box"?Ae+=Ee:Me==="content-box"&&(Ae-=q),se!==null||ge!==null){H.value=" ";var Fe=H.scrollHeight-q;se!==null&&(De=Fe*se,Me==="border-box"&&(De=De+q+Ee),Ae=Math.max(De,Ae)),ge!==null&&(Be=Fe*ge,Me==="border-box"&&(Be=Be+q+Ee),Pe=Ae>Be?"":"hidden",Ae=Math.min(Be,Ae))}return{height:Ae,minHeight:De,maxHeight:Be,overflowY:Pe,resize:"none"}}var G=V("Gytx"),B=V.n(G),te;(function(_e){_e[_e.NONE=0]="NONE",_e[_e.RESIZING=1]="RESIZING",_e[_e.RESIZED=2]="RESIZED"})(te||(te={}));var ce=function(_e){Object($.a)(se,_e);var le=Object(U.a)(se);function se(ge){var ie;return Object(Y.a)(this,se),ie=le.call(this,ge),ie.nextFrameActionId=void 0,ie.resizeFrameId=void 0,ie.textArea=void 0,ie.saveTextArea=function(q){ie.textArea=q},ie.handleResize=function(q){var Ee=ie.state.resizeStatus,Me=ie.props,Ne=Me.autoSize,De=Me.onResize;if(Ee!==te.NONE)return;typeof De=="function"&&De(q),Ne&&ie.resizeOnNextFrame()},ie.resizeOnNextFrame=function(){cancelAnimationFrame(ie.nextFrameActionId),ie.nextFrameActionId=requestAnimationFrame(ie.resizeTextarea)},ie.resizeTextarea=function(){var q=ie.props.autoSize;if(!q||!ie.textArea)return;var Ee=q.minRows,Me=q.maxRows,Ne=Z(ie.textArea,!1,Ee,Me);ie.setState({textareaStyles:Ne,resizeStatus:te.RESIZING},function(){cancelAnimationFrame(ie.resizeFrameId),ie.resizeFrameId=requestAnimationFrame(function(){ie.setState({resizeStatus:te.RESIZED},function(){ie.resizeFrameId=requestAnimationFrame(function(){ie.setState({resizeStatus:te.NONE}),ie.fixFirefoxAutoScroll()})})})})},ie.renderTextArea=function(){var q=ie.props,Ee=q.prefixCls,Me=Ee===void 0?"rc-textarea":Ee,Ne=q.autoSize,De=q.onResize,Be=q.className,Ae=q.disabled,Pe=ie.state,Fe=Pe.textareaStyles,ze=Pe.resizeStatus,qe=Object(s.a)(ie.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),He=b()(Me,Be,Object(N.a)({},"".concat(Me,"-disabled"),Ae));"value"in qe&&(qe.value=qe.value||"");var Oe=Object(K.a)(Object(K.a)(Object(K.a)({},ie.props.style),Fe),ze===te.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return I.createElement(f,{onResize:ie.handleResize,disabled:!(Ne||De)},I.createElement("textarea",Object(oe.a)({},qe,{className:He,style:Oe,ref:ie.saveTextArea})))},ie.state={textareaStyles:{},resizeStatus:te.NONE},ie}return Object(D.a)(se,[{key:"componentDidUpdate",value:function(ie){(ie.value!==this.props.value||!B()(ie.autoSize,this.props.autoSize))&&this.resizeTextarea()}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.nextFrameActionId),cancelAnimationFrame(this.resizeFrameId)}},{key:"fixFirefoxAutoScroll",value:function(){try{if(document.activeElement===this.textArea){var ie=this.textArea.selectionStart,q=this.textArea.selectionEnd;this.textArea.setSelectionRange(ie,q)}}catch(Ee){}}},{key:"render",value:function(){return this.renderTextArea()}}]),se}(I.Component),pe=ce,ye=function(_e){Object($.a)(se,_e);var le=Object(U.a)(se);function se(ge){var ie;Object(Y.a)(this,se),ie=le.call(this,ge),ie.resizableTextArea=void 0,ie.focus=function(){ie.resizableTextArea.textArea.focus()},ie.saveTextArea=function(Ee){ie.resizableTextArea=Ee},ie.handleChange=function(Ee){var Me=ie.props.onChange;ie.setValue(Ee.target.value,function(){ie.resizableTextArea.resizeTextarea()}),Me&&Me(Ee)},ie.handleKeyDown=function(Ee){var Me=ie.props,Ne=Me.onPressEnter,De=Me.onKeyDown;Ee.keyCode===13&&Ne&&Ne(Ee),De&&De(Ee)};var q=typeof ge.value=="undefined"||ge.value===null?ge.defaultValue:ge.value;return ie.state={value:q},ie}return Object(D.a)(se,[{key:"setValue",value:function(ie,q){"value"in this.props||this.setState({value:ie},q)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return I.createElement(pe,Object(oe.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ie){return"value"in ie?{value:ie.value}:null}}]),se}(I.Component),Ce=Xe.default=ye},YBdh:function(at,Xe,V){at.exports=V.p+"static/xiren.a6554bc1.svg"},ZWs3:function(at,Xe,V){"use strict";V.d(Xe,"a",function(){return x});var oe=V("+L6B"),Y=V("2/Rp"),D=V("0Owb"),$=V("9og8"),U=V("tJVT"),I=V("PpiC"),K=V("WmNS"),N=V.n(K),O=V("q1tI"),L=V.n(O),x=function(P){var w=P.children,S=Object(I.a)(P,["children"]),T=Object(O.useState)(!1),h=Object(U.a)(T,2),l=h[0],i=h[1];return L.a.createElement(Y.a,Object(D.a)({},S,{loading:l,onClick:function(){var c=Object($.a)(N.a.mark(function C(v){return N.a.wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.prev=0,i(!0),u.next=4,S.onClick(v);case 4:i(!1),u.next=10;break;case 7:u.prev=7,u.t0=u.catch(0),i(!1);case 10:case"end":return u.stop()}},C,null,[[0,7]])}));return function(C){return c.apply(this,arguments)}}()}),w)}},ZpRC:function(at,Xe,V){"use strict";function oe(x){return typeof x=="object"&&x!=null&&x.nodeType===1}function Y(x,A){return(!A||x!=="hidden")&&x!=="visible"&&x!=="clip"}function D(x,A){if(x.clientHeightA||T>x&&h=A&&l>=P?T-x-w:h>A&&lP?h-A+S:0}var U=function(x,A){var P=window,w=A.scrollMode,S=A.block,T=A.inline,h=A.boundary,l=A.skipOverflowHiddenElements,i=typeof h=="function"?h:function(Fe){return Fe!==h};if(!oe(x))throw new TypeError("Invalid target");for(var c=document.scrollingElement||document.documentElement,C=[],v=x;oe(v)&&i(v);){if((v=v.parentElement)===c){C.push(v);break}v!=null&&v===document.body&&D(v)&&!D(document.documentElement)||v!=null&&D(v,l)&&C.push(v)}for(var m=P.visualViewport?P.visualViewport.width:innerWidth,u=P.visualViewport?P.visualViewport.height:innerHeight,E=window.scrollX||pageXOffset,d=window.scrollY||pageYOffset,f=x.getBoundingClientRect(),s=f.height,a=f.width,b=f.top,g=f.right,_=f.bottom,k=f.left,H=S==="start"||S==="nearest"?b:S==="end"?_:b+s/2,z=T==="center"?k+a/2:T==="end"?g:k,Z=[],G=0;G=0&&k>=0&&_<=u&&g<=m&&b>=ye&&_<=_e&&k>=le&&g<=Ce)return Z;var se=getComputedStyle(B),ge=parseInt(se.borderLeftWidth,10),ie=parseInt(se.borderTopWidth,10),q=parseInt(se.borderRightWidth,10),Ee=parseInt(se.borderBottomWidth,10),Me=0,Ne=0,De="offsetWidth"in B?B.offsetWidth-B.clientWidth-ge-q:0,Be="offsetHeight"in B?B.offsetHeight-B.clientHeight-ie-Ee:0;if(c===B)Me=S==="start"?H:S==="end"?H-u:S==="nearest"?$(d,d+u,u,ie,Ee,d+H,d+H+s,s):H-u/2,Ne=T==="start"?z:T==="center"?z-m/2:T==="end"?z-m:$(E,E+m,m,ge,q,E+z,E+z+a,a),Me=Math.max(0,Me+d),Ne=Math.max(0,Ne+E);else{Me=S==="start"?H-ye-ie:S==="end"?H-_e+Ee+Be:S==="nearest"?$(ye,_e,ce,ie,Ee+Be,H,H+s,s):H-(ye+ce/2)+Be/2,Ne=T==="start"?z-le-ge:T==="center"?z-(le+pe/2)+De/2:T==="end"?z-Ce+q+De:$(le,Ce,pe,ge,q+De,z,z+a,a);var Ae=B.scrollLeft,Pe=B.scrollTop;H+=Pe-(Me=Math.max(0,Math.min(Pe+Me,B.scrollHeight-ce+Be))),z+=Ae-(Ne=Math.max(0,Math.min(Ae+Ne,B.scrollWidth-pe+De)))}Z.push({el:B,top:Me,left:Ne})}return Z};function I(x){return x===Object(x)&&Object.keys(x).length!==0}function K(x,A){A===void 0&&(A="auto");var P="scrollBehavior"in document.body.style;x.forEach(function(w){var S=w.el,T=w.top,h=w.left;S.scroll&&P?S.scroll({top:T,left:h,behavior:A}):(S.scrollTop=T,S.scrollLeft=h)})}function N(x){return x===!1?{block:"end",inline:"nearest"}:I(x)?x:{block:"start",inline:"nearest"}}function O(x,A){var P=!x.ownerDocument.documentElement.contains(x);if(I(A)&&typeof A.behavior=="function")return A.behavior(P?[]:U(x,A));if(P)return;var w=N(A);return K(U(x,w),w.behavior)}var L=Xe.a=O},bT9E:function(at,Xe,V){"use strict";V.d(Xe,"a",function(){return Y});var oe=V("VTBJ");function Y(D,$){var U=Object(oe.a)({},D);return Array.isArray($)&&$.forEach(function(I){delete U[I]}),U}},c5Ni:function(at,Xe,V){},dejd:function(at,Xe,V){},dmUQ:function(at,Xe,V){"use strict";var oe=V("Ff2n"),Y=V("rePB"),D=V("1OyB"),$=V("vuIU"),U=V("Ji7U"),I=V("md7G"),K=V("foSv"),N=V("q1tI"),O=V.n(N),L=V("TSYQ"),x=V.n(L),A=V("4IlW");function P(s,a){var b=Object.keys(s);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(s);a&&(g=g.filter(function(_){return Object.getOwnPropertyDescriptor(s,_).enumerable})),b.push.apply(b,g)}return b}function w(s){for(var a=1;a1?pe-1:0),Ce=1;Ce1?G-1:0),te=1;te=0)return parseInt(Z.slice(Z.indexOf("e-")+2),10);var G=0;return Z.indexOf(".")>=0&&(G=Z.length-Z.indexOf(".")-1),G},_.getInputDisplayValue=function(z){var Z=z||_.state,G=Z.focused,B=Z.inputValue,te=Z.value,ce;G?ce=B:ce=_.toPrecisionAsStep(te),ce==null&&(ce="");var pe=_.formatWrapper(ce);return m(_.props.decimalSeparator)&&(pe=pe.toString().replace(".",_.props.decimalSeparator)),pe},_.recordCursorPosition=function(){try{_.cursorStart=_.input.selectionStart,_.cursorEnd=_.input.selectionEnd,_.currentValue=_.input.value,_.cursorBefore=_.input.value.substring(0,_.cursorStart),_.cursorAfter=_.input.value.substring(_.cursorEnd)}catch(z){}},_.restoreByAfter=function(z){if(z===void 0)return!1;var Z=_.input.value,G=Z.lastIndexOf(z);if(G===-1)return!1;var B=_.cursorBefore.length;return _.lastKeyCode===A.a.DELETE&&_.cursorBefore.charAt(B-1)===z[0]?(_.fixCaret(B,B),!0):G+z.length===Z.length?(_.fixCaret(G,G),!0):!1},_.partRestoreByAfter=function(z){return z===void 0?!1:Array.prototype.some.call(z,function(Z,G){var B=z.substring(G);return _.restoreByAfter(B)})},_.isNotCompleteNumber=function(z){return isNaN(z)||z===""||z===null||z&&z.toString().indexOf(".")===z.toString().length-1},_.stop=function(){_.autoStepTimer&&clearTimeout(_.autoStepTimer)},_.down=function(z,Z,G){_.pressingUpOrDown=!0,_.step("down",z,Z,G)},_.up=function(z,Z,G){_.pressingUpOrDown=!0,_.step("up",z,Z,G)},_.saveInput=function(z){_.input=z};var k=g.value;k===void 0&&(k=g.defaultValue),_.state={focused:g.autoFocus};var H=_.getValidValue(_.toNumber(k));return _.state=w(w({},_.state),{},{inputValue:_.toPrecisionAsStep(H),value:H}),_}return Object($.a)(b,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(_){var k=this.props,H=k.value,z=k.onChange,Z=k.max,G=k.min,B=this.state.focused;if(_){if(!u(_.value,H)||!u(_.max,Z)||!u(_.min,G)){var te=B?H:this.getValidValue(H),ce;this.pressingUpOrDown?ce=te:this.inputting?ce=this.rawInput:ce=this.toPrecisionAsStep(te),this.setState({value:te,inputValue:ce})}var pe="value"in this.props?H:this.state.value;"max"in this.props&&_.max!==Z&&typeof pe=="number"&&pe>Z&&z&&z(Z),"min"in this.props&&_.min!==G&&typeof pe=="number"&&pe1&&arguments[1]!==void 0?arguments[1]:this.props.min,H=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,z=parseFloat(_);return isNaN(z)?_:(zH&&(z=H),z)}},{key:"setValue",value:function(_,k){var H=this.props.precision,z=this.isNotCompleteNumber(parseFloat(_))?null:parseFloat(_),Z=this.state.value,G=Z===void 0?null:Z,B=this.state.inputValue,te=B===void 0?null:B,ce=typeof z=="number"?z.toFixed(H):"".concat(z),pe=z!==G||ce!=="".concat(te);return"value"in this.props?(te=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:te},k)):this.setState({value:z,inputValue:this.toPrecisionAsStep(_)},k),pe&&this.props.onChange(z),z}},{key:"getMaxPrecision",value:function(_){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,H=this.props,z=H.precision,Z=H.step;if(m(z))return z;var G=this.getPrecision(k),B=this.getPrecision(Z),te=this.getPrecision(_);return _?Math.max(te,G+B):G+B}},{key:"getPrecisionFactor",value:function(_){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,H=this.getMaxPrecision(_,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(_){return this.props.formatter?this.props.formatter(_):_}},{key:"toPrecisionAsStep",value:function(_){if(this.isNotCompleteNumber(_)||_==="")return _;var k=Math.abs(this.getMaxPrecision(_));return isNaN(k)?_.toString():Number(_).toFixed(k)}},{key:"toNumber",value:function(_){var k=this.props.precision,H=this.state.focused,z=_&&_.length>16&&H;return this.isNotCompleteNumber(_)||z?_:m(k)?Math.round(_*Math.pow(10,k))/Math.pow(10,k):Number(_)}},{key:"upStep",value:function(_,k){var H=this.props.step,z=this.getPrecisionFactor(_,k),Z=Math.abs(this.getMaxPrecision(_,k)),G=((z*_+z*H*k)/z).toFixed(Z);return this.toNumber(G)}},{key:"downStep",value:function(_,k){var H=this.props.step,z=this.getPrecisionFactor(_,k),Z=Math.abs(this.getMaxPrecision(_,k)),G=((z*_-z*H*k)/z).toFixed(Z);return this.toNumber(G)}},{key:"step",value:function(_,k){var H=this,z=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,Z=arguments.length>3?arguments[3]:void 0;this.stop(),k&&(k.persist(),k.preventDefault());var G=this.props;if(G.disabled)return;var B=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(B))return;var te=this["".concat(_,"Step")](B,z),ce=te>G.max||teG.max?te=G.max:te=ye),Ze=(St||St===0)&&(isNaN(St)||Number(St)<=Ce),xe=Ue||z||Z,fe=Ze||z||Z,be=x()("".concat(H,"-handler"),"".concat(H,"-handler-up"),Object(Y.a)({},"".concat(H,"-handler-up-disabled"),xe)),ne=x()("".concat(H,"-handler"),"".concat(H,"-handler-down"),Object(Y.a)({},"".concat(H,"-handler-down-disabled"),fe)),re=G?{onTouchStart:xe?h:this.up,onTouchEnd:this.stop}:{onMouseDown:xe?h:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},ae=G?{onTouchStart:fe?h:this.down,onTouchEnd:this.stop}:{onMouseDown:fe?h:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return O.a.createElement("div",{className:yt,style:_e,title:le,onMouseEnter:se,onMouseLeave:ge,onMouseOver:ie,onMouseOut:q,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"},re,{role:"button","aria-label":"Increase Value","aria-disabled":xe,className:be}),te||O.a.createElement("span",{unselectable:"on",className:"".concat(H,"-handler-up-inner"),onClick:l})),O.a.createElement("span",Object.assign({unselectable:"on"},ae,{role:"button","aria-label":"Decrease Value","aria-disabled":fe,className:ne}),ce||O.a.createElement("span",{unselectable:"on",className:"".concat(H,"-handler-down-inner"),onClick:l}))),O.a.createElement("div",{className:"".concat(H,"-input-wrap")},O.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Ce,"aria-valuemax":ye,"aria-valuenow":St,required:Ee,type:De,placeholder:Be,onPaste:lt,onClick:Me,onMouseUp:this.onMouseUp,className:"".concat(H,"-input"),tabIndex:Ne,autoComplete:B,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:Pt?this.onKeyDown:h,onKeyUp:Pt?this.onKeyUp:h,autoFocus:He,maxLength:qe,readOnly:Z,disabled:z,max:ye,min:Ce,step:ze,name:Oe,title:le,id:Ae,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Tt),pattern:Fe,inputMode:Pe,onInput:tt},ke))))}}]),b}(O.a.Component);E.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:v,min:-v,step:1,style:{},onChange:h,onKeyDown:h,onPressEnter:h,onFocus:h,onBlur:h,parser:i,required:!1,autoComplete:"off"};var d=E,f=Xe.a=d},"e+RI":function(at,Xe,V){at.exports={btn:"btn___35XHi",s1:"s1___yzdGB",s2:"s2___3kxXm",btnDisabled:"btnDisabled___lI9pA",btn2:"btn2___2KLJQ"}},"eS0+":function(at,Xe,V){"use strict";var oe=V("giR+"),Y=V("fyUT"),D=V("tJVT"),$=V("PpiC"),U=V("OaEy"),I=V("2fM7"),K=V("q1tI"),N=V.n(K),O=V("2sxD"),L=V.n(O),x=V("51dB"),A=V.n(x),P=V("5MlY"),w=V.n(P),S=V("lnNo"),T=V.n(S),h=V("YBdh"),l=V.n(h),i=V("LvDl"),c=V.n(i),C=V("TSYQ"),v=V.n(C),m=I.a.Option,u=function(s){var a=parseInt(s);return Object(i.isNaN)(a)?0:a},E=function(s){var a,b,g=s.index,_=s.value,k=_===void 0?[]:_,H=s.onChange,z=s.type,Z=s.disabled,G=Z===void 0?!1:Z,B=s.expansion,te=B===void 0?!0:B,ce=Object($.a)(s,["index","value","onChange","type","disabled","expansion"]),pe=Object(K.useState)(!0),ye=Object(D.a)(pe,2),Ce=ye[0],_e=ye[1],le=function(ge,ie){var q=Object(i.cloneDeep)(k);q.difficulties[ie].num=ge,console.log(q,444),H(q)};return N.a.createElement("div",{className:L.a.ListGroup,style:{borderWidth:g?1:0}},N.a.createElement("div",{className:L.a.a},g+1),N.a.createElement("div",{"data-type":"width",className:L.a.b},k==null?void 0:k.name),N.a.createElement("div",{className:L.a.c},k==null||((a=k.difficulties)===null||a===void 0)?void 0:a.map(function(se,ge){return N.a.createElement("div",{key:ge,style:{display:Ce?"flex":ge?"none":"flex"},className:L.a.c1},N.a.createElement("span",{style:{color:"#777777",marginRight:5}},"\u96BE\u5EA6"),se.difficulty===1&&N.a.createElement("span",{className:L.a.radio},"\u7B80\u5355"),se.difficulty===2&&N.a.createElement("span",{className:L.a.radio},"\u9002\u4E2D"),se.difficulty===3&&N.a.createElement("span",{className:L.a.radio},"\u56F0\u96BE"),N.a.createElement("span",{style:{color:"#777777",marginRight:5,marginLeft:50}},"\u62BD\u9898\u6570\u91CF"),g===0&&ge===0?N.a.createElement("div",{id:"".concat(z,"_sum")},N.a.createElement(Y.a,{disabled:G,parser:u,onChange:function(q){return le(q,ge)},min:0,max:se==null?void 0:se.count,value:(se==null?void 0:se.num)||0,style:{width:66}}),N.a.createElement("span",{style:{display:"none"}},"\u8BF7\u8F93\u5165\u6570\u91CF")):N.a.createElement(Y.a,{disabled:G,parser:u,onChange:function(q){return le(q,ge)},min:0,max:se==null?void 0:se.count,value:(se==null?void 0:se.num)||0,style:{width:66}}),N.a.createElement("span",{style:{marginLeft:5}},"/",se==null?void 0:se.count))})),N.a.createElement("div",{style:{display:(k==null||((b=k.difficulties)===null||b===void 0)?void 0:b.length)===1||!te?"none":"block"},onClick:function(){return _e(!Ce)},className:L.a.d},Ce?"\u6536\u8D77":"\u5C55\u5F00",N.a.createElement("img",{style:{marginTop:-2,transform:Ce?"rotate(0deg)":"rotate(180deg)"},src:T.a,className:"ml5"})))},d=function(s){var a,b,g=s.value,_=g===void 0?[]:g,k=s.onChange,H=s.listClassName,z=s.disabled,Z=z===void 0?!1:z,G=s.expansion,B=G===void 0?!0:G,te=Object($.a)(s,["value","onChange","listClassName","disabled","expansion"]),ce=Object(K.useState)(!0),pe=Object(D.a)(ce,2),ye=pe[0],Ce=pe[1],_e=function(q){var Ee,Me=q.score||0,Ne=[];q==null||((Ee=q.item_banks)===null||Ee===void 0)||Ee.forEach(function(Be){var Ae;Be==null||((Ae=Be.tag_disciplines)===null||Ae===void 0)||Ae.forEach(function(Pe){var Fe;Pe==null||((Fe=Pe.difficulties)===null||Fe===void 0)||Fe.forEach(function(ze){ze.num&&Ne.push(ze.num)})})});var De=Ne.reduce(function(Be,Ae){return Be+Ae},0);return De*Me},le=[{type:"SINGLE",name:"\u5355\u9009\u9898"},{type:"MULTIPLE",name:"\u591A\u9009\u9898"},{type:"COMPLETION",name:"\u586B\u7A7A\u9898"},{type:"JUDGMENT",name:"\u5224\u65AD\u9898"},{type:"SUBJECTIVE",name:"\u7B80\u7B54\u9898"},{type:"PROGRAM",name:"\u7F16\u7A0B\u9898"},{type:"PRACTICAL",name:"\u5B9E\u8BAD\u9898"},{type:"COMBINATION",name:"\u7EC4\u5408\u9898"}],se=function(q,Ee,Me){var Ne=Object(i.cloneDeep)(_);Ne.item_banks[Ee].tag_disciplines[Me]=q;var De=_e(Ne);Ne.scoreTotal=De,console.log(Ne,"newValue"),k(Ne)},ge=function(q){var Ee=Object(i.cloneDeep)(_);Ee.score=q;var Me=_e(Ee);Ee.scoreTotal=Me,k(Ee)};return N.a.createElement("div",{className:v()(L.a.list,H)},N.a.createElement("div",{className:L.a.head},N.a.createElement("div",{className:L.a.name},N.a.createElement("b",null),N.a.createElement("span",null,(a=le.find(function(ie){return ie.type===(_==null?void 0:_.item_type)}))===null||a===void 0?void 0:a.name)),N.a.createElement("div",{className:L.a.right},B&&N.a.createElement("div",{onClick:function(){return Ce(!ye)},className:"current c-light-primary mb10"},ye?"\u6536\u8D77":"\u5C55\u5F00",N.a.createElement("img",{style:{marginTop:-2,transform:ye?"rotate(0deg)":"rotate(180deg)"},src:T.a,className:"ml5"})),N.a.createElement("div",null,N.a.createElement("img",{src:A.a}),N.a.createElement("span",{className:"ml10 mr20"},"\u603B\u5206",_.scoreTotal,"\u5206"),N.a.createElement("img",{className:"mr10",src:w.a}),N.a.createElement("span",null,(_==null?void 0:_.item_type)==="COMBINATION"?"\u6BCF\u5C0F\u9898":"\u6BCF\u9898"),N.a.createElement("div",{id:"".concat(_==null?void 0:_.item_type,"_score")},N.a.createElement(Y.a,{disabled:Z,parser:u,min:0,onChange:ge,value:_.score,style:{margin:"0 5px"}}),N.a.createElement("span",{style:{display:"none"}},"\u8BF7\u8F93\u5165\u6BCF\u9898\u5206\u6570")),N.a.createElement("span",null,"\u5206")))),N.a.createElement("div",{className:L.a.body,style:{display:ye?"block":"none"}},_==null||((b=_.item_banks)===null||b===void 0)?void 0:b.map(function(ie,q){var Ee;return N.a.createElement(N.a.Fragment,{key:q},N.a.createElement("div",{className:L.a.top},N.a.createElement("img",{src:l.a}),N.a.createElement("span",null,"\u65B9\u5411/\u8BFE\u7A0B"),N.a.createElement("b",null),N.a.createElement("aside",null,ie==null?void 0:ie.disciplines,"/",ie==null?void 0:ie.sub_discipline)),N.a.createElement("div",{className:L.a.bottom},N.a.createElement("div",{className:L.a.l},"\u77E5\u8BC6\u70B9"),N.a.createElement("div",{className:L.a.r},ie==null||((Ee=ie.tag_disciplines)===null||Ee===void 0)?void 0:Ee.map(function(Me,Ne){return N.a.createElement(E,{expansion:B,disabled:Z,type:_==null?void 0:_.item_type,key:"".concat(q,"-").concat(Ne),value:Me,index:Ne,onChange:function(Be){return se(Be,q,Ne)}})}))))})))};Xe.a=d},exQ7:function(at,Xe,V){at.exports=V.p+"static/te.6f9c0684.svg"},fAei:function(at,Xe,V){"use strict";V.d(Xe,"a",function(){return c.a});var oe=V("rePB"),Y=V("VTBJ"),D=V("KQm4"),$=V("1OyB"),U=V("vuIU"),I=V("Ji7U"),K=V("LK+K"),N=V("q1tI"),O=V("4IlW"),L=V("Kwbf"),x=V("TSYQ"),A=V.n(x),P=V("sboe"),w=V("OZM5"),S=V("815F"),T=V("ODXe"),h=V("Ff2n"),l=V("+nKL"),i=V("8XRh"),c=V("WaYH"),C=function(Ce,_e){var le=Ce.className,se=Ce.style,ge=Ce.motion,ie=Ce.motionNodes,q=Ce.motionType,Ee=Ce.onMotionStart,Me=Ce.onMotionEnd,Ne=Ce.active,De=Ce.treeNodeRequiredProps,Be=Object(h.a)(Ce,["className","style","motion","motionNodes","motionType","onMotionStart","onMotionEnd","active","treeNodeRequiredProps"]),Ae=N.useState(!0),Pe=Object(T.a)(Ae,2),Fe=Pe[0],ze=Pe[1],qe=N.useContext(P.a),He=qe.prefixCls,Oe=N.useRef(!1),lt=function(){Oe.current||Me(),Oe.current=!0};return Object(N.useEffect)(function(){ie&&q==="hide"&&Fe&&ze(!1)},[ie]),Object(N.useEffect)(function(){return ie&&Ee(),function(){ie&<()}},[]),ie?N.createElement(i.default,Object.assign({ref:_e,visible:Fe},ge,{motionAppear:q==="show",onAppearEnd:lt,onLeaveEnd:lt}),function(tt,ft){var nt=tt.className,St=tt.style;return N.createElement("div",{ref:ft,className:A()("".concat(He,"-treenode-motion"),nt),style:St},ie.map(function(ht){var yt=ht.data,ke=yt.key,Pt=Object(h.a)(yt,["key"]),Tt=ht.isStart,Ue=ht.isEnd;delete Pt.children;var Ze=Object(S.f)(ke,De);return N.createElement(c.a,Object.assign({},Pt,Ze,{active:Ne,data:ht.data,key:ke,isStart:Tt,isEnd:Ue}))}))}):N.createElement(c.a,Object.assign({domRef:_e,className:le,style:se},Be,{active:Ne}))};C.displayName="MotionTreeNode";var v=N.forwardRef(C),m=v;function u(){var ye=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],Ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],_e=ye.length,le=Ce.length;if(Math.abs(_e-le)!==1)return{add:!1,key:null};function se(ge,ie){var q=new Map;ge.forEach(function(Me){q.set(Me,!0)});var Ee=ie.filter(function(Me){return!q.has(Me)});return Ee.length===1?Ee[0]:null}return _e ").concat(Ce);return Ce}var z=function(Ce,_e){var le=Ce.prefixCls,se=Ce.data,ge=Ce.selectable,ie=Ce.checkable,q=Ce.expandedKeys,Ee=Ce.selectedKeys,Me=Ce.checkedKeys,Ne=Ce.loadedKeys,De=Ce.loadingKeys,Be=Ce.halfCheckedKeys,Ae=Ce.keyEntities,Pe=Ce.disabled,Fe=Ce.dragging,ze=Ce.dragOverNodeKey,qe=Ce.dropPosition,He=Ce.motion,Oe=Ce.height,lt=Ce.itemHeight,tt=Ce.virtual,ft=Ce.focusable,nt=Ce.activeItem,St=Ce.focused,ht=Ce.tabIndex,yt=Ce.onKeyDown,ke=Ce.onFocus,Pt=Ce.onBlur,Tt=Ce.onActiveChange,Ue=Ce.onListChangeStart,Ze=Ce.onListChangeEnd,xe=Object(h.a)(Ce,["prefixCls","data","selectable","checkable","expandedKeys","selectedKeys","checkedKeys","loadedKeys","loadingKeys","halfCheckedKeys","keyEntities","disabled","dragging","dragOverNodeKey","dropPosition","motion","height","itemHeight","virtual","focusable","activeItem","focused","tabIndex","onKeyDown","onFocus","onBlur","onActiveChange","onListChangeStart","onListChangeEnd"]),fe=N.useRef(null);N.useImperativeHandle(_e,function(){return{scrollTo:function(kt){fe.current.scrollTo(kt)}}});var be=N.useState(q),ne=Object(T.a)(be,2),re=ne[0],ae=ne[1],de=N.useState(se),ue=Object(T.a)(de,2),we=ue[0],Le=ue[1],rt=N.useState(se),je=Object(T.a)(rt,2),Ye=je[0],Dt=je[1],ut=N.useState([]),mt=Object(T.a)(ut,2),zt=mt[0],Je=mt[1],Kt=N.useState(null),sn=Object(T.a)(Kt,2),Bt=sn[0],an=sn[1];function Qt(){Le(se),Dt(se),Je([]),an(null),Ze()}N.useEffect(function(){ae(q);var xt=u(re,q);if(xt.key!==null)if(xt.add){var kt=we.findIndex(function(ln){var $t=ln.data.key;return $t===xt.key}),Mt=_(E(we,se,xt.key),tt,Oe,lt),It=we.slice();It.splice(kt+1,0,g),Dt(It),Je(Mt),an("show")}else{var Lt=se.findIndex(function(ln){var $t=ln.data.key;return $t===xt.key}),st=_(E(se,we,xt.key),tt,Oe,lt),Ve=se.slice();Ve.splice(Lt+1,0,g),Dt(Ve),Je(st),an("hide")}else we!==se&&(Le(se),Dt(se))},[q,se]),N.useEffect(function(){Fe||Qt()},[Fe]);var ot=He?Ye:se,Ft={expandedKeys:q,selectedKeys:Ee,loadedKeys:Ne,loadingKeys:De,checkedKeys:Me,halfCheckedKeys:Be,dragOverNodeKey:ze,dropPosition:qe,keyEntities:Ae};return N.createElement(N.Fragment,null,St&&nt&&N.createElement("span",{style:d,"aria-live":"assertive"},H(nt)),N.createElement("div",{role:"tree"},N.createElement("input",{style:d,disabled:ft===!1||Pe,tabIndex:ft!==!1?ht:null,onKeyDown:yt,onFocus:ke,onBlur:Pt,value:"",onChange:f})),N.createElement(l.a,Object.assign({},xe,{data:ot,itemKey:k,height:Oe,fullHeight:!1,virtual:tt,itemHeight:lt,prefixCls:"".concat(le,"-list"),ref:fe}),function(xt){var kt=xt.pos,Mt=xt.data,It=Mt.key,Lt=Object(h.a)(Mt,["key"]),st=xt.isStart,Ve=xt.isEnd,ln=Object(S.e)(It,kt);delete Lt.children;var $t=Object(S.f)(ln,Ft);return N.createElement(m,Object.assign({},Lt,$t,{active:nt&&It===nt.data.key,pos:kt,data:xt.data,isStart:st,isEnd:Ve,motion:He,motionNodes:It===s?zt:null,motionType:Bt,onMotionStart:Ue,onMotionEnd:Qt,treeNodeRequiredProps:Ft,onMouseMove:function(){Tt(null)}}))}))},Z=N.forwardRef(z);Z.displayName="NodeList";var G=Z,B=V("NvD2"),te=function(ye){Object(I.a)(_e,ye);var Ce=Object(K.a)(_e);function _e(){var le;return Object($.a)(this,_e),le=Ce.apply(this,arguments),le.destroyed=!1,le.state={keyEntities:{},selectedKeys:[],checkedKeys:[],halfCheckedKeys:[],loadedKeys:[],loadingKeys:[],expandedKeys:[],dragging:!1,dragNodesKeys:[],dragOverNodeKey:null,dropPosition:null,treeData:[],flattenNodes:[],focused:!1,activeKey:null,listChanging:!1,prevProps:null},le.listRef=N.createRef(),le.onNodeDragStart=function(se,ge){var ie=le.state,q=ie.expandedKeys,Ee=ie.keyEntities,Me=le.props.onDragStart,Ne=ge.props.eventKey;le.dragNode=ge;var De=Object(w.b)(q,Ne);le.setState({dragging:!0,dragNodesKeys:Object(w.g)(Ne,Ee)}),le.setExpandedKeys(De),Me&&Me({event:se,node:Object(S.b)(ge.props)})},le.onNodeDragEnter=function(se,ge){var ie=le.state,q=ie.expandedKeys,Ee=ie.keyEntities,Me=ie.dragNodesKeys,Ne=le.props.onDragEnter,De=ge.props,Be=De.pos,Ae=De.eventKey;if(!le.dragNode||Me.indexOf(Ae)!==-1)return;var Pe=Object(w.c)(se,ge);if(le.dragNode.props.eventKey===Ae&&Pe===0){le.setState({dragOverNodeKey:"",dropPosition:null});return}setTimeout(function(){le.setState({dragOverNodeKey:Ae,dropPosition:Pe}),le.delayedDragEnterLogic||(le.delayedDragEnterLogic={}),Object.keys(le.delayedDragEnterLogic).forEach(function(Fe){clearTimeout(le.delayedDragEnterLogic[Fe])}),le.delayedDragEnterLogic[Be]=window.setTimeout(function(){if(!le.state.dragging)return;var Fe=Object(D.a)(q),ze=Ee[Ae];ze&&(ze.children||[]).length&&(Fe=Object(w.a)(q,Ae)),"expandedKeys"in le.props||le.setExpandedKeys(Fe),Ne&&Ne({event:se,node:Object(S.b)(ge.props),expandedKeys:Fe})},400)},0)},le.onNodeDragOver=function(se,ge){var ie=le.state.dragNodesKeys,q=le.props.onDragOver,Ee=ge.props.eventKey;if(ie.indexOf(Ee)!==-1)return;if(le.dragNode&&Ee===le.state.dragOverNodeKey){var Me=Object(w.c)(se,ge);if(Me===le.state.dropPosition)return;le.setState({dropPosition:Me})}q&&q({event:se,node:Object(S.b)(ge.props)})},le.onNodeDragLeave=function(se,ge){var ie=le.props.onDragLeave;le.setState({dragOverNodeKey:""}),ie&&ie({event:se,node:Object(S.b)(ge.props)})},le.onNodeDragEnd=function(se,ge){var ie=le.props.onDragEnd;le.setState({dragOverNodeKey:""}),le.cleanDragState(),ie&&ie({event:se,node:Object(S.b)(ge.props)}),le.dragNode=null},le.onNodeDrop=function(se,ge){var ie=le.state,q=ie.dragNodesKeys,Ee=q===void 0?[]:q,Me=ie.dropPosition,Ne=le.props.onDrop,De=ge.props,Be=De.eventKey,Ae=De.pos;if(le.setState({dragOverNodeKey:""}),le.cleanDragState(),Ee.indexOf(Be)!==-1){Object(L.a)(!1,"Can not drop to dragNode(include it's children node)");return}var Pe=Object(w.k)(Ae),Fe={event:se,node:Object(S.b)(ge.props),dragNode:le.dragNode?Object(S.b)(le.dragNode.props):null,dragNodesKeys:Ee.slice(),dropPosition:Me+Number(Pe[Pe.length-1]),dropToGap:!1};Me!==0&&(Fe.dropToGap=!0),Ne&&Ne(Fe),le.dragNode=null},le.cleanDragState=function(){var se=le.state.dragging;se&&le.setState({dragging:!1})},le.onNodeClick=function(se,ge){var ie=le.props.onClick;ie&&ie(se,ge)},le.onNodeDoubleClick=function(se,ge){var ie=le.props.onDoubleClick;ie&&ie(se,ge)},le.onNodeSelect=function(se,ge){var ie=le.state.selectedKeys,q=le.state.keyEntities,Ee=le.props,Me=Ee.onSelect,Ne=Ee.multiple,De=ge.selected,Be=ge.key,Ae=!De;Ae?Ne?ie=Object(w.a)(ie,Be):ie=[Be]:ie=Object(w.b)(ie,Be);var Pe=ie.map(function(Fe){var ze=q[Fe];return ze?ze.node:null}).filter(function(Fe){return Fe});le.setUncontrolledState({selectedKeys:ie}),Me&&Me(ie,{event:"select",selected:Ae,node:ge,selectedNodes:Pe,nativeEvent:se.nativeEvent})},le.onNodeCheck=function(se,ge,ie){var q=le.state,Ee=q.keyEntities,Me=q.checkedKeys,Ne=q.halfCheckedKeys,De=le.props,Be=De.checkStrictly,Ae=De.onCheck,Pe=ge.key,Fe,ze={event:"check",node:ge,checked:ie,nativeEvent:se.nativeEvent};if(Be){var qe=ie?Object(w.a)(Me,Pe):Object(w.b)(Me,Pe),He=Object(w.b)(Ne,Pe);Fe={checked:qe,halfChecked:He},ze.checkedNodes=qe.map(function(St){return Ee[St]}).filter(function(St){return St}).map(function(St){return St.node}),le.setUncontrolledState({checkedKeys:qe})}else{var Oe=Object(B.a)([].concat(Object(D.a)(Me),[Pe]),!0,Ee),lt=Oe.checkedKeys,tt=Oe.halfCheckedKeys;if(!ie){var ft=new Set(lt);ft.delete(Pe);var nt=Object(B.a)(Array.from(ft),{checked:!1,halfCheckedKeys:tt},Ee);lt=nt.checkedKeys,tt=nt.halfCheckedKeys}Fe=lt,ze.checkedNodes=[],ze.checkedNodesPositions=[],ze.halfCheckedKeys=tt,lt.forEach(function(St){var ht=Ee[St];if(!ht)return;var yt=ht.node,ke=ht.pos;ze.checkedNodes.push(yt),ze.checkedNodesPositions.push({node:yt,pos:ke})}),le.setUncontrolledState({checkedKeys:lt},!1,{halfCheckedKeys:tt})}Ae&&Ae(Fe,ze)},le.onNodeLoad=function(se){return new Promise(function(ge){le.setState(function(ie){var q=ie.loadedKeys,Ee=q===void 0?[]:q,Me=ie.loadingKeys,Ne=Me===void 0?[]:Me,De=le.props,Be=De.loadData,Ae=De.onLoad,Pe=se.key;if(!Be||Ee.indexOf(Pe)!==-1||Ne.indexOf(Pe)!==-1)return{};var Fe=Be(se);return Fe.then(function(){var ze=le.state,qe=ze.loadedKeys,He=ze.loadingKeys,Oe=Object(w.a)(qe,Pe),lt=Object(w.b)(He,Pe);Ae&&Ae(Oe,{event:"load",node:se}),le.setUncontrolledState({loadedKeys:Oe}),le.setState({loadingKeys:lt}),ge()}),{loadingKeys:Object(w.a)(Ne,Pe)}})})},le.onNodeMouseEnter=function(se,ge){var ie=le.props.onMouseEnter;ie&&ie({event:se,node:ge})},le.onNodeMouseLeave=function(se,ge){var ie=le.props.onMouseLeave;ie&&ie({event:se,node:ge})},le.onNodeContextMenu=function(se,ge){var ie=le.props.onRightClick;ie&&(se.preventDefault(),ie({event:se,node:ge}))},le.onFocus=function(){var se=le.props.onFocus;le.setState({focused:!0}),se&&se.apply(void 0,arguments)},le.onBlur=function(){var se=le.props.onBlur;le.setState({focused:!1}),le.onActiveChange(null),se&&se.apply(void 0,arguments)},le.getTreeNodeRequiredProps=function(){var se=le.state,ge=se.expandedKeys,ie=se.selectedKeys,q=se.loadedKeys,Ee=se.loadingKeys,Me=se.checkedKeys,Ne=se.halfCheckedKeys,De=se.dragOverNodeKey,Be=se.dropPosition,Ae=se.keyEntities;return{expandedKeys:ge||[],selectedKeys:ie||[],loadedKeys:q||[],loadingKeys:Ee||[],checkedKeys:Me||[],halfCheckedKeys:Ne||[],dragOverNodeKey:De,dropPosition:Be,keyEntities:Ae}},le.setExpandedKeys=function(se){var ge=le.state.treeData,ie=Object(S.d)(ge,se);le.setUncontrolledState({expandedKeys:se,flattenNodes:ie},!0)},le.onNodeExpand=function(se,ge){var ie=le.state.expandedKeys,q=le.state.listChanging,Ee=le.props,Me=Ee.onExpand,Ne=Ee.loadData,De=ge.key,Be=ge.expanded;if(q)return;var Ae=ie.indexOf(De),Pe=!Be;if(Object(L.a)(Be&&Ae!==-1||!Be&&Ae===-1,"Expand state not sync with index check"),Pe?ie=Object(w.a)(ie,De):ie=Object(w.b)(ie,De),le.setExpandedKeys(ie),Me&&Me(ie,{node:ge,expanded:Pe,nativeEvent:se.nativeEvent}),Pe&&Ne){var Fe=le.onNodeLoad(ge);Fe&&Fe.then(function(){var ze=Object(S.d)(le.state.treeData,ie);le.setUncontrolledState({flattenNodes:ze})})}},le.onListChangeStart=function(){le.setUncontrolledState({listChanging:!0})},le.onListChangeEnd=function(){setTimeout(function(){le.setUncontrolledState({listChanging:!1})})},le.onActiveChange=function(se){var ge=le.state.activeKey,ie=le.props.onActiveChange;if(ge===se)return;le.setState({activeKey:se}),se!==null&&le.scrollTo({key:se}),ie&&ie(se)},le.getActiveItem=function(){var se=le.state,ge=se.activeKey,ie=se.flattenNodes;return ge===null?null:ie.find(function(q){var Ee=q.data.key;return Ee===ge})||null},le.offsetActiveKey=function(se){var ge=le.state,ie=ge.flattenNodes,q=ge.activeKey,Ee=ie.findIndex(function(De){var Be=De.data.key;return Be===q});Ee===-1&&se<0&&(Ee=ie.length),Ee=(Ee+se+ie.length)%ie.length;var Me=ie[Ee];if(Me){var Ne=Me.data.key;le.onActiveChange(Ne)}else le.onActiveChange(null)},le.onKeyDown=function(se){var ge=le.state,ie=ge.activeKey,q=ge.expandedKeys,Ee=ge.checkedKeys,Me=le.props,Ne=Me.onKeyDown,De=Me.checkable,Be=Me.selectable;switch(se.which){case O.a.UP:{le.offsetActiveKey(-1),se.preventDefault();break}case O.a.DOWN:{le.offsetActiveKey(1),se.preventDefault();break}}var Ae=le.getActiveItem();if(Ae&&Ae.data){var Pe=le.getTreeNodeRequiredProps(),Fe=Ae.data.isLeaf===!1||!!(Ae.data.children||[]).length,ze=Object(S.b)(Object(Y.a)(Object(Y.a)({},Object(S.f)(ie,Pe)),{},{data:Ae.data,active:!0}));switch(se.which){case O.a.LEFT:{Fe&&q.includes(ie)?le.onNodeExpand({},ze):Ae.parent&&le.onActiveChange(Ae.parent.data.key),se.preventDefault();break}case O.a.RIGHT:{Fe&&!q.includes(ie)?le.onNodeExpand({},ze):Ae.children&&Ae.children.length&&le.onActiveChange(Ae.children[0].data.key),se.preventDefault();break}case O.a.ENTER:case O.a.SPACE:{De&&!ze.disabled&&ze.checkable!==!1&&!ze.disableCheckbox?le.onNodeCheck({},ze,!Ee.includes(ie)):!De&&Be&&!ze.disabled&&ze.selectable!==!1&&le.onNodeSelect({},ze);break}}}Ne&&Ne(se)},le.setUncontrolledState=function(se){var ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ie=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if(le.destroyed)return;var q=!1,Ee=!0,Me={};Object.keys(se).forEach(function(Ne){if(Ne in le.props){Ee=!1;return}q=!0,Me[Ne]=se[Ne]}),q&&(!ge||Ee)&&le.setState(Object(Y.a)(Object(Y.a)({},Me),ie))},le.scrollTo=function(se){le.listRef.current.scrollTo(se)},le}return Object(U.a)(_e,[{key:"componentWillUnmount",value:function(){this.destroyed=!0}},{key:"render",value:function(){var se,ge=this.state,ie=ge.focused,q=ge.flattenNodes,Ee=ge.keyEntities,Me=ge.dragging,Ne=ge.activeKey,De=this.props,Be=De.prefixCls,Ae=De.className,Pe=De.style,Fe=De.showLine,ze=De.focusable,qe=De.tabIndex,He=qe===void 0?0:qe,Oe=De.selectable,lt=De.showIcon,tt=De.icon,ft=De.switcherIcon,nt=De.draggable,St=De.checkable,ht=De.checkStrictly,yt=De.disabled,ke=De.motion,Pt=De.loadData,Tt=De.filterTreeNode,Ue=De.height,Ze=De.itemHeight,xe=De.virtual,fe=De.titleRender,be=De.onContextMenu,ne=Object(w.f)(this.props);return N.createElement(P.a.Provider,{value:{prefixCls:Be,selectable:Oe,showIcon:lt,icon:tt,switcherIcon:ft,draggable:nt,checkable:St,checkStrictly:ht,disabled:yt,keyEntities:Ee,loadData:Pt,filterTreeNode:Tt,titleRender:fe,onNodeClick:this.onNodeClick,onNodeDoubleClick:this.onNodeDoubleClick,onNodeExpand:this.onNodeExpand,onNodeSelect:this.onNodeSelect,onNodeCheck:this.onNodeCheck,onNodeLoad:this.onNodeLoad,onNodeMouseEnter:this.onNodeMouseEnter,onNodeMouseLeave:this.onNodeMouseLeave,onNodeContextMenu:this.onNodeContextMenu,onNodeDragStart:this.onNodeDragStart,onNodeDragEnter:this.onNodeDragEnter,onNodeDragOver:this.onNodeDragOver,onNodeDragLeave:this.onNodeDragLeave,onNodeDragEnd:this.onNodeDragEnd,onNodeDrop:this.onNodeDrop}},N.createElement("div",{className:A()(Be,Ae,(se={},Object(oe.a)(se,"".concat(Be,"-show-line"),Fe),Object(oe.a)(se,"".concat(Be,"-focused"),ie),Object(oe.a)(se,"".concat(Be,"-active-focused"),Ne!==null),se))},N.createElement(G,Object.assign({ref:this.listRef,prefixCls:Be,style:Pe,data:q,disabled:yt,selectable:Oe,checkable:!!St,motion:ke,dragging:Me,height:Ue,itemHeight:Ze,virtual:xe,focusable:ze,focused:ie,tabIndex:He,activeItem:this.getActiveItem(),onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onActiveChange:this.onActiveChange,onListChangeStart:this.onListChangeStart,onListChangeEnd:this.onListChangeEnd,onContextMenu:be},this.getTreeNodeRequiredProps(),ne))))}}],[{key:"getDerivedStateFromProps",value:function(se,ge){var ie=ge.prevProps,q={prevProps:se};function Ee(tt){return!ie&&tt in se||ie&&ie[tt]!==se[tt]}var Me;if(Ee("treeData")?Me=se.treeData:Ee("children")&&(Object(L.a)(!1,"`children` of Tree is deprecated. Please use `treeData` instead."),Me=Object(S.c)(se.children)),Me){q.treeData=Me;var Ne=Object(S.a)(Me);q.keyEntities=Object(Y.a)(Object(oe.a)({},s,b),Ne.keyEntities)}var De=q.keyEntities||ge.keyEntities;if(Ee("expandedKeys")||ie&&Ee("autoExpandParent"))q.expandedKeys=se.autoExpandParent||!ie&&se.defaultExpandParent?Object(w.e)(se.expandedKeys,De):se.expandedKeys;else if(!ie&&se.defaultExpandAll){var Be=Object(Y.a)({},De);delete Be[s],q.expandedKeys=Object.keys(Be).map(function(tt){return Be[tt].key})}else!ie&&se.defaultExpandedKeys&&(q.expandedKeys=se.autoExpandParent||se.defaultExpandParent?Object(w.e)(se.defaultExpandedKeys,De):se.defaultExpandedKeys);if(q.expandedKeys||delete q.expandedKeys,Me||q.expandedKeys){var Ae=Object(S.d)(Me||ge.treeData,q.expandedKeys||ge.expandedKeys);q.flattenNodes=Ae}if(se.selectable&&(Ee("selectedKeys")?q.selectedKeys=Object(w.d)(se.selectedKeys,se):!ie&&se.defaultSelectedKeys&&(q.selectedKeys=Object(w.d)(se.defaultSelectedKeys,se))),se.checkable){var Pe;if(Ee("checkedKeys")?Pe=Object(w.j)(se.checkedKeys)||{}:!ie&&se.defaultCheckedKeys?Pe=Object(w.j)(se.defaultCheckedKeys)||{}:Me&&(Pe=Object(w.j)(se.checkedKeys)||{checkedKeys:ge.checkedKeys,halfCheckedKeys:ge.halfCheckedKeys}),Pe){var Fe=Pe,ze=Fe.checkedKeys,qe=ze===void 0?[]:ze,He=Fe.halfCheckedKeys,Oe=He===void 0?[]:He;if(!se.checkStrictly){var lt=Object(B.a)(qe,!0,De);qe=lt.checkedKeys,Oe=lt.halfCheckedKeys}q.checkedKeys=qe,q.halfCheckedKeys=Oe}}return Ee("loadedKeys")&&(q.loadedKeys=se.loadedKeys),q}}]),_e}(N.Component);te.defaultProps={prefixCls:"rc-tree",showLine:!1,showIcon:!0,selectable:!0,multiple:!1,checkable:!1,disabled:!1,checkStrictly:!1,draggable:!1,defaultExpandParent:!0,autoExpandParent:!1,defaultExpandAll:!1,defaultExpandedKeys:[],defaultCheckedKeys:[],defaultSelectedKeys:[]},te.TreeNode=c.a;var ce=te,pe=Xe.b=ce},k4n4:function(at,Xe,V){"use strict";var oe=V("tJVT"),Y=V("q1tI"),D=V.n(Y),$=V("e+RI"),U=V.n($),I=V("FTkQ"),K=V.n(I),N=V("E/GV"),O=V.n(N),L=function(A){var P=A.type,w=P===void 0?1:P,S=A.value,T=S===void 0?[]:S,h=A.onChange,l=A.disabled,i=l===void 0?!1:l,c=A.icon,C=Object(Y.useState)(),v=Object(oe.a)(C,2),m=v[0],u=v[1],E=function(f){h(f)};return w===1?D.a.createElement("div",null,T==null?void 0:T.map(function(d,f){return D.a.createElement("div",{key:f,className:i?"".concat(U.a.btn," ").concat(U.a.btnDisabled):U.a.btn},D.a.createElement("span",{className:U.a.s1},d.name),D.a.createElement("img",{src:K.a,className:U.a.s2,onClick:function(){return E(d.id)}}))})):D.a.createElement("div",null,T==null?void 0:T.map(function(d,f){return D.a.createElement("div",{key:f,className:U.a.btn2},D.a.createElement("span",{className:U.a.s1},D.a.createElement("img",{src:c||O.a}),d.name),D.a.createElement("img",{src:K.a,className:U.a.s2,onClick:function(){return E(d.id)}}))}))};Xe.a=L},kSUc:function(at,Xe,V){},kqOp:function(at,Xe,V){"use strict";V.d(Xe,"a",function(){return L});var oe=V("0Owb"),Y=V("fWQN"),D=V("mtLc"),$=V("yKVA"),U=V("879j"),I=V("q1tI"),K=V.n(I),N=V("Ot1p"),O="\u2581",L=function(x){Object($.a)(P,x);var A=Object(U.a)(P);function P(){var w;Object(Y.a)(this,P);for(var S=arguments.length,T=new Array(S),h=0;h` "'(~:]+/,S=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,T=/^\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]/,l=" ";function i(G,B,te){return B.f=B.inline=te,te(G,B)}function c(G,B,te){return B.f=B.block=te,te(G,B)}function C(G){return!G||!/\S/.test(G.string)}function v(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==u){var B=U;if(!B){var te=oe.innerMode($,G.htmlState);B=te.mode.name=="xml"&&te.state.tagStart===null&&!te.state.context&&te.state.tokenize.isInText}B&&(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,B){var te=G.column()===B.indentation,ce=C(B.prevLine.stream),pe=B.indentedCode,ye=B.prevLine.hr,Ce=B.list!==!1,_e=(B.listStack[B.listStack.length-1]||0)+3;B.indentedCode=!1;var le=B.indentation;if(B.indentationDiff===null&&(B.indentationDiff=B.indentation,Ce)){for(B.list=null;le=4&&(pe||B.prevLine.fencedCodeEnd||B.prevLine.header||ce))return G.skipToEnd(),B.indentedCode=!0,K.code;if(G.eatSpace())return null;if(te&&B.indentation<=_e&&(ie=G.match(A))&&ie[1].length<=6)return B.quote=0,B.header=ie[1].length,B.thisLine.header=!0,D.highlightFormatting&&(B.formatting="header"),B.f=B.inline,d(B);if(B.indentation<=_e&&G.eat(">"))return B.quote=te?1:B.quote+1,D.highlightFormatting&&(B.formatting="quote"),G.eatSpace(),d(B);if(!ge&&!B.setext&&te&&B.indentation<=_e&&(ie=G.match(L))){var q=ie[1]?"ol":"ul";return B.indentation=le+G.current().length,B.list=!0,B.quote=0,B.listStack.push(B.indentation),B.em=!1,B.strong=!1,B.code=!1,B.strikethrough=!1,D.taskLists&&G.match(x,!1)&&(B.taskList=!0),B.f=B.inline,D.highlightFormatting&&(B.formatting=["list","list-"+q]),d(B)}else{if(te&&B.indentation<=_e&&(ie=G.match(S,!0)))return B.quote=0,B.fencedEndRE=new RegExp(ie[1]+"+ *$"),B.localMode=D.fencedCodeBlockHighlighting&&I(ie[2]||D.fencedCodeBlockDefaultMode),B.localMode&&(B.localState=oe.startState(B.localMode)),B.f=B.block=E,D.highlightFormatting&&(B.formatting="code-block"),B.code=-1,d(B);if(B.setext||(!se||!Ce)&&!B.quote&&B.list===!1&&!B.code&&!ge&&!T.test(G.string)&&(ie=G.lookAhead(1))&&(ie=ie.match(P)))return B.setext?(B.header=B.setext,B.setext=0,G.skipToEnd(),D.highlightFormatting&&(B.formatting="header")):(B.header=ie[0].charAt(0)=="="?1:2,B.setext=B.header),B.thisLine.header=!0,B.f=B.inline,d(B);if(ge)return G.skipToEnd(),B.hr=!0,B.thisLine.hr=!0,K.hr;if(G.peek()==="[")return i(G,B,k)}return i(G,B,B.inline)}function u(G,B){var te=$.token(G,B.htmlState);if(!U){var ce=oe.innerMode($,B.htmlState);(ce.mode.name=="xml"&&ce.state.tagStart===null&&!ce.state.context&&ce.state.tokenize.isInText||B.md_inside&&G.current().indexOf(">")>-1)&&(B.f=s,B.block=m,B.htmlState=null)}return te}function E(G,B){var te=B.listStack[B.listStack.length-1]||0,ce=B.indentation=G.quote?B.push(K.formatting+"-"+G.formatting[te]+"-"+G.quote):B.push("error"))}if(G.taskOpen)return B.push("meta"),B.length?B.join(" "):null;if(G.taskClosed)return B.push("property"),B.length?B.join(" "):null;if(G.linkHref?B.push(K.linkHref,"url"):(G.strong&&B.push(K.strong),G.em&&B.push(K.em),G.strikethrough&&B.push(K.strikethrough),G.emoji&&B.push(K.emoji),G.linkText&&B.push(K.linkText),G.code&&B.push(K.code),G.image&&B.push(K.image),G.imageAltText&&B.push(K.imageAltText,"link"),G.imageMarker&&B.push(K.imageMarker)),G.header&&B.push(K.header,K.header+"-"+G.header),G.quote&&(B.push(K.quote),!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=G.quote?B.push(K.quote+"-"+G.quote):B.push(K.quote+"-"+D.maxBlockquoteDepth)),G.list!==!1){var ce=(G.listStack.length-1)%3;ce?ce===1?B.push(K.list2):B.push(K.list3):B.push(K.list1)}return G.trailingSpaceNewLine?B.push("trailing-space-new-line"):G.trailingSpace&&B.push("trailing-space-"+(G.trailingSpace%2?"a":"b")),B.length?B.join(" "):null}function f(G,B){return G.match(w,!0)?d(B):void 0}function s(G,B){var te=B.text(G,B);if(typeof te!="undefined")return te;if(B.list)return B.list=null,d(B);if(B.taskList){var ce=G.match(x,!0)[1]===" ";return ce?B.taskOpen=!0:B.taskClosed=!0,D.highlightFormatting&&(B.formatting="task"),B.taskList=!1,d(B)}if(B.taskOpen=!1,B.taskClosed=!1,B.header&&G.match(/^#+$/,!0))return D.highlightFormatting&&(B.formatting="header"),d(B);var pe=G.next();if(B.linkTitle){B.linkTitle=!1;var ye=pe;pe==="("&&(ye=")"),ye=(ye+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Ce="^\\s*(?:[^"+ye+"\\\\]+|\\\\\\\\|\\\\.)"+ye;if(G.match(new RegExp(Ce),!0))return K.linkHref}if(pe==="`"){var _e=B.formatting;D.highlightFormatting&&(B.formatting="code"),G.eatWhile("`");var le=G.current().length;if(B.code==0&&(!B.quote||le==1))return B.code=le,d(B);if(le==B.code){var se=d(B);return B.code=0,se}else return B.formatting=_e,d(B)}else if(B.code)return d(B);if(pe==="\\"&&(G.next(),D.highlightFormatting)){var ge=d(B),ie=K.formatting+"-escape";return ge?ge+" "+ie:ie}if(pe==="!"&&G.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return B.imageMarker=!0,B.image=!0,D.highlightFormatting&&(B.formatting="image"),d(B);if(pe==="["&&B.imageMarker&&G.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return B.imageMarker=!1,B.imageAltText=!0,D.highlightFormatting&&(B.formatting="image"),d(B);if(pe==="]"&&B.imageAltText){D.highlightFormatting&&(B.formatting="image");var ge=d(B);return B.imageAltText=!1,B.image=!1,B.inline=B.f=b,ge}if(pe==="["&&!B.image)return B.linkText&&G.match(/^.*?\]/)||(B.linkText=!0,D.highlightFormatting&&(B.formatting="link")),d(B);if(pe==="]"&&B.linkText){D.highlightFormatting&&(B.formatting="link");var ge=d(B);return B.linkText=!1,B.inline=B.f=G.match(/\(.*?\)| ?\[.*?\]/,!1)?b:s,ge}if(pe==="<"&&G.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){B.f=B.inline=a,D.highlightFormatting&&(B.formatting="link");var ge=d(B);return ge?ge+=" ":ge="",ge+K.linkInline}if(pe==="<"&&G.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){B.f=B.inline=a,D.highlightFormatting&&(B.formatting="link");var ge=d(B);return ge?ge+=" ":ge="",ge+K.linkEmail}if(D.xml&&pe==="<"&&G.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var q=G.string.indexOf(">",G.pos);if(q!=-1){var Ee=G.string.substring(G.start,q);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Ee)&&(B.md_inside=!0)}return G.backUp(1),B.htmlState=oe.startState($),c(G,B,u)}if(D.xml&&pe==="<"&&G.match(/^\/\w*?>/))return B.md_inside=!1,"tag";if(pe==="*"||pe==="_"){for(var Me=1,Ne=G.pos==1?" ":G.string.charAt(G.pos-2);Me<3&&G.eat(pe);)Me++;var De=G.peek()||" ",Be=!/\s/.test(De)&&(!h.test(De)||/\s/.test(Ne)||h.test(Ne)),Ae=!/\s/.test(Ne)&&(!h.test(Ne)||/\s/.test(De)||h.test(De)),Pe=null,Fe=null;if(Me%2&&(!B.em&&Be&&(pe==="*"||!Ae||h.test(Ne))?Pe=!0:B.em==pe&&Ae&&(pe==="*"||!Be||h.test(De))&&(Pe=!1)),Me>1&&(!B.strong&&Be&&(pe==="*"||!Ae||h.test(Ne))?Fe=!0:B.strong==pe&&Ae&&(pe==="*"||!Be||h.test(De))&&(Fe=!1)),Fe!=null||Pe!=null){D.highlightFormatting&&(B.formatting=Pe==null?"strong":Fe==null?"em":"strong em"),Pe===!0&&(B.em=pe),Fe===!0&&(B.strong=pe);var se=d(B);return Pe===!1&&(B.em=!1),Fe===!1&&(B.strong=!1),se}}else if(pe===" "&&(G.eat("*")||G.eat("_"))){if(G.peek()===" ")return d(B);G.backUp(1)}if(D.strikethrough){if(pe==="~"&&G.eatWhile(pe)){if(B.strikethrough){D.highlightFormatting&&(B.formatting="strikethrough");var se=d(B);return B.strikethrough=!1,se}else if(G.match(/^[^\s]/,!1))return B.strikethrough=!0,D.highlightFormatting&&(B.formatting="strikethrough"),d(B)}else if(pe===" "&&G.match(/^~~/,!0)){if(G.peek()===" ")return d(B);G.backUp(2)}}if(D.emoji&&pe===":"&&G.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){B.emoji=!0,D.highlightFormatting&&(B.formatting="emoji");var ze=d(B);return B.emoji=!1,ze}return pe===" "&&(G.match(/^ +$/,!1)?B.trailingSpace++:B.trailingSpace&&(B.trailingSpaceNewLine=!0)),d(B)}function a(G,B){var te=G.next();if(te===">"){B.f=B.inline=s,D.highlightFormatting&&(B.formatting="link");var ce=d(B);return ce?ce+=" ":ce="",ce+K.linkInline}return G.match(/^[^>]+/,!0),K.linkInline}function b(G,B){if(G.eatSpace())return null;var te=G.next();return te==="("||te==="["?(B.f=B.inline=_(te==="("?")":"]"),D.highlightFormatting&&(B.formatting="link-string"),B.linkHref=!0,d(B)):"error"}var g={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function _(G){return function(B,te){var ce=B.next();if(ce===G){te.f=te.inline=s,D.highlightFormatting&&(te.formatting="link-string");var pe=d(te);return te.linkHref=!1,pe}return B.match(g[G]),te.linkHref=!0,d(te)}}function k(G,B){return G.match(/^([^\]\\]|\\.)*\]:/,!1)?(B.f=H,G.next(),D.highlightFormatting&&(B.formatting="link"),B.linkText=!0,d(B)):i(G,B,s)}function H(G,B){if(G.match(/^\]:/,!0)){B.f=B.inline=z,D.highlightFormatting&&(B.formatting="link");var te=d(B);return B.linkText=!1,te}return G.match(/^([^\]\\]|\\.)+/,!0),K.linkText}function z(G,B){return G.eatSpace()?null:(G.match(/^[^\s]+/,!0),G.peek()===void 0?B.linkTitle=!0:G.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),B.f=B.inline=s,K.linkHref+" url")}var Z={startState:function(){return{f:m,prevLine:{stream:null},thisLine:{stream:null},block:m,htmlState:null,indentation:0,inline:s,text:f,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&&oe.copyState($,G.htmlState),indentation:G.indentation,localMode:G.localMode,localState:G.localMode?oe.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,B){if(B.formatting=!1,G!=B.thisLine.stream){if(B.header=0,B.hr=!1,G.match(/^\s*$/,!0))return v(B),null;if(B.prevLine=B.thisLine,B.thisLine={stream:G},B.taskList=!1,B.trailingSpace=0,B.trailingSpaceNewLine=!1,!B.localState&&(B.f=B.block,B.f!=u)){var te=G.match(/^\s*/,!0)[0].replace(/\t/g,l).length;if(B.indentation=te,B.indentationDiff=null,te>0)return null}}return B.f(G,B)},innerMode:function(G){return G.block==u?{state:G.htmlState,mode:$}:G.localState?{state:G.localState,mode:G.localMode}:{state:G,mode:Z}},indent:function(G,B,te){return G.block==u&&$.indent?$.indent(G.htmlState,B,te):G.localState&&G.localMode.indent?G.localMode.indent(G.localState,B,te):oe.Pass},blankLine:v,getType:d,blockCommentStart:"",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return Z},"xml"),oe.defineMIME("text/markdown","markdown"),oe.defineMIME("text/x-markdown","markdown")})},lnNo:function(at,Xe,V){at.exports=V.p+"static/up.69f3b3fd.svg"},m3fD:function(at,Xe,V){at.exports={flex_box_center:"flex_box_center___1w3aZ",flex_space_between:"flex_space_between___26eB1",flex_box_vertical_center:"flex_box_vertical_center___LffUi",flex_box_center_end:"flex_box_center_end___2AiD3",flex_box_column:"flex_box_column___hZDm1",wrap:"wrap___3Du1e",btns:"btns___35pkF",crumbs:"crumbs___3CPsi",oneWrap:"oneWrap___3F99r",title:"title___2n1na",formWrap:"formWrap___3CHwR",rb:"rb___19sZ1"}},osHv:function(at,Xe,V){(function(oe){oe(V("VrN/"))})(function(oe){"use strict";var Y=oe.Pos;function D(h,l){return h.line-l.line||h.ch-l.ch}var $="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",U=$+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",I=new RegExp("<(/?)(["+$+"]["+U+"]*)","g");function K(h,l,i,c){this.line=l,this.ch=i,this.cm=h,this.text=h.getLine(l),this.min=c?Math.max(c.from,h.firstLine()):h.firstLine(),this.max=c?Math.min(c.to-1,h.lastLine()):h.lastLine()}function N(h,l){var i=h.cm.getTokenTypeAt(Y(h.line,l));return i&&/\btag\b/.test(i)}function O(h){return h.line>=h.max?void 0:(h.ch=0,h.text=h.cm.getLine(++h.line),!0)}function L(h){return h.line<=h.min?void 0:(h.text=h.cm.getLine(--h.line),h.ch=h.text.length,!0)}function x(h){for(;;){var l=h.text.indexOf(">",h.ch);if(l==-1){if(O(h))continue;return}if(!N(h,l+1)){h.ch=l+1;continue}var i=h.text.lastIndexOf("/",l),c=i>-1&&!/\S/.test(h.text.slice(i+1,l));return h.ch=l+1,c?"selfClose":"regular"}}function A(h){for(;;){var l=h.ch?h.text.lastIndexOf("<",h.ch-1):-1;if(l==-1){if(L(h))continue;return}if(!N(h,l+1)){h.ch=l;continue}I.lastIndex=l,h.ch=l;var i=I.exec(h.text);if(i&&i.index==l)return i}}function P(h){for(;;){I.lastIndex=h.ch;var l=I.exec(h.text);if(!l){if(O(h))continue;return}if(!N(h,l.index+1)){h.ch=l.index+1;continue}return h.ch=l.index+l[0].length,l}}function w(h){for(;;){var l=h.ch?h.text.lastIndexOf(">",h.ch-1):-1;if(l==-1){if(L(h))continue;return}if(!N(h,l+1)){h.ch=l;continue}var i=h.text.lastIndexOf("/",l),c=i>-1&&!/\S/.test(h.text.slice(i+1,l));return h.ch=l+1,c?"selfClose":"regular"}}function S(h,l){for(var i=[];;){var c=P(h),C,v=h.line,m=h.ch-(c?c[0].length:0);if(!c||!(C=x(h)))return;if(C=="selfClose")continue;if(c[1]){for(var u=i.length-1;u>=0;--u)if(i[u]==c[2]){i.length=u;break}if(u<0&&(!l||l==c[2]))return{tag:c[2],from:Y(v,m),to:Y(h.line,h.ch)}}else i.push(c[2])}}function T(h,l){for(var i=[];;){var c=w(h);if(!c)return;if(c=="selfClose"){A(h);continue}var C=h.line,v=h.ch,m=A(h);if(!m)return;if(m[1])i.push(m[2]);else{for(var u=i.length-1;u>=0;--u)if(i[u]==m[2]){i.length=u;break}if(u<0&&(!l||l==m[2]))return{tag:m[2],from:Y(h.line,h.ch),to:Y(C,v)}}}}oe.registerHelper("fold","xml",function(h,l){for(var i=new K(h,l.line,0);;){var c=P(i);if(!c||i.line!=l.line)return;var C=x(i);if(!C)return;if(!c[1]&&C!="selfClose"){var v=Y(i.line,i.ch),m=S(i,c[2]);return m&&D(m.from,v)>0?{from:v,to:m.from}:null}}}),oe.findMatchingTag=function(h,l,i){var c=new K(h,l.line,l.ch,i);if(c.text.indexOf(">")==-1&&c.text.indexOf("<")==-1)return;var C=x(c),v=C&&Y(c.line,c.ch),m=C&&A(c);if(!C||!m||D(c,l)>0)return;var u={from:Y(c.line,c.ch),to:v,tag:m[2]};return C=="selfClose"?{open:u,close:null,at:"open"}:m[1]?{open:T(c,m[2]),close:u,at:"close"}:(c=new K(h,v.line,v.ch,i),{open:u,close:S(c,m[2]),at:"open"})},oe.findEnclosingTag=function(h,l,i,c){for(var C=new K(h,l.line,l.ch,i);;){var v=T(C,c);if(!v)break;var m=new K(h,l.line,l.ch,i),u=S(m,v.tag);if(u)return{open:v,close:u}}},oe.scanForClosingTag=function(h,l,i,c){var C=new K(h,l.line,l.ch,c?{from:0,to:c}:null);return S(C,i)}})},p5ED:function(at,Xe,V){"use strict";var oe=V("+L6B"),Y=V("2/Rp"),D=V("5Dmo"),$=V("3S7+"),U=V("k1fw"),I=V("9og8"),K=V("tJVT"),N=V("WmNS"),O=V.n(N),L=V("q1tI"),x=V.n(L),A=V("vHTk"),P=V.n(A),w=V("yEEn"),S=V("ZW9T"),T=V("1vsH"),h=V("V0Rq"),l=V("m3rI");Xe.a=function(i){var c,C,v,m,u,E,d,f=i.editOffice,s=f===void 0?"view":f,a=i.data,b=i.theme,g=i.type,_=i.filename,k=i.monacoEditor,H=i.className,z=i.style,Z=i.close,G=i.onClose,B=i.hasMask,te=i.disabledDownload,ce=Object(L.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),pe=Object(K.a)(ce,2),ye=pe[0],Ce=pe[1],_e=Object(L.useState)(""),le=Object(K.a)(_e,2),se=le[0],ge=le[1],ie=Object(L.useState)(),q=Object(K.a)(ie,2),Ee=q[0],Me=q[1],Ne=window.ENV==="build"?"/react/build":"",De=l.a.PROXY_SERVER||location.origin,Be,Ae=1024*1024,Pe=10*Ae,Fe=Object(L.useRef)();(c=a)!==null&&c!==void 0&&c.startsWith("/api")&&g!=="txt"&&(a=l.a.API_SERVER+a),g==="office"&&(Be=Object(T.T)(a).filesize,Be>Pe&&(g="other")),_&&k&&(k.filename=_),Object(L.useEffect)(function(){var Oe,lt,tt=(Oe=document.cookie)===null||Oe===void 0||((lt=Oe.replace(/\s/g,""))===null||lt===void 0)?void 0:lt.split(";");tt==null||tt.map(function(ft){var nt=ft.split("=");nt[0]==="_educoder_session"&&ge(nt[1])})},[]),Object(L.useEffect)(function(){g==="office"&&ze()},[g,a]);var ze=function(){var Oe=Object(I.a)(O.a.mark(function lt(){var tt,ft,nt;return O.a.wrap(function(ht){for(;;)switch(ht.prev=ht.next){case 0:return console.log("data:",a),tt=a,a.startsWith("http")||(tt=location.origin+tt),ft=new URL(tt).pathname.split("/").pop(),ht.next=6,Object(h.W)({attachment_id:ft});case 6:nt=ht.sent,Me(nt);case 8:case"end":return ht.stop()}},lt)}));return function(){return Oe.apply(this,arguments)}}(),qe=function(){if(a.startsWith("http")||a.startsWith("blob:")){He();return}Object(T.z)(_||"educoder",a,_)},He=function(){Object(T.x)(_||"educoder",decodeURIComponent(a))};return x.a.createElement("div",{style:Object(U.a)({},z||{}),className:"".concat(B&&P.a.bgBlack," ").concat(g?P.a.wrp:"hide")},Z&&x.a.createElement("div",{className:P.a.close,ref:Fe},!te&&x.a.createElement($.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return Fe.current}},x.a.createElement("span",{onClick:He},x.a.createElement("i",{className:"icon-quxiaozhiding"}))),x.a.createElement($.a,{title:"\u5173\u95ED",getPopupContainer:function(){return Fe.current}},x.a.createElement("span",{className:"",onClick:G},x.a.createElement("i",{className:"icon-guanbi1"})))),x.a.createElement("div",{className:"".concat(P.a[H]," ").concat(H," ").concat(P.a.monaco," ").concat(g==="txt"?"show":"hide")},g==="txt"&&x.a.createElement(S.b,k)),g==="audio"&&x.a.createElement("audio",{src:"".concat(((C=a)===null||C===void 0?void 0:C.indexOf("http://"))>-1||((v=a)===null||v===void 0?void 0:v.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(a),autoPlay:!0}),g==="video"&&x.a.createElement(x.a.Fragment,null,((m=a)===null||m===void 0?void 0:m.indexOf("http"))>-1?x.a.createElement("video",{controls:!0,src:"".concat(a),autoPlay:!0}):x.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(a),autoPlay:!0})),g==="office"&&Ee&&x.a.createElement("iframe",{src:"".concat(Ne,"/office.html?key=").concat(Ee.key,"&url=").concat(De+Ee.url,"&callbackUrl=").concat(De+Ee.callbackUrl,"&fileType=").concat(Ee.fileType,"&title=").concat(Ee.title,"&model=").concat(s,"&officeServer=").concat(l.a.OFFICE_SERVER,"&disabledDownload=").concat(!!te)}),g==="html"&&x.a.createElement("iframe",{src:a+"&disposition=inline"}),g==="pdf"&&x.a.createElement("iframe",{src:"".concat(Ne,"/js/pdfview/index.html?url=").concat(a,"&disabledDownload=").concat(!!te)}),g==="image"&&x.a.createElement("img",{src:"".concat(((u=a)===null||u===void 0?void 0:u.indexOf("http://"))>-1||((E=a)===null||E===void 0?void 0:E.indexOf("https://"))>-1||(d=a)!==null&&d!==void 0&&d.startsWith("/api")?"":"data:image/png;base64,").concat(a)}),g==="other"&&x.a.createElement("div",null,x.a.createElement(Y.a,{type:"primary",size:"large",onClick:qe},x.a.createElement(w.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),g==="download"&&x.a.createElement(Y.a,{type:"primary",size:"large",onClick:qe},x.a.createElement(w.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(at,Xe,V){},rUJ1:function(at,Xe){const V=/[&<>"']/,oe=/[&<>"']/g,Y=/[<>"']|&(?!#?\w+;)/,D=/[<>"']|&(?!#?\w+;)/g,$={"&":"&","<":"<",">":">",'"':""","'":"'"},U=E=>$[E];function I(E,d){if(d){if(V.test(E))return E.replace(oe,U)}else if(Y.test(E))return E.replace(D,U);return E}const K=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function N(E){return E.replace(K,(d,f)=>(f=f.toLowerCase(),f==="colon"?":":f.charAt(0)==="#"?f.charAt(1)==="x"?String.fromCharCode(parseInt(f.substring(2),16)):String.fromCharCode(+f.substring(1)):""))}const O=/(^|[^\[])\^/g;function L(E,d){E=E.source||E,d=d||"";const f={replace:(s,a)=>(a=a.source||a,a=a.replace(O,"$1"),E=E.replace(s,a),f),getRegex:()=>new RegExp(E,d)};return f}const x=/[^\w:]/g,A=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function P(E,d,f){if(E){let s;try{s=decodeURIComponent(N(f)).replace(x,"").toLowerCase()}catch(a){return null}if(s.indexOf("javascript:")===0||s.indexOf("vbscript:")===0||s.indexOf("data:")===0)return null}d&&!A.test(f)&&(f=l(d,f));try{f=encodeURI(f).replace(/%25/g,"%")}catch(s){return null}return f}const w={},S=/^[^:]+:\/*[^/]*$/,T=/^([^:]+:)[\s\S]*$/,h=/^([^:]+:\/*[^/]*)[\s\S]*$/;function l(E,d){w[" "+E]||(S.test(E)?w[" "+E]=E+"/":w[" "+E]=v(E,"/",!0)),E=w[" "+E];const f=E.indexOf(":")===-1;return d.substring(0,2)==="//"?f?d:E.replace(T,"$1")+d:d.charAt(0)==="/"?f?d:E.replace(h,"$1")+d:E+d}const i={exec:function(){}};function c(E){let d=1,f,s;for(;d{let k=!1,H=g;for(;--H>=0&&_[H]==="\\";)k=!k;return k?"|":" |"}),s=f.split(/ \|/);let a=0;if(s.length>d)s.splice(d);else for(;s.length20?(w.b.warn("\u586B\u7A7A\u9898\u6807\u51C6\u7B54\u6848\u4E0D\u80FD\u4E3A\u7A7A/\u4E0D\u80FD\u8D85\u8FC720\u4E2A\uFF01"),!1):{name:mt,analysis:sn,standard_answers:F,is_ordered:Ve}):(w.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1)},pt=function(){zt(""),Bt(""),Ft([]),ln(!1)},Ge=function(F,p,y){var M=ot.slice();if(p&&M.splice(F,p),y)for(var Q=0;Q1&&u.a.createElement("span",null,u.a.createElement(pe.a,{checked:Ve,onChange:function(F){return ln(F.target.checked)},className:"".concat(q.a.color333," font14")},"\u591A\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u6709\u987A\u5E8F\u8981\u6C42"),u.a.createElement("span",{className:"".concat(q.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"))),u.a.createElement("p",{className:q.a.titleWrap},u.a.createElement("span",{className:q.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),u.a.createElement(_e.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:sn,onChange:function(F){return Bt(F)}}))},Ne=Object(g.a)(function(re){var ae=re.loading,de=re.globalSetting;return{globalSetting:de,loading:ae.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(Me)),De=V("7Kak"),Be=V("9yH6"),Ae=["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"],Pe=function(ae,de){var ue=ae.globalSetting,we=ae.loading,Le=ae.editData,rt=ae.dispatch,je=ae.onRef,Ye=je===void 0?function(){}:je,Dt=ae.isEdit,ut=Object(Ce.a)(ae,["globalSetting","loading","editData","dispatch","onRef","isEdit"]),mt=Object(m.useState)(),zt=Object(c.a)(mt,2),Je=zt[0],Kt=zt[1],sn=Object(m.useState)(""),Bt=Object(c.a)(sn,2),an=Bt[0],Qt=Bt[1],ot=Object(m.useState)(""),Ft=Object(c.a)(ot,2),xt=Ft[0],kt=Ft[1];Object(m.useEffect)(function(){if(!Le||!Dt)return;Qt(Le==null?void 0:Le.name),kt(Le==null?void 0:Le.analysis);var Lt=Le==null?void 0:Le.choices.find(function(st){return st.is_answer});Kt(Lt.choice_text==="\u6B63\u786E"?"0":"1")},[Le]),Object(m.useImperativeHandle)(de,function(){return{onSave:Mt,Clear:It}});var Mt=function(){if(!an)return w.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;if(!Je)return w.b.info("\u8BF7\u5148\u70B9\u51FB\u9009\u62E9\u672C\u9009\u62E9\u9898\u7684\u6B63\u786E\u9009\u9879"),!1;var st=[{choice_text:"\u6B63\u786E",is_answer:Je==="0"?1:0},{choice_text:"\u9519\u8BEF",is_answer:Je==="1"?1:0}];return{name:an,choices:st,analysis:xt}},It=function(){Qt(""),kt(""),Kt("")};return u.a.createElement("section",{className:q.a.wrap},u.a.createElement("p",{className:q.a.titleWrap},u.a.createElement("span",{className:q.a.required},"*"),u.a.createElement("span",{className:q.a.title},"\u9898\u5E72\uFF1A")),u.a.createElement(_e.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:an,onChange:function(st){return Qt(st)}}),u.a.createElement("p",{className:q.a.titleWrap},u.a.createElement("span",{className:q.a.required},"*"),u.a.createElement("span",{className:q.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",u.a.createElement("span",{className:q.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),u.a.createElement(Be.a.Group,{buttonStyle:"solid",value:Je,onChange:function(st){return Kt(st.target.value)}},u.a.createElement(Be.a.Button,{value:"0",className:"".concat(q.a.radio," mr40")},"\u6B63\u786E"),u.a.createElement(Be.a.Button,{value:"1",className:q.a.radio},"\u9519\u8BEF")),u.a.createElement("p",{className:q.a.titleWrap},u.a.createElement("span",{className:q.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),u.a.createElement(_e.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:xt,onChange:function(st){return kt(st)}}))},Fe=Object(g.a)(function(re){var ae=re.loading,de=re.globalSetting;return{globalSetting:de,loading:ae.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(Pe)),ze=["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"],qe=function(ae,de){var ue=ae.editData,we=ae.globalSetting,Le=ae.loading,rt=ae.dispatch,je=ae.onRef,Ye=je===void 0?function(){}:je,Dt=ae.isEdit,ut=Object(Ce.a)(ae,["editData","globalSetting","loading","dispatch","onRef","isEdit"]),mt=Object(m.useState)([]),zt=Object(c.a)(mt,2),Je=zt[0],Kt=zt[1],sn=Object(m.useState)(),Bt=Object(c.a)(sn,2),an=Bt[0],Qt=Bt[1],ot=Object(m.useState)([]),Ft=Object(c.a)(ot,2),xt=Ft[0],kt=Ft[1],Mt=Object(m.useState)(""),It=Object(c.a)(Mt,2),Lt=It[0],st=It[1],Ve=Object(m.useState)(""),ln=Object(c.a)(Ve,2),$t=ln[0],cn=ln[1];Object(m.useEffect)(function(){Kt(["","","",""])},[]),Object(m.useEffect)(function(){if(!ue||!Dt)return;st(ue==null?void 0:ue.name),cn(ue==null?void 0:ue.analysis),Kt(ue==null?void 0:ue.choices.map(function(pt){return pt.choice_text}));var on=[];ue==null||ue.choices.map(function(pt,Ge){pt.is_answer&&on.push(Ge)}),kt(on)},[ue]),Object(m.useImperativeHandle)(de,function(){return{onSave:qt,Clear:En}});var qt=function(){if(!Lt)return w.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;var pt=Je.findIndex(function(wt){return!wt});if(pt>-1)return w.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(ze[pt]," \u9009\u9879\u7684\u5185\u5BB9")),!1;if(!xt.length)return w.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(xt.length<2)return w.b.info("\u591A\u9009\u9898\u6700\u5C0F\u6B63\u786E\u9009\u9879\u4E3A2\u4E2A"),!1;var Ge=Je.map(function(wt,Hn){return{choice_text:wt,is_answer:xt.includes(Hn)?1:0}});return{name:Lt,choices:Ge,analysis:$t}},En=function(){Kt(["","","",""]),st(""),cn(""),kt("")};return u.a.createElement("section",{className:q.a.wrap},u.a.createElement("p",{className:q.a.titleWrap},u.a.createElement("span",{className:q.a.required},"*"),u.a.createElement("span",{className:q.a.title},"\u9898\u5E72\uFF1A")),u.a.createElement(_e.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Lt,onChange:function(pt){return st(pt)}}),u.a.createElement("p",{className:q.a.titleWrap},u.a.createElement("span",{className:q.a.required},"*"),u.a.createElement("span",{className:q.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",u.a.createElement("span",{className:q.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),Je.map(function(on,pt){return u.a.createElement("div",{className:q.a.choiceWrap,key:pt},u.a.createElement($.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},u.a.createElement("div",{className:"".concat(q.a.answer," ").concat(xt.includes(pt)?q.a.activeAnswer:""),onClick:function(){xt.includes(pt)?kt(xt.filter(function(wt){return wt!==pt})):kt([].concat(Object(ye.a)(xt),[pt]))}},ze[pt])),u.a.createElement("div",{className:q.a.editorWrap},an===pt?u.a.createElement(_e.a,{id:"single-question-option-".concat(pt),watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:on,onChange:function(wt){Je[pt]=wt,Kt(Je)}}):u.a.createElement("div",{className:q.a.htmlWrap,onClick:function(){return Qt(pt)}},u.a.createElement(a.a,{value:on}))),pt>1&&u.a.createElement($.a,{title:"\u5220\u9664"},u.a.createElement("i",{className:"".concat(q.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){Kt(Je.filter(function(wt,Hn){return Hn!==pt})),xt.includes(pt)?kt(xt.filter(function(wt){return wt!==pt})):kt([].concat(Object(ye.a)(xt),[pt]))}})),pt<7&&pt===Je.length-1&&u.a.createElement($.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},u.a.createElement("i",{className:"".concat(q.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return Kt([].concat(Object(ye.a)(Je),[""]))}})))}),u.a.createElement("p",{className:q.a.titleWrap},u.a.createElement("span",{className:q.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),u.a.createElement(_e.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:$t,onChange:function(pt){return cn(pt)}}))},He=Object(g.a)(function(re){var ae=re.loading,de=re.globalSetting;return{globalSetting:de,loading:ae.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(qe)),Oe=["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"],lt=function(ae,de){var ue=ae.editData,we=ae.globalSetting,Le=ae.loading,rt=ae.dispatch,je=ae.onRef,Ye=je===void 0?function(){}:je,Dt=ae.isEdit,ut=Object(Ce.a)(ae,["editData","globalSetting","loading","dispatch","onRef","isEdit"]),mt=Object(m.useState)([]),zt=Object(c.a)(mt,2),Je=zt[0],Kt=zt[1],sn=Object(m.useState)(),Bt=Object(c.a)(sn,2),an=Bt[0],Qt=Bt[1],ot=Object(m.useState)(),Ft=Object(c.a)(ot,2),xt=Ft[0],kt=Ft[1],Mt=Object(m.useState)(""),It=Object(c.a)(Mt,2),Lt=It[0],st=It[1],Ve=Object(m.useState)(""),ln=Object(c.a)(Ve,2),$t=ln[0],cn=ln[1];Object(m.useEffect)(function(){Kt(["","","",""])},[]),Object(m.useEffect)(function(){if(!ue||!Dt)return;st(ue==null?void 0:ue.name),cn(ue==null?void 0:ue.analysis),Kt(ue==null?void 0:ue.choices.map(function(on){return on.choice_text})),kt(ue==null?void 0:ue.choices.findIndex(function(on){return on.is_answer}))},[ue]),Object(m.useImperativeHandle)(de,function(){return{onSave:qt,Clear:En}});var qt=function(){if(!Lt)return w.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;var pt=Je.findIndex(function(wt){return!wt});if(pt>-1)return w.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(Oe[pt]," \u9009\u9879\u7684\u5185\u5BB9")),!1;if(console.log("activeAnswer: ",xt),!(typeof xt=="number"))return w.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 Ge=Je.map(function(wt,Hn){return{choice_text:wt,is_answer:xt===Hn?1:0}});return{name:Lt,choices:Ge,analysis:$t}},En=function(){Kt(["","","",""]),st(""),cn(""),kt("")};return u.a.createElement("section",{className:q.a.wrap},u.a.createElement("p",{className:q.a.titleWrap},u.a.createElement("span",{className:q.a.required},"*"),u.a.createElement("span",{className:q.a.title},"\u9898\u5E72\uFF1A")),u.a.createElement(_e.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Lt,onChange:function(pt){return st(pt)}}),u.a.createElement("p",{className:q.a.titleWrap},u.a.createElement("span",{className:q.a.required},"*"),u.a.createElement("span",{className:q.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",u.a.createElement("span",{className:q.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),Je.map(function(on,pt){return u.a.createElement("div",{className:q.a.choiceWrap,key:pt},u.a.createElement($.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},u.a.createElement("div",{className:"".concat(q.a.answer," ").concat(xt===pt?q.a.activeAnswer:""),onClick:function(){return kt(pt)}},Oe[pt])),u.a.createElement("div",{className:q.a.editorWrap},an===pt?u.a.createElement(_e.a,{id:"single-question-option-".concat(pt),watch:!0,height:155,isFocus:!0,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:on,onChange:function(wt){Je[pt]=wt,Kt(Je)}}):u.a.createElement("div",{className:q.a.htmlWrap,onClick:function(){return Qt(pt)}},u.a.createElement(a.a,{value:on}))),pt>1&&u.a.createElement($.a,{title:"\u5220\u9664"},u.a.createElement("i",{className:"".concat(q.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){Kt(Je.filter(function(wt,Hn){return Hn!==pt})),pt===xt&&kt(null)}})),pt<7&&pt===Je.length-1&&u.a.createElement($.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},u.a.createElement("i",{className:"".concat(q.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return Kt([].concat(Object(ye.a)(Je),[""]))}})))}),u.a.createElement("p",{className:q.a.titleWrap},u.a.createElement("span",{className:q.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),u.a.createElement(_e.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:$t,onChange:function(pt){return cn(pt)}}))},tt=Object(g.a)(function(re){var ae=re.loading,de=re.globalSetting;return{globalSetting:de,loading:ae.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(lt)),ft=["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(ae,de){var ue=ae.editData,we=ae.globalSetting,Le=ae.loading,rt=ae.dispatch,je=ae.onRef,Ye=je===void 0?function(){}:je,Dt=ae.isEdit,ut=Object(Ce.a)(ae,["editData","globalSetting","loading","dispatch","onRef","isEdit"]),mt=Object(m.useState)(""),zt=Object(c.a)(mt,2),Je=zt[0],Kt=zt[1],sn=Object(m.useState)(""),Bt=Object(c.a)(sn,2),an=Bt[0],Qt=Bt[1],ot=Object(m.useState)(""),Ft=Object(c.a)(ot,2),xt=Ft[0],kt=Ft[1];Object(m.useEffect)(function(){var Lt;if(!ue||!Dt)return;Kt(ue==null?void 0:ue.name),Qt(ue==null?void 0:ue.analysis),kt(ue==null||((Lt=ue.answer_texts)===null||Lt===void 0)?void 0:Lt[0])},[ue]),Object(m.useImperativeHandle)(de,function(){return{onSave:Mt,Clear:It}});var Mt=function(){return Je?xt?{name:Je,answer_texts:[xt],analysis:an}:(w.b.info("\u8BF7\u60A8\u8F93\u5165\u53C2\u8003\u7B54\u6848"),!1):(w.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1)},It=function(){Kt(""),Qt(""),kt("")};return u.a.createElement("section",{className:q.a.wrap},u.a.createElement("p",{className:q.a.titleWrap},u.a.createElement("span",{className:q.a.required},"*"),u.a.createElement("span",{className:q.a.title},"\u9898\u5E72\uFF1A")),u.a.createElement(_e.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Je,onChange:function(st){return Kt(st)}}),u.a.createElement("p",{className:q.a.titleWrap},u.a.createElement("span",{className:q.a.title},"\u53C2\u8003\u7B54\u6848\uFF1A")),u.a.createElement(_e.a,{id:"single-question-reference-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u53C2\u8003\u7B54\u6848",defaultValue:xt,onChange:function(st){return kt(st)}}),u.a.createElement("p",{className:q.a.titleWrap},u.a.createElement("span",{className:q.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),u.a.createElement(_e.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:an,onChange:function(st){return Qt(st)}}))},St=Object(g.a)(function(re){var ae=re.loading,de=re.globalSetting;return{globalSetting:de,loading:ae.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(nt)),ht=V("k1fw"),yt=["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"],ke=function(ae,de){var ue=ae.globalSetting,we=ae.loading,Le=ae.dispatch,rt=ae.editData,je=ae.onRef,Ye=je===void 0?function(){}:je,Dt=ae.isEdit,ut=Object(Ce.a)(ae,["globalSetting","loading","dispatch","editData","onRef","isEdit"]),mt=Object(m.useState)(""),zt=Object(c.a)(mt,2),Je=zt[0],Kt=zt[1],sn=Object(m.useState)([]),Bt=Object(c.a)(sn,2),an=Bt[0],Qt=Bt[1];console.log(an),Object(m.useEffect)(function(){var Mt;if(!rt||!Dt)return;Kt(rt==null?void 0:rt.name);var It=rt==null||((Mt=rt.sub_item_banks)===null||Mt===void 0)?void 0:Mt.map(function(Lt){var st,Ve,ln;return Object(ht.a)(Object(ht.a)({},Lt),{},{id:Lt.id,open:!1,qusList:Lt==null||((st=Lt.choices)===null||st===void 0)?void 0:st.map(function($t){return $t.choice_text}),activeQusEditor:null,qusAnswer:(Ve=[Lt==null||((ln=Lt.choices)===null||ln===void 0)?void 0:ln.findIndex(function($t){return $t.is_answer})])===null||Ve===void 0?void 0:Ve.filter(function($t){return $t!==-1})})});Qt(It)},[rt]),Object(m.useImperativeHandle)(de,function(){return{onSave:ot,Clear:Ft}});var ot=function(){if(!Je)return w.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;if(an.length===0)return w.b.info("\u8BF7\u60A8\u6DFB\u52A0\u5C0F\u9898"),!1;for(var It=0;It-1)return w.b.info("\u8BF7\u5148\u8F93\u5165\u7B2C".concat(It+1,"\u5C0F\u9898").concat(yt[Ve],"\u9009\u9879\u7684\u5185\u5BB9")),!1;if(!(st!=null&&st.qusAnswer.length))return w.b.info("\u8BF7\u8BBE\u7F6E\u7B2C".concat(It+1,"\u5C0F\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E")),!1}var ln=an.map(function($t){return{id:$t.id>1?$t.id:null,name:$t.name,item_type:$t.item_type,analysis:$t.analysis,choices:$t.qusList.map(function(cn,qt){return{choice_text:cn,is_answer:$t.qusAnswer[0]===qt?1:0}})}});return{name:Je,sub_item_banks:ln}},Ft=function(){Kt(""),Qt([])},xt=function(){var It={id:Math.random(),item_type:"SINGLE",open:!1,name:"",qusList:["","","",""],activeQusEditor:null,qusAnswer:[],analysis:""};Qt(an.concat(It))},kt=function(It,Lt,st){var Ve=Object(G.cloneDeep)(an);if(It==="open"&&(Ve[Lt].open=!Ve[Lt].open),It==="delete"&&Ve.splice(Lt,1),It==="value"&&(Ve[Lt].name=st),It==="answer"&&(Ve[Lt].qusAnswer=[st]),It==="edit"&&(Ve[Lt].activeQusEditor=st),It==="details"&&(Ve[Lt].qusList[Ve[Lt].activeQusEditor]=st),It==="addQus"&&(Ve[Lt].qusList=Ve[Lt].qusList.concat("")),It==="deleteQus"){var ln;Ve[Lt].qusList=Ve[Lt].qusList.filter(function($t,cn){return cn!==st}),Ve[Lt].qusAnswer=(ln=Ve[Lt].qusAnswer)===null||ln===void 0?void 0:ln.filter(function($t){return $t!==st})}It==="analysis"&&(Ve[Lt].analysis=st),Qt(Ve)};return u.a.createElement("section",{className:q.a.wrap},u.a.createElement("p",{className:q.a.titleWrap},u.a.createElement("span",{className:q.a.required},"*"),u.a.createElement("span",{className:q.a.title},"\u9898\u5E72\uFF1A")),u.a.createElement(_e.a,{id:"combination-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Je,onChange:function(It){return Kt(It)}}),an==null?void 0:an.map(function(Mt,It){var Lt;return u.a.createElement("div",{className:q.a.fold,key:Mt.id},u.a.createElement("div",{onClick:function(){return kt("open",It)},className:q.a.head},u.a.createElement("i",{className:"iconfont icon-sanjiaoxing",style:{transform:Mt.open?"initial":"rotate(270deg) translate(2px, 4px)"}}),u.a.createElement("span",null,"\u7B2C",It+1,"\u5C0F\u9898\uFF08\u5355\u9009\u9898\uFF09"),u.a.createElement("b",{style:{visibility:"hidden"},onClick:function(Ve){Ve.stopPropagation(),kt("delete",It)},className:"iconfont icon-shanchu8"})),u.a.createElement("div",{className:"mb10",style:{display:Mt.open?"block":"none"}},u.a.createElement(_e.a,{watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Mt==null?void 0:Mt.name,onChange:function(Ve){return kt("value",It,Ve)}}),u.a.createElement("p",{className:q.a.titleWrap},u.a.createElement("span",{className:q.a.required},"*"),u.a.createElement("span",{className:q.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",u.a.createElement("span",{className:q.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),Mt==null||((Lt=Mt.qusList)===null||Lt===void 0)?void 0:Lt.map(function(st,Ve){var ln,$t;return u.a.createElement("div",{className:q.a.choiceWrap,key:Ve},u.a.createElement($.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},u.a.createElement("div",{className:"".concat(q.a.answer," ").concat(Mt!=null&&(ln=Mt.qusAnswer)!==null&&ln!==void 0&&ln.includes(Ve)?q.a.activeAnswer:""),onClick:function(){return kt("answer",It,Ve)}},yt[Ve])),u.a.createElement("div",{className:q.a.editorWrap},(Mt==null?void 0:Mt.activeQusEditor)===Ve?u.a.createElement(_e.a,{id:"single-question-option-".concat(Ve),watch:!0,height:155,isFocus:!0,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:st,onChange:function(qt){return kt("details",It,qt)}}):u.a.createElement("div",{className:q.a.htmlWrap,onClick:function(){return kt("edit",It,Ve)}},u.a.createElement(a.a,{value:st}))),Ve>1&&u.a.createElement($.a,{title:"\u5220\u9664"},u.a.createElement("i",{className:"".concat(q.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return kt("deleteQus",It,Ve)}})),Ve<7&&Ve===(Mt==null||(($t=Mt.qusList)===null||$t===void 0)?void 0:$t.length)-1&&u.a.createElement($.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},u.a.createElement("i",{className:"".concat(q.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return kt("addQus",It)}})))}),u.a.createElement("p",{className:"mb10 mt10"},u.a.createElement("span",{className:q.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),u.a.createElement(_e.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Mt.analysis,onChange:function(Ve){return kt("analysis",It,Ve)}})))}))},Pt=Object(g.a)(function(re){var ae=re.loading,de=re.globalSetting;return{globalSetting:de,loading:ae.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(ke)),Tt=V("14J3"),Ue=V("BMrR"),Ze=V("ZWs3"),xe=function(ae){var de=ae.visible,ue=ae.onCancel,we=ae.onRandomExchange,Le=ae.selectFromProblemSet;return u.a.createElement(i.a,{title:"\u8BF7\u9009\u62E9\u66FF\u6362\u65B9\u5F0F",visible:de,onCancel:ue,centered:!0,maskClosable:!0,footer:null},u.a.createElement(Ue.a,{justify:"center"},u.a.createElement(Ze.a,{onClick:we},"\u968F\u673A\u66F4\u6362"),u.a.createElement(L.a,{style:{marginLeft:24},onClick:Le},"\u4ECE\u9898\u5E93\u4E2D\u9009\u62E9")))},fe=xe,be=function(ae){var de,ue,we,Le,rt,je,Ye,Dt,ut=ae.data,mt=ae.submit,zt=ae.goBack,Je=ae.loading,Kt=ae.onTypeScore,sn=ae.editPreview,Bt=sn===void 0?!1:sn,an=ae.onSkipExamination,Qt=ae.selectValue,ot=ae.onExchange,Ft=Object(m.useRef)(),xt=Object(m.useRef)(Object(G.debounce)(function(){return Fn()},100,{leading:!0,trailing:!0})),kt=Object(m.useState)(null),Mt=Object(c.a)(kt,2),It=Mt[0],Lt=Mt[1],st=Object(m.useState)(!1),Ve=Object(c.a)(st,2),ln=Ve[0],$t=Ve[1],cn=Object(m.useState)(!1),qt=Object(c.a)(cn,2),En=qt[0],on=qt[1],pt=Object(m.useRef)(),Ge=Object(b.i)();Object(m.useEffect)(function(){return window.addEventListener("scroll",xt==null?void 0:xt.current),function(){window.removeEventListener("scroll",xt==null?void 0:xt.current)}},[]),Object(m.useEffect)(function(){$t(!0)},[]),Object(m.useEffect)(function(){var _t,Te,it,Ht,Ot=(_t=document.getElementById("examName"))===null||_t===void 0||((Te=_t.getElementsByClassName("ant-pagination-options-quick-jumper"))===null||Te===void 0||((it=Te[0])===null||it===void 0||((Ht=it.childNodes)===null||Ht===void 0)))?void 0:Ht[2];Ot&&(Ot.nodeValue="\u4EFD")},[ut]);var wt=function(Te){var it=parseInt(Te);return isNaN(it)?"":it};function Hn(){var _t=0,Te=0,it=0;return document.body&&(Te=document.body.scrollTop),document.documentElement&&(it=document.documentElement.scrollTop),_t=Te-it>0?Te:it,_t}function fr(){var _t=0,Te=0,it=0;return document.body&&(Te=document.body.scrollHeight),document.documentElement&&(it=document.documentElement.scrollHeight),_t=Te-it>0?Te:it,_t}function Ar(){var _t=0;return document.compatMode=="CSS1Compat"?_t=document.documentElement.clientHeight:_t=document.body.clientHeight,_t}var Fn=function(){var Te=document.getElementById("preview_btns"),it=document.getElementById("preview_btns_else");Hn()+Ar()>=fr()-68?(Te.style.visibility="hidden",it.style.visibility="visible"):(Te.style.visibility="visible",it.style.visibility="hidden")},F=["\u5BB9\u6613","\u7B80\u5355","\u9002\u4E2D","\u56F0\u96BE"],p=function(Te){var it,Ht=[];return u.a.createElement(u.a.Fragment,null,u.a.createElement("aside",{className:d.a.single},Te==null||((it=Te.choices)===null||it===void 0)?void 0:it.map(function(Ot,Nt){return Ot.is_answer&&Ht.push(me[Nt]),u.a.createElement("ul",{key:Nt},u.a.createElement("li",null,me[Nt],"\u3001"),u.a.createElement("li",null,u.a.createElement(a.a,{value:Ot.choice_text})))})),u.a.createElement("div",{className:d.a.analysis},u.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",Ht.join(""),u.a.createElement("span",{className:"ml30"},"\u96BE\u5EA6\uFF1A",F[Te.difficulty])),u.a.createElement("aside",null,u.a.createElement("span",{className:d.a.text},"\u89E3\u6790:"),u.a.createElement(a.a,{value:Te.analysis?Te.analysis:"\u6682\u65E0\u89E3\u6790"})),u.a.createElement("ul",null,u.a.createElement("li",null,u.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat(Te==null?void 0:Te.discipline_name,"/").concat(Te==null?void 0:Te.sub_discipline_name)),u.a.createElement("li",null,u.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),Te==null?void 0:Te.tag_discipline_name))))},y=function(Te){var it,Ht=Te==null||((it=Te.standard_answer)===null||it===void 0)?void 0:it.map(function(Ot){var Nt;return"\u7B54\u6848\uFF08\u586B\u7A7A".concat(Ot.position,"\uFF09\uFF1A").concat(Ot==null||((Nt=Ot.answer_text)===null||Nt===void 0)?void 0:Nt.join("\u3001"))});return u.a.createElement(u.a.Fragment,null,u.a.createElement("div",{className:d.a.analysis},u.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",Ht),u.a.createElement("aside",null,u.a.createElement("span",{className:d.a.text},"\u89E3\u6790:"),u.a.createElement(a.a,{value:Te.analysis?Te.analysis:"\u6682\u65E0\u89E3\u6790"})),u.a.createElement("ul",null,u.a.createElement("li",null,u.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat(Te==null?void 0:Te.discipline_name,"/").concat(Te==null?void 0:Te.sub_discipline_name)),u.a.createElement("li",null,u.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),Te==null?void 0:Te.tag_discipline_name))))},M=function(Te){var it;return u.a.createElement("div",{className:d.a.analysis},u.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",Te==null||((it=Te.answer_texts)===null||it===void 0)?void 0:it[0]),u.a.createElement("aside",null,u.a.createElement("span",{className:d.a.text},"\u89E3\u6790:"),u.a.createElement(a.a,{value:Te.analysis?Te.analysis:"\u6682\u65E0\u89E3\u6790"})),u.a.createElement("ul",null,u.a.createElement("li",null,u.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat(Te==null?void 0:Te.discipline_name,"/").concat(Te==null?void 0:Te.sub_discipline_name)),u.a.createElement("li",null,u.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),Te==null?void 0:Te.tag_discipline_name)))},Q=function(Te){var it;return u.a.createElement("div",{className:d.a.analysis},u.a.createElement("aside",null,u.a.createElement("span",{className:d.a.text},"\u9884\u671F\u8F93\u51FA:"),u.a.createElement(a.a,{value:Te==null||((it=Te.program_attr)===null||it===void 0)?void 0:it.description})),u.a.createElement("ul",null,u.a.createElement("li",null,u.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat(Te==null?void 0:Te.discipline_name,"/").concat(Te==null?void 0:Te.sub_discipline_name)),u.a.createElement("li",null,u.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),Te==null?void 0:Te.tag_discipline_name)))},W=function(Te,it){var Ht;return u.a.createElement("div",null,Te==null||((Ht=Te.sub_item_banks)===null||Ht===void 0)?void 0:Ht.map(function(Ot,Nt){var Xt,Dn=[];return u.a.createElement(u.a.Fragment,null,u.a.createElement("div",{style:{marginLeft:25,fontSize:"16px",color:"#333"}},it+1+"."+(Nt+1),"\uFF08\u5355\u9009\u9898\uFF09",Ot.name),u.a.createElement("aside",{className:d.a.single},Ot==null||((Xt=Ot.choices)===null||Xt===void 0)?void 0:Xt.map(function(Sn,un){return Sn.is_answer&&Dn.push(me[un]),u.a.createElement("ul",{key:un},u.a.createElement("li",null,me[un],"\u3001"),u.a.createElement("li",null,u.a.createElement(a.a,{value:Sn.choice_text})))})),u.a.createElement("div",{className:d.a.analysis},u.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",Dn.join(""),u.a.createElement("span",{className:"ml30"},"\u96BE\u5EA6\uFF1A",F[Ot.difficulty])),u.a.createElement("aside",null,u.a.createElement("span",{className:d.a.text},"\u89E3\u6790:"),u.a.createElement(a.a,{value:Ot.analysis?Ot.analysis:"\u6682\u65E0\u89E3\u6790"})),u.a.createElement("ul",null,u.a.createElement("li",null,u.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat(Te==null?void 0:Te.discipline_name,"/").concat(Te==null?void 0:Te.sub_discipline_name)),u.a.createElement("li",null,u.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),Te==null?void 0:Te.tag_discipline_name))))}))},me=["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"],$e=function(Te){var it,Ht=[];Te==null||((it=Te.questions)===null||it===void 0)||it.map(function(Nt){var Xt;return Nt==null||((Xt=Nt.sub_item_banks)===null||Xt===void 0)?void 0:Xt.map(function(Dn){Ht.push(Dn)})});var Ot=0;Te.type==="COMBINATION"?Ot=Te.questions_score/Ht.length:Ot=Te.questions_score/Te.questions_count,i.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u5206\u6570\u8BBE\u7F6E",content:u.a.createElement("div",{className:d.a.modalColumn},u.a.createElement("div",{className:d.a.modalRow,style:{justifyContent:"flex-start"}},u.a.createElement("sup",{className:d.a.sup},"*"),u.a.createElement("span",null,Te==null?void 0:Te.name,(Te==null?void 0:Te.type)==="COMBINATION"&&"\u4E2D\u7684\u6BCF\u5C0F\u9898","\uFF1A"),u.a.createElement(h.a,{min:1,parser:wt,defaultValue:Ot,onChange:function(Xt){Ot=Xt}}),u.a.createElement("span",{className:"ml5"},"\u5206/\u9898"))),okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var Nt=Object(S.a)(v.a.mark(function Dn(){var Sn,un;return v.a.wrap(function(Kn){for(;;)switch(Kn.prev=Kn.next){case 0:if(Ot){Kn.next=3;break}return w.b.warn("\u5206\u6570\u4E0D\u80FD\u4E3A\u7A7A\u6216\u4E3A0"),Kn.abrupt("return",Promise.reject());case 3:Te.type==="COMBINATION"?(Sn={type:Te==null?void 0:Te.type,score:Ot,scoreTotal:Ot*(Ht==null?void 0:Ht.length)},Kt(Sn)):(un={type:Te==null?void 0:Te.type,score:Ot,scoreTotal:Ot*Te.questions_count},Kt(un));case 4:case"end":return Kn.stop()}},Dn)}));function Xt(){return Nt.apply(this,arguments)}return Xt}()})},ct=function(){var Te="";i.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u4FDD\u5B58\u8BD5\u5377",content:u.a.createElement("div",{className:d.a.modalColumn},u.a.createElement("div",{style:{color:"#676A6C",display:"flex"},className:"font14 mt20"},u.a.createElement("img",{style:{marginRight:5},src:te.a}),"\u4FDD\u5B58\u540E\u5355\u72EC\u751F\u6210\u4E00\u4EFD\u4EBA\u5DE5\u7EC4\u5377\u7C7B\u578B\u7684\u56FA\u5B9A\u8BD5\u5377\u3002"),u.a.createElement("div",{className:d.a.modalRow,style:{marginTop:20}},u.a.createElement("sup",{className:d.a.sup},"*"),u.a.createElement("span",{style:{flexShrink:0}},"\u8BD5\u5377\u540D\u79F0\uFF1A"),u.a.createElement(A.a,{placeholder:"\u8BF7\u8F93\u5165\u8BD5\u5377\u540D\u79F0",min:0,maxLength:60,defaultValue:Te,onChange:function(Ht){Te=Ht.target.value}}))),okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var it=Object(S.a)(v.a.mark(function Ot(){var Nt,Xt,Dn,Sn,un;return v.a.wrap(function(Kn){for(;;)switch(Kn.prev=Kn.next){case 0:if(Te){Kn.next=3;break}return w.b.warn("\u8BD5\u5377\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A"),Kn.abrupt("return",Promise.reject());case 3:return Xt=[],Dn=[],Sn=[],ut==null||((Nt=ut.questionList)===null||Nt===void 0)||Nt.forEach(function(ir){var yn;(yn=ir.questions)===null||yn===void 0||yn.forEach(function(mn){Xt.push(mn.id),Dn.push(ir.questions_score/ir.questions_count),ir.type==="COMBINATION"&&Sn.push({id:mn.id,sub_item_bank_ids:mn.sub_item_banks.map(function(Ln){return Ln.id})})})}),console.log("-----",Sn),un={item_bank_ids:Xt,item_bank_scores:Dn,name:Te,combination_item_banks:Sn},Kn.next=11,mt(un);case 11:case"end":return Kn.stop()}},Ot)}));function Ht(){return it.apply(this,arguments)}return Ht}()})},jt=function(Te,it,Ht,Ot){var Nt,Xt="".concat(location.pathname).concat(location.search),Dn=(Nt=Ot.questions)===null||Nt===void 0?void 0:Nt.map(function(un){return un.id});if(Xt.includes("exercise"))pt.current={id:Te,ids:Dn,type:it,index:Ht},on(!0);else var Sn=i.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 un=Object(S.a)(v.a.mark(function Kn(){return v.a.wrap(function(yn){for(;;)switch(yn.prev=yn.next){case 0:return Sn.update({cancelButtonProps:{disabled:!0}}),yn.next=3,ot({single_question_id:Te,seleted_item_bank_ids:Dn},{type:it,index:Ht});case 3:Sn.update({cancelButtonProps:{disabled:!1}}),w.b.success("\u5DF2\u91CD\u65B0\u968F\u673A\u751F\u6210\u8BD5\u9898");case 5:case"end":return yn.stop()}},Kn)}));function jn(){return un.apply(this,arguments)}return jn}()})},Qe=function(Te){var it,Ht=(it=Te.questions)===null||it===void 0?void 0:it.map(function(Xt){return Xt.id}),Ot=Te.name,Nt=i.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u6E29\u99A8\u63D0\u793A",content:"\u786E\u8BA4\u66F4\u6362".concat(Ot,"\u4E2D\u7684\u6240\u6709\u8BD5\u9898\u5417\uFF1F"),cancelButtonProps:{disabled:!1},maskClosable:!1,keyboard:!1,okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var Xt=Object(S.a)(v.a.mark(function Sn(){return v.a.wrap(function(jn){for(;;)switch(jn.prev=jn.next){case 0:return Nt.update({cancelButtonProps:{disabled:!0}}),jn.next=3,ot({seleted_item_bank_ids:Ht},{type:Te.type});case 3:Nt.update({cancelButtonProps:{disabled:!1}}),w.b.success("\u5DF2\u91CD\u65B0\u968F\u673A\u751F\u6210".concat(Ot,"\u8BD5\u9898"));case 5:case"end":return jn.stop()}},Sn)}));function Dn(){return Xt.apply(this,arguments)}return Dn}()})},Vt=function(){var Te=i.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 it=Object(S.a)(v.a.mark(function Ot(){return v.a.wrap(function(Xt){for(;;)switch(Xt.prev=Xt.next){case 0:return Te.update({cancelButtonProps:{disabled:!0}}),Xt.next=3,ot();case 3:Te.update({cancelButtonProps:{disabled:!1}}),w.b.success("\u5DF2\u91CD\u65B0\u968F\u673A\u751F\u6210\u6574\u5F20\u8BD5\u9898");case 5:case"end":return Xt.stop()}},Ot)}));function Ht(){return it.apply(this,arguments)}return Ht}()})},hn=function(Te){console.log(Te,"key"),an(Te-1)},Rn=function(){return u.a.createElement(u.a.Fragment,null,u.a.createElement(N.a,{color:"#55575D",overlayClassName:d.a.popover,visible:ln,getPopupContainer:function(it){return it==null?void 0:it.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"},u.a.createElement(L.a,{onMouseEnter:function(){return $t(!0)},onMouseLeave:function(){return $t(!1)},onClick:function(){ct()}},"\u4FDD\u5B58")),u.a.createElement(L.a,{onClick:function(){document.body.scrollIntoView(),zt()}},"\u8FD4\u56DE"),u.a.createElement(L.a,{loading:Je,onClick:function(){return mt()},type:"primary"},"\u63D0\u4EA4"))},pr=function(){var Te;return u.a.createElement(u.a.Fragment,null,u.a.createElement(L.a,{onClick:zt},"\u8FD4\u56DE"),Qt>0&&u.a.createElement(L.a,{onClick:function(){return hn(Qt)},type:"primary"},"\u4E0A\u4E00\u4EFD"),Qt<(ut==null||((Te=ut.exam)===null||Te===void 0)?void 0:Te.total_num)-1&&u.a.createElement(L.a,{onClick:function(){return hn(Qt+2)}},"\u4E0B\u4E00\u4EFD"))},qn=function(Te,it){if(it==="SINGLE")return u.a.createElement(u.a.Fragment,null,u.a.createElement(tt,{ref:Ft,editData:Te,isEdit:!0}),u.a.createElement(I.a,null));if(it==="MULTIPLE")return u.a.createElement(u.a.Fragment,null,u.a.createElement(He,{ref:Ft,editData:Te,isEdit:!0}),u.a.createElement(I.a,null));if(it==="JUDGMENT")return u.a.createElement(u.a.Fragment,null,u.a.createElement(Fe,{ref:Ft,editData:Te,isEdit:!0}),u.a.createElement(I.a,null));if(it==="COMPLETION")return u.a.createElement(u.a.Fragment,null,u.a.createElement(Ne,{ref:Ft,editData:Te,isEdit:!0}),u.a.createElement(I.a,null));if(it==="SUBJECTIVE")return u.a.createElement(u.a.Fragment,null,u.a.createElement(St,{ref:Ft,editData:Te,isEdit:!0}),u.a.createElement(I.a,null));if(it==="COMBINATION")return u.a.createElement(u.a.Fragment,null,u.a.createElement(Pt,{ref:Ft,editData:Te,isEdit:!0}),u.a.createElement(I.a,null));if(it==="PROGRAM"){var Ht;g.d.push("/problems/".concat(Te==null||((Ht=Te.program_attr)===null||Ht===void 0)?void 0:Ht.identifier,"/edit?type=exercises&express_id=").concat(Ge.categoryId,"&question_id=").concat(Te==null?void 0:Te.id,"&score=").concat(Te==null?void 0:Te.score,"&callback_url=").concat(location.pathname,"&select=").concat(Qt,"&exercise=true"))}},xn=function(){var _t=Object(S.a)(v.a.mark(function Te(it,Ht){var Ot,Nt,Xt,Dn,Sn,un,jn,Kn,ir,yn;return v.a.wrap(function(Ln){for(;;)switch(Ln.prev=Ln.next){case 0:return Ln.next=2,(Ot=Ft.current)===null||Ot===void 0?void 0:Ot.onSave();case 2:if(Nt=Ln.sent,Nt){Ln.next=5;break}return Ln.abrupt("return");case 5:return Xt={question_score:Ht.score,analysis:Nt.analysis},(it==="SINGLE"||it==="MULTIPLE"||it==="JUDGMENT")&&(Sn=[],un=[],Xt.question_type=it==="JUDGMENT"?2:1,Xt.question_title=Nt==null?void 0:Nt.name,Nt==null||((Dn=Nt.choices)===null||Dn===void 0)||Dn.forEach(function(en,Un){Sn.push(en.choice_text),en!=null&&en.is_answer&&un.push(Un+1)}),Xt.question_choices=Sn,Xt.standard_answers=un),it==="COMPLETION"&&(Xt.is_ordered=Nt.is_ordered,Xt.question_title=Nt==null?void 0:Nt.name,Xt.question_type=3,Kn=[],Nt==null||((jn=Nt.standard_answers)===null||jn===void 0)||jn.forEach(function(en,Un){Kn.push({choice_id:en.position,answer_text:en.answer_text})}),Xt.standard_answers=Kn),it==="SUBJECTIVE"&&(Xt.question_title=Nt==null?void 0:Nt.name,Xt.question_type=3,Xt.standard_answers=Nt==null?void 0:Nt.answer_texts),it==="COMBINATION"&&(Xt.question_title=Nt==null?void 0:Nt.name,Xt.question_type=7,Xt.sub_questions=Nt==null||((ir=Nt.sub_item_banks)===null||ir===void 0)?void 0:ir.map(function(en,Un){return{id:en.id,question_title:en.name,question_type:1,question_choices:en.choices.map(function(_n){return _n.choice_text}),standard_answers:[en.choices.findIndex(function(_n){return _n.is_answer})+1],analysis:en.analysis}}),delete Xt.analysis),Ln.next=12,Object(_.a)("/api/exercise_questions/".concat(Ht.id,".json"),{method:"put",body:Xt});case 12:yn=Ln.sent,(yn==null?void 0:yn.status)===0&&(w.b.success("\u7F16\u8F91\u6210\u529F"),hn(Qt+1)),Lt(null);case 15:case"end":return Ln.stop()}},Te)}));return function(it,Ht){return _t.apply(this,arguments)}}(),Rr=function(){for(var Te=[],it=0;it<(ut==null||((Ht=ut.exam)===null||Ht===void 0)?void 0:Ht.total_num);it++){var Ht;Te.push({})}return Te},qr=ut==null||((de=ut.questionList)===null||de===void 0)?void 0:de.reduce(function(_t,Te){return _t+Te.questions_score},0),Vn=Bt&&(ut==null||((ue=ut.exam)===null||ue===void 0)?void 0:ue.exercise_status)!==1;return u.a.createElement("section",{className:d.a.wrap},u.a.createElement("div",{id:"id_left_preview",className:d.a.left,onMouseEnter:function(Te){var it=document.getElementById("id_left_preview");it.style.overflowY="auto"},onMouseLeave:function(Te){var it=document.getElementById("id_left_preview");it.style.overflowY="hidden"}},u.a.createElement("div",{className:d.a.title},u.a.createElement("div",null,u.a.createElement("b",null),u.a.createElement("span",null,"\u7B54\u9898\u5361"))),u.a.createElement("div",{className:d.a.total},u.a.createElement("div",null,u.a.createElement("img",{src:H.a}),u.a.createElement("span",null,"\u9898\u6570(\u9053)"),u.a.createElement("aside",null,ut==null?void 0:ut.all_questions_count)),u.a.createElement("div",{className:"mr30 ml30"},u.a.createElement("img",{src:Z.a}),u.a.createElement("span",null,"\u603B\u5206(\u5206)"),u.a.createElement("aside",null,qr)),u.a.createElement("div",null,u.a.createElement("img",{src:s.a}),u.a.createElement("span",null,"\u65F6\u957F(\u5206)"),u.a.createElement("aside",null,ut==null||((we=ut.exam)===null||we===void 0)?void 0:we.time))),ut==null||((Le=ut.questionList)===null||Le===void 0)?void 0:Le.map(function(_t,Te){var it;return u.a.createElement("div",{className:d.a.list,key:Te},u.a.createElement("div",{className:d.a.name},u.a.createElement("b",null),u.a.createElement("span",null,_t.name)),u.a.createElement("aside",null,u.a.createElement("div",null,"\u5171",u.a.createElement("span",{className:d.a.b},_t.questions_count),"\u9898"," ",u.a.createElement("span",{className:d.a.l},"|"),"\u5171",u.a.createElement("span",{className:d.a.r},_t.questions_score),"\u5206"),u.a.createElement("div",{className:d.a.answerSheet},_t==null||((it=_t.questions)===null||it===void 0)?void 0:it.map(function(Ht,Ot){return u.a.createElement("div",{onClick:function(){var Xt="Anchor_".concat(Ht.id),Dn=document.getElementById(Xt);Dn&&setTimeout(function(){return Dn.scrollIntoView({block:"center",behavior:"smooth"})})},key:Ht.id,className:d.a.tag},Ot+1)}))))})),u.a.createElement("div",{className:d.a.right},u.a.createElement("div",{className:d.a.examName,id:"examName"},u.a.createElement("div",{className:d.a.name},u.a.createElement($.a,{title:ut==null||((rt=ut.exam)===null||rt===void 0)?void 0:rt.name,getPopupContainer:function(Te){return Te.parentNode}},u.a.createElement("span",{className:d.a.t},ut==null||((je=ut.exam)===null||je===void 0)?void 0:je.name))),Bt?u.a.createElement(Y.a,{showTotal:function(Te){return u.a.createElement("span",{style:{color:"#656F87",fontSize:14}},"\u5171\u8BA1",u.a.createElement("span",{className:"c-light-primary"},Te),"\u4EFD\u8BD5\u5377")},total:ut==null||((Ye=ut.exam)===null||Ye===void 0)?void 0:Ye.total_num,pageSize:1,current:Qt+1,showSizeChanger:!1,onChange:hn,showQuickJumper:!0,hideOnSinglePage:!1}):u.a.createElement(L.a,{onClick:Vt,type:"primary"},"\u968F\u673A\u66F4\u6362")),u.a.createElement("div",{className:d.a.topWarp},ut==null||((Dt=ut.questionList)===null||Dt===void 0)?void 0:Dt.map(function(_t,Te){var it,Ht;return u.a.createElement(u.a.Fragment,{key:Te},u.a.createElement("div",{className:d.a.head,style:Te===0?{border:0,marginTop:-16}:{}},u.a.createElement("div",{className:d.a.name},u.a.createElement("b",null),u.a.createElement("span",null,_t.name)),u.a.createElement("div",{className:d.a.so},"\u5171",u.a.createElement("span",{className:d.a.b},_t.questions_count," "),"\u9898"," ",_t.type==="COMBINATION"&&"\uFF08\u5305\u542B".concat(_t==null||((it=_t.questions)===null||it===void 0)?void 0:it.map(function(Ot){var Nt;return Ot==null||((Nt=Ot.sub_item_banks)===null||Nt===void 0)?void 0:Nt.length}).reduce(function(Ot,Nt){return Ot+Nt}),"\u5C0F\u9898\uFF09"),u.a.createElement("span",{className:d.a.l},"|"),"\u5171",u.a.createElement("span",{className:d.a.r},_t.questions_score),"\u5206"),!Bt&&u.a.createElement("div",{className:d.a.btn},u.a.createElement(L.a,{onClick:function(){$e(_t)},type:"primary",ghost:!0,className:"mr20"},"\u8BBE\u7F6E\u5F97\u5206"),u.a.createElement(L.a,{onClick:function(){return Qe(_t)},type:"primary",ghost:!0},"\u968F\u673A\u66F4\u6362"))),_t==null||((Ht=_t.questions)===null||Ht===void 0)?void 0:Ht.map(function(Ot,Nt){return It===Ot.id?u.a.createElement("div",{id:"Anchor_".concat(Ot.id),className:d.a.content,style:{padding:0,marginTop:10},key:Ot.id},u.a.createElement("div",{style:{float:"right",marginTop:-6}},u.a.createElement(L.a,{onClick:function(){return Lt(null)},className:"mr20",type:"primary",ghost:!0},"\u53D6\u6D88"),u.a.createElement(L.a,{onClick:function(){return xn(_t==null?void 0:_t.type,Ot)},type:"primary"},"\u4FDD\u5B58")),qn(Ot,_t.type)):u.a.createElement("div",{id:"Anchor_".concat(Ot.id),className:d.a.content,key:Ot.id},u.a.createElement("div",{className:d.a.titleWrap},u.a.createElement(a.a,{style:{paddingRight:10},className:d.a.titleHtml,value:Nt+1+"\u3001"+"".concat((Ot==null?void 0:Ot.item_type)==="combination"?"\uFF08\u9898\u5E72\uFF09":"")+Ot.name}),Bt&&u.a.createElement(L.a,{disabled:Vn,onClick:function(){if(It){w.b.warn("\u5148\u4FDD\u5B58\u6216\u53D6\u6D88\u5F53\u524D\u6B63\u5728\u7F16\u8F91\u7684\u8BD5\u9898");return}Lt(Ot.id)},type:"primary",className:"mr20",style:{marginLeft:"auto"},ghost:!0},"\u7F16\u8F91"),u.a.createElement(L.a,{disabled:Vn,onClick:function(){return jt(Ot.id,_t.type,Nt,_t)},type:"primary",ghost:!0},"\u6362\u4E00\u9898")),(_t.type==="SINGLE"||_t.type==="JUDGMENT"||_t.type==="MULTIPLE")&&p(Ot),_t.type==="COMPLETION"&&y(Ot),_t.type==="SUBJECTIVE"&&M(Ot),_t.type==="PROGRAM"&&Q(Ot),_t.type==="COMBINATION"&&W(Ot,Nt),u.a.createElement("div",null))}))})),u.a.createElement("div",{className:d.a.btnsElse,id:"preview_btns_else"},Bt?pr():Rn()),u.a.createElement("div",{className:d.a.btnsWrap,id:"preview_btns"},u.a.createElement("div",{className:d.a.btns},Bt?pr():Rn()))),u.a.createElement(fe,{visible:En,onRandomExchange:Object(S.a)(v.a.mark(function _t(){var Te;return v.a.wrap(function(Ht){for(;;)switch(Ht.prev=Ht.next){case 0:return Te=pt.current,Ht.next=3,ot({single_question_id:Te.id,seleted_item_bank_ids:Te.ids},{type:Te.type,index:Te.index});case 3:on(!1);case 4:case"end":return Ht.stop()}},_t)})),selectFromProblemSet:function(){var Te=pt.current,it="".concat(location.pathname).concat(location.search);it.includes("exercise")&&g.d.push("/paperlibrary/exchangequestion?type=exercise&qid=".concat(Te.id,"&qtype=").concat(Te.type,"&exerciseid=").concat(Ge.categoryId,"&from=").concat(it))},onCancel:function(){on(!1)}}))},ne=Xe.a=be},sboe:function(at,Xe,V){"use strict";V.d(Xe,"a",function(){return D});var oe=V("q1tI"),Y=V.n(oe),D=oe.createContext(null)},tmPe:function(at,Xe,V){at.exports={flex_box_center:"flex_box_center___ivyUy",flex_space_between:"flex_space_between___1h8Qq",flex_box_vertical_center:"flex_box_vertical_center___3eC95",flex_box_center_end:"flex_box_center_end___nrhvX",flex_box_column:"flex_box_column___2po4_",customTree:"customTree___1LpRW",name:"name___17ZTs"}},ulZh:function(at,Xe,V){typeof window!="undefined"&&function(Y,D){at.exports=D()}(this,function(){return function(oe){var Y={};function D($){if(Y[$])return Y[$].exports;var U=Y[$]={i:$,l:!1,exports:{}};return oe[$].call(U.exports,U,U.exports,D),U.l=!0,U.exports}return D.m=oe,D.c=Y,D.d=function($,U,I){D.o($,U)||Object.defineProperty($,U,{enumerable:!0,get:I})},D.r=function($){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty($,Symbol.toStringTag,{value:"Module"}),Object.defineProperty($,"__esModule",{value:!0})},D.t=function($,U){if(U&1&&($=D($)),U&8)return $;if(U&4&&typeof $=="object"&&$&&$.__esModule)return $;var I=Object.create(null);if(D.r(I),Object.defineProperty(I,"default",{enumerable:!0,value:$}),U&2&&typeof $!="string")for(var K in $)D.d(I,K,function(N){return $[N]}.bind(null,K));return I},D.n=function($){var U=$&&$.__esModule?function(){return $.default}:function(){return $};return D.d(U,"a",U),U},D.o=function($,U){return Object.prototype.hasOwnProperty.call($,U)},D.p="/dist/",D(D.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(oe,Y,D){"use strict";var $=Object.prototype.hasOwnProperty,U="~";function I(){}Object.create&&(I.prototype=Object.create(null),new I().__proto__||(U=!1));function K(x,A,P){this.fn=x,this.context=A,this.once=P||!1}function N(x,A,P,w,S){if(typeof P!="function")throw new TypeError("The listener must be a function");var T=new K(P,w||x,S),h=U?U+A:A;return x._events[h]?x._events[h].fn?x._events[h]=[x._events[h],T]:x._events[h].push(T):(x._events[h]=T,x._eventsCount++),x}function O(x,A){--x._eventsCount===0?x._events=new I:delete x._events[A]}function L(){this._events=new I,this._eventsCount=0}L.prototype.eventNames=function(){var A=[],P,w;if(this._eventsCount===0)return A;for(w in P=this._events)$.call(P,w)&&A.push(U?w.slice(1):w);return Object.getOwnPropertySymbols?A.concat(Object.getOwnPropertySymbols(P)):A},L.prototype.listeners=function(A){var P=U?U+A:A,w=this._events[P];if(!w)return[];if(w.fn)return[w.fn];for(var S=0,T=w.length,h=new Array(T);S0},!1)}function x(A,P){for(var w={main:[P]},S={main:[]},T={main:{}};L(w);)for(var h=Object.keys(w),l=0;l=2*u/d||_<=H)return;var z=Number.POSITIVE_INFINITY,Z;for(Z=h.level-1;Z>s;Z--){var G=f[Z].maxBitrate;if(z=u*G/(8*.8*g),z=_)return;var B=this.bwEstimator.getEstimate();L.logger.warn("Fragment "+h.sn+(l?" part "+l.index:"")+" of level "+h.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+Z+` Current BW estimate: `+(Object($.isFiniteNumber)(B)?(B/1024).toFixed(3):"Unknown")+` Kb/s Estimated load time for current fragment: `+_.toFixed(3)+` s Estimated load time for the next fragment: `+z.toFixed(3)+` s Time to underbuffer: `+H.toFixed(3)+" s"),i.nextLoadLevel=Z,this.bwEstimator.sample(E,m.loaded),this.clearTimer(),h.loader&&(this.fragCurrent=this.partCurrent=null,h.loader.abort()),i.trigger(I.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:h,part:l,stats:m})},S.onFragLoaded=function(h,l){var i=l.frag,c=l.part;if(i.type===O.PlaylistLevelType.MAIN&&Object($.isFiniteNumber)(i.sn)){var C=c?c.stats:i.stats,v=c?c.duration:i.duration;if(this.clearTimer(),this.lastLoadedFragLevel=i.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var m=this.hls.levels[i.level],u=(m.loaded?m.loaded.bytes:0)+C.loaded,E=(m.loaded?m.loaded.duration:0)+v;m.loaded={bytes:u,duration:E},m.realBitrate=Math.round(8*u/E)}if(i.bitrateTest){var d={stats:C,frag:i,part:c,id:i.type};this.onFragBuffered(I.Events.FRAG_BUFFERED,d),i.bitrateTest=!1}}},S.onFragBuffered=function(h,l){var i=l.frag,c=l.part,C=c?c.stats:i.stats;if(C.aborted)return;if(i.type!==O.PlaylistLevelType.MAIN||i.sn==="initSegment")return;var v=C.parsing.end-C.loading.start;this.bwEstimator.sample(v,C.loaded),C.bwEstimate=this.bwEstimator.getEstimate(),i.bitrateTest?this.bitrateTestDelay=v/1e3:this.bitrateTestDelay=0},S.onError=function(h,l){switch(l.details){case N.ErrorDetails.FRAG_LOAD_ERROR:case N.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},S.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},S.getNextABRAutoLevel=function(){var h=this.fragCurrent,l=this.partCurrent,i=this.hls,c=i.maxAutoLevel,C=i.config,v=i.minAutoLevel,m=i.media,u=l?l.duration:h?h.duration:0,E=m?m.currentTime:0,d=m&&m.playbackRate!==0?Math.abs(m.playbackRate):1,f=this.bwEstimator?this.bwEstimator.getEstimate():C.abrEwmaDefaultEstimate,s=(K.BufferHelper.bufferInfo(m,E,C.maxBufferHole).end-E)/d,a=this.findBestLevel(f,v,c,s,C.abrBandWidthFactor,C.abrBandWidthUpFactor);if(a>=0)return a;L.logger.trace((s?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var b=u?Math.min(u,C.maxStarvationDelay):C.maxStarvationDelay,g=C.abrBandWidthFactor,_=C.abrBandWidthUpFactor;if(!s){var k=this.bitrateTestDelay;if(k){var H=u?Math.min(u,C.maxLoadingDelay):C.maxLoadingDelay;b=H-k,L.logger.trace("bitrate test took "+Math.round(1e3*k)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*b)+" ms"),g=_=1}}return a=this.findBestLevel(f,v,c,s+b,g,_),Math.max(a,0)},S.findBestLevel=function(h,l,i,c,C,v){for(var m,u=this.fragCurrent,E=this.partCurrent,d=this.lastLoadedFragLevel,f=this.hls.levels,s=f[d],a=!!(s!=null&&(m=s.details)!==null&&m!==void 0&&m.live),b=s==null?void 0:s.codecSet,g=E?E.duration:u?u.duration:0,_=i;_>=l;_--){var k=f[_];if(!k||b&&k.codecSet!==b)continue;var H=k.details,z=(E?H==null?void 0:H.partTarget:H==null?void 0:H.averagetargetduration)||g,Z=void 0;_<=d?Z=C*h:Z=v*h;var G=f[_].maxBitrate,B=G*z/Z;if(L.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+_+"/"+Math.round(Z)+"/"+G+"/"+z+"/"+c+"/"+B),Z>G&&(!B||a&&!this.bitrateTestDelay||B0&&s===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=U.State.IDLE):(this.loadedmetadata=!1,this.state=U.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=s,this.tick()},d.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_TRACK:{var s,a=this.levels,b=this.trackId,g=a==null||((s=a[b])===null||s===void 0)?void 0:s.details;if(g){if(this.waitForCdnTuneIn(g))break;this.state=U.State.WAITING_INIT_PTS}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var _,k=performance.now(),H=this.retryDate;(!H||k>=H||(_=this.media)!==null&&_!==void 0&&_.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=U.State.IDLE);break}case U.State.WAITING_INIT_PTS:{var z=this.waitingData;if(z){var Z=z.frag,G=z.part,B=z.cache,te=z.complete;if(this.initPTS[Z.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.FRAG_LOADING;var ce=B.flush(),pe={frag:Z,part:G,payload:ce,networkDetails:null};this._handleFragmentLoadProgress(pe),te&&u.prototype._handleFragmentLoadComplete.call(this,pe)}else if(this.videoTrackCC!==this.waitingVideoCC)l.logger.log("Waiting fragment cc ("+Z.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ye=this.getLoadPosition(),Ce=K.BufferHelper.bufferInfo(this.mediaBuffer,ye,this.config.maxBufferHole),_e=Object(S.fragmentWithinToleranceTest)(Ce.end,this.config.maxFragLookUpTolerance,Z);_e<0&&(l.logger.log("Waiting fragment cc ("+Z.cc+") @ "+Z.start+" cancelled because another fragment at "+Ce.end+" is needed"),this.clearWaitingFragment())}}else this.state=U.State.IDLE}}this.onTickEnd()},d.clearWaitingFragment=function(){var s=this.waitingData;s&&(this.fragmentTracker.removeFragment(s.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.IDLE)},d.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},d.doTickIdle=function(){var s,a,b=this.hls,g=this.levels,_=this.media,k=this.trackId,H=b.config;if(!g||!g[k])return;if(!_&&(this.startFragRequested||!H.startFragPrefetch))return;var z=g[k],Z=z.details;if(!Z||Z.live&&this.levelLastLoaded!==k||this.waitForCdnTuneIn(Z)){this.state=U.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,x.ElementaryStreamTypes.AUDIO,L.PlaylistLevelType.AUDIO));var G=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,L.PlaylistLevelType.AUDIO);if(G===null)return;var B=G.len,te=this.getMaxBufferLength(),ce=this.audioSwitch;if(B>=te&&!ce)return;if(!ce&&this._streamEnded(G,Z)){b.trigger(I.Events.BUFFER_EOS,{type:"audio"}),this.state=U.State.ENDED;return}var pe=Z.fragments,ye=pe[0].start,Ce=G.end;if(ce){var _e=this.getLoadPosition();Ce=_e,Z.PTSKnown&&_eye||G.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),_.currentTime=ye+.05))}var le=this.getNextFragment(Ce,Z);if(!le){this.bufferFlushed=!0;return}((s=le.decryptdata)===null||s===void 0?void 0:s.keyFormat)==="identity"&&!((a=le.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(le,Z):this.loadFragment(le,Z,Ce)},d.getMaxBufferLength=function(){var s=u.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,L.PlaylistLevelType.MAIN);return a===null?s:Math.max(s,a.len)},d.onMediaDetaching=function(){this.videoBuffer=null,u.prototype.onMediaDetaching.call(this)},d.onAudioTracksUpdated=function(s,a){var b=a.audioTracks;this.resetTransmuxer(),this.levels=b.map(function(g){return new O.Level(g)})},d.onAudioTrackSwitching=function(s,a){var b=!!a.url;this.trackId=a.id;var g=this.fragCurrent;g!=null&&g.loader&&g.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),b?this.setInterval(v):this.resetTransmuxer(),b?(this.audioSwitch=!0,this.state=U.State.IDLE):this.state=U.State.STOPPED,this.tick()},d.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},d.onLevelLoaded=function(s,a){this.mainDetails=a.details},d.onAudioTrackLoaded=function(s,a){var b,g=this.levels,_=a.details,k=a.id;if(!g){this.warn("Audio tracks were reset while loading level "+k);return}this.log("Track "+k+" loaded ["+_.startSN+","+_.endSN+"],duration:"+_.totalduration);var H=g[k],z=0;if(_.live||(b=H.details)!==null&&b!==void 0&&b.live){var Z=this.mainDetails;if(_.fragments[0]||(_.deltaUpdateFailed=!0),_.deltaUpdateFailed||!Z)return;!H.details&&_.hasProgramDateTime&&Z.hasProgramDateTime?(Object(T.alignMediaPlaylistByPDT)(_,Z),z=_.fragments[0].start):z=this.alignPlaylists(_,H.details)}H.details=_,this.levelLastLoaded=k,!this.startFragRequested&&(this.mainDetails||!_.live)&&this.setStartPosition(H.details,z),this.state===U.State.WAITING_TRACK&&!this.waitForCdnTuneIn(_)&&(this.state=U.State.IDLE),this.tick()},d._handleFragmentLoadProgress=function(s){var a,b=s.frag,g=s.part,_=s.payload,k=this.config,H=this.trackId,z=this.levels;if(!z){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 Z=z[H];console.assert(Z,"Audio track is defined on fragment load progress");var G=Z.details;console.assert(G,"Audio track details are defined on fragment load progress");var B=k.defaultAudioCodec||Z.audioCodec||"mp4a.40.2",te=this.transmuxer;te||(te=this.transmuxer=new P.default(this.hls,L.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ce=this.initPTS[b.cc],pe=(a=b.initSegment)===null||a===void 0?void 0:a.data;if(ce!==void 0){var ye=!1,Ce=g?g.index:-1,_e=Ce!==-1,le=new w.ChunkMetadata(b.level,b.sn,b.stats.chunkCount,_.byteLength,Ce,_e);te.push(_,pe,B,"",b,g,G.totalduration,ye,le,ce)}else{l.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 se=this.waitingData=this.waitingData||{frag:b,part:g,cache:new A.default,complete:!1},ge=se.cache;ge.push(new Uint8Array(_)),this.waitingVideoCC=this.videoTrackCC,this.state=U.State.WAITING_INIT_PTS}},d._handleFragmentLoadComplete=function(s){if(this.waitingData){this.waitingData.complete=!0;return}u.prototype._handleFragmentLoadComplete.call(this,s)},d.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},d.onBufferCreated=function(s,a){var b=a.tracks.audio;b&&(this.mediaBuffer=b.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},d.onFragBuffered=function(s,a){var b=a.frag,g=a.part;if(b.type!==L.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(b)){this.warn("Fragment "+b.sn+(g?" p: "+g.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,g)},d.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(L.PlaylistLevelType.AUDIO,a);break;case h.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case h.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==U.State.ERROR&&this.state!==U.State.STOPPED&&(this.state=a.fatal?U.State.ERROR:U.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===U.State.PARSING||this.state===U.State.PARSED)){var b=!0,g=this.getFwdBufferInfo(this.mediaBuffer,L.PlaylistLevelType.AUDIO);g&&g.len>.5&&(b=!this.reduceMaxBufferLength(g.len)),b&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,u.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},d.onBufferFlushed=function(s,a){var b=a.type;b===x.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},d._handleTransmuxComplete=function(s){var a,b="audio",g=this.hls,_=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 z=H.frag,Z=H.part,G=_.audio,B=_.text,te=_.id3,ce=_.initSegment;if(this.fragContextChanged(z))return;if(this.state=U.State.PARSING,this.audioSwitch&&G&&this.completeAudioSwitch(),ce!=null&&ce.tracks&&(this._bufferInitSegment(ce.tracks,z,k),g.trigger(I.Events.FRAG_PARSING_INIT_SEGMENT,{frag:z,id:b,tracks:ce.tracks})),G){var pe=G.startPTS,ye=G.endPTS,Ce=G.startDTS,_e=G.endDTS;Z&&(Z.elementaryStreams[x.ElementaryStreamTypes.AUDIO]={startPTS:pe,endPTS:ye,startDTS:Ce,endDTS:_e}),z.setElementaryStreamInfo(x.ElementaryStreamTypes.AUDIO,pe,ye,Ce,_e),this.bufferFragmentData(G,z,Z,k)}if(te!=null&&(a=te.samples)!==null&&a!==void 0&&a.length){var le=i({frag:z,id:b},te);g.trigger(I.Events.FRAG_PARSING_METADATA,le)}if(B){var se=i({frag:z,id:b},B);g.trigger(I.Events.FRAG_PARSING_USERDATA,se)}},d._bufferInitSegment=function(s,a,b){if(this.state!==U.State.PARSING)return;s.video&&delete s.video;var g=s.audio;if(!g)return;g.levelCodec=g.codec,g.id="audio",this.log("Init audio buffer, container:"+g.container+", codecs[parsed]=["+g.codec+"]"),this.hls.trigger(I.Events.BUFFER_CODECS,s);var _=g.initSegment;if(_!=null&&_.byteLength){var k={type:"audio",frag:a,part:null,chunkMeta:b,parent:a.type,data:_};this.hls.trigger(I.Events.BUFFER_APPENDING,k)}this.tick()},d.loadFragment=function(s,a,b){var g=this.fragmentTracker.getState(s);this.fragCurrent=s,(this.audioSwitch||g===N.FragmentState.NOT_LOADED||g===N.FragmentState.PARTIAL)&&(s.sn==="initSegment"?this._loadInitSegment(s):a.live&&!Object($.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=U.State.WAITING_INIT_PTS):(this.startFragRequested=!0,u.prototype.loadFragment.call(this,s,a,b)))},d.completeAudioSwitch=function(){var s=this.hls,a=this.media,b=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),u.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,s.trigger(I.Events.AUDIO_TRACK_SWITCHED,{id:b})},E}(U.default);Y.default=m},"./src/controller/audio-track-controller.ts":function(oe,Y,D){"use strict";D.r(Y);var $=D("./src/events.ts"),U=D("./src/errors.ts"),I=D("./src/controller/base-playlist-controller.ts"),K=D("./src/types/loader.ts");function N(P,w){for(var S=0;S=l.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var i=l[this.trackId];this.log("Now switching to audio-track index "+h);var c=l[h],C=c.id,v=c.groupId,m=v===void 0?"":v,u=c.name,E=c.type,d=c.url;if(this.trackId=h,this.trackName=u,this.selectDefaultTrack=!1,this.hls.trigger($.Events.AUDIO_TRACK_SWITCHING,{id:C,groupId:m,name:u,type:E,url:d}),c.details&&!c.details.live)return;var f=this.switchParams(c.url,i==null?void 0:i.details);this.loadPlaylist(f)},S.selectInitialTrack=function(){var h=this.tracksInGroup;console.assert(h.length,"Initial audio track should be selected when tracks are known");var l=this.trackName,i=this.findTrackId(l)||this.findTrackId();i!==-1?this.setAudioTrack(i):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger($.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},S.findTrackId=function(h){for(var l=this.tracksInGroup,i=0;iw.partTarget&&(c+=1)}if(Object($.isFiniteNumber)(i))return new U.HlsUrlParameters(i,Object($.isFiniteNumber)(c)?c:void 0,U.HlsSkip.No)}}},x.loadPlaylist=function(P){},x.shouldLoadTrack=function(P){return this.canLoad&&P&&!!P.url&&(!P.details||P.details.live)},x.playlistLoaded=function(P,w,S){var T=this,h=w.details,l=w.stats,i=l.loading.end?Math.max(0,self.performance.now()-l.loading.end):0;if(h.advancedDateTime=Date.now()-i,h.live||S!=null&&S.live){if(h.reloaded(S),S&&this.log("live playlist "+P+" "+(h.advanced?"REFRESHED "+h.lastPartSn+"-"+h.lastPartIndex:"MISSED")),S&&h.fragments.length>0&&Object(I.mergeDetails)(S,h),!this.canLoad||!h.live)return;var c,C=void 0,v=void 0;if(h.canBlockReload&&h.endSN&&h.advanced){var m=this.hls.config.lowLatencyMode,u=h.lastPartSn,E=h.endSN,d=h.lastPartIndex,f=d!==-1,s=u===E,a=m?0:d;f?(C=s?E+1:u,v=s?a:d+1):C=E+1;var b=h.age,g=b+h.ageHeader,_=Math.min(g-h.partTarget,h.targetduration*1.5);if(_>0){if(S&&_>S.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+S.tuneInGoal+" to: "+_+" with playlist age: "+h.age),_=0;else{var k=Math.floor(_/h.targetduration);if(C+=k,v!==void 0){var H=Math.round(_%h.targetduration/h.partTarget);v+=H}this.log("CDN Tune-in age: "+h.ageHeader+"s last advanced "+b.toFixed(2)+"s goal: "+_+" skip sn "+k+" to part "+v)}h.tuneInGoal=_}if(c=this.getDeliveryDirectives(h,w.deliveryDirectives,C,v),m||!s){this.loadPlaylist(c);return}}else c=this.getDeliveryDirectives(h,w.deliveryDirectives,C,v);var z=Object(I.computeReloadInterval)(h,l);C!==void 0&&h.canBlockReload&&(z-=h.partTarget||1),this.log("reload live playlist "+P+" in "+Math.round(z)+" ms"),this.timer=self.setTimeout(function(){return T.loadPlaylist(c)},z)}else this.clearTimer()},x.getDeliveryDirectives=function(P,w,S,T){var h=Object(U.getSkipValue)(P,S);return w!=null&&w.skip&&P.deltaUpdateFailed&&(S=w.msn,T=w.part,h=U.HlsSkip.No),new U.HlsUrlParameters(S,T,h)},x.retryLoadingOrFail=function(P){var w=this,S=this.hls.config,T=this.retryCount-1&&(h=P.context)!==null&&h!==void 0&&h.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+P.details+'"'),this.loadPlaylist();else{var l=Math.min(Math.pow(2,this.retryCount)*S.levelLoadingRetryDelay,S.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return w.loadPlaylist()},l),this.warn("retry playlist loading #"+this.retryCount+" in "+l+' ms after "'+P.details+'"')}}else this.warn('cannot recover from error "'+P.details+'"'),this.clearTimer(),P.fatal=!0;return T},L}()},"./src/controller/base-stream-controller.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"State",function(){return E}),D.d(Y,"default",function(){return d});var $=D("./src/polyfills/number.ts"),U=D("./src/task-loop.ts"),I=D("./src/controller/fragment-tracker.ts"),K=D("./src/utils/buffer-helper.ts"),N=D("./src/utils/logger.ts"),O=D("./src/events.ts"),L=D("./src/errors.ts"),x=D("./src/types/transmuxer.ts"),A=D("./src/utils/mp4-tools.ts"),P=D("./src/utils/discontinuities.ts"),w=D("./src/controller/fragment-finders.ts"),S=D("./src/controller/level-helper.ts"),T=D("./src/loader/fragment-loader.ts"),h=D("./src/crypt/decrypter.ts"),l=D("./src/utils/time-ranges.ts"),i=D("./src/types/loader.ts");function c(f,s){for(var a=0;ace;(Z0&&Z&&Z.key&&Z.iv&&Z.method==="AES-128"){var G=self.performance.now();return _.decrypter.webCryptoDecrypt(new Uint8Array(z),Z.key.buffer,Z.iv.buffer).then(function(B){var te=self.performance.now();return H.trigger(O.Events.FRAG_DECRYPTED,{frag:g,payload:B,stats:{tstart:G,tdecrypt:te}}),k.payload=B,k})}return k}).then(function(k){var H=_.fragCurrent,z=_.hls,Z=_.levels;if(!Z)throw new Error("init load aborted, missing levels");var G=Z[g.level].details;console.assert(G,"Level details are defined when init segment is loaded");var B=g.stats;_.state=E.IDLE,_.fragLoadError=0,g.data=new Uint8Array(k.payload),B.parsing.start=B.buffering.start=self.performance.now(),B.parsing.end=B.buffering.end=self.performance.now(),k.frag===H&&z.trigger(O.Events.FRAG_BUFFERED,{stats:B,frag:H,part:null,id:g.type}),_.tick()}).catch(function(k){_.warn(k),_.resetFragmentLoading(g)})},a.fragContextChanged=function(g){var _=this.fragCurrent;return!g||!_||g.level!==_.level||g.sn!==_.sn||g.urlId!==_.urlId},a.fragBufferedComplete=function(g,_){var k=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+g.type+" sn: "+g.sn+(_?" part: "+_.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+g.level+" "+l.default.toString(K.BufferHelper.getBuffered(k))),this.state=E.IDLE,this.tick()},a._handleFragmentLoadComplete=function(g){var _=this.transmuxer;if(!_)return;var k=g.frag,H=g.part,z=g.partsLoaded,Z=!z||z.length===0||z.some(function(B){return!B}),G=new x.ChunkMetadata(k.level,k.sn,k.stats.chunkCount+1,0,H?H.index:-1,!Z);_.flush(G)},a._handleFragmentLoadProgress=function(g){},a._doFragLoad=function(g,_,k,H){var z=this;if(k===void 0&&(k=null),!this.levels)throw new Error("frag load aborted, missing levels");if(k=Math.max(g.start,k||0),this.config.lowLatencyMode&&_){var Z=_.partList;if(Z&&H){k>g.end&&_.fragmentHint&&(g=_.fragmentHint);var G=this.getNextPart(Z,g,k);if(G>-1){var B=Z[G];return this.log("Loading part sn: "+g.sn+" p: "+B.index+" cc: "+g.cc+" of playlist ["+_.startSN+"-"+_.endSN+"] parts [0-"+G+"-"+(Z.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(k.toFixed(3))),this.nextLoadPosition=B.start+B.duration,this.state=E.FRAG_LOADING,this.hls.trigger(O.Events.FRAG_LOADING,{frag:g,part:Z[G],targetBufferTime:k}),this.doFragPartsLoad(g,Z,G,H).catch(function(te){return z.handleFragLoadError(te)})}else if(!g.url||this.loadedEndOfParts(Z,k))return Promise.resolve(null)}}return this.log("Loading fragment "+g.sn+" cc: "+g.cc+" "+(_?"of ["+_.startSN+"-"+_.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(k.toFixed(3))),Object($.isFiniteNumber)(g.sn)&&!this.bitrateTest&&(this.nextLoadPosition=g.start+g.duration),this.state=E.FRAG_LOADING,this.hls.trigger(O.Events.FRAG_LOADING,{frag:g,targetBufferTime:k}),this.fragmentLoader.load(g,H).catch(function(te){return z.handleFragLoadError(te)})},a.doFragPartsLoad=function(g,_,k,H){var z=this;return new Promise(function(Z,G){var B=[],te=function ce(pe){var ye=_[pe];z.fragmentLoader.loadPart(g,ye,H).then(function(Ce){B[ye.index]=Ce;var _e=Ce.part;z.hls.trigger(O.Events.FRAG_LOADED,Ce);var le=_[pe+1];if(le&&le.fragment===g)ce(pe+1);else return Z({frag:g,part:_e,partsLoaded:B})}).catch(G)};te(k)})},a.handleFragLoadError=function(g){var _=g.data;return _&&_.details===L.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(_.frag,_.part):this.hls.trigger(O.Events.ERROR,_),null},a._handleTransmuxerFlush=function(g){var _=this.getCurrentContext(g);if(!_||this.state!==E.PARSING){this.fragCurrent||(this.state=E.IDLE);return}var k=_.frag,H=_.part,z=_.level,Z=self.performance.now();k.stats.parsing.end=Z,H&&(H.stats.parsing.end=Z),this.updateLevelTiming(k,H,z,g.partial)},a.getCurrentContext=function(g){var _=this.levels,k=g.level,H=g.sn,z=g.part;if(!_||!_[k])return this.warn("Levels object was unset while buffering fragment "+H+" of level "+k+". The current chunk will not be buffered."),null;var Z=_[k],G=z>-1?Object(S.getPartWith)(Z,H,z):null,B=G?G.fragment:Object(S.getFragmentWithSN)(Z,H,this.fragCurrent);return B?{frag:B,part:G,level:Z}:null},a.bufferFragmentData=function(g,_,k,H){if(!g||this.state!==E.PARSING)return;var z=g.data1,Z=g.data2,G=z;if(z&&Z&&(G=Object(A.appendUint8Array)(z,Z)),!G||!G.length)return;var B={type:g.type,frag:_,part:k,chunkMeta:H,parent:_.type,data:G};this.hls.trigger(O.Events.BUFFER_APPENDING,B),g.dropped&&g.independent&&!k&&this.flushBufferGap(_)},a.flushBufferGap=function(g){var _=this.media;if(!_)return;if(!K.BufferHelper.isBuffered(_,_.currentTime)){this.flushMainBuffer(0,g.start);return}var k=_.currentTime,H=K.BufferHelper.bufferInfo(_,k,0),z=g.duration,Z=Math.min(this.config.maxFragLookUpTolerance*2,z*.25),G=Math.max(Math.min(g.start-Z,H.end-Z),k+Z);g.start-G>Z&&this.flushMainBuffer(G,g.start)},a.getFwdBufferInfo=function(g,_){var k=this.config,H=this.getLoadPosition();if(!Object($.isFiniteNumber)(H))return null;var z=K.BufferHelper.bufferInfo(g,H,k.maxBufferHole);if(z.len===0&&z.nextStart!==void 0){var Z=this.fragmentTracker.getBufferedFrag(H,_);if(Z&&z.nextStart=k?(_.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+_.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(g,_){var k,H,z=_.fragments,Z=z.length;if(!Z)return null;var G=this.config,B=z[0].start,te;if(_.live){var ce=G.initialLiveManifestSize;if(Z-1&&kk.start&&k.loaded},a.getInitialLiveFragment=function(g,_){var k=this.fragPrevious,H=null;if(k){if(g.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+k.programDateTime),H=Object(w.findFragmentByPDT)(_,k.endProgramDateTime,this.config.maxFragLookUpTolerance)),!H){var z=k.sn+1;if(z>=g.startSN&&z<=g.endSN){var Z=_[z-g.startSN];k.cc===Z.cc&&(H=Z,this.log("Live playlist, switching playlist, load frag with next SN: "+H.sn))}H||(H=Object(w.findFragWithCC)(_,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?g.fragmentEnd:g.edge,g))}return H},a.getFragmentAtPosition=function(g,_,k){var H=this.config,z=this.fragPrevious,Z=k.fragments,G=k.endSN,B=k.fragmentHint,te=H.maxFragLookUpTolerance,ce=!!(H.lowLatencyMode&&k.partList&&B);ce&&B&&!this.bitrateTest&&(Z=Z.concat(B),G=B.sn);var pe;if(g<_){var ye=g>_-te?0:te;pe=Object(w.findFragmentByPTS)(z,Z,g,ye)}else pe=Z[Z.length-1];if(pe){var Ce=pe.sn-k.startSN,_e=z&&pe.level===z.level,le=Z[Ce+1],se=this.fragmentTracker.getState(pe);if(se===I.FragmentState.BACKTRACKED){pe=null;for(var ge=Ce;Z[ge]&&this.fragmentTracker.getState(Z[ge])===I.FragmentState.BACKTRACKED;)z?pe=Z[ge--]:pe=Z[--ge];pe||(pe=le)}else z&&pe.sn===z.sn&&!ce&&(_e&&(pe.sn=Z-_.maxFragLookUpTolerance&&z<=G;if(H!==null&&k.duration>H&&(z"+g.startSN+" prev-sn: "+(z?z.sn:"na")+" fragments: "+G),pe}return B},a.waitForCdnTuneIn=function(g){var _=3;return g.live&&g.canBlockReload&&g.tuneInGoal>Math.max(g.partHoldBack,g.partTarget*_)},a.setStartPosition=function(g,_){var k=this.startPosition;if(k<_&&(k=-1),k===-1||this.lastCurrentTime===-1){var H=g.startTimeOffset;Object($.isFiniteNumber)(H)?(k=_+H,H<0&&(k+=g.totalduration),k=Math.min(Math.max(_,k),_+g.totalduration),this.log("Start time offset "+H+" found in playlist, adjust startPosition to "+k),this.startPosition=k):g.live?k=this.hls.liveSyncPosition||_:this.startPosition=k=0,this.lastCurrentTime=k}this.nextLoadPosition=k},a.getLoadPosition=function(){var g=this.media,_=0;return this.loadedmetadata&&g?_=g.currentTime:this.nextLoadPosition&&(_=this.nextLoadPosition),_},a.handleFragLoadAborted=function(g,_){this.transmuxer&&g.sn!=="initSegment"&&g.stats.aborted&&(this.warn("Fragment "+g.sn+(_?" part"+_.index:"")+" of level "+g.level+" was aborted"),this.resetFragmentLoading(g))},a.resetFragmentLoading=function(g){(!this.fragCurrent||!this.fragContextChanged(g))&&(this.state=E.IDLE)},a.onFragmentOrKeyLoadError=function(g,_){if(_.fatal)return;var k=_.frag;if(!k||k.type!==g)return;var H=this.fragCurrent;console.assert(H&&k.sn===H.sn&&k.level===H.level&&k.urlId===H.urlId,"Frag load error must match current frag to retry");var z=this.config;if(this.fragLoadError+1<=z.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(k.level))return;var Z=Math.min(Math.pow(2,this.fragLoadError)*z.fragLoadingRetryDelay,z.fragLoadingMaxRetryTimeout);this.warn("Fragment "+k.sn+" of "+g+" "+k.level+" failed to load, retrying in "+Z+"ms"),this.retryDate=self.performance.now()+Z,this.fragLoadError++,this.state=E.FRAG_LOADING_WAITING_RETRY}else _.levelRetry?(g===i.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=E.IDLE):(N.logger.error(_.details+" reaches max retry, redispatch as fatal ..."),_.fatal=!0,this.hls.stopLoad(),this.state=E.ERROR)},a.afterBufferFlushed=function(g,_,k){if(!g)return;var H=K.BufferHelper.getBuffered(g);this.fragmentTracker.detectEvictedFragments(_,H,k),this.state===E.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=E.IDLE},a.resetLiveStartWhenNotLoaded=function(g){if(!this.loadedmetadata){this.startFragRequested=!1;var _=this.levels?this.levels[g].details:null;if(_!=null&&_.live)return this.startPosition=-1,this.setStartPosition(_,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(g,_,k,H){var z=this,Z=k.details;console.assert(!!Z,"level.details must be defined");var G=Object.keys(g.elementaryStreams).reduce(function(B,te){var ce=g.elementaryStreams[te];if(ce){var pe=ce.endPTS-ce.startPTS;if(pe<=0)return z.warn("Could not parse fragment "+g.sn+" "+te+" duration reliably ("+pe+") resetting transmuxer to fallback to playlist timing"),z.resetTransmuxer(),B||!1;var ye=H?0:Object(S.updateFragPTSDTS)(Z,g,ce.startPTS,ce.endPTS,ce.startDTS,ce.endDTS);return z.hls.trigger(O.Events.LEVEL_PTS_UPDATED,{details:Z,level:k,drift:ye,type:te,frag:g,start:ce.startPTS,end:ce.endPTS}),!0}return B},!1);G?(this.state=E.PARSED,this.hls.trigger(O.Events.FRAG_PARSED,{frag:g,part:_})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},C(s,[{key:"state",get:function(){return this._state},set:function(g){var _=this._state;_!==g&&(this._state=g,this.log(_+"->"+g))}}]),s}(U.default)},"./src/controller/buffer-controller.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return w});var $=D("./src/polyfills/number.ts"),U=D("./src/events.ts"),I=D("./src/utils/logger.ts"),K=D("./src/errors.ts"),N=D("./src/utils/buffer-helper.ts"),O=D("./src/utils/mediasource-helper.ts"),L=D("./src/loader/fragment.ts"),x=D("./src/controller/buffer-operation-queue.ts"),A=Object(O.getMediaSource)(),P=/([ha]vc.)(?:\.[^.,]+)+/,w=function(){function S(h){var l=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 i=l.hls,c=l.media,C=l.mediaSource;I.logger.log("[buffer-controller]: Media source opened"),c&&(l.updateMediaElementDuration(),i.trigger(U.Events.MEDIA_ATTACHED,{media:c})),C&&C.removeEventListener("sourceopen",l._onMediaSourceOpen),l.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 T=S.prototype;return T.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},T.destroy=function(){this.unregisterListeners(),this.details=null},T.registerListeners=function(){var l=this.hls;l.on(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.on(U.Events.BUFFER_RESET,this.onBufferReset,this),l.on(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),l.on(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),l.on(U.Events.BUFFER_EOS,this.onBufferEos,this),l.on(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),l.on(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),l.on(U.Events.FRAG_PARSED,this.onFragParsed,this),l.on(U.Events.FRAG_CHANGED,this.onFragChanged,this)},T.unregisterListeners=function(){var l=this.hls;l.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.off(U.Events.BUFFER_RESET,this.onBufferReset,this),l.off(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),l.off(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),l.off(U.Events.BUFFER_EOS,this.onBufferEos,this),l.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),l.off(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),l.off(U.Events.FRAG_PARSED,this.onFragParsed,this),l.off(U.Events.FRAG_CHANGED,this.onFragChanged,this)},T._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new x.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},T.onManifestParsed=function(l,i){var c=2;(i.audio&&!i.video||!i.altAudio)&&(c=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=c,this.details=null,I.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},T.onMediaAttaching=function(l,i){var c=this.media=i.media;if(c&&A){var C=this.mediaSource=new A;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}},T.onMediaDetaching=function(){var l=this.media,i=this.mediaSource,c=this._objectUrl;if(i){if(I.logger.log("[buffer-controller]: media source detaching"),i.readyState==="open")try{i.endOfStream()}catch(C){I.logger.warn("[buffer-controller]: onMediaDetaching: "+C.message+" while calling endOfStream")}this.onBufferReset(),i.removeEventListener("sourceopen",this._onMediaSourceOpen),i.removeEventListener("sourceended",this._onMediaSourceEnded),i.removeEventListener("sourceclose",this._onMediaSourceClose),l&&(c&&self.URL.revokeObjectURL(c),l.src===c?(l.removeAttribute("src"),l.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(U.Events.MEDIA_DETACHED,void 0)},T.onBufferReset=function(){var l=this;this.getSourceBufferTypes().forEach(function(i){var c=l.sourceBuffer[i];try{c&&(l.removeBufferListeners(i),l.mediaSource&&l.mediaSource.removeSourceBuffer(c),l.sourceBuffer[i]=void 0)}catch(C){I.logger.warn("[buffer-controller]: Failed to reset the "+i+" buffer",C)}}),this._initSourceBuffer()},T.onBufferCodecs=function(l,i){var c=this,C=this.getSourceBufferTypes().length;if(Object.keys(i).forEach(function(v){if(C){var m=c.tracks[v];if(m&&typeof m.buffer.changeType=="function"){var u=i[v],E=u.codec,d=u.levelCodec,f=u.container,s=(m.levelCodec||m.codec).replace(P,"$1"),a=(d||E).replace(P,"$1");if(s!==a){var b=f+";codecs="+(d||E);c.appendChangeType(v,b)}}}else c.pendingTracks[v]=i[v]}),C)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},T.appendChangeType=function(l,i){var c=this,C=this.operationQueue,v={execute:function(){var u=c.sourceBuffer[l];u&&(I.logger.log("[buffer-controller]: changing "+l+" sourceBuffer type to "+i),u.changeType(i)),C.shiftAndExecuteNext(l)},onStart:function(){},onComplete:function(){},onError:function(u){I.logger.warn("[buffer-controller]: Failed to change "+l+" SourceBuffer type",u)}};C.append(v,l)},T.onBufferAppending=function(l,i){var c=this,C=this.hls,v=this.operationQueue,m=this.tracks,u=i.data,E=i.type,d=i.frag,f=i.part,s=i.chunkMeta,a=s.buffering[E],b=self.performance.now();a.start=b;var g=d.stats.buffering,_=f?f.stats.buffering:null;g.start===0&&(g.start=b),_&&_.start===0&&(_.start=b);var k=m.audio,H=E==="audio"&&s.id===1&&(k==null?void 0:k.container)==="audio/mpeg",z={execute:function(){if(a.executeStart=self.performance.now(),H){var G=c.sourceBuffer[E];if(G){var B=d.start-G.timestampOffset;Math.abs(B)>=.1&&(I.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+d.start+" (delta: "+B+") sn: "+d.sn+")"),G.timestampOffset=d.start)}}c.appendExecutor(u,E)},onStart:function(){},onComplete:function(){var G=self.performance.now();a.executeEnd=a.end=G,g.first===0&&(g.first=G),_&&_.first===0&&(_.first=G);var B=c.sourceBuffer,te={};for(var ce in B)te[ce]=N.BufferHelper.getBuffered(B[ce]);c.appendError=0,c.hls.trigger(U.Events.BUFFER_APPENDED,{type:E,frag:d,part:f,chunkMeta:s,parent:d.type,timeRanges:te})},onError:function(G){I.logger.error("[buffer-controller]: Error encountered while trying to append to the "+E+" SourceBuffer",G);var B={type:K.ErrorTypes.MEDIA_ERROR,parent:d.type,details:K.ErrorDetails.BUFFER_APPEND_ERROR,err:G,fatal:!1};G.code===DOMException.QUOTA_EXCEEDED_ERR?B.details=K.ErrorDetails.BUFFER_FULL_ERROR:(c.appendError++,B.details=K.ErrorDetails.BUFFER_APPEND_ERROR,c.appendError>C.config.appendErrorMaxRetry&&(I.logger.error("[buffer-controller]: Failed "+C.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),B.fatal=!0)),C.trigger(U.Events.ERROR,B)}};v.append(z,E)},T.onBufferFlushing=function(l,i){var c=this,C=this.operationQueue,v=function(u){return{execute:c.removeExecutor.bind(c,u,i.startOffset,i.endOffset),onStart:function(){},onComplete:function(){c.hls.trigger(U.Events.BUFFER_FLUSHED,{type:u})},onError:function(d){I.logger.warn("[buffer-controller]: Failed to remove from "+u+" SourceBuffer",d)}}};i.type?C.append(v(i.type),i.type):this.getSourceBufferTypes().forEach(function(m){C.append(v(m),m)})},T.onFragParsed=function(l,i){var c=this,C=i.frag,v=i.part,m=[],u=v?v.elementaryStreams:C.elementaryStreams;u[L.ElementaryStreamTypes.AUDIOVIDEO]?m.push("audiovideo"):(u[L.ElementaryStreamTypes.AUDIO]&&m.push("audio"),u[L.ElementaryStreamTypes.VIDEO]&&m.push("video"));var E=function(){var f=self.performance.now();C.stats.buffering.end=f,v&&(v.stats.buffering.end=f);var s=v?v.stats:C.stats;c.hls.trigger(U.Events.FRAG_BUFFERED,{frag:C,part:v,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(E,m)},T.onFragChanged=function(l,i){this.flushBackBuffer()},T.onBufferEos=function(l,i){var c=this,C=this.getSourceBufferTypes().reduce(function(v,m){var u=c.sourceBuffer[m];return(!i.type||i.type===m)&&(u&&!u.ended&&(u.ended=!0,I.logger.log("[buffer-controller]: "+m+" sourceBuffer now EOS"))),v&&!!(!u||u.ended)},!0);C&&this.blockBuffers(function(){var v=c.mediaSource;if(!v||v.readyState!=="open")return;v.endOfStream()})},T.onLevelUpdated=function(l,i){var c=i.details;if(!c.fragments.length)return;this.details=c,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},T.flushBackBuffer=function(){var l=this.hls,i=this.details,c=this.media,C=this.sourceBuffer;if(!c||i===null)return;var v=this.getSourceBufferTypes();if(!v.length)return;var m=i.live&&l.config.liveBackBufferLength!==null?l.config.liveBackBufferLength:l.config.backBufferLength;if(!Object($.isFiniteNumber)(m)||m<0)return;var u=c.currentTime,E=i.levelTargetDuration,d=Math.max(m,E),f=Math.floor(u/E)*E-d;v.forEach(function(s){var a=C[s];if(a){var b=N.BufferHelper.getBuffered(a);b.length>0&&f>b.start(0)&&(l.trigger(U.Events.BACK_BUFFER_REACHED,{bufferEnd:f}),i.live&&l.trigger(U.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:f}),l.trigger(U.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:f,type:s}))}})},T.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var l=this.details,i=this.hls,c=this.media,C=this.mediaSource,v=l.fragments[0].start+l.totalduration,m=c.duration,u=Object($.isFiniteNumber)(C.duration)?C.duration:0;l.live&&i.config.liveDurationInfinity?(I.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),C.duration=Infinity,this.updateSeekableRange(l)):(v>u&&v>m||!Object($.isFiniteNumber)(m))&&(I.logger.log("[buffer-controller]: Updating Media Source duration to "+v.toFixed(3)),C.duration=v)},T.updateSeekableRange=function(l){var i=this.mediaSource,c=l.fragments,C=c.length;if(C&&l.live&&i!==null&&i!==void 0&&i.setLiveSeekableRange){var v=Math.max(0,c[0].start),m=Math.max(v,v+l.totalduration);i.setLiveSeekableRange(v,m)}},T.checkPendingTracks=function(){var l=this.bufferCodecEventsExpected,i=this.operationQueue,c=this.pendingTracks,C=Object.keys(c).length;if(C&&!l||C===2){this.createSourceBuffers(c),this.pendingTracks={};var v=this.getSourceBufferTypes();if(v.length===0){this.hls.trigger(U.Events.ERROR,{type:K.ErrorTypes.MEDIA_ERROR,details:K.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}v.forEach(function(m){i.executeNext(m)})}},T.createSourceBuffers=function(l){var i=this.sourceBuffer,c=this.mediaSource;if(!c)throw Error("createSourceBuffers called when mediaSource was null");var C=0;for(var v in l)if(!i[v]){var m=l[v];if(!m)throw Error("source buffer exists for track "+v+", however track does not");var u=m.levelCodec||m.codec,E=m.container+";codecs="+u;I.logger.log("[buffer-controller]: creating sourceBuffer("+E+")");try{var d=i[v]=c.addSourceBuffer(E),f=v;this.addBufferListener(f,"updatestart",this._onSBUpdateStart),this.addBufferListener(f,"updateend",this._onSBUpdateEnd),this.addBufferListener(f,"error",this._onSBUpdateError),this.tracks[v]={buffer:d,codec:u,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(U.Events.ERROR,{type:K.ErrorTypes.MEDIA_ERROR,details:K.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:s,mimeType:E})}}C&&this.hls.trigger(U.Events.BUFFER_CREATED,{tracks:this.tracks})},T._onSBUpdateStart=function(l){var i=this.operationQueue,c=i.current(l);c.onStart()},T._onSBUpdateEnd=function(l){var i=this.operationQueue,c=i.current(l);c.onComplete(),i.shiftAndExecuteNext(l)},T._onSBUpdateError=function(l,i){I.logger.error("[buffer-controller]: "+l+" SourceBuffer error",i),this.hls.trigger(U.Events.ERROR,{type:K.ErrorTypes.MEDIA_ERROR,details:K.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var c=this.operationQueue.current(l);c&&c.onError(i)},T.removeExecutor=function(l,i,c){var C=this.media,v=this.mediaSource,m=this.operationQueue,u=this.sourceBuffer,E=u[l];if(!C||!v||!E){I.logger.warn("[buffer-controller]: Attempting to remove from the "+l+" SourceBuffer, but it does not exist"),m.shiftAndExecuteNext(l);return}var d=Object($.isFiniteNumber)(C.duration)?C.duration:Infinity,f=Object($.isFiniteNumber)(v.duration)?v.duration:Infinity,s=Math.max(0,i),a=Math.min(c,d,f);a>s?(I.logger.log("[buffer-controller]: Removing ["+s+","+a+"] from the "+l+" SourceBuffer"),console.assert(!E.updating,l+" sourceBuffer must not be updating"),E.remove(s,a)):m.shiftAndExecuteNext(l)},T.appendExecutor=function(l,i){var c=this.operationQueue,C=this.sourceBuffer,v=C[i];if(!v){I.logger.warn("[buffer-controller]: Attempting to append to the "+i+" SourceBuffer, but it does not exist"),c.shiftAndExecuteNext(i);return}v.ended=!1,console.assert(!v.updating,i+" sourceBuffer must not be updating"),v.appendBuffer(l)},T.blockBuffers=function(l,i){var c=this;if(i===void 0&&(i=this.getSourceBufferTypes()),!i.length){I.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(l);return}var C=this.operationQueue,v=i.map(function(m){return C.appendBlocker(m)});Promise.all(v).then(function(){l(),i.forEach(function(m){var u=c.sourceBuffer[m];(!u||!u.updating)&&C.shiftAndExecuteNext(m)})})},T.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},T.addBufferListener=function(l,i,c){var C=this.sourceBuffer[l];if(!C)return;var v=c.bind(this,l);this.listeners[l].push({event:i,listener:v}),C.addEventListener(i,v)},T.removeBufferListeners=function(l){var i=this.sourceBuffer[l];if(!i)return;this.listeners[l].forEach(function(c){i.removeEventListener(c.event,c.listener)})},S}()},"./src/controller/buffer-operation-queue.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return U});var $=D("./src/utils/logger.ts"),U=function(){function I(N){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=N}var K=I.prototype;return K.append=function(O,L){var x=this.queues[L];x.push(O),x.length===1&&this.buffers[L]&&this.executeNext(L)},K.insertAbort=function(O,L){var x=this.queues[L];x.unshift(O),this.executeNext(L)},K.appendBlocker=function(O){var L,x=new Promise(function(P){L=P}),A={execute:L,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(A,O),x},K.executeNext=function(O){var L=this.buffers,x=this.queues,A=L[O],P=x[O];if(P.length){var w=P[0];try{w.execute()}catch(S){$.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),w.onError(S),(!A||!A.updating)&&(P.shift(),this.executeNext(O))}}},K.shiftAndExecuteNext=function(O){this.queues[O].shift(),this.executeNext(O)},K.current=function(O){return this.queues[O][0]},I}()},"./src/controller/cap-level-controller.ts":function(oe,Y,D){"use strict";D.r(Y);var $=D("./src/events.ts");function U(N,O){for(var L=0;L0&&this.mediaWidth>0){var x=this.hls.levels;if(x.length){var A=this.hls;A.autoLevelCapping=this.getMaxLevel(x.length-1),A.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=A.autoLevelCapping}}},O.getMaxLevel=function(x){var A=this,P=this.hls.levels;if(!P.length)return-1;var w=P.filter(function(S,T){return N.isLevelAllowed(T,A.restrictedLevels)&&T<=x});return this.clientRect=null,N.getMaxLevelByMediaSize(w,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 x=this.media,A={width:0,height:0};if(x){var P=x.getBoundingClientRect();A.width=P.width,A.height=P.height,!A.width&&!A.height&&(A.width=P.right-P.left||x.width||0,A.height=P.bottom-P.top||x.height||0)}return this.clientRect=A,A},N.isLevelAllowed=function(x,A){return A===void 0&&(A=[]),A.indexOf(x)===-1},N.getMaxLevelByMediaSize=function(x,A,P){if(!x||!x.length)return-1;for(var w=function(i,c){return c?i.width!==c.width||i.height!==c.height:!0},S=x.length-1,T=0;T=A||h.height>=P)&&w(h,x[T+1])){S=T;break}}return S},I(N,[{key:"mediaWidth",get:function(){return this.getDimensions().width*N.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*N.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var x=1;try{x=self.devicePixelRatio}catch(A){}return x}}]),N}();Y.default=K},"./src/controller/cmcd-controller.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return w});var $=D("./src/events.ts"),U=D("./src/types/cmcd.ts"),I=D("./src/utils/buffer-helper.ts"),K=D("./src/utils/logger.ts");function N(S,T){for(var h=0;h=S.length?{done:!0}:{done:!1,value:S[l++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function x(S,T){if(!S)return;if(typeof S=="string")return A(S,T);var h=Object.prototype.toString.call(S).slice(8,-1);if(h==="Object"&&S.constructor&&(h=S.constructor.name),h==="Map"||h==="Set")return Array.from(S);if(h==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h))return A(S,T)}function A(S,T){(T==null||T>S.length)&&(T=S.length);for(var h=0,l=new Array(T);hi&&(i=m.bitrate)}return i>0?i:NaN},T.getBufferLength=function(l){var i=this.hls.media,c=l===U.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!c||!i)return NaN;var C=I.BufferHelper.bufferInfo(c,i.currentTime,this.config.maxBufferHole);return C.len*1e3},T.createPlaylistLoader=function(){var l=this.config.pLoader,i=this.applyPlaylistData,c=l||this.config.loader;return function(){function C(m){this.loader=void 0,this.loader=new c(m)}var v=C.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(u,E,d){i(u),this.loader.load(u,E,d)},O(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},T.createFragmentLoader=function(){var l=this.config.fLoader,i=this.applyFragmentData,c=l||this.config.loader;return function(){function C(m){this.loader=void 0,this.loader=new c(m)}var v=C.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(u,E,d){i(u),this.loader.load(u,E,d)},O(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},S.uuid=function(){var l=URL.createObjectURL(new Blob),i=l.toString();return URL.revokeObjectURL(l),i.substr(i.lastIndexOf("/")+1)},S.serialize=function(l){for(var i=[],c=function(H){return!Number.isNaN(H)&&H!=null&&H!==""&&H!==!1},C=function(H){return Math.round(H)},v=function(H){return C(H/100)*100},m=function(H){return encodeURIComponent(H)},u={br:C,d:C,bl:v,dl:v,mtp:v,nor:m,rtp:v,tb:C},E=Object.keys(l||{}).sort(),d=L(E),f;!(f=d()).done;){var s=f.value,a=l[s];if(!c(a))continue;if(s==="v"&&a===1)continue;if(s=="pr"&&a===1)continue;var b=u[s];b&&(a=b(a));var g=typeof a,_=void 0;s==="ot"||s==="sf"||s==="st"?_=s+"="+a:g==="boolean"?_=s:g==="number"?_=s+"="+a:_=s+"="+JSON.stringify(a),i.push(_)}return i.join(",")},S.toHeaders=function(l){for(var i=Object.keys(l),c={},C=["Object","Request","Session","Status"],v=[{},{},{},{}],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},u=0,E=i;uL){this.hls.trigger($.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var m=L-this._requestLicenseFailureCount+1;I.logger.warn("Retrying license request, "+m+" attempts left"),this._requestLicense(i,c)}break}},S._generateLicenseRequestChallenge=function(h,l){switch(h.mediaKeySystemDomain){case K.KeySystems.WIDEVINE:return l}throw new Error("unsupported key-system: "+h.mediaKeySystemDomain)},S._requestLicense=function(h,l){I.logger.log("Requesting content license for key-system");var i=this._mediaKeysList[0];if(!i){I.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger($.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var c=this.getLicenseServerUrl(i.mediaKeySystemDomain),C=this._createLicenseXhr(c,h,l);I.logger.log("Sending license request to URL: "+c);var v=this._generateLicenseRequestChallenge(i,h);C.send(v)}catch(m){I.logger.error("Failure requesting DRM license: "+m),this.hls.trigger($.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},S.onMediaAttached=function(h,l){if(!this._emeEnabled)return;var i=l.media;this._media=i,i.addEventListener("encrypted",this._onMediaEncrypted)},S.onMediaDetached=function(){var h=this._media,l=this._mediaKeysList;if(!h)return;h.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(l.map(function(i){if(i.mediaKeysSession)return i.mediaKeysSession.close().catch(function(){})})).then(function(){return h.setMediaKeys(null)}).catch(function(){})},S.onManifestParsed=function(h,l){if(!this._emeEnabled)return;var i=l.levels.map(function(C){return C.audioCodec}).filter(function(C){return!!C}),c=l.levels.map(function(C){return C.videoCodec}).filter(function(C){return!!C});this._attemptKeySystemAccess(K.KeySystems.WIDEVINE,i,c)},O(w,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),w}();Y.default=P},"./src/controller/fps-controller.ts":function(oe,Y,D){"use strict";D.r(Y);var $=D("./src/events.ts"),U=D("./src/utils/logger.ts"),I=function(){function K(O){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=O,this.registerListeners()}var N=K.prototype;return N.setStreamController=function(L){this.streamController=L},N.registerListeners=function(){this.hls.on($.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},N.unregisterListeners=function(){this.hls.off($.Events.MEDIA_ATTACHING,this.onMediaAttaching)},N.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},N.onMediaAttaching=function(L,x){var A=this.hls.config;if(A.capLevelOnFPSDrop){var P=x.media instanceof self.HTMLVideoElement?x.media:null;this.media=P,P&&typeof P.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),A.fpsDroppedMonitoringPeriod)}},N.checkFPS=function(L,x,A){var P=performance.now();if(x){if(this.lastTime){var w=P-this.lastTime,S=A-this.lastDroppedFrames,T=x-this.lastDecodedFrames,h=1e3*S/w,l=this.hls;if(l.trigger($.Events.FPS_DROP,{currentDropped:S,currentDecoded:T,totalDroppedFrames:A}),h>0&&S>l.config.fpsDroppedMonitoringThreshold*T){var i=l.currentLevel;U.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+i),i>0&&(l.autoLevelCapping===-1||l.autoLevelCapping>=i)&&(i=i-1,l.trigger($.Events.FPS_DROP_LEVEL_CAPPING,{level:i,droppedLevel:l.currentLevel}),l.autoLevelCapping=i,this.streamController.nextLevelSwitch())}}this.lastTime=P,this.lastDroppedFrames=A,this.lastDecodedFrames=x}},N.checkFPSInterval=function(){var L=this.media;if(L)if(this.isVideoPlaybackQualityAvailable){var x=L.getVideoPlaybackQuality();this.checkFPS(L,x.totalVideoFrames,x.droppedVideoFrames)}else this.checkFPS(L,L.webkitDecodedFrameCount,L.webkitDroppedFrameCount)},K}();Y.default=I},"./src/controller/fragment-finders.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"findFragmentByPDT",function(){return I}),D.d(Y,"findFragmentByPTS",function(){return K}),D.d(Y,"fragmentWithinToleranceTest",function(){return N}),D.d(Y,"pdtWithinToleranceTest",function(){return O}),D.d(Y,"findFragWithCC",function(){return L});var $=D("./src/polyfills/number.ts"),U=D("./src/utils/binary-search.ts");function I(x,A,P){if(A===null||!Array.isArray(x)||!x.length||!Object($.isFiniteNumber)(A))return null;var w=x[0].programDateTime;if(A<(w||0))return null;var S=x[x.length-1].endProgramDateTime;if(A>=(S||0))return null;P=P||0;for(var T=0;Tx&&P.start?-1:0}function O(x,A,P){var w=Math.min(A,P.duration+(P.deltaPTS?P.deltaPTS:0))*1e3,S=P.endProgramDateTime||0;return S-w>x}function L(x,A){return U.default.search(x,function(P){return P.ccA?-1:0})}},"./src/controller/fragment-tracker.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"FragmentState",function(){return I}),D.d(Y,"FragmentTracker",function(){return K});var $=D("./src/events.ts"),U=D("./src/types/loader.ts"),I;(function(L){L.NOT_LOADED="NOT_LOADED",L.BACKTRACKED="BACKTRACKED",L.APPENDING="APPENDING",L.PARTIAL="PARTIAL",L.OK="OK"})(I||(I={}));var K=function(){function L(A){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=A,this._registerListeners()}var x=L.prototype;return x._registerListeners=function(){var P=this.hls;P.on($.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.on($.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.on($.Events.FRAG_LOADED,this.onFragLoaded,this)},x._unregisterListeners=function(){var P=this.hls;P.off($.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.off($.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.off($.Events.FRAG_LOADED,this.onFragLoaded,this)},x.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},x.getAppendedFrag=function(P,w){if(w===U.PlaylistLevelType.MAIN){var S=this.activeFragment,T=this.activeParts;if(!S)return null;if(T)for(var h=T.length;h--;){var l=T[h],i=l?l.end:S.appendedPTS;if(l.start<=P&&i!==void 0&&P<=i)return h>9&&(this.activeParts=T.slice(h-9)),l}else if(S.start<=P&&S.appendedPTS!==void 0&&P<=S.appendedPTS)return S}return this.getBufferedFrag(P,w)},x.getBufferedFrag=function(P,w){for(var S=this.fragments,T=Object.keys(S),h=T.length;h--;){var l=S[T[h]];if((l==null?void 0:l.body.type)===w&&l.buffered){var i=l.body;if(i.start<=P&&P<=i.end)return i}}return null},x.detectEvictedFragments=function(P,w,S){var T=this;Object.keys(this.fragments).forEach(function(h){var l=T.fragments[h];if(!l)return;if(!l.buffered){l.body.type===S&&T.removeFragment(l.body);return}var i=l.range[P];if(!i)return;i.time.some(function(c){var C=!T.isTimeBuffered(c.startPTS,c.endPTS,w);return C&&T.removeFragment(l.body),C})})},x.detectPartialFragments=function(P){var w=this,S=this.timeRanges,T=P.frag,h=P.part;if(!S||T.sn==="initSegment")return;var l=O(T),i=this.fragments[l];if(!i)return;Object.keys(S).forEach(function(c){var C=T.elementaryStreams[c];if(!C)return;var v=S[c],m=h!==null||C.partial===!0;i.range[c]=w.getBufferedTimes(T,h,m,v)}),i.backtrack=i.loaded=null,Object.keys(i.range).length?i.buffered=!0:this.removeFragment(i.body)},x.fragBuffered=function(P){var w=O(P),S=this.fragments[w];S&&(S.backtrack=S.loaded=null,S.buffered=!0)},x.getBufferedTimes=function(P,w,S,T){for(var h={time:[],partial:S},l=w?w.start:P.start,i=w?w.end:P.end,c=P.minEndPTS||i,C=P.maxStartPTS||l,v=0;v=m&&c<=u){h.time.push({startPTS:Math.max(l,T.start(v)),endPTS:Math.min(i,T.end(v))});break}else if(lm)h.partial=!0,h.time.push({startPTS:Math.max(l,T.start(v)),endPTS:Math.min(i,T.end(v))});else if(i<=m)break}return h},x.getPartialFragment=function(P){var w=null,S,T,h,l=0,i=this.bufferPadding,c=this.fragments;return Object.keys(c).forEach(function(C){var v=c[C];if(!v)return;N(v)&&(T=v.body.start-i,h=v.body.end+i,P>=T&&P<=h&&(S=Math.min(P-T,h-P),l<=S&&(w=v.body,l=S)))}),w},x.getState=function(P){var w=O(P),S=this.fragments[w];return S?S.buffered?N(S)?I.PARTIAL:I.OK:S.backtrack?I.BACKTRACKED:I.APPENDING:I.NOT_LOADED},x.backtrack=function(P,w){var S=O(P),T=this.fragments[S];if(!T||T.backtrack)return null;var h=T.backtrack=w||T.loaded;return T.loaded=null,h},x.getBacktrackData=function(P){var w=O(P),S=this.fragments[w];if(S){var T,h=S.backtrack;if(h!=null&&(T=h.payload)!==null&&T!==void 0&&T.byteLength)return h;this.removeFragment(P)}return null},x.isTimeBuffered=function(P,w,S){for(var T,h,l=0;l=T&&w<=h)return!0;if(w<=T)return!1}return!1},x.onFragLoaded=function(P,w){var S=w.frag,T=w.part;if(S.sn==="initSegment"||S.bitrateTest||T)return;var h=O(S);this.fragments[h]={body:S,loaded:w,backtrack:null,buffered:!1,range:Object.create(null)}},x.onBufferAppended=function(P,w){var S=this,T=w.frag,h=w.part,l=w.timeRanges;if(T.type===U.PlaylistLevelType.MAIN)if(this.activeFragment=T,h){var i=this.activeParts;i||(this.activeParts=i=[]),i.push(h)}else this.activeParts=null;this.timeRanges=l,Object.keys(l).forEach(function(c){var C=l[c];if(S.detectEvictedFragments(c,C),!h)for(var v=0;vP&&T.removeFragment(i)}})},x.removeFragment=function(P){var w=O(P);P.stats.loaded=0,P.clearElementaryStreamInfo(),delete this.fragments[w]},x.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},L}();function N(L){var x,A;return L.buffered&&(((x=L.range.video)===null||x===void 0?void 0:x.partial)||((A=L.range.audio)===null||A===void 0?void 0:A.partial))}function O(L){return L.type+"_"+L.level+"_"+L.urlId+"_"+L.sn}},"./src/controller/gap-controller.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"STALL_MINIMUM_DURATION_MS",function(){return N}),D.d(Y,"MAX_START_GAP_JUMP",function(){return O}),D.d(Y,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return L}),D.d(Y,"SKIP_BUFFER_RANGE_START",function(){return x}),D.d(Y,"default",function(){return A});var $=D("./src/utils/buffer-helper.ts"),U=D("./src/errors.ts"),I=D("./src/events.ts"),K=D("./src/utils/logger.ts"),N=250,O=2,L=.1,x=.05,A=function(){function P(S,T,h,l){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=S,this.media=T,this.fragmentTracker=h,this.hls=l}var w=P.prototype;return w.destroy=function(){this.hls=this.fragmentTracker=this.media=null},w.poll=function(T){var h=this.config,l=this.media,i=this.stalled,c=l.currentTime,C=l.seeking,v=this.seeking&&!C,m=!this.seeking&&C;if(this.seeking=C,c!==T){if(this.moved=!0,i!==null){if(this.stallReported){var u=self.performance.now()-i;K.logger.warn("playback not stuck anymore @"+c+", after "+Math.round(u)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((m||v)&&(this.stalled=null),l.paused||l.ended||l.playbackRate===0||!$.BufferHelper.getBuffered(l).length)return;var E=$.BufferHelper.bufferInfo(l,c,0),d=E.len>0,f=E.nextStart||0;if(!d&&!f)return;if(C){var s=E.len>O,a=!f||f-c>O&&!this.fragmentTracker.getPartialFragment(c);if(s||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var b,g=Math.max(f,E.start||0)-c,_=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,k=_==null||((b=_.details)===null||b===void 0)?void 0:b.live,H=k?_.details.targetduration*2:O;if(g>0&&g<=H){this._trySkipBufferHole(null);return}}var z=self.performance.now();if(i===null){this.stalled=z;return}var Z=z-i;!C&&Z>=N&&this._reportStall(E.len);var G=$.BufferHelper.bufferInfo(l,c,h.maxBufferHole);this._tryFixBufferStall(G,Z)},w._tryFixBufferStall=function(T,h){var l=this.config,i=this.fragmentTracker,c=this.media,C=c.currentTime,v=i.getPartialFragment(C);if(v){var m=this._trySkipBufferHole(v);if(m)return}T.len>l.maxBufferHole&&h>l.highBufferWatchdogPeriod*1e3&&(K.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},w._reportStall=function(T){var h=this.hls,l=this.media,i=this.stallReported;i||(this.stallReported=!0,K.logger.warn("Playback stalling at @"+l.currentTime+" due to low buffer (buffer="+T+")"),h.trigger(I.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:T}))},w._trySkipBufferHole=function(T){for(var h=this.config,l=this.hls,i=this.media,c=i.currentTime,C=0,v=$.BufferHelper.getBuffered(i),m=0;m=C&&c.05&&this.forwardBufferLength>1){var m=Math.min(2,Math.max(1,l)),u=Math.round(2/(1+Math.exp(-.75*c-this.edgeStalled))*20)/20;P.playbackRate=Math.min(m,Math.max(1,u))}else P.playbackRate!==1&&P.playbackRate!==0&&(P.playbackRate=1)},x.estimateLiveEdge=function(){var P=this.levelDetails;return P===null?null:P.edge+P.age},x.computeLatency=function(){var P=this.estimateLiveEdge();return P===null?null:P-this.currentTime},N(L,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var P=this.config,w=this.levelDetails;return P.liveMaxLatencyDuration!==void 0?P.liveMaxLatencyDuration:w?P.liveMaxLatencyDurationCount*w.targetduration:0}},{key:"targetLatency",get:function(){var P=this.levelDetails;if(P===null)return null;var w=P.holdBack,S=P.partHoldBack,T=P.targetduration,h=this.config,l=h.liveSyncDuration,i=h.liveSyncDurationCount,c=h.lowLatencyMode,C=this.hls.userConfig,v=c&&S||w;(C.liveSyncDuration||C.liveSyncDurationCount||v===0)&&(v=l!==void 0?l:i*T);var m=T,u=1;return v+Math.min(this.stallCount*u,m)}},{key:"liveSyncPosition",get:function(){var P=this.estimateLiveEdge(),w=this.targetLatency,S=this.levelDetails;if(P===null||w===null||S===null)return null;var T=S.edge,h=P-w-this.edgeStalled,l=T-S.totalduration,i=T-(this.config.lowLatencyMode&&S.partTarget||S.targetduration);return Math.min(Math.max(l,h),i)}},{key:"drift",get:function(){var P=this.levelDetails;return P===null?1:P.drift}},{key:"edgeStalled",get:function(){var P=this.levelDetails;if(P===null)return 0;var w=(this.config.lowLatencyMode&&P.partTarget||P.targetduration)*3;return Math.max(P.age-w,0)}},{key:"forwardBufferLength",get:function(){var P=this.media,w=this.levelDetails;if(!P||!w)return 0;var S=P.buffered.length;return S?P.buffered.end(S-1):w.edge-this.currentTime}}]),L}()},"./src/controller/level-controller.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return h});var $=D("./src/types/level.ts"),U=D("./src/events.ts"),I=D("./src/errors.ts"),K=D("./src/utils/codecs.ts"),N=D("./src/controller/level-helper.ts"),O=D("./src/controller/base-playlist-controller.ts"),L=D("./src/types/loader.ts");function x(){return x=Object.assign||function(l){for(var i=1;i0){f=u[0].bitrate,u.sort(function(Z,G){return Z.bitrate-G.bitrate}),this._levels=u;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:u&&(u.deliveryDirectives&&(f=!1),s=u.level),d=!0;break;case I.ErrorDetails.REMUX_ALLOC_ERROR:s=m.level,d=!0;break}s!==void 0&&this.recoverLevel(m,s,d,f)},c.recoverLevel=function(v,m,u,E){var d=v.details,f=this._levels[m];if(f.loadError++,u){var s=this.retryLoadingOrFail(v);if(s)v.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(E){var a=f.url.length;if(a>1&&f.loadError1){var E=(m.urlId+1)%u;this.warn("Switching to redundant URL-id "+E),this._levels.forEach(function(d){d.urlId=E}),this.level=v}},c.onFragLoaded=function(v,m){var u=m.frag;if(u!==void 0&&u.type===L.PlaylistLevelType.MAIN){var E=this._levels[u.level];E!==void 0&&(E.fragmentError=0,E.loadError=0)}},c.onLevelLoaded=function(v,m){var u,E=m.level,d=m.details,f=this._levels[E];if(!f){var s;this.warn("Invalid level index "+E),(s=m.deliveryDirectives)!==null&&s!==void 0&&s.skip&&(d.deltaUpdateFailed=!0);return}E===this.currentLevelIndex?(f.fragmentError===0&&(f.loadError=0,this.retryCount=0),this.playlistLoaded(E,m,f.details)):(u=m.deliveryDirectives)!==null&&u!==void 0&&u.skip&&(d.deltaUpdateFailed=!0)},c.onAudioTrackSwitched=function(v,m){var u=this.hls.levels[this.currentLevelIndex];if(!u)return;if(u.audioGroupIds){for(var E=-1,d=this.hls.audioTracks[m.id].groupId,f=0;f0){var E=u.urlId,d=u.url[E];if(v)try{d=v.addDirectives(d)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("Attempt loading level index "+m+(v?" at sn "+v.msn+" part "+v.part:"")+" with URL-id "+E+" "+d),this.clearTimer(),this.hls.trigger(U.Events.LEVEL_LOADING,{url:d,level:m,id:E,deliveryDirectives:v||null})}},c.removeLevel=function(v,m){var u=function(f,s){return s!==m},E=this._levels.filter(function(d,f){return f!==v?!0:d.url.length>1&&m!==void 0?(d.url=d.url.filter(u),d.audioGroupIds&&(d.audioGroupIds=d.audioGroupIds.filter(u)),d.textGroupIds&&(d.textGroupIds=d.textGroupIds.filter(u)),d.urlId=0,!0):!1}).map(function(d,f){var s=d.details;return s!=null&&s.fragments&&s.fragments.forEach(function(a){a.level=f}),d});this._levels=E,this.hls.trigger(U.Events.LEVELS_UPDATED,{levels:E})},P(i,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(v){var m,u=this._levels;if(u.length===0)return;if(this.currentLevelIndex===v&&(m=u[v])!==null&&m!==void 0&&m.details)return;if(v<0||v>=u.length){var E=v<0;if(this.hls.trigger(U.Events.ERROR,{type:I.ErrorTypes.OTHER_ERROR,details:I.ErrorDetails.LEVEL_SWITCH_ERROR,level:v,fatal:E,reason:"invalid level idx"}),E)return;v=Math.min(v,u.length-1)}this.clearTimer();var d=this.currentLevelIndex,f=u[d],s=u[v];this.log("switching to level "+v+" from "+d),this.currentLevelIndex=v;var a=x({},s,{level:v,maxBitrate:s.maxBitrate,uri:s.uri,urlId:s.urlId});delete a._urlId,this.hls.trigger(U.Events.LEVEL_SWITCHING,a);var b=s.details;if(!b||b.live){var g=this.switchParams(s.uri,f==null?void 0:f.details);this.loadPlaylist(g)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(v){this.manualLevelIndex=v,this._startLevel===void 0&&(this._startLevel=v),v!==-1&&(this.level=v)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(v){this._firstLevel=v}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var v=this.hls.config.startLevel;return v!==void 0?v:this._firstLevel}else return this._startLevel},set:function(v){this._startLevel=v}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(v){this.level=v,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=v)}}]),i}(O.default)},"./src/controller/level-helper.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"addGroupId",function(){return I}),D.d(Y,"assignTrackIdsByGroup",function(){return K}),D.d(Y,"updatePTS",function(){return N}),D.d(Y,"updateFragPTSDTS",function(){return L}),D.d(Y,"mergeDetails",function(){return x}),D.d(Y,"mapPartIntersection",function(){return A}),D.d(Y,"mapFragmentIntersection",function(){return P}),D.d(Y,"adjustSliding",function(){return w}),D.d(Y,"addSliding",function(){return S}),D.d(Y,"computeReloadInterval",function(){return T}),D.d(Y,"getFragmentWithSN",function(){return h}),D.d(Y,"getPartWith",function(){return l});var $=D("./src/polyfills/number.ts"),U=D("./src/utils/logger.ts");function I(i,c,C){switch(c){case"audio":i.audioGroupIds||(i.audioGroupIds=[]),i.audioGroupIds.push(C);break;case"text":i.textGroupIds||(i.textGroupIds=[]),i.textGroupIds.push(C);break}}function K(i){var c={};i.forEach(function(C){var v=C.groupId||"";C.id=c[v]=c[v]||0,c[v]++})}function N(i,c,C){var v=i[c],m=i[C];O(v,m)}function O(i,c){var C=c.startPTS;if(Object($.isFiniteNumber)(C)){var v=0,m;c.sn>i.sn?(v=C-i.start,m=i):(v=i.start-C,m=c),m.duration!==v&&(m.duration=v)}else if(c.sn>i.sn){var u=i.cc===c.cc;u&&i.minEndPTS?c.start=i.start+(i.minEndPTS-i.start):c.start=i.start+i.duration}else c.start=Math.max(i.start-c.duration,0)}function L(i,c,C,v,m,u){var E=v-C;E<=0&&(U.logger.warn("Fragment should have a positive duration",c),v=C+c.duration,u=m+c.duration);var d=C,f=v,s=c.startPTS,a=c.endPTS;if(Object($.isFiniteNumber)(s)){var b=Math.abs(s-C);Object($.isFiniteNumber)(c.deltaPTS)?c.deltaPTS=Math.max(b,c.deltaPTS):c.deltaPTS=b,d=Math.max(C,s),C=Math.min(C,s),m=Math.min(m,c.startDTS),f=Math.min(v,a),v=Math.max(v,a),u=Math.max(u,c.endDTS)}c.duration=v-C;var g=C-c.start;c.appendedPTS=v,c.start=c.startPTS=C,c.maxStartPTS=d,c.startDTS=m,c.endPTS=v,c.minEndPTS=f,c.endDTS=u;var _=c.sn;if(!i||_i.endSN)return 0;var k,H=_-i.startSN,z=i.fragments;for(z[H]=c,k=H;k>0;k--)O(z[k],z[k-1]);for(k=H;k=0;m--){var u=v[m].initSegment;if(u){C=u;break}}i.fragmentHint&&delete i.fragmentHint.endPTS;var E=0,d;if(P(i,c,function(k,H){k.relurl&&(E=k.cc-H.cc),Object($.isFiniteNumber)(k.startPTS)&&Object($.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&&(d=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 f=c.fragmentHint?c.fragments.concat(c.fragmentHint):c.fragments;f.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)){U.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(E){U.logger.warn("discontinuity sliding from playlist, take drift into account");for(var b=0;b=v.length)return;S(c,v[C].start)}function S(i,c){if(c){for(var C=i.fragments,v=i.skippedSegments;v0&&m0&&f===-1&&(this.log("Override startPosition with lastCurrentTime @"+s.toFixed(3)),f=s),this.state=U.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=f,this.tick()}else this._forceStartLoad=!0,this.state=U.State.STOPPED},E.stopLoad=function(){this._forceStartLoad=!1,m.prototype.stopLoad.call(this)},E.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_LEVEL:{var f,s=this.levels,a=this.level,b=s==null||((f=s[a])===null||f===void 0)?void 0:f.details;if(b&&(!b.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(b))break;this.state=U.State.IDLE;break}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var g,_=self.performance.now(),k=this.retryDate;(!k||_>=k||(g=this.media)!==null&&g!==void 0&&g.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=U.State.IDLE)}break;default:break}this.onTickEnd()},E.onTickEnd=function(){m.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},E.doTickIdle=function(){var f,s,a=this.hls,b=this.levelLastLoaded,g=this.levels,_=this.media,k=a.config,H=a.nextLoadLevel;if(b===null||!_&&(this.startFragRequested||!k.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!g||!g[H])return;var z=g[H];this.level=a.nextLoadLevel=H;var Z=z.details;if(!Z||this.state===U.State.WAITING_LEVEL||Z.live&&this.levelLastLoaded!==H){this.state=U.State.WAITING_LEVEL;return}var G=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:_,L.PlaylistLevelType.MAIN);if(G===null)return;var B=G.len,te=this.getMaxBufferLength(z.maxBitrate);if(B>=te)return;if(this._streamEnded(G,Z)){var ce={};this.altAudio&&(ce.type="video"),this.hls.trigger(K.Events.BUFFER_EOS,ce),this.state=U.State.ENDED;return}var pe=G.end,ye=this.getNextFragment(pe,Z);if(this.couldBacktrack&&!this.fragPrevious&&ye&&ye.sn!=="initSegment"){var Ce=ye.sn-Z.startSN;Ce>1&&(ye=Z.fragments[Ce-1],this.fragmentTracker.removeFragment(ye))}if(ye&&this.fragmentTracker.getState(ye)===O.FragmentState.OK&&this.nextLoadPosition>pe){var _e=this.audioOnly&&!this.altAudio?x.ElementaryStreamTypes.AUDIO:x.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(_,_e,L.PlaylistLevelType.MAIN),ye=this.getNextFragment(this.nextLoadPosition,Z)}if(!ye)return;ye.initSegment&&!ye.initSegment.data&&!this.bitrateTest&&(ye=ye.initSegment),((f=ye.decryptdata)===null||f===void 0?void 0:f.keyFormat)==="identity"&&!((s=ye.decryptdata)!==null&&s!==void 0&&s.key)?this.loadKey(ye,Z):this.loadFragment(ye,Z,pe)},E.loadFragment=function(f,s,a){var b,g=this.fragmentTracker.getState(f);if(this.fragCurrent=f,g===O.FragmentState.BACKTRACKED){var _=this.fragmentTracker.getBacktrackData(f);if(_){this._handleFragmentLoadProgress(_),this._handleFragmentLoadComplete(_);return}else g=O.FragmentState.NOT_LOADED}g===O.FragmentState.NOT_LOADED||g===O.FragmentState.PARTIAL?f.sn==="initSegment"?this._loadInitSegment(f):this.bitrateTest?(f.bitrateTest=!0,this.log("Fragment "+f.sn+" of level "+f.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(f)):(this.startFragRequested=!0,m.prototype.loadFragment.call(this,f,s,a)):g===O.FragmentState.APPENDING?this.reduceMaxBufferLength(f.duration)&&this.fragmentTracker.removeFragment(f):((b=this.media)===null||b===void 0?void 0:b.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},E.getAppendedFrag=function(f){var s=this.fragmentTracker.getAppendedFrag(f,L.PlaylistLevelType.MAIN);return s&&"fragment"in s?s.fragment:s},E.getBufferedFrag=function(f){return this.fragmentTracker.getBufferedFrag(f,L.PlaylistLevelType.MAIN)},E.followingBufferedFrag=function(f){return f?this.getBufferedFrag(f.end+.5):null},E.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},E.nextLevelSwitch=function(){var f=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&&f){var g=this.hls.nextLoadLevel,_=f[g],k=this.fragLastKbps;k&&this.fragCurrent?a=this.fragCurrent.duration*_.maxBitrate/(1e3*k)+1:a=0}else a=0;var H=this.getBufferedFrag(s.currentTime+a);if(H){var z=this.followingBufferedFrag(H);if(z){this.abortCurrentFrag();var Z=z.maxStartPTS?z.maxStartPTS:z.start,G=z.duration,B=Math.max(H.end,Z+Math.min(Math.max(G-this.config.maxFragLookUpTolerance,G*.5),G*.75));this.flushMainBuffer(B,Number.POSITIVE_INFINITY)}}}},E.abortCurrentFrag=function(){var f=this.fragCurrent;this.fragCurrent=null,f!=null&&f.loader&&f.loader.abort(),this.state===U.State.KEY_LOADING&&(this.state=U.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},E.flushMainBuffer=function(f,s){m.prototype.flushMainBuffer.call(this,f,s,this.altAudio?"video":null)},E.onMediaAttached=function(f,s){m.prototype.onMediaAttached.call(this,f,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 w.default(this.config,a,this.fragmentTracker,this.hls)},E.onMediaDetaching=function(){var f=this.media;f&&(f.removeEventListener("playing",this.onvplaying),f.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)},E.onMediaPlaying=function(){this.tick()},E.onMediaSeeked=function(){var f=this.media,s=f?f.currentTime:null;Object($.isFiniteNumber)(s)&&this.log("Media seeked to "+s.toFixed(3)),this.tick()},E.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(K.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},E.onManifestParsed=function(f,s){var a=!1,b=!1,g;s.levels.forEach(function(_){g=_.audioCodec,g&&(g.indexOf("mp4a.40.2")!==-1&&(a=!0),g.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},E.onLevelLoading=function(f,s){var a=this.levels;if(!a||this.state!==U.State.IDLE)return;var b=a[s.level];(!b.details||b.details.live&&this.levelLastLoaded!==s.level||this.waitForCdnTuneIn(b.details))&&(this.state=U.State.WAITING_LEVEL)},E.onLevelLoaded=function(f,s){var a,b=this.levels,g=s.level,_=s.details,k=_.totalduration;if(!b){this.warn("Levels were reset while loading level "+g);return}this.log("Level "+g+" loaded ["+_.startSN+","+_.endSN+"], cc ["+_.startCC+", "+_.endCC+"] duration:"+k);var H=this.fragCurrent;H&&(this.state===U.State.FRAG_LOADING||this.state===U.State.FRAG_LOADING_WAITING_RETRY)&&(H.level!==s.level&&H.loader&&(this.state=U.State.IDLE,H.loader.abort()));var z=b[g],Z=0;if(_.live||(a=z.details)!==null&&a!==void 0&&a.live){if(_.fragments[0]||(_.deltaUpdateFailed=!0),_.deltaUpdateFailed)return;Z=this.alignPlaylists(_,z.details)}if(z.details=_,this.levelLastLoaded=g,this.hls.trigger(K.Events.LEVEL_UPDATED,{details:_,level:g}),this.state===U.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(_))return;this.state=U.State.IDLE}this.startFragRequested?_.live&&this.synchronizeToLiveEdge(_):this.setStartPosition(_,Z),this.tick()},E._handleFragmentLoadProgress=function(f){var s,a=f.frag,b=f.part,g=f.payload,_=this.levels;if(!_){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=_[a.level],H=k.details;if(!H){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var z=k.videoCodec,Z=H.PTSKnown||!H.live,G=(s=a.initSegment)===null||s===void 0?void 0:s.data,B=this._getAudioCodec(k),te=this.transmuxer=this.transmuxer||new A.default(this.hls,L.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ce=b?b.index:-1,pe=ce!==-1,ye=new P.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,g.byteLength,ce,pe),Ce=this.initPTS[a.cc];te.push(g,G,B,z,a,b,H.totalduration,Z,ye,Ce)},E.onAudioTrackSwitching=function(f,s){var a=this.altAudio,b=!!s.url,g=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 _=this.fragCurrent;_!=null&&_.loader&&(this.log("Switching to main audio track, cancel main fragment load"),_.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var k=this.hls;a&&k.trigger(K.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),k.trigger(K.Events.AUDIO_TRACK_SWITCHED,{id:g})}},E.onAudioTrackSwitched=function(f,s){var a=s.id,b=!!this.hls.audioTracks[a].url;if(b){var g=this.videoBuffer;g&&this.mediaBuffer!==g&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=g)}this.altAudio=b,this.tick()},E.onBufferCreated=function(f,s){var a=s.tracks,b,g,_=!1;for(var k in a){var H=a[k];if(H.id==="main"){if(g=k,b=H,k==="video"){var z=a[k];z&&(this.videoBuffer=z.buffer)}}else _=!0}_&&b?(this.log("Alternate track found, use "+g+".buffered to schedule main fragment loading"),this.mediaBuffer=b.buffer):this.mediaBuffer=this.media},E.onFragBuffered=function(f,s){var a=s.frag,b=s.part;if(a&&a.type!==L.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===U.State.PARSED&&(this.state=U.State.IDLE);return}var g=b?b.stats:a.stats;this.fragLastKbps=Math.round(8*g.total/(g.buffering.end-g.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,b)},E.onError=function(f,s){switch(s.details){case S.ErrorDetails.FRAG_LOAD_ERROR:case S.ErrorDetails.FRAG_LOAD_TIMEOUT:case S.ErrorDetails.KEY_LOAD_ERROR:case S.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(L.PlaylistLevelType.MAIN,s);break;case S.ErrorDetails.LEVEL_LOAD_ERROR:case S.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==U.State.ERROR&&(s.fatal?(this.warn(""+s.details),this.state=U.State.ERROR):!s.levelRetry&&this.state===U.State.WAITING_LEVEL&&(this.state=U.State.IDLE));break;case S.ErrorDetails.BUFFER_FULL_ERROR:if(s.parent==="main"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var a=!0,b=this.getFwdBufferInfo(this.media,L.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}},E.checkBuffer=function(){var f=this.media,s=this.gapController;if(!f||!s||!f.readyState)return;var a=N.BufferHelper.getBuffered(f);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):s.poll(this.lastCurrentTime),this.lastCurrentTime=f.currentTime},E.onFragLoadEmergencyAborted=function(){this.state=U.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},E.onBufferFlushed=function(f,s){var a=s.type;if(a!==x.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var b=(a===x.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(b,a,L.PlaylistLevelType.MAIN)}},E.onLevelsUpdated=function(f,s){this.levels=s.levels},E.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},E.seekToStartPos=function(){var f=this.media,s=f.currentTime,a=this.startPosition;if(a>=0&&s0&&(_1&&f.seeking===!1){var a=f.currentTime;if(N.BufferHelper.isBuffered(f,a)?s=this.getAppendedFrag(a):N.BufferHelper.isBuffered(f,a+.1)&&(s=this.getAppendedFrag(a+.1)),s){var b=this.fragPlaying,g=s.level;(!b||s.sn!==b.sn||b.level!==g||s.urlId!==b.urlId)&&(this.hls.trigger(K.Events.FRAG_CHANGED,{frag:s}),(!b||b.level!==g)&&this.hls.trigger(K.Events.LEVEL_SWITCHED,{level:g}),this.fragPlaying=s)}}},l(u,[{key:"nextLevel",get:function(){var f=this.nextBufferedFrag;return f?f.level:-1}},{key:"currentLevel",get:function(){var f=this.media;if(f){var s=this.getAppendedFrag(f.currentTime);if(s)return s.level}return-1}},{key:"nextBufferedFrag",get:function(){var f=this.media;if(f){var s=this.getAppendedFrag(f.currentTime);return this.followingBufferedFrag(s)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),u}(U.default)},"./src/controller/subtitle-stream-controller.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"SubtitleStreamController",function(){return i});var $=D("./src/events.ts"),U=D("./src/utils/logger.ts"),I=D("./src/utils/buffer-helper.ts"),K=D("./src/controller/fragment-finders.ts"),N=D("./src/utils/discontinuities.ts"),O=D("./src/controller/level-helper.ts"),L=D("./src/controller/fragment-tracker.ts"),x=D("./src/controller/base-stream-controller.ts"),A=D("./src/types/loader.ts"),P=D("./src/types/level.ts");function w(c,C){for(var v=0;v=s[g].start&&b<=s[g].end){a=s[g];break}var _=d.start+d.duration;a?a.end=_:(a={start:b,end:_},s.push(a)),this.fragmentTracker.fragBuffered(d)},v.onBufferFlushing=function(u,E){var d=E.startOffset,f=E.endOffset;if(d===0&&f!==Number.POSITIVE_INFINITY){var s=this.currentTrackId,a=this.levels;if(!a.length||!a[s]||!a[s].details)return;var b=a[s].details,g=b.targetduration,_=f-g;if(_<=0)return;E.endOffsetSubtitles=Math.max(0,_),this.tracksBuffered.forEach(function(k){for(var H=0;H=b.length||s!==a||!g)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,f.live||(d=g.details)!==null&&d!==void 0&&d.live){var _=this.mainDetails;if(f.deltaUpdateFailed||!_)return;var k=_.fragments[0];if(!g.details)f.hasProgramDateTime&&_.hasProgramDateTime?Object(N.alignMediaPlaylistByPDT)(f,_):k&&Object(O.addSliding)(f,k.start);else{var H=this.alignPlaylists(f,g.details);H===0&&k&&Object(O.addSliding)(f,k.start)}}if(g.details=f,this.levelLastLoaded=s,this.tick(),f.live&&!this.fragCurrent&&this.media&&this.state===x.State.IDLE){var z=Object(K.findFragmentByPTS)(null,f.fragments,this.media.currentTime,0);z||(this.warn("Subtitle playlist not aligned with playback"),g.details=void 0)}},v._handleFragmentLoadComplete=function(u){var E=u.frag,d=u.payload,f=E.decryptdata,s=this.hls;if(this.fragContextChanged(E))return;if(d&&d.byteLength>0&&f&&f.key&&f.iv&&f.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(d),f.key.buffer,f.iv.buffer).then(function(b){var g=performance.now();s.trigger($.Events.FRAG_DECRYPTED,{frag:E,payload:b,stats:{tstart:a,tdecrypt:g}})})}},v.doTick=function(){if(!this.media){this.state=x.State.IDLE;return}if(this.state===x.State.IDLE){var u,E=this.currentTrackId,d=this.levels;if(!d.length||!d[E]||!d[E].details)return;var f=d[E].details,s=f.targetduration,a=this.config,b=this.media,g=I.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,b.currentTime-s,a.maxBufferHole),_=g.end,k=g.len,H=this.getMaxBufferLength()+s;if(k>H)return;console.assert(f,"Subtitle track details are defined on idle subtitle stream controller tick");var z=f.fragments,Z=z.length,G=f.edge,B,te=this.fragPrevious;if(_-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)},T.pollTrackChange=function(l){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,l)},T.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 l=P(this.media.textTracks);l.forEach(function(i){Object(U.clearCurrentCues)(i)}),this.subtitleTrack=-1,this.media=null},T.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},T.onManifestParsed=function(l,i){this.tracks=i.subtitleTracks},T.onSubtitleTrackLoaded=function(l,i){var c=i.id,C=i.details,v=this.trackId,m=this.tracksInGroup[v];if(!m){this.warn("Invalid subtitle track id "+c);return}var u=m.details;m.details=i.details,this.log("subtitle track "+c+" loaded ["+C.startSN+"-"+C.endSN+"]"),c===this.trackId&&(this.retryCount=0,this.playlistLoaded(c,i,u))},T.onLevelLoading=function(l,i){this.switchLevel(i.level)},T.onLevelSwitching=function(l,i){this.switchLevel(i.level)},T.switchLevel=function(l){var i=this.hls.levels[l];if(!(i!=null&&i.textGroupIds))return;var c=i.textGroupIds[i.urlId];if(this.groupId!==c){var C=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,v=this.tracks.filter(function(E){return!c||E.groupId===c});this.tracksInGroup=v;var m=this.findTrackId(C==null?void 0:C.name)||this.findTrackId();this.groupId=c;var u={subtitleTracks:v};this.log("Updating subtitle tracks, "+v.length+' track(s) found in "'+c+'" group-id'),this.hls.trigger($.Events.SUBTITLE_TRACKS_UPDATED,u),m!==-1&&this.setSubtitleTrack(m,C)}},T.findTrackId=function(l){for(var i=this.tracksInGroup,c=0;c=C.length)return;this.clearTimer();var v=C[l];if(this.log("Switching to subtitle track "+l),this.trackId=l,v){var m=v.id,u=v.groupId,E=u===void 0?"":u,d=v.name,f=v.type,s=v.url;this.hls.trigger($.Events.SUBTITLE_TRACK_SWITCH,{id:m,groupId:E,name:d,type:f,url:s});var a=this.switchParams(v.url,i==null?void 0:i.details);this.loadPlaylist(a)}else this.hls.trigger($.Events.SUBTITLE_TRACK_SWITCH,{id:l})},T.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var l=-1,i=P(this.media.textTracks),c=0;c=0&&(f[0]=Math.min(f[0],C),f[1]=Math.max(f[1],v),E=!0,s/(v-C)>.5))return}if(E||u.push([C,v]),this.config.renderTextTracksNatively){var a=this.captionsTracks[c];this.Cues.newCue(a,C,v,m)}else{var b=this.Cues.newCue(null,C,v,m);this.hls.trigger(U.Events.CUES_PARSED,{type:"captions",cues:b,track:c})}},l.onInitPtsFound=function(c,C){var v=this,m=C.frag,u=C.id,E=C.initPTS,d=C.timescale,f=this.unparsedVttFrags;u==="main"&&(this.initPTS[m.cc]=E,this.timescale[m.cc]=d),f.length&&(this.unparsedVttFrags=[],f.forEach(function(s){v.onFragLoaded(U.Events.FRAG_LOADED,s)}))},l.getExistingTrack=function(c){var C=this.media;if(C)for(var v=0;v>>8^d&255^99,L[m]=d,x[d]=m;var f=v[m],s=v[f],a=v[s],b=v[d]*257^d*16843008;P[m]=b<<24|b>>>8,w[m]=b<<16|b>>>16,S[m]=b<<8|b>>>24,T[m]=b,b=a*16843009^s*65537^f*257^m*16843008,l[d]=b<<24|b>>>8,i[d]=b<<16|b>>>16,c[d]=b<<8|b>>>24,C[d]=b,m?(m=f^v[v[v[a^f]]],u^=v[v[u]]):m=u=1}},N.expandKey=function(L){for(var x=this.uint8ArrayToUint32Array_(L),A=!0,P=0;P>>6)+1;var b=(c[C+2]&60)>>>2;if(b>a.length-1){i.trigger(I.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+b});return}return E=(c[C+2]&1)<<2,E|=(c[C+3]&192)>>>6,$.logger.log("manifest codec:"+v+", ADTS type:"+m+", samplingIndex:"+b),/firefox/i.test(f)?b>=6?(m=5,d=new Array(4),u=b-3):(m=2,d=new Array(2),u=b):f.indexOf("android")!==-1?(m=2,d=new Array(2),u=b):(m=5,d=new Array(4),v&&(v.indexOf("mp4a.40.29")!==-1||v.indexOf("mp4a.40.5")!==-1)||!v&&b>=6?u=b-3:((v&&v.indexOf("mp4a.40.2")!==-1&&(b>=6&&E===1||/vivaldi/i.test(f))||!v&&E===1)&&(m=2,d=new Array(2)),u=b)),d[0]=m<<3,d[0]|=(b&14)>>1,d[1]|=(b&1)<<7,d[1]|=E<<3,m===5&&(d[1]|=(u&14)>>1,d[2]=(u&1)<<7,d[2]|=2<<2,d[3]=0),{config:d,samplerate:a[b],channelCount:E,codec:"mp4a.40."+m,manifestCodec:s}}function N(i,c){return i[c]===255&&(i[c+1]&246)===240}function O(i,c){return i[c+1]&1?7:9}function L(i,c){return(i[c+3]&3)<<11|i[c+4]<<3|(i[c+5]&224)>>>5}function x(i,c){return c+5=i.length)return!1;var v=L(i,c);if(v<=C)return!1;var m=c+v;return m===i.length||A(i,m)}return!1}function S(i,c,C,v,m){if(!i.samplerate){var u=K(c,C,v,m);if(!u)return;i.config=u.config,i.samplerate=u.samplerate,i.channelCount=u.channelCount,i.codec=u.codec,i.manifestCodec=u.manifestCodec,$.logger.log("parsed codec:"+i.codec+", rate:"+u.samplerate+", channels:"+u.channelCount)}}function T(i){return 1024*9e4/i}function h(i,c,C,v,m){var u=O(i,c),E=L(i,c);if(E-=u,E>0){var d=C+v*m;return{headerLength:u,frameLength:E,stamp:d}}}function l(i,c,C,v,m){var u=T(i.samplerate),E=h(c,C,v,m,u);if(E){var d=E.frameLength,f=E.headerLength,s=E.stamp,a=f+d,b=Math.max(0,C+a-c.length),g;b?(g=new Uint8Array(a-f),g.set(c.subarray(C+f,c.length),0)):g=c.subarray(C+f,C+a);var _={unit:g,pts:s};return b||i.samples.push(_),{sample:_,length:a,missing:b}}}},"./src/demux/base-audio-demuxer.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"initPTSFn",function(){return L});var $=D("./src/polyfills/number.ts"),U=D("./src/demux/id3.ts"),I=D("./src/demux/dummy-demuxed-track.ts"),K=D("./src/utils/mp4-tools.ts"),N=D("./src/utils/typed-array.ts"),O=function(){function x(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var A=x.prototype;return A.resetInitSegment=function(w,S,T){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},A.resetTimeStamp=function(){},A.resetContiguity=function(){},A.canParse=function(w,S){return!1},A.appendFrame=function(w,S,T){},A.demux=function(w,S){this.cachedData&&(w=Object(K.appendUint8Array)(this.cachedData,w),this.cachedData=null);var T=U.getID3Data(w,0),h=T?T.length:0,l,i,c=this._audioTrack,C=this._id3Track,v=T?U.getTimeStamp(T):void 0,m=w.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=L(v,S)),T&&T.length>0&&C.samples.push({pts:this.initPTS,dts:this.initPTS,data:T}),i=this.initPTS;hO?(this.word<<=O,this.bitsAvailable-=O):(O-=this.bitsAvailable,L=O>>3,O-=L>>3,this.bytesAvailable-=L,this.loadWord(),this.word<<=O,this.bitsAvailable-=O)},K.readBits=function(O){var L=Math.min(this.bitsAvailable,O),x=this.word>>>32-L;return O>32&&$.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=L,this.bitsAvailable>0?this.word<<=L:this.bytesAvailable>0&&this.loadWord(),L=O-L,L>0&&this.bitsAvailable?x<>>O)!==0)return this.word<<=O,this.bitsAvailable-=O,O;return this.loadWord(),O+this.skipLZ()},K.skipUEG=function(){this.skipBits(1+this.skipLZ())},K.skipEG=function(){this.skipBits(1+this.skipLZ())},K.readUEG=function(){var O=this.skipLZ();return this.readBits(O+1)-1},K.readEG=function(){var O=this.readUEG();return 1&O?1+O>>>1:-1*(O>>>1)},K.readBoolean=function(){return this.readBits(1)===1},K.readUByte=function(){return this.readBits(8)},K.readUShort=function(){return this.readBits(16)},K.readUInt=function(){return this.readBits(32)},K.skipScalingList=function(O){for(var L=8,x=8,A,P=0;P0?m.subarray(E,E+d):void 0},K=function(m,u){var E=0;return E=(m[u]&127)<<21,E|=(m[u+1]&127)<<14,E|=(m[u+2]&127)<<7,E|=m[u+3]&127,E},N=function(m,u){return $(m,u)&&K(m,u+6)+10<=m.length-u},O=function(m){for(var u=A(m),E=0;E>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:_+=String.fromCharCode(a);break;case 12:case 13:b=m[k++],_+=String.fromCharCode((a&31)<<6|b&63);break;case 14:b=m[k++],g=m[k++],_+=String.fromCharCode((a&15)<<12|(b&63)<<6|(g&63)<<0);break;default:}}return _},i={decodeTextFrame:S},c;function C(){return!c&&typeof self.TextDecoder!="undefined"&&(c=new self.TextDecoder("utf-8")),c}},"./src/demux/mp3demuxer.ts":function(oe,Y,D){"use strict";D.r(Y);var $=D("./src/demux/base-audio-demuxer.ts"),U=D("./src/demux/id3.ts"),I=D("./src/utils/logger.ts"),K=D("./src/demux/mpegaudio.ts");function N(x,A){x.prototype=Object.create(A.prototype),x.prototype.constructor=x,O(x,A)}function O(x,A){return O=Object.setPrototypeOf||function(w,S){return w.__proto__=S,w},O(x,A)}var L=function(x){N(A,x);function A(){return x.apply(this,arguments)||this}var P=A.prototype;return P.resetInitSegment=function(S,T,h){x.prototype.resetInitSegment.call(this,S,T,h),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:S,duration:h,inputTimeScale:9e4,dropped:0}},A.probe=function(S){if(!S)return!1;for(var T=U.getID3Data(S,0)||[],h=T.length,l=S.length;h0},N.demux=function(L){var x=L,A=Object(U.dummyTrack)();if(this.config.progressive){this.remainderData&&(x=Object($.appendUint8Array)(this.remainderData,L));var P=Object($.segmentValidRange)(x);this.remainderData=P.remainder,A.samples=P.valid||new Uint8Array}else A.samples=x;return{audioTrack:Object(U.dummyTrack)(),avcTrack:A,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},N.flush=function(){var L=Object(U.dummyTrack)();return L.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(U.dummyTrack)(),avcTrack:L,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},N.demuxSampleAes=function(L,x,A){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},N.destroy=function(){},K}();I.minProbeByteLength=1024,Y.default=I},"./src/demux/mpegaudio.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"appendFrame",function(){return O}),D.d(Y,"parseHeader",function(){return L}),D.d(Y,"isHeaderPattern",function(){return x}),D.d(Y,"isHeader",function(){return A}),D.d(Y,"canParse",function(){return P}),D.d(Y,"probe",function(){return w});var $=null,U=[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],K=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],N=[0,1,1,4];function O(S,T,h,l,i){if(h+24>T.length)return;var c=L(T,h);if(c&&h+c.frameLength<=T.length){var C=c.samplesPerFrame*9e4/c.sampleRate,v=l+i*C,m={unit:T.subarray(h,h+c.frameLength),pts:v,dts:v};return S.config=[],S.channelCount=c.channelCount,S.samplerate=c.sampleRate,S.samples.push(m),{sample:m,length:c.frameLength,missing:0}}}function L(S,T){var h=S[T+1]>>3&3,l=S[T+1]>>1&3,i=S[T+2]>>4&15,c=S[T+2]>>2&3;if(h!==1&&i!==0&&i!==15&&c!==3){var C=S[T+2]>>1&1,v=S[T+3]>>6,m=h===3?3-l:l===3?3:4,u=U[m*14+i-1]*1e3,E=h===3?0:h===2?1:2,d=I[E*3+c],f=v===3?1:2,s=K[h][l],a=N[l],b=s*8*a,g=Math.floor(s*u/d+C)*a;if($===null){var _=navigator.userAgent||"",k=_.match(/Chrome\/(\d+)/i);$=k?parseInt(k[1]):0}var H=!!$&&$<=87;return H&&l===2&&u>=224e3&&v===0&&(S[T+3]=S[T+3]|128),{sampleRate:d,channelCount:f,frameLength:g,samplesPerFrame:b}}}function x(S,T){return S[T]===255&&(S[T+1]&224)===224&&(S[T+1]&6)!==0}function A(S,T){return T+1=L.length){A();return}if(L[x].unit.length<32)continue;var P=this.decrypter.isSync();if(this.decryptAacSample(L,x,A,P),!P)return}},N.getAvcEncryptedData=function(L){for(var x=Math.floor((L.length-48)/160)*16+16,A=new Int8Array(x),P=0,w=32;w<=L.length-16;w+=160,P+=16)A.set(L.subarray(w,w+16),P);return A},N.getAvcDecryptedUnit=function(L,x){for(var A=new Uint8Array(x),P=0,w=32;w<=L.length-16;w+=160,P+=16)L.set(A.subarray(P,P+16),w);return L},N.decryptAvcSample=function(L,x,A,P,w,S){var T=Object(U.discardEPB)(w.data),h=this.getAvcEncryptedData(T),l=this;this.decryptBuffer(h.buffer,function(i){w.data=l.getAvcDecryptedUnit(T,i),S||l.decryptAvcSamples(L,x,A+1,P)})},N.decryptAvcSamples=function(L,x,A,P){if(L instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;x++,A=0){if(x>=L.length){P();return}for(var w=L[x].units;!(A>=w.length);A++){var S=w[A];if(S.data.length<=48||S.type!==1&&S.type!==5)continue;var T=this.decrypter.isSync();if(this.decryptAvcSample(L,x,A,P,S,T),!T)return}}},K}();Y.default=I},"./src/demux/transmuxer-interface.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return w});var $=D("./node_modules/webworkify-webpack/index.js"),U=D.n($),I=D("./src/events.ts"),K=D("./src/demux/transmuxer.ts"),N=D("./src/utils/logger.ts"),O=D("./src/errors.ts"),L=D("./src/utils/mediasource-helper.ts"),x=D("./node_modules/eventemitter3/index.js"),A=D.n(x),P=Object(L.getMediaSource)()||{isTypeSupported:function(){return!1}},w=function(){function S(h,l,i,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=l,this.onTransmuxComplete=i,this.onFlush=c;var v=h.config,m=function(s,a){a=a||{},a.frag=C.frag,a.id=C.id,h.trigger(s,a)};this.observer=new x.EventEmitter,this.observer.on(I.Events.FRAG_DECRYPTED,m),this.observer.on(I.Events.ERROR,m);var u={mp4:P.isTypeSupported("video/mp4"),mpeg:P.isTypeSupported("audio/mpeg"),mp3:P.isTypeSupported('audio/mp4; codecs="mp3"')},E=navigator.vendor;if(v.enableWorker&&typeof Worker!="undefined"){N.logger.log("demuxing in webworker");var d;try{d=this.worker=$("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),d.addEventListener("message",this.onwmsg),d.onerror=function(f){h.trigger(I.Events.ERROR,{type:O.ErrorTypes.OTHER_ERROR,details:O.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(f.message+" ("+f.filename+":"+f.lineno+")")})},d.postMessage({cmd:"init",typeSupported:u,vendor:E,id:l,config:JSON.stringify(v)})}catch(f){N.logger.warn("Error in worker:",f),N.logger.error("Error while initializing DemuxerWorker, fallback to inline"),d&&self.URL.revokeObjectURL(d.objectURL),this.transmuxer=new K.default(this.observer,u,v,E,l),this.worker=null}}else this.transmuxer=new K.default(this.observer,u,v,E,l)}var T=S.prototype;return T.destroy=function(){var l=this.worker;if(l)l.removeEventListener("message",this.onwmsg),l.terminate(),this.worker=null;else{var i=this.transmuxer;i&&(i.destroy(),this.transmuxer=null)}var c=this.observer;c&&c.removeAllListeners(),this.observer=null},T.push=function(l,i,c,C,v,m,u,E,d,f){var s=this;d.transmuxing.start=self.performance.now();var a=this.transmuxer,b=this.worker,g=m?m.start:v.start,_=v.decryptdata,k=this.frag,H=!(k&&v.cc===k.cc),z=!(k&&d.level===k.level),Z=k?d.sn-k.sn:-1,G=this.part?d.part-this.part.index:1,B=!z&&(Z===1||Z===0&&G===1),te=self.performance.now();(z||Z||v.stats.parsing.start===0)&&(v.stats.parsing.start=te),m&&(G||!B)&&(m.stats.parsing.start=te);var ce=new K.TransmuxState(H,B,E,z,g);if(!B||H){N.logger.log("[transmuxer-interface, "+v.type+"]: Starting new transmux session for sn: "+d.sn+" p: "+d.part+" level: "+d.level+" id: "+d.id+` discontinuity: `+H+` trackSwitch: `+z+` contiguous: `+B+` accurateTimeOffset: `+E+` timeOffset: `+g);var pe=new K.TransmuxConfig(c,C,i,u,f);this.configureTransmuxer(pe)}if(this.frag=v,this.part=m,b)b.postMessage({cmd:"demux",data:l,decryptdata:_,chunkMeta:d,state:ce},l instanceof ArrayBuffer?[l]:[]);else if(a){var ye=a.push(l,_,d,ce);Object(K.isPromise)(ye)?ye.then(function(Ce){s.handleTransmuxComplete(Ce)}):this.handleTransmuxComplete(ye)}},T.flush=function(l){var i=this;l.transmuxing.start=self.performance.now();var c=this.transmuxer,C=this.worker;if(C)C.postMessage({cmd:"flush",chunkMeta:l});else if(c){var v=c.flush(l);Object(K.isPromise)(v)?v.then(function(m){i.handleFlushResult(m,l)}):this.handleFlushResult(v,l)}},T.handleFlushResult=function(l,i){var c=this;l.forEach(function(C){c.handleTransmuxComplete(C)}),this.onFlush(i)},T.onWorkerMessage=function(l){var i=l.data,c=this.hls;switch(i.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(i.data);break}case"flush":{this.onFlush(i.data);break}default:{i.data=i.data||{},i.data.frag=this.frag,i.data.id=this.id,c.trigger(i.event,i.data);break}}},T.configureTransmuxer=function(l){var i=this.worker,c=this.transmuxer;i?i.postMessage({cmd:"configure",config:l}):c&&c.configure(l)},T.handleTransmuxComplete=function(l){l.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(l)},S}()},"./src/demux/transmuxer-worker.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return O});var $=D("./src/demux/transmuxer.ts"),U=D("./src/events.ts"),I=D("./src/utils/logger.ts"),K=D("./node_modules/eventemitter3/index.js"),N=D.n(K);function O(w){var S=new K.EventEmitter,T=function(l,i){w.postMessage({event:l,data:i})};S.on(U.Events.FRAG_DECRYPTED,T),S.on(U.Events.ERROR,T),w.addEventListener("message",function(h){var l=h.data;switch(l.cmd){case"init":{var i=JSON.parse(l.config);w.transmuxer=new $.default(S,l.typeSupported,i,l.vendor,l.id),Object(I.enableLogs)(i.debug),T("init",null);break}case"configure":{w.transmuxer.configure(l.config);break}case"demux":{var c=w.transmuxer.push(l.data,l.decryptdata,l.chunkMeta,l.state);Object($.isPromise)(c)?c.then(function(m){L(w,m)}):L(w,c);break}case"flush":{var C=l.chunkMeta,v=w.transmuxer.flush(C);Object($.isPromise)(v)?v.then(function(m){A(w,m,C)}):A(w,v,C);break}default:break}})}function L(w,S){if(P(S.remuxResult))return;var T=[],h=S.remuxResult,l=h.audio,i=h.video;l&&x(T,l),i&&x(T,i),w.postMessage({event:"transmuxComplete",data:S},T)}function x(w,S){S.data1&&w.push(S.data1.buffer),S.data2&&w.push(S.data2.buffer)}function A(w,S,T){S.forEach(function(h){L(w,h)}),w.postMessage({event:"flush",data:T})}function P(w){return!w.audio&&!w.video&&!w.text&&!w.id3&&!w.initSegment}},"./src/demux/transmuxer.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return i}),D.d(Y,"isPromise",function(){return v}),D.d(Y,"TransmuxConfig",function(){return m}),D.d(Y,"TransmuxState",function(){return u});var $=D("./src/events.ts"),U=D("./src/errors.ts"),I=D("./src/crypt/decrypter.ts"),K=D("./src/demux/aacdemuxer.ts"),N=D("./src/demux/mp4demuxer.ts"),O=D("./src/demux/tsdemuxer.ts"),L=D("./src/demux/mp3demuxer.ts"),x=D("./src/remux/mp4-remuxer.ts"),A=D("./src/remux/passthrough-remuxer.ts"),P=D("./src/demux/chunk-cache.ts"),w=D("./src/utils/mp4-tools.ts"),S=D("./src/utils/logger.ts"),T;try{T=self.performance.now.bind(self.performance)}catch(E){S.logger.debug("Unable to use Performance API on this environment"),T=self.Date.now}var h=[{demux:O.default,remux:x.default},{demux:N.default,remux:A.default},{demux:K.default,remux:x.default},{demux:L.default,remux:x.default}],l=1024;h.forEach(function(E){var d=E.demux;l=Math.max(l,d.minProbeByteLength)});var i=function(){function E(f,s,a,b,g){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 P.default,this.observer=f,this.typeSupported=s,this.config=a,this.vendor=b,this.id=g}var d=E.prototype;return d.configure=function(s){this.transmuxConfig=s,this.decrypter&&this.decrypter.reset()},d.push=function(s,a,b,g){var _=this,k=b.transmuxing;k.executeStart=T();var H=new Uint8Array(s),z=this.cache,Z=this.config,G=this.currentTransmuxState,B=this.transmuxConfig;g&&(this.currentTransmuxState=g);var te=c(H,a);if(te&&te.method==="AES-128"){var ce=this.getDecrypter();if(Z.enableSoftwareAES){var pe=ce.softwareDecrypt(H,te.key.buffer,te.iv.buffer);if(!pe)return k.executeEnd=T(),C(b);H=new Uint8Array(pe)}else return this.decryptionPromise=ce.webCryptoDecrypt(H,te.key.buffer,te.iv.buffer).then(function(Pe){var Fe=_.push(Pe,null,b);return _.decryptionPromise=null,Fe}),this.decryptionPromise}var ye=g||G,Ce=ye.contiguous,_e=ye.discontinuity,le=ye.trackSwitch,se=ye.accurateTimeOffset,ge=ye.timeOffset,ie=B.audioCodec,q=B.videoCodec,Ee=B.defaultInitPts,Me=B.duration,Ne=B.initSegmentData;if((_e||le)&&this.resetInitSegment(Ne,ie,q,Me),_e&&this.resetInitialTimestamp(Ee),Ce||this.resetContiguity(),this.needsProbing(H,_e,le)){if(z.dataLength){var De=z.flush();H=Object(w.appendUint8Array)(De,H)}this.configureTransmuxer(H,B)}var Be=this.transmux(H,te,ge,se,b),Ae=this.currentTransmuxState;return Ae.contiguous=!0,Ae.discontinuity=!1,Ae.trackSwitch=!1,k.executeEnd=T(),Be},d.flush=function(s){var a=this,b=s.transmuxing;b.executeStart=T();var g=this.decrypter,_=this.cache,k=this.currentTransmuxState,H=this.decryptionPromise;if(H)return H.then(function(){return a.flush(s)});var z=[],Z=k.timeOffset;if(g){var G=g.flush();G&&z.push(this.push(G,null,s))}var B=_.dataLength;_.reset();var te=this.demuxer,ce=this.remuxer;if(!te||!ce)return B>=l&&this.observer.emit($.Events.ERROR,$.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),b.executeEnd=T(),[C(s)];var pe=te.flush(Z);return v(pe)?pe.then(function(ye){return a.flushRemux(z,ye,s),z}):(this.flushRemux(z,pe,s),z)},d.flushRemux=function(s,a,b){var g=a.audioTrack,_=a.avcTrack,k=a.id3Track,H=a.textTrack,z=this.currentTransmuxState,Z=z.accurateTimeOffset,G=z.timeOffset;S.logger.log("[transmuxer.ts]: Flushed fragment "+b.sn+(b.part>-1?" p: "+b.part:"")+" of level "+b.level);var B=this.remuxer.remux(g,_,k,H,G,Z,!0,this.id);s.push({remuxResult:B,chunkMeta:b}),b.transmuxing.executeEnd=T()},d.resetInitialTimestamp=function(s){var a=this.demuxer,b=this.remuxer;if(!a||!b)return;a.resetTimeStamp(s),b.resetTimeStamp(s)},d.resetContiguity=function(){var s=this.demuxer,a=this.remuxer;if(!s||!a)return;s.resetContiguity(),a.resetNextTimestamp()},d.resetInitSegment=function(s,a,b,g){var _=this.demuxer,k=this.remuxer;if(!_||!k)return;_.resetInitSegment(a,b,g),k.resetInitSegment(s,a,b)},d.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},d.transmux=function(s,a,b,g,_){var k;return a&&a.method==="SAMPLE-AES"?k=this.transmuxSampleAes(s,a,b,g,_):k=this.transmuxUnencrypted(s,b,g,_),k},d.transmuxUnencrypted=function(s,a,b,g){var _=this.demuxer.demux(s,a,!1,!this.config.progressive),k=_.audioTrack,H=_.avcTrack,z=_.id3Track,Z=_.textTrack,G=this.remuxer.remux(k,H,z,Z,a,b,!1,this.id);return{remuxResult:G,chunkMeta:g}},d.transmuxSampleAes=function(s,a,b,g,_){var k=this;return this.demuxer.demuxSampleAes(s,a,b).then(function(H){var z=k.remuxer.remux(H.audioTrack,H.avcTrack,H.id3Track,H.textTrack,b,g,!1,k.id);return{remuxResult:z,chunkMeta:_}})},d.configureTransmuxer=function(s,a){for(var b=this.config,g=this.observer,_=this.typeSupported,k=this.vendor,H=a.audioCodec,z=a.defaultInitPts,Z=a.duration,G=a.initSegmentData,B=a.videoCodec,te,ce=0,pe=h.length;ce0&&d!=null&&d.key!=null&&d.iv!==null&&d.method!=null&&(f=d),f}var C=function(d){return{remuxResult:{},chunkMeta:d}};function v(E){return"then"in E&&E.then instanceof Function}var m=function(d,f,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=d,this.videoCodec=f,this.initSegmentData=s,this.duration=a,this.defaultInitPts=b},u=function(d,f,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=d,this.contiguous=f,this.accurateTimeOffset=s,this.trackSwitch=a,this.timeOffset=b}},"./src/demux/tsdemuxer.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"discardEPB",function(){return C});var $=D("./src/demux/adts.ts"),U=D("./src/demux/mpegaudio.ts"),I=D("./src/demux/exp-golomb.ts"),K=D("./src/demux/id3.ts"),N=D("./src/demux/sample-aes.ts"),O=D("./src/events.ts"),L=D("./src/utils/mp4-tools.ts"),x=D("./src/utils/logger.ts"),A=D("./src/errors.ts"),P={video:1,audio:2,id3:3,text:4},w=function(){function v(u,E,d){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=u,this.config=E,this.typeSupported=d}v.probe=function(E){var d=v.syncOffset(E);return d<0?!1:(d&&x.logger.warn("MPEG2-TS detected but first sync word found @ offset "+d+", junk ahead ?"),!0)},v.syncOffset=function(E){for(var d=Math.min(1e3,E.length-3*188),f=0;f>4,ie=void 0;if(ge>1){if(ie=_e+5+E[_e+4],ie===_e+188)continue}else ie=_e+4;switch(se){case k:le&&(H&&(a=l(H))&&this.parseAVCPES(a,!1),H={data:[],size:0}),H&&(H.data.push(E.subarray(ie,_e+188)),H.size+=_e+188-ie);break;case z:le&&(G&&(a=l(G))&&(g.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),G={data:[],size:0}),G&&(G.data.push(E.subarray(ie,_e+188)),G.size+=_e+188-ie);break;case Z:le&&(B&&(a=l(B))&&this.parseID3PES(a),B={data:[],size:0}),B&&(B.data.push(E.subarray(ie,_e+188)),B.size+=_e+188-ie);break;case 0:le&&(ie+=E[ie]+1),pe=this._pmtId=T(E,ie);break;case pe:{le&&(ie+=E[ie]+1);var q=h(E,ie,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,f);k=q.avc,k>0&&(b.pid=k),z=q.audio,z>0&&(g.pid=z,g.isAAC=q.isAAC),Z=q.id3,Z>0&&(_.pid=Z),te&&!ce&&(x.logger.log("reparse from beginning"),te=!1,_e=Ce-188),ce=this.pmtParsed=!0;break}case 17:case 8191:break;default:te=!0;break}}else this.observer.emit(O.Events.ERROR,O.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});b.pesData=H,g.pesData=G,_.pesData=B;var Ee={audioTrack:g,avcTrack:b,id3Track:_,textTrack:this._txtTrack};return s&&this.extractRemainingSamples(Ee),Ee},m.flush=function(){var E=this.remainderData;this.remainderData=null;var d;return E?d=this.demux(E,-1,!1,!0):d={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(d),this.sampleAes?this.decrypt(d,this.sampleAes):d},m.extractRemainingSamples=function(E){var d=E.audioTrack,f=E.avcTrack,s=E.id3Track,a=f.pesData,b=d.pesData,g=s.pesData,_;a&&(_=l(a))?(this.parseAVCPES(_,!0),f.pesData=null):f.pesData=a,b&&(_=l(b))?(d.isAAC?this.parseAACPES(_):this.parseMPEGPES(_),d.pesData=null):(b!=null&&b.size&&x.logger.log("last AAC PES packet truncated,might overlap between fragments"),d.pesData=b),g&&(_=l(g))?(this.parseID3PES(_),s.pesData=null):s.pesData=g},m.demuxSampleAes=function(E,d,f){var s=this.demux(E,f,!0,!this.config.progressive),a=this.sampleAes=new N.default(this.observer,this.config,d);return this.decrypt(s,a)},m.decrypt=function(E,d){return new Promise(function(f){var s=E.audioTrack,a=E.avcTrack;s.samples&&s.isAAC?d.decryptAacSamples(s.samples,0,function(){a.samples?d.decryptAvcSamples(a.samples,0,0,function(){f(E)}):f(E)}):a.samples&&d.decryptAvcSamples(a.samples,0,0,function(){f(E)})})},m.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},m.parseAVCPES=function(E,d){var f=this,s=this._avcTrack,a=this.parseAVCNALu(E.data),b=!1,g=this.avcSample,_,k=!1;E.data=null,g&&a.length&&!s.audFound&&(i(g,s),g=this.avcSample=S(!1,E.pts,E.dts,"")),a.forEach(function(H){switch(H.type){case 1:{_=!0,g||(g=f.avcSample=S(!0,E.pts,E.dts,"")),b&&(g.debug+="NDR "),g.frame=!0;var z=H.data;if(k&&z.length>4){var Z=new I.default(z).readSliceType();(Z===2||Z===4||Z===7||Z===9)&&(g.key=!0)}break}case 5:_=!0,g||(g=f.avcSample=S(!0,E.pts,E.dts,"")),b&&(g.debug+="IDR "),g.key=!0,g.frame=!0;break;case 6:{_=!0,b&&g&&(g.debug+="SEI ");var G=new I.default(C(H.data));G.readUByte();for(var B=0,te=0,ce=!1,pe=0;!ce&&G.bytesAvailable>1;){B=0;do pe=G.readUByte(),B+=pe;while(pe===255);te=0;do pe=G.readUByte(),te+=pe;while(pe===255);if(B===4&&G.bytesAvailable!==0){ce=!0;var ye=G.readUByte();if(ye===181){var Ce=G.readUShort();if(Ce===49){var _e=G.readUInt();if(_e===1195456820){var le=G.readUByte();if(le===3){for(var se=G.readUByte(),ge=G.readUByte(),ie=31&se,q=[se,ge],Ee=0;Ee16){for(var Me=[],Ne=0;Ne<16;Ne++)Me.push(G.readUByte().toString(16)),(Ne===3||Ne===5||Ne===7||Ne===9)&&Me.push("-");for(var De=te-16,Be=new Uint8Array(De),Ae=0;Ae=0){var G={data:E.subarray(z,g-s-1),type:Z};b.push(G)}else{var B=this.getLastNalUnit();if(B&&(a&&g<=4-a&&(B.state&&(B.data=B.data.subarray(0,B.data.byteLength-a))),k=g-s-1,k>0)){var te=new Uint8Array(B.data.byteLength+k);te.set(B.data,0),te.set(E.subarray(0,k),B.data.byteLength),B.data=te,B.state=0}}g=0&&s>=0){var ce={data:E.subarray(z,d),type:Z,state:s};b.push(ce)}if(b.length===0){var pe=this.getLastNalUnit();if(pe){var ye=new Uint8Array(pe.data.byteLength+E.byteLength);ye.set(pe.data,0),ye.set(E,pe.data.byteLength),pe.data=ye}}return f.naluState=s,b},m.parseAACPES=function(E){var d=0,f=this._audioTrack,s=this.aacOverFlow,a=E.data;if(s){this.aacOverFlow=null;var b=s.sample.unit.byteLength,g=Math.min(s.missing,b),_=b-g;s.sample.unit.set(a.subarray(0,g),_),f.samples.push(s.sample),d=s.missing}var k,H;for(k=d,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)}u=a[0];var g=(u[0]<<16)+(u[1]<<8)+u[2];if(g===1){if(E=(u[4]<<8)+u[5],E&&E>v.size-6)return null;var _=u[7];_&192&&(f=(u[9]&14)*536870912+(u[10]&255)*4194304+(u[11]&254)*16384+(u[12]&255)*128+(u[13]&254)/2,_&64?(s=(u[14]&14)*536870912+(u[15]&255)*4194304+(u[16]&254)*16384+(u[17]&255)*128+(u[18]&254)/2,f-s>60*9e4&&(x.logger.warn(Math.round((f-s)/9e4)+"s delta between PTS and DTS, align them"),f=s)):s=f),d=u[8];var k=d+9;if(v.size<=k)return null;v.size-=k;for(var H=new Uint8Array(v.size),z=0,Z=a.length;zG){k-=G;continue}else u=u.subarray(k),G-=k,k=0;H.set(u,m),m+=G}return E&&(E-=d+3),{data:H,pts:f,dts:s,len:E}}return null}function i(v,m){if(v.units.length&&v.frame){if(v.pts===void 0){var u=m.samples,E=u.length;if(E){var d=u[E-1];v.pts=d.pts,v.dts=d.dts}else{m.dropped++;return}}m.samples.push(v)}v.debug.length&&x.logger.log(v.pts+"/"+v.dts+":"+v.debug)}function c(v,m){var u=v.length;if(u>0){if(m.pts>=v[u-1].pts)v.push(m);else for(var E=u-1;E>=0;E--)if(m.ptsf)return a;return 0}},{key:"maxAutoLevel",get:function(){var d=this.levels,f=this.autoLevelCapping,s;return f===-1&&d&&d.length?s=d.length-1:s=f,s}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(d){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,d)}},{key:"audioTracks",get:function(){var d=this.audioTrackController;return d?d.audioTracks:[]}},{key:"audioTrack",get:function(){var d=this.audioTrackController;return d?d.audioTrack:-1},set:function(d){var f=this.audioTrackController;f&&(f.audioTrack=d)}},{key:"subtitleTracks",get:function(){var d=this.subtitleTrackController;return d?d.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var d=this.subtitleTrackController;return d?d.subtitleTrack:-1},set:function(d){var f=this.subtitleTrackController;f&&(f.subtitleTrack=d)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var d=this.subtitleTrackController;return d?d.subtitleDisplay:!1},set:function(d){var f=this.subtitleTrackController;f&&(f.subtitleDisplay=d)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(d){this.config.lowLatencyMode=d}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return l.Events}},{key:"ErrorTypes",get:function(){return i.ErrorTypes}},{key:"ErrorDetails",get:function(){return i.ErrorDetails}},{key:"DefaultConfig",get:function(){return m.defaultConfig?m.defaultConfig:S.hlsDefaultConfig},set:function(d){m.defaultConfig=d}}]),m}();v.defaultConfig=void 0},"./src/is-supported.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"isSupported",function(){return I}),D.d(Y,"changeTypeSupported",function(){return K});var $=D("./src/utils/mediasource-helper.ts");function U(){return self.SourceBuffer||self.WebKitSourceBuffer}function I(){var N=Object($.getMediaSource)();if(!N)return!1;var O=U(),L=N&&typeof N.isTypeSupported=="function"&&N.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),x=!O||O.prototype&&typeof O.prototype.appendBuffer=="function"&&typeof O.prototype.remove=="function";return!!L&&!!x}function K(){var N,O=U();return typeof(O==null||((N=O.prototype)===null||N===void 0)?void 0:N.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return w}),D.d(Y,"LoadError",function(){return T});var $=D("./src/polyfills/number.ts"),U=D("./src/errors.ts");function I(h,l){h.prototype=Object.create(l.prototype),h.prototype.constructor=h,x(h,l)}function K(h){var l=typeof Map=="function"?new Map:void 0;return K=function(c){if(c===null||!L(c))return c;if(typeof c!="function")throw new TypeError("Super expression must either be null or a function");if(typeof l!="undefined"){if(l.has(c))return l.get(c);l.set(c,C)}function C(){return N(c,arguments,A(this).constructor)}return C.prototype=Object.create(c.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),x(C,c)},K(h)}function N(h,l,i){return O()?N=Reflect.construct:N=function(C,v,m){var u=[null];u.push.apply(u,v);var E=Function.bind.apply(C,u),d=new E;return m&&x(d,m.prototype),d},N.apply(null,arguments)}function O(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(h){return!1}}function L(h){return Function.toString.call(h).indexOf("[native code]")!==-1}function x(h,l){return x=Object.setPrototypeOf||function(c,C){return c.__proto__=C,c},x(h,l)}function A(h){return A=Object.setPrototypeOf?Object.getPrototypeOf:function(i){return i.__proto__||Object.getPrototypeOf(i)},A(h)}var P=Math.pow(2,17),w=function(){function h(i){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=i}var l=h.prototype;return l.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},l.abort=function(){this.loader&&this.loader.abort()},l.load=function(c,C){var v=this,m=c.url;if(!m)return Promise.reject(new T({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,networkDetails:null},"Fragment does not have a "+(m?"part list":"url")));this.abort();var u=this.config,E=u.fLoader,d=u.loader;return new Promise(function(f,s){v.loader&&v.loader.destroy();var a=v.loader=c.loader=E?new E(u):new d(u),b=S(c),g={timeout:u.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:u.fragLoadingMaxRetryTimeout,highWaterMark:P};c.stats=a.stats,a.load(b,g,{onSuccess:function(k,H,z,Z){v.resetLoader(c,a),f({frag:c,part:null,payload:k.data,networkDetails:Z})},onError:function(k,H,z){v.resetLoader(c,a),s(new T({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,response:k,networkDetails:z}))},onAbort:function(k,H,z){v.resetLoader(c,a),s(new T({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:c,networkDetails:z}))},onTimeout:function(k,H,z){v.resetLoader(c,a),s(new T({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:c,networkDetails:z}))},onProgress:function(k,H,z,Z){C&&C({frag:c,part:null,payload:z,networkDetails:Z})}})})},l.loadPart=function(c,C,v){var m=this;this.abort();var u=this.config,E=u.fLoader,d=u.loader;return new Promise(function(f,s){m.loader&&m.loader.destroy();var a=m.loader=c.loader=E?new E(u):new d(u),b=S(c,C),g={timeout:u.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:u.fragLoadingMaxRetryTimeout,highWaterMark:P};C.stats=a.stats,a.load(b,g,{onSuccess:function(k,H,z,Z){m.resetLoader(c,a),m.updateStatsFromPart(c,C);var G={frag:c,part:C,payload:k.data,networkDetails:Z};v(G),f(G)},onError:function(k,H,z){m.resetLoader(c,a),s(new T({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,part:C,response:k,networkDetails:z}))},onAbort:function(k,H,z){c.stats.aborted=C.stats.aborted,m.resetLoader(c,a),s(new T({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:c,part:C,networkDetails:z}))},onTimeout:function(k,H,z){m.resetLoader(c,a),s(new T({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:c,part:C,networkDetails:z}))}})})},l.updateStatsFromPart=function(c,C){var v=c.stats,m=C.stats,u=m.total;if(v.loaded+=m.loaded,u){var E=Math.round(c.duration/C.duration),d=Math.min(Math.round(v.loaded/u),E),f=E-d,s=f*Math.round(v.loaded/d);v.total=v.loaded+s}else v.total=Math.max(v.loaded,v.total);var a=v.loading,b=m.loading;a.start?a.first+=b.first-b.start:(a.start=b.start,a.first=b.first),a.end=b.end},l.resetLoader=function(c,C){c.loader=null,this.loader===C&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),C.destroy()},h}();function S(h,l){l===void 0&&(l=null);var i=l||h,c={frag:h,part:l,responseType:"arraybuffer",url:i.url,headers:{},rangeStart:0,rangeEnd:0},C=i.byteRangeStartOffset,v=i.byteRangeEndOffset;return Object($.isFiniteNumber)(C)&&Object($.isFiniteNumber)(v)&&(c.rangeStart=C,c.rangeEnd=v),c}var T=function(h){I(l,h);function l(i){for(var c,C=arguments.length,v=new Array(C>1?C-1:0),m=1;m>8*(15-u)&255;return m},c.setDecryptDataFromLevelKey=function(v,m){var u=v;return(v==null?void 0:v.method)==="AES-128"&&v.uri&&!v.iv&&(u=N.LevelKey.fromURI(v.uri),u.method=v.method,u.iv=this.createInitializationVector(m),u.keyFormat="identity"),u},c.setElementaryStreamInfo=function(v,m,u,E,d,f){f===void 0&&(f=!1);var s=this.elementaryStreams,a=s[v];if(!a){s[v]={startPTS:m,endPTS:u,startDTS:E,endDTS:d,partial:f};return}a.startPTS=Math.min(a.startPTS,m),a.endPTS=Math.max(a.endPTS,u),a.startDTS=Math.min(a.startDTS,E),a.endDTS=Math.max(a.endDTS,d)},c.clearElementaryStreamInfo=function(){var v=this.elementaryStreams;v[w.AUDIO]=null,v[w.VIDEO]=null,v[w.AUDIOVIDEO]=null},P(i,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var v=this.sn;typeof v!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&K.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),v=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,v)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object($.isFiniteNumber)(this.programDateTime))return null;var v=Object($.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+v*1e3}},{key:"encrypted",get:function(){var v;return!!((v=this.decryptdata)!==null&&v!==void 0&&v.keyFormat&&this.decryptdata.uri)}}]),i}(S),h=function(l){L(i,l);function i(c,C,v,m,u){var E;E=l.call(this,v)||this,E.fragOffset=0,E.duration=0,E.gap=!1,E.independent=!1,E.relurl=void 0,E.fragment=void 0,E.index=void 0,E.stats=new O.LoadStats,E.duration=c.decimalFloatingPoint("DURATION"),E.gap=c.bool("GAP"),E.independent=c.bool("INDEPENDENT"),E.relurl=c.enumeratedString("URI"),E.fragment=C,E.index=m;var d=c.enumeratedString("BYTERANGE");return d&&E.setByteRange(d,u),u&&(E.fragOffset=u.fragOffset+u.duration),E}return P(i,[{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)}}]),i}(S)},"./src/loader/key-loader.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return K});var $=D("./src/events.ts"),U=D("./src/errors.ts"),I=D("./src/utils/logger.ts"),K=function(){function N(L){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=L,this._registerListeners()}var O=N.prototype;return O._registerListeners=function(){this.hls.on($.Events.KEY_LOADING,this.onKeyLoading,this)},O._unregisterListeners=function(){this.hls.off($.Events.KEY_LOADING,this.onKeyLoading)},O.destroy=function(){this._unregisterListeners();for(var x in this.loaders){var A=this.loaders[x];A&&A.destroy()}this.loaders={}},O.onKeyLoading=function(x,A){var P=A.frag,w=P.type,S=this.loaders[w];if(!P.decryptdata){I.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var T=P.decryptdata.uri;if(T!==this.decrypturl||this.decryptkey===null){var h=this.hls.config;if(S&&(I.logger.warn("abort previous key loader for type:"+w),S.abort()),!T){I.logger.warn("key uri is falsy");return}var l=h.loader,i=P.loader=this.loaders[w]=new l(h);this.decrypturl=T,this.decryptkey=null;var c={url:T,frag:P,responseType:"arraybuffer"},C={timeout:h.fragLoadingTimeOut,maxRetry:0,retryDelay:h.fragLoadingRetryDelay,maxRetryDelay:h.fragLoadingMaxRetryTimeout,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};i.load(c,C,v)}else this.decryptkey&&(P.decryptdata.key=this.decryptkey,this.hls.trigger($.Events.KEY_LOADED,{frag:P}))},O.loadsuccess=function(x,A,P){var w=P.frag;if(!w.decryptdata){I.logger.error("after key load, decryptdata unset");return}this.decryptkey=w.decryptdata.key=new Uint8Array(x.data),w.loader=null,delete this.loaders[w.type],this.hls.trigger($.Events.KEY_LOADED,{frag:w})},O.loaderror=function(x,A){var P=A.frag,w=P.loader;w&&w.abort(),delete this.loaders[P.type],this.hls.trigger($.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:P,response:x})},O.loadtimeout=function(x,A){var P=A.frag,w=P.loader;w&&w.abort(),delete this.loaders[P.type],this.hls.trigger($.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:P})},N}()},"./src/loader/level-details.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"LevelDetails",function(){return N});var $=D("./src/polyfills/number.ts");function U(O,L){for(var x=0;xA.endSN||P>0||P===0&&w>0,this.updated||this.advanced?this.misses=Math.floor(A.misses*.6):this.misses=A.misses+1,this.availabilityDelay=A.availabilityDelay},I(O,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object($.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||K}},{key:"drift",get:function(){var A=this.driftEndTime-this.driftStartTime;if(A>0){var P=this.driftEnd-this.driftStart;return P*1e3/A}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var A;return(A=this.fragments)!==null&&A!==void 0&&A.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 A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),O}()},"./src/loader/level-key.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"LevelKey",function(){return N});var $=D("./node_modules/url-toolkit/src/url-toolkit.js"),U=D.n($);function I(O,L){for(var x=0;x2){var s=f.shift()+".";return s+=parseInt(f.shift()).toString(16),s+=("000"+parseInt(f.shift()).toString(16)).substr(-4),s}return d},u.resolve=function(d,f){return U.buildAbsoluteURL(f,d,{alwaysNormalize:!0})},u.parseMasterPlaylist=function(d,f){var s=[],a={},b=!1;P.lastIndex=0;for(var g;(g=P.exec(d))!=null;)if(g[1]){var _=new L.AttrList(g[1]),k={attrs:_,bitrate:_.decimalInteger("AVERAGE-BANDWIDTH")||_.decimalInteger("BANDWIDTH"),name:_.NAME,url:u.resolve(g[2],f)},H=_.decimalResolution("RESOLUTION");H&&(k.width=H.width,k.height=H.height),c((_.CODECS||"").split(/[ ,]+/).filter(function(Z){return Z}),k),k.videoCodec&&k.videoCodec.indexOf("avc1")!==-1&&(k.videoCodec=u.convertAVC1ToAVCOTI(k.videoCodec)),s.push(k)}else if(g[3]){var z=new L.AttrList(g[3]);z["DATA-ID"]&&(b=!0,a[z["DATA-ID"]]=z)}return{levels:s,sessionData:b?a:null}},u.parseMasterPlaylistMedia=function(d,f,s,a){a===void 0&&(a=[]);var b,g=[],_=0;for(w.lastIndex=0;(b=w.exec(d))!==null;){var k=new L.AttrList(b[1]);if(k.TYPE===s){var H={attrs:k,bitrate:0,id:_++,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?u.resolve(k.URI,f):""};if(a.length){var z=u.findGroup(a,H.groupId)||a[0];C(H,z,"audioCodec"),C(H,z,"textCodec")}g.push(H)}}return g},u.parseLevelPlaylist=function(d,f,s,a,b){var g=new N.LevelDetails(f),_=g.fragments,k=null,H=0,z=0,Z=0,G=0,B=null,te=new K.Fragment(a,f),ce,pe,ye,Ce=-1,_e=!1;for(S.lastIndex=0,g.m3u8=d;(ce=S.exec(d))!==null;){_e&&(_e=!1,te=new K.Fragment(a,f),te.start=Z,te.sn=H,te.cc=G,te.level=s,k&&(te.initSegment=k,te.rawProgramDateTime=k.rawProgramDateTime));var le=ce[1];if(le){te.duration=parseFloat(le);var se=(" "+ce[2]).slice(1);te.title=se||null,te.tagList.push(se?["INF",le,se]:["INF",le])}else if(ce[3])Object($.isFiniteNumber)(te.duration)&&(te.start=Z,ye&&(te.levelkey=ye),te.sn=H,te.level=s,te.cc=G,te.urlId=b,_.push(te),te.relurl=(" "+ce[3]).slice(1),m(te,B),B=te,Z+=te.duration,H++,z=0,_e=!0);else if(ce[4]){var ge=(" "+ce[4]).slice(1);B?te.setByteRange(ge,B):te.setByteRange(ge)}else if(ce[5])te.rawProgramDateTime=(" "+ce[5]).slice(1),te.tagList.push(["PROGRAM-DATE-TIME",te.rawProgramDateTime]),Ce===-1&&(Ce=_.length);else{if(ce=ce[0].match(T),!ce){x.logger.warn("No matches on slow regex match for level playlist!");continue}for(pe=1;pe-1){x.logger.warn("Keyformat "+lt+" is not supported from the manifest");continue}else if(lt!=="identity")continue;Fe&&(ye=O.LevelKey.fromURL(f,ze),ze&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Fe)>=0&&(ye.method=Fe,ye.keyFormat=lt,Oe&&(ye.keyID=Oe),He&&(ye.keyFormatVersions=He),ye.iv=qe));break}case"START":{var ft=new L.AttrList(q),nt=ft.decimalFloatingPoint("TIME-OFFSET");Object($.isFiniteNumber)(nt)&&(g.startTimeOffset=nt);break}case"MAP":{var St=new L.AttrList(q);te.relurl=St.URI,St.BYTERANGE&&te.setByteRange(St.BYTERANGE),te.level=s,te.sn="initSegment",ye&&(te.levelkey=ye),te.initSegment=null,k=te,_e=!0;break}case"SERVER-CONTROL":{var ht=new L.AttrList(q);g.canBlockReload=ht.bool("CAN-BLOCK-RELOAD"),g.canSkipUntil=ht.optionalFloat("CAN-SKIP-UNTIL",0),g.canSkipDateRanges=g.canSkipUntil>0&&ht.bool("CAN-SKIP-DATERANGES"),g.partHoldBack=ht.optionalFloat("PART-HOLD-BACK",0),g.holdBack=ht.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var yt=new L.AttrList(q);g.partTarget=yt.decimalFloatingPoint("PART-TARGET");break}case"PART":{var ke=g.partList;ke||(ke=g.partList=[]);var Pt=z>0?ke[ke.length-1]:void 0,Tt=z++,Ue=new K.Part(new L.AttrList(q),te,f,Tt,Pt);ke.push(Ue),te.duration+=Ue.duration;break}case"PRELOAD-HINT":{var Ze=new L.AttrList(q);g.preloadHint=Ze;break}case"RENDITION-REPORT":{var xe=new L.AttrList(q);g.renditionReports=g.renditionReports||[],g.renditionReports.push(xe);break}default:x.logger.warn("line parsed but not handled: "+ce);break}}}B&&!B.relurl?(_.pop(),Z-=B.duration,g.partList&&(g.fragmentHint=B)):g.partList&&(m(te,B),te.cc=G,g.fragmentHint=te);var fe=_.length,be=_[0],ne=_[fe-1];if(Z+=g.skippedSegments*g.targetduration,Z>0&&fe&&ne){g.averagetargetduration=Z/fe;var re=ne.sn;g.endSN=re!=="initSegment"?re:0,be&&(g.startCC=be.cc,be.initSegment||g.fragments.every(function(ae){return ae.relurl&&l(ae.relurl)})&&(x.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),te=new K.Fragment(a,f),te.relurl=ne.relurl,te.level=s,te.sn="initSegment",be.initSegment=te,g.needSidxRanges=!0))}else g.endSN=0,g.startCC=0;return g.fragmentHint&&(Z+=g.fragmentHint.duration),g.totalduration=Z,g.endCC=G,Ce>0&&v(_,Ce),g},u}();function c(u,E){["video","audio","text"].forEach(function(d){var f=u.filter(function(a){return Object(A.isCodecType)(a,d)});if(f.length){var s=f.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});E[d+"Codec"]=s.length>0?s[0]:f[0],u=u.filter(function(a){return f.indexOf(a)===-1})}}),E.unknownCodecs=u}function C(u,E,d){var f=E[d];f&&(u[d]=f)}function v(u,E){for(var d=u[E],f=E;f--;){var s=u[f];if(!s)return;s.programDateTime=d.programDateTime-s.duration*1e3,d=s}}function m(u,E){u.rawProgramDateTime?u.programDateTime=Date.parse(u.rawProgramDateTime):E!=null&&E.programDateTime&&(u.programDateTime=E.endProgramDateTime),Object($.isFiniteNumber)(u.programDateTime)||(u.programDateTime=null,u.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(oe,Y,D){"use strict";D.r(Y);var $=D("./src/polyfills/number.ts"),U=D("./src/events.ts"),I=D("./src/errors.ts"),K=D("./src/utils/logger.ts"),N=D("./src/utils/mp4-tools.ts"),O=D("./src/loader/m3u8-parser.ts"),L=D("./src/types/loader.ts"),x=D("./src/utils/attr-list.ts");function A(S){var T=S.type;switch(T){case L.PlaylistContextType.AUDIO_TRACK:return L.PlaylistLevelType.AUDIO;case L.PlaylistContextType.SUBTITLE_TRACK:return L.PlaylistLevelType.SUBTITLE;default:return L.PlaylistLevelType.MAIN}}function P(S,T){var h=S.url;return(h===void 0||h.indexOf("data:")===0)&&(h=T.url),h}var w=function(){function S(h){this.hls=void 0,this.loaders=Object.create(null),this.hls=h,this.registerListeners()}var T=S.prototype;return T.registerListeners=function(){var l=this.hls;l.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(U.Events.LEVEL_LOADING,this.onLevelLoading,this),l.on(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),l.on(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},T.unregisterListeners=function(){var l=this.hls;l.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(U.Events.LEVEL_LOADING,this.onLevelLoading,this),l.off(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),l.off(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},T.createInternalLoader=function(l){var i=this.hls.config,c=i.pLoader,C=i.loader,v=c||C,m=new v(i);return l.loader=m,this.loaders[l.type]=m,m},T.getInternalLoader=function(l){return this.loaders[l.type]},T.resetInternalLoader=function(l){this.loaders[l]&&delete this.loaders[l]},T.destroyInternalLoaders=function(){for(var l in this.loaders){var i=this.loaders[l];i&&i.destroy(),this.resetInternalLoader(l)}},T.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},T.onManifestLoading=function(l,i){var c=i.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:L.PlaylistContextType.MANIFEST,url:c,deliveryDirectives:null})},T.onLevelLoading=function(l,i){var c=i.id,C=i.level,v=i.url,m=i.deliveryDirectives;this.load({id:c,groupId:null,level:C,responseType:"text",type:L.PlaylistContextType.LEVEL,url:v,deliveryDirectives:m})},T.onAudioTrackLoading=function(l,i){var c=i.id,C=i.groupId,v=i.url,m=i.deliveryDirectives;this.load({id:c,groupId:C,level:null,responseType:"text",type:L.PlaylistContextType.AUDIO_TRACK,url:v,deliveryDirectives:m})},T.onSubtitleTrackLoading=function(l,i){var c=i.id,C=i.groupId,v=i.url,m=i.deliveryDirectives;this.load({id:c,groupId:C,level:null,responseType:"text",type:L.PlaylistContextType.SUBTITLE_TRACK,url:v,deliveryDirectives:m})},T.load=function(l){var i,c=this.hls.config,C=this.getInternalLoader(l);if(C){var v=C.context;if(v&&v.url===l.url){K.logger.trace("[playlist-loader]: playlist request ongoing");return}K.logger.log("[playlist-loader]: aborting previous loader for type: "+l.type),C.abort()}var m,u,E,d;switch(l.type){case L.PlaylistContextType.MANIFEST:m=c.manifestLoadingMaxRetry,u=c.manifestLoadingTimeOut,E=c.manifestLoadingRetryDelay,d=c.manifestLoadingMaxRetryTimeout;break;case L.PlaylistContextType.LEVEL:case L.PlaylistContextType.AUDIO_TRACK:case L.PlaylistContextType.SUBTITLE_TRACK:m=0,u=c.levelLoadingTimeOut;break;default:m=c.levelLoadingMaxRetry,u=c.levelLoadingTimeOut,E=c.levelLoadingRetryDelay,d=c.levelLoadingMaxRetryTimeout;break}if(C=this.createInternalLoader(l),(i=l.deliveryDirectives)!==null&&i!==void 0&&i.part){var f;if(l.type===L.PlaylistContextType.LEVEL&&l.level!==null?f=this.hls.levels[l.level].details:l.type===L.PlaylistContextType.AUDIO_TRACK&&l.id!==null?f=this.hls.audioTracks[l.id].details:l.type===L.PlaylistContextType.SUBTITLE_TRACK&&l.id!==null&&(f=this.hls.subtitleTracks[l.id].details),f){var s=f.partTarget,a=f.targetduration;s&&a&&(u=Math.min(Math.max(s*3,a*.8)*1e3,u))}}var b={timeout:u,maxRetry:m,retryDelay:E,maxRetryDelay:d,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};C.load(l,b,g)},T.loadsuccess=function(l,i,c,C){if(C===void 0&&(C=null),c.isSidxRequest){this.handleSidxRequest(l,c),this.handlePlaylistLoaded(l,i,c,C);return}this.resetInternalLoader(c.type);var v=l.data;if(v.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(l,c,"no EXTM3U delimiter",C);return}i.parsing.start=performance.now(),v.indexOf("#EXTINF:")>0||v.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(l,i,c,C):this.handleMasterPlaylist(l,i,c,C)},T.loaderror=function(l,i,c){c===void 0&&(c=null),this.handleNetworkError(i,c,!1,l)},T.loadtimeout=function(l,i,c){c===void 0&&(c=null),this.handleNetworkError(i,c,!0)},T.handleMasterPlaylist=function(l,i,c,C){var v=this.hls,m=l.data,u=P(l,c),E=O.default.parseMasterPlaylist(m,u),d=E.levels,f=E.sessionData;if(!d.length){this.handleManifestParsingError(l,c,"no level found in manifest",C);return}var s=d.map(function(H){return{id:H.attrs.AUDIO,audioCodec:H.audioCodec}}),a=d.map(function(H){return{id:H.attrs.SUBTITLES,textCodec:H.textCodec}}),b=O.default.parseMasterPlaylistMedia(m,u,"AUDIO",s),g=O.default.parseMasterPlaylistMedia(m,u,"SUBTITLES",a),_=O.default.parseMasterPlaylistMedia(m,u,"CLOSED-CAPTIONS");if(b.length){var k=b.some(function(H){return!H.url});!k&&d[0].audioCodec&&!d[0].attrs.AUDIO&&(K.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 x.AttrList({}),bitrate:0,url:""}))}v.trigger(U.Events.MANIFEST_LOADED,{levels:d,audioTracks:b,subtitles:g,captions:_,url:u,stats:i,networkDetails:C,sessionData:f})},T.handleTrackOrLevelPlaylist=function(l,i,c,C){var v=this.hls,m=c.id,u=c.level,E=c.type,d=P(l,c),f=Object($.isFiniteNumber)(m)?m:0,s=Object($.isFiniteNumber)(u)?u:f,a=A(c),b=O.default.parseLevelPlaylist(l.data,d,s,a,f);if(!b.fragments.length){v.trigger(U.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:d,reason:"no fragments found in level",level:typeof c.level=="number"?c.level:void 0});return}if(E===L.PlaylistContextType.MANIFEST){var g={attrs:new x.AttrList({}),bitrate:0,details:b,name:"",url:d};v.trigger(U.Events.MANIFEST_LOADED,{levels:[g],audioTracks:[],url:d,stats:i,networkDetails:C,sessionData:null})}if(i.parsing.end=performance.now(),b.needSidxRanges){var _,k=(_=b.fragments[0].initSegment)===null||_===void 0?void 0:_.url;this.load({url:k,isSidxRequest:!0,type:E,level:u,levelDetails:b,id:m,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}c.levelDetails=b,this.handlePlaylistLoaded(l,i,c,C)},T.handleSidxRequest=function(l,i){var c=Object(N.parseSegmentIndex)(new Uint8Array(l.data));if(!c)return;var C=c.references,v=i.levelDetails;C.forEach(function(m,u){var E=m.info,d=v.fragments[u];d.byteRange.length===0&&d.setByteRange(String(1+E.end-E.start)+"@"+String(E.start)),d.initSegment&&d.initSegment.setByteRange(String(c.moovEndOffset)+"@0")})},T.handleManifestParsingError=function(l,i,c,C){this.hls.trigger(U.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:i.type===L.PlaylistContextType.MANIFEST,url:l.url,reason:c,response:l,context:i,networkDetails:C})},T.handleNetworkError=function(l,i,c,C){c===void 0&&(c=!1),K.logger.warn("[playlist-loader]: A network "+(c?"timeout":"error")+" occurred while loading "+l.type+" level: "+l.level+" id: "+l.id+' group-id: "'+l.groupId+'"');var v=I.ErrorDetails.UNKNOWN,m=!1,u=this.getInternalLoader(l);switch(l.type){case L.PlaylistContextType.MANIFEST:v=c?I.ErrorDetails.MANIFEST_LOAD_TIMEOUT:I.ErrorDetails.MANIFEST_LOAD_ERROR,m=!0;break;case L.PlaylistContextType.LEVEL:v=c?I.ErrorDetails.LEVEL_LOAD_TIMEOUT:I.ErrorDetails.LEVEL_LOAD_ERROR,m=!1;break;case L.PlaylistContextType.AUDIO_TRACK:v=c?I.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:I.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,m=!1;break;case L.PlaylistContextType.SUBTITLE_TRACK:v=c?I.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:I.ErrorDetails.SUBTITLE_LOAD_ERROR,m=!1;break}u&&this.resetInternalLoader(l.type);var E={type:I.ErrorTypes.NETWORK_ERROR,details:v,fatal:m,url:l.url,loader:u,context:l,networkDetails:i};C&&(E.response=C),this.hls.trigger(U.Events.ERROR,E)},T.handlePlaylistLoaded=function(l,i,c,C){var v=c.type,m=c.level,u=c.id,E=c.groupId,d=c.loader,f=c.levelDetails,s=c.deliveryDirectives;if(!(f!=null&&f.targetduration)){this.handleManifestParsingError(l,c,"invalid target duration",C);return}if(!d)return;f.live&&(d.getCacheAge&&(f.ageHeader=d.getCacheAge()||0),(!d.getCacheAge||isNaN(f.ageHeader))&&(f.ageHeader=0));switch(v){case L.PlaylistContextType.MANIFEST:case L.PlaylistContextType.LEVEL:this.hls.trigger(U.Events.LEVEL_LOADED,{details:f,level:m||0,id:u||0,stats:i,networkDetails:C,deliveryDirectives:s});break;case L.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(U.Events.AUDIO_TRACK_LOADED,{details:f,id:u||0,groupId:E||"",stats:i,networkDetails:C,deliveryDirectives:s});break;case L.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(U.Events.SUBTITLE_TRACK_LOADED,{details:f,id:u||0,groupId:E||"",stats:i,networkDetails:C,deliveryDirectives:s});break}},S}();Y.default=w},"./src/polyfills/number.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"isFiniteNumber",function(){return $}),D.d(Y,"MAX_SAFE_INTEGER",function(){return U});var $=Number.isFinite||function(I){return typeof I=="number"&&isFinite(I)},U=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(oe,Y,D){"use strict";D.r(Y);var $=function(){function U(){}return U.getSilentFrame=function(K,N){switch(K){case"mp4a.40.2":if(N===1)return new Uint8Array([0,200,0,128,35,128]);if(N===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(N===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(N===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(N===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(N===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(N===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(N===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(N===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},U}();Y.default=$},"./src/remux/mp4-generator.ts":function(oe,Y,D){"use strict";D.r(Y);var $=Math.pow(2,32)-1,U=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 N;for(N in I.types)I.types.hasOwnProperty(N)&&(I.types[N]=[N.charCodeAt(0),N.charCodeAt(1),N.charCodeAt(2),N.charCodeAt(3)]);var O=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),L=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:L};var x=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),A=new Uint8Array([0,0,0,0,0,0,0,0]);I.STTS=I.STSC=I.STCO=A,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 P=new Uint8Array([105,115,111,109]),w=new Uint8Array([97,118,99,49]),S=new Uint8Array([0,0,0,1]);I.FTYP=I.box(I.types.ftyp,P,S,P,w),I.DINF=I.box(I.types.dinf,I.box(I.types.dref,x))},I.box=function(N){for(var O=8,L=arguments.length,x=new Array(L>1?L-1:0),A=1;A>24&255,S[1]=O>>16&255,S[2]=O>>8&255,S[3]=O&255,S.set(N,4),P=0,O=8;P>24&255,N>>16&255,N>>8&255,N&255,L>>24,L>>16&255,L>>8&255,L&255,x>>24,x>>16&255,x>>8&255,x&255,85,196,0,0]))},I.mdia=function(N){return I.box(I.types.mdia,I.mdhd(N.timescale,N.duration),I.hdlr(N.type),I.minf(N))},I.mfhd=function(N){return I.box(I.types.mfhd,new Uint8Array([0,0,0,0,N>>24,N>>16&255,N>>8&255,N&255]))},I.minf=function(N){return N.type==="audio"?I.box(I.types.minf,I.box(I.types.smhd,I.SMHD),I.DINF,I.stbl(N)):I.box(I.types.minf,I.box(I.types.vmhd,I.VMHD),I.DINF,I.stbl(N))},I.moof=function(N,O,L){return I.box(I.types.moof,I.mfhd(N),I.traf(L,O))},I.moov=function(N){for(var O=N.length,L=[];O--;)L[O]=I.trak(N[O]);return I.box.apply(null,[I.types.moov,I.mvhd(N[0].timescale,N[0].duration)].concat(L).concat(I.mvex(N)))},I.mvex=function(N){for(var O=N.length,L=[];O--;)L[O]=I.trex(N[O]);return I.box.apply(null,[I.types.mvex].concat(L))},I.mvhd=function(N,O){O*=N;var L=Math.floor(O/($+1)),x=Math.floor(O%($+1)),A=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,N>>24&255,N>>16&255,N>>8&255,N&255,L>>24,L>>16&255,L>>8&255,L&255,x>>24,x>>16&255,x>>8&255,x&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return I.box(I.types.mvhd,A)},I.sdtp=function(N){var O=N.samples||[],L=new Uint8Array(4+O.length),x,A;for(x=0;x>>8&255),O.push(P&255),O=O.concat(Array.prototype.slice.call(A));for(x=0;x>>8&255),L.push(P&255),L=L.concat(Array.prototype.slice.call(A));var w=I.box(I.types.avcC,new Uint8Array([1,O[3],O[4],O[5],252|3,224|N.sps.length].concat(O).concat([N.pps.length]).concat(L))),S=N.width,T=N.height,h=N.pixelRatio[0],l=N.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,S>>8&255,S&255,T>>8&255,T&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]),w,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,l>>24,l>>16&255,l>>8&255,l&255])))},I.esds=function(N){var O=N.config.length;return new Uint8Array([0,0,0,0,3,23+O,0,1,0,4,15+O,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([O]).concat(N.config).concat([6,1,2]))},I.mp4a=function(N){var O=N.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,N.channelCount,0,16,0,0,0,0,O>>8&255,O&255,0,0]),I.box(I.types.esds,I.esds(N)))},I.mp3=function(N){var O=N.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,N.channelCount,0,16,0,0,0,0,O>>8&255,O&255,0,0]))},I.stsd=function(N){return N.type==="audio"?!N.isAAC&&N.codec==="mp3"?I.box(I.types.stsd,I.STSD,I.mp3(N)):I.box(I.types.stsd,I.STSD,I.mp4a(N)):I.box(I.types.stsd,I.STSD,I.avc1(N))},I.tkhd=function(N){var O=N.id,L=N.duration*N.timescale,x=N.width,A=N.height,P=Math.floor(L/($+1)),w=Math.floor(L%($+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,P>>24,P>>16&255,P>>8&255,P&255,w>>24,w>>16&255,w>>8&255,w&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,x>>8&255,x&255,0,0,A>>8&255,A&255,0,0]))},I.traf=function(N,O){var L=I.sdtp(N),x=N.id,A=Math.floor(O/($+1)),P=Math.floor(O%($+1));return I.box(I.types.traf,I.box(I.types.tfhd,new Uint8Array([0,0,0,0,x>>24,x>>16&255,x>>8&255,x&255])),I.box(I.types.tfdt,new Uint8Array([1,0,0,0,A>>24,A>>16&255,A>>8&255,A&255,P>>24,P>>16&255,P>>8&255,P&255])),I.trun(N,L.length+16+20+8+16+8+8),L)},I.trak=function(N){return N.duration=N.duration||4294967295,I.box(I.types.trak,I.tkhd(N),I.mdia(N))},I.trex=function(N){var O=N.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(N,O){var L=N.samples||[],x=L.length,A=12+16*x,P=new Uint8Array(A),w,S,T,h,l,i;for(O+=8+A,P.set([0,0,15,1,x>>>24&255,x>>>16&255,x>>>8&255,x&255,O>>>24&255,O>>>16&255,O>>>8&255,O&255],0),w=0;w>>24&255,T>>>16&255,T>>>8&255,T&255,h>>>24&255,h>>>16&255,h>>>8&255,h&255,l.isLeading<<2|l.dependsOn,l.isDependedOn<<6|l.hasRedundancy<<4|l.paddingValue<<1|l.isNonSync,l.degradPrio&240<<8,l.degradPrio&15,i>>>24&255,i>>>16&255,i>>>8&255,i&255],12+16*w);return I.box(I.types.trun,P)},I.initSegment=function(N){I.types||I.init();var O=I.moov(N),L=new Uint8Array(I.FTYP.byteLength+O.byteLength);return L.set(I.FTYP),L.set(O,I.FTYP.byteLength),L},I}();U.types=void 0,U.HDLR_TYPES=void 0,U.STTS=void 0,U.STSC=void 0,U.STCO=void 0,U.STSZ=void 0,U.VMHD=void 0,U.SMHD=void 0,U.STSD=void 0,U.FTYP=void 0,U.DINF=void 0,Y.default=U},"./src/remux/mp4-remuxer.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return i}),D.d(Y,"normalizePts",function(){return c});var $=D("./src/polyfills/number.ts"),U=D("./src/remux/aac-helper.ts"),I=D("./src/remux/mp4-generator.ts"),K=D("./src/events.ts"),N=D("./src/errors.ts"),O=D("./src/utils/logger.ts"),L=D("./src/types/loader.ts"),x=D("./src/utils/timescale-conversion.ts");function A(){return A=Object.assign||function(u){for(var E=1;E0?b:g.pts},f[0].pts);return s&&O.logger.debug("PTS rollover detected"),a},E.remux=function(f,s,a,b,g,_,k,H){var z,Z,G,B,te,ce,pe=g,ye=g,Ce=f.pid>-1,_e=s.pid>-1,le=s.samples.length,se=f.samples.length>0,ge=le>1,ie=(!Ce||se)&&(!_e||ge)||this.ISGenerated||k;if(ie){this.ISGenerated||(G=this.generateIS(f,s,g));var q=this.isVideoContiguous,Ee=-1;if(ge&&(Ee=C(s.samples),!q&&this.config.forceKeyFrameOnDiscontinuity))if(ce=!0,Ee>0){O.logger.warn("[mp4-remuxer]: Dropped "+Ee+" out of "+le+" video samples due to a missing keyframe");var Me=this.getVideoStartPts(s.samples);s.samples=s.samples.slice(Ee),s.dropped+=Ee,ye+=(s.samples[0].pts-Me)/(s.timescale||9e4)}else Ee===-1&&(O.logger.warn("[mp4-remuxer]: No keyframe found out of "+le+" video samples"),ce=!1);if(this.ISGenerated){if(se&&ge){var Ne=this.getVideoStartPts(s.samples),De=c(f.samples[0].pts,Ne)-Ne,Be=De/s.inputTimeScale;pe+=Math.max(0,Be),ye+=Math.max(0,-Be)}if(se){if(f.samplerate||(O.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),G=this.generateIS(f,s,g)),Z=this.remuxAudio(f,pe,this.isAudioContiguous,_,_e||ge||H===L.PlaylistLevelType.AUDIO?ye:void 0),ge){var Ae=Z?Z.endPTS-Z.startPTS:0;s.inputTimeScale||(O.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),G=this.generateIS(f,s,g)),z=this.remuxVideo(s,ye,q,Ae)}}else ge&&(z=this.remuxVideo(s,ye,q,0));z&&(z.firstKeyFrame=Ee,z.independent=Ee!==-1)}}return this.ISGenerated&&(a.samples.length&&(te=this.remuxID3(a,g)),b.samples.length&&(B=this.remuxText(b,g))),{audio:Z,video:z,initSegment:G,independent:ce,text:B,id3:te}},E.generateIS=function(f,s,a){var b=f.samples,g=s.samples,_=this.typeSupported,k={},H=!Object($.isFiniteNumber)(this._initPTS),z="audio/mp4",Z,G,B;if(H&&(Z=G=Infinity),f.config&&b.length&&(f.timescale=f.samplerate,f.isAAC||(_.mpeg?(z="audio/mpeg",f.codec=""):_.mp3&&(f.codec="mp3")),k.audio={id:"audio",container:z,codec:f.codec,initSegment:!f.isAAC&&_.mpeg?new Uint8Array(0):I.default.initSegment([f]),metadata:{channelCount:f.channelCount}},H&&(B=f.inputTimeScale,Z=G=b[0].pts-Math.round(B*a))),s.sps&&s.pps&&g.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)){B=s.inputTimeScale;var te=this.getVideoStartPts(g),ce=Math.round(B*a);G=Math.min(G,c(g[0].dts,te)-ce),Z=Math.min(Z,te-ce)}if(Object.keys(k).length)return this.ISGenerated=!0,H&&(this._initPTS=Z,this._initDTS=G),{tracks:k,initPTS:Z,timescale:B}},E.remuxVideo=function(f,s,a,b){var g=f.inputTimeScale,_=f.samples,k=[],H=_.length,z=this._initPTS,Z=this.nextAvcDts,G=8,B,te,ce,pe=Number.POSITIVE_INFINITY,ye=Number.NEGATIVE_INFINITY,Ce=0,_e=!1;if(!a||Z===null){var le=s*g,se=_[0].pts-c(_[0].dts,_[0].pts);Z=le-se}for(var ge=0;geie.pts){var q=9e4*.2;Ce=Math.max(Math.min(Ce,ie.pts-ie.dts),-1*q)}ie.dts<_[ge>0?ge-1:ge].dts&&(_e=!0)}_e&&_.sort(function(Dt,ut){var mt=Dt.dts-ut.dts,zt=Dt.pts-ut.pts;return mt||zt}),te=_[0].dts,ce=_[_.length-1].dts;var Ee=Math.round((ce-te)/(H-1));if(Ce<0){if(CeEe,Pe=Be<-1;if(Ae||Pe){Ae?O.logger.warn("AVC: "+Object(x.toMsFromMpegTsClock)(Be,!0)+" ms ("+Be+"dts) hole between fragments detected, filling it"):O.logger.warn("AVC: "+Object(x.toMsFromMpegTsClock)(-Be,!0)+" ms ("+Be+"dts) overlapping between fragments detected"),te=Z;var Fe=_[0].pts-Be;_[0].dts=te,_[0].pts=Fe,O.logger.log("Video: First PTS/DTS adjusted: "+Object(x.toMsFromMpegTsClock)(Fe,!0)+"/"+Object(x.toMsFromMpegTsClock)(te,!0)+", delta: "+Object(x.toMsFromMpegTsClock)(Be,!0)+" ms")}}l&&(te=Math.max(0,te));for(var ze=0,qe=0,He=0;He0?ke-1:ke].dts;if(re.stretchShortVideoTrack&&this.nextAudioPts!==null){var de=Math.floor(re.maxBufferHole*g),ue=(b?pe+b*g:this.nextAudioPts)-Pt.pts;ue>de?(B=ue-ae,B<0&&(B=ae),O.logger.log("[mp4-remuxer]: It is approximately "+ue/90+" ms to the next segment; using duration "+B/90+" ms for the last video frame.")):B=ae}else B=ae}var we=Math.round(Pt.pts-Pt.dts);k.push(new v(Pt.key,B,Ue,we))}if(k.length&&T&&T<70){var Le=k[0].flags;Le.dependsOn=2,Le.isNonSync=0}console.assert(B!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=Z=ce+B,this.isVideoContiguous=!0;var rt=I.default.moof(f.sequenceNumber++,te,A({},f,{samples:k})),je="video",Ye={data1:rt,data2:ht,startPTS:pe/g,endPTS:(ye+B)/g,startDTS:te/g,endDTS:Z/g,type:je,hasAudio:!1,hasVideo:!0,nb:k.length,dropped:f.dropped};return f.samples=[],f.dropped=0,console.assert(ht.length,"MDAT length must not be zero"),Ye},E.remuxAudio=function(f,s,a,b,g){var _=f.inputTimeScale,k=f.samplerate?f.samplerate:_,H=_/k,z=f.isAAC?w:S,Z=z*H,G=this._initPTS,B=!f.isAAC&&this.typeSupported.mpeg,te=[],ce=f.samples,pe=B?0:8,ye=this.nextAudioPts||-1,Ce=s*_;if(this.isAudioContiguous=a=a||ce.length&&ye>0&&(b&&Math.abs(Ce-ye)<9e3||Math.abs(c(ce[0].pts-G,Ce)-ye)<20*Z),ce.forEach(function(be){be.pts=c(be.pts-G,Ce)}),!a||ye<0){if(ce=ce.filter(function(be){return be.pts>=0}),!ce.length)return;g===0?ye=0:b?ye=Math.max(0,Ce):ye=ce[0].pts}if(f.isAAC)for(var _e=g!==void 0,le=this.config.maxAudioFramesDrift,se=0,ge=ye;se=le*Z&&Me0){qe+=pe;try{ze=new Uint8Array(qe)}catch(be){this.observer.emit(K.Events.ERROR,K.Events.ERROR,{type:N.ErrorTypes.MUX_ERROR,details:N.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:qe,reason:"fail allocating audio mdat "+qe});return}if(!B){var ht=new DataView(ze.buffer);ht.setUint32(0,qe),ze.set(I.default.types.mdat,4)}}else return;ze.set(ft,pe);var yt=ft.byteLength;pe+=yt,te.push(new v(!0,z,yt,0)),Fe=nt}var ke=te.length;if(!ke)return;var Pt=te[te.length-1];this.nextAudioPts=ye=Fe+H*Pt.duration;var Tt=B?new Uint8Array(0):I.default.moof(f.sequenceNumber++,Pe/H,A({},f,{samples:te}));f.samples=[];var Ue=Pe/_,Ze=ye/_,xe="audio",fe={data1:Tt,data2:ze,startPTS:Ue,endPTS:Ze,startDTS:Ue,endDTS:Ze,type:xe,hasAudio:!0,hasVideo:!1,nb:ke};return this.isAudioContiguous=!0,console.assert(ze.length,"MDAT length must not be zero"),fe},E.remuxEmptyAudio=function(f,s,a,b){var g=f.inputTimeScale,_=f.samplerate?f.samplerate:g,k=g/_,H=this.nextAudioPts,z=(H!==null?H:b.startDTS*g)+this._initDTS,Z=b.endDTS*g+this._initDTS,G=k*w,B=Math.ceil((Z-z)/G),te=U.default.getSilentFrame(f.manifestCodec||f.codec,f.channelCount);if(O.logger.warn("[mp4-remuxer]: remux empty Audio"),!te){O.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ce=[],pe=0;pe4294967296;)u+=d;return u}function C(u){for(var E=0;E0?this.lastEndDTS=f:(K.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var s=!!u.audio,a=!!u.video,b="";s&&(b+="audio"),a&&(b+="video");var g={data1:v,startPTS:d,startDTS:d,endPTS:f,endDTS:f,type:b,hasAudio:s,hasVideo:a,nb:1,dropped:0};return C.audio=g.type==="audio"?g:void 0,C.video=g.type!=="audio"?g:void 0,C.text=h,C.id3=T,C.initSegment=m,C},x}(),O=function(A,P,w){return Object(U.getStartDTS)(A,P)-w};function L(x,A){var P=x==null?void 0:x.codec;return P&&P.length>4?P:P==="hvc1"?"hvc1.1.c.L120.90":P==="av01"?"av01.0.04M.08":P==="avc1"||A===I.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}Y.default=N},"./src/task-loop.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return $});var $=function(){function U(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var I=U.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(N){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,N),!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(){},U}()},"./src/types/cmcd.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"CMCDVersion",function(){return $}),D.d(Y,"CMCDObjectType",function(){return U}),D.d(Y,"CMCDStreamingFormat",function(){return I}),D.d(Y,"CMCDStreamType",function(){return K});var $=1,U;(function(N){N.MANIFEST="m",N.AUDIO="a",N.VIDEO="v",N.MUXED="av",N.INIT="i",N.CAPTION="c",N.TIMED_TEXT="tt",N.KEY="k",N.OTHER="o"})(U||(U={}));var I;(function(N){N.DASH="d",N.HLS="h",N.SMOOTH="s",N.OTHER="o"})(I||(I={}));var K;(function(N){N.VOD="v",N.LIVE="l"})(K||(K={}))},"./src/types/level.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"HlsSkip",function(){return I}),D.d(Y,"getSkipValue",function(){return K}),D.d(Y,"HlsUrlParameters",function(){return N}),D.d(Y,"Level",function(){return O});function $(L,x){for(var A=0;ANumber.MAX_SAFE_INTEGER?Infinity:x},N.hexadecimalInteger=function(L){if(this[L]){var x=(this[L]||"0x").slice(2);x=(x.length&1?"0":"")+x;for(var A=new Uint8Array(x.length/2),P=0;PNumber.MAX_SAFE_INTEGER?Infinity:x},N.decimalFloatingPoint=function(L){return parseFloat(this[L])},N.optionalFloat=function(L,x){var A=this[L];return A?parseFloat(A):x},N.enumeratedString=function(L){return this[L]},N.bool=function(L){return this[L]==="YES"},N.decimalResolution=function(L){var x=$.exec(this[L]);return x===null?void 0:{width:parseInt(x[1],10),height:parseInt(x[2],10)}},K.parseAttrList=function(L){var x,A={},P='"';for(U.lastIndex=0;(x=U.exec(L))!==null;){var w=x[2];w.indexOf(P)===0&&w.lastIndexOf(P)===w.length-1&&(w=w.slice(1,-1)),A[x[1]]=w}return A},K}()},"./src/utils/binary-search.ts":function(oe,Y,D){"use strict";D.r(Y);var $={search:function(I,K){for(var N=0,O=I.length-1,L=null,x=null;N<=O;){L=(N+O)/2|0,x=I[L];var A=K(x);if(A>0)N=L+1;else if(A<0)O=L-1;else return x}return null}};Y.default=$},"./src/utils/buffer-helper.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"BufferHelper",function(){return I});var $=D("./src/utils/logger.ts"),U={length:0,start:function(){return 0},end:function(){return 0}},I=function(){function K(){}return K.isBuffered=function(O,L){try{if(O){for(var x=K.getBuffered(O),A=0;A=x.start(A)&&L<=x.end(A))return!0}}catch(P){}return!1},K.bufferInfo=function(O,L,x){try{if(O){var A=K.getBuffered(O),P=[],w;for(w=0;wS&&(A[w-1].end=O[P].end):A.push(O[P])}else A.push(O[P])}else A=O;for(var T=0,h,l=L,i=L,c=0;c=C&&L=a&&$.logger.log(this.time+" ["+a+"] "+b)},d}(),T=function(f){for(var s=[],a=0;aN&&(this.logger.log(w.DEBUG,"Too large cursor position "+this.pos),this.pos=N)},f.moveCursor=function(a){var b=this.pos+a;if(a>1)for(var g=this.pos+1;g=144&&this.backSpace();var b=I(a);if(this.pos>=N){this.logger.log(w.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)},f.clearFromPos=function(a){var b;for(b=a;b0&&(a?g="["+b.join(" | ")+"]":g=b.join(` `)),g},f.getTextAndFormat=function(){return this.rows},d}(),C=function(){function d(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[K-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=b}var f=d.prototype;return f.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[K-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},f.getHandler=function(){return this.outputFilter},f.setHandler=function(a){this.outputFilter=a},f.setPAC=function(a){this.writeScreen.setPAC(a)},f.setBkgData=function(a){this.writeScreen.setBkgData(a)},f.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(w.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},f.insertChars=function(a){for(var b=0;b=46,b.italics)b.foreground="white";else{var g=Math.floor(a/2)-16,_=["white","green","blue","cyan","red","yellow","magenta"];b.foreground=_[g]}this.logger.log(w.INFO,"MIDROW: "+JSON.stringify(b)),this.writeScreen.setPen(b)},f.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))},f.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},d}(),v=function(){function d(s,a,b){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var g=new S;this.channels=[null,new C(s,a,g),new C(s+1,b,g)],this.cmdHistory=E(),this.logger=g}var f=d.prototype;return f.getHandler=function(a){return this.channels[a].getHandler()},f.setHandler=function(a,b){this.channels[a].setHandler(b)},f.addData=function(a,b){var g,_,k,H=!1;this.logger.time=a;for(var z=0;z ("+T([_,k])+")"),g=this.parseCmd(_,k),g||(g=this.parseMidrow(_,k)),g||(g=this.parsePAC(_,k)),g||(g=this.parseBackgroundAttributes(_,k)),!g&&(H=this.parseChars(_,k),H)){var Z=this.currentChannel;if(Z&&Z>0){var G=this.channels[Z];G.insertChars(H)}else this.logger.log(w.WARNING,"No channel found yet. TEXT-MODE?")}!g&&!H&&this.logger.log(w.WARNING,"Couldn't parse cleaned data "+T([_,k])+" orig: "+T([b[z],b[z+1]]))}},f.parseCmd=function(a,b){var g=this.cmdHistory,_=(a===20||a===28||a===21||a===29)&&b>=32&&b<=47,k=(a===23||a===31)&&b>=33&&b<=35;if(!(_||k))return!1;if(u(a,b,g))return m(null,null,g),this.logger.log(w.DEBUG,"Repeated command ("+T([a,b])+") is dropped"),!0;var H=a===20||a===21||a===23?1:2,z=this.channels[H];return a===20||a===21||a===28||a===29?b===32?z.ccRCL():b===33?z.ccBS():b===34?z.ccAOF():b===35?z.ccAON():b===36?z.ccDER():b===37?z.ccRU(2):b===38?z.ccRU(3):b===39?z.ccRU(4):b===40?z.ccFON():b===41?z.ccRDC():b===42?z.ccTR():b===43?z.ccRTD():b===44?z.ccEDM():b===45?z.ccCR():b===46?z.ccENM():b===47&&z.ccEOC():z.ccTO(b-32),m(a,b,g),this.currentChannel=H,!0},f.parseMidrow=function(a,b){var g=0;if((a===17||a===25)&&b>=32&&b<=47){if(a===17?g=1:g=2,g!==this.currentChannel)return this.logger.log(w.ERROR,"Mismatch channel in midrow parsing"),!1;var _=this.channels[g];return _?(_.ccMIDROW(b),this.logger.log(w.DEBUG,"MIDROW ("+T([a,b])+")"),!0):!1}return!1},f.parsePAC=function(a,b){var g,_=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(u(a,b,_))return m(null,null,_),!0;var z=a<=23?1:2;b>=64&&b<=95?g=z===1?O[a]:x[a]:g=z===1?L[a]:A[a];var Z=this.channels[z];return Z?(Z.setPAC(this.interpretPAC(g,b)),m(a,b,_),this.currentChannel=z,!0):!1},f.interpretPAC=function(a,b){var g,_={color:null,italics:!1,indent:null,underline:!1,row:a};return b>95?g=b-96:g=b-64,_.underline=(g&1)===1,g<=13?_.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(g/2)]:g<=15?(_.italics=!0,_.color="white"):_.indent=Math.floor((g-16)/2)*4,_},f.parseChars=function(a,b){var g,_=null,k=null;if(a>=25?(g=2,k=a-8):(g=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(w.INFO,"Special char '"+I(H)+"' in channel "+g),_=[H]}else a>=32&&a<=127&&(_=b===0?[a]:[a,b]);if(_){var z=T(_);this.logger.log(w.DEBUG,"Char codes = "+z.join(",")),m(a,b,this.cmdHistory)}return _},f.parseBackgroundAttributes=function(a,b){var g=(a===16||a===24)&&b>=32&&b<=47,_=(a===23||a===31)&&b>=45&&b<=47;if(!(g||_))return!1;var k,H={};a===16||a===24?(k=Math.floor((b-32)/2),H.background=P[k],b%2===1&&(H.background=H.background+"_semi")):b===45?H.background="transparent":(H.foreground="black",b===47&&(H.underline=!0));var z=a<=23?1:2,Z=this.channels[z];return Z.setBkgData(H),m(a,b,this.cmdHistory),!0},f.reset=function(){for(var a=0;a=16?l--:l++;var m=Object($.fixLineBreaks)(i.trim()),u=Object(U.generateCueId)(x,A,m);(!L||!L.cues||!L.cues.getCueById(u))&&(T=new c(x,A,m),T.id=u,T.line=C+1,T.align="left",T.position=10+Math.min(80,Math.floor(l*8/32)*10),w.push(T))}return L&&w.length&&(w.sort(function(E,d){return E.line==="auto"||d.line==="auto"?0:E.line>8&&d.line>8?d.line-E.line:E.line-d.line}),w.forEach(function(E){return Object(I.addCueToTrack)(L,E)})),w}};Y.default=N},"./src/utils/discontinuities.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"findFirstFragWithCC",function(){return K}),D.d(Y,"shouldAlignOnDiscontinuities",function(){return N}),D.d(Y,"findDiscontinuousReferenceFrag",function(){return O}),D.d(Y,"adjustSlidingStart",function(){return x}),D.d(Y,"alignStream",function(){return A}),D.d(Y,"alignPDT",function(){return w}),D.d(Y,"alignFragmentByPDTDelta",function(){return S}),D.d(Y,"alignMediaPlaylistByPDT",function(){return T});var $=D("./src/polyfills/number.ts"),U=D("./src/utils/logger.ts"),I=D("./src/controller/level-helper.ts");function K(h,l){for(var i=null,c=0,C=h.length;ci.startCC||h&&h.cc=this.minWeight_},K.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},K.destroy=function(){},I}();Y.default=U},"./src/utils/ewma.ts":function(oe,Y,D){"use strict";D.r(Y);var $=function(){function U(K,N,O){N===void 0&&(N=0),O===void 0&&(O=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=K,this.alpha_=K?Math.exp(Math.log(.5)/K):0,this.estimate_=N,this.totalWeight_=O}var I=U.prototype;return I.sample=function(N,O){var L=Math.pow(this.alpha_,N);this.estimate_=O*(1-L)+L*this.estimate_,this.totalWeight_+=N},I.getTotalWeight=function(){return this.totalWeight_},I.getEstimate=function(){if(this.alpha_){var N=1-Math.pow(this.alpha_,this.totalWeight_);if(N)return this.estimate_/N}return this.estimate_},U}();Y.default=$},"./src/utils/fetch-loader.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"fetchSupported",function(){return S});var $=D("./src/polyfills/number.ts"),U=D("./src/loader/load-stats.ts"),I=D("./src/demux/chunk-cache.ts");function K(c,C){c.prototype=Object.create(C.prototype),c.prototype.constructor=c,A(c,C)}function N(c){var C=typeof Map=="function"?new Map:void 0;return N=function(m){if(m===null||!x(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,u)}function u(){return O(m,arguments,P(this).constructor)}return u.prototype=Object.create(m.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),A(u,m)},N(c)}function O(c,C,v){return L()?O=Reflect.construct:O=function(u,E,d){var f=[null];f.push.apply(f,E);var s=Function.bind.apply(u,f),a=new s;return d&&A(a,d.prototype),a},O.apply(null,arguments)}function L(){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 x(c){return Function.toString.call(c).indexOf("[native code]")!==-1}function A(c,C){return A=Object.setPrototypeOf||function(m,u){return m.__proto__=u,m},A(c,C)}function P(c){return P=Object.setPrototypeOf?Object.getPrototypeOf:function(v){return v.__proto__||Object.getPrototypeOf(v)},P(c)}function w(){return w=Object.assign||function(c){for(var C=1;C=d&&f(u,E,s.flush(),m)):f(u,E,k,m),g()}).catch(function(){return Promise.reject()})};return b()},c}();function h(c,C){var v={method:"GET",mode:"cors",credentials:"same-origin",signal:C,headers:new self.Headers(w({},c.headers))};return c.rangeEnd&&v.headers.set("Range","bytes="+c.rangeStart+"-"+String(c.rangeEnd-1)),v}function l(c,C){return new self.Request(c.url,C)}var i=function(c){K(C,c);function C(v,m,u){var E;return E=c.call(this,v)||this,E.code=void 0,E.details=void 0,E.code=m,E.details=u,E}return C}(N(Error));Y.default=T},"./src/utils/imsc1-ttml-parser.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"IMSC1_CODEC",function(){return x}),D.d(Y,"parseIMSC1",function(){return S});var $=D("./src/utils/mp4-tools.ts"),U=D("./src/utils/vttparser.ts"),I=D("./src/utils/vttcue.ts"),K=D("./src/demux/id3.ts"),N=D("./src/utils/timescale-conversion.ts"),O=D("./src/utils/webvtt-parser.ts");function L(){return L=Object.assign||function(d){for(var f=1;f"):$}function N(x){for(var A=arguments.length,P=new Array(A>1?A-1:0),w=1;w>24,C[v+1]=m>>16&255,C[v+2]=m>>8&255,C[v+3]=m&255}function A(C,v){var m=[];if(!v.length)return m;var u,E,d;"data"in C?(u=C.data,E=C.start,d=C.end):(u=C,E=0,d=u.byteLength);for(var f=E;f1?f+s:d;if(a===v[0])if(v.length===1)m.push({data:u,start:f+8,end:b});else{var g=A({data:u,start:f+8,end:b},v.slice(1));g.length&&K.apply(m,g)}f=b}return m}function P(C){var v=A(C,["moov"]),m=v[0],u=m?m.end:null,E=A(C,["sidx"]);if(!E||!E[0])return null;var d=[],f=E[0],s=f.data[0],a=s===0?8:16,b=L(f,a);a+=4;var g=0,_=0;s===0?a+=8:a+=16,a+=2;var k=f.end+_,H=O(f,a);a+=2;for(var z=0;z>>31;if(te===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ce=L(f,Z);Z+=4,d.push({referenceSize:B,subsegmentDuration:ce,info:{duration:ce/b,start:k,end:k+B-1}}),k+=B,Z+=4,a=Z}return{earliestPresentationTime:g,timescale:b,version:s,referencesCount:H,references:d,moovEndOffset:u}}function w(C){for(var v=[],m=A(C,["moov","trak"]),u=0;uN)&&(this.startTime=N),this.endTime=O,this.screen=L,this.timelineController.createCaptionsTrack(this.trackName)},I.reset=function(){this.cueRanges=[]},U}()},"./src/utils/texttrack-utils.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"sendAddTrackEvent",function(){return U}),D.d(Y,"addCueToTrack",function(){return I}),D.d(Y,"clearCurrentCues",function(){return K}),D.d(Y,"removeCuesInRange",function(){return N}),D.d(Y,"getCuesInRange",function(){return L});var $=D("./src/utils/logger.ts");function U(x,A){var P;try{P=new Event("addtrack")}catch(w){P=document.createEvent("Event"),P.initEvent("addtrack",!1,!1)}P.track=x,A.dispatchEvent(P)}function I(x,A){var P=x.mode;if(P==="disabled"&&(x.mode="hidden"),x.cues&&!x.cues.getCueById(A.id))try{if(x.addCue(A),!x.cues.getCueById(A.id))throw new Error("addCue is failed for: "+A)}catch(S){$.logger.debug("[texttrack-utils]: "+S);var w=new self.TextTrackCue(A.startTime,A.endTime,A.text);w.id=A.id,x.addCue(w)}P==="disabled"&&(x.mode=P)}function K(x){var A=x.mode;if(A==="disabled"&&(x.mode="hidden"),x.cues)for(var P=x.cues.length;P--;)x.removeCue(x.cues[P]);A==="disabled"&&(x.mode=A)}function N(x,A,P){var w=x.mode;if(w==="disabled"&&(x.mode="hidden"),x.cues&&x.cues.length>0)for(var S=L(x.cues,A,P),T=0;Tx[P].endTime)return-1;for(var w=0,S=P;w<=S;){var T=Math.floor((S+w)/2);if(Ax[T].startTime&&w-1)for(var T=S,h=x.length;T=A&&l.endTime<=P)w.push(l);else if(l.startTime>P)return w}return w}},"./src/utils/time-ranges.ts":function(oe,Y,D){"use strict";D.r(Y);var $={toString:function(I){for(var K="",N=I.length,O=0;O1?A-1:0),w=1;w100)throw new Error("Position must be between 0 and 100.");d=g,this.hasBeenReset=!0}})),Object.defineProperty(w,"positionAlign",O({},S,{get:function(){return f},set:function(g){var _=N(g);if(!_)throw new SyntaxError("An invalid or illegal string was specified.");f=_,this.hasBeenReset=!0}})),Object.defineProperty(w,"size",O({},S,{get:function(){return s},set:function(g){if(g<0||g>100)throw new Error("Size must be between 0 and 100.");s=g,this.hasBeenReset=!0}})),Object.defineProperty(w,"align",O({},S,{get:function(){return a},set:function(g){var _=N(g);if(!_)throw new SyntaxError("An invalid or illegal string was specified.");a=_,this.hasBeenReset=!0}})),w.displayState=void 0}return L.prototype.getCueAsHTML=function(){var x=self.WebVTT;return x.convertCueToDOMTree(self,this.text)},L}()},"./src/utils/vttparser.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"parseTimeStamp",function(){return I}),D.d(Y,"fixLineBreaks",function(){return A}),D.d(Y,"VTTParser",function(){return P});var $=D("./src/utils/vttcue.ts"),U=function(){function w(){}var S=w.prototype;return S.decode=function(h,l){if(!h)return"";if(typeof h!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(h))},w}();function I(w){function S(h,l,i,c){return(h|0)*3600+(l|0)*60+(i|0)+parseFloat(c||0)}var T=w.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return T?parseFloat(T[2])>59?S(T[2],T[3],0,T[4]):S(T[1],T[2],T[3],T[4]):null}var K=function(){function w(){this.values=Object.create(null)}var S=w.prototype;return S.set=function(h,l){!this.get(h)&&l!==""&&(this.values[h]=l)},S.get=function(h,l,i){return i?this.has(h)?this.values[h]:l[i]:this.has(h)?this.values[h]:l},S.has=function(h){return h in this.values},S.alt=function(h,l,i){for(var c=0;c=0&&i<=100)return this.set(h,i),!0}return!1},w}();function N(w,S,T,h){var l=h?w.split(h):[w];for(var i in l){if(typeof l[i]!="string")continue;var c=l[i].split(T);if(c.length!==2)continue;var C=c[0],v=c[1];S(C,v)}}var O=new $.default(0,0,""),L=O.align==="middle"?"middle":"center";function x(w,S,T){var h=w;function l(){var C=I(w);if(C===null)throw new Error("Malformed timestamp: "+h);return w=w.replace(/^[^\sa-zA-Z-]+/,""),C}function i(C,v){var m=new K;N(C,function(d,f){var s;switch(d){case"region":for(var a=T.length-1;a>=0;a--)if(T[a].id===f){m.set(d,T[a].region);break}break;case"vertical":m.alt(d,f,["rl","lr"]);break;case"line":s=f.split(","),m.integer(d,s[0]),m.percent(d,s[0])&&m.set("snapToLines",!1),m.alt(d,s[0],["auto"]),s.length===2&&m.alt("lineAlign",s[1],["start",L,"end"]);break;case"position":s=f.split(","),m.percent(d,s[0]),s.length===2&&m.alt("positionAlign",s[1],["start",L,"end","line-left","line-right","auto"]);break;case"size":m.percent(d,f);break;case"align":m.alt(d,f,["start",L,"end","left","right"]);break}},/:/,/\s/),v.region=m.get("region",null),v.vertical=m.get("vertical","");var u=m.get("line","auto");u==="auto"&&O.line===-1&&(u=-1),v.line=u,v.lineAlign=m.get("lineAlign","start"),v.snapToLines=m.get("snapToLines",!0),v.size=m.get("size",100),v.align=m.get("align",L);var E=m.get("position","auto");E==="auto"&&O.position===50&&(E=v.align==="start"||v.align==="left"?0:v.align==="end"||v.align==="right"?100:50),v.position=E}function c(){w=w.replace(/^\s+/,"")}if(c(),S.startTime=l(),c(),w.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+h);w=w.substr(3),c(),S.endTime=l(),c(),i(w,S)}function A(w){return w.replace(//gi,` `)}var P=function(){function w(){this.state="INITIAL",this.buffer="",this.decoder=new U,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var S=w.prototype;return S.parse=function(h){var l=this;h&&(l.buffer+=l.decoder.decode(h,{stream:!0}));function i(){var E=l.buffer,d=0;for(E=A(E);d")===-1){l.cue.id=C;continue}case"CUE":if(!l.cue){l.state="BADCUE";continue}try{x(C,l.cue,l.regionList)}catch(E){l.cue=null,l.state="BADCUE";continue}l.state="CUETEXT";continue;case"CUETEXT":{var u=C.indexOf("-->")!==-1;if(!C||u&&(m=!0)){l.oncue&&l.cue&&l.oncue(l.cue),l.cue=null,l.state="ID";continue}if(l.cue===null)continue;l.cue.text&&(l.cue.text+=` `),l.cue.text+=C}continue;case"BADCUE":C||(l.state="ID")}}}catch(E){l.state==="CUETEXT"&&l.cue&&l.oncue&&l.oncue(l.cue),l.cue=null,l.state=l.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},S.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(l){h.onparsingerror&&h.onparsingerror(l)}return h.onflush&&h.onflush(),this},w}()},"./src/utils/webvtt-parser.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"generateCueId",function(){return P}),D.d(Y,"parseWebVTT",function(){return S});var $=D("./src/polyfills/number.ts"),U=D("./src/utils/vttparser.ts"),I=D("./src/demux/id3.ts"),K=D("./src/utils/timescale-conversion.ts"),N=D("./src/remux/mp4-remuxer.ts"),O=/\r\n|\n\r|\n|\r/g,L=function(h,l,i){return i===void 0&&(i=0),h.substr(i,l.length)===l},x=function(h){var l=parseInt(h.substr(-3)),i=parseInt(h.substr(-6,2)),c=parseInt(h.substr(-9,2)),C=h.length>9?parseInt(h.substr(0,h.indexOf(":"))):0;if(!Object($.isFiniteNumber)(l)||!Object($.isFiniteNumber)(i)||!Object($.isFiniteNumber)(c)||!Object($.isFiniteNumber)(C))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+h);return l+=1e3*i,l+=60*1e3*c,l+=60*60*1e3*C,l},A=function(h){for(var l=5381,i=h.length;i;)l=l*33^h.charCodeAt(--i);return(l>>>0).toString()};function P(T,h,l){return A(T.toString())+A(h.toString())+A(l)}var w=function(h,l,i){var c=h[l],C=h[c.prevCC];if(!C||!C.new&&c.new){h.ccOffset=h.presentationOffset=c.start,c.new=!1;return}for(;(v=C)!==null&&v!==void 0&&v.new;){var v;h.ccOffset+=c.start-C.start,c.new=!1,c=C,C=h[c.prevCC]}h.presentationOffset=i};function S(T,h,l,i,c,C,v,m){var u=new U.VTTParser,E=Object(I.utf8ArrayToStr)(new Uint8Array(T)).trim().replace(O,` `).split(` `),d=[],f=Object(K.toMpegTsClockFromTimescale)(h,l),s="00:00.000",a=0,b=0,g,_=!0,k=!1;u.oncue=function(H){var z=i[c],Z=i.ccOffset,G=(a-f)/9e4;if(z!=null&&z.new&&(b!==void 0?Z=i.ccOffset=z.start:w(i,c,G)),G&&(Z=G-i.presentationOffset),k){var B=H.endTime-H.startTime,te=Object(N.normalizePts)((H.startTime+Z-b)*9e4,C*9e4)/9e4;H.startTime=te,H.endTime=te+B}var ce=H.text.trim();H.text=decodeURIComponent(encodeURIComponent(ce)),H.id||(H.id=P(H.startTime,H.endTime,ce)),H.endTime>0&&d.push(H)},u.onparsingerror=function(H){g=H},u.onflush=function(){if(g){m(g);return}v(d)},E.forEach(function(H){if(_)if(L(H,"X-TIMESTAMP-MAP=")){_=!1,k=!0,H.substr(16).split(",").forEach(function(z){L(z,"LOCAL:")?s=z.substr(6):L(z,"MPEGTS:")&&(a=parseInt(z.substr(7)))});try{b=x(s)/1e3}catch(z){k=!1,g=z}return}else H===""&&(_=!1);u.parse(H+` `)}),u.flush()}},"./src/utils/xhr-loader.ts":function(oe,Y,D){"use strict";D.r(Y);var $=D("./src/utils/logger.ts"),U=D("./src/loader/load-stats.ts"),I=/^age:\s*[\d.]+\s*$/m,K=function(){function N(L){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=L?L.xhrSetup:null,this.stats=new U.LoadStats,this.retryDelay=0}var O=N.prototype;return O.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},O.abortInternal=function(){var x=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),x&&(x.onreadystatechange=null,x.onprogress=null,x.readyState!==4&&(this.stats.aborted=!0,x.abort()))},O.abort=function(){var x;this.abortInternal(),(x=this.callbacks)!==null&&x!==void 0&&x.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},O.load=function(x,A,P){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=x,this.config=A,this.callbacks=P,this.retryDelay=A.retryDelay,this.loadInternal()},O.loadInternal=function(){var x=this.config,A=this.context;if(!x)return;var P=this.loader=new self.XMLHttpRequest,w=this.stats;w.loading.first=0,w.loaded=0;var S=this.xhrSetup;try{if(S)try{S(P,A.url)}catch(l){P.open("GET",A.url,!0),S(P,A.url)}P.readyState||P.open("GET",A.url,!0);var T=this.context.headers;if(T)for(var h in T)P.setRequestHeader(h,T[h])}catch(l){this.callbacks.onError({code:P.status,text:l.message},A,P);return}A.rangeEnd&&P.setRequestHeader("Range","bytes="+A.rangeStart+"-"+(A.rangeEnd-1)),P.onreadystatechange=this.readystatechange.bind(this),P.onprogress=this.loadprogress.bind(this),P.responseType=A.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),x.timeout),P.send()},O.readystatechange=function(){var x=this.context,A=this.loader,P=this.stats;if(!x||!A)return;var w=A.readyState,S=this.config;if(P.aborted)return;if(w>=2)if(self.clearTimeout(this.requestTimeout),P.loading.first===0&&(P.loading.first=Math.max(self.performance.now(),P.loading.start)),w===4){A.onreadystatechange=null,A.onprogress=null;var T=A.status;if(T>=200&&T<300){P.loading.end=Math.max(self.performance.now(),P.loading.first);var h,l;if(x.responseType==="arraybuffer"?(h=A.response,l=h.byteLength):(h=A.responseText,l=h.length),P.loaded=P.total=l,!this.callbacks)return;var i=this.callbacks.onProgress;if(i&&i(P,x,h,A),!this.callbacks)return;var c={url:A.responseURL,data:h};this.callbacks.onSuccess(c,P,x,A)}else P.retry>=S.maxRetry||T>=400&&T<499?($.logger.error(T+" while loading "+x.url),this.callbacks.onError({code:T,text:A.statusText},x,A)):($.logger.warn(T+" while loading "+x.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,S.maxRetryDelay),P.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),S.timeout)},O.loadtimeout=function(){$.logger.warn("timeout while loading "+this.context.url);var x=this.callbacks;x&&(this.abortInternal(),x.onTimeout(this.stats,this.context,this.loader))},O.loadprogress=function(x){var A=this.stats;A.loaded=x.loaded,x.lengthComputable&&(A.total=x.total)},O.getCacheAge=function(){var x=null;if(this.loader&&I.test(this.loader.getAllResponseHeaders())){var A=this.loader.getResponseHeader("age");x=A?parseFloat(A):null}return x},N}();Y.default=K}}).default})},vHTk:function(at,Xe,V){at.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);