You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NewEduCoderBuild/p__Paperlibrary__Random__Ad...

361 lines
1.0 MiB

(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&&/<!\[CDATA\[/.test(b))return 0;var k=b&&/^<(\/)?([\w_:\.-]*)/.exec(b);if(k&&k[1])for(;_;)if(_.tagName==k[2]){_=_.prev;break}else if(K.implicitlyClosed.hasOwnProperty(_.tagName))_=_.prev;else break;else if(k)for(;_;){var H=K.contextGrabbers[_.tagName];if(H&&H.hasOwnProperty(k[2]))_=_.prev;else break}for(;_&&_.prev&&!_.startOfLine;)_=_.prev;return _?_.indent+I:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",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<s;b++)a[b]=arguments[b];return f=E.call.apply(E,[this].concat(a)),f.state={goInputText:""},f.buildOptionText=function(g){return"".concat(g," ").concat(f.props.locale.items_per_page)},f.changeSize=function(g){f.props.changeSize(Number(g))},f.handleChange=function(g){f.setState({goInputText:g.target.value})},f.handleBlur=function(g){var _=f.props,k=_.goButton,H=_.quickGo,z=_.rootPrefixCls,Z=f.state.goInputText;if(k||Z==="")return;if(g.relatedTarget&&(g.relatedTarget.className.indexOf("".concat(z,"-prev"))>=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.current<C(void 0,s.state,s.props)},s.runIfEnter=function(k,H){if(k.key==="Enter"||k.charCode===13){for(var z=arguments.length,Z=new Array(z>2?z-2:0),G=2;G<z;G++)Z[G-2]=arguments[G];H.apply(void 0,Z)}},s.runIfEnterPrev=function(k){s.runIfEnter(k,s.prev)},s.runIfEnterNext=function(k){s.runIfEnter(k,s.next)},s.runIfEnterJumpPrev=function(k){s.runIfEnter(k,s.jumpPrev)},s.runIfEnterJumpNext=function(k){s.runIfEnter(k,s.jumpNext)},s.handleGoTO=function(k){(k.keyCode===w.ENTER||k.type==="click")&&s.handleChange(s.state.currentInputValue)};var a=f.onChange!==l,b="current"in f;b&&!a&&console.warn("Warning: You provided a `current` prop to a Pagination component without an `onChange` handler. This will render a read-only component.");var g=f.defaultCurrent;"current"in f&&(g=f.current);var _=f.defaultPageSize;return"pageSize"in f&&(_=f.pageSize),g=Math.min(g,C(_,void 0,f)),s.state={current:g,currentInputValue:g,pageSize:_},s}return Object(U.a)(d,[{key:"componentDidUpdate",value:function(s,a){var b=this.props.prefixCls;if(a.current!==this.state.current&&this.paginationNode){var g=this.paginationNode.querySelector(".".concat(b,"-item-").concat(a.current));g&&document.activeElement===g&&g.blur()}}},{key:"getValidValue",value:function(s){var a=s.target.value,b=C(void 0,this.state,this.props),g=this.state.currentInputValue,_;return a===""?_=a:isNaN(Number(a))?_=g:a>=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<De?Ee+1:De,ft=Object.keys(this.props).reduce(function(ne,re){return(re.substr(0,5)==="data-"||re.substr(0,5)==="aria-"||re==="role")&&(ne[re]=s.props[re]),ne},{});if(pe)return He&&(typeof He=="boolean"?qe=O.a.createElement("button",{type:"button",onClick:this.handleGoTO,onKeyUp:this.handleGoTO},Z.jump_to_confirm):qe=O.a.createElement("span",{onClick:this.handleGoTO,onKeyUp:this.handleGoTO},He),qe=O.a.createElement("li",{title:te?"".concat(Z.jump_to).concat(Ee,"/").concat(De):null,className:"".concat(b,"-simple-pager")},qe)),O.a.createElement("ul",Object(oe.a)({className:x()(b,"".concat(b,"-simple"),Object(Y.a)({},"".concat(b,"-disabled"),k),g),style:_,ref:this.savePaginationNode},ft),O.a.createElement("li",{title:te?Z.prev_page:null,onClick:this.prev,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterPrev,className:x()("".concat(b,"-prev"),Object(Y.a)({},"".concat(b,"-disabled"),!this.hasPrev())),"aria-disabled":!this.hasPrev()},this.renderPrev(lt)),O.a.createElement("li",{title:te?"".concat(Ee,"/").concat(De):null,className:"".concat(b,"-simple-pager")},O.a.createElement("input",{type:"text",value:Ne,disabled:k,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onChange:this.handleKeyUp,size:"3"}),O.a.createElement("span",{className:"".concat(b,"-slash")},"/"),De),O.a.createElement("li",{title:te?Z.next_page:null,onClick:this.next,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterNext,className:x()("".concat(b,"-next"),Object(Y.a)({},"".concat(b,"-disabled"),!this.hasNext())),"aria-disabled":!this.hasNext()},this.renderNext(tt)),qe);if(De<=3+Oe*2){var nt={locale:Z,rootPrefixCls:b,onClick:this.handleChange,onKeyPress:this.runIfEnter,showTitle:te,itemRender:ye};De||Be.push(O.a.createElement(P,Object(oe.a)({},nt,{key:"noPager",page:De,className:"".concat(b,"-disabled")})));for(var St=1;St<=De;St+=1){var ht=Ee===St;Be.push(O.a.createElement(P,Object(oe.a)({},nt,{key:St,page:St,active:ht})))}}else{var yt=B?Z.prev_3:Z.prev_5,ke=B?Z.next_3:Z.next_5;Ce&&(Ae=O.a.createElement("li",{title:te?yt:null,key:"prev",onClick:this.jumpPrev,tabIndex:"0",onKeyPress:this.runIfEnterJumpPrev,className:x()("".concat(b,"-jump-prev"),Object(Y.a)({},"".concat(b,"-jump-prev-custom-icon"),!!_e))},ye(this.getJumpPrevPage(),"jump-prev",this.getItemIcon(_e,"prev page"))),Pe=O.a.createElement("li",{title:te?ke:null,key:"next",tabIndex:"0",onClick:this.jumpNext,onKeyPress:this.runIfEnterJumpNext,className:x()("".concat(b,"-jump-next"),Object(Y.a)({},"".concat(b,"-jump-next-custom-icon"),!!le))},ye(this.getJumpNextPage(),"jump-next",this.getItemIcon(le,"next page")))),ze=O.a.createElement(P,{locale:Z,last:!0,rootPrefixCls:b,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:De,page:De,active:!1,showTitle:te,itemRender:ye}),Fe=O.a.createElement(P,{locale:Z,rootPrefixCls:b,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:1,page:1,active:!1,showTitle:te,itemRender:ye});var Pt=Math.max(1,Ee-Oe),Tt=Math.min(Ee+Oe,De);Ee-1<=Oe&&(Tt=1+Oe*2),De-Ee<=Oe&&(Pt=De-Oe*2);for(var Ue=Pt;Ue<=Tt;Ue+=1){var Ze=Ee===Ue;Be.push(O.a.createElement(P,{locale:Z,rootPrefixCls:b,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:Ue,page:Ue,active:Ze,showTitle:te,itemRender:ye}))}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<oe.modeInfo.length;Y++){var D=oe.modeInfo[Y];D.mimes&&(D.mime=D.mimes[0])}oe.findModeByMIME=function($){$=$.toLowerCase();for(var U=0;U<oe.modeInfo.length;U++){var I=oe.modeInfo[U];if(I.mime==$)return I;if(I.mimes){for(var K=0;K<I.mimes.length;K++)if(I.mimes[K]==$)return I}}if(/\+xml$/.test($))return oe.findModeByMIME("application/xml");if(/\+json$/.test($))return oe.findModeByMIME("application/json")},oe.findModeByExtension=function($){$=$.toLowerCase();for(var U=0;U<oe.modeInfo.length;U++){var I=oe.modeInfo[U];if(I.ext){for(var K=0;K<I.ext.length;K++)if(I.ext[K]==$)return I}}},oe.findModeByFileName=function($){for(var U=0;U<oe.modeInfo.length;U++){var I=oe.modeInfo[U];if(I.file&&I.file.test($))return I}var K=$.lastIndexOf("."),N=K>-1&&$.substring(K+1,$.length);if(N)return oe.findModeByExtension(N)},oe.findModeByName=function($){$=$.toLowerCase();for(var U=0;U<oe.modeInfo.length;U++){var I=oe.modeInfo[U];if(I.name.toLowerCase()==$)return I;if(I.alias){for(var K=0;K<I.alias.length;K++)if(I.alias[K].toLowerCase()==$)return I}}}})},"8hTe":function(at,Xe,V){at.exports={button:"button___1wy9m"}},"9Bee":function(at,Xe,V){"use strict";var oe=V("DYRE"),Y=V("zeV3"),D=V("+L6B"),$=V("2/Rp"),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("vg9a"),P=V("DlQD"),w=V.n(P),S=V("rUJ1");function T(F,p){var y=F.match(/^(\s+)(?:```)/);if(y===null)return p;var M=y[1];return p.split(`
`).map(function(Q){var W=Q.match(/^\s+/);if(W===null)return Q;var me=Object(K.a)(W,1),$e=me[0];return $e.length>=M.length?Q.slice(M.length):Q}).join(`
`)}var h=[],l=["<ul>"],i=new w.a.Renderer,c=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function C(){h.length=0,l=["<ul>"]}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("<li><a href='#"+Q.anchor+"'>"+Q.text+"</a>"),p++;var W=[];return p=m(F,p,Q.level,W),W.length>0&&(M.push("<ul>"),W.forEach(function(me){M.push(me)}),M.push("</ul>")),M.push("</li>"),p=m(F,p,y,M),p}function u(){return m(h,0,0,l),l.push("</ul>"),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?"<p class='editormd-tex'>".concat(F,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(p,'">').concat(y?F:Object(S.escape)(F,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(y?F:Object(S.escape)(F,!0))+"</code></pre>"},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}),"<h"+p+' id="'+M+'">'+F+"</h"+p+">"},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]<Q[3])){me.label=Qe[1];break}if(Qe[0]===6&&me.label<Q[1]){me.label=Q[1],Q=Qe;break}if(Q&&me.label<Q[2]){me.label=Q[2],me.ops.push(Qe);break}Q[2]&&me.ops.pop(),me.trys.pop();continue}Qe=p.call(F,me)}catch(Vt){Qe=[6,Vt],M=0}finally{y=Q=0}if(5&Qe[0])throw Qe[1];return{value:Qe[0]?Qe[1]:void 0,done:!0}}([ct,jt])}}}function ie(){for(var F=0,p=0,y=arguments.length;p<y;p++)F+=arguments[p].length;var M=Array(F),Q=0;for(p=0;p<y;p++)for(var W=arguments[p],me=0,$e=W.length;me<$e;me++,Q++)M[Q]=W[me];return M}var q=function(){function F(){}return F.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},F.setAttributes=function(p,y){for(var M=0,Q=y;M<Q.length;M++){var W=Q[M],me=W[0],$e=W[1];p.setAttribute(me,$e)}},F.createRect=function(p,y,M){var Q=document.createElementNS("http://www.w3.org/2000/svg","rect");return Q.setAttribute("width",p.toString()),Q.setAttribute("height",y.toString()),M&&F.setAttributes(Q,M),Q},F.createLine=function(p,y,M,Q,W){var me=document.createElementNS("http://www.w3.org/2000/svg","line");return me.setAttribute("x1",p.toString()),me.setAttribute("y1",y.toString()),me.setAttribute("x2",M.toString()),me.setAttribute("y2",Q.toString()),W&&F.setAttributes(me,W),me},F.createPolygon=function(p,y){var M=document.createElementNS("http://www.w3.org/2000/svg","polygon");return M.setAttribute("points",p),y&&F.setAttributes(M,y),M},F.createCircle=function(p,y){var M=document.createElementNS("http://www.w3.org/2000/svg","circle");return M.setAttribute("cx",(p/2).toString()),M.setAttribute("cy",(p/2).toString()),M.setAttribute("r",p.toString()),y&&F.setAttributes(M,y),M},F.createEllipse=function(p,y,M){var Q=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return Q.setAttribute("cx",(p/2).toString()),Q.setAttribute("cy",(y/2).toString()),Q.setAttribute("rx",(p/2).toString()),Q.setAttribute("ry",(y/2).toString()),M&&F.setAttributes(Q,M),Q},F.createGroup=function(p){var y=document.createElementNS("http://www.w3.org/2000/svg","g");return p&&F.setAttributes(y,p),y},F.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},F.createMarker=function(p,y,M,Q,W,me,$e){var ct=document.createElementNS("http://www.w3.org/2000/svg","marker");return F.setAttributes(ct,[["id",p],["orient",y],["markerWidth",M.toString()],["markerHeight",Q.toString()],["refX",W.toString()],["refY",me.toString()]]),ct.appendChild($e),ct},F.createText=function(p){var y=document.createElementNS("http://www.w3.org/2000/svg","text");return y.setAttribute("x","0"),y.setAttribute("y","0"),p&&F.setAttributes(y,p),y},F.createTSpan=function(p,y){var M=document.createElementNS("http://www.w3.org/2000/svg","tspan");return M.textContent=p,y&&F.setAttributes(M,y),M},F.createImage=function(p){var y=document.createElementNS("http://www.w3.org/2000/svg","image");return p&&F.setAttributes(y,p),y},F.createPoint=function(p,y){var M=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return M.x=p,M.y=y,M},F.createPath=function(p,y){var M=document.createElementNS("http://www.w3.org/2000/svg","path");return M.setAttribute("d",p),y&&F.setAttributes(M,y),M},F}(),Ee=function(){function F(){}return F.addKey=function(p){F.key=p},Object.defineProperty(F,"isLicensed",{get:function(){return!!F.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(F.key)},enumerable:!1,configurable:!0}),F}(),Me=function(){function F(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return F.prototype.rasterize=function(p,y,M){var Q=this;return new Promise(function(W){var me=M!==void 0?M:document.createElement("canvas");p===null&&(Q.markersOnly=!0,Q.naturalSize=!1);var $e=document.createElementNS("http://www.w3.org/2000/svg","svg");$e.setAttribute("xmlns","http://www.w3.org/2000/svg"),$e.setAttribute("width",y.width.baseVal.valueAsString),$e.setAttribute("height",y.height.baseVal.valueAsString),$e.setAttribute("viewBox","0 0 "+y.viewBox.baseVal.width.toString()+" "+y.viewBox.baseVal.height.toString()),$e.innerHTML=y.innerHTML,Q.naturalSize===!0?($e.width.baseVal.value=p.naturalWidth,$e.height.baseVal.value=p.naturalHeight):Q.width!==void 0&&Q.height!==void 0&&($e.width.baseVal.value=Q.width,$e.height.baseVal.value=Q.height),me.width=$e.width.baseVal.value,me.height=$e.height.baseVal.value;var ct=$e.outerHTML,jt=me.getContext("2d");Q.markersOnly!==!0&&jt.drawImage(p,0,0,me.width,me.height);var Qe=window.URL,Vt=new Image(me.width,me.height);Vt.setAttribute("crossOrigin","anonymous");var hn=new Blob([ct],{type:"image/svg+xml"}),Rn=Qe.createObjectURL(hn);Vt.onload=function(){jt.drawImage(Vt,0,0),Qe.revokeObjectURL(Rn);var pr=me.toDataURL(Q.imageType,Q.imageQuality);W(pr)},Vt.src=Rn})},F}(),Ne=function(){},De=function(){function F(p){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+p+"_"}return Object.defineProperty(F.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#ffffff",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarColor:"#eeeeee",toolbarHeight:40,toolboxColor:"#eeeeee",toolboxAccentColor:"#3080c3",undoButtonVisible:!0,redoButtonVisible:!1,zoomButtonVisible:!1,zoomOutButtonVisible:!1,clearButtonVisible:!1,resultButtonBlockVisible:!0,logoPosition:"left"}},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),F.prototype.addClass=function(p){return this.styleSheet===void 0&&this.addStyleSheet(),p.name=""+this.classNamePrefix+p.localName,this.classes.push(p),this.styleSheet.sheet.insertRule("."+p.name+" {"+p.style+"}",this.styleSheet.sheet.cssRules.length),p},F.prototype.addRule=function(p){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(p),this.styleSheet.sheet.insertRule(p.selector+" {"+p.style+"}",this.styleSheet.sheet.cssRules.length)},F.prototype.addStyleSheet=function(){var p;this.styleSheet=document.createElement("style"),((p=this.styleSheetRoot)!==null&&p!==void 0?p:document.head).appendChild(this.styleSheet),this.addRule(new Be("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Be("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new Be("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new Ae("fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new Ae("fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},F.prototype.removeStyleSheet=function(){var p;this.styleSheet&&(((p=this.styleSheetRoot)!==null&&p!==void 0?p:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},F}(),Be=function(F,p){this.selector=F,this.style=p},Ae=function(F,p){this.localName=F,this.style=p},Pe=function(){function F(p,y,M,Q,W){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=p,this.displayMode=y,this.markerItems=M,this.uiStyleSettings=Q,this.styles=W,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return F.prototype.show=function(p){var y=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=p,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var M=document.createElement("div");M.className=this.toolbarBlockStyleClass.name,M.style.whiteSpace="nowrap",this.uiContainer.appendChild(M),this.addActionButton(M,'<svg viewBox="0 0 24 24"><path d="M10.07 14.27a.997.997 0 011.33.48l2.3 4.99 1.8-.85-2.31-4.98c-.24-.5-.02-1.1.48-1.33l.28-.08 2.3-.45L8 5.12V15.9l1.82-1.47.25-.16m3.57 7.7a.99.99 0 01-1.33-.47l-2.18-4.74-2.51 2.02c-.17.14-.38.22-.62.22a1 1 0 01-1-1V3a1 1 0 011-1c.24 0 .47.09.64.23l.01-.01 11.49 9.64a1.001 1.001 0 01-.44 1.75l-3.16.62 2.2 4.73c.26.5.02 1.09-.48 1.32l-3.62 1.69z"/></svg>',"select"),this.addActionButton(M,'<svg viewBox="0 0 24 24"><path d="M9 3v1H4v2h1v13a2 2 0 002 2h10a2 2 0 002-2V6h1V4h-5V3H9M7 6h10v13H7V6m2 2v9h2V8H9m4 0v9h2V8h-2z"/></svg>',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(M,'<svg viewBox="0 0 24 24"><path d="M19.36 2.72l1.42 1.42-5.72 5.71c1.07 1.54 1.22 3.39.32 4.59L9.06 8.12c1.2-.9 3.05-.75 4.59.32l5.71-5.72M5.93 17.57c-2.01-2.01-3.24-4.41-3.58-6.65l4.88-2.09 7.44 7.44-2.09 4.88c-2.24-.34-4.64-1.57-6.65-3.58z"/></svg>',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(M,'<svg viewBox="0 0 24 24"><path d="M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"/></svg>',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(M,'<svg viewBox="0 0 24 24"><path d="M18.4 10.6C16.55 9 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 017.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"/></svg>',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(M,'<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(M,'<svg viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 009.5 3 6.5 6.5 0 003 9.5 6.5 6.5 0 009.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 5 1.5-1.5-5-5m-6 0C7 14 5 12 5 9.5S7 5 9.5 5 14 7 14 9.5 12 14 9.5 14M7 9h5v1H7V9z"/></svg>',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(M,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(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='<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var 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,'<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"render"),this.addActionButton(Q,'<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},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;y<this.markerButtons.length;y++)y<p||y===p&&this.markerButtons.length-1===p?this.markerButtonBlock.appendChild(this.markerButtons[y]):(y===p&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[y]))}},F.prototype.overflowButtonClicked=function(){this.markerButtonOverflowBlock.style.display!=="none"?(this.markerButtonOverflowBlock.className=this.markerButtonOverflowBlock.className.replace(this.styles.fadeInAnimationClassName,""),this.markerButtonOverflowBlock.style.display="none"):(this.markerButtonOverflowBlock.className+=" "+this.styles.fadeInAnimationClassName,this.markerButtonOverflowBlock.style.top=this.uiContainer.offsetTop+this.overflowButton.offsetHeight+"px",this.markerButtonOverflowBlock.style.right=this.uiContainer.offsetWidth-this.overflowButton.offsetLeft-this.overflowButton.offsetWidth+2*this.uiContainer.offsetLeft+"px",this.markerButtonOverflowBlock.style.display="inline-block")},F.prototype.resetButtonStyles=function(){var p=this;this.buttons.forEach(function(y){y.className=y.className.replace(p.uiStyleSettings.toolbarButtonStyleColorsClassName?p.uiStyleSettings.toolbarButtonStyleColorsClassName:p.toolbarButtonStyleColorsClass.name,"").trim(),y.className=y.className.replace(p.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?p.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:p.toolbarActiveButtonStyleColorsClass.name,"").trim(),y.className+=" "+(p.uiStyleSettings.toolbarButtonStyleColorsClassName?p.uiStyleSettings.toolbarButtonStyleColorsClassName:p.toolbarButtonStyleColorsClass.name)})},F.prototype.addActionButton=function(p,y,M){var Q=this,W=document.createElement("div");switch(W.className=""+this.toolbarButtonStyleClass.name,W.innerHTML=y,W.setAttribute("data-action",M),W.addEventListener("click",function(){Q.actionToolbarButtonClicked(W,M)}),M){case"select":W.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":W.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":W.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":W.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":W.style.fill=this.uiStyleSettings.closeButtonColor}p.appendChild(W),this.buttons.push(W)},F.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Ae("toolbar",`
width: 100%;
flex-shrink: 0;
display: flex;
flex-direction: row;
justify-content: space-between;
height: `+this.uiStyleSettings.toolbarHeight+`px;
box-sizing: content-box;
`+(this.displayMode==="inline"?"border-top-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
`+(this.displayMode==="inline"?"border-top-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
overflow: hidden;
`)),this.toolbarStyleColorsClass=this.styles.addClass(new Ae("toolbar_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Ae("toolbar-block",`
display: inline-block;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new Ae("toolbar-overflow-block",`
position: absolute;
top: `+this.uiStyleSettings.toolbarHeight+`px;
max-width: `+2*this.uiStyleSettings.toolbarHeight+`px;
z-index: 10;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleColorsClass=this.styles.addClass(new Ae("toolbar-overflow-block_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`));var p=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Ae("toolbar_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*p)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*p)+`px;
padding: `+p+`px;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Ae("toolbar_button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Ae("toolbar_active_button",`
fill: `+this.uiStyleSettings.toolbarColor+`;
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new Be("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`)),this.styles.addRule(new Be("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`))},F.prototype.markerToolbarButtonClicked=function(p,y){this.setActiveButton(p),this.buttonClickListeners&&this.buttonClickListeners.length>0&&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||'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 01-1.5-1.5A1.5 1.5 0 0117.5 9a1.5 1.5 0 011.5 1.5 1.5 1.5 0 01-1.5 1.5m-3-4A1.5 1.5 0 0113 6.5 1.5 1.5 0 0114.5 5 1.5 1.5 0 0116 6.5 1.5 1.5 0 0114.5 8m-5 0A1.5 1.5 0 018 6.5 1.5 1.5 0 019.5 5 1.5 1.5 0 0111 6.5 1.5 1.5 0 019.5 8m-3 4A1.5 1.5 0 015 10.5 1.5 1.5 0 016.5 9 1.5 1.5 0 018 10.5 1.5 1.5 0 016.5 12M12 3a9 9 0 00-9 9 9 9 0 009 9 1.5 1.5 0 001.5-1.5c0-.39-.15-.74-.39-1-.23-.27-.38-.62-.38-1a1.5 1.5 0 011.5-1.5H16a5 5 0 005-5c0-4.42-4.03-8-9-8z"/></svg>')||this;return 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=`<svg viewBox="0 0 24 24">
<path d="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z" />
</svg>`),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||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||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||'<svg viewBox="0 0 24 24"><path d="M3 16h5v-2H3v2m6.5 0h5v-2h-5v2m6.5 0h5v-2h-5v2M3 20h2v-2H3v2m4 0h2v-2H7v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2M3 12h8v-2H3v2m10 0h8v-2h-8v2M3 4v4h18V4H3z"/></svg>')||this;return 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=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+y.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(Q!==""?'stroke-dasharray="'+Q+'"':"")+` />
</svg>`;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='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',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='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',p}(Pt),Ue=function(F){function p(y,M,Q,W){var me=F.call(this,y,W||'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1l-3.5 7H18V9M5 3h5c1.11 0 2 .89 2 2v11H9v-5H6v5H3V5c0-1.11.89-2 2-2m1 2v4h3V5H6z"/></svg>')||this;return 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='<svg viewBox="0 0 24 24"><path d="M9.6 14L12 7.7l2.4 6.3M11 5L5.5 19h2.2l1.1-3H15l1.1 3h2.2L13 5h-2z"/></svg>',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;jt<this.canvasElement.height;jt++)for(var Qe=0;Qe<this.canvasElement.width;Qe++)y.data[jt*this.canvasElement.width*4+4*Qe+3]>0&&(ct=!0,jt<W&&(W=jt),Qe<Q&&(Q=Qe),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='<svg viewBox="0 0 24 24"><path d="M9.75 20.85c1.78-.7 1.39-2.63.49-3.85-.89-1.25-2.12-2.11-3.36-2.94A9.817 9.817 0 014.54 12c-.28-.33-.85-.94-.27-1.06.59-.12 1.61.46 2.13.68.91.38 1.81.82 2.65 1.34l1.01-1.7C8.5 10.23 6.5 9.32 4.64 9.05c-1.06-.16-2.18.06-2.54 1.21-.32.99.19 1.99.77 2.77 1.37 1.83 3.5 2.71 5.09 4.29.34.33.75.72.95 1.18.21.44.16.47-.31.47-1.24 0-2.79-.97-3.8-1.61l-1.01 1.7c1.53.94 4.09 2.41 5.96 1.79m11.09-15.6c.22-.22.22-.58 0-.79l-1.3-1.3a.562.562 0 00-.78 0l-1.02 1.02 2.08 2.08M11 10.92V13h2.08l6.15-6.15-2.08-2.08L11 10.92z"/></svg>',p}(ft),fe=function(F){function p(y,M,Q){var W=F.call(this,y,Q||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||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=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
<polygon points="0,5 10,0 10,10" fill="`+(W.uiStyleSettings!==void 0?W.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,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=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
<polygon points="0,0 10,5 0,10" fill="`+(W.uiStyleSettings!==void 0?W.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,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='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',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='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',p}(nt),re=function(F){function p(y,M,Q,W){var me=F.call(this,y,W||'<svg viewBox="0 0 24 24"><path d="M17.66 8L12 2.35 6.34 8A8.02 8.02 0 004 13.64c0 2 .78 4.11 2.34 5.67a7.99 7.99 0 0011.32 0c1.56-1.56 2.34-3.67 2.34-5.67S19.22 9.56 17.66 8M6 14c0-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 18 12 18 14H6z"/></svg>')||this;return 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='<svg viewBox="0 0 24 24"><path d="M18.5 1.15c-.53 0-1.04.19-1.43.58l-5.81 5.82 5.65 5.65 5.82-5.81c.77-.78.77-2.04 0-2.83l-2.84-2.83c-.39-.39-.89-.58-1.39-.58M10.3 8.5l-5.96 5.96c-.78.78-.78 2.04.02 2.85C3.14 18.54 1.9 19.77.67 21h5.66l.86-.86c.78.76 2.03.75 2.81-.02l5.95-5.96"/></svg>',p}(ne),de='<svg viewBox="0 0 24 24"><path d="M19 11.5s-2 2.17-2 3.5a2 2 0 002 2 2 2 0 002-2c0-1.33-2-3.5-2-3.5M5.21 10L10 5.21 14.79 10m1.77-1.06L7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.56-.59 1.53 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.59.59-1.56 0-2.12z"/></svg>',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,'<svg viewBox="0 0 24 24"><path d="M9.62 12L12 5.67 14.37 12M11 3L5.5 17h2.25l1.12-3h6.25l1.13 3h2.25L13 3h-2z"/></svg>'),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.height/2?W<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(Q=this.width/5,M=Math.min(this.width/2,15),this.tipBase1Position={x:M,y:0},this.tipBase2Position={x:M+Q,y:0}):(this.tipBase1Position={x:0,y:M},this.tipBase2Position={x:0,y:M+Q}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?W<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(Q=this.width/5,M=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-M-Q,y:0},this.tipBase2Position={x:this.width-M,y:0}):(this.tipBase1Position={x:this.width,y:M},this.tipBase2Position={x:this.width,y:M+Q}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?W<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(Q=this.width/5,M=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-M-Q,y:this.height},this.tipBase2Position={x:this.width-M,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-M-Q},this.tipBase2Position={x:this.width,y:this.height-M}):W<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(Q=this.width/5,M=Math.min(this.width/2,15),this.tipBase1Position={x:M,y:this.height},this.tipBase2Position={x:M+Q,y:this.height}):(this.tipBase1Position={x:0,y:this.height-M},this.tipBase2Position={x:0,y:this.height-M-Q})},p.prototype.resize=function(y){F.prototype.resize.call(this,y),this.positionTip()},p.prototype.positionTip=function(){q.setAttributes(this.tip,[["points",this.getTipPoints()]]);var y=this.tipGrip.visual.transform.baseVal.getItem(0);y.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(y,0)},Object.defineProperty(p.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),p.prototype.select=function(){this.positionTip(),F.prototype.select.call(this)},p.prototype.getState=function(){var y=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},F.prototype.getState.call(this));return y.typeName=p.typeName,y},p.prototype.restoreState=function(y){var M=y;this.bgColor=M.bgColor,this.tipPosition=M.tipPosition,F.prototype.restoreState.call(this,y),this.createTip(),this.setTipPoints()},p.prototype.scale=function(y,M){F.prototype.scale.call(this,y,M),this.tipPosition={x:this.tipPosition.x*y,y:this.tipPosition.y*M},this.positionTip()},p.typeName="CalloutMarker",p.title="Callout marker",p.icon='<svg viewBox="0 0 24 24"><path d="M4 2h16a2 2 0 012 2v12a2 2 0 01-2 2h-4l-4 4-4-4H4a2 2 0 01-2-2V4a2 2 0 012-2m0 2v12h4.83L12 19.17 15.17 16H20V4H4m2 3h12v2H6V7m0 4h10v2H6v-2z"/></svg>',p}(Ze),we=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.strokeColor=Q.defaultColor,W.strokeWidth=Q.defaultStrokeWidth,W.strokeDasharray=Q.defaultStrokeDasharray,W.fillColor=Q.defaultFillColor,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.setOpacity=W.setOpacity.bind(W),W.createVisual=W.createVisual.bind(W),W.strokePanel=new qe("Line color",ie(Q.defaultColorSet,["transparent"]),Q.defaultColor),W.strokePanel.onColorChanged=W.setStrokeColor,W.fillPanel=new qe("Fill color",ie(Q.defaultColorSet,["transparent"]),W.fillColor,de),W.fillPanel.onColorChanged=W.setFillColor,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.opacityPanel=new re("Opacity",Q.defaultOpacitySteps,W.opacity),W.opacityPanel.onOpacityChanged=W.setOpacity,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.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},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,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).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.fillColorChanged(y),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.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.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),p.prototype.getState=function(){var y=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},F.prototype.getState.call(this));return y.typeName=p.typeName,y},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.typeName="EllipseMarker",p.title="Ellipse marker",p.icon='<svg viewBox="0 0 24 24"><path d="M12 4C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',p}(ft),Le=function(F){function p(y,M,Q){return F.call(this,y,M,Q)||this}return le(p,F),Object.defineProperty(p.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),p.prototype.ownsTarget=function(y){return!(!F.prototype.ownsTarget.call(this,y)&&y!==this.tip1&&y!==this.tip2)},p.prototype.createTips=function(){this.tip1=q.createLine(this.x1-this.tipLength/2,this.y1,this.x1+this.tipLength/2,this.y1,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip1.transform.baseVal.appendItem(q.createTransform()),this.visual.appendChild(this.tip1),this.tip2=q.createLine(this.x2-this.tipLength/2,this.y2,this.x2+this.tipLength/2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip2.transform.baseVal.appendItem(q.createTransform()),this.visual.appendChild(this.tip2)},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.tip1&&this.tip2&&(q.setAttributes(this.tip1,[["x1",(this.x1-this.tipLength/2).toString()],["y1",this.y1.toString()],["x2",(this.x1+this.tipLength/2).toString()],["y2",this.y1.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),q.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var 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='<svg viewBox="0 0 24 24"><path d="M1.39 18.36l1.77-1.76L4.58 18l1.06-1.05-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.42 1.41L10.59 12l-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.41 1.41 1.07-1.06-1.42-1.41 1.42-1.42L18 6.7l1.07-1.06-2.47-2.48 1.76-1.77 4.25 4.25L5.64 22.61l-4.25-4.25z"/></svg>',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='<svg viewBox="0 0 24 24"><path d="M12 6c4.41 0 8 2.69 8 6s-3.59 6-8 6-8-2.69-8-6 3.59-6 8-6m0-2C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',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='<svg viewBox="0 0 24 24"><path d="M18.5 2A1.5 1.5 0 0120 3.5 1.5 1.5 0 0118.5 5c-.23 0-.45-.05-.65-.15l-3.69 3.7.34.45c2.19-1.26 4.76-2 7.5-2l1 .03v2.01L22 9c-2.58 0-5 .75-7 2.04A3.96 3.96 0 0111.04 15C9.75 17 9 19.42 9 22l.04 1H7.03L7 22c0-2.74.74-5.31 2-7.5l-.45-.34-3.7 3.69c.1.2.15.42.15.65A1.5 1.5 0 013.5 20 1.5 1.5 0 012 18.5 1.5 1.5 0 013.5 17c.23 0 .45.05.65.15l3.69-3.7C7.31 12.78 7 11.92 7 11a4 4 0 014-4c.92 0 1.78.31 2.45.84l3.7-3.69c-.1-.2-.15-.42-.15-.65A1.5 1.5 0 0118.5 2M11 9a2 2 0 00-2 2 2 2 0 002 2 2 2 0 002-2 2 2 0 00-2-2z"/></svg>',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;M<arguments.length;M++)y[M]=arguments[M];(p=this._availableMarkerTypes).push.apply(p,y)},F.prototype.addRenderEventListener=function(p){this.addEventListener("render",function(y){p(y.dataUrl,y.state)})},F.prototype.removeRenderEventListener=function(p){},F.prototype.addCloseEventListener=function(p){this.addEventListener("close",function(){p()})},F.prototype.removeCloseEventListener=function(p){},F.prototype.setupResizeObserver=function(){var p=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){p.resize(p.target.clientWidth,p.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return p.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},F.prototype.onPopupTargetResize=function(){var p=1*this.target.clientWidth/this.target.clientHeight,y=this.editorCanvas.clientWidth/p>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*p:this.editorCanvas.clientWidth,M=y<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/p;this.resize(y,M)},F.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},F.prototype.resize=function(p,y){this._isResizing=!0;var M=p/this.imageWidth,Q=y/this.imageHeight;this.imageWidth=Math.round(p),this.imageHeight=Math.round(y),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px",this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.settings.displayMode!=="popup"?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),this.toolbar!==void 0&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(M,Q),this._isResizing=!1},F.prototype.scaleMarkers=function(p,y){var M,Q=this;this._currentMarker&&this._currentMarker instanceof Ze?this._currentMarker.scale(p,y):(M=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(W){W!==Q._currentMarker&&W.scale(p,y)}),M!==void 0&&this.setCurrentMarker(M)},F.prototype.setEditingTarget=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px"},F.prototype.setTopLeft=function(){var p=this.editingTarget.getBoundingClientRect(),y=this.editorCanvas.getBoundingClientRect();this.left=p.left-y.left,this.top=p.top-y.top},F.prototype.initMarkerCanvas=function(){this.markerImageHolder=document.createElement("div"),this.markerImageHolder.style.setProperty("touch-action","pinch-zoom"),this.markerImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.markerImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImage.style.pointerEvents="auto",this.markerImageHolder.style.position="absolute",this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.markerImageHolder.style.transformOrigin="top left",this.positionMarkerImage(),this.markerImageHolder.appendChild(this.markerImage),this.editorCanvas.appendChild(this.markerImageHolder)},F.prototype.addDefs=function(){for(var p,y=[],M=0;M<arguments.length;M++)y[M]=arguments[M];this.defs=q.createDefs(),this.addDefsToImage(),(p=this.defs).append.apply(p,y)},F.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},F.prototype.initOverlay=function(){this.overlayContainer=document.createElement("div"),this.overlayContainer.style.position="absolute",this.overlayContainer.style.left="0px",this.overlayContainer.style.top="0px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.overlayContainer.style.display="flex",this.markerImageHolder.appendChild(this.overlayContainer)},F.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},F.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},F.prototype.attachWindowEvents=function(){window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp),window.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("pointerout",this.onPointerOut),window.addEventListener("pointerleave",this.onPointerUp),window.addEventListener("resize",this.onWindowResize),window.addEventListener("keyup",this.onKeyUp)},F.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},F.prototype.detachWindowEvents=function(){window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("pointerout",this.onPointerOut),window.removeEventListener("pointerleave",this.onPointerUp),window.removeEventListener("resize",this.onWindowResize),window.removeEventListener("keyup",this.onKeyUp)},F.prototype.addLogo=function(){this.logoUI=document.createElement("div"),this.logoUI.style.display="inline-block",this.logoUI.style.margin="0px",this.logoUI.style.padding="0px",this.logoUI.style.fill="#333333";var p=document.createElement("a");p.href="https://markerjs.com/",p.target="_blank",p.innerHTML='<svg viewBox="0 0 112 96" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path fill="#e5f20d" fill-opacity=".647" d="M0 40.386h111.96V95.62H0z"/><path d="M93.61 61.452c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.591 1.048-1.481 0-2.222-.74-2.222-2.22 0-16.617-.533-29.347-1.604-38.192-1.068-8.842-2.92-13.265-5.552-13.265-4.443 0-10.94 15.509-19.497 46.52v.124c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.592 1.048-1.48 0-2.22-.74-2.22-2.22 0-3.29.165-8.392.493-15.302.33-7.732.494-13.82.494-18.262 0-6.17-.186-10.55-.556-13.142-.37-2.591-1.172-3.887-2.406-3.887-2.796 0-6.333 5.12-10.612 15.363C38.494 34.367 34.01 46.44 29.32 60.34l-1.11 3.209a5.714 5.714 0 01-1.42 2.097c-.617.578-1.295.864-2.036.864-.987 0-1.644-.081-1.974-.247-.328-.162-.533-.656-.617-1.48-.41-4.03-.74-9.418-.987-16.165-.163-1.728-.329-4.566-.494-8.515-.822-13.901-1.562-23.3-2.221-28.196-.657-4.893-.987-7.628-.987-8.205 0-.657.33-1.44.987-2.345.659-.903 1.276-1.357 1.85-1.357 1.319 0 2.387.947 3.21 2.838.411.906.863 4.526 1.357 10.859.493 6.335.905 14.19 1.233 23.568l.617 18.88c4.527-13.983 9.216-26.673 14.068-38.068C45.65 6.686 50.093.988 54.123.988c2.715 0 4.566 1.974 5.553 5.923.987 3.949 1.481 9.667 1.481 17.152 0 3.949-.081 9.625-.247 17.029l-.123 5.676c3.373-11.762 6.725-21.634 10.057-29.615 3.331-7.979 6.685-11.97 10.056-11.97 8.475 0 12.71 18.757 12.71 56.269z" fill-rule="nonzero"/></svg>',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<this.styles.settings.toolbarHeight&&(this.editingTarget.style.marginTop=this.target.offsetTop-this.styles.settings.toolbarHeight+"px"),this.editorCanvas.appendChild(this.editingTarget),this.toolbox=new Fe(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},F.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},F.prototype.removeMarker=function(p){this.markerImage.removeChild(p.container),this.markers.indexOf(p)>-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),Q<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(W){return W(new Dt(p))})}else this.undoRedoManager.replaceLastUndoStep(y),this.eventListeners.statechange.forEach(function(W){return W(new Dt(p))})}},F.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},F.prototype.undoStep=function(){var p=this,y=this.undoRedoManager.undo();y!==void 0&&(this.restoreState(y),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(M){return M(new Dt(p))}))},F.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},F.prototype.redoStep=function(){var p=this,y=this.undoRedoManager.redo();y!==void 0&&(this.restoreState(y),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(M){return M(new Dt(p))}))},F.prototype.stepZoom=function(){var p=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=p<this.zoomSteps.length-1?this.zoomSteps[p+1]:this.zoomSteps[0]},F.prototype.panTo=function(p){this.contentDiv.scrollBy({left:this.prevPanPoint.x-p.x,top:this.prevPanPoint.y-p.y}),this.prevPanPoint=p},F.prototype.startRenderAndClose=function(){return se(this,void 0,void 0,function(){var p,y,M=this;return ge(this,function(Q){switch(Q.label){case 0:return[4,this.render()];case 1:return p=Q.sent(),y=this.getState(),this.eventListeners.render.forEach(function(W){return W(new ut(M,p,y))}),this.close(!0),[2]}})})},F.prototype.getState=function(p){p===!0&&this.setCurrentMarker();var y={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(M){return y.markers.push(M.getState())}),y},F.prototype.restoreState=function(p){var y=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);p.markers.forEach(function(M){var Q=y._availableMarkerTypes.find(function(me){return me.typeName===M.typeName});if(Q!==void 0){var W=y.addNewMarker(Q);W.restoreState(M),y.markers.push(W)}}),p.width&&p.height&&(p.width!==this.imageWidth||p.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/p.width,this.imageHeight/p.height),this.eventListeners.restorestate.forEach(function(M){return M(new Dt(y))})},F.prototype.addNewMarker=function(p){var y=q.createGroup();return this.markerImage.appendChild(y),new p(y,this.overlayContainer,this.settings)},F.prototype.createNewMarker=function(p){var y,M=this;(y=typeof p=="string"?this._availableMarkerTypes.find(function(Q){return Q.typeName===p}):p)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(y),this._currentMarker.onMarkerCreated=this.markerCreated,this._currentMarker.onColorChanged=this.colorChanged,this._currentMarker.onFillColorChanged=this.fillColorChanged,this._currentMarker.onStateChanged=this.markerStateChanged,this.markerImage.style.cursor="crosshair",this.toolbar.setActiveMarkerButton(y.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(Q){return Q(new mt(M,M._currentMarker))}))},F.prototype.markerCreated=function(p){var y=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(p),this.setCurrentMarker(p),p instanceof xe&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(xe):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(M){return M(new mt(y,y._currentMarker))})},F.prototype.colorChanged=function(p){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=p,this.settings.defaultStrokeColor=p)},F.prototype.fillColorChanged=function(p){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=p)},F.prototype.markerStateChanged=function(p){var y=this;this.eventListeners.markerchange.forEach(function(M){return M(new mt(y,p))})},F.prototype.setCurrentMarker=function(p){var y=this;this._currentMarker!==p&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(M){return M(new mt(y,y._currentMarker))})),this._currentMarker=p,this._currentMarker===void 0||this._currentMarker.isSelected||(this._currentMarker.state!=="new"&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach(function(M){return M(new mt(y,y._currentMarker))}))},F.prototype.onPointerDown=function(p){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||p.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var y=this.markers.find(function(M){return M.ownsTarget(p.target)});y!==void 0?(this.setCurrentMarker(y),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(p.clientX,p.clientY),p.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:p.clientX,y:p.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(p.clientX,p.clientY))},F.prototype.onDblClick=function(p){if(this._isFocused||this.focus(),this.mode==="select"){var y=this.markers.find(function(M){return M.ownsTarget(p.target)});y!==void 0&&y!==this._currentMarker&&this.setCurrentMarker(y),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(p.clientX,p.clientY),p.target):this.setCurrentMarker()}},F.prototype.onPointerMove=function(p){this.touchPoints!==1&&p.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||p.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(p.clientX,p.clientY)):this.zoomLevel>1&&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]<Q[3])){me.label=Qe[1];break}if(Qe[0]===6&&me.label<Q[1]){me.label=Q[1],Q=Qe;break}if(Q&&me.label<Q[2]){me.label=Q[2],me.ops.push(Qe);break}Q[2]&&me.ops.pop(),me.trys.pop();continue}Qe=p.call(F,me)}catch(Vt){Qe=[6,Vt],M=0}finally{y=Q=0}if(5&Qe[0])throw Qe[1];return{value:Qe[0]?Qe[1]:void 0,done:!0}}([ct,jt])}}}var Qt=function(){function F(){}return F.addKey=function(p){F.key=p},Object.defineProperty(F,"isLicensed",{get:function(){return!!F.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(F.key)},enumerable:!1,configurable:!0}),F}(),ot=function(){function F(){}return F.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},F.setAttributes=function(p,y){for(var M=0,Q=y;M<Q.length;M++){var W=Q[M],me=W[0],$e=W[1];p.setAttribute(me,$e)}},F.createRect=function(p,y,M){var Q=document.createElementNS("http://www.w3.org/2000/svg","rect");return Q.setAttribute("width",p.toString()),Q.setAttribute("height",y.toString()),M&&F.setAttributes(Q,M),Q},F.createLine=function(p,y,M,Q,W){var me=document.createElementNS("http://www.w3.org/2000/svg","line");return me.setAttribute("x1",p.toString()),me.setAttribute("y1",y.toString()),me.setAttribute("x2",M.toString()),me.setAttribute("y2",Q.toString()),W&&F.setAttributes(me,W),me},F.createPolygon=function(p,y){var M=document.createElementNS("http://www.w3.org/2000/svg","polygon");return M.setAttribute("points",p),y&&F.setAttributes(M,y),M},F.createCircle=function(p,y){var M=document.createElementNS("http://www.w3.org/2000/svg","circle");return M.setAttribute("cx",(p/2).toString()),M.setAttribute("cy",(p/2).toString()),M.setAttribute("r",p.toString()),y&&F.setAttributes(M,y),M},F.createEllipse=function(p,y,M){var Q=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return Q.setAttribute("cx",(p/2).toString()),Q.setAttribute("cy",(y/2).toString()),Q.setAttribute("rx",(p/2).toString()),Q.setAttribute("ry",(y/2).toString()),M&&F.setAttributes(Q,M),Q},F.createGroup=function(p){var y=document.createElementNS("http://www.w3.org/2000/svg","g");return p&&F.setAttributes(y,p),y},F.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},F.createMarker=function(p,y,M,Q,W,me,$e){var ct=document.createElementNS("http://www.w3.org/2000/svg","marker");return F.setAttributes(ct,[["id",p],["orient",y],["markerWidth",M.toString()],["markerHeight",Q.toString()],["refX",W.toString()],["refY",me.toString()]]),ct.appendChild($e),ct},F.createText=function(p){var y=document.createElementNS("http://www.w3.org/2000/svg","text");return y.setAttribute("x","0"),y.setAttribute("y","0"),p&&F.setAttributes(y,p),y},F.createTSpan=function(p,y){var M=document.createElementNS("http://www.w3.org/2000/svg","tspan");return M.textContent=p,y&&F.setAttributes(M,y),M},F.createImage=function(p){var y=document.createElementNS("http://www.w3.org/2000/svg","image");return p&&F.setAttributes(y,p),y},F.createPoint=function(p,y){var M=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return M.x=p,M.y=y,M},F.createPath=function(p,y){var M=document.createElementNS("http://www.w3.org/2000/svg","path");return M.setAttribute("d",p),y&&F.setAttributes(M,y),M},F.createElement=function(p,y){var M=document.createElementNS("http://www.w3.org/2000/svg",p);return y&&F.setAttributes(M,y),M},F.getHollowRectanglePath=function(p,y,M,Q,W,me,$e,ct){return"M"+p+","+y+"V"+(y+Q)+"H"+(p+M)+"V"+y+"H"+W+"V"+me+"H"+(W+$e)+"V"+(me+ct)+"H"+W+"V"+y+"Z"},F}(),Ft=function(){function F(p){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+p+"_"}return Object.defineProperty(F.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#333333",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarBackgroundActiveColor:"#282828",toolbarColor:"#eeeeee",cropShadeColor:"#ffffff",cropFrameColor:"#ffffff",gripColor:"#333333",gripFillColor:"#cccccc",toolbarHeight:40}},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),F.prototype.addClass=function(p){return this.styleSheet===void 0&&this.addStyleSheet(),p.name=""+this.classNamePrefix+p.localName,this.classes.push(p),this.styleSheet.sheet.insertRule("."+p.name+" {"+p.style+"}",this.styleSheet.sheet.cssRules.length),p},F.prototype.addRule=function(p){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(p),this.styleSheet.sheet.insertRule(p.selector+" {"+p.style+"}",this.styleSheet.sheet.cssRules.length)},F.prototype.addStyleSheet=function(){var p;this.styleSheet=document.createElement("style"),((p=this.styleSheetRoot)!==null&&p!==void 0?p:document.head).appendChild(this.styleSheet),this.addRule(new xt("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new xt("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new xt("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new kt("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new kt("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},F.prototype.removeStyleSheet=function(){var p;this.styleSheet&&(((p=this.styleSheetRoot)!==null&&p!==void 0?p:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},F}(),xt=function(F,p){this.selector=F,this.style=p},kt=function(F,p){this.localName=F,this.style=p},Mt=function(){function F(){this.blocks=[],this.display=""}return F.prototype.addButtonBlock=function(p){p.className=this.blockClassName,p.buttonClassName=this.buttonClassName,p.buttonColorsClassName=this.buttonColorsClassName,p.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(p)},F.prototype.addElementBlock=function(p){p.className===void 0&&(p.className=this.blockClassName),this.blocks.push(p)},F.prototype.getUI=function(){var p=document.createElement("div");return p.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,p.style.display=this.display,this.blocks.forEach(function(y){return p.appendChild(y.getUI())}),p},F}(),It=function(){function F(){}return F.prototype.getUI=function(){var p=document.createElement("div");if(p.className=this.className,this.minWidth!==void 0&&(p.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":p.style.justifyContent="flex-start";break;case"center":p.style.justifyContent="center";break;case"end":p.style.justifyContent="flex-end"}return p.style.whiteSpace="nowrap",p},F}(),Lt=function(F){function p(){var y=F!==null&&F.apply(this,arguments)||this;return y.buttons=[],y}return sn(p,F),p.prototype.addButton=function(y){y.className=this.buttonClassName,y.colorsClassName=this.buttonColorsClassName,y.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(y)},p.prototype.getUI=function(){var y=F.prototype.getUI.call(this);return this.buttons.forEach(function(M){return y.appendChild(M.getUI())}),y},p}(It),st=function(){function F(p,y){this._isActive=!1,this._isHidden=!1,this._icon=p,this.title=y,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(F.prototype,"icon",{get:function(){return this._icon},set:function(p){this._icon=p,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"isActive",{get:function(){return this._isActive},set:function(p){this._isActive=p,this.adjustClassName()},enumerable:!1,configurable:!0}),F.prototype.getUI=function(){var p=this;return this.buttonContainer=document.createElement("div"),this.buttonContainer.title=this.title,this.buttonContainer.className=this.className+" "+this.colorsClassName,this.adjustClassName(),this.buttonContainer.innerHTML=this._icon,this.onClick&&this.buttonContainer.addEventListener("click",function(){return p.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},F.prototype.adjustClassName=function(){this.activeColorsClassName&&(this._isActive&&this.buttonContainer.className.indexOf(this.activeColorsClassName)<0?this.buttonContainer.className+=" "+this.activeColorsClassName:this._isActive||(this.buttonContainer.className=this.buttonContainer.className.replace(this.activeColorsClassName,"")))},F.prototype.hide=function(){this._isHidden=!0},F}(),Ve=function(F){function p(){var y=F!==null&&F.apply(this,arguments)||this;return y.elements=[],y}return sn(p,F),p.prototype.addElement=function(y){this.elements.push(y)},p.prototype.getUI=function(){var y=F.prototype.getUI.call(this);return this.elements.forEach(function(M){return y.appendChild(M)}),y},p}(It),ln=function(){function F(p,y){this.horizontal=p,this.vertical=y}return Object.defineProperty(F.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),F.prototype.getVerticalLength=function(p){return p/this.ratio},F.prototype.getHorizontalLength=function(p){return p*this.ratio},F}(),$t=function(){function F(){}return F.getIcon=function(p,y){if(p>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'<svg viewBox="0 0 24 24"><path d="M19 12h-2v3h-3v2h5v-5M7 9h3V7H5v5h2V9m14-6H3a2 2 0 00-2 2v14a2 2 0 002 2h18a2 2 0 002-2V5a2 2 0 00-2-2m0 16H3V5h18v14z"/></svg>'},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;y<this.numberOfGridLines;y++)this.horizontalGridLines.push(ot.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(ot.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(M){return p.gridContainer.appendChild(M)}),this.verticalGridLines.forEach(function(M){return p.gridContainer.appendChild(M)}),this.cropRectElement=ot.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new qt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new qt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new qt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new qt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},F.prototype.setCropRectangle=function(p){this.cropRect=p;var y=Object.assign({},this.cropRect);this.zoomFactor!==1&&(y.width=this.cropRect.width*this.zoomFactor,y.height=this.cropRect.height*this.zoomFactor,y.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-y.width/2,y.y=this.cropRect.height/this.cropRect.width>this.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+M<this.margin&&(M=this.margin-y.x),y.x+=M,y.width=this.cropRect.x+this.cropRect.width-y.x;break;case this.bottomRightGrip:case this.topRightGrip:y.width+M>this.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.canvasWidth<Q/this.canvasHeight?this.cropRect.width=M:this.cropRect.height=Q,this.cropRect.width>this.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=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="&deg;",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_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/p;this.resize(y,M)}},F.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},F.prototype.setEditingTargetSize=function(){this.editorCanvas.style.width=this.imageWidth+2*this.CANVAS_MARGIN+"px",this.editorCanvas.style.height=this.imageHeight+2*this.CANVAS_MARGIN+"px",ot.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},F.prototype.resize=function(p,y){this.imageWidth=Math.round(p),this.imageHeight=Math.round(y),this.setEditingTargetSize(),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.displayMode!=="popup"?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},F.prototype.setEditingTarget=function(){var p=document.createElement("canvas");p.width=this.target.naturalWidth,p.height=this.target.naturalHeight,p.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var y=p.toDataURL();ot.setAttributes(this.editingTarget,[["href",y]]),this.setEditingTargetSize()},F.prototype.setTopLeft=function(){var p=this.target.getBoundingClientRect(),y=this.editorCanvas.getBoundingClientRect();this.left=p.left-y.left-this.CANVAS_MARGIN,this.top=p.top-y.top-this.CANVAS_MARGIN},F.prototype.initCropCanvas=function(){this.cropImageHolder=document.createElement("div"),this.cropImageHolder.style.setProperty("touch-action","none"),this.cropImageHolder.style.setProperty("-ms-touch-action","none"),this.cropImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.cropImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImage.style.pointerEvents="auto",this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.cropImageHolder.style.transformOrigin="top left",this.positionCropImage(),this.defs=ot.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=ot.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=ot.createGroup(),this.editingTargetRotationScaleContainer=ot.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var p=ot.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(p);var y=ot.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(y),this.editingTargetContainer=ot.createGroup(),this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px)",this.editingTargetContainer.appendChild(this.editingTargetRotationContainer),this.cropImage.appendChild(this.editingTargetContainer),this.cropImageHolder.appendChild(this.cropImage),this.editorCanvas.appendChild(this.cropImageHolder)},F.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},F.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=ot.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new En(this.imageWidth,this.imageHeight,this.CANVAS_MARGIN,this.cropLayerContainer),this.cropLayer.onCropChange=this.cropRectChanged,this.cropLayer.numberOfGridLines=this.gridLines,this.cropLayer.isGridVisible=this.isGridVisible,this.cropLayer.cropShadeColor=this.styles.settings.cropShadeColor,this.cropLayer.cropFrameColor=this.styles.settings.cropFrameColor,this.cropLayer.gripColor=this.styles.settings.gripColor,this.cropLayer.gripFillColor=this.styles.settings.gripFillColor,this.cropLayer.open(),this.cropLayer.setCropRectangle(this.cropRect),this.zoomToCropEnabled&&this.zoomToCrop()},F.prototype.zoomToCrop=function(){if(this.cropRect){var p=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,y=this.cropRect.y-this.CANVAS_MARGIN+this.cropRect.height/2;this.zoomFactor=Math.min(this.imageWidth/this.cropRect.width,this.imageHeight/this.cropRect.height),this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin=p+"px "+y+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-p+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-y+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},F.prototype.unzoomFromCrop=function(){this.zoomFactor=1,this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin="center",this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px) scale(1)",this.cropLayer.zoomFactor=this.zoomFactor)},F.prototype.cropRectChanged=function(p){this.cropRect=p,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},F.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},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.addStyles(),this.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.displayMode){case"inline":this.coverDiv.style.position="absolute";var p=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,y=this.target.offsetTop>p+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('<svg viewBox="0 0 24 24"><path d="M10 4v4h4V4h-4m6 0v4h4V4h-4m0 6v4h4v-4h-4m0 6v4h4v-4h-4m-2 4v-4h-4v4h4m-6 0v-4H4v4h4m0-6v-4H4v4h4m0-6V4H4v4h4m2 6h4v-4h-4v4M4 2h16a2 2 0 012 2v16a2 2 0 01-2 2H4c-1.08 0-2-.9-2-2V4a2 2 0 012-2z"/></svg>',"Toggle grid");Q.isActive=this.isGridVisible,Q.onClick=function(){p.isGridVisible=!p.isGridVisible,Q.isActive=p.isGridVisible},y.addButton(Q);var W=new st('<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"Zoom to selection");if(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='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M16.326 14.895c0 1.126-.558 1.688-1.673 1.688H9.931c-1.116 0-1.674-.562-1.674-1.688V3.733c0-1.126.558-1.688 1.674-1.688h4.722c1.115 0 1.673.562 1.673 1.688v2.899h-1.957V3.793h-4.124v11.042h4.124v-3.242h1.957v3.302z" fill="currentColor"/><path d="M15.94 7.364a.783.783 0 00-1.065-.304l-11.01 6.126a.783.783 0 00-.303 1.065l4.498 8.085a.783.783 0 001.065.304l11.01-6.126a.783.783 0 00.303-1.065L15.94 7.364zM5.311 14.173l3.737 6.718 9.641-5.364-3.737-6.718-9.641 5.364z" fill="#eef762"/></svg>',$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('<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"OK");Qe.onClick=this.startRenderAndClose,jt.addButton(Qe),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Qe.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Vt=new st('<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"Close");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('<svg viewBox="0 0 24 24"><path d="M13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93M7.1 18.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32M6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47m1.02-4.47L5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47z"/></svg>',"Rotate left");M.onClick=this.rotateLeftButtonClicked,y.addButton(M);var Q=new st('<svg viewBox="0 0 24 24"><path d="M16.89 15.5l1.42 1.39c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.5M13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03m6.93-6.9a7.906 7.906 0 00-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47m-2.36-5.45L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45z"/></svg>',"Rotate right");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('<svg viewBox="0 0 24 24"><path d="M15 21h2v-2h-2m4-10h2V7h-2M3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2m16-2v2h2c0-1.1-.9-2-2-2m-8 20h2V1h-2m8 16h2v-2h-2M15 5h2V3h-2m4 10h2v-2h-2m0 10c1.1 0 2-.9 2-2h-2z"/></svg>',"Flip horizontal");$e.onClick=this.flipHorizontallyButtonClicked,me.addButton($e);var ct=new st('<svg viewBox="0 0 24 24"><path d="M3 15v2h2v-2m10 4v2h2v-2m2-16H5c-1.1 0-2 .9-2 2v4h2V5h14v4h2V5c0-1.1-.9-2-2-2m2 16h-2v2c1.1 0 2-.9 2-2M1 11v2h22v-2M7 19v2h2v-2m10-4v2h2v-2m-10 4v2h2v-2M3 19c0 1.1.9 2 2 2v-2z"/></svg>',"Flip vertical");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=/<pre[^>]*>/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("<p>[TOC]</p>",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;P<L.length;P++){if(!L[P].empty())return oe.Pass;var w=L[P].head,S=O.getTokenAt(w),T=oe.innerMode(O.getMode(),S.state),h=T.state,l=T.mode.xmlCurrentTag&&T.mode.xmlCurrentTag(h),i=l&&l.name;if(!i)return oe.Pass;var c=T.mode.configuration=="html",C=typeof A=="object"&&A.dontCloseTags||c&&Y,v=typeof A=="object"&&A.indentTags||c&&D;S.end>w.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?`
`:"")+"</"+i+">",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?"/":"</",w=O.getOption("autoCloseTags"),S=typeof w=="object"&&w.dontIndentOnSlash,T=0;T<x.length;T++){if(!x[T].empty())return oe.Pass;var h=x[T].head,l=O.getTokenAt(h),i=oe.innerMode(O.getMode(),l.state),c=i.state;if(L&&(l.type=="string"||l.string.charAt(0)!="<"||l.start!=h.ch-1))return oe.Pass;var C,v=i.mode.name!="xml"&&O.getMode().name=="htmlmixed";if(v&&i.mode.name=="javascript")C=P+"script";else if(v&&i.mode.name=="css")C=P+"style";else{var m=i.mode.xmlCurrentContext&&i.mode.xmlCurrentContext(c);if(!m||m.length&&N(O,m,m[m.length-1],h))return oe.Pass;C=P+m[m.length-1]}O.getLine(h.line).charAt(l.end)!=">"&&(C+=">"),A[T]=C}if(O.replaceSelections(A),x=O.listSelections(),!S)for(var T=0;T<x.length;T++)(T==x.length-1||x[T].head.line<x[T+1].head.line)&&O.indentLine(x[T].head.line)}function I(O){return O.getOption("disableInput")?oe.Pass:U(O,!0)}oe.commands.closeTag=function(O){return U(O)};function K(O,L){if(O.indexOf)return O.indexOf(L);for(var x=0,A=O.length;x<A;++x)if(O[x]==L)return x;return-1}function N(O,L,x,A,P){if(!oe.scanForClosingTag)return!1;var w=Math.min(O.lastLine()+1,A.line+500),S=oe.scanForClosingTag(O,A,null,w);if(!S||S.tag!=x)return!1;for(var T=P?1:0,h=L.length-1;h>=0&&L[h]==x;h--)++T;A=S.to;for(var h=1;h<T;h++){var l=oe.scanForClosingTag(O,A,null,w);if(!l||l.tag!=x)return!1;A=l.to}return!0}})},BjJ7:function(at,Xe,V){"use strict";V.d(Xe,"d",function(){return Y}),V.d(Xe,"c",function(){return D}),V.d(Xe,"e",function(){return $}),V.d(Xe,"b",function(){return U}),V.d(Xe,"a",function(){return K});var oe=V("m3rI");function Y(N){var O=!0;if(N.length>0){for(var L=0;L<N.length;L++)if(N[L].compile_success==0||!N[L].compile_success){O=!1;break}}else O=!1;return O}function D(N){for(var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",L=[],x=0;x<N.length;x++){var A=N[x],P=O?"".concat(O,"/").concat(A.name):"".concat(A.name);L.push({title:A.name,isLeaf:!(A.type==="tree"),key:P})}return L}function $(N,O,L){for(var x=0;x<N.length;x++){var A=N[x];if(A.key===O){A.children=L;break}A.children&&$(A.children,O,L)}return N}function U(N,O,L){var x;return function(){var A=this,P=arguments,w=function(){x=null,L||N.apply(A,P)},S=L&&!x;clearTimeout(x),x=setTimeout(w,O),S&&N.apply(A,P)}}var I=!0,K=oe.a.API_SERVER},"C+DQ":function(at,Xe,V){},DlQD:function(at,Xe,V){(function(oe,Y){at.exports=Y()})(this,function(){"use strict";function oe(xe,fe){for(var be=0;be<fe.length;be++){var ne=fe[be];ne.enumerable=ne.enumerable||!1,ne.configurable=!0,"value"in ne&&(ne.writable=!0),Object.defineProperty(xe,ne.key,ne)}}function Y(xe,fe,be){return fe&&oe(xe.prototype,fe),be&&oe(xe,be),xe}function D(xe,fe){if(!xe)return;if(typeof xe=="string")return $(xe,fe);var be=Object.prototype.toString.call(xe).slice(8,-1);if(be==="Object"&&xe.constructor&&(be=xe.constructor.name),be==="Map"||be==="Set")return Array.from(xe);if(be==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(be))return $(xe,fe)}function $(xe,fe){(fe==null||fe>xe.length)&&(fe=xe.length);for(var be=0,ne=new Array(fe);be<fe;be++)ne[be]=xe[be];return ne}function U(xe,fe){var be;if(typeof Symbol=="undefined"||xe[Symbol.iterator]==null){if(Array.isArray(xe)||(be=D(xe))||fe&&xe&&typeof xe.length=="number"){be&&(xe=be);var ne=0;return function(){return ne>=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={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},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<arguments.length;fe++){be=arguments[fe];for(ne in be)Object.prototype.hasOwnProperty.call(be,ne)&&(xe[ne]=be[ne])}return xe}function _(xe,fe){var be=xe.replace(/\|/g,function(ae,de,ue){for(var we=!1,Le=de;--Le>=0&&ue[Le]==="\\";)we=!we;return we?"|":" |"}),ne=be.split(/ \|/),re=0;if(ne.length>fe)ne.splice(fe);else for(;ne.length<fe;)ne.push("");for(;re<ne.length;re++)ne[re]=ne[re].trim().replace(/\\\|/g,"|");return ne}function k(xe,fe,be){var ne=xe.length;if(ne===0)return"";for(var re=0;re<ne;){var ae=xe.charAt(ne-re-1);if(ae===fe&&!be)re++;else if(ae!==fe&&be)re++;else break}return xe.substr(0,ne-re)}function H(xe,fe){if(xe.indexOf(fe[1])===-1)return-1;for(var be=xe.length,ne=0,re=0;re<be;re++)if(xe[re]==="\\")re++;else if(xe[re]===fe[0])ne++;else if(xe[re]===fe[1]&&(ne--,ne<0))return re;return-1}function z(xe){xe&&xe.sanitize&&!xe.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var Z={escape:h,unescape:i,edit:C,cleanUrl:u,resolveUrl:a,noopTest:b,merge:g,splitCells:_,rtrim:k,findClosingBracket:H,checkSanitizeDeprecation:z},G=K.defaults,B=Z.rtrim,te=Z.splitCells,ce=Z.escape,pe=Z.findClosingBracket;function ye(xe,fe,be){var ne=fe.href,re=fe.title?ce(fe.title):null,ae=xe[1].replace(/\\([\[\]])/g,"$1");return xe[0].charAt(0)!=="!"?{type:"link",raw:be,href:ne,title:re,text:ae}:{type:"image",raw:be,href:ne,title:re,text:ce(ae)}}function Ce(xe,fe){var be=xe.match(/^(\s+)(?:```)/);if(be===null)return fe;var ne=be[1];return fe.split(`
`).map(function(re){var ae=re.match(/^\s+/);if(ae===null)return re;var de=ae[0];return de.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<de;ue++)/^ *-+: *$/.test(ae.align[ue])?ae.align[ue]="right":/^ *:-+: *$/.test(ae.align[ue])?ae.align[ue]="center":/^ *:-+ *$/.test(ae.align[ue])?ae.align[ue]="left":ae.align[ue]=null;for(de=ae.cells.length,ue=0;ue<de;ue++)ae.cells[ue]=te(ae.cells[ue],ae.header.length);return ae}}},fe.hr=function(ne){var re=this.rules.block.hr.exec(ne);if(re)return{type:"hr",raw:re[0]}},fe.blockquote=function(ne){var re=this.rules.block.blockquote.exec(ne);if(re){var ae=re[0].replace(/^ *> ?/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;Bt<sn;Bt++)Ye=rt[Bt],ae=Ye,Dt=Ye.length,Ye=Ye.replace(/^ *([*+-]|\d+[.)]) */,""),~Ye.indexOf(`
`)&&(Dt-=Ye.length,Ye=this.options.pedantic?Ye.replace(/^ {1,4}/gm,""):Ye.replace(new RegExp("^ {1,"+Dt+"}","gm"),"")),Bt!==sn-1&&(ut=this.rules.block.bullet.exec(rt[Bt+1])[0],(ue?ut.length===1||!we&&ut[ut.length-1]===")":ut.length>1||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<de;ue++)/^ *-+: *$/.test(ae.align[ue])?ae.align[ue]="right":/^ *:-+: *$/.test(ae.align[ue])?ae.align[ue]="center":/^ *:-+ *$/.test(ae.align[ue])?ae.align[ue]="left":ae.align[ue]=null;for(de=ae.cells.length,ue=0;ue<de;ue++)ae.cells[ue]=te(ae.cells[ue].replace(/^ *\| *| *\| *$/g,""),ae.header.length);return ae}}},fe.lheading=function(ne){var re=this.rules.block.lheading.exec(ne);if(re)return{type:"heading",raw:re[0],depth:re[2].charAt(0)==="="?1:2,text:re[1]}},fe.paragraph=function(ne){var re=this.rules.block.paragraph.exec(ne);if(re)return{type:"paragraph",raw:re[0],text:re[1].charAt(re[1].length-1)===`
`?re[1].slice(0,-1):re[1]}},fe.text=function(ne,re){var ae=this.rules.block.text.exec(ne);if(ae){var de=re[re.length-1];return de&&de.type==="text"?{raw:ae[0],text:ae[0]}:{type:"text",raw:ae[0],text:ae[0]}}},fe.escape=function(ne){var re=this.rules.inline.escape.exec(ne);if(re)return{type:"escape",raw:re[0],text:ce(re[1])}},fe.tag=function(ne,re,ae){var de=this.rules.inline.tag.exec(ne);if(de)return!re&&/^<a /i.test(de[0])?re=!0:re&&/^<\/a>/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]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:le,table:le,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};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=/<!--(?!-?>)[\s\S]*?-->/,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","</?(?:tag)(?: +|\\n|/?>)|<(?: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","</?(?:tag)(?: +|\\n|/?>)|<(?: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","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ie._tag).getRegex(),ie.pedantic=ge({},ie.normal,{html:se(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\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:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\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:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:le,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};q._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",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]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),q.gfm.url=se(q.gfm.url,"i").replace("email",q.gfm._extended_email).getRegex(),q.breaks=ge({},q.gfm,{br:se(q.br).replace("{2,}","*").getRegex(),text:se(q.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Ee={block:ie,inline:q},Me=K.defaults,Ne=Ee.block,De=Ee.inline;function Be(xe){return xe.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function Ae(xe){var fe="",be,ne,re=xe.length;for(be=0;be<re;be++)ne=xe.charCodeAt(be),Math.random()>.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;ue<we;ue++)de.items[ue].tokens=this.blockTokens(de.items[ue].text,[],!1);re.push(de);continue}if(de=this.tokenizer.html(ne)){ne=ne.substring(de.raw.length),re.push(de);continue}if(ae&&(de=this.tokenizer.def(ne))){ne=ne.substring(de.raw.length),this.tokens.links[de.tag]||(this.tokens.links[de.tag]={href:de.href,title:de.title});continue}if(de=this.tokenizer.table(ne)){ne=ne.substring(de.raw.length),re.push(de);continue}if(de=this.tokenizer.lheading(ne)){ne=ne.substring(de.raw.length),re.push(de);continue}if(ae&&(de=this.tokenizer.paragraph(ne))){ne=ne.substring(de.raw.length),re.push(de);continue}if(de=this.tokenizer.text(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(ne){var rt="Infinite loop on byte: "+ne.charCodeAt(0);if(this.options.silent){console.error(rt);break}else throw new Error(rt)}}return re},fe.inline=function(ne){var re,ae,de,ue,we,Le,rt=ne.length;for(re=0;re<rt;re++){Le=ne[re];switch(Le.type){case"paragraph":case"text":case"heading":{Le.tokens=[],this.inlineTokens(Le.text,Le.tokens);break}case"table":{for(Le.tokens={header:[],cells:[]},ue=Le.header.length,ae=0;ae<ue;ae++)Le.tokens.header[ae]=[],this.inlineTokens(Le.header[ae],Le.tokens.header[ae]);for(ue=Le.cells.length,ae=0;ae<ue;ae++)for(we=Le.cells[ae],Le.tokens.cells[ae]=[],de=0;de<we.length;de++)Le.tokens.cells[ae][de]=[],this.inlineTokens(we[de],Le.tokens.cells[ae][de]);break}case"blockquote":{this.inline(Le.tokens);break}case"list":{for(ue=Le.items.length,ae=0;ae<ue;ae++)this.inline(Le.items[ae].tokens);break}}}return ne},fe.inlineTokens=function(ne,re,ae,de,ue){re===void 0&&(re=[]),ae===void 0&&(ae=!1),de===void 0&&(de=!1),ue===void 0&&(ue="");var we,Le=ne,rt;if(this.tokens.links){var je=Object.keys(this.tokens.links);if(je.length>0)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?'<pre><code class="'+this.options.langPrefix+qe(de,!0)+'">'+(ae?ne:qe(ne,!0))+`</code></pre>
`:"<pre><code>"+(ae?ne:qe(ne,!0))+`</code></pre>
`},fe.blockquote=function(ne){return`<blockquote>
`+ne+`</blockquote>
`},fe.html=function(ne){return ne},fe.heading=function(ne,re,ae,de){return this.options.headerIds?"<h"+re+' id="'+this.options.headerPrefix+de.slug(ae)+'">'+ne+"</h"+re+`>
`:"<h"+re+">"+ne+"</h"+re+`>
`},fe.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},fe.list=function(ne,re,ae){var de=re?"ol":"ul",ue=re&&ae!==1?' start="'+ae+'"':"";return"<"+de+ue+`>
`+ne+"</"+de+`>
`},fe.listitem=function(ne){return"<li>"+ne+`</li>
`},fe.checkbox=function(ne){return"<input "+(ne?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},fe.paragraph=function(ne){return"<p>"+ne+`</p>
`},fe.table=function(ne,re){return re&&(re="<tbody>"+re+"</tbody>"),`<table>
<thead>
`+ne+`</thead>
`+re+`</table>
`},fe.tablerow=function(ne){return`<tr>
`+ne+`</tr>
`},fe.tablecell=function(ne,re){var ae=re.header?"th":"td",de=re.align?"<"+ae+' align="'+re.align+'">':"<"+ae+">";return de+ne+"</"+ae+`>
`},fe.strong=function(ne){return"<strong>"+ne+"</strong>"},fe.em=function(ne){return"<em>"+ne+"</em>"},fe.codespan=function(ne){return"<code>"+ne+"</code>"},fe.br=function(){return this.options.xhtml?"<br/>":"<br>"},fe.del=function(ne){return"<del>"+ne+"</del>"},fe.link=function(ne,re,ae){if(ne=ze(this.options.sanitize,this.options.baseUrl,ne),ne===null)return ae;var de='<a href="'+qe(ne)+'"';return re&&(de+=' title="'+re+'"'),de+=">"+ae+"</a>",de},fe.image=function(ne,re,ae){if(ne=ze(this.options.sanitize,this.options.baseUrl,ne),ne===null)return ae;var de='<img src="'+ne+'" alt="'+ae+'"';return re&&(de+=' title="'+re+'"'),de+=this.options.xhtml?"/>":">",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;de<Ft;de++){mt=ne[de];switch(mt.type){case"space":continue;case"hr":{ae+=this.renderer.hr();continue}case"heading":{ae+=this.renderer.heading(this.parseInline(mt.tokens),mt.depth,ft(this.parseInline(mt.tokens,this.textRenderer)),this.slugger);continue}case"code":{ae+=this.renderer.code(mt.text,mt.lang,mt.escaped);continue}case"table":{for(Dt="",Ye="",Le=mt.header.length,ue=0;ue<Le;ue++)Ye+=this.renderer.tablecell(this.parseInline(mt.tokens.header[ue]),{header:!0,align:mt.align[ue]});for(Dt+=this.renderer.tablerow(Ye),ut="",Le=mt.cells.length,ue=0;ue<Le;ue++){for(je=mt.tokens.cells[ue],Ye="",rt=je.length,we=0;we<rt;we++)Ye+=this.renderer.tablecell(this.parseInline(je[we]),{header:!1,align:mt.align[we]});ut+=this.renderer.tablerow(Ye)}ae+=this.renderer.table(Dt,ut);continue}case"blockquote":{ut=this.parse(mt.tokens),ae+=this.renderer.blockquote(ut);continue}case"list":{for(zt=mt.ordered,Je=mt.start,Kt=mt.loose,Le=mt.items.length,ut="",ue=0;ue<Le;ue++)Bt=mt.items[ue],an=Bt.checked,Qt=Bt.task,sn="",Bt.task&&(ot=this.renderer.checkbox(an),Kt?Bt.tokens.length>0&&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+1<Ft&&ne[de+1].type==="text";)mt=ne[++de],ut+=`
`+(mt.tokens?this.parseInline(mt.tokens):mt.text);ae+=re?this.renderer.paragraph(ut):ut;continue}default:{var xt='Token with "'+mt.type+'" type was not found.';if(this.options.silent){console.error(xt);return}else throw new Error(xt)}}}return ae},fe.parseInline=function(ne,re){re=re||this.renderer;var ae="",de,ue,we=ne.length;for(de=0;de<we;de++){ue=ne[de];switch(ue.type){case"escape":{ae+=re.text(ue.text);break}case"html":{ae+=re.html(ue.text);break}case"link":{ae+=re.link(ue.href,ue.title,this.parseInline(ue.tokens,re));break}case"image":{ae+=re.image(ue.href,ue.title,ue.text);break}case"strong":{ae+=re.strong(this.parseInline(ue.tokens,re));break}case"em":{ae+=re.em(this.parseInline(ue.tokens,re));break}case"codespan":{ae+=re.codespan(ue.text);break}case"br":{ae+=re.br();break}case"del":{ae+=re.del(this.parseInline(ue.tokens,re));break}case"text":{ae+=re.text(ue.text);break}default:{var Le='Token with "'+ue.type+'" type was not found.';if(this.options.silent){console.error(Le);return}else throw new Error(Le)}}}return ae},xe}(),St=Z.merge,ht=Z.checkSanitizeDeprecation,yt=Z.escape,ke=K.getDefaults,Pt=K.changeDefaults,Tt=K.defaults;function Ue(xe,fe,be){if(typeof xe=="undefined"||xe===null)throw new Error("marked(): input parameter is undefined or null");if(typeof xe!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(xe)+", string expected");if(typeof fe=="function"&&(be=fe,fe=null),fe=St({},Ue.defaults,fe||{}),ht(fe),be){var ne=fe.highlight,re;try{re=Pe.lex(xe,fe)}catch(we){return be(we)}var ae=function(Le){var rt;if(!Le)try{rt=nt.parse(re,fe)}catch(je){Le=je}return fe.highlight=ne,Le?be(Le):be(null,rt)};if(!ne||ne.length<3)return ae();if(delete fe.highlight,!re.length)return ae();var de=0;Ue.walkTokens(re,function(we){we.type==="code"&&(de++,setTimeout(function(){ne(we.text,we.lang,function(Le,rt){if(Le)return ae(Le);rt!=null&&rt!==we.text&&(we.text=rt,we.escaped=!0),de--,de===0&&ae()})},0))}),de===0&&ae();return}try{var ue=Pe.lex(xe,fe);return fe.walkTokens&&Ue.walkTokens(ue,fe.walkTokens),nt.parse(ue,fe)}catch(we){if(we.message+=`
Please report this to https://github.com/markedjs/marked.`,fe.silent)return"<p>An error occurred:</p><pre>"+yt(we.message+"",!0)+"</pre>";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;je<Le;je++)rt[je]=arguments[je];var Ye=xe.renderer[ue].apply(ne,rt);return Ye===!1&&(Ye=we.apply(ne,rt)),Ye}};for(var ae in xe.renderer)re(ae);fe.renderer=ne}(),xe.tokenizer&&function(){var ne=Ue.defaults.tokenizer||new _e,re=function(ue){var we=ne[ue];ne[ue]=function(){for(var Le=arguments.length,rt=new Array(Le),je=0;je<Le;je++)rt[je]=arguments[je];var Ye=xe.tokenizer[ue].apply(ne,rt);return Ye===!1&&(Ye=we.apply(ne,rt)),Ye}};for(var ae in xe.tokenizer)re(ae);fe.tokenizer=ne}(),xe.walkTokens){var be=Ue.defaults.walkTokens;fe.walkTokens=function(ne){xe.walkTokens(ne),be&&be(ne)}}Ue.setOptions(fe)},Ue.walkTokens=function(xe,fe){for(var be=U(xe),ne;!(ne=be()).done;){var re=ne.value;fe(re);switch(re.type){case"table":{for(var ae=U(re.tokens.header),de;!(de=ae()).done;){var ue=de.value;Ue.walkTokens(ue,fe)}for(var we=U(re.tokens.cells),Le;!(Le=we()).done;)for(var rt=Le.value,je=U(rt),Ye;!(Ye=je()).done;){var Dt=Ye.value;Ue.walkTokens(Dt,fe)}break}case"list":{Ue.walkTokens(re.items,fe);break}default:re.tokens&&Ue.walkTokens(re.tokens,fe)}}},Ue.Parser=nt,Ue.parser=nt.parse,Ue.Renderer=He,Ue.TextRenderer=Oe,Ue.Lexer=Pe,Ue.lexer=Pe.lex,Ue.Tokenizer=_e,Ue.Slugger=lt,Ue.parse=Ue;var Ze=Ue;return Ze})},"Dvv+":function(at,Xe,V){"use strict";V.r(Xe);var oe=V("cWXX"),Y=V("/ezw"),D=V("+L6B"),$=V("2/Rp"),U=V("7Kak"),I=V("9yH6"),K=V("giR+"),N=V("fyUT"),O=V("9og8"),L=V("k1fw"),x=V("y8nQ"),A=V("Vl3Y"),P=V("tJVT"),w=V("5NDa"),S=V("5rEg"),T=V("WmNS"),h=V.n(T),l=V("q1tI"),i=V.n(l),c=V("Ty5D"),C=V("9kvl"),v=V("m3fD"),m=V.n(v),u=V("A+k2"),E=V.n(u),d=function(ue){var we=ue.value,Le=we===void 0?[]:we,rt=ue.onChange,je=ue.className,Ye=je===void 0?"":je;return i.a.createElement("div",{className:"".concat(E.a.tabs," ").concat(Ye," ")},i.a.createElement("div",{onClick:function(){return rt(0)},className:Le===0?E.a.active:""},i.a.createElement("div",null,"1"),i.a.createElement("div",null,"\u5F55\u5165\u4FE1\u606F")," "),i.a.createElement("div",{onClick:function(){return rt(1)},className:Le===1?E.a.active:""},i.a.createElement("div",null,"2"),i.a.createElement("div",null,"\u914D\u7F6E\u7EC4\u5377")))},f=d,s=V("2qtc"),a=V("kLXV"),b=V("sRBo"),g=V("kaz8"),_=V("5Dmo"),k=V("3S7+"),H=V("miYZ"),z=V("tsqr"),Z=V("oBTY"),G=V("IlMy"),B=V.n(G),te=V("WCUW"),ce=V("QSKd"),pe=V.n(ce),ye=V("Hfvn"),Ce=V.n(ye),_e=V("HPRh"),le=V.n(_e),se=V("+RXH"),ge=V.n(se),ie=V("+yhJ"),q=V.n(ie),Ee=V("RZ/O"),Me=V.n(Ee),Ne=V("exQ7"),De=V.n(Ne),Be=V("HG2Q"),Ae=V.n(Be),Pe=V("k4n4"),Fe=V("eS0+"),ze=V("PpiC"),qe=V("K5AI"),He=V.n(qe),Oe=V("LvDl"),lt=g.a.Group,tt=function(ue){var we=ue.value,Le=we===void 0?[]:we,rt=ue.onChange,je=ue.options,Ye=ue.search,Dt=Object(ze.a)(ue,["value","onChange","options","search"]),ut=i.a.useState(!1),mt=Object(P.a)(ut,2),zt=mt[0],Je=mt[1];Object(l.useEffect)(function(){var Qt,ot=je==null||((Qt=je.tag_disciplines)===null||Qt===void 0)?void 0:Qt.map(function(xt){return xt.id}),Ft=Le==null?void 0:Le.filter(function(xt){return ot.includes(xt)});Je(Ft.length===(ot==null?void 0:ot.length))},[Le]);var Kt=function(ot){var Ft,xt,kt=je==null||((Ft=je.tag_disciplines)===null||Ft===void 0)?void 0:Ft.map(function(st){return st.id}),Mt=Le==null?void 0:Le.filter(function(st){return kt.includes(st)}),It=Object(Oe.uniq)([].concat(Object(Z.a)(Le),Object(Z.a)(ot)));if(Mt.length>ot.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;vt<We.length;vt++){for(var Ct="",Zt=0;Zt<Et.length;Zt++)if(Et[Zt][0].parent_name==We[vt].parent_name){Ie=1,Ct=Zt;break}if(Ie==1)Et[Ct].push(We[vt]),Ie=0;else if(Ie==0){var dn=new Array;dn.push(We[vt]),Et.push(dn)}}return Et},Aa=function(dt,We){var Ie,Et,vt=Object(Oe.cloneDeep)(Q);vt[We]=dt;var Ct=Ai([vt[We]]),Zt=Ct==null||((Ie=Ct.panel)===null||Ie===void 0||((Et=Ie[0])===null||Et===void 0))?void 0:Et.reduce(function(Mn,An){return Mn+An},0);vt[We].questionTotal=Zt,W(vt);var dn=document.getElementsByClassName("customError");dn==null||dn.forEach(function(Mn){var An;Mn==null||((An=Mn.classList)===null||An===void 0)||An.remove("customError")})},Ai=function(dt){var We={contents:[],panel:[],score_num_item:[],score_total:[],error_tips:[]};return dt==null||dt.forEach(function(Ie,Et){var vt,Ct,Zt;We.panel.push([]),We.score_num_item.push(Ie==null?void 0:Ie.score),We.score_total.push(Ie==null?void 0:Ie.scoreTotal),(vt=We.error_tips)===null||vt===void 0||vt.push({name:(Ct=Ri.find(function(dn){return dn.type===(Ie==null?void 0:Ie.item_type)}))===null||Ct===void 0?void 0:Ct.name,score:(Ie==null?void 0:Ie.score)||0,scoreTotal:Ie==null?void 0:Ie.scoreTotal,item_type:Ie==null?void 0:Ie.item_type}),Ie==null||((Zt=Ie.item_banks)===null||Zt===void 0)||Zt.forEach(function(dn){var Mn;dn==null||((Mn=dn.tag_disciplines)===null||Mn===void 0)||Mn.forEach(function(An){var In;An==null||((In=An.difficulties)===null||In===void 0)||In.forEach(function(wn){wn.num&&(We.panel[Et].push(wn.num),We.contents.push({difficulty:wn.difficulty,item_type:Ie.item_type,items_count:wn.num,sub_discipline_id:dn.sub_discipline_id,tag_discipline_id:An.tag_discipline_id}))})})})}),We},Ra=function(){var bt=Object(O.a)(h.a.mark(function dt(We){var 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:if(!(!un.length&&!xn.length&&!On.length)){rn.next=3;break}return z.b.warn("\u5FC5\u987B\u9009\u62E9\u8003\u5BDF\u8303\u56F4\u6216\u8BD5\u9898\u6587\u4EF6\u5939\u6216\u6559\u7814\u56E2\u961F\u7684\u5176\u4E2D\u4E00\u9879"),rn.abrupt("return");case 3:Ie=[],Et=[],vt=Ai(Q),Ct=0;case 7:if(!(Ct<vt.error_tips.length)){rn.next=23;break}if(Mn=vt==null||((Zt=vt.panel)===null||Zt===void 0||((dn=Zt[Ct])===null||dn===void 0))?void 0:dn.reduce(function(Cn,Yn){return Cn+Yn},0),!(vt.error_tips[Ct].score===0&&Mn!==0)){rn.next=14;break}return In=document.getElementById("".concat((An=vt.error_tips[Ct])===null||An===void 0?void 0:An.item_type,"_score")),In.classList.add("customError"),In.scrollIntoView({block:"start",behavior:"smooth"}),rn.abrupt("return");case 14:if(!(vt.error_tips[Ct].score!==0&&Mn===0)){rn.next=19;break}return nr=document.getElementById("".concat((wn=vt.error_tips[Ct])===null||wn===void 0?void 0:wn.item_type,"_sum")),nr.classList.add("customError"),nr.scrollIntoView({block:"start",behavior:"smooth"}),rn.abrupt("return");case 19:vt.error_tips[Ct].score!==0&&Mn!==0&&(Ie==null||Ie.push({item_type:(Gn=vt.error_tips[Ct])===null||Gn===void 0?void 0:Gn.item_type,score:((zn=vt.error_tips[Ct])===null||zn===void 0?void 0:zn.score)||0}),Et.push(vt.error_tips[Ct].name));case 20:Ct++,rn.next=7;break;case 23:if(!(Ie.length===0)){rn.next=26;break}return z.b.warn("\u4E0D\u5141\u8BB8\u6BCF\u4E2A\u9898\u578B\u7684\u603B\u5206\u548C\u62BD\u9898\u6570\u91CF\u90FD\u4E3A0"),rn.abrupt("return");case 26:if(kt(!0),yr=Object(L.a)({contents:vt.contents,group_ids:un,teach_group_ids:On,score_settings:Ie,source:Je,sub_discipline_id:0,sort_by_item_type:Et,tag_discipline_ids:xn},Le),!We){rn.next=36;break}return sr=Object(L.a)(Object(L.a)({},yr),We),rn.next=32,Object(nt.a)("/api/examination_banks/save_question_list.json",{method:"post",body:sr});case 32:return Qn=rn.sent,Qn.status===0&&z.b.success("\u4FDD\u5B58\u6210\u529F"),kt(!1),rn.abrupt("return");case 36:if(br={},!Ye){rn.next=43;break}return rn.next=40,Object(nt.a)("/api/examination_banks/".concat(Ye==null?void 0:Ye.id,"/update_random_exam.json"),{method:"post",body:yr});case 40:br=rn.sent,rn.next=46;break;case 43:return rn.next=45,Object(nt.a)("/api/examination_banks/create_random_exam.json",{method:"post",body:yr});case 45:br=rn.sent;case 46:br.status===0&&(z.b.success("\u64CD\u4F5C\u6210\u529F"),C.d.push("/paperlibrary?defaultActiveKey=0")),kt(!1);case 48:case"end":return rn.stop()}},dt)}));return function(We){return bt.apply(this,arguments)}}(),na=function(){var bt=Object(O.a)(h.a.mark(function dt(We,Ie){var Et,vt,Ct,Zt,dn,Mn,An,In,wn,nr,Gn,zn,yr,sr,Qn,br,kr,rn,Cn,Yn,Er,lr,Mr;return h.a.wrap(function(Bn){for(;;)switch(Bn.prev=Bn.next){case 0:if(!(!un.length&&!xn.length&&!On.length)){Bn.next=3;break}return z.b.warn("\u5FC5\u987B\u9009\u62E9\u8003\u5BDF\u8303\u56F4\u6216\u8BD5\u9898\u6587\u4EF6\u5939\u6216\u6559\u7814\u56E2\u961F\u7684\u5176\u4E2D\u4E00\u9879"),Bn.abrupt("return");case 3:Et=[],vt=[],Ct=Ai(Q),Zt=0;case 7:if(!(Zt<Ct.error_tips.length)){Bn.next=23;break}if(An=Ct==null||((dn=Ct.panel)===null||dn===void 0||((Mn=dn[Zt])===null||Mn===void 0))?void 0:Mn.reduce(function(Xn,xr){return Xn+xr},0),!(Ct.error_tips[Zt].score===0&&An!==0)){Bn.next=14;break}return wn=document.getElementById("".concat((In=Ct.error_tips[Zt])===null||In===void 0?void 0:In.item_type,"_score")),wn.classList.add("customError"),wn.scrollIntoView({block:"start",behavior:"smooth"}),Bn.abrupt("return");case 14:if(!(Ct.error_tips[Zt].score!==0&&An===0)){Bn.next=19;break}return Gn=document.getElementById("".concat((nr=Ct.error_tips[Zt])===null||nr===void 0?void 0:nr.item_type,"_sum")),Gn.classList.add("customError"),Gn.scrollIntoView({block:"start",behavior:"smooth"}),Bn.abrupt("return");case 19:Ct.error_tips[Zt].score!==0&&An!==0&&(Et==null||Et.push({item_type:(zn=Ct.error_tips[Zt])===null||zn===void 0?void 0:zn.item_type,score:((yr=Ct.error_tips[Zt])===null||yr===void 0?void 0:yr.score)||0}),vt.push(Ct.error_tips[Zt].name));case 20:Zt++,Bn.next=7;break;case 23:if(!(Et.length===0)){Bn.next=26;break}return z.b.warn("\u4E0D\u5141\u8BB8\u6BCF\u4E2A\u9898\u578B\u7684\u603B\u5206\u548C\u62BD\u9898\u6570\u91CF\u90FD\u4E3A0"),Bn.abrupt("return");case 26:if(st(!0),sr=Object(L.a)({contents:Ct.contents,group_ids:un,teach_group_ids:On,score_settings:Et,sort_by_item_type:vt,tag_discipline_ids:xn,source:Je,sub_discipline_id:0},Le),!(We!==void 0&&!(We!=null&&We.single_question_id))){Bn.next=36;break}return sr.seleted_item_bank_ids=We==null?void 0:We.seleted_item_bank_ids,Bn.next=32,Object(nt.a)("/api/examination_banks/toggle_random_questions.json",{method:"post",body:sr});case 32:return Qn=Bn.sent,Qn!=null&&Qn.questions&&(kr=Object(Oe.cloneDeep)(F),kr.questionList=kr==null||((br=kr.questionList)===null||br===void 0)?void 0:br.map(function(Xn){if(Xn.type===Ie.type){var xr;return Object(L.a)(Object(L.a)({},Xn),{},{questions:(Qn==null||((xr=Qn.questions)===null||xr===void 0)?void 0:xr.questions)||[]})}return Xn}),p(kr)),st(!1),Bn.abrupt("return");case 36:if(!(We!=null&&We!==void 0&&We.single_question_id)){Bn.next=45;break}return sr.seleted_item_bank_ids=We==null?void 0:We.seleted_item_bank_ids,sr.single_question_id=We==null?void 0:We.single_question_id,Bn.next=41,Object(nt.a)("/api/examination_banks/toggle_random_questions.json",{method:"post",body:sr});case 41:return rn=Bn.sent,rn&&(Yn=Object(Oe.cloneDeep)(F),Yn.questionList=Yn==null||((Cn=Yn.questionList)===null||Cn===void 0)?void 0:Cn.map(function(Xn){if(Xn.type===Ie.type){var xr,Pr,_r=Object(Oe.cloneDeep)(Xn==null?void 0:Xn.questions);return _r.splice(Ie.index,1,rn==null||((xr=rn.questions)===null||xr===void 0||((Pr=xr.questions)===null||Pr===void 0))?void 0:Pr[0]),console.log(Xn==null?void 0:Xn.questions,_r,Ie.index,"new_questions"),Object(L.a)(Object(L.a)({},Xn),{},{questions:_r})}return Xn}),p(Yn)),st(!1),Bn.abrupt("return");case 45:return Bn.next=47,Object(nt.a)("/api/examination_banks/preview_random_questions.json",{method:"post",body:sr});case 47:Er=Bn.sent,Er.exam&&(lr=La(Er),Mr=[],vt==null||vt.forEach(function(Xn){var xr,Pr=lr==null||((xr=lr.questionList)===null||xr===void 0)?void 0:xr.find(function(_r){var Br,ra=(Br=Ri.find(function(ia){return ia.type===(_r==null?void 0:_r.type)}))===null||Br===void 0?void 0:Br.name;return ra===Xn});Mr.push(Pr)}),Mr=Object(Oe.compact)(Mr),lr.questionList=Mr,p(Object(L.a)({},lr)),console.log(JSON.stringify(lr)),fr(!0),document.body.scrollIntoView()),st(!1);case 50:case"end":return Bn.stop()}},dt)}));return function(We,Ie){return bt.apply(this,arguments)}}(),Ri=[{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"}],eo=function(){var dt=Ai(Q),We=dt.panel,Ie=dt.score_total;return Ie=Ie.reduce(function(Et,vt){return Et+vt},0),We=Object(Oe.flatten)(We).reduce(function(Et,vt){return Et+vt},0),i.a.createElement("div",{className:B.a.total},i.a.createElement("div",null,i.a.createElement("img",{src:q.a}),i.a.createElement("span",null,"\u9898\u6570(\u9053)"),i.a.createElement("aside",null,We)),i.a.createElement("aside",null),i.a.createElement("div",null,i.a.createElement("img",{src:Me.a}),i.a.createElement("span",null,"\u603B\u5206(\u5206)"),i.a.createElement("aside",null,Ie)))},gi=function(dt,We,Ie){return dt[We]=dt.splice(Ie,1,dt[We])[0],dt},ri=function(dt){var We=[],Ie=Object(Oe.cloneDeep)(Q);Ie.length>1&&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<Q.length-1?i.a.createElement(k.a,{getPopupContainer:function(Et){return document.getElementById("id_left")},title:"\u4E0B\u79FB"},i.a.createElement("span",{onClick:function(){return ji(dt)},style:{transform:"rotate(90deg)"}}," ",i.a.createElement("i",{className:"icon-jiantou1"}))):i.a.createElement("span",{style:{transform:"rotate(90deg)",cursor:"not-allowed"}}," ",i.a.createElement("i",{className:"icon-jiantou1"})))))})),eo()),i.a.createElement("div",{className:B.a.right},i.a.createElement(f,{className:B.a.tabs,value:1,onChange:function(){return rt(0)}}),i.a.createElement("section",{className:B.a.topWarp},i.a.createElement("div",{className:B.a.title},i.a.createElement("b",null),i.a.createElement("span",null,"\u62BD\u9898\u7EC4\u5377"),i.a.createElement("div",null,"STEP2")," "),i.a.createElement("div",{className:B.a.source},i.a.createElement("b",null,"*"),i.a.createElement("span",null,"\u8BD5\u9898\u6765\u6E90"),i.a.createElement("aside",null,i.a.createElement("div",{onClick:function(){return Li("mine")}}," ",i.a.createElement(g.a,{checked:Je==null?void 0:Je.includes("mine")}),i.a.createElement("span",{style:{color:Je!=null&&Je.includes("mine")?"#007DFE":"#666666"}},"\u4EC5\u6211\u521B\u5EFA\u7684")),i.a.createElement("div",{className:"mb20",onClick:function(){return Li("teach_groups")}}," ",i.a.createElement(g.a,{checked:Je==null?void 0:Je.includes("teach_groups")}),i.a.createElement("span",{style:{color:Je!=null&&Je.includes("teach_groups")?"#007DFE":"#666666"}},"\u6559\u7814\u5171\u4EAB")),i.a.createElement("div",{onClick:function(){return Li("public")}},i.a.createElement(g.a,{checked:Je==null?void 0:Je.includes("public")}),i.a.createElement("span",{style:{color:Je!=null&&Je.includes("public")?"#007DFE":"#666666"}},"\u516C\u5171\u9898\u5E93"))),i.a.createElement("aside",null,(Je==null?void 0:Je.includes("mine"))&&i.a.createElement("div",{style:{marginBottom:14},className:B.a.folder,onClick:function(){er(!0),Xt(!0),mr.current=un,or((tr==null?void 0:tr.map(function(dt){return dt.count}).reduce(function(dt,We){return dt+We},0))||0)}},i.a.createElement("img",{src:Ce.a}),i.a.createElement("span",null,"\u9009\u62E9\u8BD5\u9898\u6587\u4EF6\u5939"),i.a.createElement(k.a,{title:"\u9009\u4E2D\u9879\u4EC5\u5305\u62EC\u8BE5\u6587\u4EF6\u5939\u4E0B\u7684\u8BD5\u9898\uFF0C\u4E0D\u5305\u62EC\u5B50\u6587\u4EF6\u5939\uFF0C\u4E14\u7CFB\u7EDF\u53D6\u60A8\u9009\u4E2D\u7684\u6587\u4EF6\u5939\u548C\u8003\u67E5\u8303\u56F4\u4E2D\u7684\u8BD5\u9898\u7684\u5E76\u96C6\u4F5C\u4E3A\u968F\u673A\u5BF9\u8C61\u3002"},i.a.createElement("img",{src:pe.a}))),(Je==null?void 0:Je.includes("teach_groups"))&&i.a.createElement("div",{className:B.a.folder,onClick:function(){Jr(!0),si.current=On}},i.a.createElement("img",{src:De.a}),i.a.createElement("span",null,"\u9009\u62E9\u6559\u7814\u56E2\u961F")))),(Je==null?void 0:Je.includes("mine"))&&i.a.createElement("div",{className:B.a.choice},i.a.createElement("div",{className:B.a.name},i.a.createElement("b",null),i.a.createElement("span",null,"\u5DF2\u9009\u6587\u4EF6\u5939")),i.a.createElement(Pe.a,{type:2,value:tr,onChange:function(dt){var We=un.filter(function(Et){return Et!==dt}),Ie={source:Je,group_ids:We,tag_discipline_ids:xn,teach_group_ids:On};di(Ie),jn(We),mr.current=We}})),(Je==null?void 0:Je.includes("teach_groups"))&&i.a.createElement("div",{className:B.a.choice},i.a.createElement("div",{className:B.a.name},i.a.createElement("b",null),i.a.createElement("span",null,"\u5DF2\u9009\u6559\u7814\u56E2\u961F")),i.a.createElement(Pe.a,{icon:Ae.a,type:2,value:Gr,onChange:function(dt){var We=On.filter(function(Et){return Et!==dt}),Ie={source:Je,group_ids:un,tag_discipline_ids:xn,teach_group_ids:We};di(Ie),ti(We),si.current=We}})),i.a.createElement("div",{className:B.a.range},i.a.createElement("div",{className:B.a.name},i.a.createElement("b",null),i.a.createElement("span",null,"\u8003\u5BDF\u8303\u56F4")),i.a.createElement("div",{onClick:function(){if(_t===null){z.b.warn("\u8003\u5BDF\u8303\u56F4\u6CA1\u6709\u77E5\u8BC6\u70B9\u53EF\u4EE5\u9009\u62E9");return}it.current=xn,pt(!0)},className:B.a.btn},i.a.createElement("img",{src:le.a})," \u9009\u62E9\u8303\u56F4"),i.a.createElement("div",{className:B.a.name},i.a.createElement("b",{className:B.a.num}),i.a.createElement("span",null,"\u5DF2\u9009\u77E5\u8BC6\u70B9")),i.a.createElement("div",{className:B.a.knWarp},Pi==null?void 0:Pi.map(function(bt,dt){return i.a.createElement(i.a.Fragment,{key:dt},i.a.createElement("div",{className:B.a.kn},i.a.createElement("span",null,dt+1)," ",i.a.createElement("span",null,bt==null?void 0:bt[0].parent_name)),i.a.createElement(Pe.a,{type:1,value:bt==null?void 0:bt.filter(function(We){return!!We.item_count}),onChange:function(Ie){var Et=xn.filter(function(Ct){return Ct!==Ie}),vt={source:Je,group_ids:un,tag_discipline_ids:Et,teach_group_ids:On};di(vt),Rr(Et),it.current=Et}}))})))),console.log("-----",Q),i.a.createElement(Y.a,{loading:an,active:!0,paragraph:{rows:5}},Q.map(function(bt,dt){return i.a.createElement(Fe.a,{key:dt,value:bt,onChange:function(Ie){return Aa(Ie,dt)}})}),i.a.createElement("div",{className:B.a.btns},i.a.createElement($.a,{onClick:function(){rt(0),document.body.scrollIntoView()}},"\u4E0A\u4E00\u6B65"),i.a.createElement($.a,{loading:xt,onClick:function(){return Ra()}},"\u63D0\u4EA4"),i.a.createElement($.a,{loading:Lt,onClick:function(){return na()},type:"primary"},"\u9884\u89C8")))),i.a.createElement(a.a,{centered:!0,closable:!1,destroyOnClose:!0,className:B.a.modal,visible:on,title:null,width:"1200px",onOk:Za,onCancel:wa},i.a.createElement("div",{className:B.a.modalBody},i.a.createElement("div",{className:B.a.left},i.a.createElement("div",{className:B.a.title},i.a.createElement("img",{src:ge.a}),i.a.createElement("span",null,"\u8BD5\u9898\u8303\u56F4")),i.a.createElement("div",{className:B.a.l},ct==null?void 0:ct.map(function(bt){var dt=null,We=!1;if(!$t)We=!0;else{var Ie;(Ie=bt.sub_disciplines)===null||Ie===void 0||Ie.forEach(function(Et){var vt;(vt=Et.tag_disciplines)===null||vt===void 0||vt.forEach(function(Ct){if(!We){var Zt;We=((Zt=Ct.name)===null||Zt===void 0?void 0:Zt.includes($t))&&Ct.item_count!==0}})})}return i.a.createElement(i.a.Fragment,{key:bt.id},!!bt.item_count&&We&&i.a.createElement("div",{onClick:function(){return Te(bt.id)},className:"".concat(B.a.name," ").concat(bt.id===_t?B.a.active:"")},i.a.createElement("b",null),i.a.createElement("span",null,bt.name)))}))),i.a.createElement("div",{className:B.a.right},i.a.createElement("div",{className:B.a.inputWarp},i.a.createElement(xe,{onChange:function(dt){return cn(dt.target.value)},placeholder:"\u8BF7\u8F93\u5165\u77E5\u8BC6\u70B9",value:$t})),i.a.createElement("div",{className:B.a.l},ii==null?void 0:ii.map(function(bt,dt){var We,Ie=Object(L.a)(Object(L.a)({},bt),{},{tag_disciplines:bt==null||((We=bt.tag_disciplines)===null||We===void 0)?void 0:We.filter(function(Et){return Et.item_count!==0})});return i.a.createElement(ft,{search:$t,onChange:qa,key:bt.id,value:xn,options:Ie})}))))),i.a.createElement(a.a,{centered:!0,title:"\u9009\u62E9\u6587\u4EF6\u5939",visible:Nt,width:718,destroyOnClose:!0,onCancel:function(){jn(mr.current),Xt(!1),or(0)},footer:i.a.createElement("div",{style:{display:"flex",alignItems:"center"}},i.a.createElement("span",{style:{flex:"1",textAlign:"left"}},"\u5DF2\u9009",un.length||0,"\u4E2A\u6587\u4EF6\u5939\uFF0C\u5171\uFF08",Tn||0,"\uFF09\u9053\u9898"),i.a.createElement($.a,{onClick:function(){jn(mr.current),or(0),Xt(!1)}},"\u53D6\u6D88"),i.a.createElement($.a,{type:"primary",onClick:function(){var dt={source:Je,group_ids:un,tag_discipline_ids:xn,teach_group_ids:On};di(dt),mr.current=un,Xt(!1)}},"\u786E\u8BA4"))},i.a.createElement("aside",{className:B.a.exportModal},vn&&i.a.createElement(Ue,{treeData:Jt,defaultValue:yn,value:un,onChange:function(dt,We){var Ie;or((Ie=We.selectedNodes)===null||Ie===void 0?void 0:Ie.map(function(Et){return Et.count}).reduce(function(Et,vt){return Et+vt},0)),jn(dt)}}))),i.a.createElement(a.a,{centered:!0,title:"\u9009\u62E9\u6559\u7814\u56E2\u961F",visible:fi,width:718,destroyOnClose:!0,onCancel:function(){ti(si.current),Jr(!1)},onOk:function(){var dt={source:Je,group_ids:un,tag_discipline_ids:xn,teach_group_ids:On};di(dt),si.current=On,Jr(!1)}},i.a.createElement("aside",{className:B.a.teachModal},i.a.createElement("div",{className:B.a.head},i.a.createElement("div",{className:B.a.li}),i.a.createElement("div",{className:B.a.li},"\u56E2\u961F\u540D\u79F0"),i.a.createElement("div",{className:B.a.li},"\u5171\u4EAB\u9898\u76EE\u6570\u91CF")),i.a.createElement("div",{className:B.a.wraps},ni==null?void 0:ni.map(function(bt){return i.a.createElement("div",{key:bt.id,className:B.a.body},i.a.createElement("div",{className:B.a.li},i.a.createElement(g.a,{onChange:function(){var We=bt.id,Ie=Object(Z.a)(On);On.includes(We)?Ie=Ie.filter(function(Et){return Et!==We}):Ie.push(We),ti(Ie)},checked:On==null?void 0:On.includes(bt.id)})),i.a.createElement("div",{title:bt.name,className:B.a.li},bt.name),i.a.createElement("div",{className:B.a.li},bt.item_bank_count))})))))},be=fe,ne=S.a.TextArea,re=function(ue){var we=ue.paperlibrary,Le=ue.user,rt=ue.globalSetting,je=ue.dispatch,Ye=Object(l.useState)(0),Dt=Object(P.a)(Ye,2),ut=Dt[0],mt=Dt[1],zt=A.a.useForm(),Je=Object(P.a)(zt,1),Kt=Je[0],sn=Object(l.useState)({}),Bt=Object(P.a)(sn,2),an=Bt[0],Qt=Bt[1],ot=Object(l.useState)(!0),Ft=Object(P.a)(ot,2),xt=Ft[0],kt=Ft[1],Mt=Object(l.useState)(null),It=Object(P.a)(Mt,2),Lt=It[0],st=It[1],Ve=Object(c.i)().id;console.log(Ve,"editId"),Object(l.useEffect)(function(){return je({type:"globalSetting/footerToggle",payload:!1}),function(){je({type:"globalSetting/footerToggle",payload:!0})}},[]),Object(l.useEffect)(function(){return document.body.setAttribute("data-custom","initial"),function(){document.body.removeAttribute("data-custom")}},[]);var ln=function(on){Qt(Object(L.a)({},Kt.getFieldsValue()))};Object(l.useEffect)(function(){if(Ve){$t();return}kt(!1)},[Ve]);var $t=function(){var En=Object(O.a)(h.a.mark(function on(){var pt,Ge,wt,Hn,fr,Ar;return h.a.wrap(function(F){for(;;)switch(F.prev=F.next){case 0:return F.next=2,Object(nt.a)("/api/examination_banks/".concat(Ve,"/edit_random_exam.json"),{method:"get",params:{}});case 2:pt=F.sent,pt!=null&&pt.examination_bank&&(Ar={difficulty:pt==null||((Ge=pt.examination_bank)===null||Ge===void 0)?void 0:Ge.difficulty,exam_notes:pt==null||((wt=pt.examination_bank)===null||wt===void 0)?void 0:wt.exam_notes,name:pt==null||((Hn=pt.examination_bank)===null||Hn===void 0)?void 0:Hn.name,time:pt==null||((fr=pt.examination_bank)===null||fr===void 0)?void 0:fr.time},kt(!1),Qt(Object(L.a)({},Ar)),Kt.setFieldsValue(Object(L.a)({},Ar)),st(Object(L.a)(Object(L.a)({},pt),{},{id:Ve})));case 4:case"end":return F.stop()}},on)}));return function(){return En.apply(this,arguments)}}(),cn=function(){var En=Object(O.a)(h.a.mark(function on(pt){return h.a.wrap(function(wt){for(;;)switch(wt.prev=wt.next){case 0:if(!(pt===0)){wt.next=3;break}return mt(pt),wt.abrupt("return");case 3:return wt.next=5,Kt.validateFields();case 5:mt(pt);case 6:case"end":return wt.stop()}},on)}));return function(pt){return En.apply(this,arguments)}}(),qt=function(on){var pt=parseInt(on);return Object(Oe.isNaN)(pt)?"":pt};return i.a.createElement("section",{className:m.a.wrap},i.a.createElement(Y.a,{loading:xt,active:!0,paragraph:{rows:5}},i.a.createElement("div",{className:m.a.crumbs},i.a.createElement("b",null),i.a.createElement("span",{className:"current",onClick:function(){return C.d.push("/")}},"\u9996\u9875>"),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<S.length;T++){var h=S.charAt(T),l="'"+h+"'";U[l]||(U[l]=K(h))}}I(Y.pairs+"`");function K(S){return function(T){return A(T,S)}}function N(S){var T=S.state.closeBrackets;if(!T||T.override)return T;var h=S.getModeAt(S.getCursor());return h.closeBrackets||T}function O(S){var T=N(S);if(!T||S.getOption("disableInput"))return oe.Pass;for(var h=$(T,"pairs"),l=S.listSelections(),i=0;i<l.length;i++){if(!l[i].empty())return oe.Pass;var c=P(S,l[i].head);if(!c||h.indexOf(c)%2!=0)return oe.Pass}for(var i=l.length-1;i>=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;i<l.length;i++){if(!l[i].empty())return oe.Pass;var c=P(S,l[i].head);if(!c||h.indexOf(c)%2!=0)return oe.Pass}S.operation(function(){var C=S.lineSeparator()||`
`;S.replaceSelection(C+C,null),S.execCommand("goCharLeft"),l=S.listSelections();for(var v=0;v<l.length;v++){var m=l[v].head.line;S.indentLine(m,null,!0),S.indentLine(m+1,null,!0)}})}function x(S){var T=oe.cmpPos(S.anchor,S.head)>0;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<m.length;d++){var f=m[d],s=f.head,a,b=S.getRange(s,D(s.line,s.ch+1));if(u&&!f.empty())a="surround";else if((v||!u)&&b==T)v&&w(S,s)?a="both":C.indexOf(T)>=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;H<z.length;H++)z[H]=_+z[H]+k;S.replaceSelections(z,"around"),z=S.listSelections().slice();for(var H=0;H<z.length;H++)z[H]=x(z[H]);S.setSelections(z)}else E=="both"?(S.replaceSelection(_+k,null),S.triggerElectric(_+k),S.execCommand("goCharLeft")):E=="addFour"&&(S.replaceSelection(_+_+_+_,"before"),S.execCommand("goCharRight"))})}function P(S,T){var h=S.getRange(D(T.line,T.ch-1),D(T.line,T.ch+1));return h.length==2?h:null}function w(S,T){var h=S.getTokenAt(D(T.line,T.ch+1));return/\bstring/.test(h.type)&&h.start==T.ch&&(T.ch==0||!/\bstring/.test(S.getTokenTypeAt(T)))}})},FTkQ:function(at,Xe){at.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABjUlEQVQ4T61VsUoDQRB9s+eVYifkUlqIWCW3sbBMqYUR0cbfUPETxPgZ2giigpZaCnKXpBK1sMydpIx25+7ISu5ILhsjclvuzLx5M292lmA57PtuF2gIYIMBSYBn3BiICAg1cF0GrqjVSvLhlL+IqtVNEDUZWLAlS+8IeAPzvtduXw77ZYAMiEjKI2LeY2AskQ2cAGaiEy8MDwnQxicL7Ep5bDL+xmqijahZDsODDHBQ5sVfmVn6xmDeMuWTESAGnqf1bBpz09MSsESx729r4DwfIIA6hPjUSt2AaP7Hztwj5nXHdd0vpR7yMQzsUOT7pwzsjgEKsVIKgiCu1Za1UvfGLhynXgqCp6hSkSxEYCn9jLq+/wJgcawk5l4KYECN3YBlCVLWo4GvhmGfgVlrj4ZAjX0KmBmZD8Owj4IAMQAsvGSrKKR1zet0QpsosZQrmvnRKsqksZlxnFWVJAkT3Y6MDbAmgDlFdGcdm8IH22Qp9OmltAtdDoPlWez6SpkWtmCHFTNCvQMN/scX8A1e4fnIOEHt8AAAAABJRU5ErkJggg=="},Gytx:function(at,Xe){at.exports=function(oe,Y,D,$){var U=D?D.call($,oe,Y):void 0;if(U!==void 0)return!!U;if(oe===Y)return!0;if(typeof oe!="object"||!oe||typeof Y!="object"||!Y)return!1;var I=Object.keys(oe),K=Object.keys(Y);if(I.length!==K.length)return!1;for(var N=Object.prototype.hasOwnProperty.bind(Y),O=0;O<I.length;O++){var L=I[O];if(!N(L))return!1;var x=oe[L],A=Y[L];if(U=D?D.call($,x,A,L):void 0,U===!1||U===void 0&&x!==A)return!1}return!0}},HG2Q:function(at,Xe,V){at.exports=V.p+"static/sren.1cbce50b.svg"},HPRh:function(at,Xe,V){at.exports=V.p+"static/median.766cb706.svg"},Hfvn:function(at,Xe,V){at.exports=V.p+"static/wenjian.ea3b4170.svg"},HmJG:function(at,Xe,V){},IlMy:function(at,Xe,V){at.exports={flex_box_center:"flex_box_center___1Rd7-",flex_space_between:"flex_space_between___1qdJI",flex_box_vertical_center:"flex_box_vertical_center___3PScB",flex_box_center_end:"flex_box_center_end___gmzWk",flex_box_column:"flex_box_column___qhFY7",wrap:"wrap___2CDxR",left:"left___21M_k",list:"list___ahv58",name:"name___3cBep",b:"b___1CRFh",r:"r___2F_9I",l:"l___3XCXI",total:"total___2VTdV",topWarp:"topWarp___y9feY",right:"right___U2Z5M",tabs:"tabs___3eZK5",title:"title___3iKxF",source:"source___3rkh5",folder:"folder___AxGOK",choice:"choice___1AdWh",range:"range___23nFr",btn:"btn___1QiCj",knWarp:"knWarp___3eQQ5",kn:"kn___1OLj0",btns:"btns___26z5C",modalBody:"modalBody___1b2lK",active:"active___kELz6",inputWarp:"inputWarp___1leis",modal:"modal___1Ehn0",exportModal:"exportModal___1Vsj-",teachModal:"teachModal___CwfeZ",head:"head___2_Y6a",wraps:"wraps___3-f7m",body:"body___2Jb5Z"}},K5AI:function(at,Xe,V){at.exports={cInput:"cInput___2BJRi",cl:"cl___AbKoK",box:"box___3gRA9",box1:"box1___S3u_s",cr:"cr___16yEi"}},LdHM:function(at,Xe,V){"use strict";V.d(Xe,"b",function(){return c}),V.d(Xe,"a",function(){return v});var oe=V("1OyB"),Y=V("vuIU"),D=V("Ji7U"),$=V("LK+K"),U=V("q1tI"),I=V("rePB"),K=V("Ff2n"),N=V("ODXe"),O=V("4IlW"),L=V("bX4T"),x=V("YrtM"),A=V("TSYQ"),P=V.n(A),w=V("+nKL"),S=V("8OUc"),T=function(te,ce){var pe=te.prefixCls,ye=te.id,Ce=te.flattenOptions,_e=te.childrenAsData,le=te.values,se=te.searchValue,ge=te.multiple,ie=te.defaultActiveFirstOption,q=te.height,Ee=te.itemHeight,Me=te.notFoundContent,Ne=te.open,De=te.menuItemSelectedIcon,Be=te.virtual,Ae=te.onSelect,Pe=te.onToggleOpen,Fe=te.onActiveValue,ze=te.onScroll,qe=te.onMouseEnter,He="".concat(pe,"-item"),Oe=Object(x.a)(function(){return Ce},[Ne,Ce],function(Ze,xe){return xe[0]&&Ze[1]!==xe[1]}),lt=U.useRef(null),tt=function(xe){xe.preventDefault()},ft=function(xe){lt.current&&lt.current.scrollTo({index:xe})},nt=function(xe){for(var fe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,be=Oe.length,ne=0;ne<be;ne+=1){var re=(xe+ne*fe+be)%be,ae=Oe[re],de=ae.group,ue=ae.data;if(!de&&!ue.disabled)return re}return-1},St=U.useState(function(){return nt(0)}),ht=Object(N.a)(St,2),yt=ht[0],ke=ht[1],Pt=function(xe){ke(xe);var fe=Oe[xe];if(!fe){Fe(null,-1);return}Fe(fe.data.value,xe)};U.useEffect(function(){Pt(ie!==!1?nt(0):-1)},[Oe.length,se]),U.useEffect(function(){var Ze=setTimeout(function(){if(!ge&&Ne&&le.size===1){var xe=Array.from(le)[0],fe=Oe.findIndex(function(be){var ne=be.data;return ne.value===xe});Pt(fe),ft(fe)}});return function(){return clearTimeout(Ze)}},[Ne]);var Tt=function(xe){xe!==void 0&&Ae(xe,{selected:!le.has(xe)}),ge||Pe(!1)};if(U.useImperativeHandle(ce,function(){return{onKeyDown:function(xe){var fe=xe.which;switch(fe){case O.a.UP:case O.a.DOWN:{var be=0;if(fe===O.a.UP?be=-1:fe===O.a.DOWN&&(be=1),be!==0){var ne=nt(yt+be,be);ft(ne),Pt(ne)}break}case O.a.ENTER:{var re=Oe[yt];re&&!re.data.disabled?Tt(re.data.value):Tt(void 0),Ne&&xe.preventDefault();break}case O.a.ESC:Pe(!1)}},onKeyUp:function(){},scrollTo:function(xe){ft(xe)}}}),Oe.length===0)return U.createElement("div",{role:"listbox",id:"".concat(ye,"_list"),className:"".concat(He,"-empty"),onMouseDown:tt},Me);function Ue(Ze){var xe=Oe[Ze];if(!xe)return null;var fe=xe.data||{},be=fe.value,ne=fe.label,re=fe.children,ae=Object(L.a)(fe,!0),de=_e?re:ne;return xe?U.createElement("div",Object.assign({"aria-label":typeof de=="string"?de:null},ae,{key:Ze,role:"option",id:"".concat(ye,"_list_").concat(Ze),"aria-selected":le.has(be)}),be):null}return U.createElement(U.Fragment,null,U.createElement("div",{role:"listbox",id:"".concat(ye,"_list"),style:{height:0,width:0,overflow:"hidden"}},Ue(yt-1),Ue(yt),Ue(yt+1)),U.createElement(w.a,{itemKey:"key",ref:lt,data:Oe,height:q,itemHeight:Ee,fullHeight:!1,onMouseDown:tt,onScroll:ze,virtual:Be,onMouseEnter:qe},function(Ze,xe){var fe,be=Ze.group,ne=Ze.groupOption,re=Ze.data,ae=re.label,de=re.key;if(be)return U.createElement("div",{className:P()(He,"".concat(He,"-group"))},ae!==void 0?ae:de);var ue=re.disabled,we=re.value,Le=re.title,rt=re.children,je=re.style,Ye=re.className,Dt=Object(K.a)(re,["disabled","value","title","children","style","className"]),ut=le.has(we),mt="".concat(He,"-option"),zt=P()(He,mt,Ye,(fe={},Object(I.a)(fe,"".concat(mt,"-grouped"),ne),Object(I.a)(fe,"".concat(mt,"-active"),yt===xe&&!ue),Object(I.a)(fe,"".concat(mt,"-disabled"),ue),Object(I.a)(fe,"".concat(mt,"-selected"),ut),fe)),Je=_e?rt:ae,Kt=!De||typeof De=="function"||ut;return U.createElement("div",Object.assign({},Dt,{"aria-selected":ut,className:zt,title:Le,onMouseMove:function(){if(yt===xe||ue)return;Pt(xe)},onClick:function(){ue||Tt(we)},style:je}),U.createElement("div",{className:"".concat(mt,"-content")},Je||we),U.isValidElement(De)||ut,Kt&&U.createElement(S.a,{className:"".concat(He,"-option-state"),customizeIcon:De,customizeIconProps:{isSelected:ut}},ut?"\u2713":null))}))},h=U.forwardRef(T);h.displayName="OptionList";var l=h,i=function(){return null};i.isSelectOption=!0;var c=i,C=function(){return null};C.isSelectOptGroup=!0;var v=C,m=V("VTBJ"),u=V("Zm9Q");function E(B){var te=B.key,ce=B.props,pe=ce.children,ye=ce.value,Ce=Object(K.a)(ce,["children","value"]);return Object(m.a)({key:te,value:ye!==void 0?ye:te,children:pe},Ce)}function d(B){var te=arguments.length>1&&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('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):vn.content_type.indexOf("pdf")>-1?M.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(vn.id,"?type=").concat(vn.content_type,'&disposition=inline" target="_blank">').concat(vn.name,"</a>")):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('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Tn.id,'"></video>')):(gn==null||((Gr=gn.type)===null||Gr===void 0)?void 0:Gr.indexOf("pdf"))>-1?Gt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Tn.id,"?type=").concat(gn.type,'&disposition=inline" target="_blank">').concat(gn.name,"</a>")):ne.includes(Qr)?Gt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Tn.id,'?type=office&disposition=inline" target="_blank">').concat(gn.name,"</a>")):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('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Tn.id,'"></video>')):(gn==null||((Gr=gn.type)===null||Gr===void 0)?void 0:Gr.indexOf("pdf"))>-1?Gt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Tn.id,"?type=").concat(gn.type,'&disposition=inline" target="_blank">').concat(gn.name,"</a>")):ne.includes(Qr)?Gt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Tn.id,'?type=office&disposition=inline" target="_blank">').concat(gn.name,"</a>")):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;vn<bn.length;vn++)kn(vn)}}),Q(Gt),function(){Gt.off("paste",nn)}}},[]);var gr=Object(x.useCallback)(function(){if(Un.current)try{}catch(Gt){console.log(Gt,"---- to set md editor body height")}},[Dn,Un,qn]);Object(x.useEffect)(function(){function Gt(){var Jt=new S.default(function(fn){var bn=Object(D.a)(fn),kn;try{for(bn.s();!(kn=bn.n()).done;){var vn=kn.value;(vn.target.offsetHeight>0||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);Jt<fn.length;Jt++){var bn;nn()}return Ln.current=setInterval(function(){mn.current&&ar()},4e3),function(){clearInterval(Ln.current);var kn=Object(D.a)(Gt),vn;try{for(kn.s();!(vn=kn.n()).done;){var er=vn.value;M.removeKeyMap(er)}}catch(vr){kn.e(vr)}finally{kn.f()}}}},[M]),Object(x.useEffect)(function(){cn!==qn&&xn(cn)},[cn]),Object(St.a)(function(){if(!It&&Ht>0){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(`<br/>
`),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;Tn<er;Tn++){for(var or=[],tr=[],Gr=0;Gr<vr;Gr++)Tn===1&&tr.push(nt[gn]),or.push(" ");Tn===1&&(Qr+="| ".concat(tr.join(" | "),` |
`)),Qr+="| ".concat(or.join(vr===1?"":" | "),` |
`)}return M.replaceSelection(Qr+`
`),M.focus();default:throw new Error}},[M,Vn]),Ti=Object(x.useMemo)(function(){switch(Vn){case He:return A.a.createElement(pe,{callback:Jr,onCancel:ei});case lt:return A.a.createElement(ye.b,{callback:Jr,onCancel:ei});case Oe:return A.a.createElement(ie,{callback:Jr,onCancel:ei});case tt:return A.a.createElement(Fe,{callback:Jr,onCancel:ei});default:return null}},[Vn]);function ei(){_t("")}Object(x.useEffect)(function(){if(_n.current){var Gt=_n.current,nn=!1,Jt=0;function fn(vn){nn=!0,Jt=vn.pageY}function bn(){nn=!1}function kn(vn){if(nn){var er=vn.pageY-Jt;er<0&&(er=0),er>300&&(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;qe<He;++qe){var Oe=Ae[qe];if(Oe.ignoreCase)ze=!0;else if(/[a-z]/i.test(Oe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Fe=!0,ze=!1;break}}var lt={b:8,t:9,n:10,v:11,f:12,r:13};function tt(yt){var ke=yt.charCodeAt(0);if(ke!==92)return ke;var Pt=yt.charAt(1);return ke=lt[Pt],ke||("0"<=Pt&&Pt<="7"?parseInt(yt.substring(1),8):Pt==="u"||Pt==="x"?parseInt(yt.substring(2),16):yt.charCodeAt(1))}function ft(yt){if(yt<32)return(yt<16?"\\x0":"\\x")+yt.toString(16);var ke=String.fromCharCode(yt);return ke==="\\"||ke==="-"||ke==="]"||ke==="^"?"\\"+ke:ke}function nt(yt){var ke=yt.substring(1,yt.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),Pt=[],Tt=ke[0]==="^",Ue=["["];Tt&&Ue.push("^");for(var Ze=Tt?1:0,xe=ke.length;Ze<xe;++Ze){var fe=ke[Ze];if(/\\[bdsw]/i.test(fe))Ue.push(fe);else{var be=tt(fe),ne;Ze+2<xe&&ke[Ze+1]==="-"?(ne=tt(ke[Ze+2]),Ze+=2):ne=be,Pt.push([be,ne]),ne<65||be>122||(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;Ze<Pt.length;++Ze){var de=Pt[Ze];de[0]<=ae[1]+1?ae[1]=Math.max(ae[1],de[1]):re.push(ae=de)}for(var Ze=0;Ze<re.length;++Ze){var de=re[Ze];Ue.push(ft(de[0])),de[1]>de[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<Pt;++Ue){var xe=ke[Ue];if(xe==="(")++Ze;else if(xe.charAt(0)==="\\"){var fe=+xe.substring(1);fe&&(fe<=Ze?Tt[fe]=-1:ke[Ue]=ft(fe))}}for(var Ue=1;Ue<Tt.length;++Ue)Tt[Ue]===-1&&(Tt[Ue]=++Pe);for(var Ue=0,Ze=0;Ue<Pt;++Ue){var xe=ke[Ue];if(xe==="(")++Ze,Tt[Ze]||(ke[Ue]="(?:");else if(xe.charAt(0)==="\\"){var fe=+xe.substring(1);fe&&fe<=Ze&&(ke[Ue]="\\"+Tt[fe])}}for(var Ue=0;Ue<Pt;++Ue)ke[Ue]==="^"&&ke[Ue+1]!=="^"&&(ke[Ue]="");if(yt.ignoreCase&&Fe)for(var Ue=0;Ue<Pt;++Ue){var xe=ke[Ue],be=xe.charAt(0);xe.length>=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<He;++qe){var Oe=Ae[qe];if(Oe.global||Oe.multiline)throw new Error(""+Oe);ht.push("(?:"+St(Oe)+")")}return new RegExp(ht.join("|"),ze?"gi":"g")}function B(Ae,Pe){var Fe=/(?:^|\s)nocode(?:\s|$)/,ze=[],qe=0,He=[],Oe=0;function lt(tt){var ft=tt.nodeType;if(ft==1){if(Fe.test(tt.className))return;for(var nt=tt.firstChild;nt;nt=nt.nextSibling)lt(nt);var St=tt.nodeName.toLowerCase();(St==="br"||St==="li")&&(ze[Oe]=`
`,He[Oe<<1]=qe++,He[Oe++<<1|1]=tt)}else if(ft==3||ft==4){var ht=tt.nodeValue;ht.length&&(Pe?ht=ht.replace(/\r\n?/g,`
`):ht=ht.replace(/[ \t\r\n]+/g," "),ze[Oe]=ht,He[Oe<<1]=qe,qe+=ht.length,He[Oe++<<1|1]=tt)}}return lt(Ae),{sourceCode:ze.join("").replace(/\n$/,""),spans:He}}function te(Ae,Pe,Fe,ze,qe){if(!Fe)return;var He={sourceNode:Ae,pre:1,langExtension:null,numberLines:null,sourceCode:Fe,spans:null,basePos:Pe,decorations:null};ze(He),qe.push.apply(qe,He.decorations)}var ce=/\S/;function pe(Ae){for(var Pe=void 0,Fe=Ae.firstChild;Fe;Fe=Fe.nextSibling){var ze=Fe.nodeType;Pe=ze===1?Pe?Ae:Fe:ze===3&&ce.test(Fe.nodeValue)?Ae:Pe}return Pe===Ae?void 0:Pe}function ye(Ae,Pe){var Fe={},ze;(function(){for(var Oe=Ae.concat(Pe),lt=[],tt={},ft=0,nt=Oe.length;ft<nt;++ft){var St=Oe[ft],ht=St[3];if(ht)for(var yt=ht.length;--yt>=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<Pt;++ke){var Tt=ht[ke],Ue=yt[Tt],Ze=void 0,xe;if(typeof Ue=="string")xe=!1;else{var fe=Fe[Tt.charAt(0)];if(fe)Ze=Tt.match(fe[1]),Ue=fe[0];else{for(var be=0;be<qe;++be)if(fe=Pe[be],Ze=Tt.match(fe[1]),Ze){Ue=fe[0];break}Ze||(Ue=a)}xe=Ue.length>=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<lt.length;++nt)tt(lt[nt]);Pe===(Pe|0)&&lt[0].setAttribute("value",Pe);var St=He.createElement("ol");St.className="linenums";for(var ht=Math.max(0,Pe-1|0)||0,nt=0,yt=lt.length;nt<yt;++nt)Oe=lt[nt],Oe.className="L"+(nt+ht)%10,Oe.firstChild||Oe.appendChild(He.createTextNode("\xA0")),St.appendChild(Oe);Ae.appendChild(St)}function se(Ae){var Pe=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Pe=Pe&&+Pe[1]<=8;var Fe=/\n/g,ze=Ae.sourceCode,qe=ze.length,He=0,Oe=Ae.spans,lt=Oe.length,tt=0,ft=Ae.decorations,nt=ft.length,St=0;ft[nt]=qe;var ht,yt;for(yt=ht=0;yt<nt;)ft[yt]!==ft[yt+2]?(ft[ht++]=ft[yt++],ft[ht++]=ft[yt++]):yt+=2;for(nt=ht,yt=ht=0;yt<nt;){for(var ke=ft[yt],Pt=ft[yt+1],Tt=yt+2;Tt+2<=nt&&ft[Tt+1]===Pt;)Tt+=2;ft[ht++]=ke,ft[ht++]=Pt,yt=Tt}nt=ft.length=ht;var Ue=Ae.sourceNode,Ze="";Ue&&(Ze=Ue.style.display,Ue.style.display="none");try{for(var xe=null;tt<lt;){var fe=Oe[tt],be=Oe[tt+2]||qe,ne=ft[St+2]||qe,Tt=Math.min(be,ne),re=Oe[tt+1],ae;if(re.nodeType!==1&&(ae=ze.substring(He,Tt))){Pe&&(ae=ae.replace(Fe,"\r")),re.nodeValue=ae;var de=re.ownerDocument,ue=de.createElement("span");ue.className=ft[St+1];var we=re.parentNode;we.replaceChild(ue,re),ue.appendChild(re),He<be&&(Oe[tt+1]=re=de.createTextNode(ze.substring(Tt,be)),we.insertBefore(re,ue.nextSibling))}He=Tt,He>=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*</.test(Pe)?"default-markup":"default-code"),ge[Ae]}ie(_e,["default-code"]),ie(ye([],[[a,/^[^<?]+/],[g,/^<!\w[^>]*(?:>|$)/],[E,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[s,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),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="<pre>"+Ae+"</pre>",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<He.length;++lt)for(var tt=0,ft=He[lt].length;tt<ft;++tt)Oe.push(He[lt][tt]);He=null;var nt=Date;nt.now||(nt={now:function(){return+new Date}});var St=0,ht=/\blang(?:uage)?-([\w.]+)(?!\S)/,yt=/\bprettyprint\b/,ke=/\bprettyprinted\b/,Pt=/pre|xmp/i,Tt=/^code$/i,Ue=/^(?:pre|code|xmp)$/i,Ze={};function xe(){for(var fe=N.PR_SHOULD_USE_CONTINUATION?nt.now()+250:Infinity;St<Oe.length&&nt.now()<fe;St++){for(var be=Oe[St],ne=Ze,re=be;re=re.previousSibling;){var ae=re.nodeType,de=(ae===7||ae===8)&&re.nodeValue;if(de?!/^\??prettify\b/.test(de):ae!==3||/\S/.test(re.nodeValue))break;if(de){ne={},de.replace(/\b(\w+)=([\w:.%+-]+)/g,function(sn,Bt,an){ne[Bt]=an});break}}var ue=be.className;if((ne!==Ze||yt.test(ue))&&!ke.test(ue)){for(var we=!1,Le=be.parentNode;Le;Le=Le.parentNode){var rt=Le.tagName;if(Ue.test(rt)&&Le.className&&yt.test(Le.className)){we=!0;break}}if(!we){be.className+=" prettyprinted";var je=ne.lang;if(!je){je=ue.match(ht);var Ye;!je&&(Ye=pe(be))&&Tt.test(Ye.tagName)&&(je=Ye.className.match(ht)),je&&(je=je[1])}var Dt;if(Pt.test(be.tagName))Dt=1;else{var ut=be.currentStyle,mt=ze.defaultView,zt=ut?ut.whiteSpace:mt&&mt.getComputedStyle?mt.getComputedStyle(be,null).getPropertyValue("white-space"):0;Dt=zt&&zt.substring(0,3)==="pre"}var Je=ne.linenums;(Je=Je==="true"||+Je)||(Je=ue.match(/\blinenums\b(?::(\d+))?/),Je=Je?Je[1]&&Je[1].length?+Je[1]:!0:!1),Je&&le(be,Je,Dt);var Kt={langExtension:je,sourceNode:be,numberLines:Je,pre:Dt,sourceCode:null,basePos:null,spans:null,decorations:null};Ee(Kt)}}}St<Oe.length?N.setTimeout(xe,250):typeof Ae=="function"&&Ae()}xe()}var De=N.PR={createSimpleLexer:ye,registerLangHandler:ie,sourceDecorator:Ce,PR_ATTRIB_NAME:k,PR_ATTRIB_VALUE:H,PR_COMMENT:E,PR_DECLARATION:g,PR_KEYWORD:u,PR_LITERAL:f,PR_NOCODE:z,PR_PLAIN:a,PR_PUNCTUATION:s,PR_SOURCE:_,PR_STRING:m,PR_TAG:b,PR_TYPE:d,prettyPrintOne:D?N.prettyPrintOne=Me:I=Me,prettyPrint:K=D?N.prettyPrint=Ne:K=Ne},Be=N.define;typeof Be=="function"&&Be.amd&&Be("google-code-prettify",[],function(){return De})})()},"VrN/":function(at,Xe,V){(function(oe,Y){at.exports=Y()})(this,function(){"use strict";var oe=navigator.userAgent,Y=navigator.platform,D=/gecko\/\d/i.test(oe),$=/MSIE \d/.test(oe),U=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(oe),I=/Edge\/(\d+)/.exec(oe),K=$||U||I,N=K&&($?document.documentMode||6:+(I||U)[1]),O=!I&&/WebKit\//.test(oe),L=O&&/Qt\/\d+\.\d+/.test(oe),x=!I&&/Chrome\//.test(oe),A=/Opera\//.test(oe),P=/Apple Computer/.test(navigator.vendor),w=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(oe),S=/PhantomJS/.test(oe),T=!I&&/AppleWebKit/.test(oe)&&/Mobile\/\w+/.test(oe),h=/Android/.test(oe),l=T||h||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(oe),i=T||/Mac/.test(Y),c=/\bCrOS\b/.test(oe),C=/win/i.test(Y),v=A&&oe.match(/Version\/(\d*\.\d*)/);v&&(v=Number(v[1])),v&&v>=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.length;++R)o.appendChild(t[R]);return o}function b(e,t,r,n){var o=a(e,t,r,n);return o.setAttribute("role","presentation"),o}var g;document.createRange?g=function(e,t,r,n){var o=document.createRange();return o.setEnd(n||e,r),o.setStart(e,t),o}:g=function(e,t,r){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(o){return n}return n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n};function _(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function k(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function H(e,t){var r=e.className;E(t).test(r)||(e.className+=(r?" ":"")+t)}function z(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!E(r[n]).test(t)&&(t+=" "+r[n]);return t}var Z=function(e){e.select()};T?Z=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:K&&(Z=function(e){try{e.select()}catch(t){}});function G(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function B(e,t,r){t||(t={});for(var n in e)e.hasOwnProperty(n)&&(r!==!1||!t.hasOwnProperty(n))&&(t[n]=e[n]);return t}function te(e,t,r,n,o){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var R=n||0,j=o||0;;){var X=e.indexOf(" ",R);if(X<0||X>=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<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=r)};function pe(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}var ye=50,Ce={toString:function(){return"CodeMirror.Pass"}},_e={scroll:!1},le={origin:"*mouse"},se={origin:"+move"};function ge(e,t,r){for(var n=0,o=0;;){var R=e.indexOf(" ",n);R==-1&&(R=e.length);var j=R-n;if(R==e.length||o+j>=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<e.length;n++)r[n]=t(e[n],n);return r}function Ne(e,t,r){for(var n=0,o=r(t);n<e.length&&r(e[n])<=o;)n++;e.splice(n,0,t)}function De(){}function Be(e,t){var r;return Object.create?r=Object.create(e):(De.prototype=e,r=new De),t&&B(t,r),r}var Ae=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Pe(e){return/\w/.test(e)||e>"\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:t<e.length)&&He(e.charAt(t));)t+=r;return t}function lt(e,t,r){for(var n=t>r?-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;R<e.length;++R){var j=e[R];(j.from<r&&j.to>t||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;o<e.length;++o){var R=e[o];if(R.from<t&&R.to>t)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<Re;++Ke)Se.push(r(ee.charCodeAt(Ke)));for(var et=0,gt=ve;et<Re;++et){var At=Se[et];At=="m"?Se[et]=gt:gt=At}for(var Ut=0,Rt=ve;Ut<Re;++Ut){var Wt=Se[Ut];Wt=="1"&&Rt=="r"?Se[Ut]="n":R.test(Wt)&&(Rt=Wt,Wt=="r"&&(Se[Ut]="R"))}for(var tn=1,Yt=Se[0];tn<Re-1;++tn){var pn=Se[tn];pn=="+"&&Yt=="1"&&Se[tn+1]=="1"?Se[tn]="1":pn==","&&Yt==Se[tn+1]&&(Yt=="1"||Yt=="n")&&(Se[tn]=Yt),Yt=pn}for(var Wn=0;Wn<Re;++Wn){var Tr=Se[Wn];if(Tr==",")Se[Wn]="N";else if(Tr=="%"){var Jn=void 0;for(Jn=Wn+1;Jn<Re&&Se[Jn]=="%";++Jn);for(var Vr=Wn&&Se[Wn-1]=="!"||Jn<Re&&Se[Jn]=="1"?"1":"N",Wr=Wn;Wr<Jn;++Wr)Se[Wr]=Vr;Wn=Jn-1}}for(var ur=0,Hr=ve;ur<Re;++ur){var Lr=Se[ur];Hr=="L"&&Lr=="1"?Se[ur]="L":R.test(Lr)&&(Hr=Lr)}for(var hr=0;hr<Re;++hr)if(o.test(Se[hr])){var dr=void 0;for(dr=hr+1;dr<Re&&o.test(Se[dr]);++dr);for(var Zn=(hr?Se[hr-1]:ve)=="L",Kr=(dr<Re?Se[dr]:ve)=="L",qi=Zn==Kr?Zn?"L":"R":ve,Si=hr;Si<dr;++Si)Se[Si]=qi;hr=dr-1}for(var Or=[],li,wr=0;wr<Re;)if(j.test(Se[wr])){var Ao=wr;for(++wr;wr<Re&&j.test(Se[wr]);++wr);Or.push(new J(0,Ao,wr))}else{var hi=wr,Ui=Or.length,Bi=he=="rtl"?1:0;for(++wr;wr<Re&&Se[wr]!="L";++wr);for(var Ur=hi;Ur<wr;)if(X.test(Se[Ur])){hi<Ur&&(Or.splice(Ui,0,new J(1,hi,Ur)),Ui+=Bi);var ea=Ur;for(++Ur;Ur<wr&&X.test(Se[Ur]);++Ur);Or.splice(Ui,0,new J(2,ea,Ur)),Ui+=Bi,hi=Ur}else++Ur;hi<wr&&Or.splice(Ui,0,new J(1,hi,wr))}return he=="ltr"&&(Or[0].level==1&&(li=ee.match(/^\s+/))&&(Or[0].from=li[0].length,Or.unshift(new J(0,0,li[0].length))),Ee(Or).level==1&&(li=ee.match(/\s+$/))&&(Ee(Or).to-=li[0].length,Or.push(new J(0,Re-li[0].length,Re)))),he=="rtl"?Or.reverse():Or}}();function ht(e,t){var r=e.order;return r==null&&(r=e.order=St(e.text,t)),r}var yt=[],ke=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var n=e._handlers||(e._handlers={});n[t]=(n[t]||yt).concat(r)}};function Pt(e,t){return e._handlers&&e._handlers[t]||yt}function Tt(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var n=e._handlers,o=n&&n[t];if(o){var R=pe(o,r);R>-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;o<r.length;++o)r[o].apply(null,n)}function Ze(e,t,r){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Ue(e,r||t.type,e,t),ae(t)||t.codemirrorIgnore}function xe(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)pe(r,t[n])==-1&&r.push(t[n])}function fe(e,t){return Pt(e,t).length>0}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.pos<this.string.length)return this.string.charAt(this.pos++)},st.prototype.eat=function(e){var t=this.string.charAt(this.pos),r;if(typeof e=="string"?r=t==e:r=t&&(e.test?e.test(t):e(t)),r)return++this.pos,t},st.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},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.lastColumnPos<this.start&&(this.lastColumnValue=te(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?te(this.string,this.lineStart,this.tabSize):0)},st.prototype.indentation=function(){return te(this.string,null,this.tabSize)-(this.lineStart?te(this.string,this.lineStart,this.tabSize):0)},st.prototype.match=function(e,t,r){if(typeof e=="string"){var n=function(j){return r?j.toLowerCase():j},o=this.string.substr(this.pos,e.length);if(n(o)==n(e))return t!==!1&&(this.pos+=e.length),!0}else{var R=this.string.slice(this.pos).match(e);return R&&R.index>0?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<R){r=o;break}t-=R}return r.lines[t]}function ln(e,t,r){var n=[],o=t.line;return e.iter(t.line,r.line+1,function(R){var j=R.text;o==r.line&&(j=j.slice(0,r.ch)),o==t.line&&(j=j.slice(t.ch)),n.push(j),++o}),n}function $t(e,t,r){var n=[];return e.iter(t,r,function(o){n.push(o.text)}),n}function cn(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function qt(e){if(e.parent==null)return null;for(var t=e.parent,r=pe(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var o=0;!(n.children[o]==t);++o)r+=n.children[o].chunkSize();return r+t.first}function En(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var o=e.children[n],R=o.height;if(t<R){e=o;continue e}t-=R,r+=o.chunkSize()}return r}while(!e.lines);for(var j=0;j<e.lines.length;++j){var X=e.lines[j],J=X.height;if(t<J)break;t-=J}return r+j}function on(e,t){return t>=e.first&&t<e.first+e.size}function pt(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Ge(e,t,r){if(r===void 0&&(r=null),!(this instanceof Ge))return new Ge(e,t,r);this.line=e,this.ch=t,this.sticky=r}function wt(e,t){return e.line-t.line||e.ch-t.ch}function Hn(e,t){return e.sticky==t.sticky&&wt(e,t)==0}function fr(e){return Ge(e.line,e.ch)}function Ar(e,t){return wt(e,t)<0?t:e}function Fn(e,t){return wt(e,t)<0?e:t}function F(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function p(e,t){if(t.line<e.first)return Ge(e.first,0);var r=e.first+e.size-1;return t.line>r?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;n<t.length;n++)r[n]=p(e,t[n]);return r}var Q=function(e,t){this.state=e,this.lookAhead=t},W=function(e,t,r,n){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1};W.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.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;Re<Se;){var gt=o[ve];gt>Se&&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(;et<ve;et+=2){var At=o[et+1];o[et+1]=(At?At+" ":"")+"overlay "+Ke}},R),r.state=j,r.baseTokens=null,r.baseTokenPos=1},J=0;J<e.state.overlays.length;++J)X(J);return{styles:o,classes:R.bgClass||R.textClass?R:null}}function $e(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=ct(e,qt(t)),o=t.text.length>e.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&&ee<o.viewTo?X.save():null,X.nextLine()}),r&&(n.modeFrontier=X.line),X}function jt(e,t,r,n){var o=e.doc.mode,R=new st(t,e.options.tabSize,r);for(R.start=R.pos=n||0,t==""&&Qe(o,r.state);!R.eol();)Vt(o,R,r.state),R.start=R.pos}function Qe(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var r=It(e,t);if(r.mode.blankLine)return r.mode.blankLine(r.state)}function Vt(e,t,r,n){for(var o=0;o<10;o++){n&&(n[0]=It(e,r).mode);var R=e.token(t,r);if(t.pos>t.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.pos<t.ch)&&!ee.eol();)ee.start=ee.pos,j=Vt(R,ee,J.state),n&&he.push(new hn(ee,j,Mt(o.mode,J.state)));return n?he:new hn(ee,j,J.state)}function pr(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";t[n]==null?t[n]=r[2]:new RegExp("(?:^|\\s)"+r[2]+"(?:$|\\s)").test(t[n])||(t[n]+=" "+r[2])}return e}function qn(e,t,r,n,o,R,j){var X=r.flattenSpans;X==null&&(X=e.options.flattenSpans);var J=0,ee=null,he=new st(t,e.options.tabSize,n),ve,Re=e.options.addModeClass&&[null];for(t==""&&pr(Qe(r,n.state),R);!he.eol();){if(he.pos>e.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(;J<he.start;)J=Math.min(he.start,J+5e3),o(J,ee);ee=ve}he.start=he.pos}for(;J<he.pos;){var Ke=Math.min(he.pos,J+5e3);o(Ke,ee),J=Ke}}function xn(e,t,r){for(var n,o,R=e.doc,j=r?-1:t-(e.doc.mode.innerMode?1e3:100),X=t;X>j;--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.highlightFrontier<t-10)return;for(var r=e.first,n=t-1;n>r;n--){var o=Ve(e,n).stateAfter;if(o&&(!(o instanceof Q)||n+o.lookAhead<t)){r=n+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,r)}var qr=!1,Vn=!1;function _t(){qr=!0}function Te(){Vn=!0}function it(e,t,r){this.marker=e,this.from=t,this.to=r}function Ht(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function Ot(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function Nt(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Xt(e,t,r){var n;if(e)for(var o=0;o<e.length;++o){var R=e[o],j=R.marker,X=R.from==null||(j.inclusiveLeft?R.from<=t:R.from<t);if(X||R.from==t&&j.type=="bookmark"&&(!r||!R.marker.insertLeft)){var J=R.to==null||(j.inclusiveRight?R.to>=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<e.length;++o){var R=e[o],j=R.marker,X=R.to==null||(j.inclusiveRight?R.to>=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.from<t);(n||(n=[])).push(new it(j,J?null:R.from-t,R.to==null?null:R.to-t))}}return n}function Sn(e,t){if(t.full)return null;var r=on(e,t.from.line)&&Ve(e,t.from.line).markedSpans,n=on(e,t.to.line)&&Ve(e,t.to.line).markedSpans;if(!r&&!n)return null;var o=t.from.ch,R=t.to.ch,j=wt(t.from,t.to)==0,X=Xt(r,o,j),J=Dn(n,R,j),ee=t.text.length==1,he=Ee(t.text).length+(ee?o:0);if(X)for(var ve=0;ve<X.length;++ve){var Re=X[ve];if(Re.to==null){var Se=Ht(J,Re.marker);Se?ee&&(Re.to=Se.to==null?null:Se.to+he):Re.to=o}}if(J)for(var Ke=0;Ke<J.length;++Ke){var et=J[Ke];if(et.to!=null&&(et.to+=he),et.from==null){var gt=Ht(X,et.marker);gt||(et.from=he,ee&&(X||(X=[])).push(et))}else et.from+=he,ee&&(X||(X=[])).push(et)}X&&(X=un(X)),J&&J!=X&&(J=un(J));var At=[X];if(!ee){var Ut=t.text.length-2,Rt;if(Ut>0&&X)for(var Wt=0;Wt<X.length;++Wt)X[Wt].to==null&&(Rt||(Rt=[])).push(new it(X[Wt].marker,null,null));for(var tn=0;tn<Ut;++tn)At.push(Rt);At.push(J)}return At}function un(e){for(var t=0;t<e.length;++t){var r=e[t];r.from!=null&&r.from==r.to&&r.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function jn(e,t,r){var n=null;if(e.iter(t.line,r.line+1,function(Se){if(Se.markedSpans)for(var Ke=0;Ke<Se.markedSpans.length;++Ke){var et=Se.markedSpans[Ke].marker;et.readOnly&&(!n||pe(n,et)==-1)&&(n||(n=[])).push(et)}}),!n)return null;for(var o=[{from:t,to:r}],R=0;R<n.length;++R)for(var j=n[R],X=j.find(0),J=0;J<o.length;++J){var ee=o[J];if(wt(ee.to,X.from)<0||wt(ee.from,X.to)>0)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;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}function ir(e,t){if(!t)return;for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}function yn(e){return e.inclusiveLeft?-1:0}function mn(e){return e.inclusiveRight?1:0}function Ln(e,t){var r=e.lines.length-t.lines.length;if(r!=0)return r;var n=e.find(),o=t.find(),R=wt(n.from,o.from)||yn(e)-yn(t);if(R)return-R;var j=wt(n.to,o.to)||mn(e)-mn(t);return j||t.id-e.id}function en(e,t){var r=Vn&&e.markedSpans,n;if(r)for(var o=void 0,R=0;R<r.length;++R)o=r[R],o.marker.collapsed&&(t?o.from:o.to)==null&&(!n||Ln(n,o.marker)<0)&&(n=o.marker);return n}function Un(e){return en(e,!0)}function _n(e){return en(e,!1)}function mr(e,t){var r=Vn&&e.markedSpans,n;if(r)for(var o=0;o<r.length;++o){var R=r[o];R.marker.collapsed&&(R.from==null||R.from<t)&&(R.to==null||R.to>t)&&(!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<j.length;++X){var J=j[X];if(!J.marker.collapsed)continue;var ee=J.marker.find(0),he=wt(ee.from,r)||yn(J.marker)-yn(o),ve=wt(ee.to,n)||mn(J.marker)-mn(o);if(he>=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;o<r.length;++o){if(n=r[o],!n.marker.collapsed)continue;if(n.from==null)return!0;if(n.marker.widgetNode)continue;if(n.from==0&&n.marker.inclusiveLeft&&ti(e,t,n))return!0}}function ti(e,t,r){if(r.to==null){var n=r.marker.find(1,!0);return ti(e,n.line,Ht(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var o=void 0,R=0;R<t.markedSpans.length;++R)if(o=t.markedSpans[R],o.marker.collapsed&&!o.marker.widgetNode&&o.from==r.to&&(o.to==null||o.to!=r.from)&&(o.marker.inclusiveLeft||r.marker.inclusiveRight)&&ti(e,t,o))return!0}function Xr(e){e=gr(e);for(var t=0,r=e.parent,n=0;n<r.lines.length;++n){var o=r.lines[n];if(o==e)break;t+=o.height}for(var R=r.parent;R;r=R,R=r.parent)for(var j=0;j<R.children.length;++j){var X=R.children[j];if(X==r)break;t+=X.height}return t}function pi(e){if(e.height==0)return 0;for(var t=e.text.length,r,n=e;r=Un(n);){var o=r.find(0,!0);n=o.from.line,t+=o.from.ch-o.to.ch}for(n=e;r=_n(n);){var R=r.find(0,!0);t-=n.text.length-R.from.ch,n=R.to.line,t+=n.text.length-R.to.ch}return t}function ni(e){var t=e.display,r=e.doc;t.maxLine=Ve(r,r.first),t.maxLineLength=pi(t.maxLine),t.maxLineChanged=!0,r.iter(function(n){var o=pi(n);o>t.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;o<e.length;o++){var R=e.charAt(o);R==" "&&r&&(o==e.length-1||e.charCodeAt(o+1)==32)&&(R="\xA0"),n+=R,r=R==" "}return n}function vr(e,t){return function(r,n,o,R,j,X,J){o=o?o+" cm-force-border":"cm-force-border";for(var ee=r.pos,he=ee+n.length;;){for(var ve=void 0,Re=0;Re<t.length&&!(ve=t[Re],ve.to>ee&&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;j<r.length;j+=2)t.addToken(t,o.slice(R,R=r[j]),fn(r[j+1],t.cm.options));return}for(var X=o.length,J=0,ee=1,he="",ve,Re,Se=0,Ke,et,gt,At,Ut;;){if(Se==J){Ke=et=gt=Re="",Ut=null,At=null,Se=Infinity;for(var Rt=[],Wt=void 0,tn=0;tn<n.length;++tn){var Yt=n[tn],pn=Yt.marker;if(pn.type=="bookmark"&&Yt.from==J&&pn.widgetNode)Rt.push(pn);else if(Yt.from<=J&&(Yt.to==null||Yt.to>J||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<Wt.length;Tr+=2)Wt[Tr+1]==Se&&(et+=" "+Wt[Tr]);if(!At||At.from==J)for(var Jn=0;Jn<Rt.length;++Jn)gn(t,0,Rt[Jn]);if(At&&(At.from||0)==J){if(gn(t,(At.to==null?X+1:At.to)-J,At.marker,At.from==null),At.to==null)return;At.to==J&&(At=!1)}}if(J>=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;R<r;R=o){var j=new Tn(e.doc,Ve(e.doc,R),R);o=R+j.size,n.push(j)}return n}var tr=null;function Gr(e){tr?tr.ops.push(e):e.ownsGroup=tr={ops:[e],delayedCallbacks:[]}}function Ja(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r].call(null);for(var n=0;n<e.ops.length;n++){var o=e.ops[n];if(o.cursorActivityHandlers)for(;o.cursorActivityCalled<o.cursorActivityHandlers.length;)o.cursorActivityHandlers[o.cursorActivityCalled++].call(null,o.cm)}}while(r<t.length)}function Qa(e,t){var r=e.ownsGroup;if(!r)return;try{Ja(r)}finally{tr=null,t(r)}}var wi=null;function cr(e,t){var r=Pt(e,t);if(!r.length)return;var n=Array.prototype.slice.call(arguments,2),o;tr?o=tr.delayedCallbacks:wi?o=wi:(o=wi=[],setTimeout(Za,0));for(var R=function(X){o.push(function(){return r[X].apply(null,n)})},j=0;j<r.length;++j)R(j)}function Za(){var e=wi;wi=null;for(var t=0;t<e.length;++t)e[t]()}function Fi(e,t,r,n){for(var o=0;o<t.changes.length;o++){var R=t.changes[o];R=="text"?qa(e,t):R=="gutter"?Aa(e,t,r,n):R=="class"?ta(e,t):R=="widget"&&Ai(e,t,n)}t.changes=null}function mi(e){return e.node==e.text&&(e.node=a("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),K&&N<8&&(e.node.style.zIndex=2)),e.node}function di(e,t){var r=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(r&&(r+=" CodeMirror-linebackground"),t.background)r?t.background.className=r:(t.background.parentNode.removeChild(t.background),t.background=null);else if(r){var n=mi(t);t.background=n.insertBefore(a("div",null,r),n.firstChild),e.display.input.setUneditable(t.background)}}function wa(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):bn(e,t)}function qa(e,t){var r=t.text.className,n=wa(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,ta(e,t)):r&&(t.text.className=r)}function ta(e,t){di(e,t),t.line.wrapClass?mi(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var r=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=r||""}function Aa(e,t,r,n){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var o=mi(t);t.gutterBackground=a("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),o.insertBefore(t.gutterBackground,t.text)}var R=t.line.gutterMarkers;if(e.options.lineNumbers||R){var j=mi(t),X=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(X),j.insertBefore(X,t.text),t.line.gutterClass&&(X.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!R||!R["CodeMirror-linenumbers"])&&(t.lineNumber=X.appendChild(a("div",pt(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),R)for(var J=0;J<e.display.gutterSpecs.length;++J){var ee=e.display.gutterSpecs[J].className,he=R.hasOwnProperty(ee)&&R[ee];he&&X.appendChild(a("div",[he],"CodeMirror-gutter-elt","left: "+n.gutterLeft[ee]+"px; width: "+n.gutterWidth[ee]+"px"))}}}function Ai(e,t,r){t.alignable&&(t.alignable=null);for(var n=E("CodeMirror-linewidget"),o=t.node.firstChild,R=void 0;o;o=R)R=o.nextSibling,n.test(o.className)&&t.node.removeChild(o);na(e,t,r)}function Ra(e,t,r,n){var o=wa(e,t);return t.text=t.node=o.pre,o.bgClass&&(t.bgClass=o.bgClass),o.textClass&&(t.textClass=o.textClass),ta(e,t),Aa(e,t,r,n),na(e,t,n),t.node}function na(e,t,r){if(Ri(e,t.line,t,r,!0),t.rest)for(var n=0;n<t.rest.length;n++)Ri(e,t.rest[n],t,r,!1)}function Ri(e,t,r,n,o){if(!t.widgets)return;for(var R=mi(r),j=0,X=t.widgets;j<X.length;++j){var J=X[j],ee=a("div",[J.node],"CodeMirror-linewidget"+(J.className?" "+J.className:""));J.handleMouseEvents||ee.setAttribute("cm-ignore-events","true"),eo(J,ee,r,n),e.display.input.setUneditable(ee),o&&J.above?R.insertBefore(ee,r.gutter||r.text):R.appendChild(ee),cr(J,"redraw")}}function eo(e,t,r,n){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var o=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(o-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=o+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function gi(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!_(document.body,e.node)){var r="position: relative;";e.coverGutter&&(r+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(r+="width: "+t.display.wrapper.clientWidth+"px;"),s(t.display.measure,a("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function ri(e,t){for(var r=ue(t);r!=e.wrapper;r=r.parentNode)if(!r||r.nodeType==1&&r.getAttribute("cm-ignore-events")=="true"||r.parentNode==e.sizer&&r!=e.mover)return!0}function ji(e){return e.lineSpace.offsetTop}function Li(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function La(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=s(e.measure,a("pre","x","CodeMirror-line-like")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return!isNaN(n.left)&&!isNaN(n.right)&&(e.cachedPaddingH=n),n}function Zr(e){return ye-e.display.nativeBarWidth}function ii(e){return e.display.scroller.clientWidth-Zr(e)-e.display.barWidth}function Pi(e){return e.display.scroller.clientHeight-Zr(e)-e.display.barHeight}function bt(e,t,r){var n=e.options.lineWrapping,o=n&&ii(e);if(!t.measure.heights||n&&t.measure.width!=o){var R=t.measure.heights=[];if(n){t.measure.width=o;for(var j=t.text.firstChild.getClientRects(),X=0;X<j.length-1;X++){var J=j[X],ee=j[X+1];Math.abs(J.bottom-ee.bottom)>2&&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;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var o=0;o<e.rest.length;o++)if(qt(e.rest[o])>r)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<e.display.viewTo)return e.display.view[Oi(e,t)];var r=e.display.externalMeasured;if(r&&t>=r.lineN&&t<r.lineN+r.size)return r}function vt(e,t){var r=qt(t),n=Et(e,r);n&&!n.text?n=null:n&&n.changes&&(Fi(e,n,r,ra(e)),e.curOp.forceUpdate=!0),n||(n=We(e,t));var o=dt(n,t,r);return{line:t,view:n,rect:null,map:o.map,cache:o.cache,before:o.before,hasHeights:!1}}function Ct(e,t,r,n,o){t.before&&(r=-1);var R=r+(n||""),j;return t.cache.hasOwnProperty(R)?j=t.cache[R]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(bt(e,t.view,t.rect),t.hasHeights=!0),j=An(e,t,r,n),j.bogus||(t.cache[R]=j)),{left:j.left,right:j.right,top:o?j.rtop:j.top,bottom:o?j.rbottom:j.bottom}}var Zt={left:0,right:0,top:0,bottom:0};function dn(e,t,r){for(var n,o,R,j,X,J,ee=0;ee<e.length;ee+=3)if(X=e[ee],J=e[ee+1],t<X?(o=0,R=1,j="left"):t<J?(o=t-X,R=o+1):(ee==e.length-3||t==J&&e[ee+3]>t)&&(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<e.length-3&&e[ee+3]==e[ee+4]&&!e[ee+5].insertLeft;)n=e[(ee+=3)+2],j="right";break}return{node:n,start:o,end:R,collapse:j,coverStart:X,coverEnd:J}}function Mn(e,t){var r=Zt;if(t=="left")for(var n=0;n<e.length&&!((r=e[n]).left!=r.right);n++);else for(var o=e.length-1;o>=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+X<o.coverEnd&&He(t.line.text.charAt(o.coverStart+X));)++X;if(K&&N<9&&j==0&&X==o.coverEnd-o.coverStart?ee=R.parentNode.getBoundingClientRect():ee=Mn(g(R,j,X).getClientRects(),n),ee.left||ee.right||j==0)break;X=j,j=j-1,J="right"}K&&N<11&&(ee=In(e.display.measure,ee))}else{j>0&&(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<gt.length-1&&!(et<gt[At]);At++);var Ut=At?gt[At-1]:0,Rt=gt[At],Wt={left:(J=="right"?ee.right:ee.left)-t.rect.left,right:(J=="left"?ee.left:ee.right)-t.rect.left,top:Ut,bottom:Rt};return!ee.left&&!ee.right&&(Wt.bogus=!0),e.options.singleCursorHeightPerLine||(Wt.rtop=Se,Wt.rbottom=Ke),Wt}function In(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Kt(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*n,bottom:t.bottom*n}}function wn(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function nr(e){e.display.externalMeasure=null,f(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)wn(e.display.view[t])}function Gn(e){nr(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function zn(){return x&&h?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function yr(){return x&&h?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function sr(e){var t=0;if(e.widgets)for(var r=0;r<e.widgets.length;++r)e.widgets[r].above&&(t+=gi(e.widgets[r]));return t}function Qn(e,t,r,n,o){if(!o){var R=sr(t);r.top+=R,r.bottom+=R}if(n=="line")return r;n||(n="local");var j=Xr(t);if(n=="local"?j+=ji(e.display):j-=e.display.viewOffset,n=="page"||n=="window"){var X=e.display.lineSpace.getBoundingClientRect();j+=X.top+(n=="window"?0:yr());var J=X.left+(n=="window"?0:zn());r.left+=J,r.right+=J}return r.top+=j,r.bottom+=j,r}function br(e,t,r){if(r=="div")return t;var n=t.left,o=t.top;if(r=="page")n-=zn(),o-=yr();else if(r=="local"||!r){var R=e.display.sizer.getBoundingClientRect();n+=R.left,o+=R.top}var j=e.display.lineSpace.getBoundingClientRect();return{left:n-j.left,top:o-j.top}}function kr(e,t,r,n,o){return n||(n=Ve(e.doc,t.line)),Qn(e,n,Ie(e,n,t.ch,o),r)}function rn(e,t,r,n,o,R){n=n||Ve(e.doc,t.line),o||(o=vt(e,n));function j(Ke,et){var gt=Ct(e,o,Ke,et?"right":"left",R);return et?gt.left=gt.right:gt.right=gt.left,Qn(e,n,gt,r)}var X=ht(n,e.doc.direction),J=t.ch,ee=t.sticky;if(J>=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<Se.right-n,Rt=Ut==ee;Ke=Re+(Rt?0:1),gt=Rt?"after":"before",et=Ut?Se.left:Se.right}else{!ee&&(Ke==J||Ke==X)&&Ke++,gt=Ke==0?"after":Ke==t.text.length?"before":Ct(e,R,Ke-(ee?1:0)).bottom+j<=o==ee?"after":"before";var Wt=rn(e,Ge(r,Ke,gt),"line",t,R);et=Wt.left,At=o<Wt.top?-1:o>=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<o.length;Re++){var Se=o[Re];if(Se.from>=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=et<R?R-et+1e9:et-R;(!he||ve>gt)&&(he=Se,ve=gt)}return he||(he=o[o.length-1]),he.from<J&&(he={from:J,to:he.to,level:he.level}),he.to>ee&&(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;j<o.widgets.length;j++)o.widgets[j].height&&(R+=o.widgets[j].height);return r?R+(Math.ceil(o.text.length/n)||1)*t:R+t}}function to(e){var t=e.doc,r=Lo(e);t.iter(function(n){var o=r(n);o!=n.height&&cn(n,o)})}function Di(e,t,r,n){var o=e.display;if(!r&&ue(t).getAttribute("cm-not-content")=="true")return null;var R,j,X=o.lineSpace.getBoundingClientRect();try{R=t.clientX-X.left,j=t.clientY-X.top}catch(ve){return null}var J=Er(e,R,j),ee;if(n&&J.xRel>0&&(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;n<r.length;n++)if(t-=r[n].size,t<0)return n}function Fr(e,t,r,n){t==null&&(t=e.doc.first),r==null&&(r=e.doc.first+e.doc.size),n||(n=0);var o=e.display;if(n&&r<o.viewTo&&(o.updateLineNumbers==null||o.updateLineNumbers>t)&&(o.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=o.viewTo)Vn&&Ti(e.doc,t)<o.viewTo&&yi(e);else if(r<=o.viewFrom)Vn&&ei(e.doc,r+n)>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<ee.lineN?ee.lineN+=n:t<ee.lineN+ee.size&&(o.externalMeasured=null))}function vi(e,t,r){e.curOp.viewChanged=!0;var n=e.display,o=e.display.externalMeasured;if(o&&t>=o.lineN&&t<o.lineN+o.size&&(n.externalMeasured=null),t<n.viewFrom||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;J<o;J++)X+=j[J].size;if(X!=t){if(n>0){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.viewFrom<t&&(n.view=n.view.slice(Oi(e,t))),n.viewFrom=t,n.viewTo<r?n.view=n.view.concat(or(e,n.viewTo,r)):n.viewTo>r&&(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<t.length;n++){var o=t[n];!o.hidden&&(!o.node||o.changes)&&++r}return r}function aa(e){e.display.input.showSelection(e.display.input.prepareSelection())}function Do(e,t){t===void 0&&(t=!0);for(var r=e.doc,n={},o=n.cursors=document.createDocumentFragment(),R=n.selection=document.createDocumentFragment(),j=0;j<r.sel.ranges.length;j++){if(!t&&j==r.sel.primIndex)continue;var X=r.sel.ranges[j];if(X.from().line>=e.display.viewTo||X.to().line<e.display.viewFrom)continue;var J=X.empty();(J||e.options.showCursorWhenSelecting)&&Oo(e,X.head,o),J||Xs(e,X,R)}return n}function Oo(e,t,r){var n=rn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),o=r.appendChild(a("div","\xA0","CodeMirror-cursor"));if(o.style.left=n.left+"px",o.style.top=n.top+"px",o.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",n.other){var R=r.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));R.style.display="",R.style.left=n.other.left+"px",R.style.top=n.other.top+"px",R.style.height=(n.other.bottom-n.other.top)*.85+"px"}}function Da(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,r){var n=e.display,o=e.doc,R=document.createDocumentFragment(),j=La(e.display),X=j.left,J=Math.max(n.sizerWidth,ii(e)-n.sizer.offsetLeft)-j.right,ee=o.direction=="ltr";function he(Rt,Wt,tn,Yt){Wt<0&&(Wt=0),Wt=Math.round(Wt),Yt=Math.round(Yt),R.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+Rt+`px;
top: `+Wt+"px; width: "+(tn==null?J-Rt:tn)+`px;
height: `+(Yt-Wt)+"px"))}function ve(Rt,Wt,tn){var Yt=Ve(o,Rt),pn=Yt.text.length,Wn,Tr;function Jn(ur,Hr){return kr(e,Ge(Rt,ur),"div",Yt,Hr)}function Vr(ur,Hr,Lr){var hr=Mr(e,Yt,null,ur),dr=Hr=="ltr"==(Lr=="after")?"left":"right",Zn=Lr=="after"?hr.begin:hr.end-(/\s/.test(Yt.text.charAt(hr.end-1))?2:1);return Jn(Zn,dr)[dr]}var Wr=ht(Yt,o.direction);return tt(Wr,Wt||0,tn==null?pn:tn,function(ur,Hr,Lr,hr){var dr=Lr=="ltr",Zn=Jn(ur,dr?"left":"right"),Kr=Jn(Hr-1,dr?"right":"left"),qi=Wt==null&&ur==0,Si=tn==null&&Hr==pn,Or=hr==0,li=!Wr||hr==Wr.length-1;if(Kr.top-Zn.top<=3){var wr=(ee?qi:Si)&&Or,Ao=(ee?Si:qi)&&li,hi=wr?X:(dr?Zn:Kr).left,Ui=Ao?J:(dr?Kr:Zn).right;he(hi,Zn.top,Ui-hi,Zn.bottom)}else{var Bi,Ur,ea,Ro;dr?(Bi=ee&&qi&&Or?X:Zn.left,Ur=ee?J:Vr(ur,Lr,"before"),ea=ee?X:Vr(Hr,Lr,"after"),Ro=ee&&Si&&li?J:Kr.right):(Bi=ee?Vr(ur,Lr,"before"):X,Ur=!ee&&qi&&Or?J:Zn.right,ea=!ee&&Si&&li?X:Kr.left,Ro=ee?Vr(Hr,Lr,"after"):J),he(Bi,Zn.top,Ur-Bi,Zn.bottom),Zn.bottom<Kr.top&&he(X,Zn.bottom,null,Kr.top),he(ea,Kr.top,Ro-ea,Kr.bottom)}(!Wn||Da(Zn,Wn)<0)&&(Wn=Zn),Da(Kr,Wn)<0&&(Wn=Kr),(!Tr||Da(Zn,Tr)<0)&&(Tr=Zn),Da(Kr,Tr)<0&&(Tr=Kr)}),{start:Wn,end:Tr}}var Re=t.from(),Se=t.to();if(Re.line==Se.line)ve(Re.line,Re.ch,Se.ch);else{var Ke=Ve(o,Re.line),et=Ve(o,Se.line),gt=gr(Ke)==gr(et),At=ve(Re.line,Re.ch,gt?Ke.text.length+1:null).end,Ut=ve(Se.line,gt?0:null,Se.ch).start;gt&&(At.top<Ut.top-2?(he(At.right,At.top,null,At.bottom),he(X,Ut.top,Ut.left,Ut.bottom)):he(At.right,At.top,Ut.left-At.right,At.bottom)),At.bottom<Ut.top&&he(X,At.bottom,null,Ut.top)}r.appendChild(R)}function no(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?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<t.view.length;n++){var o=t.view[n],R=e.options.lineWrapping,j=void 0,X=0;if(o.hidden)continue;if(K&&N<8){var J=o.node.offsetTop+o.node.offsetHeight;j=J-r,r=J}else{var ee=o.node.getBoundingClientRect();j=ee.bottom-ee.top,!R&&o.text.firstChild&&(X=o.text.firstChild.getBoundingClientRect().right-ee.left-1)}var he=o.line.height-j;if((he>.005||he<-.005)&&(cn(o.line,j),Io(o.line),o.rest))for(var ve=0;ve<o.rest.length;ve++)Io(o.rest[ve]);if(X>e.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<e.widgets.length;++t){var r=e.widgets[t],n=r.node.parentNode;n&&(r.height=n.offsetHeight)}}function ka(e,t,r){var n=r&&r.top!=null?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-ji(e));var o=r&&r.bottom!=null?r.bottom:n+e.wrapper.clientHeight,R=En(t,n),j=En(t,o);if(r&&r.ensure){var X=r.ensure.from.line,J=r.ensure.to.line;X<R?(R=X,j=En(t,Xr(Ve(t,X))+e.wrapper.clientHeight)):Math.min(J,t.lastLine())>=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.top<n,ee=t.bottom>X-n;if(t.top<o)j.scrollTop=J?0:t.top;else if(t.bottom>o+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.left<Re?j.scrollLeft=Math.max(0,t.left+ve-(Ke?0:10)):t.right>Se+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.ops.length;n++)r.ops[n].cm.curOp=null;qs(r)})}function qs(e){for(var t=e.ops,r=0;r<t.length;r++)el(t[r]);for(var n=0;n<t.length;n++)tl(t[n]);for(var o=0;o<t.length;o++)nl(t[o]);for(var R=0;R<t.length;R++)rl(t[R]);for(var j=0;j<t.length;j++)il(t[j])}function el(e){var t=e.cm,r=t.display;ol(t),e.updateMaxLine&&ni(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<r.viewFrom||e.scrollToPos.to.line>=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<t.doc.scrollLeft&&ki(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var r=e.focus&&e.focus==k();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Ki(t,e.barMeasure),e.updatedDisplay&&uo(t,e.barMeasure),e.selectionChanged&&no(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&ko(e.cm)}function il(e){var t=e.cm,r=t.display,n=t.doc;if(e.updatedDisplay&&Wo(t,e.update),r.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(r.wheelStartX=r.wheelStartY=null),e.scrollTop!=null&&Uo(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&ki(t,e.scrollLeft,!0,!0),e.scrollToPos){var o=Ys(t,p(n,e.scrollToPos.from),p(n,e.scrollToPos.to),e.scrollToPos.margin);$s(t,o)}var R=e.maybeHiddenMarkers,j=e.maybeUnhiddenMarkers;if(R)for(var X=0;X<R.length;++X)R[X].lines.length||Ue(R[X],"hide");if(j)for(var J=0;J<j.length;++J)j[J].lines.length&&Ue(j[J],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Ue(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function zr(e,t){if(e.curOp)return t();Ii(e);try{return t()}finally{Ni(e)}}function Cr(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Ii(e);try{return t.apply(e,arguments)}finally{Ni(e)}}}function Nr(e){return function(){if(this.curOp)return e.apply(this,arguments);Ii(this);try{return e.apply(this,arguments)}finally{Ni(this)}}}function Sr(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Ii(t);try{return e.apply(this,arguments)}finally{Ni(t)}}}function da(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,G(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=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&&Re<j.length;++Re)ve=j[Re]!=R.styles[Re];ve&&o.push(n.line),R.stateAfter=n.save(),n.nextLine()}else R.text.length<=e.options.maxHighlightLength&&jt(e,R.text,n),R.stateAfter=n.line%5==0?n.save():null,n.nextLine();if(+new Date>r)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<o.length;R++)vi(e,o[R],"text")})}var Ia=function(e,t,r){var n=e.display;this.viewport=t,this.visible=ka(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=ii(e),this.force=r,this.dims=ra(e),this.events=[]};Ia.prototype.signal=function(e,t){fe(e,t)&&this.events.push(arguments)},Ia.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Ue.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Zr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Zr(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=k();if(!t||!_(e.display.lineDiv,t))return null;var r={activeElt:t};if(window.getSelection){var n=window.getSelection();n.anchorNode&&n.extend&&_(e.display.lineDiv,n.anchorNode)&&(r.anchorNode=n.anchorNode,r.anchorOffset=n.anchorOffset,r.focusNode=n.focusNode,r.focusOffset=n.focusOffset)}return r}function ll(e){if(!e||!e.activeElt||e.activeElt==k())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&_(document.body,e.anchorNode)&&_(document.body,e.focusNode)){var t=window.getSelection(),r=document.createRange();r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),t.removeAllRanges(),t.addRange(r),t.extend(e.focusNode,e.focusOffset)}}function oo(e,t){var r=e.display,n=e.doc;if(t.editorIsHidden)return yi(e),!1;if(!t.force&&t.visible.from>=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.viewFrom<R&&R-r.viewFrom<20&&(R=Math.max(n.first,r.viewFrom)),r.viewTo>j&&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<J.length;he++){var ve=J[he];if(!ve.hidden)if(!ve.node||ve.node.parentNode!=R){var Re=Ra(e,ve,ee,r);R.insertBefore(Re,j)}else{for(;j!=ve.node;)j=X(j);var Se=o&&t!=null&&t<=ee&&ve.lineNumber;ve.changes&&(pe(ve.changes,"gutter")>-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;j<r.length;j++)if(!r[j].hidden){e.options.fixedGutter&&(r[j].gutter&&(r[j].gutter.style.left=R),r[j].gutterBackground&&(r[j].gutterBackground.style.left=R));var X=r[j].alignable;if(X)for(var J=0;J<X.length;J++)X[J].style.left=R}e.options.fixedGutter&&(t.gutters.style.left=n+o+"px")}function Ko(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=pt(e.options,t.first+t.size-1),n=e.display;if(r.length!=n.lineNumChars){var o=n.measure.appendChild(a("div",[a("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),R=o.firstChild.offsetWidth,j=o.offsetWidth-R;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(R,n.lineGutter.offsetWidth-j)+1,n.lineNumWidth=n.lineNumInnerWidth+j,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",lo(e.display),!0}return!1}function co(e,t){for(var r=[],n=!1,o=0;o<e.length;o++){var R=e[o],j=null;if(typeof R!="string"&&(j=R.style,R=R.className),R=="CodeMirror-linenumbers")if(t)n=!0;else continue;r.push({className:R,style:j})}return t&&!n&&r.push({className:"CodeMirror-linenumbers",style:null}),r}function Go(e){var t=e.gutters,r=e.gutterSpecs;f(t),e.lineGutter=null;for(var n=0;n<r.length;++n){var o=r[n],R=o.className,j=o.style,X=t.appendChild(a("div",null,"CodeMirror-gutter "+R));j&&(X.style.cssText=j),R=="CodeMirror-linenumbers"&&(e.lineGutter=X,X.style.width=(e.lineNumWidth||1)+"px")}t.style.display=r.length?"":"none",lo(e)}function ca(e){Go(e.display),Fr(e),Ho(e)}function dl(e,t,r,n){var o=this;this.input=r,o.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),o.scrollbarFiller.setAttribute("cm-not-content","true"),o.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),o.gutterFiller.setAttribute("cm-not-content","true"),o.lineDiv=b("div",null,"CodeMirror-code"),o.selectionDiv=a("div",null,null,"position: relative; z-index: 1"),o.cursorDiv=a("div",null,"CodeMirror-cursors"),o.measure=a("div",null,"CodeMirror-measure"),o.lineMeasure=a("div",null,"CodeMirror-measure"),o.lineSpace=b("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none");var R=b("div",[o.lineSpace],"CodeMirror-lines");o.mover=a("div",[R],null,"position: relative"),o.sizer=a("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=a("div",null,null,"position: absolute; height: "+ye+"px; width: 1px;"),o.gutters=a("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=a("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=a("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),K&&N<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),!O&&!(D&&l)&&(o.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(o.wrapper):e(o.wrapper)),o.viewFrom=o.viewTo=t.first,o.reportedViewFrom=o.reportedViewTo=t.first,o.view=[],o.renderedView=null,o.externalMeasured=null,o.viewOffset=0,o.lastWrapHeight=o.lastWrapWidth=0,o.updateLineNumbers=null,o.nativeBarWidth=o.barHeight=o.barWidth=0,o.scrollbarsClipped=!1,o.lineNumWidth=o.lineNumInnerWidth=o.lineNumChars=null,o.alignWidgets=!1,o.cachedCharWidth=o.cachedTextHeight=o.cachedPaddingH=null,o.maxLine=null,o.maxLineLength=0,o.maxLineChanged=!1,o.wheelDX=o.wheelDY=o.wheelStartX=o.wheelStartY=null,o.shift=!1,o.selForContextMenu=null,o.activeTouch=null,o.gutterSpecs=co(n.gutters,n.lineNumbers),Go(o),r.init(o)}var Na=0,$r=null;K?$r=-.53:D?$r=15:x?$r=-.7:P&&($r=-1/3);function zo(e){var t=e.wheelDeltaX,r=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),r==null&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:r==null&&(r=e.wheelDelta),{x:t,y:r}}function cl(e){var t=zo(e);return t.x*=$r,t.y*=$r,t}function Vo(e,t){var r=zo(t),n=r.x,o=r.y,R=e.display,j=R.scroller,X=j.scrollWidth>j.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<he.length;ve++)if(he[ve].node==ee){e.display.currentWheelTarget=ee;break e}}if(n&&!D&&!A&&$r!=null){o&&J&&sa(e,Math.max(0,j.scrollTop+o*$r)),ki(e,Math.max(0,j.scrollLeft+n*$r)),(!o||o&&J)&&ne(t),R.wheelStartX=null;return}if(o&&$r!=null){var Re=o*$r,Se=e.doc.scrollTop,Ke=Se+R.wrapper.clientHeight;Re<0?Se=Math.max(0,Se+Re-50):Ke=Math.min(e.doc.height,Ke+Re+50),so(e,{top:Se,bottom:Ke})}Na<20&&(R.wheelStartX==null?(R.wheelStartX=j.scrollLeft,R.wheelStartY=j.scrollTop,R.wheelDX=n,R.wheelDY=o,setTimeout(function(){if(R.wheelStartX==null)return;var et=j.scrollLeft-R.wheelStartX,gt=j.scrollTop-R.wheelStartY,At=gt&&R.wheelDY&&gt/R.wheelDY||et&&R.wheelDX&&et/R.wheelDX;if(R.wheelStartX=R.wheelStartY=null,!At)return;$r=($r*Na+At)/(Na+1),++Na},200)):(R.wheelDX+=n,R.wheelDY+=o))}var Yr=function(e,t){this.ranges=e,this.primIndex=t};Yr.prototype.primary=function(){return this.ranges[this.primIndex]},Yr.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var r=this.ranges[t],n=e.ranges[t];if(!Hn(r.anchor,n.anchor)||!Hn(r.head,n.head))return!1}return!0},Yr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Pn(fr(this.ranges[t].anchor),fr(this.ranges[t].head));return new Yr(e,this.primIndex)},Yr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Yr.prototype.contains=function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var n=this.ranges[r];if(wt(t,n.from())>=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;R<t.length;R++){var j=t[R],X=t[R-1],J=wt(X.to(),j.from());if(n&&!j.empty()?J>0: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;n<e.sel.ranges.length;n++){var o=e.sel.ranges[n];r.push(new Pn(Xo(o.anchor,t),Xo(o.head,t)))}return ai(e.cm,r,e.sel.primIndex)}function $o(e,t,r){return e.line==t.line?Ge(r.line,e.ch-t.ch+r.ch):Ge(r.line+(e.line-t.line),e.ch)}function hl(e,t,r){for(var n=[],o=Ge(e.first,0),R=o,j=0;j<t.length;j++){var X=t[j],J=$o(X.from,o,R),ee=$o(Ei(X),o,R);if(o=X.to,R=ee,r=="around"){var he=e.sel.ranges[j],ve=wt(he.head,he.anchor)<0;n[j]=new Pn(ve?ee:J,ve?J:ee)}else n[j]=new Pn(J,J)}return new Yr(n,e.sel.primIndex)}function fo(e){e.doc.mode=Ft(e.options,e.doc.modeOption),ha(e)}function ha(e){e.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,da(e,100),e.state.modeGen++,e.curOp&&Fr(e)}function Yo(e,t){return t.from.ch==0&&t.to.ch==0&&Ee(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function po(e,t,r,n){function o(Ut){return r?r[Ut]:null}function R(Ut,Rt,Wt){si(Ut,Rt,Wt,n),cr(Ut,"change",Ut,t)}function j(Ut,Rt){for(var Wt=[],tn=Ut;tn<Rt;++tn)Wt.push(new ui(ee[tn],o(tn),n));return Wt}var X=t.from,J=t.to,ee=t.text,he=Ve(e,X.line),ve=Ve(e,J.line),Re=Ee(ee),Se=o(ee.length-1),Ke=J.line-X.line;if(t.full)e.insert(0,j(0,ee.length)),e.remove(ee.length,e.size-ee.length);else if(Yo(e,t)){var et=j(0,ee.length-1);R(ve,ve.text,Se),Ke&&e.remove(X.line,Ke),et.length&&e.insert(X.line,et)}else if(he==ve)if(ee.length==1)R(he,he.text.slice(0,X.ch)+Re+he.text.slice(J.ch),Se);else{var gt=j(1,ee.length-1);gt.push(new ui(Re+he.text.slice(J.ch),Se,n)),R(he,he.text.slice(0,X.ch)+ee[0],o(0)),e.insert(X.line+1,gt)}else if(ee.length==1)R(he,he.text.slice(0,X.ch)+ee[0]+ve.text.slice(J.ch),o(0)),e.remove(X.line+1,Ke);else{R(he,he.text.slice(0,X.ch)+ee[0],o(0)),R(ve,Re+ve.text.slice(J.ch),Se);var At=j(1,ee.length-1);Ke>1&&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;X<o.linked.length;++X){var J=o.linked[X];if(J.doc==R)continue;var ee=j&&J.sharedHist;if(r&&!ee)continue;t(J.doc,ee),n(J.doc,o,ee)}}n(e,null,!0)}function Jo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,to(e),fo(e),Qo(e),e.options.lineWrapping||ni(e),e.options.mode=t.modeOption,Fr(e)}function Qo(e){(e.doc.direction=="rtl"?H:d)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){zr(e,function(){Qo(e),Fr(e)})}function Ua(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function mo(e,t){var r={from:fr(t.from),to:Ei(t),text:ln(e,t.from,t.to)};return es(e,r,t.from.line,t.to.line+1),xi(e,function(n){return es(n,r,t.from.line,t.to.line+1)},!0),r}function Zo(e){for(;e.length;){var t=Ee(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Zo(e.done),Ee(e.done);if(e.done.length&&!Ee(e.done).ranges)return Ee(e.done);if(e.done.length>1&&!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<e.length;++r)e[r].marker.explicitlyCleared?t||(t=e.slice(0,r)):t&&t.push(e[r]);return t?t.length?t:null:e}function yl(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=[],o=0;o<t.text.length;++o)n.push(vl(r[o]));return n}function ts(e,t){var r=yl(e,t),n=Sn(e,t);if(!r)return n;if(!n)return r;for(var o=0;o<r.length;++o){var R=r[o],j=n[o];if(R&&j){e:for(var X=0;X<j.length;++X){for(var J=j[X],ee=0;ee<R.length;++ee)if(R[ee].marker==J.marker)continue e;R.push(J)}}else j&&(r[o]=j)}return r}function Gi(e,t,r){for(var n=[],o=0;o<e.length;++o){var R=e[o];if(R.ranges){n.push(r?Yr.prototype.deepCopy.call(R):R);continue}var j=R.changes,X=[];n.push({changes:X});for(var J=0;J<j.length;++J){var ee=j[J],he=void 0;if(X.push({from:ee.from,to:ee.to,text:ee.text}),t)for(var ve in ee)(he=ve.match(/^spans_(\d+)$/))&&(pe(t,Number(he[1]))>-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<e.sel.ranges.length;R++)n[R]=go(e.sel.ranges[R],t[R],null,o);var j=ai(e.cm,n,e.sel.primIndex);Dr(e,j,r)}function vo(e,t,r,n){var o=e.sel.ranges.slice(0);o[t]=r,Dr(e,ai(e.cm,o,e.sel.primIndex),n)}function rs(e,t,r,n){Dr(e,bi(t,r),n)}function bl(e,t,r){var n={ranges:t.ranges,update:function(o){this.ranges=[];for(var R=0;R<o.length;R++)this.ranges[R]=new Pn(p(e,o[R].anchor),p(e,o[R].head))},origin:r&&r.origin};return Ue(e,"beforeSelectionChange",e,n),e.cm&&Ue(e.cm,"beforeSelectionChange",e.cm,n),n.ranges!=t.ranges?ai(e.cm,n.ranges,n.ranges.length-1):t}function is(e,t,r){var n=e.history.done,o=Ee(n);o&&o.ranges?(n[n.length-1]=t,ja(e,t,r)):Dr(e,t,r)}function Dr(e,t,r){ja(e,t,r),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function ja(e,t,r){(fe(e,"beforeSelectionChange")||e.cm&&fe(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,r));var n=r&&r.bias||(wt(t.primary().head,e.sel.primary().head)<0?-1:1);as(e,ss(e,t,n,!0)),!(r&&r.scroll===!1)&&e.cm&&Hi(e.cm)}function as(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,xe(e.cm)),cr(e,"cursorActivity",e)}function os(e){as(e,ss(e,e.sel,null,!1))}function ss(e,t,r,n){for(var o,R=0;R<t.ranges.length;R++){var j=t.ranges[R],X=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[R],J=Wa(e,j.anchor,X&&X.anchor,r,n),ee=Wa(e,j.head,X&&X.head,r,n);(o||J!=j.anchor||ee!=j.head)&&(o||(o=t.ranges.slice(0,R)),o[R]=new Pn(J,ee))}return o?ai(e.cm,o,t.primIndex):t}function zi(e,t,r,n,o){var R=Ve(e,t.line);if(R.markedSpans)for(var j=0;j<R.markedSpans.length;++j){var X=R.markedSpans[j],J=X.marker,ee="selectLeft"in J?!J.selectLeft:J.inclusiveLeft,he="selectRight"in J?!J.selectRight:J.inclusiveRight;if((X.from==null||(ee?X.from<=t.ch:X.from<t.ch))&&(X.to==null||(he?X.to>=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<e.first+e.size-1?Ge(t.line+1,0):null:new Ge(t.line,t.ch+r)}function us(e){e.setSelection(Ge(e.firstLine(),0),Ge(e.lastLine()),_e)}function ds(e,t,r){var n={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return n.canceled=!0}};return r&&(n.update=function(o,R,j,X){o&&(n.from=p(e,o)),R&&(n.to=p(e,R)),j&&(n.text=j),X!==void 0&&(n.origin=X)}),Ue(e,"beforeChange",e,n),e.cm&&Ue(e.cm,"beforeChange",e.cm,n),n.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:n.from,to:n.to,text:n.text,origin:n.origin}}function Vi(e,t,r){if(e.cm){if(!e.cm.curOp)return Cr(e.cm,Vi)(e,t,r);if(e.cm.state.suppressEdits)return}if((fe(e,"beforeChange")||e.cm&&fe(e.cm,"beforeChange"))&&(t=ds(e,t,!0),!t))return;var n=qr&&!r&&jn(e,t.from,t.to);if(n)for(var o=n.length-1;o>=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<X.length&&!(R=X[ee],r?R.ranges&&!R.equals(e.sel):!R.ranges);ee++);if(ee==X.length)return;for(o.lastOrigin=o.lastSelOrigin=null;;)if(R=X.pop(),R.ranges){if(Ba(R,J),r&&!R.equals(e.sel)){Dr(e,R,{clearRedo:!1});return}j=R}else if(n){X.push(R);return}else break;var he=[];Ba(j,J),J.push({changes:he,generation:o.generation}),o.generation=R.generation||++o.maxGeneration;for(var ve=fe(e,"beforeChange")||e.cm&&fe(e.cm,"beforeChange"),Re=function(et){var gt=R.changes[et];if(gt.origin=t,ve&&!ds(e,gt,!1))return X.length=0,{};he.push(mo(e,gt));var At=et?ho(e,gt):Ee(X);fa(e,gt,At,ts(e,gt)),!et&&e.cm&&e.cm.scrollIntoView({from:gt.from,to:Ei(gt)});var Ut=[];xi(e,function(Rt,Wt){!Wt&&pe(Ut,Rt.history)==-1&&(ms(Rt.history,gt),Ut.push(Rt.history)),fa(Rt,gt,null,ts(Rt,gt))})},Se=R.changes.length-1;Se>=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;n<r.viewTo;n++)vi(e.cm,n,"gutter")}}function fa(e,t,r,n){if(e.cm&&!e.cm.curOp)return Cr(e.cm,fa)(e,t,r,n);if(t.to.line<e.first){hs(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var o=t.text.length-1-(e.first-t.from.line);hs(e,o),t={from:Ge(e.first,0),to:Ge(t.to.line+o,t.to.ch),text:[Ee(t.text)],origin:t.origin}}var R=e.lastLine();t.to.line>R&&(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){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function ps(e,t,r,n){for(var o=0;o<e.length;++o){var R=e[o],j=!0;if(R.ranges){R.copied||(R=e[o]=R.deepCopy(),R.copied=!0);for(var X=0;X<R.ranges.length;X++)fs(R.ranges[X].anchor,t,r,n),fs(R.ranges[X].head,t,r,n);continue}for(var J=0;J<R.changes.length;++J){var ee=R.changes[J];if(r<ee.from.line)ee.from=Ge(ee.from.line+n,ee.from.ch),ee.to=Ge(ee.to.line+n,ee.to.ch);else if(t<=ee.to.line){j=!1;break}}j||(e.splice(0,o+1),o=0)}}function ms(e,t){var r=t.from.line,n=t.to.line,o=t.text.length-(n-r)-1;ps(e.done,r,n,o),ps(e.undone,r,n,o)}function pa(e,t,r,n){var o=t,R=t;return typeof t=="number"?R=Ve(e,F(e,t)):o=qt(t),o==null?null:(n(R,o)&&e.cm&&vi(e.cm,o,r),R)}function ma(e){this.lines=e,this.parent=null;for(var t=0,r=0;r<e.length;++r)e[r].parent=this,t+=e[r].height;this.height=t}ma.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r=e,n=e+t;r<n;++r){var o=this.lines[r];this.height-=o.height,Gt(o),cr(o,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0;n<t.length;++n)t[n].parent=this},iterN:function(e,t,r){for(var n=e+t;e<n;++e)if(r(this.lines[e]))return!0}};function ga(e){this.children=e;for(var t=0,r=0,n=0;n<e.length;++n){var o=e[n];t+=o.chunkSize(),r+=o.height,o.parent=this}this.size=t,this.height=r,this.parent=null}ga.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;r<this.children.length;++r){var n=this.children[r],o=n.chunkSize();if(e<o){var R=Math.min(t,o-e),j=n.height;if(n.removeInner(e,R),this.height-=j-n.height,o==R&&(this.children.splice(r--,1),n.parent=null),(t-=R)==0)break;e=0}else e-=o}if(this.size-t<25&&(this.children.length>1||!(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;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,r){this.size+=t.length,this.height+=r;for(var n=0;n<this.children.length;++n){var o=this.children[n],R=o.chunkSize();if(e<=R){if(o.insertInner(e,t,r),o.lines&&o.lines.length>50){for(var j=o.lines.length%25+25,X=j;X<o.lines.length;){var J=new ma(o.lines.slice(X,X+=25));o.height-=J.height,this.children.splice(++n,0,J),J.parent=this}o.lines=o.lines.slice(0,j),this.maybeSpill()}break}e-=R}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),r=new ga(t);if(e.parent){e.size-=r.size,e.height-=r.height;var o=pe(e.parent.children,e);e.parent.children.splice(o+1,0,r)}else{var n=new ga(e.children);n.parent=e,e.children=[n,r],e=n}r.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,r){for(var n=0;n<this.children.length;++n){var o=this.children[n],R=o.chunkSize();if(e<R){var j=Math.min(t,R-e);if(o.iterN(e,j,r))return!0;if((t-=j)==0)break;e=0}else e-=R}}};var va=function(e,t,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.doc=e,this.node=t};va.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,n=qt(r);if(n==null||!t)return;for(var o=0;o<t.length;++o)t[o]==this&&t.splice(o--,1);t.length||(r.widgets=null);var R=gi(this);cn(r,Math.max(0,r.height-R)),e&&(zr(e,function(){gs(e,r,-R),vi(e,n,"widget")}),cr(e,"lineWidgetCleared",e,this,n))},va.prototype.changed=function(){var e=this,t=this.height,r=this.doc.cm,n=this.line;this.height=null;var o=gi(this)-t;if(!o)return;On(this.doc,n)||cn(n,n.height+o),r&&zr(r,function(){r.curOp.forceUpdate=!0,gs(r,n,o),cr(r,"lineWidgetChanged",r,e,qt(n))})},be(va);function gs(e,t,r){Xr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&ao(e,r)}function xl(e,t,r,n){var o=new va(e,r,n),R=e.cm;return R&&o.noHScroll&&(R.display.alignWidgets=!0),pa(e,t,"widget",function(j){var X=j.widgets||(j.widgets=[]);if(o.insertAt==null?X.push(o):X.splice(Math.min(X.length-1,Math.max(0,o.insertAt)),0,o),o.line=j,R&&!On(e,j)){var J=Xr(j)<e.scrollTop;cn(j,j.height+gi(o)),J&&ao(R,o.height),R.curOp.forceUpdate=!0}return!0}),R&&cr(R,"lineWidgetAdded",R,o,typeof t=="number"?t:qt(t)),o}var vs=0,_i=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++vs};_i.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&Ii(e),fe(this,"clear")){var r=this.find();r&&cr(this,"clear",r.from,r.to)}for(var n=null,o=null,R=0;R<this.lines.length;++R){var j=this.lines[R],X=Ht(j.markedSpans,this);e&&!this.collapsed?vi(e,qt(j),"text"):e&&(X.to!=null&&(o=qt(j)),X.from!=null&&(n=qt(j))),j.markedSpans=Ot(j.markedSpans,X),X.from==null&&this.collapsed&&!On(this.doc,j)&&e&&cn(j,_r(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var J=0;J<this.lines.length;++J){var ee=gr(this.lines[J]),he=pi(ee);he>e.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;o<this.lines.length;++o){var R=this.lines[o],j=Ht(R.markedSpans,this);if(j.from!=null&&(r=Ge(t?R:qt(R),j.from),e==-1))return r;if(j.to!=null&&(n=Ge(t?R:qt(R),j.to),e==1))return n}return r&&{from:r,to:n}},_i.prototype.changed=function(){var e=this,t=this.find(-1,!0),r=this,n=this.doc.cm;if(!t||!n)return;zr(n,function(){var o=t.line,R=qt(t.line),j=Et(n,R);if(j&&(wn(j),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0,!On(r.doc,o)&&r.height!=null){var X=r.height;r.height=null;var J=gi(r)-X;J&&cn(o,o.height+J)}cr(n,"markerChanged",n,e)})},_i.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||pe(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},_i.prototype.detachLine=function(e){if(this.lines.splice(pe(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},be(_i);function $i(e,t,r,n,o){if(n&&n.shared)return _l(e,t,r,n,o);if(e.cm&&!e.cm.curOp)return Cr(e.cm,$i)(e,t,r,n,o);var R=new _i(e,o),j=wt(t,r);if(n&&B(n,R,!1),j>0||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<e.length;++r)e[r].parent=this};ya.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();cr(this,"clear")},ya.prototype.find=function(e,t){return this.primary.find(e,t)},be(ya);function _l(e,t,r,n,o){n=B(n),n.shared=!1;var R=[$i(e,t,r,n,o)],j=R[0],X=n.widgetNode;return xi(e,function(J){X&&(n.widgetNode=X.cloneNode(!0)),R.push($i(J,p(J,t),p(J,r),n,o));for(var ee=0;ee<J.linked.length;++ee)if(J.linked[ee].isParent)return;j=Ee(R)}),new ya(R,j)}function ys(e){return e.findMarks(Ge(e.first,0),e.clipPos(Ge(e.lastLine())),function(t){return t.parent})}function Cl(e,t){for(var r=0;r<t.length;r++){var n=t[r],o=n.find(),R=e.clipPos(o.from),j=e.clipPos(o.to);if(wt(R,j)){var X=$i(e,R,j,n.primary,n.primary.type);n.markers.push(X),X.parent=n}}}function Sl(e){for(var t=function(n){var o=e[n],R=[o.primary.doc];xi(o.primary.doc,function(J){return R.push(J)});for(var j=0;j<o.markers.length;j++){var X=o.markers[j];pe(R,X.doc)==-1&&(X.parent=null,o.markers.splice(j--,1))}},r=0;r<e.length;r++)t(r)}var Tl=0,jr=function(e,t,r,n,o){if(!(this instanceof jr))return new jr(e,t,r,n,o);r==null&&(r=0),ga.call(this,[new ma([new ui("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=r;var R=Ge(r,0);this.sel=bi(R),this.history=new Ua(null),this.id=++Tl,this.modeOption=t,this.lineSep=n,this.direction=o=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),po(this,{from:R,to:R,text:e}),Dr(this,bi(R),_e)};jr.prototype=Be(ga.prototype,{constructor:jr,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,n=0;n<t.length;++n)r+=t[n].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=$t(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Sr(function(e){var t=Ge(this.first,0),r=this.first+this.size-1;Vi(this,{from:t,to:Ge(r,Ve(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&oa(this.cm,0,0),Dr(this,bi(t),_e)}),replaceRange:function(e,t,r,n){t=p(this,t),r=r?p(this,r):t,Xi(this,e,t,r,n)},getRange:function(e,t,r){var n=ln(this,p(this,e),p(this,t));return r===!1?n:n.join(r||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(on(this,e))return Ve(this,e)},getLineNumber:function(e){return qt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=Ve(this,e)),gr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return p(this,e)},getCursor:function(e){var t=this.sel.primary(),r;return e==null||e=="head"?r=t.head:e=="anchor"?r=t.anchor:e=="end"||e=="to"||e===!1?r=t.to():r=t.from(),r},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Sr(function(e,t,r){rs(this,p(this,typeof e=="number"?Ge(e,t||0):e),null,r)}),setSelection:Sr(function(e,t,r){rs(this,p(this,e),p(this,t||e),r)}),extendSelection:Sr(function(e,t,r){Fa(this,p(this,e),t&&p(this,t),r)}),extendSelections:Sr(function(e,t){ns(this,M(this,e),t)}),extendSelectionsBy:Sr(function(e,t){var r=Me(this.sel.ranges,e);ns(this,M(this,r),t)}),setSelections:Sr(function(e,t,r){if(!e.length)return;for(var n=[],o=0;o<e.length;o++)n[o]=new Pn(p(this,e[o].anchor),p(this,e[o].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Dr(this,ai(this.cm,n,t),r)}),addSelection:Sr(function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new Pn(p(this,e),p(this,t||e))),Dr(this,ai(this.cm,n,n.length-1),r)}),getSelection:function(e){for(var t=this.sel.ranges,r,n=0;n<t.length;n++){var o=ln(this,t[n].from(),t[n].to());r=r?r.concat(o):o}return e===!1?r:r.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],r=this.sel.ranges,n=0;n<r.length;n++){var o=ln(this,r[n].from(),r[n].to());e!==!1&&(o=o.join(e||this.lineSeparator())),t[n]=o}return t},replaceSelection:function(e,t,r){for(var n=[],o=0;o<this.sel.ranges.length;o++)n[o]=e;this.replaceSelections(n,t,r||"+input")},replaceSelections:Sr(function(e,t,r){for(var n=[],o=this.sel,R=0;R<o.ranges.length;R++){var j=o.ranges[R];n[R]={from:j.from(),to:j.to(),text:this.splitLines(e[R]),origin:r}}for(var X=t&&t!="end"&&hl(this,n,t),J=n.length-1;J>=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.done.length;n++)e.done[n].ranges||++t;for(var o=0;o<e.undone.length;o++)e.undone[o].ranges||++r;return{undo:t,redo:r}},clearHistory:function(){var e=this;this.history=new Ua(this.history.maxGeneration),xi(this,function(t){return t.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:Gi(this.history.done),undone:Gi(this.history.undone)}},setHistory:function(e){var t=this.history=new Ua(this.history.maxGeneration);t.done=Gi(e.done.slice(0),null,!0),t.undone=Gi(e.undone.slice(0),null,!0)},setGutterMarker:Sr(function(e,t,r){return pa(this,e,"gutter",function(n){var o=n.gutterMarkers||(n.gutterMarkers={});return o[t]=r,!r&&ze(o)&&(n.gutterMarkers=null),!0})}),clearGutter:Sr(function(e){var t=this;this.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&pa(t,r,"gutter",function(){return r.gutterMarkers[e]=null,ze(r.gutterMarkers)&&(r.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!on(this,e))return null;if(t=e,e=Ve(this,e),!e)return null}else if(t=qt(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:Sr(function(e,t,r){return pa(this,e,t=="gutter"?"gutter":"class",function(n){var o=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!n[o])n[o]=r;else{if(E(r).test(n[o]))return!1;n[o]+=" "+r}return!0})}),removeLineClass:Sr(function(e,t,r){return pa(this,e,t=="gutter"?"gutter":"class",function(n){var o=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",R=n[o];if(R)if(r==null)n[o]=null;else{var j=R.match(E(r));if(!j)return!1;var X=j.index+j[0].length;n[o]=R.slice(0,j.index)+(!j.index||X==R.length?"":" ")+R.slice(X)||null}else return!1;return!0})}),addLineWidget:Sr(function(e,t,r){return xl(this,e,t,r)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return $i(this,p(this,e),p(this,t),r,r&&r.type||"range")},setBookmark:function(e,t){var r={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=p(this,e),$i(this,e,e,r,"bookmark")},findMarksAt:function(e){e=p(this,e);var t=[],r=Ve(this,e.line).markedSpans;if(r)for(var n=0;n<r.length;++n){var o=r[n];(o.from==null||o.from<=e.ch)&&(o.to==null||o.to>=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.length;X++){var J=j[X];!(J.to!=null&&o==e.line&&e.ch>=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;n<r.length;++n)r[n].from!=null&&e.push(r[n].marker)}),e},posFromIndex:function(e){var t,r=this.first,n=this.lineSeparator().length;return this.iter(function(o){var R=o.text.length+n;if(R>e)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.line<this.first||e.ch<0)return 0;var r=this.lineSeparator().length;return this.iter(this.first,e.line,function(n){t+=n.text.length+r}),t},copy:function(e){var t=new jr($t(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,r=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<r&&(r=e.to);var n=new jr($t(this,t,r),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Cl(n,ys(this)),n},unlinkDoc:function(e){if(e instanceof $n&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var r=this.linked[t];if(r.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),Sl(ys(this));break}if(e.history==this.history){var n=[e.id];xi(e,function(o){return n.push(o.id)},!0),e.history=new Ua(null),e.history.done=Gi(this.history.done,n),e.history.undone=Gi(this.history.undone,n)}},iterLinkedDocs:function(e){xi(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):ut(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:Sr(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&fl(this.cm)})}),jr.prototype.eachLine=jr.prototype.iter;var bs=0;function wl(e){var t=this;if(Es(t),Ze(t,e)||ri(t.display,e))return;ne(e),K&&(bs=+new Date);var r=Di(t,e,!0),n=e.dataTransfer.files;if(!r||t.isReadOnly())return;if(n&&n.length&&window.FileReader&&window.File)for(var o=n.length,R=Array(o),j=0,X=function(){++j==o&&Cr(t,function(){r=p(t.doc,r);var Se={from:r,to:r,text:t.doc.splitLines(R.filter(function(Ke){return Ke!=null}).join(t.doc.lineSeparator())),origin:"paste"};Vi(t.doc,Se),is(t.doc,bi(p(t.doc,r),p(t.doc,Ei(Se))))})()},J=function(Se,Ke){if(t.options.allowDropFileTypes&&pe(t.options.allowDropFileTypes,Se.type)==-1){X();return}var et=new FileReader;et.onerror=function(){return X()},et.onload=function(){var gt=et.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(gt)){X();return}R[Ke]=gt,X()},et.readAsText(Se)},ee=0;ee<n.length;ee++)J(n[ee],ee);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-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<ve.length;++Re)Xi(t.doc,"",ve[Re].anchor,ve[Re].head,"drag");t.replaceSelection(he,"around","paste"),t.display.input.focus()}}catch(Se){}}}function Al(e,t){if(K&&(!e.state.draggingText||+new Date-bs<100)){de(t);return}if(Ze(e,t)||ri(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!P){var r=a("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",A&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),A&&r.parentNode.removeChild(r)}}function Rl(e,t){var r=Di(e,t);if(!r)return;var n=document.createDocumentFragment();Oo(e,r,n),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),s(e.display.dragCursor,n)}function Es(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function xs(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),r=[],n=0;n<t.length;n++){var o=t[n].CodeMirror;o&&r.push(o)}r.length&&r[0].operation(function(){for(var R=0;R<r.length;R++)e(r[R])})}var _s=!1;function Ll(){if(_s)return;Pl(),_s=!0}function Pl(){var e;ke(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,xs(Dl)},100))}),ke(window,"blur",function(){return xs(Wi)})}function Dl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Ci={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},ba=0;ba<10;ba++)Ci[ba+48]=Ci[ba+96]=String(ba);for(var Ka=65;Ka<=90;Ka++)Ci[Ka]=String.fromCharCode(Ka);for(var Ea=1;Ea<=12;Ea++)Ci[Ea+111]=Ci[Ea+63235]="F"+Ea;var ci={};ci.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},ci.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},ci.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},ci.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},ci.default=i?ci.macDefault:ci.pcDefault;function Ol(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var r,n,o,R,j=0;j<t.length-1;j++){var X=t[j];if(/^(cmd|meta|m)$/i.test(X))R=!0;else if(/^a(lt)?$/i.test(X))r=!0;else if(/^(c|ctrl|control)$/i.test(X))n=!0;else if(/^s(hift)?$/i.test(X))o=!0;else throw new Error("Unrecognized modifier name: "+X)}return r&&(e="Alt-"+e),n&&(e="Ctrl-"+e),R&&(e="Cmd-"+e),o&&(e="Shift-"+e),e}function kl(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if(n=="..."){delete e[r];continue}for(var o=Me(r.split(" "),Ol),R=0;R<o.length;R++){var j=void 0,X=void 0;R==o.length-1?(X=o.join(" "),j=n):(X=o.slice(0,R+1).join(" "),j="...");var J=t[X];if(!J)t[X]=j;else if(J!=j)throw new Error("Inconsistent bindings for "+X)}delete e[r]}for(var ee in t)e[ee]=t[ee];return e}function Yi(e,t,r,n){t=Ga(t);var o=t.call?t.call(e,n):t[e];if(o===!1)return"nothing";if(o==="...")return"multi";if(o!=null&&r(o))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return Yi(e,t.fallthrough,r,n);for(var R=0;R<t.fallthrough.length;R++){var j=Yi(e,t.fallthrough[R],r,n);if(j)return j}}}function Cs(e){var t=typeof e=="string"?e:Ci[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function Ss(e,t,r){var n=e;return t.altKey&&n!="Alt"&&(e="Alt-"+e),(m?t.metaKey:t.ctrlKey)&&n!="Ctrl"&&(e="Ctrl-"+e),(m?t.ctrlKey:t.metaKey)&&n!="Mod"&&(e="Cmd-"+e),!r&&t.shiftKey&&n!="Shift"&&(e="Shift-"+e),e}function Ts(e,t){if(A&&e.keyCode==34&&e.char)return!1;var r=Ci[e.keyCode];return r==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(r=e.code),Ss(r,e,t))}function Ga(e){return typeof e=="string"?ci[e]:e}function Ji(e,t){for(var r=e.doc.sel.ranges,n=[],o=0;o<r.length;o++){for(var R=t(r[o]);n.length&&wt(R.from,Ee(n).to)<=0;){var j=n.pop();if(wt(j.from,R.from)<0){R.from=j.from;break}}n.push(R)}zr(e,function(){for(var X=n.length-1;X>=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<r.ch))return bo(t,r,n);var X=function(At,Ut){return yo(t,At instanceof Ge?At.ch:At,Ut)},J,ee=function(At){return e.options.lineWrapping?(J=J||vt(e,t),Mr(e,t,J,At)):{begin:0,end:t.text.length}},he=ee(r.sticky=="before"?X(r,-1):r.ch);if(e.doc.direction=="rtl"||j.level==1){var ve=j.level==1==n<0,Re=X(r,ve?1:-1);if(Re!=null&&(ve?Re<=j.to&&Re<=he.end:Re>=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&&At<o.length;At+=Ut){var tn=o[At],Yt=Ut>0==(tn.level!=1),pn=Yt?Rt.begin:X(Rt.end,-1);if(tn.from<=pn&&pn<tn.to)return Wt(pn,Yt);if(pn=Yt?tn.from:X(tn.to,-1),Rt.begin<=pn&&pn<Rt.end)return Wt(pn,Yt)}},et=Ke(R+n,n,he);if(et)return et;var gt=n>0?he.end:X(he.begin,-1);return gt!=null&&!(n>0&&gt==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.line<e.lastLine()?{from:t.head,to:Ge(t.head.line+1,0)}:{from:t.head,to:Ge(t.head.line,r)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Ji(e,function(t){return{from:Ge(t.from().line,0),to:p(e.doc,Ge(t.to().line+1,0))}})},delLineLeft:function(e){return Ji(e,function(t){return{from:Ge(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Ji(e,function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div");return{from:n,to:t.from()}})},delWrappedLineRight:function(e){return Ji(e,function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div");return{from:t.from(),to:n}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(Ge(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Ge(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return ws(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return As(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div")},se)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:r},"div")},se)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div");return n.ch<e.getLine(n.line).search(/\S/)?As(e,t.head):n},se)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],r=e.listSelections(),n=e.options.tabSize,o=0;o<r.length;o++){var R=r[o].from(),j=te(e.getLine(R.line),R.ch,n);t.push(q(n-j%n))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return zr(e,function(){for(var t=e.listSelections(),r=[],n=0;n<t.length;n++){if(!t[n].empty())continue;var o=t[n].head,R=Ve(e.doc,o.line).text;if(R){if(o.ch==R.length&&(o=new Ge(o.line,o.ch-1)),o.ch>0)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;n<t.length;n++)e.indentLine(t[n].from().line,null,!0);Hi(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function ws(e,t){var r=Ve(e.doc,t),n=gr(r);return n!=r&&(t=qt(n)),Eo(!0,e,n,t,1)}function Il(e,t){var r=Ve(e.doc,t),n=fi(r);return n!=r&&(t=qt(n)),Eo(!0,e,r,t,-1)}function As(e,t){var r=ws(e,t.line),n=Ve(e.doc,r.line),o=ht(n,e.doc.direction);if(!o||o[0].level==0){var R=Math.max(r.ch,n.text.search(/\S/)),j=t.line==r.line&&t.ch<=R&&t.ch;return Ge(r.line,j?0:R,r.sticky)}return r}function za(e,t,r){if(typeof t=="string"&&(t=xa[t],!t))return!1;e.display.input.ensurePolled();var n=e.display.shift,o=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),o=t(e)!=Ce}finally{e.display.shift=n,e.state.suppressEdits=!1}return o}function Nl(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var o=Yi(t,e.state.keyMaps[n],r,e);if(o)return o}return e.options.extraKeys&&Yi(t,e.options.extraKeys,r,e)||Yi(t,e.options.keyMap,r,e)}var Ul=new ce;function _a(e,t,r,n){var o=e.state.keySeq;if(o){if(Cs(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Ul.set(50,function(){e.state.keySeq==o&&(e.state.keySeq=null,e.display.input.reset())}),Rs(e,o+" "+t,r,n))return!0}return Rs(e,t,r,n)}function Rs(e,t,r,n){var o=Nl(e,t,n);return o=="multi"&&(e.state.keySeq=t),o=="handled"&&cr(e,"keyHandled",e,t,r),(o=="handled"||o=="multi")&&(ne(r),no(e)),!!o}function Ls(e,t){var r=Ts(t,!0);return r?t.shiftKey&&!e.state.keySeq?_a(e,"Shift-"+r,t,function(n){return za(e,n,!0)})||_a(e,r,t,function(n){if(typeof n=="string"?/^go[A-Z]/.test(n):n.motion)return za(e,n)}):_a(e,r,t,function(n){return za(e,n)}):!1}function Bl(e,t,r){return _a(e,"'"+r+"'",t,function(n){return za(e,n,!0)})}var xo=null;function Ps(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=k(),Ze(t,e))return;K&&N<11&&e.keyCode==27&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=r==16||e.shiftKey;var n=Ls(t,e);A&&(xo=n?r:null,!n&&r==88&&!zt&&(i?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),D&&!i&&!n&&r==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),r==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Fl(t)}function Fl(e){var t=e.display.lineDiv;H(t,"CodeMirror-crosshair");function r(n){(n.keyCode==18||!n.altKey)&&(d(t,"CodeMirror-crosshair"),Tt(document,"keyup",r),Tt(document,"mouseover",r))}ke(document,"keyup",r),ke(document,"mouseover",r)}function Ds(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ze(this,e)}function Os(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(ri(t.display,e)||Ze(t,e)||e.ctrlKey&&!e.altKey||i&&e.metaKey)return;var r=e.keyCode,n=e.charCode;if(A&&r==xo){xo=null,ne(e);return}if(A&&(!e.which||e.which<10)&&Ls(t,e))return;var o=String.fromCharCode(n==null?r:n);if(o=="\b")return;if(Bl(t,e,o))return;t.display.input.onKeyPress(e)}var jl=400,_o=function(e,t,r){this.time=e,this.pos=t,this.button=r};_o.prototype.compare=function(e,t,r){return this.time+jl>e&&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.line<Yt.from)&&setTimeout(Cr(e,function(){Ke==Wt&&et(Rt)}),150)}else{var pn=Rt.clientY<Se.top?-20:Rt.clientY>Se.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<e.display.gutterSpecs.length;++J){var ee=j.gutters.childNodes[J];if(ee&&ee.getBoundingClientRect().right>=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;X<So.length;++X)So[X](this);Ni(this),O&&t.lineWrapping&&getComputedStyle(R.lineDiv).textRendering=="optimizelegibility"&&(R.lineDiv.style.textRendering="auto")}$n.defaults=Bs,$n.optionHandlers=Va;function Zl(e){var t=e.display;ke(t.scroller,"mousedown",Cr(e,ks)),K&&N<11?ke(t.scroller,"dblclick",Cr(e,function(J){if(Ze(e,J))return;var ee=Di(e,J);if(!ee||Co(e,J)||ri(e.display,J))return;ne(J);var he=e.findWordAt(ee);Fa(e.doc,he.anchor,he.head)})):ke(t.scroller,"dblclick",function(J){return Ze(e,J)||ne(J)}),ke(t.scroller,"contextmenu",function(J){return Ns(e,J)}),ke(t.input.getField(),"contextmenu",function(J){t.scroller.contains(J.target)||Ns(e,J)});var r,n={end:0};function o(){t.activeTouch&&(r=setTimeout(function(){return t.activeTouch=null},1e3),n=t.activeTouch,n.end=+new Date)}function R(J){if(J.touches.length!=1)return!1;var ee=J.touches[0];return ee.radiusX<=1&&ee.radiusY<=1}function j(J,ee){if(ee.left==null)return!0;var he=ee.left-J.left,ve=ee.top-J.top;return he*he+ve*ve>20*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(Re<he&&(ve+=q(he-Re)),ve!=ee)return Xi(o,ve,Ge(t,0),Ge(t,ee.length),"+input"),X.stateAfter=null,!0;for(var Ke=0;Ke<o.sel.ranges.length;Ke++){var et=o.sel.ranges[Ke];if(et.head.line==t&&et.head.ch<ee.length){var gt=Ge(t,ee.length);vo(o,Ke,new Pn(gt,gt));break}}}var oi=null;function Xa(e){oi=e}function To(e,t,r,n,o){var R=e.doc;e.display.shift=!1,n||(n=R.sel);var j=+new Date-200,X=o=="paste"||e.state.pasteIncoming>j,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<oi.text.length;he++)ee.push(R.splitLines(oi.text[he]))}}else J.length==n.ranges.length&&e.options.pasteLinesPerSelection&&(ee=Me(J,function(At){return[At]}));for(var ve=e.curOp.updateInput,Re=n.ranges.length-1;Re>=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<R.electricChars.length;X++)if(t.indexOf(R.electricChars.charAt(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;n<e.doc.sel.ranges.length;n++){var o=e.doc.sel.ranges[n].head.line,R={anchor:Ge(o,0),head:Ge(o+1,0)};r.push(R),t.push(e.getRange(R.anchor,R.head))}return{text:t,ranges:r}}function Hs(e,t,r,n){e.setAttribute("autocorrect",r?"":"off"),e.setAttribute("autocapitalize",n?"":"off"),e.setAttribute("spellcheck",!!t)}function Ks(){var e=a("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=a("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return O?e.style.width="1000px":e.setAttribute("wrap","off"),T&&(e.style.border="1px solid black"),Hs(e),t}function ql(e){var t=e.optionHandlers,r=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(n,o){var R=this.options,j=R[n];if(R[n]==o&&n!="mode")return;R[n]=o,t.hasOwnProperty(n)&&Cr(this,t[n])(this,o,j),Ue(this,"optionChange",this,n)},getOption:function(n){return this.options[n]},getDoc:function(){return this.doc},addKeyMap:function(n,o){this.state.keyMaps[o?"push":"unshift"](Ga(n))},removeKeyMap:function(n){for(var o=this.state.keyMaps,R=0;R<o.length;++R)if(o[R]==n||o[R].name==n)return o.splice(R,1),!0},addOverlay:Nr(function(n,o){var R=n.token?n:e.getMode(this.options,n);if(R.startState)throw new Error("Overlays may not be stateful.");Ne(this.state.overlays,{mode:R,modeSpec:n,opaque:o&&o.opaque,priority:o&&o.priority||0},function(j){return j.priority}),this.state.modeGen++,Fr(this)}),removeOverlay:Nr(function(n){for(var o=this.state.overlays,R=0;R<o.length;++R){var j=o[R].modeSpec;if(j==n||typeof n=="string"&&j.name==n){o.splice(R,1),this.state.modeGen++,Fr(this);return}}}),indentLine:Nr(function(n,o,R){typeof o!="string"&&typeof o!="number"&&(o==null?o=this.options.smartIndent?"smart":"prev":o=o?"add":"subtract"),on(this.doc,n)&&Ta(this,n,o,R)}),indentSelection:Nr(function(n){for(var o=this.doc.sel.ranges,R=-1,j=0;j<o.length;j++){var X=o[j];if(X.empty())X.head.line>R&&(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;ve<R;++ve)Ta(this,ve,n);var Re=this.doc.sel.ranges;J.ch==0&&o.length==Re.length&&Re[j].from().ch>0&&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]<X)R=ee+1;else{J=o[ee*2+2];break}}var he=J?J.indexOf("overlay "):-1;return he<0?J:he==0?null:J.slice(0,he-1)},getModeAt:function(n){var o=this.doc.mode;return o.innerMode?e.innerMode(o,this.getTokenAt(n).state).mode:o},getHelper:function(n,o){return this.getHelpers(n,o)[0]},getHelpers:function(n,o){var R=[];if(!r.hasOwnProperty(o))return R;var j=r[o],X=this.getModeAt(n);if(typeof X[o]=="string")j[X[o]]&&R.push(j[X[o]]);else if(X[o])for(var J=0;J<X[o].length;J++){var ee=j[X[o][J]];ee&&R.push(ee)}else X.helperType&&j[X.helperType]?R.push(j[X.helperType]):j[X.name]&&R.push(j[X.name]);for(var he=0;he<j._global.length;he++){var ve=j._global[he];ve.pred(X,this)&&pe(R,ve.val)==-1&&R.push(ve.val)}return R},getStateAfter:function(n,o){var R=this.doc;return n=F(R,n==null?R.first+R.size-1:n),ct(this,n+1,o).state},cursorCoords:function(n,o){var R,j=this.doc.sel.primary();return n==null?R=j.head:typeof n=="object"?R=p(this.doc,n):R=n?j.from():j.to(),rn(this,R,o||"page")},charCoords:function(n,o){return kr(this,p(this.doc,n),o||"page")},coordsChar:function(n,o){return n=br(this,n,o||"page"),Er(this,n.left,n.top)},lineAtHeight:function(n,o){return n=br(this,{top:n,left:0},o||"page").top,En(this.doc,n+this.display.viewOffset)},heightAtLine:function(n,o,R){var j=!1,X;if(typeof n=="number"){var J=this.doc.first+this.doc.size-1;n<this.doc.first?n=this.doc.first:n>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;ee<o&&!(J=wo(this.doc,J,X,R,j),J.hitSide);++ee);return J},moveH:Nr(function(n,o){var R=this;this.extendSelectionsBy(function(j){return R.display.shift||R.doc.extend||j.empty()?wo(R.doc,j.head,n,o,R.options.rtlMoveVisually):n<0?j.from():j.to()},se)}),deleteH:Nr(function(n,o){var R=this.doc.sel,j=this.doc;R.somethingSelected()?j.replaceSelection("",null,"+delete"):Ji(this,function(X){var J=wo(j,X.head,n,o,!1);return n<0?{from:J,to:X.head}:{from:X.head,to:J}})}),findPosV:function(n,o,R,j){var X=1,J=j;o<0&&(X=-1,o=-o);for(var ee=p(this.doc,n),he=0;he<o;++he){var ve=rn(this,ee,"div");if(J==null?J=ve.left:ve.left=J,ee=Gs(this,ve,X,R),ee.hitSide)break}return ee},moveV:Nr(function(n,o){var R=this,j=this.doc,X=[],J=!this.display.shift&&!j.extend&&j.sel.somethingSelected();if(j.extendSelectionsBy(function(he){if(J)return n<0?he.from():he.to();var ve=rn(R,he.head,"div");he.goalColumn!=null&&(ve.left=he.goalColumn),X.push(ve.left);var Re=Gs(R,ve,n,o);return o=="page"&&he==j.sel.primary()&&ao(R,kr(R,Re,"div").top-ve.top),Re},se),X.length)for(var ee=0;ee<j.sel.ranges.length;ee++)j.sel.ranges[ee].goalColumn=X[ee]}),findWordAt:function(n){var o=this.doc,R=Ve(o,n.line).text,j=n.ch,X=n.ch;if(R){var J=this.getHelper(n,"wordChars");(n.sticky=="before"||X==R.length)&&j?--j:++X;for(var ee=R.charAt(j),he=Fe(ee,J)?function(ve){return Fe(ve,J)}:/\s/.test(ee)?function(ve){return/\s/.test(ve)}:function(ve){return!/\s/.test(ve)&&!Fe(ve)};j>0&&he(R.charAt(j-1));)--j;for(;X<R.length&&he(R.charAt(X));)++X}return new Pn(Ge(n.line,j),Ge(n.line,X))},toggleOverwrite:function(n){if(n!=null&&n==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?H(this.display.cursorDiv,"CodeMirror-overwrite"):d(this.display.cursorDiv,"CodeMirror-overwrite"),Ue(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==k()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Nr(function(n,o){oa(this,n,o)}),getScrollInfo:function(){var n=this.display.scroller;return{left:n.scrollLeft,top:n.scrollTop,height:n.scrollHeight-Zr(this)-this.display.barHeight,width:n.scrollWidth-Zr(this)-this.display.barWidth,clientHeight:Pi(this),clientWidth:ii(this)}},scrollIntoView:Nr(function(n,o){n==null?(n={from:this.doc.sel.primary().head,to:null},o==null&&(o=this.options.cursorScrollMargin)):typeof n=="number"?n={from:Ge(n,0),to:null}:n.from==null&&(n={from:n,to:null}),n.to||(n.to=n.from),n.margin=o||0,n.from.line!=null?Qs(this,n):No(this,n.from,n.to,n.margin)}),setSize:Nr(function(n,o){var R=this,j=function(J){return typeof J=="number"||/^\d+$/.test(String(J))?J+"px":J};n!=null&&(this.display.wrapper.style.width=j(n)),o!=null&&(this.display.wrapper.style.height=j(o)),this.options.lineWrapping&&nr(this);var X=this.display.viewFrom;this.doc.iter(X,this.display.viewTo,function(J){if(J.widgets){for(var ee=0;ee<J.widgets.length;ee++)if(J.widgets[ee].noHScroll){vi(R,X,"widget");break}}++X}),this.curOp.forceUpdate=!0,Ue(this,"refresh",this)}),operation:function(n){return zr(this,n)},startOperation:function(){return Ii(this)},endOperation:function(){return Ni(this)},refresh:Nr(function(){var n=this.display.cachedTextHeight;Fr(this),this.curOp.forceUpdate=!0,Gn(this),oa(this,this.doc.scrollLeft,this.doc.scrollTop),lo(this.display),(n==null||Math.abs(n-_r(this.display))>.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||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){e.removeAllRanges();return}var R=$a(t,e.anchorNode,e.anchorOffset),j=$a(t,e.focusNode,e.focusOffset);if(R&&!R.bad&&j&&!j.bad&&wt(Fn(R,j),n)==0&&wt(Ar(R,j),o)==0)return;var X=t.display.view,J=n.line>=t.display.viewFrom&&zs(t,n)||{node:X[0].measure.map[2],offset:0},ee=o.line<t.display.viewTo&&zs(t,o);if(!ee){var he=X[X.length-1].measure,ve=he.maps?he.maps[he.maps.length-1]:he.map;ee={node:ve[ve.length-1],offset:ve[ve.length-2]-ve[ve.length-3]}}if(!J||!ee){e.removeAllRanges();return}var Re=e.rangeCount&&e.getRangeAt(0),Se;try{Se=g(J.node,J.offset,ee.offset,ee.node)}catch(Ke){}Se&&(!D&&t.state.focused?(e.collapse(J.node,J.offset),Se.collapsed||(e.removeAllRanges(),e.addRange(Se))):(e.removeAllRanges(),e.addRange(Se)),Re&&e.anchorNode==null?e.addRange(Re):D&&this.startGracePeriod()),this.rememberSelection()},Nn.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},Nn.prototype.showMultipleSelections=function(e){s(this.cm.display.cursorDiv,e.cursors),s(this.cm.display.selectionDiv,e.selection)},Nn.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Nn.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return _(this.div,t)},Nn.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Nn.prototype.blur=function(){this.div.blur()},Nn.prototype.getField=function(){return this.div},Nn.prototype.supportsTouch=function(){return!0},Nn.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():zr(this.cm,function(){return e.cm.curOp.selectionChanged=!0});function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}this.polling.set(this.cm.options.pollInterval,t)},Nn.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Nn.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(h&&x&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var r=$a(t,e.anchorNode,e.anchorOffset),n=$a(t,e.focusNode,e.focusOffset);r&&n&&zr(t,function(){Dr(t.doc,bi(r,n),_e),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)})},Nn.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,r=e.doc.sel.primary(),n=r.from(),o=r.to();if(n.ch==0&&n.line>e.firstLine()&&(n=Ge(n.line-1,Ve(e.doc,n.line-1).length)),o.ch==Ve(e.doc,o.line).text.length&&o.line<e.lastLine()&&(o=Ge(o.line+1,0)),n.line<t.viewFrom||o.line>t.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);Se<At&&et.charCodeAt(Se)==gt.charCodeAt(Se);)++Se;for(var Ut=Ee(ve),Rt=Ee(Re),Wt=Math.min(Ut.length-(ve.length==1?Se:0),Rt.length-(Re.length==1?Se:0));Ke<Wt&&Ut.charCodeAt(Ut.length-Ke-1)==Rt.charCodeAt(Rt.length-Ke-1);)++Ke;if(ve.length==1&&Re.length==1&&j==n.line)for(;Se&&Se>n.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<Se.childNodes.length;Rt++)Re(Se.childNodes[Rt]);/^(pre|p)$/i.test(Se.nodeName)&&(J=!0),Ut&&(j=!0)}else Se.nodeType==3&&ve(Se.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Re(t),t==r);)t=t.nextSibling,J=!1;return R}function $a(e,t,r){var n;if(t==e.display.lineDiv){if(n=e.display.lineDiv.childNodes[r],!n)return Zi(e.clipPos(Ge(e.display.viewTo-1)),!0);t=null,r=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var o=0;o<e.display.view.length;o++){var R=e.display.view[o];if(R.node==n)return nu(R,t,r)}}function nu(e,t,r){var n=e.text.firstChild,o=!1;if(!t||!_(n,t))return Zi(Ge(qt(e.line),0),!0);if(t==n&&(o=!0,t=n.childNodes[r],r=0,!t)){var R=e.rest?Ee(e.rest):e.line;return Zi(Ge(qt(R),R.text.length),o)}var j=t.nodeType==3?t:null,X=t;for(!j&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(j=t.firstChild,r&&(r=j.nodeValue.length));X.parentNode!=n;)X=X.parentNode;var J=e.measure,ee=J.maps;function he(gt,At,Ut){for(var Rt=-1;Rt<(ee?ee.length:0);Rt++)for(var Wt=Rt<0?J.map:ee[Rt],tn=0;tn<Wt.length;tn+=3){var Yt=Wt[tn+2];if(Yt==gt||Yt==At){var pn=qt(Rt<0?e.line:e.rest[Rt]),Wn=Wt[tn]+Ut;return(Ut<0||Yt!=gt)&&(Wn=Wt[tn+(Ut?1:0)]),Ge(pn,Wn)}}}var ve=he(j,X,r);if(ve)return Zi(ve,o);for(var Re=X.nextSibling,Se=j?j.nodeValue.length-r:0;Re;Re=Re.nextSibling){if(ve=he(Re,Re.firstChild,0),ve)return Zi(Ge(ve.line,ve.ch-Se),o);Se+=Re.textContent.length}for(var Ke=X.previousSibling,et=r;Ke;Ke=Ke.previousSibling){if(ve=he(Ke,Ke.firstChild,-1),ve)return Zi(Ge(ve.line,ve.ch+et),o);et+=Ke.textContent.length}}var rr=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ce,this.hasSelection=!1,this.composing=null};rr.prototype.init=function(e){var t=this,r=this,n=this.cm;this.createField(e);var o=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),T&&(o.style.width="0px"),ke(o,"input",function(){K&&N>=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);j<X&&n.charCodeAt(j)==o.charCodeAt(j);)++j;return zr(t,function(){To(t,o.slice(j),n.length-j,null,e.composing?"*compose":null),o.length>1e3||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;g<d;g+=1){var _;b.push(O.createElement("span",{key:g,className:x()(a,(_={},Object(oe.a)(_,"".concat(a,"-start"),f[g+1]),Object(oe.a)(_,"".concat(a,"-end"),s[g+1]),Object(oe.a)(_,"".concat(a,"-end-first-level"),!g&&s[0]),_))}))}return O.createElement("span",{"aria-hidden":"true",className:"".concat(E,"-indent")},b)},S=w,T=V("815F"),h="open",l="close",i="---",c=function(m){Object(K.a)(E,m);var u=Object(N.a)(E);function E(){var d;return Object($.a)(this,E),d=u.apply(this,arguments),d.state={dragNodeHighlight:!1},d.onSelectorClick=function(f){var s=d.props.context.onNodeClick;s(f,Object(T.b)(d.props)),d.isSelectable()?d.onSelect(f):d.onCheck(f)},d.onSelectorDoubleClick=function(f){var s=d.props.context.onNodeDoubleClick;s(f,Object(T.b)(d.props))},d.onSelect=function(f){if(d.isDisabled())return;var s=d.props.context.onNodeSelect;f.preventDefault(),s(f,Object(T.b)(d.props))},d.onCheck=function(f){if(d.isDisabled())return;var s=d.props,a=s.disableCheckbox,b=s.checked,g=d.props.context.onNodeCheck;if(!d.isCheckable()||a)return;f.preventDefault();var _=!b;g(f,Object(T.b)(d.props),_)},d.onMouseEnter=function(f){var s=d.props.context.onNodeMouseEnter;s(f,Object(T.b)(d.props))},d.onMouseLeave=function(f){var s=d.props.context.onNodeMouseLeave;s(f,Object(T.b)(d.props))},d.onContextMenu=function(f){var s=d.props.context.onNodeContextMenu;s(f,Object(T.b)(d.props))},d.onDragStart=function(f){var s=d.props.context.onNodeDragStart;f.stopPropagation(),d.setState({dragNodeHighlight:!0}),s(f,Object(I.a)(d));try{f.dataTransfer.setData("text/plain","")}catch(a){}},d.onDragEnter=function(f){var s=d.props.context.onNodeDragEnter;f.preventDefault(),f.stopPropagation(),s(f,Object(I.a)(d))},d.onDragOver=function(f){var s=d.props.context.onNodeDragOver;f.preventDefault(),f.stopPropagation(),s(f,Object(I.a)(d))},d.onDragLeave=function(f){var s=d.props.context.onNodeDragLeave;f.stopPropagation(),s(f,Object(I.a)(d))},d.onDragEnd=function(f){var s=d.props.context.onNodeDragEnd;f.stopPropagation(),d.setState({dragNodeHighlight:!1}),s(f,Object(I.a)(d))},d.onDrop=function(f){var s=d.props.context.onNodeDrop;f.preventDefault(),f.stopPropagation(),d.setState({dragNodeHighlight:!1}),s(f,Object(I.a)(d))},d.onExpand=function(f){var s=d.props.context.onNodeExpand;s(f,Object(T.b)(d.props))},d.setSelectHandle=function(f){d.selectHandle=f},d.getNodeState=function(){var f=d.props.expanded;return d.isLeaf()?null:f?h:l},d.hasChildren=function(){var f=d.props.eventKey,s=d.props.context.keyEntities,a=s[f]||{},b=a.children;return!!(b||[]).length},d.isLeaf=function(){var f=d.props,s=f.isLeaf,a=f.loaded,b=d.props.context.loadData,g=d.hasChildren();return s===!1?!1:s||!b&&!g||b&&a&&!g},d.isDisabled=function(){var f=d.props.disabled,s=d.props.context.disabled;return!!(s||f)},d.isCheckable=function(){var f=d.props.checkable,s=d.props.context.checkable;return!s||f===!1?!1:s},d.syncLoadData=function(f){var s=f.expanded,a=f.loading,b=f.loaded,g=d.props.context,_=g.loadData,k=g.onNodeLoad;if(a)return;_&&s&&!d.isLeaf()&&(!d.hasChildren()&&!b&&k(Object(T.b)(d.props)))},d.renderSwitcher=function(){var f=d.props,s=f.expanded,a=f.switcherIcon,b=d.props.context,g=b.prefixCls,_=b.switcherIcon,k=a||_;if(d.isLeaf())return O.createElement("span",{className:x()("".concat(g,"-switcher"),"".concat(g,"-switcher-noop"))},typeof k=="function"?k(Object(D.a)(Object(D.a)({},d.props),{},{isLeaf:!0})):k);var H=x()("".concat(g,"-switcher"),"".concat(g,"-switcher_").concat(s?h:l));return O.createElement("span",{onClick:d.onExpand,className:H},typeof k=="function"?k(Object(D.a)(Object(D.a)({},d.props),{},{isLeaf:!1})):k)},d.renderCheckbox=function(){var f=d.props,s=f.checked,a=f.halfChecked,b=f.disableCheckbox,g=d.props.context.prefixCls,_=d.isDisabled(),k=d.isCheckable();if(!k)return null;var H=typeof k!="boolean"?k:null;return O.createElement("span",{className:x()("".concat(g,"-checkbox"),s&&"".concat(g,"-checkbox-checked"),!s&&a&&"".concat(g,"-checkbox-indeterminate"),(_||b)&&"".concat(g,"-checkbox-disabled")),onClick:d.onCheck},H)},d.renderIcon=function(){var f=d.props.loading,s=d.props.context.prefixCls;return O.createElement("span",{className:x()("".concat(s,"-iconEle"),"".concat(s,"-icon__").concat(d.getNodeState()||"docu"),f&&"".concat(s,"-icon_loading"))})},d.renderSelector=function(){var f=d.state.dragNodeHighlight,s=d.props,a=s.title,b=s.selected,g=s.icon,_=s.loading,k=s.data,H=d.props.context,z=H.prefixCls,Z=H.showIcon,G=H.icon,B=H.draggable,te=H.loadData,ce=H.titleRender,pe=d.isDisabled(),ye="".concat(z,"-node-content-wrapper"),Ce;if(Z){var _e=g||G;Ce=_e?O.createElement("span",{className:x()("".concat(z,"-iconEle"),"".concat(z,"-icon__customize"))},typeof _e=="function"?_e(d.props):_e):d.renderIcon()}else te&&_&&(Ce=d.renderIcon());var le;typeof a=="function"?le=a(k):ce?le=ce(k):le=a;var se=O.createElement("span",{className:"".concat(z,"-title")},le);return O.createElement("span",{ref:d.setSelectHandle,title:typeof a=="string"?a:"",className:x()("".concat(ye),"".concat(ye,"-").concat(d.getNodeState()||"normal"),!pe&&(b||f)&&"".concat(z,"-node-selected"),!pe&&B&&"draggable"),draggable:!pe&&B||void 0,"aria-grabbed":!pe&&B||void 0,onMouseEnter:d.onMouseEnter,onMouseLeave:d.onMouseLeave,onContextMenu:d.onContextMenu,onClick:d.onSelectorClick,onDoubleClick:d.onSelectorDoubleClick,onDragStart:B?d.onDragStart:void 0},Ce,se)},d}return Object(U.a)(E,[{key:"componentDidMount",value:function(){this.syncLoadData(this.props)}},{key:"componentDidUpdate",value:function(){this.syncLoadData(this.props)}},{key:"isSelectable",value:function(){var f=this.props.selectable,s=this.props.context.selectable;return typeof f=="boolean"?f:s}},{key:"render",value:function(){var f,s=this.props,a=s.eventKey,b=s.className,g=s.style,_=s.dragOver,k=s.dragOverGapTop,H=s.dragOverGapBottom,z=s.isLeaf,Z=s.isStart,G=s.isEnd,B=s.expanded,te=s.selected,ce=s.checked,pe=s.halfChecked,ye=s.loading,Ce=s.domRef,_e=s.active,le=s.onMouseMove,se=Object(Y.a)(s,["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","onMouseMove"]),ge=this.props.context,ie=ge.prefixCls,q=ge.filterTreeNode,Ee=ge.draggable,Me=ge.keyEntities,Ne=this.isDisabled(),De=Object(P.f)(se),Be=Me[a]||{},Ae=Be.level,Pe=G[G.length-1];return O.createElement("div",Object.assign({ref:Ce,className:x()(b,"".concat(ie,"-treenode"),(f={},Object(oe.a)(f,"".concat(ie,"-treenode-disabled"),Ne),Object(oe.a)(f,"".concat(ie,"-treenode-switcher-").concat(B?"open":"close"),!z),Object(oe.a)(f,"".concat(ie,"-treenode-checkbox-checked"),ce),Object(oe.a)(f,"".concat(ie,"-treenode-checkbox-indeterminate"),pe),Object(oe.a)(f,"".concat(ie,"-treenode-selected"),te),Object(oe.a)(f,"".concat(ie,"-treenode-loading"),ye),Object(oe.a)(f,"".concat(ie,"-treenode-active"),_e),Object(oe.a)(f,"".concat(ie,"-treenode-leaf-last"),Pe),Object(oe.a)(f,"drag-over",!Ne&&_),Object(oe.a)(f,"drag-over-gap-top",!Ne&&k),Object(oe.a)(f,"drag-over-gap-bottom",!Ne&&H),Object(oe.a)(f,"filter-node",q&&q(Object(T.b)(this.props))),f)),style:g,onDragEnter:Ee?this.onDragEnter:void 0,onDragOver:Ee?this.onDragOver:void 0,onDragLeave:Ee?this.onDragLeave:void 0,onDrop:Ee?this.onDrop:void 0,onDragEnd:Ee?this.onDragEnd:void 0,onMouseMove:le},De),O.createElement(S,{prefixCls:ie,level:Ae,isStart:Z,isEnd:G}),this.renderSwitcher(),this.renderCheckbox(),this.renderSelector())}}]),E}(O.Component),C=function(u){return O.createElement(A.a.Consumer,null,function(E){return O.createElement(c,Object.assign({},u,{context:E}))})};C.displayName="TreeNode",C.defaultProps={title:i},C.isTreeNode=1;var v=Xe.a=C},Y1PL:function(at,Xe,V){"use strict";V.r(Xe),V.d(Xe,"ResizableTextArea",function(){return pe});var oe=V("wx14"),Y=V("1OyB"),D=V("vuIU"),$=V("Ji7U"),U=V("LK+K"),I=V("q1tI"),K=V("VTBJ"),N=V("rePB"),O=V("Zm9Q"),L=V("Kwbf"),x=V("c+Xe"),A=V("m+aA"),P=V("bdgK"),w=new Map;function S(_e){_e.forEach(function(le){var se,ge=le.target;(se=w.get(ge))===null||se===void 0||se.forEach(function(ie){return ie(ge)})})}var T=new P.default(S),h=null,l=null;function i(_e,le){w.has(_e)||(w.set(_e,new Set),T.observe(_e)),w.get(_e).add(le)}function c(_e,le){w.has(_e)&&(w.get(_e).delete(le),w.get(_e).size||(T.unobserve(_e),w.delete(_e)))}var C=function(_e){Object($.a)(se,_e);var le=Object(U.a)(se);function se(){return Object(Y.a)(this,se),le.apply(this,arguments)}return Object(D.a)(se,[{key:"render",value:function(){return this.props.children}}]),se}(I.Component),v=I.createContext(null);function m(_e){var le=_e.children,se=_e.onBatchResize,ge=I.useRef(0),ie=I.useRef([]),q=I.useContext(v),Ee=I.useCallback(function(Me,Ne,De){ge.current+=1;var Be=ge.current;ie.current.push({size:Me,element:Ne,data:De}),Promise.resolve().then(function(){Be===ge.current&&(se==null||se(ie.current),ie.current=[])}),q==null||q(Me,Ne,De)},[se,q]);return I.createElement(v.Provider,{value:Ee},le)}function u(_e){var le=_e.children,se=_e.disabled,ge=I.useRef(null),ie=I.useRef(null),q=I.useContext(v),Ee=I.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Me=I.isValidElement(le)&&Object(x.c)(le),Ne=Me?le.ref:null,De=I.useMemo(function(){return Object(x.a)(Ne,ge)},[Ne,ge]),Be=I.useRef(_e);Be.current=_e;var Ae=I.useCallback(function(Pe){var Fe=Be.current,ze=Fe.onResize,qe=Fe.data,He=Pe.getBoundingClientRect(),Oe=He.width,lt=He.height,tt=Pe.offsetWidth,ft=Pe.offsetHeight,nt=Math.floor(Oe),St=Math.floor(lt);if(Ee.current.width!==nt||Ee.current.height!==St||Ee.current.offsetWidth!==tt||Ee.current.offsetHeight!==ft){var ht={width:nt,height:St,offsetWidth:tt,offsetHeight:ft};Ee.current=ht;var yt=tt===Math.round(Oe)?Oe:tt,ke=ft===Math.round(lt)?lt:ft,Pt=Object(K.a)(Object(K.a)({},ht),{},{offsetWidth:yt,offsetHeight:ke});q==null||q(Pt,Pe,qe),ze&&Promise.resolve().then(function(){ze(Pt,Pe)})}},[]);return I.useEffect(function(){var Pe=Object(A.a)(ge.current)||Object(A.a)(ie.current);return Pe&&!se&&i(Pe,Ae),function(){return c(Pe,Ae)}},[ge.current,se]),I.createElement(C,{ref:ie},Me?I.cloneElement(le,{ref:De}):le)}var E="rc-observer-key";function d(_e){var le=_e.children,se=Object(O.a)(le);return se.map(function(ge,ie){var q=(ge==null?void 0:ge.key)||"".concat(E,"-").concat(ie);return I.createElement(u,Object(oe.a)({},_e,{key:q}),ge)})}d.Collection=m;var f=d,s=V("bT9E"),a=V("TSYQ"),b=V.n(a),g=`
min-height:0 !important;
max-height:none !important;
height:0 !important;
visibility:hidden !important;
overflow:hidden !important;
position:absolute !important;
z-index:-1000 !important;
top:0 !important;
right:0 !important
`,_=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],k={},H;function z(_e){var le=arguments.length>1&&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.clientHeight<x.scrollHeight||x.clientWidth<x.scrollWidth){var P=getComputedStyle(x,null);return Y(P.overflowY,A)||Y(P.overflowX,A)||function(w){var S=function(T){if(!T.ownerDocument||!T.ownerDocument.defaultView)return null;try{return T.ownerDocument.defaultView.frameElement}catch(h){return null}}(w);return!!S&&(S.clientHeight<w.scrollHeight||S.clientWidth<w.scrollWidth)}(x)}return!1}function $(x,A,P,w,S,T,h,l){return T<x&&h>A||T>x&&h<A?0:T<=x&&l<=P||h>=A&&l>=P?T-x-w:h>A&&l<P||T<x&&l>P?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<C.length;G++){var B=C[G],te=B.getBoundingClientRect(),ce=te.height,pe=te.width,ye=te.top,Ce=te.right,_e=te.bottom,le=te.left;if(w==="if-needed"&&b>=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;a<arguments.length;a++){var b=arguments[a]!=null?arguments[a]:{};a%2?P(Object(b),!0).forEach(function(g){Object(Y.a)(s,g,b[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(b)):P(Object(b)).forEach(function(g){Object.defineProperty(s,g,Object.getOwnPropertyDescriptor(b,g))})}return s}function S(s){var a=T();return function(){var g=Object(K.a)(s),_;if(a){var k=Object(K.a)(this).constructor;_=Reflect.construct(g,arguments,k)}else _=g.apply(this,arguments);return Object(I.a)(this,_)}}function T(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(s){return!1}}function h(){}function l(s){s.preventDefault()}var i=function(a){return a.replace(/[^\w.-]+/g,"")},c=200,C=600,v=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,m=function(a){return a!=null},u=function(a,b){return b===a||typeof b=="number"&&typeof a=="number"&&isNaN(b)&&isNaN(a)},E=function(s){Object(U.a)(b,s);var a=S(b);function b(g){var _;Object(D.a)(this,b),_=a.call(this,g),_.onKeyDown=function(z){var Z=_.props,G=Z.onKeyDown,B=Z.onPressEnter;if(z.keyCode===A.a.UP){var te=_.getRatio(z);_.up(z,te,null),_.stop()}else if(z.keyCode===A.a.DOWN){var ce=_.getRatio(z);_.down(z,ce,null),_.stop()}else z.keyCode===A.a.ENTER&&B&&B(z);if(_.recordCursorPosition(),_.lastKeyCode=z.keyCode,G){for(var pe=arguments.length,ye=new Array(pe>1?pe-1:0),Ce=1;Ce<pe;Ce++)ye[Ce-1]=arguments[Ce];G.apply(void 0,[z].concat(ye))}},_.onKeyUp=function(z){var Z=_.props.onKeyUp;if(_.stop(),_.recordCursorPosition(),Z){for(var G=arguments.length,B=new Array(G>1?G-1:0),te=1;te<G;te++)B[te-1]=arguments[te];Z.apply(void 0,[z].concat(B))}},_.onChange=function(z){var Z=_.props.onChange;_.state.focused&&(_.inputting=!0),_.rawInput=_.props.parser(_.getValueFromEvent(z)),_.setState({inputValue:_.rawInput}),Z(_.toNumber(_.rawInput))},_.onMouseUp=function(){var z=_.props.onMouseUp;_.recordCursorPosition(),z&&z.apply(void 0,arguments)},_.onFocus=function(){var z;_.setState({focused:!0}),(z=_.props).onFocus.apply(z,arguments)},_.onBlur=function(){var z=_.props.onBlur;_.inputting=!1,_.setState({focused:!1});var Z=_.getCurrentValidValue(_.state.inputValue),G=_.setValue(Z,h);if(z){var B=_.input.value,te=_.getInputDisplayValue({focus:!1,value:G});_.input.value=te&&Number(te),z.apply(void 0,arguments),_.input.value=B}},_.getRatio=function(z){var Z=1;return z.metaKey||z.ctrlKey?Z=.1:z.shiftKey&&(Z=10),Z},_.getFullNum=function(z){return isNaN(z)?z:/e/i.test(String(z))?Number(z).toFixed(18).replace(/\.?0+$/,""):z},_.getPrecision=function(z){if(m(_.props.precision))return _.props.precision;var Z=String(z);if(Z.indexOf("e-")>=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"&&pe<G&&z&&z(G)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var ye=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===A.a.BACKSPACE?ye=this.cursorStart-1:this.lastKeyCode===A.a.DELETE&&(ye=this.cursorStart):ye=this.input.value.length,this.fixCaret(ye,ye)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case A.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case A.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Ce){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(_){var k=_;return k===""?k="":this.isNotCompleteNumber(parseFloat(k))?k=this.state.value:k=this.getValidValue(k),this.toNumber(k)}},{key:"getValueFromEvent",value:function(_){var k=_.target.value.trim().replace(/。/g,".");return m(this.props.decimalSeparator)&&(k=k.replace(this.props.decimalSeparator,".")),k}},{key:"getValidValue",value:function(_){var k=arguments.length>1&&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)?_:(z<k&&(z=k),z>H&&(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||te<G.min;if(te>G.max?te=G.max:te<G.min&&(te=G.min),this.setValue(te,null),this.setState({focused:!0},function(){H.pressingUpOrDown=!1}),ce)return;this.autoStepTimer=setTimeout(function(){H[_](k,z,!0)},Z?c:C)}},{key:"fixCaret",value:function(_,k){if(_===void 0||k===void 0||!this.input||!this.input.value)return;try{var H=this.input.selectionStart,z=this.input.selectionEnd;(_!==H||k!==z)&&this.input.setSelectionRange(_,k)}catch(Z){}}},{key:"render",value:function(){var _,k=this.props,H=k.prefixCls,z=k.disabled,Z=k.readOnly,G=k.useTouch,B=k.autoComplete,te=k.upHandler,ce=k.downHandler,pe=k.className,ye=k.max,Ce=k.min,_e=k.style,le=k.title,se=k.onMouseEnter,ge=k.onMouseLeave,ie=k.onMouseOver,q=k.onMouseOut,Ee=k.required,Me=k.onClick,Ne=k.tabIndex,De=k.type,Be=k.placeholder,Ae=k.id,Pe=k.inputMode,Fe=k.pattern,ze=k.step,qe=k.maxLength,He=k.autoFocus,Oe=k.name,lt=k.onPaste,tt=k.onInput,ft=Object(oe.a)(k,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),nt=this.state,St=nt.value,ht=nt.focused,yt=x()(H,(_={},Object(Y.a)(_,pe,!!pe),Object(Y.a)(_,"".concat(H,"-disabled"),z),Object(Y.a)(_,"".concat(H,"-focused"),ht),_)),ke={};Object.keys(ft).forEach(function(de){(de.substr(0,5)==="data-"||de.substr(0,5)==="aria-"||de==="role")&&(ke[de]=ft[de])});var Pt=!Z&&!z,Tt=this.getInputDisplayValue(null),Ue=(St||St===0)&&(isNaN(St)||Number(St)>=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&&lt()}},[]),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<le?{add:!0,key:se(ye,Ce)}:{add:!1,key:se(Ce,ye)}}function E(ye,Ce,_e){var le=ye.findIndex(function(q){var Ee=q.data;return Ee.key===_e}),se=ye[le+1],ge=Ce.findIndex(function(q){var Ee=q.data;return Ee.key===_e});if(se){var ie=Ce.findIndex(function(q){var Ee=q.data;return Ee.key===se.data.key});return Ce.slice(ge+1,ie)}return Ce.slice(ge+1)}var d={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},f=function(){},s="RC_TREE_MOTION_".concat(Math.random()),a={key:s},b={key:s,level:0,index:0,pos:"0",node:a},g={parent:null,children:[],pos:b.pos,data:a,isStart:[],isEnd:[]};function _(ye,Ce,_e,le){return Ce===!1||!_e?ye:ye.slice(0,Math.ceil(_e/le)+1)}function k(ye){var Ce=ye.data.key,_e=ye.pos;return Object(S.e)(Ce,_e)}function H(ye){for(var Ce=String(ye.data.key),_e=ye;_e.parent;)_e=_e.parent,Ce="".concat(_e.data.key," > ").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;h++)T[h]=arguments[h];return w=A.call.apply(A,[this].concat(T)),w.getChCountBeforeCursor=function(l,i){for(var c=i.line,C=0,v=0;v<c;v++)C+=l.getLine(v).split(O).length-1;var m=l.getLine(c).substring(0,i.ch);return C+=m.split(O).length-1,C},w.onCMBeforeChange=function(l,i){var c=l.getRange(i.from,i.to),C=0;if(i.text.forEach(function(E){C+=E.split(O).length-1}),c&&c.indexOf(O)!=-1){var v=c.split(O).length-1,m=w.getChCountBeforeCursor(l,i.from);console.log("\u5220\u9664".concat(v,"\u4E2A\uFF0C \u4E4B\u524D\u6709").concat(m,"\u4E2A\uFF0C\u65B0\u589E").concat(C,"\u4E2A")),w.props.deleteEmptyDisabled?i.cancel():w.props.onPlaceholderChange&&w.props.onPlaceholderChange(m,v,C)}else if(C){var u=w.getChCountBeforeCursor(l,i.from);console.log("\u65B0\u589E".concat(C,"\u4E2A\uFF0C\u4E4B\u524D\u6709").concat(u,"\u4E2A")),w.props.onPlaceholderChange&&w.props.onPlaceholderChange(u,0,C)}},w}return Object(D.a)(P,[{key:"render",value:function(){return K.a.createElement(N.a,Object(oe.a)({},this.props,{onCMBeforeChange:this.onCMBeforeChange}))}}]),P}(I.Component)},lZu9:function(at,Xe,V){(function(oe){oe(V("VrN/"),V("1eCo"),V("8EBN"))})(function(oe){"use strict";oe.defineMode("markdown",function(Y,D){var $=oe.getMode(Y,"text/html"),U=$.name=="null";function I(G){if(oe.findModeByName){var B=oe.findModeByName(G);B&&(G=B.mime||B.mimes[0])}var te=oe.getMode(Y,G);return te.name=="null"?null:te}D.highlightFormatting===void 0&&(D.highlightFormatting=!1),D.maxBlockquoteDepth===void 0&&(D.maxBlockquoteDepth=0),D.taskLists===void 0&&(D.taskLists=!1),D.strikethrough===void 0&&(D.strikethrough=!1),D.emoji===void 0&&(D.emoji=!1),D.fencedCodeBlockHighlighting===void 0&&(D.fencedCodeBlockHighlighting=!0),D.fencedCodeBlockDefaultMode===void 0&&(D.fencedCodeBlockDefaultMode="text/plain"),D.xml===void 0&&(D.xml=!0),D.tokenTypeOverrides===void 0&&(D.tokenTypeOverrides={});var K={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var N in K)K.hasOwnProperty(N)&&D.tokenTypeOverrides[N]&&(K[N]=D.tokenTypeOverrides[N]);var O=/^([*\-_])(?:\s*\1){2,}\s*$/,L=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,x=/^\[(x| )\](?=\s)/i,A=D.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,P=/^ {0,3}(?:\={1,}|-{2,})\s*$/,w=/^[^#!\[\]*_\\<>` "'(~:]+/,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<B.listStack[B.listStack.length-1];)B.listStack.pop(),B.listStack.length?B.indentation=B.listStack[B.listStack.length-1]:B.list=!1;B.list!==!1&&(B.indentationDiff=le-B.listStack[B.listStack.length-1])}var se=!ce&&!ye&&!B.prevLine.header&&(!Ce||!pe)&&!B.prevLine.fencedCodeEnd,ge=(B.list===!1||ye||ce)&&B.indentation<=_e&&G.match(O),ie=null;if(B.indentationDiff>=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<te,pe=te+3;if(B.fencedEndRE&&B.indentation<=pe&&(ce||G.match(B.fencedEndRE))){D.highlightFormatting&&(B.formatting="code-block");var ye;return ce||(ye=d(B)),B.localMode=B.localState=null,B.block=m,B.f=s,B.fencedEndRE=null,B.code=0,B.thisLine.fencedCodeEnd=!0,ce?c(G,B,B.block):ye}else return B.localMode?B.localMode.token(G,B.localState):(G.skipToEnd(),K.code)}function d(G){var B=[];if(G.formatting){B.push(K.formatting),typeof G.formatting=="string"&&(G.formatting=[G.formatting]);for(var te=0;te<G.formatting.length;te++)B.push(K.formatting+"-"+G.formatting[te]),G.formatting[te]==="header"&&B.push(K.formatting+"-"+G.formatting[te]+"-"+G.header),G.formatting[te]==="quote"&&(!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=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:"<!--",blockCommentEnd:"-->",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.V)({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,$={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},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<arguments.length;d++){f=arguments[d];for(s in f)Object.prototype.hasOwnProperty.call(f,s)&&(E[s]=f[s])}return E}function C(E,d){const f=E.replace(/\|/g,(b,g,_)=>{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.length<d;)s.push("");for(;a<s.length;a++)s[a]=s[a].trim().replace(/\\\|/g,"|");return s}function v(E,d,f){const s=E.length;if(s===0)return"";let a=0;for(;a<s;){const b=E.charAt(s-a-1);if(b===d&&!f)a++;else if(b!==d&&f)a++;else break}return E.substr(0,s-a)}function m(E,d){if(E.indexOf(d[1])===-1)return-1;const f=E.length;let s=0,a=0;for(;a<f;a++)if(E[a]==="\\")a++;else if(E[a]===d[0])s++;else if(E[a]===d[1]&&(s--,s<0))return a;return-1}function u(E){E&&E.sanitize&&!E.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}at.exports={escape:I,unescape:N,edit:L,cleanUrl:P,resolveUrl:l,noopTest:i,merge:c,splitCells:C,rtrim:v,findClosingBracket:m,checkSanitizeDeprecation:u}},sbIO:function(at,Xe,V){"use strict";var oe=V("DjyN"),Y=V("NUBc"),D=V("5Dmo"),$=V("3S7+"),U=V("/zsF"),I=V("PArb"),K=V("Q9mQ"),N=V("diRs"),O=V("+L6B"),L=V("2/Rp"),x=V("5NDa"),A=V("5rEg"),P=V("miYZ"),w=V("tsqr"),S=V("9og8"),T=V("giR+"),h=V("fyUT"),l=V("2qtc"),i=V("kLXV"),c=V("tJVT"),C=V("WmNS"),v=V.n(C),m=V("q1tI"),u=V.n(m),E=V("PsQE"),d=V.n(E),f=V("0eGx"),s=V.n(f),a=V("9Bee"),b=V("Ty5D"),g=V("9kvl"),_=V("ErOA"),k=V("+yhJ"),H=V.n(k),z=V("RZ/O"),Z=V.n(z),G=V("LvDl"),B=V("6K3P"),te=V.n(B),ce=V("sRBo"),pe=V("kaz8"),ye=V("oBTY"),Ce=V("PpiC"),_e=V("Ot1p"),le=V("kqOp"),se=V("7qnI"),ge=V("1vsH"),ie=V("PGNT"),q=V.n(ie),Ee=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Me=function(ae,de){var ue=ae.globalSetting,we=ae.loading,Le=ae.dispatch,rt=ae.isEdit,je=ae.editData,Ye=Object(Ce.a)(ae,["globalSetting","loading","dispatch","isEdit","editData"]),Dt=Object(m.useState)(""),ut=Object(c.a)(Dt,2),mt=ut[0],zt=ut[1],Je=Object(m.useState)(""),Kt=Object(c.a)(Je,2),sn=Kt[0],Bt=Kt[1],an=Object(m.useState)([]),Qt=Object(c.a)(an,2),ot=Qt[0],Ft=Qt[1],xt=Object(m.useState)(""),kt=Object(c.a)(xt,2),Mt=kt[0],It=kt[1],Lt=Object(m.useState)(),st=Object(c.a)(Lt,2),Ve=st[0],ln=st[1],$t=Object(m.useState)(!1),cn=Object(c.a)($t,2),qt=cn[0],En=cn[1];Object(m.useEffect)(function(){if(!je||!rt)return;zt(je==null?void 0:je.name),Bt(je==null?void 0:je.analysis),ln(je==null?void 0:je.is_ordered),En(!0)},[je]),Object(m.useEffect)(function(){if(!qt)return;var Fn=je==null?void 0:je.standard_answer.map(function(F){return F.answer_text});Ft(Fn),En(!1)},[qt]),Object(m.useImperativeHandle)(de,function(){return{onSave:on,Clear:pt}});var on=function(){var F=[],p=!1;return mt?(ot.forEach(function(y,M){F.push({position:M+1,answer_text:[]}),y.forEach(function(Q,W){F[M].answer_text.push(Q),(!Q||!Object(ge.db)(Q,1e4))&&(It("".concat(M,"-").concat(W)),w.b.info(Q?"\u7B54\u6848\u4E0D\u80FD\u8D85\u8FC710000\u5B57\u7B26":"\u7B54\u6848\uFF1A\u4E0D\u80FD\u4E3A\u7A7A"),p=!0)})}),p?!1:(F==null?void 0:F.length)>20?(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;Q<y;Q++)M.splice(F+Q,0,[""]);Ft(M)},wt=function(F,p,y){It("");var M=ot.slice();M[F][p]=y,Ft(M)},Hn=function(F){var p=ot.slice();p[F]=[].concat(Object(ye.a)(p[F]),[""]),Ft(p)},fr=function(F,p){var y=ot.slice();if(!y[F][p]){y[F]=y[F].filter(function(M,Q){return Q!==p}),Ft(y);return}i.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u53C2\u8003\u7B54\u6848\u5417\uFF1F",className:q.a.modal,onOk:function(){y[F]=y[F].filter(function(Q,W){return W!==p}),Ft(y)}})},Ar=function(F){i.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u53C2\u8003\u7B54\u6848\u5417\uFF1F",className:q.a.modal,onOk:function(){var y=ot.slice();y=ot.filter(function(M,Q){return F!==Q}),Ft(y)}})};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("div",null,u.a.createElement(le.a,{id:"completion-question-tittle",placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE",height:155,defaultValue:mt,onChange:function(F){return zt(F)},showNullButton:!0,onPlaceholderChange:Ge})),u.a.createElement("div",{className:"mt20"},ot.map(function(Fn,F){return u.a.createElement(se.a,{key:F,answers:Fn,index:F,flex:1,is_md:!0,activeOptionErrorIndex:Mt,onAnswerChange:wt,addChildAnswer:Hn,deleteChildAnswer:fr,deleteChildAnswermain:Ar})})),u.a.createElement("div",{className:"mt20"},ot.length>1&&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<an.length;It++){var Lt,st=an[It];if(!(st!=null&&st.name))return w.b.info("\u8BF7\u60A8\u8F93\u5165\u7B2C".concat(It+1,"\u5C0F\u9898\u9898\u5E72")),!1;var Ve=st==null||((Lt=st.qusList)===null||Lt===void 0)?void 0:Lt.findIndex(function($t){return!$t});if(Ve>-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);S<T;S++)h[S]=w[S].fn;return h},L.prototype.listenerCount=function(A){var P=U?U+A:A,w=this._events[P];return w?w.fn?1:w.length:0},L.prototype.emit=function(A,P,w,S,T,h){var l=U?U+A:A;if(!this._events[l])return!1;var i=this._events[l],c=arguments.length,C,v;if(i.fn){i.once&&this.removeListener(A,i.fn,void 0,!0);switch(c){case 1:return i.fn.call(i.context),!0;case 2:return i.fn.call(i.context,P),!0;case 3:return i.fn.call(i.context,P,w),!0;case 4:return i.fn.call(i.context,P,w,S),!0;case 5:return i.fn.call(i.context,P,w,S,T),!0;case 6:return i.fn.call(i.context,P,w,S,T,h),!0}for(v=1,C=new Array(c-1);v<c;v++)C[v-1]=arguments[v];i.fn.apply(i.context,C)}else{var m=i.length,u;for(v=0;v<m;v++){i[v].once&&this.removeListener(A,i[v].fn,void 0,!0);switch(c){case 1:i[v].fn.call(i[v].context);break;case 2:i[v].fn.call(i[v].context,P);break;case 3:i[v].fn.call(i[v].context,P,w);break;case 4:i[v].fn.call(i[v].context,P,w,S);break;default:if(!C)for(u=1,C=new Array(c-1);u<c;u++)C[u-1]=arguments[u];i[v].fn.apply(i[v].context,C)}}}return!0},L.prototype.on=function(A,P,w){return N(this,A,P,w,!1)},L.prototype.once=function(A,P,w){return N(this,A,P,w,!0)},L.prototype.removeListener=function(A,P,w,S){var T=U?U+A:A;if(!this._events[T])return this;if(!P)return O(this,T),this;var h=this._events[T];if(h.fn)h.fn===P&&(!S||h.once)&&(!w||h.context===w)&&O(this,T);else{for(var l=0,i=[],c=h.length;l<c;l++)(h[l].fn!==P||S&&!h[l].once||w&&h[l].context!==w)&&i.push(h[l]);i.length?this._events[T]=i.length===1?i[0]:i:O(this,T)}return this},L.prototype.removeAllListeners=function(A){var P;return A?(P=U?U+A:A,this._events[P]&&O(this,P)):(this._events=new I,this._eventsCount=0),this},L.prototype.off=L.prototype.removeListener,L.prototype.addListener=L.prototype.on,L.prefixed=U,L.EventEmitter=L,oe.exports=L},"./node_modules/url-toolkit/src/url-toolkit.js":function(oe,Y,D){(function($){var U=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,I=/^([^\/?#]*)([^]*)$/,K=/(?:\/|^)\.(?=\/)/g,N=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,O={buildAbsoluteURL:function(L,x,A){if(A=A||{},L=L.trim(),x=x.trim(),!x){if(!A.alwaysNormalize)return L;var P=O.parseURL(L);if(!P)throw new Error("Error trying to parse base URL.");return P.path=O.normalizePath(P.path),O.buildURLFromParts(P)}var w=O.parseURL(x);if(!w)throw new Error("Error trying to parse relative URL.");if(w.scheme)return A.alwaysNormalize?(w.path=O.normalizePath(w.path),O.buildURLFromParts(w)):x;var S=O.parseURL(L);if(!S)throw new Error("Error trying to parse base URL.");if(!S.netLoc&&S.path&&S.path[0]!=="/"){var T=I.exec(S.path);S.netLoc=T[1],S.path=T[2]}S.netLoc&&!S.path&&(S.path="/");var h={scheme:S.scheme,netLoc:w.netLoc,path:null,params:w.params,query:w.query,fragment:w.fragment};if(!w.netLoc&&(h.netLoc=S.netLoc,w.path[0]!=="/"))if(!w.path)h.path=S.path,w.params||(h.params=S.params,w.query||(h.query=S.query));else{var l=S.path,i=l.substring(0,l.lastIndexOf("/")+1)+w.path;h.path=O.normalizePath(i)}return h.path===null&&(h.path=A.alwaysNormalize?O.normalizePath(w.path):w.path),O.buildURLFromParts(h)},parseURL:function(L){var x=U.exec(L);return x?{scheme:x[1]||"",netLoc:x[2]||"",path:x[3]||"",params:x[4]||"",query:x[5]||"",fragment:x[6]||""}:null},normalizePath:function(L){for(L=L.split("").reverse().join("").replace(K,"");L.length!==(L=L.replace(N,"")).length;);return L.split("").reverse().join("")},buildURLFromParts:function(L){return L.scheme+L.netLoc+L.path+L.params+L.query+L.fragment}};oe.exports=O})(this)},"./node_modules/webworkify-webpack/index.js":function(oe,Y,D){function $(A){var P={};function w(T){if(P[T])return P[T].exports;var h=P[T]={i:T,l:!1,exports:{}};return A[T].call(h.exports,h,h.exports,w),h.l=!0,h.exports}w.m=A,w.c=P,w.i=function(T){return T},w.d=function(T,h,l){w.o(T,h)||Object.defineProperty(T,h,{configurable:!1,enumerable:!0,get:l})},w.r=function(T){Object.defineProperty(T,"__esModule",{value:!0})},w.n=function(T){var h=T&&T.__esModule?function(){return T.default}:function(){return T};return w.d(h,"a",h),h},w.o=function(T,h){return Object.prototype.hasOwnProperty.call(T,h)},w.p="/",w.oe=function(T){throw console.error(T),T};var S=w(w.s=ENTRY_MODULE);return S.default||S}var U="[\\.|\\-|\\+|\\w|/|@]+",I="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+U+").*?\\)";function K(A){return(A+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function N(A){return!isNaN(1*A)}function O(A,P,w){var S={};S[w]=[];var T=P.toString(),h=T.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!h)return S;for(var l=h[1],i=new RegExp("(\\\\n|\\W)"+K(l)+I,"g"),c;c=i.exec(T);){if(c[3]==="dll-reference")continue;S[w].push(c[3])}for(i=new RegExp("\\("+K(l)+'\\("(dll-reference\\s('+U+'))"\\)\\)'+I,"g");c=i.exec(T);)A[c[2]]||(S[w].push(c[1]),A[c[2]]=D(c[1]).m),S[c[2]]=S[c[2]]||[],S[c[2]].push(c[4]);for(var C=Object.keys(S),v=0;v<C.length;v++)for(var m=0;m<S[C[v]].length;m++)N(S[C[v]][m])&&(S[C[v]][m]=1*S[C[v]][m]);return S}function L(A){var P=Object.keys(A);return P.reduce(function(w,S){return w||A[S].length>0},!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<h.length;l++){var i=h[l],c=w[i],C=c.pop();if(T[i]=T[i]||{},T[i][C]||!A[i][C])continue;T[i][C]=!0,S[i]=S[i]||[],S[i].push(C);for(var v=O(A,A[i][C],i),m=Object.keys(v),u=0;u<m.length;u++)w[m[u]]=w[m[u]]||[],w[m[u]]=w[m[u]].concat(v[m[u]])}return S}oe.exports=function(A,P){P=P||{};var w={main:D.m},S=P.all?{main:Object.keys(w.main)}:x(w,A),T="";Object.keys(S).filter(function(C){return C!=="main"}).forEach(function(C){for(var v=0;S[C][v];)v++;S[C].push(v),w[C][v]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",T=T+"var "+C+" = ("+$.toString().replace("ENTRY_MODULE",JSON.stringify(v))+")({"+S[C].map(function(m){return""+JSON.stringify(m)+": "+w[C][m].toString()}).join(",")+`});
`}),T=T+"new (("+$.toString().replace("ENTRY_MODULE",JSON.stringify(A))+")({"+S.main.map(function(C){return""+JSON.stringify(C)+": "+w.main[C].toString()}).join(",")+"}))(self);";var h=new window.Blob([T],{type:"text/javascript"});if(P.bare)return h;var l=window.URL||window.webkitURL||window.mozURL||window.msURL,i=l.createObjectURL(h),c=new window.Worker(i);return c.objectURL=i,c}},"./src/config.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"hlsDefaultConfig",function(){return u}),D.d(Y,"mergeConfig",function(){return d}),D.d(Y,"enableStreamingMode",function(){return f});var $=D("./src/controller/abr-controller.ts"),U=D("./src/controller/audio-stream-controller.ts"),I=D("./src/controller/audio-track-controller.ts"),K=D("./src/controller/subtitle-stream-controller.ts"),N=D("./src/controller/subtitle-track-controller.ts"),O=D("./src/controller/buffer-controller.ts"),L=D("./src/controller/timeline-controller.ts"),x=D("./src/controller/cap-level-controller.ts"),A=D("./src/controller/fps-controller.ts"),P=D("./src/controller/eme-controller.ts"),w=D("./src/controller/cmcd-controller.ts"),S=D("./src/utils/xhr-loader.ts"),T=D("./src/utils/fetch-loader.ts"),h=D("./src/utils/cues.ts"),l=D("./src/utils/mediakeys-helper.ts"),i=D("./src/utils/logger.ts");function c(){return c=Object.assign||function(s){for(var a=1;a<arguments.length;a++){var b=arguments[a];for(var g in b)Object.prototype.hasOwnProperty.call(b,g)&&(s[g]=b[g])}return s},c.apply(this,arguments)}function C(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 v(s){for(var a=1;a<arguments.length;a++){var b=arguments[a]!=null?arguments[a]:{};a%2?C(Object(b),!0).forEach(function(g){m(s,g,b[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(b)):C(Object(b)).forEach(function(g){Object.defineProperty(s,g,Object.getOwnPropertyDescriptor(b,g))})}return s}function m(s,a,b){return a in s?Object.defineProperty(s,a,{value:b,enumerable:!0,configurable:!0,writable:!0}):s[a]=b,s}var u=v(v({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:S.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:$.default,bufferController:O.default,capLevelController:x.default,fpsController:A.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:l.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},E()),{},{subtitleStreamController:K.SubtitleStreamController,subtitleTrackController:N.default,timelineController:L.TimelineController,audioStreamController:U.default,audioTrackController:I.default,emeController:P.default,cmcdController:w.default});function E(){return{cueHandler:h.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function d(s,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return c({},s,a)}function f(s){var a=s.loader;if(a!==T.default&&a!==S.default)i.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),s.progressive=!1;else{var b=Object(T.fetchSupported)();b&&(s.loader=T.default,s.progressive=!0,s.enableSoftwareAES=!0,i.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(oe,Y,D){"use strict";D.r(Y);var $=D("./src/polyfills/number.ts"),U=D("./src/utils/ewma-bandwidth-estimator.ts"),I=D("./src/events.ts"),K=D("./src/utils/buffer-helper.ts"),N=D("./src/errors.ts"),O=D("./src/types/loader.ts"),L=D("./src/utils/logger.ts");function x(w,S){for(var T=0;T<S.length;T++){var h=S[T];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(w,h.key,h)}}function A(w,S,T){return S&&x(w.prototype,S),T&&x(w,T),w}var P=function(){function w(T){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=T;var h=T.config;this.bwEstimator=new U.default(h.abrEwmaSlowVoD,h.abrEwmaFastVoD,h.abrEwmaDefaultEstimate),this.registerListeners()}var S=w.prototype;return S.registerListeners=function(){var h=this.hls;h.on(I.Events.FRAG_LOADING,this.onFragLoading,this),h.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),h.on(I.Events.FRAG_BUFFERED,this.onFragBuffered,this),h.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.on(I.Events.ERROR,this.onError,this)},S.unregisterListeners=function(){var h=this.hls;h.off(I.Events.FRAG_LOADING,this.onFragLoading,this),h.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),h.off(I.Events.FRAG_BUFFERED,this.onFragBuffered,this),h.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.off(I.Events.ERROR,this.onError,this)},S.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},S.onFragLoading=function(h,l){var i=l.frag;if(i.type===O.PlaylistLevelType.MAIN&&!this.timer){var c;this.fragCurrent=i,this.partCurrent=(c=l.part)!=null?c:null,this.timer=self.setInterval(this.onCheck,100)}},S.onLevelLoaded=function(h,l){var i=this.hls.config;l.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD)},S._abandonRulesCheck=function(){var h=this.fragCurrent,l=this.partCurrent,i=this.hls,c=i.autoLevelEnabled,C=i.config,v=i.media;if(!h||!v)return;var m=l?l.stats:h.stats,u=l?l.duration:h.duration;if(m.aborted){L.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!c||v.paused||!v.playbackRate||!v.readyState)return;var E=performance.now()-m.loading.start,d=Math.abs(v.playbackRate);if(E<=500*u/d)return;var f=i.levels,s=i.minAutoLevel,a=f[h.level],b=m.total||Math.max(m.loaded,Math.round(u*a.maxBitrate/8)),g=Math.max(1,m.bwEstimate?m.bwEstimate/8:m.loaded*1e3/E),_=(b-m.loaded)/g,k=v.currentTime,H=(K.BufferHelper.bufferInfo(v,k,C.maxBufferHole).end-k)/d;if(H>=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<H)break}if(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||B<c))return _}return-1},A(w,[{key:"nextAutoLevel",get:function(){var h=this._nextAutoLevel,l=this.bwEstimator;if(h!==-1&&(!l||!l.canEstimate()))return h;var i=this.getNextABRAutoLevel();return h!==-1&&(i=Math.min(h,i)),i},set:function(h){this._nextAutoLevel=h}}]),w}();Y.default=P},"./src/controller/audio-stream-controller.ts":function(oe,Y,D){"use strict";D.r(Y);var $=D("./src/polyfills/number.ts"),U=D("./src/controller/base-stream-controller.ts"),I=D("./src/events.ts"),K=D("./src/utils/buffer-helper.ts"),N=D("./src/controller/fragment-tracker.ts"),O=D("./src/types/level.ts"),L=D("./src/types/loader.ts"),x=D("./src/loader/fragment.ts"),A=D("./src/demux/chunk-cache.ts"),P=D("./src/demux/transmuxer-interface.ts"),w=D("./src/types/transmuxer.ts"),S=D("./src/controller/fragment-finders.ts"),T=D("./src/utils/discontinuities.ts"),h=D("./src/errors.ts"),l=D("./src/utils/logger.ts");function i(){return i=Object.assign||function(u){for(var E=1;E<arguments.length;E++){var d=arguments[E];for(var f in d)Object.prototype.hasOwnProperty.call(d,f)&&(u[f]=d[f])}return u},i.apply(this,arguments)}function c(u,E){u.prototype=Object.create(E.prototype),u.prototype.constructor=u,C(u,E)}function C(u,E){return C=Object.setPrototypeOf||function(f,s){return f.__proto__=s,f},C(u,E)}var v=100,m=function(u){c(E,u);function E(f,s){var a;return a=u.call(this,f,s,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var d=E.prototype;return d.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},d._registerListeners=function(){var s=this.hls;s.on(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.on(I.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),s.on(I.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),s.on(I.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.on(I.Events.ERROR,this.onError,this),s.on(I.Events.BUFFER_RESET,this.onBufferReset,this),s.on(I.Events.BUFFER_CREATED,this.onBufferCreated,this),s.on(I.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),s.on(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(I.Events.FRAG_BUFFERED,this.onFragBuffered,this)},d._unregisterListeners=function(){var s=this.hls;s.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.off(I.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),s.off(I.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),s.off(I.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.off(I.Events.ERROR,this.onError,this),s.off(I.Events.BUFFER_RESET,this.onBufferReset,this),s.off(I.Events.BUFFER_CREATED,this.onBufferCreated,this),s.off(I.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),s.off(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.off(I.Events.FRAG_BUFFERED,this.onFragBuffered,this)},d.onInitPtsFound=function(s,a){var b=a.frag,g=a.id,_=a.initPTS;if(g==="main"){var k=b.cc;this.initPTS[b.cc]=_,this.log("InitPTS for cc: "+k+" found from main: "+_),this.videoTrackCC=k,this.state===U.State.WAITING_INIT_PTS&&this.tick()}},d.startLoad=function(s){if(!this.levels){this.startPosition=s,this.state=U.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(v),this.fragLoadError=0,a>0&&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&&_e<ye&&((G.end>ye||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<w.length;S++){var T=w[S];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(P,T.key,T)}}function O(P,w,S){return w&&N(P.prototype,w),S&&N(P,S),P}function L(P,w){P.prototype=Object.create(w.prototype),P.prototype.constructor=P,x(P,w)}function x(P,w){return x=Object.setPrototypeOf||function(T,h){return T.__proto__=h,T},x(P,w)}var A=function(P){L(w,P);function w(T){var h;return h=P.call(this,T,"[audio-track-controller]")||this,h.tracks=[],h.groupId=null,h.tracksInGroup=[],h.trackId=-1,h.trackName="",h.selectDefaultTrack=!0,h.registerListeners(),h}var S=w.prototype;return S.registerListeners=function(){var h=this.hls;h.on($.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.on($.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.on($.Events.LEVEL_LOADING,this.onLevelLoading,this),h.on($.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),h.on($.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.on($.Events.ERROR,this.onError,this)},S.unregisterListeners=function(){var h=this.hls;h.off($.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off($.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.off($.Events.LEVEL_LOADING,this.onLevelLoading,this),h.off($.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),h.off($.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.off($.Events.ERROR,this.onError,this)},S.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,P.prototype.destroy.call(this)},S.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},S.onManifestParsed=function(h,l){this.tracks=l.audioTracks||[]},S.onAudioTrackLoaded=function(h,l){var i=l.id,c=l.details,C=this.tracksInGroup[i];if(!C){this.warn("Invalid audio track id "+i);return}var v=C.details;C.details=l.details,this.log("audioTrack "+i+" loaded ["+c.startSN+"-"+c.endSN+"]"),i===this.trackId&&(this.retryCount=0,this.playlistLoaded(i,l,v))},S.onLevelLoading=function(h,l){this.switchLevel(l.level)},S.onLevelSwitching=function(h,l){this.switchLevel(l.level)},S.switchLevel=function(h){var l=this.hls.levels[h];if(!(l!=null&&l.audioGroupIds))return;var i=l.audioGroupIds[l.urlId];if(this.groupId!==i){this.groupId=i;var c=this.tracks.filter(function(v){return!i||v.groupId===i});this.selectDefaultTrack&&!c.some(function(v){return v.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=c;var C={audioTracks:c};this.log("Updating audio tracks, "+c.length+' track(s) found in "'+i+'" group-id'),this.hls.trigger($.Events.AUDIO_TRACKS_UPDATED,C),this.selectInitialTrack()}},S.onError=function(h,l){if(P.prototype.onError.call(this,h,l),l.fatal||!l.context)return;l.context.type===K.PlaylistContextType.AUDIO_TRACK&&l.context.id===this.trackId&&l.context.groupId===this.groupId&&this.retryLoadingOrFail(l)},S.setAudioTrack=function(h){var l=this.tracksInGroup;if(h<0||h>=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;i<l.length;i++){var c=l[i];if((!this.selectDefaultTrack||c.default)&&(!h||h===c.name))return c.id}return-1},S.loadPlaylist=function(h){var l=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(l)){var i=l.id,c=l.groupId,C=l.url;if(h)try{C=h.addDirectives(C)}catch(v){this.warn("Could not construct new URL with HLS Delivery Directives: "+v)}this.log("loading audio-track playlist for id: "+i),this.clearTimer(),this.hls.trigger($.Events.AUDIO_TRACK_LOADING,{url:C,id:i,groupId:c,deliveryDirectives:h||null})}},O(w,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(h){this.selectDefaultTrack=!1,this.setAudioTrack(h)}}]),w}(I.default);Y.default=A},"./src/controller/base-playlist-controller.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return O});var $=D("./src/polyfills/number.ts"),U=D("./src/types/level.ts"),I=D("./src/controller/level-helper.ts"),K=D("./src/utils/logger.ts"),N=D("./src/errors.ts"),O=function(){function L(A,P){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=K.logger.log.bind(K.logger,P+":"),this.warn=K.logger.warn.bind(K.logger,P+":"),this.hls=A}var x=L.prototype;return x.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},x.onError=function(P,w){w.fatal&&w.type===N.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},x.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},x.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},x.stopLoad=function(){this.canLoad=!1,this.clearTimer()},x.switchParams=function(P,w){var S=w==null?void 0:w.renditionReports;if(S)for(var T=0;T<S.length;T++){var h=S[T],l=""+h.URI;if(l===P.substr(-l.length)){var i=parseInt(h["LAST-MSN"]),c=parseInt(h["LAST-PART"]);if(w&&this.hls.config.lowLatencyMode){var C=Math.min(w.age-w.partTarget,w.targetduration);c!==void 0&&C>w.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<S.levelLoadingMaxRetry;if(T){var h;if(this.retryCount++,P.details.indexOf("LoadTimeOut")>-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;a<s.length;a++){var b=s[a];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(f,b.key,b)}}function C(f,s,a){return s&&c(f.prototype,s),a&&c(f,a),f}function v(f){if(f===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f}function m(f,s){f.prototype=Object.create(s.prototype),f.prototype.constructor=f,u(f,s)}function u(f,s){return u=Object.setPrototypeOf||function(b,g){return b.__proto__=g,b},u(f,s)}var E={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},d=function(f){m(s,f);function s(b,g,_){var k;return k=f.call(this)||this,k.hls=void 0,k.fragPrevious=null,k.fragCurrent=null,k.fragmentTracker=void 0,k.transmuxer=null,k._state=E.STOPPED,k.media=void 0,k.mediaBuffer=void 0,k.config=void 0,k.bitrateTest=!1,k.lastCurrentTime=0,k.nextLoadPosition=0,k.startPosition=0,k.loadedmetadata=!1,k.fragLoadError=0,k.retryDate=0,k.levels=null,k.fragmentLoader=void 0,k.levelLastLoaded=null,k.startFragRequested=!1,k.decrypter=void 0,k.initPTS=[],k.onvseeking=null,k.onvended=null,k.logPrefix="",k.log=void 0,k.warn=void 0,k.logPrefix=_,k.log=N.logger.log.bind(N.logger,_+":"),k.warn=N.logger.warn.bind(N.logger,_+":"),k.hls=b,k.fragmentLoader=new T.default(b.config),k.fragmentTracker=g,k.config=b.config,k.decrypter=new h.default(b,b.config),b.on(O.Events.KEY_LOADED,k.onKeyLoaded,v(k)),k}var a=s.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(g){},a.stopLoad=function(){this.fragmentLoader.abort();var g=this.fragCurrent;g&&this.fragmentTracker.removeFragment(g),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=E.STOPPED},a._streamEnded=function(g,_){var k=this.fragCurrent,H=this.fragmentTracker;if(!_.live&&k&&k.sn===_.endSN&&!g.nextStart){var z=H.getState(k);return z===I.FragmentState.PARTIAL||z===I.FragmentState.OK}return!1},a.onMediaAttached=function(g,_){var k=this.media=this.mediaBuffer=_.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),k.addEventListener("seeking",this.onvseeking),k.addEventListener("ended",this.onvended);var H=this.config;this.levels&&H.autoStartLoad&&this.state===E.STOPPED&&this.startLoad(H.startPosition)},a.onMediaDetaching=function(){var g=this.media;g!=null&&g.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),g&&(g.removeEventListener("seeking",this.onvseeking),g.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var g=this.config,_=this.fragCurrent,k=this.media,H=this.mediaBuffer,z=this.state,Z=k?k.currentTime:0,G=K.BufferHelper.bufferInfo(H||k,Z,g.maxBufferHole);if(this.log("media seeking to "+(Object($.isFiniteNumber)(Z)?Z.toFixed(3):Z)+", state: "+z),z===E.ENDED)this.resetLoadingState();else if(_&&!G.len){var B=g.maxFragLookUpTolerance,te=_.start-B,ce=_.start+_.duration+B,pe=Z>ce;(Z<te||pe)&&(pe&&_.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),_.loader.abort()),this.resetLoadingState())}k&&(this.lastCurrentTime=Z),!this.loadedmetadata&&!G.len&&(this.nextLoadPosition=this.startPosition=Z),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(g,_){if(this.state!==E.KEY_LOADING||_.frag!==this.fragCurrent||!this.levels)return;this.state=E.IDLE;var k=this.levels[_.frag.level].details;k&&this.loadFragment(_.frag,k,_.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),f.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=E.STOPPED,this.hls.off(O.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,f.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(g,_){this.log("Loading key for "+g.sn+" of ["+_.startSN+"-"+_.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+g.level),this.state=E.KEY_LOADING,this.fragCurrent=g,this.hls.trigger(O.Events.KEY_LOADING,{frag:g})},a.loadFragment=function(g,_,k){this._loadFragForPlayback(g,_,k)},a._loadFragForPlayback=function(g,_,k){var H=this,z=function(G){if(H.fragContextChanged(g)){H.warn("Fragment "+g.sn+(G.part?" p: "+G.part.index:"")+" of level "+g.level+" was dropped during download."),H.fragmentTracker.removeFragment(g);return}g.stats.chunkCount++,H._handleFragmentLoadProgress(G)};this._doFragLoad(g,_,k,z).then(function(Z){if(!Z)return;H.fragLoadError=0;var G=H.state;if(H.fragContextChanged(g)){(G===E.FRAG_LOADING||G===E.BACKTRACKING||!H.fragCurrent&&G===E.PARSING)&&(H.fragmentTracker.removeFragment(g),H.state=E.IDLE);return}if("payload"in Z&&(H.log("Loaded fragment "+g.sn+" of level "+g.level),H.hls.trigger(O.Events.FRAG_LOADED,Z),H.state===E.BACKTRACKING)){H.fragmentTracker.backtrack(g,Z),H.resetFragmentLoading(g);return}H._handleFragmentLoadComplete(Z)}).catch(function(Z){H.warn(Z),H.resetFragmentLoading(g)})},a.flushMainBuffer=function(g,_,k){if(k===void 0&&(k=null),!(g-_))return;var H={startOffset:g,endOffset:_,type:k};this.fragLoadError=0,this.hls.trigger(O.Events.BUFFER_FLUSHING,H)},a._loadInitSegment=function(g){var _=this;this._doFragLoad(g).then(function(k){if(!k||_.fragContextChanged(g)||!_.levels)throw new Error("init load aborted");return k}).then(function(k){var H=_.hls,z=k.payload,Z=g.decryptdata;if(z&&z.byteLength>0&&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<Z.end)return K.BufferHelper.bufferInfo(g,H,Math.max(z.nextStart,k.maxBufferHole))}return z},a.getMaxBufferLength=function(g){var _=this.config,k;return g?k=Math.max(8*_.maxBufferSize/g,_.maxBufferLength):k=_.maxBufferLength,Math.min(k,_.maxMaxBufferLength)},a.reduceMaxBufferLength=function(g){var _=this.config,k=g||_.maxBufferLength;return _.maxMaxBufferLength>=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<ce)return this.warn("Not enough fragments to start playback (have: "+Z+", need: "+ce+")"),null;!_.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(te=this.getInitialLiveFragment(_,z),this.startPosition=te?this.hls.liveSyncPosition||te.start:g)}else g<=B&&(te=z[0]);if(!te){var pe=G.lowLatencyMode?_.partEnd:_.fragmentEnd;te=this.getFragmentAtPosition(g,pe,_)}return(k=te)!==null&&k!==void 0&&k.initSegment&&!((H=te)!==null&&H!==void 0&&H.initSegment.data)&&!this.bitrateTest&&(te=te.initSegment),te},a.getNextPart=function(g,_,k){for(var H=-1,z=!1,Z=!0,G=0,B=g.length;G<B;G++){var te=g[G];if(Z=Z&&!te.independent,H>-1&&k<te.start)break;var ce=te.loaded;!ce&&(z||te.independent||Z)&&te.fragment===_&&(H=G),z=ce}return H},a.loadedEndOfParts=function(g,_){var k=g[g.length-1];return k&&_>k.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<G&&this.fragmentTracker.getState(le)!==I.FragmentState.OK?(this.log("SN "+pe.sn+" just loaded, load next one: "+le.sn),pe=le):pe=null))}return pe},a.synchronizeToLiveEdge=function(g){var _=this.config,k=this.media;if(!k)return;var H=this.hls.liveSyncPosition,z=k.currentTime,Z=g.fragments[0].start,G=g.edge,B=z>=Z-_.maxFragLookUpTolerance&&z<=G;if(H!==null&&k.duration>H&&(z<H||!B)){var te=_.liveMaxLatencyDuration!==void 0?_.liveMaxLatencyDuration:_.liveMaxLatencyDurationCount*g.targetduration;(!B&&k.readyState<4||z<G-te)&&(this.loadedmetadata||(this.nextLoadPosition=H),k.readyState&&(this.warn("Playback: "+z.toFixed(3)+" is located too far from the end of live sliding playlist: "+G+", reset currentTime to : "+H.toFixed(3)),k.currentTime=H))}},a.alignPlaylists=function(g,_){var k=this.levels,H=this.levelLastLoaded,z=this.fragPrevious,Z=H!==null?k[H]:null,G=g.fragments.length;if(!G)return this.warn("No fragments in live playlist"),0;var B=g.fragments[0].start,te=!_,ce=g.alignedSliding&&Object($.isFiniteNumber)(B);if(te||!ce&&!B){Object(P.alignStream)(z,Z,g);var pe=g.fragments[0].start;return this.log("Live playlist sliding: "+pe.toFixed(2)+" start-sn: "+(_?_.startSN:"na")+"->"+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;L<O.length;L++){var x=O[L];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(N,x.key,x)}}function I(N,O,L){return O&&U(N.prototype,O),L&&U(N,L),N}var K=function(){function N(L){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=L,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var O=N.prototype;return O.setStreamController=function(x){this.streamController=x},O.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},O.registerListeners=function(){var x=this.hls;x.on($.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),x.on($.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),x.on($.Events.MANIFEST_PARSED,this.onManifestParsed,this),x.on($.Events.BUFFER_CODECS,this.onBufferCodecs,this),x.on($.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},O.unregisterListener=function(){var x=this.hls;x.off($.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),x.off($.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),x.off($.Events.MANIFEST_PARSED,this.onManifestParsed,this),x.off($.Events.BUFFER_CODECS,this.onBufferCodecs,this),x.off($.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},O.onFpsDropLevelCapping=function(x,A){N.isLevelAllowed(A.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(A.droppedLevel)},O.onMediaAttaching=function(x,A){this.media=A.media instanceof HTMLVideoElement?A.media:null},O.onManifestParsed=function(x,A){var P=this.hls;this.restrictedLevels=[],this.firstLevel=A.firstLevel,P.config.capLevelToPlayerSize&&A.video&&this.startCapping()},O.onBufferCodecs=function(x,A){var P=this.hls;P.config.capLevelToPlayerSize&&A.video&&this.startCapping()},O.onMediaDetaching=function(){this.stopCapping()},O.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&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<x.length;T+=1){var h=x[T];if((h.width>=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<T.length;h++){var l=T[h];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(S,l.key,l)}}function O(S,T,h){return T&&N(S.prototype,T),h&&N(S,h),S}function L(S,T){var h=typeof Symbol!="undefined"&&S[Symbol.iterator]||S["@@iterator"];if(h)return(h=h.call(S)).next.bind(h);if(Array.isArray(S)||(h=x(S))||T&&S&&typeof S.length=="number"){h&&(S=h);var l=0;return function(){return l>=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);h<T;h++)l[h]=S[h];return l}function P(){return P=Object.assign||function(S){for(var T=1;T<arguments.length;T++){var h=arguments[T];for(var l in h)Object.prototype.hasOwnProperty.call(h,l)&&(S[l]=h[l])}return S},P.apply(this,arguments)}var w=function(){function S(h){var l=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){l.initialized&&(l.starved=!0),l.buffering=!0},this.onPlaying=function(){l.initialized||(l.initialized=!0),l.buffering=!1},this.applyPlaylistData=function(C){try{l.apply(C,{ot:U.CMCDObjectType.MANIFEST,su:!l.initialized})}catch(v){K.logger.warn("Could not generate manifest CMCD data.",v)}},this.applyFragmentData=function(C){try{var v=C.frag,m=l.hls.levels[v.level],u=l.getObjectType(v),E={d:v.duration*1e3,ot:u};(u===U.CMCDObjectType.VIDEO||u===U.CMCDObjectType.AUDIO||u==U.CMCDObjectType.MUXED)&&(E.br=m.bitrate/1e3,E.tb=l.getTopBandwidth(u),E.bl=l.getBufferLength(u)),l.apply(C,E)}catch(d){K.logger.warn("Could not generate segment CMCD data.",d)}},this.hls=h;var i=this.config=h.config,c=i.cmcd;c!=null&&(i.pLoader=this.createPlaylistLoader(),i.fLoader=this.createFragmentLoader(),this.sid=c.sessionId||S.uuid(),this.cid=c.contentId,this.useHeaders=c.useHeaders===!0,this.registerListeners())}var T=S.prototype;return T.registerListeners=function(){var l=this.hls;l.on($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.on($.Events.MEDIA_DETACHED,this.onMediaDetached,this),l.on($.Events.BUFFER_CREATED,this.onBufferCreated,this)},T.unregisterListeners=function(){var l=this.hls;l.off($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.off($.Events.MEDIA_DETACHED,this.onMediaDetached,this),l.off($.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},T.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},T.onMediaAttached=function(l,i){this.media=i.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},T.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},T.onBufferCreated=function(l,i){var c,C;this.audioBuffer=(c=i.tracks.audio)===null||c===void 0?void 0:c.buffer,this.videoBuffer=(C=i.tracks.video)===null||C===void 0?void 0:C.buffer},T.createData=function(){var l;return{v:U.CMCDVersion,sf:U.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(l=this.media)===null||l===void 0?void 0:l.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},T.apply=function(l,i){i===void 0&&(i={}),P(i,this.createData());var c=i.ot===U.CMCDObjectType.INIT||i.ot===U.CMCDObjectType.VIDEO||i.ot===U.CMCDObjectType.MUXED;if(this.starved&&c&&(i.bs=!0,i.su=!0,this.starved=!1),i.su==null&&(i.su=this.buffering),this.useHeaders){var C=S.toHeaders(i);if(!Object.keys(C).length)return;l.headers||(l.headers={}),P(l.headers,C)}else{var v=S.toQuery(i);if(!v)return;l.url=S.appendQueryToUri(l.url,v)}},T.getObjectType=function(l){var i=l.type;return i==="subtitle"?U.CMCDObjectType.TIMED_TEXT:l.sn==="initSegment"?U.CMCDObjectType.INIT:i==="audio"?U.CMCDObjectType.AUDIO:i==="main"?this.hls.audioTracks.length?U.CMCDObjectType.VIDEO:U.CMCDObjectType.MUXED:void 0},T.getTopBandwidth=function(l){for(var i=0,c=l===U.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,C=L(c),v;!(v=C()).done;){var m=v.value;m.bitrate>i&&(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;u<E.length;u++){var d=E[u],f=m[d]!=null?m[d]:1;v[f][d]=l[d]}for(var s=0;s<v.length;s++){var a=S.serialize(v[s]);a&&(c["CMCD-"+C[s]]=a)}return c},S.toQuery=function(l){return"CMCD="+encodeURIComponent(S.serialize(l))},S.appendQueryToUri=function(l,i){if(!i)return l;var c=l.includes("?")?"&":"?";return""+l+c+i},S}()},"./src/controller/eme-controller.ts":function(oe,Y,D){"use strict";D.r(Y);var $=D("./src/events.ts"),U=D("./src/errors.ts"),I=D("./src/utils/logger.ts"),K=D("./src/utils/mediakeys-helper.ts");function N(w,S){for(var T=0;T<S.length;T++){var h=S[T];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(w,h.key,h)}}function O(w,S,T){return S&&N(w.prototype,S),T&&N(w,T),w}var L=3,x=function(S,T,h){var l={audioCapabilities:[],videoCapabilities:[]};return S.forEach(function(i){l.audioCapabilities.push({contentType:'audio/mp4; codecs="'+i+'"',robustness:h.audioRobustness||""})}),T.forEach(function(i){l.videoCapabilities.push({contentType:'video/mp4; codecs="'+i+'"',robustness:h.videoRobustness||""})}),[l]},A=function(S,T,h,l){switch(S){case K.KeySystems.WIDEVINE:return x(T,h,l);default:throw new Error("Unknown key-system: "+S)}},P=function(){function w(T){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=T,this._config=T.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var S=w.prototype;return S.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},S._registerListeners=function(){this.hls.on($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on($.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on($.Events.MANIFEST_PARSED,this.onManifestParsed,this)},S._unregisterListeners=function(){this.hls.off($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off($.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off($.Events.MANIFEST_PARSED,this.onManifestParsed,this)},S.getLicenseServerUrl=function(h){switch(h){case K.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+h+'"')},S._attemptKeySystemAccess=function(h,l,i){var c=this,C=A(h,l,i,this._drmSystemOptions);I.logger.log("Requesting encrypted media key-system access");var v=this.requestMediaKeySystemAccess(h,C);this.mediaKeysPromise=v.then(function(m){return c._onMediaKeySystemAccessObtained(h,m)}),v.catch(function(m){I.logger.error('Failed to obtain key-system "'+h+'" access:',m)})},S._onMediaKeySystemAccessObtained=function(h,l){var i=this;I.logger.log('Access for key-system "'+h+'" obtained');var c={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:l,mediaKeySystemDomain:h};this._mediaKeysList.push(c);var C=Promise.resolve().then(function(){return l.createMediaKeys()}).then(function(v){return c.mediaKeys=v,I.logger.log('Media-keys created for key-system "'+h+'"'),i._onMediaKeysCreated(),v});return C.catch(function(v){I.logger.error("Failed to create media-keys:",v)}),C},S._onMediaKeysCreated=function(){var h=this;this._mediaKeysList.forEach(function(l){l.mediaKeysSession||(l.mediaKeysSession=l.mediaKeys.createSession(),h._onNewMediaKeySession(l.mediaKeysSession))})},S._onNewMediaKeySession=function(h){var l=this;I.logger.log("New key-system session "+h.sessionId),h.addEventListener("message",function(i){l._onKeySessionMessage(h,i.message)},!1)},S._onKeySessionMessage=function(h,l){I.logger.log("Got EME message event, creating license request"),this._requestLicense(l,function(i){I.logger.log("Received license data (length: "+(i&&i.byteLength)+"), updating key-session"),h.update(i)})},S.onMediaEncrypted=function(h){var l=this;if(I.logger.log('Media is encrypted using "'+h.initDataType+'" init data type'),!this.mediaKeysPromise){I.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger($.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var i=function(C){if(!l._media)return;l._attemptSetMediaKeys(C),l._generateRequestWithPreferredKeySession(h.initDataType,h.initData)};this.mediaKeysPromise.then(i).catch(i)},S._attemptSetMediaKeys=function(h){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var l=this._mediaKeysList[0];if(!l||!l.mediaKeys){I.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger($.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}I.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(l.mediaKeys),this._hasSetMediaKeys=!0}},S._generateRequestWithPreferredKeySession=function(h,l){var i=this,c=this._mediaKeysList[0];if(!c){I.logger.error("Fatal: Media is encrypted but not any 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}if(c.mediaKeysSessionInitialized){I.logger.warn("Key-Session already initialized but requested again");return}var C=c.mediaKeysSession;if(!C){I.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger($.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!l){I.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger($.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}I.logger.log('Generating key-session request for "'+h+'" init data type'),c.mediaKeysSessionInitialized=!0,C.generateRequest(h,l).then(function(){I.logger.debug("Key-session generation succeeded")}).catch(function(v){I.logger.error("Error generating key-session request:",v),i.hls.trigger($.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},S._createLicenseXhr=function(h,l,i){var c=new XMLHttpRequest;c.responseType="arraybuffer",c.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,c,h,l,i);var C=this._licenseXhrSetup;if(C)try{C.call(this.hls,c,h),C=void 0}catch(v){I.logger.error(v)}try{c.readyState||c.open("POST",h,!0),C&&C.call(this.hls,c,h)}catch(v){throw new Error("issue setting up KeySystem license XHR "+v)}return c},S._onLicenseRequestReadyStageChange=function(h,l,i,c){switch(h.readyState){case 4:if(h.status===200){this._requestLicenseFailureCount=0,I.logger.log("License request succeeded");var C=h.response,v=this._licenseResponseCallback;if(v)try{C=v.call(this.hls,h,l)}catch(u){I.logger.error(u)}c(C)}else{if(I.logger.error("License Request XHR failed ("+l+"). Status: "+h.status+" ("+h.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>L){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;T<x.length;++T){var h=x[T];if(O(A,P,h))return h}return null}function K(x,A,P,w){P===void 0&&(P=0),w===void 0&&(w=0);var S=null;if(x?S=A[x.sn-A[0].sn+1]||null:P===0&&A[0].start===0&&(S=A[0]),S&&N(P,w,S)===0)return S;var T=U.default.search(A,N.bind(null,P,w));return T||S}function N(x,A,P){x===void 0&&(x=0),A===void 0&&(A=0);var w=Math.min(A,P.duration+(P.deltaPTS?P.deltaPTS:0));return P.start+P.duration-w<=x?1:P.start-w>x&&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.cc<A?1:P.cc>A?-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<T.length;v++){var m=T.start(v)-this.bufferPadding,u=T.end(v)+this.bufferPadding;if(C>=m&&c<=u){h.time.push({startPTS:Math.max(l,T.start(v)),endPTS:Math.min(i,T.end(v))});break}else if(l<u&&i>m)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<S.length;l++){if(T=S.start(l)-this.bufferPadding,h=S.end(l)+this.bufferPadding,P>=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;v<C.length;v++)T.appendedPTS=Math.max(C.end(v),T.appendedPTS||0)})},x.onFragBuffered=function(P,w){this.detectPartialFragments(w)},x.hasFragment=function(P){var w=O(P);return!!this.fragments[w]},x.removeFragmentsInRange=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){var i=l.body;i.type===S&&i.start<w&&i.end>P&&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<v.length;m++){var u=v.start(m);if(c+h.maxBufferHole>=C&&c<u){var E=Math.max(u+x,i.currentTime+L);return K.logger.warn("skipping hole, adjusting currentTime from "+c+" to "+E),this.moved=!0,this.stalled=null,i.currentTime=E,T&&l.trigger(I.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+c+" to "+E,frag:T}),E}C=v.end(m)}return 0},w._tryNudgeBuffer=function(){var T=this.config,h=this.hls,l=this.media,i=l.currentTime,c=(this.nudgeRetry||0)+1;if(this.nudgeRetry=c,c<T.nudgeMaxRetry){var C=i+c*T.nudgeOffset;K.logger.warn("Nudging 'currentTime' from "+i+" to "+C),l.currentTime=C,h.trigger(I.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else K.logger.error("Playhead still not moving while enough data buffered @"+i+" after "+T.nudgeMaxRetry+" nudges"),h.trigger(I.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},P}()},"./src/controller/id3-track-controller.ts":function(oe,Y,D){"use strict";D.r(Y);var $=D("./src/events.ts"),U=D("./src/utils/texttrack-utils.ts"),I=D("./src/demux/id3.ts"),K=.25,N=function(){function O(x){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=x,this._registerListeners()}var L=O.prototype;return L.destroy=function(){this._unregisterListeners()},L._registerListeners=function(){var A=this.hls;A.on($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.on($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.on($.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.on($.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},L._unregisterListeners=function(){var A=this.hls;A.off($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.off($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.off($.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.off($.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},L.onMediaAttached=function(A,P){this.media=P.media},L.onMediaDetaching=function(){if(!this.id3Track)return;Object(U.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},L.getID3Track=function(A){if(!this.media)return;for(var P=0;P<A.length;P++){var w=A[P];if(w.kind==="metadata"&&w.label==="id3")return Object(U.sendAddTrackEvent)(w,this.media),w}return this.media.addTextTrack("metadata","id3")},L.onFragParsingMetadata=function(A,P){if(!this.media)return;var w=P.frag,S=P.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var T=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,h=0;h<S.length;h++){var l=I.getID3Frames(S[h].data);if(l){var i=S[h].pts,c=h<S.length-1?S[h+1].pts:w.end,C=c-i;C<=0&&(c=i+K);for(var v=0;v<l.length;v++){var m=l[v];if(!I.isTimeStampFrame(m)){var u=new T(i,c,"");u.value=m,this.id3Track.addCue(u)}}}}},L.onBufferFlushing=function(A,P){var w=P.startOffset,S=P.endOffset,T=P.type;if(!T||T==="audio"){var h=this.id3Track;h&&Object(U.removeCuesInRange)(h,w,S)}},O}();Y.default=N},"./src/controller/latency-controller.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return O});var $=D("./src/errors.ts"),U=D("./src/events.ts"),I=D("./src/utils/logger.ts");function K(L,x){for(var A=0;A<x.length;A++){var P=x[A];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(L,P.key,P)}}function N(L,x,A){return x&&K(L.prototype,x),A&&K(L,A),L}var O=function(){function L(A){var P=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return P.timeupdate()},this.hls=A,this.config=A.config,this.registerListeners()}var x=L.prototype;return x.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},x.registerListeners=function(){this.hls.on(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(U.Events.ERROR,this.onError,this)},x.unregisterListeners=function(){this.hls.off(U.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(U.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(U.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(U.Events.ERROR,this.onError)},x.onMediaAttached=function(P,w){this.media=w.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},x.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},x.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},x.onLevelUpdated=function(P,w){var S=w.details;this.levelDetails=S,S.advanced&&this.timeupdate(),!S.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},x.onError=function(P,w){if(w.details!==$.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,I.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},x.timeupdate=function(){var P=this.media,w=this.levelDetails;if(!P||!w)return;this.currentTime=P.currentTime;var S=this.computeLatency();if(S===null)return;this._latency=S;var T=this.config,h=T.lowLatencyMode,l=T.maxLiveSyncPlaybackRate;if(!h||l===1)return;var i=this.targetLatency;if(i===null)return;var c=S-i,C=Math.min(this.maxLatency,i+w.targetduration),v=c<C;if(w.live&&v&&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;i<arguments.length;i++){var c=arguments[i];for(var C in c)Object.prototype.hasOwnProperty.call(c,C)&&(l[C]=c[C])}return l},x.apply(this,arguments)}function A(l,i){for(var c=0;c<i.length;c++){var C=i[c];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(l,C.key,C)}}function P(l,i,c){return i&&A(l.prototype,i),c&&A(l,c),l}function w(l,i){l.prototype=Object.create(i.prototype),l.prototype.constructor=l,S(l,i)}function S(l,i){return S=Object.setPrototypeOf||function(C,v){return C.__proto__=v,C},S(l,i)}var T=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),h=function(l){w(i,l);function i(C){var v;return v=l.call(this,C,"[level-controller]")||this,v._levels=[],v._firstLevel=-1,v._startLevel=void 0,v.currentLevelIndex=-1,v.manualLevelIndex=-1,v.onParsedComplete=void 0,v._registerListeners(),v}var c=i.prototype;return c._registerListeners=function(){var v=this.hls;v.on(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),v.on(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.on(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),v.on(U.Events.ERROR,this.onError,this)},c._unregisterListeners=function(){var v=this.hls;v.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),v.off(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.off(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),v.off(U.Events.ERROR,this.onError,this)},c.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,l.prototype.destroy.call(this)},c.startLoad=function(){var v=this._levels;v.forEach(function(m){m.loadError=0}),l.prototype.startLoad.call(this)},c.onManifestLoaded=function(v,m){var u=[],E=[],d=[],f,s={},a,b=!1,g=!1,_=!1;if(m.levels.forEach(function(Z){var G=Z.attrs;b=b||!!(Z.width&&Z.height),g=g||!!Z.videoCodec,_=_||!!Z.audioCodec,T&&Z.audioCodec&&Z.audioCodec.indexOf("mp4a.40.34")!==-1&&(Z.audioCodec=void 0);var B=Z.bitrate+"-"+Z.attrs.RESOLUTION+"-"+Z.attrs.CODECS;a=s[B],a?a.url.push(Z.url):(a=new $.Level(Z),s[B]=a,u.push(a)),G&&(G.AUDIO&&Object(N.addGroupId)(a,"audio",G.AUDIO),G.SUBTITLES&&Object(N.addGroupId)(a,"text",G.SUBTITLES))}),(b||g)&&_&&(u=u.filter(function(Z){var G=Z.videoCodec,B=Z.width,te=Z.height;return!!G||!!(B&&te)})),u=u.filter(function(Z){var G=Z.audioCodec,B=Z.videoCodec;return(!G||Object(K.isCodecSupportedInMp4)(G,"audio"))&&(!B||Object(K.isCodecSupportedInMp4)(B,"video"))}),m.audioTracks&&(E=m.audioTracks.filter(function(Z){return!Z.audioCodec||Object(K.isCodecSupportedInMp4)(Z.audioCodec,"audio")}),Object(N.assignTrackIdsByGroup)(E)),m.subtitles&&(d=m.subtitles,Object(N.assignTrackIdsByGroup)(d)),u.length>0){f=u[0].bitrate,u.sort(function(Z,G){return Z.bitrate-G.bitrate}),this._levels=u;for(var k=0;k<u.length;k++)if(u[k].bitrate===f){this._firstLevel=k,this.log("manifest loaded, "+u.length+" level(s) found, first bitrate: "+f);break}var H=_&&!g,z={levels:u,audioTracks:E,subtitleTracks:d,firstLevel:this._firstLevel,stats:m.stats,audio:_,video:g,altAudio:!H&&E.some(function(Z){return!!Z.url})};this.hls.trigger(U.Events.MANIFEST_PARSED,z),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(U.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:m.url,reason:"no level with compatible codecs found in manifest"})},c.onError=function(v,m){if(l.prototype.onError.call(this,v,m),m.fatal)return;var u=m.context,E=this._levels[this.currentLevelIndex];if(u&&(u.type===L.PlaylistContextType.AUDIO_TRACK&&E.audioGroupIds&&u.groupId===E.audioGroupIds[E.urlId]||u.type===L.PlaylistContextType.SUBTITLE_TRACK&&E.textGroupIds&&u.groupId===E.textGroupIds[E.urlId])){this.redundantFailover(this.currentLevelIndex);return}var d=!1,f=!0,s;switch(m.details){case I.ErrorDetails.FRAG_LOAD_ERROR:case I.ErrorDetails.FRAG_LOAD_TIMEOUT:case I.ErrorDetails.KEY_LOAD_ERROR:case I.ErrorDetails.KEY_LOAD_TIMEOUT:if(m.frag){var a=this._levels[m.frag.level];a?(a.fragmentError++,a.fragmentError>this.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.loadError<a)v.levelRetry=!0,this.redundantFailover(m);else if(this.manualLevelIndex===-1){var b=m===0?this._levels.length-1:m-1;this.currentLevelIndex!==b&&this._levels[b].loadError===0&&(this.warn(d+": switch to "+b),v.levelRetry=!0,this.hls.nextAutoLevel=b)}}},c.redundantFailover=function(v){var m=this._levels[v],u=m.url.length;if(u>1){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;f<u.audioGroupIds.length;f++)if(u.audioGroupIds[f]===d){E=f;break}E!==u.urlId&&(u.urlId=E,this.startLoad())}},c.loadPlaylist=function(v){var m=this.currentLevelIndex,u=this._levels[m];if(this.canLoad&&u&&u.url.length>0){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.startSN||_>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<z.length-1;k++)O(z[k],z[k+1]);return i.fragmentHint&&O(z[z.length-1],i.fragmentHint),i.PTSKnown=i.alignedSliding=!0,g}function x(i,c){for(var C=null,v=i.fragments,m=v.length-1;m>=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<a.length;b++)a[b].cc+=E}c.skippedSegments&&(c.startCC=c.fragments[0].cc),A(i.partList,c.partList,function(k,H){H.elementaryStreams=k.elementaryStreams,H.stats=k.stats}),d?L(c,d,d.startPTS,d.endPTS,d.startDTS,d.endDTS):w(i,c),a.length&&(c.totalduration=c.edge-a[0].start),c.driftStartTime=i.driftStartTime,c.driftStart=i.driftStart;var g=c.advancedDateTime;if(c.advanced&&g){var _=c.edge;c.driftStart||(c.driftStartTime=g,c.driftStart=_),c.driftEndTime=g,c.driftEnd=_}else c.driftEndTime=i.driftEndTime,c.driftEnd=i.driftEnd,c.advancedDateTime=i.advancedDateTime}function A(i,c,C){if(i&&c)for(var v=0,m=0,u=i.length;m<=u;m++){var E=i[m],d=c[m+v];E&&d&&E.index===d.index&&E.fragment.sn===d.fragment.sn?C(E,d):v--}}function P(i,c,C){for(var v=c.skippedSegments,m=Math.max(i.startSN,c.startSN)-c.startSN,u=(i.fragmentHint?1:0)+(v?c.endSN:Math.min(i.endSN,c.endSN))-c.startSN,E=c.startSN-i.startSN,d=c.fragmentHint?c.fragments.concat(c.fragmentHint):c.fragments,f=i.fragmentHint?i.fragments.concat(i.fragmentHint):i.fragments,s=m;s<=u;s++){var a=f[E+s],b=d[s];v&&!b&&s<v&&(b=c.fragments[s]=a),a&&b&&C(a,b)}}function w(i,c){var C=c.startSN+c.skippedSegments-i.startSN,v=i.fragments;if(C<0||C>=v.length)return;S(c,v[C].start)}function S(i,c){if(c){for(var C=i.fragments,v=i.skippedSegments;v<C.length;v++)C[v].start+=c;i.fragmentHint&&(i.fragmentHint.start+=c)}}function T(i,c){var C=1e3*i.levelTargetDuration,v=C/2,m=i.age,u=m>0&&m<C*3,E=c.loading.end-c.loading.start,d,f=i.availabilityDelay;if(i.updated===!1)if(u){var s=333*i.misses;d=Math.max(Math.min(v,E*2),s),i.availabilityDelay=(i.availabilityDelay||0)+d}else d=v;else u?(f=Math.min(f||C/2,m),i.availabilityDelay=f,d=f+C-m):d=C-E;return Math.round(d)}function h(i,c,C){if(!i||!i.details)return null;var v=i.details,m=v.fragments[c-v.startSN];return m||(m=v.fragmentHint,m&&m.sn===c?m:c<v.startSN&&C&&C.sn===c?C:null)}function l(i,c,C){if(!i||!i.details)return null;var v=i.details.partList;if(v)for(var m=v.length;m--;){var u=v[m];if(u.index===C&&u.fragment.sn===c)return u}return null}},"./src/controller/stream-controller.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return v});var $=D("./src/polyfills/number.ts"),U=D("./src/controller/base-stream-controller.ts"),I=D("./src/is-supported.ts"),K=D("./src/events.ts"),N=D("./src/utils/buffer-helper.ts"),O=D("./src/controller/fragment-tracker.ts"),L=D("./src/types/loader.ts"),x=D("./src/loader/fragment.ts"),A=D("./src/demux/transmuxer-interface.ts"),P=D("./src/types/transmuxer.ts"),w=D("./src/controller/gap-controller.ts"),S=D("./src/errors.ts"),T=D("./src/utils/logger.ts");function h(m,u){for(var E=0;E<u.length;E++){var d=u[E];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(m,d.key,d)}}function l(m,u,E){return u&&h(m.prototype,u),E&&h(m,E),m}function i(m,u){m.prototype=Object.create(u.prototype),m.prototype.constructor=m,c(m,u)}function c(m,u){return c=Object.setPrototypeOf||function(d,f){return d.__proto__=f,d},c(m,u)}var C=100,v=function(m){i(u,m);function u(d,f){var s;return s=m.call(this,d,f,"[stream-controller]")||this,s.audioCodecSwap=!1,s.gapController=null,s.level=-1,s._forceStartLoad=!1,s.altAudio=!1,s.audioOnly=!1,s.fragPlaying=null,s.onvplaying=null,s.onvseeked=null,s.fragLastKbps=0,s.stalled=!1,s.couldBacktrack=!1,s.audioCodecSwitch=!1,s.videoBuffer=null,s._registerListeners(),s}var E=u.prototype;return E._registerListeners=function(){var f=this.hls;f.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.on(K.Events.LEVEL_LOADING,this.onLevelLoading,this),f.on(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.on(K.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),f.on(K.Events.ERROR,this.onError,this),f.on(K.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),f.on(K.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.on(K.Events.BUFFER_CREATED,this.onBufferCreated,this),f.on(K.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),f.on(K.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),f.on(K.Events.FRAG_BUFFERED,this.onFragBuffered,this)},E._unregisterListeners=function(){var f=this.hls;f.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.off(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.off(K.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),f.off(K.Events.ERROR,this.onError,this),f.off(K.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),f.off(K.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.off(K.Events.BUFFER_CREATED,this.onBufferCreated,this),f.off(K.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),f.off(K.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),f.off(K.Events.FRAG_BUFFERED,this.onFragBuffered,this)},E.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},E.startLoad=function(f){if(this.levels){var s=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(C),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var b=a.startLevel;b===-1&&(a.config.testBandwidth?(b=0,this.bitrateTest=!0):b=a.nextAutoLevel),this.level=a.nextLoadLevel=b,this.loadedmetadata=!1}s>0&&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&&s<a){if(f.seeking){T.logger.log("could not seek to "+a+", already seeking at "+s);return}var b=N.BufferHelper.getBuffered(f),g=b.length?b.start(0):0,_=g-a;_>0&&(_<this.config.maxBufferHole||_<this.config.maxFragLookUpTolerance)&&(T.logger.log("adjusting start position by "+_+" to match buffer start"),a+=_,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+s),f.currentTime=a}},E._getAudioCodec=function(f){var s=this.config.defaultAudioCodec||f.audioCodec;return this.audioCodecSwap&&s&&(this.log("Swapping audio codec"),s.indexOf("mp4a.40.5")!==-1?s="mp4a.40.2":s="mp4a.40.5"),s},E._loadBitrateTestFrag=function(f){var s=this;this._doFragLoad(f).then(function(a){var b=s.hls;if(!a||b.nextLoadLevel||s.fragContextChanged(f))return;s.fragLoadError=0,s.state=U.State.IDLE,s.startFragRequested=!1,s.bitrateTest=!1;var g=f.stats;g.parsing.start=g.parsing.end=g.buffering.start=g.buffering.end=self.performance.now(),b.trigger(K.Events.FRAG_LOADED,a)})},E._handleTransmuxComplete=function(f){var s,a="main",b=this.hls,g=f.remuxResult,_=f.chunkMeta,k=this.getCurrentContext(_);if(!k){this.warn("The loading context changed while buffering fragment "+_.sn+" of level "+_.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(_.level);return}var H=k.frag,z=k.part,Z=k.level,G=g.video,B=g.text,te=g.id3,ce=g.initSegment,pe=this.altAudio?void 0:g.audio;if(this.fragContextChanged(H))return;if(this.state=U.State.PARSING,ce){ce.tracks&&(this._bufferInitSegment(Z,ce.tracks,H,_),b.trigger(K.Events.FRAG_PARSING_INIT_SEGMENT,{frag:H,id:a,tracks:ce.tracks}));var ye=ce.initPTS,Ce=ce.timescale;Object($.isFiniteNumber)(ye)&&(this.initPTS[H.cc]=ye,b.trigger(K.Events.INIT_PTS_FOUND,{frag:H,id:a,initPTS:ye,timescale:Ce}))}if(G&&g.independent!==!1){if(Z.details){var _e=G.startPTS,le=G.endPTS,se=G.startDTS,ge=G.endDTS;if(z)z.elementaryStreams[G.type]={startPTS:_e,endPTS:le,startDTS:se,endDTS:ge};else if(G.firstKeyFrame&&G.independent&&(this.couldBacktrack=!0),G.dropped&&G.independent){var ie=this.getLoadPosition()+this.config.maxBufferHole;if(ie<_e){this.backtrack(H);return}H.setElementaryStreamInfo(G.type,H.start,le,H.start,ge,!0)}H.setElementaryStreamInfo(G.type,_e,le,se,ge),this.bufferFragmentData(G,H,z,_)}}else if(g.independent===!1){this.backtrack(H);return}if(pe){var q=pe.startPTS,Ee=pe.endPTS,Me=pe.startDTS,Ne=pe.endDTS;z&&(z.elementaryStreams[x.ElementaryStreamTypes.AUDIO]={startPTS:q,endPTS:Ee,startDTS:Me,endDTS:Ne}),H.setElementaryStreamInfo(x.ElementaryStreamTypes.AUDIO,q,Ee,Me,Ne),this.bufferFragmentData(pe,H,z,_)}if(te!=null&&(s=te.samples)!==null&&s!==void 0&&s.length){var De={frag:H,id:a,samples:te.samples};b.trigger(K.Events.FRAG_PARSING_METADATA,De)}if(B){var Be={frag:H,id:a,samples:B.samples};b.trigger(K.Events.FRAG_PARSING_USERDATA,Be)}},E._bufferInitSegment=function(f,s,a,b){var g=this;if(this.state!==U.State.PARSING)return;this.audioOnly=!!s.audio&&!s.video,this.altAudio&&!this.audioOnly&&delete s.audio;var _=s.audio,k=s.video,H=s.audiovideo;if(_){var z=f.audioCodec,Z=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(z&&(z.indexOf("mp4a.40.5")!==-1?z="mp4a.40.2":z="mp4a.40.5"),_.metadata.channelCount!==1&&Z.indexOf("firefox")===-1&&(z="mp4a.40.5")),Z.indexOf("android")!==-1&&_.container!=="audio/mpeg"&&(z="mp4a.40.2",this.log("Android: force audio codec to "+z)),f.audioCodec&&f.audioCodec!==z&&this.log('Swapping manifest audio codec "'+f.audioCodec+'" for "'+z+'"'),_.levelCodec=z,_.id="main",this.log("Init audio buffer, container:"+_.container+", codecs[selected/level/parsed]=["+(z||"")+"/"+(f.audioCodec||"")+"/"+_.codec+"]")}k&&(k.levelCodec=f.videoCodec,k.id="main",this.log("Init video buffer, container:"+k.container+", codecs[level/parsed]=["+(f.videoCodec||"")+"/"+k.codec+"]")),H&&this.log("Init audiovideo buffer, container:"+H.container+", codecs[level/parsed]=["+(f.attrs.CODECS||"")+"/"+H.codec+"]"),this.hls.trigger(K.Events.BUFFER_CODECS,s),Object.keys(s).forEach(function(G){var B=s[G],te=B.initSegment;te!=null&&te.byteLength&&g.hls.trigger(K.Events.BUFFER_APPENDING,{type:G,data:te,frag:a,part:null,chunkMeta:b,parent:a.type})}),this.tick()},E.backtrack=function(f){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(f);var s=this.fragmentTracker.backtrack(f);this.fragPrevious=null,this.nextLoadPosition=f.start,s?this.resetFragmentLoading(f):this.state=U.State.BACKTRACKING},E.checkFragmentChanged=function(){var f=this.media,s=null;if(f&&f.readyState>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<C.length;v++){var m=C[v];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(c,m.key,m)}}function S(c,C,v){return C&&w(c.prototype,C),v&&w(c,v),c}function T(c,C){c.prototype=Object.create(C.prototype),c.prototype.constructor=c,h(c,C)}function h(c,C){return h=Object.setPrototypeOf||function(m,u){return m.__proto__=u,m},h(c,C)}var l=500,i=function(c){T(C,c);function C(m,u){var E;return E=c.call(this,m,u,"[subtitle-stream-controller]")||this,E.levels=[],E.currentTrackId=-1,E.tracksBuffered=[],E.mainDetails=null,E._registerListeners(),E}var v=C.prototype;return v.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},v._registerListeners=function(){var u=this.hls;u.on($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.on($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on($.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on($.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on($.Events.ERROR,this.onError,this),u.on($.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.on($.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),u.on($.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),u.on($.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),u.on($.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},v._unregisterListeners=function(){var u=this.hls;u.off($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.off($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off($.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off($.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off($.Events.ERROR,this.onError,this),u.off($.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.off($.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),u.off($.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),u.off($.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),u.off($.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},v.startLoad=function(){this.stopLoad(),this.state=x.State.IDLE,this.setInterval(l),this.tick()},v.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},v.onLevelLoaded=function(u,E){this.mainDetails=E.details},v.onSubtitleFragProcessed=function(u,E){var d=E.frag,f=E.success;if(this.fragPrevious=d,this.state=x.State.IDLE,!f)return;var s=this.tracksBuffered[this.currentTrackId];if(!s)return;for(var a,b=d.start,g=0;g<s.length;g++)if(b>=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<k.length;){if(k[H].end<=_){k.shift();continue}else if(k[H].start<_)k[H].start=_;else break;H++}}),this.fragmentTracker.removeFragmentsInRange(d,_,A.PlaylistLevelType.SUBTITLE)}},v.onError=function(u,E){var d,f=E.frag;if(!f||f.type!==A.PlaylistLevelType.SUBTITLE)return;(d=this.fragCurrent)!==null&&d!==void 0&&d.loader&&this.fragCurrent.loader.abort(),this.state=x.State.IDLE},v.onSubtitleTracksUpdated=function(u,E){var d=this,f=E.subtitleTracks;this.tracksBuffered=[],this.levels=f.map(function(s){return new P.Level(s)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(s){d.tracksBuffered[s.id]=[]}),this.mediaBuffer=null},v.onSubtitleTrackSwitch=function(u,E){if(this.currentTrackId=E.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var d=this.levels[this.currentTrackId];d!=null&&d.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,d&&this.setInterval(l)},v.onSubtitleTrackLoaded=function(u,E){var d,f=E.details,s=E.id,a=this.currentTrackId,b=this.levels;if(!b.length)return;var g=b[a];if(s>=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(_<G){var ce=a.maxFragLookUpTolerance;te&&f.hasProgramDateTime&&(B=Object(K.findFragmentByPDT)(z,te.endProgramDateTime,ce)),B||(B=Object(K.findFragmentByPTS)(te,z,_,ce),!B&&te&&te.start<z[0].start&&(B=z[0]))}else B=z[Z-1];(u=B)!==null&&u!==void 0&&u.encrypted?(U.logger.log("Loading key for "+B.sn),this.state=x.State.KEY_LOADING,this.hls.trigger($.Events.KEY_LOADING,{frag:B})):B&&this.fragmentTracker.getState(B)===L.FragmentState.NOT_LOADED&&this.loadFragment(B,f,_)}},v.loadFragment=function(u,E,d){this.fragCurrent=u,c.prototype.loadFragment.call(this,u,E,d)},S(C,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),C}(x.default)},"./src/controller/subtitle-track-controller.ts":function(oe,Y,D){"use strict";D.r(Y);var $=D("./src/events.ts"),U=D("./src/utils/texttrack-utils.ts"),I=D("./src/controller/base-playlist-controller.ts"),K=D("./src/types/loader.ts");function N(w,S){for(var T=0;T<S.length;T++){var h=S[T];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(w,h.key,h)}}function O(w,S,T){return S&&N(w.prototype,S),T&&N(w,T),w}function L(w,S){w.prototype=Object.create(S.prototype),w.prototype.constructor=w,x(w,S)}function x(w,S){return x=Object.setPrototypeOf||function(h,l){return h.__proto__=l,h},x(w,S)}var A=function(w){L(S,w);function S(h){var l;return l=w.call(this,h,"[subtitle-track-controller]")||this,l.media=null,l.tracks=[],l.groupId=null,l.tracksInGroup=[],l.trackId=-1,l.selectDefaultTrack=!0,l.queuedDefaultTrack=-1,l.trackChangeListener=function(){return l.onTextTracksChanged()},l.asyncPollTrackChange=function(){return l.pollTrackChange(0)},l.useTextTrackPolling=!1,l.subtitlePollingInterval=-1,l.subtitleDisplay=!0,l.registerListeners(),l}var T=S.prototype;return T.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,w.prototype.destroy.call(this)},T.registerListeners=function(){var l=this.hls;l.on($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.on($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on($.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on($.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.on($.Events.LEVEL_LOADING,this.onLevelLoading,this),l.on($.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.on($.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),l.on($.Events.ERROR,this.onError,this)},T.unregisterListeners=function(){var l=this.hls;l.off($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.off($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off($.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off($.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.off($.Events.LEVEL_LOADING,this.onLevelLoading,this),l.off($.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.off($.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),l.off($.Events.ERROR,this.onError,this)},T.onMediaAttached=function(l,i){if(this.media=i.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},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<i.length;c++){var C=i[c];if((!this.selectDefaultTrack||C.default)&&(!l||l===C.name))return C.id}return-1},T.onError=function(l,i){if(w.prototype.onError.call(this,l,i),i.fatal||!i.context)return;i.context.type===K.PlaylistContextType.SUBTITLE_TRACK&&i.context.id===this.trackId&&i.context.groupId===this.groupId&&this.retryLoadingOrFail(i)},T.loadPlaylist=function(l){var i=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(i)){var c=i.id,C=i.groupId,v=i.url;if(l)try{v=l.addDirectives(v)}catch(m){this.warn("Could not construct new URL with HLS Delivery Directives: "+m)}this.log("Loading subtitle playlist for id "+c),this.hls.trigger($.Events.SUBTITLE_TRACK_LOADING,{url:v,id:c,groupId:C,deliveryDirectives:l||null})}},T.toggleTrackModes=function(l){var i=this,c=this.media,C=this.subtitleDisplay,v=this.trackId;if(!c)return;var m=P(c.textTracks),u=m.filter(function(f){return f.groupId===i.groupId});if(l===-1)[].slice.call(m).forEach(function(f){f.mode="disabled"});else{var E=u[v];E&&(E.mode="disabled")}var d=u[l];d&&(d.mode=C?"showing":"hidden")},T.setSubtitleTrack=function(l,i){var c,C=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=l;return}if(this.trackId!==l&&this.toggleTrackModes(l),this.trackId===l&&(l===-1||(c=C[l])!==null&&c!==void 0&&c.details)||l<-1||l>=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<i.length;c++)if(i[c].mode==="hidden")l=c;else if(i[c].mode==="showing"){l=c;break}this.subtitleTrack!==l&&(this.subtitleTrack=l)},O(S,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(l){this.selectDefaultTrack=!1;var i=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(l,i)}}]),S}(I.default);function P(w){for(var S=[],T=0;T<w.length;T++){var h=w[T];h.kind==="subtitles"&&h.label&&S.push(w[T])}return S}Y.default=A},"./src/controller/timeline-controller.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"TimelineController",function(){return P});var $=D("./src/polyfills/number.ts"),U=D("./src/events.ts"),I=D("./src/utils/cea-608-parser.ts"),K=D("./src/utils/output-filter.ts"),N=D("./src/utils/webvtt-parser.ts"),O=D("./src/utils/texttrack-utils.ts"),L=D("./src/utils/imsc1-ttml-parser.ts"),x=D("./src/types/loader.ts"),A=D("./src/utils/logger.ts"),P=function(){function h(i){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=T(),this.captionsProperties=void 0,this.hls=i,this.config=i.config,this.Cues=i.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var c=new K.default(this,"textTrack1"),C=new K.default(this,"textTrack2"),v=new K.default(this,"textTrack3"),m=new K.default(this,"textTrack4");this.cea608Parser1=new I.default(1,c,C),this.cea608Parser2=new I.default(3,v,m)}i.on(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),i.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.on(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),i.on(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),i.on(U.Events.FRAG_LOADING,this.onFragLoading,this),i.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),i.on(U.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),i.on(U.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),i.on(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),i.on(U.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),i.on(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var l=h.prototype;return l.destroy=function(){var c=this.hls;c.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),c.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),c.off(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),c.off(U.Events.FRAG_LOADING,this.onFragLoading,this),c.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),c.off(U.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),c.off(U.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),c.off(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),c.off(U.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),c.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},l.addCues=function(c,C,v,m,u){for(var E=!1,d=u.length;d--;){var f=u[d],s=S(f[0],f[1],C,v);if(s>=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<C.textTracks.length;v++){var m=C.textTracks[v];if(m[c])return m}return null},l.createCaptionsTrack=function(c){this.config.renderTextTracksNatively?this.createNativeTrack(c):this.createNonNativeTrack(c)},l.createNativeTrack=function(c){if(this.captionsTracks[c])return;var C=this.captionsProperties,v=this.captionsTracks,m=this.media,u=C[c],E=u.label,d=u.languageCode,f=this.getExistingTrack(c);if(f)v[c]=f,Object(O.clearCurrentCues)(v[c]),Object(O.sendAddTrackEvent)(v[c],m);else{var s=this.createTextTrack("captions",E,d);s&&(s[c]=!0,v[c]=s)}},l.createNonNativeTrack=function(c){if(this.nonNativeCaptionsTracks[c])return;var C=this.captionsProperties[c];if(!C)return;var v=C.label,m={_id:c,label:v,kind:"captions",default:C.media?!!C.media.default:!1,closedCaptions:C.media};this.nonNativeCaptionsTracks[c]=m,this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[m]})},l.createTextTrack=function(c,C,v){var m=this.media;return m?m.addTextTrack(c,C,v):void 0},l.onMediaAttaching=function(c,C){this.media=C.media,this._cleanTracks()},l.onMediaDetaching=function(){var c=this.captionsTracks;Object.keys(c).forEach(function(C){Object(O.clearCurrentCues)(c[C]),delete c[C]}),this.nonNativeCaptionsTracks={}},l.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=T(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},l._cleanTracks=function(){var c=this.media;if(!c)return;var C=c.textTracks;if(C)for(var v=0;v<C.length;v++)Object(O.clearCurrentCues)(C[v])},l.onSubtitleTracksUpdated=function(c,C){var v=this;this.textTracks=[];var m=C.subtitleTracks||[],u=m.some(function(s){return s.textCodec===L.IMSC1_CODEC});if(this.config.enableWebVTT||u&&this.config.enableIMSC1){var E=this.tracks&&m&&this.tracks.length===m.length;if(this.tracks=m||[],this.config.renderTextTracksNatively){var d=this.media?this.media.textTracks:[];this.tracks.forEach(function(s,a){var b;if(a<d.length){for(var g=null,_=0;_<d.length;_++)if(w(d[_],s)){g=d[_];break}g&&(b=g)}b?Object(O.clearCurrentCues)(b):(b=v.createTextTrack("subtitles",s.name,s.lang),b&&(b.mode="disabled")),b&&(b.groupId=s.groupId,v.textTracks.push(b))})}else if(!E&&this.tracks&&this.tracks.length){var f=this.tracks.map(function(s){return{label:s.name,kind:s.type.toLowerCase(),default:s.default,subtitleTrack:s}});this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:f})}}},l.onManifestLoaded=function(c,C){var v=this;this.config.enableCEA708Captions&&C.captions&&C.captions.forEach(function(m){var u=/(?:CC|SERVICE)([1-4])/.exec(m.instreamId);if(!u)return;var E="textTrack"+u[1],d=v.captionsProperties[E];if(!d)return;d.label=m.name,m.lang&&(d.languageCode=m.lang),d.media=m})},l.onFragLoading=function(c,C){var v=this.cea608Parser1,m=this.cea608Parser2,u=this.lastSn,E=this.lastPartIndex;if(!this.enabled||!(v&&m))return;if(C.frag.type===x.PlaylistLevelType.MAIN){var d,f,s=C.frag.sn,a=(d=C==null||((f=C.part)===null||f===void 0)?void 0:f.index)!=null?d:-1;s===u+1||s===u&&a===E+1||(v.reset(),m.reset()),this.lastSn=s,this.lastPartIndex=a}},l.onFragLoaded=function(c,C){var v=C.frag,m=C.payload,u=this.initPTS,E=this.unparsedVttFrags;if(v.type===x.PlaylistLevelType.SUBTITLE)if(m.byteLength){if(!Object($.isFiniteNumber)(u[v.cc])){E.push(C),u.length&&this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:v,error:new Error("Missing initial subtitle PTS")});return}var d=v.decryptdata;if(d==null||d.key==null||d.method!=="AES-128"){var f=this.tracks[v.level],s=this.vttCCs;s[v.cc]||(s[v.cc]={start:v.start,prevCC:this.prevCC,new:!0},this.prevCC=v.cc),f&&f.textCodec===L.IMSC1_CODEC?this._parseIMSC1(v,m):this._parseVTTs(v,m,s)}}else this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:v,error:new Error("Empty subtitle payload")})},l._parseIMSC1=function(c,C){var v=this,m=this.hls;Object(L.parseIMSC1)(C,this.initPTS[c.cc],this.timescale[c.cc],function(u){v._appendCues(u,c.level),m.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:c})},function(u){A.logger.log("Failed to parse IMSC1: "+u),m.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:c,error:u})})},l._parseVTTs=function(c,C,v){var m=this,u=this.hls;Object(N.parseWebVTT)(C,this.initPTS[c.cc],this.timescale[c.cc],v,c.cc,c.start,function(E){m._appendCues(E,c.level),u.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:c})},function(E){m._fallbackToIMSC1(c,C),A.logger.log("Failed to parse VTT cue: "+E),u.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:c,error:E})})},l._fallbackToIMSC1=function(c,C){var v=this,m=this.tracks[c.level];m.textCodec||Object(L.parseIMSC1)(C,this.initPTS[c.cc],this.timescale[c.cc],function(){m.textCodec=L.IMSC1_CODEC,v._parseIMSC1(c,C)},function(){m.textCodec="wvtt"})},l._appendCues=function(c,C){var v=this.hls;if(this.config.renderTextTracksNatively){var m=this.textTracks[C];if(m.mode==="disabled")return;c.forEach(function(d){return Object(O.addCueToTrack)(m,d)})}else{var u=this.tracks[C],E=u.default?"default":"subtitles"+C;v.trigger(U.Events.CUES_PARSED,{type:"subtitles",cues:c,track:E})}},l.onFragDecrypted=function(c,C){var v=C.frag;if(v.type===x.PlaylistLevelType.SUBTITLE){if(!Object($.isFiniteNumber)(this.initPTS[v.cc])){this.unparsedVttFrags.push(C);return}this.onFragLoaded(U.Events.FRAG_LOADED,C)}},l.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},l.onFragParsingUserdata=function(c,C){var v=this.cea608Parser1,m=this.cea608Parser2;if(!this.enabled||!(v&&m))return;for(var u=0;u<C.samples.length;u++){var E=C.samples[u].bytes;if(E){var d=this.extractCea608Data(E);v.addData(C.samples[u].pts,d[0]),m.addData(C.samples[u].pts,d[1])}}},l.onBufferFlushing=function(c,C){var v=C.startOffset,m=C.endOffset,u=C.endOffsetSubtitles,E=C.type,d=this.media;if(!d||d.currentTime<m)return;if(!E||E==="video"){var f=this.captionsTracks;Object.keys(f).forEach(function(a){return Object(O.removeCuesInRange)(f[a],v,m)})}if(this.config.renderTextTracksNatively&&(v===0&&u!==void 0)){var s=this.textTracks;Object.keys(s).forEach(function(a){return Object(O.removeCuesInRange)(s[a],v,u)})}},l.extractCea608Data=function(c){for(var C=c[0]&31,v=2,m=[[],[]],u=0;u<C;u++){var E=c[v++],d=127&c[v++],f=127&c[v++],s=(4&E)!==0,a=3&E;if(d===0&&f===0)continue;s&&((a===0||a===1)&&(m[a].push(d),m[a].push(f)))}return m},h}();function w(h,l){return h&&h.label===l.name&&!(h.textTrack1||h.textTrack2)}function S(h,l,i,c){return Math.min(l,c)-Math.max(h,i)}function T(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return $});var $=function(){function U(K,N){this.subtle=void 0,this.aesIV=void 0,this.subtle=K,this.aesIV=N}var I=U.prototype;return I.decrypt=function(N,O){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},O,N)},U}()},"./src/crypt/aes-decryptor.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"removePadding",function(){return U}),D.d(Y,"default",function(){return I});var $=D("./src/utils/typed-array.ts");function U(K){var N=K.byteLength,O=N&&new DataView(K.buffer).getUint8(N-1);return O?Object($.sliceUint8)(K,0,N-O):K}var I=function(){function K(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var N=K.prototype;return N.uint8ArrayToUint32Array_=function(L){for(var x=new DataView(L),A=new Uint32Array(4),P=0;P<4;P++)A[P]=x.getUint32(P*4);return A},N.initTable=function(){var L=this.sBox,x=this.invSBox,A=this.subMix,P=A[0],w=A[1],S=A[2],T=A[3],h=this.invSubMix,l=h[0],i=h[1],c=h[2],C=h[3],v=new Uint32Array(256),m=0,u=0,E=0;for(E=0;E<256;E++)E<128?v[E]=E<<1:v[E]=E<<1^283;for(E=0;E<256;E++){var d=u^u<<1^u<<2^u<<3^u<<4;d=d>>>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<x.length&&A;)A=x[P]===this.key[P],P++;if(A)return;this.key=x;var w=this.keySize=x.length;if(w!==4&&w!==6&&w!==8)throw new Error("Invalid aes key size="+w);var S=this.ksRows=(w+6+1)*4,T,h,l=this.keySchedule=new Uint32Array(S),i=this.invKeySchedule=new Uint32Array(S),c=this.sBox,C=this.rcon,v=this.invSubMix,m=v[0],u=v[1],E=v[2],d=v[3],f,s;for(T=0;T<S;T++){if(T<w){f=l[T]=x[T];continue}s=f,T%w===0?(s=s<<8|s>>>24,s=c[s>>>24]<<24|c[s>>>16&255]<<16|c[s>>>8&255]<<8|c[s&255],s^=C[T/w|0]<<24):w>6&&T%w===4&&(s=c[s>>>24]<<24|c[s>>>16&255]<<16|c[s>>>8&255]<<8|c[s&255]),l[T]=f=(l[T-w]^s)>>>0}for(h=0;h<S;h++)T=S-h,h&3?s=l[T]:s=l[T-4],h<4||T<=4?i[h]=s:i[h]=m[c[s>>>24]]^u[c[s>>>16&255]]^E[c[s>>>8&255]]^d[c[s&255]],i[h]=i[h]>>>0},N.networkToHostOrderSwap=function(L){return L<<24|(L&65280)<<8|(L&16711680)>>8|L>>>24},N.decrypt=function(L,x,A){for(var P=this.keySize+6,w=this.invKeySchedule,S=this.invSBox,T=this.invSubMix,h=T[0],l=T[1],i=T[2],c=T[3],C=this.uint8ArrayToUint32Array_(A),v=C[0],m=C[1],u=C[2],E=C[3],d=new Int32Array(L),f=new Int32Array(d.length),s,a,b,g,_,k,H,z,Z,G,B,te,ce,pe,ye=this.networkToHostOrderSwap;x<d.length;){for(Z=ye(d[x]),G=ye(d[x+1]),B=ye(d[x+2]),te=ye(d[x+3]),_=Z^w[0],k=te^w[1],H=B^w[2],z=G^w[3],ce=4,pe=1;pe<P;pe++)s=h[_>>>24]^l[k>>16&255]^i[H>>8&255]^c[z&255]^w[ce],a=h[k>>>24]^l[H>>16&255]^i[z>>8&255]^c[_&255]^w[ce+1],b=h[H>>>24]^l[z>>16&255]^i[_>>8&255]^c[k&255]^w[ce+2],g=h[z>>>24]^l[_>>16&255]^i[k>>8&255]^c[H&255]^w[ce+3],_=s,k=a,H=b,z=g,ce=ce+4;s=S[_>>>24]<<24^S[k>>16&255]<<16^S[H>>8&255]<<8^S[z&255]^w[ce],a=S[k>>>24]<<24^S[H>>16&255]<<16^S[z>>8&255]<<8^S[_&255]^w[ce+1],b=S[H>>>24]<<24^S[z>>16&255]<<16^S[_>>8&255]<<8^S[k&255]^w[ce+2],g=S[z>>>24]<<24^S[_>>16&255]<<16^S[k>>8&255]<<8^S[H&255]^w[ce+3],f[x]=ye(s^v),f[x+1]=ye(g^m),f[x+2]=ye(b^u),f[x+3]=ye(a^E),v=Z,m=G,u=B,E=te,x=x+4}return f.buffer},K}()},"./src/crypt/decrypter.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return x});var $=D("./src/crypt/aes-crypto.ts"),U=D("./src/crypt/fast-aes-key.ts"),I=D("./src/crypt/aes-decryptor.ts"),K=D("./src/utils/logger.ts"),N=D("./src/utils/mp4-tools.ts"),O=D("./src/utils/typed-array.ts"),L=16,x=function(){function A(w,S,T){var h=T===void 0?{}:T,l=h.removePKCS7Padding,i=l===void 0?!0:l;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=w,this.config=S,this.removePKCS7Padding=i,i)try{var c=self.crypto;c&&(this.subtle=c.subtle||c.webkitSubtle)}catch(C){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var P=A.prototype;return P.destroy=function(){this.observer=null},P.isSync=function(){return this.config.enableSoftwareAES},P.flush=function(){var S=this.currentResult;if(!S){this.reset();return}var T=new Uint8Array(S);return this.reset(),this.removePKCS7Padding?Object(I.removePadding)(T):T},P.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},P.decrypt=function(S,T,h,l){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(S),T,h);var i=this.flush();i&&l(i.buffer)}else this.webCryptoDecrypt(new Uint8Array(S),T,h).then(l)},P.softwareDecrypt=function(S,T,h){var l=this.currentIV,i=this.currentResult,c=this.remainderData;this.logOnce("JS AES decrypt"),c&&(S=Object(N.appendUint8Array)(c,S),this.remainderData=null);var C=this.getValidChunk(S);if(!C.length)return null;l&&(h=l);var v=this.softwareDecrypter;v||(v=this.softwareDecrypter=new I.default),v.expandKey(T);var m=i;return this.currentResult=v.decrypt(C.buffer,0,h),this.currentIV=Object(O.sliceUint8)(C,-16).buffer,m||null},P.webCryptoDecrypt=function(S,T,h){var l=this,i=this.subtle;return(this.key!==T||!this.fastAesKey)&&(this.key=T,this.fastAesKey=new U.default(i,T)),this.fastAesKey.expandKey().then(function(c){if(!i)return Promise.reject(new Error("web crypto not initialized"));var C=new $.default(i,h);return C.decrypt(S.buffer,c)}).catch(function(c){return l.onWebCryptoError(c,S,T,h)})},P.onWebCryptoError=function(S,T,h,l){return K.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",S),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(T,h,l)},P.getValidChunk=function(S){var T=S,h=S.length-S.length%L;return h!==S.length&&(T=Object(O.sliceUint8)(S,0,h),this.remainderData=Object(O.sliceUint8)(S,h)),T},P.logOnce=function(S){if(!this.logEnabled)return;K.logger.log("[decrypter.ts]: "+S),this.logEnabled=!1},A}()},"./src/crypt/fast-aes-key.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return $});var $=function(){function U(K,N){this.subtle=void 0,this.key=void 0,this.subtle=K,this.key=N}var I=U.prototype;return I.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},U}()},"./src/demux/aacdemuxer.ts":function(oe,Y,D){"use strict";D.r(Y);var $=D("./src/demux/base-audio-demuxer.ts"),U=D("./src/demux/adts.ts"),I=D("./src/utils/logger.ts"),K=D("./src/demux/id3.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(w,S){var T;return T=x.call(this)||this,T.observer=void 0,T.config=void 0,T.observer=w,T.config=S,T}var P=A.prototype;return P.resetInitSegment=function(S,T,h){x.prototype.resetInitSegment.call(this,S,T,h),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:S,duration:h,inputTimeScale:9e4,dropped:0}},A.probe=function(S){if(!S)return!1;for(var T=K.getID3Data(S,0)||[],h=T.length,l=S.length;h<l;h++)if(U.probe(S,h))return I.logger.log("ADTS sync word found !"),!0;return!1},P.canParse=function(S,T){return U.canParse(S,T)},P.appendFrame=function(S,T,h){U.initTrackConfig(S,this.observer,T,h,S.manifestCodec);var l=U.appendFrame(S,T,h,this.initPTS,this.frameIndex);if(l&&l.missing===0)return l},A}($.default);L.minProbeByteLength=9,Y.default=L},"./src/demux/adts.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"getAudioConfig",function(){return K}),D.d(Y,"isHeaderPattern",function(){return N}),D.d(Y,"getHeaderLength",function(){return O}),D.d(Y,"getFullFrameLength",function(){return L}),D.d(Y,"canGetFrameLength",function(){return x}),D.d(Y,"isHeader",function(){return A}),D.d(Y,"canParse",function(){return P}),D.d(Y,"probe",function(){return w}),D.d(Y,"initTrackConfig",function(){return S}),D.d(Y,"getFrameDuration",function(){return T}),D.d(Y,"parseFrameHeader",function(){return h}),D.d(Y,"appendFrame",function(){return l});var $=D("./src/utils/logger.ts"),U=D("./src/errors.ts"),I=D("./src/events.ts");function K(i,c,C,v){var m,u,E,d,f=navigator.userAgent.toLowerCase(),s=v,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];m=((c[C+2]&192)>>>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}function A(i,c){return c+1<i.length&&N(i,c)}function P(i,c){return x(i,c)&&N(i,c)&&L(i,c)<=i.length-c}function w(i,c){if(A(i,c)){var C=O(i,c);if(c+C>=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;h<m;){if(this.canParse(w,h)){var u=this.appendFrame(c,w,h);u?(this.frameIndex++,i=u.sample.pts,h+=u.length,l=h):h=m}else U.canParse(w,h)?(T=U.getID3Data(w,h),C.samples.push({pts:i,dts:i,data:T}),h+=T.length,l=h):h++;if(h===m&&l!==m){var E=Object(N.sliceUint8)(w,l);this.cachedData?this.cachedData=Object(K.appendUint8Array)(this.cachedData,E):this.cachedData=E}}return{audioTrack:c,avcTrack:Object(I.dummyTrack)(),id3Track:C,textTrack:Object(I.dummyTrack)()}},A.demuxSampleAes=function(w,S,T){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},A.flush=function(w){var S=this.cachedData;return S&&(this.cachedData=null,this.demux(S,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(I.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(I.dummyTrack)()}},A.destroy=function(){},x}(),L=function(A,P){return Object($.isFiniteNumber)(A)?A*90:P*9e4};Y.default=O},"./src/demux/chunk-cache.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return $});var $=function(){function I(){this.chunks=[],this.dataLength=0}var K=I.prototype;return K.push=function(O){this.chunks.push(O),this.dataLength+=O.length},K.flush=function(){var O=this.chunks,L=this.dataLength,x;if(O.length)O.length===1?x=O[0]:x=U(O,L);else return new Uint8Array(0);return this.reset(),x},K.reset=function(){this.chunks.length=0,this.dataLength=0},I}();function U(I,K){for(var N=new Uint8Array(K),O=0,L=0;L<I.length;L++){var x=I[L];N.set(x,O),O+=x.length}return N}},"./src/demux/dummy-demuxed-track.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"dummyTrack",function(){return $});function $(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(oe,Y,D){"use strict";D.r(Y);var $=D("./src/utils/logger.ts"),U=function(){function I(N){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=N,this.bytesAvailable=N.byteLength,this.word=0,this.bitsAvailable=0}var K=I.prototype;return K.loadWord=function(){var O=this.data,L=this.bytesAvailable,x=O.byteLength-L,A=new Uint8Array(4),P=Math.min(4,L);if(P===0)throw new Error("no bytes available");A.set(O.subarray(x,x+P)),this.word=new DataView(A.buffer).getUint32(0),this.bitsAvailable=P*8,this.bytesAvailable-=P},K.skipBits=function(O){var L;this.bitsAvailable>O?(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<<L|this.readBits(L):x},K.skipLZ=function(){var O;for(O=0;O<this.bitsAvailable;++O)if((this.word&2147483648>>>O)!==0)return this.word<<=O,this.bitsAvailable-=O,O;return this.loadWord(),O+this.skipLZ()},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;P<O;P++)x!==0&&(A=this.readEG(),x=(L+A+256)%256),L=x===0?L:x},K.readSPS=function(){var O=0,L=0,x=0,A=0,P,w,S,T=this.readUByte.bind(this),h=this.readBits.bind(this),l=this.readUEG.bind(this),i=this.readBoolean.bind(this),c=this.skipBits.bind(this),C=this.skipEG.bind(this),v=this.skipUEG.bind(this),m=this.skipScalingList.bind(this);T();var u=T();if(h(5),c(3),T(),v(),u===100||u===110||u===122||u===244||u===44||u===83||u===86||u===118||u===128){var E=l();if(E===3&&c(1),v(),v(),c(1),i())for(w=E!==3?8:12,S=0;S<w;S++)i()&&(S<6?m(16):m(64))}v();var d=l();if(d===0)l();else if(d===1)for(c(1),C(),C(),P=l(),S=0;S<P;S++)C();v(),c(1);var f=l(),s=l(),a=h(1);a===0&&c(1),c(1),i()&&(O=l(),L=l(),x=l(),A=l());var b=[1,1];if(i()&&i()){var g=T();switch(g){case 1:b=[1,1];break;case 2:b=[12,11];break;case 3:b=[10,11];break;case 4:b=[16,11];break;case 5:b=[40,33];break;case 6:b=[24,11];break;case 7:b=[20,11];break;case 8:b=[32,11];break;case 9:b=[80,33];break;case 10:b=[18,11];break;case 11:b=[15,11];break;case 12:b=[64,33];break;case 13:b=[160,99];break;case 14:b=[4,3];break;case 15:b=[3,2];break;case 16:b=[2,1];break;case 255:{b=[T()<<8|T(),T()<<8|T()];break}}}return{width:Math.ceil((f+1)*16-O*2-L*2),height:(2-a)*(s+1)*16-(a?2:4)*(x+A),pixelRatio:b}},K.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},I}();Y.default=U},"./src/demux/id3.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"isHeader",function(){return $}),D.d(Y,"isFooter",function(){return U}),D.d(Y,"getID3Data",function(){return I}),D.d(Y,"canParse",function(){return N}),D.d(Y,"getTimeStamp",function(){return O}),D.d(Y,"isTimeStampFrame",function(){return L}),D.d(Y,"getID3Frames",function(){return A}),D.d(Y,"decodeFrame",function(){return P}),D.d(Y,"utf8ArrayToStr",function(){return l}),D.d(Y,"testables",function(){return i});var $=function(m,u){return u+10<=m.length&&(m[u]===73&&m[u+1]===68&&m[u+2]===51&&(m[u+3]<255&&m[u+4]<255&&(m[u+6]<128&&m[u+7]<128&&m[u+8]<128&&m[u+9]<128)))},U=function(m,u){return u+10<=m.length&&(m[u]===51&&m[u+1]===68&&m[u+2]===73&&(m[u+3]<255&&m[u+4]<255&&(m[u+6]<128&&m[u+7]<128&&m[u+8]<128&&m[u+9]<128)))},I=function(m,u){for(var E=u,d=0;$(m,u);){d+=10;var f=K(m,u+6);d+=f,U(m,u+10)&&(d+=10),u+=d}return d>0?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<u.length;E++){var d=u[E];if(L(d))return h(d)}return},L=function(m){return m&&m.key==="PRIV"&&m.info==="com.apple.streaming.transportStreamTimestamp"},x=function(m){var u=String.fromCharCode(m[0],m[1],m[2],m[3]),E=K(m,4),d=10;return{type:u,size:E,data:m.subarray(d,d+E)}},A=function(m){for(var u=0,E=[];$(m,u);){var d=K(m,u+6);u+=10;for(var f=u+d;u+8<f;){var s=x(m.subarray(u)),a=P(s);a&&E.push(a),u+=s.size+10}U(m,u)&&(u+=10)}return E},P=function(m){return m.type==="PRIV"?w(m):m.type[0]==="W"?T(m):S(m)},w=function(m){if(m.size<2)return;var u=l(m.data,!0),E=new Uint8Array(m.data.subarray(u.length+1));return{key:m.type,info:u,data:E.buffer}},S=function(m){if(m.size<2)return;if(m.type==="TXXX"){var u=1,E=l(m.data.subarray(u),!0);u+=E.length+1;var d=l(m.data.subarray(u));return{key:m.type,info:E,data:d}}var f=l(m.data.subarray(1));return{key:m.type,data:f}},T=function(m){if(m.type==="WXXX"){if(m.size<2)return;var u=1,E=l(m.data.subarray(u),!0);u+=E.length+1;var d=l(m.data.subarray(u));return{key:m.type,info:E,data:d}}var f=l(m.data);return{key:m.type,data:f}},h=function(m){if(m.data.byteLength===8){var u=new Uint8Array(m.data),E=u[3]&1,d=(u[4]<<23)+(u[5]<<15)+(u[6]<<7)+u[7];return d/=45,E&&(d+=4772185884e-2),Math.round(d)}return},l=function(m,u){u===void 0&&(u=!1);var E=C();if(E){var d=E.decode(m);if(u){var f=d.indexOf("\0");return f!==-1?d.substring(0,f):d}return d.replace(/\0/g,"")}for(var s=m.length,a,b,g,_="",k=0;k<s;){if(a=m[k++],a===0&&u)return _;if(a===0||a===3)continue;switch(a>>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;h<l;h++)if(K.probe(S,h))return I.logger.log("MPEG Audio sync word found !"),!0;return!1},P.canParse=function(S,T){return K.canParse(S,T)},P.appendFrame=function(S,T,h){return this.initPTS===null?void 0:K.appendFrame(S,T,h,this.initPTS,this.frameIndex)},A}($.default);L.minProbeByteLength=4,Y.default=L},"./src/demux/mp4demuxer.ts":function(oe,Y,D){"use strict";D.r(Y);var $=D("./src/utils/mp4-tools.ts"),U=D("./src/demux/dummy-demuxed-track.ts"),I=function(){function K(O,L){this.remainderData=null,this.config=void 0,this.config=L}var N=K.prototype;return N.resetTimeStamp=function(){},N.resetInitSegment=function(){},N.resetContiguity=function(){},K.probe=function(L){return Object($.findBox)({data:L,start:0,end:Math.min(L.length,16384)},["moof"]).length>0},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<S.length&&x(S,T)}function P(S,T){var h=4;return x(S,T)&&h<=S.length-T}function w(S,T){if(T+1<S.length&&x(S,T)){var h=4,l=L(S,T),i=h;l!=null&&l.frameLength&&(i=l.frameLength);var c=T+i;return c===S.length||A(S,c)}return!1}},"./src/demux/sample-aes.ts":function(oe,Y,D){"use strict";D.r(Y);var $=D("./src/crypt/decrypter.ts"),U=D("./src/demux/tsdemuxer.ts"),I=function(){function K(O,L,x){this.keyData=void 0,this.decrypter=void 0,this.keyData=x,this.decrypter=new $.default(O,L,{removePKCS7Padding:!1})}var N=K.prototype;return N.decryptBuffer=function(L,x){this.decrypter.decrypt(L,this.keyData.key.buffer,this.keyData.iv.buffer,x)},N.decryptAacSample=function(L,x,A,P){var w=L[x].unit,S=w.subarray(16,w.length-w.length%16),T=S.buffer.slice(S.byteOffset,S.byteOffset+S.length),h=this;this.decryptBuffer(T,function(l){var i=new Uint8Array(l);w.set(i,16),P||h.decryptAacSamples(L,x+1,A)})},N.decryptAacSamples=function(L,x,A){for(;;x++){if(x>=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;ce<pe;ce++)if(h[ce].demux.probe(s)){te=h[ce];break}te||(S.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),te={demux:N.default,remux:A.default});var ye=this.demuxer,Ce=this.remuxer,_e=te.remux,le=te.demux;(!Ce||!(Ce instanceof _e))&&(this.remuxer=new _e(g,b,_,k)),(!ye||!(ye instanceof le))&&(this.demuxer=new le(g,b,_),this.probe=le.probe),this.resetInitSegment(G,H,B,Z),this.resetInitialTimestamp(z)},d.needsProbing=function(s,a,b){return!this.demuxer||!this.remuxer||a||b},d.getDecrypter=function(){var s=this.decrypter;return s||(s=this.decrypter=new I.default(this.observer,this.config)),s},E}();function c(E,d){var f=null;return E.byteLength>0&&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<d;){if(E[f]===71&&E[f+188]===71&&E[f+2*188]===71)return f;f++}return-1},v.createTrack=function(E,d){return{container:E==="video"||E==="audio"?"video/mp2t":void 0,type:E,id:P[E],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:E==="audio"?d:void 0}};var m=v.prototype;return m.resetInitSegment=function(E,d,f){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=v.createTrack("video",f),this._audioTrack=v.createTrack("audio",f),this._id3Track=v.createTrack("id3",f),this._txtTrack=v.createTrack("text",f),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=E,this.videoCodec=d,this._duration=f},m.resetTimeStamp=function(){},m.resetContiguity=function(){var E=this._audioTrack,d=this._avcTrack,f=this._id3Track;E&&(E.pesData=null),d&&(d.pesData=null),f&&(f.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},m.demux=function(E,d,f,s){f===void 0&&(f=!1),s===void 0&&(s=!1),f||(this.sampleAes=null);var a,b=this._avcTrack,g=this._audioTrack,_=this._id3Track,k=b.pid,H=b.pesData,z=g.pid,Z=_.pid,G=g.pesData,B=_.pesData,te=!1,ce=this.pmtParsed,pe=this._pmtId,ye=E.length;if(this.remainderData&&(E=Object(L.appendUint8Array)(this.remainderData,E),ye=E.length,this.remainderData=null),ye<188&&!s)return this.remainderData=E,{audioTrack:g,avcTrack:b,id3Track:_,textTrack:this._txtTrack};var Ce=Math.max(0,v.syncOffset(E));ye-=(ye+Ce)%188,ye<E.byteLength&&!s&&(this.remainderData=new Uint8Array(E.buffer,ye,E.buffer.byteLength-ye));for(var _e=Ce;_e<ye;_e+=188)if(E[_e]===71){var le=!!(E[_e+1]&64),se=((E[_e+1]&31)<<8)+E[_e+2],ge=(E[_e+3]&48)>>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;Ee<ie;Ee++)q.push(G.readUByte()),q.push(G.readUByte()),q.push(G.readUByte());c(f._txtTrack.samples,{type:3,pts:E.pts,bytes:q})}}}}}else if(B===5&&G.bytesAvailable!==0){if(ce=!0,te>16){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<De;Ae++)Be[Ae]=G.readUByte();c(f._txtTrack.samples,{pts:E.pts,payloadType:B,uuid:Me.join(""),userData:Object(K.utf8ArrayToStr)(Be),userDataBytes:Be})}}else if(te<G.bytesAvailable)for(var Pe=0;Pe<te;Pe++)G.readUByte()}break}case 7:if(_=!0,k=!0,b&&g&&(g.debug+="SPS "),!s.sps){var Fe=new I.default(H.data),ze=Fe.readSPS();s.width=ze.width,s.height=ze.height,s.pixelRatio=ze.pixelRatio,s.sps=[H.data],s.duration=f._duration;for(var qe=H.data.subarray(1,4),He="avc1.",Oe=0;Oe<3;Oe++){var lt=qe[Oe].toString(16);lt.length<2&&(lt="0"+lt),He+=lt}s.codec=He}break;case 8:_=!0,b&&g&&(g.debug+="PPS "),s.pps||(s.pps=[H.data]);break;case 9:_=!1,s.audFound=!0,g&&i(g,s),g=f.avcSample=S(!1,E.pts,E.dts,b?"AUD ":"");break;case 12:_=!1;break;default:_=!1,g&&(g.debug+="unknown NAL "+H.type+" ");break}if(g&&_){var tt=g.units;tt.push(H)}}),d&&g&&(i(g,s),this.avcSample=null)},m.getLastNalUnit=function(){var E,d=this.avcSample,f;if(!d||d.units.length===0){var s=this._avcTrack.samples;d=s[s.length-1]}if((E=d)!==null&&E!==void 0&&E.units){var a=d.units;f=a[a.length-1]}return f},m.parseAVCNALu=function(E){var d=E.byteLength,f=this._avcTrack,s=f.naluState||0,a=s,b=[],g=0,_,k,H,z=-1,Z=0;for(s===-1&&(z=0,Z=E[0]&31,s=0,g=1);g<d;){if(_=E[g++],!s){s=_?0:1;continue}if(s===1){s=_?0:2;continue}if(!_)s=3;else if(_===1){if(z>=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<d?(H=E[g]&31,z=g,Z=H,s=0):s=-1}else s=0}if(z>=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;k<H-1&&!$.isHeader(a,k);k++);if(k!==d){var z,Z;if(k<H-1?(z="AAC PES did not start with ADTS header,offset:"+k,Z=!1):(z="no ADTS header found in AAC PES",Z=!0),x.logger.warn("parsing error:"+z),this.observer.emit(O.Events.ERROR,O.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:Z,reason:z}),Z)return}$.initTrackConfig(f,this.observer,a,k,this.audioCodec);var G;if(E.pts!==void 0)G=E.pts;else if(s){var B=$.getFrameDuration(f.samplerate);G=s.sample.pts+B}else{x.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var te=0;k<H;)if($.isHeader(a,k)){if(k+5<H){var ce=$.appendFrame(f,a,k,G,te);if(ce)if(ce.missing)this.aacOverFlow=ce;else{k+=ce.length,te++;continue}}break}else k++},m.parseMPEGPES=function(E){var d=E.data,f=d.length,s=0,a=0,b=E.pts;if(b===void 0){x.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<f;)if(U.isHeader(d,a)){var g=U.appendFrame(this._audioTrack,d,a,b,s);if(g)a+=g.length,s++;else break}else a++},m.parseID3PES=function(E){if(E.pts===void 0){x.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(E)},v}();w.minProbeByteLength=188;function S(v,m,u,E){return{key:v,frame:!1,pts:m,dts:u,units:[],debug:E,length:0}}function T(v,m){return(v[m+10]&31)<<8|v[m+11]}function h(v,m,u,E){var d={audio:-1,avc:-1,id3:-1,isAAC:!0},f=(v[m+1]&15)<<8|v[m+2],s=m+3+f-4,a=(v[m+10]&15)<<8|v[m+11];for(m+=12+a;m<s;){var b=(v[m+1]&31)<<8|v[m+2];switch(v[m]){case 207:if(!E){x.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:d.audio===-1&&(d.audio=b);break;case 21:d.id3===-1&&(d.id3=b);break;case 219:if(!E){x.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:d.avc===-1&&(d.avc=b);break;case 3:case 4:u?d.audio===-1&&(d.audio=b,d.isAAC=!1):x.logger.log("MPEG audio found, not supported in this browser");break;case 36:x.logger.warn("Unsupported HEVC stream type found");break;default:break}m+=((v[m+3]&15)<<8|v[m+4])+5}return d}function l(v){var m=0,u,E,d,f,s,a=v.data;if(!v||v.size===0)return null;for(;a[0].length<19&&a.length>1;){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;z<Z;z++){u=a[z];var G=u.byteLength;if(k)if(k>G){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.pts<v[E].pts){v.splice(E,0,m);break}}else v.push(m)}function C(v){for(var m=v.byteLength,u=[],E=1;E<m-2;)v[E]===0&&v[E+1]===0&&v[E+2]===3?(u.push(E+2),E+=2):E++;if(u.length===0)return v;var d=m-u.length,f=new Uint8Array(d),s=0;for(E=0;E<d;s++,E++)s===u[0]&&(s++,u.shift()),f[E]=v[s];return f}Y.default=w},"./src/errors.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"ErrorTypes",function(){return $}),D.d(Y,"ErrorDetails",function(){return U});var $;(function(I){I.NETWORK_ERROR="networkError",I.MEDIA_ERROR="mediaError",I.KEY_SYSTEM_ERROR="keySystemError",I.MUX_ERROR="muxError",I.OTHER_ERROR="otherError"})($||($={}));var U;(function(I){I.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",I.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",I.KEY_SYSTEM_NO_SESSION="keySystemNoSession",I.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",I.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",I.MANIFEST_LOAD_ERROR="manifestLoadError",I.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",I.MANIFEST_PARSING_ERROR="manifestParsingError",I.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",I.LEVEL_EMPTY_ERROR="levelEmptyError",I.LEVEL_LOAD_ERROR="levelLoadError",I.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",I.LEVEL_SWITCH_ERROR="levelSwitchError",I.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",I.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",I.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",I.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",I.FRAG_LOAD_ERROR="fragLoadError",I.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",I.FRAG_DECRYPT_ERROR="fragDecryptError",I.FRAG_PARSING_ERROR="fragParsingError",I.REMUX_ALLOC_ERROR="remuxAllocError",I.KEY_LOAD_ERROR="keyLoadError",I.KEY_LOAD_TIMEOUT="keyLoadTimeOut",I.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",I.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",I.BUFFER_APPEND_ERROR="bufferAppendError",I.BUFFER_APPENDING_ERROR="bufferAppendingError",I.BUFFER_STALLED_ERROR="bufferStalledError",I.BUFFER_FULL_ERROR="bufferFullError",I.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",I.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",I.INTERNAL_EXCEPTION="internalException",I.INTERNAL_ABORTED="aborted",I.UNKNOWN="unknown"})(U||(U={}))},"./src/events.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"Events",function(){return $});var $;(function(U){U.MEDIA_ATTACHING="hlsMediaAttaching",U.MEDIA_ATTACHED="hlsMediaAttached",U.MEDIA_DETACHING="hlsMediaDetaching",U.MEDIA_DETACHED="hlsMediaDetached",U.BUFFER_RESET="hlsBufferReset",U.BUFFER_CODECS="hlsBufferCodecs",U.BUFFER_CREATED="hlsBufferCreated",U.BUFFER_APPENDING="hlsBufferAppending",U.BUFFER_APPENDED="hlsBufferAppended",U.BUFFER_EOS="hlsBufferEos",U.BUFFER_FLUSHING="hlsBufferFlushing",U.BUFFER_FLUSHED="hlsBufferFlushed",U.MANIFEST_LOADING="hlsManifestLoading",U.MANIFEST_LOADED="hlsManifestLoaded",U.MANIFEST_PARSED="hlsManifestParsed",U.LEVEL_SWITCHING="hlsLevelSwitching",U.LEVEL_SWITCHED="hlsLevelSwitched",U.LEVEL_LOADING="hlsLevelLoading",U.LEVEL_LOADED="hlsLevelLoaded",U.LEVEL_UPDATED="hlsLevelUpdated",U.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",U.LEVELS_UPDATED="hlsLevelsUpdated",U.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",U.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",U.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",U.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",U.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",U.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",U.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",U.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",U.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",U.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",U.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",U.CUES_PARSED="hlsCuesParsed",U.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",U.INIT_PTS_FOUND="hlsInitPtsFound",U.FRAG_LOADING="hlsFragLoading",U.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",U.FRAG_LOADED="hlsFragLoaded",U.FRAG_DECRYPTED="hlsFragDecrypted",U.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",U.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",U.FRAG_PARSING_METADATA="hlsFragParsingMetadata",U.FRAG_PARSED="hlsFragParsed",U.FRAG_BUFFERED="hlsFragBuffered",U.FRAG_CHANGED="hlsFragChanged",U.FPS_DROP="hlsFpsDrop",U.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",U.ERROR="hlsError",U.DESTROYING="hlsDestroying",U.KEY_LOADING="hlsKeyLoading",U.KEY_LOADED="hlsKeyLoaded",U.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",U.BACK_BUFFER_REACHED="hlsBackBufferReached"})($||($={}))},"./src/hls.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return v});var $=D("./node_modules/url-toolkit/src/url-toolkit.js"),U=D.n($),I=D("./src/loader/playlist-loader.ts"),K=D("./src/loader/key-loader.ts"),N=D("./src/controller/id3-track-controller.ts"),O=D("./src/controller/latency-controller.ts"),L=D("./src/controller/level-controller.ts"),x=D("./src/controller/fragment-tracker.ts"),A=D("./src/controller/stream-controller.ts"),P=D("./src/is-supported.ts"),w=D("./src/utils/logger.ts"),S=D("./src/config.ts"),T=D("./node_modules/eventemitter3/index.js"),h=D.n(T),l=D("./src/events.ts"),i=D("./src/errors.ts");function c(m,u){for(var E=0;E<u.length;E++){var d=u[E];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(m,d.key,d)}}function C(m,u,E){return u&&c(m.prototype,u),E&&c(m,E),m}var v=function(){m.isSupported=function(){return Object(P.isSupported)()};function m(E){E===void 0&&(E={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new T.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var d=this.config=Object(S.mergeConfig)(m.DefaultConfig,E);this.userConfig=E,Object(w.enableLogs)(d.debug),this._autoLevelCapping=-1,d.progressive&&Object(S.enableStreamingMode)(d);var f=d.abrController,s=d.bufferController,a=d.capLevelController,b=d.fpsController,g=this.abrController=new f(this),_=this.bufferController=new s(this),k=this.capLevelController=new a(this),H=new b(this),z=new I.default(this),Z=new K.default(this),G=new N.default(this),B=this.levelController=new L.default(this),te=new x.FragmentTracker(this),ce=this.streamController=new A.default(this,te);k.setStreamController(ce),H.setStreamController(ce);var pe=[B,ce];this.networkControllers=pe;var ye=[z,Z,g,_,k,H,G,te];this.audioTrackController=this.createController(d.audioTrackController,null,pe),this.createController(d.audioStreamController,te,pe),this.subtitleTrackController=this.createController(d.subtitleTrackController,null,pe),this.createController(d.subtitleStreamController,te,pe),this.createController(d.timelineController,null,ye),this.emeController=this.createController(d.emeController,null,ye),this.cmcdController=this.createController(d.cmcdController,null,ye),this.latencyController=this.createController(O.default,null,ye),this.coreComponents=ye}var u=m.prototype;return u.createController=function(d,f,s){if(d){var a=f?new d(this,f):new d(this);return s&&s.push(a),a}return null},u.on=function(d,f,s){s===void 0&&(s=this),this._emitter.on(d,f,s)},u.once=function(d,f,s){s===void 0&&(s=this),this._emitter.once(d,f,s)},u.removeAllListeners=function(d){this._emitter.removeAllListeners(d)},u.off=function(d,f,s,a){s===void 0&&(s=this),this._emitter.off(d,f,s,a)},u.listeners=function(d){return this._emitter.listeners(d)},u.emit=function(d,f,s){return this._emitter.emit(d,f,s)},u.trigger=function(d,f){if(this.config.debug)return this.emit(d,d,f);try{return this.emit(d,d,f)}catch(s){w.logger.error("An internal error happened while handling event "+d+'. Error message: "'+s.message+'". Here is a stacktrace:',s),this.trigger(l.Events.ERROR,{type:i.ErrorTypes.OTHER_ERROR,details:i.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:d,error:s})}return!1},u.listenerCount=function(d){return this._emitter.listenerCount(d)},u.destroy=function(){w.logger.log("destroy"),this.trigger(l.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(d){return d.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(d){return d.destroy()}),this.coreComponents.length=0},u.attachMedia=function(d){w.logger.log("attachMedia"),this._media=d,this.trigger(l.Events.MEDIA_ATTACHING,{media:d})},u.detachMedia=function(){w.logger.log("detachMedia"),this.trigger(l.Events.MEDIA_DETACHING,void 0),this._media=null},u.loadSource=function(d){this.stopLoad();var f=this.media,s=this.url,a=this.url=$.buildAbsoluteURL(self.location.href,d,{alwaysNormalize:!0});w.logger.log("loadSource:"+a),f&&s&&s!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(f)),this.trigger(l.Events.MANIFEST_LOADING,{url:d})},u.startLoad=function(d){d===void 0&&(d=-1),w.logger.log("startLoad("+d+")"),this.networkControllers.forEach(function(f){f.startLoad(d)})},u.stopLoad=function(){w.logger.log("stopLoad"),this.networkControllers.forEach(function(d){d.stopLoad()})},u.swapAudioCodec=function(){w.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},u.recoverMediaError=function(){w.logger.log("recoverMediaError");var d=this._media;this.detachMedia(),d&&this.attachMedia(d)},u.removeLevel=function(d,f){f===void 0&&(f=0),this.levelController.removeLevel(d,f)},C(m,[{key:"levels",get:function(){var d=this.levelController.levels;return d||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(d){w.logger.log("set currentLevel:"+d),this.loadLevel=d,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(d){w.logger.log("set nextLevel:"+d),this.levelController.manualLevel=d,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(d){w.logger.log("set loadLevel:"+d),this.levelController.manualLevel=d}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(d){this.levelController.nextLoadLevel=d}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(d){w.logger.log("set firstLevel:"+d),this.levelController.firstLevel=d}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(d){w.logger.log("set startLevel:"+d),d!==-1&&(d=Math.max(d,this.minAutoLevel)),this.levelController.startLevel=d}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(d){var f=!!d;f!==this.config.capLevelToPlayerSize&&(f?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=f)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(d){this._autoLevelCapping!==d&&(w.logger.log("set autoLevelCapping:"+d),this._autoLevelCapping=d)}},{key:"bandwidthEstimate",get:function(){var d=this.abrController.bwEstimator;return d?d.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var d=this.levels,f=this.config.minAutoBitrate;if(!d)return 0;for(var s=d.length,a=0;a<s;a++)if(d[a].maxBitrate>f)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<C;m++)v[m-1]=arguments[m];return c=h.call.apply(h,[this].concat(v))||this,c.data=void 0,c.data=i,c}return l}(K(Error))},"./src/loader/fragment.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"ElementaryStreamTypes",function(){return w}),D.d(Y,"BaseSegment",function(){return S}),D.d(Y,"Fragment",function(){return T}),D.d(Y,"Part",function(){return h});var $=D("./src/polyfills/number.ts"),U=D("./node_modules/url-toolkit/src/url-toolkit.js"),I=D.n(U),K=D("./src/utils/logger.ts"),N=D("./src/loader/level-key.ts"),O=D("./src/loader/load-stats.ts");function L(l,i){l.prototype=Object.create(i.prototype),l.prototype.constructor=l,x(l,i)}function x(l,i){return x=Object.setPrototypeOf||function(C,v){return C.__proto__=v,C},x(l,i)}function A(l,i){for(var c=0;c<i.length;c++){var C=i[c];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(l,C.key,C)}}function P(l,i,c){return i&&A(l.prototype,i),c&&A(l,c),l}var w;(function(l){l.AUDIO="audio",l.VIDEO="video",l.AUDIOVIDEO="audiovideo"})(w||(w={}));var S=function(){function l(c){var C;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(C={},C[w.AUDIO]=null,C[w.VIDEO]=null,C[w.AUDIOVIDEO]=null,C),this.baseurl=c}var i=l.prototype;return i.setByteRange=function(C,v){var m=C.split("@",2),u=[];m.length===1?u[0]=v?v.byteRangeEndOffset:0:u[0]=parseInt(m[1]),u[1]=parseInt(m[0])+u[0],this._byteRange=u},P(l,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(U.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(C){this._url=C}}]),l}(),T=function(l){L(i,l);function i(C,v){var m;return m=l.call(this,v)||this,m._decryptdata=null,m.rawProgramDateTime=null,m.programDateTime=null,m.tagList=[],m.duration=0,m.sn=0,m.levelkey=void 0,m.type=void 0,m.loader=null,m.level=-1,m.cc=0,m.startPTS=void 0,m.endPTS=void 0,m.appendedPTS=void 0,m.startDTS=void 0,m.endDTS=void 0,m.start=0,m.deltaPTS=void 0,m.maxStartPTS=void 0,m.minEndPTS=void 0,m.stats=new O.LoadStats,m.urlId=0,m.data=void 0,m.bitrateTest=!1,m.title=null,m.initSegment=null,m.type=C,m}var c=i.prototype;return c.createInitializationVector=function(v){for(var m=new Uint8Array(16),u=12;u<16;u++)m[u]=v>>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;x<L.length;x++){var A=L[x];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(O,A.key,A)}}function I(O,L,x){return L&&U(O.prototype,L),x&&U(O,x),O}var K=10,N=function(){function O(x){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=x}var L=O.prototype;return L.reloaded=function(A){if(!A){this.advanced=!0,this.updated=!0;return}var P=this.lastPartSn-A.lastPartSn,w=this.lastPartIndex-A.lastPartIndex;this.updated=this.endSN!==A.endSN||!!w||!!P,this.advanced=this.endSN>A.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;x<L.length;x++){var A=L[x];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(O,A.key,A)}}function K(O,L,x){return L&&I(O.prototype,L),x&&I(O,x),O}var N=function(){O.fromURL=function(x,A){return new O(x,A)},O.fromURI=function(x){return new O(x)};function O(L,x){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,x?this._uri=Object($.buildAbsoluteURL)(L,x,{alwaysNormalize:!0}):this._uri=L}return K(O,[{key:"uri",get:function(){return this._uri}}]),O}()},"./src/loader/load-stats.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"LoadStats",function(){return $});var $=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return i});var $=D("./src/polyfills/number.ts"),U=D("./node_modules/url-toolkit/src/url-toolkit.js"),I=D.n(U),K=D("./src/loader/fragment.ts"),N=D("./src/loader/level-details.ts"),O=D("./src/loader/level-key.ts"),L=D("./src/utils/attr-list.ts"),x=D("./src/utils/logger.ts"),A=D("./src/utils/codecs.ts"),P=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,w=/#EXT-X-MEDIA:(.*)/g,S=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),T=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),h=/\.(mp4|m4s|m4v|m4a)$/i;function l(u){var E,d;return h.test((E=(d=U.parseURL(u))===null||d===void 0?void 0:d.path)!=null?E:"")}var i=function(){function u(){}return u.findGroup=function(d,f){for(var s=0;s<d.length;s++){var a=d[s];if(a.id===f)return a}},u.convertAVC1ToAVCOTI=function(d){var f=d.split(".");if(f.length>2){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<ce.length&&!(typeof ce[pe]!="undefined");pe++);var ie=(" "+ce[pe]).slice(1),q=(" "+ce[pe+1]).slice(1),Ee=ce[pe+2]?(" "+ce[pe+2]).slice(1):"";switch(ie){case"PLAYLIST-TYPE":g.type=q.toUpperCase();break;case"MEDIA-SEQUENCE":H=g.startSN=parseInt(q);break;case"SKIP":{var Me=new L.AttrList(q),Ne=Me.decimalInteger("SKIPPED-SEGMENTS");if(Object($.isFiniteNumber)(Ne)){g.skippedSegments=Ne;for(var De=Ne;De--;)_.unshift(null);H+=Ne}var Be=Me.enumeratedString("RECENTLY-REMOVED-DATERANGES");Be&&(g.recentlyRemovedDateranges=Be.split(" "));break}case"TARGETDURATION":g.targetduration=parseFloat(q);break;case"VERSION":g.version=parseInt(q);break;case"EXTM3U":break;case"ENDLIST":g.live=!1;break;case"#":(q||Ee)&&te.tagList.push(Ee?[q,Ee]:[q]);break;case"DIS":G++;case"GAP":te.tagList.push([ie]);break;case"BITRATE":te.tagList.push([ie,q]);break;case"DISCONTINUITY-SEQ":G=parseInt(q);break;case"KEY":{var Ae,Pe=new L.AttrList(q),Fe=Pe.enumeratedString("METHOD"),ze=Pe.URI,qe=Pe.hexadecimalInteger("IV"),He=Pe.enumeratedString("KEYFORMATVERSIONS"),Oe=Pe.enumeratedString("KEYID"),lt=(Ae=Pe.enumeratedString("KEYFORMAT"))!=null?Ae:"identity",tt=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(tt.indexOf(lt)>-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<L;A++)x[A-1]=arguments[A];for(var P=x.length,w=P;P--;)O+=x[P].byteLength;var S=new Uint8Array(O);for(S[0]=O>>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<w;P++)S.set(x[P],O),O+=x[P].byteLength;return S},I.hdlr=function(N){return I.box(I.types.hdlr,I.HDLR_TYPES[N])},I.mdat=function(N){return I.box(I.types.mdat,N)},I.mdhd=function(N,O){O*=N;var L=Math.floor(O/($+1)),x=Math.floor(O%($+1));return I.box(I.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,N>>24&255,N>>16&255,N>>8&255,N&255,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<O.length;x++)A=O[x].flags,L[x+4]=A.dependsOn<<4|A.isDependedOn<<2|A.hasRedundancy;return I.box(I.types.sdtp,L)},I.stbl=function(N){return I.box(I.types.stbl,I.stsd(N),I.box(I.types.stts,I.STTS),I.box(I.types.stsc,I.STSC),I.box(I.types.stsz,I.STSZ),I.box(I.types.stco,I.STCO))},I.avc1=function(N){var O=[],L=[],x,A,P;for(x=0;x<N.sps.length;x++)A=N.sps[x],P=A.byteLength,O.push(P>>>8&255),O.push(P&255),O=O.concat(Array.prototype.slice.call(A));for(x=0;x<N.pps.length;x++)A=N.pps[x],P=A.byteLength,L.push(P>>>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<x;w++)S=L[w],T=S.duration,h=S.size,l=S.flags,i=S.cts,P.set([T>>>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;E<arguments.length;E++){var d=arguments[E];for(var f in d)Object.prototype.hasOwnProperty.call(d,f)&&(u[f]=d[f])}return u},A.apply(this,arguments)}var P=10*1e3,w=1024,S=1152,T=null,h=null,l=!1,i=function(){function u(d,f,s,a){if(a===void 0&&(a=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=d,this.config=f,this.typeSupported=s,this.ISGenerated=!1,T===null){var b=navigator.userAgent||"",g=b.match(/Chrome\/(\d+)/i);T=g?parseInt(g[1]):0}if(h===null){var _=navigator.userAgent.match(/Safari\/(\d+)/i);h=_?parseInt(_[1]):0}l=!!T&&T<75||!!h&&h<600}var E=u.prototype;return E.destroy=function(){},E.resetTimeStamp=function(f){O.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=f},E.resetNextTimestamp=function(){O.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},E.resetInitSegment=function(){O.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},E.getVideoStartPts=function(f){var s=!1,a=f.reduce(function(b,g){var _=g.pts-b;return _<-4294967296?(s=!0,c(b,g.pts)):_>0?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;ge<H;ge++){var ie=_[ge];if(ie.pts=c(ie.pts-z,Z),ie.dts=c(ie.dts-z,Z),ie.dts>ie.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(Ce<Ee*-2){O.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(x.toMsFromMpegTsClock)(-Ee,!0)+" ms");for(var Me=Ce,Ne=0;Ne<H;Ne++)_[Ne].dts=Me=Math.max(Me,_[Ne].pts-Ee),_[Ne].pts=Math.max(Me,_[Ne].pts)}else{O.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(x.toMsFromMpegTsClock)(Ce,!0)+" ms to overcome this issue");for(var De=0;De<H;De++)_[De].dts=_[De].dts+Ce}te=_[0].dts}if(a){var Be=te-Z,Ae=Be>Ee,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;He<H;He++){for(var Oe=_[He],lt=Oe.units,tt=lt.length,ft=0,nt=0;nt<tt;nt++)ft+=lt[nt].data.length;qe+=ft,ze+=tt,Oe.length=ft,Oe.dts=Math.max(Oe.dts,te),Oe.pts=Math.max(Oe.pts,Oe.dts,0),pe=Math.min(Oe.pts,pe),ye=Math.max(Oe.pts,ye)}ce=_[H-1].dts;var St=qe+4*ze+8,ht;try{ht=new Uint8Array(St)}catch(Dt){this.observer.emit(K.Events.ERROR,K.Events.ERROR,{type:N.ErrorTypes.MUX_ERROR,details:N.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:St,reason:"fail allocating video mdat "+St});return}var yt=new DataView(ht.buffer);yt.setUint32(0,St),ht.set(I.default.types.mdat,4);for(var ke=0;ke<H;ke++){for(var Pt=_[ke],Tt=Pt.units,Ue=0,Ze=0,xe=Tt.length;Ze<xe;Ze++){var fe=Tt[Ze],be=fe.data,ne=fe.data.byteLength;yt.setUint32(G,ne),G+=4,ht.set(be,G),G+=ne,Ue+=4+ne}if(ke<H-1)B=_[ke+1].dts-Pt.dts;else{var re=this.config,ae=Pt.dts-_[ke>0?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<ce.length;se++){var ie=ce[se],q=ie.pts,Ee=q-ge,Me=Math.abs(1e3*Ee/_);if(Ee<=-le*Z&&_e)se===0&&(O.logger.warn("Audio frame @ "+(q/_).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Ee/_)+" ms."),this.nextAudioPts=ye=ge=q);else if(Ee>=le*Z&&Me<P&&_e){var Ne=Math.round(Ee/Z);ge=q-Ne*Z,ge<0&&(Ne--,ge+=Z),se===0&&(this.nextAudioPts=ye=ge),O.logger.warn("[mp4-remuxer]: Injecting "+Ne+" audio frame @ "+(ge/_).toFixed(3)+"s due to "+Math.round(1e3*Ee/_)+" ms gap.");for(var De=0;De<Ne;De++){var Be=Math.max(ge,0),Ae=U.default.getSilentFrame(f.manifestCodec||f.codec,f.channelCount);Ae||(O.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Ae=ie.unit.subarray()),ce.splice(se,0,{unit:Ae,pts:Be}),ge+=Z,se++}}ie.pts=ge,ge+=Z}for(var Pe=null,Fe=null,ze,qe=0,He=ce.length;He--;)qe+=ce[He].unit.byteLength;for(var Oe=0,lt=ce.length;Oe<lt;Oe++){var tt=ce[Oe],ft=tt.unit,nt=tt.pts;if(Fe!==null){var St=te[Oe-1];St.duration=Math.round((nt-Fe)/H)}else if(a&&f.isAAC&&(nt=ye),Pe=nt,qe>0){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;pe<B;pe++){var ye=z+pe*G;ce.push({unit:te,pts:ye,dts:ye})}return f.samples=ce,this.remuxAudio(f,s,a,!1)},E.remuxID3=function(f,s){var a=f.samples.length;if(!a)return;for(var b=f.inputTimeScale,g=this._initPTS,_=this._initDTS,k=0;k<a;k++){var H=f.samples[k];H.pts=c(H.pts-g,s*b)/b,H.dts=c(H.dts-_,s*b)/b}var z=f.samples;return f.samples=[],{samples:z}},E.remuxText=function(f,s){var a=f.samples.length;if(!a)return;for(var b=f.inputTimeScale,g=this._initPTS,_=0;_<a;_++){var k=f.samples[_];k.pts=c(k.pts-g,s*b)/b}f.samples.sort(function(z,Z){return z.pts-Z.pts});var H=f.samples;return f.samples=[],{samples:H}},u}();function c(u,E){var d;if(E===null)return u;for(E<u?d=-8589934592:d=8589934592;Math.abs(u-E)>4294967296;)u+=d;return u}function C(u){for(var E=0;E<u.length;E++)if(u[E].key)return E;return-1}var v=function(E,d,f,s){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=d,this.size=f,this.cts=s,this.flags=new m(E)},m=function(E){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=E?2:1,this.isNonSync=E?0:1}},"./src/remux/passthrough-remuxer.ts":function(oe,Y,D){"use strict";D.r(Y);var $=D("./src/polyfills/number.ts"),U=D("./src/utils/mp4-tools.ts"),I=D("./src/loader/fragment.ts"),K=D("./src/utils/logger.ts"),N=function(){function x(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var A=x.prototype;return A.destroy=function(){},A.resetTimeStamp=function(w){this.initPTS=w,this.lastEndDTS=null},A.resetNextTimestamp=function(){this.lastEndDTS=null},A.resetInitSegment=function(w,S,T){this.audioCodec=S,this.videoCodec=T,this.generateInitSegment(w),this.emitInitSegment=!0},A.generateInitSegment=function(w){var S=this.audioCodec,T=this.videoCodec;if(!w||!w.byteLength){this.initTracks=void 0,this.initData=void 0;return}var h=this.initData=Object(U.parseInitSegment)(w);S||(S=L(h.audio,I.ElementaryStreamTypes.AUDIO)),T||(T=L(h.video,I.ElementaryStreamTypes.VIDEO));var l={};h.audio&&h.video?l.audiovideo={container:"video/mp4",codec:S+","+T,initSegment:w,id:"main"}:h.audio?l.audio={container:"audio/mp4",codec:S,initSegment:w,id:"audio"}:h.video?l.video={container:"video/mp4",codec:T,initSegment:w,id:"main"}:K.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=l},A.remux=function(w,S,T,h,l){var i=this.initPTS,c=this.lastEndDTS,C={audio:void 0,video:void 0,text:h,id3:T,initSegment:void 0};Object($.isFiniteNumber)(c)||(c=this.lastEndDTS=l||0);var v=S.samples;if(!v||!v.length)return C;var m={initPTS:void 0,timescale:1},u=this.initData;if((!u||!u.length)&&(this.generateInitSegment(v),u=this.initData),!u||!u.length)return K.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),C;this.emitInitSegment&&(m.tracks=this.initTracks,this.emitInitSegment=!1),Object($.isFiniteNumber)(i)||(this.initPTS=m.initPTS=i=O(u,v,c));var E=Object(U.getDuration)(v,u),d=c,f=E+d;Object(U.offsetStartDTS)(u,v,i),E>0?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;A<x.length;A++){var P=x[A];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(L,P.key,P)}}function U(L,x,A){return x&&$(L.prototype,x),A&&$(L,A),L}var I;(function(L){L.No="",L.Yes="YES",L.v2="v2"})(I||(I={}));function K(L,x){var A=L.canSkipUntil,P=L.canSkipDateRanges,w=L.endSN,S=x!==void 0?x-w:0;return A&&S<A?P?I.v2:I.Yes:I.No}var N=function(){function L(A,P,w){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=A,this.part=P,this.skip=w}var x=L.prototype;return x.addDirectives=function(P){var w=new self.URL(P);return this.msn!==void 0&&w.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&w.searchParams.set("_HLS_part",this.part.toString()),this.skip&&w.searchParams.set("_HLS_skip",this.skip),w.toString()},L}(),O=function(){function L(x){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[x.url],this.attrs=x.attrs,this.bitrate=x.bitrate,x.details&&(this.details=x.details),this.id=x.id||0,this.name=x.name,this.width=x.width||0,this.height=x.height||0,this.audioCodec=x.audioCodec,this.videoCodec=x.videoCodec,this.unknownCodecs=x.unknownCodecs,this.codecSet=[x.videoCodec,x.audioCodec].filter(function(A){return A}).join(",").replace(/\.[^.,]+/g,"")}return U(L,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(A){var P=A%this.url.length;this._urlId!==P&&(this.details=void 0,this._urlId=P)}}]),L}()},"./src/types/loader.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"PlaylistContextType",function(){return $}),D.d(Y,"PlaylistLevelType",function(){return U});var $;(function(I){I.MANIFEST="manifest",I.LEVEL="level",I.AUDIO_TRACK="audioTrack",I.SUBTITLE_TRACK="subtitleTrack"})($||($={}));var U;(function(I){I.MAIN="main",I.AUDIO="audio",I.SUBTITLE="subtitle"})(U||(U={}))},"./src/types/transmuxer.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"ChunkMetadata",function(){return $});var $=function(K,N,O,L,x,A){L===void 0&&(L=0),x===void 0&&(x=-1),A===void 0&&(A=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=U(),this.buffering={audio:U(),video:U(),audiovideo:U()},this.level=K,this.sn=N,this.id=O,this.size=L,this.part=x,this.partial=A};function U(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"AttrList",function(){return I});var $=/^(\d+)x(\d+)$/,U=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,I=function(){function K(O){typeof O=="string"&&(O=K.parseAttrList(O));for(var L in O)O.hasOwnProperty(L)&&(this[L]=O[L])}var N=K.prototype;return N.decimalInteger=function(L){var x=parseInt(this[L],10);return x>Number.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;P<x.length/2;P++)A[P]=parseInt(x.slice(P*2,P*2+2),16);return A}else return null},N.hexadecimalIntegerAsNumber=function(L){var x=parseInt(this[L],16);return x>Number.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.length;A++)if(L>=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;w<A.length;w++)P.push({start:A.start(w),end:A.end(w)});return this.bufferedInfo(P,L,x)}}catch(S){}return{len:0,start:L,end:L,nextStart:void 0}},K.bufferedInfo=function(O,L,x){L=Math.max(0,L),O.sort(function(m,u){var E=m.start-u.start;return E||u.end-m.end});var A=[];if(x)for(var P=0;P<O.length;P++){var w=A.length;if(w){var S=A[w-1].end;O[P].start-S<x?O[P].end>S&&(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<A.length;c++){var C=A[c].start,v=A[c].end;if(L+x>=C&&L<v)l=C,i=v,T=i-L;else if(L+x<C){h=C;break}}return{len:T,start:l||0,end:i||0,nextStart:h}},K.getBuffered=function(O){try{return O.buffered}catch(L){return $.logger.log("failed to get media.buffered",L),U}},K}()},"./src/utils/cea-608-parser.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"Row",function(){return i}),D.d(Y,"CaptionScreen",function(){return c});var $=D("./src/utils/logger.ts"),U={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},I=function(f){var s=f;return U.hasOwnProperty(f)&&(s=U[f]),String.fromCharCode(s)},K=15,N=100,O={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},L={17:2,18:4,21:6,22:8,23:10,19:13,20:15},x={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},A={25:2,26:4,29:6,30:8,31:10,27:13,28:15},P=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],w;(function(d){d[d.ERROR=0]="ERROR",d[d.TEXT=1]="TEXT",d[d.WARNING=2]="WARNING",d[d.INFO=2]="INFO",d[d.DEBUG=3]="DEBUG",d[d.DATA=3]="DATA"})(w||(w={}));var S=function(){function d(){this.time=null,this.verboseLevel=w.ERROR}var f=d.prototype;return f.log=function(a,b){this.verboseLevel>=a&&$.logger.log(this.time+" ["+a+"] "+b)},d}(),T=function(f){for(var s=[],a=0;a<f.length;a++)s.push(f[a].toString(16));return s},h=function(){function d(s,a,b,g,_){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=s||"white",this.underline=a||!1,this.italics=b||!1,this.background=g||"black",this.flash=_||!1}var f=d.prototype;return f.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},f.setStyles=function(a){for(var b=["foreground","underline","italics","background","flash"],g=0;g<b.length;g++){var _=b[g];a.hasOwnProperty(_)&&(this[_]=a[_])}},f.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},f.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},f.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},f.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},d}(),l=function(){function d(s,a,b,g,_,k){this.uchar=void 0,this.penState=void 0,this.uchar=s||" ",this.penState=new h(a,b,g,_,k)}var f=d.prototype;return f.reset=function(){this.uchar=" ",this.penState.reset()},f.setChar=function(a,b){this.uchar=a,this.penState.copy(b)},f.setPenState=function(a){this.penState.copy(a)},f.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},f.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},f.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},d}(),i=function(){function d(s){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<N;a++)this.chars.push(new l);this.logger=s,this.pos=0,this.currPenState=new h}var f=d.prototype;return f.equals=function(a){for(var b=!0,g=0;g<N;g++)if(!this.chars[g].equals(a.chars[g])){b=!1;break}return b},f.copy=function(a){for(var b=0;b<N;b++)this.chars[b].copy(a.chars[b])},f.isEmpty=function(){for(var a=!0,b=0;b<N;b++)if(!this.chars[b].isEmpty()){a=!1;break}return a},f.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(w.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>N&&(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<b+1;g++)this.chars[g].setPenState(this.currPenState);this.setCursor(b)},f.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},f.insertChar=function(a){a>=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;b<N;b++)this.chars[b].reset()},f.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},f.clearToEndOfRow=function(){this.clearFromPos(this.pos)},f.getTextString=function(){for(var a=[],b=!0,g=0;g<N;g++){var _=this.chars[g].uchar;_!==" "&&(b=!1),a.push(_)}return b?"":a.join("")},f.setPenStyles=function(a){this.currPenState.setStyles(a);var b=this.chars[this.pos];b.setPenState(this.currPenState)},d}(),c=function(){function d(s){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<K;a++)this.rows.push(new i(s));this.logger=s,this.currRow=K-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var f=d.prototype;return f.reset=function(){for(var a=0;a<K;a++)this.rows[a].clear();this.currRow=K-1},f.equals=function(a){for(var b=!0,g=0;g<K;g++)if(!this.rows[g].equals(a.rows[g])){b=!1;break}return b},f.copy=function(a){for(var b=0;b<K;b++)this.rows[b].copy(a.rows[b])},f.isEmpty=function(){for(var a=!0,b=0;b<K;b++)if(!this.rows[b].isEmpty()){a=!1;break}return a},f.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},f.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},f.insertChar=function(a){var b=this.rows[this.currRow];b.insertChar(a)},f.setPen=function(a){var b=this.rows[this.currRow];b.setPenStyles(a)},f.moveCursor=function(a){var b=this.rows[this.currRow];b.moveCursor(a)},f.setCursor=function(a){this.logger.log(w.INFO,"setCursor: "+a);var b=this.rows[this.currRow];b.setCursor(a)},f.setPAC=function(a){this.logger.log(w.INFO,"pacData = "+JSON.stringify(a));var b=a.row-1;if(this.nrRollUpRows&&b<this.nrRollUpRows-1&&(b=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==b){for(var g=0;g<K;g++)this.rows[g].clear();var _=this.currRow+1-this.nrRollUpRows,k=this.lastOutputScreen;if(k){var H=k.rows[_].cueStartTime,z=this.logger.time;if(H&&z!==null&&H<z)for(var Z=0;Z<this.nrRollUpRows;Z++)this.rows[b-this.nrRollUpRows+Z+1].copy(k.rows[_+Z])}}this.currRow=b;var G=this.rows[this.currRow];if(a.indent!==null){var B=a.indent,te=Math.max(B-1,0);G.setCursor(a.indent),a.color=G.chars[te].penState.foreground}var ce={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(ce)},f.setBkgData=function(a){this.logger.log(w.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},f.setRollUpRows=function(a){this.nrRollUpRows=a},f.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(w.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(w.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,b=this.rows.splice(a,1)[0];b.clear(),this.rows.splice(this.currRow,0,b),this.logger.log(w.INFO,"Rolling up")},f.getDisplayText=function(a){a=a||!1;for(var b=[],g="",_=-1,k=0;k<K;k++){var H=this.rows[k].getTextString();H&&(_=k+1,a?b.push("Row "+_+": '"+H+"'"):b.push(H.trim()))}return b.length>0&&(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<a.length;b++)this.writeScreen.insertChar(a[b]);var g=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(w.INFO,g+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(w.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},f.ccRCL=function(){this.logger.log(w.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},f.ccBS=function(){if(this.logger.log(w.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},f.ccAOF=function(){},f.ccAON=function(){},f.ccDER=function(){this.logger.log(w.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},f.ccRU=function(a){this.logger.log(w.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},f.ccFON=function(){this.logger.log(w.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},f.ccRDC=function(){this.logger.log(w.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},f.ccTR=function(){this.logger.log(w.INFO,"TR"),this.setMode("MODE_TEXT")},f.ccRTD=function(){this.logger.log(w.INFO,"RTD"),this.setMode("MODE_TEXT")},f.ccEDM=function(){this.logger.log(w.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},f.ccCR=function(){this.logger.log(w.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},f.ccENM=function(){this.logger.log(w.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},f.ccEOC=function(){if(this.logger.log(w.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(w.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},f.ccTO=function(a){this.logger.log(w.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},f.ccMIDROW=function(a){var b={flash:!1};if(b.underline=a%2===1,b.italics=a>=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<b.length;z+=2){if(_=b[z]&127,k=b[z+1]&127,_===0&&k===0)continue;if(this.logger.log(w.DATA,"["+T([b[z],b[z+1]])+"] -> ("+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<Object.keys(this.channels).length;a++){var b=this.channels[a];b&&b.reset()}this.cmdHistory=E()},f.cueSplitAtTime=function(a){for(var b=0;b<this.channels.length;b++){var g=this.channels[b];g&&g.cueSplitAtTime(a)}},d}();function m(d,f,s){s.a=d,s.b=f}function u(d,f,s){return s.a===d&&s.b===f}function E(){return{a:null,b:null}}Y.default=v},"./src/utils/codecs.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"isCodecType",function(){return U}),D.d(Y,"isCodecSupportedInMp4",function(){return I});var $={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function U(K,N){var O=$[N];return!!O&&O[K.slice(0,4)]===!0}function I(K,N){return MediaSource.isTypeSupported((N||"video")+'/mp4;codecs="'+K+'"')}},"./src/utils/cues.ts":function(oe,Y,D){"use strict";D.r(Y);var $=D("./src/utils/vttparser.ts"),U=D("./src/utils/webvtt-parser.ts"),I=D("./src/utils/texttrack-utils.ts"),K=/\s/,N={newCue:function(L,x,A,P){for(var w=[],S,T,h,l,i,c=self.VTTCue||self.TextTrackCue,C=0;C<P.rows.length;C++)if(S=P.rows[C],h=!0,l=0,i="",!S.isEmpty()){for(var v=0;v<S.chars.length;v++)K.test(S.chars[v].uchar)&&h?l++:(i+=S.chars[v].uchar,h=!1);S.cueStartTime=x,x===A&&(A+=1e-4),l>=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;c<C;c++){var v=h[c];if(v&&v.cc===l){i=v;break}}return i}function N(h,l,i){return!!(l.details&&(i.endCC>i.startCC||h&&h.cc<i.startCC))}function O(h,l){var i=h.fragments,c=l.fragments;if(!c.length||!i.length){U.logger.log("No fragments to align");return}var C=K(i,c[0].cc);if(!C||C&&!C.startPTS){U.logger.log("No frag in previous level to align on");return}return C}function L(h,l){if(h){var i=h.start+l;h.start=h.startPTS=i,h.endPTS=i+h.duration}}function x(h,l){for(var i=l.fragments,c=0,C=i.length;c<C;c++)L(i[c],h);l.fragmentHint&&L(l.fragmentHint,h),l.alignedSliding=!0}function A(h,l,i){if(!l)return;P(h,i,l),!i.alignedSliding&&l.details&&w(i,l.details),!i.alignedSliding&&l.details&&!i.skippedSegments&&Object(I.adjustSliding)(l.details,i)}function P(h,l,i){if(N(h,i,l)){var c=O(i.details,l);c&&Object($.isFiniteNumber)(c.start)&&(U.logger.log("Adjusting PTS using last level due to CC increase within current level "+l.url),x(c.start,l))}}function w(h,l){if(!l.fragments.length||!h.hasProgramDateTime||!l.hasProgramDateTime)return;var i=l.fragments[0].programDateTime,c=h.fragments[0].programDateTime,C=(c-i)/1e3+l.fragments[0].start;C&&Object($.isFiniteNumber)(C)&&(U.logger.log("Adjusting PTS using programDateTime delta "+(c-i)+"ms, sliding:"+C.toFixed(3)+" "+h.url+" "),x(C,h))}function S(h,l){var i=h.programDateTime;if(!i)return;var c=(i-l)/1e3;h.start=h.startPTS=c,h.endPTS=c+h.duration}function T(h,l){if(!l.fragments.length||!h.hasProgramDateTime||!l.hasProgramDateTime)return;var i=l.fragments[0].programDateTime,c=l.fragments[0].start,C=i-c*1e3;h.fragments.forEach(function(v){S(v,C)}),h.fragmentHint&&S(h.fragmentHint,C),h.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(oe,Y,D){"use strict";D.r(Y);var $=D("./src/utils/ewma.ts"),U=function(){function I(N,O,L){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=L,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new $.default(N),this.fast_=new $.default(O)}var K=I.prototype;return K.update=function(O,L){var x=this.slow_,A=this.fast_;this.slow_.halfLife!==O&&(this.slow_=new $.default(O,x.getEstimate(),x.getTotalWeight())),this.fast_.halfLife!==L&&(this.fast_=new $.default(L,A.getEstimate(),A.getTotalWeight()))},K.sample=function(O,L){O=Math.max(O,this.minDelayMs_);var x=8*L,A=O/1e3,P=x/A;this.fast_.sample(A,P),this.slow_.sample(A,P)},K.canEstimate=function(){var O=this.fast_;return O&&O.getTotalWeight()>=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<arguments.length;C++){var v=arguments[C];for(var m in v)Object.prototype.hasOwnProperty.call(v,m)&&(c[m]=v[m])}return c},w.apply(this,arguments)}function S(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(c){}return!1}var T=function(){function c(v){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=v.fetchSetup||l,this.controller=new self.AbortController,this.stats=new U.LoadStats}var C=c.prototype;return C.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},C.abortInternal=function(){var m=this.response;(!m||!m.ok)&&(this.stats.aborted=!0,this.controller.abort())},C.abort=function(){var m;this.abortInternal(),(m=this.callbacks)!==null&&m!==void 0&&m.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},C.load=function(m,u,E){var d=this,f=this.stats;if(f.loading.start)throw new Error("Loader can only be used once.");f.loading.start=self.performance.now();var s=h(m,this.controller.signal),a=E.onProgress,b=m.responseType==="arraybuffer",g=b?"byteLength":"length";this.context=m,this.config=u,this.callbacks=E,this.request=this.fetchSetup(m,s),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){d.abortInternal(),E.onTimeout(f,m,d.response)},u.timeout),self.fetch(this.request).then(function(_){if(d.response=d.loader=_,!_.ok){var k=_.status,H=_.statusText;throw new i(H||"fetch, bad network response",k,_)}return f.loading.first=Math.max(self.performance.now(),f.loading.start),f.total=parseInt(_.headers.get("Content-Length")||"0"),a&&Object($.isFiniteNumber)(u.highWaterMark)?d.loadProgressively(_,f,m,u.highWaterMark,a):b?_.arrayBuffer():_.text()}).then(function(_){var k=d.response;self.clearTimeout(d.requestTimeout),f.loading.end=Math.max(self.performance.now(),f.loading.first),f.loaded=f.total=_[g];var H={url:k.url,data:_};a&&!Object($.isFiniteNumber)(u.highWaterMark)&&a(f,m,_,k),E.onSuccess(H,f,m,k)}).catch(function(_){if(self.clearTimeout(d.requestTimeout),f.aborted)return;var k=_.code||0;E.onError({code:k,text:_.message},m,_.details)})},C.getCacheAge=function(){var m=null;if(this.response){var u=this.response.headers.get("age");m=u?parseFloat(u):null}return m},C.loadProgressively=function(m,u,E,d,f){d===void 0&&(d=0);var s=new I.default,a=m.body.getReader(),b=function g(){return a.read().then(function(_){if(_.done)return s.dataLength&&f(u,E,s.flush(),m),Promise.resolve(new ArrayBuffer(0));var k=_.value,H=k.length;return u.loaded+=H,H<d||s.dataLength?(s.push(k),s.dataLength>=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<arguments.length;f++){var s=arguments[f];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(d[a]=s[a])}return d},L.apply(this,arguments)}var x="stpp.ttml.im1t",A=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,P=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,w={left:"start",center:"center",right:"end",start:"start",end:"end"};function S(d,f,s,a,b){var g=Object($.findBox)(new Uint8Array(d),["mdat"]);if(g.length===0){b(new Error("Could not parse IMSC1 mdat"));return}var _=g[0],k=Object(K.utf8ArrayToStr)(new Uint8Array(d,_.start,_.end-_.start)),H=Object(N.toTimescaleFromScale)(f,1,s);try{a(T(k,H))}catch(z){b(z)}}function T(d,f){var s=new DOMParser,a=s.parseFromString(d,"text/xml"),b=a.getElementsByTagName("tt")[0];if(!b)throw new Error("Invalid ttml");var g={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},_=Object.keys(g).reduce(function(G,B){return G[B]=b.getAttribute("ttp:"+B)||g[B],G},{}),k=b.getAttribute("xml:space")!=="preserve",H=l(h(b,"styling","style")),z=l(h(b,"layout","region")),Z=h(b,"body","[begin]");return[].map.call(Z,function(G){var B=i(G,k);if(!B||!G.hasAttribute("begin"))return null;var te=m(G.getAttribute("begin"),_),ce=m(G.getAttribute("dur"),_),pe=m(G.getAttribute("end"),_);if(te===null)throw v(G);if(pe===null){if(ce===null)throw v(G);pe=te+ce}var ye=new I.default(te-f,pe-f,B);ye.id=Object(O.generateCueId)(ye.startTime,ye.endTime,ye.text);var Ce=z[G.getAttribute("region")],_e=H[G.getAttribute("style")];ye.position=10,ye.size=80;var le=c(Ce,_e),se=le.textAlign;if(se){var ge=w[se];ge&&(ye.lineAlign=ge),ye.align=se}return L(ye,le),ye}).filter(function(G){return G!==null})}function h(d,f,s){var a=d.getElementsByTagName(f)[0];return a?[].slice.call(a.querySelectorAll(s)):[]}function l(d){return d.reduce(function(f,s){var a=s.getAttribute("xml:id");return a&&(f[a]=s),f},{})}function i(d,f){return[].slice.call(d.childNodes).reduce(function(s,a,b){var g;return a.nodeName==="br"&&b?s+`
`:(g=a.childNodes)!==null&&g!==void 0&&g.length?i(a,f):f?s+a.textContent.trim().replace(/\s+/g," "):s+a.textContent},"")}function c(d,f){var s="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(b,g){var _=C(f,s,g)||C(d,s,g);return _&&(b[g]=_),b},{})}function C(d,f,s){return d.hasAttributeNS(f,s)?d.getAttributeNS(f,s):null}function v(d){return new Error("Could not parse ttml timestamp "+d)}function m(d,f){if(!d)return null;var s=Object(U.parseTimeStamp)(d);return s===null&&(A.test(d)?s=u(d,f):P.test(d)&&(s=E(d,f))),s}function u(d,f){var s=A.exec(d),a=(s[4]|0)+(s[5]|0)/f.subFrameRate;return(s[1]|0)*3600+(s[2]|0)*60+(s[3]|0)+a/f.frameRate}function E(d,f){var s=P.exec(d),a=Number(s[1]),b=s[2];switch(b){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/f.frameRate;case"t":return a/f.tickRate}return a}},"./src/utils/logger.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"enableLogs",function(){return O}),D.d(Y,"logger",function(){return L});var $=function(){},U={trace:$,debug:$,log:$,warn:$,info:$,error:$},I=U;function K(x){var A=self.console[x];return A?A.bind(self.console,"["+x+"] >"):$}function N(x){for(var A=arguments.length,P=new Array(A>1?A-1:0),w=1;w<A;w++)P[w-1]=arguments[w];P.forEach(function(S){I[S]=x[S]?x[S].bind(x):K(S)})}function O(x){if(self.console&&x===!0||typeof x=="object"){N(x,"debug","log","info","warn","error");try{I.log()}catch(A){I=U}}else I=U}var L=I},"./src/utils/mediakeys-helper.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"KeySystems",function(){return $}),D.d(Y,"requestMediaKeySystemAccess",function(){return U});var $;(function(I){I.WIDEVINE="com.widevine.alpha",I.PLAYREADY="com.microsoft.playready"})($||($={}));var U=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"getMediaSource",function(){return $});function $(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"bin2str",function(){return N}),D.d(Y,"readUint16",function(){return O}),D.d(Y,"readUint32",function(){return L}),D.d(Y,"writeUint32",function(){return x}),D.d(Y,"findBox",function(){return A}),D.d(Y,"parseSegmentIndex",function(){return P}),D.d(Y,"parseInitSegment",function(){return w}),D.d(Y,"getStartDTS",function(){return S}),D.d(Y,"getDuration",function(){return T}),D.d(Y,"computeRawDurationFromSamples",function(){return h}),D.d(Y,"offsetStartDTS",function(){return l}),D.d(Y,"segmentValidRange",function(){return i}),D.d(Y,"appendUint8Array",function(){return c});var $=D("./src/utils/typed-array.ts"),U=D("./src/loader/fragment.ts"),I=Math.pow(2,32)-1,K=[].push;function N(C){return String.fromCharCode.apply(null,C)}function O(C,v){"data"in C&&(v+=C.start,C=C.data);var m=C[v]<<8|C[v+1];return m<0?65536+m:m}function L(C,v){"data"in C&&(v+=C.start,C=C.data);var m=C[v]<<24|C[v+1]<<16|C[v+2]<<8|C[v+3];return m<0?4294967296+m:m}function x(C,v,m){"data"in C&&(v+=C.start,C=C.data),C[v]=m>>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;f<d;){var s=L(u,f),a=N(u.subarray(f+4,f+8)),b=s>1?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<H;z++){var Z=a,G=L(f,Z);Z+=4;var B=G&2147483647,te=(G&2147483648)>>>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;u<m.length;u++){var E=m[u],d=A(E,["tkhd"])[0];if(d){var f=d.data[d.start],s=f===0?12:20,a=L(d,s),b=A(E,["mdia","mdhd"])[0];if(b){f=b.data[b.start],s=f===0?12:20;var g=L(b,s),_=A(E,["mdia","hdlr"])[0];if(_){var k=N(_.data.subarray(_.start+8,_.start+12)),H={soun:U.ElementaryStreamTypes.AUDIO,vide:U.ElementaryStreamTypes.VIDEO}[k];if(H){var z=A(E,["mdia","minf","stbl","stsd"])[0],Z=void 0;z&&(Z=N(z.data.subarray(z.start+12,z.start+16))),v[a]={timescale:g,type:H},v[H]={timescale:g,id:a,codec:Z}}}}}}var G=A(C,["moov","mvex","trex"]);return G.forEach(function(B){var te=L(B,4),ce=v[te];ce&&(ce.default={duration:L(B,12),flags:L(B,20)})}),v}function S(C,v){return A(v,["moof","traf"]).reduce(function(m,u){var E=A(u,["tfdt"])[0],d=E.data[E.start],f=A(u,["tfhd"]).reduce(function(s,a){var b=L(a,4),g=C[b];if(g){var _=L(E,4);d===1&&(_*=Math.pow(2,32),_+=L(E,8));var k=g.timescale||9e4,H=_/k;if(isFinite(H)&&(s===null||H<s))return H}return s},null);return f!==null&&isFinite(f)&&(m===null||f<m)?f:m},null)||0}function T(C,v){for(var m=0,u=0,E=0,d=A(C,["moof","traf"]),f=0;f<d.length;f++){var s=d[f],a=A(s,["tfhd"])[0],b=L(a,4),g=v[b];if(!g)continue;var _=g.default,k=L(a,0)|(_==null?void 0:_.flags),H=_==null?void 0:_.duration;k&8&&(k&2?H=L(a,12):H=L(a,8));for(var z=g.timescale||9e4,Z=A(s,["trun"]),G=0;G<Z.length;G++){if(H){var B=L(Z[G],4);m=H*B}else m=h(Z[G]);g.type===U.ElementaryStreamTypes.VIDEO?u+=m/z:g.type===U.ElementaryStreamTypes.AUDIO&&(E+=m/z)}}if(u===0&&E===0){var te=P(C);if(te!=null&&te.references)return te.references.reduce(function(ce,pe){return ce+pe.info.duration||0},0)}return u||E}function h(C){var v=L(C,0),m=8;v&1&&(m+=4),v&4&&(m+=4);for(var u=0,E=L(C,4),d=0;d<E;d++){if(v&256){var f=L(C,m);u+=f,m+=4}v&512&&(m+=4),v&1024&&(m+=4),v&2048&&(m+=4)}return u}function l(C,v,m){A(v,["moof","traf"]).forEach(function(u){A(u,["tfhd"]).forEach(function(E){var d=L(E,4),f=C[d];if(!f)return;var s=f.timescale||9e4;A(u,["tfdt"]).forEach(function(a){var b=a.data[a.start],g=L(a,4);if(b===0)x(a,4,g-m*s);else{g*=Math.pow(2,32),g+=L(a,8),g-=m*s,g=Math.max(g,0);var _=Math.floor(g/(I+1)),k=Math.floor(g%(I+1));x(a,4,_),x(a,8,k)}})})})}function i(C){var v={valid:null,remainder:null},m=A(C,["moof"]);if(m){if(m.length<2)return v.remainder=C,v}else return v;var u=m[m.length-1];return v.valid=Object($.sliceUint8)(C,0,u.start-8),v.remainder=Object($.sliceUint8)(C,u.start-8),v}function c(C,v){var m=new Uint8Array(C.length+v.length);return m.set(C),m.set(v,C.length),m}},"./src/utils/output-filter.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"default",function(){return $});var $=function(){function U(K,N){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=K,this.trackName=N}var I=U.prototype;return I.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},I.newCue=function(N,O,L){(this.startTime===null||this.startTime>N)&&(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;T<S.length;T++)x.removeCue(S[T]);w==="disabled"&&(x.mode=w)}function O(x,A){if(A<x[0].startTime)return 0;var P=x.length-1;if(A>x[P].endTime)return-1;for(var w=0,S=P;w<=S;){var T=Math.floor((S+w)/2);if(A<x[T].startTime)S=T-1;else if(A>x[T].startTime&&w<P)w=T+1;else return T}return x[w].startTime-A<A-x[S].startTime?w:S}function L(x,A,P){var w=[],S=O(x,A);if(S>-1)for(var T=S,h=x.length;T<h;T++){var l=x[T];if(l.startTime>=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;O<N;O++)K+="["+I.start(O).toFixed(3)+","+I.end(O).toFixed(3)+"]";return K}};Y.default=$},"./src/utils/timescale-conversion.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"toTimescaleFromBase",function(){return U}),D.d(Y,"toTimescaleFromScale",function(){return I}),D.d(Y,"toMsFromMpegTsClock",function(){return K}),D.d(Y,"toMpegTsClockFromTimescale",function(){return N});var $=9e4;function U(O,L,x,A){x===void 0&&(x=1),A===void 0&&(A=!1);var P=O*L*x;return A?Math.round(P):P}function I(O,L,x,A){return x===void 0&&(x=1),A===void 0&&(A=!1),U(O,L,1/x,A)}function K(O,L){return L===void 0&&(L=!1),U(O,1e3,1/$,L)}function N(O,L){return L===void 0&&(L=1),U(O,$,1/L)}},"./src/utils/typed-array.ts":function(oe,Y,D){"use strict";D.r(Y),D.d(Y,"sliceUint8",function(){return $});function $(U,I,K){return Uint8Array.prototype.slice?U.slice(I,K):new Uint8Array(Array.prototype.slice.call(U,I,K))}},"./src/utils/vttcue.ts":function(oe,Y,D){"use strict";D.r(Y),Y.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var $=["","lr","rl"],U=["start","middle","end","left","right"];function I(x,A){if(typeof A!="string")return!1;if(!Array.isArray(x))return!1;var P=A.toLowerCase();return~x.indexOf(P)?P:!1}function K(x){return I($,x)}function N(x){return I(U,x)}function O(x){for(var A=arguments.length,P=new Array(A>1?A-1:0),w=1;w<A;w++)P[w-1]=arguments[w];for(var S=1;S<arguments.length;S++){var T=arguments[S];for(var h in T)x[h]=T[h]}return x}function L(x,A,P){var w=this,S={enumerable:!0};w.hasBeenReset=!1;var T="",h=!1,l=x,i=A,c=P,C=null,v="",m=!0,u="auto",E="start",d=50,f="middle",s=50,a="middle";Object.defineProperty(w,"id",O({},S,{get:function(){return T},set:function(g){T=""+g}})),Object.defineProperty(w,"pauseOnExit",O({},S,{get:function(){return h},set:function(g){h=!!g}})),Object.defineProperty(w,"startTime",O({},S,{get:function(){return l},set:function(g){if(typeof g!="number")throw new TypeError("Start time must be set to a number.");l=g,this.hasBeenReset=!0}})),Object.defineProperty(w,"endTime",O({},S,{get:function(){return i},set:function(g){if(typeof g!="number")throw new TypeError("End time must be set to a number.");i=g,this.hasBeenReset=!0}})),Object.defineProperty(w,"text",O({},S,{get:function(){return c},set:function(g){c=""+g,this.hasBeenReset=!0}})),Object.defineProperty(w,"region",O({},S,{get:function(){return C},set:function(g){C=g,this.hasBeenReset=!0}})),Object.defineProperty(w,"vertical",O({},S,{get:function(){return v},set:function(g){var _=K(g);if(_===!1)throw new SyntaxError("An invalid or illegal string was specified.");v=_,this.hasBeenReset=!0}})),Object.defineProperty(w,"snapToLines",O({},S,{get:function(){return m},set:function(g){m=!!g,this.hasBeenReset=!0}})),Object.defineProperty(w,"line",O({},S,{get:function(){return u},set:function(g){if(typeof g!="number"&&g!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");u=g,this.hasBeenReset=!0}})),Object.defineProperty(w,"lineAlign",O({},S,{get:function(){return E},set:function(g){var _=N(g);if(!_)throw new SyntaxError("An invalid or illegal string was specified.");E=_,this.hasBeenReset=!0}})),Object.defineProperty(w,"position",O({},S,{get:function(){return d},set:function(g){if(g<0||g>100)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<i.length;++c)if(l===i[c]){this.set(h,l);break}},S.integer=function(h,l){/^-?\d+$/.test(l)&&this.set(h,parseInt(l,10))},S.percent=function(h,l){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(l)){var i=parseFloat(l);if(i>=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(/<br(?: \/)?>/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<E.length&&E[d]!=="\r"&&E[d]!==`
`;)++d;var f=E.substr(0,d);return E[d]==="\r"&&++d,E[d]===`
`&&++d,l.buffer=E.substr(d),f}function c(E){N(E,function(d,f){},/:/)}try{var C="";if(l.state==="INITIAL"){if(!/\r\n|\n/.test(l.buffer))return this;C=i();var v=C.match(/^()?WEBVTT([ \t].*)?$/);if(!v||!v[0])throw new Error("Malformed WebVTT signature.");l.state="HEADER"}for(var m=!1;l.buffer;){if(!/\r\n|\n/.test(l.buffer))return this;m?m=!1:C=i();switch(l.state){case"HEADER":/:/.test(C)?c(C):C||(l.state="ID");continue;case"NOTE":C||(l.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(C)){l.state="NOTE";break}if(!C)continue;if(l.cue=new $.default(0,0,""),l.state="CUE",C.indexOf("-->")===-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"}}}]);