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([[194,7,8],{"+NIl":function(rt,Xe,X){(function(oe){oe(X("VrN/"))})(function(oe){"use strict";oe.defineMode("stex",function($,D){"use strict";function Y(w,S){w.cmdState.push(S)}function U(w){return w.cmdState.length>0?w.cmdState[w.cmdState.length-1]:null}function N(w){var S=w.cmdState.pop();S&&S.closeBracket()}function K(w){for(var S=w.cmdState,x=S.length-1;x>=0;x--){var h=S[x];if(h.name=="DEFAULT")continue;return h}return{styleIdentifier:function(){return null}}}function I(w,S,x){return function(){this.name=w,this.bracketNo=0,this.style=S,this.styles=x,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=I("importmodule","tag",["string","builtin"]),O.documentclass=I("documentclass","tag",["","atom"]),O.usepackage=I("usepackage","tag",["atom"]),O.begin=I("begin","tag",["atom"]),O.end=I("end","tag",["atom"]),O.label=I("label","tag",["atom"]),O.ref=I("ref","tag",["atom"]),O.eqref=I("eqref","tag",["atom"]),O.cite=I("cite","tag",["atom"]),O.bibitem=I("bibitem","tag",["atom"]),O.Bibitem=I("Bibitem","tag",["atom"]),O.RBibitem=I("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 T(w,S){var x;if(w.match(/^\\[a-zA-Z@]+/)){var h=w.current().slice(1);return x=O.hasOwnProperty(h)?O[h]:O.DEFAULT,x=new x,Y(S,x),L(S,P),x.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(x=U(S),x)x.closeBracket(l),L(S,P);else return"error";return"bracket"}else return l=="{"||l=="["?(x=O.DEFAULT,x=new x,Y(S,x),"bracket"):/\d/.test(l)?(w.eatWhile(/[\w.%]/),"atom"):(w.eatWhile(/[\w\-_]/),x=K(S),x.name=="begin"&&(x.argument=w.current()),x.styleIdentifier())}function A(w,S,x){if(w.eatSpace())return null;if(x&&w.match(x))return L(S,T),"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 x=w.peek(),h;return x=="{"||x=="["?(h=U(S),h.openBracket(x),w.eat(x),L(S,T),"bracket"):/[ \t\r]/.test(x)?(w.eat(x),null):(L(S,T),N(S),T(w,S))}return{startState:function(){var w=D.inMathMode?function(S,x){return A(S,x)}:T;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=T,w.cmdState.length=0},lineComment:"%"}}),oe.defineMIME("text/x-stex","stex"),oe.defineMIME("text/x-latex","stex")})},"+RXH":function(rt,Xe,X){rt.exports=X.p+"static/shu.a39bf729.svg"},"+yhJ":function(rt,Xe,X){rt.exports=X.p+"static/xixi.d492fb65.svg"},"0eGx":function(rt,Xe,X){rt.exports=X.p+"static/zhong.c1924b73.svg"},"19Vz":function(rt,Xe,X){(function(oe){oe(X("VrN/"))})(function(oe){oe.defineOption("placeholder","",function(I,O,L){var T=L&&L!=oe.Init;if(O&&!T)I.on("blur",U),I.on("change",N),I.on("swapDoc",N),oe.on(I.getInputField(),"compositionupdate",I.state.placeholderCompose=function(){Y(I)}),N(I);else if(!O&&T){I.off("blur",U),I.off("change",N),I.off("swapDoc",N),oe.off(I.getInputField(),"compositionupdate",I.state.placeholderCompose),$(I);var A=I.getWrapperElement();A.className=A.className.replace(" CodeMirror-empty","")}O&&!I.hasFocus()&&U(I)});function $(I){I.state.placeholder&&(I.state.placeholder.parentNode.removeChild(I.state.placeholder),I.state.placeholder=null)}function D(I){$(I);var O=I.state.placeholder=document.createElement("pre");O.style.cssText="height: 0; overflow: visible",O.style.direction=I.getOption("direction"),O.className="CodeMirror-placeholder CodeMirror-line-like";var L=I.getOption("placeholder");typeof L=="string"&&(L=document.createTextNode(L)),O.appendChild(L),I.display.lineSpace.insertBefore(O,I.display.lineSpace.firstChild)}function Y(I){setTimeout(function(){var O=!1,L=I.getInputField();L.nodeName=="TEXTAREA"?O=!L.value:I.lineCount()==1&&(O=!/[^\u200b]/.test(L.querySelector(".CodeMirror-line").textContent)),O?D(I):$(I)},20)}function U(I){K(I)&&D(I)}function N(I){var O=I.getWrapperElement(),L=K(I);O.className=O.className.replace(" CodeMirror-empty","")+(L?" CodeMirror-empty":""),L?D(I):$(I)}function K(I){return I.lineCount()===1&&I.getLine(0)===""}})},"1eCo":function(rt,Xe,X){(function(oe){oe(X("VrN/"))})(function(oe){"use strict";var $={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},D={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};oe.defineMode("xml",function(Y,U){var N=Y.indentUnit,K={},I=U.htmlMode?$:D;for(var O in I)K[O]=I[O];for(var O in U)K[O]=U[O];var L,T;function A(o,b){function g(H){return b.tokenize=H,H(o,b)}var _=o.next();if(_=="<")return o.eat("!")?o.eat("[")?o.match("CDATA[")?g(S("atom","]]>")):null:o.match("--")?g(S("comment","-->")):o.match("DOCTYPE",!0,!0)?(o.eatWhile(/[\w\._\-]/),g(x(1))):null:o.eat("?")?(o.eatWhile(/[\w\._\-]/),b.tokenize=S("meta","?>"),"meta"):(L=o.eat("/")?"closeTag":"openTag",b.tokenize=P,"tag bracket");if(_=="&"){var k;return o.eat("#")?o.eat("x")?k=o.eatWhile(/[a-fA-F\d]/)&&o.eat(";"):k=o.eatWhile(/[\d]/)&&o.eat(";"):k=o.eatWhile(/[\w\.\-:]/)&&o.eat(";"),k?"atom":"error"}else return o.eatWhile(/[^&<]/),null}A.isInText=!0;function P(o,b){var g=o.next();if(g==">"||g=="/"&&o.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(o,b);return _?_+" tag error":"tag error"}else return/[\'\"]/.test(g)?(b.tokenize=w(g),b.stringStartCol=o.column(),b.tokenize(o,b)):(o.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function w(o){var b=function(g,_){for(;!g.eol();)if(g.next()==o){_.tokenize=P;break}return"string"};return b.isInAttribute=!0,b}function S(o,b){return function(g,_){for(;!g.eol();){if(g.match(b)){_.tokenize=A;break}g.next()}return o}}function x(o){return function(b,g){for(var _;(_=b.next())!=null;){if(_=="<")return g.tokenize=x(o+1),g.tokenize(b,g);if(_==">")if(o==1){g.tokenize=A;break}else return g.tokenize=x(o-1),g.tokenize(b,g)}return"meta"}}function h(o,b,g){this.prev=o.context,this.tagName=b,this.indent=o.indented,this.startOfLine=g,(K.doNotIndent.hasOwnProperty(b)||o.context&&o.context.noIndent)&&(this.noIndent=!0)}function l(o){o.context&&(o.context=o.context.prev)}function i(o,b){for(var g;;){if(!o.context)return;if(g=o.context.tagName,!K.contextGrabbers.hasOwnProperty(g)||!K.contextGrabbers[g].hasOwnProperty(b))return;l(o)}}function c(o,b,g){return o=="openTag"?(g.tagStart=b.column(),C):o=="closeTag"?v:c}function C(o,b,g){return o=="word"?(g.tagName=b.current(),T="tag",E):K.allowMissingTagName&&o=="endTag"?(T="tag bracket",E(o,b,g)):(T="error",C)}function v(o,b,g){if(o=="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?(T="tag",m):(T="tag error",u)}else return K.allowMissingTagName&&o=="endTag"?(T="tag bracket",m(o,b,g)):(T="error",u)}function m(o,b,g){return o!="endTag"?(T="error",m):(l(g),c)}function u(o,b,g){return T="error",m(o,b,g)}function E(o,b,g){if(o=="word")return T="attribute",d;if(o=="endTag"||o=="selfcloseTag"){var _=g.tagName,k=g.tagStart;return g.tagName=g.tagStart=null,o=="selfcloseTag"||K.autoSelfClosers.hasOwnProperty(_)?i(g,_):(i(g,_),g.context=new h(g,_,k==g.indented)),c}return T="error",E}function d(o,b,g){return o=="equals"?f:(K.allowMissing||(T="error"),E(o,b,g))}function f(o,b,g){return o=="string"?s:o=="word"&&K.allowUnquoted?(T="string",E):(T="error",E(o,b,g))}function s(o,b,g){return o=="string"?s:E(o,b,g)}return{startState:function(o){var b={tokenize:A,state:c,indented:o||0,tagName:null,tagStart:null,context:null};return o!=null&&(b.baseIndent=o),b},token:function(o,b){if(!b.tagName&&o.sol()&&(b.indented=o.indentation()),o.eatSpace())return null;L=null;var g=b.tokenize(o,b);return(g||L)&&g!="comment"&&(T=null,b.state=b.state(L||g,o,b),T&&(g=T=="error"?g+" error":T)),g},indent:function(o,b,g){var _=o.context;if(o.tokenize.isInAttribute)return o.tagStart==o.indented?o.stringStartCol+1:o.indented+N;if(_&&_.noIndent)return oe.Pass;if(o.tokenize!=P&&o.tokenize!=A)return g?g.match(/^(\s*)/)[0].length:0;if(o.tagName)return K.multilineTagIndentPastTag!==!1?o.tagStart+o.tagName.length+2:o.tagStart+N*(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+N:o.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:K.htmlMode?"html":"xml",helperType:K.htmlMode?"html":"xml",skipAttribute:function(o){o.state==f&&(o.state=E)},xmlCurrentTag:function(o){return o.tagName?{name:o.tagName,close:o.type=="closeTag"}:null},xmlCurrentContext:function(o){for(var b=[],g=o.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(rt,Xe,X){rt.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(rt,Xe,X){rt.exports=X.p+"static/sc.c1696770.svg"},"5MlY":function(rt,Xe,X){rt.exports=X.p+"static/sm.8ccb50bf.svg"},"6+eU":function(rt,Xe,X){"use strict";X.d(Xe,"a",function(){return m});var oe=X("wx14"),$=X("rePB"),D=X("VTBJ"),Y=X("1OyB"),U=X("vuIU"),N=X("Ji7U"),K=X("LK+K"),I=X("q1tI"),O=X.n(I),L=X("TSYQ"),T=X.n(L),A=function(E){var d,f="".concat(E.rootPrefixCls,"-item"),s=T()(f,"".concat(f,"-").concat(E.page),(d={},Object($.a)(d,"".concat(f,"-active"),E.active),Object($.a)(d,E.className,!!E.className),Object($.a)(d,"".concat(f,"-disabled"),!E.page),d)),o=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:o,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(N.a)(d,u);var E=Object(K.a)(d);function d(){var f;Object(Y.a)(this,d);for(var s=arguments.length,o=new Array(s),b=0;b<s;b++)o[b]=arguments[b];return f=E.call.apply(E,[this].concat(o)),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,o=s.goInputText,b=s.current;return!o||isNaN(o)?b:Number(o)}},{key:"getPageSizeOptions",value:function(){var s=this.props,o=s.pageSize,b=s.pageSizeOptions;return b.some(function(g){return g.toString()===o.toString()})?b:b.concat([o.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,o=this.props,b=o.pageSize,g=o.locale,_=o.rootPrefixCls,k=o.changeSize,H=o.quickGo,z=o.goButton,Z=o.selectComponentClass,G=o.buildOptionText,B=o.selectPrefixCls,te=o.disabled,de=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 ve=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}},ve)}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:de,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 x=S,h=X("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(N.a)(d,u);var E=Object(K.a)(d);function d(f){var s;Object(Y.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 o=f.onChange!==l,b="current"in f;b&&!o&&console.warn("Warning: You provided a `current` prop to a Pagination component without an `onChange` handler. This will render a read-only component.");var 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,o){var b=this.props.prefixCls;if(o.current!==this.state.current&&this.paginationNode){var g=this.paginationNode.querySelector(".".concat(b,"-item-").concat(o.current));g&&document.activeElement===g&&g.blur()}}},{key:"getValidValue",value:function(s){var o=s.target.value,b=C(void 0,this.state,this.props),g=this.state.currentInputValue,_;return o===""?_=o:isNaN(Number(o))?_=g:o>=b?_=b:_=Number(o),_}},{key:"getShowSizeChanger",value:function(){var s=this.props,o=s.showSizeChanger,b=s.total,g=s.totalBoundaryShowSizeChanger;return typeof o!="undefined"?o:b>g}},{key:"renderPrev",value:function(s){var o=this.props,b=o.prevIcon,g=o.itemRender,_=g(s,"prev",this.getItemIcon(b,"prev page")),k=!this.hasPrev();return Object(I.isValidElement)(_)?Object(I.cloneElement)(_,{disabled:k}):_}},{key:"renderNext",value:function(s){var o=this.props,b=o.nextIcon,g=o.itemRender,_=g(s,"next",this.getItemIcon(b,"next page")),k=!this.hasNext();return Object(I.isValidElement)(_)?Object(I.cloneElement)(_,{disabled:k}):_}},{key:"render",value:function(){var s=this,o=this.props,b=o.prefixCls,g=o.className,_=o.style,k=o.disabled,H=o.hideOnSinglePage,z=o.total,Z=o.locale,G=o.showQuickJumper,B=o.showLessItems,te=o.showTitle,de=o.showTotal,pe=o.simple,ye=o.itemRender,Ce=o.showPrevNextJumpers,_e=o.jumpPrevIcon,le=o.jumpNextIcon,se=o.selectComponentClass,ve=o.selectPrefixCls,ie=o.pageSizeOptions,q=this.state,xe=q.current,Ie=q.pageSize,Ne=q.currentInputValue;if(H===!0&&z<=Ie)return null;var De=C(void 0,this.state,this.props),Be=[],Ae=null,Pe=null,We=null,ze=null,qe=null,Ge=G&&G.goButton,ke=B?1:2,ct=xe-1>0?xe-1:0,ut=xe+1<De?xe+1:De,vt=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 Ge&&(typeof Ge=="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},Ge),qe=O.a.createElement("li",{title:te?"".concat(Z.jump_to).concat(xe,"/").concat(De):null,className:"".concat(b,"-simple-pager")},qe)),O.a.createElement("ul",Object(oe.a)({className:T()(b,"".concat(b,"-simple"),Object($.a)({},"".concat(b,"-disabled"),k),g),style:_,ref:this.savePaginationNode},vt),O.a.createElement("li",{title:te?Z.prev_page:null,onClick:this.prev,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterPrev,className:T()("".concat(b,"-prev"),Object($.a)({},"".concat(b,"-disabled"),!this.hasPrev())),"aria-disabled":!this.hasPrev()},this.renderPrev(ct)),O.a.createElement("li",{title:te?"".concat(xe,"/").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:T()("".concat(b,"-next"),Object($.a)({},"".concat(b,"-disabled"),!this.hasNext())),"aria-disabled":!this.hasNext()},this.renderNext(ut)),qe);if(De<=3+ke*2){var lt={locale:Z,rootPrefixCls:b,onClick:this.handleChange,onKeyPress:this.runIfEnter,showTitle:te,itemRender:ye};De||Be.push(O.a.createElement(P,Object(oe.a)({},lt,{key:"noPager",page:De,className:"".concat(b,"-disabled")})));for(var Tt=1;Tt<=De;Tt+=1){var gt=xe===Tt;Be.push(O.a.createElement(P,Object(oe.a)({},lt,{key:Tt,page:Tt,active:gt})))}}else{var yt=B?Z.prev_3:Z.prev_5,Oe=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:T()("".concat(b,"-jump-prev"),Object($.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?Oe:null,key:"next",tabIndex:"0",onClick:this.jumpNext,onKeyPress:this.runIfEnterJumpNext,className:T()("".concat(b,"-jump-next"),Object($.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}),We=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,xe-ke),St=Math.min(xe+ke,De);xe-1<=ke&&(St=1+ke*2),De-xe<=ke&&(Pt=De-ke*2);for(var Ue=Pt;Ue<=St;Ue+=1){var Ze=xe===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}))}xe-1>=ke*2&&xe!==1+2&&(Be[0]=Object(I.cloneElement)(Be[0],{className:"".concat(b,"-item-after-jump-prev")}),Be.unshift(Ae)),De-xe>=ke*2&&xe!==De-2&&(Be[Be.length-1]=Object(I.cloneElement)(Be[Be.length-1],{className:"".concat(b,"-item-before-jump-next")}),Be.push(Pe)),Pt!==1&&Be.unshift(We),St!==De&&Be.push(ze)}var Ee=null;de&&(Ee=O.a.createElement("li",{className:"".concat(b,"-total-text")},de(z,[z===0?0:(xe-1)*Ie+1,xe*Ie>z?z:xe*Ie])));var fe=!this.hasPrev()||!De,be=!this.hasNext()||!De;return O.a.createElement("ul",Object(oe.a)({className:T()(b,g,Object($.a)({},"".concat(b,"-disabled"),k)),style:_,unselectable:"unselectable",ref:this.savePaginationNode},vt),Ee,O.a.createElement("li",{title:te?Z.prev_page:null,onClick:this.prev,tabIndex:fe?null:0,onKeyPress:this.runIfEnterPrev,className:T()("".concat(b,"-prev"),Object($.a)({},"".concat(b,"-disabled"),fe)),"aria-disabled":fe},this.renderPrev(ct)),Be,O.a.createElement("li",{title:te?Z.next_page:null,onClick:this.next,tabIndex:be?null:0,onKeyPress:this.runIfEnterNext,className:T()("".concat(b,"-next"),Object($.a)({},"".concat(b,"-disabled"),be)),"aria-disabled":be},this.renderNext(ut)),O.a.createElement(x,{disabled:k,locale:Z,rootPrefixCls:b,selectComponentClass:se,selectPrefixCls:ve,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:xe,pageSize:Ie,pageSizeOptions:ie,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:Ge}))}}],[{key:"getDerivedStateFromProps",value:function(s,o){var b={};if("current"in s&&(b.current=s.current,s.current!==o.current&&(b.currentInputValue=b.current)),"pageSize"in s&&s.pageSize!==o.pageSize){var g=o.current,_=C(s.pageSize,o,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(rt,Xe,X){rt.exports=X.p+"static/jinshi.9b74f304.svg"},"7Cbv":function(rt,Xe,X){"use strict";var oe=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),$=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($)}var Y=/^(?:[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"&&Y.test(P)}for(var N=U,K=[],I=0;I<256;++I)K.push((I+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(!N(S))throw TypeError("Stringified UUID is invalid");return S}var L=O;function T(P,w,S){P=P||{};var x=P.random||(P.rng||D)();if(x[6]=x[6]&15|64,x[8]=x[8]&63|128,w){S=S||0;for(var h=0;h<16;++h)w[S+h]=x[h];return w}return L(x)}var A=Xe.a=T},"7ahc":function(rt,Xe,X){"use strict";X.d(Xe,"a",function(){return C});var oe=X("k1fw"),$=X("0Owb"),D=X("+L6B"),Y=X("2/Rp"),U=X("y8nQ"),N=X("Vl3Y"),K=X("tJVT"),I=X("OaEy"),O=X("2fM7"),L=X("q1tI"),T=X.n(L),A=X("VrN/"),P=X.n(A),w=X("p77/"),S=X.n(w),x=X("c5Ni"),h=X.n(x),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 o(g){s(c[g][1])}function b(g){m(g)}return T.a.createElement(N.a,Object($.a)({},i,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:b}),T.a.createElement(N.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},T.a.createElement(O.a,{onChange:o},Object.keys(c).map(function(g){return T.a.createElement(l,{key:g,value:g},c[g][0])}))),T.a.createElement(N.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},T.a.createElement(C,{mode:f})),T.a.createElement("div",{className:"flex-container flex-end"},T.a.createElement(Y.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),T.a.createElement(Y.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)(),o=Object(L.useState)(),b=Object(K.a)(o,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]),T.a.createElement("div",{className:"my-codemirror-container"},T.a.createElement("textarea",{ref:s}))}},"7ixt":function(rt,Xe,X){"use strict";X.d(Xe,"a",function(){return D});var oe={adjustX:1,adjustY:1},$=[0,0],D={left:{points:["cr","cl"],overflow:oe,offset:[-4,0],targetOffset:$},right:{points:["cl","cr"],overflow:oe,offset:[4,0],targetOffset:$},top:{points:["bc","tc"],overflow:oe,offset:[0,-4],targetOffset:$},bottom:{points:["tc","bc"],overflow:oe,offset:[0,4],targetOffset:$},topLeft:{points:["bl","tl"],overflow:oe,offset:[0,-4],targetOffset:$},leftTop:{points:["tr","tl"],overflow:oe,offset:[-4,0],targetOffset:$},topRight:{points:["br","tr"],overflow:oe,offset:[0,-4],targetOffset:$},rightTop:{points:["tl","tr"],overflow:oe,offset:[4,0],targetOffset:$},bottomRight:{points:["tr","br"],overflow:oe,offset:[0,4],targetOffset:$},rightBottom:{points:["bl","br"],overflow:oe,offset:[4,0],targetOffset:$},bottomLeft:{points:["tl","bl"],overflow:oe,offset:[0,4],targetOffset:$},leftBottom:{points:["br","bl"],overflow:oe,offset:[-4,0],targetOffset:$}},Y=D},"7qnI":function(rt,Xe,X){"use strict";var oe=X("5Dmo"),$=X("3S7+"),D=X("fWQN"),Y=X("mtLc"),U=X("yKVA"),N=X("879j"),K=X("5NDa"),I=X("5rEg"),O=X("q1tI"),L=X.n(O),T=X("O2Wb"),A=X.n(T),P=I.a.TextArea,w=function(S){Object(U.a)(h,S);var x=Object(N.a)(h);function h(){return Object(D.a)(this,h),x.apply(this,arguments)}return Object(Y.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(o,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:o||"",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($.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($.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($.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(rt,Xe,X){"use strict";X.d(Xe,"e",function(){return K}),X.d(Xe,"c",function(){return O}),X.d(Xe,"d",function(){return L}),X.d(Xe,"a",function(){return A}),X.d(Xe,"f",function(){return P}),X.d(Xe,"b",function(){return w});var oe=X("KQm4"),$=X("VTBJ"),D=X("Ff2n"),Y=X("Zm9Q"),U=X("Kwbf"),N=X("OZM5");function K(S,x){return S!=null?S:x}function I(){var S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],x=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)(!x.has(m)||C===null||C===void 0,"Same 'key' exist in the Tree: ".concat(m)),x.set(m,!0),h(v,"".concat(i).concat(m," > "))})}h(S)}function O(S){function x(h){var l=Object(Y.a)(h);return l.map(function(i){if(!Object(N.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($.a)({key:c},m),E=x(v);return E.length&&(u.children=E),u}).filter(function(i){return i})}return x(S)}function L(){var S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],h=new Set(x===!0?[]:x),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(N.h)(C?C.pos:"0",m),E=K(v.key,u),d=Object($.a)(Object($.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),x===!0||h.has(E)?d.children=i(v.children||[],d):d.children=[],d})}return i(S),l}function T(S,x,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(N.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};x(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 x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},h=x.initWrapper,l=x.processEntity,i=x.onProcessFinished,c=arguments.length>2?arguments[2]:void 0,C={},v={},m={posEntities:C,keyEntities:v};return h&&(m=h(m)||m),T(S,function(u){var E=u.node,d=u.index,f=u.pos,s=u.key,o=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[o],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,x){var h=x.expandedKeys,l=x.selectedKeys,i=x.loadedKeys,c=x.loadingKeys,C=x.checkedKeys,v=x.halfCheckedKeys,m=x.dragOverNodeKey,u=x.dropPosition,E=x.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 x=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($.a)(Object($.a)({},x),{},{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(rt,Xe,X){(function(oe){oe(X("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 $=0;$<oe.modeInfo.length;$++){var D=oe.modeInfo[$];D.mimes&&(D.mime=D.mimes[0])}oe.findModeByMIME=function(Y){Y=Y.toLowerCase();for(var U=0;U<oe.modeInfo.length;U++){var N=oe.modeInfo[U];if(N.mime==Y)return N;if(N.mimes){for(var K=0;K<N.mimes.length;K++)if(N.mimes[K]==Y)return N}}if(/\+xml$/.test(Y))return oe.findModeByMIME("application/xml");if(/\+json$/.test(Y))return oe.findModeByMIME("application/json")},oe.findModeByExtension=function(Y){Y=Y.toLowerCase();for(var U=0;U<oe.modeInfo.length;U++){var N=oe.modeInfo[U];if(N.ext){for(var K=0;K<N.ext.length;K++)if(N.ext[K]==Y)return N}}},oe.findModeByFileName=function(Y){for(var U=0;U<oe.modeInfo.length;U++){var N=oe.modeInfo[U];if(N.file&&N.file.test(Y))return N}var K=Y.lastIndexOf("."),I=K>-1&&Y.substring(K+1,Y.length);if(I)return oe.findModeByExtension(I)},oe.findModeByName=function(Y){Y=Y.toLowerCase();for(var U=0;U<oe.modeInfo.length;U++){var N=oe.modeInfo[U];if(N.name.toLowerCase()==Y)return N;if(N.alias){for(var K=0;K<N.alias.length;K++)if(N.alias[K].toLowerCase()==Y)return N}}}})},"8hTe":function(rt,Xe,X){rt.exports={button:"button___1wy9m"}},"9Bee":function(rt,Xe,X){"use strict";var oe=X("DYRE"),$=X("zeV3"),D=X("+L6B"),Y=X("2/Rp"),U=X("k1fw"),N=X("9og8"),K=X("tJVT"),I=X("WmNS"),O=X.n(I),L=X("q1tI"),T=X.n(L),A=X("vg9a"),P=X("DlQD"),w=X.n(P),S=X("rUJ1");function x(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),Ye=me[0];return Ye.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=x(M,y[3]||""),W=y[2]?y[2].trim():y[2];if(["latex","katex","math"].indexOf(W)>=0){var me=s(),Ye=Q;Q=me,o[me]={type:"block",expression:Ye}}return{type:"code",raw:M,lang:W,text:Q}}}},d=/(?:\${2})([^\n`]+?)(?:\${2})/gi,f=0,s=function(){return"__special_katext_id_".concat(f++,"__")},o={};function b(){return o}function g(){f=0,o={}}function _(F){return F=F.replace(d,function(p,y){var M=s();return o[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=X("SJMd"),B=X("ulZh"),te=X.n(B),de=X("m3rI"),pe=X("Oy/b"),ye=X("p5ED"),Ce=X("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{dt(M.next(jt))}catch(Qe){W(Qe)}}function Ye(jt){try{dt(M.throw(jt))}catch(Qe){W(Qe)}}function dt(jt){var Qe;jt.done?Q(jt.value):(Qe=jt.value,Qe instanceof y?Qe:new y(function(Vt){Vt(Qe)})).then(me,Ye)}dt((M=M.apply(F,p||[])).next())})}function ve(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:Ye(0),throw:Ye(1),return:Ye(2)},typeof Symbol=="function"&&(W[Symbol.iterator]=function(){return this}),W;function Ye(dt){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}}([dt,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,Ye=W.length;me<Ye;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],Ye=W[1];p.setAttribute(me,Ye)}},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,Ye){var dt=document.createElementNS("http://www.w3.org/2000/svg","marker");return F.setAttributes(dt,[["id",p],["orient",y],["markerWidth",M.toString()],["markerHeight",Q.toString()],["refX",W.toString()],["refY",me.toString()]]),dt.appendChild(Ye),dt},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}(),xe=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}(),Ie=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 Ye=document.createElementNS("http://www.w3.org/2000/svg","svg");Ye.setAttribute("xmlns","http://www.w3.org/2000/svg"),Ye.setAttribute("width",y.width.baseVal.valueAsString),Ye.setAttribute("height",y.height.baseVal.valueAsString),Ye.setAttribute("viewBox","0 0 "+y.viewBox.baseVal.width.toString()+" "+y.viewBox.baseVal.height.toString()),Ye.innerHTML=y.innerHTML,Q.naturalSize===!0?(Ye.width.baseVal.value=p.naturalWidth,Ye.height.baseVal.value=p.naturalHeight):Q.width!==void 0&&Q.height!==void 0&&(Ye.width.baseVal.value=Q.width,Ye.height.baseVal.value=Q.height),me.width=Ye.width.baseVal.value,me.height=Ye.height.baseVal.value;var dt=Ye.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([dt],{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}(),We=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 Ye=document.createElement("div");Ye.className=Q.toolboxButtonStyleClass.name+" "+((me=Q.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&me!==void 0?me:Q.toolboxButtonStyleColorsClass.name),Ye.innerHTML=W.icon,Ye.title=W.title,Ye.addEventListener("click",function(){Q.panelButtonClick(W)}),Q.panelButtons.push(Ye),Q.buttonRow.appendChild(Ye)}),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 Ye,dt;W.className=y.toolboxButtonStyleClass.name+" "+(me===M?""+((Ye=y.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Ye!==void 0?Ye:y.toolboxActiveButtonStyleColorsClass.name):""+((dt=y.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&dt!==void 0?dt: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 Ye=document.createElement("div");return Ye.style.display="inline-block",Ye.style.width=W-2+"px",Ye.style.height=W-2+"px",Ye.style.backgroundColor=y,Ye.style.borderRadius=W/2+"px",y==="transparent"&&(Ye.style.fill=this.uiStyleSettings.toolboxAccentColor,Ye.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(Ye),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),Ge=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}(),ke=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}(),ct=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}(),ut=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}(),vt=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 ke,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 ct;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,Ye=this.height+this.CB_DISTANCE-y/2,dt=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,dt,Q),this.positionGrip(this.controlGrips.centerLeft.visual,M,me),this.positionGrip(this.controlGrips.centerRight.visual,dt,me),this.positionGrip(this.controlGrips.bottomLeft.visual,M,Ye),this.positionGrip(this.controlGrips.bottomCenter.visual,W,Ye),this.positionGrip(this.controlGrips.bottomRight.visual,dt,Ye),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:ut.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:ut.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(ut.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,M.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(ut.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}(Ge),lt=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}(vt),Tt=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 Ye=document.createElement("div");Ye.style.minHeight="20px",Ye.style.flexGrow="2",Ye.style.display="flex",Ye.style.alignItems="center";var dt=document.createElement("hr");dt.style.minWidth="20px",dt.style.border="0px",dt.style.borderTop=Q+"px solid "+y.uiStyleSettings.toolboxColor,dt.style.flexGrow="2",Ye.appendChild(dt),W.appendChild(Ye),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),gt=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 Ye=`<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=Ye,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 Tt("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),W.strokeWidthPanel.onWidthChanged=W.setStrokeWidth,W.strokeStylePanel=new gt("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}(lt),Oe=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 ct;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}(Ge),St=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 Tt("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),W.strokeWidthPanel.onWidthChanged=W.setStrokeWidth,W.strokeStylePanel=new gt("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 Ye=document.createElement("div");Ye.style.whiteSpace="nowrap",Ye.style.overflow="hidden",Ye.style.textOverflow="ellipsis",Ye.innerHTML="The quick brown fox jumps over the lazy dog",me.appendChild(Ye),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}(vt),Ee=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 Tt("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],Ye=M[3],dt=!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&&(dt=!0,jt<W&&(W=jt),Qe<Q&&(Q=Qe),jt>Ye&&(Ye=jt),Qe>me&&(me=Qe));if(dt){this.left=Q/this.pixelRatio,this.top=W/this.pixelRatio,this.width=(me-Q)/this.pixelRatio,this.height=(Ye-W)/this.pixelRatio;var Vt=document.createElement("canvas");Vt.width=me-Q,Vt.height=Ye-W,Vt.getContext("2d").putImageData(this.canvasContext.getImageData(Q,W,me-Q,Ye-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}(vt),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(Ye){var dt="both";switch(Ye){case 0:dt="both";break;case 1:dt="start";break;case 2:dt="end";break;case 3:dt="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=dt===W.currentType?W.uiStyleSettings.toolboxAccentColor:"transparent",jt.addEventListener("click",function(){y.setCurrentType(dt,jt)}),M.appendChild(jt),dt==="both"||dt==="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),dt==="both"||dt==="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}(St),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}(lt),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),ce='<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,ce),W.bgColorPanel.onColorChanged=W.setBgColor,W.fontFamilyPanel=new Ue("Font",Q.defaultFontFamilies,Q.defaultFontFamily),W.fontFamilyPanel.onFontChanged=W.setFont,W.tipGrip=new ct,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,ce),W.fillPanel.onColorChanged=W.setFillColor,W.strokeWidthPanel=new Tt("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),W.strokeWidthPanel.onWidthChanged=W.setStrokeWidth,W.strokeStylePanel=new gt("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}(vt),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}(St),tt=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),Fe=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}(),$e=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 Tt("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),W.strokeWidthPanel.onWidthChanged=W.setStrokeWidth,W.strokeStylePanel=new gt("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}(),ot=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),ft=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 Oe,this._isOpen=!1,this.undoRedoManager=new Fe,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,Ee,be,Ze,tt,we,ae,ue,Le,ne,St,$e]},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[yt,Ee,be,Ze,we,ae,ue]},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"BASIC_MARKER_TYPES",{get:function(){return[yt,Ee,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(),xe.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 ve(this,function(y){switch(y.label){case 0:return this.setCurrentMarker(),(p=new Ie).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 We(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 ft(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 ft(p,M))})}}},F.prototype.clear=function(){var p=this,y=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(me){var Ye=new ft(p,void 0,!0);me(Ye),Ye.defaultPrevented&&(y=!0)}),!y)){this.setCurrentMarker();for(var M=function(me){var Ye=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(dt){return dt(new ft(p,Ye))})},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 ve(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 ot(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 ft(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 Ee&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(Ee):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(M){return M(new ft(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 ft(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 ft(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 ft(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){xe.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{dt(M.next(jt))}catch(Qe){W(Qe)}}function Ye(jt){try{dt(M.throw(jt))}catch(Qe){W(Qe)}}function dt(jt){var Qe;jt.done?Q(jt.value):(Qe=jt.value,Qe instanceof y?Qe:new y(function(Vt){Vt(Qe)})).then(me,Ye)}dt((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:Ye(0),throw:Ye(1),return:Ye(2)},typeof Symbol=="function"&&(W[Symbol.iterator]=function(){return this}),W;function Ye(dt){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}}([dt,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}(),it=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],Ye=W[1];p.setAttribute(me,Ye)}},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,Ye){var dt=document.createElementNS("http://www.w3.org/2000/svg","marker");return F.setAttributes(dt,[["id",p],["orient",y],["markerWidth",M.toString()],["markerHeight",Q.toString()],["refX",W.toString()],["refY",me.toString()]]),dt.appendChild(Ye),dt},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,Ye,dt){return"M"+p+","+y+"V"+(y+Q)+"H"+(p+M)+"V"+y+"H"+W+"V"+me+"H"+(W+Ye)+"V"+(me+dt)+"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),at=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}(),Yt=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 Ye=it.createDefs();me.appendChild(Ye);var dt=it.createElement("clipPath",[["id","text-bg-clip"]]);Ye.appendChild(dt);var jt=it.createPath(it.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=it.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Qe.appendChild(it.createTSpan(p+":"+y)),me.appendChild(Qe);var Vt=Qe.getBBox();it.setAttributes(Qe,[["x",((24-Vt.width)/2).toString()],["y",((24-Vt.height)/2-Vt.y).toString()]]);var hn=it.createPath(it.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 dt.appendChild(hn),it.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}(at),qt=function(){function F(p,y){this.GRIP_SIZE=10,this.color=p,this.fillColor=y,this.visual=it.createGroup(),this.visual.appendChild(it.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(it.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 it.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&&it.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=it.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=it.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var y=0;y<this.numberOfGridLines;y++)this.horizontalGridLines.push(it.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(it.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=it.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),it.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 Ye=y.y+M*(me+1);it.setAttributes(W,[["x1",""+y.x],["y1",""+Ye],["x2",""+(y.x+y.width)],["y2",""+Ye]])});var Q=y.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(W,me){var Ye=y.x+Q*(me+1);it.setAttributes(W,[["x1",""+Ye],["y1",""+y.y],["x2",""+Ye],["y2",""+(y.y+y.height)]])}),it.setAttributes(this.cropShadeElement,[["d",it.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 Ye=M/p,dt=Q/y;return{x:(W.x-me)*Ye+me,y:(W.y-me)*dt+me,width:W.width*Ye,height:W.height*dt}},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();it.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=it.createPath(y);var W=it.createTransform();this.scaleShape.transform.baseVal.appendItem(W),p.appendChild(this.scaleShape),this.angleLabelElement=it.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=it.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var me=it.createTSpan("");return me.innerHTML="&deg;",this.angleLabelElement.appendChild(me),p.appendChild(this.angleLabelElement),document.body.removeChild(p),p},F}(),ht=function(){function F(){this.naturalSize=!1,this.imageType="image/png"}return F.prototype.rasterize=function(p,y,M,Q,W,me,Ye){var dt=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;dt.naturalSize===!0?(Vt=y.naturalWidth/(p.width.baseVal.value-2*Q)/me,hn=y.naturalHeight/(p.height.baseVal.value-2*Q)/Ye,Qe.width=y.naturalWidth/me,Qe.height=y.naturalHeight/Ye):dt.width!==void 0&&dt.height!==void 0&&(Vt=dt.width/M.width,hn=dt.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,Ye),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(dt.imageType,dt.imageQuality))})},F}(),Ke=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",it.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();it.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=it.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=it.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=it.createGroup(),this.editingTargetRotationScaleContainer=it.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var p=it.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(p);var y=it.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(y),this.editingTargetContainer=it.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=it.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 at(Yt.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(Yt.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 at('<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 at('<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 Ye=document.createElement("div");Ye.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var dt=document.createElement("a");dt.style.color="currentColor",dt.href="https://markerjs.com/products/cropro",dt.target="_blank",dt.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>',Ye.appendChild(dt),me.addElement(Ye)}var jt=new Lt;jt.minWidth=3*this.toolbarHeight+"px",jt.contentAlign="end",this.topToolbar.addButtonBlock(jt);var Qe=new at('<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 at('<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 at('<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 at('<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 Ye=new at('<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");Ye.onClick=this.flipHorizontallyButtonClicked,me.addButton(Ye);var dt=new at('<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");dt.onClick=this.flipVerticallyButtonClicked,me.addButton(dt)},F.prototype.ratioButtonClicked=function(p){this.aspectRatio=p,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},F.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=Yt.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 ht).naturalSize=this.renderAtNaturalSize,p.imageType=this.renderImageType,p.imageQuality=this.renderImageQuality,p.width=this.renderWidth,p.height=this.renderHeight,this.unzoomFromCrop(),it.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=X("8hTe"),Hn=X.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,Ye=F.showLines,dt=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],nt=Object(L.useState)("office"),Ht=Object(K.a)(nt,2),Ot=Ht[0],Nt=Ht[1],Xt=function(){var mn=new Ke(Rr.current);mn.displayMode="popup",mn.addRenderEventListener(function(){var Ln=Object(N.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&&dt(Rr.current.getAttribute("src").replace(de.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(N.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&&dt(Rr.current.getAttribute("src").replace(de.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,"("+de.a.API_SERVER+"/api/attachments/").replace(mn,'"'+de.a.API_SERVER+"/api/attachments/").replace(Ln,'"'+de.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=Ye,Ye&&(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 T.a.createElement("div",{style:{position:"relative"}},T.a.createElement("div",{ref:un,style:Object(U.a)({},hn),className:"".concat(W||""," markdown-body ").concat(Hn.a.mdBody),onMouseOver:ir,dangerouslySetInnerHTML:{__html:Sn}}),T.a.createElement("div",{ref:xn,className:Hn.a.button},T.a.createElement($.a,null,T.a.createElement(Y.a,{onClick:function(){return Xt()}},"\u88C1\u526A"),T.a.createElement(Y.a,{onClick:function(){return Dn()}},"\u7F16\u8F91"))),T.a.createElement("img",{ref:Rr,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),T.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(rt,Xe,X){"use strict";X.d(Xe,"a",function(){return D});var oe=X("q1tI"),$=X.n(oe);function D(Y,U){var N=Object(oe.useRef)();Object(oe.useEffect)(function(){N.current=Y}),Object(oe.useEffect)(function(){function K(){N.current()}if(U!==null){var I=setInterval(K,U);return function(){return clearInterval(I)}}},[U])}},"A+k2":function(rt,Xe,X){rt.exports={tabs:"tabs___2hYAP",active:"active___2Xkwd"}},Bd2K:function(rt,Xe,X){(function(oe){oe(X("VrN/"),X("osHv"))})(function(oe){oe.defineOption("autoCloseTags",!1,function(O,L,T){if(T!=oe.Init&&T&&O.removeKeyMap("autoCloseTags"),!L)return;var A={name:"autoCloseTags"};(typeof L!="object"||L.whenClosing!==!1)&&(A["'/'"]=function(P){return N(P)}),(typeof L!="object"||L.whenOpening!==!1)&&(A["'>'"]=function(P){return Y(P)}),O.addKeyMap(A)});var $=["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 Y(O){if(O.getOption("disableInput"))return oe.Pass;for(var L=O.listSelections(),T=[],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),x=oe.innerMode(O.getMode(),S.state),h=x.state,l=x.mode.xmlCurrentTag&&x.mode.xmlCurrentTag(h),i=l&&l.name;if(!i)return oe.Pass;var c=x.mode.configuration=="html",C=typeof A=="object"&&A.dontCloseTags||c&&$,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||I(O,x.mode.xmlCurrentContext&&x.mode.xmlCurrentContext(h)||[],i,w,!0))return oe.Pass;var u=typeof A=="object"&&A.emptyTags;if(u&&K(u,i)>-1){T[P]={text:"/>",newPos:oe.Pos(w.line,w.ch+2)};continue}var E=v&&K(v,m)>-1;T[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=T[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 T=O.listSelections(),A=[],P=L?"/":"</",w=O.getOption("autoCloseTags"),S=typeof w=="object"&&w.dontIndentOnSlash,x=0;x<T.length;x++){if(!T[x].empty())return oe.Pass;var h=T[x].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&&I(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[x]=C}if(O.replaceSelections(A),T=O.listSelections(),!S)for(var x=0;x<T.length;x++)(x==T.length-1||T[x].head.line<T[x+1].head.line)&&O.indentLine(T[x].head.line)}function N(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 T=0,A=O.length;T<A;++T)if(O[T]==L)return T;return-1}function I(O,L,T,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!=T)return!1;for(var x=P?1:0,h=L.length-1;h>=0&&L[h]==T;h--)++x;A=S.to;for(var h=1;h<x;h++){var l=oe.scanForClosingTag(O,A,null,w);if(!l||l.tag!=T)return!1;A=l.to}return!0}})},BjJ7:function(rt,Xe,X){"use strict";X.d(Xe,"d",function(){return $}),X.d(Xe,"c",function(){return D}),X.d(Xe,"e",function(){return Y}),X.d(Xe,"b",function(){return U}),X.d(Xe,"a",function(){return K});var oe=X("m3rI");function $(I){var O=!0;if(I.length>0){for(var L=0;L<I.length;L++)if(I[L].compile_success==0||!I[L].compile_success){O=!1;break}}else O=!1;return O}function D(I){for(var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",L=[],T=0;T<I.length;T++){var A=I[T],P=O?"".concat(O,"/").concat(A.name):"".concat(A.name);L.push({title:A.name,isLeaf:!(A.type==="tree"),key:P})}return L}function Y(I,O,L){for(var T=0;T<I.length;T++){var A=I[T];if(A.key===O){A.children=L;break}A.children&&Y(A.children,O,L)}return I}function U(I,O,L){var T;return function(){var A=this,P=arguments,w=function(){T=null,L||I.apply(A,P)},S=L&&!T;clearTimeout(T),T=setTimeout(w,O),S&&I.apply(A,P)}}var N=!0,K=oe.a.API_SERVER},"C+DQ":function(rt,Xe,X){},DlQD:function(rt,Xe,X){(function(oe,$){rt.exports=$()})(this,function(){"use strict";function oe(Ee,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(Ee,ne.key,ne)}}function $(Ee,fe,be){return fe&&oe(Ee.prototype,fe),be&&oe(Ee,be),Ee}function D(Ee,fe){if(!Ee)return;if(typeof Ee=="string")return Y(Ee,fe);var be=Object.prototype.toString.call(Ee).slice(8,-1);if(be==="Object"&&Ee.constructor&&(be=Ee.constructor.name),be==="Map"||be==="Set")return Array.from(Ee);if(be==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(be))return Y(Ee,fe)}function Y(Ee,fe){(fe==null||fe>Ee.length)&&(fe=Ee.length);for(var be=0,ne=new Array(fe);be<fe;be++)ne[be]=Ee[be];return ne}function U(Ee,fe){var be;if(typeof Symbol=="undefined"||Ee[Symbol.iterator]==null){if(Array.isArray(Ee)||(be=D(Ee))||fe&&Ee&&typeof Ee.length=="number"){be&&(Ee=be);var ne=0;return function(){return ne>=Ee.length?{done:!0}:{done:!1,value:Ee[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=Ee[Symbol.iterator](),be.next.bind(be)}function N(Ee,fe){return fe={exports:{}},Ee(fe,fe.exports),fe.exports}var K=N(function(Ee){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){Ee.exports.defaults=ne}Ee.exports={defaults:fe(),getDefaults:fe,changeDefaults:be}}),I=K.defaults,O=K.getDefaults,L=K.changeDefaults,T=/[&<>"']/,A=/[&<>"']/g,P=/[<>"']|&(?!#?\w+;)/,w=/[<>"']|&(?!#?\w+;)/g,S={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},x=function(fe){return S[fe]};function h(Ee,fe){if(fe){if(T.test(Ee))return Ee.replace(A,x)}else if(P.test(Ee))return Ee.replace(w,x);return Ee}var l=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function i(Ee){return Ee.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(Ee,fe){Ee=Ee.source||Ee,fe=fe||"";var be={replace:function(re,ae){return ae=ae.source||ae,ae=ae.replace(c,"$1"),Ee=Ee.replace(re,ae),be},getRegex:function(){return new RegExp(Ee,fe)}};return be}var v=/[^\w:]/g,m=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function u(Ee,fe,be){if(Ee){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=o(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 o(Ee,fe){E[" "+Ee]||(d.test(Ee)?E[" "+Ee]=Ee+"/":E[" "+Ee]=k(Ee,"/",!0)),Ee=E[" "+Ee];var be=Ee.indexOf(":")===-1;return fe.substring(0,2)==="//"?be?fe:Ee.replace(f,"$1")+fe:fe.charAt(0)==="/"?be?fe:Ee.replace(s,"$1")+fe:Ee+fe}var b={exec:function(){}};function g(Ee){for(var fe=1,be,ne;fe<arguments.length;fe++){be=arguments[fe];for(ne in be)Object.prototype.hasOwnProperty.call(be,ne)&&(Ee[ne]=be[ne])}return Ee}function _(Ee,fe){var be=Ee.replace(/\|/g,function(ae,ce,ue){for(var we=!1,Le=ce;--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(Ee,fe,be){var ne=Ee.length;if(ne===0)return"";for(var re=0;re<ne;){var ae=Ee.charAt(ne-re-1);if(ae===fe&&!be)re++;else if(ae!==fe&&be)re++;else break}return Ee.substr(0,ne-re)}function H(Ee,fe){if(Ee.indexOf(fe[1])===-1)return-1;for(var be=Ee.length,ne=0,re=0;re<be;re++)if(Ee[re]==="\\")re++;else if(Ee[re]===fe[0])ne++;else if(Ee[re]===fe[1]&&(ne--,ne<0))return re;return-1}function z(Ee){Ee&&Ee.sanitize&&!Ee.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:o,noopTest:b,merge:g,splitCells:_,rtrim:k,findClosingBracket:H,checkSanitizeDeprecation:z},G=K.defaults,B=Z.rtrim,te=Z.splitCells,de=Z.escape,pe=Z.findClosingBracket;function ye(Ee,fe,be){var ne=fe.href,re=fe.title?de(fe.title):null,ae=Ee[1].replace(/\\([\[\]])/g,"$1");return Ee[0].charAt(0)!=="!"?{type:"link",raw:be,href:ne,title:re,text:ae}:{type:"image",raw:be,href:ne,title:re,text:de(ae)}}function Ce(Ee,fe){var be=Ee.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 ce=ae[0];return ce.length>=ne.length?re.slice(ne.length):re}).join(`
`)}var _e=function(){function Ee(be){this.options=be||G}var fe=Ee.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 ce=re[re.length-1];if(ce&&ce.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],ce=Ce(ae,re[3]||"");return{type:"code",raw:ae,lang:re[2]?re[2].trim():re[2],text:ce}}},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 ce=ae.align.length,ue;for(ue=0;ue<ce;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(ce=ae.cells.length,ue=0;ue<ce;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],ce=re[2],ue=ce.length>1,we=ce[ce.length-1]===")",Le={type:"list",raw:ae,ordered:ue,start:ue?+ce.slice(0,-1):"",loose:!1,items:[]},tt=re[0].match(this.rules.block.item),Fe=!1,$e,Dt,ot,ft,zt,Je,Kt,sn=tt.length,Bt=0;Bt<sn;Bt++)$e=tt[Bt],ae=$e,Dt=$e.length,$e=$e.replace(/^ *([*+-]|\d+[.)]) */,""),~$e.indexOf(`
`)&&(Dt-=$e.length,$e=this.options.pedantic?$e.replace(/^ {1,4}/gm,""):$e.replace(new RegExp("^ {1,"+Dt+"}","gm"),"")),Bt!==sn-1&&(ot=this.rules.block.bullet.exec(tt[Bt+1])[0],(ue?ot.length===1||!we&&ot[ot.length-1]===")":ot.length>1||this.options.smartLists&&ot!==ce)&&(ft=tt.slice(Bt+1).join(`
`),Le.raw=Le.raw.substring(0,Le.raw.length-ft.length),Bt=sn-1)),zt=Fe||/\n\n(?!\s*$)/.test($e),Bt!==sn-1&&(Fe=$e.charAt($e.length-1)===`
`,zt||(zt=Fe)),zt&&(Le.loose=!0),Je=/^\[[ xX]\] /.test($e),Kt=void 0,Je&&(Kt=$e[1]!==" ",$e=$e.replace(/^\[[ xX]\] +/,"")),Le.items.push({type:"list_item",raw:ae,task:Je,checked:Kt,loose:zt,text:$e});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]):de(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 ce=ae.align.length,ue;for(ue=0;ue<ce;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(ce=ae.cells.length,ue=0;ue<ce;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 ce=re[re.length-1];return ce&&ce.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:de(re[1])}},fe.tag=function(ne,re,ae){var ce=this.rules.inline.tag.exec(ne);if(ce)return!re&&/^<a /i.test(ce[0])?re=!0:re&&/^<\/a>/i.test(ce[0])&&(re=!1),!ae&&/^<(pre|code|kbd|script)(\s|>)/i.test(ce[0])?ae=!0:ae&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ce[0])&&(ae=!1),{type:this.options.sanitize?"text":"html",raw:ce[0],inLink:re,inRawBlock:ae,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ce[0]):de(ce[0]):ce[0]}},fe.link=function(ne){var re=this.rules.inline.link.exec(ne);if(re){var ae=pe(re[2],"()");if(ae>-1){var ce=re[0].indexOf("!")===0?5:4,ue=ce+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 tt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(we);tt?(we=tt[1],Le=tt[3]):Le=""}else Le=re[3]?re[3].slice(1,-1):"";we=we.trim().replace(/^<([\s\S]*)>$/,"$1");var Fe=ye(re,{href:we&&we.replace(this.rules.inline._escapes,"$1"),title:Le&&Le.replace(this.rules.inline._escapes,"$1")},re[0]);return Fe}},fe.reflink=function(ne,re){var ae;if((ae=this.rules.inline.reflink.exec(ne))||(ae=this.rules.inline.nolink.exec(ne))){var ce=(ae[2]||ae[1]).replace(/\s+/g," ");if(ce=re[ce.toLowerCase()],!ce||!ce.href){var ue=ae[0].charAt(0);return{type:"text",raw:ue,text:ue}}var we=ye(ae,ce,ae[0]);return we}},fe.strong=function(ne,re,ae){ae===void 0&&(ae="");var ce=this.rules.inline.strong.start.exec(ne);if(ce&&(!ce[1]||ce[1]&&(ae===""||this.rules.inline.punctuation.exec(ae)))){re=re.slice(-1*ne.length);var ue=ce[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ue.lastIndex=0;for(var we;(ce=ue.exec(re))!=null;)if(we=this.rules.inline.strong.middle.exec(re.slice(0,ce.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 ce=this.rules.inline.em.start.exec(ne);if(ce&&(!ce[1]||ce[1]&&(ae===""||this.rules.inline.punctuation.exec(ae)))){re=re.slice(-1*ne.length);var ue=ce[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ue.lastIndex=0;for(var we;(ce=ue.exec(re))!=null;)if(we=this.rules.inline.em.middle.exec(re.slice(0,ce.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," "),ce=/[^ ]/.test(ae),ue=ae.startsWith(" ")&&ae.endsWith(" ");return ce&&ue&&(ae=ae.substring(1,ae.length-1)),ae=de(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 ce,ue;return ae[2]==="@"?(ce=de(this.options.mangle?re(ae[1]):ae[1]),ue="mailto:"+ce):(ce=de(ae[1]),ue=ce),{type:"link",raw:ae[0],text:ce,href:ue,tokens:[{type:"text",raw:ce,text:ce}]}}},fe.url=function(ne,re){var ae;if(ae=this.rules.inline.url.exec(ne)){var ce,ue;if(ae[2]==="@")ce=de(this.options.mangle?re(ae[0]):ae[0]),ue="mailto:"+ce;else{var we;do we=ae[0],ae[0]=this.rules.inline._backpedal.exec(ae[0])[0];while(we!==ae[0]);ce=de(ae[0]),ae[1]==="www."?ue="http://"+ce:ue=ce}return{type:"link",raw:ae[0],text:ce,href:ue,tokens:[{type:"text",raw:ce,text:ce}]}}},fe.inlineText=function(ne,re,ae){var ce=this.rules.inline.text.exec(ne);if(ce){var ue;return re?ue=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ce[0]):de(ce[0]):ce[0]:ue=de(this.options.smartypants?ae(ce[0]):ce[0]),{type:"text",raw:ce[0],text:ue}}},Ee}(),le=Z.noopTest,se=Z.edit,ve=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=ve({},ie),ie.gfm=ve({},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=ve({},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=ve({},q),q.pedantic=ve({},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=ve({},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=ve({},q.gfm,{br:se(q.br).replace("{2,}","*").getRegex(),text:se(q.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var xe={block:ie,inline:q},Ie=K.defaults,Ne=xe.block,De=xe.inline;function Be(Ee){return Ee.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(Ee){var fe="",be,ne,re=Ee.length;for(be=0;be<re;be++)ne=Ee.charCodeAt(be),Math.random()>.5&&(ne="x"+ne.toString(16)),fe+="&#"+ne+";";return fe}var Pe=function(){function Ee(be){this.tokens=[],this.tokens.links=Object.create(null),this.options=be||Ie,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}Ee.lex=function(ne,re){var ae=new Ee(re);return ae.lex(ne)};var fe=Ee.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 ce,ue,we,Le;ne;){if(ce=this.tokenizer.space(ne)){ne=ne.substring(ce.raw.length),ce.type&&re.push(ce);continue}if(ce=this.tokenizer.code(ne,re)){ne=ne.substring(ce.raw.length),ce.type?re.push(ce):(Le=re[re.length-1],Le.raw+=`
`+ce.raw,Le.text+=`
`+ce.text);continue}if(ce=this.tokenizer.fences(ne)){ne=ne.substring(ce.raw.length),re.push(ce);continue}if(ce=this.tokenizer.heading(ne)){ne=ne.substring(ce.raw.length),re.push(ce);continue}if(ce=this.tokenizer.nptable(ne)){ne=ne.substring(ce.raw.length),re.push(ce);continue}if(ce=this.tokenizer.hr(ne)){ne=ne.substring(ce.raw.length),re.push(ce);continue}if(ce=this.tokenizer.blockquote(ne)){ne=ne.substring(ce.raw.length),ce.tokens=this.blockTokens(ce.text,[],ae),re.push(ce);continue}if(ce=this.tokenizer.list(ne)){for(ne=ne.substring(ce.raw.length),we=ce.items.length,ue=0;ue<we;ue++)ce.items[ue].tokens=this.blockTokens(ce.items[ue].text,[],!1);re.push(ce);continue}if(ce=this.tokenizer.html(ne)){ne=ne.substring(ce.raw.length),re.push(ce);continue}if(ae&&(ce=this.tokenizer.def(ne))){ne=ne.substring(ce.raw.length),this.tokens.links[ce.tag]||(this.tokens.links[ce.tag]={href:ce.href,title:ce.title});continue}if(ce=this.tokenizer.table(ne)){ne=ne.substring(ce.raw.length),re.push(ce);continue}if(ce=this.tokenizer.lheading(ne)){ne=ne.substring(ce.raw.length),re.push(ce);continue}if(ae&&(ce=this.tokenizer.paragraph(ne))){ne=ne.substring(ce.raw.length),re.push(ce);continue}if(ce=this.tokenizer.text(ne,re)){ne=ne.substring(ce.raw.length),ce.type?re.push(ce):(Le=re[re.length-1],Le.raw+=`
`+ce.raw,Le.text+=`
`+ce.text);continue}if(ne){var tt="Infinite loop on byte: "+ne.charCodeAt(0);if(this.options.silent){console.error(tt);break}else throw new Error(tt)}}return re},fe.inline=function(ne){var re,ae,ce,ue,we,Le,tt=ne.length;for(re=0;re<tt;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]=[],ce=0;ce<we.length;ce++)Le.tokens.cells[ae][ce]=[],this.inlineTokens(we[ce],Le.tokens.cells[ae][ce]);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,ce,ue){re===void 0&&(re=[]),ae===void 0&&(ae=!1),ce===void 0&&(ce=!1),ue===void 0&&(ue="");var we,Le=ne,tt;if(this.tokens.links){var Fe=Object.keys(this.tokens.links);if(Fe.length>0)for(;(tt=this.tokenizer.rules.inline.reflinkSearch.exec(Le))!=null;)Fe.includes(tt[0].slice(tt[0].lastIndexOf("[")+1,-1))&&(Le=Le.slice(0,tt.index)+"["+"a".repeat(tt[0].length-2)+"]"+Le.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(tt=this.tokenizer.rules.inline.blockSkip.exec(Le))!=null;)Le=Le.slice(0,tt.index)+"["+"a".repeat(tt[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,ce)){ne=ne.substring(we.raw.length),ae=we.inLink,ce=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,ce)),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,ce)),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,ce),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,ce),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,ce),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,ce,Be)){ne=ne.substring(we.raw.length),ue=we.raw.slice(-1),re.push(we);continue}if(ne){var $e="Infinite loop on byte: "+ne.charCodeAt(0);if(this.options.silent){console.error($e);break}else throw new Error($e)}}return re},$(Ee,null,[{key:"rules",get:function(){return{block:Ne,inline:De}}}]),Ee}(),We=K.defaults,ze=Z.cleanUrl,qe=Z.escape,Ge=function(){function Ee(be){this.options=be||We}var fe=Ee.prototype;return fe.code=function(ne,re,ae){var ce=(re||"").match(/\S*/)[0];if(this.options.highlight){var ue=this.options.highlight(ne,ce);ue!=null&&ue!==ne&&(ae=!0,ne=ue)}return ce?'<pre><code class="'+this.options.langPrefix+qe(ce,!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,ce){return this.options.headerIds?"<h"+re+' id="'+this.options.headerPrefix+ce.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 ce=re?"ol":"ul",ue=re&&ae!==1?' start="'+ae+'"':"";return"<"+ce+ue+`>
`+ne+"</"+ce+`>
`},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",ce=re.align?"<"+ae+' align="'+re.align+'">':"<"+ae+">";return ce+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 ce='<a href="'+qe(ne)+'"';return re&&(ce+=' title="'+re+'"'),ce+=">"+ae+"</a>",ce},fe.image=function(ne,re,ae){if(ne=ze(this.options.sanitize,this.options.baseUrl,ne),ne===null)return ae;var ce='<img src="'+ne+'" alt="'+ae+'"';return re&&(ce+=' title="'+re+'"'),ce+=this.options.xhtml?"/>":">",ce},fe.text=function(ne){return ne},Ee}(),ke=function(){function Ee(){}var fe=Ee.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""},Ee}(),ct=function(){function Ee(){this.seen={}}var fe=Ee.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},Ee}(),ut=K.defaults,vt=Z.unescape,lt=function(){function Ee(be){this.options=be||ut,this.options.renderer=this.options.renderer||new Ge,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new ke,this.slugger=new ct}Ee.parse=function(ne,re){var ae=new Ee(re);return ae.parse(ne)};var fe=Ee.prototype;return fe.parse=function(ne,re){re===void 0&&(re=!0);var ae="",ce,ue,we,Le,tt,Fe,$e,Dt,ot,ft,zt,Je,Kt,sn,Bt,an,Qt,it,Ft=ne.length;for(ce=0;ce<Ft;ce++){ft=ne[ce];switch(ft.type){case"space":continue;case"hr":{ae+=this.renderer.hr();continue}case"heading":{ae+=this.renderer.heading(this.parseInline(ft.tokens),ft.depth,vt(this.parseInline(ft.tokens,this.textRenderer)),this.slugger);continue}case"code":{ae+=this.renderer.code(ft.text,ft.lang,ft.escaped);continue}case"table":{for(Dt="",$e="",Le=ft.header.length,ue=0;ue<Le;ue++)$e+=this.renderer.tablecell(this.parseInline(ft.tokens.header[ue]),{header:!0,align:ft.align[ue]});for(Dt+=this.renderer.tablerow($e),ot="",Le=ft.cells.length,ue=0;ue<Le;ue++){for(Fe=ft.tokens.cells[ue],$e="",tt=Fe.length,we=0;we<tt;we++)$e+=this.renderer.tablecell(this.parseInline(Fe[we]),{header:!1,align:ft.align[we]});ot+=this.renderer.tablerow($e)}ae+=this.renderer.table(Dt,ot);continue}case"blockquote":{ot=this.parse(ft.tokens),ae+=this.renderer.blockquote(ot);continue}case"list":{for(zt=ft.ordered,Je=ft.start,Kt=ft.loose,Le=ft.items.length,ot="",ue=0;ue<Le;ue++)Bt=ft.items[ue],an=Bt.checked,Qt=Bt.task,sn="",Bt.task&&(it=this.renderer.checkbox(an),Kt?Bt.tokens.length>0&&Bt.tokens[0].type==="text"?(Bt.tokens[0].text=it+" "+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=it+" "+Bt.tokens[0].tokens[0].text)):Bt.tokens.unshift({type:"text",text:it}):sn+=it),sn+=this.parse(Bt.tokens,Kt),ot+=this.renderer.listitem(sn,Qt,an);ae+=this.renderer.list(ot,zt,Je);continue}case"html":{ae+=this.renderer.html(ft.text);continue}case"paragraph":{ae+=this.renderer.paragraph(this.parseInline(ft.tokens));continue}case"text":{for(ot=ft.tokens?this.parseInline(ft.tokens):ft.text;ce+1<Ft&&ne[ce+1].type==="text";)ft=ne[++ce],ot+=`
`+(ft.tokens?this.parseInline(ft.tokens):ft.text);ae+=re?this.renderer.paragraph(ot):ot;continue}default:{var xt='Token with "'+ft.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="",ce,ue,we=ne.length;for(ce=0;ce<we;ce++){ue=ne[ce];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},Ee}(),Tt=Z.merge,gt=Z.checkSanitizeDeprecation,yt=Z.escape,Oe=K.getDefaults,Pt=K.changeDefaults,St=K.defaults;function Ue(Ee,fe,be){if(typeof Ee=="undefined"||Ee===null)throw new Error("marked(): input parameter is undefined or null");if(typeof Ee!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(Ee)+", string expected");if(typeof fe=="function"&&(be=fe,fe=null),fe=Tt({},Ue.defaults,fe||{}),gt(fe),be){var ne=fe.highlight,re;try{re=Pe.lex(Ee,fe)}catch(we){return be(we)}var ae=function(Le){var tt;if(!Le)try{tt=lt.parse(re,fe)}catch(Fe){Le=Fe}return fe.highlight=ne,Le?be(Le):be(null,tt)};if(!ne||ne.length<3)return ae();if(delete fe.highlight,!re.length)return ae();var ce=0;Ue.walkTokens(re,function(we){we.type==="code"&&(ce++,setTimeout(function(){ne(we.text,we.lang,function(Le,tt){if(Le)return ae(Le);tt!=null&&tt!==we.text&&(we.text=tt,we.escaped=!0),ce--,ce===0&&ae()})},0))}),ce===0&&ae();return}try{var ue=Pe.lex(Ee,fe);return fe.walkTokens&&Ue.walkTokens(ue,fe.walkTokens),lt.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(Ee){return Tt(Ue.defaults,Ee),Pt(Ue.defaults),Ue},Ue.getDefaults=Oe,Ue.defaults=St,Ue.use=function(Ee){var fe=Tt({},Ee);if(Ee.renderer&&function(){var ne=Ue.defaults.renderer||new Ge,re=function(ue){var we=ne[ue];ne[ue]=function(){for(var Le=arguments.length,tt=new Array(Le),Fe=0;Fe<Le;Fe++)tt[Fe]=arguments[Fe];var $e=Ee.renderer[ue].apply(ne,tt);return $e===!1&&($e=we.apply(ne,tt)),$e}};for(var ae in Ee.renderer)re(ae);fe.renderer=ne}(),Ee.tokenizer&&function(){var ne=Ue.defaults.tokenizer||new _e,re=function(ue){var we=ne[ue];ne[ue]=function(){for(var Le=arguments.length,tt=new Array(Le),Fe=0;Fe<Le;Fe++)tt[Fe]=arguments[Fe];var $e=Ee.tokenizer[ue].apply(ne,tt);return $e===!1&&($e=we.apply(ne,tt)),$e}};for(var ae in Ee.tokenizer)re(ae);fe.tokenizer=ne}(),Ee.walkTokens){var be=Ue.defaults.walkTokens;fe.walkTokens=function(ne){Ee.walkTokens(ne),be&&be(ne)}}Ue.setOptions(fe)},Ue.walkTokens=function(Ee,fe){for(var be=U(Ee),ne;!(ne=be()).done;){var re=ne.value;fe(re);switch(re.type){case"table":{for(var ae=U(re.tokens.header),ce;!(ce=ae()).done;){var ue=ce.value;Ue.walkTokens(ue,fe)}for(var we=U(re.tokens.cells),Le;!(Le=we()).done;)for(var tt=Le.value,Fe=U(tt),$e;!($e=Fe()).done;){var Dt=$e.value;Ue.walkTokens(Dt,fe)}break}case"list":{Ue.walkTokens(re.items,fe);break}default:re.tokens&&Ue.walkTokens(re.tokens,fe)}}},Ue.Parser=lt,Ue.parser=lt.parse,Ue.Renderer=Ge,Ue.TextRenderer=ke,Ue.Lexer=Pe,Ue.lexer=Pe.lex,Ue.Tokenizer=_e,Ue.Slugger=ct,Ue.parse=Ue;var Ze=Ue;return Ze})},"Dvv+":function(rt,Xe,X){"use strict";X.r(Xe);var oe=X("cWXX"),$=X("/ezw"),D=X("+L6B"),Y=X("2/Rp"),U=X("7Kak"),N=X("9yH6"),K=X("giR+"),I=X("fyUT"),O=X("9og8"),L=X("k1fw"),T=X("y8nQ"),A=X("Vl3Y"),P=X("tJVT"),w=X("5NDa"),S=X("5rEg"),x=X("WmNS"),h=X.n(x),l=X("q1tI"),i=X.n(l),c=X("Ty5D"),C=X("9kvl"),v=X("m3fD"),m=X.n(v),u=X("A+k2"),E=X.n(u),d=function(ue){var we=ue.value,Le=we===void 0?[]:we,tt=ue.onChange,Fe=ue.className,$e=Fe===void 0?"":Fe;return i.a.createElement("div",{className:"".concat(E.a.tabs," ").concat($e," ")},i.a.createElement("div",{onClick:function(){return tt(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 tt(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=X("2qtc"),o=X("kLXV"),b=X("sRBo"),g=X("kaz8"),_=X("5Dmo"),k=X("3S7+"),H=X("miYZ"),z=X("tsqr"),Z=X("oBTY"),G=X("IlMy"),B=X.n(G),te=X("WCUW"),de=X("QSKd"),pe=X.n(de),ye=X("Hfvn"),Ce=X.n(ye),_e=X("HPRh"),le=X.n(_e),se=X("+RXH"),ve=X.n(se),ie=X("+yhJ"),q=X.n(ie),xe=X("RZ/O"),Ie=X.n(xe),Ne=X("exQ7"),De=X.n(Ne),Be=X("HG2Q"),Ae=X.n(Be),Pe=X("k4n4"),We=X("eS0+"),ze=X("PpiC"),qe=X("K5AI"),Ge=X.n(qe),ke=X("LvDl"),ct=g.a.Group,ut=function(ue){var we=ue.value,Le=we===void 0?[]:we,tt=ue.onChange,Fe=ue.options,$e=ue.search,Dt=Object(ze.a)(ue,["value","onChange","options","search"]),ot=i.a.useState(!1),ft=Object(P.a)(ot,2),zt=ft[0],Je=ft[1];Object(l.useEffect)(function(){var Qt,it=Fe==null||((Qt=Fe.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 it.includes(xt)});Je(Ft.length===(it==null?void 0:it.length))},[Le]);var Kt=function(it){var Ft,xt,kt=Fe==null||((Ft=Fe.tag_disciplines)===null||Ft===void 0)?void 0:Ft.map(function(at){return at.id}),Mt=Le==null?void 0:Le.filter(function(at){return kt.includes(at)}),It=Object(ke.uniq)([].concat(Object(Z.a)(Le),Object(Z.a)(it)));if(Mt.length>it.length){var Lt=Object(ke.xor)(Mt,it);console.log(Lt,"newLevel"),It=It.filter(function(at){return!Lt.includes(at)})}tt(It),Je(it.length===(Fe==null||((xt=Fe.tag_disciplines)===null||xt===void 0)?void 0:xt.length))},sn=function(it){var Ft,xt=Fe==null||((Ft=Fe.tag_disciplines)===null||Ft===void 0)?void 0:Ft.map(function(kt){return kt.id});tt(it.target.checked?Object(ke.uniq)([].concat(Object(Z.a)(Le),Object(Z.a)(xt))):Le==null?void 0:Le.filter(function(kt){return!xt.includes(kt)})),Je(it.target.checked)};console.log(Fe,"options");var Bt=function(){var it,Ft,xt=(Fe==null?void 0:Fe.tag_disciplines)||[];if($e){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($e)})}return xt=(it=xt)===null||it===void 0?void 0:it.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 it=!1;if(!$e)it=!0;else{var Ft;(Ft=Fe.tag_disciplines)===null||Ft===void 0||Ft.forEach(function(xt){if(!it){var kt;it=((kt=xt.name)===null||kt===void 0?void 0:kt.includes($e))&&xt.item_count!==0}})}return it};return(Fe==null?void 0:Fe.item_count)===0||!an()?i.a.createElement(i.a.Fragment,null):i.a.createElement("div",{className:Ge.a.cInput},i.a.createElement("div",{className:Ge.a.cl},i.a.createElement(g.a,{checked:zt,onChange:sn},i.a.createElement("span",{className:Ge.a.box},i.a.createElement("span",{className:"font14 c-light-primary"},i.a.createElement("span",{title:Fe==null?void 0:Fe.name,className:Ge.a.box1}," ",Fe==null?void 0:Fe.name),i.a.createElement("span",null," ","(".concat(Fe==null?void 0:Fe.item_count,")"))),i.a.createElement("i",{className:"iconfont icon-lujing font12 ml5"})))),i.a.createElement("div",{className:Ge.a.cr},i.a.createElement(ct,{options:Bt(),value:Le,onChange:Kt})))},vt=ut,lt=X("ErOA"),Tt=X("ozfa"),gt=X("MJZm"),yt=X("0Owb"),Oe=X("tmPe"),Pt=X.n(Oe),St=function(ue){var we=ue.value,Le=ue.onChange,tt=ue.defaultValue,Fe=ue.treeData,$e=Fe===void 0?[]:Fe,Dt=Object(ze.a)(ue,["value","onChange","defaultValue","treeData"]);return i.a.createElement("div",{className:Pt.a.customTree},i.a.createElement(gt.a,Object(yt.a)({multiple:!0,showIcon:!0,selectedKeys:we,defaultExpandedKeys:tt,treeData:$e,onSelect:Le},Dt)))},Ue=St,Ze=X("sbIO"),Ee=S.a.Search,fe=function(ue){var we,Le=ue.formValue,tt=ue.setFatherTabs,Fe=ue.tabs,$e=ue.editData,Dt=ue.dispatch,ot=Object(c.i)().id,ft=Object(l.useState)(["mine"]),zt=Object(P.a)(ft,2),Je=zt[0],Kt=zt[1],sn=Object(l.useState)(!0),Bt=Object(P.a)(sn,2),an=Bt[0],Qt=Bt[1],it=Object(l.useState)(!1),Ft=Object(P.a)(it,2),xt=Ft[0],kt=Ft[1],Mt=Object(l.useState)(!1),It=Object(P.a)(Mt,2),Lt=It[0],at=It[1],Ve=Object(l.useState)(""),ln=Object(P.a)(Ve,2),Yt=ln[0],cn=ln[1],qt=Object(l.useState)(!1),En=Object(P.a)(qt,2),on=En[0],ht=En[1],Ke=Object(l.useState)(!1),wt=Object(P.a)(Ke,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)([]),Ye=Object(P.a)(me,2),dt=Ye[0],jt=Ye[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],nt=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 Fe===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})}},[Fe]),Object(l.useEffect)(function(){ot?$e&&cr():(Fi(Je),mi(),Qt(!1))},[$e]),Object(l.useEffect)(function(){Yt&&Ja()},[Yt]);var Ja=function(){var st=null;dt==null||dt.forEach(function(je){var Me;(Me=je.sub_disciplines)===null||Me===void 0||Me.forEach(function(Et){var mt;(mt=Et.tag_disciplines)===null||mt===void 0||mt.forEach(function(Ct){var Zt,dn=((Zt=Ct.name)===null||Zt===void 0?void 0:Zt.includes(Yt))&&Ct.item_count!==0;dn&&!st&&(st=je.id)})})}),st&&Te(st)},Qa=function(st){function je(Me){var Et=Me.children,mt=Array.isArray(Et)&&Et.length>0,Ct=Me==null?void 0:Me.group_id;return vr.current.push({name:Me==null?void 0:Me.name,id:Ct,count:Me==null?void 0:Me.count}),{title:i.a.createElement("div",{title:Me==null?void 0:Me.name,className:B.a.name},Me==null?void 0:Me.name,"\uFF08".concat(Me==null?void 0:Me.count,"\uFF09")),value:Ct,name:Me==null?void 0:Me.name,key:Ct,count:Me==null?void 0:Me.count,id:Ct,icon:i.a.createElement("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:mt?Et==null?void 0:Et.map(function(Zt){return je(Zt)}):[]}}return st==null?void 0:st.map(function(Me){return je(Me)})},wi=function(){var bt=Object(O.a)(h.a.mark(function st(){var je,Me;return h.a.wrap(function(mt){for(;;)switch(mt.prev=mt.next){case 0:return mt.next=2,Object(te.A)({});case 2:je=mt.sent,vr.current=[{id:0,name:"\u6839\u76EE\u5F55",count:je==null?void 0:je.root_count}],je!=null&&je.data&&(Me=[{title:i.a.createElement("div",{title:"\u6839\u76EE\u5F55",className:B.a.name},"\u6839\u76EE\u5F55","\uFF08".concat((je==null?void 0:je.root_count)||0,"\uFF09")),value:0,id:0,key:0,count:je==null?void 0:je.root_count,name:"\u6839\u76EE\u5F55",icon:i.a.createElement("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:Qa(je.data||[])}],_n(vr.current),fn(Me));case 5:case"end":return mt.stop()}},st)}));return function(){return bt.apply(this,arguments)}}(),cr=function(){var bt=Object(O.a)(h.a.mark(function st(){var je,Me,Et,mt,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=$e==null||((je=$e.tag_disciplines)===null||je===void 0)?void 0:je.map(function(Cn){return Cn.tag_discipline_id}),wn=$e==null||((Me=$e.groups)===null||Me===void 0)?void 0:Me.map(function(Cn){return Cn.id}),nr={source:$e==null||((Et=$e.examination_bank)===null||Et===void 0)?void 0:Et.source,group_ids:wn,tag_discipline_ids:In,teach_group_ids:$e==null?void 0:$e.teach_group_ids},rn.next=5,Object(lt.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 $n;return!!(Cn!=null&&($n=Cn.item_banks)!==null&&$n!==void 0&&$n.length)}),zn=zn.map(function(Cn){return Object(L.a)(Object(L.a)({},Cn),{},{scoreTotal:0,score:0,questionTotal:0})}),zn=(mt=zn)===null||mt===void 0?void 0:mt.map(function(Cn,$n){var Er,lr,Mr;return Object(L.a)(Object(L.a)({},Cn),{},{score:($e==null||((Er=$e.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=$e==null?void 0:$e.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,$n){var Er,lr=(sr==null||((Er=sr[$n])===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[$n]||0),questionTotal:lr})}),br=[],$e==null||((Zt=$e.sort_by_item_type)===null||Zt===void 0)||Zt.forEach(function(Cn){var $n=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($n)}),br=Object(ke.compact)(br),Fi($e==null||((dn=$e.examination_bank)===null||dn===void 0)?void 0:dn.source),mi(),Kt($e==null||((Mn=$e.examination_bank)===null||Mn===void 0)?void 0:Mn.source),Rr(In),nt.current=In,jn(wn),ti(($e==null?void 0:$e.teach_group_ids)||[]),or($e==null||((An=$e.groups)===null||An===void 0)?void 0:An.map(function(Cn){return Cn.count}).reduce(function(Cn,$n){return Cn+$n},0)),mr.current=wn,mn(wn!=null&&wn.length?wn:[0]),W(Object(ke.cloneDeep)(br)),Qt(!1);case 29:case"end":return rn.stop()}},st)}));return function(){return bt.apply(this,arguments)}}(),Za=function(){var bt=Object(O.a)(h.a.mark(function st(){var je;return h.a.wrap(function(Et){for(;;)switch(Et.prev=Et.next){case 0:je={source:Je,group_ids:un,tag_discipline_ids:xn,teach_group_ids:On},di(je),nt.current=xn,ht(!1);case 4:case"end":return Et.stop()}},st)}));return function(){return bt.apply(this,arguments)}}(),Fi=function(){var bt=Object(O.a)(h.a.mark(function st(je){var Me,Et,mt,Ct,Zt,dn;return h.a.wrap(function(An){for(;;)switch(An.prev=An.next){case 0:return An.next=2,Object(lt.a)("/api/disciplines.json",{method:"get",params:{source:"question",question_source:je}});case 2:mt=An.sent,Ct=[],mt==null||((Me=mt.disciplines)===null||Me===void 0)||Me.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=mt==null||((Et=mt.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()}},st)}));return function(je){return bt.apply(this,arguments)}}(),mi=function(){var bt=Object(O.a)(h.a.mark(function st(){var je;return h.a.wrap(function(Et){for(;;)switch(Et.prev=Et.next){case 0:return Et.next=2,Object(lt.a)("/api/teach_groups.json",{method:"get",params:{is_random_exam:!0}});case 2:je=Et.sent,ui((je==null?void 0:je.groups)||[]);case 4:case"end":return Et.stop()}},st)}));return function(){return bt.apply(this,arguments)}}(),di=function(){var bt=Object(O.a)(h.a.mark(function st(je){var Me,Et;return h.a.wrap(function(Ct){for(;;)switch(Ct.prev=Ct.next){case 0:return Qt(!0),Ct.next=3,Object(lt.a)("/api/examination_intelligent_settings/form_paper.json",{method:"post",body:je});case 3:Me=Ct.sent,Et=Me==null?void 0:Me.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()}},st)}));return function(je){return bt.apply(this,arguments)}}(),wa=function(){Rr(nt.current),ht(!1),cn("")},qa=function(st){Rr(st)},ta=function(){for(var st=hn==null?void 0:hn.filter(function(Mn){return xn==null?void 0:xn.includes(Mn.id)}),je=Object(Z.a)(st),Me=0,Et=[],mt=0;mt<je.length;mt++){for(var Ct="",Zt=0;Zt<Et.length;Zt++)if(Et[Zt][0].parent_name==je[mt].parent_name){Me=1,Ct=Zt;break}if(Me==1)Et[Ct].push(je[mt]),Me=0;else if(Me==0){var dn=new Array;dn.push(je[mt]),Et.push(dn)}}return Et},Aa=function(st,je){var Me,Et,mt=Object(ke.cloneDeep)(Q);mt[je]=st;var Ct=Ai([mt[je]]),Zt=Ct==null||((Me=Ct.panel)===null||Me===void 0||((Et=Me[0])===null||Et===void 0))?void 0:Et.reduce(function(Mn,An){return Mn+An},0);mt[je].questionTotal=Zt,W(mt);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(st){var je={contents:[],panel:[],score_num_item:[],score_total:[],error_tips:[]};return st==null||st.forEach(function(Me,Et){var mt,Ct,Zt;je.panel.push([]),je.score_num_item.push(Me==null?void 0:Me.score),je.score_total.push(Me==null?void 0:Me.scoreTotal),(mt=je.error_tips)===null||mt===void 0||mt.push({name:(Ct=Ri.find(function(dn){return dn.type===(Me==null?void 0:Me.item_type)}))===null||Ct===void 0?void 0:Ct.name,score:(Me==null?void 0:Me.score)||0,scoreTotal:Me==null?void 0:Me.scoreTotal,item_type:Me==null?void 0:Me.item_type}),Me==null||((Zt=Me.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&&(je.panel[Et].push(wn.num),je.contents.push({difficulty:wn.difficulty,item_type:Me.item_type,items_count:wn.num,sub_discipline_id:dn.sub_discipline_id,tag_discipline_id:An.tag_discipline_id}))})})})}),je},Ra=function(){var bt=Object(O.a)(h.a.mark(function st(je){var Me,Et,mt,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:Me=[],Et=[],mt=Ai(Q),Ct=0;case 7:if(!(Ct<mt.error_tips.length)){rn.next=23;break}if(Mn=mt==null||((Zt=mt.panel)===null||Zt===void 0||((dn=Zt[Ct])===null||dn===void 0))?void 0:dn.reduce(function(Cn,$n){return Cn+$n},0),!(mt.error_tips[Ct].score===0&&Mn!==0)){rn.next=14;break}return In=document.getElementById("".concat((An=mt.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(!(mt.error_tips[Ct].score!==0&&Mn===0)){rn.next=19;break}return nr=document.getElementById("".concat((wn=mt.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:mt.error_tips[Ct].score!==0&&Mn!==0&&(Me==null||Me.push({item_type:(Gn=mt.error_tips[Ct])===null||Gn===void 0?void 0:Gn.item_type,score:((zn=mt.error_tips[Ct])===null||zn===void 0?void 0:zn.score)||0}),Et.push(mt.error_tips[Ct].name));case 20:Ct++,rn.next=7;break;case 23:if(!(Me.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:mt.contents,group_ids:un,teach_group_ids:On,score_settings:Me,source:Je,sub_discipline_id:0,sort_by_item_type:Et,tag_discipline_ids:xn},Le),!je){rn.next=36;break}return sr=Object(L.a)(Object(L.a)({},yr),je),rn.next=32,Object(lt.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={},!$e){rn.next=43;break}return rn.next=40,Object(lt.a)("/api/examination_banks/".concat($e==null?void 0:$e.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(lt.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()}},st)}));return function(je){return bt.apply(this,arguments)}}(),na=function(){var bt=Object(O.a)(h.a.mark(function st(je,Me){var Et,mt,Ct,Zt,dn,Mn,An,In,wn,nr,Gn,zn,yr,sr,Qn,br,kr,rn,Cn,$n,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=[],mt=[],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}),mt.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(at(!0),sr=Object(L.a)({contents:Ct.contents,group_ids:un,teach_group_ids:On,score_settings:Et,sort_by_item_type:mt,tag_discipline_ids:xn,source:Je,sub_discipline_id:0},Le),!(je!==void 0&&!(je!=null&&je.single_question_id))){Bn.next=36;break}return sr.seleted_item_bank_ids=je==null?void 0:je.seleted_item_bank_ids,Bn.next=32,Object(lt.a)("/api/examination_banks/toggle_random_questions.json",{method:"post",body:sr});case 32:return Qn=Bn.sent,Qn!=null&&Qn.questions&&(kr=Object(ke.cloneDeep)(F),kr.questionList=kr==null||((br=kr.questionList)===null||br===void 0)?void 0:br.map(function(Xn){if(Xn.type===Me.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)),at(!1),Bn.abrupt("return");case 36:if(!(je!=null&&je!==void 0&&je.single_question_id)){Bn.next=45;break}return sr.seleted_item_bank_ids=je==null?void 0:je.seleted_item_bank_ids,sr.single_question_id=je==null?void 0:je.single_question_id,Bn.next=41,Object(lt.a)("/api/examination_banks/toggle_random_questions.json",{method:"post",body:sr});case 41:return rn=Bn.sent,rn&&($n=Object(ke.cloneDeep)(F),$n.questionList=$n==null||((Cn=$n.questionList)===null||Cn===void 0)?void 0:Cn.map(function(Xn){if(Xn.type===Me.type){var xr,Pr,_r=Object(ke.cloneDeep)(Xn==null?void 0:Xn.questions);return _r.splice(Me.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,Me.index,"new_questions"),Object(L.a)(Object(L.a)({},Xn),{},{questions:_r})}return Xn}),p($n)),at(!1),Bn.abrupt("return");case 45:return Bn.next=47,Object(lt.a)("/api/examination_banks/preview_random_questions.json",{method:"post",body:sr});case 47:Er=Bn.sent,Er.exam&&(lr=La(Er),Mr=[],mt==null||mt.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(ke.compact)(Mr),lr.questionList=Mr,p(Object(L.a)({},lr)),console.log(JSON.stringify(lr)),fr(!0),document.body.scrollIntoView()),at(!1);case 50:case"end":return Bn.stop()}},st)}));return function(je,Me){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 st=Ai(Q),je=st.panel,Me=st.score_total;return Me=Me.reduce(function(Et,mt){return Et+mt},0),je=Object(ke.flatten)(je).reduce(function(Et,mt){return Et+mt},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,je)),i.a.createElement("aside",null),i.a.createElement("div",null,i.a.createElement("img",{src:Ie.a}),i.a.createElement("span",null,"\u603B\u5206(\u5206)"),i.a.createElement("aside",null,Me)))},gi=function(st,je,Me){return st[je]=st.splice(Me,1,st[je])[0],st},ri=function(st){var je=[],Me=Object(ke.cloneDeep)(Q);Me.length>1&&st!==0&&(je=gi(Me,st,st-1)),W(je)},ji=function(st){var je=[],Me=Object(ke.cloneDeep)(Q);Me.length>1&&st!==Me.length-1&&(je=gi(Me,st,st+1)),W(je)},Li=function(){var bt=Object(O.a)(h.a.mark(function st(je){var Me,Et,mt,Ct;return h.a.wrap(function(dn){for(;;)switch(dn.prev=dn.next){case 0:if(mt=Object(Z.a)(Je),Je.includes(je)?mt=mt.filter(function(Mn){return Mn!==je}):mt.push(je),!(mt.length===0)){dn.next=5;break}return z.b.warn("\u8BD5\u9898\u6765\u6E90\u4E3A\u5FC5\u9009\u9879"),dn.abrupt("return");case 5:(Me=mt)!==null&&Me!==void 0&&Me.includes("mine")||(jn([]),mr.current=[]),(Et=mt)!==null&&Et!==void 0&&Et.includes("teach_groups")||(ti([]),si.current=[]),Kt(mt),Fi(mt),Rr([]),nt.current=[],Ct={source:mt,group_ids:mr.current,tag_discipline_ids:[],teach_group_ids:si.current},di(Ct);case 13:case"end":return dn.stop()}},st)}));return function(je){return bt.apply(this,arguments)}}(),La=function(st){var je={1:"\u4E00",2:"\u4E8C",3:"\u4E09",4:"\u56DB",5:"\u4E94",6:"\u516D",7:"\u4E03"};if(!st)return;var Me=st||{},Et=Me.exam,mt=Me.single_questions,Ct=Me.multiple_questions,Zt=Me.judgement_questions,dn=Me.program_questions,Mn=Me.completion_questions,An=Me.subjective_questions,In=Me.practical_questions,wn=Me.combination_questions,nr=[Object(L.a)({type:"SINGLE",name:"\u5355\u9009\u9898"},mt),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:je[br+1]})});return{all_questions_count:yr,all_score:zn,questionList:sr,ids:Gn,exam:Et}},Zr=function(st){var je,Me,Et=Object(ke.cloneDeep)(F),mt=Object(ke.cloneDeep)(Q);Et.questionList=Et==null||((je=Et.questionList)===null||je===void 0)?void 0:je.map(function(Ct){return Ct.type===st.type?Object(L.a)(Object(L.a)({},Ct),{},{questions_score:st.scoreTotal}):Ct}),mt=(Me=mt)===null||Me===void 0?void 0:Me.map(function(Ct){return Ct.item_type===st.type?Object(L.a)(Object(L.a)({},Ct),{},{score:st.score,scoreTotal:st.scoreTotal}):Ct}),W(mt),p(Et),console.log(st,F,Q)},ii=dt==null||((we=dt.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:Fe?"flex":"none"}},i.a.createElement("div",{id:"id_left",className:B.a.left,onMouseEnter:function(st){var je=document.getElementById("id_left");je.style.overflowY="auto"},onMouseLeave:function(st){var je=document.getElementById("id_left");je.style.overflowY="hidden"}},i.a.createElement($.a,{loading:an,active:!0,paragraph:{rows:5}},Q.map(function(bt,st){var je;return i.a.createElement("div",{className:B.a.list,key:st},i.a.createElement("div",{className:B.a.name},i.a.createElement("b",null),i.a.createElement("span",null,(je=Ri.find(function(Me){return Me.type===(bt==null?void 0:bt.item_type)}))===null||je===void 0?void 0:je.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,st>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(st)},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"})),st<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(st)},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 tt(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(st){return st.count}).reduce(function(st,je){return st+je},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(st){var je=un.filter(function(Et){return Et!==st}),Me={source:Je,group_ids:je,tag_discipline_ids:xn,teach_group_ids:On};di(Me),jn(je),mr.current=je}})),(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(st){var je=On.filter(function(Et){return Et!==st}),Me={source:Je,group_ids:un,tag_discipline_ids:xn,teach_group_ids:je};di(Me),ti(je),si.current=je}})),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}nt.current=xn,ht(!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,st){return i.a.createElement(i.a.Fragment,{key:st},i.a.createElement("div",{className:B.a.kn},i.a.createElement("span",null,st+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(je){return!!je.item_count}),onChange:function(Me){var Et=xn.filter(function(Ct){return Ct!==Me}),mt={source:Je,group_ids:un,tag_discipline_ids:Et,teach_group_ids:On};di(mt),Rr(Et),nt.current=Et}}))})))),console.log("-----",Q),i.a.createElement($.a,{loading:an,active:!0,paragraph:{rows:5}},Q.map(function(bt,st){return i.a.createElement(We.a,{key:st,value:bt,onChange:function(Me){return Aa(Me,st)}})}),i.a.createElement("div",{className:B.a.btns},i.a.createElement(Y.a,{onClick:function(){tt(0),document.body.scrollIntoView()}},"\u4E0A\u4E00\u6B65"),i.a.createElement(Y.a,{loading:xt,onClick:function(){return Ra()}},"\u63D0\u4EA4"),i.a.createElement(Y.a,{loading:Lt,onClick:function(){return na()},type:"primary"},"\u9884\u89C8")))),i.a.createElement(o.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:ve.a}),i.a.createElement("span",null,"\u8BD5\u9898\u8303\u56F4")),i.a.createElement("div",{className:B.a.l},dt==null?void 0:dt.map(function(bt){var st=null,je=!1;if(!Yt)je=!0;else{var Me;(Me=bt.sub_disciplines)===null||Me===void 0||Me.forEach(function(Et){var mt;(mt=Et.tag_disciplines)===null||mt===void 0||mt.forEach(function(Ct){if(!je){var Zt;je=((Zt=Ct.name)===null||Zt===void 0?void 0:Zt.includes(Yt))&&Ct.item_count!==0}})})}return i.a.createElement(i.a.Fragment,{key:bt.id},!!bt.item_count&&je&&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(Ee,{onChange:function(st){return cn(st.target.value)},placeholder:"\u8BF7\u8F93\u5165\u77E5\u8BC6\u70B9",value:Yt})),i.a.createElement("div",{className:B.a.l},ii==null?void 0:ii.map(function(bt,st){var je,Me=Object(L.a)(Object(L.a)({},bt),{},{tag_disciplines:bt==null||((je=bt.tag_disciplines)===null||je===void 0)?void 0:je.filter(function(Et){return Et.item_count!==0})});return i.a.createElement(vt,{search:Yt,onChange:qa,key:bt.id,value:xn,options:Me})}))))),i.a.createElement(o.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(Y.a,{onClick:function(){jn(mr.current),or(0),Xt(!1)}},"\u53D6\u6D88"),i.a.createElement(Y.a,{type:"primary",onClick:function(){var st={source:Je,group_ids:un,tag_discipline_ids:xn,teach_group_ids:On};di(st),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(st,je){var Me;or((Me=je.selectedNodes)===null||Me===void 0?void 0:Me.map(function(Et){return Et.count}).reduce(function(Et,mt){return Et+mt},0)),jn(st)}}))),i.a.createElement(o.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 st={source:Je,group_ids:un,tag_discipline_ids:xn,teach_group_ids:On};di(st),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 je=bt.id,Me=Object(Z.a)(On);On.includes(je)?Me=Me.filter(function(Et){return Et!==je}):Me.push(je),ti(Me)},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,tt=ue.globalSetting,Fe=ue.dispatch,$e=Object(l.useState)(0),Dt=Object(P.a)($e,2),ot=Dt[0],ft=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],it=Object(l.useState)(!0),Ft=Object(P.a)(it,2),xt=Ft[0],kt=Ft[1],Mt=Object(l.useState)(null),It=Object(P.a)(Mt,2),Lt=It[0],at=It[1],Ve=Object(c.i)().id;console.log(Ve,"editId"),Object(l.useEffect)(function(){return Fe({type:"globalSetting/footerToggle",payload:!1}),function(){Fe({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){Yt();return}kt(!1)},[Ve]);var Yt=function(){var En=Object(O.a)(h.a.mark(function on(){var ht,Ke,wt,Hn,fr,Ar;return h.a.wrap(function(F){for(;;)switch(F.prev=F.next){case 0:return F.next=2,Object(lt.a)("/api/examination_banks/".concat(Ve,"/edit_random_exam.json"),{method:"get",params:{}});case 2:ht=F.sent,ht!=null&&ht.examination_bank&&(Ar={difficulty:ht==null||((Ke=ht.examination_bank)===null||Ke===void 0)?void 0:Ke.difficulty,exam_notes:ht==null||((wt=ht.examination_bank)===null||wt===void 0)?void 0:wt.exam_notes,name:ht==null||((Hn=ht.examination_bank)===null||Hn===void 0)?void 0:Hn.name,time:ht==null||((fr=ht.examination_bank)===null||fr===void 0)?void 0:fr.time},kt(!1),Qt(Object(L.a)({},Ar)),Kt.setFieldsValue(Object(L.a)({},Ar)),at(Object(L.a)(Object(L.a)({},ht),{},{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(ht){return h.a.wrap(function(wt){for(;;)switch(wt.prev=wt.next){case 0:if(!(ht===0)){wt.next=3;break}return ft(ht),wt.abrupt("return");case 3:return wt.next=5,Kt.validateFields();case 5:ft(ht);case 6:case"end":return wt.stop()}},on)}));return function(ht){return En.apply(this,arguments)}}(),qt=function(on){var ht=parseInt(on);return Object(ke.isNaN)(ht)?"":ht};return i.a.createElement("section",{className:m.a.wrap},i.a.createElement($.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")),ot===0&&i.a.createElement(f,{value:ot,onChange:cn}),ot===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(I.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(N.a.Group,{style:{display:"flex",width:286,justifyContent:"space-between"},size:"large"},i.a.createElement(N.a.Button,{className:m.a.rb,value:1},"\u7B80\u5355"),i.a.createElement(N.a.Button,{className:m.a.rb,value:2},"\u9002\u4E2D"),i.a.createElement(N.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(Y.a,{className:"mr40",onClick:function(){return C.d.push("/paperlibrary")}},"\u8FD4\u56DE"),i.a.createElement(Y.a,{type:"primary",onClick:Object(O.a)(h.a.mark(function En(){return h.a.wrap(function(ht){for(;;)switch(ht.prev=ht.next){case 0:return ht.next=2,Kt.validateFields();case 2:ft(1);case 3:case"end":return ht.stop()}},En)}))},"\u4E0B\u4E00\u6B65"))),i.a.createElement(be,{tabs:ot,dispatch:Fe,editData:Lt,setFatherTabs:ft,formValue:an})))},ae=Xe.default=Object(C.a)(function(ce){var ue=ce.paperlibrary,we=ce.user,Le=ce.globalSetting;return{paperlibrary:ue,user:we,globalSetting:Le}})(re)},"E/GV":function(rt,Xe,X){rt.exports=X.p+"static/swenjianjia.1640bf70.svg"},ELLl:function(rt,Xe,X){(function(oe){oe(X("VrN/"))})(function(oe){var $={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},D=oe.Pos;oe.defineOption("autoCloseBrackets",!1,function(S,x,h){h&&h!=oe.Init&&(S.removeKeyMap(U),S.state.closeBrackets=null),x&&(N(Y(x,"pairs")),S.state.closeBrackets=x,S.addKeyMap(U))});function Y(S,x){return x=="pairs"&&typeof S=="string"?S:typeof S=="object"&&S[x]!=null?S[x]:$[x]}var U={Backspace:O,Enter:L};function N(S){for(var x=0;x<S.length;x++){var h=S.charAt(x),l="'"+h+"'";U[l]||(U[l]=K(h))}}N($.pairs+"`");function K(S){return function(x){return A(x,S)}}function I(S){var x=S.state.closeBrackets;if(!x||x.override)return x;var h=S.getModeAt(S.getCursor());return h.closeBrackets||x}function O(S){var x=I(S);if(!x||S.getOption("disableInput"))return oe.Pass;for(var h=Y(x,"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 x=I(S),h=x&&Y(x,"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 T(S){var x=oe.cmpPos(S.anchor,S.head)>0;return{anchor:new D(S.anchor.line,S.anchor.ch+(x?-1:1)),head:new D(S.head.line,S.head.ch+(x?1:-1))}}function A(S,x){var h=I(S);if(!h||S.getOption("disableInput"))return oe.Pass;var l=Y(h,"pairs"),i=l.indexOf(x);if(i==-1)return oe.Pass;for(var c=Y(h,"closeBefore"),C=Y(h,"triples"),v=l.charAt(i+1)==x,m=S.listSelections(),u=i%2==0,E,d=0;d<m.length;d++){var f=m[d],s=f.head,o,b=S.getRange(s,D(s.line,s.ch+1));if(u&&!f.empty())o="surround";else if((v||!u)&&b==x)v&&w(S,s)?o="both":C.indexOf(x)>=0&&S.getRange(s,D(s.line,s.ch+3))==x+x+x?o="skipThree":o="skip";else if(v&&s.ch>1&&C.indexOf(x)>=0&&S.getRange(D(s.line,s.ch-2),s)==x+x){if(s.ch>2&&/\bstring/.test(S.getTokenTypeAt(D(s.line,s.ch-2))))return oe.Pass;o="addFour"}else if(v){var g=s.ch==0?" ":S.getRange(D(s.line,s.ch-1),s);if(!oe.isWordChar(b)&&g!=x&&!oe.isWordChar(g))o="both";else return oe.Pass}else if(u&&(b.length===0||/\s/.test(b)||c.indexOf(b)>-1))o="both";else return oe.Pass;if(!E)E=o;else if(E!=o)return oe.Pass}var _=i%2?l.charAt(i-1):x,k=i%2?x: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]=T(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,x){var h=S.getRange(D(x.line,x.ch-1),D(x.line,x.ch+1));return h.length==2?h:null}function w(S,x){var h=S.getTokenAt(D(x.line,x.ch+1));return/\bstring/.test(h.type)&&h.start==x.ch&&(x.ch==0||!/\bstring/.test(S.getTokenTypeAt(x)))}})},FTkQ:function(rt,Xe){rt.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABjUlEQVQ4T61VsUoDQRB9s+eVYifkUlqIWCW3sbBMqYUR0cbfUPETxPgZ2giigpZaCnKXpBK1sMydpIx25+7ISu5ILhsjclvuzLx5M292lmA57PtuF2gIYIMBSYBn3BiICAg1cF0GrqjVSvLhlL+IqtVNEDUZWLAlS+8IeAPzvtduXw77ZYAMiEjKI2LeY2AskQ2cAGaiEy8MDwnQxicL7Ep5bDL+xmqijahZDsODDHBQ5sVfmVn6xmDeMuWTESAGnqf1bBpz09MSsESx729r4DwfIIA6hPjUSt2AaP7Hztwj5nXHdd0vpR7yMQzsUOT7pwzsjgEKsVIKgiCu1Za1UvfGLhynXgqCp6hSkSxEYCn9jLq+/wJgcawk5l4KYECN3YBlCVLWo4GvhmGfgVlrj4ZAjX0KmBmZD8Owj4IAMQAsvGSrKKR1zet0QpsosZQrmvnRKsqksZlxnFWVJAkT3Y6MDbAmgDlFdGcdm8IH22Qp9OmltAtdDoPlWez6SpkWtmCHFTNCvQMN/scX8A1e4fnIOEHt8AAAAABJRU5ErkJggg=="},Gytx:function(rt,Xe){rt.exports=function(oe,$,D,Y){var U=D?D.call(Y,oe,$):void 0;if(U!==void 0)return!!U;if(oe===$)return!0;if(typeof oe!="object"||!oe||typeof $!="object"||!$)return!1;var N=Object.keys(oe),K=Object.keys($);if(N.length!==K.length)return!1;for(var I=Object.prototype.hasOwnProperty.bind($),O=0;O<N.length;O++){var L=N[O];if(!I(L))return!1;var T=oe[L],A=$[L];if(U=D?D.call(Y,T,A,L):void 0,U===!1||U===void 0&&T!==A)return!1}return!0}},HG2Q:function(rt,Xe,X){rt.exports=X.p+"static/sren.1cbce50b.svg"},HPRh:function(rt,Xe,X){rt.exports=X.p+"static/median.766cb706.svg"},Hfvn:function(rt,Xe,X){rt.exports=X.p+"static/wenjian.ea3b4170.svg"},HmJG:function(rt,Xe,X){},IlMy:function(rt,Xe,X){rt.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(rt,Xe,X){rt.exports={cInput:"cInput___2BJRi",cl:"cl___AbKoK",box:"box___3gRA9",box1:"box1___S3u_s",cr:"cr___16yEi"}},LdHM:function(rt,Xe,X){"use strict";X.d(Xe,"b",function(){return c}),X.d(Xe,"a",function(){return v});var oe=X("1OyB"),$=X("vuIU"),D=X("Ji7U"),Y=X("LK+K"),U=X("q1tI"),N=X("rePB"),K=X("Ff2n"),I=X("ODXe"),O=X("4IlW"),L=X("bX4T"),T=X("YrtM"),A=X("TSYQ"),P=X.n(A),w=X("+nKL"),S=X("8OUc"),x=function(te,de){var pe=te.prefixCls,ye=te.id,Ce=te.flattenOptions,_e=te.childrenAsData,le=te.values,se=te.searchValue,ve=te.multiple,ie=te.defaultActiveFirstOption,q=te.height,xe=te.itemHeight,Ie=te.notFoundContent,Ne=te.open,De=te.menuItemSelectedIcon,Be=te.virtual,Ae=te.onSelect,Pe=te.onToggleOpen,We=te.onActiveValue,ze=te.onScroll,qe=te.onMouseEnter,Ge="".concat(pe,"-item"),ke=Object(T.a)(function(){return Ce},[Ne,Ce],function(Ze,Ee){return Ee[0]&&Ze[1]!==Ee[1]}),ct=U.useRef(null),ut=function(Ee){Ee.preventDefault()},vt=function(Ee){ct.current&&ct.current.scrollTo({index:Ee})},lt=function(Ee){for(var fe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,be=ke.length,ne=0;ne<be;ne+=1){var re=(Ee+ne*fe+be)%be,ae=ke[re],ce=ae.group,ue=ae.data;if(!ce&&!ue.disabled)return re}return-1},Tt=U.useState(function(){return lt(0)}),gt=Object(I.a)(Tt,2),yt=gt[0],Oe=gt[1],Pt=function(Ee){Oe(Ee);var fe=ke[Ee];if(!fe){We(null,-1);return}We(fe.data.value,Ee)};U.useEffect(function(){Pt(ie!==!1?lt(0):-1)},[ke.length,se]),U.useEffect(function(){var Ze=setTimeout(function(){if(!ve&&Ne&&le.size===1){var Ee=Array.from(le)[0],fe=ke.findIndex(function(be){var ne=be.data;return ne.value===Ee});Pt(fe),vt(fe)}});return function(){return clearTimeout(Ze)}},[Ne]);var St=function(Ee){Ee!==void 0&&Ae(Ee,{selected:!le.has(Ee)}),ve||Pe(!1)};if(U.useImperativeHandle(de,function(){return{onKeyDown:function(Ee){var fe=Ee.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=lt(yt+be,be);vt(ne),Pt(ne)}break}case O.a.ENTER:{var re=ke[yt];re&&!re.data.disabled?St(re.data.value):St(void 0),Ne&&Ee.preventDefault();break}case O.a.ESC:Pe(!1)}},onKeyUp:function(){},scrollTo:function(Ee){vt(Ee)}}}),ke.length===0)return U.createElement("div",{role:"listbox",id:"".concat(ye,"_list"),className:"".concat(Ge,"-empty"),onMouseDown:ut},Ie);function Ue(Ze){var Ee=ke[Ze];if(!Ee)return null;var fe=Ee.data||{},be=fe.value,ne=fe.label,re=fe.children,ae=Object(L.a)(fe,!0),ce=_e?re:ne;return Ee?U.createElement("div",Object.assign({"aria-label":typeof ce=="string"?ce: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:ct,data:ke,height:q,itemHeight:xe,fullHeight:!1,onMouseDown:ut,onScroll:ze,virtual:Be,onMouseEnter:qe},function(Ze,Ee){var fe,be=Ze.group,ne=Ze.groupOption,re=Ze.data,ae=re.label,ce=re.key;if(be)return U.createElement("div",{className:P()(Ge,"".concat(Ge,"-group"))},ae!==void 0?ae:ce);var ue=re.disabled,we=re.value,Le=re.title,tt=re.children,Fe=re.style,$e=re.className,Dt=Object(K.a)(re,["disabled","value","title","children","style","className"]),ot=le.has(we),ft="".concat(Ge,"-option"),zt=P()(Ge,ft,$e,(fe={},Object(N.a)(fe,"".concat(ft,"-grouped"),ne),Object(N.a)(fe,"".concat(ft,"-active"),yt===Ee&&!ue),Object(N.a)(fe,"".concat(ft,"-disabled"),ue),Object(N.a)(fe,"".concat(ft,"-selected"),ot),fe)),Je=_e?tt:ae,Kt=!De||typeof De=="function"||ot;return U.createElement("div",Object.assign({},Dt,{"aria-selected":ot,className:zt,title:Le,onMouseMove:function(){if(yt===Ee||ue)return;Pt(Ee)},onClick:function(){ue||St(we)},style:Fe}),U.createElement("div",{className:"".concat(ft,"-content")},Je||we),U.isValidElement(De)||ot,Kt&&U.createElement(S.a,{className:"".concat(Ge,"-option-state"),customizeIcon:De,customizeIconProps:{isSelected:ot}},ot?"\u2713":null))}))},h=U.forwardRef(x);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=X("VTBJ"),u=X("Zm9Q");function E(B){var te=B.key,de=B.props,pe=de.children,ye=de.value,Ce=Object(K.a)(de,["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(de,pe){if(!U.isValidElement(de)||!de.type)return null;var ye=de.type.isSelectOptGroup,Ce=de.key,_e=de.props,le=_e.children,se=Object(K.a)(_e,["children"]);return te||!ye?E(de):Object(m.a)(Object(m.a)({key:"__RC_SELECT_GRP__".concat(Ce===null?pe:Ce,"__"),label:Ce},se),{},{options:d(le)})}).filter(function(de){return de})}var f=X("2Qr1"),s=X("qNPg"),o=X("U8pU"),b=X("Kwbf"),g=X("WKfj");function _(B){var te=B.mode,de=B.options,pe=B.children,ye=B.backfill,Ce=B.allowClear,_e=B.placeholder,le=B.getInputElement,se=B.showSearch,ve=B.onSearch,ie=B.defaultOpen,q=B.autoFocus,xe=B.labelInValue,Ie=B.value,Ne=B.inputValue,De=B.optionLabelProp,Be=te==="multiple"||te==="tags",Ae=se!==void 0?se:Be||te==="combobox",Pe=de||d(pe);if(Object(b.a)(te!=="tags"||Pe.every(function(Ge){return!Ge.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),te==="tags"||te==="combobox"){var We=Pe.some(function(Ge){return Ge.options?Ge.options.some(function(ke){return typeof("value"in ke?ke.value:ke.key)=="number"}):typeof("value"in Ge?Ge.value:Ge.key)=="number"});Object(b.a)(!We,"`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`."),ve&&!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."),Ie!=null){var ze=Object(g.d)(Ie);Object(b.a)(!xe||ze.every(function(Ge){return Object(o.a)(Ge)==="object"&&("key"in Ge||"value"in Ge)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(b.a)(!Be||Array.isArray(Ie),"`value` should be array when `mode` is `multiple` or `tags`")}if(pe){var qe=null;Object(u.a)(pe).some(function(Ge){if(!U.isValidElement(Ge)||!Ge.type)return!1;var ke=Ge.type;if(ke.isSelectOption)return!1;if(ke.isSelectOptGroup){var ct=Object(u.a)(Ge.props.children).every(function(ut){return!U.isValidElement(ut)||!Ge.type||ut.type.isSelectOption?!0:(qe=ut.type,!1)});return!ct}return qe=ke,!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)(de,B);var te=Object(Y.a)(de);function de(){var pe;return Object(oe.a)(this,de),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($.a)(de,[{key:"render",value:function(){return U.createElement(H,Object.assign({ref:this.selectRef},this.props))}}]),de}(U.Component);z.Option=c,z.OptGroup=v;var Z=z,G=Xe.c=Z},M8RZ:function(rt,Xe,X){"use strict";X.d(Xe,"a",function(){return O});var oe=X("fWQN"),$=X("mtLc"),D=X("yKVA"),Y=X("879j"),U=X("q1tI"),N=X.n(U),K=X("i8i4"),I=X.n(K),O=function(L){Object(D.a)(A,L);var T=Object(Y.a)(A);function A(P){var w;Object(oe.a)(this,A),w=T.call(this,P);var S=window.document;return w.node=S.createElement("div"),S.body.appendChild(w.node),w}return Object($.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}(N.a.Component)},NvD2:function(rt,Xe,X){"use strict";X.d(Xe,"a",function(){return N});var oe=X("Kwbf");function $(K,I){var O=new Set;return K.forEach(function(L){I.has(L)||O.add(L)}),O}function D(K){var I=K||{},O=I.disabled,L=I.disableCheckbox,T=I.checkable;return!!(O||L)||T===!1}function Y(K,I,O,L){for(var T=new Set(K),A=new Set,P=0;P<=O;P+=1){var w=I.get(P)||new Set;w.forEach(function(l){var i=l.key,c=l.node,C=l.children,v=C===void 0?[]:C;T.has(i)&&!L(c)&&v.filter(function(m){return!L(m.node)}).forEach(function(m){T.add(m.key)})})}for(var S=new Set,x=O;x>=0;x-=1){var h=I.get(x)||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=T.has(u);C&&!E&&(C=!1),!v&&(E||A.has(u))&&(v=!0)}),C&&T.add(i.key),v&&A.add(i.key),S.add(i.key)})}return{checkedKeys:Array.from(T),halfCheckedKeys:Array.from($(A,T))}}function U(K,I,O,L,T){for(var A=new Set(K),P=new Set(I),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)&&!T(C)&&m.filter(function(u){return!T(u.node)}).forEach(function(u){A.delete(u.key)})})}P=new Set;for(var x=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(T(C)||!i.parent||x.has(i.parent.key))return;if(T(i.parent.node)){x.add(c.key);return}var v=!0,m=!1;(c.children||[]).filter(function(u){return!T(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),x.add(c.key)})}return{checkedKeys:Array.from(A),halfCheckedKeys:Array.from($(P,A))}}function N(K,I,O,L){var T=[],A;L?A=L:A=D;var P=new Set(K.filter(function(h){var l=!!O[h];return l||T.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)(!T.length,"Tree missing follow keys: ".concat(T.slice(0,100).map(function(h){return"'".concat(h,"'")}).join(", ")));var x;return I===!0?x=Y(P,w,S,A):x=U(P,I.halfCheckedKeys,w,S,A),x}},O2Wb:function(rt,Xe,X){rt.exports={flex:"flex___2gmSR",flex1:"flex1___3Tu1g",color666:"color666___2uyGL",error:"error___yJ86W",deleteIcon:"deleteIcon___1D2tg",addIcon:"addIcon___2VIYB"}},OLES:function(rt,Xe,X){"use strict";var oe=X("U8pU"),$=X("VTBJ"),D=X("Ff2n"),Y=X("q1tI"),U=X("uciX"),N=X("7ixt"),K=function(P){var w=P.overlay,S=P.prefixCls,x=P.id,h=P.overlayInnerStyle;return Y.createElement("div",{className:"".concat(S,"-inner"),id:x,role:"tooltip",style:h},typeof w=="function"?w():w)},I=K,O=function(P,w){var S=P.overlayClassName,x=P.trigger,h=x===void 0?["hover"]:x,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,o=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"]),de=Object(Y.useRef)(null);Object(Y.useImperativeHandle)(w,function(){return de.current});var pe=Object($.a)({},te);"visible"in P&&(pe.popupVisible=P.visible);var ye=function(){var ve=P.arrowContent,ie=ve===void 0?null:ve,q=P.overlay,xe=P.id;return[Y.createElement("div",{className:"".concat(u,"-arrow"),key:"arrow"},ie),Y.createElement(I,{key:"content",prefixCls:u,id:xe,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 Y.createElement(U.a,Object.assign({popupClassName:S,prefixCls:u,popup:ye,action:h,builtinPlacements:N.a,popupPlacement:g,ref:de,popupAlign:k,getPopupContainer:G,onPopupVisibleChange:d,afterPopupVisibleChange:f,popupTransitionName:s,popupAnimation:o,defaultPopupVisible:Z,destroyPopupOnHide:Ce,autoDestroy:_e,mouseLeaveDelay:C,popupStyle:v,mouseEnterDelay:i},pe),E)},L=Object(Y.forwardRef)(O),T=Xe.a=L},OZM5:function(rt,Xe,X){"use strict";X.d(Xe,"b",function(){return L}),X.d(Xe,"a",function(){return T}),X.d(Xe,"k",function(){return A}),X.d(Xe,"h",function(){return P}),X.d(Xe,"i",function(){return w}),X.d(Xe,"g",function(){return S}),X.d(Xe,"c",function(){return x}),X.d(Xe,"d",function(){return h}),X.d(Xe,"j",function(){return c}),X.d(Xe,"e",function(){return C}),X.d(Xe,"f",function(){return v});var oe=X("KQm4"),$=X("U8pU"),D=X("Ff2n"),Y=X("q1tI"),U=X.n(Y),N=X("Kwbf"),K=X("WaYH"),I=.25,O=2;function L(m,u){var E=m.slice(),d=E.indexOf(u);return d>=0&&E.splice(d,1),E}function T(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(o){var b=o.key,g=o.children;E.push(b),f(g)})}return f(d.children),E}function x(m,u){var E=m.clientY,d=u.selectHandle.getBoundingClientRect(),f=d.top,s=d.bottom,o=d.height,b=Math.max(o*I,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(o){var b=o.children,g=Object(D.a)(o,["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($.a)(m)==="object")u={checkedKeys:m.checked||void 0,halfCheckedKeys:m.halfChecked||void 0};else return Object(N.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 o=s.parent,b=s.node;if(b.disabled)return;o&&d(o.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(rt,Xe,X){"use strict";var oe=X("2qtc"),$=X("kLXV"),D=X("rAM+"),Y=X("miYZ"),U=X("tsqr"),N=X("9og8"),K=X("tJVT"),I=X("jrin"),O=X("WmNS"),L=X.n(O),T=X("q1tI"),A=X.n(T),P=X("VrN/"),w=X.n(P),S=X("bdgK"),x=X("p77/"),h=X("Bd2K"),l=X("ELLl"),i=X("19Vz"),c=X("lZu9"),C=X("+NIl"),v=X("kSUc"),m=X("9Bee"),u=function(ue){var we=ue.value,Le=we===void 0?"":we,tt=ue.className,Fe=ue.showTextOnly,$e=ue.showLines,Dt=ue.style,ot=Dt===void 0?{}:Dt,ft=Object(T.useMemo)(function(){return""},[Le]);return A.a.createElement(A.a.Fragment,null,A.a.createElement("div",{dangerouslySetInnerHTML:{__html:ft}}))},E=X("0Owb"),d=X("dejd"),f=X("C+DQ"),s=X("1vsH"),o=X("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,tt=ue.icon,Fe=ue.actionName,$e=ue.className,Dt=$e===void 0?"":$e,ot=ue.children;function ft(){we(Fe)}return A.a.createElement("a",{title:Le,className:Dt,onClick:ft},A.a.createElement("i",{className:"md-iconfont ".concat(tt)}),ot)}var _=function(ue){var we=ue.watch,Le=ue.showNullButton,tt=ue.onActionCallback,Fe=ue.fullScreen,$e=ue.insertTemp,Dt=ue.hidetoolBar,ot=ue.uuid,ft=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(ot,"&api=").concat(encodeURIComponent(o.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:tt})):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:tt},A.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,$e&&A.a.createElement("li",null,A.a.createElement(g,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat($e),onActionCallback:tt},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(Fe?"icon-shrink":"icon-enlarge"),title:Fe?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:tt})))},k=X("M8RZ"),H=X("+L6B"),z=X("2/Rp"),Z=X("y8nQ"),G=X("Vl3Y"),B=X("5NDa"),te=X("5rEg"),de={labelCol:{span:4},wrapperCol:{span:20}},pe=function(ue){var we=ue.callback,Le=ue.onCancel;function tt(Fe){we(Fe)}return A.a.createElement(G.a,Object(E.a)({},de,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:tt}),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=X("7ahc"),Ce=X("HmJG"),_e=X("BjJ7"),le=G.a.useForm,se={width:280,marginRight:10},ve={labelCol:{span:5},wrapperCol:{span:19}},ie=function(ue){var we=ue.callback,Le=ue.onCancel,tt=le(),Fe=Object(K.a)(tt,1),$e=Fe[0];function Dt(zt){we(zt)}function ot(zt,Je){if(zt.status===-1){U.b.error(zt.message);return}$e.setFieldsValue({src:"/api/attachments/".concat(zt.id),type:Je.type})}function ft(zt){var Je=zt.target.files[0];xe(Je,ot)}return A.a.createElement(G.a,Object(E.a)({form:$e},ve,{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:ft}))),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 xe(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 tt=new window.XMLHttpRequest;tt.withCredentials=!0,tt.addEventListener("load",function(Fe){we(JSON.parse(Fe.target.responseText),ue)},!1),tt.addEventListener("error",function(Fe){console.error(Fe)},!1),tt.open("POST","".concat(_e.a,"/api/attachments.json")),tt.send(Le)}var Ie=X("giR+"),Ne=X("fyUT"),De=X("7Kak"),Be=X("9yH6"),Ae=Be.a.Group,Pe={margin:"0 8px"},We=function(ue){var we=ue.callback,Le=ue.onCancel;function tt(Fe){we(Fe)}return A.a.createElement(G.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:tt},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=X("ErOA"),qe=X("7Cbv"),Ge="link",ke="upload-image",ct="code-block",ut="add-table",vt="------------",lt={default:vt,left:":".concat(vt),center:":".concat(vt,":"),right:"".concat(vt,":")},Tt=X("9VGf"),gt,yt;function Oe(){}var Pt=0,St=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 Ee(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=(gt={},Object(I.a)(gt,be+"-B","bold"),Object(I.a)(gt,be+"-I","italic"),gt),ae=(yt={},Object(I.a)(yt,Ge,"\u6DFB\u52A0\u94FE\u63A5"),Object(I.a)(yt,ct,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(I.a)(yt,ke,"\u6DFB\u52A0\u6587\u4EF6"),Object(I.a)(yt,ut,"\u6DFB\u52A0\u8868\u683C"),yt),ce=Xe.a=function(ue){var we=ue.defaultValue,Le=we===void 0?"":we,tt=ue.onChange,Fe=ue.width,$e=Fe===void 0?"100%":Fe,Dt=ue.height,ot=Dt===void 0?400:Dt,ft=ue.miniToolbar,zt=ft===void 0?!1:ft,Je=ue.isFocus,Kt=Je===void 0?!1:Je,sn=ue.watch,Bt=ue.insertTemp,an=ue.mode,Qt=an===void 0?"markdown":an,it=ue.id,Ft=it===void 0?"markdown-editor-id":it,xt=ue.showResizeBar,kt=xt===void 0?!1:xt,Mt=ue.noStorage,It=Mt===void 0?!1:Mt,Lt=ue.showNullButton,at=Lt===void 0?!1:Lt,Ve=ue.hidetoolBar,ln=Ve===void 0?!1:Ve,Yt=ue.fullScreen,cn=Yt===void 0?!1:Yt,qt=ue.onBlur,En=ue.onCMBeforeChange,on=ue.onFullScreen,ht=ue.className,Ke=ht===void 0?"":ht,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(T.useState)(null),y=Object(K.a)(p,2),M=y[0],Q=y[1],W=Object(T.useState)(Le),me=Object(K.a)(W,2),Ye=me[0],dt=me[1],jt=Object(T.useState)(sn),Qe=Object(K.a)(jt,2),Vt=Qe[0],hn=Qe[1],Rn=Object(T.useState)(cn),pr=Object(K.a)(Rn,2),qn=pr[0],xn=pr[1],Rr=Object(T.useState)(""),qr=Object(K.a)(Rr,2),Vn=qr[0],_t=qr[1],Te=Object(T.useState)(0),nt=Object(K.a)(Te,2),Ht=nt[0],Ot=nt[1],Nt=Object(T.useState)(ot),Xt=Object(K.a)(Nt,2),Dn=Xt[0],Sn=Xt[1],un=Object(T.useState)(!1),jn=Object(K.a)(un,2),Kn=jn[0],ir=jn[1],yn=Object(T.useRef)(Object(qe.a)()),mn=Object(T.useRef)(!1),Ln=Object(T.useRef)(),en=Object(T.useRef)(),Un=Object(T.useRef)(),_n=Object(T.useRef)(),mr=Object(T.useRef)(),ar=function(){var Gt=Object(N.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(o.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):vn.content_type.indexOf("pdf")>-1?M.replaceSelection('<a href="'.concat(o.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(o.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(T.useEffect)(function(){dt(F),M==null||M.setValue(F)},[F]),Object(T.useEffect)(function(){on==null||on(qn)},[qn]),Object(T.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();xe(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(o.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(o.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(o.a.API_SERVER,"/api/attachments/").concat(Tn.id,'?type=office&disposition=inline" target="_blank">').concat(gn.name,"</a>")):Gt.replaceSelection("[".concat(gn.name,"](").concat(o.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();xe(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(o.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(o.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(o.a.API_SERVER,"/api/attachments/").concat(Tn.id,'?type=office&disposition=inline" target="_blank">').concat(gn.name,"</a>")):Gt.replaceSelection("[".concat(gn.name,"](").concat(o.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(T.useCallback)(function(){if(Un.current)try{}catch(Gt){console.log(Gt,"---- to set md editor body height")}},[Dn,Un,qn]);Object(T.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(T.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(I.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(T.useEffect)(function(){cn!==qn&&xn(cn)},[cn]),Object(Tt.a)(function(){if(!It&&Ht>0){var Gt=new Date().getTime(),nn=window.sessionStorage.getItem(Ft);Gt>=Ht+St&&(!nn||nn!==Ye)&&(window.sessionStorage.setItem(Ft,Ye),ir(!0))}},St),Object(T.useEffect)(function(){hn(sn)},[M,sn]),Object(T.useEffect)(function(){M&&(Kt&&M.focus())},[M,Kt]),Object(T.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(T.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(T.useEffect)(function(){if(M&&qt){function Gt(){qt(M.getValue())}return M.on("blur",Gt),function(){M.off("blur",Gt)}}},[M,qt]),Object(T.useEffect)(function(){if(M){function Gt(nn){var Jt=nn.getValue();dt(Jt),Ot(new Date().getTime()),nn.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),tt&&tt(Jt)}return M.on("change",Gt),function(){M.off("change",Gt)}}},[M,tt]),Object(T.useEffect)(function(){M&&(Le==null?(M.setValue(""),dt("")):Le!==M.getValue()&&(M.setValue(Le),dt(Le),M.setCursor(M.lineCount(),0)))},[M,Le]);var fi=Object(T.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 Ge:_t(Ge);return;case ct:_t(ct);return;case ke:_t(ke);return;case ut:_t(ut);return;default:throw new Error}},[M,Vt,qn]),Jr=Object(T.useCallback)(function(Gt){_t("");switch(Vn){case Ge:var nn=Gt.title,Jt=Gt.link;return M.replaceSelection("[".concat(nn,"](").concat(Jt,")")),M.focus();case ct:var fn=Gt.language,bn=Gt.content;return M.replaceSelection(["```"+fn,bn,"```"].join(`
`)),M.focus();case ke:var kn=Gt.src,vn=Gt.alt;return vn?M.replaceSelection("![ ".concat(vn," ]( ").concat(kn,' "').concat(vn,'" )')):M.replaceSelection("![,](".concat(kn,")")),M.focus();case ut: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(lt[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(T.useMemo)(function(){switch(Vn){case Ge:return A.a.createElement(pe,{callback:Jr,onCancel:ei});case ct:return A.a.createElement(ye.b,{callback:Jr,onCancel:ei});case ke:return A.a.createElement(ie,{callback:Jr,onCancel:ei});case ut:return A.a.createElement(We,{callback:Jr,onCancel:ei});default:return null}},[Vn]);function ei(){_t("")}Object(T.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=ot+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(T.useEffect)(function(){Sn(ot)},[ot]);var On=Ee($e),ti=Ee(Dn),Xr={width:On,height:ti},pi=Object(T.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),dt(Jt),M==null||M.setValue(Jt)}return A.a.createElement(T.Fragment,null,A.a.createElement("div",{className:"markdown-editor-wrapper",ref:Un},A.a.createElement("div",{className:"markdown-editor-container ".concat(Ke," ").concat(Vt?"on-preview":""," ").concat(zt?"mini":""," ").concat(qn?"full-screen":""),style:Xr},A.a.createElement(_,{insertTemp:Bt,watch:Vt,fullScreen:qn,showNullButton:at,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:Ye}),Qt!=="stex"&&A.a.createElement(m.a,{edit:!0,value:Ye,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($.a,{centered:!0,title:ae[Vn],visible:!0,onCancel:ei,footer:null,className:"markdown-popup-form"},Ti):null))}},PGNT:function(rt,Xe,X){rt.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(rt,Xe,X){rt.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(rt,Xe,X){rt.exports=X.p+"static/wenhao.50b63ac4.svg"},"RZ/O":function(rt,Xe,X){rt.exports=X.p+"static/bi.9c9b0364.svg"},SJMd:function(rt,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 X,oe,$,D=!1,Y,U;window.PR_SHOULD_USE_CONTINUATION=!0;var N,K;(function(){var I=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"],T=[L,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],A=[T,"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=[T,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],w=[T,"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",x=[T,"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,x,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",o="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,We=!1,ze=!1,qe=0,Ge=Ae.length;qe<Ge;++qe){var ke=Ae[qe];if(ke.ignoreCase)ze=!0;else if(/[a-z]/i.test(ke.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){We=!0,ze=!1;break}}var ct={b:8,t:9,n:10,v:11,f:12,r:13};function ut(yt){var Oe=yt.charCodeAt(0);if(Oe!==92)return Oe;var Pt=yt.charAt(1);return Oe=ct[Pt],Oe||("0"<=Pt&&Pt<="7"?parseInt(yt.substring(1),8):Pt==="u"||Pt==="x"?parseInt(yt.substring(2),16):yt.charCodeAt(1))}function vt(yt){if(yt<32)return(yt<16?"\\x0":"\\x")+yt.toString(16);var Oe=String.fromCharCode(yt);return Oe==="\\"||Oe==="-"||Oe==="]"||Oe==="^"?"\\"+Oe:Oe}function lt(yt){var Oe=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=[],St=Oe[0]==="^",Ue=["["];St&&Ue.push("^");for(var Ze=St?1:0,Ee=Oe.length;Ze<Ee;++Ze){var fe=Oe[Ze];if(/\\[bdsw]/i.test(fe))Ue.push(fe);else{var be=ut(fe),ne;Ze+2<Ee&&Oe[Ze+1]==="-"?(ne=ut(Oe[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 ce=Pt[Ze];ce[0]<=ae[1]+1?ae[1]=Math.max(ae[1],ce[1]):re.push(ae=ce)}for(var Ze=0;Ze<re.length;++Ze){var ce=re[Ze];Ue.push(vt(ce[0])),ce[1]>ce[0]&&(ce[1]+1>ce[0]&&Ue.push("-"),Ue.push(vt(ce[1])))}return Ue.push("]"),Ue.join("")}function Tt(yt){for(var Oe=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=Oe.length,St=[],Ue=0,Ze=0;Ue<Pt;++Ue){var Ee=Oe[Ue];if(Ee==="(")++Ze;else if(Ee.charAt(0)==="\\"){var fe=+Ee.substring(1);fe&&(fe<=Ze?St[fe]=-1:Oe[Ue]=vt(fe))}}for(var Ue=1;Ue<St.length;++Ue)St[Ue]===-1&&(St[Ue]=++Pe);for(var Ue=0,Ze=0;Ue<Pt;++Ue){var Ee=Oe[Ue];if(Ee==="(")++Ze,St[Ze]||(Oe[Ue]="(?:");else if(Ee.charAt(0)==="\\"){var fe=+Ee.substring(1);fe&&fe<=Ze&&(Oe[Ue]="\\"+St[fe])}}for(var Ue=0;Ue<Pt;++Ue)Oe[Ue]==="^"&&Oe[Ue+1]!=="^"&&(Oe[Ue]="");if(yt.ignoreCase&&We)for(var Ue=0;Ue<Pt;++Ue){var Ee=Oe[Ue],be=Ee.charAt(0);Ee.length>=2&&be==="["?Oe[Ue]=lt(Ee):be!=="\\"&&(Oe[Ue]=Ee.replace(/[a-zA-Z]/g,function(ae){var ce=ae.charCodeAt(0);return"["+String.fromCharCode(ce&~32,ce|32)+"]"}))}return Oe.join("")}for(var gt=[],qe=0,Ge=Ae.length;qe<Ge;++qe){var ke=Ae[qe];if(ke.global||ke.multiline)throw new Error(""+ke);gt.push("(?:"+Tt(ke)+")")}return new RegExp(gt.join("|"),ze?"gi":"g")}function B(Ae,Pe){var We=/(?:^|\s)nocode(?:\s|$)/,ze=[],qe=0,Ge=[],ke=0;function ct(ut){var vt=ut.nodeType;if(vt==1){if(We.test(ut.className))return;for(var lt=ut.firstChild;lt;lt=lt.nextSibling)ct(lt);var Tt=ut.nodeName.toLowerCase();(Tt==="br"||Tt==="li")&&(ze[ke]=`
`,Ge[ke<<1]=qe++,Ge[ke++<<1|1]=ut)}else if(vt==3||vt==4){var gt=ut.nodeValue;gt.length&&(Pe?gt=gt.replace(/\r\n?/g,`
`):gt=gt.replace(/[ \t\r\n]+/g," "),ze[ke]=gt,Ge[ke<<1]=qe,qe+=gt.length,Ge[ke++<<1|1]=ut)}}return ct(Ae),{sourceCode:ze.join("").replace(/\n$/,""),spans:Ge}}function te(Ae,Pe,We,ze,qe){if(!We)return;var Ge={sourceNode:Ae,pre:1,langExtension:null,numberLines:null,sourceCode:We,spans:null,basePos:Pe,decorations:null};ze(Ge),qe.push.apply(qe,Ge.decorations)}var de=/\S/;function pe(Ae){for(var Pe=void 0,We=Ae.firstChild;We;We=We.nextSibling){var ze=We.nodeType;Pe=ze===1?Pe?Ae:We:ze===3&&de.test(We.nodeValue)?Ae:Pe}return Pe===Ae?void 0:Pe}function ye(Ae,Pe){var We={},ze;(function(){for(var ke=Ae.concat(Pe),ct=[],ut={},vt=0,lt=ke.length;vt<lt;++vt){var Tt=ke[vt],gt=Tt[3];if(gt)for(var yt=gt.length;--yt>=0;)We[gt.charAt(yt)]=Tt;var Oe=Tt[1],Pt=""+Oe;ut.hasOwnProperty(Pt)||(ct.push(Oe),ut[Pt]=null)}ct.push(/[\0-\uffff]/),ze=G(ct)})();var qe=Pe.length,Ge=function(ke){for(var ct=ke.sourceCode,ut=ke.basePos,vt=ke.sourceNode,lt=[ut,o],Tt=0,gt=ct.match(ze)||[],yt={},Oe=0,Pt=gt.length;Oe<Pt;++Oe){var St=gt[Oe],Ue=yt[St],Ze=void 0,Ee;if(typeof Ue=="string")Ee=!1;else{var fe=We[St.charAt(0)];if(fe)Ze=St.match(fe[1]),Ue=fe[0];else{for(var be=0;be<qe;++be)if(fe=Pe[be],Ze=St.match(fe[1]),Ze){Ue=fe[0];break}Ze||(Ue=o)}Ee=Ue.length>=5&&Ue.substring(0,5)==="lang-",Ee&&!(Ze&&typeof Ze[1]=="string")&&(Ee=!1,Ue=_),Ee||(yt[St]=Ue)}var ne=Tt;if(Tt+=St.length,!Ee)lt.push(ut+ne,Ue);else{var re=Ze[1],ae=St.indexOf(re),ce=ae+re.length;Ze[2]&&(ce=St.length-Ze[2].length,ae=ce-re.length);var ue=Ue.substring(5);te(vt,ut+ne,St.substring(0,ae),Ge,lt),te(vt,ut+ne+ae,re,q(ue,re),lt),te(vt,ut+ne+ce,St.substring(ce),Ge,lt)}}ke.decorations=lt};return Ge}function Ce(Ae){var Pe=[],We=[];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&&We.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,"#"]),We.push([m,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Pe.push([E,/^#[^\r\n]*/,null,"#"])),Ae.cStyleComments&&(We.push([E,/^\/\/[^\r\n]*/,null]),We.push([E,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var qe=Ae.regexLiterals;if(qe){var Ge=qe>1?"":`
\r`,ke=Ge?".":"[\\S\\s]",ct="/(?=[^/*"+Ge+"])(?:[^/\\x5B\\x5C"+Ge+"]|\\x5C"+ke+"|\\x5B(?:[^\\x5C\\x5D"+Ge+"]|\\x5C"+ke+")*(?:\\x5D|$))+/";We.push(["lang-regex",RegExp("^"+Z+"("+ct+")")])}var ut=Ae.types;ut&&We.push([d,ut]);var vt=(""+Ae.keywords).replace(/^ | $/g,"");vt.length&&We.push([u,new RegExp("^(?:"+vt.replace(/[\s,]+/g,"|")+")\\b"),null]),Pe.push([o,/^\s+/,null,` \r
\xA0`]);var lt="^.[^\\s\\w.$@'\"`/\\\\]*";return Ae.regexLiterals&&(lt+="(?!s*/)"),We.push([f,/^@[a-z_$][a-z_$@0-9]*/i,null],[d,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[o,/^[a-z_$][a-z_$@0-9]*/i,null],[f,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[o,/^\\[\s\S]?/,null],[s,new RegExp(lt),null]),ye(Pe,We)}var _e=Ce({keywords:C,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function le(Ae,Pe,We){for(var ze=/(?:^|\s)nocode(?:\s|$)/,qe=/\r\n?|\n/,Ge=Ae.ownerDocument,ke=Ge.createElement("li");Ae.firstChild;)ke.appendChild(Ae.firstChild);var ct=[ke];function ut(Oe){var Pt=Oe.nodeType;if(Pt==1&&!ze.test(Oe.className))if(Oe.nodeName==="br")vt(Oe),Oe.parentNode&&Oe.parentNode.removeChild(Oe);else for(var St=Oe.firstChild;St;St=St.nextSibling)ut(St);else if((Pt==3||Pt==4)&&We){var Ue=Oe.nodeValue,Ze=Ue.match(qe);if(Ze){var Ee=Ue.substring(0,Ze.index);Oe.nodeValue=Ee;var fe=Ue.substring(Ze.index+Ze[0].length);if(fe){var be=Oe.parentNode;be.insertBefore(Ge.createTextNode(fe),Oe.nextSibling)}vt(Oe),Ee||Oe.parentNode.removeChild(Oe)}}}function vt(Oe){for(;!Oe.nextSibling;)if(Oe=Oe.parentNode,!Oe)return;function Pt(Ze,Ee){var fe=Ee?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 St=Pt(Oe.nextSibling,0),Ue;(Ue=St.parentNode)&&Ue.nodeType===1;)St=Ue;ct.push(St)}for(var lt=0;lt<ct.length;++lt)ut(ct[lt]);Pe===(Pe|0)&&ct[0].setAttribute("value",Pe);var Tt=Ge.createElement("ol");Tt.className="linenums";for(var gt=Math.max(0,Pe-1|0)||0,lt=0,yt=ct.length;lt<yt;++lt)ke=ct[lt],ke.className="L"+(lt+gt)%10,ke.firstChild||ke.appendChild(Ge.createTextNode("\xA0")),Tt.appendChild(ke);Ae.appendChild(Tt)}function se(Ae){var Pe=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Pe=Pe&&+Pe[1]<=8;var We=/\n/g,ze=Ae.sourceCode,qe=ze.length,Ge=0,ke=Ae.spans,ct=ke.length,ut=0,vt=Ae.decorations,lt=vt.length,Tt=0;vt[lt]=qe;var gt,yt;for(yt=gt=0;yt<lt;)vt[yt]!==vt[yt+2]?(vt[gt++]=vt[yt++],vt[gt++]=vt[yt++]):yt+=2;for(lt=gt,yt=gt=0;yt<lt;){for(var Oe=vt[yt],Pt=vt[yt+1],St=yt+2;St+2<=lt&&vt[St+1]===Pt;)St+=2;vt[gt++]=Oe,vt[gt++]=Pt,yt=St}lt=vt.length=gt;var Ue=Ae.sourceNode,Ze="";Ue&&(Ze=Ue.style.display,Ue.style.display="none");try{for(var Ee=null;ut<ct;){var fe=ke[ut],be=ke[ut+2]||qe,ne=vt[Tt+2]||qe,St=Math.min(be,ne),re=ke[ut+1],ae;if(re.nodeType!==1&&(ae=ze.substring(Ge,St))){Pe&&(ae=ae.replace(We,"\r")),re.nodeValue=ae;var ce=re.ownerDocument,ue=ce.createElement("span");ue.className=vt[Tt+1];var we=re.parentNode;we.replaceChild(ue,re),ue.appendChild(re),Ge<be&&(ke[ut+1]=re=ce.createTextNode(ze.substring(St,be)),we.insertBefore(re,ue.nextSibling))}Ge=St,Ge>=be&&(ut+=2),Ge>=ne&&(Tt+=2)}}finally{Ue&&(Ue.style.display=Ze)}}var ve={};function ie(Ae,Pe){for(var We=Pe.length;--We>=0;){var ze=Pe[We];ve.hasOwnProperty(ze)?I.console&&console.warn("cannot override language handler %s",ze):ve[ze]=Ae}}function q(Ae,Pe){return Ae&&ve.hasOwnProperty(Ae)||(Ae=/^\s*</.test(Pe)?"default-markup":"default-code"),ve[Ae]}ie(_e,["default-code"]),ie(ye([],[[o,/^[^<?]+/],[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([[o,/^[\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:x,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 xe(Ae){var Pe=Ae.langExtension;try{var We=B(Ae.sourceNode,Ae.pre),ze=We.sourceCode;Ae.sourceCode=ze,Ae.spans=We.spans,Ae.basePos=0,q(Pe,ze)(Ae),se(Ae)}catch(qe){I.console&&console.log(qe&&qe.stack||qe)}}function Ie(Ae,Pe,We){var ze=We||!1,qe=Pe||null,Ge=document.createElement("div");Ge.innerHTML="<pre>"+Ae+"</pre>",Ge=Ge.firstChild,ze&&le(Ge,ze,!0);var ke={langExtension:qe,numberLines:ze,sourceNode:Ge,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return xe(ke),Ge.innerHTML}function Ne(Ae,Pe){var We=Pe||document.body,ze=We.ownerDocument||document;function qe(fe){return We.getElementsByTagName(fe)}for(var Ge=[qe("pre"),qe("code"),qe("xmp")],ke=[],ct=0;ct<Ge.length;++ct)for(var ut=0,vt=Ge[ct].length;ut<vt;++ut)ke.push(Ge[ct][ut]);Ge=null;var lt=Date;lt.now||(lt={now:function(){return+new Date}});var Tt=0,gt=/\blang(?:uage)?-([\w.]+)(?!\S)/,yt=/\bprettyprint\b/,Oe=/\bprettyprinted\b/,Pt=/pre|xmp/i,St=/^code$/i,Ue=/^(?:pre|code|xmp)$/i,Ze={};function Ee(){for(var fe=I.PR_SHOULD_USE_CONTINUATION?lt.now()+250:Infinity;Tt<ke.length&&lt.now()<fe;Tt++){for(var be=ke[Tt],ne=Ze,re=be;re=re.previousSibling;){var ae=re.nodeType,ce=(ae===7||ae===8)&&re.nodeValue;if(ce?!/^\??prettify\b/.test(ce):ae!==3||/\S/.test(re.nodeValue))break;if(ce){ne={},ce.replace(/\b(\w+)=([\w:.%+-]+)/g,function(sn,Bt,an){ne[Bt]=an});break}}var ue=be.className;if((ne!==Ze||yt.test(ue))&&!Oe.test(ue)){for(var we=!1,Le=be.parentNode;Le;Le=Le.parentNode){var tt=Le.tagName;if(Ue.test(tt)&&Le.className&&yt.test(Le.className)){we=!0;break}}if(!we){be.className+=" prettyprinted";var Fe=ne.lang;if(!Fe){Fe=ue.match(gt);var $e;!Fe&&($e=pe(be))&&St.test($e.tagName)&&(Fe=$e.className.match(gt)),Fe&&(Fe=Fe[1])}var Dt;if(Pt.test(be.tagName))Dt=1;else{var ot=be.currentStyle,ft=ze.defaultView,zt=ot?ot.whiteSpace:ft&&ft.getComputedStyle?ft.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:Fe,sourceNode:be,numberLines:Je,pre:Dt,sourceCode:null,basePos:null,spans:null,decorations:null};xe(Kt)}}}Tt<ke.length?I.setTimeout(Ee,250):typeof Ae=="function"&&Ae()}Ee()}var De=I.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:o,PR_PUNCTUATION:s,PR_SOURCE:_,PR_STRING:m,PR_TAG:b,PR_TYPE:d,prettyPrintOne:D?I.prettyPrintOne=Ie:N=Ie,prettyPrint:K=D?I.prettyPrint=Ne:K=Ne},Be=I.define;typeof Be=="function"&&Be.amd&&Be("google-code-prettify",[],function(){return De})})()},"VrN/":function(rt,Xe,X){(function(oe,$){rt.exports=$()})(this,function(){"use strict";var oe=navigator.userAgent,$=navigator.platform,D=/gecko\/\d/i.test(oe),Y=/MSIE \d/.test(oe),U=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(oe),N=/Edge\/(\d+)/.exec(oe),K=Y||U||N,I=K&&(Y?document.documentMode||6:+(N||U)[1]),O=!N&&/WebKit\//.test(oe),L=O&&/Qt\/\d+\.\d+/.test(oe),T=!N&&/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),x=!N&&/AppleWebKit/.test(oe)&&/Mobile\/\w+/.test(oe),h=/Android/.test(oe),l=x||h||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(oe),i=x||/Mac/.test($),c=/\bCrOS\b/.test(oe),C=/win/i.test($),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&&I>=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 a=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(a?n[1]+a:"")}};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 o(e,t,r,n){var a=document.createElement(e);if(r&&(a.className=r),n&&(a.style.cssText=n),typeof t=="string")a.appendChild(document.createTextNode(t));else if(t)for(var R=0;R<t.length;++R)a.appendChild(t[R]);return a}function b(e,t,r,n){var a=o(e,t,r,n);return a.setAttribute("role","presentation"),a}var g;document.createRange?g=function(e,t,r,n){var a=document.createRange();return a.setEnd(n||e,r),a.setStart(e,t),a}:g=function(e,t,r){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(a){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()};x?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,a){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var R=n||0,j=a||0;;){var V=e.indexOf(" ",R);if(V<0||V>=t)return j+(t-R);j+=V-R,j+=r-j%r,R=V+1}}var de=function(){this.id=null,this.f=null,this.time=0,this.handler=G(this.onTimeout,this)};de.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},de.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 ve(e,t,r){for(var n=0,a=0;;){var R=e.indexOf(" ",n);R==-1&&(R=e.length);var j=R-n;if(R==e.length||a+j>=t)return n+Math.min(j,t-a);if(a+=R-n,a+=r-a%r,n=R+1,a>=t)return n}}var ie=[""];function q(e){for(;ie.length<=e;)ie.push(xe(ie)+" ");return ie[e]}function xe(e){return e[e.length-1]}function Ie(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,a=r(t);n<e.length&&r(e[n])<=a;)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 We(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 Ge(e){return e.charCodeAt(0)>=768&&qe.test(e)}function ke(e,t,r){for(;(r<0?t>0:t<e.length)&&Ge(e.charAt(t));)t+=r;return t}function ct(e,t,r){for(var n=t>r?-1:1;;){if(t==r)return t;var a=(t+r)/2,R=n<0?Math.ceil(a):Math.floor(a);if(R==t)return e(R)?t:r;e(R)?r=R:t=R+n}}function ut(e,t,r,n){if(!e)return n(t,r,"ltr",0);for(var a=!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),a=!0)}a||n(t,r,"ltr")}var vt=null;function lt(e,t,r){var n;vt=null;for(var a=0;a<e.length;++a){var R=e[a];if(R.from<t&&R.to>t)return a;R.to==t&&(R.from!=R.to&&r=="before"?n=a:vt=a),R.from==t&&(R.from!=R.to&&r!="before"?n=a:vt=a)}return n!=null?n:vt}var Tt=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]/,a=/[stwN]/,R=/[LRr]/,j=/[Lb1n]/,V=/[1n]/;function J(ee,he,ge){this.level=ee,this.from=he,this.to=ge}return function(ee,he){var ge=he=="ltr"?"L":"R";if(ee.length==0||he=="ltr"&&!n.test(ee))return!1;for(var Re=ee.length,Se=[],He=0;He<Re;++He)Se.push(r(ee.charCodeAt(He)));for(var et=0,pt=ge;et<Re;++et){var At=Se[et];At=="m"?Se[et]=pt:pt=At}for(var Ut=0,Rt=ge;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,$t=Se[0];tn<Re-1;++tn){var pn=Se[tn];pn=="+"&&$t=="1"&&Se[tn+1]=="1"?Se[tn]="1":pn==","&&$t==Se[tn+1]&&($t=="1"||$t=="n")&&(Se[tn]=$t),$t=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=ge;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(a.test(Se[hr])){var dr=void 0;for(dr=hr+1;dr<Re&&a.test(Se[dr]);++dr);for(var Zn=(hr?Se[hr-1]:ge)=="L",Kr=(dr<Re?Se[dr]:ge)=="L",qi=Zn==Kr?Zn?"L":"R":ge,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(V.test(Se[Ur])){hi<Ur&&(Or.splice(Ui,0,new J(1,hi,Ur)),Ui+=Bi);var ea=Ur;for(++Ur;Ur<wr&&V.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))),xe(Or).level==1&&(li=ee.match(/\s+$/))&&(xe(Or).to-=li[0].length,Or.push(new J(0,Re-li[0].length,Re)))),he=="rtl"?Or.reverse():Or}}();function gt(e,t){var r=e.order;return r==null&&(r=e.order=Tt(e.text,t)),r}var yt=[],Oe=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 St(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,a=n&&n[t];if(a){var R=pe(a,r);R>-1&&(n[t]=a.slice(0,R).concat(a.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),a=0;a<r.length;++a)r[a].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 Ee(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){Oe(this,t,r)},e.prototype.off=function(t,r){St(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 ce(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&&I<9)return!1;var e=o("div");return"draggable"in e||"dragDrop"in e}(),tt;function Fe(e){if(tt==null){var t=o("span","\u200B");s(e,o("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(tt=t.offsetWidth<=1&&t.offsetHeight>2&&!(K&&I<8))}var r=tt?o("span","\u200B"):o("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}var $e;function Dt(e){if($e!=null)return $e;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:$e=n.right-r.right<3}var ot=`
b`.split(/\n/).length!=3?function(e){for(var t=0,r=[],n=e.length;t<=n;){var a=e.indexOf(`
`,t);a==-1&&(a=e.length);var R=e.slice(t,e.charAt(a-1)=="\r"?a-1:a),j=R.indexOf("\r");j!=-1?(r.push(R.slice(0,j)),t+=j+1):(r.push(R),t=a+1)}return r}:function(e){return e.split(/\r\n?|\n/)},ft=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=o("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,o("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 it(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 it("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return it("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Ft(e,t){t=it(t);var r=sn[t.name];if(!r)return Ft(e,"text/plain");var n=r(e,t);if(xt.hasOwnProperty(t.name)){var a=xt[t.name];for(var R in a){if(!a.hasOwnProperty(R))continue;n.hasOwnProperty(R)&&(n["_"+R]=n[R]),n[R]=a[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 a=t[n];a instanceof Array&&(a=a.concat([])),r[n]=a}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 at=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};at.prototype.eol=function(){return this.pos>=this.string.length},at.prototype.sol=function(){return this.pos==this.lineStart},at.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},at.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},at.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},at.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},at.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},at.prototype.skipToEnd=function(){this.pos=this.string.length},at.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},at.prototype.backUp=function(e){this.pos-=e},at.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)},at.prototype.indentation=function(){return te(this.string,null,this.tabSize)-(this.lineStart?te(this.string,this.lineStart,this.tabSize):0)},at.prototype.match=function(e,t,r){if(typeof e=="string"){var n=function(j){return r?j.toLowerCase():j},a=this.string.substr(this.pos,e.length);if(n(a)==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)}},at.prototype.current=function(){return this.string.slice(this.start,this.pos)},at.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},at.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},at.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 a=r.children[n],R=a.chunkSize();if(t<R){r=a;break}t-=R}return r.lines[t]}function ln(e,t,r){var n=[],a=t.line;return e.iter(t.line,r.line+1,function(R){var j=R.text;a==r.line&&(j=j.slice(0,r.ch)),a==t.line&&(j=j.slice(t.ch)),n.push(j),++a}),n}function Yt(e,t,r){var n=[];return e.iter(t,r,function(a){n.push(a.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 a=0;!(n.children[a]==t);++a)r+=n.children[a].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 a=e.children[n],R=a.height;if(t<R){e=a;continue e}t-=R,r+=a.chunkSize()}return r}while(!e.lines);for(var j=0;j<e.lines.length;++j){var V=e.lines[j],J=V.height;if(t<J)break;t-=J}return r+j}function on(e,t){return t>=e.first&&t<e.first+e.size}function ht(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Ke(e,t,r){if(r===void 0&&(r=null),!(this instanceof Ke))return new Ke(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 Ke(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 Ke(e.first,0);var r=e.first+e.size-1;return t.line>r?Ke(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?Ke(e.line,t):r<0?Ke(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 a=[e.state.modeGen],R={};qn(e,t.text,e.doc.mode,r,function(ee,he){return a.push(ee,he)},R,n);for(var j=r.state,V=function(ee){r.baseTokens=a;var he=e.state.overlays[ee],ge=1,Re=0;r.state=!0,qn(e,t.text,he.mode,r,function(Se,He){for(var et=ge;Re<Se;){var pt=a[ge];pt>Se&&a.splice(ge,1,Se,a[ge+1],pt),ge+=2,Re=Math.min(Se,pt)}if(!He)return;if(he.opaque)a.splice(et,ge-et,Se,"overlay "+He),ge=et+2;else for(;et<ge;et+=2){var At=a[et+1];a[et+1]=(At?At+" ":"")+"overlay "+He}},R),r.state=j,r.baseTokens=null,r.baseTokenPos=1},J=0;J<e.state.overlays.length;++J)V(J);return{styles:a,classes:R.bgClass||R.textClass?R:null}}function Ye(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=dt(e,qt(t)),a=t.text.length>e.options.maxHighlightLength&&Mt(e.doc.mode,n.state),R=me(e,t,n);a&&(n.state=a),t.stateAfter=n.save(!a),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 dt(e,t,r){var n=e.doc,a=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,V=j?W.fromSaved(n,j,R):new W(n,Lt(n.mode),R);return n.iter(R,t,function(J){jt(e,J.text,V);var ee=V.line;J.stateAfter=ee==t-1||ee%5==0||ee>=a.viewFrom&&ee<a.viewTo?V.save():null,V.nextLine()}),r&&(n.modeFrontier=V.line),V}function jt(e,t,r,n){var a=e.doc.mode,R=new at(t,e.options.tabSize,r);for(R.start=R.pos=n||0,t==""&&Qe(a,r.state);!R.eol();)Vt(a,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 a=0;a<10;a++){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 a=e.doc,R=a.mode,j;t=p(a,t);var V=Ve(a,t.line),J=dt(e,t.line,r),ee=new at(V.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(a.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,a,R,j){var V=r.flattenSpans;V==null&&(V=e.options.flattenSpans);var J=0,ee=null,he=new at(t,e.options.tabSize,n),ge,Re=e.options.addModeClass&&[null];for(t==""&&pr(Qe(r,n.state),R);!he.eol();){if(he.pos>e.options.maxHighlightLength?(V=!1,j&&jt(e,t,n,he.pos),he.pos=t.length,ge=null):ge=pr(Vt(r,he,n.state,Re),R),Re){var Se=Re[0].name;Se&&(ge="m-"+(ge?Se+" "+ge:Se))}if(!V||ee!=ge){for(;J<he.start;)J=Math.min(he.start,J+5e3),a(J,ee);ee=ge}he.start=he.pos}for(;J<he.pos;){var He=Math.min(he.pos,J+5e3);a(He,ee),J=He}}function xn(e,t,r){for(var n,a,R=e.doc,j=r?-1:t-(e.doc.mode.innerMode?1e3:100),V=t;V>j;--V){if(V<=R.first)return R.first;var J=Ve(R,V-1),ee=J.stateAfter;if(ee&&(!r||V+(ee instanceof Q?ee.lookAhead:0)<=R.modeFrontier))return V;var he=te(J.text,null,e.options.tabSize);(a==null||n>he)&&(a=V-1,n=he)}return a}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 a=Ve(e,n).stateAfter;if(a&&(!(a instanceof Q)||n+a.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 nt(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 a=0;a<e.length;++a){var R=e[a],j=R.marker,V=R.from==null||(j.inclusiveLeft?R.from<=t:R.from<t);if(V||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 nt(j,R.from,J?null:R.to))}}return n}function Dn(e,t,r){var n;if(e)for(var a=0;a<e.length;++a){var R=e[a],j=R.marker,V=R.to==null||(j.inclusiveRight?R.to>=t:R.to>t);if(V||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 nt(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 a=t.from.ch,R=t.to.ch,j=wt(t.from,t.to)==0,V=Xt(r,a,j),J=Dn(n,R,j),ee=t.text.length==1,he=xe(t.text).length+(ee?a:0);if(V)for(var ge=0;ge<V.length;++ge){var Re=V[ge];if(Re.to==null){var Se=Ht(J,Re.marker);Se?ee&&(Re.to=Se.to==null?null:Se.to+he):Re.to=a}}if(J)for(var He=0;He<J.length;++He){var et=J[He];if(et.to!=null&&(et.to+=he),et.from==null){var pt=Ht(V,et.marker);pt||(et.from=he,ee&&(V||(V=[])).push(et))}else et.from+=he,ee&&(V||(V=[])).push(et)}V&&(V=un(V)),J&&J!=V&&(J=un(J));var At=[V];if(!ee){var Ut=t.text.length-2,Rt;if(Ut>0&&V)for(var Wt=0;Wt<V.length;++Wt)V[Wt].to==null&&(Rt||(Rt=[])).push(new nt(V[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 He=0;He<Se.markedSpans.length;++He){var et=Se.markedSpans[He].marker;et.readOnly&&(!n||pe(n,et)==-1)&&(n||(n=[])).push(et)}}),!n)return null;for(var a=[{from:t,to:r}],R=0;R<n.length;++R)for(var j=n[R],V=j.find(0),J=0;J<a.length;++J){var ee=a[J];if(wt(ee.to,V.from)<0||wt(ee.from,V.to)>0)continue;var he=[J,1],ge=wt(ee.from,V.from),Re=wt(ee.to,V.to);(ge<0||!j.inclusiveLeft&&!ge)&&he.push({from:ee.from,to:V.from}),(Re>0||!j.inclusiveRight&&!Re)&&he.push({from:V.to,to:ee.to}),a.splice.apply(a,he),J+=he.length-3}return a}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(),a=t.find(),R=wt(n.from,a.from)||yn(e)-yn(t);if(R)return-R;var j=wt(n.to,a.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 a=void 0,R=0;R<r.length;++R)a=r[R],a.marker.collapsed&&(t?a.from:a.to)==null&&(!n||Ln(n,a.marker)<0)&&(n=a.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 a=0;a<r.length;++a){var R=r[a];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,a){var R=Ve(e,t),j=Vn&&R.markedSpans;if(j)for(var V=0;V<j.length;++V){var J=j[V];if(!J.marker.collapsed)continue;var ee=J.marker.find(0),he=wt(ee.from,r)||yn(J.marker)-yn(a),ge=wt(ee.to,n)||mn(J.marker)-mn(a);if(he>=0&&ge<=0||he<=0&&ge>=0)continue;if(he<=0&&(J.marker.inclusiveRight&&a.inclusiveLeft?wt(ee.to,r)>=0:wt(ee.to,r)>0)||he>=0&&(J.marker.inclusiveRight&&a.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,a=0;a<r.length;++a){if(n=r[a],!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 a=void 0,R=0;R<t.markedSpans.length;++R)if(a=t.markedSpans[R],a.marker.collapsed&&!a.marker.widgetNode&&a.from==r.to&&(a.to==null||a.to!=r.from)&&(a.marker.inclusiveLeft||r.marker.inclusiveRight)&&ti(e,t,a))return!0}function Xr(e){e=gr(e);for(var t=0,r=e.parent,n=0;n<r.lines.length;++n){var a=r.lines[n];if(a==e)break;t+=a.height}for(var R=r.parent;R;r=R,R=r.parent)for(var j=0;j<R.children.length;++j){var V=R.children[j];if(V==r)break;t+=V.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 a=r.find(0,!0);n=a.from.line,t+=a.from.ch-a.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 a=pi(n);a>t.maxLineLength&&(t.maxLineLength=a,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 a=n?n(e):1;a!=e.height&&cn(e,a)}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 a=0;a<=(t.rest?t.rest.length:0);a++){var R=a?t.rest[a-1]:t.line,j=void 0;n.pos=0,n.addToken=vn,Dt(e.display.measure)&&(j=gt(R,e.doc.direction))&&(n.addToken=vr(n.addToken,j)),n.map=[];var V=t!=e.display.externalMeasured&&qt(R);Qr(R,n,Ye(e,R,V)),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(Fe(e.display.measure))),a==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=o("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,a,R,j){if(!t)return;var V=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(V),e.map.push(e.pos,e.pos+t.length,he),K&&I<9&&(ee=!0),e.pos+=t.length;else{he=document.createDocumentFragment();for(var ge=0;;){J.lastIndex=ge;var Re=J.exec(t),Se=Re?Re.index-ge:t.length-ge;if(Se){var He=document.createTextNode(V.slice(ge,ge+Se));K&&I<9?he.appendChild(o("span",[He])):he.appendChild(He),e.map.push(e.pos,e.pos+Se,He),e.col+=Se,e.pos+=Se}if(!Re)break;ge+=Se+1;var et=void 0;if(Re[0]==" "){var pt=e.cm.options.tabSize,At=pt-e.col%pt;et=he.appendChild(o("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(o("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&&I<9?he.appendChild(o("span",[et])):he.appendChild(et),e.col+=1);e.map.push(e.pos,e.pos+1,et),e.pos++}}if(e.trailingSpace=V.charCodeAt(t.length-1)==32,r||n||a||ee||R||j){var Ut=r||"";n&&(Ut+=n),a&&(Ut+=a);var Rt=o("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="",a=0;a<e.length;a++){var R=e.charAt(a);R==" "&&r&&(a==e.length-1||e.charCodeAt(a+1)==32)&&(R="\xA0"),n+=R,r=R==" "}return n}function vr(e,t){return function(r,n,a,R,j,V,J){a=a?a+" cm-force-border":"cm-force-border";for(var ee=r.pos,he=ee+n.length;;){for(var ge=void 0,Re=0;Re<t.length&&!(ge=t[Re],ge.to>ee&&ge.from<=ee);Re++);if(ge.to>=he)return e(r,n,a,R,j,V,J);e(r,n.slice(0,ge.to-ee),a,R,null,V,J),R=null,n=n.slice(ge.to-ee),ee=ge.to}}}function gn(e,t,r,n){var a=!n&&r.widgetNode;a&&e.map.push(e.pos,e.pos+t,a),!n&&e.cm.display.input.needsContentAttribute&&(a||(a=e.content.appendChild(document.createElement("span"))),a.setAttribute("cm-marker",r.id)),a&&(e.cm.display.input.setUneditable(a),e.content.appendChild(a)),e.pos+=t,e.trailingSpace=!1}function Qr(e,t,r){var n=e.markedSpans,a=e.text,R=0;if(!n){for(var j=1;j<r.length;j+=2)t.addToken(t,a.slice(R,R=r[j]),fn(r[j+1],t.cm.options));return}for(var V=a.length,J=0,ee=1,he="",ge,Re,Se=0,He,et,pt,At,Ut;;){if(Se==J){He=et=pt=Re="",Ut=null,At=null,Se=Infinity;for(var Rt=[],Wt=void 0,tn=0;tn<n.length;++tn){var $t=n[tn],pn=$t.marker;if(pn.type=="bookmark"&&$t.from==J&&pn.widgetNode)Rt.push(pn);else if($t.from<=J&&($t.to==null||$t.to>J||pn.collapsed&&$t.to==J&&$t.from==J)){if($t.to!=null&&$t.to!=J&&Se>$t.to&&(Se=$t.to,et=""),pn.className&&(He+=" "+pn.className),pn.css&&(Re=(Re?Re+";":"")+pn.css),pn.startStyle&&$t.from==J&&(pt+=" "+pn.startStyle),pn.endStyle&&$t.to==Se&&(Wt||(Wt=[])).push(pn.endStyle,$t.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=$t)}else $t.from>J&&Se>$t.from&&(Se=$t.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?V+1:At.to)-J,At.marker,At.from==null),At.to==null)return;At.to==J&&(At=!1)}}if(J>=V)break;for(var Vr=Math.min(V,Se);;){if(he){var Wr=J+he.length;if(!At){var ur=Wr>Vr?he.slice(0,Vr-J):he;t.addToken(t,ur,ge?ge+He:He,pt,J+ur.length==Se?et:"",Re,Ut)}if(Wr>=Vr){he=he.slice(Vr-J),J=Vr;break}J=Wr,pt=""}he=a.slice(R,R=r[ee++]),ge=fn(r[ee++],t.cm.options)}}}function Tn(e,t,r){this.line=t,this.rest=Jr(t),this.size=this.rest?qt(xe(this.rest))-r+1:1,this.node=this.text=null,this.hidden=On(e,t)}function or(e,t,r){for(var n=[],a,R=t;R<r;R=a){var j=new Tn(e.doc,Ve(e.doc,R),R);a=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 a=e.ops[n];if(a.cursorActivityHandlers)for(;a.cursorActivityCalled<a.cursorActivityHandlers.length;)a.cursorActivityHandlers[a.cursorActivityCalled++].call(null,a.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),a;tr?a=tr.delayedCallbacks:wi?a=wi:(a=wi=[],setTimeout(Za,0));for(var R=function(V){a.push(function(){return r[V].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 a=0;a<t.changes.length;a++){var R=t.changes[a];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=o("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),K&&I<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(o("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 a=mi(t);t.gutterBackground=o("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),a.insertBefore(t.gutterBackground,t.text)}var R=t.line.gutterMarkers;if(e.options.lineNumbers||R){var j=mi(t),V=t.gutter=o("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(V),j.insertBefore(V,t.text),t.line.gutterClass&&(V.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!R||!R["CodeMirror-linenumbers"])&&(t.lineNumber=V.appendChild(o("div",ht(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&&V.appendChild(o("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"),a=t.node.firstChild,R=void 0;a;a=R)R=a.nextSibling,n.test(a.className)&&t.node.removeChild(a);na(e,t,r)}function Ra(e,t,r,n){var a=wa(e,t);return t.text=t.node=a.pre,a.bgClass&&(t.bgClass=a.bgClass),a.textClass&&(t.textClass=a.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,a){if(!t.widgets)return;for(var R=mi(r),j=0,V=t.widgets;j<V.length;++j){var J=V[j],ee=o("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),a&&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 a=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(a-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=a+"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,o("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,o("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,a=n&&ii(e);if(!t.measure.heights||n&&t.measure.width!=a){var R=t.measure.heights=[];if(n){t.measure.width=a;for(var j=t.text.firstChild.getClientRects(),V=0;V<j.length-1;V++){var J=j[V],ee=j[V+1];Math.abs(J.bottom-ee.bottom)>2&&R.push((J.bottom+ee.top)/2-r.top)}}R.push(r.bottom-r.top)}}function st(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 a=0;a<e.rest.length;a++)if(qt(e.rest[a])>r)return{map:e.measure.maps[a],cache:e.measure.caches[a],before:!0}}function je(e,t){t=gr(t);var r=qt(t),n=e.display.externalMeasured=new Tn(e.doc,t,r);n.lineN=r;var a=n.built=bn(e,n);return n.text=a.pre,s(e.display.lineMeasure,a.pre),n}function Me(e,t,r,n){return Ct(e,mt(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 mt(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=je(e,t));var a=st(n,t,r);return{line:t,view:n,rect:null,map:a.map,cache:a.cache,before:a.before,hasHeights:!1}}function Ct(e,t,r,n,a){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:a?j.rtop:j.top,bottom:a?j.rbottom:j.bottom}}var Zt={left:0,right:0,top:0,bottom:0};function dn(e,t,r){for(var n,a,R,j,V,J,ee=0;ee<e.length;ee+=3)if(V=e[ee],J=e[ee+1],t<V?(a=0,R=1,j="left"):t<J?(a=t-V,R=a+1):(ee==e.length-3||t==J&&e[ee+3]>t)&&(R=J-V,a=R-1,t>=J&&(j="right")),a!=null){if(n=e[ee+2],V==J&&r==(n.insertLeft?"left":"right")&&(j=r),r=="left"&&a==0)for(;ee&&e[ee-2]==e[ee-3]&&e[ee-1].insertLeft;)n=e[(ee-=3)+2],j="left";if(r=="right"&&a==J-V)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:a,end:R,collapse:j,coverStart:V,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 a=e.length-1;a>=0&&!((r=e[a]).left!=r.right);a--);return r}function An(e,t,r,n){var a=dn(t.map,r,n),R=a.node,j=a.start,V=a.end,J=a.collapse,ee;if(R.nodeType==3){for(var he=0;he<4;he++){for(;j&&Ge(t.line.text.charAt(a.coverStart+j));)--j;for(;a.coverStart+V<a.coverEnd&&Ge(t.line.text.charAt(a.coverStart+V));)++V;if(K&&I<9&&j==0&&V==a.coverEnd-a.coverStart?ee=R.parentNode.getBoundingClientRect():ee=Mn(g(R,j,V).getClientRects(),n),ee.left||ee.right||j==0)break;V=j,j=j-1,J="right"}K&&I<11&&(ee=In(e.display.measure,ee))}else{j>0&&(J=n="right");var ge;e.options.lineWrapping&&(ge=R.getClientRects()).length>1?ee=ge[n=="right"?ge.length-1:0]:ee=R.getBoundingClientRect()}if(K&&I<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,He=ee.bottom-t.rect.top,et=(Se+He)/2,pt=t.view.measure.heights,At=0;At<pt.length-1&&!(et<pt[At]);At++);var Ut=At?pt[At-1]:0,Rt=pt[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=He),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 T&&h?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function yr(){return T&&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,a){if(!a){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 V=e.display.lineSpace.getBoundingClientRect();j+=V.top+(n=="window"?0:yr());var J=V.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,a=t.top;if(r=="page")n-=zn(),a-=yr();else if(r=="local"||!r){var R=e.display.sizer.getBoundingClientRect();n+=R.left,a+=R.top}var j=e.display.lineSpace.getBoundingClientRect();return{left:n-j.left,top:a-j.top}}function kr(e,t,r,n,a){return n||(n=Ve(e.doc,t.line)),Qn(e,n,Me(e,n,t.ch,a),r)}function rn(e,t,r,n,a,R){n=n||Ve(e.doc,t.line),a||(a=mt(e,n));function j(He,et){var pt=Ct(e,a,He,et?"right":"left",R);return et?pt.left=pt.right:pt.right=pt.left,Qn(e,n,pt,r)}var V=gt(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"),!V)return j(ee=="before"?J-1:J,ee=="before");function he(He,et,pt){var At=V[et],Ut=At.level==1;return j(pt?He-1:He,Ut!=pt)}var ge=lt(V,J,ee),Re=vt,Se=he(J,ge,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),a=Xr(n)+ji(e.display);return{left:r,right:r,top:a,bottom:a+n.height}}function $n(e,t,r,n,a){var R=Ke(e,t,r);return R.xRel=a,n&&(R.outside=n),R}function Er(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,r<0)return $n(n.first,0,null,-1,-1);var a=En(n,r),R=n.first+n.size-1;if(a>R)return $n(n.first+n.size-1,Ve(n,R).text.length,null,1,1);t<0&&(t=0);for(var j=Ve(n,a);;){var V=Bn(e,j,a,t,r),J=mr(j,V.ch+(V.xRel>0||V.outside>0?1:0));if(!J)return V;var ee=J.find(1);if(ee.line==a)return ee;j=Ve(n,a=ee.line)}}function lr(e,t,r,n){n-=sr(t);var a=t.text.length,R=ct(function(j){return Ct(e,r,j-1).bottom<=n},a,0);return a=ct(function(j){return Ct(e,r,j).top>n},R,a),{begin:R,end:a}}function Mr(e,t,r,n){r||(r=mt(e,t));var a=Qn(e,t,Ct(e,r,n),"line").top;return lr(e,t,r,a)}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,a){a-=Xr(t);var R=mt(e,t),j=sr(t),V=0,J=t.text.length,ee=!0,he=gt(t,e.doc.direction);if(he){var ge=(e.options.lineWrapping?xr:Xn)(e,t,r,R,he,n,a);ee=ge.level!=1,V=ee?ge.from:ge.to-1,J=ee?ge.to:ge.from-1}var Re=null,Se=null,He=ct(function(tn){var $t=Ct(e,R,tn);return $t.top+=j,$t.bottom+=j,Ir($t,n,a,!1)?($t.top<=a&&$t.left<=n&&(Re=tn,Se=$t),!0):!1},V,J),et,pt,At=!1;if(Se){var Ut=n-Se.left<Se.right-n,Rt=Ut==ee;He=Re+(Rt?0:1),pt=Rt?"after":"before",et=Ut?Se.left:Se.right}else{!ee&&(He==J||He==V)&&He++,pt=He==0?"after":He==t.text.length?"before":Ct(e,R,He-(ee?1:0)).bottom+j<=a==ee?"after":"before";var Wt=rn(e,Ke(r,He,pt),"line",t,R);et=Wt.left,At=a<Wt.top?-1:a>=Wt.bottom?1:0}return He=ke(t.text,He,1),$n(r,He,pt,At,n-et)}function Xn(e,t,r,n,a,R,j){var V=ct(function(ge){var Re=a[ge],Se=Re.level!=1;return Ir(rn(e,Ke(r,Se?Re.to:Re.from,Se?"before":"after"),"line",t,n),R,j,!0)},0,a.length-1),J=a[V];if(V>0){var ee=J.level!=1,he=rn(e,Ke(r,ee?J.from:J.to,ee?"after":"before"),"line",t,n);Ir(he,R,j,!0)&&he.top>j&&(J=a[V-1])}return J}function xr(e,t,r,n,a,R,j){var V=lr(e,t,n,j),J=V.begin,ee=V.end;/\s/.test(t.text.charAt(ee-1))&&ee--;for(var he=null,ge=null,Re=0;Re<a.length;Re++){var Se=a[Re];if(Se.from>=ee||Se.to<=J)continue;var He=Se.level!=1,et=Ct(e,n,He?Math.min(ee,Se.to)-1:Math.max(J,Se.from)).right,pt=et<R?R-et+1e9:et-R;(!he||ge>pt)&&(he=Se,ge=pt)}return he||(he=a[a.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=o("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Pr.appendChild(document.createTextNode("x")),Pr.appendChild(o("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=o("span","xxxxxxxxxx"),r=o("pre",[t],"CodeMirror-line-like");s(e.measure,r);var n=t.getBoundingClientRect(),a=(n.right-n.left)/10;return a>2&&(e.cachedCharWidth=a),a||10}function ra(e){for(var t=e.display,r={},n={},a=t.gutters.clientLeft,R=t.gutters.firstChild,j=0;R;R=R.nextSibling,++j){var V=e.display.gutterSpecs[j].className;r[V]=R.offsetLeft+R.clientLeft+a,n[V]=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(a){if(On(e.doc,a))return 0;var R=0;if(a.widgets)for(var j=0;j<a.widgets.length;j++)a.widgets[j].height&&(R+=a.widgets[j].height);return r?R+(Math.ceil(a.text.length/n)||1)*t:R+t}}function to(e){var t=e.doc,r=Lo(e);t.iter(function(n){var a=r(n);a!=n.height&&cn(n,a)})}function Di(e,t,r,n){var a=e.display;if(!r&&ue(t).getAttribute("cm-not-content")=="true")return null;var R,j,V=a.lineSpace.getBoundingClientRect();try{R=t.clientX-V.left,j=t.clientY-V.top}catch(ge){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=Ke(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 a=e.display;if(n&&r<a.viewTo&&(a.updateLineNumbers==null||a.updateLineNumbers>t)&&(a.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=a.viewTo)Vn&&Ti(e.doc,t)<a.viewTo&&yi(e);else if(r<=a.viewFrom)Vn&&ei(e.doc,r+n)>a.viewFrom?yi(e):(a.viewFrom+=n,a.viewTo+=n);else if(t<=a.viewFrom&&r>=a.viewTo)yi(e);else if(t<=a.viewFrom){var R=Pa(e,r,r+n,1);R?(a.view=a.view.slice(R.index),a.viewFrom=R.lineN,a.viewTo+=n):yi(e)}else if(r>=a.viewTo){var j=Pa(e,t,t,-1);j?(a.view=a.view.slice(0,j.index),a.viewTo=j.lineN):yi(e)}else{var V=Pa(e,t,t,-1),J=Pa(e,r,r+n,1);V&&J?(a.view=a.view.slice(0,V.index).concat(or(e,V.lineN,J.lineN)).concat(a.view.slice(J.index)),a.viewTo+=n):yi(e)}var ee=a.externalMeasured;ee&&(r<ee.lineN?ee.lineN+=n:t<ee.lineN+ee.size&&(a.externalMeasured=null))}function vi(e,t,r){e.curOp.viewChanged=!0;var n=e.display,a=e.display.externalMeasured;if(a&&t>=a.lineN&&t<a.lineN+a.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 a=Oi(e,t),R,j=e.display.view;if(!Vn||r==e.doc.first+e.doc.size)return{index:a,lineN:r};for(var V=e.display.viewFrom,J=0;J<a;J++)V+=j[J].size;if(V!=t){if(n>0){if(a==j.length-1)return null;R=V+j[a].size-t,a++}else R=V-t;t+=R,r+=R}for(;Ti(e.doc,r)!=r;){if(a==(n<0?0:j.length-1))return null;r+=n*j[a-(n<0?1:0)].size,a+=n}return{index:a,lineN:r}}function Vs(e,t,r){var n=e.display,a=n.view;a.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 a=t[n];!a.hidden&&(!a.node||a.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={},a=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 V=r.sel.ranges[j];if(V.from().line>=e.display.viewTo||V.to().line<e.display.viewFrom)continue;var J=V.empty();(J||e.options.showCursorWhenSelecting)&&Oo(e,V.head,a),J||Xs(e,V,R)}return n}function Oo(e,t,r){var n=rn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),a=r.appendChild(o("div","\xA0","CodeMirror-cursor"));if(a.style.left=n.left+"px",a.style.top=n.top+"px",a.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",n.other){var R=r.appendChild(o("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,a=e.doc,R=document.createDocumentFragment(),j=La(e.display),V=j.left,J=Math.max(n.sizerWidth,ii(e)-n.sizer.offsetLeft)-j.right,ee=a.direction=="ltr";function he(Rt,Wt,tn,$t){Wt<0&&(Wt=0),Wt=Math.round(Wt),$t=Math.round($t),R.appendChild(o("div",null,"CodeMirror-selected","position: absolute; left: "+Rt+`px;
top: `+Wt+"px; width: "+(tn==null?J-Rt:tn)+`px;
height: `+($t-Wt)+"px"))}function ge(Rt,Wt,tn){var $t=Ve(a,Rt),pn=$t.text.length,Wn,Tr;function Jn(ur,Hr){return kr(e,Ke(Rt,ur),"div",$t,Hr)}function Vr(ur,Hr,Lr){var hr=Mr(e,$t,null,ur),dr=Hr=="ltr"==(Lr=="after")?"left":"right",Zn=Lr=="after"?hr.begin:hr.end-(/\s/.test($t.text.charAt(hr.end-1))?2:1);return Jn(Zn,dr)[dr]}var Wr=gt($t,a.direction);return ut(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?V:(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?V:Zn.left,Ur=ee?J:Vr(ur,Lr,"before"),ea=ee?V:Vr(Hr,Lr,"after"),Ro=ee&&Si&&li?J:Kr.right):(Bi=ee?Vr(ur,Lr,"before"):V,Ur=!ee&&qi&&Or?J:Zn.right,ea=!ee&&Si&&li?V:Kr.left,Ro=ee?Vr(Hr,Lr,"after"):J),he(Bi,Zn.top,Ur-Bi,Zn.bottom),Zn.bottom<Kr.top&&he(V,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)ge(Re.line,Re.ch,Se.ch);else{var He=Ve(a,Re.line),et=Ve(a,Se.line),pt=gr(He)==gr(et),At=ge(Re.line,Re.ch,pt?He.text.length+1:null).end,Ut=ge(Se.line,pt?0:null,Se.ch).start;pt&&(At.top<Ut.top-2?(he(At.right,At.top,null,At.bottom),he(V,Ut.top,Ut.left,Ut.bottom)):he(At.right,At.top,Ut.left-At.right,At.bottom)),At.bottom<Ut.top&&he(V,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 a=t.view[n],R=e.options.lineWrapping,j=void 0,V=0;if(a.hidden)continue;if(K&&I<8){var J=a.node.offsetTop+a.node.offsetHeight;j=J-r,r=J}else{var ee=a.node.getBoundingClientRect();j=ee.bottom-ee.top,!R&&a.text.firstChild&&(V=a.text.firstChild.getBoundingClientRect().right-ee.left-1)}var he=a.line.height-j;if((he>.005||he<-.005)&&(cn(a.line,j),Io(a.line),a.rest))for(var ge=0;ge<a.rest.length;ge++)Io(a.rest[ge]);if(V>e.display.sizerWidth){var Re=Math.ceil(V/Br(e.display));Re>e.display.maxLineLength&&(e.display.maxLineLength=Re,e.display.maxLine=a.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 a=r&&r.bottom!=null?r.bottom:n+e.wrapper.clientHeight,R=En(t,n),j=En(t,a);if(r&&r.ensure){var V=r.ensure.from.line,J=r.ensure.to.line;V<R?(R=V,j=En(t,Xr(Ve(t,V))+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 Ys(e,t){if(Ze(e,"scrollCursorIntoView"))return;var r=e.display,n=r.sizer.getBoundingClientRect(),a=null;if(t.top+n.top<0?a=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(a=!1),a!=null&&!S){var R=o("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(a),e.display.lineSpace.removeChild(R)}}function $s(e,t,r,n){n==null&&(n=0);var a;!e.options.lineWrapping&&t==r&&(t=t.ch?Ke(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,r=t.sticky=="before"?Ke(t.line,t.ch+1,"before"):t);for(var R=0;R<5;R++){var j=!1,V=rn(e,t),J=!r||r==t?V:rn(e,r);a={left:Math.min(V.left,J.left),top:Math.min(V.top,J.top)-n,right:Math.max(V.left,J.left),bottom:Math.max(V.bottom,J.bottom)+n};var ee=io(e,a),he=e.doc.scrollTop,ge=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-ge)>1&&(j=!0)),!j)break}return a}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 a=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 V=e.doc.height+Li(r),J=t.top<n,ee=t.bottom>V-n;if(t.top<a)j.scrollTop=J?0:t.top;else if(t.bottom>a+R){var he=Math.min(t.top,(ee?V:t.bottom)-R);he!=a&&(j.scrollTop=he)}var ge=e.options.fixedGutter?0:r.gutters.offsetWidth,Re=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:r.scroller.scrollLeft-ge,Se=ii(e)-r.gutters.offsetWidth,He=t.right-t.left>Se;return He&&(t.right=t.left+Se),t.left<10?j.scrollLeft=0:t.left<Re?j.scrollLeft=Math.max(0,t.left+ge-(He?0:10)):t.right>Se+Re-3&&(j.scrollLeft=t.right+(He?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 a=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,a.scrollLeft,a.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=o("div",[o("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),a=this.horiz=o("div",[o("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=a.tabIndex=-1,e(n),e(a),Oe(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),Oe(a,"scroll",function(){a.clientWidth&&t(a.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,K&&I<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 a=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+a)+"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 de,this.disableVert=new de},Mi.prototype.enableZeroWidthBar=function(e,t,r){e.style.pointerEvents="auto";function n(){var a=e.getBoundingClientRect(),R=r=="vert"?document.elementFromPoint(a.right-1,(a.top+a.bottom)/2):document.elementFromPoint((a.right+a.left)/2,a.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 a=0;a<4&&r!=e.display.barWidth||n!=e.display.barHeight;a++)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),Oe(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 a=0;a<t.length;a++)nl(t[a]);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=Me(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 a=$s(t,p(n,e.scrollToPos.from),p(n,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,a)}var R=e.maybeHiddenMarkers,j=e.maybeUnhiddenMarkers;if(R)for(var V=0;V<R.length;++V)R[V].lines.length||Ue(R[V],"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=dt(e,t.highlightFrontier),a=[];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,V=R.text.length>e.options.maxHighlightLength?Mt(t.mode,n.state):null,J=me(e,R,n,!0);V&&(n.state=V),R.styles=J.styles;var ee=R.styleClasses,he=J.classes;he?R.styleClasses=he:ee&&(R.styleClasses=null);for(var ge=!j||j.length!=R.styles.length||ee!=he&&(!ee||!he||ee.bgClass!=he.bgClass||ee.textClass!=he.textClass),Re=0;!ge&&Re<j.length;++Re)ge=j[Re]!=R.styles[Re];ge&&a.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),a.length&&zr(e,function(){for(var R=0;R<a.length;R++)vi(e,a[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 a=n.first+n.size,R=Math.max(t.visible.from-e.options.viewportMargin,n.first),j=Math.min(a,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(a,r.viewTo)),Vn&&(R=Ti(e.doc,R),j=ei(e.doc,j));var V=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(!V&&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,V&&(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 a=la(e);aa(e),Ki(e,a),uo(e,a),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,a=e.options.lineNumbers,R=n.lineDiv,j=R.firstChild;function V(He){var et=He.nextSibling;return O&&i&&e.display.currentWheelTarget==He?He.style.display="none":He.parentNode.removeChild(He),et}for(var J=n.view,ee=n.viewFrom,he=0;he<J.length;he++){var ge=J[he];if(!ge.hidden)if(!ge.node||ge.node.parentNode!=R){var Re=Ra(e,ge,ee,r);R.insertBefore(Re,j)}else{for(;j!=ge.node;)j=V(j);var Se=a&&t!=null&&t<=ee&&ge.lineNumber;ge.changes&&(pe(ge.changes,"gutter")>-1&&(Se=!1),Fi(e,ge,ee,r)),Se&&(f(ge.lineNumber),ge.lineNumber.appendChild(document.createTextNode(ht(e.options,ee)))),j=ge.node.nextSibling}ee+=ge.size}for(;j;)j=V(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,a=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 V=r[j].alignable;if(V)for(var J=0;J<V.length;J++)V[J].style.left=R}e.options.fixedGutter&&(t.gutters.style.left=n+a+"px")}function Ko(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=ht(e.options,t.first+t.size-1),n=e.display;if(r.length!=n.lineNumChars){var a=n.measure.appendChild(o("div",[o("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),R=a.firstChild.offsetWidth,j=a.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,a=0;a<e.length;a++){var R=e[a],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 a=r[n],R=a.className,j=a.style,V=t.appendChild(o("div",null,"CodeMirror-gutter "+R));j&&(V.style.cssText=j),R=="CodeMirror-linenumbers"&&(e.lineGutter=V,V.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 a=this;this.input=r,a.scrollbarFiller=o("div",null,"CodeMirror-scrollbar-filler"),a.scrollbarFiller.setAttribute("cm-not-content","true"),a.gutterFiller=o("div",null,"CodeMirror-gutter-filler"),a.gutterFiller.setAttribute("cm-not-content","true"),a.lineDiv=b("div",null,"CodeMirror-code"),a.selectionDiv=o("div",null,null,"position: relative; z-index: 1"),a.cursorDiv=o("div",null,"CodeMirror-cursors"),a.measure=o("div",null,"CodeMirror-measure"),a.lineMeasure=o("div",null,"CodeMirror-measure"),a.lineSpace=b("div",[a.measure,a.lineMeasure,a.selectionDiv,a.cursorDiv,a.lineDiv],null,"position: relative; outline: none");var R=b("div",[a.lineSpace],"CodeMirror-lines");a.mover=o("div",[R],null,"position: relative"),a.sizer=o("div",[a.mover],"CodeMirror-sizer"),a.sizerWidth=null,a.heightForcer=o("div",null,null,"position: absolute; height: "+ye+"px; width: 1px;"),a.gutters=o("div",null,"CodeMirror-gutters"),a.lineGutter=null,a.scroller=o("div",[a.sizer,a.heightForcer,a.gutters],"CodeMirror-scroll"),a.scroller.setAttribute("tabIndex","-1"),a.wrapper=o("div",[a.scrollbarFiller,a.gutterFiller,a.scroller],"CodeMirror"),K&&I<8&&(a.gutters.style.zIndex=-1,a.scroller.style.paddingRight=0),!O&&!(D&&l)&&(a.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(a.wrapper):e(a.wrapper)),a.viewFrom=a.viewTo=t.first,a.reportedViewFrom=a.reportedViewTo=t.first,a.view=[],a.renderedView=null,a.externalMeasured=null,a.viewOffset=0,a.lastWrapHeight=a.lastWrapWidth=0,a.updateLineNumbers=null,a.nativeBarWidth=a.barHeight=a.barWidth=0,a.scrollbarsClipped=!1,a.lineNumWidth=a.lineNumInnerWidth=a.lineNumChars=null,a.alignWidgets=!1,a.cachedCharWidth=a.cachedTextHeight=a.cachedPaddingH=null,a.maxLine=null,a.maxLineLength=0,a.maxLineChanged=!1,a.wheelDX=a.wheelDY=a.wheelStartX=a.wheelStartY=null,a.shift=!1,a.selForContextMenu=null,a.activeTouch=null,a.gutterSpecs=co(n.gutters,n.lineNumbers),Go(a),r.init(a)}var Na=0,Yr=null;K?Yr=-.53:D?Yr=15:T?Yr=-.7:P&&(Yr=-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*=Yr,t.y*=Yr,t}function Vo(e,t){var r=zo(t),n=r.x,a=r.y,R=e.display,j=R.scroller,V=j.scrollWidth>j.clientWidth,J=j.scrollHeight>j.clientHeight;if(!(n&&V||a&&J))return;if(a&&i&&O){e:for(var ee=t.target,he=R.view;ee!=j;ee=ee.parentNode)for(var ge=0;ge<he.length;ge++)if(he[ge].node==ee){e.display.currentWheelTarget=ee;break e}}if(n&&!D&&!A&&Yr!=null){a&&J&&sa(e,Math.max(0,j.scrollTop+a*Yr)),ki(e,Math.max(0,j.scrollLeft+n*Yr)),(!a||a&&J)&&ne(t),R.wheelStartX=null;return}if(a&&Yr!=null){var Re=a*Yr,Se=e.doc.scrollTop,He=Se+R.wrapper.clientHeight;Re<0?Se=Math.max(0,Se+Re-50):He=Math.min(e.doc.height,He+Re+50),so(e,{top:Se,bottom:He})}Na<20&&(R.wheelStartX==null?(R.wheelStartX=j.scrollLeft,R.wheelStartY=j.scrollTop,R.wheelDX=n,R.wheelDY=a,setTimeout(function(){if(R.wheelStartX==null)return;var et=j.scrollLeft-R.wheelStartX,pt=j.scrollTop-R.wheelStartY,At=pt&&R.wheelDY&&pt/R.wheelDY||et&&R.wheelDX&&et/R.wheelDX;if(R.wheelStartX=R.wheelStartY=null,!At)return;Yr=(Yr*Na+At)/(Na+1),++Na},200)):(R.wheelDX+=n,R.wheelDY+=a))}var $r=function(e,t){this.ranges=e,this.primIndex=t};$r.prototype.primary=function(){return this.ranges[this.primIndex]},$r.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},$r.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 $r(e,this.primIndex)},$r.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},$r.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,a=t[r];t.sort(function(Re,Se){return wt(Re.from(),Se.from())}),r=pe(t,a);for(var R=1;R<t.length;R++){var j=t[R],V=t[R-1],J=wt(V.to(),j.from());if(n&&!j.empty()?J>0:J>=0){var ee=Fn(V.from(),j.from()),he=Ar(V.to(),j.to()),ge=V.empty()?j.from()==j.head:V.from()==V.head;R<=r&&--r,t.splice(--R,2,new Pn(ge?he:ee,ge?ee:he))}}return new $r(t,r)}function bi(e,t){return new $r([new Pn(e,t||e)],0)}function Ei(e){return e.text?Ke(e.from.line+e.text.length-1,xe(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),Ke(r,n)}function ho(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var a=e.sel.ranges[n];r.push(new Pn(Xo(a.anchor,t),Xo(a.head,t)))}return ai(e.cm,r,e.sel.primIndex)}function Yo(e,t,r){return e.line==t.line?Ke(r.line,e.ch-t.ch+r.ch):Ke(r.line+(e.line-t.line),e.ch)}function hl(e,t,r){for(var n=[],a=Ke(e.first,0),R=a,j=0;j<t.length;j++){var V=t[j],J=Yo(V.from,a,R),ee=Yo(Ei(V),a,R);if(a=V.to,R=ee,r=="around"){var he=e.sel.ranges[j],ge=wt(he.head,he.anchor)<0;n[j]=new Pn(ge?ee:J,ge?J:ee)}else n[j]=new Pn(J,J)}return new $r(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 $o(e,t){return t.from.ch==0&&t.to.ch==0&&xe(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function po(e,t,r,n){function a(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],a(tn),n));return Wt}var V=t.from,J=t.to,ee=t.text,he=Ve(e,V.line),ge=Ve(e,J.line),Re=xe(ee),Se=a(ee.length-1),He=J.line-V.line;if(t.full)e.insert(0,j(0,ee.length)),e.remove(ee.length,e.size-ee.length);else if($o(e,t)){var et=j(0,ee.length-1);R(ge,ge.text,Se),He&&e.remove(V.line,He),et.length&&e.insert(V.line,et)}else if(he==ge)if(ee.length==1)R(he,he.text.slice(0,V.ch)+Re+he.text.slice(J.ch),Se);else{var pt=j(1,ee.length-1);pt.push(new ui(Re+he.text.slice(J.ch),Se,n)),R(he,he.text.slice(0,V.ch)+ee[0],a(0)),e.insert(V.line+1,pt)}else if(ee.length==1)R(he,he.text.slice(0,V.ch)+ee[0]+ge.text.slice(J.ch),a(0)),e.remove(V.line+1,He);else{R(he,he.text.slice(0,V.ch)+ee[0],a(0)),R(ge,Re+ge.text.slice(J.ch),Se);var At=j(1,ee.length-1);He>1&&e.remove(V.line+1,He-1),e.insert(V.line+1,At)}cr(e,"change",e,t)}function xi(e,t,r){function n(a,R,j){if(a.linked)for(var V=0;V<a.linked.length;++V){var J=a.linked[V];if(J.doc==R)continue;var ee=j&&J.sharedHist;if(r&&!ee)continue;t(J.doc,ee),n(J.doc,a,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=xe(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Zo(e.done),xe(e.done);if(e.done.length&&!xe(e.done).ranges)return xe(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),xe(e.done)}function qo(e,t,r,n){var a=e.history;a.undone.length=0;var R=+new Date,j,V;if((a.lastOp==n||a.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&a.lastModTime>R-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(j=pl(a,a.lastOp==n)))V=xe(j.changes),wt(t.from,t.to)==0&&wt(t.from,V.to)==0?V.to=Ei(t):j.changes.push(mo(e,t));else{var J=xe(a.done);for((!J||!J.ranges)&&Ba(e.sel,a.done),j={changes:[mo(e,t)],generation:a.generation},a.done.push(j);a.done.length>a.undoDepth;)a.done.shift(),a.done[0].ranges||a.done.shift()}a.done.push(r),a.generation=++a.maxGeneration,a.lastModTime=a.lastSelTime=R,a.lastOp=a.lastSelOp=n,a.lastOrigin=a.lastSelOrigin=t.origin,V||Ue(e,"historyAdded")}function ml(e,t,r,n){var a=t.charAt(0);return a=="*"||a=="+"&&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 a=e.history,R=n&&n.origin;r==a.lastSelOp||R&&a.lastSelOrigin==R&&(a.lastModTime==a.lastSelTime&&a.lastOrigin==R||ml(e,R,xe(a.done),t))?a.done[a.done.length-1]=t:Ba(t,a.done),a.lastSelTime=+new Date,a.lastSelOrigin=R,a.lastSelOp=r,n&&n.clearRedo!==!1&&Zo(a.undone)}function Ba(e,t){var r=xe(t);r&&r.ranges&&r.equals(e)||t.push(e)}function es(e,t,r,n){var a=t["spans_"+e.id],R=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(j){j.markedSpans&&((a||(a=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=[],a=0;a<t.text.length;++a)n.push(vl(r[a]));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 a=0;a<r.length;++a){var R=r[a],j=n[a];if(R&&j){e:for(var V=0;V<j.length;++V){for(var J=j[V],ee=0;ee<R.length;++ee)if(R[ee].marker==J.marker)continue e;R.push(J)}}else j&&(r[a]=j)}return r}function Gi(e,t,r){for(var n=[],a=0;a<e.length;++a){var R=e[a];if(R.ranges){n.push(r?$r.prototype.deepCopy.call(R):R);continue}var j=R.changes,V=[];n.push({changes:V});for(var J=0;J<j.length;++J){var ee=j[J],he=void 0;if(V.push({from:ee.from,to:ee.to,text:ee.text}),t)for(var ge in ee)(he=ge.match(/^spans_(\d+)$/))&&(pe(t,Number(he[1]))>-1&&(xe(V)[ge]=ee[ge],delete ee[ge]))}}return n}function go(e,t,r,n){if(n){var a=e.anchor;if(r){var R=wt(t,a)<0;R!=wt(r,a)<0?(a=t,t=r):R!=wt(t,r)<0&&(t=r)}return new Pn(a,t)}else return new Pn(r||t,t)}function Fa(e,t,r,n,a){a==null&&(a=e.cm&&(e.cm.display.shift||e.extend)),Dr(e,new $r([go(e.sel.primary(),t,r,a)],0),n)}function ns(e,t,r){for(var n=[],a=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,a);var j=ai(e.cm,n,e.sel.primIndex);Dr(e,j,r)}function vo(e,t,r,n){var a=e.sel.ranges.slice(0);a[t]=r,Dr(e,ai(e.cm,a,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(a){this.ranges=[];for(var R=0;R<a.length;R++)this.ranges[R]=new Pn(p(e,a[R].anchor),p(e,a[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,a=xe(n);a&&a.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,Ee(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 a,R=0;R<t.ranges.length;R++){var j=t.ranges[R],V=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[R],J=Wa(e,j.anchor,V&&V.anchor,r,n),ee=Wa(e,j.head,V&&V.head,r,n);(a||J!=j.anchor||ee!=j.head)&&(a||(a=t.ranges.slice(0,R)),a[R]=new Pn(J,ee))}return a?ai(e.cm,a,t.primIndex):t}function zi(e,t,r,n,a){var R=Ve(e,t.line);if(R.markedSpans)for(var j=0;j<R.markedSpans.length;++j){var V=R.markedSpans[j],J=V.marker,ee="selectLeft"in J?!J.selectLeft:J.inclusiveLeft,he="selectRight"in J?!J.selectRight:J.inclusiveRight;if((V.from==null||(ee?V.from<=t.ch:V.from<t.ch))&&(V.to==null||(he?V.to>=t.ch:V.to>t.ch))){if(a&&(Ue(J,"beforeCursorEnter"),J.explicitlyCleared))if(R.markedSpans){--j;continue}else break;if(!J.atomic)continue;if(r){var ge=J.find(n<0?1:-1),Re=void 0;if((n<0?he:ee)&&(ge=ls(e,ge,-n,ge&&ge.line==t.line?R:null)),ge&&ge.line==t.line&&(Re=wt(ge,r))&&(n<0?Re<0:Re>0))return zi(e,ge,t,n,a)}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,a):null}}return t}function Wa(e,t,r,n,a){var R=n||1,j=zi(e,t,r,R,a)||!a&&zi(e,t,r,R,!0)||zi(e,t,r,-R,a)||!a&&zi(e,t,r,-R,!0);return j||(e.cantEdit=!0,Ke(e.first,0))}function ls(e,t,r,n){return r<0&&t.ch==0?t.line>e.first?p(e,Ke(t.line-1)):null:r>0&&t.ch==(n||Ve(e,t.line)).text.length?t.line<e.first+e.size-1?Ke(t.line+1,0):null:new Ke(t.line,t.ch+r)}function us(e){e.setSelection(Ke(e.firstLine(),0),Ke(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(a,R,j,V){a&&(n.from=p(e,a)),R&&(n.to=p(e,R)),j&&(n.text=j),V!==void 0&&(n.origin=V)}),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 a=n.length-1;a>=0;--a)cs(e,{from:n[a].from,to:n[a].to,text:a?[""]: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(a,R){!R&&pe(n,a.history)==-1&&(ms(a.history,t),n.push(a.history)),fa(a,t,null,Sn(a,t))})}function Ha(e,t,r){var n=e.cm&&e.cm.state.suppressEdits;if(n&&!r)return;for(var a=e.history,R,j=e.sel,V=t=="undo"?a.done:a.undone,J=t=="undo"?a.undone:a.done,ee=0;ee<V.length&&!(R=V[ee],r?R.ranges&&!R.equals(e.sel):!R.ranges);ee++);if(ee==V.length)return;for(a.lastOrigin=a.lastSelOrigin=null;;)if(R=V.pop(),R.ranges){if(Ba(R,J),r&&!R.equals(e.sel)){Dr(e,R,{clearRedo:!1});return}j=R}else if(n){V.push(R);return}else break;var he=[];Ba(j,J),J.push({changes:he,generation:a.generation}),a.generation=R.generation||++a.maxGeneration;for(var ge=fe(e,"beforeChange")||e.cm&&fe(e.cm,"beforeChange"),Re=function(et){var pt=R.changes[et];if(pt.origin=t,ge&&!ds(e,pt,!1))return V.length=0,{};he.push(mo(e,pt));var At=et?ho(e,pt):xe(V);fa(e,pt,At,ts(e,pt)),!et&&e.cm&&e.cm.scrollIntoView({from:pt.from,to:Ei(pt)});var Ut=[];xi(e,function(Rt,Wt){!Wt&&pe(Ut,Rt.history)==-1&&(ms(Rt.history,pt),Ut.push(Rt.history)),fa(Rt,pt,null,ts(Rt,pt))})},Se=R.changes.length-1;Se>=0;--Se){var He=Re(Se);if(He)return He.v}}function hs(e,t){if(t==0)return;if(e.first+=t,e.sel=new $r(Ie(e.sel.ranges,function(a){return new Pn(Ke(a.anchor.line+t,a.anchor.ch),Ke(a.head.line+t,a.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 a=t.text.length-1-(e.first-t.from.line);hs(e,a),t={from:Ke(e.first,0),to:Ke(t.to.line+a,t.to.ch),text:[xe(t.text)],origin:t.origin}}var R=e.lastLine();t.to.line>R&&(t={from:t.from,to:Ke(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,Ke(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,r){var n=e.doc,a=e.display,R=t.from,j=t.to,V=!1,J=R.line;e.options.lineWrapping||(J=qt(gr(Ve(n,R.line))),n.iter(J,j.line+1,function(Se){if(Se==a.maxLine)return V=!0,!0})),n.sel.contains(t.from,t.to)>-1&&Ee(e),po(n,t,r,Lo(e)),e.options.lineWrapping||(n.iter(J,R.line+t.text.length,function(Se){var He=pi(Se);He>a.maxLineLength&&(a.maxLine=Se,a.maxLineLength=He,a.maxLineChanged=!0,V=!1)}),V&&(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&&!$o(e.doc,t)?vi(e,R.line,"text"):Fr(e,R.line,j.line+1,ee);var he=fe(e,"changes"),ge=fe(e,"change");if(ge||he){var Re={from:R,to:j,text:t.text,removed:t.removed,origin:t.origin};ge&&cr(e,"change",e,Re),he&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Re)}e.display.selForContextMenu=null}function Xi(e,t,r,n,a){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:a})}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 a=0;a<e.length;++a){var R=e[a],j=!0;if(R.ranges){R.copied||(R=e[a]=R.deepCopy(),R.copied=!0);for(var V=0;V<R.ranges.length;V++)fs(R.ranges[V].anchor,t,r,n),fs(R.ranges[V].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=Ke(ee.from.line+n,ee.from.ch),ee.to=Ke(ee.to.line+n,ee.to.ch);else if(t<=ee.to.line){j=!1;break}}j||(e.splice(0,a+1),a=0)}}function ms(e,t){var r=t.from.line,n=t.to.line,a=t.text.length-(n-r)-1;ps(e.done,r,n,a),ps(e.undone,r,n,a)}function pa(e,t,r,n){var a=t,R=t;return typeof t=="number"?R=Ve(e,F(e,t)):a=qt(t),a==null?null:(n(R,a)&&e.cm&&vi(e.cm,a,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 a=this.lines[r];this.height-=a.height,Gt(a),cr(a,"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 a=e[n];t+=a.chunkSize(),r+=a.height,a.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],a=n.chunkSize();if(e<a){var R=Math.min(t,a-e),j=n.height;if(n.removeInner(e,R),this.height-=j-n.height,a==R&&(this.children.splice(r--,1),n.parent=null),(t-=R)==0)break;e=0}else e-=a}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof ma))){var V=[];this.collapse(V),this.children=[new ma(V)],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 a=this.children[n],R=a.chunkSize();if(e<=R){if(a.insertInner(e,t,r),a.lines&&a.lines.length>50){for(var j=a.lines.length%25+25,V=j;V<a.lines.length;){var J=new ma(a.lines.slice(V,V+=25));a.height-=J.height,this.children.splice(++n,0,J),J.parent=this}a.lines=a.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 a=pe(e.parent.children,e);e.parent.children.splice(a+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 a=this.children[n],R=a.chunkSize();if(e<R){var j=Math.min(t,R-e);if(a.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 a=0;a<t.length;++a)t[a]==this&&t.splice(a--,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 a=gi(this)-t;if(!a)return;On(this.doc,n)||cn(n,n.height+a),r&&zr(r,function(){r.curOp.forceUpdate=!0,gs(r,n,a),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 a=new va(e,r,n),R=e.cm;return R&&a.noHScroll&&(R.display.alignWidgets=!0),pa(e,t,"widget",function(j){var V=j.widgets||(j.widgets=[]);if(a.insertAt==null?V.push(a):V.splice(Math.min(V.length-1,Math.max(0,a.insertAt)),0,a),a.line=j,R&&!On(e,j)){var J=Xr(j)<e.scrollTop;cn(j,j.height+gi(a)),J&&ao(R,a.height),R.curOp.forceUpdate=!0}return!0}),R&&cr(R,"lineWidgetAdded",R,a,typeof t=="number"?t:qt(t)),a}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,a=null,R=0;R<this.lines.length;++R){var j=this.lines[R],V=Ht(j.markedSpans,this);e&&!this.collapsed?vi(e,qt(j),"text"):e&&(V.to!=null&&(a=qt(j)),V.from!=null&&(n=qt(j))),j.markedSpans=Ot(j.markedSpans,V),V.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,a+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,a),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,a=0;a<this.lines.length;++a){var R=this.lines[a],j=Ht(R.markedSpans,this);if(j.from!=null&&(r=Ke(t?R:qt(R),j.from),e==-1))return r;if(j.to!=null&&(n=Ke(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 a=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,a)&&r.height!=null){var V=r.height;r.height=null;var J=gi(r)-V;J&&cn(a,a.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 Yi(e,t,r,n,a){if(n&&n.shared)return _l(e,t,r,n,a);if(e.cm&&!e.cm.curOp)return Cr(e.cm,Yi)(e,t,r,n,a);var R=new _i(e,a),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 V=t.line,J=e.cm,ee;if(e.iter(V,r.line+1,function(ge){J&&R.collapsed&&!J.options.lineWrapping&&gr(ge)==J.display.maxLine&&(ee=!0),R.collapsed&&V!=t.line&&cn(ge,0),Nt(ge,new nt(R,V==t.line?t.ch:null,V==r.line?r.ch:null)),++V}),R.collapsed&&e.iter(t.line,r.line+1,function(ge){On(e,ge)&&cn(ge,0)}),R.clearOnEnter&&Oe(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,a){n=B(n),n.shared=!1;var R=[Yi(e,t,r,n,a)],j=R[0],V=n.widgetNode;return xi(e,function(J){V&&(n.widgetNode=V.cloneNode(!0)),R.push(Yi(J,p(J,t),p(J,r),n,a));for(var ee=0;ee<J.linked.length;++ee)if(J.linked[ee].isParent)return;j=xe(R)}),new ya(R,j)}function ys(e){return e.findMarks(Ke(e.first,0),e.clipPos(Ke(e.lastLine())),function(t){return t.parent})}function Cl(e,t){for(var r=0;r<t.length;r++){var n=t[r],a=n.find(),R=e.clipPos(a.from),j=e.clipPos(a.to);if(wt(R,j)){var V=Yi(e,R,j,n.primary,n.primary.type);n.markers.push(V),V.parent=n}}}function Sl(e){for(var t=function(n){var a=e[n],R=[a.primary.doc];xi(a.primary.doc,function(J){return R.push(J)});for(var j=0;j<a.markers.length;j++){var V=a.markers[j];pe(R,V.doc)==-1&&(V.parent=null,a.markers.splice(j--,1))}},r=0;r<e.length;r++)t(r)}var Tl=0,jr=function(e,t,r,n,a){if(!(this instanceof jr))return new jr(e,t,r,n,a);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=Ke(r,0);this.sel=bi(R),this.history=new Ua(null),this.id=++Tl,this.modeOption=t,this.lineSep=n,this.direction=a=="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=Yt(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Sr(function(e){var t=Ke(this.first,0),r=this.first+this.size-1;Vi(this,{from:t,to:Ke(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"?Ke(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=Ie(this.sel.ranges,e);ns(this,M(this,r),t)}),setSelections:Sr(function(e,t,r){if(!e.length)return;for(var n=[],a=0;a<e.length;a++)n[a]=new Pn(p(this,e[a].anchor),p(this,e[a].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 a=ln(this,t[n].from(),t[n].to());r=r?r.concat(a):a}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 a=ln(this,r[n].from(),r[n].to());e!==!1&&(a=a.join(e||this.lineSeparator())),t[n]=a}return t},replaceSelection:function(e,t,r){for(var n=[],a=0;a<this.sel.ranges.length;a++)n[a]=e;this.replaceSelections(n,t,r||"+input")},replaceSelections:Sr(function(e,t,r){for(var n=[],a=this.sel,R=0;R<a.ranges.length;R++){var j=a.ranges[R];n[R]={from:j.from(),to:j.to(),text:this.splitLines(e[R]),origin:r}}for(var V=t&&t!="end"&&hl(this,n,t),J=n.length-1;J>=0;J--)Vi(this,n[J]);V?is(this,V):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 a=0;a<e.undone.length;a++)e.undone[a].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 a=n.gutterMarkers||(n.gutterMarkers={});return a[t]=r,!r&&ze(a)&&(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 a=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!n[a])n[a]=r;else{if(E(r).test(n[a]))return!1;n[a]+=" "+r}return!0})}),removeLineClass:Sr(function(e,t,r){return pa(this,e,t=="gutter"?"gutter":"class",function(n){var a=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",R=n[a];if(R)if(r==null)n[a]=null;else{var j=R.match(E(r));if(!j)return!1;var V=j.index+j[0].length;n[a]=R.slice(0,j.index)+(!j.index||V==R.length?"":" ")+R.slice(V)||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 Yi(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),Yi(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 a=r[n];(a.from==null||a.from<=e.ch)&&(a.to==null||a.to>=e.ch)&&t.push(a.marker.parent||a.marker)}return t},findMarks:function(e,t,r){e=p(this,e),t=p(this,t);var n=[],a=e.line;return this.iter(e.line,t.line+1,function(R){var j=R.markedSpans;if(j)for(var V=0;V<j.length;V++){var J=j[V];!(J.to!=null&&a==e.line&&e.ch>=J.to||J.from==null&&a!=e.line||J.from!=null&&a==t.line&&J.from>=t.ch)&&(!r||r(J.marker))&&n.push(J.marker.parent||J.marker)}++a}),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(a){var R=a.text.length+n;if(R>e)return t=e,!0;e-=R,++r}),p(this,Ke(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(Yt(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(Yt(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 Yn&&(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(a){return n.push(a.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):ot(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 a=n.length,R=Array(a),j=0,V=function(){++j==a&&Cr(t,function(){r=p(t.doc,r);var Se={from:r,to:r,text:t.doc.splitLines(R.filter(function(He){return He!=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,He){if(t.options.allowDropFileTypes&&pe(t.options.allowDropFileTypes,Se.type)==-1){V();return}var et=new FileReader;et.onerror=function(){return V()},et.onload=function(){var pt=et.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(pt)){V();return}R[He]=pt,V()},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 ge;if(t.state.draggingText&&!t.state.draggingText.copy&&(ge=t.listSelections()),ja(t.doc,bi(r,r)),ge)for(var Re=0;Re<ge.length;++Re)Xi(t.doc,"",ge[Re].anchor,ge[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)){ce(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=o("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=o("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 a=t[n].CodeMirror;a&&r.push(a)}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;Oe(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,xs(Dl)},100))}),Oe(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,a,R,j=0;j<t.length-1;j++){var V=t[j];if(/^(cmd|meta|m)$/i.test(V))R=!0;else if(/^a(lt)?$/i.test(V))r=!0;else if(/^(c|ctrl|control)$/i.test(V))n=!0;else if(/^s(hift)?$/i.test(V))a=!0;else throw new Error("Unrecognized modifier name: "+V)}return r&&(e="Alt-"+e),n&&(e="Ctrl-"+e),R&&(e="Cmd-"+e),a&&(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 a=Ie(r.split(" "),Ol),R=0;R<a.length;R++){var j=void 0,V=void 0;R==a.length-1?(V=a.join(" "),j=n):(V=a.slice(0,R+1).join(" "),j="...");var J=t[V];if(!J)t[V]=j;else if(J!=j)throw new Error("Inconsistent bindings for "+V)}delete e[r]}for(var ee in t)e[ee]=t[ee];return e}function $i(e,t,r,n){t=Ga(t);var a=t.call?t.call(e,n):t[e];if(a===!1)return"nothing";if(a==="...")return"multi";if(a!=null&&r(a))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return $i(e,t.fallthrough,r,n);for(var R=0;R<t.fallthrough.length;R++){var j=$i(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=[],a=0;a<r.length;a++){for(var R=t(r[a]);n.length&&wt(R.from,xe(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 V=n.length-1;V>=0;V--)Xi(e.doc,"",n[V].from,n[V].to,"+delete");Hi(e)})}function yo(e,t,r){var n=ke(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 Ke(t.line,n,r<0?"after":"before")}function Eo(e,t,r,n,a){if(e){t.doc.direction=="rtl"&&(a=-a);var R=gt(r,t.doc.direction);if(R){var j=a<0?xe(R):R[0],V=a<0==(j.level==1),J=V?"after":"before",ee;if(j.level>0||t.doc.direction=="rtl"){var he=mt(t,r);ee=a<0?r.text.length-1:0;var ge=Ct(t,he,ee).top;ee=ct(function(Re){return Ct(t,he,Re).top==ge},a<0==(j.level==1)?j.from:j.to-1,ee),J=="before"&&(ee=yo(r,ee,1))}else ee=a<0?j.to:j.from;return new Ke(n,ee,J)}}return new Ke(n,a<0?r.text.length:0,a<0?"before":"after")}function Ml(e,t,r,n){var a=gt(t,e.doc.direction);if(!a)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=lt(a,r.ch,r.sticky),j=a[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 V=function(At,Ut){return yo(t,At instanceof Ke?At.ch:At,Ut)},J,ee=function(At){return e.options.lineWrapping?(J=J||mt(e,t),Mr(e,t,J,At)):{begin:0,end:t.text.length}},he=ee(r.sticky=="before"?V(r,-1):r.ch);if(e.doc.direction=="rtl"||j.level==1){var ge=j.level==1==n<0,Re=V(r,ge?1:-1);if(Re!=null&&(ge?Re<=j.to&&Re<=he.end:Re>=j.from&&Re>=he.begin)){var Se=ge?"before":"after";return new Ke(r.line,Re,Se)}}var He=function(At,Ut,Rt){for(var Wt=function(Wn,Tr){return Tr?new Ke(r.line,V(Wn,1),"before"):new Ke(r.line,Wn,"after")};At>=0&&At<a.length;At+=Ut){var tn=a[At],$t=Ut>0==(tn.level!=1),pn=$t?Rt.begin:V(Rt.end,-1);if(tn.from<=pn&&pn<tn.to)return Wt(pn,$t);if(pn=$t?tn.from:V(tn.to,-1),Rt.begin<=pn&&pn<Rt.end)return Wt(pn,$t)}},et=He(R+n,n,he);if(et)return et;var pt=n>0?he.end:V(he.begin,-1);return pt!=null&&!(n>0&&pt==t.text.length)&&(et=He(n>0?0:a.length-1,n,ee(pt)),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:Ke(t.head.line+1,0)}:{from:t.head,to:Ke(t.head.line,r)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Ji(e,function(t){return{from:Ke(t.from().line,0),to:p(e.doc,Ke(t.to().line+1,0))}})},delLineLeft:function(e){return Ji(e,function(t){return{from:Ke(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(Ke(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Ke(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,a=0;a<r.length;a++){var R=r[a].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 a=t[n].head,R=Ve(e.doc,a.line).text;if(R){if(a.ch==R.length&&(a=new Ke(a.line,a.ch-1)),a.ch>0)a=new Ke(a.line,a.ch+1),e.replaceRange(R.charAt(a.ch-1)+R.charAt(a.ch-2),Ke(a.line,a.ch-2),a,"+transpose");else if(a.line>e.doc.first){var j=Ve(e.doc,a.line-1).text;j&&(a=new Ke(a.line,1),e.replaceRange(R.charAt(0)+e.doc.lineSeparator()+j.charAt(j.length-1),Ke(a.line-1,j.length-1),a,"+transpose"))}}r.push(new Pn(a,a))}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),a=gt(n,e.doc.direction);if(!a||a[0].level==0){var R=Math.max(r.ch,n.text.search(/\S/)),j=t.line==r.line&&t.ch<=R&&t.ch;return Ke(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,a=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),a=t(e)!=Ce}finally{e.display.shift=n,e.state.suppressEdits=!1}return a}function Nl(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var a=$i(t,e.state.keyMaps[n],r,e);if(a)return a}return e.options.extraKeys&&$i(t,e.options.extraKeys,r,e)||$i(t,e.options.keyMap,r,e)}var Ul=new de;function _a(e,t,r,n){var a=e.state.keySeq;if(a){if(Cs(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Ul.set(50,function(){e.state.keySeq==a&&(e.state.keySeq=null,e.display.input.reset())}),Rs(e,a+" "+t,r,n))return!0}return Rs(e,t,r,n)}function Rs(e,t,r,n){var a=Nl(e,t,n);return a=="multi"&&(e.state.keySeq=t),a=="handled"&&cr(e,"keyHandled",e,t,r),(a=="handled"||a=="multi")&&(ne(r),no(e)),!!a}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&&I<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"),St(document,"keyup",r),St(document,"mouseover",r))}Oe(document,"keyup",r),Oe(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 a=String.fromCharCode(n==null?r:n);if(a=="\b")return;if(Bl(t,e,a))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),a=we(e),R=n?Wl(n,a):"single";if(window.focus(),a==1&&t.state.selectingText&&t.state.selectingText(e),n&&Hl(t,a,n,R,e))return;a==1?n?Gl(t,n,R,e):ue(e)==r.scroller&&ne(e):a==2?(n&&Fa(t.doc,n),setTimeout(function(){return r.input.focus()},20)):a==3&&(u?t.display.input.onContextMenu(e):Mo(t))}function Hl(e,t,r,n,a){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,a),a,function(j){if(typeof j=="string"&&(j=xa[j]),!j)return!1;var V=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),V=j(e,r)!=Ce}finally{e.state.suppressEdits=!1}return V})}function Kl(e,t,r){var n=e.getOption("configureMouse"),a=n?n(e,t,r):{};if(a.unit==null){var R=c?r.shiftKey&&r.metaKey:r.altKey;a.unit=R?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(a.extend==null||e.doc.extend)&&(a.extend=e.doc.extend||r.shiftKey),a.addNew==null&&(a.addNew=i?r.metaKey:r.ctrlKey),a.moveOnDrag==null&&(a.moveOnDrag=!(i?r.altKey:r.ctrlKey)),a}function Gl(e,t,r,n){K?setTimeout(G(ko,e),0):e.curOp.focus=k();var a=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,a):Vl(e,n,t,a)}function zl(e,t,r,n){var a=e.display,R=!1,j=Cr(e,function(ee){O&&(a.scroller.draggable=!1),e.state.draggingText=!1,St(a.wrapper.ownerDocument,"mouseup",j),St(a.wrapper.ownerDocument,"mousemove",V),St(a.scroller,"dragstart",J),St(a.scroller,"drop",j),R||(ne(ee),n.addNew||Fa(e.doc,r,null,null,n.extend),O&&!P||K&&I==9?setTimeout(function(){a.wrapper.ownerDocument.body.focus({preventScroll:!0}),a.input.focus()},20):a.input.focus())}),V=function(ee){R=R||Math.abs(t.clientX-ee.clientX)+Math.abs(t.clientY-ee.clientY)>=10},J=function(){return R=!0};O&&(a.scroller.draggable=!0),e.state.draggingText=j,j.copy=!n.moveOnDrag,a.scroller.dragDrop&&a.scroller.dragDrop(),Oe(a.wrapper.ownerDocument,"mouseup",j),Oe(a.wrapper.ownerDocument,"mousemove",V),Oe(a.scroller,"dragstart",J),Oe(a.scroller,"drop",j),Mo(e),setTimeout(function(){return a.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(Ke(t.line,0),p(e.doc,Ke(t.line+1,0)));var n=r(e,t);return new Pn(n.from,n.to)}function Vl(e,t,r,n){var a=e.display,R=e.doc;ne(t);var j,V,J=R.sel,ee=J.ranges;if(n.addNew&&!n.extend?(V=R.sel.contains(r),V>-1?j=ee[V]:j=new Pn(r,r)):(j=R.sel.primary(),V=R.sel.primIndex),n.unit=="rectangle")n.addNew||(j=new Pn(r,r)),r=Di(e,t,!0,!0),V=-1;else{var he=Ms(e,r,n.unit);n.extend?j=go(j,he.anchor,he.head,n.extend):j=he}n.addNew?V==-1?(V=ee.length,Dr(R,ai(e,ee.concat([j]),V),{scroll:!1,origin:"*mouse"})):ee.length>1&&ee[V].empty()&&n.unit=="char"&&!n.extend?(Dr(R,ai(e,ee.slice(0,V).concat(ee.slice(V+1)),0),{scroll:!1,origin:"*mouse"}),J=R.sel):vo(R,V,j,le):(V=0,Dr(R,new $r([j],0),le),J=R.sel);var ge=r;function Re(Rt){if(wt(ge,Rt)==0)return;if(ge=Rt,n.unit=="rectangle"){for(var Wt=[],tn=e.options.tabSize,$t=te(Ve(R,r.line).text,r.ch,tn),pn=te(Ve(R,Rt.line).text,Rt.ch,tn),Wn=Math.min($t,pn),Tr=Math.max($t,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=ve(Wr,Wn,tn);Wn==Tr?Wt.push(new Pn(Ke(Jn,ur),Ke(Jn,ur))):Wr.length>ur&&Wt.push(new Pn(Ke(Jn,ur),Ke(Jn,ve(Wr,Tr,tn))))}Wt.length||Wt.push(new Pn(r,r)),Dr(R,ai(e,J.ranges.slice(0,V).concat(Wt),V),{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[V]=Xl(e,new Pn(p(R,hr),dr)),Dr(R,ai(e,Zn,V),le)}}var Se=a.wrapper.getBoundingClientRect(),He=0;function et(Rt){var Wt=++He,tn=Di(e,Rt,!0,n.unit=="rectangle");if(!tn)return;if(wt(tn,ge)!=0){e.curOp.focus=k(),Re(tn);var $t=ka(a,R);(tn.line>=$t.to||tn.line<$t.from)&&setTimeout(Cr(e,function(){He==Wt&&et(Rt)}),150)}else{var pn=Rt.clientY<Se.top?-20:Rt.clientY>Se.bottom?20:0;pn&&setTimeout(Cr(e,function(){if(He!=Wt)return;a.scroller.scrollTop+=pn,et(Rt)}),50)}}function pt(Rt){e.state.selectingText=!1,He=Infinity,Rt&&(ne(Rt),a.input.focus()),St(a.wrapper.ownerDocument,"mousemove",At),St(a.wrapper.ownerDocument,"mouseup",Ut),R.history.lastSelOrigin=null}var At=Cr(e,function(Rt){Rt.buttons===0||!we(Rt)?pt(Rt):et(Rt)}),Ut=Cr(e,pt);e.state.selectingText=Ut,Oe(a.wrapper.ownerDocument,"mousemove",At),Oe(a.wrapper.ownerDocument,"mouseup",Ut)}function Xl(e,t){var r=t.anchor,n=t.head,a=Ve(e.doc,r.line);if(wt(r,n)==0&&r.sticky==n.sticky)return t;var R=gt(a);if(!R)return t;var j=lt(R,r.ch,r.sticky),V=R[j];if(V.from!=r.ch&&V.to!=r.ch)return t;var J=j+(V.from==r.ch==(V.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=lt(R,n.ch,n.sticky),ge=he-j||(n.ch-r.ch)*(V.level==1?-1:1);he==J-1||he==J?ee=ge<0:ee=ge>0}var Re=R[J+(ee?-1:0)],Se=ee==(Re.level==1),He=Se?Re.from:Re.to,et=Se?"after":"before";return r.ch==He&&r.sticky==et?t:new Pn(new Ke(r.line,He,et),n)}function Is(e,t,r,n){var a,R;if(t.touches)a=t.touches[0].clientX,R=t.touches[0].clientY;else try{a=t.clientX,R=t.clientY}catch(Re){return!1}if(a>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&ne(t);var j=e.display,V=j.lineDiv.getBoundingClientRect();if(R>V.bottom||!fe(e,r))return ae(t);R-=V.top-j.viewOffset;for(var J=0;J<e.display.gutterSpecs.length;++J){var ee=j.gutters.childNodes[J];if(ee&&ee.getBoundingClientRect().right>=a){var he=En(e.doc,R),ge=e.display.gutterSpecs[J];return Ue(e,r,e,he,ge.className,t),ae(t)}}}function Co(e,t){return Is(e,t,"gutterClick",!0)}function Ns(e,t){if(ri(e.display,t)||Yl(e,t))return;if(Ze(e,t,"contextmenu"))return;u||e.display.input.onContextMenu(t)}function Yl(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 $l(e){var t=e.optionHandlers;function r(n,a,R,j){e.defaults[n]=a,R&&(t[n]=j?function(V,J,ee){ee!=Qi&&R(V,J,ee)}:R)}e.defineOption=r,e.Init=Qi,r("value","",function(n,a){return n.setValue(a)},!0),r("mode",null,function(n,a){n.doc.modeOption=a,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,a){if(n.doc.lineSep=a,!a)return;var R=[],j=n.doc.first;n.doc.iter(function(J){for(var ee=0;;){var he=J.text.indexOf(a,ee);if(he==-1)break;ee=he+a.length,R.push(Ke(j,he))}j++});for(var V=R.length-1;V>=0;V--)Xi(n.doc,a,R[V],Ke(R[V].line,R[V].ch+a.length))}),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(n,a,R){n.state.specialChars=new RegExp(a.source+(a.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,a){return n.getInputField().spellcheck=a},!0),r("autocorrect",!1,function(n,a){return n.getInputField().autocorrect=a},!0),r("autocapitalize",!1,function(n,a){return n.getInputField().autocapitalize=a},!0),r("rtlMoveVisually",!C),r("wholeLineUpdateBefore",!0),r("theme","default",function(n){Us(n),ca(n)},!0),r("keyMap","default",function(n,a,R){var j=Ga(a),V=R!=Qi&&Ga(R);V&&V.detach&&V.detach(n,j),j.attach&&j.attach(n,V||null)}),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,Ql,!0),r("gutters",[],function(n,a){n.display.gutterSpecs=co(a,n.options.lineNumbers),ca(n)},!0),r("fixedGutter",!0,function(n,a){n.display.gutters.style.left=a?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,a){n.display.gutterSpecs=co(n.options.gutters,a),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,a){a=="nocursor"&&(Wi(n),n.display.input.blur()),n.display.input.readOnlyChanged(a)}),r("screenReaderLabel",null,function(n,a){a=a===""?null:a,n.display.input.screenReaderLabelChanged(a)}),r("disableInput",!1,function(n,a){a||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,a){return n.doc.history.undoDepth=a}),r("historyEventDelay",1250),r("viewportMargin",10,function(n){return n.refresh()},!0),r("maxHighlightLength",1e4,ha,!0),r("moveInputWithCursor",!0,function(n,a){a||n.display.input.resetPosition()}),r("tabindex",null,function(n,a){return n.display.input.getField().tabIndex=a||""}),r("autofocus",null),r("direction","ltr",function(n,a){return n.doc.setDirection(a)},!0),r("phrases",null)}function Jl(e,t,r){var n=r&&r!=Qi;if(!t!=!n){var a=e.display.dragFunctions,R=t?Oe:St;R(e.display.scroller,"dragstart",a.start),R(e.display.scroller,"dragenter",a.enter),R(e.display.scroller,"dragover",a.over),R(e.display.scroller,"dragleave",a.leave),R(e.display.scroller,"drop",a.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 Yn(e,t){var r=this;if(!(this instanceof Yn))return new Yn(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 a=new Yn.inputStyles[t.inputStyle](this),R=this.display=new dl(e,n,a,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 de,keySeq:null,specialChars:null},t.autofocus&&!l&&R.input.focus(),K&&I<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 V=0;V<So.length;++V)So[V](this);Ni(this),O&&t.lineWrapping&&getComputedStyle(R.lineDiv).textRendering=="optimizelegibility"&&(R.lineDiv.style.textRendering="auto")}Yn.defaults=Bs,Yn.optionHandlers=Va;function Zl(e){var t=e.display;Oe(t.scroller,"mousedown",Cr(e,ks)),K&&I<11?Oe(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)})):Oe(t.scroller,"dblclick",function(J){return Ze(e,J)||ne(J)}),Oe(t.scroller,"contextmenu",function(J){return Ns(e,J)}),Oe(t.input.getField(),"contextmenu",function(J){t.scroller.contains(J.target)||Ns(e,J)});var r,n={end:0};function a(){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,ge=ee.top-J.top;return he*he+ge*ge>20*20}Oe(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)}}),Oe(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Oe(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"),ge;!ee.prev||j(ee,ee.prev)?ge=new Pn(he,he):!ee.prev.prev||j(ee,ee.prev.prev)?ge=e.findWordAt(he):ge=new Pn(Ke(he.line,0),p(e.doc,Ke(he.line+1,0))),e.setSelection(ge.anchor,ge.head),e.focus(),ne(J)}a()}),Oe(t.scroller,"touchcancel",a),Oe(t.scroller,"scroll",function(){t.scroller.clientHeight&&(sa(e,t.scroller.scrollTop),ki(e,t.scroller.scrollLeft,!0),Ue(e,"scroll",e))}),Oe(t.scroller,"mousewheel",function(J){return Vo(e,J)}),Oe(t.scroller,"DOMMouseScroll",function(J){return Vo(e,J)}),Oe(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(J){Ze(e,J)||ce(J)},over:function(J){Ze(e,J)||(Rl(e,J),ce(J))},start:function(J){return Al(e,J)},drop:Cr(e,wl),leave:function(J){Ze(e,J)||Es(e)}};var V=t.input.getField();Oe(V,"keyup",function(J){return Ds.call(e,J)}),Oe(V,"keydown",Cr(e,Ps)),Oe(V,"keypress",Cr(e,Os)),Oe(V,"focus",function(J){return ro(e,J)}),Oe(V,"blur",function(J){return Wi(e,J)})}var So=[];Yn.defineInitHook=function(e){return So.push(e)};function Ta(e,t,r,n){var a=e.doc,R;r==null&&(r="add"),r=="smart"&&(a.mode.indent?R=dt(e,t).state:r="prev");var j=e.options.tabSize,V=Ve(a,t),J=te(V.text,null,j);V.stateAfter&&(V.stateAfter=null);var ee=V.text.match(/^\s*/)[0],he;if(!n&&!/\S/.test(V.text))he=0,r="not";else if(r=="smart"&&(he=a.mode.indent(R,V.text.slice(ee.length),V.text),he==Ce||he>150)){if(!n)return;r="prev"}r=="prev"?t>a.first?he=te(Ve(a,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 ge="",Re=0;if(e.options.indentWithTabs)for(var Se=Math.floor(he/j);Se;--Se)Re+=j,ge+=" ";if(Re<he&&(ge+=q(he-Re)),ge!=ee)return Xi(a,ge,Ke(t,0),Ke(t,ee.length),"+input"),V.stateAfter=null,!0;for(var He=0;He<a.sel.ranges.length;He++){var et=a.sel.ranges[He];if(et.head.line==t&&et.head.ch<ee.length){var pt=Ke(t,ee.length);vo(a,He,new Pn(pt,pt));break}}}var oi=null;function Xa(e){oi=e}function To(e,t,r,n,a){var R=e.doc;e.display.shift=!1,n||(n=R.sel);var j=+new Date-200,V=a=="paste"||e.state.pasteIncoming>j,J=ot(t),ee=null;if(V&&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=Ie(J,function(At){return[At]}));for(var ge=e.curOp.updateInput,Re=n.ranges.length-1;Re>=0;Re--){var Se=n.ranges[Re],He=Se.from(),et=Se.to();Se.empty()&&(r&&r>0?He=Ke(He.line,He.ch-r):e.state.overwrite&&!V?et=Ke(et.line,Math.min(Ve(R,et.line).text.length,et.ch+xe(J).length)):V&&oi&&oi.lineWise&&oi.text.join(`
`)==J.join(`
`)&&(He=et=Ke(He.line,0)));var pt={from:He,to:et,text:ee?ee[Re%ee.length]:J,origin:a||(V?"paste":e.state.cutIncoming>j?"cut":"+input")};Vi(e.doc,pt),cr(e,"inputRead",e,pt)}t&&!V&&js(e,t),Hi(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ge),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 a=r.ranges[n];if(a.head.ch>100||n&&r.ranges[n-1].head.line==a.head.line)continue;var R=e.getModeAt(a.head),j=!1;if(R.electricChars){for(var V=0;V<R.electricChars.length;V++)if(t.indexOf(R.electricChars.charAt(V))>-1){j=Ta(e,a.head.line,"smart");break}}else R.electricInput&&(R.electricInput.test(Ve(e.doc,a.head.line).text.slice(0,a.head.ch))&&(j=Ta(e,a.head.line,"smart")));j&&cr(e,"electricInput",e,a.head.line)}}function Ws(e){for(var t=[],r=[],n=0;n<e.doc.sel.ranges.length;n++){var a=e.doc.sel.ranges[n].head.line,R={anchor:Ke(a,0),head:Ke(a+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=o("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=o("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return O?e.style.width="1000px":e.setAttribute("wrap","off"),x&&(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,a){var R=this.options,j=R[n];if(R[n]==a&&n!="mode")return;R[n]=a,t.hasOwnProperty(n)&&Cr(this,t[n])(this,a,j),Ue(this,"optionChange",this,n)},getOption:function(n){return this.options[n]},getDoc:function(){return this.doc},addKeyMap:function(n,a){this.state.keyMaps[a?"push":"unshift"](Ga(n))},removeKeyMap:function(n){for(var a=this.state.keyMaps,R=0;R<a.length;++R)if(a[R]==n||a[R].name==n)return a.splice(R,1),!0},addOverlay:Nr(function(n,a){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:a&&a.opaque,priority:a&&a.priority||0},function(j){return j.priority}),this.state.modeGen++,Fr(this)}),removeOverlay:Nr(function(n){for(var a=this.state.overlays,R=0;R<a.length;++R){var j=a[R].modeSpec;if(j==n||typeof n=="string"&&j.name==n){a.splice(R,1),this.state.modeGen++,Fr(this);return}}}),indentLine:Nr(function(n,a,R){typeof a!="string"&&typeof a!="number"&&(a==null?a=this.options.smartIndent?"smart":"prev":a=a?"add":"subtract"),on(this.doc,n)&&Ta(this,n,a,R)}),indentSelection:Nr(function(n){for(var a=this.doc.sel.ranges,R=-1,j=0;j<a.length;j++){var V=a[j];if(V.empty())V.head.line>R&&(Ta(this,V.head.line,n,!0),R=V.head.line,j==this.doc.sel.primIndex&&Hi(this));else{var J=V.from(),ee=V.to(),he=Math.max(R,J.line);R=Math.min(this.lastLine(),ee.line-(ee.ch?0:1))+1;for(var ge=he;ge<R;++ge)Ta(this,ge,n);var Re=this.doc.sel.ranges;J.ch==0&&a.length==Re.length&&Re[j].from().ch>0&&vo(this.doc,j,new Pn(J,Re[j].to()),_e)}}}),getTokenAt:function(n,a){return Rn(this,n,a)},getLineTokens:function(n,a){return Rn(this,Ke(n),a,!0)},getTokenTypeAt:function(n){n=p(this.doc,n);var a=Ye(this,Ve(this.doc,n.line)),R=0,j=(a.length-1)/2,V=n.ch,J;if(V==0)J=a[2];else for(;;){var ee=R+j>>1;if((ee?a[ee*2-1]:0)>=V)j=ee;else if(a[ee*2+1]<V)R=ee+1;else{J=a[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 a=this.doc.mode;return a.innerMode?e.innerMode(a,this.getTokenAt(n).state).mode:a},getHelper:function(n,a){return this.getHelpers(n,a)[0]},getHelpers:function(n,a){var R=[];if(!r.hasOwnProperty(a))return R;var j=r[a],V=this.getModeAt(n);if(typeof V[a]=="string")j[V[a]]&&R.push(j[V[a]]);else if(V[a])for(var J=0;J<V[a].length;J++){var ee=j[V[a][J]];ee&&R.push(ee)}else V.helperType&&j[V.helperType]?R.push(j[V.helperType]):j[V.name]&&R.push(j[V.name]);for(var he=0;he<j._global.length;he++){var ge=j._global[he];ge.pred(V,this)&&pe(R,ge.val)==-1&&R.push(ge.val)}return R},getStateAfter:function(n,a){var R=this.doc;return n=F(R,n==null?R.first+R.size-1:n),dt(this,n+1,a).state},cursorCoords:function(n,a){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,a||"page")},charCoords:function(n,a){return kr(this,p(this.doc,n),a||"page")},coordsChar:function(n,a){return n=br(this,n,a||"page"),Er(this,n.left,n.top)},lineAtHeight:function(n,a){return n=br(this,{top:n,left:0},a||"page").top,En(this.doc,n+this.display.viewOffset)},heightAtLine:function(n,a,R){var j=!1,V;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),V=Ve(this.doc,n)}else V=n;return Qn(this,V,{top:0,left:0},a||"page",R||j).top+(j?this.doc.height-Xr(V):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,a,R,j,V){var J=this.display;n=rn(this,p(this.doc,n));var ee=n.bottom,he=n.left;if(a.style.position="absolute",a.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(a),J.sizer.appendChild(a),j=="over")ee=n.top;else if(j=="above"||j=="near"){var ge=Math.max(J.wrapper.clientHeight,this.doc.height),Re=Math.max(J.sizer.clientWidth,J.lineSpace.clientWidth);(j=="above"||n.bottom+a.offsetHeight>ge)&&n.top>a.offsetHeight?ee=n.top-a.offsetHeight:n.bottom+a.offsetHeight<=ge&&(ee=n.bottom),he+a.offsetWidth>Re&&(he=Re-a.offsetWidth)}a.style.top=ee+"px",a.style.left=a.style.right="",V=="right"?(he=J.sizer.clientWidth-a.offsetWidth,a.style.right="0px"):(V=="left"?he=0:V=="middle"&&(he=(J.sizer.clientWidth-a.offsetWidth)/2),a.style.left=he+"px"),R&&Js(this,{left:he,top:ee,right:he+a.offsetWidth,bottom:ee+a.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,a,R,j){var V=1;a<0&&(V=-1,a=-a);for(var J=p(this.doc,n),ee=0;ee<a&&!(J=wo(this.doc,J,V,R,j),J.hitSide);++ee);return J},moveH:Nr(function(n,a){var R=this;this.extendSelectionsBy(function(j){return R.display.shift||R.doc.extend||j.empty()?wo(R.doc,j.head,n,a,R.options.rtlMoveVisually):n<0?j.from():j.to()},se)}),deleteH:Nr(function(n,a){var R=this.doc.sel,j=this.doc;R.somethingSelected()?j.replaceSelection("",null,"+delete"):Ji(this,function(V){var J=wo(j,V.head,n,a,!1);return n<0?{from:J,to:V.head}:{from:V.head,to:J}})}),findPosV:function(n,a,R,j){var V=1,J=j;a<0&&(V=-1,a=-a);for(var ee=p(this.doc,n),he=0;he<a;++he){var ge=rn(this,ee,"div");if(J==null?J=ge.left:ge.left=J,ee=Gs(this,ge,V,R),ee.hitSide)break}return ee},moveV:Nr(function(n,a){var R=this,j=this.doc,V=[],J=!this.display.shift&&!j.extend&&j.sel.somethingSelected();if(j.extendSelectionsBy(function(he){if(J)return n<0?he.from():he.to();var ge=rn(R,he.head,"div");he.goalColumn!=null&&(ge.left=he.goalColumn),V.push(ge.left);var Re=Gs(R,ge,n,a);return a=="page"&&he==j.sel.primary()&&ao(R,kr(R,Re,"div").top-ge.top),Re},se),V.length)for(var ee=0;ee<j.sel.ranges.length;ee++)j.sel.ranges[ee].goalColumn=V[ee]}),findWordAt:function(n){var a=this.doc,R=Ve(a,n.line).text,j=n.ch,V=n.ch;if(R){var J=this.getHelper(n,"wordChars");(n.sticky=="before"||V==R.length)&&j?--j:++V;for(var ee=R.charAt(j),he=We(ee,J)?function(ge){return We(ge,J)}:/\s/.test(ee)?function(ge){return/\s/.test(ge)}:function(ge){return!/\s/.test(ge)&&!We(ge)};j>0&&he(R.charAt(j-1));)--j;for(;V<R.length&&he(R.charAt(V));)++V}return new Pn(Ke(n.line,j),Ke(n.line,V))},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,a){oa(this,n,a)}),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,a){n==null?(n={from:this.doc.sel.primary().head,to:null},a==null&&(a=this.options.cursorScrollMargin)):typeof n=="number"?n={from:Ke(n,0),to:null}:n.from==null&&(n={from:n,to:null}),n.to||(n.to=n.from),n.margin=a||0,n.from.line!=null?Qs(this,n):No(this,n.from,n.to,n.margin)}),setSize:Nr(function(n,a){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)),a!=null&&(this.display.wrapper.style.height=j(a)),this.options.lineWrapping&&nr(this);var V=this.display.viewFrom;this.doc.iter(V,this.display.viewTo,function(J){if(J.widgets){for(var ee=0;ee<J.widgets.length;ee++)if(J.widgets[ee].noHScroll){vi(R,V,"widget");break}}++V}),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 a=this.doc;return a.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,a),a}),phrase:function(n){var a=this.options.phrases;return a&&Object.prototype.hasOwnProperty.call(a,n)?a[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,a,R){r.hasOwnProperty(n)||(r[n]=e[n]={_global:[]}),r[n][a]=R},e.registerGlobalHelper=function(n,a,R,j){e.registerHelper(n,a,j),r[n]._global.push({pred:R,val:j})}}function wo(e,t,r,n,a){var R=t,j=r,V=Ve(e,t.line),J=a&&e.direction=="rtl"?-r:r;function ee(){var Ut=t.line+J;return Ut<e.first||Ut>=e.first+e.size?!1:(t=new Ke(Ut,t.ch,t.sticky),V=Ve(e,Ut))}function he(Ut){var Rt;if(n=="codepoint"){var Wt=V.text.charCodeAt(t.ch+(n>0?0:-1));isNaN(Wt)?Rt=null:Rt=new Ke(t.line,Math.max(0,Math.min(V.text.length,t.ch+r*(Wt>=55296&&Wt<56320?2:1))),-r)}else a?Rt=Ml(e.cm,V,t,r):Rt=bo(V,t,r);if(Rt==null)if(!Ut&&ee())t=Eo(a,e.cm,V,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 ge=null,Re=n=="group",Se=e.cm&&e.cm.getHelper(t,"wordChars"),He=!0;!(r<0&&!he(!He));He=!1){var et=V.text.charAt(t.ch)||`
`,pt=We(et,Se)?"w":Re&&et==`
`?"n":!Re||/\s/.test(et)?null:"p";if(Re&&!He&&!pt&&(pt="s"),ge&&ge!=pt){r<0&&(r=1,he(),t.sticky="after");break}if(pt&&(ge=pt),r>0&&!he(!He))break}var At=Wa(e,t,R,j,!0);return Hn(R,At)&&(At.hitSide=!0),At}function Gs(e,t,r,n){var a=e.doc,R=t.left,j;if(n=="page"){var V=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),J=Math.max(V-.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>=a.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 de,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Nn.prototype.init=function(e){var t=this,r=this,n=r.cm,a=r.div=e.lineDiv;Hs(a,n.options.spellcheck,n.options.autocorrect,n.options.autocapitalize);function R(V){for(var J=V.target;J;J=J.parentNode){if(J==a)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(J.className))break}return!1}Oe(a,"paste",function(V){if(!R(V)||Ze(n,V)||Fs(V,n))return;I<=11&&setTimeout(Cr(n,function(){return t.updateFromDOM()}),20)}),Oe(a,"compositionstart",function(V){t.composing={data:V.data,done:!1}}),Oe(a,"compositionupdate",function(V){t.composing||(t.composing={data:V.data,done:!1})}),Oe(a,"compositionend",function(V){t.composing&&(V.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Oe(a,"touchstart",function(){return r.forceCompositionEnd()}),Oe(a,"input",function(){t.composing||t.readFromDOMSoon()});function j(V){if(!R(V)||Ze(n,V))return;if(n.somethingSelected())Xa({lineWise:!1,text:n.getSelections()}),V.type=="cut"&&n.replaceSelection("",null,"cut");else if(n.options.lineWiseCopyCut){var J=Ws(n);Xa({lineWise:!0,text:J.text}),V.type=="cut"&&n.operation(function(){n.setSelections(J.ranges,0,_e),n.replaceSelection("",null,"cut")})}else return;if(V.clipboardData){V.clipboardData.clearData();var ee=oi.text.join(`
`);if(V.clipboardData.setData("Text",ee),V.clipboardData.getData("Text")==ee){V.preventDefault();return}}var he=Ks(),ge=he.firstChild;n.display.lineSpace.insertBefore(he,n.display.lineSpace.firstChild),ge.value=oi.text.join(`
`);var Re=document.activeElement;Z(ge),setTimeout(function(){n.display.lineSpace.removeChild(he),Re.focus(),Re==a&&r.showPrimarySelection()},50)}Oe(a,"copy",j),Oe(a,"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(),a=r.to();if(t.display.viewTo==t.display.viewFrom||n.line>=t.display.viewTo||a.line<t.display.viewFrom){e.removeAllRanges();return}var R=Ya(t,e.anchorNode,e.anchorOffset),j=Ya(t,e.focusNode,e.focusOffset);if(R&&!R.bad&&j&&!j.bad&&wt(Fn(R,j),n)==0&&wt(Ar(R,j),a)==0)return;var V=t.display.view,J=n.line>=t.display.viewFrom&&zs(t,n)||{node:V[0].measure.map[2],offset:0},ee=a.line<t.display.viewTo&&zs(t,a);if(!ee){var he=V[V.length-1].measure,ge=he.maps?he.maps[he.maps.length-1]:he.map;ee={node:ge[ge.length-1],offset:ge[ge.length-2]-ge[ge.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(He){}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&&T&&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=Ya(t,e.anchorNode,e.anchorOffset),n=Ya(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(),a=r.to();if(n.ch==0&&n.line>e.firstLine()&&(n=Ke(n.line-1,Ve(e.doc,n.line-1).length)),a.ch==Ve(e.doc,a.line).text.length&&a.line<e.lastLine()&&(a=Ke(a.line+1,0)),n.line<t.viewFrom||a.line>t.viewTo-1)return!1;var R,j,V;n.line==t.viewFrom||(R=Oi(e,n.line))==0?(j=qt(t.view[0].line),V=t.view[0].node):(j=qt(t.view[R].line),V=t.view[R-1].node.nextSibling);var J=Oi(e,a.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),!V)return!1;for(var ge=e.doc.splitLines(tu(e,V,he,j,ee)),Re=ln(e.doc,Ke(j,0),Ke(ee,Ve(e.doc,ee).text.length));ge.length>1&&Re.length>1;)if(xe(ge)==xe(Re))ge.pop(),Re.pop(),ee--;else if(ge[0]==Re[0])ge.shift(),Re.shift(),j++;else break;for(var Se=0,He=0,et=ge[0],pt=Re[0],At=Math.min(et.length,pt.length);Se<At&&et.charCodeAt(Se)==pt.charCodeAt(Se);)++Se;for(var Ut=xe(ge),Rt=xe(Re),Wt=Math.min(Ut.length-(ge.length==1?Se:0),Rt.length-(Re.length==1?Se:0));He<Wt&&Ut.charCodeAt(Ut.length-He-1)==Rt.charCodeAt(Rt.length-He-1);)++He;if(ge.length==1&&Re.length==1&&j==n.line)for(;Se&&Se>n.ch&&Ut.charCodeAt(Ut.length-He-1)==Rt.charCodeAt(Rt.length-He-1);)Se--,He++;ge[ge.length-1]=Ut.slice(0,Ut.length-He).replace(/^\u200b+/,""),ge[0]=ge[0].slice(Se).replace(/\u200b+$/,"");var tn=Ke(j,Se),$t=Ke(ee,Re.length?xe(Re).length-He:0);if(ge.length>1||ge[0]||wt(tn,$t))return Xi(e.doc,ge,tn,$t,"+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),a=st(r,n,t.line),R=gt(n,e.doc.direction),j="left";if(R){var V=lt(R,t.ch);j=V%2?"right":"left"}var J=dn(a.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,a){var R="",j=!1,V=e.doc.lineSeparator(),J=!1;function ee(Se){return function(He){return He.id==Se}}function he(){j&&(R+=V,J&&(R+=V),j=J=!1)}function ge(Se){Se&&(he(),R+=Se)}function Re(Se){if(Se.nodeType==1){var He=Se.getAttribute("cm-text");if(He){ge(He);return}var et=Se.getAttribute("cm-marker"),pt;if(et){var At=e.findMarks(Ke(n,0),Ke(a+1,0),ee(+et));At.length&&(pt=At[0].find(0))&&ge(ln(e.doc,pt.from,pt.to).join(V));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&&ge(Se.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Re(t),t==r);)t=t.nextSibling,J=!1;return R}function Ya(e,t,r){var n;if(t==e.display.lineDiv){if(n=e.display.lineDiv.childNodes[r],!n)return Zi(e.clipPos(Ke(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 a=0;a<e.display.view.length;a++){var R=e.display.view[a];if(R.node==n)return nu(R,t,r)}}function nu(e,t,r){var n=e.text.firstChild,a=!1;if(!t||!_(n,t))return Zi(Ke(qt(e.line),0),!0);if(t==n&&(a=!0,t=n.childNodes[r],r=0,!t)){var R=e.rest?xe(e.rest):e.line;return Zi(Ke(qt(R),R.text.length),a)}var j=t.nodeType==3?t:null,V=t;for(!j&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(j=t.firstChild,r&&(r=j.nodeValue.length));V.parentNode!=n;)V=V.parentNode;var J=e.measure,ee=J.maps;function he(pt,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 $t=Wt[tn+2];if($t==pt||$t==At){var pn=qt(Rt<0?e.line:e.rest[Rt]),Wn=Wt[tn]+Ut;return(Ut<0||$t!=pt)&&(Wn=Wt[tn+(Ut?1:0)]),Ke(pn,Wn)}}}var ge=he(j,V,r);if(ge)return Zi(ge,a);for(var Re=V.nextSibling,Se=j?j.nodeValue.length-r:0;Re;Re=Re.nextSibling){if(ge=he(Re,Re.firstChild,0),ge)return Zi(Ke(ge.line,ge.ch-Se),a);Se+=Re.textContent.length}for(var He=V.previousSibling,et=r;He;He=He.previousSibling){if(ge=he(He,He.firstChild,-1),ge)return Zi(Ke(ge.line,ge.ch+et),a);et+=He.textContent.length}}var rr=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new de,this.hasSelection=!1,this.composing=null};rr.prototype.init=function(e){var t=this,r=this,n=this.cm;this.createField(e);var a=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),x&&(a.style.width="0px"),Oe(a,"input",function(){K&&I>=9&&t.hasSelection&&(t.hasSelection=null),r.poll()}),Oe(a,"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 V=Ws(n);Xa({lineWise:!0,text:V.text}),j.type=="cut"?n.setSelections(V.ranges,null,_e):(r.prevInput="",a.value=V.text.join(`
`),Z(a))}else return;j.type=="cut"&&(n.state.cutIncoming=+new Date)}Oe(a,"cut",R),Oe(a,"copy",R),Oe(e.scroller,"paste",function(j){if(ri(e,j)||Ze(n,j))return;if(!a.dispatchEvent){n.state.pasteIncoming=+new Date,r.focus();return}var V=new Event("paste");V.clipboardData=j.clipboardData,a.dispatchEvent(V)}),Oe(e.lineSpace,"selectstart",function(j){ri(e,j)||ne(j)}),Oe(a,"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"})}}),Oe(a,"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 a=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,a.top+j.top-R.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,a.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&&I>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",K&&I>=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||ft(r)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var a=r.value;if(a==n&&!t.somethingSelected())return!1;if(K&&I>=9&&this.hasSelection===a||i&&/[\uf700-\uf7ff]/.test(a))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var R=a.charCodeAt(0);if(R==8203&&!n&&(n="\u200B"),R==8666)return this.reset(),this.cm.execCommand("undo")}for(var j=0,V=Math.min(n.length,a.length);j<V&&n.charCodeAt(j)==a.charCodeAt(j);)++j;return zr(t,function(){To(t,a.slice(j),n.length-j,null,e.composing?"*compose":null),a.length>1e3||a.indexOf(`
`)>-1?r.value=e.prevInput="":e.prevInput=a,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&&I>=9&&(this.hasSelection=null),this.fastPoll()},rr.prototype.onContextMenu=function(e){var t=this,r=t.cm,n=r.display,a=t.textarea;t.contextMenuPending&&t.contextMenuPending();var R=Di(r,e),j=n.scroller.scrollTop;if(!R||A)return;var V=r.options.resetSelectionOnContextMenu;V&&r.doc.sel.contains(R)==-1&&Cr(r,Dr)(r.doc,bi(R),_e);var J=a.style.cssText,ee=t.wrapper.style.cssText,he=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",a.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 ge;O&&(ge=window.scrollY),n.input.focus(),O&&window.scrollTo(null,ge),n.input.reset(),r.somethingSelected()||(a.value=t.prevInput=" "),t.contextMenuPending=Se,n.selForContextMenu=r.doc.sel,clearTimeout(n.detectingSelectAll);function Re(){if(a.selectionStart!=null){var et=r.somethingSelected(),pt="\u200B"+(et?a.value:"");a.value="\u21DA",a.value=pt,t.prevInput=et?"":"\u200B",a.selectionStart=1,a.selectionEnd=pt.length,n.selForContextMenu=r.doc.sel}}function Se(){if(t.contextMenuPending!=Se)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=ee,a.style.cssText=J,K&&I<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=j),a.selectionStart!=null){(!K||K&&I<9)&&Re();var et=0,pt=function(){n.selForContextMenu==r.doc.sel&&a.selectionStart==0&&a.selectionEnd>0&&t.prevInput=="\u200B"?Cr(r,us)(r):et++<10?n.detectingSelectAll=setTimeout(pt,500):(n.selForContextMenu=null,n.input.reset())};n.detectingSelectAll=setTimeout(pt,200)}}if(K&&I>=9&&Re(),u){ce(e);var He=function(){St(window,"mouseup",He),setTimeout(Se,20)};Oe(window,"mouseup",He)}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=V.getValue()}var a;if(e.form&&(Oe(e.form,"submit",n),!t.leaveSubmitMethodAlone)){var R=e.form;a=R.submit;try{var j=R.submit=function(){n(),R.submit=a,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&&(St(e.form,"submit",n),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=a))}},e.style.display="none";var V=Yn(function(J){return e.parentNode.insertBefore(J,e.nextSibling)},t);return V}function iu(e){e.off=St,e.on=Oe,e.wheelEventPixels=cl,e.Doc=jr,e.splitLines=ot,e.countColumn=te,e.findColumn=ve,e.isWordChar=Pe,e.Pass=Ce,e.signal=Ue,e.Line=ui,e.changeEnd=Ei,e.scrollbarModel=Fo,e.Pos=Ke,e.cmpPos=wt,e.modes=sn,e.mimeModes=Bt,e.resolveMode=it,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=$i,e.normalizeKeyMap=kl,e.StringStream=at,e.SharedTextMarker=ya,e.TextMarker=_i,e.LineWidget=va,e.e_preventDefault=ne,e.e_stopPropagation=re,e.e_stop=ce,e.addClass=H,e.contains=_,e.rmClass=d,e.keyNames=Ci}$l(Yn),ql(Yn);var au="iter insert remove copy getEditor constructor".split(" ");for(var $a in jr.prototype)jr.prototype.hasOwnProperty($a)&&pe(au,$a)<0&&(Yn.prototype[$a]=function(e){return function(){return e.apply(this.doc,arguments)}}(jr.prototype[$a]));return be(jr),Yn.inputStyles={textarea:rr,contenteditable:Nn},Yn.defineMode=function(e){!Yn.defaults.mode&&e!="null"&&(Yn.defaults.mode=e),an.apply(this,arguments)},Yn.defineMIME=Qt,Yn.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Yn.defineMIME("text/plain","null"),Yn.defineExtension=function(e,t){Yn.prototype[e]=t},Yn.defineDocExtension=function(e,t){jr.prototype[e]=t},Yn.fromTextArea=ru,iu(Yn),Yn.version="5.58.2",Yn})},WaYH:function(rt,Xe,X){"use strict";var oe=X("rePB"),$=X("Ff2n"),D=X("VTBJ"),Y=X("1OyB"),U=X("vuIU"),N=X("JX7q"),K=X("Ji7U"),I=X("LK+K"),O=X("q1tI"),L=X("TSYQ"),T=X.n(L),A=X("sboe"),P=X("OZM5"),w=function(u){var E=u.prefixCls,d=u.level,f=u.isStart,s=u.isEnd;if(!d)return null;for(var o="".concat(E,"-indent-unit"),b=[],g=0;g<d;g+=1){var _;b.push(O.createElement("span",{key:g,className:T()(o,(_={},Object(oe.a)(_,"".concat(o,"-start"),f[g+1]),Object(oe.a)(_,"".concat(o,"-end"),s[g+1]),Object(oe.a)(_,"".concat(o,"-end-first-level"),!g&&s[0]),_))}))}return O.createElement("span",{"aria-hidden":"true",className:"".concat(E,"-indent")},b)},S=w,x=X("815F"),h="open",l="close",i="---",c=function(m){Object(K.a)(E,m);var u=Object(I.a)(E);function E(){var d;return Object(Y.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(x.b)(d.props)),d.isSelectable()?d.onSelect(f):d.onCheck(f)},d.onSelectorDoubleClick=function(f){var s=d.props.context.onNodeDoubleClick;s(f,Object(x.b)(d.props))},d.onSelect=function(f){if(d.isDisabled())return;var s=d.props.context.onNodeSelect;f.preventDefault(),s(f,Object(x.b)(d.props))},d.onCheck=function(f){if(d.isDisabled())return;var s=d.props,o=s.disableCheckbox,b=s.checked,g=d.props.context.onNodeCheck;if(!d.isCheckable()||o)return;f.preventDefault();var _=!b;g(f,Object(x.b)(d.props),_)},d.onMouseEnter=function(f){var s=d.props.context.onNodeMouseEnter;s(f,Object(x.b)(d.props))},d.onMouseLeave=function(f){var s=d.props.context.onNodeMouseLeave;s(f,Object(x.b)(d.props))},d.onContextMenu=function(f){var s=d.props.context.onNodeContextMenu;s(f,Object(x.b)(d.props))},d.onDragStart=function(f){var s=d.props.context.onNodeDragStart;f.stopPropagation(),d.setState({dragNodeHighlight:!0}),s(f,Object(N.a)(d));try{f.dataTransfer.setData("text/plain","")}catch(o){}},d.onDragEnter=function(f){var s=d.props.context.onNodeDragEnter;f.preventDefault(),f.stopPropagation(),s(f,Object(N.a)(d))},d.onDragOver=function(f){var s=d.props.context.onNodeDragOver;f.preventDefault(),f.stopPropagation(),s(f,Object(N.a)(d))},d.onDragLeave=function(f){var s=d.props.context.onNodeDragLeave;f.stopPropagation(),s(f,Object(N.a)(d))},d.onDragEnd=function(f){var s=d.props.context.onNodeDragEnd;f.stopPropagation(),d.setState({dragNodeHighlight:!1}),s(f,Object(N.a)(d))},d.onDrop=function(f){var s=d.props.context.onNodeDrop;f.preventDefault(),f.stopPropagation(),d.setState({dragNodeHighlight:!1}),s(f,Object(N.a)(d))},d.onExpand=function(f){var s=d.props.context.onNodeExpand;s(f,Object(x.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,o=s[f]||{},b=o.children;return!!(b||[]).length},d.isLeaf=function(){var f=d.props,s=f.isLeaf,o=f.loaded,b=d.props.context.loadData,g=d.hasChildren();return s===!1?!1:s||!b&&!g||b&&o&&!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,o=f.loading,b=f.loaded,g=d.props.context,_=g.loadData,k=g.onNodeLoad;if(o)return;_&&s&&!d.isLeaf()&&(!d.hasChildren()&&!b&&k(Object(x.b)(d.props)))},d.renderSwitcher=function(){var f=d.props,s=f.expanded,o=f.switcherIcon,b=d.props.context,g=b.prefixCls,_=b.switcherIcon,k=o||_;if(d.isLeaf())return O.createElement("span",{className:T()("".concat(g,"-switcher"),"".concat(g,"-switcher-noop"))},typeof k=="function"?k(Object(D.a)(Object(D.a)({},d.props),{},{isLeaf:!0})):k);var H=T()("".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,o=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:T()("".concat(g,"-checkbox"),s&&"".concat(g,"-checkbox-checked"),!s&&o&&"".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:T()("".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,o=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,de=H.titleRender,pe=d.isDisabled(),ye="".concat(z,"-node-content-wrapper"),Ce;if(Z){var _e=g||G;Ce=_e?O.createElement("span",{className:T()("".concat(z,"-iconEle"),"".concat(z,"-icon__customize"))},typeof _e=="function"?_e(d.props):_e):d.renderIcon()}else te&&_&&(Ce=d.renderIcon());var le;typeof o=="function"?le=o(k):de?le=de(k):le=o;var se=O.createElement("span",{className:"".concat(z,"-title")},le);return O.createElement("span",{ref:d.setSelectHandle,title:typeof o=="string"?o:"",className:T()("".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,o=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,de=s.checked,pe=s.halfChecked,ye=s.loading,Ce=s.domRef,_e=s.active,le=s.onMouseMove,se=Object($.a)(s,["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","onMouseMove"]),ve=this.props.context,ie=ve.prefixCls,q=ve.filterTreeNode,xe=ve.draggable,Ie=ve.keyEntities,Ne=this.isDisabled(),De=Object(P.f)(se),Be=Ie[o]||{},Ae=Be.level,Pe=G[G.length-1];return O.createElement("div",Object.assign({ref:Ce,className:T()(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"),de),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(x.b)(this.props))),f)),style:g,onDragEnter:xe?this.onDragEnter:void 0,onDragOver:xe?this.onDragOver:void 0,onDragLeave:xe?this.onDragLeave:void 0,onDrop:xe?this.onDrop:void 0,onDragEnd:xe?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(rt,Xe,X){"use strict";X.r(Xe),X.d(Xe,"ResizableTextArea",function(){return pe});var oe=X("wx14"),$=X("1OyB"),D=X("vuIU"),Y=X("Ji7U"),U=X("LK+K"),N=X("q1tI"),K=X("VTBJ"),I=X("rePB"),O=X("Zm9Q"),L=X("Kwbf"),T=X("c+Xe"),A=X("m+aA"),P=X("bdgK"),w=new Map;function S(_e){_e.forEach(function(le){var se,ve=le.target;(se=w.get(ve))===null||se===void 0||se.forEach(function(ie){return ie(ve)})})}var x=new P.default(S),h=null,l=null;function i(_e,le){w.has(_e)||(w.set(_e,new Set),x.observe(_e)),w.get(_e).add(le)}function c(_e,le){w.has(_e)&&(w.get(_e).delete(le),w.get(_e).size||(x.unobserve(_e),w.delete(_e)))}var C=function(_e){Object(Y.a)(se,_e);var le=Object(U.a)(se);function se(){return Object($.a)(this,se),le.apply(this,arguments)}return Object(D.a)(se,[{key:"render",value:function(){return this.props.children}}]),se}(N.Component),v=N.createContext(null);function m(_e){var le=_e.children,se=_e.onBatchResize,ve=N.useRef(0),ie=N.useRef([]),q=N.useContext(v),xe=N.useCallback(function(Ie,Ne,De){ve.current+=1;var Be=ve.current;ie.current.push({size:Ie,element:Ne,data:De}),Promise.resolve().then(function(){Be===ve.current&&(se==null||se(ie.current),ie.current=[])}),q==null||q(Ie,Ne,De)},[se,q]);return N.createElement(v.Provider,{value:xe},le)}function u(_e){var le=_e.children,se=_e.disabled,ve=N.useRef(null),ie=N.useRef(null),q=N.useContext(v),xe=N.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Ie=N.isValidElement(le)&&Object(T.c)(le),Ne=Ie?le.ref:null,De=N.useMemo(function(){return Object(T.a)(Ne,ve)},[Ne,ve]),Be=N.useRef(_e);Be.current=_e;var Ae=N.useCallback(function(Pe){var We=Be.current,ze=We.onResize,qe=We.data,Ge=Pe.getBoundingClientRect(),ke=Ge.width,ct=Ge.height,ut=Pe.offsetWidth,vt=Pe.offsetHeight,lt=Math.floor(ke),Tt=Math.floor(ct);if(xe.current.width!==lt||xe.current.height!==Tt||xe.current.offsetWidth!==ut||xe.current.offsetHeight!==vt){var gt={width:lt,height:Tt,offsetWidth:ut,offsetHeight:vt};xe.current=gt;var yt=ut===Math.round(ke)?ke:ut,Oe=vt===Math.round(ct)?ct:vt,Pt=Object(K.a)(Object(K.a)({},gt),{},{offsetWidth:yt,offsetHeight:Oe});q==null||q(Pt,Pe,qe),ze&&Promise.resolve().then(function(){ze(Pt,Pe)})}},[]);return N.useEffect(function(){var Pe=Object(A.a)(ve.current)||Object(A.a)(ie.current);return Pe&&!se&&i(Pe,Ae),function(){return c(Pe,Ae)}},[ve.current,se]),N.createElement(C,{ref:ie},Ie?N.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(ve,ie){var q=(ve==null?void 0:ve.key)||"".concat(E,"-").concat(ie);return N.createElement(u,Object(oe.a)({},_e,{key:q}),ve)})}d.Collection=m;var f=d,s=X("bT9E"),o=X("TSYQ"),b=X.n(o),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 ve=window.getComputedStyle(_e),ie=ve.getPropertyValue("box-sizing")||ve.getPropertyValue("-moz-box-sizing")||ve.getPropertyValue("-webkit-box-sizing"),q=parseFloat(ve.getPropertyValue("padding-bottom"))+parseFloat(ve.getPropertyValue("padding-top")),xe=parseFloat(ve.getPropertyValue("border-bottom-width"))+parseFloat(ve.getPropertyValue("border-top-width")),Ie=_.map(function(De){return"".concat(De,":").concat(ve.getPropertyValue(De))}).join(";"),Ne={sizingStyle:Ie,paddingSize:q,borderSize:xe,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,ve=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,xe=ie.borderSize,Ie=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(Ie==="border-box"?Ae+=xe:Ie==="content-box"&&(Ae-=q),se!==null||ve!==null){H.value=" ";var We=H.scrollHeight-q;se!==null&&(De=We*se,Ie==="border-box"&&(De=De+q+xe),Ae=Math.max(De,Ae)),ve!==null&&(Be=We*ve,Ie==="border-box"&&(Be=Be+q+xe),Pe=Ae>Be?"":"hidden",Ae=Math.min(Be,Ae))}return{height:Ae,minHeight:De,maxHeight:Be,overflowY:Pe,resize:"none"}}var G=X("Gytx"),B=X.n(G),te;(function(_e){_e[_e.NONE=0]="NONE",_e[_e.RESIZING=1]="RESIZING",_e[_e.RESIZED=2]="RESIZED"})(te||(te={}));var de=function(_e){Object(Y.a)(se,_e);var le=Object(U.a)(se);function se(ve){var ie;return Object($.a)(this,se),ie=le.call(this,ve),ie.nextFrameActionId=void 0,ie.resizeFrameId=void 0,ie.textArea=void 0,ie.saveTextArea=function(q){ie.textArea=q},ie.handleResize=function(q){var xe=ie.state.resizeStatus,Ie=ie.props,Ne=Ie.autoSize,De=Ie.onResize;if(xe!==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 xe=q.minRows,Ie=q.maxRows,Ne=Z(ie.textArea,!1,xe,Ie);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,xe=q.prefixCls,Ie=xe===void 0?"rc-textarea":xe,Ne=q.autoSize,De=q.onResize,Be=q.className,Ae=q.disabled,Pe=ie.state,We=Pe.textareaStyles,ze=Pe.resizeStatus,qe=Object(s.a)(ie.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ge=b()(Ie,Be,Object(I.a)({},"".concat(Ie,"-disabled"),Ae));"value"in qe&&(qe.value=qe.value||"");var ke=Object(K.a)(Object(K.a)(Object(K.a)({},ie.props.style),We),ze===te.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return N.createElement(f,{onResize:ie.handleResize,disabled:!(Ne||De)},N.createElement("textarea",Object(oe.a)({},qe,{className:Ge,style:ke,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(xe){}}},{key:"render",value:function(){return this.renderTextArea()}}]),se}(N.Component),pe=de,ye=function(_e){Object(Y.a)(se,_e);var le=Object(U.a)(se);function se(ve){var ie;Object($.a)(this,se),ie=le.call(this,ve),ie.resizableTextArea=void 0,ie.focus=function(){ie.resizableTextArea.textArea.focus()},ie.saveTextArea=function(xe){ie.resizableTextArea=xe},ie.handleChange=function(xe){var Ie=ie.props.onChange;ie.setValue(xe.target.value,function(){ie.resizableTextArea.resizeTextarea()}),Ie&&Ie(xe)},ie.handleKeyDown=function(xe){var Ie=ie.props,Ne=Ie.onPressEnter,De=Ie.onKeyDown;xe.keyCode===13&&Ne&&Ne(xe),De&&De(xe)};var q=typeof ve.value=="undefined"||ve.value===null?ve.defaultValue:ve.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 N.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}(N.Component),Ce=Xe.default=ye},YBdh:function(rt,Xe,X){rt.exports=X.p+"static/xiren.a6554bc1.svg"},ZWs3:function(rt,Xe,X){"use strict";X.d(Xe,"a",function(){return T});var oe=X("+L6B"),$=X("2/Rp"),D=X("0Owb"),Y=X("9og8"),U=X("tJVT"),N=X("PpiC"),K=X("WmNS"),I=X.n(K),O=X("q1tI"),L=X.n(O),T=function(P){var w=P.children,S=Object(N.a)(P,["children"]),x=Object(O.useState)(!1),h=Object(U.a)(x,2),l=h[0],i=h[1];return L.a.createElement($.a,Object(D.a)({},S,{loading:l,onClick:function(){var c=Object(Y.a)(I.a.mark(function C(v){return I.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(rt,Xe,X){"use strict";function oe(T){return typeof T=="object"&&T!=null&&T.nodeType===1}function $(T,A){return(!A||T!=="hidden")&&T!=="visible"&&T!=="clip"}function D(T,A){if(T.clientHeight<T.scrollHeight||T.clientWidth<T.scrollWidth){var P=getComputedStyle(T,null);return $(P.overflowY,A)||$(P.overflowX,A)||function(w){var S=function(x){if(!x.ownerDocument||!x.ownerDocument.defaultView)return null;try{return x.ownerDocument.defaultView.frameElement}catch(h){return null}}(w);return!!S&&(S.clientHeight<w.scrollHeight||S.clientWidth<w.scrollWidth)}(T)}return!1}function Y(T,A,P,w,S,x,h,l){return x<T&&h>A||x>T&&h<A?0:x<=T&&l<=P||h>=A&&l>=P?x-T-w:h>A&&l<P||x<T&&l>P?h-A+S:0}var U=function(T,A){var P=window,w=A.scrollMode,S=A.block,x=A.inline,h=A.boundary,l=A.skipOverflowHiddenElements,i=typeof h=="function"?h:function(We){return We!==h};if(!oe(T))throw new TypeError("Invalid target");for(var c=document.scrollingElement||document.documentElement,C=[],v=T;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=T.getBoundingClientRect(),s=f.height,o=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=x==="center"?k+o/2:x==="end"?g:k,Z=[],G=0;G<C.length;G++){var B=C[G],te=B.getBoundingClientRect(),de=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),ve=parseInt(se.borderLeftWidth,10),ie=parseInt(se.borderTopWidth,10),q=parseInt(se.borderRightWidth,10),xe=parseInt(se.borderBottomWidth,10),Ie=0,Ne=0,De="offsetWidth"in B?B.offsetWidth-B.clientWidth-ve-q:0,Be="offsetHeight"in B?B.offsetHeight-B.clientHeight-ie-xe:0;if(c===B)Ie=S==="start"?H:S==="end"?H-u:S==="nearest"?Y(d,d+u,u,ie,xe,d+H,d+H+s,s):H-u/2,Ne=x==="start"?z:x==="center"?z-m/2:x==="end"?z-m:Y(E,E+m,m,ve,q,E+z,E+z+o,o),Ie=Math.max(0,Ie+d),Ne=Math.max(0,Ne+E);else{Ie=S==="start"?H-ye-ie:S==="end"?H-_e+xe+Be:S==="nearest"?Y(ye,_e,de,ie,xe+Be,H,H+s,s):H-(ye+de/2)+Be/2,Ne=x==="start"?z-le-ve:x==="center"?z-(le+pe/2)+De/2:x==="end"?z-Ce+q+De:Y(le,Ce,pe,ve,q+De,z,z+o,o);var Ae=B.scrollLeft,Pe=B.scrollTop;H+=Pe-(Ie=Math.max(0,Math.min(Pe+Ie,B.scrollHeight-de+Be))),z+=Ae-(Ne=Math.max(0,Math.min(Ae+Ne,B.scrollWidth-pe+De)))}Z.push({el:B,top:Ie,left:Ne})}return Z};function N(T){return T===Object(T)&&Object.keys(T).length!==0}function K(T,A){A===void 0&&(A="auto");var P="scrollBehavior"in document.body.style;T.forEach(function(w){var S=w.el,x=w.top,h=w.left;S.scroll&&P?S.scroll({top:x,left:h,behavior:A}):(S.scrollTop=x,S.scrollLeft=h)})}function I(T){return T===!1?{block:"end",inline:"nearest"}:N(T)?T:{block:"start",inline:"nearest"}}function O(T,A){var P=!T.ownerDocument.documentElement.contains(T);if(N(A)&&typeof A.behavior=="function")return A.behavior(P?[]:U(T,A));if(P)return;var w=I(A);return K(U(T,w),w.behavior)}var L=Xe.a=O},bT9E:function(rt,Xe,X){"use strict";X.d(Xe,"a",function(){return $});var oe=X("VTBJ");function $(D,Y){var U=Object(oe.a)({},D);return Array.isArray(Y)&&Y.forEach(function(N){delete U[N]}),U}},c5Ni:function(rt,Xe,X){},dejd:function(rt,Xe,X){},dmUQ:function(rt,Xe,X){"use strict";var oe=X("Ff2n"),$=X("rePB"),D=X("1OyB"),Y=X("vuIU"),U=X("Ji7U"),N=X("md7G"),K=X("foSv"),I=X("q1tI"),O=X.n(I),L=X("TSYQ"),T=X.n(L),A=X("4IlW");function P(s,o){var b=Object.keys(s);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(s);o&&(g=g.filter(function(_){return Object.getOwnPropertyDescriptor(s,_).enumerable})),b.push.apply(b,g)}return b}function w(s){for(var o=1;o<arguments.length;o++){var b=arguments[o]!=null?arguments[o]:{};o%2?P(Object(b),!0).forEach(function(g){Object($.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 o=x();return function(){var g=Object(K.a)(s),_;if(o){var k=Object(K.a)(this).constructor;_=Reflect.construct(g,arguments,k)}else _=g.apply(this,arguments);return Object(N.a)(this,_)}}function x(){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(o){return o.replace(/[^\w.-]+/g,"")},c=200,C=600,v=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,m=function(o){return o!=null},u=function(o,b){return b===o||typeof b=="number"&&typeof o=="number"&&isNaN(b)&&isNaN(o)},E=function(s){Object(U.a)(b,s);var o=S(b);function b(g){var _;Object(D.a)(this,b),_=o.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 de=_.getRatio(z);_.down(z,de,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,de;G?de=B:de=_.toPrecisionAsStep(te),de==null&&(de="");var pe=_.formatWrapper(de);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(Y.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),de;this.pressingUpOrDown?de=te:this.inputting?de=this.rawInput:de=this.toPrecisionAsStep(te),this.setState({value:te,inputValue:de})}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,de=typeof z=="number"?z.toFixed(H):"".concat(z),pe=z!==G||de!=="".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),de=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}),de)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,de=k.downHandler,pe=k.className,ye=k.max,Ce=k.min,_e=k.style,le=k.title,se=k.onMouseEnter,ve=k.onMouseLeave,ie=k.onMouseOver,q=k.onMouseOut,xe=k.required,Ie=k.onClick,Ne=k.tabIndex,De=k.type,Be=k.placeholder,Ae=k.id,Pe=k.inputMode,We=k.pattern,ze=k.step,qe=k.maxLength,Ge=k.autoFocus,ke=k.name,ct=k.onPaste,ut=k.onInput,vt=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"]),lt=this.state,Tt=lt.value,gt=lt.focused,yt=T()(H,(_={},Object($.a)(_,pe,!!pe),Object($.a)(_,"".concat(H,"-disabled"),z),Object($.a)(_,"".concat(H,"-focused"),gt),_)),Oe={};Object.keys(vt).forEach(function(ce){(ce.substr(0,5)==="data-"||ce.substr(0,5)==="aria-"||ce==="role")&&(Oe[ce]=vt[ce])});var Pt=!Z&&!z,St=this.getInputDisplayValue(null),Ue=(Tt||Tt===0)&&(isNaN(Tt)||Number(Tt)>=ye),Ze=(Tt||Tt===0)&&(isNaN(Tt)||Number(Tt)<=Ce),Ee=Ue||z||Z,fe=Ze||z||Z,be=T()("".concat(H,"-handler"),"".concat(H,"-handler-up"),Object($.a)({},"".concat(H,"-handler-up-disabled"),Ee)),ne=T()("".concat(H,"-handler"),"".concat(H,"-handler-down"),Object($.a)({},"".concat(H,"-handler-down-disabled"),fe)),re=G?{onTouchStart:Ee?h:this.up,onTouchEnd:this.stop}:{onMouseDown:Ee?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:ve,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":Ee,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}),de||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":Tt,required:xe,type:De,placeholder:Be,onPaste:ct,onClick:Ie,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:Ge,maxLength:qe,readOnly:Z,disabled:z,max:ye,min:Ce,step:ze,name:ke,title:le,id:Ae,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(St),pattern:We,inputMode:Pe,onInput:ut},Oe))))}}]),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(rt,Xe,X){rt.exports={btn:"btn___35XHi",s1:"s1___yzdGB",s2:"s2___3kxXm",btnDisabled:"btnDisabled___lI9pA",btn2:"btn2___2KLJQ"}},"eS0+":function(rt,Xe,X){"use strict";var oe=X("giR+"),$=X("fyUT"),D=X("tJVT"),Y=X("PpiC"),U=X("OaEy"),N=X("2fM7"),K=X("q1tI"),I=X.n(K),O=X("2sxD"),L=X.n(O),T=X("51dB"),A=X.n(T),P=X("5MlY"),w=X.n(P),S=X("lnNo"),x=X.n(S),h=X("YBdh"),l=X.n(h),i=X("LvDl"),c=X.n(i),C=X("TSYQ"),v=X.n(C),m=N.a.Option,u=function(s){var o=parseInt(s);return Object(i.isNaN)(o)?0:o},E=function(s){var o,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,de=Object(Y.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(ve,ie){var q=Object(i.cloneDeep)(k);q.difficulties[ie].num=ve,console.log(q,444),H(q)};return I.a.createElement("div",{className:L.a.ListGroup,style:{borderWidth:g?1:0}},I.a.createElement("div",{className:L.a.a},g+1),I.a.createElement("div",{"data-type":"width",className:L.a.b},k==null?void 0:k.name),I.a.createElement("div",{className:L.a.c},k==null||((o=k.difficulties)===null||o===void 0)?void 0:o.map(function(se,ve){return I.a.createElement("div",{key:ve,style:{display:Ce?"flex":ve?"none":"flex"},className:L.a.c1},I.a.createElement("span",{style:{color:"#777777",marginRight:5}},"\u96BE\u5EA6"),se.difficulty===1&&I.a.createElement("span",{className:L.a.radio},"\u7B80\u5355"),se.difficulty===2&&I.a.createElement("span",{className:L.a.radio},"\u9002\u4E2D"),se.difficulty===3&&I.a.createElement("span",{className:L.a.radio},"\u56F0\u96BE"),I.a.createElement("span",{style:{color:"#777777",marginRight:5,marginLeft:50}},"\u62BD\u9898\u6570\u91CF"),g===0&&ve===0?I.a.createElement("div",{id:"".concat(z,"_sum")},I.a.createElement($.a,{disabled:G,parser:u,onChange:function(q){return le(q,ve)},min:0,max:se==null?void 0:se.count,value:(se==null?void 0:se.num)||0,style:{width:66}}),I.a.createElement("span",{style:{display:"none"}},"\u8BF7\u8F93\u5165\u6570\u91CF")):I.a.createElement($.a,{disabled:G,parser:u,onChange:function(q){return le(q,ve)},min:0,max:se==null?void 0:se.count,value:(se==null?void 0:se.num)||0,style:{width:66}}),I.a.createElement("span",{style:{marginLeft:5}},"/",se==null?void 0:se.count))})),I.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",I.a.createElement("img",{style:{marginTop:-2,transform:Ce?"rotate(0deg)":"rotate(180deg)"},src:x.a,className:"ml5"})))},d=function(s){var o,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(Y.a)(s,["value","onChange","listClassName","disabled","expansion"]),de=Object(K.useState)(!0),pe=Object(D.a)(de,2),ye=pe[0],Ce=pe[1],_e=function(q){var xe,Ie=q.score||0,Ne=[];q==null||((xe=q.item_banks)===null||xe===void 0)||xe.forEach(function(Be){var Ae;Be==null||((Ae=Be.tag_disciplines)===null||Ae===void 0)||Ae.forEach(function(Pe){var We;Pe==null||((We=Pe.difficulties)===null||We===void 0)||We.forEach(function(ze){ze.num&&Ne.push(ze.num)})})});var De=Ne.reduce(function(Be,Ae){return Be+Ae},0);return De*Ie},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,xe,Ie){var Ne=Object(i.cloneDeep)(_);Ne.item_banks[xe].tag_disciplines[Ie]=q;var De=_e(Ne);Ne.scoreTotal=De,console.log(Ne,"newValue"),k(Ne)},ve=function(q){var xe=Object(i.cloneDeep)(_);xe.score=q;var Ie=_e(xe);xe.scoreTotal=Ie,k(xe)};return I.a.createElement("div",{className:v()(L.a.list,H)},I.a.createElement("div",{className:L.a.head},I.a.createElement("div",{className:L.a.name},I.a.createElement("b",null),I.a.createElement("span",null,(o=le.find(function(ie){return ie.type===(_==null?void 0:_.item_type)}))===null||o===void 0?void 0:o.name)),I.a.createElement("div",{className:L.a.right},B&&I.a.createElement("div",{onClick:function(){return Ce(!ye)},className:"current c-light-primary mb10"},ye?"\u6536\u8D77":"\u5C55\u5F00",I.a.createElement("img",{style:{marginTop:-2,transform:ye?"rotate(0deg)":"rotate(180deg)"},src:x.a,className:"ml5"})),I.a.createElement("div",null,I.a.createElement("img",{src:A.a}),I.a.createElement("span",{className:"ml10 mr20"},"\u603B\u5206",_.scoreTotal,"\u5206"),I.a.createElement("img",{className:"mr10",src:w.a}),I.a.createElement("span",null,(_==null?void 0:_.item_type)==="COMBINATION"?"\u6BCF\u5C0F\u9898":"\u6BCF\u9898"),I.a.createElement("div",{id:"".concat(_==null?void 0:_.item_type,"_score")},I.a.createElement($.a,{disabled:Z,parser:u,min:0,onChange:ve,value:_.score,style:{margin:"0 5px"}}),I.a.createElement("span",{style:{display:"none"}},"\u8BF7\u8F93\u5165\u6BCF\u9898\u5206\u6570")),I.a.createElement("span",null,"\u5206")))),I.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 xe;return I.a.createElement(I.a.Fragment,{key:q},I.a.createElement("div",{className:L.a.top},I.a.createElement("img",{src:l.a}),I.a.createElement("span",null,"\u65B9\u5411/\u8BFE\u7A0B"),I.a.createElement("b",null),I.a.createElement("aside",null,ie==null?void 0:ie.disciplines,"/",ie==null?void 0:ie.sub_discipline)),I.a.createElement("div",{className:L.a.bottom},I.a.createElement("div",{className:L.a.l},"\u77E5\u8BC6\u70B9"),I.a.createElement("div",{className:L.a.r},ie==null||((xe=ie.tag_disciplines)===null||xe===void 0)?void 0:xe.map(function(Ie,Ne){return I.a.createElement(E,{expansion:B,disabled:Z,type:_==null?void 0:_.item_type,key:"".concat(q,"-").concat(Ne),value:Ie,index:Ne,onChange:function(Be){return se(Be,q,Ne)}})}))))})))};Xe.a=d},exQ7:function(rt,Xe,X){rt.exports=X.p+"static/te.6f9c0684.svg"},fAei:function(rt,Xe,X){"use strict";X.d(Xe,"a",function(){return c.a});var oe=X("rePB"),$=X("VTBJ"),D=X("KQm4"),Y=X("1OyB"),U=X("vuIU"),N=X("Ji7U"),K=X("LK+K"),I=X("q1tI"),O=X("4IlW"),L=X("Kwbf"),T=X("TSYQ"),A=X.n(T),P=X("sboe"),w=X("OZM5"),S=X("815F"),x=X("ODXe"),h=X("Ff2n"),l=X("+nKL"),i=X("8XRh"),c=X("WaYH"),C=function(Ce,_e){var le=Ce.className,se=Ce.style,ve=Ce.motion,ie=Ce.motionNodes,q=Ce.motionType,xe=Ce.onMotionStart,Ie=Ce.onMotionEnd,Ne=Ce.active,De=Ce.treeNodeRequiredProps,Be=Object(h.a)(Ce,["className","style","motion","motionNodes","motionType","onMotionStart","onMotionEnd","active","treeNodeRequiredProps"]),Ae=I.useState(!0),Pe=Object(x.a)(Ae,2),We=Pe[0],ze=Pe[1],qe=I.useContext(P.a),Ge=qe.prefixCls,ke=I.useRef(!1),ct=function(){ke.current||Ie(),ke.current=!0};return Object(I.useEffect)(function(){ie&&q==="hide"&&We&&ze(!1)},[ie]),Object(I.useEffect)(function(){return ie&&xe(),function(){ie&&ct()}},[]),ie?I.createElement(i.default,Object.assign({ref:_e,visible:We},ve,{motionAppear:q==="show",onAppearEnd:ct,onLeaveEnd:ct}),function(ut,vt){var lt=ut.className,Tt=ut.style;return I.createElement("div",{ref:vt,className:A()("".concat(Ge,"-treenode-motion"),lt),style:Tt},ie.map(function(gt){var yt=gt.data,Oe=yt.key,Pt=Object(h.a)(yt,["key"]),St=gt.isStart,Ue=gt.isEnd;delete Pt.children;var Ze=Object(S.f)(Oe,De);return I.createElement(c.a,Object.assign({},Pt,Ze,{active:Ne,data:gt.data,key:Oe,isStart:St,isEnd:Ue}))}))}):I.createElement(c.a,Object.assign({domRef:_e,className:le,style:se},Be,{active:Ne}))};C.displayName="MotionTreeNode";var v=I.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(ve,ie){var q=new Map;ve.forEach(function(Ie){q.set(Ie,!0)});var xe=ie.filter(function(Ie){return!q.has(Ie)});return xe.length===1?xe[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 xe=q.data;return xe.key===_e}),se=ye[le+1],ve=Ce.findIndex(function(q){var xe=q.data;return xe.key===_e});if(se){var ie=Ce.findIndex(function(q){var xe=q.data;return xe.key===se.data.key});return Ce.slice(ve+1,ie)}return Ce.slice(ve+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()),o={key:s},b={key:s,level:0,index:0,pos:"0",node:o},g={parent:null,children:[],pos:b.pos,data:o,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,ve=Ce.selectable,ie=Ce.checkable,q=Ce.expandedKeys,xe=Ce.selectedKeys,Ie=Ce.checkedKeys,Ne=Ce.loadedKeys,De=Ce.loadingKeys,Be=Ce.halfCheckedKeys,Ae=Ce.keyEntities,Pe=Ce.disabled,We=Ce.dragging,ze=Ce.dragOverNodeKey,qe=Ce.dropPosition,Ge=Ce.motion,ke=Ce.height,ct=Ce.itemHeight,ut=Ce.virtual,vt=Ce.focusable,lt=Ce.activeItem,Tt=Ce.focused,gt=Ce.tabIndex,yt=Ce.onKeyDown,Oe=Ce.onFocus,Pt=Ce.onBlur,St=Ce.onActiveChange,Ue=Ce.onListChangeStart,Ze=Ce.onListChangeEnd,Ee=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=I.useRef(null);I.useImperativeHandle(_e,function(){return{scrollTo:function(kt){fe.current.scrollTo(kt)}}});var be=I.useState(q),ne=Object(x.a)(be,2),re=ne[0],ae=ne[1],ce=I.useState(se),ue=Object(x.a)(ce,2),we=ue[0],Le=ue[1],tt=I.useState(se),Fe=Object(x.a)(tt,2),$e=Fe[0],Dt=Fe[1],ot=I.useState([]),ft=Object(x.a)(ot,2),zt=ft[0],Je=ft[1],Kt=I.useState(null),sn=Object(x.a)(Kt,2),Bt=sn[0],an=sn[1];function Qt(){Le(se),Dt(se),Je([]),an(null),Ze()}I.useEffect(function(){ae(q);var xt=u(re,q);if(xt.key!==null)if(xt.add){var kt=we.findIndex(function(ln){var Yt=ln.data.key;return Yt===xt.key}),Mt=_(E(we,se,xt.key),ut,ke,ct),It=we.slice();It.splice(kt+1,0,g),Dt(It),Je(Mt),an("show")}else{var Lt=se.findIndex(function(ln){var Yt=ln.data.key;return Yt===xt.key}),at=_(E(se,we,xt.key),ut,ke,ct),Ve=se.slice();Ve.splice(Lt+1,0,g),Dt(Ve),Je(at),an("hide")}else we!==se&&(Le(se),Dt(se))},[q,se]),I.useEffect(function(){We||Qt()},[We]);var it=Ge?$e:se,Ft={expandedKeys:q,selectedKeys:xe,loadedKeys:Ne,loadingKeys:De,checkedKeys:Ie,halfCheckedKeys:Be,dragOverNodeKey:ze,dropPosition:qe,keyEntities:Ae};return I.createElement(I.Fragment,null,Tt&&lt&&I.createElement("span",{style:d,"aria-live":"assertive"},H(lt)),I.createElement("div",{role:"tree"},I.createElement("input",{style:d,disabled:vt===!1||Pe,tabIndex:vt!==!1?gt:null,onKeyDown:yt,onFocus:Oe,onBlur:Pt,value:"",onChange:f})),I.createElement(l.a,Object.assign({},Ee,{data:it,itemKey:k,height:ke,fullHeight:!1,virtual:ut,itemHeight:ct,prefixCls:"".concat(le,"-list"),ref:fe}),function(xt){var kt=xt.pos,Mt=xt.data,It=Mt.key,Lt=Object(h.a)(Mt,["key"]),at=xt.isStart,Ve=xt.isEnd,ln=Object(S.e)(It,kt);delete Lt.children;var Yt=Object(S.f)(ln,Ft);return I.createElement(m,Object.assign({},Lt,Yt,{active:lt&&It===lt.data.key,pos:kt,data:xt.data,isStart:at,isEnd:Ve,motion:Ge,motionNodes:It===s?zt:null,motionType:Bt,onMotionStart:Ue,onMotionEnd:Qt,treeNodeRequiredProps:Ft,onMouseMove:function(){St(null)}}))}))},Z=I.forwardRef(z);Z.displayName="NodeList";var G=Z,B=X("NvD2"),te=function(ye){Object(N.a)(_e,ye);var Ce=Object(K.a)(_e);function _e(){var le;return Object(Y.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=I.createRef(),le.onNodeDragStart=function(se,ve){var ie=le.state,q=ie.expandedKeys,xe=ie.keyEntities,Ie=le.props.onDragStart,Ne=ve.props.eventKey;le.dragNode=ve;var De=Object(w.b)(q,Ne);le.setState({dragging:!0,dragNodesKeys:Object(w.g)(Ne,xe)}),le.setExpandedKeys(De),Ie&&Ie({event:se,node:Object(S.b)(ve.props)})},le.onNodeDragEnter=function(se,ve){var ie=le.state,q=ie.expandedKeys,xe=ie.keyEntities,Ie=ie.dragNodesKeys,Ne=le.props.onDragEnter,De=ve.props,Be=De.pos,Ae=De.eventKey;if(!le.dragNode||Ie.indexOf(Ae)!==-1)return;var Pe=Object(w.c)(se,ve);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(We){clearTimeout(le.delayedDragEnterLogic[We])}),le.delayedDragEnterLogic[Be]=window.setTimeout(function(){if(!le.state.dragging)return;var We=Object(D.a)(q),ze=xe[Ae];ze&&(ze.children||[]).length&&(We=Object(w.a)(q,Ae)),"expandedKeys"in le.props||le.setExpandedKeys(We),Ne&&Ne({event:se,node:Object(S.b)(ve.props),expandedKeys:We})},400)},0)},le.onNodeDragOver=function(se,ve){var ie=le.state.dragNodesKeys,q=le.props.onDragOver,xe=ve.props.eventKey;if(ie.indexOf(xe)!==-1)return;if(le.dragNode&&xe===le.state.dragOverNodeKey){var Ie=Object(w.c)(se,ve);if(Ie===le.state.dropPosition)return;le.setState({dropPosition:Ie})}q&&q({event:se,node:Object(S.b)(ve.props)})},le.onNodeDragLeave=function(se,ve){var ie=le.props.onDragLeave;le.setState({dragOverNodeKey:""}),ie&&ie({event:se,node:Object(S.b)(ve.props)})},le.onNodeDragEnd=function(se,ve){var ie=le.props.onDragEnd;le.setState({dragOverNodeKey:""}),le.cleanDragState(),ie&&ie({event:se,node:Object(S.b)(ve.props)}),le.dragNode=null},le.onNodeDrop=function(se,ve){var ie=le.state,q=ie.dragNodesKeys,xe=q===void 0?[]:q,Ie=ie.dropPosition,Ne=le.props.onDrop,De=ve.props,Be=De.eventKey,Ae=De.pos;if(le.setState({dragOverNodeKey:""}),le.cleanDragState(),xe.indexOf(Be)!==-1){Object(L.a)(!1,"Can not drop to dragNode(include it's children node)");return}var Pe=Object(w.k)(Ae),We={event:se,node:Object(S.b)(ve.props),dragNode:le.dragNode?Object(S.b)(le.dragNode.props):null,dragNodesKeys:xe.slice(),dropPosition:Ie+Number(Pe[Pe.length-1]),dropToGap:!1};Ie!==0&&(We.dropToGap=!0),Ne&&Ne(We),le.dragNode=null},le.cleanDragState=function(){var se=le.state.dragging;se&&le.setState({dragging:!1})},le.onNodeClick=function(se,ve){var ie=le.props.onClick;ie&&ie(se,ve)},le.onNodeDoubleClick=function(se,ve){var ie=le.props.onDoubleClick;ie&&ie(se,ve)},le.onNodeSelect=function(se,ve){var ie=le.state.selectedKeys,q=le.state.keyEntities,xe=le.props,Ie=xe.onSelect,Ne=xe.multiple,De=ve.selected,Be=ve.key,Ae=!De;Ae?Ne?ie=Object(w.a)(ie,Be):ie=[Be]:ie=Object(w.b)(ie,Be);var Pe=ie.map(function(We){var ze=q[We];return ze?ze.node:null}).filter(function(We){return We});le.setUncontrolledState({selectedKeys:ie}),Ie&&Ie(ie,{event:"select",selected:Ae,node:ve,selectedNodes:Pe,nativeEvent:se.nativeEvent})},le.onNodeCheck=function(se,ve,ie){var q=le.state,xe=q.keyEntities,Ie=q.checkedKeys,Ne=q.halfCheckedKeys,De=le.props,Be=De.checkStrictly,Ae=De.onCheck,Pe=ve.key,We,ze={event:"check",node:ve,checked:ie,nativeEvent:se.nativeEvent};if(Be){var qe=ie?Object(w.a)(Ie,Pe):Object(w.b)(Ie,Pe),Ge=Object(w.b)(Ne,Pe);We={checked:qe,halfChecked:Ge},ze.checkedNodes=qe.map(function(Tt){return xe[Tt]}).filter(function(Tt){return Tt}).map(function(Tt){return Tt.node}),le.setUncontrolledState({checkedKeys:qe})}else{var ke=Object(B.a)([].concat(Object(D.a)(Ie),[Pe]),!0,xe),ct=ke.checkedKeys,ut=ke.halfCheckedKeys;if(!ie){var vt=new Set(ct);vt.delete(Pe);var lt=Object(B.a)(Array.from(vt),{checked:!1,halfCheckedKeys:ut},xe);ct=lt.checkedKeys,ut=lt.halfCheckedKeys}We=ct,ze.checkedNodes=[],ze.checkedNodesPositions=[],ze.halfCheckedKeys=ut,ct.forEach(function(Tt){var gt=xe[Tt];if(!gt)return;var yt=gt.node,Oe=gt.pos;ze.checkedNodes.push(yt),ze.checkedNodesPositions.push({node:yt,pos:Oe})}),le.setUncontrolledState({checkedKeys:ct},!1,{halfCheckedKeys:ut})}Ae&&Ae(We,ze)},le.onNodeLoad=function(se){return new Promise(function(ve){le.setState(function(ie){var q=ie.loadedKeys,xe=q===void 0?[]:q,Ie=ie.loadingKeys,Ne=Ie===void 0?[]:Ie,De=le.props,Be=De.loadData,Ae=De.onLoad,Pe=se.key;if(!Be||xe.indexOf(Pe)!==-1||Ne.indexOf(Pe)!==-1)return{};var We=Be(se);return We.then(function(){var ze=le.state,qe=ze.loadedKeys,Ge=ze.loadingKeys,ke=Object(w.a)(qe,Pe),ct=Object(w.b)(Ge,Pe);Ae&&Ae(ke,{event:"load",node:se}),le.setUncontrolledState({loadedKeys:ke}),le.setState({loadingKeys:ct}),ve()}),{loadingKeys:Object(w.a)(Ne,Pe)}})})},le.onNodeMouseEnter=function(se,ve){var ie=le.props.onMouseEnter;ie&&ie({event:se,node:ve})},le.onNodeMouseLeave=function(se,ve){var ie=le.props.onMouseLeave;ie&&ie({event:se,node:ve})},le.onNodeContextMenu=function(se,ve){var ie=le.props.onRightClick;ie&&(se.preventDefault(),ie({event:se,node:ve}))},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,ve=se.expandedKeys,ie=se.selectedKeys,q=se.loadedKeys,xe=se.loadingKeys,Ie=se.checkedKeys,Ne=se.halfCheckedKeys,De=se.dragOverNodeKey,Be=se.dropPosition,Ae=se.keyEntities;return{expandedKeys:ve||[],selectedKeys:ie||[],loadedKeys:q||[],loadingKeys:xe||[],checkedKeys:Ie||[],halfCheckedKeys:Ne||[],dragOverNodeKey:De,dropPosition:Be,keyEntities:Ae}},le.setExpandedKeys=function(se){var ve=le.state.treeData,ie=Object(S.d)(ve,se);le.setUncontrolledState({expandedKeys:se,flattenNodes:ie},!0)},le.onNodeExpand=function(se,ve){var ie=le.state.expandedKeys,q=le.state.listChanging,xe=le.props,Ie=xe.onExpand,Ne=xe.loadData,De=ve.key,Be=ve.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),Ie&&Ie(ie,{node:ve,expanded:Pe,nativeEvent:se.nativeEvent}),Pe&&Ne){var We=le.onNodeLoad(ve);We&&We.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 ve=le.state.activeKey,ie=le.props.onActiveChange;if(ve===se)return;le.setState({activeKey:se}),se!==null&&le.scrollTo({key:se}),ie&&ie(se)},le.getActiveItem=function(){var se=le.state,ve=se.activeKey,ie=se.flattenNodes;return ve===null?null:ie.find(function(q){var xe=q.data.key;return xe===ve})||null},le.offsetActiveKey=function(se){var ve=le.state,ie=ve.flattenNodes,q=ve.activeKey,xe=ie.findIndex(function(De){var Be=De.data.key;return Be===q});xe===-1&&se<0&&(xe=ie.length),xe=(xe+se+ie.length)%ie.length;var Ie=ie[xe];if(Ie){var Ne=Ie.data.key;le.onActiveChange(Ne)}else le.onActiveChange(null)},le.onKeyDown=function(se){var ve=le.state,ie=ve.activeKey,q=ve.expandedKeys,xe=ve.checkedKeys,Ie=le.props,Ne=Ie.onKeyDown,De=Ie.checkable,Be=Ie.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(),We=Ae.data.isLeaf===!1||!!(Ae.data.children||[]).length,ze=Object(S.b)(Object($.a)(Object($.a)({},Object(S.f)(ie,Pe)),{},{data:Ae.data,active:!0}));switch(se.which){case O.a.LEFT:{We&&q.includes(ie)?le.onNodeExpand({},ze):Ae.parent&&le.onActiveChange(Ae.parent.data.key),se.preventDefault();break}case O.a.RIGHT:{We&&!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,!xe.includes(ie)):!De&&Be&&!ze.disabled&&ze.selectable!==!1&&le.onNodeSelect({},ze);break}}}Ne&&Ne(se)},le.setUncontrolledState=function(se){var ve=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,xe=!0,Ie={};Object.keys(se).forEach(function(Ne){if(Ne in le.props){xe=!1;return}q=!0,Ie[Ne]=se[Ne]}),q&&(!ve||xe)&&le.setState(Object($.a)(Object($.a)({},Ie),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,ve=this.state,ie=ve.focused,q=ve.flattenNodes,xe=ve.keyEntities,Ie=ve.dragging,Ne=ve.activeKey,De=this.props,Be=De.prefixCls,Ae=De.className,Pe=De.style,We=De.showLine,ze=De.focusable,qe=De.tabIndex,Ge=qe===void 0?0:qe,ke=De.selectable,ct=De.showIcon,ut=De.icon,vt=De.switcherIcon,lt=De.draggable,Tt=De.checkable,gt=De.checkStrictly,yt=De.disabled,Oe=De.motion,Pt=De.loadData,St=De.filterTreeNode,Ue=De.height,Ze=De.itemHeight,Ee=De.virtual,fe=De.titleRender,be=De.onContextMenu,ne=Object(w.f)(this.props);return I.createElement(P.a.Provider,{value:{prefixCls:Be,selectable:ke,showIcon:ct,icon:ut,switcherIcon:vt,draggable:lt,checkable:Tt,checkStrictly:gt,disabled:yt,keyEntities:xe,loadData:Pt,filterTreeNode:St,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}},I.createElement("div",{className:A()(Be,Ae,(se={},Object(oe.a)(se,"".concat(Be,"-show-line"),We),Object(oe.a)(se,"".concat(Be,"-focused"),ie),Object(oe.a)(se,"".concat(Be,"-active-focused"),Ne!==null),se))},I.createElement(G,Object.assign({ref:this.listRef,prefixCls:Be,style:Pe,data:q,disabled:yt,selectable:ke,checkable:!!Tt,motion:Oe,dragging:Ie,height:Ue,itemHeight:Ze,virtual:Ee,focusable:ze,focused:ie,tabIndex:Ge,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,ve){var ie=ve.prevProps,q={prevProps:se};function xe(ut){return!ie&&ut in se||ie&&ie[ut]!==se[ut]}var Ie;if(xe("treeData")?Ie=se.treeData:xe("children")&&(Object(L.a)(!1,"`children` of Tree is deprecated. Please use `treeData` instead."),Ie=Object(S.c)(se.children)),Ie){q.treeData=Ie;var Ne=Object(S.a)(Ie);q.keyEntities=Object($.a)(Object(oe.a)({},s,b),Ne.keyEntities)}var De=q.keyEntities||ve.keyEntities;if(xe("expandedKeys")||ie&&xe("autoExpandParent"))q.expandedKeys=se.autoExpandParent||!ie&&se.defaultExpandParent?Object(w.e)(se.expandedKeys,De):se.expandedKeys;else if(!ie&&se.defaultExpandAll){var Be=Object($.a)({},De);delete Be[s],q.expandedKeys=Object.keys(Be).map(function(ut){return Be[ut].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,Ie||q.expandedKeys){var Ae=Object(S.d)(Ie||ve.treeData,q.expandedKeys||ve.expandedKeys);q.flattenNodes=Ae}if(se.selectable&&(xe("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(xe("checkedKeys")?Pe=Object(w.j)(se.checkedKeys)||{}:!ie&&se.defaultCheckedKeys?Pe=Object(w.j)(se.defaultCheckedKeys)||{}:Ie&&(Pe=Object(w.j)(se.checkedKeys)||{checkedKeys:ve.checkedKeys,halfCheckedKeys:ve.halfCheckedKeys}),Pe){var We=Pe,ze=We.checkedKeys,qe=ze===void 0?[]:ze,Ge=We.halfCheckedKeys,ke=Ge===void 0?[]:Ge;if(!se.checkStrictly){var ct=Object(B.a)(qe,!0,De);qe=ct.checkedKeys,ke=ct.halfCheckedKeys}q.checkedKeys=qe,q.halfCheckedKeys=ke}}return xe("loadedKeys")&&(q.loadedKeys=se.loadedKeys),q}}]),_e}(I.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 de=te,pe=Xe.b=de},k4n4:function(rt,Xe,X){"use strict";var oe=X("tJVT"),$=X("q1tI"),D=X.n($),Y=X("e+RI"),U=X.n(Y),N=X("FTkQ"),K=X.n(N),I=X("E/GV"),O=X.n(I),L=function(A){var P=A.type,w=P===void 0?1:P,S=A.value,x=S===void 0?[]:S,h=A.onChange,l=A.disabled,i=l===void 0?!1:l,c=A.icon,C=Object($.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,x==null?void 0:x.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,x==null?void 0:x.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(rt,Xe,X){},kqOp:function(rt,Xe,X){"use strict";X.d(Xe,"a",function(){return L});var oe=X("0Owb"),$=X("fWQN"),D=X("mtLc"),Y=X("yKVA"),U=X("879j"),N=X("q1tI"),K=X.n(N),I=X("Ot1p"),O="\u2581",L=function(T){Object(Y.a)(P,T);var A=Object(U.a)(P);function P(){var w;Object($.a)(this,P);for(var S=arguments.length,x=new Array(S),h=0;h<S;h++)x[h]=arguments[h];return w=A.call.apply(A,[this].concat(x)),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(I.a,Object(oe.a)({},this.props,{onCMBeforeChange:this.onCMBeforeChange}))}}]),P}(N.Component)},lZu9:function(rt,Xe,X){(function(oe){oe(X("VrN/"),X("1eCo"),X("8EBN"))})(function(oe){"use strict";oe.defineMode("markdown",function($,D){var Y=oe.getMode($,"text/html"),U=Y.name=="null";function N(G){if(oe.findModeByName){var B=oe.findModeByName(G);B&&(G=B.mime||B.mimes[0])}var te=oe.getMode($,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 I in K)K.hasOwnProperty(I)&&D.tokenTypeOverrides[I]&&(K[I]=D.tokenTypeOverrides[I]);var O=/^([*\-_])(?:\s*\1){2,}\s*$/,L=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,T=/^\[(x| )\](?=\s)/i,A=D.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,P=/^ {0,3}(?:\={1,}|-{2,})\s*$/,w=/^[^#!\[\]*_\\<>` "'(~:]+/,S=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,x=/^\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(Y,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,de=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=!de&&!ye&&!B.prevLine.header&&(!Ce||!pe)&&!B.prevLine.fencedCodeEnd,ve=(B.list===!1||ye||de)&&B.indentation<=_e&&G.match(O),ie=null;if(B.indentationDiff>=4&&(pe||B.prevLine.fencedCodeEnd||B.prevLine.header||de))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(!ve&&!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(T,!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&&N(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&&!ve&&!x.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(ve)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=Y.token(G,B.htmlState);if(!U){var de=oe.innerMode(Y,B.htmlState);(de.mode.name=="xml"&&de.state.tagStart===null&&!de.state.context&&de.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,de=B.indentation<te,pe=te+3;if(B.fencedEndRE&&B.indentation<=pe&&(de||G.match(B.fencedEndRE))){D.highlightFormatting&&(B.formatting="code-block");var ye;return de||(ye=d(B)),B.localMode=B.localState=null,B.block=m,B.f=s,B.fencedEndRE=null,B.code=0,B.thisLine.fencedCodeEnd=!0,de?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 de=(G.listStack.length-1)%3;de?de===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 de=G.match(T,!0)[1]===" ";return de?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 ve=d(B),ie=K.formatting+"-escape";return ve?ve+" "+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 ve=d(B);return B.imageAltText=!1,B.image=!1,B.inline=B.f=b,ve}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 ve=d(B);return B.linkText=!1,B.inline=B.f=G.match(/\(.*?\)| ?\[.*?\]/,!1)?b:s,ve}if(pe==="<"&&G.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){B.f=B.inline=o,D.highlightFormatting&&(B.formatting="link");var ve=d(B);return ve?ve+=" ":ve="",ve+K.linkInline}if(pe==="<"&&G.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){B.f=B.inline=o,D.highlightFormatting&&(B.formatting="link");var ve=d(B);return ve?ve+=" ":ve="",ve+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 xe=G.string.substring(G.start,q);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(xe)&&(B.md_inside=!0)}return G.backUp(1),B.htmlState=oe.startState(Y),c(G,B,u)}if(D.xml&&pe==="<"&&G.match(/^\/\w*?>/))return B.md_inside=!1,"tag";if(pe==="*"||pe==="_"){for(var Ie=1,Ne=G.pos==1?" ":G.string.charAt(G.pos-2);Ie<3&&G.eat(pe);)Ie++;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,We=null;if(Ie%2&&(!B.em&&Be&&(pe==="*"||!Ae||h.test(Ne))?Pe=!0:B.em==pe&&Ae&&(pe==="*"||!Be||h.test(De))&&(Pe=!1)),Ie>1&&(!B.strong&&Be&&(pe==="*"||!Ae||h.test(Ne))?We=!0:B.strong==pe&&Ae&&(pe==="*"||!Be||h.test(De))&&(We=!1)),We!=null||Pe!=null){D.highlightFormatting&&(B.formatting=Pe==null?"strong":We==null?"em":"strong em"),Pe===!0&&(B.em=pe),We===!0&&(B.strong=pe);var se=d(B);return Pe===!1&&(B.em=!1),We===!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 o(G,B){var te=G.next();if(te===">"){B.f=B.inline=s,D.highlightFormatting&&(B.formatting="link");var de=d(B);return de?de+=" ":de="",de+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 de=B.next();if(de===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(Y,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:Y}:G.localState?{state:G.localState,mode:G.localMode}:{state:G,mode:Z}},indent:function(G,B,te){return G.block==u&&Y.indent?Y.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(rt,Xe,X){rt.exports=X.p+"static/up.69f3b3fd.svg"},m3fD:function(rt,Xe,X){rt.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(rt,Xe,X){(function(oe){oe(X("VrN/"))})(function(oe){"use strict";var $=oe.Pos;function D(h,l){return h.line-l.line||h.ch-l.ch}var Y="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=Y+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",N=new RegExp("<(/?)(["+Y+"]["+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 I(h,l){var i=h.cm.getTokenTypeAt($(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 T(h){for(;;){var l=h.text.indexOf(">",h.ch);if(l==-1){if(O(h))continue;return}if(!I(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(!I(h,l+1)){h.ch=l;continue}N.lastIndex=l,h.ch=l;var i=N.exec(h.text);if(i&&i.index==l)return i}}function P(h){for(;;){N.lastIndex=h.ch;var l=N.exec(h.text);if(!l){if(O(h))continue;return}if(!I(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(!I(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=T(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:$(v,m),to:$(h.line,h.ch)}}else i.push(c[2])}}function x(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:$(h.line,h.ch),to:$(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=T(i);if(!C)return;if(!c[1]&&C!="selfClose"){var v=$(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=T(c),v=C&&$(c.line,c.ch),m=C&&A(c);if(!C||!m||D(c,l)>0)return;var u={from:$(c.line,c.ch),to:v,tag:m[2]};return C=="selfClose"?{open:u,close:null,at:"open"}:m[1]?{open:x(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=x(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(rt,Xe,X){"use strict";var oe=X("+L6B"),$=X("2/Rp"),D=X("5Dmo"),Y=X("3S7+"),U=X("k1fw"),N=X("tJVT"),K=X("q1tI"),I=X.n(K),O=X("vHTk"),L=X.n(O),T=X("yEEn"),A=X("ZW9T"),P=X("1vsH");Xe.a=function(w){var S=w.name,x=w.data,h=w.theme,l=w.type,i=w.filename,c=w.monacoEditor,C=w.className,v=w.style,m=w.close,u=w.onClose,E=w.hasMask,d=Object(K.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),f=Object(N.a)(d,2),s=f[0],o=f[1],b=Object(K.useState)(""),g=Object(N.a)(b,2),_=g[0],k=g[1],H,z=1024*1024,Z=10*z,G=Object(K.useRef)();l==="office"&&(H=Object(P.T)(x).filesize,H>Z&&(l="other")),i&&(c.filename=i),Object(K.useEffect)(function(){var de,pe,ye=(de=document.cookie)===null||de===void 0||((pe=de.replace(/\s/g,""))===null||pe===void 0)?void 0:pe.split(";");ye==null||ye.map(function(Ce){var _e=Ce.split("=");_e[0]==="_educoder_session"&&k(_e[1])})},[]);var B=function(){if(x.startsWith("http")||x.startsWith("/")){te();return}Object(P.z)(i||"educoder",x,i)},te=function(){Object(P.x)(i||S,x)};return console.log("data:",x,"fileanme:",i," name:",S),I.a.createElement("div",{style:Object(U.a)({},v||{}),className:"".concat(E&&L.a.bgBlack," ").concat(l?L.a.wrp:"hide")},m&&I.a.createElement("div",{className:L.a.close,ref:G},I.a.createElement(Y.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return G.current}},I.a.createElement("span",{onClick:te},I.a.createElement("i",{className:"icon-quxiaozhiding"}))),I.a.createElement(Y.a,{title:"\u5173\u95ED",getPopupContainer:function(){return G.current}},I.a.createElement("span",{className:"",onClick:u},I.a.createElement("i",{className:"icon-guanbi1"})))),I.a.createElement("div",{className:"".concat(L.a[C]," ").concat(C," ").concat(L.a.monaco," ").concat(l==="txt"?"show":"hide")},l==="txt"&&I.a.createElement(A.b,c)),l==="audio"&&I.a.createElement("audio",{src:"".concat(x!=null&&x.startsWith("/")||(x==null?void 0:x.indexOf("https://"))>-1?x:"data:audio/mp3;base64,").concat(x),autoPlay:!0}),l==="video"&&I.a.createElement(I.a.Fragment,null,x!=null&&x.startsWith("/")?I.a.createElement("video",{controls:!0,src:"".concat(x),autoPlay:!0}):I.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(x),autoPlay:!0})),l==="html"&&I.a.createElement("iframe",{src:x+"&disposition=inline"}),l==="pdf"&&I.a.createElement("embed",{className:L.a.embed,src:x}),l==="image"&&I.a.createElement(I.a.Fragment,null,I.a.createElement("img",{src:"".concat(x!=null&&x.startsWith("/")||(x==null?void 0:x.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(x)})),l==="other"&&I.a.createElement("div",null,I.a.createElement($.a,{type:"primary",size:"large",onClick:B},I.a.createElement(T.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(l==="download"||l==="office")&&I.a.createElement($.a,{type:"primary",size:"large",onClick:B},I.a.createElement(T.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(rt,Xe,X){},rUJ1:function(rt,Xe){const X=/[&<>"']/,oe=/[&<>"']/g,$=/[<>"']|&(?!#?\w+;)/,D=/[<>"']|&(?!#?\w+;)/g,Y={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},U=E=>Y[E];function N(E,d){if(d){if(X.test(E))return E.replace(oe,U)}else if($.test(E))return E.replace(D,U);return E}const K=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function I(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,o)=>(o=o.source||o,o=o.replace(O,"$1"),E=E.replace(s,o),f),getRegex:()=>new RegExp(E,d)};return f}const T=/[^\w:]/g,A=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function P(E,d,f){if(E){let s;try{s=decodeURIComponent(I(f)).replace(T,"").toLowerCase()}catch(o){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=/^[^:]+:\/*[^/]*$/,x=/^([^:]+:)[\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(x,"$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 o=0;if(s.length>d)s.splice(d);else for(;s.length<d;)s.push("");for(;o<s.length;o++)s[o]=s[o].trim().replace(/\\\|/g,"|");return s}function v(E,d,f){const s=E.length;if(s===0)return"";let o=0;for(;o<s;){const b=E.charAt(s-o-1);if(b===d&&!f)o++;else if(b!==d&&f)o++;else break}return E.substr(0,s-o)}function m(E,d){if(E.indexOf(d[1])===-1)return-1;const f=E.length;let s=0,o=0;for(;o<f;o++)if(E[o]==="\\")o++;else if(E[o]===d[0])s++;else if(E[o]===d[1]&&(s--,s<0))return o;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")}rt.exports={escape:N,unescape:I,edit:L,cleanUrl:P,resolveUrl:l,noopTest:i,merge:c,splitCells:C,rtrim:v,findClosingBracket:m,checkSanitizeDeprecation:u}},sbIO:function(rt,Xe,X){"use strict";var oe=X("DjyN"),$=X("NUBc"),D=X("5Dmo"),Y=X("3S7+"),U=X("/zsF"),N=X("PArb"),K=X("Q9mQ"),I=X("diRs"),O=X("+L6B"),L=X("2/Rp"),T=X("5NDa"),A=X("5rEg"),P=X("miYZ"),w=X("tsqr"),S=X("9og8"),x=X("giR+"),h=X("fyUT"),l=X("2qtc"),i=X("kLXV"),c=X("tJVT"),C=X("WmNS"),v=X.n(C),m=X("q1tI"),u=X.n(m),E=X("PsQE"),d=X.n(E),f=X("0eGx"),s=X.n(f),o=X("9Bee"),b=X("Ty5D"),g=X("9kvl"),_=X("ErOA"),k=X("+yhJ"),H=X.n(k),z=X("RZ/O"),Z=X.n(z),G=X("LvDl"),B=X("6K3P"),te=X.n(B),de=X("sRBo"),pe=X("kaz8"),ye=X("oBTY"),Ce=X("PpiC"),_e=X("Ot1p"),le=X("kqOp"),se=X("7qnI"),ve=X("1vsH"),ie=X("PGNT"),q=X.n(ie),xe=["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"],Ie=function(ae,ce){var ue=ae.globalSetting,we=ae.loading,Le=ae.dispatch,tt=ae.isEdit,Fe=ae.editData,$e=Object(Ce.a)(ae,["globalSetting","loading","dispatch","isEdit","editData"]),Dt=Object(m.useState)(""),ot=Object(c.a)(Dt,2),ft=ot[0],zt=ot[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),it=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)(),at=Object(c.a)(Lt,2),Ve=at[0],ln=at[1],Yt=Object(m.useState)(!1),cn=Object(c.a)(Yt,2),qt=cn[0],En=cn[1];Object(m.useEffect)(function(){if(!Fe||!tt)return;zt(Fe==null?void 0:Fe.name),Bt(Fe==null?void 0:Fe.analysis),ln(Fe==null?void 0:Fe.is_ordered),En(!0)},[Fe]),Object(m.useEffect)(function(){if(!qt)return;var Fn=Fe==null?void 0:Fe.standard_answer.map(function(F){return F.answer_text});Ft(Fn),En(!1)},[qt]),Object(m.useImperativeHandle)(ce,function(){return{onSave:on,Clear:ht}});var on=function(){var F=[],p=!1;return ft?(it.forEach(function(y,M){F.push({position:M+1,answer_text:[]}),y.forEach(function(Q,W){F[M].answer_text.push(Q),(!Q||!Object(ve.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:ft,analysis:sn,standard_answers:F,is_ordered:Ve}):(w.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1)},ht=function(){zt(""),Bt(""),Ft([]),ln(!1)},Ke=function(F,p,y){var M=it.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=it.slice();M[F][p]=y,Ft(M)},Hn=function(F){var p=it.slice();p[F]=[].concat(Object(ye.a)(p[F]),[""]),Ft(p)},fr=function(F,p){var y=it.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=it.slice();y=it.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:ft,onChange:function(F){return zt(F)},showNullButton:!0,onPlaceholderChange:Ke})),u.a.createElement("div",{className:"mt20"},it.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"},it.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,ce=re.globalSetting;return{globalSetting:ce,loading:ae.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(Ie)),De=X("7Kak"),Be=X("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,ce){var ue=ae.globalSetting,we=ae.loading,Le=ae.editData,tt=ae.dispatch,Fe=ae.onRef,$e=Fe===void 0?function(){}:Fe,Dt=ae.isEdit,ot=Object(Ce.a)(ae,["globalSetting","loading","editData","dispatch","onRef","isEdit"]),ft=Object(m.useState)(),zt=Object(c.a)(ft,2),Je=zt[0],Kt=zt[1],sn=Object(m.useState)(""),Bt=Object(c.a)(sn,2),an=Bt[0],Qt=Bt[1],it=Object(m.useState)(""),Ft=Object(c.a)(it,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(at){return at.is_answer});Kt(Lt.choice_text==="\u6B63\u786E"?"0":"1")},[Le]),Object(m.useImperativeHandle)(ce,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 at=[{choice_text:"\u6B63\u786E",is_answer:Je==="0"?1:0},{choice_text:"\u9519\u8BEF",is_answer:Je==="1"?1:0}];return{name:an,choices:at,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(at){return Qt(at)}}),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(at){return Kt(at.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(at){return kt(at)}}))},We=Object(g.a)(function(re){var ae=re.loading,ce=re.globalSetting;return{globalSetting:ce,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,ce){var ue=ae.editData,we=ae.globalSetting,Le=ae.loading,tt=ae.dispatch,Fe=ae.onRef,$e=Fe===void 0?function(){}:Fe,Dt=ae.isEdit,ot=Object(Ce.a)(ae,["editData","globalSetting","loading","dispatch","onRef","isEdit"]),ft=Object(m.useState)([]),zt=Object(c.a)(ft,2),Je=zt[0],Kt=zt[1],sn=Object(m.useState)(),Bt=Object(c.a)(sn,2),an=Bt[0],Qt=Bt[1],it=Object(m.useState)([]),Ft=Object(c.a)(it,2),xt=Ft[0],kt=Ft[1],Mt=Object(m.useState)(""),It=Object(c.a)(Mt,2),Lt=It[0],at=It[1],Ve=Object(m.useState)(""),ln=Object(c.a)(Ve,2),Yt=ln[0],cn=ln[1];Object(m.useEffect)(function(){Kt(["","","",""])},[]),Object(m.useEffect)(function(){if(!ue||!Dt)return;at(ue==null?void 0:ue.name),cn(ue==null?void 0:ue.analysis),Kt(ue==null?void 0:ue.choices.map(function(ht){return ht.choice_text}));var on=[];ue==null||ue.choices.map(function(ht,Ke){ht.is_answer&&on.push(Ke)}),kt(on)},[ue]),Object(m.useImperativeHandle)(ce,function(){return{onSave:qt,Clear:En}});var qt=function(){if(!Lt)return w.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;var ht=Je.findIndex(function(wt){return!wt});if(ht>-1)return w.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(ze[ht]," \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 Ke=Je.map(function(wt,Hn){return{choice_text:wt,is_answer:xt.includes(Hn)?1:0}});return{name:Lt,choices:Ke,analysis:Yt}},En=function(){Kt(["","","",""]),at(""),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(ht){return at(ht)}}),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,ht){return u.a.createElement("div",{className:q.a.choiceWrap,key:ht},u.a.createElement(Y.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(ht)?q.a.activeAnswer:""),onClick:function(){xt.includes(ht)?kt(xt.filter(function(wt){return wt!==ht})):kt([].concat(Object(ye.a)(xt),[ht]))}},ze[ht])),u.a.createElement("div",{className:q.a.editorWrap},an===ht?u.a.createElement(_e.a,{id:"single-question-option-".concat(ht),watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:on,onChange:function(wt){Je[ht]=wt,Kt(Je)}}):u.a.createElement("div",{className:q.a.htmlWrap,onClick:function(){return Qt(ht)}},u.a.createElement(o.a,{value:on}))),ht>1&&u.a.createElement(Y.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!==ht})),xt.includes(ht)?kt(xt.filter(function(wt){return wt!==ht})):kt([].concat(Object(ye.a)(xt),[ht]))}})),ht<7&&ht===Je.length-1&&u.a.createElement(Y.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:Yt,onChange:function(ht){return cn(ht)}}))},Ge=Object(g.a)(function(re){var ae=re.loading,ce=re.globalSetting;return{globalSetting:ce,loading:ae.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(qe)),ke=["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"],ct=function(ae,ce){var ue=ae.editData,we=ae.globalSetting,Le=ae.loading,tt=ae.dispatch,Fe=ae.onRef,$e=Fe===void 0?function(){}:Fe,Dt=ae.isEdit,ot=Object(Ce.a)(ae,["editData","globalSetting","loading","dispatch","onRef","isEdit"]),ft=Object(m.useState)([]),zt=Object(c.a)(ft,2),Je=zt[0],Kt=zt[1],sn=Object(m.useState)(),Bt=Object(c.a)(sn,2),an=Bt[0],Qt=Bt[1],it=Object(m.useState)(),Ft=Object(c.a)(it,2),xt=Ft[0],kt=Ft[1],Mt=Object(m.useState)(""),It=Object(c.a)(Mt,2),Lt=It[0],at=It[1],Ve=Object(m.useState)(""),ln=Object(c.a)(Ve,2),Yt=ln[0],cn=ln[1];Object(m.useEffect)(function(){Kt(["","","",""])},[]),Object(m.useEffect)(function(){if(!ue||!Dt)return;at(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)(ce,function(){return{onSave:qt,Clear:En}});var qt=function(){if(!Lt)return w.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;var ht=Je.findIndex(function(wt){return!wt});if(ht>-1)return w.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(ke[ht]," \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 Ke=Je.map(function(wt,Hn){return{choice_text:wt,is_answer:xt===Hn?1:0}});return{name:Lt,choices:Ke,analysis:Yt}},En=function(){Kt(["","","",""]),at(""),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(ht){return at(ht)}}),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,ht){return u.a.createElement("div",{className:q.a.choiceWrap,key:ht},u.a.createElement(Y.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},u.a.createElement("div",{className:"".concat(q.a.answer," ").concat(xt===ht?q.a.activeAnswer:""),onClick:function(){return kt(ht)}},ke[ht])),u.a.createElement("div",{className:q.a.editorWrap},an===ht?u.a.createElement(_e.a,{id:"single-question-option-".concat(ht),watch:!0,height:155,isFocus:!0,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:on,onChange:function(wt){Je[ht]=wt,Kt(Je)}}):u.a.createElement("div",{className:q.a.htmlWrap,onClick:function(){return Qt(ht)}},u.a.createElement(o.a,{value:on}))),ht>1&&u.a.createElement(Y.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!==ht})),ht===xt&&kt(null)}})),ht<7&&ht===Je.length-1&&u.a.createElement(Y.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:Yt,onChange:function(ht){return cn(ht)}}))},ut=Object(g.a)(function(re){var ae=re.loading,ce=re.globalSetting;return{globalSetting:ce,loading:ae.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(ct)),vt=["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,ce){var ue=ae.editData,we=ae.globalSetting,Le=ae.loading,tt=ae.dispatch,Fe=ae.onRef,$e=Fe===void 0?function(){}:Fe,Dt=ae.isEdit,ot=Object(Ce.a)(ae,["editData","globalSetting","loading","dispatch","onRef","isEdit"]),ft=Object(m.useState)(""),zt=Object(c.a)(ft,2),Je=zt[0],Kt=zt[1],sn=Object(m.useState)(""),Bt=Object(c.a)(sn,2),an=Bt[0],Qt=Bt[1],it=Object(m.useState)(""),Ft=Object(c.a)(it,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)(ce,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(at){return Kt(at)}}),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(at){return kt(at)}}),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(at){return Qt(at)}}))},Tt=Object(g.a)(function(re){var ae=re.loading,ce=re.globalSetting;return{globalSetting:ce,loading:ae.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(lt)),gt=X("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"],Oe=function(ae,ce){var ue=ae.globalSetting,we=ae.loading,Le=ae.dispatch,tt=ae.editData,Fe=ae.onRef,$e=Fe===void 0?function(){}:Fe,Dt=ae.isEdit,ot=Object(Ce.a)(ae,["globalSetting","loading","dispatch","editData","onRef","isEdit"]),ft=Object(m.useState)(""),zt=Object(c.a)(ft,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(!tt||!Dt)return;Kt(tt==null?void 0:tt.name);var It=tt==null||((Mt=tt.sub_item_banks)===null||Mt===void 0)?void 0:Mt.map(function(Lt){var at,Ve,ln;return Object(gt.a)(Object(gt.a)({},Lt),{},{id:Lt.id,open:!1,qusList:Lt==null||((at=Lt.choices)===null||at===void 0)?void 0:at.map(function(Yt){return Yt.choice_text}),activeQusEditor:null,qusAnswer:(Ve=[Lt==null||((ln=Lt.choices)===null||ln===void 0)?void 0:ln.findIndex(function(Yt){return Yt.is_answer})])===null||Ve===void 0?void 0:Ve.filter(function(Yt){return Yt!==-1})})});Qt(It)},[tt]),Object(m.useImperativeHandle)(ce,function(){return{onSave:it,Clear:Ft}});var it=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,at=an[It];if(!(at!=null&&at.name))return w.b.info("\u8BF7\u60A8\u8F93\u5165\u7B2C".concat(It+1,"\u5C0F\u9898\u9898\u5E72")),!1;var Ve=at==null||((Lt=at.qusList)===null||Lt===void 0)?void 0:Lt.findIndex(function(Yt){return!Yt});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(!(at!=null&&at.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(Yt){return{id:Yt.id>1?Yt.id:null,name:Yt.name,item_type:Yt.item_type,analysis:Yt.analysis,choices:Yt.qusList.map(function(cn,qt){return{choice_text:cn,is_answer:Yt.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,at){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=at),It==="answer"&&(Ve[Lt].qusAnswer=[at]),It==="edit"&&(Ve[Lt].activeQusEditor=at),It==="details"&&(Ve[Lt].qusList[Ve[Lt].activeQusEditor]=at),It==="addQus"&&(Ve[Lt].qusList=Ve[Lt].qusList.concat("")),It==="deleteQus"){var ln;Ve[Lt].qusList=Ve[Lt].qusList.filter(function(Yt,cn){return cn!==at}),Ve[Lt].qusAnswer=(ln=Ve[Lt].qusAnswer)===null||ln===void 0?void 0:ln.filter(function(Yt){return Yt!==at})}It==="analysis"&&(Ve[Lt].analysis=at),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(at,Ve){var ln,Yt;return u.a.createElement("div",{className:q.a.choiceWrap,key:Ve},u.a.createElement(Y.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:at,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(o.a,{value:at}))),Ve>1&&u.a.createElement(Y.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||((Yt=Mt.qusList)===null||Yt===void 0)?void 0:Yt.length)-1&&u.a.createElement(Y.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,ce=re.globalSetting;return{globalSetting:ce,loading:ae.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(Oe)),St=X("14J3"),Ue=X("BMrR"),Ze=X("ZWs3"),Ee=function(ae){var ce=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:ce,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=Ee,be=function(ae){var ce,ue,we,Le,tt,Fe,$e,Dt,ot=ae.data,ft=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,it=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],at=Object(m.useState)(!1),Ve=Object(c.a)(at,2),ln=Ve[0],Yt=Ve[1],cn=Object(m.useState)(!1),qt=Object(c.a)(cn,2),En=qt[0],on=qt[1],ht=Object(m.useRef)(),Ke=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(){Yt(!0)},[]),Object(m.useEffect)(function(){var _t,Te,nt,Ht,Ot=(_t=document.getElementById("examName"))===null||_t===void 0||((Te=_t.getElementsByClassName("ant-pagination-options-quick-jumper"))===null||Te===void 0||((nt=Te[0])===null||nt===void 0||((Ht=nt.childNodes)===null||Ht===void 0)))?void 0:Ht[2];Ot&&(Ot.nodeValue="\u4EFD")},[ot]);var wt=function(Te){var nt=parseInt(Te);return isNaN(nt)?"":nt};function Hn(){var _t=0,Te=0,nt=0;return document.body&&(Te=document.body.scrollTop),document.documentElement&&(nt=document.documentElement.scrollTop),_t=Te-nt>0?Te:nt,_t}function fr(){var _t=0,Te=0,nt=0;return document.body&&(Te=document.body.scrollHeight),document.documentElement&&(nt=document.documentElement.scrollHeight),_t=Te-nt>0?Te:nt,_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"),nt=document.getElementById("preview_btns_else");Hn()+Ar()>=fr()-68?(Te.style.visibility="hidden",nt.style.visibility="visible"):(Te.style.visibility="visible",nt.style.visibility="hidden")},F=["\u5BB9\u6613","\u7B80\u5355","\u9002\u4E2D","\u56F0\u96BE"],p=function(Te){var nt,Ht=[];return u.a.createElement(u.a.Fragment,null,u.a.createElement("aside",{className:d.a.single},Te==null||((nt=Te.choices)===null||nt===void 0)?void 0:nt.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(o.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(o.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 nt,Ht=Te==null||((nt=Te.standard_answer)===null||nt===void 0)?void 0:nt.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(o.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 nt;return u.a.createElement("div",{className:d.a.analysis},u.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",Te==null||((nt=Te.answer_texts)===null||nt===void 0)?void 0:nt[0]),u.a.createElement("aside",null,u.a.createElement("span",{className:d.a.text},"\u89E3\u6790:"),u.a.createElement(o.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 nt;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(o.a,{value:Te==null||((nt=Te.program_attr)===null||nt===void 0)?void 0:nt.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,nt){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"}},nt+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(o.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(o.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"],Ye=function(Te){var nt,Ht=[];Te==null||((nt=Te.questions)===null||nt===void 0)||nt.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}()})},dt=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 nt=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=[],ot==null||((Nt=ot.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,ft(un);case 11:case"end":return Kn.stop()}},Ot)}));function Ht(){return nt.apply(this,arguments)}return Ht}()})},jt=function(Te,nt,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"))ht.current={id:Te,ids:Dn,type:nt,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,it({single_question_id:Te,seleted_item_bank_ids:Dn},{type:nt,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 nt,Ht=(nt=Te.questions)===null||nt===void 0?void 0:nt.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,it({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 nt=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,it();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 nt.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(I.a,{color:"#55575D",overlayClassName:d.a.popover,visible:ln,getPopupContainer:function(nt){return nt==null?void 0:nt.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 Yt(!0)},onMouseLeave:function(){return Yt(!1)},onClick:function(){dt()}},"\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 ft()},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<(ot==null||((Te=ot.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,nt){if(nt==="SINGLE")return u.a.createElement(u.a.Fragment,null,u.a.createElement(ut,{ref:Ft,editData:Te,isEdit:!0}),u.a.createElement(N.a,null));if(nt==="MULTIPLE")return u.a.createElement(u.a.Fragment,null,u.a.createElement(Ge,{ref:Ft,editData:Te,isEdit:!0}),u.a.createElement(N.a,null));if(nt==="JUDGMENT")return u.a.createElement(u.a.Fragment,null,u.a.createElement(We,{ref:Ft,editData:Te,isEdit:!0}),u.a.createElement(N.a,null));if(nt==="COMPLETION")return u.a.createElement(u.a.Fragment,null,u.a.createElement(Ne,{ref:Ft,editData:Te,isEdit:!0}),u.a.createElement(N.a,null));if(nt==="SUBJECTIVE")return u.a.createElement(u.a.Fragment,null,u.a.createElement(Tt,{ref:Ft,editData:Te,isEdit:!0}),u.a.createElement(N.a,null));if(nt==="COMBINATION")return u.a.createElement(u.a.Fragment,null,u.a.createElement(Pt,{ref:Ft,editData:Te,isEdit:!0}),u.a.createElement(N.a,null));if(nt==="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(Ke.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(nt,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},(nt==="SINGLE"||nt==="MULTIPLE"||nt==="JUDGMENT")&&(Sn=[],un=[],Xt.question_type=nt==="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),nt==="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),nt==="SUBJECTIVE"&&(Xt.question_title=Nt==null?void 0:Nt.name,Xt.question_type=3,Xt.standard_answers=Nt==null?void 0:Nt.answer_texts),nt==="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(nt,Ht){return _t.apply(this,arguments)}}(),Rr=function(){for(var Te=[],nt=0;nt<(ot==null||((Ht=ot.exam)===null||Ht===void 0)?void 0:Ht.total_num);nt++){var Ht;Te.push({})}return Te},qr=ot==null||((ce=ot.questionList)===null||ce===void 0)?void 0:ce.reduce(function(_t,Te){return _t+Te.questions_score},0),Vn=Bt&&(ot==null||((ue=ot.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 nt=document.getElementById("id_left_preview");nt.style.overflowY="auto"},onMouseLeave:function(Te){var nt=document.getElementById("id_left_preview");nt.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,ot==null?void 0:ot.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,ot==null||((we=ot.exam)===null||we===void 0)?void 0:we.time))),ot==null||((Le=ot.questionList)===null||Le===void 0)?void 0:Le.map(function(_t,Te){var nt;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||((nt=_t.questions)===null||nt===void 0)?void 0:nt.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(Y.a,{title:ot==null||((tt=ot.exam)===null||tt===void 0)?void 0:tt.name,getPopupContainer:function(Te){return Te.parentNode}},u.a.createElement("span",{className:d.a.t},ot==null||((Fe=ot.exam)===null||Fe===void 0)?void 0:Fe.name))),Bt?u.a.createElement($.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:ot==null||(($e=ot.exam)===null||$e===void 0)?void 0:$e.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},ot==null||((Dt=ot.questionList)===null||Dt===void 0)?void 0:Dt.map(function(_t,Te){var nt,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||((nt=_t.questions)===null||nt===void 0)?void 0:nt.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(){Ye(_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(o.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=ht.current,Ht.next=3,it({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=ht.current,nt="".concat(location.pathname).concat(location.search);nt.includes("exercise")&&g.d.push("/paperlibrary/exchangequestion?type=exercise&qid=".concat(Te.id,"&qtype=").concat(Te.type,"&exerciseid=").concat(Ke.categoryId,"&from=").concat(nt))},onCancel:function(){on(!1)}}))},ne=Xe.a=be},sboe:function(rt,Xe,X){"use strict";X.d(Xe,"a",function(){return D});var oe=X("q1tI"),$=X.n(oe),D=oe.createContext(null)},tmPe:function(rt,Xe,X){rt.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(rt,Xe,X){typeof window!="undefined"&&function($,D){rt.exports=D()}(this,function(){return function(oe){var $={};function D(Y){if($[Y])return $[Y].exports;var U=$[Y]={i:Y,l:!1,exports:{}};return oe[Y].call(U.exports,U,U.exports,D),U.l=!0,U.exports}return D.m=oe,D.c=$,D.d=function(Y,U,N){D.o(Y,U)||Object.defineProperty(Y,U,{enumerable:!0,get:N})},D.r=function(Y){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(Y,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Y,"__esModule",{value:!0})},D.t=function(Y,U){if(U&1&&(Y=D(Y)),U&8)return Y;if(U&4&&typeof Y=="object"&&Y&&Y.__esModule)return Y;var N=Object.create(null);if(D.r(N),Object.defineProperty(N,"default",{enumerable:!0,value:Y}),U&2&&typeof Y!="string")for(var K in Y)D.d(N,K,function(I){return Y[I]}.bind(null,K));return N},D.n=function(Y){var U=Y&&Y.__esModule?function(){return Y.default}:function(){return Y};return D.d(U,"a",U),U},D.o=function(Y,U){return Object.prototype.hasOwnProperty.call(Y,U)},D.p="/dist/",D(D.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(oe,$,D){"use strict";var Y=Object.prototype.hasOwnProperty,U="~";function N(){}Object.create&&(N.prototype=Object.create(null),new N().__proto__||(U=!1));function K(T,A,P){this.fn=T,this.context=A,this.once=P||!1}function I(T,A,P,w,S){if(typeof P!="function")throw new TypeError("The listener must be a function");var x=new K(P,w||T,S),h=U?U+A:A;return T._events[h]?T._events[h].fn?T._events[h]=[T._events[h],x]:T._events[h].push(x):(T._events[h]=x,T._eventsCount++),T}function O(T,A){--T._eventsCount===0?T._events=new N:delete T._events[A]}function L(){this._events=new N,this._eventsCount=0}L.prototype.eventNames=function(){var A=[],P,w;if(this._eventsCount===0)return A;for(w in P=this._events)Y.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,x=w.length,h=new Array(x);S<x;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,x,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,x),!0;case 6:return i.fn.call(i.context,P,w,S,x,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 I(this,A,P,w,!1)},L.prototype.once=function(A,P,w){return I(this,A,P,w,!0)},L.prototype.removeListener=function(A,P,w,S){var x=U?U+A:A;if(!this._events[x])return this;if(!P)return O(this,x),this;var h=this._events[x];if(h.fn)h.fn===P&&(!S||h.once)&&(!w||h.context===w)&&O(this,x);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[x]=i.length===1?i[0]:i:O(this,x)}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 N,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,$,D){(function(Y){var U=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,N=/^([^\/?#]*)([^]*)$/,K=/(?:\/|^)\.(?=\/)/g,I=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,O={buildAbsoluteURL:function(L,T,A){if(A=A||{},L=L.trim(),T=T.trim(),!T){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(T);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)):T;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 x=N.exec(S.path);S.netLoc=x[1],S.path=x[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 T=U.exec(L);return T?{scheme:T[1]||"",netLoc:T[2]||"",path:T[3]||"",params:T[4]||"",query:T[5]||"",fragment:T[6]||""}:null},normalizePath:function(L){for(L=L.split("").reverse().join("").replace(K,"");L.length!==(L=L.replace(I,"")).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,$,D){function Y(A){var P={};function w(x){if(P[x])return P[x].exports;var h=P[x]={i:x,l:!1,exports:{}};return A[x].call(h.exports,h,h.exports,w),h.l=!0,h.exports}w.m=A,w.c=P,w.i=function(x){return x},w.d=function(x,h,l){w.o(x,h)||Object.defineProperty(x,h,{configurable:!1,enumerable:!0,get:l})},w.r=function(x){Object.defineProperty(x,"__esModule",{value:!0})},w.n=function(x){var h=x&&x.__esModule?function(){return x.default}:function(){return x};return w.d(h,"a",h),h},w.o=function(x,h){return Object.prototype.hasOwnProperty.call(x,h)},w.p="/",w.oe=function(x){throw console.error(x),x};var S=w(w.s=ENTRY_MODULE);return S.default||S}var U="[\\.|\\-|\\+|\\w|/|@]+",N="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+U+").*?\\)";function K(A){return(A+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function I(A){return!isNaN(1*A)}function O(A,P,w){var S={};S[w]=[];var x=P.toString(),h=x.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)+N,"g"),c;c=i.exec(x);){if(c[3]==="dll-reference")continue;S[w].push(c[3])}for(i=new RegExp("\\("+K(l)+'\\("(dll-reference\\s('+U+'))"\\)\\)'+N,"g");c=i.exec(x);)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++)I(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 T(A,P){for(var w={main:[P]},S={main:[]},x={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(x[i]=x[i]||{},x[i][C]||!A[i][C])continue;x[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)}:T(w,A),x="";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__; })",x=x+"var "+C+" = ("+Y.toString().replace("ENTRY_MODULE",JSON.stringify(v))+")({"+S[C].map(function(m){return""+JSON.stringify(m)+": "+w[C][m].toString()}).join(",")+`});
`}),x=x+"new (("+Y.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([x],{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,$,D){"use strict";D.r($),D.d($,"hlsDefaultConfig",function(){return u}),D.d($,"mergeConfig",function(){return d}),D.d($,"enableStreamingMode",function(){return f});var Y=D("./src/controller/abr-controller.ts"),U=D("./src/controller/audio-stream-controller.ts"),N=D("./src/controller/audio-track-controller.ts"),K=D("./src/controller/subtitle-stream-controller.ts"),I=D("./src/controller/subtitle-track-controller.ts"),O=D("./src/controller/buffer-controller.ts"),L=D("./src/controller/timeline-controller.ts"),T=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"),x=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 o=1;o<arguments.length;o++){var b=arguments[o];for(var g in b)Object.prototype.hasOwnProperty.call(b,g)&&(s[g]=b[g])}return s},c.apply(this,arguments)}function C(s,o){var b=Object.keys(s);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(s);o&&(g=g.filter(function(_){return Object.getOwnPropertyDescriptor(s,_).enumerable})),b.push.apply(b,g)}return b}function v(s){for(var o=1;o<arguments.length;o++){var b=arguments[o]!=null?arguments[o]:{};o%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,o,b){return o in s?Object.defineProperty(s,o,{value:b,enumerable:!0,configurable:!0,writable:!0}):s[o]=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:Y.default,bufferController:O.default,capLevelController:T.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:I.default,timelineController:L.TimelineController,audioStreamController:U.default,audioTrackController:N.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,o){if((o.liveSyncDurationCount||o.liveMaxLatencyDurationCount)&&(o.liveSyncDuration||o.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(o.liveMaxLatencyDurationCount!==void 0&&(o.liveSyncDurationCount===void 0||o.liveMaxLatencyDurationCount<=o.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(o.liveMaxLatencyDuration!==void 0&&(o.liveSyncDuration===void 0||o.liveMaxLatencyDuration<=o.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return c({},s,o)}function f(s){var o=s.loader;if(o!==x.default&&o!==S.default)i.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),s.progressive=!1;else{var b=Object(x.fetchSupported)();b&&(s.loader=x.default,s.progressive=!0,s.enableSoftwareAES=!0,i.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(oe,$,D){"use strict";D.r($);var Y=D("./src/polyfills/number.ts"),U=D("./src/utils/ewma-bandwidth-estimator.ts"),N=D("./src/events.ts"),K=D("./src/utils/buffer-helper.ts"),I=D("./src/errors.ts"),O=D("./src/types/loader.ts"),L=D("./src/utils/logger.ts");function T(w,S){for(var x=0;x<S.length;x++){var h=S[x];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(w,h.key,h)}}function A(w,S,x){return S&&T(w.prototype,S),x&&T(w,x),w}var P=function(){function w(x){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=x;var h=x.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(N.Events.FRAG_LOADING,this.onFragLoading,this),h.on(N.Events.FRAG_LOADED,this.onFragLoaded,this),h.on(N.Events.FRAG_BUFFERED,this.onFragBuffered,this),h.on(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.on(N.Events.ERROR,this.onError,this)},S.unregisterListeners=function(){var h=this.hls;h.off(N.Events.FRAG_LOADING,this.onFragLoading,this),h.off(N.Events.FRAG_LOADED,this.onFragLoaded,this),h.off(N.Events.FRAG_BUFFERED,this.onFragBuffered,this),h.off(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.off(N.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,o=f[h.level],b=m.total||Math.max(m.loaded,Math.round(u*o.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(Y.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(N.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(Y.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(N.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 I.ErrorDetails.FRAG_LOAD_ERROR:case I.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,o=this.findBestLevel(f,v,c,s,C.abrBandWidthFactor,C.abrBandWidthUpFactor);if(o>=0)return o;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 o=this.findBestLevel(f,v,c,s+b,g,_),Math.max(o,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],o=!!(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||o&&!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}();$.default=P},"./src/controller/audio-stream-controller.ts":function(oe,$,D){"use strict";D.r($);var Y=D("./src/polyfills/number.ts"),U=D("./src/controller/base-stream-controller.ts"),N=D("./src/events.ts"),K=D("./src/utils/buffer-helper.ts"),I=D("./src/controller/fragment-tracker.ts"),O=D("./src/types/level.ts"),L=D("./src/types/loader.ts"),T=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"),x=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 o;return o=u.call(this,f,s,"[audio-stream-controller]")||this,o.videoBuffer=null,o.videoTrackCC=-1,o.waitingVideoCC=-1,o.audioSwitch=!1,o.trackId=-1,o.waitingData=null,o.mainDetails=null,o.bufferFlushed=!1,o._registerListeners(),o}var d=E.prototype;return d.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},d._registerListeners=function(){var s=this.hls;s.on(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.on(N.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),s.on(N.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),s.on(N.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.on(N.Events.ERROR,this.onError,this),s.on(N.Events.BUFFER_RESET,this.onBufferReset,this),s.on(N.Events.BUFFER_CREATED,this.onBufferCreated,this),s.on(N.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),s.on(N.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(N.Events.FRAG_BUFFERED,this.onFragBuffered,this)},d._unregisterListeners=function(){var s=this.hls;s.off(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.off(N.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),s.off(N.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),s.off(N.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.off(N.Events.ERROR,this.onError,this),s.off(N.Events.BUFFER_RESET,this.onBufferReset,this),s.off(N.Events.BUFFER_CREATED,this.onBufferCreated,this),s.off(N.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),s.off(N.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.off(N.Events.FRAG_BUFFERED,this.onFragBuffered,this)},d.onInitPtsFound=function(s,o){var b=o.frag,g=o.id,_=o.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 o=this.lastCurrentTime;this.stopLoad(),this.setInterval(v),this.fragLoadError=0,o>0&&s===-1?(this.log("Override startPosition with lastCurrentTime @"+o.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,o=this.levels,b=this.trackId,g=o==null||((s=o[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 de=B.flush(),pe={frag:Z,part:G,payload:de,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 o=this.mediaBuffer?this.mediaBuffer:s,b=o.buffered;!this.loadedmetadata&&b.length&&(this.loadedmetadata=!0),this.lastCurrentTime=s.currentTime},d.doTickIdle=function(){var s,o,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,T.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(),de=this.audioSwitch;if(B>=te&&!de)return;if(!de&&this._streamEnded(G,Z)){b.trigger(N.Events.BUFFER_EOS,{type:"audio"}),this.state=U.State.ENDED;return}var pe=Z.fragments,ye=pe[0].start,Ce=G.end;if(de){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"&&!((o=le.decryptdata)!==null&&o!==void 0&&o.key)?this.loadKey(le,Z):this.loadFragment(le,Z,Ce)},d.getMaxBufferLength=function(){var s=u.prototype.getMaxBufferLength.call(this),o=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,L.PlaylistLevelType.MAIN);return o===null?s:Math.max(s,o.len)},d.onMediaDetaching=function(){this.videoBuffer=null,u.prototype.onMediaDetaching.call(this)},d.onAudioTracksUpdated=function(s,o){var b=o.audioTracks;this.resetTransmuxer(),this.levels=b.map(function(g){return new O.Level(g)})},d.onAudioTrackSwitching=function(s,o){var b=!!o.url;this.trackId=o.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,o){this.mainDetails=o.details},d.onAudioTrackLoaded=function(s,o){var b,g=this.levels,_=o.details,k=o.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(x.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 o,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 de=this.initPTS[b.cc],pe=(o=b.initSegment)===null||o===void 0?void 0:o.data;if(de!==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,de)}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},ve=se.cache;ve.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,o){var b=o.tracks.audio;b&&(this.mediaBuffer=b.buffer),o.tracks.video&&(this.videoBuffer=o.tracks.video.buffer)},d.onFragBuffered=function(s,o){var b=o.frag,g=o.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(N.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(b,g)},d.onError=function(s,o){switch(o.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,o);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=o.fatal?U.State.ERROR:U.State.IDLE,this.warn(o.details+" while loading frag, switching to "+this.state+" state"));break;case h.ErrorDetails.BUFFER_FULL_ERROR:if(o.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,o){var b=o.type;b===T.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},d._handleTransmuxComplete=function(s){var o,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,de=_.initSegment;if(this.fragContextChanged(z))return;if(this.state=U.State.PARSING,this.audioSwitch&&G&&this.completeAudioSwitch(),de!=null&&de.tracks&&(this._bufferInitSegment(de.tracks,z,k),g.trigger(N.Events.FRAG_PARSING_INIT_SEGMENT,{frag:z,id:b,tracks:de.tracks})),G){var pe=G.startPTS,ye=G.endPTS,Ce=G.startDTS,_e=G.endDTS;Z&&(Z.elementaryStreams[T.ElementaryStreamTypes.AUDIO]={startPTS:pe,endPTS:ye,startDTS:Ce,endDTS:_e}),z.setElementaryStreamInfo(T.ElementaryStreamTypes.AUDIO,pe,ye,Ce,_e),this.bufferFragmentData(G,z,Z,k)}if(te!=null&&(o=te.samples)!==null&&o!==void 0&&o.length){var le=i({frag:z,id:b},te);g.trigger(N.Events.FRAG_PARSING_METADATA,le)}if(B){var se=i({frag:z,id:b},B);g.trigger(N.Events.FRAG_PARSING_USERDATA,se)}},d._bufferInitSegment=function(s,o,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(N.Events.BUFFER_CODECS,s);var _=g.initSegment;if(_!=null&&_.byteLength){var k={type:"audio",frag:o,part:null,chunkMeta:b,parent:o.type,data:_};this.hls.trigger(N.Events.BUFFER_APPENDING,k)}this.tick()},d.loadFragment=function(s,o,b){var g=this.fragmentTracker.getState(s);this.fragCurrent=s,(this.audioSwitch||g===I.FragmentState.NOT_LOADED||g===I.FragmentState.PARTIAL)&&(s.sn==="initSegment"?this._loadInitSegment(s):o.live&&!Object(Y.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,o,b)))},d.completeAudioSwitch=function(){var s=this.hls,o=this.media,b=this.trackId;o&&(this.log("Switching audio track : flushing all audio"),u.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,s.trigger(N.Events.AUDIO_TRACK_SWITCHED,{id:b})},E}(U.default);$.default=m},"./src/controller/audio-track-controller.ts":function(oe,$,D){"use strict";D.r($);var Y=D("./src/events.ts"),U=D("./src/errors.ts"),N=D("./src/controller/base-playlist-controller.ts"),K=D("./src/types/loader.ts");function I(P,w){for(var S=0;S<w.length;S++){var x=w[S];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(P,x.key,x)}}function O(P,w,S){return w&&I(P.prototype,w),S&&I(P,S),P}function L(P,w){P.prototype=Object.create(w.prototype),P.prototype.constructor=P,T(P,w)}function T(P,w){return T=Object.setPrototypeOf||function(x,h){return x.__proto__=h,x},T(P,w)}var A=function(P){L(w,P);function w(x){var h;return h=P.call(this,x,"[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(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.on(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),h.on(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),h.on(Y.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.on(Y.Events.ERROR,this.onError,this)},S.unregisterListeners=function(){var h=this.hls;h.off(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.off(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),h.off(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),h.off(Y.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.off(Y.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(Y.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(Y.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(Y.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(Y.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}(N.default);$.default=A},"./src/controller/base-playlist-controller.ts":function(oe,$,D){"use strict";D.r($),D.d($,"default",function(){return O});var Y=D("./src/polyfills/number.ts"),U=D("./src/types/level.ts"),N=D("./src/controller/level-helper.ts"),K=D("./src/utils/logger.ts"),I=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 T=L.prototype;return T.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},T.onError=function(P,w){w.fatal&&w.type===I.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},T.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},T.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},T.stopLoad=function(){this.canLoad=!1,this.clearTimer()},T.switchParams=function(P,w){var S=w==null?void 0:w.renditionReports;if(S)for(var x=0;x<S.length;x++){var h=S[x],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(Y.isFiniteNumber)(i))return new U.HlsUrlParameters(i,Object(Y.isFiniteNumber)(c)?c:void 0,U.HlsSkip.No)}}},T.loadPlaylist=function(P){},T.shouldLoadTrack=function(P){return this.canLoad&&P&&!!P.url&&(!P.details||P.details.live)},T.playlistLoaded=function(P,w,S){var x=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(N.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,o=m?0:d;f?(C=s?E+1:u,v=s?o: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(N.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 x.loadPlaylist(c)},z)}else this.clearTimer()},T.getDeliveryDirectives=function(P,w,S,x){var h=Object(U.getSkipValue)(P,S);return w!=null&&w.skip&&P.deltaUpdateFailed&&(S=w.msn,x=w.part,h=U.HlsSkip.No),new U.HlsUrlParameters(S,x,h)},T.retryLoadingOrFail=function(P){var w=this,S=this.hls.config,x=this.retryCount<S.levelLoadingMaxRetry;if(x){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 x},L}()},"./src/controller/base-stream-controller.ts":function(oe,$,D){"use strict";D.r($),D.d($,"State",function(){return E}),D.d($,"default",function(){return d});var Y=D("./src/polyfills/number.ts"),U=D("./src/task-loop.ts"),N=D("./src/controller/fragment-tracker.ts"),K=D("./src/utils/buffer-helper.ts"),I=D("./src/utils/logger.ts"),O=D("./src/events.ts"),L=D("./src/errors.ts"),T=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"),x=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 o=0;o<s.length;o++){var b=s[o];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(f,b.key,b)}}function C(f,s,o){return s&&c(f.prototype,s),o&&c(f,o),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=I.logger.log.bind(I.logger,_+":"),k.warn=I.logger.warn.bind(I.logger,_+":"),k.hls=b,k.fragmentLoader=new x.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 o=s.prototype;return o.doTick=function(){this.onTickEnd()},o.onTickEnd=function(){},o.startLoad=function(g){},o.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},o._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===N.FragmentState.PARTIAL||z===N.FragmentState.OK}return!1},o.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)},o.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()},o.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(Y.isFiniteNumber)(Z)?Z.toFixed(3):Z)+", state: "+z),z===E.ENDED)this.resetLoadingState();else if(_&&!G.len){var B=g.maxFragLookUpTolerance,te=_.start-B,de=_.start+_.duration+B,pe=Z>de;(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()},o.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},o.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)},o.onHandlerDestroying=function(){this.stopLoad(),f.prototype.onHandlerDestroying.call(this)},o.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)},o.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})},o.loadFragment=function(g,_,k){this._loadFragForPlayback(g,_,k)},o._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)})},o.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)},o._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)})},o.fragContextChanged=function(g){var _=this.fragCurrent;return!g||!_||g.level!==_.level||g.sn!==_.sn||g.urlId!==_.urlId},o.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()},o._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 T.ChunkMetadata(k.level,k.sn,k.stats.chunkCount+1,0,H?H.index:-1,!Z);_.flush(G)},o._handleFragmentLoadProgress=function(g){},o._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(Y.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)})},o.doFragPartsLoad=function(g,_,k,H){var z=this;return new Promise(function(Z,G){var B=[],te=function de(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)de(pe+1);else return Z({frag:g,part:_e,partsLoaded:B})}).catch(G)};te(k)})},o.handleFragLoadError=function(g){var _=g.data;return _&&_.details===L.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(_.frag,_.part):this.hls.trigger(O.Events.ERROR,_),null},o._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)},o.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},o.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(_)},o.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)},o.getFwdBufferInfo=function(g,_){var k=this.config,H=this.getLoadPosition();if(!Object(Y.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},o.getMaxBufferLength=function(g){var _=this.config,k;return g?k=Math.max(8*_.maxBufferSize/g,_.maxBufferLength):k=_.maxBufferLength,Math.min(k,_.maxMaxBufferLength)},o.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},o.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 de=G.initialLiveManifestSize;if(Z<de)return this.warn("Not enough fragments to start playback (have: "+Z+", need: "+de+")"),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},o.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 de=te.loaded;!de&&(z||te.independent||Z)&&te.fragment===_&&(H=G),z=de}return H},o.loadedEndOfParts=function(g,_){var k=g[g.length-1];return k&&_>k.start&&k.loaded},o.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},o.getFragmentAtPosition=function(g,_,k){var H=this.config,z=this.fragPrevious,Z=k.fragments,G=k.endSN,B=k.fragmentHint,te=H.maxFragLookUpTolerance,de=!!(H.lowLatencyMode&&k.partList&&B);de&&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===N.FragmentState.BACKTRACKED){pe=null;for(var ve=Ce;Z[ve]&&this.fragmentTracker.getState(Z[ve])===N.FragmentState.BACKTRACKED;)z?pe=Z[ve--]:pe=Z[--ve];pe||(pe=le)}else z&&pe.sn===z.sn&&!de&&(_e&&(pe.sn<G&&this.fragmentTracker.getState(le)!==N.FragmentState.OK?(this.log("SN "+pe.sn+" just loaded, load next one: "+le.sn),pe=le):pe=null))}return pe},o.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))}},o.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=!_,de=g.alignedSliding&&Object(Y.isFiniteNumber)(B);if(te||!de&&!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},o.waitForCdnTuneIn=function(g){var _=3;return g.live&&g.canBlockReload&&g.tuneInGoal>Math.max(g.partHoldBack,g.partTarget*_)},o.setStartPosition=function(g,_){var k=this.startPosition;if(k<_&&(k=-1),k===-1||this.lastCurrentTime===-1){var H=g.startTimeOffset;Object(Y.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},o.getLoadPosition=function(){var g=this.media,_=0;return this.loadedmetadata&&g?_=g.currentTime:this.nextLoadPosition&&(_=this.nextLoadPosition),_},o.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))},o.resetFragmentLoading=function(g){(!this.fragCurrent||!this.fragContextChanged(g))&&(this.state=E.IDLE)},o.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):(I.logger.error(_.details+" reaches max retry, redispatch as fatal ..."),_.fatal=!0,this.hls.stopLoad(),this.state=E.ERROR)},o.afterBufferFlushed=function(g,_,k){if(!g)return;var H=K.BufferHelper.getBuffered(g);this.fragmentTracker.detectEvictedFragments(_,H,k),this.state===E.ENDED&&this.resetLoadingState()},o.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=E.IDLE},o.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},o.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 de=g.elementaryStreams[te];if(de){var pe=de.endPTS-de.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,de.startPTS,de.endPTS,de.startDTS,de.endDTS);return z.hls.trigger(O.Events.LEVEL_PTS_UPDATED,{details:Z,level:k,drift:ye,type:te,frag:g,start:de.startPTS,end:de.endPTS}),!0}return B},!1);G?(this.state=E.PARSED,this.hls.trigger(O.Events.FRAG_PARSED,{frag:g,part:_})):this.resetLoadingState()},o.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,$,D){"use strict";D.r($),D.d($,"default",function(){return w});var Y=D("./src/polyfills/number.ts"),U=D("./src/events.ts"),N=D("./src/utils/logger.ts"),K=D("./src/errors.ts"),I=D("./src/utils/buffer-helper.ts"),O=D("./src/utils/mediasource-helper.ts"),L=D("./src/loader/fragment.ts"),T=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;N.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(){N.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){N.logger.log("[buffer-controller]: Media source ended")},this.hls=h,this._initSourceBuffer(),this.registerListeners()}var x=S.prototype;return x.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},x.destroy=function(){this.unregisterListeners(),this.details=null},x.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)},x.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)},x._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new T.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},x.onManifestParsed=function(l,i){var c=2;(i.audio&&!i.video||!i.altAudio)&&(c=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=c,this.details=null,N.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},x.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}},x.onMediaDetaching=function(){var l=this.media,i=this.mediaSource,c=this._objectUrl;if(i){if(N.logger.log("[buffer-controller]: media source detaching"),i.readyState==="open")try{i.endOfStream()}catch(C){N.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()):N.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)},x.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){N.logger.warn("[buffer-controller]: Failed to reset the "+i+" buffer",C)}}),this._initSourceBuffer()},x.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"),o=(d||E).replace(P,"$1");if(s!==o){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()},x.appendChangeType=function(l,i){var c=this,C=this.operationQueue,v={execute:function(){var u=c.sourceBuffer[l];u&&(N.logger.log("[buffer-controller]: changing "+l+" sourceBuffer type to "+i),u.changeType(i)),C.shiftAndExecuteNext(l)},onStart:function(){},onComplete:function(){},onError:function(u){N.logger.warn("[buffer-controller]: Failed to change "+l+" SourceBuffer type",u)}};C.append(v,l)},x.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,o=s.buffering[E],b=self.performance.now();o.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(o.executeStart=self.performance.now(),H){var G=c.sourceBuffer[E];if(G){var B=d.start-G.timestampOffset;Math.abs(B)>=.1&&(N.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();o.executeEnd=o.end=G,g.first===0&&(g.first=G),_&&_.first===0&&(_.first=G);var B=c.sourceBuffer,te={};for(var de in B)te[de]=I.BufferHelper.getBuffered(B[de]);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){N.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&&(N.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)},x.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){N.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)})},x.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&&N.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+C.type+" level: "+C.level+" sn: "+C.sn),this.blockBuffers(E,m)},x.onFragChanged=function(l,i){this.flushBackBuffer()},x.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,N.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()})},x.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()},x.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(Y.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 o=C[s];if(o){var b=I.BufferHelper.getBuffered(o);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}))}})},x.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(Y.isFiniteNumber)(C.duration)?C.duration:0;l.live&&i.config.liveDurationInfinity?(N.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),C.duration=Infinity,this.updateSeekableRange(l)):(v>u&&v>m||!Object(Y.isFiniteNumber)(m))&&(N.logger.log("[buffer-controller]: Updating Media Source duration to "+v.toFixed(3)),C.duration=v)},x.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)}},x.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)})}},x.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;N.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){N.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})},x._onSBUpdateStart=function(l){var i=this.operationQueue,c=i.current(l);c.onStart()},x._onSBUpdateEnd=function(l){var i=this.operationQueue,c=i.current(l);c.onComplete(),i.shiftAndExecuteNext(l)},x._onSBUpdateError=function(l,i){N.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)},x.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){N.logger.warn("[buffer-controller]: Attempting to remove from the "+l+" SourceBuffer, but it does not exist"),m.shiftAndExecuteNext(l);return}var d=Object(Y.isFiniteNumber)(C.duration)?C.duration:Infinity,f=Object(Y.isFiniteNumber)(v.duration)?v.duration:Infinity,s=Math.max(0,i),o=Math.min(c,d,f);o>s?(N.logger.log("[buffer-controller]: Removing ["+s+","+o+"] from the "+l+" SourceBuffer"),console.assert(!E.updating,l+" sourceBuffer must not be updating"),E.remove(s,o)):m.shiftAndExecuteNext(l)},x.appendExecutor=function(l,i){var c=this.operationQueue,C=this.sourceBuffer,v=C[i];if(!v){N.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)},x.blockBuffers=function(l,i){var c=this;if(i===void 0&&(i=this.getSourceBufferTypes()),!i.length){N.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)})})},x.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},x.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)},x.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,$,D){"use strict";D.r($),D.d($,"default",function(){return U});var Y=D("./src/utils/logger.ts"),U=function(){function N(I){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=I}var K=N.prototype;return K.append=function(O,L){var T=this.queues[L];T.push(O),T.length===1&&this.buffers[L]&&this.executeNext(L)},K.insertAbort=function(O,L){var T=this.queues[L];T.unshift(O),this.executeNext(L)},K.appendBlocker=function(O){var L,T=new Promise(function(P){L=P}),A={execute:L,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(A,O),T},K.executeNext=function(O){var L=this.buffers,T=this.queues,A=L[O],P=T[O];if(P.length){var w=P[0];try{w.execute()}catch(S){Y.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]},N}()},"./src/controller/cap-level-controller.ts":function(oe,$,D){"use strict";D.r($);var Y=D("./src/events.ts");function U(I,O){for(var L=0;L<O.length;L++){var T=O[L];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(I,T.key,T)}}function N(I,O,L){return O&&U(I.prototype,O),L&&U(I,L),I}var K=function(){function I(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=I.prototype;return O.setStreamController=function(T){this.streamController=T},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 T=this.hls;T.on(Y.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),T.on(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),T.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),T.on(Y.Events.BUFFER_CODECS,this.onBufferCodecs,this),T.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},O.unregisterListener=function(){var T=this.hls;T.off(Y.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),T.off(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),T.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),T.off(Y.Events.BUFFER_CODECS,this.onBufferCodecs,this),T.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},O.onFpsDropLevelCapping=function(T,A){I.isLevelAllowed(A.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(A.droppedLevel)},O.onMediaAttaching=function(T,A){this.media=A.media instanceof HTMLVideoElement?A.media:null},O.onManifestParsed=function(T,A){var P=this.hls;this.restrictedLevels=[],this.firstLevel=A.firstLevel,P.config.capLevelToPlayerSize&&A.video&&this.startCapping()},O.onBufferCodecs=function(T,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 T=this.hls.levels;if(T.length){var A=this.hls;A.autoLevelCapping=this.getMaxLevel(T.length-1),A.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=A.autoLevelCapping}}},O.getMaxLevel=function(T){var A=this,P=this.hls.levels;if(!P.length)return-1;var w=P.filter(function(S,x){return I.isLevelAllowed(x,A.restrictedLevels)&&x<=T});return this.clientRect=null,I.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 T=this.media,A={width:0,height:0};if(T){var P=T.getBoundingClientRect();A.width=P.width,A.height=P.height,!A.width&&!A.height&&(A.width=P.right-P.left||T.width||0,A.height=P.bottom-P.top||T.height||0)}return this.clientRect=A,A},I.isLevelAllowed=function(T,A){return A===void 0&&(A=[]),A.indexOf(T)===-1},I.getMaxLevelByMediaSize=function(T,A,P){if(!T||!T.length)return-1;for(var w=function(i,c){return c?i.width!==c.width||i.height!==c.height:!0},S=T.length-1,x=0;x<T.length;x+=1){var h=T[x];if((h.width>=A||h.height>=P)&&w(h,T[x+1])){S=x;break}}return S},N(I,[{key:"mediaWidth",get:function(){return this.getDimensions().width*I.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*I.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var T=1;try{T=self.devicePixelRatio}catch(A){}return T}}]),I}();$.default=K},"./src/controller/cmcd-controller.ts":function(oe,$,D){"use strict";D.r($),D.d($,"default",function(){return w});var Y=D("./src/events.ts"),U=D("./src/types/cmcd.ts"),N=D("./src/utils/buffer-helper.ts"),K=D("./src/utils/logger.ts");function I(S,x){for(var h=0;h<x.length;h++){var l=x[h];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(S,l.key,l)}}function O(S,x,h){return x&&I(S.prototype,x),h&&I(S,h),S}function L(S,x){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=T(S))||x&&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 T(S,x){if(!S)return;if(typeof S=="string")return A(S,x);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,x)}function A(S,x){(x==null||x>S.length)&&(x=S.length);for(var h=0,l=new Array(x);h<x;h++)l[h]=S[h];return l}function P(){return P=Object.assign||function(S){for(var x=1;x<arguments.length;x++){var h=arguments[x];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 x=S.prototype;return x.registerListeners=function(){var l=this.hls;l.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.on(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),l.on(Y.Events.BUFFER_CREATED,this.onBufferCreated,this)},x.unregisterListeners=function(){var l=this.hls;l.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.off(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),l.off(Y.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},x.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},x.onMediaAttached=function(l,i){this.media=i.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},x.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},x.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},x.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}},x.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)}},x.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},x.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},x.getBufferLength=function(l){var i=this.hls.media,c=l===U.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!c||!i)return NaN;var C=N.BufferHelper.bufferInfo(c,i.currentTime,this.config.maxBufferHole);return C.len*1e3},x.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}()},x.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,o=l[s];if(!c(o))continue;if(s==="v"&&o===1)continue;if(s=="pr"&&o===1)continue;var b=u[s];b&&(o=b(o));var g=typeof o,_=void 0;s==="ot"||s==="sf"||s==="st"?_=s+"="+o:g==="boolean"?_=s:g==="number"?_=s+"="+o:_=s+"="+JSON.stringify(o),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 o=S.serialize(v[s]);o&&(c["CMCD-"+C[s]]=o)}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,$,D){"use strict";D.r($);var Y=D("./src/events.ts"),U=D("./src/errors.ts"),N=D("./src/utils/logger.ts"),K=D("./src/utils/mediakeys-helper.ts");function I(w,S){for(var x=0;x<S.length;x++){var h=S[x];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(w,h.key,h)}}function O(w,S,x){return S&&I(w.prototype,S),x&&I(w,x),w}var L=3,T=function(S,x,h){var l={audioCapabilities:[],videoCapabilities:[]};return S.forEach(function(i){l.audioCapabilities.push({contentType:'audio/mp4; codecs="'+i+'"',robustness:h.audioRobustness||""})}),x.forEach(function(i){l.videoCapabilities.push({contentType:'video/mp4; codecs="'+i+'"',robustness:h.videoRobustness||""})}),[l]},A=function(S,x,h,l){switch(S){case K.KeySystems.WIDEVINE:return T(x,h,l);default:throw new Error("Unknown key-system: "+S)}},P=function(){function w(x){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=x,this._config=x.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(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this)},S._unregisterListeners=function(){this.hls.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(Y.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);N.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){N.logger.error('Failed to obtain key-system "'+h+'" access:',m)})},S._onMediaKeySystemAccessObtained=function(h,l){var i=this;N.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,N.logger.log('Media-keys created for key-system "'+h+'"'),i._onMediaKeysCreated(),v});return C.catch(function(v){N.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;N.logger.log("New key-system session "+h.sessionId),h.addEventListener("message",function(i){l._onKeySessionMessage(h,i.message)},!1)},S._onKeySessionMessage=function(h,l){N.logger.log("Got EME message event, creating license request"),this._requestLicense(l,function(i){N.logger.log("Received license data (length: "+(i&&i.byteLength)+"), updating key-session"),h.update(i)})},S.onMediaEncrypted=function(h){var l=this;if(N.logger.log('Media is encrypted using "'+h.initDataType+'" init data type'),!this.mediaKeysPromise){N.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(Y.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){N.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(Y.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}N.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){N.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(Y.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(c.mediaKeysSessionInitialized){N.logger.warn("Key-Session already initialized but requested again");return}var C=c.mediaKeysSession;if(!C){N.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(Y.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!l){N.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(Y.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}N.logger.log('Generating key-session request for "'+h+'" init data type'),c.mediaKeysSessionInitialized=!0,C.generateRequest(h,l).then(function(){N.logger.debug("Key-session generation succeeded")}).catch(function(v){N.logger.error("Error generating key-session request:",v),i.hls.trigger(Y.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){N.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,N.logger.log("License request succeeded");var C=h.response,v=this._licenseResponseCallback;if(v)try{C=v.call(this.hls,h,l)}catch(u){N.logger.error(u)}c(C)}else{if(N.logger.error("License Request XHR failed ("+l+"). Status: "+h.status+" ("+h.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>L){this.hls.trigger(Y.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;N.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){N.logger.log("Requesting content license for key-system");var i=this._mediaKeysList[0];if(!i){N.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(Y.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);N.logger.log("Sending license request to URL: "+c);var v=this._generateLicenseRequestChallenge(i,h);C.send(v)}catch(m){N.logger.error("Failure requesting DRM license: "+m),this.hls.trigger(Y.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}();$.default=P},"./src/controller/fps-controller.ts":function(oe,$,D){"use strict";D.r($);var Y=D("./src/events.ts"),U=D("./src/utils/logger.ts"),N=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 I=K.prototype;return I.setStreamController=function(L){this.streamController=L},I.registerListeners=function(){this.hls.on(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},I.unregisterListeners=function(){this.hls.off(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching)},I.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},I.onMediaAttaching=function(L,T){var A=this.hls.config;if(A.capLevelOnFPSDrop){var P=T.media instanceof self.HTMLVideoElement?T.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)}},I.checkFPS=function(L,T,A){var P=performance.now();if(T){if(this.lastTime){var w=P-this.lastTime,S=A-this.lastDroppedFrames,x=T-this.lastDecodedFrames,h=1e3*S/w,l=this.hls;if(l.trigger(Y.Events.FPS_DROP,{currentDropped:S,currentDecoded:x,totalDroppedFrames:A}),h>0&&S>l.config.fpsDroppedMonitoringThreshold*x){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(Y.Events.FPS_DROP_LEVEL_CAPPING,{level:i,droppedLevel:l.currentLevel}),l.autoLevelCapping=i,this.streamController.nextLevelSwitch())}}this.lastTime=P,this.lastDroppedFrames=A,this.lastDecodedFrames=T}},I.checkFPSInterval=function(){var L=this.media;if(L)if(this.isVideoPlaybackQualityAvailable){var T=L.getVideoPlaybackQuality();this.checkFPS(L,T.totalVideoFrames,T.droppedVideoFrames)}else this.checkFPS(L,L.webkitDecodedFrameCount,L.webkitDroppedFrameCount)},K}();$.default=N},"./src/controller/fragment-finders.ts":function(oe,$,D){"use strict";D.r($),D.d($,"findFragmentByPDT",function(){return N}),D.d($,"findFragmentByPTS",function(){return K}),D.d($,"fragmentWithinToleranceTest",function(){return I}),D.d($,"pdtWithinToleranceTest",function(){return O}),D.d($,"findFragWithCC",function(){return L});var Y=D("./src/polyfills/number.ts"),U=D("./src/utils/binary-search.ts");function N(T,A,P){if(A===null||!Array.isArray(T)||!T.length||!Object(Y.isFiniteNumber)(A))return null;var w=T[0].programDateTime;if(A<(w||0))return null;var S=T[T.length-1].endProgramDateTime;if(A>=(S||0))return null;P=P||0;for(var x=0;x<T.length;++x){var h=T[x];if(O(A,P,h))return h}return null}function K(T,A,P,w){P===void 0&&(P=0),w===void 0&&(w=0);var S=null;if(T?S=A[T.sn-A[0].sn+1]||null:P===0&&A[0].start===0&&(S=A[0]),S&&I(P,w,S)===0)return S;var x=U.default.search(A,I.bind(null,P,w));return x||S}function I(T,A,P){T===void 0&&(T=0),A===void 0&&(A=0);var w=Math.min(A,P.duration+(P.deltaPTS?P.deltaPTS:0));return P.start+P.duration-w<=T?1:P.start-w>T&&P.start?-1:0}function O(T,A,P){var w=Math.min(A,P.duration+(P.deltaPTS?P.deltaPTS:0))*1e3,S=P.endProgramDateTime||0;return S-w>T}function L(T,A){return U.default.search(T,function(P){return P.cc<A?1:P.cc>A?-1:0})}},"./src/controller/fragment-tracker.ts":function(oe,$,D){"use strict";D.r($),D.d($,"FragmentState",function(){return N}),D.d($,"FragmentTracker",function(){return K});var Y=D("./src/events.ts"),U=D("./src/types/loader.ts"),N;(function(L){L.NOT_LOADED="NOT_LOADED",L.BACKTRACKED="BACKTRACKED",L.APPENDING="APPENDING",L.PARTIAL="PARTIAL",L.OK="OK"})(N||(N={}));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 T=L.prototype;return T._registerListeners=function(){var P=this.hls;P.on(Y.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.on(Y.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.on(Y.Events.FRAG_LOADED,this.onFragLoaded,this)},T._unregisterListeners=function(){var P=this.hls;P.off(Y.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.off(Y.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.off(Y.Events.FRAG_LOADED,this.onFragLoaded,this)},T.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},T.getAppendedFrag=function(P,w){if(w===U.PlaylistLevelType.MAIN){var S=this.activeFragment,x=this.activeParts;if(!S)return null;if(x)for(var h=x.length;h--;){var l=x[h],i=l?l.end:S.appendedPTS;if(l.start<=P&&i!==void 0&&P<=i)return h>9&&(this.activeParts=x.slice(h-9)),l}else if(S.start<=P&&S.appendedPTS!==void 0&&P<=S.appendedPTS)return S}return this.getBufferedFrag(P,w)},T.getBufferedFrag=function(P,w){for(var S=this.fragments,x=Object.keys(S),h=x.length;h--;){var l=S[x[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},T.detectEvictedFragments=function(P,w,S){var x=this;Object.keys(this.fragments).forEach(function(h){var l=x.fragments[h];if(!l)return;if(!l.buffered){l.body.type===S&&x.removeFragment(l.body);return}var i=l.range[P];if(!i)return;i.time.some(function(c){var C=!x.isTimeBuffered(c.startPTS,c.endPTS,w);return C&&x.removeFragment(l.body),C})})},T.detectPartialFragments=function(P){var w=this,S=this.timeRanges,x=P.frag,h=P.part;if(!S||x.sn==="initSegment")return;var l=O(x),i=this.fragments[l];if(!i)return;Object.keys(S).forEach(function(c){var C=x.elementaryStreams[c];if(!C)return;var v=S[c],m=h!==null||C.partial===!0;i.range[c]=w.getBufferedTimes(x,h,m,v)}),i.backtrack=i.loaded=null,Object.keys(i.range).length?i.buffered=!0:this.removeFragment(i.body)},T.fragBuffered=function(P){var w=O(P),S=this.fragments[w];S&&(S.backtrack=S.loaded=null,S.buffered=!0)},T.getBufferedTimes=function(P,w,S,x){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<x.length;v++){var m=x.start(v)-this.bufferPadding,u=x.end(v)+this.bufferPadding;if(C>=m&&c<=u){h.time.push({startPTS:Math.max(l,x.start(v)),endPTS:Math.min(i,x.end(v))});break}else if(l<u&&i>m)h.partial=!0,h.time.push({startPTS:Math.max(l,x.start(v)),endPTS:Math.min(i,x.end(v))});else if(i<=m)break}return h},T.getPartialFragment=function(P){var w=null,S,x,h,l=0,i=this.bufferPadding,c=this.fragments;return Object.keys(c).forEach(function(C){var v=c[C];if(!v)return;I(v)&&(x=v.body.start-i,h=v.body.end+i,P>=x&&P<=h&&(S=Math.min(P-x,h-P),l<=S&&(w=v.body,l=S)))}),w},T.getState=function(P){var w=O(P),S=this.fragments[w];return S?S.buffered?I(S)?N.PARTIAL:N.OK:S.backtrack?N.BACKTRACKED:N.APPENDING:N.NOT_LOADED},T.backtrack=function(P,w){var S=O(P),x=this.fragments[S];if(!x||x.backtrack)return null;var h=x.backtrack=w||x.loaded;return x.loaded=null,h},T.getBacktrackData=function(P){var w=O(P),S=this.fragments[w];if(S){var x,h=S.backtrack;if(h!=null&&(x=h.payload)!==null&&x!==void 0&&x.byteLength)return h;this.removeFragment(P)}return null},T.isTimeBuffered=function(P,w,S){for(var x,h,l=0;l<S.length;l++){if(x=S.start(l)-this.bufferPadding,h=S.end(l)+this.bufferPadding,P>=x&&w<=h)return!0;if(w<=x)return!1}return!1},T.onFragLoaded=function(P,w){var S=w.frag,x=w.part;if(S.sn==="initSegment"||S.bitrateTest||x)return;var h=O(S);this.fragments[h]={body:S,loaded:w,backtrack:null,buffered:!1,range:Object.create(null)}},T.onBufferAppended=function(P,w){var S=this,x=w.frag,h=w.part,l=w.timeRanges;if(x.type===U.PlaylistLevelType.MAIN)if(this.activeFragment=x,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++)x.appendedPTS=Math.max(C.end(v),x.appendedPTS||0)})},T.onFragBuffered=function(P,w){this.detectPartialFragments(w)},T.hasFragment=function(P){var w=O(P);return!!this.fragments[w]},T.removeFragmentsInRange=function(P,w,S){var x=this;Object.keys(this.fragments).forEach(function(h){var l=x.fragments[h];if(!l)return;if(l.buffered){var i=l.body;i.type===S&&i.start<w&&i.end>P&&x.removeFragment(i)}})},T.removeFragment=function(P){var w=O(P);P.stats.loaded=0,P.clearElementaryStreamInfo(),delete this.fragments[w]},T.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},L}();function I(L){var T,A;return L.buffered&&(((T=L.range.video)===null||T===void 0?void 0:T.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,$,D){"use strict";D.r($),D.d($,"STALL_MINIMUM_DURATION_MS",function(){return I}),D.d($,"MAX_START_GAP_JUMP",function(){return O}),D.d($,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return L}),D.d($,"SKIP_BUFFER_RANGE_START",function(){return T}),D.d($,"default",function(){return A});var Y=D("./src/utils/buffer-helper.ts"),U=D("./src/errors.ts"),N=D("./src/events.ts"),K=D("./src/utils/logger.ts"),I=250,O=2,L=.1,T=.05,A=function(){function P(S,x,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=x,this.fragmentTracker=h,this.hls=l}var w=P.prototype;return w.destroy=function(){this.hls=this.fragmentTracker=this.media=null},w.poll=function(x){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!==x){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||!Y.BufferHelper.getBuffered(l).length)return;var E=Y.BufferHelper.bufferInfo(l,c,0),d=E.len>0,f=E.nextStart||0;if(!d&&!f)return;if(C){var s=E.len>O,o=!f||f-c>O&&!this.fragmentTracker.getPartialFragment(c);if(s||o)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>=I&&this._reportStall(E.len);var G=Y.BufferHelper.bufferInfo(l,c,h.maxBufferHole);this._tryFixBufferStall(G,Z)},w._tryFixBufferStall=function(x,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}x.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(x){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="+x+")"),h.trigger(N.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:x}))},w._trySkipBufferHole=function(x){for(var h=this.config,l=this.hls,i=this.media,c=i.currentTime,C=0,v=Y.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+T,i.currentTime+L);return K.logger.warn("skipping hole, adjusting currentTime from "+c+" to "+E),this.moved=!0,this.stalled=null,i.currentTime=E,x&&l.trigger(N.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:x}),E}C=v.end(m)}return 0},w._tryNudgeBuffer=function(){var x=this.config,h=this.hls,l=this.media,i=l.currentTime,c=(this.nudgeRetry||0)+1;if(this.nudgeRetry=c,c<x.nudgeMaxRetry){var C=i+c*x.nudgeOffset;K.logger.warn("Nudging 'currentTime' from "+i+" to "+C),l.currentTime=C,h.trigger(N.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 "+x.nudgeMaxRetry+" nudges"),h.trigger(N.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},P}()},"./src/controller/id3-track-controller.ts":function(oe,$,D){"use strict";D.r($);var Y=D("./src/events.ts"),U=D("./src/utils/texttrack-utils.ts"),N=D("./src/demux/id3.ts"),K=.25,I=function(){function O(T){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=T,this._registerListeners()}var L=O.prototype;return L.destroy=function(){this._unregisterListeners()},L._registerListeners=function(){var A=this.hls;A.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.on(Y.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.on(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},L._unregisterListeners=function(){var A=this.hls;A.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.off(Y.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.off(Y.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 x=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,h=0;h<S.length;h++){var l=N.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(!N.isTimeStampFrame(m)){var u=new x(i,c,"");u.value=m,this.id3Track.addCue(u)}}}}},L.onBufferFlushing=function(A,P){var w=P.startOffset,S=P.endOffset,x=P.type;if(!x||x==="audio"){var h=this.id3Track;h&&Object(U.removeCuesInRange)(h,w,S)}},O}();$.default=I},"./src/controller/latency-controller.ts":function(oe,$,D){"use strict";D.r($),D.d($,"default",function(){return O});var Y=D("./src/errors.ts"),U=D("./src/events.ts"),N=D("./src/utils/logger.ts");function K(L,T){for(var A=0;A<T.length;A++){var P=T[A];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(L,P.key,P)}}function I(L,T,A){return T&&K(L.prototype,T),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 T=L.prototype;return T.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},T.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)},T.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)},T.onMediaAttached=function(P,w){this.media=w.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},T.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},T.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},T.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)},T.onError=function(P,w){if(w.details!==Y.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,N.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},T.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 x=this.config,h=x.lowLatencyMode,l=x.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)},T.estimateLiveEdge=function(){var P=this.levelDetails;return P===null?null:P.edge+P.age},T.computeLatency=function(){var P=this.estimateLiveEdge();return P===null?null:P-this.currentTime},I(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,x=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*x);var m=x,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 x=S.edge,h=P-w-this.edgeStalled,l=x-S.totalduration,i=x-(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,$,D){"use strict";D.r($),D.d($,"default",function(){return h});var Y=D("./src/types/level.ts"),U=D("./src/events.ts"),N=D("./src/errors.ts"),K=D("./src/utils/codecs.ts"),I=D("./src/controller/level-helper.ts"),O=D("./src/controller/base-playlist-controller.ts"),L=D("./src/types/loader.ts");function T(){return T=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},T.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 x=/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={},o,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,x&&Z.audioCodec&&Z.audioCodec.indexOf("mp4a.40.34")!==-1&&(Z.audioCodec=void 0);var B=Z.bitrate+"-"+Z.attrs.RESOLUTION+"-"+Z.attrs.CODECS;o=s[B],o?o.url.push(Z.url):(o=new Y.Level(Z),s[B]=o,u.push(o)),G&&(G.AUDIO&&Object(I.addGroupId)(o,"audio",G.AUDIO),G.SUBTITLES&&Object(I.addGroupId)(o,"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(I.assignTrackIdsByGroup)(E)),m.subtitles&&(d=m.subtitles,Object(I.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:N.ErrorTypes.MEDIA_ERROR,details:N.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 N.ErrorDetails.FRAG_LOAD_ERROR:case N.ErrorDetails.FRAG_LOAD_TIMEOUT:case N.ErrorDetails.KEY_LOAD_ERROR:case N.ErrorDetails.KEY_LOAD_TIMEOUT:if(m.frag){var o=this._levels[m.frag.level];o?(o.fragmentError++,o.fragmentError>this.hls.config.fragLoadingMaxRetry&&(s=m.frag.level)):s=m.frag.level}break;case N.ErrorDetails.LEVEL_LOAD_ERROR:case N.ErrorDetails.LEVEL_LOAD_TIMEOUT:u&&(u.deliveryDirectives&&(f=!1),s=u.level),d=!0;break;case N.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 o=f.url.length;if(o>1&&f.loadError<o)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(o){o.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:N.ErrorTypes.OTHER_ERROR,details:N.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 o=T({},s,{level:v,maxBitrate:s.maxBitrate,uri:s.uri,urlId:s.urlId});delete o._urlId,this.hls.trigger(U.Events.LEVEL_SWITCHING,o);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,$,D){"use strict";D.r($),D.d($,"addGroupId",function(){return N}),D.d($,"assignTrackIdsByGroup",function(){return K}),D.d($,"updatePTS",function(){return I}),D.d($,"updateFragPTSDTS",function(){return L}),D.d($,"mergeDetails",function(){return T}),D.d($,"mapPartIntersection",function(){return A}),D.d($,"mapFragmentIntersection",function(){return P}),D.d($,"adjustSliding",function(){return w}),D.d($,"addSliding",function(){return S}),D.d($,"computeReloadInterval",function(){return x}),D.d($,"getFragmentWithSN",function(){return h}),D.d($,"getPartWith",function(){return l});var Y=D("./src/polyfills/number.ts"),U=D("./src/utils/logger.ts");function N(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 I(i,c,C){var v=i[c],m=i[C];O(v,m)}function O(i,c){var C=c.startPTS;if(Object(Y.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,o=c.endPTS;if(Object(Y.isFiniteNumber)(s)){var b=Math.abs(s-C);Object(Y.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,o),v=Math.max(v,o),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 T(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(Y.isFiniteNumber)(k.startPTS)&&Object(Y.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 o=c.fragments;if(E){U.logger.warn("discontinuity sliding from playlist, take drift into account");for(var b=0;b<o.length;b++)o[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),o.length&&(c.totalduration=c.edge-o[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 o=f[E+s],b=d[s];v&&!b&&s<v&&(b=c.fragments[s]=o),o&&b&&C(o,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 x(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,$,D){"use strict";D.r($),D.d($,"default",function(){return v});var Y=D("./src/polyfills/number.ts"),U=D("./src/controller/base-stream-controller.ts"),N=D("./src/is-supported.ts"),K=D("./src/events.ts"),I=D("./src/utils/buffer-helper.ts"),O=D("./src/controller/fragment-tracker.ts"),L=D("./src/types/loader.ts"),T=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"),x=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,o=this.hls;if(this.stopLoad(),this.setInterval(C),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var b=o.startLevel;b===-1&&(o.config.testBandwidth?(b=0,this.bitrateTest=!0):b=o.nextAutoLevel),this.level=o.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,o=this.level,b=s==null||((f=s[o])===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,o=this.hls,b=this.levelLastLoaded,g=this.levels,_=this.media,k=o.config,H=o.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=o.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 de={};this.altAudio&&(de.type="video"),this.hls.trigger(K.Events.BUFFER_EOS,de),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?T.ElementaryStreamTypes.AUDIO:T.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,o){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,o)):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 o,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?o=this.fragCurrent.duration*_.maxBitrate/(1e3*k)+1:o=0}else o=0;var H=this.getBufferedFrag(s.currentTime+o);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 o=s.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),o.addEventListener("playing",this.onvplaying),o.addEventListener("seeked",this.onvseeked),this.gapController=new w.default(this.config,o,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(Y.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 o=!1,b=!1,g;s.levels.forEach(function(_){g=_.audioCodec,g&&(g.indexOf("mp4a.40.2")!==-1&&(o=!0),g.indexOf("mp4a.40.5")!==-1&&(b=!0))}),this.audioCodecSwitch=o&&b&&!Object(N.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 o=this.levels;if(!o||this.state!==U.State.IDLE)return;var b=o[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 o,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||(o=z.details)!==null&&o!==void 0&&o.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,o=f.frag,b=f.part,g=f.payload,_=this.levels;if(!_){this.warn("Levels were reset while fragment load was in progress. Fragment "+o.sn+" of level "+o.level+" will not be buffered");return}var k=_[o.level],H=k.details;if(!H){this.warn("Dropping fragment "+o.sn+" of level "+o.level+" after level details were reset");return}var z=k.videoCodec,Z=H.PTSKnown||!H.live,G=(s=o.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)),de=b?b.index:-1,pe=de!==-1,ye=new P.ChunkMetadata(o.level,o.sn,o.stats.chunkCount,g.byteLength,de,pe),Ce=this.initPTS[o.cc];te.push(g,G,B,z,o,b,H.totalduration,Z,ye,Ce)},E.onAudioTrackSwitching=function(f,s){var o=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;o&&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 o=s.id,b=!!this.hls.audioTracks[o].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 o=s.tracks,b,g,_=!1;for(var k in o){var H=o[k];if(H.id==="main"){if(g=k,b=H,k==="video"){var z=o[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 o=s.frag,b=s.part;if(o&&o.type!==L.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(o)){this.warn("Fragment "+o.sn+(b?" p: "+b.index:"")+" of level "+o.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:o.stats;this.fragLastKbps=Math.round(8*g.total/(g.buffering.end-g.loading.first)),o.sn!=="initSegment"&&(this.fragPrevious=o),this.fragBufferedComplete(o,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 o=!0,b=this.getFwdBufferInfo(this.media,L.PlaylistLevelType.MAIN);b&&b.len>.5&&(o=!this.reduceMaxBufferLength(b.len)),o&&(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 o=I.BufferHelper.getBuffered(f);!this.loadedmetadata&&o.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 o=s.type;if(o!==T.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var b=(o===T.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(b,o,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,o=this.startPosition;if(o>=0&&s<o){if(f.seeking){x.logger.log("could not seek to "+o+", already seeking at "+s);return}var b=I.BufferHelper.getBuffered(f),g=b.length?b.start(0):0,_=g-o;_>0&&(_<this.config.maxBufferHole||_<this.config.maxFragLookUpTolerance)&&(x.logger.log("adjusting start position by "+_+" to match buffer start"),o+=_,this.startPosition=o),this.log("seek to target start position "+o+" from current time "+s),f.currentTime=o}},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(o){var b=s.hls;if(!o||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,o)})},E._handleTransmuxComplete=function(f){var s,o="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,de=g.initSegment,pe=this.altAudio?void 0:g.audio;if(this.fragContextChanged(H))return;if(this.state=U.State.PARSING,de){de.tracks&&(this._bufferInitSegment(Z,de.tracks,H,_),b.trigger(K.Events.FRAG_PARSING_INIT_SEGMENT,{frag:H,id:o,tracks:de.tracks}));var ye=de.initPTS,Ce=de.timescale;Object(Y.isFiniteNumber)(ye)&&(this.initPTS[H.cc]=ye,b.trigger(K.Events.INIT_PTS_FOUND,{frag:H,id:o,initPTS:ye,timescale:Ce}))}if(G&&g.independent!==!1){if(Z.details){var _e=G.startPTS,le=G.endPTS,se=G.startDTS,ve=G.endDTS;if(z)z.elementaryStreams[G.type]={startPTS:_e,endPTS:le,startDTS:se,endDTS:ve};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,ve,!0)}H.setElementaryStreamInfo(G.type,_e,le,se,ve),this.bufferFragmentData(G,H,z,_)}}else if(g.independent===!1){this.backtrack(H);return}if(pe){var q=pe.startPTS,xe=pe.endPTS,Ie=pe.startDTS,Ne=pe.endDTS;z&&(z.elementaryStreams[T.ElementaryStreamTypes.AUDIO]={startPTS:q,endPTS:xe,startDTS:Ie,endDTS:Ne}),H.setElementaryStreamInfo(T.ElementaryStreamTypes.AUDIO,q,xe,Ie,Ne),this.bufferFragmentData(pe,H,z,_)}if(te!=null&&(s=te.samples)!==null&&s!==void 0&&s.length){var De={frag:H,id:o,samples:te.samples};b.trigger(K.Events.FRAG_PARSING_METADATA,De)}if(B){var Be={frag:H,id:o,samples:B.samples};b.trigger(K.Events.FRAG_PARSING_USERDATA,Be)}},E._bufferInitSegment=function(f,s,o,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:o,part:null,chunkMeta:b,parent:o.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 o=f.currentTime;if(I.BufferHelper.isBuffered(f,o)?s=this.getAppendedFrag(o):I.BufferHelper.isBuffered(f,o+.1)&&(s=this.getAppendedFrag(o+.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,$,D){"use strict";D.r($),D.d($,"SubtitleStreamController",function(){return i});var Y=D("./src/events.ts"),U=D("./src/utils/logger.ts"),N=D("./src/utils/buffer-helper.ts"),K=D("./src/controller/fragment-finders.ts"),I=D("./src/utils/discontinuities.ts"),O=D("./src/controller/level-helper.ts"),L=D("./src/controller/fragment-tracker.ts"),T=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 x(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){x(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(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(Y.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(Y.Events.ERROR,this.onError,this),u.on(Y.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.on(Y.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),u.on(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),u.on(Y.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),u.on(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},v._unregisterListeners=function(){var u=this.hls;u.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(Y.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(Y.Events.ERROR,this.onError,this),u.off(Y.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.off(Y.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),u.off(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),u.off(Y.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),u.off(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},v.startLoad=function(){this.stopLoad(),this.state=T.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=T.State.IDLE,!f)return;var s=this.tracksBuffered[this.currentTrackId];if(!s)return;for(var o,b=d.start,g=0;g<s.length;g++)if(b>=s[g].start&&b<=s[g].end){o=s[g];break}var _=d.start+d.duration;o?o.end=_:(o={start:b,end:_},s.push(o)),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,o=this.levels;if(!o.length||!o[s]||!o[s].details)return;var b=o[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=T.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,o=this.currentTrackId,b=this.levels;if(!b.length)return;var g=b[o];if(s>=b.length||s!==o||!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(I.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===T.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 o=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(d),f.key.buffer,f.iv.buffer).then(function(b){var g=performance.now();s.trigger(Y.Events.FRAG_DECRYPTED,{frag:E,payload:b,stats:{tstart:o,tdecrypt:g}})})}},v.doTick=function(){if(!this.media){this.state=T.State.IDLE;return}if(this.state===T.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,o=this.config,b=this.media,g=N.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,b.currentTime-s,o.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 de=o.maxFragLookUpTolerance;te&&f.hasProgramDateTime&&(B=Object(K.findFragmentByPDT)(z,te.endProgramDateTime,de)),B||(B=Object(K.findFragmentByPTS)(te,z,_,de),!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=T.State.KEY_LOADING,this.hls.trigger(Y.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}(T.default)},"./src/controller/subtitle-track-controller.ts":function(oe,$,D){"use strict";D.r($);var Y=D("./src/events.ts"),U=D("./src/utils/texttrack-utils.ts"),N=D("./src/controller/base-playlist-controller.ts"),K=D("./src/types/loader.ts");function I(w,S){for(var x=0;x<S.length;x++){var h=S[x];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(w,h.key,h)}}function O(w,S,x){return S&&I(w.prototype,S),x&&I(w,x),w}function L(w,S){w.prototype=Object.create(S.prototype),w.prototype.constructor=w,T(w,S)}function T(w,S){return T=Object.setPrototypeOf||function(h,l){return h.__proto__=l,h},T(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 x=S.prototype;return x.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,w.prototype.destroy.call(this)},x.registerListeners=function(){var l=this.hls;l.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.on(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),l.on(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.on(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),l.on(Y.Events.ERROR,this.onError,this)},x.unregisterListeners=function(){var l=this.hls;l.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.off(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),l.off(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.off(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),l.off(Y.Events.ERROR,this.onError,this)},x.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)},x.pollTrackChange=function(l){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,l)},x.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},x.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},x.onManifestParsed=function(l,i){this.tracks=i.subtitleTracks},x.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))},x.onLevelLoading=function(l,i){this.switchLevel(i.level)},x.onLevelSwitching=function(l,i){this.switchLevel(i.level)},x.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(Y.Events.SUBTITLE_TRACKS_UPDATED,u),m!==-1&&this.setSubtitleTrack(m,C)}},x.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},x.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)},x.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(Y.Events.SUBTITLE_TRACK_LOADING,{url:v,id:c,groupId:C,deliveryDirectives:l||null})}},x.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")},x.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(Y.Events.SUBTITLE_TRACK_SWITCH,{id:m,groupId:E,name:d,type:f,url:s});var o=this.switchParams(v.url,i==null?void 0:i.details);this.loadPlaylist(o)}else this.hls.trigger(Y.Events.SUBTITLE_TRACK_SWITCH,{id:l})},x.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}(N.default);function P(w){for(var S=[],x=0;x<w.length;x++){var h=w[x];h.kind==="subtitles"&&h.label&&S.push(w[x])}return S}$.default=A},"./src/controller/timeline-controller.ts":function(oe,$,D){"use strict";D.r($),D.d($,"TimelineController",function(){return P});var Y=D("./src/polyfills/number.ts"),U=D("./src/events.ts"),N=D("./src/utils/cea-608-parser.ts"),K=D("./src/utils/output-filter.ts"),I=D("./src/utils/webvtt-parser.ts"),O=D("./src/utils/texttrack-utils.ts"),L=D("./src/utils/imsc1-ttml-parser.ts"),T=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=x(),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 N.default(1,c,C),this.cea608Parser2=new N.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 o=this.captionsTracks[c];this.Cues.newCue(o,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=x(),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,o){var b;if(o<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===T.PlaylistLevelType.MAIN){var d,f,s=C.frag.sn,o=(d=C==null||((f=C.part)===null||f===void 0)?void 0:f.index)!=null?d:-1;s===u+1||s===u&&o===E+1||(v.reset(),m.reset()),this.lastSn=s,this.lastPartIndex=o}},l.onFragLoaded=function(c,C){var v=C.frag,m=C.payload,u=this.initPTS,E=this.unparsedVttFrags;if(v.type===T.PlaylistLevelType.SUBTITLE)if(m.byteLength){if(!Object(Y.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(I.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===T.PlaylistLevelType.SUBTITLE){if(!Object(Y.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(o){return Object(O.removeCuesInRange)(f[o],v,m)})}if(this.config.renderTextTracksNatively&&(v===0&&u!==void 0)){var s=this.textTracks;Object.keys(s).forEach(function(o){return Object(O.removeCuesInRange)(s[o],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,o=3&E;if(d===0&&f===0)continue;s&&((o===0||o===1)&&(m[o].push(d),m[o].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 x(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(oe,$,D){"use strict";D.r($),D.d($,"default",function(){return Y});var Y=function(){function U(K,I){this.subtle=void 0,this.aesIV=void 0,this.subtle=K,this.aesIV=I}var N=U.prototype;return N.decrypt=function(I,O){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},O,I)},U}()},"./src/crypt/aes-decryptor.ts":function(oe,$,D){"use strict";D.r($),D.d($,"removePadding",function(){return U}),D.d($,"default",function(){return N});var Y=D("./src/utils/typed-array.ts");function U(K){var I=K.byteLength,O=I&&new DataView(K.buffer).getUint8(I-1);return O?Object(Y.sliceUint8)(K,0,I-O):K}var N=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 I=K.prototype;return I.uint8ArrayToUint32Array_=function(L){for(var T=new DataView(L),A=new Uint32Array(4),P=0;P<4;P++)A[P]=T.getUint32(P*4);return A},I.initTable=function(){var L=this.sBox,T=this.invSBox,A=this.subMix,P=A[0],w=A[1],S=A[2],x=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,T[d]=m;var f=v[m],s=v[f],o=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,x[m]=b,b=o*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[o^f]]],u^=v[v[u]]):m=u=1}},I.expandKey=function(L){for(var T=this.uint8ArrayToUint32Array_(L),A=!0,P=0;P<T.length&&A;)A=T[P]===this.key[P],P++;if(A)return;this.key=T;var w=this.keySize=T.length;if(w!==4&&w!==6&&w!==8)throw new Error("Invalid aes key size="+w);var S=this.ksRows=(w+6+1)*4,x,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(x=0;x<S;x++){if(x<w){f=l[x]=T[x];continue}s=f,x%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[x/w|0]<<24):w>6&&x%w===4&&(s=c[s>>>24]<<24|c[s>>>16&255]<<16|c[s>>>8&255]<<8|c[s&255]),l[x]=f=(l[x-w]^s)>>>0}for(h=0;h<S;h++)x=S-h,h&3?s=l[x]:s=l[x-4],h<4||x<=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},I.networkToHostOrderSwap=function(L){return L<<24|(L&65280)<<8|(L&16711680)>>8|L>>>24},I.decrypt=function(L,T,A){for(var P=this.keySize+6,w=this.invKeySchedule,S=this.invSBox,x=this.invSubMix,h=x[0],l=x[1],i=x[2],c=x[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,o,b,g,_,k,H,z,Z,G,B,te,de,pe,ye=this.networkToHostOrderSwap;T<d.length;){for(Z=ye(d[T]),G=ye(d[T+1]),B=ye(d[T+2]),te=ye(d[T+3]),_=Z^w[0],k=te^w[1],H=B^w[2],z=G^w[3],de=4,pe=1;pe<P;pe++)s=h[_>>>24]^l[k>>16&255]^i[H>>8&255]^c[z&255]^w[de],o=h[k>>>24]^l[H>>16&255]^i[z>>8&255]^c[_&255]^w[de+1],b=h[H>>>24]^l[z>>16&255]^i[_>>8&255]^c[k&255]^w[de+2],g=h[z>>>24]^l[_>>16&255]^i[k>>8&255]^c[H&255]^w[de+3],_=s,k=o,H=b,z=g,de=de+4;s=S[_>>>24]<<24^S[k>>16&255]<<16^S[H>>8&255]<<8^S[z&255]^w[de],o=S[k>>>24]<<24^S[H>>16&255]<<16^S[z>>8&255]<<8^S[_&255]^w[de+1],b=S[H>>>24]<<24^S[z>>16&255]<<16^S[_>>8&255]<<8^S[k&255]^w[de+2],g=S[z>>>24]<<24^S[_>>16&255]<<16^S[k>>8&255]<<8^S[H&255]^w[de+3],f[T]=ye(s^v),f[T+1]=ye(g^m),f[T+2]=ye(b^u),f[T+3]=ye(o^E),v=Z,m=G,u=B,E=te,T=T+4}return f.buffer},K}()},"./src/crypt/decrypter.ts":function(oe,$,D){"use strict";D.r($),D.d($,"default",function(){return T});var Y=D("./src/crypt/aes-crypto.ts"),U=D("./src/crypt/fast-aes-key.ts"),N=D("./src/crypt/aes-decryptor.ts"),K=D("./src/utils/logger.ts"),I=D("./src/utils/mp4-tools.ts"),O=D("./src/utils/typed-array.ts"),L=16,T=function(){function A(w,S,x){var h=x===void 0?{}:x,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 x=new Uint8Array(S);return this.reset(),this.removePKCS7Padding?Object(N.removePadding)(x):x},P.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},P.decrypt=function(S,x,h,l){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(S),x,h);var i=this.flush();i&&l(i.buffer)}else this.webCryptoDecrypt(new Uint8Array(S),x,h).then(l)},P.softwareDecrypt=function(S,x,h){var l=this.currentIV,i=this.currentResult,c=this.remainderData;this.logOnce("JS AES decrypt"),c&&(S=Object(I.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 N.default),v.expandKey(x);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,x,h){var l=this,i=this.subtle;return(this.key!==x||!this.fastAesKey)&&(this.key=x,this.fastAesKey=new U.default(i,x)),this.fastAesKey.expandKey().then(function(c){if(!i)return Promise.reject(new Error("web crypto not initialized"));var C=new Y.default(i,h);return C.decrypt(S.buffer,c)}).catch(function(c){return l.onWebCryptoError(c,S,x,h)})},P.onWebCryptoError=function(S,x,h,l){return K.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",S),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(x,h,l)},P.getValidChunk=function(S){var x=S,h=S.length-S.length%L;return h!==S.length&&(x=Object(O.sliceUint8)(S,0,h),this.remainderData=Object(O.sliceUint8)(S,h)),x},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,$,D){"use strict";D.r($),D.d($,"default",function(){return Y});var Y=function(){function U(K,I){this.subtle=void 0,this.key=void 0,this.subtle=K,this.key=I}var N=U.prototype;return N.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},U}()},"./src/demux/aacdemuxer.ts":function(oe,$,D){"use strict";D.r($);var Y=D("./src/demux/base-audio-demuxer.ts"),U=D("./src/demux/adts.ts"),N=D("./src/utils/logger.ts"),K=D("./src/demux/id3.ts");function I(T,A){T.prototype=Object.create(A.prototype),T.prototype.constructor=T,O(T,A)}function O(T,A){return O=Object.setPrototypeOf||function(w,S){return w.__proto__=S,w},O(T,A)}var L=function(T){I(A,T);function A(w,S){var x;return x=T.call(this)||this,x.observer=void 0,x.config=void 0,x.observer=w,x.config=S,x}var P=A.prototype;return P.resetInitSegment=function(S,x,h){T.prototype.resetInitSegment.call(this,S,x,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 x=K.getID3Data(S,0)||[],h=x.length,l=S.length;h<l;h++)if(U.probe(S,h))return N.logger.log("ADTS sync word found !"),!0;return!1},P.canParse=function(S,x){return U.canParse(S,x)},P.appendFrame=function(S,x,h){U.initTrackConfig(S,this.observer,x,h,S.manifestCodec);var l=U.appendFrame(S,x,h,this.initPTS,this.frameIndex);if(l&&l.missing===0)return l},A}(Y.default);L.minProbeByteLength=9,$.default=L},"./src/demux/adts.ts":function(oe,$,D){"use strict";D.r($),D.d($,"getAudioConfig",function(){return K}),D.d($,"isHeaderPattern",function(){return I}),D.d($,"getHeaderLength",function(){return O}),D.d($,"getFullFrameLength",function(){return L}),D.d($,"canGetFrameLength",function(){return T}),D.d($,"isHeader",function(){return A}),D.d($,"canParse",function(){return P}),D.d($,"probe",function(){return w}),D.d($,"initTrackConfig",function(){return S}),D.d($,"getFrameDuration",function(){return x}),D.d($,"parseFrameHeader",function(){return h}),D.d($,"appendFrame",function(){return l});var Y=D("./src/utils/logger.ts"),U=D("./src/errors.ts"),N=D("./src/events.ts");function K(i,c,C,v){var m,u,E,d,f=navigator.userAgent.toLowerCase(),s=v,o=[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>o.length-1){i.trigger(N.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,Y.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:o[b],channelCount:E,codec:"mp4a.40."+m,manifestCodec:s}}function I(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 T(i,c){return c+5<i.length}function A(i,c){return c+1<i.length&&I(i,c)}function P(i,c){return T(i,c)&&I(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,Y.logger.log("parsed codec:"+i.codec+", rate:"+u.samplerate+", channels:"+u.channelCount)}}function x(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=x(i.samplerate),E=h(c,C,v,m,u);if(E){var d=E.frameLength,f=E.headerLength,s=E.stamp,o=f+d,b=Math.max(0,C+o-c.length),g;b?(g=new Uint8Array(o-f),g.set(c.subarray(C+f,c.length),0)):g=c.subarray(C+f,C+o);var _={unit:g,pts:s};return b||i.samples.push(_),{sample:_,length:o,missing:b}}}},"./src/demux/base-audio-demuxer.ts":function(oe,$,D){"use strict";D.r($),D.d($,"initPTSFn",function(){return L});var Y=D("./src/polyfills/number.ts"),U=D("./src/demux/id3.ts"),N=D("./src/demux/dummy-demuxed-track.ts"),K=D("./src/utils/mp4-tools.ts"),I=D("./src/utils/typed-array.ts"),O=function(){function T(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var A=T.prototype;return A.resetInitSegment=function(w,S,x){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,x){},A.demux=function(w,S){this.cachedData&&(w=Object(K.appendUint8Array)(this.cachedData,w),this.cachedData=null);var x=U.getID3Data(w,0),h=x?x.length:0,l,i,c=this._audioTrack,C=this._id3Track,v=x?U.getTimeStamp(x):void 0,m=w.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=L(v,S)),x&&x.length>0&&C.samples.push({pts:this.initPTS,dts:this.initPTS,data:x}),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)?(x=U.getID3Data(w,h),C.samples.push({pts:i,dts:i,data:x}),h+=x.length,l=h):h++;if(h===m&&l!==m){var E=Object(I.sliceUint8)(w,l);this.cachedData?this.cachedData=Object(K.appendUint8Array)(this.cachedData,E):this.cachedData=E}}return{audioTrack:c,avcTrack:Object(N.dummyTrack)(),id3Track:C,textTrack:Object(N.dummyTrack)()}},A.demuxSampleAes=function(w,S,x){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(N.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(N.dummyTrack)()}},A.destroy=function(){},T}(),L=function(A,P){return Object(Y.isFiniteNumber)(A)?A*90:P*9e4};$.default=O},"./src/demux/chunk-cache.ts":function(oe,$,D){"use strict";D.r($),D.d($,"default",function(){return Y});var Y=function(){function N(){this.chunks=[],this.dataLength=0}var K=N.prototype;return K.push=function(O){this.chunks.push(O),this.dataLength+=O.length},K.flush=function(){var O=this.chunks,L=this.dataLength,T;if(O.length)O.length===1?T=O[0]:T=U(O,L);else return new Uint8Array(0);return this.reset(),T},K.reset=function(){this.chunks.length=0,this.dataLength=0},N}();function U(N,K){for(var I=new Uint8Array(K),O=0,L=0;L<N.length;L++){var T=N[L];I.set(T,O),O+=T.length}return I}},"./src/demux/dummy-demuxed-track.ts":function(oe,$,D){"use strict";D.r($),D.d($,"dummyTrack",function(){return Y});function Y(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(oe,$,D){"use strict";D.r($);var Y=D("./src/utils/logger.ts"),U=function(){function N(I){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=I,this.bytesAvailable=I.byteLength,this.word=0,this.bitsAvailable=0}var K=N.prototype;return K.loadWord=function(){var O=this.data,L=this.bytesAvailable,T=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(T,T+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),T=this.word>>>32-L;return O>32&&Y.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?T<<L|this.readBits(L):T},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,T=8,A,P=0;P<O;P++)T!==0&&(A=this.readEG(),T=(L+A+256)%256),L=T===0?L:T},K.readSPS=function(){var O=0,L=0,T=0,A=0,P,w,S,x=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);x();var u=x();if(h(5),c(3),x(),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(),o=h(1);o===0&&c(1),c(1),i()&&(O=l(),L=l(),T=l(),A=l());var b=[1,1];if(i()&&i()){var g=x();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=[x()<<8|x(),x()<<8|x()];break}}}return{width:Math.ceil((f+1)*16-O*2-L*2),height:(2-o)*(s+1)*16-(o?2:4)*(T+A),pixelRatio:b}},K.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},N}();$.default=U},"./src/demux/id3.ts":function(oe,$,D){"use strict";D.r($),D.d($,"isHeader",function(){return Y}),D.d($,"isFooter",function(){return U}),D.d($,"getID3Data",function(){return N}),D.d($,"canParse",function(){return I}),D.d($,"getTimeStamp",function(){return O}),D.d($,"isTimeStampFrame",function(){return L}),D.d($,"getID3Frames",function(){return A}),D.d($,"decodeFrame",function(){return P}),D.d($,"utf8ArrayToStr",function(){return l}),D.d($,"testables",function(){return i});var Y=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)))},N=function(m,u){for(var E=u,d=0;Y(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},I=function(m,u){return Y(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"},T=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=[];Y(m,u);){var d=K(m,u+6);u+=10;for(var f=u+d;u+8<f;){var s=T(m.subarray(u)),o=P(s);o&&E.push(o),u+=s.size+10}U(m,u)&&(u+=10)}return E},P=function(m){return m.type==="PRIV"?w(m):m.type[0]==="W"?x(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}},x=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,o,b,g,_="",k=0;k<s;){if(o=m[k++],o===0&&u)return _;if(o===0||o===3)continue;switch(o>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:_+=String.fromCharCode(o);break;case 12:case 13:b=m[k++],_+=String.fromCharCode((o&31)<<6|b&63);break;case 14:b=m[k++],g=m[k++],_+=String.fromCharCode((o&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,$,D){"use strict";D.r($);var Y=D("./src/demux/base-audio-demuxer.ts"),U=D("./src/demux/id3.ts"),N=D("./src/utils/logger.ts"),K=D("./src/demux/mpegaudio.ts");function I(T,A){T.prototype=Object.create(A.prototype),T.prototype.constructor=T,O(T,A)}function O(T,A){return O=Object.setPrototypeOf||function(w,S){return w.__proto__=S,w},O(T,A)}var L=function(T){I(A,T);function A(){return T.apply(this,arguments)||this}var P=A.prototype;return P.resetInitSegment=function(S,x,h){T.prototype.resetInitSegment.call(this,S,x,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 x=U.getID3Data(S,0)||[],h=x.length,l=S.length;h<l;h++)if(K.probe(S,h))return N.logger.log("MPEG Audio sync word found !"),!0;return!1},P.canParse=function(S,x){return K.canParse(S,x)},P.appendFrame=function(S,x,h){return this.initPTS===null?void 0:K.appendFrame(S,x,h,this.initPTS,this.frameIndex)},A}(Y.default);L.minProbeByteLength=4,$.default=L},"./src/demux/mp4demuxer.ts":function(oe,$,D){"use strict";D.r($);var Y=D("./src/utils/mp4-tools.ts"),U=D("./src/demux/dummy-demuxed-track.ts"),N=function(){function K(O,L){this.remainderData=null,this.config=void 0,this.config=L}var I=K.prototype;return I.resetTimeStamp=function(){},I.resetInitSegment=function(){},I.resetContiguity=function(){},K.probe=function(L){return Object(Y.findBox)({data:L,start:0,end:Math.min(L.length,16384)},["moof"]).length>0},I.demux=function(L){var T=L,A=Object(U.dummyTrack)();if(this.config.progressive){this.remainderData&&(T=Object(Y.appendUint8Array)(this.remainderData,L));var P=Object(Y.segmentValidRange)(T);this.remainderData=P.remainder,A.samples=P.valid||new Uint8Array}else A.samples=T;return{audioTrack:Object(U.dummyTrack)(),avcTrack:A,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},I.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)()}},I.demuxSampleAes=function(L,T,A){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},I.destroy=function(){},K}();N.minProbeByteLength=1024,$.default=N},"./src/demux/mpegaudio.ts":function(oe,$,D){"use strict";D.r($),D.d($,"appendFrame",function(){return O}),D.d($,"parseHeader",function(){return L}),D.d($,"isHeaderPattern",function(){return T}),D.d($,"isHeader",function(){return A}),D.d($,"canParse",function(){return P}),D.d($,"probe",function(){return w});var Y=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],N=[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]],I=[0,1,1,4];function O(S,x,h,l,i){if(h+24>x.length)return;var c=L(x,h);if(c&&h+c.frameLength<=x.length){var C=c.samplesPerFrame*9e4/c.sampleRate,v=l+i*C,m={unit:x.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,x){var h=S[x+1]>>3&3,l=S[x+1]>>1&3,i=S[x+2]>>4&15,c=S[x+2]>>2&3;if(h!==1&&i!==0&&i!==15&&c!==3){var C=S[x+2]>>1&1,v=S[x+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=N[E*3+c],f=v===3?1:2,s=K[h][l],o=I[l],b=s*8*o,g=Math.floor(s*u/d+C)*o;if(Y===null){var _=navigator.userAgent||"",k=_.match(/Chrome\/(\d+)/i);Y=k?parseInt(k[1]):0}var H=!!Y&&Y<=87;return H&&l===2&&u>=224e3&&v===0&&(S[x+3]=S[x+3]|128),{sampleRate:d,channelCount:f,frameLength:g,samplesPerFrame:b}}}function T(S,x){return S[x]===255&&(S[x+1]&224)===224&&(S[x+1]&6)!==0}function A(S,x){return x+1<S.length&&T(S,x)}function P(S,x){var h=4;return T(S,x)&&h<=S.length-x}function w(S,x){if(x+1<S.length&&T(S,x)){var h=4,l=L(S,x),i=h;l!=null&&l.frameLength&&(i=l.frameLength);var c=x+i;return c===S.length||A(S,c)}return!1}},"./src/demux/sample-aes.ts":function(oe,$,D){"use strict";D.r($);var Y=D("./src/crypt/decrypter.ts"),U=D("./src/demux/tsdemuxer.ts"),N=function(){function K(O,L,T){this.keyData=void 0,this.decrypter=void 0,this.keyData=T,this.decrypter=new Y.default(O,L,{removePKCS7Padding:!1})}var I=K.prototype;return I.decryptBuffer=function(L,T){this.decrypter.decrypt(L,this.keyData.key.buffer,this.keyData.iv.buffer,T)},I.decryptAacSample=function(L,T,A,P){var w=L[T].unit,S=w.subarray(16,w.length-w.length%16),x=S.buffer.slice(S.byteOffset,S.byteOffset+S.length),h=this;this.decryptBuffer(x,function(l){var i=new Uint8Array(l);w.set(i,16),P||h.decryptAacSamples(L,T+1,A)})},I.decryptAacSamples=function(L,T,A){for(;;T++){if(T>=L.length){A();return}if(L[T].unit.length<32)continue;var P=this.decrypter.isSync();if(this.decryptAacSample(L,T,A,P),!P)return}},I.getAvcEncryptedData=function(L){for(var T=Math.floor((L.length-48)/160)*16+16,A=new Int8Array(T),P=0,w=32;w<=L.length-16;w+=160,P+=16)A.set(L.subarray(w,w+16),P);return A},I.getAvcDecryptedUnit=function(L,T){for(var A=new Uint8Array(T),P=0,w=32;w<=L.length-16;w+=160,P+=16)L.set(A.subarray(P,P+16),w);return L},I.decryptAvcSample=function(L,T,A,P,w,S){var x=Object(U.discardEPB)(w.data),h=this.getAvcEncryptedData(x),l=this;this.decryptBuffer(h.buffer,function(i){w.data=l.getAvcDecryptedUnit(x,i),S||l.decryptAvcSamples(L,T,A+1,P)})},I.decryptAvcSamples=function(L,T,A,P){if(L instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;T++,A=0){if(T>=L.length){P();return}for(var w=L[T].units;!(A>=w.length);A++){var S=w[A];if(S.data.length<=48||S.type!==1&&S.type!==5)continue;var x=this.decrypter.isSync();if(this.decryptAvcSample(L,T,A,P,S,x),!x)return}}},K}();$.default=N},"./src/demux/transmuxer-interface.ts":function(oe,$,D){"use strict";D.r($),D.d($,"default",function(){return w});var Y=D("./node_modules/webworkify-webpack/index.js"),U=D.n(Y),N=D("./src/events.ts"),K=D("./src/demux/transmuxer.ts"),I=D("./src/utils/logger.ts"),O=D("./src/errors.ts"),L=D("./src/utils/mediasource-helper.ts"),T=D("./node_modules/eventemitter3/index.js"),A=D.n(T),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,o){o=o||{},o.frag=C.frag,o.id=C.id,h.trigger(s,o)};this.observer=new T.EventEmitter,this.observer.on(N.Events.FRAG_DECRYPTED,m),this.observer.on(N.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"){I.logger.log("demuxing in webworker");var d;try{d=this.worker=Y("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),d.addEventListener("message",this.onwmsg),d.onerror=function(f){h.trigger(N.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){I.logger.warn("Error in worker:",f),I.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 x=S.prototype;return x.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},x.push=function(l,i,c,C,v,m,u,E,d,f){var s=this;d.transmuxing.start=self.performance.now();var o=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 de=new K.TransmuxState(H,B,E,z,g);if(!B||H){I.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:de},l instanceof ArrayBuffer?[l]:[]);else if(o){var ye=o.push(l,_,d,de);Object(K.isPromise)(ye)?ye.then(function(Ce){s.handleTransmuxComplete(Ce)}):this.handleTransmuxComplete(ye)}},x.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)}},x.handleFlushResult=function(l,i){var c=this;l.forEach(function(C){c.handleTransmuxComplete(C)}),this.onFlush(i)},x.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}}},x.configureTransmuxer=function(l){var i=this.worker,c=this.transmuxer;i?i.postMessage({cmd:"configure",config:l}):c&&c.configure(l)},x.handleTransmuxComplete=function(l){l.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(l)},S}()},"./src/demux/transmuxer-worker.ts":function(oe,$,D){"use strict";D.r($),D.d($,"default",function(){return O});var Y=D("./src/demux/transmuxer.ts"),U=D("./src/events.ts"),N=D("./src/utils/logger.ts"),K=D("./node_modules/eventemitter3/index.js"),I=D.n(K);function O(w){var S=new K.EventEmitter,x=function(l,i){w.postMessage({event:l,data:i})};S.on(U.Events.FRAG_DECRYPTED,x),S.on(U.Events.ERROR,x),w.addEventListener("message",function(h){var l=h.data;switch(l.cmd){case"init":{var i=JSON.parse(l.config);w.transmuxer=new Y.default(S,l.typeSupported,i,l.vendor,l.id),Object(N.enableLogs)(i.debug),x("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(Y.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(Y.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 x=[],h=S.remuxResult,l=h.audio,i=h.video;l&&T(x,l),i&&T(x,i),w.postMessage({event:"transmuxComplete",data:S},x)}function T(w,S){S.data1&&w.push(S.data1.buffer),S.data2&&w.push(S.data2.buffer)}function A(w,S,x){S.forEach(function(h){L(w,h)}),w.postMessage({event:"flush",data:x})}function P(w){return!w.audio&&!w.video&&!w.text&&!w.id3&&!w.initSegment}},"./src/demux/transmuxer.ts":function(oe,$,D){"use strict";D.r($),D.d($,"default",function(){return i}),D.d($,"isPromise",function(){return v}),D.d($,"TransmuxConfig",function(){return m}),D.d($,"TransmuxState",function(){return u});var Y=D("./src/events.ts"),U=D("./src/errors.ts"),N=D("./src/crypt/decrypter.ts"),K=D("./src/demux/aacdemuxer.ts"),I=D("./src/demux/mp4demuxer.ts"),O=D("./src/demux/tsdemuxer.ts"),L=D("./src/demux/mp3demuxer.ts"),T=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"),x;try{x=self.performance.now.bind(self.performance)}catch(E){S.logger.debug("Unable to use Performance API on this environment"),x=self.Date.now}var h=[{demux:O.default,remux:T.default},{demux:I.default,remux:A.default},{demux:K.default,remux:T.default},{demux:L.default,remux:T.default}],l=1024;h.forEach(function(E){var d=E.demux;l=Math.max(l,d.minProbeByteLength)});var i=function(){function E(f,s,o,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=o,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,o,b,g){var _=this,k=b.transmuxing;k.executeStart=x();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,o);if(te&&te.method==="AES-128"){var de=this.getDecrypter();if(Z.enableSoftwareAES){var pe=de.softwareDecrypt(H,te.key.buffer,te.iv.buffer);if(!pe)return k.executeEnd=x(),C(b);H=new Uint8Array(pe)}else return this.decryptionPromise=de.webCryptoDecrypt(H,te.key.buffer,te.iv.buffer).then(function(Pe){var We=_.push(Pe,null,b);return _.decryptionPromise=null,We}),this.decryptionPromise}var ye=g||G,Ce=ye.contiguous,_e=ye.discontinuity,le=ye.trackSwitch,se=ye.accurateTimeOffset,ve=ye.timeOffset,ie=B.audioCodec,q=B.videoCodec,xe=B.defaultInitPts,Ie=B.duration,Ne=B.initSegmentData;if((_e||le)&&this.resetInitSegment(Ne,ie,q,Ie),_e&&this.resetInitialTimestamp(xe),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,ve,se,b),Ae=this.currentTransmuxState;return Ae.contiguous=!0,Ae.discontinuity=!1,Ae.trackSwitch=!1,k.executeEnd=x(),Be},d.flush=function(s){var o=this,b=s.transmuxing;b.executeStart=x();var g=this.decrypter,_=this.cache,k=this.currentTransmuxState,H=this.decryptionPromise;if(H)return H.then(function(){return o.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,de=this.remuxer;if(!te||!de)return B>=l&&this.observer.emit(Y.Events.ERROR,Y.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),b.executeEnd=x(),[C(s)];var pe=te.flush(Z);return v(pe)?pe.then(function(ye){return o.flushRemux(z,ye,s),z}):(this.flushRemux(z,pe,s),z)},d.flushRemux=function(s,o,b){var g=o.audioTrack,_=o.avcTrack,k=o.id3Track,H=o.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=x()},d.resetInitialTimestamp=function(s){var o=this.demuxer,b=this.remuxer;if(!o||!b)return;o.resetTimeStamp(s),b.resetTimeStamp(s)},d.resetContiguity=function(){var s=this.demuxer,o=this.remuxer;if(!s||!o)return;s.resetContiguity(),o.resetNextTimestamp()},d.resetInitSegment=function(s,o,b,g){var _=this.demuxer,k=this.remuxer;if(!_||!k)return;_.resetInitSegment(o,b,g),k.resetInitSegment(s,o,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,o,b,g,_){var k;return o&&o.method==="SAMPLE-AES"?k=this.transmuxSampleAes(s,o,b,g,_):k=this.transmuxUnencrypted(s,b,g,_),k},d.transmuxUnencrypted=function(s,o,b,g){var _=this.demuxer.demux(s,o,!1,!this.config.progressive),k=_.audioTrack,H=_.avcTrack,z=_.id3Track,Z=_.textTrack,G=this.remuxer.remux(k,H,z,Z,o,b,!1,this.id);return{remuxResult:G,chunkMeta:g}},d.transmuxSampleAes=function(s,o,b,g,_){var k=this;return this.demuxer.demuxSampleAes(s,o,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,o){for(var b=this.config,g=this.observer,_=this.typeSupported,k=this.vendor,H=o.audioCodec,z=o.defaultInitPts,Z=o.duration,G=o.initSegmentData,B=o.videoCodec,te,de=0,pe=h.length;de<pe;de++)if(h[de].demux.probe(s)){te=h[de];break}te||(S.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),te={demux:I.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,o,b){return!this.demuxer||!this.remuxer||o||b},d.getDecrypter=function(){var s=this.decrypter;return s||(s=this.decrypter=new N.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,o,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=o,this.defaultInitPts=b},u=function(d,f,s,o,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=o,this.timeOffset=b}},"./src/demux/tsdemuxer.ts":function(oe,$,D){"use strict";D.r($),D.d($,"discardEPB",function(){return C});var Y=D("./src/demux/adts.ts"),U=D("./src/demux/mpegaudio.ts"),N=D("./src/demux/exp-golomb.ts"),K=D("./src/demux/id3.ts"),I=D("./src/demux/sample-aes.ts"),O=D("./src/events.ts"),L=D("./src/utils/mp4-tools.ts"),T=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&&T.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 o,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,de=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],ve=(E[_e+3]&48)>>4,ie=void 0;if(ve>1){if(ie=_e+5+E[_e+4],ie===_e+188)continue}else ie=_e+4;switch(se){case k:le&&(H&&(o=l(H))&&this.parseAVCPES(o,!1),H={data:[],size:0}),H&&(H.data.push(E.subarray(ie,_e+188)),H.size+=_e+188-ie);break;case z:le&&(G&&(o=l(G))&&(g.isAAC?this.parseAACPES(o):this.parseMPEGPES(o)),G={data:[],size:0}),G&&(G.data.push(E.subarray(ie,_e+188)),G.size+=_e+188-ie);break;case Z:le&&(B&&(o=l(B))&&this.parseID3PES(o),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=x(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&&!de&&(T.logger.log("reparse from beginning"),te=!1,_e=Ce-188),de=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 xe={audioTrack:g,avcTrack:b,id3Track:_,textTrack:this._txtTrack};return s&&this.extractRemainingSamples(xe),xe},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,o=f.pesData,b=d.pesData,g=s.pesData,_;o&&(_=l(o))?(this.parseAVCPES(_,!0),f.pesData=null):f.pesData=o,b&&(_=l(b))?(d.isAAC?this.parseAACPES(_):this.parseMPEGPES(_),d.pesData=null):(b!=null&&b.size&&T.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),o=this.sampleAes=new I.default(this.observer,this.config,d);return this.decrypt(s,o)},m.decrypt=function(E,d){return new Promise(function(f){var s=E.audioTrack,o=E.avcTrack;s.samples&&s.isAAC?d.decryptAacSamples(s.samples,0,function(){o.samples?d.decryptAvcSamples(o.samples,0,0,function(){f(E)}):f(E)}):o.samples&&d.decryptAvcSamples(o.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,o=this.parseAVCNALu(E.data),b=!1,g=this.avcSample,_,k=!1;E.data=null,g&&o.length&&!s.audFound&&(i(g,s),g=this.avcSample=S(!1,E.pts,E.dts,"")),o.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 N.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 N.default(C(H.data));G.readUByte();for(var B=0,te=0,de=!1,pe=0;!de&&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){de=!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(),ve=G.readUByte(),ie=31&se,q=[se,ve],xe=0;xe<ie;xe++)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(de=!0,te>16){for(var Ie=[],Ne=0;Ne<16;Ne++)Ie.push(G.readUByte().toString(16)),(Ne===3||Ne===5||Ne===7||Ne===9)&&Ie.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:Ie.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 We=new N.default(H.data),ze=We.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),Ge="avc1.",ke=0;ke<3;ke++){var ct=qe[ke].toString(16);ct.length<2&&(ct="0"+ct),Ge+=ct}s.codec=Ge}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 ut=g.units;ut.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 o=d.units;f=o[o.length-1]}return f},m.parseAVCNALu=function(E){var d=E.byteLength,f=this._avcTrack,s=f.naluState||0,o=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&&(o&&g<=4-o&&(B.state&&(B.data=B.data.subarray(0,B.data.byteLength-o))),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 de={data:E.subarray(z,d),type:Z,state:s};b.push(de)}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,o=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(o.subarray(0,g),_),f.samples.push(s.sample),d=s.missing}var k,H;for(k=d,H=o.length;k<H-1&&!Y.isHeader(o,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),T.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}Y.initTrackConfig(f,this.observer,o,k,this.audioCodec);var G;if(E.pts!==void 0)G=E.pts;else if(s){var B=Y.getFrameDuration(f.samplerate);G=s.sample.pts+B}else{T.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var te=0;k<H;)if(Y.isHeader(o,k)){if(k+5<H){var de=Y.appendFrame(f,o,k,G,te);if(de)if(de.missing)this.aacOverFlow=de;else{k+=de.length,te++;continue}}break}else k++},m.parseMPEGPES=function(E){var d=E.data,f=d.length,s=0,o=0,b=E.pts;if(b===void 0){T.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<f;)if(U.isHeader(d,o)){var g=U.appendFrame(this._audioTrack,d,o,b,s);if(g)o+=g.length,s++;else break}else o++},m.parseID3PES=function(E){if(E.pts===void 0){T.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 x(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,o=(v[m+10]&15)<<8|v[m+11];for(m+=12+o;m<s;){var b=(v[m+1]&31)<<8|v[m+2];switch(v[m]){case 207:if(!E){T.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){T.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):T.logger.log("MPEG audio found, not supported in this browser");break;case 36:T.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,o=v.data;if(!v||v.size===0)return null;for(;o[0].length<19&&o.length>1;){var b=new Uint8Array(o[0].length+o[1].length);b.set(o[0]),b.set(o[1],o[0].length),o[0]=b,o.splice(1,1)}u=o[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&&(T.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=o.length;z<Z;z++){u=o[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&&T.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}$.default=w},"./src/errors.ts":function(oe,$,D){"use strict";D.r($),D.d($,"ErrorTypes",function(){return Y}),D.d($,"ErrorDetails",function(){return U});var Y;(function(N){N.NETWORK_ERROR="networkError",N.MEDIA_ERROR="mediaError",N.KEY_SYSTEM_ERROR="keySystemError",N.MUX_ERROR="muxError",N.OTHER_ERROR="otherError"})(Y||(Y={}));var U;(function(N){N.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",N.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",N.KEY_SYSTEM_NO_SESSION="keySystemNoSession",N.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",N.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",N.MANIFEST_LOAD_ERROR="manifestLoadError",N.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",N.MANIFEST_PARSING_ERROR="manifestParsingError",N.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",N.LEVEL_EMPTY_ERROR="levelEmptyError",N.LEVEL_LOAD_ERROR="levelLoadError",N.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",N.LEVEL_SWITCH_ERROR="levelSwitchError",N.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",N.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",N.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",N.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",N.FRAG_LOAD_ERROR="fragLoadError",N.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",N.FRAG_DECRYPT_ERROR="fragDecryptError",N.FRAG_PARSING_ERROR="fragParsingError",N.REMUX_ALLOC_ERROR="remuxAllocError",N.KEY_LOAD_ERROR="keyLoadError",N.KEY_LOAD_TIMEOUT="keyLoadTimeOut",N.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",N.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",N.BUFFER_APPEND_ERROR="bufferAppendError",N.BUFFER_APPENDING_ERROR="bufferAppendingError",N.BUFFER_STALLED_ERROR="bufferStalledError",N.BUFFER_FULL_ERROR="bufferFullError",N.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",N.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",N.INTERNAL_EXCEPTION="internalException",N.INTERNAL_ABORTED="aborted",N.UNKNOWN="unknown"})(U||(U={}))},"./src/events.ts":function(oe,$,D){"use strict";D.r($),D.d($,"Events",function(){return Y});var Y;(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"})(Y||(Y={}))},"./src/hls.ts":function(oe,$,D){"use strict";D.r($),D.d($,"default",function(){return v});var Y=D("./node_modules/url-toolkit/src/url-toolkit.js"),U=D.n(Y),N=D("./src/loader/playlist-loader.ts"),K=D("./src/loader/key-loader.ts"),I=D("./src/controller/id3-track-controller.ts"),O=D("./src/controller/latency-controller.ts"),L=D("./src/controller/level-controller.ts"),T=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"),x=D("./node_modules/eventemitter3/index.js"),h=D.n(x),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 x.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,o=d.capLevelController,b=d.fpsController,g=this.abrController=new f(this),_=this.bufferController=new s(this),k=this.capLevelController=new o(this),H=new b(this),z=new N.default(this),Z=new K.default(this),G=new I.default(this),B=this.levelController=new L.default(this),te=new T.FragmentTracker(this),de=this.streamController=new A.default(this,te);k.setStreamController(de),H.setStreamController(de);var pe=[B,de];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 o=f?new d(this,f):new d(this);return s&&s.push(o),o}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,o){s===void 0&&(s=this),this._emitter.off(d,f,s,o)},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,o=this.url=Y.buildAbsoluteURL(self.location.href,d,{alwaysNormalize:!0});w.logger.log("loadSource:"+o),f&&s&&s!==o&&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,o=0;o<s;o++)if(d[o].maxBitrate>f)return o;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,$,D){"use strict";D.r($),D.d($,"isSupported",function(){return N}),D.d($,"changeTypeSupported",function(){return K});var Y=D("./src/utils/mediasource-helper.ts");function U(){return self.SourceBuffer||self.WebKitSourceBuffer}function N(){var I=Object(Y.getMediaSource)();if(!I)return!1;var O=U(),L=I&&typeof I.isTypeSupported=="function"&&I.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),T=!O||O.prototype&&typeof O.prototype.appendBuffer=="function"&&typeof O.prototype.remove=="function";return!!L&&!!T}function K(){var I,O=U();return typeof(O==null||((I=O.prototype)===null||I===void 0)?void 0:I.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(oe,$,D){"use strict";D.r($),D.d($,"default",function(){return w}),D.d($,"LoadError",function(){return x});var Y=D("./src/polyfills/number.ts"),U=D("./src/errors.ts");function N(h,l){h.prototype=Object.create(l.prototype),h.prototype.constructor=h,T(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 I(c,arguments,A(this).constructor)}return C.prototype=Object.create(c.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),T(C,c)},K(h)}function I(h,l,i){return O()?I=Reflect.construct:I=function(C,v,m){var u=[null];u.push.apply(u,v);var E=Function.bind.apply(C,u),d=new E;return m&&T(d,m.prototype),d},I.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 T(h,l){return T=Object.setPrototypeOf||function(c,C){return c.__proto__=C,c},T(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 x({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 o=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=o.stats,o.load(b,g,{onSuccess:function(k,H,z,Z){v.resetLoader(c,o),f({frag:c,part:null,payload:k.data,networkDetails:Z})},onError:function(k,H,z){v.resetLoader(c,o),s(new x({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,o),s(new x({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:c,networkDetails:z}))},onTimeout:function(k,H,z){v.resetLoader(c,o),s(new x({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 o=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=o.stats,o.load(b,g,{onSuccess:function(k,H,z,Z){m.resetLoader(c,o),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,o),s(new x({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,o),s(new x({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,o),s(new x({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 o=v.loading,b=m.loading;o.start?o.first+=b.first-b.start:(o.start=b.start,o.first=b.first),o.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(Y.isFiniteNumber)(C)&&Object(Y.isFiniteNumber)(v)&&(c.rangeStart=C,c.rangeEnd=v),c}var x=function(h){N(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,$,D){"use strict";D.r($),D.d($,"ElementaryStreamTypes",function(){return w}),D.d($,"BaseSegment",function(){return S}),D.d($,"Fragment",function(){return x}),D.d($,"Part",function(){return h});var Y=D("./src/polyfills/number.ts"),U=D("./node_modules/url-toolkit/src/url-toolkit.js"),N=D.n(U),K=D("./src/utils/logger.ts"),I=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,T(l,i)}function T(l,i){return T=Object.setPrototypeOf||function(C,v){return C.__proto__=v,C},T(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}(),x=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=I.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,o=s[v];if(!o){s[v]={startPTS:m,endPTS:u,startDTS:E,endDTS:d,partial:f};return}o.startPTS=Math.min(o.startPTS,m),o.endPTS=Math.max(o.endPTS,u),o.startDTS=Math.min(o.startDTS,E),o.endDTS=Math.max(o.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(Y.isFiniteNumber)(this.programDateTime))return null;var v=Object(Y.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,$,D){"use strict";D.r($),D.d($,"default",function(){return K});var Y=D("./src/events.ts"),U=D("./src/errors.ts"),N=D("./src/utils/logger.ts"),K=function(){function I(L){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=L,this._registerListeners()}var O=I.prototype;return O._registerListeners=function(){this.hls.on(Y.Events.KEY_LOADING,this.onKeyLoading,this)},O._unregisterListeners=function(){this.hls.off(Y.Events.KEY_LOADING,this.onKeyLoading)},O.destroy=function(){this._unregisterListeners();for(var T in this.loaders){var A=this.loaders[T];A&&A.destroy()}this.loaders={}},O.onKeyLoading=function(T,A){var P=A.frag,w=P.type,S=this.loaders[w];if(!P.decryptdata){N.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var x=P.decryptdata.uri;if(x!==this.decrypturl||this.decryptkey===null){var h=this.hls.config;if(S&&(N.logger.warn("abort previous key loader for type:"+w),S.abort()),!x){N.logger.warn("key uri is falsy");return}var l=h.loader,i=P.loader=this.loaders[w]=new l(h);this.decrypturl=x,this.decryptkey=null;var c={url:x,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(Y.Events.KEY_LOADED,{frag:P}))},O.loadsuccess=function(T,A,P){var w=P.frag;if(!w.decryptdata){N.logger.error("after key load, decryptdata unset");return}this.decryptkey=w.decryptdata.key=new Uint8Array(T.data),w.loader=null,delete this.loaders[w.type],this.hls.trigger(Y.Events.KEY_LOADED,{frag:w})},O.loaderror=function(T,A){var P=A.frag,w=P.loader;w&&w.abort(),delete this.loaders[P.type],this.hls.trigger(Y.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:P,response:T})},O.loadtimeout=function(T,A){var P=A.frag,w=P.loader;w&&w.abort(),delete this.loaders[P.type],this.hls.trigger(Y.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:P})},I}()},"./src/loader/level-details.ts":function(oe,$,D){"use strict";D.r($),D.d($,"LevelDetails",function(){return I});var Y=D("./src/polyfills/number.ts");function U(O,L){for(var T=0;T<L.length;T++){var A=L[T];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(O,A.key,A)}}function N(O,L,T){return L&&U(O.prototype,L),T&&U(O,T),O}var K=10,I=function(){function O(T){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=T}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},N(O,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(Y.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,$,D){"use strict";D.r($),D.d($,"LevelKey",function(){return I});var Y=D("./node_modules/url-toolkit/src/url-toolkit.js"),U=D.n(Y);function N(O,L){for(var T=0;T<L.length;T++){var A=L[T];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(O,A.key,A)}}function K(O,L,T){return L&&N(O.prototype,L),T&&N(O,T),O}var I=function(){O.fromURL=function(T,A){return new O(T,A)},O.fromURI=function(T){return new O(T)};function O(L,T){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,T?this._uri=Object(Y.buildAbsoluteURL)(L,T,{alwaysNormalize:!0}):this._uri=L}return K(O,[{key:"uri",get:function(){return this._uri}}]),O}()},"./src/loader/load-stats.ts":function(oe,$,D){"use strict";D.r($),D.d($,"LoadStats",function(){return Y});var Y=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,$,D){"use strict";D.r($),D.d($,"default",function(){return i});var Y=D("./src/polyfills/number.ts"),U=D("./node_modules/url-toolkit/src/url-toolkit.js"),N=D.n(U),K=D("./src/loader/fragment.ts"),I=D("./src/loader/level-details.ts"),O=D("./src/loader/level-key.ts"),L=D("./src/utils/attr-list.ts"),T=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"),x=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 o=d[s];if(o.id===f)return o}},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=[],o={},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,o[z["DATA-ID"]]=z)}return{levels:s,sessionData:b?o:null}},u.parseMasterPlaylistMedia=function(d,f,s,o){o===void 0&&(o=[]);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(o.length){var z=u.findGroup(o,H.groupId)||o[0];C(H,z,"audioCodec"),C(H,z,"textCodec")}g.push(H)}}return g},u.parseLevelPlaylist=function(d,f,s,o,b){var g=new I.LevelDetails(f),_=g.fragments,k=null,H=0,z=0,Z=0,G=0,B=null,te=new K.Fragment(o,f),de,pe,ye,Ce=-1,_e=!1;for(S.lastIndex=0,g.m3u8=d;(de=S.exec(d))!==null;){_e&&(_e=!1,te=new K.Fragment(o,f),te.start=Z,te.sn=H,te.cc=G,te.level=s,k&&(te.initSegment=k,te.rawProgramDateTime=k.rawProgramDateTime));var le=de[1];if(le){te.duration=parseFloat(le);var se=(" "+de[2]).slice(1);te.title=se||null,te.tagList.push(se?["INF",le,se]:["INF",le])}else if(de[3])Object(Y.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=(" "+de[3]).slice(1),m(te,B),B=te,Z+=te.duration,H++,z=0,_e=!0);else if(de[4]){var ve=(" "+de[4]).slice(1);B?te.setByteRange(ve,B):te.setByteRange(ve)}else if(de[5])te.rawProgramDateTime=(" "+de[5]).slice(1),te.tagList.push(["PROGRAM-DATE-TIME",te.rawProgramDateTime]),Ce===-1&&(Ce=_.length);else{if(de=de[0].match(x),!de){T.logger.warn("No matches on slow regex match for level playlist!");continue}for(pe=1;pe<de.length&&!(typeof de[pe]!="undefined");pe++);var ie=(" "+de[pe]).slice(1),q=(" "+de[pe+1]).slice(1),xe=de[pe+2]?(" "+de[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 Ie=new L.AttrList(q),Ne=Ie.decimalInteger("SKIPPED-SEGMENTS");if(Object(Y.isFiniteNumber)(Ne)){g.skippedSegments=Ne;for(var De=Ne;De--;)_.unshift(null);H+=Ne}var Be=Ie.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||xe)&&te.tagList.push(xe?[q,xe]:[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),We=Pe.enumeratedString("METHOD"),ze=Pe.URI,qe=Pe.hexadecimalInteger("IV"),Ge=Pe.enumeratedString("KEYFORMATVERSIONS"),ke=Pe.enumeratedString("KEYID"),ct=(Ae=Pe.enumeratedString("KEYFORMAT"))!=null?Ae:"identity",ut=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(ut.indexOf(ct)>-1){T.logger.warn("Keyformat "+ct+" is not supported from the manifest");continue}else if(ct!=="identity")continue;We&&(ye=O.LevelKey.fromURL(f,ze),ze&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(We)>=0&&(ye.method=We,ye.keyFormat=ct,ke&&(ye.keyID=ke),Ge&&(ye.keyFormatVersions=Ge),ye.iv=qe));break}case"START":{var vt=new L.AttrList(q),lt=vt.decimalFloatingPoint("TIME-OFFSET");Object(Y.isFiniteNumber)(lt)&&(g.startTimeOffset=lt);break}case"MAP":{var Tt=new L.AttrList(q);te.relurl=Tt.URI,Tt.BYTERANGE&&te.setByteRange(Tt.BYTERANGE),te.level=s,te.sn="initSegment",ye&&(te.levelkey=ye),te.initSegment=null,k=te,_e=!0;break}case"SERVER-CONTROL":{var gt=new L.AttrList(q);g.canBlockReload=gt.bool("CAN-BLOCK-RELOAD"),g.canSkipUntil=gt.optionalFloat("CAN-SKIP-UNTIL",0),g.canSkipDateRanges=g.canSkipUntil>0&&gt.bool("CAN-SKIP-DATERANGES"),g.partHoldBack=gt.optionalFloat("PART-HOLD-BACK",0),g.holdBack=gt.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var yt=new L.AttrList(q);g.partTarget=yt.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Oe=g.partList;Oe||(Oe=g.partList=[]);var Pt=z>0?Oe[Oe.length-1]:void 0,St=z++,Ue=new K.Part(new L.AttrList(q),te,f,St,Pt);Oe.push(Ue),te.duration+=Ue.duration;break}case"PRELOAD-HINT":{var Ze=new L.AttrList(q);g.preloadHint=Ze;break}case"RENDITION-REPORT":{var Ee=new L.AttrList(q);g.renditionReports=g.renditionReports||[],g.renditionReports.push(Ee);break}default:T.logger.warn("line parsed but not handled: "+de);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)})&&(T.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),te=new K.Fragment(o,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(o){return Object(A.isCodecType)(o,d)});if(f.length){var s=f.filter(function(o){return o.lastIndexOf("avc1",0)===0||o.lastIndexOf("mp4a",0)===0});E[d+"Codec"]=s.length>0?s[0]:f[0],u=u.filter(function(o){return f.indexOf(o)===-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(Y.isFiniteNumber)(u.programDateTime)||(u.programDateTime=null,u.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(oe,$,D){"use strict";D.r($);var Y=D("./src/polyfills/number.ts"),U=D("./src/events.ts"),N=D("./src/errors.ts"),K=D("./src/utils/logger.ts"),I=D("./src/utils/mp4-tools.ts"),O=D("./src/loader/m3u8-parser.ts"),L=D("./src/types/loader.ts"),T=D("./src/utils/attr-list.ts");function A(S){var x=S.type;switch(x){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,x){var h=S.url;return(h===void 0||h.indexOf("data:")===0)&&(h=x.url),h}var w=function(){function S(h){this.hls=void 0,this.loaders=Object.create(null),this.hls=h,this.registerListeners()}var x=S.prototype;return x.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)},x.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)},x.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},x.getInternalLoader=function(l){return this.loaders[l.type]},x.resetInternalLoader=function(l){this.loaders[l]&&delete this.loaders[l]},x.destroyInternalLoaders=function(){for(var l in this.loaders){var i=this.loaders[l];i&&i.destroy(),this.resetInternalLoader(l)}},x.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},x.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})},x.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})},x.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})},x.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})},x.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,o=f.targetduration;s&&o&&(u=Math.min(Math.max(s*3,o*.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)},x.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)},x.loaderror=function(l,i,c){c===void 0&&(c=null),this.handleNetworkError(i,c,!1,l)},x.loadtimeout=function(l,i,c){c===void 0&&(c=null),this.handleNetworkError(i,c,!0)},x.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}}),o=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",o),_=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 T.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})},x.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(Y.isFiniteNumber)(m)?m:0,s=Object(Y.isFiniteNumber)(u)?u:f,o=A(c),b=O.default.parseLevelPlaylist(l.data,d,s,o,f);if(!b.fragments.length){v.trigger(U.Events.ERROR,{type:N.ErrorTypes.NETWORK_ERROR,details:N.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 T.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)},x.handleSidxRequest=function(l,i){var c=Object(I.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")})},x.handleManifestParsingError=function(l,i,c,C){this.hls.trigger(U.Events.ERROR,{type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:i.type===L.PlaylistContextType.MANIFEST,url:l.url,reason:c,response:l,context:i,networkDetails:C})},x.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=N.ErrorDetails.UNKNOWN,m=!1,u=this.getInternalLoader(l);switch(l.type){case L.PlaylistContextType.MANIFEST:v=c?N.ErrorDetails.MANIFEST_LOAD_TIMEOUT:N.ErrorDetails.MANIFEST_LOAD_ERROR,m=!0;break;case L.PlaylistContextType.LEVEL:v=c?N.ErrorDetails.LEVEL_LOAD_TIMEOUT:N.ErrorDetails.LEVEL_LOAD_ERROR,m=!1;break;case L.PlaylistContextType.AUDIO_TRACK:v=c?N.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:N.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,m=!1;break;case L.PlaylistContextType.SUBTITLE_TRACK:v=c?N.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:N.ErrorDetails.SUBTITLE_LOAD_ERROR,m=!1;break}u&&this.resetInternalLoader(l.type);var E={type:N.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)},x.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}();$.default=w},"./src/polyfills/number.ts":function(oe,$,D){"use strict";D.r($),D.d($,"isFiniteNumber",function(){return Y}),D.d($,"MAX_SAFE_INTEGER",function(){return U});var Y=Number.isFinite||function(N){return typeof N=="number"&&isFinite(N)},U=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(oe,$,D){"use strict";D.r($);var Y=function(){function U(){}return U.getSilentFrame=function(K,I){switch(K){case"mp4a.40.2":if(I===1)return new Uint8Array([0,200,0,128,35,128]);if(I===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(I===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(I===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(I===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(I===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(I===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(I===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(I===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}();$.default=Y},"./src/remux/mp4-generator.ts":function(oe,$,D){"use strict";D.r($);var Y=Math.pow(2,32)-1,U=function(){function N(){}return N.init=function(){N.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 I;for(I in N.types)N.types.hasOwnProperty(I)&&(N.types[I]=[I.charCodeAt(0),I.charCodeAt(1),I.charCodeAt(2),I.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]);N.HDLR_TYPES={video:O,audio:L};var T=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]);N.STTS=N.STSC=N.STCO=A,N.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),N.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),N.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),N.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]);N.FTYP=N.box(N.types.ftyp,P,S,P,w),N.DINF=N.box(N.types.dinf,N.box(N.types.dref,T))},N.box=function(I){for(var O=8,L=arguments.length,T=new Array(L>1?L-1:0),A=1;A<L;A++)T[A-1]=arguments[A];for(var P=T.length,w=P;P--;)O+=T[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(I,4),P=0,O=8;P<w;P++)S.set(T[P],O),O+=T[P].byteLength;return S},N.hdlr=function(I){return N.box(N.types.hdlr,N.HDLR_TYPES[I])},N.mdat=function(I){return N.box(N.types.mdat,I)},N.mdhd=function(I,O){O*=I;var L=Math.floor(O/(Y+1)),T=Math.floor(O%(Y+1));return N.box(N.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,I>>24&255,I>>16&255,I>>8&255,I&255,L>>24,L>>16&255,L>>8&255,L&255,T>>24,T>>16&255,T>>8&255,T&255,85,196,0,0]))},N.mdia=function(I){return N.box(N.types.mdia,N.mdhd(I.timescale,I.duration),N.hdlr(I.type),N.minf(I))},N.mfhd=function(I){return N.box(N.types.mfhd,new Uint8Array([0,0,0,0,I>>24,I>>16&255,I>>8&255,I&255]))},N.minf=function(I){return I.type==="audio"?N.box(N.types.minf,N.box(N.types.smhd,N.SMHD),N.DINF,N.stbl(I)):N.box(N.types.minf,N.box(N.types.vmhd,N.VMHD),N.DINF,N.stbl(I))},N.moof=function(I,O,L){return N.box(N.types.moof,N.mfhd(I),N.traf(L,O))},N.moov=function(I){for(var O=I.length,L=[];O--;)L[O]=N.trak(I[O]);return N.box.apply(null,[N.types.moov,N.mvhd(I[0].timescale,I[0].duration)].concat(L).concat(N.mvex(I)))},N.mvex=function(I){for(var O=I.length,L=[];O--;)L[O]=N.trex(I[O]);return N.box.apply(null,[N.types.mvex].concat(L))},N.mvhd=function(I,O){O*=I;var L=Math.floor(O/(Y+1)),T=Math.floor(O%(Y+1)),A=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,I>>24&255,I>>16&255,I>>8&255,I&255,L>>24,L>>16&255,L>>8&255,L&255,T>>24,T>>16&255,T>>8&255,T&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 N.box(N.types.mvhd,A)},N.sdtp=function(I){var O=I.samples||[],L=new Uint8Array(4+O.length),T,A;for(T=0;T<O.length;T++)A=O[T].flags,L[T+4]=A.dependsOn<<4|A.isDependedOn<<2|A.hasRedundancy;return N.box(N.types.sdtp,L)},N.stbl=function(I){return N.box(N.types.stbl,N.stsd(I),N.box(N.types.stts,N.STTS),N.box(N.types.stsc,N.STSC),N.box(N.types.stsz,N.STSZ),N.box(N.types.stco,N.STCO))},N.avc1=function(I){var O=[],L=[],T,A,P;for(T=0;T<I.sps.length;T++)A=I.sps[T],P=A.byteLength,O.push(P>>>8&255),O.push(P&255),O=O.concat(Array.prototype.slice.call(A));for(T=0;T<I.pps.length;T++)A=I.pps[T],P=A.byteLength,L.push(P>>>8&255),L.push(P&255),L=L.concat(Array.prototype.slice.call(A));var w=N.box(N.types.avcC,new Uint8Array([1,O[3],O[4],O[5],252|3,224|I.sps.length].concat(O).concat([I.pps.length]).concat(L))),S=I.width,x=I.height,h=I.pixelRatio[0],l=I.pixelRatio[1];return N.box(N.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,x>>8&255,x&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,N.box(N.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),N.box(N.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,h&255,l>>24,l>>16&255,l>>8&255,l&255])))},N.esds=function(I){var O=I.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(I.config).concat([6,1,2]))},N.mp4a=function(I){var O=I.samplerate;return N.box(N.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,I.channelCount,0,16,0,0,0,0,O>>8&255,O&255,0,0]),N.box(N.types.esds,N.esds(I)))},N.mp3=function(I){var O=I.samplerate;return N.box(N.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,I.channelCount,0,16,0,0,0,0,O>>8&255,O&255,0,0]))},N.stsd=function(I){return I.type==="audio"?!I.isAAC&&I.codec==="mp3"?N.box(N.types.stsd,N.STSD,N.mp3(I)):N.box(N.types.stsd,N.STSD,N.mp4a(I)):N.box(N.types.stsd,N.STSD,N.avc1(I))},N.tkhd=function(I){var O=I.id,L=I.duration*I.timescale,T=I.width,A=I.height,P=Math.floor(L/(Y+1)),w=Math.floor(L%(Y+1));return N.box(N.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,T>>8&255,T&255,0,0,A>>8&255,A&255,0,0]))},N.traf=function(I,O){var L=N.sdtp(I),T=I.id,A=Math.floor(O/(Y+1)),P=Math.floor(O%(Y+1));return N.box(N.types.traf,N.box(N.types.tfhd,new Uint8Array([0,0,0,0,T>>24,T>>16&255,T>>8&255,T&255])),N.box(N.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])),N.trun(I,L.length+16+20+8+16+8+8),L)},N.trak=function(I){return I.duration=I.duration||4294967295,N.box(N.types.trak,N.tkhd(I),N.mdia(I))},N.trex=function(I){var O=I.id;return N.box(N.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]))},N.trun=function(I,O){var L=I.samples||[],T=L.length,A=12+16*T,P=new Uint8Array(A),w,S,x,h,l,i;for(O+=8+A,P.set([0,0,15,1,T>>>24&255,T>>>16&255,T>>>8&255,T&255,O>>>24&255,O>>>16&255,O>>>8&255,O&255],0),w=0;w<T;w++)S=L[w],x=S.duration,h=S.size,l=S.flags,i=S.cts,P.set([x>>>24&255,x>>>16&255,x>>>8&255,x&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 N.box(N.types.trun,P)},N.initSegment=function(I){N.types||N.init();var O=N.moov(I),L=new Uint8Array(N.FTYP.byteLength+O.byteLength);return L.set(N.FTYP),L.set(O,N.FTYP.byteLength),L},N}();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,$.default=U},"./src/remux/mp4-remuxer.ts":function(oe,$,D){"use strict";D.r($),D.d($,"default",function(){return i}),D.d($,"normalizePts",function(){return c});var Y=D("./src/polyfills/number.ts"),U=D("./src/remux/aac-helper.ts"),N=D("./src/remux/mp4-generator.ts"),K=D("./src/events.ts"),I=D("./src/errors.ts"),O=D("./src/utils/logger.ts"),L=D("./src/types/loader.ts"),T=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,x=null,h=null,l=!1,i=function(){function u(d,f,s,o){if(o===void 0&&(o=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=d,this.config=f,this.typeSupported=s,this.ISGenerated=!1,x===null){var b=navigator.userAgent||"",g=b.match(/Chrome\/(\d+)/i);x=g?parseInt(g[1]):0}if(h===null){var _=navigator.userAgent.match(/Safari\/(\d+)/i);h=_?parseInt(_[1]):0}l=!!x&&x<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,o=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"),o},E.remux=function(f,s,o,b,g,_,k,H){var z,Z,G,B,te,de,pe=g,ye=g,Ce=f.pid>-1,_e=s.pid>-1,le=s.samples.length,se=f.samples.length>0,ve=le>1,ie=(!Ce||se)&&(!_e||ve)||this.ISGenerated||k;if(ie){this.ISGenerated||(G=this.generateIS(f,s,g));var q=this.isVideoContiguous,xe=-1;if(ve&&(xe=C(s.samples),!q&&this.config.forceKeyFrameOnDiscontinuity))if(de=!0,xe>0){O.logger.warn("[mp4-remuxer]: Dropped "+xe+" out of "+le+" video samples due to a missing keyframe");var Ie=this.getVideoStartPts(s.samples);s.samples=s.samples.slice(xe),s.dropped+=xe,ye+=(s.samples[0].pts-Ie)/(s.timescale||9e4)}else xe===-1&&(O.logger.warn("[mp4-remuxer]: No keyframe found out of "+le+" video samples"),de=!1);if(this.ISGenerated){if(se&&ve){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||ve||H===L.PlaylistLevelType.AUDIO?ye:void 0),ve){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 ve&&(z=this.remuxVideo(s,ye,q,0));z&&(z.firstKeyFrame=xe,z.independent=xe!==-1)}}return this.ISGenerated&&(o.samples.length&&(te=this.remuxID3(o,g)),b.samples.length&&(B=this.remuxText(b,g))),{audio:Z,video:z,initSegment:G,independent:de,text:B,id3:te}},E.generateIS=function(f,s,o){var b=f.samples,g=s.samples,_=this.typeSupported,k={},H=!Object(Y.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):N.default.initSegment([f]),metadata:{channelCount:f.channelCount}},H&&(B=f.inputTimeScale,Z=G=b[0].pts-Math.round(B*o))),s.sps&&s.pps&&g.length&&(s.timescale=s.inputTimeScale,k.video={id:"main",container:"video/mp4",codec:s.codec,initSegment:N.default.initSegment([s]),metadata:{width:s.width,height:s.height}},H)){B=s.inputTimeScale;var te=this.getVideoStartPts(g),de=Math.round(B*o);G=Math.min(G,c(g[0].dts,te)-de),Z=Math.min(Z,te-de)}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,o,b){var g=f.inputTimeScale,_=f.samples,k=[],H=_.length,z=this._initPTS,Z=this.nextAvcDts,G=8,B,te,de,pe=Number.POSITIVE_INFINITY,ye=Number.NEGATIVE_INFINITY,Ce=0,_e=!1;if(!o||Z===null){var le=s*g,se=_[0].pts-c(_[0].dts,_[0].pts);Z=le-se}for(var ve=0;ve<H;ve++){var ie=_[ve];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<_[ve>0?ve-1:ve].dts&&(_e=!0)}_e&&_.sort(function(Dt,ot){var ft=Dt.dts-ot.dts,zt=Dt.pts-ot.pts;return ft||zt}),te=_[0].dts,de=_[_.length-1].dts;var xe=Math.round((de-te)/(H-1));if(Ce<0){if(Ce<xe*-2){O.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(T.toMsFromMpegTsClock)(-xe,!0)+" ms");for(var Ie=Ce,Ne=0;Ne<H;Ne++)_[Ne].dts=Ie=Math.max(Ie,_[Ne].pts-xe),_[Ne].pts=Math.max(Ie,_[Ne].pts)}else{O.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(T.toMsFromMpegTsClock)(Ce,!0)+" ms to overcome this issue");for(var De=0;De<H;De++)_[De].dts=_[De].dts+Ce}te=_[0].dts}if(o){var Be=te-Z,Ae=Be>xe,Pe=Be<-1;if(Ae||Pe){Ae?O.logger.warn("AVC: "+Object(T.toMsFromMpegTsClock)(Be,!0)+" ms ("+Be+"dts) hole between fragments detected, filling it"):O.logger.warn("AVC: "+Object(T.toMsFromMpegTsClock)(-Be,!0)+" ms ("+Be+"dts) overlapping between fragments detected"),te=Z;var We=_[0].pts-Be;_[0].dts=te,_[0].pts=We,O.logger.log("Video: First PTS/DTS adjusted: "+Object(T.toMsFromMpegTsClock)(We,!0)+"/"+Object(T.toMsFromMpegTsClock)(te,!0)+", delta: "+Object(T.toMsFromMpegTsClock)(Be,!0)+" ms")}}l&&(te=Math.max(0,te));for(var ze=0,qe=0,Ge=0;Ge<H;Ge++){for(var ke=_[Ge],ct=ke.units,ut=ct.length,vt=0,lt=0;lt<ut;lt++)vt+=ct[lt].data.length;qe+=vt,ze+=ut,ke.length=vt,ke.dts=Math.max(ke.dts,te),ke.pts=Math.max(ke.pts,ke.dts,0),pe=Math.min(ke.pts,pe),ye=Math.max(ke.pts,ye)}de=_[H-1].dts;var Tt=qe+4*ze+8,gt;try{gt=new Uint8Array(Tt)}catch(Dt){this.observer.emit(K.Events.ERROR,K.Events.ERROR,{type:I.ErrorTypes.MUX_ERROR,details:I.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Tt,reason:"fail allocating video mdat "+Tt});return}var yt=new DataView(gt.buffer);yt.setUint32(0,Tt),gt.set(N.default.types.mdat,4);for(var Oe=0;Oe<H;Oe++){for(var Pt=_[Oe],St=Pt.units,Ue=0,Ze=0,Ee=St.length;Ze<Ee;Ze++){var fe=St[Ze],be=fe.data,ne=fe.data.byteLength;yt.setUint32(G,ne),G+=4,gt.set(be,G),G+=ne,Ue+=4+ne}if(Oe<H-1)B=_[Oe+1].dts-Pt.dts;else{var re=this.config,ae=Pt.dts-_[Oe>0?Oe-1:Oe].dts;if(re.stretchShortVideoTrack&&this.nextAudioPts!==null){var ce=Math.floor(re.maxBufferHole*g),ue=(b?pe+b*g:this.nextAudioPts)-Pt.pts;ue>ce?(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&&x&&x<70){var Le=k[0].flags;Le.dependsOn=2,Le.isNonSync=0}console.assert(B!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=Z=de+B,this.isVideoContiguous=!0;var tt=N.default.moof(f.sequenceNumber++,te,A({},f,{samples:k})),Fe="video",$e={data1:tt,data2:gt,startPTS:pe/g,endPTS:(ye+B)/g,startDTS:te/g,endDTS:Z/g,type:Fe,hasAudio:!1,hasVideo:!0,nb:k.length,dropped:f.dropped};return f.samples=[],f.dropped=0,console.assert(gt.length,"MDAT length must not be zero"),$e},E.remuxAudio=function(f,s,o,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=[],de=f.samples,pe=B?0:8,ye=this.nextAudioPts||-1,Ce=s*_;if(this.isAudioContiguous=o=o||de.length&&ye>0&&(b&&Math.abs(Ce-ye)<9e3||Math.abs(c(de[0].pts-G,Ce)-ye)<20*Z),de.forEach(function(be){be.pts=c(be.pts-G,Ce)}),!o||ye<0){if(de=de.filter(function(be){return be.pts>=0}),!de.length)return;g===0?ye=0:b?ye=Math.max(0,Ce):ye=de[0].pts}if(f.isAAC)for(var _e=g!==void 0,le=this.config.maxAudioFramesDrift,se=0,ve=ye;se<de.length;se++){var ie=de[se],q=ie.pts,xe=q-ve,Ie=Math.abs(1e3*xe/_);if(xe<=-le*Z&&_e)se===0&&(O.logger.warn("Audio frame @ "+(q/_).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*xe/_)+" ms."),this.nextAudioPts=ye=ve=q);else if(xe>=le*Z&&Ie<P&&_e){var Ne=Math.round(xe/Z);ve=q-Ne*Z,ve<0&&(Ne--,ve+=Z),se===0&&(this.nextAudioPts=ye=ve),O.logger.warn("[mp4-remuxer]: Injecting "+Ne+" audio frame @ "+(ve/_).toFixed(3)+"s due to "+Math.round(1e3*xe/_)+" ms gap.");for(var De=0;De<Ne;De++){var Be=Math.max(ve,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()),de.splice(se,0,{unit:Ae,pts:Be}),ve+=Z,se++}}ie.pts=ve,ve+=Z}for(var Pe=null,We=null,ze,qe=0,Ge=de.length;Ge--;)qe+=de[Ge].unit.byteLength;for(var ke=0,ct=de.length;ke<ct;ke++){var ut=de[ke],vt=ut.unit,lt=ut.pts;if(We!==null){var Tt=te[ke-1];Tt.duration=Math.round((lt-We)/H)}else if(o&&f.isAAC&&(lt=ye),Pe=lt,qe>0){qe+=pe;try{ze=new Uint8Array(qe)}catch(be){this.observer.emit(K.Events.ERROR,K.Events.ERROR,{type:I.ErrorTypes.MUX_ERROR,details:I.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:qe,reason:"fail allocating audio mdat "+qe});return}if(!B){var gt=new DataView(ze.buffer);gt.setUint32(0,qe),ze.set(N.default.types.mdat,4)}}else return;ze.set(vt,pe);var yt=vt.byteLength;pe+=yt,te.push(new v(!0,z,yt,0)),We=lt}var Oe=te.length;if(!Oe)return;var Pt=te[te.length-1];this.nextAudioPts=ye=We+H*Pt.duration;var St=B?new Uint8Array(0):N.default.moof(f.sequenceNumber++,Pe/H,A({},f,{samples:te}));f.samples=[];var Ue=Pe/_,Ze=ye/_,Ee="audio",fe={data1:St,data2:ze,startPTS:Ue,endPTS:Ze,startDTS:Ue,endDTS:Ze,type:Ee,hasAudio:!0,hasVideo:!1,nb:Oe};return this.isAudioContiguous=!0,console.assert(ze.length,"MDAT length must not be zero"),fe},E.remuxEmptyAudio=function(f,s,o,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 de=[],pe=0;pe<B;pe++){var ye=z+pe*G;de.push({unit:te,pts:ye,dts:ye})}return f.samples=de,this.remuxAudio(f,s,o,!1)},E.remuxID3=function(f,s){var o=f.samples.length;if(!o)return;for(var b=f.inputTimeScale,g=this._initPTS,_=this._initDTS,k=0;k<o;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 o=f.samples.length;if(!o)return;for(var b=f.inputTimeScale,g=this._initPTS,_=0;_<o;_++){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,$,D){"use strict";D.r($);var Y=D("./src/polyfills/number.ts"),U=D("./src/utils/mp4-tools.ts"),N=D("./src/loader/fragment.ts"),K=D("./src/utils/logger.ts"),I=function(){function T(){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=T.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,x){this.audioCodec=S,this.videoCodec=x,this.generateInitSegment(w),this.emitInitSegment=!0},A.generateInitSegment=function(w){var S=this.audioCodec,x=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,N.ElementaryStreamTypes.AUDIO)),x||(x=L(h.video,N.ElementaryStreamTypes.VIDEO));var l={};h.audio&&h.video?l.audiovideo={container:"video/mp4",codec:S+","+x,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:x,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,x,h,l){var i=this.initPTS,c=this.lastEndDTS,C={audio:void 0,video:void 0,text:h,id3:x,initSegment:void 0};Object(Y.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(Y.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,o=!!u.video,b="";s&&(b+="audio"),o&&(b+="video");var g={data1:v,startPTS:d,startDTS:d,endPTS:f,endDTS:f,type:b,hasAudio:s,hasVideo:o,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=x,C.initSegment=m,C},T}(),O=function(A,P,w){return Object(U.getStartDTS)(A,P)-w};function L(T,A){var P=T==null?void 0:T.codec;return P&&P.length>4?P:P==="hvc1"?"hvc1.1.c.L120.90":P==="av01"?"av01.0.04M.08":P==="avc1"||A===N.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}$.default=I},"./src/task-loop.ts":function(oe,$,D){"use strict";D.r($),D.d($,"default",function(){return Y});var Y=function(){function U(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var N=U.prototype;return N.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},N.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},N.onHandlerDestroyed=function(){},N.hasInterval=function(){return!!this._tickInterval},N.hasNextTick=function(){return!!this._tickTimer},N.setInterval=function(I){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,I),!0)},N.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},N.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},N.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},N.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},N.doTick=function(){},U}()},"./src/types/cmcd.ts":function(oe,$,D){"use strict";D.r($),D.d($,"CMCDVersion",function(){return Y}),D.d($,"CMCDObjectType",function(){return U}),D.d($,"CMCDStreamingFormat",function(){return N}),D.d($,"CMCDStreamType",function(){return K});var Y=1,U;(function(I){I.MANIFEST="m",I.AUDIO="a",I.VIDEO="v",I.MUXED="av",I.INIT="i",I.CAPTION="c",I.TIMED_TEXT="tt",I.KEY="k",I.OTHER="o"})(U||(U={}));var N;(function(I){I.DASH="d",I.HLS="h",I.SMOOTH="s",I.OTHER="o"})(N||(N={}));var K;(function(I){I.VOD="v",I.LIVE="l"})(K||(K={}))},"./src/types/level.ts":function(oe,$,D){"use strict";D.r($),D.d($,"HlsSkip",function(){return N}),D.d($,"getSkipValue",function(){return K}),D.d($,"HlsUrlParameters",function(){return I}),D.d($,"Level",function(){return O});function Y(L,T){for(var A=0;A<T.length;A++){var P=T[A];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(L,P.key,P)}}function U(L,T,A){return T&&Y(L.prototype,T),A&&Y(L,A),L}var N;(function(L){L.No="",L.Yes="YES",L.v2="v2"})(N||(N={}));function K(L,T){var A=L.canSkipUntil,P=L.canSkipDateRanges,w=L.endSN,S=T!==void 0?T-w:0;return A&&S<A?P?N.v2:N.Yes:N.No}var I=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 T=L.prototype;return T.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(T){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=[T.url],this.attrs=T.attrs,this.bitrate=T.bitrate,T.details&&(this.details=T.details),this.id=T.id||0,this.name=T.name,this.width=T.width||0,this.height=T.height||0,this.audioCodec=T.audioCodec,this.videoCodec=T.videoCodec,this.unknownCodecs=T.unknownCodecs,this.codecSet=[T.videoCodec,T.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,$,D){"use strict";D.r($),D.d($,"PlaylistContextType",function(){return Y}),D.d($,"PlaylistLevelType",function(){return U});var Y;(function(N){N.MANIFEST="manifest",N.LEVEL="level",N.AUDIO_TRACK="audioTrack",N.SUBTITLE_TRACK="subtitleTrack"})(Y||(Y={}));var U;(function(N){N.MAIN="main",N.AUDIO="audio",N.SUBTITLE="subtitle"})(U||(U={}))},"./src/types/transmuxer.ts":function(oe,$,D){"use strict";D.r($),D.d($,"ChunkMetadata",function(){return Y});var Y=function(K,I,O,L,T,A){L===void 0&&(L=0),T===void 0&&(T=-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=I,this.id=O,this.size=L,this.part=T,this.partial=A};function U(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(oe,$,D){"use strict";D.r($),D.d($,"AttrList",function(){return N});var Y=/^(\d+)x(\d+)$/,U=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,N=function(){function K(O){typeof O=="string"&&(O=K.parseAttrList(O));for(var L in O)O.hasOwnProperty(L)&&(this[L]=O[L])}var I=K.prototype;return I.decimalInteger=function(L){var T=parseInt(this[L],10);return T>Number.MAX_SAFE_INTEGER?Infinity:T},I.hexadecimalInteger=function(L){if(this[L]){var T=(this[L]||"0x").slice(2);T=(T.length&1?"0":"")+T;for(var A=new Uint8Array(T.length/2),P=0;P<T.length/2;P++)A[P]=parseInt(T.slice(P*2,P*2+2),16);return A}else return null},I.hexadecimalIntegerAsNumber=function(L){var T=parseInt(this[L],16);return T>Number.MAX_SAFE_INTEGER?Infinity:T},I.decimalFloatingPoint=function(L){return parseFloat(this[L])},I.optionalFloat=function(L,T){var A=this[L];return A?parseFloat(A):T},I.enumeratedString=function(L){return this[L]},I.bool=function(L){return this[L]==="YES"},I.decimalResolution=function(L){var T=Y.exec(this[L]);return T===null?void 0:{width:parseInt(T[1],10),height:parseInt(T[2],10)}},K.parseAttrList=function(L){var T,A={},P='"';for(U.lastIndex=0;(T=U.exec(L))!==null;){var w=T[2];w.indexOf(P)===0&&w.lastIndexOf(P)===w.length-1&&(w=w.slice(1,-1)),A[T[1]]=w}return A},K}()},"./src/utils/binary-search.ts":function(oe,$,D){"use strict";D.r($);var Y={search:function(N,K){for(var I=0,O=N.length-1,L=null,T=null;I<=O;){L=(I+O)/2|0,T=N[L];var A=K(T);if(A>0)I=L+1;else if(A<0)O=L-1;else return T}return null}};$.default=Y},"./src/utils/buffer-helper.ts":function(oe,$,D){"use strict";D.r($),D.d($,"BufferHelper",function(){return N});var Y=D("./src/utils/logger.ts"),U={length:0,start:function(){return 0},end:function(){return 0}},N=function(){function K(){}return K.isBuffered=function(O,L){try{if(O){for(var T=K.getBuffered(O),A=0;A<T.length;A++)if(L>=T.start(A)&&L<=T.end(A))return!0}}catch(P){}return!1},K.bufferInfo=function(O,L,T){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,T)}}catch(S){}return{len:0,start:L,end:L,nextStart:void 0}},K.bufferedInfo=function(O,L,T){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(T)for(var P=0;P<O.length;P++){var w=A.length;if(w){var S=A[w-1].end;O[P].start-S<T?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 x=0,h,l=L,i=L,c=0;c<A.length;c++){var C=A[c].start,v=A[c].end;if(L+T>=C&&L<v)l=C,i=v,x=i-L;else if(L+T<C){h=C;break}}return{len:x,start:l||0,end:i||0,nextStart:h}},K.getBuffered=function(O){try{return O.buffered}catch(L){return Y.logger.log("failed to get media.buffered",L),U}},K}()},"./src/utils/cea-608-parser.ts":function(oe,$,D){"use strict";D.r($),D.d($,"Row",function(){return i}),D.d($,"CaptionScreen",function(){return c});var Y=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},N=function(f){var s=f;return U.hasOwnProperty(f)&&(s=U[f]),String.fromCharCode(s)},K=15,I=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},T={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(o,b){this.verboseLevel>=o&&Y.logger.log(this.time+" ["+o+"] "+b)},d}(),x=function(f){for(var s=[],o=0;o<f.length;o++)s.push(f[o].toString(16));return s},h=function(){function d(s,o,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=o||!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(o){for(var b=["foreground","underline","italics","background","flash"],g=0;g<b.length;g++){var _=b[g];o.hasOwnProperty(_)&&(this[_]=o[_])}},f.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},f.equals=function(o){return this.foreground===o.foreground&&this.underline===o.underline&&this.italics===o.italics&&this.background===o.background&&this.flash===o.flash},f.copy=function(o){this.foreground=o.foreground,this.underline=o.underline,this.italics=o.italics,this.background=o.background,this.flash=o.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,o,b,g,_,k){this.uchar=void 0,this.penState=void 0,this.uchar=s||" ",this.penState=new h(o,b,g,_,k)}var f=d.prototype;return f.reset=function(){this.uchar=" ",this.penState.reset()},f.setChar=function(o,b){this.uchar=o,this.penState.copy(b)},f.setPenState=function(o){this.penState.copy(o)},f.equals=function(o){return this.uchar===o.uchar&&this.penState.equals(o.penState)},f.copy=function(o){this.uchar=o.uchar,this.penState.copy(o.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 o=0;o<I;o++)this.chars.push(new l);this.logger=s,this.pos=0,this.currPenState=new h}var f=d.prototype;return f.equals=function(o){for(var b=!0,g=0;g<I;g++)if(!this.chars[g].equals(o.chars[g])){b=!1;break}return b},f.copy=function(o){for(var b=0;b<I;b++)this.chars[b].copy(o.chars[b])},f.isEmpty=function(){for(var o=!0,b=0;b<I;b++)if(!this.chars[b].isEmpty()){o=!1;break}return o},f.setCursor=function(o){this.pos!==o&&(this.pos=o),this.pos<0?(this.logger.log(w.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>I&&(this.logger.log(w.DEBUG,"Too large cursor position "+this.pos),this.pos=I)},f.moveCursor=function(o){var b=this.pos+o;if(o>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(o){o>=144&&this.backSpace();var b=N(o);if(this.pos>=I){this.logger.log(w.ERROR,"Cannot insert "+o.toString(16)+" ("+b+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(b,this.currPenState),this.moveCursor(1)},f.clearFromPos=function(o){var b;for(b=o;b<I;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 o=[],b=!0,g=0;g<I;g++){var _=this.chars[g].uchar;_!==" "&&(b=!1),o.push(_)}return b?"":o.join("")},f.setPenStyles=function(o){this.currPenState.setStyles(o);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 o=0;o<K;o++)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 o=0;o<K;o++)this.rows[o].clear();this.currRow=K-1},f.equals=function(o){for(var b=!0,g=0;g<K;g++)if(!this.rows[g].equals(o.rows[g])){b=!1;break}return b},f.copy=function(o){for(var b=0;b<K;b++)this.rows[b].copy(o.rows[b])},f.isEmpty=function(){for(var o=!0,b=0;b<K;b++)if(!this.rows[b].isEmpty()){o=!1;break}return o},f.backSpace=function(){var o=this.rows[this.currRow];o.backSpace()},f.clearToEndOfRow=function(){var o=this.rows[this.currRow];o.clearToEndOfRow()},f.insertChar=function(o){var b=this.rows[this.currRow];b.insertChar(o)},f.setPen=function(o){var b=this.rows[this.currRow];b.setPenStyles(o)},f.moveCursor=function(o){var b=this.rows[this.currRow];b.moveCursor(o)},f.setCursor=function(o){this.logger.log(w.INFO,"setCursor: "+o);var b=this.rows[this.currRow];b.setCursor(o)},f.setPAC=function(o){this.logger.log(w.INFO,"pacData = "+JSON.stringify(o));var b=o.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(o.indent!==null){var B=o.indent,te=Math.max(B-1,0);G.setCursor(o.indent),o.color=G.chars[te].penState.foreground}var de={foreground:o.color,underline:o.underline,italics:o.italics,background:"black",flash:!1};this.setPen(de)},f.setBkgData=function(o){this.logger.log(w.INFO,"bkgData = "+JSON.stringify(o)),this.backSpace(),this.setPen(o),this.insertChar(32)},f.setRollUpRows=function(o){this.nrRollUpRows=o},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 o=this.currRow+1-this.nrRollUpRows,b=this.rows.splice(o,1)[0];b.clear(),this.rows.splice(this.currRow,0,b),this.logger.log(w.INFO,"Rolling up")},f.getDisplayText=function(o){o=o||!1;for(var b=[],g="",_=-1,k=0;k<K;k++){var H=this.rows[k].getTextString();H&&(_=k+1,o?b.push("Row "+_+": '"+H+"'"):b.push(H.trim()))}return b.length>0&&(o?g="["+b.join(" | ")+"]":g=b.join(`
`)),g},f.getTextAndFormat=function(){return this.rows},d}(),C=function(){function d(s,o,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=o,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(o){this.outputFilter=o},f.setPAC=function(o){this.writeScreen.setPAC(o)},f.setBkgData=function(o){this.writeScreen.setBkgData(o)},f.setMode=function(o){if(o===this.mode)return;this.mode=o,this.logger.log(w.INFO,"MODE="+o),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=o},f.insertChars=function(o){for(var b=0;b<o.length;b++)this.writeScreen.insertChar(o[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(o){this.logger.log(w.INFO,"RU("+o+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(o)},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 o=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=o,this.writeScreen=this.nonDisplayedMemory,this.logger.log(w.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},f.ccTO=function(o){this.logger.log(w.INFO,"TO("+o+") - Tab Offset"),this.writeScreen.moveCursor(o)},f.ccMIDROW=function(o){var b={flash:!1};if(b.underline=o%2===1,b.italics=o>=46,b.italics)b.foreground="white";else{var g=Math.floor(o/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(o){o===void 0&&(o=!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),o&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:b),this.lastOutputScreen.copy(this.displayedMemory))},f.cueSplitAtTime=function(o){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,o,this.displayedMemory),this.cueStartTime=o))},d}(),v=function(){function d(s,o,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,o,g),new C(s+1,b,g)],this.cmdHistory=E(),this.logger=g}var f=d.prototype;return f.getHandler=function(o){return this.channels[o].getHandler()},f.setHandler=function(o,b){this.channels[o].setHandler(b)},f.addData=function(o,b){var g,_,k,H=!1;this.logger.time=o;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,"["+x([b[z],b[z+1]])+"] -> ("+x([_,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 "+x([_,k])+" orig: "+x([b[z],b[z+1]]))}},f.parseCmd=function(o,b){var g=this.cmdHistory,_=(o===20||o===28||o===21||o===29)&&b>=32&&b<=47,k=(o===23||o===31)&&b>=33&&b<=35;if(!(_||k))return!1;if(u(o,b,g))return m(null,null,g),this.logger.log(w.DEBUG,"Repeated command ("+x([o,b])+") is dropped"),!0;var H=o===20||o===21||o===23?1:2,z=this.channels[H];return o===20||o===21||o===28||o===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(o,b,g),this.currentChannel=H,!0},f.parseMidrow=function(o,b){var g=0;if((o===17||o===25)&&b>=32&&b<=47){if(o===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 ("+x([o,b])+")"),!0):!1}return!1},f.parsePAC=function(o,b){var g,_=this.cmdHistory,k=(o>=17&&o<=23||o>=25&&o<=31)&&b>=64&&b<=127,H=(o===16||o===24)&&b>=64&&b<=95;if(!(k||H))return!1;if(u(o,b,_))return m(null,null,_),!0;var z=o<=23?1:2;b>=64&&b<=95?g=z===1?O[o]:T[o]:g=z===1?L[o]:A[o];var Z=this.channels[z];return Z?(Z.setPAC(this.interpretPAC(g,b)),m(o,b,_),this.currentChannel=z,!0):!1},f.interpretPAC=function(o,b){var g,_={color:null,italics:!1,indent:null,underline:!1,row:o};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(o,b){var g,_=null,k=null;if(o>=25?(g=2,k=o-8):(g=1,k=o),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 '"+N(H)+"' in channel "+g),_=[H]}else o>=32&&o<=127&&(_=b===0?[o]:[o,b]);if(_){var z=x(_);this.logger.log(w.DEBUG,"Char codes = "+z.join(",")),m(o,b,this.cmdHistory)}return _},f.parseBackgroundAttributes=function(o,b){var g=(o===16||o===24)&&b>=32&&b<=47,_=(o===23||o===31)&&b>=45&&b<=47;if(!(g||_))return!1;var k,H={};o===16||o===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=o<=23?1:2,Z=this.channels[z];return Z.setBkgData(H),m(o,b,this.cmdHistory),!0},f.reset=function(){for(var o=0;o<Object.keys(this.channels).length;o++){var b=this.channels[o];b&&b.reset()}this.cmdHistory=E()},f.cueSplitAtTime=function(o){for(var b=0;b<this.channels.length;b++){var g=this.channels[b];g&&g.cueSplitAtTime(o)}},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}}$.default=v},"./src/utils/codecs.ts":function(oe,$,D){"use strict";D.r($),D.d($,"isCodecType",function(){return U}),D.d($,"isCodecSupportedInMp4",function(){return N});var Y={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,I){var O=Y[I];return!!O&&O[K.slice(0,4)]===!0}function N(K,I){return MediaSource.isTypeSupported((I||"video")+'/mp4;codecs="'+K+'"')}},"./src/utils/cues.ts":function(oe,$,D){"use strict";D.r($);var Y=D("./src/utils/vttparser.ts"),U=D("./src/utils/webvtt-parser.ts"),N=D("./src/utils/texttrack-utils.ts"),K=/\s/,I={newCue:function(L,T,A,P){for(var w=[],S,x,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=T,T===A&&(A+=1e-4),l>=16?l--:l++;var m=Object(Y.fixLineBreaks)(i.trim()),u=Object(U.generateCueId)(T,A,m);(!L||!L.cues||!L.cues.getCueById(u))&&(x=new c(T,A,m),x.id=u,x.line=C+1,x.align="left",x.position=10+Math.min(80,Math.floor(l*8/32)*10),w.push(x))}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(N.addCueToTrack)(L,E)})),w}};$.default=I},"./src/utils/discontinuities.ts":function(oe,$,D){"use strict";D.r($),D.d($,"findFirstFragWithCC",function(){return K}),D.d($,"shouldAlignOnDiscontinuities",function(){return I}),D.d($,"findDiscontinuousReferenceFrag",function(){return O}),D.d($,"adjustSlidingStart",function(){return T}),D.d($,"alignStream",function(){return A}),D.d($,"alignPDT",function(){return w}),D.d($,"alignFragmentByPDTDelta",function(){return S}),D.d($,"alignMediaPlaylistByPDT",function(){return x});var Y=D("./src/polyfills/number.ts"),U=D("./src/utils/logger.ts"),N=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 I(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 T(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(N.adjustSliding)(l.details,i)}function P(h,l,i){if(I(h,i,l)){var c=O(i.details,l);c&&Object(Y.isFiniteNumber)(c.start)&&(U.logger.log("Adjusting PTS using last level due to CC increase within current level "+l.url),T(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(Y.isFiniteNumber)(C)&&(U.logger.log("Adjusting PTS using programDateTime delta "+(c-i)+"ms, sliding:"+C.toFixed(3)+" "+h.url+" "),T(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 x(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,$,D){"use strict";D.r($);var Y=D("./src/utils/ewma.ts"),U=function(){function N(I,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 Y.default(I),this.fast_=new Y.default(O)}var K=N.prototype;return K.update=function(O,L){var T=this.slow_,A=this.fast_;this.slow_.halfLife!==O&&(this.slow_=new Y.default(O,T.getEstimate(),T.getTotalWeight())),this.fast_.halfLife!==L&&(this.fast_=new Y.default(L,A.getEstimate(),A.getTotalWeight()))},K.sample=function(O,L){O=Math.max(O,this.minDelayMs_);var T=8*L,A=O/1e3,P=T/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(){},N}();$.default=U},"./src/utils/ewma.ts":function(oe,$,D){"use strict";D.r($);var Y=function(){function U(K,I,O){I===void 0&&(I=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_=I,this.totalWeight_=O}var N=U.prototype;return N.sample=function(I,O){var L=Math.pow(this.alpha_,I);this.estimate_=O*(1-L)+L*this.estimate_,this.totalWeight_+=I},N.getTotalWeight=function(){return this.totalWeight_},N.getEstimate=function(){if(this.alpha_){var I=1-Math.pow(this.alpha_,this.totalWeight_);if(I)return this.estimate_/I}return this.estimate_},U}();$.default=Y},"./src/utils/fetch-loader.ts":function(oe,$,D){"use strict";D.r($),D.d($,"fetchSupported",function(){return S});var Y=D("./src/polyfills/number.ts"),U=D("./src/loader/load-stats.ts"),N=D("./src/demux/chunk-cache.ts");function K(c,C){c.prototype=Object.create(C.prototype),c.prototype.constructor=c,A(c,C)}function I(c){var C=typeof Map=="function"?new Map:void 0;return I=function(m){if(m===null||!T(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)},I(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),o=new s;return d&&A(o,d.prototype),o},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 T(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 x=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),o=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"),o&&Object(Y.isFiniteNumber)(u.highWaterMark)?d.loadProgressively(_,f,m,u.highWaterMark,o):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:_};o&&!Object(Y.isFiniteNumber)(u.highWaterMark)&&o(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 N.default,o=m.body.getReader(),b=function g(){return o.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}(I(Error));$.default=x},"./src/utils/imsc1-ttml-parser.ts":function(oe,$,D){"use strict";D.r($),D.d($,"IMSC1_CODEC",function(){return T}),D.d($,"parseIMSC1",function(){return S});var Y=D("./src/utils/mp4-tools.ts"),U=D("./src/utils/vttparser.ts"),N=D("./src/utils/vttcue.ts"),K=D("./src/demux/id3.ts"),I=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 o in s)Object.prototype.hasOwnProperty.call(s,o)&&(d[o]=s[o])}return d},L.apply(this,arguments)}var T="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,o,b){var g=Object(Y.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(I.toTimescaleFromScale)(f,1,s);try{o(x(k,H))}catch(z){b(z)}}function x(d,f){var s=new DOMParser,o=s.parseFromString(d,"text/xml"),b=o.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"),_),de=m(G.getAttribute("dur"),_),pe=m(G.getAttribute("end"),_);if(te===null)throw v(G);if(pe===null){if(de===null)throw v(G);pe=te+de}var ye=new N.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 ve=w[se];ve&&(ye.lineAlign=ve),ye.align=se}return L(ye,le),ye}).filter(function(G){return G!==null})}function h(d,f,s){var o=d.getElementsByTagName(f)[0];return o?[].slice.call(o.querySelectorAll(s)):[]}function l(d){return d.reduce(function(f,s){var o=s.getAttribute("xml:id");return o&&(f[o]=s),f},{})}function i(d,f){return[].slice.call(d.childNodes).reduce(function(s,o,b){var g;return o.nodeName==="br"&&b?s+`
`:(g=o.childNodes)!==null&&g!==void 0&&g.length?i(o,f):f?s+o.textContent.trim().replace(/\s+/g," "):s+o.textContent},"")}function c(d,f){var s="http://www.w3.org/ns/ttml#styling",o=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return o.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),o=(s[4]|0)+(s[5]|0)/f.subFrameRate;return(s[1]|0)*3600+(s[2]|0)*60+(s[3]|0)+o/f.frameRate}function E(d,f){var s=P.exec(d),o=Number(s[1]),b=s[2];switch(b){case"h":return o*3600;case"m":return o*60;case"ms":return o*1e3;case"f":return o/f.frameRate;case"t":return o/f.tickRate}return o}},"./src/utils/logger.ts":function(oe,$,D){"use strict";D.r($),D.d($,"enableLogs",function(){return O}),D.d($,"logger",function(){return L});var Y=function(){},U={trace:Y,debug:Y,log:Y,warn:Y,info:Y,error:Y},N=U;function K(T){var A=self.console[T];return A?A.bind(self.console,"["+T+"] >"):Y}function I(T){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){N[S]=T[S]?T[S].bind(T):K(S)})}function O(T){if(self.console&&T===!0||typeof T=="object"){I(T,"debug","log","info","warn","error");try{N.log()}catch(A){N=U}}else N=U}var L=N},"./src/utils/mediakeys-helper.ts":function(oe,$,D){"use strict";D.r($),D.d($,"KeySystems",function(){return Y}),D.d($,"requestMediaKeySystemAccess",function(){return U});var Y;(function(N){N.WIDEVINE="com.widevine.alpha",N.PLAYREADY="com.microsoft.playready"})(Y||(Y={}));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,$,D){"use strict";D.r($),D.d($,"getMediaSource",function(){return Y});function Y(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(oe,$,D){"use strict";D.r($),D.d($,"bin2str",function(){return I}),D.d($,"readUint16",function(){return O}),D.d($,"readUint32",function(){return L}),D.d($,"writeUint32",function(){return T}),D.d($,"findBox",function(){return A}),D.d($,"parseSegmentIndex",function(){return P}),D.d($,"parseInitSegment",function(){return w}),D.d($,"getStartDTS",function(){return S}),D.d($,"getDuration",function(){return x}),D.d($,"computeRawDurationFromSamples",function(){return h}),D.d($,"offsetStartDTS",function(){return l}),D.d($,"segmentValidRange",function(){return i}),D.d($,"appendUint8Array",function(){return c});var Y=D("./src/utils/typed-array.ts"),U=D("./src/loader/fragment.ts"),N=Math.pow(2,32)-1,K=[].push;function I(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 T(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),o=I(u.subarray(f+4,f+8)),b=s>1?f+s:d;if(o===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],o=s===0?8:16,b=L(f,o);o+=4;var g=0,_=0;s===0?o+=8:o+=16,o+=2;var k=f.end+_,H=O(f,o);o+=2;for(var z=0;z<H;z++){var Z=o,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 de=L(f,Z);Z+=4,d.push({referenceSize:B,subsegmentDuration:de,info:{duration:de/b,start:k,end:k+B-1}}),k+=B,Z+=4,o=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,o=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=I(_.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=I(z.data.subarray(z.start+12,z.start+16))),v[o]={timescale:g,type:H},v[H]={timescale:g,id:o,codec:Z}}}}}}var G=A(C,["moov","mvex","trex"]);return G.forEach(function(B){var te=L(B,4),de=v[te];de&&(de.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,o){var b=L(o,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 x(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],o=A(s,["tfhd"])[0],b=L(o,4),g=v[b];if(!g)continue;var _=g.default,k=L(o,0)|(_==null?void 0:_.flags),H=_==null?void 0:_.duration;k&8&&(k&2?H=L(o,12):H=L(o,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(de,pe){return de+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(o){var b=o.data[o.start],g=L(o,4);if(b===0)T(o,4,g-m*s);else{g*=Math.pow(2,32),g+=L(o,8),g-=m*s,g=Math.max(g,0);var _=Math.floor(g/(N+1)),k=Math.floor(g%(N+1));T(o,4,_),T(o,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(Y.sliceUint8)(C,0,u.start-8),v.remainder=Object(Y.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,$,D){"use strict";D.r($),D.d($,"default",function(){return Y});var Y=function(){function U(K,I){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=K,this.trackName=I}var N=U.prototype;return N.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},N.newCue=function(I,O,L){(this.startTime===null||this.startTime>I)&&(this.startTime=I),this.endTime=O,this.screen=L,this.timelineController.createCaptionsTrack(this.trackName)},N.reset=function(){this.cueRanges=[]},U}()},"./src/utils/texttrack-utils.ts":function(oe,$,D){"use strict";D.r($),D.d($,"sendAddTrackEvent",function(){return U}),D.d($,"addCueToTrack",function(){return N}),D.d($,"clearCurrentCues",function(){return K}),D.d($,"removeCuesInRange",function(){return I}),D.d($,"getCuesInRange",function(){return L});var Y=D("./src/utils/logger.ts");function U(T,A){var P;try{P=new Event("addtrack")}catch(w){P=document.createEvent("Event"),P.initEvent("addtrack",!1,!1)}P.track=T,A.dispatchEvent(P)}function N(T,A){var P=T.mode;if(P==="disabled"&&(T.mode="hidden"),T.cues&&!T.cues.getCueById(A.id))try{if(T.addCue(A),!T.cues.getCueById(A.id))throw new Error("addCue is failed for: "+A)}catch(S){Y.logger.debug("[texttrack-utils]: "+S);var w=new self.TextTrackCue(A.startTime,A.endTime,A.text);w.id=A.id,T.addCue(w)}P==="disabled"&&(T.mode=P)}function K(T){var A=T.mode;if(A==="disabled"&&(T.mode="hidden"),T.cues)for(var P=T.cues.length;P--;)T.removeCue(T.cues[P]);A==="disabled"&&(T.mode=A)}function I(T,A,P){var w=T.mode;if(w==="disabled"&&(T.mode="hidden"),T.cues&&T.cues.length>0)for(var S=L(T.cues,A,P),x=0;x<S.length;x++)T.removeCue(S[x]);w==="disabled"&&(T.mode=w)}function O(T,A){if(A<T[0].startTime)return 0;var P=T.length-1;if(A>T[P].endTime)return-1;for(var w=0,S=P;w<=S;){var x=Math.floor((S+w)/2);if(A<T[x].startTime)S=x-1;else if(A>T[x].startTime&&w<P)w=x+1;else return x}return T[w].startTime-A<A-T[S].startTime?w:S}function L(T,A,P){var w=[],S=O(T,A);if(S>-1)for(var x=S,h=T.length;x<h;x++){var l=T[x];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,$,D){"use strict";D.r($);var Y={toString:function(N){for(var K="",I=N.length,O=0;O<I;O++)K+="["+N.start(O).toFixed(3)+","+N.end(O).toFixed(3)+"]";return K}};$.default=Y},"./src/utils/timescale-conversion.ts":function(oe,$,D){"use strict";D.r($),D.d($,"toTimescaleFromBase",function(){return U}),D.d($,"toTimescaleFromScale",function(){return N}),D.d($,"toMsFromMpegTsClock",function(){return K}),D.d($,"toMpegTsClockFromTimescale",function(){return I});var Y=9e4;function U(O,L,T,A){T===void 0&&(T=1),A===void 0&&(A=!1);var P=O*L*T;return A?Math.round(P):P}function N(O,L,T,A){return T===void 0&&(T=1),A===void 0&&(A=!1),U(O,L,1/T,A)}function K(O,L){return L===void 0&&(L=!1),U(O,1e3,1/Y,L)}function I(O,L){return L===void 0&&(L=1),U(O,Y,1/L)}},"./src/utils/typed-array.ts":function(oe,$,D){"use strict";D.r($),D.d($,"sliceUint8",function(){return Y});function Y(U,N,K){return Uint8Array.prototype.slice?U.slice(N,K):new Uint8Array(Array.prototype.slice.call(U,N,K))}},"./src/utils/vttcue.ts":function(oe,$,D){"use strict";D.r($),$.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var Y=["","lr","rl"],U=["start","middle","end","left","right"];function N(T,A){if(typeof A!="string")return!1;if(!Array.isArray(T))return!1;var P=A.toLowerCase();return~T.indexOf(P)?P:!1}function K(T){return N(Y,T)}function I(T){return N(U,T)}function O(T){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 x=arguments[S];for(var h in x)T[h]=x[h]}return T}function L(T,A,P){var w=this,S={enumerable:!0};w.hasBeenReset=!1;var x="",h=!1,l=T,i=A,c=P,C=null,v="",m=!0,u="auto",E="start",d=50,f="middle",s=50,o="middle";Object.defineProperty(w,"id",O({},S,{get:function(){return x},set:function(g){x=""+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 _=I(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 _=I(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 o},set:function(g){var _=I(g);if(!_)throw new SyntaxError("An invalid or illegal string was specified.");o=_,this.hasBeenReset=!0}})),w.displayState=void 0}return L.prototype.getCueAsHTML=function(){var T=self.WebVTT;return T.convertCueToDOMTree(self,this.text)},L}()},"./src/utils/vttparser.ts":function(oe,$,D){"use strict";D.r($),D.d($,"parseTimeStamp",function(){return N}),D.d($,"fixLineBreaks",function(){return A}),D.d($,"VTTParser",function(){return P});var Y=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 N(w){function S(h,l,i,c){return(h|0)*3600+(l|0)*60+(i|0)+parseFloat(c||0)}var x=w.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return x?parseFloat(x[2])>59?S(x[2],x[3],0,x[4]):S(x[1],x[2],x[3],x[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 I(w,S,x,h){var l=h?w.split(h):[w];for(var i in l){if(typeof l[i]!="string")continue;var c=l[i].split(x);if(c.length!==2)continue;var C=c[0],v=c[1];S(C,v)}}var O=new Y.default(0,0,""),L=O.align==="middle"?"middle":"center";function T(w,S,x){var h=w;function l(){var C=N(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;I(C,function(d,f){var s;switch(d){case"region":for(var o=x.length-1;o>=0;o--)if(x[o].id===f){m.set(d,x[o].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){I(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 Y.default(0,0,""),l.state="CUE",C.indexOf("-->")===-1){l.cue.id=C;continue}case"CUE":if(!l.cue){l.state="BADCUE";continue}try{T(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,$,D){"use strict";D.r($),D.d($,"generateCueId",function(){return P}),D.d($,"parseWebVTT",function(){return S});var Y=D("./src/polyfills/number.ts"),U=D("./src/utils/vttparser.ts"),N=D("./src/demux/id3.ts"),K=D("./src/utils/timescale-conversion.ts"),I=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},T=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(Y.isFiniteNumber)(l)||!Object(Y.isFiniteNumber)(i)||!Object(Y.isFiniteNumber)(c)||!Object(Y.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(x,h,l){return A(x.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(x,h,l,i,c,C,v,m){var u=new U.VTTParser,E=Object(N.utf8ArrayToStr)(new Uint8Array(x)).trim().replace(O,`
`).split(`
`),d=[],f=Object(K.toMpegTsClockFromTimescale)(h,l),s="00:00.000",o=0,b=0,g,_=!0,k=!1;u.oncue=function(H){var z=i[c],Z=i.ccOffset,G=(o-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(I.normalizePts)((H.startTime+Z-b)*9e4,C*9e4)/9e4;H.startTime=te,H.endTime=te+B}var de=H.text.trim();H.text=decodeURIComponent(encodeURIComponent(de)),H.id||(H.id=P(H.startTime,H.endTime,de)),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:")&&(o=parseInt(z.substr(7)))});try{b=T(s)/1e3}catch(z){k=!1,g=z}return}else H===""&&(_=!1);u.parse(H+`
`)}),u.flush()}},"./src/utils/xhr-loader.ts":function(oe,$,D){"use strict";D.r($);var Y=D("./src/utils/logger.ts"),U=D("./src/loader/load-stats.ts"),N=/^age:\s*[\d.]+\s*$/m,K=function(){function I(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=I.prototype;return O.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},O.abortInternal=function(){var T=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),T&&(T.onreadystatechange=null,T.onprogress=null,T.readyState!==4&&(this.stats.aborted=!0,T.abort()))},O.abort=function(){var T;this.abortInternal(),(T=this.callbacks)!==null&&T!==void 0&&T.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},O.load=function(T,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=T,this.config=A,this.callbacks=P,this.retryDelay=A.retryDelay,this.loadInternal()},O.loadInternal=function(){var T=this.config,A=this.context;if(!T)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 x=this.context.headers;if(x)for(var h in x)P.setRequestHeader(h,x[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),T.timeout),P.send()},O.readystatechange=function(){var T=this.context,A=this.loader,P=this.stats;if(!T||!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 x=A.status;if(x>=200&&x<300){P.loading.end=Math.max(self.performance.now(),P.loading.first);var h,l;if(T.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,T,h,A),!this.callbacks)return;var c={url:A.responseURL,data:h};this.callbacks.onSuccess(c,P,T,A)}else P.retry>=S.maxRetry||x>=400&&x<499?(Y.logger.error(x+" while loading "+T.url),this.callbacks.onError({code:x,text:A.statusText},T,A)):(Y.logger.warn(x+" while loading "+T.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(){Y.logger.warn("timeout while loading "+this.context.url);var T=this.callbacks;T&&(this.abortInternal(),T.onTimeout(this.stats,this.context,this.loader))},O.loadprogress=function(T){var A=this.stats;A.loaded=T.loaded,T.lengthComputable&&(A.total=T.total)},O.getCacheAge=function(){var T=null;if(this.loader&&N.test(this.loader.getAllResponseHeaders())){var A=this.loader.getResponseHeader("age");T=A?parseFloat(A):null}return T},I}();$.default=K}}).default})},vHTk:function(rt,Xe,X){rt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);